From f59ad68ab743290f440b644aa427b3375775755d Mon Sep 17 00:00:00 2001 From: Andrea Bianco Date: Thu, 7 Feb 2019 13:40:42 +0100 Subject: [PATCH] Built motion from commit (unavailable).|2.0.75 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/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/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/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/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/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/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/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/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/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/migrations/2.0.75.js | 4 ---- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/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/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/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 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.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/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/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/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 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- 973 files changed, 972 insertions(+), 976 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8132312..a8fff90 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.0.75", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or a xCALLY API token.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H "Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo" https://motion.xcally.com/api/users\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2019-02-07T11:20:18.376Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); +define({ "name": "xCALLY Motion API", "version": "2.0.75", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or a xCALLY API token.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H "Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo" https://motion.xcally.com/api/users\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2019-02-07T12:34:30.721Z", "url": "http://apidocjs.com", "version": "0.17.7" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 558e8c7..327f856 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.0.75", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or a xCALLY API token.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H "Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo" https://motion.xcally.com/api/users\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2019-02-07T11:20:18.376Z", "url": "http://apidocjs.com", "version": "0.17.7" } } +{ "name": "xCALLY Motion API", "version": "2.0.75", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { "title": "Introduction", "content": "

The API

\n

This is the documentation for the xCALLY MOTION API.

\n

We make changes to the APIs from time to time. For more information, see Changelog.

\n

The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.

\n

The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].

\n

Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:

\n
GET /api/users\n
\n

Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:

\n
https://motion.xcally.com/api/users\n
\n

Curly braces, {}, indicate values you have to supply. Example:

\n
GET  /api/users/{id}\n
\n

The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].

\n

The examples use basic authentication requiring a xCALLY username and password.

\n

Security and Authentication

\n

This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token.

\n

Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or a xCALLY API token.

\n

Basic authentication

\n

Use the following authentication format with your username and password:\n{username}:{password}

\n

Example:

\n
curl -u admin:password https://motion.xcally.com/api/users\n
\n

OAuth access token

\n

The xCALLY API supports OAuth authorization flows.

\n

OAuth access tokens also permit client-side API requests.

\n

In your requests, specify the access token in an Authorization header as follows:\nAuthorization: Bearer {token}

\n

Example:

\n
curl -H "Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo" https://motion.xcally.com/api/users\n
\n

Request Format

\n

The xCALLY API is a JSON API. You must supply a Content-Type: application/json header in PUT and POST requests. You must set an Accept: application/json header on all requests. You may get a text/plain response in case of an error like a bad request. You should treat this as an error you need to fix.

\n

Response Format

\n

The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.

\n

Responses may have the status codes described in the following sections.

\n

200 range

\n

The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.

\n

400 range

\n

The request was not successful. The content type of the response may be text/plain for API-level error messages, such as when trying to call the API without SSL. The content type is application/json for business-level error messages because the response includes a JSON object with information about the error.

\n

If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.

\n

500 range

\n

When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.

\n

If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.

\n

Data Types

\n

The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.

\n

ID integers

\n

Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.

\n

The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.

\n

Time stamps

\n

Time stamps use UTC time and are formatted as ISO 8601 strings. Example: 2017-04-16T09:14:57Z

\n" }, "template": { "withGenerator": false, "withCompare": false, "forceLanguage": "en" }, "sampleUrl": false, "defaultVersion": "0.0.0", "apidoc": "0.3.0", "generator": { "name": "apidoc", "time": "2019-02-07T12:34:30.721Z", "url": "http://apidocjs.com", "version": "0.17.7" } } diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index 840c6d0..dbfdbd6 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 _0xbb17=['motionbar','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT','sequelize','exports','VIRTUAL','getDataValue','contactManager'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xbb17,0x126));var _0x7bb1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbb17[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x7bb1('0x0'));module[_0x7bb1('0x1')]={'name':{'type':Sequelize[_0x7bb1('0x2')],'get':function(_0x5b9b60){return this[_0x7bb1('0x3')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7bb1('0x4'),'integration',_0x7bb1('0x5'),'jscripty','urlForward',_0x7bb1('0x6')]],'msg':_0x7bb1('0x7')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser'},'data1':{'type':Sequelize[_0x7bb1('0x8')](0x1000),'comment':_0x7bb1('0x9')},'data2':{'type':Sequelize[_0x7bb1('0x8')](0x1000),'comment':_0x7bb1('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x7bb1('0xb')},'data4':{'type':Sequelize[_0x7bb1('0x8')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x7bb1('0x8')]},'data7':{'type':Sequelize[_0x7bb1('0xc')]}}; \ No newline at end of file +var _0x2ecc=['VIRTUAL','getDataValue','jscripty','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser','STRING','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT'];(function(_0xf0d4e8,_0x2685dc){var _0x51c410=function(_0xcae505){while(--_0xcae505){_0xf0d4e8['push'](_0xf0d4e8['shift']());}};_0x51c410(++_0x2685dc);}(_0x2ecc,0x19a));var _0xc2ec=function(_0x4e1c59,_0x487423){_0x4e1c59=_0x4e1c59-0x0;var _0x3b5278=_0x2ecc[_0x4e1c59];return _0x3b5278;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc2ec('0x0')],'get':function(_0x1f2140){return this[_0xc2ec('0x1')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[['contactManager','integration','motionbar',_0xc2ec('0x2'),'urlForward',_0xc2ec('0x3')]],'msg':_0xc2ec('0x4')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser'},'data1':{'type':Sequelize[_0xc2ec('0x5')](0x1000),'comment':_0xc2ec('0x6')},'data2':{'type':Sequelize[_0xc2ec('0x5')](0x1000),'comment':_0xc2ec('0x7')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xc2ec('0x8')},'data4':{'type':Sequelize[_0xc2ec('0x5')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0xc2ec('0x9')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index c1c89e7..08e99c9 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 _0xd68a=['moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','body','Action','find','params','catch','fast-json-patch','request-promise'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xd68a,0xe2));var _0xad68=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd68a[_0x166d93];return _0xba708;};'use strict';var jsonpatch=require(_0xad68('0x0'));var rp=require(_0xad68('0x1'));var moment=require(_0xad68('0x2'));var BPromise=require(_0xad68('0x3'));var Mustache=require(_0xad68('0x4'));var util=require('util');var path=require(_0xad68('0x5'));var sox=require(_0xad68('0x6'));var csv=require(_0xad68('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xad68('0x8'));var squel=require('squel');var crypto=require(_0xad68('0x9'));var jsforce=require(_0xad68('0xa'));var deskjs=require(_0xad68('0xb'));var toCsv=require(_0xad68('0x7'));var querystring=require(_0xad68('0xc'));var Papa=require(_0xad68('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xad68('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xad68('0xf'))['db'];function respondWithStatusCode(_0x5e6b60,_0x1b2ad7){_0x1b2ad7=_0x1b2ad7||0xcc;return function(_0x33e579){if(_0x33e579){return _0x5e6b60['sendStatus'](_0x1b2ad7);}return _0x5e6b60[_0xad68('0x10')](_0x1b2ad7)[_0xad68('0x11')]();};}function respondWithResult(_0x444b3a,_0x511fac){_0x511fac=_0x511fac||0xc8;return function(_0x237fc7){if(_0x237fc7){return _0x444b3a['status'](_0x511fac)[_0xad68('0x12')](_0x237fc7);}};}function respondWithFilteredResult(_0x1a1115,_0x1224cd){return function(_0x10c14a){if(_0x10c14a){var _0x2956be=_0x10c14a[_0xad68('0x13')],_0x4d2985=_0x1224cd[_0xad68('0x14')],_0x47259b=_0x1224cd['offset']+_0x1224cd['limit'],_0x169640;if(_0x47259b>=_0x2956be){_0x47259b=_0x2956be;_0x169640=0xc8;}else{_0x169640=0xce;}_0x1a1115[_0xad68('0x10')](_0x169640);return _0x1a1115[_0xad68('0x15')](_0xad68('0x16'),_0x4d2985+'-'+_0x47259b+'/'+_0x2956be)[_0xad68('0x12')](_0x10c14a);}return null;};}function patchUpdates(_0x275813){return function(_0x419e02){try{jsonpatch[_0xad68('0x17')](_0x419e02,_0x275813,!![]);}catch(_0x38f6a5){return BPromise[_0xad68('0x18')](_0x38f6a5);}return _0x419e02[_0xad68('0x19')]();};}function saveUpdates(_0x163635,_0x16b260){return function(_0xa7e0a){if(_0xa7e0a){return _0xa7e0a[_0xad68('0x1a')](_0x163635)[_0xad68('0x1b')](function(_0x5ceb48){return _0x5ceb48;});}return null;};}function removeEntity(_0x5d8218,_0x226ac0){return function(_0x5e42d4){if(_0x5e42d4){return _0x5e42d4[_0xad68('0x1c')]()[_0xad68('0x1b')](function(){_0x5d8218[_0xad68('0x10')](0xcc)[_0xad68('0x11')]();});}};}function handleEntityNotFound(_0x52bd3e,_0x5f0642){return function(_0x668767){if(!_0x668767){_0x52bd3e[_0xad68('0x1d')](0x194);}return _0x668767;};}function handleError(_0x1184e3,_0xd0d8a0){_0xd0d8a0=_0xd0d8a0||0x1f4;return function(_0x387493){logger[_0xad68('0x1e')](_0x387493[_0xad68('0x1f')]);if(_0x387493[_0xad68('0x20')]){delete _0x387493[_0xad68('0x20')];}_0x1184e3[_0xad68('0x10')](_0xd0d8a0)['send'](_0x387493);};}exports[_0xad68('0x1a')]=function(_0x52050d,_0x1a64b7){if(_0x52050d['body']['id']){delete _0x52050d[_0xad68('0x21')]['id'];}return db[_0xad68('0x22')][_0xad68('0x23')]({'where':{'id':_0x52050d[_0xad68('0x24')]['id']}})[_0xad68('0x1b')](handleEntityNotFound(_0x1a64b7,null))[_0xad68('0x1b')](saveUpdates(_0x52050d[_0xad68('0x21')],null))['then'](respondWithResult(_0x1a64b7,null))['catch'](handleError(_0x1a64b7,null));};exports[_0xad68('0x1c')]=function(_0x2850ea,_0x2338e7){return db[_0xad68('0x22')][_0xad68('0x23')]({'where':{'id':_0x2850ea[_0xad68('0x24')]['id']}})[_0xad68('0x1b')](handleEntityNotFound(_0x2338e7,null))[_0xad68('0x1b')](removeEntity(_0x2338e7,null))[_0xad68('0x25')](handleError(_0x2338e7,null));}; \ No newline at end of file +var _0xedff=['mustache','util','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','body','Action','params','find','fast-json-patch','request-promise','moment','bluebird'];(function(_0x280cb6,_0x553e27){var _0x484498=function(_0x11f643){while(--_0x11f643){_0x280cb6['push'](_0x280cb6['shift']());}};_0x484498(++_0x553e27);}(_0xedff,0x18c));var _0xfedf=function(_0x517a90,_0x46b102){_0x517a90=_0x517a90-0x0;var _0x13cb98=_0xedff[_0x517a90];return _0x13cb98;};'use strict';var jsonpatch=require(_0xfedf('0x0'));var rp=require(_0xfedf('0x1'));var moment=require(_0xfedf('0x2'));var BPromise=require(_0xfedf('0x3'));var Mustache=require(_0xfedf('0x4'));var util=require(_0xfedf('0x5'));var path=require('path');var sox=require(_0xfedf('0x6'));var csv=require(_0xfedf('0x7'));var ejs=require(_0xfedf('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfedf('0x9'));var crypto=require(_0xfedf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfedf('0xb'));var toCsv=require(_0xfedf('0x7'));var querystring=require(_0xfedf('0xc'));var Papa=require(_0xfedf('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xfedf('0xe'))(_0xfedf('0xf'));var utils=require(_0xfedf('0x10'));var config=require(_0xfedf('0x11'));var db=require(_0xfedf('0x12'))['db'];function respondWithStatusCode(_0x5d30c2,_0x3486e6){_0x3486e6=_0x3486e6||0xcc;return function(_0x474240){if(_0x474240){return _0x5d30c2['sendStatus'](_0x3486e6);}return _0x5d30c2[_0xfedf('0x13')](_0x3486e6)[_0xfedf('0x14')]();};}function respondWithResult(_0x661a32,_0x4874f1){_0x4874f1=_0x4874f1||0xc8;return function(_0x2ce3ee){if(_0x2ce3ee){return _0x661a32[_0xfedf('0x13')](_0x4874f1)['json'](_0x2ce3ee);}};}function respondWithFilteredResult(_0x1c30c2,_0x3c56cd){return function(_0x5ced43){if(_0x5ced43){var _0x23107a=_0x5ced43[_0xfedf('0x15')],_0x44485a=_0x3c56cd['offset'],_0x37350c=_0x3c56cd[_0xfedf('0x16')]+_0x3c56cd['limit'],_0x4fd16f;if(_0x37350c>=_0x23107a){_0x37350c=_0x23107a;_0x4fd16f=0xc8;}else{_0x4fd16f=0xce;}_0x1c30c2[_0xfedf('0x13')](_0x4fd16f);return _0x1c30c2[_0xfedf('0x17')](_0xfedf('0x18'),_0x44485a+'-'+_0x37350c+'/'+_0x23107a)[_0xfedf('0x19')](_0x5ced43);}return null;};}function patchUpdates(_0x39e520){return function(_0x5529cd){try{jsonpatch[_0xfedf('0x1a')](_0x5529cd,_0x39e520,!![]);}catch(_0x3af087){return BPromise[_0xfedf('0x1b')](_0x3af087);}return _0x5529cd[_0xfedf('0x1c')]();};}function saveUpdates(_0x314cce,_0x560c39){return function(_0x376228){if(_0x376228){return _0x376228[_0xfedf('0x1d')](_0x314cce)[_0xfedf('0x1e')](function(_0xbac607){return _0xbac607;});}return null;};}function removeEntity(_0x38b2a9,_0x4b2326){return function(_0x25c499){if(_0x25c499){return _0x25c499[_0xfedf('0x1f')]()[_0xfedf('0x1e')](function(){_0x38b2a9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x52abb1,_0xd29180){return function(_0x353414){if(!_0x353414){_0x52abb1['sendStatus'](0x194);}return _0x353414;};}function handleError(_0x40dad9,_0x36f2a7){_0x36f2a7=_0x36f2a7||0x1f4;return function(_0x584dee){logger[_0xfedf('0x20')](_0x584dee[_0xfedf('0x21')]);if(_0x584dee[_0xfedf('0x22')]){delete _0x584dee[_0xfedf('0x22')];}_0x40dad9[_0xfedf('0x13')](_0x36f2a7)[_0xfedf('0x23')](_0x584dee);};}exports[_0xfedf('0x1d')]=function(_0x49a14a,_0x24212f){if(_0x49a14a[_0xfedf('0x24')]['id']){delete _0x49a14a[_0xfedf('0x24')]['id'];}return db[_0xfedf('0x25')]['find']({'where':{'id':_0x49a14a[_0xfedf('0x26')]['id']}})[_0xfedf('0x1e')](handleEntityNotFound(_0x24212f,null))[_0xfedf('0x1e')](saveUpdates(_0x49a14a['body'],null))[_0xfedf('0x1e')](respondWithResult(_0x24212f,null))['catch'](handleError(_0x24212f,null));};exports[_0xfedf('0x1f')]=function(_0x3cabb5,_0x5ed123){return db[_0xfedf('0x25')][_0xfedf('0x27')]({'where':{'id':_0x3cabb5[_0xfedf('0x26')]['id']}})[_0xfedf('0x1e')](handleEntityNotFound(_0x5ed123,null))[_0xfedf('0x1e')](removeEntity(_0x5ed123,null))['catch'](handleError(_0x5ed123,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 009033d..c6c10c1 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 _0xaccd=['bluebird','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','api','moment'];(function(_0x137c68,_0x2ce341){var _0x524b07=function(_0x9519da){while(--_0x9519da){_0x137c68['push'](_0x137c68['shift']());}};_0x524b07(++_0x2ce341);}(_0xaccd,0x1d4));var _0xdacc=function(_0x103fdc,_0x128fa3){_0x103fdc=_0x103fdc-0x0;var _0x35fa79=_0xaccd[_0x103fdc];return _0x35fa79;};'use strict';var _=require(_0xdacc('0x0'));var util=require(_0xdacc('0x1'));var logger=require(_0xdacc('0x2'))(_0xdacc('0x3'));var moment=require(_0xdacc('0x4'));var BPromise=require(_0xdacc('0x5'));var rp=require('request-promise');var attributes=require(_0xdacc('0x6'));module[_0xdacc('0x7')]=function(_0x3e5f07,_0x413912){return _0x3e5f07[_0xdacc('0x8')](_0xdacc('0x9'),attributes,{'tableName':_0xdacc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x68a8=['bluebird','request-promise','./action.attributes','exports','define','Action','tools_actions','util','api','moment'];(function(_0x5834e5,_0x171e7f){var _0x1bfcf9=function(_0x1ed8fa){while(--_0x1ed8fa){_0x5834e5['push'](_0x5834e5['shift']());}};_0x1bfcf9(++_0x171e7f);}(_0x68a8,0x1c9));var _0x868a=function(_0x52e13b,_0x5223cf){_0x52e13b=_0x52e13b-0x0;var _0x3e8eea=_0x68a8[_0x52e13b];return _0x3e8eea;};'use strict';var _=require('lodash');var util=require(_0x868a('0x0'));var logger=require('../../config/logger')(_0x868a('0x1'));var moment=require(_0x868a('0x2'));var BPromise=require(_0x868a('0x3'));var rp=require(_0x868a('0x4'));var attributes=require(_0x868a('0x5'));module[_0x868a('0x6')]=function(_0x21633b,_0x4e9b05){return _0x21633b[_0x868a('0x7')](_0x868a('0x8'),attributes,{'tableName':_0x868a('0x9'),'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 f94ad70..8916af9 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 _0x26bc=['util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash'];(function(_0x3b8235,_0x549720){var _0x3f475b=function(_0x17ed17){while(--_0x17ed17){_0x3b8235['push'](_0x3b8235['shift']());}};_0x3f475b(++_0x549720);}(_0x26bc,0xd1));var _0xc26b=function(_0x4f14cd,_0xf43f6c){_0x4f14cd=_0x4f14cd-0x0;var _0x335d32=_0x26bc[_0x4f14cd];return _0x335d32;};'use strict';var _=require(_0xc26b('0x0'));var util=require(_0xc26b('0x1'));var moment=require('moment');var BPromise=require(_0xc26b('0x2'));var rs=require(_0xc26b('0x3'));var fs=require('fs');var db=require(_0xc26b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc26b('0x5'))('rpc');var config=require(_0xc26b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc26b('0x7')][_0xc26b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f7c74,_0x6d3ebb,_0x4d7a98){return new BPromise(function(_0xad36a5,_0x5d11ac){return client[_0xc26b('0x9')](_0x4f7c74,_0x4d7a98)[_0xc26b('0xa')](function(_0x1ac382){logger['info'](_0xc26b('0xb'),_0x6d3ebb,_0xc26b('0xc'));logger[_0xc26b('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x6d3ebb,_0xc26b('0xc'),JSON[_0xc26b('0xe')](_0x1ac382));if(_0x1ac382['error']){if(_0x1ac382[_0xc26b('0xf')][_0xc26b('0x10')]===0x1f4){logger[_0xc26b('0xf')]('Action,\x20%s,\x20%s',_0x6d3ebb,_0x1ac382[_0xc26b('0xf')][_0xc26b('0x11')]);return _0x5d11ac(_0x1ac382[_0xc26b('0xf')][_0xc26b('0x11')]);}logger[_0xc26b('0xf')]('Action,\x20%s,\x20%s',_0x6d3ebb,_0x1ac382[_0xc26b('0xf')]['message']);return _0xad36a5(_0x1ac382[_0xc26b('0xf')][_0xc26b('0x11')]);}else{logger[_0xc26b('0x12')]('Action,\x20%s,\x20%s',_0x6d3ebb,_0xc26b('0xc'));_0xad36a5(_0x1ac382[_0xc26b('0x13')]['message']);}})[_0xc26b('0x14')](function(_0x462cee){logger[_0xc26b('0xf')](_0xc26b('0xb'),_0x6d3ebb,_0x462cee);_0x5d11ac(_0x462cee);});});} \ No newline at end of file +var _0xe41d=['result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','code','message','Action,\x20%s,\x20%s'];(function(_0xc252ef,_0x32b872){var _0x13a192=function(_0x4b7ec7){while(--_0x4b7ec7){_0xc252ef['push'](_0xc252ef['shift']());}};_0x13a192(++_0x32b872);}(_0xe41d,0x13d));var _0xde41=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe41d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var moment=require('moment');var BPromise=require(_0xde41('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xde41('0x3'))['db'];var utils=require(_0xde41('0x4'));var logger=require('../../config/logger')(_0xde41('0x5'));var config=require(_0xde41('0x6'));var jayson=require(_0xde41('0x7'));var client=jayson[_0xde41('0x8')][_0xde41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144835,_0x34c7b4,_0x85e62){return new BPromise(function(_0x5d1e46,_0x54c631){return client[_0xde41('0xa')](_0x144835,_0x85e62)[_0xde41('0xb')](function(_0x4317dc){logger['info']('Action,\x20%s,\x20%s',_0x34c7b4,_0xde41('0xc'));logger[_0xde41('0xd')]('Action,\x20%s,\x20%s,\x20%s',_0x34c7b4,_0xde41('0xc'),JSON[_0xde41('0xe')](_0x4317dc));if(_0x4317dc[_0xde41('0xf')]){if(_0x4317dc[_0xde41('0xf')][_0xde41('0x10')]===0x1f4){logger[_0xde41('0xf')]('Action,\x20%s,\x20%s',_0x34c7b4,_0x4317dc['error'][_0xde41('0x11')]);return _0x54c631(_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);}logger[_0xde41('0xf')](_0xde41('0x12'),_0x34c7b4,_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);return _0x5d1e46(_0x4317dc[_0xde41('0xf')][_0xde41('0x11')]);}else{logger['info'](_0xde41('0x12'),_0x34c7b4,_0xde41('0xc'));_0x5d1e46(_0x4317dc[_0xde41('0x13')][_0xde41('0x11')]);}})[_0xde41('0x14')](function(_0x4a95ec){logger[_0xde41('0xf')](_0xde41('0x12'),_0x34c7b4,_0x4a95ec);_0x54c631(_0x4a95ec);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 48d08c5..0140978 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 _0x81d4=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','express'];(function(_0x519655,_0x567da0){var _0x51e77c=function(_0x4ad858){while(--_0x4ad858){_0x519655['push'](_0x519655['shift']());}};_0x51e77c(++_0x567da0);}(_0x81d4,0x9c));var _0x481d=function(_0x240547,_0x1d4d95){_0x240547=_0x240547-0x0;var _0x13dcb5=_0x81d4[_0x240547];return _0x13dcb5;};'use strict';var multer=require(_0x481d('0x0'));var util=require(_0x481d('0x1'));var path=require(_0x481d('0x2'));var express=require(_0x481d('0x3'));var router=express[_0x481d('0x4')]();var auth=require(_0x481d('0x5'));var interaction=require(_0x481d('0x6'));var config=require(_0x481d('0x7'));var controller=require(_0x481d('0x8'));router[_0x481d('0x9')](_0x481d('0xa'),auth['isAuthenticated'](),controller[_0x481d('0xb')]);router[_0x481d('0xc')](_0x481d('0xa'),auth[_0x481d('0xd')](),controller[_0x481d('0xe')]);module[_0x481d('0xf')]=router; \ No newline at end of file +var _0x79ba=['/:id','update','delete','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','put'];(function(_0xb6c185,_0x1fba89){var _0x18717b=function(_0x1ac33d){while(--_0x1ac33d){_0xb6c185['push'](_0xb6c185['shift']());}};_0x18717b(++_0x1fba89);}(_0x79ba,0x147));var _0xa79b=function(_0x1cfda3,_0x32e81){_0x1cfda3=_0x1cfda3-0x0;var _0x45a82f=_0x79ba[_0x1cfda3];return _0x45a82f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa79b('0x0'));var express=require('express');var router=express[_0xa79b('0x1')]();var auth=require(_0xa79b('0x2'));var interaction=require(_0xa79b('0x3'));var config=require(_0xa79b('0x4'));var controller=require('./action.controller');router[_0xa79b('0x5')](_0xa79b('0x6'),auth['isAuthenticated'](),controller[_0xa79b('0x7')]);router[_0xa79b('0x8')](_0xa79b('0x6'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index fbc3257..e52cc78 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 _0xf081=['TEXT','sequelize','STRING'];(function(_0x4a7b70,_0x3b1dce){var _0x12ee67=function(_0x4e9f38){while(--_0x4e9f38){_0x4a7b70['push'](_0x4a7b70['shift']());}};_0x12ee67(++_0x3b1dce);}(_0xf081,0x199));var _0x1f08=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xf081[_0x4792c8];return _0x35edb1;};'use strict';var Sequelize=require(_0x1f08('0x0'));module['exports']={'name':{'type':Sequelize[_0x1f08('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1f08('0x1')]},'parent':{'type':Sequelize[_0x1f08('0x1')]},'table':{'type':Sequelize[_0x1f08('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x1f08('0x2')]}}; \ No newline at end of file +var _0x194c=['sequelize','exports','STRING','TEXT'];(function(_0xbd5eaa,_0x5a81c1){var _0x3990cf=function(_0x341093){while(--_0x341093){_0xbd5eaa['push'](_0xbd5eaa['shift']());}};_0x3990cf(++_0x5a81c1);}(_0x194c,0x84));var _0xc194=function(_0x33f959,_0x37a84d){_0x33f959=_0x33f959-0x0;var _0x1db2fd=_0x194c[_0x33f959];return _0x1db2fd;};'use strict';var Sequelize=require(_0xc194('0x0'));module[_0xc194('0x1')]={'name':{'type':Sequelize[_0xc194('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xc194('0x2')]},'parent':{'type':Sequelize[_0xc194('0x2')]},'table':{'type':Sequelize[_0xc194('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xc194('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index c98556a..362605b 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 _0x94ce=['QueryTypes','SELECT','join','outer_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','value','from','function','groupBy','ValidationError','No\x20Data!','output','fullPath','randomstring','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','AnalyticCustomReport','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','count','includeAll','include','rows','show','params','length','options','find','create','body','catch','preview','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)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','findAll','keyBy','select','table','MetricId','metric','replace','format','orderBy','DESC','alias','joins','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parse','conditions','clone','debug','Limited\x20Query:','toString','sequelize'];(function(_0x5c7e91,_0x475934){var _0x373eea=function(_0x310924){while(--_0x310924){_0x5c7e91['push'](_0x5c7e91['shift']());}};_0x373eea(++_0x475934);}(_0x94ce,0x144));var _0xe94c=function(_0x2a319f,_0x3ea13e){_0x2a319f=_0x2a319f-0x0;var _0x4931e0=_0x94ce[_0x2a319f];return _0x4931e0;};'use strict';var jsonpatch=require(_0xe94c('0x0'));var rp=require(_0xe94c('0x1'));var moment=require(_0xe94c('0x2'));var BPromise=require(_0xe94c('0x3'));var Mustache=require(_0xe94c('0x4'));var util=require('util');var path=require(_0xe94c('0x5'));var sox=require(_0xe94c('0x6'));var csv=require(_0xe94c('0x7'));var ejs=require(_0xe94c('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe94c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe94c('0x7'));var querystring=require(_0xe94c('0xa'));var Papa=require(_0xe94c('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0xe94c('0xc'))(_0xe94c('0xd'));var utils=require(_0xe94c('0xe'));var config=require(_0xe94c('0xf'));var db=require(_0xe94c('0x10'))['db'];function respondWithStatusCode(_0x515db2,_0x5e12cb){_0x5e12cb=_0x5e12cb||0xcc;return function(_0x5b6b3f){if(_0x5b6b3f){return _0x515db2[_0xe94c('0x11')](_0x5e12cb);}return _0x515db2[_0xe94c('0x12')](_0x5e12cb)[_0xe94c('0x13')]();};}function respondWithResult(_0x318120,_0x338fbc){_0x338fbc=_0x338fbc||0xc8;return function(_0x3f696d){if(_0x3f696d){return _0x318120['status'](_0x338fbc)[_0xe94c('0x14')](_0x3f696d);}};}function respondWithFilteredResult(_0x344b16,_0x535049){return function(_0x37373e){if(_0x37373e){var _0x459436=_0x37373e['count'],_0x1842fe=_0x535049[_0xe94c('0x15')],_0x5e864e=_0x535049[_0xe94c('0x15')]+_0x535049[_0xe94c('0x16')],_0x298339;if(_0x5e864e>=_0x459436){_0x5e864e=_0x459436;_0x298339=0xc8;}else{_0x298339=0xce;}_0x344b16[_0xe94c('0x12')](_0x298339);return _0x344b16[_0xe94c('0x17')](_0xe94c('0x18'),_0x1842fe+'-'+_0x5e864e+'/'+_0x459436)['json'](_0x37373e);}return null;};}function patchUpdates(_0x51536f){return function(_0x8d2d32){try{jsonpatch[_0xe94c('0x19')](_0x8d2d32,_0x51536f,!![]);}catch(_0x1ac13a){return BPromise[_0xe94c('0x1a')](_0x1ac13a);}return _0x8d2d32[_0xe94c('0x1b')]();};}function saveUpdates(_0x553cf6,_0x1fca18){return function(_0x3b982a){if(_0x3b982a){return _0x3b982a[_0xe94c('0x1c')](_0x553cf6)[_0xe94c('0x1d')](function(_0x1d3787){return _0x1d3787;});}return null;};}function removeEntity(_0x44629f,_0x19bd94){return function(_0x444e80){if(_0x444e80){return _0x444e80[_0xe94c('0x1e')]()[_0xe94c('0x1d')](function(){_0x44629f[_0xe94c('0x12')](0xcc)[_0xe94c('0x13')]();});}};}function handleEntityNotFound(_0x516d39,_0x6d56dd){return function(_0x16daec){if(!_0x16daec){_0x516d39[_0xe94c('0x11')](0x194);}return _0x16daec;};}function handleError(_0x5383cf,_0x3b40b6){_0x3b40b6=_0x3b40b6||0x1f4;return function(_0x27d903){logger['error'](_0x27d903['stack']);if(_0x27d903[_0xe94c('0x1f')]){delete _0x27d903['name'];}_0x5383cf[_0xe94c('0x12')](_0x3b40b6)[_0xe94c('0x20')](_0x27d903);};}exports[_0xe94c('0x21')]=function(_0x72b601,_0x2bd774){var _0x5f2959={},_0x27156c={},_0x28d066={'count':0x0,'rows':[]};var _0x4bce5e=db[_0xe94c('0x22')][_0xe94c('0x23')];_0x27156c['model']=_['keys'](_0x4bce5e);var _0x558c22={'dateStart':_0x72b601[_0xe94c('0x24')][_0xe94c('0x25')],'dateEnd':_0x72b601[_0xe94c('0x24')]['dateEnd']};delete _0x72b601[_0xe94c('0x24')][_0xe94c('0x25')];delete _0x72b601[_0xe94c('0x24')][_0xe94c('0x26')];_0x27156c[_0xe94c('0x24')]=_[_0xe94c('0x27')](_0x72b601[_0xe94c('0x24')]);_0x27156c[_0xe94c('0x28')]=_[_0xe94c('0x29')](_0x27156c[_0xe94c('0x2a')],_0x27156c[_0xe94c('0x24')]);_0x5f2959['attributes']=_[_0xe94c('0x29')](_0x27156c[_0xe94c('0x2a')],qs[_0xe94c('0x2b')](_0x72b601[_0xe94c('0x24')][_0xe94c('0x2b')]));_0x5f2959[_0xe94c('0x2c')]=_0x5f2959['attributes']['length']?_0x5f2959['attributes']:_0x27156c['model'];if(!_0x72b601['query'][_0xe94c('0x2d')](_0xe94c('0x2e'))){_0x5f2959[_0xe94c('0x16')]=qs[_0xe94c('0x16')](_0x72b601[_0xe94c('0x24')]['limit']);_0x5f2959['offset']=qs[_0xe94c('0x15')](_0x72b601[_0xe94c('0x24')][_0xe94c('0x15')]);}_0x5f2959[_0xe94c('0x2f')]=qs[_0xe94c('0x30')](_0x72b601[_0xe94c('0x24')][_0xe94c('0x30')]);_0x5f2959[_0xe94c('0x31')]=qs['filters'](_[_0xe94c('0x32')](_0x72b601['query'],_0x27156c['filters']));if(_0x558c22[_0xe94c('0x25')]){if(_0x558c22[_0xe94c('0x26')]){_0x558c22[_0xe94c('0x26')]=moment(_0x558c22['dateEnd'])[_0xe94c('0x33')](0x1,_0xe94c('0x34'));}else{_0x558c22['dateEnd']=moment(_0x558c22['dateStart'])[_0xe94c('0x33')](0x1,_0xe94c('0x34'));}_['merge'](_0x5f2959[_0xe94c('0x31')],{'createdAt':{'$gte':_0x558c22[_0xe94c('0x25')],'$lte':_0x558c22['dateEnd']}});}if(_0x72b601[_0xe94c('0x24')][_0xe94c('0x35')]){_0x5f2959[_0xe94c('0x31')]=_[_0xe94c('0x36')](_0x5f2959[_0xe94c('0x31')],{'$or':_[_0xe94c('0x37')](_0x5f2959['attributes'],function(_0x31e8d4){var _0x5ecdfa={};_0x5ecdfa[_0x31e8d4]={'$like':'%'+_0x72b601[_0xe94c('0x24')][_0xe94c('0x35')]+'%'};return _0x5ecdfa;})});}_0x5f2959=_[_0xe94c('0x36')]({},_0x5f2959,_0x72b601['options']);var _0x5d1ae3={'where':_0x5f2959['where']};return db[_0xe94c('0x22')][_0xe94c('0x38')](_0x5d1ae3)['then'](function(_0x3622cf){_0x28d066[_0xe94c('0x38')]=_0x3622cf;if(_0x72b601[_0xe94c('0x24')][_0xe94c('0x39')]){_0x5f2959[_0xe94c('0x3a')]=[{'all':!![]}];}return db[_0xe94c('0x22')]['findAll'](_0x5f2959);})['then'](function(_0x572077){_0x28d066[_0xe94c('0x3b')]=_0x572077;return _0x28d066;})[_0xe94c('0x1d')](respondWithFilteredResult(_0x2bd774,_0x5f2959))['catch'](handleError(_0x2bd774,null));};exports[_0xe94c('0x3c')]=function(_0x51b5fa,_0x1fbcaf){var _0x447742={'raw':![],'where':{'id':_0x51b5fa[_0xe94c('0x3d')]['id']}},_0x413f8b={};_0x413f8b['model']=_[_0xe94c('0x27')](db['AnalyticCustomReport']['rawAttributes']);_0x413f8b[_0xe94c('0x24')]=_[_0xe94c('0x27')](_0x51b5fa['query']);_0x413f8b[_0xe94c('0x28')]=_[_0xe94c('0x29')](_0x413f8b['model'],_0x413f8b['query']);_0x447742['attributes']=_[_0xe94c('0x29')](_0x413f8b['model'],qs[_0xe94c('0x2b')](_0x51b5fa[_0xe94c('0x24')][_0xe94c('0x2b')]));_0x447742['attributes']=_0x447742[_0xe94c('0x2c')][_0xe94c('0x3e')]?_0x447742['attributes']:_0x413f8b[_0xe94c('0x2a')];if(_0x51b5fa['query'][_0xe94c('0x39')]){_0x447742['include']=[{'all':!![]}];}_0x447742=_['merge']({},_0x447742,_0x51b5fa[_0xe94c('0x3f')]);return db[_0xe94c('0x22')][_0xe94c('0x40')](_0x447742)[_0xe94c('0x1d')](handleEntityNotFound(_0x1fbcaf,null))['then'](respondWithResult(_0x1fbcaf,null))['catch'](handleError(_0x1fbcaf,null));};exports[_0xe94c('0x41')]=function(_0x242d8e,_0x304186){return db['AnalyticCustomReport'][_0xe94c('0x41')](_0x242d8e[_0xe94c('0x42')],{})[_0xe94c('0x1d')](respondWithResult(_0x304186,0xc9))[_0xe94c('0x43')](handleError(_0x304186,null));};exports[_0xe94c('0x1c')]=function(_0xfeb011,_0x31ed3c){if(_0xfeb011[_0xe94c('0x42')]['id']){delete _0xfeb011['body']['id'];}return db[_0xe94c('0x22')][_0xe94c('0x40')]({'where':{'id':_0xfeb011['params']['id']}})['then'](handleEntityNotFound(_0x31ed3c,null))['then'](saveUpdates(_0xfeb011['body'],null))[_0xe94c('0x1d')](respondWithResult(_0x31ed3c,null))[_0xe94c('0x43')](handleError(_0x31ed3c,null));};exports[_0xe94c('0x1e')]=function(_0x46a945,_0x4e3ce5){return db['AnalyticCustomReport'][_0xe94c('0x40')]({'where':{'id':_0x46a945[_0xe94c('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4e3ce5,null))['then'](removeEntity(_0x4e3ce5,null))['catch'](handleError(_0x4e3ce5,null));};exports[_0xe94c('0x44')]=function(_0x31f574,_0x5cf003){var _0x280a9e=0xa;var _0x4346f6=['join',_0xe94c('0x45'),_0xe94c('0x46'),'outer_join',_0xe94c('0x47')];var _0xf1ed29={'SUM':_0xe94c('0x48'),'COUNT':_0xe94c('0x49'),'COUNT DISTINCT':_0xe94c('0x4a'),'MAX':_0xe94c('0x4b'),'MIN':_0xe94c('0x4c'),'AVG':_0xe94c('0x4d'),'GROUP_CONCAT':_0xe94c('0x4e'),'GROUP_CONCAT ASC':_0xe94c('0x4f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2edc2b={'SEC_TO_TIME':_0xe94c('0x50'),'DATE':_0xe94c('0x51'),'HOUR':_0xe94c('0x52'),'ROUND':_0xe94c('0x53'),'UNIX_TIMESTAMP':_0xe94c('0x54')};var _0x285fdc=function(_0x203885){return!_[_0xe94c('0x55')]([_0xe94c('0x56'),_0xe94c('0x57'),_0xe94c('0x58'),_0xe94c('0x59')],_0x203885);};var _0xebbf66=function(_0x2a7950){if(!_0x2a7950||!_0x2a7950['rules'][_0xe94c('0x3e')]){return'';}for(var _0x4f9d4e='(',_0x749250=0x0;_0x749250<_0x2a7950['rules'][_0xe94c('0x3e')];_0x749250+=0x1){_0x749250>0x0&&(_0x4f9d4e+='\x20'+_0x2a7950[_0xe94c('0x5a')]+'\x20');_0x4f9d4e+=_0x2a7950[_0xe94c('0x5b')][_0x749250][_0xe94c('0x5c')]?_0xebbf66(_0x2a7950['rules'][_0x749250]['group']):_0x2a7950[_0xe94c('0x5b')][_0x749250][_0xe94c('0x5d')]+'\x20'+_0x2a7950['rules'][_0x749250][_0xe94c('0x5e')]+(_0x285fdc(_0x2a7950[_0xe94c('0x5b')][_0x749250][_0xe94c('0x5e')])?'\x20'+_0x2a7950['rules'][_0x749250]['value']:'');}return _0x4f9d4e+')';};var _0x58ebf7={'where':{'id':_0x31f574[_0xe94c('0x3d')]['id']}},_0x3851b0,_0x9a19c3,_0xe26fff,_0x5cacaf,_0x109bdb;_0x58ebf7=_[_0xe94c('0x36')]({},_0x58ebf7,_0x31f574['options']);return db[_0xe94c('0x22')][_0xe94c('0x40')](_0x58ebf7)[_0xe94c('0x1d')](function(_0xc665a2){if(_0xc665a2){_0x3851b0=_0xc665a2;return _0xc665a2[_0xe94c('0x5f')]();}return null;})[_0xe94c('0x1d')](function(_0x549130){if(_0x549130){if(!_0x549130[_0xe94c('0x3e')]){throw new db[(_0xe94c('0x60'))]['ValidationError'](_0xe94c('0x61'));}_0x9a19c3=_0x549130;return db[_0xe94c('0x62')][_0xe94c('0x63')]({'raw':!![]});}return null;})[_0xe94c('0x1d')](function(_0x29da58){if(_0x29da58){_0xe26fff=_[_0xe94c('0x64')](_0x29da58,'id');var _0x4a9871;var _0x157c9d=squel[_0xe94c('0x65')]();_0x157c9d['from'](_0x3851b0[_0xe94c('0x66')]);for(var _0x142311=0x0;_0x142311<_0x9a19c3[_0xe94c('0x3e')];_0x142311+=0x1){_0x4a9871=_0x9a19c3[_0x142311][_0xe94c('0x67')]?_0xe26fff[_0x9a19c3[_0x142311][_0xe94c('0x67')]][_0xe94c('0x68')]:_0x9a19c3[_0x142311]['field'];_0x4a9871=_0x9a19c3[_0x142311]['function']?_[_0xe94c('0x69')](_0xf1ed29[_0x9a19c3[_0x142311]['function']],'%s',_0x4a9871):_0x4a9871;_0x4a9871=_0x9a19c3[_0x142311][_0xe94c('0x6a')]?_['replace'](_0x2edc2b[_0x9a19c3[_0x142311][_0xe94c('0x6a')]],'%s',_0x4a9871):_0x4a9871;if(_0x9a19c3[_0x142311]['groupBy']){_0x157c9d['group'](_0x4a9871);}_0x9a19c3[_0x142311][_0xe94c('0x6b')]&&_0x157c9d[_0xe94c('0x2f')](_0x4a9871,_0x9a19c3[_0x142311][_0xe94c('0x6b')]===_0xe94c('0x6c')?![]:!![]);_0x157c9d[_0xe94c('0x5d')](_0x4a9871,_0x9a19c3[_0x142311][_0xe94c('0x6d')]||_0x4a9871);}if(_0x3851b0[_0xe94c('0x6e')]){_0x3851b0[_0xe94c('0x6e')]=JSON['parse'](_0x3851b0['joins']);for(var _0x50d45d=0x0;_0x50d45d<_0x3851b0['joins']['length'];_0x50d45d+=0x1){if(_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x6f')]&&_[_0xe94c('0x55')](_0x4346f6,_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x6f')])&&_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x70')]&&_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x71')]&&_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x72')]){_0x157c9d[_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x6f')]](_0x3851b0[_0xe94c('0x6e')][_0x50d45d]['foreignTable'],null,util[_0xe94c('0x6a')](_0xe94c('0x73'),_0x3851b0[_0xe94c('0x66')],_0x3851b0['joins'][_0x50d45d][_0xe94c('0x70')],_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x71')],_0x3851b0[_0xe94c('0x6e')][_0x50d45d][_0xe94c('0x72')]));}}}if(_0x3851b0['conditions']){_0x3851b0['conditions']=JSON[_0xe94c('0x74')](_0x3851b0[_0xe94c('0x75')]);_0x157c9d[_0xe94c('0x31')](_0xebbf66(_0x3851b0[_0xe94c('0x75')][_0xe94c('0x5c')]));}_0x109bdb=_0x157c9d[_0xe94c('0x76')]();_0x157c9d[_0xe94c('0x16')](_0x280a9e);_0x157c9d['offset'](0x0);logger[_0xe94c('0x77')](_0xe94c('0x78'),_0x157c9d[_0xe94c('0x79')]());return db['sequelize'][_0xe94c('0x24')](_0x157c9d[_0xe94c('0x79')](),{'type':db[_0xe94c('0x7a')][_0xe94c('0x7b')][_0xe94c('0x7c')]});}})[_0xe94c('0x1d')](respondWithResult(_0x5cf003,null))[_0xe94c('0x43')](handleError(_0x5cf003,null));};function runReport(_0x3be02d,_0x1d0ef1,_0x24876a){var _0x39ed15=_0x1d0ef1[_0xe94c('0x1f')];var _0x377c39=0xa;var _0x2f40a4=[_0xe94c('0x7d'),_0xe94c('0x45'),_0xe94c('0x46'),_0xe94c('0x7e'),_0xe94c('0x47')];var _0x11c00f={'SUM':_0xe94c('0x48'),'COUNT':_0xe94c('0x49'),'COUNT DISTINCT':_0xe94c('0x4a'),'MAX':_0xe94c('0x4b'),'MIN':_0xe94c('0x4c'),'AVG':_0xe94c('0x4d'),'GROUP_CONCAT':_0xe94c('0x4e'),'GROUP_CONCAT ASC':_0xe94c('0x4f'),'GROUP_CONCAT DESC':_0xe94c('0x7f')};var _0x3b1624={'SEC_TO_TIME':_0xe94c('0x50'),'DATE':'DATE(%s)','HOUR':_0xe94c('0x52'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xd42c6e=function(_0x36f35){return!_[_0xe94c('0x55')]([_0xe94c('0x56'),_0xe94c('0x57'),_0xe94c('0x58'),_0xe94c('0x59')],_0x36f35);};var _0x45106d=function(_0x3e8d89){if(!_0x3e8d89||!_0x3e8d89['rules']['length']){return'';}for(var _0x99771d='(',_0x179069=0x0;_0x179069<_0x3e8d89[_0xe94c('0x5b')][_0xe94c('0x3e')];_0x179069+=0x1){_0x179069>0x0&&(_0x99771d+='\x20'+_0x3e8d89[_0xe94c('0x5a')]+'\x20');_0x99771d+=_0x3e8d89[_0xe94c('0x5b')][_0x179069]['group']?_0x45106d(_0x3e8d89[_0xe94c('0x5b')][_0x179069][_0xe94c('0x5c')]):_0x3e8d89[_0xe94c('0x5b')][_0x179069][_0xe94c('0x5d')]+'\x20'+_0x3e8d89[_0xe94c('0x5b')][_0x179069][_0xe94c('0x5e')]+(_0xd42c6e(_0x3e8d89[_0xe94c('0x5b')][_0x179069][_0xe94c('0x5e')])?'\x20'+_0x3e8d89[_0xe94c('0x5b')][_0x179069][_0xe94c('0x80')]:'');}return _0x99771d+')';};var _0x18abc3={'where':{'id':_0x3be02d['id']}},_0x2222a5,_0x427170,_0x433665,_0x407cd1,_0xa1778e;_0x18abc3=_[_0xe94c('0x36')]({},_0x18abc3,_0x24876a);return db[_0xe94c('0x22')][_0xe94c('0x40')](_0x18abc3)[_0xe94c('0x1d')](function(_0x134500){if(_0x134500){_0x2222a5=_0x134500;return _0x134500[_0xe94c('0x5f')]();}return null;})[_0xe94c('0x1d')](function(_0x23820){if(_0x23820){if(!_0x23820[_0xe94c('0x3e')]){throw new db[(_0xe94c('0x60'))]['ValidationError'](_0xe94c('0x61'));}_0x427170=_0x23820;return db['AnalyticMetric'][_0xe94c('0x63')]({'raw':!![]});}return null;})[_0xe94c('0x1d')](function(_0x551514){if(_0x551514){_0x433665=_[_0xe94c('0x64')](_0x551514,'id');var _0x2fe8b1;var _0x583412=squel[_0xe94c('0x65')]();_0x583412[_0xe94c('0x81')](_0x2222a5['table']);for(var _0x2a9ffc=0x0;_0x2a9ffc<_0x427170[_0xe94c('0x3e')];_0x2a9ffc+=0x1){_0x2fe8b1=_0x427170[_0x2a9ffc][_0xe94c('0x67')]?_0x433665[_0x427170[_0x2a9ffc]['MetricId']]['metric']:_0x427170[_0x2a9ffc][_0xe94c('0x5d')];_0x2fe8b1=_0x427170[_0x2a9ffc]['function']?_[_0xe94c('0x69')](_0x11c00f[_0x427170[_0x2a9ffc][_0xe94c('0x82')]],'%s',_0x2fe8b1):_0x2fe8b1;_0x2fe8b1=_0x427170[_0x2a9ffc][_0xe94c('0x6a')]?_[_0xe94c('0x69')](_0x3b1624[_0x427170[_0x2a9ffc][_0xe94c('0x6a')]],'%s',_0x2fe8b1):_0x2fe8b1;if(_0x427170[_0x2a9ffc][_0xe94c('0x83')]){_0x583412[_0xe94c('0x5c')](_0x2fe8b1);}_0x427170[_0x2a9ffc][_0xe94c('0x6b')]&&_0x583412[_0xe94c('0x2f')](_0x2fe8b1,_0x427170[_0x2a9ffc][_0xe94c('0x6b')]==='DESC'?![]:!![]);_0x583412[_0xe94c('0x5d')](_0x2fe8b1,_0x427170[_0x2a9ffc][_0xe94c('0x6d')]||_0x2fe8b1);}if(_0x2222a5[_0xe94c('0x6e')]){_0x2222a5[_0xe94c('0x6e')]=JSON[_0xe94c('0x74')](_0x2222a5[_0xe94c('0x6e')]);for(var _0x5cf413=0x0;_0x5cf413<_0x2222a5[_0xe94c('0x6e')][_0xe94c('0x3e')];_0x5cf413+=0x1){if(_0x2222a5['joins'][_0x5cf413]['type']&&_[_0xe94c('0x55')](_0x2f40a4,_0x2222a5[_0xe94c('0x6e')][_0x5cf413][_0xe94c('0x6f')])&&_0x2222a5['joins'][_0x5cf413][_0xe94c('0x70')]&&_0x2222a5['joins'][_0x5cf413]['foreignTable']&&_0x2222a5[_0xe94c('0x6e')][_0x5cf413][_0xe94c('0x72')]){_0x583412[_0x2222a5['joins'][_0x5cf413][_0xe94c('0x6f')]](_0x2222a5[_0xe94c('0x6e')][_0x5cf413]['foreignTable'],null,util[_0xe94c('0x6a')](_0xe94c('0x73'),_0x2222a5[_0xe94c('0x66')],_0x2222a5[_0xe94c('0x6e')][_0x5cf413]['parentKey'],_0x2222a5[_0xe94c('0x6e')][_0x5cf413][_0xe94c('0x71')],_0x2222a5[_0xe94c('0x6e')][_0x5cf413]['foreignKey']));}}}if(_0x2222a5[_0xe94c('0x75')]){_0x2222a5['conditions']=JSON[_0xe94c('0x74')](_0x2222a5['conditions']);_0x583412[_0xe94c('0x31')](_0x45106d(_0x2222a5['conditions'][_0xe94c('0x5c')]));}_0xa1778e=_0x583412[_0xe94c('0x76')]();_0x583412[_0xe94c('0x16')](_0x377c39);_0x583412[_0xe94c('0x15')](0x0);logger[_0xe94c('0x77')]('Limited\x20Query:',_0x583412[_0xe94c('0x79')]());return db[_0xe94c('0x7a')]['query'](_0x583412[_0xe94c('0x79')](),{'type':db[_0xe94c('0x7a')]['QueryTypes'][_0xe94c('0x7c')]});}})['then'](function(_0x2680b2){if(!_0x2680b2[_0xe94c('0x3e')]){throw new db[(_0xe94c('0x60'))][(_0xe94c('0x84'))](_0xe94c('0x85'));}if(_0x1d0ef1[_0xe94c('0x86')]==='web'){return null;}var _0x2d1633=_[_0xe94c('0x36')](_0x1d0ef1,{'name':_0x1d0ef1[_0xe94c('0x87')]||_0x1d0ef1[_0xe94c('0x1f')]||_0x2222a5[_0xe94c('0x1f')],'basename':_0x39ed15,'savename':util['format']('%s-%s.%s',_0x1d0ef1[_0xe94c('0x1f')]||_0x2222a5[_0xe94c('0x1f')],require(_0xe94c('0x88'))['generate'](0x4),_0x1d0ef1[_0xe94c('0x86')]||'csv')});return db[_0xe94c('0x89')]['create'](_0x2d1633,{'raw':!![]});})[_0xe94c('0x1d')](function(_0x4ddade){_0xa1778e['where'](_0x2222a5[_0xe94c('0x66')]+_0xe94c('0x8a'),_0x1d0ef1[_0xe94c('0x8b')],_0x1d0ef1[_0xe94c('0x8c')]);if(_0x4ddade){logger['info'](_0xe94c('0x8d'),_0xa1778e[_0xe94c('0x79')]());require(_0xe94c('0x8e'))['fork'](path[_0xe94c('0x7d')](__dirname,_0xe94c('0x8f'),_0x4ddade[_0xe94c('0x86')]),[_0x4ddade['id'],_0xa1778e[_0xe94c('0x79')](),path[_0xe94c('0x7d')](__dirname,_0xe94c('0x90'),_0x4ddade['savename']),_0x39ed15]);return _0x4ddade;}else{var _0x46ccff=squel[_0xe94c('0x65')]();_0x46ccff[_0xe94c('0x81')]('('+_0xa1778e[_0xe94c('0x79')]()+')',_0xe94c('0x91'));_0x46ccff['field'](_0xe94c('0x92'),_0xe94c('0x38'));_0xa1778e[_0xe94c('0x16')](_0x1d0ef1['limit']||_0x377c39);_0xa1778e[_0xe94c('0x15')](_0x1d0ef1[_0xe94c('0x15')]||0x0);return db['sequelize'][_0xe94c('0x24')](_0x46ccff[_0xe94c('0x79')](),{'type':db['sequelize']['QueryTypes'][_0xe94c('0x7c')]})[_0xe94c('0x1d')](function(_0x29d23c){if(!_0x29d23c['length']){_0x407cd1=0x0;}else{_0x407cd1=_0x29d23c[0x0][_0xe94c('0x38')]||0x0;}return db[_0xe94c('0x7a')]['query'](_0xa1778e[_0xe94c('0x79')](),{'type':db[_0xe94c('0x7a')]['QueryTypes'][_0xe94c('0x7c')]});})[_0xe94c('0x1d')](function(_0x48ac4b){return{'rows':_0x48ac4b||[],'count':_0x407cd1};});}});}exports[_0xe94c('0x93')]=function(_0x378caf,_0x3a6fe6){return runReport(_0x378caf[_0xe94c('0x3d')],_0x378caf[_0xe94c('0x24')],_0x378caf['options'])[_0xe94c('0x1d')](respondWithResult(_0x3a6fe6,null))[_0xe94c('0x43')](handleError(_0x3a6fe6,null));};exports[_0xe94c('0x94')]=runReport;exports['query']=function(_0x4d593a,_0x2102dc){var _0x1eb95d=0xa;var _0x37a5f9=[_0xe94c('0x7d'),_0xe94c('0x45'),'right_join','outer_join',_0xe94c('0x47')];var _0xc20adc={'SUM':'SUM(%s)','COUNT':_0xe94c('0x49'),'COUNT DISTINCT':_0xe94c('0x4a'),'MAX':_0xe94c('0x4b'),'MIN':'MIN(%s)','AVG':_0xe94c('0x4d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe94c('0x4f'),'GROUP_CONCAT DESC':_0xe94c('0x7f')};var _0x19a36b={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe94c('0x51'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe94c('0x54')};var _0x446c5a=function(_0x58abf1){return!_[_0xe94c('0x55')]([_0xe94c('0x56'),_0xe94c('0x57'),_0xe94c('0x58'),_0xe94c('0x59')],_0x58abf1);};var _0x57b01d=function(_0x4d20fd){if(!_0x4d20fd||!_0x4d20fd[_0xe94c('0x5b')][_0xe94c('0x3e')]){return'';}for(var _0x4df0a1='(',_0x507edf=0x0;_0x507edf<_0x4d20fd[_0xe94c('0x5b')]['length'];_0x507edf+=0x1){_0x507edf>0x0&&(_0x4df0a1+='\x20'+_0x4d20fd['operator']+'\x20');_0x4df0a1+=_0x4d20fd['rules'][_0x507edf][_0xe94c('0x5c')]?_0x57b01d(_0x4d20fd[_0xe94c('0x5b')][_0x507edf][_0xe94c('0x5c')]):_0x4d20fd[_0xe94c('0x5b')][_0x507edf][_0xe94c('0x5d')]+'\x20'+_0x4d20fd[_0xe94c('0x5b')][_0x507edf][_0xe94c('0x5e')]+(_0x446c5a(_0x4d20fd[_0xe94c('0x5b')][_0x507edf]['condition'])?'\x20'+_0x4d20fd[_0xe94c('0x5b')][_0x507edf][_0xe94c('0x80')]:'');}return _0x4df0a1+')';};var _0x5383c9={'where':{'id':_0x4d593a[_0xe94c('0x3d')]['id']}},_0x44c4a1,_0x24cd65,_0x1c08e0,_0x1e86d2,_0x516046;_0x5383c9=_[_0xe94c('0x36')]({},_0x5383c9,_0x4d593a[_0xe94c('0x3f')]);return db[_0xe94c('0x22')][_0xe94c('0x40')](_0x5383c9)['then'](function(_0x3548a1){if(_0x3548a1){_0x44c4a1=_0x3548a1;return _0x3548a1[_0xe94c('0x5f')]();}return null;})[_0xe94c('0x1d')](function(_0x25e835){if(_0x25e835){if(!_0x25e835[_0xe94c('0x3e')]){throw new db['Sequelize'][(_0xe94c('0x84'))](_0xe94c('0x61'));}_0x24cd65=_0x25e835;return db[_0xe94c('0x62')][_0xe94c('0x63')]({'raw':!![]});}return null;})[_0xe94c('0x1d')](function(_0xe28e2){if(_0xe28e2){_0x1c08e0=_[_0xe94c('0x64')](_0xe28e2,'id');var _0x1f6201;var _0xbf15d3=squel[_0xe94c('0x65')]();_0xbf15d3[_0xe94c('0x81')](_0x44c4a1[_0xe94c('0x66')]);for(var _0x13e1fc=0x0;_0x13e1fc<_0x24cd65[_0xe94c('0x3e')];_0x13e1fc+=0x1){_0x1f6201=_0x24cd65[_0x13e1fc][_0xe94c('0x67')]?_0x1c08e0[_0x24cd65[_0x13e1fc][_0xe94c('0x67')]]['metric']:_0x24cd65[_0x13e1fc][_0xe94c('0x5d')];_0x1f6201=_0x24cd65[_0x13e1fc][_0xe94c('0x82')]?_['replace'](_0xc20adc[_0x24cd65[_0x13e1fc]['function']],'%s',_0x1f6201):_0x1f6201;_0x1f6201=_0x24cd65[_0x13e1fc][_0xe94c('0x6a')]?_[_0xe94c('0x69')](_0x19a36b[_0x24cd65[_0x13e1fc]['format']],'%s',_0x1f6201):_0x1f6201;if(_0x24cd65[_0x13e1fc]['groupBy']){_0xbf15d3[_0xe94c('0x5c')](_0x1f6201);}_0x24cd65[_0x13e1fc][_0xe94c('0x6b')]&&_0xbf15d3[_0xe94c('0x2f')](_0x1f6201,_0x24cd65[_0x13e1fc][_0xe94c('0x6b')]===_0xe94c('0x6c')?![]:!![]);_0xbf15d3[_0xe94c('0x5d')](_0x1f6201,_0x24cd65[_0x13e1fc][_0xe94c('0x6d')]||_0x1f6201);}if(_0x44c4a1[_0xe94c('0x6e')]){_0x44c4a1['joins']=JSON['parse'](_0x44c4a1[_0xe94c('0x6e')]);for(var _0x558340=0x0;_0x558340<_0x44c4a1[_0xe94c('0x6e')][_0xe94c('0x3e')];_0x558340+=0x1){if(_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x6f')]&&_[_0xe94c('0x55')](_0x37a5f9,_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x6f')])&&_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x70')]&&_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x71')]&&_0x44c4a1['joins'][_0x558340][_0xe94c('0x72')]){_0xbf15d3[_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x6f')]](_0x44c4a1[_0xe94c('0x6e')][_0x558340][_0xe94c('0x71')],null,util['format'](_0xe94c('0x73'),_0x44c4a1[_0xe94c('0x66')],_0x44c4a1['joins'][_0x558340][_0xe94c('0x70')],_0x44c4a1[_0xe94c('0x6e')][_0x558340]['foreignTable'],_0x44c4a1['joins'][_0x558340][_0xe94c('0x72')]));}}}if(_0x44c4a1[_0xe94c('0x75')]){_0x44c4a1[_0xe94c('0x75')]=JSON['parse'](_0x44c4a1['conditions']);_0xbf15d3[_0xe94c('0x31')](_0x57b01d(_0x44c4a1[_0xe94c('0x75')][_0xe94c('0x5c')]));}_0x516046=_0xbf15d3['clone']();_0xbf15d3[_0xe94c('0x16')](_0x1eb95d);_0xbf15d3[_0xe94c('0x15')](0x0);logger[_0xe94c('0x77')](_0xe94c('0x78'),_0xbf15d3[_0xe94c('0x79')]());return db['sequelize'][_0xe94c('0x24')](_0xbf15d3[_0xe94c('0x79')](),{'type':db['sequelize'][_0xe94c('0x7b')][_0xe94c('0x7c')]});}})[_0xe94c('0x1d')](function(){return{'sql':_0x516046['toString']()};})[_0xe94c('0x1d')](respondWithResult(_0x2102dc,null))[_0xe94c('0x43')](handleError(_0x2102dc,null));}; \ No newline at end of file +var _0xd17b=['limit','offset','order','sort','where','filters','pick','add','day','merge','filter','map','then','include','findAll','rows','catch','show','params','AnalyticCustomReport','rawAttributes','includeAll','options','create','body','find','join','right_join','outer_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','keyBy','select','from','table','MetricId','function','replace','format','orderBy','DESC','field','joins','type','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','parse','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','MIN(%s)','UNIX_TIMESTAMP(%s)','Sequelize','metric','groupBy','alias','clone','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','request-promise','moment','mustache','util','path','to-csv','squel','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','apply','reject','update','destroy','error','stack','name','send','index','dateStart','query','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x15a34f,_0x1378ba){var _0x2e7b6b=function(_0x1fbfa2){while(--_0x1fbfa2){_0x15a34f['push'](_0x15a34f['shift']());}};_0x2e7b6b(++_0x1378ba);}(_0xd17b,0x6a));var _0xbd17=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0xd17b[_0xa990b7];return _0x52c99c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xbd17('0x0'));var moment=require(_0xbd17('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xbd17('0x2'));var util=require(_0xbd17('0x3'));var path=require(_0xbd17('0x4'));var sox=require('sox');var csv=require(_0xbd17('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xbd17('0x6'));var crypto=require('crypto');var jsforce=require(_0xbd17('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xbd17('0x5'));var querystring=require(_0xbd17('0x8'));var Papa=require(_0xbd17('0x9'));var qs=require(_0xbd17('0xa'));var logger=require('../../config/logger')(_0xbd17('0xb'));var utils=require(_0xbd17('0xc'));var config=require(_0xbd17('0xd'));var db=require(_0xbd17('0xe'))['db'];function respondWithStatusCode(_0x4b5360,_0x105aeb){_0x105aeb=_0x105aeb||0xcc;return function(_0x3d776c){if(_0x3d776c){return _0x4b5360[_0xbd17('0xf')](_0x105aeb);}return _0x4b5360[_0xbd17('0x10')](_0x105aeb)[_0xbd17('0x11')]();};}function respondWithResult(_0x15e012,_0x3a9c5f){_0x3a9c5f=_0x3a9c5f||0xc8;return function(_0x4015f4){if(_0x4015f4){return _0x15e012[_0xbd17('0x10')](_0x3a9c5f)[_0xbd17('0x12')](_0x4015f4);}};}function respondWithFilteredResult(_0x2e5f2a,_0xd6ea73){return function(_0x589499){if(_0x589499){var _0x227be5=_0x589499[_0xbd17('0x13')],_0x21649e=_0xd6ea73['offset'],_0x452096=_0xd6ea73['offset']+_0xd6ea73['limit'],_0x53f01c;if(_0x452096>=_0x227be5){_0x452096=_0x227be5;_0x53f01c=0xc8;}else{_0x53f01c=0xce;}_0x2e5f2a['status'](_0x53f01c);return _0x2e5f2a[_0xbd17('0x14')]('Content-Range',_0x21649e+'-'+_0x452096+'/'+_0x227be5)[_0xbd17('0x12')](_0x589499);}return null;};}function patchUpdates(_0x1ee345){return function(_0x4b0017){try{jsonpatch[_0xbd17('0x15')](_0x4b0017,_0x1ee345,!![]);}catch(_0x13a3c1){return BPromise[_0xbd17('0x16')](_0x13a3c1);}return _0x4b0017['save']();};}function saveUpdates(_0x5c53de,_0x2d6b38){return function(_0x32f1a1){if(_0x32f1a1){return _0x32f1a1[_0xbd17('0x17')](_0x5c53de)['then'](function(_0x371713){return _0x371713;});}return null;};}function removeEntity(_0x16b805,_0x20a0d2){return function(_0x5c3971){if(_0x5c3971){return _0x5c3971[_0xbd17('0x18')]()['then'](function(){_0x16b805[_0xbd17('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b3a7f,_0x2fc50b){return function(_0x3c85f1){if(!_0x3c85f1){_0x3b3a7f[_0xbd17('0xf')](0x194);}return _0x3c85f1;};}function handleError(_0x1cbb86,_0x502c2e){_0x502c2e=_0x502c2e||0x1f4;return function(_0x492151){logger[_0xbd17('0x19')](_0x492151[_0xbd17('0x1a')]);if(_0x492151[_0xbd17('0x1b')]){delete _0x492151['name'];}_0x1cbb86[_0xbd17('0x10')](_0x502c2e)[_0xbd17('0x1c')](_0x492151);};}exports[_0xbd17('0x1d')]=function(_0x2bd5bf,_0x547cad){var _0x5d6c03={},_0x19a35e={},_0x325a69={'count':0x0,'rows':[]};var _0x473c49=db['AnalyticCustomReport']['rawAttributes'];_0x19a35e['model']=_['keys'](_0x473c49);var _0xf4d902={'dateStart':_0x2bd5bf['query'][_0xbd17('0x1e')],'dateEnd':_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x20')]};delete _0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x1e')];delete _0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x20')];_0x19a35e[_0xbd17('0x1f')]=_[_0xbd17('0x21')](_0x2bd5bf[_0xbd17('0x1f')]);_0x19a35e['filters']=_[_0xbd17('0x22')](_0x19a35e[_0xbd17('0x23')],_0x19a35e[_0xbd17('0x1f')]);_0x5d6c03[_0xbd17('0x24')]=_['intersection'](_0x19a35e[_0xbd17('0x23')],qs[_0xbd17('0x25')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x25')]));_0x5d6c03['attributes']=_0x5d6c03[_0xbd17('0x24')][_0xbd17('0x26')]?_0x5d6c03[_0xbd17('0x24')]:_0x19a35e['model'];if(!_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x27')]('nolimit')){_0x5d6c03[_0xbd17('0x28')]=qs[_0xbd17('0x28')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x28')]);_0x5d6c03[_0xbd17('0x29')]=qs[_0xbd17('0x29')](_0x2bd5bf[_0xbd17('0x1f')]['offset']);}_0x5d6c03[_0xbd17('0x2a')]=qs[_0xbd17('0x2b')](_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x2b')]);_0x5d6c03[_0xbd17('0x2c')]=qs[_0xbd17('0x2d')](_[_0xbd17('0x2e')](_0x2bd5bf['query'],_0x19a35e[_0xbd17('0x2d')]));if(_0xf4d902['dateStart']){if(_0xf4d902[_0xbd17('0x20')]){_0xf4d902['dateEnd']=moment(_0xf4d902['dateEnd'])[_0xbd17('0x2f')](0x1,_0xbd17('0x30'));}else{_0xf4d902['dateEnd']=moment(_0xf4d902[_0xbd17('0x1e')])[_0xbd17('0x2f')](0x1,'day');}_[_0xbd17('0x31')](_0x5d6c03[_0xbd17('0x2c')],{'createdAt':{'$gte':_0xf4d902[_0xbd17('0x1e')],'$lte':_0xf4d902[_0xbd17('0x20')]}});}if(_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x32')]){_0x5d6c03[_0xbd17('0x2c')]=_[_0xbd17('0x31')](_0x5d6c03['where'],{'$or':_[_0xbd17('0x33')](_0x5d6c03[_0xbd17('0x24')],function(_0x2e8e7f){var _0x454861={};_0x454861[_0x2e8e7f]={'$like':'%'+_0x2bd5bf[_0xbd17('0x1f')][_0xbd17('0x32')]+'%'};return _0x454861;})});}_0x5d6c03=_['merge']({},_0x5d6c03,_0x2bd5bf['options']);var _0x204710={'where':_0x5d6c03['where']};return db['AnalyticCustomReport'][_0xbd17('0x13')](_0x204710)[_0xbd17('0x34')](function(_0xe57e3f){_0x325a69[_0xbd17('0x13')]=_0xe57e3f;if(_0x2bd5bf[_0xbd17('0x1f')]['includeAll']){_0x5d6c03[_0xbd17('0x35')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xbd17('0x36')](_0x5d6c03);})[_0xbd17('0x34')](function(_0x21e359){_0x325a69[_0xbd17('0x37')]=_0x21e359;return _0x325a69;})[_0xbd17('0x34')](respondWithFilteredResult(_0x547cad,_0x5d6c03))[_0xbd17('0x38')](handleError(_0x547cad,null));};exports[_0xbd17('0x39')]=function(_0x432011,_0x4873a1){var _0x35d3ae={'raw':![],'where':{'id':_0x432011[_0xbd17('0x3a')]['id']}},_0x510bf2={};_0x510bf2[_0xbd17('0x23')]=_[_0xbd17('0x21')](db[_0xbd17('0x3b')][_0xbd17('0x3c')]);_0x510bf2[_0xbd17('0x1f')]=_[_0xbd17('0x21')](_0x432011[_0xbd17('0x1f')]);_0x510bf2[_0xbd17('0x2d')]=_[_0xbd17('0x22')](_0x510bf2['model'],_0x510bf2[_0xbd17('0x1f')]);_0x35d3ae[_0xbd17('0x24')]=_['intersection'](_0x510bf2[_0xbd17('0x23')],qs[_0xbd17('0x25')](_0x432011['query'][_0xbd17('0x25')]));_0x35d3ae[_0xbd17('0x24')]=_0x35d3ae[_0xbd17('0x24')]['length']?_0x35d3ae[_0xbd17('0x24')]:_0x510bf2[_0xbd17('0x23')];if(_0x432011[_0xbd17('0x1f')][_0xbd17('0x3d')]){_0x35d3ae['include']=[{'all':!![]}];}_0x35d3ae=_[_0xbd17('0x31')]({},_0x35d3ae,_0x432011[_0xbd17('0x3e')]);return db[_0xbd17('0x3b')]['find'](_0x35d3ae)[_0xbd17('0x34')](handleEntityNotFound(_0x4873a1,null))['then'](respondWithResult(_0x4873a1,null))[_0xbd17('0x38')](handleError(_0x4873a1,null));};exports['create']=function(_0x347958,_0x2cbae4){return db['AnalyticCustomReport'][_0xbd17('0x3f')](_0x347958['body'],{})[_0xbd17('0x34')](respondWithResult(_0x2cbae4,0xc9))[_0xbd17('0x38')](handleError(_0x2cbae4,null));};exports[_0xbd17('0x17')]=function(_0x5f2954,_0x1d7e28){if(_0x5f2954[_0xbd17('0x40')]['id']){delete _0x5f2954['body']['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x5f2954[_0xbd17('0x3a')]['id']}})[_0xbd17('0x34')](handleEntityNotFound(_0x1d7e28,null))[_0xbd17('0x34')](saveUpdates(_0x5f2954[_0xbd17('0x40')],null))['then'](respondWithResult(_0x1d7e28,null))[_0xbd17('0x38')](handleError(_0x1d7e28,null));};exports[_0xbd17('0x18')]=function(_0x4ad8bb,_0x5ab8f4){return db[_0xbd17('0x3b')][_0xbd17('0x41')]({'where':{'id':_0x4ad8bb['params']['id']}})[_0xbd17('0x34')](handleEntityNotFound(_0x5ab8f4,null))[_0xbd17('0x34')](removeEntity(_0x5ab8f4,null))['catch'](handleError(_0x5ab8f4,null));};exports['preview']=function(_0x543696,_0xfb286e){var _0x11c9a4=0xa;var _0x156e3e=[_0xbd17('0x42'),'left_join',_0xbd17('0x43'),_0xbd17('0x44'),'cross_join'];var _0x47ef4b={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':_0xbd17('0x47'),'MAX':_0xbd17('0x48'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbd17('0x4a')};var _0x2fdfad={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':_0xbd17('0x4c'),'HOUR':_0xbd17('0x4d'),'ROUND':_0xbd17('0x4e'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x6465cd=function(_0x80ae1){return!_[_0xbd17('0x4f')]([_0xbd17('0x50'),_0xbd17('0x51'),_0xbd17('0x52'),_0xbd17('0x53')],_0x80ae1);};var _0x5302b=function(_0x280862){if(!_0x280862||!_0x280862[_0xbd17('0x54')]['length']){return'';}for(var _0x3092e4='(',_0x2aa853=0x0;_0x2aa853<_0x280862[_0xbd17('0x54')]['length'];_0x2aa853+=0x1){_0x2aa853>0x0&&(_0x3092e4+='\x20'+_0x280862[_0xbd17('0x55')]+'\x20');_0x3092e4+=_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x56')]?_0x5302b(_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x56')]):_0x280862[_0xbd17('0x54')][_0x2aa853]['field']+'\x20'+_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x57')]+(_0x6465cd(_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x57')])?'\x20'+_0x280862[_0xbd17('0x54')][_0x2aa853][_0xbd17('0x58')]:'');}return _0x3092e4+')';};var _0x504d3a={'where':{'id':_0x543696[_0xbd17('0x3a')]['id']}},_0x625107,_0x1caec3,_0x118171,_0x30bbe6,_0x244fe3;_0x504d3a=_[_0xbd17('0x31')]({},_0x504d3a,_0x543696['options']);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x504d3a)[_0xbd17('0x34')](function(_0x38cf2a){if(_0x38cf2a){_0x625107=_0x38cf2a;return _0x38cf2a[_0xbd17('0x59')]();}return null;})[_0xbd17('0x34')](function(_0xbdeb1d){if(_0xbdeb1d){if(!_0xbdeb1d['length']){throw new db['Sequelize'][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x1caec3=_0xbdeb1d;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})['then'](function(_0xa5ff10){if(_0xa5ff10){_0x118171=_[_0xbd17('0x5d')](_0xa5ff10,'id');var _0x5e0aff;var _0x54bec4=squel[_0xbd17('0x5e')]();_0x54bec4[_0xbd17('0x5f')](_0x625107[_0xbd17('0x60')]);for(var _0x436295=0x0;_0x436295<_0x1caec3[_0xbd17('0x26')];_0x436295+=0x1){_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x61')]?_0x118171[_0x1caec3[_0x436295]['MetricId']]['metric']:_0x1caec3[_0x436295]['field'];_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x62')]?_[_0xbd17('0x63')](_0x47ef4b[_0x1caec3[_0x436295][_0xbd17('0x62')]],'%s',_0x5e0aff):_0x5e0aff;_0x5e0aff=_0x1caec3[_0x436295][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x2fdfad[_0x1caec3[_0x436295]['format']],'%s',_0x5e0aff):_0x5e0aff;if(_0x1caec3[_0x436295]['groupBy']){_0x54bec4[_0xbd17('0x56')](_0x5e0aff);}_0x1caec3[_0x436295][_0xbd17('0x65')]&&_0x54bec4[_0xbd17('0x2a')](_0x5e0aff,_0x1caec3[_0x436295][_0xbd17('0x65')]===_0xbd17('0x66')?![]:!![]);_0x54bec4[_0xbd17('0x67')](_0x5e0aff,_0x1caec3[_0x436295]['alias']||_0x5e0aff);}if(_0x625107[_0xbd17('0x68')]){_0x625107['joins']=JSON['parse'](_0x625107[_0xbd17('0x68')]);for(var _0x2e70d0=0x0;_0x2e70d0<_0x625107[_0xbd17('0x68')][_0xbd17('0x26')];_0x2e70d0+=0x1){if(_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')]&&_[_0xbd17('0x4f')](_0x156e3e,_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')])&&_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6a')]&&_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6b')]&&_0x625107[_0xbd17('0x68')][_0x2e70d0]['foreignKey']){_0x54bec4[_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x69')]](_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6b')],null,util[_0xbd17('0x64')](_0xbd17('0x6c'),_0x625107[_0xbd17('0x60')],_0x625107[_0xbd17('0x68')][_0x2e70d0][_0xbd17('0x6a')],_0x625107['joins'][_0x2e70d0][_0xbd17('0x6b')],_0x625107['joins'][_0x2e70d0][_0xbd17('0x6d')]));}}}if(_0x625107[_0xbd17('0x6e')]){_0x625107['conditions']=JSON[_0xbd17('0x6f')](_0x625107[_0xbd17('0x6e')]);_0x54bec4[_0xbd17('0x2c')](_0x5302b(_0x625107['conditions'][_0xbd17('0x56')]));}_0x244fe3=_0x54bec4['clone']();_0x54bec4[_0xbd17('0x28')](_0x11c9a4);_0x54bec4[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x54bec4[_0xbd17('0x72')]());return db[_0xbd17('0x73')][_0xbd17('0x1f')](_0x54bec4['toString'](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})['then'](respondWithResult(_0xfb286e,null))[_0xbd17('0x38')](handleError(_0xfb286e,null));};function runReport(_0x2b51d6,_0x2f94f7,_0x59cee8){var _0x50b4fe=_0x2f94f7[_0xbd17('0x1b')];var _0x1cb6f8=0xa;var _0x1c6c00=['join',_0xbd17('0x76'),_0xbd17('0x43'),_0xbd17('0x44'),_0xbd17('0x77')];var _0x116f17={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':_0xbd17('0x47'),'MAX':_0xbd17('0x48'),'MIN':_0xbd17('0x78'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x30253d={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':_0xbd17('0x4c'),'HOUR':_0xbd17('0x4d'),'ROUND':_0xbd17('0x4e'),'UNIX_TIMESTAMP':_0xbd17('0x79')};var _0x31c045=function(_0x265267){return!_['includes']([_0xbd17('0x50'),_0xbd17('0x51'),_0xbd17('0x52'),_0xbd17('0x53')],_0x265267);};var _0xc9365f=function(_0xa1eeec){if(!_0xa1eeec||!_0xa1eeec[_0xbd17('0x54')][_0xbd17('0x26')]){return'';}for(var _0x16f43b='(',_0x3d5412=0x0;_0x3d5412<_0xa1eeec[_0xbd17('0x54')]['length'];_0x3d5412+=0x1){_0x3d5412>0x0&&(_0x16f43b+='\x20'+_0xa1eeec[_0xbd17('0x55')]+'\x20');_0x16f43b+=_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['group']?_0xc9365f(_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['group']):_0xa1eeec[_0xbd17('0x54')][_0x3d5412][_0xbd17('0x67')]+'\x20'+_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['condition']+(_0x31c045(_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['condition'])?'\x20'+_0xa1eeec[_0xbd17('0x54')][_0x3d5412]['value']:'');}return _0x16f43b+')';};var _0x551b91={'where':{'id':_0x2b51d6['id']}},_0x3806c4,_0x8f5e1b,_0x382e88,_0x53a099,_0x17dedd;_0x551b91=_[_0xbd17('0x31')]({},_0x551b91,_0x59cee8);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x551b91)[_0xbd17('0x34')](function(_0x3d845a){if(_0x3d845a){_0x3806c4=_0x3d845a;return _0x3d845a[_0xbd17('0x59')]();}return null;})[_0xbd17('0x34')](function(_0x4db8ef){if(_0x4db8ef){if(!_0x4db8ef['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x8f5e1b=_0x4db8ef;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})[_0xbd17('0x34')](function(_0x518dc5){if(_0x518dc5){_0x382e88=_[_0xbd17('0x5d')](_0x518dc5,'id');var _0x412846;var _0x1b759c=squel[_0xbd17('0x5e')]();_0x1b759c['from'](_0x3806c4[_0xbd17('0x60')]);for(var _0x5f3760=0x0;_0x5f3760<_0x8f5e1b['length'];_0x5f3760+=0x1){_0x412846=_0x8f5e1b[_0x5f3760][_0xbd17('0x61')]?_0x382e88[_0x8f5e1b[_0x5f3760][_0xbd17('0x61')]][_0xbd17('0x7b')]:_0x8f5e1b[_0x5f3760]['field'];_0x412846=_0x8f5e1b[_0x5f3760]['function']?_['replace'](_0x116f17[_0x8f5e1b[_0x5f3760]['function']],'%s',_0x412846):_0x412846;_0x412846=_0x8f5e1b[_0x5f3760][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x30253d[_0x8f5e1b[_0x5f3760]['format']],'%s',_0x412846):_0x412846;if(_0x8f5e1b[_0x5f3760][_0xbd17('0x7c')]){_0x1b759c[_0xbd17('0x56')](_0x412846);}_0x8f5e1b[_0x5f3760][_0xbd17('0x65')]&&_0x1b759c[_0xbd17('0x2a')](_0x412846,_0x8f5e1b[_0x5f3760][_0xbd17('0x65')]===_0xbd17('0x66')?![]:!![]);_0x1b759c[_0xbd17('0x67')](_0x412846,_0x8f5e1b[_0x5f3760][_0xbd17('0x7d')]||_0x412846);}if(_0x3806c4['joins']){_0x3806c4[_0xbd17('0x68')]=JSON[_0xbd17('0x6f')](_0x3806c4[_0xbd17('0x68')]);for(var _0x50796e=0x0;_0x50796e<_0x3806c4[_0xbd17('0x68')][_0xbd17('0x26')];_0x50796e+=0x1){if(_0x3806c4['joins'][_0x50796e][_0xbd17('0x69')]&&_['includes'](_0x1c6c00,_0x3806c4['joins'][_0x50796e][_0xbd17('0x69')])&&_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6a')]&&_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')]&&_0x3806c4['joins'][_0x50796e]['foreignKey']){_0x1b759c[_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x69')]](_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')],null,util[_0xbd17('0x64')](_0xbd17('0x6c'),_0x3806c4[_0xbd17('0x60')],_0x3806c4['joins'][_0x50796e][_0xbd17('0x6a')],_0x3806c4[_0xbd17('0x68')][_0x50796e][_0xbd17('0x6b')],_0x3806c4['joins'][_0x50796e]['foreignKey']));}}}if(_0x3806c4[_0xbd17('0x6e')]){_0x3806c4['conditions']=JSON[_0xbd17('0x6f')](_0x3806c4['conditions']);_0x1b759c[_0xbd17('0x2c')](_0xc9365f(_0x3806c4[_0xbd17('0x6e')][_0xbd17('0x56')]));}_0x17dedd=_0x1b759c[_0xbd17('0x7e')]();_0x1b759c[_0xbd17('0x28')](_0x1cb6f8);_0x1b759c[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x1b759c[_0xbd17('0x72')]());return db[_0xbd17('0x73')]['query'](_0x1b759c['toString'](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})[_0xbd17('0x34')](function(_0xf5c143){if(!_0xf5c143['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))]('No\x20Data!');}if(_0x2f94f7[_0xbd17('0x7f')]==='web'){return null;}var _0x562ffd=_[_0xbd17('0x31')](_0x2f94f7,{'name':_0x2f94f7[_0xbd17('0x80')]||_0x2f94f7[_0xbd17('0x1b')]||_0x3806c4[_0xbd17('0x1b')],'basename':_0x50b4fe,'savename':util['format'](_0xbd17('0x81'),_0x2f94f7[_0xbd17('0x1b')]||_0x3806c4[_0xbd17('0x1b')],require(_0xbd17('0x82'))[_0xbd17('0x83')](0x4),_0x2f94f7[_0xbd17('0x7f')]||_0xbd17('0x84'))});return db[_0xbd17('0x85')][_0xbd17('0x3f')](_0x562ffd,{'raw':!![]});})[_0xbd17('0x34')](function(_0x321294){_0x17dedd['where'](_0x3806c4[_0xbd17('0x60')]+_0xbd17('0x86'),_0x2f94f7['startDate'],_0x2f94f7['endDate']);if(_0x321294){logger[_0xbd17('0x87')]('Run\x20Query:',_0x17dedd[_0xbd17('0x72')]());require(_0xbd17('0x88'))[_0xbd17('0x89')](path['join'](__dirname,_0xbd17('0x8a'),_0x321294[_0xbd17('0x7f')]),[_0x321294['id'],_0x17dedd[_0xbd17('0x72')](),path[_0xbd17('0x42')](__dirname,_0xbd17('0x8b'),_0x321294[_0xbd17('0x8c')]),_0x50b4fe]);return _0x321294;}else{var _0x551796=squel['select']();_0x551796[_0xbd17('0x5f')]('('+_0x17dedd[_0xbd17('0x72')]()+')',_0xbd17('0x8d'));_0x551796[_0xbd17('0x67')](_0xbd17('0x8e'),_0xbd17('0x13'));_0x17dedd[_0xbd17('0x28')](_0x2f94f7[_0xbd17('0x28')]||_0x1cb6f8);_0x17dedd['offset'](_0x2f94f7['offset']||0x0);return db['sequelize']['query'](_0x551796[_0xbd17('0x72')](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')]['SELECT']})[_0xbd17('0x34')](function(_0x41878d){if(!_0x41878d[_0xbd17('0x26')]){_0x53a099=0x0;}else{_0x53a099=_0x41878d[0x0]['count']||0x0;}return db['sequelize']['query'](_0x17dedd['toString'](),{'type':db['sequelize'][_0xbd17('0x74')][_0xbd17('0x75')]});})[_0xbd17('0x34')](function(_0x46f69a){return{'rows':_0x46f69a||[],'count':_0x53a099};});}});}exports['run']=function(_0x5775a2,_0x47d90f){return runReport(_0x5775a2[_0xbd17('0x3a')],_0x5775a2[_0xbd17('0x1f')],_0x5775a2[_0xbd17('0x3e')])['then'](respondWithResult(_0x47d90f,null))[_0xbd17('0x38')](handleError(_0x47d90f,null));};exports[_0xbd17('0x8f')]=runReport;exports[_0xbd17('0x1f')]=function(_0x466545,_0x4656bf){var _0x2a71c4=0xa;var _0x48edc1=[_0xbd17('0x42'),'left_join',_0xbd17('0x43'),_0xbd17('0x44'),'cross_join'];var _0x3a2fc9={'SUM':_0xbd17('0x45'),'COUNT':_0xbd17('0x46'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xbd17('0x78'),'AVG':_0xbd17('0x90'),'GROUP_CONCAT':_0xbd17('0x49'),'GROUP_CONCAT ASC':_0xbd17('0x91'),'GROUP_CONCAT DESC':_0xbd17('0x4a')};var _0x3f4dc0={'SEC_TO_TIME':_0xbd17('0x4b'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbd17('0x79')};var _0x4bae15=function(_0x353293){return!_[_0xbd17('0x4f')]([_0xbd17('0x50'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xbd17('0x53')],_0x353293);};var _0x419f54=function(_0x231a3e){if(!_0x231a3e||!_0x231a3e[_0xbd17('0x54')][_0xbd17('0x26')]){return'';}for(var _0x20d936='(',_0x106d13=0x0;_0x106d13<_0x231a3e[_0xbd17('0x54')][_0xbd17('0x26')];_0x106d13+=0x1){_0x106d13>0x0&&(_0x20d936+='\x20'+_0x231a3e[_0xbd17('0x55')]+'\x20');_0x20d936+=_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x56')]?_0x419f54(_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x56')]):_0x231a3e['rules'][_0x106d13][_0xbd17('0x67')]+'\x20'+_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x57')]+(_0x4bae15(_0x231a3e[_0xbd17('0x54')][_0x106d13][_0xbd17('0x57')])?'\x20'+_0x231a3e['rules'][_0x106d13]['value']:'');}return _0x20d936+')';};var _0x55f5d9={'where':{'id':_0x466545[_0xbd17('0x3a')]['id']}},_0x31f600,_0x529e41,_0xbb7c7a,_0x2e538d,_0x562d4d;_0x55f5d9=_[_0xbd17('0x31')]({},_0x55f5d9,_0x466545[_0xbd17('0x3e')]);return db[_0xbd17('0x3b')][_0xbd17('0x41')](_0x55f5d9)[_0xbd17('0x34')](function(_0x8bedf9){if(_0x8bedf9){_0x31f600=_0x8bedf9;return _0x8bedf9[_0xbd17('0x59')]();}return null;})['then'](function(_0x4fe05d){if(_0x4fe05d){if(!_0x4fe05d['length']){throw new db[(_0xbd17('0x7a'))][(_0xbd17('0x5a'))](_0xbd17('0x5b'));}_0x529e41=_0x4fe05d;return db[_0xbd17('0x5c')][_0xbd17('0x36')]({'raw':!![]});}return null;})[_0xbd17('0x34')](function(_0x285bb0){if(_0x285bb0){_0xbb7c7a=_[_0xbd17('0x5d')](_0x285bb0,'id');var _0x4fc401;var _0x59bf86=squel[_0xbd17('0x5e')]();_0x59bf86[_0xbd17('0x5f')](_0x31f600['table']);for(var _0x1a5dfa=0x0;_0x1a5dfa<_0x529e41['length'];_0x1a5dfa+=0x1){_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x61')]?_0xbb7c7a[_0x529e41[_0x1a5dfa][_0xbd17('0x61')]]['metric']:_0x529e41[_0x1a5dfa][_0xbd17('0x67')];_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x62')]?_[_0xbd17('0x63')](_0x3a2fc9[_0x529e41[_0x1a5dfa][_0xbd17('0x62')]],'%s',_0x4fc401):_0x4fc401;_0x4fc401=_0x529e41[_0x1a5dfa][_0xbd17('0x64')]?_[_0xbd17('0x63')](_0x3f4dc0[_0x529e41[_0x1a5dfa][_0xbd17('0x64')]],'%s',_0x4fc401):_0x4fc401;if(_0x529e41[_0x1a5dfa][_0xbd17('0x7c')]){_0x59bf86[_0xbd17('0x56')](_0x4fc401);}_0x529e41[_0x1a5dfa][_0xbd17('0x65')]&&_0x59bf86[_0xbd17('0x2a')](_0x4fc401,_0x529e41[_0x1a5dfa]['orderBy']===_0xbd17('0x66')?![]:!![]);_0x59bf86['field'](_0x4fc401,_0x529e41[_0x1a5dfa]['alias']||_0x4fc401);}if(_0x31f600[_0xbd17('0x68')]){_0x31f600['joins']=JSON['parse'](_0x31f600[_0xbd17('0x68')]);for(var _0x25bf52=0x0;_0x25bf52<_0x31f600[_0xbd17('0x68')][_0xbd17('0x26')];_0x25bf52+=0x1){if(_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x69')]&&_[_0xbd17('0x4f')](_0x48edc1,_0x31f600['joins'][_0x25bf52][_0xbd17('0x69')])&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6a')]&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')]&&_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6d')]){_0x59bf86[_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x69')]](_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')],null,util['format'](_0xbd17('0x6c'),_0x31f600[_0xbd17('0x60')],_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6a')],_0x31f600[_0xbd17('0x68')][_0x25bf52][_0xbd17('0x6b')],_0x31f600['joins'][_0x25bf52][_0xbd17('0x6d')]));}}}if(_0x31f600['conditions']){_0x31f600[_0xbd17('0x6e')]=JSON[_0xbd17('0x6f')](_0x31f600[_0xbd17('0x6e')]);_0x59bf86[_0xbd17('0x2c')](_0x419f54(_0x31f600[_0xbd17('0x6e')][_0xbd17('0x56')]));}_0x562d4d=_0x59bf86[_0xbd17('0x7e')]();_0x59bf86[_0xbd17('0x28')](_0x2a71c4);_0x59bf86[_0xbd17('0x29')](0x0);logger[_0xbd17('0x70')](_0xbd17('0x71'),_0x59bf86[_0xbd17('0x72')]());return db[_0xbd17('0x73')][_0xbd17('0x1f')](_0x59bf86[_0xbd17('0x72')](),{'type':db[_0xbd17('0x73')][_0xbd17('0x74')][_0xbd17('0x75')]});}})['then'](function(){return{'sql':_0x562d4d[_0xbd17('0x72')]()};})[_0xbd17('0x34')](respondWithResult(_0x4656bf,null))[_0xbd17('0x38')](handleError(_0x4656bf,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 9642301..343d920 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 _0x1649=['util','../../config/logger','moment','bluebird','request-promise','exports','AnalyticCustomReport','lodash'];(function(_0x3d5f7a,_0x189a90){var _0xce3308=function(_0x22c66b){while(--_0x22c66b){_0x3d5f7a['push'](_0x3d5f7a['shift']());}};_0xce3308(++_0x189a90);}(_0x1649,0xff));var _0x9164=function(_0x17355a,_0x383a93){_0x17355a=_0x17355a-0x0;var _0x344bb9=_0x1649[_0x17355a];return _0x344bb9;};'use strict';var _=require(_0x9164('0x0'));var util=require(_0x9164('0x1'));var logger=require(_0x9164('0x2'))('api');var moment=require(_0x9164('0x3'));var BPromise=require(_0x9164('0x4'));var rp=require(_0x9164('0x5'));var attributes=require('./analyticCustomReport.attributes');module[_0x9164('0x6')]=function(_0x2692d2,_0x1606e4){return _0x2692d2['define'](_0x9164('0x7'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x35d7=['lodash','../../config/logger','api','bluebird','request-promise','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x18d8da,_0x42f2e5){var _0x389119=function(_0x3f561b){while(--_0x3f561b){_0x18d8da['push'](_0x18d8da['shift']());}};_0x389119(++_0x42f2e5);}(_0x35d7,0x19a));var _0x735d=function(_0x3fbe3f,_0x3be178){_0x3fbe3f=_0x3fbe3f-0x0;var _0x33bed3=_0x35d7[_0x3fbe3f];return _0x33bed3;};'use strict';var _=require(_0x735d('0x0'));var util=require('util');var logger=require(_0x735d('0x1'))(_0x735d('0x2'));var moment=require('moment');var BPromise=require(_0x735d('0x3'));var rp=require(_0x735d('0x4'));var attributes=require(_0x735d('0x5'));module[_0x735d('0x6')]=function(_0x1c217c,_0x5e1837){return _0x1c217c[_0x735d('0x7')](_0x735d('0x8'),attributes,{'tableName':_0x735d('0x9'),'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 21648dc..17b8dc3 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 _0x595c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x4a6eb0,_0x2836aa){var _0x3fc3e0=function(_0x44c43a){while(--_0x44c43a){_0x4a6eb0['push'](_0x4a6eb0['shift']());}};_0x3fc3e0(++_0x2836aa);}(_0x595c,0xb2));var _0xc595=function(_0x50f592,_0x5c712a){_0x50f592=_0x50f592-0x0;var _0x247acd=_0x595c[_0x50f592];return _0x247acd;};'use strict';var _=require(_0xc595('0x0'));var util=require(_0xc595('0x1'));var moment=require(_0xc595('0x2'));var BPromise=require(_0xc595('0x3'));var rs=require(_0xc595('0x4'));var fs=require('fs');var db=require(_0xc595('0x5'))['db'];var utils=require(_0xc595('0x6'));var logger=require(_0xc595('0x7'))(_0xc595('0x8'));var config=require(_0xc595('0x9'));var jayson=require(_0xc595('0xa'));var client=jayson[_0xc595('0xb')][_0xc595('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x29a5cb,_0x7480cb,_0x145bd0){return new BPromise(function(_0x10e601,_0x111629){return client[_0xc595('0xd')](_0x29a5cb,_0x145bd0)['then'](function(_0x3d75b8){logger[_0xc595('0xe')](_0xc595('0xf'),_0x7480cb,_0xc595('0x10'));logger[_0xc595('0x11')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x7480cb,_0xc595('0x10'),JSON['stringify'](_0x3d75b8));if(_0x3d75b8[_0xc595('0x12')]){if(_0x3d75b8[_0xc595('0x12')][_0xc595('0x13')]===0x1f4){logger[_0xc595('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x7480cb,_0x3d75b8[_0xc595('0x12')][_0xc595('0x14')]);return _0x111629(_0x3d75b8[_0xc595('0x12')][_0xc595('0x14')]);}logger[_0xc595('0x12')](_0xc595('0xf'),_0x7480cb,_0x3d75b8[_0xc595('0x12')][_0xc595('0x14')]);return _0x10e601(_0x3d75b8['error']['message']);}else{logger[_0xc595('0xe')](_0xc595('0xf'),_0x7480cb,_0xc595('0x10'));_0x10e601(_0x3d75b8['result'][_0xc595('0x14')]);}})[_0xc595('0x15')](function(_0x3fbc48){logger[_0xc595('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x7480cb,_0x3fbc48);_0x111629(_0x3fbc48);});});} \ No newline at end of file +var _0xeca4=['../../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','error','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x17e843,_0xd71e6f){var _0xcacb76=function(_0x1602ac){while(--_0x1602ac){_0x17e843['push'](_0x17e843['shift']());}};_0xcacb76(++_0xd71e6f);}(_0xeca4,0x82));var _0x4eca=function(_0x583269,_0x1a63ea){_0x583269=_0x583269-0x0;var _0x22a497=_0xeca4[_0x583269];return _0x22a497;};'use strict';var _=require(_0x4eca('0x0'));var util=require(_0x4eca('0x1'));var moment=require('moment');var BPromise=require(_0x4eca('0x2'));var rs=require(_0x4eca('0x3'));var fs=require('fs');var db=require(_0x4eca('0x4'))['db'];var utils=require(_0x4eca('0x5'));var logger=require(_0x4eca('0x6'))(_0x4eca('0x7'));var config=require(_0x4eca('0x8'));var jayson=require(_0x4eca('0x9'));var client=jayson[_0x4eca('0xa')][_0x4eca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x590cc2,_0x317b2c,_0x544ba4){return new BPromise(function(_0x1ed3ce,_0xd9507d){return client[_0x4eca('0xc')](_0x590cc2,_0x544ba4)[_0x4eca('0xd')](function(_0x107270){logger[_0x4eca('0xe')](_0x4eca('0xf'),_0x317b2c,_0x4eca('0x10'));logger[_0x4eca('0x11')](_0x4eca('0x12'),_0x317b2c,_0x4eca('0x10'),JSON[_0x4eca('0x13')](_0x107270));if(_0x107270[_0x4eca('0x14')]){if(_0x107270[_0x4eca('0x14')]['code']===0x1f4){logger[_0x4eca('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x317b2c,_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);return _0xd9507d(_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);}logger[_0x4eca('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x317b2c,_0x107270[_0x4eca('0x14')][_0x4eca('0x15')]);return _0x1ed3ce(_0x107270[_0x4eca('0x14')]['message']);}else{logger[_0x4eca('0xe')](_0x4eca('0xf'),_0x317b2c,_0x4eca('0x10'));_0x1ed3ce(_0x107270['result'][_0x4eca('0x15')]);}})[_0x4eca('0x16')](function(_0x4ad91e){logger['error'](_0x4eca('0xf'),_0x317b2c,_0x4ad91e);_0xd9507d(_0x4ad91e);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index e1c7e7a..997f923 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 _0xf10c=['post','create','put','update','delete','exports','path','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf10c,0xae));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcf10('0x0'));var express=require('express');var router=express['Router']();var auth=require(_0xcf10('0x1'));var interaction=require(_0xcf10('0x2'));var config=require(_0xcf10('0x3'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcf10('0x4')]);router[_0xcf10('0x5')](_0xcf10('0x6'),auth[_0xcf10('0x7')](),controller[_0xcf10('0x8')]);router[_0xcf10('0x5')](_0xcf10('0x9'),auth['isAuthenticated'](),controller[_0xcf10('0xa')]);router[_0xcf10('0x5')](_0xcf10('0xb'),auth[_0xcf10('0x7')](),controller[_0xcf10('0xc')]);router['get'](_0xcf10('0xd'),auth[_0xcf10('0x7')](),controller[_0xcf10('0xe')]);router[_0xcf10('0xf')]('/',auth[_0xcf10('0x7')](),controller[_0xcf10('0x10')]);router[_0xcf10('0x11')](_0xcf10('0x6'),auth[_0xcf10('0x7')](),controller[_0xcf10('0x12')]);router[_0xcf10('0x13')](_0xcf10('0x6'),auth[_0xcf10('0x7')](),controller['destroy']);module[_0xcf10('0x14')]=router; \ No newline at end of file +var _0x5758=['post','put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','run','query'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x5758,0xcd));var _0x8575=function(_0x11535d,_0x7df4ba){_0x11535d=_0x11535d-0x0;var _0x542367=_0x5758[_0x11535d];return _0x542367;};'use strict';var multer=require(_0x8575('0x0'));var util=require('util');var path=require(_0x8575('0x1'));var express=require('express');var router=express[_0x8575('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x8575('0x3'));var config=require(_0x8575('0x4'));var controller=require(_0x8575('0x5'));router[_0x8575('0x6')]('/',auth[_0x8575('0x7')](),controller[_0x8575('0x8')]);router[_0x8575('0x6')]('/:id',auth[_0x8575('0x7')](),controller[_0x8575('0x9')]);router['get'](_0x8575('0xa'),auth['isAuthenticated'](),controller[_0x8575('0xb')]);router[_0x8575('0x6')](_0x8575('0xc'),auth[_0x8575('0x7')](),controller[_0x8575('0xd')]);router[_0x8575('0x6')]('/:id/query',auth[_0x8575('0x7')](),controller[_0x8575('0xe')]);router[_0x8575('0xf')]('/',auth[_0x8575('0x7')](),controller['create']);router[_0x8575('0x10')](_0x8575('0x11'),auth[_0x8575('0x7')](),controller[_0x8575('0x12')]);router[_0x8575('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8575('0x14')]);module[_0x8575('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 79b1830..60e4b20 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 _0xe561=['exports','STRING','TEXT','sequelize'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0xe561,0x157));var _0x1e56=function(_0x3d93c6,_0x5b9eaa){_0x3d93c6=_0x3d93c6-0x0;var _0x4c31a6=_0xe561[_0x3d93c6];return _0x4c31a6;};'use strict';var Sequelize=require(_0x1e56('0x0'));module[_0x1e56('0x1')]={'name':{'type':Sequelize[_0x1e56('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x1e56('0x2')]},'conditions':{'type':Sequelize[_0x1e56('0x3')]},'joins':{'type':Sequelize[_0x1e56('0x3')]}}; \ No newline at end of file +var _0x76bb=['STRING','TEXT','sequelize','exports'];(function(_0x3e9e1d,_0x22c726){var _0x41eab5=function(_0x31c65d){while(--_0x31c65d){_0x3e9e1d['push'](_0x3e9e1d['shift']());}};_0x41eab5(++_0x22c726);}(_0x76bb,0xe6));var _0xb76b=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0x76bb[_0x87506e];return _0x5496a4;};'use strict';var Sequelize=require(_0xb76b('0x0'));module[_0xb76b('0x1')]={'name':{'type':Sequelize[_0xb76b('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xb76b('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xb76b('0x3')]},'joins':{'type':Sequelize[_0xb76b('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 8c91727..0ef2f37 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 _0x7c22=['value','getFields','Sequelize','ValidationError','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','replace','function','format','groupBy','orderBy','DESC','alias','joins','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','QueryTypes','outer_join','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','DATE(%s)','Please\x20insert\x20at\x20least\x20one\x20field!','toString','SELECT','No\x20Data!','output','fullPath','generate','csv','AnalyticExtractedReport','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','../../components/export/','savename','COUNT(*)','run','runReport','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','end','status','json','offset','limit','set','Content-Range','reject','save','then','destroy','sendStatus','stack','name','send','index','AnalyticDefaultReport','rawAttributes','model','keys','query','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','count','includeAll','findAll','catch','show','params','include','find','create','body','update','preview','join','left_join','right_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\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition'];(function(_0x8abac4,_0x3bd34c){var _0x21f092=function(_0x1023be){while(--_0x1023be){_0x8abac4['push'](_0x8abac4['shift']());}};_0x21f092(++_0x3bd34c);}(_0x7c22,0xc9));var _0x27c2=function(_0x1f9de4,_0x46ee07){_0x1f9de4=_0x1f9de4-0x0;var _0x438af6=_0x7c22[_0x1f9de4];return _0x438af6;};'use strict';var jsonpatch=require(_0x27c2('0x0'));var rp=require('request-promise');var moment=require(_0x27c2('0x1'));var BPromise=require(_0x27c2('0x2'));var Mustache=require('mustache');var util=require(_0x27c2('0x3'));var path=require(_0x27c2('0x4'));var sox=require(_0x27c2('0x5'));var csv=require('to-csv');var ejs=require(_0x27c2('0x6'));var fs=require('fs');var _=require(_0x27c2('0x7'));var squel=require(_0x27c2('0x8'));var crypto=require(_0x27c2('0x9'));var jsforce=require(_0x27c2('0xa'));var deskjs=require(_0x27c2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x27c2('0xc'));var Papa=require('papaparse');var qs=require(_0x27c2('0xd'));var logger=require('../../config/logger')(_0x27c2('0xe'));var utils=require(_0x27c2('0xf'));var config=require(_0x27c2('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314eda,_0x378408){_0x378408=_0x378408||0xcc;return function(_0x35a88f){if(_0x35a88f){return _0x314eda['sendStatus'](_0x378408);}return _0x314eda['status'](_0x378408)[_0x27c2('0x11')]();};}function respondWithResult(_0x4fff5e,_0x1ad0c3){_0x1ad0c3=_0x1ad0c3||0xc8;return function(_0x1ec1a9){if(_0x1ec1a9){return _0x4fff5e[_0x27c2('0x12')](_0x1ad0c3)[_0x27c2('0x13')](_0x1ec1a9);}};}function respondWithFilteredResult(_0x19017f,_0xe7cc93){return function(_0xd24582){if(_0xd24582){var _0x335bb7=_0xd24582['count'],_0x1dac81=_0xe7cc93[_0x27c2('0x14')],_0x5943ef=_0xe7cc93[_0x27c2('0x14')]+_0xe7cc93[_0x27c2('0x15')],_0x3d0d43;if(_0x5943ef>=_0x335bb7){_0x5943ef=_0x335bb7;_0x3d0d43=0xc8;}else{_0x3d0d43=0xce;}_0x19017f[_0x27c2('0x12')](_0x3d0d43);return _0x19017f[_0x27c2('0x16')](_0x27c2('0x17'),_0x1dac81+'-'+_0x5943ef+'/'+_0x335bb7)[_0x27c2('0x13')](_0xd24582);}return null;};}function patchUpdates(_0x16390c){return function(_0x2d1902){try{jsonpatch['apply'](_0x2d1902,_0x16390c,!![]);}catch(_0x4c02bb){return BPromise[_0x27c2('0x18')](_0x4c02bb);}return _0x2d1902[_0x27c2('0x19')]();};}function saveUpdates(_0x24e66f,_0x5f0206){return function(_0x1b79fb){if(_0x1b79fb){return _0x1b79fb['update'](_0x24e66f)[_0x27c2('0x1a')](function(_0x171cc5){return _0x171cc5;});}return null;};}function removeEntity(_0x23a0e,_0x350a81){return function(_0x3b01f1){if(_0x3b01f1){return _0x3b01f1[_0x27c2('0x1b')]()['then'](function(){_0x23a0e['status'](0xcc)[_0x27c2('0x11')]();});}};}function handleEntityNotFound(_0x538658,_0x1dff76){return function(_0x401c3d){if(!_0x401c3d){_0x538658[_0x27c2('0x1c')](0x194);}return _0x401c3d;};}function handleError(_0x3285ce,_0x32d2d0){_0x32d2d0=_0x32d2d0||0x1f4;return function(_0x187e2a){logger['error'](_0x187e2a[_0x27c2('0x1d')]);if(_0x187e2a[_0x27c2('0x1e')]){delete _0x187e2a['name'];}_0x3285ce[_0x27c2('0x12')](_0x32d2d0)[_0x27c2('0x1f')](_0x187e2a);};}exports[_0x27c2('0x20')]=function(_0x541580,_0x5c5e0b){var _0x14be34={},_0x5ce4d9={},_0x37a216={'count':0x0,'rows':[]};var _0x59bcfa=db[_0x27c2('0x21')][_0x27c2('0x22')];_0x5ce4d9[_0x27c2('0x23')]=_[_0x27c2('0x24')](_0x59bcfa);var _0x3ec579={'dateStart':_0x541580[_0x27c2('0x25')][_0x27c2('0x26')],'dateEnd':_0x541580[_0x27c2('0x25')]['dateEnd']};delete _0x541580[_0x27c2('0x25')][_0x27c2('0x26')];delete _0x541580[_0x27c2('0x25')]['dateEnd'];_0x5ce4d9[_0x27c2('0x25')]=_[_0x27c2('0x24')](_0x541580[_0x27c2('0x25')]);_0x5ce4d9[_0x27c2('0x27')]=_['intersection'](_0x5ce4d9['model'],_0x5ce4d9[_0x27c2('0x25')]);_0x14be34['attributes']=_[_0x27c2('0x28')](_0x5ce4d9[_0x27c2('0x23')],qs['fields'](_0x541580['query'][_0x27c2('0x29')]));_0x14be34['attributes']=_0x14be34[_0x27c2('0x2a')][_0x27c2('0x2b')]?_0x14be34['attributes']:_0x5ce4d9[_0x27c2('0x23')];if(!_0x541580[_0x27c2('0x25')][_0x27c2('0x2c')](_0x27c2('0x2d'))){_0x14be34[_0x27c2('0x15')]=qs['limit'](_0x541580[_0x27c2('0x25')][_0x27c2('0x15')]);_0x14be34[_0x27c2('0x14')]=qs[_0x27c2('0x14')](_0x541580[_0x27c2('0x25')][_0x27c2('0x14')]);}_0x14be34[_0x27c2('0x2e')]=qs[_0x27c2('0x2f')](_0x541580[_0x27c2('0x25')][_0x27c2('0x2f')]);_0x14be34[_0x27c2('0x30')]=qs[_0x27c2('0x27')](_[_0x27c2('0x31')](_0x541580[_0x27c2('0x25')],_0x5ce4d9['filters']));if(_0x3ec579[_0x27c2('0x26')]){if(_0x3ec579[_0x27c2('0x32')]){_0x3ec579[_0x27c2('0x32')]=moment(_0x3ec579[_0x27c2('0x32')])[_0x27c2('0x33')](0x1,'day');}else{_0x3ec579[_0x27c2('0x32')]=moment(_0x3ec579['dateStart'])[_0x27c2('0x33')](0x1,_0x27c2('0x34'));}_[_0x27c2('0x35')](_0x14be34['where'],{'createdAt':{'$gte':_0x3ec579[_0x27c2('0x26')],'$lte':_0x3ec579['dateEnd']}});}if(_0x541580[_0x27c2('0x25')][_0x27c2('0x36')]){_0x14be34[_0x27c2('0x30')]=_[_0x27c2('0x35')](_0x14be34[_0x27c2('0x30')],{'$or':_[_0x27c2('0x37')](_0x14be34[_0x27c2('0x2a')],function(_0x4c4074){var _0x1e847a={};_0x1e847a[_0x4c4074]={'$like':'%'+_0x541580[_0x27c2('0x25')][_0x27c2('0x36')]+'%'};return _0x1e847a;})});}_0x14be34=_['merge']({},_0x14be34,_0x541580[_0x27c2('0x38')]);var _0x3a1b13={'where':_0x14be34[_0x27c2('0x30')]};return db['AnalyticDefaultReport'][_0x27c2('0x39')](_0x3a1b13)[_0x27c2('0x1a')](function(_0x3c6b76){_0x37a216['count']=_0x3c6b76;if(_0x541580['query'][_0x27c2('0x3a')]){_0x14be34['include']=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x27c2('0x3b')](_0x14be34);})['then'](function(_0x5c5da2){_0x37a216['rows']=_0x5c5da2;return _0x37a216;})[_0x27c2('0x1a')](respondWithFilteredResult(_0x5c5e0b,_0x14be34))[_0x27c2('0x3c')](handleError(_0x5c5e0b,null));};exports[_0x27c2('0x3d')]=function(_0x582c61,_0xca9047){var _0x42bd9b={'raw':!![],'where':{'id':_0x582c61[_0x27c2('0x3e')]['id']}},_0x284979={};_0x284979['model']=_['keys'](db[_0x27c2('0x21')][_0x27c2('0x22')]);_0x284979['query']=_[_0x27c2('0x24')](_0x582c61[_0x27c2('0x25')]);_0x284979[_0x27c2('0x27')]=_[_0x27c2('0x28')](_0x284979[_0x27c2('0x23')],_0x284979['query']);_0x42bd9b[_0x27c2('0x2a')]=_[_0x27c2('0x28')](_0x284979[_0x27c2('0x23')],qs[_0x27c2('0x29')](_0x582c61['query'][_0x27c2('0x29')]));_0x42bd9b[_0x27c2('0x2a')]=_0x42bd9b['attributes'][_0x27c2('0x2b')]?_0x42bd9b[_0x27c2('0x2a')]:_0x284979[_0x27c2('0x23')];if(_0x582c61[_0x27c2('0x25')][_0x27c2('0x3a')]){_0x42bd9b[_0x27c2('0x3f')]=[{'all':!![]}];}_0x42bd9b=_['merge']({},_0x42bd9b,_0x582c61[_0x27c2('0x38')]);return db[_0x27c2('0x21')][_0x27c2('0x40')](_0x42bd9b)['then'](handleEntityNotFound(_0xca9047,null))[_0x27c2('0x1a')](respondWithResult(_0xca9047,null))[_0x27c2('0x3c')](handleError(_0xca9047,null));};exports[_0x27c2('0x41')]=function(_0x59fbe3,_0x2b94fc){return db[_0x27c2('0x21')][_0x27c2('0x41')](_0x59fbe3[_0x27c2('0x42')],{})[_0x27c2('0x1a')](respondWithResult(_0x2b94fc,0xc9))[_0x27c2('0x3c')](handleError(_0x2b94fc,null));};exports[_0x27c2('0x43')]=function(_0x29410d,_0x2262c2){if(_0x29410d[_0x27c2('0x42')]['id']){delete _0x29410d[_0x27c2('0x42')]['id'];}return db[_0x27c2('0x21')][_0x27c2('0x40')]({'where':{'id':_0x29410d[_0x27c2('0x3e')]['id']}})[_0x27c2('0x1a')](handleEntityNotFound(_0x2262c2,null))['then'](saveUpdates(_0x29410d['body'],null))[_0x27c2('0x1a')](respondWithResult(_0x2262c2,null))[_0x27c2('0x3c')](handleError(_0x2262c2,null));};exports['destroy']=function(_0x1b2d9f,_0xae9c1){return db[_0x27c2('0x21')][_0x27c2('0x40')]({'where':{'id':_0x1b2d9f['params']['id']}})[_0x27c2('0x1a')](handleEntityNotFound(_0xae9c1,null))[_0x27c2('0x1a')](removeEntity(_0xae9c1,null))['catch'](handleError(_0xae9c1,null));};exports[_0x27c2('0x44')]=function(_0x76570c,_0x5daa21){var _0x3ff4be=0xa;var _0x1ec281=[_0x27c2('0x45'),_0x27c2('0x46'),_0x27c2('0x47'),'outer_join','cross_join'];var _0x3d3da2={'SUM':_0x27c2('0x48'),'COUNT':_0x27c2('0x49'),'COUNT DISTINCT':_0x27c2('0x4a'),'MAX':_0x27c2('0x4b'),'MIN':_0x27c2('0x4c'),'AVG':_0x27c2('0x4d'),'GROUP_CONCAT':_0x27c2('0x4e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x27c2('0x4f')};var _0x36aa82={'SEC_TO_TIME':_0x27c2('0x50'),'DATE':'DATE(%s)','HOUR':_0x27c2('0x51'),'ROUND':_0x27c2('0x52'),'UNIX_TIMESTAMP':_0x27c2('0x53')};var _0x35028c=function(_0x2c3b02){return!_[_0x27c2('0x54')]([_0x27c2('0x55'),_0x27c2('0x56'),_0x27c2('0x57'),_0x27c2('0x58')],_0x2c3b02);};var _0x4e8f3f=function(_0x90c72e){if(!_0x90c72e||!_0x90c72e[_0x27c2('0x59')][_0x27c2('0x2b')]){return'';}for(var _0x462041='(',_0x489c1c=0x0;_0x489c1c<_0x90c72e[_0x27c2('0x59')][_0x27c2('0x2b')];_0x489c1c+=0x1){_0x489c1c>0x0&&(_0x462041+='\x20'+_0x90c72e[_0x27c2('0x5a')]+'\x20');_0x462041+=_0x90c72e[_0x27c2('0x59')][_0x489c1c][_0x27c2('0x5b')]?_0x4e8f3f(_0x90c72e['rules'][_0x489c1c][_0x27c2('0x5b')]):_0x90c72e[_0x27c2('0x59')][_0x489c1c]['field']+'\x20'+_0x90c72e[_0x27c2('0x59')][_0x489c1c][_0x27c2('0x5c')]+(_0x35028c(_0x90c72e[_0x27c2('0x59')][_0x489c1c][_0x27c2('0x5c')])?'\x20'+_0x90c72e[_0x27c2('0x59')][_0x489c1c][_0x27c2('0x5d')]:'');}return _0x462041+')';};var _0x2ee620={'where':{'id':_0x76570c[_0x27c2('0x3e')]['id']}},_0x50a6ea,_0x188f16,_0x1829cc,_0x3b787e,_0x5a1f3b;_0x2ee620=_['merge']({},_0x2ee620,_0x76570c[_0x27c2('0x38')]);return db[_0x27c2('0x21')]['find'](_0x2ee620)[_0x27c2('0x1a')](function(_0x182a47){if(_0x182a47){_0x50a6ea=_0x182a47;return _0x182a47[_0x27c2('0x5e')]();}return null;})[_0x27c2('0x1a')](function(_0x1ee8ad){if(_0x1ee8ad){if(!_0x1ee8ad['length']){throw new db[(_0x27c2('0x5f'))][(_0x27c2('0x60'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x188f16=_0x1ee8ad;return db[_0x27c2('0x61')][_0x27c2('0x3b')]({'raw':!![]});}return null;})[_0x27c2('0x1a')](function(_0x538432){if(_0x538432){_0x1829cc=_[_0x27c2('0x62')](_0x538432,'id');var _0x154ce4;var _0x43e04c=squel[_0x27c2('0x63')]();_0x43e04c[_0x27c2('0x64')](_0x50a6ea[_0x27c2('0x65')]);for(var _0x302adf=0x0;_0x302adf<_0x188f16[_0x27c2('0x2b')];_0x302adf+=0x1){_0x154ce4=_0x188f16[_0x302adf]['MetricId']?_0x1829cc[_0x188f16[_0x302adf][_0x27c2('0x66')]][_0x27c2('0x67')]:_0x188f16[_0x302adf][_0x27c2('0x68')];_0x154ce4=_0x188f16[_0x302adf]['function']?_[_0x27c2('0x69')](_0x3d3da2[_0x188f16[_0x302adf][_0x27c2('0x6a')]],'%s',_0x154ce4):_0x154ce4;_0x154ce4=_0x188f16[_0x302adf]['format']?_[_0x27c2('0x69')](_0x36aa82[_0x188f16[_0x302adf][_0x27c2('0x6b')]],'%s',_0x154ce4):_0x154ce4;if(_0x188f16[_0x302adf][_0x27c2('0x6c')]){_0x43e04c[_0x27c2('0x5b')](_0x154ce4);}_0x188f16[_0x302adf][_0x27c2('0x6d')]&&_0x43e04c['order'](_0x154ce4,_0x188f16[_0x302adf][_0x27c2('0x6d')]===_0x27c2('0x6e')?![]:!![]);_0x43e04c[_0x27c2('0x68')](_0x154ce4,_0x188f16[_0x302adf][_0x27c2('0x6f')]||_0x154ce4);}if(_0x50a6ea[_0x27c2('0x70')]){_0x50a6ea['joins']=JSON['parse'](_0x50a6ea[_0x27c2('0x70')]);for(var _0x48f797=0x0;_0x48f797<_0x50a6ea[_0x27c2('0x70')][_0x27c2('0x2b')];_0x48f797+=0x1){if(_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x71')]&&_[_0x27c2('0x54')](_0x1ec281,_0x50a6ea[_0x27c2('0x70')][_0x48f797]['type'])&&_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x72')]&&_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x73')]&&_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x74')]){_0x43e04c[_0x50a6ea[_0x27c2('0x70')][_0x48f797]['type']](_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x73')],null,util[_0x27c2('0x6b')](_0x27c2('0x75'),_0x50a6ea['table'],_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x72')],_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x73')],_0x50a6ea[_0x27c2('0x70')][_0x48f797][_0x27c2('0x74')]));}}}if(_0x50a6ea['conditions']){_0x50a6ea[_0x27c2('0x76')]=JSON[_0x27c2('0x77')](_0x50a6ea['conditions']);_0x43e04c[_0x27c2('0x30')](_0x4e8f3f(_0x50a6ea[_0x27c2('0x76')][_0x27c2('0x5b')]));}_0x5a1f3b=_0x43e04c[_0x27c2('0x78')]();_0x43e04c[_0x27c2('0x15')](_0x3ff4be);_0x43e04c[_0x27c2('0x14')](0x0);logger[_0x27c2('0x79')](_0x27c2('0x7a'),_0x43e04c['toString']());return db[_0x27c2('0x7b')]['query'](_0x43e04c['toString'](),{'type':db[_0x27c2('0x7b')][_0x27c2('0x7c')]['SELECT']});}})[_0x27c2('0x1a')](respondWithResult(_0x5daa21,null))[_0x27c2('0x3c')](handleError(_0x5daa21,null));};function runReport(_0x45276e,_0x2f705b,_0x2b4570){var _0x8b18d6=_0x2f705b['name'];var _0x30c642=0xa;var _0x36499b=['join','left_join',_0x27c2('0x47'),_0x27c2('0x7d'),_0x27c2('0x7e')];var _0x1bb34c={'SUM':_0x27c2('0x48'),'COUNT':_0x27c2('0x49'),'COUNT DISTINCT':_0x27c2('0x4a'),'MAX':_0x27c2('0x4b'),'MIN':'MIN(%s)','AVG':_0x27c2('0x4d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x27c2('0x7f'),'GROUP_CONCAT DESC':_0x27c2('0x4f')};var _0x298ecb={'SEC_TO_TIME':_0x27c2('0x50'),'DATE':_0x27c2('0x80'),'HOUR':_0x27c2('0x51'),'ROUND':_0x27c2('0x52'),'UNIX_TIMESTAMP':_0x27c2('0x53')};var _0x5d9aac=function(_0x5f1eb1){return!_[_0x27c2('0x54')]([_0x27c2('0x55'),_0x27c2('0x56'),_0x27c2('0x57'),'IS\x20NOT\x20EMPTY'],_0x5f1eb1);};var _0x23495a=function(_0x353ba1){if(!_0x353ba1||!_0x353ba1[_0x27c2('0x59')][_0x27c2('0x2b')]){return'';}for(var _0x1f236c='(',_0x330cea=0x0;_0x330cea<_0x353ba1['rules'][_0x27c2('0x2b')];_0x330cea+=0x1){_0x330cea>0x0&&(_0x1f236c+='\x20'+_0x353ba1[_0x27c2('0x5a')]+'\x20');_0x1f236c+=_0x353ba1['rules'][_0x330cea][_0x27c2('0x5b')]?_0x23495a(_0x353ba1['rules'][_0x330cea]['group']):_0x353ba1[_0x27c2('0x59')][_0x330cea][_0x27c2('0x68')]+'\x20'+_0x353ba1[_0x27c2('0x59')][_0x330cea][_0x27c2('0x5c')]+(_0x5d9aac(_0x353ba1[_0x27c2('0x59')][_0x330cea][_0x27c2('0x5c')])?'\x20'+_0x353ba1['rules'][_0x330cea][_0x27c2('0x5d')]:'');}return _0x1f236c+')';};var _0x1f0327={'where':{'id':_0x45276e['id']}},_0x4f65b7,_0xa9e7fe,_0x4f1b7e,_0x415b39,_0x66acec;_0x1f0327=_[_0x27c2('0x35')]({},_0x1f0327,_0x2b4570);return db[_0x27c2('0x21')][_0x27c2('0x40')](_0x1f0327)['then'](function(_0x585fa0){if(_0x585fa0){_0x4f65b7=_0x585fa0;return _0x585fa0[_0x27c2('0x5e')]();}return null;})['then'](function(_0x181754){if(_0x181754){if(!_0x181754[_0x27c2('0x2b')]){throw new db[(_0x27c2('0x5f'))][(_0x27c2('0x60'))](_0x27c2('0x81'));}_0xa9e7fe=_0x181754;return db[_0x27c2('0x61')]['findAll']({'raw':!![]});}return null;})[_0x27c2('0x1a')](function(_0x51512b){if(_0x51512b){_0x4f1b7e=_[_0x27c2('0x62')](_0x51512b,'id');var _0x29ac41;var _0x10a917=squel[_0x27c2('0x63')]();_0x10a917[_0x27c2('0x64')](_0x4f65b7[_0x27c2('0x65')]);for(var _0x2bb1e5=0x0;_0x2bb1e5<_0xa9e7fe[_0x27c2('0x2b')];_0x2bb1e5+=0x1){_0x29ac41=_0xa9e7fe[_0x2bb1e5][_0x27c2('0x66')]?_0x4f1b7e[_0xa9e7fe[_0x2bb1e5]['MetricId']]['metric']:_0xa9e7fe[_0x2bb1e5][_0x27c2('0x68')];_0x29ac41=_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6a')]?_[_0x27c2('0x69')](_0x1bb34c[_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6a')]],'%s',_0x29ac41):_0x29ac41;_0x29ac41=_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6b')]?_['replace'](_0x298ecb[_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6b')]],'%s',_0x29ac41):_0x29ac41;if(_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6c')]){_0x10a917['group'](_0x29ac41);}_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6d')]&&_0x10a917['order'](_0x29ac41,_0xa9e7fe[_0x2bb1e5]['orderBy']===_0x27c2('0x6e')?![]:!![]);_0x10a917[_0x27c2('0x68')](_0x29ac41,_0xa9e7fe[_0x2bb1e5][_0x27c2('0x6f')]||_0x29ac41);}if(_0x4f65b7[_0x27c2('0x70')]){_0x4f65b7[_0x27c2('0x70')]=JSON[_0x27c2('0x77')](_0x4f65b7[_0x27c2('0x70')]);for(var _0x4aa399=0x0;_0x4aa399<_0x4f65b7['joins'][_0x27c2('0x2b')];_0x4aa399+=0x1){if(_0x4f65b7[_0x27c2('0x70')][_0x4aa399][_0x27c2('0x71')]&&_[_0x27c2('0x54')](_0x36499b,_0x4f65b7[_0x27c2('0x70')][_0x4aa399][_0x27c2('0x71')])&&_0x4f65b7[_0x27c2('0x70')][_0x4aa399]['parentKey']&&_0x4f65b7[_0x27c2('0x70')][_0x4aa399][_0x27c2('0x73')]&&_0x4f65b7['joins'][_0x4aa399][_0x27c2('0x74')]){_0x10a917[_0x4f65b7['joins'][_0x4aa399][_0x27c2('0x71')]](_0x4f65b7['joins'][_0x4aa399][_0x27c2('0x73')],null,util[_0x27c2('0x6b')](_0x27c2('0x75'),_0x4f65b7['table'],_0x4f65b7[_0x27c2('0x70')][_0x4aa399]['parentKey'],_0x4f65b7[_0x27c2('0x70')][_0x4aa399]['foreignTable'],_0x4f65b7[_0x27c2('0x70')][_0x4aa399][_0x27c2('0x74')]));}}}if(_0x4f65b7['conditions']){_0x4f65b7[_0x27c2('0x76')]=JSON[_0x27c2('0x77')](_0x4f65b7['conditions']);_0x10a917['where'](_0x23495a(_0x4f65b7[_0x27c2('0x76')][_0x27c2('0x5b')]));}_0x66acec=_0x10a917['clone']();_0x10a917[_0x27c2('0x15')](_0x30c642);_0x10a917[_0x27c2('0x14')](0x0);logger[_0x27c2('0x79')](_0x27c2('0x7a'),_0x10a917[_0x27c2('0x82')]());return db[_0x27c2('0x7b')]['query'](_0x10a917[_0x27c2('0x82')](),{'type':db[_0x27c2('0x7b')][_0x27c2('0x7c')][_0x27c2('0x83')]});}})['then'](function(_0x4c5435){if(!_0x4c5435[_0x27c2('0x2b')]){throw new db[(_0x27c2('0x5f'))]['ValidationError'](_0x27c2('0x84'));}if(_0x2f705b[_0x27c2('0x85')]==='web'){return null;}var _0x51c5a6=_[_0x27c2('0x35')](_0x2f705b,{'name':_0x2f705b[_0x27c2('0x86')]||_0x2f705b[_0x27c2('0x1e')]||_0x4f65b7[_0x27c2('0x1e')],'basename':_0x8b18d6,'savename':util[_0x27c2('0x6b')]('%s-%s.%s',_0x2f705b['name']||_0x4f65b7[_0x27c2('0x1e')],require('randomstring')[_0x27c2('0x87')](0x4),_0x2f705b['output']||_0x27c2('0x88'))});return db[_0x27c2('0x89')][_0x27c2('0x41')](_0x51c5a6,{'raw':!![]});})[_0x27c2('0x1a')](function(_0xe8413b){_0x66acec['where'](_0x4f65b7[_0x27c2('0x65')]+_0x27c2('0x8a'),_0x2f705b['startDate'],_0x2f705b['endDate']);if(_0xe8413b){logger[_0x27c2('0x8b')](_0x27c2('0x8c'),_0x66acec['toString']());require(_0x27c2('0x8d'))['fork'](path[_0x27c2('0x45')](__dirname,_0x27c2('0x8e'),_0xe8413b[_0x27c2('0x85')]),[_0xe8413b['id'],_0x66acec[_0x27c2('0x82')](),path[_0x27c2('0x45')](__dirname,'../../files/reports',_0xe8413b[_0x27c2('0x8f')]),_0x8b18d6]);return _0xe8413b;}else{var _0x1d46a6=squel[_0x27c2('0x63')]();_0x1d46a6['from']('('+_0x66acec[_0x27c2('0x82')]()+')','countTable');_0x1d46a6[_0x27c2('0x68')](_0x27c2('0x90'),_0x27c2('0x39'));_0x66acec['limit'](_0x2f705b[_0x27c2('0x15')]||_0x30c642);_0x66acec[_0x27c2('0x14')](_0x2f705b[_0x27c2('0x14')]||0x0);return db[_0x27c2('0x7b')][_0x27c2('0x25')](_0x1d46a6[_0x27c2('0x82')](),{'type':db[_0x27c2('0x7b')]['QueryTypes']['SELECT']})[_0x27c2('0x1a')](function(_0x886ab2){if(!_0x886ab2['length']){_0x415b39=0x0;}else{_0x415b39=_0x886ab2[0x0][_0x27c2('0x39')]||0x0;}return db[_0x27c2('0x7b')][_0x27c2('0x25')](_0x66acec['toString'](),{'type':db[_0x27c2('0x7b')][_0x27c2('0x7c')][_0x27c2('0x83')]});})['then'](function(_0x2cb1bf){return{'rows':_0x2cb1bf||[],'count':_0x415b39};});}});}exports[_0x27c2('0x91')]=function(_0x48bae0,_0x45e9c0){return runReport(_0x48bae0[_0x27c2('0x3e')],_0x48bae0['query'],_0x48bae0['options'])[_0x27c2('0x1a')](respondWithResult(_0x45e9c0,null))[_0x27c2('0x3c')](handleError(_0x45e9c0,null));};exports[_0x27c2('0x92')]=runReport;exports[_0x27c2('0x25')]=function(_0x4da79e,_0x16c645){var _0x11b490=0xa;var _0x51aca5=[_0x27c2('0x45'),'left_join',_0x27c2('0x47'),_0x27c2('0x7d'),_0x27c2('0x7e')];var _0x51115e={'SUM':_0x27c2('0x48'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x27c2('0x4a'),'MAX':'MAX(%s)','MIN':_0x27c2('0x4c'),'AVG':_0x27c2('0x4d'),'GROUP_CONCAT':_0x27c2('0x4e'),'GROUP_CONCAT ASC':_0x27c2('0x7f'),'GROUP_CONCAT DESC':_0x27c2('0x4f')};var _0x5513f4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x27c2('0x80'),'HOUR':_0x27c2('0x51'),'ROUND':_0x27c2('0x52'),'UNIX_TIMESTAMP':_0x27c2('0x53')};var _0x519fc6=function(_0x3808b6){return!_[_0x27c2('0x54')]([_0x27c2('0x55'),_0x27c2('0x56'),_0x27c2('0x57'),_0x27c2('0x58')],_0x3808b6);};var _0x1c9885=function(_0x6f009f){if(!_0x6f009f||!_0x6f009f[_0x27c2('0x59')][_0x27c2('0x2b')]){return'';}for(var _0x185047='(',_0x1fc4ee=0x0;_0x1fc4ee<_0x6f009f[_0x27c2('0x59')][_0x27c2('0x2b')];_0x1fc4ee+=0x1){_0x1fc4ee>0x0&&(_0x185047+='\x20'+_0x6f009f[_0x27c2('0x5a')]+'\x20');_0x185047+=_0x6f009f['rules'][_0x1fc4ee][_0x27c2('0x5b')]?_0x1c9885(_0x6f009f[_0x27c2('0x59')][_0x1fc4ee][_0x27c2('0x5b')]):_0x6f009f[_0x27c2('0x59')][_0x1fc4ee][_0x27c2('0x68')]+'\x20'+_0x6f009f[_0x27c2('0x59')][_0x1fc4ee][_0x27c2('0x5c')]+(_0x519fc6(_0x6f009f[_0x27c2('0x59')][_0x1fc4ee][_0x27c2('0x5c')])?'\x20'+_0x6f009f[_0x27c2('0x59')][_0x1fc4ee][_0x27c2('0x5d')]:'');}return _0x185047+')';};var _0x3775fc={'where':{'id':_0x4da79e[_0x27c2('0x3e')]['id']}},_0x93f5d,_0x9439ff,_0x28a728,_0x425ed9,_0x2a0d95;_0x3775fc=_[_0x27c2('0x35')]({},_0x3775fc,_0x4da79e[_0x27c2('0x38')]);return db[_0x27c2('0x21')]['find'](_0x3775fc)['then'](function(_0x3610fb){if(_0x3610fb){_0x93f5d=_0x3610fb;return _0x3610fb[_0x27c2('0x5e')]();}return null;})['then'](function(_0x3a5f1e){if(_0x3a5f1e){if(!_0x3a5f1e[_0x27c2('0x2b')]){throw new db[(_0x27c2('0x5f'))][(_0x27c2('0x60'))](_0x27c2('0x81'));}_0x9439ff=_0x3a5f1e;return db[_0x27c2('0x61')][_0x27c2('0x3b')]({'raw':!![]});}return null;})['then'](function(_0x4dc10b){if(_0x4dc10b){_0x28a728=_['keyBy'](_0x4dc10b,'id');var _0x48e939;var _0xbc1f6b=squel[_0x27c2('0x63')]();_0xbc1f6b[_0x27c2('0x64')](_0x93f5d[_0x27c2('0x65')]);for(var _0x40f7a1=0x0;_0x40f7a1<_0x9439ff[_0x27c2('0x2b')];_0x40f7a1+=0x1){_0x48e939=_0x9439ff[_0x40f7a1]['MetricId']?_0x28a728[_0x9439ff[_0x40f7a1]['MetricId']][_0x27c2('0x67')]:_0x9439ff[_0x40f7a1][_0x27c2('0x68')];_0x48e939=_0x9439ff[_0x40f7a1][_0x27c2('0x6a')]?_[_0x27c2('0x69')](_0x51115e[_0x9439ff[_0x40f7a1][_0x27c2('0x6a')]],'%s',_0x48e939):_0x48e939;_0x48e939=_0x9439ff[_0x40f7a1][_0x27c2('0x6b')]?_[_0x27c2('0x69')](_0x5513f4[_0x9439ff[_0x40f7a1][_0x27c2('0x6b')]],'%s',_0x48e939):_0x48e939;if(_0x9439ff[_0x40f7a1][_0x27c2('0x6c')]){_0xbc1f6b[_0x27c2('0x5b')](_0x48e939);}_0x9439ff[_0x40f7a1][_0x27c2('0x6d')]&&_0xbc1f6b[_0x27c2('0x2e')](_0x48e939,_0x9439ff[_0x40f7a1][_0x27c2('0x6d')]==='DESC'?![]:!![]);_0xbc1f6b[_0x27c2('0x68')](_0x48e939,_0x9439ff[_0x40f7a1][_0x27c2('0x6f')]||_0x48e939);}if(_0x93f5d[_0x27c2('0x70')]){_0x93f5d['joins']=JSON[_0x27c2('0x77')](_0x93f5d[_0x27c2('0x70')]);for(var _0x138bf4=0x0;_0x138bf4<_0x93f5d[_0x27c2('0x70')]['length'];_0x138bf4+=0x1){if(_0x93f5d['joins'][_0x138bf4][_0x27c2('0x71')]&&_[_0x27c2('0x54')](_0x51aca5,_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x71')])&&_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x72')]&&_0x93f5d[_0x27c2('0x70')][_0x138bf4]['foreignTable']&&_0x93f5d['joins'][_0x138bf4][_0x27c2('0x74')]){_0xbc1f6b[_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x71')]](_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x73')],null,util[_0x27c2('0x6b')]('%s.%s\x20=\x20%s.%s',_0x93f5d[_0x27c2('0x65')],_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x72')],_0x93f5d['joins'][_0x138bf4]['foreignTable'],_0x93f5d[_0x27c2('0x70')][_0x138bf4][_0x27c2('0x74')]));}}}if(_0x93f5d['conditions']){_0x93f5d[_0x27c2('0x76')]=JSON[_0x27c2('0x77')](_0x93f5d[_0x27c2('0x76')]);_0xbc1f6b[_0x27c2('0x30')](_0x1c9885(_0x93f5d[_0x27c2('0x76')][_0x27c2('0x5b')]));}_0x2a0d95=_0xbc1f6b[_0x27c2('0x78')]();_0xbc1f6b[_0x27c2('0x15')](_0x11b490);_0xbc1f6b[_0x27c2('0x14')](0x0);logger[_0x27c2('0x79')](_0x27c2('0x7a'),_0xbc1f6b[_0x27c2('0x82')]());return db[_0x27c2('0x7b')]['query'](_0xbc1f6b[_0x27c2('0x82')](),{'type':db[_0x27c2('0x7b')][_0x27c2('0x7c')][_0x27c2('0x83')]});}})[_0x27c2('0x1a')](function(){return{'sql':_0x2a0d95[_0x27c2('0x82')]()};})['then'](respondWithResult(_0x16c645,null))['catch'](handleError(_0x16c645,null));}; \ No newline at end of file +var _0x00ca=['alias','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','left_join','outer_join','cross_join','SUM(%s)','MAX(%s)','MIN(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','value','getFields','keyBy','table','metric','SELECT','No\x20Data!','output','web','fullPath','name','generate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','DESC','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../config/utils','sendStatus','status','end','json','count','offset','apply','reject','destroy','then','error','stack','send','index','AnalyticDefaultReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','add','merge','where','filter','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','preview','join','right_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','Sequelize','ValidationError','Please\x20insert\x20at\x20least\x20one\x20field!','AnalyticMetric','select','from','MetricId','function','replace','format','groupBy','orderBy'];(function(_0x3043dd,_0x570cd5){var _0x4b4032=function(_0x71001e){while(--_0x71001e){_0x3043dd['push'](_0x3043dd['shift']());}};_0x4b4032(++_0x570cd5);}(_0x00ca,0x1df));var _0xa00c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x00ca[_0x3947c9];return _0x2e7871;};'use strict';var jsonpatch=require(_0xa00c('0x0'));var rp=require('request-promise');var moment=require(_0xa00c('0x1'));var BPromise=require(_0xa00c('0x2'));var Mustache=require(_0xa00c('0x3'));var util=require(_0xa00c('0x4'));var path=require(_0xa00c('0x5'));var sox=require(_0xa00c('0x6'));var csv=require(_0xa00c('0x7'));var ejs=require(_0xa00c('0x8'));var fs=require('fs');var _=require(_0xa00c('0x9'));var squel=require(_0xa00c('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa00c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa00c('0xc'));var Papa=require('papaparse');var qs=require(_0xa00c('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xa00c('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c9748,_0x262da3){_0x262da3=_0x262da3||0xcc;return function(_0x2117a6){if(_0x2117a6){return _0x1c9748[_0xa00c('0xf')](_0x262da3);}return _0x1c9748[_0xa00c('0x10')](_0x262da3)[_0xa00c('0x11')]();};}function respondWithResult(_0x2ec017,_0x17414f){_0x17414f=_0x17414f||0xc8;return function(_0x4614a1){if(_0x4614a1){return _0x2ec017[_0xa00c('0x10')](_0x17414f)[_0xa00c('0x12')](_0x4614a1);}};}function respondWithFilteredResult(_0x5356ff,_0x1b698e){return function(_0x4baeaf){if(_0x4baeaf){var _0x34b9c8=_0x4baeaf[_0xa00c('0x13')],_0x1f48a8=_0x1b698e[_0xa00c('0x14')],_0x23e0f8=_0x1b698e[_0xa00c('0x14')]+_0x1b698e['limit'],_0xfe7845;if(_0x23e0f8>=_0x34b9c8){_0x23e0f8=_0x34b9c8;_0xfe7845=0xc8;}else{_0xfe7845=0xce;}_0x5356ff['status'](_0xfe7845);return _0x5356ff['set']('Content-Range',_0x1f48a8+'-'+_0x23e0f8+'/'+_0x34b9c8)[_0xa00c('0x12')](_0x4baeaf);}return null;};}function patchUpdates(_0x223005){return function(_0x3bd175){try{jsonpatch[_0xa00c('0x15')](_0x3bd175,_0x223005,!![]);}catch(_0x5740d1){return BPromise[_0xa00c('0x16')](_0x5740d1);}return _0x3bd175['save']();};}function saveUpdates(_0x9d39e4,_0x5dfa65){return function(_0x52ed74){if(_0x52ed74){return _0x52ed74['update'](_0x9d39e4)['then'](function(_0x371924){return _0x371924;});}return null;};}function removeEntity(_0x3187e8,_0x31cf34){return function(_0x42c8bf){if(_0x42c8bf){return _0x42c8bf[_0xa00c('0x17')]()[_0xa00c('0x18')](function(){_0x3187e8[_0xa00c('0x10')](0xcc)[_0xa00c('0x11')]();});}};}function handleEntityNotFound(_0x176d43,_0x500750){return function(_0x4125ad){if(!_0x4125ad){_0x176d43[_0xa00c('0xf')](0x194);}return _0x4125ad;};}function handleError(_0x356abb,_0x1e8de4){_0x1e8de4=_0x1e8de4||0x1f4;return function(_0x4c1b9a){logger[_0xa00c('0x19')](_0x4c1b9a[_0xa00c('0x1a')]);if(_0x4c1b9a['name']){delete _0x4c1b9a['name'];}_0x356abb[_0xa00c('0x10')](_0x1e8de4)[_0xa00c('0x1b')](_0x4c1b9a);};}exports[_0xa00c('0x1c')]=function(_0x1d23bd,_0x235c86){var _0x5401b2={},_0x24018c={},_0x57f306={'count':0x0,'rows':[]};var _0x113190=db[_0xa00c('0x1d')][_0xa00c('0x1e')];_0x24018c['model']=_[_0xa00c('0x1f')](_0x113190);var _0x5375a8={'dateStart':_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x21')],'dateEnd':_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x22')]};delete _0x1d23bd[_0xa00c('0x20')][_0xa00c('0x21')];delete _0x1d23bd[_0xa00c('0x20')][_0xa00c('0x22')];_0x24018c[_0xa00c('0x20')]=_['keys'](_0x1d23bd[_0xa00c('0x20')]);_0x24018c[_0xa00c('0x23')]=_[_0xa00c('0x24')](_0x24018c['model'],_0x24018c[_0xa00c('0x20')]);_0x5401b2[_0xa00c('0x25')]=_['intersection'](_0x24018c[_0xa00c('0x26')],qs[_0xa00c('0x27')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x27')]));_0x5401b2['attributes']=_0x5401b2[_0xa00c('0x25')][_0xa00c('0x28')]?_0x5401b2[_0xa00c('0x25')]:_0x24018c[_0xa00c('0x26')];if(!_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x29')](_0xa00c('0x2a'))){_0x5401b2[_0xa00c('0x2b')]=qs[_0xa00c('0x2b')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x2b')]);_0x5401b2['offset']=qs[_0xa00c('0x14')](_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x14')]);}_0x5401b2[_0xa00c('0x2c')]=qs[_0xa00c('0x2d')](_0x1d23bd['query'][_0xa00c('0x2d')]);_0x5401b2['where']=qs[_0xa00c('0x23')](_['pick'](_0x1d23bd[_0xa00c('0x20')],_0x24018c['filters']));if(_0x5375a8[_0xa00c('0x21')]){if(_0x5375a8[_0xa00c('0x22')]){_0x5375a8['dateEnd']=moment(_0x5375a8['dateEnd'])[_0xa00c('0x2e')](0x1,'day');}else{_0x5375a8[_0xa00c('0x22')]=moment(_0x5375a8['dateStart'])[_0xa00c('0x2e')](0x1,'day');}_[_0xa00c('0x2f')](_0x5401b2[_0xa00c('0x30')],{'createdAt':{'$gte':_0x5375a8[_0xa00c('0x21')],'$lte':_0x5375a8[_0xa00c('0x22')]}});}if(_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x31')]){_0x5401b2['where']=_['merge'](_0x5401b2[_0xa00c('0x30')],{'$or':_[_0xa00c('0x32')](_0x5401b2[_0xa00c('0x25')],function(_0x28f648){var _0x50dced={};_0x50dced[_0x28f648]={'$like':'%'+_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x31')]+'%'};return _0x50dced;})});}_0x5401b2=_[_0xa00c('0x2f')]({},_0x5401b2,_0x1d23bd[_0xa00c('0x33')]);var _0x1516d5={'where':_0x5401b2[_0xa00c('0x30')]};return db['AnalyticDefaultReport'][_0xa00c('0x13')](_0x1516d5)[_0xa00c('0x18')](function(_0x5dacca){_0x57f306[_0xa00c('0x13')]=_0x5dacca;if(_0x1d23bd[_0xa00c('0x20')][_0xa00c('0x34')]){_0x5401b2[_0xa00c('0x35')]=[{'all':!![]}];}return db[_0xa00c('0x1d')][_0xa00c('0x36')](_0x5401b2);})[_0xa00c('0x18')](function(_0x3cdc6b){_0x57f306[_0xa00c('0x37')]=_0x3cdc6b;return _0x57f306;})[_0xa00c('0x18')](respondWithFilteredResult(_0x235c86,_0x5401b2))[_0xa00c('0x38')](handleError(_0x235c86,null));};exports[_0xa00c('0x39')]=function(_0x1690b0,_0xed534){var _0x39358c={'raw':!![],'where':{'id':_0x1690b0[_0xa00c('0x3a')]['id']}},_0xc351d2={};_0xc351d2[_0xa00c('0x26')]=_[_0xa00c('0x1f')](db['AnalyticDefaultReport'][_0xa00c('0x1e')]);_0xc351d2[_0xa00c('0x20')]=_[_0xa00c('0x1f')](_0x1690b0[_0xa00c('0x20')]);_0xc351d2[_0xa00c('0x23')]=_[_0xa00c('0x24')](_0xc351d2[_0xa00c('0x26')],_0xc351d2[_0xa00c('0x20')]);_0x39358c[_0xa00c('0x25')]=_[_0xa00c('0x24')](_0xc351d2[_0xa00c('0x26')],qs[_0xa00c('0x27')](_0x1690b0[_0xa00c('0x20')][_0xa00c('0x27')]));_0x39358c[_0xa00c('0x25')]=_0x39358c[_0xa00c('0x25')][_0xa00c('0x28')]?_0x39358c['attributes']:_0xc351d2[_0xa00c('0x26')];if(_0x1690b0[_0xa00c('0x20')]['includeAll']){_0x39358c['include']=[{'all':!![]}];}_0x39358c=_[_0xa00c('0x2f')]({},_0x39358c,_0x1690b0['options']);return db[_0xa00c('0x1d')][_0xa00c('0x3b')](_0x39358c)[_0xa00c('0x18')](handleEntityNotFound(_0xed534,null))[_0xa00c('0x18')](respondWithResult(_0xed534,null))[_0xa00c('0x38')](handleError(_0xed534,null));};exports[_0xa00c('0x3c')]=function(_0x45a0b1,_0x38929f){return db['AnalyticDefaultReport'][_0xa00c('0x3c')](_0x45a0b1[_0xa00c('0x3d')],{})[_0xa00c('0x18')](respondWithResult(_0x38929f,0xc9))[_0xa00c('0x38')](handleError(_0x38929f,null));};exports[_0xa00c('0x3e')]=function(_0x1a0fab,_0x51c1b0){if(_0x1a0fab[_0xa00c('0x3d')]['id']){delete _0x1a0fab[_0xa00c('0x3d')]['id'];}return db['AnalyticDefaultReport'][_0xa00c('0x3b')]({'where':{'id':_0x1a0fab[_0xa00c('0x3a')]['id']}})[_0xa00c('0x18')](handleEntityNotFound(_0x51c1b0,null))[_0xa00c('0x18')](saveUpdates(_0x1a0fab[_0xa00c('0x3d')],null))[_0xa00c('0x18')](respondWithResult(_0x51c1b0,null))[_0xa00c('0x38')](handleError(_0x51c1b0,null));};exports['destroy']=function(_0x18ef43,_0x117010){return db[_0xa00c('0x1d')]['find']({'where':{'id':_0x18ef43[_0xa00c('0x3a')]['id']}})[_0xa00c('0x18')](handleEntityNotFound(_0x117010,null))[_0xa00c('0x18')](removeEntity(_0x117010,null))[_0xa00c('0x38')](handleError(_0x117010,null));};exports[_0xa00c('0x3f')]=function(_0x592acc,_0x1b3828){var _0x3f8c8b=0xa;var _0x4aa061=[_0xa00c('0x40'),'left_join',_0xa00c('0x41'),'outer_join','cross_join'];var _0x2b6a7b={'SUM':'SUM(%s)','COUNT':_0xa00c('0x42'),'COUNT DISTINCT':_0xa00c('0x43'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa00c('0x44'),'GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':_0xa00c('0x46'),'GROUP_CONCAT DESC':_0xa00c('0x47')};var _0x3a07fa={'SEC_TO_TIME':_0xa00c('0x48'),'DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x20fb93=function(_0x4c23b5){return!_[_0xa00c('0x4d')]([_0xa00c('0x4e'),_0xa00c('0x4f'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x4c23b5);};var _0x50bb13=function(_0x55e902){if(!_0x55e902||!_0x55e902[_0xa00c('0x50')][_0xa00c('0x28')]){return'';}for(var _0x5997fe='(',_0x518588=0x0;_0x518588<_0x55e902[_0xa00c('0x50')]['length'];_0x518588+=0x1){_0x518588>0x0&&(_0x5997fe+='\x20'+_0x55e902[_0xa00c('0x51')]+'\x20');_0x5997fe+=_0x55e902['rules'][_0x518588][_0xa00c('0x52')]?_0x50bb13(_0x55e902[_0xa00c('0x50')][_0x518588][_0xa00c('0x52')]):_0x55e902[_0xa00c('0x50')][_0x518588][_0xa00c('0x53')]+'\x20'+_0x55e902['rules'][_0x518588][_0xa00c('0x54')]+(_0x20fb93(_0x55e902['rules'][_0x518588][_0xa00c('0x54')])?'\x20'+_0x55e902[_0xa00c('0x50')][_0x518588]['value']:'');}return _0x5997fe+')';};var _0x4d4220={'where':{'id':_0x592acc[_0xa00c('0x3a')]['id']}},_0x2ebef6,_0x569a2b,_0x49555b,_0x1df11b,_0x52849d;_0x4d4220=_[_0xa00c('0x2f')]({},_0x4d4220,_0x592acc['options']);return db['AnalyticDefaultReport'][_0xa00c('0x3b')](_0x4d4220)[_0xa00c('0x18')](function(_0x3287d3){if(_0x3287d3){_0x2ebef6=_0x3287d3;return _0x3287d3['getFields']();}return null;})[_0xa00c('0x18')](function(_0x3b17b8){if(_0x3b17b8){if(!_0x3b17b8[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x57'));}_0x569a2b=_0x3b17b8;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})['then'](function(_0xef9bf1){if(_0xef9bf1){_0x49555b=_['keyBy'](_0xef9bf1,'id');var _0x4d6c96;var _0x240f2c=squel[_0xa00c('0x59')]();_0x240f2c[_0xa00c('0x5a')](_0x2ebef6['table']);for(var _0x3136a7=0x0;_0x3136a7<_0x569a2b[_0xa00c('0x28')];_0x3136a7+=0x1){_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5b')]?_0x49555b[_0x569a2b[_0x3136a7][_0xa00c('0x5b')]]['metric']:_0x569a2b[_0x3136a7]['field'];_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x2b6a7b[_0x569a2b[_0x3136a7][_0xa00c('0x5c')]],'%s',_0x4d6c96):_0x4d6c96;_0x4d6c96=_0x569a2b[_0x3136a7][_0xa00c('0x5e')]?_[_0xa00c('0x5d')](_0x3a07fa[_0x569a2b[_0x3136a7]['format']],'%s',_0x4d6c96):_0x4d6c96;if(_0x569a2b[_0x3136a7][_0xa00c('0x5f')]){_0x240f2c[_0xa00c('0x52')](_0x4d6c96);}_0x569a2b[_0x3136a7]['orderBy']&&_0x240f2c[_0xa00c('0x2c')](_0x4d6c96,_0x569a2b[_0x3136a7][_0xa00c('0x60')]==='DESC'?![]:!![]);_0x240f2c[_0xa00c('0x53')](_0x4d6c96,_0x569a2b[_0x3136a7][_0xa00c('0x61')]||_0x4d6c96);}if(_0x2ebef6[_0xa00c('0x62')]){_0x2ebef6[_0xa00c('0x62')]=JSON[_0xa00c('0x63')](_0x2ebef6['joins']);for(var _0x252986=0x0;_0x252986<_0x2ebef6[_0xa00c('0x62')][_0xa00c('0x28')];_0x252986+=0x1){if(_0x2ebef6[_0xa00c('0x62')][_0x252986]['type']&&_[_0xa00c('0x4d')](_0x4aa061,_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x64')])&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x65')]&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')]&&_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x67')]){_0x240f2c[_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x64')]](_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')],null,util['format'](_0xa00c('0x68'),_0x2ebef6['table'],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x65')],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x66')],_0x2ebef6[_0xa00c('0x62')][_0x252986][_0xa00c('0x67')]));}}}if(_0x2ebef6[_0xa00c('0x69')]){_0x2ebef6[_0xa00c('0x69')]=JSON['parse'](_0x2ebef6[_0xa00c('0x69')]);_0x240f2c[_0xa00c('0x30')](_0x50bb13(_0x2ebef6[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x52849d=_0x240f2c[_0xa00c('0x6a')]();_0x240f2c[_0xa00c('0x2b')](_0x3f8c8b);_0x240f2c[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x240f2c['toString']());return db[_0xa00c('0x6d')][_0xa00c('0x20')](_0x240f2c[_0xa00c('0x6e')](),{'type':db[_0xa00c('0x6d')][_0xa00c('0x6f')]['SELECT']});}})[_0xa00c('0x18')](respondWithResult(_0x1b3828,null))[_0xa00c('0x38')](handleError(_0x1b3828,null));};function runReport(_0x44f7b8,_0x3b8d39,_0x3cba49){var _0x318f11=_0x3b8d39['name'];var _0x5889d3=0xa;var _0x4352e9=[_0xa00c('0x40'),_0xa00c('0x70'),_0xa00c('0x41'),_0xa00c('0x71'),_0xa00c('0x72')];var _0x4cb123={'SUM':_0xa00c('0x73'),'COUNT':_0xa00c('0x42'),'COUNT DISTINCT':_0xa00c('0x43'),'MAX':_0xa00c('0x74'),'MIN':_0xa00c('0x75'),'AVG':_0xa00c('0x44'),'GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':_0xa00c('0x46'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3ba6e2={'SEC_TO_TIME':_0xa00c('0x48'),'DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x2dba6e=function(_0x283c0b){return!_[_0xa00c('0x4d')](['IS\x20NULL',_0xa00c('0x4f'),_0xa00c('0x76'),_0xa00c('0x77')],_0x283c0b);};var _0x375530=function(_0x2875c4){if(!_0x2875c4||!_0x2875c4[_0xa00c('0x50')][_0xa00c('0x28')]){return'';}for(var _0x1f672c='(',_0x33d4cf=0x0;_0x33d4cf<_0x2875c4[_0xa00c('0x50')][_0xa00c('0x28')];_0x33d4cf+=0x1){_0x33d4cf>0x0&&(_0x1f672c+='\x20'+_0x2875c4[_0xa00c('0x51')]+'\x20');_0x1f672c+=_0x2875c4[_0xa00c('0x50')][_0x33d4cf][_0xa00c('0x52')]?_0x375530(_0x2875c4['rules'][_0x33d4cf][_0xa00c('0x52')]):_0x2875c4[_0xa00c('0x50')][_0x33d4cf]['field']+'\x20'+_0x2875c4['rules'][_0x33d4cf]['condition']+(_0x2dba6e(_0x2875c4[_0xa00c('0x50')][_0x33d4cf]['condition'])?'\x20'+_0x2875c4[_0xa00c('0x50')][_0x33d4cf][_0xa00c('0x78')]:'');}return _0x1f672c+')';};var _0x375771={'where':{'id':_0x44f7b8['id']}},_0x585f02,_0x3dc94e,_0x1a4b38,_0x25c495,_0x3e5862;_0x375771=_['merge']({},_0x375771,_0x3cba49);return db[_0xa00c('0x1d')][_0xa00c('0x3b')](_0x375771)[_0xa00c('0x18')](function(_0x33276f){if(_0x33276f){_0x585f02=_0x33276f;return _0x33276f[_0xa00c('0x79')]();}return null;})[_0xa00c('0x18')](function(_0x288a5f){if(_0x288a5f){if(!_0x288a5f[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))]('Please\x20insert\x20at\x20least\x20one\x20field!');}_0x3dc94e=_0x288a5f;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})[_0xa00c('0x18')](function(_0x7ae992){if(_0x7ae992){_0x1a4b38=_[_0xa00c('0x7a')](_0x7ae992,'id');var _0x45bef8;var _0x4729da=squel[_0xa00c('0x59')]();_0x4729da[_0xa00c('0x5a')](_0x585f02[_0xa00c('0x7b')]);for(var _0x271c95=0x0;_0x271c95<_0x3dc94e['length'];_0x271c95+=0x1){_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5b')]?_0x1a4b38[_0x3dc94e[_0x271c95][_0xa00c('0x5b')]][_0xa00c('0x7c')]:_0x3dc94e[_0x271c95][_0xa00c('0x53')];_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x4cb123[_0x3dc94e[_0x271c95][_0xa00c('0x5c')]],'%s',_0x45bef8):_0x45bef8;_0x45bef8=_0x3dc94e[_0x271c95][_0xa00c('0x5e')]?_[_0xa00c('0x5d')](_0x3ba6e2[_0x3dc94e[_0x271c95][_0xa00c('0x5e')]],'%s',_0x45bef8):_0x45bef8;if(_0x3dc94e[_0x271c95][_0xa00c('0x5f')]){_0x4729da['group'](_0x45bef8);}_0x3dc94e[_0x271c95]['orderBy']&&_0x4729da['order'](_0x45bef8,_0x3dc94e[_0x271c95][_0xa00c('0x60')]==='DESC'?![]:!![]);_0x4729da[_0xa00c('0x53')](_0x45bef8,_0x3dc94e[_0x271c95][_0xa00c('0x61')]||_0x45bef8);}if(_0x585f02[_0xa00c('0x62')]){_0x585f02['joins']=JSON['parse'](_0x585f02['joins']);for(var _0x119b74=0x0;_0x119b74<_0x585f02[_0xa00c('0x62')][_0xa00c('0x28')];_0x119b74+=0x1){if(_0x585f02['joins'][_0x119b74][_0xa00c('0x64')]&&_[_0xa00c('0x4d')](_0x4352e9,_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x64')])&&_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x65')]&&_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignTable']&&_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignKey']){_0x4729da[_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x64')]](_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x66')],null,util[_0xa00c('0x5e')](_0xa00c('0x68'),_0x585f02[_0xa00c('0x7b')],_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x65')],_0x585f02[_0xa00c('0x62')][_0x119b74][_0xa00c('0x66')],_0x585f02[_0xa00c('0x62')][_0x119b74]['foreignKey']));}}}if(_0x585f02[_0xa00c('0x69')]){_0x585f02[_0xa00c('0x69')]=JSON[_0xa00c('0x63')](_0x585f02['conditions']);_0x4729da[_0xa00c('0x30')](_0x375530(_0x585f02[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x3e5862=_0x4729da['clone']();_0x4729da['limit'](_0x5889d3);_0x4729da[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x4729da[_0xa00c('0x6e')]());return db['sequelize'][_0xa00c('0x20')](_0x4729da[_0xa00c('0x6e')](),{'type':db['sequelize']['QueryTypes'][_0xa00c('0x7d')]});}})['then'](function(_0x203340){if(!_0x203340[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x7e'));}if(_0x3b8d39[_0xa00c('0x7f')]===_0xa00c('0x80')){return null;}var _0x1ed659=_[_0xa00c('0x2f')](_0x3b8d39,{'name':_0x3b8d39[_0xa00c('0x81')]||_0x3b8d39[_0xa00c('0x82')]||_0x585f02[_0xa00c('0x82')],'basename':_0x318f11,'savename':util[_0xa00c('0x5e')]('%s-%s.%s',_0x3b8d39[_0xa00c('0x82')]||_0x585f02[_0xa00c('0x82')],require('randomstring')[_0xa00c('0x83')](0x4),_0x3b8d39[_0xa00c('0x7f')]||'csv')});return db['AnalyticExtractedReport']['create'](_0x1ed659,{'raw':!![]});})[_0xa00c('0x18')](function(_0x4e8ffc){_0x3e5862[_0xa00c('0x30')](_0x585f02['table']+_0xa00c('0x84'),_0x3b8d39[_0xa00c('0x85')],_0x3b8d39[_0xa00c('0x86')]);if(_0x4e8ffc){logger[_0xa00c('0x87')](_0xa00c('0x88'),_0x3e5862[_0xa00c('0x6e')]());require('child_process')[_0xa00c('0x89')](path[_0xa00c('0x40')](__dirname,_0xa00c('0x8a'),_0x4e8ffc['output']),[_0x4e8ffc['id'],_0x3e5862[_0xa00c('0x6e')](),path[_0xa00c('0x40')](__dirname,'../../files/reports',_0x4e8ffc[_0xa00c('0x8b')]),_0x318f11]);return _0x4e8ffc;}else{var _0x10617a=squel['select']();_0x10617a[_0xa00c('0x5a')]('('+_0x3e5862['toString']()+')',_0xa00c('0x8c'));_0x10617a['field'](_0xa00c('0x8d'),_0xa00c('0x13'));_0x3e5862[_0xa00c('0x2b')](_0x3b8d39['limit']||_0x5889d3);_0x3e5862[_0xa00c('0x14')](_0x3b8d39[_0xa00c('0x14')]||0x0);return db['sequelize'][_0xa00c('0x20')](_0x10617a[_0xa00c('0x6e')](),{'type':db[_0xa00c('0x6d')]['QueryTypes']['SELECT']})[_0xa00c('0x18')](function(_0xbb47c2){if(!_0xbb47c2['length']){_0x25c495=0x0;}else{_0x25c495=_0xbb47c2[0x0]['count']||0x0;}return db['sequelize'][_0xa00c('0x20')](_0x3e5862['toString'](),{'type':db[_0xa00c('0x6d')][_0xa00c('0x6f')][_0xa00c('0x7d')]});})[_0xa00c('0x18')](function(_0x2a749){return{'rows':_0x2a749||[],'count':_0x25c495};});}});}exports['run']=function(_0x4c4ce5,_0xb672c2){return runReport(_0x4c4ce5[_0xa00c('0x3a')],_0x4c4ce5['query'],_0x4c4ce5['options'])[_0xa00c('0x18')](respondWithResult(_0xb672c2,null))[_0xa00c('0x38')](handleError(_0xb672c2,null));};exports[_0xa00c('0x8e')]=runReport;exports[_0xa00c('0x20')]=function(_0x59ba8f,_0x2ffa2f){var _0xbbfdb7=0xa;var _0x53b53c=[_0xa00c('0x40'),_0xa00c('0x70'),'right_join','outer_join',_0xa00c('0x72')];var _0x1ed7d6={'SUM':'SUM(%s)','COUNT':_0xa00c('0x42'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xa00c('0x75'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa00c('0x45'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa00c('0x47')};var _0x253f9a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa00c('0x49'),'HOUR':_0xa00c('0x4a'),'ROUND':_0xa00c('0x4b'),'UNIX_TIMESTAMP':_0xa00c('0x4c')};var _0x36b1f1=function(_0x593bd3){return!_[_0xa00c('0x4d')](['IS\x20NULL',_0xa00c('0x4f'),'IS\x20EMPTY',_0xa00c('0x77')],_0x593bd3);};var _0x32d607=function(_0x1ada8f){if(!_0x1ada8f||!_0x1ada8f['rules'][_0xa00c('0x28')]){return'';}for(var _0x512503='(',_0x1e64e0=0x0;_0x1e64e0<_0x1ada8f[_0xa00c('0x50')][_0xa00c('0x28')];_0x1e64e0+=0x1){_0x1e64e0>0x0&&(_0x512503+='\x20'+_0x1ada8f[_0xa00c('0x51')]+'\x20');_0x512503+=_0x1ada8f['rules'][_0x1e64e0][_0xa00c('0x52')]?_0x32d607(_0x1ada8f[_0xa00c('0x50')][_0x1e64e0]['group']):_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x53')]+'\x20'+_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x54')]+(_0x36b1f1(_0x1ada8f['rules'][_0x1e64e0]['condition'])?'\x20'+_0x1ada8f[_0xa00c('0x50')][_0x1e64e0][_0xa00c('0x78')]:'');}return _0x512503+')';};var _0x1d6b31={'where':{'id':_0x59ba8f[_0xa00c('0x3a')]['id']}},_0x5e7b33,_0x1b782c,_0x50525c,_0x26fd9b,_0x58fd5d;_0x1d6b31=_[_0xa00c('0x2f')]({},_0x1d6b31,_0x59ba8f['options']);return db[_0xa00c('0x1d')]['find'](_0x1d6b31)[_0xa00c('0x18')](function(_0x1fe42d){if(_0x1fe42d){_0x5e7b33=_0x1fe42d;return _0x1fe42d[_0xa00c('0x79')]();}return null;})[_0xa00c('0x18')](function(_0xc6dc67){if(_0xc6dc67){if(!_0xc6dc67[_0xa00c('0x28')]){throw new db[(_0xa00c('0x55'))][(_0xa00c('0x56'))](_0xa00c('0x57'));}_0x1b782c=_0xc6dc67;return db[_0xa00c('0x58')][_0xa00c('0x36')]({'raw':!![]});}return null;})['then'](function(_0x4f3cad){if(_0x4f3cad){_0x50525c=_[_0xa00c('0x7a')](_0x4f3cad,'id');var _0x3d9def;var _0x4368b1=squel['select']();_0x4368b1[_0xa00c('0x5a')](_0x5e7b33[_0xa00c('0x7b')]);for(var _0x487d16=0x0;_0x487d16<_0x1b782c[_0xa00c('0x28')];_0x487d16+=0x1){_0x3d9def=_0x1b782c[_0x487d16][_0xa00c('0x5b')]?_0x50525c[_0x1b782c[_0x487d16][_0xa00c('0x5b')]]['metric']:_0x1b782c[_0x487d16][_0xa00c('0x53')];_0x3d9def=_0x1b782c[_0x487d16][_0xa00c('0x5c')]?_[_0xa00c('0x5d')](_0x1ed7d6[_0x1b782c[_0x487d16][_0xa00c('0x5c')]],'%s',_0x3d9def):_0x3d9def;_0x3d9def=_0x1b782c[_0x487d16]['format']?_[_0xa00c('0x5d')](_0x253f9a[_0x1b782c[_0x487d16][_0xa00c('0x5e')]],'%s',_0x3d9def):_0x3d9def;if(_0x1b782c[_0x487d16]['groupBy']){_0x4368b1[_0xa00c('0x52')](_0x3d9def);}_0x1b782c[_0x487d16]['orderBy']&&_0x4368b1['order'](_0x3d9def,_0x1b782c[_0x487d16][_0xa00c('0x60')]===_0xa00c('0x8f')?![]:!![]);_0x4368b1[_0xa00c('0x53')](_0x3d9def,_0x1b782c[_0x487d16]['alias']||_0x3d9def);}if(_0x5e7b33['joins']){_0x5e7b33[_0xa00c('0x62')]=JSON[_0xa00c('0x63')](_0x5e7b33[_0xa00c('0x62')]);for(var _0x312f8b=0x0;_0x312f8b<_0x5e7b33[_0xa00c('0x62')]['length'];_0x312f8b+=0x1){if(_0x5e7b33['joins'][_0x312f8b]['type']&&_['includes'](_0x53b53c,_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x64')])&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x65')]&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')]&&_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x67')]){_0x4368b1[_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x64')]](_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')],null,util[_0xa00c('0x5e')](_0xa00c('0x68'),_0x5e7b33[_0xa00c('0x7b')],_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x65')],_0x5e7b33[_0xa00c('0x62')][_0x312f8b][_0xa00c('0x66')],_0x5e7b33['joins'][_0x312f8b]['foreignKey']));}}}if(_0x5e7b33[_0xa00c('0x69')]){_0x5e7b33[_0xa00c('0x69')]=JSON[_0xa00c('0x63')](_0x5e7b33['conditions']);_0x4368b1[_0xa00c('0x30')](_0x32d607(_0x5e7b33[_0xa00c('0x69')][_0xa00c('0x52')]));}_0x58fd5d=_0x4368b1[_0xa00c('0x6a')]();_0x4368b1[_0xa00c('0x2b')](_0xbbfdb7);_0x4368b1[_0xa00c('0x14')](0x0);logger[_0xa00c('0x6b')](_0xa00c('0x6c'),_0x4368b1['toString']());return db['sequelize']['query'](_0x4368b1[_0xa00c('0x6e')](),{'type':db['sequelize'][_0xa00c('0x6f')]['SELECT']});}})[_0xa00c('0x18')](function(){return{'sql':_0x58fd5d['toString']()};})[_0xa00c('0x18')](respondWithResult(_0x2ffa2f,null))[_0xa00c('0x38')](handleError(_0x2ffa2f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 139f4e9..34b0794 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 _0x8597=['request-promise','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5b4ab1,_0x3fe203){var _0x1bb55e=function(_0x1361bf){while(--_0x1361bf){_0x5b4ab1['push'](_0x5b4ab1['shift']());}};_0x1bb55e(++_0x3fe203);}(_0x8597,0x186));var _0x7859=function(_0x3f88bc,_0xe38cf5){_0x3f88bc=_0x3f88bc-0x0;var _0x4df1c4=_0x8597[_0x3f88bc];return _0x4df1c4;};'use strict';var _=require(_0x7859('0x0'));var util=require(_0x7859('0x1'));var logger=require(_0x7859('0x2'))(_0x7859('0x3'));var moment=require(_0x7859('0x4'));var BPromise=require(_0x7859('0x5'));var rp=require(_0x7859('0x6'));var attributes=require(_0x7859('0x7'));module[_0x7859('0x8')]=function(_0x38371c,_0x53804b){return _0x38371c['define'](_0x7859('0x9'),attributes,{'tableName':_0x7859('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5896=['api','moment','bluebird','request-promise','./analyticDefaultReport.attributes','AnalyticDefaultReport','lodash','util','../../config/logger'];(function(_0x14a686,_0x396664){var _0xde9f05=function(_0x2004e9){while(--_0x2004e9){_0x14a686['push'](_0x14a686['shift']());}};_0xde9f05(++_0x396664);}(_0x5896,0x19b));var _0x6589=function(_0x5e3326,_0x15430d){_0x5e3326=_0x5e3326-0x0;var _0x247dd3=_0x5896[_0x5e3326];return _0x247dd3;};'use strict';var _=require(_0x6589('0x0'));var util=require(_0x6589('0x1'));var logger=require(_0x6589('0x2'))(_0x6589('0x3'));var moment=require(_0x6589('0x4'));var BPromise=require(_0x6589('0x5'));var rp=require(_0x6589('0x6'));var attributes=require(_0x6589('0x7'));module['exports']=function(_0x223832,_0x532130){return _0x223832['define'](_0x6589('0x8'),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 22f42c2..1debbc0 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 _0x63e1=['error','code','message','result','lodash','util','moment','bluebird','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1e47c6,_0x3b2a57){var _0x36c48f=function(_0x354521){while(--_0x354521){_0x1e47c6['push'](_0x1e47c6['shift']());}};_0x36c48f(++_0x3b2a57);}(_0x63e1,0x1e7));var _0x163e=function(_0x17fd41,_0x13ad12){_0x17fd41=_0x17fd41-0x0;var _0x27bc0f=_0x63e1[_0x17fd41];return _0x27bc0f;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var moment=require(_0x163e('0x2'));var BPromise=require(_0x163e('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x163e('0x4'))(_0x163e('0x5'));var config=require('../../config/environment');var jayson=require(_0x163e('0x6'));var client=jayson[_0x163e('0x7')][_0x163e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d605f,_0x638b5f,_0x152d27){return new BPromise(function(_0x38b19f,_0x3a789f){return client[_0x163e('0x9')](_0x3d605f,_0x152d27)[_0x163e('0xa')](function(_0x13ed8d){logger[_0x163e('0xb')](_0x163e('0xc'),_0x638b5f,'request\x20sent');logger[_0x163e('0xd')](_0x163e('0xe'),_0x638b5f,_0x163e('0xf'),JSON[_0x163e('0x10')](_0x13ed8d));if(_0x13ed8d[_0x163e('0x11')]){if(_0x13ed8d[_0x163e('0x11')][_0x163e('0x12')]===0x1f4){logger[_0x163e('0x11')](_0x163e('0xc'),_0x638b5f,_0x13ed8d['error']['message']);return _0x3a789f(_0x13ed8d[_0x163e('0x11')][_0x163e('0x13')]);}logger[_0x163e('0x11')](_0x163e('0xc'),_0x638b5f,_0x13ed8d['error'][_0x163e('0x13')]);return _0x38b19f(_0x13ed8d['error'][_0x163e('0x13')]);}else{logger[_0x163e('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x638b5f,'request\x20sent');_0x38b19f(_0x13ed8d[_0x163e('0x14')]['message']);}})['catch'](function(_0x5e5939){logger[_0x163e('0x11')](_0x163e('0xc'),_0x638b5f,_0x5e5939);_0x3a789f(_0x5e5939);});});} \ No newline at end of file +var _0x7ec5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x17327e,_0x4f6991){var _0x5a9f39=function(_0x360ab3){while(--_0x360ab3){_0x17327e['push'](_0x17327e['shift']());}};_0x5a9f39(++_0x4f6991);}(_0x7ec5,0x128));var _0x57ec=function(_0x2fe5a8,_0x36dfc3){_0x2fe5a8=_0x2fe5a8-0x0;var _0x5cf27c=_0x7ec5[_0x2fe5a8];return _0x5cf27c;};'use strict';var _=require(_0x57ec('0x0'));var util=require('util');var moment=require(_0x57ec('0x1'));var BPromise=require(_0x57ec('0x2'));var rs=require(_0x57ec('0x3'));var fs=require('fs');var db=require(_0x57ec('0x4'))['db'];var utils=require(_0x57ec('0x5'));var logger=require(_0x57ec('0x6'))(_0x57ec('0x7'));var config=require('../../config/environment');var jayson=require(_0x57ec('0x8'));var client=jayson[_0x57ec('0x9')][_0x57ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x177187,_0x3a7222,_0x5d1060){return new BPromise(function(_0x10111e,_0x33e7bd){return client[_0x57ec('0xb')](_0x177187,_0x5d1060)[_0x57ec('0xc')](function(_0x425670){logger[_0x57ec('0xd')](_0x57ec('0xe'),_0x3a7222,_0x57ec('0xf'));logger[_0x57ec('0x10')](_0x57ec('0x11'),_0x3a7222,_0x57ec('0xf'),JSON[_0x57ec('0x12')](_0x425670));if(_0x425670[_0x57ec('0x13')]){if(_0x425670[_0x57ec('0x13')][_0x57ec('0x14')]===0x1f4){logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x425670['error'][_0x57ec('0x15')]);return _0x33e7bd(_0x425670[_0x57ec('0x13')][_0x57ec('0x15')]);}logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x425670[_0x57ec('0x13')][_0x57ec('0x15')]);return _0x10111e(_0x425670[_0x57ec('0x13')]['message']);}else{logger[_0x57ec('0xd')](_0x57ec('0xe'),_0x3a7222,_0x57ec('0xf'));_0x10111e(_0x425670[_0x57ec('0x16')]['message']);}})['catch'](function(_0x377882){logger[_0x57ec('0x13')](_0x57ec('0xe'),_0x3a7222,_0x377882);_0x33e7bd(_0x377882);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 29aaa6a..dc7e01f 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 _0x009f=['/:id/run','run','/:id/query','post','create','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id','isAuthenticated','show','/:id/preview','preview'];(function(_0x4f3c40,_0x54c9a0){var _0x48ce28=function(_0x51293d){while(--_0x51293d){_0x4f3c40['push'](_0x4f3c40['shift']());}};_0x48ce28(++_0x54c9a0);}(_0x009f,0x194));var _0xf009=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x009f[_0x53c256];return _0x25feb6;};'use strict';var multer=require(_0xf009('0x0'));var util=require(_0xf009('0x1'));var path=require(_0xf009('0x2'));var express=require('express');var router=express[_0xf009('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf009('0x4'));var config=require(_0xf009('0x5'));var controller=require(_0xf009('0x6'));router[_0xf009('0x7')]('/',auth['isAuthenticated'](),controller[_0xf009('0x8')]);router[_0xf009('0x7')](_0xf009('0x9'),auth[_0xf009('0xa')](),controller[_0xf009('0xb')]);router[_0xf009('0x7')](_0xf009('0xc'),auth[_0xf009('0xa')](),controller[_0xf009('0xd')]);router['get'](_0xf009('0xe'),auth['isAuthenticated'](),controller[_0xf009('0xf')]);router[_0xf009('0x7')](_0xf009('0x10'),auth[_0xf009('0xa')](),controller['query']);router[_0xf009('0x11')]('/',auth[_0xf009('0xa')](),controller[_0xf009('0x12')]);router['put']('/:id',auth[_0xf009('0xa')](),controller['update']);router[_0xf009('0x13')]('/:id',auth[_0xf009('0xa')](),controller[_0xf009('0x14')]);module[_0xf009('0x15')]=router; \ No newline at end of file +var _0x0f54=['query','post','create','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','preview','/:id/run'];(function(_0x2496da,_0x3fe1fc){var _0x4caae0=function(_0x378012){while(--_0x378012){_0x2496da['push'](_0x2496da['shift']());}};_0x4caae0(++_0x3fe1fc);}(_0x0f54,0x13b));var _0x40f5=function(_0x2345be,_0x5e949d){_0x2345be=_0x2345be-0x0;var _0x2ff231=_0x0f54[_0x2345be];return _0x2ff231;};'use strict';var multer=require(_0x40f5('0x0'));var util=require(_0x40f5('0x1'));var path=require('path');var express=require(_0x40f5('0x2'));var router=express[_0x40f5('0x3')]();var auth=require(_0x40f5('0x4'));var interaction=require(_0x40f5('0x5'));var config=require(_0x40f5('0x6'));var controller=require(_0x40f5('0x7'));router[_0x40f5('0x8')]('/',auth[_0x40f5('0x9')](),controller[_0x40f5('0xa')]);router['get']('/:id',auth[_0x40f5('0x9')](),controller[_0x40f5('0xb')]);router['get'](_0x40f5('0xc'),auth['isAuthenticated'](),controller[_0x40f5('0xd')]);router['get'](_0x40f5('0xe'),auth[_0x40f5('0x9')](),controller['run']);router['get']('/:id/query',auth[_0x40f5('0x9')](),controller[_0x40f5('0xf')]);router[_0x40f5('0x10')]('/',auth[_0x40f5('0x9')](),controller[_0x40f5('0x11')]);router['put'](_0x40f5('0x12'),auth[_0x40f5('0x9')](),controller['update']);router[_0x40f5('0x13')](_0x40f5('0x12'),auth[_0x40f5('0x9')](),controller[_0x40f5('0x14')]);module[_0x40f5('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index e894d41..2e41515 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 _0xbc8f=['STRING','csv','pdf','xlsx','DATE','ENUM','manual','scheduled','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbc8f,0x8f));var _0xfbc8=function(_0x5c13c8,_0xad32d3){_0x5c13c8=_0x5c13c8-0x0;var _0x5041fd=_0xbc8f[_0x5c13c8];return _0x5041fd;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xfbc8('0x0')]={'name':{'type':Sequelize[_0xfbc8('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0xfbc8('0x1')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xfbc8('0x2'),_0xfbc8('0x3'),_0xfbc8('0x4')),'allowNull':![],'defaultValue':_0xfbc8('0x2')},'savename':{'type':Sequelize[_0xfbc8('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0xfbc8('0x5')]},'endDate':{'type':Sequelize[_0xfbc8('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xfbc8('0x6')](_0xfbc8('0x7'),_0xfbc8('0x8')),'allowNull':![],'defaultValue':_0xfbc8('0x7')}}; \ No newline at end of file +var _0x3b3d=['ENUM','manual','scheduled','sequelize','moment','xlsx','STRING','DATE','Loading'];(function(_0x592c24,_0x5d508b){var _0x5aa052=function(_0x1a5dd2){while(--_0x1a5dd2){_0x592c24['push'](_0x592c24['shift']());}};_0x5aa052(++_0x5d508b);}(_0x3b3d,0xa5));var _0xd3b3=function(_0x54c9ba,_0x3cea45){_0x54c9ba=_0x54c9ba-0x0;var _0xfd2aa1=_0x3b3d[_0x54c9ba];return _0xfd2aa1;};'use strict';var Sequelize=require(_0xd3b3('0x0'));var moment=require(_0xd3b3('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM']('csv','pdf',_0xd3b3('0x2')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xd3b3('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xd3b3('0x4')]},'endDate':{'type':Sequelize[_0xd3b3('0x4')]},'status':{'type':Sequelize[_0xd3b3('0x3')],'defaultValue':_0xd3b3('0x5')},'type':{'type':Sequelize[_0xd3b3('0x6')](_0xd3b3('0x7'),_0xd3b3('0x8')),'allowNull':![],'defaultValue':_0xd3b3('0x7')}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 55993e6..e9c007f 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 _0xf7f0=['nolimit','offset','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','rawAttributes','body','find','destroy','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','format','%s.%s','toLowerCase','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','json','apply','reject','save','update','then','error','stack','name','send','index','AnalyticExtractedReport','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x316c52,_0x787106){var _0x3970a9=function(_0xe5927b){while(--_0xe5927b){_0x316c52['push'](_0x316c52['shift']());}};_0x3970a9(++_0x787106);}(_0xf7f0,0xcb));var _0x0f7f=function(_0x228445,_0x4bfa2b){_0x228445=_0x228445-0x0;var _0x33d4f8=_0xf7f0[_0x228445];return _0x33d4f8;};'use strict';var jsonpatch=require(_0x0f7f('0x0'));var rp=require(_0x0f7f('0x1'));var moment=require('moment');var BPromise=require(_0x0f7f('0x2'));var Mustache=require(_0x0f7f('0x3'));var util=require(_0x0f7f('0x4'));var path=require(_0x0f7f('0x5'));var sox=require('sox');var csv=require(_0x0f7f('0x6'));var ejs=require(_0x0f7f('0x7'));var fs=require('fs');var _=require(_0x0f7f('0x8'));var squel=require(_0x0f7f('0x9'));var crypto=require(_0x0f7f('0xa'));var jsforce=require(_0x0f7f('0xb'));var deskjs=require(_0x0f7f('0xc'));var toCsv=require(_0x0f7f('0x6'));var querystring=require(_0x0f7f('0xd'));var Papa=require(_0x0f7f('0xe'));var qs=require(_0x0f7f('0xf'));var logger=require(_0x0f7f('0x10'))('api');var utils=require(_0x0f7f('0x11'));var config=require(_0x0f7f('0x12'));var db=require(_0x0f7f('0x13'))['db'];function respondWithStatusCode(_0x2e7bb6,_0xc80a3f){_0xc80a3f=_0xc80a3f||0xcc;return function(_0x2dd35d){if(_0x2dd35d){return _0x2e7bb6[_0x0f7f('0x14')](_0xc80a3f);}return _0x2e7bb6[_0x0f7f('0x15')](_0xc80a3f)['end']();};}function respondWithResult(_0x4dad2c,_0x44c5c1){_0x44c5c1=_0x44c5c1||0xc8;return function(_0x5deda4){if(_0x5deda4){return _0x4dad2c['status'](_0x44c5c1)['json'](_0x5deda4);}};}function respondWithFilteredResult(_0x53d1bf,_0x306254){return function(_0x2c98ba){if(_0x2c98ba){var _0x44498f=_0x2c98ba[_0x0f7f('0x16')],_0x30fe26=_0x306254['offset'],_0xbf1387=_0x306254['offset']+_0x306254[_0x0f7f('0x17')],_0x3a6047;if(_0xbf1387>=_0x44498f){_0xbf1387=_0x44498f;_0x3a6047=0xc8;}else{_0x3a6047=0xce;}_0x53d1bf[_0x0f7f('0x15')](_0x3a6047);return _0x53d1bf['set']('Content-Range',_0x30fe26+'-'+_0xbf1387+'/'+_0x44498f)[_0x0f7f('0x18')](_0x2c98ba);}return null;};}function patchUpdates(_0xc6d90a){return function(_0xa417b8){try{jsonpatch[_0x0f7f('0x19')](_0xa417b8,_0xc6d90a,!![]);}catch(_0x160b1a){return BPromise[_0x0f7f('0x1a')](_0x160b1a);}return _0xa417b8[_0x0f7f('0x1b')]();};}function saveUpdates(_0x3caf8a,_0x56b8f9){return function(_0x17fe36){if(_0x17fe36){return _0x17fe36[_0x0f7f('0x1c')](_0x3caf8a)[_0x0f7f('0x1d')](function(_0x590e4d){return _0x590e4d;});}return null;};}function removeEntity(_0x5be574,_0x2caab2){return function(_0x56d1f9){if(_0x56d1f9){return _0x56d1f9['destroy']()[_0x0f7f('0x1d')](function(){_0x5be574[_0x0f7f('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dd370,_0x35396c){return function(_0xc4fbd){if(!_0xc4fbd){_0x2dd370[_0x0f7f('0x14')](0x194);}return _0xc4fbd;};}function handleError(_0x40f6e1,_0x2f19c7){_0x2f19c7=_0x2f19c7||0x1f4;return function(_0x1bde3d){logger[_0x0f7f('0x1e')](_0x1bde3d[_0x0f7f('0x1f')]);if(_0x1bde3d[_0x0f7f('0x20')]){delete _0x1bde3d['name'];}_0x40f6e1['status'](_0x2f19c7)[_0x0f7f('0x21')](_0x1bde3d);};}exports[_0x0f7f('0x22')]=function(_0x32539c,_0x48e341){var _0xc3d107={},_0x229b0f={},_0x2aae44={'count':0x0,'rows':[]};var _0xd3bfd0=db[_0x0f7f('0x23')]['rawAttributes'];_0x229b0f[_0x0f7f('0x24')]=_['keys'](_0xd3bfd0);var _0x4d9f96={'dateStart':_0x32539c[_0x0f7f('0x25')]['dateStart'],'dateEnd':_0x32539c[_0x0f7f('0x25')]['dateEnd']};delete _0x32539c[_0x0f7f('0x25')][_0x0f7f('0x26')];delete _0x32539c['query'][_0x0f7f('0x27')];_0x229b0f[_0x0f7f('0x25')]=_[_0x0f7f('0x28')](_0x32539c[_0x0f7f('0x25')]);_0x229b0f['filters']=_[_0x0f7f('0x29')](_0x229b0f[_0x0f7f('0x24')],_0x229b0f['query']);_0xc3d107[_0x0f7f('0x2a')]=_[_0x0f7f('0x29')](_0x229b0f[_0x0f7f('0x24')],qs['fields'](_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x2b')]));_0xc3d107[_0x0f7f('0x2a')]=_0xc3d107['attributes'][_0x0f7f('0x2c')]?_0xc3d107[_0x0f7f('0x2a')]:_0x229b0f[_0x0f7f('0x24')];if(!_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x2d')](_0x0f7f('0x2e'))){_0xc3d107[_0x0f7f('0x17')]=qs[_0x0f7f('0x17')](_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x17')]);_0xc3d107[_0x0f7f('0x2f')]=qs[_0x0f7f('0x2f')](_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x2f')]);}_0xc3d107[_0x0f7f('0x30')]=qs[_0x0f7f('0x31')](_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x31')]);_0xc3d107[_0x0f7f('0x32')]=qs[_0x0f7f('0x33')](_[_0x0f7f('0x34')](_0x32539c[_0x0f7f('0x25')],_0x229b0f['filters']));if(_0x4d9f96[_0x0f7f('0x26')]){if(_0x4d9f96[_0x0f7f('0x27')]){_0x4d9f96['dateEnd']=moment(_0x4d9f96[_0x0f7f('0x27')])[_0x0f7f('0x35')](0x1,_0x0f7f('0x36'));}else{_0x4d9f96[_0x0f7f('0x27')]=moment(_0x4d9f96['dateStart'])[_0x0f7f('0x35')](0x1,'day');}_[_0x0f7f('0x37')](_0xc3d107['where'],{'createdAt':{'$gte':_0x4d9f96[_0x0f7f('0x26')],'$lte':_0x4d9f96[_0x0f7f('0x27')]}});}if(_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x38')]){_0xc3d107[_0x0f7f('0x32')]=_[_0x0f7f('0x37')](_0xc3d107[_0x0f7f('0x32')],{'$or':_[_0x0f7f('0x39')](_0xc3d107[_0x0f7f('0x2a')],function(_0x2c2eec){var _0x2ddd05={};_0x2ddd05[_0x2c2eec]={'$like':'%'+_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x38')]+'%'};return _0x2ddd05;})});}_0xc3d107=_['merge']({},_0xc3d107,_0x32539c[_0x0f7f('0x3a')]);var _0xd45ba={'where':_0xc3d107['where']};return db[_0x0f7f('0x23')]['count'](_0xd45ba)['then'](function(_0x203e5d){_0x2aae44[_0x0f7f('0x16')]=_0x203e5d;if(_0x32539c[_0x0f7f('0x25')][_0x0f7f('0x3b')]){_0xc3d107[_0x0f7f('0x3c')]=[{'all':!![]}];}return db[_0x0f7f('0x23')][_0x0f7f('0x3d')](_0xc3d107);})[_0x0f7f('0x1d')](function(_0x329a8){_0x2aae44['rows']=_0x329a8;return _0x2aae44;})[_0x0f7f('0x1d')](respondWithFilteredResult(_0x48e341,_0xc3d107))[_0x0f7f('0x3e')](handleError(_0x48e341,null));};exports[_0x0f7f('0x3f')]=function(_0x222e86,_0x3a767a){var _0x243329={'raw':!![],'where':{'id':_0x222e86[_0x0f7f('0x40')]['id']}},_0x559afb={};_0x559afb[_0x0f7f('0x24')]=_[_0x0f7f('0x28')](db[_0x0f7f('0x23')][_0x0f7f('0x41')]);_0x559afb[_0x0f7f('0x25')]=_[_0x0f7f('0x28')](_0x222e86[_0x0f7f('0x25')]);_0x559afb['filters']=_[_0x0f7f('0x29')](_0x559afb['model'],_0x559afb[_0x0f7f('0x25')]);_0x243329[_0x0f7f('0x2a')]=_[_0x0f7f('0x29')](_0x559afb['model'],qs[_0x0f7f('0x2b')](_0x222e86[_0x0f7f('0x25')][_0x0f7f('0x2b')]));_0x243329['attributes']=_0x243329[_0x0f7f('0x2a')][_0x0f7f('0x2c')]?_0x243329[_0x0f7f('0x2a')]:_0x559afb[_0x0f7f('0x24')];if(_0x222e86[_0x0f7f('0x25')][_0x0f7f('0x3b')]){_0x243329[_0x0f7f('0x3c')]=[{'all':!![]}];}_0x243329=_[_0x0f7f('0x37')]({},_0x243329,_0x222e86[_0x0f7f('0x3a')]);return db['AnalyticExtractedReport']['find'](_0x243329)[_0x0f7f('0x1d')](handleEntityNotFound(_0x3a767a,null))[_0x0f7f('0x1d')](respondWithResult(_0x3a767a,null))['catch'](handleError(_0x3a767a,null));};exports['create']=function(_0x57793a,_0xf69762){return db[_0x0f7f('0x23')]['create'](_0x57793a[_0x0f7f('0x42')],{})[_0x0f7f('0x1d')](respondWithResult(_0xf69762,0xc9))[_0x0f7f('0x3e')](handleError(_0xf69762,null));};exports['update']=function(_0x5dde62,_0x1b5180){if(_0x5dde62['body']['id']){delete _0x5dde62[_0x0f7f('0x42')]['id'];}return db[_0x0f7f('0x23')][_0x0f7f('0x43')]({'where':{'id':_0x5dde62[_0x0f7f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b5180,null))[_0x0f7f('0x1d')](saveUpdates(_0x5dde62['body'],null))[_0x0f7f('0x1d')](respondWithResult(_0x1b5180,null))[_0x0f7f('0x3e')](handleError(_0x1b5180,null));};exports[_0x0f7f('0x44')]=function(_0x29ab0f,_0x3f19cc){return db[_0x0f7f('0x23')][_0x0f7f('0x43')]({'where':{'id':_0x29ab0f[_0x0f7f('0x40')]['id']}})[_0x0f7f('0x1d')](handleEntityNotFound(_0x3f19cc,null))[_0x0f7f('0x1d')](removeEntity(_0x3f19cc,null))[_0x0f7f('0x3e')](handleError(_0x3f19cc,null));};exports[_0x0f7f('0x45')]=function(_0x287767,_0x1f5714,_0x428d79){return db[_0x0f7f('0x23')]['find']({'where':{'id':_0x287767[_0x0f7f('0x40')]['id']},'attributes':[_0x0f7f('0x20'),_0x0f7f('0x46'),_0x0f7f('0x47'),_0x0f7f('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x1f5714,null))[_0x0f7f('0x1d')](function(_0xb93c39){if(_0xb93c39){if(!fs[_0x0f7f('0x49')](path[_0x0f7f('0x4a')](config[_0x0f7f('0x4b')],_0x0f7f('0x4c'),_0xb93c39[_0x0f7f('0x47')]))){throw new db[(_0x0f7f('0x4d'))][(_0x0f7f('0x4e'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x287767[_0x0f7f('0x25')][_0x0f7f('0x4f')]){return _0x1f5714[_0x0f7f('0x14')](0xc8);}return _0x1f5714['download'](path[_0x0f7f('0x4a')](config['root'],_0x0f7f('0x4c'),_0xb93c39['savename']),util[_0x0f7f('0x50')](_0x0f7f('0x51'),_0xb93c39[_0x0f7f('0x46')]||_0xb93c39['name'],_0xb93c39[_0x0f7f('0x48')][_0x0f7f('0x52')]()));}})[_0x0f7f('0x3e')](handleError(_0x1f5714,null));}; \ No newline at end of file +var _0x9e48=['download','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','toLowerCase','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','add','day','merge','filter','options','AnalyticExtractedReport','count','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x608e20,_0x2c546d){var _0x5f498a=function(_0x7ee427){while(--_0x7ee427){_0x608e20['push'](_0x608e20['shift']());}};_0x5f498a(++_0x2c546d);}(_0x9e48,0xf5));var _0x89e4=function(_0xdfd552,_0x5f39a0){_0xdfd552=_0xdfd552-0x0;var _0x598335=_0x9e48[_0xdfd552];return _0x598335;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x89e4('0x0'));var moment=require(_0x89e4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x89e4('0x2'));var util=require(_0x89e4('0x3'));var path=require(_0x89e4('0x4'));var sox=require(_0x89e4('0x5'));var csv=require('to-csv');var ejs=require(_0x89e4('0x6'));var fs=require('fs');var _=require(_0x89e4('0x7'));var squel=require(_0x89e4('0x8'));var crypto=require(_0x89e4('0x9'));var jsforce=require(_0x89e4('0xa'));var deskjs=require(_0x89e4('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x89e4('0xc'));var qs=require(_0x89e4('0xd'));var logger=require(_0x89e4('0xe'))(_0x89e4('0xf'));var utils=require(_0x89e4('0x10'));var config=require(_0x89e4('0x11'));var db=require(_0x89e4('0x12'))['db'];function respondWithStatusCode(_0x41f8ea,_0x634fae){_0x634fae=_0x634fae||0xcc;return function(_0x24414d){if(_0x24414d){return _0x41f8ea[_0x89e4('0x13')](_0x634fae);}return _0x41f8ea[_0x89e4('0x14')](_0x634fae)['end']();};}function respondWithResult(_0x1a9a80,_0x24c8b0){_0x24c8b0=_0x24c8b0||0xc8;return function(_0x4eb069){if(_0x4eb069){return _0x1a9a80['status'](_0x24c8b0)[_0x89e4('0x15')](_0x4eb069);}};}function respondWithFilteredResult(_0x344f60,_0x12c334){return function(_0x1add97){if(_0x1add97){var _0x7a1002=_0x1add97['count'],_0x270dde=_0x12c334[_0x89e4('0x16')],_0x541623=_0x12c334['offset']+_0x12c334[_0x89e4('0x17')],_0x27900f;if(_0x541623>=_0x7a1002){_0x541623=_0x7a1002;_0x27900f=0xc8;}else{_0x27900f=0xce;}_0x344f60[_0x89e4('0x14')](_0x27900f);return _0x344f60['set'](_0x89e4('0x18'),_0x270dde+'-'+_0x541623+'/'+_0x7a1002)[_0x89e4('0x15')](_0x1add97);}return null;};}function patchUpdates(_0x1feb50){return function(_0x34ba46){try{jsonpatch[_0x89e4('0x19')](_0x34ba46,_0x1feb50,!![]);}catch(_0x228aab){return BPromise[_0x89e4('0x1a')](_0x228aab);}return _0x34ba46[_0x89e4('0x1b')]();};}function saveUpdates(_0x5228ca,_0x292bb1){return function(_0x33c339){if(_0x33c339){return _0x33c339[_0x89e4('0x1c')](_0x5228ca)[_0x89e4('0x1d')](function(_0x3c6845){return _0x3c6845;});}return null;};}function removeEntity(_0x38a545,_0x3df709){return function(_0x315fc2){if(_0x315fc2){return _0x315fc2[_0x89e4('0x1e')]()[_0x89e4('0x1d')](function(){_0x38a545[_0x89e4('0x14')](0xcc)[_0x89e4('0x1f')]();});}};}function handleEntityNotFound(_0x5ba2fc,_0x1e323e){return function(_0x40f294){if(!_0x40f294){_0x5ba2fc['sendStatus'](0x194);}return _0x40f294;};}function handleError(_0x417062,_0x53c929){_0x53c929=_0x53c929||0x1f4;return function(_0x5cb864){logger[_0x89e4('0x20')](_0x5cb864[_0x89e4('0x21')]);if(_0x5cb864['name']){delete _0x5cb864[_0x89e4('0x22')];}_0x417062[_0x89e4('0x14')](_0x53c929)['send'](_0x5cb864);};}exports[_0x89e4('0x23')]=function(_0x1bc693,_0x2c2c43){var _0x1f841d={},_0x4c23a2={},_0x2cb28a={'count':0x0,'rows':[]};var _0x4ad5e=db['AnalyticExtractedReport'][_0x89e4('0x24')];_0x4c23a2[_0x89e4('0x25')]=_[_0x89e4('0x26')](_0x4ad5e);var _0x32a274={'dateStart':_0x1bc693[_0x89e4('0x27')][_0x89e4('0x28')],'dateEnd':_0x1bc693[_0x89e4('0x27')][_0x89e4('0x29')]};delete _0x1bc693[_0x89e4('0x27')]['dateStart'];delete _0x1bc693[_0x89e4('0x27')][_0x89e4('0x29')];_0x4c23a2[_0x89e4('0x27')]=_['keys'](_0x1bc693['query']);_0x4c23a2[_0x89e4('0x2a')]=_['intersection'](_0x4c23a2[_0x89e4('0x25')],_0x4c23a2[_0x89e4('0x27')]);_0x1f841d[_0x89e4('0x2b')]=_[_0x89e4('0x2c')](_0x4c23a2[_0x89e4('0x25')],qs['fields'](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x2d')]));_0x1f841d[_0x89e4('0x2b')]=_0x1f841d[_0x89e4('0x2b')][_0x89e4('0x2e')]?_0x1f841d[_0x89e4('0x2b')]:_0x4c23a2[_0x89e4('0x25')];if(!_0x1bc693[_0x89e4('0x27')]['hasOwnProperty'](_0x89e4('0x2f'))){_0x1f841d[_0x89e4('0x17')]=qs[_0x89e4('0x17')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x17')]);_0x1f841d[_0x89e4('0x16')]=qs[_0x89e4('0x16')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x16')]);}_0x1f841d['order']=qs[_0x89e4('0x30')](_0x1bc693[_0x89e4('0x27')][_0x89e4('0x30')]);_0x1f841d[_0x89e4('0x31')]=qs['filters'](_[_0x89e4('0x32')](_0x1bc693['query'],_0x4c23a2[_0x89e4('0x2a')]));if(_0x32a274[_0x89e4('0x28')]){if(_0x32a274[_0x89e4('0x29')]){_0x32a274[_0x89e4('0x29')]=moment(_0x32a274['dateEnd'])[_0x89e4('0x33')](0x1,_0x89e4('0x34'));}else{_0x32a274[_0x89e4('0x29')]=moment(_0x32a274['dateStart'])[_0x89e4('0x33')](0x1,_0x89e4('0x34'));}_[_0x89e4('0x35')](_0x1f841d[_0x89e4('0x31')],{'createdAt':{'$gte':_0x32a274['dateStart'],'$lte':_0x32a274[_0x89e4('0x29')]}});}if(_0x1bc693['query'][_0x89e4('0x36')]){_0x1f841d['where']=_[_0x89e4('0x35')](_0x1f841d[_0x89e4('0x31')],{'$or':_['map'](_0x1f841d[_0x89e4('0x2b')],function(_0x804254){var _0x4e3afe={};_0x4e3afe[_0x804254]={'$like':'%'+_0x1bc693['query']['filter']+'%'};return _0x4e3afe;})});}_0x1f841d=_[_0x89e4('0x35')]({},_0x1f841d,_0x1bc693[_0x89e4('0x37')]);var _0x1fd4af={'where':_0x1f841d['where']};return db[_0x89e4('0x38')][_0x89e4('0x39')](_0x1fd4af)['then'](function(_0x2770ca){_0x2cb28a[_0x89e4('0x39')]=_0x2770ca;if(_0x1bc693['query'][_0x89e4('0x3a')]){_0x1f841d[_0x89e4('0x3b')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x1f841d);})['then'](function(_0x9a84b7){_0x2cb28a[_0x89e4('0x3c')]=_0x9a84b7;return _0x2cb28a;})[_0x89e4('0x1d')](respondWithFilteredResult(_0x2c2c43,_0x1f841d))[_0x89e4('0x3d')](handleError(_0x2c2c43,null));};exports[_0x89e4('0x3e')]=function(_0x5e496f,_0x400154){var _0x501489={'raw':!![],'where':{'id':_0x5e496f[_0x89e4('0x3f')]['id']}},_0x5afc84={};_0x5afc84['model']=_[_0x89e4('0x26')](db[_0x89e4('0x38')]['rawAttributes']);_0x5afc84[_0x89e4('0x27')]=_[_0x89e4('0x26')](_0x5e496f['query']);_0x5afc84[_0x89e4('0x2a')]=_[_0x89e4('0x2c')](_0x5afc84[_0x89e4('0x25')],_0x5afc84[_0x89e4('0x27')]);_0x501489['attributes']=_['intersection'](_0x5afc84[_0x89e4('0x25')],qs[_0x89e4('0x2d')](_0x5e496f[_0x89e4('0x27')][_0x89e4('0x2d')]));_0x501489['attributes']=_0x501489['attributes'][_0x89e4('0x2e')]?_0x501489['attributes']:_0x5afc84[_0x89e4('0x25')];if(_0x5e496f['query'][_0x89e4('0x3a')]){_0x501489[_0x89e4('0x3b')]=[{'all':!![]}];}_0x501489=_['merge']({},_0x501489,_0x5e496f[_0x89e4('0x37')]);return db['AnalyticExtractedReport'][_0x89e4('0x40')](_0x501489)[_0x89e4('0x1d')](handleEntityNotFound(_0x400154,null))['then'](respondWithResult(_0x400154,null))[_0x89e4('0x3d')](handleError(_0x400154,null));};exports['create']=function(_0x5e9faf,_0x1da0f5){return db[_0x89e4('0x38')][_0x89e4('0x41')](_0x5e9faf[_0x89e4('0x42')],{})['then'](respondWithResult(_0x1da0f5,0xc9))[_0x89e4('0x3d')](handleError(_0x1da0f5,null));};exports[_0x89e4('0x1c')]=function(_0x2b4994,_0x3b63b7){if(_0x2b4994[_0x89e4('0x42')]['id']){delete _0x2b4994[_0x89e4('0x42')]['id'];}return db['AnalyticExtractedReport'][_0x89e4('0x40')]({'where':{'id':_0x2b4994[_0x89e4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b63b7,null))[_0x89e4('0x1d')](saveUpdates(_0x2b4994[_0x89e4('0x42')],null))[_0x89e4('0x1d')](respondWithResult(_0x3b63b7,null))['catch'](handleError(_0x3b63b7,null));};exports[_0x89e4('0x1e')]=function(_0x4f25a6,_0x3ff107){return db['AnalyticExtractedReport'][_0x89e4('0x40')]({'where':{'id':_0x4f25a6['params']['id']}})[_0x89e4('0x1d')](handleEntityNotFound(_0x3ff107,null))['then'](removeEntity(_0x3ff107,null))[_0x89e4('0x3d')](handleError(_0x3ff107,null));};exports[_0x89e4('0x43')]=function(_0x5edd76,_0x584ff4,_0x22fff2){return db[_0x89e4('0x38')]['find']({'where':{'id':_0x5edd76[_0x89e4('0x3f')]['id']},'attributes':[_0x89e4('0x22'),'basename',_0x89e4('0x44'),_0x89e4('0x45')],'raw':!![]})[_0x89e4('0x1d')](handleEntityNotFound(_0x584ff4,null))[_0x89e4('0x1d')](function(_0x233dcb){if(_0x233dcb){if(!fs[_0x89e4('0x46')](path[_0x89e4('0x47')](config[_0x89e4('0x48')],_0x89e4('0x49'),_0x233dcb['savename']))){throw new db[(_0x89e4('0x4a'))][(_0x89e4('0x4b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x5edd76[_0x89e4('0x27')][_0x89e4('0x4c')]){return _0x584ff4[_0x89e4('0x13')](0xc8);}return _0x584ff4[_0x89e4('0x43')](path[_0x89e4('0x47')](config[_0x89e4('0x48')],'server/files/reports',_0x233dcb['savename']),util['format']('%s.%s',_0x233dcb['basename']||_0x233dcb[_0x89e4('0x22')],_0x233dcb[_0x89e4('0x45')][_0x89e4('0x4d')]()));}})[_0x89e4('0x3d')](handleError(_0x584ff4,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 1aa9014..9558fac 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 _0x142b=['../../config/logger','api','moment','request-promise','./analyticExtractedReport.attributes','exports','lodash','util'];(function(_0x1c8c07,_0x2579af){var _0x4aa88f=function(_0x2ad13d){while(--_0x2ad13d){_0x1c8c07['push'](_0x1c8c07['shift']());}};_0x4aa88f(++_0x2579af);}(_0x142b,0x10e));var _0xb142=function(_0x58e112,_0x282a5e){_0x58e112=_0x58e112-0x0;var _0x5c401a=_0x142b[_0x58e112];return _0x5c401a;};'use strict';var _=require(_0xb142('0x0'));var util=require(_0xb142('0x1'));var logger=require(_0xb142('0x2'))(_0xb142('0x3'));var moment=require(_0xb142('0x4'));var BPromise=require('bluebird');var rp=require(_0xb142('0x5'));var attributes=require(_0xb142('0x6'));module[_0xb142('0x7')]=function(_0xb3dd9c,_0x5c3714){return _0xb3dd9c['define']('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9265=['lodash','api','moment','bluebird','request-promise','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports'];(function(_0x2b58ec,_0x463407){var _0x348182=function(_0x52fbd8){while(--_0x52fbd8){_0x2b58ec['push'](_0x2b58ec['shift']());}};_0x348182(++_0x463407);}(_0x9265,0x1dd));var _0x5926=function(_0xd90b19,_0x340c84){_0xd90b19=_0xd90b19-0x0;var _0x16bae2=_0x9265[_0xd90b19];return _0x16bae2;};'use strict';var _=require(_0x5926('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5926('0x1'));var moment=require(_0x5926('0x2'));var BPromise=require(_0x5926('0x3'));var rp=require(_0x5926('0x4'));var attributes=require(_0x5926('0x5'));module[_0x5926('0x6')]=function(_0x31d820,_0x2ce376){return _0x31d820['define'](_0x5926('0x7'),attributes,{'tableName':_0x5926('0x8'),'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 cb2e220..1ff69fd 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 _0x12a4=['info','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5df092,_0x4a7628){var _0x2423af=function(_0x2b1a77){while(--_0x2b1a77){_0x5df092['push'](_0x5df092['shift']());}};_0x2423af(++_0x4a7628);}(_0x12a4,0x1e2));var _0x412a=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x12a4[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0x412a('0x0'));var util=require(_0x412a('0x1'));var moment=require('moment');var BPromise=require(_0x412a('0x2'));var rs=require(_0x412a('0x3'));var fs=require('fs');var db=require(_0x412a('0x4'))['db'];var utils=require(_0x412a('0x5'));var logger=require(_0x412a('0x6'))(_0x412a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x412a('0x8')][_0x412a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56fd92,_0x4d93f2,_0x28b928){return new BPromise(function(_0xf872a9,_0x19c12f){return client[_0x412a('0xa')](_0x56fd92,_0x28b928)['then'](function(_0x55aa13){logger['info'](_0x412a('0xb'),_0x4d93f2,_0x412a('0xc'));logger['debug'](_0x412a('0xd'),_0x4d93f2,_0x412a('0xc'),JSON[_0x412a('0xe')](_0x55aa13));if(_0x55aa13[_0x412a('0xf')]){if(_0x55aa13[_0x412a('0xf')][_0x412a('0x10')]===0x1f4){logger[_0x412a('0xf')](_0x412a('0xb'),_0x4d93f2,_0x55aa13[_0x412a('0xf')]['message']);return _0x19c12f(_0x55aa13[_0x412a('0xf')][_0x412a('0x11')]);}logger[_0x412a('0xf')](_0x412a('0xb'),_0x4d93f2,_0x55aa13[_0x412a('0xf')]['message']);return _0xf872a9(_0x55aa13['error'][_0x412a('0x11')]);}else{logger[_0x412a('0x12')](_0x412a('0xb'),_0x4d93f2,_0x412a('0xc'));_0xf872a9(_0x55aa13[_0x412a('0x13')][_0x412a('0x11')]);}})['catch'](function(_0x3cd7db){logger[_0x412a('0xf')](_0x412a('0xb'),_0x4d93f2,_0x3cd7db);_0x19c12f(_0x3cd7db);});});} \ No newline at end of file +var _0x98f0=['moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x98f0,0xd0));var _0x098f=function(_0x1035d2,_0x48714c){_0x1035d2=_0x1035d2-0x0;var _0x2fddcc=_0x98f0[_0x1035d2];return _0x2fddcc;};'use strict';var _=require(_0x098f('0x0'));var util=require(_0x098f('0x1'));var moment=require(_0x098f('0x2'));var BPromise=require(_0x098f('0x3'));var rs=require(_0x098f('0x4'));var fs=require('fs');var db=require(_0x098f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x098f('0x6'))('rpc');var config=require(_0x098f('0x7'));var jayson=require(_0x098f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b20a0,_0xfd75c3,_0x5d65ed){return new BPromise(function(_0x6f8775,_0x47c6f){return client[_0x098f('0x9')](_0x2b20a0,_0x5d65ed)[_0x098f('0xa')](function(_0x8b2b25){logger[_0x098f('0xb')](_0x098f('0xc'),_0xfd75c3,_0x098f('0xd'));logger[_0x098f('0xe')](_0x098f('0xf'),_0xfd75c3,_0x098f('0xd'),JSON[_0x098f('0x10')](_0x8b2b25));if(_0x8b2b25['error']){if(_0x8b2b25[_0x098f('0x11')][_0x098f('0x12')]===0x1f4){logger['error'](_0x098f('0xc'),_0xfd75c3,_0x8b2b25[_0x098f('0x11')]['message']);return _0x47c6f(_0x8b2b25['error']['message']);}logger['error'](_0x098f('0xc'),_0xfd75c3,_0x8b2b25[_0x098f('0x11')][_0x098f('0x13')]);return _0x6f8775(_0x8b2b25[_0x098f('0x11')][_0x098f('0x13')]);}else{logger[_0x098f('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfd75c3,'request\x20sent');_0x6f8775(_0x8b2b25['result']['message']);}})[_0x098f('0x14')](function(_0x2fd5a5){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xfd75c3,_0x2fd5a5);_0x47c6f(_0x2fd5a5);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 82d8cfc..2fa9e0f 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 _0x19d3=['put','update','delete','destroy','multer','util','path','express','../../config/environment','./analyticExtractedReport.controller','get','/:id','isAuthenticated','/:id/download','download','post','create'];(function(_0x2c53ad,_0x6976fa){var _0x322a5c=function(_0x164cba){while(--_0x164cba){_0x2c53ad['push'](_0x2c53ad['shift']());}};_0x322a5c(++_0x6976fa);}(_0x19d3,0xe1));var _0x319d=function(_0x3db278,_0x1b0b22){_0x3db278=_0x3db278-0x0;var _0x38ed71=_0x19d3[_0x3db278];return _0x38ed71;};'use strict';var multer=require(_0x319d('0x0'));var util=require(_0x319d('0x1'));var path=require(_0x319d('0x2'));var express=require(_0x319d('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x319d('0x4'));var controller=require(_0x319d('0x5'));router[_0x319d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x319d('0x7'),auth[_0x319d('0x8')](),controller['show']);router[_0x319d('0x6')](_0x319d('0x9'),auth[_0x319d('0x8')](),controller[_0x319d('0xa')]);router[_0x319d('0xb')]('/',auth[_0x319d('0x8')](),controller[_0x319d('0xc')]);router[_0x319d('0xd')]('/:id',auth[_0x319d('0x8')](),controller[_0x319d('0xe')]);router[_0x319d('0xf')](_0x319d('0x7'),auth['isAuthenticated'](),controller[_0x319d('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f8d=['./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x9f8d,0xd5));var _0xd9f8=function(_0x4c2698,_0x2720c2){_0x4c2698=_0x4c2698-0x0;var _0x309bed=_0x9f8d[_0x4c2698];return _0x309bed;};'use strict';var multer=require(_0xd9f8('0x0'));var util=require('util');var path=require(_0xd9f8('0x1'));var express=require(_0xd9f8('0x2'));var router=express[_0xd9f8('0x3')]();var auth=require(_0xd9f8('0x4'));var interaction=require(_0xd9f8('0x5'));var config=require(_0xd9f8('0x6'));var controller=require(_0xd9f8('0x7'));router[_0xd9f8('0x8')]('/',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0xa')]);router['get'](_0xd9f8('0xb'),auth[_0xd9f8('0x9')](),controller[_0xd9f8('0xc')]);router['get'](_0xd9f8('0xd'),auth['isAuthenticated'](),controller[_0xd9f8('0xe')]);router[_0xd9f8('0xf')]('/',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x10')]);router[_0xd9f8('0x11')]('/:id',auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x12')]);router[_0xd9f8('0x13')](_0xd9f8('0xb'),auth[_0xd9f8('0x9')](),controller[_0xd9f8('0x14')]);module[_0xd9f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 0614c38..239dac1 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 _0x28a8=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x28a8,0xb0));var _0x828a=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x28a8[_0x482214];return _0x38d0cb;};'use strict';var Sequelize=require(_0x828a('0x0'));module[_0x828a('0x1')]={'field':{'type':Sequelize[_0x828a('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x828a('0x3')]},'groupBy':{'type':Sequelize[_0x828a('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x828a('0x3')]},'custom':{'type':Sequelize[_0x828a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x3ece=['BOOLEAN','exports','STRING'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0x3ece,0x181));var _0xe3ec=function(_0x4e1924,_0x561843){_0x4e1924=_0x4e1924-0x0;var _0x5c3f20=_0x3ece[_0x4e1924];return _0x5c3f20;};'use strict';var Sequelize=require('sequelize');module[_0xe3ec('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xe3ec('0x1')]},'function':{'type':Sequelize[_0xe3ec('0x1')]},'format':{'type':Sequelize[_0xe3ec('0x1')]},'groupBy':{'type':Sequelize[_0xe3ec('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xe3ec('0x1')]},'custom':{'type':Sequelize[_0xe3ec('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e1c44b7..a42bb92 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 _0xafc4=['dateStart','dateEnd','intersection','model','attributes','fields','length','nolimit','limit','sort','where','filters','pick','day','merge','filter','map','options','includeAll','catch','show','params','create','bulkCreate','body','find','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','findAll','fast-json-patch','moment','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','index','AnalyticFieldReport','rawAttributes','keys','query'];(function(_0x45e5f2,_0xc803d0){var _0x333b0a=function(_0xa16e8a){while(--_0xa16e8a){_0x45e5f2['push'](_0x45e5f2['shift']());}};_0x333b0a(++_0xc803d0);}(_0xafc4,0x69));var _0x4afc=function(_0x3c7e99,_0x177ea1){_0x3c7e99=_0x3c7e99-0x0;var _0x3654be=_0xafc4[_0x3c7e99];return _0x3654be;};'use strict';var jsonpatch=require(_0x4afc('0x0'));var rp=require('request-promise');var moment=require(_0x4afc('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x4afc('0x2'));var util=require(_0x4afc('0x3'));var path=require(_0x4afc('0x4'));var sox=require(_0x4afc('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4afc('0x6'));var crypto=require(_0x4afc('0x7'));var jsforce=require(_0x4afc('0x8'));var deskjs=require(_0x4afc('0x9'));var toCsv=require(_0x4afc('0xa'));var querystring=require(_0x4afc('0xb'));var Papa=require('papaparse');var qs=require(_0x4afc('0xc'));var logger=require(_0x4afc('0xd'))(_0x4afc('0xe'));var utils=require(_0x4afc('0xf'));var config=require(_0x4afc('0x10'));var db=require(_0x4afc('0x11'))['db'];function respondWithStatusCode(_0x5542ec,_0x5c523b){_0x5c523b=_0x5c523b||0xcc;return function(_0x7f127f){if(_0x7f127f){return _0x5542ec['sendStatus'](_0x5c523b);}return _0x5542ec[_0x4afc('0x12')](_0x5c523b)[_0x4afc('0x13')]();};}function respondWithResult(_0x49b56f,_0x38b322){_0x38b322=_0x38b322||0xc8;return function(_0x3fb54a){if(_0x3fb54a){return _0x49b56f[_0x4afc('0x12')](_0x38b322)[_0x4afc('0x14')](_0x3fb54a);}};}function respondWithFilteredResult(_0x1d8f98,_0x2f1c59){return function(_0x1ad8fd){if(_0x1ad8fd){var _0x23b03e=_0x1ad8fd[_0x4afc('0x15')],_0x5effb4=_0x2f1c59[_0x4afc('0x16')],_0x26f3f1=_0x2f1c59['offset']+_0x2f1c59['limit'],_0x429fd8;if(_0x26f3f1>=_0x23b03e){_0x26f3f1=_0x23b03e;_0x429fd8=0xc8;}else{_0x429fd8=0xce;}_0x1d8f98[_0x4afc('0x12')](_0x429fd8);return _0x1d8f98['set'](_0x4afc('0x17'),_0x5effb4+'-'+_0x26f3f1+'/'+_0x23b03e)[_0x4afc('0x14')](_0x1ad8fd);}return null;};}function patchUpdates(_0x2b928b){return function(_0x31eec4){try{jsonpatch[_0x4afc('0x18')](_0x31eec4,_0x2b928b,!![]);}catch(_0x3ebdc8){return BPromise[_0x4afc('0x19')](_0x3ebdc8);}return _0x31eec4[_0x4afc('0x1a')]();};}function saveUpdates(_0x16365f,_0x135349){return function(_0x178229){if(_0x178229){return _0x178229['update'](_0x16365f)[_0x4afc('0x1b')](function(_0x25603b){return _0x25603b;});}return null;};}function removeEntity(_0x32865e,_0x14558a){return function(_0x557a7e){if(_0x557a7e){return _0x557a7e[_0x4afc('0x1c')]()[_0x4afc('0x1b')](function(){_0x32865e[_0x4afc('0x12')](0xcc)[_0x4afc('0x13')]();});}};}function handleEntityNotFound(_0x1559b8,_0x3add4c){return function(_0x3ad7a5){if(!_0x3ad7a5){_0x1559b8['sendStatus'](0x194);}return _0x3ad7a5;};}function handleError(_0x5403e4,_0x3ecf2d){_0x3ecf2d=_0x3ecf2d||0x1f4;return function(_0x57f37c){logger[_0x4afc('0x1d')](_0x57f37c['stack']);if(_0x57f37c[_0x4afc('0x1e')]){delete _0x57f37c[_0x4afc('0x1e')];}_0x5403e4[_0x4afc('0x12')](_0x3ecf2d)[_0x4afc('0x1f')](_0x57f37c);};}exports[_0x4afc('0x20')]=function(_0x28a86c,_0x40a0db){var _0x383a71={},_0x2bb837={},_0x100220={'count':0x0,'rows':[]};var _0x4e8273=db[_0x4afc('0x21')][_0x4afc('0x22')];_0x2bb837['model']=_[_0x4afc('0x23')](_0x4e8273);var _0x244f6c={'dateStart':_0x28a86c[_0x4afc('0x24')]['dateStart'],'dateEnd':_0x28a86c['query']['dateEnd']};delete _0x28a86c[_0x4afc('0x24')][_0x4afc('0x25')];delete _0x28a86c['query'][_0x4afc('0x26')];_0x2bb837[_0x4afc('0x24')]=_['keys'](_0x28a86c['query']);_0x2bb837['filters']=_[_0x4afc('0x27')](_0x2bb837[_0x4afc('0x28')],_0x2bb837[_0x4afc('0x24')]);_0x383a71[_0x4afc('0x29')]=_[_0x4afc('0x27')](_0x2bb837[_0x4afc('0x28')],qs['fields'](_0x28a86c[_0x4afc('0x24')][_0x4afc('0x2a')]));_0x383a71[_0x4afc('0x29')]=_0x383a71[_0x4afc('0x29')][_0x4afc('0x2b')]?_0x383a71[_0x4afc('0x29')]:_0x2bb837[_0x4afc('0x28')];if(!_0x28a86c[_0x4afc('0x24')]['hasOwnProperty'](_0x4afc('0x2c'))){_0x383a71['limit']=qs['limit'](_0x28a86c[_0x4afc('0x24')][_0x4afc('0x2d')]);_0x383a71[_0x4afc('0x16')]=qs[_0x4afc('0x16')](_0x28a86c[_0x4afc('0x24')][_0x4afc('0x16')]);}_0x383a71['order']=qs[_0x4afc('0x2e')](_0x28a86c[_0x4afc('0x24')][_0x4afc('0x2e')]);_0x383a71[_0x4afc('0x2f')]=qs[_0x4afc('0x30')](_[_0x4afc('0x31')](_0x28a86c['query'],_0x2bb837[_0x4afc('0x30')]));if(_0x244f6c[_0x4afc('0x25')]){if(_0x244f6c[_0x4afc('0x26')]){_0x244f6c[_0x4afc('0x26')]=moment(_0x244f6c['dateEnd'])['add'](0x1,_0x4afc('0x32'));}else{_0x244f6c[_0x4afc('0x26')]=moment(_0x244f6c[_0x4afc('0x25')])['add'](0x1,'day');}_[_0x4afc('0x33')](_0x383a71['where'],{'createdAt':{'$gte':_0x244f6c['dateStart'],'$lte':_0x244f6c[_0x4afc('0x26')]}});}if(_0x28a86c[_0x4afc('0x24')][_0x4afc('0x34')]){_0x383a71[_0x4afc('0x2f')]=_[_0x4afc('0x33')](_0x383a71[_0x4afc('0x2f')],{'$or':_[_0x4afc('0x35')](_0x383a71[_0x4afc('0x29')],function(_0x3ccc5a){var _0x38f762={};_0x38f762[_0x3ccc5a]={'$like':'%'+_0x28a86c[_0x4afc('0x24')][_0x4afc('0x34')]+'%'};return _0x38f762;})});}_0x383a71=_[_0x4afc('0x33')]({},_0x383a71,_0x28a86c[_0x4afc('0x36')]);var _0x46dd2a={'where':_0x383a71['where']};return db[_0x4afc('0x21')][_0x4afc('0x15')](_0x46dd2a)[_0x4afc('0x1b')](function(_0xe6db12){_0x100220[_0x4afc('0x15')]=_0xe6db12;if(_0x28a86c[_0x4afc('0x24')][_0x4afc('0x37')]){_0x383a71['include']=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x383a71);})[_0x4afc('0x1b')](function(_0x105c03){_0x100220['rows']=_0x105c03;return _0x100220;})[_0x4afc('0x1b')](respondWithFilteredResult(_0x40a0db,_0x383a71))[_0x4afc('0x38')](handleError(_0x40a0db,null));};exports[_0x4afc('0x39')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x3a')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x28')]=_[_0x4afc('0x23')](db[_0x4afc('0x21')]['rawAttributes']);_0x45c9c3[_0x4afc('0x24')]=_['keys'](_0x397996[_0x4afc('0x24')]);_0x45c9c3[_0x4afc('0x30')]=_[_0x4afc('0x27')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x29')]=_[_0x4afc('0x27')](_0x45c9c3[_0x4afc('0x28')],qs[_0x4afc('0x2a')](_0x397996[_0x4afc('0x24')][_0x4afc('0x2a')]));_0x12b5db[_0x4afc('0x29')]=_0x12b5db[_0x4afc('0x29')]['length']?_0x12b5db[_0x4afc('0x29')]:_0x45c9c3[_0x4afc('0x28')];if(_0x397996['query'][_0x4afc('0x37')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x33')]({},_0x12b5db,_0x397996[_0x4afc('0x36')]);return db[_0x4afc('0x21')]['find'](_0x12b5db)[_0x4afc('0x1b')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x1b')](respondWithResult(_0x545109,null))[_0x4afc('0x38')](handleError(_0x545109,null));};exports[_0x4afc('0x3b')]=function(_0x4772db,_0x19a0ac){return db['AnalyticFieldReport']['create'](_0x4772db['body'],{})[_0x4afc('0x1b')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x38')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x3c')]=function(_0x269c24,_0xb5cca9){return db[_0x4afc('0x21')][_0x4afc('0x3c')](_0x269c24[_0x4afc('0x3d')],{'raw':![],'individualHooks':!![]})[_0x4afc('0x1b')](respondWithResult(_0xb5cca9,0xc9))[_0x4afc('0x38')](handleError(_0xb5cca9,null));};exports['update']=function(_0x40bb3b,_0x4d7e3f){if(_0x40bb3b['body']['id']){delete _0x40bb3b[_0x4afc('0x3d')]['id'];}return db['AnalyticFieldReport'][_0x4afc('0x3e')]({'where':{'id':_0x40bb3b[_0x4afc('0x3a')]['id']}})[_0x4afc('0x1b')](handleEntityNotFound(_0x4d7e3f,null))[_0x4afc('0x1b')](saveUpdates(_0x40bb3b['body'],null))[_0x4afc('0x1b')](respondWithResult(_0x4d7e3f,null))['catch'](handleError(_0x4d7e3f,null));};exports[_0x4afc('0x1c')]=function(_0x14afa7,_0x3625c9){return db[_0x4afc('0x21')][_0x4afc('0x3e')]({'where':{'id':_0x14afa7[_0x4afc('0x3a')]['id']}})[_0x4afc('0x1b')](handleEntityNotFound(_0x3625c9,null))[_0x4afc('0x1b')](removeEntity(_0x3625c9,null))[_0x4afc('0x38')](handleError(_0x3625c9,null));};exports[_0x4afc('0x3f')]=function(_0x322eb8,_0x3915d5){return db['AnalyticFieldReport'][_0x4afc('0x1c')]({'where':{'id':_0x322eb8[_0x4afc('0x24')][_0x4afc('0x40')]||[]},'raw':![],'individualHooks':!![]})[_0x4afc('0x1b')](respondWithResult(_0x3915d5,0xcc))[_0x4afc('0x38')](handleError(_0x3915d5,null));};exports[_0x4afc('0x41')]=function(_0x2fd538,_0x10c254,_0x369f01){return db[_0x4afc('0x42')][_0x4afc('0x43')]({'where':{'id':_0x2fd538[_0x4afc('0x3a')]['id']}})[_0x4afc('0x1b')](handleEntityNotFound(_0x10c254,null))['then'](function(_0x2abf25){if(_0x2abf25){return db['sequelize'][_0x4afc('0x44')](function(_0x2abc1b){return db[_0x4afc('0x21')][_0x4afc('0x1c')]({'where':{'CustomReportId':_0x2fd538['params']['id']},'transaction':_0x2abc1b})['then'](function(_0x240ea8){var _0x2f9790=_['map'](_0x2fd538[_0x4afc('0x3d')],function(_0x3af52c){delete _0x3af52c['id'];_0x3af52c[_0x4afc('0x45')]=_0x2fd538[_0x4afc('0x3a')]['id'];return _0x3af52c;});return db[_0x4afc('0x21')][_0x4afc('0x3c')](_0x2f9790,{'transaction':_0x2abc1b});});})[_0x4afc('0x1b')](function(){return db[_0x4afc('0x21')][_0x4afc('0x46')]({'where':{'CustomReportId':_0x2fd538[_0x4afc('0x3a')]['id']}});});}})[_0x4afc('0x1b')](respondWithResult(_0x10c254,null))[_0x4afc('0x38')](handleError(_0x10c254,null));}; \ No newline at end of file +var _0x5496=['ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','set','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','add','day','merge','where','filter','map','includeAll','rows','catch','show','params','include','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5496,0x175));var _0x6549=function(_0x17ad18,_0xa7ac00){_0x17ad18=_0x17ad18-0x0;var _0x2ce142=_0x5496[_0x17ad18];return _0x2ce142;};'use strict';var jsonpatch=require(_0x6549('0x0'));var rp=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var Mustache=require(_0x6549('0x4'));var util=require('util');var path=require(_0x6549('0x5'));var sox=require('sox');var csv=require(_0x6549('0x6'));var ejs=require(_0x6549('0x7'));var fs=require('fs');var _=require(_0x6549('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6549('0x9'));var deskjs=require(_0x6549('0xa'));var toCsv=require('to-csv');var querystring=require(_0x6549('0xb'));var Papa=require(_0x6549('0xc'));var qs=require(_0x6549('0xd'));var logger=require('../../config/logger')(_0x6549('0xe'));var utils=require(_0x6549('0xf'));var config=require(_0x6549('0x10'));var db=require(_0x6549('0x11'))['db'];function respondWithStatusCode(_0x1e5083,_0x3e08a6){_0x3e08a6=_0x3e08a6||0xcc;return function(_0x50fa35){if(_0x50fa35){return _0x1e5083['sendStatus'](_0x3e08a6);}return _0x1e5083[_0x6549('0x12')](_0x3e08a6)[_0x6549('0x13')]();};}function respondWithResult(_0x3c5f9b,_0x216620){_0x216620=_0x216620||0xc8;return function(_0x1a0f72){if(_0x1a0f72){return _0x3c5f9b['status'](_0x216620)['json'](_0x1a0f72);}};}function respondWithFilteredResult(_0x3f844f,_0x39d78c){return function(_0x57a149){if(_0x57a149){var _0x200ff1=_0x57a149[_0x6549('0x14')],_0x150fc8=_0x39d78c[_0x6549('0x15')],_0x195d25=_0x39d78c['offset']+_0x39d78c['limit'],_0x12b068;if(_0x195d25>=_0x200ff1){_0x195d25=_0x200ff1;_0x12b068=0xc8;}else{_0x12b068=0xce;}_0x3f844f[_0x6549('0x12')](_0x12b068);return _0x3f844f[_0x6549('0x16')]('Content-Range',_0x150fc8+'-'+_0x195d25+'/'+_0x200ff1)[_0x6549('0x17')](_0x57a149);}return null;};}function patchUpdates(_0x67acc0){return function(_0x4608fb){try{jsonpatch[_0x6549('0x18')](_0x4608fb,_0x67acc0,!![]);}catch(_0xffc8b9){return BPromise['reject'](_0xffc8b9);}return _0x4608fb['save']();};}function saveUpdates(_0x26a212,_0x48f037){return function(_0x56c15b){if(_0x56c15b){return _0x56c15b[_0x6549('0x19')](_0x26a212)[_0x6549('0x1a')](function(_0x19c4a6){return _0x19c4a6;});}return null;};}function removeEntity(_0xfca192,_0x236fd9){return function(_0x5ce3aa){if(_0x5ce3aa){return _0x5ce3aa[_0x6549('0x1b')]()['then'](function(){_0xfca192[_0x6549('0x12')](0xcc)[_0x6549('0x13')]();});}};}function handleEntityNotFound(_0x3992cf,_0x29c6b3){return function(_0x22bcf8){if(!_0x22bcf8){_0x3992cf[_0x6549('0x1c')](0x194);}return _0x22bcf8;};}function handleError(_0x427b47,_0x25bc01){_0x25bc01=_0x25bc01||0x1f4;return function(_0x2be467){logger[_0x6549('0x1d')](_0x2be467[_0x6549('0x1e')]);if(_0x2be467[_0x6549('0x1f')]){delete _0x2be467[_0x6549('0x1f')];}_0x427b47['status'](_0x25bc01)[_0x6549('0x20')](_0x2be467);};}exports[_0x6549('0x21')]=function(_0x53bbca,_0x126967){var _0x29f89e={},_0x3768cb={},_0x583c7d={'count':0x0,'rows':[]};var _0x31a95=db[_0x6549('0x22')][_0x6549('0x23')];_0x3768cb[_0x6549('0x24')]=_[_0x6549('0x25')](_0x31a95);var _0x3edf02={'dateStart':_0x53bbca[_0x6549('0x26')][_0x6549('0x27')],'dateEnd':_0x53bbca['query'][_0x6549('0x28')]};delete _0x53bbca[_0x6549('0x26')][_0x6549('0x27')];delete _0x53bbca['query'][_0x6549('0x28')];_0x3768cb['query']=_['keys'](_0x53bbca['query']);_0x3768cb[_0x6549('0x29')]=_[_0x6549('0x2a')](_0x3768cb['model'],_0x3768cb[_0x6549('0x26')]);_0x29f89e[_0x6549('0x2b')]=_[_0x6549('0x2a')](_0x3768cb[_0x6549('0x24')],qs[_0x6549('0x2c')](_0x53bbca[_0x6549('0x26')][_0x6549('0x2c')]));_0x29f89e['attributes']=_0x29f89e[_0x6549('0x2b')][_0x6549('0x2d')]?_0x29f89e[_0x6549('0x2b')]:_0x3768cb[_0x6549('0x24')];if(!_0x53bbca[_0x6549('0x26')][_0x6549('0x2e')]('nolimit')){_0x29f89e[_0x6549('0x2f')]=qs['limit'](_0x53bbca[_0x6549('0x26')]['limit']);_0x29f89e[_0x6549('0x15')]=qs[_0x6549('0x15')](_0x53bbca[_0x6549('0x26')]['offset']);}_0x29f89e[_0x6549('0x30')]=qs[_0x6549('0x31')](_0x53bbca[_0x6549('0x26')][_0x6549('0x31')]);_0x29f89e['where']=qs['filters'](_['pick'](_0x53bbca[_0x6549('0x26')],_0x3768cb[_0x6549('0x29')]));if(_0x3edf02['dateStart']){if(_0x3edf02[_0x6549('0x28')]){_0x3edf02[_0x6549('0x28')]=moment(_0x3edf02[_0x6549('0x28')])[_0x6549('0x32')](0x1,_0x6549('0x33'));}else{_0x3edf02['dateEnd']=moment(_0x3edf02['dateStart'])[_0x6549('0x32')](0x1,_0x6549('0x33'));}_[_0x6549('0x34')](_0x29f89e[_0x6549('0x35')],{'createdAt':{'$gte':_0x3edf02[_0x6549('0x27')],'$lte':_0x3edf02[_0x6549('0x28')]}});}if(_0x53bbca[_0x6549('0x26')][_0x6549('0x36')]){_0x29f89e[_0x6549('0x35')]=_[_0x6549('0x34')](_0x29f89e['where'],{'$or':_[_0x6549('0x37')](_0x29f89e[_0x6549('0x2b')],function(_0x2ea977){var _0x38f048={};_0x38f048[_0x2ea977]={'$like':'%'+_0x53bbca[_0x6549('0x26')]['filter']+'%'};return _0x38f048;})});}_0x29f89e=_['merge']({},_0x29f89e,_0x53bbca['options']);var _0x22b919={'where':_0x29f89e[_0x6549('0x35')]};return db[_0x6549('0x22')][_0x6549('0x14')](_0x22b919)['then'](function(_0x56ce9f){_0x583c7d[_0x6549('0x14')]=_0x56ce9f;if(_0x53bbca[_0x6549('0x26')][_0x6549('0x38')]){_0x29f89e['include']=[{'all':!![]}];}return db[_0x6549('0x22')]['findAll'](_0x29f89e);})[_0x6549('0x1a')](function(_0x2ec614){_0x583c7d[_0x6549('0x39')]=_0x2ec614;return _0x583c7d;})[_0x6549('0x1a')](respondWithFilteredResult(_0x126967,_0x29f89e))[_0x6549('0x3a')](handleError(_0x126967,null));};exports[_0x6549('0x3b')]=function(_0xbbfdc9,_0x4deaab){var _0x132625={'raw':![],'where':{'id':_0xbbfdc9[_0x6549('0x3c')]['id']}},_0x309f45={};_0x309f45[_0x6549('0x24')]=_[_0x6549('0x25')](db[_0x6549('0x22')][_0x6549('0x23')]);_0x309f45[_0x6549('0x26')]=_[_0x6549('0x25')](_0xbbfdc9[_0x6549('0x26')]);_0x309f45[_0x6549('0x29')]=_[_0x6549('0x2a')](_0x309f45[_0x6549('0x24')],_0x309f45[_0x6549('0x26')]);_0x132625[_0x6549('0x2b')]=_[_0x6549('0x2a')](_0x309f45['model'],qs[_0x6549('0x2c')](_0xbbfdc9[_0x6549('0x26')][_0x6549('0x2c')]));_0x132625[_0x6549('0x2b')]=_0x132625['attributes'][_0x6549('0x2d')]?_0x132625['attributes']:_0x309f45[_0x6549('0x24')];if(_0xbbfdc9[_0x6549('0x26')]['includeAll']){_0x132625[_0x6549('0x3d')]=[{'all':!![]}];}_0x132625=_[_0x6549('0x34')]({},_0x132625,_0xbbfdc9[_0x6549('0x3e')]);return db[_0x6549('0x22')][_0x6549('0x3f')](_0x132625)['then'](handleEntityNotFound(_0x4deaab,null))['then'](respondWithResult(_0x4deaab,null))[_0x6549('0x3a')](handleError(_0x4deaab,null));};exports[_0x6549('0x40')]=function(_0x41d675,_0x1712f3){return db[_0x6549('0x22')]['create'](_0x41d675[_0x6549('0x41')],{})[_0x6549('0x1a')](respondWithResult(_0x1712f3,0xc9))[_0x6549('0x3a')](handleError(_0x1712f3,null));};exports[_0x6549('0x42')]=function(_0xa4c650,_0x25a6ee){return db[_0x6549('0x22')][_0x6549('0x42')](_0xa4c650['body'],{'raw':![],'individualHooks':!![]})[_0x6549('0x1a')](respondWithResult(_0x25a6ee,0xc9))['catch'](handleError(_0x25a6ee,null));};exports[_0x6549('0x19')]=function(_0x1e09e1,_0x1da901){if(_0x1e09e1['body']['id']){delete _0x1e09e1[_0x6549('0x41')]['id'];}return db[_0x6549('0x22')][_0x6549('0x3f')]({'where':{'id':_0x1e09e1['params']['id']}})[_0x6549('0x1a')](handleEntityNotFound(_0x1da901,null))[_0x6549('0x1a')](saveUpdates(_0x1e09e1[_0x6549('0x41')],null))[_0x6549('0x1a')](respondWithResult(_0x1da901,null))[_0x6549('0x3a')](handleError(_0x1da901,null));};exports[_0x6549('0x1b')]=function(_0x489275,_0x28af00){return db['AnalyticFieldReport'][_0x6549('0x3f')]({'where':{'id':_0x489275[_0x6549('0x3c')]['id']}})[_0x6549('0x1a')](handleEntityNotFound(_0x28af00,null))[_0x6549('0x1a')](removeEntity(_0x28af00,null))[_0x6549('0x3a')](handleError(_0x28af00,null));};exports[_0x6549('0x43')]=function(_0x292b52,_0x2e59ad){return db[_0x6549('0x22')][_0x6549('0x1b')]({'where':{'id':_0x292b52[_0x6549('0x26')][_0x6549('0x44')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2e59ad,0xcc))[_0x6549('0x3a')](handleError(_0x2e59ad,null));};exports[_0x6549('0x45')]=function(_0x325c0a,_0x1eaa0f,_0x260097){return db[_0x6549('0x46')][_0x6549('0x47')]({'where':{'id':_0x325c0a[_0x6549('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1eaa0f,null))[_0x6549('0x1a')](function(_0x46e923){if(_0x46e923){return db[_0x6549('0x48')][_0x6549('0x49')](function(_0x2b0ba8){return db[_0x6549('0x22')][_0x6549('0x1b')]({'where':{'CustomReportId':_0x325c0a[_0x6549('0x3c')]['id']},'transaction':_0x2b0ba8})['then'](function(_0x201554){var _0x3b89d0=_[_0x6549('0x37')](_0x325c0a[_0x6549('0x41')],function(_0x46d2df){delete _0x46d2df['id'];_0x46d2df[_0x6549('0x4a')]=_0x325c0a['params']['id'];return _0x46d2df;});return db[_0x6549('0x22')][_0x6549('0x42')](_0x3b89d0,{'transaction':_0x2b0ba8});});})['then'](function(){return db[_0x6549('0x22')][_0x6549('0x4b')]({'where':{'CustomReportId':_0x325c0a[_0x6549('0x3c')]['id']}});});}})['then'](respondWithResult(_0x1eaa0f,null))[_0x6549('0x3a')](handleError(_0x1eaa0f,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 10be83a..92cfda6 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 _0x52f5=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','./analyticFieldReport.attributes'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x52f5,0x1dd));var _0x552f=function(_0x5246dc,_0x1c39a5){_0x5246dc=_0x5246dc-0x0;var _0x4aafcb=_0x52f5[_0x5246dc];return _0x4aafcb;};'use strict';var _=require(_0x552f('0x0'));var util=require(_0x552f('0x1'));var logger=require(_0x552f('0x2'))(_0x552f('0x3'));var moment=require('moment');var BPromise=require(_0x552f('0x4'));var rp=require(_0x552f('0x5'));var attributes=require(_0x552f('0x6'));module[_0x552f('0x7')]=function(_0x34860f,_0x1e4d8f){return _0x34860f[_0x552f('0x8')](_0x552f('0x9'),attributes,{'tableName':_0x552f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80c1=['util','../../config/logger','api','moment','bluebird','request-promise','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash'];(function(_0x2b10bc,_0x537612){var _0x192c1d=function(_0x497556){while(--_0x497556){_0x2b10bc['push'](_0x2b10bc['shift']());}};_0x192c1d(++_0x537612);}(_0x80c1,0xc5));var _0x180c=function(_0x44d116,_0x4932bc){_0x44d116=_0x44d116-0x0;var _0x142e09=_0x80c1[_0x44d116];return _0x142e09;};'use strict';var _=require(_0x180c('0x0'));var util=require(_0x180c('0x1'));var logger=require(_0x180c('0x2'))(_0x180c('0x3'));var moment=require(_0x180c('0x4'));var BPromise=require(_0x180c('0x5'));var rp=require(_0x180c('0x6'));var attributes=require(_0x180c('0x7'));module[_0x180c('0x8')]=function(_0x2d96f2,_0x590dd5){return _0x2d96f2['define'](_0x180c('0x9'),attributes,{'tableName':_0x180c('0xa'),'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 82586a0..aef7f74 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 _0x3b71=['request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x37786a,_0x1da087){var _0x2ad3b2=function(_0x1fe88f){while(--_0x1fe88f){_0x37786a['push'](_0x37786a['shift']());}};_0x2ad3b2(++_0x1da087);}(_0x3b71,0x187));var _0x13b7=function(_0x1d01a9,_0x328fe5){_0x1d01a9=_0x1d01a9-0x0;var _0x4680ba=_0x3b71[_0x1d01a9];return _0x4680ba;};'use strict';var _=require(_0x13b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x13b7('0x1'));var rs=require(_0x13b7('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x13b7('0x3'));var logger=require(_0x13b7('0x4'))('rpc');var config=require(_0x13b7('0x5'));var jayson=require(_0x13b7('0x6'));var client=jayson[_0x13b7('0x7')][_0x13b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc4bd57,_0x599725,_0x343c8d){return new BPromise(function(_0x5c973e,_0x105a6a){return client[_0x13b7('0x9')](_0xc4bd57,_0x343c8d)[_0x13b7('0xa')](function(_0xec296a){logger[_0x13b7('0xb')](_0x13b7('0xc'),_0x599725,_0x13b7('0xd'));logger[_0x13b7('0xe')](_0x13b7('0xf'),_0x599725,_0x13b7('0xd'),JSON['stringify'](_0xec296a));if(_0xec296a[_0x13b7('0x10')]){if(_0xec296a[_0x13b7('0x10')]['code']===0x1f4){logger['error'](_0x13b7('0xc'),_0x599725,_0xec296a[_0x13b7('0x10')]['message']);return _0x105a6a(_0xec296a[_0x13b7('0x10')][_0x13b7('0x11')]);}logger[_0x13b7('0x10')](_0x13b7('0xc'),_0x599725,_0xec296a[_0x13b7('0x10')]['message']);return _0x5c973e(_0xec296a[_0x13b7('0x10')][_0x13b7('0x11')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x599725,_0x13b7('0xd'));_0x5c973e(_0xec296a[_0x13b7('0x12')][_0x13b7('0x11')]);}})[_0x13b7('0x13')](function(_0x5c2dce){logger[_0x13b7('0x10')](_0x13b7('0xc'),_0x599725,_0x5c2dce);_0x105a6a(_0x5c2dce);});});} \ No newline at end of file +var _0x3729=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x383f96,_0x136f62){var _0x4aa968=function(_0x55ad14){while(--_0x55ad14){_0x383f96['push'](_0x383f96['shift']());}};_0x4aa968(++_0x136f62);}(_0x3729,0xf1));var _0x9372=function(_0x356116,_0x4d2c42){_0x356116=_0x356116-0x0;var _0x233a6c=_0x3729[_0x356116];return _0x233a6c;};'use strict';var _=require(_0x9372('0x0'));var util=require(_0x9372('0x1'));var moment=require(_0x9372('0x2'));var BPromise=require(_0x9372('0x3'));var rs=require(_0x9372('0x4'));var fs=require('fs');var db=require(_0x9372('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9372('0x6'));var config=require(_0x9372('0x7'));var jayson=require(_0x9372('0x8'));var client=jayson[_0x9372('0x9')][_0x9372('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x336c06,_0x4b2681,_0x1d5482){return new BPromise(function(_0x45400e,_0x4e36e9){return client['request'](_0x336c06,_0x1d5482)['then'](function(_0x273966){logger['info'](_0x9372('0xb'),_0x4b2681,_0x9372('0xc'));logger[_0x9372('0xd')](_0x9372('0xe'),_0x4b2681,_0x9372('0xc'),JSON[_0x9372('0xf')](_0x273966));if(_0x273966[_0x9372('0x10')]){if(_0x273966[_0x9372('0x10')]['code']===0x1f4){logger['error'](_0x9372('0xb'),_0x4b2681,_0x273966[_0x9372('0x10')][_0x9372('0x11')]);return _0x4e36e9(_0x273966['error'][_0x9372('0x11')]);}logger[_0x9372('0x10')](_0x9372('0xb'),_0x4b2681,_0x273966[_0x9372('0x10')]['message']);return _0x45400e(_0x273966[_0x9372('0x10')][_0x9372('0x11')]);}else{logger['info'](_0x9372('0xb'),_0x4b2681,_0x9372('0xc'));_0x45400e(_0x273966['result']['message']);}})['catch'](function(_0x26f051){logger[_0x9372('0x10')](_0x9372('0xb'),_0x4b2681,_0x26f051);_0x4e36e9(_0x26f051);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index d8d4082..1b9fc19 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 _0xba98=['express','Router','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','/:id','show','post','create','/create_many','bulkCreate','addFields','put','update','delete','/destroy_many','bulkDestroy','destroy','exports','util','path'];(function(_0x6cb5b8,_0x14cc50){var _0x445115=function(_0x200d97){while(--_0x200d97){_0x6cb5b8['push'](_0x6cb5b8['shift']());}};_0x445115(++_0x14cc50);}(_0xba98,0x19c));var _0x8ba9=function(_0xcfe91f,_0x129ce1){_0xcfe91f=_0xcfe91f-0x0;var _0x465270=_0xba98[_0xcfe91f];return _0x465270;};'use strict';var multer=require('multer');var util=require(_0x8ba9('0x0'));var path=require(_0x8ba9('0x1'));var express=require(_0x8ba9('0x2'));var router=express[_0x8ba9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8ba9('0x4'));var config=require(_0x8ba9('0x5'));var controller=require(_0x8ba9('0x6'));router[_0x8ba9('0x7')]('/',auth[_0x8ba9('0x8')](),controller['index']);router[_0x8ba9('0x7')](_0x8ba9('0x9'),auth['isAuthenticated'](),controller[_0x8ba9('0xa')]);router[_0x8ba9('0xb')]('/',auth[_0x8ba9('0x8')](),controller[_0x8ba9('0xc')]);router[_0x8ba9('0xb')](_0x8ba9('0xd'),auth['isAuthenticated'](),controller[_0x8ba9('0xe')]);router[_0x8ba9('0xb')]('/:id/create_many',auth[_0x8ba9('0x8')](),controller[_0x8ba9('0xf')]);router[_0x8ba9('0x10')](_0x8ba9('0x9'),auth['isAuthenticated'](),controller[_0x8ba9('0x11')]);router[_0x8ba9('0x12')](_0x8ba9('0x13'),auth['isAuthenticated'](),controller[_0x8ba9('0x14')]);router[_0x8ba9('0x12')](_0x8ba9('0x9'),auth[_0x8ba9('0x8')](),controller[_0x8ba9('0x15')]);module[_0x8ba9('0x16')]=router; \ No newline at end of file +var _0x6598=['bulkDestroy','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','show','post','isAuthenticated','create','/create_many','bulkCreate','/:id/create_many','addFields','put','update'];(function(_0x1d99d2,_0x25bbfd){var _0xeac936=function(_0x2a7ff1){while(--_0x2a7ff1){_0x1d99d2['push'](_0x1d99d2['shift']());}};_0xeac936(++_0x25bbfd);}(_0x6598,0x1b8));var _0x8659=function(_0xea3649,_0x557e6a){_0xea3649=_0xea3649-0x0;var _0x5e7d67=_0x6598[_0xea3649];return _0x5e7d67;};'use strict';var multer=require('multer');var util=require(_0x8659('0x0'));var path=require('path');var express=require(_0x8659('0x1'));var router=express[_0x8659('0x2')]();var auth=require(_0x8659('0x3'));var interaction=require(_0x8659('0x4'));var config=require(_0x8659('0x5'));var controller=require(_0x8659('0x6'));router[_0x8659('0x7')]('/',auth['isAuthenticated'](),controller[_0x8659('0x8')]);router[_0x8659('0x7')](_0x8659('0x9'),auth['isAuthenticated'](),controller[_0x8659('0xa')]);router[_0x8659('0xb')]('/',auth[_0x8659('0xc')](),controller[_0x8659('0xd')]);router[_0x8659('0xb')](_0x8659('0xe'),auth[_0x8659('0xc')](),controller[_0x8659('0xf')]);router[_0x8659('0xb')](_0x8659('0x10'),auth[_0x8659('0xc')](),controller[_0x8659('0x11')]);router[_0x8659('0x12')](_0x8659('0x9'),auth[_0x8659('0xc')](),controller[_0x8659('0x13')]);router['delete']('/destroy_many',auth[_0x8659('0xc')](),controller[_0x8659('0x14')]);router[_0x8659('0x15')]('/:id',auth[_0x8659('0xc')](),controller[_0x8659('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 26cabce..f1bb500 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 _0x7c1e=['STRING','name'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x7c1e,0x130));var _0xe7c1=function(_0xc8921f,_0x3fd36d){_0xc8921f=_0xc8921f-0x0;var _0x4e1489=_0x7c1e[_0xc8921f];return _0x4e1489;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe7c1('0x0')],'allowNull':![],'unique':_0xe7c1('0x1')},'table':{'type':Sequelize[_0xe7c1('0x0')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xe7c1('0x0')]}}; \ No newline at end of file +var _0x587e=['STRING','name','TEXT'];(function(_0xb78f74,_0x2548d1){var _0x465eb1=function(_0x590567){while(--_0x590567){_0xb78f74['push'](_0xb78f74['shift']());}};_0x465eb1(++_0x2548d1);}(_0x587e,0x114));var _0xe587=function(_0x302b74,_0x1916bb){_0x302b74=_0x302b74-0x0;var _0x53e970=_0x587e[_0x302b74];return _0x53e970;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe587('0x0')],'allowNull':![],'unique':_0xe587('0x1')},'table':{'type':Sequelize[_0xe587('0x0')]},'metric':{'type':Sequelize[_0xe587('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 96f5984..e3e90c7 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 _0xf594=['stack','name','send','index','AnalyticMetric','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','dateEnd','add','day','merge','where','filter','includeAll','include','rows','catch','show','params','create','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','count','offset','apply','reject','save','then','destroy','error'];(function(_0x37c137,_0x2ef48f){var _0x100009=function(_0x12cb47){while(--_0x12cb47){_0x37c137['push'](_0x37c137['shift']());}};_0x100009(++_0x2ef48f);}(_0xf594,0x65));var _0x4f59=function(_0x172694,_0x28bfff){_0x172694=_0x172694-0x0;var _0x5b7faa=_0xf594[_0x172694];return _0x5b7faa;};'use strict';var jsonpatch=require(_0x4f59('0x0'));var rp=require(_0x4f59('0x1'));var moment=require(_0x4f59('0x2'));var BPromise=require(_0x4f59('0x3'));var Mustache=require(_0x4f59('0x4'));var util=require(_0x4f59('0x5'));var path=require(_0x4f59('0x6'));var sox=require(_0x4f59('0x7'));var csv=require(_0x4f59('0x8'));var ejs=require(_0x4f59('0x9'));var fs=require('fs');var _=require(_0x4f59('0xa'));var squel=require(_0x4f59('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4f59('0xc'));var toCsv=require(_0x4f59('0x8'));var querystring=require(_0x4f59('0xd'));var Papa=require(_0x4f59('0xe'));var qs=require(_0x4f59('0xf'));var logger=require(_0x4f59('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x4f59('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f9139,_0x3bd19c){_0x3bd19c=_0x3bd19c||0xcc;return function(_0xd21c1e){if(_0xd21c1e){return _0x2f9139[_0x4f59('0x12')](_0x3bd19c);}return _0x2f9139[_0x4f59('0x13')](_0x3bd19c)[_0x4f59('0x14')]();};}function respondWithResult(_0x8643c7,_0x1dc552){_0x1dc552=_0x1dc552||0xc8;return function(_0x34ab90){if(_0x34ab90){return _0x8643c7['status'](_0x1dc552)['json'](_0x34ab90);}};}function respondWithFilteredResult(_0x5d9674,_0x51d563){return function(_0x110706){if(_0x110706){var _0x5737b1=_0x110706[_0x4f59('0x15')],_0x1b579b=_0x51d563[_0x4f59('0x16')],_0x27e714=_0x51d563[_0x4f59('0x16')]+_0x51d563['limit'],_0x2990a9;if(_0x27e714>=_0x5737b1){_0x27e714=_0x5737b1;_0x2990a9=0xc8;}else{_0x2990a9=0xce;}_0x5d9674[_0x4f59('0x13')](_0x2990a9);return _0x5d9674['set']('Content-Range',_0x1b579b+'-'+_0x27e714+'/'+_0x5737b1)['json'](_0x110706);}return null;};}function patchUpdates(_0x3b32c3){return function(_0x4429c7){try{jsonpatch[_0x4f59('0x17')](_0x4429c7,_0x3b32c3,!![]);}catch(_0x4c709f){return BPromise[_0x4f59('0x18')](_0x4c709f);}return _0x4429c7[_0x4f59('0x19')]();};}function saveUpdates(_0x22cc03,_0x324310){return function(_0x48a0c6){if(_0x48a0c6){return _0x48a0c6['update'](_0x22cc03)[_0x4f59('0x1a')](function(_0x443196){return _0x443196;});}return null;};}function removeEntity(_0x1ba1f5,_0x564901){return function(_0x22e40a){if(_0x22e40a){return _0x22e40a[_0x4f59('0x1b')]()['then'](function(){_0x1ba1f5[_0x4f59('0x13')](0xcc)[_0x4f59('0x14')]();});}};}function handleEntityNotFound(_0x2677dd,_0x58f1d3){return function(_0x3f94d4){if(!_0x3f94d4){_0x2677dd['sendStatus'](0x194);}return _0x3f94d4;};}function handleError(_0x59cd85,_0x4bcedf){_0x4bcedf=_0x4bcedf||0x1f4;return function(_0x579c3c){logger[_0x4f59('0x1c')](_0x579c3c[_0x4f59('0x1d')]);if(_0x579c3c[_0x4f59('0x1e')]){delete _0x579c3c['name'];}_0x59cd85['status'](_0x4bcedf)[_0x4f59('0x1f')](_0x579c3c);};}exports[_0x4f59('0x20')]=function(_0x56f19e,_0x45eefd){var _0x5dacdd={},_0x1e37d9={},_0x5a8250={'count':0x0,'rows':[]};var _0x233784=db[_0x4f59('0x21')][_0x4f59('0x22')];_0x1e37d9[_0x4f59('0x23')]=_[_0x4f59('0x24')](_0x233784);var _0x1206c={'dateStart':_0x56f19e[_0x4f59('0x25')][_0x4f59('0x26')],'dateEnd':_0x56f19e[_0x4f59('0x25')]['dateEnd']};delete _0x56f19e[_0x4f59('0x25')][_0x4f59('0x26')];delete _0x56f19e[_0x4f59('0x25')]['dateEnd'];_0x1e37d9[_0x4f59('0x25')]=_[_0x4f59('0x24')](_0x56f19e[_0x4f59('0x25')]);_0x1e37d9[_0x4f59('0x27')]=_[_0x4f59('0x28')](_0x1e37d9[_0x4f59('0x23')],_0x1e37d9[_0x4f59('0x25')]);_0x5dacdd[_0x4f59('0x29')]=_['intersection'](_0x1e37d9[_0x4f59('0x23')],qs[_0x4f59('0x2a')](_0x56f19e['query'][_0x4f59('0x2a')]));_0x5dacdd['attributes']=_0x5dacdd[_0x4f59('0x29')][_0x4f59('0x2b')]?_0x5dacdd[_0x4f59('0x29')]:_0x1e37d9[_0x4f59('0x23')];if(!_0x56f19e['query'][_0x4f59('0x2c')](_0x4f59('0x2d'))){_0x5dacdd[_0x4f59('0x2e')]=qs[_0x4f59('0x2e')](_0x56f19e['query']['limit']);_0x5dacdd[_0x4f59('0x16')]=qs[_0x4f59('0x16')](_0x56f19e['query'][_0x4f59('0x16')]);}_0x5dacdd[_0x4f59('0x2f')]=qs[_0x4f59('0x30')](_0x56f19e[_0x4f59('0x25')][_0x4f59('0x30')]);_0x5dacdd['where']=qs[_0x4f59('0x27')](_[_0x4f59('0x31')](_0x56f19e[_0x4f59('0x25')],_0x1e37d9['filters']));if(_0x1206c[_0x4f59('0x26')]){if(_0x1206c[_0x4f59('0x32')]){_0x1206c[_0x4f59('0x32')]=moment(_0x1206c[_0x4f59('0x32')])[_0x4f59('0x33')](0x1,_0x4f59('0x34'));}else{_0x1206c[_0x4f59('0x32')]=moment(_0x1206c[_0x4f59('0x26')])[_0x4f59('0x33')](0x1,_0x4f59('0x34'));}_['merge'](_0x5dacdd['where'],{'createdAt':{'$gte':_0x1206c[_0x4f59('0x26')],'$lte':_0x1206c['dateEnd']}});}if(_0x56f19e[_0x4f59('0x25')]['filter']){_0x5dacdd['where']=_[_0x4f59('0x35')](_0x5dacdd[_0x4f59('0x36')],{'$or':_['map'](_0x5dacdd[_0x4f59('0x29')],function(_0x56f135){var _0x519767={};_0x519767[_0x56f135]={'$like':'%'+_0x56f19e[_0x4f59('0x25')][_0x4f59('0x37')]+'%'};return _0x519767;})});}_0x5dacdd=_['merge']({},_0x5dacdd,_0x56f19e['options']);var _0x5296da={'where':_0x5dacdd['where']};return db[_0x4f59('0x21')][_0x4f59('0x15')](_0x5296da)[_0x4f59('0x1a')](function(_0x32a9fa){_0x5a8250[_0x4f59('0x15')]=_0x32a9fa;if(_0x56f19e['query'][_0x4f59('0x38')]){_0x5dacdd[_0x4f59('0x39')]=[{'all':!![]}];}return db[_0x4f59('0x21')]['findAll'](_0x5dacdd);})[_0x4f59('0x1a')](function(_0x3d02d8){_0x5a8250[_0x4f59('0x3a')]=_0x3d02d8;return _0x5a8250;})['then'](respondWithFilteredResult(_0x45eefd,_0x5dacdd))[_0x4f59('0x3b')](handleError(_0x45eefd,null));};exports[_0x4f59('0x3c')]=function(_0x5226a9,_0x5a2825){var _0x2a0e67={'raw':!![],'where':{'id':_0x5226a9[_0x4f59('0x3d')]['id']}},_0x1af82a={};_0x1af82a[_0x4f59('0x23')]=_[_0x4f59('0x24')](db[_0x4f59('0x21')][_0x4f59('0x22')]);_0x1af82a['query']=_[_0x4f59('0x24')](_0x5226a9['query']);_0x1af82a[_0x4f59('0x27')]=_[_0x4f59('0x28')](_0x1af82a[_0x4f59('0x23')],_0x1af82a[_0x4f59('0x25')]);_0x2a0e67[_0x4f59('0x29')]=_[_0x4f59('0x28')](_0x1af82a[_0x4f59('0x23')],qs['fields'](_0x5226a9[_0x4f59('0x25')]['fields']));_0x2a0e67['attributes']=_0x2a0e67[_0x4f59('0x29')][_0x4f59('0x2b')]?_0x2a0e67[_0x4f59('0x29')]:_0x1af82a[_0x4f59('0x23')];if(_0x5226a9[_0x4f59('0x25')][_0x4f59('0x38')]){_0x2a0e67[_0x4f59('0x39')]=[{'all':!![]}];}_0x2a0e67=_[_0x4f59('0x35')]({},_0x2a0e67,_0x5226a9['options']);return db[_0x4f59('0x21')]['find'](_0x2a0e67)[_0x4f59('0x1a')](handleEntityNotFound(_0x5a2825,null))['then'](respondWithResult(_0x5a2825,null))[_0x4f59('0x3b')](handleError(_0x5a2825,null));};exports[_0x4f59('0x3e')]=function(_0x3b091d,_0x426de2){return db['AnalyticMetric']['create'](_0x3b091d['body'],{})[_0x4f59('0x1a')](respondWithResult(_0x426de2,0xc9))[_0x4f59('0x3b')](handleError(_0x426de2,null));};exports['update']=function(_0x278eca,_0x20f82b){if(_0x278eca[_0x4f59('0x3f')]['id']){delete _0x278eca[_0x4f59('0x3f')]['id'];}return db[_0x4f59('0x21')][_0x4f59('0x40')]({'where':{'id':_0x278eca[_0x4f59('0x3d')]['id']}})[_0x4f59('0x1a')](handleEntityNotFound(_0x20f82b,null))[_0x4f59('0x1a')](saveUpdates(_0x278eca[_0x4f59('0x3f')],null))[_0x4f59('0x1a')](respondWithResult(_0x20f82b,null))['catch'](handleError(_0x20f82b,null));};exports['destroy']=function(_0x469a89,_0x1fe12c){return db['AnalyticMetric'][_0x4f59('0x40')]({'where':{'id':_0x469a89[_0x4f59('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1fe12c,null))[_0x4f59('0x1a')](removeEntity(_0x1fe12c,null))[_0x4f59('0x3b')](handleError(_0x1fe12c,null));}; \ No newline at end of file +var _0x5c82=['offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','day','add','filter','merge','map','options','includeAll','include','rows','show','params','find','create','body','catch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count'];(function(_0x99ba67,_0x10eae9){var _0x5c4f7d=function(_0x2962f6){while(--_0x2962f6){_0x99ba67['push'](_0x99ba67['shift']());}};_0x5c4f7d(++_0x10eae9);}(_0x5c82,0x18c));var _0x25c8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c82[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x25c8('0x0'));var moment=require(_0x25c8('0x1'));var BPromise=require(_0x25c8('0x2'));var Mustache=require('mustache');var util=require(_0x25c8('0x3'));var path=require(_0x25c8('0x4'));var sox=require(_0x25c8('0x5'));var csv=require(_0x25c8('0x6'));var ejs=require(_0x25c8('0x7'));var fs=require('fs');var _=require(_0x25c8('0x8'));var squel=require(_0x25c8('0x9'));var crypto=require(_0x25c8('0xa'));var jsforce=require(_0x25c8('0xb'));var deskjs=require(_0x25c8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x25c8('0xd'));var Papa=require(_0x25c8('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x25c8('0xf'))(_0x25c8('0x10'));var utils=require(_0x25c8('0x11'));var config=require(_0x25c8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f9bad,_0x219c09){_0x219c09=_0x219c09||0xcc;return function(_0x568500){if(_0x568500){return _0x3f9bad[_0x25c8('0x13')](_0x219c09);}return _0x3f9bad[_0x25c8('0x14')](_0x219c09)[_0x25c8('0x15')]();};}function respondWithResult(_0x36a545,_0x5a3b36){_0x5a3b36=_0x5a3b36||0xc8;return function(_0x538a83){if(_0x538a83){return _0x36a545[_0x25c8('0x14')](_0x5a3b36)[_0x25c8('0x16')](_0x538a83);}};}function respondWithFilteredResult(_0x248039,_0x332409){return function(_0x2c0171){if(_0x2c0171){var _0x168452=_0x2c0171[_0x25c8('0x17')],_0x32fd9a=_0x332409[_0x25c8('0x18')],_0x1d7442=_0x332409[_0x25c8('0x18')]+_0x332409['limit'],_0x19823a;if(_0x1d7442>=_0x168452){_0x1d7442=_0x168452;_0x19823a=0xc8;}else{_0x19823a=0xce;}_0x248039[_0x25c8('0x14')](_0x19823a);return _0x248039[_0x25c8('0x19')](_0x25c8('0x1a'),_0x32fd9a+'-'+_0x1d7442+'/'+_0x168452)['json'](_0x2c0171);}return null;};}function patchUpdates(_0x3ed486){return function(_0x26ed00){try{jsonpatch['apply'](_0x26ed00,_0x3ed486,!![]);}catch(_0x1a543e){return BPromise[_0x25c8('0x1b')](_0x1a543e);}return _0x26ed00[_0x25c8('0x1c')]();};}function saveUpdates(_0x152050,_0x161022){return function(_0x28a93e){if(_0x28a93e){return _0x28a93e[_0x25c8('0x1d')](_0x152050)[_0x25c8('0x1e')](function(_0x1617c7){return _0x1617c7;});}return null;};}function removeEntity(_0x453831,_0x25e31c){return function(_0x7ed8e7){if(_0x7ed8e7){return _0x7ed8e7[_0x25c8('0x1f')]()['then'](function(){_0x453831[_0x25c8('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27dd3a,_0x161a67){return function(_0x4c9502){if(!_0x4c9502){_0x27dd3a[_0x25c8('0x13')](0x194);}return _0x4c9502;};}function handleError(_0x399d49,_0x42357d){_0x42357d=_0x42357d||0x1f4;return function(_0x1801cb){logger[_0x25c8('0x20')](_0x1801cb[_0x25c8('0x21')]);if(_0x1801cb[_0x25c8('0x22')]){delete _0x1801cb[_0x25c8('0x22')];}_0x399d49[_0x25c8('0x14')](_0x42357d)[_0x25c8('0x23')](_0x1801cb);};}exports[_0x25c8('0x24')]=function(_0x37c2ef,_0x4d94b1){var _0x3a1478={},_0x362a9f={},_0x12fd97={'count':0x0,'rows':[]};var _0x1b7c7f=db[_0x25c8('0x25')][_0x25c8('0x26')];_0x362a9f[_0x25c8('0x27')]=_[_0x25c8('0x28')](_0x1b7c7f);var _0x1803c0={'dateStart':_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2a')],'dateEnd':_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2b')]};delete _0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2a')];delete _0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2b')];_0x362a9f['query']=_[_0x25c8('0x28')](_0x37c2ef[_0x25c8('0x29')]);_0x362a9f[_0x25c8('0x2c')]=_['intersection'](_0x362a9f[_0x25c8('0x27')],_0x362a9f[_0x25c8('0x29')]);_0x3a1478[_0x25c8('0x2d')]=_[_0x25c8('0x2e')](_0x362a9f[_0x25c8('0x27')],qs[_0x25c8('0x2f')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x2f')]));_0x3a1478[_0x25c8('0x2d')]=_0x3a1478[_0x25c8('0x2d')][_0x25c8('0x30')]?_0x3a1478[_0x25c8('0x2d')]:_0x362a9f[_0x25c8('0x27')];if(!_0x37c2ef['query'][_0x25c8('0x31')](_0x25c8('0x32'))){_0x3a1478[_0x25c8('0x33')]=qs[_0x25c8('0x33')](_0x37c2ef[_0x25c8('0x29')]['limit']);_0x3a1478[_0x25c8('0x18')]=qs[_0x25c8('0x18')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x18')]);}_0x3a1478['order']=qs[_0x25c8('0x34')](_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x34')]);_0x3a1478[_0x25c8('0x35')]=qs[_0x25c8('0x2c')](_[_0x25c8('0x36')](_0x37c2ef[_0x25c8('0x29')],_0x362a9f[_0x25c8('0x2c')]));if(_0x1803c0[_0x25c8('0x2a')]){if(_0x1803c0[_0x25c8('0x2b')]){_0x1803c0[_0x25c8('0x2b')]=moment(_0x1803c0[_0x25c8('0x2b')])['add'](0x1,_0x25c8('0x37'));}else{_0x1803c0[_0x25c8('0x2b')]=moment(_0x1803c0[_0x25c8('0x2a')])[_0x25c8('0x38')](0x1,'day');}_['merge'](_0x3a1478['where'],{'createdAt':{'$gte':_0x1803c0[_0x25c8('0x2a')],'$lte':_0x1803c0[_0x25c8('0x2b')]}});}if(_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x39')]){_0x3a1478['where']=_[_0x25c8('0x3a')](_0x3a1478[_0x25c8('0x35')],{'$or':_[_0x25c8('0x3b')](_0x3a1478[_0x25c8('0x2d')],function(_0x553ffd){var _0x184ed1={};_0x184ed1[_0x553ffd]={'$like':'%'+_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x39')]+'%'};return _0x184ed1;})});}_0x3a1478=_['merge']({},_0x3a1478,_0x37c2ef[_0x25c8('0x3c')]);var _0x54ffb9={'where':_0x3a1478[_0x25c8('0x35')]};return db[_0x25c8('0x25')][_0x25c8('0x17')](_0x54ffb9)['then'](function(_0x509c55){_0x12fd97[_0x25c8('0x17')]=_0x509c55;if(_0x37c2ef[_0x25c8('0x29')][_0x25c8('0x3d')]){_0x3a1478[_0x25c8('0x3e')]=[{'all':!![]}];}return db[_0x25c8('0x25')]['findAll'](_0x3a1478);})[_0x25c8('0x1e')](function(_0x40951a){_0x12fd97[_0x25c8('0x3f')]=_0x40951a;return _0x12fd97;})[_0x25c8('0x1e')](respondWithFilteredResult(_0x4d94b1,_0x3a1478))['catch'](handleError(_0x4d94b1,null));};exports[_0x25c8('0x40')]=function(_0x239cdd,_0x2c84a7){var _0x16fdc3={'raw':!![],'where':{'id':_0x239cdd[_0x25c8('0x41')]['id']}},_0x124d19={};_0x124d19['model']=_[_0x25c8('0x28')](db[_0x25c8('0x25')]['rawAttributes']);_0x124d19[_0x25c8('0x29')]=_[_0x25c8('0x28')](_0x239cdd[_0x25c8('0x29')]);_0x124d19[_0x25c8('0x2c')]=_[_0x25c8('0x2e')](_0x124d19['model'],_0x124d19['query']);_0x16fdc3[_0x25c8('0x2d')]=_[_0x25c8('0x2e')](_0x124d19[_0x25c8('0x27')],qs['fields'](_0x239cdd[_0x25c8('0x29')][_0x25c8('0x2f')]));_0x16fdc3[_0x25c8('0x2d')]=_0x16fdc3[_0x25c8('0x2d')][_0x25c8('0x30')]?_0x16fdc3[_0x25c8('0x2d')]:_0x124d19[_0x25c8('0x27')];if(_0x239cdd[_0x25c8('0x29')][_0x25c8('0x3d')]){_0x16fdc3['include']=[{'all':!![]}];}_0x16fdc3=_['merge']({},_0x16fdc3,_0x239cdd[_0x25c8('0x3c')]);return db[_0x25c8('0x25')][_0x25c8('0x42')](_0x16fdc3)[_0x25c8('0x1e')](handleEntityNotFound(_0x2c84a7,null))[_0x25c8('0x1e')](respondWithResult(_0x2c84a7,null))['catch'](handleError(_0x2c84a7,null));};exports[_0x25c8('0x43')]=function(_0x3515c7,_0x242530){return db[_0x25c8('0x25')][_0x25c8('0x43')](_0x3515c7[_0x25c8('0x44')],{})[_0x25c8('0x1e')](respondWithResult(_0x242530,0xc9))[_0x25c8('0x45')](handleError(_0x242530,null));};exports[_0x25c8('0x1d')]=function(_0x2be3b,_0x58def4){if(_0x2be3b[_0x25c8('0x44')]['id']){delete _0x2be3b[_0x25c8('0x44')]['id'];}return db[_0x25c8('0x25')]['find']({'where':{'id':_0x2be3b['params']['id']}})[_0x25c8('0x1e')](handleEntityNotFound(_0x58def4,null))[_0x25c8('0x1e')](saveUpdates(_0x2be3b['body'],null))['then'](respondWithResult(_0x58def4,null))[_0x25c8('0x45')](handleError(_0x58def4,null));};exports[_0x25c8('0x1f')]=function(_0x2c35b2,_0x2ef12c){return db[_0x25c8('0x25')][_0x25c8('0x42')]({'where':{'id':_0x2c35b2['params']['id']}})['then'](handleEntityNotFound(_0x2ef12c,null))[_0x25c8('0x1e')](removeEntity(_0x2ef12c,null))[_0x25c8('0x45')](handleError(_0x2ef12c,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 7e14105..72cb98a 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 _0x7c63=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','api','moment'];(function(_0x208128,_0x9e2557){var _0x213a02=function(_0x29fc57){while(--_0x29fc57){_0x208128['push'](_0x208128['shift']());}};_0x213a02(++_0x9e2557);}(_0x7c63,0x115));var _0x37c6=function(_0x195ef9,_0x3f3ff5){_0x195ef9=_0x195ef9-0x0;var _0x51548f=_0x7c63[_0x195ef9];return _0x51548f;};'use strict';var _=require(_0x37c6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x37c6('0x1'));var moment=require(_0x37c6('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x37c6('0x3'));module[_0x37c6('0x4')]=function(_0x3f95e5,_0x4bc401){return _0x3f95e5[_0x37c6('0x5')](_0x37c6('0x6'),attributes,{'tableName':_0x37c6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82b2=['AnalyticMetric','analytics_metrics','lodash','util','api','moment','bluebird','define'];(function(_0x4a01a3,_0xa47ef6){var _0xd20294=function(_0x3aab1e){while(--_0x3aab1e){_0x4a01a3['push'](_0x4a01a3['shift']());}};_0xd20294(++_0xa47ef6);}(_0x82b2,0xb2));var _0x282b=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x82b2[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x282b('0x0'));var util=require(_0x282b('0x1'));var logger=require('../../config/logger')(_0x282b('0x2'));var moment=require(_0x282b('0x3'));var BPromise=require(_0x282b('0x4'));var rp=require('request-promise');var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x331116,_0x53d524){return _0x331116[_0x282b('0x5')](_0x282b('0x6'),attributes,{'tableName':_0x282b('0x7'),'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 3b864df..3b254a2 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 _0xa9e0=['error','message','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s'];(function(_0x2f6d16,_0x516c0c){var _0xf706a=function(_0x43dd25){while(--_0x43dd25){_0x2f6d16['push'](_0x2f6d16['shift']());}};_0xf706a(++_0x516c0c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219af0,_0x441e3a,_0x2cc193){return new BPromise(function(_0x5f41ea,_0x503809){return client[_0x0a9e('0x9')](_0x219af0,_0x2cc193)['then'](function(_0x52cace){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x441e3a,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x441e3a,_0x0a9e('0xc'),JSON['stringify'](_0x52cace));if(_0x52cace['error']){if(_0x52cace['error']['code']===0x1f4){logger[_0x0a9e('0xf')](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x503809(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}logger['error'](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x5f41ea(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}else{logger[_0x0a9e('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x441e3a,_0x0a9e('0xc'));_0x5f41ea(_0x52cace['result'][_0x0a9e('0x10')]);}})['catch'](function(_0x16033c){logger[_0x0a9e('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x441e3a,_0x16033c);_0x503809(_0x16033c);});});} \ No newline at end of file +var _0x9957=['AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('AnalyticMetric,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index d2159e8..5d1b416 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 _0xc590=['create','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','/:id','show','post'];(function(_0x3ff685,_0x304b9e){var _0x2046c9=function(_0x7a10e9){while(--_0x7a10e9){_0x3ff685['push'](_0x3ff685['shift']());}};_0x2046c9(++_0x304b9e);}(_0xc590,0x159));var _0x0c59=function(_0x5290c4,_0x340950){_0x5290c4=_0x5290c4-0x0;var _0x275727=_0xc590[_0x5290c4];return _0x275727;};'use strict';var multer=require(_0x0c59('0x0'));var util=require(_0x0c59('0x1'));var path=require(_0x0c59('0x2'));var express=require(_0x0c59('0x3'));var router=express[_0x0c59('0x4')]();var auth=require(_0x0c59('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0c59('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x0c59('0x7')](),controller['index']);router[_0x0c59('0x8')](_0x0c59('0x9'),auth[_0x0c59('0x7')](),controller[_0x0c59('0xa')]);router[_0x0c59('0xb')]('/',auth[_0x0c59('0x7')](),controller[_0x0c59('0xc')]);router[_0x0c59('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x0c59('0xe')]);router[_0x0c59('0xf')](_0x0c59('0x9'),auth[_0x0c59('0x7')](),controller[_0x0c59('0x10')]);module['exports']=router; \ No newline at end of file +var _0x1619=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','post','put','/:id','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x2f2cb8,_0x417d38){var _0x5a7add=function(_0xc1da1d){while(--_0xc1da1d){_0x2f2cb8['push'](_0x2f2cb8['shift']());}};_0x5a7add(++_0x417d38);}(_0x1619,0x193));var _0x9161=function(_0x523a34,_0x4f0364){_0x523a34=_0x523a34-0x0;var _0x35d8ff=_0x1619[_0x523a34];return _0x35d8ff;};'use strict';var multer=require(_0x9161('0x0'));var util=require(_0x9161('0x1'));var path=require(_0x9161('0x2'));var express=require(_0x9161('0x3'));var router=express[_0x9161('0x4')]();var auth=require(_0x9161('0x5'));var interaction=require(_0x9161('0x6'));var config=require(_0x9161('0x7'));var controller=require(_0x9161('0x8'));router[_0x9161('0x9')]('/',auth[_0x9161('0xa')](),controller['index']);router[_0x9161('0x9')]('/:id',auth[_0x9161('0xa')](),controller['show']);router[_0x9161('0xb')]('/',auth[_0x9161('0xa')](),controller['create']);router[_0x9161('0xc')](_0x9161('0xd'),auth[_0x9161('0xa')](),controller['update']);router[_0x9161('0xe')](_0x9161('0xd'),auth['isAuthenticated'](),controller[_0x9161('0xf')]);module[_0x9161('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 71dc3e9..bb4a09d 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 _0xcc4e=['sequelize'];(function(_0x12fe89,_0x4bef78){var _0xf35724=function(_0x5b4b8a){while(--_0x5b4b8a){_0x12fe89['push'](_0x12fe89['shift']());}};_0xf35724(++_0x4bef78);}(_0xcc4e,0x1c6));var _0xecc4=function(_0x3f6160,_0x3b703d){_0x3f6160=_0x3f6160-0x0;var _0x90a915=_0xcc4e[_0x3f6160];return _0x90a915;};'use strict';var Sequelize=require(_0xecc4('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x2b5f=['TEXT','exports'];(function(_0x3f1a4d,_0x4c4c7d){var _0x5e401a=function(_0x245dfd){while(--_0x245dfd){_0x3f1a4d['push'](_0x3f1a4d['shift']());}};_0x5e401a(++_0x4c4c7d);}(_0x2b5f,0xd5));var _0xf2b5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x2b5f[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0xf2b5('0x0')]={'tree':{'type':Sequelize[_0xf2b5('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 020785a..93d1834 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 _0x490e=['find','create','body','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','model','keys','dateEnd','dateStart','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','add','day','where','merge','map','options','count','includeAll','include','rows','catch','show','params'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x490e,0x83));var _0xe490=function(_0x50a45f,_0x428399){_0x50a45f=_0x50a45f-0x0;var _0x5279ef=_0x490e[_0x50a45f];return _0x5279ef;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xe490('0x0'));var moment=require(_0xe490('0x1'));var BPromise=require(_0xe490('0x2'));var Mustache=require(_0xe490('0x3'));var util=require(_0xe490('0x4'));var path=require(_0xe490('0x5'));var sox=require(_0xe490('0x6'));var csv=require(_0xe490('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe490('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe490('0x9'));var deskjs=require(_0xe490('0xa'));var toCsv=require(_0xe490('0x7'));var querystring=require(_0xe490('0xb'));var Papa=require(_0xe490('0xc'));var qs=require(_0xe490('0xd'));var logger=require('../../config/logger')(_0xe490('0xe'));var utils=require(_0xe490('0xf'));var config=require(_0xe490('0x10'));var db=require(_0xe490('0x11'))['db'];function respondWithStatusCode(_0x100a49,_0x1aacea){_0x1aacea=_0x1aacea||0xcc;return function(_0x2f6768){if(_0x2f6768){return _0x100a49[_0xe490('0x12')](_0x1aacea);}return _0x100a49[_0xe490('0x13')](_0x1aacea)[_0xe490('0x14')]();};}function respondWithResult(_0x5266b0,_0x1cc267){_0x1cc267=_0x1cc267||0xc8;return function(_0x208e14){if(_0x208e14){return _0x5266b0[_0xe490('0x13')](_0x1cc267)[_0xe490('0x15')](_0x208e14);}};}function respondWithFilteredResult(_0x2f5aa3,_0x51cae8){return function(_0x43dadf){if(_0x43dadf){var _0x10b684=_0x43dadf['count'],_0x358fca=_0x51cae8[_0xe490('0x16')],_0x542753=_0x51cae8[_0xe490('0x16')]+_0x51cae8[_0xe490('0x17')],_0x11e7eb;if(_0x542753>=_0x10b684){_0x542753=_0x10b684;_0x11e7eb=0xc8;}else{_0x11e7eb=0xce;}_0x2f5aa3[_0xe490('0x13')](_0x11e7eb);return _0x2f5aa3[_0xe490('0x18')](_0xe490('0x19'),_0x358fca+'-'+_0x542753+'/'+_0x10b684)[_0xe490('0x15')](_0x43dadf);}return null;};}function patchUpdates(_0x116d0c){return function(_0x3cb1c6){try{jsonpatch[_0xe490('0x1a')](_0x3cb1c6,_0x116d0c,!![]);}catch(_0x93c86f){return BPromise['reject'](_0x93c86f);}return _0x3cb1c6['save']();};}function saveUpdates(_0x1ff984,_0x2d3623){return function(_0xf131cc){if(_0xf131cc){return _0xf131cc['update'](_0x1ff984)[_0xe490('0x1b')](function(_0x3bcb65){return _0x3bcb65;});}return null;};}function removeEntity(_0x79c842,_0x110ddc){return function(_0x3f1c21){if(_0x3f1c21){return _0x3f1c21[_0xe490('0x1c')]()[_0xe490('0x1b')](function(){_0x79c842[_0xe490('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x393997,_0x9305fe){return function(_0x2e080e){if(!_0x2e080e){_0x393997[_0xe490('0x12')](0x194);}return _0x2e080e;};}function handleError(_0x35944f,_0x58c58c){_0x58c58c=_0x58c58c||0x1f4;return function(_0x257f23){logger[_0xe490('0x1d')](_0x257f23[_0xe490('0x1e')]);if(_0x257f23[_0xe490('0x1f')]){delete _0x257f23['name'];}_0x35944f['status'](_0x58c58c)[_0xe490('0x20')](_0x257f23);};}exports[_0xe490('0x21')]=function(_0x5a63c7,_0x23a319){var _0x3ae623={},_0x3e20d3={},_0x1f4699={'count':0x0,'rows':[]};var _0x7deac=db[_0xe490('0x22')][_0xe490('0x23')];_0x3e20d3[_0xe490('0x24')]=_[_0xe490('0x25')](_0x7deac);var _0x59df61={'dateStart':_0x5a63c7['query']['dateStart'],'dateEnd':_0x5a63c7['query'][_0xe490('0x26')]};delete _0x5a63c7['query'][_0xe490('0x27')];delete _0x5a63c7[_0xe490('0x28')][_0xe490('0x26')];_0x3e20d3[_0xe490('0x28')]=_[_0xe490('0x25')](_0x5a63c7[_0xe490('0x28')]);_0x3e20d3[_0xe490('0x29')]=_[_0xe490('0x2a')](_0x3e20d3[_0xe490('0x24')],_0x3e20d3[_0xe490('0x28')]);_0x3ae623[_0xe490('0x2b')]=_[_0xe490('0x2a')](_0x3e20d3[_0xe490('0x24')],qs[_0xe490('0x2c')](_0x5a63c7[_0xe490('0x28')][_0xe490('0x2c')]));_0x3ae623[_0xe490('0x2b')]=_0x3ae623[_0xe490('0x2b')][_0xe490('0x2d')]?_0x3ae623[_0xe490('0x2b')]:_0x3e20d3[_0xe490('0x24')];if(!_0x5a63c7[_0xe490('0x28')][_0xe490('0x2e')]('nolimit')){_0x3ae623[_0xe490('0x17')]=qs[_0xe490('0x17')](_0x5a63c7[_0xe490('0x28')]['limit']);_0x3ae623['offset']=qs[_0xe490('0x16')](_0x5a63c7[_0xe490('0x28')][_0xe490('0x16')]);}_0x3ae623['order']=qs['sort'](_0x5a63c7[_0xe490('0x28')][_0xe490('0x2f')]);_0x3ae623['where']=qs[_0xe490('0x29')](_['pick'](_0x5a63c7[_0xe490('0x28')],_0x3e20d3['filters']));if(_0x59df61['dateStart']){if(_0x59df61[_0xe490('0x26')]){_0x59df61['dateEnd']=moment(_0x59df61['dateEnd'])[_0xe490('0x30')](0x1,_0xe490('0x31'));}else{_0x59df61['dateEnd']=moment(_0x59df61[_0xe490('0x27')])[_0xe490('0x30')](0x1,'day');}_['merge'](_0x3ae623[_0xe490('0x32')],{'createdAt':{'$gte':_0x59df61[_0xe490('0x27')],'$lte':_0x59df61[_0xe490('0x26')]}});}if(_0x5a63c7['query']['filter']){_0x3ae623['where']=_[_0xe490('0x33')](_0x3ae623[_0xe490('0x32')],{'$or':_[_0xe490('0x34')](_0x3ae623[_0xe490('0x2b')],function(_0x148315){var _0x2d45bc={};_0x2d45bc[_0x148315]={'$like':'%'+_0x5a63c7['query']['filter']+'%'};return _0x2d45bc;})});}_0x3ae623=_[_0xe490('0x33')]({},_0x3ae623,_0x5a63c7[_0xe490('0x35')]);var _0x3ce4c3={'where':_0x3ae623[_0xe490('0x32')]};return db['AnalyticTreeReport'][_0xe490('0x36')](_0x3ce4c3)['then'](function(_0x567001){_0x1f4699[_0xe490('0x36')]=_0x567001;if(_0x5a63c7[_0xe490('0x28')][_0xe490('0x37')]){_0x3ae623[_0xe490('0x38')]=[{'all':!![]}];}return db[_0xe490('0x22')]['findAll'](_0x3ae623);})['then'](function(_0xf68be0){_0x1f4699[_0xe490('0x39')]=_0xf68be0;return _0x1f4699;})['then'](respondWithFilteredResult(_0x23a319,_0x3ae623))[_0xe490('0x3a')](handleError(_0x23a319,null));};exports[_0xe490('0x3b')]=function(_0x2bf01b,_0x5cd9c4){var _0xc0263d={'raw':!![],'where':{'id':_0x2bf01b[_0xe490('0x3c')]['id']}},_0xbf9594={};_0xbf9594[_0xe490('0x24')]=_[_0xe490('0x25')](db['AnalyticTreeReport'][_0xe490('0x23')]);_0xbf9594[_0xe490('0x28')]=_[_0xe490('0x25')](_0x2bf01b[_0xe490('0x28')]);_0xbf9594[_0xe490('0x29')]=_[_0xe490('0x2a')](_0xbf9594[_0xe490('0x24')],_0xbf9594[_0xe490('0x28')]);_0xc0263d[_0xe490('0x2b')]=_[_0xe490('0x2a')](_0xbf9594['model'],qs[_0xe490('0x2c')](_0x2bf01b[_0xe490('0x28')][_0xe490('0x2c')]));_0xc0263d[_0xe490('0x2b')]=_0xc0263d[_0xe490('0x2b')]['length']?_0xc0263d['attributes']:_0xbf9594[_0xe490('0x24')];if(_0x2bf01b[_0xe490('0x28')]['includeAll']){_0xc0263d[_0xe490('0x38')]=[{'all':!![]}];}_0xc0263d=_[_0xe490('0x33')]({},_0xc0263d,_0x2bf01b[_0xe490('0x35')]);return db[_0xe490('0x22')][_0xe490('0x3d')](_0xc0263d)[_0xe490('0x1b')](handleEntityNotFound(_0x5cd9c4,null))['then'](respondWithResult(_0x5cd9c4,null))[_0xe490('0x3a')](handleError(_0x5cd9c4,null));};exports[_0xe490('0x3e')]=function(_0x2d620d,_0x4a7c9c){return db[_0xe490('0x22')]['create'](_0x2d620d[_0xe490('0x3f')],{})['then'](respondWithResult(_0x4a7c9c,0xc9))[_0xe490('0x3a')](handleError(_0x4a7c9c,null));};exports['update']=function(_0x4ffb1c,_0x67ff68){if(_0x4ffb1c[_0xe490('0x3f')]['id']){delete _0x4ffb1c[_0xe490('0x3f')]['id'];}return db[_0xe490('0x22')][_0xe490('0x3d')]({'where':{'id':_0x4ffb1c[_0xe490('0x3c')]['id']}})[_0xe490('0x1b')](handleEntityNotFound(_0x67ff68,null))['then'](saveUpdates(_0x4ffb1c[_0xe490('0x3f')],null))[_0xe490('0x1b')](respondWithResult(_0x67ff68,null))[_0xe490('0x3a')](handleError(_0x67ff68,null));};exports[_0xe490('0x1c')]=function(_0x4b753e,_0x548700){return db[_0xe490('0x22')][_0xe490('0x3d')]({'where':{'id':_0x4b753e[_0xe490('0x3c')]['id']}})[_0xe490('0x1b')](handleEntityNotFound(_0x548700,null))[_0xe490('0x1b')](removeEntity(_0x548700,null))[_0xe490('0x3a')](handleError(_0x548700,null));}; \ No newline at end of file +var _0x3976=['desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','apply','save','update','then','error','name','send','index','AnalyticTreeReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','day','add','filter','map','merge','options','includeAll','rows','catch','show','params','include','find','create','body','destroy','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x3976,0x149));var _0x6397=function(_0x391a1e,_0x10742f){_0x391a1e=_0x391a1e-0x0;var _0x4b4a0f=_0x3976[_0x391a1e];return _0x4b4a0f;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x6397('0x0'));var moment=require(_0x6397('0x1'));var BPromise=require(_0x6397('0x2'));var Mustache=require(_0x6397('0x3'));var util=require(_0x6397('0x4'));var path=require('path');var sox=require(_0x6397('0x5'));var csv=require(_0x6397('0x6'));var ejs=require(_0x6397('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6397('0x8'));var crypto=require(_0x6397('0x9'));var jsforce=require(_0x6397('0xa'));var deskjs=require(_0x6397('0xb'));var toCsv=require(_0x6397('0x6'));var querystring=require(_0x6397('0xc'));var Papa=require(_0x6397('0xd'));var qs=require(_0x6397('0xe'));var logger=require(_0x6397('0xf'))('api');var utils=require(_0x6397('0x10'));var config=require(_0x6397('0x11'));var db=require(_0x6397('0x12'))['db'];function respondWithStatusCode(_0xbe3e05,_0x4479dc){_0x4479dc=_0x4479dc||0xcc;return function(_0x527191){if(_0x527191){return _0xbe3e05[_0x6397('0x13')](_0x4479dc);}return _0xbe3e05['status'](_0x4479dc)[_0x6397('0x14')]();};}function respondWithResult(_0x4968a5,_0x5802b2){_0x5802b2=_0x5802b2||0xc8;return function(_0x51a3e8){if(_0x51a3e8){return _0x4968a5[_0x6397('0x15')](_0x5802b2)[_0x6397('0x16')](_0x51a3e8);}};}function respondWithFilteredResult(_0x34e02c,_0x34bc96){return function(_0x21239b){if(_0x21239b){var _0x9839da=_0x21239b[_0x6397('0x17')],_0x458261=_0x34bc96[_0x6397('0x18')],_0x55f5ab=_0x34bc96[_0x6397('0x18')]+_0x34bc96[_0x6397('0x19')],_0x3076d1;if(_0x55f5ab>=_0x9839da){_0x55f5ab=_0x9839da;_0x3076d1=0xc8;}else{_0x3076d1=0xce;}_0x34e02c['status'](_0x3076d1);return _0x34e02c[_0x6397('0x1a')]('Content-Range',_0x458261+'-'+_0x55f5ab+'/'+_0x9839da)[_0x6397('0x16')](_0x21239b);}return null;};}function patchUpdates(_0xdacf78){return function(_0xeeba6e){try{jsonpatch[_0x6397('0x1b')](_0xeeba6e,_0xdacf78,!![]);}catch(_0x1a7f5f){return BPromise['reject'](_0x1a7f5f);}return _0xeeba6e[_0x6397('0x1c')]();};}function saveUpdates(_0x572897,_0x3c4061){return function(_0x54d83d){if(_0x54d83d){return _0x54d83d[_0x6397('0x1d')](_0x572897)['then'](function(_0xeab00b){return _0xeab00b;});}return null;};}function removeEntity(_0x4d7589,_0x37d2cd){return function(_0x37fce1){if(_0x37fce1){return _0x37fce1['destroy']()[_0x6397('0x1e')](function(){_0x4d7589[_0x6397('0x15')](0xcc)[_0x6397('0x14')]();});}};}function handleEntityNotFound(_0x57d374,_0x1c2c52){return function(_0xeec45d){if(!_0xeec45d){_0x57d374[_0x6397('0x13')](0x194);}return _0xeec45d;};}function handleError(_0x3a38d5,_0x5b5cd9){_0x5b5cd9=_0x5b5cd9||0x1f4;return function(_0x2cb7d7){logger[_0x6397('0x1f')](_0x2cb7d7['stack']);if(_0x2cb7d7[_0x6397('0x20')]){delete _0x2cb7d7['name'];}_0x3a38d5['status'](_0x5b5cd9)[_0x6397('0x21')](_0x2cb7d7);};}exports[_0x6397('0x22')]=function(_0x33b2d3,_0x349193){var _0x2ab273={},_0x254583={},_0x241a4a={'count':0x0,'rows':[]};var _0x5c38b9=db[_0x6397('0x23')][_0x6397('0x24')];_0x254583[_0x6397('0x25')]=_[_0x6397('0x26')](_0x5c38b9);var _0x2b6d3a={'dateStart':_0x33b2d3[_0x6397('0x27')][_0x6397('0x28')],'dateEnd':_0x33b2d3[_0x6397('0x27')][_0x6397('0x29')]};delete _0x33b2d3[_0x6397('0x27')][_0x6397('0x28')];delete _0x33b2d3[_0x6397('0x27')][_0x6397('0x29')];_0x254583[_0x6397('0x27')]=_[_0x6397('0x26')](_0x33b2d3[_0x6397('0x27')]);_0x254583[_0x6397('0x2a')]=_[_0x6397('0x2b')](_0x254583[_0x6397('0x25')],_0x254583[_0x6397('0x27')]);_0x2ab273[_0x6397('0x2c')]=_[_0x6397('0x2b')](_0x254583[_0x6397('0x25')],qs[_0x6397('0x2d')](_0x33b2d3[_0x6397('0x27')]['fields']));_0x2ab273[_0x6397('0x2c')]=_0x2ab273[_0x6397('0x2c')][_0x6397('0x2e')]?_0x2ab273[_0x6397('0x2c')]:_0x254583['model'];if(!_0x33b2d3[_0x6397('0x27')][_0x6397('0x2f')](_0x6397('0x30'))){_0x2ab273[_0x6397('0x19')]=qs[_0x6397('0x19')](_0x33b2d3['query'][_0x6397('0x19')]);_0x2ab273[_0x6397('0x18')]=qs[_0x6397('0x18')](_0x33b2d3['query'][_0x6397('0x18')]);}_0x2ab273[_0x6397('0x31')]=qs['sort'](_0x33b2d3[_0x6397('0x27')][_0x6397('0x32')]);_0x2ab273[_0x6397('0x33')]=qs[_0x6397('0x2a')](_['pick'](_0x33b2d3[_0x6397('0x27')],_0x254583[_0x6397('0x2a')]));if(_0x2b6d3a[_0x6397('0x28')]){if(_0x2b6d3a[_0x6397('0x29')]){_0x2b6d3a[_0x6397('0x29')]=moment(_0x2b6d3a[_0x6397('0x29')])['add'](0x1,_0x6397('0x34'));}else{_0x2b6d3a[_0x6397('0x29')]=moment(_0x2b6d3a[_0x6397('0x28')])[_0x6397('0x35')](0x1,_0x6397('0x34'));}_['merge'](_0x2ab273[_0x6397('0x33')],{'createdAt':{'$gte':_0x2b6d3a[_0x6397('0x28')],'$lte':_0x2b6d3a[_0x6397('0x29')]}});}if(_0x33b2d3[_0x6397('0x27')][_0x6397('0x36')]){_0x2ab273[_0x6397('0x33')]=_['merge'](_0x2ab273[_0x6397('0x33')],{'$or':_[_0x6397('0x37')](_0x2ab273[_0x6397('0x2c')],function(_0x2ff26a){var _0x4d7db0={};_0x4d7db0[_0x2ff26a]={'$like':'%'+_0x33b2d3[_0x6397('0x27')]['filter']+'%'};return _0x4d7db0;})});}_0x2ab273=_[_0x6397('0x38')]({},_0x2ab273,_0x33b2d3[_0x6397('0x39')]);var _0x242c82={'where':_0x2ab273[_0x6397('0x33')]};return db[_0x6397('0x23')]['count'](_0x242c82)['then'](function(_0x36b5cf){_0x241a4a[_0x6397('0x17')]=_0x36b5cf;if(_0x33b2d3[_0x6397('0x27')][_0x6397('0x3a')]){_0x2ab273['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2ab273);})[_0x6397('0x1e')](function(_0x21393e){_0x241a4a[_0x6397('0x3b')]=_0x21393e;return _0x241a4a;})[_0x6397('0x1e')](respondWithFilteredResult(_0x349193,_0x2ab273))[_0x6397('0x3c')](handleError(_0x349193,null));};exports[_0x6397('0x3d')]=function(_0x309c9d,_0x4978fc){var _0x1deff3={'raw':!![],'where':{'id':_0x309c9d[_0x6397('0x3e')]['id']}},_0x4c8c76={};_0x4c8c76[_0x6397('0x25')]=_[_0x6397('0x26')](db[_0x6397('0x23')][_0x6397('0x24')]);_0x4c8c76[_0x6397('0x27')]=_[_0x6397('0x26')](_0x309c9d['query']);_0x4c8c76[_0x6397('0x2a')]=_[_0x6397('0x2b')](_0x4c8c76[_0x6397('0x25')],_0x4c8c76[_0x6397('0x27')]);_0x1deff3[_0x6397('0x2c')]=_[_0x6397('0x2b')](_0x4c8c76[_0x6397('0x25')],qs['fields'](_0x309c9d[_0x6397('0x27')][_0x6397('0x2d')]));_0x1deff3[_0x6397('0x2c')]=_0x1deff3[_0x6397('0x2c')]['length']?_0x1deff3['attributes']:_0x4c8c76[_0x6397('0x25')];if(_0x309c9d[_0x6397('0x27')][_0x6397('0x3a')]){_0x1deff3[_0x6397('0x3f')]=[{'all':!![]}];}_0x1deff3=_[_0x6397('0x38')]({},_0x1deff3,_0x309c9d[_0x6397('0x39')]);return db[_0x6397('0x23')][_0x6397('0x40')](_0x1deff3)['then'](handleEntityNotFound(_0x4978fc,null))[_0x6397('0x1e')](respondWithResult(_0x4978fc,null))['catch'](handleError(_0x4978fc,null));};exports[_0x6397('0x41')]=function(_0x1946fc,_0x3ad9b7){return db[_0x6397('0x23')]['create'](_0x1946fc[_0x6397('0x42')],{})[_0x6397('0x1e')](respondWithResult(_0x3ad9b7,0xc9))[_0x6397('0x3c')](handleError(_0x3ad9b7,null));};exports['update']=function(_0x3dfc3d,_0x196c00){if(_0x3dfc3d[_0x6397('0x42')]['id']){delete _0x3dfc3d[_0x6397('0x42')]['id'];}return db['AnalyticTreeReport'][_0x6397('0x40')]({'where':{'id':_0x3dfc3d[_0x6397('0x3e')]['id']}})[_0x6397('0x1e')](handleEntityNotFound(_0x196c00,null))[_0x6397('0x1e')](saveUpdates(_0x3dfc3d[_0x6397('0x42')],null))[_0x6397('0x1e')](respondWithResult(_0x196c00,null))['catch'](handleError(_0x196c00,null));};exports[_0x6397('0x43')]=function(_0x481f9c,_0x36064b){return db['AnalyticTreeReport']['find']({'where':{'id':_0x481f9c[_0x6397('0x3e')]['id']}})[_0x6397('0x1e')](handleEntityNotFound(_0x36064b,null))[_0x6397('0x1e')](removeEntity(_0x36064b,null))[_0x6397('0x3c')](handleError(_0x36064b,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 379f713..24cbda4 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 _0x3a88=['moment','bluebird','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x36d910,_0x2e8f99){var _0x4bba9e=function(_0x4255a7){while(--_0x4255a7){_0x36d910['push'](_0x36d910['shift']());}};_0x4bba9e(++_0x2e8f99);}(_0x3a88,0x152));var _0x83a8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3a88[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x83a8('0x0'));var util=require(_0x83a8('0x1'));var logger=require(_0x83a8('0x2'))(_0x83a8('0x3'));var moment=require(_0x83a8('0x4'));var BPromise=require(_0x83a8('0x5'));var rp=require('request-promise');var attributes=require('./analyticTreeReport.attributes');module[_0x83a8('0x6')]=function(_0x549154,_0x222069){return _0x549154['define'](_0x83a8('0x7'),attributes,{'tableName':_0x83a8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94b9=['lodash','api','moment','bluebird','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x28f355,_0x1a3d25){var _0x4d6ec3=function(_0x2a0bb1){while(--_0x2a0bb1){_0x28f355['push'](_0x28f355['shift']());}};_0x4d6ec3(++_0x1a3d25);}(_0x94b9,0x75));var _0x994b=function(_0x15556a,_0x3dc205){_0x15556a=_0x15556a-0x0;var _0x2cc566=_0x94b9[_0x15556a];return _0x2cc566;};'use strict';var _=require(_0x994b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x994b('0x1'));var moment=require(_0x994b('0x2'));var BPromise=require(_0x994b('0x3'));var rp=require('request-promise');var attributes=require(_0x994b('0x4'));module[_0x994b('0x5')]=function(_0x4f6f83,_0x22de0b){return _0x4f6f83[_0x994b('0x6')](_0x994b('0x7'),attributes,{'tableName':_0x994b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 0254b1a..24a8fa1 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 _0x32dc=['rpc','jayson/promise','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x24a82,_0x836580){var _0x37095d=function(_0x5bb2fc){while(--_0x5bb2fc){_0x24a82['push'](_0x24a82['shift']());}};_0x37095d(++_0x836580);}(_0x32dc,0xeb));var _0xc32d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x32dc[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xc32d('0x0'));var util=require(_0xc32d('0x1'));var moment=require(_0xc32d('0x2'));var BPromise=require(_0xc32d('0x3'));var rs=require(_0xc32d('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc32d('0x5'));var logger=require(_0xc32d('0x6'))(_0xc32d('0x7'));var config=require('../../config/environment');var jayson=require(_0xc32d('0x8'));var client=jayson['client'][_0xc32d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40e4c5,_0x2f136a,_0x3a874b){return new BPromise(function(_0x86a023,_0x4be723){return client[_0xc32d('0xa')](_0x40e4c5,_0x3a874b)[_0xc32d('0xb')](function(_0x226e2f){logger[_0xc32d('0xc')](_0xc32d('0xd'),_0x2f136a,_0xc32d('0xe'));logger[_0xc32d('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x2f136a,_0xc32d('0xe'),JSON[_0xc32d('0x10')](_0x226e2f));if(_0x226e2f['error']){if(_0x226e2f[_0xc32d('0x11')][_0xc32d('0x12')]===0x1f4){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x2f136a,_0x226e2f[_0xc32d('0x11')][_0xc32d('0x13')]);return _0x4be723(_0x226e2f[_0xc32d('0x11')][_0xc32d('0x13')]);}logger[_0xc32d('0x11')](_0xc32d('0xd'),_0x2f136a,_0x226e2f['error'][_0xc32d('0x13')]);return _0x86a023(_0x226e2f[_0xc32d('0x11')]['message']);}else{logger[_0xc32d('0xc')](_0xc32d('0xd'),_0x2f136a,_0xc32d('0xe'));_0x86a023(_0x226e2f[_0xc32d('0x14')]['message']);}})[_0xc32d('0x15')](function(_0x1be74b){logger[_0xc32d('0x11')](_0xc32d('0xd'),_0x2f136a,_0x1be74b);_0x4be723(_0x1be74b);});});} \ No newline at end of file +var _0xc8b5=['../../config/environment','http','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x18b7de,_0x174f89){var _0x20d1be=function(_0x3712ce){while(--_0x3712ce){_0x18b7de['push'](_0x18b7de['shift']());}};_0x20d1be(++_0x174f89);}(_0xc8b5,0x161));var _0x5c8b=function(_0x2897f9,_0x4c4be3){_0x2897f9=_0x2897f9-0x0;var _0x4f4da5=_0xc8b5[_0x2897f9];return _0x4f4da5;};'use strict';var _=require(_0x5c8b('0x0'));var util=require(_0x5c8b('0x1'));var moment=require(_0x5c8b('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c8b('0x3'));var fs=require('fs');var db=require(_0x5c8b('0x4'))['db'];var utils=require(_0x5c8b('0x5'));var logger=require('../../config/logger')(_0x5c8b('0x6'));var config=require(_0x5c8b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5c8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6ac4c5,_0x2c9571,_0x659fa8){return new BPromise(function(_0x3fd10b,_0xf59d11){return client['request'](_0x6ac4c5,_0x659fa8)['then'](function(_0x2c090e){logger[_0x5c8b('0x9')](_0x5c8b('0xa'),_0x2c9571,_0x5c8b('0xb'));logger[_0x5c8b('0xc')](_0x5c8b('0xd'),_0x2c9571,_0x5c8b('0xb'),JSON[_0x5c8b('0xe')](_0x2c090e));if(_0x2c090e[_0x5c8b('0xf')]){if(_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x10')]===0x1f4){logger['error'](_0x5c8b('0xa'),_0x2c9571,_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x11')]);return _0xf59d11(_0x2c090e[_0x5c8b('0xf')][_0x5c8b('0x11')]);}logger[_0x5c8b('0xf')](_0x5c8b('0xa'),_0x2c9571,_0x2c090e[_0x5c8b('0xf')]['message']);return _0x3fd10b(_0x2c090e[_0x5c8b('0xf')]['message']);}else{logger[_0x5c8b('0x9')](_0x5c8b('0xa'),_0x2c9571,_0x5c8b('0xb'));_0x3fd10b(_0x2c090e[_0x5c8b('0x12')][_0x5c8b('0x11')]);}})[_0x5c8b('0x13')](function(_0x4abd52){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x2c9571,_0x4abd52);_0xf59d11(_0x4abd52);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 6657093..5764bf1 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 _0x974b=['show','post','create','update','delete','/:id','multer','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index'];(function(_0x2d3bf9,_0x316601){var _0x150076=function(_0x54fa9f){while(--_0x54fa9f){_0x2d3bf9['push'](_0x2d3bf9['shift']());}};_0x150076(++_0x316601);}(_0x974b,0xab));var _0xb974=function(_0x32f91b,_0x460016){_0x32f91b=_0x32f91b-0x0;var _0x3ee8f3=_0x974b[_0x32f91b];return _0x3ee8f3;};'use strict';var multer=require(_0xb974('0x0'));var util=require('util');var path=require('path');var express=require(_0xb974('0x1'));var router=express[_0xb974('0x2')]();var auth=require(_0xb974('0x3'));var interaction=require(_0xb974('0x4'));var config=require('../../config/environment');var controller=require(_0xb974('0x5'));router[_0xb974('0x6')]('/',auth[_0xb974('0x7')](),controller[_0xb974('0x8')]);router[_0xb974('0x6')]('/:id',auth[_0xb974('0x7')](),controller[_0xb974('0x9')]);router[_0xb974('0xa')]('/',auth[_0xb974('0x7')](),controller[_0xb974('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb974('0xc')]);router[_0xb974('0xd')](_0xb974('0xe'),auth[_0xb974('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd76b=['get','show','post','create','/:id','update','delete','destroy','exports','multer','path','Router','./analyticTreeReport.controller','isAuthenticated','index'];(function(_0x389ed9,_0xbd0522){var _0x491550=function(_0x215f1b){while(--_0x215f1b){_0x389ed9['push'](_0x389ed9['shift']());}};_0x491550(++_0xbd0522);}(_0xd76b,0xdb));var _0xbd76=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd76b[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xbd76('0x0'));var util=require('util');var path=require(_0xbd76('0x1'));var express=require('express');var router=express[_0xbd76('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbd76('0x3'));router['get']('/',auth[_0xbd76('0x4')](),controller[_0xbd76('0x5')]);router[_0xbd76('0x6')]('/:id',auth[_0xbd76('0x4')](),controller[_0xbd76('0x7')]);router[_0xbd76('0x8')]('/',auth[_0xbd76('0x4')](),controller[_0xbd76('0x9')]);router['put'](_0xbd76('0xa'),auth['isAuthenticated'](),controller[_0xbd76('0xb')]);router[_0xbd76('0xc')](_0xbd76('0xa'),auth[_0xbd76('0x4')](),controller[_0xbd76('0xd')]);module[_0xbd76('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index afafbad..b98d00d 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 _0xe974=['exports','STRING','sequelize'];(function(_0x21dd21,_0x26264a){var _0x26b682=function(_0x4dc4e2){while(--_0x4dc4e2){_0x21dd21['push'](_0x21dd21['shift']());}};_0x26b682(++_0x26264a);}(_0xe974,0xe3));var _0x4e97=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xe974[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x4e97('0x0'));module[_0x4e97('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x4e97('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x60f7=['STRING','exports'];(function(_0xd2a568,_0x4e8606){var _0x4cf0ba=function(_0x1f9dfc){while(--_0x1f9dfc){_0xd2a568['push'](_0xd2a568['shift']());}};_0x4cf0ba(++_0x4e8606);}(_0x60f7,0xcf));var _0x760f=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x60f7[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0x760f('0x0')]={'name':{'type':Sequelize[_0x760f('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 124f13e..c8c42f1 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 _0x9611=['attributes','length','hasOwnProperty','order','pick','add','day','merge','filter','where','map','options','then','includeAll','include','findAll','catch','params','find','update','body','create','originalname','basename','file','type','download','findOne','join','root','server/files/attachments/','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','end','json','count','offset','limit','status','set','apply','reject','save','destroy','error','stack','name','index','Attachment','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields'];(function(_0x2de5ea,_0x2d7851){var _0x17638a=function(_0x164ad4){while(--_0x164ad4){_0x2de5ea['push'](_0x2de5ea['shift']());}};_0x17638a(++_0x2d7851);}(_0x9611,0x67));var _0x1961=function(_0x533959,_0x2c507d){_0x533959=_0x533959-0x0;var _0x58485f=_0x9611[_0x533959];return _0x58485f;};'use strict';var jsonpatch=require(_0x1961('0x0'));var rp=require('request-promise');var moment=require(_0x1961('0x1'));var BPromise=require(_0x1961('0x2'));var Mustache=require(_0x1961('0x3'));var util=require('util');var path=require(_0x1961('0x4'));var sox=require(_0x1961('0x5'));var csv=require(_0x1961('0x6'));var ejs=require(_0x1961('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1961('0x8'));var crypto=require('crypto');var jsforce=require(_0x1961('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1961('0x6'));var querystring=require('querystring');var Papa=require(_0x1961('0xa'));var qs=require(_0x1961('0xb'));var logger=require(_0x1961('0xc'))(_0x1961('0xd'));var utils=require(_0x1961('0xe'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x246061,_0x177d12){_0x177d12=_0x177d12||0xcc;return function(_0x18397f){if(_0x18397f){return _0x246061[_0x1961('0xf')](_0x177d12);}return _0x246061['status'](_0x177d12)[_0x1961('0x10')]();};}function respondWithResult(_0x38f1af,_0xd7fa5e){_0xd7fa5e=_0xd7fa5e||0xc8;return function(_0xcd9b3b){if(_0xcd9b3b){return _0x38f1af['status'](_0xd7fa5e)[_0x1961('0x11')](_0xcd9b3b);}};}function respondWithFilteredResult(_0x406487,_0x3e7a79){return function(_0x330b8c){if(_0x330b8c){var _0x2d1516=_0x330b8c[_0x1961('0x12')],_0xd9bc03=_0x3e7a79['offset'],_0x3599d1=_0x3e7a79[_0x1961('0x13')]+_0x3e7a79[_0x1961('0x14')],_0x48cfd2;if(_0x3599d1>=_0x2d1516){_0x3599d1=_0x2d1516;_0x48cfd2=0xc8;}else{_0x48cfd2=0xce;}_0x406487[_0x1961('0x15')](_0x48cfd2);return _0x406487[_0x1961('0x16')]('Content-Range',_0xd9bc03+'-'+_0x3599d1+'/'+_0x2d1516)['json'](_0x330b8c);}return null;};}function patchUpdates(_0xa0981c){return function(_0x5f05ab){try{jsonpatch[_0x1961('0x17')](_0x5f05ab,_0xa0981c,!![]);}catch(_0x2e9f04){return BPromise[_0x1961('0x18')](_0x2e9f04);}return _0x5f05ab[_0x1961('0x19')]();};}function saveUpdates(_0x2ec040,_0x3ae664){return function(_0x3bb5f2){if(_0x3bb5f2){return _0x3bb5f2['update'](_0x2ec040)['then'](function(_0x15f430){return _0x15f430;});}return null;};}function removeEntity(_0x468075,_0x4289b1){return function(_0xdb9c33){if(_0xdb9c33){return _0xdb9c33[_0x1961('0x1a')]()['then'](function(){_0x468075[_0x1961('0x15')](0xcc)[_0x1961('0x10')]();});}};}function handleEntityNotFound(_0x323972,_0x18a898){return function(_0x179d2e){if(!_0x179d2e){_0x323972[_0x1961('0xf')](0x194);}return _0x179d2e;};}function handleError(_0x5e2a61,_0x32602b){_0x32602b=_0x32602b||0x1f4;return function(_0x234863){logger[_0x1961('0x1b')](_0x234863[_0x1961('0x1c')]);if(_0x234863[_0x1961('0x1d')]){delete _0x234863[_0x1961('0x1d')];}_0x5e2a61['status'](_0x32602b)['send'](_0x234863);};}exports[_0x1961('0x1e')]=function(_0x463fba,_0xa72b70){var _0x4ea709={},_0x36c2f6={},_0x5e3402={'count':0x0,'rows':[]};var _0xcd7a7e=db[_0x1961('0x1f')][_0x1961('0x20')];_0x36c2f6['model']=_[_0x1961('0x21')](_0xcd7a7e);var _0x23bf10={'dateStart':_0x463fba[_0x1961('0x22')][_0x1961('0x23')],'dateEnd':_0x463fba[_0x1961('0x22')]['dateEnd']};delete _0x463fba[_0x1961('0x22')][_0x1961('0x23')];delete _0x463fba[_0x1961('0x22')][_0x1961('0x24')];_0x36c2f6['query']=_[_0x1961('0x21')](_0x463fba[_0x1961('0x22')]);_0x36c2f6[_0x1961('0x25')]=_[_0x1961('0x26')](_0x36c2f6[_0x1961('0x27')],_0x36c2f6['query']);_0x4ea709['attributes']=_[_0x1961('0x26')](_0x36c2f6[_0x1961('0x27')],qs['fields'](_0x463fba[_0x1961('0x22')][_0x1961('0x28')]));_0x4ea709[_0x1961('0x29')]=_0x4ea709[_0x1961('0x29')][_0x1961('0x2a')]?_0x4ea709['attributes']:_0x36c2f6[_0x1961('0x27')];if(!_0x463fba['query'][_0x1961('0x2b')]('nolimit')){_0x4ea709['limit']=qs[_0x1961('0x14')](_0x463fba[_0x1961('0x22')]['limit']);_0x4ea709[_0x1961('0x13')]=qs['offset'](_0x463fba[_0x1961('0x22')]['offset']);}_0x4ea709[_0x1961('0x2c')]=qs['sort'](_0x463fba[_0x1961('0x22')]['sort']);_0x4ea709['where']=qs[_0x1961('0x25')](_[_0x1961('0x2d')](_0x463fba[_0x1961('0x22')],_0x36c2f6['filters']));if(_0x23bf10[_0x1961('0x23')]){if(_0x23bf10[_0x1961('0x24')]){_0x23bf10[_0x1961('0x24')]=moment(_0x23bf10[_0x1961('0x24')])[_0x1961('0x2e')](0x1,_0x1961('0x2f'));}else{_0x23bf10['dateEnd']=moment(_0x23bf10[_0x1961('0x23')])[_0x1961('0x2e')](0x1,_0x1961('0x2f'));}_[_0x1961('0x30')](_0x4ea709['where'],{'createdAt':{'$gte':_0x23bf10[_0x1961('0x23')],'$lte':_0x23bf10['dateEnd']}});}if(_0x463fba[_0x1961('0x22')][_0x1961('0x31')]){_0x4ea709[_0x1961('0x32')]=_[_0x1961('0x30')](_0x4ea709[_0x1961('0x32')],{'$or':_[_0x1961('0x33')](_0x4ea709[_0x1961('0x29')],function(_0x2207f7){var _0x279b65={};_0x279b65[_0x2207f7]={'$like':'%'+_0x463fba['query'][_0x1961('0x31')]+'%'};return _0x279b65;})});}_0x4ea709=_['merge']({},_0x4ea709,_0x463fba[_0x1961('0x34')]);var _0x346037={'where':_0x4ea709['where']};return db[_0x1961('0x1f')][_0x1961('0x12')](_0x346037)[_0x1961('0x35')](function(_0x4dc010){_0x5e3402[_0x1961('0x12')]=_0x4dc010;if(_0x463fba[_0x1961('0x22')][_0x1961('0x36')]){_0x4ea709[_0x1961('0x37')]=[{'all':!![]}];}return db['Attachment'][_0x1961('0x38')](_0x4ea709);})[_0x1961('0x35')](function(_0x5956af){_0x5e3402['rows']=_0x5956af;return _0x5e3402;})[_0x1961('0x35')](respondWithFilteredResult(_0xa72b70,_0x4ea709))[_0x1961('0x39')](handleError(_0xa72b70,null));};exports['show']=function(_0x303e89,_0x4477f5){var _0x5d37f2={'raw':!![],'where':{'id':_0x303e89[_0x1961('0x3a')]['id']}},_0x34df00={};_0x34df00[_0x1961('0x27')]=_[_0x1961('0x21')](db[_0x1961('0x1f')][_0x1961('0x20')]);_0x34df00[_0x1961('0x22')]=_[_0x1961('0x21')](_0x303e89[_0x1961('0x22')]);_0x34df00[_0x1961('0x25')]=_[_0x1961('0x26')](_0x34df00['model'],_0x34df00[_0x1961('0x22')]);_0x5d37f2['attributes']=_[_0x1961('0x26')](_0x34df00[_0x1961('0x27')],qs[_0x1961('0x28')](_0x303e89[_0x1961('0x22')]['fields']));_0x5d37f2[_0x1961('0x29')]=_0x5d37f2[_0x1961('0x29')][_0x1961('0x2a')]?_0x5d37f2['attributes']:_0x34df00[_0x1961('0x27')];if(_0x303e89['query'][_0x1961('0x36')]){_0x5d37f2[_0x1961('0x37')]=[{'all':!![]}];}_0x5d37f2=_['merge']({},_0x5d37f2,_0x303e89['options']);return db[_0x1961('0x1f')][_0x1961('0x3b')](_0x5d37f2)[_0x1961('0x35')](handleEntityNotFound(_0x4477f5,null))[_0x1961('0x35')](respondWithResult(_0x4477f5,null))[_0x1961('0x39')](handleError(_0x4477f5,null));};exports[_0x1961('0x3c')]=function(_0xe6dd18,_0x1d5e42){if(_0xe6dd18[_0x1961('0x3d')]['id']){delete _0xe6dd18['body']['id'];}return db['Attachment'][_0x1961('0x3b')]({'where':{'id':_0xe6dd18[_0x1961('0x3a')]['id']}})[_0x1961('0x35')](handleEntityNotFound(_0x1d5e42,null))[_0x1961('0x35')](saveUpdates(_0xe6dd18['body'],null))[_0x1961('0x35')](respondWithResult(_0x1d5e42,null))[_0x1961('0x39')](handleError(_0x1d5e42,null));};exports[_0x1961('0x1a')]=function(_0x2b5e99,_0x588c60){return db[_0x1961('0x1f')][_0x1961('0x3b')]({'where':{'id':_0x2b5e99['params']['id']}})[_0x1961('0x35')](handleEntityNotFound(_0x588c60,null))[_0x1961('0x35')](removeEntity(_0x588c60,null))['catch'](handleError(_0x588c60,null));};exports[_0x1961('0x3e')]=function(_0x26ebfe,_0xb223c3,_0x5b7f37){_0x26ebfe[_0x1961('0x3d')]['name']=_0x26ebfe['file'][_0x1961('0x3f')];_0x26ebfe[_0x1961('0x3d')][_0x1961('0x40')]=_0x26ebfe[_0x1961('0x41')]['filename'];_0x26ebfe[_0x1961('0x3d')][_0x1961('0x42')]=_0x26ebfe[_0x1961('0x41')]['mimetype'];return db[_0x1961('0x1f')][_0x1961('0x3e')](_0x26ebfe[_0x1961('0x3d')])[_0x1961('0x35')](respondWithResult(_0xb223c3,0xc9))['catch'](handleError(_0xb223c3,null));};exports[_0x1961('0x43')]=function(_0x10b2e7,_0x5bf12b,_0x3ac0a6){return db[_0x1961('0x1f')][_0x1961('0x44')]({'where':{'id':_0x10b2e7['params']['id']},'raw':!![]})[_0x1961('0x35')](handleEntityNotFound(_0x5bf12b,null))[_0x1961('0x35')](function(_0x2afb44){if(_0x2afb44){return _0x5bf12b[_0x1961('0x43')](path[_0x1961('0x45')](config[_0x1961('0x46')],_0x1961('0x47'),_0x2afb44[_0x1961('0x40')]));}})[_0x1961('0x39')](handleError(_0x5bf12b,null));}; \ No newline at end of file +var _0x09bc=['intersection','attributes','fields','length','hasOwnProperty','order','where','day','merge','map','filter','options','Attachment','count','includeAll','findAll','rows','catch','params','include','find','body','destroy','create','file','originalname','basename','filename','download','findOne','join','server/files/attachments/','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','set','reject','save','update','then','sendStatus','error','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x16759a,_0x2c1f70){var _0x49d27a=function(_0xf9815d){while(--_0xf9815d){_0x16759a['push'](_0x16759a['shift']());}};_0x49d27a(++_0x2c1f70);}(_0x09bc,0x13c));var _0xc09b=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x09bc[_0x18afca];return _0x11603f;};'use strict';var jsonpatch=require(_0xc09b('0x0'));var rp=require(_0xc09b('0x1'));var moment=require(_0xc09b('0x2'));var BPromise=require(_0xc09b('0x3'));var Mustache=require(_0xc09b('0x4'));var util=require('util');var path=require(_0xc09b('0x5'));var sox=require(_0xc09b('0x6'));var csv=require(_0xc09b('0x7'));var ejs=require(_0xc09b('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xc09b('0x9'));var jsforce=require(_0xc09b('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc09b('0x7'));var querystring=require(_0xc09b('0xb'));var Papa=require(_0xc09b('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xc09b('0xd'))(_0xc09b('0xe'));var utils=require(_0xc09b('0xf'));var config=require('../../config/environment');var db=require(_0xc09b('0x10'))['db'];function respondWithStatusCode(_0xd60a4,_0x12bed0){_0x12bed0=_0x12bed0||0xcc;return function(_0x58bc47){if(_0x58bc47){return _0xd60a4['sendStatus'](_0x12bed0);}return _0xd60a4[_0xc09b('0x11')](_0x12bed0)[_0xc09b('0x12')]();};}function respondWithResult(_0x56ccfa,_0x22a0f3){_0x22a0f3=_0x22a0f3||0xc8;return function(_0x1d2326){if(_0x1d2326){return _0x56ccfa[_0xc09b('0x11')](_0x22a0f3)[_0xc09b('0x13')](_0x1d2326);}};}function respondWithFilteredResult(_0x4f09a3,_0x2d4995){return function(_0x4a8131){if(_0x4a8131){var _0x416430=_0x4a8131['count'],_0x16b5a9=_0x2d4995[_0xc09b('0x14')],_0x593e14=_0x2d4995[_0xc09b('0x14')]+_0x2d4995[_0xc09b('0x15')],_0x5e96ce;if(_0x593e14>=_0x416430){_0x593e14=_0x416430;_0x5e96ce=0xc8;}else{_0x5e96ce=0xce;}_0x4f09a3[_0xc09b('0x11')](_0x5e96ce);return _0x4f09a3[_0xc09b('0x16')]('Content-Range',_0x16b5a9+'-'+_0x593e14+'/'+_0x416430)['json'](_0x4a8131);}return null;};}function patchUpdates(_0x4f9e2e){return function(_0x7d0a88){try{jsonpatch['apply'](_0x7d0a88,_0x4f9e2e,!![]);}catch(_0x49e23a){return BPromise[_0xc09b('0x17')](_0x49e23a);}return _0x7d0a88[_0xc09b('0x18')]();};}function saveUpdates(_0x33914f,_0x546bfc){return function(_0x5c03e9){if(_0x5c03e9){return _0x5c03e9[_0xc09b('0x19')](_0x33914f)[_0xc09b('0x1a')](function(_0x584e14){return _0x584e14;});}return null;};}function removeEntity(_0x2c3ef2,_0x20ccf4){return function(_0x4bc514){if(_0x4bc514){return _0x4bc514['destroy']()[_0xc09b('0x1a')](function(){_0x2c3ef2[_0xc09b('0x11')](0xcc)[_0xc09b('0x12')]();});}};}function handleEntityNotFound(_0x17ac49,_0x123bd1){return function(_0x272cf0){if(!_0x272cf0){_0x17ac49[_0xc09b('0x1b')](0x194);}return _0x272cf0;};}function handleError(_0x1775cf,_0x5479ce){_0x5479ce=_0x5479ce||0x1f4;return function(_0xaa3c){logger[_0xc09b('0x1c')](_0xaa3c[_0xc09b('0x1d')]);if(_0xaa3c[_0xc09b('0x1e')]){delete _0xaa3c[_0xc09b('0x1e')];}_0x1775cf[_0xc09b('0x11')](_0x5479ce)['send'](_0xaa3c);};}exports[_0xc09b('0x1f')]=function(_0x2a42f6,_0x490172){var _0x5862fd={},_0x2fb76f={},_0x4dadbe={'count':0x0,'rows':[]};var _0xf8f882=db['Attachment'][_0xc09b('0x20')];_0x2fb76f[_0xc09b('0x21')]=_[_0xc09b('0x22')](_0xf8f882);var _0x512e52={'dateStart':_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x24')],'dateEnd':_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x25')]};delete _0x2a42f6[_0xc09b('0x23')][_0xc09b('0x24')];delete _0x2a42f6[_0xc09b('0x23')]['dateEnd'];_0x2fb76f[_0xc09b('0x23')]=_['keys'](_0x2a42f6[_0xc09b('0x23')]);_0x2fb76f[_0xc09b('0x26')]=_[_0xc09b('0x27')](_0x2fb76f['model'],_0x2fb76f[_0xc09b('0x23')]);_0x5862fd[_0xc09b('0x28')]=_[_0xc09b('0x27')](_0x2fb76f[_0xc09b('0x21')],qs['fields'](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x29')]));_0x5862fd[_0xc09b('0x28')]=_0x5862fd[_0xc09b('0x28')][_0xc09b('0x2a')]?_0x5862fd[_0xc09b('0x28')]:_0x2fb76f['model'];if(!_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x2b')]('nolimit')){_0x5862fd[_0xc09b('0x15')]=qs[_0xc09b('0x15')](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x15')]);_0x5862fd[_0xc09b('0x14')]=qs[_0xc09b('0x14')](_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x14')]);}_0x5862fd[_0xc09b('0x2c')]=qs['sort'](_0x2a42f6[_0xc09b('0x23')]['sort']);_0x5862fd[_0xc09b('0x2d')]=qs[_0xc09b('0x26')](_['pick'](_0x2a42f6[_0xc09b('0x23')],_0x2fb76f['filters']));if(_0x512e52[_0xc09b('0x24')]){if(_0x512e52[_0xc09b('0x25')]){_0x512e52[_0xc09b('0x25')]=moment(_0x512e52[_0xc09b('0x25')])['add'](0x1,_0xc09b('0x2e'));}else{_0x512e52[_0xc09b('0x25')]=moment(_0x512e52[_0xc09b('0x24')])['add'](0x1,_0xc09b('0x2e'));}_[_0xc09b('0x2f')](_0x5862fd[_0xc09b('0x2d')],{'createdAt':{'$gte':_0x512e52['dateStart'],'$lte':_0x512e52['dateEnd']}});}if(_0x2a42f6[_0xc09b('0x23')]['filter']){_0x5862fd['where']=_[_0xc09b('0x2f')](_0x5862fd[_0xc09b('0x2d')],{'$or':_[_0xc09b('0x30')](_0x5862fd[_0xc09b('0x28')],function(_0x399df0){var _0x7d1b86={};_0x7d1b86[_0x399df0]={'$like':'%'+_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x31')]+'%'};return _0x7d1b86;})});}_0x5862fd=_['merge']({},_0x5862fd,_0x2a42f6[_0xc09b('0x32')]);var _0x175f25={'where':_0x5862fd[_0xc09b('0x2d')]};return db[_0xc09b('0x33')]['count'](_0x175f25)[_0xc09b('0x1a')](function(_0x424df2){_0x4dadbe[_0xc09b('0x34')]=_0x424df2;if(_0x2a42f6[_0xc09b('0x23')][_0xc09b('0x35')]){_0x5862fd['include']=[{'all':!![]}];}return db[_0xc09b('0x33')][_0xc09b('0x36')](_0x5862fd);})[_0xc09b('0x1a')](function(_0x4050e4){_0x4dadbe[_0xc09b('0x37')]=_0x4050e4;return _0x4dadbe;})[_0xc09b('0x1a')](respondWithFilteredResult(_0x490172,_0x5862fd))[_0xc09b('0x38')](handleError(_0x490172,null));};exports['show']=function(_0x3dee11,_0x170de3){var _0xb3d292={'raw':!![],'where':{'id':_0x3dee11[_0xc09b('0x39')]['id']}},_0x47d2c3={};_0x47d2c3[_0xc09b('0x21')]=_[_0xc09b('0x22')](db[_0xc09b('0x33')][_0xc09b('0x20')]);_0x47d2c3['query']=_[_0xc09b('0x22')](_0x3dee11[_0xc09b('0x23')]);_0x47d2c3[_0xc09b('0x26')]=_[_0xc09b('0x27')](_0x47d2c3[_0xc09b('0x21')],_0x47d2c3[_0xc09b('0x23')]);_0xb3d292[_0xc09b('0x28')]=_[_0xc09b('0x27')](_0x47d2c3[_0xc09b('0x21')],qs[_0xc09b('0x29')](_0x3dee11[_0xc09b('0x23')][_0xc09b('0x29')]));_0xb3d292['attributes']=_0xb3d292[_0xc09b('0x28')][_0xc09b('0x2a')]?_0xb3d292[_0xc09b('0x28')]:_0x47d2c3[_0xc09b('0x21')];if(_0x3dee11['query'][_0xc09b('0x35')]){_0xb3d292[_0xc09b('0x3a')]=[{'all':!![]}];}_0xb3d292=_[_0xc09b('0x2f')]({},_0xb3d292,_0x3dee11[_0xc09b('0x32')]);return db['Attachment'][_0xc09b('0x3b')](_0xb3d292)['then'](handleEntityNotFound(_0x170de3,null))['then'](respondWithResult(_0x170de3,null))[_0xc09b('0x38')](handleError(_0x170de3,null));};exports[_0xc09b('0x19')]=function(_0x21b870,_0x55c204){if(_0x21b870[_0xc09b('0x3c')]['id']){delete _0x21b870[_0xc09b('0x3c')]['id'];}return db[_0xc09b('0x33')][_0xc09b('0x3b')]({'where':{'id':_0x21b870[_0xc09b('0x39')]['id']}})[_0xc09b('0x1a')](handleEntityNotFound(_0x55c204,null))['then'](saveUpdates(_0x21b870['body'],null))[_0xc09b('0x1a')](respondWithResult(_0x55c204,null))[_0xc09b('0x38')](handleError(_0x55c204,null));};exports[_0xc09b('0x3d')]=function(_0x35eb54,_0x455ca9){return db[_0xc09b('0x33')]['find']({'where':{'id':_0x35eb54[_0xc09b('0x39')]['id']}})[_0xc09b('0x1a')](handleEntityNotFound(_0x455ca9,null))[_0xc09b('0x1a')](removeEntity(_0x455ca9,null))[_0xc09b('0x38')](handleError(_0x455ca9,null));};exports[_0xc09b('0x3e')]=function(_0xa5c00f,_0x2a9831,_0x36b03e){_0xa5c00f[_0xc09b('0x3c')]['name']=_0xa5c00f[_0xc09b('0x3f')][_0xc09b('0x40')];_0xa5c00f[_0xc09b('0x3c')][_0xc09b('0x41')]=_0xa5c00f[_0xc09b('0x3f')][_0xc09b('0x42')];_0xa5c00f['body']['type']=_0xa5c00f[_0xc09b('0x3f')]['mimetype'];return db[_0xc09b('0x33')][_0xc09b('0x3e')](_0xa5c00f[_0xc09b('0x3c')])['then'](respondWithResult(_0x2a9831,0xc9))[_0xc09b('0x38')](handleError(_0x2a9831,null));};exports[_0xc09b('0x43')]=function(_0x278d31,_0x4b5a5e,_0x439689){return db[_0xc09b('0x33')][_0xc09b('0x44')]({'where':{'id':_0x278d31[_0xc09b('0x39')]['id']},'raw':!![]})[_0xc09b('0x1a')](handleEntityNotFound(_0x4b5a5e,null))[_0xc09b('0x1a')](function(_0x12a565){if(_0x12a565){return _0x4b5a5e[_0xc09b('0x43')](path[_0xc09b('0x45')](config['root'],_0xc09b('0x46'),_0x12a565[_0xc09b('0x41')]));}})[_0xc09b('0x38')](handleError(_0x4b5a5e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 2307b29..cecbba1 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 _0x55ca=['bluebird','request-promise','exports','define','Attachment','attachments','lodash','util'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x55ca,0x126));var _0xa55c=function(_0x803ae0,_0x5c5f30){_0x803ae0=_0x803ae0-0x0;var _0x3c38b1=_0x55ca[_0x803ae0];return _0x3c38b1;};'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 attributes=require('./attachment.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['exports','define','Attachment','attachments','lodash','../../config/logger','api','moment','bluebird','./attachment.attributes'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x1cb9,0x14e));var _0x91cb=function(_0x63927c,_0x298ea4){_0x63927c=_0x63927c-0x0;var _0x337f26=_0x1cb9[_0x63927c];return _0x337f26;};'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 attributes=require(_0x91cb('0x5'));module[_0x91cb('0x6')]=function(_0x5652cd,_0x17c21c){return _0x5652cd[_0x91cb('0x7')](_0x91cb('0x8'),attributes,{'tableName':_0x91cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 89b8700..e0c5d12 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 _0x390a=['create','options','raw','debug','CreateAttachment','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x35fcb7,_0x3734c0){var _0x30f28a=function(_0x1da8bd){while(--_0x1da8bd){_0x35fcb7['push'](_0x35fcb7['shift']());}};_0x30f28a(++_0x3734c0);}(_0x390a,0xc9));var _0xa390=function(_0x15ebe1,_0x43733d){_0x15ebe1=_0x15ebe1-0x0;var _0x4a1897=_0x390a[_0x15ebe1];return _0x4a1897;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xa390('0x4'))['db'];var utils=require(_0xa390('0x5'));var logger=require(_0xa390('0x6'))(_0xa390('0x7'));var config=require('../../config/environment');var jayson=require(_0xa390('0x8'));var client=jayson[_0xa390('0x9')][_0xa390('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ac9f5,_0x2d49cc,_0x1f9de0){return new BPromise(function(_0x53bfb4,_0x492418){return client[_0xa390('0xb')](_0x4ac9f5,_0x1f9de0)[_0xa390('0xc')](function(_0x321bae){logger[_0xa390('0xd')](_0xa390('0xe'),_0x2d49cc,'request\x20sent');logger['debug'](_0xa390('0xf'),_0x2d49cc,_0xa390('0x10'),JSON[_0xa390('0x11')](_0x321bae));if(_0x321bae['error']){if(_0x321bae[_0xa390('0x12')][_0xa390('0x13')]===0x1f4){logger['error'](_0xa390('0xe'),_0x2d49cc,_0x321bae[_0xa390('0x12')]['message']);return _0x492418(_0x321bae['error'][_0xa390('0x14')]);}logger[_0xa390('0x12')]('Attachment,\x20%s,\x20%s',_0x2d49cc,_0x321bae[_0xa390('0x12')]['message']);return _0x53bfb4(_0x321bae['error']['message']);}else{logger[_0xa390('0xd')]('Attachment,\x20%s,\x20%s',_0x2d49cc,_0xa390('0x10'));_0x53bfb4(_0x321bae[_0xa390('0x15')]['message']);}})[_0xa390('0x16')](function(_0x180429){logger['error'](_0xa390('0xe'),_0x2d49cc,_0x180429);_0x492418(_0x180429);});});}exports['CreateAttachment']=function(_0x228c83){var _0x225e2c=this;return new Promise(function(_0x23bb5d,_0x3905b3){return db['Attachment'][_0xa390('0x17')](_0x228c83['body'],{'raw':_0x228c83['options']?_0x228c83[_0xa390('0x18')][_0xa390('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3815bd){logger[_0xa390('0xd')]('CreateAttachment',_0x228c83);logger[_0xa390('0x1a')](_0xa390('0x1b'),_0x228c83,JSON['stringify'](_0x3815bd));_0x23bb5d(_0x3815bd);})['catch'](function(_0x18a0f0){logger[_0xa390('0x12')](_0xa390('0x1b'),_0x18a0f0['message'],_0x228c83);_0x3905b3(_0x225e2c['error'](0x1f4,_0x18a0f0[_0xa390('0x14')]));});});}; \ No newline at end of file +var _0x5236=['http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateAttachment','Attachment','create','options','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x5236,0x109));var _0x6523=function(_0x1cee0f,_0x27016c){_0x1cee0f=_0x1cee0f-0x0;var _0x1c4fc7=_0x5236[_0x1cee0f];return _0x1c4fc7;};'use strict';var _=require(_0x6523('0x0'));var util=require(_0x6523('0x1'));var moment=require(_0x6523('0x2'));var BPromise=require(_0x6523('0x3'));var rs=require(_0x6523('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6523('0x5'));var logger=require(_0x6523('0x6'))('rpc');var config=require(_0x6523('0x7'));var jayson=require(_0x6523('0x8'));var client=jayson[_0x6523('0x9')][_0x6523('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fcb0d,_0x53548c,_0x32e99c){return new BPromise(function(_0x17b335,_0x24550b){return client['request'](_0x3fcb0d,_0x32e99c)[_0x6523('0xb')](function(_0x1c7d9f){logger[_0x6523('0xc')](_0x6523('0xd'),_0x53548c,_0x6523('0xe'));logger[_0x6523('0xf')]('Attachment,\x20%s,\x20%s,\x20%s',_0x53548c,_0x6523('0xe'),JSON[_0x6523('0x10')](_0x1c7d9f));if(_0x1c7d9f[_0x6523('0x11')]){if(_0x1c7d9f[_0x6523('0x11')][_0x6523('0x12')]===0x1f4){logger['error'](_0x6523('0xd'),_0x53548c,_0x1c7d9f[_0x6523('0x11')]['message']);return _0x24550b(_0x1c7d9f[_0x6523('0x11')]['message']);}logger['error'](_0x6523('0xd'),_0x53548c,_0x1c7d9f[_0x6523('0x11')][_0x6523('0x13')]);return _0x17b335(_0x1c7d9f[_0x6523('0x11')][_0x6523('0x13')]);}else{logger[_0x6523('0xc')]('Attachment,\x20%s,\x20%s',_0x53548c,_0x6523('0xe'));_0x17b335(_0x1c7d9f['result'][_0x6523('0x13')]);}})[_0x6523('0x14')](function(_0x15eaf8){logger[_0x6523('0x11')](_0x6523('0xd'),_0x53548c,_0x15eaf8);_0x24550b(_0x15eaf8);});});}exports[_0x6523('0x15')]=function(_0x17325a){var _0x303a1e=this;return new Promise(function(_0x59db97,_0x9bc6b1){return db[_0x6523('0x16')][_0x6523('0x17')](_0x17325a['body'],{'raw':_0x17325a[_0x6523('0x18')]?_0x17325a['options']['raw']===undefined?!![]:![]:!![]})[_0x6523('0xb')](function(_0x193be6){logger[_0x6523('0xc')](_0x6523('0x15'),_0x17325a);logger[_0x6523('0xf')](_0x6523('0x15'),_0x17325a,JSON[_0x6523('0x10')](_0x193be6));_0x59db97(_0x193be6);})[_0x6523('0x14')](function(_0x5ca8c4){logger['error'](_0x6523('0x15'),_0x5ca8c4['message'],_0x17325a);_0x9bc6b1(_0x303a1e[_0x6523('0x11')](0x1f4,_0x5ca8c4[_0x6523('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index aea17ff..d3f7404 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 _0x3423=['originalname','replace','single','file','create','put','update','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','%s-%s'];(function(_0x3697b9,_0x48cb6a){var _0x30bd34=function(_0x369f3c){while(--_0x369f3c){_0x3697b9['push'](_0x3697b9['shift']());}};_0x30bd34(++_0x48cb6a);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var express=require(_0x3342('0x1'));var router=express[_0x3342('0x2')]();var auth=require(_0x3342('0x3'));var interaction=require(_0x3342('0x4'));var config=require(_0x3342('0x5'));var controller=require(_0x3342('0x6'));router[_0x3342('0x7')]('/',auth[_0x3342('0x8')](),controller[_0x3342('0x9')]);router[_0x3342('0x7')](_0x3342('0xa'),auth[_0x3342('0x8')](),controller[_0x3342('0xb')]);router[_0x3342('0x7')](_0x3342('0xc'),auth[_0x3342('0x8')](),controller[_0x3342('0xd')]);var upload=multer({'storage':multer[_0x3342('0xe')]({'destination':function(_0x4ae4f3,_0x582c37,_0x2d0cb0){_0x2d0cb0(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4f85e3,_0xb11eb9,_0x2f3c47){_0x2f3c47(null,util['format'](_0x3342('0xf'),Date['now'](),_0xb11eb9[_0x3342('0x10')][_0x3342('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/',upload[_0x3342('0x12')](_0x3342('0x13')),controller[_0x3342('0x14')]);router[_0x3342('0x15')](_0x3342('0xa'),auth[_0x3342('0x8')](),controller[_0x3342('0x16')]);router['delete'](_0x3342('0xa'),auth[_0x3342('0x8')](),controller['destroy']);module[_0x3342('0x17')]=router; \ No newline at end of file +var _0xa9fc=['format','now','originalname','replace','post','single','file','create','put','exports','multer','util','path','express','Router','../../components/interaction/service','./attachment.controller','get','/:id','show','/:id/download','isAuthenticated','download','diskStorage','join','root','server/files/attachments/'];(function(_0x913be,_0x46ec6a){var _0x403cbf=function(_0x417351){while(--_0x417351){_0x913be['push'](_0x913be['shift']());}};_0x403cbf(++_0x46ec6a);}(_0xa9fc,0x19f));var _0xca9f=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xa9fc[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0xca9f('0x0'));var util=require(_0xca9f('0x1'));var path=require(_0xca9f('0x2'));var express=require(_0xca9f('0x3'));var router=express[_0xca9f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xca9f('0x5'));var config=require('../../config/environment');var controller=require(_0xca9f('0x6'));router[_0xca9f('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xca9f('0x8'),auth['isAuthenticated'](),controller[_0xca9f('0x9')]);router[_0xca9f('0x7')](_0xca9f('0xa'),auth[_0xca9f('0xb')](),controller[_0xca9f('0xc')]);var upload=multer({'storage':multer[_0xca9f('0xd')]({'destination':function(_0x4713f0,_0x5ae48c,_0x5cd1db){_0x5cd1db(null,path[_0xca9f('0xe')](config[_0xca9f('0xf')],_0xca9f('0x10')));},'filename':function(_0x5d7bd8,_0x529ed0,_0x41bca1){_0x41bca1(null,util[_0xca9f('0x11')]('%s-%s',Date[_0xca9f('0x12')](),_0x529ed0[_0xca9f('0x13')][_0xca9f('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xca9f('0x15')]('/',upload[_0xca9f('0x16')](_0xca9f('0x17')),controller[_0xca9f('0x18')]);router[_0xca9f('0x19')](_0xca9f('0x8'),auth[_0xca9f('0xb')](),controller['update']);router['delete'](_0xca9f('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0xca9f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index ed5f799..4cfd2f2 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 _0x2b63=['map','emails','value','user','agent','then','User\x20email\x20not\x20found!','catch','lodash','passport','../../config/environment','signToken','login','google','profile','email','callback','use','clientID','clientSecret','secret','callbackURL','User'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x2b63,0x1d4));var _0x32b6=function(_0x1e0f75,_0x497973){_0x1e0f75=_0x1e0f75-0x0;var _0x422d75=_0x2b63[_0x1e0f75];return _0x422d75;};'use strict';var _=require(_0x32b6('0x0'));var passport=require(_0x32b6('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var db=require('../../mysqldb')['db'];var config=require(_0x32b6('0x2'));var signToken=require('../../components/auth/service')[_0x32b6('0x3')];exports[_0x32b6('0x4')]=passport['authenticate'](_0x32b6('0x5'),{'failureRedirect':'/login','scope':[_0x32b6('0x6'),_0x32b6('0x7')],'session':![]});exports[_0x32b6('0x8')]=passport['authenticate'](_0x32b6('0x5'),{'failureRedirect':'/login','session':![]});passport[_0x32b6('0x9')](new GoogleStrategy({'clientID':config[_0x32b6('0x5')]?config['google'][_0x32b6('0xa')]:'id','clientSecret':config['google']?config[_0x32b6('0x5')][_0x32b6('0xb')]:_0x32b6('0xc'),'callbackURL':config[_0x32b6('0x5')]?config['google'][_0x32b6('0xd')]:''},function(_0x4e5eb0,_0x34ce11,_0x54219e,_0x3077b4){db[_0x32b6('0xe')]['find']({'where':{'email':_[_0x32b6('0xf')](_0x54219e[_0x32b6('0x10')],_0x32b6('0x11')),'role':{'$or':['admin',_0x32b6('0x12'),_0x32b6('0x13')]}}})[_0x32b6('0x14')](function(_0x40f52d){if(_0x40f52d){return _0x3077b4(null,_0x40f52d);}_0x3077b4(_0x32b6('0x15'));})[_0x32b6('0x16')](function(_0x314f8e){_0x3077b4(_0x314f8e);});})); \ No newline at end of file +var _0x0a01=['emails','admin','user','agent','then','User\x20email\x20not\x20found!','lodash','passport','passport-google-oauth20','Strategy','../../config/environment','../../components/auth/service','signToken','login','authenticate','google','/login','profile','callback','use','clientSecret','secret','callbackURL','User','find','map'];(function(_0x296b88,_0x293cef){var _0x150363=function(_0x37ca28){while(--_0x37ca28){_0x296b88['push'](_0x296b88['shift']());}};_0x150363(++_0x293cef);}(_0x0a01,0x1a6));var _0x10a0=function(_0x292ecc,_0x2ed340){_0x292ecc=_0x292ecc-0x0;var _0x59aabc=_0x0a01[_0x292ecc];return _0x59aabc;};'use strict';var _=require(_0x10a0('0x0'));var passport=require(_0x10a0('0x1'));var GoogleStrategy=require(_0x10a0('0x2'))[_0x10a0('0x3')];var db=require('../../mysqldb')['db'];var config=require(_0x10a0('0x4'));var signToken=require(_0x10a0('0x5'))[_0x10a0('0x6')];exports[_0x10a0('0x7')]=passport[_0x10a0('0x8')](_0x10a0('0x9'),{'failureRedirect':_0x10a0('0xa'),'scope':[_0x10a0('0xb'),'email'],'session':![]});exports[_0x10a0('0xc')]=passport[_0x10a0('0x8')](_0x10a0('0x9'),{'failureRedirect':_0x10a0('0xa'),'session':![]});passport[_0x10a0('0xd')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config['google']?config[_0x10a0('0x9')][_0x10a0('0xe')]:_0x10a0('0xf'),'callbackURL':config[_0x10a0('0x9')]?config[_0x10a0('0x9')][_0x10a0('0x10')]:''},function(_0x14456c,_0x69aaff,_0x4f52ca,_0x28c3b0){db[_0x10a0('0x11')][_0x10a0('0x12')]({'where':{'email':_[_0x10a0('0x13')](_0x4f52ca[_0x10a0('0x14')],'value'),'role':{'$or':[_0x10a0('0x15'),_0x10a0('0x16'),_0x10a0('0x17')]}}})[_0x10a0('0x18')](function(_0x2e599d){if(_0x2e599d){return _0x28c3b0(null,_0x2e599d);}_0x28c3b0(_0x10a0('0x19'));})['catch'](function(_0x2d1e5d){_0x28c3b0(_0x2d1e5d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 42ef88f..ca90492 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 _0xbdf4=['./authGoogle.controller','setTokenCookie','get','/callback','callback','exports'];(function(_0x4577d8,_0x15c7ae){var _0x22cb92=function(_0x15aa2e){while(--_0x15aa2e){_0x4577d8['push'](_0x4577d8['shift']());}};_0x22cb92(++_0x15c7ae);}(_0xbdf4,0xb4));var _0x4bdf=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xbdf4[_0x485b5a];return _0xd2b34d;};'use strict';var express=require('express');var passport=require('passport');var router=express['Router']();var controller=require(_0x4bdf('0x0'));var setTokenCookie=require('../../components/auth/service')[_0x4bdf('0x1')];router[_0x4bdf('0x2')]('/',controller['login']);router[_0x4bdf('0x2')](_0x4bdf('0x3'),controller[_0x4bdf('0x4')],setTokenCookie);module[_0x4bdf('0x5')]=router; \ No newline at end of file +var _0x6979=['../../components/auth/service','setTokenCookie','get','callback','exports','passport','Router','./authGoogle.controller'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x6979,0x10d));var _0x9697=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0x6979[_0xb15182];return _0x4a8749;};'use strict';var express=require('express');var passport=require(_0x9697('0x0'));var router=express[_0x9697('0x1')]();var controller=require(_0x9697('0x2'));var setTokenCookie=require(_0x9697('0x3'))[_0x9697('0x4')];router[_0x9697('0x5')]('/',controller['login']);router['get']('/callback',controller[_0x9697('0x6')],setTokenCookie);module[_0x9697('0x7')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 2394e50..e022ef8 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 _0xe26d=['../../mysqldb','../../components/auth/service','client','http','role','User','count','agent','../../config/license/util','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','trim','admin','This\x20name\x20is\x20not\x20registered.','authenticate','catch','email','MailServerOut','Smtp','service','host','port','secure','authentication','user','pass','\x22%s\x22\x20<%s>','name','SendMail','error','message','stringify','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','find','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','password','save','Password\x20reset!','use','util','passport','passport-local','bluebird','lodash','../../config/logger','api','randomstring'];(function(_0x36f766,_0x1ae427){var _0xfe9619=function(_0x1e9c8e){while(--_0x1e9c8e){_0x36f766['push'](_0x36f766['shift']());}};_0xfe9619(++_0x1ae427);}(_0xe26d,0x10c));var _0xde26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe26d[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xde26('0x0'));var passport=require(_0xde26('0x1'));var LocalStrategy=require(_0xde26('0x2'))['Strategy'];var BPromise=require(_0xde26('0x3'));var jayson=require('jayson/promise');var _=require(_0xde26('0x4'));var logger=require(_0xde26('0x5'))(_0xde26('0x6'));var rs=require(_0xde26('0x7'));var db=require(_0xde26('0x8'))['db'];var signToken=require(_0xde26('0x9'))['signToken'];var client=jayson[_0xde26('0xa')][_0xde26('0xb')]({'port':0x232b});var getLicense=function(_0x5a12b2){return new BPromise(function(_0x488282,_0x306a58){var _0x5d752d=0x0;_0x5a12b2[_0xde26('0xc')]!=='agent'&&_0x488282(_0x5a12b2);return db[_0xde26('0xd')][_0xde26('0xe')]({'where':{'role':_0xde26('0xf'),'online':!![],'id':{'$ne':_0x5a12b2['id']}}})['then'](function(_0x3941e9){_0x5d752d=_0x3941e9;return require(_0xde26('0x10'))[_0xde26('0x11')]();})[_0xde26('0x12')](function(_0x538883){if(_0x538883&&_0x538883[_0xde26('0x13')]&&_0x5d752d>=_0x538883['agents']){return _0x306a58({'message':_0xde26('0x14')});}return _0x488282(_0x5a12b2);})['catch'](function(_0xc04ee7){return _0x306a58(_0xc04ee7);});});};function localAuthenticate(_0xbd715b,_0x39074d,_0x1d5a65,_0x3c8bff){var _0x15c65e;_0xbd715b['find']({'where':{'name':_0x39074d[_0xde26('0x15')](),'role':{'$or':[_0xde26('0x16'),'user','agent']}}})['then'](function(_0x5b4526){if(!_0x5b4526){return _0x3c8bff(null,![],{'message':_0xde26('0x17')});}return getLicense(_0x5b4526);})[_0xde26('0x12')](function(_0x409a6d){_0x409a6d[_0xde26('0x18')](_0x1d5a65,function(_0x199319,_0x213abc){if(_0x199319){return _0x3c8bff(_0x199319);}if(!_0x213abc){return _0x3c8bff(null,![],{'message':'This\x20password\x20is\x20not\x20correct.'});}else{return _0x3c8bff(null,_0x409a6d);}});})[_0xde26('0x19')](function(_0x5aa313){_0x3c8bff(_0x5aa313);});}function sendServiceMail(_0x1d7903){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id','name',_0xde26('0x1a')],'include':[{'model':db[_0xde26('0x1b')],'as':_0xde26('0x1c')}]})[_0xde26('0x12')](function(_0x177b58){if(!_0x177b58){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x5e4f2e={'tls':{'rejectUnauthorized':![]}};if(_0x177b58[_0xde26('0x1c')][_0xde26('0x1d')]){_0x5e4f2e[_0xde26('0x1d')]=_0x177b58[_0xde26('0x1c')][_0xde26('0x1d')];}else{_0x5e4f2e[_0xde26('0x1e')]=_0x177b58[_0xde26('0x1c')][_0xde26('0x1e')];_0x5e4f2e['port']=_0x177b58['Smtp'][_0xde26('0x1f')];_0x5e4f2e[_0xde26('0x20')]=_0x177b58[_0xde26('0x1c')][_0xde26('0x20')];}if(_0x177b58[_0xde26('0x1c')][_0xde26('0x21')]){_0x5e4f2e['auth']={'user':_0x177b58[_0xde26('0x1c')][_0xde26('0x22')],'pass':_0x177b58[_0xde26('0x1c')][_0xde26('0x23')]};}var _0x1f7d52={'account':_0x5e4f2e,'message':_['merge']({'from':util['format'](_0xde26('0x24'),_0x177b58[_0xde26('0x25')],_0x177b58[_0xde26('0x1a')]||_0x177b58[_0xde26('0x1c')][_0xde26('0x22')])},_0x1d7903)};return client['request'](_0xde26('0x26'),_0x1f7d52);})[_0xde26('0x12')](function(_0x45f778){if(_0x45f778[_0xde26('0x27')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x45f778[_0xde26('0x27')][_0xde26('0x28')]||JSON[_0xde26('0x29')](_0x45f778[_0xde26('0x27')])));}return!![];});}function handleError(_0x5f1ec4,_0x8e790a,_0x28b09e){return _0x5f1ec4['status'](_0x8e790a||0x1f4)['send']({'message':_0x28b09e?_0x28b09e[_0xde26('0x28')]||_0x28b09e:''});}exports[_0xde26('0x2a')]=function(_0xde2ea4,_0x7341b1,_0x58a1fa){passport['authenticate'](_0xde26('0x2b'),function(_0x106d2f,_0x59ff67,_0x12a544){var _0x22956c=_0x106d2f||_0x12a544;if(_0x22956c){return handleError(_0x7341b1,0x191,_0x22956c);}if(!_0x59ff67){return handleError(_0x7341b1,0x194,{'message':_0xde26('0x2c')});}var _0x17657a=signToken(_0x59ff67['id'],_0x59ff67[_0xde26('0xc')]);_0x7341b1['json']({'id':_0x59ff67['id'],'token':_0x17657a,'statusCall':'','isAlreadyLogged':_0x59ff67[_0xde26('0x2d')]});})(_0xde2ea4,_0x7341b1,_0x58a1fa);};exports[_0xde26('0x2e')]=function(_0x2e4c26,_0x5f6d58,_0x18f4e3){if(!_0x2e4c26[_0xde26('0x2f')][_0xde26('0x1a')]){return handleError(_0x5f6d58,0x1f4,{'message':_0xde26('0x30')});}var _0x180af6=rs[_0xde26('0x31')]();_0x2e4c26[_0xde26('0x2f')]['email']=_0x2e4c26[_0xde26('0x2f')][_0xde26('0x1a')][_0xde26('0x15')]()['toLowerCase']();return db['User'][_0xde26('0x32')]({'where':{'email':_0x2e4c26['body'][_0xde26('0x1a')]}})[_0xde26('0x12')](function(_0x3a2449){if(!_0x3a2449){throw new Error(_0xde26('0x33'));}_0x3a2449[_0xde26('0x34')]=_0x180af6;_0x3a2449['resetPasswordExpires']=Date[_0xde26('0x35')]()+0x36ee80;return _0x3a2449['save']();})[_0xde26('0x12')](function(){return sendServiceMail({'to':_0x2e4c26[_0xde26('0x2f')]['email'],'subject':_0xde26('0x36'),'text':_0xde26('0x37')+_0xde26('0x38')+'http://'+_0x2e4c26[_0xde26('0x39')][_0xde26('0x1e')]+_0xde26('0x3a')+_0x180af6+'\x0a\x0a'+_0xde26('0x3b')});})[_0xde26('0x12')](function(){_0x5f6d58[_0xde26('0x3c')](0xc8)[_0xde26('0x3d')]({'message':'Reset\x20Email\x20sent!'});})[_0xde26('0x19')](function(_0x9a65ff){return handleError(_0x5f6d58,0x1f4,_0x9a65ff);});};exports['reset']=function(_0x579281,_0x1ca9e1,_0x278adb){return db[_0xde26('0xd')][_0xde26('0x32')]({'where':{'resetPasswordToken':_0x579281[_0xde26('0x3e')][_0xde26('0x3f')],'resetPasswordExpires':{'$gt':Date[_0xde26('0x35')]()}}})[_0xde26('0x12')](function(_0x2241a3){if(!_0x2241a3){throw new Error(_0xde26('0x40'));}_0x2241a3[_0xde26('0x41')]=_0x579281[_0xde26('0x2f')]['password'];_0x2241a3[_0xde26('0x34')]=null;_0x2241a3['resetPasswordExpires']=null;return _0x2241a3[_0xde26('0x42')]();})['then'](function(){_0x1ca9e1[_0xde26('0x3c')](0xc8)['send']({'message':_0xde26('0x43')});})['catch'](function(_0x222515){return handleError(_0x1ca9e1,0x1f4,_0x222515);});};passport[_0xde26('0x44')](new LocalStrategy({'usernameField':_0xde26('0x25'),'passwordField':_0xde26('0x41')},function(_0x4e3b53,_0x272eb1,_0x12be54){return localAuthenticate(db[_0xde26('0xd')],_0x4e3b53,_0x272eb1,_0x12be54);})); \ No newline at end of file +var _0xdd89=['getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','find','trim','admin','This\x20name\x20is\x20not\x20registered.','authenticate','MailAccount','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','secure','authentication','user','pass','merge','format','\x22%s\x22\x20<%s>','name','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','stringify','status','send','message','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','generate','toLowerCase','This\x20email\x20is\x20not\x20registered.','resetPasswordToken','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','password','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','bluebird','lodash','../../config/logger','api','randomstring','../../mysqldb','../../components/auth/service','signToken','client','http','role','agent','User','count','then','../../config/license/util'];(function(_0x3f349f,_0x5ef575){var _0x304cd6=function(_0x43206e){while(--_0x43206e){_0x3f349f['push'](_0x3f349f['shift']());}};_0x304cd6(++_0x5ef575);}(_0xdd89,0x86));var _0x9dd8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xdd89[_0x45b034];return _0x509cb0;};'use strict';var util=require(_0x9dd8('0x0'));var passport=require(_0x9dd8('0x1'));var LocalStrategy=require(_0x9dd8('0x2'))[_0x9dd8('0x3')];var BPromise=require(_0x9dd8('0x4'));var jayson=require('jayson/promise');var _=require(_0x9dd8('0x5'));var logger=require(_0x9dd8('0x6'))(_0x9dd8('0x7'));var rs=require(_0x9dd8('0x8'));var db=require(_0x9dd8('0x9'))['db'];var signToken=require(_0x9dd8('0xa'))[_0x9dd8('0xb')];var client=jayson[_0x9dd8('0xc')][_0x9dd8('0xd')]({'port':0x232b});var getLicense=function(_0x1785a3){return new BPromise(function(_0x4ac891,_0x19de70){var _0x361c33=0x0;_0x1785a3[_0x9dd8('0xe')]!==_0x9dd8('0xf')&&_0x4ac891(_0x1785a3);return db[_0x9dd8('0x10')][_0x9dd8('0x11')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x1785a3['id']}}})[_0x9dd8('0x12')](function(_0xe0dc6b){_0x361c33=_0xe0dc6b;return require(_0x9dd8('0x13'))[_0x9dd8('0x14')]();})[_0x9dd8('0x12')](function(_0x29fe46){if(_0x29fe46&&_0x29fe46['agents']&&_0x361c33>=_0x29fe46[_0x9dd8('0x15')]){return _0x19de70({'message':_0x9dd8('0x16')});}return _0x4ac891(_0x1785a3);})[_0x9dd8('0x17')](function(_0x4e19d9){return _0x19de70(_0x4e19d9);});});};function localAuthenticate(_0x52ec62,_0x171817,_0x15486d,_0x5b1eec){var _0xa5ef05;_0x52ec62[_0x9dd8('0x18')]({'where':{'name':_0x171817[_0x9dd8('0x19')](),'role':{'$or':[_0x9dd8('0x1a'),'user',_0x9dd8('0xf')]}}})['then'](function(_0x114d15){if(!_0x114d15){return _0x5b1eec(null,![],{'message':_0x9dd8('0x1b')});}return getLicense(_0x114d15);})[_0x9dd8('0x12')](function(_0x181165){_0x181165[_0x9dd8('0x1c')](_0x15486d,function(_0x237624,_0x39954a){if(_0x237624){return _0x5b1eec(_0x237624);}if(!_0x39954a){return _0x5b1eec(null,![],{'message':'This\x20password\x20is\x20not\x20correct.'});}else{return _0x5b1eec(null,_0x181165);}});})[_0x9dd8('0x17')](function(_0x331e36){_0x5b1eec(_0x331e36);});}function sendServiceMail(_0x1b602e){return db[_0x9dd8('0x1d')][_0x9dd8('0x18')]({'where':{'service':!![]},'attributes':['id','name',_0x9dd8('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x9dd8('0x1f')}]})[_0x9dd8('0x12')](function(_0x533131){if(!_0x533131){throw new Error(_0x9dd8('0x20'));}var _0x484af3={'tls':{'rejectUnauthorized':![]}};if(_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x21')]){_0x484af3[_0x9dd8('0x21')]=_0x533131[_0x9dd8('0x1f')]['service'];}else{_0x484af3[_0x9dd8('0x22')]=_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x22')];_0x484af3['port']=_0x533131[_0x9dd8('0x1f')]['port'];_0x484af3[_0x9dd8('0x23')]=_0x533131['Smtp'][_0x9dd8('0x23')];}if(_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x24')]){_0x484af3['auth']={'user':_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x25')],'pass':_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x26')]};}var _0x20d35f={'account':_0x484af3,'message':_[_0x9dd8('0x27')]({'from':util[_0x9dd8('0x28')](_0x9dd8('0x29'),_0x533131[_0x9dd8('0x2a')],_0x533131[_0x9dd8('0x1e')]||_0x533131[_0x9dd8('0x1f')][_0x9dd8('0x25')])},_0x1b602e)};return client['request'](_0x9dd8('0x2b'),_0x20d35f);})[_0x9dd8('0x12')](function(_0x40e3f3){if(_0x40e3f3['error']){throw new Error(util[_0x9dd8('0x28')](_0x9dd8('0x2c'),_0x40e3f3[_0x9dd8('0x2d')]['message']||JSON[_0x9dd8('0x2e')](_0x40e3f3['error'])));}return!![];});}function handleError(_0x31e840,_0x372882,_0x4a0588){return _0x31e840[_0x9dd8('0x2f')](_0x372882||0x1f4)[_0x9dd8('0x30')]({'message':_0x4a0588?_0x4a0588[_0x9dd8('0x31')]||_0x4a0588:''});}exports[_0x9dd8('0x32')]=function(_0x28dfe7,_0x7aeceb,_0x1a9366){passport[_0x9dd8('0x1c')](_0x9dd8('0x33'),function(_0x56983a,_0x4d542e,_0xda6c02){var _0x28938d=_0x56983a||_0xda6c02;if(_0x28938d){return handleError(_0x7aeceb,0x191,_0x28938d);}if(!_0x4d542e){return handleError(_0x7aeceb,0x194,{'message':_0x9dd8('0x34')});}var _0x1da158=signToken(_0x4d542e['id'],_0x4d542e['role']);_0x7aeceb[_0x9dd8('0x35')]({'id':_0x4d542e['id'],'token':_0x1da158,'statusCall':'','isAlreadyLogged':_0x4d542e[_0x9dd8('0x36')]});})(_0x28dfe7,_0x7aeceb,_0x1a9366);};exports[_0x9dd8('0x37')]=function(_0x3bc2a0,_0x2aef8f,_0xbac7f){if(!_0x3bc2a0[_0x9dd8('0x38')][_0x9dd8('0x1e')]){return handleError(_0x2aef8f,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1dc316=rs[_0x9dd8('0x39')]();_0x3bc2a0['body'][_0x9dd8('0x1e')]=_0x3bc2a0[_0x9dd8('0x38')][_0x9dd8('0x1e')][_0x9dd8('0x19')]()[_0x9dd8('0x3a')]();return db[_0x9dd8('0x10')][_0x9dd8('0x18')]({'where':{'email':_0x3bc2a0[_0x9dd8('0x38')]['email']}})['then'](function(_0x424bb0){if(!_0x424bb0){throw new Error(_0x9dd8('0x3b'));}_0x424bb0[_0x9dd8('0x3c')]=_0x1dc316;_0x424bb0['resetPasswordExpires']=Date[_0x9dd8('0x3d')]()+0x36ee80;return _0x424bb0[_0x9dd8('0x3e')]();})[_0x9dd8('0x12')](function(){return sendServiceMail({'to':_0x3bc2a0['body']['email'],'subject':_0x9dd8('0x3f'),'text':_0x9dd8('0x40')+_0x9dd8('0x41')+_0x9dd8('0x42')+_0x3bc2a0[_0x9dd8('0x43')][_0x9dd8('0x22')]+'/reset/'+_0x1dc316+'\x0a\x0a'+_0x9dd8('0x44')});})[_0x9dd8('0x12')](function(){_0x2aef8f[_0x9dd8('0x2f')](0xc8)[_0x9dd8('0x30')]({'message':_0x9dd8('0x45')});})[_0x9dd8('0x17')](function(_0x13bff9){return handleError(_0x2aef8f,0x1f4,_0x13bff9);});};exports[_0x9dd8('0x46')]=function(_0x151077,_0x18d8eb,_0x313234){return db['User'][_0x9dd8('0x18')]({'where':{'resetPasswordToken':_0x151077[_0x9dd8('0x47')][_0x9dd8('0x48')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x9dd8('0x12')](function(_0x25baae){if(!_0x25baae){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}_0x25baae[_0x9dd8('0x49')]=_0x151077['body']['password'];_0x25baae[_0x9dd8('0x3c')]=null;_0x25baae[_0x9dd8('0x4a')]=null;return _0x25baae['save']();})[_0x9dd8('0x12')](function(){_0x18d8eb['status'](0xc8)[_0x9dd8('0x30')]({'message':_0x9dd8('0x4b')});})[_0x9dd8('0x17')](function(_0x278415){return handleError(_0x18d8eb,0x1f4,_0x278415);});};passport[_0x9dd8('0x4c')](new LocalStrategy({'usernameField':'name','passwordField':_0x9dd8('0x49')},function(_0x58b136,_0x36f1f7,_0x30774f){return localAuthenticate(db['User'],_0x58b136,_0x36f1f7,_0x30774f);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 8d4f246..47fad47 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 _0x6314=['forgot','reset','exports','Router','post','login'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6314,0x195));var _0x4631=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0x6314[_0x934425];return _0x31d596;};'use strict';var express=require('express');var router=express[_0x4631('0x0')]();var controller=require('./authLocal.controller');router[_0x4631('0x1')]('/',controller[_0x4631('0x2')]);router['post']('/forgot',controller[_0x4631('0x3')]);router['post']('/reset/:token',controller[_0x4631('0x4')]);module[_0x4631('0x5')]=router; \ No newline at end of file +var _0xc3d8=['exports','express','Router','./authLocal.controller','post','login','/forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3d8,0x1b3));var _0x8c3d=function(_0x337db7,_0x25f94c){_0x337db7=_0x337db7-0x0;var _0x1733ba=_0xc3d8[_0x337db7];return _0x1733ba;};'use strict';var express=require(_0x8c3d('0x0'));var router=express[_0x8c3d('0x1')]();var controller=require(_0x8c3d('0x2'));router[_0x8c3d('0x3')]('/',controller[_0x8c3d('0x4')]);router[_0x8c3d('0x3')](_0x8c3d('0x5'),controller['forgot']);router[_0x8c3d('0x3')]('/reset/:token',controller['reset']);module[_0x8c3d('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 7692912..e6dced0 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 _0x9972=['STRING','BOOLEAN','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9972,0xaa));var _0x2997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9972[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x2997('0x0'));module[_0x2997('0x1')]={'name':{'type':Sequelize[_0x2997('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2997('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x2997('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x13cf=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3a081b,_0x516437){var _0xb166c4=function(_0x22bc5d){while(--_0x22bc5d){_0x3a081b['push'](_0x3a081b['shift']());}};_0xb166c4(++_0x516437);}(_0x13cf,0x11d));var _0xf13c=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x13cf[_0x2d8fc2];return _0x3a9e53;};'use strict';var Sequelize=require(_0xf13c('0x0'));module[_0xf13c('0x1')]={'name':{'type':Sequelize[_0xf13c('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf13c('0x2')]},'status':{'type':Sequelize[_0xf13c('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf13c('0x4')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index de163c6..e488294 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 _0x67a9=['update','then','destroy','end','error','stack','name','send','index','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','Automation','includeAll','include','rows','catch','params','options','find','create','body','addConditions','Condition','ids','getConditions','findOne','rawAttributes','order','map','filter','addActions','Action','getActions','fast-json-patch','request-promise','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','json','reject'];(function(_0xc2c353,_0x41a5a3){var _0x806605=function(_0x439e06){while(--_0x439e06){_0xc2c353['push'](_0xc2c353['shift']());}};_0x806605(++_0x41a5a3);}(_0x67a9,0x79));var _0x967a=function(_0x2603b3,_0x20c3e7){_0x2603b3=_0x2603b3-0x0;var _0x1a0d1a=_0x67a9[_0x2603b3];return _0x1a0d1a;};'use strict';var jsonpatch=require(_0x967a('0x0'));var rp=require(_0x967a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x967a('0x2'));var path=require(_0x967a('0x3'));var sox=require(_0x967a('0x4'));var csv=require(_0x967a('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x967a('0x6'));var squel=require('squel');var crypto=require(_0x967a('0x7'));var jsforce=require(_0x967a('0x8'));var deskjs=require(_0x967a('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x967a('0xa'));var qs=require(_0x967a('0xb'));var logger=require(_0x967a('0xc'))(_0x967a('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x967a('0xe'))['db'];function respondWithStatusCode(_0x4f495f,_0x588e71){_0x588e71=_0x588e71||0xcc;return function(_0x17ae7a){if(_0x17ae7a){return _0x4f495f[_0x967a('0xf')](_0x588e71);}return _0x4f495f[_0x967a('0x10')](_0x588e71)['end']();};}function respondWithResult(_0x5bee9a,_0x31ebc6){_0x31ebc6=_0x31ebc6||0xc8;return function(_0x3e2fc5){if(_0x3e2fc5){return _0x5bee9a[_0x967a('0x10')](_0x31ebc6)['json'](_0x3e2fc5);}};}function respondWithFilteredResult(_0x54badc,_0x2beebc){return function(_0x14a31a){if(_0x14a31a){var _0x255c54=_0x14a31a[_0x967a('0x11')],_0x1d8cd0=_0x2beebc['offset'],_0x1932c4=_0x2beebc[_0x967a('0x12')]+_0x2beebc[_0x967a('0x13')],_0x56cb4e;if(_0x1932c4>=_0x255c54){_0x1932c4=_0x255c54;_0x56cb4e=0xc8;}else{_0x56cb4e=0xce;}_0x54badc[_0x967a('0x10')](_0x56cb4e);return _0x54badc['set'](_0x967a('0x14'),_0x1d8cd0+'-'+_0x1932c4+'/'+_0x255c54)[_0x967a('0x15')](_0x14a31a);}return null;};}function patchUpdates(_0x21aac9){return function(_0x2e61d9){try{jsonpatch['apply'](_0x2e61d9,_0x21aac9,!![]);}catch(_0x1ad9e0){return BPromise[_0x967a('0x16')](_0x1ad9e0);}return _0x2e61d9['save']();};}function saveUpdates(_0x45a4ec,_0x4be115){return function(_0x37d9de){if(_0x37d9de){return _0x37d9de[_0x967a('0x17')](_0x45a4ec)[_0x967a('0x18')](function(_0x48c890){return _0x48c890;});}return null;};}function removeEntity(_0x17d0d0,_0xc49751){return function(_0x3bfc63){if(_0x3bfc63){return _0x3bfc63[_0x967a('0x19')]()[_0x967a('0x18')](function(){_0x17d0d0['status'](0xcc)[_0x967a('0x1a')]();});}};}function handleEntityNotFound(_0x2ea82a,_0x292eb6){return function(_0x3aebd9){if(!_0x3aebd9){_0x2ea82a[_0x967a('0xf')](0x194);}return _0x3aebd9;};}function handleError(_0x36ca93,_0x327c85){_0x327c85=_0x327c85||0x1f4;return function(_0x23a8f1){logger[_0x967a('0x1b')](_0x23a8f1[_0x967a('0x1c')]);if(_0x23a8f1[_0x967a('0x1d')]){delete _0x23a8f1[_0x967a('0x1d')];}_0x36ca93['status'](_0x327c85)[_0x967a('0x1e')](_0x23a8f1);};}exports[_0x967a('0x1f')]=function(_0x2b41e7,_0x406d45){var _0xc3e03={},_0x107e0b={},_0x2d3143={'count':0x0,'rows':[]};var _0x318c4e=db['Automation']['rawAttributes'];_0x107e0b[_0x967a('0x20')]=_[_0x967a('0x21')](_0x318c4e);var _0x1a3d79={'dateStart':_0x2b41e7[_0x967a('0x22')][_0x967a('0x23')],'dateEnd':_0x2b41e7[_0x967a('0x22')][_0x967a('0x24')]};delete _0x2b41e7['query'][_0x967a('0x23')];delete _0x2b41e7[_0x967a('0x22')][_0x967a('0x24')];_0x107e0b['query']=_[_0x967a('0x21')](_0x2b41e7['query']);_0x107e0b[_0x967a('0x25')]=_[_0x967a('0x26')](_0x107e0b[_0x967a('0x20')],_0x107e0b[_0x967a('0x22')]);_0xc3e03[_0x967a('0x27')]=_[_0x967a('0x26')](_0x107e0b[_0x967a('0x20')],qs[_0x967a('0x28')](_0x2b41e7[_0x967a('0x22')]['fields']));_0xc3e03[_0x967a('0x27')]=_0xc3e03['attributes'][_0x967a('0x29')]?_0xc3e03[_0x967a('0x27')]:_0x107e0b[_0x967a('0x20')];if(!_0x2b41e7[_0x967a('0x22')][_0x967a('0x2a')](_0x967a('0x2b'))){_0xc3e03[_0x967a('0x13')]=qs['limit'](_0x2b41e7['query']['limit']);_0xc3e03[_0x967a('0x12')]=qs[_0x967a('0x12')](_0x2b41e7['query'][_0x967a('0x12')]);}_0xc3e03['order']=qs[_0x967a('0x2c')](_0x2b41e7[_0x967a('0x22')][_0x967a('0x2c')]);_0xc3e03[_0x967a('0x2d')]=qs[_0x967a('0x25')](_[_0x967a('0x2e')](_0x2b41e7[_0x967a('0x22')],_0x107e0b['filters']));if(_0x1a3d79[_0x967a('0x23')]){if(_0x1a3d79[_0x967a('0x24')]){_0x1a3d79[_0x967a('0x24')]=moment(_0x1a3d79[_0x967a('0x24')])[_0x967a('0x2f')](0x1,'day');}else{_0x1a3d79[_0x967a('0x24')]=moment(_0x1a3d79['dateStart'])[_0x967a('0x2f')](0x1,_0x967a('0x30'));}_[_0x967a('0x31')](_0xc3e03[_0x967a('0x2d')],{'createdAt':{'$gte':_0x1a3d79[_0x967a('0x23')],'$lte':_0x1a3d79[_0x967a('0x24')]}});}if(_0x2b41e7[_0x967a('0x22')]['filter']){_0xc3e03['where']=_['merge'](_0xc3e03[_0x967a('0x2d')],{'$or':_['map'](_0xc3e03[_0x967a('0x27')],function(_0x1ed574){var _0x208ad9={};_0x208ad9[_0x1ed574]={'$like':'%'+_0x2b41e7[_0x967a('0x22')]['filter']+'%'};return _0x208ad9;})});}_0xc3e03=_[_0x967a('0x31')]({},_0xc3e03,_0x2b41e7['options']);var _0x435850={'where':_0xc3e03['where']};return db[_0x967a('0x32')]['count'](_0x435850)[_0x967a('0x18')](function(_0x3537fb){_0x2d3143[_0x967a('0x11')]=_0x3537fb;if(_0x2b41e7[_0x967a('0x22')][_0x967a('0x33')]){_0xc3e03[_0x967a('0x34')]=[{'all':!![]}];}return db[_0x967a('0x32')]['findAll'](_0xc3e03);})[_0x967a('0x18')](function(_0x27d0d4){_0x2d3143[_0x967a('0x35')]=_0x27d0d4;return _0x2d3143;})[_0x967a('0x18')](respondWithFilteredResult(_0x406d45,_0xc3e03))[_0x967a('0x36')](handleError(_0x406d45,null));};exports['show']=function(_0x493b40,_0x54b99f){var _0xac0251={'raw':![],'where':{'id':_0x493b40[_0x967a('0x37')]['id']}},_0x2ba30d={};_0x2ba30d[_0x967a('0x20')]=_['keys'](db['Automation']['rawAttributes']);_0x2ba30d[_0x967a('0x22')]=_[_0x967a('0x21')](_0x493b40[_0x967a('0x22')]);_0x2ba30d[_0x967a('0x25')]=_[_0x967a('0x26')](_0x2ba30d[_0x967a('0x20')],_0x2ba30d['query']);_0xac0251[_0x967a('0x27')]=_[_0x967a('0x26')](_0x2ba30d[_0x967a('0x20')],qs[_0x967a('0x28')](_0x493b40[_0x967a('0x22')][_0x967a('0x28')]));_0xac0251[_0x967a('0x27')]=_0xac0251[_0x967a('0x27')][_0x967a('0x29')]?_0xac0251['attributes']:_0x2ba30d['model'];if(_0x493b40[_0x967a('0x22')][_0x967a('0x33')]){_0xac0251['include']=[{'all':!![]}];}_0xac0251=_['merge']({},_0xac0251,_0x493b40[_0x967a('0x38')]);return db['Automation'][_0x967a('0x39')](_0xac0251)['then'](handleEntityNotFound(_0x54b99f,null))[_0x967a('0x18')](respondWithResult(_0x54b99f,null))['catch'](handleError(_0x54b99f,null));};exports[_0x967a('0x3a')]=function(_0x495204,_0x3ea5b0){return db[_0x967a('0x32')]['create'](_0x495204[_0x967a('0x3b')],{})[_0x967a('0x18')](respondWithResult(_0x3ea5b0,0xc9))[_0x967a('0x36')](handleError(_0x3ea5b0,null));};exports['update']=function(_0x5b7b4b,_0x4ccefd){if(_0x5b7b4b[_0x967a('0x3b')]['id']){delete _0x5b7b4b[_0x967a('0x3b')]['id'];}return db[_0x967a('0x32')][_0x967a('0x39')]({'where':{'id':_0x5b7b4b[_0x967a('0x37')]['id']}})[_0x967a('0x18')](handleEntityNotFound(_0x4ccefd,null))[_0x967a('0x18')](saveUpdates(_0x5b7b4b[_0x967a('0x3b')],null))[_0x967a('0x18')](respondWithResult(_0x4ccefd,null))[_0x967a('0x36')](handleError(_0x4ccefd,null));};exports[_0x967a('0x19')]=function(_0x3dc62a,_0x4c2aba){return db[_0x967a('0x32')][_0x967a('0x39')]({'where':{'id':_0x3dc62a[_0x967a('0x37')]['id']}})[_0x967a('0x18')](handleEntityNotFound(_0x4c2aba,null))['then'](removeEntity(_0x4c2aba,null))['catch'](handleError(_0x4c2aba,null));};exports[_0x967a('0x3c')]=function(_0x10e05,_0x44bdfd,_0x269807){return db[_0x967a('0x3d')][_0x967a('0x39')]({'where':{'id':_0x10e05[_0x967a('0x37')]['id']}})[_0x967a('0x18')](handleEntityNotFound(_0x44bdfd,null))[_0x967a('0x18')](function(_0x270362){if(_0x270362){return _0x270362[_0x967a('0x3c')](_0x10e05[_0x967a('0x3b')][_0x967a('0x3e')],_['omit'](_0x10e05[_0x967a('0x3b')],[_0x967a('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x44bdfd,null))[_0x967a('0x36')](handleError(_0x44bdfd,null));};exports[_0x967a('0x3f')]=function(_0x157301,_0x4e82cd,_0x226be3){var _0x3acc97={};var _0x711a29={};var _0x405763;var _0x45132d;return db[_0x967a('0x32')][_0x967a('0x40')]({'where':{'id':_0x157301[_0x967a('0x37')]['id']}})['then'](handleEntityNotFound(_0x4e82cd,null))[_0x967a('0x18')](function(_0x3ce868){if(_0x3ce868){_0x405763=_0x3ce868;_0x711a29['model']=_[_0x967a('0x21')](db['Condition'][_0x967a('0x41')]);_0x711a29[_0x967a('0x22')]=_['keys'](_0x157301['query']);_0x711a29[_0x967a('0x25')]=_['intersection'](_0x711a29['model'],_0x711a29['query']);_0x3acc97[_0x967a('0x27')]=_[_0x967a('0x26')](_0x711a29[_0x967a('0x20')],qs['fields'](_0x157301[_0x967a('0x22')][_0x967a('0x28')]));_0x3acc97['attributes']=_0x3acc97['attributes'][_0x967a('0x29')]?_0x3acc97[_0x967a('0x27')]:_0x711a29[_0x967a('0x20')];_0x3acc97[_0x967a('0x42')]=qs[_0x967a('0x2c')](_0x157301[_0x967a('0x22')]['sort']);_0x3acc97['where']=qs[_0x967a('0x25')](_[_0x967a('0x2e')](_0x157301[_0x967a('0x22')],_0x711a29[_0x967a('0x25')]));if(_0x157301[_0x967a('0x22')]['filter']){_0x3acc97[_0x967a('0x2d')]=_[_0x967a('0x31')](_0x3acc97['where'],{'$or':_[_0x967a('0x43')](_0x3acc97[_0x967a('0x27')],function(_0x5ac8c1){var _0x4a7175={};_0x4a7175[_0x5ac8c1]={'$like':'%'+_0x157301['query'][_0x967a('0x44')]+'%'};return _0x4a7175;})});}_0x3acc97=_[_0x967a('0x31')]({},_0x3acc97,_0x157301[_0x967a('0x38')]);return _0x405763[_0x967a('0x3f')](_0x3acc97);}})[_0x967a('0x18')](function(_0x6ff3a0){if(_0x6ff3a0){_0x45132d=_0x6ff3a0[_0x967a('0x29')];if(!_0x157301[_0x967a('0x22')][_0x967a('0x2a')](_0x967a('0x2b'))){_0x3acc97[_0x967a('0x13')]=qs[_0x967a('0x13')](_0x157301[_0x967a('0x22')][_0x967a('0x13')]);_0x3acc97[_0x967a('0x12')]=qs[_0x967a('0x12')](_0x157301[_0x967a('0x22')][_0x967a('0x12')]);}return _0x405763[_0x967a('0x3f')](_0x3acc97);}})['then'](function(_0x63271e){if(_0x63271e){return _0x63271e?{'count':_0x45132d,'rows':_0x63271e}:null;}})[_0x967a('0x18')](respondWithResult(_0x4e82cd,null))[_0x967a('0x36')](handleError(_0x4e82cd,null));};exports[_0x967a('0x45')]=function(_0x28afa5,_0x3a74e3,_0x39e648){return db[_0x967a('0x46')][_0x967a('0x39')]({'where':{'id':_0x28afa5[_0x967a('0x37')]['id']}})['then'](handleEntityNotFound(_0x3a74e3,null))['then'](function(_0x146338){if(_0x146338){return _0x146338[_0x967a('0x45')](_0x28afa5[_0x967a('0x3b')][_0x967a('0x3e')],_['omit'](_0x28afa5['body'],[_0x967a('0x3e'),'id'])||{});}})[_0x967a('0x18')](respondWithResult(_0x3a74e3,null))[_0x967a('0x36')](handleError(_0x3a74e3,null));};exports[_0x967a('0x47')]=function(_0x17a37b,_0x354d4e,_0x16f6b9){var _0x3e00a5={};var _0x460dd4={};var _0x21c022;var _0x5dffe6;return db[_0x967a('0x32')][_0x967a('0x40')]({'where':{'id':_0x17a37b['params']['id']}})['then'](handleEntityNotFound(_0x354d4e,null))[_0x967a('0x18')](function(_0x44ead4){if(_0x44ead4){_0x21c022=_0x44ead4;_0x460dd4['model']=_['keys'](db[_0x967a('0x46')]['rawAttributes']);_0x460dd4['query']=_[_0x967a('0x21')](_0x17a37b[_0x967a('0x22')]);_0x460dd4[_0x967a('0x25')]=_[_0x967a('0x26')](_0x460dd4[_0x967a('0x20')],_0x460dd4[_0x967a('0x22')]);_0x3e00a5[_0x967a('0x27')]=_['intersection'](_0x460dd4[_0x967a('0x20')],qs['fields'](_0x17a37b[_0x967a('0x22')][_0x967a('0x28')]));_0x3e00a5[_0x967a('0x27')]=_0x3e00a5[_0x967a('0x27')][_0x967a('0x29')]?_0x3e00a5[_0x967a('0x27')]:_0x460dd4[_0x967a('0x20')];_0x3e00a5['order']=qs['sort'](_0x17a37b['query'][_0x967a('0x2c')]);_0x3e00a5[_0x967a('0x2d')]=qs[_0x967a('0x25')](_[_0x967a('0x2e')](_0x17a37b[_0x967a('0x22')],_0x460dd4['filters']));if(_0x17a37b[_0x967a('0x22')][_0x967a('0x44')]){_0x3e00a5[_0x967a('0x2d')]=_['merge'](_0x3e00a5[_0x967a('0x2d')],{'$or':_['map'](_0x3e00a5[_0x967a('0x27')],function(_0x5f4ca0){var _0x5e4cc6={};_0x5e4cc6[_0x5f4ca0]={'$like':'%'+_0x17a37b['query'][_0x967a('0x44')]+'%'};return _0x5e4cc6;})});}_0x3e00a5=_[_0x967a('0x31')]({},_0x3e00a5,_0x17a37b[_0x967a('0x38')]);return _0x21c022['getActions'](_0x3e00a5);}})[_0x967a('0x18')](function(_0x676823){if(_0x676823){_0x5dffe6=_0x676823['length'];if(!_0x17a37b[_0x967a('0x22')][_0x967a('0x2a')]('nolimit')){_0x3e00a5[_0x967a('0x13')]=qs[_0x967a('0x13')](_0x17a37b[_0x967a('0x22')][_0x967a('0x13')]);_0x3e00a5[_0x967a('0x12')]=qs[_0x967a('0x12')](_0x17a37b[_0x967a('0x22')][_0x967a('0x12')]);}return _0x21c022[_0x967a('0x47')](_0x3e00a5);}})[_0x967a('0x18')](function(_0x148ed9){if(_0x148ed9){return _0x148ed9?{'count':_0x5dffe6,'rows':_0x148ed9}:null;}})['then'](respondWithResult(_0x354d4e,null))[_0x967a('0x36')](handleError(_0x354d4e,null));}; \ No newline at end of file +var _0xf5bf=['sox','to-csv','lodash','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','save','update','then','destroy','sendStatus','name','send','index','Automation','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','include','catch','show','includeAll','options','find','create','body','params','addConditions','ids','omit','getConditions','Condition','addActions','getActions','findOne','Action','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x39af5b,_0x35a505){var _0x11dfbf=function(_0x498017){while(--_0x498017){_0x39af5b['push'](_0x39af5b['shift']());}};_0x11dfbf(++_0x35a505);}(_0xf5bf,0xd0));var _0xff5b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf5bf[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xff5b('0x0'));var rp=require('request-promise');var moment=require(_0xff5b('0x1'));var BPromise=require(_0xff5b('0x2'));var Mustache=require(_0xff5b('0x3'));var util=require(_0xff5b('0x4'));var path=require('path');var sox=require(_0xff5b('0x5'));var csv=require(_0xff5b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xff5b('0x7'));var squel=require('squel');var crypto=require(_0xff5b('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xff5b('0x9'));var toCsv=require(_0xff5b('0x6'));var querystring=require(_0xff5b('0xa'));var Papa=require('papaparse');var qs=require(_0xff5b('0xb'));var logger=require(_0xff5b('0xc'))(_0xff5b('0xd'));var utils=require('../../config/utils');var config=require(_0xff5b('0xe'));var db=require(_0xff5b('0xf'))['db'];function respondWithStatusCode(_0x1b2114,_0x4454cc){_0x4454cc=_0x4454cc||0xcc;return function(_0x18bdff){if(_0x18bdff){return _0x1b2114['sendStatus'](_0x4454cc);}return _0x1b2114[_0xff5b('0x10')](_0x4454cc)['end']();};}function respondWithResult(_0x451fc3,_0x15f4ec){_0x15f4ec=_0x15f4ec||0xc8;return function(_0x22ae50){if(_0x22ae50){return _0x451fc3[_0xff5b('0x10')](_0x15f4ec)[_0xff5b('0x11')](_0x22ae50);}};}function respondWithFilteredResult(_0x3186b4,_0x5733c4){return function(_0x21f45e){if(_0x21f45e){var _0x4ce649=_0x21f45e[_0xff5b('0x12')],_0x3996d2=_0x5733c4['offset'],_0x5cc29b=_0x5733c4[_0xff5b('0x13')]+_0x5733c4[_0xff5b('0x14')],_0x2481b6;if(_0x5cc29b>=_0x4ce649){_0x5cc29b=_0x4ce649;_0x2481b6=0xc8;}else{_0x2481b6=0xce;}_0x3186b4['status'](_0x2481b6);return _0x3186b4[_0xff5b('0x15')]('Content-Range',_0x3996d2+'-'+_0x5cc29b+'/'+_0x4ce649)[_0xff5b('0x11')](_0x21f45e);}return null;};}function patchUpdates(_0x57dc91){return function(_0x354571){try{jsonpatch['apply'](_0x354571,_0x57dc91,!![]);}catch(_0x30067f){return BPromise['reject'](_0x30067f);}return _0x354571[_0xff5b('0x16')]();};}function saveUpdates(_0x7eb1b2,_0x3b3474){return function(_0x4954ec){if(_0x4954ec){return _0x4954ec[_0xff5b('0x17')](_0x7eb1b2)[_0xff5b('0x18')](function(_0x14d58b){return _0x14d58b;});}return null;};}function removeEntity(_0x5086cf,_0x38b6a8){return function(_0x328dba){if(_0x328dba){return _0x328dba[_0xff5b('0x19')]()[_0xff5b('0x18')](function(){_0x5086cf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b394c,_0x5a3d3d){return function(_0xf3a28b){if(!_0xf3a28b){_0x5b394c[_0xff5b('0x1a')](0x194);}return _0xf3a28b;};}function handleError(_0xc7d4a3,_0x2a031a){_0x2a031a=_0x2a031a||0x1f4;return function(_0x5b572e){logger['error'](_0x5b572e['stack']);if(_0x5b572e['name']){delete _0x5b572e[_0xff5b('0x1b')];}_0xc7d4a3[_0xff5b('0x10')](_0x2a031a)[_0xff5b('0x1c')](_0x5b572e);};}exports[_0xff5b('0x1d')]=function(_0x356f3a,_0xd0b72c){var _0x5c3484={},_0x564c42={},_0x2eafa2={'count':0x0,'rows':[]};var _0x2ff7b3=db[_0xff5b('0x1e')][_0xff5b('0x1f')];_0x564c42[_0xff5b('0x20')]=_[_0xff5b('0x21')](_0x2ff7b3);var _0x2efc28={'dateStart':_0x356f3a[_0xff5b('0x22')][_0xff5b('0x23')],'dateEnd':_0x356f3a[_0xff5b('0x22')][_0xff5b('0x24')]};delete _0x356f3a[_0xff5b('0x22')]['dateStart'];delete _0x356f3a[_0xff5b('0x22')]['dateEnd'];_0x564c42[_0xff5b('0x22')]=_[_0xff5b('0x21')](_0x356f3a[_0xff5b('0x22')]);_0x564c42[_0xff5b('0x25')]=_['intersection'](_0x564c42[_0xff5b('0x20')],_0x564c42[_0xff5b('0x22')]);_0x5c3484['attributes']=_[_0xff5b('0x26')](_0x564c42['model'],qs[_0xff5b('0x27')](_0x356f3a[_0xff5b('0x22')]['fields']));_0x5c3484[_0xff5b('0x28')]=_0x5c3484[_0xff5b('0x28')][_0xff5b('0x29')]?_0x5c3484['attributes']:_0x564c42[_0xff5b('0x20')];if(!_0x356f3a[_0xff5b('0x22')][_0xff5b('0x2a')](_0xff5b('0x2b'))){_0x5c3484[_0xff5b('0x14')]=qs[_0xff5b('0x14')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x14')]);_0x5c3484[_0xff5b('0x13')]=qs[_0xff5b('0x13')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x13')]);}_0x5c3484[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x356f3a[_0xff5b('0x22')][_0xff5b('0x2d')]);_0x5c3484[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_[_0xff5b('0x2f')](_0x356f3a[_0xff5b('0x22')],_0x564c42[_0xff5b('0x25')]));if(_0x2efc28[_0xff5b('0x23')]){if(_0x2efc28[_0xff5b('0x24')]){_0x2efc28[_0xff5b('0x24')]=moment(_0x2efc28['dateEnd'])[_0xff5b('0x30')](0x1,'day');}else{_0x2efc28['dateEnd']=moment(_0x2efc28[_0xff5b('0x23')])[_0xff5b('0x30')](0x1,_0xff5b('0x31'));}_[_0xff5b('0x32')](_0x5c3484[_0xff5b('0x2e')],{'createdAt':{'$gte':_0x2efc28[_0xff5b('0x23')],'$lte':_0x2efc28[_0xff5b('0x24')]}});}if(_0x356f3a[_0xff5b('0x22')][_0xff5b('0x33')]){_0x5c3484[_0xff5b('0x2e')]=_[_0xff5b('0x32')](_0x5c3484['where'],{'$or':_[_0xff5b('0x34')](_0x5c3484[_0xff5b('0x28')],function(_0x4dfebe){var _0x2c0f2a={};_0x2c0f2a[_0x4dfebe]={'$like':'%'+_0x356f3a[_0xff5b('0x22')][_0xff5b('0x33')]+'%'};return _0x2c0f2a;})});}_0x5c3484=_[_0xff5b('0x32')]({},_0x5c3484,_0x356f3a['options']);var _0x1a95b3={'where':_0x5c3484[_0xff5b('0x2e')]};return db[_0xff5b('0x1e')][_0xff5b('0x12')](_0x1a95b3)[_0xff5b('0x18')](function(_0x5513dd){_0x2eafa2[_0xff5b('0x12')]=_0x5513dd;if(_0x356f3a[_0xff5b('0x22')]['includeAll']){_0x5c3484[_0xff5b('0x35')]=[{'all':!![]}];}return db[_0xff5b('0x1e')]['findAll'](_0x5c3484);})['then'](function(_0x31b590){_0x2eafa2['rows']=_0x31b590;return _0x2eafa2;})[_0xff5b('0x18')](respondWithFilteredResult(_0xd0b72c,_0x5c3484))[_0xff5b('0x36')](handleError(_0xd0b72c,null));};exports[_0xff5b('0x37')]=function(_0x417810,_0x586030){var _0x306aba={'raw':![],'where':{'id':_0x417810['params']['id']}},_0x3b5a2e={};_0x3b5a2e[_0xff5b('0x20')]=_[_0xff5b('0x21')](db[_0xff5b('0x1e')]['rawAttributes']);_0x3b5a2e[_0xff5b('0x22')]=_[_0xff5b('0x21')](_0x417810[_0xff5b('0x22')]);_0x3b5a2e[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x3b5a2e[_0xff5b('0x20')],_0x3b5a2e[_0xff5b('0x22')]);_0x306aba['attributes']=_[_0xff5b('0x26')](_0x3b5a2e['model'],qs[_0xff5b('0x27')](_0x417810['query'][_0xff5b('0x27')]));_0x306aba['attributes']=_0x306aba[_0xff5b('0x28')][_0xff5b('0x29')]?_0x306aba[_0xff5b('0x28')]:_0x3b5a2e['model'];if(_0x417810['query'][_0xff5b('0x38')]){_0x306aba[_0xff5b('0x35')]=[{'all':!![]}];}_0x306aba=_[_0xff5b('0x32')]({},_0x306aba,_0x417810[_0xff5b('0x39')]);return db[_0xff5b('0x1e')][_0xff5b('0x3a')](_0x306aba)[_0xff5b('0x18')](handleEntityNotFound(_0x586030,null))[_0xff5b('0x18')](respondWithResult(_0x586030,null))[_0xff5b('0x36')](handleError(_0x586030,null));};exports[_0xff5b('0x3b')]=function(_0x45bf01,_0x16143c){return db[_0xff5b('0x1e')][_0xff5b('0x3b')](_0x45bf01[_0xff5b('0x3c')],{})['then'](respondWithResult(_0x16143c,0xc9))['catch'](handleError(_0x16143c,null));};exports[_0xff5b('0x17')]=function(_0x5a5d67,_0x23fa34){if(_0x5a5d67['body']['id']){delete _0x5a5d67[_0xff5b('0x3c')]['id'];}return db['Automation']['find']({'where':{'id':_0x5a5d67['params']['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x23fa34,null))['then'](saveUpdates(_0x5a5d67['body'],null))[_0xff5b('0x18')](respondWithResult(_0x23fa34,null))[_0xff5b('0x36')](handleError(_0x23fa34,null));};exports[_0xff5b('0x19')]=function(_0x2b71e1,_0x4b27aa){return db[_0xff5b('0x1e')]['find']({'where':{'id':_0x2b71e1[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x4b27aa,null))['then'](removeEntity(_0x4b27aa,null))['catch'](handleError(_0x4b27aa,null));};exports[_0xff5b('0x3e')]=function(_0xd06797,_0x3b368c,_0x2a8842){return db['Condition'][_0xff5b('0x3a')]({'where':{'id':_0xd06797[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x3b368c,null))['then'](function(_0x39ad33){if(_0x39ad33){return _0x39ad33[_0xff5b('0x3e')](_0xd06797[_0xff5b('0x3c')][_0xff5b('0x3f')],_[_0xff5b('0x40')](_0xd06797[_0xff5b('0x3c')],[_0xff5b('0x3f'),'id'])||{});}})[_0xff5b('0x18')](respondWithResult(_0x3b368c,null))[_0xff5b('0x36')](handleError(_0x3b368c,null));};exports[_0xff5b('0x41')]=function(_0x4fd632,_0x777f6a,_0xd08927){var _0x3fe0e7={};var _0x251261={};var _0x178d14;var _0x27dcd5;return db[_0xff5b('0x1e')]['findOne']({'where':{'id':_0x4fd632['params']['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x777f6a,null))[_0xff5b('0x18')](function(_0x2a9e2b){if(_0x2a9e2b){_0x178d14=_0x2a9e2b;_0x251261['model']=_['keys'](db[_0xff5b('0x42')]['rawAttributes']);_0x251261[_0xff5b('0x22')]=_['keys'](_0x4fd632[_0xff5b('0x22')]);_0x251261[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x251261[_0xff5b('0x20')],_0x251261['query']);_0x3fe0e7['attributes']=_[_0xff5b('0x26')](_0x251261[_0xff5b('0x20')],qs[_0xff5b('0x27')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x27')]));_0x3fe0e7['attributes']=_0x3fe0e7[_0xff5b('0x28')][_0xff5b('0x29')]?_0x3fe0e7[_0xff5b('0x28')]:_0x251261[_0xff5b('0x20')];_0x3fe0e7[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x4fd632['query'][_0xff5b('0x2d')]);_0x3fe0e7[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_[_0xff5b('0x2f')](_0x4fd632[_0xff5b('0x22')],_0x251261[_0xff5b('0x25')]));if(_0x4fd632[_0xff5b('0x22')]['filter']){_0x3fe0e7['where']=_[_0xff5b('0x32')](_0x3fe0e7[_0xff5b('0x2e')],{'$or':_[_0xff5b('0x34')](_0x3fe0e7[_0xff5b('0x28')],function(_0x4efd93){var _0x3fdb5d={};_0x3fdb5d[_0x4efd93]={'$like':'%'+_0x4fd632['query'][_0xff5b('0x33')]+'%'};return _0x3fdb5d;})});}_0x3fe0e7=_[_0xff5b('0x32')]({},_0x3fe0e7,_0x4fd632[_0xff5b('0x39')]);return _0x178d14[_0xff5b('0x41')](_0x3fe0e7);}})[_0xff5b('0x18')](function(_0x57d726){if(_0x57d726){_0x27dcd5=_0x57d726[_0xff5b('0x29')];if(!_0x4fd632[_0xff5b('0x22')][_0xff5b('0x2a')](_0xff5b('0x2b'))){_0x3fe0e7[_0xff5b('0x14')]=qs[_0xff5b('0x14')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x14')]);_0x3fe0e7['offset']=qs[_0xff5b('0x13')](_0x4fd632[_0xff5b('0x22')][_0xff5b('0x13')]);}return _0x178d14[_0xff5b('0x41')](_0x3fe0e7);}})[_0xff5b('0x18')](function(_0x4d1b87){if(_0x4d1b87){return _0x4d1b87?{'count':_0x27dcd5,'rows':_0x4d1b87}:null;}})[_0xff5b('0x18')](respondWithResult(_0x777f6a,null))['catch'](handleError(_0x777f6a,null));};exports[_0xff5b('0x43')]=function(_0x4a43a6,_0x4f79ab,_0x548460){return db['Action'][_0xff5b('0x3a')]({'where':{'id':_0x4a43a6[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x4f79ab,null))[_0xff5b('0x18')](function(_0x2fe10e){if(_0x2fe10e){return _0x2fe10e[_0xff5b('0x43')](_0x4a43a6[_0xff5b('0x3c')][_0xff5b('0x3f')],_[_0xff5b('0x40')](_0x4a43a6[_0xff5b('0x3c')],['ids','id'])||{});}})[_0xff5b('0x18')](respondWithResult(_0x4f79ab,null))[_0xff5b('0x36')](handleError(_0x4f79ab,null));};exports[_0xff5b('0x44')]=function(_0x4c4709,_0x5807fc,_0x2cf3f8){var _0x176d5f={};var _0x85271={};var _0xda0033;var _0x156342;return db[_0xff5b('0x1e')][_0xff5b('0x45')]({'where':{'id':_0x4c4709[_0xff5b('0x3d')]['id']}})[_0xff5b('0x18')](handleEntityNotFound(_0x5807fc,null))[_0xff5b('0x18')](function(_0x59d2d7){if(_0x59d2d7){_0xda0033=_0x59d2d7;_0x85271['model']=_[_0xff5b('0x21')](db[_0xff5b('0x46')][_0xff5b('0x1f')]);_0x85271[_0xff5b('0x22')]=_['keys'](_0x4c4709[_0xff5b('0x22')]);_0x85271[_0xff5b('0x25')]=_[_0xff5b('0x26')](_0x85271[_0xff5b('0x20')],_0x85271[_0xff5b('0x22')]);_0x176d5f['attributes']=_['intersection'](_0x85271['model'],qs[_0xff5b('0x27')](_0x4c4709[_0xff5b('0x22')]['fields']));_0x176d5f[_0xff5b('0x28')]=_0x176d5f[_0xff5b('0x28')][_0xff5b('0x29')]?_0x176d5f['attributes']:_0x85271[_0xff5b('0x20')];_0x176d5f[_0xff5b('0x2c')]=qs[_0xff5b('0x2d')](_0x4c4709['query'][_0xff5b('0x2d')]);_0x176d5f[_0xff5b('0x2e')]=qs[_0xff5b('0x25')](_['pick'](_0x4c4709[_0xff5b('0x22')],_0x85271['filters']));if(_0x4c4709[_0xff5b('0x22')][_0xff5b('0x33')]){_0x176d5f[_0xff5b('0x2e')]=_[_0xff5b('0x32')](_0x176d5f['where'],{'$or':_[_0xff5b('0x34')](_0x176d5f[_0xff5b('0x28')],function(_0x1362cc){var _0x2c4fc9={};_0x2c4fc9[_0x1362cc]={'$like':'%'+_0x4c4709[_0xff5b('0x22')]['filter']+'%'};return _0x2c4fc9;})});}_0x176d5f=_[_0xff5b('0x32')]({},_0x176d5f,_0x4c4709[_0xff5b('0x39')]);return _0xda0033[_0xff5b('0x44')](_0x176d5f);}})[_0xff5b('0x18')](function(_0x5e44ec){if(_0x5e44ec){_0x156342=_0x5e44ec[_0xff5b('0x29')];if(!_0x4c4709[_0xff5b('0x22')][_0xff5b('0x2a')]('nolimit')){_0x176d5f['limit']=qs[_0xff5b('0x14')](_0x4c4709[_0xff5b('0x22')][_0xff5b('0x14')]);_0x176d5f['offset']=qs[_0xff5b('0x13')](_0x4c4709[_0xff5b('0x22')][_0xff5b('0x13')]);}return _0xda0033[_0xff5b('0x44')](_0x176d5f);}})[_0xff5b('0x18')](function(_0xcf5cd3){if(_0xcf5cd3){return _0xcf5cd3?{'count':_0x156342,'rows':_0xcf5cd3}:null;}})['then'](respondWithResult(_0x5807fc,null))[_0xff5b('0x36')](handleError(_0x5807fc,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c95ca38..87e505d 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 _0x0a94=['Automation','tools_automations','lodash','util','../../config/logger','api','moment','request-promise','./automation.attributes'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x0a94,0xf5));var _0x40a9=function(_0x103149,_0xe0111f){_0x103149=_0x103149-0x0;var _0xd3507b=_0x0a94[_0x103149];return _0xd3507b;};'use strict';var _=require(_0x40a9('0x0'));var util=require(_0x40a9('0x1'));var logger=require(_0x40a9('0x2'))(_0x40a9('0x3'));var moment=require(_0x40a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x40a9('0x5'));var attributes=require(_0x40a9('0x6'));module['exports']=function(_0x260b4d,_0xb3395c){return _0x260b4d['define'](_0x40a9('0x7'),attributes,{'tableName':_0x40a9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a0e=['request-promise','exports','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1acd88,_0x3e3f54){var _0xf8e5ec=function(_0x343b42){while(--_0x343b42){_0x1acd88['push'](_0x1acd88['shift']());}};_0xf8e5ec(++_0x3e3f54);}(_0x1a0e,0x1c6));var _0xe1a0=function(_0x1391a8,_0x4e2f7f){_0x1391a8=_0x1391a8-0x0;var _0x1e3519=_0x1a0e[_0x1391a8];return _0x1e3519;};'use strict';var _=require(_0xe1a0('0x0'));var util=require(_0xe1a0('0x1'));var logger=require(_0xe1a0('0x2'))(_0xe1a0('0x3'));var moment=require(_0xe1a0('0x4'));var BPromise=require(_0xe1a0('0x5'));var rp=require(_0xe1a0('0x6'));var attributes=require('./automation.attributes');module[_0xe1a0('0x7')]=function(_0x5602cf,_0x47c1bc){return _0x5602cf['define'](_0xe1a0('0x8'),attributes,{'tableName':_0xe1a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 6f27cdc..e0ee29d 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 _0x9082=['request','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x49fcfc,_0x104175){var _0x4ab162=function(_0x2fb28b){while(--_0x2fb28b){_0x49fcfc['push'](_0x49fcfc['shift']());}};_0x4ab162(++_0x104175);}(_0x9082,0x161));var _0x2908=function(_0x5af59e,_0x3771c1){_0x5af59e=_0x5af59e-0x0;var _0x4240df=_0x9082[_0x5af59e];return _0x4240df;};'use strict';var _=require('lodash');var util=require(_0x2908('0x0'));var moment=require(_0x2908('0x1'));var BPromise=require(_0x2908('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2908('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2908('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2908('0x5'));var client=jayson[_0x2908('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f56ef,_0x426c4e,_0x4df611){return new BPromise(function(_0x2d1a65,_0x2d8a79){return client[_0x2908('0x7')](_0x5f56ef,_0x4df611)['then'](function(_0x8773cc){logger[_0x2908('0x8')](_0x2908('0x9'),_0x426c4e,'request\x20sent');logger[_0x2908('0xa')](_0x2908('0xb'),_0x426c4e,'request\x20sent',JSON[_0x2908('0xc')](_0x8773cc));if(_0x8773cc[_0x2908('0xd')]){if(_0x8773cc[_0x2908('0xd')][_0x2908('0xe')]===0x1f4){logger['error']('Automation,\x20%s,\x20%s',_0x426c4e,_0x8773cc['error']['message']);return _0x2d8a79(_0x8773cc[_0x2908('0xd')][_0x2908('0xf')]);}logger[_0x2908('0xd')](_0x2908('0x9'),_0x426c4e,_0x8773cc[_0x2908('0xd')][_0x2908('0xf')]);return _0x2d1a65(_0x8773cc[_0x2908('0xd')][_0x2908('0xf')]);}else{logger[_0x2908('0x8')](_0x2908('0x9'),_0x426c4e,'request\x20sent');_0x2d1a65(_0x8773cc[_0x2908('0x10')][_0x2908('0xf')]);}})[_0x2908('0x11')](function(_0x22905a){logger[_0x2908('0xd')](_0x2908('0x9'),_0x426c4e,_0x22905a);_0x2d8a79(_0x22905a);});});} \ No newline at end of file +var _0x5a8f=['error','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5a8f,0xdf));var _0xf5a8=function(_0x2bca07,_0x1a04b9){_0x2bca07=_0x2bca07-0x0;var _0x1ee9aa=_0x5a8f[_0x2bca07];return _0x1ee9aa;};'use strict';var _=require(_0xf5a8('0x0'));var util=require('util');var moment=require(_0xf5a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xf5a8('0x2'));var fs=require('fs');var db=require(_0xf5a8('0x3'))['db'];var utils=require(_0xf5a8('0x4'));var logger=require(_0xf5a8('0x5'))('rpc');var config=require(_0xf5a8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf5a8('0x7')][_0xf5a8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x798c40,_0x5a32d3,_0x8c03f2){return new BPromise(function(_0x4add58,_0x3372a){return client[_0xf5a8('0x9')](_0x798c40,_0x8c03f2)[_0xf5a8('0xa')](function(_0x1db8aa){logger[_0xf5a8('0xb')](_0xf5a8('0xc'),_0x5a32d3,_0xf5a8('0xd'));logger[_0xf5a8('0xe')](_0xf5a8('0xf'),_0x5a32d3,_0xf5a8('0xd'),JSON[_0xf5a8('0x10')](_0x1db8aa));if(_0x1db8aa['error']){if(_0x1db8aa[_0xf5a8('0x11')]['code']===0x1f4){logger[_0xf5a8('0x11')](_0xf5a8('0xc'),_0x5a32d3,_0x1db8aa[_0xf5a8('0x11')]['message']);return _0x3372a(_0x1db8aa[_0xf5a8('0x11')][_0xf5a8('0x12')]);}logger[_0xf5a8('0x11')](_0xf5a8('0xc'),_0x5a32d3,_0x1db8aa[_0xf5a8('0x11')][_0xf5a8('0x12')]);return _0x4add58(_0x1db8aa[_0xf5a8('0x11')]['message']);}else{logger[_0xf5a8('0xb')](_0xf5a8('0xc'),_0x5a32d3,_0xf5a8('0xd'));_0x4add58(_0x1db8aa['result'][_0xf5a8('0x12')]);}})[_0xf5a8('0x13')](function(_0x471570){logger['error'](_0xf5a8('0xc'),_0x5a32d3,_0x471570);_0x3372a(_0x471570);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index ed9b9fd..862eb53 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 _0x7a54=['path','Router','../../components/auth/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getActions','/:id/conditions','addConditions','post','/:id/actions','addActions','update','delete','destroy','exports','multer','util'];(function(_0x533fab,_0xc0d7b4){var _0x24dbf3=function(_0x5eb73f){while(--_0x5eb73f){_0x533fab['push'](_0x533fab['shift']());}};_0x24dbf3(++_0xc0d7b4);}(_0x7a54,0x106));var _0x47a5=function(_0x2ee50b,_0x321896){_0x2ee50b=_0x2ee50b-0x0;var _0x52f71a=_0x7a54[_0x2ee50b];return _0x52f71a;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id/conditions',auth[_0x47a5('0x8')](),controller['getConditions']);router['get']('/:id/actions',auth[_0x47a5('0x8')](),controller[_0x47a5('0xc')]);router['post']('/',auth[_0x47a5('0x8')](),controller['create']);router['post'](_0x47a5('0xd'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xe')]);router[_0x47a5('0xf')](_0x47a5('0x10'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x11')]);router['put'](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x14')]);module[_0x47a5('0x15')]=router; \ No newline at end of file +var _0x9957=['./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33025b,_0x2f778f){var _0x30f787=function(_0x1abcdf){while(--_0x1abcdf){_0x33025b['push'](_0x33025b['shift']());}};_0x30f787(++_0x2f778f);}(_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 express=require(_0x7995('0x3'));var router=express['Router']();var auth=require(_0x7995('0x4'));var interaction=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var controller=require(_0x7995('0x7'));router['get']('/',auth[_0x7995('0x8')](),controller[_0x7995('0x9')]);router[_0x7995('0xa')](_0x7995('0xb'),auth[_0x7995('0x8')](),controller[_0x7995('0xc')]);router['get'](_0x7995('0xd'),auth[_0x7995('0x8')](),controller['getConditions']);router[_0x7995('0xa')](_0x7995('0xe'),auth[_0x7995('0x8')](),controller[_0x7995('0xf')]);router[_0x7995('0x10')]('/',auth[_0x7995('0x8')](),controller[_0x7995('0x11')]);router['post'](_0x7995('0xd'),auth[_0x7995('0x8')](),controller['addConditions']);router[_0x7995('0x10')](_0x7995('0xe'),auth[_0x7995('0x8')](),controller[_0x7995('0x12')]);router[_0x7995('0x13')](_0x7995('0xb'),auth[_0x7995('0x8')](),controller['update']);router['delete'](_0x7995('0xb'),auth[_0x7995('0x8')](),controller[_0x7995('0x14')]);module[_0x7995('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index fef7a83..4b1b93a 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 _0x2778=['sequelize','exports','name','ivr','STRING','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#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,*,*,*','ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2778,0xba));var _0x8277=function(_0x1a35a4,_0x2d220d){_0x1a35a4=_0x1a35a4-0x0;var _0x3aa380=_0x2778[_0x1a35a4];return _0x3aa380;};'use strict';var Sequelize=require(_0x8277('0x0'));module[_0x8277('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8277('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x8277('0x3')),'allowNull':![],'defaultValue':_0x8277('0x3')},'description':{'type':Sequelize[_0x8277('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x8277('0x5')},'limitCalls':{'type':Sequelize[_0x8277('0x6')](0x4)[_0x8277('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x8277('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8277('0x4')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x8277('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8277('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x8277('0x6')](0x3)[_0x8277('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8277('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8277('0x6')](0x5)[_0x8277('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8277('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x8277('0x6')](0x3)[_0x8277('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8277('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x8277('0x6')](0x5)[_0x8277('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8277('0x6')](0x3)[_0x8277('0x7')],'defaultValue':0x3,'comment':_0x8277('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x8277('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8277('0xe')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8277('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x8277('0xf')},'dialTimezone':{'type':Sequelize[_0x8277('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8277('0x4')],'defaultValue':_0x8277('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0x8277('0x11')](_0x8277('0x12'),_0x8277('0x13'),'onlyIfOpen'),'defaultValue':_0x8277('0x12')},'dialAMDActive':{'type':Sequelize[_0x8277('0x14')],'defaultValue':0x0,'comment':_0x8277('0x15')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8277('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x8277('0x6')](0x9)[_0x8277('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8277('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8277('0x6')](0x9)[_0x8277('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8277('0x6')](0x9)[_0x8277('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8277('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x8277('0x6')](0x9)[_0x8277('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8277('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x8277('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x8277('0x6')](0x9)[_0x8277('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8277('0x6')](0x5)[_0x8277('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8277('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x8277('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x8277('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8277('0x11')]('DESC',_0x8277('0x1c')),'defaultValue':_0x8277('0x1d')},'dialPrefix':{'type':Sequelize[_0x8277('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8277('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8277('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x8277('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'}}; \ No newline at end of file +var _0xf0aa=['#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','never','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence'];(function(_0x4a8e69,_0x593023){var _0x55d440=function(_0x587986){while(--_0x587986){_0x4a8e69['push'](_0x4a8e69['shift']());}};_0x55d440(++_0x593023);}(_0xf0aa,0x100));var _0xaf0a=function(_0x46c3ec,_0x313165){_0x46c3ec=_0x46c3ec-0x0;var _0x516cf7=_0xf0aa[_0x46c3ec];return _0x516cf7;};'use strict';var Sequelize=require(_0xaf0a('0x0'));module[_0xaf0a('0x1')]={'name':{'type':Sequelize[_0xaf0a('0x2')],'unique':_0xaf0a('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xaf0a('0x4')]('ivr'),'allowNull':![],'defaultValue':_0xaf0a('0x5')},'description':{'type':Sequelize[_0xaf0a('0x2')]},'active':{'type':Sequelize[_0xaf0a('0x6')],'defaultValue':0x0,'comment':_0xaf0a('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xaf0a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xaf0a('0x9')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xaf0a('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf0a('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf0a('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf0a('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xd')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xaf0a('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf0a('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf0a('0xf')},'dialGlobalMaxRetry':{'type':Sequelize[_0xaf0a('0xa')](0x3)[_0xaf0a('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf0a('0x2')],'defaultValue':_0xaf0a('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xaf0a('0x4')]('always',_0xaf0a('0x11'),'onlyIfOpen'),'defaultValue':_0xaf0a('0x12')},'dialAMDActive':{'type':Sequelize[_0xaf0a('0x6')],'defaultValue':0x0,'comment':_0xaf0a('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf0a('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf0a('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf0a('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaf0a('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf0a('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xaf0a('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf0a('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf0a('0xa')](0x5)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf0a('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xaf0a('0xa')](0x9)[_0xaf0a('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf0a('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf0a('0x4')](_0xaf0a('0x1b'),_0xaf0a('0x1c')),'defaultValue':_0xaf0a('0x1b')},'dialPrefix':{'type':Sequelize[_0xaf0a('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf0a('0x1d')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xaf0a('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf0a('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9cfc637..4fa6dfb 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 _0x5385=['set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','Campaign','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','merge','map','filter','options','includeAll','include','rows','show','find','catch','create','body','clone','params','get','omit','createdAt','updatedAt','getHoppers','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','CmListId','toString','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','from','phone\x20NOT\x20IN\x20(?)','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','push','sequelize','all','removeLists','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit'];(function(_0x54a876,_0x3a318a){var _0x45fe82=function(_0x3bebde){while(--_0x3bebde){_0x54a876['push'](_0x54a876['shift']());}};_0x45fe82(++_0x3a318a);}(_0x5385,0x1c4));var _0x5538=function(_0x40ba2f,_0x4c6027){_0x40ba2f=_0x40ba2f-0x0;var _0xeeaa5f=_0x5385[_0x40ba2f];return _0xeeaa5f;};'use strict';var jsonpatch=require(_0x5538('0x0'));var rp=require('request-promise');var moment=require(_0x5538('0x1'));var BPromise=require(_0x5538('0x2'));var Mustache=require(_0x5538('0x3'));var util=require(_0x5538('0x4'));var path=require(_0x5538('0x5'));var sox=require(_0x5538('0x6'));var csv=require(_0x5538('0x7'));var ejs=require(_0x5538('0x8'));var fs=require('fs');var _=require(_0x5538('0x9'));var squel=require('squel');var crypto=require(_0x5538('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5538('0xb'));var toCsv=require(_0x5538('0x7'));var querystring=require(_0x5538('0xc'));var Papa=require(_0x5538('0xd'));var qs=require(_0x5538('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x5538('0xf'));var config=require('../../config/environment');var db=require(_0x5538('0x10'))['db'];function respondWithStatusCode(_0x1e11fb,_0x1ccf61){_0x1ccf61=_0x1ccf61||0xcc;return function(_0x1321ae){if(_0x1321ae){return _0x1e11fb[_0x5538('0x11')](_0x1ccf61);}return _0x1e11fb[_0x5538('0x12')](_0x1ccf61)[_0x5538('0x13')]();};}function respondWithResult(_0x31b4c0,_0x595bb5){_0x595bb5=_0x595bb5||0xc8;return function(_0x8fa001){if(_0x8fa001){return _0x31b4c0['status'](_0x595bb5)[_0x5538('0x14')](_0x8fa001);}};}function respondWithFilteredResult(_0x133582,_0x41d4cb){return function(_0x7fbefe){if(_0x7fbefe){var _0x33c493=_0x7fbefe[_0x5538('0x15')],_0x30f1aa=_0x41d4cb[_0x5538('0x16')],_0x52aa84=_0x41d4cb['offset']+_0x41d4cb[_0x5538('0x17')],_0x2508d0;if(_0x52aa84>=_0x33c493){_0x52aa84=_0x33c493;_0x2508d0=0xc8;}else{_0x2508d0=0xce;}_0x133582[_0x5538('0x12')](_0x2508d0);return _0x133582[_0x5538('0x18')](_0x5538('0x19'),_0x30f1aa+'-'+_0x52aa84+'/'+_0x33c493)['json'](_0x7fbefe);}return null;};}function patchUpdates(_0x32d12e){return function(_0x10f08d){try{jsonpatch[_0x5538('0x1a')](_0x10f08d,_0x32d12e,!![]);}catch(_0x3cb902){return BPromise[_0x5538('0x1b')](_0x3cb902);}return _0x10f08d[_0x5538('0x1c')]();};}function saveUpdates(_0x37e487,_0x56ed2d){return function(_0x5391d4){if(_0x5391d4){return _0x5391d4[_0x5538('0x1d')](_0x37e487)[_0x5538('0x1e')](function(_0x5e232d){return _0x5e232d;});}return null;};}function removeEntity(_0x5c75fd,_0x54fc6e){return function(_0x17413f){if(_0x17413f){return _0x17413f[_0x5538('0x1f')]()['then'](function(){_0x5c75fd['status'](0xcc)[_0x5538('0x13')]();});}};}function handleEntityNotFound(_0x43ce2c,_0x5c562e){return function(_0x1b047a){if(!_0x1b047a){_0x43ce2c[_0x5538('0x11')](0x194);}return _0x1b047a;};}function handleError(_0x5075bd,_0x285d87){_0x285d87=_0x285d87||0x1f4;return function(_0x36384f){logger[_0x5538('0x20')](_0x36384f[_0x5538('0x21')]);if(_0x36384f['name']){delete _0x36384f['name'];}_0x5075bd[_0x5538('0x12')](_0x285d87)[_0x5538('0x22')](_0x36384f);};}exports['index']=function(_0x11c1af,_0x12df0c){var _0x4f59cf={},_0x3b7076={},_0x36aa79={'count':0x0,'rows':[]};var _0x564e87=db[_0x5538('0x23')][_0x5538('0x24')];_0x3b7076[_0x5538('0x25')]=_[_0x5538('0x26')](_0x564e87);var _0x35eb0f={'dateStart':_0x11c1af[_0x5538('0x27')][_0x5538('0x28')],'dateEnd':_0x11c1af[_0x5538('0x27')][_0x5538('0x29')]};delete _0x11c1af['query'][_0x5538('0x28')];delete _0x11c1af[_0x5538('0x27')][_0x5538('0x29')];_0x3b7076[_0x5538('0x27')]=_[_0x5538('0x26')](_0x11c1af[_0x5538('0x27')]);_0x3b7076[_0x5538('0x2a')]=_[_0x5538('0x2b')](_0x3b7076[_0x5538('0x25')],_0x3b7076['query']);_0x4f59cf[_0x5538('0x2c')]=_[_0x5538('0x2b')](_0x3b7076[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x11c1af['query'][_0x5538('0x2d')]));_0x4f59cf[_0x5538('0x2c')]=_0x4f59cf[_0x5538('0x2c')][_0x5538('0x2e')]?_0x4f59cf['attributes']:_0x3b7076[_0x5538('0x25')];if(!_0x11c1af[_0x5538('0x27')][_0x5538('0x2f')](_0x5538('0x30'))){_0x4f59cf[_0x5538('0x17')]=qs['limit'](_0x11c1af[_0x5538('0x27')][_0x5538('0x17')]);_0x4f59cf[_0x5538('0x16')]=qs[_0x5538('0x16')](_0x11c1af[_0x5538('0x27')]['offset']);}_0x4f59cf[_0x5538('0x31')]=qs[_0x5538('0x32')](_0x11c1af[_0x5538('0x27')][_0x5538('0x32')]);_0x4f59cf[_0x5538('0x33')]=qs[_0x5538('0x2a')](_[_0x5538('0x34')](_0x11c1af[_0x5538('0x27')],_0x3b7076[_0x5538('0x2a')]));if(_0x35eb0f['dateStart']){if(_0x35eb0f[_0x5538('0x29')]){_0x35eb0f['dateEnd']=moment(_0x35eb0f['dateEnd'])['add'](0x1,_0x5538('0x35'));}else{_0x35eb0f[_0x5538('0x29')]=moment(_0x35eb0f[_0x5538('0x28')])['add'](0x1,_0x5538('0x35'));}_[_0x5538('0x36')](_0x4f59cf[_0x5538('0x33')],{'createdAt':{'$gte':_0x35eb0f[_0x5538('0x28')],'$lte':_0x35eb0f['dateEnd']}});}if(_0x11c1af[_0x5538('0x27')]['filter']){_0x4f59cf[_0x5538('0x33')]=_['merge'](_0x4f59cf[_0x5538('0x33')],{'$or':_[_0x5538('0x37')](_0x4f59cf[_0x5538('0x2c')],function(_0x12155b){var _0x59383c={};_0x59383c[_0x12155b]={'$like':'%'+_0x11c1af['query'][_0x5538('0x38')]+'%'};return _0x59383c;})});}_0x4f59cf=_[_0x5538('0x36')]({},_0x4f59cf,_0x11c1af[_0x5538('0x39')]);var _0x425ac2={'where':_0x4f59cf[_0x5538('0x33')]};return db[_0x5538('0x23')][_0x5538('0x15')](_0x425ac2)[_0x5538('0x1e')](function(_0x2e45eb){_0x36aa79[_0x5538('0x15')]=_0x2e45eb;if(_0x11c1af['query'][_0x5538('0x3a')]){_0x4f59cf[_0x5538('0x3b')]=[{'all':!![]}];}return db[_0x5538('0x23')]['findAll'](_0x4f59cf);})[_0x5538('0x1e')](function(_0x3b6b6b){_0x36aa79[_0x5538('0x3c')]=_0x3b6b6b;return _0x36aa79;})[_0x5538('0x1e')](respondWithFilteredResult(_0x12df0c,_0x4f59cf))['catch'](handleError(_0x12df0c,null));};exports[_0x5538('0x3d')]=function(_0x1686f7,_0x6a8fdb){var _0x5117c4={'raw':![],'where':{'id':_0x1686f7['params']['id']}},_0x4a2868={};_0x4a2868[_0x5538('0x25')]=_[_0x5538('0x26')](db[_0x5538('0x23')][_0x5538('0x24')]);_0x4a2868[_0x5538('0x27')]=_[_0x5538('0x26')](_0x1686f7[_0x5538('0x27')]);_0x4a2868['filters']=_[_0x5538('0x2b')](_0x4a2868['model'],_0x4a2868[_0x5538('0x27')]);_0x5117c4[_0x5538('0x2c')]=_[_0x5538('0x2b')](_0x4a2868[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x1686f7['query'][_0x5538('0x2d')]));_0x5117c4[_0x5538('0x2c')]=_0x5117c4[_0x5538('0x2c')][_0x5538('0x2e')]?_0x5117c4[_0x5538('0x2c')]:_0x4a2868[_0x5538('0x25')];if(_0x1686f7[_0x5538('0x27')][_0x5538('0x3a')]){_0x5117c4[_0x5538('0x3b')]=[{'all':!![]}];}_0x5117c4=_[_0x5538('0x36')]({},_0x5117c4,_0x1686f7[_0x5538('0x39')]);return db[_0x5538('0x23')][_0x5538('0x3e')](_0x5117c4)[_0x5538('0x1e')](handleEntityNotFound(_0x6a8fdb,null))[_0x5538('0x1e')](respondWithResult(_0x6a8fdb,null))[_0x5538('0x3f')](handleError(_0x6a8fdb,null));};exports[_0x5538('0x40')]=function(_0x37e0b1,_0xa96a62){return db['Campaign'][_0x5538('0x40')](_0x37e0b1[_0x5538('0x41')],{})[_0x5538('0x1e')](respondWithResult(_0xa96a62,0xc9))[_0x5538('0x3f')](handleError(_0xa96a62,null));};exports[_0x5538('0x42')]=function(_0x47e859,_0x4371ad){var _0x21a4a5={'raw':![],'where':{'id':_0x47e859[_0x5538('0x43')]['id']}},_0x4aa35b={};_0x4aa35b[_0x5538('0x25')]=_[_0x5538('0x26')](db['Campaign'][_0x5538('0x24')]);_0x21a4a5['attributes']=_[_0x5538('0x2b')](_0x4aa35b[_0x5538('0x25')],qs['fields'](_0x47e859[_0x5538('0x27')][_0x5538('0x2d')]));_0x21a4a5[_0x5538('0x2c')]=_0x21a4a5[_0x5538('0x2c')][_0x5538('0x2e')]?_0x21a4a5[_0x5538('0x2c')]:_0x4aa35b[_0x5538('0x25')];if(_0x47e859[_0x5538('0x27')]['includeAll']){_0x21a4a5[_0x5538('0x3b')]=[{'all':!![]}];}_0x21a4a5=_[_0x5538('0x36')]({},_0x21a4a5,_0x47e859['options']);return db[_0x5538('0x23')]['find'](_0x21a4a5)[_0x5538('0x1e')](handleEntityNotFound(_0x4371ad,null))[_0x5538('0x1e')](function(_0x3de1ec){if(_0x3de1ec){var _0xe52f86=_0x3de1ec[_0x5538('0x44')]({'plain':!![]});_0xe52f86=qs[_0x5538('0x45')](_0xe52f86,['id',_0x5538('0x46'),_0x5538('0x47')]);_0x47e859[_0x5538('0x41')]=_['omit'](_0x47e859[_0x5538('0x41')],['id',_0x5538('0x46'),_0x5538('0x47')]);return db['Campaign'][_0x5538('0x40')](_[_0x5538('0x36')](_0xe52f86,_0x47e859['body']),{'include':_0x47e859[_0x5538('0x27')][_0x5538('0x3a')]?[{'all':!![]}]:undefined});}})[_0x5538('0x1e')](respondWithResult(_0x4371ad,0xc9))[_0x5538('0x3f')](handleError(_0x4371ad,null));};exports['update']=function(_0xe65cf6,_0x21ea68){if(_0xe65cf6['body']['id']){delete _0xe65cf6[_0x5538('0x41')]['id'];}return db['Campaign'][_0x5538('0x3e')]({'where':{'id':_0xe65cf6['params']['id']}})['then'](handleEntityNotFound(_0x21ea68,null))[_0x5538('0x1e')](saveUpdates(_0xe65cf6['body'],null))[_0x5538('0x1e')](respondWithResult(_0x21ea68,null))[_0x5538('0x3f')](handleError(_0x21ea68,null));};exports['destroy']=function(_0x24cc7b,_0x2ed296){return db[_0x5538('0x23')][_0x5538('0x3e')]({'where':{'id':_0x24cc7b[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x2ed296,null))['then'](removeEntity(_0x2ed296,null))['catch'](handleError(_0x2ed296,null));};exports[_0x5538('0x48')]=function(_0x48b227,_0x32ba08,_0x2923c5){var _0x100343={'raw':!![],'where':{}};var _0x3e7659={};var _0x2989be={'count':0x0,'rows':[]};return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x48b227[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x32ba08,null))[_0x5538('0x1e')](function(_0xf7d431){if(_0xf7d431){_0x3e7659['model']=_[_0x5538('0x26')](db[_0x5538('0x4a')]['rawAttributes']);_0x3e7659['query']=_[_0x5538('0x26')](_0x48b227[_0x5538('0x27')]);_0x3e7659[_0x5538('0x2a')]=_['intersection'](_0x3e7659[_0x5538('0x25')],_0x3e7659[_0x5538('0x27')]);_0x100343['attributes']=_[_0x5538('0x2b')](_0x3e7659['model'],qs[_0x5538('0x2d')](_0x48b227[_0x5538('0x27')][_0x5538('0x2d')]));_0x100343[_0x5538('0x2c')]=_0x100343[_0x5538('0x2c')][_0x5538('0x2e')]?_0x100343[_0x5538('0x2c')]:_0x3e7659['model'];if(!_0x48b227[_0x5538('0x27')][_0x5538('0x2f')]('nolimit')){_0x100343[_0x5538('0x17')]=qs[_0x5538('0x17')](_0x48b227[_0x5538('0x27')][_0x5538('0x17')]);_0x100343[_0x5538('0x16')]=qs[_0x5538('0x16')](_0x48b227['query']['offset']);}_0x100343[_0x5538('0x31')]=qs[_0x5538('0x32')](_0x48b227[_0x5538('0x27')][_0x5538('0x32')]);_0x100343[_0x5538('0x33')]=qs[_0x5538('0x2a')](_['pick'](_0x48b227[_0x5538('0x27')],_0x3e7659[_0x5538('0x2a')]));_0x100343[_0x5538('0x33')][_0x5538('0x4b')]=_0xf7d431['id'];if(_0x48b227['query'][_0x5538('0x38')]){_0x100343[_0x5538('0x33')]=_[_0x5538('0x36')](_0x100343['where'],{'$or':_[_0x5538('0x37')](_0x100343[_0x5538('0x2c')],function(_0x3d2f80){var _0xb8d656={};_0xb8d656[_0x3d2f80]={'$like':'%'+_0x48b227['query'][_0x5538('0x38')]+'%'};return _0xb8d656;})});}_0x100343=_['merge']({},_0x100343,_0x48b227[_0x5538('0x39')]);return db[_0x5538('0x4a')]['count']({'where':_0x100343['where']})[_0x5538('0x1e')](function(_0x18d760){_0x2989be[_0x5538('0x15')]=_0x18d760;if(_0x48b227[_0x5538('0x27')][_0x5538('0x3a')]){_0x100343[_0x5538('0x3b')]=[{'all':!![]}];}return db[_0x5538('0x4a')][_0x5538('0x4c')](_0x100343);})[_0x5538('0x1e')](function(_0x28e52a){_0x2989be['rows']=_0x28e52a;return _0x2989be;});}})[_0x5538('0x1e')](respondWithFilteredResult(_0x32ba08,_0x100343))['catch'](handleError(_0x32ba08,null));};exports[_0x5538('0x4d')]=function(_0x335034,_0x829a4f,_0x5670d2){var _0x512919={'raw':!![],'where':{}};var _0x3b4151={};var _0x4ef695={'count':0x0,'rows':[]};return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x335034[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x829a4f,null))[_0x5538('0x1e')](function(_0x101f86){if(_0x101f86){_0x3b4151[_0x5538('0x25')]=_['keys'](db['CmHopperHistory'][_0x5538('0x24')]);_0x3b4151['query']=_[_0x5538('0x26')](_0x335034[_0x5538('0x27')]);_0x3b4151[_0x5538('0x2a')]=_['intersection'](_0x3b4151['model'],_0x3b4151[_0x5538('0x27')]);_0x512919[_0x5538('0x2c')]=_['intersection'](_0x3b4151[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x335034['query'][_0x5538('0x2d')]));_0x512919[_0x5538('0x2c')]=_0x512919[_0x5538('0x2c')][_0x5538('0x2e')]?_0x512919[_0x5538('0x2c')]:_0x3b4151[_0x5538('0x25')];if(!_0x335034['query'][_0x5538('0x2f')](_0x5538('0x30'))){_0x512919[_0x5538('0x17')]=qs[_0x5538('0x17')](_0x335034[_0x5538('0x27')]['limit']);_0x512919[_0x5538('0x16')]=qs[_0x5538('0x16')](_0x335034[_0x5538('0x27')]['offset']);}_0x512919[_0x5538('0x31')]=qs[_0x5538('0x32')](_0x335034['query'][_0x5538('0x32')]);_0x512919[_0x5538('0x33')]=qs[_0x5538('0x2a')](_[_0x5538('0x34')](_0x335034[_0x5538('0x27')],_0x3b4151[_0x5538('0x2a')]));_0x512919[_0x5538('0x33')]['CampaignId']=_0x101f86['id'];if(_0x335034[_0x5538('0x27')]['filter']){_0x512919[_0x5538('0x33')]=_['merge'](_0x512919[_0x5538('0x33')],{'$or':_[_0x5538('0x37')](_0x512919['attributes'],function(_0x147ea7){var _0x3cd693={};_0x3cd693[_0x147ea7]={'$like':'%'+_0x335034[_0x5538('0x27')][_0x5538('0x38')]+'%'};return _0x3cd693;})});}_0x512919=_[_0x5538('0x36')]({},_0x512919,_0x335034[_0x5538('0x39')]);return db[_0x5538('0x4e')]['count']({'where':_0x512919[_0x5538('0x33')]})['then'](function(_0x1af2c7){_0x4ef695[_0x5538('0x15')]=_0x1af2c7;if(_0x335034[_0x5538('0x27')]['includeAll']){_0x512919[_0x5538('0x3b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5538('0x4c')](_0x512919);})[_0x5538('0x1e')](function(_0x402147){_0x4ef695[_0x5538('0x3c')]=_0x402147;return _0x4ef695;});}})[_0x5538('0x1e')](respondWithFilteredResult(_0x829a4f,_0x512919))[_0x5538('0x3f')](handleError(_0x829a4f,null));};exports[_0x5538('0x4f')]=function(_0x18a7d8,_0x45af82,_0x48e9ea){var _0x41d32c={'raw':!![],'where':{}};var _0x24b080={};var _0x4af34b={'count':0x0,'rows':[]};return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x18a7d8[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x45af82,null))[_0x5538('0x1e')](function(_0x3a465e){if(_0x3a465e){_0x24b080['model']=_[_0x5538('0x26')](db[_0x5538('0x50')][_0x5538('0x24')]);_0x24b080[_0x5538('0x27')]=_['keys'](_0x18a7d8[_0x5538('0x27')]);_0x24b080['filters']=_[_0x5538('0x2b')](_0x24b080['model'],_0x24b080[_0x5538('0x27')]);_0x41d32c[_0x5538('0x2c')]=_[_0x5538('0x2b')](_0x24b080[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x18a7d8[_0x5538('0x27')][_0x5538('0x2d')]));_0x41d32c[_0x5538('0x2c')]=_0x41d32c[_0x5538('0x2c')][_0x5538('0x2e')]?_0x41d32c[_0x5538('0x2c')]:_0x24b080[_0x5538('0x25')];if(!_0x18a7d8[_0x5538('0x27')]['hasOwnProperty'](_0x5538('0x30'))){_0x41d32c['limit']=qs[_0x5538('0x17')](_0x18a7d8[_0x5538('0x27')][_0x5538('0x17')]);_0x41d32c[_0x5538('0x16')]=qs['offset'](_0x18a7d8[_0x5538('0x27')]['offset']);}_0x41d32c['order']=qs[_0x5538('0x32')](_0x18a7d8[_0x5538('0x27')][_0x5538('0x32')]);_0x41d32c[_0x5538('0x33')]=qs['filters'](_[_0x5538('0x34')](_0x18a7d8[_0x5538('0x27')],_0x24b080[_0x5538('0x2a')]));_0x41d32c[_0x5538('0x33')]['CampaignId']=_0x3a465e['id'];if(_0x18a7d8[_0x5538('0x27')][_0x5538('0x38')]){_0x41d32c[_0x5538('0x33')]=_[_0x5538('0x36')](_0x41d32c['where'],{'$or':_[_0x5538('0x37')](_0x41d32c[_0x5538('0x2c')],function(_0x3c28c0){var _0x266ccb={};_0x266ccb[_0x3c28c0]={'$like':'%'+_0x18a7d8['query'][_0x5538('0x38')]+'%'};return _0x266ccb;})});}_0x41d32c=_[_0x5538('0x36')]({},_0x41d32c,_0x18a7d8[_0x5538('0x39')]);return db[_0x5538('0x50')][_0x5538('0x15')]({'where':_0x41d32c['where']})[_0x5538('0x1e')](function(_0xbfd302){_0x4af34b[_0x5538('0x15')]=_0xbfd302;if(_0x18a7d8[_0x5538('0x27')][_0x5538('0x3a')]){_0x41d32c[_0x5538('0x3b')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5538('0x4c')](_0x41d32c);})[_0x5538('0x1e')](function(_0xbc79db){_0x4af34b[_0x5538('0x3c')]=_0xbc79db;return _0x4af34b;});}})[_0x5538('0x1e')](respondWithFilteredResult(_0x45af82,_0x41d32c))[_0x5538('0x3f')](handleError(_0x45af82,null));};exports[_0x5538('0x51')]=function(_0x1a9245,_0x199ed9,_0x51c875){var _0x316880={'raw':!![],'where':{}};var _0x35b1dd={};var _0x3bf43c={'count':0x0,'rows':[]};return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x1a9245[_0x5538('0x43')]['id']}})['then'](handleEntityNotFound(_0x199ed9,null))['then'](function(_0x10d2f0){if(_0x10d2f0){_0x35b1dd[_0x5538('0x25')]=_[_0x5538('0x26')](db['CmHopperBlack']['rawAttributes']);_0x35b1dd[_0x5538('0x27')]=_[_0x5538('0x26')](_0x1a9245[_0x5538('0x27')]);_0x35b1dd[_0x5538('0x2a')]=_[_0x5538('0x2b')](_0x35b1dd[_0x5538('0x25')],_0x35b1dd[_0x5538('0x27')]);_0x316880['attributes']=_['intersection'](_0x35b1dd[_0x5538('0x25')],qs['fields'](_0x1a9245[_0x5538('0x27')][_0x5538('0x2d')]));_0x316880[_0x5538('0x2c')]=_0x316880[_0x5538('0x2c')][_0x5538('0x2e')]?_0x316880[_0x5538('0x2c')]:_0x35b1dd[_0x5538('0x25')];if(!_0x1a9245[_0x5538('0x27')][_0x5538('0x2f')](_0x5538('0x30'))){_0x316880[_0x5538('0x17')]=qs[_0x5538('0x17')](_0x1a9245[_0x5538('0x27')][_0x5538('0x17')]);_0x316880[_0x5538('0x16')]=qs['offset'](_0x1a9245['query']['offset']);}_0x316880['order']=qs['sort'](_0x1a9245[_0x5538('0x27')]['sort']);_0x316880['where']=qs['filters'](_[_0x5538('0x34')](_0x1a9245[_0x5538('0x27')],_0x35b1dd[_0x5538('0x2a')]));_0x316880[_0x5538('0x33')][_0x5538('0x4b')]=_0x10d2f0['id'];if(_0x1a9245[_0x5538('0x27')][_0x5538('0x38')]){_0x316880[_0x5538('0x33')]=_[_0x5538('0x36')](_0x316880['where'],{'$or':_[_0x5538('0x37')](_0x316880[_0x5538('0x2c')],function(_0x14ef84){var _0xd3eff4={};_0xd3eff4[_0x14ef84]={'$like':'%'+_0x1a9245['query'][_0x5538('0x38')]+'%'};return _0xd3eff4;})});}_0x316880=_[_0x5538('0x36')]({},_0x316880,_0x1a9245[_0x5538('0x39')]);return db[_0x5538('0x52')][_0x5538('0x15')]({'where':_0x316880[_0x5538('0x33')]})['then'](function(_0x32e185){_0x3bf43c['count']=_0x32e185;if(_0x1a9245[_0x5538('0x27')][_0x5538('0x3a')]){_0x316880[_0x5538('0x3b')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x316880);})[_0x5538('0x1e')](function(_0x611c4c){_0x3bf43c[_0x5538('0x3c')]=_0x611c4c;return _0x3bf43c;});}})[_0x5538('0x1e')](respondWithFilteredResult(_0x199ed9,_0x316880))[_0x5538('0x3f')](handleError(_0x199ed9,null));};exports['getLists']=function(_0x43fae6,_0x35e12b,_0x269886){var _0x450994={};var _0x5222f0={};var _0x3bacd2;var _0x4b67a4;return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x43fae6['params']['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x35e12b,null))[_0x5538('0x1e')](function(_0x3821df){if(_0x3821df){_0x3bacd2=_0x3821df;_0x5222f0['model']=_[_0x5538('0x26')](db[_0x5538('0x53')][_0x5538('0x24')]);_0x5222f0['query']=_[_0x5538('0x26')](_0x43fae6['query']);_0x5222f0[_0x5538('0x2a')]=_['intersection'](_0x5222f0[_0x5538('0x25')],_0x5222f0[_0x5538('0x27')]);_0x450994[_0x5538('0x2c')]=_['intersection'](_0x5222f0[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x43fae6[_0x5538('0x27')][_0x5538('0x2d')]));_0x450994[_0x5538('0x2c')]=_0x450994[_0x5538('0x2c')][_0x5538('0x2e')]?_0x450994[_0x5538('0x2c')]:_0x5222f0[_0x5538('0x25')];_0x450994[_0x5538('0x31')]=qs[_0x5538('0x32')](_0x43fae6['query'][_0x5538('0x32')]);_0x450994[_0x5538('0x33')]=qs['filters'](_[_0x5538('0x34')](_0x43fae6[_0x5538('0x27')],_0x5222f0[_0x5538('0x2a')]));if(_0x43fae6['query']['filter']){_0x450994[_0x5538('0x33')]=_[_0x5538('0x36')](_0x450994[_0x5538('0x33')],{'$or':_[_0x5538('0x37')](_0x450994[_0x5538('0x2c')],function(_0x509b6d){var _0x1ab5b0={};_0x1ab5b0[_0x509b6d]={'$like':'%'+_0x43fae6[_0x5538('0x27')][_0x5538('0x38')]+'%'};return _0x1ab5b0;})});}_0x450994=_[_0x5538('0x36')]({},_0x450994,_0x43fae6['options']);return _0x3bacd2[_0x5538('0x54')](_0x450994);}})[_0x5538('0x1e')](function(_0x4544d9){if(_0x4544d9){_0x4b67a4=_0x4544d9[_0x5538('0x2e')];if(!_0x43fae6[_0x5538('0x27')][_0x5538('0x2f')](_0x5538('0x30'))){_0x450994['limit']=qs[_0x5538('0x17')](_0x43fae6['query']['limit']);_0x450994[_0x5538('0x16')]=qs[_0x5538('0x16')](_0x43fae6['query']['offset']);}return _0x3bacd2[_0x5538('0x54')](_0x450994);}})[_0x5538('0x1e')](function(_0x2663f1){if(_0x2663f1){return _0x2663f1?{'count':_0x4b67a4,'rows':_0x2663f1}:null;}})[_0x5538('0x1e')](respondWithResult(_0x35e12b,null))['catch'](handleError(_0x35e12b,null));};exports[_0x5538('0x55')]=function(_0xead3b0,_0x598041,_0x47cd17){var _0x10b57e,_0x227dc5;return db[_0x5538('0x23')][_0x5538('0x3e')]({'where':{'id':_0xead3b0[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x598041,null))[_0x5538('0x1e')](function(_0x3a7e9c){if(_0x3a7e9c){_0x227dc5=_0x3a7e9c;return _0x3a7e9c[_0x5538('0x55')](_0xead3b0[_0x5538('0x41')][_0x5538('0x56')],_['omit'](_0xead3b0[_0x5538('0x41')],[_0x5538('0x56'),'id'])||{});}return null;})[_0x5538('0x57')](function(_0x3f168f){var _0x45650d;_0x10b57e=_0x3f168f||[];var _0x5636a9=[];if(_0x3f168f){for(var _0x49286a=0x0;_0x49286a<_0x3f168f['length'];_0x49286a+=0x1){var _0x331604=_0x3f168f[_0x49286a][_0x5538('0x44')]({'plain':!![]});_0x227dc5['dialCheckDuplicateType']=_0xead3b0[_0x5538('0x41')][_0x5538('0x58')]?_0xead3b0[_0x5538('0x41')]['dialCheckDuplicateType']:_0x227dc5[_0x5538('0x58')];switch(_0x227dc5[_0x5538('0x58')]){case _0x5538('0x59'):_0x45650d=squel[_0x5538('0x5a')]()[_0x5538('0x5b')](_0x5538('0x5c'))[_0x5538('0x5d')]([_0x5538('0x5e'),_0x5538('0x5f'),_0x5538('0x60'),_0x5538('0x61'),'CampaignId',_0x5538('0x46'),_0x5538('0x47')],squel[_0x5538('0x62')]()[_0x5538('0x63')](_0x5538('0x5e'),'phone')[_0x5538('0x63')]('NOW()','scheduledAt')[_0x5538('0x63')]('id',_0x5538('0x60'))[_0x5538('0x63')](_0x331604[_0x5538('0x64')][_0x5538('0x65')](),'ListId')['field'](_0xead3b0[_0x5538('0x43')]['id'][_0x5538('0x65')](),_0x5538('0x4b'))[_0x5538('0x63')]('NOW()',_0x5538('0x46'))[_0x5538('0x63')](_0x5538('0x66'),_0x5538('0x47'))['from']('cm_contacts')[_0x5538('0x33')](_0x5538('0x67'))['where'](_0x5538('0x68'),_0x331604[_0x5538('0x64')]['toString']())[_0x5538('0x33')](_0x5538('0x69'))[_0x5538('0x33')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x5538('0x63')](_0x5538('0x6a'))[_0x5538('0x6b')]('cm_hopper_final')[_0x5538('0x33')]('CampaignId\x20=\x20?',_0xead3b0['params']['id'][_0x5538('0x65')]()))['where'](_0x5538('0x6c'),squel[_0x5538('0x62')]()[_0x5538('0x63')](_0x5538('0x5e'))[_0x5538('0x6b')](_0x5538('0x5c'))[_0x5538('0x33')](_0x5538('0x6d'),_0xead3b0[_0x5538('0x43')]['id'][_0x5538('0x65')]())))[_0x5538('0x65')]();break;case _0x5538('0x6e'):_0x45650d=squel[_0x5538('0x5a')]()['into'](_0x5538('0x5c'))[_0x5538('0x5d')]([_0x5538('0x5e'),_0x5538('0x5f'),_0x5538('0x60'),'ListId','CampaignId',_0x5538('0x46'),_0x5538('0x47')],squel['select']()[_0x5538('0x63')](_0x5538('0x5e'),'phone')['field'](_0x5538('0x66'),_0x5538('0x5f'))[_0x5538('0x63')]('id','ContactId')[_0x5538('0x63')](_0x331604[_0x5538('0x64')][_0x5538('0x65')](),'ListId')[_0x5538('0x63')](_0xead3b0['params']['id'][_0x5538('0x65')](),_0x5538('0x4b'))['field'](_0x5538('0x66'),_0x5538('0x46'))['field']('NOW()','updatedAt')[_0x5538('0x6b')](_0x5538('0x6f'))[_0x5538('0x33')](_0x5538('0x67'))[_0x5538('0x33')]('ListId\x20=\x20?',_0x331604[_0x5538('0x64')][_0x5538('0x65')]())['where'](_0x5538('0x69'))[_0x5538('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5538('0x62')]()[_0x5538('0x63')]('phone')['from'](_0x5538('0x5c'))[_0x5538('0x33')](_0x5538('0x6d'),_0xead3b0['params']['id'][_0x5538('0x65')]())))[_0x5538('0x65')]();break;default:_0x45650d=squel[_0x5538('0x5a')]()[_0x5538('0x5b')](_0x5538('0x5c'))[_0x5538('0x5d')]([_0x5538('0x5e'),_0x5538('0x5f'),'ContactId',_0x5538('0x61'),_0x5538('0x4b'),'createdAt','updatedAt'],squel[_0x5538('0x62')]()[_0x5538('0x63')](_0x5538('0x5e'),_0x5538('0x5e'))[_0x5538('0x63')](_0x5538('0x66'),_0x5538('0x5f'))['field']('id','ContactId')[_0x5538('0x63')](_0x331604[_0x5538('0x64')]['toString'](),'ListId')['field'](_0xead3b0[_0x5538('0x43')]['id']['toString'](),_0x5538('0x4b'))[_0x5538('0x63')](_0x5538('0x66'),_0x5538('0x46'))[_0x5538('0x63')](_0x5538('0x66'),_0x5538('0x47'))[_0x5538('0x6b')]('cm_contacts')[_0x5538('0x33')](_0x5538('0x67'))[_0x5538('0x33')]('ListId\x20=\x20?',_0x331604[_0x5538('0x64')][_0x5538('0x65')]())[_0x5538('0x33')](_0x5538('0x69')))['toString']();}_0x5636a9[_0x5538('0x70')](db[_0x5538('0x71')][_0x5538('0x27')](_0x45650d));}return BPromise[_0x5538('0x72')](_0x5636a9);}})[_0x5538('0x1e')](function(){return _0x10b57e;})[_0x5538('0x1e')](respondWithResult(_0x598041,null))[_0x5538('0x3f')](handleError(_0x598041,null));};exports[_0x5538('0x73')]=function(_0x386262,_0x1e288b,_0x2914f3){var _0x210cbb;return db[_0x5538('0x23')][_0x5538('0x3e')]({'where':{'id':_0x386262['params']['id']}})['then'](handleEntityNotFound(_0x1e288b,null))[_0x5538('0x1e')](function(_0x5aa8aa){if(_0x5aa8aa){return _0x5aa8aa['removeLists'](_0x386262['query']['ids']);}})['then'](function(_0x25346d){if(_0x25346d){_0x210cbb=_0x25346d;return db[_0x5538('0x4a')]['destroy']({'where':{'ListId':_0x386262[_0x5538('0x27')][_0x5538('0x56')],'CampaignId':_0x386262[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](function(){return _0x210cbb;});}})[_0x5538('0x1e')](respondWithStatusCode(_0x1e288b,null))[_0x5538('0x3f')](handleError(_0x1e288b,null));};exports['getBlackLists']=function(_0x58fe86,_0x41e3d7,_0x1aacf3){var _0x11fbbc={'raw':!![],'where':{}};var _0x476d7c={};var _0x5b0f96={'count':0x0,'rows':[]};return db[_0x5538('0x23')][_0x5538('0x49')]({'where':{'id':_0x58fe86[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x41e3d7,null))[_0x5538('0x1e')](function(_0x4ec965){if(_0x4ec965){_0x476d7c[_0x5538('0x25')]=_[_0x5538('0x26')](db[_0x5538('0x53')]['rawAttributes']);_0x476d7c[_0x5538('0x27')]=_[_0x5538('0x26')](_0x58fe86[_0x5538('0x27')]);_0x476d7c[_0x5538('0x2a')]=_['intersection'](_0x476d7c[_0x5538('0x25')],_0x476d7c[_0x5538('0x27')]);_0x11fbbc[_0x5538('0x2c')]=_['intersection'](_0x476d7c[_0x5538('0x25')],qs[_0x5538('0x2d')](_0x58fe86[_0x5538('0x27')][_0x5538('0x2d')]));_0x11fbbc['attributes']=_0x11fbbc[_0x5538('0x2c')][_0x5538('0x2e')]?_0x11fbbc[_0x5538('0x2c')]:_0x476d7c[_0x5538('0x25')];if(!_0x58fe86[_0x5538('0x27')]['hasOwnProperty'](_0x5538('0x30'))){_0x11fbbc[_0x5538('0x17')]=qs[_0x5538('0x17')](_0x58fe86[_0x5538('0x27')][_0x5538('0x17')]);_0x11fbbc['offset']=qs[_0x5538('0x16')](_0x58fe86['query'][_0x5538('0x16')]);}_0x11fbbc[_0x5538('0x31')]=qs[_0x5538('0x32')](_0x58fe86[_0x5538('0x27')][_0x5538('0x32')]);_0x11fbbc[_0x5538('0x33')]=qs['filters'](_[_0x5538('0x34')](_0x58fe86['query'],_0x476d7c[_0x5538('0x2a')]));_0x11fbbc[_0x5538('0x33')][_0x5538('0x4b')]=_0x4ec965['id'];if(_0x58fe86['query'][_0x5538('0x38')]){_0x11fbbc['where']=_[_0x5538('0x36')](_0x11fbbc[_0x5538('0x33')],{'$or':_['map'](_0x11fbbc[_0x5538('0x2c')],function(_0x373bcb){var _0x871ce0={};_0x871ce0[_0x373bcb]={'$like':'%'+_0x58fe86['query'][_0x5538('0x38')]+'%'};return _0x871ce0;})});}_0x11fbbc=_[_0x5538('0x36')]({},_0x11fbbc,_0x58fe86[_0x5538('0x39')]);return db['CmList']['count']({'where':_0x11fbbc[_0x5538('0x33')]})['then'](function(_0x5633ae){_0x5b0f96[_0x5538('0x15')]=_0x5633ae;if(_0x58fe86[_0x5538('0x27')]['includeAll']){_0x11fbbc[_0x5538('0x3b')]=[{'all':!![]}];}return db[_0x5538('0x53')]['findAll'](_0x11fbbc);})[_0x5538('0x1e')](function(_0x4d5e8d){_0x5b0f96[_0x5538('0x3c')]=_0x4d5e8d;return _0x5b0f96;});}})[_0x5538('0x1e')](respondWithFilteredResult(_0x41e3d7,_0x11fbbc))[_0x5538('0x3f')](handleError(_0x41e3d7,null));};exports[_0x5538('0x74')]=function(_0x20651c,_0x201dda,_0x1e80b2){var _0x9ab064,_0x2187c6;return db['Campaign'][_0x5538('0x3e')]({'where':{'id':_0x20651c[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x201dda,null))[_0x5538('0x1e')](function(_0x12d1d1){if(_0x12d1d1){_0x2187c6=_0x12d1d1;return _0x12d1d1['addBlackLists'](_0x20651c[_0x5538('0x41')][_0x5538('0x56')],_[_0x5538('0x45')](_0x20651c['body'],[_0x5538('0x56'),'id'])||{});}return null;})['spread'](function(_0x2e6202){var _0x350572;_0x9ab064=_0x2e6202||[];var _0x4d12f6=[];if(_0x2e6202){for(var _0x4fbb91=0x0;_0x4fbb91<_0x2e6202[_0x5538('0x2e')];_0x4fbb91+=0x1){var _0x24dd68=_0x2e6202[_0x4fbb91][_0x5538('0x44')]({'plain':!![]});_0x350572=squel[_0x5538('0x5a')]()[_0x5538('0x5b')](_0x5538('0x75'))[_0x5538('0x5d')](['phone',_0x5538('0x60'),'ListId',_0x5538('0x4b'),_0x5538('0x46'),'updatedAt'],squel['select']()['field']('phone','phone')['field']('id',_0x5538('0x60'))[_0x5538('0x63')](_0x24dd68[_0x5538('0x64')][_0x5538('0x65')](),'ListId')[_0x5538('0x63')](_0x20651c[_0x5538('0x43')]['id'][_0x5538('0x65')](),'CampaignId')[_0x5538('0x63')](_0x5538('0x66'),'createdAt')['field'](_0x5538('0x66'),'updatedAt')[_0x5538('0x6b')](_0x5538('0x6f'))[_0x5538('0x33')](_0x5538('0x67'))[_0x5538('0x33')](_0x5538('0x68'),_0x24dd68['CmListId'][_0x5538('0x65')]())[_0x5538('0x33')](_0x5538('0x69')))[_0x5538('0x65')]();_0x4d12f6[_0x5538('0x70')](db[_0x5538('0x71')][_0x5538('0x27')](_0x350572));}return BPromise[_0x5538('0x72')](_0x4d12f6);}})[_0x5538('0x1e')](function(){return _0x9ab064;})[_0x5538('0x1e')](respondWithResult(_0x201dda,null))[_0x5538('0x3f')](handleError(_0x201dda,null));};exports[_0x5538('0x76')]=function(_0x5ae62f,_0x1d411c,_0x2bc928){var _0xd75ccf;return db[_0x5538('0x23')][_0x5538('0x3e')]({'where':{'id':_0x5ae62f[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](handleEntityNotFound(_0x1d411c,null))[_0x5538('0x1e')](function(_0x5a77dc){if(_0x5a77dc){return _0x5a77dc[_0x5538('0x76')](_0x5ae62f[_0x5538('0x27')][_0x5538('0x56')]);}})['then'](function(_0x20a5c7){if(_0x20a5c7){_0xd75ccf=_0x20a5c7;return db['CmHopperBlack'][_0x5538('0x1f')]({'where':{'ListId':_0x5ae62f[_0x5538('0x27')]['ids'],'CampaignId':_0x5ae62f[_0x5538('0x43')]['id']}})[_0x5538('0x1e')](function(){return _0xd75ccf;});}})['then'](respondWithStatusCode(_0x1d411c,null))[_0x5538('0x3f')](handleError(_0x1d411c,null));}; \ No newline at end of file +var _0x3012=['get','createdAt','updatedAt','omit','getHoppers','findOne','CmHopper','hasOwnProperty','CampaignId','options','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','insert','push','sequelize','all','removeLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','add','merge','filter','map','Campaign','includeAll','rows','catch','params','fields','find','create','body','clone','include'];(function(_0xabd82e,_0x395385){var _0x13927d=function(_0x14eb0e){while(--_0x14eb0e){_0xabd82e['push'](_0xabd82e['shift']());}};_0x13927d(++_0x395385);}(_0x3012,0x19b));var _0x2301=function(_0x480c13,_0xe67fac){_0x480c13=_0x480c13-0x0;var _0x53ee47=_0x3012[_0x480c13];return _0x53ee47;};'use strict';var jsonpatch=require(_0x2301('0x0'));var rp=require(_0x2301('0x1'));var moment=require(_0x2301('0x2'));var BPromise=require(_0x2301('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2301('0x4'));var sox=require(_0x2301('0x5'));var csv=require(_0x2301('0x6'));var ejs=require(_0x2301('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2301('0x8'));var jsforce=require(_0x2301('0x9'));var deskjs=require(_0x2301('0xa'));var toCsv=require('to-csv');var querystring=require(_0x2301('0xb'));var Papa=require(_0x2301('0xc'));var qs=require(_0x2301('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x2301('0xe'));var config=require(_0x2301('0xf'));var db=require(_0x2301('0x10'))['db'];function respondWithStatusCode(_0x1311fa,_0x4077d6){_0x4077d6=_0x4077d6||0xcc;return function(_0x53fe2d){if(_0x53fe2d){return _0x1311fa[_0x2301('0x11')](_0x4077d6);}return _0x1311fa[_0x2301('0x12')](_0x4077d6)[_0x2301('0x13')]();};}function respondWithResult(_0xa759a4,_0x1cca44){_0x1cca44=_0x1cca44||0xc8;return function(_0x2e0ce9){if(_0x2e0ce9){return _0xa759a4[_0x2301('0x12')](_0x1cca44)[_0x2301('0x14')](_0x2e0ce9);}};}function respondWithFilteredResult(_0x20c92f,_0x33c4e7){return function(_0x1cc69a){if(_0x1cc69a){var _0x4966bf=_0x1cc69a[_0x2301('0x15')],_0x31de17=_0x33c4e7['offset'],_0x210c70=_0x33c4e7[_0x2301('0x16')]+_0x33c4e7['limit'],_0x1bc65d;if(_0x210c70>=_0x4966bf){_0x210c70=_0x4966bf;_0x1bc65d=0xc8;}else{_0x1bc65d=0xce;}_0x20c92f[_0x2301('0x12')](_0x1bc65d);return _0x20c92f[_0x2301('0x17')](_0x2301('0x18'),_0x31de17+'-'+_0x210c70+'/'+_0x4966bf)[_0x2301('0x14')](_0x1cc69a);}return null;};}function patchUpdates(_0x42cf6a){return function(_0x49c748){try{jsonpatch['apply'](_0x49c748,_0x42cf6a,!![]);}catch(_0x2d0f2a){return BPromise[_0x2301('0x19')](_0x2d0f2a);}return _0x49c748[_0x2301('0x1a')]();};}function saveUpdates(_0x52aa75,_0x33e9e5){return function(_0x2a3c29){if(_0x2a3c29){return _0x2a3c29[_0x2301('0x1b')](_0x52aa75)[_0x2301('0x1c')](function(_0x54785a){return _0x54785a;});}return null;};}function removeEntity(_0x59c543,_0x1faee0){return function(_0x4a869b){if(_0x4a869b){return _0x4a869b[_0x2301('0x1d')]()[_0x2301('0x1c')](function(){_0x59c543['status'](0xcc)[_0x2301('0x13')]();});}};}function handleEntityNotFound(_0x60df5f,_0x56efb3){return function(_0x2e1034){if(!_0x2e1034){_0x60df5f['sendStatus'](0x194);}return _0x2e1034;};}function handleError(_0x256d13,_0x410f4a){_0x410f4a=_0x410f4a||0x1f4;return function(_0x3559f4){logger[_0x2301('0x1e')](_0x3559f4[_0x2301('0x1f')]);if(_0x3559f4[_0x2301('0x20')]){delete _0x3559f4[_0x2301('0x20')];}_0x256d13['status'](_0x410f4a)[_0x2301('0x21')](_0x3559f4);};}exports['index']=function(_0x2bbf5d,_0xe65ba4){var _0x18d9c8={},_0x5a76f9={},_0xbe675a={'count':0x0,'rows':[]};var _0x51d1ab=db['Campaign'][_0x2301('0x22')];_0x5a76f9[_0x2301('0x23')]=_[_0x2301('0x24')](_0x51d1ab);var _0x5e3b29={'dateStart':_0x2bbf5d[_0x2301('0x25')][_0x2301('0x26')],'dateEnd':_0x2bbf5d[_0x2301('0x25')][_0x2301('0x27')]};delete _0x2bbf5d[_0x2301('0x25')][_0x2301('0x26')];delete _0x2bbf5d[_0x2301('0x25')]['dateEnd'];_0x5a76f9[_0x2301('0x25')]=_[_0x2301('0x24')](_0x2bbf5d[_0x2301('0x25')]);_0x5a76f9[_0x2301('0x28')]=_[_0x2301('0x29')](_0x5a76f9[_0x2301('0x23')],_0x5a76f9[_0x2301('0x25')]);_0x18d9c8['attributes']=_[_0x2301('0x29')](_0x5a76f9[_0x2301('0x23')],qs['fields'](_0x2bbf5d[_0x2301('0x25')]['fields']));_0x18d9c8[_0x2301('0x2a')]=_0x18d9c8[_0x2301('0x2a')][_0x2301('0x2b')]?_0x18d9c8['attributes']:_0x5a76f9[_0x2301('0x23')];if(!_0x2bbf5d[_0x2301('0x25')]['hasOwnProperty'](_0x2301('0x2c'))){_0x18d9c8[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x2bbf5d['query']['limit']);_0x18d9c8[_0x2301('0x16')]=qs['offset'](_0x2bbf5d[_0x2301('0x25')][_0x2301('0x16')]);}_0x18d9c8[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x2bbf5d[_0x2301('0x25')][_0x2301('0x2f')]);_0x18d9c8[_0x2301('0x30')]=qs['filters'](_[_0x2301('0x31')](_0x2bbf5d['query'],_0x5a76f9[_0x2301('0x28')]));if(_0x5e3b29['dateStart']){if(_0x5e3b29[_0x2301('0x27')]){_0x5e3b29['dateEnd']=moment(_0x5e3b29[_0x2301('0x27')])[_0x2301('0x32')](0x1,'day');}else{_0x5e3b29[_0x2301('0x27')]=moment(_0x5e3b29[_0x2301('0x26')])[_0x2301('0x32')](0x1,'day');}_[_0x2301('0x33')](_0x18d9c8[_0x2301('0x30')],{'createdAt':{'$gte':_0x5e3b29[_0x2301('0x26')],'$lte':_0x5e3b29[_0x2301('0x27')]}});}if(_0x2bbf5d[_0x2301('0x25')][_0x2301('0x34')]){_0x18d9c8[_0x2301('0x30')]=_[_0x2301('0x33')](_0x18d9c8['where'],{'$or':_[_0x2301('0x35')](_0x18d9c8[_0x2301('0x2a')],function(_0x2ec348){var _0xe967f7={};_0xe967f7[_0x2ec348]={'$like':'%'+_0x2bbf5d['query'][_0x2301('0x34')]+'%'};return _0xe967f7;})});}_0x18d9c8=_['merge']({},_0x18d9c8,_0x2bbf5d['options']);var _0x30815d={'where':_0x18d9c8[_0x2301('0x30')]};return db[_0x2301('0x36')]['count'](_0x30815d)['then'](function(_0x52a133){_0xbe675a[_0x2301('0x15')]=_0x52a133;if(_0x2bbf5d[_0x2301('0x25')][_0x2301('0x37')]){_0x18d9c8['include']=[{'all':!![]}];}return db[_0x2301('0x36')]['findAll'](_0x18d9c8);})['then'](function(_0x3858d7){_0xbe675a[_0x2301('0x38')]=_0x3858d7;return _0xbe675a;})['then'](respondWithFilteredResult(_0xe65ba4,_0x18d9c8))[_0x2301('0x39')](handleError(_0xe65ba4,null));};exports['show']=function(_0x40dc93,_0x42a7fd){var _0x5d8ede={'raw':![],'where':{'id':_0x40dc93[_0x2301('0x3a')]['id']}},_0x32826e={};_0x32826e[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x36')][_0x2301('0x22')]);_0x32826e[_0x2301('0x25')]=_[_0x2301('0x24')](_0x40dc93['query']);_0x32826e[_0x2301('0x28')]=_[_0x2301('0x29')](_0x32826e['model'],_0x32826e['query']);_0x5d8ede[_0x2301('0x2a')]=_['intersection'](_0x32826e[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x40dc93['query'][_0x2301('0x3b')]));_0x5d8ede[_0x2301('0x2a')]=_0x5d8ede[_0x2301('0x2a')][_0x2301('0x2b')]?_0x5d8ede[_0x2301('0x2a')]:_0x32826e['model'];if(_0x40dc93[_0x2301('0x25')][_0x2301('0x37')]){_0x5d8ede['include']=[{'all':!![]}];}_0x5d8ede=_['merge']({},_0x5d8ede,_0x40dc93['options']);return db[_0x2301('0x36')][_0x2301('0x3c')](_0x5d8ede)[_0x2301('0x1c')](handleEntityNotFound(_0x42a7fd,null))[_0x2301('0x1c')](respondWithResult(_0x42a7fd,null))[_0x2301('0x39')](handleError(_0x42a7fd,null));};exports[_0x2301('0x3d')]=function(_0x34b099,_0x33ff17){return db[_0x2301('0x36')]['create'](_0x34b099[_0x2301('0x3e')],{})[_0x2301('0x1c')](respondWithResult(_0x33ff17,0xc9))[_0x2301('0x39')](handleError(_0x33ff17,null));};exports[_0x2301('0x3f')]=function(_0x42d599,_0x551472){var _0x1b32c0={'raw':![],'where':{'id':_0x42d599['params']['id']}},_0x3209c6={};_0x3209c6[_0x2301('0x23')]=_['keys'](db[_0x2301('0x36')][_0x2301('0x22')]);_0x1b32c0[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x3209c6['model'],qs['fields'](_0x42d599[_0x2301('0x25')][_0x2301('0x3b')]));_0x1b32c0['attributes']=_0x1b32c0[_0x2301('0x2a')][_0x2301('0x2b')]?_0x1b32c0[_0x2301('0x2a')]:_0x3209c6[_0x2301('0x23')];if(_0x42d599[_0x2301('0x25')][_0x2301('0x37')]){_0x1b32c0[_0x2301('0x40')]=[{'all':!![]}];}_0x1b32c0=_[_0x2301('0x33')]({},_0x1b32c0,_0x42d599['options']);return db[_0x2301('0x36')][_0x2301('0x3c')](_0x1b32c0)['then'](handleEntityNotFound(_0x551472,null))['then'](function(_0x35b602){if(_0x35b602){var _0x3ef93d=_0x35b602[_0x2301('0x41')]({'plain':!![]});_0x3ef93d=qs['omit'](_0x3ef93d,['id',_0x2301('0x42'),_0x2301('0x43')]);_0x42d599[_0x2301('0x3e')]=_[_0x2301('0x44')](_0x42d599[_0x2301('0x3e')],['id',_0x2301('0x42'),_0x2301('0x43')]);return db[_0x2301('0x36')][_0x2301('0x3d')](_['merge'](_0x3ef93d,_0x42d599[_0x2301('0x3e')]),{'include':_0x42d599[_0x2301('0x25')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x2301('0x1c')](respondWithResult(_0x551472,0xc9))[_0x2301('0x39')](handleError(_0x551472,null));};exports[_0x2301('0x1b')]=function(_0x4efaf7,_0x1cdb8f){if(_0x4efaf7['body']['id']){delete _0x4efaf7[_0x2301('0x3e')]['id'];}return db['Campaign'][_0x2301('0x3c')]({'where':{'id':_0x4efaf7[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1cdb8f,null))['then'](saveUpdates(_0x4efaf7[_0x2301('0x3e')],null))[_0x2301('0x1c')](respondWithResult(_0x1cdb8f,null))[_0x2301('0x39')](handleError(_0x1cdb8f,null));};exports[_0x2301('0x1d')]=function(_0x2672b0,_0x3ba67c){return db[_0x2301('0x36')][_0x2301('0x3c')]({'where':{'id':_0x2672b0[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x3ba67c,null))[_0x2301('0x1c')](removeEntity(_0x3ba67c,null))[_0x2301('0x39')](handleError(_0x3ba67c,null));};exports[_0x2301('0x45')]=function(_0x46d16e,_0x56fb63,_0x28a234){var _0x52a2f1={'raw':!![],'where':{}};var _0x221a60={};var _0x473db6={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x46d16e[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x56fb63,null))[_0x2301('0x1c')](function(_0x45b710){if(_0x45b710){_0x221a60[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x47')][_0x2301('0x22')]);_0x221a60[_0x2301('0x25')]=_[_0x2301('0x24')](_0x46d16e[_0x2301('0x25')]);_0x221a60['filters']=_[_0x2301('0x29')](_0x221a60[_0x2301('0x23')],_0x221a60[_0x2301('0x25')]);_0x52a2f1['attributes']=_['intersection'](_0x221a60['model'],qs[_0x2301('0x3b')](_0x46d16e['query'][_0x2301('0x3b')]));_0x52a2f1['attributes']=_0x52a2f1[_0x2301('0x2a')][_0x2301('0x2b')]?_0x52a2f1[_0x2301('0x2a')]:_0x221a60[_0x2301('0x23')];if(!_0x46d16e[_0x2301('0x25')][_0x2301('0x48')]('nolimit')){_0x52a2f1['limit']=qs[_0x2301('0x2d')](_0x46d16e['query'][_0x2301('0x2d')]);_0x52a2f1[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x46d16e[_0x2301('0x25')]['offset']);}_0x52a2f1[_0x2301('0x2e')]=qs['sort'](_0x46d16e[_0x2301('0x25')][_0x2301('0x2f')]);_0x52a2f1[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x46d16e[_0x2301('0x25')],_0x221a60[_0x2301('0x28')]));_0x52a2f1[_0x2301('0x30')][_0x2301('0x49')]=_0x45b710['id'];if(_0x46d16e[_0x2301('0x25')][_0x2301('0x34')]){_0x52a2f1[_0x2301('0x30')]=_[_0x2301('0x33')](_0x52a2f1[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x52a2f1['attributes'],function(_0x11d3ca){var _0x2fd6a1={};_0x2fd6a1[_0x11d3ca]={'$like':'%'+_0x46d16e[_0x2301('0x25')][_0x2301('0x34')]+'%'};return _0x2fd6a1;})});}_0x52a2f1=_[_0x2301('0x33')]({},_0x52a2f1,_0x46d16e[_0x2301('0x4a')]);return db[_0x2301('0x47')]['count']({'where':_0x52a2f1[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x467f65){_0x473db6['count']=_0x467f65;if(_0x46d16e[_0x2301('0x25')][_0x2301('0x37')]){_0x52a2f1[_0x2301('0x40')]=[{'all':!![]}];}return db[_0x2301('0x47')]['findAll'](_0x52a2f1);})[_0x2301('0x1c')](function(_0x2bff80){_0x473db6[_0x2301('0x38')]=_0x2bff80;return _0x473db6;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x56fb63,_0x52a2f1))['catch'](handleError(_0x56fb63,null));};exports[_0x2301('0x4b')]=function(_0x4769fb,_0x185a85,_0x11aff5){var _0x479f29={'raw':!![],'where':{}};var _0xa8e53f={};var _0x533545={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x4769fb[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x185a85,null))[_0x2301('0x1c')](function(_0x4f48e1){if(_0x4f48e1){_0xa8e53f[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x4c')]['rawAttributes']);_0xa8e53f[_0x2301('0x25')]=_['keys'](_0x4769fb[_0x2301('0x25')]);_0xa8e53f['filters']=_[_0x2301('0x29')](_0xa8e53f[_0x2301('0x23')],_0xa8e53f[_0x2301('0x25')]);_0x479f29[_0x2301('0x2a')]=_[_0x2301('0x29')](_0xa8e53f[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x4769fb['query']['fields']));_0x479f29['attributes']=_0x479f29[_0x2301('0x2a')][_0x2301('0x2b')]?_0x479f29[_0x2301('0x2a')]:_0xa8e53f['model'];if(!_0x4769fb[_0x2301('0x25')][_0x2301('0x48')](_0x2301('0x2c'))){_0x479f29[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x4769fb['query'][_0x2301('0x2d')]);_0x479f29['offset']=qs[_0x2301('0x16')](_0x4769fb[_0x2301('0x25')][_0x2301('0x16')]);}_0x479f29[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x4769fb[_0x2301('0x25')][_0x2301('0x2f')]);_0x479f29[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x4769fb['query'],_0xa8e53f[_0x2301('0x28')]));_0x479f29[_0x2301('0x30')][_0x2301('0x49')]=_0x4f48e1['id'];if(_0x4769fb[_0x2301('0x25')][_0x2301('0x34')]){_0x479f29[_0x2301('0x30')]=_[_0x2301('0x33')](_0x479f29[_0x2301('0x30')],{'$or':_['map'](_0x479f29[_0x2301('0x2a')],function(_0x199c81){var _0x5aa5da={};_0x5aa5da[_0x199c81]={'$like':'%'+_0x4769fb[_0x2301('0x25')]['filter']+'%'};return _0x5aa5da;})});}_0x479f29=_[_0x2301('0x33')]({},_0x479f29,_0x4769fb[_0x2301('0x4a')]);return db[_0x2301('0x4c')][_0x2301('0x15')]({'where':_0x479f29[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x2d9b52){_0x533545[_0x2301('0x15')]=_0x2d9b52;if(_0x4769fb['query'][_0x2301('0x37')]){_0x479f29[_0x2301('0x40')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2301('0x4d')](_0x479f29);})['then'](function(_0x33a8ba){_0x533545[_0x2301('0x38')]=_0x33a8ba;return _0x533545;});}})['then'](respondWithFilteredResult(_0x185a85,_0x479f29))[_0x2301('0x39')](handleError(_0x185a85,null));};exports[_0x2301('0x4e')]=function(_0x5f1d62,_0x17aa60,_0x39ad98){var _0x4c165e={'raw':!![],'where':{}};var _0x1a77ef={};var _0x15dc2e={'count':0x0,'rows':[]};return db[_0x2301('0x36')][_0x2301('0x46')]({'where':{'id':_0x5f1d62[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x17aa60,null))['then'](function(_0x4ba993){if(_0x4ba993){_0x1a77ef[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x4f')]['rawAttributes']);_0x1a77ef[_0x2301('0x25')]=_['keys'](_0x5f1d62[_0x2301('0x25')]);_0x1a77ef['filters']=_['intersection'](_0x1a77ef['model'],_0x1a77ef[_0x2301('0x25')]);_0x4c165e[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x1a77ef[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x5f1d62[_0x2301('0x25')][_0x2301('0x3b')]));_0x4c165e['attributes']=_0x4c165e[_0x2301('0x2a')]['length']?_0x4c165e[_0x2301('0x2a')]:_0x1a77ef[_0x2301('0x23')];if(!_0x5f1d62[_0x2301('0x25')]['hasOwnProperty']('nolimit')){_0x4c165e['limit']=qs[_0x2301('0x2d')](_0x5f1d62[_0x2301('0x25')]['limit']);_0x4c165e[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x5f1d62['query'][_0x2301('0x16')]);}_0x4c165e['order']=qs[_0x2301('0x2f')](_0x5f1d62['query']['sort']);_0x4c165e[_0x2301('0x30')]=qs[_0x2301('0x28')](_['pick'](_0x5f1d62[_0x2301('0x25')],_0x1a77ef['filters']));_0x4c165e['where'][_0x2301('0x49')]=_0x4ba993['id'];if(_0x5f1d62['query'][_0x2301('0x34')]){_0x4c165e[_0x2301('0x30')]=_['merge'](_0x4c165e['where'],{'$or':_[_0x2301('0x35')](_0x4c165e[_0x2301('0x2a')],function(_0x53acf7){var _0xa4ca62={};_0xa4ca62[_0x53acf7]={'$like':'%'+_0x5f1d62['query']['filter']+'%'};return _0xa4ca62;})});}_0x4c165e=_[_0x2301('0x33')]({},_0x4c165e,_0x5f1d62[_0x2301('0x4a')]);return db[_0x2301('0x4f')]['count']({'where':_0x4c165e[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x4b7a6b){_0x15dc2e['count']=_0x4b7a6b;if(_0x5f1d62[_0x2301('0x25')][_0x2301('0x37')]){_0x4c165e['include']=[{'all':!![]}];}return db[_0x2301('0x4f')][_0x2301('0x4d')](_0x4c165e);})[_0x2301('0x1c')](function(_0x4241f5){_0x15dc2e[_0x2301('0x38')]=_0x4241f5;return _0x15dc2e;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x17aa60,_0x4c165e))['catch'](handleError(_0x17aa60,null));};exports[_0x2301('0x50')]=function(_0x1df3b5,_0x5b1a83,_0x3d5277){var _0x3794a9={'raw':!![],'where':{}};var _0xdcf9ea={};var _0x12433c={'count':0x0,'rows':[]};return db[_0x2301('0x36')]['findOne']({'where':{'id':_0x1df3b5[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5b1a83,null))[_0x2301('0x1c')](function(_0xa2d11e){if(_0xa2d11e){_0xdcf9ea[_0x2301('0x23')]=_['keys'](db['CmHopperBlack'][_0x2301('0x22')]);_0xdcf9ea['query']=_[_0x2301('0x24')](_0x1df3b5[_0x2301('0x25')]);_0xdcf9ea[_0x2301('0x28')]=_['intersection'](_0xdcf9ea[_0x2301('0x23')],_0xdcf9ea['query']);_0x3794a9[_0x2301('0x2a')]=_[_0x2301('0x29')](_0xdcf9ea[_0x2301('0x23')],qs['fields'](_0x1df3b5[_0x2301('0x25')][_0x2301('0x3b')]));_0x3794a9[_0x2301('0x2a')]=_0x3794a9[_0x2301('0x2a')]['length']?_0x3794a9['attributes']:_0xdcf9ea[_0x2301('0x23')];if(!_0x1df3b5[_0x2301('0x25')]['hasOwnProperty'](_0x2301('0x2c'))){_0x3794a9[_0x2301('0x2d')]=qs['limit'](_0x1df3b5['query'][_0x2301('0x2d')]);_0x3794a9[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x1df3b5[_0x2301('0x25')][_0x2301('0x16')]);}_0x3794a9[_0x2301('0x2e')]=qs[_0x2301('0x2f')](_0x1df3b5[_0x2301('0x25')][_0x2301('0x2f')]);_0x3794a9[_0x2301('0x30')]=qs['filters'](_[_0x2301('0x31')](_0x1df3b5[_0x2301('0x25')],_0xdcf9ea[_0x2301('0x28')]));_0x3794a9['where']['CampaignId']=_0xa2d11e['id'];if(_0x1df3b5[_0x2301('0x25')][_0x2301('0x34')]){_0x3794a9[_0x2301('0x30')]=_['merge'](_0x3794a9['where'],{'$or':_[_0x2301('0x35')](_0x3794a9[_0x2301('0x2a')],function(_0x1f7645){var _0x3171df={};_0x3171df[_0x1f7645]={'$like':'%'+_0x1df3b5[_0x2301('0x25')]['filter']+'%'};return _0x3171df;})});}_0x3794a9=_[_0x2301('0x33')]({},_0x3794a9,_0x1df3b5[_0x2301('0x4a')]);return db[_0x2301('0x51')]['count']({'where':_0x3794a9['where']})[_0x2301('0x1c')](function(_0x13c8d8){_0x12433c[_0x2301('0x15')]=_0x13c8d8;if(_0x1df3b5[_0x2301('0x25')][_0x2301('0x37')]){_0x3794a9[_0x2301('0x40')]=[{'all':!![]}];}return db[_0x2301('0x51')][_0x2301('0x4d')](_0x3794a9);})[_0x2301('0x1c')](function(_0x59d327){_0x12433c['rows']=_0x59d327;return _0x12433c;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x5b1a83,_0x3794a9))[_0x2301('0x39')](handleError(_0x5b1a83,null));};exports['getLists']=function(_0x875cb5,_0xcf59d2,_0x2f9e02){var _0x50e81f={};var _0x3135d3={};var _0x459500;var _0x528444;return db[_0x2301('0x36')]['findOne']({'where':{'id':_0x875cb5['params']['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0xcf59d2,null))[_0x2301('0x1c')](function(_0xba8611){if(_0xba8611){_0x459500=_0xba8611;_0x3135d3['model']=_[_0x2301('0x24')](db['CmList'][_0x2301('0x22')]);_0x3135d3[_0x2301('0x25')]=_[_0x2301('0x24')](_0x875cb5[_0x2301('0x25')]);_0x3135d3[_0x2301('0x28')]=_[_0x2301('0x29')](_0x3135d3[_0x2301('0x23')],_0x3135d3[_0x2301('0x25')]);_0x50e81f[_0x2301('0x2a')]=_[_0x2301('0x29')](_0x3135d3[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x875cb5[_0x2301('0x25')][_0x2301('0x3b')]));_0x50e81f[_0x2301('0x2a')]=_0x50e81f[_0x2301('0x2a')][_0x2301('0x2b')]?_0x50e81f['attributes']:_0x3135d3['model'];_0x50e81f['order']=qs[_0x2301('0x2f')](_0x875cb5['query'][_0x2301('0x2f')]);_0x50e81f[_0x2301('0x30')]=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x875cb5[_0x2301('0x25')],_0x3135d3[_0x2301('0x28')]));if(_0x875cb5[_0x2301('0x25')][_0x2301('0x34')]){_0x50e81f[_0x2301('0x30')]=_[_0x2301('0x33')](_0x50e81f[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x50e81f[_0x2301('0x2a')],function(_0x51c975){var _0x3bcd01={};_0x3bcd01[_0x51c975]={'$like':'%'+_0x875cb5[_0x2301('0x25')][_0x2301('0x34')]+'%'};return _0x3bcd01;})});}_0x50e81f=_[_0x2301('0x33')]({},_0x50e81f,_0x875cb5['options']);return _0x459500[_0x2301('0x52')](_0x50e81f);}})[_0x2301('0x1c')](function(_0x106242){if(_0x106242){_0x528444=_0x106242[_0x2301('0x2b')];if(!_0x875cb5['query'][_0x2301('0x48')](_0x2301('0x2c'))){_0x50e81f[_0x2301('0x2d')]=qs[_0x2301('0x2d')](_0x875cb5[_0x2301('0x25')]['limit']);_0x50e81f[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x875cb5[_0x2301('0x25')]['offset']);}return _0x459500[_0x2301('0x52')](_0x50e81f);}})[_0x2301('0x1c')](function(_0x593e75){if(_0x593e75){return _0x593e75?{'count':_0x528444,'rows':_0x593e75}:null;}})['then'](respondWithResult(_0xcf59d2,null))['catch'](handleError(_0xcf59d2,null));};exports[_0x2301('0x53')]=function(_0x145026,_0x38d1e5,_0x1d0646){var _0x5b6e10,_0x1a8f20;return db[_0x2301('0x36')]['find']({'where':{'id':_0x145026[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x38d1e5,null))[_0x2301('0x1c')](function(_0x42093f){if(_0x42093f){_0x1a8f20=_0x42093f;return _0x42093f[_0x2301('0x53')](_0x145026['body'][_0x2301('0x54')],_[_0x2301('0x44')](_0x145026['body'],[_0x2301('0x54'),'id'])||{});}return null;})[_0x2301('0x55')](function(_0x1a1c1f){var _0x4917ee;_0x5b6e10=_0x1a1c1f||[];var _0x5043c8=[];if(_0x1a1c1f){for(var _0xf61a68=0x0;_0xf61a68<_0x1a1c1f['length'];_0xf61a68+=0x1){var _0x332fc0=_0x1a1c1f[_0xf61a68][_0x2301('0x41')]({'plain':!![]});_0x1a8f20['dialCheckDuplicateType']=_0x145026['body'][_0x2301('0x56')]?_0x145026[_0x2301('0x3e')][_0x2301('0x56')]:_0x1a8f20[_0x2301('0x56')];switch(_0x1a8f20[_0x2301('0x56')]){case _0x2301('0x57'):_0x4917ee=squel['insert']()['into'](_0x2301('0x58'))[_0x2301('0x59')]([_0x2301('0x5a'),_0x2301('0x5b'),_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),_0x2301('0x42'),_0x2301('0x43')],squel[_0x2301('0x5e')]()[_0x2301('0x5f')]('phone',_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),_0x2301('0x5d'))['field'](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x42'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')]('cm_contacts')[_0x2301('0x30')](_0x2301('0x64'))['where'](_0x2301('0x65'),_0x332fc0['CmListId'][_0x2301('0x62')]())[_0x2301('0x30')]('phone\x20IS\x20NOT\x20NULL')[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x67'))['from'](_0x2301('0x68'))[_0x2301('0x30')]('CampaignId\x20=\x20?',_0x145026['params']['id'][_0x2301('0x62')]()))[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'))[_0x2301('0x63')]('cm_hopper')['where'](_0x2301('0x69'),_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')]())))['toString']();break;case _0x2301('0x6a'):_0x4917ee=squel['insert']()[_0x2301('0x6b')](_0x2301('0x58'))[_0x2301('0x59')](['phone',_0x2301('0x5b'),'ContactId','ListId',_0x2301('0x49'),_0x2301('0x42'),'updatedAt'],squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'),_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),'ListId')[_0x2301('0x5f')](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),'createdAt')[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')]('deletedAt\x20IS\x20NULL')['where'](_0x2301('0x65'),_0x332fc0[_0x2301('0x61')][_0x2301('0x62')]())[_0x2301('0x30')](_0x2301('0x6d'))[_0x2301('0x30')](_0x2301('0x66'),squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'))[_0x2301('0x63')]('cm_hopper')[_0x2301('0x30')](_0x2301('0x69'),_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')]())))['toString']();break;default:_0x4917ee=squel[_0x2301('0x6e')]()[_0x2301('0x6b')](_0x2301('0x58'))[_0x2301('0x59')]([_0x2301('0x5a'),_0x2301('0x5b'),_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),_0x2301('0x42'),_0x2301('0x43')],squel[_0x2301('0x5e')]()[_0x2301('0x5f')](_0x2301('0x5a'),_0x2301('0x5a'))[_0x2301('0x5f')](_0x2301('0x60'),'scheduledAt')[_0x2301('0x5f')]('id',_0x2301('0x5c'))[_0x2301('0x5f')](_0x332fc0[_0x2301('0x61')]['toString'](),_0x2301('0x5d'))[_0x2301('0x5f')](_0x145026[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))['field'](_0x2301('0x60'),'createdAt')[_0x2301('0x5f')]('NOW()',_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')](_0x2301('0x64'))[_0x2301('0x30')]('ListId\x20=\x20?',_0x332fc0[_0x2301('0x61')][_0x2301('0x62')]())[_0x2301('0x30')]('phone\x20IS\x20NOT\x20NULL'))[_0x2301('0x62')]();}_0x5043c8[_0x2301('0x6f')](db[_0x2301('0x70')][_0x2301('0x25')](_0x4917ee));}return BPromise[_0x2301('0x71')](_0x5043c8);}})['then'](function(){return _0x5b6e10;})[_0x2301('0x1c')](respondWithResult(_0x38d1e5,null))[_0x2301('0x39')](handleError(_0x38d1e5,null));};exports[_0x2301('0x72')]=function(_0x1e2c43,_0x584788,_0x1d90c8){var _0x2fec87;return db['Campaign'][_0x2301('0x3c')]({'where':{'id':_0x1e2c43['params']['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x584788,null))['then'](function(_0x36a59a){if(_0x36a59a){return _0x36a59a['removeLists'](_0x1e2c43[_0x2301('0x25')]['ids']);}})[_0x2301('0x1c')](function(_0xf73fed){if(_0xf73fed){_0x2fec87=_0xf73fed;return db[_0x2301('0x47')][_0x2301('0x1d')]({'where':{'ListId':_0x1e2c43['query'][_0x2301('0x54')],'CampaignId':_0x1e2c43[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](function(){return _0x2fec87;});}})[_0x2301('0x1c')](respondWithStatusCode(_0x584788,null))['catch'](handleError(_0x584788,null));};exports['getBlackLists']=function(_0x1a486c,_0x50e085,_0x5bac40){var _0x4e3744={'raw':!![],'where':{}};var _0x468862={};var _0x3c27c6={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x1a486c[_0x2301('0x3a')]['id']}})['then'](handleEntityNotFound(_0x50e085,null))[_0x2301('0x1c')](function(_0x393522){if(_0x393522){_0x468862[_0x2301('0x23')]=_[_0x2301('0x24')](db[_0x2301('0x73')]['rawAttributes']);_0x468862[_0x2301('0x25')]=_[_0x2301('0x24')](_0x1a486c[_0x2301('0x25')]);_0x468862[_0x2301('0x28')]=_[_0x2301('0x29')](_0x468862[_0x2301('0x23')],_0x468862[_0x2301('0x25')]);_0x4e3744[_0x2301('0x2a')]=_['intersection'](_0x468862[_0x2301('0x23')],qs[_0x2301('0x3b')](_0x1a486c['query'][_0x2301('0x3b')]));_0x4e3744['attributes']=_0x4e3744['attributes'][_0x2301('0x2b')]?_0x4e3744['attributes']:_0x468862[_0x2301('0x23')];if(!_0x1a486c['query'][_0x2301('0x48')](_0x2301('0x2c'))){_0x4e3744[_0x2301('0x2d')]=qs['limit'](_0x1a486c[_0x2301('0x25')][_0x2301('0x2d')]);_0x4e3744[_0x2301('0x16')]=qs[_0x2301('0x16')](_0x1a486c[_0x2301('0x25')][_0x2301('0x16')]);}_0x4e3744[_0x2301('0x2e')]=qs['sort'](_0x1a486c['query'][_0x2301('0x2f')]);_0x4e3744['where']=qs[_0x2301('0x28')](_[_0x2301('0x31')](_0x1a486c[_0x2301('0x25')],_0x468862['filters']));_0x4e3744[_0x2301('0x30')][_0x2301('0x49')]=_0x393522['id'];if(_0x1a486c['query'][_0x2301('0x34')]){_0x4e3744['where']=_[_0x2301('0x33')](_0x4e3744[_0x2301('0x30')],{'$or':_[_0x2301('0x35')](_0x4e3744['attributes'],function(_0x2c42c1){var _0x22e47d={};_0x22e47d[_0x2c42c1]={'$like':'%'+_0x1a486c['query'][_0x2301('0x34')]+'%'};return _0x22e47d;})});}_0x4e3744=_[_0x2301('0x33')]({},_0x4e3744,_0x1a486c['options']);return db[_0x2301('0x73')][_0x2301('0x15')]({'where':_0x4e3744[_0x2301('0x30')]})[_0x2301('0x1c')](function(_0x106d26){_0x3c27c6['count']=_0x106d26;if(_0x1a486c[_0x2301('0x25')][_0x2301('0x37')]){_0x4e3744[_0x2301('0x40')]=[{'all':!![]}];}return db['CmList'][_0x2301('0x4d')](_0x4e3744);})[_0x2301('0x1c')](function(_0x138c03){_0x3c27c6[_0x2301('0x38')]=_0x138c03;return _0x3c27c6;});}})[_0x2301('0x1c')](respondWithFilteredResult(_0x50e085,_0x4e3744))[_0x2301('0x39')](handleError(_0x50e085,null));};exports['addBlackLists']=function(_0x253a59,_0x736c3c,_0x277023){var _0x144540,_0x427186;return db[_0x2301('0x36')]['find']({'where':{'id':_0x253a59[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](handleEntityNotFound(_0x736c3c,null))['then'](function(_0x2788df){if(_0x2788df){_0x427186=_0x2788df;return _0x2788df[_0x2301('0x74')](_0x253a59[_0x2301('0x3e')][_0x2301('0x54')],_['omit'](_0x253a59[_0x2301('0x3e')],[_0x2301('0x54'),'id'])||{});}return null;})['spread'](function(_0x41508a){var _0x152454;_0x144540=_0x41508a||[];var _0x279826=[];if(_0x41508a){for(var _0x485b13=0x0;_0x485b13<_0x41508a[_0x2301('0x2b')];_0x485b13+=0x1){var _0x182a0f=_0x41508a[_0x485b13]['get']({'plain':!![]});_0x152454=squel[_0x2301('0x6e')]()[_0x2301('0x6b')](_0x2301('0x75'))['fromQuery'](['phone',_0x2301('0x5c'),_0x2301('0x5d'),_0x2301('0x49'),'createdAt',_0x2301('0x43')],squel['select']()[_0x2301('0x5f')]('phone',_0x2301('0x5a'))[_0x2301('0x5f')]('id','ContactId')['field'](_0x182a0f[_0x2301('0x61')][_0x2301('0x62')](),_0x2301('0x5d'))[_0x2301('0x5f')](_0x253a59[_0x2301('0x3a')]['id'][_0x2301('0x62')](),_0x2301('0x49'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x42'))[_0x2301('0x5f')](_0x2301('0x60'),_0x2301('0x43'))[_0x2301('0x63')](_0x2301('0x6c'))[_0x2301('0x30')]('deletedAt\x20IS\x20NULL')[_0x2301('0x30')](_0x2301('0x65'),_0x182a0f['CmListId'][_0x2301('0x62')]())[_0x2301('0x30')](_0x2301('0x6d')))['toString']();_0x279826[_0x2301('0x6f')](db['sequelize'][_0x2301('0x25')](_0x152454));}return BPromise[_0x2301('0x71')](_0x279826);}})[_0x2301('0x1c')](function(){return _0x144540;})[_0x2301('0x1c')](respondWithResult(_0x736c3c,null))[_0x2301('0x39')](handleError(_0x736c3c,null));};exports[_0x2301('0x76')]=function(_0x5c8778,_0x44bb01,_0x3d9a14){var _0x41edbc;return db[_0x2301('0x36')][_0x2301('0x3c')]({'where':{'id':_0x5c8778['params']['id']}})['then'](handleEntityNotFound(_0x44bb01,null))[_0x2301('0x1c')](function(_0x342cec){if(_0x342cec){return _0x342cec['removeBlackLists'](_0x5c8778['query']['ids']);}})[_0x2301('0x1c')](function(_0x51e2b){if(_0x51e2b){_0x41edbc=_0x51e2b;return db['CmHopperBlack'][_0x2301('0x1d')]({'where':{'ListId':_0x5c8778[_0x2301('0x25')][_0x2301('0x54')],'CampaignId':_0x5c8778[_0x2301('0x3a')]['id']}})[_0x2301('0x1c')](function(){return _0x41edbc;});}})[_0x2301('0x1c')](respondWithStatusCode(_0x44bb01,null))[_0x2301('0x39')](handleError(_0x44bb01,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6367d8f..f8b1373 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 _0x7ef8=['request-promise','./campaign.attributes','exports','Campaign','campaigns','util','../../config/logger','api','moment'];(function(_0x106496,_0x3f16b1){var _0x54b50a=function(_0xf3fe16){while(--_0xf3fe16){_0x106496['push'](_0x106496['shift']());}};_0x54b50a(++_0x3f16b1);}(_0x7ef8,0xb9));var _0x87ef=function(_0x5c2cd5,_0x1c2fbb){_0x5c2cd5=_0x5c2cd5-0x0;var _0x5180e9=_0x7ef8[_0x5c2cd5];return _0x5180e9;};'use strict';var _=require('lodash');var util=require(_0x87ef('0x0'));var logger=require(_0x87ef('0x1'))(_0x87ef('0x2'));var moment=require(_0x87ef('0x3'));var BPromise=require('bluebird');var rp=require(_0x87ef('0x4'));var attributes=require(_0x87ef('0x5'));module[_0x87ef('0x6')]=function(_0x2a16aa,_0x2e5865){return _0x2a16aa['define'](_0x87ef('0x7'),attributes,{'tableName':_0x87ef('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf635=['lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define','Campaign','campaigns'];(function(_0xacf370,_0x3bd96f){var _0x456f67=function(_0x2de878){while(--_0x2de878){_0xacf370['push'](_0xacf370['shift']());}};_0x456f67(++_0x3bd96f);}(_0xf635,0xdc));var _0x5f63=function(_0x402718,_0x22529c){_0x402718=_0x402718-0x0;var _0x3e6afb=_0xf635[_0x402718];return _0x3e6afb;};'use strict';var _=require(_0x5f63('0x0'));var util=require(_0x5f63('0x1'));var logger=require(_0x5f63('0x2'))('api');var moment=require(_0x5f63('0x3'));var BPromise=require(_0x5f63('0x4'));var rp=require(_0x5f63('0x5'));var attributes=require('./campaign.attributes');module[_0x5f63('0x6')]=function(_0x1ed505,_0x4663be){return _0x1ed505[_0x5f63('0x7')](_0x5f63('0x8'),attributes,{'tableName':_0x5f63('0x9'),'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 94ef50f..362cbb6 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 _0x0e32=['code','message','Campaign,\x20%s,\x20%s','result','catch','GetCampaign','Campaign','options','raw','where','attributes','limit','include','model','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','then','info','debug','request\x20sent','stringify','error'];(function(_0x23ab5f,_0x2d847e){var _0x319643=function(_0x377d8a){while(--_0x377d8a){_0x23ab5f['push'](_0x23ab5f['shift']());}};_0x319643(++_0x2d847e);}(_0x0e32,0x131));var _0x20e3=function(_0x23e2b9,_0x163b12){_0x23e2b9=_0x23e2b9-0x0;var _0x57e61a=_0x0e32[_0x23e2b9];return _0x57e61a;};'use strict';var _=require(_0x20e3('0x0'));var util=require(_0x20e3('0x1'));var moment=require(_0x20e3('0x2'));var BPromise=require(_0x20e3('0x3'));var rs=require(_0x20e3('0x4'));var fs=require('fs');var db=require(_0x20e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x20e3('0x6'));var config=require('../../config/environment');var jayson=require(_0x20e3('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x714d03,_0x46116e,_0x4f08c2){return new BPromise(function(_0x40b126,_0x4375f9){return client['request'](_0x714d03,_0x4f08c2)[_0x20e3('0x8')](function(_0x519b03){logger[_0x20e3('0x9')]('Campaign,\x20%s,\x20%s',_0x46116e,'request\x20sent');logger[_0x20e3('0xa')]('Campaign,\x20%s,\x20%s,\x20%s',_0x46116e,_0x20e3('0xb'),JSON[_0x20e3('0xc')](_0x519b03));if(_0x519b03[_0x20e3('0xd')]){if(_0x519b03[_0x20e3('0xd')][_0x20e3('0xe')]===0x1f4){logger[_0x20e3('0xd')]('Campaign,\x20%s,\x20%s',_0x46116e,_0x519b03[_0x20e3('0xd')][_0x20e3('0xf')]);return _0x4375f9(_0x519b03['error'][_0x20e3('0xf')]);}logger['error'](_0x20e3('0x10'),_0x46116e,_0x519b03[_0x20e3('0xd')][_0x20e3('0xf')]);return _0x40b126(_0x519b03[_0x20e3('0xd')][_0x20e3('0xf')]);}else{logger['info'](_0x20e3('0x10'),_0x46116e,'request\x20sent');_0x40b126(_0x519b03[_0x20e3('0x11')][_0x20e3('0xf')]);}})[_0x20e3('0x12')](function(_0x11fec8){logger[_0x20e3('0xd')](_0x20e3('0x10'),_0x46116e,_0x11fec8);_0x4375f9(_0x11fec8);});});}exports[_0x20e3('0x13')]=function(_0x103cca){var _0x1b45aa=this;return new Promise(function(_0xbc099e,_0x3ee9fe){return db[_0x20e3('0x14')]['findAll']({'raw':_0x103cca[_0x20e3('0x15')]?_0x103cca[_0x20e3('0x15')][_0x20e3('0x16')]===undefined?!![]:![]:!![],'where':_0x103cca[_0x20e3('0x15')]?_0x103cca[_0x20e3('0x15')][_0x20e3('0x17')]||null:null,'attributes':_0x103cca[_0x20e3('0x15')]?_0x103cca[_0x20e3('0x15')][_0x20e3('0x18')]||null:null,'limit':_0x103cca[_0x20e3('0x15')]?_0x103cca['options'][_0x20e3('0x19')]||null:null,'include':_0x103cca[_0x20e3('0x15')]?_0x103cca['options'][_0x20e3('0x1a')]?_['map'](_0x103cca[_0x20e3('0x15')][_0x20e3('0x1a')],function(_0x321b49){return{'model':db[_0x321b49[_0x20e3('0x1b')]],'as':_0x321b49['as'],'attributes':_0x321b49[_0x20e3('0x18')],'include':_0x321b49[_0x20e3('0x1a')]?_[_0x20e3('0x1c')](_0x321b49['include'],function(_0x1a6ad6){return{'model':db[_0x1a6ad6[_0x20e3('0x1b')]],'as':_0x1a6ad6['as'],'attributes':_0x1a6ad6['attributes'],'include':_0x1a6ad6[_0x20e3('0x1a')]?_[_0x20e3('0x1c')](_0x1a6ad6[_0x20e3('0x1a')],function(_0x290ae9){return{'model':db[_0x290ae9[_0x20e3('0x1b')]],'as':_0x290ae9['as'],'attributes':_0x290ae9['attributes']};}):[]};}):[]};}):[]:[]})[_0x20e3('0x8')](function(_0x56826d){logger[_0x20e3('0x9')](_0x20e3('0x13'),_0x103cca);logger['debug']('GetCampaign',_0x103cca,JSON[_0x20e3('0xc')](_0x56826d));_0xbc099e(_0x56826d);})[_0x20e3('0x12')](function(_0x91b40f){logger[_0x20e3('0xd')]('GetCampaign',_0x91b40f[_0x20e3('0xf')],_0x103cca);_0x3ee9fe(_0x1b45aa[_0x20e3('0xd')](0x1f4,_0x91b40f[_0x20e3('0xf')]));});});}; \ No newline at end of file +var _0x6b46=['raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetCampaign','Campaign','options'];(function(_0x5d5edb,_0x3d416f){var _0x34324c=function(_0x52af0d){while(--_0x52af0d){_0x5d5edb['push'](_0x5d5edb['shift']());}};_0x34324c(++_0x3d416f);}(_0x6b46,0xd0));var _0x66b4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6b46[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x66b4('0x0'));var moment=require(_0x66b4('0x1'));var BPromise=require(_0x66b4('0x2'));var rs=require(_0x66b4('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x66b4('0x4'));var logger=require(_0x66b4('0x5'))(_0x66b4('0x6'));var config=require(_0x66b4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x66b4('0x8')][_0x66b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4be2b1,_0x2f1411,_0x4b695b){return new BPromise(function(_0x464078,_0x24aa73){return client[_0x66b4('0xa')](_0x4be2b1,_0x4b695b)[_0x66b4('0xb')](function(_0x2848c4){logger[_0x66b4('0xc')](_0x66b4('0xd'),_0x2f1411,_0x66b4('0xe'));logger[_0x66b4('0xf')](_0x66b4('0x10'),_0x2f1411,_0x66b4('0xe'),JSON[_0x66b4('0x11')](_0x2848c4));if(_0x2848c4['error']){if(_0x2848c4['error']['code']===0x1f4){logger[_0x66b4('0x12')](_0x66b4('0xd'),_0x2f1411,_0x2848c4[_0x66b4('0x12')][_0x66b4('0x13')]);return _0x24aa73(_0x2848c4['error']['message']);}logger[_0x66b4('0x12')]('Campaign,\x20%s,\x20%s',_0x2f1411,_0x2848c4[_0x66b4('0x12')]['message']);return _0x464078(_0x2848c4[_0x66b4('0x12')][_0x66b4('0x13')]);}else{logger[_0x66b4('0xc')](_0x66b4('0xd'),_0x2f1411,_0x66b4('0xe'));_0x464078(_0x2848c4['result'][_0x66b4('0x13')]);}})[_0x66b4('0x14')](function(_0x2fc444){logger[_0x66b4('0x12')](_0x66b4('0xd'),_0x2f1411,_0x2fc444);_0x24aa73(_0x2fc444);});});}exports[_0x66b4('0x15')]=function(_0x5ee49e){var _0x4b6210=this;return new Promise(function(_0x324443,_0x55b3da){return db[_0x66b4('0x16')]['findAll']({'raw':_0x5ee49e['options']?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x18')]===undefined?!![]:![]:!![],'where':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')]['where']||null:null,'attributes':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x19')]||null:null,'limit':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')]['limit']||null:null,'include':_0x5ee49e[_0x66b4('0x17')]?_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x1a')]?_['map'](_0x5ee49e[_0x66b4('0x17')][_0x66b4('0x1a')],function(_0x34e28c){return{'model':db[_0x34e28c['model']],'as':_0x34e28c['as'],'attributes':_0x34e28c[_0x66b4('0x19')],'include':_0x34e28c['include']?_[_0x66b4('0x1b')](_0x34e28c[_0x66b4('0x1a')],function(_0x74f831){return{'model':db[_0x74f831['model']],'as':_0x74f831['as'],'attributes':_0x74f831[_0x66b4('0x19')],'include':_0x74f831[_0x66b4('0x1a')]?_[_0x66b4('0x1b')](_0x74f831[_0x66b4('0x1a')],function(_0x4e388b){return{'model':db[_0x4e388b[_0x66b4('0x1c')]],'as':_0x4e388b['as'],'attributes':_0x4e388b[_0x66b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0x66b4('0xb')](function(_0x1cbc48){logger[_0x66b4('0xc')](_0x66b4('0x15'),_0x5ee49e);logger['debug'](_0x66b4('0x15'),_0x5ee49e,JSON[_0x66b4('0x11')](_0x1cbc48));_0x324443(_0x1cbc48);})['catch'](function(_0x2093ba){logger[_0x66b4('0x12')](_0x66b4('0x15'),_0x2093ba[_0x66b4('0x13')],_0x5ee49e);_0x55b3da(_0x4b6210[_0x66b4('0x12')](0x1f4,_0x2093ba['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 400de95..84b1339 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 _0x8eca=['/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','delete','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','/:id','show','/:id/hoppers','isAuthenticated','getHoppers','get','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists'];(function(_0x2f688e,_0x1c637b){var _0x1e3430=function(_0x27fccc){while(--_0x27fccc){_0x2f688e['push'](_0x2f688e['shift']());}};_0x1e3430(++_0x1c637b);}(_0x8eca,0x1e2));var _0xa8ec=function(_0x46005d,_0x3810cd){_0x46005d=_0x46005d-0x0;var _0x3bff1d=_0x8eca[_0x46005d];return _0x3bff1d;};'use strict';var multer=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var path=require(_0xa8ec('0x2'));var express=require('express');var router=express[_0xa8ec('0x3')]();var auth=require(_0xa8ec('0x4'));var interaction=require(_0xa8ec('0x5'));var config=require(_0xa8ec('0x6'));var controller=require(_0xa8ec('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa8ec('0x8'),auth['isAuthenticated'](),controller[_0xa8ec('0x9')]);router['get'](_0xa8ec('0xa'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0xc')]);router[_0xa8ec('0xd')](_0xa8ec('0xe'),auth['isAuthenticated'](),controller[_0xa8ec('0xf')]);router[_0xa8ec('0xd')](_0xa8ec('0x10'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x11')]);router[_0xa8ec('0xd')](_0xa8ec('0x12'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x13')]);router[_0xa8ec('0xd')](_0xa8ec('0x14'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x15')]);router[_0xa8ec('0xd')](_0xa8ec('0x16'),auth['isAuthenticated'](),controller[_0xa8ec('0x17')]);router[_0xa8ec('0x18')]('/',auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x19')]);router[_0xa8ec('0x18')](_0xa8ec('0x1a'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x1b')]);router[_0xa8ec('0x18')](_0xa8ec('0x14'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x1c')]);router['post']('/:id/blacklists',auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x1d')]);router[_0xa8ec('0x1e')](_0xa8ec('0x8'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x1f')]);router[_0xa8ec('0x20')](_0xa8ec('0x8'),auth[_0xa8ec('0xb')](),controller['destroy']);router[_0xa8ec('0x20')](_0xa8ec('0x14'),auth[_0xa8ec('0xb')](),controller[_0xa8ec('0x21')]);router[_0xa8ec('0x20')](_0xa8ec('0x16'),auth['isAuthenticated'](),controller[_0xa8ec('0x22')]);module[_0xa8ec('0x23')]=router; \ No newline at end of file +var _0x9d0d=['multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists','put','update','destroy','delete','removeBlackLists','exports'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x9d0d,0xe7));var _0xd9d0=function(_0x53d7c0,_0xd0b7b8){_0x53d7c0=_0x53d7c0-0x0;var _0x322a0e=_0x9d0d[_0x53d7c0];return _0x322a0e;};'use strict';var multer=require(_0xd9d0('0x0'));var util=require('util');var path=require(_0xd9d0('0x1'));var express=require(_0xd9d0('0x2'));var router=express[_0xd9d0('0x3')]();var auth=require(_0xd9d0('0x4'));var interaction=require(_0xd9d0('0x5'));var config=require(_0xd9d0('0x6'));var controller=require(_0xd9d0('0x7'));router[_0xd9d0('0x8')]('/',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0xa')]);router[_0xd9d0('0x8')](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller['show']);router['get'](_0xd9d0('0xc'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0xd')]);router[_0xd9d0('0x8')](_0xd9d0('0xe'),auth[_0xd9d0('0x9')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0xd9d0('0x9')](),controller['getHopperFinals']);router[_0xd9d0('0x8')](_0xd9d0('0xf'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x10')]);router[_0xd9d0('0x8')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x12')]);router[_0xd9d0('0x8')](_0xd9d0('0x13'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x14')]);router[_0xd9d0('0x15')]('/',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x16')]);router[_0xd9d0('0x15')](_0xd9d0('0x17'),auth['isAuthenticated'](),controller[_0xd9d0('0x18')]);router[_0xd9d0('0x15')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x19')]);router['post']('/:id/blacklists',auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1a')]);router[_0xd9d0('0x1b')](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1c')]);router['delete'](_0xd9d0('0xb'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1d')]);router[_0xd9d0('0x1e')](_0xd9d0('0x11'),auth[_0xd9d0('0x9')](),controller['removeLists']);router['delete'](_0xd9d0('0x13'),auth[_0xd9d0('0x9')](),controller[_0xd9d0('0x1f')]);module[_0xd9d0('0x20')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 142aa2f..99030b1 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 _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x4f5b1,_0x2e1f00){var _0x1e380e=function(_0x512e1b){while(--_0x512e1b){_0x4f5b1['push'](_0x4f5b1['shift']());}};_0x1e380e(++_0x2e1f00);}(_0xb138,0x1dd));var _0x8b13=function(_0xb15182,_0x48d8fb){_0xb15182=_0xb15182-0x0;var _0x4a8749=_0xb138[_0xb15182];return _0x4a8749;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'key':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8b13('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]}}; \ No newline at end of file +var _0x4c60=['TEXT','sequelize','exports','STRING'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4c60,0xc1));var _0x04c6=function(_0x765aa4,_0x5f49a2){_0x765aa4=_0x765aa4-0x0;var _0x10b33f=_0x4c60[_0x765aa4];return _0x10b33f;};'use strict';var Sequelize=require(_0x04c6('0x0'));module[_0x04c6('0x1')]={'key':{'type':Sequelize[_0x04c6('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x04c6('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7fde845..34297d1 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 _0xa9fd=['json','apply','reject','save','update','then','destroy','error','stack','name','send','index','CannedAnswer','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','rows','show','params','rawAttributes','find','catch','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','create','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','count','offset','set'];(function(_0x4a7e25,_0x2a18c3){var _0x2a63c1=function(_0x3d8f24){while(--_0x3d8f24){_0x4a7e25['push'](_0x4a7e25['shift']());}};_0x2a63c1(++_0x2a18c3);}(_0xa9fd,0x1ef));var _0xda9f=function(_0x29214c,_0x94e2d5){_0x29214c=_0x29214c-0x0;var _0x70c653=_0xa9fd[_0x29214c];return _0x70c653;};'use strict';var jsonpatch=require(_0xda9f('0x0'));var rp=require(_0xda9f('0x1'));var moment=require(_0xda9f('0x2'));var BPromise=require(_0xda9f('0x3'));var Mustache=require(_0xda9f('0x4'));var util=require(_0xda9f('0x5'));var path=require(_0xda9f('0x6'));var sox=require('sox');var csv=require(_0xda9f('0x7'));var ejs=require(_0xda9f('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xda9f('0x9'));var crypto=require(_0xda9f('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xda9f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xda9f('0xc'));var Papa=require('papaparse');var qs=require(_0xda9f('0xd'));var logger=require(_0xda9f('0xe'))(_0xda9f('0xf'));var utils=require(_0xda9f('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46c0a8,_0x43ba99){_0x43ba99=_0x43ba99||0xcc;return function(_0x2e648e){if(_0x2e648e){return _0x46c0a8[_0xda9f('0x11')](_0x43ba99);}return _0x46c0a8[_0xda9f('0x12')](_0x43ba99)[_0xda9f('0x13')]();};}function respondWithResult(_0x4d5d3a,_0x135cdb){_0x135cdb=_0x135cdb||0xc8;return function(_0x3e46fe){if(_0x3e46fe){return _0x4d5d3a[_0xda9f('0x12')](_0x135cdb)['json'](_0x3e46fe);}};}function respondWithFilteredResult(_0x422d2a,_0x334b76){return function(_0x5011b5){if(_0x5011b5){var _0x5c8d82=_0x5011b5[_0xda9f('0x14')],_0x117df3=_0x334b76[_0xda9f('0x15')],_0x471852=_0x334b76[_0xda9f('0x15')]+_0x334b76['limit'],_0x25eb15;if(_0x471852>=_0x5c8d82){_0x471852=_0x5c8d82;_0x25eb15=0xc8;}else{_0x25eb15=0xce;}_0x422d2a[_0xda9f('0x12')](_0x25eb15);return _0x422d2a[_0xda9f('0x16')]('Content-Range',_0x117df3+'-'+_0x471852+'/'+_0x5c8d82)[_0xda9f('0x17')](_0x5011b5);}return null;};}function patchUpdates(_0x29e437){return function(_0x1508be){try{jsonpatch[_0xda9f('0x18')](_0x1508be,_0x29e437,!![]);}catch(_0x24a9ae){return BPromise[_0xda9f('0x19')](_0x24a9ae);}return _0x1508be[_0xda9f('0x1a')]();};}function saveUpdates(_0xa1c40b,_0x33229c){return function(_0x350fc0){if(_0x350fc0){return _0x350fc0[_0xda9f('0x1b')](_0xa1c40b)[_0xda9f('0x1c')](function(_0x4c7545){return _0x4c7545;});}return null;};}function removeEntity(_0x42ae73,_0x2567be){return function(_0x4e5e27){if(_0x4e5e27){return _0x4e5e27[_0xda9f('0x1d')]()[_0xda9f('0x1c')](function(){_0x42ae73[_0xda9f('0x12')](0xcc)[_0xda9f('0x13')]();});}};}function handleEntityNotFound(_0x3cce29,_0x34c20e){return function(_0x3c983d){if(!_0x3c983d){_0x3cce29[_0xda9f('0x11')](0x194);}return _0x3c983d;};}function handleError(_0x2e62da,_0x27cdad){_0x27cdad=_0x27cdad||0x1f4;return function(_0x4bb686){logger[_0xda9f('0x1e')](_0x4bb686[_0xda9f('0x1f')]);if(_0x4bb686[_0xda9f('0x20')]){delete _0x4bb686['name'];}_0x2e62da['status'](_0x27cdad)[_0xda9f('0x21')](_0x4bb686);};}exports[_0xda9f('0x22')]=function(_0x38c95f,_0x250036){var _0x19139a={},_0x41f37c={},_0x2ffcec={'count':0x0,'rows':[]};var _0x38462f=db[_0xda9f('0x23')]['rawAttributes'];_0x41f37c[_0xda9f('0x24')]=_[_0xda9f('0x25')](_0x38462f);var _0x59ac89={'dateStart':_0x38c95f[_0xda9f('0x26')][_0xda9f('0x27')],'dateEnd':_0x38c95f['query'][_0xda9f('0x28')]};delete _0x38c95f['query']['dateStart'];delete _0x38c95f['query']['dateEnd'];_0x41f37c['query']=_[_0xda9f('0x25')](_0x38c95f[_0xda9f('0x26')]);_0x41f37c['filters']=_[_0xda9f('0x29')](_0x41f37c[_0xda9f('0x24')],_0x41f37c[_0xda9f('0x26')]);_0x19139a['attributes']=_[_0xda9f('0x29')](_0x41f37c[_0xda9f('0x24')],qs[_0xda9f('0x2a')](_0x38c95f['query'][_0xda9f('0x2a')]));_0x19139a[_0xda9f('0x2b')]=_0x19139a[_0xda9f('0x2b')][_0xda9f('0x2c')]?_0x19139a[_0xda9f('0x2b')]:_0x41f37c['model'];if(!_0x38c95f['query'][_0xda9f('0x2d')](_0xda9f('0x2e'))){_0x19139a[_0xda9f('0x2f')]=qs[_0xda9f('0x2f')](_0x38c95f[_0xda9f('0x26')][_0xda9f('0x2f')]);_0x19139a[_0xda9f('0x15')]=qs[_0xda9f('0x15')](_0x38c95f['query']['offset']);}_0x19139a['order']=qs[_0xda9f('0x30')](_0x38c95f[_0xda9f('0x26')][_0xda9f('0x30')]);_0x19139a[_0xda9f('0x31')]=qs[_0xda9f('0x32')](_[_0xda9f('0x33')](_0x38c95f[_0xda9f('0x26')],_0x41f37c[_0xda9f('0x32')]));if(_0x59ac89['dateStart']){if(_0x59ac89[_0xda9f('0x28')]){_0x59ac89['dateEnd']=moment(_0x59ac89[_0xda9f('0x28')])[_0xda9f('0x34')](0x1,_0xda9f('0x35'));}else{_0x59ac89[_0xda9f('0x28')]=moment(_0x59ac89[_0xda9f('0x27')])[_0xda9f('0x34')](0x1,_0xda9f('0x35'));}_[_0xda9f('0x36')](_0x19139a['where'],{'createdAt':{'$gte':_0x59ac89[_0xda9f('0x27')],'$lte':_0x59ac89['dateEnd']}});}if(_0x38c95f[_0xda9f('0x26')][_0xda9f('0x37')]){_0x19139a[_0xda9f('0x31')]=_['merge'](_0x19139a[_0xda9f('0x31')],{'$or':_[_0xda9f('0x38')](_0x19139a[_0xda9f('0x2b')],function(_0xb309e9){var _0x3e9c56={};_0x3e9c56[_0xb309e9]={'$like':'%'+_0x38c95f['query']['filter']+'%'};return _0x3e9c56;})});}_0x19139a=_[_0xda9f('0x36')]({},_0x19139a,_0x38c95f[_0xda9f('0x39')]);var _0x516a6c={'where':_0x19139a[_0xda9f('0x31')]};return db[_0xda9f('0x23')][_0xda9f('0x14')](_0x516a6c)[_0xda9f('0x1c')](function(_0x55c49d){_0x2ffcec[_0xda9f('0x14')]=_0x55c49d;if(_0x38c95f[_0xda9f('0x26')][_0xda9f('0x3a')]){_0x19139a[_0xda9f('0x3b')]=[{'all':!![]}];}return db[_0xda9f('0x23')]['findAll'](_0x19139a);})[_0xda9f('0x1c')](function(_0x52fbfc){_0x2ffcec[_0xda9f('0x3c')]=_0x52fbfc;return _0x2ffcec;})[_0xda9f('0x1c')](respondWithFilteredResult(_0x250036,_0x19139a))['catch'](handleError(_0x250036,null));};exports[_0xda9f('0x3d')]=function(_0x3b34d0,_0x26f3e4){var _0x530ab1={'raw':!![],'where':{'id':_0x3b34d0[_0xda9f('0x3e')]['id']}},_0x15c2bb={};_0x15c2bb['model']=_['keys'](db['CannedAnswer'][_0xda9f('0x3f')]);_0x15c2bb[_0xda9f('0x26')]=_[_0xda9f('0x25')](_0x3b34d0[_0xda9f('0x26')]);_0x15c2bb['filters']=_['intersection'](_0x15c2bb['model'],_0x15c2bb[_0xda9f('0x26')]);_0x530ab1[_0xda9f('0x2b')]=_[_0xda9f('0x29')](_0x15c2bb['model'],qs[_0xda9f('0x2a')](_0x3b34d0['query']['fields']));_0x530ab1[_0xda9f('0x2b')]=_0x530ab1[_0xda9f('0x2b')]['length']?_0x530ab1[_0xda9f('0x2b')]:_0x15c2bb[_0xda9f('0x24')];if(_0x3b34d0['query']['includeAll']){_0x530ab1['include']=[{'all':!![]}];}_0x530ab1=_[_0xda9f('0x36')]({},_0x530ab1,_0x3b34d0[_0xda9f('0x39')]);return db[_0xda9f('0x23')][_0xda9f('0x40')](_0x530ab1)[_0xda9f('0x1c')](handleEntityNotFound(_0x26f3e4,null))[_0xda9f('0x1c')](respondWithResult(_0x26f3e4,null))[_0xda9f('0x41')](handleError(_0x26f3e4,null));};exports[_0xda9f('0x1b')]=function(_0x10e918,_0x103bbd){if(_0x10e918[_0xda9f('0x42')]['id']){delete _0x10e918[_0xda9f('0x42')]['id'];}return db[_0xda9f('0x23')][_0xda9f('0x40')]({'where':{'id':_0x10e918[_0xda9f('0x3e')]['id']}})[_0xda9f('0x1c')](handleEntityNotFound(_0x103bbd,null))[_0xda9f('0x1c')](saveUpdates(_0x10e918[_0xda9f('0x42')],null))[_0xda9f('0x1c')](respondWithResult(_0x103bbd,null))[_0xda9f('0x41')](handleError(_0x103bbd,null));};exports[_0xda9f('0x1d')]=function(_0x149c75,_0x6f2f){return db[_0xda9f('0x23')]['find']({'where':{'id':_0x149c75['params']['id']}})[_0xda9f('0x1c')](handleEntityNotFound(_0x6f2f,null))[_0xda9f('0x1c')](removeEntity(_0x6f2f,null))['catch'](handleError(_0x6f2f,null));};exports['create']=function(_0x222737,_0x291744){var _0x18ca1e={'key':_0x222737[_0xda9f('0x42')]['key']};if(_0x222737[_0xda9f('0x42')][_0xda9f('0x43')]){_0x18ca1e['MailAccountId']=_0x222737[_0xda9f('0x42')][_0xda9f('0x43')];}else if(_0x222737[_0xda9f('0x42')]['SmsAccountId']){_0x18ca1e[_0xda9f('0x44')]=_0x222737[_0xda9f('0x42')][_0xda9f('0x44')];}else if(_0x222737['body'][_0xda9f('0x45')]){_0x18ca1e[_0xda9f('0x45')]=_0x222737[_0xda9f('0x42')][_0xda9f('0x45')];}else if(_0x222737[_0xda9f('0x42')][_0xda9f('0x46')]){_0x18ca1e['ChatWebsiteId']=_0x222737[_0xda9f('0x42')][_0xda9f('0x46')];}return db[_0xda9f('0x23')][_0xda9f('0x40')]({'where':_0x18ca1e})['then'](function(_0x2d1af6){if(_0x2d1af6){throw new db[(_0xda9f('0x47'))][(_0xda9f('0x48'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xda9f('0x23')][_0xda9f('0x49')](_0x222737[_0xda9f('0x42')]);})[_0xda9f('0x1c')](respondWithResult(_0x291744,0xc9))[_0xda9f('0x41')](handleError(_0x291744,null));}; \ No newline at end of file +var _0xcd74=['keys','dateStart','query','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','filter','map','merge','includeAll','findAll','catch','show','rawAttributes','length','include','options','body','find','params','destroy','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','fast-json-patch','moment','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','json','reject','update','then','end','sendStatus','error','name','send','index','CannedAnswer'];(function(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xcd74,0xad));var _0x4cd7=function(_0x3293de,_0x29c856){_0x3293de=_0x3293de-0x0;var _0x465384=_0xcd74[_0x3293de];return _0x465384;};'use strict';var jsonpatch=require(_0x4cd7('0x0'));var rp=require('request-promise');var moment=require(_0x4cd7('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4cd7('0x2'));var ejs=require(_0x4cd7('0x3'));var fs=require('fs');var _=require(_0x4cd7('0x4'));var squel=require(_0x4cd7('0x5'));var crypto=require(_0x4cd7('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x4cd7('0x7'));var toCsv=require(_0x4cd7('0x2'));var querystring=require(_0x4cd7('0x8'));var Papa=require('papaparse');var qs=require(_0x4cd7('0x9'));var logger=require(_0x4cd7('0xa'))(_0x4cd7('0xb'));var utils=require('../../config/utils');var config=require(_0x4cd7('0xc'));var db=require(_0x4cd7('0xd'))['db'];function respondWithStatusCode(_0x644e17,_0x5af493){_0x5af493=_0x5af493||0xcc;return function(_0x3fba60){if(_0x3fba60){return _0x644e17['sendStatus'](_0x5af493);}return _0x644e17['status'](_0x5af493)['end']();};}function respondWithResult(_0x4fa393,_0x32ab04){_0x32ab04=_0x32ab04||0xc8;return function(_0x4518b3){if(_0x4518b3){return _0x4fa393[_0x4cd7('0xe')](_0x32ab04)['json'](_0x4518b3);}};}function respondWithFilteredResult(_0x496ef6,_0x466eb6){return function(_0x5809d0){if(_0x5809d0){var _0x50ceab=_0x5809d0[_0x4cd7('0xf')],_0xeca836=_0x466eb6[_0x4cd7('0x10')],_0x12e591=_0x466eb6['offset']+_0x466eb6['limit'],_0x1bbbe1;if(_0x12e591>=_0x50ceab){_0x12e591=_0x50ceab;_0x1bbbe1=0xc8;}else{_0x1bbbe1=0xce;}_0x496ef6[_0x4cd7('0xe')](_0x1bbbe1);return _0x496ef6['set']('Content-Range',_0xeca836+'-'+_0x12e591+'/'+_0x50ceab)[_0x4cd7('0x11')](_0x5809d0);}return null;};}function patchUpdates(_0x47f1bd){return function(_0x405984){try{jsonpatch['apply'](_0x405984,_0x47f1bd,!![]);}catch(_0x26b93a){return BPromise[_0x4cd7('0x12')](_0x26b93a);}return _0x405984['save']();};}function saveUpdates(_0x3b603f,_0x50b980){return function(_0x505b78){if(_0x505b78){return _0x505b78[_0x4cd7('0x13')](_0x3b603f)['then'](function(_0x109067){return _0x109067;});}return null;};}function removeEntity(_0x490152,_0x2ca9c5){return function(_0x163c4c){if(_0x163c4c){return _0x163c4c['destroy']()[_0x4cd7('0x14')](function(){_0x490152[_0x4cd7('0xe')](0xcc)[_0x4cd7('0x15')]();});}};}function handleEntityNotFound(_0x3b7856,_0x2cf3ad){return function(_0x38dbd8){if(!_0x38dbd8){_0x3b7856[_0x4cd7('0x16')](0x194);}return _0x38dbd8;};}function handleError(_0x2a4c94,_0x1357b5){_0x1357b5=_0x1357b5||0x1f4;return function(_0x14f292){logger[_0x4cd7('0x17')](_0x14f292['stack']);if(_0x14f292[_0x4cd7('0x18')]){delete _0x14f292[_0x4cd7('0x18')];}_0x2a4c94[_0x4cd7('0xe')](_0x1357b5)[_0x4cd7('0x19')](_0x14f292);};}exports[_0x4cd7('0x1a')]=function(_0x38f759,_0x492a77){var _0x912765={},_0x21d375={},_0x99e3c9={'count':0x0,'rows':[]};var _0x40e95a=db[_0x4cd7('0x1b')]['rawAttributes'];_0x21d375['model']=_[_0x4cd7('0x1c')](_0x40e95a);var _0x478119={'dateStart':_0x38f759['query'][_0x4cd7('0x1d')],'dateEnd':_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x1f')]};delete _0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x1d')];delete _0x38f759['query'][_0x4cd7('0x1f')];_0x21d375['query']=_['keys'](_0x38f759[_0x4cd7('0x1e')]);_0x21d375[_0x4cd7('0x20')]=_[_0x4cd7('0x21')](_0x21d375[_0x4cd7('0x22')],_0x21d375[_0x4cd7('0x1e')]);_0x912765[_0x4cd7('0x23')]=_['intersection'](_0x21d375[_0x4cd7('0x22')],qs[_0x4cd7('0x24')](_0x38f759['query'][_0x4cd7('0x24')]));_0x912765[_0x4cd7('0x23')]=_0x912765['attributes']['length']?_0x912765['attributes']:_0x21d375[_0x4cd7('0x22')];if(!_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x25')](_0x4cd7('0x26'))){_0x912765[_0x4cd7('0x27')]=qs[_0x4cd7('0x27')](_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x27')]);_0x912765[_0x4cd7('0x10')]=qs[_0x4cd7('0x10')](_0x38f759[_0x4cd7('0x1e')]['offset']);}_0x912765[_0x4cd7('0x28')]=qs[_0x4cd7('0x29')](_0x38f759[_0x4cd7('0x1e')]['sort']);_0x912765[_0x4cd7('0x2a')]=qs[_0x4cd7('0x20')](_[_0x4cd7('0x2b')](_0x38f759[_0x4cd7('0x1e')],_0x21d375[_0x4cd7('0x20')]));if(_0x478119['dateStart']){if(_0x478119[_0x4cd7('0x1f')]){_0x478119[_0x4cd7('0x1f')]=moment(_0x478119[_0x4cd7('0x1f')])[_0x4cd7('0x2c')](0x1,_0x4cd7('0x2d'));}else{_0x478119[_0x4cd7('0x1f')]=moment(_0x478119['dateStart'])[_0x4cd7('0x2c')](0x1,_0x4cd7('0x2d'));}_['merge'](_0x912765[_0x4cd7('0x2a')],{'createdAt':{'$gte':_0x478119[_0x4cd7('0x1d')],'$lte':_0x478119[_0x4cd7('0x1f')]}});}if(_0x38f759['query'][_0x4cd7('0x2e')]){_0x912765[_0x4cd7('0x2a')]=_['merge'](_0x912765[_0x4cd7('0x2a')],{'$or':_[_0x4cd7('0x2f')](_0x912765[_0x4cd7('0x23')],function(_0x3e441d){var _0x1ea3dd={};_0x1ea3dd[_0x3e441d]={'$like':'%'+_0x38f759[_0x4cd7('0x1e')][_0x4cd7('0x2e')]+'%'};return _0x1ea3dd;})});}_0x912765=_[_0x4cd7('0x30')]({},_0x912765,_0x38f759['options']);var _0x636205={'where':_0x912765[_0x4cd7('0x2a')]};return db['CannedAnswer'][_0x4cd7('0xf')](_0x636205)[_0x4cd7('0x14')](function(_0x555aea){_0x99e3c9[_0x4cd7('0xf')]=_0x555aea;if(_0x38f759['query'][_0x4cd7('0x31')]){_0x912765['include']=[{'all':!![]}];}return db[_0x4cd7('0x1b')][_0x4cd7('0x32')](_0x912765);})[_0x4cd7('0x14')](function(_0x17ffef){_0x99e3c9['rows']=_0x17ffef;return _0x99e3c9;})[_0x4cd7('0x14')](respondWithFilteredResult(_0x492a77,_0x912765))[_0x4cd7('0x33')](handleError(_0x492a77,null));};exports[_0x4cd7('0x34')]=function(_0x1196ec,_0x553169){var _0x520e04={'raw':!![],'where':{'id':_0x1196ec['params']['id']}},_0x5561e2={};_0x5561e2[_0x4cd7('0x22')]=_[_0x4cd7('0x1c')](db[_0x4cd7('0x1b')][_0x4cd7('0x35')]);_0x5561e2[_0x4cd7('0x1e')]=_[_0x4cd7('0x1c')](_0x1196ec[_0x4cd7('0x1e')]);_0x5561e2[_0x4cd7('0x20')]=_['intersection'](_0x5561e2['model'],_0x5561e2[_0x4cd7('0x1e')]);_0x520e04[_0x4cd7('0x23')]=_[_0x4cd7('0x21')](_0x5561e2['model'],qs[_0x4cd7('0x24')](_0x1196ec['query'][_0x4cd7('0x24')]));_0x520e04[_0x4cd7('0x23')]=_0x520e04[_0x4cd7('0x23')][_0x4cd7('0x36')]?_0x520e04[_0x4cd7('0x23')]:_0x5561e2[_0x4cd7('0x22')];if(_0x1196ec['query'][_0x4cd7('0x31')]){_0x520e04[_0x4cd7('0x37')]=[{'all':!![]}];}_0x520e04=_[_0x4cd7('0x30')]({},_0x520e04,_0x1196ec[_0x4cd7('0x38')]);return db[_0x4cd7('0x1b')]['find'](_0x520e04)[_0x4cd7('0x14')](handleEntityNotFound(_0x553169,null))[_0x4cd7('0x14')](respondWithResult(_0x553169,null))[_0x4cd7('0x33')](handleError(_0x553169,null));};exports[_0x4cd7('0x13')]=function(_0x17ac19,_0x2a7277){if(_0x17ac19['body']['id']){delete _0x17ac19[_0x4cd7('0x39')]['id'];}return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':{'id':_0x17ac19[_0x4cd7('0x3b')]['id']}})[_0x4cd7('0x14')](handleEntityNotFound(_0x2a7277,null))[_0x4cd7('0x14')](saveUpdates(_0x17ac19[_0x4cd7('0x39')],null))['then'](respondWithResult(_0x2a7277,null))[_0x4cd7('0x33')](handleError(_0x2a7277,null));};exports[_0x4cd7('0x3c')]=function(_0x1402b0,_0x191051){return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':{'id':_0x1402b0[_0x4cd7('0x3b')]['id']}})[_0x4cd7('0x14')](handleEntityNotFound(_0x191051,null))[_0x4cd7('0x14')](removeEntity(_0x191051,null))[_0x4cd7('0x33')](handleError(_0x191051,null));};exports['create']=function(_0x4c319c,_0x28cac3){var _0x1f7bab={'key':_0x4c319c[_0x4cd7('0x39')]['key']};if(_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3d')]){_0x1f7bab['MailAccountId']=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3d')];}else if(_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3e')]){_0x1f7bab[_0x4cd7('0x3e')]=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x3e')];}else if(_0x4c319c['body'][_0x4cd7('0x3f')]){_0x1f7bab[_0x4cd7('0x3f')]=_0x4c319c['body'][_0x4cd7('0x3f')];}else if(_0x4c319c['body'][_0x4cd7('0x40')]){_0x1f7bab[_0x4cd7('0x40')]=_0x4c319c[_0x4cd7('0x39')][_0x4cd7('0x40')];}return db[_0x4cd7('0x1b')][_0x4cd7('0x3a')]({'where':_0x1f7bab})[_0x4cd7('0x14')](function(_0x55958d){if(_0x55958d){throw new db[(_0x4cd7('0x41'))]['ValidationError'](_0x4cd7('0x42'));}return db['CannedAnswer']['create'](_0x4c319c[_0x4cd7('0x39')]);})[_0x4cd7('0x14')](respondWithResult(_0x28cac3,0xc9))[_0x4cd7('0x33')](handleError(_0x28cac3,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2eb0ec7..b519ab4 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 _0x406b=['../../config/logger','moment','request-promise','./cannedAnswer.attributes','exports','CannedAnswer','lodash','util'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x406b,0x1ae));var _0xb406=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x406b[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xb406('0x0'));var util=require(_0xb406('0x1'));var logger=require(_0xb406('0x2'))('api');var moment=require(_0xb406('0x3'));var BPromise=require('bluebird');var rp=require(_0xb406('0x4'));var attributes=require(_0xb406('0x5'));module[_0xb406('0x6')]=function(_0x49c1c5,_0xbb1973){return _0x49c1c5['define'](_0xb406('0x7'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb00=['exports','tools_canned_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cannedAnswer.attributes'];(function(_0x20f143,_0x4619c7){var _0x42712e=function(_0x2c0d27){while(--_0x2c0d27){_0x20f143['push'](_0x20f143['shift']());}};_0x42712e(++_0x4619c7);}(_0xdb00,0x142));var _0x0db0=function(_0x32bbb1,_0xa0e27e){_0x32bbb1=_0x32bbb1-0x0;var _0x42b415=_0xdb00[_0x32bbb1];return _0x42b415;};'use strict';var _=require(_0x0db0('0x0'));var util=require(_0x0db0('0x1'));var logger=require(_0x0db0('0x2'))(_0x0db0('0x3'));var moment=require(_0x0db0('0x4'));var BPromise=require(_0x0db0('0x5'));var rp=require(_0x0db0('0x6'));var attributes=require(_0x0db0('0x7'));module[_0x0db0('0x8')]=function(_0xa34503,_0x10d5e7){return _0xa34503['define']('CannedAnswer',attributes,{'tableName':_0x0db0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 84d67da..051fc2f 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 _0xe2c5=['request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x1fe718,_0x15813e){var _0x4fdf03=function(_0x1df512){while(--_0x1df512){_0x1fe718['push'](_0x1fe718['shift']());}};_0x4fdf03(++_0x15813e);}(_0xe2c5,0x139));var _0x5e2c=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xe2c5[_0x9fb081];return _0x43f8b0;};'use strict';var _=require(_0x5e2c('0x0'));var util=require(_0x5e2c('0x1'));var moment=require('moment');var BPromise=require(_0x5e2c('0x2'));var rs=require(_0x5e2c('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5e2c('0x4'));var logger=require(_0x5e2c('0x5'))(_0x5e2c('0x6'));var config=require(_0x5e2c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5e2c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48fdd9,_0x2ac6f3,_0x30bb65){return new BPromise(function(_0x3d51df,_0x2675af){return client['request'](_0x48fdd9,_0x30bb65)['then'](function(_0x5f1ad8){logger[_0x5e2c('0x9')](_0x5e2c('0xa'),_0x2ac6f3,_0x5e2c('0xb'));logger[_0x5e2c('0xc')]('CannedAnswer,\x20%s,\x20%s,\x20%s',_0x2ac6f3,_0x5e2c('0xb'),JSON['stringify'](_0x5f1ad8));if(_0x5f1ad8[_0x5e2c('0xd')]){if(_0x5f1ad8[_0x5e2c('0xd')][_0x5e2c('0xe')]===0x1f4){logger[_0x5e2c('0xd')](_0x5e2c('0xa'),_0x2ac6f3,_0x5f1ad8['error'][_0x5e2c('0xf')]);return _0x2675af(_0x5f1ad8[_0x5e2c('0xd')][_0x5e2c('0xf')]);}logger[_0x5e2c('0xd')](_0x5e2c('0xa'),_0x2ac6f3,_0x5f1ad8['error'][_0x5e2c('0xf')]);return _0x3d51df(_0x5f1ad8[_0x5e2c('0xd')][_0x5e2c('0xf')]);}else{logger[_0x5e2c('0x9')](_0x5e2c('0xa'),_0x2ac6f3,_0x5e2c('0xb'));_0x3d51df(_0x5f1ad8[_0x5e2c('0x10')]['message']);}})[_0x5e2c('0x11')](function(_0xf5a61f){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x2ac6f3,_0xf5a61f);_0x2675af(_0xf5a61f);});});} \ No newline at end of file +var _0x7fec=['request\x20sent','CannedAnswer,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CannedAnswer,\x20%s,\x20%s'];(function(_0x4477d1,_0x3fbbbc){var _0x421b7e=function(_0x25579e){while(--_0x25579e){_0x4477d1['push'](_0x4477d1['shift']());}};_0x421b7e(++_0x3fbbbc);}(_0x7fec,0xee));var _0xc7fe=function(_0x2747e7,_0xbfa7af){_0x2747e7=_0x2747e7-0x0;var _0x3002d3=_0x7fec[_0x2747e7];return _0x3002d3;};'use strict';var _=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var moment=require('moment');var BPromise=require(_0xc7fe('0x2'));var rs=require(_0xc7fe('0x3'));var fs=require('fs');var db=require(_0xc7fe('0x4'))['db'];var utils=require(_0xc7fe('0x5'));var logger=require(_0xc7fe('0x6'))(_0xc7fe('0x7'));var config=require(_0xc7fe('0x8'));var jayson=require(_0xc7fe('0x9'));var client=jayson[_0xc7fe('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357c04,_0x2cac2c,_0x4c9cfa){return new BPromise(function(_0x7f881c,_0x575353){return client['request'](_0x357c04,_0x4c9cfa)[_0xc7fe('0xb')](function(_0x5176b7){logger[_0xc7fe('0xc')](_0xc7fe('0xd'),_0x2cac2c,_0xc7fe('0xe'));logger['debug'](_0xc7fe('0xf'),_0x2cac2c,_0xc7fe('0xe'),JSON['stringify'](_0x5176b7));if(_0x5176b7[_0xc7fe('0x10')]){if(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x11')]===0x1f4){logger['error']('CannedAnswer,\x20%s,\x20%s',_0x2cac2c,_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);return _0x575353(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);}logger[_0xc7fe('0x10')](_0xc7fe('0xd'),_0x2cac2c,_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);return _0x7f881c(_0x5176b7[_0xc7fe('0x10')][_0xc7fe('0x12')]);}else{logger['info']('CannedAnswer,\x20%s,\x20%s',_0x2cac2c,_0xc7fe('0xe'));_0x7f881c(_0x5176b7[_0xc7fe('0x13')]['message']);}})[_0xc7fe('0x14')](function(_0x58e83b){logger[_0xc7fe('0x10')](_0xc7fe('0xd'),_0x2cac2c,_0x58e83b);_0x575353(_0x58e83b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index a1aee2a..4e0d00f 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 _0xca96=['update','delete','destroy','exports','util','path','express','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','put'];(function(_0x328763,_0x41bd92){var _0x1cbd89=function(_0xb84d26){while(--_0xb84d26){_0x328763['push'](_0x328763['shift']());}};_0x1cbd89(++_0x41bd92);}(_0xca96,0x1cf));var _0x6ca9=function(_0x4a4437,_0x36702a){_0x4a4437=_0x4a4437-0x0;var _0x4eb03c=_0xca96[_0x4a4437];return _0x4eb03c;};'use strict';var multer=require('multer');var util=require(_0x6ca9('0x0'));var path=require(_0x6ca9('0x1'));var express=require(_0x6ca9('0x2'));var router=express['Router']();var auth=require(_0x6ca9('0x3'));var interaction=require(_0x6ca9('0x4'));var config=require('../../config/environment');var controller=require(_0x6ca9('0x5'));router[_0x6ca9('0x6')]('/',auth[_0x6ca9('0x7')](),controller[_0x6ca9('0x8')]);router[_0x6ca9('0x6')](_0x6ca9('0x9'),auth[_0x6ca9('0x7')](),controller[_0x6ca9('0xa')]);router[_0x6ca9('0xb')]('/',auth[_0x6ca9('0x7')](),controller['create']);router[_0x6ca9('0xc')](_0x6ca9('0x9'),auth[_0x6ca9('0x7')](),controller[_0x6ca9('0xd')]);router[_0x6ca9('0xe')](_0x6ca9('0x9'),auth[_0x6ca9('0x7')](),controller[_0x6ca9('0xf')]);module[_0x6ca9('0x10')]=router; \ No newline at end of file +var _0x8edf=['../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports','multer','path','Router'];(function(_0x34f726,_0x421385){var _0x37b027=function(_0x458d00){while(--_0x458d00){_0x34f726['push'](_0x34f726['shift']());}};_0x37b027(++_0x421385);}(_0x8edf,0xad));var _0xf8ed=function(_0x28da0c,_0x4282ed){_0x28da0c=_0x28da0c-0x0;var _0x3a3aa2=_0x8edf[_0x28da0c];return _0x3a3aa2;};'use strict';var multer=require(_0xf8ed('0x0'));var util=require('util');var path=require(_0xf8ed('0x1'));var express=require('express');var router=express[_0xf8ed('0x2')]();var auth=require(_0xf8ed('0x3'));var interaction=require(_0xf8ed('0x4'));var config=require('../../config/environment');var controller=require(_0xf8ed('0x5'));router[_0xf8ed('0x6')]('/',auth[_0xf8ed('0x7')](),controller[_0xf8ed('0x8')]);router[_0xf8ed('0x6')](_0xf8ed('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf8ed('0xa')]('/',auth['isAuthenticated'](),controller[_0xf8ed('0xb')]);router['put'](_0xf8ed('0x9'),auth[_0xf8ed('0x7')](),controller[_0xf8ed('0xc')]);router[_0xf8ed('0xd')](_0xf8ed('0x9'),auth[_0xf8ed('0x7')](),controller[_0xf8ed('0xe')]);module[_0xf8ed('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index d35df56..4ad3ace 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 _0xe8f1=['STRING','INTEGER','sequelize','1970-01-01\x2000:00:01'];(function(_0x9c75f4,_0xc54e83){var _0x57f1db=function(_0x42c906){while(--_0x42c906){_0x9c75f4['push'](_0x9c75f4['shift']());}};_0x57f1db(++_0xc54e83);}(_0xe8f1,0xfe));var _0x1e8f=function(_0x2b5a41,_0x5ac813){_0x2b5a41=_0x2b5a41-0x0;var _0x50f282=_0xe8f1[_0x2b5a41];return _0x50f282;};'use strict';var Sequelize=require(_0x1e8f('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x1e8f('0x1')},'clid':{'type':Sequelize[_0x1e8f('0x2')]},'src':{'type':Sequelize[_0x1e8f('0x2')]},'dst':{'type':Sequelize[_0x1e8f('0x2')]},'dcontext':{'type':Sequelize[_0x1e8f('0x2')]},'channel':{'type':Sequelize[_0x1e8f('0x2')]},'dstchannel':{'type':Sequelize[_0x1e8f('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x1e8f('0x2')]},'duration':{'type':Sequelize[_0x1e8f('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1e8f('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1e8f('0x2')]},'amaflags':{'type':Sequelize[_0x1e8f('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1e8f('0x2')]},'userfield':{'type':Sequelize[_0x1e8f('0x2')]},'uniqueid':{'type':Sequelize[_0x1e8f('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x1e8f('0x2')]},'peeraccount':{'type':Sequelize[_0x1e8f('0x2')]},'type':{'type':Sequelize[_0x1e8f('0x2')]},'tag':{'type':Sequelize[_0x1e8f('0x2')]}}; \ No newline at end of file +var _0xde6e=['DATE','STRING','INTEGER','sequelize'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xde6e,0x177));var _0xede6=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0xde6e[_0x263a2f];return _0x8020e8;};'use strict';var Sequelize=require(_0xede6('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xede6('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xede6('0x2')]},'src':{'type':Sequelize[_0xede6('0x2')]},'dst':{'type':Sequelize[_0xede6('0x2')]},'dcontext':{'type':Sequelize[_0xede6('0x2')]},'channel':{'type':Sequelize[_0xede6('0x2')]},'dstchannel':{'type':Sequelize[_0xede6('0x2')]},'lastapp':{'type':Sequelize[_0xede6('0x2')]},'lastdata':{'type':Sequelize[_0xede6('0x2')]},'duration':{'type':Sequelize[_0xede6('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xede6('0x2')]},'amaflags':{'type':Sequelize[_0xede6('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xede6('0x2')]},'linkedid':{'type':Sequelize[_0xede6('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xede6('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xede6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b47f826..af36363 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 _0x372d=['../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','update','then','stack','name','index','Cdr','model','query','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','dateStart','add','day','merge','where','filter','includeAll','include','findAll','rows','show','params','keys','rawAttributes','options','find','catch','create','body','destroy','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x7e974c,_0x4ad3f0){var _0x37c527=function(_0x519e42){while(--_0x519e42){_0x7e974c['push'](_0x7e974c['shift']());}};_0x37c527(++_0x4ad3f0);}(_0x372d,0x72));var _0xd372=function(_0x2bfa9a,_0x2ce9d3){_0x2bfa9a=_0x2bfa9a-0x0;var _0xa34095=_0x372d[_0x2bfa9a];return _0xa34095;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd372('0x0'));var BPromise=require(_0xd372('0x1'));var Mustache=require(_0xd372('0x2'));var util=require(_0xd372('0x3'));var path=require(_0xd372('0x4'));var sox=require(_0xd372('0x5'));var csv=require(_0xd372('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd372('0x7'));var squel=require(_0xd372('0x8'));var crypto=require(_0xd372('0x9'));var jsforce=require(_0xd372('0xa'));var deskjs=require(_0xd372('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd372('0xc'));var Papa=require(_0xd372('0xd'));var qs=require(_0xd372('0xe'));var logger=require(_0xd372('0xf'))(_0xd372('0x10'));var utils=require(_0xd372('0x11'));var config=require(_0xd372('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31a3fd,_0x446783){_0x446783=_0x446783||0xcc;return function(_0x221daa){if(_0x221daa){return _0x31a3fd[_0xd372('0x13')](_0x446783);}return _0x31a3fd[_0xd372('0x14')](_0x446783)[_0xd372('0x15')]();};}function respondWithResult(_0x3cefe0,_0x4f2adb){_0x4f2adb=_0x4f2adb||0xc8;return function(_0x3fd9f1){if(_0x3fd9f1){return _0x3cefe0['status'](_0x4f2adb)[_0xd372('0x16')](_0x3fd9f1);}};}function respondWithFilteredResult(_0x4f2297,_0xb16bd0){return function(_0x3d2e0d){if(_0x3d2e0d){var _0x58ac3f=_0x3d2e0d[_0xd372('0x17')],_0x1b5b43=_0xb16bd0[_0xd372('0x18')],_0x1dae58=_0xb16bd0['offset']+_0xb16bd0[_0xd372('0x19')],_0x8b0faa;if(_0x1dae58>=_0x58ac3f){_0x1dae58=_0x58ac3f;_0x8b0faa=0xc8;}else{_0x8b0faa=0xce;}_0x4f2297[_0xd372('0x14')](_0x8b0faa);return _0x4f2297[_0xd372('0x1a')](_0xd372('0x1b'),_0x1b5b43+'-'+_0x1dae58+'/'+_0x58ac3f)[_0xd372('0x16')](_0x3d2e0d);}return null;};}function patchUpdates(_0x28fa57){return function(_0xce1261){try{jsonpatch['apply'](_0xce1261,_0x28fa57,!![]);}catch(_0xbfcabb){return BPromise['reject'](_0xbfcabb);}return _0xce1261['save']();};}function saveUpdates(_0x1ee616,_0xd73ce8){return function(_0xd19fec){if(_0xd19fec){return _0xd19fec[_0xd372('0x1c')](_0x1ee616)[_0xd372('0x1d')](function(_0x373d0e){return _0x373d0e;});}return null;};}function removeEntity(_0x56c17e,_0x27b25a){return function(_0x1f9b8e){if(_0x1f9b8e){return _0x1f9b8e['destroy']()[_0xd372('0x1d')](function(){_0x56c17e[_0xd372('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b55d5,_0x124ab0){return function(_0x16adaf){if(!_0x16adaf){_0x5b55d5[_0xd372('0x13')](0x194);}return _0x16adaf;};}function handleError(_0x3f56f2,_0x1924ed){_0x1924ed=_0x1924ed||0x1f4;return function(_0x46b441){logger['error'](_0x46b441[_0xd372('0x1e')]);if(_0x46b441[_0xd372('0x1f')]){delete _0x46b441[_0xd372('0x1f')];}_0x3f56f2['status'](_0x1924ed)['send'](_0x46b441);};}exports[_0xd372('0x20')]=function(_0x2153a6,_0x2301fc){var _0x38a09a={},_0x2cb17c={},_0x49ac38={'count':0x0,'rows':[]};var _0x43fd1b=db[_0xd372('0x21')]['rawAttributes'];_0x2cb17c[_0xd372('0x22')]=_['keys'](_0x43fd1b);var _0x4e04ac={'dateStart':_0x2153a6['query']['dateStart'],'dateEnd':_0x2153a6[_0xd372('0x23')][_0xd372('0x24')]};delete _0x2153a6[_0xd372('0x23')]['dateStart'];delete _0x2153a6[_0xd372('0x23')][_0xd372('0x24')];_0x2cb17c['query']=_['keys'](_0x2153a6['query']);_0x2cb17c[_0xd372('0x25')]=_['intersection'](_0x2cb17c[_0xd372('0x22')],_0x2cb17c[_0xd372('0x23')]);_0x38a09a[_0xd372('0x26')]=_[_0xd372('0x27')](_0x2cb17c['model'],qs[_0xd372('0x28')](_0x2153a6[_0xd372('0x23')]['fields']));_0x38a09a[_0xd372('0x26')]=_0x38a09a[_0xd372('0x26')][_0xd372('0x29')]?_0x38a09a[_0xd372('0x26')]:_0x2cb17c['model'];if(!_0x2153a6[_0xd372('0x23')][_0xd372('0x2a')](_0xd372('0x2b'))){_0x38a09a[_0xd372('0x19')]=qs[_0xd372('0x19')](_0x2153a6[_0xd372('0x23')][_0xd372('0x19')]);_0x38a09a[_0xd372('0x18')]=qs[_0xd372('0x18')](_0x2153a6[_0xd372('0x23')][_0xd372('0x18')]);}_0x38a09a['order']=qs[_0xd372('0x2c')](_0x2153a6['query'][_0xd372('0x2c')]);_0x38a09a['where']=qs[_0xd372('0x25')](_[_0xd372('0x2d')](_0x2153a6[_0xd372('0x23')],_0x2cb17c[_0xd372('0x25')]));if(_0x4e04ac[_0xd372('0x2e')]){if(_0x4e04ac[_0xd372('0x24')]){_0x4e04ac[_0xd372('0x24')]=moment(_0x4e04ac[_0xd372('0x24')])[_0xd372('0x2f')](0x1,'day');}else{_0x4e04ac[_0xd372('0x24')]=moment(_0x4e04ac[_0xd372('0x2e')])['add'](0x1,_0xd372('0x30'));}_[_0xd372('0x31')](_0x38a09a[_0xd372('0x32')],{'createdAt':{'$gte':_0x4e04ac[_0xd372('0x2e')],'$lte':_0x4e04ac[_0xd372('0x24')]}});}if(_0x2153a6[_0xd372('0x23')]['filter']){_0x38a09a[_0xd372('0x32')]=_[_0xd372('0x31')](_0x38a09a[_0xd372('0x32')],{'$or':_['map'](_0x38a09a[_0xd372('0x26')],function(_0x4eedb8){var _0x36a7de={};_0x36a7de[_0x4eedb8]={'$like':'%'+_0x2153a6[_0xd372('0x23')][_0xd372('0x33')]+'%'};return _0x36a7de;})});}_0x38a09a=_[_0xd372('0x31')]({},_0x38a09a,_0x2153a6['options']);var _0x372802={'where':_0x38a09a[_0xd372('0x32')]};return db[_0xd372('0x21')][_0xd372('0x17')](_0x372802)[_0xd372('0x1d')](function(_0x44ba74){_0x49ac38[_0xd372('0x17')]=_0x44ba74;if(_0x2153a6[_0xd372('0x23')][_0xd372('0x34')]){_0x38a09a[_0xd372('0x35')]=[{'all':!![]}];}return db[_0xd372('0x21')][_0xd372('0x36')](_0x38a09a);})[_0xd372('0x1d')](function(_0xb1883){_0x49ac38[_0xd372('0x37')]=_0xb1883;return _0x49ac38;})[_0xd372('0x1d')](respondWithFilteredResult(_0x2301fc,_0x38a09a))['catch'](handleError(_0x2301fc,null));};exports[_0xd372('0x38')]=function(_0x3dc0f8,_0x263d8e){var _0x2be9aa={'raw':!![],'where':{'id':_0x3dc0f8[_0xd372('0x39')]['id']}},_0x167b60={};_0x167b60['model']=_[_0xd372('0x3a')](db[_0xd372('0x21')][_0xd372('0x3b')]);_0x167b60[_0xd372('0x23')]=_['keys'](_0x3dc0f8['query']);_0x167b60[_0xd372('0x25')]=_[_0xd372('0x27')](_0x167b60['model'],_0x167b60[_0xd372('0x23')]);_0x2be9aa[_0xd372('0x26')]=_[_0xd372('0x27')](_0x167b60['model'],qs['fields'](_0x3dc0f8[_0xd372('0x23')]['fields']));_0x2be9aa[_0xd372('0x26')]=_0x2be9aa[_0xd372('0x26')][_0xd372('0x29')]?_0x2be9aa['attributes']:_0x167b60['model'];if(_0x3dc0f8[_0xd372('0x23')]['includeAll']){_0x2be9aa[_0xd372('0x35')]=[{'all':!![]}];}_0x2be9aa=_[_0xd372('0x31')]({},_0x2be9aa,_0x3dc0f8[_0xd372('0x3c')]);return db['Cdr'][_0xd372('0x3d')](_0x2be9aa)[_0xd372('0x1d')](handleEntityNotFound(_0x263d8e,null))[_0xd372('0x1d')](respondWithResult(_0x263d8e,null))[_0xd372('0x3e')](handleError(_0x263d8e,null));};exports[_0xd372('0x3f')]=function(_0x314252,_0x129607){return db[_0xd372('0x21')][_0xd372('0x3f')](_0x314252[_0xd372('0x40')],{})[_0xd372('0x1d')](respondWithResult(_0x129607,0xc9))[_0xd372('0x3e')](handleError(_0x129607,null));};exports['update']=function(_0x1a6648,_0x908ec8){if(_0x1a6648['body']['id']){delete _0x1a6648[_0xd372('0x40')]['id'];}return db[_0xd372('0x21')][_0xd372('0x3d')]({'where':{'id':_0x1a6648[_0xd372('0x39')]['id']}})[_0xd372('0x1d')](handleEntityNotFound(_0x908ec8,null))['then'](saveUpdates(_0x1a6648[_0xd372('0x40')],null))[_0xd372('0x1d')](respondWithResult(_0x908ec8,null))[_0xd372('0x3e')](handleError(_0x908ec8,null));};exports[_0xd372('0x41')]=function(_0x3fa36b,_0xfd5c7e){return db[_0xd372('0x21')]['find']({'where':{'id':_0x3fa36b['params']['id']}})[_0xd372('0x1d')](handleEntityNotFound(_0xfd5c7e,null))[_0xd372('0x1d')](removeEntity(_0xfd5c7e,null))[_0xd372('0x3e')](handleError(_0xfd5c7e,null));}; \ No newline at end of file +var _0xe0e4=['stack','name','send','index','Cdr','rawAttributes','model','keys','query','dateEnd','dateStart','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','map','filter','options','includeAll','include','show','params','fields','find','catch','body','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error'];(function(_0x47f5a9,_0x40474a){var _0x407467=function(_0x60f244){while(--_0x60f244){_0x47f5a9['push'](_0x47f5a9['shift']());}};_0x407467(++_0x40474a);}(_0xe0e4,0x186));var _0x4e0e=function(_0x563a1c,_0x3c2949){_0x563a1c=_0x563a1c-0x0;var _0x11a860=_0xe0e4[_0x563a1c];return _0x11a860;};'use strict';var jsonpatch=require(_0x4e0e('0x0'));var rp=require(_0x4e0e('0x1'));var moment=require(_0x4e0e('0x2'));var BPromise=require(_0x4e0e('0x3'));var Mustache=require(_0x4e0e('0x4'));var util=require('util');var path=require(_0x4e0e('0x5'));var sox=require(_0x4e0e('0x6'));var csv=require('to-csv');var ejs=require(_0x4e0e('0x7'));var fs=require('fs');var _=require(_0x4e0e('0x8'));var squel=require(_0x4e0e('0x9'));var crypto=require(_0x4e0e('0xa'));var jsforce=require(_0x4e0e('0xb'));var deskjs=require(_0x4e0e('0xc'));var toCsv=require(_0x4e0e('0xd'));var querystring=require(_0x4e0e('0xe'));var Papa=require(_0x4e0e('0xf'));var qs=require(_0x4e0e('0x10'));var logger=require('../../config/logger')(_0x4e0e('0x11'));var utils=require(_0x4e0e('0x12'));var config=require(_0x4e0e('0x13'));var db=require(_0x4e0e('0x14'))['db'];function respondWithStatusCode(_0x57750d,_0x5efccc){_0x5efccc=_0x5efccc||0xcc;return function(_0x553776){if(_0x553776){return _0x57750d['sendStatus'](_0x5efccc);}return _0x57750d[_0x4e0e('0x15')](_0x5efccc)[_0x4e0e('0x16')]();};}function respondWithResult(_0x51439a,_0x3db635){_0x3db635=_0x3db635||0xc8;return function(_0x446e84){if(_0x446e84){return _0x51439a[_0x4e0e('0x15')](_0x3db635)[_0x4e0e('0x17')](_0x446e84);}};}function respondWithFilteredResult(_0x5c1280,_0x17110b){return function(_0x5d5b93){if(_0x5d5b93){var _0x11815b=_0x5d5b93[_0x4e0e('0x18')],_0x56da63=_0x17110b[_0x4e0e('0x19')],_0x1750e4=_0x17110b[_0x4e0e('0x19')]+_0x17110b[_0x4e0e('0x1a')],_0x2570de;if(_0x1750e4>=_0x11815b){_0x1750e4=_0x11815b;_0x2570de=0xc8;}else{_0x2570de=0xce;}_0x5c1280['status'](_0x2570de);return _0x5c1280[_0x4e0e('0x1b')](_0x4e0e('0x1c'),_0x56da63+'-'+_0x1750e4+'/'+_0x11815b)[_0x4e0e('0x17')](_0x5d5b93);}return null;};}function patchUpdates(_0x3a93e8){return function(_0x3ba25c){try{jsonpatch[_0x4e0e('0x1d')](_0x3ba25c,_0x3a93e8,!![]);}catch(_0xbe150b){return BPromise[_0x4e0e('0x1e')](_0xbe150b);}return _0x3ba25c[_0x4e0e('0x1f')]();};}function saveUpdates(_0xff56c7,_0x3a0513){return function(_0x53b067){if(_0x53b067){return _0x53b067[_0x4e0e('0x20')](_0xff56c7)[_0x4e0e('0x21')](function(_0x2468f9){return _0x2468f9;});}return null;};}function removeEntity(_0x3d571b,_0x2d1e0c){return function(_0x17bbbd){if(_0x17bbbd){return _0x17bbbd['destroy']()[_0x4e0e('0x21')](function(){_0x3d571b[_0x4e0e('0x15')](0xcc)[_0x4e0e('0x16')]();});}};}function handleEntityNotFound(_0x4181ee,_0x44cdfc){return function(_0x48e8d1){if(!_0x48e8d1){_0x4181ee[_0x4e0e('0x22')](0x194);}return _0x48e8d1;};}function handleError(_0x27634a,_0x73506b){_0x73506b=_0x73506b||0x1f4;return function(_0x11fd11){logger[_0x4e0e('0x23')](_0x11fd11[_0x4e0e('0x24')]);if(_0x11fd11[_0x4e0e('0x25')]){delete _0x11fd11[_0x4e0e('0x25')];}_0x27634a[_0x4e0e('0x15')](_0x73506b)[_0x4e0e('0x26')](_0x11fd11);};}exports[_0x4e0e('0x27')]=function(_0x36bd03,_0x1b79de){var _0x3be640={},_0x19deb9={},_0x40a92b={'count':0x0,'rows':[]};var _0x54c6b4=db[_0x4e0e('0x28')][_0x4e0e('0x29')];_0x19deb9[_0x4e0e('0x2a')]=_[_0x4e0e('0x2b')](_0x54c6b4);var _0x3020c5={'dateStart':_0x36bd03[_0x4e0e('0x2c')]['dateStart'],'dateEnd':_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x2d')]};delete _0x36bd03['query'][_0x4e0e('0x2e')];delete _0x36bd03['query'][_0x4e0e('0x2d')];_0x19deb9[_0x4e0e('0x2c')]=_[_0x4e0e('0x2b')](_0x36bd03[_0x4e0e('0x2c')]);_0x19deb9['filters']=_['intersection'](_0x19deb9[_0x4e0e('0x2a')],_0x19deb9[_0x4e0e('0x2c')]);_0x3be640[_0x4e0e('0x2f')]=_[_0x4e0e('0x30')](_0x19deb9[_0x4e0e('0x2a')],qs['fields'](_0x36bd03[_0x4e0e('0x2c')]['fields']));_0x3be640['attributes']=_0x3be640[_0x4e0e('0x2f')][_0x4e0e('0x31')]?_0x3be640['attributes']:_0x19deb9[_0x4e0e('0x2a')];if(!_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x32')](_0x4e0e('0x33'))){_0x3be640['limit']=qs['limit'](_0x36bd03['query'][_0x4e0e('0x1a')]);_0x3be640[_0x4e0e('0x19')]=qs[_0x4e0e('0x19')](_0x36bd03['query']['offset']);}_0x3be640[_0x4e0e('0x34')]=qs[_0x4e0e('0x35')](_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x35')]);_0x3be640['where']=qs[_0x4e0e('0x36')](_[_0x4e0e('0x37')](_0x36bd03[_0x4e0e('0x2c')],_0x19deb9['filters']));if(_0x3020c5[_0x4e0e('0x2e')]){if(_0x3020c5[_0x4e0e('0x2d')]){_0x3020c5['dateEnd']=moment(_0x3020c5['dateEnd'])[_0x4e0e('0x38')](0x1,_0x4e0e('0x39'));}else{_0x3020c5['dateEnd']=moment(_0x3020c5[_0x4e0e('0x2e')])['add'](0x1,_0x4e0e('0x39'));}_[_0x4e0e('0x3a')](_0x3be640[_0x4e0e('0x3b')],{'createdAt':{'$gte':_0x3020c5[_0x4e0e('0x2e')],'$lte':_0x3020c5['dateEnd']}});}if(_0x36bd03[_0x4e0e('0x2c')]['filter']){_0x3be640['where']=_[_0x4e0e('0x3a')](_0x3be640[_0x4e0e('0x3b')],{'$or':_[_0x4e0e('0x3c')](_0x3be640[_0x4e0e('0x2f')],function(_0x359fdf){var _0x4c0944={};_0x4c0944[_0x359fdf]={'$like':'%'+_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x3d')]+'%'};return _0x4c0944;})});}_0x3be640=_[_0x4e0e('0x3a')]({},_0x3be640,_0x36bd03[_0x4e0e('0x3e')]);var _0x2c46cb={'where':_0x3be640[_0x4e0e('0x3b')]};return db[_0x4e0e('0x28')]['count'](_0x2c46cb)[_0x4e0e('0x21')](function(_0x11fd9d){_0x40a92b[_0x4e0e('0x18')]=_0x11fd9d;if(_0x36bd03[_0x4e0e('0x2c')][_0x4e0e('0x3f')]){_0x3be640[_0x4e0e('0x40')]=[{'all':!![]}];}return db[_0x4e0e('0x28')]['findAll'](_0x3be640);})['then'](function(_0x408f21){_0x40a92b['rows']=_0x408f21;return _0x40a92b;})[_0x4e0e('0x21')](respondWithFilteredResult(_0x1b79de,_0x3be640))['catch'](handleError(_0x1b79de,null));};exports[_0x4e0e('0x41')]=function(_0x5111cd,_0x5939dd){var _0x4b2ff2={'raw':!![],'where':{'id':_0x5111cd[_0x4e0e('0x42')]['id']}},_0x351a8d={};_0x351a8d[_0x4e0e('0x2a')]=_['keys'](db['Cdr'][_0x4e0e('0x29')]);_0x351a8d[_0x4e0e('0x2c')]=_['keys'](_0x5111cd[_0x4e0e('0x2c')]);_0x351a8d[_0x4e0e('0x36')]=_['intersection'](_0x351a8d[_0x4e0e('0x2a')],_0x351a8d[_0x4e0e('0x2c')]);_0x4b2ff2[_0x4e0e('0x2f')]=_['intersection'](_0x351a8d['model'],qs[_0x4e0e('0x43')](_0x5111cd[_0x4e0e('0x2c')][_0x4e0e('0x43')]));_0x4b2ff2['attributes']=_0x4b2ff2[_0x4e0e('0x2f')]['length']?_0x4b2ff2[_0x4e0e('0x2f')]:_0x351a8d[_0x4e0e('0x2a')];if(_0x5111cd[_0x4e0e('0x2c')][_0x4e0e('0x3f')]){_0x4b2ff2[_0x4e0e('0x40')]=[{'all':!![]}];}_0x4b2ff2=_['merge']({},_0x4b2ff2,_0x5111cd[_0x4e0e('0x3e')]);return db[_0x4e0e('0x28')][_0x4e0e('0x44')](_0x4b2ff2)[_0x4e0e('0x21')](handleEntityNotFound(_0x5939dd,null))[_0x4e0e('0x21')](respondWithResult(_0x5939dd,null))[_0x4e0e('0x45')](handleError(_0x5939dd,null));};exports['create']=function(_0x2605c1,_0x389499){return db[_0x4e0e('0x28')]['create'](_0x2605c1[_0x4e0e('0x46')],{})[_0x4e0e('0x21')](respondWithResult(_0x389499,0xc9))[_0x4e0e('0x45')](handleError(_0x389499,null));};exports[_0x4e0e('0x20')]=function(_0x3b394d,_0x3e7fb9){if(_0x3b394d['body']['id']){delete _0x3b394d[_0x4e0e('0x46')]['id'];}return db['Cdr'][_0x4e0e('0x44')]({'where':{'id':_0x3b394d[_0x4e0e('0x42')]['id']}})[_0x4e0e('0x21')](handleEntityNotFound(_0x3e7fb9,null))[_0x4e0e('0x21')](saveUpdates(_0x3b394d[_0x4e0e('0x46')],null))['then'](respondWithResult(_0x3e7fb9,null))[_0x4e0e('0x45')](handleError(_0x3e7fb9,null));};exports['destroy']=function(_0x77a1c3,_0x179e22){return db[_0x4e0e('0x28')]['find']({'where':{'id':_0x77a1c3[_0x4e0e('0x42')]['id']}})[_0x4e0e('0x21')](handleEntityNotFound(_0x179e22,null))[_0x4e0e('0x21')](removeEntity(_0x179e22,null))['catch'](handleError(_0x179e22,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 0dd95b3..0ab6064 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 _0x6131=['lodash','../../config/logger','api','moment','request-promise','./cdr.attributes','exports','Cdr','cdr','accountcode','calldate','disposition','dst','src','uniqueid'];(function(_0xbb20ea,_0x43c564){var _0x361051=function(_0x1e85cc){while(--_0x1e85cc){_0xbb20ea['push'](_0xbb20ea['shift']());}};_0x361051(++_0x43c564);}(_0x6131,0x168));var _0x1613=function(_0x2a56e1,_0x32e9a4){_0x2a56e1=_0x2a56e1-0x0;var _0x36df48=_0x6131[_0x2a56e1];return _0x36df48;};'use strict';var _=require(_0x1613('0x0'));var util=require('util');var logger=require(_0x1613('0x1'))(_0x1613('0x2'));var moment=require(_0x1613('0x3'));var BPromise=require('bluebird');var rp=require(_0x1613('0x4'));var attributes=require(_0x1613('0x5'));module[_0x1613('0x6')]=function(_0x3aa330,_0x3c4986){return _0x3aa330['define'](_0x1613('0x7'),attributes,{'tableName':_0x1613('0x8'),'paranoid':![],'indexes':[{'name':_0x1613('0x9'),'fields':[_0x1613('0x9')]},{'name':'calldate','fields':[_0x1613('0xa')]},{'name':'disposition','fields':[_0x1613('0xb')]},{'name':_0x1613('0xc'),'fields':[_0x1613('0xc')]},{'name':'src','fields':[_0x1613('0xd')]},{'name':_0x1613('0xe'),'fields':['uniqueid']}],'timestamps':![]});}; \ No newline at end of file +var _0xaf9c=['request-promise','./cdr.attributes','exports','define','cdr','accountcode','calldate','disposition','dst','src','uniqueid','lodash','util','bluebird'];(function(_0x5b95f3,_0x576375){var _0x58a5ef=function(_0x4808d8){while(--_0x4808d8){_0x5b95f3['push'](_0x5b95f3['shift']());}};_0x58a5ef(++_0x576375);}(_0xaf9c,0xa5));var _0xcaf9=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xaf9c[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0xcaf9('0x0'));var util=require(_0xcaf9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcaf9('0x2'));var rp=require(_0xcaf9('0x3'));var attributes=require(_0xcaf9('0x4'));module[_0xcaf9('0x5')]=function(_0x32a298,_0x2b89cb){return _0x32a298[_0xcaf9('0x6')]('Cdr',attributes,{'tableName':_0xcaf9('0x7'),'paranoid':![],'indexes':[{'name':_0xcaf9('0x8'),'fields':['accountcode']},{'name':'calldate','fields':[_0xcaf9('0x9')]},{'name':_0xcaf9('0xa'),'fields':[_0xcaf9('0xa')]},{'name':_0xcaf9('0xb'),'fields':[_0xcaf9('0xb')]},{'name':_0xcaf9('0xc'),'fields':['src']},{'name':_0xcaf9('0xd'),'fields':[_0xcaf9('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 41953fb..013e879 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 _0xc67b=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','message','result','catch'];(function(_0x2c7088,_0x734d01){var _0x1b0ca2=function(_0x492508){while(--_0x492508){_0x2c7088['push'](_0x2c7088['shift']());}};_0x1b0ca2(++_0x734d01);}(_0xc67b,0x104));var _0xbc67=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc67b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbc67('0x0'));var util=require(_0xbc67('0x1'));var moment=require(_0xbc67('0x2'));var BPromise=require(_0xbc67('0x3'));var rs=require(_0xbc67('0x4'));var fs=require('fs');var db=require(_0xbc67('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc67('0x6'))(_0xbc67('0x7'));var config=require(_0xbc67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbc67('0x9')][_0xbc67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f0619,_0x5cb4f5,_0x4aa5f1){return new BPromise(function(_0x364339,_0x50aa69){return client[_0xbc67('0xb')](_0x5f0619,_0x4aa5f1)['then'](function(_0x47c3d1){logger[_0xbc67('0xc')](_0xbc67('0xd'),_0x5cb4f5,_0xbc67('0xe'));logger['debug'](_0xbc67('0xf'),_0x5cb4f5,_0xbc67('0xe'),JSON['stringify'](_0x47c3d1));if(_0x47c3d1[_0xbc67('0x10')]){if(_0x47c3d1[_0xbc67('0x10')]['code']===0x1f4){logger['error'](_0xbc67('0xd'),_0x5cb4f5,_0x47c3d1[_0xbc67('0x10')][_0xbc67('0x11')]);return _0x50aa69(_0x47c3d1[_0xbc67('0x10')][_0xbc67('0x11')]);}logger[_0xbc67('0x10')](_0xbc67('0xd'),_0x5cb4f5,_0x47c3d1['error'][_0xbc67('0x11')]);return _0x364339(_0x47c3d1[_0xbc67('0x10')][_0xbc67('0x11')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x5cb4f5,_0xbc67('0xe'));_0x364339(_0x47c3d1[_0xbc67('0x12')][_0xbc67('0x11')]);}})[_0xbc67('0x13')](function(_0x382670){logger[_0xbc67('0x10')](_0xbc67('0xd'),_0x5cb4f5,_0x382670);_0x50aa69(_0x382670);});});} \ No newline at end of file +var _0x528e=['request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Cdr,\x20%s,\x20%s','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x144310,_0x3f3931){var _0x3ac520=function(_0x2c1543){while(--_0x2c1543){_0x144310['push'](_0x144310['shift']());}};_0x3ac520(++_0x3f3931);}(_0x528e,0x1d2));var _0xe528=function(_0x49f96c,_0x6e8095){_0x49f96c=_0x49f96c-0x0;var _0x2ecaff=_0x528e[_0x49f96c];return _0x2ecaff;};'use strict';var _=require(_0xe528('0x0'));var util=require(_0xe528('0x1'));var moment=require(_0xe528('0x2'));var BPromise=require(_0xe528('0x3'));var rs=require(_0xe528('0x4'));var fs=require('fs');var db=require(_0xe528('0x5'))['db'];var utils=require(_0xe528('0x6'));var logger=require(_0xe528('0x7'))(_0xe528('0x8'));var config=require(_0xe528('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe528('0xa')][_0xe528('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x112e81,_0x1cda6c,_0x572ca3){return new BPromise(function(_0x2c0e02,_0x3bfc13){return client[_0xe528('0xc')](_0x112e81,_0x572ca3)[_0xe528('0xd')](function(_0x107929){logger[_0xe528('0xe')](_0xe528('0xf'),_0x1cda6c,'request\x20sent');logger['debug'](_0xe528('0x10'),_0x1cda6c,_0xe528('0x11'),JSON[_0xe528('0x12')](_0x107929));if(_0x107929[_0xe528('0x13')]){if(_0x107929[_0xe528('0x13')][_0xe528('0x14')]===0x1f4){logger[_0xe528('0x13')]('Cdr,\x20%s,\x20%s',_0x1cda6c,_0x107929[_0xe528('0x13')][_0xe528('0x15')]);return _0x3bfc13(_0x107929[_0xe528('0x13')][_0xe528('0x15')]);}logger[_0xe528('0x13')](_0xe528('0xf'),_0x1cda6c,_0x107929[_0xe528('0x13')][_0xe528('0x15')]);return _0x2c0e02(_0x107929[_0xe528('0x13')]['message']);}else{logger[_0xe528('0xe')](_0xe528('0xf'),_0x1cda6c,_0xe528('0x11'));_0x2c0e02(_0x107929['result'][_0xe528('0x15')]);}})[_0xe528('0x16')](function(_0x1c0109){logger[_0xe528('0x13')]('Cdr,\x20%s,\x20%s',_0x1cda6c,_0x1c0109);_0x3bfc13(_0x1c0109);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 093668b..d598928 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 _0x8927=['../../config/environment','./cdr.controller','isAuthenticated','get','/:id','post','create','destroy','multer','path','express','Router','../../components/interaction/service'];(function(_0x122d4d,_0x590e87){var _0x3668cf=function(_0x5551f2){while(--_0x5551f2){_0x122d4d['push'](_0x122d4d['shift']());}};_0x3668cf(++_0x590e87);}(_0x8927,0x1a8));var _0x7892=function(_0x5b3ccb,_0x17bbbb){_0x5b3ccb=_0x5b3ccb-0x0;var _0x1e8529=_0x8927[_0x5b3ccb];return _0x1e8529;};'use strict';var multer=require(_0x7892('0x0'));var util=require('util');var path=require(_0x7892('0x1'));var express=require(_0x7892('0x2'));var router=express[_0x7892('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7892('0x4'));var config=require(_0x7892('0x5'));var controller=require(_0x7892('0x6'));router['get']('/',auth[_0x7892('0x7')](),controller['index']);router[_0x7892('0x8')](_0x7892('0x9'),auth[_0x7892('0x7')](),controller['show']);router[_0x7892('0xa')]('/',auth['isAuthenticated'](),controller[_0x7892('0xb')]);router['put'](_0x7892('0x9'),auth[_0x7892('0x7')](),controller['update']);router['delete'](_0x7892('0x9'),auth['isAuthenticated'](),controller[_0x7892('0xc')]);module['exports']=router; \ No newline at end of file +var _0x8a62=['index','show','post','put','/:id','update','delete','exports','util','path','express','../../components/auth/service','../../config/environment','./cdr.controller','get','isAuthenticated'];(function(_0x51d46d,_0x43e757){var _0x36b683=function(_0x3947f1){while(--_0x3947f1){_0x51d46d['push'](_0x51d46d['shift']());}};_0x36b683(++_0x43e757);}(_0x8a62,0x98));var _0x28a6=function(_0x29556b,_0x3cdbc5){_0x29556b=_0x29556b-0x0;var _0x41b45b=_0x8a62[_0x29556b];return _0x41b45b;};'use strict';var multer=require('multer');var util=require(_0x28a6('0x0'));var path=require(_0x28a6('0x1'));var express=require(_0x28a6('0x2'));var router=express['Router']();var auth=require(_0x28a6('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x28a6('0x4'));var controller=require(_0x28a6('0x5'));router[_0x28a6('0x6')]('/',auth[_0x28a6('0x7')](),controller[_0x28a6('0x8')]);router['get']('/:id',auth[_0x28a6('0x7')](),controller[_0x28a6('0x9')]);router[_0x28a6('0xa')]('/',auth[_0x28a6('0x7')](),controller['create']);router[_0x28a6('0xb')](_0x28a6('0xc'),auth[_0x28a6('0x7')](),controller[_0x28a6('0xd')]);router[_0x28a6('0xe')](_0x28a6('0xc'),auth[_0x28a6('0x7')](),controller['destroy']);module[_0x28a6('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 94154f7..0ee0359 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 _0x91e8=['STRING','noop','sequelize','exports','INTEGER'];(function(_0x29c7fa,_0x1ec7e3){var _0x5a2375=function(_0x36b3ac){while(--_0x36b3ac){_0x29c7fa['push'](_0x29c7fa['shift']());}};_0x5a2375(++_0x1ec7e3);}(_0x91e8,0x1bf));var _0x891e=function(_0x518f60,_0x480f70){_0x518f60=_0x518f60-0x0;var _0x30af68=_0x91e8[_0x518f60];return _0x30af68;};'use strict';var Sequelize=require(_0x891e('0x0'));module[_0x891e('0x1')]={'priority':{'type':Sequelize[_0x891e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x891e('0x3')],'allowNull':![],'defaultValue':_0x891e('0x4')},'appdata':{'type':Sequelize[_0x891e('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x891e('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xf891=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x555049,_0x190b20){var _0x5a091f=function(_0x32d6c9){while(--_0x32d6c9){_0x555049['push'](_0x555049['shift']());}};_0x5a091f(++_0x190b20);}(_0xf891,0x1f0));var _0x1f89=function(_0x5afa1a,_0x3d534f){_0x5afa1a=_0x5afa1a-0x0;var _0x531e4e=_0xf891[_0x5afa1a];return _0x531e4e;};'use strict';var Sequelize=require(_0x1f89('0x0'));module[_0x1f89('0x1')]={'priority':{'type':Sequelize[_0x1f89('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1f89('0x3')],'allowNull':![],'defaultValue':_0x1f89('0x4')},'appdata':{'type':Sequelize[_0x1f89('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x1f89('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1f89('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 06fb086..002027c 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 _0x46cd=['lodash','desk.js','querystring','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','end','json','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','body','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x105f81,_0x28bf90){var _0x5a081b=function(_0x5c61ed){while(--_0x5c61ed){_0x105f81['push'](_0x105f81['shift']());}};_0x5a081b(++_0x28bf90);}(_0x46cd,0x181));var _0xd46c=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x46cd[_0x2070da];return _0x4f9fe1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd46c('0x0'));var moment=require(_0xd46c('0x1'));var BPromise=require(_0xd46c('0x2'));var Mustache=require('mustache');var util=require(_0xd46c('0x3'));var path=require(_0xd46c('0x4'));var sox=require(_0xd46c('0x5'));var csv=require(_0xd46c('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd46c('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd46c('0x8'));var toCsv=require(_0xd46c('0x6'));var querystring=require(_0xd46c('0x9'));var Papa=require('papaparse');var qs=require(_0xd46c('0xa'));var logger=require('../../config/logger')(_0xd46c('0xb'));var utils=require('../../config/utils');var config=require(_0xd46c('0xc'));var db=require(_0xd46c('0xd'))['db'];function respondWithStatusCode(_0x2faa01,_0x3966fa){_0x3966fa=_0x3966fa||0xcc;return function(_0x254da6){if(_0x254da6){return _0x2faa01['sendStatus'](_0x3966fa);}return _0x2faa01[_0xd46c('0xe')](_0x3966fa)[_0xd46c('0xf')]();};}function respondWithResult(_0x3c8bf4,_0x2757cc){_0x2757cc=_0x2757cc||0xc8;return function(_0x3b251e){if(_0x3b251e){return _0x3c8bf4[_0xd46c('0xe')](_0x2757cc)[_0xd46c('0x10')](_0x3b251e);}};}function respondWithFilteredResult(_0x411636,_0x33e54b){return function(_0x42b7e2){if(_0x42b7e2){var _0xa12afa=_0x42b7e2['count'],_0x28a91e=_0x33e54b['offset'],_0x28b073=_0x33e54b[_0xd46c('0x11')]+_0x33e54b['limit'],_0x5d8360;if(_0x28b073>=_0xa12afa){_0x28b073=_0xa12afa;_0x5d8360=0xc8;}else{_0x5d8360=0xce;}_0x411636[_0xd46c('0xe')](_0x5d8360);return _0x411636[_0xd46c('0x12')](_0xd46c('0x13'),_0x28a91e+'-'+_0x28b073+'/'+_0xa12afa)['json'](_0x42b7e2);}return null;};}function patchUpdates(_0x13fb5e){return function(_0xe4ba06){try{jsonpatch[_0xd46c('0x14')](_0xe4ba06,_0x13fb5e,!![]);}catch(_0x591531){return BPromise[_0xd46c('0x15')](_0x591531);}return _0xe4ba06['save']();};}function saveUpdates(_0x13807c,_0x5352ba){return function(_0x29f8cc){if(_0x29f8cc){return _0x29f8cc[_0xd46c('0x16')](_0x13807c)[_0xd46c('0x17')](function(_0x435555){return _0x435555;});}return null;};}function removeEntity(_0x6b0e7d,_0x5e05f7){return function(_0x3e2509){if(_0x3e2509){return _0x3e2509[_0xd46c('0x18')]()[_0xd46c('0x17')](function(){_0x6b0e7d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b1368,_0x5322b3){return function(_0x4cebc8){if(!_0x4cebc8){_0x5b1368[_0xd46c('0x19')](0x194);}return _0x4cebc8;};}function handleError(_0x234888,_0xb8b5b7){_0xb8b5b7=_0xb8b5b7||0x1f4;return function(_0x146fc2){logger[_0xd46c('0x1a')](_0x146fc2[_0xd46c('0x1b')]);if(_0x146fc2[_0xd46c('0x1c')]){delete _0x146fc2[_0xd46c('0x1c')];}_0x234888[_0xd46c('0xe')](_0xb8b5b7)[_0xd46c('0x1d')](_0x146fc2);};}exports[_0xd46c('0x1e')]=function(_0x1d3396,_0x5585f8){var _0x3600e0={'raw':!![],'where':{'id':_0x1d3396[_0xd46c('0x1f')]['id']}},_0xf847b8={};_0xf847b8[_0xd46c('0x20')]=_[_0xd46c('0x21')](db[_0xd46c('0x22')][_0xd46c('0x23')]);_0xf847b8[_0xd46c('0x24')]=_[_0xd46c('0x21')](_0x1d3396[_0xd46c('0x24')]);_0xf847b8[_0xd46c('0x25')]=_[_0xd46c('0x26')](_0xf847b8[_0xd46c('0x20')],_0xf847b8['query']);_0x3600e0[_0xd46c('0x27')]=_[_0xd46c('0x26')](_0xf847b8[_0xd46c('0x20')],qs[_0xd46c('0x28')](_0x1d3396[_0xd46c('0x24')][_0xd46c('0x28')]));_0x3600e0[_0xd46c('0x27')]=_0x3600e0[_0xd46c('0x27')][_0xd46c('0x29')]?_0x3600e0[_0xd46c('0x27')]:_0xf847b8[_0xd46c('0x20')];if(_0x1d3396[_0xd46c('0x24')][_0xd46c('0x2a')]){_0x3600e0[_0xd46c('0x2b')]=[{'all':!![]}];}_0x3600e0=_[_0xd46c('0x2c')]({},_0x3600e0,_0x1d3396[_0xd46c('0x2d')]);return db[_0xd46c('0x22')][_0xd46c('0x2e')](_0x3600e0)[_0xd46c('0x17')](handleEntityNotFound(_0x5585f8,null))['then'](respondWithResult(_0x5585f8,null))[_0xd46c('0x2f')](handleError(_0x5585f8,null));};exports['update']=function(_0x4e7845,_0x4aa3fe){if(_0x4e7845['body']['id']){delete _0x4e7845[_0xd46c('0x30')]['id'];}return db[_0xd46c('0x22')][_0xd46c('0x2e')]({'where':{'id':_0x4e7845[_0xd46c('0x1f')]['id']}})['then'](handleEntityNotFound(_0x4aa3fe,null))[_0xd46c('0x17')](saveUpdates(_0x4e7845[_0xd46c('0x30')],null))[_0xd46c('0x17')](respondWithResult(_0x4aa3fe,null))[_0xd46c('0x2f')](handleError(_0x4aa3fe,null));};exports['destroy']=function(_0xdecb26,_0x2754a4){return db['ChatApplication'][_0xd46c('0x2e')]({'where':{'id':_0xdecb26['params']['id']}})[_0xd46c('0x17')](handleEntityNotFound(_0x2754a4,null))[_0xd46c('0x17')](removeEntity(_0x2754a4,null))[_0xd46c('0x2f')](handleError(_0x2754a4,null));}; \ No newline at end of file +var _0x5d48=['request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','end','status','count','offset','limit','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','show','params','ChatApplication','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','body','fast-json-patch'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x5d48,0xd7));var _0x85d4=function(_0x55daac,_0x2d8957){_0x55daac=_0x55daac-0x0;var _0x16b34c=_0x5d48[_0x55daac];return _0x16b34c;};'use strict';var jsonpatch=require(_0x85d4('0x0'));var rp=require(_0x85d4('0x1'));var moment=require(_0x85d4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x85d4('0x3'));var util=require(_0x85d4('0x4'));var path=require(_0x85d4('0x5'));var sox=require(_0x85d4('0x6'));var csv=require('to-csv');var ejs=require(_0x85d4('0x7'));var fs=require('fs');var _=require(_0x85d4('0x8'));var squel=require(_0x85d4('0x9'));var crypto=require(_0x85d4('0xa'));var jsforce=require(_0x85d4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x85d4('0xc'));var querystring=require('querystring');var Papa=require(_0x85d4('0xd'));var qs=require(_0x85d4('0xe'));var logger=require(_0x85d4('0xf'))(_0x85d4('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x85d4('0x11'))['db'];function respondWithStatusCode(_0x293e73,_0x22d6e3){_0x22d6e3=_0x22d6e3||0xcc;return function(_0x17224c){if(_0x17224c){return _0x293e73[_0x85d4('0x12')](_0x22d6e3);}return _0x293e73['status'](_0x22d6e3)[_0x85d4('0x13')]();};}function respondWithResult(_0x5895b7,_0x14c8e2){_0x14c8e2=_0x14c8e2||0xc8;return function(_0x346747){if(_0x346747){return _0x5895b7[_0x85d4('0x14')](_0x14c8e2)['json'](_0x346747);}};}function respondWithFilteredResult(_0x1a9d70,_0x5a9045){return function(_0x4ec88c){if(_0x4ec88c){var _0x1ee71c=_0x4ec88c[_0x85d4('0x15')],_0x2d3eb9=_0x5a9045[_0x85d4('0x16')],_0x17429f=_0x5a9045[_0x85d4('0x16')]+_0x5a9045[_0x85d4('0x17')],_0x20de24;if(_0x17429f>=_0x1ee71c){_0x17429f=_0x1ee71c;_0x20de24=0xc8;}else{_0x20de24=0xce;}_0x1a9d70[_0x85d4('0x14')](_0x20de24);return _0x1a9d70['set'](_0x85d4('0x18'),_0x2d3eb9+'-'+_0x17429f+'/'+_0x1ee71c)[_0x85d4('0x19')](_0x4ec88c);}return null;};}function patchUpdates(_0x3479bf){return function(_0x2874a8){try{jsonpatch[_0x85d4('0x1a')](_0x2874a8,_0x3479bf,!![]);}catch(_0xfcbef4){return BPromise['reject'](_0xfcbef4);}return _0x2874a8[_0x85d4('0x1b')]();};}function saveUpdates(_0x23343c,_0x15c29e){return function(_0x54a9f2){if(_0x54a9f2){return _0x54a9f2[_0x85d4('0x1c')](_0x23343c)['then'](function(_0x1dba9f){return _0x1dba9f;});}return null;};}function removeEntity(_0xaabd0e,_0x4e92d5){return function(_0x4ad2a0){if(_0x4ad2a0){return _0x4ad2a0[_0x85d4('0x1d')]()[_0x85d4('0x1e')](function(){_0xaabd0e[_0x85d4('0x14')](0xcc)[_0x85d4('0x13')]();});}};}function handleEntityNotFound(_0x5e3222,_0xeba178){return function(_0x19ec4c){if(!_0x19ec4c){_0x5e3222[_0x85d4('0x12')](0x194);}return _0x19ec4c;};}function handleError(_0x5beda9,_0x35db05){_0x35db05=_0x35db05||0x1f4;return function(_0xc2153b){logger[_0x85d4('0x1f')](_0xc2153b[_0x85d4('0x20')]);if(_0xc2153b[_0x85d4('0x21')]){delete _0xc2153b[_0x85d4('0x21')];}_0x5beda9[_0x85d4('0x14')](_0x35db05)[_0x85d4('0x22')](_0xc2153b);};}exports[_0x85d4('0x23')]=function(_0x23c750,_0x512746){var _0x5ec93a={'raw':!![],'where':{'id':_0x23c750[_0x85d4('0x24')]['id']}},_0x156603={};_0x156603['model']=_['keys'](db[_0x85d4('0x25')][_0x85d4('0x26')]);_0x156603[_0x85d4('0x27')]=_[_0x85d4('0x28')](_0x23c750['query']);_0x156603[_0x85d4('0x29')]=_[_0x85d4('0x2a')](_0x156603[_0x85d4('0x2b')],_0x156603[_0x85d4('0x27')]);_0x5ec93a[_0x85d4('0x2c')]=_[_0x85d4('0x2a')](_0x156603[_0x85d4('0x2b')],qs[_0x85d4('0x2d')](_0x23c750[_0x85d4('0x27')]['fields']));_0x5ec93a[_0x85d4('0x2c')]=_0x5ec93a[_0x85d4('0x2c')][_0x85d4('0x2e')]?_0x5ec93a[_0x85d4('0x2c')]:_0x156603[_0x85d4('0x2b')];if(_0x23c750['query'][_0x85d4('0x2f')]){_0x5ec93a[_0x85d4('0x30')]=[{'all':!![]}];}_0x5ec93a=_[_0x85d4('0x31')]({},_0x5ec93a,_0x23c750[_0x85d4('0x32')]);return db[_0x85d4('0x25')][_0x85d4('0x33')](_0x5ec93a)[_0x85d4('0x1e')](handleEntityNotFound(_0x512746,null))[_0x85d4('0x1e')](respondWithResult(_0x512746,null))[_0x85d4('0x34')](handleError(_0x512746,null));};exports[_0x85d4('0x1c')]=function(_0x4e0132,_0x5d7c8f){if(_0x4e0132['body']['id']){delete _0x4e0132[_0x85d4('0x35')]['id'];}return db['ChatApplication'][_0x85d4('0x33')]({'where':{'id':_0x4e0132[_0x85d4('0x24')]['id']}})['then'](handleEntityNotFound(_0x5d7c8f,null))[_0x85d4('0x1e')](saveUpdates(_0x4e0132['body'],null))[_0x85d4('0x1e')](respondWithResult(_0x5d7c8f,null))[_0x85d4('0x34')](handleError(_0x5d7c8f,null));};exports[_0x85d4('0x1d')]=function(_0x349470,_0x5dfd96){return db['ChatApplication']['find']({'where':{'id':_0x349470[_0x85d4('0x24')]['id']}})[_0x85d4('0x1e')](handleEntityNotFound(_0x5dfd96,null))['then'](removeEntity(_0x5dfd96,null))['catch'](handleError(_0x5dfd96,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 9b219f7..4d28d7d 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 _0xd531=['moment','bluebird','exports','define','ChatApplication','chat_applications','lodash','api'];(function(_0x54b5fc,_0x5794db){var _0x3a1d57=function(_0x56a400){while(--_0x56a400){_0x54b5fc['push'](_0x54b5fc['shift']());}};_0x3a1d57(++_0x5794db);}(_0xd531,0x156));var _0x1d53=function(_0x2e4aa0,_0x65c666){_0x2e4aa0=_0x2e4aa0-0x0;var _0x59a58c=_0xd531[_0x2e4aa0];return _0x59a58c;};'use strict';var _=require(_0x1d53('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1d53('0x1'));var moment=require(_0x1d53('0x2'));var BPromise=require(_0x1d53('0x3'));var rp=require('request-promise');var attributes=require('./chatApplication.attributes');module[_0x1d53('0x4')]=function(_0x346b27,_0x2360b0){return _0x346b27[_0x1d53('0x5')](_0x1d53('0x6'),attributes,{'tableName':_0x1d53('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a68=['chat_applications','lodash','util','../../config/logger','moment','bluebird','./chatApplication.attributes','exports','ChatApplication'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1a68,0x19f));var _0x81a6=function(_0x155413,_0xfa66e2){_0x155413=_0x155413-0x0;var _0x4ec639=_0x1a68[_0x155413];return _0x4ec639;};'use strict';var _=require(_0x81a6('0x0'));var util=require(_0x81a6('0x1'));var logger=require(_0x81a6('0x2'))('api');var moment=require(_0x81a6('0x3'));var BPromise=require(_0x81a6('0x4'));var rp=require('request-promise');var attributes=require(_0x81a6('0x5'));module[_0x81a6('0x6')]=function(_0x283fd6,_0x2a0931){return _0x283fd6['define'](_0x81a6('0x7'),attributes,{'tableName':_0x81a6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 3b6bdcf..d31a7fe 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 _0x1a85=['jayson/promise','http','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0xc3a516,_0x32c235){var _0x1aec8a=function(_0xe2f26a){while(--_0xe2f26a){_0xc3a516['push'](_0xc3a516['shift']());}};_0x1aec8a(++_0x32c235);}(_0x1a85,0x14c));var _0x51a8=function(_0xd3d5c3,_0x42d2af){_0xd3d5c3=_0xd3d5c3-0x0;var _0x29a808=_0x1a85[_0xd3d5c3];return _0x29a808;};'use strict';var _=require(_0x51a8('0x0'));var util=require(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require(_0x51a8('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x51a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x51a8('0x5'))(_0x51a8('0x6'));var config=require(_0x51a8('0x7'));var jayson=require(_0x51a8('0x8'));var client=jayson['client'][_0x51a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcbe30a,_0x4799c0,_0x1b6642){return new BPromise(function(_0x277a69,_0x12fbe8){return client['request'](_0xcbe30a,_0x1b6642)[_0x51a8('0xa')](function(_0x16c63c){logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x4799c0,_0x51a8('0xd'));logger[_0x51a8('0xe')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x4799c0,_0x51a8('0xd'),JSON[_0x51a8('0xf')](_0x16c63c));if(_0x16c63c[_0x51a8('0x10')]){if(_0x16c63c['error'][_0x51a8('0x11')]===0x1f4){logger[_0x51a8('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4799c0,_0x16c63c[_0x51a8('0x10')][_0x51a8('0x12')]);return _0x12fbe8(_0x16c63c[_0x51a8('0x10')][_0x51a8('0x12')]);}logger[_0x51a8('0x10')]('ChatApplication,\x20%s,\x20%s',_0x4799c0,_0x16c63c['error'][_0x51a8('0x12')]);return _0x277a69(_0x16c63c[_0x51a8('0x10')]['message']);}else{logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x4799c0,_0x51a8('0xd'));_0x277a69(_0x16c63c[_0x51a8('0x13')][_0x51a8('0x12')]);}})['catch'](function(_0x5556ab){logger['error'](_0x51a8('0xc'),_0x4799c0,_0x5556ab);_0x12fbe8(_0x5556ab);});});} \ No newline at end of file +var _0x6974=['../../config/logger','jayson/promise','request','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x3e2915,_0x271d92){var _0x56f80a=function(_0x535e6a){while(--_0x535e6a){_0x3e2915['push'](_0x3e2915['shift']());}};_0x56f80a(++_0x271d92);}(_0x6974,0xcc));var _0x4697=function(_0x1f1a45,_0x5d8549){_0x1f1a45=_0x1f1a45-0x0;var _0x5dfb6f=_0x6974[_0x1f1a45];return _0x5dfb6f;};'use strict';var _=require(_0x4697('0x0'));var util=require(_0x4697('0x1'));var moment=require(_0x4697('0x2'));var BPromise=require('bluebird');var rs=require(_0x4697('0x3'));var fs=require('fs');var db=require(_0x4697('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4697('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4697('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53165d,_0x205386,_0x57be77){return new BPromise(function(_0x1feab5,_0x5ebb25){return client[_0x4697('0x7')](_0x53165d,_0x57be77)['then'](function(_0x59ab24){logger['info']('ChatApplication,\x20%s,\x20%s',_0x205386,'request\x20sent');logger[_0x4697('0x8')](_0x4697('0x9'),_0x205386,_0x4697('0xa'),JSON[_0x4697('0xb')](_0x59ab24));if(_0x59ab24[_0x4697('0xc')]){if(_0x59ab24[_0x4697('0xc')][_0x4697('0xd')]===0x1f4){logger[_0x4697('0xc')](_0x4697('0xe'),_0x205386,_0x59ab24[_0x4697('0xc')][_0x4697('0xf')]);return _0x5ebb25(_0x59ab24['error'][_0x4697('0xf')]);}logger['error'](_0x4697('0xe'),_0x205386,_0x59ab24[_0x4697('0xc')][_0x4697('0xf')]);return _0x1feab5(_0x59ab24[_0x4697('0xc')]['message']);}else{logger[_0x4697('0x10')](_0x4697('0xe'),_0x205386,'request\x20sent');_0x1feab5(_0x59ab24[_0x4697('0x11')]['message']);}})[_0x4697('0x12')](function(_0x11b7fd){logger[_0x4697('0xc')](_0x4697('0xe'),_0x205386,_0x11b7fd);_0x5ebb25(_0x11b7fd);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 842ae43..9f4fc16 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 _0xaf9d=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','path'];(function(_0x172a69,_0x2438f3){var _0x2da405=function(_0x299ccc){while(--_0x299ccc){_0x172a69['push'](_0x172a69['shift']());}};_0x2da405(++_0x2438f3);}(_0xaf9d,0x195));var _0xdaf9=function(_0xad03d,_0x45015a){_0xad03d=_0xad03d-0x0;var _0x243ab2=_0xaf9d[_0xad03d];return _0x243ab2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdaf9('0x0'));var express=require(_0xdaf9('0x1'));var router=express['Router']();var auth=require(_0xdaf9('0x2'));var interaction=require(_0xdaf9('0x3'));var config=require(_0xdaf9('0x4'));var controller=require(_0xdaf9('0x5'));router[_0xdaf9('0x6')](_0xdaf9('0x7'),auth[_0xdaf9('0x8')](),controller[_0xdaf9('0x9')]);router[_0xdaf9('0xa')](_0xdaf9('0x7'),auth[_0xdaf9('0x8')](),controller['update']);router[_0xdaf9('0xb')](_0xdaf9('0x7'),auth[_0xdaf9('0x8')](),controller[_0xdaf9('0xc')]);module[_0xdaf9('0xd')]=router; \ No newline at end of file +var _0xdbed=['delete','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','put','update'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xdbed,0xb8));var _0xddbe=function(_0x3fe2b8,_0x598727){_0x3fe2b8=_0x3fe2b8-0x0;var _0x211116=_0xdbed[_0x3fe2b8];return _0x211116;};'use strict';var multer=require(_0xddbe('0x0'));var util=require(_0xddbe('0x1'));var path=require(_0xddbe('0x2'));var express=require(_0xddbe('0x3'));var router=express['Router']();var auth=require(_0xddbe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xddbe('0x5'));var controller=require('./chatApplication.controller');router[_0xddbe('0x6')](_0xddbe('0x7'),auth[_0xddbe('0x8')](),controller['show']);router[_0xddbe('0x9')](_0xddbe('0x7'),auth[_0xddbe('0x8')](),controller[_0xddbe('0xa')]);router[_0xddbe('0xb')](_0xddbe('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0xddbe('0xc')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5de5178..b90f406 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 _0xf3dc=['BOOLEAN','sequelize','STRING'];(function(_0xf383ab,_0x171408){var _0x7bfe15=function(_0x584bbb){while(--_0x584bbb){_0xf383ab['push'](_0xf383ab['shift']());}};_0x7bfe15(++_0x171408);}(_0xf3dc,0xe8));var _0xcf3d=function(_0x308dcc,_0x2d1178){_0x308dcc=_0x308dcc-0x0;var _0x361717=_0xf3dc[_0x308dcc];return _0x361717;};'use strict';var Sequelize=require(_0xcf3d('0x0'));module['exports']={'name':{'type':Sequelize[_0xcf3d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xcf3d('0x1')]},'write':{'type':Sequelize[_0xcf3d('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x674f=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2205aa,_0x27a3a1){var _0x242941=function(_0x565eaa){while(--_0x565eaa){_0x2205aa['push'](_0x2205aa['shift']());}};_0x242941(++_0x27a3a1);}(_0x674f,0x164));var _0xf674=function(_0x4c7df9,_0x5b9d54){_0x4c7df9=_0x4c7df9-0x0;var _0x1f341b=_0x674f[_0x4c7df9];return _0x1f341b;};'use strict';var Sequelize=require(_0xf674('0x0'));module[_0xf674('0x1')]={'name':{'type':Sequelize[_0xf674('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf674('0x2')]},'write':{'type':Sequelize[_0xf674('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 986127c..32333d2 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 _0xf971=['day','merge','filter','map','options','include','findAll','rows','show','length','includeAll','find','create','body','update','destroy','params','describe','ChatInternalMessage','user','toInteger','addMembers','omit','ids','User','getMembers','nolimit','removeMembers','addMessage','ChatGroupId','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./chatGroup.socket','register','jayson/promise','client','http','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','apply','reject','save','stack','name','index','ChatGroup','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','attributes','hasOwnProperty','limit','order','sort','where','pick','add'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0xf971,0x15c));var _0x1f97=function(_0x445228,_0x7507e9){_0x445228=_0x445228-0x0;var _0x286827=_0xf971[_0x445228];return _0x286827;};'use strict';var jsonpatch=require(_0x1f97('0x0'));var rp=require(_0x1f97('0x1'));var moment=require(_0x1f97('0x2'));var BPromise=require(_0x1f97('0x3'));var Mustache=require(_0x1f97('0x4'));var util=require('util');var path=require(_0x1f97('0x5'));var sox=require(_0x1f97('0x6'));var csv=require(_0x1f97('0x7'));var ejs=require(_0x1f97('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1f97('0x9'));var crypto=require(_0x1f97('0xa'));var jsforce=require(_0x1f97('0xb'));var deskjs=require(_0x1f97('0xc'));var toCsv=require(_0x1f97('0x7'));var querystring=require(_0x1f97('0xd'));var Papa=require('papaparse');var qs=require(_0x1f97('0xe'));var logger=require(_0x1f97('0xf'))(_0x1f97('0x10'));var utils=require(_0x1f97('0x11'));var config=require(_0x1f97('0x12'));var db=require(_0x1f97('0x13'))['db'];var socket=require(_0x1f97('0x14'))({'host':'localhost','port':0x18eb});require(_0x1f97('0x15'))[_0x1f97('0x16')](socket);var jayson=require(_0x1f97('0x17'));var client=jayson[_0x1f97('0x18')][_0x1f97('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x54352b,_0x37b319,_0x2d1104,_0x462ebd){return new BPromise(function(_0x200a94,_0x11ee2f){var _0x26e09e=_0x462ebd||client;return _0x26e09e[_0x1f97('0x1a')](_0x54352b,_0x2d1104)[_0x1f97('0x1b')](function(_0x2a7838){logger[_0x1f97('0x1c')](_0x1f97('0x1d'),_0x37b319,_0x1f97('0x1e'));logger[_0x1f97('0x1f')](_0x1f97('0x20'),_0x37b319,_0x1f97('0x1e'),JSON['stringify'](_0x2a7838));if(_0x2a7838[_0x1f97('0x21')]){if(_0x2a7838[_0x1f97('0x21')][_0x1f97('0x22')]===0x1f4){logger[_0x1f97('0x21')](_0x1f97('0x1d'),_0x37b319,_0x2a7838[_0x1f97('0x21')][_0x1f97('0x23')]);return _0x11ee2f(_0x2a7838[_0x1f97('0x21')][_0x1f97('0x23')]);}logger['error'](_0x1f97('0x1d'),_0x37b319,_0x2a7838['error'][_0x1f97('0x23')]);return _0x200a94(_0x2a7838['error'][_0x1f97('0x23')]);}else{logger[_0x1f97('0x1c')](_0x1f97('0x1d'),_0x37b319,'request\x20sent');_0x200a94(_0x2a7838[_0x1f97('0x24')][_0x1f97('0x23')]);}})[_0x1f97('0x25')](function(_0x470c93){logger['error'](_0x1f97('0x1d'),_0x37b319,_0x470c93);_0x11ee2f(_0x470c93);});});}function respondWithStatusCode(_0x1c22c7,_0x3309cd){_0x3309cd=_0x3309cd||0xcc;return function(_0x49a800){if(_0x49a800){return _0x1c22c7[_0x1f97('0x26')](_0x3309cd);}return _0x1c22c7[_0x1f97('0x27')](_0x3309cd)[_0x1f97('0x28')]();};}function respondWithResult(_0x4211f7,_0xf88d20){_0xf88d20=_0xf88d20||0xc8;return function(_0x206ed2){if(_0x206ed2){return _0x4211f7[_0x1f97('0x27')](_0xf88d20)[_0x1f97('0x29')](_0x206ed2);}};}function respondWithFilteredResult(_0x3673d8,_0x35c619){return function(_0x543e64){if(_0x543e64){var _0x4ab72b=_0x543e64[_0x1f97('0x2a')],_0x14b032=_0x35c619[_0x1f97('0x2b')],_0x351edf=_0x35c619['offset']+_0x35c619['limit'],_0x7d8dfa;if(_0x351edf>=_0x4ab72b){_0x351edf=_0x4ab72b;_0x7d8dfa=0xc8;}else{_0x7d8dfa=0xce;}_0x3673d8[_0x1f97('0x27')](_0x7d8dfa);return _0x3673d8['set']('Content-Range',_0x14b032+'-'+_0x351edf+'/'+_0x4ab72b)[_0x1f97('0x29')](_0x543e64);}return null;};}function patchUpdates(_0x26cfef){return function(_0x3dfc0a){try{jsonpatch[_0x1f97('0x2c')](_0x3dfc0a,_0x26cfef,!![]);}catch(_0x42baf8){return BPromise[_0x1f97('0x2d')](_0x42baf8);}return _0x3dfc0a[_0x1f97('0x2e')]();};}function saveUpdates(_0x400463,_0x58b3fb){return function(_0x6b1fef){if(_0x6b1fef){return _0x6b1fef['update'](_0x400463)['then'](function(_0x3400fa){return _0x3400fa;});}return null;};}function removeEntity(_0x1107d5,_0x43094a){return function(_0x2cfacb){if(_0x2cfacb){return _0x2cfacb['destroy']()['then'](function(){_0x1107d5[_0x1f97('0x27')](0xcc)[_0x1f97('0x28')]();});}};}function handleEntityNotFound(_0x455914,_0xd116d0){return function(_0x33554f){if(!_0x33554f){_0x455914[_0x1f97('0x26')](0x194);}return _0x33554f;};}function handleError(_0x379509,_0x360e2e){_0x360e2e=_0x360e2e||0x1f4;return function(_0x814ae8){logger[_0x1f97('0x21')](_0x814ae8[_0x1f97('0x2f')]);if(_0x814ae8['name']){delete _0x814ae8[_0x1f97('0x30')];}_0x379509['status'](_0x360e2e)['send'](_0x814ae8);};}exports[_0x1f97('0x31')]=function(_0x52b95c,_0x3b5601){var _0x21a16c={},_0x3853f1={},_0x9f178={'count':0x0,'rows':[]};var _0x2c9a96=db[_0x1f97('0x32')][_0x1f97('0x33')];_0x3853f1['model']=_[_0x1f97('0x34')](_0x2c9a96);var _0x44f94a={'dateStart':_0x52b95c[_0x1f97('0x35')][_0x1f97('0x36')],'dateEnd':_0x52b95c['query'][_0x1f97('0x37')]};delete _0x52b95c['query'][_0x1f97('0x36')];delete _0x52b95c[_0x1f97('0x35')][_0x1f97('0x37')];_0x3853f1[_0x1f97('0x35')]=_[_0x1f97('0x34')](_0x52b95c[_0x1f97('0x35')]);_0x3853f1[_0x1f97('0x38')]=_[_0x1f97('0x39')](_0x3853f1[_0x1f97('0x3a')],_0x3853f1[_0x1f97('0x35')]);_0x21a16c['attributes']=_['intersection'](_0x3853f1[_0x1f97('0x3a')],qs[_0x1f97('0x3b')](_0x52b95c[_0x1f97('0x35')][_0x1f97('0x3b')]));_0x21a16c[_0x1f97('0x3c')]=_0x21a16c[_0x1f97('0x3c')]['length']?_0x21a16c[_0x1f97('0x3c')]:_0x3853f1['model'];if(!_0x52b95c['query'][_0x1f97('0x3d')]('nolimit')){_0x21a16c[_0x1f97('0x3e')]=qs[_0x1f97('0x3e')](_0x52b95c['query'][_0x1f97('0x3e')]);_0x21a16c[_0x1f97('0x2b')]=qs['offset'](_0x52b95c[_0x1f97('0x35')][_0x1f97('0x2b')]);}_0x21a16c[_0x1f97('0x3f')]=qs[_0x1f97('0x40')](_0x52b95c[_0x1f97('0x35')][_0x1f97('0x40')]);_0x21a16c[_0x1f97('0x41')]=qs['filters'](_[_0x1f97('0x42')](_0x52b95c[_0x1f97('0x35')],_0x3853f1[_0x1f97('0x38')]));if(_0x44f94a[_0x1f97('0x36')]){if(_0x44f94a['dateEnd']){_0x44f94a[_0x1f97('0x37')]=moment(_0x44f94a[_0x1f97('0x37')])[_0x1f97('0x43')](0x1,'day');}else{_0x44f94a[_0x1f97('0x37')]=moment(_0x44f94a[_0x1f97('0x36')])[_0x1f97('0x43')](0x1,_0x1f97('0x44'));}_[_0x1f97('0x45')](_0x21a16c['where'],{'createdAt':{'$gte':_0x44f94a[_0x1f97('0x36')],'$lte':_0x44f94a[_0x1f97('0x37')]}});}if(_0x52b95c[_0x1f97('0x35')][_0x1f97('0x46')]){_0x21a16c[_0x1f97('0x41')]=_[_0x1f97('0x45')](_0x21a16c[_0x1f97('0x41')],{'$or':_[_0x1f97('0x47')](_0x21a16c['attributes'],function(_0xfacebb){var _0x3828ce={};_0x3828ce[_0xfacebb]={'$like':'%'+_0x52b95c['query']['filter']+'%'};return _0x3828ce;})});}_0x21a16c=_[_0x1f97('0x45')]({},_0x21a16c,_0x52b95c[_0x1f97('0x48')]);var _0x57fbab={'where':_0x21a16c[_0x1f97('0x41')]};return db[_0x1f97('0x32')][_0x1f97('0x2a')](_0x57fbab)[_0x1f97('0x1b')](function(_0x22f581){_0x9f178[_0x1f97('0x2a')]=_0x22f581;if(_0x52b95c[_0x1f97('0x35')]['includeAll']){_0x21a16c[_0x1f97('0x49')]=[{'all':!![]}];}return db[_0x1f97('0x32')][_0x1f97('0x4a')](_0x21a16c);})[_0x1f97('0x1b')](function(_0x45e05a){_0x9f178[_0x1f97('0x4b')]=_0x45e05a;return _0x9f178;})['then'](respondWithFilteredResult(_0x3b5601,_0x21a16c))[_0x1f97('0x25')](handleError(_0x3b5601,null));};exports[_0x1f97('0x4c')]=function(_0x38a37a,_0x9c46d9){var _0x2d2828={'raw':!![],'where':{'id':_0x38a37a['params']['id']}},_0x336a78={};_0x336a78[_0x1f97('0x3a')]=_[_0x1f97('0x34')](db['ChatGroup'][_0x1f97('0x33')]);_0x336a78[_0x1f97('0x35')]=_[_0x1f97('0x34')](_0x38a37a[_0x1f97('0x35')]);_0x336a78[_0x1f97('0x38')]=_[_0x1f97('0x39')](_0x336a78[_0x1f97('0x3a')],_0x336a78[_0x1f97('0x35')]);_0x2d2828[_0x1f97('0x3c')]=_[_0x1f97('0x39')](_0x336a78[_0x1f97('0x3a')],qs[_0x1f97('0x3b')](_0x38a37a[_0x1f97('0x35')][_0x1f97('0x3b')]));_0x2d2828[_0x1f97('0x3c')]=_0x2d2828[_0x1f97('0x3c')][_0x1f97('0x4d')]?_0x2d2828['attributes']:_0x336a78['model'];if(_0x38a37a[_0x1f97('0x35')][_0x1f97('0x4e')]){_0x2d2828[_0x1f97('0x49')]=[{'all':!![]}];}_0x2d2828=_['merge']({},_0x2d2828,_0x38a37a['options']);return db[_0x1f97('0x32')][_0x1f97('0x4f')](_0x2d2828)[_0x1f97('0x1b')](handleEntityNotFound(_0x9c46d9,null))['then'](respondWithResult(_0x9c46d9,null))[_0x1f97('0x25')](handleError(_0x9c46d9,null));};exports[_0x1f97('0x50')]=function(_0x1f1e10,_0x8d527e){return db[_0x1f97('0x32')]['create'](_0x1f1e10[_0x1f97('0x51')],{})[_0x1f97('0x1b')](respondWithResult(_0x8d527e,0xc9))['catch'](handleError(_0x8d527e,null));};exports[_0x1f97('0x52')]=function(_0xd9481,_0x44457d){if(_0xd9481[_0x1f97('0x51')]['id']){delete _0xd9481[_0x1f97('0x51')]['id'];}return db[_0x1f97('0x32')]['find']({'where':{'id':_0xd9481['params']['id']}})['then'](handleEntityNotFound(_0x44457d,null))[_0x1f97('0x1b')](saveUpdates(_0xd9481['body'],null))['then'](respondWithResult(_0x44457d,null))[_0x1f97('0x25')](handleError(_0x44457d,null));};exports[_0x1f97('0x53')]=function(_0x63812,_0x5c8635){return db[_0x1f97('0x32')]['find']({'where':{'id':_0x63812[_0x1f97('0x54')]['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x5c8635,null))['then'](removeEntity(_0x5c8635,null))[_0x1f97('0x25')](handleError(_0x5c8635,null));};exports['describe']=function(_0xbb0bf0,_0x25e7db){return db[_0x1f97('0x32')][_0x1f97('0x55')]()[_0x1f97('0x1b')](respondWithResult(_0x25e7db,null))['catch'](handleError(_0x25e7db,null));};exports['getUnread']=function(_0x4404ac,_0x5af3f8,_0x26f46e){return db[_0x1f97('0x56')][_0x1f97('0x2a')]({'where':{'ChatGroupId':_0x4404ac[_0x1f97('0x54')]['id'],'ToId':_0x4404ac[_0x1f97('0x57')]['id'],'read':![]}})[_0x1f97('0x1b')](function(_0x117329){return{'id':_[_0x1f97('0x58')](_0x4404ac[_0x1f97('0x54')]['id']),'count':_0x117329};})[_0x1f97('0x1b')](respondWithResult(_0x5af3f8,null))[_0x1f97('0x25')](handleError(_0x5af3f8,null));};exports[_0x1f97('0x59')]=function(_0x2b85df,_0x846643,_0x48a256){return db['ChatGroup'][_0x1f97('0x4f')]({'where':{'id':_0x2b85df['params']['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x846643,null))[_0x1f97('0x1b')](function(_0x3d197b){if(_0x3d197b){return _0x3d197b[_0x1f97('0x59')](_0x2b85df['body']['ids'],_[_0x1f97('0x5a')](_0x2b85df[_0x1f97('0x51')],[_0x1f97('0x5b'),'id'])||{});}})[_0x1f97('0x1b')](respondWithResult(_0x846643,null))[_0x1f97('0x25')](handleError(_0x846643,null));};exports['getMembers']=function(_0x317950,_0x5d1ba4,_0x35343f){var _0x2f24b8={};var _0x2b69a2={};var _0x54e359;var _0x99766f;return db[_0x1f97('0x32')]['findOne']({'where':{'id':_0x317950[_0x1f97('0x54')]['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x5d1ba4,null))[_0x1f97('0x1b')](function(_0x1c9cd6){if(_0x1c9cd6){_0x54e359=_0x1c9cd6;_0x2b69a2[_0x1f97('0x3a')]=_[_0x1f97('0x34')](db[_0x1f97('0x5c')][_0x1f97('0x33')]);_0x2b69a2[_0x1f97('0x35')]=_[_0x1f97('0x34')](_0x317950[_0x1f97('0x35')]);_0x2b69a2[_0x1f97('0x38')]=_[_0x1f97('0x39')](_0x2b69a2[_0x1f97('0x3a')],_0x2b69a2['query']);_0x2f24b8[_0x1f97('0x3c')]=_[_0x1f97('0x39')](_0x2b69a2[_0x1f97('0x3a')],qs[_0x1f97('0x3b')](_0x317950[_0x1f97('0x35')][_0x1f97('0x3b')]));_0x2f24b8['attributes']=_0x2f24b8[_0x1f97('0x3c')][_0x1f97('0x4d')]?_0x2f24b8[_0x1f97('0x3c')]:_0x2b69a2[_0x1f97('0x3a')];_0x2f24b8[_0x1f97('0x3f')]=qs['sort'](_0x317950[_0x1f97('0x35')][_0x1f97('0x40')]);_0x2f24b8[_0x1f97('0x41')]=qs[_0x1f97('0x38')](_[_0x1f97('0x42')](_0x317950[_0x1f97('0x35')],_0x2b69a2['filters']));if(_0x317950[_0x1f97('0x35')][_0x1f97('0x46')]){_0x2f24b8['where']=_[_0x1f97('0x45')](_0x2f24b8[_0x1f97('0x41')],{'$or':_[_0x1f97('0x47')](_0x2f24b8[_0x1f97('0x3c')],function(_0x249b4c){var _0x2355db={};_0x2355db[_0x249b4c]={'$like':'%'+_0x317950[_0x1f97('0x35')][_0x1f97('0x46')]+'%'};return _0x2355db;})});}_0x2f24b8=_[_0x1f97('0x45')]({},_0x2f24b8,_0x317950[_0x1f97('0x48')]);return _0x54e359[_0x1f97('0x5d')](_0x2f24b8);}})[_0x1f97('0x1b')](function(_0x3988ec){if(_0x3988ec){_0x99766f=_0x3988ec[_0x1f97('0x4d')];if(!_0x317950[_0x1f97('0x35')][_0x1f97('0x3d')](_0x1f97('0x5e'))){_0x2f24b8['limit']=qs[_0x1f97('0x3e')](_0x317950[_0x1f97('0x35')]['limit']);_0x2f24b8[_0x1f97('0x2b')]=qs[_0x1f97('0x2b')](_0x317950[_0x1f97('0x35')][_0x1f97('0x2b')]);}return _0x54e359[_0x1f97('0x5d')](_0x2f24b8);}})[_0x1f97('0x1b')](function(_0x4a2234){if(_0x4a2234){return _0x4a2234?{'count':_0x99766f,'rows':_0x4a2234}:null;}})[_0x1f97('0x1b')](respondWithResult(_0x5d1ba4,null))[_0x1f97('0x25')](handleError(_0x5d1ba4,null));};exports[_0x1f97('0x5f')]=function(_0x51f510,_0x21148c,_0x5ece38){var _0x282f7e;return db[_0x1f97('0x32')][_0x1f97('0x4f')]({'where':{'id':_0x51f510['params']['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x21148c,null))[_0x1f97('0x1b')](function(_0x256000){if(_0x256000){return _0x256000[_0x1f97('0x5f')](_0x51f510[_0x1f97('0x35')][_0x1f97('0x5b')]);}})[_0x1f97('0x1b')](respondWithStatusCode(_0x21148c,null))[_0x1f97('0x25')](handleError(_0x21148c,null));};exports[_0x1f97('0x60')]=function(_0x5b5f9e,_0x5901ce,_0x1e87db){if(_0x5b5f9e['body']['id']){delete _0x5b5f9e[_0x1f97('0x51')]['id'];}return db[_0x1f97('0x32')][_0x1f97('0x4f')]({'where':{'id':_0x5b5f9e[_0x1f97('0x54')]['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x5901ce,null))['then'](function(_0x56a14b){if(_0x56a14b){_0x5b5f9e['body'][_0x1f97('0x61')]=_0x56a14b['id'];return db[_0x1f97('0x56')][_0x1f97('0x50')](_0x5b5f9e['body']);}})['then'](respondWithResult(_0x5901ce,null))[_0x1f97('0x25')](handleError(_0x5901ce,null));};exports['getMessages']=function(_0x4c9f44,_0x200a35,_0x2362ac){var _0x35d344={};var _0x53f244={};var _0x6083f3;var _0x3c1cbf;return db[_0x1f97('0x32')][_0x1f97('0x62')]({'where':{'id':_0x4c9f44['params']['id']}})[_0x1f97('0x1b')](handleEntityNotFound(_0x200a35,null))[_0x1f97('0x1b')](function(_0x4a9379){if(_0x4a9379){_0x6083f3=_0x4a9379;_0x53f244[_0x1f97('0x3a')]=_[_0x1f97('0x34')](db[_0x1f97('0x56')][_0x1f97('0x33')]);_0x53f244[_0x1f97('0x35')]=_['keys'](_0x4c9f44[_0x1f97('0x35')]);_0x53f244[_0x1f97('0x38')]=_[_0x1f97('0x39')](_0x53f244[_0x1f97('0x3a')],_0x53f244['query']);_0x35d344[_0x1f97('0x3c')]=_['intersection'](_0x53f244[_0x1f97('0x3a')],qs[_0x1f97('0x3b')](_0x4c9f44[_0x1f97('0x35')][_0x1f97('0x3b')]));_0x35d344[_0x1f97('0x3c')]=_0x35d344['attributes'][_0x1f97('0x4d')]?_0x35d344[_0x1f97('0x3c')]:_0x53f244[_0x1f97('0x3a')];_0x35d344[_0x1f97('0x3f')]=qs[_0x1f97('0x40')](_0x4c9f44[_0x1f97('0x35')]['sort']);_0x35d344[_0x1f97('0x41')]=qs[_0x1f97('0x38')](_[_0x1f97('0x42')](_0x4c9f44[_0x1f97('0x35')],_0x53f244[_0x1f97('0x38')]));if(_0x4c9f44[_0x1f97('0x35')][_0x1f97('0x46')]){_0x35d344[_0x1f97('0x41')]=_[_0x1f97('0x45')](_0x35d344[_0x1f97('0x41')],{'$or':_[_0x1f97('0x47')](_0x35d344['attributes'],function(_0x30d247){var _0x5304ca={};_0x5304ca[_0x30d247]={'$like':'%'+_0x4c9f44[_0x1f97('0x35')]['filter']+'%'};return _0x5304ca;})});}if(_0x4c9f44[_0x1f97('0x35')][_0x1f97('0x63')]){var _0x898a10=_0x4c9f44[_0x1f97('0x35')]['$gte'][_0x1f97('0x64')](',');var _0x11eed7={};_0x11eed7[_0x898a10[0x0]]={'$gte':moment(_0x898a10[0x1])[_0x1f97('0x65')](_0x1f97('0x66'))};_0x35d344[_0x1f97('0x41')]=_[_0x1f97('0x45')](_0x35d344['where'],_0x11eed7);}_0x35d344=_[_0x1f97('0x45')]({},_0x35d344,_0x4c9f44['options']);return _0x6083f3['getMessages'](_0x35d344);}})[_0x1f97('0x1b')](function(_0x5ce2f6){if(_0x5ce2f6){_0x3c1cbf=_0x5ce2f6['length'];if(!_0x4c9f44['query'][_0x1f97('0x3d')](_0x1f97('0x5e'))){_0x35d344[_0x1f97('0x3e')]=qs[_0x1f97('0x3e')](_0x4c9f44['query'][_0x1f97('0x3e')]);_0x35d344['offset']=qs['offset'](_0x4c9f44['query']['offset']);}return _0x6083f3[_0x1f97('0x67')](_0x35d344);}})['then'](function(_0x329d32){if(_0x329d32){return _0x329d32?{'count':_0x3c1cbf,'rows':_0x329d32}:null;}})['then'](respondWithResult(_0x200a35,null))[_0x1f97('0x25')](handleError(_0x200a35,null));}; \ No newline at end of file +var _0xf93e=['socket.io-emitter','localhost','./chatGroup.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','sendStatus','status','count','offset','set','Content-Range','json','apply','reject','destroy','stack','name','ChatGroup','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','day','add','merge','filter','includeAll','include','catch','show','params','rawAttributes','create','body','update','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','findOne','User','map','options','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x32375b,_0xebbf8){var _0x5711a8=function(_0x38e88f){while(--_0x38e88f){_0x32375b['push'](_0x32375b['shift']());}};_0x5711a8(++_0xebbf8);}(_0xf93e,0x121));var _0xef93=function(_0x3457d7,_0xbfc1){_0x3457d7=_0x3457d7-0x0;var _0xe45694=_0xf93e[_0x3457d7];return _0xe45694;};'use strict';var jsonpatch=require(_0xef93('0x0'));var rp=require(_0xef93('0x1'));var moment=require(_0xef93('0x2'));var BPromise=require(_0xef93('0x3'));var Mustache=require(_0xef93('0x4'));var util=require(_0xef93('0x5'));var path=require(_0xef93('0x6'));var sox=require(_0xef93('0x7'));var csv=require(_0xef93('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xef93('0x9'));var squel=require('squel');var crypto=require(_0xef93('0xa'));var jsforce=require(_0xef93('0xb'));var deskjs=require(_0xef93('0xc'));var toCsv=require(_0xef93('0x8'));var querystring=require(_0xef93('0xd'));var Papa=require(_0xef93('0xe'));var qs=require(_0xef93('0xf'));var logger=require(_0xef93('0x10'))(_0xef93('0x11'));var utils=require(_0xef93('0x12'));var config=require(_0xef93('0x13'));var db=require('../../mysqldb')['db'];var socket=require(_0xef93('0x14'))({'host':_0xef93('0x15'),'port':0x18eb});require(_0xef93('0x16'))[_0xef93('0x17')](socket);var jayson=require(_0xef93('0x18'));var client=jayson[_0xef93('0x19')][_0xef93('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x9a716f,_0x54794b,_0x270aeb,_0x431cd6){return new BPromise(function(_0x5ebfff,_0x1971b7){var _0x2aca71=_0x431cd6||client;return _0x2aca71[_0xef93('0x1b')](_0x9a716f,_0x270aeb)[_0xef93('0x1c')](function(_0x44dc8b){logger['info']('ChatGroup,\x20%s,\x20%s',_0x54794b,_0xef93('0x1d'));logger[_0xef93('0x1e')](_0xef93('0x1f'),_0x54794b,_0xef93('0x1d'),JSON[_0xef93('0x20')](_0x44dc8b));if(_0x44dc8b[_0xef93('0x21')]){if(_0x44dc8b[_0xef93('0x21')][_0xef93('0x22')]===0x1f4){logger[_0xef93('0x21')](_0xef93('0x23'),_0x54794b,_0x44dc8b[_0xef93('0x21')]['message']);return _0x1971b7(_0x44dc8b[_0xef93('0x21')][_0xef93('0x24')]);}logger['error'](_0xef93('0x23'),_0x54794b,_0x44dc8b[_0xef93('0x21')]['message']);return _0x5ebfff(_0x44dc8b[_0xef93('0x21')][_0xef93('0x24')]);}else{logger[_0xef93('0x25')]('ChatGroup,\x20%s,\x20%s',_0x54794b,_0xef93('0x1d'));_0x5ebfff(_0x44dc8b[_0xef93('0x26')]['message']);}})['catch'](function(_0x501ac8){logger[_0xef93('0x21')](_0xef93('0x23'),_0x54794b,_0x501ac8);_0x1971b7(_0x501ac8);});});}function respondWithStatusCode(_0x309997,_0x287332){_0x287332=_0x287332||0xcc;return function(_0x7d2066){if(_0x7d2066){return _0x309997[_0xef93('0x27')](_0x287332);}return _0x309997[_0xef93('0x28')](_0x287332)['end']();};}function respondWithResult(_0x1dd14a,_0x2d8fc3){_0x2d8fc3=_0x2d8fc3||0xc8;return function(_0x4d256f){if(_0x4d256f){return _0x1dd14a[_0xef93('0x28')](_0x2d8fc3)['json'](_0x4d256f);}};}function respondWithFilteredResult(_0x4353cf,_0x3cd7e2){return function(_0x307216){if(_0x307216){var _0x166e9c=_0x307216[_0xef93('0x29')],_0x14d52a=_0x3cd7e2['offset'],_0x4c0237=_0x3cd7e2[_0xef93('0x2a')]+_0x3cd7e2['limit'],_0x2cd870;if(_0x4c0237>=_0x166e9c){_0x4c0237=_0x166e9c;_0x2cd870=0xc8;}else{_0x2cd870=0xce;}_0x4353cf[_0xef93('0x28')](_0x2cd870);return _0x4353cf[_0xef93('0x2b')](_0xef93('0x2c'),_0x14d52a+'-'+_0x4c0237+'/'+_0x166e9c)[_0xef93('0x2d')](_0x307216);}return null;};}function patchUpdates(_0x1c140f){return function(_0x3e0226){try{jsonpatch[_0xef93('0x2e')](_0x3e0226,_0x1c140f,!![]);}catch(_0x11b843){return BPromise[_0xef93('0x2f')](_0x11b843);}return _0x3e0226['save']();};}function saveUpdates(_0x276a25,_0x38058c){return function(_0x3ac44c){if(_0x3ac44c){return _0x3ac44c['update'](_0x276a25)[_0xef93('0x1c')](function(_0xc7ecee){return _0xc7ecee;});}return null;};}function removeEntity(_0x443b4b,_0x2d8e90){return function(_0x531053){if(_0x531053){return _0x531053[_0xef93('0x30')]()['then'](function(){_0x443b4b[_0xef93('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a488a,_0x5ccfa2){return function(_0x5051ad){if(!_0x5051ad){_0x2a488a[_0xef93('0x27')](0x194);}return _0x5051ad;};}function handleError(_0x1cda79,_0x36b68f){_0x36b68f=_0x36b68f||0x1f4;return function(_0x53d3db){logger[_0xef93('0x21')](_0x53d3db[_0xef93('0x31')]);if(_0x53d3db[_0xef93('0x32')]){delete _0x53d3db['name'];}_0x1cda79[_0xef93('0x28')](_0x36b68f)['send'](_0x53d3db);};}exports['index']=function(_0x2fbd03,_0x5e2d1e){var _0x59acf3={},_0x4f43fa={},_0x1bef67={'count':0x0,'rows':[]};var _0x2bf5e2=db[_0xef93('0x33')]['rawAttributes'];_0x4f43fa[_0xef93('0x34')]=_['keys'](_0x2bf5e2);var _0x3055a2={'dateStart':_0x2fbd03[_0xef93('0x35')][_0xef93('0x36')],'dateEnd':_0x2fbd03['query'][_0xef93('0x37')]};delete _0x2fbd03[_0xef93('0x35')][_0xef93('0x36')];delete _0x2fbd03[_0xef93('0x35')][_0xef93('0x37')];_0x4f43fa[_0xef93('0x35')]=_[_0xef93('0x38')](_0x2fbd03[_0xef93('0x35')]);_0x4f43fa[_0xef93('0x39')]=_[_0xef93('0x3a')](_0x4f43fa[_0xef93('0x34')],_0x4f43fa[_0xef93('0x35')]);_0x59acf3[_0xef93('0x3b')]=_[_0xef93('0x3a')](_0x4f43fa[_0xef93('0x34')],qs[_0xef93('0x3c')](_0x2fbd03[_0xef93('0x35')][_0xef93('0x3c')]));_0x59acf3[_0xef93('0x3b')]=_0x59acf3[_0xef93('0x3b')][_0xef93('0x3d')]?_0x59acf3[_0xef93('0x3b')]:_0x4f43fa[_0xef93('0x34')];if(!_0x2fbd03[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0x59acf3[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x2fbd03['query'][_0xef93('0x3f')]);_0x59acf3[_0xef93('0x2a')]=qs['offset'](_0x2fbd03[_0xef93('0x35')][_0xef93('0x2a')]);}_0x59acf3[_0xef93('0x40')]=qs[_0xef93('0x41')](_0x2fbd03['query'][_0xef93('0x41')]);_0x59acf3[_0xef93('0x42')]=qs[_0xef93('0x39')](_[_0xef93('0x43')](_0x2fbd03['query'],_0x4f43fa[_0xef93('0x39')]));if(_0x3055a2[_0xef93('0x36')]){if(_0x3055a2['dateEnd']){_0x3055a2[_0xef93('0x37')]=moment(_0x3055a2[_0xef93('0x37')])['add'](0x1,_0xef93('0x44'));}else{_0x3055a2[_0xef93('0x37')]=moment(_0x3055a2[_0xef93('0x36')])[_0xef93('0x45')](0x1,_0xef93('0x44'));}_[_0xef93('0x46')](_0x59acf3[_0xef93('0x42')],{'createdAt':{'$gte':_0x3055a2[_0xef93('0x36')],'$lte':_0x3055a2[_0xef93('0x37')]}});}if(_0x2fbd03[_0xef93('0x35')][_0xef93('0x47')]){_0x59acf3[_0xef93('0x42')]=_[_0xef93('0x46')](_0x59acf3[_0xef93('0x42')],{'$or':_['map'](_0x59acf3[_0xef93('0x3b')],function(_0x30abbb){var _0x284b6d={};_0x284b6d[_0x30abbb]={'$like':'%'+_0x2fbd03[_0xef93('0x35')][_0xef93('0x47')]+'%'};return _0x284b6d;})});}_0x59acf3=_[_0xef93('0x46')]({},_0x59acf3,_0x2fbd03['options']);var _0x587c58={'where':_0x59acf3['where']};return db[_0xef93('0x33')][_0xef93('0x29')](_0x587c58)[_0xef93('0x1c')](function(_0x48eb96){_0x1bef67[_0xef93('0x29')]=_0x48eb96;if(_0x2fbd03['query'][_0xef93('0x48')]){_0x59acf3[_0xef93('0x49')]=[{'all':!![]}];}return db[_0xef93('0x33')]['findAll'](_0x59acf3);})[_0xef93('0x1c')](function(_0x39161d){_0x1bef67['rows']=_0x39161d;return _0x1bef67;})[_0xef93('0x1c')](respondWithFilteredResult(_0x5e2d1e,_0x59acf3))[_0xef93('0x4a')](handleError(_0x5e2d1e,null));};exports[_0xef93('0x4b')]=function(_0x143feb,_0x2d8db5){var _0x13fc4b={'raw':!![],'where':{'id':_0x143feb[_0xef93('0x4c')]['id']}},_0x2ed690={};_0x2ed690[_0xef93('0x34')]=_['keys'](db['ChatGroup'][_0xef93('0x4d')]);_0x2ed690[_0xef93('0x35')]=_[_0xef93('0x38')](_0x143feb['query']);_0x2ed690['filters']=_[_0xef93('0x3a')](_0x2ed690[_0xef93('0x34')],_0x2ed690['query']);_0x13fc4b['attributes']=_[_0xef93('0x3a')](_0x2ed690[_0xef93('0x34')],qs['fields'](_0x143feb[_0xef93('0x35')]['fields']));_0x13fc4b['attributes']=_0x13fc4b['attributes']['length']?_0x13fc4b[_0xef93('0x3b')]:_0x2ed690[_0xef93('0x34')];if(_0x143feb['query'][_0xef93('0x48')]){_0x13fc4b['include']=[{'all':!![]}];}_0x13fc4b=_[_0xef93('0x46')]({},_0x13fc4b,_0x143feb['options']);return db[_0xef93('0x33')]['find'](_0x13fc4b)[_0xef93('0x1c')](handleEntityNotFound(_0x2d8db5,null))[_0xef93('0x1c')](respondWithResult(_0x2d8db5,null))['catch'](handleError(_0x2d8db5,null));};exports[_0xef93('0x4e')]=function(_0xf3b587,_0x5eb780){return db[_0xef93('0x33')][_0xef93('0x4e')](_0xf3b587[_0xef93('0x4f')],{})[_0xef93('0x1c')](respondWithResult(_0x5eb780,0xc9))[_0xef93('0x4a')](handleError(_0x5eb780,null));};exports[_0xef93('0x50')]=function(_0x8adda7,_0x2cd457){if(_0x8adda7[_0xef93('0x4f')]['id']){delete _0x8adda7[_0xef93('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x8adda7[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x2cd457,null))[_0xef93('0x1c')](saveUpdates(_0x8adda7['body'],null))[_0xef93('0x1c')](respondWithResult(_0x2cd457,null))[_0xef93('0x4a')](handleError(_0x2cd457,null));};exports[_0xef93('0x30')]=function(_0x8ae80e,_0x434d82){return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x8ae80e[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x434d82,null))[_0xef93('0x1c')](removeEntity(_0x434d82,null))['catch'](handleError(_0x434d82,null));};exports[_0xef93('0x52')]=function(_0x32b1b2,_0x176810){return db['ChatGroup'][_0xef93('0x52')]()[_0xef93('0x1c')](respondWithResult(_0x176810,null))[_0xef93('0x4a')](handleError(_0x176810,null));};exports[_0xef93('0x53')]=function(_0x34eba2,_0x2b8ec0,_0x2d23b3){return db[_0xef93('0x54')]['count']({'where':{'ChatGroupId':_0x34eba2[_0xef93('0x4c')]['id'],'ToId':_0x34eba2[_0xef93('0x55')]['id'],'read':![]}})[_0xef93('0x1c')](function(_0x3d4012){return{'id':_[_0xef93('0x56')](_0x34eba2[_0xef93('0x4c')]['id']),'count':_0x3d4012};})[_0xef93('0x1c')](respondWithResult(_0x2b8ec0,null))[_0xef93('0x4a')](handleError(_0x2b8ec0,null));};exports[_0xef93('0x57')]=function(_0x5c5166,_0x2067c7,_0x1d4f31){return db[_0xef93('0x33')]['find']({'where':{'id':_0x5c5166['params']['id']}})['then'](handleEntityNotFound(_0x2067c7,null))[_0xef93('0x1c')](function(_0x1bdf36){if(_0x1bdf36){return _0x1bdf36[_0xef93('0x57')](_0x5c5166['body'][_0xef93('0x58')],_[_0xef93('0x59')](_0x5c5166[_0xef93('0x4f')],[_0xef93('0x58'),'id'])||{});}})['then'](respondWithResult(_0x2067c7,null))[_0xef93('0x4a')](handleError(_0x2067c7,null));};exports['getMembers']=function(_0x316309,_0x26f467,_0x15934b){var _0xb7c61d={};var _0x3cd9ac={};var _0x3ab9d8;var _0xd2eb94;return db[_0xef93('0x33')][_0xef93('0x5a')]({'where':{'id':_0x316309[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x26f467,null))[_0xef93('0x1c')](function(_0x51263f){if(_0x51263f){_0x3ab9d8=_0x51263f;_0x3cd9ac[_0xef93('0x34')]=_['keys'](db[_0xef93('0x5b')][_0xef93('0x4d')]);_0x3cd9ac['query']=_['keys'](_0x316309[_0xef93('0x35')]);_0x3cd9ac[_0xef93('0x39')]=_[_0xef93('0x3a')](_0x3cd9ac[_0xef93('0x34')],_0x3cd9ac[_0xef93('0x35')]);_0xb7c61d[_0xef93('0x3b')]=_['intersection'](_0x3cd9ac[_0xef93('0x34')],qs[_0xef93('0x3c')](_0x316309[_0xef93('0x35')]['fields']));_0xb7c61d[_0xef93('0x3b')]=_0xb7c61d['attributes']['length']?_0xb7c61d[_0xef93('0x3b')]:_0x3cd9ac[_0xef93('0x34')];_0xb7c61d[_0xef93('0x40')]=qs[_0xef93('0x41')](_0x316309[_0xef93('0x35')][_0xef93('0x41')]);_0xb7c61d['where']=qs[_0xef93('0x39')](_[_0xef93('0x43')](_0x316309[_0xef93('0x35')],_0x3cd9ac[_0xef93('0x39')]));if(_0x316309[_0xef93('0x35')][_0xef93('0x47')]){_0xb7c61d[_0xef93('0x42')]=_[_0xef93('0x46')](_0xb7c61d['where'],{'$or':_[_0xef93('0x5c')](_0xb7c61d[_0xef93('0x3b')],function(_0x1a971b){var _0x3c06e4={};_0x3c06e4[_0x1a971b]={'$like':'%'+_0x316309[_0xef93('0x35')][_0xef93('0x47')]+'%'};return _0x3c06e4;})});}_0xb7c61d=_[_0xef93('0x46')]({},_0xb7c61d,_0x316309[_0xef93('0x5d')]);return _0x3ab9d8[_0xef93('0x5e')](_0xb7c61d);}})[_0xef93('0x1c')](function(_0x1b7994){if(_0x1b7994){_0xd2eb94=_0x1b7994[_0xef93('0x3d')];if(!_0x316309[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0xb7c61d[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x316309['query']['limit']);_0xb7c61d['offset']=qs['offset'](_0x316309[_0xef93('0x35')][_0xef93('0x2a')]);}return _0x3ab9d8[_0xef93('0x5e')](_0xb7c61d);}})[_0xef93('0x1c')](function(_0x34d048){if(_0x34d048){return _0x34d048?{'count':_0xd2eb94,'rows':_0x34d048}:null;}})[_0xef93('0x1c')](respondWithResult(_0x26f467,null))[_0xef93('0x4a')](handleError(_0x26f467,null));};exports[_0xef93('0x5f')]=function(_0x19c2a2,_0x201a29,_0x13d5a4){var _0x5a9ef2;return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x19c2a2[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x201a29,null))[_0xef93('0x1c')](function(_0x38dc32){if(_0x38dc32){return _0x38dc32[_0xef93('0x5f')](_0x19c2a2[_0xef93('0x35')][_0xef93('0x58')]);}})['then'](respondWithStatusCode(_0x201a29,null))[_0xef93('0x4a')](handleError(_0x201a29,null));};exports[_0xef93('0x60')]=function(_0x5dbe96,_0x5049b7,_0x5f33be){if(_0x5dbe96[_0xef93('0x4f')]['id']){delete _0x5dbe96[_0xef93('0x4f')]['id'];}return db[_0xef93('0x33')][_0xef93('0x51')]({'where':{'id':_0x5dbe96[_0xef93('0x4c')]['id']}})[_0xef93('0x1c')](handleEntityNotFound(_0x5049b7,null))[_0xef93('0x1c')](function(_0x32319d){if(_0x32319d){_0x5dbe96[_0xef93('0x4f')][_0xef93('0x61')]=_0x32319d['id'];return db['ChatInternalMessage']['create'](_0x5dbe96['body']);}})[_0xef93('0x1c')](respondWithResult(_0x5049b7,null))['catch'](handleError(_0x5049b7,null));};exports[_0xef93('0x62')]=function(_0x2c7995,_0x2c49f8,_0x24a191){var _0x96f506={};var _0x5fa15a={};var _0x3d2335;var _0x587607;return db[_0xef93('0x33')][_0xef93('0x5a')]({'where':{'id':_0x2c7995[_0xef93('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2c49f8,null))[_0xef93('0x1c')](function(_0xf029b4){if(_0xf029b4){_0x3d2335=_0xf029b4;_0x5fa15a[_0xef93('0x34')]=_[_0xef93('0x38')](db[_0xef93('0x54')]['rawAttributes']);_0x5fa15a[_0xef93('0x35')]=_[_0xef93('0x38')](_0x2c7995[_0xef93('0x35')]);_0x5fa15a['filters']=_['intersection'](_0x5fa15a[_0xef93('0x34')],_0x5fa15a[_0xef93('0x35')]);_0x96f506[_0xef93('0x3b')]=_[_0xef93('0x3a')](_0x5fa15a[_0xef93('0x34')],qs['fields'](_0x2c7995[_0xef93('0x35')][_0xef93('0x3c')]));_0x96f506[_0xef93('0x3b')]=_0x96f506[_0xef93('0x3b')][_0xef93('0x3d')]?_0x96f506[_0xef93('0x3b')]:_0x5fa15a[_0xef93('0x34')];_0x96f506[_0xef93('0x40')]=qs['sort'](_0x2c7995[_0xef93('0x35')][_0xef93('0x41')]);_0x96f506[_0xef93('0x42')]=qs[_0xef93('0x39')](_['pick'](_0x2c7995[_0xef93('0x35')],_0x5fa15a[_0xef93('0x39')]));if(_0x2c7995['query'][_0xef93('0x47')]){_0x96f506[_0xef93('0x42')]=_[_0xef93('0x46')](_0x96f506['where'],{'$or':_[_0xef93('0x5c')](_0x96f506['attributes'],function(_0x4c33ea){var _0x1f2a1c={};_0x1f2a1c[_0x4c33ea]={'$like':'%'+_0x2c7995['query'][_0xef93('0x47')]+'%'};return _0x1f2a1c;})});}if(_0x2c7995['query']['$gte']){var _0x2f5fce=_0x2c7995['query'][_0xef93('0x63')][_0xef93('0x64')](',');var _0x55a49a={};_0x55a49a[_0x2f5fce[0x0]]={'$gte':moment(_0x2f5fce[0x1])[_0xef93('0x65')](_0xef93('0x66'))};_0x96f506[_0xef93('0x42')]=_[_0xef93('0x46')](_0x96f506[_0xef93('0x42')],_0x55a49a);}_0x96f506=_['merge']({},_0x96f506,_0x2c7995[_0xef93('0x5d')]);return _0x3d2335[_0xef93('0x62')](_0x96f506);}})[_0xef93('0x1c')](function(_0x3c88c4){if(_0x3c88c4){_0x587607=_0x3c88c4[_0xef93('0x3d')];if(!_0x2c7995[_0xef93('0x35')][_0xef93('0x3e')]('nolimit')){_0x96f506[_0xef93('0x3f')]=qs[_0xef93('0x3f')](_0x2c7995[_0xef93('0x35')][_0xef93('0x3f')]);_0x96f506['offset']=qs[_0xef93('0x2a')](_0x2c7995[_0xef93('0x35')][_0xef93('0x2a')]);}return _0x3d2335[_0xef93('0x62')](_0x96f506);}})['then'](function(_0x21969d){if(_0x21969d){return _0x21969d?{'count':_0x587607,'rows':_0x21969d}:null;}})[_0xef93('0x1c')](respondWithResult(_0x2c49f8,null))[_0xef93('0x4a')](handleError(_0x2c49f8,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index c76ad17..4cc6afb 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 _0xdabf=['../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x239649,_0x4cbb5f){var _0x12315b=function(_0x2ecf2c){while(--_0x2ecf2c){_0x239649['push'](_0x239649['shift']());}};_0x12315b(++_0x4cbb5f);}(_0xdabf,0x6c));var _0xfdab=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xdabf[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xfdab('0x0'))['db'][_0xfdab('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xfdab('0x2')](0x0);var events={'afterCreate':_0xfdab('0x3'),'afterUpdate':_0xfdab('0x4'),'afterDestroy':_0xfdab('0x5')};function emitEvent(_0x5a76f3){return function(_0x272d9e,_0x1cd173,_0x11439c){ChatGroupEvents[_0xfdab('0x6')](_0x5a76f3+':'+_0x272d9e['id'],_0x272d9e);ChatGroupEvents[_0xfdab('0x6')](_0x5a76f3,_0x272d9e);_0x11439c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0xfdab('0x7')](e,emitEvent(event));}}module[_0xfdab('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x6669=['events','../../mysqldb','ChatGroup','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x2fd404,_0x369e73){var _0x516d76=function(_0xfb3644){while(--_0xfb3644){_0x2fd404['push'](_0x2fd404['shift']());}};_0x516d76(++_0x369e73);}(_0x6669,0x1e0));var _0x9666=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0x6669[_0x5a79e2];return _0x266c45;};'use strict';var EventEmitter=require(_0x9666('0x0'));var ChatGroup=require(_0x9666('0x1'))['db'][_0x9666('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9666('0x3')](0x0);var events={'afterCreate':_0x9666('0x4'),'afterUpdate':_0x9666('0x5'),'afterDestroy':_0x9666('0x6')};function emitEvent(_0x2828c8){return function(_0x3f8aa5,_0x3fde8c,_0x212e21){ChatGroupEvents[_0x9666('0x7')](_0x2828c8+':'+_0x3f8aa5['id'],_0x3f8aa5);ChatGroupEvents['emit'](_0x2828c8,_0x3f8aa5);_0x212e21(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x9666('0x8')](e,emitEvent(event));}}module[_0x9666('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f9f2b28..39ba5e0 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 _0xd879=['lodash','../../config/logger','moment','bluebird','request-promise','./chatGroup.attributes','exports','chat_groups'];(function(_0x2c69a1,_0x201903){var _0x24bb91=function(_0x3131ac){while(--_0x3131ac){_0x2c69a1['push'](_0x2c69a1['shift']());}};_0x24bb91(++_0x201903);}(_0xd879,0x108));var _0x9d87=function(_0x466dc4,_0x1073ea){_0x466dc4=_0x466dc4-0x0;var _0x442af7=_0xd879[_0x466dc4];return _0x442af7;};'use strict';var _=require(_0x9d87('0x0'));var util=require('util');var logger=require(_0x9d87('0x1'))('api');var moment=require(_0x9d87('0x2'));var BPromise=require(_0x9d87('0x3'));var rp=require(_0x9d87('0x4'));var attributes=require(_0x9d87('0x5'));module[_0x9d87('0x6')]=function(_0x126962,_0x4c96be){return _0x126962['define']('ChatGroup',attributes,{'tableName':_0x9d87('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a31=['../../config/logger','api','moment','request-promise','exports','define','chat_groups','util'];(function(_0x5eafce,_0x3d62b6){var _0x414698=function(_0x58ff9a){while(--_0x58ff9a){_0x5eafce['push'](_0x5eafce['shift']());}};_0x414698(++_0x3d62b6);}(_0x4a31,0x187));var _0x14a3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a31[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x14a3('0x0'));var logger=require(_0x14a3('0x1'))(_0x14a3('0x2'));var moment=require(_0x14a3('0x3'));var BPromise=require('bluebird');var rp=require(_0x14a3('0x4'));var attributes=require('./chatGroup.attributes');module[_0x14a3('0x5')]=function(_0xadc3c7,_0x441702){return _0xadc3c7[_0x14a3('0x6')]('ChatGroup',attributes,{'tableName':_0x14a3('0x7'),'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 814aeb7..ebf1234 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 _0x20f4=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','socket.io-emitter','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x52f344,_0x29d242){var _0xb45b4c=function(_0x27dde5){while(--_0x27dde5){_0x52f344['push'](_0x52f344['shift']());}};_0xb45b4c(++_0x29d242);}(_0x20f4,0x1f3));var _0x420f=function(_0x38e2ae,_0x219a81){_0x38e2ae=_0x38e2ae-0x0;var _0x525a1b=_0x20f4[_0x38e2ae];return _0x525a1b;};'use strict';var _=require(_0x420f('0x0'));var util=require(_0x420f('0x1'));var moment=require('moment');var BPromise=require(_0x420f('0x2'));var rs=require(_0x420f('0x3'));var fs=require('fs');var db=require(_0x420f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x420f('0x5'))(_0x420f('0x6'));var config=require(_0x420f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x420f('0x8')]['http']({'port':0x232a});var socket=require(_0x420f('0x9'))({'host':_0x420f('0xa'),'port':0x18eb});require(_0x420f('0xb'))[_0x420f('0xc')](socket);function respondWithRpcPromise(_0x2d409d,_0x29042b,_0x473148){return new BPromise(function(_0x3aafcd,_0x516d9c){return client[_0x420f('0xd')](_0x2d409d,_0x473148)[_0x420f('0xe')](function(_0x7eb021){logger[_0x420f('0xf')](_0x420f('0x10'),_0x29042b,_0x420f('0x11'));logger[_0x420f('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x29042b,_0x420f('0x11'),JSON[_0x420f('0x13')](_0x7eb021));if(_0x7eb021[_0x420f('0x14')]){if(_0x7eb021[_0x420f('0x14')][_0x420f('0x15')]===0x1f4){logger[_0x420f('0x14')](_0x420f('0x10'),_0x29042b,_0x7eb021[_0x420f('0x14')][_0x420f('0x16')]);return _0x516d9c(_0x7eb021['error']['message']);}logger[_0x420f('0x14')](_0x420f('0x10'),_0x29042b,_0x7eb021[_0x420f('0x14')][_0x420f('0x16')]);return _0x3aafcd(_0x7eb021['error'][_0x420f('0x16')]);}else{logger[_0x420f('0xf')](_0x420f('0x10'),_0x29042b,'request\x20sent');_0x3aafcd(_0x7eb021[_0x420f('0x17')][_0x420f('0x16')]);}})[_0x420f('0x18')](function(_0x2b48ee){logger[_0x420f('0x14')](_0x420f('0x10'),_0x29042b,_0x2b48ee);_0x516d9c(_0x2b48ee);});});} \ No newline at end of file +var _0x2a85=['then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','register','request'];(function(_0x23c671,_0x560893){var _0x3fb348=function(_0x5d1850){while(--_0x5d1850){_0x23c671['push'](_0x23c671['shift']());}};_0x3fb348(++_0x560893);}(_0x2a85,0x1ea));var _0x52a8=function(_0x347f53,_0x34eee3){_0x347f53=_0x347f53-0x0;var _0x33ecde=_0x2a85[_0x347f53];return _0x33ecde;};'use strict';var _=require(_0x52a8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x52a8('0x1'));var rs=require(_0x52a8('0x2'));var fs=require('fs');var db=require(_0x52a8('0x3'))['db'];var utils=require(_0x52a8('0x4'));var logger=require(_0x52a8('0x5'))(_0x52a8('0x6'));var config=require(_0x52a8('0x7'));var jayson=require(_0x52a8('0x8'));var client=jayson[_0x52a8('0x9')][_0x52a8('0xa')]({'port':0x232a});var socket=require(_0x52a8('0xb'))({'host':'localhost','port':0x18eb});require('./chatGroup.socket')[_0x52a8('0xc')](socket);function respondWithRpcPromise(_0x360463,_0x4c35eb,_0x5807d0){return new BPromise(function(_0x47428d,_0x33c57c){return client[_0x52a8('0xd')](_0x360463,_0x5807d0)[_0x52a8('0xe')](function(_0x569471){logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x4c35eb,_0x52a8('0x11'));logger[_0x52a8('0x12')](_0x52a8('0x13'),_0x4c35eb,_0x52a8('0x11'),JSON[_0x52a8('0x14')](_0x569471));if(_0x569471[_0x52a8('0x15')]){if(_0x569471[_0x52a8('0x15')][_0x52a8('0x16')]===0x1f4){logger[_0x52a8('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c35eb,_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);return _0x33c57c(_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);}logger[_0x52a8('0x15')](_0x52a8('0x10'),_0x4c35eb,_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);return _0x47428d(_0x569471[_0x52a8('0x15')][_0x52a8('0x17')]);}else{logger[_0x52a8('0xf')](_0x52a8('0x10'),_0x4c35eb,_0x52a8('0x11'));_0x47428d(_0x569471['result'][_0x52a8('0x17')]);}})['catch'](function(_0x1d48a3){logger[_0x52a8('0x15')]('ChatGroup,\x20%s,\x20%s',_0x4c35eb,_0x1d48a3);_0x33c57c(_0x1d48a3);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8603c7c..bfd0720 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 _0x0713=['removeListener','register','length','chatGroup:','remove','update'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=['save',_0x3071('0x0'),_0x3071('0x1')];function createListener(_0x27405a,_0x305d85){return function(_0x864539){_0x305d85['emit'](_0x27405a,_0x864539);};}function removeListener(_0x2c547f,_0x7b18a4){return function(){ChatGroupEvents[_0x3071('0x2')](_0x2c547f,_0x7b18a4);};}exports[_0x3071('0x3')]=function(_0xabd7b6){for(var _0x41cf76=0x0,_0x1d3dd6=events[_0x3071('0x4')];_0x41cf76<_0x1d3dd6;_0x41cf76++){var _0xbd737f=events[_0x41cf76];var _0x22274c=createListener(_0x3071('0x5')+_0xbd737f,_0xabd7b6);ChatGroupEvents['on'](_0xbd737f,_0x22274c);}}; \ No newline at end of file +var _0x1e69=['emit','removeListener','register','length','chatGroup:','save','remove','update'];(function(_0x1d02ac,_0x378eb2){var _0x1f01ba=function(_0x355bb4){while(--_0x355bb4){_0x1d02ac['push'](_0x1d02ac['shift']());}};_0x1f01ba(++_0x378eb2);}(_0x1e69,0x85));var _0x91e6=function(_0x102826,_0x35f7b9){_0x102826=_0x102826-0x0;var _0x57556e=_0x1e69[_0x102826];return _0x57556e;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x91e6('0x0'),_0x91e6('0x1'),_0x91e6('0x2')];function createListener(_0x3a523e,_0x4f5881){return function(_0x537c0e){_0x4f5881[_0x91e6('0x3')](_0x3a523e,_0x537c0e);};}function removeListener(_0x351c1d,_0x2b53b6){return function(){ChatGroupEvents[_0x91e6('0x4')](_0x351c1d,_0x2b53b6);};}exports[_0x91e6('0x5')]=function(_0x42fe90){for(var _0x4091b8=0x0,_0x2733bf=events[_0x91e6('0x6')];_0x4091b8<_0x2733bf;_0x4091b8++){var _0x375184=events[_0x4091b8];var _0x266fe6=createListener(_0x91e6('0x7')+_0x375184,_0x42fe90);ChatGroupEvents['on'](_0x375184,_0x266fe6);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index cd3c41b..1c8e034 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 _0xe8d3=['destroy','removeMembers','util','path','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','getUnread','getMembers','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','update','delete'];(function(_0x2f505a,_0x4df654){var _0x9f25da=function(_0x1a7a93){while(--_0x1a7a93){_0x2f505a['push'](_0x2f505a['shift']());}};_0x9f25da(++_0x4df654);}(_0xe8d3,0xb1));var _0x3e8d=function(_0x50b148,_0x198a78){_0x50b148=_0x50b148-0x0;var _0x371a7a=_0xe8d3[_0x50b148];return _0x371a7a;};'use strict';var multer=require('multer');var util=require(_0x3e8d('0x0'));var path=require(_0x3e8d('0x1'));var express=require(_0x3e8d('0x2'));var router=express['Router']();var auth=require(_0x3e8d('0x3'));var interaction=require(_0x3e8d('0x4'));var config=require('../../config/environment');var controller=require(_0x3e8d('0x5'));router['get']('/',auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x7')]);router[_0x3e8d('0x8')](_0x3e8d('0x9'),auth[_0x3e8d('0x6')](),controller[_0x3e8d('0xa')]);router['get'](_0x3e8d('0xb'),auth[_0x3e8d('0x6')](),controller['show']);router[_0x3e8d('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0x3e8d('0xc')]);router['get']('/:id/members',auth[_0x3e8d('0x6')](),controller[_0x3e8d('0xd')]);router[_0x3e8d('0x8')](_0x3e8d('0xe'),auth[_0x3e8d('0x6')](),controller[_0x3e8d('0xf')]);router[_0x3e8d('0x10')]('/',auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x11')]);router[_0x3e8d('0x10')](_0x3e8d('0x12'),auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x13')]);router[_0x3e8d('0x10')](_0x3e8d('0xe'),auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x14')]);router['put'](_0x3e8d('0xb'),auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x15')]);router[_0x3e8d('0x16')](_0x3e8d('0xb'),auth['isAuthenticated'](),controller[_0x3e8d('0x17')]);router[_0x3e8d('0x16')]('/:id/members',auth[_0x3e8d('0x6')](),controller[_0x3e8d('0x18')]);module['exports']=router; \ No newline at end of file +var _0xc8d9=['/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','destroy','removeMembers','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/unread','getUnread'];(function(_0x4a91fc,_0x5bc46c){var _0x255ae8=function(_0x33ddbb){while(--_0x33ddbb){_0x4a91fc['push'](_0x4a91fc['shift']());}};_0x255ae8(++_0x5bc46c);}(_0xc8d9,0x15d));var _0x9c8d=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0xc8d9[_0x50b1c5];return _0x344f99;};'use strict';var multer=require('multer');var util=require(_0x9c8d('0x0'));var path=require('path');var express=require(_0x9c8d('0x1'));var router=express[_0x9c8d('0x2')]();var auth=require(_0x9c8d('0x3'));var interaction=require(_0x9c8d('0x4'));var config=require(_0x9c8d('0x5'));var controller=require(_0x9c8d('0x6'));router['get']('/',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x8')]);router[_0x9c8d('0x9')](_0x9c8d('0xa'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0xb')]);router['get'](_0x9c8d('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9c8d('0xd'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0xe')]);router[_0x9c8d('0x9')](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x10')]);router[_0x9c8d('0x9')](_0x9c8d('0x11'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x12')]);router[_0x9c8d('0x13')]('/',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x14')]);router[_0x9c8d('0x13')](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x15')]);router[_0x9c8d('0x13')](_0x9c8d('0x11'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x16')]);router['put'](_0x9c8d('0xc'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x17')]);router[_0x9c8d('0x18')]('/:id',auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x19')]);router['delete'](_0x9c8d('0xf'),auth[_0x9c8d('0x7')](),controller[_0x9c8d('0x1a')]);module[_0x9c8d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 0a645b1..55c6c80 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 _0x96cc=['STRING','DATE','long','out','sequelize','BOOLEAN','ENUM','star','thumb','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x96cc,0x16c));var _0xc96c=function(_0x4d578c,_0x4d2ed2){_0x4d578c=_0x4d578c-0x0;var _0xf41cac=_0x96cc[_0x4d578c];return _0xf41cac;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xc96c('0x2')](_0xc96c('0x3'),_0xc96c('0x4')),'defaultValue':_0xc96c('0x3')},'ratingMessage':{'type':Sequelize[_0xc96c('0x5')]},'pathTranscript':{'type':Sequelize[_0xc96c('0x5')]},'mailTranscript':{'type':Sequelize[_0xc96c('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc96c('0x7')]},'disposition':{'type':Sequelize[_0xc96c('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xc96c('0x6')]},'browserVersion':{'type':Sequelize[_0xc96c('0x6')]},'osName':{'type':Sequelize[_0xc96c('0x6')]},'osVersion':{'type':Sequelize[_0xc96c('0x6')]},'deviceModel':{'type':Sequelize[_0xc96c('0x6')]},'deviceVendor':{'type':Sequelize[_0xc96c('0x6')]},'deviceType':{'type':Sequelize[_0xc96c('0x6')]},'referer':{'type':Sequelize['STRING']},'customerIp':{'type':Sequelize[_0xc96c('0x6')]},'formData':{'type':Sequelize[_0xc96c('0x5')](_0xc96c('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xc96c('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc96c('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4483=['out','sequelize','exports','BOOLEAN','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4483,0x1a3));var _0x3448=function(_0x494444,_0x104f0a){_0x494444=_0x494444-0x0;var _0x291f1f=_0x4483[_0x494444];return _0x291f1f;};'use strict';var Sequelize=require(_0x3448('0x0'));module[_0x3448('0x1')]={'closed':{'type':Sequelize[_0x3448('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x3448('0x3')](_0x3448('0x4'),_0x3448('0x5')),'defaultValue':_0x3448('0x4')},'ratingMessage':{'type':Sequelize[_0x3448('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x3448('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3448('0x8')]},'disposition':{'type':Sequelize[_0x3448('0x7')]},'note':{'type':Sequelize[_0x3448('0x7')]},'browserName':{'type':Sequelize[_0x3448('0x7')]},'browserVersion':{'type':Sequelize[_0x3448('0x7')]},'osName':{'type':Sequelize[_0x3448('0x7')]},'osVersion':{'type':Sequelize[_0x3448('0x7')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x3448('0x7')]},'referer':{'type':Sequelize[_0x3448('0x7')]},'customerIp':{'type':Sequelize[_0x3448('0x7')]},'formData':{'type':Sequelize[_0x3448('0x6')](_0x3448('0x9'))},'read1stAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3448('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x3448('0x3')]('in',_0x3448('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3448('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3b1b358..07886f9 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 _0x91ed=['send','index','ChatInteraction','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','add','day','merge','map','filter','options','include','tag','push','Tag','Tags','read','direction','createdAt','includeAll','User','CmContact','Contact','Owner','fullname','internal','ChatWebsite','Account','ChatMessage','color','ThroughTags','findAll','rows','show','find','create','body','destroy','params','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','closedAt','disposition','AbandonInteraction','attachmentUpload','file','filename','type','mimetype','Attachment','findOne','Unauthorized','attachId','download','join','server/files/attachments/','basename','close','root','server/files/chat/upload/','format','now','pathTranscript','Messages','ChatWebsiteId','ContactId','agentAlias','System','%s%d','Visitor','agentIdentifier','alias','agent_fullname','secret','MailAccount','MailServerOut','Smtp','service','port','secure','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','mailTranscript','Mail\x20Transcript','addMessage','ids','omit','getMessages','nolimit','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','ChatInteractionId','includeAgent','addTags','setTags','spread','chatInteractionTags:save','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','localhost','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','count','offset','set','Content-Range','apply','save','update','sendStatus','stack','name'];(function(_0x516091,_0x2a92f1){var _0x37f205=function(_0x4c58e8){while(--_0x4c58e8){_0x516091['push'](_0x516091['shift']());}};_0x37f205(++_0x2a92f1);}(_0x91ed,0x7f));var _0xd91e=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x91ed[_0xaa1b3e];return _0x454d7d;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xd91e('0x0'));var moment=require(_0xd91e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd91e('0x2'));var util=require(_0xd91e('0x3'));var path=require(_0xd91e('0x4'));var sox=require(_0xd91e('0x5'));var csv=require(_0xd91e('0x6'));var ejs=require(_0xd91e('0x7'));var fs=require('fs');var _=require(_0xd91e('0x8'));var squel=require(_0xd91e('0x9'));var crypto=require(_0xd91e('0xa'));var jsforce=require(_0xd91e('0xb'));var deskjs=require(_0xd91e('0xc'));var toCsv=require(_0xd91e('0x6'));var querystring=require('querystring');var Papa=require(_0xd91e('0xd'));var qs=require(_0xd91e('0xe'));var logger=require(_0xd91e('0xf'))(_0xd91e('0x10'));var utils=require(_0xd91e('0x11'));var config=require('../../config/environment');var db=require(_0xd91e('0x12'))['db'];var socket=require('socket.io-emitter')({'host':_0xd91e('0x13'),'port':0x18eb});require(_0xd91e('0x14'))[_0xd91e('0x15')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd91e('0x16')][_0xd91e('0x17')]({'port':0x232b});var client9004=jayson[_0xd91e('0x16')][_0xd91e('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x112f01,_0x2f3d59,_0x250ca2,_0x420343){return new BPromise(function(_0x4144ad,_0x5dd113){var _0x2cfc98=_0x420343||client;return _0x2cfc98[_0xd91e('0x18')](_0x112f01,_0x250ca2)[_0xd91e('0x19')](function(_0x3a8174){logger[_0xd91e('0x1a')](_0xd91e('0x1b'),_0x2f3d59,_0xd91e('0x1c'));logger[_0xd91e('0x1d')](_0xd91e('0x1e'),_0x2f3d59,_0xd91e('0x1c'),JSON[_0xd91e('0x1f')](_0x3a8174));if(_0x3a8174[_0xd91e('0x20')]){if(_0x3a8174[_0xd91e('0x20')][_0xd91e('0x21')]===0x1f4){logger[_0xd91e('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x2f3d59,_0x3a8174['error']['message']);return _0x5dd113(_0x3a8174[_0xd91e('0x20')][_0xd91e('0x22')]);}logger[_0xd91e('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x2f3d59,_0x3a8174[_0xd91e('0x20')]['message']);return _0x4144ad(_0x3a8174['error'][_0xd91e('0x22')]);}else{logger['info'](_0xd91e('0x1b'),_0x2f3d59,'request\x20sent');_0x4144ad(_0x3a8174['result']['message']);}})[_0xd91e('0x23')](function(_0x238b19){logger[_0xd91e('0x20')]('ChatInteraction,\x20%s,\x20%s',_0x2f3d59,_0x238b19);_0x5dd113(_0x238b19);});});}function respondWithStatusCode(_0x246a71,_0x359773){_0x359773=_0x359773||0xcc;return function(_0x3ebf0a){if(_0x3ebf0a){return _0x246a71['sendStatus'](_0x359773);}return _0x246a71['status'](_0x359773)[_0xd91e('0x24')]();};}function respondWithResult(_0x37933b,_0x3835ff){_0x3835ff=_0x3835ff||0xc8;return function(_0xd86a2a){if(_0xd86a2a){return _0x37933b[_0xd91e('0x25')](_0x3835ff)[_0xd91e('0x26')](_0xd86a2a);}};}function respondWithFilteredResult(_0x37360a,_0x37f811){return function(_0x25af23){if(_0x25af23){var _0x3d7383=_0x25af23[_0xd91e('0x27')],_0x314856=_0x37f811[_0xd91e('0x28')],_0x61cf32=_0x37f811[_0xd91e('0x28')]+_0x37f811['limit'],_0x13cfb8;if(_0x61cf32>=_0x3d7383){_0x61cf32=_0x3d7383;_0x13cfb8=0xc8;}else{_0x13cfb8=0xce;}_0x37360a[_0xd91e('0x25')](_0x13cfb8);return _0x37360a[_0xd91e('0x29')](_0xd91e('0x2a'),_0x314856+'-'+_0x61cf32+'/'+_0x3d7383)[_0xd91e('0x26')](_0x25af23);}return null;};}function patchUpdates(_0x3bb40f){return function(_0x37f126){try{jsonpatch[_0xd91e('0x2b')](_0x37f126,_0x3bb40f,!![]);}catch(_0x55eb4f){return BPromise['reject'](_0x55eb4f);}return _0x37f126[_0xd91e('0x2c')]();};}function saveUpdates(_0x2e2469,_0x19e03b){return function(_0x119190){if(_0x119190){return _0x119190[_0xd91e('0x2d')](_0x2e2469)[_0xd91e('0x19')](function(_0x48b693){return _0x48b693;});}return null;};}function removeEntity(_0x74860a,_0x28b860){return function(_0x37c5e5){if(_0x37c5e5){return _0x37c5e5['destroy']()[_0xd91e('0x19')](function(){_0x74860a[_0xd91e('0x25')](0xcc)[_0xd91e('0x24')]();});}};}function handleEntityNotFound(_0xffef21,_0x470824){return function(_0x1a96f7){if(!_0x1a96f7){_0xffef21[_0xd91e('0x2e')](0x194);}return _0x1a96f7;};}function handleError(_0x4123f9,_0x5edcb5){_0x5edcb5=_0x5edcb5||0x1f4;return function(_0x4192e9){logger[_0xd91e('0x20')](_0x4192e9[_0xd91e('0x2f')]);if(_0x4192e9['name']){delete _0x4192e9[_0xd91e('0x30')];}_0x4123f9[_0xd91e('0x25')](_0x5edcb5)[_0xd91e('0x31')](_0x4192e9);};}exports[_0xd91e('0x32')]=function(_0x2a14b8,_0x5957e6){var _0x23cbb1={},_0x432b12={},_0x5201fc={'count':0x0,'rows':[]};var _0x518b4b=db[_0xd91e('0x33')][_0xd91e('0x34')];_0x432b12[_0xd91e('0x35')]=_[_0xd91e('0x36')](_0x518b4b);var _0x4d1121={'dateStart':_0x2a14b8[_0xd91e('0x37')]['dateStart'],'dateEnd':_0x2a14b8['query'][_0xd91e('0x38')]};delete _0x2a14b8[_0xd91e('0x37')][_0xd91e('0x39')];delete _0x2a14b8['query']['dateEnd'];_0x432b12[_0xd91e('0x37')]=_[_0xd91e('0x36')](_0x2a14b8[_0xd91e('0x37')]);_0x432b12[_0xd91e('0x3a')]=_[_0xd91e('0x3b')](_0x432b12[_0xd91e('0x35')],_0x432b12[_0xd91e('0x37')]);_0x23cbb1[_0xd91e('0x3c')]=_[_0xd91e('0x3b')](_0x432b12[_0xd91e('0x35')],qs[_0xd91e('0x3d')](_0x2a14b8['query'][_0xd91e('0x3d')]));_0x23cbb1[_0xd91e('0x3c')]=_0x23cbb1[_0xd91e('0x3c')][_0xd91e('0x3e')]?_0x23cbb1[_0xd91e('0x3c')]:_0x432b12['model'];if(!_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x3f')]('nolimit')){_0x23cbb1[_0xd91e('0x40')]=qs[_0xd91e('0x40')](_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x40')]);_0x23cbb1[_0xd91e('0x28')]=qs[_0xd91e('0x28')](_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x28')]);}_0x23cbb1[_0xd91e('0x41')]=qs['sort'](_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x42')]);_0x23cbb1[_0xd91e('0x43')]=qs[_0xd91e('0x3a')](_[_0xd91e('0x44')](_0x2a14b8[_0xd91e('0x37')],_0x432b12['filters']));if(_0x4d1121[_0xd91e('0x39')]){if(_0x4d1121['dateEnd']){_0x4d1121[_0xd91e('0x38')]=moment(_0x4d1121[_0xd91e('0x38')])[_0xd91e('0x45')](0x1,_0xd91e('0x46'));}else{_0x4d1121[_0xd91e('0x38')]=moment(_0x4d1121[_0xd91e('0x39')])[_0xd91e('0x45')](0x1,_0xd91e('0x46'));}_[_0xd91e('0x47')](_0x23cbb1['where'],{'createdAt':{'$gte':_0x4d1121[_0xd91e('0x39')],'$lte':_0x4d1121[_0xd91e('0x38')]}});}if(_0x2a14b8[_0xd91e('0x37')]['filter']){_0x23cbb1['where']=_['merge'](_0x23cbb1[_0xd91e('0x43')],{'$or':_[_0xd91e('0x48')](_0x23cbb1['attributes'],function(_0x1d48a3){var _0x2500b5={};_0x2500b5[_0x1d48a3]={'$like':'%'+_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x49')]+'%'};return _0x2500b5;})});}_0x23cbb1=_[_0xd91e('0x47')]({},_0x23cbb1,_0x2a14b8[_0xd91e('0x4a')]);var _0x2b4fca={'where':_0x23cbb1['where']};_0x2b4fca[_0xd91e('0x4b')]=[];if(_0x2a14b8['query'][_0xd91e('0x4c')]){_0x2b4fca[_0xd91e('0x4b')][_0xd91e('0x4d')]({'model':db[_0xd91e('0x4e')],'as':_0xd91e('0x4f'),'attributes':['id'],'where':{'id':_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x4c')]},'required':!![]});_0x2b4fca['distinct']=!![];}if(_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x50')]){_0x2b4fca[_0xd91e('0x4b')]['push']({'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0xd91e('0x51'),_0xd91e('0x52'),_0xd91e('0x50')],'where':{'direction':'in','read':_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x50')]||![]},'required':!![]});_0x2b4fca['distinct']=!![];}return db['ChatInteraction'][_0xd91e('0x27')](_0x2b4fca)[_0xd91e('0x19')](function(_0x92610c){_0x5201fc['count']=_0x92610c;if(_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x53')]){_0x23cbb1[_0xd91e('0x4b')]=[{'model':db[_0xd91e('0x54')],'as':'Users','required':![],'attributes':['id',_0xd91e('0x30'),'fullname']},{'model':db[_0xd91e('0x55')],'as':_0xd91e('0x56'),'required':![]},{'model':db[_0xd91e('0x54')],'as':_0xd91e('0x57'),'attributes':['name',_0xd91e('0x58'),_0xd91e('0x59')],'required':![]},{'model':db[_0xd91e('0x5a')],'as':_0xd91e('0x5b'),'attributes':['name','key'],'required':![]},{'model':db[_0xd91e('0x5c')],'as':'Messages','attributes':['id',_0xd91e('0x51'),_0xd91e('0x52'),_0xd91e('0x50')],'where':{'direction':'in','read':_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x50')]||![]},'required':_0x2a14b8['query'][_0xd91e('0x50')]||![]},{'model':db[_0xd91e('0x4e')],'as':_0xd91e('0x4f'),'attributes':['id',_0xd91e('0x30'),_0xd91e('0x5d')],'required':_0x2a14b8['query'][_0xd91e('0x4c')]?!![]:![]},{'model':db[_0xd91e('0x4e')],'as':_0xd91e('0x5e'),'attributes':['id',_0xd91e('0x30'),_0xd91e('0x5d')],'through':_0x2a14b8[_0xd91e('0x37')]['tag']?{'attributes':[],'where':{'TagId':_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x4c')]||undefined}}:{},'required':_0x2a14b8[_0xd91e('0x37')][_0xd91e('0x4c')]?!![]:![]}];}return db[_0xd91e('0x33')][_0xd91e('0x5f')](_0x23cbb1);})[_0xd91e('0x19')](function(_0x13581b){_0x5201fc[_0xd91e('0x60')]=_0x13581b;return _0x5201fc;})['then'](respondWithFilteredResult(_0x5957e6,_0x23cbb1))[_0xd91e('0x23')](handleError(_0x5957e6,null));};exports[_0xd91e('0x61')]=function(_0x1e8288,_0x1c755d){var _0x13ea9d={'raw':![],'where':{'id':_0x1e8288['params']['id']}},_0x18d632={};_0x18d632[_0xd91e('0x35')]=_['keys'](db['ChatInteraction'][_0xd91e('0x34')]);_0x18d632[_0xd91e('0x37')]=_[_0xd91e('0x36')](_0x1e8288[_0xd91e('0x37')]);_0x18d632[_0xd91e('0x3a')]=_[_0xd91e('0x3b')](_0x18d632[_0xd91e('0x35')],_0x18d632[_0xd91e('0x37')]);_0x13ea9d['attributes']=_['intersection'](_0x18d632[_0xd91e('0x35')],qs[_0xd91e('0x3d')](_0x1e8288[_0xd91e('0x37')][_0xd91e('0x3d')]));_0x13ea9d[_0xd91e('0x3c')]=_0x13ea9d['attributes'][_0xd91e('0x3e')]?_0x13ea9d[_0xd91e('0x3c')]:_0x18d632[_0xd91e('0x35')];if(_0x1e8288['query'][_0xd91e('0x53')]){_0x13ea9d[_0xd91e('0x4b')]=[{'all':!![]}];}_0x13ea9d=_[_0xd91e('0x47')]({},_0x13ea9d,_0x1e8288[_0xd91e('0x4a')]);return db[_0xd91e('0x33')][_0xd91e('0x62')](_0x13ea9d)[_0xd91e('0x19')](handleEntityNotFound(_0x1c755d,null))['then'](respondWithResult(_0x1c755d,null))[_0xd91e('0x23')](handleError(_0x1c755d,null));};exports[_0xd91e('0x63')]=function(_0x5bc6ea,_0x3a291a){return db[_0xd91e('0x33')]['create'](_0x5bc6ea[_0xd91e('0x64')],{})[_0xd91e('0x19')](respondWithResult(_0x3a291a,0xc9))[_0xd91e('0x23')](handleError(_0x3a291a,null));};exports['update']=function(_0x50c4ce,_0x595df9){if(_0x50c4ce[_0xd91e('0x64')]['id']){delete _0x50c4ce[_0xd91e('0x64')]['id'];}return db[_0xd91e('0x33')]['find']({'where':{'id':_0x50c4ce['params']['id']}})['then'](handleEntityNotFound(_0x595df9,null))[_0xd91e('0x19')](saveUpdates(_0x50c4ce[_0xd91e('0x64')],null))[_0xd91e('0x19')](respondWithResult(_0x595df9,null))[_0xd91e('0x23')](handleError(_0x595df9,null));};exports[_0xd91e('0x65')]=function(_0x16bee7,_0x5216fc){return db[_0xd91e('0x33')][_0xd91e('0x62')]({'where':{'id':_0x16bee7[_0xd91e('0x66')]['id']}})[_0xd91e('0x19')](handleEntityNotFound(_0x5216fc,null))[_0xd91e('0x19')](removeEntity(_0x5216fc,null))[_0xd91e('0x23')](handleError(_0x5216fc,null));};exports['describe']=function(_0x45cfcd,_0x1639b4){return db[_0xd91e('0x33')][_0xd91e('0x67')]()[_0xd91e('0x19')](respondWithResult(_0x1639b4,null))[_0xd91e('0x23')](handleError(_0x1639b4,null));};exports[_0xd91e('0x68')]=function(_0x224f0d,_0x34c3bb){if(_0x224f0d[_0xd91e('0x64')]['id']){delete _0x224f0d[_0xd91e('0x64')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x224f0d['params']['id']}})['then'](handleEntityNotFound(_0x34c3bb,null))[_0xd91e('0x19')](saveUpdates(_0x224f0d[_0xd91e('0x64')],null))['then'](respondWithResult(_0x34c3bb,null))[_0xd91e('0x23')](handleError(_0x34c3bb,null));};exports[_0xd91e('0x69')]=function(_0x520177,_0x3065a5,_0x21fe59){if(_0x520177['body']['id']){delete _0x520177[_0xd91e('0x64')]['id'];}return db[_0xd91e('0x33')][_0xd91e('0x62')]({'where':{'id':_0x520177['params']['id']}})[_0xd91e('0x19')](function(_0x36e781){if(!_0x36e781){logger['error'](_0xd91e('0x6a'),_0xd91e('0x69'),0x194,_0xd91e('0x6b'));_0x3065a5['sendStatus'](0x194);}else{if(_0x36e781[_0xd91e('0x6c')]){throw new db[(_0xd91e('0x6d'))][(_0xd91e('0x6e'))](_0xd91e('0x6f'));}}return _0x36e781;})[_0xd91e('0x19')](function(_0x9f059e){if(_0x9f059e){return _0x9f059e[_0xd91e('0x2d')]({'closed':_0x520177['body'][_0xd91e('0x70')],'closedAt':_0x520177[_0xd91e('0x64')][_0xd91e('0x71')],'disposition':_0x520177[_0xd91e('0x64')][_0xd91e('0x72')]})[_0xd91e('0x19')](function(_0x21c01d){return _0x21c01d;});}})[_0xd91e('0x19')](function(_0x2966c3){return respondWithRpcPromise(_0xd91e('0x73'),_0xd91e('0x69'),_0x520177[_0xd91e('0x64')],client9004);})[_0xd91e('0x19')](respondWithResult(_0x3065a5,null))[_0xd91e('0x23')](handleError(_0x3065a5,null));};exports[_0xd91e('0x74')]=function(_0x43a0bd,_0x4e4d89,_0x593673){_0x43a0bd[_0xd91e('0x64')]['name']=_0x43a0bd[_0xd91e('0x75')]['originalname'];_0x43a0bd['body']['basename']=_0x43a0bd['file'][_0xd91e('0x76')];_0x43a0bd[_0xd91e('0x64')][_0xd91e('0x77')]=_0x43a0bd[_0xd91e('0x75')][_0xd91e('0x78')];return db[_0xd91e('0x79')][_0xd91e('0x63')](_0x43a0bd[_0xd91e('0x64')])[_0xd91e('0x19')](respondWithResult(_0x4e4d89,0xc9))[_0xd91e('0x23')](handleError(_0x4e4d89,null));};exports['attachmentDownload']=function(_0x318774,_0x52637a,_0x52f7bd){return db[_0xd91e('0x33')][_0xd91e('0x7a')]({'where':{'id':_0x318774[_0xd91e('0x66')]['id']},'raw':!![]})[_0xd91e('0x19')](handleEntityNotFound(_0x52637a,null))[_0xd91e('0x19')](function(_0x49af2f){if(_0x49af2f){if(_0x49af2f[_0xd91e('0x70')]){return _0x52637a[_0xd91e('0x25')](0x193)[_0xd91e('0x26')]({'status':0x193,'message':_0xd91e('0x7b')});}return db[_0xd91e('0x79')]['findOne']({'where':{'id':_0x318774[_0xd91e('0x37')][_0xd91e('0x7c')]},'raw':!![]})[_0xd91e('0x19')](handleEntityNotFound(_0x52637a,null));}})[_0xd91e('0x19')](function(_0x5d6574){if(_0x5d6574){return _0x52637a[_0xd91e('0x7d')](path[_0xd91e('0x7e')](config['root'],_0xd91e('0x7f'),_0x5d6574[_0xd91e('0x80')]));}})['catch'](handleError(_0x52637a,null));};exports[_0xd91e('0x81')]=function(_0x1d0d19,_0x517ca6){var _0x45af64=null;var _0x4a425b=null;var _0x5a18a4=null;var _0x298bcc=null;if(_0x1d0d19[_0xd91e('0x64')]['id']){delete _0x1d0d19['body']['id'];}if(_0x1d0d19['body']['mailTranscript']){_0x298bcc=path[_0xd91e('0x7e')](config[_0xd91e('0x82')],_0xd91e('0x83'),util[_0xd91e('0x84')]('transcript-%s.txt',Date[_0xd91e('0x85')]()));_0x1d0d19[_0xd91e('0x64')][_0xd91e('0x86')]=_0x298bcc;}return db[_0xd91e('0x33')][_0xd91e('0x62')]({'where':{'id':_0x1d0d19[_0xd91e('0x66')]['id']},'include':[{'model':db[_0xd91e('0x5c')],'as':_0xd91e('0x87'),'include':[{'model':db[_0xd91e('0x54')],'as':_0xd91e('0x54')}]}]})['then'](handleEntityNotFound(_0x517ca6,null))[_0xd91e('0x19')](saveUpdates(_0x1d0d19[_0xd91e('0x64')],null))[_0xd91e('0x19')](function(_0x112e00){if(_0x112e00){_0x45af64=_0x112e00;return db[_0xd91e('0x5a')][_0xd91e('0x62')]({'where':{'id':_0x45af64[_0xd91e('0x88')]}});}})[_0xd91e('0x19')](function(_0xb1cc83){if(_0xb1cc83){_0x5a18a4=_0xb1cc83;return db[_0xd91e('0x55')][_0xd91e('0x62')]({'where':{'id':_0x45af64[_0xd91e('0x89')]}});}})[_0xd91e('0x19')](function(_0x158876){if(_0x158876){_0x4a425b=_0x158876;if(_0x298bcc){var _0x1b644a=null;for(var _0x42c4a4=0x1;_0x42c4a4<_0x45af64[_0xd91e('0x87')][_0xd91e('0x3e')];++_0x42c4a4){_0x1b644a=_0x45af64[_0xd91e('0x87')][_0x42c4a4];var _0x69ba71=_0x1b644a['UserId']?util[_0xd91e('0x84')]('%s%d',_0x5a18a4[_0xd91e('0x8a')],_0x1b644a[_0xd91e('0x6c')]):_0xd91e('0x8b');var _0x568f07=_0x1d0d19[_0xd91e('0x64')]['customer']||util[_0xd91e('0x84')](_0xd91e('0x8c'),_0xd91e('0x8d'),_0x1b644a['ContactId']);switch(_0x5a18a4[_0xd91e('0x8e')]){case'website_alias':_0x69ba71=_0x1b644a[_0xd91e('0x6c')]?util[_0xd91e('0x84')](_0xd91e('0x8c'),_0x5a18a4[_0xd91e('0x8a')],_0x1b644a[_0xd91e('0x6c')]):_0xd91e('0x8b');break;case'agent_alias':_0x69ba71=_0x1b644a[_0xd91e('0x6c')]?_0x1b644a[_0xd91e('0x54')][_0xd91e('0x8f')]||_0x1b644a[_0xd91e('0x54')][_0xd91e('0x58')]:_0xd91e('0x8b');break;case _0xd91e('0x90'):_0x69ba71=_0x1b644a[_0xd91e('0x6c')]?_0x1b644a[_0xd91e('0x54')][_0xd91e('0x58')]:'System';break;default:_0x69ba71=_0x1b644a[_0xd91e('0x6c')]?util[_0xd91e('0x84')]('%s%d',_0x5a18a4['agentAlias'],_0x1b644a[_0xd91e('0x6c')]):_0xd91e('0x8b');}var _0x3b44df=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1b644a['createdAt'])[_0xd91e('0x84')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1b644a[_0xd91e('0x51')]==='in'?_0x568f07:_0x69ba71,_0x1b644a['body']);if(!_0x1b644a[_0xd91e('0x91')]){fs['appendFileSync'](_0x298bcc,_0x3b44df);}}return db[_0xd91e('0x92')][_0xd91e('0x7a')]({'where':{'service':!![]},'include':[{'model':db[_0xd91e('0x93')],'as':'Smtp','raw':!![]}]});}}})['then'](function(_0x4a63b1){if(_0x4a63b1&&_0x4a63b1[_0xd91e('0x94')]&&_0x1d0d19[_0xd91e('0x64')]){var _0x297d76={'tls':{'rejectUnauthorized':![]}};if(_0x4a63b1[_0xd91e('0x94')]['service']){_0x297d76[_0xd91e('0x95')]=_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x95')];}else{_0x297d76['host']=_0x4a63b1[_0xd91e('0x94')]['host'];_0x297d76['port']=_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x96')];_0x297d76[_0xd91e('0x97')]=_0x4a63b1['Smtp'][_0xd91e('0x97')];}if(_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x98')]){_0x297d76[_0xd91e('0x99')]={'user':_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x9a')],'pass':_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x9b')]};}return respondWithRpcPromise(_0xd91e('0x9c'),_0xd91e('0x9d'),{'account':_0x297d76,'message':{'from':util['format'](_0xd91e('0x9e'),_0x4a63b1[_0xd91e('0x30')],_0x4a63b1[_0xd91e('0x9f')]||_0x4a63b1[_0xd91e('0x94')][_0xd91e('0x9a')]),'to':_0x1d0d19[_0xd91e('0x64')][_0xd91e('0xa0')],'subject':_0xd91e('0xa1'),'text':util[_0xd91e('0x84')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x1d0d19[_0xd91e('0x64')][_0xd91e('0xa0')]),'attachments':[{'path':_0x298bcc}]}})[_0xd91e('0x19')](function(){return _0x45af64;})[_0xd91e('0x23')](function(_0x584d4d){console[_0xd91e('0x20')](_0x584d4d);});}else{return _0x45af64;}})[_0xd91e('0x19')](respondWithStatusCode(_0x517ca6,0xc8))[_0xd91e('0x23')](handleError(_0x517ca6,null));};exports[_0xd91e('0xa2')]=function(_0x8445e5,_0x511282,_0x4ea9f7){return db['ChatMessage'][_0xd91e('0x62')]({'where':{'id':_0x8445e5[_0xd91e('0x66')]['id']}})[_0xd91e('0x19')](handleEntityNotFound(_0x511282,null))[_0xd91e('0x19')](function(_0x5e188c){if(_0x5e188c){return _0x5e188c['addMessage'](_0x8445e5['body'][_0xd91e('0xa3')],_[_0xd91e('0xa4')](_0x8445e5[_0xd91e('0x64')],[_0xd91e('0xa3'),'id'])||{});}})[_0xd91e('0x19')](respondWithResult(_0x511282,null))['catch'](handleError(_0x511282,null));};exports[_0xd91e('0xa5')]=function(_0x370d93,_0x57f50b,_0x2d69d0){var _0x7c0016={'raw':![],'where':{}};var _0x1f7427={};var _0x18cbe1={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xd91e('0x7a')]({'where':{'id':_0x370d93[_0xd91e('0x66')]['id']}})['then'](handleEntityNotFound(_0x57f50b,null))[_0xd91e('0x19')](function(_0x40ce97){if(_0x40ce97){_0x1f7427[_0xd91e('0x35')]=_['keys'](db[_0xd91e('0x5c')]['rawAttributes']);_0x1f7427[_0xd91e('0x37')]=_[_0xd91e('0x36')](_0x370d93[_0xd91e('0x37')]);_0x1f7427[_0xd91e('0x3a')]=_['intersection'](_0x1f7427[_0xd91e('0x35')],_0x1f7427[_0xd91e('0x37')]);_0x7c0016['attributes']=_[_0xd91e('0x3b')](_0x1f7427['model'],qs['fields'](_0x370d93[_0xd91e('0x37')][_0xd91e('0x3d')]));_0x7c0016[_0xd91e('0x3c')]=_0x7c0016[_0xd91e('0x3c')][_0xd91e('0x3e')]?_0x7c0016[_0xd91e('0x3c')]:_0x1f7427[_0xd91e('0x35')];if(!_0x370d93[_0xd91e('0x37')][_0xd91e('0x3f')](_0xd91e('0xa6'))){_0x7c0016[_0xd91e('0x40')]=qs[_0xd91e('0x40')](_0x370d93[_0xd91e('0x37')][_0xd91e('0x40')]);_0x7c0016['offset']=qs[_0xd91e('0x28')](_0x370d93[_0xd91e('0x37')]['offset']);}_0x7c0016['order']=qs[_0xd91e('0x42')](_0x370d93[_0xd91e('0x37')][_0xd91e('0x42')]);_0x7c0016[_0xd91e('0x43')]=qs['filters'](_[_0xd91e('0x44')](_0x370d93[_0xd91e('0x37')],_0x1f7427[_0xd91e('0x3a')]));_0x7c0016['where']['ChatInteractionId']=_0x40ce97['id'];if(_0x370d93[_0xd91e('0x37')]['filter']){_0x7c0016['where']=_['merge'](_0x7c0016['where'],{'$or':_[_0xd91e('0x48')](_0x7c0016[_0xd91e('0x3c')],function(_0x45c3a4){var _0xebdea7={};_0xebdea7[_0x45c3a4]={'$like':'%'+_0x370d93['query'][_0xd91e('0x49')]+'%'};return _0xebdea7;})});}if(_0x370d93[_0xd91e('0x37')]['$gte']){var _0xd44599=_0x370d93[_0xd91e('0x37')][_0xd91e('0xa7')]['split'](',');var _0x4f8b3a={};_0x4f8b3a[_0xd44599[0x0]]={'$gte':moment(_0xd44599[0x1])[_0xd91e('0x84')](_0xd91e('0xa8'))};_0x7c0016[_0xd91e('0x43')]=_['merge'](_0x7c0016[_0xd91e('0x43')],_0x4f8b3a);}_0x7c0016=_['merge']({},_0x7c0016,_0x370d93[_0xd91e('0x4a')]);return db[_0xd91e('0x5c')][_0xd91e('0x27')]({'where':_0x7c0016[_0xd91e('0x43')]})[_0xd91e('0x19')](function(_0x2c0a8b){_0x18cbe1['count']=_0x2c0a8b;if(_0x370d93[_0xd91e('0x37')][_0xd91e('0x53')]){_0x7c0016[_0xd91e('0x4b')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x7c0016);})[_0xd91e('0x19')](function(_0x46a0d3){_0x18cbe1['rows']=_0x46a0d3;return _0x18cbe1;});}})[_0xd91e('0x19')](respondWithFilteredResult(_0x57f50b,_0x7c0016))[_0xd91e('0x23')](handleError(_0x57f50b,null));};exports[_0xd91e('0xa9')]=function(_0xd13164,_0x457856,_0x948a57){var _0xd81100={'where':{}},_0x19213a={},_0x290036={'count':0x0,'rows':[]};return db[_0xd91e('0x33')]['findOne']({'where':{'id':_0xd13164[_0xd91e('0x66')]['id']}})[_0xd91e('0x19')](handleEntityNotFound(_0x457856,null))[_0xd91e('0x19')](function(_0x36e870){if(_0x36e870){_0x19213a[_0xd91e('0x35')]=_[_0xd91e('0x36')](db[_0xd91e('0x5c')][_0xd91e('0x34')]);_0x19213a[_0xd91e('0x37')]=_[_0xd91e('0x36')](_0xd13164[_0xd91e('0x37')]);_0x19213a['filters']=_[_0xd91e('0x3b')](_0x19213a[_0xd91e('0x35')],_0x19213a[_0xd91e('0x37')]);_0xd81100[_0xd91e('0x3c')]=_[_0xd91e('0x3b')](_0x19213a[_0xd91e('0x35')],qs[_0xd91e('0x3d')](_0xd13164[_0xd91e('0x37')][_0xd91e('0x3d')]));_0xd81100[_0xd91e('0x3c')]=_0xd81100['attributes'][_0xd91e('0x3e')]?_0xd81100[_0xd91e('0x3c')]:_0x19213a[_0xd91e('0x35')];if(!_0xd13164[_0xd91e('0x37')][_0xd91e('0x3f')](_0xd91e('0xa6'))){_0xd81100[_0xd91e('0x40')]=qs['limit'](_0xd13164[_0xd91e('0x37')][_0xd91e('0x40')]);_0xd81100[_0xd91e('0x28')]=qs[_0xd91e('0x28')](_0xd13164[_0xd91e('0x37')]['offset']);}_0xd81100[_0xd91e('0x41')]=qs[_0xd91e('0x42')](_0xd13164[_0xd91e('0x37')][_0xd91e('0x42')]);_0xd81100[_0xd91e('0x43')]=qs[_0xd91e('0x3a')](_[_0xd91e('0x44')](_0xd13164[_0xd91e('0x37')],_0x19213a[_0xd91e('0x3a')]));_0xd81100[_0xd91e('0x43')][_0xd91e('0xaa')]=_0x36e870['id'];if(_0xd13164[_0xd91e('0x37')]['filter']){_0xd81100[_0xd91e('0x43')]=_[_0xd91e('0x47')](_0xd81100[_0xd91e('0x43')],{'$or':_[_0xd91e('0x48')](_0xd81100[_0xd91e('0x3c')],function(_0x1a6c82){var _0x275e90={};_0x275e90[_0x1a6c82]={'$like':'%'+_0xd13164[_0xd91e('0x37')][_0xd91e('0x49')]+'%'};return _0x275e90;})});}_0xd81100[_0xd91e('0x43')][_0xd91e('0x91')]=![];if(_0xd13164[_0xd91e('0x37')]['id']){_0xd81100[_0xd91e('0x43')]['id']={'$gt':_0xd13164[_0xd91e('0x37')]['id']};}_0xd81100=_[_0xd91e('0x47')]({},_0xd81100,_0xd13164[_0xd91e('0x4a')]);return db[_0xd91e('0x5c')][_0xd91e('0x27')]({'where':_0xd81100['where']})[_0xd91e('0x19')](function(_0x3c54e9){_0x290036[_0xd91e('0x27')]=_0x3c54e9;_0xd81100[_0xd91e('0x4b')]=[];if(_0xd13164[_0xd91e('0x37')][_0xd91e('0xab')]){_0xd81100['include']['push']({'model':db[_0xd91e('0x54')],'as':_0xd91e('0x54'),'attributes':['id',_0xd91e('0x58'),_0xd91e('0x8f')]});}if(_0xd13164[_0xd91e('0x37')]['includeAll']){_0xd81100[_0xd91e('0x4b')]=[{'all':!![]}];}return db[_0xd91e('0x5c')][_0xd91e('0x5f')](_0xd81100);})[_0xd91e('0x19')](function(_0x4f1457){_0x290036['rows']=_0x4f1457;return _0x290036;});}})[_0xd91e('0x19')](respondWithFilteredResult(_0x457856,_0xd81100))[_0xd91e('0x23')](handleError(_0x457856,null));};exports[_0xd91e('0xac')]=function(_0x354bc6,_0x1f0d8e,_0xacb596){return db['ChatInteraction'][_0xd91e('0x62')]({'where':{'id':_0x354bc6[_0xd91e('0x66')]['id']}})['then'](handleEntityNotFound(_0x1f0d8e,null))[_0xd91e('0x19')](function(_0x5513e1){if(_0x5513e1){return _0x5513e1[_0xd91e('0xad')](_0x354bc6[_0xd91e('0x64')][_0xd91e('0xa3')],_[_0xd91e('0xa4')](_0x354bc6['body'],[_0xd91e('0xa3'),'id'])||{})[_0xd91e('0xae')](function(){return db['Tag']['findAll']({'attributes':['id',_0xd91e('0x30'),_0xd91e('0x5d')],'where':{'id':_0x354bc6[_0xd91e('0x64')][_0xd91e('0xa3')]}});})['then'](function(_0xa47da){socket['emit'](_0xd91e('0xaf'),{'id':Number(_0x354bc6[_0xd91e('0x66')]['id']),'tags':_0xa47da||[]});return{'id':Number(_0x354bc6[_0xd91e('0x66')]['id']),'tags':_0xa47da||[]};});}})[_0xd91e('0x19')](respondWithResult(_0x1f0d8e,null))[_0xd91e('0x23')](handleError(_0x1f0d8e,null));};exports['removeTags']=function(_0x16fb8d,_0x183e01,_0xe825da){var _0x590e77;return db['ChatInteraction']['find']({'where':{'id':_0x16fb8d['params']['id']}})[_0xd91e('0x19')](handleEntityNotFound(_0x183e01,null))[_0xd91e('0x19')](function(_0x208f70){if(_0x208f70){return _0x208f70['removeTags'](_0x16fb8d[_0xd91e('0x37')]['ids']);}})[_0xd91e('0x19')](respondWithStatusCode(_0x183e01,null))['catch'](handleError(_0x183e01,null));}; \ No newline at end of file +var _0x89b7=['code','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','sendStatus','name','index','ChatInteraction','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','where','filter','merge','options','include','tag','push','Tag','Tags','read','ChatMessage','direction','createdAt','distinct','includeAll','Users','fullname','CmContact','Contact','Owner','ChatWebsite','Account','key','color','ThroughTags','params','length','find','create','body','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','closedAt','disposition','AbandonInteraction','basename','file','filename','type','mimetype','attachmentDownload','findOne','Attachment','download','close','mailTranscript','join','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ContactId','format','%s%d','agentAlias','System','customer','Visitor','website_alias','agent_alias','alias','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','Smtp','service','host','port','secure','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','ChatInteractionId','map','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','getMyMessages','includeAgent','addTags','spread','emit','chatInteractionTags:save','removeTags','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x273e2c,_0x2acc61){var _0x11928d=function(_0x554b68){while(--_0x554b68){_0x273e2c['push'](_0x273e2c['shift']());}};_0x11928d(++_0x2acc61);}(_0x89b7,0x1dc));var _0x789b=function(_0x3f0189,_0x37da56){_0x3f0189=_0x3f0189-0x0;var _0x356d88=_0x89b7[_0x3f0189];return _0x356d88;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x789b('0x0'));var BPromise=require(_0x789b('0x1'));var Mustache=require(_0x789b('0x2'));var util=require(_0x789b('0x3'));var path=require(_0x789b('0x4'));var sox=require('sox');var csv=require(_0x789b('0x5'));var ejs=require(_0x789b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x789b('0x7'));var crypto=require(_0x789b('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x789b('0x5'));var querystring=require(_0x789b('0x9'));var Papa=require(_0x789b('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x789b('0xb'))('api');var utils=require(_0x789b('0xc'));var config=require(_0x789b('0xd'));var db=require(_0x789b('0xe'))['db'];var socket=require(_0x789b('0xf'))({'host':_0x789b('0x10'),'port':0x18eb});require('./chatInteraction.socket')[_0x789b('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x789b('0x12')][_0x789b('0x13')]({'port':0x232b});var client9004=jayson[_0x789b('0x12')][_0x789b('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x36f69a,_0x92d40,_0x27a130,_0x153882){return new BPromise(function(_0x3c681a,_0x31b2f9){var _0x4b8a65=_0x153882||client;return _0x4b8a65[_0x789b('0x14')](_0x36f69a,_0x27a130)[_0x789b('0x15')](function(_0x47cffb){logger[_0x789b('0x16')](_0x789b('0x17'),_0x92d40,_0x789b('0x18'));logger['debug'](_0x789b('0x19'),_0x92d40,_0x789b('0x18'),JSON[_0x789b('0x1a')](_0x47cffb));if(_0x47cffb[_0x789b('0x1b')]){if(_0x47cffb[_0x789b('0x1b')][_0x789b('0x1c')]===0x1f4){logger[_0x789b('0x1b')](_0x789b('0x17'),_0x92d40,_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);return _0x31b2f9(_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);}logger['error'](_0x789b('0x17'),_0x92d40,_0x47cffb[_0x789b('0x1b')][_0x789b('0x1d')]);return _0x3c681a(_0x47cffb['error'][_0x789b('0x1d')]);}else{logger[_0x789b('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x92d40,_0x789b('0x18'));_0x3c681a(_0x47cffb[_0x789b('0x1e')][_0x789b('0x1d')]);}})[_0x789b('0x1f')](function(_0x4ecfbc){logger[_0x789b('0x1b')](_0x789b('0x17'),_0x92d40,_0x4ecfbc);_0x31b2f9(_0x4ecfbc);});});}function respondWithStatusCode(_0x3fe83d,_0x912dfd){_0x912dfd=_0x912dfd||0xcc;return function(_0x1d9d9b){if(_0x1d9d9b){return _0x3fe83d['sendStatus'](_0x912dfd);}return _0x3fe83d[_0x789b('0x20')](_0x912dfd)[_0x789b('0x21')]();};}function respondWithResult(_0x46f55f,_0x3b4942){_0x3b4942=_0x3b4942||0xc8;return function(_0x2a6c1c){if(_0x2a6c1c){return _0x46f55f[_0x789b('0x20')](_0x3b4942)[_0x789b('0x22')](_0x2a6c1c);}};}function respondWithFilteredResult(_0x5d6d82,_0x10130b){return function(_0x14c402){if(_0x14c402){var _0xa94fa9=_0x14c402[_0x789b('0x23')],_0x5546f2=_0x10130b[_0x789b('0x24')],_0x5a96ab=_0x10130b['offset']+_0x10130b[_0x789b('0x25')],_0x281ad4;if(_0x5a96ab>=_0xa94fa9){_0x5a96ab=_0xa94fa9;_0x281ad4=0xc8;}else{_0x281ad4=0xce;}_0x5d6d82['status'](_0x281ad4);return _0x5d6d82[_0x789b('0x26')](_0x789b('0x27'),_0x5546f2+'-'+_0x5a96ab+'/'+_0xa94fa9)[_0x789b('0x22')](_0x14c402);}return null;};}function patchUpdates(_0x22ef57){return function(_0x5806ed){try{jsonpatch['apply'](_0x5806ed,_0x22ef57,!![]);}catch(_0x2e93c7){return BPromise[_0x789b('0x28')](_0x2e93c7);}return _0x5806ed[_0x789b('0x29')]();};}function saveUpdates(_0x1775d3,_0x3ad52d){return function(_0x20e94f){if(_0x20e94f){return _0x20e94f[_0x789b('0x2a')](_0x1775d3)[_0x789b('0x15')](function(_0x257b78){return _0x257b78;});}return null;};}function removeEntity(_0x47125d,_0x1411ad){return function(_0xc6f93d){if(_0xc6f93d){return _0xc6f93d['destroy']()['then'](function(){_0x47125d[_0x789b('0x20')](0xcc)[_0x789b('0x21')]();});}};}function handleEntityNotFound(_0x278b82,_0xdc1604){return function(_0x1e15eb){if(!_0x1e15eb){_0x278b82[_0x789b('0x2b')](0x194);}return _0x1e15eb;};}function handleError(_0x2414d4,_0x3d1284){_0x3d1284=_0x3d1284||0x1f4;return function(_0x5e5378){logger['error'](_0x5e5378['stack']);if(_0x5e5378[_0x789b('0x2c')]){delete _0x5e5378[_0x789b('0x2c')];}_0x2414d4[_0x789b('0x20')](_0x3d1284)['send'](_0x5e5378);};}exports[_0x789b('0x2d')]=function(_0x36f8b4,_0xe683){var _0x4c4ae7={},_0x2d43a8={},_0x3fd08c={'count':0x0,'rows':[]};var _0x5d757e=db[_0x789b('0x2e')][_0x789b('0x2f')];_0x2d43a8[_0x789b('0x30')]=_[_0x789b('0x31')](_0x5d757e);var _0x2beaa6={'dateStart':_0x36f8b4[_0x789b('0x32')][_0x789b('0x33')],'dateEnd':_0x36f8b4[_0x789b('0x32')]['dateEnd']};delete _0x36f8b4[_0x789b('0x32')][_0x789b('0x33')];delete _0x36f8b4[_0x789b('0x32')]['dateEnd'];_0x2d43a8[_0x789b('0x32')]=_[_0x789b('0x31')](_0x36f8b4[_0x789b('0x32')]);_0x2d43a8[_0x789b('0x34')]=_[_0x789b('0x35')](_0x2d43a8[_0x789b('0x30')],_0x2d43a8[_0x789b('0x32')]);_0x4c4ae7[_0x789b('0x36')]=_[_0x789b('0x35')](_0x2d43a8['model'],qs[_0x789b('0x37')](_0x36f8b4['query'][_0x789b('0x37')]));_0x4c4ae7[_0x789b('0x36')]=_0x4c4ae7[_0x789b('0x36')]['length']?_0x4c4ae7['attributes']:_0x2d43a8[_0x789b('0x30')];if(!_0x36f8b4['query'][_0x789b('0x38')](_0x789b('0x39'))){_0x4c4ae7['limit']=qs[_0x789b('0x25')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x25')]);_0x4c4ae7[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x24')]);}_0x4c4ae7[_0x789b('0x3a')]=qs[_0x789b('0x3b')](_0x36f8b4[_0x789b('0x32')][_0x789b('0x3b')]);_0x4c4ae7['where']=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x36f8b4[_0x789b('0x32')],_0x2d43a8[_0x789b('0x34')]));if(_0x2beaa6[_0x789b('0x33')]){if(_0x2beaa6[_0x789b('0x3d')]){_0x2beaa6[_0x789b('0x3d')]=moment(_0x2beaa6[_0x789b('0x3d')])[_0x789b('0x3e')](0x1,_0x789b('0x3f'));}else{_0x2beaa6[_0x789b('0x3d')]=moment(_0x2beaa6[_0x789b('0x33')])[_0x789b('0x3e')](0x1,'day');}_['merge'](_0x4c4ae7[_0x789b('0x40')],{'createdAt':{'$gte':_0x2beaa6[_0x789b('0x33')],'$lte':_0x2beaa6[_0x789b('0x3d')]}});}if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x41')]){_0x4c4ae7['where']=_[_0x789b('0x42')](_0x4c4ae7[_0x789b('0x40')],{'$or':_['map'](_0x4c4ae7[_0x789b('0x36')],function(_0x1fff89){var _0x1a0c3a={};_0x1a0c3a[_0x1fff89]={'$like':'%'+_0x36f8b4[_0x789b('0x32')][_0x789b('0x41')]+'%'};return _0x1a0c3a;})});}_0x4c4ae7=_[_0x789b('0x42')]({},_0x4c4ae7,_0x36f8b4[_0x789b('0x43')]);var _0x38cd54={'where':_0x4c4ae7[_0x789b('0x40')]};_0x38cd54[_0x789b('0x44')]=[];if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]){_0x38cd54[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x47')],'as':_0x789b('0x48'),'attributes':['id'],'where':{'id':_0x36f8b4['query'][_0x789b('0x45')]},'required':!![]});_0x38cd54['distinct']=!![];}if(_0x36f8b4['query'][_0x789b('0x49')]){_0x38cd54[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x4a')],'as':'Messages','attributes':['id',_0x789b('0x4b'),_0x789b('0x4c'),_0x789b('0x49')],'where':{'direction':'in','read':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},'required':!![]});_0x38cd54[_0x789b('0x4d')]=!![];}return db['ChatInteraction'][_0x789b('0x23')](_0x38cd54)['then'](function(_0x47634f){_0x3fd08c['count']=_0x47634f;if(_0x36f8b4[_0x789b('0x32')][_0x789b('0x4e')]){_0x4c4ae7[_0x789b('0x44')]=[{'model':db['User'],'as':_0x789b('0x4f'),'required':![],'attributes':['id','name',_0x789b('0x50')]},{'model':db[_0x789b('0x51')],'as':_0x789b('0x52'),'required':![]},{'model':db['User'],'as':_0x789b('0x53'),'attributes':[_0x789b('0x2c'),'fullname','internal'],'required':![]},{'model':db[_0x789b('0x54')],'as':_0x789b('0x55'),'attributes':[_0x789b('0x2c'),_0x789b('0x56')],'required':![]},{'model':db[_0x789b('0x4a')],'as':'Messages','attributes':['id',_0x789b('0x4b'),'createdAt',_0x789b('0x49')],'where':{'direction':'in','read':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x49')]||![]},{'model':db['Tag'],'as':_0x789b('0x48'),'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]?!![]:![]},{'model':db['Tag'],'as':_0x789b('0x58'),'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'through':_0x36f8b4[_0x789b('0x32')]['tag']?{'attributes':[],'where':{'TagId':_0x36f8b4['query'][_0x789b('0x45')]||undefined}}:{},'required':_0x36f8b4[_0x789b('0x32')][_0x789b('0x45')]?!![]:![]}];}return db[_0x789b('0x2e')]['findAll'](_0x4c4ae7);})[_0x789b('0x15')](function(_0x525821){_0x3fd08c['rows']=_0x525821;return _0x3fd08c;})[_0x789b('0x15')](respondWithFilteredResult(_0xe683,_0x4c4ae7))['catch'](handleError(_0xe683,null));};exports['show']=function(_0x563651,_0x2c06da){var _0x3c9687={'raw':![],'where':{'id':_0x563651[_0x789b('0x59')]['id']}},_0x3df417={};_0x3df417['model']=_[_0x789b('0x31')](db[_0x789b('0x2e')][_0x789b('0x2f')]);_0x3df417[_0x789b('0x32')]=_[_0x789b('0x31')](_0x563651[_0x789b('0x32')]);_0x3df417[_0x789b('0x34')]=_[_0x789b('0x35')](_0x3df417[_0x789b('0x30')],_0x3df417[_0x789b('0x32')]);_0x3c9687[_0x789b('0x36')]=_['intersection'](_0x3df417[_0x789b('0x30')],qs[_0x789b('0x37')](_0x563651['query']['fields']));_0x3c9687[_0x789b('0x36')]=_0x3c9687[_0x789b('0x36')][_0x789b('0x5a')]?_0x3c9687['attributes']:_0x3df417[_0x789b('0x30')];if(_0x563651[_0x789b('0x32')][_0x789b('0x4e')]){_0x3c9687[_0x789b('0x44')]=[{'all':!![]}];}_0x3c9687=_[_0x789b('0x42')]({},_0x3c9687,_0x563651[_0x789b('0x43')]);return db[_0x789b('0x2e')][_0x789b('0x5b')](_0x3c9687)[_0x789b('0x15')](handleEntityNotFound(_0x2c06da,null))[_0x789b('0x15')](respondWithResult(_0x2c06da,null))[_0x789b('0x1f')](handleError(_0x2c06da,null));};exports[_0x789b('0x5c')]=function(_0x1c90b9,_0x521bdf){return db[_0x789b('0x2e')][_0x789b('0x5c')](_0x1c90b9[_0x789b('0x5d')],{})[_0x789b('0x15')](respondWithResult(_0x521bdf,0xc9))[_0x789b('0x1f')](handleError(_0x521bdf,null));};exports[_0x789b('0x2a')]=function(_0x562330,_0x3a4c4a){if(_0x562330[_0x789b('0x5d')]['id']){delete _0x562330['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x562330[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x3a4c4a,null))[_0x789b('0x15')](saveUpdates(_0x562330[_0x789b('0x5d')],null))[_0x789b('0x15')](respondWithResult(_0x3a4c4a,null))[_0x789b('0x1f')](handleError(_0x3a4c4a,null));};exports['destroy']=function(_0x3ae521,_0x20e9a7){return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x3ae521['params']['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x20e9a7,null))[_0x789b('0x15')](removeEntity(_0x20e9a7,null))[_0x789b('0x1f')](handleError(_0x20e9a7,null));};exports['describe']=function(_0x31e2eb,_0x5ec6a5){return db[_0x789b('0x2e')][_0x789b('0x5e')]()[_0x789b('0x15')](respondWithResult(_0x5ec6a5,null))['catch'](handleError(_0x5ec6a5,null));};exports[_0x789b('0x5f')]=function(_0xc20b86,_0x39439b){if(_0xc20b86[_0x789b('0x5d')]['id']){delete _0xc20b86[_0x789b('0x5d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0xc20b86[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x39439b,null))[_0x789b('0x15')](saveUpdates(_0xc20b86[_0x789b('0x5d')],null))['then'](respondWithResult(_0x39439b,null))[_0x789b('0x1f')](handleError(_0x39439b,null));};exports[_0x789b('0x60')]=function(_0x132d7d,_0x125692,_0x505043){if(_0x132d7d[_0x789b('0x5d')]['id']){delete _0x132d7d[_0x789b('0x5d')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x132d7d['params']['id']}})[_0x789b('0x15')](function(_0x2bfaa2){if(!_0x2bfaa2){logger['error'](_0x789b('0x61'),_0x789b('0x60'),0x194,_0x789b('0x62'));_0x125692[_0x789b('0x2b')](0x194);}else{if(_0x2bfaa2[_0x789b('0x63')]){throw new db[(_0x789b('0x64'))][(_0x789b('0x65'))](_0x789b('0x66'));}}return _0x2bfaa2;})[_0x789b('0x15')](function(_0x529f2f){if(_0x529f2f){return _0x529f2f[_0x789b('0x2a')]({'closed':_0x132d7d['body'][_0x789b('0x67')],'closedAt':_0x132d7d[_0x789b('0x5d')][_0x789b('0x68')],'disposition':_0x132d7d[_0x789b('0x5d')][_0x789b('0x69')]})[_0x789b('0x15')](function(_0x2acb06){return _0x2acb06;});}})['then'](function(_0x3df0d7){return respondWithRpcPromise(_0x789b('0x6a'),_0x789b('0x60'),_0x132d7d[_0x789b('0x5d')],client9004);})[_0x789b('0x15')](respondWithResult(_0x125692,null))[_0x789b('0x1f')](handleError(_0x125692,null));};exports['attachmentUpload']=function(_0x15ccd3,_0x5ab6d0,_0x2153f7){_0x15ccd3[_0x789b('0x5d')][_0x789b('0x2c')]=_0x15ccd3['file']['originalname'];_0x15ccd3[_0x789b('0x5d')][_0x789b('0x6b')]=_0x15ccd3[_0x789b('0x6c')][_0x789b('0x6d')];_0x15ccd3[_0x789b('0x5d')][_0x789b('0x6e')]=_0x15ccd3[_0x789b('0x6c')][_0x789b('0x6f')];return db['Attachment']['create'](_0x15ccd3['body'])[_0x789b('0x15')](respondWithResult(_0x5ab6d0,0xc9))[_0x789b('0x1f')](handleError(_0x5ab6d0,null));};exports[_0x789b('0x70')]=function(_0x4f48cc,_0x4800c0,_0x4c45e4){return db[_0x789b('0x2e')][_0x789b('0x71')]({'where':{'id':_0x4f48cc[_0x789b('0x59')]['id']},'raw':!![]})[_0x789b('0x15')](handleEntityNotFound(_0x4800c0,null))[_0x789b('0x15')](function(_0x429a30){if(_0x429a30){if(_0x429a30[_0x789b('0x67')]){return _0x4800c0[_0x789b('0x20')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x789b('0x72')][_0x789b('0x71')]({'where':{'id':_0x4f48cc['query']['attachId']},'raw':!![]})[_0x789b('0x15')](handleEntityNotFound(_0x4800c0,null));}})[_0x789b('0x15')](function(_0x4a925e){if(_0x4a925e){return _0x4800c0[_0x789b('0x73')](path['join'](config['root'],'server/files/attachments/',_0x4a925e[_0x789b('0x6b')]));}})[_0x789b('0x1f')](handleError(_0x4800c0,null));};exports[_0x789b('0x74')]=function(_0x6bca5,_0x10e219){var _0x56cc11=null;var _0xefaea3=null;var _0x132022=null;var _0x2bba30=null;if(_0x6bca5[_0x789b('0x5d')]['id']){delete _0x6bca5[_0x789b('0x5d')]['id'];}if(_0x6bca5[_0x789b('0x5d')][_0x789b('0x75')]){_0x2bba30=path[_0x789b('0x76')](config['root'],_0x789b('0x77'),util['format'](_0x789b('0x78'),Date['now']()));_0x6bca5[_0x789b('0x5d')][_0x789b('0x79')]=_0x2bba30;}return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x6bca5[_0x789b('0x59')]['id']},'include':[{'model':db[_0x789b('0x4a')],'as':_0x789b('0x7a'),'include':[{'model':db['User'],'as':_0x789b('0x7b')}]}]})[_0x789b('0x15')](handleEntityNotFound(_0x10e219,null))[_0x789b('0x15')](saveUpdates(_0x6bca5[_0x789b('0x5d')],null))['then'](function(_0x2037f7){if(_0x2037f7){_0x56cc11=_0x2037f7;return db[_0x789b('0x54')][_0x789b('0x5b')]({'where':{'id':_0x56cc11['ChatWebsiteId']}});}})[_0x789b('0x15')](function(_0x4befdf){if(_0x4befdf){_0x132022=_0x4befdf;return db[_0x789b('0x51')][_0x789b('0x5b')]({'where':{'id':_0x56cc11[_0x789b('0x7c')]}});}})[_0x789b('0x15')](function(_0xfd49d5){if(_0xfd49d5){_0xefaea3=_0xfd49d5;if(_0x2bba30){var _0x146c0c=null;for(var _0x1d0bd9=0x1;_0x1d0bd9<_0x56cc11['Messages'][_0x789b('0x5a')];++_0x1d0bd9){_0x146c0c=_0x56cc11[_0x789b('0x7a')][_0x1d0bd9];var _0x41dae0=_0x146c0c[_0x789b('0x63')]?util[_0x789b('0x7d')](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c['UserId']):_0x789b('0x80');var _0x1b4d3d=_0x6bca5[_0x789b('0x5d')][_0x789b('0x81')]||util['format'](_0x789b('0x7e'),_0x789b('0x82'),_0x146c0c['ContactId']);switch(_0x132022['agentIdentifier']){case _0x789b('0x83'):_0x41dae0=_0x146c0c[_0x789b('0x63')]?util[_0x789b('0x7d')](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c[_0x789b('0x63')]):_0x789b('0x80');break;case _0x789b('0x84'):_0x41dae0=_0x146c0c[_0x789b('0x63')]?_0x146c0c[_0x789b('0x7b')][_0x789b('0x85')]||_0x146c0c[_0x789b('0x7b')][_0x789b('0x50')]:_0x789b('0x80');break;case'agent_fullname':_0x41dae0=_0x146c0c[_0x789b('0x63')]?_0x146c0c[_0x789b('0x7b')][_0x789b('0x50')]:_0x789b('0x80');break;default:_0x41dae0=_0x146c0c[_0x789b('0x63')]?util['format'](_0x789b('0x7e'),_0x132022[_0x789b('0x7f')],_0x146c0c[_0x789b('0x63')]):_0x789b('0x80');}var _0x1a4c3c=util['format'](_0x789b('0x86'),moment(_0x146c0c[_0x789b('0x4c')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x146c0c[_0x789b('0x4b')]==='in'?_0x1b4d3d:_0x41dae0,_0x146c0c['body']);if(!_0x146c0c[_0x789b('0x87')]){fs[_0x789b('0x88')](_0x2bba30,_0x1a4c3c);}}return db['MailAccount'][_0x789b('0x71')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x789b('0x89'),'raw':!![]}]});}}})[_0x789b('0x15')](function(_0x27a4cb){if(_0x27a4cb&&_0x27a4cb[_0x789b('0x89')]&&_0x6bca5[_0x789b('0x5d')]){var _0x154d2f={'tls':{'rejectUnauthorized':![]}};if(_0x27a4cb[_0x789b('0x89')][_0x789b('0x8a')]){_0x154d2f[_0x789b('0x8a')]=_0x27a4cb[_0x789b('0x89')][_0x789b('0x8a')];}else{_0x154d2f['host']=_0x27a4cb[_0x789b('0x89')][_0x789b('0x8b')];_0x154d2f[_0x789b('0x8c')]=_0x27a4cb[_0x789b('0x89')]['port'];_0x154d2f[_0x789b('0x8d')]=_0x27a4cb['Smtp'][_0x789b('0x8d')];}if(_0x27a4cb['Smtp']['authentication']){_0x154d2f[_0x789b('0x8e')]={'user':_0x27a4cb[_0x789b('0x89')][_0x789b('0x8f')],'pass':_0x27a4cb[_0x789b('0x89')][_0x789b('0x90')]};}return respondWithRpcPromise(_0x789b('0x91'),_0x789b('0x92'),{'account':_0x154d2f,'message':{'from':util[_0x789b('0x7d')](_0x789b('0x93'),_0x27a4cb['name'],_0x27a4cb[_0x789b('0x94')]||_0x27a4cb[_0x789b('0x89')][_0x789b('0x8f')]),'to':_0x6bca5[_0x789b('0x5d')][_0x789b('0x75')],'subject':_0x789b('0x95'),'text':util[_0x789b('0x7d')](_0x789b('0x96'),_0x6bca5[_0x789b('0x5d')]['mailTranscript']),'attachments':[{'path':_0x2bba30}]}})['then'](function(){return _0x56cc11;})[_0x789b('0x1f')](function(_0x21b5fb){console[_0x789b('0x1b')](_0x21b5fb);});}else{return _0x56cc11;}})['then'](respondWithStatusCode(_0x10e219,0xc8))[_0x789b('0x1f')](handleError(_0x10e219,null));};exports[_0x789b('0x97')]=function(_0x3e5b67,_0x55a230,_0x4c613e){return db['ChatMessage'][_0x789b('0x5b')]({'where':{'id':_0x3e5b67['params']['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x55a230,null))[_0x789b('0x15')](function(_0x15c856){if(_0x15c856){return _0x15c856[_0x789b('0x97')](_0x3e5b67[_0x789b('0x5d')][_0x789b('0x98')],_[_0x789b('0x99')](_0x3e5b67[_0x789b('0x5d')],['ids','id'])||{});}})[_0x789b('0x15')](respondWithResult(_0x55a230,null))[_0x789b('0x1f')](handleError(_0x55a230,null));};exports[_0x789b('0x9a')]=function(_0x18c7e9,_0x24d1ab,_0x41c001){var _0x57c167={'raw':![],'where':{}};var _0x3a14e4={};var _0x1d9ee4={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x789b('0x71')]({'where':{'id':_0x18c7e9[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x24d1ab,null))['then'](function(_0x33fa99){if(_0x33fa99){_0x3a14e4[_0x789b('0x30')]=_['keys'](db[_0x789b('0x4a')][_0x789b('0x2f')]);_0x3a14e4['query']=_[_0x789b('0x31')](_0x18c7e9[_0x789b('0x32')]);_0x3a14e4[_0x789b('0x34')]=_[_0x789b('0x35')](_0x3a14e4[_0x789b('0x30')],_0x3a14e4[_0x789b('0x32')]);_0x57c167[_0x789b('0x36')]=_[_0x789b('0x35')](_0x3a14e4[_0x789b('0x30')],qs[_0x789b('0x37')](_0x18c7e9[_0x789b('0x32')][_0x789b('0x37')]));_0x57c167['attributes']=_0x57c167['attributes'][_0x789b('0x5a')]?_0x57c167[_0x789b('0x36')]:_0x3a14e4['model'];if(!_0x18c7e9['query'][_0x789b('0x38')]('nolimit')){_0x57c167['limit']=qs[_0x789b('0x25')](_0x18c7e9[_0x789b('0x32')][_0x789b('0x25')]);_0x57c167[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x18c7e9[_0x789b('0x32')]['offset']);}_0x57c167['order']=qs[_0x789b('0x3b')](_0x18c7e9[_0x789b('0x32')]['sort']);_0x57c167[_0x789b('0x40')]=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x18c7e9[_0x789b('0x32')],_0x3a14e4[_0x789b('0x34')]));_0x57c167[_0x789b('0x40')][_0x789b('0x9b')]=_0x33fa99['id'];if(_0x18c7e9[_0x789b('0x32')][_0x789b('0x41')]){_0x57c167[_0x789b('0x40')]=_[_0x789b('0x42')](_0x57c167['where'],{'$or':_[_0x789b('0x9c')](_0x57c167[_0x789b('0x36')],function(_0x5a5abf){var _0x30a008={};_0x30a008[_0x5a5abf]={'$like':'%'+_0x18c7e9[_0x789b('0x32')]['filter']+'%'};return _0x30a008;})});}if(_0x18c7e9[_0x789b('0x32')][_0x789b('0x9d')]){var _0x4c122c=_0x18c7e9[_0x789b('0x32')][_0x789b('0x9d')]['split'](',');var _0xc18b60={};_0xc18b60[_0x4c122c[0x0]]={'$gte':moment(_0x4c122c[0x1])[_0x789b('0x7d')](_0x789b('0x9e'))};_0x57c167[_0x789b('0x40')]=_['merge'](_0x57c167['where'],_0xc18b60);}_0x57c167=_[_0x789b('0x42')]({},_0x57c167,_0x18c7e9[_0x789b('0x43')]);return db['ChatMessage'][_0x789b('0x23')]({'where':_0x57c167[_0x789b('0x40')]})['then'](function(_0x4e831e){_0x1d9ee4[_0x789b('0x23')]=_0x4e831e;if(_0x18c7e9['query'][_0x789b('0x4e')]){_0x57c167[_0x789b('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x789b('0x9f')](_0x57c167);})['then'](function(_0x4201b5){_0x1d9ee4[_0x789b('0xa0')]=_0x4201b5;return _0x1d9ee4;});}})['then'](respondWithFilteredResult(_0x24d1ab,_0x57c167))[_0x789b('0x1f')](handleError(_0x24d1ab,null));};exports[_0x789b('0xa1')]=function(_0x4d15d9,_0x20104b,_0x402d28){var _0x1926a9={'where':{}},_0x542635={},_0x56bd30={'count':0x0,'rows':[]};return db[_0x789b('0x2e')][_0x789b('0x71')]({'where':{'id':_0x4d15d9[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x20104b,null))[_0x789b('0x15')](function(_0x52e5bc){if(_0x52e5bc){_0x542635[_0x789b('0x30')]=_[_0x789b('0x31')](db[_0x789b('0x4a')][_0x789b('0x2f')]);_0x542635['query']=_[_0x789b('0x31')](_0x4d15d9['query']);_0x542635[_0x789b('0x34')]=_[_0x789b('0x35')](_0x542635['model'],_0x542635[_0x789b('0x32')]);_0x1926a9[_0x789b('0x36')]=_[_0x789b('0x35')](_0x542635[_0x789b('0x30')],qs[_0x789b('0x37')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x37')]));_0x1926a9[_0x789b('0x36')]=_0x1926a9[_0x789b('0x36')][_0x789b('0x5a')]?_0x1926a9[_0x789b('0x36')]:_0x542635[_0x789b('0x30')];if(!_0x4d15d9[_0x789b('0x32')][_0x789b('0x38')](_0x789b('0x39'))){_0x1926a9[_0x789b('0x25')]=qs[_0x789b('0x25')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x25')]);_0x1926a9[_0x789b('0x24')]=qs[_0x789b('0x24')](_0x4d15d9[_0x789b('0x32')][_0x789b('0x24')]);}_0x1926a9[_0x789b('0x3a')]=qs[_0x789b('0x3b')](_0x4d15d9['query'][_0x789b('0x3b')]);_0x1926a9['where']=qs[_0x789b('0x34')](_[_0x789b('0x3c')](_0x4d15d9[_0x789b('0x32')],_0x542635[_0x789b('0x34')]));_0x1926a9[_0x789b('0x40')]['ChatInteractionId']=_0x52e5bc['id'];if(_0x4d15d9['query'][_0x789b('0x41')]){_0x1926a9['where']=_['merge'](_0x1926a9[_0x789b('0x40')],{'$or':_['map'](_0x1926a9[_0x789b('0x36')],function(_0x57ecb5){var _0x535d35={};_0x535d35[_0x57ecb5]={'$like':'%'+_0x4d15d9[_0x789b('0x32')]['filter']+'%'};return _0x535d35;})});}_0x1926a9['where'][_0x789b('0x87')]=![];if(_0x4d15d9[_0x789b('0x32')]['id']){_0x1926a9['where']['id']={'$gt':_0x4d15d9[_0x789b('0x32')]['id']};}_0x1926a9=_['merge']({},_0x1926a9,_0x4d15d9['options']);return db['ChatMessage'][_0x789b('0x23')]({'where':_0x1926a9[_0x789b('0x40')]})[_0x789b('0x15')](function(_0x3e66ea){_0x56bd30['count']=_0x3e66ea;_0x1926a9[_0x789b('0x44')]=[];if(_0x4d15d9[_0x789b('0x32')][_0x789b('0xa2')]){_0x1926a9[_0x789b('0x44')][_0x789b('0x46')]({'model':db[_0x789b('0x7b')],'as':_0x789b('0x7b'),'attributes':['id',_0x789b('0x50'),_0x789b('0x85')]});}if(_0x4d15d9[_0x789b('0x32')][_0x789b('0x4e')]){_0x1926a9[_0x789b('0x44')]=[{'all':!![]}];}return db[_0x789b('0x4a')][_0x789b('0x9f')](_0x1926a9);})['then'](function(_0x1fd804){_0x56bd30['rows']=_0x1fd804;return _0x56bd30;});}})[_0x789b('0x15')](respondWithFilteredResult(_0x20104b,_0x1926a9))[_0x789b('0x1f')](handleError(_0x20104b,null));};exports[_0x789b('0xa3')]=function(_0x46b3d5,_0x386ee0,_0x2baea9){return db[_0x789b('0x2e')][_0x789b('0x5b')]({'where':{'id':_0x46b3d5[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x386ee0,null))[_0x789b('0x15')](function(_0x3f5b33){if(_0x3f5b33){return _0x3f5b33['setTags'](_0x46b3d5['body'][_0x789b('0x98')],_[_0x789b('0x99')](_0x46b3d5[_0x789b('0x5d')],['ids','id'])||{})[_0x789b('0xa4')](function(){return db[_0x789b('0x47')][_0x789b('0x9f')]({'attributes':['id',_0x789b('0x2c'),_0x789b('0x57')],'where':{'id':_0x46b3d5['body'][_0x789b('0x98')]}});})[_0x789b('0x15')](function(_0x5c2aa0){socket[_0x789b('0xa5')](_0x789b('0xa6'),{'id':Number(_0x46b3d5[_0x789b('0x59')]['id']),'tags':_0x5c2aa0||[]});return{'id':Number(_0x46b3d5[_0x789b('0x59')]['id']),'tags':_0x5c2aa0||[]};});}})['then'](respondWithResult(_0x386ee0,null))[_0x789b('0x1f')](handleError(_0x386ee0,null));};exports[_0x789b('0xa7')]=function(_0x1ccf7e,_0x59e14f,_0x390e37){var _0x204961;return db['ChatInteraction'][_0x789b('0x5b')]({'where':{'id':_0x1ccf7e[_0x789b('0x59')]['id']}})[_0x789b('0x15')](handleEntityNotFound(_0x59e14f,null))[_0x789b('0x15')](function(_0x5b9738){if(_0x5b9738){return _0x5b9738['removeTags'](_0x1ccf7e[_0x789b('0x32')][_0x789b('0x98')]);}})['then'](respondWithStatusCode(_0x59e14f,null))['catch'](handleError(_0x59e14f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 7b26a05..4024b83 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 _0x34c9=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a96ef,_0x5c1383){var _0x330714=function(_0x1bc221){while(--_0x1bc221){_0x4a96ef['push'](_0x4a96ef['shift']());}};_0x330714(++_0x5c1383);}(_0x34c9,0x17b));var _0x934c=function(_0x2ff8af,_0xd48e8){_0x2ff8af=_0x2ff8af-0x0;var _0x1d7758=_0x34c9[_0x2ff8af];return _0x1d7758;};'use strict';var EventEmitter=require(_0x934c('0x0'));var ChatInteraction=require(_0x934c('0x1'))['db']['ChatInteraction'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x934c('0x2')](0x0);var events={'afterCreate':_0x934c('0x3'),'afterUpdate':_0x934c('0x4'),'afterDestroy':_0x934c('0x5')};function emitEvent(_0x1b2382){return function(_0x180263,_0x33444f,_0x3a83f1){ChatInteractionEvents[_0x934c('0x6')](_0x1b2382+':'+_0x180263['id'],_0x180263);ChatInteractionEvents[_0x934c('0x6')](_0x1b2382,_0x180263);_0x3a83f1(null);};}for(var e in events){if(events[_0x934c('0x7')](e)){var event=events[e];ChatInteraction[_0x934c('0x8')](e,emitEvent(event));}}module[_0x934c('0x9')]=ChatInteractionEvents; \ No newline at end of file +var _0xd84e=['../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd84e,0x99));var _0xed84=function(_0x4a5062,_0x382922){_0x4a5062=_0x4a5062-0x0;var _0x39bd36=_0xd84e[_0x4a5062];return _0x39bd36;};'use strict';var EventEmitter=require(_0xed84('0x0'));var ChatInteraction=require(_0xed84('0x1'))['db'][_0xed84('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xed84('0x3')](0x0);var events={'afterCreate':_0xed84('0x4'),'afterUpdate':_0xed84('0x5'),'afterDestroy':_0xed84('0x6')};function emitEvent(_0x37a3fb){return function(_0x2c344c,_0x232331,_0x1fced9){ChatInteractionEvents[_0xed84('0x7')](_0x37a3fb+':'+_0x2c344c['id'],_0x2c344c);ChatInteractionEvents['emit'](_0x37a3fb,_0x2c344c);_0x1fced9(null);};}for(var e in events){if(events[_0xed84('0x8')](e)){var event=events[e];ChatInteraction[_0xed84('0x9')](e,emitEvent(event));}}module[_0xed84('0xa')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4be829c..c8da1c5 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 _0x8cc8=['moment','request-promise','./chatInteraction.attributes','chat_interactions','utf8mb4','util','../../config/logger'];(function(_0x36874c,_0x4f1e14){var _0x1e72d3=function(_0x25bf9e){while(--_0x25bf9e){_0x36874c['push'](_0x36874c['shift']());}};_0x1e72d3(++_0x4f1e14);}(_0x8cc8,0xec));var _0x88cc=function(_0x21d46d,_0x4b012b){_0x21d46d=_0x21d46d-0x0;var _0x2ba2a9=_0x8cc8[_0x21d46d];return _0x2ba2a9;};'use strict';var _=require('lodash');var util=require(_0x88cc('0x0'));var logger=require(_0x88cc('0x1'))('api');var moment=require(_0x88cc('0x2'));var BPromise=require('bluebird');var rp=require(_0x88cc('0x3'));var attributes=require(_0x88cc('0x4'));module['exports']=function(_0x40ed8b,_0x3a73e5){return _0x40ed8b['define']('ChatInteraction',attributes,{'tableName':_0x88cc('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x88cc('0x6'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9e8a=['./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x13be07,_0x53c0d4){var _0x73948=function(_0x428f45){while(--_0x428f45){_0x13be07['push'](_0x13be07['shift']());}};_0x73948(++_0x53c0d4);}(_0x9e8a,0x11b));var _0xa9e8=function(_0x1c195e,_0x48c703){_0x1c195e=_0x1c195e-0x0;var _0x1020c3=_0x9e8a[_0x1c195e];return _0x1020c3;};'use strict';var _=require(_0xa9e8('0x0'));var util=require('util');var logger=require(_0xa9e8('0x1'))(_0xa9e8('0x2'));var moment=require('moment');var BPromise=require(_0xa9e8('0x3'));var rp=require(_0xa9e8('0x4'));var attributes=require(_0xa9e8('0x5'));module[_0xa9e8('0x6')]=function(_0x35dfda,_0x5b32de){return _0x35dfda['define'](_0xa9e8('0x7'),attributes,{'tableName':_0xa9e8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 50dd51e..2a94c5e 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 _0xa9ea=['../../config/logger','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateChatInteraction','body','options','raw','limit','stringify','AddTagsToChatInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3d424b,_0x2dfd17){var _0x12b719=function(_0x337ed3){while(--_0x337ed3){_0x3d424b['push'](_0x3d424b['shift']());}};_0x12b719(++_0x2dfd17);}(_0xa9ea,0x12a));var _0xaa9e=function(_0x5890ed,_0x5eec7c){_0x5890ed=_0x5890ed-0x0;var _0x49ef9b=_0xa9ea[_0x5890ed];return _0x49ef9b;};'use strict';var _=require(_0xaa9e('0x0'));var util=require(_0xaa9e('0x1'));var moment=require(_0xaa9e('0x2'));var BPromise=require(_0xaa9e('0x3'));var rs=require(_0xaa9e('0x4'));var fs=require('fs');var db=require(_0xaa9e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa9e('0x6'))('rpc');var config=require(_0xaa9e('0x7'));var jayson=require(_0xaa9e('0x8'));var client=jayson['client'][_0xaa9e('0x9')]({'port':0x232a});var socket=require(_0xaa9e('0xa'))({'host':_0xaa9e('0xb'),'port':0x18eb});require('./chatInteraction.socket')[_0xaa9e('0xc')](socket);function respondWithRpcPromise(_0x2d7419,_0x189484,_0x398422){return new BPromise(function(_0x5dbcec,_0x1a0fb6){return client[_0xaa9e('0xd')](_0x2d7419,_0x398422)[_0xaa9e('0xe')](function(_0x8e9b5b){logger[_0xaa9e('0xf')](_0xaa9e('0x10'),_0x189484,_0xaa9e('0x11'));logger[_0xaa9e('0x12')](_0xaa9e('0x13'),_0x189484,_0xaa9e('0x11'),JSON['stringify'](_0x8e9b5b));if(_0x8e9b5b['error']){if(_0x8e9b5b[_0xaa9e('0x14')][_0xaa9e('0x15')]===0x1f4){logger[_0xaa9e('0x14')](_0xaa9e('0x10'),_0x189484,_0x8e9b5b['error']['message']);return _0x1a0fb6(_0x8e9b5b[_0xaa9e('0x14')][_0xaa9e('0x16')]);}logger[_0xaa9e('0x14')](_0xaa9e('0x10'),_0x189484,_0x8e9b5b['error'][_0xaa9e('0x16')]);return _0x5dbcec(_0x8e9b5b[_0xaa9e('0x14')][_0xaa9e('0x16')]);}else{logger[_0xaa9e('0xf')](_0xaa9e('0x10'),_0x189484,'request\x20sent');_0x5dbcec(_0x8e9b5b[_0xaa9e('0x17')][_0xaa9e('0x16')]);}})[_0xaa9e('0x18')](function(_0x2875ca){logger[_0xaa9e('0x14')](_0xaa9e('0x10'),_0x189484,_0x2875ca);_0x1a0fb6(_0x2875ca);});});}exports[_0xaa9e('0x19')]=function(_0x23a6c4){var _0x191e25=this;return new Promise(function(_0x52ce51,_0x252c9c){return db['ChatInteraction']['update'](_0x23a6c4[_0xaa9e('0x1a')],{'raw':_0x23a6c4[_0xaa9e('0x1b')]?_0x23a6c4[_0xaa9e('0x1b')][_0xaa9e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23a6c4[_0xaa9e('0x1b')]?_0x23a6c4[_0xaa9e('0x1b')]['where']||null:null,'attributes':_0x23a6c4[_0xaa9e('0x1b')]?_0x23a6c4[_0xaa9e('0x1b')]['attributes']||null:null,'limit':_0x23a6c4['options']?_0x23a6c4['options'][_0xaa9e('0x1d')]||null:null})[_0xaa9e('0xe')](function(_0x281f63){logger[_0xaa9e('0xf')](_0xaa9e('0x19'),_0x23a6c4);logger[_0xaa9e('0x12')](_0xaa9e('0x19'),_0x23a6c4,JSON[_0xaa9e('0x1e')](_0x281f63));_0x52ce51(_0x281f63);})[_0xaa9e('0x18')](function(_0x1ef9b0){logger[_0xaa9e('0x14')]('UpdateChatInteraction',_0x1ef9b0[_0xaa9e('0x16')],_0x23a6c4);_0x252c9c(_0x191e25['error'](0x1f4,_0x1ef9b0['message']));});});};exports[_0xaa9e('0x1f')]=function(_0x2d2b5c){return new Promise(function(_0x1c2db9,_0x81767e){return db['ChatInteraction']['find']({'where':_0x2d2b5c[_0xaa9e('0x1b')]?_0x2d2b5c['options'][_0xaa9e('0x20')]||null:null})[_0xaa9e('0xe')](function(_0x9ee03c){if(_0x9ee03c){return _0x9ee03c[_0xaa9e('0x21')](_0x2d2b5c['body'][_0xaa9e('0x22')],_[_0xaa9e('0x23')](_0x2d2b5c[_0xaa9e('0x1a')],[_0xaa9e('0x22'),'id'])||{});}})[_0xaa9e('0x24')](function(_0x1a8d70){logger[_0xaa9e('0xf')](_0xaa9e('0x25'),_0x2d2b5c);logger[_0xaa9e('0x12')](_0xaa9e('0x25'),_0x2d2b5c,JSON['stringify'](_0x1a8d70));_0x1c2db9(_0x1a8d70);})[_0xaa9e('0x18')](function(_0x17e028){logger['error'](_0xaa9e('0x25'),_0x17e028[_0xaa9e('0x16')],_0x2d2b5c);_0x81767e(_this[_0xaa9e('0x14')](0x1f4,_0x17e028[_0xaa9e('0x16')]));});});}; \ No newline at end of file +var _0x471e=['attributes','limit','stringify','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./chatInteraction.socket','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','ChatInteraction,\x20%s,\x20%s','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x471e,0x123));var _0xe471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe471('0x0'));var moment=require(_0xe471('0x1'));var BPromise=require(_0xe471('0x2'));var rs=require(_0xe471('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe471('0x4'));var config=require(_0xe471('0x5'));var jayson=require(_0xe471('0x6'));var client=jayson['client'][_0xe471('0x7')]({'port':0x232a});var socket=require(_0xe471('0x8'))({'host':_0xe471('0x9'),'port':0x18eb});require(_0xe471('0xa'))['register'](socket);function respondWithRpcPromise(_0x288efe,_0x59096e,_0x5c3cf6){return new BPromise(function(_0x3a7eb7,_0x47b4d5){return client[_0xe471('0xb')](_0x288efe,_0x5c3cf6)[_0xe471('0xc')](function(_0x19ebd2){logger[_0xe471('0xd')]('ChatInteraction,\x20%s,\x20%s',_0x59096e,_0xe471('0xe'));logger[_0xe471('0xf')](_0xe471('0x10'),_0x59096e,'request\x20sent',JSON['stringify'](_0x19ebd2));if(_0x19ebd2[_0xe471('0x11')]){if(_0x19ebd2['error'][_0xe471('0x12')]===0x1f4){logger['error'](_0xe471('0x13'),_0x59096e,_0x19ebd2[_0xe471('0x11')]['message']);return _0x47b4d5(_0x19ebd2[_0xe471('0x11')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x59096e,_0x19ebd2['error'][_0xe471('0x14')]);return _0x3a7eb7(_0x19ebd2['error'][_0xe471('0x14')]);}else{logger[_0xe471('0xd')](_0xe471('0x13'),_0x59096e,_0xe471('0xe'));_0x3a7eb7(_0x19ebd2[_0xe471('0x15')][_0xe471('0x14')]);}})[_0xe471('0x16')](function(_0x2183da){logger['error'](_0xe471('0x13'),_0x59096e,_0x2183da);_0x47b4d5(_0x2183da);});});}exports[_0xe471('0x17')]=function(_0x53bd4a){var _0x178691=this;return new Promise(function(_0x4ed6e5,_0x156cff){return db[_0xe471('0x18')][_0xe471('0x19')](_0x53bd4a[_0xe471('0x1a')],{'raw':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a[_0xe471('0x1b')][_0xe471('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53bd4a['options']?_0x53bd4a[_0xe471('0x1b')]['where']||null:null,'attributes':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a['options'][_0xe471('0x1d')]||null:null,'limit':_0x53bd4a[_0xe471('0x1b')]?_0x53bd4a['options'][_0xe471('0x1e')]||null:null})[_0xe471('0xc')](function(_0x5d1c08){logger[_0xe471('0xd')]('UpdateChatInteraction',_0x53bd4a);logger[_0xe471('0xf')]('UpdateChatInteraction',_0x53bd4a,JSON[_0xe471('0x1f')](_0x5d1c08));_0x4ed6e5(_0x5d1c08);})[_0xe471('0x16')](function(_0x33203f){logger['error'](_0xe471('0x17'),_0x33203f[_0xe471('0x14')],_0x53bd4a);_0x156cff(_0x178691[_0xe471('0x11')](0x1f4,_0x33203f['message']));});});};exports[_0xe471('0x20')]=function(_0x26d4a8){return new Promise(function(_0x309285,_0xa5ea2a){return db[_0xe471('0x18')][_0xe471('0x21')]({'where':_0x26d4a8['options']?_0x26d4a8[_0xe471('0x1b')][_0xe471('0x22')]||null:null})['then'](function(_0x3386c2){if(_0x3386c2){return _0x3386c2[_0xe471('0x23')](_0x26d4a8['body'][_0xe471('0x24')],_[_0xe471('0x25')](_0x26d4a8['body'],['ids','id'])||{});}})[_0xe471('0x26')](function(_0x5b1284){logger[_0xe471('0xd')](_0xe471('0x27'),_0x26d4a8);logger[_0xe471('0xf')](_0xe471('0x27'),_0x26d4a8,JSON[_0xe471('0x1f')](_0x5b1284));_0x309285(_0x5b1284);})['catch'](function(_0x548958){logger['error'](_0xe471('0x27'),_0x548958[_0xe471('0x14')],_0x26d4a8);_0xa5ea2a(_this['error'](0x1f4,_0x548958[_0xe471('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index a10ba3f..dd15218 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 _0x4485=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x4485,0x152));var _0x5448=function(_0x2673c1,_0x489c00){_0x2673c1=_0x2673c1-0x0;var _0x46bde=_0x4485[_0x2673c1];return _0x46bde;};'use strict';var ChatInteractionEvents=require(_0x5448('0x0'));var events=[_0x5448('0x1'),_0x5448('0x2'),_0x5448('0x3')];function createListener(_0x345857,_0x33b7b0){return function(_0xfb80b7){_0x33b7b0[_0x5448('0x4')](_0x345857,_0xfb80b7);};}function removeListener(_0xe4a3bc,_0xd2b0b5){return function(){ChatInteractionEvents[_0x5448('0x5')](_0xe4a3bc,_0xd2b0b5);};}exports['register']=function(_0x44878e){for(var _0x4240e7=0x0,_0x45104f=events[_0x5448('0x6')];_0x4240e7<_0x45104f;_0x4240e7++){var _0xd0db3a=events[_0x4240e7];var _0x4f811c=createListener(_0x5448('0x7')+_0xd0db3a,_0x44878e);ChatInteractionEvents['on'](_0xd0db3a,_0x4f811c);}}; \ No newline at end of file +var _0xe6c3=['update','removeListener','chatInteraction:','save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe6c3,0x8b));var _0x3e6c=function(_0x4adf43,_0x1a34ab){_0x4adf43=_0x4adf43-0x0;var _0x364d4f=_0xe6c3[_0x4adf43];return _0x364d4f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x3e6c('0x0'),'remove',_0x3e6c('0x1')];function createListener(_0x3550e2,_0x1dbc3){return function(_0x407cef){_0x1dbc3['emit'](_0x3550e2,_0x407cef);};}function removeListener(_0x4390a1,_0x52a978){return function(){ChatInteractionEvents[_0x3e6c('0x2')](_0x4390a1,_0x52a978);};}exports['register']=function(_0x5e7f18){for(var _0x192196=0x0,_0x579abd=events['length'];_0x192196<_0x579abd;_0x192196++){var _0x3be191=events[_0x192196];var _0x449305=createListener(_0x3e6c('0x3')+_0x3be191,_0x5e7f18);ChatInteractionEvents['on'](_0x3be191,_0x449305);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index adc4013..80706ea 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 _0x30eb=['addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete','chatinteraction:destroy','destroy','removeTags','multer','path','express','../../components/auth/service','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','/describe','describe','get','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','join','server/files/attachments/','now','originalname','replace','post','single','file','attachmentUpload'];(function(_0x8cc5f7,_0x256a50){var _0x9a3b87=function(_0x45419c){while(--_0x45419c){_0x8cc5f7['push'](_0x8cc5f7['shift']());}};_0x9a3b87(++_0x256a50);}(_0x30eb,0x67));var _0xb30e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x30eb[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb30e('0x0'));var util=require('util');var path=require(_0xb30e('0x1'));var express=require(_0xb30e('0x2'));var router=express['Router']();var auth=require(_0xb30e('0x3'));var interaction=require(_0xb30e('0x4'));var config=require('../../config/environment');var controller=require(_0xb30e('0x5'));router['get']('/',auth[_0xb30e('0x6')](),controller['index']);router['get'](_0xb30e('0x7'),auth[_0xb30e('0x6')](),controller[_0xb30e('0x8')]);router[_0xb30e('0x9')](_0xb30e('0xa'),auth[_0xb30e('0xb')](),controller['show']);router['get'](_0xb30e('0xc'),auth['isChatInteractionAuthorized'](),controller[_0xb30e('0xd')]);router[_0xb30e('0x9')](_0xb30e('0xe'),auth[_0xb30e('0x6')](),controller[_0xb30e('0xf')]);router['get'](_0xb30e('0x10'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['post']('/',auth[_0xb30e('0x6')](),controller['create']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d5a92,_0x1ca2a4,_0x38c208){_0x38c208(null,path[_0xb30e('0x11')](config['root'],_0xb30e('0x12')));},'filename':function(_0x324177,_0x48dc03,_0x36110e){_0x36110e(null,util['format']('%s-%s',Date[_0xb30e('0x13')](),_0x48dc03[_0xb30e('0x14')][_0xb30e('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xb30e('0x16')]('/:id/attachment_upload',upload[_0xb30e('0x17')](_0xb30e('0x18')),controller[_0xb30e('0x19')]);router[_0xb30e('0x16')](_0xb30e('0xe'),auth[_0xb30e('0xb')](),controller[_0xb30e('0x1a')]);router['post'](_0xb30e('0x1b'),auth[_0xb30e('0x6')](),interaction['tracked'](_0xb30e('0x1c'),_0xb30e('0x1d')),controller[_0xb30e('0x1e')]);router[_0xb30e('0x1f')]('/:id',auth['isAuthenticated'](),interaction[_0xb30e('0x20')](_0xb30e('0x1c'),_0xb30e('0x21')),controller[_0xb30e('0x22')]);router[_0xb30e('0x1f')](_0xb30e('0x23'),controller['customUpdate']);router[_0xb30e('0x1f')](_0xb30e('0x24'),auth['isChatInteractionAuthorized'](),controller[_0xb30e('0x25')]);router[_0xb30e('0x1f')](_0xb30e('0x26'),controller['close']);router[_0xb30e('0x27')](_0xb30e('0xa'),auth[_0xb30e('0x6')](),interaction[_0xb30e('0x20')]('chat',_0xb30e('0x28')),controller[_0xb30e('0x29')]);router['delete']('/:id/tags',auth[_0xb30e('0x6')](),controller[_0xb30e('0x2a')]);module['exports']=router; \ No newline at end of file +var _0x9327=['originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','diskStorage','join','root','server/files/attachments/','format','now'];(function(_0x33ebd4,_0x294358){var _0xad487a=function(_0x2ba19f){while(--_0x2ba19f){_0x33ebd4['push'](_0x33ebd4['shift']());}};_0xad487a(++_0x294358);}(_0x9327,0x17d));var _0x7932=function(_0x4d5514,_0x3c0460){_0x4d5514=_0x4d5514-0x0;var _0x4bf726=_0x9327[_0x4d5514];return _0x4bf726;};'use strict';var multer=require(_0x7932('0x0'));var util=require(_0x7932('0x1'));var path=require(_0x7932('0x2'));var express=require(_0x7932('0x3'));var router=express[_0x7932('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x7932('0x5'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0x7932('0x6')]('/',auth[_0x7932('0x7')](),controller['index']);router[_0x7932('0x6')]('/describe',auth[_0x7932('0x7')](),controller[_0x7932('0x8')]);router[_0x7932('0x6')](_0x7932('0x9'),auth[_0x7932('0xa')](),controller[_0x7932('0xb')]);router[_0x7932('0x6')]('/:id/attachment_download',auth[_0x7932('0xa')](),controller['attachmentDownload']);router[_0x7932('0x6')](_0x7932('0xc'),auth[_0x7932('0x7')](),controller[_0x7932('0xd')]);router[_0x7932('0x6')](_0x7932('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x7932('0xf')]);router[_0x7932('0x10')]('/',auth[_0x7932('0x7')](),controller[_0x7932('0x11')]);var upload=multer({'storage':multer[_0x7932('0x12')]({'destination':function(_0x3c2c06,_0x2eac88,_0x536296){_0x536296(null,path[_0x7932('0x13')](config[_0x7932('0x14')],_0x7932('0x15')));},'filename':function(_0x49a41a,_0x44bf57,_0x251c45){_0x251c45(null,util[_0x7932('0x16')]('%s-%s',Date[_0x7932('0x17')](),_0x44bf57[_0x7932('0x18')][_0x7932('0x19')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7932('0x10')]('/:id/attachment_upload',upload[_0x7932('0x1a')](_0x7932('0x1b')),controller[_0x7932('0x1c')]);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller[_0x7932('0x1d')]);router[_0x7932('0x10')](_0x7932('0x1e'),auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x21')),controller[_0x7932('0x22')]);router[_0x7932('0x23')](_0x7932('0x9'),auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x24')),controller[_0x7932('0x25')]);router[_0x7932('0x23')](_0x7932('0x26'),controller[_0x7932('0x27')]);router[_0x7932('0x23')](_0x7932('0x28'),auth[_0x7932('0xa')](),controller[_0x7932('0x29')]);router[_0x7932('0x23')](_0x7932('0x2a'),controller['close']);router['delete']('/:id',auth[_0x7932('0x7')](),interaction[_0x7932('0x1f')](_0x7932('0x20'),_0x7932('0x2b')),controller[_0x7932('0x2c')]);router['delete'](_0x7932('0x1e'),auth['isAuthenticated'](),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 cf910fb..22ad965 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 _0x82c4=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0xdeefbd,_0x9e1b3d){var _0x4ff63f=function(_0x4b51f9){while(--_0x4b51f9){_0xdeefbd['push'](_0xdeefbd['shift']());}};_0x4ff63f(++_0x9e1b3d);}(_0x82c4,0x1ca));var _0x482c=function(_0x298291,_0x140ada){_0x298291=_0x298291-0x0;var _0x563d83=_0x82c4[_0x298291];return _0x563d83;};'use strict';var Sequelize=require(_0x482c('0x0'));module[_0x482c('0x1')]={'body':{'type':Sequelize[_0x482c('0x2')](_0x482c('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x482c('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x482c('0x5')]}}; \ No newline at end of file +var _0xe785=['INTEGER','sequelize','exports','medium','BOOLEAN'];(function(_0x2833be,_0x37c058){var _0x3329f7=function(_0x48fa47){while(--_0x48fa47){_0x2833be['push'](_0x2833be['shift']());}};_0x3329f7(++_0x37c058);}(_0xe785,0x128));var _0x5e78=function(_0x2526bd,_0x751acd){_0x2526bd=_0x2526bd-0x0;var _0x5991a7=_0xe785[_0x2526bd];return _0x5991a7;};'use strict';var Sequelize=require(_0x5e78('0x0'));module[_0x5e78('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5e78('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5e78('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x5e78('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 2434fc6..13dabbb 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 _0x5144=['sort','where','pick','merge','filter','map','options','ChatInternalMessage','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','lastMessageAt','lastMessage','format','getUsers','User','admin','user','fullname','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','messages','push','FromId','ToId','read','-createdAt','all','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit'];(function(_0x3dcab,_0x58860f){var _0x517c6a=function(_0x1bcf1f){while(--_0x1bcf1f){_0x3dcab['push'](_0x3dcab['shift']());}};_0x517c6a(++_0x58860f);}(_0x5144,0xe2));var _0x4514=function(_0x3ab329,_0xa38d05){_0x3ab329=_0x3ab329-0x0;var _0x4a79c1=_0x5144[_0x3ab329];return _0x4a79c1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x4514('0x0'));var moment=require(_0x4514('0x1'));var BPromise=require(_0x4514('0x2'));var Mustache=require(_0x4514('0x3'));var util=require(_0x4514('0x4'));var path=require('path');var sox=require(_0x4514('0x5'));var csv=require('to-csv');var ejs=require(_0x4514('0x6'));var fs=require('fs');var _=require(_0x4514('0x7'));var squel=require(_0x4514('0x8'));var crypto=require('crypto');var jsforce=require(_0x4514('0x9'));var deskjs=require(_0x4514('0xa'));var toCsv=require(_0x4514('0xb'));var querystring=require(_0x4514('0xc'));var Papa=require(_0x4514('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x4514('0xe'));var utils=require(_0x4514('0xf'));var config=require(_0x4514('0x10'));var db=require(_0x4514('0x11'))['db'];var socket=require(_0x4514('0x12'))({'host':'localhost','port':0x18eb});require('./chatInternalMessage.socket')[_0x4514('0x13')](socket);function respondWithStatusCode(_0x158d40,_0xe7ce49){_0xe7ce49=_0xe7ce49||0xcc;return function(_0x369eee){if(_0x369eee){return _0x158d40[_0x4514('0x14')](_0xe7ce49);}return _0x158d40['status'](_0xe7ce49)[_0x4514('0x15')]();};}function respondWithResult(_0x4183ec,_0x2e0ccc){_0x2e0ccc=_0x2e0ccc||0xc8;return function(_0x51d9ed){if(_0x51d9ed){return _0x4183ec[_0x4514('0x16')](_0x2e0ccc)[_0x4514('0x17')](_0x51d9ed);}};}function respondWithFilteredResult(_0x496170,_0x1ff147){return function(_0x19b115){if(_0x19b115){var _0x1386d8=_0x19b115[_0x4514('0x18')],_0x5c3262=_0x1ff147[_0x4514('0x19')],_0x11919f=_0x1ff147[_0x4514('0x19')]+_0x1ff147[_0x4514('0x1a')],_0x47bc87;if(_0x11919f>=_0x1386d8){_0x11919f=_0x1386d8;_0x47bc87=0xc8;}else{_0x47bc87=0xce;}_0x496170[_0x4514('0x16')](_0x47bc87);return _0x496170[_0x4514('0x1b')](_0x4514('0x1c'),_0x5c3262+'-'+_0x11919f+'/'+_0x1386d8)[_0x4514('0x17')](_0x19b115);}return null;};}function patchUpdates(_0xf990e3){return function(_0x126fdc){try{jsonpatch[_0x4514('0x1d')](_0x126fdc,_0xf990e3,!![]);}catch(_0x127a14){return BPromise[_0x4514('0x1e')](_0x127a14);}return _0x126fdc['save']();};}function saveUpdates(_0x35c502,_0x16a3b3){return function(_0x2acc47){if(_0x2acc47){return _0x2acc47[_0x4514('0x1f')](_0x35c502)[_0x4514('0x20')](function(_0x1f367f){return _0x1f367f;});}return null;};}function removeEntity(_0x507d3a,_0x465f1d){return function(_0x4e9993){if(_0x4e9993){return _0x4e9993['destroy']()[_0x4514('0x20')](function(){_0x507d3a['status'](0xcc)[_0x4514('0x15')]();});}};}function handleEntityNotFound(_0x399460,_0x4c89b4){return function(_0x5ec4d8){if(!_0x5ec4d8){_0x399460['sendStatus'](0x194);}return _0x5ec4d8;};}function handleError(_0x519818,_0x4f3066){_0x4f3066=_0x4f3066||0x1f4;return function(_0x2bc1e3){logger[_0x4514('0x21')](_0x2bc1e3[_0x4514('0x22')]);if(_0x2bc1e3[_0x4514('0x23')]){delete _0x2bc1e3[_0x4514('0x23')];}_0x519818['status'](_0x4f3066)[_0x4514('0x24')](_0x2bc1e3);};}exports[_0x4514('0x25')]=function(_0x40cb6b,_0xea9665){var _0x4f90a4={},_0x1a4b9b={},_0xa02f87={'count':0x0,'rows':[]};var _0x43b40a=db['ChatInternalMessage'][_0x4514('0x26')];_0x1a4b9b[_0x4514('0x27')]=_[_0x4514('0x28')](_0x43b40a);var _0x643b0a={'dateStart':_0x40cb6b['query'][_0x4514('0x29')],'dateEnd':_0x40cb6b[_0x4514('0x2a')]['dateEnd']};delete _0x40cb6b[_0x4514('0x2a')][_0x4514('0x29')];delete _0x40cb6b[_0x4514('0x2a')][_0x4514('0x2b')];_0x1a4b9b[_0x4514('0x2a')]=_[_0x4514('0x28')](_0x40cb6b[_0x4514('0x2a')]);_0x1a4b9b[_0x4514('0x2c')]=_[_0x4514('0x2d')](_0x1a4b9b[_0x4514('0x27')],_0x1a4b9b[_0x4514('0x2a')]);_0x4f90a4[_0x4514('0x2e')]=_[_0x4514('0x2d')](_0x1a4b9b['model'],qs[_0x4514('0x2f')](_0x40cb6b[_0x4514('0x2a')][_0x4514('0x2f')]));_0x4f90a4[_0x4514('0x2e')]=_0x4f90a4[_0x4514('0x2e')]['length']?_0x4f90a4[_0x4514('0x2e')]:_0x1a4b9b['model'];if(!_0x40cb6b[_0x4514('0x2a')][_0x4514('0x30')](_0x4514('0x31'))){_0x4f90a4[_0x4514('0x1a')]=qs[_0x4514('0x1a')](_0x40cb6b[_0x4514('0x2a')][_0x4514('0x1a')]);_0x4f90a4[_0x4514('0x19')]=qs[_0x4514('0x19')](_0x40cb6b[_0x4514('0x2a')][_0x4514('0x19')]);}_0x4f90a4['order']=qs[_0x4514('0x32')](_0x40cb6b[_0x4514('0x2a')][_0x4514('0x32')]);_0x4f90a4[_0x4514('0x33')]=qs[_0x4514('0x2c')](_[_0x4514('0x34')](_0x40cb6b[_0x4514('0x2a')],_0x1a4b9b['filters']));if(_0x643b0a[_0x4514('0x29')]){if(_0x643b0a['dateEnd']){_0x643b0a['dateEnd']=moment(_0x643b0a[_0x4514('0x2b')])['add'](0x1,'day');}else{_0x643b0a[_0x4514('0x2b')]=moment(_0x643b0a[_0x4514('0x29')])['add'](0x1,'day');}_[_0x4514('0x35')](_0x4f90a4['where'],{'createdAt':{'$gte':_0x643b0a[_0x4514('0x29')],'$lte':_0x643b0a['dateEnd']}});}if(_0x40cb6b[_0x4514('0x2a')][_0x4514('0x36')]){_0x4f90a4[_0x4514('0x33')]=_[_0x4514('0x35')](_0x4f90a4[_0x4514('0x33')],{'$or':_[_0x4514('0x37')](_0x4f90a4[_0x4514('0x2e')],function(_0x171295){var _0x51fff0={};_0x51fff0[_0x171295]={'$like':'%'+_0x40cb6b[_0x4514('0x2a')][_0x4514('0x36')]+'%'};return _0x51fff0;})});}_0x4f90a4=_[_0x4514('0x35')]({},_0x4f90a4,_0x40cb6b[_0x4514('0x38')]);var _0x4374f8={'where':_0x4f90a4['where']};return db[_0x4514('0x39')][_0x4514('0x18')](_0x4374f8)[_0x4514('0x20')](function(_0x5cdfe3){_0xa02f87[_0x4514('0x18')]=_0x5cdfe3;if(_0x40cb6b[_0x4514('0x2a')]['includeAll']){_0x4f90a4[_0x4514('0x3a')]=[{'all':!![]}];}return db[_0x4514('0x39')][_0x4514('0x3b')](_0x4f90a4);})['then'](function(_0x12f36f){_0xa02f87[_0x4514('0x3c')]=_0x12f36f;return _0xa02f87;})[_0x4514('0x20')](respondWithFilteredResult(_0xea9665,_0x4f90a4))[_0x4514('0x3d')](handleError(_0xea9665,null));};exports[_0x4514('0x3e')]=function(_0x86fa9e,_0x4b7b93){var _0x1daba3={'raw':!![],'where':{'id':_0x86fa9e[_0x4514('0x3f')]['id']}},_0x58969a={};_0x58969a['model']=_['keys'](db[_0x4514('0x39')][_0x4514('0x26')]);_0x58969a[_0x4514('0x2a')]=_['keys'](_0x86fa9e[_0x4514('0x2a')]);_0x58969a[_0x4514('0x2c')]=_[_0x4514('0x2d')](_0x58969a[_0x4514('0x27')],_0x58969a['query']);_0x1daba3[_0x4514('0x2e')]=_[_0x4514('0x2d')](_0x58969a['model'],qs['fields'](_0x86fa9e[_0x4514('0x2a')][_0x4514('0x2f')]));_0x1daba3[_0x4514('0x2e')]=_0x1daba3[_0x4514('0x2e')][_0x4514('0x40')]?_0x1daba3[_0x4514('0x2e')]:_0x58969a['model'];if(_0x86fa9e[_0x4514('0x2a')][_0x4514('0x41')]){_0x1daba3[_0x4514('0x3a')]=[{'all':!![]}];}_0x1daba3=_[_0x4514('0x35')]({},_0x1daba3,_0x86fa9e[_0x4514('0x38')]);return db[_0x4514('0x39')][_0x4514('0x42')](_0x1daba3)['then'](handleEntityNotFound(_0x4b7b93,null))[_0x4514('0x20')](respondWithResult(_0x4b7b93,null))[_0x4514('0x3d')](handleError(_0x4b7b93,null));};exports[_0x4514('0x43')]=function(_0x5c3918,_0x3d221c){return db[_0x4514('0x39')][_0x4514('0x43')](_0x5c3918['body'],{})[_0x4514('0x20')](respondWithResult(_0x3d221c,0xc9))['catch'](handleError(_0x3d221c,null));};exports[_0x4514('0x1f')]=function(_0x1c8c5e,_0x156ddd){if(_0x1c8c5e[_0x4514('0x44')]['id']){delete _0x1c8c5e[_0x4514('0x44')]['id'];}return db[_0x4514('0x39')][_0x4514('0x42')]({'where':{'id':_0x1c8c5e[_0x4514('0x3f')]['id']}})['then'](handleEntityNotFound(_0x156ddd,null))[_0x4514('0x20')](saveUpdates(_0x1c8c5e[_0x4514('0x44')],null))[_0x4514('0x20')](respondWithResult(_0x156ddd,null))[_0x4514('0x3d')](handleError(_0x156ddd,null));};exports[_0x4514('0x45')]=function(_0x2a08ea,_0x188b57){return db['ChatInternalMessage'][_0x4514('0x42')]({'where':{'id':_0x2a08ea[_0x4514('0x3f')]['id']}})[_0x4514('0x20')](handleEntityNotFound(_0x188b57,null))[_0x4514('0x20')](removeEntity(_0x188b57,null))[_0x4514('0x3d')](handleError(_0x188b57,null));};exports[_0x4514('0x46')]=function(_0x58792c,_0xf3e0c8){return db[_0x4514('0x39')][_0x4514('0x46')]()[_0x4514('0x20')](respondWithResult(_0xf3e0c8,null))[_0x4514('0x3d')](handleError(_0xf3e0c8,null));};function wrapUser(_0x29d08c){return function(_0x33f363){var _0x15f9ba=_0x29d08c['get']({'plain':!![]});_0x15f9ba['messages']=[];if(_0x33f363){_0x15f9ba[_0x4514('0x47')]=_0x33f363['createdAt'];_0x15f9ba[_0x4514('0x48')]=_0x33f363;}else{_0x15f9ba['lastMessageAt']=moment(0x0)[_0x4514('0x49')]('YYYY-MM-DD\x20HH:mm:ss');_0x15f9ba['lastMessage']={};}return _0x15f9ba;};}exports[_0x4514('0x4a')]=function(_0x3f2173,_0x21161b,_0x6a9943){var _0x58b842=[];return db[_0x4514('0x4b')]['findAll']({'where':{'role':['agent',_0x4514('0x4c'),_0x4514('0x4d')]},'attributes':['id',_0x4514('0x4e'),'name','role',_0x4514('0x4f'),_0x4514('0x50'),'online',_0x4514('0x51'),_0x4514('0x52'),_0x4514('0x53')],'order':qs[_0x4514('0x32')](_0x4514('0x54')),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id',_0x4514('0x23'),'type'],'through':{'attributes':[]}}]})[_0x4514('0x20')](function(_0x475b0b){var _0x11b863=[];if(_0x475b0b){_0x58b842=_0x475b0b;for(var _0x1fa338=0x0;_0x1fa338<_0x475b0b['length'];_0x1fa338+=0x1){_0x58b842[_0x1fa338][_0x4514('0x55')]=[];_0x11b863[_0x4514('0x56')](db[_0x4514('0x39')][_0x4514('0x42')]({'where':{'FromId':[_0x3f2173[_0x4514('0x4d')]['id'],_0x475b0b[_0x1fa338]['id']],'ToId':[_0x3f2173[_0x4514('0x4d')]['id'],_0x475b0b[_0x1fa338]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x4514('0x57'),_0x4514('0x58'),_0x4514('0x59'),_0x4514('0x44')],'order':qs[_0x4514('0x32')](_0x4514('0x5a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4514('0x20')](wrapUser(_0x475b0b[_0x1fa338])));}return BPromise[_0x4514('0x5b')](_0x11b863);}return[];})[_0x4514('0x20')](function(_0x3b166e){return{'rows':_0x3b166e,'count':_0x3b166e[_0x4514('0x40')]};})['then'](respondWithResult(_0x21161b,null))[_0x4514('0x3d')](handleError(_0x21161b,null));}; \ No newline at end of file +var _0x8f18=['squel','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatInternalMessage.socket','sendStatus','status','end','count','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','index','ChatInternalMessage','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','day','add','merge','filter','options','includeAll','include','then','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','User','findAll','admin','user','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','push','FromId','ToId','read','-createdAt','all','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5b1c50,_0x56e694){var _0x2d379b=function(_0x981b9c){while(--_0x981b9c){_0x5b1c50['push'](_0x5b1c50['shift']());}};_0x2d379b(++_0x56e694);}(_0x8f18,0x1ea));var _0x88f1=function(_0x2ae07b,_0x40a146){_0x2ae07b=_0x2ae07b-0x0;var _0x18c21b=_0x8f18[_0x2ae07b];return _0x18c21b;};'use strict';var jsonpatch=require(_0x88f1('0x0'));var rp=require(_0x88f1('0x1'));var moment=require(_0x88f1('0x2'));var BPromise=require(_0x88f1('0x3'));var Mustache=require(_0x88f1('0x4'));var util=require(_0x88f1('0x5'));var path=require(_0x88f1('0x6'));var sox=require(_0x88f1('0x7'));var csv=require(_0x88f1('0x8'));var ejs=require(_0x88f1('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x88f1('0xa'));var crypto=require('crypto');var jsforce=require(_0x88f1('0xb'));var deskjs=require(_0x88f1('0xc'));var toCsv=require(_0x88f1('0x8'));var querystring=require('querystring');var Papa=require(_0x88f1('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x88f1('0xe'))(_0x88f1('0xf'));var utils=require(_0x88f1('0x10'));var config=require(_0x88f1('0x11'));var db=require(_0x88f1('0x12'))['db'];var socket=require(_0x88f1('0x13'))({'host':_0x88f1('0x14'),'port':0x18eb});require(_0x88f1('0x15'))['register'](socket);function respondWithStatusCode(_0x4ea73b,_0x188fdb){_0x188fdb=_0x188fdb||0xcc;return function(_0x2d022c){if(_0x2d022c){return _0x4ea73b[_0x88f1('0x16')](_0x188fdb);}return _0x4ea73b[_0x88f1('0x17')](_0x188fdb)[_0x88f1('0x18')]();};}function respondWithResult(_0x38fcff,_0x44a1b3){_0x44a1b3=_0x44a1b3||0xc8;return function(_0x2817c9){if(_0x2817c9){return _0x38fcff[_0x88f1('0x17')](_0x44a1b3)['json'](_0x2817c9);}};}function respondWithFilteredResult(_0xffb484,_0x350de3){return function(_0xe00421){if(_0xe00421){var _0x196eaf=_0xe00421[_0x88f1('0x19')],_0x1d300c=_0x350de3[_0x88f1('0x1a')],_0xc2f59c=_0x350de3['offset']+_0x350de3['limit'],_0x2765f6;if(_0xc2f59c>=_0x196eaf){_0xc2f59c=_0x196eaf;_0x2765f6=0xc8;}else{_0x2765f6=0xce;}_0xffb484['status'](_0x2765f6);return _0xffb484[_0x88f1('0x1b')](_0x88f1('0x1c'),_0x1d300c+'-'+_0xc2f59c+'/'+_0x196eaf)[_0x88f1('0x1d')](_0xe00421);}return null;};}function patchUpdates(_0x41975a){return function(_0x46a65e){try{jsonpatch['apply'](_0x46a65e,_0x41975a,!![]);}catch(_0x1d407c){return BPromise[_0x88f1('0x1e')](_0x1d407c);}return _0x46a65e[_0x88f1('0x1f')]();};}function saveUpdates(_0x58126f,_0x291d1d){return function(_0x39e460){if(_0x39e460){return _0x39e460[_0x88f1('0x20')](_0x58126f)['then'](function(_0x370a0d){return _0x370a0d;});}return null;};}function removeEntity(_0xa07c52,_0x3bc67d){return function(_0x49383f){if(_0x49383f){return _0x49383f[_0x88f1('0x21')]()['then'](function(){_0xa07c52[_0x88f1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241a73,_0x3273b3){return function(_0x299cc6){if(!_0x299cc6){_0x241a73[_0x88f1('0x16')](0x194);}return _0x299cc6;};}function handleError(_0xb932f5,_0x53bd9f){_0x53bd9f=_0x53bd9f||0x1f4;return function(_0x301536){logger['error'](_0x301536[_0x88f1('0x22')]);if(_0x301536[_0x88f1('0x23')]){delete _0x301536[_0x88f1('0x23')];}_0xb932f5[_0x88f1('0x17')](_0x53bd9f)['send'](_0x301536);};}exports[_0x88f1('0x24')]=function(_0x1c752d,_0x4cdc54){var _0x216347={},_0x17f6d3={},_0x2d5c11={'count':0x0,'rows':[]};var _0x27691a=db[_0x88f1('0x25')]['rawAttributes'];_0x17f6d3[_0x88f1('0x26')]=_[_0x88f1('0x27')](_0x27691a);var _0x38af02={'dateStart':_0x1c752d[_0x88f1('0x28')][_0x88f1('0x29')],'dateEnd':_0x1c752d['query'][_0x88f1('0x2a')]};delete _0x1c752d[_0x88f1('0x28')][_0x88f1('0x29')];delete _0x1c752d['query'][_0x88f1('0x2a')];_0x17f6d3[_0x88f1('0x28')]=_[_0x88f1('0x27')](_0x1c752d[_0x88f1('0x28')]);_0x17f6d3[_0x88f1('0x2b')]=_[_0x88f1('0x2c')](_0x17f6d3[_0x88f1('0x26')],_0x17f6d3['query']);_0x216347[_0x88f1('0x2d')]=_['intersection'](_0x17f6d3['model'],qs['fields'](_0x1c752d[_0x88f1('0x28')]['fields']));_0x216347[_0x88f1('0x2d')]=_0x216347[_0x88f1('0x2d')][_0x88f1('0x2e')]?_0x216347[_0x88f1('0x2d')]:_0x17f6d3[_0x88f1('0x26')];if(!_0x1c752d[_0x88f1('0x28')][_0x88f1('0x2f')](_0x88f1('0x30'))){_0x216347['limit']=qs[_0x88f1('0x31')](_0x1c752d[_0x88f1('0x28')]['limit']);_0x216347['offset']=qs[_0x88f1('0x1a')](_0x1c752d['query']['offset']);}_0x216347[_0x88f1('0x32')]=qs['sort'](_0x1c752d[_0x88f1('0x28')][_0x88f1('0x33')]);_0x216347[_0x88f1('0x34')]=qs[_0x88f1('0x2b')](_['pick'](_0x1c752d[_0x88f1('0x28')],_0x17f6d3[_0x88f1('0x2b')]));if(_0x38af02[_0x88f1('0x29')]){if(_0x38af02[_0x88f1('0x2a')]){_0x38af02[_0x88f1('0x2a')]=moment(_0x38af02[_0x88f1('0x2a')])['add'](0x1,_0x88f1('0x35'));}else{_0x38af02['dateEnd']=moment(_0x38af02[_0x88f1('0x29')])[_0x88f1('0x36')](0x1,'day');}_[_0x88f1('0x37')](_0x216347['where'],{'createdAt':{'$gte':_0x38af02[_0x88f1('0x29')],'$lte':_0x38af02[_0x88f1('0x2a')]}});}if(_0x1c752d[_0x88f1('0x28')][_0x88f1('0x38')]){_0x216347[_0x88f1('0x34')]=_[_0x88f1('0x37')](_0x216347[_0x88f1('0x34')],{'$or':_['map'](_0x216347[_0x88f1('0x2d')],function(_0x4b9c90){var _0xbc228d={};_0xbc228d[_0x4b9c90]={'$like':'%'+_0x1c752d[_0x88f1('0x28')]['filter']+'%'};return _0xbc228d;})});}_0x216347=_[_0x88f1('0x37')]({},_0x216347,_0x1c752d[_0x88f1('0x39')]);var _0x59bca8={'where':_0x216347[_0x88f1('0x34')]};return db[_0x88f1('0x25')][_0x88f1('0x19')](_0x59bca8)['then'](function(_0x27c61c){_0x2d5c11[_0x88f1('0x19')]=_0x27c61c;if(_0x1c752d[_0x88f1('0x28')][_0x88f1('0x3a')]){_0x216347[_0x88f1('0x3b')]=[{'all':!![]}];}return db[_0x88f1('0x25')]['findAll'](_0x216347);})[_0x88f1('0x3c')](function(_0x2c4f04){_0x2d5c11[_0x88f1('0x3d')]=_0x2c4f04;return _0x2d5c11;})[_0x88f1('0x3c')](respondWithFilteredResult(_0x4cdc54,_0x216347))[_0x88f1('0x3e')](handleError(_0x4cdc54,null));};exports[_0x88f1('0x3f')]=function(_0x114aab,_0x11dca5){var _0x324927={'raw':!![],'where':{'id':_0x114aab[_0x88f1('0x40')]['id']}},_0x44e42={};_0x44e42[_0x88f1('0x26')]=_[_0x88f1('0x27')](db[_0x88f1('0x25')][_0x88f1('0x41')]);_0x44e42['query']=_[_0x88f1('0x27')](_0x114aab[_0x88f1('0x28')]);_0x44e42['filters']=_[_0x88f1('0x2c')](_0x44e42[_0x88f1('0x26')],_0x44e42[_0x88f1('0x28')]);_0x324927[_0x88f1('0x2d')]=_['intersection'](_0x44e42['model'],qs[_0x88f1('0x42')](_0x114aab['query'][_0x88f1('0x42')]));_0x324927[_0x88f1('0x2d')]=_0x324927[_0x88f1('0x2d')]['length']?_0x324927[_0x88f1('0x2d')]:_0x44e42[_0x88f1('0x26')];if(_0x114aab[_0x88f1('0x28')]['includeAll']){_0x324927[_0x88f1('0x3b')]=[{'all':!![]}];}_0x324927=_[_0x88f1('0x37')]({},_0x324927,_0x114aab[_0x88f1('0x39')]);return db['ChatInternalMessage'][_0x88f1('0x43')](_0x324927)[_0x88f1('0x3c')](handleEntityNotFound(_0x11dca5,null))[_0x88f1('0x3c')](respondWithResult(_0x11dca5,null))[_0x88f1('0x3e')](handleError(_0x11dca5,null));};exports['create']=function(_0x3de0d8,_0x74c338){return db[_0x88f1('0x25')][_0x88f1('0x44')](_0x3de0d8[_0x88f1('0x45')],{})[_0x88f1('0x3c')](respondWithResult(_0x74c338,0xc9))[_0x88f1('0x3e')](handleError(_0x74c338,null));};exports[_0x88f1('0x20')]=function(_0x50878,_0x62c779){if(_0x50878[_0x88f1('0x45')]['id']){delete _0x50878[_0x88f1('0x45')]['id'];}return db['ChatInternalMessage'][_0x88f1('0x43')]({'where':{'id':_0x50878[_0x88f1('0x40')]['id']}})[_0x88f1('0x3c')](handleEntityNotFound(_0x62c779,null))[_0x88f1('0x3c')](saveUpdates(_0x50878[_0x88f1('0x45')],null))[_0x88f1('0x3c')](respondWithResult(_0x62c779,null))[_0x88f1('0x3e')](handleError(_0x62c779,null));};exports[_0x88f1('0x21')]=function(_0x890858,_0x35d308){return db['ChatInternalMessage'][_0x88f1('0x43')]({'where':{'id':_0x890858[_0x88f1('0x40')]['id']}})[_0x88f1('0x3c')](handleEntityNotFound(_0x35d308,null))[_0x88f1('0x3c')](removeEntity(_0x35d308,null))[_0x88f1('0x3e')](handleError(_0x35d308,null));};exports[_0x88f1('0x46')]=function(_0x6f1a09,_0x4a23eb){return db['ChatInternalMessage'][_0x88f1('0x46')]()[_0x88f1('0x3c')](respondWithResult(_0x4a23eb,null))[_0x88f1('0x3e')](handleError(_0x4a23eb,null));};function wrapUser(_0x56ae0c){return function(_0x4d9959){var _0x502098=_0x56ae0c[_0x88f1('0x47')]({'plain':!![]});_0x502098[_0x88f1('0x48')]=[];if(_0x4d9959){_0x502098[_0x88f1('0x49')]=_0x4d9959[_0x88f1('0x4a')];_0x502098[_0x88f1('0x4b')]=_0x4d9959;}else{_0x502098[_0x88f1('0x49')]=moment(0x0)[_0x88f1('0x4c')](_0x88f1('0x4d'));_0x502098['lastMessage']={};}return _0x502098;};}exports['getUsers']=function(_0xb2c1db,_0x1d330e,_0x309f6c){var _0x3ef75e=[];return db[_0x88f1('0x4e')][_0x88f1('0x4f')]({'where':{'role':['agent',_0x88f1('0x50'),_0x88f1('0x51')]},'attributes':['id',_0x88f1('0x52'),_0x88f1('0x23'),_0x88f1('0x53'),_0x88f1('0x54'),_0x88f1('0x55'),_0x88f1('0x56'),_0x88f1('0x57'),_0x88f1('0x58'),_0x88f1('0x59')],'order':qs['sort'](_0x88f1('0x5a')),'include':[{'model':db[_0x88f1('0x5b')],'as':_0x88f1('0x5c'),'attributes':['id',_0x88f1('0x23'),_0x88f1('0x5d')],'through':{'attributes':[]}}]})[_0x88f1('0x3c')](function(_0x2758c9){var _0xa2d326=[];if(_0x2758c9){_0x3ef75e=_0x2758c9;for(var _0x5035c2=0x0;_0x5035c2<_0x2758c9[_0x88f1('0x2e')];_0x5035c2+=0x1){_0x3ef75e[_0x5035c2][_0x88f1('0x48')]=[];_0xa2d326[_0x88f1('0x5e')](db[_0x88f1('0x25')][_0x88f1('0x43')]({'where':{'FromId':[_0xb2c1db[_0x88f1('0x51')]['id'],_0x2758c9[_0x5035c2]['id']],'ToId':[_0xb2c1db[_0x88f1('0x51')]['id'],_0x2758c9[_0x5035c2]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x88f1('0x5f'),_0x88f1('0x60'),_0x88f1('0x61'),_0x88f1('0x45')],'order':qs[_0x88f1('0x33')](_0x88f1('0x62')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x2758c9[_0x5035c2])));}return BPromise[_0x88f1('0x63')](_0xa2d326);}return[];})[_0x88f1('0x3c')](function(_0xfdfbaa){return{'rows':_0xfdfbaa,'count':_0xfdfbaa[_0x88f1('0x2e')]};})[_0x88f1('0x3c')](respondWithResult(_0x1d330e,null))['catch'](handleError(_0x1d330e,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index facb2c4..e42fac0 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 _0x14c5=['exports','../../mysqldb','ChatInternalMessage','setMaxListeners','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14c5,0x1b7));var _0x514c=function(_0x547fd3,_0x1329f7){_0x547fd3=_0x547fd3-0x0;var _0xbf543b=_0x14c5[_0x547fd3];return _0xbf543b;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x514c('0x0'))['db'][_0x514c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x514c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x486025){return function(_0x49e66d,_0x3a1271,_0x5befcc){ChatInternalMessageEvents[_0x514c('0x3')](_0x486025+':'+_0x49e66d['id'],_0x49e66d);ChatInternalMessageEvents[_0x514c('0x3')](_0x486025,_0x49e66d);_0x5befcc(null);};}for(var e in events){if(events[_0x514c('0x4')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x514c('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x300a=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners','emit'];(function(_0x349b00,_0x5b58c3){var _0x45744f=function(_0x3caf27){while(--_0x3caf27){_0x349b00['push'](_0x349b00['shift']());}};_0x45744f(++_0x5b58c3);}(_0x300a,0x143));var _0xa300=function(_0x3d474e,_0x431f54){_0x3d474e=_0x3d474e-0x0;var _0x30b3e3=_0x300a[_0x3d474e];return _0x30b3e3;};'use strict';var EventEmitter=require(_0xa300('0x0'));var ChatInternalMessage=require(_0xa300('0x1'))['db'][_0xa300('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xa300('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4211b4){return function(_0x331158,_0x49326b,_0x5a1144){ChatInternalMessageEvents[_0xa300('0x4')](_0x4211b4+':'+_0x331158['id'],_0x331158);ChatInternalMessageEvents[_0xa300('0x4')](_0x4211b4,_0x331158);_0x5a1144(null);};}for(var e in events){if(events[_0xa300('0x5')](e)){var event=events[e];ChatInternalMessage[_0xa300('0x6')](e,emitEvent(event));}}module[_0xa300('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index ddb060b..d03f71c 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 _0xea77=['moment','bluebird','request-promise','exports','define','ChatInternalMessage','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x454080,_0x1f6126){var _0x16c2ae=function(_0x5b2764){while(--_0x5b2764){_0x454080['push'](_0x454080['shift']());}};_0x16c2ae(++_0x1f6126);}(_0xea77,0x172));var _0x7ea7=function(_0x5cef8d,_0x273c5b){_0x5cef8d=_0x5cef8d-0x0;var _0x104599=_0xea77[_0x5cef8d];return _0x104599;};'use strict';var _=require(_0x7ea7('0x0'));var util=require(_0x7ea7('0x1'));var logger=require(_0x7ea7('0x2'))(_0x7ea7('0x3'));var moment=require(_0x7ea7('0x4'));var BPromise=require(_0x7ea7('0x5'));var rp=require(_0x7ea7('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x7ea7('0x7')]=function(_0x47b973,_0x2a814d){return _0x47b973[_0x7ea7('0x8')](_0x7ea7('0x9'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7ea7('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x16cc=['utf8mb4','util','api','moment','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x16cc,0xc9));var _0xc16c=function(_0x4bce5c,_0x2575c0){_0x4bce5c=_0x4bce5c-0x0;var _0x329c06=_0x16cc[_0x4bce5c];return _0x329c06;};'use strict';var _=require('lodash');var util=require(_0xc16c('0x0'));var logger=require('../../config/logger')(_0xc16c('0x1'));var moment=require(_0xc16c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./chatInternalMessage.attributes');module[_0xc16c('0x3')]=function(_0x3c96d4,_0x1b203b){return _0x3c96d4[_0xc16c('0x4')](_0xc16c('0x5'),attributes,{'tableName':_0xc16c('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc16c('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index eced918..fc4f84e 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 _0x885f=['register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x24bad5,_0x3fa945){var _0xd97436=function(_0x98f5d5){while(--_0x98f5d5){_0x24bad5['push'](_0x24bad5['shift']());}};_0xd97436(++_0x3fa945);}(_0x885f,0xe5));var _0xf885=function(_0x189b1d,_0x1df005){_0x189b1d=_0x189b1d-0x0;var _0x3d8ab0=_0x885f[_0x189b1d];return _0x3d8ab0;};'use strict';var _=require(_0xf885('0x0'));var util=require(_0xf885('0x1'));var moment=require(_0xf885('0x2'));var BPromise=require(_0xf885('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xf885('0x4'))['db'];var utils=require(_0xf885('0x5'));var logger=require(_0xf885('0x6'))(_0xf885('0x7'));var config=require(_0xf885('0x8'));var jayson=require(_0xf885('0x9'));var client=jayson[_0xf885('0xa')]['http']({'port':0x232a});var socket=require(_0xf885('0xb'))({'host':'localhost','port':0x18eb});require(_0xf885('0xc'))[_0xf885('0xd')](socket);function respondWithRpcPromise(_0x3edb50,_0x5ae834,_0x83c5c1){return new BPromise(function(_0x3c7b4b,_0x40851c){return client['request'](_0x3edb50,_0x83c5c1)[_0xf885('0xe')](function(_0x28da31){logger[_0xf885('0xf')](_0xf885('0x10'),_0x5ae834,'request\x20sent');logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5ae834,_0xf885('0x11'),JSON[_0xf885('0x12')](_0x28da31));if(_0x28da31[_0xf885('0x13')]){if(_0x28da31[_0xf885('0x13')][_0xf885('0x14')]===0x1f4){logger['error'](_0xf885('0x10'),_0x5ae834,_0x28da31[_0xf885('0x13')][_0xf885('0x15')]);return _0x40851c(_0x28da31[_0xf885('0x13')][_0xf885('0x15')]);}logger[_0xf885('0x13')](_0xf885('0x10'),_0x5ae834,_0x28da31[_0xf885('0x13')]['message']);return _0x3c7b4b(_0x28da31[_0xf885('0x13')]['message']);}else{logger[_0xf885('0xf')](_0xf885('0x10'),_0x5ae834,'request\x20sent');_0x3c7b4b(_0x28da31['result'][_0xf885('0x15')]);}})['catch'](function(_0x581126){logger[_0xf885('0x13')](_0xf885('0x10'),_0x5ae834,_0x581126);_0x40851c(_0x581126);});});} \ No newline at end of file +var _0xc19b=['info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','./chatInternalMessage.socket','register','request'];(function(_0x115bb1,_0x1d678a){var _0x86091f=function(_0x45bcaf){while(--_0x45bcaf){_0x115bb1['push'](_0x115bb1['shift']());}};_0x86091f(++_0x1d678a);}(_0xc19b,0x11c));var _0xbc19=function(_0x228641,_0x25d636){_0x228641=_0x228641-0x0;var _0x5d5d78=_0xc19b[_0x228641];return _0x5d5d78;};'use strict';var _=require(_0xbc19('0x0'));var util=require(_0xbc19('0x1'));var moment=require(_0xbc19('0x2'));var BPromise=require(_0xbc19('0x3'));var rs=require(_0xbc19('0x4'));var fs=require('fs');var db=require(_0xbc19('0x5'))['db'];var utils=require(_0xbc19('0x6'));var logger=require('../../config/logger')(_0xbc19('0x7'));var config=require(_0xbc19('0x8'));var jayson=require(_0xbc19('0x9'));var client=jayson[_0xbc19('0xa')][_0xbc19('0xb')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xbc19('0xc'),'port':0x18eb});require(_0xbc19('0xd'))[_0xbc19('0xe')](socket);function respondWithRpcPromise(_0x33fa52,_0x582818,_0x4e236e){return new BPromise(function(_0x25ea51,_0x39b6ca){return client[_0xbc19('0xf')](_0x33fa52,_0x4e236e)['then'](function(_0x267b0e){logger[_0xbc19('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x582818,_0xbc19('0x11'));logger[_0xbc19('0x12')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x582818,_0xbc19('0x11'),JSON[_0xbc19('0x13')](_0x267b0e));if(_0x267b0e['error']){if(_0x267b0e[_0xbc19('0x14')][_0xbc19('0x15')]===0x1f4){logger[_0xbc19('0x14')](_0xbc19('0x16'),_0x582818,_0x267b0e[_0xbc19('0x14')][_0xbc19('0x17')]);return _0x39b6ca(_0x267b0e['error'][_0xbc19('0x17')]);}logger[_0xbc19('0x14')](_0xbc19('0x16'),_0x582818,_0x267b0e['error'][_0xbc19('0x17')]);return _0x25ea51(_0x267b0e[_0xbc19('0x14')][_0xbc19('0x17')]);}else{logger[_0xbc19('0x10')](_0xbc19('0x16'),_0x582818,_0xbc19('0x11'));_0x25ea51(_0x267b0e['result'][_0xbc19('0x17')]);}})[_0xbc19('0x18')](function(_0x2a4587){logger['error'](_0xbc19('0x16'),_0x582818,_0x2a4587);_0x39b6ca(_0x2a4587);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 1a58830..69fd08d 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 _0xea16=['register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove','update','emit'];(function(_0x25badc,_0xf437fd){var _0x1eb093=function(_0x57b143){while(--_0x57b143){_0x25badc['push'](_0x25badc['shift']());}};_0x1eb093(++_0xf437fd);}(_0xea16,0xe3));var _0x6ea1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xea16[_0xbca1b1];return _0x4e1686;};'use strict';var ChatInternalMessageEvents=require(_0x6ea1('0x0'));var events=[_0x6ea1('0x1'),_0x6ea1('0x2'),_0x6ea1('0x3')];function createListener(_0x50276e,_0x3ab0a3){return function(_0x2977f5){_0x3ab0a3[_0x6ea1('0x4')](_0x50276e,_0x2977f5);};}function removeListener(_0x363b25,_0x54b896){return function(){ChatInternalMessageEvents['removeListener'](_0x363b25,_0x54b896);};}exports[_0x6ea1('0x5')]=function(_0x4e3c08){for(var _0x63b3b1=0x0,_0x17cd8d=events[_0x6ea1('0x6')];_0x63b3b1<_0x17cd8d;_0x63b3b1++){var _0x2c4257=events[_0x63b3b1];var _0x360c70=createListener(_0x6ea1('0x7')+_0x2c4257,_0x4e3c08);ChatInternalMessageEvents['on'](_0x2c4257,_0x360c70);}}; \ No newline at end of file +var _0xe654=['./chatInternalMessage.events','save','remove','update','removeListener','length'];(function(_0x594847,_0x47b321){var _0xd05d17=function(_0x1e8ece){while(--_0x1e8ece){_0x594847['push'](_0x594847['shift']());}};_0xd05d17(++_0x47b321);}(_0xe654,0x162));var _0x4e65=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xe654[_0x2dafbe];return _0x58a45a;};'use strict';var ChatInternalMessageEvents=require(_0x4e65('0x0'));var events=[_0x4e65('0x1'),_0x4e65('0x2'),_0x4e65('0x3')];function createListener(_0x3597e4,_0x1d9d8c){return function(_0x2e820e){_0x1d9d8c['emit'](_0x3597e4,_0x2e820e);};}function removeListener(_0x525a29,_0x20bdc3){return function(){ChatInternalMessageEvents[_0x4e65('0x4')](_0x525a29,_0x20bdc3);};}exports['register']=function(_0x2f6fc0){for(var _0x49b4b0=0x0,_0x37e973=events[_0x4e65('0x5')];_0x49b4b0<_0x37e973;_0x49b4b0++){var _0xbccbd5=events[_0x49b4b0];var _0x3b4000=createListener('chatInternalMessage:'+_0xbccbd5,_0x2f6fc0);ChatInternalMessageEvents['on'](_0xbccbd5,_0x3b4000);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a1b6685..870232d 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 _0xcb91=['index','/describe','get','/users','getUsers','show','post','create','/:id','update','delete','path','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated'];(function(_0x55edea,_0x8839bf){var _0x12f62d=function(_0x5e62be){while(--_0x5e62be){_0x55edea['push'](_0x55edea['shift']());}};_0x12f62d(++_0x8839bf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x587ba2,_0x42eb40){_0x587ba2=_0x587ba2-0x0;var _0x50ec73=_0xcb91[_0x587ba2];return _0x50ec73;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var express=require(_0x1cb9('0x1'));var router=express[_0x1cb9('0x2')]();var auth=require(_0x1cb9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1cb9('0x4'));var controller=require(_0x1cb9('0x5'));router['get']('/',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0x7')]);router['get'](_0x1cb9('0x8'),auth[_0x1cb9('0x6')](),controller['describe']);router[_0x1cb9('0x9')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['get']('/:id',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')]('/',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xe')]);router['put'](_0x1cb9('0xf'),controller[_0x1cb9('0x10')]);router[_0x1cb9('0x11')](_0x1cb9('0xf'),auth[_0x1cb9('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa9e0=['destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x685346,_0x3ef2e5){var _0x52e15b=function(_0x4435da){while(--_0x4435da){_0x685346['push'](_0x685346['shift']());}};_0x52e15b(++_0x3ef2e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/users',auth[_0x0a9e('0x7')](),controller['getUsers']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);router['put']('/:id',controller['update']);router['delete'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xf')]);module[_0x0a9e('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 41c7c95..14129b1 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 _0xb70a=['out','sequelize','TEXT','BOOLEAN','ENUM'];(function(_0x5d44ed,_0x3ff59b){var _0x124871=function(_0xc9be4c){while(--_0xc9be4c){_0x5d44ed['push'](_0x5d44ed['shift']());}};_0x124871(++_0x3ff59b);}(_0xb70a,0x155));var _0xab70=function(_0x3b7124,_0x5380d4){_0x3b7124=_0x3b7124-0x0;var _0x3ce5f6=_0xb70a[_0x3b7124];return _0x3ce5f6;};'use strict';var Sequelize=require(_0xab70('0x0'));module['exports']={'body':{'type':Sequelize[_0xab70('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xab70('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xab70('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab70('0x3')]('in',_0xab70('0x4')),'defaultValue':_0xab70('0x4'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xfb81=['DATE','sequelize','TEXT','medium','ENUM','out'];(function(_0x437aa2,_0x48d508){var _0x28ac4d=function(_0x4afc37){while(--_0x4afc37){_0x437aa2['push'](_0x437aa2['shift']());}};_0x28ac4d(++_0x48d508);}(_0xfb81,0x1f3));var _0x1fb8=function(_0x1214e4,_0x1cb35c){_0x1214e4=_0x1214e4-0x0;var _0x1250f6=_0xfb81[_0x1214e4];return _0x1250f6;};'use strict';var Sequelize=require(_0x1fb8('0x0'));module['exports']={'body':{'type':Sequelize[_0x1fb8('0x1')](_0x1fb8('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x1fb8('0x3')]('in',_0x1fb8('0x4')),'defaultValue':_0x1fb8('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x1fb8('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 08a6891..a2a951f 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 _0xc771=['params','options','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','parse','formData','agent','RejectMessage','SIP/%s','reject','rejectmessage','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','count','offset','set','save','update','end','stack','name','send','index','ChatMessage','rawAttributes','model','keys','dateEnd','dateStart','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','add','day','merge','where','filter','map','includeAll','include','findAll','rows'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc771,0x110));var _0x1c77=function(_0x57e739,_0x22d3e1){_0x57e739=_0x57e739-0x0;var _0x381ac1=_0xc771[_0x57e739];return _0x381ac1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c77('0x0'));var BPromise=require('bluebird');var Mustache=require(_0x1c77('0x1'));var util=require(_0x1c77('0x2'));var path=require('path');var sox=require(_0x1c77('0x3'));var csv=require(_0x1c77('0x4'));var ejs=require(_0x1c77('0x5'));var fs=require('fs');var _=require(_0x1c77('0x6'));var squel=require(_0x1c77('0x7'));var crypto=require(_0x1c77('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x1c77('0x9'));var toCsv=require('to-csv');var querystring=require(_0x1c77('0xa'));var Papa=require(_0x1c77('0xb'));var qs=require(_0x1c77('0xc'));var logger=require('../../config/logger')('api');var utils=require(_0x1c77('0xd'));var config=require('../../config/environment');var db=require(_0x1c77('0xe'))['db'];var socket=require(_0x1c77('0xf'))({'host':_0x1c77('0x10'),'port':0x18eb});require(_0x1c77('0x11'))[_0x1c77('0x12')](socket);var jayson=require(_0x1c77('0x13'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x1c77('0x14')][_0x1c77('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x173a5e,_0x4efbfe,_0x5cf1b4,_0x2a804f){return new BPromise(function(_0x196f7e,_0x175c7b){var _0x455ec5=_0x2a804f||client;return _0x455ec5[_0x1c77('0x16')](_0x173a5e,_0x5cf1b4)[_0x1c77('0x17')](function(_0xafd330){logger[_0x1c77('0x18')]('ChatMessage,\x20%s,\x20%s',_0x4efbfe,_0x1c77('0x19'));logger[_0x1c77('0x1a')](_0x1c77('0x1b'),_0x4efbfe,'request\x20sent',JSON[_0x1c77('0x1c')](_0xafd330));if(_0xafd330[_0x1c77('0x1d')]){if(_0xafd330[_0x1c77('0x1d')]['code']===0x1f4){logger[_0x1c77('0x1d')](_0x1c77('0x1e'),_0x4efbfe,_0xafd330['error'][_0x1c77('0x1f')]);return _0x175c7b(_0xafd330[_0x1c77('0x1d')]['message']);}logger['error'](_0x1c77('0x1e'),_0x4efbfe,_0xafd330['error']['message']);return _0x196f7e(_0xafd330[_0x1c77('0x1d')][_0x1c77('0x1f')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x4efbfe,_0x1c77('0x19'));_0x196f7e(_0xafd330[_0x1c77('0x20')][_0x1c77('0x1f')]);}})[_0x1c77('0x21')](function(_0x49b222){logger[_0x1c77('0x1d')](_0x1c77('0x1e'),_0x4efbfe,_0x49b222);_0x175c7b(_0x49b222);});});}function respondWithStatusCode(_0x2d84ec,_0x59ae9b){_0x59ae9b=_0x59ae9b||0xcc;return function(_0xfac2fc){if(_0xfac2fc){return _0x2d84ec[_0x1c77('0x22')](_0x59ae9b);}return _0x2d84ec[_0x1c77('0x23')](_0x59ae9b)['end']();};}function respondWithResult(_0x2aa5e1,_0x5881f7){_0x5881f7=_0x5881f7||0xc8;return function(_0x49a1ea){if(_0x49a1ea){return _0x2aa5e1[_0x1c77('0x23')](_0x5881f7)[_0x1c77('0x24')](_0x49a1ea);}};}function respondWithFilteredResult(_0x3cd611,_0x2fd850){return function(_0x11dff6){if(_0x11dff6){var _0x6811c0=_0x11dff6[_0x1c77('0x25')],_0x17815d=_0x2fd850[_0x1c77('0x26')],_0x58bdcb=_0x2fd850[_0x1c77('0x26')]+_0x2fd850['limit'],_0x4ca857;if(_0x58bdcb>=_0x6811c0){_0x58bdcb=_0x6811c0;_0x4ca857=0xc8;}else{_0x4ca857=0xce;}_0x3cd611[_0x1c77('0x23')](_0x4ca857);return _0x3cd611[_0x1c77('0x27')]('Content-Range',_0x17815d+'-'+_0x58bdcb+'/'+_0x6811c0)['json'](_0x11dff6);}return null;};}function patchUpdates(_0x13856a){return function(_0xcc348d){try{jsonpatch['apply'](_0xcc348d,_0x13856a,!![]);}catch(_0x424d72){return BPromise['reject'](_0x424d72);}return _0xcc348d[_0x1c77('0x28')]();};}function saveUpdates(_0x388060,_0x252076){return function(_0x472e5f){if(_0x472e5f){return _0x472e5f[_0x1c77('0x29')](_0x388060)[_0x1c77('0x17')](function(_0x5d362a){return _0x5d362a;});}return null;};}function removeEntity(_0x364ec8,_0x599cf4){return function(_0x4933a5){if(_0x4933a5){return _0x4933a5['destroy']()[_0x1c77('0x17')](function(){_0x364ec8[_0x1c77('0x23')](0xcc)[_0x1c77('0x2a')]();});}};}function handleEntityNotFound(_0x346778,_0x5b578d){return function(_0x3d63d9){if(!_0x3d63d9){_0x346778[_0x1c77('0x22')](0x194);}return _0x3d63d9;};}function handleError(_0x5bb61f,_0x21bf50){_0x21bf50=_0x21bf50||0x1f4;return function(_0x4b939f){logger[_0x1c77('0x1d')](_0x4b939f[_0x1c77('0x2b')]);if(_0x4b939f[_0x1c77('0x2c')]){delete _0x4b939f[_0x1c77('0x2c')];}_0x5bb61f[_0x1c77('0x23')](_0x21bf50)[_0x1c77('0x2d')](_0x4b939f);};}exports[_0x1c77('0x2e')]=function(_0x440727,_0x26f94e){var _0x246ebf={},_0x46a385={},_0x93a889={'count':0x0,'rows':[]};var _0x26f244=db[_0x1c77('0x2f')][_0x1c77('0x30')];_0x46a385[_0x1c77('0x31')]=_[_0x1c77('0x32')](_0x26f244);var _0x29245b={'dateStart':_0x440727['query']['dateStart'],'dateEnd':_0x440727['query'][_0x1c77('0x33')]};delete _0x440727['query'][_0x1c77('0x34')];delete _0x440727[_0x1c77('0x35')][_0x1c77('0x33')];_0x46a385['query']=_['keys'](_0x440727[_0x1c77('0x35')]);_0x46a385[_0x1c77('0x36')]=_['intersection'](_0x46a385['model'],_0x46a385[_0x1c77('0x35')]);_0x246ebf[_0x1c77('0x37')]=_[_0x1c77('0x38')](_0x46a385[_0x1c77('0x31')],qs['fields'](_0x440727['query'][_0x1c77('0x39')]));_0x246ebf[_0x1c77('0x37')]=_0x246ebf[_0x1c77('0x37')]['length']?_0x246ebf[_0x1c77('0x37')]:_0x46a385[_0x1c77('0x31')];if(!_0x440727[_0x1c77('0x35')][_0x1c77('0x3a')](_0x1c77('0x3b'))){_0x246ebf[_0x1c77('0x3c')]=qs['limit'](_0x440727[_0x1c77('0x35')][_0x1c77('0x3c')]);_0x246ebf['offset']=qs[_0x1c77('0x26')](_0x440727[_0x1c77('0x35')][_0x1c77('0x26')]);}_0x246ebf[_0x1c77('0x3d')]=qs[_0x1c77('0x3e')](_0x440727[_0x1c77('0x35')][_0x1c77('0x3e')]);_0x246ebf['where']=qs[_0x1c77('0x36')](_['pick'](_0x440727['query'],_0x46a385['filters']));if(_0x29245b['dateStart']){if(_0x29245b[_0x1c77('0x33')]){_0x29245b[_0x1c77('0x33')]=moment(_0x29245b[_0x1c77('0x33')])[_0x1c77('0x3f')](0x1,'day');}else{_0x29245b[_0x1c77('0x33')]=moment(_0x29245b[_0x1c77('0x34')])['add'](0x1,_0x1c77('0x40'));}_[_0x1c77('0x41')](_0x246ebf[_0x1c77('0x42')],{'createdAt':{'$gte':_0x29245b[_0x1c77('0x34')],'$lte':_0x29245b[_0x1c77('0x33')]}});}if(_0x440727['query'][_0x1c77('0x43')]){_0x246ebf['where']=_['merge'](_0x246ebf['where'],{'$or':_[_0x1c77('0x44')](_0x246ebf[_0x1c77('0x37')],function(_0x10d1de){var _0x3a0151={};_0x3a0151[_0x10d1de]={'$like':'%'+_0x440727['query']['filter']+'%'};return _0x3a0151;})});}_0x246ebf=_[_0x1c77('0x41')]({},_0x246ebf,_0x440727['options']);var _0x543957={'where':_0x246ebf['where']};return db[_0x1c77('0x2f')][_0x1c77('0x25')](_0x543957)[_0x1c77('0x17')](function(_0x3ae48d){_0x93a889[_0x1c77('0x25')]=_0x3ae48d;if(_0x440727[_0x1c77('0x35')][_0x1c77('0x45')]){_0x246ebf[_0x1c77('0x46')]=[{'all':!![]}];}return db['ChatMessage'][_0x1c77('0x47')](_0x246ebf);})[_0x1c77('0x17')](function(_0x2c83d1){_0x93a889[_0x1c77('0x48')]=_0x2c83d1;return _0x93a889;})['then'](respondWithFilteredResult(_0x26f94e,_0x246ebf))['catch'](handleError(_0x26f94e,null));};exports['show']=function(_0x3343d2,_0x16f97b){var _0x54d42c={'raw':!![],'where':{'id':_0x3343d2[_0x1c77('0x49')]['id']}},_0x25bc06={};_0x25bc06[_0x1c77('0x31')]=_[_0x1c77('0x32')](db[_0x1c77('0x2f')][_0x1c77('0x30')]);_0x25bc06[_0x1c77('0x35')]=_[_0x1c77('0x32')](_0x3343d2[_0x1c77('0x35')]);_0x25bc06['filters']=_[_0x1c77('0x38')](_0x25bc06[_0x1c77('0x31')],_0x25bc06['query']);_0x54d42c[_0x1c77('0x37')]=_[_0x1c77('0x38')](_0x25bc06[_0x1c77('0x31')],qs[_0x1c77('0x39')](_0x3343d2['query'][_0x1c77('0x39')]));_0x54d42c[_0x1c77('0x37')]=_0x54d42c[_0x1c77('0x37')]['length']?_0x54d42c[_0x1c77('0x37')]:_0x25bc06[_0x1c77('0x31')];if(_0x3343d2[_0x1c77('0x35')]['includeAll']){_0x54d42c[_0x1c77('0x46')]=[{'all':!![]}];}_0x54d42c=_[_0x1c77('0x41')]({},_0x54d42c,_0x3343d2[_0x1c77('0x4a')]);return db[_0x1c77('0x2f')][_0x1c77('0x4b')](_0x54d42c)['then'](handleEntityNotFound(_0x16f97b,null))['then'](respondWithResult(_0x16f97b,null))[_0x1c77('0x21')](handleError(_0x16f97b,null));};exports[_0x1c77('0x4c')]=function(_0x4e6118,_0x5c7c4f){return db[_0x1c77('0x2f')][_0x1c77('0x4c')](_0x4e6118[_0x1c77('0x4d')],{})[_0x1c77('0x17')](respondWithResult(_0x5c7c4f,0xc9))[_0x1c77('0x21')](handleError(_0x5c7c4f,null));};exports[_0x1c77('0x29')]=function(_0x318f18,_0xb17649){if(_0x318f18[_0x1c77('0x4d')]['id']){delete _0x318f18[_0x1c77('0x4d')]['id'];}return db[_0x1c77('0x2f')]['find']({'where':{'id':_0x318f18[_0x1c77('0x49')]['id']}})[_0x1c77('0x17')](handleEntityNotFound(_0xb17649,null))[_0x1c77('0x17')](saveUpdates(_0x318f18['body'],null))[_0x1c77('0x17')](respondWithResult(_0xb17649,null))['catch'](handleError(_0xb17649,null));};exports[_0x1c77('0x4e')]=function(_0x130bf7,_0xa5a825){return db['ChatMessage'][_0x1c77('0x4b')]({'where':{'id':_0x130bf7[_0x1c77('0x49')]['id']}})[_0x1c77('0x17')](handleEntityNotFound(_0xa5a825,null))['then'](removeEntity(_0xa5a825,null))[_0x1c77('0x21')](handleError(_0xa5a825,null));};exports[_0x1c77('0x4f')]=function(_0x24e65c,_0x5a45a2){return db[_0x1c77('0x2f')][_0x1c77('0x4f')]()[_0x1c77('0x17')](respondWithResult(_0x5a45a2,null))['catch'](handleError(_0x5a45a2,null));};var interaction_log=require(_0x1c77('0x50'))(_0x1c77('0x51'));exports[_0x1c77('0x52')]=function(_0x13b3aa,_0x1506ec,_0x557a4d){var _0x32add8={'channel':_0x1c77('0x53')};if(_0x13b3aa[_0x1c77('0x4d')]['id']){delete _0x13b3aa['body']['id'];}_0x13b3aa[_0x1c77('0x4d')]['read']=!![];_0x13b3aa[_0x1c77('0x4d')][_0x1c77('0x54')]=moment()[_0x1c77('0x55')](_0x1c77('0x56'));_0x13b3aa[_0x1c77('0x4d')][_0x1c77('0x57')]=_0x13b3aa[_0x1c77('0x4d')]['UserId']||_0x13b3aa[_0x1c77('0x58')]['id'];return db['ChatMessage'][_0x1c77('0x4b')]({'where':{'id':_0x13b3aa[_0x1c77('0x49')]['id'],'UserId':null},'include':[{'model':db[_0x1c77('0x59')],'as':_0x1c77('0x5a')}]})[_0x1c77('0x17')](handleEntityNotFound(_0x1506ec,null))[_0x1c77('0x17')](saveUpdates(_0x13b3aa['body'],null))[_0x1c77('0x17')](function(_0x1065c7){if(_0x1065c7){_0x32add8[_0x1c77('0x1f')]=_0x1065c7[_0x1c77('0x5b')]({'plain':!![]});return db[_0x1c77('0x5c')]['find']({'where':{'id':_0x1065c7[_0x1c77('0x5d')]}});}return null;})[_0x1c77('0x17')](handleEntityNotFound(_0x1506ec,null))[_0x1c77('0x17')](function(_0x3a867d){if(_0x3a867d){return _0x3a867d[_0x1c77('0x29')]({'UserId':_0x13b3aa[_0x1c77('0x4d')][_0x1c77('0x57')],'read1stAt':_[_0x1c77('0x5e')](_0x3a867d[_0x1c77('0x5f')])?moment()[_0x1c77('0x55')](_0x1c77('0x56')):undefined});}return null;})[_0x1c77('0x17')](function(_0x4d7308){if(_0x4d7308){_0x32add8[_0x1c77('0x60')]=_0x4d7308[_0x1c77('0x5b')]({'plain':!![]});interaction_log['info'](_0x1c77('0x61'),_0x13b3aa[_0x1c77('0x58')]['id'],_0x13b3aa[_0x1c77('0x58')][_0x1c77('0x2c')],_0x13b3aa['user'][_0x1c77('0x62')],_0x32add8[_0x1c77('0x60')]['id'],_0x13b3aa['body']?JSON[_0x1c77('0x1c')](_0x13b3aa[_0x1c77('0x4d')]):_0x1c77('0x63'));return respondWithRpcPromise(_0x1c77('0x64'),_0x1c77('0x65'),_0x32add8);}return null;})[_0x1c77('0x17')](function(_0x452fbb){if(_0x452fbb){if(_0x13b3aa[_0x1c77('0x4d')][_0x1c77('0x66')]){_0x32add8['message'][_0x1c77('0x67')]=util[_0x1c77('0x55')]('SIP/%s',_0x13b3aa[_0x1c77('0x58')][_0x1c77('0x2c')]);_0x32add8['message']['channel']=_0x32add8[_0x1c77('0x68')];_0x32add8[_0x1c77('0x1f')][_0x1c77('0x69')]=_0x1c77('0x52');return respondWithRpcPromise(_0x1c77('0x6a'),'EventManager',{'event':_0x1c77('0x6b'),'message':_[_0x1c77('0x41')](_0x32add8[_0x1c77('0x1f')],JSON[_0x1c77('0x6c')](_0x32add8[_0x1c77('0x60')][_0x1c77('0x6d')]))},client9002)[_0x1c77('0x17')](function(){return _0x32add8;});}return _0x32add8;}return null;})[_0x1c77('0x17')](respondWithResult(_0x1506ec,null))[_0x1c77('0x21')](handleError(_0x1506ec,null));};var interaction_log=require(_0x1c77('0x50'))('chat-interactions');exports['reject']=function(_0xa34d46,_0x357aae,_0x3ed903){var _0x4ddbf9={'agent':{},'channel':_0x1c77('0x53')};if(_0xa34d46[_0x1c77('0x4d')]['id']){delete _0xa34d46[_0x1c77('0x4d')]['id'];}_0xa34d46[_0x1c77('0x4d')]['UserId']=_0xa34d46[_0x1c77('0x4d')][_0x1c77('0x57')]||_0xa34d46['user']['id'];_0x4ddbf9[_0x1c77('0x6e')]['id']=_0xa34d46[_0x1c77('0x4d')]['UserId'];return db[_0x1c77('0x2f')][_0x1c77('0x4b')]({'where':{'id':_0xa34d46[_0x1c77('0x49')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x357aae,null))['then'](function(_0x216b12){if(_0x216b12){_0x4ddbf9['message']=_0x216b12[_0x1c77('0x5b')]({'plain':!![]});return db['ChatInteraction'][_0x1c77('0x4b')]({'where':{'id':_0x216b12[_0x1c77('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x357aae,null))[_0x1c77('0x17')](function(_0x3b8fad){if(_0x3b8fad){_0x4ddbf9[_0x1c77('0x60')]=_0x3b8fad[_0x1c77('0x5b')]({'plain':!![]});interaction_log[_0x1c77('0x18')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xa34d46['user']['id'],_0xa34d46[_0x1c77('0x58')][_0x1c77('0x2c')],_0xa34d46[_0x1c77('0x58')][_0x1c77('0x62')],_0x4ddbf9[_0x1c77('0x60')]['id'],_0xa34d46[_0x1c77('0x4d')]?JSON[_0x1c77('0x1c')](_0xa34d46[_0x1c77('0x4d')]):_0x1c77('0x63'));return respondWithRpcPromise(_0x1c77('0x6f'),'rejectMessage',_0x4ddbf9);}return null;})[_0x1c77('0x17')](function(_0xec7cb9){if(_0xec7cb9){_0xec7cb9['message'][_0x1c77('0x67')]=util[_0x1c77('0x55')](_0x1c77('0x70'),_0xa34d46[_0x1c77('0x58')][_0x1c77('0x2c')]);_0xec7cb9[_0x1c77('0x1f')][_0x1c77('0x68')]=_0x4ddbf9['channel'];_0xec7cb9['message'][_0x1c77('0x69')]=_0x1c77('0x71');respondWithRpcPromise(_0x1c77('0x6a'),_0x1c77('0x6a'),{'event':_0x1c77('0x72'),'message':_0xec7cb9[_0x1c77('0x1f')]},client9002);return _0x4ddbf9;}return null;})[_0x1c77('0x17')](respondWithResult(_0x357aae,null))[_0x1c77('0x21')](handleError(_0x357aae,null));}; \ No newline at end of file +var _0xf846=['model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','day','add','merge','filter','map','options','includeAll','findAll','rows','catch','show','include','create','body','find','params','destroy','../../config/logger','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','SIP/%s','channel','EventManager','acceptmessage','parse','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','moment','bluebird','util','path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','socket.io-emitter','./chatMessage.socket','register','client','http','request','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','stack','name','ChatMessage','rawAttributes'];(function(_0x3257c2,_0x5652a7){var _0x55ad23=function(_0x525a92){while(--_0x525a92){_0x3257c2['push'](_0x3257c2['shift']());}};_0x55ad23(++_0x5652a7);}(_0xf846,0x119));var _0x6f84=function(_0x4a70ce,_0x13462f){_0x4a70ce=_0x4a70ce-0x0;var _0x5a74fd=_0xf846[_0x4a70ce];return _0x5a74fd;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f84('0x0'));var BPromise=require(_0x6f84('0x1'));var Mustache=require('mustache');var util=require(_0x6f84('0x2'));var path=require(_0x6f84('0x3'));var sox=require('sox');var csv=require(_0x6f84('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f84('0x5'));var squel=require(_0x6f84('0x6'));var crypto=require(_0x6f84('0x7'));var jsforce=require(_0x6f84('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f84('0x9'));var Papa=require(_0x6f84('0xa'));var qs=require(_0x6f84('0xb'));var logger=require('../../config/logger')(_0x6f84('0xc'));var utils=require(_0x6f84('0xd'));var config=require('../../config/environment');var db=require(_0x6f84('0xe'))['db'];var socket=require(_0x6f84('0xf'))({'host':'localhost','port':0x18eb});require(_0x6f84('0x10'))[_0x6f84('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x6f84('0x12')][_0x6f84('0x13')]({'port':0x232c});var client9002=jayson[_0x6f84('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee0cc,_0x54eca0,_0x384c0b,_0x30fd9c){return new BPromise(function(_0x4d5641,_0x25bd2a){var _0x545455=_0x30fd9c||client;return _0x545455[_0x6f84('0x14')](_0x1ee0cc,_0x384c0b)['then'](function(_0xaf424a){logger['info'](_0x6f84('0x15'),_0x54eca0,_0x6f84('0x16'));logger[_0x6f84('0x17')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x54eca0,_0x6f84('0x16'),JSON[_0x6f84('0x18')](_0xaf424a));if(_0xaf424a[_0x6f84('0x19')]){if(_0xaf424a['error'][_0x6f84('0x1a')]===0x1f4){logger[_0x6f84('0x19')](_0x6f84('0x15'),_0x54eca0,_0xaf424a[_0x6f84('0x19')]['message']);return _0x25bd2a(_0xaf424a['error'][_0x6f84('0x1b')]);}logger['error'](_0x6f84('0x15'),_0x54eca0,_0xaf424a[_0x6f84('0x19')][_0x6f84('0x1b')]);return _0x4d5641(_0xaf424a[_0x6f84('0x19')]['message']);}else{logger[_0x6f84('0x1c')](_0x6f84('0x15'),_0x54eca0,'request\x20sent');_0x4d5641(_0xaf424a['result'][_0x6f84('0x1b')]);}})['catch'](function(_0x461f61){logger[_0x6f84('0x19')](_0x6f84('0x15'),_0x54eca0,_0x461f61);_0x25bd2a(_0x461f61);});});}function respondWithStatusCode(_0xea70d1,_0x24a7ff){_0x24a7ff=_0x24a7ff||0xcc;return function(_0x248866){if(_0x248866){return _0xea70d1[_0x6f84('0x1d')](_0x24a7ff);}return _0xea70d1['status'](_0x24a7ff)[_0x6f84('0x1e')]();};}function respondWithResult(_0x853675,_0x36750a){_0x36750a=_0x36750a||0xc8;return function(_0x555354){if(_0x555354){return _0x853675['status'](_0x36750a)[_0x6f84('0x1f')](_0x555354);}};}function respondWithFilteredResult(_0x31d3c0,_0x2d2e6a){return function(_0x333f20){if(_0x333f20){var _0x54ca48=_0x333f20[_0x6f84('0x20')],_0x5cf386=_0x2d2e6a[_0x6f84('0x21')],_0x1b8765=_0x2d2e6a[_0x6f84('0x21')]+_0x2d2e6a['limit'],_0xf13ba3;if(_0x1b8765>=_0x54ca48){_0x1b8765=_0x54ca48;_0xf13ba3=0xc8;}else{_0xf13ba3=0xce;}_0x31d3c0[_0x6f84('0x22')](_0xf13ba3);return _0x31d3c0[_0x6f84('0x23')](_0x6f84('0x24'),_0x5cf386+'-'+_0x1b8765+'/'+_0x54ca48)['json'](_0x333f20);}return null;};}function patchUpdates(_0x5629e3){return function(_0x49845b){try{jsonpatch[_0x6f84('0x25')](_0x49845b,_0x5629e3,!![]);}catch(_0x5ab437){return BPromise[_0x6f84('0x26')](_0x5ab437);}return _0x49845b[_0x6f84('0x27')]();};}function saveUpdates(_0x143c10,_0xabded7){return function(_0xa89683){if(_0xa89683){return _0xa89683[_0x6f84('0x28')](_0x143c10)[_0x6f84('0x29')](function(_0x5380fc){return _0x5380fc;});}return null;};}function removeEntity(_0x1d1d73,_0x1655f5){return function(_0x306388){if(_0x306388){return _0x306388['destroy']()[_0x6f84('0x29')](function(){_0x1d1d73[_0x6f84('0x22')](0xcc)[_0x6f84('0x1e')]();});}};}function handleEntityNotFound(_0x1bb2f6,_0x38b6fc){return function(_0x25f334){if(!_0x25f334){_0x1bb2f6[_0x6f84('0x1d')](0x194);}return _0x25f334;};}function handleError(_0x59b1df,_0x3b9581){_0x3b9581=_0x3b9581||0x1f4;return function(_0x2e1806){logger[_0x6f84('0x19')](_0x2e1806[_0x6f84('0x2a')]);if(_0x2e1806['name']){delete _0x2e1806[_0x6f84('0x2b')];}_0x59b1df[_0x6f84('0x22')](_0x3b9581)['send'](_0x2e1806);};}exports['index']=function(_0x3ea1cf,_0x10436e){var _0x4681d0={},_0x1665ce={},_0x387094={'count':0x0,'rows':[]};var _0x2da173=db[_0x6f84('0x2c')][_0x6f84('0x2d')];_0x1665ce[_0x6f84('0x2e')]=_[_0x6f84('0x2f')](_0x2da173);var _0x3a492f={'dateStart':_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x31')],'dateEnd':_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x32')]};delete _0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x31')];delete _0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x32')];_0x1665ce[_0x6f84('0x30')]=_['keys'](_0x3ea1cf[_0x6f84('0x30')]);_0x1665ce['filters']=_[_0x6f84('0x33')](_0x1665ce[_0x6f84('0x2e')],_0x1665ce['query']);_0x4681d0[_0x6f84('0x34')]=_[_0x6f84('0x33')](_0x1665ce[_0x6f84('0x2e')],qs[_0x6f84('0x35')](_0x3ea1cf['query']['fields']));_0x4681d0[_0x6f84('0x34')]=_0x4681d0[_0x6f84('0x34')][_0x6f84('0x36')]?_0x4681d0[_0x6f84('0x34')]:_0x1665ce['model'];if(!_0x3ea1cf[_0x6f84('0x30')]['hasOwnProperty'](_0x6f84('0x37'))){_0x4681d0[_0x6f84('0x38')]=qs[_0x6f84('0x38')](_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x38')]);_0x4681d0[_0x6f84('0x21')]=qs['offset'](_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x21')]);}_0x4681d0['order']=qs[_0x6f84('0x39')](_0x3ea1cf[_0x6f84('0x30')]['sort']);_0x4681d0[_0x6f84('0x3a')]=qs[_0x6f84('0x3b')](_['pick'](_0x3ea1cf[_0x6f84('0x30')],_0x1665ce[_0x6f84('0x3b')]));if(_0x3a492f[_0x6f84('0x31')]){if(_0x3a492f[_0x6f84('0x32')]){_0x3a492f[_0x6f84('0x32')]=moment(_0x3a492f[_0x6f84('0x32')])['add'](0x1,_0x6f84('0x3c'));}else{_0x3a492f[_0x6f84('0x32')]=moment(_0x3a492f[_0x6f84('0x31')])[_0x6f84('0x3d')](0x1,_0x6f84('0x3c'));}_[_0x6f84('0x3e')](_0x4681d0[_0x6f84('0x3a')],{'createdAt':{'$gte':_0x3a492f['dateStart'],'$lte':_0x3a492f[_0x6f84('0x32')]}});}if(_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x3f')]){_0x4681d0[_0x6f84('0x3a')]=_['merge'](_0x4681d0[_0x6f84('0x3a')],{'$or':_[_0x6f84('0x40')](_0x4681d0[_0x6f84('0x34')],function(_0x1c6996){var _0x47263e={};_0x47263e[_0x1c6996]={'$like':'%'+_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x3f')]+'%'};return _0x47263e;})});}_0x4681d0=_['merge']({},_0x4681d0,_0x3ea1cf[_0x6f84('0x41')]);var _0x52b0e1={'where':_0x4681d0[_0x6f84('0x3a')]};return db[_0x6f84('0x2c')][_0x6f84('0x20')](_0x52b0e1)['then'](function(_0x543ad7){_0x387094[_0x6f84('0x20')]=_0x543ad7;if(_0x3ea1cf[_0x6f84('0x30')][_0x6f84('0x42')]){_0x4681d0['include']=[{'all':!![]}];}return db['ChatMessage'][_0x6f84('0x43')](_0x4681d0);})[_0x6f84('0x29')](function(_0x353c0d){_0x387094[_0x6f84('0x44')]=_0x353c0d;return _0x387094;})[_0x6f84('0x29')](respondWithFilteredResult(_0x10436e,_0x4681d0))[_0x6f84('0x45')](handleError(_0x10436e,null));};exports[_0x6f84('0x46')]=function(_0x234603,_0x53df19){var _0x389a86={'raw':!![],'where':{'id':_0x234603['params']['id']}},_0x51949c={};_0x51949c[_0x6f84('0x2e')]=_[_0x6f84('0x2f')](db[_0x6f84('0x2c')][_0x6f84('0x2d')]);_0x51949c['query']=_[_0x6f84('0x2f')](_0x234603['query']);_0x51949c[_0x6f84('0x3b')]=_[_0x6f84('0x33')](_0x51949c[_0x6f84('0x2e')],_0x51949c[_0x6f84('0x30')]);_0x389a86['attributes']=_[_0x6f84('0x33')](_0x51949c[_0x6f84('0x2e')],qs[_0x6f84('0x35')](_0x234603[_0x6f84('0x30')][_0x6f84('0x35')]));_0x389a86[_0x6f84('0x34')]=_0x389a86[_0x6f84('0x34')][_0x6f84('0x36')]?_0x389a86['attributes']:_0x51949c[_0x6f84('0x2e')];if(_0x234603[_0x6f84('0x30')][_0x6f84('0x42')]){_0x389a86[_0x6f84('0x47')]=[{'all':!![]}];}_0x389a86=_[_0x6f84('0x3e')]({},_0x389a86,_0x234603['options']);return db[_0x6f84('0x2c')]['find'](_0x389a86)['then'](handleEntityNotFound(_0x53df19,null))[_0x6f84('0x29')](respondWithResult(_0x53df19,null))[_0x6f84('0x45')](handleError(_0x53df19,null));};exports[_0x6f84('0x48')]=function(_0xc6ae09,_0x40c641){return db[_0x6f84('0x2c')][_0x6f84('0x48')](_0xc6ae09[_0x6f84('0x49')],{})[_0x6f84('0x29')](respondWithResult(_0x40c641,0xc9))[_0x6f84('0x45')](handleError(_0x40c641,null));};exports[_0x6f84('0x28')]=function(_0x47ad75,_0x52bcff){if(_0x47ad75[_0x6f84('0x49')]['id']){delete _0x47ad75[_0x6f84('0x49')]['id'];}return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x47ad75[_0x6f84('0x4b')]['id']}})[_0x6f84('0x29')](handleEntityNotFound(_0x52bcff,null))[_0x6f84('0x29')](saveUpdates(_0x47ad75[_0x6f84('0x49')],null))['then'](respondWithResult(_0x52bcff,null))[_0x6f84('0x45')](handleError(_0x52bcff,null));};exports[_0x6f84('0x4c')]=function(_0x3d5c4c,_0x2f4beb){return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x3d5c4c['params']['id']}})[_0x6f84('0x29')](handleEntityNotFound(_0x2f4beb,null))[_0x6f84('0x29')](removeEntity(_0x2f4beb,null))['catch'](handleError(_0x2f4beb,null));};exports['describe']=function(_0xab0277,_0x4a20a4){return db[_0x6f84('0x2c')]['describe']()['then'](respondWithResult(_0x4a20a4,null))[_0x6f84('0x45')](handleError(_0x4a20a4,null));};var interaction_log=require(_0x6f84('0x4d'))(_0x6f84('0x4e'));exports[_0x6f84('0x4f')]=function(_0x205fb8,_0x2e8972,_0x580125){var _0x5c9312={'channel':_0x6f84('0x50')};if(_0x205fb8[_0x6f84('0x49')]['id']){delete _0x205fb8[_0x6f84('0x49')]['id'];}_0x205fb8[_0x6f84('0x49')]['read']=!![];_0x205fb8['body'][_0x6f84('0x51')]=moment()[_0x6f84('0x52')](_0x6f84('0x53'));_0x205fb8['body'][_0x6f84('0x54')]=_0x205fb8[_0x6f84('0x49')][_0x6f84('0x54')]||_0x205fb8[_0x6f84('0x55')]['id'];return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x205fb8[_0x6f84('0x4b')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x6f84('0x56')}]})[_0x6f84('0x29')](handleEntityNotFound(_0x2e8972,null))[_0x6f84('0x29')](saveUpdates(_0x205fb8[_0x6f84('0x49')],null))['then'](function(_0x5129fd){if(_0x5129fd){_0x5c9312[_0x6f84('0x1b')]=_0x5129fd['get']({'plain':!![]});return db['ChatInteraction'][_0x6f84('0x4a')]({'where':{'id':_0x5129fd['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2e8972,null))[_0x6f84('0x29')](function(_0x4dbc2a){if(_0x4dbc2a){return _0x4dbc2a[_0x6f84('0x28')]({'UserId':_0x205fb8['body'][_0x6f84('0x54')],'read1stAt':_[_0x6f84('0x57')](_0x4dbc2a[_0x6f84('0x58')])?moment()[_0x6f84('0x52')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0xeeff0){if(_0xeeff0){_0x5c9312[_0x6f84('0x59')]=_0xeeff0['get']({'plain':!![]});interaction_log[_0x6f84('0x1c')](_0x6f84('0x5a'),_0x205fb8['user']['id'],_0x205fb8['user'][_0x6f84('0x2b')],_0x205fb8[_0x6f84('0x55')][_0x6f84('0x5b')],_0x5c9312[_0x6f84('0x59')]['id'],_0x205fb8[_0x6f84('0x49')]?JSON['stringify'](_0x205fb8[_0x6f84('0x49')]):_0x6f84('0x5c'));return respondWithRpcPromise(_0x6f84('0x5d'),'acceptMessage',_0x5c9312);}return null;})[_0x6f84('0x29')](function(_0x5f02bd){if(_0x5f02bd){if(_0x205fb8['body'][_0x6f84('0x5e')]){_0x5c9312[_0x6f84('0x1b')][_0x6f84('0x5f')]=util[_0x6f84('0x52')](_0x6f84('0x60'),_0x205fb8[_0x6f84('0x55')]['name']);_0x5c9312[_0x6f84('0x1b')][_0x6f84('0x61')]=_0x5c9312[_0x6f84('0x61')];_0x5c9312[_0x6f84('0x1b')]['event']='accept';return respondWithRpcPromise(_0x6f84('0x62'),'EventManager',{'event':_0x6f84('0x63'),'message':_[_0x6f84('0x3e')](_0x5c9312[_0x6f84('0x1b')],JSON[_0x6f84('0x64')](_0x5c9312[_0x6f84('0x59')]['formData']))},client9002)[_0x6f84('0x29')](function(){return _0x5c9312;});}return _0x5c9312;}return null;})[_0x6f84('0x29')](respondWithResult(_0x2e8972,null))['catch'](handleError(_0x2e8972,null));};var interaction_log=require(_0x6f84('0x4d'))(_0x6f84('0x4e'));exports[_0x6f84('0x26')]=function(_0x30f976,_0x90f043,_0x397824){var _0x42da76={'agent':{},'channel':'chat'};if(_0x30f976['body']['id']){delete _0x30f976['body']['id'];}_0x30f976[_0x6f84('0x49')][_0x6f84('0x54')]=_0x30f976['body'][_0x6f84('0x54')]||_0x30f976[_0x6f84('0x55')]['id'];_0x42da76[_0x6f84('0x65')]['id']=_0x30f976[_0x6f84('0x49')][_0x6f84('0x54')];return db[_0x6f84('0x2c')][_0x6f84('0x4a')]({'where':{'id':_0x30f976[_0x6f84('0x4b')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x90f043,null))[_0x6f84('0x29')](function(_0x25ed55){if(_0x25ed55){_0x42da76[_0x6f84('0x1b')]=_0x25ed55[_0x6f84('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x6f84('0x4a')]({'where':{'id':_0x25ed55[_0x6f84('0x67')]}});}return null;})[_0x6f84('0x29')](handleEntityNotFound(_0x90f043,null))[_0x6f84('0x29')](function(_0x47b8b1){if(_0x47b8b1){_0x42da76[_0x6f84('0x59')]=_0x47b8b1[_0x6f84('0x66')]({'plain':!![]});interaction_log[_0x6f84('0x1c')](_0x6f84('0x68'),_0x30f976['user']['id'],_0x30f976[_0x6f84('0x55')][_0x6f84('0x2b')],_0x30f976[_0x6f84('0x55')][_0x6f84('0x5b')],_0x42da76[_0x6f84('0x59')]['id'],_0x30f976[_0x6f84('0x49')]?JSON['stringify'](_0x30f976['body']):_0x6f84('0x5c'));return respondWithRpcPromise(_0x6f84('0x69'),_0x6f84('0x6a'),_0x42da76);}return null;})['then'](function(_0x115811){if(_0x115811){_0x115811[_0x6f84('0x1b')][_0x6f84('0x5f')]=util[_0x6f84('0x52')](_0x6f84('0x60'),_0x30f976[_0x6f84('0x55')][_0x6f84('0x2b')]);_0x115811['message']['channel']=_0x42da76[_0x6f84('0x61')];_0x115811[_0x6f84('0x1b')][_0x6f84('0x6b')]=_0x6f84('0x26');respondWithRpcPromise(_0x6f84('0x62'),_0x6f84('0x62'),{'event':_0x6f84('0x6c'),'message':_0x115811[_0x6f84('0x1b')]},client9002);return _0x42da76;}return null;})[_0x6f84('0x29')](respondWithResult(_0x90f043,null))[_0x6f84('0x45')](handleError(_0x90f043,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5551034..1146c70 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 _0x0776=['save','remove','emit','events','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0776,0xad));var _0x6077=function(_0x325233,_0x149040){_0x325233=_0x325233-0x0;var _0x5ef018=_0x0776[_0x325233];return _0x5ef018;};'use strict';var EventEmitter=require(_0x6077('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x6077('0x1')](0x0);var events={'afterCreate':_0x6077('0x2'),'afterUpdate':'update','afterDestroy':_0x6077('0x3')};function emitEvent(_0x185545){return function(_0x360b30,_0x39d443,_0x39d8c7){ChatMessageEvents[_0x6077('0x4')](_0x185545+':'+_0x360b30['id'],_0x360b30);ChatMessageEvents['emit'](_0x185545,_0x360b30);_0x39d8c7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xbe23=['events','setMaxListeners','save','update','emit','exports'];(function(_0x1d8770,_0x1799c7){var _0x3f9f23=function(_0x1f5dad){while(--_0x1f5dad){_0x1d8770['push'](_0x1d8770['shift']());}};_0x3f9f23(++_0x1799c7);}(_0xbe23,0x1c2));var _0x3be2=function(_0x620fa6,_0x56789e){_0x620fa6=_0x620fa6-0x0;var _0x538a70=_0xbe23[_0x620fa6];return _0x538a70;};'use strict';var EventEmitter=require(_0x3be2('0x0'));var ChatMessage=require('../../mysqldb')['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3be2('0x1')](0x0);var events={'afterCreate':_0x3be2('0x2'),'afterUpdate':_0x3be2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x24607a){return function(_0x3ae068,_0x181a8e,_0x30435c){ChatMessageEvents[_0x3be2('0x4')](_0x24607a+':'+_0x3ae068['id'],_0x3ae068);ChatMessageEvents[_0x3be2('0x4')](_0x24607a,_0x3ae068);_0x30435c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3be2('0x5')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 5097874..b815ff4 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 _0x1a4c=['body','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','./chatMessage.attributes','exports','ChatMessage','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteractionId','then','update'];(function(_0x54ffaa,_0x31ee18){var _0x264f9e=function(_0x571f3d){while(--_0x571f3d){_0x54ffaa['push'](_0x54ffaa['shift']());}};_0x264f9e(++_0x31ee18);}(_0x1a4c,0x164));var _0xc1a4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1a4c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc1a4('0x0'));var util=require('util');var logger=require(_0xc1a4('0x1'))(_0xc1a4('0x2'));var moment=require(_0xc1a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xc1a4('0x4'));var attributes=require(_0xc1a4('0x5'));module[_0xc1a4('0x6')]=function(_0x321056,_0x3077a2){return _0x321056['define'](_0xc1a4('0x7'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28ca8a,_0x4d7233,_0x5e25df){var _0xffa08e=_0x321056[_0xc1a4('0x8')];var _0x426233=_0x28ca8a['get']({'plain':!![]});if(_0x426233[_0xc1a4('0x9')][_0xc1a4('0xa')]()==='in'||_0x426233[_0xc1a4('0x9')][_0xc1a4('0xa')]()===_0xc1a4('0xb')&&!_0x426233[_0xc1a4('0xc')]&&!_[_0xc1a4('0xd')](_0x426233[_0xc1a4('0xe')])){_0xffa08e['ChatInteraction']['findOne']({'where':{'id':_0x426233[_0xc1a4('0xf')]}})[_0xc1a4('0x10')](function(_0x2ce598){if(_0x2ce598){_0x2ce598[_0xc1a4('0x11')]({'lastMsgAt':_0x426233['createdAt'],'lastMsgDirection':_0x426233[_0xc1a4('0x9')][_0xc1a4('0xa')](),'lastMsgBody':_0x426233[_0xc1a4('0x12')]});}})['catch'](function(_0x149339){console[_0xc1a4('0x13')](_0x149339);});}_0x5e25df();}},'charset':_0xc1a4('0x14'),'collate':_0xc1a4('0x15')});}; \ No newline at end of file +var _0x56fe=['bluebird','./chatMessage.attributes','exports','ChatMessage','chat_messages','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment'];(function(_0x470f3f,_0x336b96){var _0x5497bd=function(_0x133add){while(--_0x133add){_0x470f3f['push'](_0x470f3f['shift']());}};_0x5497bd(++_0x336b96);}(_0x56fe,0xe4));var _0xe56f=function(_0x209f89,_0x1b03c2){_0x209f89=_0x209f89-0x0;var _0x8b9c23=_0x56fe[_0x209f89];return _0x8b9c23;};'use strict';var _=require(_0xe56f('0x0'));var util=require(_0xe56f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe56f('0x2'));var BPromise=require(_0xe56f('0x3'));var rp=require('request-promise');var attributes=require(_0xe56f('0x4'));module[_0xe56f('0x5')]=function(_0x308e46,_0x1c41f6){return _0x308e46['define'](_0xe56f('0x6'),attributes,{'tableName':_0xe56f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2e00bf,_0x575c9e,_0x1e093b){var _0x219537=_0x308e46[_0xe56f('0x8')];var _0x3f0afd=_0x2e00bf['get']({'plain':!![]});if(_0x3f0afd[_0xe56f('0x9')][_0xe56f('0xa')]()==='in'||_0x3f0afd[_0xe56f('0x9')][_0xe56f('0xa')]()==='out'&&!_0x3f0afd[_0xe56f('0xb')]&&!_[_0xe56f('0xc')](_0x3f0afd[_0xe56f('0xd')])){_0x219537[_0xe56f('0xe')]['findOne']({'where':{'id':_0x3f0afd[_0xe56f('0xf')]}})[_0xe56f('0x10')](function(_0x58f742){if(_0x58f742){_0x58f742[_0xe56f('0x11')]({'lastMsgAt':_0x3f0afd[_0xe56f('0x12')],'lastMsgDirection':_0x3f0afd['direction'][_0xe56f('0xa')](),'lastMsgBody':_0x3f0afd['body']});}})['catch'](function(_0x5aa3ef){console['error'](_0x5aa3ef);});}_0x1e093b();}},'charset':_0xe56f('0x13'),'collate':_0xe56f('0x14')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 7c07015..7cab29b 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 _0xc4aa=['localhost','./chatMessage.socket','register','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','result','catch','create','body','options','raw','debug','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','socket.io-emitter'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc4aa[_0x255d5b];return _0x3e141a;};'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 db=require(_0xac4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xac4a('0x6'));var jayson=require(_0xac4a('0x7'));var client=jayson[_0xac4a('0x8')][_0xac4a('0x9')]({'port':0x232a});var socket=require(_0xac4a('0xa'))({'host':_0xac4a('0xb'),'port':0x18eb});require(_0xac4a('0xc'))[_0xac4a('0xd')](socket);function respondWithRpcPromise(_0x5c6179,_0x5b8339,_0x1aba6d){return new BPromise(function(_0x2a4d53,_0x26ec84){return client['request'](_0x5c6179,_0x1aba6d)[_0xac4a('0xe')](function(_0x3a82de){logger[_0xac4a('0xf')]('ChatMessage,\x20%s,\x20%s',_0x5b8339,_0xac4a('0x10'));logger['debug'](_0xac4a('0x11'),_0x5b8339,'request\x20sent',JSON[_0xac4a('0x12')](_0x3a82de));if(_0x3a82de[_0xac4a('0x13')]){if(_0x3a82de[_0xac4a('0x13')]['code']===0x1f4){logger[_0xac4a('0x13')](_0xac4a('0x14'),_0x5b8339,_0x3a82de[_0xac4a('0x13')][_0xac4a('0x15')]);return _0x26ec84(_0x3a82de[_0xac4a('0x13')][_0xac4a('0x15')]);}logger[_0xac4a('0x13')](_0xac4a('0x14'),_0x5b8339,_0x3a82de[_0xac4a('0x13')][_0xac4a('0x15')]);return _0x2a4d53(_0x3a82de[_0xac4a('0x13')][_0xac4a('0x15')]);}else{logger['info'](_0xac4a('0x14'),_0x5b8339,_0xac4a('0x10'));_0x2a4d53(_0x3a82de[_0xac4a('0x16')][_0xac4a('0x15')]);}})[_0xac4a('0x17')](function(_0x387a54){logger[_0xac4a('0x13')](_0xac4a('0x14'),_0x5b8339,_0x387a54);_0x26ec84(_0x387a54);});});}exports['CreateChatMessage']=function(_0x5ac21e){var _0x21a729=this;return new Promise(function(_0x13c8eb,_0x39b691){return db['ChatMessage'][_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x19')],{'raw':_0x5ac21e[_0xac4a('0x1a')]?_0x5ac21e[_0xac4a('0x1a')][_0xac4a('0x1b')]===undefined?!![]:![]:!![]})[_0xac4a('0xe')](function(_0xe38996){logger[_0xac4a('0xf')]('CreateChatMessage',_0x5ac21e);logger[_0xac4a('0x1c')](_0xac4a('0x1d'),_0x5ac21e,JSON['stringify'](_0xe38996));_0x13c8eb(_0xe38996);})[_0xac4a('0x17')](function(_0x4169c0){logger[_0xac4a('0x13')](_0xac4a('0x1d'),_0x4169c0['message'],_0x5ac21e);_0x39b691(_0x21a729[_0xac4a('0x13')](0x1f4,_0x4169c0[_0xac4a('0x15')]));});});}; \ No newline at end of file +var _0x1967=['./chatMessage.socket','register','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','raw','CreateChatMessage','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost'];(function(_0x2a8509,_0x3c9b76){var _0x4c8567=function(_0x262800){while(--_0x262800){_0x2a8509['push'](_0x2a8509['shift']());}};_0x4c8567(++_0x3c9b76);}(_0x1967,0x173));var _0x7196=function(_0x402805,_0x1f5053){_0x402805=_0x402805-0x0;var _0x420a1b=_0x1967[_0x402805];return _0x420a1b;};'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 db=require(_0x7196('0x4'))['db'];var utils=require(_0x7196('0x5'));var logger=require(_0x7196('0x6'))(_0x7196('0x7'));var config=require(_0x7196('0x8'));var jayson=require(_0x7196('0x9'));var client=jayson['client'][_0x7196('0xa')]({'port':0x232a});var socket=require(_0x7196('0xb'))({'host':_0x7196('0xc'),'port':0x18eb});require(_0x7196('0xd'))[_0x7196('0xe')](socket);function respondWithRpcPromise(_0xad78a,_0x510c72,_0x218520){return new BPromise(function(_0xc6366f,_0x3f846e){return client[_0x7196('0xf')](_0xad78a,_0x218520)[_0x7196('0x10')](function(_0x503070){logger['info'](_0x7196('0x11'),_0x510c72,_0x7196('0x12'));logger[_0x7196('0x13')](_0x7196('0x14'),_0x510c72,_0x7196('0x12'),JSON[_0x7196('0x15')](_0x503070));if(_0x503070[_0x7196('0x16')]){if(_0x503070[_0x7196('0x16')][_0x7196('0x17')]===0x1f4){logger[_0x7196('0x16')](_0x7196('0x11'),_0x510c72,_0x503070['error'][_0x7196('0x18')]);return _0x3f846e(_0x503070[_0x7196('0x16')][_0x7196('0x18')]);}logger[_0x7196('0x16')]('ChatMessage,\x20%s,\x20%s',_0x510c72,_0x503070[_0x7196('0x16')]['message']);return _0xc6366f(_0x503070[_0x7196('0x16')][_0x7196('0x18')]);}else{logger[_0x7196('0x19')](_0x7196('0x11'),_0x510c72,_0x7196('0x12'));_0xc6366f(_0x503070[_0x7196('0x1a')][_0x7196('0x18')]);}})[_0x7196('0x1b')](function(_0x3e4e69){logger[_0x7196('0x16')](_0x7196('0x11'),_0x510c72,_0x3e4e69);_0x3f846e(_0x3e4e69);});});}exports['CreateChatMessage']=function(_0x4c4f91){var _0x448f13=this;return new Promise(function(_0x26b447,_0x40418d){return db['ChatMessage'][_0x7196('0x1c')](_0x4c4f91['body'],{'raw':_0x4c4f91['options']?_0x4c4f91[_0x7196('0x1d')][_0x7196('0x1e')]===undefined?!![]:![]:!![]})[_0x7196('0x10')](function(_0x4ddf78){logger['info'](_0x7196('0x1f'),_0x4c4f91);logger[_0x7196('0x13')]('CreateChatMessage',_0x4c4f91,JSON[_0x7196('0x15')](_0x4ddf78));_0x26b447(_0x4ddf78);})[_0x7196('0x1b')](function(_0x6e22e5){logger[_0x7196('0x16')](_0x7196('0x1f'),_0x6e22e5['message'],_0x4c4f91);_0x40418d(_0x448f13[_0x7196('0x16')](0x1f4,_0x6e22e5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 1cd97fd..5caf94f 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 _0x008c=['./chatMessage.events','save','remove','update','emit','removeListener','register','chatMessage:'];(function(_0x4131a8,_0x51ecd4){var _0x4704fb=function(_0x5cf7f1){while(--_0x5cf7f1){_0x4131a8['push'](_0x4131a8['shift']());}};_0x4704fb(++_0x51ecd4);}(_0x008c,0x188));var _0xc008=function(_0x26253d,_0x5dfc80){_0x26253d=_0x26253d-0x0;var _0x318a82=_0x008c[_0x26253d];return _0x318a82;};'use strict';var ChatMessageEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){ChatMessageEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);ChatMessageEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','remove','update'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3e74,0x175));var _0x43e7=function(_0x4e49b4,_0x19fce3){_0x4e49b4=_0x4e49b4-0x0;var _0x2a51a4=_0x3e74[_0x4e49b4];return _0x2a51a4;};'use strict';var ChatMessageEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){ChatMessageEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);ChatMessageEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index a53abba..81c61f0 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 _0xafbb=['./chatMessage.controller','get','/describe','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','create','/:id','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x456904,_0x4cb25c){var _0x4b0063=function(_0x2cb59f){while(--_0x2cb59f){_0x456904['push'](_0x456904['shift']());}};_0x4b0063(++_0x4cb25c);}(_0xafbb,0x73));var _0xbafb=function(_0x5859e7,_0x441d8e){_0x5859e7=_0x5859e7-0x0;var _0x56ae5e=_0xafbb[_0x5859e7];return _0x56ae5e;};'use strict';var multer=require('multer');var util=require(_0xbafb('0x0'));var path=require(_0xbafb('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0xbafb('0x2'));var interaction=require(_0xbafb('0x3'));var config=require(_0xbafb('0x4'));var controller=require(_0xbafb('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xbafb('0x6')](_0xbafb('0x7'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x9')]);router[_0xbafb('0x6')]('/:id',auth[_0xbafb('0x8')](),controller[_0xbafb('0xa')]);router[_0xbafb('0xb')]('/',auth[_0xbafb('0x8')](),interaction[_0xbafb('0xc')](_0xbafb('0xd'),_0xbafb('0xe')),controller[_0xbafb('0xf')]);router['put'](_0xbafb('0x10'),controller['update']);router[_0xbafb('0x11')](_0xbafb('0x12'),auth['isAuthenticated'](),controller[_0xbafb('0x13')]);router['put'](_0xbafb('0x14'),auth[_0xbafb('0x8')](),controller[_0xbafb('0x15')]);router[_0xbafb('0x16')](_0xbafb('0x10'),auth['isAuthenticated'](),controller[_0xbafb('0x17')]);module['exports']=router; \ No newline at end of file +var _0x03d2=['update','accept','reject','delete','destroy','exports','path','express','../../config/environment','./chatMessage.controller','get','/describe','isAuthenticated','describe','show','post','chatmessage:create','create','put','/:id'];(function(_0x343561,_0x2ddcbc){var _0x18bda0=function(_0x393c4e){while(--_0x393c4e){_0x343561['push'](_0x343561['shift']());}};_0x18bda0(++_0x2ddcbc);}(_0x03d2,0x11e));var _0x203d=function(_0x4b163a,_0x209f4f){_0x4b163a=_0x4b163a-0x0;var _0x132d2b=_0x03d2[_0x4b163a];return _0x132d2b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x203d('0x0'));var express=require(_0x203d('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x203d('0x2'));var controller=require(_0x203d('0x3'));router[_0x203d('0x4')]('/',auth['isAuthenticated'](),controller['index']);router[_0x203d('0x4')](_0x203d('0x5'),auth[_0x203d('0x6')](),controller[_0x203d('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x203d('0x8')]);router[_0x203d('0x9')]('/',auth[_0x203d('0x6')](),interaction['tracked']('chat',_0x203d('0xa')),controller[_0x203d('0xb')]);router[_0x203d('0xc')](_0x203d('0xd'),controller[_0x203d('0xe')]);router[_0x203d('0xc')]('/:id/accept',auth[_0x203d('0x6')](),controller[_0x203d('0xf')]);router[_0x203d('0xc')]('/:id/reject',auth[_0x203d('0x6')](),controller[_0x203d('0x10')]);router[_0x203d('0x11')](_0x203d('0xd'),auth['isAuthenticated'](),controller[_0x203d('0x12')]);module[_0x203d('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 811be60..adc4b45 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 _0xb1ef=['medium','sequelize','exports'];(function(_0x1a83fb,_0xf82761){var _0x1c8ed8=function(_0x2d2ab1){while(--_0x2d2ab1){_0x1a83fb['push'](_0x1a83fb['shift']());}};_0x1c8ed8(++_0xf82761);}(_0xb1ef,0x127));var _0xfb1e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb1ef[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xfb1e('0x0'));module[_0xfb1e('0x1')]={'body':{'type':Sequelize['TEXT'](_0xfb1e('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xfed1=['sequelize','exports','medium'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xfed1,0xf0));var _0x1fed=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfed1[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x1fed('0x0'));module[_0x1fed('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1fed('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 3453d6b..709c90f 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 _0xa24f=['index','ChatOfflineMessage','rawAttributes','model','keys','dateStart','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','dateEnd','day','merge','map','filter','options','include','findAll','rows','catch','show','params','find','create','body','describe','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','../../config/environment','../../mysqldb','json','count','limit','status','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send'];(function(_0x3042c5,_0x36cb88){var _0x7cd140=function(_0x4cdcd8){while(--_0x4cdcd8){_0x3042c5['push'](_0x3042c5['shift']());}};_0x7cd140(++_0x36cb88);}(_0xa24f,0xf2));var _0xfa24=function(_0x86d32e,_0x3a0bf1){_0x86d32e=_0x86d32e-0x0;var _0x50a35e=_0xa24f[_0x86d32e];return _0x50a35e;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xfa24('0x0'));var moment=require(_0xfa24('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xfa24('0x2'));var util=require(_0xfa24('0x3'));var path=require('path');var sox=require(_0xfa24('0x4'));var csv=require('to-csv');var ejs=require(_0xfa24('0x5'));var fs=require('fs');var _=require(_0xfa24('0x6'));var squel=require(_0xfa24('0x7'));var crypto=require(_0xfa24('0x8'));var jsforce=require(_0xfa24('0x9'));var deskjs=require(_0xfa24('0xa'));var toCsv=require(_0xfa24('0xb'));var querystring=require(_0xfa24('0xc'));var Papa=require(_0xfa24('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xfa24('0xe'))('api');var utils=require('../../config/utils');var config=require(_0xfa24('0xf'));var db=require(_0xfa24('0x10'))['db'];function respondWithStatusCode(_0xb6247f,_0x2d8cd8){_0x2d8cd8=_0x2d8cd8||0xcc;return function(_0x5ae139){if(_0x5ae139){return _0xb6247f['sendStatus'](_0x2d8cd8);}return _0xb6247f['status'](_0x2d8cd8)['end']();};}function respondWithResult(_0x25a9fa,_0x4f4613){_0x4f4613=_0x4f4613||0xc8;return function(_0x34bc2f){if(_0x34bc2f){return _0x25a9fa['status'](_0x4f4613)[_0xfa24('0x11')](_0x34bc2f);}};}function respondWithFilteredResult(_0x45b860,_0x322fce){return function(_0x53d34a){if(_0x53d34a){var _0x38e92f=_0x53d34a[_0xfa24('0x12')],_0x298b83=_0x322fce['offset'],_0x308803=_0x322fce['offset']+_0x322fce[_0xfa24('0x13')],_0x4a80b1;if(_0x308803>=_0x38e92f){_0x308803=_0x38e92f;_0x4a80b1=0xc8;}else{_0x4a80b1=0xce;}_0x45b860[_0xfa24('0x14')](_0x4a80b1);return _0x45b860['set'](_0xfa24('0x15'),_0x298b83+'-'+_0x308803+'/'+_0x38e92f)[_0xfa24('0x11')](_0x53d34a);}return null;};}function patchUpdates(_0x9569f4){return function(_0x530119){try{jsonpatch[_0xfa24('0x16')](_0x530119,_0x9569f4,!![]);}catch(_0x41a712){return BPromise[_0xfa24('0x17')](_0x41a712);}return _0x530119[_0xfa24('0x18')]();};}function saveUpdates(_0x4a032d,_0x5784a7){return function(_0x2fbc21){if(_0x2fbc21){return _0x2fbc21[_0xfa24('0x19')](_0x4a032d)['then'](function(_0xb2e683){return _0xb2e683;});}return null;};}function removeEntity(_0x19dfd4,_0x143029){return function(_0x32145c){if(_0x32145c){return _0x32145c[_0xfa24('0x1a')]()[_0xfa24('0x1b')](function(){_0x19dfd4['status'](0xcc)[_0xfa24('0x1c')]();});}};}function handleEntityNotFound(_0x20255f,_0x33401e){return function(_0x484aca){if(!_0x484aca){_0x20255f[_0xfa24('0x1d')](0x194);}return _0x484aca;};}function handleError(_0x110281,_0x30c2c8){_0x30c2c8=_0x30c2c8||0x1f4;return function(_0x463e9c){logger[_0xfa24('0x1e')](_0x463e9c[_0xfa24('0x1f')]);if(_0x463e9c[_0xfa24('0x20')]){delete _0x463e9c[_0xfa24('0x20')];}_0x110281[_0xfa24('0x14')](_0x30c2c8)[_0xfa24('0x21')](_0x463e9c);};}exports[_0xfa24('0x22')]=function(_0x3e15b9,_0x1433d4){var _0x261527={},_0x1449a5={},_0x5c609f={'count':0x0,'rows':[]};var _0x53c401=db[_0xfa24('0x23')][_0xfa24('0x24')];_0x1449a5[_0xfa24('0x25')]=_[_0xfa24('0x26')](_0x53c401);var _0x3b29bf={'dateStart':_0x3e15b9['query'][_0xfa24('0x27')],'dateEnd':_0x3e15b9[_0xfa24('0x28')]['dateEnd']};delete _0x3e15b9['query'][_0xfa24('0x27')];delete _0x3e15b9[_0xfa24('0x28')]['dateEnd'];_0x1449a5['query']=_['keys'](_0x3e15b9[_0xfa24('0x28')]);_0x1449a5['filters']=_[_0xfa24('0x29')](_0x1449a5['model'],_0x1449a5[_0xfa24('0x28')]);_0x261527[_0xfa24('0x2a')]=_['intersection'](_0x1449a5[_0xfa24('0x25')],qs[_0xfa24('0x2b')](_0x3e15b9[_0xfa24('0x28')]['fields']));_0x261527[_0xfa24('0x2a')]=_0x261527[_0xfa24('0x2a')][_0xfa24('0x2c')]?_0x261527[_0xfa24('0x2a')]:_0x1449a5[_0xfa24('0x25')];if(!_0x3e15b9[_0xfa24('0x28')][_0xfa24('0x2d')](_0xfa24('0x2e'))){_0x261527['limit']=qs[_0xfa24('0x13')](_0x3e15b9[_0xfa24('0x28')]['limit']);_0x261527[_0xfa24('0x2f')]=qs[_0xfa24('0x2f')](_0x3e15b9['query'][_0xfa24('0x2f')]);}_0x261527[_0xfa24('0x30')]=qs['sort'](_0x3e15b9[_0xfa24('0x28')][_0xfa24('0x31')]);_0x261527[_0xfa24('0x32')]=qs[_0xfa24('0x33')](_[_0xfa24('0x34')](_0x3e15b9['query'],_0x1449a5[_0xfa24('0x33')]));if(_0x3b29bf[_0xfa24('0x27')]){if(_0x3b29bf[_0xfa24('0x35')]){_0x3b29bf[_0xfa24('0x35')]=moment(_0x3b29bf[_0xfa24('0x35')])['add'](0x1,_0xfa24('0x36'));}else{_0x3b29bf[_0xfa24('0x35')]=moment(_0x3b29bf[_0xfa24('0x27')])['add'](0x1,_0xfa24('0x36'));}_[_0xfa24('0x37')](_0x261527[_0xfa24('0x32')],{'createdAt':{'$gte':_0x3b29bf[_0xfa24('0x27')],'$lte':_0x3b29bf[_0xfa24('0x35')]}});}if(_0x3e15b9[_0xfa24('0x28')]['filter']){_0x261527[_0xfa24('0x32')]=_[_0xfa24('0x37')](_0x261527[_0xfa24('0x32')],{'$or':_[_0xfa24('0x38')](_0x261527[_0xfa24('0x2a')],function(_0x294242){var _0x77aff5={};_0x77aff5[_0x294242]={'$like':'%'+_0x3e15b9[_0xfa24('0x28')][_0xfa24('0x39')]+'%'};return _0x77aff5;})});}_0x261527=_[_0xfa24('0x37')]({},_0x261527,_0x3e15b9[_0xfa24('0x3a')]);var _0x2d12dd={'where':_0x261527['where']};return db[_0xfa24('0x23')][_0xfa24('0x12')](_0x2d12dd)[_0xfa24('0x1b')](function(_0x4a0450){_0x5c609f[_0xfa24('0x12')]=_0x4a0450;if(_0x3e15b9[_0xfa24('0x28')]['includeAll']){_0x261527[_0xfa24('0x3b')]=[{'all':!![]}];}return db[_0xfa24('0x23')][_0xfa24('0x3c')](_0x261527);})[_0xfa24('0x1b')](function(_0x37919d){_0x5c609f[_0xfa24('0x3d')]=_0x37919d;return _0x5c609f;})[_0xfa24('0x1b')](respondWithFilteredResult(_0x1433d4,_0x261527))[_0xfa24('0x3e')](handleError(_0x1433d4,null));};exports[_0xfa24('0x3f')]=function(_0x16555b,_0x5ac400){var _0x4ba39e={'raw':!![],'where':{'id':_0x16555b[_0xfa24('0x40')]['id']}},_0x4cb1e7={};_0x4cb1e7['model']=_[_0xfa24('0x26')](db[_0xfa24('0x23')][_0xfa24('0x24')]);_0x4cb1e7[_0xfa24('0x28')]=_[_0xfa24('0x26')](_0x16555b[_0xfa24('0x28')]);_0x4cb1e7[_0xfa24('0x33')]=_[_0xfa24('0x29')](_0x4cb1e7[_0xfa24('0x25')],_0x4cb1e7[_0xfa24('0x28')]);_0x4ba39e[_0xfa24('0x2a')]=_['intersection'](_0x4cb1e7['model'],qs['fields'](_0x16555b[_0xfa24('0x28')][_0xfa24('0x2b')]));_0x4ba39e['attributes']=_0x4ba39e[_0xfa24('0x2a')]['length']?_0x4ba39e[_0xfa24('0x2a')]:_0x4cb1e7[_0xfa24('0x25')];if(_0x16555b[_0xfa24('0x28')]['includeAll']){_0x4ba39e[_0xfa24('0x3b')]=[{'all':!![]}];}_0x4ba39e=_['merge']({},_0x4ba39e,_0x16555b[_0xfa24('0x3a')]);return db[_0xfa24('0x23')][_0xfa24('0x41')](_0x4ba39e)[_0xfa24('0x1b')](handleEntityNotFound(_0x5ac400,null))[_0xfa24('0x1b')](respondWithResult(_0x5ac400,null))[_0xfa24('0x3e')](handleError(_0x5ac400,null));};exports[_0xfa24('0x42')]=function(_0x5f4dd9,_0x25eb5a){return db[_0xfa24('0x23')][_0xfa24('0x42')](_0x5f4dd9['body'],{})[_0xfa24('0x1b')](respondWithResult(_0x25eb5a,0xc9))[_0xfa24('0x3e')](handleError(_0x25eb5a,null));};exports[_0xfa24('0x19')]=function(_0x59f1fb,_0x65fce8){if(_0x59f1fb[_0xfa24('0x43')]['id']){delete _0x59f1fb[_0xfa24('0x43')]['id'];}return db[_0xfa24('0x23')]['find']({'where':{'id':_0x59f1fb[_0xfa24('0x40')]['id']}})[_0xfa24('0x1b')](handleEntityNotFound(_0x65fce8,null))[_0xfa24('0x1b')](saveUpdates(_0x59f1fb[_0xfa24('0x43')],null))[_0xfa24('0x1b')](respondWithResult(_0x65fce8,null))[_0xfa24('0x3e')](handleError(_0x65fce8,null));};exports[_0xfa24('0x1a')]=function(_0x29ebe0,_0x376849){return db[_0xfa24('0x23')][_0xfa24('0x41')]({'where':{'id':_0x29ebe0[_0xfa24('0x40')]['id']}})[_0xfa24('0x1b')](handleEntityNotFound(_0x376849,null))[_0xfa24('0x1b')](removeEntity(_0x376849,null))['catch'](handleError(_0x376849,null));};exports['describe']=function(_0x137602,_0x1dee8e){return db['ChatOfflineMessage'][_0xfa24('0x44')]()[_0xfa24('0x1b')](respondWithResult(_0x1dee8e,null))[_0xfa24('0x3e')](handleError(_0x1dee8e,null));}; \ No newline at end of file +var _0xc342=['offset','status','set','apply','reject','save','update','destroy','error','name','send','index','ChatOfflineMessage','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','merge','map','options','count','then','includeAll','include','findAll','rows','show','rawAttributes','length','find','catch','create','body','params','describe','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end'];(function(_0x57a402,_0x40596b){var _0x753a36=function(_0x13b76b){while(--_0x13b76b){_0x57a402['push'](_0x57a402['shift']());}};_0x753a36(++_0x40596b);}(_0xc342,0x140));var _0x2c34=function(_0x4051be,_0x4e30dc){_0x4051be=_0x4051be-0x0;var _0x10d8e5=_0xc342[_0x4051be];return _0x10d8e5;};'use strict';var jsonpatch=require(_0x2c34('0x0'));var rp=require('request-promise');var moment=require(_0x2c34('0x1'));var BPromise=require(_0x2c34('0x2'));var Mustache=require(_0x2c34('0x3'));var util=require(_0x2c34('0x4'));var path=require(_0x2c34('0x5'));var sox=require('sox');var csv=require(_0x2c34('0x6'));var ejs=require(_0x2c34('0x7'));var fs=require('fs');var _=require(_0x2c34('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2c34('0x9'));var deskjs=require(_0x2c34('0xa'));var toCsv=require(_0x2c34('0x6'));var querystring=require(_0x2c34('0xb'));var Papa=require(_0x2c34('0xc'));var qs=require(_0x2c34('0xd'));var logger=require(_0x2c34('0xe'))(_0x2c34('0xf'));var utils=require(_0x2c34('0x10'));var config=require('../../config/environment');var db=require(_0x2c34('0x11'))['db'];function respondWithStatusCode(_0x3780fc,_0x337379){_0x337379=_0x337379||0xcc;return function(_0x15fde2){if(_0x15fde2){return _0x3780fc[_0x2c34('0x12')](_0x337379);}return _0x3780fc['status'](_0x337379)[_0x2c34('0x13')]();};}function respondWithResult(_0x2c17e4,_0x35f461){_0x35f461=_0x35f461||0xc8;return function(_0x14c3cd){if(_0x14c3cd){return _0x2c17e4['status'](_0x35f461)['json'](_0x14c3cd);}};}function respondWithFilteredResult(_0x3daee2,_0x552aaf){return function(_0x249332){if(_0x249332){var _0x21207c=_0x249332['count'],_0x31a653=_0x552aaf['offset'],_0x10a0f6=_0x552aaf[_0x2c34('0x14')]+_0x552aaf['limit'],_0x42e4dd;if(_0x10a0f6>=_0x21207c){_0x10a0f6=_0x21207c;_0x42e4dd=0xc8;}else{_0x42e4dd=0xce;}_0x3daee2[_0x2c34('0x15')](_0x42e4dd);return _0x3daee2[_0x2c34('0x16')]('Content-Range',_0x31a653+'-'+_0x10a0f6+'/'+_0x21207c)['json'](_0x249332);}return null;};}function patchUpdates(_0x95a1f){return function(_0x21caf7){try{jsonpatch[_0x2c34('0x17')](_0x21caf7,_0x95a1f,!![]);}catch(_0x46c2ff){return BPromise[_0x2c34('0x18')](_0x46c2ff);}return _0x21caf7[_0x2c34('0x19')]();};}function saveUpdates(_0x3d874c,_0x579412){return function(_0x16b8ae){if(_0x16b8ae){return _0x16b8ae[_0x2c34('0x1a')](_0x3d874c)['then'](function(_0x4ffc6b){return _0x4ffc6b;});}return null;};}function removeEntity(_0xae4858,_0x204c1a){return function(_0x5882eb){if(_0x5882eb){return _0x5882eb[_0x2c34('0x1b')]()['then'](function(){_0xae4858[_0x2c34('0x15')](0xcc)[_0x2c34('0x13')]();});}};}function handleEntityNotFound(_0x54c26c,_0x5cfe73){return function(_0x57d5cc){if(!_0x57d5cc){_0x54c26c[_0x2c34('0x12')](0x194);}return _0x57d5cc;};}function handleError(_0x4e1ba7,_0x1a302d){_0x1a302d=_0x1a302d||0x1f4;return function(_0x52cb8e){logger[_0x2c34('0x1c')](_0x52cb8e['stack']);if(_0x52cb8e['name']){delete _0x52cb8e[_0x2c34('0x1d')];}_0x4e1ba7['status'](_0x1a302d)[_0x2c34('0x1e')](_0x52cb8e);};}exports[_0x2c34('0x1f')]=function(_0x1e3c65,_0x3d933d){var _0x59baa4={},_0x30dc6f={},_0x502d61={'count':0x0,'rows':[]};var _0x1b1216=db[_0x2c34('0x20')]['rawAttributes'];_0x30dc6f[_0x2c34('0x21')]=_['keys'](_0x1b1216);var _0x5ad4e7={'dateStart':_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x23')],'dateEnd':_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x24')]};delete _0x1e3c65['query'][_0x2c34('0x23')];delete _0x1e3c65['query'][_0x2c34('0x24')];_0x30dc6f[_0x2c34('0x22')]=_[_0x2c34('0x25')](_0x1e3c65['query']);_0x30dc6f[_0x2c34('0x26')]=_[_0x2c34('0x27')](_0x30dc6f[_0x2c34('0x21')],_0x30dc6f[_0x2c34('0x22')]);_0x59baa4['attributes']=_[_0x2c34('0x27')](_0x30dc6f[_0x2c34('0x21')],qs[_0x2c34('0x28')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x28')]));_0x59baa4[_0x2c34('0x29')]=_0x59baa4['attributes']['length']?_0x59baa4[_0x2c34('0x29')]:_0x30dc6f['model'];if(!_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2a')](_0x2c34('0x2b'))){_0x59baa4[_0x2c34('0x2c')]=qs[_0x2c34('0x2c')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2c')]);_0x59baa4[_0x2c34('0x14')]=qs[_0x2c34('0x14')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x14')]);}_0x59baa4[_0x2c34('0x2d')]=qs[_0x2c34('0x2e')](_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x2e')]);_0x59baa4[_0x2c34('0x2f')]=qs[_0x2c34('0x26')](_[_0x2c34('0x30')](_0x1e3c65[_0x2c34('0x22')],_0x30dc6f[_0x2c34('0x26')]));if(_0x5ad4e7[_0x2c34('0x23')]){if(_0x5ad4e7[_0x2c34('0x24')]){_0x5ad4e7[_0x2c34('0x24')]=moment(_0x5ad4e7[_0x2c34('0x24')])['add'](0x1,_0x2c34('0x31'));}else{_0x5ad4e7[_0x2c34('0x24')]=moment(_0x5ad4e7[_0x2c34('0x23')])['add'](0x1,'day');}_[_0x2c34('0x32')](_0x59baa4[_0x2c34('0x2f')],{'createdAt':{'$gte':_0x5ad4e7['dateStart'],'$lte':_0x5ad4e7[_0x2c34('0x24')]}});}if(_0x1e3c65[_0x2c34('0x22')]['filter']){_0x59baa4['where']=_['merge'](_0x59baa4[_0x2c34('0x2f')],{'$or':_[_0x2c34('0x33')](_0x59baa4['attributes'],function(_0x2cf4bc){var _0x4fca14={};_0x4fca14[_0x2cf4bc]={'$like':'%'+_0x1e3c65[_0x2c34('0x22')]['filter']+'%'};return _0x4fca14;})});}_0x59baa4=_['merge']({},_0x59baa4,_0x1e3c65[_0x2c34('0x34')]);var _0x3f76bb={'where':_0x59baa4['where']};return db[_0x2c34('0x20')][_0x2c34('0x35')](_0x3f76bb)[_0x2c34('0x36')](function(_0x175ee8){_0x502d61[_0x2c34('0x35')]=_0x175ee8;if(_0x1e3c65[_0x2c34('0x22')][_0x2c34('0x37')]){_0x59baa4[_0x2c34('0x38')]=[{'all':!![]}];}return db[_0x2c34('0x20')][_0x2c34('0x39')](_0x59baa4);})[_0x2c34('0x36')](function(_0x573a51){_0x502d61[_0x2c34('0x3a')]=_0x573a51;return _0x502d61;})['then'](respondWithFilteredResult(_0x3d933d,_0x59baa4))['catch'](handleError(_0x3d933d,null));};exports[_0x2c34('0x3b')]=function(_0x2e0615,_0x4a5223){var _0x9b8d24={'raw':!![],'where':{'id':_0x2e0615['params']['id']}},_0x3fa6de={};_0x3fa6de[_0x2c34('0x21')]=_[_0x2c34('0x25')](db['ChatOfflineMessage'][_0x2c34('0x3c')]);_0x3fa6de[_0x2c34('0x22')]=_[_0x2c34('0x25')](_0x2e0615[_0x2c34('0x22')]);_0x3fa6de['filters']=_[_0x2c34('0x27')](_0x3fa6de['model'],_0x3fa6de['query']);_0x9b8d24['attributes']=_['intersection'](_0x3fa6de[_0x2c34('0x21')],qs[_0x2c34('0x28')](_0x2e0615[_0x2c34('0x22')]['fields']));_0x9b8d24['attributes']=_0x9b8d24[_0x2c34('0x29')][_0x2c34('0x3d')]?_0x9b8d24[_0x2c34('0x29')]:_0x3fa6de['model'];if(_0x2e0615[_0x2c34('0x22')][_0x2c34('0x37')]){_0x9b8d24[_0x2c34('0x38')]=[{'all':!![]}];}_0x9b8d24=_[_0x2c34('0x32')]({},_0x9b8d24,_0x2e0615[_0x2c34('0x34')]);return db[_0x2c34('0x20')][_0x2c34('0x3e')](_0x9b8d24)[_0x2c34('0x36')](handleEntityNotFound(_0x4a5223,null))['then'](respondWithResult(_0x4a5223,null))[_0x2c34('0x3f')](handleError(_0x4a5223,null));};exports[_0x2c34('0x40')]=function(_0x28facc,_0x50523e){return db[_0x2c34('0x20')][_0x2c34('0x40')](_0x28facc[_0x2c34('0x41')],{})[_0x2c34('0x36')](respondWithResult(_0x50523e,0xc9))[_0x2c34('0x3f')](handleError(_0x50523e,null));};exports['update']=function(_0x28743f,_0x537b6){if(_0x28743f[_0x2c34('0x41')]['id']){delete _0x28743f[_0x2c34('0x41')]['id'];}return db[_0x2c34('0x20')]['find']({'where':{'id':_0x28743f['params']['id']}})[_0x2c34('0x36')](handleEntityNotFound(_0x537b6,null))[_0x2c34('0x36')](saveUpdates(_0x28743f[_0x2c34('0x41')],null))[_0x2c34('0x36')](respondWithResult(_0x537b6,null))['catch'](handleError(_0x537b6,null));};exports[_0x2c34('0x1b')]=function(_0x18182a,_0x131dac){return db[_0x2c34('0x20')][_0x2c34('0x3e')]({'where':{'id':_0x18182a[_0x2c34('0x42')]['id']}})[_0x2c34('0x36')](handleEntityNotFound(_0x131dac,null))[_0x2c34('0x36')](removeEntity(_0x131dac,null))[_0x2c34('0x3f')](handleError(_0x131dac,null));};exports[_0x2c34('0x43')]=function(_0x115331,_0x459299){return db[_0x2c34('0x20')][_0x2c34('0x43')]()[_0x2c34('0x36')](respondWithResult(_0x459299,null))['catch'](handleError(_0x459299,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 8363d26..ae41251 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 _0x04f8=['define','chat_offline_messages','lodash','util','../../config/logger','api','moment','bluebird','./chatOfflineMessage.attributes','exports'];(function(_0x53d612,_0x39c6e7){var _0x2ac6f7=function(_0x336195){while(--_0x336195){_0x53d612['push'](_0x53d612['shift']());}};_0x2ac6f7(++_0x39c6e7);}(_0x04f8,0xf2));var _0x804f=function(_0x2a0d34,_0x17ff9b){_0x2a0d34=_0x2a0d34-0x0;var _0x42c8a1=_0x04f8[_0x2a0d34];return _0x42c8a1;};'use strict';var _=require(_0x804f('0x0'));var util=require(_0x804f('0x1'));var logger=require(_0x804f('0x2'))(_0x804f('0x3'));var moment=require(_0x804f('0x4'));var BPromise=require(_0x804f('0x5'));var rp=require('request-promise');var attributes=require(_0x804f('0x6'));module[_0x804f('0x7')]=function(_0x36da2a,_0x4c7689){return _0x36da2a[_0x804f('0x8')]('ChatOfflineMessage',attributes,{'tableName':_0x804f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x364e=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x583af1,_0x2eb40a){var _0x8ea646=function(_0x300bb7){while(--_0x300bb7){_0x583af1['push'](_0x583af1['shift']());}};_0x8ea646(++_0x2eb40a);}(_0x364e,0x141));var _0xe364=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x364e[_0x543084];return _0x306a57;};'use strict';var _=require(_0xe364('0x0'));var util=require(_0xe364('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe364('0x2'));var rp=require(_0xe364('0x3'));var attributes=require(_0xe364('0x4'));module[_0xe364('0x5')]=function(_0x4e435b,_0x447b7c){return _0x4e435b[_0xe364('0x6')](_0xe364('0x7'),attributes,{'tableName':_0xe364('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe364('0x9')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e0eec59..686121d 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 _0xbafa=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client'];(function(_0x4663b9,_0x41475f){var _0x3e903a=function(_0xf63442){while(--_0xf63442){_0x4663b9['push'](_0x4663b9['shift']());}};_0x3e903a(++_0x41475f);}(_0xbafa,0x66));var _0xabaf=function(_0x130f4b,_0x1a227d){_0x130f4b=_0x130f4b-0x0;var _0x52fd13=_0xbafa[_0x130f4b];return _0x52fd13;};'use strict';var _=require(_0xabaf('0x0'));var util=require(_0xabaf('0x1'));var moment=require('moment');var BPromise=require(_0xabaf('0x2'));var rs=require(_0xabaf('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xabaf('0x4'));var logger=require('../../config/logger')(_0xabaf('0x5'));var config=require('../../config/environment');var jayson=require(_0xabaf('0x6'));var client=jayson[_0xabaf('0x7')][_0xabaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29f5ea,_0x5c8227,_0x239b5c){return new BPromise(function(_0x49e015,_0x1843e3){return client[_0xabaf('0x9')](_0x29f5ea,_0x239b5c)[_0xabaf('0xa')](function(_0x1ff856){logger[_0xabaf('0xb')](_0xabaf('0xc'),_0x5c8227,_0xabaf('0xd'));logger[_0xabaf('0xe')](_0xabaf('0xf'),_0x5c8227,_0xabaf('0xd'),JSON[_0xabaf('0x10')](_0x1ff856));if(_0x1ff856[_0xabaf('0x11')]){if(_0x1ff856[_0xabaf('0x11')][_0xabaf('0x12')]===0x1f4){logger[_0xabaf('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5c8227,_0x1ff856[_0xabaf('0x11')][_0xabaf('0x13')]);return _0x1843e3(_0x1ff856[_0xabaf('0x11')][_0xabaf('0x13')]);}logger['error'](_0xabaf('0xc'),_0x5c8227,_0x1ff856[_0xabaf('0x11')][_0xabaf('0x13')]);return _0x49e015(_0x1ff856[_0xabaf('0x11')][_0xabaf('0x13')]);}else{logger[_0xabaf('0xb')](_0xabaf('0xc'),_0x5c8227,_0xabaf('0xd'));_0x49e015(_0x1ff856[_0xabaf('0x14')][_0xabaf('0x13')]);}})[_0xabaf('0x15')](function(_0x5b96a6){logger[_0xabaf('0x11')](_0xabaf('0xc'),_0x5c8227,_0x5b96a6);_0x1843e3(_0x5b96a6);});});} \ No newline at end of file +var _0x8d41=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x182d07,_0x276b39){var _0x190b9c=function(_0x53f3ff){while(--_0x53f3ff){_0x182d07['push'](_0x182d07['shift']());}};_0x190b9c(++_0x276b39);}(_0x8d41,0x167));var _0x18d4=function(_0x49372d,_0x21e0bf){_0x49372d=_0x49372d-0x0;var _0x4cccf9=_0x8d41[_0x49372d];return _0x4cccf9;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var db=require(_0x18d4('0x5'))['db'];var utils=require(_0x18d4('0x6'));var logger=require('../../config/logger')(_0x18d4('0x7'));var config=require(_0x18d4('0x8'));var jayson=require(_0x18d4('0x9'));var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d5381,_0x396f5c,_0x181e10){return new BPromise(function(_0x51539d,_0x2e1962){return client[_0x18d4('0xc')](_0x2d5381,_0x181e10)[_0x18d4('0xd')](function(_0x3dc017){logger[_0x18d4('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x396f5c,_0x18d4('0xf'));logger[_0x18d4('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x396f5c,_0x18d4('0xf'),JSON[_0x18d4('0x11')](_0x3dc017));if(_0x3dc017[_0x18d4('0x12')]){if(_0x3dc017['error'][_0x18d4('0x13')]===0x1f4){logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x3dc017['error'][_0x18d4('0x15')]);return _0x2e1962(_0x3dc017['error']['message']);}logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x3dc017[_0x18d4('0x12')][_0x18d4('0x15')]);return _0x51539d(_0x3dc017[_0x18d4('0x12')][_0x18d4('0x15')]);}else{logger['info'](_0x18d4('0x14'),_0x396f5c,_0x18d4('0xf'));_0x51539d(_0x3dc017[_0x18d4('0x16')][_0x18d4('0x15')]);}})[_0x18d4('0x17')](function(_0x5ac869){logger[_0x18d4('0x12')](_0x18d4('0x14'),_0x396f5c,_0x5ac869);_0x2e1962(_0x5ac869);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a438d4b..8dcbf04 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 _0x831e=['../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express','../../components/auth/service'];(function(_0x55fc03,_0x43ce48){var _0x5bf429=function(_0xa06468){while(--_0xa06468){_0x55fc03['push'](_0x55fc03['shift']());}};_0x5bf429(++_0x43ce48);}(_0x831e,0xb0));var _0xe831=function(_0x23c57e,_0x53acbc){_0x23c57e=_0x23c57e-0x0;var _0x4ae14c=_0x831e[_0x23c57e];return _0x4ae14c;};'use strict';var multer=require(_0xe831('0x0'));var util=require('util');var path=require(_0xe831('0x1'));var express=require(_0xe831('0x2'));var router=express['Router']();var auth=require(_0xe831('0x3'));var interaction=require(_0xe831('0x4'));var config=require(_0xe831('0x5'));var controller=require(_0xe831('0x6'));router[_0xe831('0x7')]('/',auth[_0xe831('0x8')](),controller[_0xe831('0x9')]);router[_0xe831('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xe831('0xa')]);router[_0xe831('0x7')](_0xe831('0xb'),auth[_0xe831('0x8')](),controller[_0xe831('0xc')]);router[_0xe831('0xd')]('/',auth['isAuthenticated'](),controller[_0xe831('0xe')]);router[_0xe831('0xf')](_0xe831('0xb'),auth[_0xe831('0x8')](),controller[_0xe831('0x10')]);router[_0xe831('0x11')](_0xe831('0xb'),auth[_0xe831('0x8')](),controller[_0xe831('0x12')]);module[_0xe831('0x13')]=router; \ No newline at end of file +var _0x9120=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x556bb1,_0x34830d){var _0x45455f=function(_0x13c6ba){while(--_0x13c6ba){_0x556bb1['push'](_0x556bb1['shift']());}};_0x45455f(++_0x34830d);}(_0x9120,0x105));var _0x0912=function(_0x492532,_0x4c7a29){_0x492532=_0x492532-0x0;var _0x1832b0=_0x9120[_0x492532];return _0x1832b0;};'use strict';var multer=require(_0x0912('0x0'));var util=require('util');var path=require(_0x0912('0x1'));var express=require('express');var router=express[_0x0912('0x2')]();var auth=require(_0x0912('0x3'));var interaction=require(_0x0912('0x4'));var config=require(_0x0912('0x5'));var controller=require('./chatOfflineMessage.controller');router[_0x0912('0x6')]('/',auth[_0x0912('0x7')](),controller[_0x0912('0x8')]);router[_0x0912('0x6')](_0x0912('0x9'),auth[_0x0912('0x7')](),controller[_0x0912('0xa')]);router['get'](_0x0912('0xb'),auth[_0x0912('0x7')](),controller[_0x0912('0xc')]);router[_0x0912('0xd')]('/',auth['isAuthenticated'](),controller[_0x0912('0xe')]);router[_0x0912('0xf')]('/:id',auth[_0x0912('0x7')](),controller[_0x0912('0x10')]);router['delete'](_0x0912('0xb'),auth[_0x0912('0x7')](),controller[_0x0912('0x11')]);module[_0x0912('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 b549b84..5e373ba 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 _0x014b=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x014b,0x1a8));var _0xb014=function(_0x372d03,_0x5582b5){_0x372d03=_0x372d03-0x0;var _0xa04a5=_0x014b[_0x372d03];return _0xa04a5;};'use strict';var Sequelize=require(_0xb014('0x0'));module[_0xb014('0x1')]={'name':{'type':Sequelize[_0xb014('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb014('0x3')](_0xb014('0x4'),_0xb014('0x5')),'defaultValue':_0xb014('0x4')},'selector':{'type':Sequelize[_0xb014('0x2')]},'timeout':{'type':Sequelize[_0xb014('0x6')]}}; \ No newline at end of file +var _0x1c38=['mouseOver','INTEGER','exports','STRING','ENUM','timeout'];(function(_0xefc533,_0x508444){var _0x63cfb8=function(_0x2a28fe){while(--_0x2a28fe){_0xefc533['push'](_0xefc533['shift']());}};_0x63cfb8(++_0x508444);}(_0x1c38,0x188));var _0x81c3=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x1c38[_0x471a85];return _0x5f2039;};'use strict';var Sequelize=require('sequelize');module[_0x81c3('0x0')]={'name':{'type':Sequelize[_0x81c3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x81c3('0x2')]('mouseOver',_0x81c3('0x3')),'defaultValue':_0x81c3('0x4')},'selector':{'type':Sequelize[_0x81c3('0x1')]},'timeout':{'type':Sequelize[_0x81c3('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 67b5a56..233059e 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 _0xde36=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','filters','attributes','fields','query','length','includeAll','include','find','create','body','catch','fast-json-patch','request-promise','bluebird','util','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x40c512,_0x46a335){var _0x2bf9b9=function(_0x1ec1c3){while(--_0x1ec1c3){_0x40c512['push'](_0x40c512['shift']());}};_0x2bf9b9(++_0x46a335);}(_0xde36,0x1a5));var _0x6de3=function(_0x32636e,_0x46af59){_0x32636e=_0x32636e-0x0;var _0x493655=_0xde36[_0x32636e];return _0x493655;};'use strict';var jsonpatch=require(_0x6de3('0x0'));var rp=require(_0x6de3('0x1'));var moment=require('moment');var BPromise=require(_0x6de3('0x2'));var Mustache=require('mustache');var util=require(_0x6de3('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x6de3('0x4'));var ejs=require(_0x6de3('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6de3('0x6'));var crypto=require(_0x6de3('0x7'));var jsforce=require(_0x6de3('0x8'));var deskjs=require(_0x6de3('0x9'));var toCsv=require(_0x6de3('0x4'));var querystring=require('querystring');var Papa=require(_0x6de3('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x6de3('0xb'))(_0x6de3('0xc'));var utils=require(_0x6de3('0xd'));var config=require(_0x6de3('0xe'));var db=require(_0x6de3('0xf'))['db'];function respondWithStatusCode(_0x25b0a5,_0x18b973){_0x18b973=_0x18b973||0xcc;return function(_0x37b3c3){if(_0x37b3c3){return _0x25b0a5['sendStatus'](_0x18b973);}return _0x25b0a5[_0x6de3('0x10')](_0x18b973)[_0x6de3('0x11')]();};}function respondWithResult(_0x35385a,_0xfdd2d){_0xfdd2d=_0xfdd2d||0xc8;return function(_0x65d428){if(_0x65d428){return _0x35385a['status'](_0xfdd2d)[_0x6de3('0x12')](_0x65d428);}};}function respondWithFilteredResult(_0x311094,_0xd51905){return function(_0x4732fb){if(_0x4732fb){var _0xf48d17=_0x4732fb[_0x6de3('0x13')],_0x9ef47e=_0xd51905[_0x6de3('0x14')],_0x509f6c=_0xd51905[_0x6de3('0x14')]+_0xd51905['limit'],_0x140271;if(_0x509f6c>=_0xf48d17){_0x509f6c=_0xf48d17;_0x140271=0xc8;}else{_0x140271=0xce;}_0x311094[_0x6de3('0x10')](_0x140271);return _0x311094[_0x6de3('0x15')](_0x6de3('0x16'),_0x9ef47e+'-'+_0x509f6c+'/'+_0xf48d17)[_0x6de3('0x12')](_0x4732fb);}return null;};}function patchUpdates(_0xeb5175){return function(_0x50d1bd){try{jsonpatch[_0x6de3('0x17')](_0x50d1bd,_0xeb5175,!![]);}catch(_0x268c48){return BPromise[_0x6de3('0x18')](_0x268c48);}return _0x50d1bd['save']();};}function saveUpdates(_0x447f07,_0x1cc286){return function(_0x22a9ae){if(_0x22a9ae){return _0x22a9ae[_0x6de3('0x19')](_0x447f07)[_0x6de3('0x1a')](function(_0x2dd3d3){return _0x2dd3d3;});}return null;};}function removeEntity(_0xfb1496,_0x5580d4){return function(_0x123a0c){if(_0x123a0c){return _0x123a0c[_0x6de3('0x1b')]()['then'](function(){_0xfb1496[_0x6de3('0x10')](0xcc)[_0x6de3('0x11')]();});}};}function handleEntityNotFound(_0x5488dc,_0x4ee51d){return function(_0x48a16f){if(!_0x48a16f){_0x5488dc[_0x6de3('0x1c')](0x194);}return _0x48a16f;};}function handleError(_0x195db1,_0x3bff0e){_0x3bff0e=_0x3bff0e||0x1f4;return function(_0x4caea6){logger['error'](_0x4caea6[_0x6de3('0x1d')]);if(_0x4caea6[_0x6de3('0x1e')]){delete _0x4caea6[_0x6de3('0x1e')];}_0x195db1[_0x6de3('0x10')](_0x3bff0e)['send'](_0x4caea6);};}exports[_0x6de3('0x1f')]=function(_0x2bcb5d,_0x56a5a4){var _0x2ba4c3={'raw':!![],'where':{'id':_0x2bcb5d[_0x6de3('0x20')]['id']}},_0x14bfd6={};_0x14bfd6[_0x6de3('0x21')]=_[_0x6de3('0x22')](db[_0x6de3('0x23')][_0x6de3('0x24')]);_0x14bfd6['query']=_[_0x6de3('0x22')](_0x2bcb5d['query']);_0x14bfd6[_0x6de3('0x25')]=_['intersection'](_0x14bfd6['model'],_0x14bfd6['query']);_0x2ba4c3[_0x6de3('0x26')]=_['intersection'](_0x14bfd6[_0x6de3('0x21')],qs[_0x6de3('0x27')](_0x2bcb5d[_0x6de3('0x28')][_0x6de3('0x27')]));_0x2ba4c3[_0x6de3('0x26')]=_0x2ba4c3[_0x6de3('0x26')][_0x6de3('0x29')]?_0x2ba4c3[_0x6de3('0x26')]:_0x14bfd6[_0x6de3('0x21')];if(_0x2bcb5d[_0x6de3('0x28')][_0x6de3('0x2a')]){_0x2ba4c3[_0x6de3('0x2b')]=[{'all':!![]}];}_0x2ba4c3=_['merge']({},_0x2ba4c3,_0x2bcb5d['options']);return db['ChatProactiveAction'][_0x6de3('0x2c')](_0x2ba4c3)[_0x6de3('0x1a')](handleEntityNotFound(_0x56a5a4,null))[_0x6de3('0x1a')](respondWithResult(_0x56a5a4,null))['catch'](handleError(_0x56a5a4,null));};exports['create']=function(_0x2cbe16,_0x3dc0e8){return db[_0x6de3('0x23')][_0x6de3('0x2d')](_0x2cbe16[_0x6de3('0x2e')],{})[_0x6de3('0x1a')](respondWithResult(_0x3dc0e8,0xc9))['catch'](handleError(_0x3dc0e8,null));};exports[_0x6de3('0x19')]=function(_0x35ae05,_0x27d02c){if(_0x35ae05[_0x6de3('0x2e')]['id']){delete _0x35ae05[_0x6de3('0x2e')]['id'];}return db[_0x6de3('0x23')]['find']({'where':{'id':_0x35ae05[_0x6de3('0x20')]['id']}})['then'](handleEntityNotFound(_0x27d02c,null))[_0x6de3('0x1a')](saveUpdates(_0x35ae05['body'],null))[_0x6de3('0x1a')](respondWithResult(_0x27d02c,null))[_0x6de3('0x2f')](handleError(_0x27d02c,null));};exports[_0x6de3('0x1b')]=function(_0x2cbc90,_0x1407eb){return db[_0x6de3('0x23')]['find']({'where':{'id':_0x2cbc90['params']['id']}})['then'](handleEntityNotFound(_0x1407eb,null))[_0x6de3('0x1a')](removeEntity(_0x1407eb,null))[_0x6de3('0x2f')](handleError(_0x1407eb,null));}; \ No newline at end of file +var _0x1c7b=['../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','show','params','model','keys','ChatProactiveAction','query','intersection','attributes','length','includeAll','merge','options','find','catch','create','body','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0xbd5c37,_0x28ca54){var _0x4f6bc9=function(_0x3ea779){while(--_0x3ea779){_0xbd5c37['push'](_0xbd5c37['shift']());}};_0x4f6bc9(++_0x28ca54);}(_0x1c7b,0x1ba));var _0xb1c7=function(_0x17ffac,_0x131aa5){_0x17ffac=_0x17ffac-0x0;var _0x9c54cf=_0x1c7b[_0x17ffac];return _0x9c54cf;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xb1c7('0x0'));var moment=require(_0xb1c7('0x1'));var BPromise=require(_0xb1c7('0x2'));var Mustache=require(_0xb1c7('0x3'));var util=require(_0xb1c7('0x4'));var path=require('path');var sox=require(_0xb1c7('0x5'));var csv=require(_0xb1c7('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xb1c7('0x7'));var squel=require(_0xb1c7('0x8'));var crypto=require(_0xb1c7('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb1c7('0xa'));var toCsv=require(_0xb1c7('0x6'));var querystring=require(_0xb1c7('0xb'));var Papa=require(_0xb1c7('0xc'));var qs=require(_0xb1c7('0xd'));var logger=require(_0xb1c7('0xe'))(_0xb1c7('0xf'));var utils=require(_0xb1c7('0x10'));var config=require(_0xb1c7('0x11'));var db=require(_0xb1c7('0x12'))['db'];function respondWithStatusCode(_0x5577b8,_0x7c3adf){_0x7c3adf=_0x7c3adf||0xcc;return function(_0x2d7f37){if(_0x2d7f37){return _0x5577b8[_0xb1c7('0x13')](_0x7c3adf);}return _0x5577b8[_0xb1c7('0x14')](_0x7c3adf)[_0xb1c7('0x15')]();};}function respondWithResult(_0x588ac9,_0x5263f4){_0x5263f4=_0x5263f4||0xc8;return function(_0x39a88d){if(_0x39a88d){return _0x588ac9[_0xb1c7('0x14')](_0x5263f4)[_0xb1c7('0x16')](_0x39a88d);}};}function respondWithFilteredResult(_0x2d5c4d,_0x5aca06){return function(_0x116a55){if(_0x116a55){var _0x143c0d=_0x116a55[_0xb1c7('0x17')],_0x22b3ed=_0x5aca06['offset'],_0xf2b9b0=_0x5aca06[_0xb1c7('0x18')]+_0x5aca06[_0xb1c7('0x19')],_0x10e6ff;if(_0xf2b9b0>=_0x143c0d){_0xf2b9b0=_0x143c0d;_0x10e6ff=0xc8;}else{_0x10e6ff=0xce;}_0x2d5c4d[_0xb1c7('0x14')](_0x10e6ff);return _0x2d5c4d['set'](_0xb1c7('0x1a'),_0x22b3ed+'-'+_0xf2b9b0+'/'+_0x143c0d)[_0xb1c7('0x16')](_0x116a55);}return null;};}function patchUpdates(_0x9893c2){return function(_0x5dafbe){try{jsonpatch[_0xb1c7('0x1b')](_0x5dafbe,_0x9893c2,!![]);}catch(_0x4e8a0e){return BPromise['reject'](_0x4e8a0e);}return _0x5dafbe['save']();};}function saveUpdates(_0x36de8a,_0x53e0fe){return function(_0x29ffad){if(_0x29ffad){return _0x29ffad[_0xb1c7('0x1c')](_0x36de8a)[_0xb1c7('0x1d')](function(_0x2d2e2b){return _0x2d2e2b;});}return null;};}function removeEntity(_0x365895,_0x3d3bad){return function(_0x4262ed){if(_0x4262ed){return _0x4262ed[_0xb1c7('0x1e')]()[_0xb1c7('0x1d')](function(){_0x365895[_0xb1c7('0x14')](0xcc)[_0xb1c7('0x15')]();});}};}function handleEntityNotFound(_0x55bc39,_0x2e61ff){return function(_0x5c717a){if(!_0x5c717a){_0x55bc39[_0xb1c7('0x13')](0x194);}return _0x5c717a;};}function handleError(_0x3c0764,_0x2b9c15){_0x2b9c15=_0x2b9c15||0x1f4;return function(_0x29151b){logger[_0xb1c7('0x1f')](_0x29151b[_0xb1c7('0x20')]);if(_0x29151b[_0xb1c7('0x21')]){delete _0x29151b[_0xb1c7('0x21')];}_0x3c0764['status'](_0x2b9c15)[_0xb1c7('0x22')](_0x29151b);};}exports[_0xb1c7('0x23')]=function(_0x3bced6,_0x5bf3ad){var _0x2b2d06={'raw':!![],'where':{'id':_0x3bced6[_0xb1c7('0x24')]['id']}},_0x40f38={};_0x40f38[_0xb1c7('0x25')]=_[_0xb1c7('0x26')](db[_0xb1c7('0x27')]['rawAttributes']);_0x40f38[_0xb1c7('0x28')]=_[_0xb1c7('0x26')](_0x3bced6[_0xb1c7('0x28')]);_0x40f38['filters']=_[_0xb1c7('0x29')](_0x40f38[_0xb1c7('0x25')],_0x40f38['query']);_0x2b2d06['attributes']=_[_0xb1c7('0x29')](_0x40f38[_0xb1c7('0x25')],qs['fields'](_0x3bced6[_0xb1c7('0x28')]['fields']));_0x2b2d06['attributes']=_0x2b2d06[_0xb1c7('0x2a')][_0xb1c7('0x2b')]?_0x2b2d06[_0xb1c7('0x2a')]:_0x40f38[_0xb1c7('0x25')];if(_0x3bced6[_0xb1c7('0x28')][_0xb1c7('0x2c')]){_0x2b2d06['include']=[{'all':!![]}];}_0x2b2d06=_[_0xb1c7('0x2d')]({},_0x2b2d06,_0x3bced6[_0xb1c7('0x2e')]);return db['ChatProactiveAction'][_0xb1c7('0x2f')](_0x2b2d06)['then'](handleEntityNotFound(_0x5bf3ad,null))['then'](respondWithResult(_0x5bf3ad,null))[_0xb1c7('0x30')](handleError(_0x5bf3ad,null));};exports[_0xb1c7('0x31')]=function(_0x4eebba,_0x57d805){return db['ChatProactiveAction'][_0xb1c7('0x31')](_0x4eebba[_0xb1c7('0x32')],{})['then'](respondWithResult(_0x57d805,0xc9))[_0xb1c7('0x30')](handleError(_0x57d805,null));};exports['update']=function(_0x3d9b4d,_0x544034){if(_0x3d9b4d[_0xb1c7('0x32')]['id']){delete _0x3d9b4d['body']['id'];}return db['ChatProactiveAction'][_0xb1c7('0x2f')]({'where':{'id':_0x3d9b4d[_0xb1c7('0x24')]['id']}})[_0xb1c7('0x1d')](handleEntityNotFound(_0x544034,null))['then'](saveUpdates(_0x3d9b4d[_0xb1c7('0x32')],null))['then'](respondWithResult(_0x544034,null))['catch'](handleError(_0x544034,null));};exports[_0xb1c7('0x1e')]=function(_0x4c3e7f,_0x2517f2){return db[_0xb1c7('0x27')][_0xb1c7('0x2f')]({'where':{'id':_0x4c3e7f['params']['id']}})[_0xb1c7('0x1d')](handleEntityNotFound(_0x2517f2,null))[_0xb1c7('0x1d')](removeEntity(_0x2517f2,null))[_0xb1c7('0x30')](handleError(_0x2517f2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index b3b430b..9087afa 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 _0x0b0e=['chat_proactive_actions','lodash','../../config/logger','moment','bluebird','request-promise','./chatProactiveAction.attributes','exports','define','ChatProactiveAction'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x166e96,_0x55191d){_0x166e96=_0x166e96-0x0;var _0x553d73=_0x0b0e[_0x166e96];return _0x553d73;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var logger=require(_0xe0b0('0x1'))('api');var moment=require(_0xe0b0('0x2'));var BPromise=require(_0xe0b0('0x3'));var rp=require(_0xe0b0('0x4'));var attributes=require(_0xe0b0('0x5'));module[_0xe0b0('0x6')]=function(_0x38a058,_0x399e67){return _0x38a058[_0xe0b0('0x7')](_0xe0b0('0x8'),attributes,{'tableName':_0xe0b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda2d=['ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','define'];(function(_0x1fd67f,_0x1a8c30){var _0x5804bd=function(_0x50839f){while(--_0x50839f){_0x1fd67f['push'](_0x1fd67f['shift']());}};_0x5804bd(++_0x1a8c30);}(_0xda2d,0x102));var _0xdda2=function(_0x1abdd6,_0x267768){_0x1abdd6=_0x1abdd6-0x0;var _0x3e08a9=_0xda2d[_0x1abdd6];return _0x3e08a9;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var logger=require(_0xdda2('0x1'))(_0xdda2('0x2'));var moment=require(_0xdda2('0x3'));var BPromise=require(_0xdda2('0x4'));var rp=require('request-promise');var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x357e97,_0x319129){return _0x357e97[_0xdda2('0x5')](_0xdda2('0x6'),attributes,{'tableName':_0xdda2('0x7'),'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 6f0b741..819371d 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 _0x8bbf=['message','info','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','../../config/environment','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x1123bb,_0x54472a){var _0xdeb602=function(_0x529467){while(--_0x529467){_0x1123bb['push'](_0x1123bb['shift']());}};_0xdeb602(++_0x54472a);}(_0x8bbf,0xe3));var _0xf8bb=function(_0x3c051e,_0x3440c4){_0x3c051e=_0x3c051e-0x0;var _0x242a4d=_0x8bbf[_0x3c051e];return _0x242a4d;};'use strict';var _=require(_0xf8bb('0x0'));var util=require(_0xf8bb('0x1'));var moment=require('moment');var BPromise=require(_0xf8bb('0x2'));var rs=require(_0xf8bb('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf8bb('0x4'));var logger=require('../../config/logger')(_0xf8bb('0x5'));var config=require(_0xf8bb('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dc936,_0x42066d,_0x9a27de){return new BPromise(function(_0x5a510e,_0x52aed7){return client['request'](_0x5dc936,_0x9a27de)['then'](function(_0x3bdc72){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x42066d,_0xf8bb('0x7'));logger[_0xf8bb('0x8')](_0xf8bb('0x9'),_0x42066d,_0xf8bb('0x7'),JSON['stringify'](_0x3bdc72));if(_0x3bdc72[_0xf8bb('0xa')]){if(_0x3bdc72['error'][_0xf8bb('0xb')]===0x1f4){logger[_0xf8bb('0xa')](_0xf8bb('0xc'),_0x42066d,_0x3bdc72[_0xf8bb('0xa')][_0xf8bb('0xd')]);return _0x52aed7(_0x3bdc72['error'][_0xf8bb('0xd')]);}logger[_0xf8bb('0xa')](_0xf8bb('0xc'),_0x42066d,_0x3bdc72[_0xf8bb('0xa')][_0xf8bb('0xd')]);return _0x5a510e(_0x3bdc72[_0xf8bb('0xa')][_0xf8bb('0xd')]);}else{logger[_0xf8bb('0xe')](_0xf8bb('0xc'),_0x42066d,_0xf8bb('0x7'));_0x5a510e(_0x3bdc72['result']['message']);}})[_0xf8bb('0xf')](function(_0x203f9d){logger['error'](_0xf8bb('0xc'),_0x42066d,_0x203f9d);_0x52aed7(_0x203f9d);});});} \ No newline at end of file +var _0xfca0=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result'];(function(_0x2a6bc,_0x761a07){var _0x288d3a=function(_0x3c52d8){while(--_0x3c52d8){_0x2a6bc['push'](_0x2a6bc['shift']());}};_0x288d3a(++_0x761a07);}(_0xfca0,0x171));var _0x0fca=function(_0x1a940d,_0x398c3a){_0x1a940d=_0x1a940d-0x0;var _0x29c5b9=_0xfca0[_0x1a940d];return _0x29c5b9;};'use strict';var _=require(_0x0fca('0x0'));var util=require(_0x0fca('0x1'));var moment=require(_0x0fca('0x2'));var BPromise=require(_0x0fca('0x3'));var rs=require(_0x0fca('0x4'));var fs=require('fs');var db=require(_0x0fca('0x5'))['db'];var utils=require(_0x0fca('0x6'));var logger=require(_0x0fca('0x7'))('rpc');var config=require(_0x0fca('0x8'));var jayson=require(_0x0fca('0x9'));var client=jayson[_0x0fca('0xa')][_0x0fca('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x7324a6,_0x706948,_0x2bba5e){return new BPromise(function(_0x2a9c4d,_0x230b4b){return client[_0x0fca('0xc')](_0x7324a6,_0x2bba5e)[_0x0fca('0xd')](function(_0x43e7aa){logger[_0x0fca('0xe')](_0x0fca('0xf'),_0x706948,'request\x20sent');logger['debug'](_0x0fca('0x10'),_0x706948,_0x0fca('0x11'),JSON['stringify'](_0x43e7aa));if(_0x43e7aa[_0x0fca('0x12')]){if(_0x43e7aa['error'][_0x0fca('0x13')]===0x1f4){logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);return _0x230b4b(_0x43e7aa['error'][_0x0fca('0x14')]);}logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);return _0x2a9c4d(_0x43e7aa[_0x0fca('0x12')][_0x0fca('0x14')]);}else{logger[_0x0fca('0xe')](_0x0fca('0xf'),_0x706948,_0x0fca('0x11'));_0x2a9c4d(_0x43e7aa[_0x0fca('0x15')][_0x0fca('0x14')]);}})[_0x0fca('0x16')](function(_0x1222ce){logger[_0x0fca('0x12')](_0x0fca('0xf'),_0x706948,_0x1222ce);_0x230b4b(_0x1222ce);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 118202c..66cb817 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 _0x52a9=['multer','util','path','express','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x52a9,0x170));var _0x952a=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x52a9[_0x4b2863];return _0x567d67;};'use strict';var multer=require(_0x952a('0x0'));var util=require(_0x952a('0x1'));var path=require(_0x952a('0x2'));var express=require(_0x952a('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x952a('0x4'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x952a('0x5')](_0x952a('0x6'),auth[_0x952a('0x7')](),controller[_0x952a('0x8')]);router[_0x952a('0x9')]('/',auth[_0x952a('0x7')](),controller[_0x952a('0xa')]);router[_0x952a('0xb')](_0x952a('0x6'),auth[_0x952a('0x7')](),controller[_0x952a('0xc')]);router[_0x952a('0xd')](_0x952a('0x6'),auth[_0x952a('0x7')](),controller[_0x952a('0xe')]);module[_0x952a('0xf')]=router; \ No newline at end of file +var _0x902e=['post','create','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0xc7144d,_0x5c332c){var _0x3a4323=function(_0x588d92){while(--_0x588d92){_0xc7144d['push'](_0xc7144d['shift']());}};_0x3a4323(++_0x5c332c);}(_0x902e,0x126));var _0xe902=function(_0xe0b186,_0x3ae911){_0xe0b186=_0xe0b186-0x0;var _0x39a0c9=_0x902e[_0xe0b186];return _0x39a0c9;};'use strict';var multer=require(_0xe902('0x0'));var util=require(_0xe902('0x1'));var path=require(_0xe902('0x2'));var express=require(_0xe902('0x3'));var router=express['Router']();var auth=require(_0xe902('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe902('0x5'));var controller=require('./chatProactiveAction.controller');router[_0xe902('0x6')](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0x9')]);router[_0xe902('0xa')]('/',auth['isAuthenticated'](),controller[_0xe902('0xb')]);router[_0xe902('0xc')](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0xd')]);router['delete'](_0xe902('0x7'),auth[_0xe902('0x8')](),controller[_0xe902('0xe')]);module[_0xe902('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 3398929..489610c 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 _0x7d65=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x1f6ba3,_0x5b7a1d){var _0x218b24=function(_0x1fc7d7){while(--_0x1fc7d7){_0x1f6ba3['push'](_0x1f6ba3['shift']());}};_0x218b24(++_0x5b7a1d);}(_0x7d65,0xe9));var _0x57d6=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x7d65[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0x57d6('0x0'));module['exports']={'name':{'type':Sequelize[_0x57d6('0x1')],'unique':_0x57d6('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x57d6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x57d6('0x4')](_0x57d6('0x5'),_0x57d6('0x6'),_0x57d6('0x7'))}}; \ No newline at end of file +var _0x6bc8=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x189deb,_0x190457){var _0xda48f1=function(_0x544138){while(--_0x544138){_0x189deb['push'](_0x189deb['shift']());}};_0xda48f1(++_0x190457);}(_0x6bc8,0x104));var _0x86bc=function(_0x58653d,_0x5535d2){_0x58653d=_0x58653d-0x0;var _0x3e05f2=_0x6bc8[_0x58653d];return _0x3e05f2;};'use strict';var Sequelize=require(_0x86bc('0x0'));module[_0x86bc('0x1')]={'name':{'type':Sequelize[_0x86bc('0x2')],'unique':_0x86bc('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x86bc('0x2')]},'timeout':{'type':Sequelize[_0x86bc('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x86bc('0x5'),_0x86bc('0x6'),_0x86bc('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 7f500fd..d919838 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 _0x3c1a=['path','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','code','ChatQueue,\x20%s,\x20%s','error','result','message','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','ChatQueue','model','query','dateStart','dateEnd','keys','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','describe','getMembers','findOne','get','UserChatQueue','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','nolimit','addTeams','Agents','union','addAgents','penalty','ids','removeAgents','emit','userChatQueue:save','isArray','userChatQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x3c1a,0xda));var _0xa3c1=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x3c1a[_0x3db122];return _0x325b67;};'use strict';var jsonpatch=require(_0xa3c1('0x0'));var rp=require(_0xa3c1('0x1'));var moment=require(_0xa3c1('0x2'));var BPromise=require(_0xa3c1('0x3'));var Mustache=require(_0xa3c1('0x4'));var util=require(_0xa3c1('0x5'));var path=require(_0xa3c1('0x6'));var sox=require('sox');var csv=require(_0xa3c1('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa3c1('0x8'));var squel=require(_0xa3c1('0x9'));var crypto=require(_0xa3c1('0xa'));var jsforce=require(_0xa3c1('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3c1('0xc'));var Papa=require(_0xa3c1('0xd'));var qs=require(_0xa3c1('0xe'));var logger=require(_0xa3c1('0xf'))(_0xa3c1('0x10'));var utils=require('../../config/utils');var config=require(_0xa3c1('0x11'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require('./chatQueue.socket')[_0xa3c1('0x12')](socket);var jayson=require(_0xa3c1('0x13'));var client=jayson[_0xa3c1('0x14')][_0xa3c1('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x8d232d,_0x1ce473,_0x1ece52,_0x52adac){return new BPromise(function(_0x2d2499,_0x3b86be){var _0x26cab0=_0x52adac||client;return _0x26cab0[_0xa3c1('0x16')](_0x8d232d,_0x1ece52)[_0xa3c1('0x17')](function(_0x5af0fa){logger[_0xa3c1('0x18')]('ChatQueue,\x20%s,\x20%s',_0x1ce473,_0xa3c1('0x19'));logger[_0xa3c1('0x1a')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x1ce473,_0xa3c1('0x19'),JSON[_0xa3c1('0x1b')](_0x5af0fa));if(_0x5af0fa['error']){if(_0x5af0fa['error'][_0xa3c1('0x1c')]===0x1f4){logger['error'](_0xa3c1('0x1d'),_0x1ce473,_0x5af0fa['error']['message']);return _0x3b86be(_0x5af0fa[_0xa3c1('0x1e')]['message']);}logger['error'](_0xa3c1('0x1d'),_0x1ce473,_0x5af0fa[_0xa3c1('0x1e')]['message']);return _0x2d2499(_0x5af0fa['error']['message']);}else{logger[_0xa3c1('0x18')](_0xa3c1('0x1d'),_0x1ce473,_0xa3c1('0x19'));_0x2d2499(_0x5af0fa[_0xa3c1('0x1f')][_0xa3c1('0x20')]);}})['catch'](function(_0x2158ea){logger['error']('ChatQueue,\x20%s,\x20%s',_0x1ce473,_0x2158ea);_0x3b86be(_0x2158ea);});});}function respondWithStatusCode(_0x5ec5cf,_0x4f86f7){_0x4f86f7=_0x4f86f7||0xcc;return function(_0xedc4ff){if(_0xedc4ff){return _0x5ec5cf[_0xa3c1('0x21')](_0x4f86f7);}return _0x5ec5cf[_0xa3c1('0x22')](_0x4f86f7)[_0xa3c1('0x23')]();};}function respondWithResult(_0x558713,_0x1f04be){_0x1f04be=_0x1f04be||0xc8;return function(_0x300eef){if(_0x300eef){return _0x558713[_0xa3c1('0x22')](_0x1f04be)[_0xa3c1('0x24')](_0x300eef);}};}function respondWithFilteredResult(_0x504106,_0x4c4b49){return function(_0x393c93){if(_0x393c93){var _0x4fcc7e=_0x393c93[_0xa3c1('0x25')],_0x34569c=_0x4c4b49[_0xa3c1('0x26')],_0x353fb6=_0x4c4b49[_0xa3c1('0x26')]+_0x4c4b49[_0xa3c1('0x27')],_0x3194fa;if(_0x353fb6>=_0x4fcc7e){_0x353fb6=_0x4fcc7e;_0x3194fa=0xc8;}else{_0x3194fa=0xce;}_0x504106[_0xa3c1('0x22')](_0x3194fa);return _0x504106['set'](_0xa3c1('0x28'),_0x34569c+'-'+_0x353fb6+'/'+_0x4fcc7e)[_0xa3c1('0x24')](_0x393c93);}return null;};}function patchUpdates(_0x5dd531){return function(_0x21ea8f){try{jsonpatch[_0xa3c1('0x29')](_0x21ea8f,_0x5dd531,!![]);}catch(_0x12e7a5){return BPromise[_0xa3c1('0x2a')](_0x12e7a5);}return _0x21ea8f[_0xa3c1('0x2b')]();};}function saveUpdates(_0x3d440f,_0x20cbe2){return function(_0x172fe7){if(_0x172fe7){return _0x172fe7[_0xa3c1('0x2c')](_0x3d440f)[_0xa3c1('0x17')](function(_0x257afe){return _0x257afe;});}return null;};}function removeEntity(_0x15660c,_0x4cde8c){return function(_0x157c08){if(_0x157c08){return _0x157c08[_0xa3c1('0x2d')]()[_0xa3c1('0x17')](function(){_0x15660c[_0xa3c1('0x22')](0xcc)[_0xa3c1('0x23')]();});}};}function handleEntityNotFound(_0x19e4be,_0x4391b9){return function(_0x38a804){if(!_0x38a804){_0x19e4be[_0xa3c1('0x21')](0x194);}return _0x38a804;};}function handleError(_0x5a0184,_0xa4aae6){_0xa4aae6=_0xa4aae6||0x1f4;return function(_0x474583){logger[_0xa3c1('0x1e')](_0x474583[_0xa3c1('0x2e')]);if(_0x474583[_0xa3c1('0x2f')]){delete _0x474583[_0xa3c1('0x2f')];}_0x5a0184[_0xa3c1('0x22')](_0xa4aae6)[_0xa3c1('0x30')](_0x474583);};}exports[_0xa3c1('0x31')]=function(_0x3580ab,_0x14e798){var _0x2250e3={},_0xee1997={},_0x5dc761={'count':0x0,'rows':[]};var _0x45bfe0=db[_0xa3c1('0x32')]['rawAttributes'];_0xee1997[_0xa3c1('0x33')]=_['keys'](_0x45bfe0);var _0x4b18da={'dateStart':_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x35')],'dateEnd':_0x3580ab['query'][_0xa3c1('0x36')]};delete _0x3580ab['query']['dateStart'];delete _0x3580ab['query'][_0xa3c1('0x36')];_0xee1997['query']=_[_0xa3c1('0x37')](_0x3580ab[_0xa3c1('0x34')]);_0xee1997['filters']=_['intersection'](_0xee1997[_0xa3c1('0x33')],_0xee1997[_0xa3c1('0x34')]);_0x2250e3[_0xa3c1('0x38')]=_['intersection'](_0xee1997[_0xa3c1('0x33')],qs[_0xa3c1('0x39')](_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x39')]));_0x2250e3['attributes']=_0x2250e3[_0xa3c1('0x38')][_0xa3c1('0x3a')]?_0x2250e3[_0xa3c1('0x38')]:_0xee1997[_0xa3c1('0x33')];if(!_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x3b')]('nolimit')){_0x2250e3[_0xa3c1('0x27')]=qs['limit'](_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x27')]);_0x2250e3[_0xa3c1('0x26')]=qs[_0xa3c1('0x26')](_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x26')]);}_0x2250e3[_0xa3c1('0x3c')]=qs['sort'](_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x3d')]);_0x2250e3[_0xa3c1('0x3e')]=qs[_0xa3c1('0x3f')](_[_0xa3c1('0x40')](_0x3580ab[_0xa3c1('0x34')],_0xee1997[_0xa3c1('0x3f')]));if(_0x4b18da[_0xa3c1('0x35')]){if(_0x4b18da['dateEnd']){_0x4b18da['dateEnd']=moment(_0x4b18da[_0xa3c1('0x36')])[_0xa3c1('0x41')](0x1,_0xa3c1('0x42'));}else{_0x4b18da[_0xa3c1('0x36')]=moment(_0x4b18da[_0xa3c1('0x35')])[_0xa3c1('0x41')](0x1,'day');}_[_0xa3c1('0x43')](_0x2250e3[_0xa3c1('0x3e')],{'createdAt':{'$gte':_0x4b18da[_0xa3c1('0x35')],'$lte':_0x4b18da[_0xa3c1('0x36')]}});}if(_0x3580ab[_0xa3c1('0x34')][_0xa3c1('0x44')]){_0x2250e3[_0xa3c1('0x3e')]=_[_0xa3c1('0x43')](_0x2250e3[_0xa3c1('0x3e')],{'$or':_[_0xa3c1('0x45')](_0x2250e3[_0xa3c1('0x38')],function(_0x3caa51){var _0x2f9794={};_0x2f9794[_0x3caa51]={'$like':'%'+_0x3580ab[_0xa3c1('0x34')]['filter']+'%'};return _0x2f9794;})});}_0x2250e3=_[_0xa3c1('0x43')]({},_0x2250e3,_0x3580ab[_0xa3c1('0x46')]);var _0x23f74d={'where':_0x2250e3[_0xa3c1('0x3e')]};return db[_0xa3c1('0x32')][_0xa3c1('0x25')](_0x23f74d)['then'](function(_0x4ecced){_0x5dc761['count']=_0x4ecced;if(_0x3580ab['query'][_0xa3c1('0x47')]){_0x2250e3[_0xa3c1('0x48')]=[{'all':!![]}];}return db[_0xa3c1('0x32')][_0xa3c1('0x49')](_0x2250e3);})['then'](function(_0x82b751){_0x5dc761[_0xa3c1('0x4a')]=_0x82b751;return _0x5dc761;})[_0xa3c1('0x17')](respondWithFilteredResult(_0x14e798,_0x2250e3))[_0xa3c1('0x4b')](handleError(_0x14e798,null));};exports[_0xa3c1('0x4c')]=function(_0x4b60a4,_0xd6a18c){var _0x1177aa={'raw':!![],'where':{'id':_0x4b60a4[_0xa3c1('0x4d')]['id']}},_0x39129f={};_0x39129f[_0xa3c1('0x33')]=_[_0xa3c1('0x37')](db[_0xa3c1('0x32')][_0xa3c1('0x4e')]);_0x39129f[_0xa3c1('0x34')]=_[_0xa3c1('0x37')](_0x4b60a4['query']);_0x39129f[_0xa3c1('0x3f')]=_[_0xa3c1('0x4f')](_0x39129f[_0xa3c1('0x33')],_0x39129f[_0xa3c1('0x34')]);_0x1177aa[_0xa3c1('0x38')]=_[_0xa3c1('0x4f')](_0x39129f[_0xa3c1('0x33')],qs['fields'](_0x4b60a4[_0xa3c1('0x34')][_0xa3c1('0x39')]));_0x1177aa[_0xa3c1('0x38')]=_0x1177aa[_0xa3c1('0x38')][_0xa3c1('0x3a')]?_0x1177aa[_0xa3c1('0x38')]:_0x39129f['model'];if(_0x4b60a4[_0xa3c1('0x34')]['includeAll']){_0x1177aa['include']=[{'all':!![]}];}_0x1177aa=_[_0xa3c1('0x43')]({},_0x1177aa,_0x4b60a4[_0xa3c1('0x46')]);return db[_0xa3c1('0x32')][_0xa3c1('0x50')](_0x1177aa)[_0xa3c1('0x17')](handleEntityNotFound(_0xd6a18c,null))[_0xa3c1('0x17')](respondWithResult(_0xd6a18c,null))[_0xa3c1('0x4b')](handleError(_0xd6a18c,null));};exports['create']=function(_0x2a7153,_0x3fb918){return db[_0xa3c1('0x32')][_0xa3c1('0x51')](_0x2a7153[_0xa3c1('0x52')],{})[_0xa3c1('0x17')](respondWithResult(_0x3fb918,0xc9))[_0xa3c1('0x4b')](handleError(_0x3fb918,null));};exports[_0xa3c1('0x2c')]=function(_0x5cfde5,_0x37e20b){if(_0x5cfde5[_0xa3c1('0x52')]['id']){delete _0x5cfde5[_0xa3c1('0x52')]['id'];}return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x5cfde5[_0xa3c1('0x4d')]['id']}})['then'](handleEntityNotFound(_0x37e20b,null))[_0xa3c1('0x17')](saveUpdates(_0x5cfde5[_0xa3c1('0x52')],null))['then'](respondWithResult(_0x37e20b,null))[_0xa3c1('0x4b')](handleError(_0x37e20b,null));};exports['destroy']=function(_0x383617,_0x5cbcc2){return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x383617[_0xa3c1('0x4d')]['id']}})[_0xa3c1('0x17')](handleEntityNotFound(_0x5cbcc2,null))[_0xa3c1('0x17')](removeEntity(_0x5cbcc2,null))[_0xa3c1('0x4b')](handleError(_0x5cbcc2,null));};exports[_0xa3c1('0x53')]=function(_0x5f05b9,_0x3e22d7){return db[_0xa3c1('0x32')][_0xa3c1('0x53')]()[_0xa3c1('0x17')](respondWithResult(_0x3e22d7,null))[_0xa3c1('0x4b')](handleError(_0x3e22d7,null));};exports[_0xa3c1('0x54')]=function(_0x6dd8c8,_0x5e9b88,_0x18e833){var _0x7fbe8d={'raw':!![],'where':{}},_0x35289e={},_0x114e13;return db[_0xa3c1('0x32')][_0xa3c1('0x55')]({'where':{'id':_0x6dd8c8[_0xa3c1('0x4d')]['id']}})[_0xa3c1('0x17')](handleEntityNotFound(_0x5e9b88,null))['then'](function(_0x47aef0){if(_0x47aef0){_0x114e13=_0x47aef0[_0xa3c1('0x56')]({'plain':!![]});_0x35289e[_0xa3c1('0x33')]=_['keys'](db['UserChatQueue'][_0xa3c1('0x4e')]);_0x35289e[_0xa3c1('0x34')]=_[_0xa3c1('0x37')](_0x6dd8c8[_0xa3c1('0x34')]);_0x35289e[_0xa3c1('0x3f')]=_[_0xa3c1('0x4f')](_0x35289e['model'],_0x35289e['query']);_0x7fbe8d[_0xa3c1('0x38')]=_[_0xa3c1('0x4f')](_0x35289e[_0xa3c1('0x33')],qs[_0xa3c1('0x39')](_0x6dd8c8['query'][_0xa3c1('0x39')]));_0x7fbe8d[_0xa3c1('0x38')]=_0x7fbe8d[_0xa3c1('0x38')][_0xa3c1('0x3a')]?_0x7fbe8d[_0xa3c1('0x38')]:_0x35289e[_0xa3c1('0x33')];if(!_0x6dd8c8['query'][_0xa3c1('0x3b')]('nolimit')){_0x7fbe8d['limit']=qs[_0xa3c1('0x27')](_0x6dd8c8[_0xa3c1('0x34')][_0xa3c1('0x27')]);_0x7fbe8d[_0xa3c1('0x26')]=qs[_0xa3c1('0x26')](_0x6dd8c8[_0xa3c1('0x34')][_0xa3c1('0x26')]);}_0x7fbe8d[_0xa3c1('0x3c')]=qs[_0xa3c1('0x3d')](_0x6dd8c8[_0xa3c1('0x34')]['sort']);_0x7fbe8d[_0xa3c1('0x3e')]=qs['filters'](_[_0xa3c1('0x40')](_0x6dd8c8[_0xa3c1('0x34')],_0x35289e[_0xa3c1('0x3f')]));_0x7fbe8d[_0xa3c1('0x3e')]['ChatQueueId']=_0x47aef0['id'];if(_0x6dd8c8[_0xa3c1('0x34')][_0xa3c1('0x44')]){_0x7fbe8d[_0xa3c1('0x3e')]=_[_0xa3c1('0x43')](_0x7fbe8d[_0xa3c1('0x3e')],{'$or':_[_0xa3c1('0x45')](_0x7fbe8d['attributes'],function(_0x38bb1e){var _0x40bfa2={};_0x40bfa2[_0x38bb1e]={'$like':'%'+_0x6dd8c8['query'][_0xa3c1('0x44')]+'%'};return _0x40bfa2;})});}_0x7fbe8d=_[_0xa3c1('0x43')]({},_0x7fbe8d,_0x6dd8c8['options']);return db[_0xa3c1('0x57')]['findAll'](_0x7fbe8d);}})[_0xa3c1('0x17')](function(_0x5d3cf7){if(_0x5d3cf7){return db[_0xa3c1('0x58')][_0xa3c1('0x59')]({'where':{'id':_[_0xa3c1('0x45')](_0x5d3cf7,_0xa3c1('0x5a')),'role':_0xa3c1('0x5b')},'attributes':['id','name',_0xa3c1('0x5c'),_0xa3c1('0x5d'),_0xa3c1('0x5e')]});}})[_0xa3c1('0x17')](function(_0x23fc6b){if(_0x23fc6b){return{'count':_0x23fc6b[_0xa3c1('0x25')],'rows':_[_0xa3c1('0x45')](_0x23fc6b['rows'],function(_0x13e17e){return{'membername':_0x13e17e[_0xa3c1('0x2f')],'UserId':_0x13e17e['id'],'queue_name':_0x114e13['name'],'ChatQueueId':_0x114e13['id'],'interface':util['format'](_0xa3c1('0x5f'),_0xa3c1('0x60'),_0x13e17e['name']),'penalty':0x0,'paused':_0x13e17e[_0xa3c1('0x5c')],'createdAt':_0x13e17e[_0xa3c1('0x5e')],'updatedAt':_0x13e17e[_0xa3c1('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa3c1('0x17')](respondWithFilteredResult(_0x5e9b88,_0x7fbe8d))[_0xa3c1('0x4b')](handleError(_0x5e9b88,null));};exports[_0xa3c1('0x61')]=function(_0x50540a,_0x535b5b,_0x212958){var _0x438f09={};var _0x2af59a={};var _0x393e9b;var _0x52f393;return db['ChatQueue'][_0xa3c1('0x55')]({'where':{'id':_0x50540a[_0xa3c1('0x4d')]['id']}})[_0xa3c1('0x17')](handleEntityNotFound(_0x535b5b,null))[_0xa3c1('0x17')](function(_0x121c55){if(_0x121c55){_0x393e9b=_0x121c55;_0x2af59a[_0xa3c1('0x33')]=_['keys'](db[_0xa3c1('0x62')][_0xa3c1('0x4e')]);_0x2af59a[_0xa3c1('0x34')]=_[_0xa3c1('0x37')](_0x50540a['query']);_0x2af59a[_0xa3c1('0x3f')]=_[_0xa3c1('0x4f')](_0x2af59a[_0xa3c1('0x33')],_0x2af59a[_0xa3c1('0x34')]);_0x438f09[_0xa3c1('0x38')]=_[_0xa3c1('0x4f')](_0x2af59a[_0xa3c1('0x33')],qs[_0xa3c1('0x39')](_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x39')]));_0x438f09[_0xa3c1('0x38')]=_0x438f09[_0xa3c1('0x38')][_0xa3c1('0x3a')]?_0x438f09[_0xa3c1('0x38')]:_0x2af59a[_0xa3c1('0x33')];_0x438f09[_0xa3c1('0x3c')]=qs['sort'](_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x3d')]);_0x438f09['where']=qs[_0xa3c1('0x3f')](_[_0xa3c1('0x40')](_0x50540a[_0xa3c1('0x34')],_0x2af59a[_0xa3c1('0x3f')]));if(_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x44')]){_0x438f09['where']=_[_0xa3c1('0x43')](_0x438f09[_0xa3c1('0x3e')],{'$or':_[_0xa3c1('0x45')](_0x438f09[_0xa3c1('0x38')],function(_0x3dc10a){var _0x388288={};_0x388288[_0x3dc10a]={'$like':'%'+_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x44')]+'%'};return _0x388288;})});}_0x438f09=_['merge']({},_0x438f09,_0x50540a[_0xa3c1('0x46')]);return _0x393e9b[_0xa3c1('0x61')](_0x438f09);}})[_0xa3c1('0x17')](function(_0x13a067){if(_0x13a067){_0x52f393=_0x13a067['length'];if(!_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x3b')](_0xa3c1('0x63'))){_0x438f09[_0xa3c1('0x27')]=qs[_0xa3c1('0x27')](_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x27')]);_0x438f09[_0xa3c1('0x26')]=qs[_0xa3c1('0x26')](_0x50540a[_0xa3c1('0x34')][_0xa3c1('0x26')]);}return _0x393e9b['getTeams'](_0x438f09);}})[_0xa3c1('0x17')](function(_0x53b1f8){if(_0x53b1f8){return _0x53b1f8?{'count':_0x52f393,'rows':_0x53b1f8}:null;}})[_0xa3c1('0x17')](respondWithResult(_0x535b5b,null))['catch'](handleError(_0x535b5b,null));};exports[_0xa3c1('0x64')]=function(_0x299cb9,_0x34acd2,_0xaee824){var _0x4bf8f9=[];var _0x4a7f2f;return db['Team'][_0xa3c1('0x49')]({'where':{'id':_0x299cb9[_0xa3c1('0x52')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa3c1('0x58')],'as':_0xa3c1('0x65'),'attributes':['id'],'raw':!![]}]})[_0xa3c1('0x17')](function(_0x19f215){if(_0x19f215){for(var _0x36fac8=0x0;_0x36fac8<_0x19f215[_0xa3c1('0x3a')];_0x36fac8+=0x1){for(var _0x14188f=0x0;_0x14188f<_0x19f215[_0x36fac8][_0xa3c1('0x65')][_0xa3c1('0x3a')];_0x14188f+=0x1){_0x4bf8f9=_[_0xa3c1('0x66')](_0x4bf8f9,[_0x19f215[_0x36fac8]['Agents'][_0x14188f]['id']]);}}return _0x4bf8f9;}})[_0xa3c1('0x17')](function(_0x3d91ec){if(_0x3d91ec){return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x299cb9[_0xa3c1('0x4d')]['id']}});}})[_0xa3c1('0x17')](function(_0x3cfc8b){if(_0x3cfc8b){_0x4a7f2f=_0x3cfc8b;return _0x4a7f2f[_0xa3c1('0x67')](_0x4bf8f9,{'penalty':_0x299cb9[_0xa3c1('0x52')][_0xa3c1('0x68')]});}})[_0xa3c1('0x17')](function(_0x444d6b){if(_0x444d6b){return _0x4a7f2f[_0xa3c1('0x64')](_0x299cb9[_0xa3c1('0x52')][_0xa3c1('0x69')]);}})[_0xa3c1('0x17')](handleEntityNotFound(_0x34acd2,null))[_0xa3c1('0x17')](respondWithStatusCode(_0x34acd2,null))['catch'](handleError(_0x34acd2,null));};exports['removeTeams']=function(_0x102bae,_0x4fd1b2,_0x28d85f){var _0x20fe2c=[];var _0x5201f4;return db['Team'][_0xa3c1('0x49')]({'where':{'id':_0x102bae[_0xa3c1('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0xa3c1('0x58')],'as':_0xa3c1('0x65'),'attributes':['id'],'raw':!![]}]})[_0xa3c1('0x17')](function(_0x487697){if(_0x487697){for(var _0x428534=0x0;_0x428534<_0x487697[_0xa3c1('0x3a')];_0x428534+=0x1){for(var _0x2ef557=0x0;_0x2ef557<_0x487697[_0x428534][_0xa3c1('0x65')]['length'];_0x2ef557+=0x1){_0x20fe2c=_[_0xa3c1('0x66')](_0x20fe2c,[_0x487697[_0x428534][_0xa3c1('0x65')][_0x2ef557]['id']]);}}return _0x20fe2c;}})['then'](function(_0x32d87a){if(_0x32d87a){return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x102bae['params']['id']}});}})[_0xa3c1('0x17')](function(_0x231b46){if(_0x231b46){_0x5201f4=_0x231b46;return _0x5201f4[_0xa3c1('0x6a')](_0x20fe2c);}})[_0xa3c1('0x17')](function(_0x572ad6){if(_0x5201f4){return _0x5201f4['removeTeams'](_0x102bae[_0xa3c1('0x34')][_0xa3c1('0x69')]);}})[_0xa3c1('0x17')](handleEntityNotFound(_0x4fd1b2,null))[_0xa3c1('0x17')](respondWithStatusCode(_0x4fd1b2,null))[_0xa3c1('0x4b')](handleError(_0x4fd1b2,null));};exports['addAgents']=function(_0x1cfa12,_0xd92f9e,_0x5a7035){return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x1cfa12['params']['id']}})[_0xa3c1('0x17')](handleEntityNotFound(_0xd92f9e,null))[_0xa3c1('0x17')](function(_0x77fe6a){if(_0x77fe6a){return _0x77fe6a[_0xa3c1('0x67')](_0x1cfa12['body'][_0xa3c1('0x69')],_['omit'](_0x1cfa12[_0xa3c1('0x52')],[_0xa3c1('0x69'),'id'])||{})['spread'](function(_0x58a1ca){for(var _0x9e700b=0x0;_0x9e700b<_0x1cfa12[_0xa3c1('0x52')][_0xa3c1('0x69')][_0xa3c1('0x3a')];_0x9e700b+=0x1){socket[_0xa3c1('0x6b')](_0xa3c1('0x6c'),{'UserId':_0x1cfa12['body'][_0xa3c1('0x69')][_0x9e700b],'ChatQueueId':_0x1cfa12[_0xa3c1('0x4d')]['id']});}return _0x58a1ca;});}})[_0xa3c1('0x17')](respondWithResult(_0xd92f9e,null))[_0xa3c1('0x4b')](handleError(_0xd92f9e,null));};exports['removeAgents']=function(_0x365769,_0x30ab57,_0x465034){var _0x3b0a64;return db[_0xa3c1('0x32')][_0xa3c1('0x50')]({'where':{'id':_0x365769['params']['id']}})['then'](handleEntityNotFound(_0x30ab57,null))[_0xa3c1('0x17')](function(_0x155017){if(_0x155017){return _0x155017[_0xa3c1('0x6a')](_0x365769[_0xa3c1('0x34')][_0xa3c1('0x69')])[_0xa3c1('0x17')](function(_0x59a40b){if(_[_0xa3c1('0x6d')](_0x365769[_0xa3c1('0x34')][_0xa3c1('0x69')])){for(var _0x23ccf0=0x0;_0x23ccf0<_0x365769[_0xa3c1('0x34')]['ids'][_0xa3c1('0x3a')];_0x23ccf0+=0x1){socket[_0xa3c1('0x6b')](_0xa3c1('0x6e'),{'UserId':_0x365769[_0xa3c1('0x34')][_0xa3c1('0x69')][_0x23ccf0],'ChatQueueId':_0x365769[_0xa3c1('0x4d')]['id']});}}else{socket['emit'](_0xa3c1('0x6e'),{'UserId':_0x365769[_0xa3c1('0x34')]['ids'],'ChatQueueId':_0x365769['params']['id']});}});}})[_0xa3c1('0x17')](respondWithStatusCode(_0x30ab57,null))[_0xa3c1('0x4b')](handleError(_0x30ab57,null));};exports[_0xa3c1('0x6f')]=function(_0xfec53d,_0x4da225,_0x517389){var _0x56f90b={};var _0x27a19b={};var _0x4eee7e;var _0x47d301;return db[_0xa3c1('0x32')][_0xa3c1('0x55')]({'where':{'id':_0xfec53d[_0xa3c1('0x4d')]['id']}})[_0xa3c1('0x17')](handleEntityNotFound(_0x4da225,null))[_0xa3c1('0x17')](function(_0x2b3e2f){if(_0x2b3e2f){_0x4eee7e=_0x2b3e2f;_0x27a19b['model']=_[_0xa3c1('0x37')](db['User'][_0xa3c1('0x4e')]);_0x27a19b[_0xa3c1('0x34')]=_['keys'](_0xfec53d[_0xa3c1('0x34')]);_0x27a19b[_0xa3c1('0x3f')]=_['intersection'](_0x27a19b[_0xa3c1('0x33')],_0x27a19b[_0xa3c1('0x34')]);_0x56f90b[_0xa3c1('0x38')]=_[_0xa3c1('0x4f')](_0x27a19b[_0xa3c1('0x33')],qs['fields'](_0xfec53d[_0xa3c1('0x34')]['fields']));_0x56f90b[_0xa3c1('0x38')]=_0x56f90b[_0xa3c1('0x38')]['length']?_0x56f90b[_0xa3c1('0x38')]:_0x27a19b[_0xa3c1('0x33')];_0x56f90b[_0xa3c1('0x3c')]=qs[_0xa3c1('0x3d')](_0xfec53d[_0xa3c1('0x34')]['sort']);_0x56f90b[_0xa3c1('0x3e')]=qs[_0xa3c1('0x3f')](_['pick'](_0xfec53d['query'],_0x27a19b[_0xa3c1('0x3f')]));if(_0xfec53d[_0xa3c1('0x34')][_0xa3c1('0x44')]){_0x56f90b['where']=_[_0xa3c1('0x43')](_0x56f90b[_0xa3c1('0x3e')],{'$or':_[_0xa3c1('0x45')](_0x56f90b[_0xa3c1('0x38')],function(_0x240367){var _0x2f36d5={};_0x2f36d5[_0x240367]={'$like':'%'+_0xfec53d[_0xa3c1('0x34')][_0xa3c1('0x44')]+'%'};return _0x2f36d5;})});}_0x56f90b=_[_0xa3c1('0x43')]({},_0x56f90b,_0xfec53d[_0xa3c1('0x46')]);return _0x4eee7e[_0xa3c1('0x6f')](_0x56f90b);}})['then'](function(_0x2852ad){if(_0x2852ad){_0x47d301=_0x2852ad[_0xa3c1('0x3a')];if(!_0xfec53d[_0xa3c1('0x34')]['hasOwnProperty'](_0xa3c1('0x63'))){_0x56f90b[_0xa3c1('0x27')]=qs['limit'](_0xfec53d['query']['limit']);_0x56f90b['offset']=qs['offset'](_0xfec53d[_0xa3c1('0x34')]['offset']);}return _0x4eee7e[_0xa3c1('0x6f')](_0x56f90b);}})[_0xa3c1('0x17')](function(_0x207813){if(_0x207813){return _0x207813?{'count':_0x47d301,'rows':_0x207813}:null;}})[_0xa3c1('0x17')](respondWithResult(_0x4da225,null))['catch'](handleError(_0x4da225,null));}; \ No newline at end of file +var _0x720e=['map','includeAll','include','catch','show','params','intersection','options','find','create','body','describe','getMembers','findOne','get','UserChatQueue','filter','User','findAndCountAll','agent','createdAt','rows','%s/%s','chatPause','updatedAt','Team','getTeams','findAll','ids','Agents','addAgents','penalty','addTeams','removeTeams','removeAgents','emit','userChatQueue:save','userChatQueue:remove','getAgents','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./chatQueue.socket','register','jayson/promise','client','request','then','request\x20sent','debug','stringify','error','ChatQueue,\x20%s,\x20%s','message','info','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','ChatQueue','rawAttributes','keys','query','dateStart','dateEnd','filters','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x720e,0x1cb));var _0xe720=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x720e[_0x37bd26];return _0xe83dc4;};'use strict';var jsonpatch=require(_0xe720('0x0'));var rp=require(_0xe720('0x1'));var moment=require(_0xe720('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe720('0x3'));var path=require('path');var sox=require(_0xe720('0x4'));var csv=require(_0xe720('0x5'));var ejs=require(_0xe720('0x6'));var fs=require('fs');var _=require(_0xe720('0x7'));var squel=require(_0xe720('0x8'));var crypto=require(_0xe720('0x9'));var jsforce=require(_0xe720('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xe720('0x5'));var querystring=require(_0xe720('0xb'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe720('0xc'));var utils=require(_0xe720('0xd'));var config=require(_0xe720('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0xe720('0xf'))({'host':_0xe720('0x10'),'port':0x18eb});require(_0xe720('0x11'))[_0xe720('0x12')](socket);var jayson=require(_0xe720('0x13'));var client=jayson[_0xe720('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d651f,_0x2dd7bc,_0x128830,_0x1a82cc){return new BPromise(function(_0xac0320,_0xea1a0a){var _0x42a109=_0x1a82cc||client;return _0x42a109[_0xe720('0x15')](_0x4d651f,_0x128830)[_0xe720('0x16')](function(_0x3b25e5){logger['info']('ChatQueue,\x20%s,\x20%s',_0x2dd7bc,_0xe720('0x17'));logger[_0xe720('0x18')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2dd7bc,_0xe720('0x17'),JSON[_0xe720('0x19')](_0x3b25e5));if(_0x3b25e5['error']){if(_0x3b25e5[_0xe720('0x1a')]['code']===0x1f4){logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x3b25e5['error'][_0xe720('0x1c')]);return _0xea1a0a(_0x3b25e5['error'][_0xe720('0x1c')]);}logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x3b25e5['error'][_0xe720('0x1c')]);return _0xac0320(_0x3b25e5['error'][_0xe720('0x1c')]);}else{logger[_0xe720('0x1d')](_0xe720('0x1b'),_0x2dd7bc,'request\x20sent');_0xac0320(_0x3b25e5['result'][_0xe720('0x1c')]);}})['catch'](function(_0x305438){logger[_0xe720('0x1a')](_0xe720('0x1b'),_0x2dd7bc,_0x305438);_0xea1a0a(_0x305438);});});}function respondWithStatusCode(_0xaa596f,_0xdb9b6){_0xdb9b6=_0xdb9b6||0xcc;return function(_0x3c1420){if(_0x3c1420){return _0xaa596f['sendStatus'](_0xdb9b6);}return _0xaa596f[_0xe720('0x1e')](_0xdb9b6)[_0xe720('0x1f')]();};}function respondWithResult(_0x4309a5,_0x47b367){_0x47b367=_0x47b367||0xc8;return function(_0x210a27){if(_0x210a27){return _0x4309a5[_0xe720('0x1e')](_0x47b367)[_0xe720('0x20')](_0x210a27);}};}function respondWithFilteredResult(_0xb7dc74,_0x35803c){return function(_0x1bca96){if(_0x1bca96){var _0x2c38ea=_0x1bca96[_0xe720('0x21')],_0x45d9ec=_0x35803c[_0xe720('0x22')],_0x3c5125=_0x35803c['offset']+_0x35803c[_0xe720('0x23')],_0xa49196;if(_0x3c5125>=_0x2c38ea){_0x3c5125=_0x2c38ea;_0xa49196=0xc8;}else{_0xa49196=0xce;}_0xb7dc74[_0xe720('0x1e')](_0xa49196);return _0xb7dc74[_0xe720('0x24')](_0xe720('0x25'),_0x45d9ec+'-'+_0x3c5125+'/'+_0x2c38ea)['json'](_0x1bca96);}return null;};}function patchUpdates(_0x28b6e2){return function(_0x3e9611){try{jsonpatch[_0xe720('0x26')](_0x3e9611,_0x28b6e2,!![]);}catch(_0x1ca67d){return BPromise[_0xe720('0x27')](_0x1ca67d);}return _0x3e9611[_0xe720('0x28')]();};}function saveUpdates(_0x388421,_0x360ac3){return function(_0x58ff8a){if(_0x58ff8a){return _0x58ff8a[_0xe720('0x29')](_0x388421)[_0xe720('0x16')](function(_0x4b2054){return _0x4b2054;});}return null;};}function removeEntity(_0x5166dc,_0x42d668){return function(_0x113b12){if(_0x113b12){return _0x113b12[_0xe720('0x2a')]()['then'](function(){_0x5166dc['status'](0xcc)[_0xe720('0x1f')]();});}};}function handleEntityNotFound(_0x3a107e,_0x2eb0db){return function(_0x5b641a){if(!_0x5b641a){_0x3a107e['sendStatus'](0x194);}return _0x5b641a;};}function handleError(_0x40efd7,_0x300eb8){_0x300eb8=_0x300eb8||0x1f4;return function(_0x21ed87){logger[_0xe720('0x1a')](_0x21ed87[_0xe720('0x2b')]);if(_0x21ed87[_0xe720('0x2c')]){delete _0x21ed87[_0xe720('0x2c')];}_0x40efd7[_0xe720('0x1e')](_0x300eb8)[_0xe720('0x2d')](_0x21ed87);};}exports['index']=function(_0x4edba6,_0x43e06a){var _0x4945d3={},_0x390429={},_0x166b24={'count':0x0,'rows':[]};var _0x2c38c9=db[_0xe720('0x2e')][_0xe720('0x2f')];_0x390429['model']=_[_0xe720('0x30')](_0x2c38c9);var _0x556807={'dateStart':_0x4edba6[_0xe720('0x31')][_0xe720('0x32')],'dateEnd':_0x4edba6[_0xe720('0x31')]['dateEnd']};delete _0x4edba6['query'][_0xe720('0x32')];delete _0x4edba6[_0xe720('0x31')][_0xe720('0x33')];_0x390429[_0xe720('0x31')]=_[_0xe720('0x30')](_0x4edba6['query']);_0x390429[_0xe720('0x34')]=_['intersection'](_0x390429['model'],_0x390429[_0xe720('0x31')]);_0x4945d3[_0xe720('0x35')]=_['intersection'](_0x390429[_0xe720('0x36')],qs[_0xe720('0x37')](_0x4edba6[_0xe720('0x31')][_0xe720('0x37')]));_0x4945d3[_0xe720('0x35')]=_0x4945d3['attributes'][_0xe720('0x38')]?_0x4945d3[_0xe720('0x35')]:_0x390429[_0xe720('0x36')];if(!_0x4edba6[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x4945d3[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x4edba6[_0xe720('0x31')][_0xe720('0x23')]);_0x4945d3[_0xe720('0x22')]=qs[_0xe720('0x22')](_0x4edba6[_0xe720('0x31')][_0xe720('0x22')]);}_0x4945d3[_0xe720('0x3b')]=qs[_0xe720('0x3c')](_0x4edba6['query'][_0xe720('0x3c')]);_0x4945d3[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x4edba6[_0xe720('0x31')],_0x390429[_0xe720('0x34')]));if(_0x556807[_0xe720('0x32')]){if(_0x556807[_0xe720('0x33')]){_0x556807[_0xe720('0x33')]=moment(_0x556807[_0xe720('0x33')])[_0xe720('0x3f')](0x1,'day');}else{_0x556807['dateEnd']=moment(_0x556807[_0xe720('0x32')])[_0xe720('0x3f')](0x1,_0xe720('0x40'));}_['merge'](_0x4945d3[_0xe720('0x3d')],{'createdAt':{'$gte':_0x556807['dateStart'],'$lte':_0x556807[_0xe720('0x33')]}});}if(_0x4edba6[_0xe720('0x31')]['filter']){_0x4945d3[_0xe720('0x3d')]=_[_0xe720('0x41')](_0x4945d3['where'],{'$or':_[_0xe720('0x42')](_0x4945d3[_0xe720('0x35')],function(_0x22f331){var _0x19823d={};_0x19823d[_0x22f331]={'$like':'%'+_0x4edba6[_0xe720('0x31')]['filter']+'%'};return _0x19823d;})});}_0x4945d3=_[_0xe720('0x41')]({},_0x4945d3,_0x4edba6['options']);var _0x14f66d={'where':_0x4945d3[_0xe720('0x3d')]};return db[_0xe720('0x2e')][_0xe720('0x21')](_0x14f66d)['then'](function(_0x469590){_0x166b24[_0xe720('0x21')]=_0x469590;if(_0x4edba6[_0xe720('0x31')][_0xe720('0x43')]){_0x4945d3[_0xe720('0x44')]=[{'all':!![]}];}return db[_0xe720('0x2e')]['findAll'](_0x4945d3);})[_0xe720('0x16')](function(_0x127a92){_0x166b24['rows']=_0x127a92;return _0x166b24;})[_0xe720('0x16')](respondWithFilteredResult(_0x43e06a,_0x4945d3))[_0xe720('0x45')](handleError(_0x43e06a,null));};exports[_0xe720('0x46')]=function(_0x485739,_0x2ac7ab){var _0x17a395={'raw':!![],'where':{'id':_0x485739[_0xe720('0x47')]['id']}},_0x2278d5={};_0x2278d5[_0xe720('0x36')]=_['keys'](db[_0xe720('0x2e')]['rawAttributes']);_0x2278d5[_0xe720('0x31')]=_[_0xe720('0x30')](_0x485739['query']);_0x2278d5[_0xe720('0x34')]=_[_0xe720('0x48')](_0x2278d5[_0xe720('0x36')],_0x2278d5[_0xe720('0x31')]);_0x17a395[_0xe720('0x35')]=_[_0xe720('0x48')](_0x2278d5['model'],qs[_0xe720('0x37')](_0x485739['query'][_0xe720('0x37')]));_0x17a395['attributes']=_0x17a395[_0xe720('0x35')][_0xe720('0x38')]?_0x17a395[_0xe720('0x35')]:_0x2278d5['model'];if(_0x485739['query'][_0xe720('0x43')]){_0x17a395[_0xe720('0x44')]=[{'all':!![]}];}_0x17a395=_[_0xe720('0x41')]({},_0x17a395,_0x485739[_0xe720('0x49')]);return db[_0xe720('0x2e')][_0xe720('0x4a')](_0x17a395)[_0xe720('0x16')](handleEntityNotFound(_0x2ac7ab,null))[_0xe720('0x16')](respondWithResult(_0x2ac7ab,null))[_0xe720('0x45')](handleError(_0x2ac7ab,null));};exports['create']=function(_0x2acfb7,_0x32b21c){return db['ChatQueue'][_0xe720('0x4b')](_0x2acfb7[_0xe720('0x4c')],{})[_0xe720('0x16')](respondWithResult(_0x32b21c,0xc9))[_0xe720('0x45')](handleError(_0x32b21c,null));};exports[_0xe720('0x29')]=function(_0x567560,_0x191d9c){if(_0x567560['body']['id']){delete _0x567560[_0xe720('0x4c')]['id'];}return db[_0xe720('0x2e')]['find']({'where':{'id':_0x567560[_0xe720('0x47')]['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x191d9c,null))[_0xe720('0x16')](saveUpdates(_0x567560[_0xe720('0x4c')],null))[_0xe720('0x16')](respondWithResult(_0x191d9c,null))[_0xe720('0x45')](handleError(_0x191d9c,null));};exports[_0xe720('0x2a')]=function(_0x4cddcb,_0x23bb98){return db[_0xe720('0x2e')][_0xe720('0x4a')]({'where':{'id':_0x4cddcb['params']['id']}})['then'](handleEntityNotFound(_0x23bb98,null))[_0xe720('0x16')](removeEntity(_0x23bb98,null))[_0xe720('0x45')](handleError(_0x23bb98,null));};exports[_0xe720('0x4d')]=function(_0x25ccee,_0x435161){return db[_0xe720('0x2e')][_0xe720('0x4d')]()[_0xe720('0x16')](respondWithResult(_0x435161,null))[_0xe720('0x45')](handleError(_0x435161,null));};exports[_0xe720('0x4e')]=function(_0x643c5c,_0x4b9f73,_0x18993b){var _0x21742a={'raw':!![],'where':{}},_0x3dd8c1={},_0x198ad1;return db[_0xe720('0x2e')][_0xe720('0x4f')]({'where':{'id':_0x643c5c['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x4b9f73,null))['then'](function(_0x20d1a1){if(_0x20d1a1){_0x198ad1=_0x20d1a1[_0xe720('0x50')]({'plain':!![]});_0x3dd8c1['model']=_['keys'](db[_0xe720('0x51')][_0xe720('0x2f')]);_0x3dd8c1[_0xe720('0x31')]=_[_0xe720('0x30')](_0x643c5c[_0xe720('0x31')]);_0x3dd8c1[_0xe720('0x34')]=_['intersection'](_0x3dd8c1[_0xe720('0x36')],_0x3dd8c1[_0xe720('0x31')]);_0x21742a[_0xe720('0x35')]=_[_0xe720('0x48')](_0x3dd8c1[_0xe720('0x36')],qs[_0xe720('0x37')](_0x643c5c[_0xe720('0x31')][_0xe720('0x37')]));_0x21742a[_0xe720('0x35')]=_0x21742a[_0xe720('0x35')]['length']?_0x21742a[_0xe720('0x35')]:_0x3dd8c1[_0xe720('0x36')];if(!_0x643c5c[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x21742a[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x643c5c['query'][_0xe720('0x23')]);_0x21742a['offset']=qs[_0xe720('0x22')](_0x643c5c[_0xe720('0x31')][_0xe720('0x22')]);}_0x21742a['order']=qs[_0xe720('0x3c')](_0x643c5c[_0xe720('0x31')]['sort']);_0x21742a['where']=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x643c5c[_0xe720('0x31')],_0x3dd8c1['filters']));_0x21742a['where']['ChatQueueId']=_0x20d1a1['id'];if(_0x643c5c[_0xe720('0x31')][_0xe720('0x52')]){_0x21742a['where']=_[_0xe720('0x41')](_0x21742a['where'],{'$or':_[_0xe720('0x42')](_0x21742a['attributes'],function(_0x2fab72){var _0x173ea8={};_0x173ea8[_0x2fab72]={'$like':'%'+_0x643c5c[_0xe720('0x31')][_0xe720('0x52')]+'%'};return _0x173ea8;})});}_0x21742a=_[_0xe720('0x41')]({},_0x21742a,_0x643c5c[_0xe720('0x49')]);return db['UserChatQueue']['findAll'](_0x21742a);}})[_0xe720('0x16')](function(_0x31a442){if(_0x31a442){return db[_0xe720('0x53')][_0xe720('0x54')]({'where':{'id':_['map'](_0x31a442,'UserId'),'role':_0xe720('0x55')},'attributes':['id',_0xe720('0x2c'),'chatPause','updatedAt',_0xe720('0x56')]});}})[_0xe720('0x16')](function(_0x146c91){if(_0x146c91){return{'count':_0x146c91[_0xe720('0x21')],'rows':_[_0xe720('0x42')](_0x146c91[_0xe720('0x57')],function(_0x51431b){return{'membername':_0x51431b[_0xe720('0x2c')],'UserId':_0x51431b['id'],'queue_name':_0x198ad1[_0xe720('0x2c')],'ChatQueueId':_0x198ad1['id'],'interface':util['format'](_0xe720('0x58'),'SIP',_0x51431b[_0xe720('0x2c')]),'penalty':0x0,'paused':_0x51431b[_0xe720('0x59')],'createdAt':_0x51431b[_0xe720('0x56')],'updatedAt':_0x51431b[_0xe720('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4b9f73,_0x21742a))[_0xe720('0x45')](handleError(_0x4b9f73,null));};exports['getTeams']=function(_0x1da890,_0xdf5385,_0x4e36b1){var _0x18dd4f={};var _0x2e3315={};var _0x43575e;var _0x3898db;return db[_0xe720('0x2e')][_0xe720('0x4f')]({'where':{'id':_0x1da890['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0xdf5385,null))[_0xe720('0x16')](function(_0x1a899f){if(_0x1a899f){_0x43575e=_0x1a899f;_0x2e3315['model']=_[_0xe720('0x30')](db[_0xe720('0x5b')][_0xe720('0x2f')]);_0x2e3315[_0xe720('0x31')]=_[_0xe720('0x30')](_0x1da890[_0xe720('0x31')]);_0x2e3315[_0xe720('0x34')]=_[_0xe720('0x48')](_0x2e3315[_0xe720('0x36')],_0x2e3315[_0xe720('0x31')]);_0x18dd4f[_0xe720('0x35')]=_['intersection'](_0x2e3315[_0xe720('0x36')],qs[_0xe720('0x37')](_0x1da890[_0xe720('0x31')][_0xe720('0x37')]));_0x18dd4f['attributes']=_0x18dd4f[_0xe720('0x35')]['length']?_0x18dd4f['attributes']:_0x2e3315['model'];_0x18dd4f[_0xe720('0x3b')]=qs[_0xe720('0x3c')](_0x1da890[_0xe720('0x31')][_0xe720('0x3c')]);_0x18dd4f[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x1da890[_0xe720('0x31')],_0x2e3315['filters']));if(_0x1da890[_0xe720('0x31')][_0xe720('0x52')]){_0x18dd4f[_0xe720('0x3d')]=_['merge'](_0x18dd4f['where'],{'$or':_[_0xe720('0x42')](_0x18dd4f[_0xe720('0x35')],function(_0x3f4250){var _0x8a8b7={};_0x8a8b7[_0x3f4250]={'$like':'%'+_0x1da890[_0xe720('0x31')][_0xe720('0x52')]+'%'};return _0x8a8b7;})});}_0x18dd4f=_[_0xe720('0x41')]({},_0x18dd4f,_0x1da890[_0xe720('0x49')]);return _0x43575e[_0xe720('0x5c')](_0x18dd4f);}})[_0xe720('0x16')](function(_0x336f57){if(_0x336f57){_0x3898db=_0x336f57[_0xe720('0x38')];if(!_0x1da890[_0xe720('0x31')]['hasOwnProperty'](_0xe720('0x3a'))){_0x18dd4f[_0xe720('0x23')]=qs['limit'](_0x1da890[_0xe720('0x31')][_0xe720('0x23')]);_0x18dd4f['offset']=qs[_0xe720('0x22')](_0x1da890['query']['offset']);}return _0x43575e[_0xe720('0x5c')](_0x18dd4f);}})[_0xe720('0x16')](function(_0x3fea0e){if(_0x3fea0e){return _0x3fea0e?{'count':_0x3898db,'rows':_0x3fea0e}:null;}})[_0xe720('0x16')](respondWithResult(_0xdf5385,null))[_0xe720('0x45')](handleError(_0xdf5385,null));};exports['addTeams']=function(_0x242ace,_0x133527,_0x41d647){var _0x13883a=[];var _0x4c0d07;return db[_0xe720('0x5b')][_0xe720('0x5d')]({'where':{'id':_0x242ace['body'][_0xe720('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xe720('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe720('0x16')](function(_0xc2c510){if(_0xc2c510){for(var _0x13956f=0x0;_0x13956f<_0xc2c510['length'];_0x13956f+=0x1){for(var _0x178d5c=0x0;_0x178d5c<_0xc2c510[_0x13956f][_0xe720('0x5f')][_0xe720('0x38')];_0x178d5c+=0x1){_0x13883a=_['union'](_0x13883a,[_0xc2c510[_0x13956f]['Agents'][_0x178d5c]['id']]);}}return _0x13883a;}})[_0xe720('0x16')](function(_0x2d0433){if(_0x2d0433){return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x242ace[_0xe720('0x47')]['id']}});}})[_0xe720('0x16')](function(_0x6f584){if(_0x6f584){_0x4c0d07=_0x6f584;return _0x4c0d07[_0xe720('0x60')](_0x13883a,{'penalty':_0x242ace['body'][_0xe720('0x61')]});}})[_0xe720('0x16')](function(_0x22b462){if(_0x22b462){return _0x4c0d07[_0xe720('0x62')](_0x242ace[_0xe720('0x4c')]['ids']);}})[_0xe720('0x16')](handleEntityNotFound(_0x133527,null))[_0xe720('0x16')](respondWithStatusCode(_0x133527,null))[_0xe720('0x45')](handleError(_0x133527,null));};exports[_0xe720('0x63')]=function(_0x356a18,_0x4877ee,_0x59ff91){var _0xe2ef87=[];var _0x2cf17e;return db[_0xe720('0x5b')][_0xe720('0x5d')]({'where':{'id':_0x356a18['query'][_0xe720('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe720('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xe720('0x16')](function(_0xcc4e00){if(_0xcc4e00){for(var _0x1adbd2=0x0;_0x1adbd2<_0xcc4e00[_0xe720('0x38')];_0x1adbd2+=0x1){for(var _0x11fe7a=0x0;_0x11fe7a<_0xcc4e00[_0x1adbd2][_0xe720('0x5f')]['length'];_0x11fe7a+=0x1){_0xe2ef87=_['union'](_0xe2ef87,[_0xcc4e00[_0x1adbd2]['Agents'][_0x11fe7a]['id']]);}}return _0xe2ef87;}})[_0xe720('0x16')](function(_0x404c2a){if(_0x404c2a){return db[_0xe720('0x2e')]['find']({'where':{'id':_0x356a18[_0xe720('0x47')]['id']}});}})[_0xe720('0x16')](function(_0x131d24){if(_0x131d24){_0x2cf17e=_0x131d24;return _0x2cf17e[_0xe720('0x64')](_0xe2ef87);}})[_0xe720('0x16')](function(_0x495894){if(_0x2cf17e){return _0x2cf17e[_0xe720('0x63')](_0x356a18[_0xe720('0x31')][_0xe720('0x5e')]);}})[_0xe720('0x16')](handleEntityNotFound(_0x4877ee,null))['then'](respondWithStatusCode(_0x4877ee,null))[_0xe720('0x45')](handleError(_0x4877ee,null));};exports['addAgents']=function(_0x463904,_0x172485,_0x59ed89){return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x463904['params']['id']}})['then'](handleEntityNotFound(_0x172485,null))[_0xe720('0x16')](function(_0x22c857){if(_0x22c857){return _0x22c857['addAgents'](_0x463904[_0xe720('0x4c')][_0xe720('0x5e')],_['omit'](_0x463904[_0xe720('0x4c')],['ids','id'])||{})['spread'](function(_0x1ef8c2){for(var _0xb00480=0x0;_0xb00480<_0x463904[_0xe720('0x4c')]['ids'][_0xe720('0x38')];_0xb00480+=0x1){socket[_0xe720('0x65')](_0xe720('0x66'),{'UserId':_0x463904['body'][_0xe720('0x5e')][_0xb00480],'ChatQueueId':_0x463904[_0xe720('0x47')]['id']});}return _0x1ef8c2;});}})[_0xe720('0x16')](respondWithResult(_0x172485,null))['catch'](handleError(_0x172485,null));};exports[_0xe720('0x64')]=function(_0x233ad6,_0x29792d,_0x1bd046){var _0x404030;return db['ChatQueue'][_0xe720('0x4a')]({'where':{'id':_0x233ad6[_0xe720('0x47')]['id']}})['then'](handleEntityNotFound(_0x29792d,null))[_0xe720('0x16')](function(_0x6e0c5d){if(_0x6e0c5d){return _0x6e0c5d['removeAgents'](_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')])[_0xe720('0x16')](function(_0x638150){if(_['isArray'](_0x233ad6['query'][_0xe720('0x5e')])){for(var _0x239f8a=0x0;_0x239f8a<_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')][_0xe720('0x38')];_0x239f8a+=0x1){socket[_0xe720('0x65')](_0xe720('0x67'),{'UserId':_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')][_0x239f8a],'ChatQueueId':_0x233ad6[_0xe720('0x47')]['id']});}}else{socket[_0xe720('0x65')]('userChatQueue:remove',{'UserId':_0x233ad6[_0xe720('0x31')][_0xe720('0x5e')],'ChatQueueId':_0x233ad6[_0xe720('0x47')]['id']});}});}})[_0xe720('0x16')](respondWithStatusCode(_0x29792d,null))[_0xe720('0x45')](handleError(_0x29792d,null));};exports[_0xe720('0x68')]=function(_0x877133,_0x56a259,_0x4c0720){var _0x27a054={};var _0x345b5e={};var _0x1d60eb;var _0xfecdb3;return db['ChatQueue'][_0xe720('0x4f')]({'where':{'id':_0x877133['params']['id']}})[_0xe720('0x16')](handleEntityNotFound(_0x56a259,null))['then'](function(_0x1a99e2){if(_0x1a99e2){_0x1d60eb=_0x1a99e2;_0x345b5e[_0xe720('0x36')]=_[_0xe720('0x30')](db['User'][_0xe720('0x2f')]);_0x345b5e[_0xe720('0x31')]=_['keys'](_0x877133[_0xe720('0x31')]);_0x345b5e[_0xe720('0x34')]=_[_0xe720('0x48')](_0x345b5e['model'],_0x345b5e['query']);_0x27a054[_0xe720('0x35')]=_['intersection'](_0x345b5e[_0xe720('0x36')],qs[_0xe720('0x37')](_0x877133[_0xe720('0x31')][_0xe720('0x37')]));_0x27a054['attributes']=_0x27a054[_0xe720('0x35')][_0xe720('0x38')]?_0x27a054[_0xe720('0x35')]:_0x345b5e[_0xe720('0x36')];_0x27a054[_0xe720('0x3b')]=qs['sort'](_0x877133[_0xe720('0x31')][_0xe720('0x3c')]);_0x27a054[_0xe720('0x3d')]=qs[_0xe720('0x34')](_[_0xe720('0x3e')](_0x877133[_0xe720('0x31')],_0x345b5e[_0xe720('0x34')]));if(_0x877133[_0xe720('0x31')][_0xe720('0x52')]){_0x27a054[_0xe720('0x3d')]=_['merge'](_0x27a054[_0xe720('0x3d')],{'$or':_['map'](_0x27a054['attributes'],function(_0x20ab1a){var _0x2fee5e={};_0x2fee5e[_0x20ab1a]={'$like':'%'+_0x877133['query'][_0xe720('0x52')]+'%'};return _0x2fee5e;})});}_0x27a054=_['merge']({},_0x27a054,_0x877133[_0xe720('0x49')]);return _0x1d60eb[_0xe720('0x68')](_0x27a054);}})[_0xe720('0x16')](function(_0x15cfc7){if(_0x15cfc7){_0xfecdb3=_0x15cfc7[_0xe720('0x38')];if(!_0x877133[_0xe720('0x31')][_0xe720('0x39')](_0xe720('0x3a'))){_0x27a054[_0xe720('0x23')]=qs[_0xe720('0x23')](_0x877133[_0xe720('0x31')][_0xe720('0x23')]);_0x27a054['offset']=qs[_0xe720('0x22')](_0x877133[_0xe720('0x31')][_0xe720('0x22')]);}return _0x1d60eb[_0xe720('0x68')](_0x27a054);}})['then'](function(_0x3d3956){if(_0x3d3956){return _0x3d3956?{'count':_0xfecdb3,'rows':_0x3d3956}:null;}})[_0xe720('0x16')](respondWithResult(_0x56a259,null))['catch'](handleError(_0x56a259,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 4ba16f2..b20c59a 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 _0xc6fe=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x182862,_0x5ef7e3){var _0x319634=function(_0x5ce7f4){while(--_0x5ce7f4){_0x182862['push'](_0x182862['shift']());}};_0x319634(++_0x5ef7e3);}(_0xc6fe,0xbc));var _0xec6f=function(_0x5922bb,_0x46915b){_0x5922bb=_0x5922bb-0x0;var _0x1aab29=_0xc6fe[_0x5922bb];return _0x1aab29;};'use strict';var EventEmitter=require(_0xec6f('0x0'));var ChatQueue=require(_0xec6f('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xec6f('0x2')](0x0);var events={'afterCreate':_0xec6f('0x3'),'afterUpdate':_0xec6f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x41ed86){return function(_0x540732,_0x113ee0,_0x46e237){ChatQueueEvents[_0xec6f('0x5')](_0x41ed86+':'+_0x540732['id'],_0x540732);ChatQueueEvents[_0xec6f('0x5')](_0x41ed86,_0x540732);_0x46e237(null);};}for(var e in events){if(events[_0xec6f('0x6')](e)){var event=events[e];ChatQueue[_0xec6f('0x7')](e,emitEvent(event));}}module[_0xec6f('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xbc9d=['save','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue','setMaxListeners'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x4eb684,_0xa7e5b8){_0x4eb684=_0x4eb684-0x0;var _0x25ca68=_0xbc9d[_0x4eb684];return _0x25ca68;};'use strict';var EventEmitter=require(_0xdbc9('0x0'));var ChatQueue=require(_0xdbc9('0x1'))['db'][_0xdbc9('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdbc9('0x3')](0x0);var events={'afterCreate':_0xdbc9('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4fab6e){return function(_0x2aba48,_0x404513,_0x3e63f1){ChatQueueEvents[_0xdbc9('0x5')](_0x4fab6e+':'+_0x2aba48['id'],_0x2aba48);ChatQueueEvents[_0xdbc9('0x5')](_0x4fab6e,_0x2aba48);_0x3e63f1(null);};}for(var e in events){if(events[_0xdbc9('0x6')](e)){var event=events[e];ChatQueue[_0xdbc9('0x7')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index f38e50f..294e436 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 _0x33c5=['util','../../config/logger','moment','bluebird','request-promise','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x33c5,0xe6));var _0x533c=function(_0x680b65,_0x5b2e9c){_0x680b65=_0x680b65-0x0;var _0x1c2053=_0x33c5[_0x680b65];return _0x1c2053;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var logger=require(_0x533c('0x1'))('api');var moment=require(_0x533c('0x2'));var BPromise=require(_0x533c('0x3'));var rp=require(_0x533c('0x4'));var attributes=require(_0x533c('0x5'));module[_0x533c('0x6')]=function(_0x49609e,_0x10943d){return _0x49609e[_0x533c('0x7')](_0x533c('0x8'),attributes,{'tableName':_0x533c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0309=['bluebird','request-promise','./chatQueue.attributes','exports','chat_queues','lodash','../../config/logger','moment'];(function(_0xb94789,_0x56c4e0){var _0x56f573=function(_0x4dd621){while(--_0x4dd621){_0xb94789['push'](_0xb94789['shift']());}};_0x56f573(++_0x56c4e0);}(_0x0309,0x165));var _0x9030=function(_0x12e4b7,_0x732556){_0x12e4b7=_0x12e4b7-0x0;var _0x3544d2=_0x0309[_0x12e4b7];return _0x3544d2;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var logger=require(_0x9030('0x1'))('api');var moment=require(_0x9030('0x2'));var BPromise=require(_0x9030('0x3'));var rp=require(_0x9030('0x4'));var attributes=require(_0x9030('0x5'));module[_0x9030('0x6')]=function(_0x2e6276,_0xcbbe57){return _0x2e6276['define']('ChatQueue',attributes,{'tableName':_0x9030('0x7'),'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 0a9a7d4..df29085 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 _0xa9e0=['rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x3d6b54,_0x5b6caa){var _0x27c393=function(_0x298c12){while(--_0x298c12){_0x3d6b54['push'](_0x3d6b54['shift']());}};_0x27c393(++_0x5b6caa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('ChatQueue,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});}exports[_0x0a9e('0x17')]=function(_0x205fd6){var _0x31b1ca=this;return new Promise(function(_0x2eb11f,_0x530eb7){return db[_0x0a9e('0x18')][_0x0a9e('0x19')]({'raw':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1c')]||null:null,'attributes':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')]['attributes']||null:null,'limit':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1d')]||null:null,'include':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')]['include']?_[_0x0a9e('0x1e')](_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x20')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x21')],'include':_0x4d00e6[_0x0a9e('0x1f')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x20')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x21')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x20')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x34dc65){logger[_0x0a9e('0xe')](_0x0a9e('0x17'),_0x205fd6);logger[_0x0a9e('0x22')](_0x0a9e('0x17'),_0x205fd6,JSON[_0x0a9e('0x10')](_0x34dc65));_0x2eb11f(_0x34dc65);})[_0x0a9e('0x16')](function(_0x5a101a){logger[_0x0a9e('0x11')](_0x0a9e('0x17'),_0x5a101a[_0x0a9e('0x13')],_0x205fd6);_0x530eb7(_0x31b1ca[_0x0a9e('0x11')](0x1f4,_0x5a101a['message']));});});};exports[_0x0a9e('0x23')]=function(_0x40e7a3){var _0x1843b2=this;return new Promise(function(_0x824a4f,_0x58b06f){return db[_0x0a9e('0x18')][_0x0a9e('0x24')]({'raw':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1c')]||null:null,'attributes':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x21')]||null:null,'include':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x2b45ea){return{'model':db[_0x2b45ea[_0x0a9e('0x20')]],'as':_0x2b45ea['as'],'attributes':_0x2b45ea[_0x0a9e('0x21')],'include':_0x2b45ea[_0x0a9e('0x1f')]?_['map'](_0x2b45ea[_0x0a9e('0x1f')],function(_0x5e7238){return{'model':db[_0x5e7238[_0x0a9e('0x20')]],'as':_0x5e7238['as'],'attributes':_0x5e7238[_0x0a9e('0x21')],'include':_0x5e7238[_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x5e7238['include'],function(_0x191e91){return{'model':db[_0x191e91[_0x0a9e('0x20')]],'as':_0x191e91['as'],'attributes':_0x191e91[_0x0a9e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x4853b1){logger['info'](_0x0a9e('0x23'),_0x40e7a3);logger['debug'](_0x0a9e('0x23'),_0x40e7a3,JSON[_0x0a9e('0x10')](_0x4853b1));_0x824a4f(_0x4853b1);})[_0x0a9e('0x16')](function(_0x1ef87a){logger['error'](_0x0a9e('0x23'),_0x1ef87a[_0x0a9e('0x13')],_0x40e7a3);_0x58b06f(_0x1843b2[_0x0a9e('0x11')](0x1f4,_0x1ef87a['message']));});});}; \ No newline at end of file +var _0xa9e0=['rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./chatQueue.socket','request','then','info','ChatQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','map','include','model','attributes','debug','ShowChatQueue','find','lodash','util','moment','../../mysqldb','../../config/logger'];(function(_0x20908f,_0x1f26ee){var _0x10f5a3=function(_0x2a9845){while(--_0x2a9845){_0x20908f['push'](_0x20908f['shift']());}};_0x10f5a3(++_0x1f26ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('ChatQueue,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});}exports[_0x0a9e('0x17')]=function(_0x205fd6){var _0x31b1ca=this;return new Promise(function(_0x2eb11f,_0x530eb7){return db[_0x0a9e('0x18')][_0x0a9e('0x19')]({'raw':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1b')]===undefined?!![]:![]:!![],'where':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1c')]||null:null,'attributes':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')]['attributes']||null:null,'limit':_0x205fd6['options']?_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1d')]||null:null,'include':_0x205fd6[_0x0a9e('0x1a')]?_0x205fd6[_0x0a9e('0x1a')]['include']?_[_0x0a9e('0x1e')](_0x205fd6[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x4d00e6){return{'model':db[_0x4d00e6[_0x0a9e('0x20')]],'as':_0x4d00e6['as'],'attributes':_0x4d00e6[_0x0a9e('0x21')],'include':_0x4d00e6[_0x0a9e('0x1f')]?_['map'](_0x4d00e6['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x20')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x21')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x20')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x34dc65){logger[_0x0a9e('0xe')](_0x0a9e('0x17'),_0x205fd6);logger[_0x0a9e('0x22')](_0x0a9e('0x17'),_0x205fd6,JSON[_0x0a9e('0x10')](_0x34dc65));_0x2eb11f(_0x34dc65);})[_0x0a9e('0x16')](function(_0x5a101a){logger[_0x0a9e('0x11')](_0x0a9e('0x17'),_0x5a101a[_0x0a9e('0x13')],_0x205fd6);_0x530eb7(_0x31b1ca[_0x0a9e('0x11')](0x1f4,_0x5a101a['message']));});});};exports[_0x0a9e('0x23')]=function(_0x40e7a3){var _0x1843b2=this;return new Promise(function(_0x824a4f,_0x58b06f){return db[_0x0a9e('0x18')][_0x0a9e('0x24')]({'raw':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1c')]||null:null,'attributes':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x21')]||null:null,'include':_0x40e7a3[_0x0a9e('0x1a')]?_0x40e7a3['options'][_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x40e7a3[_0x0a9e('0x1a')][_0x0a9e('0x1f')],function(_0x2b45ea){return{'model':db[_0x2b45ea[_0x0a9e('0x20')]],'as':_0x2b45ea['as'],'attributes':_0x2b45ea[_0x0a9e('0x21')],'include':_0x2b45ea[_0x0a9e('0x1f')]?_['map'](_0x2b45ea[_0x0a9e('0x1f')],function(_0x5e7238){return{'model':db[_0x5e7238[_0x0a9e('0x20')]],'as':_0x5e7238['as'],'attributes':_0x5e7238[_0x0a9e('0x21')],'include':_0x5e7238[_0x0a9e('0x1f')]?_[_0x0a9e('0x1e')](_0x5e7238['include'],function(_0x191e91){return{'model':db[_0x191e91[_0x0a9e('0x20')]],'as':_0x191e91['as'],'attributes':_0x191e91[_0x0a9e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0xd')](function(_0x4853b1){logger['info'](_0x0a9e('0x23'),_0x40e7a3);logger['debug'](_0x0a9e('0x23'),_0x40e7a3,JSON[_0x0a9e('0x10')](_0x4853b1));_0x824a4f(_0x4853b1);})[_0x0a9e('0x16')](function(_0x1ef87a){logger['error'](_0x0a9e('0x23'),_0x1ef87a[_0x0a9e('0x13')],_0x40e7a3);_0x58b06f(_0x1843b2[_0x0a9e('0x11')](0x1f4,_0x1ef87a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index eac0779..52950db 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 _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','chatQueue:','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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);ChatQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 19d658d..fe910d3 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 _0x31b2=['delete','destroy','removeTeams','removeAgents','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','put','update'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x31b2,0xc5));var _0x231b=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x31b2[_0x5a6de2];return _0x2c0525;};'use strict';var multer=require(_0x231b('0x0'));var util=require('util');var path=require(_0x231b('0x1'));var express=require(_0x231b('0x2'));var router=express['Router']();var auth=require(_0x231b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x231b('0x4'));var controller=require('./chatQueue.controller');router[_0x231b('0x5')]('/',auth[_0x231b('0x6')](),controller['index']);router['get']('/describe',auth[_0x231b('0x6')](),controller[_0x231b('0x7')]);router[_0x231b('0x5')](_0x231b('0x8'),auth[_0x231b('0x6')](),controller[_0x231b('0x9')]);router[_0x231b('0x5')](_0x231b('0xa'),auth['isAuthenticated'](),controller['getMembers']);router[_0x231b('0x5')](_0x231b('0xb'),auth[_0x231b('0x6')](),controller['getTeams']);router['get'](_0x231b('0xc'),auth[_0x231b('0x6')](),controller[_0x231b('0xd')]);router[_0x231b('0xe')]('/',auth['isAuthenticated'](),controller[_0x231b('0xf')]);router[_0x231b('0xe')]('/:id/teams',auth[_0x231b('0x6')](),controller[_0x231b('0x10')]);router[_0x231b('0xe')](_0x231b('0xc'),auth[_0x231b('0x6')](),controller['addAgents']);router[_0x231b('0x11')]('/:id',auth[_0x231b('0x6')](),controller[_0x231b('0x12')]);router[_0x231b('0x13')](_0x231b('0x8'),auth['isAuthenticated'](),controller[_0x231b('0x14')]);router[_0x231b('0x13')](_0x231b('0xb'),auth[_0x231b('0x6')](),controller[_0x231b('0x15')]);router[_0x231b('0x13')](_0x231b('0xc'),auth[_0x231b('0x6')](),controller[_0x231b('0x16')]);module[_0x231b('0x17')]=router; \ No newline at end of file +var _0xfcbd=['describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','post','create','/:id/users','addAgents','put','delete','removeTeams','exports','path','express','Router','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xfcbd,0x1d1));var _0xdfcb=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0xfcbd[_0x1c2f29];return _0x258465;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdfcb('0x0'));var express=require(_0xdfcb('0x1'));var router=express[_0xdfcb('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xdfcb('0x3'));var config=require(_0xdfcb('0x4'));var controller=require(_0xdfcb('0x5'));router[_0xdfcb('0x6')]('/',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x8')]);router['get'](_0xdfcb('0x9'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xa')]);router[_0xdfcb('0x6')](_0xdfcb('0xb'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xc')]);router[_0xdfcb('0x6')](_0xdfcb('0xd'),auth[_0xdfcb('0x7')](),controller['getMembers']);router[_0xdfcb('0x6')](_0xdfcb('0xe'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0xf')]);router[_0xdfcb('0x6')]('/:id/users',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x10')]);router[_0xdfcb('0x11')]('/',auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x12')]);router['post'](_0xdfcb('0xe'),auth[_0xdfcb('0x7')](),controller['addTeams']);router['post'](_0xdfcb('0x13'),auth[_0xdfcb('0x7')](),controller[_0xdfcb('0x14')]);router[_0xdfcb('0x15')](_0xdfcb('0xb'),auth[_0xdfcb('0x7')](),controller['update']);router['delete'](_0xdfcb('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xdfcb('0x16')](_0xdfcb('0xe'),auth['isAuthenticated'](),controller[_0xdfcb('0x17')]);router['delete'](_0xdfcb('0x13'),auth[_0xdfcb('0x7')](),controller['removeAgents']);module[_0xdfcb('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index d88e7a8..23233a9 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 _0x00b5=['moment','sequelize','exports','STRING','DATE'];(function(_0x3c5bae,_0x16d38d){var _0x378816=function(_0x122c61){while(--_0x122c61){_0x3c5bae['push'](_0x3c5bae['shift']());}};_0x378816(++_0x16d38d);}(_0x00b5,0x91));var _0x500b=function(_0x453d5c,_0x2a5322){_0x453d5c=_0x453d5c-0x0;var _0x40abc1=_0x00b5[_0x453d5c];return _0x40abc1;};'use strict';var moment=require(_0x500b('0x0'));var Sequelize=require(_0x500b('0x1'));module[_0x500b('0x2')]={'uniqueid':{'type':Sequelize[_0x500b('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x500b('0x4')]},'leaveAt':{'type':Sequelize[_0x500b('0x4')]},'acceptAt':{'type':Sequelize[_0x500b('0x4')]},'exitAt':{'type':Sequelize[_0x500b('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8966=['sequelize','exports','STRING','DATE','moment'];(function(_0x4466a5,_0x1b7aad){var _0x25e120=function(_0x4b2469){while(--_0x4b2469){_0x4466a5['push'](_0x4466a5['shift']());}};_0x25e120(++_0x1b7aad);}(_0x8966,0x185));var _0x6896=function(_0x418310,_0x50bb2a){_0x418310=_0x418310-0x0;var _0x36560d=_0x8966[_0x418310];return _0x36560d;};'use strict';var moment=require(_0x6896('0x0'));var Sequelize=require(_0x6896('0x1'));module[_0x6896('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x6896('0x3')]},'joinAt':{'type':Sequelize[_0x6896('0x4')]},'leaveAt':{'type':Sequelize[_0x6896('0x4')]},'acceptAt':{'type':Sequelize[_0x6896('0x4')]},'exitAt':{'type':Sequelize[_0x6896('0x4')]},'reason':{'type':Sequelize[_0x6896('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 0bf4493..9959a7a 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 _0xfcac=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','ChatQueueReport','findAll','rows','catch','show','create','body','find','params','describe','fast-json-patch','request-promise','bluebird','util','path','sox','lodash','squel','crypto','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields'];(function(_0x3411c4,_0x64ed62){var _0x23285e=function(_0x3b43a4){while(--_0x3b43a4){_0x3411c4['push'](_0x3411c4['shift']());}};_0x23285e(++_0x64ed62);}(_0xfcac,0x1f0));var _0xcfca=function(_0x423375,_0xadf775){_0x423375=_0x423375-0x0;var _0x5cbf9c=_0xfcac[_0x423375];return _0x5cbf9c;};'use strict';var jsonpatch=require(_0xcfca('0x0'));var rp=require(_0xcfca('0x1'));var moment=require('moment');var BPromise=require(_0xcfca('0x2'));var Mustache=require('mustache');var util=require(_0xcfca('0x3'));var path=require(_0xcfca('0x4'));var sox=require(_0xcfca('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xcfca('0x6'));var squel=require(_0xcfca('0x7'));var crypto=require(_0xcfca('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcfca('0x9'));var Papa=require('papaparse');var qs=require(_0xcfca('0xa'));var logger=require(_0xcfca('0xb'))('api');var utils=require(_0xcfca('0xc'));var config=require(_0xcfca('0xd'));var db=require(_0xcfca('0xe'))['db'];function respondWithStatusCode(_0x3df462,_0x4f67b5){_0x4f67b5=_0x4f67b5||0xcc;return function(_0x45af38){if(_0x45af38){return _0x3df462[_0xcfca('0xf')](_0x4f67b5);}return _0x3df462['status'](_0x4f67b5)[_0xcfca('0x10')]();};}function respondWithResult(_0x40b78a,_0xbc5a55){_0xbc5a55=_0xbc5a55||0xc8;return function(_0xd1204f){if(_0xd1204f){return _0x40b78a[_0xcfca('0x11')](_0xbc5a55)[_0xcfca('0x12')](_0xd1204f);}};}function respondWithFilteredResult(_0x3749a0,_0xbf9671){return function(_0x43d1e8){if(_0x43d1e8){var _0x190e13=_0x43d1e8['count'],_0x5a307c=_0xbf9671['offset'],_0x36cbfb=_0xbf9671[_0xcfca('0x13')]+_0xbf9671[_0xcfca('0x14')],_0x2d5d71;if(_0x36cbfb>=_0x190e13){_0x36cbfb=_0x190e13;_0x2d5d71=0xc8;}else{_0x2d5d71=0xce;}_0x3749a0[_0xcfca('0x11')](_0x2d5d71);return _0x3749a0[_0xcfca('0x15')]('Content-Range',_0x5a307c+'-'+_0x36cbfb+'/'+_0x190e13)[_0xcfca('0x12')](_0x43d1e8);}return null;};}function patchUpdates(_0x405c5b){return function(_0x40f51e){try{jsonpatch[_0xcfca('0x16')](_0x40f51e,_0x405c5b,!![]);}catch(_0x13beed){return BPromise[_0xcfca('0x17')](_0x13beed);}return _0x40f51e[_0xcfca('0x18')]();};}function saveUpdates(_0x23af76,_0x2389a8){return function(_0x2dda68){if(_0x2dda68){return _0x2dda68[_0xcfca('0x19')](_0x23af76)[_0xcfca('0x1a')](function(_0x1fd94c){return _0x1fd94c;});}return null;};}function removeEntity(_0x147241,_0x26a449){return function(_0x3b6cdf){if(_0x3b6cdf){return _0x3b6cdf[_0xcfca('0x1b')]()[_0xcfca('0x1a')](function(){_0x147241[_0xcfca('0x11')](0xcc)[_0xcfca('0x10')]();});}};}function handleEntityNotFound(_0x17adaa,_0x146da4){return function(_0x250316){if(!_0x250316){_0x17adaa[_0xcfca('0xf')](0x194);}return _0x250316;};}function handleError(_0x27b0db,_0x3a637c){_0x3a637c=_0x3a637c||0x1f4;return function(_0x35d59a){logger[_0xcfca('0x1c')](_0x35d59a[_0xcfca('0x1d')]);if(_0x35d59a['name']){delete _0x35d59a[_0xcfca('0x1e')];}_0x27b0db['status'](_0x3a637c)['send'](_0x35d59a);};}exports['index']=function(_0x258a0a,_0x4d723c){var _0x5741d2={},_0x97d6f2={},_0x1c08fa={'count':0x0,'rows':[]};var _0x5124bf=db['ChatQueueReport'][_0xcfca('0x1f')];_0x97d6f2[_0xcfca('0x20')]=_[_0xcfca('0x21')](_0x5124bf);var _0x54b830={'dateStart':_0x258a0a[_0xcfca('0x22')][_0xcfca('0x23')],'dateEnd':_0x258a0a['query'][_0xcfca('0x24')]};delete _0x258a0a[_0xcfca('0x22')][_0xcfca('0x23')];delete _0x258a0a[_0xcfca('0x22')][_0xcfca('0x24')];_0x97d6f2['query']=_['keys'](_0x258a0a[_0xcfca('0x22')]);_0x97d6f2[_0xcfca('0x25')]=_[_0xcfca('0x26')](_0x97d6f2[_0xcfca('0x20')],_0x97d6f2[_0xcfca('0x22')]);_0x5741d2['attributes']=_[_0xcfca('0x26')](_0x97d6f2[_0xcfca('0x20')],qs['fields'](_0x258a0a[_0xcfca('0x22')][_0xcfca('0x27')]));_0x5741d2[_0xcfca('0x28')]=_0x5741d2[_0xcfca('0x28')][_0xcfca('0x29')]?_0x5741d2[_0xcfca('0x28')]:_0x97d6f2['model'];if(!_0x258a0a[_0xcfca('0x22')][_0xcfca('0x2a')](_0xcfca('0x2b'))){_0x5741d2['limit']=qs[_0xcfca('0x14')](_0x258a0a[_0xcfca('0x22')]['limit']);_0x5741d2[_0xcfca('0x13')]=qs['offset'](_0x258a0a[_0xcfca('0x22')]['offset']);}_0x5741d2[_0xcfca('0x2c')]=qs['sort'](_0x258a0a[_0xcfca('0x22')][_0xcfca('0x2d')]);_0x5741d2[_0xcfca('0x2e')]=qs[_0xcfca('0x25')](_[_0xcfca('0x2f')](_0x258a0a[_0xcfca('0x22')],_0x97d6f2[_0xcfca('0x25')]));if(_0x54b830[_0xcfca('0x23')]){if(_0x54b830[_0xcfca('0x24')]){_0x54b830['dateEnd']=moment(_0x54b830['dateEnd'])[_0xcfca('0x30')](0x1,_0xcfca('0x31'));}else{_0x54b830[_0xcfca('0x24')]=moment(_0x54b830[_0xcfca('0x23')])[_0xcfca('0x30')](0x1,_0xcfca('0x31'));}_[_0xcfca('0x32')](_0x5741d2[_0xcfca('0x2e')],{'createdAt':{'$gte':_0x54b830['dateStart'],'$lte':_0x54b830['dateEnd']}});}if(_0x258a0a[_0xcfca('0x22')][_0xcfca('0x33')]){_0x5741d2[_0xcfca('0x2e')]=_[_0xcfca('0x32')](_0x5741d2[_0xcfca('0x2e')],{'$or':_[_0xcfca('0x34')](_0x5741d2[_0xcfca('0x28')],function(_0xbff819){var _0x3f8c56={};_0x3f8c56[_0xbff819]={'$like':'%'+_0x258a0a['query'][_0xcfca('0x33')]+'%'};return _0x3f8c56;})});}_0x5741d2=_[_0xcfca('0x32')]({},_0x5741d2,_0x258a0a[_0xcfca('0x35')]);var _0x3cc1c4={'where':_0x5741d2[_0xcfca('0x2e')]};return db['ChatQueueReport']['count'](_0x3cc1c4)[_0xcfca('0x1a')](function(_0x53537c){_0x1c08fa[_0xcfca('0x36')]=_0x53537c;if(_0x258a0a[_0xcfca('0x22')][_0xcfca('0x37')]){_0x5741d2[_0xcfca('0x38')]=[{'all':!![]}];}return db[_0xcfca('0x39')][_0xcfca('0x3a')](_0x5741d2);})[_0xcfca('0x1a')](function(_0xb340c0){_0x1c08fa[_0xcfca('0x3b')]=_0xb340c0;return _0x1c08fa;})[_0xcfca('0x1a')](respondWithFilteredResult(_0x4d723c,_0x5741d2))[_0xcfca('0x3c')](handleError(_0x4d723c,null));};exports[_0xcfca('0x3d')]=function(_0x192281,_0x4fcb6c){var _0x382eb7={'raw':!![],'where':{'id':_0x192281['params']['id']}},_0x2e6c9c={};_0x2e6c9c[_0xcfca('0x20')]=_['keys'](db[_0xcfca('0x39')][_0xcfca('0x1f')]);_0x2e6c9c[_0xcfca('0x22')]=_['keys'](_0x192281['query']);_0x2e6c9c[_0xcfca('0x25')]=_[_0xcfca('0x26')](_0x2e6c9c[_0xcfca('0x20')],_0x2e6c9c['query']);_0x382eb7[_0xcfca('0x28')]=_[_0xcfca('0x26')](_0x2e6c9c[_0xcfca('0x20')],qs[_0xcfca('0x27')](_0x192281[_0xcfca('0x22')]['fields']));_0x382eb7['attributes']=_0x382eb7[_0xcfca('0x28')][_0xcfca('0x29')]?_0x382eb7['attributes']:_0x2e6c9c[_0xcfca('0x20')];if(_0x192281[_0xcfca('0x22')][_0xcfca('0x37')]){_0x382eb7[_0xcfca('0x38')]=[{'all':!![]}];}_0x382eb7=_['merge']({},_0x382eb7,_0x192281[_0xcfca('0x35')]);return db[_0xcfca('0x39')]['find'](_0x382eb7)[_0xcfca('0x1a')](handleEntityNotFound(_0x4fcb6c,null))[_0xcfca('0x1a')](respondWithResult(_0x4fcb6c,null))[_0xcfca('0x3c')](handleError(_0x4fcb6c,null));};exports[_0xcfca('0x3e')]=function(_0xe97d0a,_0xc2e556){return db[_0xcfca('0x39')][_0xcfca('0x3e')](_0xe97d0a['body'],{})[_0xcfca('0x1a')](respondWithResult(_0xc2e556,0xc9))['catch'](handleError(_0xc2e556,null));};exports['update']=function(_0x23b491,_0x1587e8){if(_0x23b491['body']['id']){delete _0x23b491[_0xcfca('0x3f')]['id'];}return db[_0xcfca('0x39')][_0xcfca('0x40')]({'where':{'id':_0x23b491[_0xcfca('0x41')]['id']}})[_0xcfca('0x1a')](handleEntityNotFound(_0x1587e8,null))[_0xcfca('0x1a')](saveUpdates(_0x23b491[_0xcfca('0x3f')],null))[_0xcfca('0x1a')](respondWithResult(_0x1587e8,null))[_0xcfca('0x3c')](handleError(_0x1587e8,null));};exports[_0xcfca('0x1b')]=function(_0x29c95b,_0x5e08ba){return db['ChatQueueReport'][_0xcfca('0x40')]({'where':{'id':_0x29c95b[_0xcfca('0x41')]['id']}})[_0xcfca('0x1a')](handleEntityNotFound(_0x5e08ba,null))[_0xcfca('0x1a')](removeEntity(_0x5e08ba,null))['catch'](handleError(_0x5e08ba,null));};exports[_0xcfca('0x42')]=function(_0x423ad0,_0x27ad34){return db['ChatQueueReport']['describe']()['then'](respondWithResult(_0x27ad34,null))['catch'](handleError(_0x27ad34,null));}; \ No newline at end of file +var _0xbbba=['ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','destroy','stack','name','send','index','ChatQueueReport','rawAttributes','model','query','dateStart','dateEnd','attributes','fields','length','nolimit','order','sort','where','filters','pick','add','day','merge','filter','options','then','includeAll','include','findAll','catch','show','keys','intersection','create','update','body','find','params','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbbba,0x100));var _0xabbb=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xbbba[_0x5caf7e];return _0x5c3435;};'use strict';var jsonpatch=require(_0xabbb('0x0'));var rp=require(_0xabbb('0x1'));var moment=require(_0xabbb('0x2'));var BPromise=require(_0xabbb('0x3'));var Mustache=require(_0xabbb('0x4'));var util=require(_0xabbb('0x5'));var path=require(_0xabbb('0x6'));var sox=require('sox');var csv=require(_0xabbb('0x7'));var ejs=require(_0xabbb('0x8'));var fs=require('fs');var _=require(_0xabbb('0x9'));var squel=require(_0xabbb('0xa'));var crypto=require(_0xabbb('0xb'));var jsforce=require(_0xabbb('0xc'));var deskjs=require(_0xabbb('0xd'));var toCsv=require(_0xabbb('0x7'));var querystring=require('querystring');var Papa=require(_0xabbb('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xabbb('0xf'))(_0xabbb('0x10'));var utils=require(_0xabbb('0x11'));var config=require(_0xabbb('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d1944,_0x4e69cf){_0x4e69cf=_0x4e69cf||0xcc;return function(_0x411a8c){if(_0x411a8c){return _0x3d1944[_0xabbb('0x13')](_0x4e69cf);}return _0x3d1944['status'](_0x4e69cf)[_0xabbb('0x14')]();};}function respondWithResult(_0x488f8b,_0x419261){_0x419261=_0x419261||0xc8;return function(_0x56a161){if(_0x56a161){return _0x488f8b[_0xabbb('0x15')](_0x419261)[_0xabbb('0x16')](_0x56a161);}};}function respondWithFilteredResult(_0x1f4c54,_0x5800de){return function(_0x123fdc){if(_0x123fdc){var _0x45e3b1=_0x123fdc[_0xabbb('0x17')],_0x1348e0=_0x5800de[_0xabbb('0x18')],_0x3a04cf=_0x5800de['offset']+_0x5800de[_0xabbb('0x19')],_0x445ffd;if(_0x3a04cf>=_0x45e3b1){_0x3a04cf=_0x45e3b1;_0x445ffd=0xc8;}else{_0x445ffd=0xce;}_0x1f4c54['status'](_0x445ffd);return _0x1f4c54['set'](_0xabbb('0x1a'),_0x1348e0+'-'+_0x3a04cf+'/'+_0x45e3b1)[_0xabbb('0x16')](_0x123fdc);}return null;};}function patchUpdates(_0x39b0d5){return function(_0x90a528){try{jsonpatch['apply'](_0x90a528,_0x39b0d5,!![]);}catch(_0xc8b05f){return BPromise['reject'](_0xc8b05f);}return _0x90a528['save']();};}function saveUpdates(_0x2a91b,_0x5b314f){return function(_0x3aea35){if(_0x3aea35){return _0x3aea35['update'](_0x2a91b)['then'](function(_0x30b2ce){return _0x30b2ce;});}return null;};}function removeEntity(_0x140ffc,_0x1f110b){return function(_0x396c6c){if(_0x396c6c){return _0x396c6c[_0xabbb('0x1b')]()['then'](function(){_0x140ffc[_0xabbb('0x15')](0xcc)[_0xabbb('0x14')]();});}};}function handleEntityNotFound(_0x5676e0,_0xa41204){return function(_0x1e8fab){if(!_0x1e8fab){_0x5676e0['sendStatus'](0x194);}return _0x1e8fab;};}function handleError(_0x576a06,_0x1d4a58){_0x1d4a58=_0x1d4a58||0x1f4;return function(_0x5b23aa){logger['error'](_0x5b23aa[_0xabbb('0x1c')]);if(_0x5b23aa[_0xabbb('0x1d')]){delete _0x5b23aa[_0xabbb('0x1d')];}_0x576a06[_0xabbb('0x15')](_0x1d4a58)[_0xabbb('0x1e')](_0x5b23aa);};}exports[_0xabbb('0x1f')]=function(_0x5d0f70,_0x58cbf5){var _0x4dedc0={},_0x1091e6={},_0x4afb2c={'count':0x0,'rows':[]};var _0x2e00b7=db[_0xabbb('0x20')][_0xabbb('0x21')];_0x1091e6[_0xabbb('0x22')]=_['keys'](_0x2e00b7);var _0x48a483={'dateStart':_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x24')],'dateEnd':_0x5d0f70['query'][_0xabbb('0x25')]};delete _0x5d0f70[_0xabbb('0x23')][_0xabbb('0x24')];delete _0x5d0f70[_0xabbb('0x23')]['dateEnd'];_0x1091e6[_0xabbb('0x23')]=_['keys'](_0x5d0f70[_0xabbb('0x23')]);_0x1091e6['filters']=_['intersection'](_0x1091e6[_0xabbb('0x22')],_0x1091e6[_0xabbb('0x23')]);_0x4dedc0[_0xabbb('0x26')]=_['intersection'](_0x1091e6['model'],qs[_0xabbb('0x27')](_0x5d0f70[_0xabbb('0x23')]['fields']));_0x4dedc0[_0xabbb('0x26')]=_0x4dedc0[_0xabbb('0x26')][_0xabbb('0x28')]?_0x4dedc0['attributes']:_0x1091e6['model'];if(!_0x5d0f70[_0xabbb('0x23')]['hasOwnProperty'](_0xabbb('0x29'))){_0x4dedc0['limit']=qs['limit'](_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x19')]);_0x4dedc0['offset']=qs[_0xabbb('0x18')](_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x18')]);}_0x4dedc0[_0xabbb('0x2a')]=qs[_0xabbb('0x2b')](_0x5d0f70['query']['sort']);_0x4dedc0[_0xabbb('0x2c')]=qs[_0xabbb('0x2d')](_[_0xabbb('0x2e')](_0x5d0f70[_0xabbb('0x23')],_0x1091e6[_0xabbb('0x2d')]));if(_0x48a483['dateStart']){if(_0x48a483[_0xabbb('0x25')]){_0x48a483[_0xabbb('0x25')]=moment(_0x48a483['dateEnd'])[_0xabbb('0x2f')](0x1,_0xabbb('0x30'));}else{_0x48a483[_0xabbb('0x25')]=moment(_0x48a483[_0xabbb('0x24')])[_0xabbb('0x2f')](0x1,_0xabbb('0x30'));}_[_0xabbb('0x31')](_0x4dedc0[_0xabbb('0x2c')],{'createdAt':{'$gte':_0x48a483[_0xabbb('0x24')],'$lte':_0x48a483[_0xabbb('0x25')]}});}if(_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x32')]){_0x4dedc0['where']=_[_0xabbb('0x31')](_0x4dedc0[_0xabbb('0x2c')],{'$or':_['map'](_0x4dedc0[_0xabbb('0x26')],function(_0x11f66c){var _0x354250={};_0x354250[_0x11f66c]={'$like':'%'+_0x5d0f70['query'][_0xabbb('0x32')]+'%'};return _0x354250;})});}_0x4dedc0=_[_0xabbb('0x31')]({},_0x4dedc0,_0x5d0f70[_0xabbb('0x33')]);var _0x13c02e={'where':_0x4dedc0[_0xabbb('0x2c')]};return db[_0xabbb('0x20')][_0xabbb('0x17')](_0x13c02e)[_0xabbb('0x34')](function(_0x38987b){_0x4afb2c[_0xabbb('0x17')]=_0x38987b;if(_0x5d0f70[_0xabbb('0x23')][_0xabbb('0x35')]){_0x4dedc0[_0xabbb('0x36')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xabbb('0x37')](_0x4dedc0);})[_0xabbb('0x34')](function(_0x439bd5){_0x4afb2c['rows']=_0x439bd5;return _0x4afb2c;})[_0xabbb('0x34')](respondWithFilteredResult(_0x58cbf5,_0x4dedc0))[_0xabbb('0x38')](handleError(_0x58cbf5,null));};exports[_0xabbb('0x39')]=function(_0x5208ca,_0x3c208d){var _0x4d9128={'raw':!![],'where':{'id':_0x5208ca['params']['id']}},_0x2cb689={};_0x2cb689[_0xabbb('0x22')]=_[_0xabbb('0x3a')](db[_0xabbb('0x20')][_0xabbb('0x21')]);_0x2cb689[_0xabbb('0x23')]=_[_0xabbb('0x3a')](_0x5208ca['query']);_0x2cb689['filters']=_[_0xabbb('0x3b')](_0x2cb689[_0xabbb('0x22')],_0x2cb689[_0xabbb('0x23')]);_0x4d9128['attributes']=_[_0xabbb('0x3b')](_0x2cb689[_0xabbb('0x22')],qs[_0xabbb('0x27')](_0x5208ca['query'][_0xabbb('0x27')]));_0x4d9128[_0xabbb('0x26')]=_0x4d9128[_0xabbb('0x26')][_0xabbb('0x28')]?_0x4d9128[_0xabbb('0x26')]:_0x2cb689[_0xabbb('0x22')];if(_0x5208ca[_0xabbb('0x23')][_0xabbb('0x35')]){_0x4d9128['include']=[{'all':!![]}];}_0x4d9128=_[_0xabbb('0x31')]({},_0x4d9128,_0x5208ca[_0xabbb('0x33')]);return db[_0xabbb('0x20')]['find'](_0x4d9128)[_0xabbb('0x34')](handleEntityNotFound(_0x3c208d,null))[_0xabbb('0x34')](respondWithResult(_0x3c208d,null))['catch'](handleError(_0x3c208d,null));};exports[_0xabbb('0x3c')]=function(_0x5bb2db,_0x3d97b5){return db['ChatQueueReport'][_0xabbb('0x3c')](_0x5bb2db['body'],{})['then'](respondWithResult(_0x3d97b5,0xc9))[_0xabbb('0x38')](handleError(_0x3d97b5,null));};exports[_0xabbb('0x3d')]=function(_0x248b55,_0x2d2bdd){if(_0x248b55[_0xabbb('0x3e')]['id']){delete _0x248b55[_0xabbb('0x3e')]['id'];}return db['ChatQueueReport'][_0xabbb('0x3f')]({'where':{'id':_0x248b55[_0xabbb('0x40')]['id']}})[_0xabbb('0x34')](handleEntityNotFound(_0x2d2bdd,null))['then'](saveUpdates(_0x248b55['body'],null))[_0xabbb('0x34')](respondWithResult(_0x2d2bdd,null))[_0xabbb('0x38')](handleError(_0x2d2bdd,null));};exports['destroy']=function(_0x37b676,_0x397585){return db[_0xabbb('0x20')][_0xabbb('0x3f')]({'where':{'id':_0x37b676[_0xabbb('0x40')]['id']}})[_0xabbb('0x34')](handleEntityNotFound(_0x397585,null))[_0xabbb('0x34')](removeEntity(_0x397585,null))[_0xabbb('0x38')](handleError(_0x397585,null));};exports[_0xabbb('0x41')]=function(_0x567f00,_0x5e055e){return db[_0xabbb('0x20')][_0xabbb('0x41')]()[_0xabbb('0x34')](respondWithResult(_0x5e055e,null))[_0xabbb('0x38')](handleError(_0x5e055e,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 97d8a8f..6baa53d 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 _0x3e74=['define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment','./chatQueueReport.attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x32e142,_0x4d3b8e){_0x32e142=_0x32e142-0x0;var _0x2340bc=_0x3e74[_0x32e142];return _0x2340bc;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x43e7('0x4'));module['exports']=function(_0x128b0f,_0xe838b4){return _0x128b0f[_0x43e7('0x5')](_0x43e7('0x6'),attributes,{'tableName':_0x43e7('0x7'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x43e7('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x55ca=['request-promise','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util','bluebird'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x55ca,0x126));var _0xa55c=function(_0x59342a,_0x16827b){_0x59342a=_0x59342a-0x0;var _0x17abc9=_0x55ca[_0x59342a];return _0x17abc9;};'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 attributes=require('./chatQueueReport.attributes');module[_0xa55c('0x4')]=function(_0x2db02a,_0xcb02e3){return _0x2db02a[_0xa55c('0x5')](_0xa55c('0x6'),attributes,{'tableName':_0xa55c('0x7'),'paranoid':![],'indexes':[{'name':_0xa55c('0x8'),'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 97ca2bc..47de0cc 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 _0x5fc3=['where','attributes','limit','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','UpdateChatQueueReport','update','raw'];(function(_0x152e97,_0x34e6b6){var _0x30aaca=function(_0x273813){while(--_0x273813){_0x152e97['push'](_0x152e97['shift']());}};_0x30aaca(++_0x34e6b6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x5fc3[_0x221ba2];return _0x47d08e;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var db=require(_0x35fc('0x4'))['db'];var utils=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('rpc');var config=require(_0x35fc('0x7'));var jayson=require(_0x35fc('0x8'));var client=jayson[_0x35fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5754be,_0x19a0d1,_0x508b32){return new BPromise(function(_0x16e153,_0x27524f){return client[_0x35fc('0xa')](_0x5754be,_0x508b32)[_0x35fc('0xb')](function(_0x34ff19){logger[_0x35fc('0xc')](_0x35fc('0xd'),_0x19a0d1,'request\x20sent');logger[_0x35fc('0xe')](_0x35fc('0xf'),_0x19a0d1,'request\x20sent',JSON[_0x35fc('0x10')](_0x34ff19));if(_0x34ff19[_0x35fc('0x11')]){if(_0x34ff19['error'][_0x35fc('0x12')]===0x1f4){logger[_0x35fc('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x19a0d1,_0x34ff19['error'][_0x35fc('0x13')]);return _0x27524f(_0x34ff19['error'][_0x35fc('0x13')]);}logger[_0x35fc('0x11')](_0x35fc('0xd'),_0x19a0d1,_0x34ff19[_0x35fc('0x11')][_0x35fc('0x13')]);return _0x16e153(_0x34ff19['error']['message']);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x19a0d1,_0x35fc('0x14'));_0x16e153(_0x34ff19[_0x35fc('0x15')][_0x35fc('0x13')]);}})[_0x35fc('0x16')](function(_0x227a49){logger[_0x35fc('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x19a0d1,_0x227a49);_0x27524f(_0x227a49);});});}exports[_0x35fc('0x17')]=function(_0x45c8b7){var _0x553677=this;return new Promise(function(_0x41e165,_0x363e47){return db[_0x35fc('0x18')]['create'](_0x45c8b7[_0x35fc('0x19')],{'raw':_0x45c8b7[_0x35fc('0x1a')]?_0x45c8b7[_0x35fc('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x35fc('0xb')](function(_0x350a27){logger[_0x35fc('0xc')](_0x35fc('0x17'),_0x45c8b7);logger[_0x35fc('0xe')](_0x35fc('0x17'),_0x45c8b7,JSON[_0x35fc('0x10')](_0x350a27));_0x41e165(_0x350a27);})[_0x35fc('0x16')](function(_0x2405e8){logger[_0x35fc('0x11')]('CreateChatQueueReport',_0x2405e8[_0x35fc('0x13')],_0x45c8b7);_0x363e47(_0x553677[_0x35fc('0x11')](0x1f4,_0x2405e8[_0x35fc('0x13')]));});});};exports[_0x35fc('0x1b')]=function(_0x3b4743){var _0x55e9e7=this;return new Promise(function(_0x33f5e8,_0x4c587a){return db['ChatQueueReport'][_0x35fc('0x1c')](_0x3b4743[_0x35fc('0x19')],{'raw':_0x3b4743[_0x35fc('0x1a')]?_0x3b4743['options'][_0x35fc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4743['options']?_0x3b4743[_0x35fc('0x1a')][_0x35fc('0x1e')]||null:null,'attributes':_0x3b4743['options']?_0x3b4743['options'][_0x35fc('0x1f')]||null:null,'limit':_0x3b4743['options']?_0x3b4743[_0x35fc('0x1a')][_0x35fc('0x20')]||null:null})['then'](function(_0x26b7cb){logger[_0x35fc('0xc')](_0x35fc('0x1b'),_0x3b4743);logger[_0x35fc('0xe')](_0x35fc('0x1b'),_0x3b4743,JSON[_0x35fc('0x10')](_0x26b7cb));_0x33f5e8(_0x26b7cb);})[_0x35fc('0x16')](function(_0x451f0c){logger['error'](_0x35fc('0x1b'),_0x451f0c[_0x35fc('0x13')],_0x3b4743);_0x4c587a(_0x55e9e7[_0x35fc('0x11')](0x1f4,_0x451f0c['message']));});});}; \ No newline at end of file +var _0x326f=['jayson/promise','client','http','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ChatQueueReport','create','raw','then','CreateChatQueueReport','UpdateChatQueueReport','options','where','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11ae3a,_0x173eba){var _0x1ce9de=function(_0x51af7f){while(--_0x51af7f){_0x11ae3a['push'](_0x11ae3a['shift']());}};_0x1ce9de(++_0x173eba);}(_0x326f,0xd1));var _0xf326=function(_0x5e2e20,_0x10c1d4){_0x5e2e20=_0x5e2e20-0x0;var _0x2df52c=_0x326f[_0x5e2e20];return _0x2df52c;};'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 db=require(_0xf326('0x3'))['db'];var utils=require(_0xf326('0x4'));var logger=require(_0xf326('0x5'))(_0xf326('0x6'));var config=require(_0xf326('0x7'));var jayson=require(_0xf326('0x8'));var client=jayson[_0xf326('0x9')][_0xf326('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c2249,_0x3c254d,_0x3851eb){return new BPromise(function(_0x165f95,_0x1e7b8a){return client['request'](_0x4c2249,_0x3851eb)['then'](function(_0x592975){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3c254d,_0xf326('0xd'));logger[_0xf326('0xe')](_0xf326('0xf'),_0x3c254d,'request\x20sent',JSON[_0xf326('0x10')](_0x592975));if(_0x592975['error']){if(_0x592975[_0xf326('0x11')]['code']===0x1f4){logger[_0xf326('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3c254d,_0x592975[_0xf326('0x11')][_0xf326('0x12')]);return _0x1e7b8a(_0x592975['error'][_0xf326('0x12')]);}logger[_0xf326('0x11')](_0xf326('0xc'),_0x3c254d,_0x592975[_0xf326('0x11')]['message']);return _0x165f95(_0x592975[_0xf326('0x11')]['message']);}else{logger['info'](_0xf326('0xc'),_0x3c254d,_0xf326('0xd'));_0x165f95(_0x592975[_0xf326('0x13')][_0xf326('0x12')]);}})[_0xf326('0x14')](function(_0x287a2a){logger[_0xf326('0x11')](_0xf326('0xc'),_0x3c254d,_0x287a2a);_0x1e7b8a(_0x287a2a);});});}exports['CreateChatQueueReport']=function(_0x3ad7da){var _0x453100=this;return new Promise(function(_0x18bee3,_0x31ffb9){return db[_0xf326('0x15')][_0xf326('0x16')](_0x3ad7da['body'],{'raw':_0x3ad7da['options']?_0x3ad7da['options'][_0xf326('0x17')]===undefined?!![]:![]:!![]})[_0xf326('0x18')](function(_0x484cbe){logger['info'](_0xf326('0x19'),_0x3ad7da);logger['debug']('CreateChatQueueReport',_0x3ad7da,JSON[_0xf326('0x10')](_0x484cbe));_0x18bee3(_0x484cbe);})[_0xf326('0x14')](function(_0x549b46){logger['error'](_0xf326('0x19'),_0x549b46[_0xf326('0x12')],_0x3ad7da);_0x31ffb9(_0x453100['error'](0x1f4,_0x549b46[_0xf326('0x12')]));});});};exports[_0xf326('0x1a')]=function(_0x43c53e){var _0x295752=this;return new Promise(function(_0x17c157,_0x2049ec){return db['ChatQueueReport']['update'](_0x43c53e['body'],{'raw':_0x43c53e[_0xf326('0x1b')]?_0x43c53e[_0xf326('0x1b')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43c53e[_0xf326('0x1b')]?_0x43c53e[_0xf326('0x1b')][_0xf326('0x1c')]||null:null,'attributes':_0x43c53e['options']?_0x43c53e[_0xf326('0x1b')][_0xf326('0x1d')]||null:null,'limit':_0x43c53e[_0xf326('0x1b')]?_0x43c53e['options'][_0xf326('0x1e')]||null:null})['then'](function(_0x4a9abf){logger[_0xf326('0xb')](_0xf326('0x1a'),_0x43c53e);logger[_0xf326('0xe')]('UpdateChatQueueReport',_0x43c53e,JSON[_0xf326('0x10')](_0x4a9abf));_0x17c157(_0x4a9abf);})[_0xf326('0x14')](function(_0x55790d){logger[_0xf326('0x11')](_0xf326('0x1a'),_0x55790d[_0xf326('0x12')],_0x43c53e);_0x2049ec(_0x295752[_0xf326('0x11')](0x1f4,_0x55790d[_0xf326('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8e8f4c9..8cd96a2 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 _0x2c06=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','express','Router','../../components/auth/service'];(function(_0x14492f,_0x31e099){var _0x142a3d=function(_0x3e3f46){while(--_0x3e3f46){_0x14492f['push'](_0x14492f['shift']());}};_0x142a3d(++_0x31e099);}(_0x2c06,0xb9));var _0x62c0=function(_0x2654b1,_0x3057ef){_0x2654b1=_0x2654b1-0x0;var _0x1508a9=_0x2c06[_0x2654b1];return _0x1508a9;};'use strict';var multer=require('multer');var util=require(_0x62c0('0x0'));var path=require('path');var express=require(_0x62c0('0x1'));var router=express[_0x62c0('0x2')]();var auth=require(_0x62c0('0x3'));var interaction=require(_0x62c0('0x4'));var config=require(_0x62c0('0x5'));var controller=require(_0x62c0('0x6'));router[_0x62c0('0x7')]('/',auth[_0x62c0('0x8')](),controller[_0x62c0('0x9')]);router[_0x62c0('0x7')](_0x62c0('0xa'),auth[_0x62c0('0x8')](),controller[_0x62c0('0xb')]);router[_0x62c0('0x7')](_0x62c0('0xc'),auth[_0x62c0('0x8')](),controller[_0x62c0('0xd')]);router[_0x62c0('0xe')]('/',auth[_0x62c0('0x8')](),controller[_0x62c0('0xf')]);router[_0x62c0('0x10')]('/:id',auth[_0x62c0('0x8')](),controller[_0x62c0('0x11')]);router[_0x62c0('0x12')]('/:id',auth[_0x62c0('0x8')](),controller[_0x62c0('0x13')]);module[_0x62c0('0x14')]=router; \ No newline at end of file +var _0xc08b=['put','delete','destroy','exports','util','express','Router','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x58803c,_0x4a34df){var _0xf95b9b=function(_0x597eb8){while(--_0x597eb8){_0x58803c['push'](_0x58803c['shift']());}};_0xf95b9b(++_0x4a34df);}(_0xc08b,0x1b4));var _0xbc08=function(_0xc4d753,_0x2196b9){_0xc4d753=_0xc4d753-0x0;var _0x53ed4c=_0xc08b[_0xc4d753];return _0x53ed4c;};'use strict';var multer=require('multer');var util=require(_0xbc08('0x0'));var path=require('path');var express=require(_0xbc08('0x1'));var router=express[_0xbc08('0x2')]();var auth=require(_0xbc08('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xbc08('0x4'));var controller=require(_0xbc08('0x5'));router[_0xbc08('0x6')]('/',auth[_0xbc08('0x7')](),controller[_0xbc08('0x8')]);router['get']('/describe',auth[_0xbc08('0x7')](),controller[_0xbc08('0x9')]);router[_0xbc08('0x6')](_0xbc08('0xa'),auth[_0xbc08('0x7')](),controller[_0xbc08('0xb')]);router[_0xbc08('0xc')]('/',auth[_0xbc08('0x7')](),controller[_0xbc08('0xd')]);router[_0xbc08('0xe')](_0xbc08('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xbc08('0xf')](_0xbc08('0xa'),auth['isAuthenticated'](),controller[_0xbc08('0x10')]);module[_0xbc08('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index aa063c9..a5c801b 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 _0x407e=['STRING','ENUM','account','DATE','NOW','sequelize'];(function(_0x1ff7f9,_0x7f4e5d){var _0x42f261=function(_0xa4451a){while(--_0xa4451a){_0x1ff7f9['push'](_0x1ff7f9['shift']());}};_0x42f261(++_0x7f4e5d);}(_0x407e,0x1f1));var _0xe407=function(_0x3564d6,_0x37d1cb){_0x3564d6=_0x3564d6-0x0;var _0x1f2267=_0x407e[_0x3564d6];return _0x1f2267;};'use strict';var moment=require('moment');var Sequelize=require(_0xe407('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe407('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe407('0x2')](_0xe407('0x3'),'agent','queue'),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xe407('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xe407('0x5')]}}; \ No newline at end of file +var _0xca69=['agent','queue','DATE','NOW','sequelize','exports','ENUM'];(function(_0x23ac61,_0x48e4b4){var _0x974205=function(_0x1d60cd){while(--_0x1d60cd){_0x23ac61['push'](_0x23ac61['shift']());}};_0x974205(++_0x48e4b4);}(_0xca69,0xc8));var _0x9ca6=function(_0x1b419b,_0x3d6126){_0x1b419b=_0x1b419b-0x0;var _0x498ca8=_0xca69[_0x1b419b];return _0x498ca8;};'use strict';var moment=require('moment');var Sequelize=require(_0x9ca6('0x0'));module[_0x9ca6('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x9ca6('0x2')]('account',_0x9ca6('0x3'),'queue'),'allowNull':![],'defaultValue':_0x9ca6('0x4')},'transferredAt':{'type':Sequelize[_0x9ca6('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x9ca6('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 57f38bf..de7f6e9 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 _0xc092=['end','count','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','add','day','filter','merge','includeAll','include','findAll','rows','catch','show','params','ChatTransferReport','rawAttributes','length','options','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x1ddcd3,_0x298de7){var _0x2bb987=function(_0x36202c){while(--_0x36202c){_0x1ddcd3['push'](_0x1ddcd3['shift']());}};_0x2bb987(++_0x298de7);}(_0xc092,0x1a8));var _0x2c09=function(_0xbe4939,_0x1390e0){_0xbe4939=_0xbe4939-0x0;var _0x23be65=_0xc092[_0xbe4939];return _0x23be65;};'use strict';var jsonpatch=require(_0x2c09('0x0'));var rp=require(_0x2c09('0x1'));var moment=require('moment');var BPromise=require(_0x2c09('0x2'));var Mustache=require(_0x2c09('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2c09('0x4'));var csv=require(_0x2c09('0x5'));var ejs=require(_0x2c09('0x6'));var fs=require('fs');var _=require(_0x2c09('0x7'));var squel=require('squel');var crypto=require(_0x2c09('0x8'));var jsforce=require(_0x2c09('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x2c09('0x5'));var querystring=require(_0x2c09('0xa'));var Papa=require(_0x2c09('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x2c09('0xc'));var utils=require(_0x2c09('0xd'));var config=require('../../config/environment');var db=require(_0x2c09('0xe'))['db'];function respondWithStatusCode(_0x1b7609,_0x17b913){_0x17b913=_0x17b913||0xcc;return function(_0x280bc3){if(_0x280bc3){return _0x1b7609[_0x2c09('0xf')](_0x17b913);}return _0x1b7609[_0x2c09('0x10')](_0x17b913)[_0x2c09('0x11')]();};}function respondWithResult(_0x5ef634,_0x516174){_0x516174=_0x516174||0xc8;return function(_0x1ad519){if(_0x1ad519){return _0x5ef634[_0x2c09('0x10')](_0x516174)['json'](_0x1ad519);}};}function respondWithFilteredResult(_0x4b64e9,_0x5af4b3){return function(_0x4f859f){if(_0x4f859f){var _0xa2c7fb=_0x4f859f[_0x2c09('0x12')],_0x428254=_0x5af4b3['offset'],_0x279279=_0x5af4b3[_0x2c09('0x13')]+_0x5af4b3[_0x2c09('0x14')],_0x59117a;if(_0x279279>=_0xa2c7fb){_0x279279=_0xa2c7fb;_0x59117a=0xc8;}else{_0x59117a=0xce;}_0x4b64e9[_0x2c09('0x10')](_0x59117a);return _0x4b64e9['set'](_0x2c09('0x15'),_0x428254+'-'+_0x279279+'/'+_0xa2c7fb)[_0x2c09('0x16')](_0x4f859f);}return null;};}function patchUpdates(_0x483ac9){return function(_0x4dfd8b){try{jsonpatch[_0x2c09('0x17')](_0x4dfd8b,_0x483ac9,!![]);}catch(_0x190588){return BPromise[_0x2c09('0x18')](_0x190588);}return _0x4dfd8b[_0x2c09('0x19')]();};}function saveUpdates(_0x1197f0,_0x19ee12){return function(_0x106564){if(_0x106564){return _0x106564[_0x2c09('0x1a')](_0x1197f0)[_0x2c09('0x1b')](function(_0x826070){return _0x826070;});}return null;};}function removeEntity(_0x25b7c7,_0x252000){return function(_0x499bb6){if(_0x499bb6){return _0x499bb6[_0x2c09('0x1c')]()[_0x2c09('0x1b')](function(){_0x25b7c7['status'](0xcc)[_0x2c09('0x11')]();});}};}function handleEntityNotFound(_0x5d986f,_0x28af65){return function(_0x52e673){if(!_0x52e673){_0x5d986f[_0x2c09('0xf')](0x194);}return _0x52e673;};}function handleError(_0x1b00fc,_0x51fef1){_0x51fef1=_0x51fef1||0x1f4;return function(_0x2bc51c){logger['error'](_0x2bc51c[_0x2c09('0x1d')]);if(_0x2bc51c[_0x2c09('0x1e')]){delete _0x2bc51c[_0x2c09('0x1e')];}_0x1b00fc['status'](_0x51fef1)['send'](_0x2bc51c);};}exports['index']=function(_0x340814,_0x31a890){var _0x266a93={},_0x3b010a={},_0x36e418={'count':0x0,'rows':[]};var _0x248f03=db['ChatTransferReport']['rawAttributes'];_0x3b010a[_0x2c09('0x1f')]=_['keys'](_0x248f03);var _0x432f06={'dateStart':_0x340814['query'][_0x2c09('0x20')],'dateEnd':_0x340814[_0x2c09('0x21')][_0x2c09('0x22')]};delete _0x340814[_0x2c09('0x21')][_0x2c09('0x20')];delete _0x340814[_0x2c09('0x21')][_0x2c09('0x22')];_0x3b010a[_0x2c09('0x21')]=_[_0x2c09('0x23')](_0x340814['query']);_0x3b010a['filters']=_[_0x2c09('0x24')](_0x3b010a[_0x2c09('0x1f')],_0x3b010a['query']);_0x266a93[_0x2c09('0x25')]=_[_0x2c09('0x24')](_0x3b010a[_0x2c09('0x1f')],qs[_0x2c09('0x26')](_0x340814[_0x2c09('0x21')][_0x2c09('0x26')]));_0x266a93['attributes']=_0x266a93[_0x2c09('0x25')]['length']?_0x266a93[_0x2c09('0x25')]:_0x3b010a[_0x2c09('0x1f')];if(!_0x340814['query'][_0x2c09('0x27')](_0x2c09('0x28'))){_0x266a93[_0x2c09('0x14')]=qs[_0x2c09('0x14')](_0x340814['query'][_0x2c09('0x14')]);_0x266a93['offset']=qs[_0x2c09('0x13')](_0x340814['query'][_0x2c09('0x13')]);}_0x266a93['order']=qs['sort'](_0x340814['query']['sort']);_0x266a93[_0x2c09('0x29')]=qs[_0x2c09('0x2a')](_[_0x2c09('0x2b')](_0x340814['query'],_0x3b010a[_0x2c09('0x2a')]));if(_0x432f06['dateStart']){if(_0x432f06[_0x2c09('0x22')]){_0x432f06[_0x2c09('0x22')]=moment(_0x432f06['dateEnd'])[_0x2c09('0x2c')](0x1,_0x2c09('0x2d'));}else{_0x432f06['dateEnd']=moment(_0x432f06[_0x2c09('0x20')])[_0x2c09('0x2c')](0x1,_0x2c09('0x2d'));}_['merge'](_0x266a93[_0x2c09('0x29')],{'createdAt':{'$gte':_0x432f06[_0x2c09('0x20')],'$lte':_0x432f06[_0x2c09('0x22')]}});}if(_0x340814[_0x2c09('0x21')][_0x2c09('0x2e')]){_0x266a93[_0x2c09('0x29')]=_[_0x2c09('0x2f')](_0x266a93[_0x2c09('0x29')],{'$or':_['map'](_0x266a93[_0x2c09('0x25')],function(_0x24755c){var _0x3888fd={};_0x3888fd[_0x24755c]={'$like':'%'+_0x340814[_0x2c09('0x21')][_0x2c09('0x2e')]+'%'};return _0x3888fd;})});}_0x266a93=_[_0x2c09('0x2f')]({},_0x266a93,_0x340814['options']);var _0x33059d={'where':_0x266a93['where']};return db['ChatTransferReport']['count'](_0x33059d)[_0x2c09('0x1b')](function(_0x545040){_0x36e418[_0x2c09('0x12')]=_0x545040;if(_0x340814[_0x2c09('0x21')][_0x2c09('0x30')]){_0x266a93[_0x2c09('0x31')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x2c09('0x32')](_0x266a93);})['then'](function(_0x39a5f7){_0x36e418[_0x2c09('0x33')]=_0x39a5f7;return _0x36e418;})['then'](respondWithFilteredResult(_0x31a890,_0x266a93))[_0x2c09('0x34')](handleError(_0x31a890,null));};exports[_0x2c09('0x35')]=function(_0x4472a4,_0x233691){var _0xe32a0a={'raw':!![],'where':{'id':_0x4472a4[_0x2c09('0x36')]['id']}},_0x2a7300={};_0x2a7300['model']=_[_0x2c09('0x23')](db[_0x2c09('0x37')][_0x2c09('0x38')]);_0x2a7300[_0x2c09('0x21')]=_[_0x2c09('0x23')](_0x4472a4[_0x2c09('0x21')]);_0x2a7300[_0x2c09('0x2a')]=_[_0x2c09('0x24')](_0x2a7300[_0x2c09('0x1f')],_0x2a7300['query']);_0xe32a0a[_0x2c09('0x25')]=_['intersection'](_0x2a7300[_0x2c09('0x1f')],qs[_0x2c09('0x26')](_0x4472a4[_0x2c09('0x21')][_0x2c09('0x26')]));_0xe32a0a[_0x2c09('0x25')]=_0xe32a0a[_0x2c09('0x25')][_0x2c09('0x39')]?_0xe32a0a[_0x2c09('0x25')]:_0x2a7300['model'];if(_0x4472a4[_0x2c09('0x21')][_0x2c09('0x30')]){_0xe32a0a[_0x2c09('0x31')]=[{'all':!![]}];}_0xe32a0a=_[_0x2c09('0x2f')]({},_0xe32a0a,_0x4472a4[_0x2c09('0x3a')]);return db[_0x2c09('0x37')][_0x2c09('0x3b')](_0xe32a0a)['then'](handleEntityNotFound(_0x233691,null))[_0x2c09('0x1b')](respondWithResult(_0x233691,null))[_0x2c09('0x34')](handleError(_0x233691,null));};exports[_0x2c09('0x3c')]=function(_0x17535c,_0x56bba7){return db[_0x2c09('0x37')]['create'](_0x17535c[_0x2c09('0x3d')],{})['then'](respondWithResult(_0x56bba7,0xc9))[_0x2c09('0x34')](handleError(_0x56bba7,null));};exports[_0x2c09('0x1a')]=function(_0x44a060,_0x34e015){if(_0x44a060[_0x2c09('0x3d')]['id']){delete _0x44a060['body']['id'];}return db[_0x2c09('0x37')][_0x2c09('0x3b')]({'where':{'id':_0x44a060[_0x2c09('0x36')]['id']}})[_0x2c09('0x1b')](handleEntityNotFound(_0x34e015,null))[_0x2c09('0x1b')](saveUpdates(_0x44a060[_0x2c09('0x3d')],null))[_0x2c09('0x1b')](respondWithResult(_0x34e015,null))[_0x2c09('0x34')](handleError(_0x34e015,null));};exports[_0x2c09('0x1c')]=function(_0x1473ef,_0x9fc36){return db[_0x2c09('0x37')][_0x2c09('0x3b')]({'where':{'id':_0x1473ef[_0x2c09('0x36')]['id']}})[_0x2c09('0x1b')](handleEntityNotFound(_0x9fc36,null))[_0x2c09('0x1b')](removeEntity(_0x9fc36,null))[_0x2c09('0x34')](handleError(_0x9fc36,null));};exports[_0x2c09('0x3e')]=function(_0x1202d9,_0x7485a4){return db[_0x2c09('0x37')][_0x2c09('0x3e')]()[_0x2c09('0x1b')](respondWithResult(_0x7485a4,null))[_0x2c09('0x34')](handleError(_0x7485a4,null));}; \ No newline at end of file +var _0xe921=['to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','end','json','count','offset','Content-Range','apply','reject','save','update','then','error','stack','name','status','ChatTransferReport','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','pick','dateEnd','add','day','merge','where','filter','findAll','rows','catch','params','includeAll','include','find','create','body','destroy','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0x1579a7,_0x5cb266){var _0x510ac3=function(_0x36aecc){while(--_0x36aecc){_0x1579a7['push'](_0x1579a7['shift']());}};_0x510ac3(++_0x5cb266);}(_0xe921,0x139));var _0x1e92=function(_0xac4c7c,_0x560be3){_0xac4c7c=_0xac4c7c-0x0;var _0x21a40c=_0xe921[_0xac4c7c];return _0x21a40c;};'use strict';var jsonpatch=require(_0x1e92('0x0'));var rp=require('request-promise');var moment=require(_0x1e92('0x1'));var BPromise=require(_0x1e92('0x2'));var Mustache=require(_0x1e92('0x3'));var util=require(_0x1e92('0x4'));var path=require(_0x1e92('0x5'));var sox=require(_0x1e92('0x6'));var csv=require(_0x1e92('0x7'));var ejs=require(_0x1e92('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1e92('0x9'));var crypto=require('crypto');var jsforce=require(_0x1e92('0xa'));var deskjs=require(_0x1e92('0xb'));var toCsv=require(_0x1e92('0x7'));var querystring=require('querystring');var Papa=require(_0x1e92('0xc'));var qs=require(_0x1e92('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x1e92('0xe'));var config=require(_0x1e92('0xf'));var db=require(_0x1e92('0x10'))['db'];function respondWithStatusCode(_0x6af6fd,_0x8be7c7){_0x8be7c7=_0x8be7c7||0xcc;return function(_0x16e47f){if(_0x16e47f){return _0x6af6fd['sendStatus'](_0x8be7c7);}return _0x6af6fd['status'](_0x8be7c7)[_0x1e92('0x11')]();};}function respondWithResult(_0x2c02b7,_0x1f8500){_0x1f8500=_0x1f8500||0xc8;return function(_0x348755){if(_0x348755){return _0x2c02b7['status'](_0x1f8500)[_0x1e92('0x12')](_0x348755);}};}function respondWithFilteredResult(_0x1845f2,_0x2acc8c){return function(_0x1e7c43){if(_0x1e7c43){var _0x30610c=_0x1e7c43[_0x1e92('0x13')],_0x328876=_0x2acc8c[_0x1e92('0x14')],_0x317933=_0x2acc8c[_0x1e92('0x14')]+_0x2acc8c['limit'],_0x381b37;if(_0x317933>=_0x30610c){_0x317933=_0x30610c;_0x381b37=0xc8;}else{_0x381b37=0xce;}_0x1845f2['status'](_0x381b37);return _0x1845f2['set'](_0x1e92('0x15'),_0x328876+'-'+_0x317933+'/'+_0x30610c)[_0x1e92('0x12')](_0x1e7c43);}return null;};}function patchUpdates(_0x14ff85){return function(_0x39f472){try{jsonpatch[_0x1e92('0x16')](_0x39f472,_0x14ff85,!![]);}catch(_0xfcf42d){return BPromise[_0x1e92('0x17')](_0xfcf42d);}return _0x39f472[_0x1e92('0x18')]();};}function saveUpdates(_0x47f07f,_0x1d952a){return function(_0x3d2406){if(_0x3d2406){return _0x3d2406[_0x1e92('0x19')](_0x47f07f)['then'](function(_0x1e6b4d){return _0x1e6b4d;});}return null;};}function removeEntity(_0x2e198a,_0x4b8b04){return function(_0x10dd87){if(_0x10dd87){return _0x10dd87['destroy']()[_0x1e92('0x1a')](function(){_0x2e198a['status'](0xcc)[_0x1e92('0x11')]();});}};}function handleEntityNotFound(_0x42721d,_0x324d88){return function(_0x2d8116){if(!_0x2d8116){_0x42721d['sendStatus'](0x194);}return _0x2d8116;};}function handleError(_0x4f2fc8,_0xd7be4){_0xd7be4=_0xd7be4||0x1f4;return function(_0x532114){logger[_0x1e92('0x1b')](_0x532114[_0x1e92('0x1c')]);if(_0x532114[_0x1e92('0x1d')]){delete _0x532114[_0x1e92('0x1d')];}_0x4f2fc8[_0x1e92('0x1e')](_0xd7be4)['send'](_0x532114);};}exports['index']=function(_0x3aafba,_0x3b6659){var _0x719308={},_0x1ee421={},_0x3a9132={'count':0x0,'rows':[]};var _0x1917f7=db[_0x1e92('0x1f')][_0x1e92('0x20')];_0x1ee421[_0x1e92('0x21')]=_[_0x1e92('0x22')](_0x1917f7);var _0x95492f={'dateStart':_0x3aafba[_0x1e92('0x23')][_0x1e92('0x24')],'dateEnd':_0x3aafba[_0x1e92('0x23')]['dateEnd']};delete _0x3aafba[_0x1e92('0x23')][_0x1e92('0x24')];delete _0x3aafba[_0x1e92('0x23')]['dateEnd'];_0x1ee421[_0x1e92('0x23')]=_['keys'](_0x3aafba[_0x1e92('0x23')]);_0x1ee421[_0x1e92('0x25')]=_[_0x1e92('0x26')](_0x1ee421[_0x1e92('0x21')],_0x1ee421[_0x1e92('0x23')]);_0x719308[_0x1e92('0x27')]=_[_0x1e92('0x26')](_0x1ee421[_0x1e92('0x21')],qs[_0x1e92('0x28')](_0x3aafba[_0x1e92('0x23')][_0x1e92('0x28')]));_0x719308[_0x1e92('0x27')]=_0x719308[_0x1e92('0x27')][_0x1e92('0x29')]?_0x719308[_0x1e92('0x27')]:_0x1ee421['model'];if(!_0x3aafba[_0x1e92('0x23')][_0x1e92('0x2a')](_0x1e92('0x2b'))){_0x719308['limit']=qs[_0x1e92('0x2c')](_0x3aafba['query'][_0x1e92('0x2c')]);_0x719308[_0x1e92('0x14')]=qs['offset'](_0x3aafba[_0x1e92('0x23')][_0x1e92('0x14')]);}_0x719308[_0x1e92('0x2d')]=qs['sort'](_0x3aafba[_0x1e92('0x23')]['sort']);_0x719308['where']=qs[_0x1e92('0x25')](_[_0x1e92('0x2e')](_0x3aafba[_0x1e92('0x23')],_0x1ee421[_0x1e92('0x25')]));if(_0x95492f[_0x1e92('0x24')]){if(_0x95492f[_0x1e92('0x2f')]){_0x95492f[_0x1e92('0x2f')]=moment(_0x95492f[_0x1e92('0x2f')])[_0x1e92('0x30')](0x1,_0x1e92('0x31'));}else{_0x95492f[_0x1e92('0x2f')]=moment(_0x95492f[_0x1e92('0x24')])['add'](0x1,_0x1e92('0x31'));}_[_0x1e92('0x32')](_0x719308[_0x1e92('0x33')],{'createdAt':{'$gte':_0x95492f[_0x1e92('0x24')],'$lte':_0x95492f[_0x1e92('0x2f')]}});}if(_0x3aafba[_0x1e92('0x23')][_0x1e92('0x34')]){_0x719308[_0x1e92('0x33')]=_[_0x1e92('0x32')](_0x719308[_0x1e92('0x33')],{'$or':_['map'](_0x719308[_0x1e92('0x27')],function(_0x3cceb3){var _0x139f5c={};_0x139f5c[_0x3cceb3]={'$like':'%'+_0x3aafba[_0x1e92('0x23')]['filter']+'%'};return _0x139f5c;})});}_0x719308=_[_0x1e92('0x32')]({},_0x719308,_0x3aafba['options']);var _0x326514={'where':_0x719308['where']};return db[_0x1e92('0x1f')]['count'](_0x326514)['then'](function(_0x29fcea){_0x3a9132[_0x1e92('0x13')]=_0x29fcea;if(_0x3aafba['query']['includeAll']){_0x719308['include']=[{'all':!![]}];}return db[_0x1e92('0x1f')][_0x1e92('0x35')](_0x719308);})[_0x1e92('0x1a')](function(_0x1babb5){_0x3a9132[_0x1e92('0x36')]=_0x1babb5;return _0x3a9132;})['then'](respondWithFilteredResult(_0x3b6659,_0x719308))[_0x1e92('0x37')](handleError(_0x3b6659,null));};exports['show']=function(_0x4657b7,_0x13f4f5){var _0x3e1a98={'raw':!![],'where':{'id':_0x4657b7[_0x1e92('0x38')]['id']}},_0x116b98={};_0x116b98[_0x1e92('0x21')]=_[_0x1e92('0x22')](db[_0x1e92('0x1f')]['rawAttributes']);_0x116b98[_0x1e92('0x23')]=_[_0x1e92('0x22')](_0x4657b7[_0x1e92('0x23')]);_0x116b98['filters']=_[_0x1e92('0x26')](_0x116b98[_0x1e92('0x21')],_0x116b98[_0x1e92('0x23')]);_0x3e1a98[_0x1e92('0x27')]=_['intersection'](_0x116b98[_0x1e92('0x21')],qs['fields'](_0x4657b7[_0x1e92('0x23')][_0x1e92('0x28')]));_0x3e1a98['attributes']=_0x3e1a98[_0x1e92('0x27')][_0x1e92('0x29')]?_0x3e1a98[_0x1e92('0x27')]:_0x116b98[_0x1e92('0x21')];if(_0x4657b7[_0x1e92('0x23')][_0x1e92('0x39')]){_0x3e1a98[_0x1e92('0x3a')]=[{'all':!![]}];}_0x3e1a98=_[_0x1e92('0x32')]({},_0x3e1a98,_0x4657b7['options']);return db['ChatTransferReport'][_0x1e92('0x3b')](_0x3e1a98)[_0x1e92('0x1a')](handleEntityNotFound(_0x13f4f5,null))[_0x1e92('0x1a')](respondWithResult(_0x13f4f5,null))['catch'](handleError(_0x13f4f5,null));};exports[_0x1e92('0x3c')]=function(_0xe70b4a,_0x322cf8){return db[_0x1e92('0x1f')][_0x1e92('0x3c')](_0xe70b4a[_0x1e92('0x3d')],{})[_0x1e92('0x1a')](respondWithResult(_0x322cf8,0xc9))['catch'](handleError(_0x322cf8,null));};exports[_0x1e92('0x19')]=function(_0x5d2509,_0x5a8f1c){if(_0x5d2509['body']['id']){delete _0x5d2509[_0x1e92('0x3d')]['id'];}return db['ChatTransferReport'][_0x1e92('0x3b')]({'where':{'id':_0x5d2509[_0x1e92('0x38')]['id']}})[_0x1e92('0x1a')](handleEntityNotFound(_0x5a8f1c,null))['then'](saveUpdates(_0x5d2509['body'],null))[_0x1e92('0x1a')](respondWithResult(_0x5a8f1c,null))[_0x1e92('0x37')](handleError(_0x5a8f1c,null));};exports[_0x1e92('0x3e')]=function(_0x26a8ea,_0x192b40){return db['ChatTransferReport'][_0x1e92('0x3b')]({'where':{'id':_0x26a8ea[_0x1e92('0x38')]['id']}})[_0x1e92('0x1a')](handleEntityNotFound(_0x192b40,null))[_0x1e92('0x1a')](removeEntity(_0x192b40,null))[_0x1e92('0x37')](handleError(_0x192b40,null));};exports[_0x1e92('0x3f')]=function(_0x4b3eea,_0x3c0930){return db[_0x1e92('0x1f')][_0x1e92('0x3f')]()[_0x1e92('0x1a')](respondWithResult(_0x3c0930,null))[_0x1e92('0x37')](handleError(_0x3c0930,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index c6843c7..fab1f2b 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 _0xe6cd=['../../config/logger','api','bluebird','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xe6cd,0x1cc));var _0xde6c=function(_0x35b4c6,_0x5e57a2){_0x35b4c6=_0x35b4c6-0x0;var _0xa45f4c=_0xe6cd[_0x35b4c6];return _0xa45f4c;};'use strict';var _=require(_0xde6c('0x0'));var util=require(_0xde6c('0x1'));var logger=require(_0xde6c('0x2'))(_0xde6c('0x3'));var moment=require('moment');var BPromise=require(_0xde6c('0x4'));var rp=require('request-promise');var attributes=require(_0xde6c('0x5'));module[_0xde6c('0x6')]=function(_0x4e0a6c,_0x4bce32){return _0x4e0a6c[_0xde6c('0x7')](_0xde6c('0x8'),attributes,{'tableName':_0xde6c('0x9'),'paranoid':![],'indexes':[{'name':_0xde6c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8bb8=['bluebird','request-promise','./chatTransferReport.attributes','exports','define','uniqueid','lodash','util','api','moment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x8bb8,0x6a));var _0x88bb=function(_0x48ff71,_0x590466){_0x48ff71=_0x48ff71-0x0;var _0x248125=_0x8bb8[_0x48ff71];return _0x248125;};'use strict';var _=require(_0x88bb('0x0'));var util=require(_0x88bb('0x1'));var logger=require('../../config/logger')(_0x88bb('0x2'));var moment=require(_0x88bb('0x3'));var BPromise=require(_0x88bb('0x4'));var rp=require(_0x88bb('0x5'));var attributes=require(_0x88bb('0x6'));module[_0x88bb('0x7')]=function(_0x80f05b,_0x51c632){return _0x80f05b[_0x88bb('0x8')]('ChatTransferReport',attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x88bb('0x9'),'fields':[_0x88bb('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 6905c24..70b3333 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 _0x922a=['error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x922a,0x1b8));var _0xa922=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x922a[_0x24061a];return _0x82054e;};'use strict';var _=require(_0xa922('0x0'));var util=require(_0xa922('0x1'));var moment=require(_0xa922('0x2'));var BPromise=require(_0xa922('0x3'));var rs=require(_0xa922('0x4'));var fs=require('fs');var db=require(_0xa922('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa922('0x6'));var config=require(_0xa922('0x7'));var jayson=require(_0xa922('0x8'));var client=jayson['client'][_0xa922('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a685a,_0x5be580,_0x325f5c){return new BPromise(function(_0x2a1e7f,_0x2a6d7c){return client[_0xa922('0xa')](_0x3a685a,_0x325f5c)[_0xa922('0xb')](function(_0x10a8ca){logger[_0xa922('0xc')](_0xa922('0xd'),_0x5be580,_0xa922('0xe'));logger['debug'](_0xa922('0xf'),_0x5be580,_0xa922('0xe'),JSON['stringify'](_0x10a8ca));if(_0x10a8ca[_0xa922('0x10')]){if(_0x10a8ca[_0xa922('0x10')][_0xa922('0x11')]===0x1f4){logger['error'](_0xa922('0xd'),_0x5be580,_0x10a8ca[_0xa922('0x10')][_0xa922('0x12')]);return _0x2a6d7c(_0x10a8ca[_0xa922('0x10')]['message']);}logger[_0xa922('0x10')](_0xa922('0xd'),_0x5be580,_0x10a8ca[_0xa922('0x10')]['message']);return _0x2a1e7f(_0x10a8ca['error']['message']);}else{logger[_0xa922('0xc')](_0xa922('0xd'),_0x5be580,_0xa922('0xe'));_0x2a1e7f(_0x10a8ca['result']['message']);}})['catch'](function(_0x38f869){logger[_0xa922('0x10')](_0xa922('0xd'),_0x5be580,_0x38f869);_0x2a6d7c(_0x38f869);});});} \ No newline at end of file +var _0xc540=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger'];(function(_0xe252de,_0x4e1285){var _0x3b4427=function(_0x2dcfd5){while(--_0x2dcfd5){_0xe252de['push'](_0xe252de['shift']());}};_0x3b4427(++_0x4e1285);}(_0xc540,0x135));var _0x0c54=function(_0x40cc71,_0x27014f){_0x40cc71=_0x40cc71-0x0;var _0x546098=_0xc540[_0x40cc71];return _0x546098;};'use strict';var _=require(_0x0c54('0x0'));var util=require(_0x0c54('0x1'));var moment=require(_0x0c54('0x2'));var BPromise=require(_0x0c54('0x3'));var rs=require(_0x0c54('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0c54('0x5'))(_0x0c54('0x6'));var config=require(_0x0c54('0x7'));var jayson=require(_0x0c54('0x8'));var client=jayson[_0x0c54('0x9')][_0x0c54('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x358155,_0x1112c6,_0x2ed884){return new BPromise(function(_0x58e10e,_0xbc92db){return client[_0x0c54('0xb')](_0x358155,_0x2ed884)[_0x0c54('0xc')](function(_0x58615a){logger[_0x0c54('0xd')](_0x0c54('0xe'),_0x1112c6,_0x0c54('0xf'));logger[_0x0c54('0x10')](_0x0c54('0x11'),_0x1112c6,_0x0c54('0xf'),JSON['stringify'](_0x58615a));if(_0x58615a['error']){if(_0x58615a['error']['code']===0x1f4){logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);return _0xbc92db(_0x58615a[_0x0c54('0x12')]['message']);}logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);return _0x58e10e(_0x58615a[_0x0c54('0x12')][_0x0c54('0x13')]);}else{logger[_0x0c54('0xd')](_0x0c54('0xe'),_0x1112c6,'request\x20sent');_0x58e10e(_0x58615a[_0x0c54('0x14')][_0x0c54('0x13')]);}})['catch'](function(_0x97b4c1){logger[_0x0c54('0x12')](_0x0c54('0xe'),_0x1112c6,_0x97b4c1);_0xbc92db(_0x97b4c1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 97d4436..bf0bb3c 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 _0xcb91=['path','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show','create','put','update','destroy','exports'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xcb91[_0x4eaa4c];return _0x15aec6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var express=require(_0x1cb9('0x1'));var router=express[_0x1cb9('0x2')]();var auth=require(_0x1cb9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1cb9('0x4'));var controller=require(_0x1cb9('0x5'));router['get']('/',auth[_0x1cb9('0x6')](),controller[_0x1cb9('0x7')]);router['get'](_0x1cb9('0x8'),auth[_0x1cb9('0x6')](),controller['describe']);router[_0x1cb9('0x9')](_0x1cb9('0xa'),auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0xa'),auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xe')]);router['delete'](_0x1cb9('0xa'),auth[_0x1cb9('0x6')](),controller[_0x1cb9('0xf')]);module[_0x1cb9('0x10')]=router; \ No newline at end of file +var _0xe706=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0xe706,0xa3));var _0x6e70=function(_0x274d4b,_0x128681){_0x274d4b=_0x274d4b-0x0;var _0x1a1f03=_0xe706[_0x274d4b];return _0x1a1f03;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var express=require('express');var router=express[_0x6e70('0x3')]();var auth=require(_0x6e70('0x4'));var interaction=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var controller=require(_0x6e70('0x7'));router[_0x6e70('0x8')]('/',auth[_0x6e70('0x9')](),controller[_0x6e70('0xa')]);router[_0x6e70('0x8')](_0x6e70('0xb'),auth[_0x6e70('0x9')](),controller[_0x6e70('0xc')]);router[_0x6e70('0x8')](_0x6e70('0xd'),auth[_0x6e70('0x9')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xf')]('/',auth[_0x6e70('0x9')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')](_0x6e70('0xd'),auth[_0x6e70('0x9')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 7db7fbe..b85553f 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 _0xcfcb=['rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','BOOLEAN','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','TEXT','stringify','input','name','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','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:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','System','sequelize','STRING','address','email','Agent','#9f946a','#ffffff'];(function(_0x57a238,_0x4e38d9){var _0x26d344=function(_0x250524){while(--_0x250524){_0x57a238['push'](_0x57a238['shift']());}};_0x26d344(++_0x4e38d9);}(_0xcfcb,0x7a));var _0xbcfc=function(_0x5c049a,_0x2c1263){_0x5c049a=_0x5c049a-0x0;var _0x168e70=_0xcfcb[_0x5c049a];return _0x168e70;};'use strict';var Sequelize=require(_0xbcfc('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![],'unique':_0xbcfc('0x2')},'description':{'type':Sequelize[_0xbcfc('0x1')]},'mapKey':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x3')},'mapKeyOffline':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x3')},'key':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x4')},'customerAlias':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![],'defaultValue':_0xbcfc('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![],'defaultValue':_0xbcfc('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![],'defaultValue':_0xbcfc('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xbcfc('0x7'),_0xbcfc('0x8')),'defaultValue':_0xbcfc('0x7')},'header_online':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x9')},'start_chat_button':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0xb')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbcfc('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xbcfc('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x11')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xbcfc('0x12')},'placeholderMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x14')},'conditionAgreement':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0xbcfc('0x15')](_0xbcfc('0x16'),_0xbcfc('0x17')),'defaultValue':_0xbcfc('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbcfc('0x18')],'defaultValue':function(){return JSON[_0xbcfc('0x19')]({'items':[{'type':_0xbcfc('0x1a'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xbcfc('0x1b'),'helpText':''}},{'type':_0xbcfc('0x1a'),'props':{'title':_0xbcfc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xbcfc('0x3'),'type':_0xbcfc('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbcfc('0x1c')](_0xbcfc('0x1d'))?JSON['parse'](this[_0xbcfc('0x1c')](_0xbcfc('0x1d'))):{};},'set':function(_0x4990b9){return this[_0xbcfc('0x1e')]('onlineForm',JSON[_0xbcfc('0x19')](_0x4990b9));}},'offlineForm':{'type':Sequelize[_0xbcfc('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xbcfc('0x1a'),'props':{'title':_0xbcfc('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xbcfc('0x3'),'type':_0xbcfc('0x3')},'variable':null},{'type':_0xbcfc('0x1f'),'config':{'placeholder':_0xbcfc('0x20')},'props':{'title':'Comments','helpText':_0xbcfc('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xbcfc('0x22'))?JSON['parse'](this[_0xbcfc('0x1c')](_0xbcfc('0x22'))):{};},'set':function(_0x2a03b2){return this[_0xbcfc('0x1e')](_0xbcfc('0x22'),JSON[_0xbcfc('0x19')](_0x2a03b2));}},'token':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':function(){return rs[_0xbcfc('0x23')]();}},'autoclose':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x24')},'waitingMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbcfc('0x14')},'sendUnmanaged':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbcfc('0x1')]},'notificationTemplate':{'type':Sequelize[_0xbcfc('0x18')],'defaultValue':function(){return _0xbcfc('0x28');}},'notificationSound':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':_0xbcfc('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xbcfc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0xbcfc('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xbcfc('0x1')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xbcfc('0x1')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbcfc('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbcfc('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbcfc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbcfc('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbcfc('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbcfc('0x2a')},'systemAvatar':{'type':Sequelize[_0xbcfc('0x18')]}}; \ No newline at end of file +var _0xa282=['We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','sequelize','randomstring','exports','STRING','address','email','#9f946a','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa282,0x189));var _0x2a28=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xa282[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x2a28('0x0'));var rs=require(_0x2a28('0x1'));module[_0x2a28('0x2')]={'name':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'unique':_0x2a28('0x4')},'description':{'type':Sequelize[_0x2a28('0x3')]},'mapKey':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x5')},'mapKeyOffline':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x5')},'key':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'defaultValue':_0x2a28('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x2a28('0x3')],'allowNull':![],'defaultValue':_0x2a28('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a28('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x2a28('0x3')]},'animation':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x2a28('0xa')](_0x2a28('0xb'),'squared'),'defaultValue':_0x2a28('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xd')},'offline_chat_button':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xe')},'header_offline':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xf')},'download_transcript':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x2a28('0x11')]},'closingQuestion':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x12')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x14')},'placeholderMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x15')},'closingMessageButton':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0xe')},'skipMessageButton':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x16')},'conditionAgreement':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'ratingType':{'type':Sequelize[_0x2a28('0xa')](_0x2a28('0x17'),_0x2a28('0x18')),'defaultValue':_0x2a28('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x2a28('0x19')]({'items':[{'type':_0x2a28('0x1a'),'variable':null,'config':{'placeholder':_0x2a28('0x1b'),'type':_0x2a28('0x1c'),'required':!![]},'props':{'title':_0x2a28('0x1b'),'helpText':''}},{'type':_0x2a28('0x1a'),'props':{'title':_0x2a28('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x2a28('0x5'),'type':_0x2a28('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x2a28('0x1d')](_0x2a28('0x1e'))?JSON[_0x2a28('0x1f')](this[_0x2a28('0x1d')](_0x2a28('0x1e'))):{};},'set':function(_0x1d2e90){return this[_0x2a28('0x20')](_0x2a28('0x1e'),JSON[_0x2a28('0x19')](_0x1d2e90));}},'offlineForm':{'type':Sequelize[_0x2a28('0x11')],'defaultValue':function(){return JSON[_0x2a28('0x19')]({'items':[{'type':_0x2a28('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x2a28('0x5'),'type':_0x2a28('0x5')},'variable':null},{'type':_0x2a28('0x21'),'config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0x2a28('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x2a28('0x1d')](_0x2a28('0x23'))?JSON[_0x2a28('0x1f')](this[_0x2a28('0x1d')]('offlineForm')):{};},'set':function(_0x11901c){return this[_0x2a28('0x20')](_0x2a28('0x23'),JSON[_0x2a28('0x19')](_0x11901c));}},'token':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':function(){return rs[_0x2a28('0x24')]();}},'autoclose':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x2a28('0x3')]},'forwardOffline':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x25')},'offlineMessageSubject':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x26')},'offlineMessageBody':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x2a28('0xe')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x2a28('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x2a28('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x2a28('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x29')},'verticalAlignment':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x2a')},'defaultTitle':{'type':Sequelize[_0x2a28('0x3')]},'customerAvatar':{'type':Sequelize[_0x2a28('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x2a28('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2a28('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2a28('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2a28('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x2a28('0x3')],'defaultValue':_0x2a28('0x2c')},'systemAvatar':{'type':Sequelize[_0x2a28('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 71d1e63..88f0e20 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 _0x6474=['papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','name','send','index','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','add','day','merge','filter','ChatWebsite','includeAll','include','findAll','rows','params','length','options','find','create','body','describe','addDisposition','ChatWebsiteId','findOne','Disposition','rawAttributes','map','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','file','addCustomerAvatar','customerAvatar','getLogo','join','root','sitepic','getLicense','custom','isNil','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','list','orderBy','applications','asc','defaults','contact','firstName','lastName','referer','browser','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','stringify','threadId','ChatInteraction','externalUrl','interaction','created','autoclose','push','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','notify','no\x20available\x20attributes','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','ChatOfflineMessage','MailAccount','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','user','pass','sendMail','format','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','interval','ONLINE','OFFLINE','No\x20timezone','Interval','Intervals','../../config/license/util','virtual','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.js','x-forwarded-for','x-real-ip','connection','remoteAddress','alignment','addApplications','sequelize','transaction','bulkCreate','getApplications','addProactiveActions','getProactiveActions','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','userChatWebsite:save','removeAgents','isArray','getAgents','fast-json-patch','moment','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring'];(function(_0x395569,_0x134225){var _0x12233a=function(_0x500702){while(--_0x500702){_0x395569['push'](_0x395569['shift']());}};_0x12233a(++_0x134225);}(_0x6474,0x1f2));var _0x4647=function(_0xf15381,_0xa2819){_0xf15381=_0xf15381-0x0;var _0x14fa93=_0x6474[_0xf15381];return _0x14fa93;};'use strict';var jsonpatch=require(_0x4647('0x0'));var rp=require('request-promise');var moment=require(_0x4647('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4647('0x2'));var path=require('path');var sox=require(_0x4647('0x3'));var csv=require(_0x4647('0x4'));var ejs=require(_0x4647('0x5'));var fs=require('fs');var _=require(_0x4647('0x6'));var squel=require(_0x4647('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4647('0x8'));var toCsv=require(_0x4647('0x4'));var querystring=require(_0x4647('0x9'));var Papa=require(_0x4647('0xa'));var qs=require(_0x4647('0xb'));var logger=require(_0x4647('0xc'))('api');var utils=require(_0x4647('0xd'));var config=require('../../config/environment');var db=require(_0x4647('0xe'))['db'];var socket=require('socket.io-emitter')({'host':_0x4647('0xf'),'port':0x18eb});require(_0x4647('0x10'))[_0x4647('0x11')](socket);var jayson=require(_0x4647('0x12'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4647('0x13')][_0x4647('0x14')]({'port':0x232a});var client9003=jayson[_0x4647('0x13')][_0x4647('0x14')]({'port':0x232b});function respondWithRpcPromise(_0x4730bd,_0x1e353f,_0x2e48fa,_0x163105){return new BPromise(function(_0x1165f2,_0x29bfaa){var _0x4a1c1f=_0x163105||client;return _0x4a1c1f[_0x4647('0x15')](_0x4730bd,_0x2e48fa)[_0x4647('0x16')](function(_0x13f178){logger[_0x4647('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x1e353f,_0x4647('0x18'));logger[_0x4647('0x19')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1e353f,_0x4647('0x18'),JSON['stringify'](_0x13f178));if(_0x13f178[_0x4647('0x1a')]){if(_0x13f178[_0x4647('0x1a')]['code']===0x1f4){logger['error'](_0x4647('0x1b'),_0x1e353f,_0x13f178[_0x4647('0x1a')]['message']);return _0x29bfaa(_0x13f178['error'][_0x4647('0x1c')]);}logger['error'](_0x4647('0x1b'),_0x1e353f,_0x13f178[_0x4647('0x1a')][_0x4647('0x1c')]);return _0x1165f2(_0x13f178[_0x4647('0x1a')][_0x4647('0x1c')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1e353f,_0x4647('0x18'));_0x1165f2(_0x13f178['result'][_0x4647('0x1c')]);}})[_0x4647('0x1d')](function(_0x51c963){logger['error'](_0x4647('0x1b'),_0x1e353f,_0x51c963);_0x29bfaa(_0x51c963);});});}function respondWithStatusCode(_0x701cac,_0x160e80){_0x160e80=_0x160e80||0xcc;return function(_0x12fd8e){if(_0x12fd8e){return _0x701cac[_0x4647('0x1e')](_0x160e80);}return _0x701cac[_0x4647('0x1f')](_0x160e80)['end']();};}function respondWithResult(_0x3586bf,_0x1de788){_0x1de788=_0x1de788||0xc8;return function(_0x30cd0f){if(_0x30cd0f){return _0x3586bf[_0x4647('0x1f')](_0x1de788)[_0x4647('0x20')](_0x30cd0f);}};}function respondWithFilteredResult(_0x21ec3d,_0x219709){return function(_0x30abee){if(_0x30abee){var _0x3c69e3=_0x30abee[_0x4647('0x21')],_0x23f6b7=_0x219709['offset'],_0x3f0ae9=_0x219709[_0x4647('0x22')]+_0x219709[_0x4647('0x23')],_0x5bc19d;if(_0x3f0ae9>=_0x3c69e3){_0x3f0ae9=_0x3c69e3;_0x5bc19d=0xc8;}else{_0x5bc19d=0xce;}_0x21ec3d[_0x4647('0x1f')](_0x5bc19d);return _0x21ec3d[_0x4647('0x24')](_0x4647('0x25'),_0x23f6b7+'-'+_0x3f0ae9+'/'+_0x3c69e3)['json'](_0x30abee);}return null;};}function patchUpdates(_0xaca9f0){return function(_0x21a05f){try{jsonpatch['apply'](_0x21a05f,_0xaca9f0,!![]);}catch(_0x4f1f83){return BPromise[_0x4647('0x26')](_0x4f1f83);}return _0x21a05f[_0x4647('0x27')]();};}function saveUpdates(_0x1a211e,_0x547ceb){return function(_0x38b6e6){if(_0x38b6e6){return _0x38b6e6[_0x4647('0x28')](_0x1a211e)[_0x4647('0x16')](function(_0x26a5b9){return _0x26a5b9;});}return null;};}function removeEntity(_0x14876b,_0x1fd490){return function(_0x3ae7a3){if(_0x3ae7a3){return _0x3ae7a3[_0x4647('0x29')]()[_0x4647('0x16')](function(){_0x14876b[_0x4647('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x426ff8,_0x3998c8){return function(_0x1403ae){if(!_0x1403ae){_0x426ff8[_0x4647('0x1e')](0x194);}return _0x1403ae;};}function handleError(_0x4e239b,_0x5841df){_0x5841df=_0x5841df||0x1f4;return function(_0x96f450){logger[_0x4647('0x1a')](_0x96f450['stack']);if(_0x96f450['name']){delete _0x96f450[_0x4647('0x2a')];}_0x4e239b[_0x4647('0x1f')](_0x5841df)[_0x4647('0x2b')](_0x96f450);};}exports[_0x4647('0x2c')]=function(_0x49e7de,_0x56823e){var _0xd743fd={},_0x5181a8={},_0x41e0ad={'count':0x0,'rows':[]};var _0x3b0ea1=db['ChatWebsite']['rawAttributes'];_0x5181a8['model']=_[_0x4647('0x2d')](_0x3b0ea1);var _0x3753b={'dateStart':_0x49e7de[_0x4647('0x2e')]['dateStart'],'dateEnd':_0x49e7de['query'][_0x4647('0x2f')]};delete _0x49e7de[_0x4647('0x2e')][_0x4647('0x30')];delete _0x49e7de['query'][_0x4647('0x2f')];_0x5181a8[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0x49e7de[_0x4647('0x2e')]);_0x5181a8['filters']=_[_0x4647('0x31')](_0x5181a8[_0x4647('0x32')],_0x5181a8[_0x4647('0x2e')]);_0xd743fd[_0x4647('0x33')]=_['intersection'](_0x5181a8['model'],qs[_0x4647('0x34')](_0x49e7de['query'][_0x4647('0x34')]));_0xd743fd['attributes']=_0xd743fd[_0x4647('0x33')]['length']?_0xd743fd[_0x4647('0x33')]:_0x5181a8[_0x4647('0x32')];if(!_0x49e7de[_0x4647('0x2e')][_0x4647('0x35')](_0x4647('0x36'))){_0xd743fd['limit']=qs[_0x4647('0x23')](_0x49e7de['query'][_0x4647('0x23')]);_0xd743fd[_0x4647('0x22')]=qs[_0x4647('0x22')](_0x49e7de[_0x4647('0x2e')][_0x4647('0x22')]);}_0xd743fd[_0x4647('0x37')]=qs[_0x4647('0x38')](_0x49e7de[_0x4647('0x2e')][_0x4647('0x38')]);_0xd743fd[_0x4647('0x39')]=qs['filters'](_[_0x4647('0x3a')](_0x49e7de[_0x4647('0x2e')],_0x5181a8[_0x4647('0x3b')]));if(_0x3753b['dateStart']){if(_0x3753b[_0x4647('0x2f')]){_0x3753b[_0x4647('0x2f')]=moment(_0x3753b['dateEnd'])[_0x4647('0x3c')](0x1,_0x4647('0x3d'));}else{_0x3753b[_0x4647('0x2f')]=moment(_0x3753b[_0x4647('0x30')])[_0x4647('0x3c')](0x1,_0x4647('0x3d'));}_[_0x4647('0x3e')](_0xd743fd[_0x4647('0x39')],{'createdAt':{'$gte':_0x3753b[_0x4647('0x30')],'$lte':_0x3753b[_0x4647('0x2f')]}});}if(_0x49e7de[_0x4647('0x2e')][_0x4647('0x3f')]){_0xd743fd[_0x4647('0x39')]=_[_0x4647('0x3e')](_0xd743fd[_0x4647('0x39')],{'$or':_['map'](_0xd743fd[_0x4647('0x33')],function(_0x15078f){var _0x8b2d04={};_0x8b2d04[_0x15078f]={'$like':'%'+_0x49e7de[_0x4647('0x2e')]['filter']+'%'};return _0x8b2d04;})});}_0xd743fd=_[_0x4647('0x3e')]({},_0xd743fd,_0x49e7de['options']);var _0x504fb1={'where':_0xd743fd[_0x4647('0x39')]};return db[_0x4647('0x40')][_0x4647('0x21')](_0x504fb1)[_0x4647('0x16')](function(_0x4defc7){_0x41e0ad['count']=_0x4defc7;if(_0x49e7de[_0x4647('0x2e')][_0x4647('0x41')]){_0xd743fd[_0x4647('0x42')]=[{'all':!![]}];}return db[_0x4647('0x40')][_0x4647('0x43')](_0xd743fd);})[_0x4647('0x16')](function(_0xd927da){_0x41e0ad[_0x4647('0x44')]=_0xd927da;return _0x41e0ad;})[_0x4647('0x16')](respondWithFilteredResult(_0x56823e,_0xd743fd))[_0x4647('0x1d')](handleError(_0x56823e,null));};exports['show']=function(_0x5e2382,_0x795559){var _0x134eb0={'raw':![],'where':{'id':_0x5e2382[_0x4647('0x45')]['id']}},_0x3b7362={};_0x3b7362[_0x4647('0x32')]=_['keys'](db[_0x4647('0x40')]['rawAttributes']);_0x3b7362[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0x5e2382['query']);_0x3b7362['filters']=_[_0x4647('0x31')](_0x3b7362[_0x4647('0x32')],_0x3b7362['query']);_0x134eb0['attributes']=_[_0x4647('0x31')](_0x3b7362['model'],qs[_0x4647('0x34')](_0x5e2382['query'][_0x4647('0x34')]));_0x134eb0['attributes']=_0x134eb0[_0x4647('0x33')][_0x4647('0x46')]?_0x134eb0[_0x4647('0x33')]:_0x3b7362[_0x4647('0x32')];if(_0x5e2382['query'][_0x4647('0x41')]){_0x134eb0[_0x4647('0x42')]=[{'all':!![]}];}_0x134eb0=_[_0x4647('0x3e')]({},_0x134eb0,_0x5e2382[_0x4647('0x47')]);return db[_0x4647('0x40')][_0x4647('0x48')](_0x134eb0)[_0x4647('0x16')](handleEntityNotFound(_0x795559,null))[_0x4647('0x16')](respondWithResult(_0x795559,null))[_0x4647('0x1d')](handleError(_0x795559,null));};exports[_0x4647('0x49')]=function(_0x1b07b0,_0x6d9fb8){return db[_0x4647('0x40')][_0x4647('0x49')](_0x1b07b0[_0x4647('0x4a')],{})[_0x4647('0x16')](respondWithResult(_0x6d9fb8,0xc9))[_0x4647('0x1d')](handleError(_0x6d9fb8,null));};exports[_0x4647('0x28')]=function(_0x1b32f0,_0xde786){if(_0x1b32f0[_0x4647('0x4a')]['id']){delete _0x1b32f0[_0x4647('0x4a')]['id'];}return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x1b32f0[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0xde786,null))[_0x4647('0x16')](saveUpdates(_0x1b32f0[_0x4647('0x4a')],null))[_0x4647('0x16')](respondWithResult(_0xde786,null))[_0x4647('0x1d')](handleError(_0xde786,null));};exports[_0x4647('0x29')]=function(_0x2fc51c,_0x38df4b){return db[_0x4647('0x40')]['find']({'where':{'id':_0x2fc51c[_0x4647('0x45')]['id']}})['then'](handleEntityNotFound(_0x38df4b,null))[_0x4647('0x16')](removeEntity(_0x38df4b,null))['catch'](handleError(_0x38df4b,null));};exports[_0x4647('0x4b')]=function(_0x19b0fc,_0x2ef66d){return db[_0x4647('0x40')]['describe']()[_0x4647('0x16')](respondWithResult(_0x2ef66d,null))['catch'](handleError(_0x2ef66d,null));};exports[_0x4647('0x4c')]=function(_0x1baa5d,_0x1d6600,_0x523b69){if(_0x1baa5d[_0x4647('0x4a')]['id']){delete _0x1baa5d[_0x4647('0x4a')]['id'];}return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x1baa5d[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x1d6600,null))[_0x4647('0x16')](function(_0x27931d){if(_0x27931d){_0x1baa5d['body'][_0x4647('0x4d')]=_0x27931d['id'];return db['Disposition']['create'](_0x1baa5d['body']);}})[_0x4647('0x16')](respondWithResult(_0x1d6600,null))[_0x4647('0x1d')](handleError(_0x1d6600,null));};exports['getDispositions']=function(_0x3d69bf,_0xef1695,_0x402306){var _0x328b3d={'raw':![],'where':{}};var _0x5656bf={};var _0x5e85ae={'count':0x0,'rows':[]};return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x3d69bf[_0x4647('0x45')]['id']}})['then'](handleEntityNotFound(_0xef1695,null))['then'](function(_0x2e9ce0){if(_0x2e9ce0){_0x5656bf[_0x4647('0x32')]=_[_0x4647('0x2d')](db[_0x4647('0x4f')][_0x4647('0x50')]);_0x5656bf[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0x3d69bf[_0x4647('0x2e')]);_0x5656bf['filters']=_[_0x4647('0x31')](_0x5656bf[_0x4647('0x32')],_0x5656bf[_0x4647('0x2e')]);_0x328b3d['attributes']=_[_0x4647('0x31')](_0x5656bf[_0x4647('0x32')],qs['fields'](_0x3d69bf[_0x4647('0x2e')][_0x4647('0x34')]));_0x328b3d['attributes']=_0x328b3d[_0x4647('0x33')][_0x4647('0x46')]?_0x328b3d['attributes']:_0x5656bf[_0x4647('0x32')];if(!_0x3d69bf['query'][_0x4647('0x35')](_0x4647('0x36'))){_0x328b3d[_0x4647('0x23')]=qs[_0x4647('0x23')](_0x3d69bf[_0x4647('0x2e')]['limit']);_0x328b3d[_0x4647('0x22')]=qs['offset'](_0x3d69bf[_0x4647('0x2e')][_0x4647('0x22')]);}_0x328b3d[_0x4647('0x37')]=qs['sort'](_0x3d69bf[_0x4647('0x2e')][_0x4647('0x38')]);_0x328b3d[_0x4647('0x39')]=qs[_0x4647('0x3b')](_[_0x4647('0x3a')](_0x3d69bf[_0x4647('0x2e')],_0x5656bf['filters']));_0x328b3d[_0x4647('0x39')][_0x4647('0x4d')]=_0x2e9ce0['id'];if(_0x3d69bf[_0x4647('0x2e')]['filter']){_0x328b3d['where']=_[_0x4647('0x3e')](_0x328b3d[_0x4647('0x39')],{'$or':_[_0x4647('0x51')](_0x328b3d[_0x4647('0x33')],function(_0xf04bc){var _0x27ebe8={};_0x27ebe8[_0xf04bc]={'$like':'%'+_0x3d69bf[_0x4647('0x2e')][_0x4647('0x3f')]+'%'};return _0x27ebe8;})});}_0x328b3d=_[_0x4647('0x3e')]({},_0x328b3d,_0x3d69bf['options']);return db[_0x4647('0x4f')]['count']({'where':_0x328b3d['where']})[_0x4647('0x16')](function(_0x1606fa){_0x5e85ae[_0x4647('0x21')]=_0x1606fa;if(_0x3d69bf[_0x4647('0x2e')][_0x4647('0x41')]){_0x328b3d['include']=[{'all':!![]}];}return db[_0x4647('0x4f')][_0x4647('0x43')](_0x328b3d);})[_0x4647('0x16')](function(_0x106178){_0x5e85ae[_0x4647('0x44')]=_0x106178;return _0x5e85ae;});}})['then'](respondWithFilteredResult(_0xef1695,_0x328b3d))[_0x4647('0x1d')](handleError(_0xef1695,null));};exports['removeDispositions']=function(_0x2c58df,_0x53d6dd,_0x39fe9c){var _0x4f03fe;return db[_0x4647('0x40')]['find']({'where':{'id':_0x2c58df[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x53d6dd,null))['then'](function(_0xffb088){if(_0xffb088){return _0xffb088[_0x4647('0x52')](_0x2c58df[_0x4647('0x2e')][_0x4647('0x53')]);}})[_0x4647('0x16')](respondWithStatusCode(_0x53d6dd,null))[_0x4647('0x1d')](handleError(_0x53d6dd,null));};exports['addAnswer']=function(_0x5049f5,_0x4079c1,_0x204449){if(_0x5049f5['body']['id']){delete _0x5049f5[_0x4647('0x4a')]['id'];}return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x5049f5['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x4079c1,null))[_0x4647('0x16')](function(_0x11c3c5){if(_0x11c3c5){_0x5049f5['body']['ChatWebsiteId']=_0x11c3c5['id'];return db[_0x4647('0x54')][_0x4647('0x49')](_0x5049f5['body']);}})['then'](respondWithResult(_0x4079c1,null))[_0x4647('0x1d')](handleError(_0x4079c1,null));};exports[_0x4647('0x55')]=function(_0x49a363,_0x1e034c,_0x4d05ee){var _0x5aeeee={'raw':![],'where':{}};var _0xc7fea5={};var _0x11dad9={'count':0x0,'rows':[]};return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x49a363[_0x4647('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e034c,null))['then'](function(_0x2815d9){if(_0x2815d9){_0xc7fea5[_0x4647('0x32')]=_['keys'](db['CannedAnswer'][_0x4647('0x50')]);_0xc7fea5[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0x49a363[_0x4647('0x2e')]);_0xc7fea5[_0x4647('0x3b')]=_[_0x4647('0x31')](_0xc7fea5[_0x4647('0x32')],_0xc7fea5[_0x4647('0x2e')]);_0x5aeeee['attributes']=_[_0x4647('0x31')](_0xc7fea5[_0x4647('0x32')],qs[_0x4647('0x34')](_0x49a363['query'][_0x4647('0x34')]));_0x5aeeee['attributes']=_0x5aeeee['attributes']['length']?_0x5aeeee['attributes']:_0xc7fea5[_0x4647('0x32')];if(!_0x49a363['query'][_0x4647('0x35')](_0x4647('0x36'))){_0x5aeeee[_0x4647('0x23')]=qs['limit'](_0x49a363[_0x4647('0x2e')][_0x4647('0x23')]);_0x5aeeee[_0x4647('0x22')]=qs[_0x4647('0x22')](_0x49a363[_0x4647('0x2e')][_0x4647('0x22')]);}_0x5aeeee[_0x4647('0x37')]=qs[_0x4647('0x38')](_0x49a363[_0x4647('0x2e')]['sort']);_0x5aeeee[_0x4647('0x39')]=qs['filters'](_[_0x4647('0x3a')](_0x49a363[_0x4647('0x2e')],_0xc7fea5[_0x4647('0x3b')]));_0x5aeeee[_0x4647('0x39')]['ChatWebsiteId']=_0x2815d9['id'];if(_0x49a363[_0x4647('0x2e')][_0x4647('0x3f')]){_0x5aeeee[_0x4647('0x39')]=_['merge'](_0x5aeeee[_0x4647('0x39')],{'$or':_[_0x4647('0x51')](_0x5aeeee['attributes'],function(_0x540911){var _0x183c8b={};_0x183c8b[_0x540911]={'$like':'%'+_0x49a363[_0x4647('0x2e')]['filter']+'%'};return _0x183c8b;})});}_0x5aeeee=_[_0x4647('0x3e')]({},_0x5aeeee,_0x49a363['options']);return db[_0x4647('0x54')]['count']({'where':_0x5aeeee[_0x4647('0x39')]})[_0x4647('0x16')](function(_0x32bff2){_0x11dad9[_0x4647('0x21')]=_0x32bff2;if(_0x49a363['query']['includeAll']){_0x5aeeee[_0x4647('0x42')]=[{'all':!![]}];}return db[_0x4647('0x54')][_0x4647('0x43')](_0x5aeeee);})['then'](function(_0x31a2af){_0x11dad9[_0x4647('0x44')]=_0x31a2af;return _0x11dad9;});}})['then'](respondWithFilteredResult(_0x1e034c,_0x5aeeee))[_0x4647('0x1d')](handleError(_0x1e034c,null));};exports[_0x4647('0x56')]=function(_0x45d3a7,_0x2ae04a,_0x27d6e8){var _0x4ce7fc;return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x45d3a7[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x2ae04a,null))['then'](function(_0x536632){if(_0x536632){return _0x536632[_0x4647('0x56')](_0x45d3a7[_0x4647('0x2e')][_0x4647('0x53')]);}})[_0x4647('0x16')](respondWithStatusCode(_0x2ae04a,null))[_0x4647('0x1d')](handleError(_0x2ae04a,null));};exports['addLogo']=function(_0x32737e,_0x1389c2,_0x1f0089){_0x32737e[_0x4647('0x4a')]['sitepic']=_0x32737e[_0x4647('0x57')]['filename'];return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x32737e['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x1389c2,null))[_0x4647('0x16')](saveUpdates(_0x32737e['body'],null))[_0x4647('0x16')](respondWithResult(_0x1389c2,null))[_0x4647('0x1d')](handleError(_0x1389c2,null));};exports['addAvatar']=function(_0x4121eb,_0x580a36,_0x4bed89){_0x4121eb[_0x4647('0x4a')]['agentAvatar']=_0x4121eb[_0x4647('0x57')]['filename'];return db[_0x4647('0x40')]['find']({'where':{'id':_0x4121eb[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x580a36,null))[_0x4647('0x16')](saveUpdates(_0x4121eb['body'],null))[_0x4647('0x16')](respondWithResult(_0x580a36,null))['catch'](handleError(_0x580a36,null));};exports[_0x4647('0x58')]=function(_0x4168e5,_0x48922d,_0x52e66d){_0x4168e5['body'][_0x4647('0x59')]=_0x4168e5[_0x4647('0x57')]['filename'];return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x4168e5['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x48922d,null))[_0x4647('0x16')](saveUpdates(_0x4168e5[_0x4647('0x4a')],null))['then'](respondWithResult(_0x48922d,null))[_0x4647('0x1d')](handleError(_0x48922d,null));};exports['addSystemAvatar']=function(_0x27ca91,_0x335e84,_0x23ec1b){_0x27ca91['body']['systemAvatar']=_0x27ca91[_0x4647('0x57')]['filename'];return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x27ca91[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x335e84,null))[_0x4647('0x16')](saveUpdates(_0x27ca91[_0x4647('0x4a')],null))[_0x4647('0x16')](respondWithResult(_0x335e84,null))[_0x4647('0x1d')](handleError(_0x335e84,null));};exports[_0x4647('0x5a')]=function(_0x582d07,_0x4cd039,_0x469092){var _0x5064b5=path[_0x4647('0x5b')](config[_0x4647('0x5c')],'server/files/images/logos/default_logo.png');var _0x47fe54={'where':{'id':_0x582d07[_0x4647('0x45')]['id']},'attributes':['id',_0x4647('0x5d')],'raw':!![]};var _0x4b8101=![];return require('../../config/license/util')[_0x4647('0x5e')]()[_0x4647('0x16')](function(_0x5a8619){if(_0x5a8619){_0x4b8101=_0x5a8619[_0x4647('0x5f')];}})[_0x4647('0x16')](function(){return db[_0x4647('0x40')]['find'](_0x47fe54);})[_0x4647('0x16')](handleEntityNotFound(_0x4cd039,null))[_0x4647('0x16')](function(_0x41c102){if(_0x41c102){if(!_[_0x4647('0x60')](_0x41c102[_0x4647('0x5d')])){if(fs['existsSync'](path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x61'),_0x41c102[_0x4647('0x5d')]))&&_0x4b8101){_0x5064b5=path['join'](config[_0x4647('0x5c')],_0x4647('0x61'),_0x41c102[_0x4647('0x5d')]);}}return _0x4cd039[_0x4647('0x62')](_0x5064b5);}})[_0x4647('0x1d')](handleError(_0x4cd039,null));};exports['getAvatar']=function(_0x59f3ce,_0x1a281a,_0x415e26){var _0x334250=path['join'](config[_0x4647('0x5c')],_0x4647('0x63'));var _0x1b81a1={'where':{'id':_0x59f3ce[_0x4647('0x45')]['id']},'attributes':['id',_0x4647('0x64')],'raw':!![]};return db[_0x4647('0x40')][_0x4647('0x48')](_0x1b81a1)['then'](handleEntityNotFound(_0x1a281a,null))[_0x4647('0x16')](function(_0x5088f1){if(_0x5088f1){if(!_['isNil'](_0x5088f1['agentAvatar'])){if(fs[_0x4647('0x65')](path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x66'),_0x5088f1['agentAvatar']))){_0x334250=path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x66'),_0x5088f1[_0x4647('0x64')]);}}return _0x1a281a[_0x4647('0x62')](_0x334250);}})[_0x4647('0x1d')](handleError(_0x1a281a,null));};exports['getCustomerAvatar']=function(_0x3daccf,_0x4a7505,_0x3d8146){var _0x41e587=path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x67'));var _0x15e27e={'where':{'id':_0x3daccf[_0x4647('0x45')]['id']},'attributes':['id',_0x4647('0x59'),_0x4647('0x68')],'raw':!![]};return db[_0x4647('0x40')][_0x4647('0x48')](_0x15e27e)[_0x4647('0x16')](handleEntityNotFound(_0x4a7505,null))['then'](function(_0x1f3516){if(_0x1f3516){if(!_[_0x4647('0x60')](_0x1f3516[_0x4647('0x59')])){if(fs[_0x4647('0x65')](path['join'](config[_0x4647('0x5c')],'server/files/images/avatars/',_0x1f3516['customerAvatar']))&&_0x1f3516['showCustomerAvatar']){_0x41e587=path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x66'),_0x1f3516[_0x4647('0x59')]);}}return _0x4a7505[_0x4647('0x62')](_0x41e587);}})[_0x4647('0x1d')](handleError(_0x4a7505,null));};exports[_0x4647('0x69')]=function(_0x382b1a,_0x4c5909,_0x5b9813){var _0x568e3b=path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x6a'));var _0x211880={'where':{'id':_0x382b1a[_0x4647('0x45')]['id']},'attributes':['id',_0x4647('0x6b')],'raw':!![]};return db[_0x4647('0x40')][_0x4647('0x48')](_0x211880)[_0x4647('0x16')](handleEntityNotFound(_0x4c5909,null))['then'](function(_0x4f35f7){if(_0x4f35f7){if(!_[_0x4647('0x60')](_0x4f35f7[_0x4647('0x6b')])){if(fs['existsSync'](path[_0x4647('0x5b')](config[_0x4647('0x5c')],_0x4647('0x66'),_0x4f35f7[_0x4647('0x6b')]))){_0x568e3b=path[_0x4647('0x5b')](config[_0x4647('0x5c')],'server/files/images/avatars/',_0x4f35f7[_0x4647('0x6b')]);}}return _0x4c5909[_0x4647('0x62')](_0x568e3b);}})[_0x4647('0x1d')](handleError(_0x4c5909,null));};exports['notify']=function(_0x49411e,_0x43bba4,_0x560ef7){var _0x3ab013=require(_0x4647('0x6c'));var _0x5f465e=new _0x3ab013();var _0x4db24d=_0x5f465e[_0x4647('0x6d')](_0x49411e[_0x4647('0x6e')][_0x4647('0x6f')])[_0x4647('0x70')]();var _0x4eb583={'body':_0x49411e['body'],'channel':'chat'};var _0x27fc62=[];var _0x3b830b=[];var _0x45792d={};var _0x5a0f08=![];return db[_0x4647('0x71')][_0x4647('0x4b')]()[_0x4647('0x16')](function(_0x3b7aa7){if(!_0x3b7aa7){throw new db[(_0x4647('0x72'))][(_0x4647('0x73'))]('no\x20available\x20attributes');}_0x27fc62=_[_0x4647('0x74')](_[_0x4647('0x2d')](_0x3b7aa7),[_0x4647('0x75'),_0x4647('0x76')]);_0x3b830b=_[_0x4647('0x74')](_[_0x4647('0x2d')](_0x3b7aa7),[_0x4647('0x75'),_0x4647('0x76'),_0x4647('0x77'),_0x4647('0x78')]);if(_0x49411e[_0x4647('0x4a')]['id']){delete _0x49411e[_0x4647('0x4a')]['id'];}if(_[_0x4647('0x60')](_0x49411e[_0x4647('0x4a')][_0x4647('0x79')])){throw new db['Sequelize'][(_0x4647('0x73'))](_0x4647('0x7a'));}if(_[_0x4647('0x60')](_0x49411e[_0x4647('0x4a')][_0x4647('0x4a')])||_0x49411e[_0x4647('0x4a')][_0x4647('0x4a')]===''){throw new db['Sequelize'][(_0x4647('0x73'))](_0x4647('0x7b'));}if(_[_0x4647('0x60')](_0x49411e[_0x4647('0x4a')][_0x4647('0x7c')])){throw new db[(_0x4647('0x72'))][(_0x4647('0x73'))](_0x4647('0x7d')+_0x3b830b);}if(!_[_0x4647('0x7e')](_0x3b830b,_0x49411e[_0x4647('0x4a')][_0x4647('0x7c')])){throw new db['Sequelize'][(_0x4647('0x73'))](_0x4647('0x7f')+_0x3b830b);}_0x45792d[_0x49411e[_0x4647('0x4a')][_0x4647('0x7c')]]=_0x49411e[_0x4647('0x4a')][_0x4647('0x79')];})[_0x4647('0x16')](function(){return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x49411e[_0x4647('0x45')]['id']},'include':[{'model':db['CmList'],'as':_0x4647('0x80'),'include':[{'model':db[_0x4647('0x71')],'as':_0x4647('0x81'),'where':_0x45792d,'limit':0x1,'order':[['updatedAt',_0x4647('0x82')]]}]},{'model':db[_0x4647('0x83')],'as':_0x4647('0x84')}]});})[_0x4647('0x16')](handleEntityNotFound(_0x43bba4,null))[_0x4647('0x16')](function(_0x1fce42){if(_0x1fce42&&_0x1fce42[_0x4647('0x80')]){_0x4eb583[_0x4647('0x85')]=_0x1fce42;_0x4eb583['applications']=_0x1fce42['Applications'];_0x4eb583[_0x4647('0x86')]=_0x1fce42[_0x4647('0x80')];_0x4eb583['applications']=_[_0x4647('0x87')](_0x4eb583[_0x4647('0x88')],['priority'],[_0x4647('0x89')]);if(_0x4eb583[_0x4647('0x85')]['Applications']){delete _0x4eb583[_0x4647('0x85')][_0x4647('0x84')];}if(_0x4eb583['account'][_0x4647('0x80')]&&_0x4eb583[_0x4647('0x85')][_0x4647('0x80')][_0x4647('0x81')][_0x4647('0x46')]){return _0x4eb583[_0x4647('0x85')][_0x4647('0x80')]['Contacts'][0x0];}var _0x31f70f=_[_0x4647('0x8a')](_0x49411e[_0x4647('0x4a')],{'firstName':_0x49411e[_0x4647('0x4a')]['from'],'ListId':_0x1fce42[_0x4647('0x78')]});_0x31f70f[_0x49411e[_0x4647('0x4a')]['mapKey']]=_0x49411e[_0x4647('0x4a')][_0x4647('0x79')];return db['CmContact']['create'](_0x31f70f,{'fields':_0x27fc62,'raw':!![]});}})[_0x4647('0x16')](handleEntityNotFound(_0x43bba4,null))['then'](function(_0x462e7b){_0x4eb583[_0x4647('0x8b')]=_0x462e7b;if(_0x462e7b){var _0x4b3a89={'ContactId':_0x462e7b['id'],'ChatWebsiteId':_0x49411e[_0x4647('0x45')]['id'],'from':(_0x462e7b[_0x4647('0x8c')]||'')+'\x20'+(_0x462e7b[_0x4647('0x8d')]||''),'customerIp':_0x49411e[_0x4647('0x4a')]['customerIp'],'referer':_0x49411e[_0x4647('0x4a')][_0x4647('0x8e')],'browserName':_0x4db24d['browser'][_0x4647('0x2a')]&&_0x4db24d[_0x4647('0x8f')]['version']?util['format'](_0x4647('0x90'),_0x4db24d['browser']['name'],_0x4db24d[_0x4647('0x8f')][_0x4647('0x91')]):_0x4647('0x92'),'browserVersion':_0x4db24d[_0x4647('0x8f')][_0x4647('0x91')]||'unknown','osName':util['format'](_0x4647('0x90'),_0x4db24d['os'][_0x4647('0x2a')],_0x4db24d['os'][_0x4647('0x91')]),'osVersion':_0x4db24d['os'][_0x4647('0x91')],'deviceModel':_0x4db24d[_0x4647('0x93')][_0x4647('0x32')]&&_0x4db24d[_0x4647('0x93')][_0x4647('0x94')]?util['format'](_0x4647('0x95'),_0x4db24d[_0x4647('0x93')][_0x4647('0x32')],_0x4db24d[_0x4647('0x93')][_0x4647('0x94')],_0x4db24d['device'][_0x4647('0x96')]):null,'deviceVendor':_0x4db24d[_0x4647('0x93')][_0x4647('0x94')],'deviceType':_0x4db24d[_0x4647('0x93')][_0x4647('0x96')],'formData':JSON[_0x4647('0x97')](_0x49411e[_0x4647('0x4a')])};var _0x49b122={'ChatWebsiteId':_0x49411e[_0x4647('0x45')]['id'],'closed':![]};if(_0x49411e[_0x4647('0x4a')][_0x4647('0x98')]){_0x49b122[_0x4647('0x98')]=_0x49411e['body'][_0x4647('0x98')];return db[_0x4647('0x99')]['find']({'where':_0x49b122})[_0x4647('0x16')](function(_0x108dad){if(_0x108dad){return[_0x108dad,![]];}_0x4b3a89['threadId']=_0x49411e[_0x4647('0x4a')][_0x4647('0x98')];_0x4b3a89[_0x4647('0x9a')]=_0x49411e[_0x4647('0x4a')][_0x4647('0x9a')];return db['ChatInteraction'][_0x4647('0x49')](_0x4b3a89)['then'](function(_0x300e0f){return[_0x300e0f,!![]];});});}_0x49b122['ContactId']=_0x462e7b['id'];if(_0x49411e[_0x4647('0x4a')][_0x4647('0x9b')]&&_0x49411e[_0x4647('0x4a')][_0x4647('0x9b')]['id']){_0x49b122['id']=_0x49411e['body'][_0x4647('0x9b')]['id'];return db[_0x4647('0x99')]['find']({'where':_0x49b122})['then'](function(_0x1bb427){if(_0x1bb427){return[_0x1bb427,![]];}return db[_0x4647('0x99')][_0x4647('0x49')](_0x4b3a89)['then'](function(_0x238bfb){return[_0x238bfb,!![]];});});}return db[_0x4647('0x99')]['create'](_0x4b3a89)[_0x4647('0x16')](function(_0x1e5c65){return[_0x1e5c65,!![]];});}})['spread'](function(_0x4b6404,_0x254a86){if(_0x4b6404){_0x5a0f08=_0x254a86;if(!_0x254a86){return _0x4b6404[_0x4647('0x28')]({'from':(_0x4eb583[_0x4647('0x8b')]['firstName']||'')+'\x20'+(_0x4eb583['contact'][_0x4647('0x8d')]||'')});}else{return _0x4b6404;}}})['then'](function(_0x5c3c68){_0x4eb583[_0x4647('0x9b')]=_0x5c3c68['get']({'plain':!![]});_0x4eb583[_0x4647('0x9b')][_0x4647('0x9c')]=_0x5a0f08;if(_0x4eb583[_0x4647('0x9b')][_0x4647('0x9c')]){if(_0x4eb583[_0x4647('0x85')][_0x4647('0x9d')]){_0x4eb583[_0x4647('0x88')][_0x4647('0x9e')]({'id':0x0,'priority':_0x4eb583[_0x4647('0x88')][_0x4647('0x46')]+0x1,'app':'close','appdata':_0x4647('0x9f'),'interval':'*,*,*,*'});}}return db[_0x4647('0xa0')][_0x4647('0x49')]({'body':_0x49411e[_0x4647('0x4a')]['body'],'ChatWebsiteId':_0x49411e[_0x4647('0x45')]['id'],'ChatInteractionId':_0x5c3c68['id'],'direction':'in','ContactId':_0x4eb583[_0x4647('0x8b')]['id'],'AttachmentId':_0x49411e[_0x4647('0x4a')][_0x4647('0xa1')]});})[_0x4647('0x16')](function(_0x587d2e){_0x4eb583[_0x4647('0x1c')]=_0x587d2e;if(_0x4eb583[_0x4647('0x9b')][_0x4647('0xa2')]){return db[_0x4647('0xa3')][_0x4647('0x48')]({'attributes':['id','name'],'where':{'id':_0x4eb583['interaction'][_0x4647('0xa2')]}})[_0x4647('0x16')](function(_0x4d4866){if(_0x4d4866){_0x4eb583[_0x4647('0x88')][_0x4647('0xa4')]({'id':0x0,'priority':0x0,'app':_0x4647('0xa5'),'appdata':_0x4d4866['name']+','+(_0x4eb583[_0x4647('0x85')][_0x4647('0xa6')]||0xa),'interval':_0x4647('0xa7')});_0x4eb583[_0x4647('0xa8')]=!![];}return respondWithRpcPromise(_0x4647('0xa9'),_0x4647('0xaa'),_0x4eb583);});}return respondWithRpcPromise(_0x4647('0xa9'),_0x4647('0xaa'),_0x4eb583);})['then'](function(_0x449828){respondWithRpcPromise('EventManager',_0x4647('0xab'),{'event':_0x4647('0xac'),'message':_0x449828},client9002);return _0x449828;})[_0x4647('0x16')](respondWithResult(_0x43bba4,null))[_0x4647('0x1d')](handleError(_0x43bba4,null));};exports['offline']=function(_0x58c109,_0x56c844,_0x2d0943){var _0x206bd8,_0x308c2e,_0x2643d7;var _0x4e9d58=[];var _0x359c1f=[];var _0x14aee7={};return db['CmContact'][_0x4647('0x4b')]()['then'](function(_0x1765d0){if(!_0x1765d0){throw new db[(_0x4647('0x72'))][(_0x4647('0x73'))](_0x4647('0xad'));}_0x359c1f=_[_0x4647('0x74')](_[_0x4647('0x2d')](_0x1765d0),[_0x4647('0x75'),'updatedAt']);_0x4e9d58=_[_0x4647('0x74')](_['keys'](_0x1765d0),[_0x4647('0x75'),_0x4647('0x76'),_0x4647('0x77'),_0x4647('0x78')]);if(_0x58c109['body']['id']){delete _0x58c109['body']['id'];}if(_[_0x4647('0x60')](_0x58c109['body'][_0x4647('0x79')])){throw _0x56c844[_0x4647('0x1f')](0x1f4)['send'](new db[(_0x4647('0x72'))][(_0x4647('0x73'))](_0x4647('0x7a')));}if(_['isNil'](_0x58c109['body']['body'])||_0x58c109[_0x4647('0x4a')][_0x4647('0x4a')]===''){throw _0x56c844[_0x4647('0x1f')](0x1f4)['send'](new db[(_0x4647('0x72'))][(_0x4647('0x73'))](_0x4647('0x7b')));}if(_[_0x4647('0x60')](_0x58c109[_0x4647('0x4a')][_0x4647('0xae')])){throw _0x56c844['status'](0x1f4)[_0x4647('0x2b')](new db[(_0x4647('0x72'))]['ValidationError'](_0x4647('0xaf')+_0x4e9d58));}if(!_['includes'](_0x4e9d58,_0x58c109['body'][_0x4647('0xae')])){throw _0x56c844[_0x4647('0x1f')](0x1f4)[_0x4647('0x2b')](new db[(_0x4647('0x72'))][(_0x4647('0x73'))](_0x4647('0xb0')+_0x4e9d58));}_0x14aee7[_0x58c109['body'][_0x4647('0xae')]]=_0x58c109[_0x4647('0x4a')][_0x4647('0x79')];})[_0x4647('0x16')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x58c109[_0x4647('0x45')]['id']},'include':[{'model':db[_0x4647('0xb1')],'as':_0x4647('0x80')}]});})[_0x4647('0x16')](handleEntityNotFound(_0x56c844,null))['then'](function(_0x3d0b2e){if(_0x3d0b2e&&_0x3d0b2e['List']){_0x308c2e=_0x3d0b2e;var _0x3165be=_[_0x4647('0x8a')](_0x58c109['body'],{'firstName':_0x58c109[_0x4647('0x4a')][_0x4647('0x79')],'phone':_0x58c109['body']['from'],'ListId':_0x3d0b2e[_0x4647('0x78')]});_0x3165be[_0x58c109[_0x4647('0x4a')]['mapKeyOffline']]=_0x58c109['body'][_0x4647('0x79')];return db[_0x4647('0x71')][_0x4647('0xb2')]({'where':_0x14aee7,'defaults':_0x3165be});}})[_0x4647('0xb3')](function(_0x2dce42){if(_0x2dce42){_0x2643d7=_0x2dce42;var _0x1ce3a3=fs['readFileSync'](path['join'](config[_0x4647('0x5c')],_0x4647('0xb4')),_0x4647('0xb5'));var _0x277317=ejs[_0x4647('0xb6')](_0x1ce3a3,{'body':_[_0x4647('0xb7')](_0x58c109[_0x4647('0x4a')][_0x4647('0x4a')]),'bodyTitle':_0x308c2e['offlineMessageBody']});return db[_0x4647('0xb8')]['create']({'body':_0x277317,'ContactId':_0x2dce42['id'],'ChatWebsiteId':_0x308c2e['id']});}})[_0x4647('0x16')](function(_0x517e91){if(_0x517e91){_0x206bd8=_0x517e91;return db[_0x4647('0xb9')][_0x4647('0x4e')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x4647('0xba'),'raw':!![]}]});}})[_0x4647('0x16')](function(_0xcf0f4c){if(_0xcf0f4c&&_0xcf0f4c[_0x4647('0xba')]&&_0x308c2e[_0x4647('0xbb')]){var _0x3a02ae={'tls':{'rejectUnauthorized':![]}};if(_0xcf0f4c[_0x4647('0xba')]['service']){_0x3a02ae[_0x4647('0xbc')]=_0xcf0f4c[_0x4647('0xba')][_0x4647('0xbc')];}else{_0x3a02ae[_0x4647('0xbd')]=_0xcf0f4c[_0x4647('0xba')][_0x4647('0xbd')];_0x3a02ae['port']=_0xcf0f4c[_0x4647('0xba')][_0x4647('0xbe')];_0x3a02ae[_0x4647('0xbf')]=_0xcf0f4c[_0x4647('0xba')][_0x4647('0xbf')];}if(_0xcf0f4c[_0x4647('0xba')][_0x4647('0xc0')]){_0x3a02ae['auth']={'user':_0xcf0f4c[_0x4647('0xba')][_0x4647('0xc1')],'pass':_0xcf0f4c[_0x4647('0xba')][_0x4647('0xc2')]};}return respondWithRpcPromise('SendMail',_0x4647('0xc3'),{'account':_0x3a02ae,'message':{'from':util[_0x4647('0xc4')]('\x22%s\x22\x20<%s>',_0xcf0f4c[_0x4647('0x2a')],_0xcf0f4c['email']||_0xcf0f4c[_0x4647('0xba')][_0x4647('0xc1')]),'to':_0x308c2e['forwardOfflineAddress'],'subject':_0x308c2e[_0x4647('0xc5')],'text':_0x206bd8[_0x4647('0x4a')]}},client9003)[_0x4647('0x16')](function(){return _0x206bd8;})[_0x4647('0x1d')](function(_0x3a6108){console['error'](_0x3a6108);});}})[_0x4647('0x16')](function(){if(_0x206bd8){return _0x206bd8;}})[_0x4647('0x16')](respondWithResult(_0x56c844,null))[_0x4647('0x1d')](handleError(_0x56c844,null));};exports[_0x4647('0xc6')]=function(_0xe64d9f,_0x513ca6,_0x4ee5b5){return db[_0x4647('0x99')][_0x4647('0x48')]({'where':{'id':_0xe64d9f[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x513ca6,null))[_0x4647('0x16')](function(_0xd0212a){if(_0xd0212a){return _0xd0212a['addInteraction'](_0xe64d9f[_0x4647('0x4a')][_0x4647('0x53')],_[_0x4647('0xc7')](_0xe64d9f[_0x4647('0x4a')],[_0x4647('0x53'),'id'])||{});}})['then'](respondWithResult(_0x513ca6,null))[_0x4647('0x1d')](handleError(_0x513ca6,null));};exports[_0x4647('0xc8')]=function(_0xf53946,_0x5d82c5,_0x3e5265){var _0x17a0f1={'raw':![],'where':{}};var _0x43f021={};var _0x442d1c={'count':0x0,'rows':[]};return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0xf53946[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x5d82c5,null))[_0x4647('0x16')](function(_0x4fad77){if(_0x4fad77){_0x43f021[_0x4647('0x32')]=_[_0x4647('0x2d')](db[_0x4647('0x99')]['rawAttributes']);_0x43f021[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0xf53946['query']);_0x43f021[_0x4647('0x3b')]=_[_0x4647('0x31')](_0x43f021[_0x4647('0x32')],_0x43f021[_0x4647('0x2e')]);_0x17a0f1['attributes']=_['intersection'](_0x43f021['model'],qs[_0x4647('0x34')](_0xf53946[_0x4647('0x2e')][_0x4647('0x34')]));_0x17a0f1[_0x4647('0x33')]=_0x17a0f1[_0x4647('0x33')][_0x4647('0x46')]?_0x17a0f1['attributes']:_0x43f021[_0x4647('0x32')];if(!_0xf53946[_0x4647('0x2e')]['hasOwnProperty'](_0x4647('0x36'))){_0x17a0f1[_0x4647('0x23')]=qs[_0x4647('0x23')](_0xf53946[_0x4647('0x2e')][_0x4647('0x23')]);_0x17a0f1[_0x4647('0x22')]=qs['offset'](_0xf53946['query'][_0x4647('0x22')]);}_0x17a0f1['order']=qs[_0x4647('0x38')](_0xf53946[_0x4647('0x2e')][_0x4647('0x38')]);_0x17a0f1[_0x4647('0x39')]=qs[_0x4647('0x3b')](_[_0x4647('0x3a')](_0xf53946['query'],_0x43f021[_0x4647('0x3b')]));_0x17a0f1[_0x4647('0x39')]['ChatWebsiteId']=_0x4fad77['id'];if(_0xf53946['query'][_0x4647('0x3f')]){_0x17a0f1[_0x4647('0x39')]=_[_0x4647('0x3e')](_0x17a0f1[_0x4647('0x39')],{'$or':_[_0x4647('0x51')](_0x17a0f1['attributes'],function(_0x339890){var _0x346c17={};_0x346c17[_0x339890]={'$like':'%'+_0xf53946[_0x4647('0x2e')][_0x4647('0x3f')]+'%'};return _0x346c17;})});}_0x17a0f1=_[_0x4647('0x3e')]({},_0x17a0f1,_0xf53946[_0x4647('0x47')]);return db[_0x4647('0x99')][_0x4647('0x21')]({'where':_0x17a0f1['where']})[_0x4647('0x16')](function(_0x139bc9){_0x442d1c[_0x4647('0x21')]=_0x139bc9;if(_0xf53946[_0x4647('0x2e')][_0x4647('0x41')]){_0x17a0f1[_0x4647('0x42')]=[{'model':db[_0x4647('0x71')],'as':_0x4647('0xc9'),'required':![]},{'model':db[_0x4647('0xa3')],'as':'Owner','attributes':[_0x4647('0x2a'),_0x4647('0xca'),'internal'],'required':![]},{'model':db[_0x4647('0xcb')],'as':_0x4647('0xcc'),'attributes':['id',_0x4647('0x2a'),_0x4647('0xcd')],'where':_0xf53946['query'][_0x4647('0xce')]?{'id':_0xf53946['query'][_0x4647('0xce')]}:undefined,'required':_0xf53946[_0x4647('0x2e')]['tag']?!![]:![]}];}return db[_0x4647('0x99')]['findAll'](_0x17a0f1);})['then'](function(_0x459b23){_0x442d1c[_0x4647('0x44')]=_0x459b23;return _0x442d1c;});}})[_0x4647('0x16')](respondWithFilteredResult(_0x5d82c5,_0x17a0f1))[_0x4647('0x1d')](handleError(_0x5d82c5,null));};function iftimePromise(_0x5c31a6,_0x307682){return respondWithRpcPromise(_0x4647('0xcf'),_0x4647('0xd0'),{'command':_0x307682[_0x4647('0xd1')]?util['format']('iftime\x20%s,%s',_0x5c31a6['interval'],_0x307682[_0x4647('0xd1')]):util[_0x4647('0xc4')](_0x4647('0xd2'),_0x5c31a6['interval'])},client9002)[_0x4647('0x16')](function(_0x9a181a){var _0x2a55d0=_0x9a181a&&_0x9a181a[_0x4647('0xd3')](_0x4647('0xd4'))>=0x0?!![]:![];logger['info'](_0x4647('0xd5'),_0x307682['id'],_0x5c31a6['id'],_0x5c31a6[_0x4647('0xd6')],_0x2a55d0?_0x4647('0xd7'):_0x4647('0xd8'),_0x307682[_0x4647('0xd1')]?_0x307682['timezone']:_0x4647('0xd9'));return _0x2a55d0;})[_0x4647('0x1d')](function(_0x599cf4){logger[_0x4647('0x1a')](_0x4647('0xd5'),_0x307682['id'],_0x5c31a6['id'],_0x5c31a6[_0x4647('0xd6')],util['inspect'](_0x599cf4,{'showHidden':![],'depth':null}),_0x307682[_0x4647('0xd1')]?_0x307682[_0x4647('0xd1')]:_0x4647('0xd9'));return![];});}exports[_0x4647('0xd0')]=function(_0x41a54c,_0x333cf7,_0x542235){var _0x1f8d3e=0x0;var _0x4e2cf9=0x0;var _0x9e7342=![];var _0x2318c5;var _0x3f8887;return db['ChatWebsite']['find']({'where':{'id':_0x41a54c[_0x4647('0x45')]['id']},'include':[{'model':db[_0x4647('0xda')],'as':'Interval','include':[{'model':db[_0x4647('0xda')],'as':_0x4647('0xdb'),'attributes':['id',_0x4647('0xd6')],'raw':!![]}]}]})[_0x4647('0x16')](handleEntityNotFound(_0x333cf7,null))[_0x4647('0x16')](function(_0x46f207){if(_0x46f207){_0x2318c5=_0x46f207;return _0x46f207['getProactiveActions']({'raw':!![]});}})['then'](function(_0x480aed){if(_0x2318c5){if(_0x480aed){_0x3f8887=_0x480aed;}}return require(_0x4647('0xdc'))[_0x4647('0x5e')]();})[_0x4647('0x16')](function(_0x159a16){if(_0x159a16){_0x4e2cf9=_0x159a16[_0x4647('0xdd')];_0x9e7342=_0x159a16[_0x4647('0x5f')];}})[_0x4647('0x16')](function(){return db[_0x4647('0x99')][_0x4647('0x21')]({'where':{'closed':![]}});})[_0x4647('0x16')](function(_0xee1995){_0x1f8d3e=_0xee1995;if(_0x4e2cf9&&_0xee1995>_0x4e2cf9){return db[_0x4647('0xde')]['findOne']({'where':{'id':0x1}})[_0x4647('0x16')](function(_0x5ce474){if(_0x5ce474){_0x5ce474[_0x4647('0xdf')](_0x4647('0xe0'));}});}})['then'](function(){if(_0x2318c5[_0x4647('0xda')]&&_0x2318c5['Interval'][_0x4647('0xdb')]){var _0x4cc1de=[];for(var _0x512340=0x0;_0x512340<_0x2318c5[_0x4647('0xda')]['Intervals'][_0x4647('0x46')];_0x512340++){var _0x2894ec=_0x2318c5[_0x4647('0xda')]['Intervals'][_0x512340]['get']({'plain':!![]});_0x4cc1de[_0x4647('0x9e')](iftimePromise(_0x2894ec,_0x2318c5));}return BPromise[_0x4647('0xe1')](_0x4cc1de)[_0x4647('0x16')](function(_0x20fd0b){return _[_0x4647('0xe2')](_0x20fd0b);});}else{return!![];}})['then'](function(_0x52aa5f){var _0x12a2a9=fs[_0x4647('0xe3')](path[_0x4647('0x5b')](config['root'],_0x4647('0xe4')),_0x4647('0xb5'));var _0x5b877d={'remote':_0x2318c5['remote'],'query':querystring['stringify'](_[_0x4647('0x3e')](_0x2318c5['get']({'plain':!![]}),{'customerIp':_0x41a54c['headers'][_0x4647('0xe5')]||_0x41a54c[_0x4647('0x6e')][_0x4647('0xe6')]||_0x41a54c[_0x4647('0xe7')][_0x4647('0xe8')]||_0x41a54c['ip'],'referer':_0x41a54c[_0x4647('0x6e')][_0x4647('0x8e')],'openedInteractions':_0x1f8d3e,'maxInteractions':_0x4e2cf9,'virtual':_0x9e7342[_0x4647('0xdd')],'online':_0x52aa5f,'custom':_0x9e7342}))['replace'](/'/g,'\x5c\x27')};_0x333cf7[_0x4647('0x2b')](ejs[_0x4647('0xb6')](Mustache[_0x4647('0xb6')](_0x12a2a9,_0x5b877d),{'proactiveActions':_0x3f8887,'alignment':_0x2318c5[_0x4647('0xe9')],'verticalAlignment':_0x2318c5['verticalAlignment']}));})['catch'](handleError(_0x333cf7,null));};exports[_0x4647('0xea')]=function(_0x52dec6,_0x1070d7,_0x5e8c46){return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x52dec6['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x1070d7,null))['then'](function(_0x52cdce){if(_0x52cdce){return db[_0x4647('0xeb')][_0x4647('0xec')](function(_0x40872e){return db[_0x4647('0x83')][_0x4647('0x29')]({'where':{'ChatWebsiteId':_0x52dec6[_0x4647('0x45')]['id']},'transaction':_0x40872e})['then'](function(_0x250730){var _0x1c137c=_[_0x4647('0x51')](_0x52dec6['body'],function(_0x54d05e){_0x54d05e[_0x4647('0x4d')]=_0x52dec6['params']['id'];return _0x54d05e;});return db[_0x4647('0x83')][_0x4647('0xed')](_0x1c137c,{'transaction':_0x40872e});});})[_0x4647('0x16')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x52dec6[_0x4647('0x45')]['id']},'order':'priority'});});}})[_0x4647('0x16')](respondWithResult(_0x1070d7,null))['catch'](handleError(_0x1070d7,null));};exports[_0x4647('0xee')]=function(_0x259737,_0x6111e5,_0x4f1541){var _0x40ee18={};var _0x23190e={};var _0x4c9085;var _0xe15487;return db[_0x4647('0x40')]['findOne']({'where':{'id':_0x259737['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x6111e5,null))[_0x4647('0x16')](function(_0x185564){if(_0x185564){_0x4c9085=_0x185564;_0x23190e[_0x4647('0x32')]=_[_0x4647('0x2d')](db[_0x4647('0x83')][_0x4647('0x50')]);_0x23190e['query']=_['keys'](_0x259737['query']);_0x23190e[_0x4647('0x3b')]=_[_0x4647('0x31')](_0x23190e[_0x4647('0x32')],_0x23190e[_0x4647('0x2e')]);_0x40ee18[_0x4647('0x33')]=_[_0x4647('0x31')](_0x23190e[_0x4647('0x32')],qs[_0x4647('0x34')](_0x259737[_0x4647('0x2e')]['fields']));_0x40ee18[_0x4647('0x33')]=_0x40ee18[_0x4647('0x33')][_0x4647('0x46')]?_0x40ee18['attributes']:_0x23190e['model'];_0x40ee18[_0x4647('0x37')]=qs['sort'](_0x259737[_0x4647('0x2e')][_0x4647('0x38')]);_0x40ee18[_0x4647('0x39')]=qs[_0x4647('0x3b')](_[_0x4647('0x3a')](_0x259737[_0x4647('0x2e')],_0x23190e['filters']));if(_0x259737[_0x4647('0x2e')][_0x4647('0x3f')]){_0x40ee18[_0x4647('0x39')]=_[_0x4647('0x3e')](_0x40ee18['where'],{'$or':_[_0x4647('0x51')](_0x40ee18[_0x4647('0x33')],function(_0x12f930){var _0x4897d2={};_0x4897d2[_0x12f930]={'$like':'%'+_0x259737['query'][_0x4647('0x3f')]+'%'};return _0x4897d2;})});}_0x40ee18=_['merge']({},_0x40ee18,_0x259737[_0x4647('0x47')]);return _0x4c9085['getApplications'](_0x40ee18);}})[_0x4647('0x16')](function(_0x42a9f0){if(_0x42a9f0){_0xe15487=_0x42a9f0[_0x4647('0x46')];if(!_0x259737[_0x4647('0x2e')][_0x4647('0x35')](_0x4647('0x36'))){_0x40ee18['limit']=qs[_0x4647('0x23')](_0x259737[_0x4647('0x2e')]['limit']);_0x40ee18[_0x4647('0x22')]=qs[_0x4647('0x22')](_0x259737[_0x4647('0x2e')][_0x4647('0x22')]);}return _0x4c9085[_0x4647('0xee')](_0x40ee18);}})[_0x4647('0x16')](function(_0x13558d){if(_0x13558d){return _0x13558d?{'count':_0xe15487,'rows':_0x13558d}:null;}})[_0x4647('0x16')](respondWithResult(_0x6111e5,null))[_0x4647('0x1d')](handleError(_0x6111e5,null));};exports[_0x4647('0xef')]=function(_0x343b77,_0x1c193a,_0x3946f9){return db['chatProactiveAction'][_0x4647('0x48')]({'where':{'id':_0x343b77[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x1c193a,null))[_0x4647('0x16')](function(_0x45c9dc){if(_0x45c9dc){return _0x45c9dc[_0x4647('0xef')](_0x343b77[_0x4647('0x4a')]['ids'],_['omit'](_0x343b77[_0x4647('0x4a')],[_0x4647('0x53'),'id'])||{});}})[_0x4647('0x16')](respondWithResult(_0x1c193a,null))[_0x4647('0x1d')](handleError(_0x1c193a,null));};exports['getProactiveActions']=function(_0x6926cf,_0x5c04cb,_0x23d255){var _0x3a5ba3={};var _0x27abf3={};var _0x2b4011;var _0x21c7c6;return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x6926cf['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x5c04cb,null))[_0x4647('0x16')](function(_0xa1f6c5){if(_0xa1f6c5){_0x2b4011=_0xa1f6c5;_0x27abf3[_0x4647('0x32')]=_[_0x4647('0x2d')](db['ChatProactiveAction'][_0x4647('0x50')]);_0x27abf3[_0x4647('0x2e')]=_['keys'](_0x6926cf[_0x4647('0x2e')]);_0x27abf3[_0x4647('0x3b')]=_[_0x4647('0x31')](_0x27abf3[_0x4647('0x32')],_0x27abf3[_0x4647('0x2e')]);_0x3a5ba3['attributes']=_[_0x4647('0x31')](_0x27abf3['model'],qs[_0x4647('0x34')](_0x6926cf[_0x4647('0x2e')]['fields']));_0x3a5ba3[_0x4647('0x33')]=_0x3a5ba3['attributes'][_0x4647('0x46')]?_0x3a5ba3[_0x4647('0x33')]:_0x27abf3[_0x4647('0x32')];_0x3a5ba3[_0x4647('0x37')]=qs['sort'](_0x6926cf['query'][_0x4647('0x38')]);_0x3a5ba3['where']=qs[_0x4647('0x3b')](_[_0x4647('0x3a')](_0x6926cf[_0x4647('0x2e')],_0x27abf3[_0x4647('0x3b')]));if(_0x6926cf['query'][_0x4647('0x3f')]){_0x3a5ba3['where']=_[_0x4647('0x3e')](_0x3a5ba3[_0x4647('0x39')],{'$or':_['map'](_0x3a5ba3[_0x4647('0x33')],function(_0x28c98d){var _0x4e69d3={};_0x4e69d3[_0x28c98d]={'$like':'%'+_0x6926cf[_0x4647('0x2e')][_0x4647('0x3f')]+'%'};return _0x4e69d3;})});}_0x3a5ba3=_[_0x4647('0x3e')]({},_0x3a5ba3,_0x6926cf[_0x4647('0x47')]);return _0x2b4011['getProactiveActions'](_0x3a5ba3);}})[_0x4647('0x16')](function(_0x37775d){if(_0x37775d){_0x21c7c6=_0x37775d[_0x4647('0x46')];if(!_0x6926cf[_0x4647('0x2e')][_0x4647('0x35')](_0x4647('0x36'))){_0x3a5ba3[_0x4647('0x23')]=qs['limit'](_0x6926cf[_0x4647('0x2e')][_0x4647('0x23')]);_0x3a5ba3[_0x4647('0x22')]=qs[_0x4647('0x22')](_0x6926cf['query'][_0x4647('0x22')]);}return _0x2b4011[_0x4647('0xf0')](_0x3a5ba3);}})[_0x4647('0x16')](function(_0x110cd0){if(_0x110cd0){return _0x110cd0?{'count':_0x21c7c6,'rows':_0x110cd0}:null;}})[_0x4647('0x16')](respondWithResult(_0x5c04cb,null))[_0x4647('0x1d')](handleError(_0x5c04cb,null));};exports[_0x4647('0xf1')]=function(_0x52741c,_0x582375,_0x43d5b7){var _0x335085=_0x52741c[_0x4647('0x2e')]['online']===_0x4647('0xf2')?_0x4647('0xf3'):_0x4647('0xf4');return db[_0x4647('0x40')][_0x4647('0x48')]({'attributes':['id',_0x335085],'where':{'id':_0x52741c[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x582375,null))[_0x4647('0x16')](function(_0x1360b8){if(_0x1360b8){var _0x45c38e=_0x1360b8[_0x335085];var _0x504805=_0x45c38e&&_0x45c38e[_0x4647('0xf5')]?_0x45c38e[_0x4647('0xf5')]:[];_0x582375[_0x4647('0x2b')]({'fromKey':_['isNil'](_0x45c38e[_0x4647('0xf6')])?undefined:_0x45c38e[_0x4647('0xf6')],'count':_0x504805[_0x4647('0x46')],'rows':_0x504805});}})['catch'](handleError(_0x582375,null));};exports[_0x4647('0xf7')]=function(_0x1583a1,_0x17802c,_0x9ca19b){var _0x5727bb={'raw':!![],'where':{}};var _0x469a26={};var _0x490b5a={'count':0x0,'rows':[]};return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x1583a1['params']['id']}})['then'](handleEntityNotFound(_0x17802c,null))[_0x4647('0x16')](function(_0x18342b){if(_0x18342b){_0x469a26[_0x4647('0x32')]=_[_0x4647('0x2d')](db[_0x4647('0xb8')]['rawAttributes']);_0x469a26['query']=_['keys'](_0x1583a1[_0x4647('0x2e')]);_0x469a26['filters']=_[_0x4647('0x31')](_0x469a26['model'],_0x469a26['query']);_0x5727bb['attributes']=_['intersection'](_0x469a26['model'],qs[_0x4647('0x34')](_0x1583a1[_0x4647('0x2e')][_0x4647('0x34')]));_0x5727bb[_0x4647('0x33')]=_0x5727bb[_0x4647('0x33')][_0x4647('0x46')]?_0x5727bb[_0x4647('0x33')]:_0x469a26[_0x4647('0x32')];if(!_0x1583a1[_0x4647('0x2e')][_0x4647('0x35')](_0x4647('0x36'))){_0x5727bb[_0x4647('0x23')]=qs[_0x4647('0x23')](_0x1583a1[_0x4647('0x2e')]['limit']);_0x5727bb[_0x4647('0x22')]=qs['offset'](_0x1583a1[_0x4647('0x2e')]['offset']);}_0x5727bb[_0x4647('0x37')]=qs[_0x4647('0x38')](_0x1583a1[_0x4647('0x2e')][_0x4647('0x38')]);_0x5727bb[_0x4647('0x39')]=qs[_0x4647('0x3b')](_['pick'](_0x1583a1[_0x4647('0x2e')],_0x469a26[_0x4647('0x3b')]));_0x5727bb['where'][_0x4647('0x4d')]=_0x18342b['id'];if(_0x1583a1[_0x4647('0x2e')]['filter']){_0x5727bb['where']=_[_0x4647('0x3e')](_0x5727bb[_0x4647('0x39')],{'$or':_['map'](_0x5727bb[_0x4647('0x33')],function(_0x5e1dec){var _0x5a573f={};_0x5a573f[_0x5e1dec]={'$like':'%'+_0x1583a1['query']['filter']+'%'};return _0x5a573f;})});}_0x5727bb=_[_0x4647('0x3e')]({},_0x5727bb,_0x1583a1['options']);return db['ChatOfflineMessage'][_0x4647('0x21')]({'where':_0x5727bb[_0x4647('0x39')]})[_0x4647('0x16')](function(_0x19ead2){_0x490b5a['count']=_0x19ead2;if(_0x1583a1[_0x4647('0x2e')][_0x4647('0x41')]){_0x5727bb['include']=[{'all':!![]}];}return db[_0x4647('0xb8')][_0x4647('0x43')](_0x5727bb);})[_0x4647('0x16')](function(_0x364ec5){_0x490b5a['rows']=_0x364ec5;return _0x490b5a;});}})[_0x4647('0x16')](respondWithFilteredResult(_0x17802c,_0x5727bb))['catch'](handleError(_0x17802c,null));};exports[_0x4647('0xf8')]=function(_0x21ca6c,_0x4fe496,_0x1e2d6c){return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x21ca6c[_0x4647('0x45')]['id']}})['then'](handleEntityNotFound(_0x4fe496,null))[_0x4647('0x16')](function(_0x453ec4){if(_0x453ec4){return _0x453ec4[_0x4647('0xf8')](_0x21ca6c[_0x4647('0x4a')]['ids'],_[_0x4647('0xc7')](_0x21ca6c[_0x4647('0x4a')],[_0x4647('0x53'),'id'])||{})[_0x4647('0xb3')](function(_0x2cb13c){for(var _0x4c9788=0x0;_0x4c9788<_0x21ca6c[_0x4647('0x4a')][_0x4647('0x53')][_0x4647('0x46')];_0x4c9788+=0x1){socket[_0x4647('0xf9')](_0x4647('0xfa'),{'UserId':_0x21ca6c['body'][_0x4647('0x53')][_0x4c9788],'ChatWebsiteId':_0x21ca6c[_0x4647('0x45')]['id']});}return _0x2cb13c;});}})['then'](respondWithResult(_0x4fe496,null))[_0x4647('0x1d')](handleError(_0x4fe496,null));};exports['removeAgents']=function(_0x57dc0a,_0x4e0aad,_0x476660){var _0x15d37e;return db[_0x4647('0x40')][_0x4647('0x48')]({'where':{'id':_0x57dc0a[_0x4647('0x45')]['id']}})[_0x4647('0x16')](handleEntityNotFound(_0x4e0aad,null))[_0x4647('0x16')](function(_0x4f6678){if(_0x4f6678){return _0x4f6678[_0x4647('0xfb')](_0x57dc0a['query'][_0x4647('0x53')])[_0x4647('0x16')](function(_0x4ba81b){if(_[_0x4647('0xfc')](_0x57dc0a[_0x4647('0x2e')]['ids'])){for(var _0x20115f=0x0;_0x20115f<_0x57dc0a['query']['ids']['length'];_0x20115f+=0x1){socket['emit']('userChatWebsite:remove',{'UserId':_0x57dc0a[_0x4647('0x2e')]['ids'][_0x20115f],'ChatWebsiteId':_0x57dc0a[_0x4647('0x45')]['id']});}}else{socket[_0x4647('0xf9')]('userChatWebsite:remove',{'UserId':_0x57dc0a[_0x4647('0x2e')][_0x4647('0x53')],'ChatWebsiteId':_0x57dc0a[_0x4647('0x45')]['id']});}});}})['then'](respondWithStatusCode(_0x4e0aad,null))[_0x4647('0x1d')](handleError(_0x4e0aad,null));};exports[_0x4647('0xfd')]=function(_0x3acc95,_0xbb52a7,_0x5d7ff4){var _0x41b4f8={};var _0x4467a8={};var _0x1921fb;var _0x2dadec;return db[_0x4647('0x40')][_0x4647('0x4e')]({'where':{'id':_0x3acc95['params']['id']}})[_0x4647('0x16')](handleEntityNotFound(_0xbb52a7,null))[_0x4647('0x16')](function(_0x386908){if(_0x386908){_0x1921fb=_0x386908;_0x4467a8[_0x4647('0x32')]=_['keys'](db[_0x4647('0xa3')]['rawAttributes']);_0x4467a8[_0x4647('0x2e')]=_[_0x4647('0x2d')](_0x3acc95[_0x4647('0x2e')]);_0x4467a8[_0x4647('0x3b')]=_['intersection'](_0x4467a8[_0x4647('0x32')],_0x4467a8[_0x4647('0x2e')]);_0x41b4f8[_0x4647('0x33')]=_[_0x4647('0x31')](_0x4467a8[_0x4647('0x32')],qs[_0x4647('0x34')](_0x3acc95['query']['fields']));_0x41b4f8[_0x4647('0x33')]=_0x41b4f8[_0x4647('0x33')][_0x4647('0x46')]?_0x41b4f8['attributes']:_0x4467a8[_0x4647('0x32')];_0x41b4f8[_0x4647('0x37')]=qs[_0x4647('0x38')](_0x3acc95[_0x4647('0x2e')]['sort']);_0x41b4f8['where']=qs['filters'](_['pick'](_0x3acc95[_0x4647('0x2e')],_0x4467a8['filters']));if(_0x3acc95[_0x4647('0x2e')][_0x4647('0x3f')]){_0x41b4f8[_0x4647('0x39')]=_[_0x4647('0x3e')](_0x41b4f8[_0x4647('0x39')],{'$or':_[_0x4647('0x51')](_0x41b4f8[_0x4647('0x33')],function(_0x42ff97){var _0x148f8c={};_0x148f8c[_0x42ff97]={'$like':'%'+_0x3acc95[_0x4647('0x2e')][_0x4647('0x3f')]+'%'};return _0x148f8c;})});}_0x41b4f8=_[_0x4647('0x3e')]({},_0x41b4f8,_0x3acc95[_0x4647('0x47')]);return _0x1921fb[_0x4647('0xfd')](_0x41b4f8);}})[_0x4647('0x16')](function(_0x224fe7){if(_0x224fe7){_0x2dadec=_0x224fe7[_0x4647('0x46')];if(!_0x3acc95[_0x4647('0x2e')]['hasOwnProperty'](_0x4647('0x36'))){_0x41b4f8[_0x4647('0x23')]=qs[_0x4647('0x23')](_0x3acc95[_0x4647('0x2e')]['limit']);_0x41b4f8[_0x4647('0x22')]=qs[_0x4647('0x22')](_0x3acc95['query']['offset']);}return _0x1921fb[_0x4647('0xfd')](_0x41b4f8);}})['then'](function(_0x216b5f){if(_0x216b5f){return _0x216b5f?{'count':_0x2dadec,'rows':_0x216b5f}:null;}})['then'](respondWithResult(_0xbb52a7,null))[_0x4647('0x1d')](handleError(_0xbb52a7,null));}; \ No newline at end of file +var _0x64d4=['custom','isNil','existsSync','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','account','Applications','list','applications','orderBy','priority','asc','defaults','contact','firstName','referer','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','type','threadId','externalUrl','ContactId','interaction','ChatInteraction','lastName','get','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','EventManager','offline','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','omit','getInteractions','Contact','Owner','internal','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','getLicense','License','increment','chatLicenseExceeded','all','readFileSync','server/files/chat/iframe.js','headers','x-forwarded-for','x-real-ip','remoteAddress','virtual','replace','alignment','verticalAlignment','addApplications','transaction','bulkCreate','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','fromKey','getOfflineMessages','addAgents','removeAgents','emit','userChatWebsite:remove','getAgents','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./chatWebsite.socket','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','hasOwnProperty','nolimit','sort','filters','pick','day','add','merge','where','filter','map','options','ChatWebsite','rows','show','params','rawAttributes','length','includeAll','create','body','find','describe','ChatWebsiteId','getDispositions','findOne','Disposition','order','include','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','filename','agentAvatar','customerAvatar','addSystemAvatar','file','getLogo','join','../../config/license/util'];(function(_0x3e8be5,_0x2e69c4){var _0x1defa5=function(_0x56f9fc){while(--_0x56f9fc){_0x3e8be5['push'](_0x3e8be5['shift']());}};_0x1defa5(++_0x2e69c4);}(_0x64d4,0xa2));var _0x464d=function(_0x1f6fd8,_0xcbe574){_0x1f6fd8=_0x1f6fd8-0x0;var _0x3c6790=_0x64d4[_0x1f6fd8];return _0x3c6790;};'use strict';var jsonpatch=require(_0x464d('0x0'));var rp=require(_0x464d('0x1'));var moment=require('moment');var BPromise=require(_0x464d('0x2'));var Mustache=require(_0x464d('0x3'));var util=require('util');var path=require('path');var sox=require(_0x464d('0x4'));var csv=require('to-csv');var ejs=require(_0x464d('0x5'));var fs=require('fs');var _=require(_0x464d('0x6'));var squel=require(_0x464d('0x7'));var crypto=require('crypto');var jsforce=require(_0x464d('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x464d('0x9'));var querystring=require(_0x464d('0xa'));var Papa=require(_0x464d('0xb'));var qs=require(_0x464d('0xc'));var logger=require(_0x464d('0xd'))(_0x464d('0xe'));var utils=require(_0x464d('0xf'));var config=require(_0x464d('0x10'));var db=require(_0x464d('0x11'))['db'];var socket=require(_0x464d('0x12'))({'host':_0x464d('0x13'),'port':0x18eb});require(_0x464d('0x14'))[_0x464d('0x15')](socket);var jayson=require(_0x464d('0x16'));var client=jayson[_0x464d('0x17')][_0x464d('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x464d('0x18')]({'port':0x232a});var client9003=jayson[_0x464d('0x17')]['http']({'port':0x232b});function respondWithRpcPromise(_0x339b30,_0x1c211f,_0x179a66,_0x4cfcc1){return new BPromise(function(_0x155a51,_0x3dc9e9){var _0x42c233=_0x4cfcc1||client;return _0x42c233[_0x464d('0x19')](_0x339b30,_0x179a66)['then'](function(_0x26d8e3){logger[_0x464d('0x1a')](_0x464d('0x1b'),_0x1c211f,_0x464d('0x1c'));logger[_0x464d('0x1d')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x1c211f,_0x464d('0x1c'),JSON[_0x464d('0x1e')](_0x26d8e3));if(_0x26d8e3[_0x464d('0x1f')]){if(_0x26d8e3[_0x464d('0x1f')][_0x464d('0x20')]===0x1f4){logger['error'](_0x464d('0x1b'),_0x1c211f,_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);return _0x3dc9e9(_0x26d8e3[_0x464d('0x1f')]['message']);}logger[_0x464d('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x1c211f,_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);return _0x155a51(_0x26d8e3[_0x464d('0x1f')][_0x464d('0x21')]);}else{logger[_0x464d('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x1c211f,_0x464d('0x1c'));_0x155a51(_0x26d8e3[_0x464d('0x22')][_0x464d('0x21')]);}})[_0x464d('0x23')](function(_0x3b8e92){logger[_0x464d('0x1f')](_0x464d('0x1b'),_0x1c211f,_0x3b8e92);_0x3dc9e9(_0x3b8e92);});});}function respondWithStatusCode(_0x184cc3,_0x1b2edc){_0x1b2edc=_0x1b2edc||0xcc;return function(_0x4a1c74){if(_0x4a1c74){return _0x184cc3[_0x464d('0x24')](_0x1b2edc);}return _0x184cc3['status'](_0x1b2edc)[_0x464d('0x25')]();};}function respondWithResult(_0x16eb17,_0x5dce07){_0x5dce07=_0x5dce07||0xc8;return function(_0x3d5edc){if(_0x3d5edc){return _0x16eb17[_0x464d('0x26')](_0x5dce07)[_0x464d('0x27')](_0x3d5edc);}};}function respondWithFilteredResult(_0x1978f5,_0x8ff74d){return function(_0x5b4350){if(_0x5b4350){var _0x2678fa=_0x5b4350[_0x464d('0x28')],_0x1e6909=_0x8ff74d[_0x464d('0x29')],_0xcc1e84=_0x8ff74d[_0x464d('0x29')]+_0x8ff74d[_0x464d('0x2a')],_0x29f00f;if(_0xcc1e84>=_0x2678fa){_0xcc1e84=_0x2678fa;_0x29f00f=0xc8;}else{_0x29f00f=0xce;}_0x1978f5[_0x464d('0x26')](_0x29f00f);return _0x1978f5[_0x464d('0x2b')](_0x464d('0x2c'),_0x1e6909+'-'+_0xcc1e84+'/'+_0x2678fa)[_0x464d('0x27')](_0x5b4350);}return null;};}function patchUpdates(_0x10ec49){return function(_0x59a916){try{jsonpatch[_0x464d('0x2d')](_0x59a916,_0x10ec49,!![]);}catch(_0x4f8505){return BPromise[_0x464d('0x2e')](_0x4f8505);}return _0x59a916[_0x464d('0x2f')]();};}function saveUpdates(_0x346238,_0xbdd7be){return function(_0x2ca59e){if(_0x2ca59e){return _0x2ca59e[_0x464d('0x30')](_0x346238)['then'](function(_0x462749){return _0x462749;});}return null;};}function removeEntity(_0x3800ef,_0x292816){return function(_0x31d21c){if(_0x31d21c){return _0x31d21c[_0x464d('0x31')]()[_0x464d('0x32')](function(){_0x3800ef['status'](0xcc)[_0x464d('0x25')]();});}};}function handleEntityNotFound(_0x972d44,_0x368f20){return function(_0x2e5aa4){if(!_0x2e5aa4){_0x972d44[_0x464d('0x24')](0x194);}return _0x2e5aa4;};}function handleError(_0x3aa138,_0x49d3da){_0x49d3da=_0x49d3da||0x1f4;return function(_0x1f3bef){logger[_0x464d('0x1f')](_0x1f3bef[_0x464d('0x33')]);if(_0x1f3bef['name']){delete _0x1f3bef[_0x464d('0x34')];}_0x3aa138[_0x464d('0x26')](_0x49d3da)[_0x464d('0x35')](_0x1f3bef);};}exports[_0x464d('0x36')]=function(_0x41cc7f,_0x3a4cd7){var _0x43791f={},_0x29c73c={},_0x2d6afb={'count':0x0,'rows':[]};var _0xa9756c=db['ChatWebsite']['rawAttributes'];_0x29c73c[_0x464d('0x37')]=_[_0x464d('0x38')](_0xa9756c);var _0x135708={'dateStart':_0x41cc7f[_0x464d('0x39')]['dateStart'],'dateEnd':_0x41cc7f[_0x464d('0x39')][_0x464d('0x3a')]};delete _0x41cc7f[_0x464d('0x39')][_0x464d('0x3b')];delete _0x41cc7f[_0x464d('0x39')][_0x464d('0x3a')];_0x29c73c[_0x464d('0x39')]=_[_0x464d('0x38')](_0x41cc7f[_0x464d('0x39')]);_0x29c73c['filters']=_[_0x464d('0x3c')](_0x29c73c['model'],_0x29c73c['query']);_0x43791f[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x29c73c[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x41cc7f[_0x464d('0x39')]['fields']));_0x43791f[_0x464d('0x3d')]=_0x43791f[_0x464d('0x3d')]['length']?_0x43791f[_0x464d('0x3d')]:_0x29c73c[_0x464d('0x37')];if(!_0x41cc7f[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x43791f[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x41cc7f[_0x464d('0x39')][_0x464d('0x2a')]);_0x43791f[_0x464d('0x29')]=qs['offset'](_0x41cc7f['query'][_0x464d('0x29')]);}_0x43791f['order']=qs[_0x464d('0x41')](_0x41cc7f[_0x464d('0x39')][_0x464d('0x41')]);_0x43791f['where']=qs[_0x464d('0x42')](_[_0x464d('0x43')](_0x41cc7f['query'],_0x29c73c[_0x464d('0x42')]));if(_0x135708[_0x464d('0x3b')]){if(_0x135708[_0x464d('0x3a')]){_0x135708[_0x464d('0x3a')]=moment(_0x135708[_0x464d('0x3a')])['add'](0x1,_0x464d('0x44'));}else{_0x135708[_0x464d('0x3a')]=moment(_0x135708[_0x464d('0x3b')])[_0x464d('0x45')](0x1,_0x464d('0x44'));}_[_0x464d('0x46')](_0x43791f[_0x464d('0x47')],{'createdAt':{'$gte':_0x135708[_0x464d('0x3b')],'$lte':_0x135708[_0x464d('0x3a')]}});}if(_0x41cc7f[_0x464d('0x39')][_0x464d('0x48')]){_0x43791f[_0x464d('0x47')]=_[_0x464d('0x46')](_0x43791f[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x43791f['attributes'],function(_0x27181f){var _0x32b8b8={};_0x32b8b8[_0x27181f]={'$like':'%'+_0x41cc7f[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x32b8b8;})});}_0x43791f=_[_0x464d('0x46')]({},_0x43791f,_0x41cc7f[_0x464d('0x4a')]);var _0x55e2f8={'where':_0x43791f[_0x464d('0x47')]};return db[_0x464d('0x4b')][_0x464d('0x28')](_0x55e2f8)[_0x464d('0x32')](function(_0x33801c){_0x2d6afb[_0x464d('0x28')]=_0x33801c;if(_0x41cc7f['query']['includeAll']){_0x43791f['include']=[{'all':!![]}];}return db[_0x464d('0x4b')]['findAll'](_0x43791f);})[_0x464d('0x32')](function(_0x1bd423){_0x2d6afb[_0x464d('0x4c')]=_0x1bd423;return _0x2d6afb;})[_0x464d('0x32')](respondWithFilteredResult(_0x3a4cd7,_0x43791f))[_0x464d('0x23')](handleError(_0x3a4cd7,null));};exports[_0x464d('0x4d')]=function(_0x7440c7,_0x2e163e){var _0x6205f0={'raw':![],'where':{'id':_0x7440c7[_0x464d('0x4e')]['id']}},_0x3071f6={};_0x3071f6[_0x464d('0x37')]=_[_0x464d('0x38')](db['ChatWebsite'][_0x464d('0x4f')]);_0x3071f6[_0x464d('0x39')]=_[_0x464d('0x38')](_0x7440c7[_0x464d('0x39')]);_0x3071f6['filters']=_[_0x464d('0x3c')](_0x3071f6['model'],_0x3071f6[_0x464d('0x39')]);_0x6205f0['attributes']=_['intersection'](_0x3071f6[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x7440c7[_0x464d('0x39')]['fields']));_0x6205f0[_0x464d('0x3d')]=_0x6205f0[_0x464d('0x3d')][_0x464d('0x50')]?_0x6205f0['attributes']:_0x3071f6[_0x464d('0x37')];if(_0x7440c7[_0x464d('0x39')][_0x464d('0x51')]){_0x6205f0['include']=[{'all':!![]}];}_0x6205f0=_[_0x464d('0x46')]({},_0x6205f0,_0x7440c7['options']);return db[_0x464d('0x4b')]['find'](_0x6205f0)['then'](handleEntityNotFound(_0x2e163e,null))[_0x464d('0x32')](respondWithResult(_0x2e163e,null))[_0x464d('0x23')](handleError(_0x2e163e,null));};exports['create']=function(_0x50309d,_0x5b5e76){return db['ChatWebsite'][_0x464d('0x52')](_0x50309d[_0x464d('0x53')],{})[_0x464d('0x32')](respondWithResult(_0x5b5e76,0xc9))['catch'](handleError(_0x5b5e76,null));};exports['update']=function(_0x1e4589,_0x3aa600){if(_0x1e4589[_0x464d('0x53')]['id']){delete _0x1e4589[_0x464d('0x53')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1e4589[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x3aa600,null))[_0x464d('0x32')](saveUpdates(_0x1e4589['body'],null))['then'](respondWithResult(_0x3aa600,null))[_0x464d('0x23')](handleError(_0x3aa600,null));};exports[_0x464d('0x31')]=function(_0xf07ec1,_0x364ee9){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0xf07ec1[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x364ee9,null))[_0x464d('0x32')](removeEntity(_0x364ee9,null))[_0x464d('0x23')](handleError(_0x364ee9,null));};exports[_0x464d('0x55')]=function(_0x56d903,_0x39374c){return db[_0x464d('0x4b')]['describe']()[_0x464d('0x32')](respondWithResult(_0x39374c,null))[_0x464d('0x23')](handleError(_0x39374c,null));};exports['addDisposition']=function(_0x26e11c,_0x469a29,_0x368611){if(_0x26e11c['body']['id']){delete _0x26e11c[_0x464d('0x53')]['id'];}return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x26e11c['params']['id']}})['then'](handleEntityNotFound(_0x469a29,null))[_0x464d('0x32')](function(_0x122d52){if(_0x122d52){_0x26e11c[_0x464d('0x53')][_0x464d('0x56')]=_0x122d52['id'];return db['Disposition']['create'](_0x26e11c['body']);}})[_0x464d('0x32')](respondWithResult(_0x469a29,null))['catch'](handleError(_0x469a29,null));};exports[_0x464d('0x57')]=function(_0x2afe11,_0x395c03,_0x5eaa4b){var _0x13a65b={'raw':![],'where':{}};var _0x28b9e7={};var _0x14905f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x2afe11[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x395c03,null))[_0x464d('0x32')](function(_0x52cd54){if(_0x52cd54){_0x28b9e7['model']=_['keys'](db[_0x464d('0x59')]['rawAttributes']);_0x28b9e7[_0x464d('0x39')]=_[_0x464d('0x38')](_0x2afe11[_0x464d('0x39')]);_0x28b9e7[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x28b9e7[_0x464d('0x37')],_0x28b9e7[_0x464d('0x39')]);_0x13a65b[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x28b9e7[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x2afe11[_0x464d('0x39')][_0x464d('0x3e')]));_0x13a65b['attributes']=_0x13a65b[_0x464d('0x3d')][_0x464d('0x50')]?_0x13a65b[_0x464d('0x3d')]:_0x28b9e7[_0x464d('0x37')];if(!_0x2afe11[_0x464d('0x39')][_0x464d('0x3f')]('nolimit')){_0x13a65b[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x2afe11['query'][_0x464d('0x2a')]);_0x13a65b[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x2afe11['query'][_0x464d('0x29')]);}_0x13a65b[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x2afe11[_0x464d('0x39')][_0x464d('0x41')]);_0x13a65b['where']=qs[_0x464d('0x42')](_['pick'](_0x2afe11[_0x464d('0x39')],_0x28b9e7[_0x464d('0x42')]));_0x13a65b[_0x464d('0x47')][_0x464d('0x56')]=_0x52cd54['id'];if(_0x2afe11['query']['filter']){_0x13a65b[_0x464d('0x47')]=_[_0x464d('0x46')](_0x13a65b[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x13a65b[_0x464d('0x3d')],function(_0x1fa785){var _0x36cd20={};_0x36cd20[_0x1fa785]={'$like':'%'+_0x2afe11[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x36cd20;})});}_0x13a65b=_['merge']({},_0x13a65b,_0x2afe11['options']);return db['Disposition'][_0x464d('0x28')]({'where':_0x13a65b[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x12d995){_0x14905f[_0x464d('0x28')]=_0x12d995;if(_0x2afe11[_0x464d('0x39')]['includeAll']){_0x13a65b[_0x464d('0x5b')]=[{'all':!![]}];}return db[_0x464d('0x59')][_0x464d('0x5c')](_0x13a65b);})[_0x464d('0x32')](function(_0x6ccb6){_0x14905f[_0x464d('0x4c')]=_0x6ccb6;return _0x14905f;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x395c03,_0x13a65b))[_0x464d('0x23')](handleError(_0x395c03,null));};exports['removeDispositions']=function(_0x5f88d7,_0x50360b,_0x256562){var _0x53ea0c;return db[_0x464d('0x4b')]['find']({'where':{'id':_0x5f88d7[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x50360b,null))[_0x464d('0x32')](function(_0xd75844){if(_0xd75844){return _0xd75844[_0x464d('0x5d')](_0x5f88d7[_0x464d('0x39')][_0x464d('0x5e')]);}})['then'](respondWithStatusCode(_0x50360b,null))[_0x464d('0x23')](handleError(_0x50360b,null));};exports[_0x464d('0x5f')]=function(_0x500a15,_0x542760,_0x509d49){if(_0x500a15['body']['id']){delete _0x500a15[_0x464d('0x53')]['id'];}return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x500a15['params']['id']}})['then'](handleEntityNotFound(_0x542760,null))[_0x464d('0x32')](function(_0x3459e3){if(_0x3459e3){_0x500a15[_0x464d('0x53')][_0x464d('0x56')]=_0x3459e3['id'];return db['CannedAnswer'][_0x464d('0x52')](_0x500a15[_0x464d('0x53')]);}})[_0x464d('0x32')](respondWithResult(_0x542760,null))[_0x464d('0x23')](handleError(_0x542760,null));};exports[_0x464d('0x60')]=function(_0x131f51,_0x58c2fb,_0x5ed2dd){var _0x549430={'raw':![],'where':{}};var _0x2f2e6a={};var _0x2bd27c={'count':0x0,'rows':[]};return db[_0x464d('0x4b')]['findOne']({'where':{'id':_0x131f51[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x58c2fb,null))[_0x464d('0x32')](function(_0x5cd612){if(_0x5cd612){_0x2f2e6a[_0x464d('0x37')]=_['keys'](db[_0x464d('0x61')]['rawAttributes']);_0x2f2e6a[_0x464d('0x39')]=_[_0x464d('0x38')](_0x131f51[_0x464d('0x39')]);_0x2f2e6a[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x2f2e6a['model'],_0x2f2e6a[_0x464d('0x39')]);_0x549430[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x2f2e6a[_0x464d('0x37')],qs['fields'](_0x131f51[_0x464d('0x39')][_0x464d('0x3e')]));_0x549430[_0x464d('0x3d')]=_0x549430['attributes'][_0x464d('0x50')]?_0x549430['attributes']:_0x2f2e6a[_0x464d('0x37')];if(!_0x131f51['query'][_0x464d('0x3f')](_0x464d('0x40'))){_0x549430[_0x464d('0x2a')]=qs['limit'](_0x131f51[_0x464d('0x39')]['limit']);_0x549430[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x131f51[_0x464d('0x39')]['offset']);}_0x549430[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x131f51[_0x464d('0x39')][_0x464d('0x41')]);_0x549430[_0x464d('0x47')]=qs['filters'](_[_0x464d('0x43')](_0x131f51['query'],_0x2f2e6a[_0x464d('0x42')]));_0x549430['where'][_0x464d('0x56')]=_0x5cd612['id'];if(_0x131f51[_0x464d('0x39')][_0x464d('0x48')]){_0x549430[_0x464d('0x47')]=_[_0x464d('0x46')](_0x549430[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x549430[_0x464d('0x3d')],function(_0x111f26){var _0x1d6b2e={};_0x1d6b2e[_0x111f26]={'$like':'%'+_0x131f51[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x1d6b2e;})});}_0x549430=_[_0x464d('0x46')]({},_0x549430,_0x131f51[_0x464d('0x4a')]);return db[_0x464d('0x61')]['count']({'where':_0x549430[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x26158d){_0x2bd27c[_0x464d('0x28')]=_0x26158d;if(_0x131f51[_0x464d('0x39')][_0x464d('0x51')]){_0x549430[_0x464d('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x464d('0x5c')](_0x549430);})['then'](function(_0xbc8d40){_0x2bd27c['rows']=_0xbc8d40;return _0x2bd27c;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x58c2fb,_0x549430))[_0x464d('0x23')](handleError(_0x58c2fb,null));};exports['removeAnswers']=function(_0x4ccc46,_0xa95be6,_0x30cd95){var _0xb06f50;return db[_0x464d('0x4b')]['find']({'where':{'id':_0x4ccc46[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0xa95be6,null))['then'](function(_0x135a1){if(_0x135a1){return _0x135a1[_0x464d('0x62')](_0x4ccc46['query']['ids']);}})[_0x464d('0x32')](respondWithStatusCode(_0xa95be6,null))[_0x464d('0x23')](handleError(_0xa95be6,null));};exports[_0x464d('0x63')]=function(_0x1c2361,_0xa10802,_0x3b0029){_0x1c2361[_0x464d('0x53')][_0x464d('0x64')]=_0x1c2361['file'][_0x464d('0x65')];return db[_0x464d('0x4b')]['find']({'where':{'id':_0x1c2361[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0xa10802,null))['then'](saveUpdates(_0x1c2361['body'],null))[_0x464d('0x32')](respondWithResult(_0xa10802,null))[_0x464d('0x23')](handleError(_0xa10802,null));};exports['addAvatar']=function(_0x518345,_0x329bb9,_0x577d42){_0x518345[_0x464d('0x53')][_0x464d('0x66')]=_0x518345['file'][_0x464d('0x65')];return db['ChatWebsite'][_0x464d('0x54')]({'where':{'id':_0x518345[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x329bb9,null))['then'](saveUpdates(_0x518345['body'],null))['then'](respondWithResult(_0x329bb9,null))['catch'](handleError(_0x329bb9,null));};exports['addCustomerAvatar']=function(_0x42cd24,_0x23944c,_0x1dcaf7){_0x42cd24[_0x464d('0x53')][_0x464d('0x67')]=_0x42cd24['file'][_0x464d('0x65')];return db['ChatWebsite']['find']({'where':{'id':_0x42cd24[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x23944c,null))['then'](saveUpdates(_0x42cd24['body'],null))[_0x464d('0x32')](respondWithResult(_0x23944c,null))[_0x464d('0x23')](handleError(_0x23944c,null));};exports[_0x464d('0x68')]=function(_0x3aaf48,_0x4466a2,_0x4f01d7){_0x3aaf48[_0x464d('0x53')]['systemAvatar']=_0x3aaf48[_0x464d('0x69')][_0x464d('0x65')];return db[_0x464d('0x4b')]['find']({'where':{'id':_0x3aaf48[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x4466a2,null))[_0x464d('0x32')](saveUpdates(_0x3aaf48[_0x464d('0x53')],null))[_0x464d('0x32')](respondWithResult(_0x4466a2,null))[_0x464d('0x23')](handleError(_0x4466a2,null));};exports[_0x464d('0x6a')]=function(_0x54b022,_0x1b68e1,_0x46e58e){var _0x51f8f6=path[_0x464d('0x6b')](config['root'],'server/files/images/logos/default_logo.png');var _0x21481d={'where':{'id':_0x54b022[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x64')],'raw':!![]};var _0x2f0b3a=![];return require(_0x464d('0x6c'))['getLicense']()[_0x464d('0x32')](function(_0x42209b){if(_0x42209b){_0x2f0b3a=_0x42209b[_0x464d('0x6d')];}})['then'](function(){return db[_0x464d('0x4b')]['find'](_0x21481d);})[_0x464d('0x32')](handleEntityNotFound(_0x1b68e1,null))[_0x464d('0x32')](function(_0x225e80){if(_0x225e80){if(!_[_0x464d('0x6e')](_0x225e80[_0x464d('0x64')])){if(fs[_0x464d('0x6f')](path[_0x464d('0x6b')](config['root'],'server/files/images/logos/',_0x225e80[_0x464d('0x64')]))&&_0x2f0b3a){_0x51f8f6=path[_0x464d('0x6b')](config[_0x464d('0x70')],'server/files/images/logos/',_0x225e80[_0x464d('0x64')]);}}return _0x1b68e1['download'](_0x51f8f6);}})[_0x464d('0x23')](handleError(_0x1b68e1,null));};exports['getAvatar']=function(_0x529c87,_0x586051,_0x5452c1){var _0x2d03f1=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x71'));var _0x51aaa9={'where':{'id':_0x529c87[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x66')],'raw':!![]};return db[_0x464d('0x4b')][_0x464d('0x54')](_0x51aaa9)[_0x464d('0x32')](handleEntityNotFound(_0x586051,null))['then'](function(_0x2c8c64){if(_0x2c8c64){if(!_[_0x464d('0x6e')](_0x2c8c64[_0x464d('0x66')])){if(fs['existsSync'](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x2c8c64[_0x464d('0x66')]))){_0x2d03f1=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x2c8c64[_0x464d('0x66')]);}}return _0x586051['download'](_0x2d03f1);}})['catch'](handleError(_0x586051,null));};exports[_0x464d('0x73')]=function(_0x4f6655,_0x1e9214,_0x522258){var _0x16da6d=path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x74'));var _0x5d9aa2={'where':{'id':_0x4f6655['params']['id']},'attributes':['id','customerAvatar',_0x464d('0x75')],'raw':!![]};return db[_0x464d('0x4b')][_0x464d('0x54')](_0x5d9aa2)['then'](handleEntityNotFound(_0x1e9214,null))['then'](function(_0x125acc){if(_0x125acc){if(!_[_0x464d('0x6e')](_0x125acc[_0x464d('0x67')])){if(fs[_0x464d('0x6f')](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0x72'),_0x125acc[_0x464d('0x67')]))&&_0x125acc[_0x464d('0x75')]){_0x16da6d=path['join'](config['root'],_0x464d('0x72'),_0x125acc[_0x464d('0x67')]);}}return _0x1e9214[_0x464d('0x76')](_0x16da6d);}})[_0x464d('0x23')](handleError(_0x1e9214,null));};exports[_0x464d('0x77')]=function(_0x3a2339,_0x58d41f,_0x528a77){var _0x5902c8=path[_0x464d('0x6b')](config['root'],_0x464d('0x78'));var _0x48b652={'where':{'id':_0x3a2339[_0x464d('0x4e')]['id']},'attributes':['id',_0x464d('0x79')],'raw':!![]};return db['ChatWebsite'][_0x464d('0x54')](_0x48b652)[_0x464d('0x32')](handleEntityNotFound(_0x58d41f,null))[_0x464d('0x32')](function(_0x3b4908){if(_0x3b4908){if(!_[_0x464d('0x6e')](_0x3b4908['systemAvatar'])){if(fs['existsSync'](path[_0x464d('0x6b')](config['root'],_0x464d('0x72'),_0x3b4908['systemAvatar']))){_0x5902c8=path['join'](config[_0x464d('0x70')],_0x464d('0x72'),_0x3b4908['systemAvatar']);}}return _0x58d41f[_0x464d('0x76')](_0x5902c8);}})[_0x464d('0x23')](handleError(_0x58d41f,null));};exports[_0x464d('0x7a')]=function(_0x457ed2,_0x2fdd15,_0x6ca128){var _0x5e0965=require(_0x464d('0x7b'));var _0x1e6bc5=new _0x5e0965();var _0x51da8a=_0x1e6bc5[_0x464d('0x7c')](_0x457ed2['headers'][_0x464d('0x7d')])[_0x464d('0x7e')]();var _0x23e119={'body':_0x457ed2['body'],'channel':_0x464d('0x7f')};var _0x530857=[];var _0x2b902d=[];var _0x3a131d={};var _0x12ad0a=![];return db[_0x464d('0x80')]['describe']()['then'](function(_0x4b7450){if(!_0x4b7450){throw new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0x83'));}_0x530857=_[_0x464d('0x84')](_[_0x464d('0x38')](_0x4b7450),[_0x464d('0x85'),_0x464d('0x86')]);_0x2b902d=_[_0x464d('0x84')](_['keys'](_0x4b7450),[_0x464d('0x85'),_0x464d('0x86'),_0x464d('0x87'),_0x464d('0x88')]);if(_0x457ed2[_0x464d('0x53')]['id']){delete _0x457ed2[_0x464d('0x53')]['id'];}if(_[_0x464d('0x6e')](_0x457ed2[_0x464d('0x53')][_0x464d('0x89')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x457ed2[_0x464d('0x53')][_0x464d('0x53')])||_0x457ed2[_0x464d('0x53')][_0x464d('0x53')]===''){throw new db['Sequelize'][(_0x464d('0x82'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x464d('0x6e')](_0x457ed2[_0x464d('0x53')][_0x464d('0x8a')])){throw new db['Sequelize'][(_0x464d('0x82'))](_0x464d('0x8b')+_0x2b902d);}if(!_[_0x464d('0x8c')](_0x2b902d,_0x457ed2['body'][_0x464d('0x8a')])){throw new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0x8d')+_0x2b902d);}_0x3a131d[_0x457ed2[_0x464d('0x53')][_0x464d('0x8a')]]=_0x457ed2[_0x464d('0x53')][_0x464d('0x89')];})['then'](function(){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x457ed2[_0x464d('0x4e')]['id']},'include':[{'model':db['CmList'],'as':_0x464d('0x8e'),'include':[{'model':db[_0x464d('0x80')],'as':_0x464d('0x8f'),'where':_0x3a131d,'limit':0x1,'order':[[_0x464d('0x86'),_0x464d('0x90')]]}]},{'model':db[_0x464d('0x91')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0x2fdd15,null))[_0x464d('0x32')](function(_0x58d5bd){if(_0x58d5bd&&_0x58d5bd[_0x464d('0x8e')]){_0x23e119[_0x464d('0x92')]=_0x58d5bd;_0x23e119['applications']=_0x58d5bd[_0x464d('0x93')];_0x23e119[_0x464d('0x94')]=_0x58d5bd['List'];_0x23e119[_0x464d('0x95')]=_[_0x464d('0x96')](_0x23e119[_0x464d('0x95')],[_0x464d('0x97')],[_0x464d('0x98')]);if(_0x23e119[_0x464d('0x92')][_0x464d('0x93')]){delete _0x23e119[_0x464d('0x92')][_0x464d('0x93')];}if(_0x23e119['account'][_0x464d('0x8e')]&&_0x23e119['account']['List'][_0x464d('0x8f')][_0x464d('0x50')]){return _0x23e119[_0x464d('0x92')][_0x464d('0x8e')][_0x464d('0x8f')][0x0];}var _0x477b60=_[_0x464d('0x99')](_0x457ed2[_0x464d('0x53')],{'firstName':_0x457ed2[_0x464d('0x53')][_0x464d('0x89')],'ListId':_0x58d5bd[_0x464d('0x88')]});_0x477b60[_0x457ed2['body'][_0x464d('0x8a')]]=_0x457ed2[_0x464d('0x53')][_0x464d('0x89')];return db[_0x464d('0x80')][_0x464d('0x52')](_0x477b60,{'fields':_0x530857,'raw':!![]});}})[_0x464d('0x32')](handleEntityNotFound(_0x2fdd15,null))[_0x464d('0x32')](function(_0x2be127){_0x23e119[_0x464d('0x9a')]=_0x2be127;if(_0x2be127){var _0x34b16b={'ContactId':_0x2be127['id'],'ChatWebsiteId':_0x457ed2[_0x464d('0x4e')]['id'],'from':(_0x2be127[_0x464d('0x9b')]||'')+'\x20'+(_0x2be127['lastName']||''),'customerIp':_0x457ed2['body']['customerIp'],'referer':_0x457ed2['body'][_0x464d('0x9c')],'browserName':_0x51da8a['browser'][_0x464d('0x34')]&&_0x51da8a['browser'][_0x464d('0x9d')]?util[_0x464d('0x9e')](_0x464d('0x9f'),_0x51da8a['browser']['name'],_0x51da8a['browser'][_0x464d('0x9d')]):_0x464d('0xa0'),'browserVersion':_0x51da8a['browser'][_0x464d('0x9d')]||_0x464d('0xa0'),'osName':util[_0x464d('0x9e')](_0x464d('0x9f'),_0x51da8a['os'][_0x464d('0x34')],_0x51da8a['os'][_0x464d('0x9d')]),'osVersion':_0x51da8a['os'][_0x464d('0x9d')],'deviceModel':_0x51da8a[_0x464d('0xa1')][_0x464d('0x37')]&&_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')]?util[_0x464d('0x9e')](_0x464d('0xa3'),_0x51da8a[_0x464d('0xa1')]['model'],_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')],_0x51da8a['device'][_0x464d('0xa4')]):null,'deviceVendor':_0x51da8a[_0x464d('0xa1')][_0x464d('0xa2')],'deviceType':_0x51da8a['device']['type'],'formData':JSON[_0x464d('0x1e')](_0x457ed2[_0x464d('0x53')])};var _0xb5ee02={'ChatWebsiteId':_0x457ed2[_0x464d('0x4e')]['id'],'closed':![]};if(_0x457ed2[_0x464d('0x53')][_0x464d('0xa5')]){_0xb5ee02[_0x464d('0xa5')]=_0x457ed2[_0x464d('0x53')]['threadId'];return db['ChatInteraction'][_0x464d('0x54')]({'where':_0xb5ee02})[_0x464d('0x32')](function(_0x329b65){if(_0x329b65){return[_0x329b65,![]];}_0x34b16b[_0x464d('0xa5')]=_0x457ed2[_0x464d('0x53')]['threadId'];_0x34b16b[_0x464d('0xa6')]=_0x457ed2['body'][_0x464d('0xa6')];return db['ChatInteraction'][_0x464d('0x52')](_0x34b16b)[_0x464d('0x32')](function(_0x1cd412){return[_0x1cd412,!![]];});});}_0xb5ee02[_0x464d('0xa7')]=_0x2be127['id'];if(_0x457ed2[_0x464d('0x53')][_0x464d('0xa8')]&&_0x457ed2['body'][_0x464d('0xa8')]['id']){_0xb5ee02['id']=_0x457ed2['body'][_0x464d('0xa8')]['id'];return db[_0x464d('0xa9')][_0x464d('0x54')]({'where':_0xb5ee02})[_0x464d('0x32')](function(_0x252ddb){if(_0x252ddb){return[_0x252ddb,![]];}return db[_0x464d('0xa9')][_0x464d('0x52')](_0x34b16b)[_0x464d('0x32')](function(_0x46867b){return[_0x46867b,!![]];});});}return db['ChatInteraction']['create'](_0x34b16b)[_0x464d('0x32')](function(_0x44f426){return[_0x44f426,!![]];});}})['spread'](function(_0x4bea7e,_0x4e4bfd){if(_0x4bea7e){_0x12ad0a=_0x4e4bfd;if(!_0x4e4bfd){return _0x4bea7e['update']({'from':(_0x23e119[_0x464d('0x9a')][_0x464d('0x9b')]||'')+'\x20'+(_0x23e119[_0x464d('0x9a')][_0x464d('0xaa')]||'')});}else{return _0x4bea7e;}}})['then'](function(_0x3a435f){_0x23e119[_0x464d('0xa8')]=_0x3a435f[_0x464d('0xab')]({'plain':!![]});_0x23e119[_0x464d('0xa8')][_0x464d('0xac')]=_0x12ad0a;if(_0x23e119['interaction']['created']){if(_0x23e119['account'][_0x464d('0xad')]){_0x23e119[_0x464d('0x95')][_0x464d('0xae')]({'id':0x0,'priority':_0x23e119[_0x464d('0x95')]['length']+0x1,'app':_0x464d('0xaf'),'appdata':_0x464d('0xb0'),'interval':_0x464d('0xb1')});}}return db[_0x464d('0xb2')]['create']({'body':_0x457ed2[_0x464d('0x53')]['body'],'ChatWebsiteId':_0x457ed2['params']['id'],'ChatInteractionId':_0x3a435f['id'],'direction':'in','ContactId':_0x23e119[_0x464d('0x9a')]['id'],'AttachmentId':_0x457ed2[_0x464d('0x53')][_0x464d('0xb3')]});})[_0x464d('0x32')](function(_0x416314){_0x23e119[_0x464d('0x21')]=_0x416314;if(_0x23e119[_0x464d('0xa8')][_0x464d('0xb4')]){return db[_0x464d('0xb5')]['find']({'attributes':['id',_0x464d('0x34')],'where':{'id':_0x23e119[_0x464d('0xa8')][_0x464d('0xb4')]}})[_0x464d('0x32')](function(_0x4ac56c){if(_0x4ac56c){_0x23e119[_0x464d('0x95')][_0x464d('0xb6')]({'id':0x0,'priority':0x0,'app':_0x464d('0xb7'),'appdata':_0x4ac56c[_0x464d('0x34')]+','+(_0x23e119[_0x464d('0x92')][_0x464d('0xb8')]||0xa),'interval':_0x464d('0xb1')});_0x23e119[_0x464d('0xb9')]=!![];}return respondWithRpcPromise('Start','startRouting',_0x23e119);});}return respondWithRpcPromise('Start','startRouting',_0x23e119);})[_0x464d('0x32')](function(_0x597282){respondWithRpcPromise('EventManager',_0x464d('0xba'),{'event':'notify','message':_0x597282},client9002);return _0x597282;})[_0x464d('0x32')](respondWithResult(_0x2fdd15,null))[_0x464d('0x23')](handleError(_0x2fdd15,null));};exports[_0x464d('0xbb')]=function(_0xb5a3b1,_0x3fd996,_0xbb8bf2){var _0x379d86,_0x2fdaf9,_0x2b9518;var _0x121122=[];var _0x5b1b30=[];var _0x2e1968={};return db[_0x464d('0x80')][_0x464d('0x55')]()[_0x464d('0x32')](function(_0x53a3b9){if(!_0x53a3b9){throw new db[(_0x464d('0x81'))]['ValidationError'](_0x464d('0x83'));}_0x5b1b30=_[_0x464d('0x84')](_[_0x464d('0x38')](_0x53a3b9),[_0x464d('0x85'),'updatedAt']);_0x121122=_['difference'](_[_0x464d('0x38')](_0x53a3b9),[_0x464d('0x85'),_0x464d('0x86'),_0x464d('0x87'),_0x464d('0x88')]);if(_0xb5a3b1[_0x464d('0x53')]['id']){delete _0xb5a3b1['body']['id'];}if(_['isNil'](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')])){throw _0x3fd996[_0x464d('0x26')](0x1f4)[_0x464d('0x35')](new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0xbc')));}if(_['isNil'](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x53')])||_0xb5a3b1['body'][_0x464d('0x53')]===''){throw _0x3fd996['status'](0x1f4)['send'](new db[(_0x464d('0x81'))][(_0x464d('0x82'))](_0x464d('0xbd')));}if(_[_0x464d('0x6e')](_0xb5a3b1[_0x464d('0x53')]['mapKeyOffline'])){throw _0x3fd996['status'](0x1f4)[_0x464d('0x35')](new db['Sequelize'][(_0x464d('0x82'))](_0x464d('0xbe')+_0x121122));}if(!_[_0x464d('0x8c')](_0x121122,_0xb5a3b1['body'][_0x464d('0xbf')])){throw _0x3fd996[_0x464d('0x26')](0x1f4)[_0x464d('0x35')](new db[(_0x464d('0x81'))]['ValidationError'](_0x464d('0xc0')+_0x121122));}_0x2e1968[_0xb5a3b1[_0x464d('0x53')]['mapKeyOffline']]=_0xb5a3b1[_0x464d('0x53')]['from'];})['then'](function(){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0xb5a3b1['params']['id']},'include':[{'model':db['CmList'],'as':_0x464d('0x8e')}]});})[_0x464d('0x32')](handleEntityNotFound(_0x3fd996,null))[_0x464d('0x32')](function(_0xdf91e){if(_0xdf91e&&_0xdf91e[_0x464d('0x8e')]){_0x2fdaf9=_0xdf91e;var _0x378e31=_[_0x464d('0x99')](_0xb5a3b1[_0x464d('0x53')],{'firstName':_0xb5a3b1['body']['from'],'phone':_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')],'ListId':_0xdf91e['ListId']});_0x378e31[_0xb5a3b1[_0x464d('0x53')][_0x464d('0xbf')]]=_0xb5a3b1[_0x464d('0x53')][_0x464d('0x89')];return db[_0x464d('0x80')][_0x464d('0xc1')]({'where':_0x2e1968,'defaults':_0x378e31});}})[_0x464d('0xc2')](function(_0x4fe286){if(_0x4fe286){_0x2b9518=_0x4fe286;var _0xc8eaa0=fs['readFileSync'](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0xc3')),_0x464d('0xc4'));var _0x5a59d5=ejs[_0x464d('0xc5')](_0xc8eaa0,{'body':_[_0x464d('0xc6')](_0xb5a3b1[_0x464d('0x53')][_0x464d('0x53')]),'bodyTitle':_0x2fdaf9[_0x464d('0xc7')]});return db[_0x464d('0xc8')]['create']({'body':_0x5a59d5,'ContactId':_0x4fe286['id'],'ChatWebsiteId':_0x2fdaf9['id']});}})['then'](function(_0x16b619){if(_0x16b619){_0x379d86=_0x16b619;return db['MailAccount'][_0x464d('0x58')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x464d('0xc9'),'raw':!![]}]});}})[_0x464d('0x32')](function(_0x1d2e7c){if(_0x1d2e7c&&_0x1d2e7c['Smtp']&&_0x2fdaf9[_0x464d('0xca')]){var _0x46adba={'tls':{'rejectUnauthorized':![]}};if(_0x1d2e7c['Smtp'][_0x464d('0xcb')]){_0x46adba[_0x464d('0xcb')]=_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xcb')];}else{_0x46adba[_0x464d('0xcc')]=_0x1d2e7c[_0x464d('0xc9')]['host'];_0x46adba[_0x464d('0xcd')]=_0x1d2e7c[_0x464d('0xc9')]['port'];_0x46adba[_0x464d('0xce')]=_0x1d2e7c['Smtp'][_0x464d('0xce')];}if(_0x1d2e7c['Smtp'][_0x464d('0xcf')]){_0x46adba[_0x464d('0xd0')]={'user':_0x1d2e7c['Smtp'][_0x464d('0xd1')],'pass':_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xd2')]};}return respondWithRpcPromise(_0x464d('0xd3'),_0x464d('0xd4'),{'account':_0x46adba,'message':{'from':util['format'](_0x464d('0xd5'),_0x1d2e7c['name'],_0x1d2e7c[_0x464d('0xd6')]||_0x1d2e7c[_0x464d('0xc9')][_0x464d('0xd1')]),'to':_0x2fdaf9[_0x464d('0xca')],'subject':_0x2fdaf9[_0x464d('0xd7')],'text':_0x379d86[_0x464d('0x53')]}},client9003)[_0x464d('0x32')](function(){return _0x379d86;})[_0x464d('0x23')](function(_0x449258){console[_0x464d('0x1f')](_0x449258);});}})['then'](function(){if(_0x379d86){return _0x379d86;}})[_0x464d('0x32')](respondWithResult(_0x3fd996,null))[_0x464d('0x23')](handleError(_0x3fd996,null));};exports[_0x464d('0xd8')]=function(_0x57540a,_0xf02382,_0x245508){return db[_0x464d('0xa9')][_0x464d('0x54')]({'where':{'id':_0x57540a[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xf02382,null))[_0x464d('0x32')](function(_0x5942db){if(_0x5942db){return _0x5942db[_0x464d('0xd8')](_0x57540a[_0x464d('0x53')]['ids'],_[_0x464d('0xd9')](_0x57540a[_0x464d('0x53')],['ids','id'])||{});}})[_0x464d('0x32')](respondWithResult(_0xf02382,null))[_0x464d('0x23')](handleError(_0xf02382,null));};exports[_0x464d('0xda')]=function(_0x127553,_0x354205,_0x4ca9f6){var _0x4ef5ed={'raw':![],'where':{}};var _0x2d62d2={};var _0x325802={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x127553[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x354205,null))[_0x464d('0x32')](function(_0x30bf5f){if(_0x30bf5f){_0x2d62d2[_0x464d('0x37')]=_['keys'](db['ChatInteraction']['rawAttributes']);_0x2d62d2[_0x464d('0x39')]=_['keys'](_0x127553['query']);_0x2d62d2[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x2d62d2[_0x464d('0x37')],_0x2d62d2[_0x464d('0x39')]);_0x4ef5ed['attributes']=_[_0x464d('0x3c')](_0x2d62d2['model'],qs[_0x464d('0x3e')](_0x127553[_0x464d('0x39')][_0x464d('0x3e')]));_0x4ef5ed[_0x464d('0x3d')]=_0x4ef5ed[_0x464d('0x3d')][_0x464d('0x50')]?_0x4ef5ed[_0x464d('0x3d')]:_0x2d62d2['model'];if(!_0x127553[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x4ef5ed[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x127553[_0x464d('0x39')][_0x464d('0x2a')]);_0x4ef5ed['offset']=qs['offset'](_0x127553['query'][_0x464d('0x29')]);}_0x4ef5ed[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x127553[_0x464d('0x39')]['sort']);_0x4ef5ed[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x127553[_0x464d('0x39')],_0x2d62d2[_0x464d('0x42')]));_0x4ef5ed[_0x464d('0x47')][_0x464d('0x56')]=_0x30bf5f['id'];if(_0x127553[_0x464d('0x39')]['filter']){_0x4ef5ed['where']=_[_0x464d('0x46')](_0x4ef5ed[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x4ef5ed[_0x464d('0x3d')],function(_0x4d8ee5){var _0x172109={};_0x172109[_0x4d8ee5]={'$like':'%'+_0x127553[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x172109;})});}_0x4ef5ed=_[_0x464d('0x46')]({},_0x4ef5ed,_0x127553['options']);return db[_0x464d('0xa9')][_0x464d('0x28')]({'where':_0x4ef5ed[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x3f81cc){_0x325802[_0x464d('0x28')]=_0x3f81cc;if(_0x127553['query'][_0x464d('0x51')]){_0x4ef5ed[_0x464d('0x5b')]=[{'model':db[_0x464d('0x80')],'as':_0x464d('0xdb'),'required':![]},{'model':db['User'],'as':_0x464d('0xdc'),'attributes':[_0x464d('0x34'),'fullname',_0x464d('0xdd')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x464d('0xde')],'where':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]?{'id':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]}:undefined,'required':_0x127553[_0x464d('0x39')][_0x464d('0xdf')]?!![]:![]}];}return db[_0x464d('0xa9')][_0x464d('0x5c')](_0x4ef5ed);})['then'](function(_0x2087cd){_0x325802[_0x464d('0x4c')]=_0x2087cd;return _0x325802;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x354205,_0x4ef5ed))[_0x464d('0x23')](handleError(_0x354205,null));};function iftimePromise(_0x5d07e8,_0x54f646){return respondWithRpcPromise('Command',_0x464d('0xe0'),{'command':_0x54f646[_0x464d('0xe1')]?util['format'](_0x464d('0xe2'),_0x5d07e8[_0x464d('0xe3')],_0x54f646[_0x464d('0xe1')]):util[_0x464d('0x9e')](_0x464d('0xe4'),_0x5d07e8[_0x464d('0xe3')])},client9002)[_0x464d('0x32')](function(_0x2adfcd){var _0x20a79f=_0x2adfcd&&_0x2adfcd[_0x464d('0xe5')](_0x464d('0xe6'))>=0x0?!![]:![];logger[_0x464d('0x1a')](_0x464d('0xe7'),_0x54f646['id'],_0x5d07e8['id'],_0x5d07e8[_0x464d('0xe3')],_0x20a79f?_0x464d('0xe8'):_0x464d('0xe9'),_0x54f646['timezone']?_0x54f646[_0x464d('0xe1')]:'No\x20timezone');return _0x20a79f;})[_0x464d('0x23')](function(_0xaa1f88){logger['error'](_0x464d('0xe7'),_0x54f646['id'],_0x5d07e8['id'],_0x5d07e8[_0x464d('0xe3')],util[_0x464d('0xea')](_0xaa1f88,{'showHidden':![],'depth':null}),_0x54f646['timezone']?_0x54f646[_0x464d('0xe1')]:_0x464d('0xeb'));return![];});}exports['getSnippet']=function(_0x2beb12,_0x21741f,_0x62bd2c){var _0x1acc4c=0x0;var _0x4609f3=0x0;var _0x55e91e=![];var _0x3221ae;var _0x4cad5e;return db['ChatWebsite'][_0x464d('0x54')]({'where':{'id':_0x2beb12[_0x464d('0x4e')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0x464d('0xec')],'as':_0x464d('0xed'),'attributes':['id',_0x464d('0xe3')],'raw':!![]}]}]})[_0x464d('0x32')](handleEntityNotFound(_0x21741f,null))['then'](function(_0x4d08d7){if(_0x4d08d7){_0x3221ae=_0x4d08d7;return _0x4d08d7[_0x464d('0xee')]({'raw':!![]});}})[_0x464d('0x32')](function(_0xb83225){if(_0x3221ae){if(_0xb83225){_0x4cad5e=_0xb83225;}}return require(_0x464d('0x6c'))[_0x464d('0xef')]();})[_0x464d('0x32')](function(_0x22cc47){if(_0x22cc47){_0x4609f3=_0x22cc47['virtual'];_0x55e91e=_0x22cc47[_0x464d('0x6d')];}})[_0x464d('0x32')](function(){return db['ChatInteraction'][_0x464d('0x28')]({'where':{'closed':![]}});})[_0x464d('0x32')](function(_0x3e4b2f){_0x1acc4c=_0x3e4b2f;if(_0x4609f3&&_0x3e4b2f>_0x4609f3){return db[_0x464d('0xf0')][_0x464d('0x58')]({'where':{'id':0x1}})[_0x464d('0x32')](function(_0x2c157c){if(_0x2c157c){_0x2c157c[_0x464d('0xf1')](_0x464d('0xf2'));}});}})[_0x464d('0x32')](function(){if(_0x3221ae[_0x464d('0xec')]&&_0x3221ae[_0x464d('0xec')][_0x464d('0xed')]){var _0x5f09d5=[];for(var _0x419c94=0x0;_0x419c94<_0x3221ae['Interval'][_0x464d('0xed')][_0x464d('0x50')];_0x419c94++){var _0x4923b1=_0x3221ae[_0x464d('0xec')][_0x464d('0xed')][_0x419c94][_0x464d('0xab')]({'plain':!![]});_0x5f09d5[_0x464d('0xae')](iftimePromise(_0x4923b1,_0x3221ae));}return BPromise[_0x464d('0xf3')](_0x5f09d5)[_0x464d('0x32')](function(_0x3b125a){return _['some'](_0x3b125a);});}else{return!![];}})[_0x464d('0x32')](function(_0x348530){var _0x41dbea=fs[_0x464d('0xf4')](path[_0x464d('0x6b')](config[_0x464d('0x70')],_0x464d('0xf5')),_0x464d('0xc4'));var _0x53dbc1={'remote':_0x3221ae['remote'],'query':querystring['stringify'](_[_0x464d('0x46')](_0x3221ae['get']({'plain':!![]}),{'customerIp':_0x2beb12[_0x464d('0xf6')][_0x464d('0xf7')]||_0x2beb12['headers'][_0x464d('0xf8')]||_0x2beb12['connection'][_0x464d('0xf9')]||_0x2beb12['ip'],'referer':_0x2beb12[_0x464d('0xf6')]['referer'],'openedInteractions':_0x1acc4c,'maxInteractions':_0x4609f3,'virtual':_0x55e91e[_0x464d('0xfa')],'online':_0x348530,'custom':_0x55e91e}))[_0x464d('0xfb')](/'/g,'\x5c\x27')};_0x21741f[_0x464d('0x35')](ejs[_0x464d('0xc5')](Mustache[_0x464d('0xc5')](_0x41dbea,_0x53dbc1),{'proactiveActions':_0x4cad5e,'alignment':_0x3221ae[_0x464d('0xfc')],'verticalAlignment':_0x3221ae[_0x464d('0xfd')]}));})[_0x464d('0x23')](handleError(_0x21741f,null));};exports[_0x464d('0xfe')]=function(_0x327967,_0x3146db,_0x52871c){return db['ChatWebsite']['findOne']({'where':{'id':_0x327967[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x3146db,null))[_0x464d('0x32')](function(_0x3e6b7b){if(_0x3e6b7b){return db['sequelize'][_0x464d('0xff')](function(_0x224661){return db[_0x464d('0x91')][_0x464d('0x31')]({'where':{'ChatWebsiteId':_0x327967['params']['id']},'transaction':_0x224661})[_0x464d('0x32')](function(_0x26f883){var _0x768c03=_[_0x464d('0x49')](_0x327967[_0x464d('0x53')],function(_0x2d3717){_0x2d3717['ChatWebsiteId']=_0x327967[_0x464d('0x4e')]['id'];return _0x2d3717;});return db[_0x464d('0x91')][_0x464d('0x100')](_0x768c03,{'transaction':_0x224661});});})[_0x464d('0x32')](function(){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x327967[_0x464d('0x4e')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3146db,null))[_0x464d('0x23')](handleError(_0x3146db,null));};exports[_0x464d('0x101')]=function(_0x488836,_0x2d769f,_0x13a0f3){var _0x49900c={};var _0x158b45={};var _0x1d0332;var _0x283e1e;return db['ChatWebsite']['findOne']({'where':{'id':_0x488836['params']['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x2d769f,null))['then'](function(_0x2b752){if(_0x2b752){_0x1d0332=_0x2b752;_0x158b45[_0x464d('0x37')]=_[_0x464d('0x38')](db[_0x464d('0x91')][_0x464d('0x4f')]);_0x158b45[_0x464d('0x39')]=_[_0x464d('0x38')](_0x488836[_0x464d('0x39')]);_0x158b45[_0x464d('0x42')]=_['intersection'](_0x158b45[_0x464d('0x37')],_0x158b45[_0x464d('0x39')]);_0x49900c[_0x464d('0x3d')]=_['intersection'](_0x158b45['model'],qs['fields'](_0x488836[_0x464d('0x39')]['fields']));_0x49900c[_0x464d('0x3d')]=_0x49900c['attributes'][_0x464d('0x50')]?_0x49900c[_0x464d('0x3d')]:_0x158b45[_0x464d('0x37')];_0x49900c[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x488836[_0x464d('0x39')]['sort']);_0x49900c[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x488836[_0x464d('0x39')],_0x158b45[_0x464d('0x42')]));if(_0x488836['query'][_0x464d('0x48')]){_0x49900c[_0x464d('0x47')]=_['merge'](_0x49900c[_0x464d('0x47')],{'$or':_['map'](_0x49900c[_0x464d('0x3d')],function(_0x5f5a19){var _0x56c5bc={};_0x56c5bc[_0x5f5a19]={'$like':'%'+_0x488836['query']['filter']+'%'};return _0x56c5bc;})});}_0x49900c=_[_0x464d('0x46')]({},_0x49900c,_0x488836[_0x464d('0x4a')]);return _0x1d0332[_0x464d('0x101')](_0x49900c);}})[_0x464d('0x32')](function(_0x49cd3c){if(_0x49cd3c){_0x283e1e=_0x49cd3c[_0x464d('0x50')];if(!_0x488836[_0x464d('0x39')]['hasOwnProperty']('nolimit')){_0x49900c[_0x464d('0x2a')]=qs['limit'](_0x488836[_0x464d('0x39')][_0x464d('0x2a')]);_0x49900c[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x488836['query'][_0x464d('0x29')]);}return _0x1d0332[_0x464d('0x101')](_0x49900c);}})['then'](function(_0x37ef04){if(_0x37ef04){return _0x37ef04?{'count':_0x283e1e,'rows':_0x37ef04}:null;}})[_0x464d('0x32')](respondWithResult(_0x2d769f,null))[_0x464d('0x23')](handleError(_0x2d769f,null));};exports[_0x464d('0x102')]=function(_0x33e184,_0x31b455,_0xfd2e98){return db['chatProactiveAction'][_0x464d('0x54')]({'where':{'id':_0x33e184[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x31b455,null))[_0x464d('0x32')](function(_0x2e16b6){if(_0x2e16b6){return _0x2e16b6[_0x464d('0x102')](_0x33e184['body'][_0x464d('0x5e')],_[_0x464d('0xd9')](_0x33e184[_0x464d('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x31b455,null))[_0x464d('0x23')](handleError(_0x31b455,null));};exports[_0x464d('0xee')]=function(_0x23e762,_0x10ea23,_0x46ef3c){var _0x4a57f8={};var _0x1aec44={};var _0x171973;var _0x29411e;return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x23e762[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x10ea23,null))[_0x464d('0x32')](function(_0x3334b9){if(_0x3334b9){_0x171973=_0x3334b9;_0x1aec44[_0x464d('0x37')]=_[_0x464d('0x38')](db[_0x464d('0x103')][_0x464d('0x4f')]);_0x1aec44[_0x464d('0x39')]=_['keys'](_0x23e762[_0x464d('0x39')]);_0x1aec44['filters']=_[_0x464d('0x3c')](_0x1aec44['model'],_0x1aec44[_0x464d('0x39')]);_0x4a57f8[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x1aec44['model'],qs[_0x464d('0x3e')](_0x23e762[_0x464d('0x39')][_0x464d('0x3e')]));_0x4a57f8[_0x464d('0x3d')]=_0x4a57f8[_0x464d('0x3d')]['length']?_0x4a57f8[_0x464d('0x3d')]:_0x1aec44[_0x464d('0x37')];_0x4a57f8[_0x464d('0x5a')]=qs['sort'](_0x23e762[_0x464d('0x39')][_0x464d('0x41')]);_0x4a57f8[_0x464d('0x47')]=qs['filters'](_[_0x464d('0x43')](_0x23e762[_0x464d('0x39')],_0x1aec44[_0x464d('0x42')]));if(_0x23e762[_0x464d('0x39')][_0x464d('0x48')]){_0x4a57f8[_0x464d('0x47')]=_['merge'](_0x4a57f8[_0x464d('0x47')],{'$or':_[_0x464d('0x49')](_0x4a57f8[_0x464d('0x3d')],function(_0xc39206){var _0xdfee41={};_0xdfee41[_0xc39206]={'$like':'%'+_0x23e762['query'][_0x464d('0x48')]+'%'};return _0xdfee41;})});}_0x4a57f8=_['merge']({},_0x4a57f8,_0x23e762[_0x464d('0x4a')]);return _0x171973[_0x464d('0xee')](_0x4a57f8);}})[_0x464d('0x32')](function(_0x48d3c7){if(_0x48d3c7){_0x29411e=_0x48d3c7['length'];if(!_0x23e762[_0x464d('0x39')]['hasOwnProperty'](_0x464d('0x40'))){_0x4a57f8[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x23e762[_0x464d('0x39')][_0x464d('0x2a')]);_0x4a57f8['offset']=qs['offset'](_0x23e762[_0x464d('0x39')]['offset']);}return _0x171973['getProactiveActions'](_0x4a57f8);}})['then'](function(_0x5cdd8b){if(_0x5cdd8b){return _0x5cdd8b?{'count':_0x29411e,'rows':_0x5cdd8b}:null;}})['then'](respondWithResult(_0x10ea23,null))[_0x464d('0x23')](handleError(_0x10ea23,null));};exports[_0x464d('0x104')]=function(_0x441c58,_0x51109b,_0x2f7ee1){var _0x18a235=_0x441c58[_0x464d('0x39')][_0x464d('0x105')]===_0x464d('0x106')?'offlineForm':_0x464d('0x107');return db['ChatWebsite'][_0x464d('0x54')]({'attributes':['id',_0x18a235],'where':{'id':_0x441c58['params']['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x51109b,null))['then'](function(_0x18623e){if(_0x18623e){var _0x506e81=_0x18623e[_0x18a235];var _0x4d3922=_0x506e81&&_0x506e81['items']?_0x506e81['items']:[];_0x51109b[_0x464d('0x35')]({'fromKey':_[_0x464d('0x6e')](_0x506e81[_0x464d('0x108')])?undefined:_0x506e81[_0x464d('0x108')],'count':_0x4d3922['length'],'rows':_0x4d3922});}})['catch'](handleError(_0x51109b,null));};exports[_0x464d('0x109')]=function(_0x170555,_0x10d2f0,_0x50651a){var _0xdbc286={'raw':!![],'where':{}};var _0x26f912={};var _0xee33f1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x464d('0x58')]({'where':{'id':_0x170555[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x10d2f0,null))[_0x464d('0x32')](function(_0x525a3b){if(_0x525a3b){_0x26f912['model']=_[_0x464d('0x38')](db[_0x464d('0xc8')]['rawAttributes']);_0x26f912[_0x464d('0x39')]=_['keys'](_0x170555[_0x464d('0x39')]);_0x26f912[_0x464d('0x42')]=_[_0x464d('0x3c')](_0x26f912[_0x464d('0x37')],_0x26f912[_0x464d('0x39')]);_0xdbc286['attributes']=_[_0x464d('0x3c')](_0x26f912[_0x464d('0x37')],qs['fields'](_0x170555[_0x464d('0x39')][_0x464d('0x3e')]));_0xdbc286[_0x464d('0x3d')]=_0xdbc286[_0x464d('0x3d')]['length']?_0xdbc286[_0x464d('0x3d')]:_0x26f912[_0x464d('0x37')];if(!_0x170555['query']['hasOwnProperty'](_0x464d('0x40'))){_0xdbc286[_0x464d('0x2a')]=qs[_0x464d('0x2a')](_0x170555[_0x464d('0x39')]['limit']);_0xdbc286['offset']=qs[_0x464d('0x29')](_0x170555[_0x464d('0x39')]['offset']);}_0xdbc286[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x170555[_0x464d('0x39')][_0x464d('0x41')]);_0xdbc286[_0x464d('0x47')]=qs[_0x464d('0x42')](_[_0x464d('0x43')](_0x170555[_0x464d('0x39')],_0x26f912['filters']));_0xdbc286[_0x464d('0x47')]['ChatWebsiteId']=_0x525a3b['id'];if(_0x170555['query'][_0x464d('0x48')]){_0xdbc286[_0x464d('0x47')]=_['merge'](_0xdbc286['where'],{'$or':_[_0x464d('0x49')](_0xdbc286[_0x464d('0x3d')],function(_0x20ddce){var _0x5b7eec={};_0x5b7eec[_0x20ddce]={'$like':'%'+_0x170555[_0x464d('0x39')][_0x464d('0x48')]+'%'};return _0x5b7eec;})});}_0xdbc286=_[_0x464d('0x46')]({},_0xdbc286,_0x170555['options']);return db[_0x464d('0xc8')][_0x464d('0x28')]({'where':_0xdbc286[_0x464d('0x47')]})[_0x464d('0x32')](function(_0x266bb4){_0xee33f1[_0x464d('0x28')]=_0x266bb4;if(_0x170555[_0x464d('0x39')][_0x464d('0x51')]){_0xdbc286[_0x464d('0x5b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x464d('0x5c')](_0xdbc286);})[_0x464d('0x32')](function(_0x895b83){_0xee33f1[_0x464d('0x4c')]=_0x895b83;return _0xee33f1;});}})[_0x464d('0x32')](respondWithFilteredResult(_0x10d2f0,_0xdbc286))[_0x464d('0x23')](handleError(_0x10d2f0,null));};exports[_0x464d('0x10a')]=function(_0x32144d,_0x47f121,_0x394489){return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x32144d[_0x464d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x47f121,null))[_0x464d('0x32')](function(_0x5582ff){if(_0x5582ff){return _0x5582ff[_0x464d('0x10a')](_0x32144d[_0x464d('0x53')][_0x464d('0x5e')],_[_0x464d('0xd9')](_0x32144d[_0x464d('0x53')],[_0x464d('0x5e'),'id'])||{})[_0x464d('0xc2')](function(_0x3c4307){for(var _0x4d46c2=0x0;_0x4d46c2<_0x32144d[_0x464d('0x53')]['ids']['length'];_0x4d46c2+=0x1){socket['emit']('userChatWebsite:save',{'UserId':_0x32144d[_0x464d('0x53')][_0x464d('0x5e')][_0x4d46c2],'ChatWebsiteId':_0x32144d[_0x464d('0x4e')]['id']});}return _0x3c4307;});}})[_0x464d('0x32')](respondWithResult(_0x47f121,null))['catch'](handleError(_0x47f121,null));};exports[_0x464d('0x10b')]=function(_0x228a09,_0x5b5344,_0x51fc7f){var _0x57cdc9;return db[_0x464d('0x4b')][_0x464d('0x54')]({'where':{'id':_0x228a09[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x5b5344,null))[_0x464d('0x32')](function(_0x126e8c){if(_0x126e8c){return _0x126e8c[_0x464d('0x10b')](_0x228a09[_0x464d('0x39')][_0x464d('0x5e')])[_0x464d('0x32')](function(_0x2b20fa){if(_['isArray'](_0x228a09[_0x464d('0x39')]['ids'])){for(var _0x988357=0x0;_0x988357<_0x228a09[_0x464d('0x39')][_0x464d('0x5e')][_0x464d('0x50')];_0x988357+=0x1){socket[_0x464d('0x10c')](_0x464d('0x10d'),{'UserId':_0x228a09[_0x464d('0x39')][_0x464d('0x5e')][_0x988357],'ChatWebsiteId':_0x228a09[_0x464d('0x4e')]['id']});}}else{socket[_0x464d('0x10c')]('userChatWebsite:remove',{'UserId':_0x228a09['query'][_0x464d('0x5e')],'ChatWebsiteId':_0x228a09[_0x464d('0x4e')]['id']});}});}})[_0x464d('0x32')](respondWithStatusCode(_0x5b5344,null))['catch'](handleError(_0x5b5344,null));};exports[_0x464d('0x10e')]=function(_0x5ef3e7,_0x71182d,_0x5e2d7b){var _0x477cf8={};var _0x4f12d7={};var _0x57c081;var _0x4e2073;return db[_0x464d('0x4b')][_0x464d('0x58')]({'where':{'id':_0x5ef3e7[_0x464d('0x4e')]['id']}})[_0x464d('0x32')](handleEntityNotFound(_0x71182d,null))[_0x464d('0x32')](function(_0x47c226){if(_0x47c226){_0x57c081=_0x47c226;_0x4f12d7[_0x464d('0x37')]=_['keys'](db['User'][_0x464d('0x4f')]);_0x4f12d7['query']=_[_0x464d('0x38')](_0x5ef3e7[_0x464d('0x39')]);_0x4f12d7['filters']=_[_0x464d('0x3c')](_0x4f12d7[_0x464d('0x37')],_0x4f12d7[_0x464d('0x39')]);_0x477cf8[_0x464d('0x3d')]=_[_0x464d('0x3c')](_0x4f12d7[_0x464d('0x37')],qs[_0x464d('0x3e')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x3e')]));_0x477cf8[_0x464d('0x3d')]=_0x477cf8[_0x464d('0x3d')][_0x464d('0x50')]?_0x477cf8['attributes']:_0x4f12d7[_0x464d('0x37')];_0x477cf8[_0x464d('0x5a')]=qs[_0x464d('0x41')](_0x5ef3e7['query'][_0x464d('0x41')]);_0x477cf8[_0x464d('0x47')]=qs[_0x464d('0x42')](_['pick'](_0x5ef3e7[_0x464d('0x39')],_0x4f12d7[_0x464d('0x42')]));if(_0x5ef3e7['query'][_0x464d('0x48')]){_0x477cf8[_0x464d('0x47')]=_['merge'](_0x477cf8[_0x464d('0x47')],{'$or':_['map'](_0x477cf8[_0x464d('0x3d')],function(_0x3d86e2){var _0x51f2e2={};_0x51f2e2[_0x3d86e2]={'$like':'%'+_0x5ef3e7['query'][_0x464d('0x48')]+'%'};return _0x51f2e2;})});}_0x477cf8=_[_0x464d('0x46')]({},_0x477cf8,_0x5ef3e7['options']);return _0x57c081[_0x464d('0x10e')](_0x477cf8);}})[_0x464d('0x32')](function(_0x1194f1){if(_0x1194f1){_0x4e2073=_0x1194f1[_0x464d('0x50')];if(!_0x5ef3e7[_0x464d('0x39')][_0x464d('0x3f')](_0x464d('0x40'))){_0x477cf8['limit']=qs[_0x464d('0x2a')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x2a')]);_0x477cf8[_0x464d('0x29')]=qs[_0x464d('0x29')](_0x5ef3e7[_0x464d('0x39')][_0x464d('0x29')]);}return _0x57c081[_0x464d('0x10e')](_0x477cf8);}})[_0x464d('0x32')](function(_0x37b4e8){if(_0x37b4e8){return _0x37b4e8?{'count':_0x4e2073,'rows':_0x37b4e8}:null;}})[_0x464d('0x32')](respondWithResult(_0x71182d,null))['catch'](handleError(_0x71182d,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 980516d..a574cae 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 _0x0e17=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x4de586,_0x183427){var _0x46baf5=function(_0x1157f0){while(--_0x1157f0){_0x4de586['push'](_0x4de586['shift']());}};_0x46baf5(++_0x183427);}(_0x0e17,0xd6));var _0x70e1=function(_0x3ceb55,_0x583b14){_0x3ceb55=_0x3ceb55-0x0;var _0x31b62a=_0x0e17[_0x3ceb55];return _0x31b62a;};'use strict';var EventEmitter=require(_0x70e1('0x0'));var ChatWebsite=require(_0x70e1('0x1'))['db'][_0x70e1('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x70e1('0x3')](0x0);var events={'afterCreate':_0x70e1('0x4'),'afterUpdate':_0x70e1('0x5'),'afterDestroy':_0x70e1('0x6')};function emitEvent(_0xf151a0){return function(_0x406801,_0x2c62b8,_0x1a799c){ChatWebsiteEvents[_0x70e1('0x7')](_0xf151a0+':'+_0x406801['id'],_0x406801);ChatWebsiteEvents['emit'](_0xf151a0,_0x406801);_0x1a799c(null);};}for(var e in events){if(events[_0x70e1('0x8')](e)){var event=events[e];ChatWebsite[_0x70e1('0x9')](e,emitEvent(event));}}module[_0x70e1('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0x0689=['remove','emit','hook','../../mysqldb','setMaxListeners','save','update'];(function(_0x594520,_0x2fe865){var _0x4e4aea=function(_0x465eec){while(--_0x465eec){_0x594520['push'](_0x594520['shift']());}};_0x4e4aea(++_0x2fe865);}(_0x0689,0x161));var _0x9068=function(_0x18d29b,_0x3034d2){_0x18d29b=_0x18d29b-0x0;var _0x3c354f=_0x0689[_0x18d29b];return _0x3c354f;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9068('0x0'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9068('0x1')](0x0);var events={'afterCreate':_0x9068('0x2'),'afterUpdate':_0x9068('0x3'),'afterDestroy':_0x9068('0x4')};function emitEvent(_0x44080a){return function(_0x1c35ba,_0x3b12f4,_0x1dbc6f){ChatWebsiteEvents[_0x9068('0x5')](_0x44080a+':'+_0x1c35ba['id'],_0x1c35ba);ChatWebsiteEvents[_0x9068('0x5')](_0x44080a,_0x1c35ba);_0x1dbc6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9068('0x6')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a093e00..15d3239 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 _0xf109=['util','../../config/logger','request-promise','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash'];(function(_0x43e15e,_0x2fb83b){var _0x2ccb11=function(_0x408159){while(--_0x408159){_0x43e15e['push'](_0x43e15e['shift']());}};_0x2ccb11(++_0x2fb83b);}(_0xf109,0xce));var _0x9f10=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0xf109[_0x31ced5];return _0x10d9e5;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var attributes=require(_0x9f10('0x4'));module[_0x9f10('0x5')]=function(_0x26f01c,_0x4027f4){return _0x26f01c[_0x9f10('0x6')](_0x9f10('0x7'),attributes,{'tableName':_0x9f10('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf290=['bluebird','request-promise','./chatWebsite.attributes','exports','define','chat_websites','util','api'];(function(_0x59ee91,_0x5ca1ef){var _0x51b0b7=function(_0x55517f){while(--_0x55517f){_0x59ee91['push'](_0x59ee91['shift']());}};_0x51b0b7(++_0x5ca1ef);}(_0xf290,0xde));var _0x0f29=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xf290[_0x1db251];return _0x56685a;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var logger=require('../../config/logger')(_0x0f29('0x1'));var moment=require('moment');var BPromise=require(_0x0f29('0x2'));var rp=require(_0x0f29('0x3'));var attributes=require(_0x0f29('0x4'));module[_0x0f29('0x5')]=function(_0xfdab92,_0x5984ba){return _0xfdab92[_0x0f29('0x6')]('ChatWebsite',attributes,{'tableName':_0x0f29('0x7'),'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 8521e51..babff3a 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 _0x1d25=['../../config/logger','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x23ec06,_0x561142){var _0x2831d4=function(_0x3802bc){while(--_0x3802bc){_0x23ec06['push'](_0x23ec06['shift']());}};_0x2831d4(++_0x561142);}(_0x1d25,0xba));var _0x51d2=function(_0x487496,_0x249683){_0x487496=_0x487496-0x0;var _0x539dc8=_0x1d25[_0x487496];return _0x539dc8;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var moment=require(_0x51d2('0x2'));var BPromise=require(_0x51d2('0x3'));var rs=require(_0x51d2('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x51d2('0x5'));var logger=require(_0x51d2('0x6'))('rpc');var config=require(_0x51d2('0x7'));var jayson=require(_0x51d2('0x8'));var client=jayson[_0x51d2('0x9')][_0x51d2('0xa')]({'port':0x232a});var socket=require(_0x51d2('0xb'))({'host':_0x51d2('0xc'),'port':0x18eb});require('./chatWebsite.socket')[_0x51d2('0xd')](socket);function respondWithRpcPromise(_0x5a6b5f,_0x419156,_0x4dfc7e){return new BPromise(function(_0x532061,_0x30d7d0){return client[_0x51d2('0xe')](_0x5a6b5f,_0x4dfc7e)[_0x51d2('0xf')](function(_0x359fb6){logger['info'](_0x51d2('0x10'),_0x419156,_0x51d2('0x11'));logger[_0x51d2('0x12')](_0x51d2('0x13'),_0x419156,_0x51d2('0x11'),JSON['stringify'](_0x359fb6));if(_0x359fb6[_0x51d2('0x14')]){if(_0x359fb6[_0x51d2('0x14')]['code']===0x1f4){logger['error'](_0x51d2('0x10'),_0x419156,_0x359fb6[_0x51d2('0x14')][_0x51d2('0x15')]);return _0x30d7d0(_0x359fb6[_0x51d2('0x14')][_0x51d2('0x15')]);}logger['error'](_0x51d2('0x10'),_0x419156,_0x359fb6['error'][_0x51d2('0x15')]);return _0x532061(_0x359fb6[_0x51d2('0x14')][_0x51d2('0x15')]);}else{logger['info'](_0x51d2('0x10'),_0x419156,_0x51d2('0x11'));_0x532061(_0x359fb6[_0x51d2('0x16')][_0x51d2('0x15')]);}})[_0x51d2('0x17')](function(_0x17f8ea){logger[_0x51d2('0x14')](_0x51d2('0x10'),_0x419156,_0x17f8ea);_0x30d7d0(_0x17f8ea);});});} \ No newline at end of file +var _0xe362=['ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','socket.io-emitter','localhost','./chatWebsite.socket','request','then','info'];(function(_0x345fd3,_0x2128a4){var _0x18dbc9=function(_0x110e44){while(--_0x110e44){_0x345fd3['push'](_0x345fd3['shift']());}};_0x18dbc9(++_0x2128a4);}(_0xe362,0x194));var _0x2e36=function(_0x167307,_0x5a60ae){_0x167307=_0x167307-0x0;var _0x550140=_0xe362[_0x167307];return _0x550140;};'use strict';var _=require(_0x2e36('0x0'));var util=require('util');var moment=require(_0x2e36('0x1'));var BPromise=require(_0x2e36('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2e36('0x3'))['db'];var utils=require(_0x2e36('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2e36('0x5'));var client=jayson[_0x2e36('0x6')][_0x2e36('0x7')]({'port':0x232a});var socket=require(_0x2e36('0x8'))({'host':_0x2e36('0x9'),'port':0x18eb});require(_0x2e36('0xa'))['register'](socket);function respondWithRpcPromise(_0x1091a0,_0x213f47,_0x19cdad){return new BPromise(function(_0x393e82,_0x4d5e88){return client[_0x2e36('0xb')](_0x1091a0,_0x19cdad)[_0x2e36('0xc')](function(_0x4676c4){logger[_0x2e36('0xd')](_0x2e36('0xe'),_0x213f47,_0x2e36('0xf'));logger['debug'](_0x2e36('0x10'),_0x213f47,_0x2e36('0xf'),JSON[_0x2e36('0x11')](_0x4676c4));if(_0x4676c4[_0x2e36('0x12')]){if(_0x4676c4[_0x2e36('0x12')][_0x2e36('0x13')]===0x1f4){logger[_0x2e36('0x12')](_0x2e36('0xe'),_0x213f47,_0x4676c4['error'][_0x2e36('0x14')]);return _0x4d5e88(_0x4676c4[_0x2e36('0x12')][_0x2e36('0x14')]);}logger[_0x2e36('0x12')](_0x2e36('0xe'),_0x213f47,_0x4676c4[_0x2e36('0x12')][_0x2e36('0x14')]);return _0x393e82(_0x4676c4['error'][_0x2e36('0x14')]);}else{logger[_0x2e36('0xd')](_0x2e36('0xe'),_0x213f47,'request\x20sent');_0x393e82(_0x4676c4['result']['message']);}})[_0x2e36('0x15')](function(_0x2bf5c5){logger['error'](_0x2e36('0xe'),_0x213f47,_0x2bf5c5);_0x4d5e88(_0x2bf5c5);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index c844da4..5e72f71 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 _0x6078=['update','removeListener','chatWebsite:','save','remove'];(function(_0x2fc9e3,_0x16dbfc){var _0x21733a=function(_0x31a1dc){while(--_0x31a1dc){_0x2fc9e3['push'](_0x2fc9e3['shift']());}};_0x21733a(++_0x16dbfc);}(_0x6078,0x161));var _0x8607=function(_0x2b0bd3,_0x4dd3fd){_0x2b0bd3=_0x2b0bd3-0x0;var _0x15b7bd=_0x6078[_0x2b0bd3];return _0x15b7bd;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8607('0x0'),_0x8607('0x1'),_0x8607('0x2')];function createListener(_0x15b292,_0xbdccf0){return function(_0x2f79d3){_0xbdccf0['emit'](_0x15b292,_0x2f79d3);};}function removeListener(_0x2c54c6,_0x2cc46a){return function(){ChatWebsiteEvents[_0x8607('0x3')](_0x2c54c6,_0x2cc46a);};}exports['register']=function(_0x4b3033){for(var _0x1c8b5e=0x0,_0x2462e2=events['length'];_0x1c8b5e<_0x2462e2;_0x1c8b5e++){var _0x28d9b3=events[_0x1c8b5e];var _0x53af31=createListener(_0x8607('0x4')+_0x28d9b3,_0x4b3033);ChatWebsiteEvents['on'](_0x28d9b3,_0x53af31);}}; \ No newline at end of file +var _0x64c4=['removeListener','length','./chatWebsite.events','save','remove','update','emit'];(function(_0x5f1fbf,_0xc491d1){var _0x409ea7=function(_0x5af698){while(--_0x5af698){_0x5f1fbf['push'](_0x5f1fbf['shift']());}};_0x409ea7(++_0xc491d1);}(_0x64c4,0x1a6));var _0x464c=function(_0x3d071e,_0x4d61f9){_0x3d071e=_0x3d071e-0x0;var _0x4b959b=_0x64c4[_0x3d071e];return _0x4b959b;};'use strict';var ChatWebsiteEvents=require(_0x464c('0x0'));var events=[_0x464c('0x1'),_0x464c('0x2'),_0x464c('0x3')];function createListener(_0x4b964c,_0x384240){return function(_0x42970b){_0x384240[_0x464c('0x4')](_0x4b964c,_0x42970b);};}function removeListener(_0x500f8c,_0x395181){return function(){ChatWebsiteEvents[_0x464c('0x5')](_0x500f8c,_0x395181);};}exports['register']=function(_0x5cc86a){for(var _0x457c09=0x0,_0x3594ce=events[_0x464c('0x6')];_0x457c09<_0x3594ce;_0x457c09++){var _0xa23f13=events[_0x457c09];var _0x4cd5fa=createListener('chatWebsite:'+_0xa23f13,_0x5cc86a);ChatWebsiteEvents['on'](_0xa23f13,_0x4cd5fa);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index c3588bb..456eeda 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 _0x419e=['index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/applications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','join','root','format','%s-%s','single','file','addLogo','server/files/images/avatars/','originalname','addCustomerAvatar','now','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4ebce7,_0x44fbaf){var _0x8a07c9=function(_0x1f57d2){while(--_0x1f57d2){_0x4ebce7['push'](_0x4ebce7['shift']());}};_0x8a07c9(++_0x44fbaf);}(_0x419e,0xb6));var _0xe419=function(_0x461c9e,_0x9a67cd){_0x461c9e=_0x461c9e-0x0;var _0x144e35=_0x419e[_0x461c9e];return _0x144e35;};'use strict';var multer=require(_0xe419('0x0'));var util=require(_0xe419('0x1'));var path=require(_0xe419('0x2'));var express=require(_0xe419('0x3'));var router=express[_0xe419('0x4')]();var auth=require(_0xe419('0x5'));var interaction=require(_0xe419('0x6'));var config=require(_0xe419('0x7'));var controller=require('./chatWebsite.controller');router[_0xe419('0x8')]('/',auth[_0xe419('0x9')](),controller[_0xe419('0xa')]);router[_0xe419('0x8')]('/describe',auth[_0xe419('0x9')](),controller['describe']);router[_0xe419('0x8')](_0xe419('0xb'),auth[_0xe419('0x9')](),controller[_0xe419('0xc')]);router['get'](_0xe419('0xd'),auth[_0xe419('0x9')](),controller[_0xe419('0xe')]);router[_0xe419('0x8')](_0xe419('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0xe419('0x10'),controller[_0xe419('0x11')]);router['get'](_0xe419('0x12'),controller['getAvatar']);router[_0xe419('0x8')](_0xe419('0x13'),controller[_0xe419('0x14')]);router[_0xe419('0x8')](_0xe419('0x15'),controller[_0xe419('0x16')]);router[_0xe419('0x8')](_0xe419('0x17'),auth[_0xe419('0x9')](),controller['getInteractions']);router[_0xe419('0x8')]('/:id/snippet',controller['getSnippet']);router[_0xe419('0x8')](_0xe419('0x18'),auth[_0xe419('0x9')](),controller['getApplications']);router[_0xe419('0x8')]('/:id/proactive_actions',auth[_0xe419('0x9')](),controller[_0xe419('0x19')]);router[_0xe419('0x8')](_0xe419('0x1a'),controller[_0xe419('0x1b')]);router[_0xe419('0x8')](_0xe419('0x1c'),auth['isAuthenticated'](),controller[_0xe419('0x1d')]);router['get'](_0xe419('0x1e'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe419('0x1f')]('/',auth[_0xe419('0x9')](),controller[_0xe419('0x20')]);router[_0xe419('0x1f')]('/:id/dispositions',auth[_0xe419('0x9')](),controller[_0xe419('0x21')]);router[_0xe419('0x1f')](_0xe419('0xf'),auth[_0xe419('0x9')](),controller[_0xe419('0x22')]);var upload=multer({'storage':multer[_0xe419('0x23')]({'destination':function(_0x37a5a8,_0x321578,_0x4fda4b){_0x4fda4b(null,path[_0xe419('0x24')](config[_0xe419('0x25')],'server/files/images/logos/'));},'filename':function(_0x32874d,_0x593ed3,_0x5250a9){_0x5250a9(null,util[_0xe419('0x26')](_0xe419('0x27'),Date['now'](),_0x593ed3['originalname']));}})});router['post'](_0xe419('0x10'),upload[_0xe419('0x28')](_0xe419('0x29')),controller[_0xe419('0x2a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x12016f,_0x380400,_0x258d5a){_0x258d5a(null,path[_0xe419('0x24')](config['root'],_0xe419('0x2b')));},'filename':function(_0x16e328,_0x1fc33c,_0x46fdf4){_0x46fdf4(null,util['format']('%s-%s',Date['now'](),_0x1fc33c[_0xe419('0x2c')]));}})});router[_0xe419('0x1f')](_0xe419('0x12'),upload[_0xe419('0x28')](_0xe419('0x29')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2d79a0,_0x5e43b9,_0x43480f){_0x43480f(null,path[_0xe419('0x24')](config[_0xe419('0x25')],_0xe419('0x2b')));},'filename':function(_0x3cf659,_0x3b3a60,_0x233f7a){_0x233f7a(null,util[_0xe419('0x26')](_0xe419('0x27'),Date['now'](),_0x3b3a60[_0xe419('0x2c')]));}})});router[_0xe419('0x1f')](_0xe419('0x13'),upload[_0xe419('0x28')](_0xe419('0x29')),controller[_0xe419('0x2d')]);var upload=multer({'storage':multer[_0xe419('0x23')]({'destination':function(_0x18addf,_0x30783d,_0x107646){_0x107646(null,path[_0xe419('0x24')](config[_0xe419('0x25')],'server/files/images/avatars/'));},'filename':function(_0x2452b3,_0x4d3099,_0x2f729f){_0x2f729f(null,util['format'](_0xe419('0x27'),Date[_0xe419('0x2e')](),_0x4d3099['originalname']));}})});router[_0xe419('0x1f')](_0xe419('0x15'),upload['single'](_0xe419('0x29')),controller['addSystemAvatar']);router[_0xe419('0x1f')](_0xe419('0x2f'),controller[_0xe419('0x30')]);router['post'](_0xe419('0x31'),controller[_0xe419('0x32')]);router[_0xe419('0x1f')](_0xe419('0x17'),auth[_0xe419('0x9')](),controller[_0xe419('0x33')]);router[_0xe419('0x1f')](_0xe419('0x18'),auth[_0xe419('0x9')](),controller[_0xe419('0x34')]);router[_0xe419('0x1f')](_0xe419('0x35'),auth[_0xe419('0x9')](),controller[_0xe419('0x36')]);router[_0xe419('0x1f')](_0xe419('0x1e'),auth[_0xe419('0x9')](),controller[_0xe419('0x37')]);router[_0xe419('0x38')](_0xe419('0xb'),auth[_0xe419('0x9')](),controller[_0xe419('0x39')]);router['delete'](_0xe419('0xb'),auth[_0xe419('0x9')](),controller[_0xe419('0x3a')]);router[_0xe419('0x3b')](_0xe419('0xd'),auth[_0xe419('0x9')](),controller[_0xe419('0x3c')]);router[_0xe419('0x3b')]('/:id/canned_answers',auth[_0xe419('0x9')](),controller[_0xe419('0x3d')]);router[_0xe419('0x3b')]('/:id/users',auth[_0xe419('0x9')](),controller[_0xe419('0x3e')]);module[_0xe419('0x3f')]=router; \ No newline at end of file +var _0x5fd3=['/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','/:id/dispositions','addAnswer','join','server/files/images/logos/','format','%s-%s','diskStorage','root','server/files/images/avatars/','now','originalname','single','file','/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','/:id/offline','/:id/interactions','addProactiveActions','addAgents','put','delete','destroy','removeDispositions','/:id/users','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','./chatWebsite.controller','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x5fd3,0x163));var _0x35fd=function(_0x47a525,_0xc2ebe0){_0x47a525=_0x47a525-0x0;var _0x32826d=_0x5fd3[_0x47a525];return _0x32826d;};'use strict';var multer=require(_0x35fd('0x0'));var util=require(_0x35fd('0x1'));var path=require(_0x35fd('0x2'));var express=require(_0x35fd('0x3'));var router=express[_0x35fd('0x4')]();var auth=require(_0x35fd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x35fd('0x6'));router[_0x35fd('0x7')]('/',auth['isAuthenticated'](),controller[_0x35fd('0x8')]);router[_0x35fd('0x7')](_0x35fd('0x9'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xb')]);router[_0x35fd('0x7')](_0x35fd('0xc'),auth[_0x35fd('0xa')](),controller['show']);router[_0x35fd('0x7')]('/:id/dispositions',auth[_0x35fd('0xa')](),controller[_0x35fd('0xd')]);router[_0x35fd('0x7')](_0x35fd('0xe'),auth[_0x35fd('0xa')](),controller[_0x35fd('0xf')]);router[_0x35fd('0x7')](_0x35fd('0x10'),controller['getLogo']);router['get'](_0x35fd('0x11'),controller[_0x35fd('0x12')]);router[_0x35fd('0x7')]('/:id/customer_avatar',controller[_0x35fd('0x13')]);router[_0x35fd('0x7')](_0x35fd('0x14'),controller[_0x35fd('0x15')]);router[_0x35fd('0x7')]('/:id/interactions',auth[_0x35fd('0xa')](),controller[_0x35fd('0x16')]);router['get'](_0x35fd('0x17'),controller[_0x35fd('0x18')]);router[_0x35fd('0x7')](_0x35fd('0x19'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x1a')]);router['get'](_0x35fd('0x1b'),auth['isAuthenticated'](),controller[_0x35fd('0x1c')]);router['get'](_0x35fd('0x1d'),controller[_0x35fd('0x1e')]);router[_0x35fd('0x7')](_0x35fd('0x1f'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x20')]);router['get']('/:id/users',auth[_0x35fd('0xa')](),controller[_0x35fd('0x21')]);router['post']('/',auth[_0x35fd('0xa')](),controller[_0x35fd('0x22')]);router[_0x35fd('0x23')](_0x35fd('0x24'),auth[_0x35fd('0xa')](),controller['addDisposition']);router[_0x35fd('0x23')](_0x35fd('0xe'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x261522,_0x1cc0bd,_0x13325b){_0x13325b(null,path[_0x35fd('0x26')](config['root'],_0x35fd('0x27')));},'filename':function(_0x2af4ad,_0x58afda,_0x365fef){_0x365fef(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date['now'](),_0x58afda['originalname']));}})});router[_0x35fd('0x23')](_0x35fd('0x10'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x204fe0,_0x1dbbf1,_0x26442b){_0x26442b(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],_0x35fd('0x2c')));},'filename':function(_0x13deb0,_0x3345c5,_0x37ab01){_0x37ab01(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date[_0x35fd('0x2d')](),_0x3345c5[_0x35fd('0x2e')]));}})});router[_0x35fd('0x23')](_0x35fd('0x11'),upload[_0x35fd('0x2f')](_0x35fd('0x30')),controller['addAvatar']);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x5b32d9,_0xfa0928,_0xbea5be){_0xbea5be(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],_0x35fd('0x2c')));},'filename':function(_0x2260f5,_0x5987ea,_0x98cdae){_0x98cdae(null,util['format']('%s-%s',Date['now'](),_0x5987ea[_0x35fd('0x2e')]));}})});router[_0x35fd('0x23')](_0x35fd('0x31'),upload[_0x35fd('0x2f')](_0x35fd('0x30')),controller[_0x35fd('0x32')]);var upload=multer({'storage':multer[_0x35fd('0x2a')]({'destination':function(_0x5703aa,_0x4ac5aa,_0x2bc681){_0x2bc681(null,path[_0x35fd('0x26')](config[_0x35fd('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x4a8841,_0x27051b,_0x53c95a){_0x53c95a(null,util[_0x35fd('0x28')](_0x35fd('0x29'),Date[_0x35fd('0x2d')](),_0x27051b['originalname']));}})});router[_0x35fd('0x23')](_0x35fd('0x14'),upload[_0x35fd('0x2f')]('file'),controller['addSystemAvatar']);router['post'](_0x35fd('0x33'),controller[_0x35fd('0x34')]);router[_0x35fd('0x23')](_0x35fd('0x35'),controller['offline']);router['post'](_0x35fd('0x36'),auth[_0x35fd('0xa')](),controller['addInteraction']);router['post'](_0x35fd('0x19'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x35fd('0x1b'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x37')]);router[_0x35fd('0x23')]('/:id/users',auth[_0x35fd('0xa')](),controller[_0x35fd('0x38')]);router[_0x35fd('0x39')](_0x35fd('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x35fd('0x3a')](_0x35fd('0xc'),auth['isAuthenticated'](),controller[_0x35fd('0x3b')]);router[_0x35fd('0x3a')](_0x35fd('0x24'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x3c')]);router[_0x35fd('0x3a')](_0x35fd('0xe'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x35fd('0x3a')](_0x35fd('0x3d'),auth[_0x35fd('0xa')](),controller[_0x35fd('0x3e')]);module[_0x35fd('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c883838..d3c4218 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 _0xad4c=['exports','STRING'];(function(_0x73d84f,_0x5e4bb1){var _0x4221ad=function(_0x47e75a){while(--_0x47e75a){_0x73d84f['push'](_0x73d84f['shift']());}};_0x4221ad(++_0x5e4bb1);}(_0xad4c,0x13e));var _0xcad4=function(_0x2ae181,_0x560f2d){_0x2ae181=_0x2ae181-0x0;var _0x476698=_0xad4c[_0x2ae181];return _0x476698;};'use strict';var Sequelize=require('sequelize');module[_0xcad4('0x0')]={'name':{'type':Sequelize[_0xcad4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xcad4('0x1')]},'companyId':{'type':Sequelize[_0xcad4('0x1')]},'website':{'type':Sequelize[_0xcad4('0x1')]},'phone':{'type':Sequelize[_0xcad4('0x1')]},'fax':{'type':Sequelize[_0xcad4('0x1')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcad4('0x1')]},'postalCode':{'type':Sequelize[_0xcad4('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xcad4('0x1')]},'email':{'type':Sequelize[_0xcad4('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xcad4('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xcad4('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xcad4('0x1')]},'description':{'type':Sequelize[_0xcad4('0x1')]}}; \ No newline at end of file +var _0x9df5=['exports','STRING'];(function(_0x371fdd,_0x546ace){var _0x1bbc92=function(_0x11dbd1){while(--_0x11dbd1){_0x371fdd['push'](_0x371fdd['shift']());}};_0x1bbc92(++_0x546ace);}(_0x9df5,0x196));var _0x59df=function(_0x517c42,_0xdcce20){_0x517c42=_0x517c42-0x0;var _0x444250=_0x9df5[_0x517c42];return _0x444250;};'use strict';var Sequelize=require('sequelize');module[_0x59df('0x0')]={'name':{'type':Sequelize[_0x59df('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x59df('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x59df('0x1')]},'phone':{'type':Sequelize[_0x59df('0x1')]},'fax':{'type':Sequelize[_0x59df('0x1')]},'type':{'type':Sequelize[_0x59df('0x1')]},'street':{'type':Sequelize[_0x59df('0x1')]},'postalCode':{'type':Sequelize[_0x59df('0x1')]},'city':{'type':Sequelize[_0x59df('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x59df('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x59df('0x1')]},'sStreet':{'type':Sequelize[_0x59df('0x1')]},'sPostalCode':{'type':Sequelize[_0x59df('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x59df('0x1')]},'description':{'type':Sequelize[_0x59df('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 9b34e88..403f556 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 _0x9915=['options','CmCompany','count','include','findAll','rows','catch','params','includeAll','find','create','body','addContacts','CmContact','ids','getContacts','map','hasOwnProperty','nolimit','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','update','destroy','then','stack','name','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','limit','order','sort','pick','add','day','where','filter','merge'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9915,0xeb));var _0x5991=function(_0x4afa6c,_0x51360){_0x4afa6c=_0x4afa6c-0x0;var _0x592910=_0x9915[_0x4afa6c];return _0x592910;};'use strict';var jsonpatch=require(_0x5991('0x0'));var rp=require(_0x5991('0x1'));var moment=require(_0x5991('0x2'));var BPromise=require(_0x5991('0x3'));var Mustache=require(_0x5991('0x4'));var util=require(_0x5991('0x5'));var path=require(_0x5991('0x6'));var sox=require('sox');var csv=require(_0x5991('0x7'));var ejs=require(_0x5991('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5991('0x9'));var crypto=require(_0x5991('0xa'));var jsforce=require(_0x5991('0xb'));var deskjs=require(_0x5991('0xc'));var toCsv=require(_0x5991('0x7'));var querystring=require('querystring');var Papa=require(_0x5991('0xd'));var qs=require(_0x5991('0xe'));var logger=require(_0x5991('0xf'))(_0x5991('0x10'));var utils=require(_0x5991('0x11'));var config=require(_0x5991('0x12'));var db=require(_0x5991('0x13'))['db'];function respondWithStatusCode(_0x5c1559,_0x41c77d){_0x41c77d=_0x41c77d||0xcc;return function(_0x1456cc){if(_0x1456cc){return _0x5c1559[_0x5991('0x14')](_0x41c77d);}return _0x5c1559[_0x5991('0x15')](_0x41c77d)[_0x5991('0x16')]();};}function respondWithResult(_0x23aaf3,_0xef11bd){_0xef11bd=_0xef11bd||0xc8;return function(_0x35ec6a){if(_0x35ec6a){return _0x23aaf3['status'](_0xef11bd)[_0x5991('0x17')](_0x35ec6a);}};}function respondWithFilteredResult(_0x3aa40b,_0x29aee7){return function(_0x3eab0e){if(_0x3eab0e){var _0x53d030=_0x3eab0e['count'],_0x208455=_0x29aee7[_0x5991('0x18')],_0x5b1cd6=_0x29aee7[_0x5991('0x18')]+_0x29aee7['limit'],_0xd85a9d;if(_0x5b1cd6>=_0x53d030){_0x5b1cd6=_0x53d030;_0xd85a9d=0xc8;}else{_0xd85a9d=0xce;}_0x3aa40b[_0x5991('0x15')](_0xd85a9d);return _0x3aa40b['set'](_0x5991('0x19'),_0x208455+'-'+_0x5b1cd6+'/'+_0x53d030)[_0x5991('0x17')](_0x3eab0e);}return null;};}function patchUpdates(_0xc973fb){return function(_0x571d54){try{jsonpatch[_0x5991('0x1a')](_0x571d54,_0xc973fb,!![]);}catch(_0x470d7f){return BPromise[_0x5991('0x1b')](_0x470d7f);}return _0x571d54['save']();};}function saveUpdates(_0x1b4ed5,_0xa4aef2){return function(_0x4f0ed4){if(_0x4f0ed4){return _0x4f0ed4[_0x5991('0x1c')](_0x1b4ed5)['then'](function(_0x48d104){return _0x48d104;});}return null;};}function removeEntity(_0x1d5a29,_0x363ff1){return function(_0x1ac01c){if(_0x1ac01c){return _0x1ac01c[_0x5991('0x1d')]()[_0x5991('0x1e')](function(){_0x1d5a29[_0x5991('0x15')](0xcc)[_0x5991('0x16')]();});}};}function handleEntityNotFound(_0x9ef225,_0x53dfe9){return function(_0x2e139d){if(!_0x2e139d){_0x9ef225[_0x5991('0x14')](0x194);}return _0x2e139d;};}function handleError(_0x12a7cc,_0x18dda3){_0x18dda3=_0x18dda3||0x1f4;return function(_0x52a57f){logger['error'](_0x52a57f[_0x5991('0x1f')]);if(_0x52a57f['name']){delete _0x52a57f[_0x5991('0x20')];}_0x12a7cc['status'](_0x18dda3)['send'](_0x52a57f);};}exports['index']=function(_0x27af97,_0x39bf42){var _0x1847c9={},_0x4e19f5={},_0x240951={'count':0x0,'rows':[]};var _0x136c67=db['CmCompany'][_0x5991('0x21')];_0x4e19f5[_0x5991('0x22')]=_['keys'](_0x136c67);var _0x5bb940={'dateStart':_0x27af97[_0x5991('0x23')][_0x5991('0x24')],'dateEnd':_0x27af97[_0x5991('0x23')][_0x5991('0x25')]};delete _0x27af97[_0x5991('0x23')][_0x5991('0x24')];delete _0x27af97['query']['dateEnd'];_0x4e19f5[_0x5991('0x23')]=_[_0x5991('0x26')](_0x27af97[_0x5991('0x23')]);_0x4e19f5[_0x5991('0x27')]=_[_0x5991('0x28')](_0x4e19f5[_0x5991('0x22')],_0x4e19f5['query']);_0x1847c9[_0x5991('0x29')]=_['intersection'](_0x4e19f5[_0x5991('0x22')],qs[_0x5991('0x2a')](_0x27af97[_0x5991('0x23')][_0x5991('0x2a')]));_0x1847c9[_0x5991('0x29')]=_0x1847c9[_0x5991('0x29')][_0x5991('0x2b')]?_0x1847c9[_0x5991('0x29')]:_0x4e19f5['model'];if(!_0x27af97[_0x5991('0x23')]['hasOwnProperty']('nolimit')){_0x1847c9[_0x5991('0x2c')]=qs[_0x5991('0x2c')](_0x27af97['query'][_0x5991('0x2c')]);_0x1847c9['offset']=qs[_0x5991('0x18')](_0x27af97[_0x5991('0x23')][_0x5991('0x18')]);}_0x1847c9[_0x5991('0x2d')]=qs[_0x5991('0x2e')](_0x27af97[_0x5991('0x23')][_0x5991('0x2e')]);_0x1847c9['where']=qs[_0x5991('0x27')](_[_0x5991('0x2f')](_0x27af97[_0x5991('0x23')],_0x4e19f5[_0x5991('0x27')]));if(_0x5bb940[_0x5991('0x24')]){if(_0x5bb940[_0x5991('0x25')]){_0x5bb940['dateEnd']=moment(_0x5bb940['dateEnd'])[_0x5991('0x30')](0x1,_0x5991('0x31'));}else{_0x5bb940['dateEnd']=moment(_0x5bb940[_0x5991('0x24')])[_0x5991('0x30')](0x1,_0x5991('0x31'));}_['merge'](_0x1847c9[_0x5991('0x32')],{'createdAt':{'$gte':_0x5bb940['dateStart'],'$lte':_0x5bb940[_0x5991('0x25')]}});}if(_0x27af97[_0x5991('0x23')][_0x5991('0x33')]){_0x1847c9['where']=_[_0x5991('0x34')](_0x1847c9['where'],{'$or':_['map'](_0x1847c9[_0x5991('0x29')],function(_0x4762df){var _0x245975={};_0x245975[_0x4762df]={'$like':'%'+_0x27af97[_0x5991('0x23')][_0x5991('0x33')]+'%'};return _0x245975;})});}_0x1847c9=_['merge']({},_0x1847c9,_0x27af97[_0x5991('0x35')]);var _0x262d2d={'where':_0x1847c9[_0x5991('0x32')]};return db[_0x5991('0x36')][_0x5991('0x37')](_0x262d2d)[_0x5991('0x1e')](function(_0x51648a){_0x240951['count']=_0x51648a;if(_0x27af97[_0x5991('0x23')]['includeAll']){_0x1847c9[_0x5991('0x38')]=[{'all':!![]}];}return db[_0x5991('0x36')][_0x5991('0x39')](_0x1847c9);})[_0x5991('0x1e')](function(_0x1e1061){_0x240951[_0x5991('0x3a')]=_0x1e1061;return _0x240951;})[_0x5991('0x1e')](respondWithFilteredResult(_0x39bf42,_0x1847c9))[_0x5991('0x3b')](handleError(_0x39bf42,null));};exports['show']=function(_0xd9dd34,_0x3015bd){var _0x1ef717={'raw':![],'where':{'id':_0xd9dd34[_0x5991('0x3c')]['id']}},_0x3ae351={};_0x3ae351[_0x5991('0x22')]=_[_0x5991('0x26')](db['CmCompany'][_0x5991('0x21')]);_0x3ae351[_0x5991('0x23')]=_['keys'](_0xd9dd34[_0x5991('0x23')]);_0x3ae351['filters']=_[_0x5991('0x28')](_0x3ae351[_0x5991('0x22')],_0x3ae351['query']);_0x1ef717['attributes']=_[_0x5991('0x28')](_0x3ae351['model'],qs[_0x5991('0x2a')](_0xd9dd34[_0x5991('0x23')][_0x5991('0x2a')]));_0x1ef717[_0x5991('0x29')]=_0x1ef717[_0x5991('0x29')][_0x5991('0x2b')]?_0x1ef717[_0x5991('0x29')]:_0x3ae351[_0x5991('0x22')];if(_0xd9dd34['query'][_0x5991('0x3d')]){_0x1ef717[_0x5991('0x38')]=[{'all':!![]}];}_0x1ef717=_[_0x5991('0x34')]({},_0x1ef717,_0xd9dd34[_0x5991('0x35')]);return db['CmCompany'][_0x5991('0x3e')](_0x1ef717)[_0x5991('0x1e')](handleEntityNotFound(_0x3015bd,null))[_0x5991('0x1e')](respondWithResult(_0x3015bd,null))[_0x5991('0x3b')](handleError(_0x3015bd,null));};exports['create']=function(_0x20c06c,_0x23c9ed){return db['CmCompany'][_0x5991('0x3f')](_0x20c06c[_0x5991('0x40')],{})[_0x5991('0x1e')](respondWithResult(_0x23c9ed,0xc9))[_0x5991('0x3b')](handleError(_0x23c9ed,null));};exports[_0x5991('0x1c')]=function(_0xca9b8e,_0x2194c8){if(_0xca9b8e[_0x5991('0x40')]['id']){delete _0xca9b8e[_0x5991('0x40')]['id'];}return db['CmCompany']['find']({'where':{'id':_0xca9b8e[_0x5991('0x3c')]['id']}})[_0x5991('0x1e')](handleEntityNotFound(_0x2194c8,null))[_0x5991('0x1e')](saveUpdates(_0xca9b8e[_0x5991('0x40')],null))[_0x5991('0x1e')](respondWithResult(_0x2194c8,null))[_0x5991('0x3b')](handleError(_0x2194c8,null));};exports[_0x5991('0x1d')]=function(_0x2ff5d6,_0x3eab21){return db[_0x5991('0x36')][_0x5991('0x3e')]({'where':{'id':_0x2ff5d6[_0x5991('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3eab21,null))[_0x5991('0x1e')](removeEntity(_0x3eab21,null))[_0x5991('0x3b')](handleError(_0x3eab21,null));};exports[_0x5991('0x41')]=function(_0x4e995a,_0x27ee67,_0x4a46de){return db[_0x5991('0x42')][_0x5991('0x3e')]({'where':{'id':_0x4e995a[_0x5991('0x3c')]['id']}})[_0x5991('0x1e')](handleEntityNotFound(_0x27ee67,null))[_0x5991('0x1e')](function(_0x44ca6b){if(_0x44ca6b){return _0x44ca6b[_0x5991('0x41')](_0x4e995a[_0x5991('0x40')][_0x5991('0x43')],_['omit'](_0x4e995a[_0x5991('0x40')],['ids','id'])||{});}})[_0x5991('0x1e')](respondWithResult(_0x27ee67,null))['catch'](handleError(_0x27ee67,null));};exports[_0x5991('0x44')]=function(_0x5d263a,_0x13362a,_0x38bed8){var _0x42a2db={};var _0x42c1e0={};var _0xd3d3e5;var _0x48a591;return db[_0x5991('0x36')]['findOne']({'where':{'id':_0x5d263a[_0x5991('0x3c')]['id']}})[_0x5991('0x1e')](handleEntityNotFound(_0x13362a,null))['then'](function(_0x5a9c4e){if(_0x5a9c4e){_0xd3d3e5=_0x5a9c4e;_0x42c1e0[_0x5991('0x22')]=_[_0x5991('0x26')](db[_0x5991('0x42')][_0x5991('0x21')]);_0x42c1e0[_0x5991('0x23')]=_[_0x5991('0x26')](_0x5d263a[_0x5991('0x23')]);_0x42c1e0[_0x5991('0x27')]=_[_0x5991('0x28')](_0x42c1e0['model'],_0x42c1e0[_0x5991('0x23')]);_0x42a2db[_0x5991('0x29')]=_[_0x5991('0x28')](_0x42c1e0[_0x5991('0x22')],qs[_0x5991('0x2a')](_0x5d263a['query'][_0x5991('0x2a')]));_0x42a2db[_0x5991('0x29')]=_0x42a2db[_0x5991('0x29')][_0x5991('0x2b')]?_0x42a2db[_0x5991('0x29')]:_0x42c1e0['model'];_0x42a2db[_0x5991('0x2d')]=qs[_0x5991('0x2e')](_0x5d263a['query']['sort']);_0x42a2db['where']=qs[_0x5991('0x27')](_[_0x5991('0x2f')](_0x5d263a[_0x5991('0x23')],_0x42c1e0[_0x5991('0x27')]));if(_0x5d263a[_0x5991('0x23')][_0x5991('0x33')]){_0x42a2db[_0x5991('0x32')]=_[_0x5991('0x34')](_0x42a2db[_0x5991('0x32')],{'$or':_[_0x5991('0x45')](_0x42a2db[_0x5991('0x29')],function(_0xb57662){var _0x5ac6bc={};_0x5ac6bc[_0xb57662]={'$like':'%'+_0x5d263a[_0x5991('0x23')]['filter']+'%'};return _0x5ac6bc;})});}_0x42a2db=_[_0x5991('0x34')]({},_0x42a2db,_0x5d263a[_0x5991('0x35')]);return _0xd3d3e5[_0x5991('0x44')](_0x42a2db);}})[_0x5991('0x1e')](function(_0x12e871){if(_0x12e871){_0x48a591=_0x12e871[_0x5991('0x2b')];if(!_0x5d263a[_0x5991('0x23')][_0x5991('0x46')](_0x5991('0x47'))){_0x42a2db[_0x5991('0x2c')]=qs['limit'](_0x5d263a['query'][_0x5991('0x2c')]);_0x42a2db[_0x5991('0x18')]=qs[_0x5991('0x18')](_0x5d263a[_0x5991('0x23')][_0x5991('0x18')]);}return _0xd3d3e5[_0x5991('0x44')](_0x42a2db);}})[_0x5991('0x1e')](function(_0x56e685){if(_0x56e685){return _0x56e685?{'count':_0x48a591,'rows':_0x56e685}:null;}})[_0x5991('0x1e')](respondWithResult(_0x13362a,null))['catch'](handleError(_0x13362a,null));}; \ No newline at end of file +var _0xe533=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','limit','set','apply','reject','save','update','destroy','then','end','sendStatus','stack','name','send','index','CmCompany','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','includeAll','findAll','catch','show','include','find','create','body','addContacts','CmContact','params','ids','getContacts','findOne','length','options','fast-json-patch','request-promise','moment','bluebird'];(function(_0x46ecd0,_0x36b6ab){var _0xe116a9=function(_0x3477de){while(--_0x3477de){_0x46ecd0['push'](_0x46ecd0['shift']());}};_0xe116a9(++_0x36b6ab);}(_0xe533,0xd7));var _0x3e53=function(_0x373ac1,_0x5deb7d){_0x373ac1=_0x373ac1-0x0;var _0x287b12=_0xe533[_0x373ac1];return _0x287b12;};'use strict';var jsonpatch=require(_0x3e53('0x0'));var rp=require(_0x3e53('0x1'));var moment=require(_0x3e53('0x2'));var BPromise=require(_0x3e53('0x3'));var Mustache=require(_0x3e53('0x4'));var util=require(_0x3e53('0x5'));var path=require(_0x3e53('0x6'));var sox=require(_0x3e53('0x7'));var csv=require(_0x3e53('0x8'));var ejs=require(_0x3e53('0x9'));var fs=require('fs');var _=require(_0x3e53('0xa'));var squel=require('squel');var crypto=require(_0x3e53('0xb'));var jsforce=require(_0x3e53('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3e53('0x8'));var querystring=require(_0x3e53('0xd'));var Papa=require(_0x3e53('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x3e53('0xf'))('api');var utils=require(_0x3e53('0x10'));var config=require(_0x3e53('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d000e,_0x3719d9){_0x3719d9=_0x3719d9||0xcc;return function(_0x3928ad){if(_0x3928ad){return _0x4d000e['sendStatus'](_0x3719d9);}return _0x4d000e[_0x3e53('0x12')](_0x3719d9)['end']();};}function respondWithResult(_0x21d9d2,_0x3356d3){_0x3356d3=_0x3356d3||0xc8;return function(_0x322b0e){if(_0x322b0e){return _0x21d9d2[_0x3e53('0x12')](_0x3356d3)[_0x3e53('0x13')](_0x322b0e);}};}function respondWithFilteredResult(_0x12fa9b,_0x23396a){return function(_0x4d56cf){if(_0x4d56cf){var _0x47afdb=_0x4d56cf[_0x3e53('0x14')],_0x5c872f=_0x23396a[_0x3e53('0x15')],_0x38237a=_0x23396a[_0x3e53('0x15')]+_0x23396a[_0x3e53('0x16')],_0x8458f0;if(_0x38237a>=_0x47afdb){_0x38237a=_0x47afdb;_0x8458f0=0xc8;}else{_0x8458f0=0xce;}_0x12fa9b[_0x3e53('0x12')](_0x8458f0);return _0x12fa9b[_0x3e53('0x17')]('Content-Range',_0x5c872f+'-'+_0x38237a+'/'+_0x47afdb)[_0x3e53('0x13')](_0x4d56cf);}return null;};}function patchUpdates(_0x234132){return function(_0x11d585){try{jsonpatch[_0x3e53('0x18')](_0x11d585,_0x234132,!![]);}catch(_0x53c172){return BPromise[_0x3e53('0x19')](_0x53c172);}return _0x11d585[_0x3e53('0x1a')]();};}function saveUpdates(_0x2b41ec,_0x13f8c8){return function(_0x494f67){if(_0x494f67){return _0x494f67[_0x3e53('0x1b')](_0x2b41ec)['then'](function(_0x2fc910){return _0x2fc910;});}return null;};}function removeEntity(_0x1a4514,_0x3b3074){return function(_0x7e9c2f){if(_0x7e9c2f){return _0x7e9c2f[_0x3e53('0x1c')]()[_0x3e53('0x1d')](function(){_0x1a4514[_0x3e53('0x12')](0xcc)[_0x3e53('0x1e')]();});}};}function handleEntityNotFound(_0x2ec636,_0x5db649){return function(_0x19c55d){if(!_0x19c55d){_0x2ec636[_0x3e53('0x1f')](0x194);}return _0x19c55d;};}function handleError(_0x19e37f,_0x5dac20){_0x5dac20=_0x5dac20||0x1f4;return function(_0x28c6f6){logger['error'](_0x28c6f6[_0x3e53('0x20')]);if(_0x28c6f6[_0x3e53('0x21')]){delete _0x28c6f6['name'];}_0x19e37f[_0x3e53('0x12')](_0x5dac20)[_0x3e53('0x22')](_0x28c6f6);};}exports[_0x3e53('0x23')]=function(_0x2225bc,_0x3c0233){var _0x442657={},_0x1c1874={},_0x115df1={'count':0x0,'rows':[]};var _0x3400fc=db[_0x3e53('0x24')][_0x3e53('0x25')];_0x1c1874[_0x3e53('0x26')]=_[_0x3e53('0x27')](_0x3400fc);var _0x2bca62={'dateStart':_0x2225bc['query'][_0x3e53('0x28')],'dateEnd':_0x2225bc['query']['dateEnd']};delete _0x2225bc[_0x3e53('0x29')][_0x3e53('0x28')];delete _0x2225bc['query'][_0x3e53('0x2a')];_0x1c1874[_0x3e53('0x29')]=_[_0x3e53('0x27')](_0x2225bc[_0x3e53('0x29')]);_0x1c1874['filters']=_[_0x3e53('0x2b')](_0x1c1874['model'],_0x1c1874[_0x3e53('0x29')]);_0x442657[_0x3e53('0x2c')]=_[_0x3e53('0x2b')](_0x1c1874[_0x3e53('0x26')],qs['fields'](_0x2225bc[_0x3e53('0x29')][_0x3e53('0x2d')]));_0x442657[_0x3e53('0x2c')]=_0x442657[_0x3e53('0x2c')]['length']?_0x442657[_0x3e53('0x2c')]:_0x1c1874[_0x3e53('0x26')];if(!_0x2225bc[_0x3e53('0x29')][_0x3e53('0x2e')](_0x3e53('0x2f'))){_0x442657[_0x3e53('0x16')]=qs['limit'](_0x2225bc[_0x3e53('0x29')][_0x3e53('0x16')]);_0x442657[_0x3e53('0x15')]=qs[_0x3e53('0x15')](_0x2225bc['query']['offset']);}_0x442657[_0x3e53('0x30')]=qs[_0x3e53('0x31')](_0x2225bc['query'][_0x3e53('0x31')]);_0x442657[_0x3e53('0x32')]=qs[_0x3e53('0x33')](_[_0x3e53('0x34')](_0x2225bc[_0x3e53('0x29')],_0x1c1874[_0x3e53('0x33')]));if(_0x2bca62[_0x3e53('0x28')]){if(_0x2bca62[_0x3e53('0x2a')]){_0x2bca62[_0x3e53('0x2a')]=moment(_0x2bca62[_0x3e53('0x2a')])[_0x3e53('0x35')](0x1,_0x3e53('0x36'));}else{_0x2bca62[_0x3e53('0x2a')]=moment(_0x2bca62[_0x3e53('0x28')])['add'](0x1,_0x3e53('0x36'));}_[_0x3e53('0x37')](_0x442657[_0x3e53('0x32')],{'createdAt':{'$gte':_0x2bca62[_0x3e53('0x28')],'$lte':_0x2bca62[_0x3e53('0x2a')]}});}if(_0x2225bc[_0x3e53('0x29')][_0x3e53('0x38')]){_0x442657['where']=_[_0x3e53('0x37')](_0x442657['where'],{'$or':_['map'](_0x442657['attributes'],function(_0xf5f9c8){var _0x113e75={};_0x113e75[_0xf5f9c8]={'$like':'%'+_0x2225bc[_0x3e53('0x29')][_0x3e53('0x38')]+'%'};return _0x113e75;})});}_0x442657=_['merge']({},_0x442657,_0x2225bc['options']);var _0x5e5662={'where':_0x442657[_0x3e53('0x32')]};return db[_0x3e53('0x24')]['count'](_0x5e5662)[_0x3e53('0x1d')](function(_0x50d160){_0x115df1['count']=_0x50d160;if(_0x2225bc[_0x3e53('0x29')][_0x3e53('0x39')]){_0x442657['include']=[{'all':!![]}];}return db[_0x3e53('0x24')][_0x3e53('0x3a')](_0x442657);})['then'](function(_0xc487fd){_0x115df1['rows']=_0xc487fd;return _0x115df1;})[_0x3e53('0x1d')](respondWithFilteredResult(_0x3c0233,_0x442657))[_0x3e53('0x3b')](handleError(_0x3c0233,null));};exports[_0x3e53('0x3c')]=function(_0x14d7f9,_0x16acf4){var _0x5f1528={'raw':![],'where':{'id':_0x14d7f9['params']['id']}},_0x464eb8={};_0x464eb8[_0x3e53('0x26')]=_['keys'](db[_0x3e53('0x24')]['rawAttributes']);_0x464eb8['query']=_[_0x3e53('0x27')](_0x14d7f9[_0x3e53('0x29')]);_0x464eb8['filters']=_[_0x3e53('0x2b')](_0x464eb8[_0x3e53('0x26')],_0x464eb8[_0x3e53('0x29')]);_0x5f1528[_0x3e53('0x2c')]=_[_0x3e53('0x2b')](_0x464eb8[_0x3e53('0x26')],qs[_0x3e53('0x2d')](_0x14d7f9[_0x3e53('0x29')][_0x3e53('0x2d')]));_0x5f1528[_0x3e53('0x2c')]=_0x5f1528[_0x3e53('0x2c')]['length']?_0x5f1528[_0x3e53('0x2c')]:_0x464eb8[_0x3e53('0x26')];if(_0x14d7f9[_0x3e53('0x29')][_0x3e53('0x39')]){_0x5f1528[_0x3e53('0x3d')]=[{'all':!![]}];}_0x5f1528=_[_0x3e53('0x37')]({},_0x5f1528,_0x14d7f9['options']);return db[_0x3e53('0x24')][_0x3e53('0x3e')](_0x5f1528)['then'](handleEntityNotFound(_0x16acf4,null))[_0x3e53('0x1d')](respondWithResult(_0x16acf4,null))['catch'](handleError(_0x16acf4,null));};exports[_0x3e53('0x3f')]=function(_0x34fac7,_0x4a8c62){return db[_0x3e53('0x24')][_0x3e53('0x3f')](_0x34fac7[_0x3e53('0x40')],{})[_0x3e53('0x1d')](respondWithResult(_0x4a8c62,0xc9))['catch'](handleError(_0x4a8c62,null));};exports[_0x3e53('0x1b')]=function(_0x190b5b,_0x5a790c){if(_0x190b5b[_0x3e53('0x40')]['id']){delete _0x190b5b[_0x3e53('0x40')]['id'];}return db[_0x3e53('0x24')]['find']({'where':{'id':_0x190b5b['params']['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x5a790c,null))[_0x3e53('0x1d')](saveUpdates(_0x190b5b['body'],null))[_0x3e53('0x1d')](respondWithResult(_0x5a790c,null))['catch'](handleError(_0x5a790c,null));};exports[_0x3e53('0x1c')]=function(_0x148478,_0x3f9bd7){return db['CmCompany'][_0x3e53('0x3e')]({'where':{'id':_0x148478['params']['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x3f9bd7,null))['then'](removeEntity(_0x3f9bd7,null))[_0x3e53('0x3b')](handleError(_0x3f9bd7,null));};exports[_0x3e53('0x41')]=function(_0x335c0a,_0x60dcbf,_0x57dcb1){return db[_0x3e53('0x42')]['find']({'where':{'id':_0x335c0a[_0x3e53('0x43')]['id']}})[_0x3e53('0x1d')](handleEntityNotFound(_0x60dcbf,null))[_0x3e53('0x1d')](function(_0x428038){if(_0x428038){return _0x428038[_0x3e53('0x41')](_0x335c0a['body'][_0x3e53('0x44')],_['omit'](_0x335c0a[_0x3e53('0x40')],[_0x3e53('0x44'),'id'])||{});}})[_0x3e53('0x1d')](respondWithResult(_0x60dcbf,null))[_0x3e53('0x3b')](handleError(_0x60dcbf,null));};exports[_0x3e53('0x45')]=function(_0xfb121f,_0x577603,_0x5a26e3){var _0x30d9bc={};var _0x2f52d9={};var _0x270051;var _0x4d343b;return db['CmCompany'][_0x3e53('0x46')]({'where':{'id':_0xfb121f[_0x3e53('0x43')]['id']}})['then'](handleEntityNotFound(_0x577603,null))[_0x3e53('0x1d')](function(_0x346a8c){if(_0x346a8c){_0x270051=_0x346a8c;_0x2f52d9[_0x3e53('0x26')]=_[_0x3e53('0x27')](db['CmContact'][_0x3e53('0x25')]);_0x2f52d9[_0x3e53('0x29')]=_[_0x3e53('0x27')](_0xfb121f['query']);_0x2f52d9['filters']=_['intersection'](_0x2f52d9[_0x3e53('0x26')],_0x2f52d9['query']);_0x30d9bc['attributes']=_['intersection'](_0x2f52d9[_0x3e53('0x26')],qs['fields'](_0xfb121f[_0x3e53('0x29')]['fields']));_0x30d9bc[_0x3e53('0x2c')]=_0x30d9bc['attributes'][_0x3e53('0x47')]?_0x30d9bc['attributes']:_0x2f52d9[_0x3e53('0x26')];_0x30d9bc['order']=qs[_0x3e53('0x31')](_0xfb121f['query'][_0x3e53('0x31')]);_0x30d9bc['where']=qs[_0x3e53('0x33')](_[_0x3e53('0x34')](_0xfb121f[_0x3e53('0x29')],_0x2f52d9[_0x3e53('0x33')]));if(_0xfb121f[_0x3e53('0x29')]['filter']){_0x30d9bc[_0x3e53('0x32')]=_[_0x3e53('0x37')](_0x30d9bc['where'],{'$or':_['map'](_0x30d9bc['attributes'],function(_0x48e5e6){var _0x5cda89={};_0x5cda89[_0x48e5e6]={'$like':'%'+_0xfb121f[_0x3e53('0x29')]['filter']+'%'};return _0x5cda89;})});}_0x30d9bc=_[_0x3e53('0x37')]({},_0x30d9bc,_0xfb121f[_0x3e53('0x48')]);return _0x270051['getContacts'](_0x30d9bc);}})['then'](function(_0x262aae){if(_0x262aae){_0x4d343b=_0x262aae[_0x3e53('0x47')];if(!_0xfb121f[_0x3e53('0x29')][_0x3e53('0x2e')]('nolimit')){_0x30d9bc[_0x3e53('0x16')]=qs[_0x3e53('0x16')](_0xfb121f['query']['limit']);_0x30d9bc[_0x3e53('0x15')]=qs[_0x3e53('0x15')](_0xfb121f[_0x3e53('0x29')]['offset']);}return _0x270051[_0x3e53('0x45')](_0x30d9bc);}})['then'](function(_0x160190){if(_0x160190){return _0x160190?{'count':_0x4d343b,'rows':_0x160190}:null;}})[_0x3e53('0x1d')](respondWithResult(_0x577603,null))['catch'](handleError(_0x577603,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index dd35881..80a2eb7 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 _0x3c81=['util','api','moment','define','CmCompany','cm_companies','lodash'];(function(_0x3bb8f,_0x49c482){var _0x157b4c=function(_0xa8ec28){while(--_0xa8ec28){_0x3bb8f['push'](_0x3bb8f['shift']());}};_0x157b4c(++_0x49c482);}(_0x3c81,0x102));var _0x13c8=function(_0x3c108d,_0x16e48e){_0x3c108d=_0x3c108d-0x0;var _0x517336=_0x3c81[_0x3c108d];return _0x517336;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./cmCompany.attributes');module['exports']=function(_0x101d4f,_0x3ec886){return _0x101d4f[_0x13c8('0x4')](_0x13c8('0x5'),attributes,{'tableName':_0x13c8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf93=['exports','define','CmCompany','cm_companies','lodash','util','moment','bluebird','./cmCompany.attributes'];(function(_0x3e13e9,_0x317a2b){var _0x5383a6=function(_0x203ac0){while(--_0x203ac0){_0x3e13e9['push'](_0x3e13e9['shift']());}};_0x5383a6(++_0x317a2b);}(_0xaf93,0x151));var _0x3af9=function(_0x275c4f,_0x1a968c){_0x275c4f=_0x275c4f-0x0;var _0x1957ef=_0xaf93[_0x275c4f];return _0x1957ef;};'use strict';var _=require(_0x3af9('0x0'));var util=require(_0x3af9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3af9('0x2'));var BPromise=require(_0x3af9('0x3'));var rp=require('request-promise');var attributes=require(_0x3af9('0x4'));module[_0x3af9('0x5')]=function(_0x5add3,_0x189013){return _0x5add3[_0x3af9('0x6')](_0x3af9('0x7'),attributes,{'tableName':_0x3af9('0x8'),'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 9d5f55a..4aa3cfb 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 _0x2675=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','CmCompany,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','randomstring'];(function(_0x528d9c,_0x37dbde){var _0x4668c6=function(_0xdf44f4){while(--_0xdf44f4){_0x528d9c['push'](_0x528d9c['shift']());}};_0x4668c6(++_0x37dbde);}(_0x2675,0x75));var _0x5267=function(_0x4e07fc,_0x4f0c53){_0x4e07fc=_0x4e07fc-0x0;var _0x41b52e=_0x2675[_0x4e07fc];return _0x41b52e;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var db=require(_0x5267('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5267('0x3'))(_0x5267('0x4'));var config=require('../../config/environment');var jayson=require(_0x5267('0x5'));var client=jayson[_0x5267('0x6')][_0x5267('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10f92c,_0x20f065,_0xc56cd5){return new BPromise(function(_0x527c16,_0x9e0a27){return client[_0x5267('0x8')](_0x10f92c,_0xc56cd5)['then'](function(_0x799fcc){logger['info'](_0x5267('0x9'),_0x20f065,_0x5267('0xa'));logger[_0x5267('0xb')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x20f065,_0x5267('0xa'),JSON['stringify'](_0x799fcc));if(_0x799fcc[_0x5267('0xc')]){if(_0x799fcc['error'][_0x5267('0xd')]===0x1f4){logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);return _0x9e0a27(_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);}logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);return _0x527c16(_0x799fcc[_0x5267('0xc')][_0x5267('0xe')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x20f065,_0x5267('0xa'));_0x527c16(_0x799fcc[_0x5267('0xf')][_0x5267('0xe')]);}})[_0x5267('0x10')](function(_0x46b2c2){logger[_0x5267('0xc')](_0x5267('0x9'),_0x20f065,_0x46b2c2);_0x9e0a27(_0x46b2c2);});});} \ No newline at end of file +var _0x032e=['stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x032e,0x124));var _0xe032=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x032e[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe032('0x3'));var logger=require(_0xe032('0x4'))(_0xe032('0x5'));var config=require(_0xe032('0x6'));var jayson=require(_0xe032('0x7'));var client=jayson[_0xe032('0x8')][_0xe032('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33ad0b,_0x37432f,_0x1576c8){return new BPromise(function(_0x3289b0,_0xd84027){return client[_0xe032('0xa')](_0x33ad0b,_0x1576c8)[_0xe032('0xb')](function(_0x3d62fa){logger[_0xe032('0xc')](_0xe032('0xd'),_0x37432f,_0xe032('0xe'));logger['debug'](_0xe032('0xf'),_0x37432f,_0xe032('0xe'),JSON[_0xe032('0x10')](_0x3d62fa));if(_0x3d62fa[_0xe032('0x11')]){if(_0x3d62fa[_0xe032('0x11')][_0xe032('0x12')]===0x1f4){logger[_0xe032('0x11')]('CmCompany,\x20%s,\x20%s',_0x37432f,_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);return _0xd84027(_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);}logger['error'](_0xe032('0xd'),_0x37432f,_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);return _0x3289b0(_0x3d62fa[_0xe032('0x11')][_0xe032('0x13')]);}else{logger[_0xe032('0xc')](_0xe032('0xd'),_0x37432f,'request\x20sent');_0x3289b0(_0x3d62fa[_0xe032('0x14')][_0xe032('0x13')]);}})[_0xe032('0x15')](function(_0x3b57d3){logger[_0xe032('0x11')](_0xe032('0xd'),_0x37432f,_0x3b57d3);_0xd84027(_0x3b57d3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4a0345a..06b87ac 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 _0x2ec2=['get','isAuthenticated','/:id/contacts','getContacts','post','create','addContacts','/:id','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x2ec2,0x1a9));var _0x22ec=function(_0x3015f9,_0x6eeb0d){_0x3015f9=_0x3015f9-0x0;var _0x3390b6=_0x2ec2[_0x3015f9];return _0x3390b6;};'use strict';var multer=require(_0x22ec('0x0'));var util=require(_0x22ec('0x1'));var path=require('path');var express=require(_0x22ec('0x2'));var router=express[_0x22ec('0x3')]();var auth=require(_0x22ec('0x4'));var interaction=require(_0x22ec('0x5'));var config=require('../../config/environment');var controller=require(_0x22ec('0x6'));router[_0x22ec('0x7')]('/',auth[_0x22ec('0x8')](),controller['index']);router[_0x22ec('0x7')]('/:id',auth[_0x22ec('0x8')](),controller['show']);router[_0x22ec('0x7')](_0x22ec('0x9'),auth[_0x22ec('0x8')](),controller[_0x22ec('0xa')]);router[_0x22ec('0xb')]('/',auth[_0x22ec('0x8')](),controller[_0x22ec('0xc')]);router['post'](_0x22ec('0x9'),auth[_0x22ec('0x8')](),controller[_0x22ec('0xd')]);router['put'](_0x22ec('0xe'),auth[_0x22ec('0x8')](),controller[_0x22ec('0xf')]);router['delete'](_0x22ec('0xe'),auth['isAuthenticated'](),controller[_0x22ec('0x10')]);module[_0x22ec('0x11')]=router; \ No newline at end of file +var _0x258b=['getContacts','post','addContacts','put','update','delete','destroy','exports','multer','util','path','../../components/auth/service','./cmCompany.controller','get','isAuthenticated','index','/:id','/:id/contacts'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x258b,0x1ee));var _0xb258=function(_0x53619f,_0xc0254f){_0x53619f=_0x53619f-0x0;var _0x156f23=_0x258b[_0x53619f];return _0x156f23;};'use strict';var multer=require(_0xb258('0x0'));var util=require(_0xb258('0x1'));var path=require(_0xb258('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0xb258('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb258('0x4'));router[_0xb258('0x5')]('/',auth[_0xb258('0x6')](),controller[_0xb258('0x7')]);router[_0xb258('0x5')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller['show']);router[_0xb258('0x5')](_0xb258('0x9'),auth[_0xb258('0x6')](),controller[_0xb258('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xb258('0xb')](_0xb258('0x9'),auth['isAuthenticated'](),controller[_0xb258('0xc')]);router[_0xb258('0xd')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller[_0xb258('0xe')]);router[_0xb258('0xf')](_0xb258('0x8'),auth[_0xb258('0x6')](),controller[_0xb258('0x10')]);module[_0xb258('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 1614865..2996e72 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 _0xc9cc=['lodash','STRING','INTEGER','UNSIGNED','DATE'];(function(_0x56f498,_0x533ab){var _0x29a09e=function(_0x4a5627){while(--_0x4a5627){_0x56f498['push'](_0x56f498['shift']());}};_0x29a09e(++_0x533ab);}(_0xc9cc,0x12c));var _0xcc9c=function(_0x2178b8,_0x1a43e3){_0x2178b8=_0x2178b8-0x0;var _0x20ee0b=_0xc9cc[_0x2178b8];return _0x20ee0b;};'use strict';var _=require(_0xcc9c('0x0'));var Sequelize=require('sequelize');module['exports']={'firstName':{'type':Sequelize[_0xcc9c('0x1')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xcc9c('0x1')]},'postalCode':{'type':Sequelize[_0xcc9c('0x1')]},'city':{'type':Sequelize[_0xcc9c('0x1')]},'country':{'type':Sequelize[_0xcc9c('0x1')]},'dateOfBirth':{'type':Sequelize[_0xcc9c('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0xcc9c('0x1')]},'mobile':{'type':Sequelize[_0xcc9c('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcc9c('0x1')]},'url':{'type':Sequelize[_0xcc9c('0x1')]},'facebook':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xcc9c('0x1')]},'skype':{'type':Sequelize[_0xcc9c('0x1')]},'teams':{'type':Sequelize[_0xcc9c('0x1')]},'viber':{'type':Sequelize[_0xcc9c('0x1')]},'line':{'type':Sequelize[_0xcc9c('0x1')]},'wechat':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xcc9c('0x2')]},'priority':{'type':Sequelize[_0xcc9c('0x2')](0x2)[_0xcc9c('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xcc9c('0x4')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xffca=['STRING','INTEGER','UNSIGNED','DATE','NOW','exports'];(function(_0x27ce31,_0x1a0614){var _0x3d61b0=function(_0x3fcc9a){while(--_0x3fcc9a){_0x27ce31['push'](_0x27ce31['shift']());}};_0x3d61b0(++_0x1a0614);}(_0xffca,0x167));var _0xaffc=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xffca[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xaffc('0x0')]={'firstName':{'type':Sequelize[_0xaffc('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xaffc('0x1')]},'street':{'type':Sequelize[_0xaffc('0x1')]},'postalCode':{'type':Sequelize[_0xaffc('0x1')]},'city':{'type':Sequelize[_0xaffc('0x1')]},'country':{'type':Sequelize[_0xaffc('0x1')]},'dateOfBirth':{'type':Sequelize[_0xaffc('0x1')]},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xaffc('0x1')]},'fax':{'type':Sequelize[_0xaffc('0x1')]},'email':{'type':Sequelize[_0xaffc('0x1')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xaffc('0x1')]},'twitter':{'type':Sequelize[_0xaffc('0x1')]},'skype':{'type':Sequelize[_0xaffc('0x1')]},'teams':{'type':Sequelize[_0xaffc('0x1')]},'viber':{'type':Sequelize[_0xaffc('0x1')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xaffc('0x1')]},'UserId':{'type':Sequelize[_0xaffc('0x2')]},'priority':{'type':Sequelize[_0xaffc('0x2')](0x2)[_0xaffc('0x3')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xaffc('0x4')],'defaultValue':Sequelize[_0xaffc('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index ed6a8a9..9e938d1 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 _0x4861=['CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','parse','meta','import','User','agent','binding','firstName','No\x20firstName\x20column\x20specified','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','socket.io-emitter','localhost','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','describe','keys','dateStart','query','dateEnd','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','day','add','merge','where','filter','map','options','include','push','Tags','tag','CmContact','count','Tag','color','ThroughTags','rows','find','catch','body','from','get','mergeWith','isArray','tags','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','duplicates','$or','ListId','findOrCreate','spread','show','findAll','omit','cf_%d','$and','CmCustomField','pickBy','startsWith','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','params','toParam','sequelize','text','values','phone','CmHopper','findOne','getTags','nolimit','setTags','ids','getHoppers','rawAttributes','pick','ContactId','includeAll','getHopperHistories','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','file','filename','0777','child_process','fork','../../components/import/cm/csv'];(function(_0x175bfd,_0x4d47b5){var _0x2753f2=function(_0x4b0a71){while(--_0x4b0a71){_0x175bfd['push'](_0x175bfd['shift']());}};_0x2753f2(++_0x4d47b5);}(_0x4861,0x16b));var _0x1486=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x4861[_0x1caf6a];return _0x1bf493;};'use strict';var jsonpatch=require(_0x1486('0x0'));var rp=require(_0x1486('0x1'));var moment=require(_0x1486('0x2'));var BPromise=require(_0x1486('0x3'));var Mustache=require('mustache');var util=require(_0x1486('0x4'));var path=require(_0x1486('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1486('0x6'));var fs=require('fs');var _=require(_0x1486('0x7'));var squel=require(_0x1486('0x8'));var crypto=require('crypto');var jsforce=require(_0x1486('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x1486('0xa'));var querystring=require(_0x1486('0xb'));var Papa=require(_0x1486('0xc'));var qs=require(_0x1486('0xd'));var logger=require(_0x1486('0xe'))(_0x1486('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x1486('0x10'))({'host':_0x1486('0x11'),'port':0x18eb});require('./cmContact.socket')[_0x1486('0x12')](socket);function respondWithStatusCode(_0x347ccd,_0x277e0b){_0x277e0b=_0x277e0b||0xcc;return function(_0x4c83e8){if(_0x4c83e8){return _0x347ccd[_0x1486('0x13')](_0x277e0b);}return _0x347ccd[_0x1486('0x14')](_0x277e0b)[_0x1486('0x15')]();};}function respondWithResult(_0x10cfa7,_0xf049d6){_0xf049d6=_0xf049d6||0xc8;return function(_0x45b8aa){if(_0x45b8aa){return _0x10cfa7[_0x1486('0x14')](_0xf049d6)['json'](_0x45b8aa);}};}function respondWithFilteredResult(_0x1c64ff,_0x7d096){return function(_0x520d98){if(_0x520d98){var _0x58c407=_0x520d98['count'],_0x18d6c1=_0x7d096[_0x1486('0x16')],_0x2bd616=_0x7d096['offset']+_0x7d096[_0x1486('0x17')],_0xe204b;if(_0x2bd616>=_0x58c407){_0x2bd616=_0x58c407;_0xe204b=0xc8;}else{_0xe204b=0xce;}_0x1c64ff[_0x1486('0x14')](_0xe204b);return _0x1c64ff[_0x1486('0x18')](_0x1486('0x19'),_0x18d6c1+'-'+_0x2bd616+'/'+_0x58c407)[_0x1486('0x1a')](_0x520d98);}return null;};}function patchUpdates(_0x44fee3){return function(_0xbf8d2a){try{jsonpatch[_0x1486('0x1b')](_0xbf8d2a,_0x44fee3,!![]);}catch(_0x2c9284){return BPromise[_0x1486('0x1c')](_0x2c9284);}return _0xbf8d2a['save']();};}function saveUpdates(_0xb1af2e,_0x2dae03){return function(_0x3991cd){if(_0x3991cd){return _0x3991cd[_0x1486('0x1d')](_0xb1af2e)[_0x1486('0x1e')](function(_0x589782){return _0x589782;});}return null;};}function removeEntity(_0x256f77,_0x2ef64c){return function(_0x5cf33a){if(_0x5cf33a){return _0x5cf33a[_0x1486('0x1f')]()[_0x1486('0x1e')](function(){_0x256f77[_0x1486('0x14')](0xcc)[_0x1486('0x15')]();});}};}function handleEntityNotFound(_0x2ff37c,_0x1017e4){return function(_0x33d4d8){if(!_0x33d4d8){_0x2ff37c[_0x1486('0x13')](0x194);}return _0x33d4d8;};}function handleError(_0x4951d7,_0x519c0e){_0x519c0e=_0x519c0e||0x1f4;return function(_0x588143){logger[_0x1486('0x20')](_0x588143[_0x1486('0x21')]);if(_0x588143[_0x1486('0x22')]){delete _0x588143[_0x1486('0x22')];}_0x4951d7[_0x1486('0x14')](_0x519c0e)['send'](_0x588143);};}exports[_0x1486('0x23')]=function(_0x142f90,_0x249523){var _0x507676={},_0x47eada={},_0x5638a0={'count':0x0,'rows':[]};return db['CmContact'][_0x1486('0x24')]()[_0x1486('0x1e')](function(_0x2d50b7){_0x47eada['model']=_[_0x1486('0x25')](_0x2d50b7);var _0x28029e={'dateStart':_0x142f90['query'][_0x1486('0x26')],'dateEnd':_0x142f90[_0x1486('0x27')][_0x1486('0x28')]};delete _0x142f90[_0x1486('0x27')][_0x1486('0x26')];delete _0x142f90['query'][_0x1486('0x28')];_0x47eada['query']=_[_0x1486('0x25')](_0x142f90[_0x1486('0x27')]);_0x47eada[_0x1486('0x29')]=_['intersection'](_0x47eada[_0x1486('0x2a')],_0x47eada['query']);_0x507676[_0x1486('0x2b')]=_[_0x1486('0x2c')](_0x47eada[_0x1486('0x2a')],qs[_0x1486('0x2d')](_0x142f90[_0x1486('0x27')]['fields']));_0x507676['attributes']=_0x507676[_0x1486('0x2b')][_0x1486('0x2e')]?_0x507676[_0x1486('0x2b')]:_0x47eada[_0x1486('0x2a')];if(!_0x142f90[_0x1486('0x27')][_0x1486('0x2f')]('nolimit')){_0x507676[_0x1486('0x17')]=qs['limit'](_0x142f90[_0x1486('0x27')]['limit']);_0x507676[_0x1486('0x16')]=qs[_0x1486('0x16')](_0x142f90[_0x1486('0x27')][_0x1486('0x16')]);}_0x507676[_0x1486('0x30')]=qs[_0x1486('0x31')](_0x142f90['query'][_0x1486('0x31')]);_0x507676['where']=qs[_0x1486('0x29')](_['pick'](_0x142f90[_0x1486('0x27')],_0x47eada['filters']));if(_0x28029e['dateStart']){if(_0x28029e[_0x1486('0x28')]){_0x28029e[_0x1486('0x28')]=moment(_0x28029e['dateEnd'])['add'](0x1,_0x1486('0x32'));}else{_0x28029e[_0x1486('0x28')]=moment(_0x28029e[_0x1486('0x26')])[_0x1486('0x33')](0x1,_0x1486('0x32'));}_[_0x1486('0x34')](_0x507676[_0x1486('0x35')],{'createdAt':{'$gte':_0x28029e[_0x1486('0x26')],'$lte':_0x28029e['dateEnd']}});}if(_0x142f90[_0x1486('0x27')][_0x1486('0x36')]){_0x507676[_0x1486('0x35')]=_[_0x1486('0x34')](_0x507676['where'],{'$or':_[_0x1486('0x37')](_0x507676[_0x1486('0x2b')],function(_0x1fd6e5){var _0x57b9dd={};_0x57b9dd[_0x1fd6e5]={'$like':'%'+_0x142f90[_0x1486('0x27')][_0x1486('0x36')]+'%'};return _0x57b9dd;})});}_0x507676=_[_0x1486('0x34')]({},_0x507676,_0x142f90[_0x1486('0x38')]);var _0x3a4276={'where':_0x507676['where']};_0x3a4276[_0x1486('0x39')]=[];if(_0x142f90[_0x1486('0x27')]['tag']){_0x3a4276[_0x1486('0x39')][_0x1486('0x3a')]({'model':db['Tag'],'as':_0x1486('0x3b'),'attributes':['id'],'where':{'id':_0x142f90[_0x1486('0x27')][_0x1486('0x3c')]},'required':!![]});_0x3a4276['distinct']=!![];}return db[_0x1486('0x3d')][_0x1486('0x3e')](_0x3a4276)[_0x1486('0x1e')](function(_0x43d67c){_0x5638a0[_0x1486('0x3e')]=_0x43d67c;if(_0x142f90[_0x1486('0x27')]['includeAll']){_0x507676['include']=[{'model':db[_0x1486('0x3f')],'as':'Tags','attributes':['id','name',_0x1486('0x40')],'required':_0x142f90[_0x1486('0x27')]['tag']?!![]:![]},{'model':db[_0x1486('0x3f')],'as':_0x1486('0x41'),'attributes':['id','name','color'],'through':_0x142f90[_0x1486('0x27')]['tag']?{'attributes':[],'where':{'TagId':_0x142f90[_0x1486('0x27')]['tag']||undefined}}:{},'required':_0x142f90[_0x1486('0x27')]['tag']?!![]:![]}];}return db[_0x1486('0x3d')]['findAll'](_0x507676);})[_0x1486('0x1e')](function(_0x43aca0){_0x5638a0[_0x1486('0x42')]=_0x43aca0;return _0x5638a0;})[_0x1486('0x1e')](respondWithFilteredResult(_0x249523,_0x507676))['catch'](handleError(_0x249523,null));});};exports[_0x1486('0x1f')]=function(_0x1d3ffb,_0x9a84e6){return db[_0x1486('0x3d')][_0x1486('0x43')]({'where':{'id':_0x1d3ffb['params']['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x9a84e6,null))[_0x1486('0x1e')](removeEntity(_0x9a84e6,null))[_0x1486('0x44')](handleError(_0x9a84e6,null));};exports['describe']=function(_0x57cf58,_0x4d49e3){return db['CmContact'][_0x1486('0x24')]()['then'](respondWithResult(_0x4d49e3,null))[_0x1486('0x44')](handleError(_0x4d49e3,null));};exports[_0x1486('0x34')]=function(_0x17b6e6,_0x1ab841){var _0x56b9fd;var _0x278204;var _0x3cba23;if(_0x17b6e6[_0x1486('0x45')]['id']){delete _0x17b6e6[_0x1486('0x45')]['id'];}return db[_0x1486('0x3d')]['findAll']({'where':{'id':[_0x17b6e6['body']['to'],_0x17b6e6[_0x1486('0x45')][_0x1486('0x46')]]}})[_0x1486('0x1e')](function(_0x540d6e){if(_0x540d6e){if(_0x540d6e[_0x1486('0x2e')]!==0x2){return null;}_0x540d6e[0x0]=_0x540d6e[0x0][_0x1486('0x47')]({'plain':!![]});_0x540d6e[0x1]=_0x540d6e[0x1][_0x1486('0x47')]({'plain':!![]});delete _0x540d6e[0x0]['id'];delete _0x540d6e[0x1]['id'];return _[_0x1486('0x48')](_0x540d6e[0x0],_0x540d6e[0x1],function(_0x12ce40,_0x464762){if(Array[_0x1486('0x49')](_0x464762)&&!_0x464762[_0x1486('0x2e')]){return _0x12ce40;}else if(!_0x464762){return _0x12ce40;}});}})['then'](handleEntityNotFound(_0x1ab841,null))[_0x1486('0x1e')](function(_0x380b13){if(_0x380b13){if(_0x380b13['tags']&&_[_0x1486('0x49')](_0x380b13[_0x1486('0x4a')])){_0x380b13[_0x1486('0x4a')]=_0x380b13[_0x1486('0x4a')][_0x1486('0x4b')]();}logger['info'](_0x1486('0x4c'),_0x17b6e6['body']['to'],_0x17b6e6[_0x1486('0x45')][_0x1486('0x46')]);return db['CmHopper'][_0x1486('0x1f')]({'where':{'ContactId':[_0x17b6e6['body']['to'],_0x17b6e6[_0x1486('0x45')][_0x1486('0x46')]]}})['then'](function(_0x57ed60){logger['info'](_0x1486('0x4d'),_0x57ed60);return db[_0x1486('0x4e')][_0x1486('0x1f')]({'where':{'ContactId':[_0x17b6e6[_0x1486('0x45')]['to'],_0x17b6e6[_0x1486('0x45')][_0x1486('0x46')]]}})[_0x1486('0x1e')](function(_0x5b9f3e){logger[_0x1486('0x4f')](_0x1486('0x50'),_0x5b9f3e);return db[_0x1486('0x3d')][_0x1486('0x51')](_0x380b13);});});}})[_0x1486('0x1e')](function(_0x3fc589){if(_0x3fc589){_0x56b9fd=_0x3fc589;_0x278204={'ContactId':_0x56b9fd['id']};_0x3cba23={'where':{'ContactId':[_0x17b6e6['body']['to'],_0x17b6e6[_0x1486('0x45')]['from']]}};return db[_0x1486('0x52')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x53')]['update'](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x54')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x55')]['update'](_0x278204,_0x3cba23);}})['then'](function(){if(_0x56b9fd){return db[_0x1486('0x56')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x55')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db['MailMessage'][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x57')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x58')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x59')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5a')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5b')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5c')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5d')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5e')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x5f')]['update'](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x60')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db['ChatQueueReport'][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x61')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x62')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x63')][_0x1486('0x1d')](_0x278204,_0x3cba23);}})['then'](function(){if(_0x56b9fd){return db['SmsQueueReport']['update'](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db['JscriptySessionReport'][_0x1486('0x1d')](_0x278204,_0x3cba23);}})[_0x1486('0x1e')](function(){if(_0x56b9fd){return db[_0x1486('0x3d')][_0x1486('0x1f')]({'where':{'id':[_0x17b6e6['body']['to'],_0x17b6e6[_0x1486('0x45')][_0x1486('0x46')]]}});}})['then'](function(){if(_0x56b9fd){return _0x56b9fd;}})[_0x1486('0x1e')](respondWithResult(_0x1ab841,null))['catch'](handleError(_0x1ab841,null));};exports[_0x1486('0x51')]=function(_0x421b13,_0x48d67a){return db['CmContact'][_0x1486('0x24')]()[_0x1486('0x1e')](function(_0x5cfcd5){if(_0x421b13[_0x1486('0x45')][_0x1486('0x4a')]&&_[_0x1486('0x49')](_0x421b13[_0x1486('0x45')]['tags'])){if(_0x421b13['body'][_0x1486('0x4a')][_0x1486('0x2e')]){_0x421b13['body']['tags']=_0x421b13[_0x1486('0x45')][_0x1486('0x4a')][_0x1486('0x4b')](';')+';';}else{_0x421b13['body'][_0x1486('0x4a')]=null;}}else{_0x421b13[_0x1486('0x45')]['tags']=null;}return db[_0x1486('0x3d')][_0x1486('0x51')](_0x421b13['body'],{'fields':_['keys'](_0x5cfcd5),'raw':!![]});})[_0x1486('0x1e')](respondWithResult(_0x48d67a,0xc9))[_0x1486('0x44')](handleError(_0x48d67a,null));};exports['bulkCreate']=function(_0x26499e,_0x3c1ac6){var _0x4787f1=[];var _0x55e69a=0x0;var _0x43b6c8=0x0;var _0x269639=0x0;return db[_0x1486('0x3d')][_0x1486('0x24')]()[_0x1486('0x1e')](function(_0x1dc823){return BPromise['each'](_0x26499e[_0x1486('0x45')],function(_0x5e5033){var _0x3a88a8={'where':{'$or':[]},'defaults':_0x5e5033,'fields':_[_0x1486('0x25')](_0x1dc823),'raw':!![]};if(_0x5e5033[_0x1486('0x64')]){for(var _0x243973=0x0;_0x243973<_0x5e5033[_0x1486('0x64')][_0x1486('0x2e')];_0x243973++){var _0x6818e1={};_0x6818e1[_0x5e5033['duplicates'][_0x243973]]=_0x5e5033[_0x5e5033[_0x1486('0x64')][_0x243973]];_0x3a88a8['where'][_0x1486('0x65')][_0x1486('0x3a')](_0x6818e1);}_0x3a88a8[_0x1486('0x35')]['ListId']=_0x5e5033[_0x1486('0x66')];}return db[_0x1486('0x3d')][_0x1486('0x67')](_0x3a88a8)[_0x1486('0x68')](function(_0x4e06c8,_0x50ebd4){if(_0x50ebd4){_0x55e69a++;}else{_0x269639++;}})[_0x1486('0x44')](function(_0x6f3bec){console['error'](_0x6f3bec);_0x43b6c8++;});});})[_0x1486('0x1e')](function(_0x32ff74){if(_0x32ff74){return{'success':_0x55e69a,'failure':_0x43b6c8,'duplicates':_0x269639};}})[_0x1486('0x1e')](respondWithResult(_0x3c1ac6,0xc9))[_0x1486('0x44')](handleError(_0x3c1ac6,null));};exports[_0x1486('0x69')]=function(_0x52389f,_0x446667,_0x327e31){var _0x34e041;return db[_0x1486('0x3d')][_0x1486('0x24')]()[_0x1486('0x1e')](function(_0x3659fa){return db[_0x1486('0x3d')][_0x1486('0x43')]({'where':{'id':_0x52389f['params']['id']},'include':[{'model':db[_0x1486('0x3f')],'as':_0x1486('0x3b'),'attributes':['id','name',_0x1486('0x40')],'required':_0x52389f[_0x1486('0x27')][_0x1486('0x3c')]?!![]:![]}],'attributes':_[_0x1486('0x25')](_0x3659fa)});})['then'](function(_0x1caaf4){_0x34e041=_0x1caaf4[_0x1486('0x47')]({'plain':!![]});var _0x11ac10={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1caaf4&&_0x1caaf4[_0x1486('0x66')]){if(_0x1caaf4[_0x1486('0x66')]){_0x11ac10[_0x1486('0x35')]['$and']['push']({'ListId':{'$ne':_0x1caaf4[_0x1486('0x66')]}});}}return db['CmCustomField'][_0x1486('0x6a')](_0x11ac10);})[_0x1486('0x1e')](function(_0x1a8e96){return _[_0x1486('0x6b')](_0x34e041,_[_0x1486('0x37')](_0x1a8e96,function(_0x5bce9e){return util['format'](_0x1486('0x6c'),_0x5bce9e['id']);}));})[_0x1486('0x1e')](handleEntityNotFound(_0x446667,null))[_0x1486('0x1e')](respondWithResult(_0x446667,null))[_0x1486('0x44')](handleError(_0x446667,null));};exports[_0x1486('0x1d')]=function(_0x534d3e,_0x54c224){var _0x2193db;if(_0x534d3e[_0x1486('0x45')]['id']){delete _0x534d3e['body']['id'];}return db['CmContact'][_0x1486('0x43')]({'where':{'id':_0x534d3e['params']['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x54c224,null))[_0x1486('0x1e')](saveUpdates(_0x534d3e['body'],null))['then'](function(_0x4f1664){_0x2193db=_0x4f1664;var _0x14017e={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4f1664&&_0x4f1664[_0x1486('0x66')]){if(_0x4f1664[_0x1486('0x66')]){_0x14017e[_0x1486('0x35')][_0x1486('0x6d')]['push']({'ListId':{'$ne':_0x4f1664[_0x1486('0x66')]}});}}return db[_0x1486('0x6e')]['findAll'](_0x14017e);})[_0x1486('0x1e')](function(_0x32a8f1){if(_0x32a8f1){return _[_0x1486('0x6b')](_[_0x1486('0x6f')](_0x534d3e['body'],function(_0x4cb627,_0x278d7a){return _[_0x1486('0x70')](_0x278d7a,'cf_');}),_[_0x1486('0x37')](_0x32a8f1,function(_0x4aa4fe){return util[_0x1486('0x71')]('cf_%d',_0x4aa4fe['id']);}));}})[_0x1486('0x1e')](function(_0x12d1e5){if(_0x12d1e5&&!_[_0x1486('0x72')](_0x12d1e5)){var _0x510d98=squel['update']()[_0x1486('0x73')](_0x1486('0x74'))[_0x1486('0x75')](_0x12d1e5)[_0x1486('0x35')](_0x1486('0x76'),_0x534d3e[_0x1486('0x77')]['id'])[_0x1486('0x78')]();return db[_0x1486('0x79')]['query'](_0x510d98[_0x1486('0x7a')],{'replacements':_0x510d98[_0x1486('0x7b')]});}})['then'](function(){if(_0x534d3e['body'][_0x1486('0x7c')]&&_0x2193db){return db[_0x1486('0x7d')][_0x1486('0x1d')]({'phone':_0x534d3e[_0x1486('0x45')][_0x1486('0x7c')]},{'where':{'ContactId':_0x2193db['id']}});}})[_0x1486('0x1e')](function(){return _0x2193db;})[_0x1486('0x1e')](respondWithResult(_0x54c224,null))[_0x1486('0x44')](handleError(_0x54c224,null));};exports['getTags']=function(_0x389b27,_0x4cc9f0,_0x519dda){var _0x13a409={};var _0x5009a6={};var _0x864c85;var _0x18a35c;return db[_0x1486('0x3d')][_0x1486('0x7e')]({'where':{'id':_0x389b27[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x4cc9f0,null))[_0x1486('0x1e')](function(_0x56ee82){if(_0x56ee82){_0x864c85=_0x56ee82;_0x5009a6['model']=_[_0x1486('0x25')](db[_0x1486('0x3f')]['rawAttributes']);_0x5009a6[_0x1486('0x27')]=_[_0x1486('0x25')](_0x389b27['query']);_0x5009a6[_0x1486('0x29')]=_['intersection'](_0x5009a6[_0x1486('0x2a')],_0x5009a6['query']);_0x13a409['attributes']=_['intersection'](_0x5009a6[_0x1486('0x2a')],qs[_0x1486('0x2d')](_0x389b27[_0x1486('0x27')][_0x1486('0x2d')]));_0x13a409[_0x1486('0x2b')]=_0x13a409[_0x1486('0x2b')][_0x1486('0x2e')]?_0x13a409[_0x1486('0x2b')]:_0x5009a6[_0x1486('0x2a')];_0x13a409[_0x1486('0x30')]=qs[_0x1486('0x31')](_0x389b27[_0x1486('0x27')]['sort']);_0x13a409['where']=qs[_0x1486('0x29')](_['pick'](_0x389b27[_0x1486('0x27')],_0x5009a6[_0x1486('0x29')]));if(_0x389b27[_0x1486('0x27')][_0x1486('0x36')]){_0x13a409[_0x1486('0x35')]=_['merge'](_0x13a409[_0x1486('0x35')],{'$or':_['map'](_0x13a409[_0x1486('0x2b')],function(_0x1eb7e9){var _0x32de4e={};_0x32de4e[_0x1eb7e9]={'$like':'%'+_0x389b27[_0x1486('0x27')][_0x1486('0x36')]+'%'};return _0x32de4e;})});}_0x13a409=_[_0x1486('0x34')]({},_0x13a409,_0x389b27[_0x1486('0x38')]);return _0x864c85[_0x1486('0x7f')](_0x13a409);}})['then'](function(_0x4b9410){if(_0x4b9410){_0x18a35c=_0x4b9410['length'];if(!_0x389b27['query'][_0x1486('0x2f')](_0x1486('0x80'))){_0x13a409[_0x1486('0x17')]=qs[_0x1486('0x17')](_0x389b27[_0x1486('0x27')][_0x1486('0x17')]);_0x13a409[_0x1486('0x16')]=qs[_0x1486('0x16')](_0x389b27['query'][_0x1486('0x16')]);}return _0x864c85[_0x1486('0x7f')](_0x13a409);}})[_0x1486('0x1e')](function(_0x328d2c){if(_0x328d2c){return _0x328d2c?{'count':_0x18a35c,'rows':_0x328d2c}:null;}})[_0x1486('0x1e')](respondWithResult(_0x4cc9f0,null))[_0x1486('0x44')](handleError(_0x4cc9f0,null));};exports[_0x1486('0x81')]=function(_0x2d2ee2,_0x2bd0c3,_0x2e873c){if(_0x2d2ee2[_0x1486('0x45')]['id']){delete _0x2d2ee2['body']['id'];}return db[_0x1486('0x3d')][_0x1486('0x7e')]({'where':{'id':_0x2d2ee2[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x2bd0c3,null))[_0x1486('0x1e')](function(_0x4e73e6){if(_0x4e73e6){return _0x4e73e6['setTags'](_0x2d2ee2[_0x1486('0x45')][_0x1486('0x82')]||[]);}return null;})[_0x1486('0x1e')](respondWithResult(_0x2bd0c3,null))[_0x1486('0x44')](handleError(_0x2bd0c3,null));};exports[_0x1486('0x83')]=function(_0x8fae4b,_0x2ee33c,_0x3d527f){var _0x5d9542={'raw':![],'where':{}};var _0x5f3a55={};var _0x58bf38={'count':0x0,'rows':[]};return db['CmContact'][_0x1486('0x7e')]({'where':{'id':_0x8fae4b[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x2ee33c,null))['then'](function(_0x2cb483){if(_0x2cb483){_0x5f3a55[_0x1486('0x2a')]=_[_0x1486('0x25')](db[_0x1486('0x7d')][_0x1486('0x84')]);_0x5f3a55[_0x1486('0x27')]=_[_0x1486('0x25')](_0x8fae4b[_0x1486('0x27')]);_0x5f3a55[_0x1486('0x29')]=_['intersection'](_0x5f3a55['model'],_0x5f3a55[_0x1486('0x27')]);_0x5d9542[_0x1486('0x2b')]=_[_0x1486('0x2c')](_0x5f3a55[_0x1486('0x2a')],qs[_0x1486('0x2d')](_0x8fae4b[_0x1486('0x27')][_0x1486('0x2d')]));_0x5d9542['attributes']=_0x5d9542[_0x1486('0x2b')]['length']?_0x5d9542[_0x1486('0x2b')]:_0x5f3a55[_0x1486('0x2a')];if(!_0x8fae4b[_0x1486('0x27')][_0x1486('0x2f')](_0x1486('0x80'))){_0x5d9542[_0x1486('0x17')]=qs[_0x1486('0x17')](_0x8fae4b[_0x1486('0x27')][_0x1486('0x17')]);_0x5d9542[_0x1486('0x16')]=qs[_0x1486('0x16')](_0x8fae4b[_0x1486('0x27')][_0x1486('0x16')]);}_0x5d9542['order']=qs[_0x1486('0x31')](_0x8fae4b[_0x1486('0x27')][_0x1486('0x31')]);_0x5d9542[_0x1486('0x35')]=qs[_0x1486('0x29')](_[_0x1486('0x85')](_0x8fae4b[_0x1486('0x27')],_0x5f3a55[_0x1486('0x29')]));_0x5d9542[_0x1486('0x35')][_0x1486('0x86')]=_0x2cb483['id'];if(_0x8fae4b[_0x1486('0x27')]['filter']){_0x5d9542['where']=_[_0x1486('0x34')](_0x5d9542['where'],{'$or':_[_0x1486('0x37')](_0x5d9542[_0x1486('0x2b')],function(_0x1ae9de){var _0x353cf3={};_0x353cf3[_0x1ae9de]={'$like':'%'+_0x8fae4b[_0x1486('0x27')]['filter']+'%'};return _0x353cf3;})});}_0x5d9542=_['merge']({},_0x5d9542,_0x8fae4b[_0x1486('0x38')]);return db[_0x1486('0x7d')][_0x1486('0x3e')]({'where':_0x5d9542[_0x1486('0x35')]})[_0x1486('0x1e')](function(_0x18a127){_0x58bf38[_0x1486('0x3e')]=_0x18a127;if(_0x8fae4b[_0x1486('0x27')][_0x1486('0x87')]){_0x5d9542[_0x1486('0x39')]=[{'all':!![]}];}return db[_0x1486('0x7d')][_0x1486('0x6a')](_0x5d9542);})[_0x1486('0x1e')](function(_0x67794b){_0x58bf38[_0x1486('0x42')]=_0x67794b;return _0x58bf38;});}})[_0x1486('0x1e')](respondWithFilteredResult(_0x2ee33c,_0x5d9542))[_0x1486('0x44')](handleError(_0x2ee33c,null));};exports[_0x1486('0x88')]=function(_0x3c29c1,_0x1b0246,_0x1e6df8){var _0x5da3e1={'raw':!![],'where':{}};var _0x4cecb4={};var _0x2180b0={'count':0x0,'rows':[]};return db[_0x1486('0x3d')][_0x1486('0x7e')]({'where':{'id':_0x3c29c1[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x1b0246,null))['then'](function(_0x5f1aef){if(_0x5f1aef){_0x4cecb4[_0x1486('0x2a')]=_[_0x1486('0x25')](db[_0x1486('0x5e')][_0x1486('0x84')]);_0x4cecb4[_0x1486('0x27')]=_['keys'](_0x3c29c1[_0x1486('0x27')]);_0x4cecb4[_0x1486('0x29')]=_[_0x1486('0x2c')](_0x4cecb4[_0x1486('0x2a')],_0x4cecb4[_0x1486('0x27')]);_0x5da3e1['attributes']=_['intersection'](_0x4cecb4[_0x1486('0x2a')],qs[_0x1486('0x2d')](_0x3c29c1[_0x1486('0x27')][_0x1486('0x2d')]));_0x5da3e1[_0x1486('0x2b')]=_0x5da3e1[_0x1486('0x2b')][_0x1486('0x2e')]?_0x5da3e1[_0x1486('0x2b')]:_0x4cecb4['model'];if(!_0x3c29c1['query'][_0x1486('0x2f')](_0x1486('0x80'))){_0x5da3e1[_0x1486('0x17')]=qs['limit'](_0x3c29c1['query'][_0x1486('0x17')]);_0x5da3e1[_0x1486('0x16')]=qs[_0x1486('0x16')](_0x3c29c1[_0x1486('0x27')]['offset']);}_0x5da3e1[_0x1486('0x30')]=qs[_0x1486('0x31')](_0x3c29c1['query']['sort']);_0x5da3e1['where']=qs[_0x1486('0x29')](_['pick'](_0x3c29c1[_0x1486('0x27')],_0x4cecb4[_0x1486('0x29')]));_0x5da3e1[_0x1486('0x35')][_0x1486('0x86')]=_0x5f1aef['id'];if(_0x3c29c1[_0x1486('0x27')][_0x1486('0x36')]){_0x5da3e1[_0x1486('0x35')]=_[_0x1486('0x34')](_0x5da3e1[_0x1486('0x35')],{'$or':_[_0x1486('0x37')](_0x5da3e1[_0x1486('0x2b')],function(_0x165cac){var _0x588e20={};_0x588e20[_0x165cac]={'$like':'%'+_0x3c29c1['query'][_0x1486('0x36')]+'%'};return _0x588e20;})});}_0x5da3e1=_[_0x1486('0x34')]({},_0x5da3e1,_0x3c29c1['options']);return db['CmHopperHistory'][_0x1486('0x3e')]({'where':_0x5da3e1['where']})[_0x1486('0x1e')](function(_0xadb25c){_0x2180b0[_0x1486('0x3e')]=_0xadb25c;if(_0x3c29c1[_0x1486('0x27')][_0x1486('0x87')]){_0x5da3e1['include']=[{'all':!![]}];}return db[_0x1486('0x5e')][_0x1486('0x6a')](_0x5da3e1);})[_0x1486('0x1e')](function(_0x1796f8){_0x2180b0[_0x1486('0x42')]=_0x1796f8;return _0x2180b0;});}})[_0x1486('0x1e')](respondWithFilteredResult(_0x1b0246,_0x5da3e1))[_0x1486('0x44')](handleError(_0x1b0246,null));};exports['getHopperFinals']=function(_0x4d3884,_0x507f17,_0x15877f){var _0xd377bf={'raw':!![],'where':{}};var _0x222d8c={};var _0x34aa60={'count':0x0,'rows':[]};return db[_0x1486('0x3d')][_0x1486('0x7e')]({'where':{'id':_0x4d3884[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x507f17,null))[_0x1486('0x1e')](function(_0x576eae){if(_0x576eae){_0x222d8c[_0x1486('0x2a')]=_[_0x1486('0x25')](db['CmHopperFinal'][_0x1486('0x84')]);_0x222d8c[_0x1486('0x27')]=_[_0x1486('0x25')](_0x4d3884[_0x1486('0x27')]);_0x222d8c['filters']=_[_0x1486('0x2c')](_0x222d8c[_0x1486('0x2a')],_0x222d8c['query']);_0xd377bf['attributes']=_[_0x1486('0x2c')](_0x222d8c['model'],qs['fields'](_0x4d3884['query'][_0x1486('0x2d')]));_0xd377bf[_0x1486('0x2b')]=_0xd377bf[_0x1486('0x2b')][_0x1486('0x2e')]?_0xd377bf[_0x1486('0x2b')]:_0x222d8c[_0x1486('0x2a')];if(!_0x4d3884[_0x1486('0x27')][_0x1486('0x2f')](_0x1486('0x80'))){_0xd377bf[_0x1486('0x17')]=qs[_0x1486('0x17')](_0x4d3884[_0x1486('0x27')][_0x1486('0x17')]);_0xd377bf['offset']=qs['offset'](_0x4d3884['query'][_0x1486('0x16')]);}_0xd377bf[_0x1486('0x30')]=qs['sort'](_0x4d3884[_0x1486('0x27')][_0x1486('0x31')]);_0xd377bf['where']=qs[_0x1486('0x29')](_[_0x1486('0x85')](_0x4d3884[_0x1486('0x27')],_0x222d8c['filters']));_0xd377bf['where'][_0x1486('0x86')]=_0x576eae['id'];if(_0x4d3884[_0x1486('0x27')][_0x1486('0x36')]){_0xd377bf[_0x1486('0x35')]=_[_0x1486('0x34')](_0xd377bf['where'],{'$or':_[_0x1486('0x37')](_0xd377bf[_0x1486('0x2b')],function(_0x418207){var _0x1c0ee3={};_0x1c0ee3[_0x418207]={'$like':'%'+_0x4d3884[_0x1486('0x27')][_0x1486('0x36')]+'%'};return _0x1c0ee3;})});}_0xd377bf=_['merge']({},_0xd377bf,_0x4d3884['options']);return db[_0x1486('0x5d')][_0x1486('0x3e')]({'where':_0xd377bf[_0x1486('0x35')]})[_0x1486('0x1e')](function(_0x64a24c){_0x34aa60['count']=_0x64a24c;if(_0x4d3884[_0x1486('0x27')][_0x1486('0x87')]){_0xd377bf[_0x1486('0x39')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0xd377bf);})['then'](function(_0x3266ef){_0x34aa60[_0x1486('0x42')]=_0x3266ef;return _0x34aa60;});}})[_0x1486('0x1e')](respondWithFilteredResult(_0x507f17,_0xd377bf))[_0x1486('0x44')](handleError(_0x507f17,null));};exports[_0x1486('0x89')]=function(_0x596547,_0x2aa8af,_0x1e8523){var _0x8cabdb={'raw':!![],'where':{}};var _0x2f3d92={};var _0x587196={'count':0x0,'rows':[]};return db['CmContact'][_0x1486('0x7e')]({'where':{'id':_0x596547[_0x1486('0x77')]['id']}})[_0x1486('0x1e')](handleEntityNotFound(_0x2aa8af,null))[_0x1486('0x1e')](function(_0x2b722c){if(_0x2b722c){_0x2f3d92['model']=_[_0x1486('0x25')](db[_0x1486('0x8a')][_0x1486('0x84')]);_0x2f3d92[_0x1486('0x27')]=_[_0x1486('0x25')](_0x596547[_0x1486('0x27')]);_0x2f3d92['filters']=_[_0x1486('0x2c')](_0x2f3d92[_0x1486('0x2a')],_0x2f3d92[_0x1486('0x27')]);_0x8cabdb[_0x1486('0x2b')]=_['intersection'](_0x2f3d92['model'],qs[_0x1486('0x2d')](_0x596547[_0x1486('0x27')][_0x1486('0x2d')]));_0x8cabdb[_0x1486('0x2b')]=_0x8cabdb[_0x1486('0x2b')]['length']?_0x8cabdb[_0x1486('0x2b')]:_0x2f3d92[_0x1486('0x2a')];if(!_0x596547[_0x1486('0x27')]['hasOwnProperty'](_0x1486('0x80'))){_0x8cabdb['limit']=qs['limit'](_0x596547[_0x1486('0x27')]['limit']);_0x8cabdb[_0x1486('0x16')]=qs[_0x1486('0x16')](_0x596547[_0x1486('0x27')]['offset']);}_0x8cabdb[_0x1486('0x30')]=qs[_0x1486('0x31')](_0x596547[_0x1486('0x27')][_0x1486('0x31')]);_0x8cabdb[_0x1486('0x35')]=qs[_0x1486('0x29')](_['pick'](_0x596547[_0x1486('0x27')],_0x2f3d92[_0x1486('0x29')]));_0x8cabdb[_0x1486('0x35')][_0x1486('0x86')]=_0x2b722c['id'];if(_0x596547[_0x1486('0x27')][_0x1486('0x36')]){_0x8cabdb[_0x1486('0x35')]=_[_0x1486('0x34')](_0x8cabdb['where'],{'$or':_[_0x1486('0x37')](_0x8cabdb[_0x1486('0x2b')],function(_0x53deee){var _0x59e1e9={};_0x59e1e9[_0x53deee]={'$like':'%'+_0x596547[_0x1486('0x27')][_0x1486('0x36')]+'%'};return _0x59e1e9;})});}_0x8cabdb=_[_0x1486('0x34')]({},_0x8cabdb,_0x596547[_0x1486('0x38')]);return db[_0x1486('0x8a')][_0x1486('0x3e')]({'where':_0x8cabdb['where']})['then'](function(_0x40c9d9){_0x587196[_0x1486('0x3e')]=_0x40c9d9;if(_0x596547['query'][_0x1486('0x87')]){_0x8cabdb[_0x1486('0x39')]=[{'all':!![]}];}return db[_0x1486('0x8a')][_0x1486('0x6a')](_0x8cabdb);})[_0x1486('0x1e')](function(_0x190d44){_0x587196[_0x1486('0x42')]=_0x190d44;return _0x587196;});}})['then'](respondWithFilteredResult(_0x2aa8af,_0x8cabdb))[_0x1486('0x44')](handleError(_0x2aa8af,null));};exports[_0x1486('0x8b')]=function(_0x3c3486,_0x2c4142,_0x48a48f){try{if(!_0x3c3486[_0x1486('0x45')][_0x1486('0x66')]){throw new Error(_0x1486('0x8c'));}if(!_0x3c3486[_0x1486('0x45')][_0x1486('0x8d')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3c3486[_0x1486('0x45')][_0x1486('0x8e')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x3c3486[_0x1486('0x45')][_0x1486('0x8f')]){throw new Error(_0x1486('0x90'));}var _0x345517=_0x3c3486[_0x1486('0x45')][_0x1486('0x8d')][_0x1486('0x91')](',');var _0x16ce70=_0x3c3486['body'][_0x1486('0x8e')][_0x1486('0x91')](',');if(!_0x345517[_0x1486('0x2e')]||!_0x16ce70[_0x1486('0x2e')]||_0x345517['length']!==_0x16ce70[_0x1486('0x2e')]){throw new Error(_0x1486('0x92'));}_0x3c3486['body'][_0x1486('0x2d')]=_[_0x1486('0x93')](_0x345517,_0x16ce70);if(!_0x3c3486[_0x1486('0x45')]['fields']['phone']){throw new Error(_0x1486('0x94'));}if(!_0x3c3486[_0x1486('0x45')][_0x1486('0x2d')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x1d9aae=path[_0x1486('0x4b')](config[_0x1486('0x95')],'server/files/tmp',_0x3c3486[_0x1486('0x96')][_0x1486('0x97')]);fs['chmodSync'](_0x1d9aae,parseInt(_0x1486('0x98'),0x8));var _0x1ddb82=require(_0x1486('0x99'))[_0x1486('0x9a')](path['join'](__dirname,_0x1486('0x9b')),[_0x1d9aae,_0x3c3486[_0x1486('0x45')][_0x1486('0x8d')],_0x3c3486[_0x1486('0x45')]['binding_values'],_0x3c3486[_0x1486('0x45')][_0x1486('0x66')],_0x3c3486[_0x1486('0x45')][_0x1486('0x9c')],_0x3c3486['body'][_0x1486('0x64')],_0x3c3486[_0x1486('0x45')]['socket_timestamp']]);return _0x2c4142[_0x1486('0x14')](0xc8)[_0x1486('0x1a')]({'message':_0x1486('0x9d'),'pid':_0x1ddb82[_0x1486('0x9e')]});}catch(_0x3b7531){return _0x2c4142[_0x1486('0x14')](0x1f4)[_0x1486('0x9f')](_0x3b7531);}};exports[_0x1486('0xa0')]=function(_0x4fff09,_0x215aa4,_0x5ebbef){var _0x509ea7=fs['createReadStream'](_0x4fff09[_0x1486('0x96')][_0x1486('0x5')]);Papa[_0x1486('0xa1')](_0x509ea7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x4f1499){return _0x215aa4[_0x1486('0x14')](0xc8)[_0x1486('0x1a')]({'file':_0x4fff09[_0x1486('0x96')],'fields':_0x4f1499[_0x1486('0xa2')][_0x1486('0x2d')]});}});};exports[_0x1486('0xa3')]=function(_0x357d60,_0x4d9ce9,_0x36fb29){return db[_0x1486('0xa4')][_0x1486('0x6a')]({'raw':!![],'attributes':['id'],'where':{'role':_0x1486('0xa5')}})[_0x1486('0x1e')](function(_0x3bf854){var _0x2702b9=![];if(!_0x357d60[_0x1486('0x45')][_0x1486('0x66')]){throw new Error('No\x20ListId\x20specified');}if(!_0x357d60[_0x1486('0x45')]['binding'][_0x1486('0x7c')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x357d60[_0x1486('0x45')][_0x1486('0xa6')][_0x1486('0xa7')]){throw new Error(_0x1486('0xa8'));}if(!_0x357d60['body']['socket_timestamp']){throw new Error(_0x1486('0x90'));}var _0x302530=require(_0x1486('0x99'))[_0x1486('0x9a')](path[_0x1486('0x4b')](__dirname,'../../components/import/cm/csv2'),[_0x357d60[_0x1486('0x77')]['id'],JSON['stringify'](_0x357d60['body']),JSON[_0x1486('0xa9')](_0x3bf854)]);_0x302530['on']('message',function(_0x541982){_0x2702b9=!![];return _0x4d9ce9[_0x1486('0x14')](0xc8)[_0x1486('0x1a')]({'message':_0x1486('0xaa'),'pid':_0x302530['pid']});});_0x302530['on'](_0x1486('0xab'),function(_0x5699fe){if(_0x5699fe&&!_0x2702b9){return _0x4d9ce9[_0x1486('0x14')](0x1f4)[_0x1486('0x1a')]({'message':_0x1486('0xac'),'pid':_0x302530[_0x1486('0x9e')]});}});})[_0x1486('0x44')](handleError(_0x4d9ce9,null));}; \ No newline at end of file +var _0xef96=['0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','binding','firstName','fork','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','fast-json-patch','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','register','sendStatus','status','end','count','offset','set','json','apply','update','then','destroy','error','name','send','index','CmContact','describe','query','dateStart','dateEnd','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','pick','add','day','where','filter','map','merge','include','tag','push','distinct','Tag','Tags','color','ThroughTags','findAll','rows','catch','find','params','body','from','length','get','mergeWith','tags','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','ListId','findOrCreate','spread','show','$and','CmCustomField','cf_%d','pickBy','startsWith','cf_','format','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','values','phone','getTags','findOne','options','setTags','ids','rawAttributes','sort','ContactId','getHopperHistories','includeAll','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync'];(function(_0xb8531f,_0x3a0f68){var _0x24f2be=function(_0x2a0553){while(--_0x2a0553){_0xb8531f['push'](_0xb8531f['shift']());}};_0x24f2be(++_0x3a0f68);}(_0xef96,0xc0));var _0x6ef9=function(_0x2f4411,_0x19e23f){_0x2f4411=_0x2f4411-0x0;var _0x489ca6=_0xef96[_0x2f4411];return _0x489ca6;};'use strict';var jsonpatch=require(_0x6ef9('0x0'));var rp=require('request-promise');var moment=require(_0x6ef9('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6ef9('0x2'));var util=require(_0x6ef9('0x3'));var path=require(_0x6ef9('0x4'));var sox=require(_0x6ef9('0x5'));var csv=require(_0x6ef9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6ef9('0x7'));var crypto=require(_0x6ef9('0x8'));var jsforce=require(_0x6ef9('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6ef9('0xa'));var Papa=require(_0x6ef9('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x6ef9('0xc'))(_0x6ef9('0xd'));var utils=require(_0x6ef9('0xe'));var config=require(_0x6ef9('0xf'));var db=require(_0x6ef9('0x10'))['db'];var socket=require('socket.io-emitter')({'host':_0x6ef9('0x11'),'port':0x18eb});require('./cmContact.socket')[_0x6ef9('0x12')](socket);function respondWithStatusCode(_0x929f05,_0x2819cf){_0x2819cf=_0x2819cf||0xcc;return function(_0x10bdcf){if(_0x10bdcf){return _0x929f05[_0x6ef9('0x13')](_0x2819cf);}return _0x929f05[_0x6ef9('0x14')](_0x2819cf)[_0x6ef9('0x15')]();};}function respondWithResult(_0x171f2a,_0x32d9b2){_0x32d9b2=_0x32d9b2||0xc8;return function(_0x79400f){if(_0x79400f){return _0x171f2a[_0x6ef9('0x14')](_0x32d9b2)['json'](_0x79400f);}};}function respondWithFilteredResult(_0xde7a49,_0x3a3ca9){return function(_0x182b90){if(_0x182b90){var _0x1ae656=_0x182b90[_0x6ef9('0x16')],_0x3c123e=_0x3a3ca9[_0x6ef9('0x17')],_0x14ca77=_0x3a3ca9[_0x6ef9('0x17')]+_0x3a3ca9['limit'],_0x5ea3a4;if(_0x14ca77>=_0x1ae656){_0x14ca77=_0x1ae656;_0x5ea3a4=0xc8;}else{_0x5ea3a4=0xce;}_0xde7a49[_0x6ef9('0x14')](_0x5ea3a4);return _0xde7a49[_0x6ef9('0x18')]('Content-Range',_0x3c123e+'-'+_0x14ca77+'/'+_0x1ae656)[_0x6ef9('0x19')](_0x182b90);}return null;};}function patchUpdates(_0x28dbb3){return function(_0x20cafc){try{jsonpatch[_0x6ef9('0x1a')](_0x20cafc,_0x28dbb3,!![]);}catch(_0x253a58){return BPromise['reject'](_0x253a58);}return _0x20cafc['save']();};}function saveUpdates(_0x51f98b,_0x42e49d){return function(_0x1cb123){if(_0x1cb123){return _0x1cb123[_0x6ef9('0x1b')](_0x51f98b)[_0x6ef9('0x1c')](function(_0x10d3ca){return _0x10d3ca;});}return null;};}function removeEntity(_0x5625f6,_0x12c8d8){return function(_0x42d329){if(_0x42d329){return _0x42d329[_0x6ef9('0x1d')]()[_0x6ef9('0x1c')](function(){_0x5625f6[_0x6ef9('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x240349,_0x4c28e8){return function(_0x545c45){if(!_0x545c45){_0x240349[_0x6ef9('0x13')](0x194);}return _0x545c45;};}function handleError(_0x1aaebc,_0x4151fc){_0x4151fc=_0x4151fc||0x1f4;return function(_0x347c68){logger[_0x6ef9('0x1e')](_0x347c68['stack']);if(_0x347c68[_0x6ef9('0x1f')]){delete _0x347c68['name'];}_0x1aaebc[_0x6ef9('0x14')](_0x4151fc)[_0x6ef9('0x20')](_0x347c68);};}exports[_0x6ef9('0x21')]=function(_0x4ca103,_0x2fa3dc){var _0x488455={},_0x22875f={},_0x9ebf5a={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')][_0x6ef9('0x23')]()[_0x6ef9('0x1c')](function(_0x17198c){_0x22875f['model']=_['keys'](_0x17198c);var _0x2a28f2={'dateStart':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x25')],'dateEnd':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x26')]};delete _0x4ca103[_0x6ef9('0x24')]['dateStart'];delete _0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x26')];_0x22875f['query']=_[_0x6ef9('0x27')](_0x4ca103[_0x6ef9('0x24')]);_0x22875f[_0x6ef9('0x28')]=_['intersection'](_0x22875f[_0x6ef9('0x29')],_0x22875f[_0x6ef9('0x24')]);_0x488455[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x22875f[_0x6ef9('0x29')],qs[_0x6ef9('0x2c')](_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x488455[_0x6ef9('0x2a')]=_0x488455[_0x6ef9('0x2a')]['length']?_0x488455[_0x6ef9('0x2a')]:_0x22875f[_0x6ef9('0x29')];if(!_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x488455['limit']=qs[_0x6ef9('0x2f')](_0x4ca103['query'][_0x6ef9('0x2f')]);_0x488455[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x4ca103['query'][_0x6ef9('0x17')]);}_0x488455[_0x6ef9('0x30')]=qs['sort'](_0x4ca103['query']['sort']);_0x488455['where']=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0x4ca103[_0x6ef9('0x24')],_0x22875f[_0x6ef9('0x28')]));if(_0x2a28f2[_0x6ef9('0x25')]){if(_0x2a28f2[_0x6ef9('0x26')]){_0x2a28f2['dateEnd']=moment(_0x2a28f2[_0x6ef9('0x26')])[_0x6ef9('0x32')](0x1,_0x6ef9('0x33'));}else{_0x2a28f2[_0x6ef9('0x26')]=moment(_0x2a28f2[_0x6ef9('0x25')])[_0x6ef9('0x32')](0x1,_0x6ef9('0x33'));}_['merge'](_0x488455[_0x6ef9('0x34')],{'createdAt':{'$gte':_0x2a28f2[_0x6ef9('0x25')],'$lte':_0x2a28f2[_0x6ef9('0x26')]}});}if(_0x4ca103['query'][_0x6ef9('0x35')]){_0x488455['where']=_['merge'](_0x488455['where'],{'$or':_[_0x6ef9('0x36')](_0x488455[_0x6ef9('0x2a')],function(_0x14490b){var _0x26a942={};_0x26a942[_0x14490b]={'$like':'%'+_0x4ca103['query'][_0x6ef9('0x35')]+'%'};return _0x26a942;})});}_0x488455=_[_0x6ef9('0x37')]({},_0x488455,_0x4ca103['options']);var _0x31bd84={'where':_0x488455[_0x6ef9('0x34')]};_0x31bd84[_0x6ef9('0x38')]=[];if(_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]){_0x31bd84[_0x6ef9('0x38')][_0x6ef9('0x3a')]({'model':db['Tag'],'as':'Tags','attributes':['id'],'where':{'id':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]},'required':!![]});_0x31bd84[_0x6ef9('0x3b')]=!![];}return db['CmContact']['count'](_0x31bd84)[_0x6ef9('0x1c')](function(_0x4ebdda){_0x9ebf5a[_0x6ef9('0x16')]=_0x4ebdda;if(_0x4ca103['query']['includeAll']){_0x488455[_0x6ef9('0x38')]=[{'model':db[_0x6ef9('0x3c')],'as':_0x6ef9('0x3d'),'attributes':['id',_0x6ef9('0x1f'),_0x6ef9('0x3e')],'required':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]?!![]:![]},{'model':db[_0x6ef9('0x3c')],'as':_0x6ef9('0x3f'),'attributes':['id',_0x6ef9('0x1f'),'color'],'through':_0x4ca103[_0x6ef9('0x24')][_0x6ef9('0x39')]?{'attributes':[],'where':{'TagId':_0x4ca103['query'][_0x6ef9('0x39')]||undefined}}:{},'required':_0x4ca103[_0x6ef9('0x24')]['tag']?!![]:![]}];}return db[_0x6ef9('0x22')][_0x6ef9('0x40')](_0x488455);})[_0x6ef9('0x1c')](function(_0x2b333e){_0x9ebf5a[_0x6ef9('0x41')]=_0x2b333e;return _0x9ebf5a;})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x2fa3dc,_0x488455))[_0x6ef9('0x42')](handleError(_0x2fa3dc,null));});};exports[_0x6ef9('0x1d')]=function(_0x45f3c4,_0x12f346){return db[_0x6ef9('0x22')][_0x6ef9('0x43')]({'where':{'id':_0x45f3c4[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x12f346,null))['then'](removeEntity(_0x12f346,null))[_0x6ef9('0x42')](handleError(_0x12f346,null));};exports['describe']=function(_0x139af8,_0x256c70){return db['CmContact']['describe']()[_0x6ef9('0x1c')](respondWithResult(_0x256c70,null))[_0x6ef9('0x42')](handleError(_0x256c70,null));};exports['merge']=function(_0x3af46e,_0x280ab1){var _0x3d6bc9;var _0x12f093;var _0xdc8823;if(_0x3af46e['body']['id']){delete _0x3af46e['body']['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x40')]({'where':{'id':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}})[_0x6ef9('0x1c')](function(_0x4b036d){if(_0x4b036d){if(_0x4b036d[_0x6ef9('0x47')]!==0x2){return null;}_0x4b036d[0x0]=_0x4b036d[0x0][_0x6ef9('0x48')]({'plain':!![]});_0x4b036d[0x1]=_0x4b036d[0x1]['get']({'plain':!![]});delete _0x4b036d[0x0]['id'];delete _0x4b036d[0x1]['id'];return _[_0x6ef9('0x49')](_0x4b036d[0x0],_0x4b036d[0x1],function(_0x20606f,_0x53b0ed){if(Array['isArray'](_0x53b0ed)&&!_0x53b0ed[_0x6ef9('0x47')]){return _0x20606f;}else if(!_0x53b0ed){return _0x20606f;}});}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x280ab1,null))[_0x6ef9('0x1c')](function(_0x1d1103){if(_0x1d1103){if(_0x1d1103[_0x6ef9('0x4a')]&&_[_0x6ef9('0x4b')](_0x1d1103[_0x6ef9('0x4a')])){_0x1d1103[_0x6ef9('0x4a')]=_0x1d1103[_0x6ef9('0x4a')][_0x6ef9('0x4c')]();}logger['info'](_0x6ef9('0x4d'),_0x3af46e['body']['to'],_0x3af46e['body'][_0x6ef9('0x46')]);return db[_0x6ef9('0x4e')]['destroy']({'where':{'ContactId':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}})['then'](function(_0x7d5f70){logger[_0x6ef9('0x4f')](_0x6ef9('0x50'),_0x7d5f70);return db[_0x6ef9('0x51')][_0x6ef9('0x1d')]({'where':{'ContactId':[_0x3af46e['body']['to'],_0x3af46e[_0x6ef9('0x45')]['from']]}})[_0x6ef9('0x1c')](function(_0x4d1d2c){logger[_0x6ef9('0x4f')](_0x6ef9('0x52'),_0x4d1d2c);return db[_0x6ef9('0x22')][_0x6ef9('0x53')](_0x1d1103);});});}})['then'](function(_0x4bb96f){if(_0x4bb96f){_0x3d6bc9=_0x4bb96f;_0x12f093={'ContactId':_0x3d6bc9['id']};_0xdc8823={'where':{'ContactId':[_0x3af46e[_0x6ef9('0x45')]['to'],_0x3af46e[_0x6ef9('0x45')][_0x6ef9('0x46')]]}};return db[_0x6ef9('0x54')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['ChatMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db[_0x6ef9('0x55')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x56')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['MailMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x56')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x57')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db['SmsInteraction'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db['SmsMessage'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x58')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x59')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5a')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5b')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5c')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5d')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5e')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x5f')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x60')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x61')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db[_0x6ef9('0x62')]['update'](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x63')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})['then'](function(){if(_0x3d6bc9){return db['SmsQueueReport'][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x64')][_0x6ef9('0x1b')](_0x12f093,_0xdc8823);}})[_0x6ef9('0x1c')](function(){if(_0x3d6bc9){return db[_0x6ef9('0x22')][_0x6ef9('0x1d')]({'where':{'id':[_0x3af46e[_0x6ef9('0x45')]['to'],_0x3af46e[_0x6ef9('0x45')]['from']]}});}})['then'](function(){if(_0x3d6bc9){return _0x3d6bc9;}})[_0x6ef9('0x1c')](respondWithResult(_0x280ab1,null))[_0x6ef9('0x42')](handleError(_0x280ab1,null));};exports[_0x6ef9('0x53')]=function(_0x18678a,_0x2e19a5){return db[_0x6ef9('0x22')][_0x6ef9('0x23')]()[_0x6ef9('0x1c')](function(_0x5416f0){if(_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]&&_['isArray'](_0x18678a[_0x6ef9('0x45')]['tags'])){if(_0x18678a[_0x6ef9('0x45')]['tags'][_0x6ef9('0x47')]){_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]=_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')][_0x6ef9('0x4c')](';')+';';}else{_0x18678a[_0x6ef9('0x45')]['tags']=null;}}else{_0x18678a[_0x6ef9('0x45')][_0x6ef9('0x4a')]=null;}return db[_0x6ef9('0x22')]['create'](_0x18678a[_0x6ef9('0x45')],{'fields':_[_0x6ef9('0x27')](_0x5416f0),'raw':!![]});})[_0x6ef9('0x1c')](respondWithResult(_0x2e19a5,0xc9))[_0x6ef9('0x42')](handleError(_0x2e19a5,null));};exports[_0x6ef9('0x65')]=function(_0x3b372c,_0xb4e7fa){var _0x1d6f76=[];var _0x3e6014=0x0;var _0x406825=0x0;var _0x1f397d=0x0;return db['CmContact']['describe']()[_0x6ef9('0x1c')](function(_0x1bf805){return BPromise[_0x6ef9('0x66')](_0x3b372c[_0x6ef9('0x45')],function(_0x177128){var _0x10dde6={'where':{'$or':[]},'defaults':_0x177128,'fields':_[_0x6ef9('0x27')](_0x1bf805),'raw':!![]};if(_0x177128['duplicates']){for(var _0x38288a=0x0;_0x38288a<_0x177128[_0x6ef9('0x67')]['length'];_0x38288a++){var _0x394fd9={};_0x394fd9[_0x177128['duplicates'][_0x38288a]]=_0x177128[_0x177128[_0x6ef9('0x67')][_0x38288a]];_0x10dde6[_0x6ef9('0x34')][_0x6ef9('0x68')][_0x6ef9('0x3a')](_0x394fd9);}_0x10dde6['where'][_0x6ef9('0x69')]=_0x177128[_0x6ef9('0x69')];}return db[_0x6ef9('0x22')][_0x6ef9('0x6a')](_0x10dde6)[_0x6ef9('0x6b')](function(_0x35a7d0,_0x4cebca){if(_0x4cebca){_0x3e6014++;}else{_0x1f397d++;}})[_0x6ef9('0x42')](function(_0xa07a3f){console['error'](_0xa07a3f);_0x406825++;});});})[_0x6ef9('0x1c')](function(_0x4fbc50){if(_0x4fbc50){return{'success':_0x3e6014,'failure':_0x406825,'duplicates':_0x1f397d};}})[_0x6ef9('0x1c')](respondWithResult(_0xb4e7fa,0xc9))['catch'](handleError(_0xb4e7fa,null));};exports[_0x6ef9('0x6c')]=function(_0xea0988,_0x8c9d65,_0x4f02c2){var _0x5e90dc;return db[_0x6ef9('0x22')]['describe']()[_0x6ef9('0x1c')](function(_0x4810ef){return db[_0x6ef9('0x22')]['find']({'where':{'id':_0xea0988['params']['id']},'include':[{'model':db['Tag'],'as':_0x6ef9('0x3d'),'attributes':['id',_0x6ef9('0x1f'),'color'],'required':_0xea0988['query']['tag']?!![]:![]}],'attributes':_['keys'](_0x4810ef)});})['then'](function(_0x163a89){_0x5e90dc=_0x163a89[_0x6ef9('0x48')]({'plain':!![]});var _0x3114d3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x163a89&&_0x163a89[_0x6ef9('0x69')]){if(_0x163a89[_0x6ef9('0x69')]){_0x3114d3['where'][_0x6ef9('0x6d')]['push']({'ListId':{'$ne':_0x163a89['ListId']}});}}return db[_0x6ef9('0x6e')][_0x6ef9('0x40')](_0x3114d3);})[_0x6ef9('0x1c')](function(_0x31907e){return _['omit'](_0x5e90dc,_[_0x6ef9('0x36')](_0x31907e,function(_0x5eb29a){return util['format'](_0x6ef9('0x6f'),_0x5eb29a['id']);}));})[_0x6ef9('0x1c')](handleEntityNotFound(_0x8c9d65,null))['then'](respondWithResult(_0x8c9d65,null))['catch'](handleError(_0x8c9d65,null));};exports[_0x6ef9('0x1b')]=function(_0x340641,_0x5b8960){var _0x59066b;if(_0x340641[_0x6ef9('0x45')]['id']){delete _0x340641[_0x6ef9('0x45')]['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x43')]({'where':{'id':_0x340641[_0x6ef9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5b8960,null))[_0x6ef9('0x1c')](saveUpdates(_0x340641['body'],null))[_0x6ef9('0x1c')](function(_0x33b71b){_0x59066b=_0x33b71b;var _0x22fd59={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x33b71b&&_0x33b71b[_0x6ef9('0x69')]){if(_0x33b71b[_0x6ef9('0x69')]){_0x22fd59[_0x6ef9('0x34')][_0x6ef9('0x6d')]['push']({'ListId':{'$ne':_0x33b71b[_0x6ef9('0x69')]}});}}return db[_0x6ef9('0x6e')][_0x6ef9('0x40')](_0x22fd59);})['then'](function(_0x1dba74){if(_0x1dba74){return _['omit'](_[_0x6ef9('0x70')](_0x340641[_0x6ef9('0x45')],function(_0x2bd070,_0x1cb4c2){return _[_0x6ef9('0x71')](_0x1cb4c2,_0x6ef9('0x72'));}),_[_0x6ef9('0x36')](_0x1dba74,function(_0x4f064e){return util[_0x6ef9('0x73')](_0x6ef9('0x6f'),_0x4f064e['id']);}));}})[_0x6ef9('0x1c')](function(_0x58d98e){if(_0x58d98e&&!_[_0x6ef9('0x74')](_0x58d98e)){var _0x3489a3=squel[_0x6ef9('0x1b')]()[_0x6ef9('0x75')](_0x6ef9('0x76'))[_0x6ef9('0x77')](_0x58d98e)[_0x6ef9('0x34')](_0x6ef9('0x78'),_0x340641[_0x6ef9('0x44')]['id'])[_0x6ef9('0x79')]();return db['sequelize'][_0x6ef9('0x24')](_0x3489a3['text'],{'replacements':_0x3489a3[_0x6ef9('0x7a')]});}})[_0x6ef9('0x1c')](function(){if(_0x340641['body'][_0x6ef9('0x7b')]&&_0x59066b){return db[_0x6ef9('0x4e')]['update']({'phone':_0x340641[_0x6ef9('0x45')][_0x6ef9('0x7b')]},{'where':{'ContactId':_0x59066b['id']}});}})[_0x6ef9('0x1c')](function(){return _0x59066b;})[_0x6ef9('0x1c')](respondWithResult(_0x5b8960,null))[_0x6ef9('0x42')](handleError(_0x5b8960,null));};exports[_0x6ef9('0x7c')]=function(_0x5557d3,_0x25a865,_0x28f067){var _0x3e9bdf={};var _0x59f031={};var _0x3ec825;var _0x583c61;return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x5557d3[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x25a865,null))[_0x6ef9('0x1c')](function(_0x4edad8){if(_0x4edad8){_0x3ec825=_0x4edad8;_0x59f031[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x3c')]['rawAttributes']);_0x59f031[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0x5557d3[_0x6ef9('0x24')]);_0x59f031[_0x6ef9('0x28')]=_['intersection'](_0x59f031[_0x6ef9('0x29')],_0x59f031[_0x6ef9('0x24')]);_0x3e9bdf['attributes']=_[_0x6ef9('0x2b')](_0x59f031[_0x6ef9('0x29')],qs['fields'](_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x3e9bdf[_0x6ef9('0x2a')]=_0x3e9bdf[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x3e9bdf[_0x6ef9('0x2a')]:_0x59f031[_0x6ef9('0x29')];_0x3e9bdf[_0x6ef9('0x30')]=qs['sort'](_0x5557d3['query']['sort']);_0x3e9bdf['where']=qs[_0x6ef9('0x28')](_['pick'](_0x5557d3[_0x6ef9('0x24')],_0x59f031[_0x6ef9('0x28')]));if(_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x3e9bdf[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x3e9bdf[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x3e9bdf[_0x6ef9('0x2a')],function(_0x1018a7){var _0x3a7634={};_0x3a7634[_0x1018a7]={'$like':'%'+_0x5557d3['query'][_0x6ef9('0x35')]+'%'};return _0x3a7634;})});}_0x3e9bdf=_['merge']({},_0x3e9bdf,_0x5557d3[_0x6ef9('0x7e')]);return _0x3ec825[_0x6ef9('0x7c')](_0x3e9bdf);}})[_0x6ef9('0x1c')](function(_0x1088af){if(_0x1088af){_0x583c61=_0x1088af[_0x6ef9('0x47')];if(!_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2d')]('nolimit')){_0x3e9bdf['limit']=qs[_0x6ef9('0x2f')](_0x5557d3[_0x6ef9('0x24')][_0x6ef9('0x2f')]);_0x3e9bdf[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x5557d3['query'][_0x6ef9('0x17')]);}return _0x3ec825['getTags'](_0x3e9bdf);}})[_0x6ef9('0x1c')](function(_0x35db26){if(_0x35db26){return _0x35db26?{'count':_0x583c61,'rows':_0x35db26}:null;}})[_0x6ef9('0x1c')](respondWithResult(_0x25a865,null))[_0x6ef9('0x42')](handleError(_0x25a865,null));};exports[_0x6ef9('0x7f')]=function(_0x8305d,_0x411b86,_0x625764){if(_0x8305d[_0x6ef9('0x45')]['id']){delete _0x8305d['body']['id'];}return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x8305d[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x411b86,null))[_0x6ef9('0x1c')](function(_0x4e1ccf){if(_0x4e1ccf){return _0x4e1ccf[_0x6ef9('0x7f')](_0x8305d[_0x6ef9('0x45')][_0x6ef9('0x80')]||[]);}return null;})[_0x6ef9('0x1c')](respondWithResult(_0x411b86,null))[_0x6ef9('0x42')](handleError(_0x411b86,null));};exports['getHoppers']=function(_0x48c901,_0x51e179,_0x406d4d){var _0x28cb07={'raw':![],'where':{}};var _0x56d5c2={};var _0x281151={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0x48c901[_0x6ef9('0x44')]['id']}})['then'](handleEntityNotFound(_0x51e179,null))[_0x6ef9('0x1c')](function(_0x3f4dbd){if(_0x3f4dbd){_0x56d5c2[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db['CmHopper'][_0x6ef9('0x81')]);_0x56d5c2['query']=_[_0x6ef9('0x27')](_0x48c901[_0x6ef9('0x24')]);_0x56d5c2['filters']=_[_0x6ef9('0x2b')](_0x56d5c2[_0x6ef9('0x29')],_0x56d5c2[_0x6ef9('0x24')]);_0x28cb07[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x56d5c2[_0x6ef9('0x29')],qs['fields'](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2c')]));_0x28cb07[_0x6ef9('0x2a')]=_0x28cb07['attributes']['length']?_0x28cb07[_0x6ef9('0x2a')]:_0x56d5c2[_0x6ef9('0x29')];if(!_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x28cb07['limit']=qs['limit'](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x2f')]);_0x28cb07[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x28cb07[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0x48c901['query'][_0x6ef9('0x82')]);_0x28cb07[_0x6ef9('0x34')]=qs['filters'](_[_0x6ef9('0x31')](_0x48c901[_0x6ef9('0x24')],_0x56d5c2[_0x6ef9('0x28')]));_0x28cb07[_0x6ef9('0x34')][_0x6ef9('0x83')]=_0x3f4dbd['id'];if(_0x48c901['query'][_0x6ef9('0x35')]){_0x28cb07[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x28cb07[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x28cb07[_0x6ef9('0x2a')],function(_0x199ebc){var _0x46d70={};_0x46d70[_0x199ebc]={'$like':'%'+_0x48c901[_0x6ef9('0x24')][_0x6ef9('0x35')]+'%'};return _0x46d70;})});}_0x28cb07=_[_0x6ef9('0x37')]({},_0x28cb07,_0x48c901['options']);return db[_0x6ef9('0x4e')][_0x6ef9('0x16')]({'where':_0x28cb07[_0x6ef9('0x34')]})[_0x6ef9('0x1c')](function(_0xd26259){_0x281151['count']=_0xd26259;if(_0x48c901[_0x6ef9('0x24')]['includeAll']){_0x28cb07[_0x6ef9('0x38')]=[{'all':!![]}];}return db[_0x6ef9('0x4e')][_0x6ef9('0x40')](_0x28cb07);})[_0x6ef9('0x1c')](function(_0x6e1b0d){_0x281151[_0x6ef9('0x41')]=_0x6e1b0d;return _0x281151;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x51e179,_0x28cb07))[_0x6ef9('0x42')](handleError(_0x51e179,null));};exports[_0x6ef9('0x84')]=function(_0xca08a,_0x1b1707,_0x3a97b5){var _0x36fc7c={'raw':!![],'where':{}};var _0x5afa59={};var _0x5d2bcc={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0xca08a[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x1b1707,null))[_0x6ef9('0x1c')](function(_0x5e18b1){if(_0x5e18b1){_0x5afa59['model']=_[_0x6ef9('0x27')](db[_0x6ef9('0x5d')][_0x6ef9('0x81')]);_0x5afa59[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0xca08a[_0x6ef9('0x24')]);_0x5afa59[_0x6ef9('0x28')]=_[_0x6ef9('0x2b')](_0x5afa59[_0x6ef9('0x29')],_0x5afa59[_0x6ef9('0x24')]);_0x36fc7c['attributes']=_['intersection'](_0x5afa59[_0x6ef9('0x29')],qs[_0x6ef9('0x2c')](_0xca08a['query'][_0x6ef9('0x2c')]));_0x36fc7c[_0x6ef9('0x2a')]=_0x36fc7c[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x36fc7c[_0x6ef9('0x2a')]:_0x5afa59['model'];if(!_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x2d')](_0x6ef9('0x2e'))){_0x36fc7c[_0x6ef9('0x2f')]=qs[_0x6ef9('0x2f')](_0xca08a['query'][_0x6ef9('0x2f')]);_0x36fc7c[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x36fc7c[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x82')]);_0x36fc7c[_0x6ef9('0x34')]=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0xca08a[_0x6ef9('0x24')],_0x5afa59['filters']));_0x36fc7c['where']['ContactId']=_0x5e18b1['id'];if(_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x36fc7c[_0x6ef9('0x34')]=_[_0x6ef9('0x37')](_0x36fc7c['where'],{'$or':_[_0x6ef9('0x36')](_0x36fc7c['attributes'],function(_0x116c6e){var _0x211b70={};_0x211b70[_0x116c6e]={'$like':'%'+_0xca08a['query']['filter']+'%'};return _0x211b70;})});}_0x36fc7c=_[_0x6ef9('0x37')]({},_0x36fc7c,_0xca08a[_0x6ef9('0x7e')]);return db[_0x6ef9('0x5d')][_0x6ef9('0x16')]({'where':_0x36fc7c['where']})[_0x6ef9('0x1c')](function(_0x1e2447){_0x5d2bcc[_0x6ef9('0x16')]=_0x1e2447;if(_0xca08a[_0x6ef9('0x24')][_0x6ef9('0x85')]){_0x36fc7c['include']=[{'all':!![]}];}return db[_0x6ef9('0x5d')]['findAll'](_0x36fc7c);})[_0x6ef9('0x1c')](function(_0x409195){_0x5d2bcc['rows']=_0x409195;return _0x5d2bcc;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x1b1707,_0x36fc7c))['catch'](handleError(_0x1b1707,null));};exports[_0x6ef9('0x86')]=function(_0x1dfb3a,_0x5b5156,_0x2ff4db){var _0x17c0b4={'raw':!![],'where':{}};var _0x57d9dc={};var _0xcb310f={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')][_0x6ef9('0x7d')]({'where':{'id':_0x1dfb3a[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x5b5156,null))[_0x6ef9('0x1c')](function(_0x1606d0){if(_0x1606d0){_0x57d9dc[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x5c')][_0x6ef9('0x81')]);_0x57d9dc['query']=_[_0x6ef9('0x27')](_0x1dfb3a[_0x6ef9('0x24')]);_0x57d9dc[_0x6ef9('0x28')]=_[_0x6ef9('0x2b')](_0x57d9dc[_0x6ef9('0x29')],_0x57d9dc[_0x6ef9('0x24')]);_0x17c0b4[_0x6ef9('0x2a')]=_[_0x6ef9('0x2b')](_0x57d9dc['model'],qs['fields'](_0x1dfb3a[_0x6ef9('0x24')]['fields']));_0x17c0b4['attributes']=_0x17c0b4['attributes'][_0x6ef9('0x47')]?_0x17c0b4[_0x6ef9('0x2a')]:_0x57d9dc[_0x6ef9('0x29')];if(!_0x1dfb3a[_0x6ef9('0x24')][_0x6ef9('0x2d')]('nolimit')){_0x17c0b4['limit']=qs[_0x6ef9('0x2f')](_0x1dfb3a[_0x6ef9('0x24')]['limit']);_0x17c0b4[_0x6ef9('0x17')]=qs[_0x6ef9('0x17')](_0x1dfb3a['query']['offset']);}_0x17c0b4[_0x6ef9('0x30')]=qs[_0x6ef9('0x82')](_0x1dfb3a['query'][_0x6ef9('0x82')]);_0x17c0b4['where']=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0x1dfb3a[_0x6ef9('0x24')],_0x57d9dc['filters']));_0x17c0b4['where'][_0x6ef9('0x83')]=_0x1606d0['id'];if(_0x1dfb3a[_0x6ef9('0x24')]['filter']){_0x17c0b4['where']=_[_0x6ef9('0x37')](_0x17c0b4[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x17c0b4[_0x6ef9('0x2a')],function(_0x50697e){var _0x5c702f={};_0x5c702f[_0x50697e]={'$like':'%'+_0x1dfb3a[_0x6ef9('0x24')][_0x6ef9('0x35')]+'%'};return _0x5c702f;})});}_0x17c0b4=_['merge']({},_0x17c0b4,_0x1dfb3a[_0x6ef9('0x7e')]);return db[_0x6ef9('0x5c')]['count']({'where':_0x17c0b4[_0x6ef9('0x34')]})[_0x6ef9('0x1c')](function(_0x67e04d){_0xcb310f[_0x6ef9('0x16')]=_0x67e04d;if(_0x1dfb3a[_0x6ef9('0x24')]['includeAll']){_0x17c0b4[_0x6ef9('0x38')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x6ef9('0x40')](_0x17c0b4);})[_0x6ef9('0x1c')](function(_0x14bd86){_0xcb310f[_0x6ef9('0x41')]=_0x14bd86;return _0xcb310f;});}})['then'](respondWithFilteredResult(_0x5b5156,_0x17c0b4))[_0x6ef9('0x42')](handleError(_0x5b5156,null));};exports['getJscriptySessions']=function(_0xb3fe4c,_0x272a34,_0x386baa){var _0x3375d7={'raw':!![],'where':{}};var _0x2d0607={};var _0x38dc35={'count':0x0,'rows':[]};return db[_0x6ef9('0x22')]['findOne']({'where':{'id':_0xb3fe4c[_0x6ef9('0x44')]['id']}})[_0x6ef9('0x1c')](handleEntityNotFound(_0x272a34,null))['then'](function(_0x5cd190){if(_0x5cd190){_0x2d0607[_0x6ef9('0x29')]=_[_0x6ef9('0x27')](db[_0x6ef9('0x64')][_0x6ef9('0x81')]);_0x2d0607[_0x6ef9('0x24')]=_[_0x6ef9('0x27')](_0xb3fe4c[_0x6ef9('0x24')]);_0x2d0607['filters']=_[_0x6ef9('0x2b')](_0x2d0607[_0x6ef9('0x29')],_0x2d0607[_0x6ef9('0x24')]);_0x3375d7[_0x6ef9('0x2a')]=_['intersection'](_0x2d0607['model'],qs[_0x6ef9('0x2c')](_0xb3fe4c['query'][_0x6ef9('0x2c')]));_0x3375d7[_0x6ef9('0x2a')]=_0x3375d7[_0x6ef9('0x2a')][_0x6ef9('0x47')]?_0x3375d7['attributes']:_0x2d0607[_0x6ef9('0x29')];if(!_0xb3fe4c[_0x6ef9('0x24')]['hasOwnProperty'](_0x6ef9('0x2e'))){_0x3375d7[_0x6ef9('0x2f')]=qs['limit'](_0xb3fe4c['query']['limit']);_0x3375d7[_0x6ef9('0x17')]=qs['offset'](_0xb3fe4c[_0x6ef9('0x24')][_0x6ef9('0x17')]);}_0x3375d7['order']=qs[_0x6ef9('0x82')](_0xb3fe4c['query'][_0x6ef9('0x82')]);_0x3375d7[_0x6ef9('0x34')]=qs[_0x6ef9('0x28')](_[_0x6ef9('0x31')](_0xb3fe4c[_0x6ef9('0x24')],_0x2d0607[_0x6ef9('0x28')]));_0x3375d7[_0x6ef9('0x34')][_0x6ef9('0x83')]=_0x5cd190['id'];if(_0xb3fe4c[_0x6ef9('0x24')][_0x6ef9('0x35')]){_0x3375d7[_0x6ef9('0x34')]=_['merge'](_0x3375d7[_0x6ef9('0x34')],{'$or':_[_0x6ef9('0x36')](_0x3375d7[_0x6ef9('0x2a')],function(_0x4795f1){var _0x277279={};_0x277279[_0x4795f1]={'$like':'%'+_0xb3fe4c[_0x6ef9('0x24')]['filter']+'%'};return _0x277279;})});}_0x3375d7=_[_0x6ef9('0x37')]({},_0x3375d7,_0xb3fe4c['options']);return db[_0x6ef9('0x64')][_0x6ef9('0x16')]({'where':_0x3375d7[_0x6ef9('0x34')]})['then'](function(_0x2a46c3){_0x38dc35[_0x6ef9('0x16')]=_0x2a46c3;if(_0xb3fe4c['query'][_0x6ef9('0x85')]){_0x3375d7[_0x6ef9('0x38')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x3375d7);})[_0x6ef9('0x1c')](function(_0x11b450){_0x38dc35[_0x6ef9('0x41')]=_0x11b450;return _0x38dc35;});}})[_0x6ef9('0x1c')](respondWithFilteredResult(_0x272a34,_0x3375d7))[_0x6ef9('0x42')](handleError(_0x272a34,null));};exports[_0x6ef9('0x87')]=function(_0x1e2904,_0x45cf15,_0x7e9af8){try{if(!_0x1e2904[_0x6ef9('0x45')]['ListId']){throw new Error(_0x6ef9('0x88'));}if(!_0x1e2904['body'][_0x6ef9('0x89')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1e2904[_0x6ef9('0x45')]['binding_values']){throw new Error(_0x6ef9('0x8a'));}if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x8b')]){throw new Error(_0x6ef9('0x8c'));}var _0x4be3fe=_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x89')][_0x6ef9('0x8d')](',');var _0x34cf7c=_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x8e')][_0x6ef9('0x8d')](',');if(!_0x4be3fe[_0x6ef9('0x47')]||!_0x34cf7c[_0x6ef9('0x47')]||_0x4be3fe[_0x6ef9('0x47')]!==_0x34cf7c[_0x6ef9('0x47')]){throw new Error(_0x6ef9('0x8f'));}_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')]=_[_0x6ef9('0x90')](_0x4be3fe,_0x34cf7c);if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')][_0x6ef9('0x7b')]){throw new Error(_0x6ef9('0x91'));}if(!_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x2c')]['firstName']){throw new Error(_0x6ef9('0x92'));}var _0x546059=path[_0x6ef9('0x4c')](config[_0x6ef9('0x93')],_0x6ef9('0x94'),_0x1e2904[_0x6ef9('0x95')][_0x6ef9('0x96')]);fs[_0x6ef9('0x97')](_0x546059,parseInt(_0x6ef9('0x98'),0x8));var _0xde91c9=require(_0x6ef9('0x99'))['fork'](path[_0x6ef9('0x4c')](__dirname,_0x6ef9('0x9a')),[_0x546059,_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x89')],_0x1e2904['body'][_0x6ef9('0x8e')],_0x1e2904[_0x6ef9('0x45')]['ListId'],_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x9b')],_0x1e2904[_0x6ef9('0x45')][_0x6ef9('0x67')],_0x1e2904['body']['socket_timestamp']]);return _0x45cf15[_0x6ef9('0x14')](0xc8)[_0x6ef9('0x19')]({'message':_0x6ef9('0x9c'),'pid':_0xde91c9[_0x6ef9('0x9d')]});}catch(_0x5b94bb){return _0x45cf15[_0x6ef9('0x14')](0x1f4)[_0x6ef9('0x20')](_0x5b94bb);}};exports[_0x6ef9('0x9e')]=function(_0x3f713b,_0x5f49dd,_0x1c803c){var _0x3add6b=fs[_0x6ef9('0x9f')](_0x3f713b[_0x6ef9('0x95')][_0x6ef9('0x4')]);Papa[_0x6ef9('0xa0')](_0x3add6b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1cfbef){return _0x5f49dd['status'](0xc8)[_0x6ef9('0x19')]({'file':_0x3f713b['file'],'fields':_0x1cfbef[_0x6ef9('0xa1')][_0x6ef9('0x2c')]});}});};exports['import']=function(_0x310bdb,_0x1705a6,_0x3e1448){return db[_0x6ef9('0xa2')][_0x6ef9('0x40')]({'raw':!![],'attributes':['id'],'where':{'role':_0x6ef9('0xa3')}})[_0x6ef9('0x1c')](function(_0xf8f9d5){var _0x4ac0ba=![];if(!_0x310bdb['body'][_0x6ef9('0x69')]){throw new Error('No\x20ListId\x20specified');}if(!_0x310bdb['body']['binding']['phone']){throw new Error(_0x6ef9('0x91'));}if(!_0x310bdb[_0x6ef9('0x45')][_0x6ef9('0xa4')][_0x6ef9('0xa5')]){throw new Error(_0x6ef9('0x92'));}if(!_0x310bdb[_0x6ef9('0x45')][_0x6ef9('0x8b')]){throw new Error(_0x6ef9('0x8c'));}var _0x29dc7e=require(_0x6ef9('0x99'))[_0x6ef9('0xa6')](path['join'](__dirname,'../../components/import/cm/csv2'),[_0x310bdb[_0x6ef9('0x44')]['id'],JSON['stringify'](_0x310bdb['body']),JSON[_0x6ef9('0xa7')](_0xf8f9d5)]);_0x29dc7e['on'](_0x6ef9('0xa8'),function(_0x130596){_0x4ac0ba=!![];return _0x1705a6[_0x6ef9('0x14')](0xc8)['json']({'message':_0x6ef9('0xa9'),'pid':_0x29dc7e['pid']});});_0x29dc7e['on'](_0x6ef9('0xaa'),function(_0x203f79){if(_0x203f79&&!_0x4ac0ba){return _0x1705a6[_0x6ef9('0x14')](0x1f4)[_0x6ef9('0x19')]({'message':_0x6ef9('0xab'),'pid':_0x29dc7e[_0x6ef9('0x9d')]});}});})[_0x6ef9('0x42')](handleError(_0x1705a6,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index f22e48c..7e58e42 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 _0xe764=['setMaxListeners','save','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xba1056,_0x375a7b){var _0x419f99=function(_0x1d9f2d){while(--_0x1d9f2d){_0xba1056['push'](_0xba1056['shift']());}};_0x419f99(++_0x375a7b);}(_0xe764,0x9e));var _0x4e76=function(_0x368bba,_0x1f625b){_0x368bba=_0x368bba-0x0;var _0x409f8f=_0xe764[_0x368bba];return _0x409f8f;};'use strict';var EventEmitter=require(_0x4e76('0x0'));var CmContact=require(_0x4e76('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x4e76('0x2')](0x0);var events={'afterCreate':_0x4e76('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5f24bc){return function(_0x48d19a,_0x4e87b5,_0x4728bb){CmContactEvents[_0x4e76('0x4')](_0x5f24bc+':'+_0x48d19a['id'],_0x48d19a);CmContactEvents[_0x4e76('0x4')](_0x5f24bc,_0x48d19a);_0x4728bb(null);};}for(var e in events){if(events[_0x4e76('0x5')](e)){var event=events[e];CmContact[_0x4e76('0x6')](e,emitEvent(event));}}module[_0x4e76('0x7')]=CmContactEvents; \ No newline at end of file +var _0x2765=['CmContact','save','update','remove','emit','hasOwnProperty','hook'];(function(_0xafcc1c,_0xc96d6d){var _0xd87363=function(_0x4e705a){while(--_0x4e705a){_0xafcc1c['push'](_0xafcc1c['shift']());}};_0xd87363(++_0xc96d6d);}(_0x2765,0x19d));var _0x5276=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2765[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require('events');var CmContact=require('../../mysqldb')['db'][_0x5276('0x0')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5276('0x1'),'afterUpdate':_0x5276('0x2'),'afterDestroy':_0x5276('0x3')};function emitEvent(_0x36eaf8){return function(_0x5bb0ce,_0x314e50,_0x153297){CmContactEvents['emit'](_0x36eaf8+':'+_0x5bb0ce['id'],_0x5bb0ce);CmContactEvents[_0x5276('0x4')](_0x36eaf8,_0x5bb0ce);_0x153297(null);};}for(var e in events){if(events[_0x5276('0x5')](e)){var event=events[e];CmContact[_0x5276('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 0eeb92f..fd809c4 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 _0xee68=['\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','VoiceQueue','findAll','outbound','dialCheckDuplicateType','length','always','onlyIfOpen','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','Lists','BlackLists','List\x20not\x20found','isEmpty','destroy','ContactId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','bluebird','request-promise','exports','define','CmContact','phone','models','get','error','cmContact','inspect','findOne','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','priority','scheduledAt','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','afterCreate'];(function(_0x33cb5f,_0x333504){var _0x39502a=function(_0x198a7e){while(--_0x198a7e){_0x33cb5f['push'](_0x33cb5f['shift']());}};_0x39502a(++_0x333504);}(_0xee68,0x17c));var _0x8ee6=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xee68[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x8ee6('0x0'));var util=require('util');var logger=require(_0x8ee6('0x1'))(_0x8ee6('0x2'));var moment=require('moment');var BPromise=require(_0x8ee6('0x3'));var rp=require(_0x8ee6('0x4'));var attributes=require('./cmContact.attributes');module[_0x8ee6('0x5')]=function(_0xc10f70,_0x12b146){return _0xc10f70[_0x8ee6('0x6')](_0x8ee6('0x7'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x8ee6('0x8'),'fields':[_0x8ee6('0x8')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fab7f,_0x5d9d7a,_0x484eb8){var _0x51203b=_0xc10f70[_0x8ee6('0x9')];var _0x312d2e=_0x2fab7f[_0x8ee6('0xa')]({'plain':!![]});function _0x24e5be(){return function(_0xabd937){logger[_0x8ee6('0xb')](_0x8ee6('0xc'),'afterCreate',util[_0x8ee6('0xd')](_0xabd937,{'showHidden':![],'depth':null}));};}var _0x56e1a6=function(_0x319985){return new BPromise(function(_0x1e5271,_0x2a9a90){_0x51203b['CmHopper'][_0x8ee6('0xe')]({'where':{'phone':_0x312d2e[_0x8ee6('0x8')],'VoiceQueueId':_0x319985['id']}})['then'](function(_0x405b5d){if(!_[_0x8ee6('0xf')](_0x405b5d)){throw new Error(_0x8ee6('0x10')+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x11')+_0x319985['id']);}return _0x51203b[_0x8ee6('0x12')][_0x8ee6('0x13')]({'phone':_0x312d2e['phone'],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e['ListId'],'priority':_0x312d2e[_0x8ee6('0x14')]?_0x312d2e[_0x8ee6('0x14')]:0x2,'scheduledat':_0x312d2e[_0x8ee6('0x15')]?_0x312d2e['scheduledAt']:moment()[_0x8ee6('0x16')](_0x8ee6('0x17')),'callback':_0x312d2e[_0x8ee6('0x18')]?!![]:![],'callbackuniqueid':_0x312d2e[_0x8ee6('0x18')]?_0x312d2e[_0x8ee6('0x18')]:undefined,'callbackat':_0x312d2e[_0x8ee6('0x18')]?moment()[_0x8ee6('0x16')](_0x8ee6('0x17')):undefined,'VoiceQueueId':_0x319985['id']});})[_0x8ee6('0x19')](function(_0x32d704){_0x2a9a90(_0x32d704);});});};var _0x2afdee=function(_0x1fce8e){return new BPromise(function(_0x4a42e4,_0x4b70f9){_0x51203b['CmHopper']['findOne']({'where':{'phone':_0x312d2e['phone'],'VoiceQueueId':_0x1fce8e['id']}})[_0x8ee6('0x1a')](function(_0x24db76){if(!_[_0x8ee6('0xf')](_0x24db76)){throw new Error('cmContact,\x20afterCreate\x20'+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x1b')+_0x1fce8e['id']);}return _0x51203b[_0x8ee6('0x1c')][_0x8ee6('0xe')]({'where':{'calleridnum':_0x312d2e[_0x8ee6('0x8')],'VoiceQueueId':_0x1fce8e['id']}});})['then'](function(_0xadfc25){if(!_[_0x8ee6('0xf')](_0xadfc25)){throw new Error(_0x8ee6('0x1d')+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x1e')+_0x1fce8e['id']);}return _0x51203b['CmHopper']['create']({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'priority':_0x312d2e[_0x8ee6('0x14')]?_0x312d2e[_0x8ee6('0x14')]:0x2,'scheduledat':_0x312d2e['scheduledAt']?_0x312d2e['scheduledAt']:moment()[_0x8ee6('0x16')](_0x8ee6('0x17')),'callback':_0x312d2e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x312d2e[_0x8ee6('0x18')]?_0x312d2e['callbackUniqueid']:undefined,'callbackat':_0x312d2e['callbackUniqueid']?moment()[_0x8ee6('0x16')](_0x8ee6('0x17')):undefined,'VoiceQueueId':_0x1fce8e['id']});})[_0x8ee6('0x19')](function(_0x38e2ac){_0x4b70f9(_0x38e2ac);});});};function _0x45bd45(){return function(_0x878a95){logger[_0x8ee6('0xb')](_0x8ee6('0xc'),_0x8ee6('0x20'),util[_0x8ee6('0xd')](_0x878a95,{'showHidden':![],'depth':null}));};}var _0x58d14f=function(_0x50e650){return new BPromise(function(_0x55e1fb,_0x2fda35){_0x51203b['CmHopper'][_0x8ee6('0xe')]({'where':{'phone':_0x312d2e[_0x8ee6('0x8')],'CampaignId':_0x50e650['id']}})[_0x8ee6('0x1a')](function(_0x124aa6){if(!_[_0x8ee6('0xf')](_0x124aa6)){throw new Error('cmContact,\x20afterCreate\x20'+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x21')+_0x50e650['id']);}return _0x51203b[_0x8ee6('0x12')]['create']({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'priority':_0x312d2e['priority']?_0x312d2e[_0x8ee6('0x14')]:0x2,'scheduledat':_0x312d2e['scheduledAt']?_0x312d2e[_0x8ee6('0x15')]:moment()[_0x8ee6('0x16')](_0x8ee6('0x17')),'callback':_0x312d2e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x312d2e[_0x8ee6('0x18')]?_0x312d2e[_0x8ee6('0x18')]:undefined,'callbackat':_0x312d2e[_0x8ee6('0x18')]?moment()[_0x8ee6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x50e650['id']});})['catch'](function(_0x356863){_0x2fda35(_0x356863);});});};var _0x576545=function(_0x552018){return new BPromise(function(_0x14a52c,_0x100652){_0x51203b[_0x8ee6('0x12')][_0x8ee6('0xe')]({'where':{'phone':_0x312d2e[_0x8ee6('0x8')],'CampaignId':_0x552018['id']}})[_0x8ee6('0x1a')](function(_0x39e2eb){if(!_[_0x8ee6('0xf')](_0x39e2eb)){throw new Error(_0x8ee6('0x10')+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x22')+_0x552018['id']);}return _0x51203b[_0x8ee6('0x1c')][_0x8ee6('0xe')]({'where':{'calleridnum':_0x312d2e[_0x8ee6('0x8')],'CampaignId':_0x552018['id']}});})[_0x8ee6('0x1a')](function(_0x2fa873){if(!_['isNil'](_0x2fa873)){throw new Error(_0x8ee6('0x1d')+_0x312d2e[_0x8ee6('0x8')]+_0x8ee6('0x23')+_0x552018['id']);}return _0x51203b[_0x8ee6('0x12')][_0x8ee6('0x13')]({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'priority':_0x312d2e[_0x8ee6('0x14')]?_0x312d2e[_0x8ee6('0x14')]:0x2,'scheduledat':_0x312d2e[_0x8ee6('0x15')]?_0x312d2e[_0x8ee6('0x15')]:moment()[_0x8ee6('0x16')](_0x8ee6('0x17')),'callback':_0x312d2e[_0x8ee6('0x18')]?!![]:![],'callbackuniqueid':_0x312d2e['callbackUniqueid']?_0x312d2e['callbackUniqueid']:undefined,'callbackat':_0x312d2e[_0x8ee6('0x18')]?moment()[_0x8ee6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x552018['id']});})[_0x8ee6('0x19')](function(_0x3f73fd){_0x100652(_0x3f73fd);});});};if(_0x312d2e[_0x8ee6('0x1f')]){_0x51203b[_0x8ee6('0x24')][_0x8ee6('0x25')]({'where':{'type':_0x8ee6('0x26')},'attributes':['id',_0x8ee6('0x27')],'include':[{'model':_0x51203b['CmList'],'as':'Lists','where':{'id':_0x312d2e[_0x8ee6('0x1f')]}}]})[_0x8ee6('0x1a')](function(_0x5c39bd){if(_0x5c39bd){var _0x2f57c4=[];for(var _0x18133c=0x0,_0x2fc72d;_0x18133c<_0x5c39bd[_0x8ee6('0x28')];_0x18133c+=0x1){_0x2fc72d=_0x5c39bd[_0x18133c][_0x8ee6('0xa')]({'plain':!![]});switch(_0x2fc72d[_0x8ee6('0x27')]){case _0x8ee6('0x29'):_0x2afdee(_0x2fc72d)['catch'](_0x24e5be());break;case _0x8ee6('0x2a'):_0x56e1a6(_0x2fc72d)[_0x8ee6('0x19')](_0x24e5be());break;default:_0x51203b['CmHopper'][_0x8ee6('0x13')]({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e['ListId'],'scheduledat':_0x312d2e['scheduledAt']?_0x312d2e[_0x8ee6('0x15')]:moment()[_0x8ee6('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x312d2e[_0x8ee6('0x14')]?_0x312d2e[_0x8ee6('0x14')]:0x2,'callback':_0x312d2e[_0x8ee6('0x18')]?!![]:![],'callbackuniqueid':_0x312d2e[_0x8ee6('0x18')]?_0x312d2e[_0x8ee6('0x18')]:undefined,'callbackat':_0x312d2e[_0x8ee6('0x18')]?moment()[_0x8ee6('0x16')](_0x8ee6('0x17')):undefined,'VoiceQueueId':_0x2fc72d['id']})['catch'](_0x24e5be());}}}})[_0x8ee6('0x1a')](function(){return _0x51203b[_0x8ee6('0x24')][_0x8ee6('0x25')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x51203b[_0x8ee6('0x2b')],'as':'BlackLists','where':{'id':_0x312d2e[_0x8ee6('0x1f')]}}]})[_0x8ee6('0x1a')](function(_0x29d5cc){if(_0x29d5cc){var _0x35fa90=[];for(var _0x264b3d=0x0,_0x113d6b;_0x264b3d<_0x29d5cc[_0x8ee6('0x28')];_0x264b3d+=0x1){_0x113d6b=_0x29d5cc[_0x264b3d][_0x8ee6('0xa')]({'plain':!![]});_0x51203b[_0x8ee6('0x2c')][_0x8ee6('0x13')]({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'VoiceQueueId':_0x113d6b['id']})['catch'](function(_0x175b4d){logger['error'](_0x8ee6('0x2d'),_0x8ee6('0x20'),_0x175b4d[_0x8ee6('0x2e')]);});}}});})['then'](function(){return _0x51203b[_0x8ee6('0x2f')][_0x8ee6('0x25')]({'attributes':['id',_0x8ee6('0x27')],'include':[{'model':_0x51203b[_0x8ee6('0x2b')],'as':_0x8ee6('0x30'),'where':{'id':_0x312d2e[_0x8ee6('0x1f')]}}]})['then'](function(_0x5bd72a){if(_0x5bd72a){var _0x2af8a1=[];for(var _0x3da6a8=0x0,_0x22c499;_0x3da6a8<_0x5bd72a[_0x8ee6('0x28')];_0x3da6a8+=0x1){_0x22c499=_0x5bd72a[_0x3da6a8][_0x8ee6('0xa')]({'plain':!![]});switch(_0x22c499[_0x8ee6('0x27')]){case _0x8ee6('0x29'):_0x576545(_0x22c499)['catch'](_0x45bd45());break;case _0x8ee6('0x2a'):_0x58d14f(_0x22c499)[_0x8ee6('0x19')](_0x45bd45());break;default:_0x51203b[_0x8ee6('0x12')][_0x8ee6('0x13')]({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'scheduledat':_0x312d2e[_0x8ee6('0x15')]?_0x312d2e['scheduledAt']:moment()['format'](_0x8ee6('0x17')),'priority':_0x312d2e[_0x8ee6('0x14')]?_0x312d2e[_0x8ee6('0x14')]:0x2,'callback':_0x312d2e[_0x8ee6('0x18')]?!![]:![],'callbackuniqueid':_0x312d2e['callbackUniqueid']?_0x312d2e[_0x8ee6('0x18')]:undefined,'callbackat':_0x312d2e[_0x8ee6('0x18')]?moment()[_0x8ee6('0x16')](_0x8ee6('0x17')):undefined,'CampaignId':_0x22c499['id']})[_0x8ee6('0x19')](_0x45bd45());}}}});})[_0x8ee6('0x1a')](function(){return _0x51203b[_0x8ee6('0x2f')]['findAll']({'attributes':['id'],'include':[{'model':_0x51203b[_0x8ee6('0x2b')],'as':_0x8ee6('0x31'),'where':{'id':_0x312d2e[_0x8ee6('0x1f')]}}]})[_0x8ee6('0x1a')](function(_0x158591){if(_0x158591){var _0x15090f=[];for(var _0x46756d=0x0,_0x474e80;_0x46756d<_0x158591[_0x8ee6('0x28')];_0x46756d+=0x1){_0x474e80=_0x158591[_0x46756d][_0x8ee6('0xa')]({'plain':!![]});_0x51203b[_0x8ee6('0x2c')]['create']({'phone':_0x312d2e[_0x8ee6('0x8')],'ContactId':_0x312d2e['id'],'ListId':_0x312d2e[_0x8ee6('0x1f')],'CampaignId':_0x474e80['id']})['catch'](function(_0x4daee4){logger[_0x8ee6('0xb')]('cmContact,\x20%s,\x20%s',_0x8ee6('0x20'),_0x4daee4['message']);});}}});})[_0x8ee6('0x1a')](function(){_0x484eb8();})[_0x8ee6('0x19')](function(_0x200a76){logger['error'](_0x8ee6('0x2d'),_0x8ee6('0x20'),_0x200a76['message']);_0x484eb8(_0x200a76);});}else{_0x484eb8(new Error(_0x8ee6('0x32')));}},'afterDestroy':function(_0x3288ad,_0x56ad32,_0x2c2ed8){var _0x5e323c=_0xc10f70[_0x8ee6('0x9')];var _0x47df1b=_0x3288ad[_0x8ee6('0xa')]({'plain':!![]});return _0x5e323c['CmHopper']['findAll']({'raw':!![],'where':{'ListId':_0x47df1b['ListId'],'ContactId':_0x47df1b['id']}})['then'](function(_0x32df24){if(!_[_0x8ee6('0x33')](_0x32df24)){var _0x58d5d2=[];for(var _0x28f5e8=0x0;_0x28f5e8<_0x32df24[_0x8ee6('0x28')];_0x28f5e8+=0x1){var _0x4ea589=_0x5e323c['CmHopper'][_0x8ee6('0x34')]({'where':{'ListId':_0x32df24[_0x28f5e8]['ListId'],'ContactId':_0x32df24[_0x28f5e8][_0x8ee6('0x35')],'VoiceQueueId':_0x32df24[_0x28f5e8]['VoiceQueueId'],'CampaignId':_0x32df24[_0x28f5e8][_0x8ee6('0x36')]}});_0x58d5d2['push'](_0x4ea589);}return BPromise[_0x8ee6('0x37')](_0x58d5d2);}})[_0x8ee6('0x1a')](function(_0x46630b){logger[_0x8ee6('0x38')](_0x8ee6('0x39'),util['inspect'](_0x46630b,{'showHidden':![],'depth':null}));_0x2c2ed8();})[_0x8ee6('0x19')](function(_0x16441f){logger[_0x8ee6('0xb')](_0x8ee6('0x3a'),util[_0x8ee6('0xd')](_0x16441f,{'showHidden':![],'depth':null}));_0x2c2ed8(_0x16441f);});}}});}; \ No newline at end of file +var _0x6610=['length','dialCheckDuplicateType','onlyIfOpen','outbound','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','always','List\x20not\x20found','destroy','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','api','moment','request-promise','./cmContact.attributes','exports','define','CmContact','cm_contacts','phone','models','get','error','afterCreate','inspect','then','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','priority','scheduledAt','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','CmHopper','findOne','isNil','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','ListId','cmContact','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','CmList','Lists'];(function(_0x4fccf2,_0xed0aa3){var _0x1b29f9=function(_0x4adb94){while(--_0x4adb94){_0x4fccf2['push'](_0x4fccf2['shift']());}};_0x1b29f9(++_0xed0aa3);}(_0x6610,0x138));var _0x0661=function(_0x2de60d,_0xdb1add){_0x2de60d=_0x2de60d-0x0;var _0xceae08=_0x6610[_0x2de60d];return _0xceae08;};'use strict';var _=require(_0x0661('0x0'));var util=require(_0x0661('0x1'));var logger=require('../../config/logger')(_0x0661('0x2'));var moment=require(_0x0661('0x3'));var BPromise=require('bluebird');var rp=require(_0x0661('0x4'));var attributes=require(_0x0661('0x5'));module[_0x0661('0x6')]=function(_0x421b6b,_0x4062d1){return _0x421b6b[_0x0661('0x7')](_0x0661('0x8'),attributes,{'tableName':_0x0661('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x0661('0xa')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3599a6,_0x23b9e1,_0x3db2c9){var _0x433a04=_0x421b6b[_0x0661('0xb')];var _0x9559fa=_0x3599a6[_0x0661('0xc')]({'plain':!![]});function _0x58979e(){return function(_0x16b6c0){logger[_0x0661('0xd')]('cmContact',_0x0661('0xe'),util[_0x0661('0xf')](_0x16b6c0,{'showHidden':![],'depth':null}));};}var _0x471a78=function(_0x2fcc95){return new BPromise(function(_0x3f9514,_0x5580c3){_0x433a04['CmHopper']['findOne']({'where':{'phone':_0x9559fa[_0x0661('0xa')],'VoiceQueueId':_0x2fcc95['id']}})[_0x0661('0x10')](function(_0x45dace){if(!_['isNil'](_0x45dace)){throw new Error(_0x0661('0x11')+_0x9559fa['phone']+_0x0661('0x12')+_0x2fcc95['id']);}return _0x433a04['CmHopper'][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x9559fa[_0x0661('0x18')]?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x2fcc95['id']});})['catch'](function(_0x3c52f9){_0x5580c3(_0x3c52f9);});});};var _0x13a32e=function(_0x1a1d9f){return new BPromise(function(_0x1805f7,_0x2388c2){_0x433a04[_0x0661('0x19')][_0x0661('0x1a')]({'where':{'phone':_0x9559fa['phone'],'VoiceQueueId':_0x1a1d9f['id']}})[_0x0661('0x10')](function(_0x5c96af){if(!_[_0x0661('0x1b')](_0x5c96af)){throw new Error('cmContact,\x20afterCreate\x20'+_0x9559fa['phone']+_0x0661('0x1c')+_0x1a1d9f['id']);}return _0x433a04['CmHopperFinal'][_0x0661('0x1a')]({'where':{'calleridnum':_0x9559fa['phone'],'VoiceQueueId':_0x1a1d9f['id']}});})[_0x0661('0x10')](function(_0x325320){if(!_[_0x0661('0x1b')](_0x325320)){throw new Error(_0x0661('0x1d')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x1e')+_0x1a1d9f['id']);}return _0x433a04['CmHopper'][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x1a1d9f['id']});})['catch'](function(_0x137ef1){_0x2388c2(_0x137ef1);});});};function _0x342ac2(){return function(_0x7451eb){logger[_0x0661('0xd')](_0x0661('0x20'),'afterCreate',util['inspect'](_0x7451eb,{'showHidden':![],'depth':null}));};}var _0xb356d=function(_0x283d17){return new BPromise(function(_0x86ebcd,_0x6c0a34){_0x433a04[_0x0661('0x19')]['findOne']({'where':{'phone':_0x9559fa[_0x0661('0xa')],'CampaignId':_0x283d17['id']}})[_0x0661('0x10')](function(_0x46bee2){if(!_[_0x0661('0x1b')](_0x46bee2)){throw new Error(_0x0661('0x11')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x21')+_0x283d17['id']);}return _0x433a04[_0x0661('0x19')][_0x0661('0x13')]({'phone':_0x9559fa['phone'],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'CampaignId':_0x283d17['id']});})[_0x0661('0x22')](function(_0x391404){_0x6c0a34(_0x391404);});});};var _0x5622ba=function(_0x435bc8){return new BPromise(function(_0x193f1f,_0x4a6531){_0x433a04[_0x0661('0x19')][_0x0661('0x1a')]({'where':{'phone':_0x9559fa['phone'],'CampaignId':_0x435bc8['id']}})[_0x0661('0x10')](function(_0x48eadb){if(!_[_0x0661('0x1b')](_0x48eadb)){throw new Error(_0x0661('0x11')+_0x9559fa['phone']+_0x0661('0x23')+_0x435bc8['id']);}return _0x433a04[_0x0661('0x24')][_0x0661('0x1a')]({'where':{'calleridnum':_0x9559fa['phone'],'CampaignId':_0x435bc8['id']}});})[_0x0661('0x10')](function(_0x4cb79f){if(!_[_0x0661('0x1b')](_0x4cb79f)){throw new Error(_0x0661('0x1d')+_0x9559fa[_0x0661('0xa')]+_0x0661('0x25')+_0x435bc8['id']);}return _0x433a04[_0x0661('0x19')]['create']({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'scheduledat':_0x9559fa['scheduledAt']?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa['callbackUniqueid']?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'CampaignId':_0x435bc8['id']});})[_0x0661('0x22')](function(_0x3a2dfc){_0x4a6531(_0x3a2dfc);});});};if(_0x9559fa[_0x0661('0x1f')]){_0x433a04[_0x0661('0x26')][_0x0661('0x27')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x29'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x26672e){if(_0x26672e){var _0x2ab115=[];for(var _0x464e4f=0x0,_0x409212;_0x464e4f<_0x26672e[_0x0661('0x2a')];_0x464e4f+=0x1){_0x409212=_0x26672e[_0x464e4f][_0x0661('0xc')]({'plain':!![]});switch(_0x409212[_0x0661('0x2b')]){case'always':_0x13a32e(_0x409212)['catch'](_0x58979e());break;case _0x0661('0x2c'):_0x471a78(_0x409212)[_0x0661('0x22')](_0x58979e());break;default:_0x433a04[_0x0661('0x19')]['create']({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa[_0x0661('0x15')]:moment()[_0x0661('0x16')](_0x0661('0x17')),'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa[_0x0661('0x18')]?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()[_0x0661('0x16')](_0x0661('0x17')):undefined,'VoiceQueueId':_0x409212['id']})[_0x0661('0x22')](_0x58979e());}}}})[_0x0661('0x10')](function(){return _0x433a04['VoiceQueue'][_0x0661('0x27')]({'where':{'type':_0x0661('0x2d')},'attributes':['id'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x2e'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x226552){if(_0x226552){var _0x459e89=[];for(var _0x35ae14=0x0,_0x376fea;_0x35ae14<_0x226552[_0x0661('0x2a')];_0x35ae14+=0x1){_0x376fea=_0x226552[_0x35ae14][_0x0661('0xc')]({'plain':!![]});_0x433a04[_0x0661('0x2f')][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'VoiceQueueId':_0x376fea['id']})[_0x0661('0x22')](function(_0xd8a222){logger['error'](_0x0661('0x30'),'afterCreate',_0xd8a222[_0x0661('0x31')]);});}}});})[_0x0661('0x10')](function(){return _0x433a04[_0x0661('0x32')][_0x0661('0x27')]({'attributes':['id',_0x0661('0x2b')],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x29'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})[_0x0661('0x10')](function(_0x14279a){if(_0x14279a){var _0x31bf87=[];for(var _0x344931=0x0,_0x440500;_0x344931<_0x14279a[_0x0661('0x2a')];_0x344931+=0x1){_0x440500=_0x14279a[_0x344931][_0x0661('0xc')]({'plain':!![]});switch(_0x440500[_0x0661('0x2b')]){case _0x0661('0x33'):_0x5622ba(_0x440500)[_0x0661('0x22')](_0x342ac2());break;case _0x0661('0x2c'):_0xb356d(_0x440500)[_0x0661('0x22')](_0x342ac2());break;default:_0x433a04[_0x0661('0x19')][_0x0661('0x13')]({'phone':_0x9559fa[_0x0661('0xa')],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa[_0x0661('0x1f')],'scheduledat':_0x9559fa[_0x0661('0x15')]?_0x9559fa['scheduledAt']:moment()[_0x0661('0x16')](_0x0661('0x17')),'priority':_0x9559fa[_0x0661('0x14')]?_0x9559fa[_0x0661('0x14')]:0x2,'callback':_0x9559fa[_0x0661('0x18')]?!![]:![],'callbackuniqueid':_0x9559fa['callbackUniqueid']?_0x9559fa[_0x0661('0x18')]:undefined,'callbackat':_0x9559fa[_0x0661('0x18')]?moment()['format'](_0x0661('0x17')):undefined,'CampaignId':_0x440500['id']})[_0x0661('0x22')](_0x342ac2());}}}});})['then'](function(){return _0x433a04[_0x0661('0x32')][_0x0661('0x27')]({'attributes':['id'],'include':[{'model':_0x433a04[_0x0661('0x28')],'as':_0x0661('0x2e'),'where':{'id':_0x9559fa[_0x0661('0x1f')]}}]})['then'](function(_0x5b67d1){if(_0x5b67d1){var _0x285fe4=[];for(var _0x5956d8=0x0,_0x1d0a68;_0x5956d8<_0x5b67d1[_0x0661('0x2a')];_0x5956d8+=0x1){_0x1d0a68=_0x5b67d1[_0x5956d8]['get']({'plain':!![]});_0x433a04[_0x0661('0x2f')][_0x0661('0x13')]({'phone':_0x9559fa['phone'],'ContactId':_0x9559fa['id'],'ListId':_0x9559fa['ListId'],'CampaignId':_0x1d0a68['id']})[_0x0661('0x22')](function(_0x520316){logger[_0x0661('0xd')](_0x0661('0x30'),_0x0661('0xe'),_0x520316[_0x0661('0x31')]);});}}});})['then'](function(){_0x3db2c9();})['catch'](function(_0x4145aa){logger['error']('cmContact,\x20%s,\x20%s',_0x0661('0xe'),_0x4145aa['message']);_0x3db2c9(_0x4145aa);});}else{_0x3db2c9(new Error(_0x0661('0x34')));}},'afterDestroy':function(_0x530d99,_0x15b36e,_0x56ec20){var _0x4dbc6a=_0x421b6b[_0x0661('0xb')];var _0x174513=_0x530d99[_0x0661('0xc')]({'plain':!![]});return _0x4dbc6a[_0x0661('0x19')][_0x0661('0x27')]({'raw':!![],'where':{'ListId':_0x174513[_0x0661('0x1f')],'ContactId':_0x174513['id']}})[_0x0661('0x10')](function(_0x32a018){if(!_['isEmpty'](_0x32a018)){var _0x5c33c1=[];for(var _0xb225fc=0x0;_0xb225fc<_0x32a018['length'];_0xb225fc+=0x1){var _0x48e3fc=_0x4dbc6a['CmHopper'][_0x0661('0x35')]({'where':{'ListId':_0x32a018[_0xb225fc][_0x0661('0x1f')],'ContactId':_0x32a018[_0xb225fc]['ContactId'],'VoiceQueueId':_0x32a018[_0xb225fc][_0x0661('0x36')],'CampaignId':_0x32a018[_0xb225fc]['CampaignId']}});_0x5c33c1[_0x0661('0x37')](_0x48e3fc);}return BPromise[_0x0661('0x38')](_0x5c33c1);}})[_0x0661('0x10')](function(_0x1e9eb3){logger[_0x0661('0x39')](_0x0661('0x3a'),util[_0x0661('0xf')](_0x1e9eb3,{'showHidden':![],'depth':null}));_0x56ec20();})[_0x0661('0x22')](function(_0x4092e0){logger['error']('[CmContact][afterDestroy][Error]',util[_0x0661('0xf')](_0x4092e0,{'showHidden':![],'depth':null}));_0x56ec20(_0x4092e0);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index ac5d66f..4e26714 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 _0x9513=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./cmContact.socket','request','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowCmContact','CmContact','options','raw','attributes','include','map','model','then','CreateCmContact','body','lodash','moment','bluebird'];(function(_0x31ed0f,_0x4e649d){var _0x44dab5=function(_0x16283d){while(--_0x16283d){_0x31ed0f['push'](_0x31ed0f['shift']());}};_0x44dab5(++_0x4e649d);}(_0x9513,0x12d));var _0x3951=function(_0x2f1064,_0x26236b){_0x2f1064=_0x2f1064-0x0;var _0xadb96d=_0x9513[_0x2f1064];return _0xadb96d;};'use strict';var _=require(_0x3951('0x0'));var util=require('util');var moment=require(_0x3951('0x1'));var BPromise=require(_0x3951('0x2'));var rs=require(_0x3951('0x3'));var fs=require('fs');var db=require(_0x3951('0x4'))['db'];var utils=require(_0x3951('0x5'));var logger=require(_0x3951('0x6'))(_0x3951('0x7'));var config=require(_0x3951('0x8'));var jayson=require(_0x3951('0x9'));var client=jayson[_0x3951('0xa')][_0x3951('0xb')]({'port':0x232a});var socket=require(_0x3951('0xc'))({'host':_0x3951('0xd'),'port':0x18eb});require(_0x3951('0xe'))['register'](socket);function respondWithRpcPromise(_0x29f502,_0x51c7ae,_0x13b161){return new BPromise(function(_0x27f5b5,_0x3be539){return client[_0x3951('0xf')](_0x29f502,_0x13b161)['then'](function(_0x3d4b85){logger[_0x3951('0x10')](_0x3951('0x11'),_0x51c7ae,_0x3951('0x12'));logger[_0x3951('0x13')](_0x3951('0x14'),_0x51c7ae,_0x3951('0x12'),JSON[_0x3951('0x15')](_0x3d4b85));if(_0x3d4b85[_0x3951('0x16')]){if(_0x3d4b85[_0x3951('0x16')][_0x3951('0x17')]===0x1f4){logger['error']('CmContact,\x20%s,\x20%s',_0x51c7ae,_0x3d4b85[_0x3951('0x16')][_0x3951('0x18')]);return _0x3be539(_0x3d4b85['error'][_0x3951('0x18')]);}logger[_0x3951('0x16')](_0x3951('0x11'),_0x51c7ae,_0x3d4b85[_0x3951('0x16')][_0x3951('0x18')]);return _0x27f5b5(_0x3d4b85[_0x3951('0x16')][_0x3951('0x18')]);}else{logger[_0x3951('0x10')](_0x3951('0x11'),_0x51c7ae,_0x3951('0x12'));_0x27f5b5(_0x3d4b85[_0x3951('0x19')][_0x3951('0x18')]);}})[_0x3951('0x1a')](function(_0xfd46ad){logger['error'](_0x3951('0x11'),_0x51c7ae,_0xfd46ad);_0x3be539(_0xfd46ad);});});}exports[_0x3951('0x1b')]=function(_0x924b3f){var _0x1fca2c=this;return new Promise(function(_0x497f2d,_0x2268a8){return db[_0x3951('0x1c')]['find']({'raw':_0x924b3f[_0x3951('0x1d')]?_0x924b3f[_0x3951('0x1d')][_0x3951('0x1e')]===undefined?!![]:![]:!![],'where':_0x924b3f[_0x3951('0x1d')]?_0x924b3f[_0x3951('0x1d')]['where']||null:null,'attributes':_0x924b3f['options']?_0x924b3f[_0x3951('0x1d')][_0x3951('0x1f')]||null:null,'include':_0x924b3f[_0x3951('0x1d')]?_0x924b3f[_0x3951('0x1d')][_0x3951('0x20')]?_[_0x3951('0x21')](_0x924b3f['options'][_0x3951('0x20')],function(_0x33aaf1){return{'model':db[_0x33aaf1[_0x3951('0x22')]],'as':_0x33aaf1['as'],'attributes':_0x33aaf1[_0x3951('0x1f')],'include':_0x33aaf1['include']?_['map'](_0x33aaf1[_0x3951('0x20')],function(_0xede5dd){return{'model':db[_0xede5dd['model']],'as':_0xede5dd['as'],'attributes':_0xede5dd[_0x3951('0x1f')],'include':_0xede5dd[_0x3951('0x20')]?_['map'](_0xede5dd['include'],function(_0xe94b6c){return{'model':db[_0xe94b6c[_0x3951('0x22')]],'as':_0xe94b6c['as'],'attributes':_0xe94b6c[_0x3951('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3951('0x23')](function(_0x82a2cc){logger['info'](_0x3951('0x1b'),_0x924b3f);logger['debug'](_0x3951('0x1b'),_0x924b3f,JSON[_0x3951('0x15')](_0x82a2cc));_0x497f2d(_0x82a2cc);})['catch'](function(_0x281140){logger[_0x3951('0x16')]('ShowCmContact',_0x281140[_0x3951('0x18')],_0x924b3f);_0x2268a8(_0x1fca2c[_0x3951('0x16')](0x1f4,_0x281140[_0x3951('0x18')]));});});};exports[_0x3951('0x24')]=function(_0x26d96f){var _0x557cf0=this;return new Promise(function(_0xc93191,_0x2760aa){return db[_0x3951('0x1c')]['create'](_0x26d96f[_0x3951('0x25')],{'raw':_0x26d96f[_0x3951('0x1d')]?_0x26d96f['options'][_0x3951('0x1e')]===undefined?!![]:![]:!![]})[_0x3951('0x23')](function(_0x1bbd83){logger[_0x3951('0x10')](_0x3951('0x24'),_0x26d96f);logger[_0x3951('0x13')](_0x3951('0x24'),_0x26d96f,JSON[_0x3951('0x15')](_0x1bbd83));_0xc93191(_0x1bbd83);})['catch'](function(_0x5c5e9a){logger['error']('CreateCmContact',_0x5c5e9a[_0x3951('0x18')],_0x26d96f);_0x2760aa(_0x557cf0[_0x3951('0x16')](0x1f4,_0x5c5e9a[_0x3951('0x18')]));});});}; \ No newline at end of file +var _0x53c0=['debug','create','body','CreateCmContact','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowCmContact','CmContact','find','options','raw','attributes','include','model','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x53c0,0x191));var _0x053c=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x53c0[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x053c('0x0'));var util=require(_0x053c('0x1'));var moment=require(_0x053c('0x2'));var BPromise=require(_0x053c('0x3'));var rs=require(_0x053c('0x4'));var fs=require('fs');var db=require(_0x053c('0x5'))['db'];var utils=require(_0x053c('0x6'));var logger=require(_0x053c('0x7'))('rpc');var config=require(_0x053c('0x8'));var jayson=require(_0x053c('0x9'));var client=jayson['client']['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x053c('0xa'))[_0x053c('0xb')](socket);function respondWithRpcPromise(_0x2ceb49,_0x52162b,_0x3873b5){return new BPromise(function(_0x38ed19,_0x4001bf){return client[_0x053c('0xc')](_0x2ceb49,_0x3873b5)[_0x053c('0xd')](function(_0x44b307){logger[_0x053c('0xe')](_0x053c('0xf'),_0x52162b,_0x053c('0x10'));logger['debug'](_0x053c('0x11'),_0x52162b,_0x053c('0x10'),JSON['stringify'](_0x44b307));if(_0x44b307[_0x053c('0x12')]){if(_0x44b307[_0x053c('0x12')][_0x053c('0x13')]===0x1f4){logger[_0x053c('0x12')](_0x053c('0xf'),_0x52162b,_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);return _0x4001bf(_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);}logger[_0x053c('0x12')]('CmContact,\x20%s,\x20%s',_0x52162b,_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);return _0x38ed19(_0x44b307[_0x053c('0x12')][_0x053c('0x14')]);}else{logger[_0x053c('0xe')](_0x053c('0xf'),_0x52162b,_0x053c('0x10'));_0x38ed19(_0x44b307['result'][_0x053c('0x14')]);}})[_0x053c('0x15')](function(_0xf6da0a){logger[_0x053c('0x12')](_0x053c('0xf'),_0x52162b,_0xf6da0a);_0x4001bf(_0xf6da0a);});});}exports[_0x053c('0x16')]=function(_0x284d3f){var _0x4b6896=this;return new Promise(function(_0x54bea0,_0xedb99c){return db[_0x053c('0x17')][_0x053c('0x18')]({'raw':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')][_0x053c('0x1a')]===undefined?!![]:![]:!![],'where':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')]['where']||null:null,'attributes':_0x284d3f['options']?_0x284d3f['options'][_0x053c('0x1b')]||null:null,'include':_0x284d3f[_0x053c('0x19')]?_0x284d3f[_0x053c('0x19')][_0x053c('0x1c')]?_['map'](_0x284d3f[_0x053c('0x19')][_0x053c('0x1c')],function(_0x521cd8){return{'model':db[_0x521cd8[_0x053c('0x1d')]],'as':_0x521cd8['as'],'attributes':_0x521cd8['attributes'],'include':_0x521cd8[_0x053c('0x1c')]?_[_0x053c('0x1e')](_0x521cd8[_0x053c('0x1c')],function(_0x6d0fd1){return{'model':db[_0x6d0fd1[_0x053c('0x1d')]],'as':_0x6d0fd1['as'],'attributes':_0x6d0fd1[_0x053c('0x1b')],'include':_0x6d0fd1['include']?_[_0x053c('0x1e')](_0x6d0fd1[_0x053c('0x1c')],function(_0x30040b){return{'model':db[_0x30040b[_0x053c('0x1d')]],'as':_0x30040b['as'],'attributes':_0x30040b['attributes']};}):[]};}):[]};}):[]:[]})[_0x053c('0xd')](function(_0xe39b4a){logger[_0x053c('0xe')](_0x053c('0x16'),_0x284d3f);logger[_0x053c('0x1f')](_0x053c('0x16'),_0x284d3f,JSON['stringify'](_0xe39b4a));_0x54bea0(_0xe39b4a);})[_0x053c('0x15')](function(_0x35ace2){logger['error'](_0x053c('0x16'),_0x35ace2['message'],_0x284d3f);_0xedb99c(_0x4b6896[_0x053c('0x12')](0x1f4,_0x35ace2[_0x053c('0x14')]));});});};exports['CreateCmContact']=function(_0x1e1d55){var _0x4c2b09=this;return new Promise(function(_0x4b34e0,_0x285e59){return db[_0x053c('0x17')][_0x053c('0x20')](_0x1e1d55[_0x053c('0x21')],{'raw':_0x1e1d55['options']?_0x1e1d55[_0x053c('0x19')][_0x053c('0x1a')]===undefined?!![]:![]:!![]})[_0x053c('0xd')](function(_0x27f592){logger[_0x053c('0xe')](_0x053c('0x22'),_0x1e1d55);logger[_0x053c('0x1f')](_0x053c('0x22'),_0x1e1d55,JSON[_0x053c('0x23')](_0x27f592));_0x4b34e0(_0x27f592);})[_0x053c('0x15')](function(_0x29a670){logger['error'](_0x053c('0x22'),_0x29a670['message'],_0x1e1d55);_0x285e59(_0x4c2b09[_0x053c('0x12')](0x1f4,_0x29a670[_0x053c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.socket.js b/server/api/cmContact/cmContact.socket.js index 1929615..b6db5e2 100644 --- a/server/api/cmContact/cmContact.socket.js +++ b/server/api/cmContact/cmContact.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aaf=['cmContact:','./cmContact.events','remove','update','removeListener','register','length'];(function(_0x1aab6f,_0x2d3b9c){var _0x50e78a=function(_0x23b80e){while(--_0x23b80e){_0x1aab6f['push'](_0x1aab6f['shift']());}};_0x50e78a(++_0x2d3b9c);}(_0x7aaf,0x1eb));var _0xf7aa=function(_0x359993,_0x4e7894){_0x359993=_0x359993-0x0;var _0x4ddfba=_0x7aaf[_0x359993];return _0x4ddfba;};'use strict';var CmContactEvents=require(_0xf7aa('0x0'));var events=['save',_0xf7aa('0x1'),_0xf7aa('0x2')];function createListener(_0x551bfb,_0x4b942e){return function(_0x35575f){_0x4b942e['emit'](_0x551bfb,_0x35575f);};}function removeListener(_0x198d5c,_0x5ee53a){return function(){CmContactEvents[_0xf7aa('0x3')](_0x198d5c,_0x5ee53a);};}exports[_0xf7aa('0x4')]=function(_0x1babcd){for(var _0xf02ed5=0x0,_0x47f259=events[_0xf7aa('0x5')];_0xf02ed5<_0x47f259;_0xf02ed5++){var _0x5d0495=events[_0xf02ed5];var _0x598c54=createListener(_0xf7aa('0x6')+_0x5d0495,_0x1babcd);CmContactEvents['on'](_0x5d0495,_0x598c54);}}; \ No newline at end of file +var _0x4074=['./cmContact.events','save','remove','emit','removeListener','register','length','cmContact:'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4074,0xf0));var _0x4407=function(_0x17df8e,_0x24d406){_0x17df8e=_0x17df8e-0x0;var _0x3cc1a0=_0x4074[_0x17df8e];return _0x3cc1a0;};'use strict';var CmContactEvents=require(_0x4407('0x0'));var events=[_0x4407('0x1'),_0x4407('0x2'),'update'];function createListener(_0x1021e6,_0x2a756){return function(_0x14c0bc){_0x2a756[_0x4407('0x3')](_0x1021e6,_0x14c0bc);};}function removeListener(_0x188494,_0x3c9f5c){return function(){CmContactEvents[_0x4407('0x4')](_0x188494,_0x3c9f5c);};}exports[_0x4407('0x5')]=function(_0x3f085d){for(var _0x35899d=0x0,_0x4933cf=events[_0x4407('0x6')];_0x35899d<_0x4933cf;_0x35899d++){var _0x5f0699=events[_0x35899d];var _0x414f0a=createListener(_0x4407('0x7')+_0x5f0699,_0x3f085d);CmContactEvents['on'](_0x5f0699,_0x414f0a);}}; \ No newline at end of file diff --git a/server/api/cmContact/index.js b/server/api/cmContact/index.js index 09c70c8..fe3f18a 100644 --- a/server/api/cmContact/index.js +++ b/server/api/cmContact/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35f9=['getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','/merge','merge','post','create','/create_many','bulkCreate','setTags','join','root','originalname','replace','format','extname','now','single','file','uploadCsv','diskStorage','server/files/tmp','%s-%s%s','/upload','upload','import','update','delete','exports','multer','util','path','../../components/auth/service','../../config/environment','./cmContact.controller','get','/describe','isAuthenticated','/:id','/:id/tags'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x35f9,0x181));var _0x935f=function(_0x275a69,_0x50e4ad){_0x275a69=_0x275a69-0x0;var _0x37cb7c=_0x35f9[_0x275a69];return _0x37cb7c;};'use strict';var multer=require(_0x935f('0x0'));var util=require(_0x935f('0x1'));var path=require(_0x935f('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x935f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x935f('0x4'));var controller=require(_0x935f('0x5'));router[_0x935f('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x935f('0x6')](_0x935f('0x7'),auth[_0x935f('0x8')](),controller['describe']);router[_0x935f('0x6')](_0x935f('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x935f('0x6')](_0x935f('0xa'),auth[_0x935f('0x8')](),controller[_0x935f('0xb')]);router['get'](_0x935f('0xc'),auth['isAuthenticated'](),controller[_0x935f('0xd')]);router[_0x935f('0x6')](_0x935f('0xe'),auth['isAuthenticated'](),controller[_0x935f('0xf')]);router[_0x935f('0x6')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x935f('0x10')]);router['get'](_0x935f('0x11'),auth[_0x935f('0x8')](),controller['getJscriptySessions']);router['post'](_0x935f('0x12'),auth['isAuthenticated'](),controller[_0x935f('0x13')]);router[_0x935f('0x14')]('/',auth['isAuthenticated'](),controller[_0x935f('0x15')]);router[_0x935f('0x14')](_0x935f('0x16'),auth['isAuthenticated'](),controller[_0x935f('0x17')]);router[_0x935f('0x14')]('/:id/tags',auth[_0x935f('0x8')](),controller[_0x935f('0x18')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d3ba3,_0x3b0a31,_0x17812d){_0x17812d(null,path[_0x935f('0x19')](config[_0x935f('0x1a')],'server/files/tmp'));},'filename':function(_0x5defff,_0xd5083d,_0x58860f){_0xd5083d[_0x935f('0x1b')]=_0xd5083d[_0x935f('0x1b')][_0x935f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x58860f(null,util[_0x935f('0x1d')]('%s-%s%s',path['basename'](_0xd5083d['originalname'],path[_0x935f('0x1e')](_0xd5083d[_0x935f('0x1b')])),Date[_0x935f('0x1f')](),path[_0x935f('0x1e')](_0xd5083d[_0x935f('0x1b')])));}})});router[_0x935f('0x14')]('/csv',upload[_0x935f('0x20')](_0x935f('0x21')),controller[_0x935f('0x22')]);var upload=multer({'storage':multer[_0x935f('0x23')]({'destination':function(_0xf8c65d,_0x2d6301,_0x130f67){_0x130f67(null,path['join'](config['root'],_0x935f('0x24')));},'filename':function(_0x353c0c,_0x3fb6bc,_0x5d4b83){_0x3fb6bc[_0x935f('0x1b')]=_0x3fb6bc['originalname'][_0x935f('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5d4b83(null,util[_0x935f('0x1d')](_0x935f('0x25'),path['basename'](_0x3fb6bc[_0x935f('0x1b')],path['extname'](_0x3fb6bc['originalname'])),Date[_0x935f('0x1f')](),path[_0x935f('0x1e')](_0x3fb6bc[_0x935f('0x1b')])));}})});router[_0x935f('0x14')](_0x935f('0x26'),upload[_0x935f('0x20')](_0x935f('0x21')),controller[_0x935f('0x27')]);router[_0x935f('0x14')]('/upload/:id',auth[_0x935f('0x8')](),controller[_0x935f('0x28')]);router['put'](_0x935f('0x9'),auth[_0x935f('0x8')](),controller[_0x935f('0x29')]);router[_0x935f('0x2a')]('/:id',auth[_0x935f('0x8')](),controller['destroy']);module[_0x935f('0x2b')]=router; \ No newline at end of file +var _0x1f3f=['single','file','%s-%s%s','now','import','put','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','get','index','/describe','/:id','isAuthenticated','show','/:id/tags','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','post','/merge','create','/create_many','bulkCreate','diskStorage','join','root','server/files/tmp','originalname','replace','format','basename','extname'];(function(_0x4684bb,_0x5c37e7){var _0x146724=function(_0x409499){while(--_0x409499){_0x4684bb['push'](_0x4684bb['shift']());}};_0x146724(++_0x5c37e7);}(_0x1f3f,0x13d));var _0xf1f3=function(_0x3e3d0a,_0x4745dd){_0x3e3d0a=_0x3e3d0a-0x0;var _0x3fc765=_0x1f3f[_0x3e3d0a];return _0x3fc765;};'use strict';var multer=require(_0xf1f3('0x0'));var util=require(_0xf1f3('0x1'));var path=require(_0xf1f3('0x2'));var express=require(_0xf1f3('0x3'));var router=express[_0xf1f3('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xf1f3('0x5'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0xf1f3('0x6')]('/',auth['isAuthenticated'](),controller[_0xf1f3('0x7')]);router[_0xf1f3('0x6')](_0xf1f3('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0xb')]);router['get'](_0xf1f3('0xc'),auth['isAuthenticated'](),controller[_0xf1f3('0xd')]);router[_0xf1f3('0x6')](_0xf1f3('0xe'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0xf')]);router[_0xf1f3('0x6')](_0xf1f3('0x10'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x11')]);router[_0xf1f3('0x6')](_0xf1f3('0x12'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x13')]);router[_0xf1f3('0x6')]('/:id/jscripty_sessions',auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x14')]);router[_0xf1f3('0x15')](_0xf1f3('0x16'),auth[_0xf1f3('0xa')](),controller['merge']);router[_0xf1f3('0x15')]('/',auth['isAuthenticated'](),controller[_0xf1f3('0x17')]);router['post'](_0xf1f3('0x18'),auth['isAuthenticated'](),controller[_0xf1f3('0x19')]);router['post'](_0xf1f3('0xc'),auth[_0xf1f3('0xa')](),controller['setTags']);var upload=multer({'storage':multer[_0xf1f3('0x1a')]({'destination':function(_0x127b35,_0xfd0cee,_0x1dd2c7){_0x1dd2c7(null,path[_0xf1f3('0x1b')](config[_0xf1f3('0x1c')],_0xf1f3('0x1d')));},'filename':function(_0x1035ad,_0x165f2c,_0x5c06b1){_0x165f2c[_0xf1f3('0x1e')]=_0x165f2c[_0xf1f3('0x1e')][_0xf1f3('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5c06b1(null,util[_0xf1f3('0x20')]('%s-%s%s',path[_0xf1f3('0x21')](_0x165f2c[_0xf1f3('0x1e')],path[_0xf1f3('0x22')](_0x165f2c['originalname'])),Date['now'](),path[_0xf1f3('0x22')](_0x165f2c[_0xf1f3('0x1e')])));}})});router[_0xf1f3('0x15')]('/csv',upload[_0xf1f3('0x23')](_0xf1f3('0x24')),controller['uploadCsv']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x324b5b,_0xc2ce40,_0x42d8f0){_0x42d8f0(null,path[_0xf1f3('0x1b')](config['root'],_0xf1f3('0x1d')));},'filename':function(_0x20a24a,_0x55ba07,_0x306c36){_0x55ba07[_0xf1f3('0x1e')]=_0x55ba07[_0xf1f3('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x306c36(null,util[_0xf1f3('0x20')](_0xf1f3('0x25'),path[_0xf1f3('0x21')](_0x55ba07[_0xf1f3('0x1e')],path[_0xf1f3('0x22')](_0x55ba07[_0xf1f3('0x1e')])),Date[_0xf1f3('0x26')](),path['extname'](_0x55ba07['originalname'])));}})});router[_0xf1f3('0x15')]('/upload',upload[_0xf1f3('0x23')]('file'),controller['upload']);router[_0xf1f3('0x15')]('/upload/:id',auth['isAuthenticated'](),controller[_0xf1f3('0x27')]);router[_0xf1f3('0x28')](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller['update']);router[_0xf1f3('0x29')](_0xf1f3('0x9'),auth[_0xf1f3('0xa')](),controller[_0xf1f3('0x2a')]);module[_0xf1f3('0x2b')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 45e1251..57a4899 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 _0xbe8a=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','parse','values','isArray','stringify','BOOLEAN','sequelize'];(function(_0x6d9ca4,_0x205540){var _0x112f28=function(_0x2bff17){while(--_0x2bff17){_0x6d9ca4['push'](_0x6d9ca4['shift']());}};_0x112f28(++_0x205540);}(_0xbe8a,0x187));var _0xabe8=function(_0xfe26da,_0x5ac1b7){_0xfe26da=_0xfe26da-0x0;var _0x2abe6e=_0xbe8a[_0xfe26da];return _0x2abe6e;};'use strict';var Sequelize=require(_0xabe8('0x0'));var _=require('lodash');module[_0xabe8('0x1')]={'name':{'type':Sequelize[_0xabe8('0x2')],'get':function(_0x4f904e){return this[_0xabe8('0x3')](_0xabe8('0x4'));}},'alias':{'type':Sequelize[_0xabe8('0x5')],'allowNull':![],'set':function(_0x1b5eff){this[_0xabe8('0x6')](_0xabe8('0x4'),_0x1b5eff?_0x1b5eff:this['getDataValue'](_0xabe8('0x7')));}},'type':{'type':Sequelize[_0xabe8('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xabe8('0x8')),'get':function(){if(this[_0xabe8('0x3')]('type')==='select'){return JSON[_0xabe8('0x9')](this['getDataValue'](_0xabe8('0xa')));}else{return this[_0xabe8('0x3')]('values');}},'set':function(_0x597d3b){if(Array[_0xabe8('0xb')](_0x597d3b)){this['setDataValue'](_0xabe8('0xa'),JSON[_0xabe8('0xc')](_0x597d3b));}else{this[_0xabe8('0x6')](_0xabe8('0xa'),_0x597d3b);}}},'required':{'type':Sequelize[_0xabe8('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x22de=['STRING','setDataValue','getDataValue','name','TEXT','long','parse','values','isArray','stringify','BOOLEAN','sequelize','lodash','exports','VIRTUAL','alias'];(function(_0x48af50,_0x9e9508){var _0x5570d8=function(_0x54c814){while(--_0x54c814){_0x48af50['push'](_0x48af50['shift']());}};_0x5570d8(++_0x9e9508);}(_0x22de,0xdb));var _0xe22d=function(_0x548068,_0x550179){_0x548068=_0x548068-0x0;var _0x1dd633=_0x22de[_0x548068];return _0x1dd633;};'use strict';var Sequelize=require(_0xe22d('0x0'));var _=require(_0xe22d('0x1'));module[_0xe22d('0x2')]={'name':{'type':Sequelize[_0xe22d('0x3')],'get':function(_0x4e0c75){return this['getDataValue'](_0xe22d('0x4'));}},'alias':{'type':Sequelize[_0xe22d('0x5')],'allowNull':![],'set':function(_0x353899){this[_0xe22d('0x6')](_0xe22d('0x4'),_0x353899?_0x353899:this[_0xe22d('0x7')](_0xe22d('0x8')));}},'type':{'type':Sequelize[_0xe22d('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe22d('0x9')](_0xe22d('0xa')),'get':function(){if(this[_0xe22d('0x7')]('type')==='select'){return JSON[_0xe22d('0xb')](this[_0xe22d('0x7')](_0xe22d('0xc')));}else{return this[_0xe22d('0x7')](_0xe22d('0xc'));}},'set':function(_0x14c820){if(Array[_0xe22d('0xd')](_0x14c820)){this['setDataValue']('values',JSON[_0xe22d('0xe')](_0x14c820));}else{this[_0xe22d('0x6')](_0xe22d('0xc'),_0x14c820);}}},'required':{'type':Sequelize[_0xe22d('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0a42c3f..8832af4 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 _0x8a28=['queryInterface','addColumn','format','cf_%d','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','send','CmCustomField','rawAttributes','differenceBy','name','query','dateEnd','dateStart','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','count','include','rows','catch','show','includeAll','find','body','params','create','Sequelize','type','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue'];(function(_0x58dcf4,_0xa5200f){var _0x5a89b7=function(_0x2c7921){while(--_0x2c7921){_0x58dcf4['push'](_0x58dcf4['shift']());}};_0x5a89b7(++_0xa5200f);}(_0x8a28,0xfd));var _0x88a2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x8a28[_0xa1e3e3];return _0xc980e9;};'use strict';var jsonpatch=require(_0x88a2('0x0'));var rp=require(_0x88a2('0x1'));var moment=require(_0x88a2('0x2'));var BPromise=require(_0x88a2('0x3'));var Mustache=require(_0x88a2('0x4'));var util=require(_0x88a2('0x5'));var path=require(_0x88a2('0x6'));var sox=require(_0x88a2('0x7'));var csv=require('to-csv');var ejs=require(_0x88a2('0x8'));var fs=require('fs');var _=require(_0x88a2('0x9'));var squel=require(_0x88a2('0xa'));var crypto=require(_0x88a2('0xb'));var jsforce=require(_0x88a2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x88a2('0xd'));var querystring=require('querystring');var Papa=require(_0x88a2('0xe'));var qs=require(_0x88a2('0xf'));var logger=require(_0x88a2('0x10'))(_0x88a2('0x11'));var utils=require(_0x88a2('0x12'));var config=require(_0x88a2('0x13'));var db=require(_0x88a2('0x14'))['db'];function respondWithStatusCode(_0x306a59,_0x4eec50){_0x4eec50=_0x4eec50||0xcc;return function(_0x4f02ff){if(_0x4f02ff){return _0x306a59['sendStatus'](_0x4eec50);}return _0x306a59[_0x88a2('0x15')](_0x4eec50)[_0x88a2('0x16')]();};}function respondWithResult(_0x14559e,_0xae0676){_0xae0676=_0xae0676||0xc8;return function(_0x18d477){if(_0x18d477){return _0x14559e['status'](_0xae0676)[_0x88a2('0x17')](_0x18d477);}};}function respondWithFilteredResult(_0x1a4056,_0x367a7d){return function(_0x21b05a){if(_0x21b05a){var _0x5093c0=_0x21b05a['count'],_0x923706=_0x367a7d[_0x88a2('0x18')],_0x407ef0=_0x367a7d[_0x88a2('0x18')]+_0x367a7d[_0x88a2('0x19')],_0x3b83ce;if(_0x407ef0>=_0x5093c0){_0x407ef0=_0x5093c0;_0x3b83ce=0xc8;}else{_0x3b83ce=0xce;}_0x1a4056[_0x88a2('0x15')](_0x3b83ce);return _0x1a4056[_0x88a2('0x1a')](_0x88a2('0x1b'),_0x923706+'-'+_0x407ef0+'/'+_0x5093c0)[_0x88a2('0x17')](_0x21b05a);}return null;};}function patchUpdates(_0x2f5220){return function(_0x2890d8){try{jsonpatch[_0x88a2('0x1c')](_0x2890d8,_0x2f5220,!![]);}catch(_0x235b75){return BPromise[_0x88a2('0x1d')](_0x235b75);}return _0x2890d8[_0x88a2('0x1e')]();};}function saveUpdates(_0x29dc1b,_0x34d34a){return function(_0x162b5f){if(_0x162b5f){return _0x162b5f[_0x88a2('0x1f')](_0x29dc1b)[_0x88a2('0x20')](function(_0x4b72d1){return _0x4b72d1;});}return null;};}function removeEntity(_0x190aac,_0x282a27){return function(_0x4cd11e){if(_0x4cd11e){return _0x4cd11e['destroy']()[_0x88a2('0x20')](function(){_0x190aac[_0x88a2('0x15')](0xcc)[_0x88a2('0x16')]();});}};}function handleEntityNotFound(_0x20aef3,_0x2039ee){return function(_0x54c6ed){if(!_0x54c6ed){_0x20aef3[_0x88a2('0x21')](0x194);}return _0x54c6ed;};}function handleError(_0xda54c4,_0x36cc2c){_0x36cc2c=_0x36cc2c||0x1f4;return function(_0xdeb1e1){logger['error'](_0xdeb1e1[_0x88a2('0x22')]);if(_0xdeb1e1['name']){delete _0xdeb1e1['name'];}_0xda54c4[_0x88a2('0x15')](_0x36cc2c)[_0x88a2('0x23')](_0xdeb1e1);};}exports['index']=function(_0x54744e,_0x1343fc){var _0xac4afe={},_0x5be767={},_0x42ae5b={'count':0x0,'rows':[]};var _0x4427a1=db[_0x88a2('0x24')][_0x88a2('0x25')];_0x5be767['model']=_[_0x88a2('0x26')](_['keys'](_0x4427a1),[_0x88a2('0x27')]);var _0x3d9e8a={'dateStart':_0x54744e[_0x88a2('0x28')]['dateStart'],'dateEnd':_0x54744e[_0x88a2('0x28')][_0x88a2('0x29')]};delete _0x54744e['query'][_0x88a2('0x2a')];delete _0x54744e[_0x88a2('0x28')]['dateEnd'];_0x5be767['query']=_[_0x88a2('0x2b')](_0x54744e[_0x88a2('0x28')]);_0x5be767[_0x88a2('0x2c')]=_[_0x88a2('0x2d')](_0x5be767[_0x88a2('0x2e')],_0x5be767[_0x88a2('0x28')]);_0xac4afe['attributes']=_[_0x88a2('0x2d')](_0x5be767[_0x88a2('0x2e')],qs[_0x88a2('0x2f')](_0x54744e[_0x88a2('0x28')][_0x88a2('0x2f')]));_0xac4afe[_0x88a2('0x30')]=_0xac4afe[_0x88a2('0x30')][_0x88a2('0x31')]?_0xac4afe[_0x88a2('0x30')]:_0x5be767[_0x88a2('0x2e')];if(!_0x54744e['query']['hasOwnProperty'](_0x88a2('0x32'))){_0xac4afe[_0x88a2('0x19')]=qs[_0x88a2('0x19')](_0x54744e['query'][_0x88a2('0x19')]);_0xac4afe[_0x88a2('0x18')]=qs['offset'](_0x54744e[_0x88a2('0x28')][_0x88a2('0x18')]);}_0xac4afe[_0x88a2('0x33')]=qs['sort'](_0x54744e['query'][_0x88a2('0x34')]);_0xac4afe[_0x88a2('0x35')]=qs['filters'](_[_0x88a2('0x36')](_0x54744e[_0x88a2('0x28')],_0x5be767[_0x88a2('0x2c')]));if(_0x3d9e8a[_0x88a2('0x2a')]){if(_0x3d9e8a[_0x88a2('0x29')]){_0x3d9e8a[_0x88a2('0x29')]=moment(_0x3d9e8a[_0x88a2('0x29')])[_0x88a2('0x37')](0x1,'day');}else{_0x3d9e8a[_0x88a2('0x29')]=moment(_0x3d9e8a[_0x88a2('0x2a')])['add'](0x1,_0x88a2('0x38'));}_[_0x88a2('0x39')](_0xac4afe[_0x88a2('0x35')],{'createdAt':{'$gte':_0x3d9e8a[_0x88a2('0x2a')],'$lte':_0x3d9e8a[_0x88a2('0x29')]}});}if(_0x54744e[_0x88a2('0x28')][_0x88a2('0x3a')]){_0xac4afe[_0x88a2('0x35')]=_[_0x88a2('0x39')](_0xac4afe[_0x88a2('0x35')],{'$or':_[_0x88a2('0x3b')](_0xac4afe[_0x88a2('0x30')],function(_0x1f2bc5){var _0x25f2b2={};_0x25f2b2[_0x1f2bc5]={'$like':'%'+_0x54744e[_0x88a2('0x28')][_0x88a2('0x3a')]+'%'};return _0x25f2b2;})});}_0xac4afe=_[_0x88a2('0x39')]({},_0xac4afe,_0x54744e[_0x88a2('0x3c')]);var _0x1a5038={'where':_0xac4afe[_0x88a2('0x35')]};return db[_0x88a2('0x24')][_0x88a2('0x3d')](_0x1a5038)[_0x88a2('0x20')](function(_0x3df13d){_0x42ae5b[_0x88a2('0x3d')]=_0x3df13d;if(_0x54744e['query']['includeAll']){_0xac4afe[_0x88a2('0x3e')]=[{'all':!![]}];}return db[_0x88a2('0x24')]['findAll'](_0xac4afe);})[_0x88a2('0x20')](function(_0x4333f6){_0x42ae5b[_0x88a2('0x3f')]=_0x4333f6;return _0x42ae5b;})[_0x88a2('0x20')](respondWithFilteredResult(_0x1343fc,_0xac4afe))[_0x88a2('0x40')](handleError(_0x1343fc,null));};exports[_0x88a2('0x41')]=function(_0x4d9726,_0x23f8c8){var _0x2c3742={'raw':!![],'where':{'id':_0x4d9726['params']['id']}},_0x1f12f2={};_0x1f12f2[_0x88a2('0x2e')]=_[_0x88a2('0x2b')](db[_0x88a2('0x24')][_0x88a2('0x25')]);_0x1f12f2['query']=_[_0x88a2('0x2b')](_0x4d9726[_0x88a2('0x28')]);_0x1f12f2[_0x88a2('0x2c')]=_[_0x88a2('0x2d')](_0x1f12f2[_0x88a2('0x2e')],_0x1f12f2[_0x88a2('0x28')]);_0x2c3742[_0x88a2('0x30')]=_[_0x88a2('0x2d')](_0x1f12f2[_0x88a2('0x2e')],qs[_0x88a2('0x2f')](_0x4d9726[_0x88a2('0x28')][_0x88a2('0x2f')]));_0x2c3742[_0x88a2('0x30')]=_0x2c3742[_0x88a2('0x30')][_0x88a2('0x31')]?_0x2c3742[_0x88a2('0x30')]:_0x1f12f2[_0x88a2('0x2e')];if(_0x4d9726[_0x88a2('0x28')][_0x88a2('0x42')]){_0x2c3742[_0x88a2('0x3e')]=[{'all':!![]}];}_0x2c3742=_['merge']({},_0x2c3742,_0x4d9726[_0x88a2('0x3c')]);return db['CmCustomField'][_0x88a2('0x43')](_0x2c3742)['then'](handleEntityNotFound(_0x23f8c8,null))[_0x88a2('0x20')](respondWithResult(_0x23f8c8,null))[_0x88a2('0x40')](handleError(_0x23f8c8,null));};exports[_0x88a2('0x1f')]=function(_0x37319d,_0x2ace4b){if(_0x37319d[_0x88a2('0x44')]['id']){delete _0x37319d[_0x88a2('0x44')]['id'];}return db[_0x88a2('0x24')]['find']({'where':{'id':_0x37319d[_0x88a2('0x45')]['id']}})[_0x88a2('0x20')](handleEntityNotFound(_0x2ace4b,null))['then'](saveUpdates(_0x37319d[_0x88a2('0x44')],null))['then'](respondWithResult(_0x2ace4b,null))[_0x88a2('0x40')](handleError(_0x2ace4b,null));};exports['destroy']=function(_0x4dcaa5,_0x4697da){return db[_0x88a2('0x24')][_0x88a2('0x43')]({'where':{'id':_0x4dcaa5[_0x88a2('0x45')]['id']}})[_0x88a2('0x20')](handleEntityNotFound(_0x4697da,null))[_0x88a2('0x20')](removeEntity(_0x4697da,null))[_0x88a2('0x40')](handleError(_0x4697da,null));};exports[_0x88a2('0x46')]=function(_0x33e64c,_0x3887c5){var _0x193d5e;return db['sequelize']['transaction'](function(_0x26ee71){return db[_0x88a2('0x24')][_0x88a2('0x46')](_0x33e64c[_0x88a2('0x44')],{'transaction':_0x26ee71})[_0x88a2('0x20')](function(_0x575365){_0x193d5e=_0x575365;var _0x2bc03d={'type':db[_0x88a2('0x47')]['TEXT'],'transaction':_0x26ee71};switch(_0x33e64c[_0x88a2('0x44')][_0x88a2('0x48')]){case'text':_0x2bc03d[_0x88a2('0x48')]=db['Sequelize'][_0x88a2('0x49')];break;case _0x88a2('0x4a'):_0x2bc03d[_0x88a2('0x48')]=db[_0x88a2('0x47')][_0x88a2('0x4b')];break;case _0x88a2('0x4c'):_0x2bc03d['type']=db[_0x88a2('0x47')][_0x88a2('0x4d')];_0x2bc03d[_0x88a2('0x4e')]=![];break;default:}return db['sequelize'][_0x88a2('0x4f')][_0x88a2('0x50')]('cm_contacts',util[_0x88a2('0x51')](_0x88a2('0x52'),_0x193d5e['id']),_0x2bc03d);})['then'](function(){return _0x193d5e;});})['then'](respondWithResult(_0x3887c5,0xc9))[_0x88a2('0x40')](handleError(_0x3887c5,null));}; \ No newline at end of file +var _0x63c5=['../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','CmCustomField','rawAttributes','differenceBy','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','day','add','where','filter','merge','include','rows','catch','params','options','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','type','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs'];(function(_0x1663ae,_0x10484a){var _0x30ffb8=function(_0x21e006){while(--_0x21e006){_0x1663ae['push'](_0x1663ae['shift']());}};_0x30ffb8(++_0x10484a);}(_0x63c5,0xde));var _0x563c=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0x63c5[_0x52096b];return _0x2b1cc7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x563c('0x0'));var BPromise=require(_0x563c('0x1'));var Mustache=require(_0x563c('0x2'));var util=require(_0x563c('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x563c('0x4'));var ejs=require(_0x563c('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x563c('0x6'));var crypto=require(_0x563c('0x7'));var jsforce=require(_0x563c('0x8'));var deskjs=require(_0x563c('0x9'));var toCsv=require('to-csv');var querystring=require(_0x563c('0xa'));var Papa=require('papaparse');var qs=require(_0x563c('0xb'));var logger=require(_0x563c('0xc'))('api');var utils=require(_0x563c('0xd'));var config=require(_0x563c('0xe'));var db=require(_0x563c('0xf'))['db'];function respondWithStatusCode(_0x29f927,_0x2bf1d6){_0x2bf1d6=_0x2bf1d6||0xcc;return function(_0x2330fd){if(_0x2330fd){return _0x29f927[_0x563c('0x10')](_0x2bf1d6);}return _0x29f927[_0x563c('0x11')](_0x2bf1d6)[_0x563c('0x12')]();};}function respondWithResult(_0x2a204f,_0x420e85){_0x420e85=_0x420e85||0xc8;return function(_0x4ba01f){if(_0x4ba01f){return _0x2a204f[_0x563c('0x11')](_0x420e85)[_0x563c('0x13')](_0x4ba01f);}};}function respondWithFilteredResult(_0x2febf8,_0x1b0b94){return function(_0x9cf36){if(_0x9cf36){var _0xf5cfa6=_0x9cf36[_0x563c('0x14')],_0x491bf4=_0x1b0b94['offset'],_0x26e98a=_0x1b0b94[_0x563c('0x15')]+_0x1b0b94[_0x563c('0x16')],_0x45b454;if(_0x26e98a>=_0xf5cfa6){_0x26e98a=_0xf5cfa6;_0x45b454=0xc8;}else{_0x45b454=0xce;}_0x2febf8[_0x563c('0x11')](_0x45b454);return _0x2febf8[_0x563c('0x17')](_0x563c('0x18'),_0x491bf4+'-'+_0x26e98a+'/'+_0xf5cfa6)['json'](_0x9cf36);}return null;};}function patchUpdates(_0x539d02){return function(_0x204aa9){try{jsonpatch[_0x563c('0x19')](_0x204aa9,_0x539d02,!![]);}catch(_0x2b7ba0){return BPromise[_0x563c('0x1a')](_0x2b7ba0);}return _0x204aa9[_0x563c('0x1b')]();};}function saveUpdates(_0x46c31f,_0x5cab19){return function(_0x86c745){if(_0x86c745){return _0x86c745[_0x563c('0x1c')](_0x46c31f)[_0x563c('0x1d')](function(_0x33e5b2){return _0x33e5b2;});}return null;};}function removeEntity(_0x28d753,_0x4c7ff2){return function(_0x54eed1){if(_0x54eed1){return _0x54eed1[_0x563c('0x1e')]()['then'](function(){_0x28d753[_0x563c('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5eb12a,_0xc86a26){return function(_0x378632){if(!_0x378632){_0x5eb12a[_0x563c('0x10')](0x194);}return _0x378632;};}function handleError(_0x2300a9,_0x5d5aa3){_0x5d5aa3=_0x5d5aa3||0x1f4;return function(_0x59e60b){logger['error'](_0x59e60b['stack']);if(_0x59e60b[_0x563c('0x1f')]){delete _0x59e60b[_0x563c('0x1f')];}_0x2300a9[_0x563c('0x11')](_0x5d5aa3)['send'](_0x59e60b);};}exports['index']=function(_0x2b0f70,_0x2f622c){var _0x56026c={},_0x52b146={},_0x24a6a9={'count':0x0,'rows':[]};var _0x24660a=db[_0x563c('0x20')][_0x563c('0x21')];_0x52b146['model']=_[_0x563c('0x22')](_[_0x563c('0x23')](_0x24660a),[_0x563c('0x1f')]);var _0x40cb12={'dateStart':_0x2b0f70[_0x563c('0x24')][_0x563c('0x25')],'dateEnd':_0x2b0f70[_0x563c('0x24')][_0x563c('0x26')]};delete _0x2b0f70[_0x563c('0x24')][_0x563c('0x25')];delete _0x2b0f70[_0x563c('0x24')][_0x563c('0x26')];_0x52b146[_0x563c('0x24')]=_[_0x563c('0x23')](_0x2b0f70[_0x563c('0x24')]);_0x52b146['filters']=_[_0x563c('0x27')](_0x52b146[_0x563c('0x28')],_0x52b146['query']);_0x56026c[_0x563c('0x29')]=_[_0x563c('0x27')](_0x52b146['model'],qs['fields'](_0x2b0f70[_0x563c('0x24')][_0x563c('0x2a')]));_0x56026c['attributes']=_0x56026c['attributes'][_0x563c('0x2b')]?_0x56026c[_0x563c('0x29')]:_0x52b146['model'];if(!_0x2b0f70[_0x563c('0x24')][_0x563c('0x2c')](_0x563c('0x2d'))){_0x56026c[_0x563c('0x16')]=qs[_0x563c('0x16')](_0x2b0f70[_0x563c('0x24')][_0x563c('0x16')]);_0x56026c[_0x563c('0x15')]=qs[_0x563c('0x15')](_0x2b0f70[_0x563c('0x24')][_0x563c('0x15')]);}_0x56026c[_0x563c('0x2e')]=qs['sort'](_0x2b0f70['query'][_0x563c('0x2f')]);_0x56026c['where']=qs['filters'](_[_0x563c('0x30')](_0x2b0f70[_0x563c('0x24')],_0x52b146[_0x563c('0x31')]));if(_0x40cb12[_0x563c('0x25')]){if(_0x40cb12['dateEnd']){_0x40cb12[_0x563c('0x26')]=moment(_0x40cb12[_0x563c('0x26')])['add'](0x1,_0x563c('0x32'));}else{_0x40cb12[_0x563c('0x26')]=moment(_0x40cb12[_0x563c('0x25')])[_0x563c('0x33')](0x1,_0x563c('0x32'));}_['merge'](_0x56026c[_0x563c('0x34')],{'createdAt':{'$gte':_0x40cb12['dateStart'],'$lte':_0x40cb12['dateEnd']}});}if(_0x2b0f70[_0x563c('0x24')][_0x563c('0x35')]){_0x56026c[_0x563c('0x34')]=_[_0x563c('0x36')](_0x56026c[_0x563c('0x34')],{'$or':_['map'](_0x56026c[_0x563c('0x29')],function(_0x54118d){var _0x8301fa={};_0x8301fa[_0x54118d]={'$like':'%'+_0x2b0f70['query']['filter']+'%'};return _0x8301fa;})});}_0x56026c=_[_0x563c('0x36')]({},_0x56026c,_0x2b0f70['options']);var _0x2b861d={'where':_0x56026c[_0x563c('0x34')]};return db['CmCustomField'][_0x563c('0x14')](_0x2b861d)[_0x563c('0x1d')](function(_0x53dd58){_0x24a6a9[_0x563c('0x14')]=_0x53dd58;if(_0x2b0f70[_0x563c('0x24')]['includeAll']){_0x56026c[_0x563c('0x37')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x56026c);})[_0x563c('0x1d')](function(_0x370682){_0x24a6a9[_0x563c('0x38')]=_0x370682;return _0x24a6a9;})[_0x563c('0x1d')](respondWithFilteredResult(_0x2f622c,_0x56026c))[_0x563c('0x39')](handleError(_0x2f622c,null));};exports['show']=function(_0x4ec75f,_0x1dbed8){var _0x554640={'raw':!![],'where':{'id':_0x4ec75f[_0x563c('0x3a')]['id']}},_0x42f76f={};_0x42f76f['model']=_[_0x563c('0x23')](db['CmCustomField']['rawAttributes']);_0x42f76f[_0x563c('0x24')]=_['keys'](_0x4ec75f[_0x563c('0x24')]);_0x42f76f[_0x563c('0x31')]=_[_0x563c('0x27')](_0x42f76f['model'],_0x42f76f[_0x563c('0x24')]);_0x554640['attributes']=_[_0x563c('0x27')](_0x42f76f[_0x563c('0x28')],qs[_0x563c('0x2a')](_0x4ec75f[_0x563c('0x24')][_0x563c('0x2a')]));_0x554640[_0x563c('0x29')]=_0x554640[_0x563c('0x29')][_0x563c('0x2b')]?_0x554640[_0x563c('0x29')]:_0x42f76f[_0x563c('0x28')];if(_0x4ec75f[_0x563c('0x24')]['includeAll']){_0x554640['include']=[{'all':!![]}];}_0x554640=_['merge']({},_0x554640,_0x4ec75f[_0x563c('0x3b')]);return db['CmCustomField'][_0x563c('0x3c')](_0x554640)[_0x563c('0x1d')](handleEntityNotFound(_0x1dbed8,null))[_0x563c('0x1d')](respondWithResult(_0x1dbed8,null))[_0x563c('0x39')](handleError(_0x1dbed8,null));};exports[_0x563c('0x1c')]=function(_0x400d83,_0x37cdb4){if(_0x400d83[_0x563c('0x3d')]['id']){delete _0x400d83[_0x563c('0x3d')]['id'];}return db[_0x563c('0x20')][_0x563c('0x3c')]({'where':{'id':_0x400d83['params']['id']}})[_0x563c('0x1d')](handleEntityNotFound(_0x37cdb4,null))['then'](saveUpdates(_0x400d83[_0x563c('0x3d')],null))[_0x563c('0x1d')](respondWithResult(_0x37cdb4,null))[_0x563c('0x39')](handleError(_0x37cdb4,null));};exports[_0x563c('0x1e')]=function(_0x50a78f,_0x176415){return db[_0x563c('0x20')][_0x563c('0x3c')]({'where':{'id':_0x50a78f[_0x563c('0x3a')]['id']}})[_0x563c('0x1d')](handleEntityNotFound(_0x176415,null))['then'](removeEntity(_0x176415,null))['catch'](handleError(_0x176415,null));};exports[_0x563c('0x3e')]=function(_0x2451bf,_0xd879a){var _0xf29521;return db[_0x563c('0x3f')][_0x563c('0x40')](function(_0x3adc48){return db['CmCustomField']['create'](_0x2451bf[_0x563c('0x3d')],{'transaction':_0x3adc48})[_0x563c('0x1d')](function(_0x39da22){_0xf29521=_0x39da22;var _0x5bac2a={'type':db[_0x563c('0x41')][_0x563c('0x42')],'transaction':_0x3adc48};switch(_0x2451bf['body']['type']){case _0x563c('0x43'):_0x5bac2a['type']=db[_0x563c('0x41')][_0x563c('0x42')];break;case _0x563c('0x44'):_0x5bac2a[_0x563c('0x45')]=db[_0x563c('0x41')]['INTEGER'];break;case _0x563c('0x46'):_0x5bac2a[_0x563c('0x45')]=db[_0x563c('0x41')][_0x563c('0x47')];_0x5bac2a[_0x563c('0x48')]=![];break;default:}return db[_0x563c('0x3f')][_0x563c('0x49')][_0x563c('0x4a')](_0x563c('0x4b'),util[_0x563c('0x4c')](_0x563c('0x4d'),_0xf29521['id']),_0x5bac2a);})[_0x563c('0x1d')](function(){return _0xf29521;});})['then'](respondWithResult(_0xd879a,0xc9))[_0x563c('0x39')](handleError(_0xd879a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index f21955d..30b717f 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 _0xd47a=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./cmCustomField.attributes','define','CmCustomField'];(function(_0x14a513,_0x3239f){var _0x47236c=function(_0x394191){while(--_0x394191){_0x14a513['push'](_0x14a513['shift']());}};_0x47236c(++_0x3239f);}(_0xd47a,0x182));var _0xad47=function(_0x151334,_0x1e11ac){_0x151334=_0x151334-0x0;var _0x3d03da=_0xd47a[_0x151334];return _0x3d03da;};'use strict';var _=require(_0xad47('0x0'));var util=require(_0xad47('0x1'));var logger=require(_0xad47('0x2'))(_0xad47('0x3'));var moment=require(_0xad47('0x4'));var BPromise=require(_0xad47('0x5'));var rp=require(_0xad47('0x6'));var attributes=require(_0xad47('0x7'));module['exports']=function(_0x2226bb,_0x503cae){return _0x2226bb[_0xad47('0x8')](_0xad47('0x9'),attributes,{'tableName':_0xad47('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d2=['CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','define'];(function(_0x43b0a6,_0x4e08bb){var _0x355aa2=function(_0x16b254){while(--_0x16b254){_0x43b0a6['push'](_0x43b0a6['shift']());}};_0x355aa2(++_0x4e08bb);}(_0xd6d2,0xf2));var _0x2d6d=function(_0x1274cd,_0x5b00d6){_0x1274cd=_0x1274cd-0x0;var _0x3095c2=_0xd6d2[_0x1274cd];return _0x3095c2;};'use strict';var _=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var logger=require(_0x2d6d('0x2'))(_0x2d6d('0x3'));var moment=require(_0x2d6d('0x4'));var BPromise=require(_0x2d6d('0x5'));var rp=require(_0x2d6d('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x3bfb68,_0x2d4cc7){return _0x3bfb68[_0x2d6d('0x7')](_0x2d6d('0x8'),attributes,{'tableName':_0x2d6d('0x9'),'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 bff385f..ec838f7 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 _0x64be=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2b5621,_0x2d428e){var _0x30e03f=function(_0x3ee79a){while(--_0x3ee79a){_0x2b5621['push'](_0x2b5621['shift']());}};_0x30e03f(++_0x2d428e);}(_0x64be,0x120));var _0xe64b=function(_0x20ef0c,_0x1a36c6){_0x20ef0c=_0x20ef0c-0x0;var _0x248042=_0x64be[_0x20ef0c];return _0x248042;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe64b('0x0'));var BPromise=require(_0xe64b('0x1'));var rs=require(_0xe64b('0x2'));var fs=require('fs');var db=require(_0xe64b('0x3'))['db'];var utils=require(_0xe64b('0x4'));var logger=require(_0xe64b('0x5'))(_0xe64b('0x6'));var config=require(_0xe64b('0x7'));var jayson=require(_0xe64b('0x8'));var client=jayson[_0xe64b('0x9')][_0xe64b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57b34d,_0x2d1123,_0x3b5f3c){return new BPromise(function(_0x79619d,_0x6c2c7e){return client['request'](_0x57b34d,_0x3b5f3c)[_0xe64b('0xb')](function(_0x521baf){logger[_0xe64b('0xc')](_0xe64b('0xd'),_0x2d1123,'request\x20sent');logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0x2d1123,_0xe64b('0xe'),JSON[_0xe64b('0xf')](_0x521baf));if(_0x521baf[_0xe64b('0x10')]){if(_0x521baf[_0xe64b('0x10')]['code']===0x1f4){logger['error'](_0xe64b('0xd'),_0x2d1123,_0x521baf[_0xe64b('0x10')]['message']);return _0x6c2c7e(_0x521baf[_0xe64b('0x10')]['message']);}logger['error'](_0xe64b('0xd'),_0x2d1123,_0x521baf[_0xe64b('0x10')][_0xe64b('0x11')]);return _0x79619d(_0x521baf[_0xe64b('0x10')][_0xe64b('0x11')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x2d1123,'request\x20sent');_0x79619d(_0x521baf[_0xe64b('0x12')][_0xe64b('0x11')]);}})[_0xe64b('0x13')](function(_0x16dfce){logger['error'](_0xe64b('0xd'),_0x2d1123,_0x16dfce);_0x6c2c7e(_0x16dfce);});});} \ No newline at end of file +var _0xff43=['catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x2990a6,_0x4374bf){var _0x4b64fb=function(_0x4e7ccb){while(--_0x4e7ccb){_0x2990a6['push'](_0x2990a6['shift']());}};_0x4b64fb(++_0x4374bf);}(_0xff43,0x65));var _0x3ff4=function(_0x50a444,_0x4e34ac){_0x50a444=_0x50a444-0x0;var _0xaf00ac=_0xff43[_0x50a444];return _0xaf00ac;};'use strict';var _=require('lodash');var util=require(_0x3ff4('0x0'));var moment=require(_0x3ff4('0x1'));var BPromise=require(_0x3ff4('0x2'));var rs=require(_0x3ff4('0x3'));var fs=require('fs');var db=require(_0x3ff4('0x4'))['db'];var utils=require(_0x3ff4('0x5'));var logger=require(_0x3ff4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3ff4('0x7'));var client=jayson[_0x3ff4('0x8')][_0x3ff4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30167e,_0xf3b14c,_0x260334){return new BPromise(function(_0x394fe6,_0x50266b){return client[_0x3ff4('0xa')](_0x30167e,_0x260334)[_0x3ff4('0xb')](function(_0x396df8){logger[_0x3ff4('0xc')](_0x3ff4('0xd'),_0xf3b14c,_0x3ff4('0xe'));logger['debug']('CmCustomField,\x20%s,\x20%s,\x20%s',_0xf3b14c,'request\x20sent',JSON[_0x3ff4('0xf')](_0x396df8));if(_0x396df8[_0x3ff4('0x10')]){if(_0x396df8[_0x3ff4('0x10')]['code']===0x1f4){logger[_0x3ff4('0x10')]('CmCustomField,\x20%s,\x20%s',_0xf3b14c,_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);return _0x50266b(_0x396df8['error'][_0x3ff4('0x11')]);}logger[_0x3ff4('0x10')](_0x3ff4('0xd'),_0xf3b14c,_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);return _0x394fe6(_0x396df8[_0x3ff4('0x10')][_0x3ff4('0x11')]);}else{logger['info'](_0x3ff4('0xd'),_0xf3b14c,_0x3ff4('0xe'));_0x394fe6(_0x396df8[_0x3ff4('0x12')][_0x3ff4('0x11')]);}})[_0x3ff4('0x13')](function(_0x28e951){logger[_0x3ff4('0x10')]('CmCustomField,\x20%s,\x20%s',_0xf3b14c,_0x28e951);_0x50266b(_0x28e951);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 57f2db6..e95e355 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 _0xe910=['../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','path','Router','../../components/interaction/service'];(function(_0x4aba0e,_0x3cca89){var _0x240301=function(_0x376410){while(--_0x376410){_0x4aba0e['push'](_0x4aba0e['shift']());}};_0x240301(++_0x3cca89);}(_0xe910,0x12c));var _0x0e91=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0xe910[_0x12b8ec];return _0x21af77;};'use strict';var multer=require(_0x0e91('0x0'));var util=require('util');var path=require(_0x0e91('0x1'));var express=require('express');var router=express[_0x0e91('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0e91('0x3'));var config=require(_0x0e91('0x4'));var controller=require(_0x0e91('0x5'));router[_0x0e91('0x6')]('/',auth[_0x0e91('0x7')](),controller[_0x0e91('0x8')]);router[_0x0e91('0x6')](_0x0e91('0x9'),auth[_0x0e91('0x7')](),controller[_0x0e91('0xa')]);router[_0x0e91('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x0e91('0x7')](),controller[_0x0e91('0xc')]);router[_0x0e91('0xd')](_0x0e91('0x9'),auth['isAuthenticated'](),controller[_0x0e91('0xe')]);module[_0x0e91('0xf')]=router; \ No newline at end of file +var _0x036f=['get','index','/:id','isAuthenticated','show','post','create','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x32175b,_0x8f7caf){var _0x59d1cc=function(_0x391c91){while(--_0x391c91){_0x32175b['push'](_0x32175b['shift']());}};_0x59d1cc(++_0x8f7caf);}(_0x036f,0x1c4));var _0xf036=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0x036f[_0x4c06ac];return _0x2333cb;};'use strict';var multer=require(_0xf036('0x0'));var util=require(_0xf036('0x1'));var path=require('path');var express=require(_0xf036('0x2'));var router=express[_0xf036('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf036('0x4'));var config=require(_0xf036('0x5'));var controller=require(_0xf036('0x6'));router[_0xf036('0x7')]('/',auth['isAuthenticated'](),controller[_0xf036('0x8')]);router[_0xf036('0x7')](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xb')]);router[_0xf036('0xc')]('/',auth[_0xf036('0xa')](),controller[_0xf036('0xd')]);router['put'](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xe')]);router['delete'](_0xf036('0x9'),auth[_0xf036('0xa')](),controller[_0xf036('0xf')]);module[_0xf036('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 9716269..44b8dd0 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 _0x7c0e=['UNSIGNED','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x5a4a1f,_0x3f90b6){var _0x43db26=function(_0x2824f5){while(--_0x2824f5){_0x5a4a1f['push'](_0x5a4a1f['shift']());}};_0x43db26(++_0x3f90b6);}(_0x7c0e,0x14c));var _0xe7c0=function(_0x2736c3,_0x14072c){_0x2736c3=_0x2736c3-0x0;var _0x268f75=_0x7c0e[_0x2736c3];return _0x268f75;};'use strict';var moment=require(_0xe7c0('0x0'));var Sequelize=require(_0xe7c0('0x1'));module[_0xe7c0('0x2')]={'phone':{'type':Sequelize[_0xe7c0('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xe7c0('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xe7c0('0x5')],'defaultValue':moment()['format'](_0xe7c0('0x6'))},'countbusyretry':{'type':Sequelize[_0xe7c0('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe7c0('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe7c0('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xe7c0('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe7c0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe7c0('0x5')]},'priority':{'type':Sequelize[_0xe7c0('0x7')](0x2)[_0xe7c0('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xe7c0('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xe7c0('0x9')},'ListId':{'type':Sequelize[_0xe7c0('0x7')],'unique':_0xe7c0('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xe7c0('0x9')},'CampaignId':{'type':Sequelize[_0xe7c0('0x7')]}}; \ No newline at end of file +var _0x2b15=['contactListQueue','moment','sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x2b15,0x141));var _0x52b1=function(_0x10dc94,_0x2fed4f){_0x10dc94=_0x10dc94-0x0;var _0x4a462d=_0x2b15[_0x10dc94];return _0x4a462d;};'use strict';var moment=require(_0x52b1('0x0'));var Sequelize=require(_0x52b1('0x1'));module['exports']={'phone':{'type':Sequelize[_0x52b1('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x52b1('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x52b1('0x4')](_0x52b1('0x5'))},'countbusyretry':{'type':Sequelize[_0x52b1('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x52b1('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x52b1('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x52b1('0x7')]},'priority':{'type':Sequelize[_0x52b1('0x6')](0x2)[_0x52b1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x52b1('0x6')],'unique':_0x52b1('0x9')},'ListId':{'type':Sequelize[_0x52b1('0x6')],'unique':_0x52b1('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x52b1('0x9')},'CampaignId':{'type':Sequelize[_0x52b1('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 235bf04..080d6b7 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 _0xdfe9=['attributes','length','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','map','includeAll','include','findAll','rows','catch','show','params','merge','options','find','create','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','hopperIds','findOne','scheduledat','priority','DESC','scheduledAt','UserId','LOCK','UPDATE','CmCompany','Company','CmList','List','dialActive','isNumber','entity\x20not\x20found','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopper','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x192a7c,_0x5cc0cd){_0x192a7c=_0x192a7c-0x0;var _0x24b308=_0xdfe9[_0x192a7c];return _0x24b308;};'use strict';var jsonpatch=require(_0x9dfe('0x0'));var rp=require('request-promise');var moment=require(_0x9dfe('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9dfe('0x2'));var path=require(_0x9dfe('0x3'));var sox=require(_0x9dfe('0x4'));var csv=require(_0x9dfe('0x5'));var ejs=require(_0x9dfe('0x6'));var fs=require('fs');var _=require(_0x9dfe('0x7'));var squel=require(_0x9dfe('0x8'));var crypto=require(_0x9dfe('0x9'));var jsforce=require(_0x9dfe('0xa'));var deskjs=require(_0x9dfe('0xb'));var toCsv=require(_0x9dfe('0x5'));var querystring=require('querystring');var Papa=require(_0x9dfe('0xc'));var qs=require(_0x9dfe('0xd'));var logger=require(_0x9dfe('0xe'))(_0x9dfe('0xf'));var utils=require(_0x9dfe('0x10'));var config=require(_0x9dfe('0x11'));var db=require(_0x9dfe('0x12'))['db'];function respondWithStatusCode(_0xaed877,_0x58e7bb){_0x58e7bb=_0x58e7bb||0xcc;return function(_0x263ad7){if(_0x263ad7){return _0xaed877[_0x9dfe('0x13')](_0x58e7bb);}return _0xaed877[_0x9dfe('0x14')](_0x58e7bb)[_0x9dfe('0x15')]();};}function respondWithResult(_0x5f4511,_0x4ebe42){_0x4ebe42=_0x4ebe42||0xc8;return function(_0x825165){if(_0x825165){return _0x5f4511[_0x9dfe('0x14')](_0x4ebe42)['json'](_0x825165);}};}function respondWithFilteredResult(_0x547ae1,_0x5d9256){return function(_0x173898){if(_0x173898){var _0x28d035=_0x173898[_0x9dfe('0x16')],_0x2a7734=_0x5d9256[_0x9dfe('0x17')],_0x12794d=_0x5d9256[_0x9dfe('0x17')]+_0x5d9256[_0x9dfe('0x18')],_0x189edc;if(_0x12794d>=_0x28d035){_0x12794d=_0x28d035;_0x189edc=0xc8;}else{_0x189edc=0xce;}_0x547ae1['status'](_0x189edc);return _0x547ae1['set'](_0x9dfe('0x19'),_0x2a7734+'-'+_0x12794d+'/'+_0x28d035)['json'](_0x173898);}return null;};}function patchUpdates(_0x1a7cbe){return function(_0x4232de){try{jsonpatch[_0x9dfe('0x1a')](_0x4232de,_0x1a7cbe,!![]);}catch(_0x43ad01){return BPromise[_0x9dfe('0x1b')](_0x43ad01);}return _0x4232de[_0x9dfe('0x1c')]();};}function saveUpdates(_0x5c7158,_0x270796){return function(_0x94082a){if(_0x94082a){return _0x94082a[_0x9dfe('0x1d')](_0x5c7158)[_0x9dfe('0x1e')](function(_0x2ebbc4){return _0x2ebbc4;});}return null;};}function removeEntity(_0x14b6f7,_0x1469a0){return function(_0x1a5b17){if(_0x1a5b17){return _0x1a5b17[_0x9dfe('0x1f')]()[_0x9dfe('0x1e')](function(){_0x14b6f7[_0x9dfe('0x14')](0xcc)[_0x9dfe('0x15')]();});}};}function handleEntityNotFound(_0x3c67cc,_0x2acba6){return function(_0x54ee52){if(!_0x54ee52){_0x3c67cc['sendStatus'](0x194);}return _0x54ee52;};}function handleError(_0x35cb5c,_0x1e1b3a){_0x1e1b3a=_0x1e1b3a||0x1f4;return function(_0x313b4b){logger[_0x9dfe('0x20')](_0x313b4b[_0x9dfe('0x21')]);if(_0x313b4b[_0x9dfe('0x22')]){delete _0x313b4b[_0x9dfe('0x22')];}_0x35cb5c[_0x9dfe('0x14')](_0x1e1b3a)[_0x9dfe('0x23')](_0x313b4b);};}exports[_0x9dfe('0x24')]=function(_0x3bcbe8,_0x512599){var _0x5b9502={},_0x14a616={},_0x18c158={'count':0x0,'rows':[]};var _0x51a6f1=db[_0x9dfe('0x25')][_0x9dfe('0x26')];_0x14a616[_0x9dfe('0x27')]=_['keys'](_0x51a6f1);var _0x2fba44={'dateStart':_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x29')],'dateEnd':_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x2a')]};delete _0x3bcbe8['query'][_0x9dfe('0x29')];delete _0x3bcbe8['query'][_0x9dfe('0x2a')];_0x14a616[_0x9dfe('0x28')]=_[_0x9dfe('0x2b')](_0x3bcbe8[_0x9dfe('0x28')]);_0x14a616[_0x9dfe('0x2c')]=_[_0x9dfe('0x2d')](_0x14a616[_0x9dfe('0x27')],_0x14a616[_0x9dfe('0x28')]);_0x5b9502['attributes']=_['intersection'](_0x14a616[_0x9dfe('0x27')],qs['fields'](_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x2e')]));_0x5b9502[_0x9dfe('0x2f')]=_0x5b9502['attributes'][_0x9dfe('0x30')]?_0x5b9502[_0x9dfe('0x2f')]:_0x14a616['model'];if(!_0x3bcbe8['query'][_0x9dfe('0x31')](_0x9dfe('0x32'))){_0x5b9502[_0x9dfe('0x18')]=qs[_0x9dfe('0x18')](_0x3bcbe8['query'][_0x9dfe('0x18')]);_0x5b9502[_0x9dfe('0x17')]=qs[_0x9dfe('0x17')](_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x17')]);}_0x5b9502['order']=qs[_0x9dfe('0x33')](_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x33')]);_0x5b9502[_0x9dfe('0x34')]=qs[_0x9dfe('0x2c')](_[_0x9dfe('0x35')](_0x3bcbe8[_0x9dfe('0x28')],_0x14a616['filters']));if(_0x2fba44[_0x9dfe('0x29')]){if(_0x2fba44[_0x9dfe('0x2a')]){_0x2fba44[_0x9dfe('0x2a')]=moment(_0x2fba44[_0x9dfe('0x2a')])[_0x9dfe('0x36')](0x1,'day');}else{_0x2fba44[_0x9dfe('0x2a')]=moment(_0x2fba44[_0x9dfe('0x29')])['add'](0x1,_0x9dfe('0x37'));}_['merge'](_0x5b9502[_0x9dfe('0x34')],{'createdAt':{'$gte':_0x2fba44[_0x9dfe('0x29')],'$lte':_0x2fba44[_0x9dfe('0x2a')]}});}if(_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x38')]){_0x5b9502['where']=_['merge'](_0x5b9502[_0x9dfe('0x34')],{'$or':_[_0x9dfe('0x39')](_0x5b9502['attributes'],function(_0x2168c7){var _0x509d7f={};_0x509d7f[_0x2168c7]={'$like':'%'+_0x3bcbe8[_0x9dfe('0x28')]['filter']+'%'};return _0x509d7f;})});}_0x5b9502=_['merge']({},_0x5b9502,_0x3bcbe8['options']);var _0x28856f={'where':_0x5b9502['where']};return db['CmHopper'][_0x9dfe('0x16')](_0x28856f)['then'](function(_0x2bf463){_0x18c158[_0x9dfe('0x16')]=_0x2bf463;if(_0x3bcbe8[_0x9dfe('0x28')][_0x9dfe('0x3a')]){_0x5b9502[_0x9dfe('0x3b')]=[{'all':!![]}];}return db[_0x9dfe('0x25')][_0x9dfe('0x3c')](_0x5b9502);})[_0x9dfe('0x1e')](function(_0x340f34){_0x18c158[_0x9dfe('0x3d')]=_0x340f34;return _0x18c158;})[_0x9dfe('0x1e')](respondWithFilteredResult(_0x512599,_0x5b9502))[_0x9dfe('0x3e')](handleError(_0x512599,null));};exports[_0x9dfe('0x3f')]=function(_0x42d51e,_0x2cd4c1){var _0x1350fa={'raw':!![],'where':{'id':_0x42d51e[_0x9dfe('0x40')]['id']}},_0x5dfa4b={};_0x5dfa4b[_0x9dfe('0x27')]=_[_0x9dfe('0x2b')](db['CmHopper']['rawAttributes']);_0x5dfa4b[_0x9dfe('0x28')]=_['keys'](_0x42d51e['query']);_0x5dfa4b[_0x9dfe('0x2c')]=_[_0x9dfe('0x2d')](_0x5dfa4b[_0x9dfe('0x27')],_0x5dfa4b[_0x9dfe('0x28')]);_0x1350fa[_0x9dfe('0x2f')]=_[_0x9dfe('0x2d')](_0x5dfa4b[_0x9dfe('0x27')],qs[_0x9dfe('0x2e')](_0x42d51e[_0x9dfe('0x28')][_0x9dfe('0x2e')]));_0x1350fa['attributes']=_0x1350fa[_0x9dfe('0x2f')][_0x9dfe('0x30')]?_0x1350fa[_0x9dfe('0x2f')]:_0x5dfa4b[_0x9dfe('0x27')];if(_0x42d51e[_0x9dfe('0x28')][_0x9dfe('0x3a')]){_0x1350fa['include']=[{'all':!![]}];}_0x1350fa=_[_0x9dfe('0x41')]({},_0x1350fa,_0x42d51e[_0x9dfe('0x42')]);return db[_0x9dfe('0x25')][_0x9dfe('0x43')](_0x1350fa)[_0x9dfe('0x1e')](handleEntityNotFound(_0x2cd4c1,null))[_0x9dfe('0x1e')](respondWithResult(_0x2cd4c1,null))['catch'](handleError(_0x2cd4c1,null));};exports[_0x9dfe('0x44')]=function(_0x427ec3,_0x37036d){return db[_0x9dfe('0x25')][_0x9dfe('0x44')](_0x427ec3[_0x9dfe('0x45')],{})[_0x9dfe('0x1e')](respondWithResult(_0x37036d,0xc9))[_0x9dfe('0x3e')](handleError(_0x37036d,null));};exports[_0x9dfe('0x1d')]=function(_0x36a433,_0xb597b1){if(_0x36a433[_0x9dfe('0x45')]['id']){delete _0x36a433[_0x9dfe('0x45')]['id'];}return db[_0x9dfe('0x25')][_0x9dfe('0x43')]({'where':{'id':_0x36a433['params']['id']}})[_0x9dfe('0x1e')](handleEntityNotFound(_0xb597b1,null))[_0x9dfe('0x1e')](saveUpdates(_0x36a433['body'],null))['then'](respondWithResult(_0xb597b1,null))[_0x9dfe('0x3e')](handleError(_0xb597b1,null));};exports[_0x9dfe('0x46')]=function(_0x556309,_0x4caa6a){return db['CmHopper'][_0x9dfe('0x46')]()[_0x9dfe('0x1e')](respondWithResult(_0x4caa6a,null))[_0x9dfe('0x3e')](handleError(_0x4caa6a,null));};exports[_0x9dfe('0x1f')]=function(_0x5d488d,_0x396bbe){var _0x3b6f0c;return db[_0x9dfe('0x25')][_0x9dfe('0x43')]({'where':{'id':_0x5d488d[_0x9dfe('0x40')]['id']}})['then'](handleEntityNotFound(_0x396bbe,null))[_0x9dfe('0x1e')](function(_0x219475){if(_0x219475){return _0x219475['destroy']()[_0x9dfe('0x1e')](function(_0x34474c){return _0x34474c;});}})['then'](function(_0x1e3042){_0x3b6f0c=_0x1e3042;if(_0x1e3042){if(_0x1e3042[_0x9dfe('0x47')]||_0x1e3042[_0x9dfe('0x48')]){return db[_0x1e3042['VoiceQueueId']?_0x9dfe('0x49'):_0x9dfe('0x4a')]['find']({'where':{'id':_0x1e3042['VoiceQueueId']?_0x1e3042[_0x9dfe('0x47')]:_0x1e3042['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x9dfe('0x1e')](function(_0x349c71){var _0x14ef32={};if(_0x349c71){_['merge'](_0x14ef32,_['omit'](_0x3b6f0c[_0x9dfe('0x4b')],[_0x9dfe('0x4c'),_0x9dfe('0x4d'),'id']));_0x14ef32[_0x9dfe('0x4e')]=0x15;_0x14ef32[_0x9dfe('0x4f')]=_0x9dfe('0x50');_0x14ef32[_0x9dfe('0x51')]=_0x349c71['name'];_0x14ef32[_0x9dfe('0x52')]=_0x5d488d[_0x9dfe('0x53')][_0x9dfe('0x22')];_0x14ef32['UserId']=_0x5d488d[_0x9dfe('0x53')]['id'];_0x14ef32['deleted']=!![];_0x14ef32[_0x9dfe('0x54')]=moment()[_0x9dfe('0x55')](_0x9dfe('0x56'));_0x14ef32[_0x9dfe('0x57')]=_0x3b6f0c[_0x9dfe('0x58')];_0x14ef32['campaigntype']=_0x3b6f0c[_0x9dfe('0x47')]?_0x9dfe('0x59'):_0x9dfe('0x5a');return db[_0x9dfe('0x5b')][_0x9dfe('0x43')]({'where':{'id':_0x14ef32[_0x9dfe('0x5c')]},'attributes':[_0x9dfe('0x5d'),_0x9dfe('0x5e')]})[_0x9dfe('0x1e')](function(_0x4455fc){if(!_[_0x9dfe('0x5f')](_0x396bbe)&&!_['isNil'](_0x4455fc[_0x9dfe('0x5d')])){_0x14ef32['calleridname']=_0x4455fc['firstName'];if(!_[_0x9dfe('0x5f')](_0x4455fc[_0x9dfe('0x5e')])){_0x14ef32[_0x9dfe('0x60')]+='\x20'+_0x4455fc['lastName'];}}})['finally'](function(){return db[_0x9dfe('0x61')][_0x9dfe('0x44')](_0x14ef32);});}})[_0x9dfe('0x1e')](function(){return _0x396bbe[_0x9dfe('0x14')](0xcc)[_0x9dfe('0x15')]();})[_0x9dfe('0x3e')](handleError(_0x396bbe,null));};exports[_0x9dfe('0x62')]=function(_0x5c281e,_0x2c7c2c,_0x4139c2){var _0x1686ce=[];return db[_0x9dfe('0x5b')]['describe']()['then'](function(_0xc624ce){_0x1686ce=_[_0x9dfe('0x2b')](_0xc624ce);return _0x5c281e[_0x9dfe('0x53')][_0x9dfe('0x63')]({'where':{'type':_0x9dfe('0x64'),'dialActive':!![],'dialMethod':_0x9dfe('0x65')},'attributes':['id',_0x9dfe('0x66')],'raw':!![]});})[_0x9dfe('0x1e')](function(_0x8f7882){if(_0x8f7882&&_0x8f7882[_0x9dfe('0x30')]){return db[_0x9dfe('0x67')][_0x9dfe('0x68')](function(_0x3069ed){var _0x598b11={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x9dfe('0x56'))},'VoiceQueueId':{'$in':_[_0x9dfe('0x39')](_0x8f7882,'id')},'$or':[{'UserId':null},{'UserId':_0x5c281e[_0x9dfe('0x53')]['id']}]};if(!_['isEmpty'](_0x5c281e[_0x9dfe('0x45')][_0x9dfe('0x69')])){var _0x4d7dd8={'$notIn':_0x5c281e[_0x9dfe('0x45')][_0x9dfe('0x69')]};_0x598b11['id']=_0x4d7dd8;}return db[_0x9dfe('0x25')][_0x9dfe('0x6a')]({'attributes':['id',_0x9dfe('0x6b')],'where':_0x598b11,'order':[[_0x9dfe('0x6c'),_0x9dfe('0x6d')],[_0x9dfe('0x6e'),_0x8f7882[0x0][_0x9dfe('0x66')]],[_0x9dfe('0x6f'),_0x9dfe('0x6d')],['id','ASC']],'transaction':_0x3069ed,'lock':_0x3069ed[_0x9dfe('0x70')][_0x9dfe('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x1686ce,'include':[{'model':db[_0x9dfe('0x72')],'as':_0x9dfe('0x73'),'attributes':['id',_0x9dfe('0x22')]}]},{'model':db[_0x9dfe('0x74')],'as':_0x9dfe('0x75'),'attributes':['id',_0x9dfe('0x22')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0x9dfe('0x22'),_0x9dfe('0x76')]}]})[_0x9dfe('0x1e')](function(_0x18fbf6){if(_0x18fbf6){return _0x18fbf6[_0x9dfe('0x1d')]({'UserId':_0x5c281e[_0x9dfe('0x53')]['id']},{'transaction':_0x3069ed});}});});}})[_0x9dfe('0x1e')](handleEntityNotFound(_0x2c7c2c,null))['then'](respondWithResult(_0x2c7c2c,null))[_0x9dfe('0x3e')](handleError(_0x2c7c2c,null));};exports['getOpenContacts']=function(_0x506fa7,_0x2c8068,_0x6d6e4f){return _0x506fa7[_0x9dfe('0x53')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x9dfe('0x65')},'attributes':['id'],'raw':!![]})[_0x9dfe('0x1e')](function(_0x2b6a7e){if(_0x2b6a7e&&_0x2b6a7e['length']){return db[_0x9dfe('0x25')][_0x9dfe('0x16')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x9dfe('0x55')](_0x9dfe('0x56'))},'VoiceQueueId':{'$in':_['map'](_0x2b6a7e,'id')},'$or':[{'UserId':null},{'UserId':_0x506fa7[_0x9dfe('0x53')]['id']}]}});}return 0x0;})[_0x9dfe('0x1e')](function(_0x220128){if(!_[_0x9dfe('0x5f')](_0x220128)&&_[_0x9dfe('0x77')](_0x220128)){return _0x2c8068['status'](0xc8)['json']({'contacts':_0x220128});}else{logger['error']('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x9dfe('0x78'));_0x2c8068[_0x9dfe('0x13')](0x194);}})[_0x9dfe('0x3e')](handleError(_0x2c8068,null));}; \ No newline at end of file +var _0x3308=['moment','bluebird','mustache','util','path','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','CmHopper','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','update','params','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','end','getPreview','getVoiceQueues','preview','sequelize','transaction','isEmpty','hopperIds','findOne','scheduledat','priority','DESC','dialOrderByScheduledAt','ASC','UPDATE','Contact','Company','CmList','List','Queue','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','fast-json-patch','request-promise'];(function(_0x454e70,_0x5367ae){var _0x57a428=function(_0x995a6){while(--_0x995a6){_0x454e70['push'](_0x454e70['shift']());}};_0x57a428(++_0x5367ae);}(_0x3308,0x160));var _0x8330=function(_0x4c1f59,_0x11dbda){_0x4c1f59=_0x4c1f59-0x0;var _0x307147=_0x3308[_0x4c1f59];return _0x307147;};'use strict';var jsonpatch=require(_0x8330('0x0'));var rp=require(_0x8330('0x1'));var moment=require(_0x8330('0x2'));var BPromise=require(_0x8330('0x3'));var Mustache=require(_0x8330('0x4'));var util=require(_0x8330('0x5'));var path=require(_0x8330('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8330('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8330('0x8'));var crypto=require(_0x8330('0x9'));var jsforce=require(_0x8330('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8330('0xb'));var querystring=require(_0x8330('0xc'));var Papa=require(_0x8330('0xd'));var qs=require(_0x8330('0xe'));var logger=require(_0x8330('0xf'))(_0x8330('0x10'));var utils=require('../../config/utils');var config=require(_0x8330('0x11'));var db=require(_0x8330('0x12'))['db'];function respondWithStatusCode(_0xc80f4c,_0x5ec516){_0x5ec516=_0x5ec516||0xcc;return function(_0x52522c){if(_0x52522c){return _0xc80f4c['sendStatus'](_0x5ec516);}return _0xc80f4c['status'](_0x5ec516)['end']();};}function respondWithResult(_0x54a18b,_0x30e631){_0x30e631=_0x30e631||0xc8;return function(_0x55db5c){if(_0x55db5c){return _0x54a18b[_0x8330('0x13')](_0x30e631)[_0x8330('0x14')](_0x55db5c);}};}function respondWithFilteredResult(_0x252953,_0x3ceb1e){return function(_0x306b34){if(_0x306b34){var _0x4ee58b=_0x306b34[_0x8330('0x15')],_0x199da4=_0x3ceb1e[_0x8330('0x16')],_0x4f0cf0=_0x3ceb1e[_0x8330('0x16')]+_0x3ceb1e[_0x8330('0x17')],_0x293658;if(_0x4f0cf0>=_0x4ee58b){_0x4f0cf0=_0x4ee58b;_0x293658=0xc8;}else{_0x293658=0xce;}_0x252953[_0x8330('0x13')](_0x293658);return _0x252953[_0x8330('0x18')](_0x8330('0x19'),_0x199da4+'-'+_0x4f0cf0+'/'+_0x4ee58b)[_0x8330('0x14')](_0x306b34);}return null;};}function patchUpdates(_0x4d9662){return function(_0x27ebf8){try{jsonpatch[_0x8330('0x1a')](_0x27ebf8,_0x4d9662,!![]);}catch(_0x47895b){return BPromise[_0x8330('0x1b')](_0x47895b);}return _0x27ebf8[_0x8330('0x1c')]();};}function saveUpdates(_0x457dc7,_0x56fc18){return function(_0xca2672){if(_0xca2672){return _0xca2672['update'](_0x457dc7)[_0x8330('0x1d')](function(_0x58e614){return _0x58e614;});}return null;};}function removeEntity(_0x3e8c0e,_0x16a208){return function(_0x57a7f6){if(_0x57a7f6){return _0x57a7f6[_0x8330('0x1e')]()['then'](function(){_0x3e8c0e[_0x8330('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x239822,_0x1fc4e8){return function(_0x1b213f){if(!_0x1b213f){_0x239822[_0x8330('0x1f')](0x194);}return _0x1b213f;};}function handleError(_0x317045,_0x1ebee7){_0x1ebee7=_0x1ebee7||0x1f4;return function(_0x121d03){logger[_0x8330('0x20')](_0x121d03[_0x8330('0x21')]);if(_0x121d03[_0x8330('0x22')]){delete _0x121d03[_0x8330('0x22')];}_0x317045['status'](_0x1ebee7)['send'](_0x121d03);};}exports['index']=function(_0x23a439,_0x1fb538){var _0x36db54={},_0xa04d8={},_0x44adb5={'count':0x0,'rows':[]};var _0x7ea841=db[_0x8330('0x23')]['rawAttributes'];_0xa04d8[_0x8330('0x24')]=_[_0x8330('0x25')](_0x7ea841);var _0x545e15={'dateStart':_0x23a439[_0x8330('0x26')][_0x8330('0x27')],'dateEnd':_0x23a439[_0x8330('0x26')][_0x8330('0x28')]};delete _0x23a439[_0x8330('0x26')]['dateStart'];delete _0x23a439[_0x8330('0x26')]['dateEnd'];_0xa04d8[_0x8330('0x26')]=_[_0x8330('0x25')](_0x23a439[_0x8330('0x26')]);_0xa04d8['filters']=_[_0x8330('0x29')](_0xa04d8[_0x8330('0x24')],_0xa04d8['query']);_0x36db54[_0x8330('0x2a')]=_['intersection'](_0xa04d8[_0x8330('0x24')],qs[_0x8330('0x2b')](_0x23a439[_0x8330('0x26')][_0x8330('0x2b')]));_0x36db54[_0x8330('0x2a')]=_0x36db54[_0x8330('0x2a')][_0x8330('0x2c')]?_0x36db54[_0x8330('0x2a')]:_0xa04d8[_0x8330('0x24')];if(!_0x23a439[_0x8330('0x26')][_0x8330('0x2d')]('nolimit')){_0x36db54['limit']=qs[_0x8330('0x17')](_0x23a439['query'][_0x8330('0x17')]);_0x36db54['offset']=qs['offset'](_0x23a439[_0x8330('0x26')][_0x8330('0x16')]);}_0x36db54[_0x8330('0x2e')]=qs[_0x8330('0x2f')](_0x23a439['query'][_0x8330('0x2f')]);_0x36db54['where']=qs[_0x8330('0x30')](_[_0x8330('0x31')](_0x23a439[_0x8330('0x26')],_0xa04d8[_0x8330('0x30')]));if(_0x545e15[_0x8330('0x27')]){if(_0x545e15[_0x8330('0x28')]){_0x545e15['dateEnd']=moment(_0x545e15[_0x8330('0x28')])[_0x8330('0x32')](0x1,_0x8330('0x33'));}else{_0x545e15[_0x8330('0x28')]=moment(_0x545e15[_0x8330('0x27')])[_0x8330('0x32')](0x1,_0x8330('0x33'));}_[_0x8330('0x34')](_0x36db54['where'],{'createdAt':{'$gte':_0x545e15['dateStart'],'$lte':_0x545e15[_0x8330('0x28')]}});}if(_0x23a439[_0x8330('0x26')][_0x8330('0x35')]){_0x36db54[_0x8330('0x36')]=_[_0x8330('0x34')](_0x36db54[_0x8330('0x36')],{'$or':_[_0x8330('0x37')](_0x36db54[_0x8330('0x2a')],function(_0x3ccfa1){var _0x4a7634={};_0x4a7634[_0x3ccfa1]={'$like':'%'+_0x23a439[_0x8330('0x26')][_0x8330('0x35')]+'%'};return _0x4a7634;})});}_0x36db54=_[_0x8330('0x34')]({},_0x36db54,_0x23a439[_0x8330('0x38')]);var _0xf1c683={'where':_0x36db54[_0x8330('0x36')]};return db[_0x8330('0x23')][_0x8330('0x15')](_0xf1c683)[_0x8330('0x1d')](function(_0xdc529a){_0x44adb5[_0x8330('0x15')]=_0xdc529a;if(_0x23a439[_0x8330('0x26')][_0x8330('0x39')]){_0x36db54[_0x8330('0x3a')]=[{'all':!![]}];}return db[_0x8330('0x23')][_0x8330('0x3b')](_0x36db54);})['then'](function(_0x2e06fb){_0x44adb5[_0x8330('0x3c')]=_0x2e06fb;return _0x44adb5;})[_0x8330('0x1d')](respondWithFilteredResult(_0x1fb538,_0x36db54))[_0x8330('0x3d')](handleError(_0x1fb538,null));};exports['show']=function(_0x136919,_0x752941){var _0x1e71df={'raw':!![],'where':{'id':_0x136919['params']['id']}},_0x11dabe={};_0x11dabe[_0x8330('0x24')]=_['keys'](db['CmHopper'][_0x8330('0x3e')]);_0x11dabe['query']=_['keys'](_0x136919['query']);_0x11dabe[_0x8330('0x30')]=_[_0x8330('0x29')](_0x11dabe[_0x8330('0x24')],_0x11dabe[_0x8330('0x26')]);_0x1e71df[_0x8330('0x2a')]=_[_0x8330('0x29')](_0x11dabe[_0x8330('0x24')],qs[_0x8330('0x2b')](_0x136919[_0x8330('0x26')]['fields']));_0x1e71df[_0x8330('0x2a')]=_0x1e71df[_0x8330('0x2a')][_0x8330('0x2c')]?_0x1e71df[_0x8330('0x2a')]:_0x11dabe[_0x8330('0x24')];if(_0x136919[_0x8330('0x26')][_0x8330('0x39')]){_0x1e71df[_0x8330('0x3a')]=[{'all':!![]}];}_0x1e71df=_[_0x8330('0x34')]({},_0x1e71df,_0x136919[_0x8330('0x38')]);return db[_0x8330('0x23')][_0x8330('0x3f')](_0x1e71df)['then'](handleEntityNotFound(_0x752941,null))[_0x8330('0x1d')](respondWithResult(_0x752941,null))[_0x8330('0x3d')](handleError(_0x752941,null));};exports[_0x8330('0x40')]=function(_0x927efc,_0x3afffc){return db['CmHopper'][_0x8330('0x40')](_0x927efc[_0x8330('0x41')],{})[_0x8330('0x1d')](respondWithResult(_0x3afffc,0xc9))['catch'](handleError(_0x3afffc,null));};exports[_0x8330('0x42')]=function(_0x504a75,_0x4d5466){if(_0x504a75[_0x8330('0x41')]['id']){delete _0x504a75[_0x8330('0x41')]['id'];}return db[_0x8330('0x23')]['find']({'where':{'id':_0x504a75[_0x8330('0x43')]['id']}})[_0x8330('0x1d')](handleEntityNotFound(_0x4d5466,null))[_0x8330('0x1d')](saveUpdates(_0x504a75[_0x8330('0x41')],null))['then'](respondWithResult(_0x4d5466,null))[_0x8330('0x3d')](handleError(_0x4d5466,null));};exports[_0x8330('0x44')]=function(_0x1c9e8d,_0x5df830){return db[_0x8330('0x23')]['describe']()[_0x8330('0x1d')](respondWithResult(_0x5df830,null))[_0x8330('0x3d')](handleError(_0x5df830,null));};exports[_0x8330('0x1e')]=function(_0x510197,_0x42e4fd){var _0x268ce7;return db[_0x8330('0x23')][_0x8330('0x3f')]({'where':{'id':_0x510197[_0x8330('0x43')]['id']}})['then'](handleEntityNotFound(_0x42e4fd,null))[_0x8330('0x1d')](function(_0x3d1636){if(_0x3d1636){return _0x3d1636[_0x8330('0x1e')]()[_0x8330('0x1d')](function(_0xad07bc){return _0xad07bc;});}})[_0x8330('0x1d')](function(_0x34084a){_0x268ce7=_0x34084a;if(_0x34084a){if(_0x34084a[_0x8330('0x45')]||_0x34084a[_0x8330('0x46')]){return db[_0x34084a[_0x8330('0x45')]?_0x8330('0x47'):_0x8330('0x48')][_0x8330('0x3f')]({'where':{'id':_0x34084a['VoiceQueueId']?_0x34084a[_0x8330('0x45')]:_0x34084a['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x8330('0x1d')](function(_0x19dba9){var _0x432cb6={};if(_0x19dba9){_[_0x8330('0x34')](_0x432cb6,_['omit'](_0x268ce7[_0x8330('0x49')],[_0x8330('0x4a'),_0x8330('0x4b'),'id']));_0x432cb6['state']=0x15;_0x432cb6[_0x8330('0x4c')]=_0x8330('0x4d');_0x432cb6[_0x8330('0x4e')]=_0x19dba9['name'];_0x432cb6['membername']=_0x510197[_0x8330('0x4f')][_0x8330('0x22')];_0x432cb6[_0x8330('0x50')]=_0x510197[_0x8330('0x4f')]['id'];_0x432cb6[_0x8330('0x4d')]=!![];_0x432cb6[_0x8330('0x51')]=moment()[_0x8330('0x52')](_0x8330('0x53'));_0x432cb6[_0x8330('0x54')]=_0x268ce7[_0x8330('0x55')];_0x432cb6['campaigntype']=_0x268ce7[_0x8330('0x45')]?'queue':'ivr';return db[_0x8330('0x56')]['find']({'where':{'id':_0x432cb6[_0x8330('0x57')]},'attributes':['firstName',_0x8330('0x58')]})[_0x8330('0x1d')](function(_0x44f4a5){if(!_[_0x8330('0x59')](_0x42e4fd)&&!_['isNil'](_0x44f4a5[_0x8330('0x5a')])){_0x432cb6[_0x8330('0x5b')]=_0x44f4a5['firstName'];if(!_[_0x8330('0x59')](_0x44f4a5['lastName'])){_0x432cb6[_0x8330('0x5b')]+='\x20'+_0x44f4a5[_0x8330('0x58')];}}})[_0x8330('0x5c')](function(){return db[_0x8330('0x5d')][_0x8330('0x40')](_0x432cb6);});}})[_0x8330('0x1d')](function(){return _0x42e4fd['status'](0xcc)[_0x8330('0x5e')]();})[_0x8330('0x3d')](handleError(_0x42e4fd,null));};exports[_0x8330('0x5f')]=function(_0x328b1f,_0x4988b5,_0x5c0c2a){var _0x1ccdb7=[];return db[_0x8330('0x56')][_0x8330('0x44')]()[_0x8330('0x1d')](function(_0x19362f){_0x1ccdb7=_['keys'](_0x19362f);return _0x328b1f['user'][_0x8330('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x8330('0x61')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x8330('0x1d')](function(_0x324a36){if(_0x324a36&&_0x324a36[_0x8330('0x2c')]){return db[_0x8330('0x62')][_0x8330('0x63')](function(_0x45f605){var _0x5af4b9={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8330('0x52')](_0x8330('0x53'))},'VoiceQueueId':{'$in':_[_0x8330('0x37')](_0x324a36,'id')},'$or':[{'UserId':null},{'UserId':_0x328b1f['user']['id']}]};if(!_[_0x8330('0x64')](_0x328b1f[_0x8330('0x41')]['hopperIds'])){var _0x43807a={'$notIn':_0x328b1f['body'][_0x8330('0x65')]};_0x5af4b9['id']=_0x43807a;}return db[_0x8330('0x23')][_0x8330('0x66')]({'attributes':['id',_0x8330('0x67')],'where':_0x5af4b9,'order':[[_0x8330('0x68'),_0x8330('0x69')],['scheduledAt',_0x324a36[0x0][_0x8330('0x6a')]],['UserId',_0x8330('0x69')],['id',_0x8330('0x6b')]],'transaction':_0x45f605,'lock':_0x45f605['LOCK'][_0x8330('0x6c')],'include':[{'model':db[_0x8330('0x56')],'as':_0x8330('0x6d'),'attributes':_0x1ccdb7,'include':[{'model':db['CmCompany'],'as':_0x8330('0x6e'),'attributes':['id',_0x8330('0x22')]}]},{'model':db[_0x8330('0x6f')],'as':_0x8330('0x70'),'attributes':['id','name']},{'model':db[_0x8330('0x47')],'as':_0x8330('0x71'),'attributes':['id',_0x8330('0x22'),'dialActive']}]})[_0x8330('0x1d')](function(_0x4f7449){if(_0x4f7449){return _0x4f7449[_0x8330('0x42')]({'UserId':_0x328b1f[_0x8330('0x4f')]['id']},{'transaction':_0x45f605});}});});}})[_0x8330('0x1d')](handleEntityNotFound(_0x4988b5,null))[_0x8330('0x1d')](respondWithResult(_0x4988b5,null))[_0x8330('0x3d')](handleError(_0x4988b5,null));};exports[_0x8330('0x72')]=function(_0x249fd9,_0x2ff8cf,_0xd0f784){return _0x249fd9[_0x8330('0x4f')][_0x8330('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x1c2417){if(_0x1c2417&&_0x1c2417[_0x8330('0x2c')]){return db[_0x8330('0x23')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x8330('0x52')](_0x8330('0x53'))},'VoiceQueueId':{'$in':_[_0x8330('0x37')](_0x1c2417,'id')},'$or':[{'UserId':null},{'UserId':_0x249fd9[_0x8330('0x4f')]['id']}]}});}return 0x0;})['then'](function(_0x5358ac){if(!_[_0x8330('0x59')](_0x5358ac)&&_[_0x8330('0x73')](_0x5358ac)){return _0x2ff8cf[_0x8330('0x13')](0xc8)[_0x8330('0x14')]({'contacts':_0x5358ac});}else{logger[_0x8330('0x20')](_0x8330('0x74'),_0x8330('0x72'),0x194,_0x8330('0x75'));_0x2ff8cf[_0x8330('0x1f')](0x194);}})['catch'](handleError(_0x2ff8cf,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 234cd30..9805e5d 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 _0xa097=['scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','define','CmHopper'];(function(_0x3ca672,_0x2e3824){var _0x2ecf27=function(_0x1441b7){while(--_0x1441b7){_0x3ca672['push'](_0x3ca672['shift']());}};_0x2ecf27(++_0x2e3824);}(_0xa097,0xdf));var _0x7a09=function(_0x20237d,_0x506c3d){_0x20237d=_0x20237d-0x0;var _0x5a5b92=_0xa097[_0x20237d];return _0x5a5b92;};'use strict';var _=require(_0x7a09('0x0'));var util=require('util');var logger=require(_0x7a09('0x1'))(_0x7a09('0x2'));var moment=require(_0x7a09('0x3'));var BPromise=require(_0x7a09('0x4'));var rp=require(_0x7a09('0x5'));var attributes=require('./cmHopper.attributes');module['exports']=function(_0x9edb0f,_0x48db0c){return _0x9edb0f[_0x7a09('0x6')](_0x7a09('0x7'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x7a09('0x8'),'fields':[_0x7a09('0x8')]},{'name':'phone','fields':[_0x7a09('0x9')]},{'name':_0x7a09('0xa'),'fields':[_0x7a09('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x825f=['cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','./cmHopper.attributes','exports','define','CmHopper'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x825f,0x122));var _0xf825=function(_0x5859f9,_0x4428e5){_0x5859f9=_0x5859f9-0x0;var _0x126499=_0x825f[_0x5859f9];return _0x126499;};'use strict';var _=require(_0xf825('0x0'));var util=require('util');var logger=require(_0xf825('0x1'))(_0xf825('0x2'));var moment=require(_0xf825('0x3'));var BPromise=require(_0xf825('0x4'));var rp=require('request-promise');var attributes=require(_0xf825('0x5'));module[_0xf825('0x6')]=function(_0x4c5bb2,_0x810fce){return _0x4c5bb2[_0xf825('0x7')](_0xf825('0x8'),attributes,{'tableName':_0xf825('0x9'),'paranoid':![],'indexes':[{'name':_0xf825('0xa'),'fields':[_0xf825('0xa')]},{'name':_0xf825('0xb'),'fields':[_0xf825('0xb')]},{'name':_0xf825('0xc'),'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 7c2eaae..1de2fcc 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 _0xdb22=['CountReScheduled','GetContactRecallMe','UserId','UPDATE','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCmHopper','findAll','options','where','attributes','limit','include','map','model','debug','catch','ShowCmHopper','CmHopper','find','raw','CreateCmHopper','create','body','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','describe','sequelize','transaction','order','LOCK','CmContact','Contact','keys','push','update','all','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdb22,0x144));var _0x2db2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xdb22[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x2db2('0x0'));var util=require(_0x2db2('0x1'));var moment=require('moment');var BPromise=require(_0x2db2('0x2'));var rs=require(_0x2db2('0x3'));var fs=require('fs');var db=require(_0x2db2('0x4'))['db'];var utils=require(_0x2db2('0x5'));var logger=require(_0x2db2('0x6'))('rpc');var config=require(_0x2db2('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x25eca1,_0x3f1624,_0xf1433f){return new BPromise(function(_0xb7ef33,_0x1866f1){return client[_0x2db2('0x8')](_0x25eca1,_0xf1433f)[_0x2db2('0x9')](function(_0x25e208){logger[_0x2db2('0xa')](_0x2db2('0xb'),_0x3f1624,_0x2db2('0xc'));logger['debug']('CmHopper,\x20%s,\x20%s,\x20%s',_0x3f1624,_0x2db2('0xc'),JSON[_0x2db2('0xd')](_0x25e208));if(_0x25e208[_0x2db2('0xe')]){if(_0x25e208[_0x2db2('0xe')]['code']===0x1f4){logger[_0x2db2('0xe')](_0x2db2('0xb'),_0x3f1624,_0x25e208[_0x2db2('0xe')][_0x2db2('0xf')]);return _0x1866f1(_0x25e208[_0x2db2('0xe')]['message']);}logger[_0x2db2('0xe')](_0x2db2('0xb'),_0x3f1624,_0x25e208[_0x2db2('0xe')][_0x2db2('0xf')]);return _0xb7ef33(_0x25e208[_0x2db2('0xe')][_0x2db2('0xf')]);}else{logger['info'](_0x2db2('0xb'),_0x3f1624,_0x2db2('0xc'));_0xb7ef33(_0x25e208[_0x2db2('0x10')][_0x2db2('0xf')]);}})['catch'](function(_0x17952a){logger[_0x2db2('0xe')](_0x2db2('0xb'),_0x3f1624,_0x17952a);_0x1866f1(_0x17952a);});});}exports[_0x2db2('0x11')]=function(_0x534212){var _0x293d4c=this;return new Promise(function(_0x55468c,_0x3fa1aa){return db['CmHopper'][_0x2db2('0x12')]({'raw':_0x534212[_0x2db2('0x13')]?_0x534212[_0x2db2('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x534212[_0x2db2('0x13')]?_0x534212[_0x2db2('0x13')][_0x2db2('0x14')]||null:null,'attributes':_0x534212[_0x2db2('0x13')]?_0x534212[_0x2db2('0x13')][_0x2db2('0x15')]||null:null,'limit':_0x534212[_0x2db2('0x13')]?_0x534212[_0x2db2('0x13')][_0x2db2('0x16')]||null:null,'include':_0x534212[_0x2db2('0x13')]?_0x534212[_0x2db2('0x13')][_0x2db2('0x17')]?_['map'](_0x534212[_0x2db2('0x13')]['include'],function(_0x1e89b3){return{'model':db[_0x1e89b3['model']],'as':_0x1e89b3['as'],'attributes':_0x1e89b3[_0x2db2('0x15')],'include':_0x1e89b3['include']?_[_0x2db2('0x18')](_0x1e89b3[_0x2db2('0x17')],function(_0x1dfb8f){return{'model':db[_0x1dfb8f['model']],'as':_0x1dfb8f['as'],'attributes':_0x1dfb8f[_0x2db2('0x15')],'include':_0x1dfb8f[_0x2db2('0x17')]?_['map'](_0x1dfb8f[_0x2db2('0x17')],function(_0x3d6b84){return{'model':db[_0x3d6b84[_0x2db2('0x19')]],'as':_0x3d6b84['as'],'attributes':_0x3d6b84[_0x2db2('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x9')](function(_0x305e6c){logger['info']('GetCmHopper',_0x534212);logger[_0x2db2('0x1a')](_0x2db2('0x11'),_0x534212,JSON[_0x2db2('0xd')](_0x305e6c));_0x55468c(_0x305e6c);})[_0x2db2('0x1b')](function(_0x3a44b0){logger[_0x2db2('0xe')](_0x2db2('0x11'),_0x3a44b0[_0x2db2('0xf')],_0x534212);_0x3fa1aa(_0x293d4c[_0x2db2('0xe')](0x1f4,_0x3a44b0[_0x2db2('0xf')]));});});};exports[_0x2db2('0x1c')]=function(_0x35f78e){var _0x241940=this;return new Promise(function(_0x5e2a5c,_0x152fe0){return db[_0x2db2('0x1d')][_0x2db2('0x1e')]({'raw':_0x35f78e['options']?_0x35f78e['options'][_0x2db2('0x1f')]===undefined?!![]:![]:!![],'where':_0x35f78e['options']?_0x35f78e[_0x2db2('0x13')]['where']||null:null,'attributes':_0x35f78e[_0x2db2('0x13')]?_0x35f78e['options'][_0x2db2('0x15')]||null:null,'include':_0x35f78e[_0x2db2('0x13')]?_0x35f78e[_0x2db2('0x13')][_0x2db2('0x17')]?_['map'](_0x35f78e[_0x2db2('0x13')]['include'],function(_0x1f9888){return{'model':db[_0x1f9888[_0x2db2('0x19')]],'as':_0x1f9888['as'],'attributes':_0x1f9888[_0x2db2('0x15')],'include':_0x1f9888[_0x2db2('0x17')]?_[_0x2db2('0x18')](_0x1f9888[_0x2db2('0x17')],function(_0x101f6a){return{'model':db[_0x101f6a[_0x2db2('0x19')]],'as':_0x101f6a['as'],'attributes':_0x101f6a[_0x2db2('0x15')],'include':_0x101f6a['include']?_['map'](_0x101f6a[_0x2db2('0x17')],function(_0x49bdba){return{'model':db[_0x49bdba['model']],'as':_0x49bdba['as'],'attributes':_0x49bdba['attributes']};}):[]};}):[]};}):[]:[]})[_0x2db2('0x9')](function(_0x1470f7){logger[_0x2db2('0xa')]('ShowCmHopper',_0x35f78e);logger[_0x2db2('0x1a')](_0x2db2('0x1c'),_0x35f78e,JSON[_0x2db2('0xd')](_0x1470f7));_0x5e2a5c(_0x1470f7);})[_0x2db2('0x1b')](function(_0x4c535e){logger[_0x2db2('0xe')](_0x2db2('0x1c'),_0x4c535e['message'],_0x35f78e);_0x152fe0(_0x241940[_0x2db2('0xe')](0x1f4,_0x4c535e[_0x2db2('0xf')]));});});};exports[_0x2db2('0x20')]=function(_0x3a797e){var _0x41afe0=this;return new Promise(function(_0x109629,_0x1fa171){return db['CmHopper'][_0x2db2('0x21')](_0x3a797e[_0x2db2('0x22')],{'raw':_0x3a797e[_0x2db2('0x13')]?_0x3a797e[_0x2db2('0x13')][_0x2db2('0x1f')]===undefined?!![]:![]:!![]})[_0x2db2('0x9')](function(_0x2dd478){logger[_0x2db2('0xa')](_0x2db2('0x20'),_0x3a797e);logger['debug'](_0x2db2('0x20'),_0x3a797e,JSON['stringify'](_0x2dd478));_0x109629(_0x2dd478);})[_0x2db2('0x1b')](function(_0x409b33){logger[_0x2db2('0xe')](_0x2db2('0x20'),_0x409b33[_0x2db2('0xf')],_0x3a797e);_0x1fa171(_0x41afe0['error'](0x1f4,_0x409b33[_0x2db2('0xf')]));});});};exports[_0x2db2('0x23')]=function(_0x4e233c){var _0xcf5cd5=this;return new Promise(function(_0x244c50,_0x33d055){return db[_0x2db2('0x1d')]['update'](_0x4e233c[_0x2db2('0x22')],{'raw':_0x4e233c[_0x2db2('0x13')]?_0x4e233c['options'][_0x2db2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e233c[_0x2db2('0x13')]?_0x4e233c[_0x2db2('0x13')][_0x2db2('0x14')]||null:null,'attributes':_0x4e233c['options']?_0x4e233c[_0x2db2('0x13')][_0x2db2('0x15')]||null:null,'limit':_0x4e233c[_0x2db2('0x13')]?_0x4e233c['options'][_0x2db2('0x16')]||null:null})[_0x2db2('0x9')](function(_0x1d3eae){logger[_0x2db2('0xa')](_0x2db2('0x23'),_0x4e233c);logger[_0x2db2('0x1a')](_0x2db2('0x23'),_0x4e233c,JSON[_0x2db2('0xd')](_0x1d3eae));_0x244c50(_0x1d3eae);})[_0x2db2('0x1b')](function(_0x563c1d){logger[_0x2db2('0xe')](_0x2db2('0x23'),_0x563c1d[_0x2db2('0xf')],_0x4e233c);_0x33d055(_0xcf5cd5[_0x2db2('0xe')](0x1f4,_0x563c1d[_0x2db2('0xf')]));});});};exports['DestroyCmHopper']=function(_0x8ae4df){var _0x44d8d6=this;return new Promise(function(_0x5334ba,_0x4d3314){return db[_0x2db2('0x1d')][_0x2db2('0x24')]({'where':_0x8ae4df['options']?_0x8ae4df['options'][_0x2db2('0x14')]||null:null})[_0x2db2('0x9')](function(_0x1874fe){logger['info'](_0x2db2('0x25'),_0x8ae4df);logger[_0x2db2('0x1a')]('DestroyCmHopper',_0x8ae4df,JSON['stringify'](_0x1874fe));_0x5334ba(_0x1874fe);})[_0x2db2('0x1b')](function(_0x459ba5){logger[_0x2db2('0xe')](_0x2db2('0x25'),_0x459ba5[_0x2db2('0xf')],_0x8ae4df);_0x4d3314(_0x44d8d6['error'](0x1f4,_0x459ba5[_0x2db2('0xf')]));});});};exports[_0x2db2('0x26')]=function(_0x10b730){var _0x3bab86=this;return new Promise(function(_0x33ee0b,_0x2d1203){return db['CmContact'][_0x2db2('0x27')]()['then'](function(_0xf2934d){return db[_0x2db2('0x28')][_0x2db2('0x29')](function(_0xd2091e){return db['CmHopper'][_0x2db2('0x12')]({'where':_0x10b730[_0x2db2('0x13')]?_0x10b730['options'][_0x2db2('0x14')]||null:null,'attributes':_0x10b730[_0x2db2('0x13')]?_0x10b730[_0x2db2('0x13')]['attributes']||null:null,'limit':_0x10b730[_0x2db2('0x13')]?_0x10b730[_0x2db2('0x13')]['limit']||null:null,'order':_0x10b730[_0x2db2('0x13')]?_0x10b730[_0x2db2('0x13')][_0x2db2('0x2a')]||null:null,'transaction':_0xd2091e,'lock':_0xd2091e[_0x2db2('0x2b')]['UPDATE'],'include':[{'model':db[_0x2db2('0x2c')],'as':_0x2db2('0x2d'),'attributes':_[_0x2db2('0x2e')](_0xf2934d)}]})[_0x2db2('0x9')](function(_0x4245a6){var _0x482262=[];for(var _0x2798c9=0x0;_0x2798c9<_0x4245a6['length'];_0x2798c9+=0x1){_0x482262[_0x2db2('0x2f')](_0x4245a6[_0x2798c9][_0x2db2('0x30')](_0x10b730[_0x2db2('0x22')],{'transaction':_0xd2091e}));}return BPromise[_0x2db2('0x31')](_0x482262);});})[_0x2db2('0x9')](function(_0x33cfd9){logger[_0x2db2('0xa')](_0x2db2('0x26'),_0x10b730);logger[_0x2db2('0x1a')]('GetContactDialer',_0x10b730,JSON[_0x2db2('0xd')](_0x33cfd9));_0x33ee0b(_0x33cfd9);})[_0x2db2('0x1b')](function(_0x48f021){logger['error'](_0x2db2('0x26'),_0x48f021['message'],_0x10b730);_0x2d1203(_0x3bab86[_0x2db2('0xe')](0x1f4,_0x48f021['message']));});});});};exports[_0x2db2('0x32')]=function(_0xa60d3d){var _0x4bb92c=this;return new Promise(function(_0x4de17c,_0x25041f){return db[_0x2db2('0x28')]['transaction'](function(_0x211f63){return db[_0x2db2('0x33')][_0x2db2('0x21')](_0xa60d3d['body'],{'raw':_0xa60d3d[_0x2db2('0x13')]?_0xa60d3d[_0x2db2('0x13')][_0x2db2('0x1f')]===undefined?!![]:![]:!![],'transaction':_0x211f63})[_0x2db2('0x9')](function(){return db[_0x2db2('0x1d')]['destroy']({'where':_0xa60d3d[_0x2db2('0x13')]?_0xa60d3d[_0x2db2('0x13')][_0x2db2('0x14')]||null:null,'transaction':_0x211f63});});})[_0x2db2('0x9')](function(_0x356aad){logger[_0x2db2('0xa')](_0x2db2('0x32'),_0xa60d3d);logger[_0x2db2('0x1a')]('MoveContactManagedDialer',_0xa60d3d,JSON[_0x2db2('0xd')](_0x356aad));_0x4de17c(_0x356aad);})[_0x2db2('0x1b')](function(_0x4a4e34){logger[_0x2db2('0xe')]('MoveContactManagedDialer',_0x4a4e34[_0x2db2('0xf')],_0xa60d3d);_0x25041f(_0x4bb92c['error'](0x1f4,_0x4a4e34[_0x2db2('0xf')]));});});};exports['CountReScheduled']=function(_0x3ebc8f){var _0x2c19fe=this;return new Promise(function(_0x443187,_0x2b2001){return db[_0x2db2('0x1d')][_0x2db2('0x12')]({'raw':_0x3ebc8f[_0x2db2('0x13')]?_0x3ebc8f[_0x2db2('0x13')][_0x2db2('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ebc8f[_0x2db2('0x13')]?_0x3ebc8f[_0x2db2('0x13')][_0x2db2('0x14')]||null:null,'attributes':[[db[_0x2db2('0x28')]['fn'](_0x2db2('0x34'),db[_0x2db2('0x28')]['fn']('IF',db['sequelize'][_0x2db2('0x35')](_0x2db2('0x36')+util[_0x2db2('0x37')](_0x2db2('0x38'),moment()[_0x2db2('0x37')](_0x2db2('0x39')))+_0x2db2('0x3a')))),_0x2db2('0x3b')]]})[_0x2db2('0x9')](function(_0x195b9c){logger[_0x2db2('0xa')](_0x2db2('0x3c'),_0x3ebc8f);logger['debug'](_0x2db2('0x3c'),_0x3ebc8f,JSON[_0x2db2('0xd')](_0x195b9c));_0x443187(_0x195b9c);})[_0x2db2('0x1b')](function(_0x3e4017){logger['error']('CountReScheduled',_0x3e4017[_0x2db2('0xf')],_0x3ebc8f);_0x2b2001(_0x2c19fe[_0x2db2('0xe')](0x1f4,_0x3e4017[_0x2db2('0xf')]));});});};exports[_0x2db2('0x3d')]=function(_0xaaf209){var _0x420a6c=this;return new Promise(function(_0x3b9d12,_0x27669a){return db[_0x2db2('0x2c')][_0x2db2('0x27')]()['then'](function(_0x382468){return db[_0x2db2('0x28')][_0x2db2('0x29')](function(_0x82a2e5){return db[_0x2db2('0x1d')]['findAll']({'where':_0xaaf209['options']?_0xaaf209[_0x2db2('0x13')][_0x2db2('0x14')]||null:null,'attributes':_0xaaf209['options']?_0xaaf209['options']['attributes']||null:null,'limit':0x1,'order':_0xaaf209[_0x2db2('0x13')]?_0xaaf209['options'][_0x2db2('0x2a')]||null:null,'group':db['CmHopper'][_0x2db2('0x3e')],'transaction':_0x82a2e5,'lock':_0x82a2e5[_0x2db2('0x2b')][_0x2db2('0x3f')],'include':_0xaaf209[_0x2db2('0x13')]?_0xaaf209['options'][_0x2db2('0x17')]?_['map'](_0xaaf209[_0x2db2('0x13')]['include'],function(_0x3cd637){return{'model':db[_0x3cd637[_0x2db2('0x19')]],'as':_0x3cd637['as'],'attributes':_0x3cd637[_0x2db2('0x15')],'include':_0x3cd637['include']?_[_0x2db2('0x18')](_0x3cd637[_0x2db2('0x17')],function(_0x4a1d18){return{'model':db[_0x4a1d18['model']],'as':_0x4a1d18['as'],'attributes':_0x4a1d18[_0x2db2('0x15')],'include':_0x4a1d18['include']?_[_0x2db2('0x18')](_0x4a1d18[_0x2db2('0x17')],function(_0x412cf4){return{'model':db[_0x412cf4[_0x2db2('0x19')]],'as':_0x412cf4['as'],'attributes':_0x412cf4[_0x2db2('0x15')]};}):[]};}):[]};}):[]:[]})[_0x2db2('0x9')](function(_0x3ab4bc){var _0x1101a5=[];for(var _0x96d26a=0x0;_0x96d26a<_0x3ab4bc['length'];_0x96d26a+=0x1){_0x1101a5[_0x2db2('0x2f')](_0x3ab4bc[_0x96d26a][_0x2db2('0x30')](_0xaaf209['body'],{'transaction':_0x82a2e5}));}return BPromise[_0x2db2('0x31')](_0x1101a5);});})[_0x2db2('0x9')](function(_0x5e408c){logger[_0x2db2('0xa')](_0x2db2('0x3d'),_0xaaf209);logger['debug']('GetContactRecallMe',_0xaaf209,JSON[_0x2db2('0xd')](_0x5e408c));_0x3b9d12(_0x5e408c);})['catch'](function(_0x520c44){logger[_0x2db2('0xe')]('GetContactRecallMe',_0x520c44[_0x2db2('0xf')],_0xaaf209);_0x27669a(_0x420a6c['error'](0x1f4,_0x520c44[_0x2db2('0xf')]));});});});}; \ No newline at end of file +var _0xad8c=['destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','keys','length','push','update','all','sequelize','CmHopperFinal','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','UserId','GetContactRecallMe','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','attributes','include','map','model','find','raw','where','ShowCmHopper','create','body','CreateCmHopper','limit','UpdateCmHopper'];(function(_0x4b5efc,_0x473301){var _0x15f834=function(_0x142b65){while(--_0x142b65){_0x4b5efc['push'](_0x4b5efc['shift']());}};_0x15f834(++_0x473301);}(_0xad8c,0x123));var _0xcad8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xad8c[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0xcad8('0x0'));var util=require('util');var moment=require(_0xcad8('0x1'));var BPromise=require(_0xcad8('0x2'));var rs=require(_0xcad8('0x3'));var fs=require('fs');var db=require(_0xcad8('0x4'))['db'];var utils=require(_0xcad8('0x5'));var logger=require(_0xcad8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcad8('0x7'));var client=jayson[_0xcad8('0x8')][_0xcad8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3da7b9,_0x59cf94,_0x471042){return new BPromise(function(_0x3e9407,_0x5d173f){return client[_0xcad8('0xa')](_0x3da7b9,_0x471042)[_0xcad8('0xb')](function(_0x213111){logger[_0xcad8('0xc')](_0xcad8('0xd'),_0x59cf94,_0xcad8('0xe'));logger[_0xcad8('0xf')](_0xcad8('0x10'),_0x59cf94,_0xcad8('0xe'),JSON[_0xcad8('0x11')](_0x213111));if(_0x213111['error']){if(_0x213111[_0xcad8('0x12')]['code']===0x1f4){logger[_0xcad8('0x12')](_0xcad8('0xd'),_0x59cf94,_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);return _0x5d173f(_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);}logger[_0xcad8('0x12')](_0xcad8('0xd'),_0x59cf94,_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);return _0x3e9407(_0x213111[_0xcad8('0x12')][_0xcad8('0x13')]);}else{logger[_0xcad8('0xc')](_0xcad8('0xd'),_0x59cf94,'request\x20sent');_0x3e9407(_0x213111[_0xcad8('0x14')][_0xcad8('0x13')]);}})[_0xcad8('0x15')](function(_0x57ecfa){logger['error'](_0xcad8('0xd'),_0x59cf94,_0x57ecfa);_0x5d173f(_0x57ecfa);});});}exports[_0xcad8('0x16')]=function(_0x1a91a0){var _0xe6a1a0=this;return new Promise(function(_0x4c7a99,_0x48e8d5){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'raw':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')]['where']||null:null,'attributes':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0[_0xcad8('0x19')][_0xcad8('0x1a')]||null:null,'limit':_0x1a91a0['options']?_0x1a91a0[_0xcad8('0x19')]['limit']||null:null,'include':_0x1a91a0[_0xcad8('0x19')]?_0x1a91a0['options'][_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x1a91a0['options']['include'],function(_0x56cd0e){return{'model':db[_0x56cd0e[_0xcad8('0x1d')]],'as':_0x56cd0e['as'],'attributes':_0x56cd0e[_0xcad8('0x1a')],'include':_0x56cd0e[_0xcad8('0x1b')]?_['map'](_0x56cd0e[_0xcad8('0x1b')],function(_0x4cac2f){return{'model':db[_0x4cac2f[_0xcad8('0x1d')]],'as':_0x4cac2f['as'],'attributes':_0x4cac2f[_0xcad8('0x1a')],'include':_0x4cac2f[_0xcad8('0x1b')]?_['map'](_0x4cac2f[_0xcad8('0x1b')],function(_0xcbdd22){return{'model':db[_0xcbdd22[_0xcad8('0x1d')]],'as':_0xcbdd22['as'],'attributes':_0xcbdd22[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x42b089){logger[_0xcad8('0xc')]('GetCmHopper',_0x1a91a0);logger[_0xcad8('0xf')]('GetCmHopper',_0x1a91a0,JSON[_0xcad8('0x11')](_0x42b089));_0x4c7a99(_0x42b089);})[_0xcad8('0x15')](function(_0x1287e2){logger['error']('GetCmHopper',_0x1287e2[_0xcad8('0x13')],_0x1a91a0);_0x48e8d5(_0xe6a1a0[_0xcad8('0x12')](0x1f4,_0x1287e2['message']));});});};exports['ShowCmHopper']=function(_0x2914ce){var _0x470efa=this;return new Promise(function(_0x2494fd,_0x28e13d){return db['CmHopper'][_0xcad8('0x1e')]({'raw':_0x2914ce[_0xcad8('0x19')]?_0x2914ce['options'][_0xcad8('0x1f')]===undefined?!![]:![]:!![],'where':_0x2914ce['options']?_0x2914ce[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0x2914ce[_0xcad8('0x19')]?_0x2914ce[_0xcad8('0x19')][_0xcad8('0x1a')]||null:null,'include':_0x2914ce[_0xcad8('0x19')]?_0x2914ce['options'][_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x2914ce[_0xcad8('0x19')][_0xcad8('0x1b')],function(_0x4e4ac1){return{'model':db[_0x4e4ac1[_0xcad8('0x1d')]],'as':_0x4e4ac1['as'],'attributes':_0x4e4ac1[_0xcad8('0x1a')],'include':_0x4e4ac1[_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x4e4ac1[_0xcad8('0x1b')],function(_0x1cda5a){return{'model':db[_0x1cda5a[_0xcad8('0x1d')]],'as':_0x1cda5a['as'],'attributes':_0x1cda5a[_0xcad8('0x1a')],'include':_0x1cda5a[_0xcad8('0x1b')]?_['map'](_0x1cda5a[_0xcad8('0x1b')],function(_0x31c6aa){return{'model':db[_0x31c6aa[_0xcad8('0x1d')]],'as':_0x31c6aa['as'],'attributes':_0x31c6aa[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x63fe69){logger['info']('ShowCmHopper',_0x2914ce);logger[_0xcad8('0xf')](_0xcad8('0x21'),_0x2914ce,JSON[_0xcad8('0x11')](_0x63fe69));_0x2494fd(_0x63fe69);})['catch'](function(_0x5bfac7){logger[_0xcad8('0x12')](_0xcad8('0x21'),_0x5bfac7[_0xcad8('0x13')],_0x2914ce);_0x28e13d(_0x470efa[_0xcad8('0x12')](0x1f4,_0x5bfac7[_0xcad8('0x13')]));});});};exports['CreateCmHopper']=function(_0x4dc4c8){var _0x2fece0=this;return new Promise(function(_0x1d407c,_0x3fd135){return db['CmHopper'][_0xcad8('0x22')](_0x4dc4c8[_0xcad8('0x23')],{'raw':_0x4dc4c8[_0xcad8('0x19')]?_0x4dc4c8[_0xcad8('0x19')][_0xcad8('0x1f')]===undefined?!![]:![]:!![]})[_0xcad8('0xb')](function(_0x4a0d04){logger[_0xcad8('0xc')](_0xcad8('0x24'),_0x4dc4c8);logger[_0xcad8('0xf')](_0xcad8('0x24'),_0x4dc4c8,JSON[_0xcad8('0x11')](_0x4a0d04));_0x1d407c(_0x4a0d04);})[_0xcad8('0x15')](function(_0x182d89){logger['error']('CreateCmHopper',_0x182d89[_0xcad8('0x13')],_0x4dc4c8);_0x3fd135(_0x2fece0[_0xcad8('0x12')](0x1f4,_0x182d89['message']));});});};exports['UpdateCmHopper']=function(_0x44c443){var _0xba6efe=this;return new Promise(function(_0x22e1fd,_0x46cb30){return db[_0xcad8('0x17')]['update'](_0x44c443[_0xcad8('0x23')],{'raw':_0x44c443[_0xcad8('0x19')]?_0x44c443['options'][_0xcad8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44c443['options']?_0x44c443[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0x44c443[_0xcad8('0x19')]?_0x44c443['options'][_0xcad8('0x1a')]||null:null,'limit':_0x44c443['options']?_0x44c443[_0xcad8('0x19')][_0xcad8('0x25')]||null:null})[_0xcad8('0xb')](function(_0x5cc603){logger[_0xcad8('0xc')](_0xcad8('0x26'),_0x44c443);logger['debug'](_0xcad8('0x26'),_0x44c443,JSON[_0xcad8('0x11')](_0x5cc603));_0x22e1fd(_0x5cc603);})['catch'](function(_0x215253){logger[_0xcad8('0x12')]('UpdateCmHopper',_0x215253['message'],_0x44c443);_0x46cb30(_0xba6efe[_0xcad8('0x12')](0x1f4,_0x215253[_0xcad8('0x13')]));});});};exports['DestroyCmHopper']=function(_0x5c630e){var _0xc6c527=this;return new Promise(function(_0x5d1cab,_0x26c80b){return db['CmHopper'][_0xcad8('0x27')]({'where':_0x5c630e[_0xcad8('0x19')]?_0x5c630e['options']['where']||null:null})[_0xcad8('0xb')](function(_0x28b8e1){logger[_0xcad8('0xc')]('DestroyCmHopper',_0x5c630e);logger[_0xcad8('0xf')](_0xcad8('0x28'),_0x5c630e,JSON[_0xcad8('0x11')](_0x28b8e1));_0x5d1cab(_0x28b8e1);})[_0xcad8('0x15')](function(_0xf803c9){logger['error'](_0xcad8('0x28'),_0xf803c9[_0xcad8('0x13')],_0x5c630e);_0x26c80b(_0xc6c527[_0xcad8('0x12')](0x1f4,_0xf803c9[_0xcad8('0x13')]));});});};exports[_0xcad8('0x29')]=function(_0x27bf33){var _0x4c1523=this;return new Promise(function(_0xfd7092,_0x214aee){return db[_0xcad8('0x2a')][_0xcad8('0x2b')]()['then'](function(_0x49f20e){return db['sequelize'][_0xcad8('0x2c')](function(_0x2a89fb){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'where':_0x27bf33[_0xcad8('0x19')]?_0x27bf33['options'][_0xcad8('0x20')]||null:null,'attributes':_0x27bf33[_0xcad8('0x19')]?_0x27bf33['options'][_0xcad8('0x1a')]||null:null,'limit':_0x27bf33[_0xcad8('0x19')]?_0x27bf33[_0xcad8('0x19')][_0xcad8('0x25')]||null:null,'order':_0x27bf33['options']?_0x27bf33[_0xcad8('0x19')][_0xcad8('0x2d')]||null:null,'transaction':_0x2a89fb,'lock':_0x2a89fb[_0xcad8('0x2e')][_0xcad8('0x2f')],'include':[{'model':db[_0xcad8('0x2a')],'as':'Contact','attributes':_[_0xcad8('0x30')](_0x49f20e)}]})[_0xcad8('0xb')](function(_0x53ebd0){var _0x282a71=[];for(var _0x21d18d=0x0;_0x21d18d<_0x53ebd0[_0xcad8('0x31')];_0x21d18d+=0x1){_0x282a71[_0xcad8('0x32')](_0x53ebd0[_0x21d18d][_0xcad8('0x33')](_0x27bf33['body'],{'transaction':_0x2a89fb}));}return BPromise[_0xcad8('0x34')](_0x282a71);});})[_0xcad8('0xb')](function(_0x1da4c2){logger[_0xcad8('0xc')](_0xcad8('0x29'),_0x27bf33);logger[_0xcad8('0xf')](_0xcad8('0x29'),_0x27bf33,JSON['stringify'](_0x1da4c2));_0xfd7092(_0x1da4c2);})['catch'](function(_0x11f5ec){logger[_0xcad8('0x12')](_0xcad8('0x29'),_0x11f5ec['message'],_0x27bf33);_0x214aee(_0x4c1523[_0xcad8('0x12')](0x1f4,_0x11f5ec[_0xcad8('0x13')]));});});});};exports['MoveContactManagedDialer']=function(_0x338592){var _0x148c69=this;return new Promise(function(_0x7b3605,_0x46dc85){return db[_0xcad8('0x35')][_0xcad8('0x2c')](function(_0x2073c9){return db[_0xcad8('0x36')][_0xcad8('0x22')](_0x338592['body'],{'raw':_0x338592[_0xcad8('0x19')]?_0x338592[_0xcad8('0x19')]['raw']===undefined?!![]:![]:!![],'transaction':_0x2073c9})[_0xcad8('0xb')](function(){return db[_0xcad8('0x17')][_0xcad8('0x27')]({'where':_0x338592[_0xcad8('0x19')]?_0x338592[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'transaction':_0x2073c9});});})['then'](function(_0x27eb97){logger[_0xcad8('0xc')]('MoveContactManagedDialer',_0x338592);logger[_0xcad8('0xf')](_0xcad8('0x37'),_0x338592,JSON[_0xcad8('0x11')](_0x27eb97));_0x7b3605(_0x27eb97);})['catch'](function(_0x37c24a){logger[_0xcad8('0x12')](_0xcad8('0x37'),_0x37c24a['message'],_0x338592);_0x46dc85(_0x148c69[_0xcad8('0x12')](0x1f4,_0x37c24a[_0xcad8('0x13')]));});});};exports[_0xcad8('0x38')]=function(_0x53fbea){var _0x4520b2=this;return new Promise(function(_0x5f3dad,_0x48eb05){return db[_0xcad8('0x17')][_0xcad8('0x18')]({'raw':_0x53fbea['options']?_0x53fbea['options']['raw']===undefined?!![]:![]:!![],'where':_0x53fbea['options']?_0x53fbea[_0xcad8('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xcad8('0x39'),db[_0xcad8('0x35')]['fn']('IF',db[_0xcad8('0x35')][_0xcad8('0x3a')](_0xcad8('0x3b')+util['format']('\x22%s\x22',moment()[_0xcad8('0x3c')](_0xcad8('0x3d')))+_0xcad8('0x3e')))),_0xcad8('0x3f')]]})['then'](function(_0x1c1fac){logger[_0xcad8('0xc')](_0xcad8('0x38'),_0x53fbea);logger[_0xcad8('0xf')](_0xcad8('0x38'),_0x53fbea,JSON[_0xcad8('0x11')](_0x1c1fac));_0x5f3dad(_0x1c1fac);})[_0xcad8('0x15')](function(_0xc417){logger[_0xcad8('0x12')](_0xcad8('0x38'),_0xc417[_0xcad8('0x13')],_0x53fbea);_0x48eb05(_0x4520b2[_0xcad8('0x12')](0x1f4,_0xc417[_0xcad8('0x13')]));});});};exports['GetContactRecallMe']=function(_0xe96d51){var _0x3cb03c=this;return new Promise(function(_0x4bf893,_0x545e57){return db[_0xcad8('0x2a')]['describe']()[_0xcad8('0xb')](function(_0x3f250e){return db[_0xcad8('0x35')]['transaction'](function(_0x404d62){return db['CmHopper']['findAll']({'where':_0xe96d51[_0xcad8('0x19')]?_0xe96d51[_0xcad8('0x19')][_0xcad8('0x20')]||null:null,'attributes':_0xe96d51[_0xcad8('0x19')]?_0xe96d51['options']['attributes']||null:null,'limit':0x1,'order':_0xe96d51['options']?_0xe96d51[_0xcad8('0x19')][_0xcad8('0x2d')]||null:null,'group':db[_0xcad8('0x17')][_0xcad8('0x40')],'transaction':_0x404d62,'lock':_0x404d62[_0xcad8('0x2e')][_0xcad8('0x2f')],'include':_0xe96d51[_0xcad8('0x19')]?_0xe96d51[_0xcad8('0x19')]['include']?_[_0xcad8('0x1c')](_0xe96d51[_0xcad8('0x19')][_0xcad8('0x1b')],function(_0x181aa2){return{'model':db[_0x181aa2['model']],'as':_0x181aa2['as'],'attributes':_0x181aa2['attributes'],'include':_0x181aa2['include']?_[_0xcad8('0x1c')](_0x181aa2['include'],function(_0x4b47e2){return{'model':db[_0x4b47e2[_0xcad8('0x1d')]],'as':_0x4b47e2['as'],'attributes':_0x4b47e2[_0xcad8('0x1a')],'include':_0x4b47e2[_0xcad8('0x1b')]?_[_0xcad8('0x1c')](_0x4b47e2[_0xcad8('0x1b')],function(_0x2bb98f){return{'model':db[_0x2bb98f['model']],'as':_0x2bb98f['as'],'attributes':_0x2bb98f[_0xcad8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcad8('0xb')](function(_0x299f99){var _0x174730=[];for(var _0x59c82a=0x0;_0x59c82a<_0x299f99['length'];_0x59c82a+=0x1){_0x174730[_0xcad8('0x32')](_0x299f99[_0x59c82a][_0xcad8('0x33')](_0xe96d51[_0xcad8('0x23')],{'transaction':_0x404d62}));}return BPromise['all'](_0x174730);});})['then'](function(_0x306c76){logger[_0xcad8('0xc')](_0xcad8('0x41'),_0xe96d51);logger[_0xcad8('0xf')](_0xcad8('0x41'),_0xe96d51,JSON[_0xcad8('0x11')](_0x306c76));_0x4bf893(_0x306c76);})[_0xcad8('0x15')](function(_0x489b51){logger[_0xcad8('0x12')]('GetContactRecallMe',_0x489b51['message'],_0xe96d51);_0x545e57(_0x3cb03c[_0xcad8('0x12')](0x1f4,_0x489b51[_0xcad8('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 219ac63..87bdf4d 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 _0xbaf0=['getPreview','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','/preview'];(function(_0x2c756a,_0x536308){var _0x51eceb=function(_0x496e64){while(--_0x496e64){_0x2c756a['push'](_0x2c756a['shift']());}};_0x51eceb(++_0x536308);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var express=require(_0x0baf('0x2'));var router=express[_0x0baf('0x3')]();var auth=require(_0x0baf('0x4'));var interaction=require(_0x0baf('0x5'));var config=require('../../config/environment');var controller=require(_0x0baf('0x6'));router[_0x0baf('0x7')]('/',auth[_0x0baf('0x8')](),controller[_0x0baf('0x9')]);router[_0x0baf('0x7')](_0x0baf('0xa'),auth[_0x0baf('0x8')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x7')]('/opencontacts',auth[_0x0baf('0x8')](),controller['getOpenContacts']);router[_0x0baf('0x7')](_0x0baf('0xc'),auth[_0x0baf('0x8')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0x8')](),controller[_0x0baf('0xf')]);router[_0x0baf('0xe')](_0x0baf('0x10'),auth[_0x0baf('0x8')](),controller[_0x0baf('0x11')]);router['put']('/:id',auth[_0x0baf('0x8')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0xc'),auth['isAuthenticated'](),controller[_0x0baf('0x14')]);module['exports']=router; \ No newline at end of file +var _0x0713=['delete','destroy','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','show','post','create','/preview','getPreview','put','/:id'];(function(_0x4c7ecc,_0x2eb72a){var _0x5b6620=function(_0x1a6fca){while(--_0x1a6fca){_0x4c7ecc['push'](_0x4c7ecc['shift']());}};_0x5b6620(++_0x2eb72a);}(_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 express=require(_0x3071('0x1'));var router=express[_0x3071('0x2')]();var auth=require(_0x3071('0x3'));var interaction=require(_0x3071('0x4'));var config=require('../../config/environment');var controller=require(_0x3071('0x5'));router[_0x3071('0x6')]('/',auth[_0x3071('0x7')](),controller[_0x3071('0x8')]);router[_0x3071('0x6')](_0x3071('0x9'),auth[_0x3071('0x7')](),controller[_0x3071('0xa')]);router[_0x3071('0x6')](_0x3071('0xb'),auth[_0x3071('0x7')](),controller[_0x3071('0xc')]);router[_0x3071('0x6')]('/:id',auth[_0x3071('0x7')](),controller[_0x3071('0xd')]);router[_0x3071('0xe')]('/',auth[_0x3071('0x7')](),controller[_0x3071('0xf')]);router['post'](_0x3071('0x10'),auth[_0x3071('0x7')](),controller[_0x3071('0x11')]);router[_0x3071('0x12')](_0x3071('0x13'),auth['isAuthenticated'](),controller['update']);router[_0x3071('0x14')]('/:id',auth[_0x3071('0x7')](),controller[_0x3071('0x15')]);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 8d9e996..2fd3eb5 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 _0xcfbf=['sequelize','exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x39780c,_0x5782c9){var _0x53c19b=function(_0x594f01){while(--_0x594f01){_0x39780c['push'](_0x39780c['shift']());}};_0x53c19b(++_0x5782c9);}(_0xcfbf,0x17f));var _0xfcfb=function(_0x2b6578,_0x50eeb1){_0x2b6578=_0x2b6578-0x0;var _0x14da65=_0xcfbf[_0x2b6578];return _0x14da65;};'use strict';var moment=require(_0xfcfb('0x0'));var Sequelize=require(_0xfcfb('0x1'));module[_0xfcfb('0x2')]={'phone':{'type':Sequelize[_0xfcfb('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xfcfb('0x4')],'unique':_0xfcfb('0x5')},'ListId':{'type':Sequelize[_0xfcfb('0x4')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xfcfb('0x4')],'unique':_0xfcfb('0x5')}}; \ No newline at end of file +var _0xe4d2=['INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x463faa,_0x28d99e){var _0xfbb01c=function(_0x50ddce){while(--_0x50ddce){_0x463faa['push'](_0x463faa['shift']());}};_0xfbb01c(++_0x28d99e);}(_0xe4d2,0xed));var _0x2e4d=function(_0x47c39d,_0x3eea90){_0x47c39d=_0x47c39d-0x0;var _0xd41416=_0xe4d2[_0x47c39d];return _0xd41416;};'use strict';var moment=require(_0x2e4d('0x0'));var Sequelize=require(_0x2e4d('0x1'));module[_0x2e4d('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x2e4d('0x3')],'unique':_0x2e4d('0x4')},'ListId':{'type':Sequelize[_0x2e4d('0x3')],'unique':_0x2e4d('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2e4d('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index d589221..8bac0f0 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 _0x89bd=['status','end','json','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','CmHopperBlack','rawAttributes','model','keys','query','dateEnd','dateStart','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','day','add','filter','merge','map','includeAll','include','rows','params','options','find','catch','update','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus'];(function(_0x3c9814,_0x385abc){var _0x155464=function(_0x584bd9){while(--_0x584bd9){_0x3c9814['push'](_0x3c9814['shift']());}};_0x155464(++_0x385abc);}(_0x89bd,0x17f));var _0xd89b=function(_0x326539,_0x108886){_0x326539=_0x326539-0x0;var _0x2cbb6e=_0x89bd[_0x326539];return _0x2cbb6e;};'use strict';var jsonpatch=require(_0xd89b('0x0'));var rp=require(_0xd89b('0x1'));var moment=require(_0xd89b('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd89b('0x3'));var util=require(_0xd89b('0x4'));var path=require(_0xd89b('0x5'));var sox=require('sox');var csv=require(_0xd89b('0x6'));var ejs=require(_0xd89b('0x7'));var fs=require('fs');var _=require(_0xd89b('0x8'));var squel=require(_0xd89b('0x9'));var crypto=require(_0xd89b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xd89b('0xb'));var toCsv=require(_0xd89b('0x6'));var querystring=require(_0xd89b('0xc'));var Papa=require(_0xd89b('0xd'));var qs=require(_0xd89b('0xe'));var logger=require(_0xd89b('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xd89b('0x10'));var db=require(_0xd89b('0x11'))['db'];function respondWithStatusCode(_0x276092,_0x44508d){_0x44508d=_0x44508d||0xcc;return function(_0x441b77){if(_0x441b77){return _0x276092[_0xd89b('0x12')](_0x44508d);}return _0x276092[_0xd89b('0x13')](_0x44508d)[_0xd89b('0x14')]();};}function respondWithResult(_0x551620,_0x2f6b62){_0x2f6b62=_0x2f6b62||0xc8;return function(_0x581914){if(_0x581914){return _0x551620[_0xd89b('0x13')](_0x2f6b62)[_0xd89b('0x15')](_0x581914);}};}function respondWithFilteredResult(_0x428e1c,_0x6fc34b){return function(_0x313dee){if(_0x313dee){var _0x25b280=_0x313dee[_0xd89b('0x16')],_0x4bd8b1=_0x6fc34b[_0xd89b('0x17')],_0x39049a=_0x6fc34b['offset']+_0x6fc34b['limit'],_0x58be96;if(_0x39049a>=_0x25b280){_0x39049a=_0x25b280;_0x58be96=0xc8;}else{_0x58be96=0xce;}_0x428e1c[_0xd89b('0x13')](_0x58be96);return _0x428e1c[_0xd89b('0x18')](_0xd89b('0x19'),_0x4bd8b1+'-'+_0x39049a+'/'+_0x25b280)['json'](_0x313dee);}return null;};}function patchUpdates(_0x1024f0){return function(_0x2cec6d){try{jsonpatch[_0xd89b('0x1a')](_0x2cec6d,_0x1024f0,!![]);}catch(_0x2e035e){return BPromise[_0xd89b('0x1b')](_0x2e035e);}return _0x2cec6d[_0xd89b('0x1c')]();};}function saveUpdates(_0x49bff3,_0x30d1d5){return function(_0x3d1c1b){if(_0x3d1c1b){return _0x3d1c1b['update'](_0x49bff3)[_0xd89b('0x1d')](function(_0x57b235){return _0x57b235;});}return null;};}function removeEntity(_0x5e8db8,_0x574fe5){return function(_0x53d82a){if(_0x53d82a){return _0x53d82a['destroy']()['then'](function(){_0x5e8db8['status'](0xcc)[_0xd89b('0x14')]();});}};}function handleEntityNotFound(_0x5e9f60,_0x2a30a5){return function(_0x1eba29){if(!_0x1eba29){_0x5e9f60[_0xd89b('0x12')](0x194);}return _0x1eba29;};}function handleError(_0x28c216,_0x309da8){_0x309da8=_0x309da8||0x1f4;return function(_0x4b810d){logger[_0xd89b('0x1e')](_0x4b810d[_0xd89b('0x1f')]);if(_0x4b810d[_0xd89b('0x20')]){delete _0x4b810d[_0xd89b('0x20')];}_0x28c216['status'](_0x309da8)[_0xd89b('0x21')](_0x4b810d);};}exports['index']=function(_0x15665a,_0x35ed9c){var _0x365311={},_0x387ab8={},_0x5e14af={'count':0x0,'rows':[]};var _0x1e3bef=db[_0xd89b('0x22')][_0xd89b('0x23')];_0x387ab8[_0xd89b('0x24')]=_[_0xd89b('0x25')](_0x1e3bef);var _0x10a1b5={'dateStart':_0x15665a[_0xd89b('0x26')]['dateStart'],'dateEnd':_0x15665a[_0xd89b('0x26')][_0xd89b('0x27')]};delete _0x15665a[_0xd89b('0x26')][_0xd89b('0x28')];delete _0x15665a[_0xd89b('0x26')][_0xd89b('0x27')];_0x387ab8[_0xd89b('0x26')]=_['keys'](_0x15665a[_0xd89b('0x26')]);_0x387ab8['filters']=_[_0xd89b('0x29')](_0x387ab8['model'],_0x387ab8['query']);_0x365311[_0xd89b('0x2a')]=_[_0xd89b('0x29')](_0x387ab8['model'],qs[_0xd89b('0x2b')](_0x15665a[_0xd89b('0x26')][_0xd89b('0x2b')]));_0x365311[_0xd89b('0x2a')]=_0x365311[_0xd89b('0x2a')][_0xd89b('0x2c')]?_0x365311[_0xd89b('0x2a')]:_0x387ab8[_0xd89b('0x24')];if(!_0x15665a[_0xd89b('0x26')][_0xd89b('0x2d')](_0xd89b('0x2e'))){_0x365311[_0xd89b('0x2f')]=qs[_0xd89b('0x2f')](_0x15665a['query']['limit']);_0x365311[_0xd89b('0x17')]=qs[_0xd89b('0x17')](_0x15665a['query']['offset']);}_0x365311[_0xd89b('0x30')]=qs[_0xd89b('0x31')](_0x15665a['query'][_0xd89b('0x31')]);_0x365311[_0xd89b('0x32')]=qs[_0xd89b('0x33')](_['pick'](_0x15665a['query'],_0x387ab8[_0xd89b('0x33')]));if(_0x10a1b5[_0xd89b('0x28')]){if(_0x10a1b5[_0xd89b('0x27')]){_0x10a1b5['dateEnd']=moment(_0x10a1b5[_0xd89b('0x27')])['add'](0x1,_0xd89b('0x34'));}else{_0x10a1b5['dateEnd']=moment(_0x10a1b5[_0xd89b('0x28')])[_0xd89b('0x35')](0x1,_0xd89b('0x34'));}_['merge'](_0x365311['where'],{'createdAt':{'$gte':_0x10a1b5['dateStart'],'$lte':_0x10a1b5[_0xd89b('0x27')]}});}if(_0x15665a[_0xd89b('0x26')][_0xd89b('0x36')]){_0x365311['where']=_[_0xd89b('0x37')](_0x365311[_0xd89b('0x32')],{'$or':_[_0xd89b('0x38')](_0x365311['attributes'],function(_0x17b1c5){var _0x4c2e8b={};_0x4c2e8b[_0x17b1c5]={'$like':'%'+_0x15665a['query'][_0xd89b('0x36')]+'%'};return _0x4c2e8b;})});}_0x365311=_[_0xd89b('0x37')]({},_0x365311,_0x15665a['options']);var _0x327a61={'where':_0x365311[_0xd89b('0x32')]};return db[_0xd89b('0x22')][_0xd89b('0x16')](_0x327a61)[_0xd89b('0x1d')](function(_0x4eee81){_0x5e14af[_0xd89b('0x16')]=_0x4eee81;if(_0x15665a['query'][_0xd89b('0x39')]){_0x365311[_0xd89b('0x3a')]=[{'all':!![]}];}return db[_0xd89b('0x22')]['findAll'](_0x365311);})[_0xd89b('0x1d')](function(_0x3bfb59){_0x5e14af[_0xd89b('0x3b')]=_0x3bfb59;return _0x5e14af;})['then'](respondWithFilteredResult(_0x35ed9c,_0x365311))['catch'](handleError(_0x35ed9c,null));};exports['show']=function(_0x169593,_0x31e58b){var _0x29ea06={'raw':!![],'where':{'id':_0x169593[_0xd89b('0x3c')]['id']}},_0x11ae59={};_0x11ae59[_0xd89b('0x24')]=_[_0xd89b('0x25')](db['CmHopperBlack'][_0xd89b('0x23')]);_0x11ae59[_0xd89b('0x26')]=_[_0xd89b('0x25')](_0x169593[_0xd89b('0x26')]);_0x11ae59[_0xd89b('0x33')]=_[_0xd89b('0x29')](_0x11ae59[_0xd89b('0x24')],_0x11ae59[_0xd89b('0x26')]);_0x29ea06[_0xd89b('0x2a')]=_[_0xd89b('0x29')](_0x11ae59[_0xd89b('0x24')],qs[_0xd89b('0x2b')](_0x169593[_0xd89b('0x26')][_0xd89b('0x2b')]));_0x29ea06[_0xd89b('0x2a')]=_0x29ea06['attributes']['length']?_0x29ea06[_0xd89b('0x2a')]:_0x11ae59[_0xd89b('0x24')];if(_0x169593[_0xd89b('0x26')][_0xd89b('0x39')]){_0x29ea06[_0xd89b('0x3a')]=[{'all':!![]}];}_0x29ea06=_['merge']({},_0x29ea06,_0x169593[_0xd89b('0x3d')]);return db[_0xd89b('0x22')][_0xd89b('0x3e')](_0x29ea06)[_0xd89b('0x1d')](handleEntityNotFound(_0x31e58b,null))['then'](respondWithResult(_0x31e58b,null))[_0xd89b('0x3f')](handleError(_0x31e58b,null));};exports[_0xd89b('0x40')]=function(_0x32c253,_0x3b6ba4){if(_0x32c253[_0xd89b('0x41')]['id']){delete _0x32c253['body']['id'];}return db[_0xd89b('0x22')][_0xd89b('0x3e')]({'where':{'id':_0x32c253[_0xd89b('0x3c')]['id']}})[_0xd89b('0x1d')](handleEntityNotFound(_0x3b6ba4,null))['then'](saveUpdates(_0x32c253['body'],null))[_0xd89b('0x1d')](respondWithResult(_0x3b6ba4,null))[_0xd89b('0x3f')](handleError(_0x3b6ba4,null));};exports['destroy']=function(_0x242897,_0x2c3284){return db[_0xd89b('0x22')][_0xd89b('0x3e')]({'where':{'id':_0x242897[_0xd89b('0x3c')]['id']}})[_0xd89b('0x1d')](handleEntityNotFound(_0x2c3284,null))[_0xd89b('0x1d')](removeEntity(_0x2c3284,null))[_0xd89b('0x3f')](handleError(_0x2c3284,null));};exports[_0xd89b('0x42')]=function(_0x3c0846,_0x726cd7){return db[_0xd89b('0x22')][_0xd89b('0x42')]()[_0xd89b('0x1d')](respondWithResult(_0x726cd7,null))[_0xd89b('0x3f')](handleError(_0x726cd7,null));}; \ No newline at end of file +var _0x96cc=['filter','merge','map','options','includeAll','findAll','rows','catch','show','params','include','find','body','describe','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','CmHopperBlack','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','add'];(function(_0xb27df3,_0x4063cc){var _0x3f3c63=function(_0x2bfde0){while(--_0x2bfde0){_0xb27df3['push'](_0xb27df3['shift']());}};_0x3f3c63(++_0x4063cc);}(_0x96cc,0x16c));var _0xc96c=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x96cc[_0x2d3d0d];return _0xca35b6;};'use strict';var jsonpatch=require(_0xc96c('0x0'));var rp=require('request-promise');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc96c('0x2'));var util=require(_0xc96c('0x3'));var path=require(_0xc96c('0x4'));var sox=require(_0xc96c('0x5'));var csv=require(_0xc96c('0x6'));var ejs=require(_0xc96c('0x7'));var fs=require('fs');var _=require(_0xc96c('0x8'));var squel=require(_0xc96c('0x9'));var crypto=require(_0xc96c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xc96c('0xb'));var toCsv=require(_0xc96c('0x6'));var querystring=require(_0xc96c('0xc'));var Papa=require(_0xc96c('0xd'));var qs=require(_0xc96c('0xe'));var logger=require(_0xc96c('0xf'))(_0xc96c('0x10'));var utils=require('../../config/utils');var config=require(_0xc96c('0x11'));var db=require(_0xc96c('0x12'))['db'];function respondWithStatusCode(_0x19f599,_0x5ceddc){_0x5ceddc=_0x5ceddc||0xcc;return function(_0x95ce8e){if(_0x95ce8e){return _0x19f599['sendStatus'](_0x5ceddc);}return _0x19f599[_0xc96c('0x13')](_0x5ceddc)['end']();};}function respondWithResult(_0x18a1a6,_0x32f682){_0x32f682=_0x32f682||0xc8;return function(_0x3ef47a){if(_0x3ef47a){return _0x18a1a6[_0xc96c('0x13')](_0x32f682)['json'](_0x3ef47a);}};}function respondWithFilteredResult(_0x3fe3d5,_0x43fcaa){return function(_0x1e7742){if(_0x1e7742){var _0x3f65fd=_0x1e7742[_0xc96c('0x14')],_0x48de8d=_0x43fcaa[_0xc96c('0x15')],_0x35da94=_0x43fcaa[_0xc96c('0x15')]+_0x43fcaa[_0xc96c('0x16')],_0xbed0c9;if(_0x35da94>=_0x3f65fd){_0x35da94=_0x3f65fd;_0xbed0c9=0xc8;}else{_0xbed0c9=0xce;}_0x3fe3d5[_0xc96c('0x13')](_0xbed0c9);return _0x3fe3d5[_0xc96c('0x17')](_0xc96c('0x18'),_0x48de8d+'-'+_0x35da94+'/'+_0x3f65fd)[_0xc96c('0x19')](_0x1e7742);}return null;};}function patchUpdates(_0x861230){return function(_0x5f1344){try{jsonpatch['apply'](_0x5f1344,_0x861230,!![]);}catch(_0x406791){return BPromise[_0xc96c('0x1a')](_0x406791);}return _0x5f1344[_0xc96c('0x1b')]();};}function saveUpdates(_0x2ae19a,_0x4aa6a3){return function(_0x2c4c83){if(_0x2c4c83){return _0x2c4c83[_0xc96c('0x1c')](_0x2ae19a)[_0xc96c('0x1d')](function(_0x3c0864){return _0x3c0864;});}return null;};}function removeEntity(_0x184128,_0x335910){return function(_0x43cc22){if(_0x43cc22){return _0x43cc22[_0xc96c('0x1e')]()[_0xc96c('0x1d')](function(){_0x184128[_0xc96c('0x13')](0xcc)[_0xc96c('0x1f')]();});}};}function handleEntityNotFound(_0x1203a1,_0x3f9603){return function(_0x45edee){if(!_0x45edee){_0x1203a1[_0xc96c('0x20')](0x194);}return _0x45edee;};}function handleError(_0x3b5c6c,_0x3e2615){_0x3e2615=_0x3e2615||0x1f4;return function(_0x51dabe){logger[_0xc96c('0x21')](_0x51dabe[_0xc96c('0x22')]);if(_0x51dabe[_0xc96c('0x23')]){delete _0x51dabe[_0xc96c('0x23')];}_0x3b5c6c[_0xc96c('0x13')](_0x3e2615)[_0xc96c('0x24')](_0x51dabe);};}exports[_0xc96c('0x25')]=function(_0x415d33,_0x1a77df){var _0x14f171={},_0x50fc07={},_0x3a23cb={'count':0x0,'rows':[]};var _0x117f17=db[_0xc96c('0x26')][_0xc96c('0x27')];_0x50fc07['model']=_['keys'](_0x117f17);var _0x39c191={'dateStart':_0x415d33[_0xc96c('0x28')][_0xc96c('0x29')],'dateEnd':_0x415d33[_0xc96c('0x28')][_0xc96c('0x2a')]};delete _0x415d33[_0xc96c('0x28')][_0xc96c('0x29')];delete _0x415d33[_0xc96c('0x28')][_0xc96c('0x2a')];_0x50fc07[_0xc96c('0x28')]=_[_0xc96c('0x2b')](_0x415d33[_0xc96c('0x28')]);_0x50fc07[_0xc96c('0x2c')]=_[_0xc96c('0x2d')](_0x50fc07['model'],_0x50fc07[_0xc96c('0x28')]);_0x14f171['attributes']=_[_0xc96c('0x2d')](_0x50fc07[_0xc96c('0x2e')],qs[_0xc96c('0x2f')](_0x415d33['query'][_0xc96c('0x2f')]));_0x14f171[_0xc96c('0x30')]=_0x14f171[_0xc96c('0x30')][_0xc96c('0x31')]?_0x14f171['attributes']:_0x50fc07['model'];if(!_0x415d33[_0xc96c('0x28')][_0xc96c('0x32')](_0xc96c('0x33'))){_0x14f171['limit']=qs[_0xc96c('0x16')](_0x415d33[_0xc96c('0x28')][_0xc96c('0x16')]);_0x14f171[_0xc96c('0x15')]=qs['offset'](_0x415d33[_0xc96c('0x28')][_0xc96c('0x15')]);}_0x14f171['order']=qs[_0xc96c('0x34')](_0x415d33[_0xc96c('0x28')][_0xc96c('0x34')]);_0x14f171[_0xc96c('0x35')]=qs[_0xc96c('0x2c')](_[_0xc96c('0x36')](_0x415d33['query'],_0x50fc07[_0xc96c('0x2c')]));if(_0x39c191[_0xc96c('0x29')]){if(_0x39c191[_0xc96c('0x2a')]){_0x39c191[_0xc96c('0x2a')]=moment(_0x39c191[_0xc96c('0x2a')])[_0xc96c('0x37')](0x1,'day');}else{_0x39c191['dateEnd']=moment(_0x39c191[_0xc96c('0x29')])[_0xc96c('0x37')](0x1,'day');}_['merge'](_0x14f171[_0xc96c('0x35')],{'createdAt':{'$gte':_0x39c191[_0xc96c('0x29')],'$lte':_0x39c191[_0xc96c('0x2a')]}});}if(_0x415d33[_0xc96c('0x28')][_0xc96c('0x38')]){_0x14f171[_0xc96c('0x35')]=_[_0xc96c('0x39')](_0x14f171[_0xc96c('0x35')],{'$or':_[_0xc96c('0x3a')](_0x14f171[_0xc96c('0x30')],function(_0x1b68e6){var _0x5ed343={};_0x5ed343[_0x1b68e6]={'$like':'%'+_0x415d33[_0xc96c('0x28')][_0xc96c('0x38')]+'%'};return _0x5ed343;})});}_0x14f171=_[_0xc96c('0x39')]({},_0x14f171,_0x415d33[_0xc96c('0x3b')]);var _0x4eb180={'where':_0x14f171[_0xc96c('0x35')]};return db[_0xc96c('0x26')][_0xc96c('0x14')](_0x4eb180)['then'](function(_0x510252){_0x3a23cb[_0xc96c('0x14')]=_0x510252;if(_0x415d33[_0xc96c('0x28')][_0xc96c('0x3c')]){_0x14f171['include']=[{'all':!![]}];}return db[_0xc96c('0x26')][_0xc96c('0x3d')](_0x14f171);})[_0xc96c('0x1d')](function(_0x2a8ea7){_0x3a23cb[_0xc96c('0x3e')]=_0x2a8ea7;return _0x3a23cb;})[_0xc96c('0x1d')](respondWithFilteredResult(_0x1a77df,_0x14f171))[_0xc96c('0x3f')](handleError(_0x1a77df,null));};exports[_0xc96c('0x40')]=function(_0x25df41,_0x4d5a1b){var _0x4c3088={'raw':!![],'where':{'id':_0x25df41[_0xc96c('0x41')]['id']}},_0x30b3ac={};_0x30b3ac[_0xc96c('0x2e')]=_[_0xc96c('0x2b')](db['CmHopperBlack']['rawAttributes']);_0x30b3ac[_0xc96c('0x28')]=_[_0xc96c('0x2b')](_0x25df41[_0xc96c('0x28')]);_0x30b3ac[_0xc96c('0x2c')]=_[_0xc96c('0x2d')](_0x30b3ac[_0xc96c('0x2e')],_0x30b3ac[_0xc96c('0x28')]);_0x4c3088['attributes']=_[_0xc96c('0x2d')](_0x30b3ac[_0xc96c('0x2e')],qs[_0xc96c('0x2f')](_0x25df41[_0xc96c('0x28')]['fields']));_0x4c3088['attributes']=_0x4c3088[_0xc96c('0x30')][_0xc96c('0x31')]?_0x4c3088[_0xc96c('0x30')]:_0x30b3ac[_0xc96c('0x2e')];if(_0x25df41[_0xc96c('0x28')][_0xc96c('0x3c')]){_0x4c3088[_0xc96c('0x42')]=[{'all':!![]}];}_0x4c3088=_[_0xc96c('0x39')]({},_0x4c3088,_0x25df41[_0xc96c('0x3b')]);return db[_0xc96c('0x26')][_0xc96c('0x43')](_0x4c3088)[_0xc96c('0x1d')](handleEntityNotFound(_0x4d5a1b,null))[_0xc96c('0x1d')](respondWithResult(_0x4d5a1b,null))['catch'](handleError(_0x4d5a1b,null));};exports[_0xc96c('0x1c')]=function(_0x2e5045,_0x307d58){if(_0x2e5045[_0xc96c('0x44')]['id']){delete _0x2e5045['body']['id'];}return db[_0xc96c('0x26')]['find']({'where':{'id':_0x2e5045[_0xc96c('0x41')]['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x307d58,null))['then'](saveUpdates(_0x2e5045[_0xc96c('0x44')],null))[_0xc96c('0x1d')](respondWithResult(_0x307d58,null))[_0xc96c('0x3f')](handleError(_0x307d58,null));};exports[_0xc96c('0x1e')]=function(_0x1e38e1,_0x1bd694){return db['CmHopperBlack']['find']({'where':{'id':_0x1e38e1['params']['id']}})[_0xc96c('0x1d')](handleEntityNotFound(_0x1bd694,null))['then'](removeEntity(_0x1bd694,null))[_0xc96c('0x3f')](handleError(_0x1bd694,null));};exports[_0xc96c('0x45')]=function(_0x65a0a7,_0x17c764){return db[_0xc96c('0x26')][_0xc96c('0x45')]()[_0xc96c('0x1d')](respondWithResult(_0x17c764,null))[_0xc96c('0x3f')](handleError(_0x17c764,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index c8eeb2d..dbb7dc8 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 _0x9642=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','define'];(function(_0x1633e9,_0x50a939){var _0x549ace=function(_0x15a157){while(--_0x15a157){_0x1633e9['push'](_0x1633e9['shift']());}};_0x549ace(++_0x50a939);}(_0x9642,0x16d));var _0x2964=function(_0x166f23,_0x57a116){_0x166f23=_0x166f23-0x0;var _0xdd7be4=_0x9642[_0x166f23];return _0xdd7be4;};'use strict';var _=require('lodash');var util=require(_0x2964('0x0'));var logger=require(_0x2964('0x1'))(_0x2964('0x2'));var moment=require(_0x2964('0x3'));var BPromise=require(_0x2964('0x4'));var rp=require(_0x2964('0x5'));var attributes=require(_0x2964('0x6'));module[_0x2964('0x7')]=function(_0x2b221c,_0xbea73f){return _0x2b221c[_0x2964('0x8')](_0x2964('0x9'),attributes,{'tableName':_0x2964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd0=['cm_hopper_black','lodash','../../config/logger','api','moment','bluebird','request-promise','./cmHopperBlack.attributes','exports','CmHopperBlack'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4cd0,0x1d7));var _0x04cd=function(_0x76e6db,_0x13e203){_0x76e6db=_0x76e6db-0x0;var _0xdef203=_0x4cd0[_0x76e6db];return _0xdef203;};'use strict';var _=require(_0x04cd('0x0'));var util=require('util');var logger=require(_0x04cd('0x1'))(_0x04cd('0x2'));var moment=require(_0x04cd('0x3'));var BPromise=require(_0x04cd('0x4'));var rp=require(_0x04cd('0x5'));var attributes=require(_0x04cd('0x6'));module[_0x04cd('0x7')]=function(_0x3d94bd,_0x4e98d7){return _0x3d94bd['define'](_0x04cd('0x8'),attributes,{'tableName':_0x04cd('0x9'),'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 420b14d..2f8cf88 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 _0x808b=['UpdateCmHopperBlack','update','DestroyCmHopperBlack','destroy','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CmHopperBlack','options','raw','where','attributes','limit','include','map','model','info','GetCmHopperBlack','debug','stringify'];(function(_0xdf061f,_0x12b457){var _0x1940e7=function(_0x5800c7){while(--_0x5800c7){_0xdf061f['push'](_0xdf061f['shift']());}};_0x1940e7(++_0x12b457);}(_0x808b,0x1d8));var _0xb808=function(_0x434e1c,_0xed0e83){_0x434e1c=_0x434e1c-0x0;var _0x508be2=_0x808b[_0x434e1c];return _0x508be2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb808('0x0'));var BPromise=require(_0xb808('0x1'));var rs=require(_0xb808('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb808('0x3'))(_0xb808('0x4'));var config=require(_0xb808('0x5'));var jayson=require(_0xb808('0x6'));var client=jayson[_0xb808('0x7')][_0xb808('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d165a,_0x456c86,_0xa7e5b7){return new BPromise(function(_0x5117d9,_0x52cc7b){return client[_0xb808('0x9')](_0x5d165a,_0xa7e5b7)[_0xb808('0xa')](function(_0x33241c){logger['info'](_0xb808('0xb'),_0x456c86,_0xb808('0xc'));logger['debug'](_0xb808('0xd'),_0x456c86,'request\x20sent',JSON['stringify'](_0x33241c));if(_0x33241c[_0xb808('0xe')]){if(_0x33241c[_0xb808('0xe')][_0xb808('0xf')]===0x1f4){logger['error'](_0xb808('0xb'),_0x456c86,_0x33241c[_0xb808('0xe')][_0xb808('0x10')]);return _0x52cc7b(_0x33241c[_0xb808('0xe')][_0xb808('0x10')]);}logger[_0xb808('0xe')](_0xb808('0xb'),_0x456c86,_0x33241c[_0xb808('0xe')][_0xb808('0x10')]);return _0x5117d9(_0x33241c[_0xb808('0xe')]['message']);}else{logger['info'](_0xb808('0xb'),_0x456c86,'request\x20sent');_0x5117d9(_0x33241c[_0xb808('0x11')][_0xb808('0x10')]);}})[_0xb808('0x12')](function(_0x5cf23c){logger['error'](_0xb808('0xb'),_0x456c86,_0x5cf23c);_0x52cc7b(_0x5cf23c);});});}exports['GetCmHopperBlack']=function(_0x21ee16){var _0x57e482=this;return new Promise(function(_0x3690ae,_0x84ac1){return db[_0xb808('0x13')]['findAll']({'raw':_0x21ee16[_0xb808('0x14')]?_0x21ee16[_0xb808('0x14')][_0xb808('0x15')]===undefined?!![]:![]:!![],'where':_0x21ee16[_0xb808('0x14')]?_0x21ee16['options'][_0xb808('0x16')]||null:null,'attributes':_0x21ee16[_0xb808('0x14')]?_0x21ee16[_0xb808('0x14')][_0xb808('0x17')]||null:null,'limit':_0x21ee16[_0xb808('0x14')]?_0x21ee16[_0xb808('0x14')][_0xb808('0x18')]||null:null,'include':_0x21ee16['options']?_0x21ee16[_0xb808('0x14')][_0xb808('0x19')]?_[_0xb808('0x1a')](_0x21ee16[_0xb808('0x14')][_0xb808('0x19')],function(_0x336206){return{'model':db[_0x336206[_0xb808('0x1b')]],'as':_0x336206['as'],'attributes':_0x336206[_0xb808('0x17')],'include':_0x336206[_0xb808('0x19')]?_[_0xb808('0x1a')](_0x336206[_0xb808('0x19')],function(_0x37bbd5){return{'model':db[_0x37bbd5[_0xb808('0x1b')]],'as':_0x37bbd5['as'],'attributes':_0x37bbd5[_0xb808('0x17')],'include':_0x37bbd5[_0xb808('0x19')]?_[_0xb808('0x1a')](_0x37bbd5['include'],function(_0x23ad8b){return{'model':db[_0x23ad8b['model']],'as':_0x23ad8b['as'],'attributes':_0x23ad8b[_0xb808('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb808('0xa')](function(_0x5183d5){logger[_0xb808('0x1c')](_0xb808('0x1d'),_0x21ee16);logger[_0xb808('0x1e')]('GetCmHopperBlack',_0x21ee16,JSON[_0xb808('0x1f')](_0x5183d5));_0x3690ae(_0x5183d5);})['catch'](function(_0x32c635){logger[_0xb808('0xe')](_0xb808('0x1d'),_0x32c635[_0xb808('0x10')],_0x21ee16);_0x84ac1(_0x57e482[_0xb808('0xe')](0x1f4,_0x32c635[_0xb808('0x10')]));});});};exports[_0xb808('0x20')]=function(_0x5c0a83){var _0x585849=this;return new Promise(function(_0x366fea,_0x5331f6){return db[_0xb808('0x13')][_0xb808('0x21')](_0x5c0a83['body'],{'raw':_0x5c0a83[_0xb808('0x14')]?_0x5c0a83[_0xb808('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c0a83[_0xb808('0x14')]?_0x5c0a83[_0xb808('0x14')][_0xb808('0x16')]||null:null,'attributes':_0x5c0a83[_0xb808('0x14')]?_0x5c0a83[_0xb808('0x14')]['attributes']||null:null,'limit':_0x5c0a83[_0xb808('0x14')]?_0x5c0a83[_0xb808('0x14')][_0xb808('0x18')]||null:null})[_0xb808('0xa')](function(_0x40a83c){logger['info'](_0xb808('0x20'),_0x5c0a83);logger[_0xb808('0x1e')](_0xb808('0x20'),_0x5c0a83,JSON['stringify'](_0x40a83c));_0x366fea(_0x40a83c);})[_0xb808('0x12')](function(_0x544068){logger[_0xb808('0xe')](_0xb808('0x20'),_0x544068[_0xb808('0x10')],_0x5c0a83);_0x5331f6(_0x585849[_0xb808('0xe')](0x1f4,_0x544068[_0xb808('0x10')]));});});};exports[_0xb808('0x22')]=function(_0x3f0bb7){var _0x2d6f43=this;return new Promise(function(_0x348a16,_0x2f57cf){return db[_0xb808('0x13')][_0xb808('0x23')]({'where':_0x3f0bb7[_0xb808('0x14')]?_0x3f0bb7['options'][_0xb808('0x16')]||null:null})['then'](function(_0xf83358){logger[_0xb808('0x1c')](_0xb808('0x22'),_0x3f0bb7);logger[_0xb808('0x1e')](_0xb808('0x22'),_0x3f0bb7,JSON[_0xb808('0x1f')](_0xf83358));_0x348a16(_0xf83358);})['catch'](function(_0x199278){logger[_0xb808('0xe')](_0xb808('0x22'),_0x199278[_0xb808('0x10')],_0x3f0bb7);_0x2f57cf(_0x2d6f43['error'](0x1f4,_0x199278[_0xb808('0x10')]));});});}; \ No newline at end of file +var _0x5f1f=['map','model','UpdateCmHopperBlack','update','body','debug','DestroyCmHopperBlack','destroy','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperBlack,\x20%s,\x20%s','message','info','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include'];(function(_0x12049f,_0x25f34f){var _0x23667e=function(_0x58f936){while(--_0x58f936){_0x12049f['push'](_0x12049f['shift']());}};_0x23667e(++_0x25f34f);}(_0x5f1f,0x7d));var _0xf5f1=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x5f1f[_0x37e886];return _0x57c5cd;};'use strict';var _=require(_0xf5f1('0x0'));var util=require('util');var moment=require(_0xf5f1('0x1'));var BPromise=require(_0xf5f1('0x2'));var rs=require(_0xf5f1('0x3'));var fs=require('fs');var db=require(_0xf5f1('0x4'))['db'];var utils=require(_0xf5f1('0x5'));var logger=require(_0xf5f1('0x6'))(_0xf5f1('0x7'));var config=require(_0xf5f1('0x8'));var jayson=require(_0xf5f1('0x9'));var client=jayson[_0xf5f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d6d6d,_0x3a30d8,_0x2d5cb4){return new BPromise(function(_0x291102,_0x381870){return client[_0xf5f1('0xb')](_0x4d6d6d,_0x2d5cb4)[_0xf5f1('0xc')](function(_0x9e84f9){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x3a30d8,_0xf5f1('0xd'));logger['debug'](_0xf5f1('0xe'),_0x3a30d8,_0xf5f1('0xd'),JSON[_0xf5f1('0xf')](_0x9e84f9));if(_0x9e84f9[_0xf5f1('0x10')]){if(_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x11')]===0x1f4){logger[_0xf5f1('0x10')](_0xf5f1('0x12'),_0x3a30d8,_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x13')]);return _0x381870(_0x9e84f9[_0xf5f1('0x10')][_0xf5f1('0x13')]);}logger[_0xf5f1('0x10')]('CmHopperBlack,\x20%s,\x20%s',_0x3a30d8,_0x9e84f9[_0xf5f1('0x10')]['message']);return _0x291102(_0x9e84f9['error']['message']);}else{logger[_0xf5f1('0x14')](_0xf5f1('0x12'),_0x3a30d8,_0xf5f1('0xd'));_0x291102(_0x9e84f9['result']['message']);}})[_0xf5f1('0x15')](function(_0x8de6d7){logger['error'](_0xf5f1('0x12'),_0x3a30d8,_0x8de6d7);_0x381870(_0x8de6d7);});});}exports[_0xf5f1('0x16')]=function(_0x28dc59){var _0x2715e8=this;return new Promise(function(_0x3468a0,_0x6afc0c){return db[_0xf5f1('0x17')][_0xf5f1('0x18')]({'raw':_0x28dc59['options']?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1a')]===undefined?!![]:![]:!![],'where':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null,'attributes':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59['options'][_0xf5f1('0x1c')]||null:null,'limit':_0x28dc59[_0xf5f1('0x19')]?_0x28dc59[_0xf5f1('0x19')][_0xf5f1('0x1d')]||null:null,'include':_0x28dc59['options']?_0x28dc59['options'][_0xf5f1('0x1e')]?_[_0xf5f1('0x1f')](_0x28dc59[_0xf5f1('0x19')]['include'],function(_0x5c97ba){return{'model':db[_0x5c97ba['model']],'as':_0x5c97ba['as'],'attributes':_0x5c97ba[_0xf5f1('0x1c')],'include':_0x5c97ba['include']?_['map'](_0x5c97ba[_0xf5f1('0x1e')],function(_0x362642){return{'model':db[_0x362642[_0xf5f1('0x20')]],'as':_0x362642['as'],'attributes':_0x362642['attributes'],'include':_0x362642['include']?_['map'](_0x362642[_0xf5f1('0x1e')],function(_0x112838){return{'model':db[_0x112838[_0xf5f1('0x20')]],'as':_0x112838['as'],'attributes':_0x112838[_0xf5f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xf5f1('0xc')](function(_0x588b91){logger[_0xf5f1('0x14')](_0xf5f1('0x16'),_0x28dc59);logger['debug'](_0xf5f1('0x16'),_0x28dc59,JSON[_0xf5f1('0xf')](_0x588b91));_0x3468a0(_0x588b91);})['catch'](function(_0x35eb5e){logger['error'](_0xf5f1('0x16'),_0x35eb5e[_0xf5f1('0x13')],_0x28dc59);_0x6afc0c(_0x2715e8[_0xf5f1('0x10')](0x1f4,_0x35eb5e[_0xf5f1('0x13')]));});});};exports[_0xf5f1('0x21')]=function(_0x2858e2){var _0x71e252=this;return new Promise(function(_0x46b599,_0x38ccb4){return db['CmHopperBlack'][_0xf5f1('0x22')](_0x2858e2[_0xf5f1('0x23')],{'raw':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null,'attributes':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2[_0xf5f1('0x19')][_0xf5f1('0x1c')]||null:null,'limit':_0x2858e2[_0xf5f1('0x19')]?_0x2858e2['options']['limit']||null:null})[_0xf5f1('0xc')](function(_0x28cfa0){logger[_0xf5f1('0x14')](_0xf5f1('0x21'),_0x2858e2);logger[_0xf5f1('0x24')](_0xf5f1('0x21'),_0x2858e2,JSON[_0xf5f1('0xf')](_0x28cfa0));_0x46b599(_0x28cfa0);})[_0xf5f1('0x15')](function(_0x22475a){logger[_0xf5f1('0x10')](_0xf5f1('0x21'),_0x22475a[_0xf5f1('0x13')],_0x2858e2);_0x38ccb4(_0x71e252[_0xf5f1('0x10')](0x1f4,_0x22475a[_0xf5f1('0x13')]));});});};exports[_0xf5f1('0x25')]=function(_0x597709){var _0x506d82=this;return new Promise(function(_0x36cbee,_0x20a792){return db[_0xf5f1('0x17')][_0xf5f1('0x26')]({'where':_0x597709['options']?_0x597709[_0xf5f1('0x19')][_0xf5f1('0x1b')]||null:null})[_0xf5f1('0xc')](function(_0x166ebc){logger['info']('DestroyCmHopperBlack',_0x597709);logger[_0xf5f1('0x24')](_0xf5f1('0x25'),_0x597709,JSON[_0xf5f1('0xf')](_0x166ebc));_0x36cbee(_0x166ebc);})[_0xf5f1('0x15')](function(_0x3778fb){logger[_0xf5f1('0x10')](_0xf5f1('0x25'),_0x3778fb[_0xf5f1('0x13')],_0x597709);_0x20a792(_0x506d82[_0xf5f1('0x10')](0x1f4,_0x3778fb['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 7682a44..05e8d72 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 _0xc03c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','show','put','/:id','update','delete','destroy','multer','util','path','express','Router'];(function(_0xfc88e5,_0x36cd00){var _0x10b302=function(_0x5192e2){while(--_0x5192e2){_0xfc88e5['push'](_0xfc88e5['shift']());}};_0x10b302(++_0x36cd00);}(_0xc03c,0x9b));var _0xcc03=function(_0x52a7e1,_0x189bf3){_0x52a7e1=_0x52a7e1-0x0;var _0x4f4495=_0xc03c[_0x52a7e1];return _0x4f4495;};'use strict';var multer=require(_0xcc03('0x0'));var util=require(_0xcc03('0x1'));var path=require(_0xcc03('0x2'));var express=require(_0xcc03('0x3'));var router=express[_0xcc03('0x4')]();var auth=require(_0xcc03('0x5'));var interaction=require(_0xcc03('0x6'));var config=require(_0xcc03('0x7'));var controller=require(_0xcc03('0x8'));router[_0xcc03('0x9')]('/',auth[_0xcc03('0xa')](),controller[_0xcc03('0xb')]);router[_0xcc03('0x9')](_0xcc03('0xc'),auth[_0xcc03('0xa')](),controller[_0xcc03('0xd')]);router['get']('/:id',auth[_0xcc03('0xa')](),controller[_0xcc03('0xe')]);router[_0xcc03('0xf')](_0xcc03('0x10'),auth[_0xcc03('0xa')](),controller[_0xcc03('0x11')]);router[_0xcc03('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xcc03('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2269=['show','put','/:id','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','isAuthenticated','describe'];(function(_0x6182ff,_0x59d492){var _0x1cec22=function(_0x2e96f8){while(--_0x2e96f8){_0x6182ff['push'](_0x6182ff['shift']());}};_0x1cec22(++_0x59d492);}(_0x2269,0x101));var _0x9226=function(_0x5d6482,_0x1c9b00){_0x5d6482=_0x5d6482-0x0;var _0x32e681=_0x2269[_0x5d6482];return _0x32e681;};'use strict';var multer=require(_0x9226('0x0'));var util=require(_0x9226('0x1'));var path=require(_0x9226('0x2'));var express=require(_0x9226('0x3'));var router=express[_0x9226('0x4')]();var auth=require(_0x9226('0x5'));var interaction=require(_0x9226('0x6'));var config=require(_0x9226('0x7'));var controller=require(_0x9226('0x8'));router[_0x9226('0x9')]('/',auth['isAuthenticated'](),controller[_0x9226('0xa')]);router['get']('/describe',auth[_0x9226('0xb')](),controller[_0x9226('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9226('0xd')]);router[_0x9226('0xe')]('/:id',auth[_0x9226('0xb')](),controller['update']);router['delete'](_0x9226('0xf'),auth['isAuthenticated'](),controller[_0x9226('0x10')]);module[_0x9226('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 fce5834..b369b46 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 _0x44e7=['INTEGER','DATE','STRING','getDataValue','endtime','followuptime','seconds','setDataValue','dispositionat','BOOLEAN','sequelize','exports'];(function(_0x42228c,_0x2dc0e6){var _0x4616a5=function(_0x17ec27){while(--_0x17ec27){_0x42228c['push'](_0x42228c['shift']());}};_0x4616a5(++_0x2dc0e6);}(_0x44e7,0xbe));var _0x744e=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x44e7[_0x55d8c5];return _0x225ae5;};'use strict';var Sequelize=require(_0x744e('0x0'));var moment=require('moment');module[_0x744e('0x1')]={'state':{'type':Sequelize[_0x744e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x744e('0x3')]},'countbusyretry':{'type':Sequelize[_0x744e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x744e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x744e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x744e('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x744e('0x4')]},'originatecalleridname':{'type':Sequelize[_0x744e('0x4')]},'calleridnum':{'type':Sequelize[_0x744e('0x4')]},'calleridname':{'type':Sequelize[_0x744e('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x744e('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x744e('0x3')]},'endtime':{'type':Sequelize[_0x744e('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x744e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x744e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x744e('0x4')]},'reason':{'type':Sequelize[_0x744e('0x4')]},'disposition':{'type':Sequelize[_0x744e('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x14e3a7){var _0x5134f3=this[_0x744e('0x5')](_0x744e('0x6'));if(_0x5134f3&&_0x14e3a7){this['setDataValue'](_0x744e('0x7'),moment(_0x14e3a7)['diff'](moment(_0x5134f3),_0x744e('0x8')));}return this[_0x744e('0x9')](_0x744e('0xa'),_0x14e3a7);}},'amd':{'type':Sequelize[_0x744e('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x744e('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x744e('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x744e('0x3')]},'recallme':{'type':Sequelize[_0x744e('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x744e('0x3')]}}; \ No newline at end of file +var _0x5426=['setDataValue','followuptime','diff','dispositionat','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0x5426,0xd5));var _0x6542=function(_0x286d27,_0xc83500){_0x286d27=_0x286d27-0x0;var _0x53544e=_0x5426[_0x286d27];return _0x53544e;};'use strict';var Sequelize=require(_0x6542('0x0'));var moment=require(_0x6542('0x1'));module[_0x6542('0x2')]={'state':{'type':Sequelize[_0x6542('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x6542('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6542('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x6542('0x4')]},'originatecalleridname':{'type':Sequelize[_0x6542('0x4')]},'calleridnum':{'type':Sequelize[_0x6542('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x6542('0x5')]},'responsetime':{'type':Sequelize[_0x6542('0x5')]},'answertime':{'type':Sequelize[_0x6542('0x5')]},'droptime':{'type':Sequelize[_0x6542('0x5')]},'endtime':{'type':Sequelize[_0x6542('0x5')]},'ringtime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6542('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6542('0x4')]},'campaign':{'type':Sequelize[_0x6542('0x4')]},'campaigntype':{'type':Sequelize[_0x6542('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6542('0x4')]},'disposition':{'type':Sequelize[_0x6542('0x4')]},'dispositionat':{'type':Sequelize[_0x6542('0x5')],'set':function(_0x341bf1){var _0x35f89a=this[_0x6542('0x6')](_0x6542('0x7'));if(_0x35f89a&&_0x341bf1){this[_0x6542('0x8')](_0x6542('0x9'),moment(_0x341bf1)[_0x6542('0xa')](moment(_0x35f89a),'seconds'));}return this[_0x6542('0x8')](_0x6542('0xb'),_0x341bf1);}},'amd':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6542('0x5')]},'callback':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6542('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6542('0x5')]},'recallme':{'type':Sequelize[_0x6542('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6542('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 00874f8..8112521 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 _0xc7b0=['json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','CmHopperFinal','dateStart','dateEnd','query','filters','intersection','model','attributes','fields','length','limit','order','sort','pick','add','merge','filter','where','includeAll','include','catch','show','keys','rawAttributes','find','describe','body','uniqueid','params','countContactsQueueCampaignHopperFinal','findAll','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','COUNT','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','countContactsIvrCampaignHopperFinal','busyContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','group','ContactId','moveContactsIvrCampaignHopperFinal','Campaign','cm_hopper','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x54de83,_0x4c8606){var _0x42cc12=function(_0x291cae){while(--_0x291cae){_0x54de83['push'](_0x54de83['shift']());}};_0x42cc12(++_0x4c8606);}(_0xc7b0,0xda));var _0x0c7b=function(_0x3a57b4,_0x141b37){_0x3a57b4=_0x3a57b4-0x0;var _0x12cfed=_0xc7b0[_0x3a57b4];return _0x12cfed;};'use strict';var jsonpatch=require(_0x0c7b('0x0'));var rp=require(_0x0c7b('0x1'));var moment=require(_0x0c7b('0x2'));var BPromise=require(_0x0c7b('0x3'));var Mustache=require(_0x0c7b('0x4'));var util=require(_0x0c7b('0x5'));var path=require(_0x0c7b('0x6'));var sox=require(_0x0c7b('0x7'));var csv=require(_0x0c7b('0x8'));var ejs=require(_0x0c7b('0x9'));var fs=require('fs');var _=require(_0x0c7b('0xa'));var squel=require(_0x0c7b('0xb'));var crypto=require(_0x0c7b('0xc'));var jsforce=require(_0x0c7b('0xd'));var deskjs=require(_0x0c7b('0xe'));var toCsv=require(_0x0c7b('0x8'));var querystring=require(_0x0c7b('0xf'));var Papa=require(_0x0c7b('0x10'));var qs=require(_0x0c7b('0x11'));var logger=require('../../config/logger')(_0x0c7b('0x12'));var utils=require(_0x0c7b('0x13'));var config=require(_0x0c7b('0x14'));var db=require(_0x0c7b('0x15'))['db'];function respondWithStatusCode(_0x2880d7,_0x4c0a18){_0x4c0a18=_0x4c0a18||0xcc;return function(_0x4c1a7e){if(_0x4c1a7e){return _0x2880d7[_0x0c7b('0x16')](_0x4c0a18);}return _0x2880d7[_0x0c7b('0x17')](_0x4c0a18)['end']();};}function respondWithResult(_0x594bda,_0x2f9f33){_0x2f9f33=_0x2f9f33||0xc8;return function(_0x2049d5){if(_0x2049d5){return _0x594bda[_0x0c7b('0x17')](_0x2f9f33)[_0x0c7b('0x18')](_0x2049d5);}};}function respondWithFilteredResult(_0x59c1d6,_0x1b6d0c){return function(_0x3865a9){if(_0x3865a9){var _0x46f475=_0x3865a9[_0x0c7b('0x19')],_0x3d2879=_0x1b6d0c[_0x0c7b('0x1a')],_0xda44d5=_0x1b6d0c[_0x0c7b('0x1a')]+_0x1b6d0c['limit'],_0x3ca1ef;if(_0xda44d5>=_0x46f475){_0xda44d5=_0x46f475;_0x3ca1ef=0xc8;}else{_0x3ca1ef=0xce;}_0x59c1d6[_0x0c7b('0x17')](_0x3ca1ef);return _0x59c1d6[_0x0c7b('0x1b')](_0x0c7b('0x1c'),_0x3d2879+'-'+_0xda44d5+'/'+_0x46f475)[_0x0c7b('0x18')](_0x3865a9);}return null;};}function patchUpdates(_0x5acb68){return function(_0x3af83f){try{jsonpatch[_0x0c7b('0x1d')](_0x3af83f,_0x5acb68,!![]);}catch(_0x5da3ef){return BPromise[_0x0c7b('0x1e')](_0x5da3ef);}return _0x3af83f['save']();};}function saveUpdates(_0x415559,_0xfa4b52){return function(_0x514c10){if(_0x514c10){return _0x514c10[_0x0c7b('0x1f')](_0x415559)[_0x0c7b('0x20')](function(_0x2981e6){return _0x2981e6;});}return null;};}function removeEntity(_0x1bf48f,_0x15a8cd){return function(_0x45483a){if(_0x45483a){return _0x45483a[_0x0c7b('0x21')]()[_0x0c7b('0x20')](function(){_0x1bf48f[_0x0c7b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f1836,_0x513f51){return function(_0x1cf752){if(!_0x1cf752){_0x2f1836[_0x0c7b('0x16')](0x194);}return _0x1cf752;};}function handleError(_0x4ac602,_0x15b84b){_0x15b84b=_0x15b84b||0x1f4;return function(_0x4569e3){logger[_0x0c7b('0x22')](_0x4569e3['stack']);if(_0x4569e3[_0x0c7b('0x23')]){delete _0x4569e3['name'];}_0x4ac602[_0x0c7b('0x17')](_0x15b84b)[_0x0c7b('0x24')](_0x4569e3);};}exports['index']=function(_0x3f8d5b,_0xad133a){var _0x298177={},_0x3b026f={},_0x338ed9={'count':0x0,'rows':[]};var _0x4a8ff1=db[_0x0c7b('0x25')]['rawAttributes'];_0x3b026f['model']=_['keys'](_0x4a8ff1);var _0x97796f={'dateStart':_0x3f8d5b['query'][_0x0c7b('0x26')],'dateEnd':_0x3f8d5b['query'][_0x0c7b('0x27')]};delete _0x3f8d5b['query'][_0x0c7b('0x26')];delete _0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x27')];_0x3b026f[_0x0c7b('0x28')]=_['keys'](_0x3f8d5b[_0x0c7b('0x28')]);_0x3b026f[_0x0c7b('0x29')]=_[_0x0c7b('0x2a')](_0x3b026f[_0x0c7b('0x2b')],_0x3b026f[_0x0c7b('0x28')]);_0x298177[_0x0c7b('0x2c')]=_[_0x0c7b('0x2a')](_0x3b026f[_0x0c7b('0x2b')],qs[_0x0c7b('0x2d')](_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x2d')]));_0x298177[_0x0c7b('0x2c')]=_0x298177[_0x0c7b('0x2c')][_0x0c7b('0x2e')]?_0x298177[_0x0c7b('0x2c')]:_0x3b026f[_0x0c7b('0x2b')];if(!_0x3f8d5b[_0x0c7b('0x28')]['hasOwnProperty']('nolimit')){_0x298177[_0x0c7b('0x2f')]=qs[_0x0c7b('0x2f')](_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x2f')]);_0x298177['offset']=qs[_0x0c7b('0x1a')](_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x1a')]);}_0x298177[_0x0c7b('0x30')]=qs[_0x0c7b('0x31')](_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x31')]);_0x298177['where']=qs[_0x0c7b('0x29')](_[_0x0c7b('0x32')](_0x3f8d5b['query'],_0x3b026f[_0x0c7b('0x29')]));if(_0x97796f[_0x0c7b('0x26')]){if(_0x97796f[_0x0c7b('0x27')]){_0x97796f[_0x0c7b('0x27')]=moment(_0x97796f[_0x0c7b('0x27')])[_0x0c7b('0x33')](0x1,'day');}else{_0x97796f['dateEnd']=moment(_0x97796f[_0x0c7b('0x26')])[_0x0c7b('0x33')](0x1,'day');}_[_0x0c7b('0x34')](_0x298177['where'],{'createdAt':{'$gte':_0x97796f['dateStart'],'$lte':_0x97796f[_0x0c7b('0x27')]}});}if(_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x35')]){_0x298177[_0x0c7b('0x36')]=_[_0x0c7b('0x34')](_0x298177[_0x0c7b('0x36')],{'$or':_['map'](_0x298177[_0x0c7b('0x2c')],function(_0x2bffb0){var _0x4f257d={};_0x4f257d[_0x2bffb0]={'$like':'%'+_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x35')]+'%'};return _0x4f257d;})});}_0x298177=_[_0x0c7b('0x34')]({},_0x298177,_0x3f8d5b['options']);var _0x522e4e={'where':_0x298177['where']};return db[_0x0c7b('0x25')][_0x0c7b('0x19')](_0x522e4e)[_0x0c7b('0x20')](function(_0x35285f){_0x338ed9['count']=_0x35285f;if(_0x3f8d5b[_0x0c7b('0x28')][_0x0c7b('0x37')]){_0x298177[_0x0c7b('0x38')]=[{'all':!![]}];}return db[_0x0c7b('0x25')]['findAll'](_0x298177);})['then'](function(_0x28ddf7){_0x338ed9['rows']=_0x28ddf7;return _0x338ed9;})[_0x0c7b('0x20')](respondWithFilteredResult(_0xad133a,_0x298177))[_0x0c7b('0x39')](handleError(_0xad133a,null));};exports[_0x0c7b('0x3a')]=function(_0xe831ee,_0xd34b06){var _0x440179={'raw':!![],'where':{'id':_0xe831ee['params']['id']}},_0x2f2e70={};_0x2f2e70[_0x0c7b('0x2b')]=_[_0x0c7b('0x3b')](db[_0x0c7b('0x25')][_0x0c7b('0x3c')]);_0x2f2e70[_0x0c7b('0x28')]=_[_0x0c7b('0x3b')](_0xe831ee[_0x0c7b('0x28')]);_0x2f2e70['filters']=_[_0x0c7b('0x2a')](_0x2f2e70[_0x0c7b('0x2b')],_0x2f2e70['query']);_0x440179[_0x0c7b('0x2c')]=_[_0x0c7b('0x2a')](_0x2f2e70['model'],qs[_0x0c7b('0x2d')](_0xe831ee[_0x0c7b('0x28')][_0x0c7b('0x2d')]));_0x440179[_0x0c7b('0x2c')]=_0x440179[_0x0c7b('0x2c')][_0x0c7b('0x2e')]?_0x440179[_0x0c7b('0x2c')]:_0x2f2e70[_0x0c7b('0x2b')];if(_0xe831ee[_0x0c7b('0x28')]['includeAll']){_0x440179[_0x0c7b('0x38')]=[{'all':!![]}];}_0x440179=_['merge']({},_0x440179,_0xe831ee['options']);return db['CmHopperFinal'][_0x0c7b('0x3d')](_0x440179)[_0x0c7b('0x20')](handleEntityNotFound(_0xd34b06,null))[_0x0c7b('0x20')](respondWithResult(_0xd34b06,null))['catch'](handleError(_0xd34b06,null));};exports[_0x0c7b('0x3e')]=function(_0x4f8b4a,_0x17be62){return db[_0x0c7b('0x25')][_0x0c7b('0x3e')]()[_0x0c7b('0x20')](respondWithResult(_0x17be62,null))[_0x0c7b('0x39')](handleError(_0x17be62,null));};exports['update']=function(_0x453872,_0x13d0a9){if(_0x453872[_0x0c7b('0x3f')][_0x0c7b('0x40')]){delete _0x453872[_0x0c7b('0x3f')][_0x0c7b('0x40')];}return db[_0x0c7b('0x25')][_0x0c7b('0x3d')]({'where':{'uniqueid':_0x453872[_0x0c7b('0x41')]['id']}})['then'](handleEntityNotFound(_0x13d0a9,null))[_0x0c7b('0x20')](saveUpdates(_0x453872[_0x0c7b('0x3f')],null))['then'](respondWithResult(_0x13d0a9,null))[_0x0c7b('0x39')](handleError(_0x13d0a9,null));};exports[_0x0c7b('0x42')]=function(_0x3ffb86,_0xcf030d,_0x5e5b6c){return db[_0x0c7b('0x25')][_0x0c7b('0x43')]({'raw':![],'where':{'VoiceQueueId':_0x3ffb86['params']['id']},'attributes':[[db[_0x0c7b('0x44')]['fn']('COUNT',db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')]['literal'](_0x0c7b('0x45')))),_0x0c7b('0x46')],[db['sequelize']['fn']('COUNT',db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')][_0x0c7b('0x47')](_0x0c7b('0x48')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x0c7b('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x4a')))),'busyContacts'],[db['sequelize']['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')]['literal'](_0x0c7b('0x4b')))),_0x0c7b('0x4c')],[db['sequelize']['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x4d')))),_0x0c7b('0x4e')],[db[_0x0c7b('0x44')]['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x4f')))),_0x0c7b('0x50')],[db[_0x0c7b('0x44')]['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x51')))),_0x0c7b('0x52')]]})[_0x0c7b('0x20')](handleEntityNotFound(_0xcf030d,null))[_0x0c7b('0x20')](respondWithResult(_0xcf030d,null))[_0x0c7b('0x39')](handleError(_0xcf030d,null));};exports[_0x0c7b('0x53')]=function(_0x1697f0,_0x17fd31,_0x318600){return db[_0x0c7b('0x25')][_0x0c7b('0x43')]({'raw':![],'where':{'CampaignId':_0x1697f0[_0x0c7b('0x41')]['id']},'attributes':[[db[_0x0c7b('0x44')]['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')]['literal'](_0x0c7b('0x45')))),'noSuchContacts'],[db['sequelize']['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x48')))),'noAnswerContacts'],[db[_0x0c7b('0x44')]['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db['sequelize'][_0x0c7b('0x47')](_0x0c7b('0x4a')))),_0x0c7b('0x54')],[db['sequelize']['fn'](_0x0c7b('0x49'),db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')][_0x0c7b('0x47')](_0x0c7b('0x4b')))),'congestionContacts'],[db[_0x0c7b('0x44')]['fn'](_0x0c7b('0x49'),db['sequelize']['fn']('IF',db[_0x0c7b('0x44')]['literal'](_0x0c7b('0x4d')))),_0x0c7b('0x4e')],[db['sequelize']['fn'](_0x0c7b('0x49'),db['sequelize']['fn']('IF',db[_0x0c7b('0x44')][_0x0c7b('0x47')](_0x0c7b('0x4f')))),_0x0c7b('0x50')],[db[_0x0c7b('0x44')]['fn']('COUNT',db[_0x0c7b('0x44')]['fn']('IF',db[_0x0c7b('0x44')][_0x0c7b('0x47')](_0x0c7b('0x51')))),_0x0c7b('0x52')]]})[_0x0c7b('0x20')](handleEntityNotFound(_0x17fd31,null))[_0x0c7b('0x20')](respondWithResult(_0x17fd31,null))['catch'](handleError(_0x17fd31,null));};exports[_0x0c7b('0x55')]=function(_0x518b4b,_0x42e907,_0x1d8acb){return db[_0x0c7b('0x56')]['find']({'where':{'id':_0x518b4b['params']['id']}})[_0x0c7b('0x20')](handleEntityNotFound(_0x42e907,null))[_0x0c7b('0x20')](function(_0x10891a){var _0x39f33c;if(_0x10891a){_0x39f33c=squel[_0x0c7b('0x57')]()[_0x0c7b('0x58')]('cm_hopper')[_0x0c7b('0x59')]([_0x0c7b('0x5a'),_0x0c7b('0x5b'),'ContactId',_0x0c7b('0x5c'),_0x0c7b('0x5d'),_0x0c7b('0x5e'),_0x0c7b('0x5f')],squel[_0x0c7b('0x60')]()[_0x0c7b('0x61')]('ANY_VALUE(calleridnum)',_0x0c7b('0x5a'))[_0x0c7b('0x61')]('NOW()',_0x0c7b('0x5b'))['field'](_0x0c7b('0x62'),'ContactId')[_0x0c7b('0x61')](_0x0c7b('0x63'),_0x0c7b('0x5c'))[_0x0c7b('0x61')](_0x0c7b('0x64'),_0x0c7b('0x5d'))[_0x0c7b('0x61')](_0x0c7b('0x65'),_0x0c7b('0x5e'))[_0x0c7b('0x61')]('NOW()',_0x0c7b('0x5f'))[_0x0c7b('0x66')](_0x0c7b('0x67'))[_0x0c7b('0x36')]('VoiceQueueId\x20=\x20?',_0x518b4b[_0x0c7b('0x41')]['id'][_0x0c7b('0x68')]())[_0x0c7b('0x36')]('state\x20=\x20?',_0x518b4b['body'][_0x0c7b('0x69')][_0x0c7b('0x68')]())[_0x0c7b('0x36')](_0x0c7b('0x6a'))[_0x0c7b('0x36')](_0x0c7b('0x6b'),squel['select']()['field'](_0x0c7b('0x5a'))[_0x0c7b('0x66')]('cm_hopper')[_0x0c7b('0x36')](_0x0c7b('0x6c'),_0x518b4b[_0x0c7b('0x41')]['id'][_0x0c7b('0x68')]()))[_0x0c7b('0x36')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x0c7b('0x61')](_0x0c7b('0x6d'))['from']('cm_hopper_final')[_0x0c7b('0x36')](_0x0c7b('0x6c'),_0x518b4b[_0x0c7b('0x41')]['id'][_0x0c7b('0x68')]())[_0x0c7b('0x36')](_0x0c7b('0x6e')))[_0x0c7b('0x6f')](_0x0c7b('0x70')))['toString']();return db[_0x0c7b('0x44')]['query'](_0x39f33c);}return[];})[_0x0c7b('0x20')](respondWithResult(_0x42e907,null))['catch'](handleError(_0x42e907,null));};exports[_0x0c7b('0x71')]=function(_0x13c6a1,_0xdbe446,_0x284071){return db[_0x0c7b('0x72')][_0x0c7b('0x3d')]({'where':{'id':_0x13c6a1['params']['id']}})[_0x0c7b('0x20')](handleEntityNotFound(_0xdbe446,null))[_0x0c7b('0x20')](function(_0x4b9496){var _0x4b18ce;if(_0x4b9496){_0x4b18ce=squel[_0x0c7b('0x57')]()[_0x0c7b('0x58')](_0x0c7b('0x73'))[_0x0c7b('0x59')]([_0x0c7b('0x5a'),_0x0c7b('0x5b'),_0x0c7b('0x70'),_0x0c7b('0x5c'),_0x0c7b('0x74'),_0x0c7b('0x5e'),_0x0c7b('0x5f')],squel['select']()[_0x0c7b('0x61')](_0x0c7b('0x75'),_0x0c7b('0x5a'))[_0x0c7b('0x61')](_0x0c7b('0x65'),'scheduledAt')[_0x0c7b('0x61')]('ANY_VALUE(ContactId)',_0x0c7b('0x70'))[_0x0c7b('0x61')]('ANY_VALUE(ListId)',_0x0c7b('0x5c'))[_0x0c7b('0x61')](_0x0c7b('0x76'),'CampaignId')['field'](_0x0c7b('0x65'),'createdAt')[_0x0c7b('0x61')](_0x0c7b('0x65'),_0x0c7b('0x5f'))['from']('cm_hopper_final')[_0x0c7b('0x36')](_0x0c7b('0x77'),_0x13c6a1[_0x0c7b('0x41')]['id'][_0x0c7b('0x68')]())[_0x0c7b('0x36')](_0x0c7b('0x78'),_0x13c6a1[_0x0c7b('0x3f')][_0x0c7b('0x69')]['toString']())[_0x0c7b('0x36')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x0c7b('0x6b'),squel['select']()[_0x0c7b('0x61')]('phone')[_0x0c7b('0x66')]('cm_hopper')[_0x0c7b('0x36')]('CampaignId\x20=\x20?',_0x13c6a1[_0x0c7b('0x41')]['id']['toString']()))[_0x0c7b('0x36')](_0x0c7b('0x6b'),squel[_0x0c7b('0x60')]()[_0x0c7b('0x61')](_0x0c7b('0x6d'))['from'](_0x0c7b('0x67'))[_0x0c7b('0x36')](_0x0c7b('0x77'),_0x13c6a1[_0x0c7b('0x41')]['id'][_0x0c7b('0x68')]())[_0x0c7b('0x36')](_0x0c7b('0x6e')))[_0x0c7b('0x6f')]('ContactId'))[_0x0c7b('0x68')]();return db['sequelize']['query'](_0x4b18ce);}return[];})[_0x0c7b('0x20')](respondWithResult(_0xdbe446,null))[_0x0c7b('0x39')](handleError(_0xdbe446,null));};exports['checkContactHopper']=function(_0x16cf6e,_0x5d601f,_0x2c330d){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x16cf6e[_0x0c7b('0x3f')][_0x0c7b('0x5d')],'CampaignId':_0x16cf6e[_0x0c7b('0x3f')][_0x0c7b('0x74')],'ContactId':_0x16cf6e[_0x0c7b('0x3f')][_0x0c7b('0x70')]}})[_0x0c7b('0x20')](handleEntityNotFound(_0x5d601f,null))[_0x0c7b('0x20')](function(_0x55a7da){if(_0x55a7da){return _0x55a7da;}return null;})[_0x0c7b('0x20')](respondWithResult(_0x5d601f,null))['catch'](handleError(_0x5d601f,null));}; \ No newline at end of file +var _0x8a1f=['jsforce','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','status','end','json','offset','limit','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','send','index','CmHopperFinal','rawAttributes','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','find','body','uniqueid','params','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','NOW()','field','ListId','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','group','checkContactHopper','CmHopper','findOne','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x4b71ae,_0x3333ad){var _0x1efc6b=function(_0x136e6b){while(--_0x136e6b){_0x4b71ae['push'](_0x4b71ae['shift']());}};_0x1efc6b(++_0x3333ad);}(_0x8a1f,0x70));var _0xf8a1=function(_0x1c66f1,_0x53c85c){_0x1c66f1=_0x1c66f1-0x0;var _0x682d89=_0x8a1f[_0x1c66f1];return _0x682d89;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf8a1('0x0'));var BPromise=require(_0xf8a1('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf8a1('0x2'));var sox=require(_0xf8a1('0x3'));var csv=require(_0xf8a1('0x4'));var ejs=require(_0xf8a1('0x5'));var fs=require('fs');var _=require(_0xf8a1('0x6'));var squel=require(_0xf8a1('0x7'));var crypto=require(_0xf8a1('0x8'));var jsforce=require(_0xf8a1('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf8a1('0x4'));var querystring=require('querystring');var Papa=require(_0xf8a1('0xa'));var qs=require(_0xf8a1('0xb'));var logger=require(_0xf8a1('0xc'))('api');var utils=require(_0xf8a1('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1630ce,_0xdf9e1f){_0xdf9e1f=_0xdf9e1f||0xcc;return function(_0x12df15){if(_0x12df15){return _0x1630ce['sendStatus'](_0xdf9e1f);}return _0x1630ce[_0xf8a1('0xe')](_0xdf9e1f)[_0xf8a1('0xf')]();};}function respondWithResult(_0xecc8d1,_0x44a4cc){_0x44a4cc=_0x44a4cc||0xc8;return function(_0xb52655){if(_0xb52655){return _0xecc8d1[_0xf8a1('0xe')](_0x44a4cc)[_0xf8a1('0x10')](_0xb52655);}};}function respondWithFilteredResult(_0x2cd271,_0x3882d6){return function(_0x176212){if(_0x176212){var _0x2c8b96=_0x176212['count'],_0x30990e=_0x3882d6[_0xf8a1('0x11')],_0x5a79e7=_0x3882d6[_0xf8a1('0x11')]+_0x3882d6[_0xf8a1('0x12')],_0x511f45;if(_0x5a79e7>=_0x2c8b96){_0x5a79e7=_0x2c8b96;_0x511f45=0xc8;}else{_0x511f45=0xce;}_0x2cd271[_0xf8a1('0xe')](_0x511f45);return _0x2cd271['set'](_0xf8a1('0x13'),_0x30990e+'-'+_0x5a79e7+'/'+_0x2c8b96)['json'](_0x176212);}return null;};}function patchUpdates(_0x5efdf3){return function(_0x32437e){try{jsonpatch['apply'](_0x32437e,_0x5efdf3,!![]);}catch(_0xfbeae9){return BPromise[_0xf8a1('0x14')](_0xfbeae9);}return _0x32437e['save']();};}function saveUpdates(_0x5ea1cc,_0x589720){return function(_0x317dda){if(_0x317dda){return _0x317dda[_0xf8a1('0x15')](_0x5ea1cc)[_0xf8a1('0x16')](function(_0x454d00){return _0x454d00;});}return null;};}function removeEntity(_0x38ddcc,_0x40cbcf){return function(_0x510828){if(_0x510828){return _0x510828[_0xf8a1('0x17')]()[_0xf8a1('0x16')](function(){_0x38ddcc[_0xf8a1('0xe')](0xcc)[_0xf8a1('0xf')]();});}};}function handleEntityNotFound(_0x47a9ce,_0x19e086){return function(_0x4e455f){if(!_0x4e455f){_0x47a9ce[_0xf8a1('0x18')](0x194);}return _0x4e455f;};}function handleError(_0x59e81b,_0x49b96f){_0x49b96f=_0x49b96f||0x1f4;return function(_0x27d36e){logger[_0xf8a1('0x19')](_0x27d36e[_0xf8a1('0x1a')]);if(_0x27d36e[_0xf8a1('0x1b')]){delete _0x27d36e['name'];}_0x59e81b['status'](_0x49b96f)[_0xf8a1('0x1c')](_0x27d36e);};}exports[_0xf8a1('0x1d')]=function(_0x31ec18,_0x2e84e2){var _0x51cbeb={},_0x363c19={},_0x5485ee={'count':0x0,'rows':[]};var _0xe24bf2=db[_0xf8a1('0x1e')][_0xf8a1('0x1f')];_0x363c19['model']=_[_0xf8a1('0x20')](_0xe24bf2);var _0xe8ec56={'dateStart':_0x31ec18['query'][_0xf8a1('0x21')],'dateEnd':_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x23')]};delete _0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x21')];delete _0x31ec18[_0xf8a1('0x22')]['dateEnd'];_0x363c19['query']=_[_0xf8a1('0x20')](_0x31ec18[_0xf8a1('0x22')]);_0x363c19['filters']=_[_0xf8a1('0x24')](_0x363c19[_0xf8a1('0x25')],_0x363c19['query']);_0x51cbeb[_0xf8a1('0x26')]=_['intersection'](_0x363c19[_0xf8a1('0x25')],qs[_0xf8a1('0x27')](_0x31ec18['query']['fields']));_0x51cbeb[_0xf8a1('0x26')]=_0x51cbeb[_0xf8a1('0x26')][_0xf8a1('0x28')]?_0x51cbeb[_0xf8a1('0x26')]:_0x363c19[_0xf8a1('0x25')];if(!_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x29')](_0xf8a1('0x2a'))){_0x51cbeb[_0xf8a1('0x12')]=qs[_0xf8a1('0x12')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x12')]);_0x51cbeb[_0xf8a1('0x11')]=qs[_0xf8a1('0x11')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x11')]);}_0x51cbeb[_0xf8a1('0x2b')]=qs[_0xf8a1('0x2c')](_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x2c')]);_0x51cbeb[_0xf8a1('0x2d')]=qs[_0xf8a1('0x2e')](_[_0xf8a1('0x2f')](_0x31ec18[_0xf8a1('0x22')],_0x363c19[_0xf8a1('0x2e')]));if(_0xe8ec56['dateStart']){if(_0xe8ec56[_0xf8a1('0x23')]){_0xe8ec56[_0xf8a1('0x23')]=moment(_0xe8ec56[_0xf8a1('0x23')])[_0xf8a1('0x30')](0x1,'day');}else{_0xe8ec56[_0xf8a1('0x23')]=moment(_0xe8ec56[_0xf8a1('0x21')])['add'](0x1,_0xf8a1('0x31'));}_[_0xf8a1('0x32')](_0x51cbeb['where'],{'createdAt':{'$gte':_0xe8ec56['dateStart'],'$lte':_0xe8ec56[_0xf8a1('0x23')]}});}if(_0x31ec18[_0xf8a1('0x22')][_0xf8a1('0x33')]){_0x51cbeb[_0xf8a1('0x2d')]=_['merge'](_0x51cbeb[_0xf8a1('0x2d')],{'$or':_[_0xf8a1('0x34')](_0x51cbeb[_0xf8a1('0x26')],function(_0x293fe6){var _0x398942={};_0x398942[_0x293fe6]={'$like':'%'+_0x31ec18[_0xf8a1('0x22')]['filter']+'%'};return _0x398942;})});}_0x51cbeb=_[_0xf8a1('0x32')]({},_0x51cbeb,_0x31ec18[_0xf8a1('0x35')]);var _0x4a353c={'where':_0x51cbeb['where']};return db[_0xf8a1('0x1e')]['count'](_0x4a353c)[_0xf8a1('0x16')](function(_0x2ce94b){_0x5485ee[_0xf8a1('0x36')]=_0x2ce94b;if(_0x31ec18['query'][_0xf8a1('0x37')]){_0x51cbeb[_0xf8a1('0x38')]=[{'all':!![]}];}return db[_0xf8a1('0x1e')][_0xf8a1('0x39')](_0x51cbeb);})[_0xf8a1('0x16')](function(_0x4f8a4e){_0x5485ee[_0xf8a1('0x3a')]=_0x4f8a4e;return _0x5485ee;})[_0xf8a1('0x16')](respondWithFilteredResult(_0x2e84e2,_0x51cbeb))[_0xf8a1('0x3b')](handleError(_0x2e84e2,null));};exports[_0xf8a1('0x3c')]=function(_0x3d3135,_0x19888e){var _0x1495d9={'raw':!![],'where':{'id':_0x3d3135['params']['id']}},_0x369786={};_0x369786[_0xf8a1('0x25')]=_[_0xf8a1('0x20')](db[_0xf8a1('0x1e')][_0xf8a1('0x1f')]);_0x369786[_0xf8a1('0x22')]=_[_0xf8a1('0x20')](_0x3d3135[_0xf8a1('0x22')]);_0x369786[_0xf8a1('0x2e')]=_[_0xf8a1('0x24')](_0x369786['model'],_0x369786[_0xf8a1('0x22')]);_0x1495d9[_0xf8a1('0x26')]=_[_0xf8a1('0x24')](_0x369786[_0xf8a1('0x25')],qs[_0xf8a1('0x27')](_0x3d3135[_0xf8a1('0x22')][_0xf8a1('0x27')]));_0x1495d9[_0xf8a1('0x26')]=_0x1495d9['attributes']['length']?_0x1495d9['attributes']:_0x369786[_0xf8a1('0x25')];if(_0x3d3135[_0xf8a1('0x22')][_0xf8a1('0x37')]){_0x1495d9[_0xf8a1('0x38')]=[{'all':!![]}];}_0x1495d9=_['merge']({},_0x1495d9,_0x3d3135[_0xf8a1('0x35')]);return db[_0xf8a1('0x1e')][_0xf8a1('0x3d')](_0x1495d9)[_0xf8a1('0x16')](handleEntityNotFound(_0x19888e,null))[_0xf8a1('0x16')](respondWithResult(_0x19888e,null))[_0xf8a1('0x3b')](handleError(_0x19888e,null));};exports['describe']=function(_0x1545e7,_0x42709c){return db[_0xf8a1('0x1e')]['describe']()[_0xf8a1('0x16')](respondWithResult(_0x42709c,null))['catch'](handleError(_0x42709c,null));};exports[_0xf8a1('0x15')]=function(_0xd63de0,_0x1950f1){if(_0xd63de0[_0xf8a1('0x3e')]['uniqueid']){delete _0xd63de0[_0xf8a1('0x3e')][_0xf8a1('0x3f')];}return db[_0xf8a1('0x1e')][_0xf8a1('0x3d')]({'where':{'uniqueid':_0xd63de0[_0xf8a1('0x40')]['id']}})[_0xf8a1('0x16')](handleEntityNotFound(_0x1950f1,null))[_0xf8a1('0x16')](saveUpdates(_0xd63de0[_0xf8a1('0x3e')],null))[_0xf8a1('0x16')](respondWithResult(_0x1950f1,null))[_0xf8a1('0x3b')](handleError(_0x1950f1,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x3b9df,_0x54c7cd,_0x157dd7){return db[_0xf8a1('0x1e')][_0xf8a1('0x39')]({'raw':![],'where':{'VoiceQueueId':_0x3b9df[_0xf8a1('0x40')]['id']},'attributes':[[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x44')))),_0xf8a1('0x45')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')]('`state`\x20=\x205,\x201,\x20null'))),_0xf8a1('0x46')],[db[_0xf8a1('0x41')]['fn']('COUNT',db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')]['literal'](_0xf8a1('0x47')))),_0xf8a1('0x48')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')](_0xf8a1('0x49')))),_0xf8a1('0x4a')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4b')))),_0xf8a1('0x4c')],[db['sequelize']['fn']('COUNT',db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4d')))),'reCallContacts']]})[_0xf8a1('0x16')](handleEntityNotFound(_0x54c7cd,null))[_0xf8a1('0x16')](respondWithResult(_0x54c7cd,null))['catch'](handleError(_0x54c7cd,null));};exports[_0xf8a1('0x4e')]=function(_0x5ea33c,_0x4e93b2,_0x2dfa24){return db[_0xf8a1('0x1e')][_0xf8a1('0x39')]({'raw':![],'where':{'CampaignId':_0x5ea33c[_0xf8a1('0x40')]['id']},'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x4f')))),_0xf8a1('0x50')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x44')))),_0xf8a1('0x45')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf8a1('0x51')))),_0xf8a1('0x46')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')]('`state`\x20=\x208,\x201,\x20null'))),_0xf8a1('0x48')],[db[_0xf8a1('0x41')]['fn'](_0xf8a1('0x42'),db['sequelize']['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x49')))),'dropContacts'],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db[_0xf8a1('0x41')][_0xf8a1('0x43')](_0xf8a1('0x4b')))),_0xf8a1('0x4c')],[db['sequelize']['fn'](_0xf8a1('0x42'),db[_0xf8a1('0x41')]['fn']('IF',db['sequelize'][_0xf8a1('0x43')](_0xf8a1('0x4d')))),_0xf8a1('0x52')]]})[_0xf8a1('0x16')](handleEntityNotFound(_0x4e93b2,null))['then'](respondWithResult(_0x4e93b2,null))['catch'](handleError(_0x4e93b2,null));};exports[_0xf8a1('0x53')]=function(_0x3a5347,_0x4e0db6,_0x5109df){return db[_0xf8a1('0x54')]['find']({'where':{'id':_0x3a5347['params']['id']}})[_0xf8a1('0x16')](handleEntityNotFound(_0x4e0db6,null))[_0xf8a1('0x16')](function(_0x2849dc){var _0x323605;if(_0x2849dc){_0x323605=squel[_0xf8a1('0x55')]()[_0xf8a1('0x56')](_0xf8a1('0x57'))[_0xf8a1('0x58')]([_0xf8a1('0x59'),_0xf8a1('0x5a'),_0xf8a1('0x5b'),'ListId',_0xf8a1('0x5c'),_0xf8a1('0x5d'),_0xf8a1('0x5e')],squel[_0xf8a1('0x5f')]()['field'](_0xf8a1('0x60'),_0xf8a1('0x59'))['field'](_0xf8a1('0x61'),'scheduledAt')[_0xf8a1('0x62')]('ANY_VALUE(ContactId)',_0xf8a1('0x5b'))[_0xf8a1('0x62')]('ANY_VALUE(ListId)',_0xf8a1('0x63'))['field'](_0xf8a1('0x64'),_0xf8a1('0x5c'))[_0xf8a1('0x62')]('NOW()',_0xf8a1('0x5d'))[_0xf8a1('0x62')](_0xf8a1('0x61'),_0xf8a1('0x5e'))[_0xf8a1('0x65')](_0xf8a1('0x66'))[_0xf8a1('0x2d')]('VoiceQueueId\x20=\x20?',_0x3a5347['params']['id'][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x68'),_0x3a5347[_0xf8a1('0x3e')][_0xf8a1('0x69')][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x6a'))[_0xf8a1('0x2d')](_0xf8a1('0x6b'),squel['select']()[_0xf8a1('0x62')](_0xf8a1('0x59'))['from'](_0xf8a1('0x57'))[_0xf8a1('0x2d')](_0xf8a1('0x6c'),_0x3a5347['params']['id'][_0xf8a1('0x67')]()))[_0xf8a1('0x2d')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0xf8a1('0x62')](_0xf8a1('0x6d'))['from'](_0xf8a1('0x66'))['where'](_0xf8a1('0x6c'),_0x3a5347['params']['id'][_0xf8a1('0x67')]())['where'](_0xf8a1('0x6e')))['group'](_0xf8a1('0x5b')))['toString']();return db[_0xf8a1('0x41')][_0xf8a1('0x22')](_0x323605);}return[];})[_0xf8a1('0x16')](respondWithResult(_0x4e0db6,null))[_0xf8a1('0x3b')](handleError(_0x4e0db6,null));};exports[_0xf8a1('0x6f')]=function(_0x4312d6,_0x243646,_0xe4f726){return db[_0xf8a1('0x70')][_0xf8a1('0x3d')]({'where':{'id':_0x4312d6[_0xf8a1('0x40')]['id']}})['then'](handleEntityNotFound(_0x243646,null))[_0xf8a1('0x16')](function(_0x1a4b4c){var _0x4e2c2a;if(_0x1a4b4c){_0x4e2c2a=squel['insert']()[_0xf8a1('0x56')](_0xf8a1('0x57'))[_0xf8a1('0x58')](['phone','scheduledAt','ContactId','ListId','CampaignId','createdAt',_0xf8a1('0x5e')],squel[_0xf8a1('0x5f')]()[_0xf8a1('0x62')](_0xf8a1('0x60'),_0xf8a1('0x59'))['field'](_0xf8a1('0x61'),_0xf8a1('0x5a'))[_0xf8a1('0x62')]('ANY_VALUE(ContactId)',_0xf8a1('0x5b'))[_0xf8a1('0x62')](_0xf8a1('0x71'),_0xf8a1('0x63'))[_0xf8a1('0x62')](_0xf8a1('0x72'),_0xf8a1('0x73'))[_0xf8a1('0x62')](_0xf8a1('0x61'),_0xf8a1('0x5d'))[_0xf8a1('0x62')]('NOW()','updatedAt')[_0xf8a1('0x65')]('cm_hopper_final')[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id'][_0xf8a1('0x67')]())[_0xf8a1('0x2d')](_0xf8a1('0x68'),_0x4312d6[_0xf8a1('0x3e')][_0xf8a1('0x69')]['toString']())[_0xf8a1('0x2d')](_0xf8a1('0x6a'))[_0xf8a1('0x2d')](_0xf8a1('0x6b'),squel[_0xf8a1('0x5f')]()[_0xf8a1('0x62')](_0xf8a1('0x59'))[_0xf8a1('0x65')](_0xf8a1('0x57'))[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id'][_0xf8a1('0x67')]()))[_0xf8a1('0x2d')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xf8a1('0x5f')]()['field'](_0xf8a1('0x6d'))[_0xf8a1('0x65')](_0xf8a1('0x66'))[_0xf8a1('0x2d')](_0xf8a1('0x74'),_0x4312d6[_0xf8a1('0x40')]['id']['toString']())[_0xf8a1('0x2d')](_0xf8a1('0x6e')))[_0xf8a1('0x75')](_0xf8a1('0x5b')))['toString']();return db[_0xf8a1('0x41')][_0xf8a1('0x22')](_0x4e2c2a);}return[];})['then'](respondWithResult(_0x243646,null))[_0xf8a1('0x3b')](handleError(_0x243646,null));};exports[_0xf8a1('0x76')]=function(_0x112709,_0x5cbc56,_0x51e11e){return db[_0xf8a1('0x77')][_0xf8a1('0x78')]({'where':{'VoiceQueueId':_0x112709['body']['VoiceQueueId'],'CampaignId':_0x112709[_0xf8a1('0x3e')][_0xf8a1('0x73')],'ContactId':_0x112709[_0xf8a1('0x3e')][_0xf8a1('0x5b')]}})[_0xf8a1('0x16')](handleEntityNotFound(_0x5cbc56,null))[_0xf8a1('0x16')](function(_0x503974){if(_0x503974){return _0x503974;}return null;})[_0xf8a1('0x16')](respondWithResult(_0x5cbc56,null))['catch'](handleError(_0x5cbc56,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 76af386..41a032f 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 _0x5f2f=['../../config/logger','api','moment','bluebird','request-promise','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x197925,_0x1ebc44){var _0x286cbb=function(_0x1f4ebe){while(--_0x1f4ebe){_0x197925['push'](_0x197925['shift']());}};_0x286cbb(++_0x1ebc44);}(_0x5f2f,0x73));var _0xf5f2=function(_0x254673,_0x49f8ce){_0x254673=_0x254673-0x0;var _0x4ae7e4=_0x5f2f[_0x254673];return _0x4ae7e4;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xb')]},{'name':'uniqueid','fields':[_0xf5f2('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','./cmHopperFinal.attributes','exports','define','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x172948,_0x4262cc){var _0x4aeaa9=function(_0x5ec4b3){while(--_0x5ec4b3){_0x172948['push'](_0x172948['shift']());}};_0x4aeaa9(++_0x4262cc);}(_0x7a54,0x106));var _0x47a5=function(_0x232f7b,_0x586835){_0x232f7b=_0x232f7b-0x0;var _0x44ca38=_0x7a54[_0x232f7b];return _0x44ca38;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('CmHopperFinal',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x47a5('0x9')]},{'name':_0x47a5('0xa'),'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 582393d..1a36aec 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 _0xd373=['catch','CreateCmHopperFinal','create','body','options','raw','info','stringify','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','then','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','error','code','result'];(function(_0x5548c9,_0x2c7cd1){var _0x49be13=function(_0xa8dddf){while(--_0xa8dddf){_0x5548c9['push'](_0x5548c9['shift']());}};_0x49be13(++_0x2c7cd1);}(_0xd373,0x8b));var _0x3d37=function(_0x5d54bf,_0x195ccd){_0x5d54bf=_0x5d54bf-0x0;var _0x2c255d=_0xd373[_0x5d54bf];return _0x2c255d;};'use strict';var _=require(_0x3d37('0x0'));var util=require(_0x3d37('0x1'));var moment=require(_0x3d37('0x2'));var BPromise=require(_0x3d37('0x3'));var rs=require(_0x3d37('0x4'));var fs=require('fs');var db=require(_0x3d37('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d37('0x6'));var config=require(_0x3d37('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3d37('0x8')][_0x3d37('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x270a46,_0x2ec0be,_0x17d2e9){return new BPromise(function(_0x148c2d,_0x5c1023){return client['request'](_0x270a46,_0x17d2e9)[_0x3d37('0xa')](function(_0x56ac13){logger['info'](_0x3d37('0xb'),_0x2ec0be,_0x3d37('0xc'));logger[_0x3d37('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x2ec0be,_0x3d37('0xc'),JSON['stringify'](_0x56ac13));if(_0x56ac13[_0x3d37('0xe')]){if(_0x56ac13[_0x3d37('0xe')][_0x3d37('0xf')]===0x1f4){logger[_0x3d37('0xe')](_0x3d37('0xb'),_0x2ec0be,_0x56ac13[_0x3d37('0xe')]['message']);return _0x5c1023(_0x56ac13['error']['message']);}logger[_0x3d37('0xe')](_0x3d37('0xb'),_0x2ec0be,_0x56ac13['error']['message']);return _0x148c2d(_0x56ac13[_0x3d37('0xe')]['message']);}else{logger['info'](_0x3d37('0xb'),_0x2ec0be,_0x3d37('0xc'));_0x148c2d(_0x56ac13[_0x3d37('0x10')]['message']);}})[_0x3d37('0x11')](function(_0x454f09){logger[_0x3d37('0xe')](_0x3d37('0xb'),_0x2ec0be,_0x454f09);_0x5c1023(_0x454f09);});});}exports[_0x3d37('0x12')]=function(_0x5c9c99){var _0x4541b4=this;return new Promise(function(_0x5472a4,_0x523bb3){return db['CmHopperFinal'][_0x3d37('0x13')](_0x5c9c99[_0x3d37('0x14')],{'raw':_0x5c9c99['options']?_0x5c9c99[_0x3d37('0x15')][_0x3d37('0x16')]===undefined?!![]:![]:!![]})[_0x3d37('0xa')](function(_0x11672e){logger[_0x3d37('0x17')](_0x3d37('0x12'),_0x5c9c99);logger[_0x3d37('0xd')]('CreateCmHopperFinal',_0x5c9c99,JSON[_0x3d37('0x18')](_0x11672e));_0x5472a4(_0x11672e);})['catch'](function(_0x35301e){logger[_0x3d37('0xe')](_0x3d37('0x12'),_0x35301e['message'],_0x5c9c99);_0x523bb3(_0x4541b4[_0x3d37('0xe')](0x1f4,_0x35301e[_0x3d37('0x19')]));});});}; \ No newline at end of file +var _0x55da=['CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xf2f8d2,_0x3162c6){var _0x45ce4f=function(_0x31a13a){while(--_0x31a13a){_0xf2f8d2['push'](_0xf2f8d2['shift']());}};_0x45ce4f(++_0x3162c6);}(_0x55da,0xa6));var _0xa55d=function(_0x24c4bd,_0x2a5676){_0x24c4bd=_0x24c4bd-0x0;var _0x3ca5f0=_0x55da[_0x24c4bd];return _0x3ca5f0;};'use strict';var _=require('lodash');var util=require(_0xa55d('0x0'));var moment=require('moment');var BPromise=require(_0xa55d('0x1'));var rs=require(_0xa55d('0x2'));var fs=require('fs');var db=require(_0xa55d('0x3'))['db'];var utils=require(_0xa55d('0x4'));var logger=require(_0xa55d('0x5'))(_0xa55d('0x6'));var config=require(_0xa55d('0x7'));var jayson=require(_0xa55d('0x8'));var client=jayson[_0xa55d('0x9')][_0xa55d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1bd89e,_0x3f19b5,_0x4da2fa){return new BPromise(function(_0x5eafb2,_0x1b7110){return client[_0xa55d('0xb')](_0x1bd89e,_0x4da2fa)[_0xa55d('0xc')](function(_0xc70267){logger[_0xa55d('0xd')](_0xa55d('0xe'),_0x3f19b5,_0xa55d('0xf'));logger[_0xa55d('0x10')](_0xa55d('0x11'),_0x3f19b5,_0xa55d('0xf'),JSON[_0xa55d('0x12')](_0xc70267));if(_0xc70267[_0xa55d('0x13')]){if(_0xc70267[_0xa55d('0x13')][_0xa55d('0x14')]===0x1f4){logger[_0xa55d('0x13')](_0xa55d('0xe'),_0x3f19b5,_0xc70267[_0xa55d('0x13')][_0xa55d('0x15')]);return _0x1b7110(_0xc70267[_0xa55d('0x13')][_0xa55d('0x15')]);}logger[_0xa55d('0x13')](_0xa55d('0xe'),_0x3f19b5,_0xc70267['error'][_0xa55d('0x15')]);return _0x5eafb2(_0xc70267[_0xa55d('0x13')]['message']);}else{logger[_0xa55d('0xd')](_0xa55d('0xe'),_0x3f19b5,_0xa55d('0xf'));_0x5eafb2(_0xc70267[_0xa55d('0x16')][_0xa55d('0x15')]);}})[_0xa55d('0x17')](function(_0x412b8b){logger['error'](_0xa55d('0xe'),_0x3f19b5,_0x412b8b);_0x1b7110(_0x412b8b);});});}exports[_0xa55d('0x18')]=function(_0x10a568){var _0x151bff=this;return new Promise(function(_0x267026,_0x3db7f0){return db[_0xa55d('0x19')][_0xa55d('0x1a')](_0x10a568[_0xa55d('0x1b')],{'raw':_0x10a568[_0xa55d('0x1c')]?_0x10a568[_0xa55d('0x1c')][_0xa55d('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2e3455){logger['info']('CreateCmHopperFinal',_0x10a568);logger[_0xa55d('0x10')](_0xa55d('0x18'),_0x10a568,JSON[_0xa55d('0x12')](_0x2e3455));_0x267026(_0x2e3455);})['catch'](function(_0x1dfc73){logger[_0xa55d('0x13')]('CreateCmHopperFinal',_0x1dfc73['message'],_0x10a568);_0x3db7f0(_0x151bff[_0xa55d('0x13')](0x1f4,_0x1dfc73[_0xa55d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e39a406..3ffefea 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 _0x34aa=['index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated'];(function(_0x529b05,_0x130267){var _0x381832=function(_0x2cac68){while(--_0x2cac68){_0x529b05['push'](_0x529b05['shift']());}};_0x381832(++_0x130267);}(_0x34aa,0x171));var _0xa34a=function(_0x23e6bb,_0x5c2d69){_0x23e6bb=_0x23e6bb-0x0;var _0x1e3b4c=_0x34aa[_0x23e6bb];return _0x1e3b4c;};'use strict';var multer=require(_0xa34a('0x0'));var util=require('util');var path=require(_0xa34a('0x1'));var express=require(_0xa34a('0x2'));var router=express[_0xa34a('0x3')]();var auth=require(_0xa34a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa34a('0x5'));var controller=require(_0xa34a('0x6'));router[_0xa34a('0x7')]('/',auth[_0xa34a('0x8')](),controller[_0xa34a('0x9')]);router[_0xa34a('0x7')](_0xa34a('0xa'),auth[_0xa34a('0x8')](),controller[_0xa34a('0xb')]);router[_0xa34a('0x7')](_0xa34a('0xc'),auth['isAuthenticated'](),controller[_0xa34a('0xd')]);router[_0xa34a('0x7')](_0xa34a('0xe'),auth[_0xa34a('0x8')](),controller[_0xa34a('0xf')]);router['get'](_0xa34a('0x10'),auth[_0xa34a('0x8')](),controller[_0xa34a('0x11')]);router[_0xa34a('0x12')](_0xa34a('0x13'),auth[_0xa34a('0x8')](),controller[_0xa34a('0x14')]);router['post'](_0xa34a('0x15'),auth[_0xa34a('0x8')](),controller[_0xa34a('0x16')]);router['post'](_0xa34a('0x17'),auth[_0xa34a('0x8')](),controller['checkContactHopper']);router[_0xa34a('0x18')](_0xa34a('0xc'),auth['isAuthenticated'](),controller[_0xa34a('0x19')]);module[_0xa34a('0x1a')]=router; \ No newline at end of file +var _0x7118=['countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal'];(function(_0x9d0cde,_0x163fc8){var _0x2812cb=function(_0x4e7016){while(--_0x4e7016){_0x9d0cde['push'](_0x9d0cde['shift']());}};_0x2812cb(++_0x163fc8);}(_0x7118,0x159));var _0x8711=function(_0x3797b4,_0x58ab4c){_0x3797b4=_0x3797b4-0x0;var _0x23284e=_0x7118[_0x3797b4];return _0x23284e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8711('0x0'));var express=require(_0x8711('0x1'));var router=express['Router']();var auth=require(_0x8711('0x2'));var interaction=require(_0x8711('0x3'));var config=require(_0x8711('0x4'));var controller=require(_0x8711('0x5'));router[_0x8711('0x6')]('/',auth[_0x8711('0x7')](),controller[_0x8711('0x8')]);router['get'](_0x8711('0x9'),auth[_0x8711('0x7')](),controller[_0x8711('0xa')]);router[_0x8711('0x6')](_0x8711('0xb'),auth[_0x8711('0x7')](),controller[_0x8711('0xc')]);router[_0x8711('0x6')](_0x8711('0xd'),auth[_0x8711('0x7')](),controller[_0x8711('0xe')]);router['get']('/campaign/countAttributes/:id',auth[_0x8711('0x7')](),controller[_0x8711('0xf')]);router[_0x8711('0x10')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0x8711('0x11')]);router[_0x8711('0x10')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x8711('0x12')]);router[_0x8711('0x10')](_0x8711('0x13'),auth[_0x8711('0x7')](),controller[_0x8711('0x14')]);router[_0x8711('0x15')](_0x8711('0xb'),auth['isAuthenticated'](),controller[_0x8711('0x16')]);module[_0x8711('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 108d119..98621ae 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 _0xcb57=['exports','STRING','INTEGER','DATE','BOOLEAN','sequelize'];(function(_0x32f78b,_0x178f58){var _0x51d847=function(_0xc010c3){while(--_0xc010c3){_0x32f78b['push'](_0x32f78b['shift']());}};_0x51d847(++_0x178f58);}(_0xcb57,0xa1));var _0x7cb5=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xcb57[_0x344a3f];return _0x264712;};'use strict';var Sequelize=require(_0x7cb5('0x0'));module[_0x7cb5('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x7cb5('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7cb5('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7cb5('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7cb5('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7cb5('0x2')]},'originatecalleridname':{'type':Sequelize[_0x7cb5('0x2')]},'calleridnum':{'type':Sequelize[_0x7cb5('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x7cb5('0x4')]},'responsetime':{'type':Sequelize[_0x7cb5('0x4')]},'answertime':{'type':Sequelize[_0x7cb5('0x4')]},'droptime':{'type':Sequelize[_0x7cb5('0x4')]},'endtime':{'type':Sequelize[_0x7cb5('0x4')]},'ringtime':{'type':Sequelize[_0x7cb5('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x7cb5('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x7cb5('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x7cb5('0x2')]},'amd':{'type':Sequelize[_0x7cb5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7cb5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x7cb5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7cb5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7cb5('0x4')]},'recallme':{'type':Sequelize[_0x7cb5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x7cb5('0x4')]},'edited':{'type':Sequelize[_0x7cb5('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0xcd59=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3f0f6f,_0x32d8b9){var _0xb1511b=function(_0x4e02d9){while(--_0x4e02d9){_0x3f0f6f['push'](_0x3f0f6f['shift']());}};_0xb1511b(++_0x32d8b9);}(_0xcd59,0x14b));var _0x9cd5=function(_0x1b4912,_0x3e8bb9){_0x1b4912=_0x1b4912-0x0;var _0x48cac5=_0xcd59[_0x1b4912];return _0x48cac5;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'state':{'type':Sequelize[_0x9cd5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9cd5('0x3')]},'scheduledat':{'type':Sequelize[_0x9cd5('0x4')]},'countbusyretry':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9cd5('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9cd5('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9cd5('0x3')]},'calleridnum':{'type':Sequelize[_0x9cd5('0x3')]},'calleridname':{'type':Sequelize[_0x9cd5('0x3')]},'starttime':{'type':Sequelize[_0x9cd5('0x4')]},'responsetime':{'type':Sequelize[_0x9cd5('0x4')]},'answertime':{'type':Sequelize[_0x9cd5('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x9cd5('0x4')]},'ringtime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9cd5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9cd5('0x3')]},'campaign':{'type':Sequelize[_0x9cd5('0x3')]},'campaigntype':{'type':Sequelize[_0x9cd5('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x9cd5('0x3')]},'amd':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x9cd5('0x4')]},'edited':{'type':Sequelize[_0x9cd5('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 049c792..049ad8a 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 _0x0fee=['intersection','fields','attributes','length','sort','where','add','day','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','find','body','describe','uniqueid','moment','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','CmHopperHistory','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x2c030c,_0x10e595){var _0x3da8f6=function(_0x7d9aa){while(--_0x7d9aa){_0x2c030c['push'](_0x2c030c['shift']());}};_0x3da8f6(++_0x10e595);}(_0x0fee,0x116));var _0xe0fe=function(_0x4dc0c4,_0x3ed069){_0x4dc0c4=_0x4dc0c4-0x0;var _0x3669f3=_0x0fee[_0x4dc0c4];return _0x3669f3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe0fe('0x0'));var BPromise=require('bluebird');var Mustache=require(_0xe0fe('0x1'));var util=require(_0xe0fe('0x2'));var path=require(_0xe0fe('0x3'));var sox=require(_0xe0fe('0x4'));var csv=require(_0xe0fe('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xe0fe('0x6'));var crypto=require('crypto');var jsforce=require(_0xe0fe('0x7'));var deskjs=require(_0xe0fe('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe0fe('0x9'));var qs=require(_0xe0fe('0xa'));var logger=require(_0xe0fe('0xb'))(_0xe0fe('0xc'));var utils=require(_0xe0fe('0xd'));var config=require('../../config/environment');var db=require(_0xe0fe('0xe'))['db'];function respondWithStatusCode(_0x4beb27,_0x5d2725){_0x5d2725=_0x5d2725||0xcc;return function(_0x793a7c){if(_0x793a7c){return _0x4beb27[_0xe0fe('0xf')](_0x5d2725);}return _0x4beb27[_0xe0fe('0x10')](_0x5d2725)[_0xe0fe('0x11')]();};}function respondWithResult(_0x2c609d,_0x5478f0){_0x5478f0=_0x5478f0||0xc8;return function(_0xb9220f){if(_0xb9220f){return _0x2c609d['status'](_0x5478f0)[_0xe0fe('0x12')](_0xb9220f);}};}function respondWithFilteredResult(_0x549c0a,_0x43a66d){return function(_0xa70e37){if(_0xa70e37){var _0x519ea6=_0xa70e37[_0xe0fe('0x13')],_0x4fdb1b=_0x43a66d[_0xe0fe('0x14')],_0x567eab=_0x43a66d[_0xe0fe('0x14')]+_0x43a66d[_0xe0fe('0x15')],_0x194a73;if(_0x567eab>=_0x519ea6){_0x567eab=_0x519ea6;_0x194a73=0xc8;}else{_0x194a73=0xce;}_0x549c0a['status'](_0x194a73);return _0x549c0a[_0xe0fe('0x16')](_0xe0fe('0x17'),_0x4fdb1b+'-'+_0x567eab+'/'+_0x519ea6)[_0xe0fe('0x12')](_0xa70e37);}return null;};}function patchUpdates(_0x1b6bff){return function(_0x226c02){try{jsonpatch[_0xe0fe('0x18')](_0x226c02,_0x1b6bff,!![]);}catch(_0x344be){return BPromise[_0xe0fe('0x19')](_0x344be);}return _0x226c02[_0xe0fe('0x1a')]();};}function saveUpdates(_0x4d66c6,_0x1de803){return function(_0x1b91c6){if(_0x1b91c6){return _0x1b91c6[_0xe0fe('0x1b')](_0x4d66c6)[_0xe0fe('0x1c')](function(_0x5a6d04){return _0x5a6d04;});}return null;};}function removeEntity(_0x530437,_0xf99ee){return function(_0x202d27){if(_0x202d27){return _0x202d27[_0xe0fe('0x1d')]()['then'](function(){_0x530437[_0xe0fe('0x10')](0xcc)[_0xe0fe('0x11')]();});}};}function handleEntityNotFound(_0x3a54ea,_0x5d0998){return function(_0x46adbb){if(!_0x46adbb){_0x3a54ea['sendStatus'](0x194);}return _0x46adbb;};}function handleError(_0x14e657,_0x456e57){_0x456e57=_0x456e57||0x1f4;return function(_0x3f02b5){logger[_0xe0fe('0x1e')](_0x3f02b5[_0xe0fe('0x1f')]);if(_0x3f02b5[_0xe0fe('0x20')]){delete _0x3f02b5['name'];}_0x14e657['status'](_0x456e57)[_0xe0fe('0x21')](_0x3f02b5);};}exports['index']=function(_0x4f4cef,_0x241a76){var _0x2f24df={},_0x335966={},_0x5a0637={'count':0x0,'rows':[]};var _0x354b7d=db[_0xe0fe('0x22')][_0xe0fe('0x23')];_0x335966[_0xe0fe('0x24')]=_[_0xe0fe('0x25')](_0x354b7d);var _0x54973b={'dateStart':_0x4f4cef[_0xe0fe('0x26')][_0xe0fe('0x27')],'dateEnd':_0x4f4cef[_0xe0fe('0x26')]['dateEnd']};delete _0x4f4cef[_0xe0fe('0x26')]['dateStart'];delete _0x4f4cef['query'][_0xe0fe('0x28')];_0x335966[_0xe0fe('0x26')]=_[_0xe0fe('0x25')](_0x4f4cef[_0xe0fe('0x26')]);_0x335966[_0xe0fe('0x29')]=_[_0xe0fe('0x2a')](_0x335966[_0xe0fe('0x24')],_0x335966[_0xe0fe('0x26')]);_0x2f24df['attributes']=_['intersection'](_0x335966[_0xe0fe('0x24')],qs[_0xe0fe('0x2b')](_0x4f4cef[_0xe0fe('0x26')][_0xe0fe('0x2b')]));_0x2f24df[_0xe0fe('0x2c')]=_0x2f24df[_0xe0fe('0x2c')][_0xe0fe('0x2d')]?_0x2f24df[_0xe0fe('0x2c')]:_0x335966[_0xe0fe('0x24')];if(!_0x4f4cef[_0xe0fe('0x26')]['hasOwnProperty']('nolimit')){_0x2f24df[_0xe0fe('0x15')]=qs['limit'](_0x4f4cef['query'][_0xe0fe('0x15')]);_0x2f24df['offset']=qs['offset'](_0x4f4cef['query'][_0xe0fe('0x14')]);}_0x2f24df['order']=qs['sort'](_0x4f4cef[_0xe0fe('0x26')][_0xe0fe('0x2e')]);_0x2f24df[_0xe0fe('0x2f')]=qs['filters'](_['pick'](_0x4f4cef['query'],_0x335966['filters']));if(_0x54973b[_0xe0fe('0x27')]){if(_0x54973b[_0xe0fe('0x28')]){_0x54973b['dateEnd']=moment(_0x54973b[_0xe0fe('0x28')])[_0xe0fe('0x30')](0x1,'day');}else{_0x54973b[_0xe0fe('0x28')]=moment(_0x54973b[_0xe0fe('0x27')])['add'](0x1,_0xe0fe('0x31'));}_['merge'](_0x2f24df[_0xe0fe('0x2f')],{'createdAt':{'$gte':_0x54973b[_0xe0fe('0x27')],'$lte':_0x54973b['dateEnd']}});}if(_0x4f4cef[_0xe0fe('0x26')][_0xe0fe('0x32')]){_0x2f24df['where']=_[_0xe0fe('0x33')](_0x2f24df[_0xe0fe('0x2f')],{'$or':_[_0xe0fe('0x34')](_0x2f24df[_0xe0fe('0x2c')],function(_0x5494bb){var _0x3c51a7={};_0x3c51a7[_0x5494bb]={'$like':'%'+_0x4f4cef[_0xe0fe('0x26')]['filter']+'%'};return _0x3c51a7;})});}_0x2f24df=_[_0xe0fe('0x33')]({},_0x2f24df,_0x4f4cef['options']);var _0x488c33={'where':_0x2f24df['where']};return db[_0xe0fe('0x22')][_0xe0fe('0x13')](_0x488c33)[_0xe0fe('0x1c')](function(_0x3ca12b){_0x5a0637[_0xe0fe('0x13')]=_0x3ca12b;if(_0x4f4cef[_0xe0fe('0x26')][_0xe0fe('0x35')]){_0x2f24df[_0xe0fe('0x36')]=[{'all':!![]}];}return db[_0xe0fe('0x22')][_0xe0fe('0x37')](_0x2f24df);})['then'](function(_0x734931){_0x5a0637[_0xe0fe('0x38')]=_0x734931;return _0x5a0637;})[_0xe0fe('0x1c')](respondWithFilteredResult(_0x241a76,_0x2f24df))[_0xe0fe('0x39')](handleError(_0x241a76,null));};exports[_0xe0fe('0x3a')]=function(_0x2c38c3,_0x3aa19b){var _0x3c212b={'raw':!![],'where':{'id':_0x2c38c3[_0xe0fe('0x3b')]['id']}},_0xc1c859={};_0xc1c859['model']=_[_0xe0fe('0x25')](db['CmHopperHistory']['rawAttributes']);_0xc1c859[_0xe0fe('0x26')]=_[_0xe0fe('0x25')](_0x2c38c3[_0xe0fe('0x26')]);_0xc1c859[_0xe0fe('0x29')]=_[_0xe0fe('0x2a')](_0xc1c859['model'],_0xc1c859[_0xe0fe('0x26')]);_0x3c212b[_0xe0fe('0x2c')]=_[_0xe0fe('0x2a')](_0xc1c859['model'],qs['fields'](_0x2c38c3[_0xe0fe('0x26')][_0xe0fe('0x2b')]));_0x3c212b[_0xe0fe('0x2c')]=_0x3c212b['attributes'][_0xe0fe('0x2d')]?_0x3c212b['attributes']:_0xc1c859[_0xe0fe('0x24')];if(_0x2c38c3['query'][_0xe0fe('0x35')]){_0x3c212b['include']=[{'all':!![]}];}_0x3c212b=_[_0xe0fe('0x33')]({},_0x3c212b,_0x2c38c3['options']);return db['CmHopperHistory'][_0xe0fe('0x3c')](_0x3c212b)['then'](handleEntityNotFound(_0x3aa19b,null))['then'](respondWithResult(_0x3aa19b,null))[_0xe0fe('0x39')](handleError(_0x3aa19b,null));};exports['create']=function(_0x2d02e,_0x2febff){return db['CmHopperHistory']['create'](_0x2d02e[_0xe0fe('0x3d')],{})['then'](respondWithResult(_0x2febff,0xc9))[_0xe0fe('0x39')](handleError(_0x2febff,null));};exports[_0xe0fe('0x3e')]=function(_0x1c76ae,_0x11cec4){return db['CmHopperHistory'][_0xe0fe('0x3e')]()[_0xe0fe('0x1c')](respondWithResult(_0x11cec4,null))['catch'](handleError(_0x11cec4,null));};exports[_0xe0fe('0x1b')]=function(_0x565c3d,_0x4f37d5){if(_0x565c3d[_0xe0fe('0x3d')]['uniqueid']){delete _0x565c3d[_0xe0fe('0x3d')][_0xe0fe('0x3f')];}return db[_0xe0fe('0x22')][_0xe0fe('0x3c')]({'where':{'uniqueid':_0x565c3d['params']['id']}})[_0xe0fe('0x1c')](handleEntityNotFound(_0x4f37d5,null))['then'](saveUpdates(_0x565c3d[_0xe0fe('0x3d')],null))[_0xe0fe('0x1c')](respondWithResult(_0x4f37d5,null))[_0xe0fe('0x39')](handleError(_0x4f37d5,null));}; \ No newline at end of file +var _0x3e8e=['length','hasOwnProperty','nolimit','order','sort','where','filters','day','add','merge','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','intersection','find','create','body','describe','catch','uniqueid','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','CmHopperHistory','model','keys','dateStart','query','dateEnd','attributes','fields'];(function(_0x4a78a8,_0x2f6cfd){var _0x22959d=function(_0x4127e5){while(--_0x4127e5){_0x4a78a8['push'](_0x4a78a8['shift']());}};_0x22959d(++_0x2f6cfd);}(_0x3e8e,0x1b8));var _0xe3e8=function(_0x1d63e2,_0x35f417){_0x1d63e2=_0x1d63e2-0x0;var _0x3b9709=_0x3e8e[_0x1d63e2];return _0x3b9709;};'use strict';var jsonpatch=require(_0xe3e8('0x0'));var rp=require(_0xe3e8('0x1'));var moment=require(_0xe3e8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe3e8('0x3'));var util=require(_0xe3e8('0x4'));var path=require(_0xe3e8('0x5'));var sox=require(_0xe3e8('0x6'));var csv=require(_0xe3e8('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe3e8('0x8'));var squel=require(_0xe3e8('0x9'));var crypto=require(_0xe3e8('0xa'));var jsforce=require(_0xe3e8('0xb'));var deskjs=require(_0xe3e8('0xc'));var toCsv=require(_0xe3e8('0x7'));var querystring=require(_0xe3e8('0xd'));var Papa=require('papaparse');var qs=require(_0xe3e8('0xe'));var logger=require(_0xe3e8('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xe3e8('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x160e11,_0xe9891e){_0xe9891e=_0xe9891e||0xcc;return function(_0x1824c3){if(_0x1824c3){return _0x160e11['sendStatus'](_0xe9891e);}return _0x160e11[_0xe3e8('0x11')](_0xe9891e)[_0xe3e8('0x12')]();};}function respondWithResult(_0x126091,_0x515512){_0x515512=_0x515512||0xc8;return function(_0x34092d){if(_0x34092d){return _0x126091[_0xe3e8('0x11')](_0x515512)['json'](_0x34092d);}};}function respondWithFilteredResult(_0x3e3b42,_0x826313){return function(_0x27f743){if(_0x27f743){var _0x3fe5fa=_0x27f743[_0xe3e8('0x13')],_0x428592=_0x826313[_0xe3e8('0x14')],_0x41a4b5=_0x826313[_0xe3e8('0x14')]+_0x826313[_0xe3e8('0x15')],_0xb76966;if(_0x41a4b5>=_0x3fe5fa){_0x41a4b5=_0x3fe5fa;_0xb76966=0xc8;}else{_0xb76966=0xce;}_0x3e3b42[_0xe3e8('0x11')](_0xb76966);return _0x3e3b42[_0xe3e8('0x16')](_0xe3e8('0x17'),_0x428592+'-'+_0x41a4b5+'/'+_0x3fe5fa)[_0xe3e8('0x18')](_0x27f743);}return null;};}function patchUpdates(_0x5d3955){return function(_0x50168a){try{jsonpatch[_0xe3e8('0x19')](_0x50168a,_0x5d3955,!![]);}catch(_0x1a401b){return BPromise[_0xe3e8('0x1a')](_0x1a401b);}return _0x50168a['save']();};}function saveUpdates(_0xe8a199,_0x46467c){return function(_0xf171a1){if(_0xf171a1){return _0xf171a1[_0xe3e8('0x1b')](_0xe8a199)[_0xe3e8('0x1c')](function(_0x3cb872){return _0x3cb872;});}return null;};}function removeEntity(_0x1d06d9,_0x1e4495){return function(_0x31efd3){if(_0x31efd3){return _0x31efd3[_0xe3e8('0x1d')]()[_0xe3e8('0x1c')](function(){_0x1d06d9[_0xe3e8('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0f28f,_0x293961){return function(_0x513d65){if(!_0x513d65){_0xb0f28f[_0xe3e8('0x1e')](0x194);}return _0x513d65;};}function handleError(_0x101eed,_0xd302fe){_0xd302fe=_0xd302fe||0x1f4;return function(_0x369054){logger[_0xe3e8('0x1f')](_0x369054[_0xe3e8('0x20')]);if(_0x369054[_0xe3e8('0x21')]){delete _0x369054[_0xe3e8('0x21')];}_0x101eed[_0xe3e8('0x11')](_0xd302fe)[_0xe3e8('0x22')](_0x369054);};}exports['index']=function(_0x5cb16d,_0x77fb19){var _0x3e1b60={},_0x1d68f3={},_0x5691d6={'count':0x0,'rows':[]};var _0x35546d=db[_0xe3e8('0x23')]['rawAttributes'];_0x1d68f3[_0xe3e8('0x24')]=_[_0xe3e8('0x25')](_0x35546d);var _0x3802e1={'dateStart':_0x5cb16d['query'][_0xe3e8('0x26')],'dateEnd':_0x5cb16d[_0xe3e8('0x27')]['dateEnd']};delete _0x5cb16d['query'][_0xe3e8('0x26')];delete _0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x28')];_0x1d68f3[_0xe3e8('0x27')]=_[_0xe3e8('0x25')](_0x5cb16d[_0xe3e8('0x27')]);_0x1d68f3['filters']=_['intersection'](_0x1d68f3['model'],_0x1d68f3[_0xe3e8('0x27')]);_0x3e1b60[_0xe3e8('0x29')]=_['intersection'](_0x1d68f3[_0xe3e8('0x24')],qs['fields'](_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2a')]));_0x3e1b60[_0xe3e8('0x29')]=_0x3e1b60[_0xe3e8('0x29')][_0xe3e8('0x2b')]?_0x3e1b60['attributes']:_0x1d68f3[_0xe3e8('0x24')];if(!_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2c')](_0xe3e8('0x2d'))){_0x3e1b60['limit']=qs['limit'](_0x5cb16d[_0xe3e8('0x27')]['limit']);_0x3e1b60['offset']=qs['offset'](_0x5cb16d[_0xe3e8('0x27')]['offset']);}_0x3e1b60[_0xe3e8('0x2e')]=qs[_0xe3e8('0x2f')](_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x2f')]);_0x3e1b60[_0xe3e8('0x30')]=qs[_0xe3e8('0x31')](_['pick'](_0x5cb16d[_0xe3e8('0x27')],_0x1d68f3[_0xe3e8('0x31')]));if(_0x3802e1[_0xe3e8('0x26')]){if(_0x3802e1[_0xe3e8('0x28')]){_0x3802e1[_0xe3e8('0x28')]=moment(_0x3802e1[_0xe3e8('0x28')])['add'](0x1,_0xe3e8('0x32'));}else{_0x3802e1[_0xe3e8('0x28')]=moment(_0x3802e1[_0xe3e8('0x26')])[_0xe3e8('0x33')](0x1,_0xe3e8('0x32'));}_[_0xe3e8('0x34')](_0x3e1b60[_0xe3e8('0x30')],{'createdAt':{'$gte':_0x3802e1[_0xe3e8('0x26')],'$lte':_0x3802e1['dateEnd']}});}if(_0x5cb16d['query']['filter']){_0x3e1b60['where']=_[_0xe3e8('0x34')](_0x3e1b60[_0xe3e8('0x30')],{'$or':_[_0xe3e8('0x35')](_0x3e1b60['attributes'],function(_0x36d501){var _0x53d7b6={};_0x53d7b6[_0x36d501]={'$like':'%'+_0x5cb16d[_0xe3e8('0x27')]['filter']+'%'};return _0x53d7b6;})});}_0x3e1b60=_[_0xe3e8('0x34')]({},_0x3e1b60,_0x5cb16d[_0xe3e8('0x36')]);var _0x9d0da8={'where':_0x3e1b60[_0xe3e8('0x30')]};return db[_0xe3e8('0x23')][_0xe3e8('0x13')](_0x9d0da8)[_0xe3e8('0x1c')](function(_0x2f254c){_0x5691d6['count']=_0x2f254c;if(_0x5cb16d[_0xe3e8('0x27')][_0xe3e8('0x37')]){_0x3e1b60[_0xe3e8('0x38')]=[{'all':!![]}];}return db[_0xe3e8('0x23')][_0xe3e8('0x39')](_0x3e1b60);})[_0xe3e8('0x1c')](function(_0xfecf26){_0x5691d6[_0xe3e8('0x3a')]=_0xfecf26;return _0x5691d6;})[_0xe3e8('0x1c')](respondWithFilteredResult(_0x77fb19,_0x3e1b60))['catch'](handleError(_0x77fb19,null));};exports[_0xe3e8('0x3b')]=function(_0x3a6a8f,_0x43e065){var _0x5c9a47={'raw':!![],'where':{'id':_0x3a6a8f[_0xe3e8('0x3c')]['id']}},_0x163b63={};_0x163b63[_0xe3e8('0x24')]=_[_0xe3e8('0x25')](db[_0xe3e8('0x23')][_0xe3e8('0x3d')]);_0x163b63['query']=_[_0xe3e8('0x25')](_0x3a6a8f[_0xe3e8('0x27')]);_0x163b63[_0xe3e8('0x31')]=_[_0xe3e8('0x3e')](_0x163b63['model'],_0x163b63[_0xe3e8('0x27')]);_0x5c9a47[_0xe3e8('0x29')]=_[_0xe3e8('0x3e')](_0x163b63[_0xe3e8('0x24')],qs[_0xe3e8('0x2a')](_0x3a6a8f[_0xe3e8('0x27')][_0xe3e8('0x2a')]));_0x5c9a47['attributes']=_0x5c9a47[_0xe3e8('0x29')][_0xe3e8('0x2b')]?_0x5c9a47[_0xe3e8('0x29')]:_0x163b63[_0xe3e8('0x24')];if(_0x3a6a8f[_0xe3e8('0x27')][_0xe3e8('0x37')]){_0x5c9a47[_0xe3e8('0x38')]=[{'all':!![]}];}_0x5c9a47=_[_0xe3e8('0x34')]({},_0x5c9a47,_0x3a6a8f['options']);return db[_0xe3e8('0x23')][_0xe3e8('0x3f')](_0x5c9a47)['then'](handleEntityNotFound(_0x43e065,null))['then'](respondWithResult(_0x43e065,null))['catch'](handleError(_0x43e065,null));};exports['create']=function(_0x16b9eb,_0xf521f5){return db[_0xe3e8('0x23')][_0xe3e8('0x40')](_0x16b9eb[_0xe3e8('0x41')],{})[_0xe3e8('0x1c')](respondWithResult(_0xf521f5,0xc9))['catch'](handleError(_0xf521f5,null));};exports[_0xe3e8('0x42')]=function(_0x12edd1,_0x2f5294){return db[_0xe3e8('0x23')][_0xe3e8('0x42')]()[_0xe3e8('0x1c')](respondWithResult(_0x2f5294,null))[_0xe3e8('0x43')](handleError(_0x2f5294,null));};exports[_0xe3e8('0x1b')]=function(_0x2e340e,_0x58bb85){if(_0x2e340e[_0xe3e8('0x41')][_0xe3e8('0x44')]){delete _0x2e340e[_0xe3e8('0x41')][_0xe3e8('0x44')];}return db[_0xe3e8('0x23')]['find']({'where':{'uniqueid':_0x2e340e['params']['id']}})[_0xe3e8('0x1c')](handleEntityNotFound(_0x58bb85,null))[_0xe3e8('0x1c')](saveUpdates(_0x2e340e[_0xe3e8('0x41')],null))[_0xe3e8('0x1c')](respondWithResult(_0x58bb85,null))['catch'](handleError(_0x58bb85,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 0d0af5a..f38e9f5 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 _0x2a4f=['../../config/logger','api','bluebird','request-promise','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x4af8cf,_0x51a87c){var _0x1cb78d=function(_0x49de71){while(--_0x49de71){_0x4af8cf['push'](_0x4af8cf['shift']());}};_0x1cb78d(++_0x51a87c);}(_0x2a4f,0xdb));var _0xf2a4=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x2a4f[_0x2cdd4d];return _0x55cbc8;};'use strict';var _=require(_0xf2a4('0x0'));var util=require(_0xf2a4('0x1'));var logger=require(_0xf2a4('0x2'))(_0xf2a4('0x3'));var moment=require('moment');var BPromise=require(_0xf2a4('0x4'));var rp=require(_0xf2a4('0x5'));var attributes=require(_0xf2a4('0x6'));module[_0xf2a4('0x7')]=function(_0x3248da,_0xbb5813){return _0x3248da[_0xf2a4('0x8')](_0xf2a4('0x9'),attributes,{'tableName':_0xf2a4('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xf2a4('0xb')]},{'name':_0xf2a4('0xc'),'fields':[_0xf2a4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b58=['./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4e1dbd,_0x159091){var _0x2e4a31=function(_0x564417){while(--_0x564417){_0x4e1dbd['push'](_0x4e1dbd['shift']());}};_0x2e4a31(++_0x159091);}(_0x4b58,0x10f));var _0x84b5=function(_0x3a433a,_0x559f3b){_0x3a433a=_0x3a433a-0x0;var _0x417696=_0x4b58[_0x3a433a];return _0x417696;};'use strict';var _=require(_0x84b5('0x0'));var util=require(_0x84b5('0x1'));var logger=require(_0x84b5('0x2'))('api');var moment=require(_0x84b5('0x3'));var BPromise=require('bluebird');var rp=require(_0x84b5('0x4'));var attributes=require(_0x84b5('0x5'));module[_0x84b5('0x6')]=function(_0x2ceb95,_0x5c4016){return _0x2ceb95[_0x84b5('0x7')](_0x84b5('0x8'),attributes,{'tableName':_0x84b5('0x9'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x84b5('0xa')]},{'name':_0x84b5('0xb'),'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 d6f062b..6822e62 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 _0xfc05=['client','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','catch','CmHopperHistory','create','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','COUNT','sequelize','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','where','campaign','name','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x27d22e,_0xa7aa59){var _0x27328d=function(_0x1d1e2b){while(--_0x1d1e2b){_0x27d22e['push'](_0x27d22e['shift']());}};_0x27328d(++_0xa7aa59);}(_0xfc05,0x147));var _0x5fc0=function(_0xee8158,_0x2af37c){_0xee8158=_0xee8158-0x0;var _0x5e9c2b=_0xfc05[_0xee8158];return _0x5e9c2b;};'use strict';var _=require(_0x5fc0('0x0'));var util=require(_0x5fc0('0x1'));var moment=require('moment');var BPromise=require(_0x5fc0('0x2'));var rs=require(_0x5fc0('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5fc0('0x4'));var logger=require(_0x5fc0('0x5'))(_0x5fc0('0x6'));var config=require('../../config/environment');var jayson=require(_0x5fc0('0x7'));var client=jayson[_0x5fc0('0x8')][_0x5fc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be348,_0x460d16,_0x22848a){return new BPromise(function(_0x5acf54,_0x3d61af){return client[_0x5fc0('0xa')](_0x3be348,_0x22848a)[_0x5fc0('0xb')](function(_0x51b260){logger[_0x5fc0('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x460d16,_0x5fc0('0xd'));logger[_0x5fc0('0xe')](_0x5fc0('0xf'),_0x460d16,_0x5fc0('0xd'),JSON[_0x5fc0('0x10')](_0x51b260));if(_0x51b260[_0x5fc0('0x11')]){if(_0x51b260[_0x5fc0('0x11')][_0x5fc0('0x12')]===0x1f4){logger[_0x5fc0('0x11')](_0x5fc0('0x13'),_0x460d16,_0x51b260[_0x5fc0('0x11')][_0x5fc0('0x14')]);return _0x3d61af(_0x51b260['error'][_0x5fc0('0x14')]);}logger['error'](_0x5fc0('0x13'),_0x460d16,_0x51b260[_0x5fc0('0x11')][_0x5fc0('0x14')]);return _0x5acf54(_0x51b260[_0x5fc0('0x11')][_0x5fc0('0x14')]);}else{logger[_0x5fc0('0xc')](_0x5fc0('0x13'),_0x460d16,_0x5fc0('0xd'));_0x5acf54(_0x51b260['result']['message']);}})[_0x5fc0('0x15')](function(_0x2d033a){logger[_0x5fc0('0x11')](_0x5fc0('0x13'),_0x460d16,_0x2d033a);_0x3d61af(_0x2d033a);});});}exports['CreateCmHopperHistory']=function(_0x67f62d){var _0x5467be=this;return new Promise(function(_0x403452,_0x2c9715){return db[_0x5fc0('0x16')][_0x5fc0('0x17')](_0x67f62d[_0x5fc0('0x18')],{'raw':_0x67f62d[_0x5fc0('0x19')]?_0x67f62d[_0x5fc0('0x19')][_0x5fc0('0x1a')]===undefined?!![]:![]:!![]})[_0x5fc0('0xb')](function(_0x397345){logger[_0x5fc0('0xc')](_0x5fc0('0x1b'),_0x67f62d);logger[_0x5fc0('0xe')]('CreateCmHopperHistory',_0x67f62d,JSON[_0x5fc0('0x10')](_0x397345));_0x403452(_0x397345);})[_0x5fc0('0x15')](function(_0x1ff7e7){logger[_0x5fc0('0x11')](_0x5fc0('0x1b'),_0x1ff7e7[_0x5fc0('0x14')],_0x67f62d);_0x2c9715(_0x5467be[_0x5fc0('0x11')](0x1f4,_0x1ff7e7['message']));});});};exports[_0x5fc0('0x1c')]=function(_0x8d2738){var _0x1fac3d=this;return new Promise(function(_0x5bfc14,_0x4e4bf4){return db[_0x5fc0('0x16')][_0x5fc0('0x1d')]({'raw':_0x8d2738['options']?_0x8d2738[_0x5fc0('0x19')][_0x5fc0('0x1a')]===undefined?!![]:![]:!![],'where':_0x8d2738['options']?_0x8d2738[_0x5fc0('0x19')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')][_0x5fc0('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x5fc0('0x1f')]['fn']('COUNT',db[_0x5fc0('0x1f')]['fn']('IF',db['sequelize'][_0x5fc0('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x5fc0('0x22')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x23')))),_0x5fc0('0x24')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x26'),db['sequelize']['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x5fc0('0x26'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x27')))),_0x5fc0('0x28')]]})['then'](function(_0x1ac402){logger[_0x5fc0('0xc')]('AvgHandleTime',_0x8d2738);logger[_0x5fc0('0xe')](_0x5fc0('0x1c'),_0x8d2738,JSON[_0x5fc0('0x10')](_0x1ac402));_0x5bfc14(_0x1ac402);})[_0x5fc0('0x15')](function(_0x5a1b50){logger[_0x5fc0('0x11')](_0x5fc0('0x1c'),_0x5a1b50[_0x5fc0('0x14')],_0x8d2738);_0x4e4bf4(_0x1fac3d[_0x5fc0('0x11')](0x1f4,_0x5a1b50['message']));});});};exports[_0x5fc0('0x29')]=function(_0x436842){var _0x334e6c=this;return new Promise(function(_0x2d6793,_0xb879e4){return db[_0x5fc0('0x16')]['findAll']({'raw':_0x436842[_0x5fc0('0x19')]?_0x436842[_0x5fc0('0x19')][_0x5fc0('0x1a')]===undefined?!![]:![]:!![],'where':_0x436842[_0x5fc0('0x19')]?_0x436842[_0x5fc0('0x19')][_0x5fc0('0x2a')]||null:null,'attributes':[[_0x5fc0('0x2b'),_0x5fc0('0x2c')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')]('`state`\x20=\x200,\x201,\x20null'))),_0x5fc0('0x2d')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x5fc0('0x2e')],[db['sequelize']['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5fc0('0x2f')))),_0x5fc0('0x30')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db['sequelize'][_0x5fc0('0x21')](_0x5fc0('0x31')))),_0x5fc0('0x32')],[db['sequelize']['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5fc0('0x33')))),'outboundCongestionCallsDay'],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')]['literal'](_0x5fc0('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5fc0('0x35')],[db['sequelize']['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),_0x5fc0('0x36')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')]['literal'](_0x5fc0('0x37')))),_0x5fc0('0x38')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x39')))),_0x5fc0('0x3a')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')]('`state`\x20=\x2018,\x201,\x20null'))),_0x5fc0('0x3b')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x3c')))),'outboundAnswerAgiCallsDay'],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')](_0x5fc0('0x3d')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x5fc0('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x5fc0('0x21')](_0x5fc0('0x3e')))),_0x5fc0('0x3f')]],'group':[_0x5fc0('0x2b')]})[_0x5fc0('0xb')](function(_0x12e661){logger[_0x5fc0('0xc')](_0x5fc0('0x29'),_0x436842);logger[_0x5fc0('0xe')](_0x5fc0('0x29'),_0x436842,JSON[_0x5fc0('0x10')](_0x12e661));_0x2d6793(_0x12e661);})[_0x5fc0('0x15')](function(_0x4c068d){logger[_0x5fc0('0x11')](_0x5fc0('0x29'),_0x4c068d[_0x5fc0('0x14')],_0x436842);_0xb879e4(_0x334e6c[_0x5fc0('0x11')](0x1f4,_0x4c068d[_0x5fc0('0x14')]));});});};exports[_0x5fc0('0x40')]=function(_0x9d9557){var _0x12dcc8=this;return new Promise(function(_0x1cbe72,_0x4e8ba5){return db['CmHopperHistory'][_0x5fc0('0x1d')]({'raw':_0x9d9557[_0x5fc0('0x19')]?_0x9d9557[_0x5fc0('0x19')][_0x5fc0('0x1a')]===undefined?!![]:![]:!![],'where':_0x9d9557[_0x5fc0('0x19')]?_0x9d9557['options'][_0x5fc0('0x2a')]||null:null,'attributes':[[_0x5fc0('0x2b'),_0x5fc0('0x2c')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')][_0x5fc0('0x20')]('id')),_0x5fc0('0x41')],[db[_0x5fc0('0x1f')]['fn'](_0x5fc0('0x1e'),db[_0x5fc0('0x1f')]['fn']('IF',db[_0x5fc0('0x1f')][_0x5fc0('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x5fc0('0x42')]],'group':[_0x5fc0('0x2b')]})[_0x5fc0('0xb')](function(_0x3100bd){logger[_0x5fc0('0xc')](_0x5fc0('0x40'),_0x9d9557);logger['debug'](_0x5fc0('0x40'),_0x9d9557,JSON[_0x5fc0('0x10')](_0x3100bd));_0x1cbe72(_0x3100bd);})[_0x5fc0('0x15')](function(_0x2ed37e){logger[_0x5fc0('0x11')](_0x5fc0('0x40'),_0x2ed37e[_0x5fc0('0x14')],_0x9d9557);_0x4e8ba5(_0x12dcc8['error'](0x1f4,_0x2ed37e[_0x5fc0('0x14')]));});});}; \ No newline at end of file +var _0x314a=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','col','ivrAnswerCallsDay','GetCampaignHopperHistory','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','then','AvgHandleTime','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG'];(function(_0x13806c,_0x442882){var _0x43391d=function(_0x147756){while(--_0x147756){_0x13806c['push'](_0x13806c['shift']());}};_0x43391d(++_0x442882);}(_0x314a,0xab));var _0xa314=function(_0x39f9f2,_0x37fc06){_0x39f9f2=_0x39f9f2-0x0;var _0x3febf8=_0x314a[_0x39f9f2];return _0x3febf8;};'use strict';var _=require('lodash');var util=require(_0xa314('0x0'));var moment=require('moment');var BPromise=require(_0xa314('0x1'));var rs=require(_0xa314('0x2'));var fs=require('fs');var db=require(_0xa314('0x3'))['db'];var utils=require(_0xa314('0x4'));var logger=require(_0xa314('0x5'))(_0xa314('0x6'));var config=require(_0xa314('0x7'));var jayson=require(_0xa314('0x8'));var client=jayson[_0xa314('0x9')][_0xa314('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d6e26,_0x4d42f4,_0x14c1ce){return new BPromise(function(_0x26c49e,_0x1cec08){return client['request'](_0x1d6e26,_0x14c1ce)['then'](function(_0x39e74d){logger[_0xa314('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d42f4,_0xa314('0xc'));logger[_0xa314('0xd')](_0xa314('0xe'),_0x4d42f4,'request\x20sent',JSON[_0xa314('0xf')](_0x39e74d));if(_0x39e74d['error']){if(_0x39e74d[_0xa314('0x10')][_0xa314('0x11')]===0x1f4){logger['error'](_0xa314('0x12'),_0x4d42f4,_0x39e74d['error'][_0xa314('0x13')]);return _0x1cec08(_0x39e74d[_0xa314('0x10')][_0xa314('0x13')]);}logger[_0xa314('0x10')](_0xa314('0x12'),_0x4d42f4,_0x39e74d['error'][_0xa314('0x13')]);return _0x26c49e(_0x39e74d[_0xa314('0x10')]['message']);}else{logger[_0xa314('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4d42f4,_0xa314('0xc'));_0x26c49e(_0x39e74d[_0xa314('0x14')][_0xa314('0x13')]);}})[_0xa314('0x15')](function(_0x444aae){logger[_0xa314('0x10')](_0xa314('0x12'),_0x4d42f4,_0x444aae);_0x1cec08(_0x444aae);});});}exports[_0xa314('0x16')]=function(_0x30fa7f){var _0x87bf3a=this;return new Promise(function(_0x4f4c1a,_0xfb0520){return db[_0xa314('0x17')][_0xa314('0x18')](_0x30fa7f[_0xa314('0x19')],{'raw':_0x30fa7f[_0xa314('0x1a')]?_0x30fa7f['options']['raw']===undefined?!![]:![]:!![]})[_0xa314('0x1b')](function(_0x1ad8e7){logger[_0xa314('0xb')](_0xa314('0x16'),_0x30fa7f);logger[_0xa314('0xd')](_0xa314('0x16'),_0x30fa7f,JSON[_0xa314('0xf')](_0x1ad8e7));_0x4f4c1a(_0x1ad8e7);})[_0xa314('0x15')](function(_0x5c2e0c){logger[_0xa314('0x10')](_0xa314('0x16'),_0x5c2e0c[_0xa314('0x13')],_0x30fa7f);_0xfb0520(_0x87bf3a[_0xa314('0x10')](0x1f4,_0x5c2e0c[_0xa314('0x13')]));});});};exports[_0xa314('0x1c')]=function(_0x34fc04){var _0x5007a2=this;return new Promise(function(_0x2a414f,_0x1ee4b1){return db['CmHopperHistory'][_0xa314('0x1d')]({'raw':_0x34fc04[_0xa314('0x1a')]?_0x34fc04[_0xa314('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x34fc04[_0xa314('0x1a')]?_0x34fc04[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['col']('id')),_0xa314('0x21')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x23')))),_0xa314('0x24')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x26'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x27')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xa314('0x28')]]})[_0xa314('0x1b')](function(_0x154994){logger[_0xa314('0xb')](_0xa314('0x1c'),_0x34fc04);logger['debug'](_0xa314('0x1c'),_0x34fc04,JSON[_0xa314('0xf')](_0x154994));_0x2a414f(_0x154994);})[_0xa314('0x15')](function(_0x472519){logger[_0xa314('0x10')]('AvgHandleTime',_0x472519[_0xa314('0x13')],_0x34fc04);_0x1ee4b1(_0x5007a2['error'](0x1f4,_0x472519[_0xa314('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x140e2d){var _0x3cc77e=this;return new Promise(function(_0x33c786,_0x4f1d59){return db['CmHopperHistory'][_0xa314('0x1d')]({'raw':_0x140e2d[_0xa314('0x1a')]?_0x140e2d[_0xa314('0x1a')][_0xa314('0x29')]===undefined?!![]:![]:!![],'where':_0x140e2d[_0xa314('0x1a')]?_0x140e2d[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[_0xa314('0x2a'),_0xa314('0x2b')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa314('0x2c')))),_0xa314('0x2d')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x2e')))),_0xa314('0x2f')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xa314('0x30')],[db[_0xa314('0x1f')]['fn']('COUNT',db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal'](_0xa314('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xa314('0x32')],[db[_0xa314('0x1f')]['fn']('COUNT',db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x33')))),_0xa314('0x34')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x35')))),'outboundDropCallsDayCallersExit'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x36')))),'outboundUnknownCallsDay'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xa314('0x37')))),_0xa314('0x38')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x39')))),_0xa314('0x3a')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db[_0xa314('0x1f')][_0xa314('0x22')](_0xa314('0x3b')))),_0xa314('0x3c')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db[_0xa314('0x1f')]['literal'](_0xa314('0x3d')))),_0xa314('0x3e')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xa314('0x3f')))),_0xa314('0x3c')],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db[_0xa314('0x1f')]['fn']('IF',db['sequelize'][_0xa314('0x22')](_0xa314('0x40')))),_0xa314('0x41')]],'group':[_0xa314('0x2a')]})[_0xa314('0x1b')](function(_0x345a19){logger[_0xa314('0xb')](_0xa314('0x42'),_0x140e2d);logger[_0xa314('0xd')](_0xa314('0x42'),_0x140e2d,JSON[_0xa314('0xf')](_0x345a19));_0x33c786(_0x345a19);})[_0xa314('0x15')](function(_0xd66e8){logger[_0xa314('0x10')](_0xa314('0x42'),_0xd66e8['message'],_0x140e2d);_0x4f1d59(_0x3cc77e[_0xa314('0x10')](0x1f4,_0xd66e8[_0xa314('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x2d4a4e){var _0x37807b=this;return new Promise(function(_0x49ecf6,_0x2ac976){return db[_0xa314('0x17')][_0xa314('0x1d')]({'raw':_0x2d4a4e[_0xa314('0x1a')]?_0x2d4a4e['options'][_0xa314('0x29')]===undefined?!![]:![]:!![],'where':_0x2d4a4e['options']?_0x2d4a4e[_0xa314('0x1a')][_0xa314('0x1e')]||null:null,'attributes':[[_0xa314('0x2a'),_0xa314('0x2b')],[db['sequelize']['fn'](_0xa314('0x20'),db[_0xa314('0x1f')][_0xa314('0x43')]('id')),'ivrTotalCallsDays'],[db[_0xa314('0x1f')]['fn'](_0xa314('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xa314('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0xa314('0x44')]],'group':[_0xa314('0x2a')]})[_0xa314('0x1b')](function(_0x79f548){logger[_0xa314('0xb')]('GetCampaignHopperHistory',_0x2d4a4e);logger[_0xa314('0xd')]('GetCampaignHopperHistory',_0x2d4a4e,JSON[_0xa314('0xf')](_0x79f548));_0x49ecf6(_0x79f548);})[_0xa314('0x15')](function(_0x5828a9){logger[_0xa314('0x10')](_0xa314('0x45'),_0x5828a9[_0xa314('0x13')],_0x2d4a4e);_0x2ac976(_0x37807b[_0xa314('0x10')](0x1f4,_0x5828a9[_0xa314('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index d43663d..2d12390 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 _0xa9e0=['/describe','describe','create','put','/:id','update','multer','util','path','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x25de1b,_0x5c42a5){var _0x52615d=function(_0x559694){while(--_0x559694){_0x25de1b['push'](_0x25de1b['shift']());}};_0x52615d(++_0x5c42a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id',auth[_0x0a9e('0x7')](),controller['show']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/describe','describe','create','put','/:id','update','multer','util','path','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x301f8f,_0x2087c6){var _0x203692=function(_0x51d7c5){while(--_0x51d7c5){_0x301f8f['push'](_0x301f8f['shift']());}};_0x203692(++_0x2087c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id',auth[_0x0a9e('0x7')](),controller['show']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index e69b01d..00bc9ed 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 _0x4819=['name','exports','STRING'];(function(_0x5aa9ed,_0x3b5c55){var _0x50c332=function(_0x3672b5){while(--_0x3672b5){_0x5aa9ed['push'](_0x5aa9ed['shift']());}};_0x50c332(++_0x3b5c55);}(_0x4819,0xcd));var _0x9481=function(_0x3d13d7,_0x295266){_0x3d13d7=_0x3d13d7-0x0;var _0x34fdde=_0x4819[_0x3d13d7];return _0x34fdde;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'unique':_0x9481('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9481('0x1')]},'dialPrefix':{'type':Sequelize[_0x9481('0x1')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','name','sequelize'];(function(_0x155214,_0x331973){var _0x5df1ae=function(_0x582257){while(--_0x582257){_0x155214['push'](_0x155214['shift']());}};_0x5df1ae(++_0x331973);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'name':{'type':Sequelize[_0x7995('0x2')],'unique':_0x7995('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index b529a0f..30c9fd2 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 _0x9a5c=['fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./cmList.socket','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','stack','name','send','index','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','CmList','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','concat','CustomFields','format','cf_%d','raw','getContactsCsv','CmCustomField','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','Sequelize','TEXT','type','text','number','INTEGER','switch','BOOLEAN','defaultValue','cm_contacts','cf_%s','getCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User'];(function(_0x2ede95,_0x32c4ff){var _0x596c7f=function(_0x53f0fa){while(--_0x53f0fa){_0x2ede95['push'](_0x2ede95['shift']());}};_0x596c7f(++_0x32c4ff);}(_0x9a5c,0x82));var _0xc9a5=function(_0x1b9f24,_0x42077f){_0x1b9f24=_0x1b9f24-0x0;var _0x1220da=_0x9a5c[_0x1b9f24];return _0x1220da;};'use strict';var jsonpatch=require(_0xc9a5('0x0'));var rp=require(_0xc9a5('0x1'));var moment=require(_0xc9a5('0x2'));var BPromise=require(_0xc9a5('0x3'));var Mustache=require('mustache');var util=require(_0xc9a5('0x4'));var path=require(_0xc9a5('0x5'));var sox=require(_0xc9a5('0x6'));var csv=require(_0xc9a5('0x7'));var ejs=require(_0xc9a5('0x8'));var fs=require('fs');var _=require(_0xc9a5('0x9'));var squel=require('squel');var crypto=require(_0xc9a5('0xa'));var jsforce=require(_0xc9a5('0xb'));var deskjs=require(_0xc9a5('0xc'));var toCsv=require(_0xc9a5('0x7'));var querystring=require('querystring');var Papa=require(_0xc9a5('0xd'));var qs=require(_0xc9a5('0xe'));var logger=require('../../config/logger')(_0xc9a5('0xf'));var utils=require(_0xc9a5('0x10'));var config=require(_0xc9a5('0x11'));var db=require(_0xc9a5('0x12'))['db'];var socket=require(_0xc9a5('0x13'))({'host':_0xc9a5('0x14'),'port':0x18eb});require(_0xc9a5('0x15'))['register'](socket);function respondWithStatusCode(_0x3a8f8b,_0x40cce4){_0x40cce4=_0x40cce4||0xcc;return function(_0x9529bf){if(_0x9529bf){return _0x3a8f8b['sendStatus'](_0x40cce4);}return _0x3a8f8b[_0xc9a5('0x16')](_0x40cce4)['end']();};}function respondWithResult(_0x2479d3,_0x5f4a3b){_0x5f4a3b=_0x5f4a3b||0xc8;return function(_0x5b7522){if(_0x5b7522){return _0x2479d3['status'](_0x5f4a3b)[_0xc9a5('0x17')](_0x5b7522);}};}function respondWithFilteredResult(_0x462163,_0x18ec53){return function(_0x36122e){if(_0x36122e){var _0x4b7f9=_0x36122e[_0xc9a5('0x18')],_0x59d748=_0x18ec53['offset'],_0x362e98=_0x18ec53[_0xc9a5('0x19')]+_0x18ec53[_0xc9a5('0x1a')],_0x497bc8;if(_0x362e98>=_0x4b7f9){_0x362e98=_0x4b7f9;_0x497bc8=0xc8;}else{_0x497bc8=0xce;}_0x462163['status'](_0x497bc8);return _0x462163[_0xc9a5('0x1b')](_0xc9a5('0x1c'),_0x59d748+'-'+_0x362e98+'/'+_0x4b7f9)[_0xc9a5('0x17')](_0x36122e);}return null;};}function patchUpdates(_0x5865e0){return function(_0x5c892d){try{jsonpatch[_0xc9a5('0x1d')](_0x5c892d,_0x5865e0,!![]);}catch(_0x3df128){return BPromise['reject'](_0x3df128);}return _0x5c892d[_0xc9a5('0x1e')]();};}function saveUpdates(_0x212d1d,_0x1f6f81){return function(_0x1a2ce0){if(_0x1a2ce0){return _0x1a2ce0[_0xc9a5('0x1f')](_0x212d1d)[_0xc9a5('0x20')](function(_0x29a6ec){return _0x29a6ec;});}return null;};}function removeEntity(_0x57ca28,_0x39ef96){return function(_0x17d60e){if(_0x17d60e){return _0x17d60e[_0xc9a5('0x21')]()[_0xc9a5('0x20')](function(){_0x57ca28[_0xc9a5('0x16')](0xcc)[_0xc9a5('0x22')]();});}};}function handleEntityNotFound(_0x2af275,_0xf2841c){return function(_0xfa310){if(!_0xfa310){_0x2af275[_0xc9a5('0x23')](0x194);}return _0xfa310;};}function handleError(_0x3ee25b,_0x415b92){_0x415b92=_0x415b92||0x1f4;return function(_0x12e7bc){logger['error'](_0x12e7bc[_0xc9a5('0x24')]);if(_0x12e7bc['name']){delete _0x12e7bc[_0xc9a5('0x25')];}_0x3ee25b[_0xc9a5('0x16')](_0x415b92)[_0xc9a5('0x26')](_0x12e7bc);};}exports[_0xc9a5('0x27')]=function(_0x456ed8,_0x9f4186){var _0x4a43cf={},_0x3ed566={},_0x59b336={'count':0x0,'rows':[]};var _0x532388=db['CmList'][_0xc9a5('0x28')];_0x3ed566['model']=_[_0xc9a5('0x29')](_0x532388);var _0x128631={'dateStart':_0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x2b')],'dateEnd':_0x456ed8['query'][_0xc9a5('0x2c')]};delete _0x456ed8[_0xc9a5('0x2a')]['dateStart'];delete _0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x2c')];_0x3ed566[_0xc9a5('0x2a')]=_[_0xc9a5('0x29')](_0x456ed8[_0xc9a5('0x2a')]);_0x3ed566[_0xc9a5('0x2d')]=_[_0xc9a5('0x2e')](_0x3ed566[_0xc9a5('0x2f')],_0x3ed566[_0xc9a5('0x2a')]);_0x4a43cf[_0xc9a5('0x30')]=_['intersection'](_0x3ed566[_0xc9a5('0x2f')],qs[_0xc9a5('0x31')](_0x456ed8[_0xc9a5('0x2a')]['fields']));_0x4a43cf[_0xc9a5('0x30')]=_0x4a43cf[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x4a43cf['attributes']:_0x3ed566[_0xc9a5('0x2f')];if(!_0x456ed8['query'][_0xc9a5('0x33')](_0xc9a5('0x34'))){_0x4a43cf['limit']=qs[_0xc9a5('0x1a')](_0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x1a')]);_0x4a43cf[_0xc9a5('0x19')]=qs[_0xc9a5('0x19')](_0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x19')]);}_0x4a43cf[_0xc9a5('0x35')]=qs[_0xc9a5('0x36')](_0x456ed8[_0xc9a5('0x2a')]['sort']);_0x4a43cf[_0xc9a5('0x37')]=qs[_0xc9a5('0x2d')](_[_0xc9a5('0x38')](_0x456ed8[_0xc9a5('0x2a')],_0x3ed566['filters']));if(_0x128631[_0xc9a5('0x2b')]){if(_0x128631[_0xc9a5('0x2c')]){_0x128631[_0xc9a5('0x2c')]=moment(_0x128631['dateEnd'])[_0xc9a5('0x39')](0x1,_0xc9a5('0x3a'));}else{_0x128631[_0xc9a5('0x2c')]=moment(_0x128631[_0xc9a5('0x2b')])[_0xc9a5('0x39')](0x1,_0xc9a5('0x3a'));}_[_0xc9a5('0x3b')](_0x4a43cf[_0xc9a5('0x37')],{'createdAt':{'$gte':_0x128631[_0xc9a5('0x2b')],'$lte':_0x128631[_0xc9a5('0x2c')]}});}if(_0x456ed8['query'][_0xc9a5('0x3c')]){_0x4a43cf[_0xc9a5('0x37')]=_['merge'](_0x4a43cf[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x4a43cf[_0xc9a5('0x30')],function(_0xcb484e){var _0x562fe1={};_0x562fe1[_0xcb484e]={'$like':'%'+_0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x3c')]+'%'};return _0x562fe1;})});}_0x4a43cf=_[_0xc9a5('0x3b')]({},_0x4a43cf,_0x456ed8[_0xc9a5('0x3e')]);var _0x1d5f95={'where':_0x4a43cf['where']};return db[_0xc9a5('0x3f')]['count'](_0x1d5f95)['then'](function(_0x491928){_0x59b336[_0xc9a5('0x18')]=_0x491928;if(_0x456ed8[_0xc9a5('0x2a')][_0xc9a5('0x40')]){_0x4a43cf[_0xc9a5('0x41')]=[{'all':!![]}];}return db[_0xc9a5('0x3f')][_0xc9a5('0x42')](_0x4a43cf);})['then'](function(_0x1b2374){_0x59b336[_0xc9a5('0x43')]=_0x1b2374;return _0x59b336;})[_0xc9a5('0x20')](respondWithFilteredResult(_0x9f4186,_0x4a43cf))[_0xc9a5('0x44')](handleError(_0x9f4186,null));};exports[_0xc9a5('0x45')]=function(_0x5e254c,_0x14263f){var _0x2950d4={'raw':![],'where':{'id':_0x5e254c[_0xc9a5('0x46')]['id']}},_0x2a0a87={};_0x2a0a87[_0xc9a5('0x2f')]=_[_0xc9a5('0x29')](db[_0xc9a5('0x3f')][_0xc9a5('0x28')]);_0x2a0a87[_0xc9a5('0x2a')]=_[_0xc9a5('0x29')](_0x5e254c[_0xc9a5('0x2a')]);_0x2a0a87[_0xc9a5('0x2d')]=_[_0xc9a5('0x2e')](_0x2a0a87[_0xc9a5('0x2f')],_0x2a0a87['query']);_0x2950d4['attributes']=_[_0xc9a5('0x2e')](_0x2a0a87[_0xc9a5('0x2f')],qs['fields'](_0x5e254c[_0xc9a5('0x2a')]['fields']));_0x2950d4[_0xc9a5('0x30')]=_0x2950d4['attributes'][_0xc9a5('0x32')]?_0x2950d4[_0xc9a5('0x30')]:_0x2a0a87[_0xc9a5('0x2f')];if(_0x5e254c[_0xc9a5('0x2a')]['includeAll']){_0x2950d4[_0xc9a5('0x41')]=[{'all':!![]}];}_0x2950d4=_[_0xc9a5('0x3b')]({},_0x2950d4,_0x5e254c[_0xc9a5('0x3e')]);return db[_0xc9a5('0x3f')]['find'](_0x2950d4)[_0xc9a5('0x20')](handleEntityNotFound(_0x14263f,null))['then'](respondWithResult(_0x14263f,null))['catch'](handleError(_0x14263f,null));};exports[_0xc9a5('0x47')]=function(_0x1793c8,_0x4324ad){return db[_0xc9a5('0x3f')][_0xc9a5('0x47')](_0x1793c8['body'],{})[_0xc9a5('0x20')](respondWithResult(_0x4324ad,0xc9))[_0xc9a5('0x44')](handleError(_0x4324ad,null));};exports[_0xc9a5('0x1f')]=function(_0x478cc0,_0x49039a){if(_0x478cc0['body']['id']){delete _0x478cc0[_0xc9a5('0x48')]['id'];}return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x478cc0['params']['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x49039a,null))[_0xc9a5('0x20')](saveUpdates(_0x478cc0[_0xc9a5('0x48')],null))[_0xc9a5('0x20')](respondWithResult(_0x49039a,null))['catch'](handleError(_0x49039a,null));};exports[_0xc9a5('0x21')]=function(_0xe835ad,_0x478926){return db['CmList'][_0xc9a5('0x49')]({'where':{'id':_0xe835ad[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x478926,null))[_0xc9a5('0x20')](removeEntity(_0x478926,null))['catch'](handleError(_0x478926,null));};exports[_0xc9a5('0x4a')]=function(_0x1a0a20,_0x4da843){return db['CmList'][_0xc9a5('0x4a')]()[_0xc9a5('0x20')](respondWithResult(_0x4da843,null))[_0xc9a5('0x44')](handleError(_0x4da843,null));};exports[_0xc9a5('0x4b')]=function(_0x495456,_0xa10993,_0x3daa07){if(_0x495456[_0xc9a5('0x48')]['id']){delete _0x495456[_0xc9a5('0x48')]['id'];}return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x495456['params']['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0xa10993,null))[_0xc9a5('0x20')](function(_0x51aae4){if(_0x51aae4){_0x495456[_0xc9a5('0x48')][_0xc9a5('0x4c')]=_0x51aae4['id'];return db['Disposition']['create'](_0x495456['body']);}})[_0xc9a5('0x20')](respondWithResult(_0xa10993,null))[_0xc9a5('0x44')](handleError(_0xa10993,null));};exports[_0xc9a5('0x4d')]=function(_0x419087,_0x109cd2,_0x4621b8){var _0x50865b={'raw':![],'where':{}};var _0xe695d3={};var _0x4f33be={'count':0x0,'rows':[]};return db[_0xc9a5('0x3f')][_0xc9a5('0x4e')]({'where':{'id':_0x419087[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x109cd2,null))['then'](function(_0x3b6552){if(_0x3b6552){_0xe695d3[_0xc9a5('0x2f')]=_[_0xc9a5('0x29')](db[_0xc9a5('0x4f')][_0xc9a5('0x28')]);_0xe695d3[_0xc9a5('0x2a')]=_[_0xc9a5('0x29')](_0x419087[_0xc9a5('0x2a')]);_0xe695d3[_0xc9a5('0x2d')]=_['intersection'](_0xe695d3[_0xc9a5('0x2f')],_0xe695d3[_0xc9a5('0x2a')]);_0x50865b[_0xc9a5('0x30')]=_['intersection'](_0xe695d3['model'],qs[_0xc9a5('0x31')](_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x31')]));_0x50865b[_0xc9a5('0x30')]=_0x50865b[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x50865b[_0xc9a5('0x30')]:_0xe695d3[_0xc9a5('0x2f')];if(!_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x33')](_0xc9a5('0x34'))){_0x50865b[_0xc9a5('0x1a')]=qs[_0xc9a5('0x1a')](_0x419087['query'][_0xc9a5('0x1a')]);_0x50865b[_0xc9a5('0x19')]=qs[_0xc9a5('0x19')](_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x19')]);}_0x50865b['order']=qs['sort'](_0x419087[_0xc9a5('0x2a')]['sort']);_0x50865b[_0xc9a5('0x37')]=qs[_0xc9a5('0x2d')](_['pick'](_0x419087[_0xc9a5('0x2a')],_0xe695d3[_0xc9a5('0x2d')]));_0x50865b[_0xc9a5('0x37')][_0xc9a5('0x4c')]=_0x3b6552['id'];if(_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x3c')]){_0x50865b[_0xc9a5('0x37')]=_[_0xc9a5('0x3b')](_0x50865b[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x50865b[_0xc9a5('0x30')],function(_0x130be6){var _0x456286={};_0x456286[_0x130be6]={'$like':'%'+_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x3c')]+'%'};return _0x456286;})});}_0x50865b=_[_0xc9a5('0x3b')]({},_0x50865b,_0x419087[_0xc9a5('0x3e')]);return db[_0xc9a5('0x4f')][_0xc9a5('0x18')]({'where':_0x50865b['where']})[_0xc9a5('0x20')](function(_0x2da3b1){_0x4f33be['count']=_0x2da3b1;if(_0x419087[_0xc9a5('0x2a')][_0xc9a5('0x40')]){_0x50865b[_0xc9a5('0x41')]=[{'all':!![]}];}return db[_0xc9a5('0x4f')]['findAll'](_0x50865b);})[_0xc9a5('0x20')](function(_0x222f5f){_0x4f33be[_0xc9a5('0x43')]=_0x222f5f;return _0x4f33be;});}})[_0xc9a5('0x20')](respondWithFilteredResult(_0x109cd2,_0x50865b))[_0xc9a5('0x44')](handleError(_0x109cd2,null));};exports[_0xc9a5('0x50')]=function(_0x316bdc,_0x39b21b,_0x802579){var _0x36d2a1;return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x316bdc[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x39b21b,null))[_0xc9a5('0x20')](function(_0x479ad6){if(_0x479ad6){return _0x479ad6[_0xc9a5('0x50')](_0x316bdc[_0xc9a5('0x2a')][_0xc9a5('0x51')]);}})[_0xc9a5('0x20')](respondWithStatusCode(_0x39b21b,null))['catch'](handleError(_0x39b21b,null));};exports[_0xc9a5('0x52')]=function(_0x1a1564,_0x183082,_0x3cb0cf){return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x1a1564['params']['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x183082,null))[_0xc9a5('0x20')](function(_0x3be114){if(_0x3be114){var _0x52891a=[];var _0x209ef5={'success':[],'errors':[]};return db[_0xc9a5('0x53')][_0xc9a5('0x4a')]()['then'](function(_0xe51fd5){if(_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')]&&_[_0xc9a5('0x55')](_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')])){if(_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')][_0xc9a5('0x32')]){_0x1a1564['body'][_0xc9a5('0x54')]=_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')][_0xc9a5('0x56')](';')+';';}else{_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')]=null;}}else{_0x1a1564[_0xc9a5('0x48')][_0xc9a5('0x54')]=null;}if(_0x1a1564[_0xc9a5('0x48')]&&_[_0xc9a5('0x55')](_0x1a1564['body'])){for(var _0x1e2ea3=0x0;_0x1e2ea3<_0x1a1564['body'][_0xc9a5('0x32')];_0x1e2ea3+=0x1){_0x1a1564['body'][_0x1e2ea3][_0xc9a5('0x4c')]=_0x1a1564[_0xc9a5('0x46')]['id'];_0x52891a[_0xc9a5('0x57')](_0x1a1564[_0xc9a5('0x48')][_0x1e2ea3]);}return BPromise['each'](_0x52891a,function(_0x219232){return db[_0xc9a5('0x53')][_0xc9a5('0x47')](_[_0xc9a5('0x58')](_0x219232,[_0xc9a5('0x51'),'id'])||{},{'fields':_[_0xc9a5('0x29')](_0xe51fd5),'raw':!![]})['then'](function(_0x2abbc6){_0x209ef5['success'][_0xc9a5('0x57')](_0x2abbc6[_0xc9a5('0x59')]);})[_0xc9a5('0x44')](function(_0x71abd3){_0x209ef5[_0xc9a5('0x5a')][_0xc9a5('0x57')]({'data':_0x219232,'error':_0x71abd3[_0xc9a5('0x5b')]});});})[_0xc9a5('0x20')](function(_0x1c4aa2){return _0x209ef5;})['catch'](function(_0x3c10d2){return _0x3c10d2;});}else{_0x183082[_0xc9a5('0x16')](0x190)[_0xc9a5('0x17')]({'message':_0xc9a5('0x5c')});}});}})[_0xc9a5('0x20')](respondWithResult(_0x183082,null))['catch'](handleError(_0x183082,null));};exports[_0xc9a5('0x5d')]=function(_0x4bd2f7,_0x58482e,_0x5a7cee){var _0x3d3d81;return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x4bd2f7[_0xc9a5('0x46')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0xc9a5('0x20')](handleEntityNotFound(_0x58482e,null))['then'](function(_0x44b5a9){if(_0x44b5a9){_0x3d3d81=_0x44b5a9;return db['CmContact'][_0xc9a5('0x28')];}})['then'](function(_0x534155){if(_0x534155){var _0x31e263={};var _0x3d23bb={};_0x3d23bb['model']=_[_0xc9a5('0x5e')](_[_0xc9a5('0x29')](_0x534155),_[_0xc9a5('0x3d')](_0x3d3d81[_0xc9a5('0x5f')],function(_0x58cf6b){return util[_0xc9a5('0x60')](_0xc9a5('0x61'),_0x58cf6b['id']);}));_0x3d23bb[_0xc9a5('0x2a')]=_['keys'](_0x4bd2f7[_0xc9a5('0x2a')]);_0x3d23bb[_0xc9a5('0x2d')]=_[_0xc9a5('0x2e')](_0x3d23bb[_0xc9a5('0x2f')],_0x3d23bb[_0xc9a5('0x2a')]);_0x31e263[_0xc9a5('0x30')]=_[_0xc9a5('0x2e')](_0x3d23bb[_0xc9a5('0x2f')],qs[_0xc9a5('0x31')](_0x4bd2f7[_0xc9a5('0x2a')][_0xc9a5('0x31')]));_0x31e263[_0xc9a5('0x30')]=_0x31e263[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x31e263['attributes']:_0x3d23bb[_0xc9a5('0x2f')];if(!_0x4bd2f7[_0xc9a5('0x2a')]['hasOwnProperty'](_0xc9a5('0x34'))){_0x31e263['limit']=qs['limit'](_0x4bd2f7[_0xc9a5('0x2a')][_0xc9a5('0x1a')]);_0x31e263[_0xc9a5('0x19')]=qs[_0xc9a5('0x19')](_0x4bd2f7[_0xc9a5('0x2a')]['offset']);}_0x31e263[_0xc9a5('0x35')]=qs[_0xc9a5('0x36')](_0x4bd2f7[_0xc9a5('0x2a')]['sort']);_0x31e263[_0xc9a5('0x37')]=qs['filters'](_[_0xc9a5('0x38')](_0x4bd2f7[_0xc9a5('0x2a')],_0x3d23bb[_0xc9a5('0x2d')]));_0x31e263[_0xc9a5('0x62')]=!![];if(_0x4bd2f7['query'][_0xc9a5('0x3c')]){_0x31e263[_0xc9a5('0x37')]=_[_0xc9a5('0x3b')](_0x31e263[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x31e263['attributes'],function(_0x1242b0){var _0x5e4f82={};_0x5e4f82[_0x1242b0]={'$like':'%'+_0x4bd2f7['query']['filter']+'%'};return _0x5e4f82;})});}_0x31e263=_[_0xc9a5('0x3b')]({},_0x31e263,_0x4bd2f7[_0xc9a5('0x3e')]);return _0x3d3d81[_0xc9a5('0x5d')](_0x31e263);}})[_0xc9a5('0x20')](respondWithResult(_0x58482e,null))['catch'](handleError(_0x58482e,null));};exports[_0xc9a5('0x63')]=function(_0xbb7c49,_0xe5a3f6,_0x34d74d){var _0x428ec8;return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0xbb7c49[_0xc9a5('0x46')]['id']},'include':[{'model':db[_0xc9a5('0x64')],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0xe5a3f6,null))[_0xc9a5('0x20')](function(_0x4f3afd){if(_0x4f3afd){_0x428ec8=_0x4f3afd;return db[_0xc9a5('0x53')][_0xc9a5('0x28')];}})['then'](function(_0x5d4410){if(_0x5d4410){var _0x2935a9={};var _0x18f1d1={};_0x18f1d1[_0xc9a5('0x2f')]=_[_0xc9a5('0x5e')](_[_0xc9a5('0x29')](_0x5d4410),_[_0xc9a5('0x3d')](_0x428ec8[_0xc9a5('0x5f')],function(_0x14c54a){return util[_0xc9a5('0x60')](_0xc9a5('0x61'),_0x14c54a['id']);}));_0x18f1d1[_0xc9a5('0x2a')]=_[_0xc9a5('0x29')](_0xbb7c49['query']);_0x18f1d1[_0xc9a5('0x2d')]=_['intersection'](_0x18f1d1[_0xc9a5('0x2f')],_0x18f1d1[_0xc9a5('0x2a')]);_0x2935a9['attributes']=_[_0xc9a5('0x2e')](_0x18f1d1['model'],qs[_0xc9a5('0x31')](_0xbb7c49['query'][_0xc9a5('0x31')]));_0x2935a9[_0xc9a5('0x30')]=_0x2935a9[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x2935a9['attributes']:_0x18f1d1[_0xc9a5('0x2f')];if(!_0xbb7c49['query'][_0xc9a5('0x33')](_0xc9a5('0x34'))){_0x2935a9['limit']=qs[_0xc9a5('0x1a')](_0xbb7c49[_0xc9a5('0x2a')]['limit']);_0x2935a9[_0xc9a5('0x19')]=qs[_0xc9a5('0x19')](_0xbb7c49[_0xc9a5('0x2a')][_0xc9a5('0x19')]);}_0x2935a9[_0xc9a5('0x35')]=qs[_0xc9a5('0x36')](_0xbb7c49[_0xc9a5('0x2a')][_0xc9a5('0x36')]);_0x2935a9[_0xc9a5('0x37')]=qs[_0xc9a5('0x2d')](_[_0xc9a5('0x38')](_0xbb7c49['query'],_0x18f1d1[_0xc9a5('0x2d')]));_0x2935a9[_0xc9a5('0x62')]=!![];if(_0xbb7c49[_0xc9a5('0x2a')]['filter']){_0x2935a9[_0xc9a5('0x37')]=_[_0xc9a5('0x3b')](_0x2935a9[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x2935a9['attributes'],function(_0x3fa4ad){var _0x1bab01={};_0x1bab01[_0x3fa4ad]={'$like':'%'+_0xbb7c49[_0xc9a5('0x2a')][_0xc9a5('0x3c')]+'%'};return _0x1bab01;})});}_0x2935a9=_['merge']({},_0x2935a9,_0xbb7c49[_0xc9a5('0x3e')]);return _0x428ec8[_0xc9a5('0x5d')](_0x2935a9);}})['then'](function(_0x493939){if(!_['isEmpty'](_0x493939)){var _0x3b05d4=toCsv(_0x493939);var _0x32d47b=Date[_0xc9a5('0x65')]();fs['writeFileSync'](util['format'](_0xc9a5('0x66'),_0x428ec8['id'],_0x32d47b),_0x3b05d4);_0xe5a3f6[_0xc9a5('0x67')](_0xc9a5('0x68'),'attachment;\x20filename='+util[_0xc9a5('0x60')](_0xc9a5('0x69'),_0x428ec8['id'],_0x32d47b));_0xe5a3f6[_0xc9a5('0x67')](_0xc9a5('0x6a'),_0xc9a5('0x6b'));return _0xe5a3f6[_0xc9a5('0x6c')](util['format'](_0xc9a5('0x66'),_0x428ec8['id'],_0x32d47b));}else{return _0xe5a3f6['sendStatus'](0xcc);}})[_0xc9a5('0x44')](handleError(_0xe5a3f6,null));};exports[_0xc9a5('0x6d')]=function(_0x22a91e,_0x3cf6b5,_0x16ebcc){var _0xc312e;delete _0x22a91e[_0xc9a5('0x48')]['id'];return db['CmList'][_0xc9a5('0x4e')]({'where':{'id':_0x22a91e[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x3cf6b5,null))[_0xc9a5('0x20')](function(_0x4f6b16){if(_0x4f6b16){return db[_0xc9a5('0x6e')]['transaction'](function(_0xdabf6e){return db['CmCustomField']['create'](_0x22a91e[_0xc9a5('0x48')],{'transaction':_0xdabf6e})[_0xc9a5('0x20')](function(_0x4380a8){_0xc312e=_0x4380a8;return _0x4f6b16['addCustomFields'](_0x4380a8,{'transaction':_0xdabf6e});})['then'](function(){var _0x3688f0={'type':db[_0xc9a5('0x6f')][_0xc9a5('0x70')],'transaction':_0xdabf6e};switch(_0x22a91e[_0xc9a5('0x48')][_0xc9a5('0x71')]){case _0xc9a5('0x72'):_0x3688f0['type']=db[_0xc9a5('0x6f')][_0xc9a5('0x70')];break;case _0xc9a5('0x73'):_0x3688f0['type']=db[_0xc9a5('0x6f')][_0xc9a5('0x74')];break;case _0xc9a5('0x75'):_0x3688f0['type']=db[_0xc9a5('0x6f')][_0xc9a5('0x76')];_0x3688f0[_0xc9a5('0x77')]=![];break;default:}return db[_0xc9a5('0x6e')]['queryInterface']['addColumn'](_0xc9a5('0x78'),util[_0xc9a5('0x60')](_0xc9a5('0x79'),_0xc312e['id']),_0x3688f0);})[_0xc9a5('0x20')](function(){return _0xc312e;});});}})['then'](respondWithResult(_0x3cf6b5,null))['catch'](handleError(_0x3cf6b5,null));};exports[_0xc9a5('0x7a')]=function(_0x4964d6,_0x30b8bb,_0x3c298c){var _0x438083={};var _0x2c39d8={};var _0x212d8c;var _0x464a30;return db['CmList']['findOne']({'where':{'id':_0x4964d6[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x30b8bb,null))[_0xc9a5('0x20')](function(_0x279353){if(_0x279353){_0x212d8c=_0x279353;_0x2c39d8['model']=_[_0xc9a5('0x29')](db[_0xc9a5('0x64')]['rawAttributes']);_0x2c39d8[_0xc9a5('0x2a')]=_[_0xc9a5('0x29')](_0x4964d6[_0xc9a5('0x2a')]);_0x2c39d8[_0xc9a5('0x2d')]=_[_0xc9a5('0x2e')](_0x2c39d8['model'],_0x2c39d8['query']);_0x438083['attributes']=_[_0xc9a5('0x2e')](_0x2c39d8[_0xc9a5('0x2f')],qs['fields'](_0x4964d6['query'][_0xc9a5('0x31')]));_0x438083[_0xc9a5('0x30')]=_0x438083[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x438083[_0xc9a5('0x30')]:_0x2c39d8[_0xc9a5('0x2f')];_0x438083[_0xc9a5('0x35')]=qs[_0xc9a5('0x36')](_0x4964d6[_0xc9a5('0x2a')][_0xc9a5('0x36')]);_0x438083['where']=qs['filters'](_['pick'](_0x4964d6[_0xc9a5('0x2a')],_0x2c39d8[_0xc9a5('0x2d')]));_0x438083[_0xc9a5('0x37')]=_[_0xc9a5('0x3b')](_0x438083[_0xc9a5('0x37')],{'$or':[{'ListId':_0x279353['id']},{'ListId':null}]});if(_0x4964d6[_0xc9a5('0x2a')][_0xc9a5('0x3c')]){_0x438083[_0xc9a5('0x37')]=_[_0xc9a5('0x3b')](_0x438083[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x438083['attributes'],function(_0x42cbb4){var _0x41f617={};_0x41f617[_0x42cbb4]={'$like':'%'+_0x4964d6[_0xc9a5('0x2a')][_0xc9a5('0x3c')]+'%'};return _0x41f617;})});}_0x438083=_[_0xc9a5('0x3b')]({},_0x438083,_0x4964d6[_0xc9a5('0x3e')]);return db[_0xc9a5('0x64')]['findAndCountAll'](_0x438083);}})[_0xc9a5('0x20')](respondWithResult(_0x30b8bb,null))[_0xc9a5('0x44')](handleError(_0x30b8bb,null));};exports[_0xc9a5('0x7b')]=function(_0x37fed2,_0x2782bb,_0x46ed05){return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x37fed2['params']['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x2782bb,null))[_0xc9a5('0x20')](function(_0x491d47){if(_0x491d47){return _0x491d47[_0xc9a5('0x7b')](_0x37fed2[_0xc9a5('0x48')]['ids'],_['omit'](_0x37fed2[_0xc9a5('0x48')],[_0xc9a5('0x51'),'id'])||{})['spread'](function(_0x16ce4d){for(var _0x4bb87e=0x0;_0x4bb87e<_0x37fed2[_0xc9a5('0x48')][_0xc9a5('0x51')][_0xc9a5('0x32')];_0x4bb87e+=0x1){socket[_0xc9a5('0x7c')](_0xc9a5('0x7d'),{'UserId':_0x37fed2[_0xc9a5('0x48')][_0xc9a5('0x51')][_0x4bb87e],'CmListId':_0x37fed2[_0xc9a5('0x46')]['id']});}return _0x16ce4d;});}})[_0xc9a5('0x20')](respondWithResult(_0x2782bb,null))[_0xc9a5('0x44')](handleError(_0x2782bb,null));};exports['removeAgents']=function(_0x24cffc,_0x52f168,_0x12f3c3){var _0x5902cd;return db[_0xc9a5('0x3f')][_0xc9a5('0x49')]({'where':{'id':_0x24cffc[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x52f168,null))[_0xc9a5('0x20')](function(_0x41cfec){if(_0x41cfec){return _0x41cfec[_0xc9a5('0x7e')](_0x24cffc['query'][_0xc9a5('0x51')])[_0xc9a5('0x20')](function(_0x352cae){if(_[_0xc9a5('0x55')](_0x24cffc['query'][_0xc9a5('0x51')])){for(var _0x176302=0x0;_0x176302<_0x24cffc['query'][_0xc9a5('0x51')]['length'];_0x176302+=0x1){socket[_0xc9a5('0x7c')](_0xc9a5('0x7f'),{'UserId':_0x24cffc[_0xc9a5('0x2a')]['ids'][_0x176302],'CmListId':_0x24cffc[_0xc9a5('0x46')]['id']});}}else{socket[_0xc9a5('0x7c')](_0xc9a5('0x7f'),{'UserId':_0x24cffc['query'][_0xc9a5('0x51')],'CmListId':_0x24cffc[_0xc9a5('0x46')]['id']});}});}})[_0xc9a5('0x20')](respondWithStatusCode(_0x52f168,null))[_0xc9a5('0x44')](handleError(_0x52f168,null));};exports[_0xc9a5('0x80')]=function(_0x152bac,_0x11b9ec,_0x155614){var _0x57a2c7={};var _0x4ebac2={};var _0x506aa3;var _0x369dea;return db[_0xc9a5('0x3f')][_0xc9a5('0x4e')]({'where':{'id':_0x152bac[_0xc9a5('0x46')]['id']}})[_0xc9a5('0x20')](handleEntityNotFound(_0x11b9ec,null))[_0xc9a5('0x20')](function(_0x1048ee){if(_0x1048ee){_0x506aa3=_0x1048ee;_0x4ebac2[_0xc9a5('0x2f')]=_[_0xc9a5('0x29')](db[_0xc9a5('0x81')][_0xc9a5('0x28')]);_0x4ebac2['query']=_[_0xc9a5('0x29')](_0x152bac[_0xc9a5('0x2a')]);_0x4ebac2['filters']=_[_0xc9a5('0x2e')](_0x4ebac2[_0xc9a5('0x2f')],_0x4ebac2['query']);_0x57a2c7[_0xc9a5('0x30')]=_[_0xc9a5('0x2e')](_0x4ebac2[_0xc9a5('0x2f')],qs[_0xc9a5('0x31')](_0x152bac['query'][_0xc9a5('0x31')]));_0x57a2c7['attributes']=_0x57a2c7[_0xc9a5('0x30')][_0xc9a5('0x32')]?_0x57a2c7['attributes']:_0x4ebac2[_0xc9a5('0x2f')];_0x57a2c7[_0xc9a5('0x35')]=qs[_0xc9a5('0x36')](_0x152bac[_0xc9a5('0x2a')][_0xc9a5('0x36')]);_0x57a2c7['where']=qs[_0xc9a5('0x2d')](_[_0xc9a5('0x38')](_0x152bac['query'],_0x4ebac2[_0xc9a5('0x2d')]));if(_0x152bac[_0xc9a5('0x2a')][_0xc9a5('0x3c')]){_0x57a2c7[_0xc9a5('0x37')]=_['merge'](_0x57a2c7[_0xc9a5('0x37')],{'$or':_[_0xc9a5('0x3d')](_0x57a2c7[_0xc9a5('0x30')],function(_0x9fe496){var _0x4f9771={};_0x4f9771[_0x9fe496]={'$like':'%'+_0x152bac[_0xc9a5('0x2a')]['filter']+'%'};return _0x4f9771;})});}_0x57a2c7=_[_0xc9a5('0x3b')]({},_0x57a2c7,_0x152bac['options']);return _0x506aa3['getAgents'](_0x57a2c7);}})[_0xc9a5('0x20')](function(_0x4946aa){if(_0x4946aa){_0x369dea=_0x4946aa['length'];if(!_0x152bac[_0xc9a5('0x2a')]['hasOwnProperty'](_0xc9a5('0x34'))){_0x57a2c7[_0xc9a5('0x1a')]=qs['limit'](_0x152bac[_0xc9a5('0x2a')][_0xc9a5('0x1a')]);_0x57a2c7[_0xc9a5('0x19')]=qs['offset'](_0x152bac[_0xc9a5('0x2a')][_0xc9a5('0x19')]);}return _0x506aa3[_0xc9a5('0x80')](_0x57a2c7);}})[_0xc9a5('0x20')](function(_0x39f8e5){if(_0x39f8e5){return _0x39f8e5?{'count':_0x369dea,'rows':_0x39f8e5}:null;}})[_0xc9a5('0x20')](respondWithResult(_0x11b9ec,null))[_0xc9a5('0x44')](handleError(_0x11b9ec,null));}; \ No newline at end of file +var _0x9a0d=['bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','destroy','then','name','send','index','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','CmList','includeAll','catch','show','params','include','create','body','update','find','describe','addDisposition','Disposition','getDispositions','findOne','pick','ListId','rows','removeDispositions','CmContact','tags','isArray','join','push','omit','ids','dataValues','errors','message','getContacts','CmCustomField','CustomFields','rawAttributes','concat','format','cf_%d','raw','getContactsCsv','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','text/csv','download','addCustomField','sequelize','transaction','Sequelize','TEXT','type','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','addAgents','removeAgents','userCmList:remove','getAgents','fast-json-patch','moment'];(function(_0x3e251b,_0x159cc2){var _0x3b2957=function(_0x419dfe){while(--_0x419dfe){_0x3e251b['push'](_0x3e251b['shift']());}};_0x3b2957(++_0x159cc2);}(_0x9a0d,0x1ee));var _0xd9a0=function(_0x1c1509,_0x2dfa81){_0x1c1509=_0x1c1509-0x0;var _0xf11b7=_0x9a0d[_0x1c1509];return _0xf11b7;};'use strict';var jsonpatch=require(_0xd9a0('0x0'));var rp=require('request-promise');var moment=require(_0xd9a0('0x1'));var BPromise=require(_0xd9a0('0x2'));var Mustache=require(_0xd9a0('0x3'));var util=require(_0xd9a0('0x4'));var path=require(_0xd9a0('0x5'));var sox=require(_0xd9a0('0x6'));var csv=require(_0xd9a0('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd9a0('0x8'));var squel=require(_0xd9a0('0x9'));var crypto=require(_0xd9a0('0xa'));var jsforce=require(_0xd9a0('0xb'));var deskjs=require(_0xd9a0('0xc'));var toCsv=require(_0xd9a0('0x7'));var querystring=require(_0xd9a0('0xd'));var Papa=require(_0xd9a0('0xe'));var qs=require(_0xd9a0('0xf'));var logger=require(_0xd9a0('0x10'))('api');var utils=require(_0xd9a0('0x11'));var config=require(_0xd9a0('0x12'));var db=require(_0xd9a0('0x13'))['db'];var socket=require(_0xd9a0('0x14'))({'host':_0xd9a0('0x15'),'port':0x18eb});require('./cmList.socket')[_0xd9a0('0x16')](socket);function respondWithStatusCode(_0x482557,_0x50536c){_0x50536c=_0x50536c||0xcc;return function(_0x37e300){if(_0x37e300){return _0x482557[_0xd9a0('0x17')](_0x50536c);}return _0x482557[_0xd9a0('0x18')](_0x50536c)['end']();};}function respondWithResult(_0x4d7c8a,_0x302a08){_0x302a08=_0x302a08||0xc8;return function(_0x16a4b0){if(_0x16a4b0){return _0x4d7c8a[_0xd9a0('0x18')](_0x302a08)[_0xd9a0('0x19')](_0x16a4b0);}};}function respondWithFilteredResult(_0x221d93,_0x2311bf){return function(_0x1c0009){if(_0x1c0009){var _0x1c016a=_0x1c0009[_0xd9a0('0x1a')],_0x287237=_0x2311bf[_0xd9a0('0x1b')],_0x155d74=_0x2311bf[_0xd9a0('0x1b')]+_0x2311bf[_0xd9a0('0x1c')],_0xaa5fa7;if(_0x155d74>=_0x1c016a){_0x155d74=_0x1c016a;_0xaa5fa7=0xc8;}else{_0xaa5fa7=0xce;}_0x221d93['status'](_0xaa5fa7);return _0x221d93['set'](_0xd9a0('0x1d'),_0x287237+'-'+_0x155d74+'/'+_0x1c016a)[_0xd9a0('0x19')](_0x1c0009);}return null;};}function patchUpdates(_0x3448f2){return function(_0x70720d){try{jsonpatch['apply'](_0x70720d,_0x3448f2,!![]);}catch(_0x150129){return BPromise[_0xd9a0('0x1e')](_0x150129);}return _0x70720d[_0xd9a0('0x1f')]();};}function saveUpdates(_0x519df7,_0x104899){return function(_0x3effbe){if(_0x3effbe){return _0x3effbe['update'](_0x519df7)['then'](function(_0x5400ef){return _0x5400ef;});}return null;};}function removeEntity(_0x5c8de4,_0x401877){return function(_0x282350){if(_0x282350){return _0x282350[_0xd9a0('0x20')]()[_0xd9a0('0x21')](function(){_0x5c8de4[_0xd9a0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a76f2,_0x577e15){return function(_0x2e22ef){if(!_0x2e22ef){_0x3a76f2[_0xd9a0('0x17')](0x194);}return _0x2e22ef;};}function handleError(_0x2d3248,_0x14caea){_0x14caea=_0x14caea||0x1f4;return function(_0x34ef20){logger['error'](_0x34ef20['stack']);if(_0x34ef20[_0xd9a0('0x22')]){delete _0x34ef20[_0xd9a0('0x22')];}_0x2d3248['status'](_0x14caea)[_0xd9a0('0x23')](_0x34ef20);};}exports[_0xd9a0('0x24')]=function(_0x25d5e7,_0x3ded1d){var _0x40267f={},_0x37c7ed={},_0x589d12={'count':0x0,'rows':[]};var _0x2e6f4e=db['CmList']['rawAttributes'];_0x37c7ed[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](_0x2e6f4e);var _0x18a1b1={'dateStart':_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x28')],'dateEnd':_0x25d5e7['query'][_0xd9a0('0x29')]};delete _0x25d5e7['query'][_0xd9a0('0x28')];delete _0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x29')];_0x37c7ed[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x25d5e7[_0xd9a0('0x27')]);_0x37c7ed[_0xd9a0('0x2a')]=_['intersection'](_0x37c7ed['model'],_0x37c7ed[_0xd9a0('0x27')]);_0x40267f[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x37c7ed[_0xd9a0('0x25')],qs['fields'](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x40267f[_0xd9a0('0x2b')]=_0x40267f[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x40267f[_0xd9a0('0x2b')]:_0x37c7ed['model'];if(!_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x40267f[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x40267f['offset']=qs['offset'](_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x40267f[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x25d5e7[_0xd9a0('0x27')]['sort']);_0x40267f['where']=qs[_0xd9a0('0x2a')](_['pick'](_0x25d5e7[_0xd9a0('0x27')],_0x37c7ed['filters']));if(_0x18a1b1['dateStart']){if(_0x18a1b1['dateEnd']){_0x18a1b1['dateEnd']=moment(_0x18a1b1[_0xd9a0('0x29')])[_0xd9a0('0x33')](0x1,_0xd9a0('0x34'));}else{_0x18a1b1['dateEnd']=moment(_0x18a1b1[_0xd9a0('0x28')])[_0xd9a0('0x33')](0x1,_0xd9a0('0x34'));}_[_0xd9a0('0x35')](_0x40267f[_0xd9a0('0x36')],{'createdAt':{'$gte':_0x18a1b1[_0xd9a0('0x28')],'$lte':_0x18a1b1['dateEnd']}});}if(_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x40267f[_0xd9a0('0x36')]=_['merge'](_0x40267f[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x40267f[_0xd9a0('0x2b')],function(_0x160d83){var _0x30c879={};_0x30c879[_0x160d83]={'$like':'%'+_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x30c879;})});}_0x40267f=_['merge']({},_0x40267f,_0x25d5e7[_0xd9a0('0x39')]);var _0x4baa10={'where':_0x40267f['where']};return db[_0xd9a0('0x3a')][_0xd9a0('0x1a')](_0x4baa10)[_0xd9a0('0x21')](function(_0x2e83fd){_0x589d12[_0xd9a0('0x1a')]=_0x2e83fd;if(_0x25d5e7[_0xd9a0('0x27')][_0xd9a0('0x3b')]){_0x40267f['include']=[{'all':!![]}];}return db[_0xd9a0('0x3a')]['findAll'](_0x40267f);})[_0xd9a0('0x21')](function(_0x2618e2){_0x589d12['rows']=_0x2618e2;return _0x589d12;})[_0xd9a0('0x21')](respondWithFilteredResult(_0x3ded1d,_0x40267f))[_0xd9a0('0x3c')](handleError(_0x3ded1d,null));};exports[_0xd9a0('0x3d')]=function(_0x263dea,_0x510ec7){var _0x210053={'raw':![],'where':{'id':_0x263dea[_0xd9a0('0x3e')]['id']}},_0x3a0ff5={};_0x3a0ff5[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x3a')]['rawAttributes']);_0x3a0ff5[_0xd9a0('0x27')]=_['keys'](_0x263dea[_0xd9a0('0x27')]);_0x3a0ff5[_0xd9a0('0x2a')]=_['intersection'](_0x3a0ff5['model'],_0x3a0ff5[_0xd9a0('0x27')]);_0x210053[_0xd9a0('0x2b')]=_['intersection'](_0x3a0ff5[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x263dea[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x210053['attributes']=_0x210053['attributes'][_0xd9a0('0x2e')]?_0x210053[_0xd9a0('0x2b')]:_0x3a0ff5['model'];if(_0x263dea[_0xd9a0('0x27')][_0xd9a0('0x3b')]){_0x210053[_0xd9a0('0x3f')]=[{'all':!![]}];}_0x210053=_[_0xd9a0('0x35')]({},_0x210053,_0x263dea[_0xd9a0('0x39')]);return db[_0xd9a0('0x3a')]['find'](_0x210053)[_0xd9a0('0x21')](handleEntityNotFound(_0x510ec7,null))[_0xd9a0('0x21')](respondWithResult(_0x510ec7,null))['catch'](handleError(_0x510ec7,null));};exports[_0xd9a0('0x40')]=function(_0x1ce1dd,_0x5a513f){return db[_0xd9a0('0x3a')]['create'](_0x1ce1dd[_0xd9a0('0x41')],{})[_0xd9a0('0x21')](respondWithResult(_0x5a513f,0xc9))[_0xd9a0('0x3c')](handleError(_0x5a513f,null));};exports[_0xd9a0('0x42')]=function(_0x164349,_0x35be58){if(_0x164349[_0xd9a0('0x41')]['id']){delete _0x164349[_0xd9a0('0x41')]['id'];}return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x164349[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x35be58,null))[_0xd9a0('0x21')](saveUpdates(_0x164349[_0xd9a0('0x41')],null))['then'](respondWithResult(_0x35be58,null))[_0xd9a0('0x3c')](handleError(_0x35be58,null));};exports[_0xd9a0('0x20')]=function(_0x13cbe9,_0x4bf191){return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x13cbe9['params']['id']}})['then'](handleEntityNotFound(_0x4bf191,null))['then'](removeEntity(_0x4bf191,null))['catch'](handleError(_0x4bf191,null));};exports[_0xd9a0('0x44')]=function(_0x558db8,_0x607bcd){return db['CmList'][_0xd9a0('0x44')]()[_0xd9a0('0x21')](respondWithResult(_0x607bcd,null))[_0xd9a0('0x3c')](handleError(_0x607bcd,null));};exports[_0xd9a0('0x45')]=function(_0x393b09,_0xdc9327,_0x253b10){if(_0x393b09['body']['id']){delete _0x393b09[_0xd9a0('0x41')]['id'];}return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x393b09['params']['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0xdc9327,null))['then'](function(_0x13fe85){if(_0x13fe85){_0x393b09[_0xd9a0('0x41')]['ListId']=_0x13fe85['id'];return db[_0xd9a0('0x46')][_0xd9a0('0x40')](_0x393b09[_0xd9a0('0x41')]);}})[_0xd9a0('0x21')](respondWithResult(_0xdc9327,null))[_0xd9a0('0x3c')](handleError(_0xdc9327,null));};exports[_0xd9a0('0x47')]=function(_0x5e3713,_0x5e0f1e,_0x7bc100){var _0x2f34de={'raw':![],'where':{}};var _0x53eb0c={};var _0x36276a={'count':0x0,'rows':[]};return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x5e3713[_0xd9a0('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5e0f1e,null))[_0xd9a0('0x21')](function(_0xc5cc6b){if(_0xc5cc6b){_0x53eb0c[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x46')]['rawAttributes']);_0x53eb0c[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x5e3713['query']);_0x53eb0c[_0xd9a0('0x2a')]=_['intersection'](_0x53eb0c[_0xd9a0('0x25')],_0x53eb0c[_0xd9a0('0x27')]);_0x2f34de['attributes']=_[_0xd9a0('0x2c')](_0x53eb0c[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x2f34de[_0xd9a0('0x2b')]=_0x2f34de[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x2f34de[_0xd9a0('0x2b')]:_0x53eb0c[_0xd9a0('0x25')];if(!_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x2f34de[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x5e3713['query'][_0xd9a0('0x1c')]);_0x2f34de[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x2f34de[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x5e3713['query']['sort']);_0x2f34de[_0xd9a0('0x36')]=qs[_0xd9a0('0x2a')](_[_0xd9a0('0x49')](_0x5e3713[_0xd9a0('0x27')],_0x53eb0c[_0xd9a0('0x2a')]));_0x2f34de[_0xd9a0('0x36')][_0xd9a0('0x4a')]=_0xc5cc6b['id'];if(_0x5e3713[_0xd9a0('0x27')]['filter']){_0x2f34de[_0xd9a0('0x36')]=_['merge'](_0x2f34de[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x2f34de['attributes'],function(_0x3e58e1){var _0x24c72c={};_0x24c72c[_0x3e58e1]={'$like':'%'+_0x5e3713[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x24c72c;})});}_0x2f34de=_[_0xd9a0('0x35')]({},_0x2f34de,_0x5e3713[_0xd9a0('0x39')]);return db[_0xd9a0('0x46')][_0xd9a0('0x1a')]({'where':_0x2f34de[_0xd9a0('0x36')]})['then'](function(_0x466417){_0x36276a['count']=_0x466417;if(_0x5e3713['query'][_0xd9a0('0x3b')]){_0x2f34de[_0xd9a0('0x3f')]=[{'all':!![]}];}return db[_0xd9a0('0x46')]['findAll'](_0x2f34de);})['then'](function(_0x514b45){_0x36276a[_0xd9a0('0x4b')]=_0x514b45;return _0x36276a;});}})['then'](respondWithFilteredResult(_0x5e0f1e,_0x2f34de))[_0xd9a0('0x3c')](handleError(_0x5e0f1e,null));};exports[_0xd9a0('0x4c')]=function(_0x42d72c,_0x372e89,_0x6e05ba){var _0x1edd4a;return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x42d72c['params']['id']}})['then'](handleEntityNotFound(_0x372e89,null))[_0xd9a0('0x21')](function(_0x155a6d){if(_0x155a6d){return _0x155a6d[_0xd9a0('0x4c')](_0x42d72c[_0xd9a0('0x27')]['ids']);}})[_0xd9a0('0x21')](respondWithStatusCode(_0x372e89,null))['catch'](handleError(_0x372e89,null));};exports['addContacts']=function(_0x2029f3,_0x274845,_0x49fa91){return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x2029f3[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x274845,null))[_0xd9a0('0x21')](function(_0x423279){if(_0x423279){var _0x217730=[];var _0xc2eb26={'success':[],'errors':[]};return db[_0xd9a0('0x4d')]['describe']()[_0xd9a0('0x21')](function(_0x2982ff){if(_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]&&_[_0xd9a0('0x4f')](_0x2029f3[_0xd9a0('0x41')]['tags'])){if(_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]['length']){_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')]=_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x4e')][_0xd9a0('0x50')](';')+';';}else{_0x2029f3[_0xd9a0('0x41')]['tags']=null;}}else{_0x2029f3['body'][_0xd9a0('0x4e')]=null;}if(_0x2029f3['body']&&_[_0xd9a0('0x4f')](_0x2029f3[_0xd9a0('0x41')])){for(var _0x1161be=0x0;_0x1161be<_0x2029f3[_0xd9a0('0x41')][_0xd9a0('0x2e')];_0x1161be+=0x1){_0x2029f3[_0xd9a0('0x41')][_0x1161be][_0xd9a0('0x4a')]=_0x2029f3[_0xd9a0('0x3e')]['id'];_0x217730[_0xd9a0('0x51')](_0x2029f3[_0xd9a0('0x41')][_0x1161be]);}return BPromise['each'](_0x217730,function(_0x455a81){return db[_0xd9a0('0x4d')][_0xd9a0('0x40')](_[_0xd9a0('0x52')](_0x455a81,[_0xd9a0('0x53'),'id'])||{},{'fields':_[_0xd9a0('0x26')](_0x2982ff),'raw':!![]})['then'](function(_0x2851f0){_0xc2eb26['success'][_0xd9a0('0x51')](_0x2851f0[_0xd9a0('0x54')]);})['catch'](function(_0x498c08){_0xc2eb26[_0xd9a0('0x55')][_0xd9a0('0x51')]({'data':_0x455a81,'error':_0x498c08[_0xd9a0('0x56')]});});})[_0xd9a0('0x21')](function(_0x4ab580){return _0xc2eb26;})[_0xd9a0('0x3c')](function(_0x44299a){return _0x44299a;});}else{_0x274845['status'](0x190)[_0xd9a0('0x19')]({'message':'Malformed\x20request\x20syntax'});}});}})['then'](respondWithResult(_0x274845,null))[_0xd9a0('0x3c')](handleError(_0x274845,null));};exports[_0xd9a0('0x57')]=function(_0x56d32e,_0x346076,_0x348d58){var _0x3bd347;return db[_0xd9a0('0x3a')][_0xd9a0('0x43')]({'where':{'id':_0x56d32e['params']['id']},'include':[{'model':db[_0xd9a0('0x58')],'as':_0xd9a0('0x59')}]})[_0xd9a0('0x21')](handleEntityNotFound(_0x346076,null))['then'](function(_0x138578){if(_0x138578){_0x3bd347=_0x138578;return db['CmContact'][_0xd9a0('0x5a')];}})[_0xd9a0('0x21')](function(_0x49e1e7){if(_0x49e1e7){var _0x541742={};var _0x234bdc={};_0x234bdc['model']=_[_0xd9a0('0x5b')](_['keys'](_0x49e1e7),_[_0xd9a0('0x38')](_0x3bd347[_0xd9a0('0x59')],function(_0x8e6020){return util[_0xd9a0('0x5c')](_0xd9a0('0x5d'),_0x8e6020['id']);}));_0x234bdc['query']=_['keys'](_0x56d32e[_0xd9a0('0x27')]);_0x234bdc[_0xd9a0('0x2a')]=_[_0xd9a0('0x2c')](_0x234bdc[_0xd9a0('0x25')],_0x234bdc['query']);_0x541742[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x234bdc['model'],qs[_0xd9a0('0x2d')](_0x56d32e['query'][_0xd9a0('0x2d')]));_0x541742[_0xd9a0('0x2b')]=_0x541742[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x541742['attributes']:_0x234bdc['model'];if(!_0x56d32e[_0xd9a0('0x27')]['hasOwnProperty']('nolimit')){_0x541742['limit']=qs[_0xd9a0('0x1c')](_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x541742['offset']=qs['offset'](_0x56d32e[_0xd9a0('0x27')]['offset']);}_0x541742['order']=qs[_0xd9a0('0x32')](_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x32')]);_0x541742[_0xd9a0('0x36')]=qs['filters'](_['pick'](_0x56d32e['query'],_0x234bdc[_0xd9a0('0x2a')]));_0x541742[_0xd9a0('0x5e')]=!![];if(_0x56d32e[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x541742[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0x541742['where'],{'$or':_[_0xd9a0('0x38')](_0x541742[_0xd9a0('0x2b')],function(_0x17071c){var _0x327252={};_0x327252[_0x17071c]={'$like':'%'+_0x56d32e[_0xd9a0('0x27')]['filter']+'%'};return _0x327252;})});}_0x541742=_[_0xd9a0('0x35')]({},_0x541742,_0x56d32e['options']);return _0x3bd347[_0xd9a0('0x57')](_0x541742);}})[_0xd9a0('0x21')](respondWithResult(_0x346076,null))[_0xd9a0('0x3c')](handleError(_0x346076,null));};exports[_0xd9a0('0x5f')]=function(_0xa9a34e,_0x1779c2,_0xf9a85f){var _0x21d5b0;return db['CmList'][_0xd9a0('0x43')]({'where':{'id':_0xa9a34e[_0xd9a0('0x3e')]['id']},'include':[{'model':db[_0xd9a0('0x58')],'as':_0xd9a0('0x59')}]})[_0xd9a0('0x21')](handleEntityNotFound(_0x1779c2,null))[_0xd9a0('0x21')](function(_0x4ee8c7){if(_0x4ee8c7){_0x21d5b0=_0x4ee8c7;return db[_0xd9a0('0x4d')][_0xd9a0('0x5a')];}})['then'](function(_0x51310d){if(_0x51310d){var _0x51ce60={};var _0x42c7a6={};_0x42c7a6[_0xd9a0('0x25')]=_[_0xd9a0('0x5b')](_['keys'](_0x51310d),_['map'](_0x21d5b0['CustomFields'],function(_0x30e170){return util['format'](_0xd9a0('0x5d'),_0x30e170['id']);}));_0x42c7a6[_0xd9a0('0x27')]=_['keys'](_0xa9a34e['query']);_0x42c7a6[_0xd9a0('0x2a')]=_[_0xd9a0('0x2c')](_0x42c7a6[_0xd9a0('0x25')],_0x42c7a6['query']);_0x51ce60['attributes']=_[_0xd9a0('0x2c')](_0x42c7a6['model'],qs['fields'](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0x51ce60[_0xd9a0('0x2b')]=_0x51ce60[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0x51ce60['attributes']:_0x42c7a6[_0xd9a0('0x25')];if(!_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x2f')](_0xd9a0('0x30'))){_0x51ce60[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0x51ce60[_0xd9a0('0x1b')]=qs['offset'](_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}_0x51ce60[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0xa9a34e['query']['sort']);_0x51ce60[_0xd9a0('0x36')]=qs[_0xd9a0('0x2a')](_[_0xd9a0('0x49')](_0xa9a34e[_0xd9a0('0x27')],_0x42c7a6[_0xd9a0('0x2a')]));_0x51ce60[_0xd9a0('0x5e')]=!![];if(_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0x51ce60[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0x51ce60[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0x51ce60[_0xd9a0('0x2b')],function(_0x2f5dc0){var _0x139bcb={};_0x139bcb[_0x2f5dc0]={'$like':'%'+_0xa9a34e[_0xd9a0('0x27')][_0xd9a0('0x37')]+'%'};return _0x139bcb;})});}_0x51ce60=_[_0xd9a0('0x35')]({},_0x51ce60,_0xa9a34e[_0xd9a0('0x39')]);return _0x21d5b0[_0xd9a0('0x57')](_0x51ce60);}})[_0xd9a0('0x21')](function(_0x54e278){if(!_[_0xd9a0('0x60')](_0x54e278)){var _0x54fc01=toCsv(_0x54e278);var _0x27b7dc=Date['now']();fs[_0xd9a0('0x61')](util[_0xd9a0('0x5c')](_0xd9a0('0x62'),_0x21d5b0['id'],_0x27b7dc),_0x54fc01);_0x1779c2['setHeader'](_0xd9a0('0x63'),_0xd9a0('0x64')+util['format'](_0xd9a0('0x65'),_0x21d5b0['id'],_0x27b7dc));_0x1779c2[_0xd9a0('0x66')](_0xd9a0('0x67'),_0xd9a0('0x68'));return _0x1779c2[_0xd9a0('0x69')](util[_0xd9a0('0x5c')]('/tmp/list_%d_%s.csv',_0x21d5b0['id'],_0x27b7dc));}else{return _0x1779c2['sendStatus'](0xcc);}})[_0xd9a0('0x3c')](handleError(_0x1779c2,null));};exports[_0xd9a0('0x6a')]=function(_0x57658f,_0x2332c3,_0x5eb4fb){var _0x1251cf;delete _0x57658f[_0xd9a0('0x41')]['id'];return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x57658f[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x2332c3,null))[_0xd9a0('0x21')](function(_0x514a67){if(_0x514a67){return db[_0xd9a0('0x6b')][_0xd9a0('0x6c')](function(_0xd0168e){return db[_0xd9a0('0x58')][_0xd9a0('0x40')](_0x57658f['body'],{'transaction':_0xd0168e})[_0xd9a0('0x21')](function(_0xac1f0d){_0x1251cf=_0xac1f0d;return _0x514a67['addCustomFields'](_0xac1f0d,{'transaction':_0xd0168e});})[_0xd9a0('0x21')](function(){var _0x4ca885={'type':db[_0xd9a0('0x6d')][_0xd9a0('0x6e')],'transaction':_0xd0168e};switch(_0x57658f[_0xd9a0('0x41')][_0xd9a0('0x6f')]){case _0xd9a0('0x70'):_0x4ca885['type']=db[_0xd9a0('0x6d')][_0xd9a0('0x6e')];break;case'number':_0x4ca885[_0xd9a0('0x6f')]=db[_0xd9a0('0x6d')][_0xd9a0('0x71')];break;case _0xd9a0('0x72'):_0x4ca885[_0xd9a0('0x6f')]=db['Sequelize'][_0xd9a0('0x73')];_0x4ca885[_0xd9a0('0x74')]=![];break;default:}return db['sequelize'][_0xd9a0('0x75')][_0xd9a0('0x76')](_0xd9a0('0x77'),util[_0xd9a0('0x5c')]('cf_%s',_0x1251cf['id']),_0x4ca885);})[_0xd9a0('0x21')](function(){return _0x1251cf;});});}})['then'](respondWithResult(_0x2332c3,null))['catch'](handleError(_0x2332c3,null));};exports['getCustomFields']=function(_0x6823e0,_0x5b8f78,_0x48cc5e){var _0xa6eb5d={};var _0x405eb4={};var _0x3e01c5;var _0x53a801;return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x6823e0[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x5b8f78,null))[_0xd9a0('0x21')](function(_0x2f5fc0){if(_0x2f5fc0){_0x3e01c5=_0x2f5fc0;_0x405eb4[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db[_0xd9a0('0x58')]['rawAttributes']);_0x405eb4[_0xd9a0('0x27')]=_[_0xd9a0('0x26')](_0x6823e0['query']);_0x405eb4['filters']=_[_0xd9a0('0x2c')](_0x405eb4['model'],_0x405eb4['query']);_0xa6eb5d[_0xd9a0('0x2b')]=_['intersection'](_0x405eb4[_0xd9a0('0x25')],qs[_0xd9a0('0x2d')](_0x6823e0[_0xd9a0('0x27')][_0xd9a0('0x2d')]));_0xa6eb5d['attributes']=_0xa6eb5d[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0xa6eb5d[_0xd9a0('0x2b')]:_0x405eb4[_0xd9a0('0x25')];_0xa6eb5d['order']=qs[_0xd9a0('0x32')](_0x6823e0[_0xd9a0('0x27')]['sort']);_0xa6eb5d[_0xd9a0('0x36')]=qs['filters'](_[_0xd9a0('0x49')](_0x6823e0[_0xd9a0('0x27')],_0x405eb4[_0xd9a0('0x2a')]));_0xa6eb5d[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0xa6eb5d[_0xd9a0('0x36')],{'$or':[{'ListId':_0x2f5fc0['id']},{'ListId':null}]});if(_0x6823e0[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0xa6eb5d[_0xd9a0('0x36')]=_[_0xd9a0('0x35')](_0xa6eb5d[_0xd9a0('0x36')],{'$or':_['map'](_0xa6eb5d[_0xd9a0('0x2b')],function(_0x8122f2){var _0x160632={};_0x160632[_0x8122f2]={'$like':'%'+_0x6823e0[_0xd9a0('0x27')]['filter']+'%'};return _0x160632;})});}_0xa6eb5d=_[_0xd9a0('0x35')]({},_0xa6eb5d,_0x6823e0['options']);return db['CmCustomField']['findAndCountAll'](_0xa6eb5d);}})['then'](respondWithResult(_0x5b8f78,null))[_0xd9a0('0x3c')](handleError(_0x5b8f78,null));};exports['addAgents']=function(_0x42a436,_0x5344d6,_0x5eff3b){return db[_0xd9a0('0x3a')]['find']({'where':{'id':_0x42a436[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x5344d6,null))[_0xd9a0('0x21')](function(_0x505fb9){if(_0x505fb9){return _0x505fb9[_0xd9a0('0x78')](_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')],_[_0xd9a0('0x52')](_0x42a436[_0xd9a0('0x41')],[_0xd9a0('0x53'),'id'])||{})['spread'](function(_0x48b2cc){for(var _0x466cd3=0x0;_0x466cd3<_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')]['length'];_0x466cd3+=0x1){socket['emit']('userCmList:save',{'UserId':_0x42a436[_0xd9a0('0x41')][_0xd9a0('0x53')][_0x466cd3],'CmListId':_0x42a436[_0xd9a0('0x3e')]['id']});}return _0x48b2cc;});}})[_0xd9a0('0x21')](respondWithResult(_0x5344d6,null))[_0xd9a0('0x3c')](handleError(_0x5344d6,null));};exports['removeAgents']=function(_0x2685c4,_0x4fa7bc,_0x18ae2b){var _0x4d29a1;return db['CmList'][_0xd9a0('0x43')]({'where':{'id':_0x2685c4[_0xd9a0('0x3e')]['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x4fa7bc,null))[_0xd9a0('0x21')](function(_0x44edfe){if(_0x44edfe){return _0x44edfe[_0xd9a0('0x79')](_0x2685c4[_0xd9a0('0x27')]['ids'])[_0xd9a0('0x21')](function(_0x4dbebd){if(_[_0xd9a0('0x4f')](_0x2685c4[_0xd9a0('0x27')][_0xd9a0('0x53')])){for(var _0x5214b6=0x0;_0x5214b6<_0x2685c4['query'][_0xd9a0('0x53')][_0xd9a0('0x2e')];_0x5214b6+=0x1){socket['emit'](_0xd9a0('0x7a'),{'UserId':_0x2685c4[_0xd9a0('0x27')]['ids'][_0x5214b6],'CmListId':_0x2685c4[_0xd9a0('0x3e')]['id']});}}else{socket['emit'](_0xd9a0('0x7a'),{'UserId':_0x2685c4[_0xd9a0('0x27')][_0xd9a0('0x53')],'CmListId':_0x2685c4[_0xd9a0('0x3e')]['id']});}});}})['then'](respondWithStatusCode(_0x4fa7bc,null))[_0xd9a0('0x3c')](handleError(_0x4fa7bc,null));};exports[_0xd9a0('0x7b')]=function(_0x470072,_0x3a8054,_0x241c3b){var _0xb8fb36={};var _0x14e27e={};var _0x5b49ae;var _0x76e734;return db[_0xd9a0('0x3a')][_0xd9a0('0x48')]({'where':{'id':_0x470072['params']['id']}})[_0xd9a0('0x21')](handleEntityNotFound(_0x3a8054,null))[_0xd9a0('0x21')](function(_0x2dcce){if(_0x2dcce){_0x5b49ae=_0x2dcce;_0x14e27e[_0xd9a0('0x25')]=_[_0xd9a0('0x26')](db['User'][_0xd9a0('0x5a')]);_0x14e27e[_0xd9a0('0x27')]=_['keys'](_0x470072['query']);_0x14e27e['filters']=_[_0xd9a0('0x2c')](_0x14e27e[_0xd9a0('0x25')],_0x14e27e[_0xd9a0('0x27')]);_0xb8fb36[_0xd9a0('0x2b')]=_[_0xd9a0('0x2c')](_0x14e27e[_0xd9a0('0x25')],qs['fields'](_0x470072[_0xd9a0('0x27')]['fields']));_0xb8fb36[_0xd9a0('0x2b')]=_0xb8fb36[_0xd9a0('0x2b')][_0xd9a0('0x2e')]?_0xb8fb36[_0xd9a0('0x2b')]:_0x14e27e[_0xd9a0('0x25')];_0xb8fb36[_0xd9a0('0x31')]=qs[_0xd9a0('0x32')](_0x470072['query'][_0xd9a0('0x32')]);_0xb8fb36[_0xd9a0('0x36')]=qs['filters'](_[_0xd9a0('0x49')](_0x470072[_0xd9a0('0x27')],_0x14e27e[_0xd9a0('0x2a')]));if(_0x470072[_0xd9a0('0x27')][_0xd9a0('0x37')]){_0xb8fb36['where']=_[_0xd9a0('0x35')](_0xb8fb36[_0xd9a0('0x36')],{'$or':_[_0xd9a0('0x38')](_0xb8fb36[_0xd9a0('0x2b')],function(_0x41dd59){var _0x174f46={};_0x174f46[_0x41dd59]={'$like':'%'+_0x470072['query'][_0xd9a0('0x37')]+'%'};return _0x174f46;})});}_0xb8fb36=_[_0xd9a0('0x35')]({},_0xb8fb36,_0x470072[_0xd9a0('0x39')]);return _0x5b49ae[_0xd9a0('0x7b')](_0xb8fb36);}})[_0xd9a0('0x21')](function(_0x12596e){if(_0x12596e){_0x76e734=_0x12596e['length'];if(!_0x470072[_0xd9a0('0x27')][_0xd9a0('0x2f')]('nolimit')){_0xb8fb36[_0xd9a0('0x1c')]=qs[_0xd9a0('0x1c')](_0x470072[_0xd9a0('0x27')][_0xd9a0('0x1c')]);_0xb8fb36[_0xd9a0('0x1b')]=qs[_0xd9a0('0x1b')](_0x470072[_0xd9a0('0x27')][_0xd9a0('0x1b')]);}return _0x5b49ae['getAgents'](_0xb8fb36);}})['then'](function(_0x3a083a){if(_0x3a083a){return _0x3a083a?{'count':_0x76e734,'rows':_0x3a083a}:null;}})['then'](respondWithResult(_0x3a8054,null))[_0xd9a0('0x3c')](handleError(_0x3a8054,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f22a858..d02c128 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 _0x62c7=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x35b950,_0x183d4a){var _0x42eec9=function(_0x19e1c1){while(--_0x19e1c1){_0x35b950['push'](_0x35b950['shift']());}};_0x42eec9(++_0x183d4a);}(_0x62c7,0x1ac));var _0x762c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62c7[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var CmList=require(_0x762c('0x0'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x762c('0x1')](0x0);var events={'afterCreate':_0x762c('0x2'),'afterUpdate':_0x762c('0x3'),'afterDestroy':_0x762c('0x4')};function emitEvent(_0x212d84){return function(_0x476789,_0xc36619,_0x4a6ff7){CmListEvents[_0x762c('0x5')](_0x212d84+':'+_0x476789['id'],_0x476789);CmListEvents[_0x762c('0x5')](_0x212d84,_0x476789);_0x4a6ff7(null);};}for(var e in events){if(events[_0x762c('0x6')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x762c('0x7')]=CmListEvents; \ No newline at end of file +var _0xdf1a=['../../mysqldb','CmList','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x1e76e8,_0x41ec55){var _0x2d7a1f=function(_0x15a0bd){while(--_0x15a0bd){_0x1e76e8['push'](_0x1e76e8['shift']());}};_0x2d7a1f(++_0x41ec55);}(_0xdf1a,0x8f));var _0xadf1=function(_0x515afd,_0x1a1e91){_0x515afd=_0x515afd-0x0;var _0x536d53=_0xdf1a[_0x515afd];return _0x536d53;};'use strict';var EventEmitter=require(_0xadf1('0x0'));var CmList=require(_0xadf1('0x1'))['db'][_0xadf1('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xadf1('0x3')](0x0);var events={'afterCreate':_0xadf1('0x4'),'afterUpdate':_0xadf1('0x5'),'afterDestroy':_0xadf1('0x6')};function emitEvent(_0x352a60){return function(_0x55aa8,_0x338699,_0x3dfa8d){CmListEvents[_0xadf1('0x7')](_0x352a60+':'+_0x55aa8['id'],_0x55aa8);CmListEvents[_0xadf1('0x7')](_0x352a60,_0x55aa8);_0x3dfa8d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xadf1('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5c2db68..d8a2629 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 _0x0c97=['CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x46c5ad,_0x3d957a){var _0x970544=function(_0x135cc2){while(--_0x135cc2){_0x46c5ad['push'](_0x46c5ad['shift']());}};_0x970544(++_0x3d957a);}(_0x0c97,0x14c));var _0x70c9=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x0c97[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0x70c9('0x0'));var util=require(_0x70c9('0x1'));var logger=require(_0x70c9('0x2'))('api');var moment=require(_0x70c9('0x3'));var BPromise=require(_0x70c9('0x4'));var rp=require(_0x70c9('0x5'));var attributes=require('./cmList.attributes');module[_0x70c9('0x6')]=function(_0x108a54,_0x26d7d2){return _0x108a54[_0x70c9('0x7')](_0x70c9('0x8'),attributes,{'tableName':_0x70c9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7297=['request-promise','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','moment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7297,0x180));var _0x7729=function(_0x2ae076,_0x3edab3){_0x2ae076=_0x2ae076-0x0;var _0xa4da77=_0x7297[_0x2ae076];return _0xa4da77;};'use strict';var _=require(_0x7729('0x0'));var util=require(_0x7729('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7729('0x2'));var BPromise=require('bluebird');var rp=require(_0x7729('0x3'));var attributes=require(_0x7729('0x4'));module[_0x7729('0x5')]=function(_0x26ad47,_0x2ee7ac){return _0x26ad47[_0x7729('0x6')](_0x7729('0x7'),attributes,{'tableName':_0x7729('0x8'),'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 b88652f..ed8ca3f 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 _0xd008=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','./cmList.socket','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd008,0x1e5));var _0x8d00=function(_0x50aa3d,_0x46644e){_0x50aa3d=_0x50aa3d-0x0;var _0x101d07=_0xd008[_0x50aa3d];return _0x101d07;};'use strict';var _=require(_0x8d00('0x0'));var util=require(_0x8d00('0x1'));var moment=require('moment');var BPromise=require(_0x8d00('0x2'));var rs=require(_0x8d00('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8d00('0x4'));var logger=require(_0x8d00('0x5'))(_0x8d00('0x6'));var config=require(_0x8d00('0x7'));var jayson=require(_0x8d00('0x8'));var client=jayson[_0x8d00('0x9')][_0x8d00('0xa')]({'port':0x232a});var socket=require(_0x8d00('0xb'))({'host':'localhost','port':0x18eb});require(_0x8d00('0xc'))[_0x8d00('0xd')](socket);function respondWithRpcPromise(_0x3500ea,_0x53316c,_0x1dd6aa){return new BPromise(function(_0x5f14ec,_0x4eb74b){return client['request'](_0x3500ea,_0x1dd6aa)[_0x8d00('0xe')](function(_0x1fd0c9){logger[_0x8d00('0xf')](_0x8d00('0x10'),_0x53316c,_0x8d00('0x11'));logger[_0x8d00('0x12')](_0x8d00('0x13'),_0x53316c,_0x8d00('0x11'),JSON[_0x8d00('0x14')](_0x1fd0c9));if(_0x1fd0c9[_0x8d00('0x15')]){if(_0x1fd0c9['error']['code']===0x1f4){logger[_0x8d00('0x15')](_0x8d00('0x10'),_0x53316c,_0x1fd0c9[_0x8d00('0x15')]['message']);return _0x4eb74b(_0x1fd0c9[_0x8d00('0x15')][_0x8d00('0x16')]);}logger[_0x8d00('0x15')](_0x8d00('0x10'),_0x53316c,_0x1fd0c9['error'][_0x8d00('0x16')]);return _0x5f14ec(_0x1fd0c9[_0x8d00('0x15')][_0x8d00('0x16')]);}else{logger[_0x8d00('0xf')](_0x8d00('0x10'),_0x53316c,'request\x20sent');_0x5f14ec(_0x1fd0c9['result']['message']);}})[_0x8d00('0x17')](function(_0x3d14ec){logger[_0x8d00('0x15')](_0x8d00('0x10'),_0x53316c,_0x3d14ec);_0x4eb74b(_0x3d14ec);});});} \ No newline at end of file +var _0x74ae=['stringify','error','code','CmList,\x20%s,\x20%s','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','./cmList.socket','register','request','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s'];(function(_0x429fe,_0x18ea96){var _0x4052e3=function(_0xc09b93){while(--_0xc09b93){_0x429fe['push'](_0x429fe['shift']());}};_0x4052e3(++_0x18ea96);}(_0x74ae,0x15f));var _0xe74a=function(_0x2ebce5,_0x4d089a){_0x2ebce5=_0x2ebce5-0x0;var _0x2173cf=_0x74ae[_0x2ebce5];return _0x2173cf;};'use strict';var _=require('lodash');var util=require(_0xe74a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe74a('0x1'));var fs=require('fs');var db=require(_0xe74a('0x2'))['db'];var utils=require(_0xe74a('0x3'));var logger=require(_0xe74a('0x4'))(_0xe74a('0x5'));var config=require(_0xe74a('0x6'));var jayson=require(_0xe74a('0x7'));var client=jayson[_0xe74a('0x8')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0xe74a('0x9'),'port':0x18eb});require(_0xe74a('0xa'))[_0xe74a('0xb')](socket);function respondWithRpcPromise(_0x3da312,_0x186b58,_0x518d2b){return new BPromise(function(_0x16232d,_0x50743f){return client[_0xe74a('0xc')](_0x3da312,_0x518d2b)[_0xe74a('0xd')](function(_0x1bbd1e){logger[_0xe74a('0xe')]('CmList,\x20%s,\x20%s',_0x186b58,_0xe74a('0xf'));logger['debug'](_0xe74a('0x10'),_0x186b58,_0xe74a('0xf'),JSON[_0xe74a('0x11')](_0x1bbd1e));if(_0x1bbd1e[_0xe74a('0x12')]){if(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x13')]===0x1f4){logger[_0xe74a('0x12')](_0xe74a('0x14'),_0x186b58,_0x1bbd1e[_0xe74a('0x12')]['message']);return _0x50743f(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);}logger[_0xe74a('0x12')]('CmList,\x20%s,\x20%s',_0x186b58,_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);return _0x16232d(_0x1bbd1e[_0xe74a('0x12')][_0xe74a('0x15')]);}else{logger[_0xe74a('0xe')]('CmList,\x20%s,\x20%s',_0x186b58,_0xe74a('0xf'));_0x16232d(_0x1bbd1e[_0xe74a('0x16')][_0xe74a('0x15')]);}})['catch'](function(_0x3c901f){logger[_0xe74a('0x12')](_0xe74a('0x14'),_0x186b58,_0x3c901f);_0x50743f(_0x3c901f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 7702892..ca59805 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 _0x2dc4=['length','save','update','emit','removeListener','register'];(function(_0x13f675,_0x2bf9ff){var _0x560664=function(_0x468246){while(--_0x468246){_0x13f675['push'](_0x13f675['shift']());}};_0x560664(++_0x2bf9ff);}(_0x2dc4,0xbb));var _0x42dc=function(_0x4ab53b,_0x2e857a){_0x4ab53b=_0x4ab53b-0x0;var _0x4d6dda=_0x2dc4[_0x4ab53b];return _0x4d6dda;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x42dc('0x0'),'remove',_0x42dc('0x1')];function createListener(_0x2bc5c3,_0x3a93c8){return function(_0x3cf36b){_0x3a93c8[_0x42dc('0x2')](_0x2bc5c3,_0x3cf36b);};}function removeListener(_0x45180a,_0x33aed7){return function(){CmListEvents[_0x42dc('0x3')](_0x45180a,_0x33aed7);};}exports[_0x42dc('0x4')]=function(_0xe9c047){for(var _0x184f6a=0x0,_0x5015fd=events[_0x42dc('0x5')];_0x184f6a<_0x5015fd;_0x184f6a++){var _0x27751e=events[_0x184f6a];var _0x594c4f=createListener('cmList:'+_0x27751e,_0xe9c047);CmListEvents['on'](_0x27751e,_0x594c4f);}}; \ No newline at end of file +var _0x20bd=['length','cmList:','./cmList.events','remove','update','emit','register'];(function(_0x4803d7,_0xcacf36){var _0x1bc64d=function(_0x2af553){while(--_0x2af553){_0x4803d7['push'](_0x4803d7['shift']());}};_0x1bc64d(++_0xcacf36);}(_0x20bd,0xfe));var _0xd20b=function(_0x4af65b,_0x18d3f0){_0x4af65b=_0x4af65b-0x0;var _0x582787=_0x20bd[_0x4af65b];return _0x582787;};'use strict';var CmListEvents=require(_0xd20b('0x0'));var events=['save',_0xd20b('0x1'),_0xd20b('0x2')];function createListener(_0x16dc9c,_0x399dad){return function(_0x30a7d4){_0x399dad[_0xd20b('0x3')](_0x16dc9c,_0x30a7d4);};}function removeListener(_0x2c7377,_0x2c1740){return function(){CmListEvents['removeListener'](_0x2c7377,_0x2c1740);};}exports[_0xd20b('0x4')]=function(_0x49f2b3){for(var _0x430735=0x0,_0x27f415=events[_0xd20b('0x5')];_0x430735<_0x27f415;_0x430735++){var _0x1dce88=events[_0x430735];var _0x3198d1=createListener(_0xd20b('0x6')+_0x1dce88,_0x49f2b3);CmListEvents['on'](_0x1dce88,_0x3198d1);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 5597a8b..29cc60c 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 _0xb28c=['get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','destroy','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./cmList.controller'];(function(_0x47d267,_0x5ebbeb){var _0x1bef7a=function(_0x2bcd3a){while(--_0x2bcd3a){_0x47d267['push'](_0x47d267['shift']());}};_0x1bef7a(++_0x5ebbeb);}(_0xb28c,0x1c8));var _0xcb28=function(_0x18e60c,_0x229027){_0x18e60c=_0x18e60c-0x0;var _0x30bfd1=_0xb28c[_0x18e60c];return _0x30bfd1;};'use strict';var multer=require(_0xcb28('0x0'));var util=require(_0xcb28('0x1'));var path=require(_0xcb28('0x2'));var express=require(_0xcb28('0x3'));var router=express[_0xcb28('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb28('0x5'));var config=require(_0xcb28('0x6'));var controller=require(_0xcb28('0x7'));router[_0xcb28('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcb28('0x8')](_0xcb28('0x9'),auth[_0xcb28('0xa')](),controller['describe']);router[_0xcb28('0x8')](_0xcb28('0xb'),auth[_0xcb28('0xa')](),controller[_0xcb28('0xc')]);router[_0xcb28('0x8')](_0xcb28('0xd'),auth[_0xcb28('0xa')](),controller[_0xcb28('0xe')]);router['get'](_0xcb28('0xf'),auth[_0xcb28('0xa')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0xcb28('0xa')](),controller[_0xcb28('0x10')]);router[_0xcb28('0x8')](_0xcb28('0x11'),auth[_0xcb28('0xa')](),controller['getCustomFields']);router['get'](_0xcb28('0x12'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x13')]);router[_0xcb28('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xcb28('0xd'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x15')]);router['post'](_0xcb28('0xf'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x16')]);router[_0xcb28('0x14')](_0xcb28('0x11'),auth['isAuthenticated'](),controller[_0xcb28('0x17')]);router[_0xcb28('0x14')](_0xcb28('0x12'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x18')]);router['put'](_0xcb28('0xb'),auth[_0xcb28('0xa')](),controller['update']);router['delete'](_0xcb28('0xb'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x19')]);router['delete'](_0xcb28('0xd'),auth['isAuthenticated'](),controller[_0xcb28('0x1a')]);router['delete'](_0xcb28('0x12'),auth[_0xcb28('0xa')](),controller[_0xcb28('0x1b')]);module[_0xcb28('0x1c')]=router; \ No newline at end of file +var _0x8382=['/:id/dispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','post','create','addDisposition','addCustomField','/:id/users','addAgents','put','/:id','update','destroy','delete','exports','multer','util','path','express','Router','../../components/interaction/service','./cmList.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8382,0x1d4));var _0x2838=function(_0x1d37f3,_0x4af9bc){_0x1d37f3=_0x1d37f3-0x0;var _0x4bc938=_0x8382[_0x1d37f3];return _0x4bc938;};'use strict';var multer=require(_0x2838('0x0'));var util=require(_0x2838('0x1'));var path=require(_0x2838('0x2'));var express=require(_0x2838('0x3'));var router=express[_0x2838('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2838('0x5'));var config=require('../../config/environment');var controller=require(_0x2838('0x6'));router[_0x2838('0x7')]('/',auth[_0x2838('0x8')](),controller[_0x2838('0x9')]);router[_0x2838('0x7')](_0x2838('0xa'),auth[_0x2838('0x8')](),controller[_0x2838('0xb')]);router['get']('/:id',auth[_0x2838('0x8')](),controller['show']);router['get'](_0x2838('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x2838('0x7')](_0x2838('0xd'),auth[_0x2838('0x8')](),controller['getContacts']);router[_0x2838('0x7')](_0x2838('0xe'),auth[_0x2838('0x8')](),controller[_0x2838('0xf')]);router['get'](_0x2838('0x10'),auth[_0x2838('0x8')](),controller[_0x2838('0x11')]);router[_0x2838('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x2838('0x12')]('/',auth[_0x2838('0x8')](),controller[_0x2838('0x13')]);router[_0x2838('0x12')]('/:id/dispositions',auth[_0x2838('0x8')](),controller[_0x2838('0x14')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x2838('0x12')](_0x2838('0x10'),auth[_0x2838('0x8')](),controller[_0x2838('0x15')]);router[_0x2838('0x12')](_0x2838('0x16'),auth[_0x2838('0x8')](),controller[_0x2838('0x17')]);router[_0x2838('0x18')](_0x2838('0x19'),auth[_0x2838('0x8')](),controller[_0x2838('0x1a')]);router['delete'](_0x2838('0x19'),auth[_0x2838('0x8')](),controller[_0x2838('0x1b')]);router[_0x2838('0x1c')](_0x2838('0xc'),auth[_0x2838('0x8')](),controller['removeDispositions']);router[_0x2838('0x1c')](_0x2838('0x16'),auth[_0x2838('0x8')](),controller['removeAgents']);module[_0x2838('0x1d')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 1ef6d56..11adad0 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 _0x43c2=['sequelize','exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x2ec5b9,_0x56e0a3){var _0x10dcea=function(_0x1d403d){while(--_0x1d403d){_0x2ec5b9['push'](_0x2ec5b9['shift']());}};_0x10dcea(++_0x56e0a3);}(_0x43c2,0x1a4));var _0x243c=function(_0x3b8009,_0x595399){_0x3b8009=_0x3b8009-0x0;var _0x2e0b28=_0x43c2[_0x3b8009];return _0x2e0b28;};'use strict';var Sequelize=require(_0x243c('0x0'));module[_0x243c('0x1')]={'name':{'type':Sequelize[_0x243c('0x2')],'get':function(_0x5da759){return this[_0x243c('0x3')](_0x243c('0x4'));}},'field':{'type':Sequelize[_0x243c('0x5')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x243c('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x3089=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3089,0x19c));var _0x9308=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x3089[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0x9308('0x0'));module[_0x9308('0x1')]={'name':{'type':Sequelize[_0x9308('0x2')],'get':function(_0x388092){return this[_0x9308('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x9308('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 1588447..f11592b 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 _0x34e8=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','reject','save','update','then','stack','name','send','body','find','catch','destroy','params','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce'];(function(_0x7a079c,_0x582ad4){var _0x2fb89f=function(_0x590cb0){while(--_0x590cb0){_0x7a079c['push'](_0x7a079c['shift']());}};_0x2fb89f(++_0x582ad4);}(_0x34e8,0x12c));var _0x834e=function(_0x1b01ec,_0xf84afe){_0x1b01ec=_0x1b01ec-0x0;var _0x21331c=_0x34e8[_0x1b01ec];return _0x21331c;};'use strict';var jsonpatch=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var Mustache=require('mustache');var util=require(_0x834e('0x4'));var path=require(_0x834e('0x5'));var sox=require(_0x834e('0x6'));var csv=require(_0x834e('0x7'));var ejs=require(_0x834e('0x8'));var fs=require('fs');var _=require(_0x834e('0x9'));var squel=require(_0x834e('0xa'));var crypto=require('crypto');var jsforce=require(_0x834e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x834e('0x7'));var querystring=require(_0x834e('0xc'));var Papa=require(_0x834e('0xd'));var qs=require(_0x834e('0xe'));var logger=require(_0x834e('0xf'))(_0x834e('0x10'));var utils=require(_0x834e('0x11'));var config=require(_0x834e('0x12'));var db=require(_0x834e('0x13'))['db'];function respondWithStatusCode(_0x186b3b,_0x1e41fe){_0x1e41fe=_0x1e41fe||0xcc;return function(_0x36e124){if(_0x36e124){return _0x186b3b[_0x834e('0x14')](_0x1e41fe);}return _0x186b3b[_0x834e('0x15')](_0x1e41fe)[_0x834e('0x16')]();};}function respondWithResult(_0x1e00de,_0x2fd95c){_0x2fd95c=_0x2fd95c||0xc8;return function(_0x538bb3){if(_0x538bb3){return _0x1e00de[_0x834e('0x15')](_0x2fd95c)[_0x834e('0x17')](_0x538bb3);}};}function respondWithFilteredResult(_0x58a27e,_0x23848e){return function(_0x2d95f2){if(_0x2d95f2){var _0x28e659=_0x2d95f2[_0x834e('0x18')],_0x21cc0a=_0x23848e['offset'],_0x50e860=_0x23848e[_0x834e('0x19')]+_0x23848e['limit'],_0x43156c;if(_0x50e860>=_0x28e659){_0x50e860=_0x28e659;_0x43156c=0xc8;}else{_0x43156c=0xce;}_0x58a27e[_0x834e('0x15')](_0x43156c);return _0x58a27e[_0x834e('0x1a')]('Content-Range',_0x21cc0a+'-'+_0x50e860+'/'+_0x28e659)[_0x834e('0x17')](_0x2d95f2);}return null;};}function patchUpdates(_0x22106e){return function(_0x370fb5){try{jsonpatch['apply'](_0x370fb5,_0x22106e,!![]);}catch(_0x283e56){return BPromise[_0x834e('0x1b')](_0x283e56);}return _0x370fb5[_0x834e('0x1c')]();};}function saveUpdates(_0xb993a1,_0x237947){return function(_0x254677){if(_0x254677){return _0x254677[_0x834e('0x1d')](_0xb993a1)['then'](function(_0x2545b4){return _0x2545b4;});}return null;};}function removeEntity(_0x1fd2c6,_0x113ff4){return function(_0x325a99){if(_0x325a99){return _0x325a99['destroy']()[_0x834e('0x1e')](function(){_0x1fd2c6[_0x834e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b4bdf,_0x28d687){return function(_0x8d406e){if(!_0x8d406e){_0x1b4bdf['sendStatus'](0x194);}return _0x8d406e;};}function handleError(_0x4e3f48,_0x231619){_0x231619=_0x231619||0x1f4;return function(_0x34563b){logger['error'](_0x34563b[_0x834e('0x1f')]);if(_0x34563b[_0x834e('0x20')]){delete _0x34563b['name'];}_0x4e3f48[_0x834e('0x15')](_0x231619)[_0x834e('0x21')](_0x34563b);};}exports[_0x834e('0x1d')]=function(_0x561cd2,_0x24fcf7){if(_0x561cd2[_0x834e('0x22')]['id']){delete _0x561cd2['body']['id'];}return db['Condition'][_0x834e('0x23')]({'where':{'id':_0x561cd2['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x24fcf7,null))[_0x834e('0x1e')](saveUpdates(_0x561cd2[_0x834e('0x22')],null))[_0x834e('0x1e')](respondWithResult(_0x24fcf7,null))[_0x834e('0x24')](handleError(_0x24fcf7,null));};exports[_0x834e('0x25')]=function(_0x491919,_0x510780){return db['Condition']['find']({'where':{'id':_0x491919[_0x834e('0x26')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x510780,null))[_0x834e('0x1e')](removeEntity(_0x510780,null))['catch'](handleError(_0x510780,null));}; \ No newline at end of file +var _0x70e0=['../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','body','find','params','catch','destroy','Condition','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','querystring','papaparse'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x70e0,0x17b));var _0x070e=function(_0x4744b5,_0xd47c54){_0x4744b5=_0x4744b5-0x0;var _0x6768e2=_0x70e0[_0x4744b5];return _0x6768e2;};'use strict';var jsonpatch=require(_0x070e('0x0'));var rp=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var sox=require(_0x070e('0x5'));var csv=require(_0x070e('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x070e('0x7'));var squel=require('squel');var crypto=require(_0x070e('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x070e('0x9'));var Papa=require(_0x070e('0xa'));var qs=require(_0x070e('0xb'));var logger=require(_0x070e('0xc'))(_0x070e('0xd'));var utils=require(_0x070e('0xe'));var config=require(_0x070e('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x49b2fb,_0x50f4eb){_0x50f4eb=_0x50f4eb||0xcc;return function(_0x2e3e5e){if(_0x2e3e5e){return _0x49b2fb[_0x070e('0x10')](_0x50f4eb);}return _0x49b2fb[_0x070e('0x11')](_0x50f4eb)[_0x070e('0x12')]();};}function respondWithResult(_0xffcdd6,_0x25cfe1){_0x25cfe1=_0x25cfe1||0xc8;return function(_0x1baa12){if(_0x1baa12){return _0xffcdd6[_0x070e('0x11')](_0x25cfe1)[_0x070e('0x13')](_0x1baa12);}};}function respondWithFilteredResult(_0x2930b8,_0x52da3b){return function(_0x5dca0f){if(_0x5dca0f){var _0x24baba=_0x5dca0f[_0x070e('0x14')],_0x56c7ba=_0x52da3b[_0x070e('0x15')],_0x4a33d2=_0x52da3b['offset']+_0x52da3b['limit'],_0x5bae0f;if(_0x4a33d2>=_0x24baba){_0x4a33d2=_0x24baba;_0x5bae0f=0xc8;}else{_0x5bae0f=0xce;}_0x2930b8[_0x070e('0x11')](_0x5bae0f);return _0x2930b8[_0x070e('0x16')](_0x070e('0x17'),_0x56c7ba+'-'+_0x4a33d2+'/'+_0x24baba)[_0x070e('0x13')](_0x5dca0f);}return null;};}function patchUpdates(_0x5bc71e){return function(_0x49861b){try{jsonpatch[_0x070e('0x18')](_0x49861b,_0x5bc71e,!![]);}catch(_0x2bd937){return BPromise[_0x070e('0x19')](_0x2bd937);}return _0x49861b[_0x070e('0x1a')]();};}function saveUpdates(_0x364b3f,_0x5037eb){return function(_0x3938b5){if(_0x3938b5){return _0x3938b5[_0x070e('0x1b')](_0x364b3f)[_0x070e('0x1c')](function(_0x3ea105){return _0x3ea105;});}return null;};}function removeEntity(_0x259893,_0x5c16fd){return function(_0x5b2f48){if(_0x5b2f48){return _0x5b2f48['destroy']()[_0x070e('0x1c')](function(){_0x259893[_0x070e('0x11')](0xcc)[_0x070e('0x12')]();});}};}function handleEntityNotFound(_0x4be0d7,_0x5b184){return function(_0x5dc5d2){if(!_0x5dc5d2){_0x4be0d7[_0x070e('0x10')](0x194);}return _0x5dc5d2;};}function handleError(_0x3f6985,_0x27a01e){_0x27a01e=_0x27a01e||0x1f4;return function(_0x33e8c6){logger[_0x070e('0x1d')](_0x33e8c6[_0x070e('0x1e')]);if(_0x33e8c6[_0x070e('0x1f')]){delete _0x33e8c6[_0x070e('0x1f')];}_0x3f6985['status'](_0x27a01e)[_0x070e('0x20')](_0x33e8c6);};}exports[_0x070e('0x1b')]=function(_0x4790eb,_0x503f4d){if(_0x4790eb[_0x070e('0x21')]['id']){delete _0x4790eb['body']['id'];}return db['Condition'][_0x070e('0x22')]({'where':{'id':_0x4790eb[_0x070e('0x23')]['id']}})[_0x070e('0x1c')](handleEntityNotFound(_0x503f4d,null))[_0x070e('0x1c')](saveUpdates(_0x4790eb[_0x070e('0x21')],null))['then'](respondWithResult(_0x503f4d,null))[_0x070e('0x24')](handleError(_0x503f4d,null));};exports[_0x070e('0x25')]=function(_0x1d72d6,_0x1d2a34){return db[_0x070e('0x26')][_0x070e('0x22')]({'where':{'id':_0x1d72d6[_0x070e('0x23')]['id']}})[_0x070e('0x1c')](handleEntityNotFound(_0x1d2a34,null))['then'](removeEntity(_0x1d2a34,null))[_0x070e('0x24')](handleError(_0x1d2a34,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index ac55b93..776396c 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 _0x3d51=['moment','bluebird','request-promise','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api'];(function(_0x30db6a,_0x56c988){var _0x2440fd=function(_0x382cc2){while(--_0x382cc2){_0x30db6a['push'](_0x30db6a['shift']());}};_0x2440fd(++_0x56c988);}(_0x3d51,0x152));var _0x13d5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d51[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x13d5('0x0'));var logger=require(_0x13d5('0x1'))(_0x13d5('0x2'));var moment=require(_0x13d5('0x3'));var BPromise=require(_0x13d5('0x4'));var rp=require(_0x13d5('0x5'));var attributes=require(_0x13d5('0x6'));module[_0x13d5('0x7')]=function(_0x26b7f9,_0x4e2f7f){return _0x26b7f9[_0x13d5('0x8')](_0x13d5('0x9'),attributes,{'tableName':_0x13d5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd469=['bluebird','request-promise','./condition.attributes','exports','define','Condition','tools_conditions','lodash','util','../../config/logger','moment'];(function(_0x3c2e28,_0x33df16){var _0x3a5e35=function(_0x140637){while(--_0x140637){_0x3c2e28['push'](_0x3c2e28['shift']());}};_0x3a5e35(++_0x33df16);}(_0xd469,0x193));var _0x9d46=function(_0x597c41,_0x197993){_0x597c41=_0x597c41-0x0;var _0x36c84a=_0xd469[_0x597c41];return _0x36c84a;};'use strict';var _=require(_0x9d46('0x0'));var util=require(_0x9d46('0x1'));var logger=require(_0x9d46('0x2'))('api');var moment=require(_0x9d46('0x3'));var BPromise=require(_0x9d46('0x4'));var rp=require(_0x9d46('0x5'));var attributes=require(_0x9d46('0x6'));module[_0x9d46('0x7')]=function(_0x37d247,_0x19c57a){return _0x37d247[_0x9d46('0x8')](_0x9d46('0x9'),attributes,{'tableName':_0x9d46('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index efc47de..fc857e6 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 _0xadbe=['code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xadbe,0x1a7));var _0xeadb=function(_0x436fd6,_0x3a416a){_0x436fd6=_0x436fd6-0x0;var _0x45cd28=_0xadbe[_0x436fd6];return _0x45cd28;};'use strict';var _=require(_0xeadb('0x0'));var util=require(_0xeadb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xeadb('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xeadb('0x3'))(_0xeadb('0x4'));var config=require(_0xeadb('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeadb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xc67349,_0x30da79,_0x18629b){return new BPromise(function(_0x39fa79,_0x15da71){return client[_0xeadb('0x7')](_0xc67349,_0x18629b)[_0xeadb('0x8')](function(_0x446b45){logger['info']('Condition,\x20%s,\x20%s',_0x30da79,_0xeadb('0x9'));logger[_0xeadb('0xa')](_0xeadb('0xb'),_0x30da79,_0xeadb('0x9'),JSON[_0xeadb('0xc')](_0x446b45));if(_0x446b45[_0xeadb('0xd')]){if(_0x446b45['error'][_0xeadb('0xe')]===0x1f4){logger[_0xeadb('0xd')](_0xeadb('0xf'),_0x30da79,_0x446b45[_0xeadb('0xd')][_0xeadb('0x10')]);return _0x15da71(_0x446b45['error'][_0xeadb('0x10')]);}logger[_0xeadb('0xd')]('Condition,\x20%s,\x20%s',_0x30da79,_0x446b45[_0xeadb('0xd')]['message']);return _0x39fa79(_0x446b45[_0xeadb('0xd')][_0xeadb('0x10')]);}else{logger['info'](_0xeadb('0xf'),_0x30da79,_0xeadb('0x9'));_0x39fa79(_0x446b45[_0xeadb('0x11')][_0xeadb('0x10')]);}})[_0xeadb('0x12')](function(_0x3969d0){logger['error'](_0xeadb('0xf'),_0x30da79,_0x3969d0);_0x15da71(_0x3969d0);});});} \ No newline at end of file +var _0xb10f=['result','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x161cc4,_0x3e1ccd){var _0x4ff541=function(_0x27811d){while(--_0x27811d){_0x161cc4['push'](_0x161cc4['shift']());}};_0x4ff541(++_0x3e1ccd);}(_0xb10f,0xe9));var _0xfb10=function(_0xd0df35,_0x1b27db){_0xd0df35=_0xd0df35-0x0;var _0x14fbe2=_0xb10f[_0xd0df35];return _0x14fbe2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfb10('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xfb10('0x1'))['db'];var utils=require(_0xfb10('0x2'));var logger=require(_0xfb10('0x3'))(_0xfb10('0x4'));var config=require('../../config/environment');var jayson=require(_0xfb10('0x5'));var client=jayson[_0xfb10('0x6')][_0xfb10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xcb61f9,_0x4cb94f,_0x1d76b1){return new BPromise(function(_0x375f6f,_0x1c3440){return client[_0xfb10('0x8')](_0xcb61f9,_0x1d76b1)[_0xfb10('0x9')](function(_0x346b15){logger[_0xfb10('0xa')](_0xfb10('0xb'),_0x4cb94f,_0xfb10('0xc'));logger[_0xfb10('0xd')](_0xfb10('0xe'),_0x4cb94f,'request\x20sent',JSON[_0xfb10('0xf')](_0x346b15));if(_0x346b15[_0xfb10('0x10')]){if(_0x346b15['error'][_0xfb10('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x4cb94f,_0x346b15[_0xfb10('0x10')]['message']);return _0x1c3440(_0x346b15[_0xfb10('0x10')]['message']);}logger[_0xfb10('0x10')](_0xfb10('0xb'),_0x4cb94f,_0x346b15[_0xfb10('0x10')][_0xfb10('0x12')]);return _0x375f6f(_0x346b15['error'][_0xfb10('0x12')]);}else{logger[_0xfb10('0xa')](_0xfb10('0xb'),_0x4cb94f,_0xfb10('0xc'));_0x375f6f(_0x346b15[_0xfb10('0x13')][_0xfb10('0x12')]);}})[_0xfb10('0x14')](function(_0xc96807){logger[_0xfb10('0x10')](_0xfb10('0xb'),_0x4cb94f,_0xc96807);_0x1c3440(_0xc96807);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index a58d873..fd7127f 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 _0x0f1b=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x35063b,_0xa1ab0d){var _0x2c0930=function(_0x13df2f){while(--_0x13df2f){_0x35063b['push'](_0x35063b['shift']());}};_0x2c0930(++_0xa1ab0d);}(_0x0f1b,0x19e));var _0xb0f1=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0f1b[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xb0f1('0x0'));var util=require(_0xb0f1('0x1'));var path=require(_0xb0f1('0x2'));var express=require('express');var router=express[_0xb0f1('0x3')]();var auth=require(_0xb0f1('0x4'));var interaction=require(_0xb0f1('0x5'));var config=require('../../config/environment');var controller=require('./condition.controller');router['put'](_0xb0f1('0x6'),auth[_0xb0f1('0x7')](),controller[_0xb0f1('0x8')]);router[_0xb0f1('0x9')](_0xb0f1('0x6'),auth[_0xb0f1('0x7')](),controller[_0xb0f1('0xa')]);module[_0xb0f1('0xb')]=router; \ No newline at end of file +var _0x6480=['destroy','util','express','Router','../../components/interaction/service','../../config/environment','./condition.controller','put','update','delete','/:id','isAuthenticated'];(function(_0x460214,_0xcd081d){var _0x31462e=function(_0x15d09f){while(--_0x15d09f){_0x460214['push'](_0x460214['shift']());}};_0x31462e(++_0xcd081d);}(_0x6480,0x151));var _0x0648=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6480[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0648('0x0'));var path=require('path');var express=require(_0x0648('0x1'));var router=express[_0x0648('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x0648('0x3'));var config=require(_0x0648('0x4'));var controller=require(_0x0648('0x5'));router[_0x0648('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x0648('0x7')]);router[_0x0648('0x8')](_0x0648('0x9'),auth[_0x0648('0xa')](),controller[_0x0648('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 9b9e31a..6217f1e 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 _0xfc76=['exports','name','STRING','sequelize'];(function(_0x5b9410,_0x286768){var _0x3a551d=function(_0x5db5ad){while(--_0x5db5ad){_0x5b9410['push'](_0x5b9410['shift']());}};_0x3a551d(++_0x286768);}(_0xfc76,0x1a3));var _0x6fc7=function(_0xebd7e3,_0x4865f7){_0xebd7e3=_0xebd7e3-0x0;var _0xef5196=_0xfc76[_0xebd7e3];return _0xef5196;};'use strict';var Sequelize=require(_0x6fc7('0x0'));module[_0x6fc7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6fc7('0x2')},'description':{'type':Sequelize[_0x6fc7('0x3')]}}; \ No newline at end of file +var _0x663d=['STRING','name','exports'];(function(_0x29346a,_0x20564c){var _0x33adca=function(_0x40c3e5){while(--_0x40c3e5){_0x29346a['push'](_0x29346a['shift']());}};_0x33adca(++_0x20564c);}(_0x663d,0xf5));var _0xd663=function(_0x147a8c,_0x258a51){_0x147a8c=_0x147a8c-0x0;var _0x1abf88=_0x663d[_0x147a8c];return _0x1abf88;};'use strict';var Sequelize=require('sequelize');module[_0xd663('0x0')]={'name':{'type':Sequelize[_0xd663('0x1')],'allowNull':![],'unique':_0xd663('0x2')},'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 8129e31..3c03da6 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 _0xe578=['filter','merge','then','includeAll','include','findAll','catch','params','options','find','create','body','clone','get','omit','updatedAt','createdAt','update','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrMetric','total','attrVoiceQueues','attrFontSize','multibar-chart','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','map','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./dashboard.socket','register','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','destroy','error','name','send','index','Dashboard','rawAttributes','query','dateStart','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day'];(function(_0x4f8b17,_0x2be430){var _0x15e151=function(_0xf4113c){while(--_0xf4113c){_0x4f8b17['push'](_0x4f8b17['shift']());}};_0x15e151(++_0x2be430);}(_0xe578,0x95));var _0x8e57=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe578[_0x1facfa];return _0x9ec701;};'use strict';var jsonpatch=require(_0x8e57('0x0'));var rp=require(_0x8e57('0x1'));var moment=require(_0x8e57('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8e57('0x3'));var util=require(_0x8e57('0x4'));var path=require(_0x8e57('0x5'));var sox=require(_0x8e57('0x6'));var csv=require(_0x8e57('0x7'));var ejs=require(_0x8e57('0x8'));var fs=require('fs');var _=require(_0x8e57('0x9'));var squel=require(_0x8e57('0xa'));var crypto=require(_0x8e57('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8e57('0xc'));var Papa=require('papaparse');var qs=require(_0x8e57('0xd'));var logger=require(_0x8e57('0xe'))('api');var utils=require(_0x8e57('0xf'));var config=require(_0x8e57('0x10'));var db=require(_0x8e57('0x11'))['db'];var socket=require(_0x8e57('0x12'))({'host':_0x8e57('0x13'),'port':0x18eb});require(_0x8e57('0x14'))[_0x8e57('0x15')](socket);function respondWithStatusCode(_0xeb069c,_0x52981e){_0x52981e=_0x52981e||0xcc;return function(_0x4395ed){if(_0x4395ed){return _0xeb069c[_0x8e57('0x16')](_0x52981e);}return _0xeb069c[_0x8e57('0x17')](_0x52981e)[_0x8e57('0x18')]();};}function respondWithResult(_0x1b37d2,_0x1345c9){_0x1345c9=_0x1345c9||0xc8;return function(_0x4707c8){if(_0x4707c8){return _0x1b37d2[_0x8e57('0x17')](_0x1345c9)[_0x8e57('0x19')](_0x4707c8);}};}function respondWithFilteredResult(_0x4f237,_0x1a5827){return function(_0x568f30){if(_0x568f30){var _0x98628=_0x568f30[_0x8e57('0x1a')],_0x1120d4=_0x1a5827[_0x8e57('0x1b')],_0x109874=_0x1a5827[_0x8e57('0x1b')]+_0x1a5827[_0x8e57('0x1c')],_0x526f7b;if(_0x109874>=_0x98628){_0x109874=_0x98628;_0x526f7b=0xc8;}else{_0x526f7b=0xce;}_0x4f237[_0x8e57('0x17')](_0x526f7b);return _0x4f237['set'](_0x8e57('0x1d'),_0x1120d4+'-'+_0x109874+'/'+_0x98628)[_0x8e57('0x19')](_0x568f30);}return null;};}function patchUpdates(_0x2e8a2e){return function(_0x24b2ba){try{jsonpatch[_0x8e57('0x1e')](_0x24b2ba,_0x2e8a2e,!![]);}catch(_0x10ca02){return BPromise[_0x8e57('0x1f')](_0x10ca02);}return _0x24b2ba[_0x8e57('0x20')]();};}function saveUpdates(_0x8cd828,_0x1df450){return function(_0x1fe624){if(_0x1fe624){return _0x1fe624['update'](_0x8cd828)['then'](function(_0x2c4ea1){return _0x2c4ea1;});}return null;};}function removeEntity(_0x3254fc,_0x474f81){return function(_0x2d806e){if(_0x2d806e){return _0x2d806e[_0x8e57('0x21')]()['then'](function(){_0x3254fc[_0x8e57('0x17')](0xcc)[_0x8e57('0x18')]();});}};}function handleEntityNotFound(_0x576b82,_0x42d881){return function(_0x4e6145){if(!_0x4e6145){_0x576b82[_0x8e57('0x16')](0x194);}return _0x4e6145;};}function handleError(_0x5ddff4,_0x1082ea){_0x1082ea=_0x1082ea||0x1f4;return function(_0x74b60e){logger[_0x8e57('0x22')](_0x74b60e['stack']);if(_0x74b60e['name']){delete _0x74b60e[_0x8e57('0x23')];}_0x5ddff4[_0x8e57('0x17')](_0x1082ea)[_0x8e57('0x24')](_0x74b60e);};}exports[_0x8e57('0x25')]=function(_0x225b30,_0x32697f){var _0x417e23={},_0x31b10f={},_0x37e71c={'count':0x0,'rows':[]};var _0x35c9=db[_0x8e57('0x26')][_0x8e57('0x27')];_0x31b10f['model']=_['keys'](_0x35c9);var _0x548e00={'dateStart':_0x225b30[_0x8e57('0x28')][_0x8e57('0x29')],'dateEnd':_0x225b30[_0x8e57('0x28')][_0x8e57('0x2a')]};delete _0x225b30[_0x8e57('0x28')][_0x8e57('0x29')];delete _0x225b30['query'][_0x8e57('0x2a')];_0x31b10f[_0x8e57('0x28')]=_[_0x8e57('0x2b')](_0x225b30['query']);_0x31b10f['filters']=_[_0x8e57('0x2c')](_0x31b10f[_0x8e57('0x2d')],_0x31b10f['query']);_0x417e23[_0x8e57('0x2e')]=_[_0x8e57('0x2c')](_0x31b10f[_0x8e57('0x2d')],qs['fields'](_0x225b30[_0x8e57('0x28')][_0x8e57('0x2f')]));_0x417e23[_0x8e57('0x2e')]=_0x417e23[_0x8e57('0x2e')][_0x8e57('0x30')]?_0x417e23[_0x8e57('0x2e')]:_0x31b10f[_0x8e57('0x2d')];if(!_0x225b30[_0x8e57('0x28')][_0x8e57('0x31')](_0x8e57('0x32'))){_0x417e23['limit']=qs[_0x8e57('0x1c')](_0x225b30['query'][_0x8e57('0x1c')]);_0x417e23[_0x8e57('0x1b')]=qs['offset'](_0x225b30[_0x8e57('0x28')]['offset']);}_0x417e23[_0x8e57('0x33')]=qs[_0x8e57('0x34')](_0x225b30['query'][_0x8e57('0x34')]);_0x417e23[_0x8e57('0x35')]=qs[_0x8e57('0x36')](_['pick'](_0x225b30[_0x8e57('0x28')],_0x31b10f[_0x8e57('0x36')]));if(_0x548e00[_0x8e57('0x29')]){if(_0x548e00[_0x8e57('0x2a')]){_0x548e00[_0x8e57('0x2a')]=moment(_0x548e00[_0x8e57('0x2a')])[_0x8e57('0x37')](0x1,_0x8e57('0x38'));}else{_0x548e00['dateEnd']=moment(_0x548e00[_0x8e57('0x29')])[_0x8e57('0x37')](0x1,_0x8e57('0x38'));}_['merge'](_0x417e23['where'],{'createdAt':{'$gte':_0x548e00[_0x8e57('0x29')],'$lte':_0x548e00['dateEnd']}});}if(_0x225b30[_0x8e57('0x28')][_0x8e57('0x39')]){_0x417e23[_0x8e57('0x35')]=_[_0x8e57('0x3a')](_0x417e23[_0x8e57('0x35')],{'$or':_['map'](_0x417e23[_0x8e57('0x2e')],function(_0x4f9918){var _0x49c15b={};_0x49c15b[_0x4f9918]={'$like':'%'+_0x225b30[_0x8e57('0x28')][_0x8e57('0x39')]+'%'};return _0x49c15b;})});}_0x417e23=_[_0x8e57('0x3a')]({},_0x417e23,_0x225b30['options']);var _0x34a82b={'where':_0x417e23[_0x8e57('0x35')]};return db[_0x8e57('0x26')][_0x8e57('0x1a')](_0x34a82b)[_0x8e57('0x3b')](function(_0x433853){_0x37e71c['count']=_0x433853;if(_0x225b30['query'][_0x8e57('0x3c')]){_0x417e23[_0x8e57('0x3d')]=[{'all':!![]}];}return db[_0x8e57('0x26')][_0x8e57('0x3e')](_0x417e23);})[_0x8e57('0x3b')](function(_0x5cda3b){_0x37e71c['rows']=_0x5cda3b;return _0x37e71c;})[_0x8e57('0x3b')](respondWithFilteredResult(_0x32697f,_0x417e23))[_0x8e57('0x3f')](handleError(_0x32697f,null));};exports['show']=function(_0x730654,_0x237877){var _0x20e250={'raw':![],'where':{'id':_0x730654[_0x8e57('0x40')]['id']}},_0xc9cc4d={};_0xc9cc4d[_0x8e57('0x2d')]=_[_0x8e57('0x2b')](db[_0x8e57('0x26')][_0x8e57('0x27')]);_0xc9cc4d[_0x8e57('0x28')]=_[_0x8e57('0x2b')](_0x730654[_0x8e57('0x28')]);_0xc9cc4d[_0x8e57('0x36')]=_[_0x8e57('0x2c')](_0xc9cc4d[_0x8e57('0x2d')],_0xc9cc4d['query']);_0x20e250[_0x8e57('0x2e')]=_[_0x8e57('0x2c')](_0xc9cc4d[_0x8e57('0x2d')],qs[_0x8e57('0x2f')](_0x730654[_0x8e57('0x28')]['fields']));_0x20e250['attributes']=_0x20e250[_0x8e57('0x2e')][_0x8e57('0x30')]?_0x20e250[_0x8e57('0x2e')]:_0xc9cc4d[_0x8e57('0x2d')];if(_0x730654[_0x8e57('0x28')]['includeAll']){_0x20e250[_0x8e57('0x3d')]=[{'all':!![]}];}_0x20e250=_['merge']({},_0x20e250,_0x730654[_0x8e57('0x41')]);return db[_0x8e57('0x26')][_0x8e57('0x42')](_0x20e250)['then'](handleEntityNotFound(_0x237877,null))[_0x8e57('0x3b')](respondWithResult(_0x237877,null))[_0x8e57('0x3f')](handleError(_0x237877,null));};exports['create']=function(_0x275728,_0x49faba){return db['Dashboard'][_0x8e57('0x43')](_0x275728[_0x8e57('0x44')],{})[_0x8e57('0x3b')](respondWithResult(_0x49faba,0xc9))[_0x8e57('0x3f')](handleError(_0x49faba,null));};exports[_0x8e57('0x45')]=function(_0x2207e7,_0x37ca92){var _0x539769={'raw':![],'where':{'id':_0x2207e7[_0x8e57('0x40')]['id']}},_0x35868f={};_0x35868f['model']=_[_0x8e57('0x2b')](db[_0x8e57('0x26')][_0x8e57('0x27')]);_0x539769['attributes']=_['intersection'](_0x35868f['model'],qs[_0x8e57('0x2f')](_0x2207e7['query']['fields']));_0x539769[_0x8e57('0x2e')]=_0x539769[_0x8e57('0x2e')][_0x8e57('0x30')]?_0x539769[_0x8e57('0x2e')]:_0x35868f[_0x8e57('0x2d')];if(_0x2207e7[_0x8e57('0x28')][_0x8e57('0x3c')]){_0x539769[_0x8e57('0x3d')]=[{'all':!![]}];}_0x539769=_[_0x8e57('0x3a')]({},_0x539769,_0x2207e7['options']);return db[_0x8e57('0x26')][_0x8e57('0x42')](_0x539769)[_0x8e57('0x3b')](handleEntityNotFound(_0x37ca92,null))[_0x8e57('0x3b')](function(_0x569caa){if(_0x569caa){var _0x3c8cf0=_0x569caa[_0x8e57('0x46')]({'plain':!![]});_0x3c8cf0=qs[_0x8e57('0x47')](_0x3c8cf0,['id','createdAt',_0x8e57('0x48')]);_0x2207e7['body']=_[_0x8e57('0x47')](_0x2207e7[_0x8e57('0x44')],['id',_0x8e57('0x49'),_0x8e57('0x48')]);return db['Dashboard'][_0x8e57('0x43')](_[_0x8e57('0x3a')](_0x3c8cf0,_0x2207e7['body']),{'include':_0x2207e7[_0x8e57('0x28')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x8e57('0x3b')](respondWithResult(_0x37ca92,0xc9))[_0x8e57('0x3f')](handleError(_0x37ca92,null));};exports[_0x8e57('0x4a')]=function(_0xcb8fe4,_0x2c7a86){if(_0xcb8fe4['body']['id']){delete _0xcb8fe4[_0x8e57('0x44')]['id'];}return db[_0x8e57('0x26')]['find']({'where':{'id':_0xcb8fe4[_0x8e57('0x40')]['id']}})[_0x8e57('0x3b')](handleEntityNotFound(_0x2c7a86,null))[_0x8e57('0x3b')](saveUpdates(_0xcb8fe4['body'],null))['then'](respondWithResult(_0x2c7a86,null))[_0x8e57('0x3f')](handleError(_0x2c7a86,null));};exports[_0x8e57('0x21')]=function(_0x55e509,_0x57bd3f){return db[_0x8e57('0x26')]['find']({'where':{'id':_0x55e509[_0x8e57('0x40')]['id']}})[_0x8e57('0x3b')](handleEntityNotFound(_0x57bd3f,null))[_0x8e57('0x3b')](removeEntity(_0x57bd3f,null))[_0x8e57('0x3f')](handleError(_0x57bd3f,null));};function widgetAttributes(_0x3c628a){try{switch(_0x3c628a[_0x8e57('0x4b')]){case'iframe':return[{'name':_0x8e57('0x4c'),'value':_0x3c628a['attrUrl']||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x0]?_0x3c628a[_0x8e57('0x4d')][0x0][_0x8e57('0x4e')]:undefined)||'https://'}];case _0x8e57('0x4f'):return[{'name':_0x8e57('0x50'),'value':_0x3c628a[_0x8e57('0x50')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a['attrs'][0x0]?_0x3c628a['attrs'][0x0][_0x8e57('0x4e')]:undefined)||''}];case _0x8e57('0x51'):return[{'name':'attrHourFormat','value':_0x3c628a[_0x8e57('0x52')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x0]?_0x3c628a[_0x8e57('0x4d')][0x0][_0x8e57('0x4e')]:undefined)||'HH:mm:ss'},{'name':_0x8e57('0x53'),'value':_0x3c628a[_0x8e57('0x53')]||(_0x3c628a['attrs']&&_0x3c628a[_0x8e57('0x4d')][0x1]?_0x3c628a[_0x8e57('0x4d')][0x1][_0x8e57('0x4e')]:undefined)||_0x8e57('0x54')},{'name':'attrFontSize','value':_0x3c628a['attrFontSize']||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a['attrs'][0x2]?_0x3c628a['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x8e57('0x55'),'value':_0x3c628a[_0x8e57('0x55')]||(_0x3c628a['attrs']&&_0x3c628a['attrs'][0x0]?_0x3c628a[_0x8e57('0x4d')][0x0][_0x8e57('0x4e')]:undefined)||_0x8e57('0x56')},{'name':_0x8e57('0x57'),'value':_0x3c628a[_0x8e57('0x57')]||(_0x3c628a['attrs']&&_0x3c628a['attrs'][0x1]?_0x3c628a[_0x8e57('0x4d')][0x1][_0x8e57('0x4e')]:undefined)||[]},{'name':'attrFontSize','value':_0x3c628a[_0x8e57('0x58')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x2]?_0x3c628a[_0x8e57('0x4d')][0x2][_0x8e57('0x4e')]:undefined)||0x14}];case _0x8e57('0x59'):case'pie-chart':return[{'name':'attrSerie1','value':_0x3c628a['attrSerie1']||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x0]?_0x3c628a['attrs'][0x0]['value']:undefined)||_0x8e57('0x56')},{'name':'attrSerie2','value':_0x3c628a[_0x8e57('0x5a')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x1]?_0x3c628a[_0x8e57('0x4d')][0x1]['value']:undefined)||null},{'name':_0x8e57('0x5b'),'value':_0x3c628a[_0x8e57('0x5b')]||(_0x3c628a['attrs']&&_0x3c628a['attrs'][0x2]?_0x3c628a[_0x8e57('0x4d')][0x2]['value']:undefined)||null},{'name':_0x8e57('0x57'),'value':_0x3c628a[_0x8e57('0x57')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x3]?_0x3c628a[_0x8e57('0x4d')][0x3][_0x8e57('0x4e')]:undefined)||[]}];case _0x8e57('0x5c'):return[{'name':_0x8e57('0x5d'),'value':_0x3c628a[_0x8e57('0x5d')]||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a[_0x8e57('0x4d')][0x0]?_0x3c628a['attrs'][0x0][_0x8e57('0x4e')]:undefined)||null},{'name':_0x8e57('0x5e'),'value':_0x3c628a['attrRefresh']||(_0x3c628a[_0x8e57('0x4d')]&&_0x3c628a['attrs'][0x1]?_0x3c628a[_0x8e57('0x4d')][0x1][_0x8e57('0x4e')]:undefined)||0x0}];default:return[];}}catch(_0x2a41ba){logger['error'](_0x8e57('0x5f'),JSON[_0x8e57('0x60')](_0x2a41ba));return[];}}exports[_0x8e57('0x61')]=function(_0x52429a,_0x3927d2,_0x1336ad){if(_0x52429a[_0x8e57('0x44')]['id']){delete _0x52429a[_0x8e57('0x44')]['id'];}return db[_0x8e57('0x26')]['find']({'where':{'id':_0x52429a['params']['id']}})['then'](handleEntityNotFound(_0x3927d2,null))[_0x8e57('0x3b')](function(_0x5cff69){if(_0x5cff69){_0x52429a['body'][_0x8e57('0x62')]=_0x5cff69['id'];_0x52429a[_0x8e57('0x44')][_0x8e57('0x4d')]=widgetAttributes(_0x52429a[_0x8e57('0x44')]);return db[_0x8e57('0x63')][_0x8e57('0x43')](_0x52429a['body']);}})[_0x8e57('0x3b')](respondWithResult(_0x3927d2,null))['catch'](handleError(_0x3927d2,null));};exports[_0x8e57('0x64')]=function(_0x5f58ee,_0x45143a,_0x21bae7){var _0x5f42c1={};var _0x578149={};var _0x310b52;var _0xaed299;return db[_0x8e57('0x26')][_0x8e57('0x65')]({'where':{'id':_0x5f58ee['params']['id']}})[_0x8e57('0x3b')](handleEntityNotFound(_0x45143a,null))[_0x8e57('0x3b')](function(_0x21fdda){if(_0x21fdda){_0x310b52=_0x21fdda;_0x578149[_0x8e57('0x2d')]=_['keys'](db[_0x8e57('0x63')]['rawAttributes']);_0x578149[_0x8e57('0x28')]=_[_0x8e57('0x2b')](_0x5f58ee[_0x8e57('0x28')]);_0x578149[_0x8e57('0x36')]=_['intersection'](_0x578149[_0x8e57('0x2d')],_0x578149[_0x8e57('0x28')]);_0x5f42c1[_0x8e57('0x2e')]=_[_0x8e57('0x2c')](_0x578149[_0x8e57('0x2d')],qs['fields'](_0x5f58ee[_0x8e57('0x28')][_0x8e57('0x2f')]));_0x5f42c1['attributes']=_0x5f42c1[_0x8e57('0x2e')][_0x8e57('0x30')]?_0x5f42c1[_0x8e57('0x2e')]:_0x578149['model'];_0x5f42c1[_0x8e57('0x33')]=qs['sort'](_0x5f58ee['query'][_0x8e57('0x34')]);_0x5f42c1[_0x8e57('0x35')]=qs['filters'](_['pick'](_0x5f58ee['query'],_0x578149['filters']));if(_0x5f58ee['query'][_0x8e57('0x39')]){_0x5f42c1[_0x8e57('0x35')]=_[_0x8e57('0x3a')](_0x5f42c1[_0x8e57('0x35')],{'$or':_[_0x8e57('0x66')](_0x5f42c1['attributes'],function(_0x11b706){var _0x4d1e28={};_0x4d1e28[_0x11b706]={'$like':'%'+_0x5f58ee['query'][_0x8e57('0x39')]+'%'};return _0x4d1e28;})});}_0x5f42c1=_[_0x8e57('0x3a')]({},_0x5f42c1,_0x5f58ee[_0x8e57('0x41')]);return _0x310b52[_0x8e57('0x64')](_0x5f42c1);}})[_0x8e57('0x3b')](function(_0xcac7a7){if(_0xcac7a7){_0xaed299=_0xcac7a7['length'];if(!_0x5f58ee['query'][_0x8e57('0x31')](_0x8e57('0x32'))){_0x5f42c1[_0x8e57('0x1c')]=qs[_0x8e57('0x1c')](_0x5f58ee[_0x8e57('0x28')][_0x8e57('0x1c')]);_0x5f42c1[_0x8e57('0x1b')]=qs[_0x8e57('0x1b')](_0x5f58ee[_0x8e57('0x28')][_0x8e57('0x1b')]);}return _0x310b52[_0x8e57('0x64')](_0x5f42c1);}})['then'](function(_0x2b2eb8){if(_0x2b2eb8){return _0x2b2eb8?{'count':_0xaed299,'rows':_0x2b2eb8}:null;}})[_0x8e57('0x3b')](respondWithResult(_0x45143a,null))['catch'](handleError(_0x45143a,null));}; \ No newline at end of file +var _0x21db=['HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','error','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','moment','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','Dashboard','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','day','add','filter','merge','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','clone','get','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock'];(function(_0x1a78f0,_0x398b53){var _0x3704e5=function(_0x210c13){while(--_0x210c13){_0x1a78f0['push'](_0x1a78f0['shift']());}};_0x3704e5(++_0x398b53);}(_0x21db,0xde));var _0xb21d=function(_0x2668d4,_0x2bbebc){_0x2668d4=_0x2668d4-0x0;var _0x341317=_0x21db[_0x2668d4];return _0x341317;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb21d('0x0'));var BPromise=require(_0xb21d('0x1'));var Mustache=require('mustache');var util=require(_0xb21d('0x2'));var path=require(_0xb21d('0x3'));var sox=require('sox');var csv=require(_0xb21d('0x4'));var ejs=require(_0xb21d('0x5'));var fs=require('fs');var _=require(_0xb21d('0x6'));var squel=require(_0xb21d('0x7'));var crypto=require('crypto');var jsforce=require(_0xb21d('0x8'));var deskjs=require(_0xb21d('0x9'));var toCsv=require(_0xb21d('0x4'));var querystring=require(_0xb21d('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xb21d('0xb'))(_0xb21d('0xc'));var utils=require(_0xb21d('0xd'));var config=require(_0xb21d('0xe'));var db=require(_0xb21d('0xf'))['db'];var socket=require(_0xb21d('0x10'))({'host':'localhost','port':0x18eb});require('./dashboard.socket')[_0xb21d('0x11')](socket);function respondWithStatusCode(_0x4edd4f,_0x16d864){_0x16d864=_0x16d864||0xcc;return function(_0x3f9f25){if(_0x3f9f25){return _0x4edd4f[_0xb21d('0x12')](_0x16d864);}return _0x4edd4f[_0xb21d('0x13')](_0x16d864)[_0xb21d('0x14')]();};}function respondWithResult(_0x369622,_0xa5558e){_0xa5558e=_0xa5558e||0xc8;return function(_0x1a597a){if(_0x1a597a){return _0x369622[_0xb21d('0x13')](_0xa5558e)[_0xb21d('0x15')](_0x1a597a);}};}function respondWithFilteredResult(_0x29be21,_0x46cb6e){return function(_0x50d476){if(_0x50d476){var _0x40339b=_0x50d476[_0xb21d('0x16')],_0x581272=_0x46cb6e[_0xb21d('0x17')],_0x5f8080=_0x46cb6e[_0xb21d('0x17')]+_0x46cb6e[_0xb21d('0x18')],_0x254a38;if(_0x5f8080>=_0x40339b){_0x5f8080=_0x40339b;_0x254a38=0xc8;}else{_0x254a38=0xce;}_0x29be21[_0xb21d('0x13')](_0x254a38);return _0x29be21[_0xb21d('0x19')](_0xb21d('0x1a'),_0x581272+'-'+_0x5f8080+'/'+_0x40339b)[_0xb21d('0x15')](_0x50d476);}return null;};}function patchUpdates(_0x2321d3){return function(_0x4ddc86){try{jsonpatch[_0xb21d('0x1b')](_0x4ddc86,_0x2321d3,!![]);}catch(_0x5c1bce){return BPromise[_0xb21d('0x1c')](_0x5c1bce);}return _0x4ddc86['save']();};}function saveUpdates(_0x4c072d,_0x6c5b0e){return function(_0x442551){if(_0x442551){return _0x442551[_0xb21d('0x1d')](_0x4c072d)[_0xb21d('0x1e')](function(_0x30e106){return _0x30e106;});}return null;};}function removeEntity(_0x394c94,_0x119416){return function(_0x81f53d){if(_0x81f53d){return _0x81f53d[_0xb21d('0x1f')]()['then'](function(){_0x394c94[_0xb21d('0x13')](0xcc)[_0xb21d('0x14')]();});}};}function handleEntityNotFound(_0x6a6df9,_0x1910fd){return function(_0x3ccd77){if(!_0x3ccd77){_0x6a6df9['sendStatus'](0x194);}return _0x3ccd77;};}function handleError(_0xa71467,_0x128c53){_0x128c53=_0x128c53||0x1f4;return function(_0x562708){logger['error'](_0x562708[_0xb21d('0x20')]);if(_0x562708[_0xb21d('0x21')]){delete _0x562708['name'];}_0xa71467[_0xb21d('0x13')](_0x128c53)[_0xb21d('0x22')](_0x562708);};}exports[_0xb21d('0x23')]=function(_0x5a4c8d,_0xc77c25){var _0x2efa65={},_0x30ef59={},_0xf89472={'count':0x0,'rows':[]};var _0x1d2ae2=db[_0xb21d('0x24')][_0xb21d('0x25')];_0x30ef59[_0xb21d('0x26')]=_[_0xb21d('0x27')](_0x1d2ae2);var _0x44cb54={'dateStart':_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x29')],'dateEnd':_0x5a4c8d[_0xb21d('0x28')]['dateEnd']};delete _0x5a4c8d['query']['dateStart'];delete _0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x2a')];_0x30ef59['query']=_[_0xb21d('0x27')](_0x5a4c8d[_0xb21d('0x28')]);_0x30ef59[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x30ef59[_0xb21d('0x26')],_0x30ef59[_0xb21d('0x28')]);_0x2efa65[_0xb21d('0x2d')]=_['intersection'](_0x30ef59[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x5a4c8d['query'][_0xb21d('0x2e')]));_0x2efa65[_0xb21d('0x2d')]=_0x2efa65['attributes'][_0xb21d('0x2f')]?_0x2efa65['attributes']:_0x30ef59[_0xb21d('0x26')];if(!_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x30')]('nolimit')){_0x2efa65[_0xb21d('0x18')]=qs[_0xb21d('0x18')](_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x18')]);_0x2efa65[_0xb21d('0x17')]=qs[_0xb21d('0x17')](_0x5a4c8d[_0xb21d('0x28')]['offset']);}_0x2efa65[_0xb21d('0x31')]=qs[_0xb21d('0x32')](_0x5a4c8d[_0xb21d('0x28')]['sort']);_0x2efa65[_0xb21d('0x33')]=qs[_0xb21d('0x2b')](_[_0xb21d('0x34')](_0x5a4c8d[_0xb21d('0x28')],_0x30ef59[_0xb21d('0x2b')]));if(_0x44cb54[_0xb21d('0x29')]){if(_0x44cb54[_0xb21d('0x2a')]){_0x44cb54['dateEnd']=moment(_0x44cb54[_0xb21d('0x2a')])['add'](0x1,_0xb21d('0x35'));}else{_0x44cb54['dateEnd']=moment(_0x44cb54[_0xb21d('0x29')])[_0xb21d('0x36')](0x1,_0xb21d('0x35'));}_['merge'](_0x2efa65[_0xb21d('0x33')],{'createdAt':{'$gte':_0x44cb54[_0xb21d('0x29')],'$lte':_0x44cb54[_0xb21d('0x2a')]}});}if(_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x37')]){_0x2efa65['where']=_[_0xb21d('0x38')](_0x2efa65[_0xb21d('0x33')],{'$or':_[_0xb21d('0x39')](_0x2efa65['attributes'],function(_0x552044){var _0x4f810f={};_0x4f810f[_0x552044]={'$like':'%'+_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x37')]+'%'};return _0x4f810f;})});}_0x2efa65=_['merge']({},_0x2efa65,_0x5a4c8d[_0xb21d('0x3a')]);var _0x53208c={'where':_0x2efa65[_0xb21d('0x33')]};return db[_0xb21d('0x24')][_0xb21d('0x16')](_0x53208c)[_0xb21d('0x1e')](function(_0x40efd8){_0xf89472[_0xb21d('0x16')]=_0x40efd8;if(_0x5a4c8d[_0xb21d('0x28')][_0xb21d('0x3b')]){_0x2efa65[_0xb21d('0x3c')]=[{'all':!![]}];}return db[_0xb21d('0x24')][_0xb21d('0x3d')](_0x2efa65);})[_0xb21d('0x1e')](function(_0x24ad20){_0xf89472[_0xb21d('0x3e')]=_0x24ad20;return _0xf89472;})[_0xb21d('0x1e')](respondWithFilteredResult(_0xc77c25,_0x2efa65))['catch'](handleError(_0xc77c25,null));};exports[_0xb21d('0x3f')]=function(_0x20d6a6,_0x11093e){var _0x10cdff={'raw':![],'where':{'id':_0x20d6a6[_0xb21d('0x40')]['id']}},_0x5a2bda={};_0x5a2bda[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x24')][_0xb21d('0x25')]);_0x5a2bda['query']=_[_0xb21d('0x27')](_0x20d6a6[_0xb21d('0x28')]);_0x5a2bda[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x5a2bda[_0xb21d('0x26')],_0x5a2bda[_0xb21d('0x28')]);_0x10cdff[_0xb21d('0x2d')]=_[_0xb21d('0x2c')](_0x5a2bda[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x20d6a6['query'][_0xb21d('0x2e')]));_0x10cdff[_0xb21d('0x2d')]=_0x10cdff[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0x10cdff[_0xb21d('0x2d')]:_0x5a2bda['model'];if(_0x20d6a6[_0xb21d('0x28')]['includeAll']){_0x10cdff[_0xb21d('0x3c')]=[{'all':!![]}];}_0x10cdff=_['merge']({},_0x10cdff,_0x20d6a6[_0xb21d('0x3a')]);return db['Dashboard'][_0xb21d('0x41')](_0x10cdff)[_0xb21d('0x1e')](handleEntityNotFound(_0x11093e,null))[_0xb21d('0x1e')](respondWithResult(_0x11093e,null))[_0xb21d('0x42')](handleError(_0x11093e,null));};exports['create']=function(_0x217793,_0x58e016){return db[_0xb21d('0x24')][_0xb21d('0x43')](_0x217793[_0xb21d('0x44')],{})[_0xb21d('0x1e')](respondWithResult(_0x58e016,0xc9))[_0xb21d('0x42')](handleError(_0x58e016,null));};exports[_0xb21d('0x45')]=function(_0x1e7efd,_0x3ab4af){var _0xff95d4={'raw':![],'where':{'id':_0x1e7efd[_0xb21d('0x40')]['id']}},_0x368cd4={};_0x368cd4[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x24')]['rawAttributes']);_0xff95d4['attributes']=_[_0xb21d('0x2c')](_0x368cd4['model'],qs[_0xb21d('0x2e')](_0x1e7efd[_0xb21d('0x28')][_0xb21d('0x2e')]));_0xff95d4[_0xb21d('0x2d')]=_0xff95d4[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0xff95d4[_0xb21d('0x2d')]:_0x368cd4['model'];if(_0x1e7efd['query'][_0xb21d('0x3b')]){_0xff95d4[_0xb21d('0x3c')]=[{'all':!![]}];}_0xff95d4=_[_0xb21d('0x38')]({},_0xff95d4,_0x1e7efd['options']);return db[_0xb21d('0x24')]['find'](_0xff95d4)[_0xb21d('0x1e')](handleEntityNotFound(_0x3ab4af,null))[_0xb21d('0x1e')](function(_0x5ed5ce){if(_0x5ed5ce){var _0x23911a=_0x5ed5ce[_0xb21d('0x46')]({'plain':!![]});_0x23911a=qs[_0xb21d('0x47')](_0x23911a,['id',_0xb21d('0x48'),_0xb21d('0x49')]);_0x1e7efd[_0xb21d('0x44')]=_[_0xb21d('0x47')](_0x1e7efd[_0xb21d('0x44')],['id',_0xb21d('0x48'),_0xb21d('0x49')]);return db[_0xb21d('0x24')]['create'](_[_0xb21d('0x38')](_0x23911a,_0x1e7efd[_0xb21d('0x44')]),{'include':_0x1e7efd[_0xb21d('0x28')][_0xb21d('0x3b')]?[{'all':!![]}]:undefined});}})[_0xb21d('0x1e')](respondWithResult(_0x3ab4af,0xc9))[_0xb21d('0x42')](handleError(_0x3ab4af,null));};exports[_0xb21d('0x1d')]=function(_0x18adf1,_0x3f2984){if(_0x18adf1[_0xb21d('0x44')]['id']){delete _0x18adf1[_0xb21d('0x44')]['id'];}return db['Dashboard'][_0xb21d('0x41')]({'where':{'id':_0x18adf1['params']['id']}})['then'](handleEntityNotFound(_0x3f2984,null))[_0xb21d('0x1e')](saveUpdates(_0x18adf1['body'],null))[_0xb21d('0x1e')](respondWithResult(_0x3f2984,null))[_0xb21d('0x42')](handleError(_0x3f2984,null));};exports[_0xb21d('0x1f')]=function(_0xdaf81a,_0x5cfdbb){return db[_0xb21d('0x24')][_0xb21d('0x41')]({'where':{'id':_0xdaf81a[_0xb21d('0x40')]['id']}})[_0xb21d('0x1e')](handleEntityNotFound(_0x5cfdbb,null))[_0xb21d('0x1e')](removeEntity(_0x5cfdbb,null))[_0xb21d('0x42')](handleError(_0x5cfdbb,null));};function widgetAttributes(_0x833c27){try{switch(_0x833c27['type']){case _0xb21d('0x4a'):return[{'name':_0xb21d('0x4b'),'value':_0x833c27[_0xb21d('0x4b')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||'https://'}];case _0xb21d('0x4e'):return[{'name':'attrPath','value':_0x833c27[_0xb21d('0x4f')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||''}];case _0xb21d('0x50'):return[{'name':'attrHourFormat','value':_0x833c27['attrHourFormat']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x51')},{'name':_0xb21d('0x52'),'value':_0x833c27['attrTimezone']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||'0.00'},{'name':_0xb21d('0x53'),'value':_0x833c27[_0xb21d('0x53')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27['attrs'][0x2][_0xb21d('0x4d')]:undefined)||0xc}];case _0xb21d('0x54'):return[{'name':_0xb21d('0x55'),'value':_0x833c27[_0xb21d('0x55')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x56')},{'name':'attrVoiceQueues','value':_0x833c27[_0xb21d('0x57')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||[]},{'name':_0xb21d('0x53'),'value':_0x833c27[_0xb21d('0x53')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27[_0xb21d('0x4c')][0x2]['value']:undefined)||0x14}];case _0xb21d('0x58'):case'pie-chart':return[{'name':_0xb21d('0x59'),'value':_0x833c27[_0xb21d('0x59')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x0]?_0x833c27[_0xb21d('0x4c')][0x0][_0xb21d('0x4d')]:undefined)||_0xb21d('0x56')},{'name':_0xb21d('0x5a'),'value':_0x833c27[_0xb21d('0x5a')]||(_0x833c27['attrs']&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27[_0xb21d('0x4c')][0x1][_0xb21d('0x4d')]:undefined)||null},{'name':_0xb21d('0x5b'),'value':_0x833c27[_0xb21d('0x5b')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x2]?_0x833c27[_0xb21d('0x4c')][0x2][_0xb21d('0x4d')]:undefined)||null},{'name':_0xb21d('0x57'),'value':_0x833c27[_0xb21d('0x57')]||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x3]?_0x833c27[_0xb21d('0x4c')][0x3][_0xb21d('0x4d')]:undefined)||[]}];case'web-report':return[{'name':_0xb21d('0x5c'),'value':_0x833c27['attrReport']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27['attrs'][0x0]?_0x833c27[_0xb21d('0x4c')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x833c27['attrRefresh']||(_0x833c27[_0xb21d('0x4c')]&&_0x833c27[_0xb21d('0x4c')][0x1]?_0x833c27['attrs'][0x1][_0xb21d('0x4d')]:undefined)||0x0}];default:return[];}}catch(_0x28a26a){logger[_0xb21d('0x5d')](_0xb21d('0x5e'),JSON[_0xb21d('0x5f')](_0x28a26a));return[];}}exports[_0xb21d('0x60')]=function(_0xc390e0,_0x2f4654,_0x4ee6f0){if(_0xc390e0[_0xb21d('0x44')]['id']){delete _0xc390e0[_0xb21d('0x44')]['id'];}return db[_0xb21d('0x24')][_0xb21d('0x41')]({'where':{'id':_0xc390e0['params']['id']}})[_0xb21d('0x1e')](handleEntityNotFound(_0x2f4654,null))[_0xb21d('0x1e')](function(_0x106fb0){if(_0x106fb0){_0xc390e0[_0xb21d('0x44')][_0xb21d('0x61')]=_0x106fb0['id'];_0xc390e0[_0xb21d('0x44')][_0xb21d('0x4c')]=widgetAttributes(_0xc390e0[_0xb21d('0x44')]);return db[_0xb21d('0x62')][_0xb21d('0x43')](_0xc390e0['body']);}})[_0xb21d('0x1e')](respondWithResult(_0x2f4654,null))[_0xb21d('0x42')](handleError(_0x2f4654,null));};exports[_0xb21d('0x63')]=function(_0x27c9f1,_0x1fe9df,_0x277876){var _0x174597={};var _0x483627={};var _0x1e1fab;var _0x2713e8;return db['Dashboard']['findOne']({'where':{'id':_0x27c9f1[_0xb21d('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fe9df,null))[_0xb21d('0x1e')](function(_0x4e13d6){if(_0x4e13d6){_0x1e1fab=_0x4e13d6;_0x483627[_0xb21d('0x26')]=_[_0xb21d('0x27')](db[_0xb21d('0x62')][_0xb21d('0x25')]);_0x483627[_0xb21d('0x28')]=_[_0xb21d('0x27')](_0x27c9f1['query']);_0x483627[_0xb21d('0x2b')]=_[_0xb21d('0x2c')](_0x483627[_0xb21d('0x26')],_0x483627['query']);_0x174597[_0xb21d('0x2d')]=_[_0xb21d('0x2c')](_0x483627[_0xb21d('0x26')],qs[_0xb21d('0x2e')](_0x27c9f1['query'][_0xb21d('0x2e')]));_0x174597[_0xb21d('0x2d')]=_0x174597[_0xb21d('0x2d')][_0xb21d('0x2f')]?_0x174597[_0xb21d('0x2d')]:_0x483627[_0xb21d('0x26')];_0x174597[_0xb21d('0x31')]=qs[_0xb21d('0x32')](_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x32')]);_0x174597['where']=qs[_0xb21d('0x2b')](_[_0xb21d('0x34')](_0x27c9f1[_0xb21d('0x28')],_0x483627[_0xb21d('0x2b')]));if(_0x27c9f1['query'][_0xb21d('0x37')]){_0x174597[_0xb21d('0x33')]=_[_0xb21d('0x38')](_0x174597[_0xb21d('0x33')],{'$or':_[_0xb21d('0x39')](_0x174597['attributes'],function(_0x49a2ce){var _0x1fc036={};_0x1fc036[_0x49a2ce]={'$like':'%'+_0x27c9f1['query'][_0xb21d('0x37')]+'%'};return _0x1fc036;})});}_0x174597=_[_0xb21d('0x38')]({},_0x174597,_0x27c9f1['options']);return _0x1e1fab['getItems'](_0x174597);}})['then'](function(_0x5a060d){if(_0x5a060d){_0x2713e8=_0x5a060d[_0xb21d('0x2f')];if(!_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x30')](_0xb21d('0x64'))){_0x174597[_0xb21d('0x18')]=qs[_0xb21d('0x18')](_0x27c9f1['query'][_0xb21d('0x18')]);_0x174597[_0xb21d('0x17')]=qs['offset'](_0x27c9f1[_0xb21d('0x28')][_0xb21d('0x17')]);}return _0x1e1fab[_0xb21d('0x63')](_0x174597);}})[_0xb21d('0x1e')](function(_0x2e779c){if(_0x2e779c){return _0x2e779c?{'count':_0x2713e8,'rows':_0x2e779c}:null;}})['then'](respondWithResult(_0x1fe9df,null))[_0xb21d('0x42')](handleError(_0x1fe9df,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4b39a46..7bb6288 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 _0x349a=['events','Dashboard','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x1df2bc,_0x6ec254){var _0x2ef3be=function(_0xc5d4c2){while(--_0xc5d4c2){_0x1df2bc['push'](_0x1df2bc['shift']());}};_0x2ef3be(++_0x6ec254);}(_0x349a,0xd8));var _0xa349=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x349a[_0x439d59];return _0x3670c7;};'use strict';var EventEmitter=require(_0xa349('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xa349('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xa349('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa349('0x3'),'afterDestroy':'remove'};function emitEvent(_0x336fb1){return function(_0x42e8fa,_0x12348c,_0x180272){DashboardEvents[_0xa349('0x4')](_0x336fb1+':'+_0x42e8fa['id'],_0x42e8fa);DashboardEvents[_0xa349('0x4')](_0x336fb1,_0x42e8fa);_0x180272(null);};}for(var e in events){if(events[_0xa349('0x5')](e)){var event=events[e];Dashboard[_0xa349('0x6')](e,emitEvent(event));}}module[_0xa349('0x7')]=DashboardEvents; \ No newline at end of file +var _0xb98b=['Dashboard','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xb98b,0xee));var _0xbb98=function(_0x18514e,_0x551acd){_0x18514e=_0x18514e-0x0;var _0x14fe42=_0xb98b[_0x18514e];return _0x14fe42;};'use strict';var EventEmitter=require(_0xbb98('0x0'));var Dashboard=require(_0xbb98('0x1'))['db'][_0xbb98('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb98('0x3'),'afterUpdate':_0xbb98('0x4'),'afterDestroy':_0xbb98('0x5')};function emitEvent(_0x20affe){return function(_0x30c675,_0x5411c4,_0xcbfba4){DashboardEvents[_0xbb98('0x6')](_0x20affe+':'+_0x30c675['id'],_0x30c675);DashboardEvents[_0xbb98('0x6')](_0x20affe,_0x30c675);_0xcbfba4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xbb98('0x7')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index dc6264b..c789401 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 _0x7d8a=['Dashboard','dashboards','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./dashboard.attributes','exports','define'];(function(_0x27adff,_0x431b76){var _0x146999=function(_0x19de08){while(--_0x19de08){_0x27adff['push'](_0x27adff['shift']());}};_0x146999(++_0x431b76);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x7d8a[_0x179e11];return _0x549f04;};'use strict';var _=require(_0xa7d8('0x0'));var util=require(_0xa7d8('0x1'));var logger=require(_0xa7d8('0x2'))(_0xa7d8('0x3'));var moment=require(_0xa7d8('0x4'));var BPromise=require(_0xa7d8('0x5'));var rp=require(_0xa7d8('0x6'));var attributes=require(_0xa7d8('0x7'));module[_0xa7d8('0x8')]=function(_0x199cdd,_0x1162e1){return _0x199cdd[_0xa7d8('0x9')](_0xa7d8('0xa'),attributes,{'tableName':_0xa7d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cd0=['define','Dashboard','dashboards','lodash','api','bluebird','request-promise','./dashboard.attributes','exports'];(function(_0x1794d6,_0x193740){var _0x10af9e=function(_0x4295d6){while(--_0x4295d6){_0x1794d6['push'](_0x1794d6['shift']());}};_0x10af9e(++_0x193740);}(_0x3cd0,0x8a));var _0x03cd=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0x3cd0[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0x03cd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x03cd('0x1'));var moment=require('moment');var BPromise=require(_0x03cd('0x2'));var rp=require(_0x03cd('0x3'));var attributes=require(_0x03cd('0x4'));module[_0x03cd('0x5')]=function(_0x3d4a90,_0x5a7068){return _0x3d4a90[_0x03cd('0x6')](_0x03cd('0x7'),attributes,{'tableName':_0x03cd('0x8'),'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 71b1a3e..d115329 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 _0xc50c=['../../config/utils','rpc','jayson/promise','http','socket.io-emitter','localhost','register','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3b4698,_0x43348e){var _0x5108be=function(_0x5b8140){while(--_0x5b8140){_0x3b4698['push'](_0x3b4698['shift']());}};_0x5108be(++_0x43348e);}(_0xc50c,0x96));var _0xcc50=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xc50c[_0x29d94e];return _0x106237;};'use strict';var _=require(_0xcc50('0x0'));var util=require(_0xcc50('0x1'));var moment=require('moment');var BPromise=require(_0xcc50('0x2'));var rs=require(_0xcc50('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xcc50('0x4'));var logger=require('../../config/logger')(_0xcc50('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc50('0x6'));var client=jayson['client'][_0xcc50('0x7')]({'port':0x232a});var socket=require(_0xcc50('0x8'))({'host':_0xcc50('0x9'),'port':0x18eb});require('./dashboard.socket')[_0xcc50('0xa')](socket);function respondWithRpcPromise(_0x9952fa,_0x3fec03,_0x68fa40){return new BPromise(function(_0x241c04,_0x1dbc9b){return client['request'](_0x9952fa,_0x68fa40)[_0xcc50('0xb')](function(_0x382f76){logger[_0xcc50('0xc')](_0xcc50('0xd'),_0x3fec03,_0xcc50('0xe'));logger[_0xcc50('0xf')](_0xcc50('0x10'),_0x3fec03,'request\x20sent',JSON['stringify'](_0x382f76));if(_0x382f76['error']){if(_0x382f76[_0xcc50('0x11')][_0xcc50('0x12')]===0x1f4){logger[_0xcc50('0x11')](_0xcc50('0xd'),_0x3fec03,_0x382f76[_0xcc50('0x11')][_0xcc50('0x13')]);return _0x1dbc9b(_0x382f76[_0xcc50('0x11')][_0xcc50('0x13')]);}logger[_0xcc50('0x11')](_0xcc50('0xd'),_0x3fec03,_0x382f76['error'][_0xcc50('0x13')]);return _0x241c04(_0x382f76[_0xcc50('0x11')][_0xcc50('0x13')]);}else{logger[_0xcc50('0xc')](_0xcc50('0xd'),_0x3fec03,'request\x20sent');_0x241c04(_0x382f76[_0xcc50('0x14')][_0xcc50('0x13')]);}})[_0xcc50('0x15')](function(_0x3f328){logger['error'](_0xcc50('0xd'),_0x3fec03,_0x3f328);_0x1dbc9b(_0x3f328);});});} \ No newline at end of file +var _0x9af7=['rpc','../../config/environment','jayson/promise','client','http','localhost','./dashboard.socket','register','request','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5b2011,_0x59cd2e){var _0xca3680=function(_0x53f4d9){while(--_0x53f4d9){_0x5b2011['push'](_0x5b2011['shift']());}};_0xca3680(++_0x59cd2e);}(_0x9af7,0x7a));var _0x79af=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9af7[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x79af('0x0'));var util=require(_0x79af('0x1'));var moment=require(_0x79af('0x2'));var BPromise=require(_0x79af('0x3'));var rs=require(_0x79af('0x4'));var fs=require('fs');var db=require(_0x79af('0x5'))['db'];var utils=require(_0x79af('0x6'));var logger=require(_0x79af('0x7'))(_0x79af('0x8'));var config=require(_0x79af('0x9'));var jayson=require(_0x79af('0xa'));var client=jayson[_0x79af('0xb')][_0x79af('0xc')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x79af('0xd'),'port':0x18eb});require(_0x79af('0xe'))[_0x79af('0xf')](socket);function respondWithRpcPromise(_0x2cb88f,_0x299ac3,_0x5c4b20){return new BPromise(function(_0x33bf67,_0xe17707){return client[_0x79af('0x10')](_0x2cb88f,_0x5c4b20)['then'](function(_0x387993){logger['info'](_0x79af('0x11'),_0x299ac3,_0x79af('0x12'));logger[_0x79af('0x13')](_0x79af('0x14'),_0x299ac3,_0x79af('0x12'),JSON['stringify'](_0x387993));if(_0x387993[_0x79af('0x15')]){if(_0x387993['error'][_0x79af('0x16')]===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x299ac3,_0x387993[_0x79af('0x15')][_0x79af('0x17')]);return _0xe17707(_0x387993['error'][_0x79af('0x17')]);}logger[_0x79af('0x15')](_0x79af('0x11'),_0x299ac3,_0x387993[_0x79af('0x15')][_0x79af('0x17')]);return _0x33bf67(_0x387993[_0x79af('0x15')][_0x79af('0x17')]);}else{logger['info'](_0x79af('0x11'),_0x299ac3,_0x79af('0x12'));_0x33bf67(_0x387993[_0x79af('0x18')]['message']);}})[_0x79af('0x19')](function(_0x3b39be){logger['error'](_0x79af('0x11'),_0x299ac3,_0x3b39be);_0xe17707(_0x3b39be);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 2b90dfb..67222f4 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 _0x1678=['update','emit','removeListener','register','length','dashboard:','save','remove'];(function(_0x2f02ad,_0x1d1f28){var _0x2e1f05=function(_0x849014){while(--_0x849014){_0x2f02ad['push'](_0x2f02ad['shift']());}};_0x2e1f05(++_0x1d1f28);}(_0x1678,0x1d6));var _0x8167=function(_0x2538ee,_0xee8bf9){_0x2538ee=_0x2538ee-0x0;var _0x3542be=_0x1678[_0x2538ee];return _0x3542be;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x8167('0x0'),_0x8167('0x1'),_0x8167('0x2')];function createListener(_0x381ee1,_0x38f8ed){return function(_0xad43fe){_0x38f8ed[_0x8167('0x3')](_0x381ee1,_0xad43fe);};}function removeListener(_0x370b8e,_0x1a6478){return function(){DashboardEvents[_0x8167('0x4')](_0x370b8e,_0x1a6478);};}exports[_0x8167('0x5')]=function(_0x5db0be){for(var _0x1e0d03=0x0,_0x3a486a=events[_0x8167('0x6')];_0x1e0d03<_0x3a486a;_0x1e0d03++){var _0x122308=events[_0x1e0d03];var _0x56c65a=createListener(_0x8167('0x7')+_0x122308,_0x5db0be);DashboardEvents['on'](_0x122308,_0x56c65a);}}; \ No newline at end of file +var _0xa07e=['save','remove','removeListener','length','./dashboard.events'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0xa07e,0x10d));var _0xea07=function(_0x1f7ecc,_0x5e12fc){_0x1f7ecc=_0x1f7ecc-0x0;var _0x285151=_0xa07e[_0x1f7ecc];return _0x285151;};'use strict';var DashboardEvents=require(_0xea07('0x0'));var events=[_0xea07('0x1'),_0xea07('0x2'),'update'];function createListener(_0x5eefb9,_0x41fb56){return function(_0x1aa67f){_0x41fb56['emit'](_0x5eefb9,_0x1aa67f);};}function removeListener(_0x521e71,_0xbf50a3){return function(){DashboardEvents[_0xea07('0x3')](_0x521e71,_0xbf50a3);};}exports['register']=function(_0x170684){for(var _0x374cab=0x0,_0x2d9a90=events[_0xea07('0x4')];_0x374cab<_0x2d9a90;_0x374cab++){var _0x3165f4=events[_0x374cab];var _0x5f35d3=createListener('dashboard:'+_0x3165f4,_0x170684);DashboardEvents['on'](_0x3165f4,_0x5f35d3);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 3a0a05a..14040ee 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 _0x56c0=['post','create','clone','addItem','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','get','show','/:id/items','getItems'];(function(_0x2601b1,_0x459335){var _0x4c0910=function(_0x34b0aa){while(--_0x34b0aa){_0x2601b1['push'](_0x2601b1['shift']());}};_0x4c0910(++_0x459335);}(_0x56c0,0x1d7));var _0x056c=function(_0xbb5c55,_0xad78ba){_0xbb5c55=_0xbb5c55-0x0;var _0x4121b8=_0x56c0[_0xbb5c55];return _0x4121b8;};'use strict';var multer=require(_0x056c('0x0'));var util=require(_0x056c('0x1'));var path=require(_0x056c('0x2'));var express=require(_0x056c('0x3'));var router=express[_0x056c('0x4')]();var auth=require(_0x056c('0x5'));var interaction=require(_0x056c('0x6'));var config=require('../../config/environment');var controller=require(_0x056c('0x7'));router['get']('/',auth[_0x056c('0x8')](),controller['index']);router[_0x056c('0x9')]('/:id',auth[_0x056c('0x8')](),controller[_0x056c('0xa')]);router[_0x056c('0x9')](_0x056c('0xb'),auth[_0x056c('0x8')](),controller[_0x056c('0xc')]);router[_0x056c('0xd')]('/',auth[_0x056c('0x8')](),controller[_0x056c('0xe')]);router[_0x056c('0xd')]('/:id/clone',auth[_0x056c('0x8')](),controller[_0x056c('0xf')]);router[_0x056c('0xd')](_0x056c('0xb'),auth[_0x056c('0x8')](),controller[_0x056c('0x10')]);router['put'](_0x056c('0x11'),auth[_0x056c('0x8')](),controller[_0x056c('0x12')]);router[_0x056c('0x13')](_0x056c('0x11'),auth['isAuthenticated'](),controller[_0x056c('0x14')]);module[_0x056c('0x15')]=router; \ No newline at end of file +var _0x9ec0=['index','/:id','show','/:id/items','post','create','/:id/clone','update','delete','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x534cd7,_0x574fd5){var _0x25a9a2=function(_0x33bef3){while(--_0x33bef3){_0x534cd7['push'](_0x534cd7['shift']());}};_0x25a9a2(++_0x574fd5);}(_0x9ec0,0x1bf));var _0x09ec=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x9ec0[_0x40ad05];return _0x5cc00f;};'use strict';var multer=require(_0x09ec('0x0'));var util=require(_0x09ec('0x1'));var path=require(_0x09ec('0x2'));var express=require(_0x09ec('0x3'));var router=express[_0x09ec('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x09ec('0x5'));var config=require(_0x09ec('0x6'));var controller=require('./dashboard.controller');router[_0x09ec('0x7')]('/',auth[_0x09ec('0x8')](),controller[_0x09ec('0x9')]);router[_0x09ec('0x7')](_0x09ec('0xa'),auth[_0x09ec('0x8')](),controller[_0x09ec('0xb')]);router[_0x09ec('0x7')](_0x09ec('0xc'),auth[_0x09ec('0x8')](),controller['getItems']);router[_0x09ec('0xd')]('/',auth[_0x09ec('0x8')](),controller[_0x09ec('0xe')]);router[_0x09ec('0xd')](_0x09ec('0xf'),auth[_0x09ec('0x8')](),controller['clone']);router['post'](_0x09ec('0xc'),auth[_0x09ec('0x8')](),controller['addItem']);router['put']('/:id',auth[_0x09ec('0x8')](),controller[_0x09ec('0x10')]);router[_0x09ec('0x11')](_0x09ec('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x09ec('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 1c41a96..2b39449 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 _0x73c6=['sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff'];(function(_0x57a8fa,_0x234b99){var _0x5dd375=function(_0x49cfc6){while(--_0x49cfc6){_0x57a8fa['push'](_0x57a8fa['shift']());}};_0x5dd375(++_0x234b99);}(_0x73c6,0x1b2));var _0x673c=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x73c6[_0x2112d4];return _0x434972;};'use strict';var Sequelize=require(_0x673c('0x0'));var squel=require(_0x673c('0x1'));var _=require(_0x673c('0x2'));module[_0x673c('0x3')]={'title':{'type':Sequelize[_0x673c('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0x673c('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x673c('0x5')](_0x673c('0x6')),'get':function(){try{return JSON[_0x673c('0x7')](this[_0x673c('0x8')](_0x673c('0x9')));}catch(_0xa4fe4a){return[];}},'set':function(_0x2daac6){try{this[_0x673c('0xa')](_0x673c('0x9'),JSON[_0x673c('0xb')](_0x2daac6));}catch(_0x20b59c){this[_0x673c('0xa')](_0x673c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x673c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x673c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x673c('0xc')]},'col':{'type':Sequelize[_0x673c('0xc')]},'background':{'type':Sequelize[_0x673c('0x4')],'allowNull':![],'defaultValue':_0x673c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x673c('0x4')]}}; \ No newline at end of file +var _0x020a=['INTEGER','#ffffff','sequelize','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue'];(function(_0x3b0b91,_0x5bdb01){var _0x24950a=function(_0x1af66f){while(--_0x1af66f){_0x3b0b91['push'](_0x3b0b91['shift']());}};_0x24950a(++_0x5bdb01);}(_0x020a,0xdf));var _0xa020=function(_0x450689,_0x3b857c){_0x450689=_0x450689-0x0;var _0x46ffb0=_0x020a[_0x450689];return _0x46ffb0;};'use strict';var Sequelize=require(_0xa020('0x0'));var squel=require('squel');var _=require(_0xa020('0x1'));module[_0xa020('0x2')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa020('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa020('0x4')](_0xa020('0x5')),'get':function(){try{return JSON[_0xa020('0x6')](this[_0xa020('0x7')](_0xa020('0x8')));}catch(_0x47b091){return[];}},'set':function(_0x5834af){try{this['setDataValue'](_0xa020('0x8'),JSON[_0xa020('0x9')](_0x5834af));}catch(_0x33e296){this[_0xa020('0xa')](_0xa020('0x8'),JSON[_0xa020('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xa020('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa020('0xb')]},'background':{'type':Sequelize[_0xa020('0x3')],'allowNull':![],'defaultValue':_0xa020('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa020('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa020('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 29a4a0a..90a7210 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 _0x3cae=['apply','reject','save','then','destroy','error','stack','name','send','show','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','find','params','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./dashboardItem.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x3cae,0x8d));var _0xe3ca=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3cae[_0x4cf98e];return _0x1623ac;};'use strict';var jsonpatch=require(_0xe3ca('0x0'));var rp=require('request-promise');var moment=require(_0xe3ca('0x1'));var BPromise=require(_0xe3ca('0x2'));var Mustache=require('mustache');var util=require(_0xe3ca('0x3'));var path=require(_0xe3ca('0x4'));var sox=require(_0xe3ca('0x5'));var csv=require('to-csv');var ejs=require(_0xe3ca('0x6'));var fs=require('fs');var _=require(_0xe3ca('0x7'));var squel=require(_0xe3ca('0x8'));var crypto=require(_0xe3ca('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3ca('0xa'));var querystring=require(_0xe3ca('0xb'));var Papa=require(_0xe3ca('0xc'));var qs=require(_0xe3ca('0xd'));var logger=require(_0xe3ca('0xe'))(_0xe3ca('0xf'));var utils=require(_0xe3ca('0x10'));var config=require('../../config/environment');var db=require(_0xe3ca('0x11'))['db'];var socket=require(_0xe3ca('0x12'))({'host':_0xe3ca('0x13'),'port':0x18eb});require(_0xe3ca('0x14'))[_0xe3ca('0x15')](socket);function respondWithStatusCode(_0x11f6e5,_0x2e0ffd){_0x2e0ffd=_0x2e0ffd||0xcc;return function(_0x25daa4){if(_0x25daa4){return _0x11f6e5[_0xe3ca('0x16')](_0x2e0ffd);}return _0x11f6e5['status'](_0x2e0ffd)[_0xe3ca('0x17')]();};}function respondWithResult(_0x277182,_0x4ee8e4){_0x4ee8e4=_0x4ee8e4||0xc8;return function(_0x3eadc3){if(_0x3eadc3){return _0x277182[_0xe3ca('0x18')](_0x4ee8e4)[_0xe3ca('0x19')](_0x3eadc3);}};}function respondWithFilteredResult(_0x4d79f8,_0x4a048f){return function(_0xf18756){if(_0xf18756){var _0x3b4b91=_0xf18756[_0xe3ca('0x1a')],_0x2de447=_0x4a048f[_0xe3ca('0x1b')],_0x3ee891=_0x4a048f[_0xe3ca('0x1b')]+_0x4a048f[_0xe3ca('0x1c')],_0x3d99b2;if(_0x3ee891>=_0x3b4b91){_0x3ee891=_0x3b4b91;_0x3d99b2=0xc8;}else{_0x3d99b2=0xce;}_0x4d79f8[_0xe3ca('0x18')](_0x3d99b2);return _0x4d79f8[_0xe3ca('0x1d')](_0xe3ca('0x1e'),_0x2de447+'-'+_0x3ee891+'/'+_0x3b4b91)[_0xe3ca('0x19')](_0xf18756);}return null;};}function patchUpdates(_0x2414c6){return function(_0x5edf4a){try{jsonpatch[_0xe3ca('0x1f')](_0x5edf4a,_0x2414c6,!![]);}catch(_0x432bda){return BPromise[_0xe3ca('0x20')](_0x432bda);}return _0x5edf4a[_0xe3ca('0x21')]();};}function saveUpdates(_0x457394,_0x2be1cb){return function(_0x80efc6){if(_0x80efc6){return _0x80efc6['update'](_0x457394)[_0xe3ca('0x22')](function(_0x3f86ad){return _0x3f86ad;});}return null;};}function removeEntity(_0x4558c3,_0x124f8d){return function(_0x8fa26b){if(_0x8fa26b){return _0x8fa26b[_0xe3ca('0x23')]()[_0xe3ca('0x22')](function(){_0x4558c3[_0xe3ca('0x18')](0xcc)[_0xe3ca('0x17')]();});}};}function handleEntityNotFound(_0x4de3df,_0x25d61e){return function(_0x48f270){if(!_0x48f270){_0x4de3df[_0xe3ca('0x16')](0x194);}return _0x48f270;};}function handleError(_0x43bba1,_0x2d80ff){_0x2d80ff=_0x2d80ff||0x1f4;return function(_0x4d08ad){logger[_0xe3ca('0x24')](_0x4d08ad[_0xe3ca('0x25')]);if(_0x4d08ad['name']){delete _0x4d08ad[_0xe3ca('0x26')];}_0x43bba1['status'](_0x2d80ff)[_0xe3ca('0x27')](_0x4d08ad);};}exports[_0xe3ca('0x28')]=function(_0x5f40a2,_0x24d7fc){var _0x504ac4={'raw':![],'where':{'id':_0x5f40a2['params']['id']}},_0x5bfc85={};_0x5bfc85[_0xe3ca('0x29')]=_[_0xe3ca('0x2a')](db[_0xe3ca('0x2b')][_0xe3ca('0x2c')]);_0x5bfc85[_0xe3ca('0x2d')]=_[_0xe3ca('0x2a')](_0x5f40a2[_0xe3ca('0x2d')]);_0x5bfc85['filters']=_[_0xe3ca('0x2e')](_0x5bfc85[_0xe3ca('0x29')],_0x5bfc85[_0xe3ca('0x2d')]);_0x504ac4[_0xe3ca('0x2f')]=_[_0xe3ca('0x2e')](_0x5bfc85[_0xe3ca('0x29')],qs['fields'](_0x5f40a2['query'][_0xe3ca('0x30')]));_0x504ac4[_0xe3ca('0x2f')]=_0x504ac4[_0xe3ca('0x2f')][_0xe3ca('0x31')]?_0x504ac4['attributes']:_0x5bfc85[_0xe3ca('0x29')];if(_0x5f40a2[_0xe3ca('0x2d')][_0xe3ca('0x32')]){_0x504ac4[_0xe3ca('0x33')]=[{'all':!![]}];}_0x504ac4=_[_0xe3ca('0x34')]({},_0x504ac4,_0x5f40a2[_0xe3ca('0x35')]);return db['DashboardItem'][_0xe3ca('0x36')](_0x504ac4)['then'](handleEntityNotFound(_0x24d7fc,null))[_0xe3ca('0x22')](respondWithResult(_0x24d7fc,null))['catch'](handleError(_0x24d7fc,null));};exports[_0xe3ca('0x23')]=function(_0x5d2055,_0x2329bc){return db[_0xe3ca('0x2b')][_0xe3ca('0x36')]({'where':{'id':_0x5d2055[_0xe3ca('0x37')]['id']}})['then'](handleEntityNotFound(_0x2329bc,null))[_0xe3ca('0x22')](removeEntity(_0x2329bc,null))[_0xe3ca('0x38')](handleError(_0x2329bc,null));};function widgetAttributes(_0x2bac27){try{switch(_0x2bac27[_0xe3ca('0x39')]){case _0xe3ca('0x3a'):return[{'name':_0xe3ca('0x3b'),'value':_0x2bac27[_0xe3ca('0x3b')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x0]?_0x2bac27[_0xe3ca('0x3c')][0x0][_0xe3ca('0x3d')]:undefined)||_0xe3ca('0x3e')}];case _0xe3ca('0x3f'):return[{'name':_0xe3ca('0x40'),'value':_0x2bac27[_0xe3ca('0x40')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27['attrs'][0x0]?_0x2bac27[_0xe3ca('0x3c')][0x0][_0xe3ca('0x3d')]:undefined)||''}];case _0xe3ca('0x41'):return[{'name':_0xe3ca('0x42'),'value':_0x2bac27[_0xe3ca('0x42')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x0]?_0x2bac27[_0xe3ca('0x3c')][0x0][_0xe3ca('0x3d')]:undefined)||_0xe3ca('0x43')},{'name':_0xe3ca('0x44'),'value':_0x2bac27[_0xe3ca('0x44')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x1]?_0x2bac27['attrs'][0x1][_0xe3ca('0x3d')]:undefined)||_0xe3ca('0x45')},{'name':_0xe3ca('0x46'),'value':_0x2bac27[_0xe3ca('0x46')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x2]?_0x2bac27[_0xe3ca('0x3c')][0x2][_0xe3ca('0x3d')]:undefined)||0xc}];case _0xe3ca('0x47'):return[{'name':'attrMetric','value':_0x2bac27[_0xe3ca('0x48')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27['attrs'][0x0]?_0x2bac27['attrs'][0x0][_0xe3ca('0x3d')]:undefined)||'total'},{'name':_0xe3ca('0x49'),'value':_0x2bac27[_0xe3ca('0x49')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x1]?_0x2bac27[_0xe3ca('0x3c')][0x1][_0xe3ca('0x3d')]:undefined)||[]},{'name':'attrFontSize','value':_0x2bac27[_0xe3ca('0x46')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x2]?_0x2bac27['attrs'][0x2][_0xe3ca('0x3d')]:undefined)||0x14}];case'multibar-chart':case _0xe3ca('0x4a'):return[{'name':_0xe3ca('0x4b'),'value':_0x2bac27[_0xe3ca('0x4b')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27['attrs'][0x0]?_0x2bac27['attrs'][0x0][_0xe3ca('0x3d')]:undefined)||_0xe3ca('0x4c')},{'name':'attrSerie2','value':_0x2bac27[_0xe3ca('0x4d')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27['attrs'][0x1]?_0x2bac27[_0xe3ca('0x3c')][0x1][_0xe3ca('0x3d')]:undefined)||null},{'name':'attrSerie3','value':_0x2bac27[_0xe3ca('0x4e')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x2]?_0x2bac27[_0xe3ca('0x3c')][0x2][_0xe3ca('0x3d')]:undefined)||null},{'name':_0xe3ca('0x49'),'value':_0x2bac27[_0xe3ca('0x49')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27['attrs'][0x3]?_0x2bac27[_0xe3ca('0x3c')][0x3]['value']:undefined)||[]}];case'web-report':return[{'name':_0xe3ca('0x4f'),'value':_0x2bac27[_0xe3ca('0x4f')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x0]?_0x2bac27[_0xe3ca('0x3c')][0x0][_0xe3ca('0x3d')]:undefined)||null},{'name':_0xe3ca('0x50'),'value':_0x2bac27[_0xe3ca('0x50')]||(_0x2bac27[_0xe3ca('0x3c')]&&_0x2bac27[_0xe3ca('0x3c')][0x1]?_0x2bac27[_0xe3ca('0x3c')][0x1][_0xe3ca('0x3d')]:undefined)||0x0}];default:return[];}}catch(_0x43ebdd){logger[_0xe3ca('0x24')](_0xe3ca('0x51'),JSON[_0xe3ca('0x52')](_0x43ebdd));return[];}}exports[_0xe3ca('0x53')]=function(_0x7f773c,_0x2a9d0f){if(_0x7f773c[_0xe3ca('0x54')]){_0x7f773c[_0xe3ca('0x54')]['attrs']=widgetAttributes(_0x7f773c[_0xe3ca('0x54')]);}return db[_0xe3ca('0x2b')][_0xe3ca('0x53')](_0x7f773c['body'],{})['then'](respondWithResult(_0x2a9d0f,0xc9))[_0xe3ca('0x38')](handleError(_0x2a9d0f,null));};exports[_0xe3ca('0x55')]=function(_0x1aeb18,_0x52055d){if(_0x1aeb18[_0xe3ca('0x54')]['id']){delete _0x1aeb18[_0xe3ca('0x54')]['id'];}_0x1aeb18[_0xe3ca('0x54')][_0xe3ca('0x3c')]=widgetAttributes(_0x1aeb18['body']);return db['DashboardItem'][_0xe3ca('0x36')]({'where':{'id':_0x1aeb18[_0xe3ca('0x37')]['id']}})['then'](handleEntityNotFound(_0x52055d,null))[_0xe3ca('0x22')](saveUpdates(_0x1aeb18[_0xe3ca('0x54')],null))[_0xe3ca('0x22')](respondWithResult(_0x52055d,null))[_0xe3ca('0x38')](handleError(_0x52055d,null));}; \ No newline at end of file +var _0x98d5=['multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','create','body','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues'];(function(_0xfc0bc,_0x432c2e){var _0x2d9484=function(_0x1474da){while(--_0x1474da){_0xfc0bc['push'](_0xfc0bc['shift']());}};_0x2d9484(++_0x432c2e);}(_0x98d5,0x1d8));var _0x598d=function(_0x4aa3ae,_0x4e60c9){_0x4aa3ae=_0x4aa3ae-0x0;var _0x130c6c=_0x98d5[_0x4aa3ae];return _0x130c6c;};'use strict';var jsonpatch=require(_0x598d('0x0'));var rp=require(_0x598d('0x1'));var moment=require(_0x598d('0x2'));var BPromise=require(_0x598d('0x3'));var Mustache=require('mustache');var util=require(_0x598d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x598d('0x5'));var ejs=require(_0x598d('0x6'));var fs=require('fs');var _=require(_0x598d('0x7'));var squel=require('squel');var crypto=require(_0x598d('0x8'));var jsforce=require(_0x598d('0x9'));var deskjs=require(_0x598d('0xa'));var toCsv=require('to-csv');var querystring=require(_0x598d('0xb'));var Papa=require(_0x598d('0xc'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x598d('0xd'));var utils=require(_0x598d('0xe'));var config=require(_0x598d('0xf'));var db=require(_0x598d('0x10'))['db'];var socket=require(_0x598d('0x11'))({'host':'localhost','port':0x18eb});require(_0x598d('0x12'))['register'](socket);function respondWithStatusCode(_0x7c0da6,_0x4745b8){_0x4745b8=_0x4745b8||0xcc;return function(_0x2b38d4){if(_0x2b38d4){return _0x7c0da6[_0x598d('0x13')](_0x4745b8);}return _0x7c0da6[_0x598d('0x14')](_0x4745b8)[_0x598d('0x15')]();};}function respondWithResult(_0x1a242e,_0x387841){_0x387841=_0x387841||0xc8;return function(_0x2a9ddf){if(_0x2a9ddf){return _0x1a242e[_0x598d('0x14')](_0x387841)[_0x598d('0x16')](_0x2a9ddf);}};}function respondWithFilteredResult(_0x1af83a,_0xd573ee){return function(_0x409d1e){if(_0x409d1e){var _0x34be05=_0x409d1e[_0x598d('0x17')],_0x52af2d=_0xd573ee[_0x598d('0x18')],_0x43b80f=_0xd573ee[_0x598d('0x18')]+_0xd573ee[_0x598d('0x19')],_0x17f4e3;if(_0x43b80f>=_0x34be05){_0x43b80f=_0x34be05;_0x17f4e3=0xc8;}else{_0x17f4e3=0xce;}_0x1af83a['status'](_0x17f4e3);return _0x1af83a[_0x598d('0x1a')]('Content-Range',_0x52af2d+'-'+_0x43b80f+'/'+_0x34be05)[_0x598d('0x16')](_0x409d1e);}return null;};}function patchUpdates(_0x4eb54d){return function(_0x5101af){try{jsonpatch[_0x598d('0x1b')](_0x5101af,_0x4eb54d,!![]);}catch(_0x59f947){return BPromise[_0x598d('0x1c')](_0x59f947);}return _0x5101af[_0x598d('0x1d')]();};}function saveUpdates(_0x586a53,_0x54e1f3){return function(_0x4fa550){if(_0x4fa550){return _0x4fa550[_0x598d('0x1e')](_0x586a53)['then'](function(_0x5ede35){return _0x5ede35;});}return null;};}function removeEntity(_0x4b5586,_0x3ffbfa){return function(_0xaf9437){if(_0xaf9437){return _0xaf9437['destroy']()[_0x598d('0x1f')](function(){_0x4b5586['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x188506,_0x3cbef3){return function(_0x108a01){if(!_0x108a01){_0x188506[_0x598d('0x13')](0x194);}return _0x108a01;};}function handleError(_0x12674c,_0x50c8c3){_0x50c8c3=_0x50c8c3||0x1f4;return function(_0x49ce4b){logger[_0x598d('0x20')](_0x49ce4b[_0x598d('0x21')]);if(_0x49ce4b[_0x598d('0x22')]){delete _0x49ce4b[_0x598d('0x22')];}_0x12674c['status'](_0x50c8c3)[_0x598d('0x23')](_0x49ce4b);};}exports['show']=function(_0x5ee13d,_0x234dc0){var _0x410bc7={'raw':![],'where':{'id':_0x5ee13d[_0x598d('0x24')]['id']}},_0x400ce8={};_0x400ce8[_0x598d('0x25')]=_[_0x598d('0x26')](db['DashboardItem'][_0x598d('0x27')]);_0x400ce8[_0x598d('0x28')]=_[_0x598d('0x26')](_0x5ee13d['query']);_0x400ce8[_0x598d('0x29')]=_[_0x598d('0x2a')](_0x400ce8[_0x598d('0x25')],_0x400ce8[_0x598d('0x28')]);_0x410bc7['attributes']=_[_0x598d('0x2a')](_0x400ce8['model'],qs['fields'](_0x5ee13d[_0x598d('0x28')]['fields']));_0x410bc7[_0x598d('0x2b')]=_0x410bc7[_0x598d('0x2b')][_0x598d('0x2c')]?_0x410bc7[_0x598d('0x2b')]:_0x400ce8[_0x598d('0x25')];if(_0x5ee13d['query'][_0x598d('0x2d')]){_0x410bc7[_0x598d('0x2e')]=[{'all':!![]}];}_0x410bc7=_[_0x598d('0x2f')]({},_0x410bc7,_0x5ee13d[_0x598d('0x30')]);return db[_0x598d('0x31')][_0x598d('0x32')](_0x410bc7)[_0x598d('0x1f')](handleEntityNotFound(_0x234dc0,null))[_0x598d('0x1f')](respondWithResult(_0x234dc0,null))[_0x598d('0x33')](handleError(_0x234dc0,null));};exports['destroy']=function(_0x38af89,_0x29ce45){return db[_0x598d('0x31')]['find']({'where':{'id':_0x38af89['params']['id']}})[_0x598d('0x1f')](handleEntityNotFound(_0x29ce45,null))[_0x598d('0x1f')](removeEntity(_0x29ce45,null))[_0x598d('0x33')](handleError(_0x29ce45,null));};function widgetAttributes(_0x4e5ca6){try{switch(_0x4e5ca6[_0x598d('0x34')]){case _0x598d('0x35'):return[{'name':_0x598d('0x36'),'value':_0x4e5ca6[_0x598d('0x36')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6['attrs'][0x0][_0x598d('0x38')]:undefined)||_0x598d('0x39')}];case'custom':return[{'name':'attrPath','value':_0x4e5ca6[_0x598d('0x3a')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||''}];case _0x598d('0x3b'):return[{'name':_0x598d('0x3c'),'value':_0x4e5ca6['attrHourFormat']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0]['value']:undefined)||_0x598d('0x3d')},{'name':_0x598d('0x3e'),'value':_0x4e5ca6['attrTimezone']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6[_0x598d('0x37')][0x1][_0x598d('0x38')]:undefined)||_0x598d('0x3f')},{'name':'attrFontSize','value':_0x4e5ca6[_0x598d('0x40')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6['attrs'][0x2]?_0x4e5ca6['attrs'][0x2][_0x598d('0x38')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4e5ca6['attrMetric']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||_0x598d('0x41')},{'name':'attrVoiceQueues','value':_0x4e5ca6[_0x598d('0x42')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6['attrs'][0x1]['value']:undefined)||[]},{'name':_0x598d('0x40'),'value':_0x4e5ca6[_0x598d('0x40')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6['attrs'][0x2]?_0x4e5ca6[_0x598d('0x37')][0x2][_0x598d('0x38')]:undefined)||0x14}];case _0x598d('0x43'):case'pie-chart':return[{'name':_0x598d('0x44'),'value':_0x4e5ca6[_0x598d('0x44')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0]['value']:undefined)||'total'},{'name':_0x598d('0x45'),'value':_0x4e5ca6[_0x598d('0x45')]||(_0x4e5ca6['attrs']&&_0x4e5ca6['attrs'][0x1]?_0x4e5ca6['attrs'][0x1]['value']:undefined)||null},{'name':_0x598d('0x46'),'value':_0x4e5ca6[_0x598d('0x46')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x2]?_0x4e5ca6[_0x598d('0x37')][0x2][_0x598d('0x38')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4e5ca6['attrVoiceQueues']||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x3]?_0x4e5ca6['attrs'][0x3][_0x598d('0x38')]:undefined)||[]}];case _0x598d('0x47'):return[{'name':_0x598d('0x48'),'value':_0x4e5ca6[_0x598d('0x48')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x0]?_0x4e5ca6[_0x598d('0x37')][0x0][_0x598d('0x38')]:undefined)||null},{'name':_0x598d('0x49'),'value':_0x4e5ca6[_0x598d('0x49')]||(_0x4e5ca6[_0x598d('0x37')]&&_0x4e5ca6[_0x598d('0x37')][0x1]?_0x4e5ca6['attrs'][0x1][_0x598d('0x38')]:undefined)||0x0}];default:return[];}}catch(_0x5ceeb6){logger[_0x598d('0x20')](_0x598d('0x4a'),JSON['stringify'](_0x5ceeb6));return[];}}exports[_0x598d('0x4b')]=function(_0xfe2c28,_0x45696f){if(_0xfe2c28[_0x598d('0x4c')]){_0xfe2c28[_0x598d('0x4c')]['attrs']=widgetAttributes(_0xfe2c28['body']);}return db[_0x598d('0x31')][_0x598d('0x4b')](_0xfe2c28[_0x598d('0x4c')],{})[_0x598d('0x1f')](respondWithResult(_0x45696f,0xc9))['catch'](handleError(_0x45696f,null));};exports[_0x598d('0x1e')]=function(_0x13ba09,_0x275343){if(_0x13ba09[_0x598d('0x4c')]['id']){delete _0x13ba09[_0x598d('0x4c')]['id'];}_0x13ba09[_0x598d('0x4c')][_0x598d('0x37')]=widgetAttributes(_0x13ba09['body']);return db[_0x598d('0x31')][_0x598d('0x32')]({'where':{'id':_0x13ba09[_0x598d('0x24')]['id']}})['then'](handleEntityNotFound(_0x275343,null))[_0x598d('0x1f')](saveUpdates(_0x13ba09[_0x598d('0x4c')],null))[_0x598d('0x1f')](respondWithResult(_0x275343,null))['catch'](handleError(_0x275343,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b1644e1..222bd42 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 _0xbec8=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','setMaxListeners'];(function(_0x37fbd6,_0x3a3f1e){var _0x144eac=function(_0x333b92){while(--_0x333b92){_0x37fbd6['push'](_0x37fbd6['shift']());}};_0x144eac(++_0x3a3f1e);}(_0xbec8,0x140));var _0x8bec=function(_0x32b122,_0x1ad490){_0x32b122=_0x32b122-0x0;var _0x4ad25a=_0xbec8[_0x32b122];return _0x4ad25a;};'use strict';var EventEmitter=require(_0x8bec('0x0'));var DashboardItem=require(_0x8bec('0x1'))['db'][_0x8bec('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x8bec('0x3')](0x0);var events={'afterCreate':_0x8bec('0x4'),'afterUpdate':'update','afterDestroy':_0x8bec('0x5')};function emitEvent(_0x29a684){return function(_0x418f5b,_0x50a652,_0x24bba9){DashboardItemEvents['emit'](_0x29a684+':'+_0x418f5b['id'],_0x418f5b);DashboardItemEvents[_0x8bec('0x6')](_0x29a684,_0x418f5b);_0x24bba9(null);};}for(var e in events){if(events[_0x8bec('0x7')](e)){var event=events[e];DashboardItem[_0x8bec('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xf213=['remove','emit','hook','exports','events','save','update'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xf213,0x162));var _0x3f21=function(_0x20c3ae,_0x37eae0){_0x20c3ae=_0x20c3ae-0x0;var _0x3946a9=_0xf213[_0x20c3ae];return _0x3946a9;};'use strict';var EventEmitter=require(_0x3f21('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3f21('0x1'),'afterUpdate':_0x3f21('0x2'),'afterDestroy':_0x3f21('0x3')};function emitEvent(_0x455024){return function(_0x14f92c,_0x301244,_0x3b025d){DashboardItemEvents[_0x3f21('0x4')](_0x455024+':'+_0x14f92c['id'],_0x14f92c);DashboardItemEvents[_0x3f21('0x4')](_0x455024,_0x14f92c);_0x3b025d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x3f21('0x5')](e,emitEvent(event));}}module[_0x3f21('0x6')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 5abe5e1..4218d1d 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 _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x4e38fd,_0x13d776){var _0x2fe8b7=function(_0x22127a){while(--_0x22127a){_0x4e38fd['push'](_0x4e38fd['shift']());}};_0x2fe8b7(++_0x13d776);}(_0x7a54,0x106));var _0x47a5=function(_0xdef6e0,_0x463fac){_0xdef6e0=_0xdef6e0-0x0;var _0x399093=_0x7a54[_0xdef6e0];return _0x399093;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','./dashboardItem.attributes','exports','define'];(function(_0x1ccf3d,_0x461209){var _0x5345c1=function(_0x55c638){while(--_0x55c638){_0x1ccf3d['push'](_0x1ccf3d['shift']());}};_0x5345c1(++_0x461209);}(_0x7a54,0x106));var _0x47a5=function(_0x1c83fb,_0x385d4f){_0x1c83fb=_0x1c83fb-0x0;var _0x3309c2=_0x7a54[_0x1c83fb];return _0x3309c2;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('DashboardItem',attributes,{'tableName':_0x47a5('0x8'),'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 9a44d30..9916555 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 _0xa9e0=['client','socket.io-emitter','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1da811,_0x2e30db){var _0x53858b=function(_0x4e70ce){while(--_0x4e70ce){_0x1da811['push'](_0x1da811['shift']());}};_0x53858b(++_0x2e30db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('DashboardItem,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});} \ No newline at end of file +var _0xa9e0=['client','socket.io-emitter','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c06ac,_0x568788){var _0x2333cb=function(_0xdb5c64){while(--_0xdb5c64){_0x4c06ac['push'](_0x4c06ac['shift']());}};_0x2333cb(++_0x568788);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});var socket=require(_0x0a9e('0x9'))({'host':_0x0a9e('0xa'),'port':0x18eb});require(_0x0a9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x503809,_0xe42b77,_0x56465b){return new BPromise(function(_0x52cace,_0x39753a){return client[_0x0a9e('0xc')](_0x503809,_0x56465b)[_0x0a9e('0xd')](function(_0x3ab53f){logger[_0x0a9e('0xe')](_0x0a9e('0xf'),_0xe42b77,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0xe42b77,'request\x20sent',JSON[_0x0a9e('0x10')](_0x3ab53f));if(_0x3ab53f[_0x0a9e('0x11')]){if(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x12')]===0x1f4){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f['error'][_0x0a9e('0x13')]);return _0x39753a(_0x3ab53f[_0x0a9e('0x11')][_0x0a9e('0x13')]);}logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x3ab53f[_0x0a9e('0x11')]['message']);return _0x52cace(_0x3ab53f[_0x0a9e('0x11')]['message']);}else{logger[_0x0a9e('0xe')]('DashboardItem,\x20%s,\x20%s',_0xe42b77,_0x0a9e('0x14'));_0x52cace(_0x3ab53f[_0x0a9e('0x15')]['message']);}})[_0x0a9e('0x16')](function(_0x5a0a06){logger[_0x0a9e('0x11')](_0x0a9e('0xf'),_0xe42b77,_0x5a0a06);_0x39753a(_0x5a0a06);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index e388147..c65b901 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 _0x55ca=['removeListener','register','./dashboardItem.events','save'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x55ca,0x126));var _0xa55c=function(_0x4b2993,_0xd46430){_0x4b2993=_0x4b2993-0x0;var _0x480074=_0x55ca[_0x4b2993];return _0x480074;};'use strict';var DashboardItemEvents=require(_0xa55c('0x0'));var events=[_0xa55c('0x1'),'remove','update'];function createListener(_0x49875a,_0x1c6ec3){return function(_0x267ea0){_0x1c6ec3['emit'](_0x49875a,_0x267ea0);};}function removeListener(_0x3b478a,_0x2db02a){return function(){DashboardItemEvents[_0xa55c('0x2')](_0x3b478a,_0x2db02a);};}exports[_0xa55c('0x3')]=function(_0x3c97c8){for(var _0x279caa=0x0,_0x36b623=events['length'];_0x279caa<_0x36b623;_0x279caa++){var _0x2121fd=events[_0x279caa];var _0x2537f0=createListener('dashboardItem:'+_0x2121fd,_0x3c97c8);DashboardItemEvents['on'](_0x2121fd,_0x2537f0);}}; \ No newline at end of file +var _0x3e74=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','remove','update'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3e74,0x175));var _0x43e7=function(_0xa616eb,_0x23488a){_0xa616eb=_0xa616eb-0x0;var _0x371c23=_0x3e74[_0xa616eb];return _0x371c23;};'use strict';var DashboardItemEvents=require(_0x43e7('0x0'));var events=['save',_0x43e7('0x1'),_0x43e7('0x2')];function createListener(_0x151ad2,_0x494e45){return function(_0x490ced){_0x494e45[_0x43e7('0x3')](_0x151ad2,_0x490ced);};}function removeListener(_0x4f9bbe,_0x128b0f){return function(){DashboardItemEvents[_0x43e7('0x4')](_0x4f9bbe,_0x128b0f);};}exports[_0x43e7('0x5')]=function(_0x1c503b){for(var _0xc98b9c=0x0,_0x503698=events[_0x43e7('0x6')];_0xc98b9c<_0x503698;_0xc98b9c++){var _0x3491d6=events[_0xc98b9c];var _0x2ede2d=createListener(_0x43e7('0x7')+_0x3491d6,_0x1c503b);DashboardItemEvents['on'](_0x3491d6,_0x2ede2d);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 8b8b68c..a1d7b97 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 _0x3b5b=['put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','show','post','create'];(function(_0x30853f,_0x4aa320){var _0x3c416d=function(_0x15d3d2){while(--_0x15d3d2){_0x30853f['push'](_0x30853f['shift']());}};_0x3c416d(++_0x4aa320);}(_0x3b5b,0x154));var _0xb3b5=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x3b5b[_0x3a7257];return _0x467d25;};'use strict';var multer=require(_0xb3b5('0x0'));var util=require(_0xb3b5('0x1'));var path=require(_0xb3b5('0x2'));var express=require(_0xb3b5('0x3'));var router=express['Router']();var auth=require(_0xb3b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3b5('0x5'));var controller=require(_0xb3b5('0x6'));router['get'](_0xb3b5('0x7'),auth[_0xb3b5('0x8')](),controller[_0xb3b5('0x9')]);router[_0xb3b5('0xa')]('/',auth[_0xb3b5('0x8')](),controller[_0xb3b5('0xb')]);router[_0xb3b5('0xc')](_0xb3b5('0x7'),auth['isAuthenticated'](),controller[_0xb3b5('0xd')]);router[_0xb3b5('0xe')](_0xb3b5('0x7'),auth[_0xb3b5('0x8')](),controller[_0xb3b5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x0c1f=['exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','get','show','post','isAuthenticated','create','put','/:id','update','destroy'];(function(_0x897040,_0x3f46be){var _0x5babf5=function(_0x3a2fa5){while(--_0x3a2fa5){_0x897040['push'](_0x897040['shift']());}};_0x5babf5(++_0x3f46be);}(_0x0c1f,0xb1));var _0xf0c1=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x0c1f[_0x5ee3d3];return _0x4b272f;};'use strict';var multer=require(_0xf0c1('0x0'));var util=require(_0xf0c1('0x1'));var path=require(_0xf0c1('0x2'));var express=require('express');var router=express[_0xf0c1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf0c1('0x4'));var config=require(_0xf0c1('0x5'));var controller=require('./dashboardItem.controller');router[_0xf0c1('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xf0c1('0x7')]);router[_0xf0c1('0x8')]('/',auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xa')]);router[_0xf0c1('0xb')](_0xf0c1('0xc'),auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xd')]);router['delete'](_0xf0c1('0xc'),auth[_0xf0c1('0x9')](),controller[_0xf0c1('0xe')]);module[_0xf0c1('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9472965..811c776 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 _0x94e6=['STRING','sequelize','exports'];(function(_0x1e0668,_0x567132){var _0xb553eb=function(_0x29d34e){while(--_0x29d34e){_0x1e0668['push'](_0x1e0668['shift']());}};_0xb553eb(++_0x567132);}(_0x94e6,0xac));var _0x694e=function(_0x3a834e,_0x3db360){_0x3a834e=_0x3a834e-0x0;var _0x5b282b=_0x94e6[_0x3a834e];return _0x5b282b;};'use strict';var Sequelize=require(_0x694e('0x0'));module[_0x694e('0x1')]={'name':{'type':Sequelize[_0x694e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9130=['sequelize','STRING'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x9130,0x1d6));var _0x0913=function(_0x564af9,_0xf53011){_0x564af9=_0x564af9-0x0;var _0x2ea46f=_0x9130[_0x564af9];return _0x2ea46f;};'use strict';var Sequelize=require(_0x0913('0x0'));module['exports']={'name':{'type':Sequelize[_0x0913('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 0927ed5..80e8e48 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 _0xd8b0=['reject','save','then','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x5df2a2,_0x24a9e9){var _0x5b7542=function(_0xef5284){while(--_0xef5284){_0x5df2a2['push'](_0x5df2a2['shift']());}};_0x5b7542(++_0x24a9e9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var jsonpatch=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d8b('0x2'));var path=require(_0x0d8b('0x3'));var sox=require(_0x0d8b('0x4'));var csv=require(_0x0d8b('0x5'));var ejs=require(_0x0d8b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d8b('0x7'));var jsforce=require(_0x0d8b('0x8'));var deskjs=require(_0x0d8b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0d8b('0xa'));var Papa=require(_0x0d8b('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d8b('0xc'))(_0x0d8b('0xd'));var utils=require(_0x0d8b('0xe'));var config=require(_0x0d8b('0xf'));var db=require(_0x0d8b('0x10'))['db'];function respondWithStatusCode(_0x1cac62,_0x2c5e9e){_0x2c5e9e=_0x2c5e9e||0xcc;return function(_0x28f87c){if(_0x28f87c){return _0x1cac62['sendStatus'](_0x2c5e9e);}return _0x1cac62[_0x0d8b('0x11')](_0x2c5e9e)['end']();};}function respondWithResult(_0x4225c4,_0xc574a3){_0xc574a3=_0xc574a3||0xc8;return function(_0x340cc4){if(_0x340cc4){return _0x4225c4[_0x0d8b('0x11')](_0xc574a3)[_0x0d8b('0x12')](_0x340cc4);}};}function respondWithFilteredResult(_0x32bb1a,_0x15dd0f){return function(_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=_0x31a8cc[_0x0d8b('0x13')],_0x2ce75e=_0x15dd0f[_0x0d8b('0x14')],_0x5ad086=_0x15dd0f['offset']+_0x15dd0f[_0x0d8b('0x15')],_0xe65334;if(_0x5ad086>=_0x1d4bbc){_0x5ad086=_0x1d4bbc;_0xe65334=0xc8;}else{_0xe65334=0xce;}_0x32bb1a[_0x0d8b('0x11')](_0xe65334);return _0x32bb1a[_0x0d8b('0x16')](_0x0d8b('0x17'),_0x2ce75e+'-'+_0x5ad086+'/'+_0x1d4bbc)[_0x0d8b('0x12')](_0x31a8cc);}return null;};}function patchUpdates(_0x5cd485){return function(_0x106a01){try{jsonpatch[_0x0d8b('0x18')](_0x106a01,_0x5cd485,!![]);}catch(_0x2fd0fc){return BPromise[_0x0d8b('0x19')](_0x2fd0fc);}return _0x106a01[_0x0d8b('0x1a')]();};}function saveUpdates(_0x18dd2d,_0x264b39){return function(_0xa3612a){if(_0xa3612a){return _0xa3612a['update'](_0x18dd2d)[_0x0d8b('0x1b')](function(_0x23d58f){return _0x23d58f;});}return null;};}function removeEntity(_0x196c0a,_0x143372){return function(_0x24e8ed){if(_0x24e8ed){return _0x24e8ed[_0x0d8b('0x1c')]()[_0x0d8b('0x1b')](function(){_0x196c0a[_0x0d8b('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0a1a,_0x33fb87){return function(_0x54a9a7){if(!_0x54a9a7){_0x4f0a1a['sendStatus'](0x194);}return _0x54a9a7;};}function handleError(_0x5527d8,_0x238728){_0x238728=_0x238728||0x1f4;return function(_0x2b924f){logger[_0x0d8b('0x1d')](_0x2b924f[_0x0d8b('0x1e')]);if(_0x2b924f[_0x0d8b('0x1f')]){delete _0x2b924f[_0x0d8b('0x1f')];}_0x5527d8[_0x0d8b('0x11')](_0x238728)[_0x0d8b('0x20')](_0x2b924f);};}exports[_0x0d8b('0x21')]=function(_0x5e5bc3,_0xe8bbee){var _0x4463ee={},_0x5363e3={},_0xe1ef20={'count':0x0,'rows':[]};var _0x4a0ae4=db[_0x0d8b('0x22')][_0x0d8b('0x23')];_0x5363e3[_0x0d8b('0x24')]=_['keys'](_0x4a0ae4);var _0x59a905={'dateStart':_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x26')],'dateEnd':_0x5e5bc3['query'][_0x0d8b('0x27')]};delete _0x5e5bc3['query'][_0x0d8b('0x26')];delete _0x5e5bc3['query'][_0x0d8b('0x27')];_0x5363e3['query']=_[_0x0d8b('0x28')](_0x5e5bc3['query']);_0x5363e3[_0x0d8b('0x29')]=_['intersection'](_0x5363e3[_0x0d8b('0x24')],_0x5363e3[_0x0d8b('0x25')]);_0x4463ee[_0x0d8b('0x2a')]=_['intersection'](_0x5363e3['model'],qs['fields'](_0x5e5bc3[_0x0d8b('0x25')]['fields']));_0x4463ee[_0x0d8b('0x2a')]=_0x4463ee['attributes']['length']?_0x4463ee[_0x0d8b('0x2a')]:_0x5363e3[_0x0d8b('0x24')];if(!_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x2b')](_0x0d8b('0x2c'))){_0x4463ee[_0x0d8b('0x15')]=qs[_0x0d8b('0x15')](_0x5e5bc3[_0x0d8b('0x25')]['limit']);_0x4463ee[_0x0d8b('0x14')]=qs[_0x0d8b('0x14')](_0x5e5bc3['query'][_0x0d8b('0x14')]);}_0x4463ee[_0x0d8b('0x2d')]=qs[_0x0d8b('0x2e')](_0x5e5bc3['query'][_0x0d8b('0x2e')]);_0x4463ee[_0x0d8b('0x2f')]=qs[_0x0d8b('0x29')](_[_0x0d8b('0x30')](_0x5e5bc3[_0x0d8b('0x25')],_0x5363e3['filters']));if(_0x59a905[_0x0d8b('0x26')]){if(_0x59a905[_0x0d8b('0x27')]){_0x59a905['dateEnd']=moment(_0x59a905[_0x0d8b('0x27')])[_0x0d8b('0x31')](0x1,_0x0d8b('0x32'));}else{_0x59a905[_0x0d8b('0x27')]=moment(_0x59a905[_0x0d8b('0x26')])['add'](0x1,'day');}_[_0x0d8b('0x33')](_0x4463ee['where'],{'createdAt':{'$gte':_0x59a905['dateStart'],'$lte':_0x59a905[_0x0d8b('0x27')]}});}if(_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]){_0x4463ee[_0x0d8b('0x2f')]=_[_0x0d8b('0x33')](_0x4463ee[_0x0d8b('0x2f')],{'$or':_['map'](_0x4463ee[_0x0d8b('0x2a')],function(_0x6a02ad){var _0x28fd82={};_0x28fd82[_0x6a02ad]={'$like':'%'+_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]+'%'};return _0x28fd82;})});}_0x4463ee=_[_0x0d8b('0x33')]({},_0x4463ee,_0x5e5bc3[_0x0d8b('0x35')]);var _0x5c980b={'where':_0x4463ee[_0x0d8b('0x2f')]};return db[_0x0d8b('0x22')][_0x0d8b('0x13')](_0x5c980b)[_0x0d8b('0x1b')](function(_0x59d3ad){_0xe1ef20[_0x0d8b('0x13')]=_0x59d3ad;if(_0x5e5bc3['query'][_0x0d8b('0x36')]){_0x4463ee[_0x0d8b('0x37')]=[{'all':!![]}];}return db[_0x0d8b('0x22')][_0x0d8b('0x38')](_0x4463ee);})[_0x0d8b('0x1b')](function(_0x3e632e){_0xe1ef20[_0x0d8b('0x39')]=_0x3e632e;return _0xe1ef20;})[_0x0d8b('0x1b')](respondWithFilteredResult(_0xe8bbee,_0x4463ee))[_0x0d8b('0x3a')](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x3b')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x24')]=_[_0x0d8b('0x28')](db[_0x0d8b('0x22')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x28')](_0x482069[_0x0d8b('0x25')]);_0x4d0811[_0x0d8b('0x29')]=_['intersection'](_0x4d0811[_0x0d8b('0x24')],_0x4d0811[_0x0d8b('0x25')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x24')],qs['fields'](_0x482069[_0x0d8b('0x25')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x2a')][_0x0d8b('0x3c')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x37')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x33')]({},_0x576050,_0x482069[_0x0d8b('0x35')]);return db['Disposition'][_0x0d8b('0x3d')](_0x576050)[_0x0d8b('0x1b')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x1b')](respondWithResult(_0x571acf,null))[_0x0d8b('0x3a')](handleError(_0x571acf,null));};exports[_0x0d8b('0x3e')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x22')][_0x0d8b('0x3e')](_0x2d5246[_0x0d8b('0x3f')],{})[_0x0d8b('0x1b')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x3a')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x40')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x3f')]['id']){delete _0x3e569b[_0x0d8b('0x3f')]['id'];}return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x1b')](respondWithResult(_0x570af8,null))[_0x0d8b('0x3a')](handleError(_0x570af8,null));};exports[_0x0d8b('0x1c')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x4396b5[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x1b')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));}; \ No newline at end of file +var _0xd8b0=['reject','save','then','destroy','error','stack','name','send','index','Disposition','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','apply'];(function(_0x4a8e2e,_0x2dab17){var _0x419372=function(_0x1bba3f){while(--_0x1bba3f){_0x4a8e2e['push'](_0x4a8e2e['shift']());}};_0x419372(++_0x2dab17);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0d8b('0x2'));var path=require(_0x0d8b('0x3'));var sox=require(_0x0d8b('0x4'));var csv=require(_0x0d8b('0x5'));var ejs=require(_0x0d8b('0x6'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x0d8b('0x7'));var jsforce=require(_0x0d8b('0x8'));var deskjs=require(_0x0d8b('0x9'));var toCsv=require('to-csv');var querystring=require(_0x0d8b('0xa'));var Papa=require(_0x0d8b('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x0d8b('0xc'))(_0x0d8b('0xd'));var utils=require(_0x0d8b('0xe'));var config=require(_0x0d8b('0xf'));var db=require(_0x0d8b('0x10'))['db'];function respondWithStatusCode(_0x1cac62,_0x2c5e9e){_0x2c5e9e=_0x2c5e9e||0xcc;return function(_0x28f87c){if(_0x28f87c){return _0x1cac62['sendStatus'](_0x2c5e9e);}return _0x1cac62[_0x0d8b('0x11')](_0x2c5e9e)['end']();};}function respondWithResult(_0x4225c4,_0xc574a3){_0xc574a3=_0xc574a3||0xc8;return function(_0x340cc4){if(_0x340cc4){return _0x4225c4[_0x0d8b('0x11')](_0xc574a3)[_0x0d8b('0x12')](_0x340cc4);}};}function respondWithFilteredResult(_0x32bb1a,_0x15dd0f){return function(_0x31a8cc){if(_0x31a8cc){var _0x1d4bbc=_0x31a8cc[_0x0d8b('0x13')],_0x2ce75e=_0x15dd0f[_0x0d8b('0x14')],_0x5ad086=_0x15dd0f['offset']+_0x15dd0f[_0x0d8b('0x15')],_0xe65334;if(_0x5ad086>=_0x1d4bbc){_0x5ad086=_0x1d4bbc;_0xe65334=0xc8;}else{_0xe65334=0xce;}_0x32bb1a[_0x0d8b('0x11')](_0xe65334);return _0x32bb1a[_0x0d8b('0x16')](_0x0d8b('0x17'),_0x2ce75e+'-'+_0x5ad086+'/'+_0x1d4bbc)[_0x0d8b('0x12')](_0x31a8cc);}return null;};}function patchUpdates(_0x5cd485){return function(_0x106a01){try{jsonpatch[_0x0d8b('0x18')](_0x106a01,_0x5cd485,!![]);}catch(_0x2fd0fc){return BPromise[_0x0d8b('0x19')](_0x2fd0fc);}return _0x106a01[_0x0d8b('0x1a')]();};}function saveUpdates(_0x18dd2d,_0x264b39){return function(_0xa3612a){if(_0xa3612a){return _0xa3612a['update'](_0x18dd2d)[_0x0d8b('0x1b')](function(_0x23d58f){return _0x23d58f;});}return null;};}function removeEntity(_0x196c0a,_0x143372){return function(_0x24e8ed){if(_0x24e8ed){return _0x24e8ed[_0x0d8b('0x1c')]()[_0x0d8b('0x1b')](function(){_0x196c0a[_0x0d8b('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f0a1a,_0x33fb87){return function(_0x54a9a7){if(!_0x54a9a7){_0x4f0a1a['sendStatus'](0x194);}return _0x54a9a7;};}function handleError(_0x5527d8,_0x238728){_0x238728=_0x238728||0x1f4;return function(_0x2b924f){logger[_0x0d8b('0x1d')](_0x2b924f[_0x0d8b('0x1e')]);if(_0x2b924f[_0x0d8b('0x1f')]){delete _0x2b924f[_0x0d8b('0x1f')];}_0x5527d8[_0x0d8b('0x11')](_0x238728)[_0x0d8b('0x20')](_0x2b924f);};}exports[_0x0d8b('0x21')]=function(_0x5e5bc3,_0xe8bbee){var _0x4463ee={},_0x5363e3={},_0xe1ef20={'count':0x0,'rows':[]};var _0x4a0ae4=db[_0x0d8b('0x22')][_0x0d8b('0x23')];_0x5363e3[_0x0d8b('0x24')]=_['keys'](_0x4a0ae4);var _0x59a905={'dateStart':_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x26')],'dateEnd':_0x5e5bc3['query'][_0x0d8b('0x27')]};delete _0x5e5bc3['query'][_0x0d8b('0x26')];delete _0x5e5bc3['query'][_0x0d8b('0x27')];_0x5363e3['query']=_[_0x0d8b('0x28')](_0x5e5bc3['query']);_0x5363e3[_0x0d8b('0x29')]=_['intersection'](_0x5363e3[_0x0d8b('0x24')],_0x5363e3[_0x0d8b('0x25')]);_0x4463ee[_0x0d8b('0x2a')]=_['intersection'](_0x5363e3['model'],qs['fields'](_0x5e5bc3[_0x0d8b('0x25')]['fields']));_0x4463ee[_0x0d8b('0x2a')]=_0x4463ee['attributes']['length']?_0x4463ee[_0x0d8b('0x2a')]:_0x5363e3[_0x0d8b('0x24')];if(!_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x2b')](_0x0d8b('0x2c'))){_0x4463ee[_0x0d8b('0x15')]=qs[_0x0d8b('0x15')](_0x5e5bc3[_0x0d8b('0x25')]['limit']);_0x4463ee[_0x0d8b('0x14')]=qs[_0x0d8b('0x14')](_0x5e5bc3['query'][_0x0d8b('0x14')]);}_0x4463ee[_0x0d8b('0x2d')]=qs[_0x0d8b('0x2e')](_0x5e5bc3['query'][_0x0d8b('0x2e')]);_0x4463ee[_0x0d8b('0x2f')]=qs[_0x0d8b('0x29')](_[_0x0d8b('0x30')](_0x5e5bc3[_0x0d8b('0x25')],_0x5363e3['filters']));if(_0x59a905[_0x0d8b('0x26')]){if(_0x59a905[_0x0d8b('0x27')]){_0x59a905['dateEnd']=moment(_0x59a905[_0x0d8b('0x27')])[_0x0d8b('0x31')](0x1,_0x0d8b('0x32'));}else{_0x59a905[_0x0d8b('0x27')]=moment(_0x59a905[_0x0d8b('0x26')])['add'](0x1,'day');}_[_0x0d8b('0x33')](_0x4463ee['where'],{'createdAt':{'$gte':_0x59a905['dateStart'],'$lte':_0x59a905[_0x0d8b('0x27')]}});}if(_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]){_0x4463ee[_0x0d8b('0x2f')]=_[_0x0d8b('0x33')](_0x4463ee[_0x0d8b('0x2f')],{'$or':_['map'](_0x4463ee[_0x0d8b('0x2a')],function(_0x6a02ad){var _0x28fd82={};_0x28fd82[_0x6a02ad]={'$like':'%'+_0x5e5bc3[_0x0d8b('0x25')][_0x0d8b('0x34')]+'%'};return _0x28fd82;})});}_0x4463ee=_[_0x0d8b('0x33')]({},_0x4463ee,_0x5e5bc3[_0x0d8b('0x35')]);var _0x5c980b={'where':_0x4463ee[_0x0d8b('0x2f')]};return db[_0x0d8b('0x22')][_0x0d8b('0x13')](_0x5c980b)[_0x0d8b('0x1b')](function(_0x59d3ad){_0xe1ef20[_0x0d8b('0x13')]=_0x59d3ad;if(_0x5e5bc3['query'][_0x0d8b('0x36')]){_0x4463ee[_0x0d8b('0x37')]=[{'all':!![]}];}return db[_0x0d8b('0x22')][_0x0d8b('0x38')](_0x4463ee);})[_0x0d8b('0x1b')](function(_0x3e632e){_0xe1ef20[_0x0d8b('0x39')]=_0x3e632e;return _0xe1ef20;})[_0x0d8b('0x1b')](respondWithFilteredResult(_0xe8bbee,_0x4463ee))[_0x0d8b('0x3a')](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x3b')]=function(_0x482069,_0x571acf){var _0x576050={'raw':!![],'where':{'id':_0x482069['params']['id']}},_0x4d0811={};_0x4d0811[_0x0d8b('0x24')]=_[_0x0d8b('0x28')](db[_0x0d8b('0x22')]['rawAttributes']);_0x4d0811['query']=_[_0x0d8b('0x28')](_0x482069[_0x0d8b('0x25')]);_0x4d0811[_0x0d8b('0x29')]=_['intersection'](_0x4d0811[_0x0d8b('0x24')],_0x4d0811[_0x0d8b('0x25')]);_0x576050['attributes']=_['intersection'](_0x4d0811[_0x0d8b('0x24')],qs['fields'](_0x482069[_0x0d8b('0x25')]['fields']));_0x576050['attributes']=_0x576050[_0x0d8b('0x2a')][_0x0d8b('0x3c')]?_0x576050['attributes']:_0x4d0811['model'];if(_0x482069['query']['includeAll']){_0x576050[_0x0d8b('0x37')]=[{'all':!![]}];}_0x576050=_[_0x0d8b('0x33')]({},_0x576050,_0x482069[_0x0d8b('0x35')]);return db['Disposition'][_0x0d8b('0x3d')](_0x576050)[_0x0d8b('0x1b')](handleEntityNotFound(_0x571acf,null))[_0x0d8b('0x1b')](respondWithResult(_0x571acf,null))[_0x0d8b('0x3a')](handleError(_0x571acf,null));};exports[_0x0d8b('0x3e')]=function(_0x2d5246,_0x11d22b){return db[_0x0d8b('0x22')][_0x0d8b('0x3e')](_0x2d5246[_0x0d8b('0x3f')],{})[_0x0d8b('0x1b')](respondWithResult(_0x11d22b,0xc9))[_0x0d8b('0x3a')](handleError(_0x11d22b,null));};exports[_0x0d8b('0x40')]=function(_0x3e569b,_0x570af8){if(_0x3e569b[_0x0d8b('0x3f')]['id']){delete _0x3e569b[_0x0d8b('0x3f')]['id'];}return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x3e569b['params']['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x570af8,null))['then'](saveUpdates(_0x3e569b['body'],null))[_0x0d8b('0x1b')](respondWithResult(_0x570af8,null))[_0x0d8b('0x3a')](handleError(_0x570af8,null));};exports[_0x0d8b('0x1c')]=function(_0x4396b5,_0x505d22){return db[_0x0d8b('0x22')][_0x0d8b('0x3d')]({'where':{'id':_0x4396b5[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x1b')](handleEntityNotFound(_0x505d22,null))[_0x0d8b('0x1b')](removeEntity(_0x505d22,null))['catch'](handleError(_0x505d22,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d98fbd1..db2e877 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 _0x5f2f=['name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x5a54c0,_0x3736c9){var _0xdc009=function(_0x1fd5a2){while(--_0x1fd5a2){_0x5a54c0['push'](_0x5a54c0['shift']());}};_0xdc009(++_0x3736c9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a8cb6,_0x4e3bc4){_0x2a8cb6=_0x2a8cb6-0x0;var _0x1cb58f=_0x5f2f[_0x2a8cb6];return _0x1cb58f;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xc'),'ListId']},{'unique':!![],'name':_0xf5f2('0xd'),'fields':[_0xf5f2('0xc'),_0xf5f2('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xf5f2('0xc'),_0xf5f2('0xf')]},{'unique':!![],'name':_0xf5f2('0x10'),'fields':['name',_0xf5f2('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xf5f2('0x12')]},{'unique':!![],'name':_0xf5f2('0x13'),'fields':['name',_0xf5f2('0x14')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f2f=['name_voice','name','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions'];(function(_0x19dbe7,_0x288ffb){var _0x14b88f=function(_0x1c9939){while(--_0x1c9939){_0x19dbe7['push'](_0x19dbe7['shift']());}};_0x14b88f(++_0x288ffb);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5e0648,_0x5c3164){_0x5e0648=_0x5e0648-0x0;var _0x33d820=_0x5f2f[_0x5e0648];return _0x33d820;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xc'),'ListId']},{'unique':!![],'name':_0xf5f2('0xd'),'fields':[_0xf5f2('0xc'),_0xf5f2('0xe')]},{'unique':!![],'name':'name_mail','fields':[_0xf5f2('0xc'),_0xf5f2('0xf')]},{'unique':!![],'name':_0xf5f2('0x10'),'fields':['name',_0xf5f2('0x11')]},{'unique':!![],'name':'name_fax','fields':['name',_0xf5f2('0x12')]},{'unique':!![],'name':_0xf5f2('0x13'),'fields':['name',_0xf5f2('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 5866264..2ce3fa6 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 _0xa571=['message','info','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a3634,_0x3a5fe7){var _0x2338c7=function(_0x5ee63d){while(--_0x5ee63d){_0x1a3634['push'](_0x1a3634['shift']());}};_0x2338c7(++_0x3a5fe7);}(_0xa571,0x107));var _0x1a57=function(_0x5736e8,_0x2f933f){_0x5736e8=_0x5736e8-0x0;var _0xd092d4=_0xa571[_0x5736e8];return _0xd092d4;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x1a57('0x4'))['db'];var utils=require(_0x1a57('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1a57('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1a57('0x7')][_0x1a57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22ca20,_0x3c5352,_0x2492f5){return new BPromise(function(_0x924873,_0x5d9f45){return client[_0x1a57('0x9')](_0x22ca20,_0x2492f5)[_0x1a57('0xa')](function(_0x3631d6){logger['info'](_0x1a57('0xb'),_0x3c5352,_0x1a57('0xc'));logger[_0x1a57('0xd')](_0x1a57('0xe'),_0x3c5352,_0x1a57('0xc'),JSON[_0x1a57('0xf')](_0x3631d6));if(_0x3631d6[_0x1a57('0x10')]){if(_0x3631d6[_0x1a57('0x10')]['code']===0x1f4){logger['error'](_0x1a57('0xb'),_0x3c5352,_0x3631d6[_0x1a57('0x10')][_0x1a57('0x11')]);return _0x5d9f45(_0x3631d6['error'][_0x1a57('0x11')]);}logger[_0x1a57('0x10')]('Disposition,\x20%s,\x20%s',_0x3c5352,_0x3631d6[_0x1a57('0x10')]['message']);return _0x924873(_0x3631d6[_0x1a57('0x10')][_0x1a57('0x11')]);}else{logger[_0x1a57('0x12')](_0x1a57('0xb'),_0x3c5352,'request\x20sent');_0x924873(_0x3631d6[_0x1a57('0x13')]['message']);}})['catch'](function(_0x1b58d7){logger[_0x1a57('0x10')](_0x1a57('0xb'),_0x3c5352,_0x1b58d7);_0x5d9f45(_0x1b58d7);});});} \ No newline at end of file +var _0xb62e=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xb62e,0x1de));var _0xeb62=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xb62e[_0x1ac595];return _0x455fff;};'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 db=require(_0xeb62('0x4'))['db'];var utils=require(_0xeb62('0x5'));var logger=require(_0xeb62('0x6'))(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var jayson=require(_0xeb62('0x9'));var client=jayson['client'][_0xeb62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x455e1a,_0x31f5ea,_0x5e0dc4){return new BPromise(function(_0x2065a0,_0xab7049){return client[_0xeb62('0xb')](_0x455e1a,_0x5e0dc4)[_0xeb62('0xc')](function(_0x4967c0){logger['info'](_0xeb62('0xd'),_0x31f5ea,_0xeb62('0xe'));logger[_0xeb62('0xf')](_0xeb62('0x10'),_0x31f5ea,_0xeb62('0xe'),JSON[_0xeb62('0x11')](_0x4967c0));if(_0x4967c0[_0xeb62('0x12')]){if(_0x4967c0[_0xeb62('0x12')][_0xeb62('0x13')]===0x1f4){logger[_0xeb62('0x12')]('Disposition,\x20%s,\x20%s',_0x31f5ea,_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);return _0xab7049(_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);}logger['error'](_0xeb62('0xd'),_0x31f5ea,_0x4967c0[_0xeb62('0x12')][_0xeb62('0x14')]);return _0x2065a0(_0x4967c0['error'][_0xeb62('0x14')]);}else{logger[_0xeb62('0x15')](_0xeb62('0xd'),_0x31f5ea,'request\x20sent');_0x2065a0(_0x4967c0[_0xeb62('0x16')][_0xeb62('0x14')]);}})[_0xeb62('0x17')](function(_0x353e2c){logger[_0xeb62('0x12')](_0xeb62('0xd'),_0x31f5ea,_0x353e2c);_0xab7049(_0x353e2c);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 466b358..f9050bf 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 _0x9025=['update','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x535004,_0x3bc1e1){var _0x2950d7=function(_0x4e56dd){while(--_0x4e56dd){_0x535004['push'](_0x535004['shift']());}};_0x2950d7(++_0x3bc1e1);}(_0x9025,0x123));var _0x5902=function(_0x242fd2,_0x1f7913){_0x242fd2=_0x242fd2-0x0;var _0x4c290e=_0x9025[_0x242fd2];return _0x4c290e;};'use strict';var multer=require(_0x5902('0x0'));var util=require(_0x5902('0x1'));var path=require(_0x5902('0x2'));var express=require(_0x5902('0x3'));var router=express[_0x5902('0x4')]();var auth=require(_0x5902('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5902('0x6'));router[_0x5902('0x7')]('/',auth[_0x5902('0x8')](),controller[_0x5902('0x9')]);router[_0x5902('0x7')](_0x5902('0xa'),auth[_0x5902('0x8')](),controller[_0x5902('0xb')]);router[_0x5902('0xc')]('/',auth['isAuthenticated'](),controller[_0x5902('0xd')]);router[_0x5902('0xe')](_0x5902('0xa'),auth['isAuthenticated'](),controller[_0x5902('0xf')]);router['delete'](_0x5902('0xa'),auth[_0x5902('0x8')](),controller[_0x5902('0x10')]);module[_0x5902('0x11')]=router; \ No newline at end of file +var _0x0d84=['index','/:id','show','post','create','update','delete','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4958fe,_0xb30015){var _0x1f6428=function(_0x569bec){while(--_0x569bec){_0x4958fe['push'](_0x4958fe['shift']());}};_0x1f6428(++_0xb30015);}(_0x0d84,0x1d8));var _0x40d8=function(_0x9100dc,_0x50a575){_0x9100dc=_0x9100dc-0x0;var _0x30963b=_0x0d84[_0x9100dc];return _0x30963b;};'use strict';var multer=require(_0x40d8('0x0'));var util=require(_0x40d8('0x1'));var path=require('path');var express=require('express');var router=express[_0x40d8('0x2')]();var auth=require(_0x40d8('0x3'));var interaction=require(_0x40d8('0x4'));var config=require(_0x40d8('0x5'));var controller=require('./disposition.controller');router[_0x40d8('0x6')]('/',auth[_0x40d8('0x7')](),controller[_0x40d8('0x8')]);router['get'](_0x40d8('0x9'),auth['isAuthenticated'](),controller[_0x40d8('0xa')]);router[_0x40d8('0xb')]('/',auth[_0x40d8('0x7')](),controller[_0x40d8('0xc')]);router['put'](_0x40d8('0x9'),auth[_0x40d8('0x7')](),controller[_0x40d8('0xd')]);router[_0x40d8('0xe')](_0x40d8('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x40d8('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index fa8e73d..644dd9c 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 _0x65a6=['SIP','DADHI','KHOMP','TEXT','BOOLEAN','sequelize','exports','STRING','yes','ENUM','4800','7200','9600','14400','v17,v27,v29','INTEGER'];(function(_0x3df21d,_0xa44265){var _0x37ab8a=function(_0x156e3d){while(--_0x156e3d){_0x3df21d['push'](_0x3df21d['shift']());}};_0x37ab8a(++_0xa44265);}(_0x65a6,0xa5));var _0x665a=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x65a6[_0x15fc3c];return _0x94c5c8;};'use strict';var Sequelize=require(_0x665a('0x0'));module[_0x665a('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x665a('0x2')]},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x665a('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x665a('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x665a('0x4')]('2400',_0x665a('0x5'),_0x665a('0x6'),_0x665a('0x7'),'12000',_0x665a('0x8')),'defaultValue':_0x665a('0x5')},'maxrate':{'type':Sequelize[_0x665a('0x4')]('2400','4800','7200',_0x665a('0x7'),'12000','14400'),'defaultValue':_0x665a('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x665a('0x9')},'gateway':{'type':Sequelize['STRING'],'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[_0x665a('0xa')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x665a('0x4')](_0x665a('0xb'),'IAX',_0x665a('0xc'),_0x665a('0xd')),'defaultValue':'SIP'},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x665a('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x665a('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x665a('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x665a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x665a('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x665a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x665a('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x830c=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','9600','12000','2400','14400','v17,v27,v29','INTEGER','SIP','DADHI','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x1655bb,_0x5a82ae){var _0x5e2020=function(_0x1ccfb4){while(--_0x1ccfb4){_0x1655bb['push'](_0x1655bb['shift']());}};_0x5e2020(++_0x5a82ae);}(_0x830c,0xf7));var _0xc830=function(_0x339422,_0x2fc156){_0x339422=_0x339422-0x0;var _0x2a2104=_0x830c[_0x339422];return _0x2a2104;};'use strict';var Sequelize=require(_0xc830('0x0'));module[_0xc830('0x1')]={'name':{'type':Sequelize[_0xc830('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc830('0x2')]},'ecm':{'type':Sequelize[_0xc830('0x3')](_0xc830('0x4'),'no'),'defaultValue':_0xc830('0x4')},'headerinfo':{'type':Sequelize[_0xc830('0x2')],'defaultValue':_0xc830('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xc830('0x6')},'minrate':{'type':Sequelize[_0xc830('0x3')]('2400',_0xc830('0x7'),_0xc830('0x8'),_0xc830('0x9'),_0xc830('0xa'),'14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xc830('0x3')](_0xc830('0xb'),_0xc830('0x7'),'7200',_0xc830('0x9'),'12000',_0xc830('0xc')),'defaultValue':_0xc830('0xc')},'modem':{'type':Sequelize[_0xc830('0x2')],'defaultValue':_0xc830('0xd')},'gateway':{'type':Sequelize[_0xc830('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc830('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc830('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0xc830('0xf'),'IAX',_0xc830('0x10'),'KHOMP'),'defaultValue':_0xc830('0xf')},'key':{'type':Sequelize[_0xc830('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xc830('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc830('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc830('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc830('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index adfb813..2477791 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 _0xbc75=['SendFax','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','socket.io-emitter','localhost','./faxAccount.socket','register','jayson/promise','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','update','destroy','end','stack','name','send','FaxAccount','model','keys','query','dateStart','dateEnd','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','add','merge','map','filter','options','includeAll','include','findAll','show','rawAttributes','fields','find','body','params','describe','addDisposition','FaxAccountId','Disposition','create','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','FaxInteraction','omit','User','Owner','fullname','internal','tag','addApplications','sequelize','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','minrate','modem','t38timeout','Wait','addAccountApplications','transaction','VoiceExtension','bulkCreate','updateAccountApplications','tech','key','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','Send\x20Fax\x20failed','user','filename','Contact\x20not\x20found','spread','out','ContactId','Messages','dataValues'];(function(_0x2aa9a8,_0x18150d){var _0x2075b1=function(_0x23cfd2){while(--_0x23cfd2){_0x2aa9a8['push'](_0x2aa9a8['shift']());}};_0x2075b1(++_0x18150d);}(_0xbc75,0xb1));var _0x5bc7=function(_0x53c00b,_0x41961d){_0x53c00b=_0x53c00b-0x0;var _0x3ec282=_0xbc75[_0x53c00b];return _0x3ec282;};'use strict';var jsonpatch=require(_0x5bc7('0x0'));var rp=require(_0x5bc7('0x1'));var moment=require(_0x5bc7('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5bc7('0x3'));var ejs=require(_0x5bc7('0x4'));var fs=require('fs');var _=require(_0x5bc7('0x5'));var squel=require('squel');var crypto=require(_0x5bc7('0x6'));var jsforce=require(_0x5bc7('0x7'));var deskjs=require(_0x5bc7('0x8'));var toCsv=require(_0x5bc7('0x3'));var querystring=require(_0x5bc7('0x9'));var Papa=require(_0x5bc7('0xa'));var qs=require(_0x5bc7('0xb'));var logger=require(_0x5bc7('0xc'))(_0x5bc7('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5bc7('0xe'))['db'];var socket=require(_0x5bc7('0xf'))({'host':_0x5bc7('0x10'),'port':0x18eb});require(_0x5bc7('0x11'))[_0x5bc7('0x12')](socket);var jayson=require(_0x5bc7('0x13'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x5bc7('0x14')][_0x5bc7('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xc4ef2b,_0x115566,_0x4be626,_0x298d39){return new BPromise(function(_0x351201,_0x26957b){var _0x48bec0=_0x298d39||client;return _0x48bec0['request'](_0xc4ef2b,_0x4be626)[_0x5bc7('0x16')](function(_0x37b29f){logger['info'](_0x5bc7('0x17'),_0x115566,_0x5bc7('0x18'));logger[_0x5bc7('0x19')](_0x5bc7('0x1a'),_0x115566,_0x5bc7('0x18'),JSON['stringify'](_0x37b29f));if(_0x37b29f[_0x5bc7('0x1b')]){if(_0x37b29f[_0x5bc7('0x1b')]['code']===0x1f4){logger[_0x5bc7('0x1b')]('FaxAccount,\x20%s,\x20%s',_0x115566,_0x37b29f['error'][_0x5bc7('0x1c')]);return _0x26957b(_0x37b29f['error'][_0x5bc7('0x1c')]);}logger[_0x5bc7('0x1b')](_0x5bc7('0x17'),_0x115566,_0x37b29f[_0x5bc7('0x1b')][_0x5bc7('0x1c')]);return _0x351201(_0x37b29f[_0x5bc7('0x1b')][_0x5bc7('0x1c')]);}else{logger[_0x5bc7('0x1d')](_0x5bc7('0x17'),_0x115566,_0x5bc7('0x18'));_0x351201(_0x37b29f[_0x5bc7('0x1e')]['message']);}})[_0x5bc7('0x1f')](function(_0x6de78c){logger[_0x5bc7('0x1b')](_0x5bc7('0x17'),_0x115566,_0x6de78c);_0x26957b(_0x6de78c);});});}function respondWithStatusCode(_0x5965f8,_0x439d1e){_0x439d1e=_0x439d1e||0xcc;return function(_0xa93ce9){if(_0xa93ce9){return _0x5965f8[_0x5bc7('0x20')](_0x439d1e);}return _0x5965f8[_0x5bc7('0x21')](_0x439d1e)['end']();};}function respondWithResult(_0x318c00,_0xcb995e){_0xcb995e=_0xcb995e||0xc8;return function(_0x359e25){if(_0x359e25){return _0x318c00[_0x5bc7('0x21')](_0xcb995e)[_0x5bc7('0x22')](_0x359e25);}};}function respondWithFilteredResult(_0x5f058a,_0x51426e){return function(_0x10c18c){if(_0x10c18c){var _0x440377=_0x10c18c[_0x5bc7('0x23')],_0x194502=_0x51426e[_0x5bc7('0x24')],_0x5d6bf5=_0x51426e['offset']+_0x51426e[_0x5bc7('0x25')],_0x50e86a;if(_0x5d6bf5>=_0x440377){_0x5d6bf5=_0x440377;_0x50e86a=0xc8;}else{_0x50e86a=0xce;}_0x5f058a[_0x5bc7('0x21')](_0x50e86a);return _0x5f058a['set'](_0x5bc7('0x26'),_0x194502+'-'+_0x5d6bf5+'/'+_0x440377)[_0x5bc7('0x22')](_0x10c18c);}return null;};}function patchUpdates(_0x2fc42a){return function(_0x1d29d2){try{jsonpatch[_0x5bc7('0x27')](_0x1d29d2,_0x2fc42a,!![]);}catch(_0x11828e){return BPromise[_0x5bc7('0x28')](_0x11828e);}return _0x1d29d2['save']();};}function saveUpdates(_0x2b321e,_0x2cfd62){return function(_0x137256){if(_0x137256){return _0x137256[_0x5bc7('0x29')](_0x2b321e)[_0x5bc7('0x16')](function(_0x7c0054){return _0x7c0054;});}return null;};}function removeEntity(_0x50256f,_0xb1b8f5){return function(_0x47ac60){if(_0x47ac60){return _0x47ac60[_0x5bc7('0x2a')]()['then'](function(){_0x50256f[_0x5bc7('0x21')](0xcc)[_0x5bc7('0x2b')]();});}};}function handleEntityNotFound(_0x27c586,_0x1b43a1){return function(_0x35009f){if(!_0x35009f){_0x27c586[_0x5bc7('0x20')](0x194);}return _0x35009f;};}function handleError(_0x394aaa,_0x238767){_0x238767=_0x238767||0x1f4;return function(_0x3252b3){logger['error'](_0x3252b3[_0x5bc7('0x2c')]);if(_0x3252b3[_0x5bc7('0x2d')]){delete _0x3252b3[_0x5bc7('0x2d')];}_0x394aaa['status'](_0x238767)[_0x5bc7('0x2e')](_0x3252b3);};}exports['index']=function(_0x4564dd,_0x1df2bc){var _0x4775c3={},_0x1b3888={},_0x1a9eb3={'count':0x0,'rows':[]};var _0x2c125f=db[_0x5bc7('0x2f')]['rawAttributes'];_0x1b3888[_0x5bc7('0x30')]=_[_0x5bc7('0x31')](_0x2c125f);var _0x1e0068={'dateStart':_0x4564dd[_0x5bc7('0x32')]['dateStart'],'dateEnd':_0x4564dd['query']['dateEnd']};delete _0x4564dd[_0x5bc7('0x32')][_0x5bc7('0x33')];delete _0x4564dd[_0x5bc7('0x32')][_0x5bc7('0x34')];_0x1b3888['query']=_[_0x5bc7('0x31')](_0x4564dd[_0x5bc7('0x32')]);_0x1b3888['filters']=_[_0x5bc7('0x35')](_0x1b3888[_0x5bc7('0x30')],_0x1b3888[_0x5bc7('0x32')]);_0x4775c3[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0x1b3888[_0x5bc7('0x30')],qs['fields'](_0x4564dd[_0x5bc7('0x32')]['fields']));_0x4775c3['attributes']=_0x4775c3[_0x5bc7('0x36')][_0x5bc7('0x37')]?_0x4775c3[_0x5bc7('0x36')]:_0x1b3888[_0x5bc7('0x30')];if(!_0x4564dd['query'][_0x5bc7('0x38')](_0x5bc7('0x39'))){_0x4775c3[_0x5bc7('0x25')]=qs['limit'](_0x4564dd[_0x5bc7('0x32')][_0x5bc7('0x25')]);_0x4775c3[_0x5bc7('0x24')]=qs['offset'](_0x4564dd['query']['offset']);}_0x4775c3[_0x5bc7('0x3a')]=qs[_0x5bc7('0x3b')](_0x4564dd[_0x5bc7('0x32')]['sort']);_0x4775c3[_0x5bc7('0x3c')]=qs['filters'](_['pick'](_0x4564dd[_0x5bc7('0x32')],_0x1b3888[_0x5bc7('0x3d')]));if(_0x1e0068[_0x5bc7('0x33')]){if(_0x1e0068[_0x5bc7('0x34')]){_0x1e0068[_0x5bc7('0x34')]=moment(_0x1e0068['dateEnd'])[_0x5bc7('0x3e')](0x1,'day');}else{_0x1e0068[_0x5bc7('0x34')]=moment(_0x1e0068[_0x5bc7('0x33')])[_0x5bc7('0x3e')](0x1,'day');}_[_0x5bc7('0x3f')](_0x4775c3[_0x5bc7('0x3c')],{'createdAt':{'$gte':_0x1e0068[_0x5bc7('0x33')],'$lte':_0x1e0068['dateEnd']}});}if(_0x4564dd['query']['filter']){_0x4775c3[_0x5bc7('0x3c')]=_['merge'](_0x4775c3[_0x5bc7('0x3c')],{'$or':_[_0x5bc7('0x40')](_0x4775c3['attributes'],function(_0x3ff4f8){var _0x597878={};_0x597878[_0x3ff4f8]={'$like':'%'+_0x4564dd[_0x5bc7('0x32')][_0x5bc7('0x41')]+'%'};return _0x597878;})});}_0x4775c3=_[_0x5bc7('0x3f')]({},_0x4775c3,_0x4564dd[_0x5bc7('0x42')]);var _0x457109={'where':_0x4775c3[_0x5bc7('0x3c')]};return db[_0x5bc7('0x2f')]['count'](_0x457109)[_0x5bc7('0x16')](function(_0x571231){_0x1a9eb3[_0x5bc7('0x23')]=_0x571231;if(_0x4564dd[_0x5bc7('0x32')][_0x5bc7('0x43')]){_0x4775c3[_0x5bc7('0x44')]=[{'all':!![]}];}return db[_0x5bc7('0x2f')][_0x5bc7('0x45')](_0x4775c3);})[_0x5bc7('0x16')](function(_0x3026cf){_0x1a9eb3['rows']=_0x3026cf;return _0x1a9eb3;})['then'](respondWithFilteredResult(_0x1df2bc,_0x4775c3))[_0x5bc7('0x1f')](handleError(_0x1df2bc,null));};exports[_0x5bc7('0x46')]=function(_0x161eb3,_0x5b2670){var _0x4d2a77={'raw':![],'where':{'id':_0x161eb3['params']['id']}},_0x1d7b10={};_0x1d7b10[_0x5bc7('0x30')]=_[_0x5bc7('0x31')](db['FaxAccount'][_0x5bc7('0x47')]);_0x1d7b10[_0x5bc7('0x32')]=_[_0x5bc7('0x31')](_0x161eb3['query']);_0x1d7b10[_0x5bc7('0x3d')]=_['intersection'](_0x1d7b10['model'],_0x1d7b10[_0x5bc7('0x32')]);_0x4d2a77[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0x1d7b10[_0x5bc7('0x30')],qs['fields'](_0x161eb3[_0x5bc7('0x32')][_0x5bc7('0x48')]));_0x4d2a77[_0x5bc7('0x36')]=_0x4d2a77['attributes'][_0x5bc7('0x37')]?_0x4d2a77[_0x5bc7('0x36')]:_0x1d7b10[_0x5bc7('0x30')];if(_0x161eb3['query']['includeAll']){_0x4d2a77['include']=[{'all':!![]}];}_0x4d2a77=_[_0x5bc7('0x3f')]({},_0x4d2a77,_0x161eb3[_0x5bc7('0x42')]);return db[_0x5bc7('0x2f')][_0x5bc7('0x49')](_0x4d2a77)[_0x5bc7('0x16')](handleEntityNotFound(_0x5b2670,null))[_0x5bc7('0x16')](respondWithResult(_0x5b2670,null))[_0x5bc7('0x1f')](handleError(_0x5b2670,null));};exports['create']=function(_0x37b3a4,_0x1e9149){return db[_0x5bc7('0x2f')]['create'](_0x37b3a4[_0x5bc7('0x4a')],{})[_0x5bc7('0x16')](respondWithResult(_0x1e9149,0xc9))['catch'](handleError(_0x1e9149,null));};exports[_0x5bc7('0x29')]=function(_0x305183,_0x2aa5e5){if(_0x305183[_0x5bc7('0x4a')]['id']){delete _0x305183[_0x5bc7('0x4a')]['id'];}return db[_0x5bc7('0x2f')]['find']({'where':{'id':_0x305183[_0x5bc7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2aa5e5,null))[_0x5bc7('0x16')](saveUpdates(_0x305183[_0x5bc7('0x4a')],null))[_0x5bc7('0x16')](respondWithResult(_0x2aa5e5,null))[_0x5bc7('0x1f')](handleError(_0x2aa5e5,null));};exports[_0x5bc7('0x2a')]=function(_0x1d1e71,_0x4280d4){return db[_0x5bc7('0x2f')]['find']({'where':{'id':_0x1d1e71[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x4280d4,null))['then'](removeEntity(_0x4280d4,null))[_0x5bc7('0x1f')](handleError(_0x4280d4,null));};exports[_0x5bc7('0x4c')]=function(_0x49a9ec,_0xa126c){return db[_0x5bc7('0x2f')][_0x5bc7('0x4c')]()[_0x5bc7('0x16')](respondWithResult(_0xa126c,null))[_0x5bc7('0x1f')](handleError(_0xa126c,null));};exports[_0x5bc7('0x4d')]=function(_0x2d1826,_0x15a326,_0x429fc4){if(_0x2d1826[_0x5bc7('0x4a')]['id']){delete _0x2d1826[_0x5bc7('0x4a')]['id'];}return db[_0x5bc7('0x2f')][_0x5bc7('0x49')]({'where':{'id':_0x2d1826[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x15a326,null))[_0x5bc7('0x16')](function(_0x25e210){if(_0x25e210){_0x2d1826['body'][_0x5bc7('0x4e')]=_0x25e210['id'];return db[_0x5bc7('0x4f')][_0x5bc7('0x50')](_0x2d1826[_0x5bc7('0x4a')]);}})[_0x5bc7('0x16')](respondWithResult(_0x15a326,null))[_0x5bc7('0x1f')](handleError(_0x15a326,null));};exports[_0x5bc7('0x51')]=function(_0x13b73d,_0x2d727d,_0x418baf){var _0x492a4b={'raw':![],'where':{}};var _0x292348={};var _0x472fb4={'count':0x0,'rows':[]};return db[_0x5bc7('0x2f')][_0x5bc7('0x52')]({'where':{'id':_0x13b73d[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x2d727d,null))[_0x5bc7('0x16')](function(_0x44ede7){if(_0x44ede7){_0x292348['model']=_[_0x5bc7('0x31')](db['Disposition'][_0x5bc7('0x47')]);_0x292348['query']=_[_0x5bc7('0x31')](_0x13b73d[_0x5bc7('0x32')]);_0x292348[_0x5bc7('0x3d')]=_[_0x5bc7('0x35')](_0x292348[_0x5bc7('0x30')],_0x292348[_0x5bc7('0x32')]);_0x492a4b[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0x292348['model'],qs[_0x5bc7('0x48')](_0x13b73d[_0x5bc7('0x32')][_0x5bc7('0x48')]));_0x492a4b['attributes']=_0x492a4b[_0x5bc7('0x36')][_0x5bc7('0x37')]?_0x492a4b[_0x5bc7('0x36')]:_0x292348[_0x5bc7('0x30')];if(!_0x13b73d['query'][_0x5bc7('0x38')]('nolimit')){_0x492a4b[_0x5bc7('0x25')]=qs[_0x5bc7('0x25')](_0x13b73d[_0x5bc7('0x32')]['limit']);_0x492a4b['offset']=qs['offset'](_0x13b73d[_0x5bc7('0x32')][_0x5bc7('0x24')]);}_0x492a4b[_0x5bc7('0x3a')]=qs[_0x5bc7('0x3b')](_0x13b73d[_0x5bc7('0x32')][_0x5bc7('0x3b')]);_0x492a4b['where']=qs['filters'](_[_0x5bc7('0x53')](_0x13b73d[_0x5bc7('0x32')],_0x292348[_0x5bc7('0x3d')]));_0x492a4b['where']['FaxAccountId']=_0x44ede7['id'];if(_0x13b73d['query'][_0x5bc7('0x41')]){_0x492a4b[_0x5bc7('0x3c')]=_['merge'](_0x492a4b['where'],{'$or':_[_0x5bc7('0x40')](_0x492a4b[_0x5bc7('0x36')],function(_0x44ed3d){var _0x14f878={};_0x14f878[_0x44ed3d]={'$like':'%'+_0x13b73d[_0x5bc7('0x32')]['filter']+'%'};return _0x14f878;})});}_0x492a4b=_[_0x5bc7('0x3f')]({},_0x492a4b,_0x13b73d[_0x5bc7('0x42')]);return db['Disposition'][_0x5bc7('0x23')]({'where':_0x492a4b[_0x5bc7('0x3c')]})[_0x5bc7('0x16')](function(_0x1c288e){_0x472fb4['count']=_0x1c288e;if(_0x13b73d['query'][_0x5bc7('0x43')]){_0x492a4b[_0x5bc7('0x44')]=[{'all':!![]}];}return db[_0x5bc7('0x4f')][_0x5bc7('0x45')](_0x492a4b);})[_0x5bc7('0x16')](function(_0xc299a){_0x472fb4[_0x5bc7('0x54')]=_0xc299a;return _0x472fb4;});}})['then'](respondWithFilteredResult(_0x2d727d,_0x492a4b))[_0x5bc7('0x1f')](handleError(_0x2d727d,null));};exports[_0x5bc7('0x55')]=function(_0x232d78,_0x2143fc,_0x4f5985){var _0x33c72c;return db[_0x5bc7('0x2f')][_0x5bc7('0x49')]({'where':{'id':_0x232d78[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x2143fc,null))[_0x5bc7('0x16')](function(_0xb307d2){if(_0xb307d2){return _0xb307d2['removeDispositions'](_0x232d78[_0x5bc7('0x32')][_0x5bc7('0x56')]);}})[_0x5bc7('0x16')](respondWithStatusCode(_0x2143fc,null))[_0x5bc7('0x1f')](handleError(_0x2143fc,null));};exports[_0x5bc7('0x57')]=function(_0x4139e1,_0x4077a1,_0x511a1d){if(_0x4139e1[_0x5bc7('0x4a')]['id']){delete _0x4139e1[_0x5bc7('0x4a')]['id'];}return db[_0x5bc7('0x2f')][_0x5bc7('0x49')]({'where':{'id':_0x4139e1[_0x5bc7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4077a1,null))[_0x5bc7('0x16')](function(_0x3b7fe6){if(_0x3b7fe6){_0x4139e1[_0x5bc7('0x4a')][_0x5bc7('0x4e')]=_0x3b7fe6['id'];return db[_0x5bc7('0x58')][_0x5bc7('0x50')](_0x4139e1[_0x5bc7('0x4a')]);}})[_0x5bc7('0x16')](respondWithResult(_0x4077a1,null))['catch'](handleError(_0x4077a1,null));};exports[_0x5bc7('0x59')]=function(_0x51c9a6,_0x10c3a5,_0x3b8f1f){var _0x171dc6={'raw':![],'where':{}};var _0x49f3c5={};var _0x3cb08f={'count':0x0,'rows':[]};return db[_0x5bc7('0x2f')][_0x5bc7('0x52')]({'where':{'id':_0x51c9a6['params']['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x10c3a5,null))[_0x5bc7('0x16')](function(_0x1785e0){if(_0x1785e0){_0x49f3c5[_0x5bc7('0x30')]=_[_0x5bc7('0x31')](db[_0x5bc7('0x58')][_0x5bc7('0x47')]);_0x49f3c5[_0x5bc7('0x32')]=_[_0x5bc7('0x31')](_0x51c9a6[_0x5bc7('0x32')]);_0x49f3c5[_0x5bc7('0x3d')]=_[_0x5bc7('0x35')](_0x49f3c5[_0x5bc7('0x30')],_0x49f3c5[_0x5bc7('0x32')]);_0x171dc6[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0x49f3c5[_0x5bc7('0x30')],qs[_0x5bc7('0x48')](_0x51c9a6[_0x5bc7('0x32')][_0x5bc7('0x48')]));_0x171dc6['attributes']=_0x171dc6[_0x5bc7('0x36')]['length']?_0x171dc6[_0x5bc7('0x36')]:_0x49f3c5[_0x5bc7('0x30')];if(!_0x51c9a6[_0x5bc7('0x32')][_0x5bc7('0x38')](_0x5bc7('0x39'))){_0x171dc6[_0x5bc7('0x25')]=qs[_0x5bc7('0x25')](_0x51c9a6[_0x5bc7('0x32')]['limit']);_0x171dc6[_0x5bc7('0x24')]=qs[_0x5bc7('0x24')](_0x51c9a6[_0x5bc7('0x32')]['offset']);}_0x171dc6[_0x5bc7('0x3a')]=qs[_0x5bc7('0x3b')](_0x51c9a6[_0x5bc7('0x32')]['sort']);_0x171dc6[_0x5bc7('0x3c')]=qs[_0x5bc7('0x3d')](_[_0x5bc7('0x53')](_0x51c9a6[_0x5bc7('0x32')],_0x49f3c5[_0x5bc7('0x3d')]));_0x171dc6[_0x5bc7('0x3c')][_0x5bc7('0x4e')]=_0x1785e0['id'];if(_0x51c9a6[_0x5bc7('0x32')][_0x5bc7('0x41')]){_0x171dc6[_0x5bc7('0x3c')]=_[_0x5bc7('0x3f')](_0x171dc6[_0x5bc7('0x3c')],{'$or':_[_0x5bc7('0x40')](_0x171dc6['attributes'],function(_0x795d54){var _0x35c5a7={};_0x35c5a7[_0x795d54]={'$like':'%'+_0x51c9a6['query'][_0x5bc7('0x41')]+'%'};return _0x35c5a7;})});}_0x171dc6=_['merge']({},_0x171dc6,_0x51c9a6[_0x5bc7('0x42')]);return db[_0x5bc7('0x58')][_0x5bc7('0x23')]({'where':_0x171dc6[_0x5bc7('0x3c')]})[_0x5bc7('0x16')](function(_0x316ac4){_0x3cb08f[_0x5bc7('0x23')]=_0x316ac4;if(_0x51c9a6[_0x5bc7('0x32')]['includeAll']){_0x171dc6[_0x5bc7('0x44')]=[{'all':!![]}];}return db[_0x5bc7('0x58')][_0x5bc7('0x45')](_0x171dc6);})[_0x5bc7('0x16')](function(_0x12a0ca){_0x3cb08f[_0x5bc7('0x54')]=_0x12a0ca;return _0x3cb08f;});}})[_0x5bc7('0x16')](respondWithFilteredResult(_0x10c3a5,_0x171dc6))['catch'](handleError(_0x10c3a5,null));};exports['removeAnswers']=function(_0x251cf,_0x5561ca,_0x507dcf){var _0x429b1f;return db['FaxAccount'][_0x5bc7('0x49')]({'where':{'id':_0x251cf[_0x5bc7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5561ca,null))[_0x5bc7('0x16')](function(_0x45d123){if(_0x45d123){return _0x45d123['removeAnswers'](_0x251cf[_0x5bc7('0x32')][_0x5bc7('0x56')]);}})[_0x5bc7('0x16')](respondWithStatusCode(_0x5561ca,null))['catch'](handleError(_0x5561ca,null));};exports[_0x5bc7('0x5a')]=function(_0x5b8331,_0x2b7cdf,_0x265370){return db[_0x5bc7('0x5b')][_0x5bc7('0x49')]({'where':{'id':_0x5b8331[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x2b7cdf,null))[_0x5bc7('0x16')](function(_0x3921f8){if(_0x3921f8){return _0x3921f8['addInteraction'](_0x5b8331[_0x5bc7('0x4a')][_0x5bc7('0x56')],_[_0x5bc7('0x5c')](_0x5b8331['body'],[_0x5bc7('0x56'),'id'])||{});}})[_0x5bc7('0x16')](respondWithResult(_0x2b7cdf,null))[_0x5bc7('0x1f')](handleError(_0x2b7cdf,null));};exports['getInteractions']=function(_0x3e0c90,_0x21c516,_0x1d6a69){var _0x45e478={'raw':![],'where':{}};var _0xbc6bb4={};var _0x48df6a={'count':0x0,'rows':[]};return db[_0x5bc7('0x2f')][_0x5bc7('0x52')]({'where':{'id':_0x3e0c90['params']['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x21c516,null))[_0x5bc7('0x16')](function(_0x5dba66){if(_0x5dba66){_0xbc6bb4[_0x5bc7('0x30')]=_[_0x5bc7('0x31')](db[_0x5bc7('0x5b')][_0x5bc7('0x47')]);_0xbc6bb4[_0x5bc7('0x32')]=_[_0x5bc7('0x31')](_0x3e0c90['query']);_0xbc6bb4[_0x5bc7('0x3d')]=_[_0x5bc7('0x35')](_0xbc6bb4[_0x5bc7('0x30')],_0xbc6bb4[_0x5bc7('0x32')]);_0x45e478[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0xbc6bb4['model'],qs[_0x5bc7('0x48')](_0x3e0c90[_0x5bc7('0x32')][_0x5bc7('0x48')]));_0x45e478[_0x5bc7('0x36')]=_0x45e478[_0x5bc7('0x36')][_0x5bc7('0x37')]?_0x45e478['attributes']:_0xbc6bb4[_0x5bc7('0x30')];if(!_0x3e0c90['query']['hasOwnProperty']('nolimit')){_0x45e478[_0x5bc7('0x25')]=qs[_0x5bc7('0x25')](_0x3e0c90[_0x5bc7('0x32')][_0x5bc7('0x25')]);_0x45e478['offset']=qs['offset'](_0x3e0c90['query']['offset']);}_0x45e478[_0x5bc7('0x3a')]=qs['sort'](_0x3e0c90[_0x5bc7('0x32')]['sort']);_0x45e478[_0x5bc7('0x3c')]=qs[_0x5bc7('0x3d')](_[_0x5bc7('0x53')](_0x3e0c90[_0x5bc7('0x32')],_0xbc6bb4['filters']));_0x45e478[_0x5bc7('0x3c')][_0x5bc7('0x4e')]=_0x5dba66['id'];if(_0x3e0c90[_0x5bc7('0x32')][_0x5bc7('0x41')]){_0x45e478[_0x5bc7('0x3c')]=_[_0x5bc7('0x3f')](_0x45e478[_0x5bc7('0x3c')],{'$or':_[_0x5bc7('0x40')](_0x45e478[_0x5bc7('0x36')],function(_0x578ac4){var _0x2c5409={};_0x2c5409[_0x578ac4]={'$like':'%'+_0x3e0c90[_0x5bc7('0x32')]['filter']+'%'};return _0x2c5409;})});}_0x45e478=_['merge']({},_0x45e478,_0x3e0c90[_0x5bc7('0x42')]);return db[_0x5bc7('0x5b')][_0x5bc7('0x23')]({'where':_0x45e478[_0x5bc7('0x3c')]})[_0x5bc7('0x16')](function(_0x4c0efb){_0x48df6a[_0x5bc7('0x23')]=_0x4c0efb;if(_0x3e0c90['query'][_0x5bc7('0x43')]){_0x45e478[_0x5bc7('0x44')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x5bc7('0x5d')],'as':_0x5bc7('0x5e'),'attributes':['name',_0x5bc7('0x5f'),_0x5bc7('0x60')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name','color'],'where':_0x3e0c90[_0x5bc7('0x32')][_0x5bc7('0x61')]?{'id':_0x3e0c90['query']['tag']}:undefined,'required':_0x3e0c90['query']['tag']?!![]:![]}];}return db['FaxInteraction'][_0x5bc7('0x45')](_0x45e478);})[_0x5bc7('0x16')](function(_0x29f474){_0x48df6a['rows']=_0x29f474;return _0x48df6a;});}})[_0x5bc7('0x16')](respondWithFilteredResult(_0x21c516,_0x45e478))['catch'](handleError(_0x21c516,null));};exports[_0x5bc7('0x62')]=function(_0x4a1ff7,_0x5aa1d0,_0x1ec752){return db[_0x5bc7('0x2f')][_0x5bc7('0x52')]({'where':{'id':_0x4a1ff7[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x5aa1d0,null))[_0x5bc7('0x16')](function(_0x44719f){if(_0x44719f){return db[_0x5bc7('0x63')]['transaction'](function(_0x195028){return db[_0x5bc7('0x64')]['destroy']({'where':{'FaxAccountId':_0x4a1ff7['params']['id']},'transaction':_0x195028})[_0x5bc7('0x16')](function(_0x143180){var _0x52e183=_[_0x5bc7('0x40')](_0x4a1ff7[_0x5bc7('0x4a')],function(_0x4c8b3e){_0x4c8b3e['FaxAccountId']=_0x4a1ff7['params']['id'];return _0x4c8b3e;});return db['FaxApplication']['bulkCreate'](_0x52e183,{'transaction':_0x195028});});})['then'](function(){return db[_0x5bc7('0x64')][_0x5bc7('0x65')]({'where':{'FaxAccountId':_0x4a1ff7[_0x5bc7('0x4b')]['id']},'order':_0x5bc7('0x66')});});}})[_0x5bc7('0x16')](respondWithResult(_0x5aa1d0,null))[_0x5bc7('0x1f')](handleError(_0x5aa1d0,null));};exports[_0x5bc7('0x67')]=function(_0x2200f5,_0x1b904f,_0x6dd3c){var _0x914080={};var _0x503b1b={};var _0x1a2360;var _0x577e1c;return db[_0x5bc7('0x2f')][_0x5bc7('0x52')]({'where':{'id':_0x2200f5[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x1b904f,null))[_0x5bc7('0x16')](function(_0x218c2e){if(_0x218c2e){_0x1a2360=_0x218c2e;_0x503b1b['model']=_[_0x5bc7('0x31')](db[_0x5bc7('0x64')]['rawAttributes']);_0x503b1b['query']=_[_0x5bc7('0x31')](_0x2200f5['query']);_0x503b1b['filters']=_[_0x5bc7('0x35')](_0x503b1b['model'],_0x503b1b['query']);_0x914080['attributes']=_[_0x5bc7('0x35')](_0x503b1b[_0x5bc7('0x30')],qs[_0x5bc7('0x48')](_0x2200f5[_0x5bc7('0x32')][_0x5bc7('0x48')]));_0x914080['attributes']=_0x914080['attributes'][_0x5bc7('0x37')]?_0x914080[_0x5bc7('0x36')]:_0x503b1b[_0x5bc7('0x30')];_0x914080['order']=qs[_0x5bc7('0x3b')](_0x2200f5['query'][_0x5bc7('0x3b')]);_0x914080[_0x5bc7('0x3c')]=qs['filters'](_[_0x5bc7('0x53')](_0x2200f5[_0x5bc7('0x32')],_0x503b1b[_0x5bc7('0x3d')]));if(_0x2200f5[_0x5bc7('0x32')]['filter']){_0x914080[_0x5bc7('0x3c')]=_[_0x5bc7('0x3f')](_0x914080['where'],{'$or':_[_0x5bc7('0x40')](_0x914080[_0x5bc7('0x36')],function(_0x107e7a){var _0x2c3124={};_0x2c3124[_0x107e7a]={'$like':'%'+_0x2200f5[_0x5bc7('0x32')]['filter']+'%'};return _0x2c3124;})});}_0x914080=_[_0x5bc7('0x3f')]({},_0x914080,_0x2200f5[_0x5bc7('0x42')]);return _0x1a2360['getApplications'](_0x914080);}})[_0x5bc7('0x16')](function(_0x34aeeb){if(_0x34aeeb){_0x577e1c=_0x34aeeb[_0x5bc7('0x37')];if(!_0x2200f5['query'][_0x5bc7('0x38')](_0x5bc7('0x39'))){_0x914080[_0x5bc7('0x25')]=qs[_0x5bc7('0x25')](_0x2200f5[_0x5bc7('0x32')][_0x5bc7('0x25')]);_0x914080[_0x5bc7('0x24')]=qs[_0x5bc7('0x24')](_0x2200f5[_0x5bc7('0x32')][_0x5bc7('0x24')]);}return _0x1a2360[_0x5bc7('0x67')](_0x914080);}})[_0x5bc7('0x16')](function(_0x3ebdc7){if(_0x3ebdc7){return _0x3ebdc7?{'count':_0x577e1c,'rows':_0x3ebdc7}:null;}})[_0x5bc7('0x16')](respondWithResult(_0x1b904f,null))[_0x5bc7('0x1f')](handleError(_0x1b904f,null));};function Extension(_0x572d84,_0x2bdc4b,_0x53aaf4,_0x351185){this[_0x5bc7('0x68')]=_0x5bc7('0x69');this[_0x5bc7('0x6a')]=_0x572d84[_0x5bc7('0x6b')];this['app']=_0x351185;this['type']='system';this[_0x5bc7('0x6c')]=_0x5bc7('0x6d');this[_0x5bc7('0x4e')]=_0x572d84['id'];this[_0x5bc7('0x66')]=_0x2bdc4b;this[_0x5bc7('0x6e')]=_0x53aaf4;}function createExtensionsReciveFax(_0x58be41){var _0xbe55bc=0x1;var _0x2d2e80=[];_0x2d2e80[_0x5bc7('0x6f')](new Extension(_0x58be41,_0xbe55bc,'',_0x5bc7('0x70')));_0xbe55bc+=0x1;_0x2d2e80[_0x5bc7('0x6f')](new Extension(_0x58be41,_0xbe55bc,_0x5bc7('0x71'),_0x5bc7('0x72')));_0xbe55bc+=0x1;for(var _0x52af2e in _0x58be41){if(_0x58be41[_0x5bc7('0x38')](_0x52af2e)&&(_0x52af2e==='ecm'||_0x52af2e===_0x5bc7('0x6b')||_0x52af2e===_0x5bc7('0x73')||_0x52af2e===_0x5bc7('0x74')||_0x52af2e==='headerinfo'||_0x52af2e===_0x5bc7('0x75')||_0x52af2e===_0x5bc7('0x76')||_0x52af2e===_0x5bc7('0x77')||_0x52af2e===_0x5bc7('0x78'))){_0x2d2e80[_0x5bc7('0x6f')](new Extension(_0x58be41,_0xbe55bc,'FAXOPT('+_0x52af2e+')='+_0x58be41[_0x52af2e],_0x5bc7('0x72')));_0xbe55bc+=0x1;}}_0x2d2e80[_0x5bc7('0x6f')](new Extension(_0x58be41,_0xbe55bc,'6',_0x5bc7('0x79')));_0xbe55bc+=0x1;_0x2d2e80[_0x5bc7('0x6f')](new Extension(_0x58be41,_0xbe55bc,'/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'));_0xbe55bc=0x0;return _0x2d2e80;}exports[_0x5bc7('0x7a')]=function(_0x2b5cc9,_0x5f3407,_0x183810){var _0x50b64e;return db[_0x5bc7('0x63')][_0x5bc7('0x7b')](function(_0x2a2f47){return db['FaxAccount'][_0x5bc7('0x50')](_0x2b5cc9[_0x5bc7('0x4a')],{'transaction':_0x2a2f47})[_0x5bc7('0x16')](function(_0x2f3f9c){_0x50b64e=_0x2f3f9c['get']({'plain':!![]});return db[_0x5bc7('0x7c')][_0x5bc7('0x7d')](createExtensionsReciveFax(_0x50b64e),{'transaction':_0x2a2f47});});})[_0x5bc7('0x16')](function(){return _0x50b64e;})[_0x5bc7('0x16')](respondWithResult(_0x5f3407,null))[_0x5bc7('0x1f')](handleError(_0x5f3407,null));};exports[_0x5bc7('0x7e')]=function(_0x5aadf1,_0x3ddf41,_0x305ba4){var _0x293984;return db[_0x5bc7('0x63')][_0x5bc7('0x7b')](function(_0x2f2287){return db['FaxAccount'][_0x5bc7('0x29')](_0x5aadf1[_0x5bc7('0x4a')],{'where':{'id':_0x5aadf1[_0x5bc7('0x4a')]['id']},'transaction':_0x2f2287})[_0x5bc7('0x16')](function(_0x2c895f){return db[_0x5bc7('0x7c')][_0x5bc7('0x2a')]({'where':{'FaxAccountId':_0x5aadf1[_0x5bc7('0x4a')]['id']},'transaction':_0x2f2287})[_0x5bc7('0x16')](function(_0x46e05a){return db[_0x5bc7('0x7c')][_0x5bc7('0x7d')](createExtensionsReciveFax(_[_0x5bc7('0x5c')](_0x5aadf1['body'],[_0x5bc7('0x7f'),_0x5bc7('0x80'),'createdAt',_0x5bc7('0x81'),'TrunkId',_0x5bc7('0x82')])),{'transaction':_0x2f2287});});});})[_0x5bc7('0x16')](function(){return db['FaxAccount'][_0x5bc7('0x83')](_0x5aadf1['body']['id']);})['then'](respondWithResult(_0x3ddf41,null))['catch'](handleError(_0x3ddf41,null));};exports[_0x5bc7('0x84')]=function(_0x5abf5c,_0xddbfb7,_0x49350a){var _0x31bc34={'raw':!![],'where':{}};var _0x4a2b74={};var _0x3c69df={'count':0x0,'rows':[]};return db['FaxAccount'][_0x5bc7('0x52')]({'where':{'id':_0x5abf5c['params']['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0xddbfb7,null))[_0x5bc7('0x16')](function(_0x3cb7b0){if(_0x3cb7b0){_0x4a2b74[_0x5bc7('0x30')]=_['keys'](db[_0x5bc7('0x85')][_0x5bc7('0x47')]);_0x4a2b74[_0x5bc7('0x32')]=_[_0x5bc7('0x31')](_0x5abf5c['query']);_0x4a2b74[_0x5bc7('0x3d')]=_['intersection'](_0x4a2b74['model'],_0x4a2b74[_0x5bc7('0x32')]);_0x31bc34[_0x5bc7('0x36')]=_[_0x5bc7('0x35')](_0x4a2b74[_0x5bc7('0x30')],qs['fields'](_0x5abf5c[_0x5bc7('0x32')]['fields']));_0x31bc34[_0x5bc7('0x36')]=_0x31bc34[_0x5bc7('0x36')][_0x5bc7('0x37')]?_0x31bc34[_0x5bc7('0x36')]:_0x4a2b74[_0x5bc7('0x30')];if(!_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x38')](_0x5bc7('0x39'))){_0x31bc34['limit']=qs['limit'](_0x5abf5c['query'][_0x5bc7('0x25')]);_0x31bc34[_0x5bc7('0x24')]=qs['offset'](_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x24')]);}_0x31bc34[_0x5bc7('0x3a')]=qs[_0x5bc7('0x3b')](_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x3b')]);_0x31bc34[_0x5bc7('0x3c')]=qs[_0x5bc7('0x3d')](_[_0x5bc7('0x53')](_0x5abf5c['query'],_0x4a2b74[_0x5bc7('0x3d')]));_0x31bc34[_0x5bc7('0x3c')][_0x5bc7('0x4e')]=_0x3cb7b0['id'];if(_0x5abf5c[_0x5bc7('0x32')]['filter']){_0x31bc34['where']=_[_0x5bc7('0x3f')](_0x31bc34[_0x5bc7('0x3c')],{'$or':_['map'](_0x31bc34[_0x5bc7('0x36')],function(_0x574d23){var _0x22e827={};_0x22e827[_0x574d23]={'$like':'%'+_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x41')]+'%'};return _0x22e827;})});}if(_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x86')]){var _0x5ee98f=_0x5abf5c['query'][_0x5bc7('0x86')][_0x5bc7('0x87')](',');var _0x594961={};_0x594961[_0x5ee98f[0x0]]={'$gte':moment(_0x5ee98f[0x1])[_0x5bc7('0x88')](_0x5bc7('0x89'))};_0x31bc34[_0x5bc7('0x3c')]=_[_0x5bc7('0x3f')](_0x31bc34[_0x5bc7('0x3c')],_0x594961);}_0x31bc34=_[_0x5bc7('0x3f')]({},_0x31bc34,_0x5abf5c[_0x5bc7('0x42')]);return db[_0x5bc7('0x85')][_0x5bc7('0x23')]({'where':_0x31bc34[_0x5bc7('0x3c')]})[_0x5bc7('0x16')](function(_0x5d3496){_0x3c69df[_0x5bc7('0x23')]=_0x5d3496;if(_0x5abf5c[_0x5bc7('0x32')][_0x5bc7('0x43')]){_0x31bc34[_0x5bc7('0x44')]=[{'all':!![]}];}return db['FaxMessage'][_0x5bc7('0x45')](_0x31bc34);})[_0x5bc7('0x16')](function(_0x83d0bb){_0x3c69df['rows']=_0x83d0bb;return _0x3c69df;});}})[_0x5bc7('0x16')](respondWithFilteredResult(_0xddbfb7,_0x31bc34))[_0x5bc7('0x1f')](handleError(_0xddbfb7,null));};exports['send']=function(_0x3b66a0,_0x27a7a9,_0x379dca){var _0xb2fad2,_0x3d8ad2={},_0x356e04;if(_0x3b66a0['body']['to']){_0x356e04=_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0];}return db[_0x5bc7('0x2f')][_0x5bc7('0x49')]({'where':{'id':_0x3b66a0['params']['id']},'include':[{'model':db[_0x5bc7('0x8a')],'as':_0x5bc7('0x8b'),'include':[{'model':db[_0x5bc7('0x8c')],'as':_0x5bc7('0x8d'),'where':{'fax':_0x356e04},'limit':0x1,'order':[['updatedAt',_0x5bc7('0x8e')]]}]}]})[_0x5bc7('0x16')](handleEntityNotFound(_0x27a7a9,null))[_0x5bc7('0x16')](function(_0x495158){_0xb2fad2=_0x495158;if(_0x3b66a0['body']['attachments']&&_0x3b66a0[_0x5bc7('0x4a')]['attachments']['length']){for(var _0xbe3d6b=0x0;_0xbe3d6b<_0x3b66a0[_0x5bc7('0x4a')]['attachments'][_0x5bc7('0x37')];_0xbe3d6b+=0x1){_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][_0xbe3d6b]={'filename':_0x3b66a0[_0x5bc7('0x4a')]['attachments'][_0xbe3d6b][_0x5bc7('0x2d')],'id':_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][_0xbe3d6b]['id'],'path':path[_0x5bc7('0x90')](config[_0x5bc7('0x91')],_0x5bc7('0x92'),_0x3b66a0['body'][_0x5bc7('0x8f')][_0xbe3d6b][_0x5bc7('0x93')])};}}return respondWithRpcPromise(_0x5bc7('0x94'),_0x5bc7('0x94'),{'FaxAccountId':_[_0x5bc7('0x95')](_0x3b66a0[_0x5bc7('0x4b')]['id'])?undefined:_0x3b66a0[_0x5bc7('0x4b')]['id'],'path':_[_0x5bc7('0x95')](_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0][_0x5bc7('0x96')])?undefined:_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0][_0x5bc7('0x96')],'fax':_[_0x5bc7('0x95')](_0x3b66a0['body']['to'][0x0])?undefined:_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0]},client9002);})[_0x5bc7('0x16')](function(){if(_0xb2fad2){if(_[_0x5bc7('0x95')](_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x97')])){_0x3b66a0['body'][_0x5bc7('0x97')]=util[_0x5bc7('0x88')](_0x5bc7('0x98'),_0xb2fad2[_0x5bc7('0x2d')],_0xb2fad2[_0x5bc7('0x99')]);}if(_0xb2fad2[_0x5bc7('0x8b')]){if(_0xb2fad2[_0x5bc7('0x8b')]['Contacts']['length']){return _0xb2fad2[_0x5bc7('0x8b')][_0x5bc7('0x8d')][0x0];}else{return db[_0x5bc7('0x8c')][_0x5bc7('0x50')](_['defaults'](_0x3b66a0[_0x5bc7('0x4a')],{'firstName':_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0],'phone':_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0],'fax':_0x3b66a0['body']['to'][0x0],'ListId':_0xb2fad2[_0x5bc7('0x82')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0x5bc7('0x9a'));}})[_0x5bc7('0x16')](function(_0x15d964){if(_0x15d964){return db[_0x5bc7('0x5b')][_0x5bc7('0x49')]({'where':{'ContactId':_0x15d964['id'],'closed':![],'FaxAccountId':_0xb2fad2['id']}})[_0x5bc7('0x16')](function(_0x4f92dc){if(_0x4f92dc){return[_0x4f92dc,![]];}return db['FaxInteraction'][_0x5bc7('0x50')]({'UserId':_0x3b66a0[_0x5bc7('0x9b')]['id'],'ContactId':_0x15d964['id'],'FaxAccountId':_0xb2fad2['id'],'fax':_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x5bc7('0x3f')](_0x3b66a0[_0x5bc7('0x4a')],{'read':![],'body':_0x3b66a0['body'][_0x5bc7('0x8f')][0x0][_0x5bc7('0x9c')],'FaxAccountId':_0xb2fad2['id'],'UserId':_0x3b66a0['user']['id'],'ContactId':_0x15d964['id'],'AttachmentId':_0x3b66a0['body'][_0x5bc7('0x8f')][0x0]['id']})]},{'include':[{'model':db[_0x5bc7('0x85')],'as':'Messages'}]})[_0x5bc7('0x16')](function(_0xf62b6c){return[_0xf62b6c,!![]];});});}else{throw new Error(_0x5bc7('0x9d'));}})[_0x5bc7('0x9e')](function(_0x33f441,_0x3d4ef2){if(_0x3d4ef2){return _0x33f441;}return db['FaxMessage']['create']({'direction':_0x5bc7('0x9f'),'read':![],'body':_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0][_0x5bc7('0x9c')],'FaxAccountId':_0xb2fad2['id'],'FaxInteractionId':_0x33f441['id'],'UserId':_0x3b66a0[_0x5bc7('0x9b')]['id'],'ContactId':_0x33f441[_0x5bc7('0xa0')],'AttachmentId':_0x3b66a0[_0x5bc7('0x4a')]['attachments'][0x0]['id']})['then'](function(_0x5cad4e){_0x33f441['dataValues'][_0x5bc7('0xa1')]=[];_0x33f441[_0x5bc7('0xa2')][_0x5bc7('0xa1')][_0x5bc7('0x6f')](_0x5cad4e[_0x5bc7('0xa2')]);return _0x33f441;});})['then'](function(_0x466778){respondWithRpcPromise(_0x5bc7('0xa3'),_0x5bc7('0xa3'),{'FaxAccountId':_[_0x5bc7('0x95')](_0x3b66a0[_0x5bc7('0x4b')]['id'])?undefined:_0x3b66a0['params']['id'],'path':_['isNil'](_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0][_0x5bc7('0x96')])?undefined:_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0][_0x5bc7('0x96')],'fax':_['isNil'](_0x3b66a0['body']['to'][0x0])?undefined:_0x3b66a0[_0x5bc7('0x4a')]['to'][0x0],'AttachmentId':_0x3b66a0[_0x5bc7('0x4a')][_0x5bc7('0x8f')][0x0]['id']},client9002)['then'](function(_0x4dd671){logger[_0x5bc7('0x1d')]('SendFaxRpc,\x20%s',_0x4dd671);})[_0x5bc7('0x1f')](function(_0x19ccc4){logger[_0x5bc7('0x1d')]('SendFaxRpc,\x20%s',_0x19ccc4);});return _0x466778;})[_0x5bc7('0x16')](respondWithResult(_0x27a7a9,null))[_0x5bc7('0x1f')](handleError(_0x27a7a9,null));};exports[_0x5bc7('0xa4')]=function(_0x29e021,_0x5b57e3,_0x5645d4){return db['FaxAccount'][_0x5bc7('0x49')]({'where':{'id':_0x29e021[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x5b57e3,null))[_0x5bc7('0x16')](function(_0x536254){if(_0x536254){return _0x536254[_0x5bc7('0xa4')](_0x29e021['body'][_0x5bc7('0x56')],_[_0x5bc7('0x5c')](_0x29e021['body'],[_0x5bc7('0x56'),'id'])||{})[_0x5bc7('0x9e')](function(_0x129573){for(var _0x163c97=0x0;_0x163c97<_0x29e021[_0x5bc7('0x4a')][_0x5bc7('0x56')]['length'];_0x163c97+=0x1){socket[_0x5bc7('0xa5')]('userFaxAccount:save',{'UserId':_0x29e021[_0x5bc7('0x4a')]['ids'][_0x163c97],'FaxAccountId':_0x29e021[_0x5bc7('0x4b')]['id']});}return _0x129573;});}})['then'](respondWithResult(_0x5b57e3,null))[_0x5bc7('0x1f')](handleError(_0x5b57e3,null));};exports[_0x5bc7('0xa6')]=function(_0x3bb378,_0x4bdb5f,_0x51a818){var _0x4a0140;return db['FaxAccount'][_0x5bc7('0x49')]({'where':{'id':_0x3bb378['params']['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x4bdb5f,null))['then'](function(_0x2596b8){if(_0x2596b8){return _0x2596b8[_0x5bc7('0xa6')](_0x3bb378[_0x5bc7('0x32')]['ids'])[_0x5bc7('0x16')](function(_0x53be14){if(_[_0x5bc7('0xa7')](_0x3bb378['query'][_0x5bc7('0x56')])){for(var _0x3b6df7=0x0;_0x3b6df7<_0x3bb378['query'][_0x5bc7('0x56')][_0x5bc7('0x37')];_0x3b6df7+=0x1){socket[_0x5bc7('0xa5')]('userFaxAccount:remove',{'UserId':_0x3bb378[_0x5bc7('0x32')]['ids'][_0x3b6df7],'FaxAccountId':_0x3bb378[_0x5bc7('0x4b')]['id']});}}else{socket[_0x5bc7('0xa5')](_0x5bc7('0xa8'),{'UserId':_0x3bb378[_0x5bc7('0x32')][_0x5bc7('0x56')],'FaxAccountId':_0x3bb378[_0x5bc7('0x4b')]['id']});}});}})[_0x5bc7('0x16')](respondWithStatusCode(_0x4bdb5f,null))[_0x5bc7('0x1f')](handleError(_0x4bdb5f,null));};exports[_0x5bc7('0xa9')]=function(_0x404526,_0x1a33f7,_0x9b6b67){var _0x33bb35={};var _0x5a6863={};var _0x41a100;var _0x416f2a;return db[_0x5bc7('0x2f')]['findOne']({'where':{'id':_0x404526[_0x5bc7('0x4b')]['id']}})[_0x5bc7('0x16')](handleEntityNotFound(_0x1a33f7,null))[_0x5bc7('0x16')](function(_0x3a1048){if(_0x3a1048){_0x41a100=_0x3a1048;_0x5a6863[_0x5bc7('0x30')]=_[_0x5bc7('0x31')](db['User']['rawAttributes']);_0x5a6863[_0x5bc7('0x32')]=_[_0x5bc7('0x31')](_0x404526[_0x5bc7('0x32')]);_0x5a6863[_0x5bc7('0x3d')]=_[_0x5bc7('0x35')](_0x5a6863[_0x5bc7('0x30')],_0x5a6863[_0x5bc7('0x32')]);_0x33bb35['attributes']=_[_0x5bc7('0x35')](_0x5a6863['model'],qs[_0x5bc7('0x48')](_0x404526['query'][_0x5bc7('0x48')]));_0x33bb35['attributes']=_0x33bb35[_0x5bc7('0x36')][_0x5bc7('0x37')]?_0x33bb35['attributes']:_0x5a6863[_0x5bc7('0x30')];_0x33bb35['order']=qs[_0x5bc7('0x3b')](_0x404526[_0x5bc7('0x32')][_0x5bc7('0x3b')]);_0x33bb35[_0x5bc7('0x3c')]=qs['filters'](_[_0x5bc7('0x53')](_0x404526[_0x5bc7('0x32')],_0x5a6863['filters']));if(_0x404526[_0x5bc7('0x32')][_0x5bc7('0x41')]){_0x33bb35[_0x5bc7('0x3c')]=_['merge'](_0x33bb35['where'],{'$or':_[_0x5bc7('0x40')](_0x33bb35['attributes'],function(_0x543506){var _0x3b7d91={};_0x3b7d91[_0x543506]={'$like':'%'+_0x404526[_0x5bc7('0x32')][_0x5bc7('0x41')]+'%'};return _0x3b7d91;})});}_0x33bb35=_[_0x5bc7('0x3f')]({},_0x33bb35,_0x404526[_0x5bc7('0x42')]);return _0x41a100[_0x5bc7('0xa9')](_0x33bb35);}})[_0x5bc7('0x16')](function(_0x3aed86){if(_0x3aed86){_0x416f2a=_0x3aed86['length'];if(!_0x404526[_0x5bc7('0x32')]['hasOwnProperty'](_0x5bc7('0x39'))){_0x33bb35[_0x5bc7('0x25')]=qs[_0x5bc7('0x25')](_0x404526[_0x5bc7('0x32')]['limit']);_0x33bb35[_0x5bc7('0x24')]=qs['offset'](_0x404526[_0x5bc7('0x32')][_0x5bc7('0x24')]);}return _0x41a100[_0x5bc7('0xa9')](_0x33bb35);}})[_0x5bc7('0x16')](function(_0x714e8c){if(_0x714e8c){return _0x714e8c?{'count':_0x416f2a,'rows':_0x714e8c}:null;}})['then'](respondWithResult(_0x1a33f7,null))[_0x5bc7('0x1f')](handleError(_0x1a33f7,null));}; \ No newline at end of file +var _0xff9b=['Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','get','VoiceExtension','updateAccountApplications','key','createdAt','updatedAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','Send\x20Fax\x20failed','user','out','filename','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','userFaxAccount:remove','emit','getAgents','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','socket.io-emitter','localhost','./faxAccount.socket','client','http','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','json','count','offset','limit','status','apply','save','destroy','stack','send','FaxAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','find','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','order','CmContact','Contact','User','name','fullname','Tag','color','tag','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','type','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','ecm','gateway','maxrate','minrate','modem','t38timeout','Set'];(function(_0x25235c,_0x5502a1){var _0x1d60ad=function(_0x97fe38){while(--_0x97fe38){_0x25235c['push'](_0x25235c['shift']());}};_0x1d60ad(++_0x5502a1);}(_0xff9b,0x186));var _0xbff9=function(_0x4df58e,_0xf2d8dd){_0x4df58e=_0x4df58e-0x0;var _0x16ac17=_0xff9b[_0x4df58e];return _0x16ac17;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbff9('0x0'));var BPromise=require(_0xbff9('0x1'));var Mustache=require(_0xbff9('0x2'));var util=require(_0xbff9('0x3'));var path=require(_0xbff9('0x4'));var sox=require(_0xbff9('0x5'));var csv=require(_0xbff9('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xbff9('0x7'));var squel=require(_0xbff9('0x8'));var crypto=require(_0xbff9('0x9'));var jsforce=require(_0xbff9('0xa'));var deskjs=require(_0xbff9('0xb'));var toCsv=require(_0xbff9('0x6'));var querystring=require('querystring');var Papa=require(_0xbff9('0xc'));var qs=require(_0xbff9('0xd'));var logger=require(_0xbff9('0xe'))(_0xbff9('0xf'));var utils=require('../../config/utils');var config=require(_0xbff9('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xbff9('0x11'))({'host':_0xbff9('0x12'),'port':0x18eb});require(_0xbff9('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xbff9('0x14')][_0xbff9('0x15')]({'port':0x232c});var client9002=jayson[_0xbff9('0x14')][_0xbff9('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x4424bb,_0x22ec94,_0x5cb496,_0x4e1e65){return new BPromise(function(_0x6afe23,_0x3ccc23){var _0x219daa=_0x4e1e65||client;return _0x219daa['request'](_0x4424bb,_0x5cb496)[_0xbff9('0x16')](function(_0x5de695){logger['info'](_0xbff9('0x17'),_0x22ec94,_0xbff9('0x18'));logger[_0xbff9('0x19')](_0xbff9('0x1a'),_0x22ec94,_0xbff9('0x18'),JSON['stringify'](_0x5de695));if(_0x5de695[_0xbff9('0x1b')]){if(_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1c')]===0x1f4){logger[_0xbff9('0x1b')](_0xbff9('0x17'),_0x22ec94,_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1d')]);return _0x3ccc23(_0x5de695['error'][_0xbff9('0x1d')]);}logger[_0xbff9('0x1b')](_0xbff9('0x17'),_0x22ec94,_0x5de695[_0xbff9('0x1b')][_0xbff9('0x1d')]);return _0x6afe23(_0x5de695[_0xbff9('0x1b')]['message']);}else{logger[_0xbff9('0x1e')](_0xbff9('0x17'),_0x22ec94,'request\x20sent');_0x6afe23(_0x5de695[_0xbff9('0x1f')][_0xbff9('0x1d')]);}})[_0xbff9('0x20')](function(_0x443ecc){logger['error'](_0xbff9('0x17'),_0x22ec94,_0x443ecc);_0x3ccc23(_0x443ecc);});});}function respondWithStatusCode(_0x3ce8fb,_0x5ebc7f){_0x5ebc7f=_0x5ebc7f||0xcc;return function(_0x46bb7b){if(_0x46bb7b){return _0x3ce8fb[_0xbff9('0x21')](_0x5ebc7f);}return _0x3ce8fb['status'](_0x5ebc7f)[_0xbff9('0x22')]();};}function respondWithResult(_0x46607f,_0x553a29){_0x553a29=_0x553a29||0xc8;return function(_0x448cef){if(_0x448cef){return _0x46607f['status'](_0x553a29)[_0xbff9('0x23')](_0x448cef);}};}function respondWithFilteredResult(_0x183abd,_0x75ad09){return function(_0x34b7a3){if(_0x34b7a3){var _0x58d983=_0x34b7a3[_0xbff9('0x24')],_0x22c821=_0x75ad09['offset'],_0x132782=_0x75ad09[_0xbff9('0x25')]+_0x75ad09[_0xbff9('0x26')],_0x51d0b3;if(_0x132782>=_0x58d983){_0x132782=_0x58d983;_0x51d0b3=0xc8;}else{_0x51d0b3=0xce;}_0x183abd[_0xbff9('0x27')](_0x51d0b3);return _0x183abd['set']('Content-Range',_0x22c821+'-'+_0x132782+'/'+_0x58d983)[_0xbff9('0x23')](_0x34b7a3);}return null;};}function patchUpdates(_0x127aad){return function(_0x3d7eaf){try{jsonpatch[_0xbff9('0x28')](_0x3d7eaf,_0x127aad,!![]);}catch(_0x161f67){return BPromise['reject'](_0x161f67);}return _0x3d7eaf[_0xbff9('0x29')]();};}function saveUpdates(_0x4538d4,_0x370281){return function(_0x5b7ab3){if(_0x5b7ab3){return _0x5b7ab3['update'](_0x4538d4)[_0xbff9('0x16')](function(_0x4c33e0){return _0x4c33e0;});}return null;};}function removeEntity(_0x1efb16,_0x554328){return function(_0xb487f9){if(_0xb487f9){return _0xb487f9[_0xbff9('0x2a')]()[_0xbff9('0x16')](function(){_0x1efb16['status'](0xcc)[_0xbff9('0x22')]();});}};}function handleEntityNotFound(_0x1234c0,_0x1e7862){return function(_0x365fa1){if(!_0x365fa1){_0x1234c0[_0xbff9('0x21')](0x194);}return _0x365fa1;};}function handleError(_0x4c7cea,_0x10738d){_0x10738d=_0x10738d||0x1f4;return function(_0x3cc14e){logger[_0xbff9('0x1b')](_0x3cc14e[_0xbff9('0x2b')]);if(_0x3cc14e['name']){delete _0x3cc14e['name'];}_0x4c7cea[_0xbff9('0x27')](_0x10738d)[_0xbff9('0x2c')](_0x3cc14e);};}exports['index']=function(_0x5e5f30,_0x33a71b){var _0x223f1a={},_0x58efba={},_0x5b4b52={'count':0x0,'rows':[]};var _0x385b7c=db[_0xbff9('0x2d')]['rawAttributes'];_0x58efba[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](_0x385b7c);var _0xd01c58={'dateStart':_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x31')],'dateEnd':_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x32')]};delete _0x5e5f30[_0xbff9('0x30')][_0xbff9('0x31')];delete _0x5e5f30[_0xbff9('0x30')][_0xbff9('0x32')];_0x58efba[_0xbff9('0x30')]=_['keys'](_0x5e5f30[_0xbff9('0x30')]);_0x58efba[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x58efba[_0xbff9('0x2e')],_0x58efba['query']);_0x223f1a[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x58efba[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x5e5f30['query']['fields']));_0x223f1a[_0xbff9('0x35')]=_0x223f1a['attributes'][_0xbff9('0x37')]?_0x223f1a['attributes']:_0x58efba[_0xbff9('0x2e')];if(!_0x5e5f30['query'][_0xbff9('0x38')](_0xbff9('0x39'))){_0x223f1a[_0xbff9('0x26')]=qs['limit'](_0x5e5f30[_0xbff9('0x30')]['limit']);_0x223f1a[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x223f1a['order']=qs[_0xbff9('0x3a')](_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x223f1a[_0xbff9('0x3b')]=qs['filters'](_[_0xbff9('0x3c')](_0x5e5f30[_0xbff9('0x30')],_0x58efba[_0xbff9('0x33')]));if(_0xd01c58[_0xbff9('0x31')]){if(_0xd01c58[_0xbff9('0x32')]){_0xd01c58['dateEnd']=moment(_0xd01c58[_0xbff9('0x32')])[_0xbff9('0x3d')](0x1,_0xbff9('0x3e'));}else{_0xd01c58[_0xbff9('0x32')]=moment(_0xd01c58['dateStart'])[_0xbff9('0x3d')](0x1,'day');}_[_0xbff9('0x3f')](_0x223f1a[_0xbff9('0x3b')],{'createdAt':{'$gte':_0xd01c58[_0xbff9('0x31')],'$lte':_0xd01c58[_0xbff9('0x32')]}});}if(_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x40')]){_0x223f1a[_0xbff9('0x3b')]=_['merge'](_0x223f1a['where'],{'$or':_[_0xbff9('0x41')](_0x223f1a[_0xbff9('0x35')],function(_0x3afafd){var _0x42ef1b={};_0x42ef1b[_0x3afafd]={'$like':'%'+_0x5e5f30[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x42ef1b;})});}_0x223f1a=_['merge']({},_0x223f1a,_0x5e5f30[_0xbff9('0x42')]);var _0x3c9430={'where':_0x223f1a['where']};return db['FaxAccount'][_0xbff9('0x24')](_0x3c9430)[_0xbff9('0x16')](function(_0x4b0d46){_0x5b4b52[_0xbff9('0x24')]=_0x4b0d46;if(_0x5e5f30['query'][_0xbff9('0x43')]){_0x223f1a[_0xbff9('0x44')]=[{'all':!![]}];}return db['FaxAccount'][_0xbff9('0x45')](_0x223f1a);})[_0xbff9('0x16')](function(_0x281bbd){_0x5b4b52[_0xbff9('0x46')]=_0x281bbd;return _0x5b4b52;})[_0xbff9('0x16')](respondWithFilteredResult(_0x33a71b,_0x223f1a))[_0xbff9('0x20')](handleError(_0x33a71b,null));};exports[_0xbff9('0x47')]=function(_0x1c0a58,_0x538712){var _0x62cc7a={'raw':![],'where':{'id':_0x1c0a58[_0xbff9('0x48')]['id']}},_0x42364e={};_0x42364e[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x2d')][_0xbff9('0x49')]);_0x42364e[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x1c0a58[_0xbff9('0x30')]);_0x42364e[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x42364e[_0xbff9('0x2e')],_0x42364e[_0xbff9('0x30')]);_0x62cc7a['attributes']=_[_0xbff9('0x34')](_0x42364e[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x1c0a58[_0xbff9('0x30')][_0xbff9('0x36')]));_0x62cc7a[_0xbff9('0x35')]=_0x62cc7a[_0xbff9('0x35')][_0xbff9('0x37')]?_0x62cc7a[_0xbff9('0x35')]:_0x42364e[_0xbff9('0x2e')];if(_0x1c0a58['query'][_0xbff9('0x43')]){_0x62cc7a['include']=[{'all':!![]}];}_0x62cc7a=_['merge']({},_0x62cc7a,_0x1c0a58[_0xbff9('0x42')]);return db['FaxAccount']['find'](_0x62cc7a)[_0xbff9('0x16')](handleEntityNotFound(_0x538712,null))[_0xbff9('0x16')](respondWithResult(_0x538712,null))[_0xbff9('0x20')](handleError(_0x538712,null));};exports['create']=function(_0x50196d,_0x481bb2){return db[_0xbff9('0x2d')][_0xbff9('0x4a')](_0x50196d[_0xbff9('0x4b')],{})[_0xbff9('0x16')](respondWithResult(_0x481bb2,0xc9))[_0xbff9('0x20')](handleError(_0x481bb2,null));};exports['update']=function(_0x29559d,_0x12f2c1){if(_0x29559d['body']['id']){delete _0x29559d[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x29559d[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x12f2c1,null))[_0xbff9('0x16')](saveUpdates(_0x29559d[_0xbff9('0x4b')],null))[_0xbff9('0x16')](respondWithResult(_0x12f2c1,null))['catch'](handleError(_0x12f2c1,null));};exports[_0xbff9('0x2a')]=function(_0x3a5736,_0x4f331d){return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x3a5736[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x4f331d,null))[_0xbff9('0x16')](removeEntity(_0x4f331d,null))[_0xbff9('0x20')](handleError(_0x4f331d,null));};exports[_0xbff9('0x4d')]=function(_0x43ba99,_0xc6bcf3){return db[_0xbff9('0x2d')][_0xbff9('0x4d')]()['then'](respondWithResult(_0xc6bcf3,null))[_0xbff9('0x20')](handleError(_0xc6bcf3,null));};exports[_0xbff9('0x4e')]=function(_0xa3f756,_0x565cc5,_0x42755c){if(_0xa3f756[_0xbff9('0x4b')]['id']){delete _0xa3f756[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0xa3f756['params']['id']}})['then'](handleEntityNotFound(_0x565cc5,null))[_0xbff9('0x16')](function(_0x5ca5a7){if(_0x5ca5a7){_0xa3f756[_0xbff9('0x4b')][_0xbff9('0x4f')]=_0x5ca5a7['id'];return db[_0xbff9('0x50')][_0xbff9('0x4a')](_0xa3f756['body']);}})[_0xbff9('0x16')](respondWithResult(_0x565cc5,null))[_0xbff9('0x20')](handleError(_0x565cc5,null));};exports[_0xbff9('0x51')]=function(_0x4f08af,_0x47f1e7,_0x516815){var _0x2a966e={'raw':![],'where':{}};var _0x271baa={};var _0x1679fb={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x4f08af[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x47f1e7,null))['then'](function(_0x3192ac){if(_0x3192ac){_0x271baa[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x50')][_0xbff9('0x49')]);_0x271baa[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x4f08af['query']);_0x271baa['filters']=_[_0xbff9('0x34')](_0x271baa[_0xbff9('0x2e')],_0x271baa['query']);_0x2a966e['attributes']=_['intersection'](_0x271baa[_0xbff9('0x2e')],qs['fields'](_0x4f08af[_0xbff9('0x30')][_0xbff9('0x36')]));_0x2a966e[_0xbff9('0x35')]=_0x2a966e[_0xbff9('0x35')][_0xbff9('0x37')]?_0x2a966e[_0xbff9('0x35')]:_0x271baa[_0xbff9('0x2e')];if(!_0x4f08af[_0xbff9('0x30')]['hasOwnProperty']('nolimit')){_0x2a966e[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x4f08af['query'][_0xbff9('0x26')]);_0x2a966e[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x4f08af['query'][_0xbff9('0x25')]);}_0x2a966e['order']=qs[_0xbff9('0x3a')](_0x4f08af['query']['sort']);_0x2a966e[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x4f08af[_0xbff9('0x30')],_0x271baa['filters']));_0x2a966e[_0xbff9('0x3b')][_0xbff9('0x4f')]=_0x3192ac['id'];if(_0x4f08af[_0xbff9('0x30')][_0xbff9('0x40')]){_0x2a966e[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x2a966e[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x2a966e[_0xbff9('0x35')],function(_0x542a75){var _0x849b9f={};_0x849b9f[_0x542a75]={'$like':'%'+_0x4f08af[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x849b9f;})});}_0x2a966e=_[_0xbff9('0x3f')]({},_0x2a966e,_0x4f08af[_0xbff9('0x42')]);return db[_0xbff9('0x50')][_0xbff9('0x24')]({'where':_0x2a966e[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x23ee41){_0x1679fb[_0xbff9('0x24')]=_0x23ee41;if(_0x4f08af[_0xbff9('0x30')][_0xbff9('0x43')]){_0x2a966e[_0xbff9('0x44')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2a966e);})[_0xbff9('0x16')](function(_0x16fa37){_0x1679fb['rows']=_0x16fa37;return _0x1679fb;});}})['then'](respondWithFilteredResult(_0x47f1e7,_0x2a966e))[_0xbff9('0x20')](handleError(_0x47f1e7,null));};exports[_0xbff9('0x53')]=function(_0x25be12,_0x7e9ca0,_0x14f0e4){var _0x49b01f;return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x25be12[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x7e9ca0,null))[_0xbff9('0x16')](function(_0x455f41){if(_0x455f41){return _0x455f41[_0xbff9('0x53')](_0x25be12[_0xbff9('0x30')][_0xbff9('0x54')]);}})[_0xbff9('0x16')](respondWithStatusCode(_0x7e9ca0,null))['catch'](handleError(_0x7e9ca0,null));};exports[_0xbff9('0x55')]=function(_0x222214,_0x3da4e5,_0x417eae){if(_0x222214[_0xbff9('0x4b')]['id']){delete _0x222214[_0xbff9('0x4b')]['id'];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x222214[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x3da4e5,null))['then'](function(_0x100694){if(_0x100694){_0x222214['body'][_0xbff9('0x4f')]=_0x100694['id'];return db[_0xbff9('0x56')][_0xbff9('0x4a')](_0x222214[_0xbff9('0x4b')]);}})[_0xbff9('0x16')](respondWithResult(_0x3da4e5,null))[_0xbff9('0x20')](handleError(_0x3da4e5,null));};exports['getAnswers']=function(_0x412392,_0x43ef30,_0x562fbe){var _0x45ce2a={'raw':![],'where':{}};var _0x22ac75={};var _0x31f8c8={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x412392['params']['id']}})['then'](handleEntityNotFound(_0x43ef30,null))['then'](function(_0x192c6c){if(_0x192c6c){_0x22ac75[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x56')][_0xbff9('0x49')]);_0x22ac75['query']=_[_0xbff9('0x2f')](_0x412392[_0xbff9('0x30')]);_0x22ac75['filters']=_['intersection'](_0x22ac75['model'],_0x22ac75[_0xbff9('0x30')]);_0x45ce2a['attributes']=_[_0xbff9('0x34')](_0x22ac75[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x412392['query'][_0xbff9('0x36')]));_0x45ce2a[_0xbff9('0x35')]=_0x45ce2a[_0xbff9('0x35')][_0xbff9('0x37')]?_0x45ce2a[_0xbff9('0x35')]:_0x22ac75['model'];if(!_0x412392['query'][_0xbff9('0x38')]('nolimit')){_0x45ce2a['limit']=qs['limit'](_0x412392[_0xbff9('0x30')][_0xbff9('0x26')]);_0x45ce2a[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x412392[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x45ce2a['order']=qs[_0xbff9('0x3a')](_0x412392[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x45ce2a['where']=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x412392[_0xbff9('0x30')],_0x22ac75[_0xbff9('0x33')]));_0x45ce2a['where'][_0xbff9('0x4f')]=_0x192c6c['id'];if(_0x412392[_0xbff9('0x30')]['filter']){_0x45ce2a['where']=_['merge'](_0x45ce2a[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x45ce2a[_0xbff9('0x35')],function(_0x4a4f64){var _0x24b914={};_0x24b914[_0x4a4f64]={'$like':'%'+_0x412392[_0xbff9('0x30')][_0xbff9('0x40')]+'%'};return _0x24b914;})});}_0x45ce2a=_[_0xbff9('0x3f')]({},_0x45ce2a,_0x412392[_0xbff9('0x42')]);return db['CannedAnswer'][_0xbff9('0x24')]({'where':_0x45ce2a[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x46884a){_0x31f8c8[_0xbff9('0x24')]=_0x46884a;if(_0x412392[_0xbff9('0x30')][_0xbff9('0x43')]){_0x45ce2a[_0xbff9('0x44')]=[{'all':!![]}];}return db[_0xbff9('0x56')][_0xbff9('0x45')](_0x45ce2a);})['then'](function(_0x163826){_0x31f8c8[_0xbff9('0x46')]=_0x163826;return _0x31f8c8;});}})[_0xbff9('0x16')](respondWithFilteredResult(_0x43ef30,_0x45ce2a))[_0xbff9('0x20')](handleError(_0x43ef30,null));};exports[_0xbff9('0x57')]=function(_0x41c1dd,_0x574cd9,_0x1282d6){var _0x3ff61f;return db[_0xbff9('0x2d')]['find']({'where':{'id':_0x41c1dd['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x574cd9,null))[_0xbff9('0x16')](function(_0x107719){if(_0x107719){return _0x107719[_0xbff9('0x57')](_0x41c1dd['query']['ids']);}})['then'](respondWithStatusCode(_0x574cd9,null))[_0xbff9('0x20')](handleError(_0x574cd9,null));};exports[_0xbff9('0x58')]=function(_0x4d59e0,_0x3c6000,_0x3e8036){return db[_0xbff9('0x59')][_0xbff9('0x4c')]({'where':{'id':_0x4d59e0[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x3c6000,null))['then'](function(_0x33d0ce){if(_0x33d0ce){return _0x33d0ce[_0xbff9('0x58')](_0x4d59e0['body'][_0xbff9('0x54')],_[_0xbff9('0x5a')](_0x4d59e0[_0xbff9('0x4b')],[_0xbff9('0x54'),'id'])||{});}})['then'](respondWithResult(_0x3c6000,null))['catch'](handleError(_0x3c6000,null));};exports[_0xbff9('0x5b')]=function(_0x52029a,_0x2161ac,_0x5a1d4c){var _0x5b9845={'raw':![],'where':{}};var _0x4adfc3={};var _0x21353a={'count':0x0,'rows':[]};return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x52029a[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x2161ac,null))[_0xbff9('0x16')](function(_0x55f9ee){if(_0x55f9ee){_0x4adfc3[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db['FaxInteraction']['rawAttributes']);_0x4adfc3[_0xbff9('0x30')]=_['keys'](_0x52029a['query']);_0x4adfc3['filters']=_[_0xbff9('0x34')](_0x4adfc3[_0xbff9('0x2e')],_0x4adfc3[_0xbff9('0x30')]);_0x5b9845['attributes']=_[_0xbff9('0x34')](_0x4adfc3[_0xbff9('0x2e')],qs['fields'](_0x52029a['query']['fields']));_0x5b9845['attributes']=_0x5b9845[_0xbff9('0x35')][_0xbff9('0x37')]?_0x5b9845[_0xbff9('0x35')]:_0x4adfc3[_0xbff9('0x2e')];if(!_0x52029a[_0xbff9('0x30')][_0xbff9('0x38')](_0xbff9('0x39'))){_0x5b9845[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x52029a[_0xbff9('0x30')][_0xbff9('0x26')]);_0x5b9845[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x52029a[_0xbff9('0x30')][_0xbff9('0x25')]);}_0x5b9845[_0xbff9('0x5c')]=qs[_0xbff9('0x3a')](_0x52029a['query'][_0xbff9('0x3a')]);_0x5b9845[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_['pick'](_0x52029a[_0xbff9('0x30')],_0x4adfc3['filters']));_0x5b9845[_0xbff9('0x3b')][_0xbff9('0x4f')]=_0x55f9ee['id'];if(_0x52029a[_0xbff9('0x30')][_0xbff9('0x40')]){_0x5b9845[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x5b9845[_0xbff9('0x3b')],{'$or':_['map'](_0x5b9845[_0xbff9('0x35')],function(_0x9f0e0a){var _0x348c9a={};_0x348c9a[_0x9f0e0a]={'$like':'%'+_0x52029a['query'][_0xbff9('0x40')]+'%'};return _0x348c9a;})});}_0x5b9845=_[_0xbff9('0x3f')]({},_0x5b9845,_0x52029a[_0xbff9('0x42')]);return db[_0xbff9('0x59')][_0xbff9('0x24')]({'where':_0x5b9845['where']})[_0xbff9('0x16')](function(_0x824760){_0x21353a[_0xbff9('0x24')]=_0x824760;if(_0x52029a[_0xbff9('0x30')][_0xbff9('0x43')]){_0x5b9845['include']=[{'model':db[_0xbff9('0x5d')],'as':_0xbff9('0x5e'),'required':![]},{'model':db[_0xbff9('0x5f')],'as':'Owner','attributes':[_0xbff9('0x60'),_0xbff9('0x61'),'internal'],'required':![]},{'model':db[_0xbff9('0x62')],'as':'Tags','attributes':['id',_0xbff9('0x60'),_0xbff9('0x63')],'where':_0x52029a[_0xbff9('0x30')][_0xbff9('0x64')]?{'id':_0x52029a[_0xbff9('0x30')]['tag']}:undefined,'required':_0x52029a[_0xbff9('0x30')]['tag']?!![]:![]}];}return db[_0xbff9('0x59')][_0xbff9('0x45')](_0x5b9845);})[_0xbff9('0x16')](function(_0x32679d){_0x21353a['rows']=_0x32679d;return _0x21353a;});}})['then'](respondWithFilteredResult(_0x2161ac,_0x5b9845))['catch'](handleError(_0x2161ac,null));};exports['addApplications']=function(_0x32cba8,_0x5e2698,_0x14b3cf){return db[_0xbff9('0x2d')]['findOne']({'where':{'id':_0x32cba8[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x5e2698,null))['then'](function(_0x497d01){if(_0x497d01){return db[_0xbff9('0x65')][_0xbff9('0x66')](function(_0x175f03){return db[_0xbff9('0x67')][_0xbff9('0x2a')]({'where':{'FaxAccountId':_0x32cba8[_0xbff9('0x48')]['id']},'transaction':_0x175f03})['then'](function(_0x2b3d90){var _0x245ee8=_['map'](_0x32cba8['body'],function(_0x5b25b9){_0x5b25b9[_0xbff9('0x4f')]=_0x32cba8[_0xbff9('0x48')]['id'];return _0x5b25b9;});return db[_0xbff9('0x67')][_0xbff9('0x68')](_0x245ee8,{'transaction':_0x175f03});});})[_0xbff9('0x16')](function(){return db[_0xbff9('0x67')][_0xbff9('0x69')]({'where':{'FaxAccountId':_0x32cba8[_0xbff9('0x48')]['id']},'order':_0xbff9('0x6a')});});}})[_0xbff9('0x16')](respondWithResult(_0x5e2698,null))[_0xbff9('0x20')](handleError(_0x5e2698,null));};exports[_0xbff9('0x6b')]=function(_0x382df5,_0x9603a7,_0x2b4637){var _0x16a89d={};var _0x46cfe9={};var _0xab391e;var _0x474a48;return db[_0xbff9('0x2d')]['findOne']({'where':{'id':_0x382df5[_0xbff9('0x48')]['id']}})['then'](handleEntityNotFound(_0x9603a7,null))[_0xbff9('0x16')](function(_0x210080){if(_0x210080){_0xab391e=_0x210080;_0x46cfe9[_0xbff9('0x2e')]=_['keys'](db[_0xbff9('0x67')][_0xbff9('0x49')]);_0x46cfe9[_0xbff9('0x30')]=_['keys'](_0x382df5['query']);_0x46cfe9[_0xbff9('0x33')]=_['intersection'](_0x46cfe9[_0xbff9('0x2e')],_0x46cfe9[_0xbff9('0x30')]);_0x16a89d[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x46cfe9[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x36')]));_0x16a89d[_0xbff9('0x35')]=_0x16a89d['attributes'][_0xbff9('0x37')]?_0x16a89d[_0xbff9('0x35')]:_0x46cfe9[_0xbff9('0x2e')];_0x16a89d[_0xbff9('0x5c')]=qs[_0xbff9('0x3a')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x16a89d[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x382df5[_0xbff9('0x30')],_0x46cfe9[_0xbff9('0x33')]));if(_0x382df5[_0xbff9('0x30')][_0xbff9('0x40')]){_0x16a89d['where']=_['merge'](_0x16a89d[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x16a89d[_0xbff9('0x35')],function(_0x26822f){var _0x134273={};_0x134273[_0x26822f]={'$like':'%'+_0x382df5[_0xbff9('0x30')]['filter']+'%'};return _0x134273;})});}_0x16a89d=_[_0xbff9('0x3f')]({},_0x16a89d,_0x382df5[_0xbff9('0x42')]);return _0xab391e[_0xbff9('0x6b')](_0x16a89d);}})[_0xbff9('0x16')](function(_0x2156f5){if(_0x2156f5){_0x474a48=_0x2156f5[_0xbff9('0x37')];if(!_0x382df5[_0xbff9('0x30')][_0xbff9('0x38')](_0xbff9('0x39'))){_0x16a89d[_0xbff9('0x26')]=qs[_0xbff9('0x26')](_0x382df5[_0xbff9('0x30')][_0xbff9('0x26')]);_0x16a89d[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x382df5[_0xbff9('0x30')]['offset']);}return _0xab391e[_0xbff9('0x6b')](_0x16a89d);}})[_0xbff9('0x16')](function(_0x1f24ba){if(_0x1f24ba){return _0x1f24ba?{'count':_0x474a48,'rows':_0x1f24ba}:null;}})[_0xbff9('0x16')](respondWithResult(_0x9603a7,null))['catch'](handleError(_0x9603a7,null));};function Extension(_0x162b19,_0x2c1177,_0x279f08,_0x2fe7e2){this[_0xbff9('0x6c')]='from-voip-provider';this[_0xbff9('0x6d')]=_0x162b19[_0xbff9('0x6e')];this[_0xbff9('0x6f')]=_0x2fe7e2;this[_0xbff9('0x70')]=_0xbff9('0x71');this[_0xbff9('0x72')]=_0xbff9('0x73');this[_0xbff9('0x4f')]=_0x162b19['id'];this[_0xbff9('0x6a')]=_0x2c1177;this['appdata']=_0x279f08;}function createExtensionsReciveFax(_0x217b47){var _0x3f8d0a=0x1;var _0xba15ab=[];_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'',_0xbff9('0x75')));_0x3f8d0a+=0x1;_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,_0xbff9('0x76'),'Set'));_0x3f8d0a+=0x1;for(var _0x232c3c in _0x217b47){if(_0x217b47[_0xbff9('0x38')](_0x232c3c)&&(_0x232c3c===_0xbff9('0x77')||_0x232c3c===_0xbff9('0x6e')||_0x232c3c===_0xbff9('0x78')||_0x232c3c==='faxdetect'||_0x232c3c==='headerinfo'||_0x232c3c===_0xbff9('0x79')||_0x232c3c===_0xbff9('0x7a')||_0x232c3c===_0xbff9('0x7b')||_0x232c3c===_0xbff9('0x7c'))){_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'FAXOPT('+_0x232c3c+')='+_0x217b47[_0x232c3c],_0xbff9('0x7d')));_0x3f8d0a+=0x1;}}_0xba15ab[_0xbff9('0x74')](new Extension(_0x217b47,_0x3f8d0a,'6',_0xbff9('0x7e')));_0x3f8d0a+=0x1;_0xba15ab['push'](new Extension(_0x217b47,_0x3f8d0a,_0xbff9('0x7f'),_0xbff9('0x80')));_0x3f8d0a=0x0;return _0xba15ab;}exports[_0xbff9('0x81')]=function(_0x42b896,_0x5b90e4,_0xf0c01d){var _0x552955;return db[_0xbff9('0x65')][_0xbff9('0x66')](function(_0x2f1557){return db[_0xbff9('0x2d')][_0xbff9('0x4a')](_0x42b896[_0xbff9('0x4b')],{'transaction':_0x2f1557})[_0xbff9('0x16')](function(_0x50d97a){_0x552955=_0x50d97a[_0xbff9('0x82')]({'plain':!![]});return db[_0xbff9('0x83')][_0xbff9('0x68')](createExtensionsReciveFax(_0x552955),{'transaction':_0x2f1557});});})['then'](function(){return _0x552955;})[_0xbff9('0x16')](respondWithResult(_0x5b90e4,null))[_0xbff9('0x20')](handleError(_0x5b90e4,null));};exports[_0xbff9('0x84')]=function(_0x8dc1a4,_0x40dde1,_0x5db060){var _0x90b56c;return db['sequelize'][_0xbff9('0x66')](function(_0x2962f4){return db[_0xbff9('0x2d')]['update'](_0x8dc1a4[_0xbff9('0x4b')],{'where':{'id':_0x8dc1a4[_0xbff9('0x4b')]['id']},'transaction':_0x2962f4})[_0xbff9('0x16')](function(_0x586611){return db[_0xbff9('0x83')][_0xbff9('0x2a')]({'where':{'FaxAccountId':_0x8dc1a4[_0xbff9('0x4b')]['id']},'transaction':_0x2962f4})[_0xbff9('0x16')](function(_0x35fd08){return db['VoiceExtension'][_0xbff9('0x68')](createExtensionsReciveFax(_[_0xbff9('0x5a')](_0x8dc1a4['body'],['tech',_0xbff9('0x85'),_0xbff9('0x86'),_0xbff9('0x87'),_0xbff9('0x88'),_0xbff9('0x89')])),{'transaction':_0x2962f4});});});})[_0xbff9('0x16')](function(){return db[_0xbff9('0x2d')]['findById'](_0x8dc1a4['body']['id']);})[_0xbff9('0x16')](respondWithResult(_0x40dde1,null))['catch'](handleError(_0x40dde1,null));};exports['getMessages']=function(_0x414d6a,_0x292fae,_0x36d892){var _0x3ff9ef={'raw':!![],'where':{}};var _0x585828={};var _0x4a43d5={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x414d6a['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x292fae,null))[_0xbff9('0x16')](function(_0x269f2){if(_0x269f2){_0x585828[_0xbff9('0x2e')]=_[_0xbff9('0x2f')](db[_0xbff9('0x8a')][_0xbff9('0x49')]);_0x585828[_0xbff9('0x30')]=_['keys'](_0x414d6a[_0xbff9('0x30')]);_0x585828[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x585828[_0xbff9('0x2e')],_0x585828['query']);_0x3ff9ef[_0xbff9('0x35')]=_['intersection'](_0x585828['model'],qs[_0xbff9('0x36')](_0x414d6a[_0xbff9('0x30')]['fields']));_0x3ff9ef[_0xbff9('0x35')]=_0x3ff9ef['attributes'][_0xbff9('0x37')]?_0x3ff9ef['attributes']:_0x585828[_0xbff9('0x2e')];if(!_0x414d6a[_0xbff9('0x30')]['hasOwnProperty'](_0xbff9('0x39'))){_0x3ff9ef[_0xbff9('0x26')]=qs['limit'](_0x414d6a[_0xbff9('0x30')][_0xbff9('0x26')]);_0x3ff9ef[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x414d6a['query'][_0xbff9('0x25')]);}_0x3ff9ef[_0xbff9('0x5c')]=qs['sort'](_0x414d6a[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x3ff9ef[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_['pick'](_0x414d6a['query'],_0x585828['filters']));_0x3ff9ef[_0xbff9('0x3b')]['FaxAccountId']=_0x269f2['id'];if(_0x414d6a[_0xbff9('0x30')]['filter']){_0x3ff9ef[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x3ff9ef[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x3ff9ef[_0xbff9('0x35')],function(_0x2252d0){var _0x44673e={};_0x44673e[_0x2252d0]={'$like':'%'+_0x414d6a['query'][_0xbff9('0x40')]+'%'};return _0x44673e;})});}if(_0x414d6a[_0xbff9('0x30')][_0xbff9('0x8b')]){var _0x34724e=_0x414d6a[_0xbff9('0x30')][_0xbff9('0x8b')][_0xbff9('0x8c')](',');var _0x398cc9={};_0x398cc9[_0x34724e[0x0]]={'$gte':moment(_0x34724e[0x1])[_0xbff9('0x8d')](_0xbff9('0x8e'))};_0x3ff9ef[_0xbff9('0x3b')]=_[_0xbff9('0x3f')](_0x3ff9ef[_0xbff9('0x3b')],_0x398cc9);}_0x3ff9ef=_[_0xbff9('0x3f')]({},_0x3ff9ef,_0x414d6a[_0xbff9('0x42')]);return db['FaxMessage'][_0xbff9('0x24')]({'where':_0x3ff9ef[_0xbff9('0x3b')]})[_0xbff9('0x16')](function(_0x16556d){_0x4a43d5['count']=_0x16556d;if(_0x414d6a[_0xbff9('0x30')][_0xbff9('0x43')]){_0x3ff9ef[_0xbff9('0x44')]=[{'all':!![]}];}return db['FaxMessage'][_0xbff9('0x45')](_0x3ff9ef);})[_0xbff9('0x16')](function(_0x19d6ed){_0x4a43d5[_0xbff9('0x46')]=_0x19d6ed;return _0x4a43d5;});}})[_0xbff9('0x16')](respondWithFilteredResult(_0x292fae,_0x3ff9ef))[_0xbff9('0x20')](handleError(_0x292fae,null));};exports[_0xbff9('0x2c')]=function(_0x54378e,_0xe6ebba,_0x2540d6){var _0x48bd2f,_0x4e4f90={},_0x77748d;if(_0x54378e[_0xbff9('0x4b')]['to']){_0x77748d=_0x54378e[_0xbff9('0x4b')]['to'][0x0];}return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x54378e[_0xbff9('0x48')]['id']},'include':[{'model':db[_0xbff9('0x8f')],'as':_0xbff9('0x90'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x77748d},'limit':0x1,'order':[[_0xbff9('0x87'),_0xbff9('0x91')]]}]}]})[_0xbff9('0x16')](handleEntityNotFound(_0xe6ebba,null))[_0xbff9('0x16')](function(_0x3dcb71){_0x48bd2f=_0x3dcb71;if(_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')]&&_0x54378e['body'][_0xbff9('0x92')]['length']){for(var _0x2d5cd3=0x0;_0x2d5cd3<_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0xbff9('0x37')];_0x2d5cd3+=0x1){_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0x2d5cd3]={'filename':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][_0x2d5cd3][_0xbff9('0x60')],'id':_0x54378e[_0xbff9('0x4b')]['attachments'][_0x2d5cd3]['id'],'path':path[_0xbff9('0x93')](config['root'],_0xbff9('0x94'),_0x54378e['body'][_0xbff9('0x92')][_0x2d5cd3]['basename'])};}}return respondWithRpcPromise(_0xbff9('0x95'),'CheckAfterSend',{'FaxAccountId':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x48')]['id'])?undefined:_0x54378e[_0xbff9('0x48')]['id'],'path':_['isNil'](_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['path'])?undefined:_0x54378e['body'][_0xbff9('0x92')][0x0][_0xbff9('0x4')],'fax':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x4b')]['to'][0x0])?undefined:_0x54378e[_0xbff9('0x4b')]['to'][0x0]},client9002);})[_0xbff9('0x16')](function(){if(_0x48bd2f){if(_[_0xbff9('0x96')](_0x54378e['body'][_0xbff9('0x97')])){_0x54378e[_0xbff9('0x4b')]['from']=util[_0xbff9('0x8d')](_0xbff9('0x98'),_0x48bd2f['name'],_0x48bd2f[_0xbff9('0x99')]);}if(_0x48bd2f[_0xbff9('0x90')]){if(_0x48bd2f[_0xbff9('0x90')][_0xbff9('0x9a')][_0xbff9('0x37')]){return _0x48bd2f[_0xbff9('0x90')][_0xbff9('0x9a')][0x0];}else{return db[_0xbff9('0x5d')][_0xbff9('0x4a')](_[_0xbff9('0x9b')](_0x54378e[_0xbff9('0x4b')],{'firstName':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'phone':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'fax':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'ListId':_0x48bd2f['ListId']}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xbff9('0x9c'));}})[_0xbff9('0x16')](function(_0x20013e){if(_0x20013e){return db[_0xbff9('0x59')]['find']({'where':{'ContactId':_0x20013e['id'],'closed':![],'FaxAccountId':_0x48bd2f['id']}})[_0xbff9('0x16')](function(_0x561105){if(_0x561105){return[_0x561105,![]];}return db[_0xbff9('0x59')][_0xbff9('0x4a')]({'UserId':_0x54378e[_0xbff9('0x9d')]['id'],'ContactId':_0x20013e['id'],'FaxAccountId':_0x48bd2f['id'],'fax':_0x54378e[_0xbff9('0x4b')]['to'][0x0],'firstMsgDirection':_0xbff9('0x9e'),'Messages':[_[_0xbff9('0x3f')](_0x54378e[_0xbff9('0x4b')],{'read':![],'body':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0][_0xbff9('0x9f')],'FaxAccountId':_0x48bd2f['id'],'UserId':_0x54378e[_0xbff9('0x9d')]['id'],'ContactId':_0x20013e['id'],'AttachmentId':_0x54378e['body'][_0xbff9('0x92')][0x0]['id']})]},{'include':[{'model':db[_0xbff9('0x8a')],'as':'Messages'}]})[_0xbff9('0x16')](function(_0x27201e){return[_0x27201e,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbff9('0xa0')](function(_0x2c17e3,_0x54307d){if(_0x54307d){return _0x2c17e3;}return db[_0xbff9('0x8a')]['create']({'direction':_0xbff9('0x9e'),'read':![],'body':_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x9f')],'FaxAccountId':_0x48bd2f['id'],'FaxInteractionId':_0x2c17e3['id'],'UserId':_0x54378e['user']['id'],'ContactId':_0x2c17e3[_0xbff9('0xa1')],'AttachmentId':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['id']})[_0xbff9('0x16')](function(_0x21b493){_0x2c17e3[_0xbff9('0xa2')][_0xbff9('0xa3')]=[];_0x2c17e3[_0xbff9('0xa2')]['Messages'][_0xbff9('0x74')](_0x21b493[_0xbff9('0xa2')]);return _0x2c17e3;});})[_0xbff9('0x16')](function(_0x1ce36a){respondWithRpcPromise(_0xbff9('0xa4'),'SendFax',{'FaxAccountId':_[_0xbff9('0x96')](_0x54378e[_0xbff9('0x48')]['id'])?undefined:_0x54378e[_0xbff9('0x48')]['id'],'path':_['isNil'](_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x4')])?undefined:_0x54378e[_0xbff9('0x4b')]['attachments'][0x0][_0xbff9('0x4')],'fax':_['isNil'](_0x54378e['body']['to'][0x0])?undefined:_0x54378e['body']['to'][0x0],'AttachmentId':_0x54378e[_0xbff9('0x4b')][_0xbff9('0x92')][0x0]['id']},client9002)[_0xbff9('0x16')](function(_0x5f59ec){logger[_0xbff9('0x1e')]('SendFaxRpc,\x20%s',_0x5f59ec);})[_0xbff9('0x20')](function(_0x1bf962){logger[_0xbff9('0x1e')](_0xbff9('0xa5'),_0x1bf962);});return _0x1ce36a;})[_0xbff9('0x16')](respondWithResult(_0xe6ebba,null))['catch'](handleError(_0xe6ebba,null));};exports[_0xbff9('0xa6')]=function(_0x5b463a,_0x5e1988,_0x4d1cfa){return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x5b463a[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x5e1988,null))[_0xbff9('0x16')](function(_0x25474c){if(_0x25474c){return _0x25474c[_0xbff9('0xa6')](_0x5b463a[_0xbff9('0x4b')][_0xbff9('0x54')],_[_0xbff9('0x5a')](_0x5b463a[_0xbff9('0x4b')],[_0xbff9('0x54'),'id'])||{})['spread'](function(_0x1cfb3c){for(var _0x328056=0x0;_0x328056<_0x5b463a[_0xbff9('0x4b')]['ids']['length'];_0x328056+=0x1){socket['emit']('userFaxAccount:save',{'UserId':_0x5b463a['body'][_0xbff9('0x54')][_0x328056],'FaxAccountId':_0x5b463a['params']['id']});}return _0x1cfb3c;});}})[_0xbff9('0x16')](respondWithResult(_0x5e1988,null))[_0xbff9('0x20')](handleError(_0x5e1988,null));};exports[_0xbff9('0xa7')]=function(_0x4fbf7d,_0x1b8331,_0x184979){var _0x4a4393;return db[_0xbff9('0x2d')][_0xbff9('0x4c')]({'where':{'id':_0x4fbf7d[_0xbff9('0x48')]['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x1b8331,null))[_0xbff9('0x16')](function(_0x3063ed){if(_0x3063ed){return _0x3063ed[_0xbff9('0xa7')](_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')])[_0xbff9('0x16')](function(_0x4231e3){if(_[_0xbff9('0xa8')](_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')])){for(var _0x45afd2=0x0;_0x45afd2<_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')]['length'];_0x45afd2+=0x1){socket['emit'](_0xbff9('0xa9'),{'UserId':_0x4fbf7d[_0xbff9('0x30')][_0xbff9('0x54')][_0x45afd2],'FaxAccountId':_0x4fbf7d[_0xbff9('0x48')]['id']});}}else{socket[_0xbff9('0xaa')]('userFaxAccount:remove',{'UserId':_0x4fbf7d['query'][_0xbff9('0x54')],'FaxAccountId':_0x4fbf7d[_0xbff9('0x48')]['id']});}});}})[_0xbff9('0x16')](respondWithStatusCode(_0x1b8331,null))[_0xbff9('0x20')](handleError(_0x1b8331,null));};exports['getAgents']=function(_0x5cc3c9,_0x52adda,_0x46a98b){var _0x24f4b0={};var _0x59aee3={};var _0x23e6d1;var _0x45f17e;return db[_0xbff9('0x2d')][_0xbff9('0x52')]({'where':{'id':_0x5cc3c9['params']['id']}})[_0xbff9('0x16')](handleEntityNotFound(_0x52adda,null))[_0xbff9('0x16')](function(_0x566f25){if(_0x566f25){_0x23e6d1=_0x566f25;_0x59aee3[_0xbff9('0x2e')]=_['keys'](db[_0xbff9('0x5f')][_0xbff9('0x49')]);_0x59aee3[_0xbff9('0x30')]=_[_0xbff9('0x2f')](_0x5cc3c9[_0xbff9('0x30')]);_0x59aee3[_0xbff9('0x33')]=_[_0xbff9('0x34')](_0x59aee3[_0xbff9('0x2e')],_0x59aee3[_0xbff9('0x30')]);_0x24f4b0[_0xbff9('0x35')]=_[_0xbff9('0x34')](_0x59aee3[_0xbff9('0x2e')],qs[_0xbff9('0x36')](_0x5cc3c9['query'][_0xbff9('0x36')]));_0x24f4b0[_0xbff9('0x35')]=_0x24f4b0[_0xbff9('0x35')][_0xbff9('0x37')]?_0x24f4b0[_0xbff9('0x35')]:_0x59aee3[_0xbff9('0x2e')];_0x24f4b0[_0xbff9('0x5c')]=qs['sort'](_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x3a')]);_0x24f4b0[_0xbff9('0x3b')]=qs[_0xbff9('0x33')](_[_0xbff9('0x3c')](_0x5cc3c9[_0xbff9('0x30')],_0x59aee3[_0xbff9('0x33')]));if(_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x40')]){_0x24f4b0['where']=_[_0xbff9('0x3f')](_0x24f4b0[_0xbff9('0x3b')],{'$or':_[_0xbff9('0x41')](_0x24f4b0[_0xbff9('0x35')],function(_0x4b4fda){var _0xa78973={};_0xa78973[_0x4b4fda]={'$like':'%'+_0x5cc3c9[_0xbff9('0x30')]['filter']+'%'};return _0xa78973;})});}_0x24f4b0=_[_0xbff9('0x3f')]({},_0x24f4b0,_0x5cc3c9[_0xbff9('0x42')]);return _0x23e6d1[_0xbff9('0xab')](_0x24f4b0);}})['then'](function(_0x3af6d7){if(_0x3af6d7){_0x45f17e=_0x3af6d7['length'];if(!_0x5cc3c9[_0xbff9('0x30')]['hasOwnProperty'](_0xbff9('0x39'))){_0x24f4b0[_0xbff9('0x26')]=qs['limit'](_0x5cc3c9[_0xbff9('0x30')][_0xbff9('0x26')]);_0x24f4b0[_0xbff9('0x25')]=qs[_0xbff9('0x25')](_0x5cc3c9['query']['offset']);}return _0x23e6d1['getAgents'](_0x24f4b0);}})[_0xbff9('0x16')](function(_0xb8c2a8){if(_0xb8c2a8){return _0xb8c2a8?{'count':_0x45f17e,'rows':_0xb8c2a8}:null;}})[_0xbff9('0x16')](respondWithResult(_0x52adda,null))[_0xbff9('0x20')](handleError(_0x52adda,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 30fe8f9..380c11a 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 _0xdaea=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x535424,_0x177ea0){var _0x45ad25=function(_0x1b4da2){while(--_0x1b4da2){_0x535424['push'](_0x535424['shift']());}};_0x45ad25(++_0x177ea0);}(_0xdaea,0x163));var _0xadae=function(_0x1c510a,_0x1413a9){_0x1c510a=_0x1c510a-0x0;var _0x23cedd=_0xdaea[_0x1c510a];return _0x23cedd;};'use strict';var EventEmitter=require(_0xadae('0x0'));var FaxAccount=require(_0xadae('0x1'))['db'][_0xadae('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xadae('0x3')](0x0);var events={'afterCreate':_0xadae('0x4'),'afterUpdate':'update','afterDestroy':_0xadae('0x5')};function emitEvent(_0x3aa6b2){return function(_0x3cc625,_0x18ed0f,_0x2b4c0f){FaxAccountEvents[_0xadae('0x6')](_0x3aa6b2+':'+_0x3cc625['id'],_0x3cc625);FaxAccountEvents[_0xadae('0x6')](_0x3aa6b2,_0x3cc625);_0x2b4c0f(null);};}for(var e in events){if(events[_0xadae('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xadae('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x8511=['hasOwnProperty','events','../../mysqldb','FaxAccount','save','update','emit'];(function(_0x585fe0,_0x2a42c6){var _0x219da5=function(_0x52da95){while(--_0x52da95){_0x585fe0['push'](_0x585fe0['shift']());}};_0x219da5(++_0x2a42c6);}(_0x8511,0x135));var _0x1851=function(_0xfea597,_0x5bc88d){_0xfea597=_0xfea597-0x0;var _0x5e3649=_0x8511[_0xfea597];return _0x5e3649;};'use strict';var EventEmitter=require(_0x1851('0x0'));var FaxAccount=require(_0x1851('0x1'))['db'][_0x1851('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1851('0x3'),'afterUpdate':_0x1851('0x4'),'afterDestroy':'remove'};function emitEvent(_0x560bef){return function(_0x3548c8,_0x2e15ca,_0x5b9d1d){FaxAccountEvents['emit'](_0x560bef+':'+_0x3548c8['id'],_0x3548c8);FaxAccountEvents[_0x1851('0x5')](_0x560bef,_0x3548c8);_0x5b9d1d(null);};}for(var e in events){if(events[_0x1851('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5283952..185d397 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 _0xc4be=['exports','FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','./faxAccount.attributes'];(function(_0x52c139,_0x50f364){var _0x387d63=function(_0x461b35){while(--_0x461b35){_0x52c139['push'](_0x52c139['shift']());}};_0x387d63(++_0x50f364);}(_0xc4be,0x1ed));var _0xec4b=function(_0x3a7dfc,_0x2103c4){_0x3a7dfc=_0x3a7dfc-0x0;var _0x338897=_0xc4be[_0x3a7dfc];return _0x338897;};'use strict';var _=require(_0xec4b('0x0'));var util=require(_0xec4b('0x1'));var logger=require('../../config/logger')(_0xec4b('0x2'));var moment=require(_0xec4b('0x3'));var BPromise=require(_0xec4b('0x4'));var rp=require(_0xec4b('0x5'));var attributes=require(_0xec4b('0x6'));module[_0xec4b('0x7')]=function(_0x5c535b,_0x114f34){return _0x5c535b['define'](_0xec4b('0x8'),attributes,{'tableName':_0xec4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2f9=['lodash','util','api','moment','request-promise','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0xb9ccf7,_0x58b5e2){var _0x1a5e02=function(_0x419c96){while(--_0x419c96){_0xb9ccf7['push'](_0xb9ccf7['shift']());}};_0x1a5e02(++_0x58b5e2);}(_0xd2f9,0x1ef));var _0x9d2f=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0xd2f9[_0x1a89ca];return _0x29cbb2;};'use strict';var _=require(_0x9d2f('0x0'));var util=require(_0x9d2f('0x1'));var logger=require('../../config/logger')(_0x9d2f('0x2'));var moment=require(_0x9d2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d2f('0x4'));var attributes=require(_0x9d2f('0x5'));module[_0x9d2f('0x6')]=function(_0x2045a1,_0x2836c5){return _0x2045a1['define'](_0x9d2f('0x7'),attributes,{'tableName':_0x9d2f('0x8'),'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 1aa0b8a..a2713b6 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 _0x7216=['User','name','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','attributes','include','model','map','GetFaxAccount','NotifyFaxAccount','body','describe','Sequelize','ValidationError','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','account','applications','list','orderBy','asc','length','defaults','contact','fax','FaxInteraction','find','create','spread','get','autoclose','push','*,*,*,*','created','FaxMessage','ContactId'];(function(_0x55a9b3,_0xe5a8f1){var _0x56e853=function(_0x1ebf4e){while(--_0x1ebf4e){_0x55a9b3['push'](_0x55a9b3['shift']());}};_0x56e853(++_0xe5a8f1);}(_0x7216,0x107));var _0x6721=function(_0x18e4bb,_0xc458b0){_0x18e4bb=_0x18e4bb-0x0;var _0x35856d=_0x7216[_0x18e4bb];return _0x35856d;};'use strict';var _=require(_0x6721('0x0'));var util=require(_0x6721('0x1'));var moment=require(_0x6721('0x2'));var BPromise=require(_0x6721('0x3'));var rs=require(_0x6721('0x4'));var fs=require('fs');var db=require(_0x6721('0x5'))['db'];var utils=require(_0x6721('0x6'));var logger=require(_0x6721('0x7'))(_0x6721('0x8'));var config=require(_0x6721('0x9'));var jayson=require(_0x6721('0xa'));var client=jayson['client'][_0x6721('0xb')]({'port':0x232c});var socket=require(_0x6721('0xc'))({'host':_0x6721('0xd'),'port':0x18eb});require(_0x6721('0xe'))[_0x6721('0xf')](socket);function respondWithRpcPromise(_0x3b4e52,_0x1d1975,_0x5b9a86){return new BPromise(function(_0xe41fc1,_0x44a010){return client['request'](_0x3b4e52,_0x5b9a86)[_0x6721('0x10')](function(_0x1a601a){logger[_0x6721('0x11')](_0x6721('0x12'),_0x1d1975,_0x6721('0x13'));logger[_0x6721('0x14')](_0x6721('0x15'),_0x1d1975,_0x6721('0x13'),JSON[_0x6721('0x16')](_0x1a601a));if(_0x1a601a[_0x6721('0x17')]){if(_0x1a601a['error'][_0x6721('0x18')]===0x1f4){logger[_0x6721('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1d1975,_0x1a601a[_0x6721('0x17')][_0x6721('0x19')]);return _0x44a010(_0x1a601a[_0x6721('0x17')][_0x6721('0x19')]);}logger[_0x6721('0x17')](_0x6721('0x12'),_0x1d1975,_0x1a601a['error'][_0x6721('0x19')]);return _0xe41fc1(_0x1a601a[_0x6721('0x17')][_0x6721('0x19')]);}else{logger[_0x6721('0x11')](_0x6721('0x12'),_0x1d1975,_0x6721('0x13'));_0xe41fc1(_0x1a601a[_0x6721('0x1a')][_0x6721('0x19')]);}})[_0x6721('0x1b')](function(_0x3f41c0){logger[_0x6721('0x17')]('FaxAccount,\x20%s,\x20%s',_0x1d1975,_0x3f41c0);_0x44a010(_0x3f41c0);});});}exports['GetFaxAccount']=function(_0x1a750f){var _0x30b359=this;return new Promise(function(_0x194c05,_0x2bd160){return db[_0x6721('0x1c')][_0x6721('0x1d')]({'raw':_0x1a750f[_0x6721('0x1e')]?_0x1a750f[_0x6721('0x1e')][_0x6721('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a750f[_0x6721('0x1e')]?_0x1a750f[_0x6721('0x1e')][_0x6721('0x20')]||null:null,'attributes':_0x1a750f['options']?_0x1a750f['options'][_0x6721('0x21')]||null:null,'limit':_0x1a750f[_0x6721('0x1e')]?_0x1a750f['options']['limit']||null:null,'include':_0x1a750f[_0x6721('0x1e')]?_0x1a750f[_0x6721('0x1e')][_0x6721('0x22')]?_['map'](_0x1a750f[_0x6721('0x1e')][_0x6721('0x22')],function(_0x1150a0){return{'model':db[_0x1150a0[_0x6721('0x23')]],'as':_0x1150a0['as'],'attributes':_0x1150a0[_0x6721('0x21')],'include':_0x1150a0['include']?_[_0x6721('0x24')](_0x1150a0[_0x6721('0x22')],function(_0x412355){return{'model':db[_0x412355['model']],'as':_0x412355['as'],'attributes':_0x412355[_0x6721('0x21')],'include':_0x412355[_0x6721('0x22')]?_[_0x6721('0x24')](_0x412355[_0x6721('0x22')],function(_0x1bec9c){return{'model':db[_0x1bec9c[_0x6721('0x23')]],'as':_0x1bec9c['as'],'attributes':_0x1bec9c['attributes']};}):[]};}):[]};}):[]:[]})[_0x6721('0x10')](function(_0x5434b7){logger['info']('GetFaxAccount',_0x1a750f);logger[_0x6721('0x14')](_0x6721('0x25'),_0x1a750f,JSON[_0x6721('0x16')](_0x5434b7));_0x194c05(_0x5434b7);})[_0x6721('0x1b')](function(_0x175c81){logger[_0x6721('0x17')](_0x6721('0x25'),_0x175c81[_0x6721('0x19')],_0x1a750f);_0x2bd160(_0x30b359['error'](0x1f4,_0x175c81['message']));});});};exports[_0x6721('0x26')]=function(_0x24a4a1,_0x17a723,_0x3d29ef){var _0x28c36f=this;return new Promise(function(_0x34875f,_0x3d914d){var _0x57456b={'body':_0x24a4a1[_0x6721('0x27')],'channel':'fax'};var _0x2f4c0b=[];var _0x4dd92f=[];var _0x2cc67b={};return db['CmContact'][_0x6721('0x28')]()['then'](function(_0x2d3c53){if(!_0x2d3c53){throw new db[(_0x6721('0x29'))][(_0x6721('0x2a'))]('no\x20available\x20attributes');}_0x2f4c0b=_[_0x6721('0x2b')](_['keys'](_0x2d3c53),[_0x6721('0x2c'),_0x6721('0x2d')]);_0x4dd92f=_[_0x6721('0x2b')](_[_0x6721('0x2e')](_0x2d3c53),[_0x6721('0x2c'),_0x6721('0x2d'),_0x6721('0x2f'),_0x6721('0x30')]);if(_0x24a4a1[_0x6721('0x27')]['id']){delete _0x24a4a1[_0x6721('0x27')]['id'];}if(_[_0x6721('0x31')](_0x24a4a1[_0x6721('0x27')][_0x6721('0x32')])){throw new db[(_0x6721('0x29'))][(_0x6721('0x2a'))](_0x6721('0x33'));}if(_['isNil'](_0x24a4a1[_0x6721('0x27')][_0x6721('0x27')])||_0x24a4a1[_0x6721('0x27')][_0x6721('0x27')]===''){throw new db[(_0x6721('0x29'))][(_0x6721('0x2a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6721('0x31')](_0x24a4a1['body']['mapKey'])){throw new db['Sequelize'][(_0x6721('0x2a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4dd92f);}if(!_['includes'](_0x4dd92f,_0x24a4a1[_0x6721('0x27')]['mapKey'])){throw new db[(_0x6721('0x29'))][(_0x6721('0x2a'))](_0x6721('0x34')+_0x4dd92f);}_0x2cc67b[_0x24a4a1[_0x6721('0x27')][_0x6721('0x35')]]=_0x24a4a1['body'][_0x6721('0x32')];})[_0x6721('0x10')](function(){return db[_0x6721('0x1c')]['find']({'where':{'id':_0x24a4a1['account']['id']},'include':[{'model':db[_0x6721('0x36')],'as':_0x6721('0x37'),'include':[{'model':db[_0x6721('0x38')],'as':_0x6721('0x39'),'where':_0x2cc67b,'limit':0x1,'order':[[_0x6721('0x2d'),_0x6721('0x3a')]]}]},{'model':db[_0x6721('0x3b')],'as':_0x6721('0x3c')}]});})[_0x6721('0x10')](function(_0x2d038f){if(_0x2d038f&&_0x2d038f[_0x6721('0x37')]){var _0x167625=_0x2d038f['get']({'plain':!![]});_0x57456b[_0x6721('0x3d')]=_0x167625;_0x57456b[_0x6721('0x3e')]=_0x167625[_0x6721('0x3c')];_0x57456b[_0x6721('0x3f')]=_0x167625[_0x6721('0x37')];_0x57456b['applications']=_[_0x6721('0x40')](_0x57456b[_0x6721('0x3e')],['priority'],[_0x6721('0x41')]);if(_0x57456b[_0x6721('0x3d')][_0x6721('0x3c')]){delete _0x57456b[_0x6721('0x3d')][_0x6721('0x3c')];}if(_0x57456b['account']['List']&&_0x57456b[_0x6721('0x3d')][_0x6721('0x37')][_0x6721('0x39')][_0x6721('0x42')]){return _0x57456b[_0x6721('0x3d')][_0x6721('0x37')][_0x6721('0x39')][0x0];}var _0x2bfbe0=_[_0x6721('0x43')](_0x24a4a1[_0x6721('0x27')],{'firstName':_0x24a4a1[_0x6721('0x27')]['from'],'ListId':_0x167625[_0x6721('0x30')]});_0x2bfbe0[_0x24a4a1['body']['mapKey']]=_0x24a4a1[_0x6721('0x27')][_0x6721('0x32')];return db[_0x6721('0x38')]['create'](_0x2bfbe0,{'fields':_0x2f4c0b,'raw':!![]});}})[_0x6721('0x10')](function(_0x28e0f5){_0x57456b[_0x6721('0x44')]=_0x28e0f5;if(_0x28e0f5){var _0x1cd1c8={'ContactId':_0x28e0f5['id'],'FaxAccountId':_0x24a4a1[_0x6721('0x3d')]['id'],'fax':_0x28e0f5[_0x6721('0x45')]};return db[_0x6721('0x46')][_0x6721('0x47')]({'where':{'ContactId':_0x28e0f5['id'],'closed':![],'FaxAccountId':_0x24a4a1[_0x6721('0x3d')]['id']}})[_0x6721('0x10')](function(_0x45574a){if(_0x45574a){return[_0x45574a,![]];}return db[_0x6721('0x46')][_0x6721('0x48')](_0x1cd1c8)[_0x6721('0x10')](function(_0x13a6af){return[_0x13a6af,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x6721('0x49')](function(_0x5bdb1c,_0x1df57d){var _0x4ba598=_0x5bdb1c[_0x6721('0x4a')]({'plain':!![]});if(_0x1df57d){if(_0x57456b['account'][_0x6721('0x4b')]){_0x57456b[_0x6721('0x3e')][_0x6721('0x4c')]({'id':0x0,'priority':_0x57456b[_0x6721('0x3e')][_0x6721('0x42')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x6721('0x4d')});}_0x4ba598[_0x6721('0x4e')]=!![];}else{_0x4ba598['created']=![];}_0x57456b['interaction']=_0x4ba598;return db[_0x6721('0x4f')][_0x6721('0x48')]({'body':_0x24a4a1[_0x6721('0x27')][_0x6721('0x27')],'FaxAccountId':_0x24a4a1['account']['id'],'FaxInteractionId':_0x5bdb1c['id'],'direction':'in','ContactId':_0x5bdb1c[_0x6721('0x50')],'AttachmentId':_0x24a4a1[_0x6721('0x27')]['AttachmentId']});})[_0x6721('0x10')](function(_0x4d498b){_0x57456b['message']=_0x4d498b;if(_0x57456b['interaction']['UserId']){return db[_0x6721('0x51')]['find']({'attributes':['id',_0x6721('0x52')],'where':{'id':_0x57456b['interaction']['UserId']}})[_0x6721('0x10')](function(_0x320f18){if(_0x320f18){_0x57456b[_0x6721('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x6721('0x53'),'appdata':_0x320f18[_0x6721('0x52')]+','+(_0x57456b[_0x6721('0x3d')][_0x6721('0x54')]||0xa),'interval':_0x6721('0x4d')});}return respondWithRpcPromise(_0x6721('0x55'),'startRouting',_0x57456b);});}return respondWithRpcPromise('Start','startRouting',_0x57456b);})[_0x6721('0x10')](function(_0x1e5e49){_0x34875f(_0x1e5e49);})[_0x6721('0x1b')](function(_0x41af43){_0x3d914d(_0x28c36f[_0x6721('0x17')](0x1f4,_0x41af43[_0x6721('0x19')]));});});}; \ No newline at end of file +var _0x4571=['http','localhost','./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','catch','GetFaxAccount','findAll','raw','options','where','limit','include','model','map','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','ListId','body','isNil','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','account','CmList','DESC','Applications','List','applications','orderBy','priority','asc','Contacts','length','defaults','create','contact','FaxInteraction','spread','get','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dbaba,_0x15f997){var _0x4894ac=function(_0x6f3267){while(--_0x6f3267){_0x3dbaba['push'](_0x3dbaba['shift']());}};_0x4894ac(++_0x15f997);}(_0x4571,0x1af));var _0x1457=function(_0x35f7f5,_0x4e2ee1){_0x35f7f5=_0x35f7f5-0x0;var _0x5567a4=_0x4571[_0x35f7f5];return _0x5567a4;};'use strict';var _=require(_0x1457('0x0'));var util=require(_0x1457('0x1'));var moment=require(_0x1457('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x1457('0x3'))['db'];var utils=require(_0x1457('0x4'));var logger=require('../../config/logger')(_0x1457('0x5'));var config=require(_0x1457('0x6'));var jayson=require(_0x1457('0x7'));var client=jayson[_0x1457('0x8')][_0x1457('0x9')]({'port':0x232c});var socket=require('socket.io-emitter')({'host':_0x1457('0xa'),'port':0x18eb});require(_0x1457('0xb'))[_0x1457('0xc')](socket);function respondWithRpcPromise(_0x332d11,_0x135bc2,_0x56db4a){return new BPromise(function(_0x20ce3f,_0x191556){return client[_0x1457('0xd')](_0x332d11,_0x56db4a)[_0x1457('0xe')](function(_0x272b03){logger[_0x1457('0xf')](_0x1457('0x10'),_0x135bc2,_0x1457('0x11'));logger[_0x1457('0x12')](_0x1457('0x13'),_0x135bc2,_0x1457('0x11'),JSON[_0x1457('0x14')](_0x272b03));if(_0x272b03['error']){if(_0x272b03[_0x1457('0x15')]['code']===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x135bc2,_0x272b03['error'][_0x1457('0x16')]);return _0x191556(_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);}logger[_0x1457('0x15')](_0x1457('0x10'),_0x135bc2,_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);return _0x20ce3f(_0x272b03[_0x1457('0x15')][_0x1457('0x16')]);}else{logger[_0x1457('0xf')](_0x1457('0x10'),_0x135bc2,_0x1457('0x11'));_0x20ce3f(_0x272b03[_0x1457('0x17')][_0x1457('0x16')]);}})[_0x1457('0x18')](function(_0x243621){logger[_0x1457('0x15')](_0x1457('0x10'),_0x135bc2,_0x243621);_0x191556(_0x243621);});});}exports[_0x1457('0x19')]=function(_0x2e766d){var _0x72af5d=this;return new Promise(function(_0x1b8f8e,_0x4823b8){return db['FaxAccount'][_0x1457('0x1a')]({'raw':_0x2e766d['options']?_0x2e766d['options'][_0x1457('0x1b')]===undefined?!![]:![]:!![],'where':_0x2e766d[_0x1457('0x1c')]?_0x2e766d[_0x1457('0x1c')][_0x1457('0x1d')]||null:null,'attributes':_0x2e766d['options']?_0x2e766d['options']['attributes']||null:null,'limit':_0x2e766d[_0x1457('0x1c')]?_0x2e766d[_0x1457('0x1c')][_0x1457('0x1e')]||null:null,'include':_0x2e766d['options']?_0x2e766d[_0x1457('0x1c')]['include']?_['map'](_0x2e766d[_0x1457('0x1c')][_0x1457('0x1f')],function(_0x171f4d){return{'model':db[_0x171f4d[_0x1457('0x20')]],'as':_0x171f4d['as'],'attributes':_0x171f4d['attributes'],'include':_0x171f4d[_0x1457('0x1f')]?_[_0x1457('0x21')](_0x171f4d[_0x1457('0x1f')],function(_0x38ecfe){return{'model':db[_0x38ecfe[_0x1457('0x20')]],'as':_0x38ecfe['as'],'attributes':_0x38ecfe['attributes'],'include':_0x38ecfe['include']?_[_0x1457('0x21')](_0x38ecfe[_0x1457('0x1f')],function(_0x24112f){return{'model':db[_0x24112f[_0x1457('0x20')]],'as':_0x24112f['as'],'attributes':_0x24112f[_0x1457('0x22')]};}):[]};}):[]};}):[]:[]})[_0x1457('0xe')](function(_0x150433){logger['info']('GetFaxAccount',_0x2e766d);logger[_0x1457('0x12')]('GetFaxAccount',_0x2e766d,JSON[_0x1457('0x14')](_0x150433));_0x1b8f8e(_0x150433);})[_0x1457('0x18')](function(_0x4031d5){logger[_0x1457('0x15')](_0x1457('0x19'),_0x4031d5['message'],_0x2e766d);_0x4823b8(_0x72af5d[_0x1457('0x15')](0x1f4,_0x4031d5[_0x1457('0x16')]));});});};exports[_0x1457('0x23')]=function(_0x3f240d,_0x54e6c5,_0x4225ba){var _0x451e52=this;return new Promise(function(_0x36e810,_0x5a95a9){var _0xbcfe61={'body':_0x3f240d['body'],'channel':_0x1457('0x24')};var _0x543d70=[];var _0x4697e7=[];var _0x49e424={};return db[_0x1457('0x25')][_0x1457('0x26')]()[_0x1457('0xe')](function(_0x497472){if(!_0x497472){throw new db[(_0x1457('0x27'))]['ValidationError'](_0x1457('0x28'));}_0x543d70=_[_0x1457('0x29')](_[_0x1457('0x2a')](_0x497472),[_0x1457('0x2b'),_0x1457('0x2c')]);_0x4697e7=_[_0x1457('0x29')](_['keys'](_0x497472),[_0x1457('0x2b'),_0x1457('0x2c'),'CompanyId',_0x1457('0x2d')]);if(_0x3f240d[_0x1457('0x2e')]['id']){delete _0x3f240d[_0x1457('0x2e')]['id'];}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')]['from'])){throw new db[(_0x1457('0x27'))][(_0x1457('0x30'))](_0x1457('0x31'));}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')][_0x1457('0x2e')])||_0x3f240d['body'][_0x1457('0x2e')]===''){throw new db[(_0x1457('0x27'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1457('0x2f')](_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')])){throw new db['Sequelize'][(_0x1457('0x30'))](_0x1457('0x33')+_0x4697e7);}if(!_[_0x1457('0x34')](_0x4697e7,_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')])){throw new db[(_0x1457('0x27'))]['ValidationError'](_0x1457('0x35')+_0x4697e7);}_0x49e424[_0x3f240d[_0x1457('0x2e')]['mapKey']]=_0x3f240d['body'][_0x1457('0x36')];})[_0x1457('0xe')](function(){return db[_0x1457('0x37')][_0x1457('0x38')]({'where':{'id':_0x3f240d[_0x1457('0x39')]['id']},'include':[{'model':db[_0x1457('0x3a')],'as':'List','include':[{'model':db[_0x1457('0x25')],'as':'Contacts','where':_0x49e424,'limit':0x1,'order':[[_0x1457('0x2c'),_0x1457('0x3b')]]}]},{'model':db['FaxApplication'],'as':_0x1457('0x3c')}]});})[_0x1457('0xe')](function(_0x1be340){if(_0x1be340&&_0x1be340['List']){var _0xa4458a=_0x1be340['get']({'plain':!![]});_0xbcfe61['account']=_0xa4458a;_0xbcfe61['applications']=_0xa4458a[_0x1457('0x3c')];_0xbcfe61['list']=_0xa4458a[_0x1457('0x3d')];_0xbcfe61[_0x1457('0x3e')]=_[_0x1457('0x3f')](_0xbcfe61['applications'],[_0x1457('0x40')],[_0x1457('0x41')]);if(_0xbcfe61['account']['Applications']){delete _0xbcfe61[_0x1457('0x39')]['Applications'];}if(_0xbcfe61[_0x1457('0x39')][_0x1457('0x3d')]&&_0xbcfe61['account'][_0x1457('0x3d')][_0x1457('0x42')][_0x1457('0x43')]){return _0xbcfe61['account'][_0x1457('0x3d')]['Contacts'][0x0];}var _0x540ac2=_[_0x1457('0x44')](_0x3f240d['body'],{'firstName':_0x3f240d[_0x1457('0x2e')]['from'],'ListId':_0xa4458a['ListId']});_0x540ac2[_0x3f240d[_0x1457('0x2e')][_0x1457('0x32')]]=_0x3f240d['body'][_0x1457('0x36')];return db[_0x1457('0x25')][_0x1457('0x45')](_0x540ac2,{'fields':_0x543d70,'raw':!![]});}})[_0x1457('0xe')](function(_0x1e6d0b){_0xbcfe61[_0x1457('0x46')]=_0x1e6d0b;if(_0x1e6d0b){var _0x34c762={'ContactId':_0x1e6d0b['id'],'FaxAccountId':_0x3f240d['account']['id'],'fax':_0x1e6d0b['fax']};return db[_0x1457('0x47')][_0x1457('0x38')]({'where':{'ContactId':_0x1e6d0b['id'],'closed':![],'FaxAccountId':_0x3f240d['account']['id']}})['then'](function(_0x451d32){if(_0x451d32){return[_0x451d32,![]];}return db['FaxInteraction'][_0x1457('0x45')](_0x34c762)[_0x1457('0xe')](function(_0x3ff6b3){return[_0x3ff6b3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x1457('0x48')](function(_0x157f78,_0x5b8dbe){var _0x35394d=_0x157f78[_0x1457('0x49')]({'plain':!![]});if(_0x5b8dbe){if(_0xbcfe61[_0x1457('0x39')]['autoclose']){_0xbcfe61['applications']['push']({'id':0x0,'priority':_0xbcfe61['applications'][_0x1457('0x43')]+0x1,'app':_0x1457('0x4a'),'appdata':'unmanaged','interval':_0x1457('0x4b')});}_0x35394d[_0x1457('0x4c')]=!![];}else{_0x35394d[_0x1457('0x4c')]=![];}_0xbcfe61[_0x1457('0x4d')]=_0x35394d;return db[_0x1457('0x4e')][_0x1457('0x45')]({'body':_0x3f240d[_0x1457('0x2e')]['body'],'FaxAccountId':_0x3f240d[_0x1457('0x39')]['id'],'FaxInteractionId':_0x157f78['id'],'direction':'in','ContactId':_0x157f78[_0x1457('0x4f')],'AttachmentId':_0x3f240d[_0x1457('0x2e')][_0x1457('0x50')]});})[_0x1457('0xe')](function(_0x2d9fde){_0xbcfe61['message']=_0x2d9fde;if(_0xbcfe61[_0x1457('0x4d')]['UserId']){return db[_0x1457('0x51')]['find']({'attributes':['id',_0x1457('0x52')],'where':{'id':_0xbcfe61[_0x1457('0x4d')][_0x1457('0x53')]}})[_0x1457('0xe')](function(_0x5964a9){if(_0x5964a9){_0xbcfe61[_0x1457('0x3e')][_0x1457('0x54')]({'id':0x0,'priority':0x0,'app':_0x1457('0x55'),'appdata':_0x5964a9['name']+','+(_0xbcfe61[_0x1457('0x39')][_0x1457('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1457('0x57'),_0xbcfe61);});}return respondWithRpcPromise('Start',_0x1457('0x57'),_0xbcfe61);})[_0x1457('0xe')](function(_0x4265d0){_0x36e810(_0x4265d0);})['catch'](function(_0x279ef5){_0x5a95a9(_0x451e52[_0x1457('0x15')](0x1f4,_0x279ef5[_0x1457('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 0e8bff1..2c7de8e 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 _0xb6ad=['faxAccount:','./faxAccount.events','save','update','removeListener','length'];(function(_0x46d732,_0x588400){var _0x1f1a77=function(_0x57e758){while(--_0x57e758){_0x46d732['push'](_0x46d732['shift']());}};_0x1f1a77(++_0x588400);}(_0xb6ad,0x18d));var _0xdb6a=function(_0x487ca1,_0x30df99){_0x487ca1=_0x487ca1-0x0;var _0x410cbc=_0xb6ad[_0x487ca1];return _0x410cbc;};'use strict';var FaxAccountEvents=require(_0xdb6a('0x0'));var events=[_0xdb6a('0x1'),'remove',_0xdb6a('0x2')];function createListener(_0x3ddc17,_0x4b01fb){return function(_0x1f8e9a){_0x4b01fb['emit'](_0x3ddc17,_0x1f8e9a);};}function removeListener(_0x4ee6ba,_0x56b987){return function(){FaxAccountEvents[_0xdb6a('0x3')](_0x4ee6ba,_0x56b987);};}exports['register']=function(_0x4c00ca){for(var _0x399ef8=0x0,_0x42ec3d=events[_0xdb6a('0x4')];_0x399ef8<_0x42ec3d;_0x399ef8++){var _0x2289a0=events[_0x399ef8];var _0x41789c=createListener(_0xdb6a('0x5')+_0x2289a0,_0x4c00ca);FaxAccountEvents['on'](_0x2289a0,_0x41789c);}}; \ No newline at end of file +var _0x9c41=['save','update','length'];(function(_0x40737d,_0x4fcfbc){var _0x11b37b=function(_0x40a15a){while(--_0x40a15a){_0x40737d['push'](_0x40737d['shift']());}};_0x11b37b(++_0x4fcfbc);}(_0x9c41,0x1c8));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x19c4('0x0'),'remove',_0x19c4('0x1')];function createListener(_0x183ac2,_0x53ddc0){return function(_0x405b53){_0x53ddc0['emit'](_0x183ac2,_0x405b53);};}function removeListener(_0x4a3689,_0x9ecfa4){return function(){FaxAccountEvents['removeListener'](_0x4a3689,_0x9ecfa4);};}exports['register']=function(_0x1586a4){for(var _0x4d36ac=0x0,_0x5921be=events[_0x19c4('0x2')];_0x4d36ac<_0x5921be;_0x4d36ac++){var _0x44e396=events[_0x4d36ac];var _0x27b52c=createListener('faxAccount:'+_0x44e396,_0x1586a4);FaxAccountEvents['on'](_0x44e396,_0x27b52c);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index d02b8f8..a79b0c6 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 _0x9b60=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getApplications','/:id/messages','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/interactions','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer'];(function(_0x3aa996,_0x1da4bf){var _0x51d497=function(_0x219272){while(--_0x219272){_0x3aa996['push'](_0x3aa996['shift']());}};_0x51d497(++_0x1da4bf);}(_0x9b60,0x147));var _0x09b6=function(_0x18aa3e,_0x5116d2){_0x18aa3e=_0x18aa3e-0x0;var _0x3d050c=_0x9b60[_0x18aa3e];return _0x3d050c;};'use strict';var multer=require(_0x09b6('0x0'));var util=require(_0x09b6('0x1'));var path=require(_0x09b6('0x2'));var express=require('express');var router=express[_0x09b6('0x3')]();var auth=require(_0x09b6('0x4'));var interaction=require(_0x09b6('0x5'));var config=require(_0x09b6('0x6'));var controller=require('./faxAccount.controller');router[_0x09b6('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09b6('0x7')](_0x09b6('0x8'),auth[_0x09b6('0x9')](),controller[_0x09b6('0xa')]);router[_0x09b6('0x7')](_0x09b6('0xb'),auth[_0x09b6('0x9')](),controller[_0x09b6('0xc')]);router[_0x09b6('0x7')](_0x09b6('0xd'),auth['isAuthenticated'](),controller[_0x09b6('0xe')]);router[_0x09b6('0x7')](_0x09b6('0xf'),auth[_0x09b6('0x9')](),controller['getAnswers']);router[_0x09b6('0x7')]('/:id/interactions',auth[_0x09b6('0x9')](),controller['getInteractions']);router[_0x09b6('0x7')]('/:id/applications',auth[_0x09b6('0x9')](),controller[_0x09b6('0x10')]);router[_0x09b6('0x7')](_0x09b6('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x09b6('0x7')](_0x09b6('0x12'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x13')]);router[_0x09b6('0x14')]('/',auth[_0x09b6('0x9')](),controller[_0x09b6('0x15')]);router[_0x09b6('0x14')](_0x09b6('0xd'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x16')]);router[_0x09b6('0x14')](_0x09b6('0xf'),auth['isAuthenticated'](),controller[_0x09b6('0x17')]);router[_0x09b6('0x14')](_0x09b6('0x18'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x19')]);router[_0x09b6('0x14')](_0x09b6('0x1a'),auth['isAuthenticated'](),controller[_0x09b6('0x1b')]);router[_0x09b6('0x14')](_0x09b6('0x1c'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x1d')]);router['post'](_0x09b6('0x1e'),auth['isAuthenticated'](),controller[_0x09b6('0x1f')]);router[_0x09b6('0x14')](_0x09b6('0x20'),auth['isAuthenticated'](),controller[_0x09b6('0x21')]);router[_0x09b6('0x14')](_0x09b6('0x12'),auth[_0x09b6('0x9')](),controller['addAgents']);router[_0x09b6('0x22')](_0x09b6('0xb'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x23')]);router['delete'](_0x09b6('0xb'),auth['isAuthenticated'](),controller[_0x09b6('0x24')]);router[_0x09b6('0x25')](_0x09b6('0xd'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x26')]);router[_0x09b6('0x25')](_0x09b6('0xf'),auth[_0x09b6('0x9')](),controller['removeAnswers']);router[_0x09b6('0x25')](_0x09b6('0x12'),auth[_0x09b6('0x9')](),controller[_0x09b6('0x27')]);module[_0x09b6('0x28')]=router; \ No newline at end of file +var _0x38c7=['/:id/messages','getMessages','getAgents','create','post','addInteraction','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','/:id/users','removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','getApplications'];(function(_0x249228,_0x107f61){var _0xbecdeb=function(_0x3d0c3c){while(--_0x3d0c3c){_0x249228['push'](_0x249228['shift']());}};_0xbecdeb(++_0x107f61);}(_0x38c7,0x111));var _0x738c=function(_0x3dcecb,_0x9c907){_0x3dcecb=_0x3dcecb-0x0;var _0x19fa75=_0x38c7[_0x3dcecb];return _0x19fa75;};'use strict';var multer=require(_0x738c('0x0'));var util=require(_0x738c('0x1'));var path=require(_0x738c('0x2'));var express=require(_0x738c('0x3'));var router=express['Router']();var auth=require(_0x738c('0x4'));var interaction=require(_0x738c('0x5'));var config=require(_0x738c('0x6'));var controller=require(_0x738c('0x7'));router[_0x738c('0x8')]('/',auth[_0x738c('0x9')](),controller[_0x738c('0xa')]);router[_0x738c('0x8')](_0x738c('0xb'),auth[_0x738c('0x9')](),controller[_0x738c('0xc')]);router[_0x738c('0x8')](_0x738c('0xd'),auth[_0x738c('0x9')](),controller[_0x738c('0xe')]);router[_0x738c('0x8')](_0x738c('0xf'),auth['isAuthenticated'](),controller[_0x738c('0x10')]);router[_0x738c('0x8')](_0x738c('0x11'),auth[_0x738c('0x9')](),controller['getAnswers']);router[_0x738c('0x8')](_0x738c('0x12'),auth[_0x738c('0x9')](),controller[_0x738c('0x13')]);router[_0x738c('0x8')]('/:id/applications',auth[_0x738c('0x9')](),controller[_0x738c('0x14')]);router[_0x738c('0x8')](_0x738c('0x15'),auth['isAuthenticated'](),controller[_0x738c('0x16')]);router[_0x738c('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x738c('0x17')]);router['post']('/',auth[_0x738c('0x9')](),controller[_0x738c('0x18')]);router['post'](_0x738c('0xf'),auth[_0x738c('0x9')](),controller['addDisposition']);router[_0x738c('0x19')]('/:id/canned_answers',auth[_0x738c('0x9')](),controller['addAnswer']);router['post'](_0x738c('0x12'),auth[_0x738c('0x9')](),controller[_0x738c('0x1a')]);router[_0x738c('0x19')](_0x738c('0x1b'),auth[_0x738c('0x9')](),controller[_0x738c('0x1c')]);router[_0x738c('0x19')](_0x738c('0x1d'),auth[_0x738c('0x9')](),controller[_0x738c('0x1e')]);router['post'](_0x738c('0x1f'),auth['isAuthenticated'](),controller[_0x738c('0x20')]);router[_0x738c('0x19')](_0x738c('0x21'),auth[_0x738c('0x9')](),controller[_0x738c('0x22')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x738c('0x23')](_0x738c('0xd'),auth[_0x738c('0x9')](),controller[_0x738c('0x24')]);router[_0x738c('0x25')]('/:id',auth[_0x738c('0x9')](),controller[_0x738c('0x26')]);router[_0x738c('0x25')](_0x738c('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x738c('0x11'),auth[_0x738c('0x9')](),controller['removeAnswers']);router[_0x738c('0x25')](_0x738c('0x27'),auth[_0x738c('0x9')](),controller[_0x738c('0x28')]);module[_0x738c('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 23b87d0..6f2fcf6 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 _0xe7aa=['STRING','noop','*,*,*,*','exports','INTEGER'];(function(_0x577f3d,_0x43ab79){var _0x3b11f6=function(_0x4f1a61){while(--_0x4f1a61){_0x577f3d['push'](_0x577f3d['shift']());}};_0x3b11f6(++_0x43ab79);}(_0xe7aa,0x1f2));var _0xae7a=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xe7aa[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require('sequelize');module[_0xae7a('0x0')]={'priority':{'type':Sequelize[_0xae7a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xae7a('0x2')],'allowNull':![],'defaultValue':_0xae7a('0x3')},'appdata':{'type':Sequelize[_0xae7a('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0xae7a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xae7a('0x4')}}; \ No newline at end of file +var _0xe6b4=['exports','STRING','sequelize'];(function(_0x29af0e,_0x35f669){var _0x349e39=function(_0x251fba){while(--_0x251fba){_0x29af0e['push'](_0x29af0e['shift']());}};_0x349e39(++_0x35f669);}(_0xe6b4,0x182));var _0x4e6b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe6b4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e6b('0x0'));module[_0x4e6b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x4e6b('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x4e6b('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x4e6b('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ab39881..88822f3 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 _0x2147=['status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','name','send','index','FaxApplication','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','where','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','sendStatus'];(function(_0x4cfc43,_0x2ff1c3){var _0x42df80=function(_0x1fc15c){while(--_0x1fc15c){_0x4cfc43['push'](_0x4cfc43['shift']());}};_0x42df80(++_0x2ff1c3);}(_0x2147,0x138));var _0x7214=function(_0x27fd35,_0x2143ae){_0x27fd35=_0x27fd35-0x0;var _0x551109=_0x2147[_0x27fd35];return _0x551109;};'use strict';var jsonpatch=require(_0x7214('0x0'));var rp=require(_0x7214('0x1'));var moment=require(_0x7214('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7214('0x3'));var util=require(_0x7214('0x4'));var path=require(_0x7214('0x5'));var sox=require(_0x7214('0x6'));var csv=require(_0x7214('0x7'));var ejs=require(_0x7214('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7214('0x9'));var crypto=require(_0x7214('0xa'));var jsforce=require(_0x7214('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7214('0xc'));var Papa=require(_0x7214('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x7214('0xe'))(_0x7214('0xf'));var utils=require(_0x7214('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d943c,_0x29fcc8){_0x29fcc8=_0x29fcc8||0xcc;return function(_0x4e0672){if(_0x4e0672){return _0x2d943c[_0x7214('0x11')](_0x29fcc8);}return _0x2d943c[_0x7214('0x12')](_0x29fcc8)['end']();};}function respondWithResult(_0x20ca30,_0x1e82f8){_0x1e82f8=_0x1e82f8||0xc8;return function(_0x3018e9){if(_0x3018e9){return _0x20ca30[_0x7214('0x12')](_0x1e82f8)[_0x7214('0x13')](_0x3018e9);}};}function respondWithFilteredResult(_0x260376,_0x4855cd){return function(_0x3d4f41){if(_0x3d4f41){var _0xaac45a=_0x3d4f41[_0x7214('0x14')],_0x12d755=_0x4855cd[_0x7214('0x15')],_0x432834=_0x4855cd[_0x7214('0x15')]+_0x4855cd[_0x7214('0x16')],_0x14bd36;if(_0x432834>=_0xaac45a){_0x432834=_0xaac45a;_0x14bd36=0xc8;}else{_0x14bd36=0xce;}_0x260376['status'](_0x14bd36);return _0x260376[_0x7214('0x17')](_0x7214('0x18'),_0x12d755+'-'+_0x432834+'/'+_0xaac45a)[_0x7214('0x13')](_0x3d4f41);}return null;};}function patchUpdates(_0x4743c9){return function(_0x53d0d8){try{jsonpatch[_0x7214('0x19')](_0x53d0d8,_0x4743c9,!![]);}catch(_0x2087ab){return BPromise[_0x7214('0x1a')](_0x2087ab);}return _0x53d0d8[_0x7214('0x1b')]();};}function saveUpdates(_0x3239f8,_0x15cf2){return function(_0x3b3371){if(_0x3b3371){return _0x3b3371['update'](_0x3239f8)[_0x7214('0x1c')](function(_0x4453ff){return _0x4453ff;});}return null;};}function removeEntity(_0x5922b2,_0x50c9ab){return function(_0x243d90){if(_0x243d90){return _0x243d90[_0x7214('0x1d')]()[_0x7214('0x1c')](function(){_0x5922b2[_0x7214('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56144f,_0x8da85b){return function(_0x168500){if(!_0x168500){_0x56144f[_0x7214('0x11')](0x194);}return _0x168500;};}function handleError(_0xb60a5a,_0x53043c){_0x53043c=_0x53043c||0x1f4;return function(_0xe8504d){logger['error'](_0xe8504d['stack']);if(_0xe8504d[_0x7214('0x1e')]){delete _0xe8504d[_0x7214('0x1e')];}_0xb60a5a['status'](_0x53043c)[_0x7214('0x1f')](_0xe8504d);};}exports[_0x7214('0x20')]=function(_0x787958,_0x4fdfa8){var _0x2a1c23={},_0x4bdf3c={},_0x134d74={'count':0x0,'rows':[]};var _0x5e3315=db[_0x7214('0x21')]['rawAttributes'];_0x4bdf3c[_0x7214('0x22')]=_['keys'](_0x5e3315);var _0x672165={'dateStart':_0x787958[_0x7214('0x23')][_0x7214('0x24')],'dateEnd':_0x787958[_0x7214('0x23')][_0x7214('0x25')]};delete _0x787958['query']['dateStart'];delete _0x787958[_0x7214('0x23')][_0x7214('0x25')];_0x4bdf3c[_0x7214('0x23')]=_[_0x7214('0x26')](_0x787958[_0x7214('0x23')]);_0x4bdf3c[_0x7214('0x27')]=_[_0x7214('0x28')](_0x4bdf3c['model'],_0x4bdf3c['query']);_0x2a1c23[_0x7214('0x29')]=_[_0x7214('0x28')](_0x4bdf3c[_0x7214('0x22')],qs[_0x7214('0x2a')](_0x787958['query'][_0x7214('0x2a')]));_0x2a1c23[_0x7214('0x29')]=_0x2a1c23[_0x7214('0x29')][_0x7214('0x2b')]?_0x2a1c23[_0x7214('0x29')]:_0x4bdf3c[_0x7214('0x22')];if(!_0x787958[_0x7214('0x23')][_0x7214('0x2c')](_0x7214('0x2d'))){_0x2a1c23[_0x7214('0x16')]=qs[_0x7214('0x16')](_0x787958[_0x7214('0x23')][_0x7214('0x16')]);_0x2a1c23[_0x7214('0x15')]=qs['offset'](_0x787958[_0x7214('0x23')][_0x7214('0x15')]);}_0x2a1c23[_0x7214('0x2e')]=qs[_0x7214('0x2f')](_0x787958[_0x7214('0x23')][_0x7214('0x2f')]);_0x2a1c23['where']=qs[_0x7214('0x27')](_[_0x7214('0x30')](_0x787958[_0x7214('0x23')],_0x4bdf3c[_0x7214('0x27')]));if(_0x672165[_0x7214('0x24')]){if(_0x672165[_0x7214('0x25')]){_0x672165['dateEnd']=moment(_0x672165[_0x7214('0x25')])[_0x7214('0x31')](0x1,'day');}else{_0x672165[_0x7214('0x25')]=moment(_0x672165[_0x7214('0x24')])[_0x7214('0x31')](0x1,'day');}_['merge'](_0x2a1c23[_0x7214('0x32')],{'createdAt':{'$gte':_0x672165[_0x7214('0x24')],'$lte':_0x672165['dateEnd']}});}if(_0x787958[_0x7214('0x23')][_0x7214('0x33')]){_0x2a1c23[_0x7214('0x32')]=_[_0x7214('0x34')](_0x2a1c23[_0x7214('0x32')],{'$or':_[_0x7214('0x35')](_0x2a1c23['attributes'],function(_0x3adcfe){var _0xb71e7={};_0xb71e7[_0x3adcfe]={'$like':'%'+_0x787958[_0x7214('0x23')][_0x7214('0x33')]+'%'};return _0xb71e7;})});}_0x2a1c23=_[_0x7214('0x34')]({},_0x2a1c23,_0x787958[_0x7214('0x36')]);var _0x2522ce={'where':_0x2a1c23['where']};return db[_0x7214('0x21')][_0x7214('0x14')](_0x2522ce)[_0x7214('0x1c')](function(_0x487e36){_0x134d74[_0x7214('0x14')]=_0x487e36;if(_0x787958['query'][_0x7214('0x37')]){_0x2a1c23[_0x7214('0x38')]=[{'all':!![]}];}return db[_0x7214('0x21')][_0x7214('0x39')](_0x2a1c23);})[_0x7214('0x1c')](function(_0x39405c){_0x134d74[_0x7214('0x3a')]=_0x39405c;return _0x134d74;})[_0x7214('0x1c')](respondWithFilteredResult(_0x4fdfa8,_0x2a1c23))[_0x7214('0x3b')](handleError(_0x4fdfa8,null));};exports[_0x7214('0x3c')]=function(_0x3b1c77,_0x2d81c7){var _0x1706e7={'raw':!![],'where':{'id':_0x3b1c77[_0x7214('0x3d')]['id']}},_0xb468af={};_0xb468af[_0x7214('0x22')]=_[_0x7214('0x26')](db[_0x7214('0x21')]['rawAttributes']);_0xb468af[_0x7214('0x23')]=_[_0x7214('0x26')](_0x3b1c77['query']);_0xb468af['filters']=_['intersection'](_0xb468af[_0x7214('0x22')],_0xb468af['query']);_0x1706e7[_0x7214('0x29')]=_[_0x7214('0x28')](_0xb468af[_0x7214('0x22')],qs[_0x7214('0x2a')](_0x3b1c77[_0x7214('0x23')]['fields']));_0x1706e7[_0x7214('0x29')]=_0x1706e7[_0x7214('0x29')][_0x7214('0x2b')]?_0x1706e7['attributes']:_0xb468af['model'];if(_0x3b1c77[_0x7214('0x23')][_0x7214('0x37')]){_0x1706e7[_0x7214('0x38')]=[{'all':!![]}];}_0x1706e7=_[_0x7214('0x34')]({},_0x1706e7,_0x3b1c77[_0x7214('0x36')]);return db[_0x7214('0x21')][_0x7214('0x3e')](_0x1706e7)['then'](handleEntityNotFound(_0x2d81c7,null))['then'](respondWithResult(_0x2d81c7,null))[_0x7214('0x3b')](handleError(_0x2d81c7,null));};exports[_0x7214('0x3f')]=function(_0x152f5e,_0x1c54a1){return db['FaxApplication']['create'](_0x152f5e[_0x7214('0x40')],{})['then'](respondWithResult(_0x1c54a1,0xc9))[_0x7214('0x3b')](handleError(_0x1c54a1,null));};exports[_0x7214('0x41')]=function(_0x1c5e50,_0x462503){if(_0x1c5e50[_0x7214('0x40')]['id']){delete _0x1c5e50[_0x7214('0x40')]['id'];}return db['FaxApplication'][_0x7214('0x3e')]({'where':{'id':_0x1c5e50[_0x7214('0x3d')]['id']}})[_0x7214('0x1c')](handleEntityNotFound(_0x462503,null))[_0x7214('0x1c')](saveUpdates(_0x1c5e50[_0x7214('0x40')],null))[_0x7214('0x1c')](respondWithResult(_0x462503,null))[_0x7214('0x3b')](handleError(_0x462503,null));};exports[_0x7214('0x1d')]=function(_0x60167e,_0x451764){return db['FaxApplication'][_0x7214('0x3e')]({'where':{'id':_0x60167e[_0x7214('0x3d')]['id']}})[_0x7214('0x1c')](handleEntityNotFound(_0x451764,null))[_0x7214('0x1c')](removeEntity(_0x451764,null))['catch'](handleError(_0x451764,null));}; \ No newline at end of file +var _0x4450=['dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','where','filter','merge','map','options','FaxApplication','includeAll','findAll','catch','show','params','include','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','reject','save','update','then','destroy','name','index','rawAttributes','model','keys','dateStart','query'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x4450,0x15f));var _0x0445=function(_0x5670c2,_0xeabcd5){_0x5670c2=_0x5670c2-0x0;var _0x583021=_0x4450[_0x5670c2];return _0x583021;};'use strict';var jsonpatch=require(_0x0445('0x0'));var rp=require(_0x0445('0x1'));var moment=require(_0x0445('0x2'));var BPromise=require(_0x0445('0x3'));var Mustache=require(_0x0445('0x4'));var util=require(_0x0445('0x5'));var path=require('path');var sox=require(_0x0445('0x6'));var csv=require(_0x0445('0x7'));var ejs=require(_0x0445('0x8'));var fs=require('fs');var _=require(_0x0445('0x9'));var squel=require(_0x0445('0xa'));var crypto=require(_0x0445('0xb'));var jsforce=require(_0x0445('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0445('0xd'));var Papa=require(_0x0445('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x0445('0xf'))(_0x0445('0x10'));var utils=require(_0x0445('0x11'));var config=require(_0x0445('0x12'));var db=require(_0x0445('0x13'))['db'];function respondWithStatusCode(_0x363ed3,_0x1e7843){_0x1e7843=_0x1e7843||0xcc;return function(_0xe3d8ba){if(_0xe3d8ba){return _0x363ed3['sendStatus'](_0x1e7843);}return _0x363ed3[_0x0445('0x14')](_0x1e7843)[_0x0445('0x15')]();};}function respondWithResult(_0x322e33,_0xb7447b){_0xb7447b=_0xb7447b||0xc8;return function(_0x3b162e){if(_0x3b162e){return _0x322e33[_0x0445('0x14')](_0xb7447b)[_0x0445('0x16')](_0x3b162e);}};}function respondWithFilteredResult(_0x5b2593,_0x396c5d){return function(_0x5d5baf){if(_0x5d5baf){var _0x9ff4be=_0x5d5baf[_0x0445('0x17')],_0x1cc40f=_0x396c5d['offset'],_0x274e72=_0x396c5d[_0x0445('0x18')]+_0x396c5d[_0x0445('0x19')],_0x5345e7;if(_0x274e72>=_0x9ff4be){_0x274e72=_0x9ff4be;_0x5345e7=0xc8;}else{_0x5345e7=0xce;}_0x5b2593[_0x0445('0x14')](_0x5345e7);return _0x5b2593[_0x0445('0x1a')]('Content-Range',_0x1cc40f+'-'+_0x274e72+'/'+_0x9ff4be)[_0x0445('0x16')](_0x5d5baf);}return null;};}function patchUpdates(_0x1799af){return function(_0x6490d3){try{jsonpatch['apply'](_0x6490d3,_0x1799af,!![]);}catch(_0x4a2f11){return BPromise[_0x0445('0x1b')](_0x4a2f11);}return _0x6490d3[_0x0445('0x1c')]();};}function saveUpdates(_0x1e0ac4,_0xfcc640){return function(_0xab3d9e){if(_0xab3d9e){return _0xab3d9e[_0x0445('0x1d')](_0x1e0ac4)[_0x0445('0x1e')](function(_0x1847ba){return _0x1847ba;});}return null;};}function removeEntity(_0x411707,_0x8457da){return function(_0x4e87e3){if(_0x4e87e3){return _0x4e87e3[_0x0445('0x1f')]()[_0x0445('0x1e')](function(){_0x411707[_0x0445('0x14')](0xcc)[_0x0445('0x15')]();});}};}function handleEntityNotFound(_0x2538d4,_0x17ad7b){return function(_0x2d8ef4){if(!_0x2d8ef4){_0x2538d4['sendStatus'](0x194);}return _0x2d8ef4;};}function handleError(_0x4f99d6,_0x390530){_0x390530=_0x390530||0x1f4;return function(_0x5e6d75){logger['error'](_0x5e6d75['stack']);if(_0x5e6d75[_0x0445('0x20')]){delete _0x5e6d75[_0x0445('0x20')];}_0x4f99d6[_0x0445('0x14')](_0x390530)['send'](_0x5e6d75);};}exports[_0x0445('0x21')]=function(_0x28751e,_0x51007d){var _0x3c682b={},_0x90f924={},_0x520776={'count':0x0,'rows':[]};var _0xcc38e4=db['FaxApplication'][_0x0445('0x22')];_0x90f924[_0x0445('0x23')]=_[_0x0445('0x24')](_0xcc38e4);var _0x327db1={'dateStart':_0x28751e['query'][_0x0445('0x25')],'dateEnd':_0x28751e[_0x0445('0x26')]['dateEnd']};delete _0x28751e['query'][_0x0445('0x25')];delete _0x28751e['query'][_0x0445('0x27')];_0x90f924[_0x0445('0x26')]=_[_0x0445('0x24')](_0x28751e[_0x0445('0x26')]);_0x90f924[_0x0445('0x28')]=_[_0x0445('0x29')](_0x90f924[_0x0445('0x23')],_0x90f924[_0x0445('0x26')]);_0x3c682b[_0x0445('0x2a')]=_[_0x0445('0x29')](_0x90f924[_0x0445('0x23')],qs[_0x0445('0x2b')](_0x28751e[_0x0445('0x26')][_0x0445('0x2b')]));_0x3c682b[_0x0445('0x2a')]=_0x3c682b[_0x0445('0x2a')][_0x0445('0x2c')]?_0x3c682b[_0x0445('0x2a')]:_0x90f924[_0x0445('0x23')];if(!_0x28751e[_0x0445('0x26')][_0x0445('0x2d')]('nolimit')){_0x3c682b[_0x0445('0x19')]=qs['limit'](_0x28751e[_0x0445('0x26')][_0x0445('0x19')]);_0x3c682b[_0x0445('0x18')]=qs[_0x0445('0x18')](_0x28751e[_0x0445('0x26')][_0x0445('0x18')]);}_0x3c682b[_0x0445('0x2e')]=qs[_0x0445('0x2f')](_0x28751e[_0x0445('0x26')][_0x0445('0x2f')]);_0x3c682b['where']=qs[_0x0445('0x28')](_[_0x0445('0x30')](_0x28751e['query'],_0x90f924[_0x0445('0x28')]));if(_0x327db1[_0x0445('0x25')]){if(_0x327db1[_0x0445('0x27')]){_0x327db1[_0x0445('0x27')]=moment(_0x327db1[_0x0445('0x27')])[_0x0445('0x31')](0x1,'day');}else{_0x327db1['dateEnd']=moment(_0x327db1['dateStart'])[_0x0445('0x31')](0x1,_0x0445('0x32'));}_['merge'](_0x3c682b[_0x0445('0x33')],{'createdAt':{'$gte':_0x327db1[_0x0445('0x25')],'$lte':_0x327db1[_0x0445('0x27')]}});}if(_0x28751e[_0x0445('0x26')][_0x0445('0x34')]){_0x3c682b[_0x0445('0x33')]=_[_0x0445('0x35')](_0x3c682b[_0x0445('0x33')],{'$or':_[_0x0445('0x36')](_0x3c682b[_0x0445('0x2a')],function(_0x4d2289){var _0x3bcd38={};_0x3bcd38[_0x4d2289]={'$like':'%'+_0x28751e['query'][_0x0445('0x34')]+'%'};return _0x3bcd38;})});}_0x3c682b=_[_0x0445('0x35')]({},_0x3c682b,_0x28751e[_0x0445('0x37')]);var _0x175411={'where':_0x3c682b['where']};return db[_0x0445('0x38')][_0x0445('0x17')](_0x175411)[_0x0445('0x1e')](function(_0x28d3f0){_0x520776['count']=_0x28d3f0;if(_0x28751e[_0x0445('0x26')][_0x0445('0x39')]){_0x3c682b['include']=[{'all':!![]}];}return db['FaxApplication'][_0x0445('0x3a')](_0x3c682b);})[_0x0445('0x1e')](function(_0x417192){_0x520776['rows']=_0x417192;return _0x520776;})[_0x0445('0x1e')](respondWithFilteredResult(_0x51007d,_0x3c682b))[_0x0445('0x3b')](handleError(_0x51007d,null));};exports[_0x0445('0x3c')]=function(_0x2f889d,_0x4af637){var _0xd43284={'raw':!![],'where':{'id':_0x2f889d[_0x0445('0x3d')]['id']}},_0x2afba6={};_0x2afba6[_0x0445('0x23')]=_['keys'](db[_0x0445('0x38')]['rawAttributes']);_0x2afba6['query']=_['keys'](_0x2f889d[_0x0445('0x26')]);_0x2afba6[_0x0445('0x28')]=_['intersection'](_0x2afba6['model'],_0x2afba6['query']);_0xd43284[_0x0445('0x2a')]=_[_0x0445('0x29')](_0x2afba6[_0x0445('0x23')],qs['fields'](_0x2f889d[_0x0445('0x26')]['fields']));_0xd43284[_0x0445('0x2a')]=_0xd43284[_0x0445('0x2a')][_0x0445('0x2c')]?_0xd43284[_0x0445('0x2a')]:_0x2afba6['model'];if(_0x2f889d['query'][_0x0445('0x39')]){_0xd43284[_0x0445('0x3e')]=[{'all':!![]}];}_0xd43284=_[_0x0445('0x35')]({},_0xd43284,_0x2f889d[_0x0445('0x37')]);return db[_0x0445('0x38')]['find'](_0xd43284)[_0x0445('0x1e')](handleEntityNotFound(_0x4af637,null))['then'](respondWithResult(_0x4af637,null))[_0x0445('0x3b')](handleError(_0x4af637,null));};exports['create']=function(_0x171cb3,_0x3a480c){return db['FaxApplication']['create'](_0x171cb3[_0x0445('0x3f')],{})[_0x0445('0x1e')](respondWithResult(_0x3a480c,0xc9))['catch'](handleError(_0x3a480c,null));};exports['update']=function(_0x1517f8,_0x5ef6fc){if(_0x1517f8['body']['id']){delete _0x1517f8['body']['id'];}return db[_0x0445('0x38')]['find']({'where':{'id':_0x1517f8[_0x0445('0x3d')]['id']}})[_0x0445('0x1e')](handleEntityNotFound(_0x5ef6fc,null))[_0x0445('0x1e')](saveUpdates(_0x1517f8[_0x0445('0x3f')],null))[_0x0445('0x1e')](respondWithResult(_0x5ef6fc,null))[_0x0445('0x3b')](handleError(_0x5ef6fc,null));};exports['destroy']=function(_0x455561,_0x41d1b8){return db[_0x0445('0x38')][_0x0445('0x40')]({'where':{'id':_0x455561[_0x0445('0x3d')]['id']}})[_0x0445('0x1e')](handleEntityNotFound(_0x41d1b8,null))[_0x0445('0x1e')](removeEntity(_0x41d1b8,null))[_0x0445('0x3b')](handleError(_0x41d1b8,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 7926647..d00f793 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 _0xdad6=['define','FaxApplication','lodash','request-promise','./faxApplication.attributes','exports'];(function(_0x56a862,_0x57e8ce){var _0x1a9219=function(_0x3e2c53){while(--_0x3e2c53){_0x56a862['push'](_0x56a862['shift']());}};_0x1a9219(++_0x57e8ce);}(_0xdad6,0x16a));var _0x6dad=function(_0x34cd14,_0x48a49c){_0x34cd14=_0x34cd14-0x0;var _0x303f84=_0xdad6[_0x34cd14];return _0x303f84;};'use strict';var _=require(_0x6dad('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6dad('0x1'));var attributes=require(_0x6dad('0x2'));module[_0x6dad('0x3')]=function(_0x278c2b,_0x737a81){return _0x278c2b[_0x6dad('0x4')](_0x6dad('0x5'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a9d=['define','FaxApplication','fax_applications','util','api','moment','bluebird','request-promise'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x4a9d,0x1e3));var _0xd4a9=function(_0x4f7258,_0x81abfe){_0x4f7258=_0x4f7258-0x0;var _0x1017f3=_0x4a9d[_0x4f7258];return _0x1017f3;};'use strict';var _=require('lodash');var util=require(_0xd4a9('0x0'));var logger=require('../../config/logger')(_0xd4a9('0x1'));var moment=require(_0xd4a9('0x2'));var BPromise=require(_0xd4a9('0x3'));var rp=require(_0xd4a9('0x4'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0xe4d033,_0x14b869){return _0xe4d033[_0xd4a9('0x5')](_0xd4a9('0x6'),attributes,{'tableName':_0xd4a9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1e9ddcc..5fb71f3 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 _0x38d3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','stringify','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x38d3,0x1a7));var _0x338d=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x38d3[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var moment=require('moment');var BPromise=require(_0x338d('0x2'));var rs=require(_0x338d('0x3'));var fs=require('fs');var db=require(_0x338d('0x4'))['db'];var utils=require(_0x338d('0x5'));var logger=require(_0x338d('0x6'))(_0x338d('0x7'));var config=require(_0x338d('0x8'));var jayson=require(_0x338d('0x9'));var client=jayson[_0x338d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a056d,_0x2012c3,_0x439f4b){return new BPromise(function(_0x2b7aab,_0x60eaa1){return client[_0x338d('0xb')](_0x2a056d,_0x439f4b)[_0x338d('0xc')](function(_0x489cb2){logger[_0x338d('0xd')](_0x338d('0xe'),_0x2012c3,_0x338d('0xf'));logger[_0x338d('0x10')](_0x338d('0x11'),_0x2012c3,_0x338d('0xf'),JSON['stringify'](_0x489cb2));if(_0x489cb2[_0x338d('0x12')]){if(_0x489cb2[_0x338d('0x12')][_0x338d('0x13')]===0x1f4){logger[_0x338d('0x12')](_0x338d('0xe'),_0x2012c3,_0x489cb2[_0x338d('0x12')][_0x338d('0x14')]);return _0x60eaa1(_0x489cb2[_0x338d('0x12')]['message']);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x2012c3,_0x489cb2[_0x338d('0x12')][_0x338d('0x14')]);return _0x2b7aab(_0x489cb2['error'][_0x338d('0x14')]);}else{logger['info'](_0x338d('0xe'),_0x2012c3,_0x338d('0xf'));_0x2b7aab(_0x489cb2[_0x338d('0x15')]['message']);}})['catch'](function(_0x4c90f5){logger[_0x338d('0x12')]('FaxApplication,\x20%s,\x20%s',_0x2012c3,_0x4c90f5);_0x60eaa1(_0x4c90f5);});});}exports[_0x338d('0x16')]=function(_0x598941){var _0x5ab98c=this;return new Promise(function(_0x191d82,_0x316ffa){return db[_0x338d('0x17')][_0x338d('0x18')](_0x598941[_0x338d('0x19')],{'raw':_0x598941['options']?_0x598941[_0x338d('0x1a')][_0x338d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x598941[_0x338d('0x1a')]?_0x598941['options'][_0x338d('0x1c')]||null:null,'attributes':_0x598941[_0x338d('0x1a')]?_0x598941[_0x338d('0x1a')][_0x338d('0x1d')]||null:null,'limit':_0x598941[_0x338d('0x1a')]?_0x598941[_0x338d('0x1a')][_0x338d('0x1e')]||null:null})[_0x338d('0xc')](function(_0x22fc54){logger[_0x338d('0xd')](_0x338d('0x16'),_0x598941);logger[_0x338d('0x10')]('UpdateFaxApplication',_0x598941,JSON[_0x338d('0x1f')](_0x22fc54));_0x191d82(_0x22fc54);})[_0x338d('0x20')](function(_0x102219){logger['error']('UpdateFaxApplication',_0x102219['message'],_0x598941);_0x316ffa(_0x5ab98c['error'](0x1f4,_0x102219[_0x338d('0x14')]));});});}; \ No newline at end of file +var _0x535f=['attributes','debug','stringify','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateFaxApplication','update','body','options'];(function(_0x77c3bb,_0xce09ed){var _0x5e44db=function(_0x5618b7){while(--_0x5618b7){_0x77c3bb['push'](_0x77c3bb['shift']());}};_0x5e44db(++_0xce09ed);}(_0x535f,0x111));var _0xf535=function(_0x50ecfd,_0x47b417){_0x50ecfd=_0x50ecfd-0x0;var _0x561933=_0x535f[_0x50ecfd];return _0x561933;};'use strict';var _=require('lodash');var util=require(_0xf535('0x0'));var moment=require(_0xf535('0x1'));var BPromise=require('bluebird');var rs=require(_0xf535('0x2'));var fs=require('fs');var db=require(_0xf535('0x3'))['db'];var utils=require(_0xf535('0x4'));var logger=require(_0xf535('0x5'))('rpc');var config=require(_0xf535('0x6'));var jayson=require(_0xf535('0x7'));var client=jayson[_0xf535('0x8')][_0xf535('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41ca74,_0xc74104,_0x580328){return new BPromise(function(_0x510b86,_0x17f72e){return client[_0xf535('0xa')](_0x41ca74,_0x580328)[_0xf535('0xb')](function(_0x51b742){logger[_0xf535('0xc')](_0xf535('0xd'),_0xc74104,'request\x20sent');logger['debug'](_0xf535('0xe'),_0xc74104,_0xf535('0xf'),JSON['stringify'](_0x51b742));if(_0x51b742['error']){if(_0x51b742[_0xf535('0x10')][_0xf535('0x11')]===0x1f4){logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x51b742[_0xf535('0x10')]['message']);return _0x17f72e(_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);}logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);return _0x510b86(_0x51b742[_0xf535('0x10')][_0xf535('0x12')]);}else{logger[_0xf535('0xc')](_0xf535('0xd'),_0xc74104,_0xf535('0xf'));_0x510b86(_0x51b742['result'][_0xf535('0x12')]);}})[_0xf535('0x13')](function(_0x302a4e){logger[_0xf535('0x10')](_0xf535('0xd'),_0xc74104,_0x302a4e);_0x17f72e(_0x302a4e);});});}exports[_0xf535('0x14')]=function(_0xc790c9){var _0x33a8c3=this;return new Promise(function(_0x15132b,_0x477c1d){return db['FaxApplication'][_0xf535('0x15')](_0xc790c9[_0xf535('0x16')],{'raw':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['where']||null:null,'attributes':_0xc790c9['options']?_0xc790c9['options'][_0xf535('0x18')]||null:null,'limit':_0xc790c9[_0xf535('0x17')]?_0xc790c9[_0xf535('0x17')]['limit']||null:null})['then'](function(_0x438cb1){logger[_0xf535('0xc')](_0xf535('0x14'),_0xc790c9);logger[_0xf535('0x19')](_0xf535('0x14'),_0xc790c9,JSON[_0xf535('0x1a')](_0x438cb1));_0x15132b(_0x438cb1);})[_0xf535('0x13')](function(_0x43ea4b){logger[_0xf535('0x10')](_0xf535('0x14'),_0x43ea4b[_0xf535('0x12')],_0xc790c9);_0x477c1d(_0x33a8c3['error'](0x1f4,_0x43ea4b[_0xf535('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 9bf6052..f086dca 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 _0x7c09=['delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','show','post','create','/:id','update'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x7c09,0x102));var _0x97c0=function(_0x4c0624,_0x26de5b){_0x4c0624=_0x4c0624-0x0;var _0x7f107f=_0x7c09[_0x4c0624];return _0x7f107f;};'use strict';var multer=require('multer');var util=require(_0x97c0('0x0'));var path=require(_0x97c0('0x1'));var express=require('express');var router=express[_0x97c0('0x2')]();var auth=require(_0x97c0('0x3'));var interaction=require(_0x97c0('0x4'));var config=require(_0x97c0('0x5'));var controller=require(_0x97c0('0x6'));router[_0x97c0('0x7')]('/',auth[_0x97c0('0x8')](),controller['index']);router['get']('/:id',auth[_0x97c0('0x8')](),controller[_0x97c0('0x9')]);router[_0x97c0('0xa')]('/',auth[_0x97c0('0x8')](),controller[_0x97c0('0xb')]);router['put'](_0x97c0('0xc'),auth['isAuthenticated'](),controller[_0x97c0('0xd')]);router[_0x97c0('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x97c0('0xf')]);module[_0x97c0('0x10')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x528133,_0x2d67fc){var _0x4493b3=function(_0x488fd3){while(--_0x488fd3){_0x528133['push'](_0x528133['shift']());}};_0x4493b3(++_0x2d67fc);}(_0x814b,0x1a2));var _0xb814=function(_0x26474a,_0x3cfcfd){_0x26474a=_0x26474a-0x0;var _0x32e0e0=_0x814b[_0x26474a];return _0x32e0e0;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('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 62f5da6..804a3f9 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 _0x6702=['ENUM','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x121886,_0x8cd8e5){var _0x20ca01=function(_0x15e144){while(--_0x15e144){_0x121886['push'](_0x121886['shift']());}};_0x20ca01(++_0x8cd8e5);}(_0x6702,0xf7));var _0x2670=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x6702[_0x5f309e];return _0x487b5e;};'use strict';var Sequelize=require(_0x2670('0x0'));module[_0x2670('0x1')]={'closed':{'type':Sequelize[_0x2670('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2670('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x2670('0x4')]},'read1stAt':{'type':Sequelize[_0x2670('0x3')]},'fax':{'type':Sequelize[_0x2670('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2670('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2670('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x2670('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x34f6=['ENUM','out','sequelize','DATE','STRING'];(function(_0x5c731c,_0x25b6ca){var _0x94da03=function(_0x597922){while(--_0x597922){_0x5c731c['push'](_0x5c731c['shift']());}};_0x94da03(++_0x25b6ca);}(_0x34f6,0x8e));var _0x634f=function(_0x236f13,_0x52bc53){_0x236f13=_0x236f13-0x0;var _0xf98878=_0x34f6[_0x236f13];return _0xf98878;};'use strict';var Sequelize=require(_0x634f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x634f('0x1')]},'disposition':{'type':Sequelize[_0x634f('0x2')]},'note':{'type':Sequelize[_0x634f('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x634f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x634f('0x3')]('in',_0x634f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x634f('0x3')]('in',_0x634f('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 07818bd..9765813 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 _0x768c=['sort','where','filters','pick','add','day','merge','map','filter','options','include','Tag','tag','distinct','read','push','Messages','direction','createdAt','includeAll','User','Users','fullname','Contact','Owner','Account','key','FaxMessage','Tags','color','ThroughTags','findAll','rows','show','params','length','find','catch','create','body','describe','addMessage','ids','FaxInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','FaxInteraction','rawAttributes','model','keys','dateStart','query','dateEnd','attributes','intersection','fields','hasOwnProperty','nolimit','order'];(function(_0x43ad81,_0x114d95){var _0x1273f0=function(_0x506c1b){while(--_0x506c1b){_0x43ad81['push'](_0x43ad81['shift']());}};_0x1273f0(++_0x114d95);}(_0x768c,0xa4));var _0xc768=function(_0x3a6061,_0x18dac9){_0x3a6061=_0x3a6061-0x0;var _0x3ef9ea=_0x768c[_0x3a6061];return _0x3ef9ea;};'use strict';var jsonpatch=require(_0xc768('0x0'));var rp=require(_0xc768('0x1'));var moment=require(_0xc768('0x2'));var BPromise=require(_0xc768('0x3'));var Mustache=require('mustache');var util=require(_0xc768('0x4'));var path=require(_0xc768('0x5'));var sox=require(_0xc768('0x6'));var csv=require(_0xc768('0x7'));var ejs=require(_0xc768('0x8'));var fs=require('fs');var _=require(_0xc768('0x9'));var squel=require(_0xc768('0xa'));var crypto=require(_0xc768('0xb'));var jsforce=require(_0xc768('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc768('0xd'));var Papa=require(_0xc768('0xe'));var qs=require(_0xc768('0xf'));var logger=require('../../config/logger')(_0xc768('0x10'));var utils=require(_0xc768('0x11'));var config=require('../../config/environment');var db=require(_0xc768('0x12'))['db'];var socket=require(_0xc768('0x13'))({'host':'localhost','port':0x18eb});require(_0xc768('0x14'))[_0xc768('0x15')](socket);function respondWithStatusCode(_0x5cb722,_0x180277){_0x180277=_0x180277||0xcc;return function(_0x592e98){if(_0x592e98){return _0x5cb722[_0xc768('0x16')](_0x180277);}return _0x5cb722[_0xc768('0x17')](_0x180277)['end']();};}function respondWithResult(_0x5c7ef9,_0x1a335e){_0x1a335e=_0x1a335e||0xc8;return function(_0x48f56b){if(_0x48f56b){return _0x5c7ef9[_0xc768('0x17')](_0x1a335e)[_0xc768('0x18')](_0x48f56b);}};}function respondWithFilteredResult(_0x5de42c,_0x2699b5){return function(_0x1e80d4){if(_0x1e80d4){var _0x10a815=_0x1e80d4[_0xc768('0x19')],_0xfd4c55=_0x2699b5[_0xc768('0x1a')],_0xf3a510=_0x2699b5[_0xc768('0x1a')]+_0x2699b5[_0xc768('0x1b')],_0x38d822;if(_0xf3a510>=_0x10a815){_0xf3a510=_0x10a815;_0x38d822=0xc8;}else{_0x38d822=0xce;}_0x5de42c[_0xc768('0x17')](_0x38d822);return _0x5de42c[_0xc768('0x1c')](_0xc768('0x1d'),_0xfd4c55+'-'+_0xf3a510+'/'+_0x10a815)[_0xc768('0x18')](_0x1e80d4);}return null;};}function patchUpdates(_0xd4e759){return function(_0x4538ce){try{jsonpatch[_0xc768('0x1e')](_0x4538ce,_0xd4e759,!![]);}catch(_0x12b39d){return BPromise[_0xc768('0x1f')](_0x12b39d);}return _0x4538ce['save']();};}function saveUpdates(_0x4fb084,_0x15076f){return function(_0x22dcdb){if(_0x22dcdb){return _0x22dcdb[_0xc768('0x20')](_0x4fb084)[_0xc768('0x21')](function(_0x16e4cf){return _0x16e4cf;});}return null;};}function removeEntity(_0x2afbd9,_0x192b3b){return function(_0x252f86){if(_0x252f86){return _0x252f86[_0xc768('0x22')]()[_0xc768('0x21')](function(){_0x2afbd9['status'](0xcc)[_0xc768('0x23')]();});}};}function handleEntityNotFound(_0x58f061,_0x20a637){return function(_0x2e65ac){if(!_0x2e65ac){_0x58f061['sendStatus'](0x194);}return _0x2e65ac;};}function handleError(_0x56c2f1,_0x1a9ca2){_0x1a9ca2=_0x1a9ca2||0x1f4;return function(_0x5a3ccb){logger[_0xc768('0x24')](_0x5a3ccb[_0xc768('0x25')]);if(_0x5a3ccb[_0xc768('0x26')]){delete _0x5a3ccb[_0xc768('0x26')];}_0x56c2f1[_0xc768('0x17')](_0x1a9ca2)[_0xc768('0x27')](_0x5a3ccb);};}exports[_0xc768('0x28')]=function(_0x4af7d1,_0x58fb1e){var _0x6776ff={},_0x2de31b={},_0x4fd944={'count':0x0,'rows':[]};var _0x3372d6=db[_0xc768('0x29')][_0xc768('0x2a')];_0x2de31b[_0xc768('0x2b')]=_[_0xc768('0x2c')](_0x3372d6);var _0x30df01={'dateStart':_0x4af7d1['query'][_0xc768('0x2d')],'dateEnd':_0x4af7d1[_0xc768('0x2e')][_0xc768('0x2f')]};delete _0x4af7d1[_0xc768('0x2e')][_0xc768('0x2d')];delete _0x4af7d1[_0xc768('0x2e')]['dateEnd'];_0x2de31b[_0xc768('0x2e')]=_[_0xc768('0x2c')](_0x4af7d1[_0xc768('0x2e')]);_0x2de31b['filters']=_['intersection'](_0x2de31b['model'],_0x2de31b['query']);_0x6776ff[_0xc768('0x30')]=_[_0xc768('0x31')](_0x2de31b[_0xc768('0x2b')],qs['fields'](_0x4af7d1['query'][_0xc768('0x32')]));_0x6776ff[_0xc768('0x30')]=_0x6776ff['attributes']['length']?_0x6776ff[_0xc768('0x30')]:_0x2de31b[_0xc768('0x2b')];if(!_0x4af7d1[_0xc768('0x2e')][_0xc768('0x33')](_0xc768('0x34'))){_0x6776ff[_0xc768('0x1b')]=qs[_0xc768('0x1b')](_0x4af7d1[_0xc768('0x2e')][_0xc768('0x1b')]);_0x6776ff[_0xc768('0x1a')]=qs['offset'](_0x4af7d1[_0xc768('0x2e')][_0xc768('0x1a')]);}_0x6776ff[_0xc768('0x35')]=qs[_0xc768('0x36')](_0x4af7d1[_0xc768('0x2e')][_0xc768('0x36')]);_0x6776ff[_0xc768('0x37')]=qs[_0xc768('0x38')](_[_0xc768('0x39')](_0x4af7d1[_0xc768('0x2e')],_0x2de31b[_0xc768('0x38')]));if(_0x30df01[_0xc768('0x2d')]){if(_0x30df01[_0xc768('0x2f')]){_0x30df01[_0xc768('0x2f')]=moment(_0x30df01[_0xc768('0x2f')])[_0xc768('0x3a')](0x1,_0xc768('0x3b'));}else{_0x30df01[_0xc768('0x2f')]=moment(_0x30df01['dateStart'])[_0xc768('0x3a')](0x1,_0xc768('0x3b'));}_['merge'](_0x6776ff['where'],{'createdAt':{'$gte':_0x30df01[_0xc768('0x2d')],'$lte':_0x30df01[_0xc768('0x2f')]}});}if(_0x4af7d1[_0xc768('0x2e')]['filter']){_0x6776ff[_0xc768('0x37')]=_[_0xc768('0x3c')](_0x6776ff[_0xc768('0x37')],{'$or':_[_0xc768('0x3d')](_0x6776ff[_0xc768('0x30')],function(_0x25e66f){var _0x590a33={};_0x590a33[_0x25e66f]={'$like':'%'+_0x4af7d1[_0xc768('0x2e')][_0xc768('0x3e')]+'%'};return _0x590a33;})});}_0x6776ff=_[_0xc768('0x3c')]({},_0x6776ff,_0x4af7d1[_0xc768('0x3f')]);var _0x2d0adc={'where':_0x6776ff['where']};_0x2d0adc['include']=[];if(_0x4af7d1['query']['tag']){_0x2d0adc[_0xc768('0x40')]['push']({'model':db[_0xc768('0x41')],'as':'Tags','attributes':['id'],'where':{'id':_0x4af7d1[_0xc768('0x2e')][_0xc768('0x42')]},'required':!![]});_0x2d0adc[_0xc768('0x43')]=!![];}if(_0x4af7d1[_0xc768('0x2e')][_0xc768('0x44')]){_0x2d0adc[_0xc768('0x40')][_0xc768('0x45')]({'model':db['FaxMessage'],'as':_0xc768('0x46'),'attributes':['id',_0xc768('0x47'),_0xc768('0x48'),_0xc768('0x44')],'where':{'direction':'in','read':_0x4af7d1[_0xc768('0x2e')]['read']||![]},'required':!![]});_0x2d0adc['distinct']=!![];}return db[_0xc768('0x29')][_0xc768('0x19')](_0x2d0adc)[_0xc768('0x21')](function(_0x382d96){_0x4fd944[_0xc768('0x19')]=_0x382d96;if(_0x4af7d1[_0xc768('0x2e')][_0xc768('0x49')]){_0x6776ff['include']=[{'model':db[_0xc768('0x4a')],'as':_0xc768('0x4b'),'required':![],'attributes':['id',_0xc768('0x26'),_0xc768('0x4c')]},{'model':db['CmContact'],'as':_0xc768('0x4d'),'required':![]},{'model':db[_0xc768('0x4a')],'as':_0xc768('0x4e'),'attributes':[_0xc768('0x26'),_0xc768('0x4c'),'internal'],'required':![]},{'model':db['FaxAccount'],'as':_0xc768('0x4f'),'attributes':['name',_0xc768('0x50')],'required':![]},{'model':db[_0xc768('0x51')],'as':_0xc768('0x46'),'attributes':['id','direction',_0xc768('0x48'),_0xc768('0x44')],'where':{'direction':'in','read':_0x4af7d1['query'][_0xc768('0x44')]||![]},'required':_0x4af7d1['query'][_0xc768('0x44')]||![]},{'model':db[_0xc768('0x41')],'as':_0xc768('0x52'),'attributes':['id',_0xc768('0x26'),_0xc768('0x53')],'required':_0x4af7d1['query'][_0xc768('0x42')]?!![]:![]},{'model':db[_0xc768('0x41')],'as':_0xc768('0x54'),'attributes':['id',_0xc768('0x26'),_0xc768('0x53')],'through':_0x4af7d1[_0xc768('0x2e')][_0xc768('0x42')]?{'attributes':[],'where':{'TagId':_0x4af7d1[_0xc768('0x2e')][_0xc768('0x42')]||undefined}}:{},'required':_0x4af7d1['query'][_0xc768('0x42')]?!![]:![]}];}return db[_0xc768('0x29')][_0xc768('0x55')](_0x6776ff);})['then'](function(_0x5f3b94){_0x4fd944[_0xc768('0x56')]=_0x5f3b94;return _0x4fd944;})[_0xc768('0x21')](respondWithFilteredResult(_0x58fb1e,_0x6776ff))['catch'](handleError(_0x58fb1e,null));};exports[_0xc768('0x57')]=function(_0x45d118,_0x294997){var _0x151bac={'raw':![],'where':{'id':_0x45d118[_0xc768('0x58')]['id']}},_0x4ef8dd={};_0x4ef8dd[_0xc768('0x2b')]=_['keys'](db[_0xc768('0x29')][_0xc768('0x2a')]);_0x4ef8dd[_0xc768('0x2e')]=_[_0xc768('0x2c')](_0x45d118[_0xc768('0x2e')]);_0x4ef8dd['filters']=_['intersection'](_0x4ef8dd[_0xc768('0x2b')],_0x4ef8dd[_0xc768('0x2e')]);_0x151bac[_0xc768('0x30')]=_[_0xc768('0x31')](_0x4ef8dd[_0xc768('0x2b')],qs[_0xc768('0x32')](_0x45d118[_0xc768('0x2e')]['fields']));_0x151bac['attributes']=_0x151bac[_0xc768('0x30')][_0xc768('0x59')]?_0x151bac[_0xc768('0x30')]:_0x4ef8dd[_0xc768('0x2b')];if(_0x45d118[_0xc768('0x2e')]['includeAll']){_0x151bac[_0xc768('0x40')]=[{'all':!![]}];}_0x151bac=_[_0xc768('0x3c')]({},_0x151bac,_0x45d118[_0xc768('0x3f')]);return db[_0xc768('0x29')][_0xc768('0x5a')](_0x151bac)[_0xc768('0x21')](handleEntityNotFound(_0x294997,null))[_0xc768('0x21')](respondWithResult(_0x294997,null))[_0xc768('0x5b')](handleError(_0x294997,null));};exports['create']=function(_0x4f2843,_0xb13fc9){return db[_0xc768('0x29')][_0xc768('0x5c')](_0x4f2843[_0xc768('0x5d')],{})[_0xc768('0x21')](respondWithResult(_0xb13fc9,0xc9))['catch'](handleError(_0xb13fc9,null));};exports[_0xc768('0x20')]=function(_0x49ed03,_0x494fb5){if(_0x49ed03[_0xc768('0x5d')]['id']){delete _0x49ed03[_0xc768('0x5d')]['id'];}return db[_0xc768('0x29')]['find']({'where':{'id':_0x49ed03[_0xc768('0x58')]['id']}})[_0xc768('0x21')](handleEntityNotFound(_0x494fb5,null))[_0xc768('0x21')](saveUpdates(_0x49ed03[_0xc768('0x5d')],null))['then'](respondWithResult(_0x494fb5,null))[_0xc768('0x5b')](handleError(_0x494fb5,null));};exports[_0xc768('0x22')]=function(_0x268122,_0x3a2365){return db[_0xc768('0x29')][_0xc768('0x5a')]({'where':{'id':_0x268122[_0xc768('0x58')]['id']}})[_0xc768('0x21')](handleEntityNotFound(_0x3a2365,null))[_0xc768('0x21')](removeEntity(_0x3a2365,null))[_0xc768('0x5b')](handleError(_0x3a2365,null));};exports[_0xc768('0x5e')]=function(_0x187014,_0x5c0a98){return db[_0xc768('0x29')]['describe']()['then'](respondWithResult(_0x5c0a98,null))['catch'](handleError(_0x5c0a98,null));};exports[_0xc768('0x5f')]=function(_0xcb08fa,_0x1fda69,_0x4f611a){return db[_0xc768('0x51')][_0xc768('0x5a')]({'where':{'id':_0xcb08fa[_0xc768('0x58')]['id']}})[_0xc768('0x21')](handleEntityNotFound(_0x1fda69,null))[_0xc768('0x21')](function(_0x231803){if(_0x231803){return _0x231803[_0xc768('0x5f')](_0xcb08fa[_0xc768('0x5d')][_0xc768('0x60')],_['omit'](_0xcb08fa['body'],[_0xc768('0x60'),'id'])||{});}})['then'](respondWithResult(_0x1fda69,null))[_0xc768('0x5b')](handleError(_0x1fda69,null));};exports['getMessages']=function(_0x23ccb,_0x3c3a7f,_0x75a89){var _0x20773c={'raw':![],'where':{}};var _0x4e9e7c={};var _0x32215b={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0x23ccb['params']['id']}})[_0xc768('0x21')](handleEntityNotFound(_0x3c3a7f,null))['then'](function(_0x1fb227){if(_0x1fb227){_0x4e9e7c[_0xc768('0x2b')]=_[_0xc768('0x2c')](db['FaxMessage'][_0xc768('0x2a')]);_0x4e9e7c[_0xc768('0x2e')]=_[_0xc768('0x2c')](_0x23ccb[_0xc768('0x2e')]);_0x4e9e7c[_0xc768('0x38')]=_['intersection'](_0x4e9e7c[_0xc768('0x2b')],_0x4e9e7c[_0xc768('0x2e')]);_0x20773c[_0xc768('0x30')]=_[_0xc768('0x31')](_0x4e9e7c[_0xc768('0x2b')],qs[_0xc768('0x32')](_0x23ccb[_0xc768('0x2e')][_0xc768('0x32')]));_0x20773c['attributes']=_0x20773c[_0xc768('0x30')]['length']?_0x20773c[_0xc768('0x30')]:_0x4e9e7c['model'];if(!_0x23ccb[_0xc768('0x2e')][_0xc768('0x33')](_0xc768('0x34'))){_0x20773c[_0xc768('0x1b')]=qs[_0xc768('0x1b')](_0x23ccb[_0xc768('0x2e')][_0xc768('0x1b')]);_0x20773c[_0xc768('0x1a')]=qs['offset'](_0x23ccb[_0xc768('0x2e')][_0xc768('0x1a')]);}_0x20773c['order']=qs[_0xc768('0x36')](_0x23ccb[_0xc768('0x2e')]['sort']);_0x20773c[_0xc768('0x37')]=qs[_0xc768('0x38')](_['pick'](_0x23ccb[_0xc768('0x2e')],_0x4e9e7c[_0xc768('0x38')]));_0x20773c[_0xc768('0x37')][_0xc768('0x61')]=_0x1fb227['id'];if(_0x23ccb[_0xc768('0x2e')][_0xc768('0x3e')]){_0x20773c['where']=_[_0xc768('0x3c')](_0x20773c['where'],{'$or':_[_0xc768('0x3d')](_0x20773c[_0xc768('0x30')],function(_0x3f6853){var _0x1c01a9={};_0x1c01a9[_0x3f6853]={'$like':'%'+_0x23ccb[_0xc768('0x2e')][_0xc768('0x3e')]+'%'};return _0x1c01a9;})});}if(_0x23ccb[_0xc768('0x2e')]['$gte']){var _0x61e478=_0x23ccb[_0xc768('0x2e')][_0xc768('0x62')][_0xc768('0x63')](',');var _0x1d5ff4={};_0x1d5ff4[_0x61e478[0x0]]={'$gte':moment(_0x61e478[0x1])[_0xc768('0x64')](_0xc768('0x65'))};_0x20773c['where']=_[_0xc768('0x3c')](_0x20773c[_0xc768('0x37')],_0x1d5ff4);}_0x20773c=_['merge']({},_0x20773c,_0x23ccb[_0xc768('0x3f')]);return db['FaxMessage'][_0xc768('0x19')]({'where':_0x20773c[_0xc768('0x37')]})[_0xc768('0x21')](function(_0x480bc1){_0x32215b['count']=_0x480bc1;if(_0x23ccb[_0xc768('0x2e')]['includeAll']){_0x20773c[_0xc768('0x40')]=[{'all':!![]}];}return db['FaxMessage'][_0xc768('0x55')](_0x20773c);})['then'](function(_0xd3a7ec){_0x32215b[_0xc768('0x56')]=_0xd3a7ec;return _0x32215b;});}})['then'](respondWithFilteredResult(_0x3c3a7f,_0x20773c))['catch'](handleError(_0x3c3a7f,null));};exports[_0xc768('0x66')]=function(_0x39ff9d,_0x5175a0,_0x37ceb7){return db['FaxInteraction']['find']({'where':{'id':_0x39ff9d[_0xc768('0x58')]['id']}})['then'](handleEntityNotFound(_0x5175a0,null))[_0xc768('0x21')](function(_0x1a2334){if(_0x1a2334){return _0x1a2334[_0xc768('0x67')](_0x39ff9d[_0xc768('0x5d')][_0xc768('0x60')],_[_0xc768('0x68')](_0x39ff9d['body'],[_0xc768('0x60'),'id'])||{})[_0xc768('0x69')](function(){return db[_0xc768('0x41')][_0xc768('0x55')]({'attributes':['id',_0xc768('0x26'),_0xc768('0x53')],'where':{'id':_0x39ff9d[_0xc768('0x5d')][_0xc768('0x60')]}});})[_0xc768('0x21')](function(_0xa00e91){socket[_0xc768('0x6a')](_0xc768('0x6b'),{'id':Number(_0x39ff9d[_0xc768('0x58')]['id']),'tags':_0xa00e91||[]});return{'id':Number(_0x39ff9d[_0xc768('0x58')]['id']),'tags':_0xa00e91||[]};});}})['then'](respondWithResult(_0x5175a0,null))[_0xc768('0x5b')](handleError(_0x5175a0,null));};exports[_0xc768('0x6c')]=function(_0x5e0a0d,_0xb0c225,_0x4a3a81){var _0x1751c7;return db[_0xc768('0x29')][_0xc768('0x5a')]({'where':{'id':_0x5e0a0d['params']['id']}})[_0xc768('0x21')](handleEntityNotFound(_0xb0c225,null))[_0xc768('0x21')](function(_0x6707){if(_0x6707){return _0x6707[_0xc768('0x6c')](_0x5e0a0d[_0xc768('0x2e')][_0xc768('0x60')]);}})[_0xc768('0x21')](respondWithStatusCode(_0xb0c225,null))['catch'](handleError(_0xb0c225,null));}; \ No newline at end of file +var _0xfb2a=['find','body','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','addTags','spread','color','faxInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','FaxInteraction','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','sort','where','pick','add','day','filter','merge','map','include','tag','push','Tag','Tags','distinct','read','createdAt','User','Users','fullname','Contact','internal','FaxAccount','Account','FaxMessage','Messages','direction','ThroughTags','findAll','rows','catch','params','options'];(function(_0x9c55b9,_0x5eba12){var _0xa590b5=function(_0x340e52){while(--_0x340e52){_0x9c55b9['push'](_0x9c55b9['shift']());}};_0xa590b5(++_0x5eba12);}(_0xfb2a,0x7b));var _0xafb2=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xfb2a[_0x3e5086];return _0xfeb102;};'use strict';var jsonpatch=require(_0xafb2('0x0'));var rp=require(_0xafb2('0x1'));var moment=require(_0xafb2('0x2'));var BPromise=require(_0xafb2('0x3'));var Mustache=require(_0xafb2('0x4'));var util=require(_0xafb2('0x5'));var path=require(_0xafb2('0x6'));var sox=require('sox');var csv=require(_0xafb2('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xafb2('0x8'));var squel=require(_0xafb2('0x9'));var crypto=require(_0xafb2('0xa'));var jsforce=require(_0xafb2('0xb'));var deskjs=require(_0xafb2('0xc'));var toCsv=require(_0xafb2('0x7'));var querystring=require(_0xafb2('0xd'));var Papa=require(_0xafb2('0xe'));var qs=require(_0xafb2('0xf'));var logger=require(_0xafb2('0x10'))(_0xafb2('0x11'));var utils=require('../../config/utils');var config=require(_0xafb2('0x12'));var db=require(_0xafb2('0x13'))['db'];var socket=require(_0xafb2('0x14'))({'host':_0xafb2('0x15'),'port':0x18eb});require(_0xafb2('0x16'))[_0xafb2('0x17')](socket);function respondWithStatusCode(_0x438139,_0x8bb3bb){_0x8bb3bb=_0x8bb3bb||0xcc;return function(_0x55cf81){if(_0x55cf81){return _0x438139[_0xafb2('0x18')](_0x8bb3bb);}return _0x438139[_0xafb2('0x19')](_0x8bb3bb)[_0xafb2('0x1a')]();};}function respondWithResult(_0x3e6d43,_0xc7a558){_0xc7a558=_0xc7a558||0xc8;return function(_0x7e733a){if(_0x7e733a){return _0x3e6d43['status'](_0xc7a558)[_0xafb2('0x1b')](_0x7e733a);}};}function respondWithFilteredResult(_0x1c7720,_0x185335){return function(_0x292411){if(_0x292411){var _0x5b4204=_0x292411[_0xafb2('0x1c')],_0x3a88b2=_0x185335['offset'],_0x381c51=_0x185335[_0xafb2('0x1d')]+_0x185335[_0xafb2('0x1e')],_0x1bae99;if(_0x381c51>=_0x5b4204){_0x381c51=_0x5b4204;_0x1bae99=0xc8;}else{_0x1bae99=0xce;}_0x1c7720[_0xafb2('0x19')](_0x1bae99);return _0x1c7720[_0xafb2('0x1f')]('Content-Range',_0x3a88b2+'-'+_0x381c51+'/'+_0x5b4204)[_0xafb2('0x1b')](_0x292411);}return null;};}function patchUpdates(_0x2ed4ca){return function(_0x3a1fd0){try{jsonpatch[_0xafb2('0x20')](_0x3a1fd0,_0x2ed4ca,!![]);}catch(_0xe08efc){return BPromise['reject'](_0xe08efc);}return _0x3a1fd0[_0xafb2('0x21')]();};}function saveUpdates(_0x1dabd9,_0x558f2c){return function(_0x13d2fe){if(_0x13d2fe){return _0x13d2fe[_0xafb2('0x22')](_0x1dabd9)[_0xafb2('0x23')](function(_0xdbff19){return _0xdbff19;});}return null;};}function removeEntity(_0x33cbb4,_0xc65584){return function(_0x5b419a){if(_0x5b419a){return _0x5b419a[_0xafb2('0x24')]()['then'](function(){_0x33cbb4[_0xafb2('0x19')](0xcc)[_0xafb2('0x1a')]();});}};}function handleEntityNotFound(_0x3c414a,_0x5302c1){return function(_0x473bd7){if(!_0x473bd7){_0x3c414a[_0xafb2('0x18')](0x194);}return _0x473bd7;};}function handleError(_0x3fc513,_0x108a2c){_0x108a2c=_0x108a2c||0x1f4;return function(_0x217e4d){logger[_0xafb2('0x25')](_0x217e4d[_0xafb2('0x26')]);if(_0x217e4d['name']){delete _0x217e4d[_0xafb2('0x27')];}_0x3fc513[_0xafb2('0x19')](_0x108a2c)[_0xafb2('0x28')](_0x217e4d);};}exports['index']=function(_0x3c6e99,_0x30a516){var _0x2ef65b={},_0x44fddf={},_0x28830e={'count':0x0,'rows':[]};var _0x2662c2=db[_0xafb2('0x29')][_0xafb2('0x2a')];_0x44fddf[_0xafb2('0x2b')]=_['keys'](_0x2662c2);var _0x8ca979={'dateStart':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2d')],'dateEnd':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2e')]};delete _0x3c6e99['query'][_0xafb2('0x2d')];delete _0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x2e')];_0x44fddf[_0xafb2('0x2c')]=_[_0xafb2('0x2f')](_0x3c6e99[_0xafb2('0x2c')]);_0x44fddf[_0xafb2('0x30')]=_[_0xafb2('0x31')](_0x44fddf[_0xafb2('0x2b')],_0x44fddf['query']);_0x2ef65b[_0xafb2('0x32')]=_['intersection'](_0x44fddf[_0xafb2('0x2b')],qs[_0xafb2('0x33')](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x2ef65b[_0xafb2('0x32')]=_0x2ef65b[_0xafb2('0x32')][_0xafb2('0x34')]?_0x2ef65b['attributes']:_0x44fddf[_0xafb2('0x2b')];if(!_0x3c6e99[_0xafb2('0x2c')]['hasOwnProperty']('nolimit')){_0x2ef65b[_0xafb2('0x1e')]=qs['limit'](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x1e')]);_0x2ef65b[_0xafb2('0x1d')]=qs[_0xafb2('0x1d')](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x1d')]);}_0x2ef65b['order']=qs['sort'](_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x35')]);_0x2ef65b[_0xafb2('0x36')]=qs['filters'](_[_0xafb2('0x37')](_0x3c6e99[_0xafb2('0x2c')],_0x44fddf[_0xafb2('0x30')]));if(_0x8ca979['dateStart']){if(_0x8ca979[_0xafb2('0x2e')]){_0x8ca979[_0xafb2('0x2e')]=moment(_0x8ca979[_0xafb2('0x2e')])[_0xafb2('0x38')](0x1,_0xafb2('0x39'));}else{_0x8ca979[_0xafb2('0x2e')]=moment(_0x8ca979[_0xafb2('0x2d')])['add'](0x1,_0xafb2('0x39'));}_['merge'](_0x2ef65b[_0xafb2('0x36')],{'createdAt':{'$gte':_0x8ca979[_0xafb2('0x2d')],'$lte':_0x8ca979[_0xafb2('0x2e')]}});}if(_0x3c6e99['query'][_0xafb2('0x3a')]){_0x2ef65b[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x2ef65b[_0xafb2('0x36')],{'$or':_[_0xafb2('0x3c')](_0x2ef65b['attributes'],function(_0x2f9e01){var _0x196975={};_0x196975[_0x2f9e01]={'$like':'%'+_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3a')]+'%'};return _0x196975;})});}_0x2ef65b=_[_0xafb2('0x3b')]({},_0x2ef65b,_0x3c6e99['options']);var _0x1c7f10={'where':_0x2ef65b[_0xafb2('0x36')]};_0x1c7f10[_0xafb2('0x3d')]=[];if(_0x3c6e99['query'][_0xafb2('0x3e')]){_0x1c7f10[_0xafb2('0x3d')][_0xafb2('0x3f')]({'model':db[_0xafb2('0x40')],'as':_0xafb2('0x41'),'attributes':['id'],'where':{'id':_0x3c6e99['query'][_0xafb2('0x3e')]},'required':!![]});_0x1c7f10[_0xafb2('0x42')]=!![];}if(_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x43')]){_0x1c7f10[_0xafb2('0x3d')][_0xafb2('0x3f')]({'model':db['FaxMessage'],'as':'Messages','attributes':['id','direction',_0xafb2('0x44'),_0xafb2('0x43')],'where':{'direction':'in','read':_0x3c6e99['query'][_0xafb2('0x43')]||![]},'required':!![]});_0x1c7f10['distinct']=!![];}return db[_0xafb2('0x29')][_0xafb2('0x1c')](_0x1c7f10)[_0xafb2('0x23')](function(_0x4fc51f){_0x28830e['count']=_0x4fc51f;if(_0x3c6e99[_0xafb2('0x2c')]['includeAll']){_0x2ef65b[_0xafb2('0x3d')]=[{'model':db[_0xafb2('0x45')],'as':_0xafb2('0x46'),'required':![],'attributes':['id',_0xafb2('0x27'),_0xafb2('0x47')]},{'model':db['CmContact'],'as':_0xafb2('0x48'),'required':![]},{'model':db[_0xafb2('0x45')],'as':'Owner','attributes':['name','fullname',_0xafb2('0x49')],'required':![]},{'model':db[_0xafb2('0x4a')],'as':_0xafb2('0x4b'),'attributes':[_0xafb2('0x27'),'key'],'required':![]},{'model':db[_0xafb2('0x4c')],'as':_0xafb2('0x4d'),'attributes':['id',_0xafb2('0x4e'),_0xafb2('0x44'),_0xafb2('0x43')],'where':{'direction':'in','read':_0x3c6e99['query'][_0xafb2('0x43')]||![]},'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x43')]||![]},{'model':db['Tag'],'as':_0xafb2('0x41'),'attributes':['id',_0xafb2('0x27'),'color'],'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?!![]:![]},{'model':db[_0xafb2('0x40')],'as':_0xafb2('0x4f'),'attributes':['id',_0xafb2('0x27'),'color'],'through':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?{'attributes':[],'where':{'TagId':_0x3c6e99['query'][_0xafb2('0x3e')]||undefined}}:{},'required':_0x3c6e99[_0xafb2('0x2c')][_0xafb2('0x3e')]?!![]:![]}];}return db['FaxInteraction'][_0xafb2('0x50')](_0x2ef65b);})[_0xafb2('0x23')](function(_0x3f339f){_0x28830e[_0xafb2('0x51')]=_0x3f339f;return _0x28830e;})[_0xafb2('0x23')](respondWithFilteredResult(_0x30a516,_0x2ef65b))[_0xafb2('0x52')](handleError(_0x30a516,null));};exports['show']=function(_0x34a742,_0x3d72ca){var _0x161e11={'raw':![],'where':{'id':_0x34a742[_0xafb2('0x53')]['id']}},_0x59a330={};_0x59a330[_0xafb2('0x2b')]=_[_0xafb2('0x2f')](db[_0xafb2('0x29')]['rawAttributes']);_0x59a330[_0xafb2('0x2c')]=_[_0xafb2('0x2f')](_0x34a742[_0xafb2('0x2c')]);_0x59a330[_0xafb2('0x30')]=_['intersection'](_0x59a330[_0xafb2('0x2b')],_0x59a330[_0xafb2('0x2c')]);_0x161e11[_0xafb2('0x32')]=_['intersection'](_0x59a330[_0xafb2('0x2b')],qs[_0xafb2('0x33')](_0x34a742[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x161e11['attributes']=_0x161e11[_0xafb2('0x32')][_0xafb2('0x34')]?_0x161e11['attributes']:_0x59a330[_0xafb2('0x2b')];if(_0x34a742[_0xafb2('0x2c')]['includeAll']){_0x161e11[_0xafb2('0x3d')]=[{'all':!![]}];}_0x161e11=_['merge']({},_0x161e11,_0x34a742[_0xafb2('0x54')]);return db[_0xafb2('0x29')][_0xafb2('0x55')](_0x161e11)[_0xafb2('0x23')](handleEntityNotFound(_0x3d72ca,null))['then'](respondWithResult(_0x3d72ca,null))[_0xafb2('0x52')](handleError(_0x3d72ca,null));};exports['create']=function(_0x58dd94,_0x47240){return db[_0xafb2('0x29')]['create'](_0x58dd94[_0xafb2('0x56')],{})[_0xafb2('0x23')](respondWithResult(_0x47240,0xc9))['catch'](handleError(_0x47240,null));};exports['update']=function(_0x270a7d,_0x2b8c07){if(_0x270a7d[_0xafb2('0x56')]['id']){delete _0x270a7d['body']['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x270a7d['params']['id']}})['then'](handleEntityNotFound(_0x2b8c07,null))[_0xafb2('0x23')](saveUpdates(_0x270a7d[_0xafb2('0x56')],null))[_0xafb2('0x23')](respondWithResult(_0x2b8c07,null))[_0xafb2('0x52')](handleError(_0x2b8c07,null));};exports[_0xafb2('0x24')]=function(_0x39e2c1,_0x1de68e){return db[_0xafb2('0x29')][_0xafb2('0x55')]({'where':{'id':_0x39e2c1[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x1de68e,null))[_0xafb2('0x23')](removeEntity(_0x1de68e,null))[_0xafb2('0x52')](handleError(_0x1de68e,null));};exports[_0xafb2('0x57')]=function(_0x27d8b7,_0x4ce0a6){return db[_0xafb2('0x29')][_0xafb2('0x57')]()['then'](respondWithResult(_0x4ce0a6,null))[_0xafb2('0x52')](handleError(_0x4ce0a6,null));};exports[_0xafb2('0x58')]=function(_0x1bdd17,_0x14e5f5,_0x9405fc){return db[_0xafb2('0x4c')][_0xafb2('0x55')]({'where':{'id':_0x1bdd17[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x14e5f5,null))[_0xafb2('0x23')](function(_0x2c095a){if(_0x2c095a){return _0x2c095a[_0xafb2('0x58')](_0x1bdd17[_0xafb2('0x56')][_0xafb2('0x59')],_[_0xafb2('0x5a')](_0x1bdd17[_0xafb2('0x56')],[_0xafb2('0x59'),'id'])||{});}})['then'](respondWithResult(_0x14e5f5,null))[_0xafb2('0x52')](handleError(_0x14e5f5,null));};exports[_0xafb2('0x5b')]=function(_0x2f28ee,_0x40e829,_0x177500){var _0x23ef35={'raw':![],'where':{}};var _0x448fdc={};var _0x350f4a={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xafb2('0x5c')]({'where':{'id':_0x2f28ee[_0xafb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x40e829,null))[_0xafb2('0x23')](function(_0x1dc709){if(_0x1dc709){_0x448fdc[_0xafb2('0x2b')]=_[_0xafb2('0x2f')](db[_0xafb2('0x4c')]['rawAttributes']);_0x448fdc[_0xafb2('0x2c')]=_['keys'](_0x2f28ee[_0xafb2('0x2c')]);_0x448fdc[_0xafb2('0x30')]=_[_0xafb2('0x31')](_0x448fdc[_0xafb2('0x2b')],_0x448fdc[_0xafb2('0x2c')]);_0x23ef35[_0xafb2('0x32')]=_[_0xafb2('0x31')](_0x448fdc[_0xafb2('0x2b')],qs['fields'](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x33')]));_0x23ef35[_0xafb2('0x32')]=_0x23ef35[_0xafb2('0x32')][_0xafb2('0x34')]?_0x23ef35['attributes']:_0x448fdc[_0xafb2('0x2b')];if(!_0x2f28ee['query'][_0xafb2('0x5d')](_0xafb2('0x5e'))){_0x23ef35[_0xafb2('0x1e')]=qs[_0xafb2('0x1e')](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x1e')]);_0x23ef35[_0xafb2('0x1d')]=qs[_0xafb2('0x1d')](_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x1d')]);}_0x23ef35['order']=qs[_0xafb2('0x35')](_0x2f28ee[_0xafb2('0x2c')]['sort']);_0x23ef35['where']=qs['filters'](_[_0xafb2('0x37')](_0x2f28ee['query'],_0x448fdc['filters']));_0x23ef35['where'][_0xafb2('0x5f')]=_0x1dc709['id'];if(_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x3a')]){_0x23ef35[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x23ef35['where'],{'$or':_[_0xafb2('0x3c')](_0x23ef35[_0xafb2('0x32')],function(_0x2f1d23){var _0x515686={};_0x515686[_0x2f1d23]={'$like':'%'+_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x3a')]+'%'};return _0x515686;})});}if(_0x2f28ee[_0xafb2('0x2c')][_0xafb2('0x60')]){var _0x159d72=_0x2f28ee['query'][_0xafb2('0x60')]['split'](',');var _0x16da0b={};_0x16da0b[_0x159d72[0x0]]={'$gte':moment(_0x159d72[0x1])[_0xafb2('0x61')](_0xafb2('0x62'))};_0x23ef35[_0xafb2('0x36')]=_[_0xafb2('0x3b')](_0x23ef35[_0xafb2('0x36')],_0x16da0b);}_0x23ef35=_[_0xafb2('0x3b')]({},_0x23ef35,_0x2f28ee[_0xafb2('0x54')]);return db[_0xafb2('0x4c')][_0xafb2('0x1c')]({'where':_0x23ef35[_0xafb2('0x36')]})['then'](function(_0x4bef4e){_0x350f4a[_0xafb2('0x1c')]=_0x4bef4e;if(_0x2f28ee[_0xafb2('0x2c')]['includeAll']){_0x23ef35[_0xafb2('0x3d')]=[{'all':!![]}];}return db[_0xafb2('0x4c')][_0xafb2('0x50')](_0x23ef35);})[_0xafb2('0x23')](function(_0xc0d07e){_0x350f4a[_0xafb2('0x51')]=_0xc0d07e;return _0x350f4a;});}})[_0xafb2('0x23')](respondWithFilteredResult(_0x40e829,_0x23ef35))[_0xafb2('0x52')](handleError(_0x40e829,null));};exports[_0xafb2('0x63')]=function(_0x316a6f,_0x38abcc,_0x32b9ff){return db['FaxInteraction'][_0xafb2('0x55')]({'where':{'id':_0x316a6f[_0xafb2('0x53')]['id']}})[_0xafb2('0x23')](handleEntityNotFound(_0x38abcc,null))[_0xafb2('0x23')](function(_0x4a8d31){if(_0x4a8d31){return _0x4a8d31['setTags'](_0x316a6f[_0xafb2('0x56')]['ids'],_[_0xafb2('0x5a')](_0x316a6f['body'],[_0xafb2('0x59'),'id'])||{})[_0xafb2('0x64')](function(){return db[_0xafb2('0x40')]['findAll']({'attributes':['id',_0xafb2('0x27'),_0xafb2('0x65')],'where':{'id':_0x316a6f[_0xafb2('0x56')][_0xafb2('0x59')]}});})['then'](function(_0x2535b1){socket['emit'](_0xafb2('0x66'),{'id':Number(_0x316a6f[_0xafb2('0x53')]['id']),'tags':_0x2535b1||[]});return{'id':Number(_0x316a6f[_0xafb2('0x53')]['id']),'tags':_0x2535b1||[]};});}})[_0xafb2('0x23')](respondWithResult(_0x38abcc,null))['catch'](handleError(_0x38abcc,null));};exports[_0xafb2('0x67')]=function(_0x255a62,_0x5790b2,_0x2f1fb4){var _0x2c2fd7;return db[_0xafb2('0x29')]['find']({'where':{'id':_0x255a62[_0xafb2('0x53')]['id']}})['then'](handleEntityNotFound(_0x5790b2,null))[_0xafb2('0x23')](function(_0x5b7752){if(_0x5b7752){return _0x5b7752[_0xafb2('0x67')](_0x255a62['query'][_0xafb2('0x59')]);}})[_0xafb2('0x23')](respondWithStatusCode(_0x5790b2,null))[_0xafb2('0x52')](handleError(_0x5790b2,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 71b673f..25a5ec5 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 _0x2884=['exports','events','FaxInteraction','setMaxListeners','save','remove','emit'];(function(_0x518b03,_0x5371af){var _0x1065ef=function(_0x3aba68){while(--_0x3aba68){_0x518b03['push'](_0x518b03['shift']());}};_0x1065ef(++_0x5371af);}(_0x2884,0x1eb));var _0x4288=function(_0xa7fe6,_0x3c7f2d){_0xa7fe6=_0xa7fe6-0x0;var _0x2fd571=_0x2884[_0xa7fe6];return _0x2fd571;};'use strict';var EventEmitter=require(_0x4288('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0x4288('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4288('0x2')](0x0);var events={'afterCreate':_0x4288('0x3'),'afterUpdate':'update','afterDestroy':_0x4288('0x4')};function emitEvent(_0x28ee27){return function(_0x50417e,_0x4b2323,_0x1ac6e7){FaxInteractionEvents[_0x4288('0x5')](_0x28ee27+':'+_0x50417e['id'],_0x50417e);FaxInteractionEvents[_0x4288('0x5')](_0x28ee27,_0x50417e);_0x1ac6e7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4288('0x6')]=FaxInteractionEvents; \ No newline at end of file +var _0xbdb7=['save','update','remove','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','setMaxListeners'];(function(_0x3e3c9c,_0x5d9adb){var _0x49d7ff=function(_0x1fd768){while(--_0x1fd768){_0x3e3c9c['push'](_0x3e3c9c['shift']());}};_0x49d7ff(++_0x5d9adb);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1da289,_0x417651){_0x1da289=_0x1da289-0x0;var _0x41c889=_0xbdb7[_0x1da289];return _0x41c889;};'use strict';var EventEmitter=require(_0x7bdb('0x0'));var FaxInteraction=require(_0x7bdb('0x1'))['db'][_0x7bdb('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7bdb('0x3')](0x0);var events={'afterCreate':_0x7bdb('0x4'),'afterUpdate':_0x7bdb('0x5'),'afterDestroy':_0x7bdb('0x6')};function emitEvent(_0x2c7e07){return function(_0x46c068,_0x47aec5,_0x28542c){FaxInteractionEvents['emit'](_0x2c7e07+':'+_0x46c068['id'],_0x46c068);FaxInteractionEvents['emit'](_0x2c7e07,_0x46c068);_0x28542c(null);};}for(var e in events){if(events[_0x7bdb('0x7')](e)){var event=events[e];FaxInteraction[_0x7bdb('0x8')](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 db42cab..83fb016 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 _0x2b0e=['util','../../config/logger','api','moment','bluebird','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','lodash'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x2b0e,0x83));var _0xe2b0=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x2b0e[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xe2b0('0x0'));var util=require(_0xe2b0('0x1'));var logger=require(_0xe2b0('0x2'))(_0xe2b0('0x3'));var moment=require(_0xe2b0('0x4'));var BPromise=require(_0xe2b0('0x5'));var rp=require('request-promise');var attributes=require(_0xe2b0('0x6'));module[_0xe2b0('0x7')]=function(_0x3f0f0b,_0x274d75){return _0x3f0f0b[_0xe2b0('0x8')](_0xe2b0('0x9'),attributes,{'tableName':_0xe2b0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x67e7=['request-promise','./faxInteraction.attributes','exports','define','FaxInteraction','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x565b65,_0x2134b0){var _0x2b9d8a=function(_0x1e50d1){while(--_0x1e50d1){_0x565b65['push'](_0x565b65['shift']());}};_0x2b9d8a(++_0x2134b0);}(_0x67e7,0x1a7));var _0x767e=function(_0x65968f,_0x5d0325){_0x65968f=_0x65968f-0x0;var _0x4f192f=_0x67e7[_0x65968f];return _0x4f192f;};'use strict';var _=require(_0x767e('0x0'));var util=require(_0x767e('0x1'));var logger=require(_0x767e('0x2'))(_0x767e('0x3'));var moment=require(_0x767e('0x4'));var BPromise=require(_0x767e('0x5'));var rp=require(_0x767e('0x6'));var attributes=require(_0x767e('0x7'));module[_0x767e('0x8')]=function(_0x5251e5,_0x194e50){return _0x5251e5[_0x767e('0x9')](_0x767e('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index e5b56cc..3313546 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 _0x39d8=['message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','limit','AddTagsToFaxInteraction','find','addTags','ids','spread','AddTags','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x39d8,0x182));var _0x839d=function(_0x3a62c9,_0x4656c3){_0x3a62c9=_0x3a62c9-0x0;var _0x26f7b2=_0x39d8[_0x3a62c9];return _0x26f7b2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x839d('0x0'));var BPromise=require(_0x839d('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x839d('0x2'))['db'];var utils=require(_0x839d('0x3'));var logger=require(_0x839d('0x4'))(_0x839d('0x5'));var config=require(_0x839d('0x6'));var jayson=require(_0x839d('0x7'));var client=jayson[_0x839d('0x8')][_0x839d('0x9')]({'port':0x232a});var socket=require(_0x839d('0xa'))({'host':'localhost','port':0x18eb});require(_0x839d('0xb'))[_0x839d('0xc')](socket);function respondWithRpcPromise(_0x2c880b,_0x3eff43,_0x241b61){return new BPromise(function(_0x1d63be,_0x473b1f){return client['request'](_0x2c880b,_0x241b61)[_0x839d('0xd')](function(_0xe749f){logger[_0x839d('0xe')](_0x839d('0xf'),_0x3eff43,_0x839d('0x10'));logger[_0x839d('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x3eff43,_0x839d('0x10'),JSON[_0x839d('0x12')](_0xe749f));if(_0xe749f[_0x839d('0x13')]){if(_0xe749f[_0x839d('0x13')][_0x839d('0x14')]===0x1f4){logger[_0x839d('0x13')](_0x839d('0xf'),_0x3eff43,_0xe749f[_0x839d('0x13')][_0x839d('0x15')]);return _0x473b1f(_0xe749f[_0x839d('0x13')][_0x839d('0x15')]);}logger[_0x839d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x3eff43,_0xe749f[_0x839d('0x13')][_0x839d('0x15')]);return _0x1d63be(_0xe749f[_0x839d('0x13')][_0x839d('0x15')]);}else{logger[_0x839d('0xe')]('FaxInteraction,\x20%s,\x20%s',_0x3eff43,'request\x20sent');_0x1d63be(_0xe749f[_0x839d('0x16')][_0x839d('0x15')]);}})['catch'](function(_0x35fa1e){logger[_0x839d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x3eff43,_0x35fa1e);_0x473b1f(_0x35fa1e);});});}exports[_0x839d('0x17')]=function(_0x5fc1f3){var _0x327d03=this;return new Promise(function(_0x24a91e,_0x5dc2c1){return db[_0x839d('0x18')]['update'](_0x5fc1f3[_0x839d('0x19')],{'raw':_0x5fc1f3[_0x839d('0x1a')]?_0x5fc1f3[_0x839d('0x1a')][_0x839d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fc1f3[_0x839d('0x1a')]?_0x5fc1f3[_0x839d('0x1a')][_0x839d('0x1c')]||null:null,'attributes':_0x5fc1f3[_0x839d('0x1a')]?_0x5fc1f3['options'][_0x839d('0x1d')]||null:null,'limit':_0x5fc1f3[_0x839d('0x1a')]?_0x5fc1f3[_0x839d('0x1a')][_0x839d('0x1e')]||null:null})[_0x839d('0xd')](function(_0x1b9790){logger[_0x839d('0xe')](_0x839d('0x17'),_0x5fc1f3);logger[_0x839d('0x11')](_0x839d('0x17'),_0x5fc1f3,JSON[_0x839d('0x12')](_0x1b9790));_0x24a91e(_0x1b9790);})['catch'](function(_0x30992c){logger['error']('UpdateFaxInteraction',_0x30992c['message'],_0x5fc1f3);_0x5dc2c1(_0x327d03[_0x839d('0x13')](0x1f4,_0x30992c['message']));});});};exports[_0x839d('0x1f')]=function(_0x61ceec){return new Promise(function(_0x116f79,_0x3e7670){return db['FaxInteraction'][_0x839d('0x20')]({'where':_0x61ceec[_0x839d('0x1a')]?_0x61ceec[_0x839d('0x1a')]['where']||null:null})['then'](function(_0x58d911){if(_0x58d911){return _0x58d911[_0x839d('0x21')](_0x61ceec['body'][_0x839d('0x22')],_['omit'](_0x61ceec[_0x839d('0x19')],[_0x839d('0x22'),'id'])||{});}})[_0x839d('0x23')](function(_0x52b509){logger[_0x839d('0xe')](_0x839d('0x24'),_0x61ceec);logger['debug'](_0x839d('0x24'),_0x61ceec,JSON[_0x839d('0x12')](_0x52b509));_0x116f79(_0x52b509);})['catch'](function(_0x1ffde7){logger[_0x839d('0x13')](_0x839d('0x24'),_0x1ffde7[_0x839d('0x15')],_0x61ceec);_0x3e7670(_this['error'](0x1f4,_0x1ffde7['message']));});});}; \ No newline at end of file +var _0xbae6=['rpc','jayson/promise','client','http','socket.io-emitter','localhost','register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','addTags','ids','omit','spread','AddTags','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a8a6f,_0x16e10d){var _0x4f0032=function(_0x2df12b){while(--_0x2df12b){_0x5a8a6f['push'](_0x5a8a6f['shift']());}};_0x4f0032(++_0x16e10d);}(_0xbae6,0xf8));var _0x6bae=function(_0x3340dc,_0x3a3c73){_0x3340dc=_0x3340dc-0x0;var _0x105594=_0xbae6[_0x3340dc];return _0x105594;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6bae('0x0'));var fs=require('fs');var db=require(_0x6bae('0x1'))['db'];var utils=require(_0x6bae('0x2'));var logger=require(_0x6bae('0x3'))(_0x6bae('0x4'));var config=require('../../config/environment');var jayson=require(_0x6bae('0x5'));var client=jayson[_0x6bae('0x6')][_0x6bae('0x7')]({'port':0x232a});var socket=require(_0x6bae('0x8'))({'host':_0x6bae('0x9'),'port':0x18eb});require('./faxInteraction.socket')[_0x6bae('0xa')](socket);function respondWithRpcPromise(_0x5e798e,_0x333015,_0x297d46){return new BPromise(function(_0xa1d7a6,_0x100501){return client[_0x6bae('0xb')](_0x5e798e,_0x297d46)[_0x6bae('0xc')](function(_0x7355b6){logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x333015,_0x6bae('0xf'));logger[_0x6bae('0x10')](_0x6bae('0x11'),_0x333015,_0x6bae('0xf'),JSON[_0x6bae('0x12')](_0x7355b6));if(_0x7355b6[_0x6bae('0x13')]){if(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x14')]===0x1f4){logger[_0x6bae('0x13')](_0x6bae('0xe'),_0x333015,_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);return _0x100501(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);}logger['error'](_0x6bae('0xe'),_0x333015,_0x7355b6['error']['message']);return _0xa1d7a6(_0x7355b6[_0x6bae('0x13')][_0x6bae('0x15')]);}else{logger[_0x6bae('0xd')](_0x6bae('0xe'),_0x333015,'request\x20sent');_0xa1d7a6(_0x7355b6[_0x6bae('0x16')]['message']);}})['catch'](function(_0x298e56){logger[_0x6bae('0x13')](_0x6bae('0xe'),_0x333015,_0x298e56);_0x100501(_0x298e56);});});}exports[_0x6bae('0x17')]=function(_0x474730){var _0x292bde=this;return new Promise(function(_0x5855eb,_0x4ef36b){return db[_0x6bae('0x18')]['update'](_0x474730[_0x6bae('0x19')],{'raw':_0x474730[_0x6bae('0x1a')]?_0x474730[_0x6bae('0x1a')][_0x6bae('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x474730[_0x6bae('0x1a')]?_0x474730['options'][_0x6bae('0x1c')]||null:null,'attributes':_0x474730[_0x6bae('0x1a')]?_0x474730['options'][_0x6bae('0x1d')]||null:null,'limit':_0x474730[_0x6bae('0x1a')]?_0x474730[_0x6bae('0x1a')]['limit']||null:null})['then'](function(_0x5703a1){logger[_0x6bae('0xd')](_0x6bae('0x17'),_0x474730);logger[_0x6bae('0x10')](_0x6bae('0x17'),_0x474730,JSON[_0x6bae('0x12')](_0x5703a1));_0x5855eb(_0x5703a1);})['catch'](function(_0x4a395c){logger[_0x6bae('0x13')](_0x6bae('0x17'),_0x4a395c[_0x6bae('0x15')],_0x474730);_0x4ef36b(_0x292bde['error'](0x1f4,_0x4a395c[_0x6bae('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1bb0ca){return new Promise(function(_0x518988,_0x4fa1ca){return db[_0x6bae('0x18')]['find']({'where':_0x1bb0ca[_0x6bae('0x1a')]?_0x1bb0ca[_0x6bae('0x1a')][_0x6bae('0x1c')]||null:null})['then'](function(_0x56d0b4){if(_0x56d0b4){return _0x56d0b4[_0x6bae('0x1e')](_0x1bb0ca[_0x6bae('0x19')][_0x6bae('0x1f')],_[_0x6bae('0x20')](_0x1bb0ca[_0x6bae('0x19')],['ids','id'])||{});}})[_0x6bae('0x21')](function(_0x4593bb){logger[_0x6bae('0xd')]('AddTags',_0x1bb0ca);logger[_0x6bae('0x10')](_0x6bae('0x22'),_0x1bb0ca,JSON[_0x6bae('0x12')](_0x4593bb));_0x518988(_0x4593bb);})[_0x6bae('0x23')](function(_0xa9d806){logger[_0x6bae('0x13')](_0x6bae('0x22'),_0xa9d806[_0x6bae('0x15')],_0x1bb0ca);_0x4fa1ca(_this['error'](0x1f4,_0xa9d806[_0x6bae('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 7340384..dca794c 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 _0x8d81=['./faxInteraction.events','update','emit','removeListener','faxInteraction:'];(function(_0x270020,_0x2585bc){var _0x4e4105=function(_0x5c8e8f){while(--_0x5c8e8f){_0x270020['push'](_0x270020['shift']());}};_0x4e4105(++_0x2585bc);}(_0x8d81,0x195));var _0x18d8=function(_0x35103d,_0x682c7a){_0x35103d=_0x35103d-0x0;var _0x4c65b5=_0x8d81[_0x35103d];return _0x4c65b5;};'use strict';var FaxInteractionEvents=require(_0x18d8('0x0'));var events=['save','remove',_0x18d8('0x1')];function createListener(_0xc05b5,_0x2588d3){return function(_0x2a41b8){_0x2588d3[_0x18d8('0x2')](_0xc05b5,_0x2a41b8);};}function removeListener(_0x5f2759,_0x2b9f34){return function(){FaxInteractionEvents[_0x18d8('0x3')](_0x5f2759,_0x2b9f34);};}exports['register']=function(_0x5771ef){for(var _0x3b097e=0x0,_0x1e15c8=events['length'];_0x3b097e<_0x1e15c8;_0x3b097e++){var _0x3a2205=events[_0x3b097e];var _0xbb2315=createListener(_0x18d8('0x4')+_0x3a2205,_0x5771ef);FaxInteractionEvents['on'](_0x3a2205,_0xbb2315);}}; \ No newline at end of file +var _0x882f=['length','./faxInteraction.events','remove','update','removeListener','register'];(function(_0x3fbeea,_0x59b594){var _0x479753=function(_0x2d874d){while(--_0x2d874d){_0x3fbeea['push'](_0x3fbeea['shift']());}};_0x479753(++_0x59b594);}(_0x882f,0x85));var _0xf882=function(_0x3e5595,_0xbe4275){_0x3e5595=_0x3e5595-0x0;var _0x3fd3a6=_0x882f[_0x3e5595];return _0x3fd3a6;};'use strict';var FaxInteractionEvents=require(_0xf882('0x0'));var events=['save',_0xf882('0x1'),_0xf882('0x2')];function createListener(_0x510672,_0x5658dd){return function(_0x215abe){_0x5658dd['emit'](_0x510672,_0x215abe);};}function removeListener(_0x4612e4,_0x35f522){return function(){FaxInteractionEvents[_0xf882('0x3')](_0x4612e4,_0x35f522);};}exports[_0xf882('0x4')]=function(_0x292f4b){for(var _0x3cb43d=0x0,_0x226cf0=events[_0xf882('0x5')];_0x3cb43d<_0x226cf0;_0x3cb43d++){var _0x3a4f02=events[_0x3cb43d];var _0x21c8e3=createListener('faxInteraction:'+_0x3a4f02,_0x292f4b);FaxInteractionEvents['on'](_0x3a4f02,_0x21c8e3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index d586c14..41a86cc 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 _0xb55a=['./faxInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','addMessage','post','tracked','fax','faxinteraction:update','update','delete','destroy','/:id/tags','removeTags','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0x13adc7,_0x3fa5fa){var _0x4abf3f=function(_0x482b44){while(--_0x482b44){_0x13adc7['push'](_0x13adc7['shift']());}};_0x4abf3f(++_0x3fa5fa);}(_0xb55a,0x78));var _0xab55=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0xb55a[_0x36884e];return _0x1cc367;};'use strict';var multer=require(_0xab55('0x0'));var util=require(_0xab55('0x1'));var path=require('path');var express=require(_0xab55('0x2'));var router=express['Router']();var auth=require(_0xab55('0x3'));var interaction=require(_0xab55('0x4'));var config=require('../../config/environment');var controller=require(_0xab55('0x5'));router[_0xab55('0x6')]('/',auth[_0xab55('0x7')](),controller[_0xab55('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xab55('0x9'),auth[_0xab55('0x7')](),controller[_0xab55('0xa')]);router[_0xab55('0x6')](_0xab55('0xb'),auth[_0xab55('0x7')](),controller[_0xab55('0xc')]);router['post']('/',auth[_0xab55('0x7')](),controller[_0xab55('0xd')]);router['post'](_0xab55('0xb'),auth[_0xab55('0x7')](),controller[_0xab55('0xe')]);router[_0xab55('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xab55('0x10')]('fax','faxinteraction:addtags'),controller['addTags']);router['put'](_0xab55('0x9'),auth[_0xab55('0x7')](),interaction[_0xab55('0x10')](_0xab55('0x11'),_0xab55('0x12')),controller[_0xab55('0x13')]);router[_0xab55('0x14')]('/:id',auth[_0xab55('0x7')](),interaction[_0xab55('0x10')]('fax','faxinteraction:destroy'),controller[_0xab55('0x15')]);router[_0xab55('0x14')](_0xab55('0x16'),auth[_0xab55('0x7')](),controller[_0xab55('0x17')]);module[_0xab55('0x18')]=router; \ No newline at end of file +var _0x986c=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','Router','../../components/interaction/service','../../config/environment','./faxInteraction.controller'];(function(_0x3d34c8,_0x12ca06){var _0x11eecd=function(_0x43777e){while(--_0x43777e){_0x3d34c8['push'](_0x3d34c8['shift']());}};_0x11eecd(++_0x12ca06);}(_0x986c,0xff));var _0xc986=function(_0x3d7635,_0x1db21e){_0x3d7635=_0x3d7635-0x0;var _0x3f611f=_0x986c[_0x3d7635];return _0x3f611f;};'use strict';var multer=require(_0xc986('0x0'));var util=require(_0xc986('0x1'));var path=require('path');var express=require('express');var router=express[_0xc986('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc986('0x3'));var config=require(_0xc986('0x4'));var controller=require(_0xc986('0x5'));router[_0xc986('0x6')]('/',auth[_0xc986('0x7')](),controller[_0xc986('0x8')]);router['get'](_0xc986('0x9'),auth[_0xc986('0x7')](),controller[_0xc986('0xa')]);router[_0xc986('0x6')](_0xc986('0xb'),auth[_0xc986('0x7')](),controller[_0xc986('0xc')]);router[_0xc986('0x6')](_0xc986('0xd'),auth[_0xc986('0x7')](),controller[_0xc986('0xe')]);router[_0xc986('0xf')]('/',auth[_0xc986('0x7')](),controller[_0xc986('0x10')]);router[_0xc986('0xf')](_0xc986('0xd'),auth[_0xc986('0x7')](),controller[_0xc986('0x11')]);router[_0xc986('0xf')](_0xc986('0x12'),auth['isAuthenticated'](),interaction[_0xc986('0x13')](_0xc986('0x14'),_0xc986('0x15')),controller[_0xc986('0x16')]);router[_0xc986('0x17')](_0xc986('0xb'),auth[_0xc986('0x7')](),interaction[_0xc986('0x13')](_0xc986('0x14'),_0xc986('0x18')),controller['update']);router[_0xc986('0x19')](_0xc986('0xb'),auth['isAuthenticated'](),interaction[_0xc986('0x13')]('fax',_0xc986('0x1a')),controller[_0xc986('0x1b')]);router[_0xc986('0x19')](_0xc986('0x12'),auth[_0xc986('0x7')](),controller[_0xc986('0x1c')]);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 d611462..578303c 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 _0x96fa=['exports','TEXT','medium','BOOLEAN','out','DATE','sequelize'];(function(_0x1e2fb3,_0x252d42){var _0x350d17=function(_0x1cfc9b){while(--_0x1cfc9b){_0x1e2fb3['push'](_0x1e2fb3['shift']());}};_0x350d17(++_0x252d42);}(_0x96fa,0xe6));var _0xa96f=function(_0x584d21,_0xee475c){_0x584d21=_0x584d21-0x0;var _0x188964=_0x96fa[_0x584d21];return _0x188964;};'use strict';var Sequelize=require(_0xa96f('0x0'));module[_0xa96f('0x1')]={'body':{'type':Sequelize[_0xa96f('0x2')](_0xa96f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xa96f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xa96f('0x5')),'defaultValue':_0xa96f('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xa96f('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xa96f('0x6')]}}; \ No newline at end of file +var _0x2e3b=['BOOLEAN','ENUM','out','exports','TEXT','medium'];(function(_0xc4ea75,_0x273753){var _0x52ea5e=function(_0x1ee872){while(--_0x1ee872){_0xc4ea75['push'](_0xc4ea75['shift']());}};_0x52ea5e(++_0x273753);}(_0x2e3b,0x81));var _0xb2e3=function(_0x4d952,_0x2b6b04){_0x4d952=_0x4d952-0x0;var _0x33de2e=_0x2e3b[_0x4d952];return _0x33de2e;};'use strict';var Sequelize=require('sequelize');module[_0xb2e3('0x0')]={'body':{'type':Sequelize[_0xb2e3('0x1')](_0xb2e3('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xb2e3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb2e3('0x4')]('in',_0xb2e3('0x5')),'defaultValue':_0xb2e3('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xb2e3('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a3f10ad..29c4db5 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 _0x63d4=['findAll','rows','show','includeAll','find','update','body','params','fax-interactions','accept','readAt','format','CmContact','Contact','get','FaxInteraction','UserId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','manual','SIP/%s','channel','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','interface','event','rejectmessage','create','ContactId','fax','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','end','json','count','offset','set','apply','reject','save','destroy','status','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','filter','where','map','options','include'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x63d4,0x117));var _0x463d=function(_0x5c3d2c,_0x545aee){_0x5c3d2c=_0x5c3d2c-0x0;var _0x6fdb05=_0x63d4[_0x5c3d2c];return _0x6fdb05;};'use strict';var jsonpatch=require(_0x463d('0x0'));var rp=require(_0x463d('0x1'));var moment=require(_0x463d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x463d('0x3'));var util=require(_0x463d('0x4'));var path=require(_0x463d('0x5'));var sox=require(_0x463d('0x6'));var csv=require(_0x463d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x463d('0x8'));var squel=require(_0x463d('0x9'));var crypto=require('crypto');var jsforce=require(_0x463d('0xa'));var deskjs=require(_0x463d('0xb'));var toCsv=require(_0x463d('0x7'));var querystring=require(_0x463d('0xc'));var Papa=require(_0x463d('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x463d('0xe'))('api');var utils=require(_0x463d('0xf'));var config=require(_0x463d('0x10'));var db=require(_0x463d('0x11'))['db'];var socket=require(_0x463d('0x12'))({'host':'localhost','port':0x18eb});require('./faxMessage.socket')[_0x463d('0x13')](socket);var jayson=require('jayson/promise');var client=jayson[_0x463d('0x14')][_0x463d('0x15')]({'port':0x232c});var client9002=jayson[_0x463d('0x14')][_0x463d('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1ac050,_0x15d6ca,_0x39834c,_0x5e463e){return new BPromise(function(_0x1817e2,_0x475b35){var _0x436dba=_0x5e463e||client;return _0x436dba['request'](_0x1ac050,_0x39834c)[_0x463d('0x16')](function(_0xea6080){logger[_0x463d('0x17')](_0x463d('0x18'),_0x15d6ca,_0x463d('0x19'));logger[_0x463d('0x1a')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x15d6ca,_0x463d('0x19'),JSON['stringify'](_0xea6080));if(_0xea6080[_0x463d('0x1b')]){if(_0xea6080[_0x463d('0x1b')][_0x463d('0x1c')]===0x1f4){logger[_0x463d('0x1b')](_0x463d('0x18'),_0x15d6ca,_0xea6080[_0x463d('0x1b')]['message']);return _0x475b35(_0xea6080[_0x463d('0x1b')][_0x463d('0x1d')]);}logger[_0x463d('0x1b')](_0x463d('0x18'),_0x15d6ca,_0xea6080[_0x463d('0x1b')][_0x463d('0x1d')]);return _0x1817e2(_0xea6080[_0x463d('0x1b')][_0x463d('0x1d')]);}else{logger[_0x463d('0x17')](_0x463d('0x18'),_0x15d6ca,_0x463d('0x19'));_0x1817e2(_0xea6080[_0x463d('0x1e')][_0x463d('0x1d')]);}})[_0x463d('0x1f')](function(_0x458789){logger['error'](_0x463d('0x18'),_0x15d6ca,_0x458789);_0x475b35(_0x458789);});});}function respondWithStatusCode(_0x5b0a6b,_0x415f78){_0x415f78=_0x415f78||0xcc;return function(_0x1a2756){if(_0x1a2756){return _0x5b0a6b['sendStatus'](_0x415f78);}return _0x5b0a6b['status'](_0x415f78)[_0x463d('0x20')]();};}function respondWithResult(_0x39c5cb,_0x53dfb3){_0x53dfb3=_0x53dfb3||0xc8;return function(_0x2efdb4){if(_0x2efdb4){return _0x39c5cb['status'](_0x53dfb3)[_0x463d('0x21')](_0x2efdb4);}};}function respondWithFilteredResult(_0x35e562,_0x3f10b3){return function(_0x4b8993){if(_0x4b8993){var _0x592748=_0x4b8993[_0x463d('0x22')],_0x4627c0=_0x3f10b3[_0x463d('0x23')],_0x3763a2=_0x3f10b3[_0x463d('0x23')]+_0x3f10b3['limit'],_0xff0522;if(_0x3763a2>=_0x592748){_0x3763a2=_0x592748;_0xff0522=0xc8;}else{_0xff0522=0xce;}_0x35e562['status'](_0xff0522);return _0x35e562[_0x463d('0x24')]('Content-Range',_0x4627c0+'-'+_0x3763a2+'/'+_0x592748)[_0x463d('0x21')](_0x4b8993);}return null;};}function patchUpdates(_0x45165d){return function(_0x33305d){try{jsonpatch[_0x463d('0x25')](_0x33305d,_0x45165d,!![]);}catch(_0x540e9c){return BPromise[_0x463d('0x26')](_0x540e9c);}return _0x33305d[_0x463d('0x27')]();};}function saveUpdates(_0xfa24ab,_0x236ebb){return function(_0x3a9fb1){if(_0x3a9fb1){return _0x3a9fb1['update'](_0xfa24ab)[_0x463d('0x16')](function(_0x2a3c7a){return _0x2a3c7a;});}return null;};}function removeEntity(_0x5cd7ed,_0x294507){return function(_0x54b954){if(_0x54b954){return _0x54b954[_0x463d('0x28')]()[_0x463d('0x16')](function(){_0x5cd7ed[_0x463d('0x29')](0xcc)[_0x463d('0x20')]();});}};}function handleEntityNotFound(_0x2b32f0,_0x5203fb){return function(_0x43c6e9){if(!_0x43c6e9){_0x2b32f0[_0x463d('0x2a')](0x194);}return _0x43c6e9;};}function handleError(_0x27869a,_0x386377){_0x386377=_0x386377||0x1f4;return function(_0x2ff2f0){logger[_0x463d('0x1b')](_0x2ff2f0[_0x463d('0x2b')]);if(_0x2ff2f0[_0x463d('0x2c')]){delete _0x2ff2f0[_0x463d('0x2c')];}_0x27869a[_0x463d('0x29')](_0x386377)[_0x463d('0x2d')](_0x2ff2f0);};}exports[_0x463d('0x2e')]=function(_0x3d4960,_0x456f46){var _0x471ee4={},_0x5d2624={},_0x153fab={'count':0x0,'rows':[]};var _0x83382e=db[_0x463d('0x2f')][_0x463d('0x30')];_0x5d2624[_0x463d('0x31')]=_[_0x463d('0x32')](_0x83382e);var _0x38c352={'dateStart':_0x3d4960[_0x463d('0x33')][_0x463d('0x34')],'dateEnd':_0x3d4960[_0x463d('0x33')][_0x463d('0x35')]};delete _0x3d4960['query']['dateStart'];delete _0x3d4960[_0x463d('0x33')][_0x463d('0x35')];_0x5d2624['query']=_[_0x463d('0x32')](_0x3d4960['query']);_0x5d2624['filters']=_[_0x463d('0x36')](_0x5d2624['model'],_0x5d2624[_0x463d('0x33')]);_0x471ee4[_0x463d('0x37')]=_['intersection'](_0x5d2624[_0x463d('0x31')],qs[_0x463d('0x38')](_0x3d4960[_0x463d('0x33')][_0x463d('0x38')]));_0x471ee4[_0x463d('0x37')]=_0x471ee4[_0x463d('0x37')][_0x463d('0x39')]?_0x471ee4['attributes']:_0x5d2624['model'];if(!_0x3d4960[_0x463d('0x33')][_0x463d('0x3a')](_0x463d('0x3b'))){_0x471ee4['limit']=qs['limit'](_0x3d4960[_0x463d('0x33')]['limit']);_0x471ee4[_0x463d('0x23')]=qs[_0x463d('0x23')](_0x3d4960[_0x463d('0x33')][_0x463d('0x23')]);}_0x471ee4[_0x463d('0x3c')]=qs[_0x463d('0x3d')](_0x3d4960['query'][_0x463d('0x3d')]);_0x471ee4['where']=qs[_0x463d('0x3e')](_[_0x463d('0x3f')](_0x3d4960['query'],_0x5d2624['filters']));if(_0x38c352[_0x463d('0x34')]){if(_0x38c352[_0x463d('0x35')]){_0x38c352['dateEnd']=moment(_0x38c352['dateEnd'])[_0x463d('0x40')](0x1,'day');}else{_0x38c352[_0x463d('0x35')]=moment(_0x38c352[_0x463d('0x34')])[_0x463d('0x40')](0x1,_0x463d('0x41'));}_[_0x463d('0x42')](_0x471ee4['where'],{'createdAt':{'$gte':_0x38c352[_0x463d('0x34')],'$lte':_0x38c352[_0x463d('0x35')]}});}if(_0x3d4960[_0x463d('0x33')][_0x463d('0x43')]){_0x471ee4[_0x463d('0x44')]=_[_0x463d('0x42')](_0x471ee4[_0x463d('0x44')],{'$or':_[_0x463d('0x45')](_0x471ee4['attributes'],function(_0x3deb61){var _0x5a7469={};_0x5a7469[_0x3deb61]={'$like':'%'+_0x3d4960['query']['filter']+'%'};return _0x5a7469;})});}_0x471ee4=_['merge']({},_0x471ee4,_0x3d4960[_0x463d('0x46')]);var _0x1739e8={'where':_0x471ee4[_0x463d('0x44')]};return db[_0x463d('0x2f')][_0x463d('0x22')](_0x1739e8)[_0x463d('0x16')](function(_0x10a96){_0x153fab['count']=_0x10a96;if(_0x3d4960[_0x463d('0x33')]['includeAll']){_0x471ee4[_0x463d('0x47')]=[{'all':!![]}];}return db[_0x463d('0x2f')][_0x463d('0x48')](_0x471ee4);})[_0x463d('0x16')](function(_0x772f66){_0x153fab[_0x463d('0x49')]=_0x772f66;return _0x153fab;})[_0x463d('0x16')](respondWithFilteredResult(_0x456f46,_0x471ee4))[_0x463d('0x1f')](handleError(_0x456f46,null));};exports[_0x463d('0x4a')]=function(_0x5363d4,_0x21e5e5){var _0x27cc80={'raw':!![],'where':{'id':_0x5363d4['params']['id']}},_0x1b66dc={};_0x1b66dc['model']=_[_0x463d('0x32')](db['FaxMessage'][_0x463d('0x30')]);_0x1b66dc[_0x463d('0x33')]=_[_0x463d('0x32')](_0x5363d4['query']);_0x1b66dc[_0x463d('0x3e')]=_[_0x463d('0x36')](_0x1b66dc['model'],_0x1b66dc['query']);_0x27cc80[_0x463d('0x37')]=_[_0x463d('0x36')](_0x1b66dc[_0x463d('0x31')],qs[_0x463d('0x38')](_0x5363d4[_0x463d('0x33')][_0x463d('0x38')]));_0x27cc80[_0x463d('0x37')]=_0x27cc80[_0x463d('0x37')][_0x463d('0x39')]?_0x27cc80[_0x463d('0x37')]:_0x1b66dc['model'];if(_0x5363d4['query'][_0x463d('0x4b')]){_0x27cc80['include']=[{'all':!![]}];}_0x27cc80=_['merge']({},_0x27cc80,_0x5363d4['options']);return db[_0x463d('0x2f')][_0x463d('0x4c')](_0x27cc80)[_0x463d('0x16')](handleEntityNotFound(_0x21e5e5,null))['then'](respondWithResult(_0x21e5e5,null))[_0x463d('0x1f')](handleError(_0x21e5e5,null));};exports[_0x463d('0x4d')]=function(_0x48b92a,_0x167566){if(_0x48b92a[_0x463d('0x4e')]['id']){delete _0x48b92a['body']['id'];}return db[_0x463d('0x2f')][_0x463d('0x4c')]({'where':{'id':_0x48b92a[_0x463d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x167566,null))['then'](saveUpdates(_0x48b92a[_0x463d('0x4e')],null))[_0x463d('0x16')](respondWithResult(_0x167566,null))[_0x463d('0x1f')](handleError(_0x167566,null));};exports[_0x463d('0x28')]=function(_0x1c87c4,_0x5cd075){return db[_0x463d('0x2f')][_0x463d('0x4c')]({'where':{'id':_0x1c87c4[_0x463d('0x4f')]['id']}})[_0x463d('0x16')](handleEntityNotFound(_0x5cd075,null))[_0x463d('0x16')](removeEntity(_0x5cd075,null))[_0x463d('0x1f')](handleError(_0x5cd075,null));};exports['describe']=function(_0x1165df,_0x4b9f47){return db[_0x463d('0x2f')]['describe']()[_0x463d('0x16')](respondWithResult(_0x4b9f47,null))['catch'](handleError(_0x4b9f47,null));};var interaction_log=require('../../config/logger')(_0x463d('0x50'));exports[_0x463d('0x51')]=function(_0x5283fd,_0x172e14,_0x1cc0fe){var _0x1aa0ed={'channel':'fax'};if(_0x5283fd[_0x463d('0x4e')]['id']){delete _0x5283fd['body']['id'];}_0x5283fd[_0x463d('0x4e')]['read']=!![];_0x5283fd[_0x463d('0x4e')][_0x463d('0x52')]=moment()[_0x463d('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x5283fd['body']['UserId']=_0x5283fd['body']['UserId']||_0x5283fd['user']['id'];return db[_0x463d('0x2f')]['find']({'where':{'id':_0x5283fd[_0x463d('0x4f')]['id'],'UserId':null},'include':[{'model':db[_0x463d('0x54')],'as':_0x463d('0x55')}]})['then'](handleEntityNotFound(_0x172e14,null))[_0x463d('0x16')](saveUpdates(_0x5283fd[_0x463d('0x4e')],null))[_0x463d('0x16')](function(_0x2c6a27){if(_0x2c6a27){_0x1aa0ed[_0x463d('0x1d')]=_0x2c6a27[_0x463d('0x56')]({'plain':!![]});return db[_0x463d('0x57')][_0x463d('0x4c')]({'where':{'id':_0x2c6a27['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x172e14,null))[_0x463d('0x16')](function(_0x24f773){if(_0x24f773){return _0x24f773[_0x463d('0x4d')]({'UserId':_0x5283fd['body'][_0x463d('0x58')],'read1stAt':_[_0x463d('0x59')](_0x24f773['read1stAt'])?moment()[_0x463d('0x53')](_0x463d('0x5a')):undefined});}return null;})['then'](function(_0x99c239){if(_0x99c239){_0x1aa0ed[_0x463d('0x5b')]=_0x99c239[_0x463d('0x56')]({'plain':!![]});interaction_log[_0x463d('0x17')](_0x463d('0x5c'),_0x5283fd[_0x463d('0x5d')]['id'],_0x5283fd[_0x463d('0x5d')][_0x463d('0x2c')],_0x5283fd[_0x463d('0x5d')][_0x463d('0x5e')],_0x1aa0ed[_0x463d('0x5b')]['id'],_0x5283fd[_0x463d('0x4e')]?JSON[_0x463d('0x5f')](_0x5283fd[_0x463d('0x4e')]):'null');return respondWithRpcPromise(_0x463d('0x60'),_0x463d('0x61'),_0x1aa0ed);}return null;})[_0x463d('0x16')](function(_0x58a994){if(_0x58a994){if(_0x5283fd[_0x463d('0x4e')][_0x463d('0x62')]){_0x1aa0ed[_0x463d('0x1d')]['interface']=util[_0x463d('0x53')](_0x463d('0x63'),_0x5283fd[_0x463d('0x5d')]['name']);_0x1aa0ed[_0x463d('0x1d')][_0x463d('0x64')]=_0x1aa0ed['channel'];_0x1aa0ed['message']['event']=_0x463d('0x51');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x1aa0ed[_0x463d('0x1d')]},client9002)[_0x463d('0x16')](function(){return _0x1aa0ed;});}return _0x1aa0ed;}return null;})['then'](respondWithResult(_0x172e14,null))[_0x463d('0x1f')](handleError(_0x172e14,null));};var interaction_log=require(_0x463d('0xe'))('fax-interactions');exports[_0x463d('0x26')]=function(_0x548ee9,_0x56e860,_0x11997d){var _0x1e4dd4={'agent':{},'channel':'fax'};if(_0x548ee9['body']['id']){delete _0x548ee9['body']['id'];}_0x548ee9[_0x463d('0x4e')]['UserId']=_0x548ee9[_0x463d('0x4e')][_0x463d('0x58')]||_0x548ee9[_0x463d('0x5d')]['id'];_0x1e4dd4[_0x463d('0x65')]['id']=_0x548ee9[_0x463d('0x4e')][_0x463d('0x58')];return db['FaxMessage'][_0x463d('0x4c')]({'where':{'id':_0x548ee9['params']['id'],'UserId':null}})[_0x463d('0x16')](handleEntityNotFound(_0x56e860,null))['then'](function(_0x2dcd7b){if(_0x2dcd7b){_0x1e4dd4[_0x463d('0x1d')]=_0x2dcd7b['get']({'plain':!![]});return db[_0x463d('0x57')][_0x463d('0x4c')]({'where':{'id':_0x2dcd7b[_0x463d('0x66')]}});}return null;})[_0x463d('0x16')](handleEntityNotFound(_0x56e860,null))[_0x463d('0x16')](function(_0x4a4fa0){if(_0x4a4fa0){_0x1e4dd4[_0x463d('0x5b')]=_0x4a4fa0[_0x463d('0x56')]({'plain':!![]});interaction_log[_0x463d('0x17')](_0x463d('0x67'),_0x548ee9['user']['id'],_0x548ee9[_0x463d('0x5d')][_0x463d('0x2c')],_0x548ee9[_0x463d('0x5d')]['role'],_0x1e4dd4[_0x463d('0x5b')]['id'],_0x548ee9[_0x463d('0x4e')]?JSON[_0x463d('0x5f')](_0x548ee9[_0x463d('0x4e')]):_0x463d('0x68'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x1e4dd4);}return null;})[_0x463d('0x16')](function(_0x228eca){if(_0x228eca){_0x228eca['message'][_0x463d('0x69')]=util[_0x463d('0x53')]('SIP/%s',_0x548ee9[_0x463d('0x5d')][_0x463d('0x2c')]);_0x228eca['message'][_0x463d('0x64')]=_0x1e4dd4[_0x463d('0x64')];_0x228eca[_0x463d('0x1d')][_0x463d('0x6a')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x463d('0x6b'),'message':_0x228eca['message']},client9002);return _0x1e4dd4;}return null;})[_0x463d('0x16')](respondWithResult(_0x56e860,null))[_0x463d('0x1f')](handleError(_0x56e860,null));};exports[_0x463d('0x6c')]=function(_0x2e0189,_0x4e4d8c){var _0x4c825b;return db['FaxMessage']['create'](_0x2e0189[_0x463d('0x4e')],{})[_0x463d('0x16')](function(_0x28afb3){_0x4c825b=_0x28afb3;return db['CmContact']['findOne']({'where':{'id':_0x4c825b[_0x463d('0x6d')]}});})[_0x463d('0x16')](function(_0x1bd373){if(_[_0x463d('0x59')](_0x1bd373)){return;}else{_0x4c825b[_0x463d('0x6e')]=_0x1bd373['fax'];return db[_0x463d('0x6f')]['findOne']({'where':{'id':_0x4c825b[_0x463d('0x70')]}});}})[_0x463d('0x16')](function(_0xc1e3e6){return respondWithRpcPromise('SendFax',_0x463d('0x71'),{'FaxAccountId':_[_0x463d('0x59')](_0x2e0189[_0x463d('0x4e')])?undefined:_0x2e0189[_0x463d('0x4e')][_0x463d('0x72')],'path':_[_0x463d('0x59')](_0xc1e3e6)?undefined:util[_0x463d('0x53')](_0x463d('0x73'),_0xc1e3e6[_0x463d('0x74')]),'fax':_[_0x463d('0x59')](_0x4c825b[_0x463d('0x6e')])?undefined:_0x4c825b[_0x463d('0x6e')],'AttachmentId':_0x4c825b['AttachmentId']},client9002);})[_0x463d('0x16')](respondWithResult(_0x4e4d8c,0xc9))['catch'](handleError(_0x4e4d8c,null));}; \ No newline at end of file +var _0xda81=['code','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','update','destroy','stack','name','send','FaxMessage','rawAttributes','model','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','merge','where','filter','map','options','include','findAll','catch','show','params','keys','includeAll','find','describe','accept','fax','body','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','Contact','get','FaxInteraction','FaxInteractionId','user','interaction','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax-interactions','reject','agent','role','rejectmessage','create','CmContact','findOne','ContactId','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./faxMessage.socket','register','jayson/promise','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x253825,_0x1751b9){var _0x21823f=function(_0x5e8358){while(--_0x5e8358){_0x253825['push'](_0x253825['shift']());}};_0x21823f(++_0x1751b9);}(_0xda81,0x1c3));var _0x1da8=function(_0x560b2b,_0x1a08f2){_0x560b2b=_0x560b2b-0x0;var _0x267dd9=_0xda81[_0x560b2b];return _0x267dd9;};'use strict';var jsonpatch=require(_0x1da8('0x0'));var rp=require(_0x1da8('0x1'));var moment=require(_0x1da8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x1da8('0x3'));var util=require(_0x1da8('0x4'));var path=require(_0x1da8('0x5'));var sox=require(_0x1da8('0x6'));var csv=require('to-csv');var ejs=require(_0x1da8('0x7'));var fs=require('fs');var _=require(_0x1da8('0x8'));var squel=require('squel');var crypto=require(_0x1da8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1da8('0xa'));var toCsv=require(_0x1da8('0xb'));var querystring=require(_0x1da8('0xc'));var Papa=require(_0x1da8('0xd'));var qs=require(_0x1da8('0xe'));var logger=require(_0x1da8('0xf'))(_0x1da8('0x10'));var utils=require(_0x1da8('0x11'));var config=require(_0x1da8('0x12'));var db=require('../../mysqldb')['db'];var socket=require(_0x1da8('0x13'))({'host':_0x1da8('0x14'),'port':0x18eb});require(_0x1da8('0x15'))[_0x1da8('0x16')](socket);var jayson=require(_0x1da8('0x17'));var client=jayson['client'][_0x1da8('0x18')]({'port':0x232c});var client9002=jayson['client'][_0x1da8('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x4127c8,_0x2717e6,_0x444ea6,_0x44c1a7){return new BPromise(function(_0x5c722d,_0x9d4cd3){var _0x491a3f=_0x44c1a7||client;return _0x491a3f[_0x1da8('0x19')](_0x4127c8,_0x444ea6)[_0x1da8('0x1a')](function(_0x126954){logger[_0x1da8('0x1b')](_0x1da8('0x1c'),_0x2717e6,_0x1da8('0x1d'));logger['debug'](_0x1da8('0x1e'),_0x2717e6,_0x1da8('0x1d'),JSON[_0x1da8('0x1f')](_0x126954));if(_0x126954[_0x1da8('0x20')]){if(_0x126954[_0x1da8('0x20')][_0x1da8('0x21')]===0x1f4){logger[_0x1da8('0x20')](_0x1da8('0x1c'),_0x2717e6,_0x126954[_0x1da8('0x20')]['message']);return _0x9d4cd3(_0x126954[_0x1da8('0x20')][_0x1da8('0x22')]);}logger[_0x1da8('0x20')](_0x1da8('0x1c'),_0x2717e6,_0x126954[_0x1da8('0x20')][_0x1da8('0x22')]);return _0x5c722d(_0x126954['error'][_0x1da8('0x22')]);}else{logger[_0x1da8('0x1b')](_0x1da8('0x1c'),_0x2717e6,_0x1da8('0x1d'));_0x5c722d(_0x126954[_0x1da8('0x23')][_0x1da8('0x22')]);}})['catch'](function(_0x283ff8){logger['error'](_0x1da8('0x1c'),_0x2717e6,_0x283ff8);_0x9d4cd3(_0x283ff8);});});}function respondWithStatusCode(_0x2a127f,_0x3c9abf){_0x3c9abf=_0x3c9abf||0xcc;return function(_0x370d2a){if(_0x370d2a){return _0x2a127f[_0x1da8('0x24')](_0x3c9abf);}return _0x2a127f[_0x1da8('0x25')](_0x3c9abf)[_0x1da8('0x26')]();};}function respondWithResult(_0x4b926b,_0x4a703d){_0x4a703d=_0x4a703d||0xc8;return function(_0xac4b2a){if(_0xac4b2a){return _0x4b926b[_0x1da8('0x25')](_0x4a703d)['json'](_0xac4b2a);}};}function respondWithFilteredResult(_0x242e69,_0x1509a9){return function(_0xa6da1b){if(_0xa6da1b){var _0x138aad=_0xa6da1b[_0x1da8('0x27')],_0x1e2d3e=_0x1509a9[_0x1da8('0x28')],_0x46af20=_0x1509a9[_0x1da8('0x28')]+_0x1509a9[_0x1da8('0x29')],_0x5c3960;if(_0x46af20>=_0x138aad){_0x46af20=_0x138aad;_0x5c3960=0xc8;}else{_0x5c3960=0xce;}_0x242e69[_0x1da8('0x25')](_0x5c3960);return _0x242e69[_0x1da8('0x2a')](_0x1da8('0x2b'),_0x1e2d3e+'-'+_0x46af20+'/'+_0x138aad)[_0x1da8('0x2c')](_0xa6da1b);}return null;};}function patchUpdates(_0x442043){return function(_0x21f3fe){try{jsonpatch['apply'](_0x21f3fe,_0x442043,!![]);}catch(_0x157977){return BPromise['reject'](_0x157977);}return _0x21f3fe['save']();};}function saveUpdates(_0x585ccc,_0x54d3fd){return function(_0x3e7c00){if(_0x3e7c00){return _0x3e7c00[_0x1da8('0x2d')](_0x585ccc)['then'](function(_0x198b31){return _0x198b31;});}return null;};}function removeEntity(_0x59d3c5,_0x1b26dc){return function(_0x202017){if(_0x202017){return _0x202017[_0x1da8('0x2e')]()['then'](function(){_0x59d3c5[_0x1da8('0x25')](0xcc)[_0x1da8('0x26')]();});}};}function handleEntityNotFound(_0x354513,_0x7678be){return function(_0x5ec22c){if(!_0x5ec22c){_0x354513[_0x1da8('0x24')](0x194);}return _0x5ec22c;};}function handleError(_0x3e622f,_0x32b72){_0x32b72=_0x32b72||0x1f4;return function(_0x21cc4b){logger[_0x1da8('0x20')](_0x21cc4b[_0x1da8('0x2f')]);if(_0x21cc4b['name']){delete _0x21cc4b[_0x1da8('0x30')];}_0x3e622f[_0x1da8('0x25')](_0x32b72)[_0x1da8('0x31')](_0x21cc4b);};}exports['index']=function(_0x1e50da,_0x12ce12){var _0x31995e={},_0x16424c={},_0x4089c6={'count':0x0,'rows':[]};var _0x504b51=db[_0x1da8('0x32')][_0x1da8('0x33')];_0x16424c[_0x1da8('0x34')]=_['keys'](_0x504b51);var _0x4f8291={'dateStart':_0x1e50da[_0x1da8('0x35')]['dateStart'],'dateEnd':_0x1e50da['query']['dateEnd']};delete _0x1e50da[_0x1da8('0x35')][_0x1da8('0x36')];delete _0x1e50da[_0x1da8('0x35')]['dateEnd'];_0x16424c[_0x1da8('0x35')]=_['keys'](_0x1e50da[_0x1da8('0x35')]);_0x16424c[_0x1da8('0x37')]=_[_0x1da8('0x38')](_0x16424c[_0x1da8('0x34')],_0x16424c[_0x1da8('0x35')]);_0x31995e[_0x1da8('0x39')]=_[_0x1da8('0x38')](_0x16424c[_0x1da8('0x34')],qs[_0x1da8('0x3a')](_0x1e50da[_0x1da8('0x35')][_0x1da8('0x3a')]));_0x31995e[_0x1da8('0x39')]=_0x31995e['attributes'][_0x1da8('0x3b')]?_0x31995e[_0x1da8('0x39')]:_0x16424c['model'];if(!_0x1e50da[_0x1da8('0x35')][_0x1da8('0x3c')](_0x1da8('0x3d'))){_0x31995e['limit']=qs[_0x1da8('0x29')](_0x1e50da[_0x1da8('0x35')][_0x1da8('0x29')]);_0x31995e[_0x1da8('0x28')]=qs[_0x1da8('0x28')](_0x1e50da['query'][_0x1da8('0x28')]);}_0x31995e[_0x1da8('0x3e')]=qs[_0x1da8('0x3f')](_0x1e50da['query'][_0x1da8('0x3f')]);_0x31995e['where']=qs[_0x1da8('0x37')](_[_0x1da8('0x40')](_0x1e50da[_0x1da8('0x35')],_0x16424c[_0x1da8('0x37')]));if(_0x4f8291[_0x1da8('0x36')]){if(_0x4f8291[_0x1da8('0x41')]){_0x4f8291[_0x1da8('0x41')]=moment(_0x4f8291[_0x1da8('0x41')])[_0x1da8('0x42')](0x1,_0x1da8('0x43'));}else{_0x4f8291['dateEnd']=moment(_0x4f8291[_0x1da8('0x36')])[_0x1da8('0x42')](0x1,_0x1da8('0x43'));}_[_0x1da8('0x44')](_0x31995e[_0x1da8('0x45')],{'createdAt':{'$gte':_0x4f8291['dateStart'],'$lte':_0x4f8291[_0x1da8('0x41')]}});}if(_0x1e50da[_0x1da8('0x35')][_0x1da8('0x46')]){_0x31995e[_0x1da8('0x45')]=_[_0x1da8('0x44')](_0x31995e[_0x1da8('0x45')],{'$or':_[_0x1da8('0x47')](_0x31995e[_0x1da8('0x39')],function(_0x3235ab){var _0x3d7755={};_0x3d7755[_0x3235ab]={'$like':'%'+_0x1e50da[_0x1da8('0x35')][_0x1da8('0x46')]+'%'};return _0x3d7755;})});}_0x31995e=_[_0x1da8('0x44')]({},_0x31995e,_0x1e50da[_0x1da8('0x48')]);var _0x4e515f={'where':_0x31995e['where']};return db[_0x1da8('0x32')][_0x1da8('0x27')](_0x4e515f)[_0x1da8('0x1a')](function(_0x31d76e){_0x4089c6[_0x1da8('0x27')]=_0x31d76e;if(_0x1e50da[_0x1da8('0x35')]['includeAll']){_0x31995e[_0x1da8('0x49')]=[{'all':!![]}];}return db['FaxMessage'][_0x1da8('0x4a')](_0x31995e);})[_0x1da8('0x1a')](function(_0x426894){_0x4089c6['rows']=_0x426894;return _0x4089c6;})[_0x1da8('0x1a')](respondWithFilteredResult(_0x12ce12,_0x31995e))[_0x1da8('0x4b')](handleError(_0x12ce12,null));};exports[_0x1da8('0x4c')]=function(_0x3566d1,_0x2fd418){var _0x40a2c4={'raw':!![],'where':{'id':_0x3566d1[_0x1da8('0x4d')]['id']}},_0x54311d={};_0x54311d['model']=_[_0x1da8('0x4e')](db['FaxMessage'][_0x1da8('0x33')]);_0x54311d['query']=_[_0x1da8('0x4e')](_0x3566d1[_0x1da8('0x35')]);_0x54311d[_0x1da8('0x37')]=_['intersection'](_0x54311d[_0x1da8('0x34')],_0x54311d[_0x1da8('0x35')]);_0x40a2c4[_0x1da8('0x39')]=_['intersection'](_0x54311d['model'],qs[_0x1da8('0x3a')](_0x3566d1[_0x1da8('0x35')][_0x1da8('0x3a')]));_0x40a2c4[_0x1da8('0x39')]=_0x40a2c4[_0x1da8('0x39')][_0x1da8('0x3b')]?_0x40a2c4[_0x1da8('0x39')]:_0x54311d[_0x1da8('0x34')];if(_0x3566d1['query'][_0x1da8('0x4f')]){_0x40a2c4[_0x1da8('0x49')]=[{'all':!![]}];}_0x40a2c4=_[_0x1da8('0x44')]({},_0x40a2c4,_0x3566d1['options']);return db[_0x1da8('0x32')][_0x1da8('0x50')](_0x40a2c4)[_0x1da8('0x1a')](handleEntityNotFound(_0x2fd418,null))['then'](respondWithResult(_0x2fd418,null))[_0x1da8('0x4b')](handleError(_0x2fd418,null));};exports['update']=function(_0x48c4b7,_0x1ecadf){if(_0x48c4b7['body']['id']){delete _0x48c4b7['body']['id'];}return db[_0x1da8('0x32')][_0x1da8('0x50')]({'where':{'id':_0x48c4b7[_0x1da8('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ecadf,null))['then'](saveUpdates(_0x48c4b7['body'],null))[_0x1da8('0x1a')](respondWithResult(_0x1ecadf,null))[_0x1da8('0x4b')](handleError(_0x1ecadf,null));};exports['destroy']=function(_0x5c65de,_0x8d512b){return db[_0x1da8('0x32')]['find']({'where':{'id':_0x5c65de[_0x1da8('0x4d')]['id']}})[_0x1da8('0x1a')](handleEntityNotFound(_0x8d512b,null))[_0x1da8('0x1a')](removeEntity(_0x8d512b,null))[_0x1da8('0x4b')](handleError(_0x8d512b,null));};exports['describe']=function(_0x4663ac,_0x489c4a){return db[_0x1da8('0x32')][_0x1da8('0x51')]()['then'](respondWithResult(_0x489c4a,null))[_0x1da8('0x4b')](handleError(_0x489c4a,null));};var interaction_log=require(_0x1da8('0xf'))('fax-interactions');exports[_0x1da8('0x52')]=function(_0x442460,_0x532a88,_0x7a4c6e){var _0x42980e={'channel':_0x1da8('0x53')};if(_0x442460[_0x1da8('0x54')]['id']){delete _0x442460[_0x1da8('0x54')]['id'];}_0x442460['body'][_0x1da8('0x55')]=!![];_0x442460[_0x1da8('0x54')][_0x1da8('0x56')]=moment()[_0x1da8('0x57')](_0x1da8('0x58'));_0x442460[_0x1da8('0x54')]['UserId']=_0x442460[_0x1da8('0x54')][_0x1da8('0x59')]||_0x442460['user']['id'];return db[_0x1da8('0x32')][_0x1da8('0x50')]({'where':{'id':_0x442460[_0x1da8('0x4d')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x1da8('0x5a')}]})['then'](handleEntityNotFound(_0x532a88,null))[_0x1da8('0x1a')](saveUpdates(_0x442460[_0x1da8('0x54')],null))[_0x1da8('0x1a')](function(_0x1f9295){if(_0x1f9295){_0x42980e[_0x1da8('0x22')]=_0x1f9295[_0x1da8('0x5b')]({'plain':!![]});return db[_0x1da8('0x5c')][_0x1da8('0x50')]({'where':{'id':_0x1f9295[_0x1da8('0x5d')]}});}return null;})['then'](handleEntityNotFound(_0x532a88,null))[_0x1da8('0x1a')](function(_0x2ef656){if(_0x2ef656){return _0x2ef656[_0x1da8('0x2d')]({'UserId':_0x442460[_0x1da8('0x54')][_0x1da8('0x59')],'read1stAt':_['isNil'](_0x2ef656['read1stAt'])?moment()['format'](_0x1da8('0x58')):undefined});}return null;})[_0x1da8('0x1a')](function(_0xcff857){if(_0xcff857){_0x42980e['interaction']=_0xcff857[_0x1da8('0x5b')]({'plain':!![]});interaction_log[_0x1da8('0x1b')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x442460[_0x1da8('0x5e')]['id'],_0x442460[_0x1da8('0x5e')][_0x1da8('0x30')],_0x442460[_0x1da8('0x5e')]['role'],_0x42980e[_0x1da8('0x5f')]['id'],_0x442460[_0x1da8('0x54')]?JSON['stringify'](_0x442460[_0x1da8('0x54')]):_0x1da8('0x60'));return respondWithRpcPromise(_0x1da8('0x61'),_0x1da8('0x62'),_0x42980e);}return null;})[_0x1da8('0x1a')](function(_0x5d03c8){if(_0x5d03c8){if(_0x442460[_0x1da8('0x54')][_0x1da8('0x63')]){_0x42980e[_0x1da8('0x22')][_0x1da8('0x64')]=util[_0x1da8('0x57')](_0x1da8('0x65'),_0x442460[_0x1da8('0x5e')]['name']);_0x42980e[_0x1da8('0x22')][_0x1da8('0x66')]=_0x42980e[_0x1da8('0x66')];_0x42980e[_0x1da8('0x22')][_0x1da8('0x67')]='accept';return respondWithRpcPromise(_0x1da8('0x68'),_0x1da8('0x68'),{'event':_0x1da8('0x69'),'message':_0x42980e[_0x1da8('0x22')]},client9002)['then'](function(){return _0x42980e;});}return _0x42980e;}return null;})[_0x1da8('0x1a')](respondWithResult(_0x532a88,null))['catch'](handleError(_0x532a88,null));};var interaction_log=require('../../config/logger')(_0x1da8('0x6a'));exports[_0x1da8('0x6b')]=function(_0xf38be8,_0x4bf467,_0x3e51ff){var _0x4499ed={'agent':{},'channel':_0x1da8('0x53')};if(_0xf38be8[_0x1da8('0x54')]['id']){delete _0xf38be8[_0x1da8('0x54')]['id'];}_0xf38be8[_0x1da8('0x54')][_0x1da8('0x59')]=_0xf38be8[_0x1da8('0x54')]['UserId']||_0xf38be8[_0x1da8('0x5e')]['id'];_0x4499ed[_0x1da8('0x6c')]['id']=_0xf38be8['body'][_0x1da8('0x59')];return db['FaxMessage'][_0x1da8('0x50')]({'where':{'id':_0xf38be8[_0x1da8('0x4d')]['id'],'UserId':null}})[_0x1da8('0x1a')](handleEntityNotFound(_0x4bf467,null))[_0x1da8('0x1a')](function(_0x4af980){if(_0x4af980){_0x4499ed[_0x1da8('0x22')]=_0x4af980[_0x1da8('0x5b')]({'plain':!![]});return db[_0x1da8('0x5c')][_0x1da8('0x50')]({'where':{'id':_0x4af980[_0x1da8('0x5d')]}});}return null;})[_0x1da8('0x1a')](handleEntityNotFound(_0x4bf467,null))[_0x1da8('0x1a')](function(_0x13dd21){if(_0x13dd21){_0x4499ed[_0x1da8('0x5f')]=_0x13dd21['get']({'plain':!![]});interaction_log[_0x1da8('0x1b')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf38be8[_0x1da8('0x5e')]['id'],_0xf38be8[_0x1da8('0x5e')][_0x1da8('0x30')],_0xf38be8[_0x1da8('0x5e')][_0x1da8('0x6d')],_0x4499ed[_0x1da8('0x5f')]['id'],_0xf38be8[_0x1da8('0x54')]?JSON[_0x1da8('0x1f')](_0xf38be8[_0x1da8('0x54')]):_0x1da8('0x60'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x4499ed);}return null;})['then'](function(_0x12b2ec){if(_0x12b2ec){_0x12b2ec['message'][_0x1da8('0x64')]=util[_0x1da8('0x57')]('SIP/%s',_0xf38be8[_0x1da8('0x5e')]['name']);_0x12b2ec[_0x1da8('0x22')][_0x1da8('0x66')]=_0x4499ed[_0x1da8('0x66')];_0x12b2ec[_0x1da8('0x22')][_0x1da8('0x67')]='reject';respondWithRpcPromise('EventManager',_0x1da8('0x68'),{'event':_0x1da8('0x6e'),'message':_0x12b2ec[_0x1da8('0x22')]},client9002);return _0x4499ed;}return null;})['then'](respondWithResult(_0x4bf467,null))[_0x1da8('0x4b')](handleError(_0x4bf467,null));};exports[_0x1da8('0x6f')]=function(_0x551841,_0x536b1f){var _0x56dd81;return db[_0x1da8('0x32')][_0x1da8('0x6f')](_0x551841['body'],{})[_0x1da8('0x1a')](function(_0x2dbc9c){_0x56dd81=_0x2dbc9c;return db[_0x1da8('0x70')][_0x1da8('0x71')]({'where':{'id':_0x56dd81[_0x1da8('0x72')]}});})[_0x1da8('0x1a')](function(_0xbb30ac){if(_[_0x1da8('0x73')](_0xbb30ac)){return;}else{_0x56dd81[_0x1da8('0x53')]=_0xbb30ac[_0x1da8('0x53')];return db['Attachment']['findOne']({'where':{'id':_0x56dd81[_0x1da8('0x74')]}});}})[_0x1da8('0x1a')](function(_0x2db6e6){return respondWithRpcPromise(_0x1da8('0x75'),'SendFax',{'FaxAccountId':_[_0x1da8('0x73')](_0x551841['body'])?undefined:_0x551841[_0x1da8('0x54')][_0x1da8('0x76')],'path':_['isNil'](_0x2db6e6)?undefined:util[_0x1da8('0x57')](_0x1da8('0x77'),_0x2db6e6[_0x1da8('0x78')]),'fax':_[_0x1da8('0x73')](_0x56dd81['fax'])?undefined:_0x56dd81[_0x1da8('0x53')],'AttachmentId':_0x56dd81[_0x1da8('0x74')]},client9002);})[_0x1da8('0x1a')](respondWithResult(_0x536b1f,0xc9))['catch'](handleError(_0x536b1f,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2554182..bdf54f9 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 _0x6271=['FaxMessage','save','update','hook','exports','events','../../mysqldb'];(function(_0x39ba3c,_0x318beb){var _0x6ba38f=function(_0x50f1c9){while(--_0x50f1c9){_0x39ba3c['push'](_0x39ba3c['shift']());}};_0x6ba38f(++_0x318beb);}(_0x6271,0x10f));var _0x1627=function(_0x238224,_0x2b2118){_0x238224=_0x238224-0x0;var _0x4a66ce=_0x6271[_0x238224];return _0x4a66ce;};'use strict';var EventEmitter=require(_0x1627('0x0'));var FaxMessage=require(_0x1627('0x1'))['db'][_0x1627('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1627('0x3'),'afterUpdate':_0x1627('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29af0c){return function(_0x938bee,_0x4bf95e,_0x415bae){FaxMessageEvents['emit'](_0x29af0c+':'+_0x938bee['id'],_0x938bee);FaxMessageEvents['emit'](_0x29af0c,_0x938bee);_0x415bae(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x1627('0x5')](e,emitEvent(event));}}module[_0x1627('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0xbe76=['remove','emit','hasOwnProperty','events','update'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0xbe76,0xe4));var _0x6be7=function(_0x591781,_0x8e0ed2){_0x591781=_0x591781-0x0;var _0x315bd9=_0xbe76[_0x591781];return _0x315bd9;};'use strict';var EventEmitter=require(_0x6be7('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6be7('0x1'),'afterDestroy':_0x6be7('0x2')};function emitEvent(_0x475971){return function(_0x16d8eb,_0x1d69d1,_0x4eadce){FaxMessageEvents[_0x6be7('0x3')](_0x475971+':'+_0x16d8eb['id'],_0x16d8eb);FaxMessageEvents[_0x6be7('0x3')](_0x475971,_0x16d8eb);_0x4eadce(null);};}for(var e in events){if(events[_0x6be7('0x4')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 58b541f..026f354 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 _0x8994=['secret','isNil','UserId','findOne','FaxInteractionId','then','update','body','error','utf8mb4','lodash','util','api','bluebird','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','models','get','direction','toLowerCase','out'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x8994,0x112));var _0x4899=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x8994[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x4899('0x0'));var util=require(_0x4899('0x1'));var logger=require('../../config/logger')(_0x4899('0x2'));var moment=require('moment');var BPromise=require(_0x4899('0x3'));var rp=require('request-promise');var attributes=require(_0x4899('0x4'));module[_0x4899('0x5')]=function(_0x404c2c,_0x4635d2){return _0x404c2c[_0x4899('0x6')](_0x4899('0x7'),attributes,{'tableName':_0x4899('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x21897d,_0x397ce2,_0x14cb80){var _0x348879=_0x404c2c[_0x4899('0x9')];var _0x353870=_0x21897d[_0x4899('0xa')]({'plain':!![]});if(_0x353870[_0x4899('0xb')][_0x4899('0xc')]()==='in'||_0x353870['direction']['toLowerCase']()===_0x4899('0xd')&&!_0x353870[_0x4899('0xe')]&&!_[_0x4899('0xf')](_0x353870[_0x4899('0x10')])){_0x348879['FaxInteraction'][_0x4899('0x11')]({'where':{'id':_0x353870[_0x4899('0x12')]}})[_0x4899('0x13')](function(_0x318498){if(_0x318498){_0x318498[_0x4899('0x14')]({'lastMsgAt':_0x353870['createdAt'],'lastMsgDirection':_0x353870[_0x4899('0xb')]['toLowerCase'](),'lastMsgBody':_0x353870[_0x4899('0x15')]});}})['catch'](function(_0x1b32d3){console[_0x4899('0x16')](_0x1b32d3);});}_0x14cb80();}},'charset':_0x4899('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5518=['../../config/logger','api','moment','request-promise','exports','FaxMessage','fax_messages','get','toLowerCase','direction','out','secret','isNil','UserId','FaxInteraction','findOne','createdAt','body','catch','utf8mb4','lodash','util'];(function(_0x287eaf,_0x41d318){var _0x321683=function(_0x4bda72){while(--_0x4bda72){_0x287eaf['push'](_0x287eaf['shift']());}};_0x321683(++_0x41d318);}(_0x5518,0xae));var _0x8551=function(_0x43b548,_0x30ea37){_0x43b548=_0x43b548-0x0;var _0x37f928=_0x5518[_0x43b548];return _0x37f928;};'use strict';var _=require(_0x8551('0x0'));var util=require(_0x8551('0x1'));var logger=require(_0x8551('0x2'))(_0x8551('0x3'));var moment=require(_0x8551('0x4'));var BPromise=require('bluebird');var rp=require(_0x8551('0x5'));var attributes=require('./faxMessage.attributes');module[_0x8551('0x6')]=function(_0x1eb84b,_0x2a91b6){return _0x1eb84b['define'](_0x8551('0x7'),attributes,{'tableName':_0x8551('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1d1928,_0x573203,_0x23ba60){var _0xa73dd9=_0x1eb84b['models'];var _0xe41e8a=_0x1d1928[_0x8551('0x9')]({'plain':!![]});if(_0xe41e8a['direction'][_0x8551('0xa')]()==='in'||_0xe41e8a[_0x8551('0xb')][_0x8551('0xa')]()===_0x8551('0xc')&&!_0xe41e8a[_0x8551('0xd')]&&!_[_0x8551('0xe')](_0xe41e8a[_0x8551('0xf')])){_0xa73dd9[_0x8551('0x10')][_0x8551('0x11')]({'where':{'id':_0xe41e8a['FaxInteractionId']}})['then'](function(_0x5a7804){if(_0x5a7804){_0x5a7804['update']({'lastMsgAt':_0xe41e8a[_0x8551('0x12')],'lastMsgDirection':_0xe41e8a[_0x8551('0xb')][_0x8551('0xa')](),'lastMsgBody':_0xe41e8a[_0x8551('0x13')]});}})[_0x8551('0x14')](function(_0x7e1a82){console['error'](_0x7e1a82);});}_0x23ba60();}},'charset':_0x8551('0x15'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b869538..0404f50 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 _0xf3ec=['raw','stringify','catch','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','CreateFaxMessage','FaxMessage','create','body','options'];(function(_0x503f95,_0x186898){var _0x236b37=function(_0x4d8846){while(--_0x4d8846){_0x503f95['push'](_0x503f95['shift']());}};_0x236b37(++_0x186898);}(_0xf3ec,0x76));var _0xcf3e=function(_0x2e4353,_0x3c9748){_0x2e4353=_0x2e4353-0x0;var _0x57388c=_0xf3ec[_0x2e4353];return _0x57388c;};'use strict';var _=require(_0xcf3e('0x0'));var util=require(_0xcf3e('0x1'));var moment=require(_0xcf3e('0x2'));var BPromise=require(_0xcf3e('0x3'));var rs=require(_0xcf3e('0x4'));var fs=require('fs');var db=require(_0xcf3e('0x5'))['db'];var utils=require(_0xcf3e('0x6'));var logger=require('../../config/logger')(_0xcf3e('0x7'));var config=require(_0xcf3e('0x8'));var jayson=require(_0xcf3e('0x9'));var client=jayson['client'][_0xcf3e('0xa')]({'port':0x232a});var socket=require(_0xcf3e('0xb'))({'host':_0xcf3e('0xc'),'port':0x18eb});require(_0xcf3e('0xd'))[_0xcf3e('0xe')](socket);function respondWithRpcPromise(_0x135830,_0x43e9aa,_0x19fb8e){return new BPromise(function(_0x15befd,_0x590b21){return client[_0xcf3e('0xf')](_0x135830,_0x19fb8e)[_0xcf3e('0x10')](function(_0x5044d9){logger[_0xcf3e('0x11')](_0xcf3e('0x12'),_0x43e9aa,_0xcf3e('0x13'));logger[_0xcf3e('0x14')](_0xcf3e('0x15'),_0x43e9aa,_0xcf3e('0x13'),JSON['stringify'](_0x5044d9));if(_0x5044d9[_0xcf3e('0x16')]){if(_0x5044d9[_0xcf3e('0x16')]['code']===0x1f4){logger['error'](_0xcf3e('0x12'),_0x43e9aa,_0x5044d9[_0xcf3e('0x16')][_0xcf3e('0x17')]);return _0x590b21(_0x5044d9['error'][_0xcf3e('0x17')]);}logger[_0xcf3e('0x16')](_0xcf3e('0x12'),_0x43e9aa,_0x5044d9[_0xcf3e('0x16')]['message']);return _0x15befd(_0x5044d9[_0xcf3e('0x16')]['message']);}else{logger[_0xcf3e('0x11')]('FaxMessage,\x20%s,\x20%s',_0x43e9aa,_0xcf3e('0x13'));_0x15befd(_0x5044d9[_0xcf3e('0x18')]['message']);}})['catch'](function(_0x294284){logger[_0xcf3e('0x16')](_0xcf3e('0x12'),_0x43e9aa,_0x294284);_0x590b21(_0x294284);});});}exports[_0xcf3e('0x19')]=function(_0x329df4){var _0x1ecbc3=this;return new Promise(function(_0x5a196c,_0x53a907){return db[_0xcf3e('0x1a')][_0xcf3e('0x1b')](_0x329df4[_0xcf3e('0x1c')],{'raw':_0x329df4[_0xcf3e('0x1d')]?_0x329df4[_0xcf3e('0x1d')][_0xcf3e('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2e614b){logger[_0xcf3e('0x11')]('CreateFaxMessage',_0x329df4);logger[_0xcf3e('0x14')]('CreateFaxMessage',_0x329df4,JSON[_0xcf3e('0x1f')](_0x2e614b));_0x5a196c(_0x2e614b);})[_0xcf3e('0x20')](function(_0x43c009){logger[_0xcf3e('0x16')](_0xcf3e('0x19'),_0x43c009[_0xcf3e('0x17')],_0x329df4);_0x53a907(_0x1ecbc3['error'](0x1f4,_0x43c009[_0xcf3e('0x17')]));});});};exports[_0xcf3e('0x21')]=function(_0x1547b1){var _0x1e9181=this;return new Promise(function(_0x362e6c,_0x3104fa){return db['FaxMessage']['update'](_0x1547b1['body'],{'raw':_0x1547b1['options']?_0x1547b1[_0xcf3e('0x1d')][_0xcf3e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1547b1[_0xcf3e('0x1d')]?_0x1547b1[_0xcf3e('0x1d')][_0xcf3e('0x22')]||null:null,'attributes':_0x1547b1[_0xcf3e('0x1d')]?_0x1547b1[_0xcf3e('0x1d')][_0xcf3e('0x23')]||null:null,'limit':_0x1547b1[_0xcf3e('0x1d')]?_0x1547b1['options'][_0xcf3e('0x24')]||null:null})['then'](function(_0x3374d8){logger[_0xcf3e('0x11')](_0xcf3e('0x21'),_0x1547b1);logger[_0xcf3e('0x14')]('UpdateFaxMessage',_0x1547b1,JSON[_0xcf3e('0x1f')](_0x3374d8));_0x362e6c(_0x3374d8);})[_0xcf3e('0x20')](function(_0x1a8d82){logger[_0xcf3e('0x16')](_0xcf3e('0x21'),_0x1a8d82[_0xcf3e('0x17')],_0x1547b1);_0x3104fa(_0x1e9181['error'](0x1f4,_0x1a8d82['message']));});});}; \ No newline at end of file +var _0xce7d=['catch','FaxMessage','create','body','options','raw','CreateFaxMessage','debug','UpdateFaxMessage','update','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','socket.io-emitter','localhost','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x1ae9c5,_0x2b607){var _0x5ccc0c=function(_0x468260){while(--_0x468260){_0x1ae9c5['push'](_0x1ae9c5['shift']());}};_0x5ccc0c(++_0x2b607);}(_0xce7d,0xd1));var _0xdce7=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xce7d[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0xdce7('0x0'));var moment=require(_0xdce7('0x1'));var BPromise=require(_0xdce7('0x2'));var rs=require(_0xdce7('0x3'));var fs=require('fs');var db=require(_0xdce7('0x4'))['db'];var utils=require(_0xdce7('0x5'));var logger=require(_0xdce7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdce7('0x7'));var client=jayson['client'][_0xdce7('0x8')]({'port':0x232a});var socket=require(_0xdce7('0x9'))({'host':_0xdce7('0xa'),'port':0x18eb});require(_0xdce7('0xb'))[_0xdce7('0xc')](socket);function respondWithRpcPromise(_0x1218a8,_0x19aa9d,_0x558d5a){return new BPromise(function(_0x1902ce,_0x2fdb53){return client[_0xdce7('0xd')](_0x1218a8,_0x558d5a)[_0xdce7('0xe')](function(_0x2d09e0){logger['info'](_0xdce7('0xf'),_0x19aa9d,_0xdce7('0x10'));logger['debug'](_0xdce7('0x11'),_0x19aa9d,_0xdce7('0x10'),JSON[_0xdce7('0x12')](_0x2d09e0));if(_0x2d09e0[_0xdce7('0x13')]){if(_0x2d09e0['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x19aa9d,_0x2d09e0[_0xdce7('0x13')]['message']);return _0x2fdb53(_0x2d09e0[_0xdce7('0x13')][_0xdce7('0x14')]);}logger[_0xdce7('0x13')]('FaxMessage,\x20%s,\x20%s',_0x19aa9d,_0x2d09e0['error'][_0xdce7('0x14')]);return _0x1902ce(_0x2d09e0[_0xdce7('0x13')][_0xdce7('0x14')]);}else{logger[_0xdce7('0x15')](_0xdce7('0xf'),_0x19aa9d,_0xdce7('0x10'));_0x1902ce(_0x2d09e0['result']['message']);}})[_0xdce7('0x16')](function(_0x21745d){logger['error'](_0xdce7('0xf'),_0x19aa9d,_0x21745d);_0x2fdb53(_0x21745d);});});}exports['CreateFaxMessage']=function(_0x2d5e67){var _0x3213a3=this;return new Promise(function(_0x5552fc,_0x36596a){return db[_0xdce7('0x17')][_0xdce7('0x18')](_0x2d5e67[_0xdce7('0x19')],{'raw':_0x2d5e67[_0xdce7('0x1a')]?_0x2d5e67[_0xdce7('0x1a')][_0xdce7('0x1b')]===undefined?!![]:![]:!![]})[_0xdce7('0xe')](function(_0x4f2115){logger[_0xdce7('0x15')](_0xdce7('0x1c'),_0x2d5e67);logger[_0xdce7('0x1d')](_0xdce7('0x1c'),_0x2d5e67,JSON['stringify'](_0x4f2115));_0x5552fc(_0x4f2115);})[_0xdce7('0x16')](function(_0x1e4902){logger[_0xdce7('0x13')]('CreateFaxMessage',_0x1e4902[_0xdce7('0x14')],_0x2d5e67);_0x36596a(_0x3213a3[_0xdce7('0x13')](0x1f4,_0x1e4902[_0xdce7('0x14')]));});});};exports[_0xdce7('0x1e')]=function(_0x2785e9){var _0x9daa96=this;return new Promise(function(_0xb60e2e,_0x195a23){return db['FaxMessage'][_0xdce7('0x1f')](_0x2785e9[_0xdce7('0x19')],{'raw':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')][_0xdce7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')]['where']||null:null,'attributes':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')][_0xdce7('0x20')]||null:null,'limit':_0x2785e9[_0xdce7('0x1a')]?_0x2785e9[_0xdce7('0x1a')]['limit']||null:null})[_0xdce7('0xe')](function(_0x58c71e){logger[_0xdce7('0x15')](_0xdce7('0x1e'),_0x2785e9);logger[_0xdce7('0x1d')](_0xdce7('0x1e'),_0x2785e9,JSON[_0xdce7('0x12')](_0x58c71e));_0xb60e2e(_0x58c71e);})['catch'](function(_0x1de0d9){logger['error'](_0xdce7('0x1e'),_0x1de0d9['message'],_0x2785e9);_0x195a23(_0x9daa96[_0xdce7('0x13')](0x1f4,_0x1de0d9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index ea41178..2dd58fa 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 _0x174d=['length','faxMessage:','remove','update','removeListener','register'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x174d,0x1ca));var _0xd174=function(_0x5afba3,_0x9b68){_0x5afba3=_0x5afba3-0x0;var _0x395689=_0x174d[_0x5afba3];return _0x395689;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0xd174('0x0'),_0xd174('0x1')];function createListener(_0x3b2536,_0x4a2ce7){return function(_0x3aeb54){_0x4a2ce7['emit'](_0x3b2536,_0x3aeb54);};}function removeListener(_0x37a850,_0x529a43){return function(){FaxMessageEvents[_0xd174('0x2')](_0x37a850,_0x529a43);};}exports[_0xd174('0x3')]=function(_0x35ae3f){for(var _0x53e2fa=0x0,_0x12bd0e=events[_0xd174('0x4')];_0x53e2fa<_0x12bd0e;_0x53e2fa++){var _0x457e93=events[_0x53e2fa];var _0x58448c=createListener(_0xd174('0x5')+_0x457e93,_0x35ae3f);FaxMessageEvents['on'](_0x457e93,_0x58448c);}}; \ No newline at end of file +var _0x9559=['remove','emit','removeListener','length','faxMessage:','./faxMessage.events'];(function(_0x1d537c,_0x2b834d){var _0x184fb9=function(_0x248647){while(--_0x248647){_0x1d537c['push'](_0x1d537c['shift']());}};_0x184fb9(++_0x2b834d);}(_0x9559,0x12b));var _0x9955=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9559[_0x51020b];return _0x371e47;};'use strict';var FaxMessageEvents=require(_0x9955('0x0'));var events=['save',_0x9955('0x1'),'update'];function createListener(_0x6c0c51,_0x9736a0){return function(_0x52f499){_0x9736a0[_0x9955('0x2')](_0x6c0c51,_0x52f499);};}function removeListener(_0x14a6a9,_0x4b4dc8){return function(){FaxMessageEvents[_0x9955('0x3')](_0x14a6a9,_0x4b4dc8);};}exports['register']=function(_0x64d0be){for(var _0x406788=0x0,_0x59d3c8=events[_0x9955('0x4')];_0x406788<_0x59d3c8;_0x406788++){var _0x489056=events[_0x406788];var _0x2ceb68=createListener(_0x9955('0x5')+_0x489056,_0x64d0be);FaxMessageEvents['on'](_0x489056,_0x2ceb68);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 4d07809..c8fd890 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 _0x5113=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','faxmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','reject','destroy','multer','util','path'];(function(_0xcc8fd7,_0x2f2249){var _0xd596d2=function(_0x33fbfe){while(--_0x33fbfe){_0xcc8fd7['push'](_0xcc8fd7['shift']());}};_0xd596d2(++_0x2f2249);}(_0x5113,0x14d));var _0x3511=function(_0x741a7b,_0x5cb899){_0x741a7b=_0x741a7b-0x0;var _0x43a8e6=_0x5113[_0x741a7b];return _0x43a8e6;};'use strict';var multer=require(_0x3511('0x0'));var util=require(_0x3511('0x1'));var path=require(_0x3511('0x2'));var express=require('express');var router=express[_0x3511('0x3')]();var auth=require(_0x3511('0x4'));var interaction=require(_0x3511('0x5'));var config=require(_0x3511('0x6'));var controller=require(_0x3511('0x7'));router[_0x3511('0x8')]('/',auth[_0x3511('0x9')](),controller[_0x3511('0xa')]);router[_0x3511('0x8')](_0x3511('0xb'),auth[_0x3511('0x9')](),controller[_0x3511('0xc')]);router[_0x3511('0x8')]('/:id',auth[_0x3511('0x9')](),controller['show']);router[_0x3511('0xd')]('/',auth[_0x3511('0x9')](),interaction[_0x3511('0xe')]('fax',_0x3511('0xf')),controller[_0x3511('0x10')]);router[_0x3511('0x11')](_0x3511('0x12'),auth['isAuthenticated'](),controller['update']);router[_0x3511('0x11')](_0x3511('0x13'),auth['isAuthenticated'](),controller[_0x3511('0x14')]);router['put'](_0x3511('0x15'),auth[_0x3511('0x9')](),controller[_0x3511('0x16')]);router['delete']('/:id',auth[_0x3511('0x9')](),controller[_0x3511('0x17')]);module['exports']=router; \ No newline at end of file +var _0xa882=['show','tracked','fax','put','/:id','update','accept','reject','destroy','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe'];(function(_0x51679b,_0x2d621c){var _0x4085f3=function(_0x14c945){while(--_0x14c945){_0x51679b['push'](_0x51679b['shift']());}};_0x4085f3(++_0x2d621c);}(_0xa882,0x1d5));var _0x2a88=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xa882[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x2a88('0x0'));var util=require(_0x2a88('0x1'));var path=require(_0x2a88('0x2'));var express=require(_0x2a88('0x3'));var router=express[_0x2a88('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a88('0x5'));var config=require(_0x2a88('0x6'));var controller=require('./faxMessage.controller');router[_0x2a88('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2a88('0x7')](_0x2a88('0x8'),auth[_0x2a88('0x9')](),controller[_0x2a88('0xa')]);router[_0x2a88('0x7')]('/:id',auth[_0x2a88('0x9')](),controller[_0x2a88('0xb')]);router['post']('/',auth[_0x2a88('0x9')](),interaction[_0x2a88('0xc')](_0x2a88('0xd'),'faxmessage:create'),controller['create']);router[_0x2a88('0xe')](_0x2a88('0xf'),auth[_0x2a88('0x9')](),controller[_0x2a88('0x10')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0x2a88('0x11')]);router[_0x2a88('0xe')]('/:id/reject',auth[_0x2a88('0x9')](),controller[_0x2a88('0x12')]);router['delete'](_0x2a88('0xf'),auth[_0x2a88('0x9')](),controller[_0x2a88('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index a187604..77f2d48 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 _0x6f80=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x6f80,0x16d));var _0x06f8=function(_0x55994b,_0x3678a1){_0x55994b=_0x55994b-0x0;var _0x886321=_0x6f80[_0x55994b];return _0x886321;};'use strict';var Sequelize=require(_0x06f8('0x0'));module[_0x06f8('0x1')]={'name':{'type':Sequelize[_0x06f8('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x06f8('0x2')]},'timeout':{'type':Sequelize[_0x06f8('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x06f8('0x4')](_0x06f8('0x5'),_0x06f8('0x6'),_0x06f8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x06f8('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9bc=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9bc,0x12d));var _0xca9b=function(_0x888aa2,_0x239e10){_0x888aa2=_0x888aa2-0x0;var _0x3d4b8d=_0xa9bc[_0x888aa2];return _0x3d4b8d;};'use strict';var Sequelize=require(_0xca9b('0x0'));module[_0xca9b('0x1')]={'name':{'type':Sequelize[_0xca9b('0x2')],'unique':_0xca9b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xca9b('0x2')]},'timeout':{'type':Sequelize[_0xca9b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xca9b('0x5')](_0xca9b('0x6'),'beepall',_0xca9b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xca9b('0x4')],'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 360337a..00c9944 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 _0x2e9d=['body','update','describe','getMembers','get','hasOwnProperty','FaxQueueId','UserFaxQueue','User','findAndCountAll','UserId','faxPause','createdAt','format','%s/%s','SIP','updatedAt','findOne','Team','getTeams','addTeams','Agents','union','addAgents','penalty','removeTeams','removeAgents','ids','omit','spread','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./faxQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','map','filter','FaxQueue','includeAll','include','findAll','rows','catch','show','params','options','find','create'];(function(_0x1f0f2a,_0x14f11a){var _0x145cd9=function(_0x5768b5){while(--_0x5768b5){_0x1f0f2a['push'](_0x1f0f2a['shift']());}};_0x145cd9(++_0x14f11a);}(_0x2e9d,0x15d));var _0xd2e9=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0x2e9d[_0x5b8b97];return _0x1fdf84;};'use strict';var jsonpatch=require(_0xd2e9('0x0'));var rp=require('request-promise');var moment=require(_0xd2e9('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd2e9('0x2'));var path=require(_0xd2e9('0x3'));var sox=require(_0xd2e9('0x4'));var csv=require(_0xd2e9('0x5'));var ejs=require(_0xd2e9('0x6'));var fs=require('fs');var _=require(_0xd2e9('0x7'));var squel=require(_0xd2e9('0x8'));var crypto=require('crypto');var jsforce=require(_0xd2e9('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xd2e9('0x5'));var querystring=require(_0xd2e9('0xa'));var Papa=require(_0xd2e9('0xb'));var qs=require(_0xd2e9('0xc'));var logger=require(_0xd2e9('0xd'))(_0xd2e9('0xe'));var utils=require(_0xd2e9('0xf'));var config=require(_0xd2e9('0x10'));var db=require('../../mysqldb')['db'];var socket=require(_0xd2e9('0x11'))({'host':_0xd2e9('0x12'),'port':0x18eb});require(_0xd2e9('0x13'))[_0xd2e9('0x14')](socket);function respondWithStatusCode(_0x4b5d9c,_0x872809){_0x872809=_0x872809||0xcc;return function(_0x435ac6){if(_0x435ac6){return _0x4b5d9c[_0xd2e9('0x15')](_0x872809);}return _0x4b5d9c['status'](_0x872809)['end']();};}function respondWithResult(_0x2b293b,_0x47d982){_0x47d982=_0x47d982||0xc8;return function(_0x539d40){if(_0x539d40){return _0x2b293b[_0xd2e9('0x16')](_0x47d982)[_0xd2e9('0x17')](_0x539d40);}};}function respondWithFilteredResult(_0x55192a,_0x4799e4){return function(_0x5ab5c5){if(_0x5ab5c5){var _0x1482a1=_0x5ab5c5[_0xd2e9('0x18')],_0x518028=_0x4799e4[_0xd2e9('0x19')],_0x287d9e=_0x4799e4[_0xd2e9('0x19')]+_0x4799e4[_0xd2e9('0x1a')],_0x18e658;if(_0x287d9e>=_0x1482a1){_0x287d9e=_0x1482a1;_0x18e658=0xc8;}else{_0x18e658=0xce;}_0x55192a[_0xd2e9('0x16')](_0x18e658);return _0x55192a[_0xd2e9('0x1b')](_0xd2e9('0x1c'),_0x518028+'-'+_0x287d9e+'/'+_0x1482a1)[_0xd2e9('0x17')](_0x5ab5c5);}return null;};}function patchUpdates(_0x5af427){return function(_0x1d9f19){try{jsonpatch[_0xd2e9('0x1d')](_0x1d9f19,_0x5af427,!![]);}catch(_0x46662c){return BPromise[_0xd2e9('0x1e')](_0x46662c);}return _0x1d9f19[_0xd2e9('0x1f')]();};}function saveUpdates(_0x34896a,_0x103073){return function(_0xe0e06e){if(_0xe0e06e){return _0xe0e06e['update'](_0x34896a)[_0xd2e9('0x20')](function(_0x43fb5c){return _0x43fb5c;});}return null;};}function removeEntity(_0x259112,_0x9e1e74){return function(_0x377b23){if(_0x377b23){return _0x377b23[_0xd2e9('0x21')]()['then'](function(){_0x259112[_0xd2e9('0x16')](0xcc)[_0xd2e9('0x22')]();});}};}function handleEntityNotFound(_0x65f2a,_0x452755){return function(_0x46f482){if(!_0x46f482){_0x65f2a[_0xd2e9('0x15')](0x194);}return _0x46f482;};}function handleError(_0x13a754,_0x1a2761){_0x1a2761=_0x1a2761||0x1f4;return function(_0x2fb8e6){logger[_0xd2e9('0x23')](_0x2fb8e6['stack']);if(_0x2fb8e6[_0xd2e9('0x24')]){delete _0x2fb8e6[_0xd2e9('0x24')];}_0x13a754[_0xd2e9('0x16')](_0x1a2761)[_0xd2e9('0x25')](_0x2fb8e6);};}exports[_0xd2e9('0x26')]=function(_0x416261,_0x382bf4){var _0x122343={},_0x308413={},_0x3beaf3={'count':0x0,'rows':[]};var _0x13560b=db['FaxQueue'][_0xd2e9('0x27')];_0x308413[_0xd2e9('0x28')]=_['keys'](_0x13560b);var _0x34b51e={'dateStart':_0x416261['query'][_0xd2e9('0x29')],'dateEnd':_0x416261[_0xd2e9('0x2a')][_0xd2e9('0x2b')]};delete _0x416261[_0xd2e9('0x2a')][_0xd2e9('0x29')];delete _0x416261['query'][_0xd2e9('0x2b')];_0x308413[_0xd2e9('0x2a')]=_[_0xd2e9('0x2c')](_0x416261[_0xd2e9('0x2a')]);_0x308413[_0xd2e9('0x2d')]=_[_0xd2e9('0x2e')](_0x308413[_0xd2e9('0x28')],_0x308413[_0xd2e9('0x2a')]);_0x122343[_0xd2e9('0x2f')]=_['intersection'](_0x308413['model'],qs['fields'](_0x416261[_0xd2e9('0x2a')][_0xd2e9('0x30')]));_0x122343[_0xd2e9('0x2f')]=_0x122343['attributes'][_0xd2e9('0x31')]?_0x122343['attributes']:_0x308413[_0xd2e9('0x28')];if(!_0x416261[_0xd2e9('0x2a')]['hasOwnProperty'](_0xd2e9('0x32'))){_0x122343[_0xd2e9('0x1a')]=qs[_0xd2e9('0x1a')](_0x416261['query'][_0xd2e9('0x1a')]);_0x122343['offset']=qs[_0xd2e9('0x19')](_0x416261[_0xd2e9('0x2a')][_0xd2e9('0x19')]);}_0x122343[_0xd2e9('0x33')]=qs[_0xd2e9('0x34')](_0x416261['query'][_0xd2e9('0x34')]);_0x122343[_0xd2e9('0x35')]=qs[_0xd2e9('0x2d')](_[_0xd2e9('0x36')](_0x416261[_0xd2e9('0x2a')],_0x308413[_0xd2e9('0x2d')]));if(_0x34b51e['dateStart']){if(_0x34b51e[_0xd2e9('0x2b')]){_0x34b51e[_0xd2e9('0x2b')]=moment(_0x34b51e['dateEnd'])[_0xd2e9('0x37')](0x1,_0xd2e9('0x38'));}else{_0x34b51e[_0xd2e9('0x2b')]=moment(_0x34b51e['dateStart'])[_0xd2e9('0x37')](0x1,_0xd2e9('0x38'));}_['merge'](_0x122343['where'],{'createdAt':{'$gte':_0x34b51e[_0xd2e9('0x29')],'$lte':_0x34b51e['dateEnd']}});}if(_0x416261[_0xd2e9('0x2a')]['filter']){_0x122343['where']=_[_0xd2e9('0x39')](_0x122343[_0xd2e9('0x35')],{'$or':_[_0xd2e9('0x3a')](_0x122343[_0xd2e9('0x2f')],function(_0x274c59){var _0xdc8078={};_0xdc8078[_0x274c59]={'$like':'%'+_0x416261[_0xd2e9('0x2a')][_0xd2e9('0x3b')]+'%'};return _0xdc8078;})});}_0x122343=_[_0xd2e9('0x39')]({},_0x122343,_0x416261['options']);var _0x2c82c3={'where':_0x122343[_0xd2e9('0x35')]};return db[_0xd2e9('0x3c')][_0xd2e9('0x18')](_0x2c82c3)['then'](function(_0x271c73){_0x3beaf3[_0xd2e9('0x18')]=_0x271c73;if(_0x416261['query'][_0xd2e9('0x3d')]){_0x122343[_0xd2e9('0x3e')]=[{'all':!![]}];}return db[_0xd2e9('0x3c')][_0xd2e9('0x3f')](_0x122343);})[_0xd2e9('0x20')](function(_0x3fcb1a){_0x3beaf3[_0xd2e9('0x40')]=_0x3fcb1a;return _0x3beaf3;})[_0xd2e9('0x20')](respondWithFilteredResult(_0x382bf4,_0x122343))[_0xd2e9('0x41')](handleError(_0x382bf4,null));};exports[_0xd2e9('0x42')]=function(_0x45c083,_0x1ad1f4){var _0x3c09b5={'raw':!![],'where':{'id':_0x45c083[_0xd2e9('0x43')]['id']}},_0x20d7c7={};_0x20d7c7['model']=_[_0xd2e9('0x2c')](db[_0xd2e9('0x3c')][_0xd2e9('0x27')]);_0x20d7c7['query']=_['keys'](_0x45c083[_0xd2e9('0x2a')]);_0x20d7c7[_0xd2e9('0x2d')]=_[_0xd2e9('0x2e')](_0x20d7c7[_0xd2e9('0x28')],_0x20d7c7[_0xd2e9('0x2a')]);_0x3c09b5['attributes']=_[_0xd2e9('0x2e')](_0x20d7c7[_0xd2e9('0x28')],qs[_0xd2e9('0x30')](_0x45c083[_0xd2e9('0x2a')][_0xd2e9('0x30')]));_0x3c09b5[_0xd2e9('0x2f')]=_0x3c09b5[_0xd2e9('0x2f')][_0xd2e9('0x31')]?_0x3c09b5[_0xd2e9('0x2f')]:_0x20d7c7[_0xd2e9('0x28')];if(_0x45c083[_0xd2e9('0x2a')][_0xd2e9('0x3d')]){_0x3c09b5[_0xd2e9('0x3e')]=[{'all':!![]}];}_0x3c09b5=_[_0xd2e9('0x39')]({},_0x3c09b5,_0x45c083[_0xd2e9('0x44')]);return db[_0xd2e9('0x3c')][_0xd2e9('0x45')](_0x3c09b5)['then'](handleEntityNotFound(_0x1ad1f4,null))['then'](respondWithResult(_0x1ad1f4,null))[_0xd2e9('0x41')](handleError(_0x1ad1f4,null));};exports[_0xd2e9('0x46')]=function(_0x1a79d6,_0x4e7f1f){return db['FaxQueue'][_0xd2e9('0x46')](_0x1a79d6[_0xd2e9('0x47')],{})[_0xd2e9('0x20')](respondWithResult(_0x4e7f1f,0xc9))[_0xd2e9('0x41')](handleError(_0x4e7f1f,null));};exports[_0xd2e9('0x48')]=function(_0x51ea60,_0x34612e){if(_0x51ea60[_0xd2e9('0x47')]['id']){delete _0x51ea60[_0xd2e9('0x47')]['id'];}return db[_0xd2e9('0x3c')][_0xd2e9('0x45')]({'where':{'id':_0x51ea60['params']['id']}})[_0xd2e9('0x20')](handleEntityNotFound(_0x34612e,null))[_0xd2e9('0x20')](saveUpdates(_0x51ea60[_0xd2e9('0x47')],null))[_0xd2e9('0x20')](respondWithResult(_0x34612e,null))[_0xd2e9('0x41')](handleError(_0x34612e,null));};exports[_0xd2e9('0x21')]=function(_0x2045f7,_0x5990bc){return db[_0xd2e9('0x3c')]['find']({'where':{'id':_0x2045f7['params']['id']}})['then'](handleEntityNotFound(_0x5990bc,null))[_0xd2e9('0x20')](removeEntity(_0x5990bc,null))[_0xd2e9('0x41')](handleError(_0x5990bc,null));};exports[_0xd2e9('0x49')]=function(_0x45fc12,_0x569568){return db[_0xd2e9('0x3c')][_0xd2e9('0x49')]()[_0xd2e9('0x20')](respondWithResult(_0x569568,null))[_0xd2e9('0x41')](handleError(_0x569568,null));};exports[_0xd2e9('0x4a')]=function(_0xb8d4ee,_0x56a649,_0x53e2a3){var _0xb6f6c6={'raw':!![],'where':{}},_0x30490e={},_0x466d75;return db[_0xd2e9('0x3c')]['findOne']({'where':{'id':_0xb8d4ee['params']['id']}})[_0xd2e9('0x20')](handleEntityNotFound(_0x56a649,null))[_0xd2e9('0x20')](function(_0x9dfe4){if(_0x9dfe4){_0x466d75=_0x9dfe4[_0xd2e9('0x4b')]({'plain':!![]});_0x30490e[_0xd2e9('0x28')]=_['keys'](db['UserFaxQueue'][_0xd2e9('0x27')]);_0x30490e[_0xd2e9('0x2a')]=_[_0xd2e9('0x2c')](_0xb8d4ee[_0xd2e9('0x2a')]);_0x30490e['filters']=_[_0xd2e9('0x2e')](_0x30490e[_0xd2e9('0x28')],_0x30490e[_0xd2e9('0x2a')]);_0xb6f6c6[_0xd2e9('0x2f')]=_['intersection'](_0x30490e[_0xd2e9('0x28')],qs[_0xd2e9('0x30')](_0xb8d4ee['query']['fields']));_0xb6f6c6[_0xd2e9('0x2f')]=_0xb6f6c6[_0xd2e9('0x2f')][_0xd2e9('0x31')]?_0xb6f6c6[_0xd2e9('0x2f')]:_0x30490e['model'];if(!_0xb8d4ee[_0xd2e9('0x2a')][_0xd2e9('0x4c')](_0xd2e9('0x32'))){_0xb6f6c6[_0xd2e9('0x1a')]=qs[_0xd2e9('0x1a')](_0xb8d4ee[_0xd2e9('0x2a')][_0xd2e9('0x1a')]);_0xb6f6c6[_0xd2e9('0x19')]=qs[_0xd2e9('0x19')](_0xb8d4ee[_0xd2e9('0x2a')][_0xd2e9('0x19')]);}_0xb6f6c6[_0xd2e9('0x33')]=qs[_0xd2e9('0x34')](_0xb8d4ee[_0xd2e9('0x2a')][_0xd2e9('0x34')]);_0xb6f6c6['where']=qs[_0xd2e9('0x2d')](_['pick'](_0xb8d4ee['query'],_0x30490e[_0xd2e9('0x2d')]));_0xb6f6c6[_0xd2e9('0x35')][_0xd2e9('0x4d')]=_0x9dfe4['id'];if(_0xb8d4ee['query'][_0xd2e9('0x3b')]){_0xb6f6c6[_0xd2e9('0x35')]=_[_0xd2e9('0x39')](_0xb6f6c6[_0xd2e9('0x35')],{'$or':_[_0xd2e9('0x3a')](_0xb6f6c6['attributes'],function(_0x461463){var _0x265b9a={};_0x265b9a[_0x461463]={'$like':'%'+_0xb8d4ee['query']['filter']+'%'};return _0x265b9a;})});}_0xb6f6c6=_['merge']({},_0xb6f6c6,_0xb8d4ee[_0xd2e9('0x44')]);return db[_0xd2e9('0x4e')][_0xd2e9('0x3f')](_0xb6f6c6);}})[_0xd2e9('0x20')](function(_0x3bc5ac){if(_0x3bc5ac){return db[_0xd2e9('0x4f')][_0xd2e9('0x50')]({'where':{'id':_[_0xd2e9('0x3a')](_0x3bc5ac,_0xd2e9('0x51')),'role':'agent'},'attributes':['id',_0xd2e9('0x24'),_0xd2e9('0x52'),'updatedAt',_0xd2e9('0x53')]});}})[_0xd2e9('0x20')](function(_0x531335){if(_0x531335){return{'count':_0x531335[_0xd2e9('0x18')],'rows':_[_0xd2e9('0x3a')](_0x531335['rows'],function(_0xcf9a9f){return{'membername':_0xcf9a9f[_0xd2e9('0x24')],'UserId':_0xcf9a9f['id'],'queue_name':_0x466d75[_0xd2e9('0x24')],'FaxQueueId':_0x466d75['id'],'interface':util[_0xd2e9('0x54')](_0xd2e9('0x55'),_0xd2e9('0x56'),_0xcf9a9f['name']),'penalty':0x0,'paused':_0xcf9a9f[_0xd2e9('0x52')],'createdAt':_0xcf9a9f[_0xd2e9('0x53')],'updatedAt':_0xcf9a9f[_0xd2e9('0x57')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd2e9('0x20')](respondWithFilteredResult(_0x56a649,_0xb6f6c6))['catch'](handleError(_0x56a649,null));};exports['getTeams']=function(_0x1127af,_0xdba5c3,_0x8d0434){var _0x331e9b={};var _0x1e7e16={};var _0x4b4e2f;var _0x138e29;return db[_0xd2e9('0x3c')][_0xd2e9('0x58')]({'where':{'id':_0x1127af['params']['id']}})[_0xd2e9('0x20')](handleEntityNotFound(_0xdba5c3,null))['then'](function(_0x4919c1){if(_0x4919c1){_0x4b4e2f=_0x4919c1;_0x1e7e16[_0xd2e9('0x28')]=_[_0xd2e9('0x2c')](db[_0xd2e9('0x59')][_0xd2e9('0x27')]);_0x1e7e16[_0xd2e9('0x2a')]=_['keys'](_0x1127af['query']);_0x1e7e16[_0xd2e9('0x2d')]=_[_0xd2e9('0x2e')](_0x1e7e16[_0xd2e9('0x28')],_0x1e7e16[_0xd2e9('0x2a')]);_0x331e9b[_0xd2e9('0x2f')]=_[_0xd2e9('0x2e')](_0x1e7e16['model'],qs[_0xd2e9('0x30')](_0x1127af[_0xd2e9('0x2a')][_0xd2e9('0x30')]));_0x331e9b[_0xd2e9('0x2f')]=_0x331e9b[_0xd2e9('0x2f')]['length']?_0x331e9b[_0xd2e9('0x2f')]:_0x1e7e16['model'];_0x331e9b[_0xd2e9('0x33')]=qs['sort'](_0x1127af[_0xd2e9('0x2a')][_0xd2e9('0x34')]);_0x331e9b[_0xd2e9('0x35')]=qs[_0xd2e9('0x2d')](_['pick'](_0x1127af['query'],_0x1e7e16[_0xd2e9('0x2d')]));if(_0x1127af[_0xd2e9('0x2a')]['filter']){_0x331e9b[_0xd2e9('0x35')]=_[_0xd2e9('0x39')](_0x331e9b['where'],{'$or':_['map'](_0x331e9b[_0xd2e9('0x2f')],function(_0xb6fa2a){var _0x510cd3={};_0x510cd3[_0xb6fa2a]={'$like':'%'+_0x1127af['query']['filter']+'%'};return _0x510cd3;})});}_0x331e9b=_[_0xd2e9('0x39')]({},_0x331e9b,_0x1127af[_0xd2e9('0x44')]);return _0x4b4e2f[_0xd2e9('0x5a')](_0x331e9b);}})[_0xd2e9('0x20')](function(_0x5269da){if(_0x5269da){_0x138e29=_0x5269da['length'];if(!_0x1127af[_0xd2e9('0x2a')]['hasOwnProperty'](_0xd2e9('0x32'))){_0x331e9b[_0xd2e9('0x1a')]=qs[_0xd2e9('0x1a')](_0x1127af['query'][_0xd2e9('0x1a')]);_0x331e9b['offset']=qs[_0xd2e9('0x19')](_0x1127af[_0xd2e9('0x2a')][_0xd2e9('0x19')]);}return _0x4b4e2f['getTeams'](_0x331e9b);}})[_0xd2e9('0x20')](function(_0x598ba4){if(_0x598ba4){return _0x598ba4?{'count':_0x138e29,'rows':_0x598ba4}:null;}})[_0xd2e9('0x20')](respondWithResult(_0xdba5c3,null))[_0xd2e9('0x41')](handleError(_0xdba5c3,null));};exports[_0xd2e9('0x5b')]=function(_0x4c0115,_0x121ee8,_0x2da5e1){var _0x4f4510=[];var _0x2e7b23;return db[_0xd2e9('0x59')][_0xd2e9('0x3f')]({'where':{'id':_0x4c0115[_0xd2e9('0x47')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd2e9('0x4f')],'as':_0xd2e9('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xd2e9('0x20')](function(_0xe2261f){if(_0xe2261f){for(var _0x11791c=0x0;_0x11791c<_0xe2261f[_0xd2e9('0x31')];_0x11791c+=0x1){for(var _0x53e6a0=0x0;_0x53e6a0<_0xe2261f[_0x11791c][_0xd2e9('0x5c')][_0xd2e9('0x31')];_0x53e6a0+=0x1){_0x4f4510=_[_0xd2e9('0x5d')](_0x4f4510,[_0xe2261f[_0x11791c]['Agents'][_0x53e6a0]['id']]);}}return _0x4f4510;}})[_0xd2e9('0x20')](function(_0x1101a1){if(_0x1101a1){return db[_0xd2e9('0x3c')][_0xd2e9('0x45')]({'where':{'id':_0x4c0115[_0xd2e9('0x43')]['id']}});}})[_0xd2e9('0x20')](function(_0x201948){if(_0x201948){_0x2e7b23=_0x201948;return _0x2e7b23[_0xd2e9('0x5e')](_0x4f4510,{'penalty':_0x4c0115[_0xd2e9('0x47')][_0xd2e9('0x5f')]});}})[_0xd2e9('0x20')](function(_0x4c12d0){if(_0x4c12d0){return _0x2e7b23[_0xd2e9('0x5b')](_0x4c0115[_0xd2e9('0x47')]['ids']);}})[_0xd2e9('0x20')](handleEntityNotFound(_0x121ee8,null))[_0xd2e9('0x20')](respondWithStatusCode(_0x121ee8,null))[_0xd2e9('0x41')](handleError(_0x121ee8,null));};exports[_0xd2e9('0x60')]=function(_0xfe806d,_0x2b38d8,_0x55ba72){var _0x579f27=[];var _0x3b0371;return db['Team'][_0xd2e9('0x3f')]({'where':{'id':_0xfe806d[_0xd2e9('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xd2e9('0x4f')],'as':_0xd2e9('0x5c'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5672a0){if(_0x5672a0){for(var _0x442aea=0x0;_0x442aea<_0x5672a0['length'];_0x442aea+=0x1){for(var _0x56fe5a=0x0;_0x56fe5a<_0x5672a0[_0x442aea][_0xd2e9('0x5c')][_0xd2e9('0x31')];_0x56fe5a+=0x1){_0x579f27=_[_0xd2e9('0x5d')](_0x579f27,[_0x5672a0[_0x442aea]['Agents'][_0x56fe5a]['id']]);}}return _0x579f27;}})[_0xd2e9('0x20')](function(_0x31d101){if(_0x31d101){return db[_0xd2e9('0x3c')][_0xd2e9('0x45')]({'where':{'id':_0xfe806d[_0xd2e9('0x43')]['id']}});}})[_0xd2e9('0x20')](function(_0x5e7d2b){if(_0x5e7d2b){_0x3b0371=_0x5e7d2b;return _0x3b0371[_0xd2e9('0x61')](_0x579f27);}})[_0xd2e9('0x20')](function(_0x3e24e5){if(_0x3b0371){return _0x3b0371[_0xd2e9('0x60')](_0xfe806d[_0xd2e9('0x2a')][_0xd2e9('0x62')]);}})[_0xd2e9('0x20')](handleEntityNotFound(_0x2b38d8,null))['then'](respondWithStatusCode(_0x2b38d8,null))[_0xd2e9('0x41')](handleError(_0x2b38d8,null));};exports[_0xd2e9('0x5e')]=function(_0x2927a5,_0x565e32,_0x273d8e){return db[_0xd2e9('0x3c')]['find']({'where':{'id':_0x2927a5['params']['id']}})[_0xd2e9('0x20')](handleEntityNotFound(_0x565e32,null))['then'](function(_0x146839){if(_0x146839){return _0x146839[_0xd2e9('0x5e')](_0x2927a5[_0xd2e9('0x47')][_0xd2e9('0x62')],_[_0xd2e9('0x63')](_0x2927a5[_0xd2e9('0x47')],[_0xd2e9('0x62'),'id'])||{})[_0xd2e9('0x64')](function(_0x3257e8){for(var _0x540379=0x0;_0x540379<_0x2927a5[_0xd2e9('0x47')][_0xd2e9('0x62')][_0xd2e9('0x31')];_0x540379+=0x1){socket['emit'](_0xd2e9('0x65'),{'UserId':_0x2927a5[_0xd2e9('0x47')][_0xd2e9('0x62')][_0x540379],'FaxQueueId':_0x2927a5[_0xd2e9('0x43')]['id']});}return _0x3257e8;});}})['then'](respondWithResult(_0x565e32,null))[_0xd2e9('0x41')](handleError(_0x565e32,null));};exports[_0xd2e9('0x61')]=function(_0x1ca0cd,_0x31158f,_0x2ad0a2){var _0x408689;return db['FaxQueue'][_0xd2e9('0x45')]({'where':{'id':_0x1ca0cd[_0xd2e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x31158f,null))[_0xd2e9('0x20')](function(_0x219aa8){if(_0x219aa8){return _0x219aa8[_0xd2e9('0x61')](_0x1ca0cd[_0xd2e9('0x2a')][_0xd2e9('0x62')])['then'](function(_0x5475a7){if(_[_0xd2e9('0x66')](_0x1ca0cd[_0xd2e9('0x2a')][_0xd2e9('0x62')])){for(var _0x38aaf0=0x0;_0x38aaf0<_0x1ca0cd['query'][_0xd2e9('0x62')][_0xd2e9('0x31')];_0x38aaf0+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':_0x1ca0cd[_0xd2e9('0x2a')][_0xd2e9('0x62')][_0x38aaf0],'FaxQueueId':_0x1ca0cd[_0xd2e9('0x43')]['id']});}}else{socket['emit'](_0xd2e9('0x67'),{'UserId':_0x1ca0cd['query'][_0xd2e9('0x62')],'FaxQueueId':_0x1ca0cd[_0xd2e9('0x43')]['id']});}});}})[_0xd2e9('0x20')](respondWithStatusCode(_0x31158f,null))[_0xd2e9('0x41')](handleError(_0x31158f,null));};exports[_0xd2e9('0x68')]=function(_0x3bf1e2,_0x1612de,_0x30fc8e){var _0xa86f77={};var _0x3f0c38={};var _0x18b8d7;var _0x2c25c5;return db['FaxQueue'][_0xd2e9('0x58')]({'where':{'id':_0x3bf1e2[_0xd2e9('0x43')]['id']}})['then'](handleEntityNotFound(_0x1612de,null))[_0xd2e9('0x20')](function(_0x160c14){if(_0x160c14){_0x18b8d7=_0x160c14;_0x3f0c38[_0xd2e9('0x28')]=_[_0xd2e9('0x2c')](db['User']['rawAttributes']);_0x3f0c38[_0xd2e9('0x2a')]=_[_0xd2e9('0x2c')](_0x3bf1e2['query']);_0x3f0c38[_0xd2e9('0x2d')]=_[_0xd2e9('0x2e')](_0x3f0c38[_0xd2e9('0x28')],_0x3f0c38[_0xd2e9('0x2a')]);_0xa86f77[_0xd2e9('0x2f')]=_[_0xd2e9('0x2e')](_0x3f0c38[_0xd2e9('0x28')],qs[_0xd2e9('0x30')](_0x3bf1e2[_0xd2e9('0x2a')][_0xd2e9('0x30')]));_0xa86f77[_0xd2e9('0x2f')]=_0xa86f77[_0xd2e9('0x2f')][_0xd2e9('0x31')]?_0xa86f77[_0xd2e9('0x2f')]:_0x3f0c38[_0xd2e9('0x28')];_0xa86f77[_0xd2e9('0x33')]=qs[_0xd2e9('0x34')](_0x3bf1e2[_0xd2e9('0x2a')][_0xd2e9('0x34')]);_0xa86f77[_0xd2e9('0x35')]=qs[_0xd2e9('0x2d')](_[_0xd2e9('0x36')](_0x3bf1e2[_0xd2e9('0x2a')],_0x3f0c38[_0xd2e9('0x2d')]));if(_0x3bf1e2['query'][_0xd2e9('0x3b')]){_0xa86f77['where']=_[_0xd2e9('0x39')](_0xa86f77['where'],{'$or':_[_0xd2e9('0x3a')](_0xa86f77[_0xd2e9('0x2f')],function(_0x12a55f){var _0xee3c60={};_0xee3c60[_0x12a55f]={'$like':'%'+_0x3bf1e2[_0xd2e9('0x2a')][_0xd2e9('0x3b')]+'%'};return _0xee3c60;})});}_0xa86f77=_[_0xd2e9('0x39')]({},_0xa86f77,_0x3bf1e2[_0xd2e9('0x44')]);return _0x18b8d7[_0xd2e9('0x68')](_0xa86f77);}})[_0xd2e9('0x20')](function(_0x2ed4d3){if(_0x2ed4d3){_0x2c25c5=_0x2ed4d3['length'];if(!_0x3bf1e2['query'][_0xd2e9('0x4c')](_0xd2e9('0x32'))){_0xa86f77[_0xd2e9('0x1a')]=qs[_0xd2e9('0x1a')](_0x3bf1e2[_0xd2e9('0x2a')][_0xd2e9('0x1a')]);_0xa86f77[_0xd2e9('0x19')]=qs['offset'](_0x3bf1e2[_0xd2e9('0x2a')][_0xd2e9('0x19')]);}return _0x18b8d7[_0xd2e9('0x68')](_0xa86f77);}})['then'](function(_0x43c40f){if(_0x43c40f){return _0x43c40f?{'count':_0x2c25c5,'rows':_0x43c40f}:null;}})[_0xd2e9('0x20')](respondWithResult(_0x1612de,null))['catch'](handleError(_0x1612de,null));}; \ No newline at end of file +var _0x0a62=['json','offset','limit','Content-Range','reject','save','update','destroy','then','end','error','stack','name','send','index','FaxQueue','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','pick','filters','add','day','merge','where','filter','options','count','includeAll','include','rows','catch','show','find','create','body','params','describe','findOne','get','hasOwnProperty','FaxQueueId','map','UserFaxQueue','User','UserId','agent','faxPause','format','%s/%s','updatedAt','Team','getTeams','addTeams','findAll','Agents','union','addAgents','penalty','ids','removeTeams','removeAgents','omit','spread','emit','userFaxQueue:save','isArray','userFaxQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a62,0x119));var _0x20a6=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x0a62[_0x1c3c59];return _0x1100b7;};'use strict';var jsonpatch=require(_0x20a6('0x0'));var rp=require(_0x20a6('0x1'));var moment=require(_0x20a6('0x2'));var BPromise=require(_0x20a6('0x3'));var Mustache=require(_0x20a6('0x4'));var util=require(_0x20a6('0x5'));var path=require(_0x20a6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x20a6('0x7'));var fs=require('fs');var _=require(_0x20a6('0x8'));var squel=require('squel');var crypto=require(_0x20a6('0x9'));var jsforce=require(_0x20a6('0xa'));var deskjs=require(_0x20a6('0xb'));var toCsv=require(_0x20a6('0xc'));var querystring=require(_0x20a6('0xd'));var Papa=require(_0x20a6('0xe'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x20a6('0xf'));var db=require(_0x20a6('0x10'))['db'];var socket=require(_0x20a6('0x11'))({'host':_0x20a6('0x12'),'port':0x18eb});require('./faxQueue.socket')[_0x20a6('0x13')](socket);function respondWithStatusCode(_0xf33c1f,_0x337b53){_0x337b53=_0x337b53||0xcc;return function(_0xaad751){if(_0xaad751){return _0xf33c1f[_0x20a6('0x14')](_0x337b53);}return _0xf33c1f['status'](_0x337b53)['end']();};}function respondWithResult(_0x38513d,_0x2b5314){_0x2b5314=_0x2b5314||0xc8;return function(_0x300e36){if(_0x300e36){return _0x38513d[_0x20a6('0x15')](_0x2b5314)[_0x20a6('0x16')](_0x300e36);}};}function respondWithFilteredResult(_0x4619ff,_0xf0de0e){return function(_0x5361a9){if(_0x5361a9){var _0x356a6f=_0x5361a9['count'],_0x3b3faa=_0xf0de0e[_0x20a6('0x17')],_0x1d7600=_0xf0de0e[_0x20a6('0x17')]+_0xf0de0e[_0x20a6('0x18')],_0x5d40b4;if(_0x1d7600>=_0x356a6f){_0x1d7600=_0x356a6f;_0x5d40b4=0xc8;}else{_0x5d40b4=0xce;}_0x4619ff['status'](_0x5d40b4);return _0x4619ff['set'](_0x20a6('0x19'),_0x3b3faa+'-'+_0x1d7600+'/'+_0x356a6f)[_0x20a6('0x16')](_0x5361a9);}return null;};}function patchUpdates(_0x147e6b){return function(_0x3ed2f4){try{jsonpatch['apply'](_0x3ed2f4,_0x147e6b,!![]);}catch(_0x5ece96){return BPromise[_0x20a6('0x1a')](_0x5ece96);}return _0x3ed2f4[_0x20a6('0x1b')]();};}function saveUpdates(_0x7fcd2a,_0x27144f){return function(_0x2a8813){if(_0x2a8813){return _0x2a8813[_0x20a6('0x1c')](_0x7fcd2a)['then'](function(_0x456788){return _0x456788;});}return null;};}function removeEntity(_0x25ee09,_0x442203){return function(_0x28cec6){if(_0x28cec6){return _0x28cec6[_0x20a6('0x1d')]()[_0x20a6('0x1e')](function(){_0x25ee09[_0x20a6('0x15')](0xcc)[_0x20a6('0x1f')]();});}};}function handleEntityNotFound(_0x449ad0,_0x288027){return function(_0x39f6d9){if(!_0x39f6d9){_0x449ad0['sendStatus'](0x194);}return _0x39f6d9;};}function handleError(_0x29a051,_0x3cca9c){_0x3cca9c=_0x3cca9c||0x1f4;return function(_0x32f9ba){logger[_0x20a6('0x20')](_0x32f9ba[_0x20a6('0x21')]);if(_0x32f9ba[_0x20a6('0x22')]){delete _0x32f9ba[_0x20a6('0x22')];}_0x29a051[_0x20a6('0x15')](_0x3cca9c)[_0x20a6('0x23')](_0x32f9ba);};}exports[_0x20a6('0x24')]=function(_0x18cb71,_0x458cc4){var _0x56c604={},_0x124612={},_0x54e514={'count':0x0,'rows':[]};var _0x4dfbfc=db[_0x20a6('0x25')][_0x20a6('0x26')];_0x124612[_0x20a6('0x27')]=_[_0x20a6('0x28')](_0x4dfbfc);var _0x2f26e6={'dateStart':_0x18cb71['query'][_0x20a6('0x29')],'dateEnd':_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2b')]};delete _0x18cb71[_0x20a6('0x2a')][_0x20a6('0x29')];delete _0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2b')];_0x124612['query']=_[_0x20a6('0x28')](_0x18cb71[_0x20a6('0x2a')]);_0x124612['filters']=_[_0x20a6('0x2c')](_0x124612[_0x20a6('0x27')],_0x124612['query']);_0x56c604[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x124612[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x56c604['attributes']=_0x56c604[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x56c604[_0x20a6('0x2d')]:_0x124612[_0x20a6('0x27')];if(!_0x18cb71['query']['hasOwnProperty'](_0x20a6('0x30'))){_0x56c604[_0x20a6('0x18')]=qs[_0x20a6('0x18')](_0x18cb71['query'][_0x20a6('0x18')]);_0x56c604[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x17')]);}_0x56c604[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x18cb71['query'][_0x20a6('0x32')]);_0x56c604['where']=qs['filters'](_[_0x20a6('0x33')](_0x18cb71['query'],_0x124612[_0x20a6('0x34')]));if(_0x2f26e6[_0x20a6('0x29')]){if(_0x2f26e6[_0x20a6('0x2b')]){_0x2f26e6[_0x20a6('0x2b')]=moment(_0x2f26e6[_0x20a6('0x2b')])[_0x20a6('0x35')](0x1,_0x20a6('0x36'));}else{_0x2f26e6[_0x20a6('0x2b')]=moment(_0x2f26e6[_0x20a6('0x29')])['add'](0x1,_0x20a6('0x36'));}_[_0x20a6('0x37')](_0x56c604[_0x20a6('0x38')],{'createdAt':{'$gte':_0x2f26e6[_0x20a6('0x29')],'$lte':_0x2f26e6[_0x20a6('0x2b')]}});}if(_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x39')]){_0x56c604[_0x20a6('0x38')]=_[_0x20a6('0x37')](_0x56c604[_0x20a6('0x38')],{'$or':_['map'](_0x56c604[_0x20a6('0x2d')],function(_0x5a8a93){var _0xaaee8c={};_0xaaee8c[_0x5a8a93]={'$like':'%'+_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0xaaee8c;})});}_0x56c604=_[_0x20a6('0x37')]({},_0x56c604,_0x18cb71[_0x20a6('0x3a')]);var _0x20370d={'where':_0x56c604[_0x20a6('0x38')]};return db[_0x20a6('0x25')][_0x20a6('0x3b')](_0x20370d)['then'](function(_0x4adec0){_0x54e514[_0x20a6('0x3b')]=_0x4adec0;if(_0x18cb71[_0x20a6('0x2a')][_0x20a6('0x3c')]){_0x56c604[_0x20a6('0x3d')]=[{'all':!![]}];}return db[_0x20a6('0x25')]['findAll'](_0x56c604);})[_0x20a6('0x1e')](function(_0x2f996c){_0x54e514[_0x20a6('0x3e')]=_0x2f996c;return _0x54e514;})['then'](respondWithFilteredResult(_0x458cc4,_0x56c604))[_0x20a6('0x3f')](handleError(_0x458cc4,null));};exports[_0x20a6('0x40')]=function(_0x191b50,_0x5e03f6){var _0x49a3d6={'raw':!![],'where':{'id':_0x191b50['params']['id']}},_0x51cef9={};_0x51cef9[_0x20a6('0x27')]=_[_0x20a6('0x28')](db[_0x20a6('0x25')][_0x20a6('0x26')]);_0x51cef9['query']=_[_0x20a6('0x28')](_0x191b50[_0x20a6('0x2a')]);_0x51cef9['filters']=_[_0x20a6('0x2c')](_0x51cef9['model'],_0x51cef9['query']);_0x49a3d6['attributes']=_[_0x20a6('0x2c')](_0x51cef9[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x191b50[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x49a3d6[_0x20a6('0x2d')]=_0x49a3d6[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x49a3d6['attributes']:_0x51cef9['model'];if(_0x191b50[_0x20a6('0x2a')][_0x20a6('0x3c')]){_0x49a3d6[_0x20a6('0x3d')]=[{'all':!![]}];}_0x49a3d6=_[_0x20a6('0x37')]({},_0x49a3d6,_0x191b50[_0x20a6('0x3a')]);return db[_0x20a6('0x25')][_0x20a6('0x41')](_0x49a3d6)[_0x20a6('0x1e')](handleEntityNotFound(_0x5e03f6,null))[_0x20a6('0x1e')](respondWithResult(_0x5e03f6,null))[_0x20a6('0x3f')](handleError(_0x5e03f6,null));};exports[_0x20a6('0x42')]=function(_0x8436e,_0x27dc6a){return db[_0x20a6('0x25')][_0x20a6('0x42')](_0x8436e[_0x20a6('0x43')],{})[_0x20a6('0x1e')](respondWithResult(_0x27dc6a,0xc9))[_0x20a6('0x3f')](handleError(_0x27dc6a,null));};exports['update']=function(_0x45c3a7,_0x5d904e){if(_0x45c3a7[_0x20a6('0x43')]['id']){delete _0x45c3a7[_0x20a6('0x43')]['id'];}return db[_0x20a6('0x25')]['find']({'where':{'id':_0x45c3a7[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x5d904e,null))['then'](saveUpdates(_0x45c3a7[_0x20a6('0x43')],null))[_0x20a6('0x1e')](respondWithResult(_0x5d904e,null))[_0x20a6('0x3f')](handleError(_0x5d904e,null));};exports[_0x20a6('0x1d')]=function(_0x1f8d7f,_0x379ce4){return db[_0x20a6('0x25')][_0x20a6('0x41')]({'where':{'id':_0x1f8d7f[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x379ce4,null))[_0x20a6('0x1e')](removeEntity(_0x379ce4,null))['catch'](handleError(_0x379ce4,null));};exports[_0x20a6('0x45')]=function(_0x151867,_0x4d5b05){return db[_0x20a6('0x25')]['describe']()[_0x20a6('0x1e')](respondWithResult(_0x4d5b05,null))[_0x20a6('0x3f')](handleError(_0x4d5b05,null));};exports['getMembers']=function(_0x56be93,_0xe6442f,_0x43f07f){var _0x2106dc={'raw':!![],'where':{}},_0x4bbf8d={},_0x1c96f8;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x56be93[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0xe6442f,null))[_0x20a6('0x1e')](function(_0x4200f5){if(_0x4200f5){_0x1c96f8=_0x4200f5[_0x20a6('0x47')]({'plain':!![]});_0x4bbf8d[_0x20a6('0x27')]=_[_0x20a6('0x28')](db['UserFaxQueue'][_0x20a6('0x26')]);_0x4bbf8d[_0x20a6('0x2a')]=_['keys'](_0x56be93[_0x20a6('0x2a')]);_0x4bbf8d[_0x20a6('0x34')]=_[_0x20a6('0x2c')](_0x4bbf8d[_0x20a6('0x27')],_0x4bbf8d[_0x20a6('0x2a')]);_0x2106dc[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x4bbf8d[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x2106dc[_0x20a6('0x2d')]=_0x2106dc[_0x20a6('0x2d')]['length']?_0x2106dc[_0x20a6('0x2d')]:_0x4bbf8d['model'];if(!_0x56be93[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x2106dc[_0x20a6('0x18')]=qs[_0x20a6('0x18')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x18')]);_0x2106dc[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x56be93['query']['offset']);}_0x2106dc['order']=qs[_0x20a6('0x32')](_0x56be93[_0x20a6('0x2a')][_0x20a6('0x32')]);_0x2106dc[_0x20a6('0x38')]=qs[_0x20a6('0x34')](_[_0x20a6('0x33')](_0x56be93[_0x20a6('0x2a')],_0x4bbf8d[_0x20a6('0x34')]));_0x2106dc[_0x20a6('0x38')][_0x20a6('0x49')]=_0x4200f5['id'];if(_0x56be93['query']['filter']){_0x2106dc['where']=_[_0x20a6('0x37')](_0x2106dc['where'],{'$or':_[_0x20a6('0x4a')](_0x2106dc[_0x20a6('0x2d')],function(_0x4e378e){var _0x140bd3={};_0x140bd3[_0x4e378e]={'$like':'%'+_0x56be93['query'][_0x20a6('0x39')]+'%'};return _0x140bd3;})});}_0x2106dc=_[_0x20a6('0x37')]({},_0x2106dc,_0x56be93[_0x20a6('0x3a')]);return db[_0x20a6('0x4b')]['findAll'](_0x2106dc);}})['then'](function(_0x2f444d){if(_0x2f444d){return db[_0x20a6('0x4c')]['findAndCountAll']({'where':{'id':_[_0x20a6('0x4a')](_0x2f444d,_0x20a6('0x4d')),'role':_0x20a6('0x4e')},'attributes':['id','name',_0x20a6('0x4f'),'updatedAt','createdAt']});}})[_0x20a6('0x1e')](function(_0x17dfa2){if(_0x17dfa2){return{'count':_0x17dfa2[_0x20a6('0x3b')],'rows':_['map'](_0x17dfa2['rows'],function(_0x3505d8){return{'membername':_0x3505d8[_0x20a6('0x22')],'UserId':_0x3505d8['id'],'queue_name':_0x1c96f8[_0x20a6('0x22')],'FaxQueueId':_0x1c96f8['id'],'interface':util[_0x20a6('0x50')](_0x20a6('0x51'),'SIP',_0x3505d8['name']),'penalty':0x0,'paused':_0x3505d8[_0x20a6('0x4f')],'createdAt':_0x3505d8['createdAt'],'updatedAt':_0x3505d8[_0x20a6('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xe6442f,_0x2106dc))[_0x20a6('0x3f')](handleError(_0xe6442f,null));};exports['getTeams']=function(_0x29a902,_0x3cd3c8,_0xaeb70c){var _0x2a4255={};var _0x1b9a00={};var _0xf79804;var _0x43a92e;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x29a902[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3cd3c8,null))[_0x20a6('0x1e')](function(_0x2f5e93){if(_0x2f5e93){_0xf79804=_0x2f5e93;_0x1b9a00[_0x20a6('0x27')]=_[_0x20a6('0x28')](db[_0x20a6('0x53')][_0x20a6('0x26')]);_0x1b9a00[_0x20a6('0x2a')]=_['keys'](_0x29a902[_0x20a6('0x2a')]);_0x1b9a00[_0x20a6('0x34')]=_[_0x20a6('0x2c')](_0x1b9a00['model'],_0x1b9a00[_0x20a6('0x2a')]);_0x2a4255[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x1b9a00[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x29a902[_0x20a6('0x2a')][_0x20a6('0x2e')]));_0x2a4255[_0x20a6('0x2d')]=_0x2a4255['attributes'][_0x20a6('0x2f')]?_0x2a4255[_0x20a6('0x2d')]:_0x1b9a00[_0x20a6('0x27')];_0x2a4255[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x29a902['query'][_0x20a6('0x32')]);_0x2a4255[_0x20a6('0x38')]=qs['filters'](_['pick'](_0x29a902['query'],_0x1b9a00[_0x20a6('0x34')]));if(_0x29a902[_0x20a6('0x2a')]['filter']){_0x2a4255[_0x20a6('0x38')]=_['merge'](_0x2a4255[_0x20a6('0x38')],{'$or':_['map'](_0x2a4255['attributes'],function(_0x283ef2){var _0x3a0131={};_0x3a0131[_0x283ef2]={'$like':'%'+_0x29a902[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0x3a0131;})});}_0x2a4255=_[_0x20a6('0x37')]({},_0x2a4255,_0x29a902['options']);return _0xf79804[_0x20a6('0x54')](_0x2a4255);}})[_0x20a6('0x1e')](function(_0x5ab7f2){if(_0x5ab7f2){_0x43a92e=_0x5ab7f2[_0x20a6('0x2f')];if(!_0x29a902[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x2a4255['limit']=qs[_0x20a6('0x18')](_0x29a902[_0x20a6('0x2a')]['limit']);_0x2a4255[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x29a902[_0x20a6('0x2a')][_0x20a6('0x17')]);}return _0xf79804[_0x20a6('0x54')](_0x2a4255);}})[_0x20a6('0x1e')](function(_0x47667e){if(_0x47667e){return _0x47667e?{'count':_0x43a92e,'rows':_0x47667e}:null;}})['then'](respondWithResult(_0x3cd3c8,null))[_0x20a6('0x3f')](handleError(_0x3cd3c8,null));};exports[_0x20a6('0x55')]=function(_0x23a9eb,_0x9c82c5,_0x145036){var _0x5a48e4=[];var _0x277382;return db[_0x20a6('0x53')][_0x20a6('0x56')]({'where':{'id':_0x23a9eb[_0x20a6('0x43')]['ids']},'attributes':['id'],'include':[{'model':db[_0x20a6('0x4c')],'as':_0x20a6('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5d7e98){if(_0x5d7e98){for(var _0x1eecde=0x0;_0x1eecde<_0x5d7e98['length'];_0x1eecde+=0x1){for(var _0x4a3daf=0x0;_0x4a3daf<_0x5d7e98[_0x1eecde][_0x20a6('0x57')]['length'];_0x4a3daf+=0x1){_0x5a48e4=_[_0x20a6('0x58')](_0x5a48e4,[_0x5d7e98[_0x1eecde][_0x20a6('0x57')][_0x4a3daf]['id']]);}}return _0x5a48e4;}})[_0x20a6('0x1e')](function(_0x5a3deb){if(_0x5a3deb){return db[_0x20a6('0x25')]['find']({'where':{'id':_0x23a9eb[_0x20a6('0x44')]['id']}});}})['then'](function(_0x5bfe16){if(_0x5bfe16){_0x277382=_0x5bfe16;return _0x277382[_0x20a6('0x59')](_0x5a48e4,{'penalty':_0x23a9eb[_0x20a6('0x43')][_0x20a6('0x5a')]});}})[_0x20a6('0x1e')](function(_0x40aeac){if(_0x40aeac){return _0x277382['addTeams'](_0x23a9eb[_0x20a6('0x43')][_0x20a6('0x5b')]);}})[_0x20a6('0x1e')](handleEntityNotFound(_0x9c82c5,null))['then'](respondWithStatusCode(_0x9c82c5,null))[_0x20a6('0x3f')](handleError(_0x9c82c5,null));};exports[_0x20a6('0x5c')]=function(_0x150aef,_0x3b3fa8,_0x29cb6e){var _0x1ff883=[];var _0x365cee;return db[_0x20a6('0x53')][_0x20a6('0x56')]({'where':{'id':_0x150aef[_0x20a6('0x2a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x20a6('0x4c')],'as':_0x20a6('0x57'),'attributes':['id'],'raw':!![]}]})[_0x20a6('0x1e')](function(_0x5df465){if(_0x5df465){for(var _0x4a3a48=0x0;_0x4a3a48<_0x5df465[_0x20a6('0x2f')];_0x4a3a48+=0x1){for(var _0x4cdfdf=0x0;_0x4cdfdf<_0x5df465[_0x4a3a48]['Agents'][_0x20a6('0x2f')];_0x4cdfdf+=0x1){_0x1ff883=_[_0x20a6('0x58')](_0x1ff883,[_0x5df465[_0x4a3a48][_0x20a6('0x57')][_0x4cdfdf]['id']]);}}return _0x1ff883;}})[_0x20a6('0x1e')](function(_0x3d3814){if(_0x3d3814){return db[_0x20a6('0x25')][_0x20a6('0x41')]({'where':{'id':_0x150aef[_0x20a6('0x44')]['id']}});}})[_0x20a6('0x1e')](function(_0x3e5d55){if(_0x3e5d55){_0x365cee=_0x3e5d55;return _0x365cee[_0x20a6('0x5d')](_0x1ff883);}})[_0x20a6('0x1e')](function(_0x6140c4){if(_0x365cee){return _0x365cee['removeTeams'](_0x150aef[_0x20a6('0x2a')][_0x20a6('0x5b')]);}})[_0x20a6('0x1e')](handleEntityNotFound(_0x3b3fa8,null))[_0x20a6('0x1e')](respondWithStatusCode(_0x3b3fa8,null))[_0x20a6('0x3f')](handleError(_0x3b3fa8,null));};exports[_0x20a6('0x59')]=function(_0x13300d,_0x550b54,_0x382d45){return db['FaxQueue'][_0x20a6('0x41')]({'where':{'id':_0x13300d[_0x20a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x550b54,null))[_0x20a6('0x1e')](function(_0x19e3f2){if(_0x19e3f2){return _0x19e3f2[_0x20a6('0x59')](_0x13300d[_0x20a6('0x43')][_0x20a6('0x5b')],_[_0x20a6('0x5e')](_0x13300d['body'],['ids','id'])||{})[_0x20a6('0x5f')](function(_0x52fc95){for(var _0x208791=0x0;_0x208791<_0x13300d[_0x20a6('0x43')][_0x20a6('0x5b')][_0x20a6('0x2f')];_0x208791+=0x1){socket[_0x20a6('0x60')](_0x20a6('0x61'),{'UserId':_0x13300d[_0x20a6('0x43')]['ids'][_0x208791],'FaxQueueId':_0x13300d['params']['id']});}return _0x52fc95;});}})[_0x20a6('0x1e')](respondWithResult(_0x550b54,null))[_0x20a6('0x3f')](handleError(_0x550b54,null));};exports[_0x20a6('0x5d')]=function(_0x28920e,_0x5b35b6,_0x4cc445){var _0x43fcc2;return db['FaxQueue'][_0x20a6('0x41')]({'where':{'id':_0x28920e[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x5b35b6,null))['then'](function(_0x5d5494){if(_0x5d5494){return _0x5d5494[_0x20a6('0x5d')](_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')])[_0x20a6('0x1e')](function(_0x52472a){if(_[_0x20a6('0x62')](_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')])){for(var _0x47c2f9=0x0;_0x47c2f9<_0x28920e['query']['ids'][_0x20a6('0x2f')];_0x47c2f9+=0x1){socket['emit'](_0x20a6('0x63'),{'UserId':_0x28920e[_0x20a6('0x2a')][_0x20a6('0x5b')][_0x47c2f9],'FaxQueueId':_0x28920e['params']['id']});}}else{socket[_0x20a6('0x60')](_0x20a6('0x63'),{'UserId':_0x28920e['query'][_0x20a6('0x5b')],'FaxQueueId':_0x28920e[_0x20a6('0x44')]['id']});}});}})[_0x20a6('0x1e')](respondWithStatusCode(_0x5b35b6,null))[_0x20a6('0x3f')](handleError(_0x5b35b6,null));};exports[_0x20a6('0x64')]=function(_0x1f8514,_0x1323ae,_0x5187e0){var _0x364256={};var _0x4b17e2={};var _0x4b5e5f;var _0x424ca1;return db[_0x20a6('0x25')][_0x20a6('0x46')]({'where':{'id':_0x1f8514[_0x20a6('0x44')]['id']}})[_0x20a6('0x1e')](handleEntityNotFound(_0x1323ae,null))[_0x20a6('0x1e')](function(_0x155496){if(_0x155496){_0x4b5e5f=_0x155496;_0x4b17e2[_0x20a6('0x27')]=_['keys'](db[_0x20a6('0x4c')]['rawAttributes']);_0x4b17e2['query']=_[_0x20a6('0x28')](_0x1f8514['query']);_0x4b17e2[_0x20a6('0x34')]=_['intersection'](_0x4b17e2[_0x20a6('0x27')],_0x4b17e2[_0x20a6('0x2a')]);_0x364256[_0x20a6('0x2d')]=_[_0x20a6('0x2c')](_0x4b17e2[_0x20a6('0x27')],qs[_0x20a6('0x2e')](_0x1f8514['query']['fields']));_0x364256['attributes']=_0x364256[_0x20a6('0x2d')][_0x20a6('0x2f')]?_0x364256[_0x20a6('0x2d')]:_0x4b17e2[_0x20a6('0x27')];_0x364256[_0x20a6('0x31')]=qs[_0x20a6('0x32')](_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x32')]);_0x364256[_0x20a6('0x38')]=qs[_0x20a6('0x34')](_[_0x20a6('0x33')](_0x1f8514[_0x20a6('0x2a')],_0x4b17e2['filters']));if(_0x1f8514[_0x20a6('0x2a')]['filter']){_0x364256['where']=_[_0x20a6('0x37')](_0x364256[_0x20a6('0x38')],{'$or':_['map'](_0x364256[_0x20a6('0x2d')],function(_0x4b42ce){var _0x268fe1={};_0x268fe1[_0x4b42ce]={'$like':'%'+_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x39')]+'%'};return _0x268fe1;})});}_0x364256=_[_0x20a6('0x37')]({},_0x364256,_0x1f8514[_0x20a6('0x3a')]);return _0x4b5e5f[_0x20a6('0x64')](_0x364256);}})[_0x20a6('0x1e')](function(_0x3501bc){if(_0x3501bc){_0x424ca1=_0x3501bc[_0x20a6('0x2f')];if(!_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x48')](_0x20a6('0x30'))){_0x364256['limit']=qs[_0x20a6('0x18')](_0x1f8514[_0x20a6('0x2a')][_0x20a6('0x18')]);_0x364256[_0x20a6('0x17')]=qs[_0x20a6('0x17')](_0x1f8514[_0x20a6('0x2a')]['offset']);}return _0x4b5e5f[_0x20a6('0x64')](_0x364256);}})['then'](function(_0x1ebae5){if(_0x1ebae5){return _0x1ebae5?{'count':_0x424ca1,'rows':_0x1ebae5}:null;}})[_0x20a6('0x1e')](respondWithResult(_0x1323ae,null))[_0x20a6('0x3f')](handleError(_0x1323ae,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9a4aebd..d2af88e 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x55ca,0x126));var _0xa55c=function(_0x39e4a1,_0x4edcc5){_0x39e4a1=_0x39e4a1-0x0;var _0x55b30e=_0x55ca[_0x39e4a1];return _0x55b30e;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxQueue=require(_0xa55c('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxQueueEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxQueueEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxQueue[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0x5292=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0xa6b0c9,_0x1c102a){var _0x17eba9=function(_0x5bb7df){while(--_0x5bb7df){_0xa6b0c9['push'](_0xa6b0c9['shift']());}};_0x17eba9(++_0x1c102a);}(_0x5292,0xf7));var _0x2529=function(_0x5da01c,_0x53bf77){_0x5da01c=_0x5da01c-0x0;var _0x1216c2=_0x5292[_0x5da01c];return _0x1216c2;};'use strict';var EventEmitter=require(_0x2529('0x0'));var FaxQueue=require(_0x2529('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x2529('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2529('0x3'),'afterDestroy':_0x2529('0x4')};function emitEvent(_0x29576c){return function(_0x228165,_0x5d25dc,_0x28c08d){FaxQueueEvents['emit'](_0x29576c+':'+_0x228165['id'],_0x228165);FaxQueueEvents['emit'](_0x29576c,_0x228165);_0x28c08d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x2529('0x5')](e,emitEvent(event));}}module[_0x2529('0x6')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 745d95e..d2ae056 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 _0xb73a=['FaxQueue','fax_queues','util','../../config/logger','api','moment','./faxQueue.attributes','exports'];(function(_0x5d4876,_0x11e6b0){var _0x6927ac=function(_0x2e9a3a){while(--_0x2e9a3a){_0x5d4876['push'](_0x5d4876['shift']());}};_0x6927ac(++_0x11e6b0);}(_0xb73a,0x17a));var _0xab73=function(_0x493a95,_0x4cfccb){_0x493a95=_0x493a95-0x0;var _0x1cac44=_0xb73a[_0x493a95];return _0x1cac44;};'use strict';var _=require('lodash');var util=require(_0xab73('0x0'));var logger=require(_0xab73('0x1'))(_0xab73('0x2'));var moment=require(_0xab73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xab73('0x4'));module[_0xab73('0x5')]=function(_0x57ff1b,_0x1c662d){return _0x57ff1b['define'](_0xab73('0x6'),attributes,{'tableName':_0xab73('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb6ab=['../../config/logger','api','moment','bluebird','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','util'];(function(_0x835a1,_0x88f505){var _0x2fdd76=function(_0x7b4348){while(--_0x7b4348){_0x835a1['push'](_0x835a1['shift']());}};_0x2fdd76(++_0x88f505);}(_0xb6ab,0x10d));var _0xbb6a=function(_0x3c1d68,_0x44cce2){_0x3c1d68=_0x3c1d68-0x0;var _0x19c5aa=_0xb6ab[_0x3c1d68];return _0x19c5aa;};'use strict';var _=require('lodash');var util=require(_0xbb6a('0x0'));var logger=require(_0xbb6a('0x1'))(_0xbb6a('0x2'));var moment=require(_0xbb6a('0x3'));var BPromise=require(_0xbb6a('0x4'));var rp=require('request-promise');var attributes=require(_0xbb6a('0x5'));module[_0xbb6a('0x6')]=function(_0x3ae683,_0x4dd0cb){return _0x3ae683[_0xbb6a('0x7')](_0xbb6a('0x8'),attributes,{'tableName':_0xbb6a('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 e139202..69a4e01 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 _0x7893=['../../config/logger','jayson/promise','client','http','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxQueue','findAll','options','where','attributes','map','include','model','GetFaxQueue','stringify','ShowFaxQueue','find','raw','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x2ffe50,_0x552833){var _0x38386f=function(_0x24b81e){while(--_0x24b81e){_0x2ffe50['push'](_0x2ffe50['shift']());}};_0x38386f(++_0x552833);}(_0x7893,0x193));var _0x3789=function(_0x43cee4,_0xe78eb4){_0x43cee4=_0x43cee4-0x0;var _0x36e924=_0x7893[_0x43cee4];return _0x36e924;};'use strict';var _=require(_0x3789('0x0'));var util=require(_0x3789('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3789('0x2'));var fs=require('fs');var db=require(_0x3789('0x3'))['db'];var utils=require(_0x3789('0x4'));var logger=require(_0x3789('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3789('0x6'));var client=jayson[_0x3789('0x7')][_0x3789('0x8')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x3789('0x9'))['register'](socket);function respondWithRpcPromise(_0x24b0ca,_0x18a4a8,_0x40ef58){return new BPromise(function(_0x25ac9f,_0x4f20f1){return client['request'](_0x24b0ca,_0x40ef58)[_0x3789('0xa')](function(_0x1677d8){logger['info'](_0x3789('0xb'),_0x18a4a8,_0x3789('0xc'));logger[_0x3789('0xd')](_0x3789('0xe'),_0x18a4a8,_0x3789('0xc'),JSON['stringify'](_0x1677d8));if(_0x1677d8[_0x3789('0xf')]){if(_0x1677d8[_0x3789('0xf')][_0x3789('0x10')]===0x1f4){logger[_0x3789('0xf')](_0x3789('0xb'),_0x18a4a8,_0x1677d8[_0x3789('0xf')]['message']);return _0x4f20f1(_0x1677d8[_0x3789('0xf')]['message']);}logger[_0x3789('0xf')]('FaxQueue,\x20%s,\x20%s',_0x18a4a8,_0x1677d8[_0x3789('0xf')][_0x3789('0x11')]);return _0x25ac9f(_0x1677d8[_0x3789('0xf')]['message']);}else{logger[_0x3789('0x12')]('FaxQueue,\x20%s,\x20%s',_0x18a4a8,_0x3789('0xc'));_0x25ac9f(_0x1677d8[_0x3789('0x13')][_0x3789('0x11')]);}})[_0x3789('0x14')](function(_0x425ce3){logger[_0x3789('0xf')](_0x3789('0xb'),_0x18a4a8,_0x425ce3);_0x4f20f1(_0x425ce3);});});}exports['GetFaxQueue']=function(_0x4c3d72){var _0x5998c1=this;return new Promise(function(_0x3486b7,_0x3694ab){return db[_0x3789('0x15')][_0x3789('0x16')]({'raw':_0x4c3d72[_0x3789('0x17')]?_0x4c3d72[_0x3789('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4c3d72[_0x3789('0x17')]?_0x4c3d72[_0x3789('0x17')][_0x3789('0x18')]||null:null,'attributes':_0x4c3d72[_0x3789('0x17')]?_0x4c3d72[_0x3789('0x17')][_0x3789('0x19')]||null:null,'limit':_0x4c3d72[_0x3789('0x17')]?_0x4c3d72['options']['limit']||null:null,'include':_0x4c3d72['options']?_0x4c3d72['options']['include']?_[_0x3789('0x1a')](_0x4c3d72[_0x3789('0x17')][_0x3789('0x1b')],function(_0x3415ea){return{'model':db[_0x3415ea[_0x3789('0x1c')]],'as':_0x3415ea['as'],'attributes':_0x3415ea[_0x3789('0x19')],'include':_0x3415ea[_0x3789('0x1b')]?_[_0x3789('0x1a')](_0x3415ea[_0x3789('0x1b')],function(_0x38f10a){return{'model':db[_0x38f10a[_0x3789('0x1c')]],'as':_0x38f10a['as'],'attributes':_0x38f10a[_0x3789('0x19')],'include':_0x38f10a[_0x3789('0x1b')]?_[_0x3789('0x1a')](_0x38f10a['include'],function(_0x33cda6){return{'model':db[_0x33cda6[_0x3789('0x1c')]],'as':_0x33cda6['as'],'attributes':_0x33cda6[_0x3789('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26e94a){logger[_0x3789('0x12')](_0x3789('0x1d'),_0x4c3d72);logger[_0x3789('0xd')]('GetFaxQueue',_0x4c3d72,JSON[_0x3789('0x1e')](_0x26e94a));_0x3486b7(_0x26e94a);})['catch'](function(_0x552464){logger[_0x3789('0xf')]('GetFaxQueue',_0x552464[_0x3789('0x11')],_0x4c3d72);_0x3694ab(_0x5998c1[_0x3789('0xf')](0x1f4,_0x552464[_0x3789('0x11')]));});});};exports[_0x3789('0x1f')]=function(_0x289322){var _0x20da3e=this;return new Promise(function(_0x2deae0,_0x406bd1){return db['FaxQueue'][_0x3789('0x20')]({'raw':_0x289322[_0x3789('0x17')]?_0x289322['options'][_0x3789('0x21')]===undefined?!![]:![]:!![],'where':_0x289322[_0x3789('0x17')]?_0x289322[_0x3789('0x17')][_0x3789('0x18')]||null:null,'attributes':_0x289322[_0x3789('0x17')]?_0x289322['options'][_0x3789('0x19')]||null:null,'include':_0x289322[_0x3789('0x17')]?_0x289322['options'][_0x3789('0x1b')]?_[_0x3789('0x1a')](_0x289322[_0x3789('0x17')][_0x3789('0x1b')],function(_0x5daa64){return{'model':db[_0x5daa64[_0x3789('0x1c')]],'as':_0x5daa64['as'],'attributes':_0x5daa64[_0x3789('0x19')],'include':_0x5daa64[_0x3789('0x1b')]?_[_0x3789('0x1a')](_0x5daa64[_0x3789('0x1b')],function(_0x4bb57a){return{'model':db[_0x4bb57a['model']],'as':_0x4bb57a['as'],'attributes':_0x4bb57a['attributes'],'include':_0x4bb57a[_0x3789('0x1b')]?_[_0x3789('0x1a')](_0x4bb57a[_0x3789('0x1b')],function(_0x26c82c){return{'model':db[_0x26c82c[_0x3789('0x1c')]],'as':_0x26c82c['as'],'attributes':_0x26c82c[_0x3789('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3789('0xa')](function(_0x1cabe1){logger[_0x3789('0x12')](_0x3789('0x1f'),_0x289322);logger[_0x3789('0xd')](_0x3789('0x1f'),_0x289322,JSON[_0x3789('0x1e')](_0x1cabe1));_0x2deae0(_0x1cabe1);})[_0x3789('0x14')](function(_0x1c16e3){logger[_0x3789('0xf')](_0x3789('0x1f'),_0x1c16e3[_0x3789('0x11')],_0x289322);_0x406bd1(_0x20da3e[_0x3789('0xf')](0x1f4,_0x1c16e3[_0x3789('0x11')]));});});}; \ No newline at end of file +var _0x8a76=['../../config/environment','client','http','socket.io-emitter','localhost','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','raw','options','where','limit','include','map','model','attributes','stringify','ShowFaxQueue','find','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8a76,0x17f));var _0x68a7=function(_0x55afd9,_0x564f0a){_0x55afd9=_0x55afd9-0x0;var _0x506682=_0x8a76[_0x55afd9];return _0x506682;};'use strict';var _=require(_0x68a7('0x0'));var util=require(_0x68a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x68a7('0x2'));var fs=require('fs');var db=require(_0x68a7('0x3'))['db'];var utils=require(_0x68a7('0x4'));var logger=require(_0x68a7('0x5'))(_0x68a7('0x6'));var config=require(_0x68a7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x68a7('0x8')][_0x68a7('0x9')]({'port':0x232a});var socket=require(_0x68a7('0xa'))({'host':_0x68a7('0xb'),'port':0x18eb});require(_0x68a7('0xc'))[_0x68a7('0xd')](socket);function respondWithRpcPromise(_0x56f2aa,_0x3a09d7,_0x157454){return new BPromise(function(_0x5786d7,_0x2ed464){return client[_0x68a7('0xe')](_0x56f2aa,_0x157454)[_0x68a7('0xf')](function(_0x18a66b){logger[_0x68a7('0x10')](_0x68a7('0x11'),_0x3a09d7,_0x68a7('0x12'));logger[_0x68a7('0x13')](_0x68a7('0x14'),_0x3a09d7,_0x68a7('0x12'),JSON['stringify'](_0x18a66b));if(_0x18a66b[_0x68a7('0x15')]){if(_0x18a66b[_0x68a7('0x15')]['code']===0x1f4){logger[_0x68a7('0x15')](_0x68a7('0x11'),_0x3a09d7,_0x18a66b[_0x68a7('0x15')]['message']);return _0x2ed464(_0x18a66b['error']['message']);}logger[_0x68a7('0x15')]('FaxQueue,\x20%s,\x20%s',_0x3a09d7,_0x18a66b[_0x68a7('0x15')]['message']);return _0x5786d7(_0x18a66b[_0x68a7('0x15')][_0x68a7('0x16')]);}else{logger[_0x68a7('0x10')]('FaxQueue,\x20%s,\x20%s',_0x3a09d7,_0x68a7('0x12'));_0x5786d7(_0x18a66b[_0x68a7('0x17')]['message']);}})[_0x68a7('0x18')](function(_0x4d1c5d){logger[_0x68a7('0x15')](_0x68a7('0x11'),_0x3a09d7,_0x4d1c5d);_0x2ed464(_0x4d1c5d);});});}exports[_0x68a7('0x19')]=function(_0x428f07){var _0x28e9ba=this;return new Promise(function(_0x3e7e66,_0x415754){return db[_0x68a7('0x1a')][_0x68a7('0x1b')]({'raw':_0x428f07['options']?_0x428f07['options'][_0x68a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x428f07[_0x68a7('0x1d')]?_0x428f07['options'][_0x68a7('0x1e')]||null:null,'attributes':_0x428f07[_0x68a7('0x1d')]?_0x428f07['options']['attributes']||null:null,'limit':_0x428f07[_0x68a7('0x1d')]?_0x428f07[_0x68a7('0x1d')][_0x68a7('0x1f')]||null:null,'include':_0x428f07[_0x68a7('0x1d')]?_0x428f07[_0x68a7('0x1d')][_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x428f07[_0x68a7('0x1d')]['include'],function(_0x2d2604){return{'model':db[_0x2d2604['model']],'as':_0x2d2604['as'],'attributes':_0x2d2604['attributes'],'include':_0x2d2604['include']?_[_0x68a7('0x21')](_0x2d2604[_0x68a7('0x20')],function(_0x5e0b82){return{'model':db[_0x5e0b82[_0x68a7('0x22')]],'as':_0x5e0b82['as'],'attributes':_0x5e0b82[_0x68a7('0x23')],'include':_0x5e0b82[_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x5e0b82[_0x68a7('0x20')],function(_0x591430){return{'model':db[_0x591430[_0x68a7('0x22')]],'as':_0x591430['as'],'attributes':_0x591430[_0x68a7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x68a7('0xf')](function(_0x4323ce){logger['info']('GetFaxQueue',_0x428f07);logger[_0x68a7('0x13')](_0x68a7('0x19'),_0x428f07,JSON[_0x68a7('0x24')](_0x4323ce));_0x3e7e66(_0x4323ce);})[_0x68a7('0x18')](function(_0x4c0a91){logger[_0x68a7('0x15')](_0x68a7('0x19'),_0x4c0a91[_0x68a7('0x16')],_0x428f07);_0x415754(_0x28e9ba[_0x68a7('0x15')](0x1f4,_0x4c0a91[_0x68a7('0x16')]));});});};exports[_0x68a7('0x25')]=function(_0x27fc7a){var _0x257a87=this;return new Promise(function(_0x487427,_0x50acf9){return db[_0x68a7('0x1a')][_0x68a7('0x26')]({'raw':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x1c')]===undefined?!![]:![]:!![],'where':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')]['where']||null:null,'attributes':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x23')]||null:null,'include':_0x27fc7a[_0x68a7('0x1d')]?_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x20')]?_['map'](_0x27fc7a[_0x68a7('0x1d')][_0x68a7('0x20')],function(_0x1ffb5b){return{'model':db[_0x1ffb5b['model']],'as':_0x1ffb5b['as'],'attributes':_0x1ffb5b[_0x68a7('0x23')],'include':_0x1ffb5b[_0x68a7('0x20')]?_['map'](_0x1ffb5b[_0x68a7('0x20')],function(_0x1eb3e3){return{'model':db[_0x1eb3e3[_0x68a7('0x22')]],'as':_0x1eb3e3['as'],'attributes':_0x1eb3e3['attributes'],'include':_0x1eb3e3[_0x68a7('0x20')]?_[_0x68a7('0x21')](_0x1eb3e3[_0x68a7('0x20')],function(_0x325966){return{'model':db[_0x325966[_0x68a7('0x22')]],'as':_0x325966['as'],'attributes':_0x325966['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xd5bc58){logger[_0x68a7('0x10')](_0x68a7('0x25'),_0x27fc7a);logger['debug'](_0x68a7('0x25'),_0x27fc7a,JSON[_0x68a7('0x24')](_0xd5bc58));_0x487427(_0xd5bc58);})[_0x68a7('0x18')](function(_0x230e1e){logger[_0x68a7('0x15')](_0x68a7('0x25'),_0x230e1e[_0x68a7('0x16')],_0x27fc7a);_0x50acf9(_0x257a87[_0x68a7('0x15')](0x1f4,_0x230e1e[_0x68a7('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 256edca..748f5d4 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 _0x087c=['update','emit','removeListener','length','faxQueue:','./faxQueue.events','save','remove'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x087c,0x18d));var _0xc087=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x087c[_0x321bb2];return _0x9c12ed;};'use strict';var FaxQueueEvents=require(_0xc087('0x0'));var events=[_0xc087('0x1'),_0xc087('0x2'),_0xc087('0x3')];function createListener(_0x57918,_0xabf0af){return function(_0x286a3f){_0xabf0af[_0xc087('0x4')](_0x57918,_0x286a3f);};}function removeListener(_0x3697b4,_0x22c688){return function(){FaxQueueEvents[_0xc087('0x5')](_0x3697b4,_0x22c688);};}exports['register']=function(_0x41495e){for(var _0x136c3f=0x0,_0x4f6de3=events[_0xc087('0x6')];_0x136c3f<_0x4f6de3;_0x136c3f++){var _0x3b186b=events[_0x136c3f];var _0x1fa618=createListener(_0xc087('0x7')+_0x3b186b,_0x41495e);FaxQueueEvents['on'](_0x3b186b,_0x1fa618);}}; \ No newline at end of file +var _0xf274=['update','removeListener','register','length','./faxQueue.events','save','remove'];(function(_0x4e4989,_0x3c3d9e){var _0x4dabe5=function(_0x288f5b){while(--_0x288f5b){_0x4e4989['push'](_0x4e4989['shift']());}};_0x4dabe5(++_0x3c3d9e);}(_0xf274,0x1ee));var _0x4f27=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0xf274[_0x39c734];return _0xb2a2f9;};'use strict';var FaxQueueEvents=require(_0x4f27('0x0'));var events=[_0x4f27('0x1'),_0x4f27('0x2'),_0x4f27('0x3')];function createListener(_0x13aee8,_0x15b21e){return function(_0x26e6a9){_0x15b21e['emit'](_0x13aee8,_0x26e6a9);};}function removeListener(_0x36570a,_0xd8cdf8){return function(){FaxQueueEvents[_0x4f27('0x4')](_0x36570a,_0xd8cdf8);};}exports[_0x4f27('0x5')]=function(_0x5b7022){for(var _0x441cf3=0x0,_0x19ac13=events[_0x4f27('0x6')];_0x441cf3<_0x19ac13;_0x441cf3++){var _0x428fd8=events[_0x441cf3];var _0x543b83=createListener('faxQueue:'+_0x428fd8,_0x5b7022);FaxQueueEvents['on'](_0x428fd8,_0x543b83);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index aa9b8ee..ba84ca8 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 _0x0f97=['/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','put','update','delete','/:id','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','show'];(function(_0x128ee7,_0xbfbe00){var _0x38450a=function(_0x570931){while(--_0x570931){_0x128ee7['push'](_0x128ee7['shift']());}};_0x38450a(++_0xbfbe00);}(_0x0f97,0x196));var _0x70f9=function(_0xffd1b5,_0x1ede18){_0xffd1b5=_0xffd1b5-0x0;var _0x3176d6=_0x0f97[_0xffd1b5];return _0x3176d6;};'use strict';var multer=require(_0x70f9('0x0'));var util=require(_0x70f9('0x1'));var path=require(_0x70f9('0x2'));var express=require(_0x70f9('0x3'));var router=express[_0x70f9('0x4')]();var auth=require(_0x70f9('0x5'));var interaction=require(_0x70f9('0x6'));var config=require(_0x70f9('0x7'));var controller=require(_0x70f9('0x8'));router[_0x70f9('0x9')]('/',auth[_0x70f9('0xa')](),controller['index']);router['get'](_0x70f9('0xb'),auth[_0x70f9('0xa')](),controller[_0x70f9('0xc')]);router[_0x70f9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x70f9('0xd')]);router[_0x70f9('0x9')](_0x70f9('0xe'),auth[_0x70f9('0xa')](),controller['getMembers']);router['get']('/:id/teams',auth['isAuthenticated'](),controller[_0x70f9('0xf')]);router[_0x70f9('0x9')](_0x70f9('0x10'),auth[_0x70f9('0xa')](),controller['getAgents']);router[_0x70f9('0x11')]('/',auth[_0x70f9('0xa')](),controller[_0x70f9('0x12')]);router[_0x70f9('0x11')](_0x70f9('0x13'),auth['isAuthenticated'](),controller[_0x70f9('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x70f9('0x15')]('/:id',auth[_0x70f9('0xa')](),controller[_0x70f9('0x16')]);router[_0x70f9('0x17')](_0x70f9('0x18'),auth[_0x70f9('0xa')](),controller[_0x70f9('0x19')]);router[_0x70f9('0x17')](_0x70f9('0x13'),auth[_0x70f9('0xa')](),controller['removeTeams']);router[_0x70f9('0x17')](_0x70f9('0x10'),auth['isAuthenticated'](),controller[_0x70f9('0x1a')]);module[_0x70f9('0x1b')]=router; \ No newline at end of file +var _0xd98a=['get','/describe','isAuthenticated','describe','/:id','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','index'];(function(_0x3b9fbe,_0x193298){var _0x309bd1=function(_0x28aa42){while(--_0x28aa42){_0x3b9fbe['push'](_0x3b9fbe['shift']());}};_0x309bd1(++_0x193298);}(_0xd98a,0xfc));var _0xad98=function(_0x227e46,_0x5a362f){_0x227e46=_0x227e46-0x0;var _0x3f7de0=_0xd98a[_0x227e46];return _0x3f7de0;};'use strict';var multer=require(_0xad98('0x0'));var util=require('util');var path=require('path');var express=require(_0xad98('0x1'));var router=express[_0xad98('0x2')]();var auth=require(_0xad98('0x3'));var interaction=require(_0xad98('0x4'));var config=require(_0xad98('0x5'));var controller=require(_0xad98('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xad98('0x7')]);router[_0xad98('0x8')](_0xad98('0x9'),auth[_0xad98('0xa')](),controller[_0xad98('0xb')]);router['get'](_0xad98('0xc'),auth[_0xad98('0xa')](),controller['show']);router[_0xad98('0x8')]('/:id/members',auth[_0xad98('0xa')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xad98('0xa')](),controller[_0xad98('0xd')]);router[_0xad98('0x8')](_0xad98('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xad98('0xf')]('/',auth[_0xad98('0xa')](),controller[_0xad98('0x10')]);router[_0xad98('0xf')](_0xad98('0x11'),auth[_0xad98('0xa')](),controller[_0xad98('0x12')]);router[_0xad98('0xf')](_0xad98('0xe'),auth['isAuthenticated'](),controller[_0xad98('0x13')]);router[_0xad98('0x14')](_0xad98('0xc'),auth[_0xad98('0xa')](),controller[_0xad98('0x15')]);router[_0xad98('0x16')](_0xad98('0xc'),auth[_0xad98('0xa')](),controller[_0xad98('0x17')]);router['delete']('/:id/teams',auth[_0xad98('0xa')](),controller['removeTeams']);router[_0xad98('0x16')](_0xad98('0xe'),auth[_0xad98('0xa')](),controller[_0xad98('0x18')]);module[_0xad98('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 f867165..d6cdb96 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 _0xb027=['STRING','DATE','moment','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xb027,0x16f));var _0x7b02=function(_0x16b2fa,_0x4e76dd){_0x16b2fa=_0x16b2fa-0x0;var _0x5d5a3a=_0xb027[_0x16b2fa];return _0x5d5a3a;};'use strict';var moment=require(_0x7b02('0x0'));var Sequelize=require(_0x7b02('0x1'));module[_0x7b02('0x2')]={'uniqueid':{'type':Sequelize[_0x7b02('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x7b02('0x3')]},'joinAt':{'type':Sequelize[_0x7b02('0x4')]},'leaveAt':{'type':Sequelize[_0x7b02('0x4')]},'acceptAt':{'type':Sequelize[_0x7b02('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x7b02('0x3')]}}; \ No newline at end of file +var _0x3076=['exports','DATE','STRING','sequelize'];(function(_0x34048f,_0x5f11bf){var _0x4d2ce7=function(_0x307a5d){while(--_0x307a5d){_0x34048f['push'](_0x34048f['shift']());}};_0x4d2ce7(++_0x5f11bf);}(_0x3076,0x193));var _0x6307=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0x3076[_0x22bdd3];return _0x44d9d9;};'use strict';var moment=require('moment');var Sequelize=require(_0x6307('0x0'));module[_0x6307('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x6307('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x6307('0x2')]},'exitAt':{'type':Sequelize[_0x6307('0x2')]},'reason':{'type':Sequelize[_0x6307('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index cd40947..9bd5f86 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 _0x9a34=['keys','query','dateEnd','dateStart','filters','intersection','attributes','length','nolimit','order','sort','where','pick','add','day','filter','map','merge','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','describe','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','destroy','then','stack','name','send','index','FaxQueueReport','model'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9a34,0xa6));var _0x49a3=function(_0x368fae,_0x3274ca){_0x368fae=_0x368fae-0x0;var _0x113724=_0x9a34[_0x368fae];return _0x113724;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x49a3('0x0'));var moment=require(_0x49a3('0x1'));var BPromise=require(_0x49a3('0x2'));var Mustache=require(_0x49a3('0x3'));var util=require('util');var path=require(_0x49a3('0x4'));var sox=require(_0x49a3('0x5'));var csv=require(_0x49a3('0x6'));var ejs=require(_0x49a3('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x49a3('0x8'));var crypto=require(_0x49a3('0x9'));var jsforce=require(_0x49a3('0xa'));var deskjs=require(_0x49a3('0xb'));var toCsv=require(_0x49a3('0x6'));var querystring=require(_0x49a3('0xc'));var Papa=require(_0x49a3('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x49a3('0xe'))(_0x49a3('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b3a00,_0x41318b){_0x41318b=_0x41318b||0xcc;return function(_0x5b51b0){if(_0x5b51b0){return _0x3b3a00[_0x49a3('0x10')](_0x41318b);}return _0x3b3a00[_0x49a3('0x11')](_0x41318b)[_0x49a3('0x12')]();};}function respondWithResult(_0x97616,_0x10dd67){_0x10dd67=_0x10dd67||0xc8;return function(_0x5ee51b){if(_0x5ee51b){return _0x97616[_0x49a3('0x11')](_0x10dd67)['json'](_0x5ee51b);}};}function respondWithFilteredResult(_0x5522e1,_0x393f3e){return function(_0x4142af){if(_0x4142af){var _0x19bebe=_0x4142af[_0x49a3('0x13')],_0x473f81=_0x393f3e['offset'],_0x50ac9c=_0x393f3e[_0x49a3('0x14')]+_0x393f3e[_0x49a3('0x15')],_0xeb12ea;if(_0x50ac9c>=_0x19bebe){_0x50ac9c=_0x19bebe;_0xeb12ea=0xc8;}else{_0xeb12ea=0xce;}_0x5522e1[_0x49a3('0x11')](_0xeb12ea);return _0x5522e1['set'](_0x49a3('0x16'),_0x473f81+'-'+_0x50ac9c+'/'+_0x19bebe)[_0x49a3('0x17')](_0x4142af);}return null;};}function patchUpdates(_0x4cfc7e){return function(_0x279e32){try{jsonpatch[_0x49a3('0x18')](_0x279e32,_0x4cfc7e,!![]);}catch(_0x3c3a9c){return BPromise[_0x49a3('0x19')](_0x3c3a9c);}return _0x279e32[_0x49a3('0x1a')]();};}function saveUpdates(_0x4e2071,_0x18e2e1){return function(_0xced326){if(_0xced326){return _0xced326['update'](_0x4e2071)['then'](function(_0x5e5198){return _0x5e5198;});}return null;};}function removeEntity(_0x2fb1e0,_0x5b20d5){return function(_0x438082){if(_0x438082){return _0x438082[_0x49a3('0x1b')]()[_0x49a3('0x1c')](function(){_0x2fb1e0[_0x49a3('0x11')](0xcc)[_0x49a3('0x12')]();});}};}function handleEntityNotFound(_0x1a3950,_0x1d12a8){return function(_0x340657){if(!_0x340657){_0x1a3950[_0x49a3('0x10')](0x194);}return _0x340657;};}function handleError(_0x4bb317,_0x47b57a){_0x47b57a=_0x47b57a||0x1f4;return function(_0x2ea5e7){logger['error'](_0x2ea5e7[_0x49a3('0x1d')]);if(_0x2ea5e7[_0x49a3('0x1e')]){delete _0x2ea5e7[_0x49a3('0x1e')];}_0x4bb317[_0x49a3('0x11')](_0x47b57a)[_0x49a3('0x1f')](_0x2ea5e7);};}exports[_0x49a3('0x20')]=function(_0x153467,_0x122944){var _0x10c747={},_0x54b5e8={},_0x51b96e={'count':0x0,'rows':[]};var _0x5ed68f=db[_0x49a3('0x21')]['rawAttributes'];_0x54b5e8[_0x49a3('0x22')]=_[_0x49a3('0x23')](_0x5ed68f);var _0x2ebcf8={'dateStart':_0x153467[_0x49a3('0x24')]['dateStart'],'dateEnd':_0x153467[_0x49a3('0x24')][_0x49a3('0x25')]};delete _0x153467[_0x49a3('0x24')][_0x49a3('0x26')];delete _0x153467[_0x49a3('0x24')][_0x49a3('0x25')];_0x54b5e8[_0x49a3('0x24')]=_[_0x49a3('0x23')](_0x153467['query']);_0x54b5e8[_0x49a3('0x27')]=_[_0x49a3('0x28')](_0x54b5e8[_0x49a3('0x22')],_0x54b5e8[_0x49a3('0x24')]);_0x10c747[_0x49a3('0x29')]=_[_0x49a3('0x28')](_0x54b5e8['model'],qs['fields'](_0x153467[_0x49a3('0x24')]['fields']));_0x10c747[_0x49a3('0x29')]=_0x10c747[_0x49a3('0x29')][_0x49a3('0x2a')]?_0x10c747[_0x49a3('0x29')]:_0x54b5e8['model'];if(!_0x153467[_0x49a3('0x24')]['hasOwnProperty'](_0x49a3('0x2b'))){_0x10c747[_0x49a3('0x15')]=qs[_0x49a3('0x15')](_0x153467['query'][_0x49a3('0x15')]);_0x10c747[_0x49a3('0x14')]=qs[_0x49a3('0x14')](_0x153467[_0x49a3('0x24')][_0x49a3('0x14')]);}_0x10c747[_0x49a3('0x2c')]=qs[_0x49a3('0x2d')](_0x153467[_0x49a3('0x24')][_0x49a3('0x2d')]);_0x10c747[_0x49a3('0x2e')]=qs['filters'](_[_0x49a3('0x2f')](_0x153467[_0x49a3('0x24')],_0x54b5e8[_0x49a3('0x27')]));if(_0x2ebcf8[_0x49a3('0x26')]){if(_0x2ebcf8[_0x49a3('0x25')]){_0x2ebcf8[_0x49a3('0x25')]=moment(_0x2ebcf8[_0x49a3('0x25')])[_0x49a3('0x30')](0x1,'day');}else{_0x2ebcf8[_0x49a3('0x25')]=moment(_0x2ebcf8['dateStart'])[_0x49a3('0x30')](0x1,_0x49a3('0x31'));}_['merge'](_0x10c747[_0x49a3('0x2e')],{'createdAt':{'$gte':_0x2ebcf8[_0x49a3('0x26')],'$lte':_0x2ebcf8['dateEnd']}});}if(_0x153467[_0x49a3('0x24')][_0x49a3('0x32')]){_0x10c747['where']=_['merge'](_0x10c747[_0x49a3('0x2e')],{'$or':_[_0x49a3('0x33')](_0x10c747['attributes'],function(_0x1f990e){var _0x49e7db={};_0x49e7db[_0x1f990e]={'$like':'%'+_0x153467[_0x49a3('0x24')][_0x49a3('0x32')]+'%'};return _0x49e7db;})});}_0x10c747=_[_0x49a3('0x34')]({},_0x10c747,_0x153467[_0x49a3('0x35')]);var _0x314e20={'where':_0x10c747[_0x49a3('0x2e')]};return db['FaxQueueReport'][_0x49a3('0x13')](_0x314e20)[_0x49a3('0x1c')](function(_0x43f0e1){_0x51b96e['count']=_0x43f0e1;if(_0x153467[_0x49a3('0x24')][_0x49a3('0x36')]){_0x10c747[_0x49a3('0x37')]=[{'all':!![]}];}return db[_0x49a3('0x21')][_0x49a3('0x38')](_0x10c747);})['then'](function(_0x4169c4){_0x51b96e[_0x49a3('0x39')]=_0x4169c4;return _0x51b96e;})[_0x49a3('0x1c')](respondWithFilteredResult(_0x122944,_0x10c747))[_0x49a3('0x3a')](handleError(_0x122944,null));};exports[_0x49a3('0x3b')]=function(_0x55dae6,_0x2c75bf){var _0x444276={'raw':!![],'where':{'id':_0x55dae6[_0x49a3('0x3c')]['id']}},_0x6b4699={};_0x6b4699['model']=_['keys'](db['FaxQueueReport']['rawAttributes']);_0x6b4699['query']=_[_0x49a3('0x23')](_0x55dae6[_0x49a3('0x24')]);_0x6b4699[_0x49a3('0x27')]=_[_0x49a3('0x28')](_0x6b4699[_0x49a3('0x22')],_0x6b4699[_0x49a3('0x24')]);_0x444276[_0x49a3('0x29')]=_[_0x49a3('0x28')](_0x6b4699[_0x49a3('0x22')],qs[_0x49a3('0x3d')](_0x55dae6[_0x49a3('0x24')]['fields']));_0x444276[_0x49a3('0x29')]=_0x444276[_0x49a3('0x29')][_0x49a3('0x2a')]?_0x444276[_0x49a3('0x29')]:_0x6b4699[_0x49a3('0x22')];if(_0x55dae6[_0x49a3('0x24')][_0x49a3('0x36')]){_0x444276[_0x49a3('0x37')]=[{'all':!![]}];}_0x444276=_[_0x49a3('0x34')]({},_0x444276,_0x55dae6['options']);return db['FaxQueueReport'][_0x49a3('0x3e')](_0x444276)['then'](handleEntityNotFound(_0x2c75bf,null))['then'](respondWithResult(_0x2c75bf,null))['catch'](handleError(_0x2c75bf,null));};exports[_0x49a3('0x3f')]=function(_0x2523ad,_0x14f86a){return db['FaxQueueReport'][_0x49a3('0x3f')](_0x2523ad[_0x49a3('0x40')],{})['then'](respondWithResult(_0x14f86a,0xc9))[_0x49a3('0x3a')](handleError(_0x14f86a,null));};exports[_0x49a3('0x41')]=function(_0x945b54,_0x50cbc4){if(_0x945b54[_0x49a3('0x40')]['id']){delete _0x945b54[_0x49a3('0x40')]['id'];}return db[_0x49a3('0x21')]['find']({'where':{'id':_0x945b54[_0x49a3('0x3c')]['id']}})[_0x49a3('0x1c')](handleEntityNotFound(_0x50cbc4,null))['then'](saveUpdates(_0x945b54[_0x49a3('0x40')],null))[_0x49a3('0x1c')](respondWithResult(_0x50cbc4,null))[_0x49a3('0x3a')](handleError(_0x50cbc4,null));};exports[_0x49a3('0x1b')]=function(_0x3c5fc8,_0x2d316a){return db['FaxQueueReport'][_0x49a3('0x3e')]({'where':{'id':_0x3c5fc8['params']['id']}})['then'](handleEntityNotFound(_0x2d316a,null))[_0x49a3('0x1c')](removeEntity(_0x2d316a,null))[_0x49a3('0x3a')](handleError(_0x2d316a,null));};exports[_0x49a3('0x42')]=function(_0x26888c,_0x3bde3c){return db[_0x49a3('0x21')][_0x49a3('0x42')]()[_0x49a3('0x1c')](respondWithResult(_0x3bde3c,null))[_0x49a3('0x3a')](handleError(_0x3bde3c,null));}; \ No newline at end of file +var _0xca9b=['reject','save','update','error','stack','name','send','index','FaxQueueReport','model','query','dateStart','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','options','count','then','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','describe','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xca9b,0xb4));var _0xbca9=function(_0x223689,_0x852368){_0x223689=_0x223689-0x0;var _0x71e743=_0xca9b[_0x223689];return _0x71e743;};'use strict';var jsonpatch=require(_0xbca9('0x0'));var rp=require('request-promise');var moment=require(_0xbca9('0x1'));var BPromise=require(_0xbca9('0x2'));var Mustache=require('mustache');var util=require(_0xbca9('0x3'));var path=require(_0xbca9('0x4'));var sox=require('sox');var csv=require(_0xbca9('0x5'));var ejs=require(_0xbca9('0x6'));var fs=require('fs');var _=require(_0xbca9('0x7'));var squel=require(_0xbca9('0x8'));var crypto=require(_0xbca9('0x9'));var jsforce=require(_0xbca9('0xa'));var deskjs=require(_0xbca9('0xb'));var toCsv=require(_0xbca9('0x5'));var querystring=require(_0xbca9('0xc'));var Papa=require(_0xbca9('0xd'));var qs=require(_0xbca9('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xbca9('0xf'));var config=require(_0xbca9('0x10'));var db=require(_0xbca9('0x11'))['db'];function respondWithStatusCode(_0x10878e,_0x2cb7f4){_0x2cb7f4=_0x2cb7f4||0xcc;return function(_0x26841e){if(_0x26841e){return _0x10878e[_0xbca9('0x12')](_0x2cb7f4);}return _0x10878e[_0xbca9('0x13')](_0x2cb7f4)[_0xbca9('0x14')]();};}function respondWithResult(_0x567bf9,_0x25d70a){_0x25d70a=_0x25d70a||0xc8;return function(_0x37eda1){if(_0x37eda1){return _0x567bf9[_0xbca9('0x13')](_0x25d70a)[_0xbca9('0x15')](_0x37eda1);}};}function respondWithFilteredResult(_0x22bd1f,_0x443cb0){return function(_0x1780be){if(_0x1780be){var _0x4e7f5f=_0x1780be['count'],_0x16903e=_0x443cb0[_0xbca9('0x16')],_0x50a187=_0x443cb0['offset']+_0x443cb0[_0xbca9('0x17')],_0x4b6b21;if(_0x50a187>=_0x4e7f5f){_0x50a187=_0x4e7f5f;_0x4b6b21=0xc8;}else{_0x4b6b21=0xce;}_0x22bd1f[_0xbca9('0x13')](_0x4b6b21);return _0x22bd1f[_0xbca9('0x18')](_0xbca9('0x19'),_0x16903e+'-'+_0x50a187+'/'+_0x4e7f5f)['json'](_0x1780be);}return null;};}function patchUpdates(_0x551f56){return function(_0xd3b676){try{jsonpatch[_0xbca9('0x1a')](_0xd3b676,_0x551f56,!![]);}catch(_0x2ff72d){return BPromise[_0xbca9('0x1b')](_0x2ff72d);}return _0xd3b676[_0xbca9('0x1c')]();};}function saveUpdates(_0x55aafa,_0x1b7a2b){return function(_0x596e77){if(_0x596e77){return _0x596e77[_0xbca9('0x1d')](_0x55aafa)['then'](function(_0x1eb5f3){return _0x1eb5f3;});}return null;};}function removeEntity(_0x2da435,_0x227c40){return function(_0x4a12e5){if(_0x4a12e5){return _0x4a12e5['destroy']()['then'](function(){_0x2da435[_0xbca9('0x13')](0xcc)[_0xbca9('0x14')]();});}};}function handleEntityNotFound(_0x46b91a,_0x255be7){return function(_0xdefe2e){if(!_0xdefe2e){_0x46b91a[_0xbca9('0x12')](0x194);}return _0xdefe2e;};}function handleError(_0x144bad,_0x39303f){_0x39303f=_0x39303f||0x1f4;return function(_0x3b699c){logger[_0xbca9('0x1e')](_0x3b699c[_0xbca9('0x1f')]);if(_0x3b699c[_0xbca9('0x20')]){delete _0x3b699c[_0xbca9('0x20')];}_0x144bad[_0xbca9('0x13')](_0x39303f)[_0xbca9('0x21')](_0x3b699c);};}exports[_0xbca9('0x22')]=function(_0x55a38b,_0x2060b5){var _0x43585f={},_0x3f638b={},_0x95f1c3={'count':0x0,'rows':[]};var _0x20bb63=db[_0xbca9('0x23')]['rawAttributes'];_0x3f638b[_0xbca9('0x24')]=_['keys'](_0x20bb63);var _0x2b92e5={'dateStart':_0x55a38b[_0xbca9('0x25')][_0xbca9('0x26')],'dateEnd':_0x55a38b[_0xbca9('0x25')]['dateEnd']};delete _0x55a38b[_0xbca9('0x25')][_0xbca9('0x26')];delete _0x55a38b[_0xbca9('0x25')]['dateEnd'];_0x3f638b[_0xbca9('0x25')]=_[_0xbca9('0x27')](_0x55a38b[_0xbca9('0x25')]);_0x3f638b[_0xbca9('0x28')]=_['intersection'](_0x3f638b[_0xbca9('0x24')],_0x3f638b[_0xbca9('0x25')]);_0x43585f['attributes']=_[_0xbca9('0x29')](_0x3f638b[_0xbca9('0x24')],qs[_0xbca9('0x2a')](_0x55a38b[_0xbca9('0x25')][_0xbca9('0x2a')]));_0x43585f['attributes']=_0x43585f[_0xbca9('0x2b')][_0xbca9('0x2c')]?_0x43585f[_0xbca9('0x2b')]:_0x3f638b[_0xbca9('0x24')];if(!_0x55a38b[_0xbca9('0x25')]['hasOwnProperty'](_0xbca9('0x2d'))){_0x43585f['limit']=qs[_0xbca9('0x17')](_0x55a38b['query'][_0xbca9('0x17')]);_0x43585f[_0xbca9('0x16')]=qs[_0xbca9('0x16')](_0x55a38b[_0xbca9('0x25')]['offset']);}_0x43585f[_0xbca9('0x2e')]=qs[_0xbca9('0x2f')](_0x55a38b[_0xbca9('0x25')][_0xbca9('0x2f')]);_0x43585f[_0xbca9('0x30')]=qs['filters'](_[_0xbca9('0x31')](_0x55a38b[_0xbca9('0x25')],_0x3f638b[_0xbca9('0x28')]));if(_0x2b92e5[_0xbca9('0x26')]){if(_0x2b92e5[_0xbca9('0x32')]){_0x2b92e5['dateEnd']=moment(_0x2b92e5[_0xbca9('0x32')])[_0xbca9('0x33')](0x1,_0xbca9('0x34'));}else{_0x2b92e5[_0xbca9('0x32')]=moment(_0x2b92e5[_0xbca9('0x26')])[_0xbca9('0x33')](0x1,_0xbca9('0x34'));}_[_0xbca9('0x35')](_0x43585f[_0xbca9('0x30')],{'createdAt':{'$gte':_0x2b92e5[_0xbca9('0x26')],'$lte':_0x2b92e5[_0xbca9('0x32')]}});}if(_0x55a38b['query'][_0xbca9('0x36')]){_0x43585f['where']=_['merge'](_0x43585f[_0xbca9('0x30')],{'$or':_[_0xbca9('0x37')](_0x43585f[_0xbca9('0x2b')],function(_0x57d6f9){var _0x441c76={};_0x441c76[_0x57d6f9]={'$like':'%'+_0x55a38b[_0xbca9('0x25')]['filter']+'%'};return _0x441c76;})});}_0x43585f=_['merge']({},_0x43585f,_0x55a38b[_0xbca9('0x38')]);var _0x254bed={'where':_0x43585f[_0xbca9('0x30')]};return db['FaxQueueReport'][_0xbca9('0x39')](_0x254bed)[_0xbca9('0x3a')](function(_0x104308){_0x95f1c3[_0xbca9('0x39')]=_0x104308;if(_0x55a38b[_0xbca9('0x25')][_0xbca9('0x3b')]){_0x43585f[_0xbca9('0x3c')]=[{'all':!![]}];}return db['FaxQueueReport'][_0xbca9('0x3d')](_0x43585f);})[_0xbca9('0x3a')](function(_0x1ccdb2){_0x95f1c3['rows']=_0x1ccdb2;return _0x95f1c3;})[_0xbca9('0x3a')](respondWithFilteredResult(_0x2060b5,_0x43585f))[_0xbca9('0x3e')](handleError(_0x2060b5,null));};exports[_0xbca9('0x3f')]=function(_0x562dd6,_0x582913){var _0x123251={'raw':!![],'where':{'id':_0x562dd6[_0xbca9('0x40')]['id']}},_0x4ee490={};_0x4ee490[_0xbca9('0x24')]=_[_0xbca9('0x27')](db[_0xbca9('0x23')][_0xbca9('0x41')]);_0x4ee490[_0xbca9('0x25')]=_[_0xbca9('0x27')](_0x562dd6[_0xbca9('0x25')]);_0x4ee490['filters']=_[_0xbca9('0x29')](_0x4ee490[_0xbca9('0x24')],_0x4ee490['query']);_0x123251[_0xbca9('0x2b')]=_['intersection'](_0x4ee490['model'],qs[_0xbca9('0x2a')](_0x562dd6[_0xbca9('0x25')][_0xbca9('0x2a')]));_0x123251[_0xbca9('0x2b')]=_0x123251[_0xbca9('0x2b')][_0xbca9('0x2c')]?_0x123251[_0xbca9('0x2b')]:_0x4ee490[_0xbca9('0x24')];if(_0x562dd6[_0xbca9('0x25')][_0xbca9('0x3b')]){_0x123251[_0xbca9('0x3c')]=[{'all':!![]}];}_0x123251=_[_0xbca9('0x35')]({},_0x123251,_0x562dd6['options']);return db[_0xbca9('0x23')][_0xbca9('0x42')](_0x123251)[_0xbca9('0x3a')](handleEntityNotFound(_0x582913,null))[_0xbca9('0x3a')](respondWithResult(_0x582913,null))[_0xbca9('0x3e')](handleError(_0x582913,null));};exports['create']=function(_0x258b00,_0xa3baf0){return db[_0xbca9('0x23')]['create'](_0x258b00['body'],{})[_0xbca9('0x3a')](respondWithResult(_0xa3baf0,0xc9))['catch'](handleError(_0xa3baf0,null));};exports[_0xbca9('0x1d')]=function(_0x418ac5,_0x5b29ef){if(_0x418ac5[_0xbca9('0x43')]['id']){delete _0x418ac5['body']['id'];}return db['FaxQueueReport'][_0xbca9('0x42')]({'where':{'id':_0x418ac5[_0xbca9('0x40')]['id']}})[_0xbca9('0x3a')](handleEntityNotFound(_0x5b29ef,null))[_0xbca9('0x3a')](saveUpdates(_0x418ac5[_0xbca9('0x43')],null))[_0xbca9('0x3a')](respondWithResult(_0x5b29ef,null))[_0xbca9('0x3e')](handleError(_0x5b29ef,null));};exports['destroy']=function(_0x1df081,_0x3ad187){return db[_0xbca9('0x23')][_0xbca9('0x42')]({'where':{'id':_0x1df081[_0xbca9('0x40')]['id']}})[_0xbca9('0x3a')](handleEntityNotFound(_0x3ad187,null))[_0xbca9('0x3a')](removeEntity(_0x3ad187,null))[_0xbca9('0x3e')](handleError(_0x3ad187,null));};exports[_0xbca9('0x44')]=function(_0x14c2a3,_0x1239b1){return db[_0xbca9('0x23')][_0xbca9('0x44')]()[_0xbca9('0x3a')](respondWithResult(_0x1239b1,null))[_0xbca9('0x3e')](handleError(_0x1239b1,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2f5de09..d2d512d 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 _0x9b00=['../../config/logger','bluebird','request-promise','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash','util'];(function(_0x2cb984,_0x365f50){var _0x2f73e6=function(_0x315369){while(--_0x315369){_0x2cb984['push'](_0x2cb984['shift']());}};_0x2f73e6(++_0x365f50);}(_0x9b00,0x184));var _0x09b0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9b00[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x09b0('0x0'));var util=require(_0x09b0('0x1'));var logger=require(_0x09b0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x09b0('0x3'));var rp=require(_0x09b0('0x4'));var attributes=require(_0x09b0('0x5'));module[_0x09b0('0x6')]=function(_0x22e221,_0x3263de){return _0x22e221[_0x09b0('0x7')]('FaxQueueReport',attributes,{'tableName':_0x09b0('0x8'),'paranoid':![],'indexes':[{'name':_0x09b0('0x9'),'fields':[_0x09b0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1047=['./faxQueueReport.attributes','exports','report_fax_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1047,0x11c));var _0x7104=function(_0x27b295,_0x17f598){_0x27b295=_0x27b295-0x0;var _0xd79398=_0x1047[_0x27b295];return _0xd79398;};'use strict';var _=require(_0x7104('0x0'));var util=require(_0x7104('0x1'));var logger=require(_0x7104('0x2'))(_0x7104('0x3'));var moment=require('moment');var BPromise=require(_0x7104('0x4'));var rp=require(_0x7104('0x5'));var attributes=require(_0x7104('0x6'));module[_0x7104('0x7')]=function(_0x2db81c,_0x3e2147){return _0x2db81c['define']('FaxQueueReport',attributes,{'tableName':_0x7104('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7104('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 3617c8d..529659b 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 _0xe5e7=['update','where','attributes','limit','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FaxQueueReport','body','options','CreateFaxQueueReport','UpdateFaxQueueReport'];(function(_0x47fa9c,_0x210971){var _0x3d71dc=function(_0x1e739d){while(--_0x1e739d){_0x47fa9c['push'](_0x47fa9c['shift']());}};_0x3d71dc(++_0x210971);}(_0xe5e7,0xb9));var _0x7e5e=function(_0x5c4de3,_0x4b58de){_0x5c4de3=_0x5c4de3-0x0;var _0x1e93b2=_0xe5e7[_0x5c4de3];return _0x1e93b2;};'use strict';var _=require(_0x7e5e('0x0'));var util=require(_0x7e5e('0x1'));var moment=require(_0x7e5e('0x2'));var BPromise=require(_0x7e5e('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x7e5e('0x4'))['db'];var utils=require(_0x7e5e('0x5'));var logger=require('../../config/logger')(_0x7e5e('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e5e('0x7'));var client=jayson[_0x7e5e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22ee21,_0x18b395,_0x3dd639){return new BPromise(function(_0x574717,_0x587119){return client['request'](_0x22ee21,_0x3dd639)[_0x7e5e('0x9')](function(_0x1ab3be){logger[_0x7e5e('0xa')](_0x7e5e('0xb'),_0x18b395,_0x7e5e('0xc'));logger[_0x7e5e('0xd')](_0x7e5e('0xe'),_0x18b395,_0x7e5e('0xc'),JSON[_0x7e5e('0xf')](_0x1ab3be));if(_0x1ab3be[_0x7e5e('0x10')]){if(_0x1ab3be['error'][_0x7e5e('0x11')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x18b395,_0x1ab3be[_0x7e5e('0x10')][_0x7e5e('0x12')]);return _0x587119(_0x1ab3be[_0x7e5e('0x10')][_0x7e5e('0x12')]);}logger[_0x7e5e('0x10')](_0x7e5e('0xb'),_0x18b395,_0x1ab3be[_0x7e5e('0x10')][_0x7e5e('0x12')]);return _0x574717(_0x1ab3be[_0x7e5e('0x10')][_0x7e5e('0x12')]);}else{logger[_0x7e5e('0xa')](_0x7e5e('0xb'),_0x18b395,_0x7e5e('0xc'));_0x574717(_0x1ab3be[_0x7e5e('0x13')][_0x7e5e('0x12')]);}})['catch'](function(_0x59cd8c){logger[_0x7e5e('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x18b395,_0x59cd8c);_0x587119(_0x59cd8c);});});}exports['CreateFaxQueueReport']=function(_0x4b2ab5){var _0x497b30=this;return new Promise(function(_0x23baf8,_0x382485){return db[_0x7e5e('0x14')]['create'](_0x4b2ab5[_0x7e5e('0x15')],{'raw':_0x4b2ab5[_0x7e5e('0x16')]?_0x4b2ab5[_0x7e5e('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x7e5e('0x9')](function(_0x5c24c1){logger[_0x7e5e('0xa')](_0x7e5e('0x17'),_0x4b2ab5);logger[_0x7e5e('0xd')](_0x7e5e('0x17'),_0x4b2ab5,JSON['stringify'](_0x5c24c1));_0x23baf8(_0x5c24c1);})['catch'](function(_0x308eff){logger[_0x7e5e('0x10')](_0x7e5e('0x17'),_0x308eff['message'],_0x4b2ab5);_0x382485(_0x497b30[_0x7e5e('0x10')](0x1f4,_0x308eff[_0x7e5e('0x12')]));});});};exports[_0x7e5e('0x18')]=function(_0x5cc790){var _0x2a498f=this;return new Promise(function(_0x4f69c3,_0x125604){return db['FaxQueueReport'][_0x7e5e('0x19')](_0x5cc790[_0x7e5e('0x15')],{'raw':_0x5cc790['options']?_0x5cc790[_0x7e5e('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cc790[_0x7e5e('0x16')]?_0x5cc790[_0x7e5e('0x16')][_0x7e5e('0x1a')]||null:null,'attributes':_0x5cc790[_0x7e5e('0x16')]?_0x5cc790[_0x7e5e('0x16')][_0x7e5e('0x1b')]||null:null,'limit':_0x5cc790[_0x7e5e('0x16')]?_0x5cc790[_0x7e5e('0x16')][_0x7e5e('0x1c')]||null:null})[_0x7e5e('0x9')](function(_0x183783){logger[_0x7e5e('0xa')](_0x7e5e('0x18'),_0x5cc790);logger[_0x7e5e('0xd')](_0x7e5e('0x18'),_0x5cc790,JSON['stringify'](_0x183783));_0x4f69c3(_0x183783);})[_0x7e5e('0x1d')](function(_0x3cb9eb){logger[_0x7e5e('0x10')](_0x7e5e('0x18'),_0x3cb9eb['message'],_0x5cc790);_0x125604(_0x2a498f[_0x7e5e('0x10')](0x1f4,_0x3cb9eb['message']));});});}; \ No newline at end of file +var _0xb0fd=['../../config/logger','rpc','jayson/promise','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','create','options','raw','UpdateFaxQueueReport','update','body','stringify','lodash','util','moment','bluebird','../../config/utils'];(function(_0x1baef6,_0x104b34){var _0x5f34a6=function(_0x4db449){while(--_0x4db449){_0x1baef6['push'](_0x1baef6['shift']());}};_0x5f34a6(++_0x104b34);}(_0xb0fd,0xdb));var _0xdb0f=function(_0x4c06a3,_0x1e6b6f){_0x4c06a3=_0x4c06a3-0x0;var _0x7ff53c=_0xb0fd[_0x4c06a3];return _0x7ff53c;};'use strict';var _=require(_0xdb0f('0x0'));var util=require(_0xdb0f('0x1'));var moment=require(_0xdb0f('0x2'));var BPromise=require(_0xdb0f('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xdb0f('0x4'));var logger=require(_0xdb0f('0x5'))(_0xdb0f('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb0f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26fb06,_0x58646e,_0x2b5954){return new BPromise(function(_0x4a2946,_0x588977){return client[_0xdb0f('0x8')](_0x26fb06,_0x2b5954)[_0xdb0f('0x9')](function(_0x454809){logger[_0xdb0f('0xa')](_0xdb0f('0xb'),_0x58646e,_0xdb0f('0xc'));logger[_0xdb0f('0xd')](_0xdb0f('0xe'),_0x58646e,_0xdb0f('0xc'),JSON['stringify'](_0x454809));if(_0x454809[_0xdb0f('0xf')]){if(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x10')]===0x1f4){logger[_0xdb0f('0xf')](_0xdb0f('0xb'),_0x58646e,_0x454809['error']['message']);return _0x588977(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x11')]);}logger['error'](_0xdb0f('0xb'),_0x58646e,_0x454809['error'][_0xdb0f('0x11')]);return _0x4a2946(_0x454809[_0xdb0f('0xf')][_0xdb0f('0x11')]);}else{logger[_0xdb0f('0xa')](_0xdb0f('0xb'),_0x58646e,_0xdb0f('0xc'));_0x4a2946(_0x454809[_0xdb0f('0x12')]['message']);}})[_0xdb0f('0x13')](function(_0x1c9ebb){logger['error'](_0xdb0f('0xb'),_0x58646e,_0x1c9ebb);_0x588977(_0x1c9ebb);});});}exports[_0xdb0f('0x14')]=function(_0x527d47){var _0x4b2650=this;return new Promise(function(_0x637e3f,_0x5dbeb4){return db['FaxQueueReport'][_0xdb0f('0x15')](_0x527d47['body'],{'raw':_0x527d47[_0xdb0f('0x16')]?_0x527d47[_0xdb0f('0x16')][_0xdb0f('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x3d340c){logger['info'](_0xdb0f('0x14'),_0x527d47);logger[_0xdb0f('0xd')]('CreateFaxQueueReport',_0x527d47,JSON['stringify'](_0x3d340c));_0x637e3f(_0x3d340c);})['catch'](function(_0x43bc11){logger[_0xdb0f('0xf')](_0xdb0f('0x14'),_0x43bc11['message'],_0x527d47);_0x5dbeb4(_0x4b2650['error'](0x1f4,_0x43bc11['message']));});});};exports[_0xdb0f('0x18')]=function(_0xa8b1c4){var _0x1d21ea=this;return new Promise(function(_0x39edb8,_0x39c623){return db['FaxQueueReport'][_0xdb0f('0x19')](_0xa8b1c4[_0xdb0f('0x1a')],{'raw':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4['options'][_0xdb0f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4['options']['where']||null:null,'attributes':_0xa8b1c4['options']?_0xa8b1c4[_0xdb0f('0x16')]['attributes']||null:null,'limit':_0xa8b1c4[_0xdb0f('0x16')]?_0xa8b1c4[_0xdb0f('0x16')]['limit']||null:null})[_0xdb0f('0x9')](function(_0x411db6){logger[_0xdb0f('0xa')](_0xdb0f('0x18'),_0xa8b1c4);logger[_0xdb0f('0xd')]('UpdateFaxQueueReport',_0xa8b1c4,JSON[_0xdb0f('0x1b')](_0x411db6));_0x39edb8(_0x411db6);})[_0xdb0f('0x13')](function(_0x5eb706){logger[_0xdb0f('0xf')](_0xdb0f('0x18'),_0x5eb706['message'],_0xa8b1c4);_0x39c623(_0x1d21ea[_0xdb0f('0xf')](0x1f4,_0x5eb706[_0xdb0f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index cfc7603..8ea1922 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 _0xa643=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x5d47c9,_0x73fcd5){var _0x47a510=function(_0xa93e6f){while(--_0xa93e6f){_0x5d47c9['push'](_0x5d47c9['shift']());}};_0x47a510(++_0x73fcd5);}(_0xa643,0x14d));var _0x3a64=function(_0x4bbf5e,_0x3d852f){_0x4bbf5e=_0x4bbf5e-0x0;var _0x14d065=_0xa643[_0x4bbf5e];return _0x14d065;};'use strict';var multer=require('multer');var util=require(_0x3a64('0x0'));var path=require(_0x3a64('0x1'));var express=require('express');var router=express[_0x3a64('0x2')]();var auth=require(_0x3a64('0x3'));var interaction=require(_0x3a64('0x4'));var config=require(_0x3a64('0x5'));var controller=require(_0x3a64('0x6'));router['get']('/',auth[_0x3a64('0x7')](),controller[_0x3a64('0x8')]);router[_0x3a64('0x9')](_0x3a64('0xa'),auth['isAuthenticated'](),controller[_0x3a64('0xb')]);router[_0x3a64('0x9')](_0x3a64('0xc'),auth[_0x3a64('0x7')](),controller[_0x3a64('0xd')]);router[_0x3a64('0xe')]('/',auth[_0x3a64('0x7')](),controller[_0x3a64('0xf')]);router['put'](_0x3a64('0xc'),auth['isAuthenticated'](),controller[_0x3a64('0x10')]);router[_0x3a64('0x11')](_0x3a64('0xc'),auth[_0x3a64('0x7')](),controller[_0x3a64('0x12')]);module[_0x3a64('0x13')]=router; \ No newline at end of file +var _0x8580=['isAuthenticated','get','/describe','/:id','show','post','create','put','update','delete','exports','path','express','Router','../../components/auth/service','../../config/environment','./faxQueueReport.controller'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0x8580,0x192));var _0x0858=function(_0x1f0add,_0x7c2793){_0x1f0add=_0x1f0add-0x0;var _0x16c85c=_0x8580[_0x1f0add];return _0x16c85c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0858('0x0'));var express=require(_0x0858('0x1'));var router=express[_0x0858('0x2')]();var auth=require(_0x0858('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0858('0x4'));var controller=require(_0x0858('0x5'));router['get']('/',auth[_0x0858('0x6')](),controller['index']);router[_0x0858('0x7')](_0x0858('0x8'),auth[_0x0858('0x6')](),controller['describe']);router[_0x0858('0x7')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller[_0x0858('0xa')]);router[_0x0858('0xb')]('/',auth['isAuthenticated'](),controller[_0x0858('0xc')]);router[_0x0858('0xd')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller[_0x0858('0xe')]);router[_0x0858('0xf')](_0x0858('0x9'),auth[_0x0858('0x6')](),controller['destroy']);module[_0x0858('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 4ff41cc..494efd4 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 _0x4acf=['STRING','ENUM','agent','queue','DATE','moment','sequelize','exports'];(function(_0x160264,_0x42dbfa){var _0x4b064e=function(_0x54f142){while(--_0x54f142){_0x160264['push'](_0x160264['shift']());}};_0x4b064e(++_0x42dbfa);}(_0x4acf,0x7d));var _0xf4ac=function(_0x185912,_0x5295b8){_0x185912=_0x185912-0x0;var _0x5106e4=_0x4acf[_0x185912];return _0x5106e4;};'use strict';var moment=require(_0xf4ac('0x0'));var Sequelize=require(_0xf4ac('0x1'));module[_0xf4ac('0x2')]={'uniqueid':{'type':Sequelize[_0xf4ac('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xf4ac('0x4')]('account',_0xf4ac('0x5'),_0xf4ac('0x6')),'allowNull':![],'defaultValue':_0xf4ac('0x6')},'transferredAt':{'type':Sequelize[_0xf4ac('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xbd16=['DATE','NOW','moment','exports','ENUM','account','queue'];(function(_0x2437b1,_0x3997c0){var _0x4054b6=function(_0x10f58e){while(--_0x10f58e){_0x2437b1['push'](_0x2437b1['shift']());}};_0x4054b6(++_0x3997c0);}(_0xbd16,0xbf));var _0x6bd1=function(_0x3760bc,_0x583ce3){_0x3760bc=_0x3760bc-0x0;var _0x103d18=_0xbd16[_0x3760bc];return _0x103d18;};'use strict';var moment=require(_0x6bd1('0x0'));var Sequelize=require('sequelize');module[_0x6bd1('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6bd1('0x2')](_0x6bd1('0x3'),'agent',_0x6bd1('0x4')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x6bd1('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x6bd1('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index c2d2b99..4f37bca 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 _0xb799=['name','index','FaxTransferReport','model','keys','query','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','dateEnd','day','add','merge','filter','map','options','includeAll','findAll','catch','show','params','include','create','body','find','destroy','describe','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','update','then','error','stack'];(function(_0x334928,_0x5a8621){var _0x454a8e=function(_0x248bb5){while(--_0x248bb5){_0x334928['push'](_0x334928['shift']());}};_0x454a8e(++_0x5a8621);}(_0xb799,0x163));var _0x9b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb799[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x9b79('0x0'));var moment=require(_0x9b79('0x1'));var BPromise=require(_0x9b79('0x2'));var Mustache=require(_0x9b79('0x3'));var util=require(_0x9b79('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9b79('0x5'));var squel=require(_0x9b79('0x6'));var crypto=require(_0x9b79('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x9b79('0x8'));var toCsv=require(_0x9b79('0x9'));var querystring=require(_0x9b79('0xa'));var Papa=require('papaparse');var qs=require(_0x9b79('0xb'));var logger=require('../../config/logger')(_0x9b79('0xc'));var utils=require('../../config/utils');var config=require(_0x9b79('0xd'));var db=require(_0x9b79('0xe'))['db'];function respondWithStatusCode(_0x242c3f,_0x188756){_0x188756=_0x188756||0xcc;return function(_0x135a0b){if(_0x135a0b){return _0x242c3f[_0x9b79('0xf')](_0x188756);}return _0x242c3f['status'](_0x188756)[_0x9b79('0x10')]();};}function respondWithResult(_0x4c4170,_0x464b8b){_0x464b8b=_0x464b8b||0xc8;return function(_0x4db9b6){if(_0x4db9b6){return _0x4c4170['status'](_0x464b8b)[_0x9b79('0x11')](_0x4db9b6);}};}function respondWithFilteredResult(_0x47b35f,_0x1fa8c6){return function(_0x45fbed){if(_0x45fbed){var _0x4bc1b6=_0x45fbed[_0x9b79('0x12')],_0xf8547f=_0x1fa8c6['offset'],_0x52c947=_0x1fa8c6[_0x9b79('0x13')]+_0x1fa8c6[_0x9b79('0x14')],_0x1a7a33;if(_0x52c947>=_0x4bc1b6){_0x52c947=_0x4bc1b6;_0x1a7a33=0xc8;}else{_0x1a7a33=0xce;}_0x47b35f[_0x9b79('0x15')](_0x1a7a33);return _0x47b35f[_0x9b79('0x16')](_0x9b79('0x17'),_0xf8547f+'-'+_0x52c947+'/'+_0x4bc1b6)['json'](_0x45fbed);}return null;};}function patchUpdates(_0x31dae4){return function(_0x372cc3){try{jsonpatch[_0x9b79('0x18')](_0x372cc3,_0x31dae4,!![]);}catch(_0x590c9d){return BPromise['reject'](_0x590c9d);}return _0x372cc3['save']();};}function saveUpdates(_0xd1d307,_0x11c800){return function(_0x211e88){if(_0x211e88){return _0x211e88[_0x9b79('0x19')](_0xd1d307)[_0x9b79('0x1a')](function(_0x53f8cb){return _0x53f8cb;});}return null;};}function removeEntity(_0x4e3297,_0x3f890b){return function(_0x1ad876){if(_0x1ad876){return _0x1ad876['destroy']()[_0x9b79('0x1a')](function(){_0x4e3297[_0x9b79('0x15')](0xcc)[_0x9b79('0x10')]();});}};}function handleEntityNotFound(_0x373f2a,_0x45fb2f){return function(_0x2e2591){if(!_0x2e2591){_0x373f2a[_0x9b79('0xf')](0x194);}return _0x2e2591;};}function handleError(_0x465791,_0x36c1c8){_0x36c1c8=_0x36c1c8||0x1f4;return function(_0x243034){logger[_0x9b79('0x1b')](_0x243034[_0x9b79('0x1c')]);if(_0x243034[_0x9b79('0x1d')]){delete _0x243034[_0x9b79('0x1d')];}_0x465791['status'](_0x36c1c8)['send'](_0x243034);};}exports[_0x9b79('0x1e')]=function(_0x5331ca,_0x5a8367){var _0x4c141e={},_0x42fe8d={},_0x42f1b9={'count':0x0,'rows':[]};var _0x312947=db[_0x9b79('0x1f')]['rawAttributes'];_0x42fe8d[_0x9b79('0x20')]=_[_0x9b79('0x21')](_0x312947);var _0x306467={'dateStart':_0x5331ca[_0x9b79('0x22')][_0x9b79('0x23')],'dateEnd':_0x5331ca[_0x9b79('0x22')]['dateEnd']};delete _0x5331ca[_0x9b79('0x22')][_0x9b79('0x23')];delete _0x5331ca[_0x9b79('0x22')]['dateEnd'];_0x42fe8d[_0x9b79('0x22')]=_[_0x9b79('0x21')](_0x5331ca[_0x9b79('0x22')]);_0x42fe8d[_0x9b79('0x24')]=_['intersection'](_0x42fe8d[_0x9b79('0x20')],_0x42fe8d['query']);_0x4c141e['attributes']=_[_0x9b79('0x25')](_0x42fe8d[_0x9b79('0x20')],qs[_0x9b79('0x26')](_0x5331ca['query'][_0x9b79('0x26')]));_0x4c141e['attributes']=_0x4c141e[_0x9b79('0x27')][_0x9b79('0x28')]?_0x4c141e[_0x9b79('0x27')]:_0x42fe8d[_0x9b79('0x20')];if(!_0x5331ca[_0x9b79('0x22')][_0x9b79('0x29')](_0x9b79('0x2a'))){_0x4c141e[_0x9b79('0x14')]=qs['limit'](_0x5331ca[_0x9b79('0x22')][_0x9b79('0x14')]);_0x4c141e['offset']=qs['offset'](_0x5331ca['query'][_0x9b79('0x13')]);}_0x4c141e[_0x9b79('0x2b')]=qs[_0x9b79('0x2c')](_0x5331ca[_0x9b79('0x22')][_0x9b79('0x2c')]);_0x4c141e[_0x9b79('0x2d')]=qs['filters'](_['pick'](_0x5331ca[_0x9b79('0x22')],_0x42fe8d[_0x9b79('0x24')]));if(_0x306467[_0x9b79('0x23')]){if(_0x306467[_0x9b79('0x2e')]){_0x306467['dateEnd']=moment(_0x306467[_0x9b79('0x2e')])['add'](0x1,_0x9b79('0x2f'));}else{_0x306467[_0x9b79('0x2e')]=moment(_0x306467[_0x9b79('0x23')])[_0x9b79('0x30')](0x1,_0x9b79('0x2f'));}_[_0x9b79('0x31')](_0x4c141e[_0x9b79('0x2d')],{'createdAt':{'$gte':_0x306467['dateStart'],'$lte':_0x306467[_0x9b79('0x2e')]}});}if(_0x5331ca[_0x9b79('0x22')][_0x9b79('0x32')]){_0x4c141e['where']=_[_0x9b79('0x31')](_0x4c141e[_0x9b79('0x2d')],{'$or':_[_0x9b79('0x33')](_0x4c141e[_0x9b79('0x27')],function(_0x457707){var _0x2cd418={};_0x2cd418[_0x457707]={'$like':'%'+_0x5331ca['query']['filter']+'%'};return _0x2cd418;})});}_0x4c141e=_[_0x9b79('0x31')]({},_0x4c141e,_0x5331ca[_0x9b79('0x34')]);var _0x31e014={'where':_0x4c141e[_0x9b79('0x2d')]};return db[_0x9b79('0x1f')][_0x9b79('0x12')](_0x31e014)[_0x9b79('0x1a')](function(_0x2af33c){_0x42f1b9[_0x9b79('0x12')]=_0x2af33c;if(_0x5331ca['query'][_0x9b79('0x35')]){_0x4c141e['include']=[{'all':!![]}];}return db[_0x9b79('0x1f')][_0x9b79('0x36')](_0x4c141e);})['then'](function(_0x592fdc){_0x42f1b9['rows']=_0x592fdc;return _0x42f1b9;})['then'](respondWithFilteredResult(_0x5a8367,_0x4c141e))[_0x9b79('0x37')](handleError(_0x5a8367,null));};exports[_0x9b79('0x38')]=function(_0x50aab2,_0x362375){var _0x35838d={'raw':!![],'where':{'id':_0x50aab2[_0x9b79('0x39')]['id']}},_0x4fcc05={};_0x4fcc05[_0x9b79('0x20')]=_[_0x9b79('0x21')](db[_0x9b79('0x1f')]['rawAttributes']);_0x4fcc05[_0x9b79('0x22')]=_[_0x9b79('0x21')](_0x50aab2['query']);_0x4fcc05[_0x9b79('0x24')]=_['intersection'](_0x4fcc05['model'],_0x4fcc05[_0x9b79('0x22')]);_0x35838d[_0x9b79('0x27')]=_[_0x9b79('0x25')](_0x4fcc05[_0x9b79('0x20')],qs[_0x9b79('0x26')](_0x50aab2['query'][_0x9b79('0x26')]));_0x35838d[_0x9b79('0x27')]=_0x35838d[_0x9b79('0x27')][_0x9b79('0x28')]?_0x35838d[_0x9b79('0x27')]:_0x4fcc05['model'];if(_0x50aab2[_0x9b79('0x22')]['includeAll']){_0x35838d[_0x9b79('0x3a')]=[{'all':!![]}];}_0x35838d=_[_0x9b79('0x31')]({},_0x35838d,_0x50aab2['options']);return db['FaxTransferReport']['find'](_0x35838d)['then'](handleEntityNotFound(_0x362375,null))[_0x9b79('0x1a')](respondWithResult(_0x362375,null))[_0x9b79('0x37')](handleError(_0x362375,null));};exports['create']=function(_0x28ccec,_0x5097fe){return db[_0x9b79('0x1f')][_0x9b79('0x3b')](_0x28ccec[_0x9b79('0x3c')],{})[_0x9b79('0x1a')](respondWithResult(_0x5097fe,0xc9))[_0x9b79('0x37')](handleError(_0x5097fe,null));};exports[_0x9b79('0x19')]=function(_0x404202,_0x3b8946){if(_0x404202[_0x9b79('0x3c')]['id']){delete _0x404202[_0x9b79('0x3c')]['id'];}return db[_0x9b79('0x1f')][_0x9b79('0x3d')]({'where':{'id':_0x404202[_0x9b79('0x39')]['id']}})['then'](handleEntityNotFound(_0x3b8946,null))[_0x9b79('0x1a')](saveUpdates(_0x404202[_0x9b79('0x3c')],null))[_0x9b79('0x1a')](respondWithResult(_0x3b8946,null))[_0x9b79('0x37')](handleError(_0x3b8946,null));};exports[_0x9b79('0x3e')]=function(_0x22db5c,_0x4d6dc2){return db['FaxTransferReport'][_0x9b79('0x3d')]({'where':{'id':_0x22db5c[_0x9b79('0x39')]['id']}})[_0x9b79('0x1a')](handleEntityNotFound(_0x4d6dc2,null))['then'](removeEntity(_0x4d6dc2,null))[_0x9b79('0x37')](handleError(_0x4d6dc2,null));};exports[_0x9b79('0x3f')]=function(_0x2aa6a6,_0x2ee70b){return db[_0x9b79('0x1f')][_0x9b79('0x3f')]()[_0x9b79('0x1a')](respondWithResult(_0x2ee70b,null))['catch'](handleError(_0x2ee70b,null));}; \ No newline at end of file +var _0xf863=['rows','show','params','includeAll','include','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','add','day','merge','filter','map','options','FaxTransferReport'];(function(_0x359eb9,_0x408dbd){var _0x3cba6d=function(_0x2edbf9){while(--_0x2edbf9){_0x359eb9['push'](_0x359eb9['shift']());}};_0x3cba6d(++_0x408dbd);}(_0xf863,0x117));var _0x3f86=function(_0x223283,_0x7eeb6a){_0x223283=_0x223283-0x0;var _0x4a9347=_0xf863[_0x223283];return _0x4a9347;};'use strict';var jsonpatch=require(_0x3f86('0x0'));var rp=require(_0x3f86('0x1'));var moment=require('moment');var BPromise=require(_0x3f86('0x2'));var Mustache=require('mustache');var util=require(_0x3f86('0x3'));var path=require(_0x3f86('0x4'));var sox=require(_0x3f86('0x5'));var csv=require(_0x3f86('0x6'));var ejs=require(_0x3f86('0x7'));var fs=require('fs');var _=require(_0x3f86('0x8'));var squel=require(_0x3f86('0x9'));var crypto=require(_0x3f86('0xa'));var jsforce=require(_0x3f86('0xb'));var deskjs=require(_0x3f86('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f86('0xd'));var Papa=require(_0x3f86('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x3f86('0xf'))(_0x3f86('0x10'));var utils=require(_0x3f86('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b5584,_0x23b79d){_0x23b79d=_0x23b79d||0xcc;return function(_0xcc8dfd){if(_0xcc8dfd){return _0x1b5584[_0x3f86('0x12')](_0x23b79d);}return _0x1b5584['status'](_0x23b79d)[_0x3f86('0x13')]();};}function respondWithResult(_0x5e76d1,_0x1ed632){_0x1ed632=_0x1ed632||0xc8;return function(_0x130366){if(_0x130366){return _0x5e76d1[_0x3f86('0x14')](_0x1ed632)[_0x3f86('0x15')](_0x130366);}};}function respondWithFilteredResult(_0xd6d0b6,_0x4373f8){return function(_0x2f5104){if(_0x2f5104){var _0x1fa9e0=_0x2f5104[_0x3f86('0x16')],_0x46a5d6=_0x4373f8[_0x3f86('0x17')],_0x36bf79=_0x4373f8['offset']+_0x4373f8[_0x3f86('0x18')],_0x470946;if(_0x36bf79>=_0x1fa9e0){_0x36bf79=_0x1fa9e0;_0x470946=0xc8;}else{_0x470946=0xce;}_0xd6d0b6[_0x3f86('0x14')](_0x470946);return _0xd6d0b6['set'](_0x3f86('0x19'),_0x46a5d6+'-'+_0x36bf79+'/'+_0x1fa9e0)[_0x3f86('0x15')](_0x2f5104);}return null;};}function patchUpdates(_0x2b5004){return function(_0x3bbf31){try{jsonpatch[_0x3f86('0x1a')](_0x3bbf31,_0x2b5004,!![]);}catch(_0x23535e){return BPromise[_0x3f86('0x1b')](_0x23535e);}return _0x3bbf31[_0x3f86('0x1c')]();};}function saveUpdates(_0x5b7bd8,_0x105299){return function(_0x573d3a){if(_0x573d3a){return _0x573d3a[_0x3f86('0x1d')](_0x5b7bd8)[_0x3f86('0x1e')](function(_0x2425c9){return _0x2425c9;});}return null;};}function removeEntity(_0x4f2f5b,_0x429429){return function(_0x367379){if(_0x367379){return _0x367379['destroy']()[_0x3f86('0x1e')](function(){_0x4f2f5b[_0x3f86('0x14')](0xcc)[_0x3f86('0x13')]();});}};}function handleEntityNotFound(_0x8d7d66,_0x307bbd){return function(_0x2d87f4){if(!_0x2d87f4){_0x8d7d66[_0x3f86('0x12')](0x194);}return _0x2d87f4;};}function handleError(_0xe2e1b6,_0x28da68){_0x28da68=_0x28da68||0x1f4;return function(_0x23cfcf){logger[_0x3f86('0x1f')](_0x23cfcf[_0x3f86('0x20')]);if(_0x23cfcf[_0x3f86('0x21')]){delete _0x23cfcf[_0x3f86('0x21')];}_0xe2e1b6[_0x3f86('0x14')](_0x28da68)[_0x3f86('0x22')](_0x23cfcf);};}exports['index']=function(_0x1cf3e4,_0x2c3782){var _0xd94e1b={},_0x471eec={},_0x2a74d3={'count':0x0,'rows':[]};var _0xe12fd4=db['FaxTransferReport'][_0x3f86('0x23')];_0x471eec[_0x3f86('0x24')]=_[_0x3f86('0x25')](_0xe12fd4);var _0x4b9fd4={'dateStart':_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x27')],'dateEnd':_0x1cf3e4['query'][_0x3f86('0x28')]};delete _0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x27')];delete _0x1cf3e4['query'][_0x3f86('0x28')];_0x471eec['query']=_[_0x3f86('0x25')](_0x1cf3e4[_0x3f86('0x26')]);_0x471eec[_0x3f86('0x29')]=_[_0x3f86('0x2a')](_0x471eec[_0x3f86('0x24')],_0x471eec[_0x3f86('0x26')]);_0xd94e1b[_0x3f86('0x2b')]=_['intersection'](_0x471eec['model'],qs['fields'](_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x2c')]));_0xd94e1b[_0x3f86('0x2b')]=_0xd94e1b[_0x3f86('0x2b')][_0x3f86('0x2d')]?_0xd94e1b[_0x3f86('0x2b')]:_0x471eec['model'];if(!_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x2e')](_0x3f86('0x2f'))){_0xd94e1b[_0x3f86('0x18')]=qs[_0x3f86('0x18')](_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x18')]);_0xd94e1b[_0x3f86('0x17')]=qs[_0x3f86('0x17')](_0x1cf3e4['query']['offset']);}_0xd94e1b['order']=qs['sort'](_0x1cf3e4[_0x3f86('0x26')]['sort']);_0xd94e1b[_0x3f86('0x30')]=qs[_0x3f86('0x29')](_['pick'](_0x1cf3e4[_0x3f86('0x26')],_0x471eec[_0x3f86('0x29')]));if(_0x4b9fd4[_0x3f86('0x27')]){if(_0x4b9fd4[_0x3f86('0x28')]){_0x4b9fd4[_0x3f86('0x28')]=moment(_0x4b9fd4['dateEnd'])[_0x3f86('0x31')](0x1,_0x3f86('0x32'));}else{_0x4b9fd4[_0x3f86('0x28')]=moment(_0x4b9fd4[_0x3f86('0x27')])[_0x3f86('0x31')](0x1,_0x3f86('0x32'));}_[_0x3f86('0x33')](_0xd94e1b[_0x3f86('0x30')],{'createdAt':{'$gte':_0x4b9fd4[_0x3f86('0x27')],'$lte':_0x4b9fd4['dateEnd']}});}if(_0x1cf3e4['query'][_0x3f86('0x34')]){_0xd94e1b[_0x3f86('0x30')]=_[_0x3f86('0x33')](_0xd94e1b[_0x3f86('0x30')],{'$or':_[_0x3f86('0x35')](_0xd94e1b['attributes'],function(_0x39a35c){var _0x1f295e={};_0x1f295e[_0x39a35c]={'$like':'%'+_0x1cf3e4[_0x3f86('0x26')][_0x3f86('0x34')]+'%'};return _0x1f295e;})});}_0xd94e1b=_[_0x3f86('0x33')]({},_0xd94e1b,_0x1cf3e4[_0x3f86('0x36')]);var _0x57490d={'where':_0xd94e1b['where']};return db[_0x3f86('0x37')][_0x3f86('0x16')](_0x57490d)[_0x3f86('0x1e')](function(_0x3befd8){_0x2a74d3[_0x3f86('0x16')]=_0x3befd8;if(_0x1cf3e4[_0x3f86('0x26')]['includeAll']){_0xd94e1b['include']=[{'all':!![]}];}return db[_0x3f86('0x37')]['findAll'](_0xd94e1b);})[_0x3f86('0x1e')](function(_0x1e441b){_0x2a74d3[_0x3f86('0x38')]=_0x1e441b;return _0x2a74d3;})[_0x3f86('0x1e')](respondWithFilteredResult(_0x2c3782,_0xd94e1b))['catch'](handleError(_0x2c3782,null));};exports[_0x3f86('0x39')]=function(_0x2d302c,_0x14f594){var _0x567bfb={'raw':!![],'where':{'id':_0x2d302c[_0x3f86('0x3a')]['id']}},_0x2f9712={};_0x2f9712['model']=_[_0x3f86('0x25')](db[_0x3f86('0x37')][_0x3f86('0x23')]);_0x2f9712['query']=_[_0x3f86('0x25')](_0x2d302c['query']);_0x2f9712['filters']=_[_0x3f86('0x2a')](_0x2f9712[_0x3f86('0x24')],_0x2f9712[_0x3f86('0x26')]);_0x567bfb[_0x3f86('0x2b')]=_[_0x3f86('0x2a')](_0x2f9712[_0x3f86('0x24')],qs[_0x3f86('0x2c')](_0x2d302c['query']['fields']));_0x567bfb[_0x3f86('0x2b')]=_0x567bfb[_0x3f86('0x2b')][_0x3f86('0x2d')]?_0x567bfb[_0x3f86('0x2b')]:_0x2f9712[_0x3f86('0x24')];if(_0x2d302c[_0x3f86('0x26')][_0x3f86('0x3b')]){_0x567bfb[_0x3f86('0x3c')]=[{'all':!![]}];}_0x567bfb=_[_0x3f86('0x33')]({},_0x567bfb,_0x2d302c['options']);return db['FaxTransferReport'][_0x3f86('0x3d')](_0x567bfb)[_0x3f86('0x1e')](handleEntityNotFound(_0x14f594,null))[_0x3f86('0x1e')](respondWithResult(_0x14f594,null))[_0x3f86('0x3e')](handleError(_0x14f594,null));};exports[_0x3f86('0x3f')]=function(_0x1f15fb,_0x202408){return db['FaxTransferReport']['create'](_0x1f15fb[_0x3f86('0x40')],{})['then'](respondWithResult(_0x202408,0xc9))['catch'](handleError(_0x202408,null));};exports[_0x3f86('0x1d')]=function(_0x219dda,_0x41b5ff){if(_0x219dda[_0x3f86('0x40')]['id']){delete _0x219dda[_0x3f86('0x40')]['id'];}return db[_0x3f86('0x37')][_0x3f86('0x3d')]({'where':{'id':_0x219dda['params']['id']}})[_0x3f86('0x1e')](handleEntityNotFound(_0x41b5ff,null))[_0x3f86('0x1e')](saveUpdates(_0x219dda['body'],null))[_0x3f86('0x1e')](respondWithResult(_0x41b5ff,null))[_0x3f86('0x3e')](handleError(_0x41b5ff,null));};exports[_0x3f86('0x41')]=function(_0x155fb8,_0x5844dc){return db['FaxTransferReport'][_0x3f86('0x3d')]({'where':{'id':_0x155fb8[_0x3f86('0x3a')]['id']}})[_0x3f86('0x1e')](handleEntityNotFound(_0x5844dc,null))[_0x3f86('0x1e')](removeEntity(_0x5844dc,null))[_0x3f86('0x3e')](handleError(_0x5844dc,null));};exports[_0x3f86('0x42')]=function(_0xdf273d,_0x27dbed){return db['FaxTransferReport'][_0x3f86('0x42')]()[_0x3f86('0x1e')](respondWithResult(_0x27dbed,null))['catch'](handleError(_0x27dbed,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index a75c2f2..7bfb9c5 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 _0x3e9b=['define','FaxTransferReport','report_fax_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./faxTransferReport.attributes','exports'];(function(_0x4b4a48,_0xc5efd4){var _0x4d06a3=function(_0x43b260){while(--_0x43b260){_0x4b4a48['push'](_0x4b4a48['shift']());}};_0x4d06a3(++_0xc5efd4);}(_0x3e9b,0x1cb));var _0xb3e9=function(_0x3356e0,_0x1cfd96){_0x3356e0=_0x3356e0-0x0;var _0x64060d=_0x3e9b[_0x3356e0];return _0x64060d;};'use strict';var _=require(_0xb3e9('0x0'));var util=require(_0xb3e9('0x1'));var logger=require(_0xb3e9('0x2'))(_0xb3e9('0x3'));var moment=require(_0xb3e9('0x4'));var BPromise=require(_0xb3e9('0x5'));var rp=require(_0xb3e9('0x6'));var attributes=require(_0xb3e9('0x7'));module[_0xb3e9('0x8')]=function(_0x4cdcb5,_0x3e5b0f){return _0x4cdcb5[_0xb3e9('0x9')](_0xb3e9('0xa'),attributes,{'tableName':_0xb3e9('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa44=['moment','bluebird','request-promise','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xfa44,0x8c));var _0x4fa4=function(_0x3cba93,_0x5c2fd8){_0x3cba93=_0x3cba93-0x0;var _0x4a2991=_0xfa44[_0x3cba93];return _0x4a2991;};'use strict';var _=require(_0x4fa4('0x0'));var util=require(_0x4fa4('0x1'));var logger=require('../../config/logger')(_0x4fa4('0x2'));var moment=require(_0x4fa4('0x3'));var BPromise=require(_0x4fa4('0x4'));var rp=require(_0x4fa4('0x5'));var attributes=require(_0x4fa4('0x6'));module[_0x4fa4('0x7')]=function(_0x4dcced,_0xadc7d6){return _0x4dcced['define'](_0x4fa4('0x8'),attributes,{'tableName':_0x4fa4('0x9'),'paranoid':![],'indexes':[{'name':_0x4fa4('0xa'),'fields':[_0x4fa4('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 839a841..c9ed288 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 _0xe364=['debug','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','../../config/logger','../../config/environment','client','http','request','request\x20sent'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xe364,0x104));var _0x4e36=function(_0x115621,_0x341cde){_0x115621=_0x115621-0x0;var _0x5ef5ce=_0xe364[_0x115621];return _0x5ef5ce;};'use strict';var _=require(_0x4e36('0x0'));var util=require('util');var moment=require(_0x4e36('0x1'));var BPromise=require(_0x4e36('0x2'));var rs=require(_0x4e36('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e36('0x4'))('rpc');var config=require(_0x4e36('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x4e36('0x6')][_0x4e36('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e24b6,_0x425d64,_0x45cadd){return new BPromise(function(_0x16b6b7,_0x39a300){return client[_0x4e36('0x8')](_0x1e24b6,_0x45cadd)['then'](function(_0x596659){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x425d64,_0x4e36('0x9'));logger[_0x4e36('0xa')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x425d64,'request\x20sent',JSON[_0x4e36('0xb')](_0x596659));if(_0x596659['error']){if(_0x596659[_0x4e36('0xc')][_0x4e36('0xd')]===0x1f4){logger[_0x4e36('0xc')](_0x4e36('0xe'),_0x425d64,_0x596659[_0x4e36('0xc')][_0x4e36('0xf')]);return _0x39a300(_0x596659[_0x4e36('0xc')][_0x4e36('0xf')]);}logger[_0x4e36('0xc')](_0x4e36('0xe'),_0x425d64,_0x596659[_0x4e36('0xc')]['message']);return _0x16b6b7(_0x596659['error']['message']);}else{logger['info'](_0x4e36('0xe'),_0x425d64,_0x4e36('0x9'));_0x16b6b7(_0x596659[_0x4e36('0x10')]['message']);}})[_0x4e36('0x11')](function(_0x39410c){logger[_0x4e36('0xc')](_0x4e36('0xe'),_0x425d64,_0x39410c);_0x39a300(_0x39410c);});});} \ No newline at end of file +var _0x53d3=['request\x20sent','debug','stringify','error','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x53d3,0xd8));var _0x353d=function(_0x9a6054,_0x5a23ed){_0x9a6054=_0x9a6054-0x0;var _0x48e88c=_0x53d3[_0x9a6054];return _0x48e88c;};'use strict';var _=require(_0x353d('0x0'));var util=require('util');var moment=require(_0x353d('0x1'));var BPromise=require(_0x353d('0x2'));var rs=require(_0x353d('0x3'));var fs=require('fs');var db=require(_0x353d('0x4'))['db'];var utils=require(_0x353d('0x5'));var logger=require(_0x353d('0x6'))('rpc');var config=require(_0x353d('0x7'));var jayson=require(_0x353d('0x8'));var client=jayson[_0x353d('0x9')][_0x353d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x363d2d,_0x77ea11,_0x3c8f0b){return new BPromise(function(_0x112b86,_0x30ac83){return client[_0x353d('0xb')](_0x363d2d,_0x3c8f0b)[_0x353d('0xc')](function(_0xa5bc76){logger[_0x353d('0xd')](_0x353d('0xe'),_0x77ea11,_0x353d('0xf'));logger[_0x353d('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x77ea11,_0x353d('0xf'),JSON[_0x353d('0x11')](_0xa5bc76));if(_0xa5bc76[_0x353d('0x12')]){if(_0xa5bc76[_0x353d('0x12')]['code']===0x1f4){logger[_0x353d('0x12')](_0x353d('0xe'),_0x77ea11,_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);return _0x30ac83(_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);}logger[_0x353d('0x12')](_0x353d('0xe'),_0x77ea11,_0xa5bc76[_0x353d('0x12')][_0x353d('0x13')]);return _0x112b86(_0xa5bc76['error']['message']);}else{logger[_0x353d('0xd')](_0x353d('0xe'),_0x77ea11,_0x353d('0xf'));_0x112b86(_0xa5bc76['result'][_0x353d('0x13')]);}})[_0x353d('0x14')](function(_0x2dd0c4){logger['error'](_0x353d('0xe'),_0x77ea11,_0x2dd0c4);_0x30ac83(_0x2dd0c4);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 1fdee8a..49e45ef 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 _0xdcab=['describe','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0xdcab,0x1e9));var _0xbdca=function(_0x2e6d65,_0x3ab9e6){_0x2e6d65=_0x2e6d65-0x0;var _0x17b72d=_0xdcab[_0x2e6d65];return _0x17b72d;};'use strict';var multer=require(_0xbdca('0x0'));var util=require(_0xbdca('0x1'));var path=require(_0xbdca('0x2'));var express=require(_0xbdca('0x3'));var router=express[_0xbdca('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbdca('0x5'));var controller=require(_0xbdca('0x6'));router[_0xbdca('0x7')]('/',auth[_0xbdca('0x8')](),controller[_0xbdca('0x9')]);router[_0xbdca('0x7')](_0xbdca('0xa'),auth[_0xbdca('0x8')](),controller[_0xbdca('0xb')]);router[_0xbdca('0x7')]('/:id',auth[_0xbdca('0x8')](),controller['show']);router[_0xbdca('0xc')]('/',auth[_0xbdca('0x8')](),controller[_0xbdca('0xd')]);router[_0xbdca('0xe')](_0xbdca('0xf'),auth[_0xbdca('0x8')](),controller[_0xbdca('0x10')]);router[_0xbdca('0x11')](_0xbdca('0xf'),auth['isAuthenticated'](),controller[_0xbdca('0x12')]);module[_0xbdca('0x13')]=router; \ No newline at end of file +var _0x8c99=['put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create'];(function(_0x4694a9,_0x82531f){var _0x596dc8=function(_0x24c97f){while(--_0x24c97f){_0x4694a9['push'](_0x4694a9['shift']());}};_0x596dc8(++_0x82531f);}(_0x8c99,0x1a8));var _0x98c9=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x8c99[_0x214266];return _0x568f75;};'use strict';var multer=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var path=require(_0x98c9('0x2'));var express=require(_0x98c9('0x3'));var router=express[_0x98c9('0x4')]();var auth=require(_0x98c9('0x5'));var interaction=require(_0x98c9('0x6'));var config=require(_0x98c9('0x7'));var controller=require(_0x98c9('0x8'));router[_0x98c9('0x9')]('/',auth[_0x98c9('0xa')](),controller[_0x98c9('0xb')]);router['get'](_0x98c9('0xc'),auth[_0x98c9('0xa')](),controller['describe']);router['get']('/:id',auth[_0x98c9('0xa')](),controller[_0x98c9('0xd')]);router[_0x98c9('0xe')]('/',auth[_0x98c9('0xa')](),controller[_0x98c9('0xf')]);router[_0x98c9('0x10')](_0x98c9('0x11'),auth[_0x98c9('0xa')](),controller[_0x98c9('0x12')]);router[_0x98c9('0x13')](_0x98c9('0x11'),auth['isAuthenticated'](),controller[_0x98c9('0x14')]);module[_0x98c9('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 1e9faeb..94d5aaa 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 _0x207c=['create','addConfiguration','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x5c71d2,_0x3f5557){var _0x34d47e=function(_0xc9087d){while(--_0xc9087d){_0x5c71d2['push'](_0x5c71d2['shift']());}};_0x34d47e(++_0x3f5557);}(_0x207c,0x1e8));var _0xc207=function(_0x282f68,_0x239640){_0x282f68=_0x282f68-0x0;var _0x1aba38=_0x207c[_0x282f68];return _0x1aba38;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var express=require(_0xc207('0x2'));var router=express[_0xc207('0x3')]();var auth=require(_0xc207('0x4'));var interaction=require(_0xc207('0x5'));var config=require(_0xc207('0x6'));var controller=require('./intDeskAccount.controller');router[_0xc207('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xc207('0x8'),auth[_0xc207('0x9')](),controller[_0xc207('0xa')]);router['get'](_0xc207('0xb'),auth[_0xc207('0x9')](),controller[_0xc207('0xc')]);router['get'](_0xc207('0xd'),auth[_0xc207('0x9')](),controller[_0xc207('0xe')]);router[_0xc207('0xf')]('/',auth[_0xc207('0x9')](),controller[_0xc207('0x10')]);router['post']('/:id/configurations',auth['isAuthenticated'](),controller[_0xc207('0x11')]);router['put'](_0xc207('0x8'),auth[_0xc207('0x9')](),controller['update']);router[_0xc207('0x12')](_0xc207('0x8'),auth[_0xc207('0x9')](),controller[_0xc207('0x13')]);module[_0xc207('0x14')]=router; \ No newline at end of file +var _0xf109=['create','addConfiguration','put','update','delete','destroy','multer','util','path','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post'];(function(_0x221d9f,_0x11ec04){var _0x3dd059=function(_0x685dbc){while(--_0x685dbc){_0x221d9f['push'](_0x221d9f['shift']());}};_0x3dd059(++_0x11ec04);}(_0xf109,0xce));var _0x9f10=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xf109[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var path=require(_0x9f10('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9f10('0x3'));var config=require(_0x9f10('0x4'));var controller=require(_0x9f10('0x5'));router[_0x9f10('0x6')]('/',auth[_0x9f10('0x7')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x7')](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')]('/:id/configurations',auth[_0x9f10('0x7')](),controller[_0x9f10('0xb')]);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x7')](),controller['getFields']);router[_0x9f10('0xd')]('/',auth[_0x9f10('0x7')](),controller[_0x9f10('0xe')]);router['post']('/:id/configurations',auth[_0x9f10('0x7')](),controller[_0x9f10('0xf')]);router[_0x9f10('0x10')]('/:id',auth[_0x9f10('0x7')](),controller[_0x9f10('0x11')]);router[_0x9f10('0x12')]('/:id',auth[_0x9f10('0x7')](),controller[_0x9f10('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 966b23f..726470d 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 _0x85bf=['newTab','exports','STRING','ENUM','basic','integrationTab'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x85bf,0xd9));var _0xf85b=function(_0x168fd3,_0x11fbbd){_0x168fd3=_0x168fd3-0x0;var _0x47f2b7=_0x85bf[_0x168fd3];return _0x47f2b7;};'use strict';var Sequelize=require('sequelize');module[_0xf85b('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf85b('0x1')]},'remoteUri':{'type':Sequelize[_0xf85b('0x1')]},'authType':{'type':Sequelize[_0xf85b('0x2')](_0xf85b('0x3')),'defaultValue':_0xf85b('0x3')},'password':{'type':Sequelize[_0xf85b('0x1')]},'consumerKey':{'type':Sequelize[_0xf85b('0x1')]},'consumerSecret':{'type':Sequelize[_0xf85b('0x1')]},'token':{'type':Sequelize[_0xf85b('0x1')]},'tokenSecret':{'type':Sequelize[_0xf85b('0x1')]},'serverUrl':{'type':Sequelize[_0xf85b('0x1')]},'type':{'type':Sequelize['ENUM'](_0xf85b('0x4'),_0xf85b('0x5')),'defaultValue':_0xf85b('0x4')}}; \ No newline at end of file +var _0x4608=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x5b2f2c,_0x481fb6){var _0x5e37d2=function(_0x29a88c){while(--_0x29a88c){_0x5b2f2c['push'](_0x5b2f2c['shift']());}};_0x5e37d2(++_0x481fb6);}(_0x4608,0x1dd));var _0x8460=function(_0x582efe,_0x2f9ad8){_0x582efe=_0x582efe-0x0;var _0x4973f1=_0x4608[_0x582efe];return _0x4973f1;};'use strict';var Sequelize=require(_0x8460('0x0'));module[_0x8460('0x1')]={'name':{'type':Sequelize[_0x8460('0x2')]},'description':{'type':Sequelize[_0x8460('0x2')]},'username':{'type':Sequelize[_0x8460('0x2')]},'remoteUri':{'type':Sequelize[_0x8460('0x2')]},'authType':{'type':Sequelize[_0x8460('0x3')](_0x8460('0x4')),'defaultValue':_0x8460('0x4')},'password':{'type':Sequelize[_0x8460('0x2')]},'consumerKey':{'type':Sequelize[_0x8460('0x2')]},'consumerSecret':{'type':Sequelize[_0x8460('0x2')]},'token':{'type':Sequelize[_0x8460('0x2')]},'tokenSecret':{'type':Sequelize[_0x8460('0x2')]},'serverUrl':{'type':Sequelize[_0x8460('0x2')]},'type':{'type':Sequelize[_0x8460('0x3')](_0x8460('0x5'),_0x8460('0x6')),'defaultValue':_0x8460('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 302b84c..6060d3a 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 _0x191a=['token','tokenSecret','GET','format','basic','Authorization','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','then','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','DeskAccount,\x20%s,\x20%s','message','result','catch','end','status','json','count','Content-Range','save','update','destroy','sendStatus','stack','name','index','DeskAccount','rawAttributes','model','query','dateStart','keys','filters','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','dateEnd','day','add','merge','filter','where','map','options','includeAll','include','rows','show','params','find','create','body','findOne','DeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','type','DeskField','Descriptions','getFields','priority','remoteUri','authType','username','password','consumerSecret'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x191a,0xef));var _0xa191=function(_0x520672,_0x2ecff4){_0x520672=_0x520672-0x0;var _0x14aa6d=_0x191a[_0x520672];return _0x14aa6d;};'use strict';var jsonpatch=require(_0xa191('0x0'));var rp=require('request-promise');var moment=require(_0xa191('0x1'));var BPromise=require(_0xa191('0x2'));var Mustache=require(_0xa191('0x3'));var util=require(_0xa191('0x4'));var path=require(_0xa191('0x5'));var sox=require(_0xa191('0x6'));var csv=require(_0xa191('0x7'));var ejs=require(_0xa191('0x8'));var fs=require('fs');var _=require(_0xa191('0x9'));var squel=require(_0xa191('0xa'));var crypto=require(_0xa191('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa191('0xc'));var toCsv=require(_0xa191('0x7'));var querystring=require('querystring');var Papa=require(_0xa191('0xd'));var qs=require(_0xa191('0xe'));var logger=require('../../config/logger')(_0xa191('0xf'));var utils=require(_0xa191('0x10'));var config=require(_0xa191('0x11'));var db=require(_0xa191('0x12'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xa191('0x13'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x21eb93,_0x264af5,_0x3cec84,_0x2cab3c){return new BPromise(function(_0x3088cf,_0x100bd4){var _0x1436b5=_0x2cab3c||client;return _0x1436b5['request'](_0x21eb93,_0x3cec84)[_0xa191('0x14')](function(_0x4d5c90){logger['info']('DeskAccount,\x20%s,\x20%s',_0x264af5,_0xa191('0x15'));logger[_0xa191('0x16')](_0xa191('0x17'),_0x264af5,_0xa191('0x15'),JSON['stringify'](_0x4d5c90));if(_0x4d5c90[_0xa191('0x18')]){if(_0x4d5c90[_0xa191('0x18')]['code']===0x1f4){logger[_0xa191('0x18')](_0xa191('0x19'),_0x264af5,_0x4d5c90[_0xa191('0x18')][_0xa191('0x1a')]);return _0x100bd4(_0x4d5c90[_0xa191('0x18')][_0xa191('0x1a')]);}logger[_0xa191('0x18')](_0xa191('0x19'),_0x264af5,_0x4d5c90['error'][_0xa191('0x1a')]);return _0x3088cf(_0x4d5c90[_0xa191('0x18')][_0xa191('0x1a')]);}else{logger['info'](_0xa191('0x19'),_0x264af5,_0xa191('0x15'));_0x3088cf(_0x4d5c90[_0xa191('0x1b')][_0xa191('0x1a')]);}})[_0xa191('0x1c')](function(_0x51e09c){logger[_0xa191('0x18')](_0xa191('0x19'),_0x264af5,_0x51e09c);_0x100bd4(_0x51e09c);});});}function respondWithStatusCode(_0x2784ed,_0xe86b8c){_0xe86b8c=_0xe86b8c||0xcc;return function(_0x2ecf1e){if(_0x2ecf1e){return _0x2784ed['sendStatus'](_0xe86b8c);}return _0x2784ed['status'](_0xe86b8c)[_0xa191('0x1d')]();};}function respondWithResult(_0x2515f2,_0x569cda){_0x569cda=_0x569cda||0xc8;return function(_0x3d9e2c){if(_0x3d9e2c){return _0x2515f2[_0xa191('0x1e')](_0x569cda)[_0xa191('0x1f')](_0x3d9e2c);}};}function respondWithFilteredResult(_0x346788,_0x3cbc94){return function(_0x53e8be){if(_0x53e8be){var _0x48383c=_0x53e8be[_0xa191('0x20')],_0x13a9cb=_0x3cbc94['offset'],_0x247cc1=_0x3cbc94['offset']+_0x3cbc94['limit'],_0x31e756;if(_0x247cc1>=_0x48383c){_0x247cc1=_0x48383c;_0x31e756=0xc8;}else{_0x31e756=0xce;}_0x346788[_0xa191('0x1e')](_0x31e756);return _0x346788['set'](_0xa191('0x21'),_0x13a9cb+'-'+_0x247cc1+'/'+_0x48383c)[_0xa191('0x1f')](_0x53e8be);}return null;};}function patchUpdates(_0x4a4ef0){return function(_0x193a7c){try{jsonpatch['apply'](_0x193a7c,_0x4a4ef0,!![]);}catch(_0x189ab9){return BPromise['reject'](_0x189ab9);}return _0x193a7c[_0xa191('0x22')]();};}function saveUpdates(_0x584b5b,_0x1f7c43){return function(_0xf732ed){if(_0xf732ed){return _0xf732ed[_0xa191('0x23')](_0x584b5b)[_0xa191('0x14')](function(_0xf89222){return _0xf89222;});}return null;};}function removeEntity(_0x4ccd92,_0x1a6fb3){return function(_0x3c136e){if(_0x3c136e){return _0x3c136e[_0xa191('0x24')]()[_0xa191('0x14')](function(){_0x4ccd92[_0xa191('0x1e')](0xcc)[_0xa191('0x1d')]();});}};}function handleEntityNotFound(_0x4a60c0,_0x407e96){return function(_0x649632){if(!_0x649632){_0x4a60c0[_0xa191('0x25')](0x194);}return _0x649632;};}function handleError(_0x1267a8,_0x299c8f){_0x299c8f=_0x299c8f||0x1f4;return function(_0x5b29e2){logger[_0xa191('0x18')](_0x5b29e2[_0xa191('0x26')]);if(_0x5b29e2[_0xa191('0x27')]){delete _0x5b29e2[_0xa191('0x27')];}_0x1267a8[_0xa191('0x1e')](_0x299c8f)['send'](_0x5b29e2);};}exports[_0xa191('0x28')]=function(_0x1ffe1e,_0x1e798d){var _0x1511f0={},_0x5a5d58={},_0x23fe53={'count':0x0,'rows':[]};var _0x44e4a0=db[_0xa191('0x29')][_0xa191('0x2a')];_0x5a5d58[_0xa191('0x2b')]=_['keys'](_0x44e4a0);var _0x4c4a71={'dateStart':_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x2d')],'dateEnd':_0x1ffe1e[_0xa191('0x2c')]['dateEnd']};delete _0x1ffe1e[_0xa191('0x2c')]['dateStart'];delete _0x1ffe1e['query']['dateEnd'];_0x5a5d58[_0xa191('0x2c')]=_[_0xa191('0x2e')](_0x1ffe1e[_0xa191('0x2c')]);_0x5a5d58[_0xa191('0x2f')]=_[_0xa191('0x30')](_0x5a5d58[_0xa191('0x2b')],_0x5a5d58['query']);_0x1511f0[_0xa191('0x31')]=_['intersection'](_0x5a5d58[_0xa191('0x2b')],qs[_0xa191('0x32')](_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x32')]));_0x1511f0['attributes']=_0x1511f0[_0xa191('0x31')][_0xa191('0x33')]?_0x1511f0['attributes']:_0x5a5d58['model'];if(!_0x1ffe1e[_0xa191('0x2c')]['hasOwnProperty'](_0xa191('0x34'))){_0x1511f0[_0xa191('0x35')]=qs[_0xa191('0x35')](_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x35')]);_0x1511f0[_0xa191('0x36')]=qs[_0xa191('0x36')](_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x36')]);}_0x1511f0[_0xa191('0x37')]=qs[_0xa191('0x38')](_0x1ffe1e['query'][_0xa191('0x38')]);_0x1511f0['where']=qs[_0xa191('0x2f')](_['pick'](_0x1ffe1e[_0xa191('0x2c')],_0x5a5d58[_0xa191('0x2f')]));if(_0x4c4a71[_0xa191('0x2d')]){if(_0x4c4a71['dateEnd']){_0x4c4a71['dateEnd']=moment(_0x4c4a71[_0xa191('0x39')])['add'](0x1,_0xa191('0x3a'));}else{_0x4c4a71[_0xa191('0x39')]=moment(_0x4c4a71[_0xa191('0x2d')])[_0xa191('0x3b')](0x1,'day');}_[_0xa191('0x3c')](_0x1511f0['where'],{'createdAt':{'$gte':_0x4c4a71[_0xa191('0x2d')],'$lte':_0x4c4a71[_0xa191('0x39')]}});}if(_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x3d')]){_0x1511f0[_0xa191('0x3e')]=_[_0xa191('0x3c')](_0x1511f0[_0xa191('0x3e')],{'$or':_[_0xa191('0x3f')](_0x1511f0[_0xa191('0x31')],function(_0xb83bc3){var _0x1adf96={};_0x1adf96[_0xb83bc3]={'$like':'%'+_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x3d')]+'%'};return _0x1adf96;})});}_0x1511f0=_[_0xa191('0x3c')]({},_0x1511f0,_0x1ffe1e[_0xa191('0x40')]);var _0x16091b={'where':_0x1511f0[_0xa191('0x3e')]};return db[_0xa191('0x29')][_0xa191('0x20')](_0x16091b)[_0xa191('0x14')](function(_0x2f67a4){_0x23fe53[_0xa191('0x20')]=_0x2f67a4;if(_0x1ffe1e[_0xa191('0x2c')][_0xa191('0x41')]){_0x1511f0[_0xa191('0x42')]=[{'all':!![]}];}return db[_0xa191('0x29')]['findAll'](_0x1511f0);})['then'](function(_0x44c600){_0x23fe53[_0xa191('0x43')]=_0x44c600;return _0x23fe53;})['then'](respondWithFilteredResult(_0x1e798d,_0x1511f0))[_0xa191('0x1c')](handleError(_0x1e798d,null));};exports[_0xa191('0x44')]=function(_0x58434f,_0x3137bf){var _0x11c7ce={'raw':![],'where':{'id':_0x58434f[_0xa191('0x45')]['id']}},_0x5cdb87={};_0x5cdb87[_0xa191('0x2b')]=_[_0xa191('0x2e')](db[_0xa191('0x29')][_0xa191('0x2a')]);_0x5cdb87[_0xa191('0x2c')]=_[_0xa191('0x2e')](_0x58434f[_0xa191('0x2c')]);_0x5cdb87[_0xa191('0x2f')]=_[_0xa191('0x30')](_0x5cdb87[_0xa191('0x2b')],_0x5cdb87['query']);_0x11c7ce[_0xa191('0x31')]=_[_0xa191('0x30')](_0x5cdb87[_0xa191('0x2b')],qs[_0xa191('0x32')](_0x58434f[_0xa191('0x2c')][_0xa191('0x32')]));_0x11c7ce[_0xa191('0x31')]=_0x11c7ce[_0xa191('0x31')][_0xa191('0x33')]?_0x11c7ce[_0xa191('0x31')]:_0x5cdb87[_0xa191('0x2b')];if(_0x58434f[_0xa191('0x2c')][_0xa191('0x41')]){_0x11c7ce[_0xa191('0x42')]=[{'all':!![]}];}_0x11c7ce=_[_0xa191('0x3c')]({},_0x11c7ce,_0x58434f['options']);return db[_0xa191('0x29')][_0xa191('0x46')](_0x11c7ce)[_0xa191('0x14')](handleEntityNotFound(_0x3137bf,null))[_0xa191('0x14')](respondWithResult(_0x3137bf,null))['catch'](handleError(_0x3137bf,null));};exports[_0xa191('0x47')]=function(_0x1cb44c,_0xc9f86d){return db[_0xa191('0x29')]['create'](_0x1cb44c[_0xa191('0x48')],{})[_0xa191('0x14')](respondWithResult(_0xc9f86d,0xc9))[_0xa191('0x1c')](handleError(_0xc9f86d,null));};exports['update']=function(_0x42f741,_0x4c92aa){if(_0x42f741[_0xa191('0x48')]['id']){delete _0x42f741[_0xa191('0x48')]['id'];}return db['DeskAccount'][_0xa191('0x46')]({'where':{'id':_0x42f741[_0xa191('0x45')]['id']}})[_0xa191('0x14')](handleEntityNotFound(_0x4c92aa,null))[_0xa191('0x14')](saveUpdates(_0x42f741[_0xa191('0x48')],null))[_0xa191('0x14')](respondWithResult(_0x4c92aa,null))[_0xa191('0x1c')](handleError(_0x4c92aa,null));};exports[_0xa191('0x24')]=function(_0x312ede,_0x3a3859){return db[_0xa191('0x29')][_0xa191('0x46')]({'where':{'id':_0x312ede[_0xa191('0x45')]['id']}})[_0xa191('0x14')](handleEntityNotFound(_0x3a3859,null))[_0xa191('0x14')](removeEntity(_0x3a3859,null))[_0xa191('0x1c')](handleError(_0x3a3859,null));};exports['getConfigurations']=function(_0x2c7cfe,_0x2361e4,_0x39f9f6){var _0x2c39f5={};var _0x3e9dfa={};var _0x4164c5;var _0x266393;return db[_0xa191('0x29')][_0xa191('0x49')]({'where':{'id':_0x2c7cfe[_0xa191('0x45')]['id']}})[_0xa191('0x14')](handleEntityNotFound(_0x2361e4,null))[_0xa191('0x14')](function(_0x53007d){if(_0x53007d){_0x4164c5=_0x53007d;_0x3e9dfa['model']=_[_0xa191('0x2e')](db[_0xa191('0x4a')][_0xa191('0x2a')]);_0x3e9dfa[_0xa191('0x2c')]=_[_0xa191('0x2e')](_0x2c7cfe[_0xa191('0x2c')]);_0x3e9dfa[_0xa191('0x2f')]=_[_0xa191('0x30')](_0x3e9dfa['model'],_0x3e9dfa['query']);_0x2c39f5[_0xa191('0x31')]=_['intersection'](_0x3e9dfa[_0xa191('0x2b')],qs[_0xa191('0x32')](_0x2c7cfe['query'][_0xa191('0x32')]));_0x2c39f5[_0xa191('0x31')]=_0x2c39f5[_0xa191('0x31')]['length']?_0x2c39f5['attributes']:_0x3e9dfa[_0xa191('0x2b')];_0x2c39f5['order']=qs[_0xa191('0x38')](_0x2c7cfe['query'][_0xa191('0x38')]);_0x2c39f5[_0xa191('0x3e')]=qs[_0xa191('0x2f')](_['pick'](_0x2c7cfe[_0xa191('0x2c')],_0x3e9dfa[_0xa191('0x2f')]));if(_0x2c7cfe[_0xa191('0x2c')][_0xa191('0x3d')]){_0x2c39f5['where']=_['merge'](_0x2c39f5['where'],{'$or':_[_0xa191('0x3f')](_0x2c39f5[_0xa191('0x31')],function(_0x4caf85){var _0xe9c2da={};_0xe9c2da[_0x4caf85]={'$like':'%'+_0x2c7cfe[_0xa191('0x2c')][_0xa191('0x3d')]+'%'};return _0xe9c2da;})});}_0x2c39f5=_[_0xa191('0x3c')]({},_0x2c39f5,_0x2c7cfe[_0xa191('0x40')]);return _0x4164c5[_0xa191('0x4b')](_0x2c39f5);}})[_0xa191('0x14')](function(_0x541def){if(_0x541def){_0x266393=_0x541def['length'];if(!_0x2c7cfe[_0xa191('0x2c')][_0xa191('0x4c')](_0xa191('0x34'))){_0x2c39f5[_0xa191('0x35')]=qs[_0xa191('0x35')](_0x2c7cfe['query'][_0xa191('0x35')]);_0x2c39f5[_0xa191('0x36')]=qs[_0xa191('0x36')](_0x2c7cfe[_0xa191('0x2c')][_0xa191('0x36')]);}return _0x4164c5[_0xa191('0x4b')](_0x2c39f5);}})[_0xa191('0x14')](function(_0x5bfa7f){if(_0x5bfa7f){return _0x5bfa7f?{'count':_0x266393,'rows':_0x5bfa7f}:null;}})[_0xa191('0x14')](respondWithResult(_0x2361e4,null))[_0xa191('0x1c')](handleError(_0x2361e4,null));};exports[_0xa191('0x4d')]=function(_0x5c3fca,_0xfd5a26,_0x53e770){if(_0x5c3fca[_0xa191('0x48')]['id']){delete _0x5c3fca[_0xa191('0x48')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x5c3fca[_0xa191('0x45')]['id']}})[_0xa191('0x14')](handleEntityNotFound(_0xfd5a26,null))['then'](function(_0x39bb47){if(_0x39bb47){_0x5c3fca['body']['AccountId']=_0x39bb47['id'];_0x5c3fca[_0xa191('0x48')][_0xa191('0x4e')]=integrations[_0xa191('0x4f')](_0x5c3fca[_0xa191('0x48')][_0xa191('0x50')],_0x5c3fca['body'][_0xa191('0x51')]);_0x5c3fca['body']['Descriptions']=integrations['getDescriptions'](_0x5c3fca[_0xa191('0x48')][_0xa191('0x50')],_0x5c3fca[_0xa191('0x48')][_0xa191('0x51')]);return db[_0xa191('0x4a')][_0xa191('0x47')](_0x5c3fca['body'],{'include':[{'model':db['DeskField'],'as':_0xa191('0x4e')},{'model':db[_0xa191('0x52')],'as':_0xa191('0x53')}]});}return null;})[_0xa191('0x14')](respondWithResult(_0xfd5a26,null))['catch'](handleError(_0xfd5a26,null));};exports[_0xa191('0x54')]=function(_0x5421d2,_0x60e99f,_0x38fc72){var _0x46dafb=[{'name':_0xa191('0x55'),'label':_0xa191('0x55'),'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}]}];return db[_0xa191('0x29')]['findOne']({'where':{'id':_0x5421d2[_0xa191('0x45')]['id']},'attributes':['id',_0xa191('0x56'),_0xa191('0x57'),_0xa191('0x58'),_0xa191('0x59'),'consumerKey',_0xa191('0x5a'),_0xa191('0x5b'),_0xa191('0x5c')]})[_0xa191('0x14')](handleEntityNotFound(_0x60e99f,null))[_0xa191('0x14')](function(_0xf34238){if(_0xf34238){var _0x9c1da2={'method':_0xa191('0x5d'),'uri':util[_0xa191('0x5e')]('%s/custom_fields',_0xf34238[_0xa191('0x56')]),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0xf34238[_0xa191('0x57')]===_0xa191('0x5f')){_0x9c1da2['headers'][_0xa191('0x60')]=util[_0xa191('0x5e')]('Basic\x20%s',new Buffer(util['format'](_0xa191('0x61'),_0xf34238[_0xa191('0x58')],_0xf34238[_0xa191('0x59')]))[_0xa191('0x62')](_0xa191('0x63')));}return rp(_0x9c1da2)[_0xa191('0x14')](function(_0x48d8c5){return _0x46dafb[_0xa191('0x64')](_[_0xa191('0x3f')](_0x48d8c5['_embedded'][_0xa191('0x65')],function(_0x3d7433){return{'id':_0x3d7433[_0xa191('0x27')],'name':_0x3d7433[_0xa191('0x27')],'type':_0x3d7433[_0xa191('0x51')],'active':_0x3d7433[_0xa191('0x66')],'label':_0x3d7433[_0xa191('0x67')],'custom':!![]};}));});}})[_0xa191('0x14')](function(_0x1bc6cb){return{'count':_0x1bc6cb[_0xa191('0x33')],'rows':_0x1bc6cb};})[_0xa191('0x14')](respondWithResult(_0x60e99f,null))['catch'](function(_0x507907){var _0x12d85d=_0x5421d2[_0xa191('0x2c')][_0xa191('0x68')]?0x1f4:_0x507907[_0xa191('0x69')]||0x1f4;logger[_0xa191('0x18')](_0xa191('0x6a'),'getFields',_0x12d85d,JSON[_0xa191('0x6b')](_0x507907));delete _0x507907[_0xa191('0x27')];if(_0x12d85d===0x191){_0x12d85d=0x190;}_0x60e99f[_0xa191('0x1e')](_0x12d85d)[_0xa191('0x6c')](_0x5421d2[_0xa191('0x2c')][_0xa191('0x68')]?{'message':_0xa191('0x6d'),'statusCode':_0x507907[_0xa191('0x69')]}:_0x507907);});}; \ No newline at end of file +var _0x5a7b=['mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','request','then','info','DeskAccount,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','end','name','send','index','DeskAccount','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','add','merge','where','map','filter','options','includeAll','findAll','rows','show','params','find','create','body','destroy','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','username','password','consumerKey','consumerSecret','tokenSecret','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','getFields,\x20%s,\x20%s,\x20%s','stringify','test','statusCode','fast-json-patch','request-promise','moment'];(function(_0x264872,_0x21298c){var _0x206a64=function(_0x239300){while(--_0x239300){_0x264872['push'](_0x264872['shift']());}};_0x206a64(++_0x21298c);}(_0x5a7b,0x1c5));var _0xb5a7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5a7b[_0x14add3];return _0x4a174f;};'use strict';var jsonpatch=require(_0xb5a7('0x0'));var rp=require(_0xb5a7('0x1'));var moment=require(_0xb5a7('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb5a7('0x3'));var util=require('util');var path=require(_0xb5a7('0x4'));var sox=require(_0xb5a7('0x5'));var csv=require('to-csv');var ejs=require(_0xb5a7('0x6'));var fs=require('fs');var _=require(_0xb5a7('0x7'));var squel=require(_0xb5a7('0x8'));var crypto=require(_0xb5a7('0x9'));var jsforce=require(_0xb5a7('0xa'));var deskjs=require(_0xb5a7('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xb5a7('0xc'));var logger=require(_0xb5a7('0xd'))('api');var utils=require(_0xb5a7('0xe'));var config=require(_0xb5a7('0xf'));var db=require(_0xb5a7('0x10'))['db'];var integrations=require(_0xb5a7('0x11'));var jayson=require('jayson/promise');var client=jayson[_0xb5a7('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53fcca,_0x13804b,_0x6e23d,_0x338434){return new BPromise(function(_0x31cd23,_0x34579d){var _0x208009=_0x338434||client;return _0x208009[_0xb5a7('0x13')](_0x53fcca,_0x6e23d)[_0xb5a7('0x14')](function(_0x53e794){logger[_0xb5a7('0x15')](_0xb5a7('0x16'),_0x13804b,'request\x20sent');logger[_0xb5a7('0x17')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x13804b,_0xb5a7('0x18'),JSON['stringify'](_0x53e794));if(_0x53e794[_0xb5a7('0x19')]){if(_0x53e794[_0xb5a7('0x19')]['code']===0x1f4){logger['error'](_0xb5a7('0x16'),_0x13804b,_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);return _0x34579d(_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);}logger['error'](_0xb5a7('0x16'),_0x13804b,_0x53e794['error'][_0xb5a7('0x1a')]);return _0x31cd23(_0x53e794[_0xb5a7('0x19')][_0xb5a7('0x1a')]);}else{logger[_0xb5a7('0x15')](_0xb5a7('0x16'),_0x13804b,_0xb5a7('0x18'));_0x31cd23(_0x53e794['result'][_0xb5a7('0x1a')]);}})[_0xb5a7('0x1b')](function(_0x57cd77){logger[_0xb5a7('0x19')]('DeskAccount,\x20%s,\x20%s',_0x13804b,_0x57cd77);_0x34579d(_0x57cd77);});});}function respondWithStatusCode(_0x4b271a,_0x18b229){_0x18b229=_0x18b229||0xcc;return function(_0x12eced){if(_0x12eced){return _0x4b271a[_0xb5a7('0x1c')](_0x18b229);}return _0x4b271a[_0xb5a7('0x1d')](_0x18b229)['end']();};}function respondWithResult(_0x479ae4,_0x4b0e0b){_0x4b0e0b=_0x4b0e0b||0xc8;return function(_0x2512c6){if(_0x2512c6){return _0x479ae4['status'](_0x4b0e0b)[_0xb5a7('0x1e')](_0x2512c6);}};}function respondWithFilteredResult(_0x3c4ca8,_0x15973a){return function(_0x53edee){if(_0x53edee){var _0x483a99=_0x53edee[_0xb5a7('0x1f')],_0x43c914=_0x15973a[_0xb5a7('0x20')],_0x24c47a=_0x15973a['offset']+_0x15973a[_0xb5a7('0x21')],_0x198b6e;if(_0x24c47a>=_0x483a99){_0x24c47a=_0x483a99;_0x198b6e=0xc8;}else{_0x198b6e=0xce;}_0x3c4ca8['status'](_0x198b6e);return _0x3c4ca8['set'](_0xb5a7('0x22'),_0x43c914+'-'+_0x24c47a+'/'+_0x483a99)[_0xb5a7('0x1e')](_0x53edee);}return null;};}function patchUpdates(_0x24eb8c){return function(_0x148233){try{jsonpatch[_0xb5a7('0x23')](_0x148233,_0x24eb8c,!![]);}catch(_0x1d8a52){return BPromise[_0xb5a7('0x24')](_0x1d8a52);}return _0x148233[_0xb5a7('0x25')]();};}function saveUpdates(_0x46451e,_0x5c20f3){return function(_0x8eb128){if(_0x8eb128){return _0x8eb128[_0xb5a7('0x26')](_0x46451e)[_0xb5a7('0x14')](function(_0x399e89){return _0x399e89;});}return null;};}function removeEntity(_0x583ce6,_0x3d6de1){return function(_0x54947a){if(_0x54947a){return _0x54947a['destroy']()[_0xb5a7('0x14')](function(){_0x583ce6[_0xb5a7('0x1d')](0xcc)[_0xb5a7('0x27')]();});}};}function handleEntityNotFound(_0x25708d,_0x4d2d22){return function(_0x177295){if(!_0x177295){_0x25708d[_0xb5a7('0x1c')](0x194);}return _0x177295;};}function handleError(_0x2c62da,_0x2fcdbd){_0x2fcdbd=_0x2fcdbd||0x1f4;return function(_0x2706ce){logger[_0xb5a7('0x19')](_0x2706ce['stack']);if(_0x2706ce['name']){delete _0x2706ce[_0xb5a7('0x28')];}_0x2c62da[_0xb5a7('0x1d')](_0x2fcdbd)[_0xb5a7('0x29')](_0x2706ce);};}exports[_0xb5a7('0x2a')]=function(_0x52328a,_0x1d0860){var _0x2061bc={},_0x92e0b2={},_0x5db8d2={'count':0x0,'rows':[]};var _0x39c0ad=db[_0xb5a7('0x2b')][_0xb5a7('0x2c')];_0x92e0b2[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](_0x39c0ad);var _0x54d55f={'dateStart':_0x52328a['query']['dateStart'],'dateEnd':_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x30')]};delete _0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x31')];delete _0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x30')];_0x92e0b2[_0xb5a7('0x2f')]=_[_0xb5a7('0x2e')](_0x52328a[_0xb5a7('0x2f')]);_0x92e0b2[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x92e0b2['model'],_0x92e0b2[_0xb5a7('0x2f')]);_0x2061bc['attributes']=_[_0xb5a7('0x33')](_0x92e0b2[_0xb5a7('0x2d')],qs[_0xb5a7('0x34')](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x34')]));_0x2061bc['attributes']=_0x2061bc[_0xb5a7('0x35')][_0xb5a7('0x36')]?_0x2061bc[_0xb5a7('0x35')]:_0x92e0b2[_0xb5a7('0x2d')];if(!_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x37')](_0xb5a7('0x38'))){_0x2061bc[_0xb5a7('0x21')]=qs[_0xb5a7('0x21')](_0x52328a['query'][_0xb5a7('0x21')]);_0x2061bc[_0xb5a7('0x20')]=qs['offset'](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x20')]);}_0x2061bc[_0xb5a7('0x39')]=qs['sort'](_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x3a')]);_0x2061bc['where']=qs[_0xb5a7('0x32')](_['pick'](_0x52328a[_0xb5a7('0x2f')],_0x92e0b2[_0xb5a7('0x32')]));if(_0x54d55f[_0xb5a7('0x31')]){if(_0x54d55f[_0xb5a7('0x30')]){_0x54d55f['dateEnd']=moment(_0x54d55f[_0xb5a7('0x30')])[_0xb5a7('0x3b')](0x1,'day');}else{_0x54d55f[_0xb5a7('0x30')]=moment(_0x54d55f[_0xb5a7('0x31')])[_0xb5a7('0x3b')](0x1,'day');}_[_0xb5a7('0x3c')](_0x2061bc[_0xb5a7('0x3d')],{'createdAt':{'$gte':_0x54d55f[_0xb5a7('0x31')],'$lte':_0x54d55f['dateEnd']}});}if(_0x52328a[_0xb5a7('0x2f')]['filter']){_0x2061bc[_0xb5a7('0x3d')]=_[_0xb5a7('0x3c')](_0x2061bc['where'],{'$or':_[_0xb5a7('0x3e')](_0x2061bc[_0xb5a7('0x35')],function(_0x55082b){var _0x4acd97={};_0x4acd97[_0x55082b]={'$like':'%'+_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x3f')]+'%'};return _0x4acd97;})});}_0x2061bc=_[_0xb5a7('0x3c')]({},_0x2061bc,_0x52328a[_0xb5a7('0x40')]);var _0x4e6dc3={'where':_0x2061bc[_0xb5a7('0x3d')]};return db[_0xb5a7('0x2b')][_0xb5a7('0x1f')](_0x4e6dc3)[_0xb5a7('0x14')](function(_0x30f0af){_0x5db8d2['count']=_0x30f0af;if(_0x52328a[_0xb5a7('0x2f')][_0xb5a7('0x41')]){_0x2061bc['include']=[{'all':!![]}];}return db[_0xb5a7('0x2b')][_0xb5a7('0x42')](_0x2061bc);})['then'](function(_0x251180){_0x5db8d2[_0xb5a7('0x43')]=_0x251180;return _0x5db8d2;})[_0xb5a7('0x14')](respondWithFilteredResult(_0x1d0860,_0x2061bc))[_0xb5a7('0x1b')](handleError(_0x1d0860,null));};exports[_0xb5a7('0x44')]=function(_0x229192,_0x454641){var _0x49f519={'raw':![],'where':{'id':_0x229192[_0xb5a7('0x45')]['id']}},_0x4f6915={};_0x4f6915[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](db[_0xb5a7('0x2b')]['rawAttributes']);_0x4f6915[_0xb5a7('0x2f')]=_[_0xb5a7('0x2e')](_0x229192[_0xb5a7('0x2f')]);_0x4f6915[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x4f6915[_0xb5a7('0x2d')],_0x4f6915[_0xb5a7('0x2f')]);_0x49f519['attributes']=_['intersection'](_0x4f6915[_0xb5a7('0x2d')],qs[_0xb5a7('0x34')](_0x229192[_0xb5a7('0x2f')][_0xb5a7('0x34')]));_0x49f519[_0xb5a7('0x35')]=_0x49f519[_0xb5a7('0x35')][_0xb5a7('0x36')]?_0x49f519[_0xb5a7('0x35')]:_0x4f6915[_0xb5a7('0x2d')];if(_0x229192['query'][_0xb5a7('0x41')]){_0x49f519['include']=[{'all':!![]}];}_0x49f519=_[_0xb5a7('0x3c')]({},_0x49f519,_0x229192[_0xb5a7('0x40')]);return db[_0xb5a7('0x2b')][_0xb5a7('0x46')](_0x49f519)[_0xb5a7('0x14')](handleEntityNotFound(_0x454641,null))[_0xb5a7('0x14')](respondWithResult(_0x454641,null))[_0xb5a7('0x1b')](handleError(_0x454641,null));};exports[_0xb5a7('0x47')]=function(_0x57dbe4,_0x16832e){return db[_0xb5a7('0x2b')]['create'](_0x57dbe4[_0xb5a7('0x48')],{})['then'](respondWithResult(_0x16832e,0xc9))[_0xb5a7('0x1b')](handleError(_0x16832e,null));};exports['update']=function(_0xdf3dff,_0x4bfc1b){if(_0xdf3dff['body']['id']){delete _0xdf3dff[_0xb5a7('0x48')]['id'];}return db['DeskAccount'][_0xb5a7('0x46')]({'where':{'id':_0xdf3dff[_0xb5a7('0x45')]['id']}})['then'](handleEntityNotFound(_0x4bfc1b,null))['then'](saveUpdates(_0xdf3dff[_0xb5a7('0x48')],null))[_0xb5a7('0x14')](respondWithResult(_0x4bfc1b,null))[_0xb5a7('0x1b')](handleError(_0x4bfc1b,null));};exports[_0xb5a7('0x49')]=function(_0x56f164,_0x29b789){return db[_0xb5a7('0x2b')][_0xb5a7('0x46')]({'where':{'id':_0x56f164[_0xb5a7('0x45')]['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0x29b789,null))[_0xb5a7('0x14')](removeEntity(_0x29b789,null))[_0xb5a7('0x1b')](handleError(_0x29b789,null));};exports[_0xb5a7('0x4a')]=function(_0x45e4a3,_0x25f63b,_0x28424c){var _0x2ff83a={};var _0x3ad3a7={};var _0xc5dd19;var _0xe55e04;return db[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0x45e4a3['params']['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0x25f63b,null))['then'](function(_0x2834ce){if(_0x2834ce){_0xc5dd19=_0x2834ce;_0x3ad3a7[_0xb5a7('0x2d')]=_[_0xb5a7('0x2e')](db['DeskConfiguration']['rawAttributes']);_0x3ad3a7[_0xb5a7('0x2f')]=_['keys'](_0x45e4a3[_0xb5a7('0x2f')]);_0x3ad3a7[_0xb5a7('0x32')]=_[_0xb5a7('0x33')](_0x3ad3a7[_0xb5a7('0x2d')],_0x3ad3a7[_0xb5a7('0x2f')]);_0x2ff83a[_0xb5a7('0x35')]=_['intersection'](_0x3ad3a7[_0xb5a7('0x2d')],qs['fields'](_0x45e4a3[_0xb5a7('0x2f')]['fields']));_0x2ff83a[_0xb5a7('0x35')]=_0x2ff83a[_0xb5a7('0x35')]['length']?_0x2ff83a[_0xb5a7('0x35')]:_0x3ad3a7[_0xb5a7('0x2d')];_0x2ff83a[_0xb5a7('0x39')]=qs[_0xb5a7('0x3a')](_0x45e4a3[_0xb5a7('0x2f')]['sort']);_0x2ff83a[_0xb5a7('0x3d')]=qs[_0xb5a7('0x32')](_[_0xb5a7('0x4c')](_0x45e4a3[_0xb5a7('0x2f')],_0x3ad3a7[_0xb5a7('0x32')]));if(_0x45e4a3[_0xb5a7('0x2f')][_0xb5a7('0x3f')]){_0x2ff83a[_0xb5a7('0x3d')]=_[_0xb5a7('0x3c')](_0x2ff83a[_0xb5a7('0x3d')],{'$or':_['map'](_0x2ff83a[_0xb5a7('0x35')],function(_0x914cc){var _0x54056f={};_0x54056f[_0x914cc]={'$like':'%'+_0x45e4a3[_0xb5a7('0x2f')]['filter']+'%'};return _0x54056f;})});}_0x2ff83a=_[_0xb5a7('0x3c')]({},_0x2ff83a,_0x45e4a3[_0xb5a7('0x40')]);return _0xc5dd19['getConfigurations'](_0x2ff83a);}})[_0xb5a7('0x14')](function(_0x333dcb){if(_0x333dcb){_0xe55e04=_0x333dcb[_0xb5a7('0x36')];if(!_0x45e4a3['query']['hasOwnProperty'](_0xb5a7('0x38'))){_0x2ff83a[_0xb5a7('0x21')]=qs['limit'](_0x45e4a3[_0xb5a7('0x2f')][_0xb5a7('0x21')]);_0x2ff83a[_0xb5a7('0x20')]=qs[_0xb5a7('0x20')](_0x45e4a3['query'][_0xb5a7('0x20')]);}return _0xc5dd19[_0xb5a7('0x4a')](_0x2ff83a);}})[_0xb5a7('0x14')](function(_0x534d28){if(_0x534d28){return _0x534d28?{'count':_0xe55e04,'rows':_0x534d28}:null;}})[_0xb5a7('0x14')](respondWithResult(_0x25f63b,null))[_0xb5a7('0x1b')](handleError(_0x25f63b,null));};exports[_0xb5a7('0x4d')]=function(_0xdda242,_0xa0d742,_0x18bafb){if(_0xdda242['body']['id']){delete _0xdda242[_0xb5a7('0x48')]['id'];}return db[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0xdda242[_0xb5a7('0x45')]['id']}})[_0xb5a7('0x14')](handleEntityNotFound(_0xa0d742,null))[_0xb5a7('0x14')](function(_0x17c1a2){if(_0x17c1a2){_0xdda242['body'][_0xb5a7('0x4e')]=_0x17c1a2['id'];_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x4f')]=integrations[_0xb5a7('0x50')](_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x51')],_0xdda242['body'][_0xb5a7('0x52')]);_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x53')]=integrations[_0xb5a7('0x54')](_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x51')],_0xdda242[_0xb5a7('0x48')][_0xb5a7('0x52')]);return db['DeskConfiguration'][_0xb5a7('0x47')](_0xdda242[_0xb5a7('0x48')],{'include':[{'model':db[_0xb5a7('0x55')],'as':_0xb5a7('0x4f')},{'model':db[_0xb5a7('0x55')],'as':'Descriptions'}]});}return null;})[_0xb5a7('0x14')](respondWithResult(_0xa0d742,null))[_0xb5a7('0x1b')](handleError(_0xa0d742,null));};exports[_0xb5a7('0x56')]=function(_0x220b21,_0x521bd4,_0x43d6b0){var _0x34a3c8=[{'name':_0xb5a7('0x57'),'label':_0xb5a7('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];return db[_0xb5a7('0x2b')][_0xb5a7('0x4b')]({'where':{'id':_0x220b21[_0xb5a7('0x45')]['id']},'attributes':['id',_0xb5a7('0x58'),'authType',_0xb5a7('0x59'),_0xb5a7('0x5a'),_0xb5a7('0x5b'),_0xb5a7('0x5c'),'token',_0xb5a7('0x5d')]})['then'](handleEntityNotFound(_0x521bd4,null))[_0xb5a7('0x14')](function(_0x50052f){if(_0x50052f){var _0x572fda={'method':_0xb5a7('0x5e'),'uri':util[_0xb5a7('0x5f')](_0xb5a7('0x60'),_0x50052f[_0xb5a7('0x58')]),'headers':{'Content-Type':_0xb5a7('0x61'),'Accept':'application/json'},'json':!![]};if(_0x50052f[_0xb5a7('0x62')]===_0xb5a7('0x63')){_0x572fda[_0xb5a7('0x64')][_0xb5a7('0x65')]=util['format'](_0xb5a7('0x66'),new Buffer(util[_0xb5a7('0x5f')](_0xb5a7('0x67'),_0x50052f[_0xb5a7('0x59')],_0x50052f[_0xb5a7('0x5a')]))[_0xb5a7('0x68')](_0xb5a7('0x69')));}return rp(_0x572fda)['then'](function(_0x4f3112){return _0x34a3c8[_0xb5a7('0x6a')](_['map'](_0x4f3112['_embedded'][_0xb5a7('0x6b')],function(_0x7952e2){return{'id':_0x7952e2['name'],'name':_0x7952e2['name'],'type':_0x7952e2['type'],'active':_0x7952e2[_0xb5a7('0x6c')],'label':_0x7952e2[_0xb5a7('0x6d')],'custom':!![]};}));});}})['then'](function(_0x35a5dd){return{'count':_0x35a5dd[_0xb5a7('0x36')],'rows':_0x35a5dd};})[_0xb5a7('0x14')](respondWithResult(_0x521bd4,null))[_0xb5a7('0x1b')](function(_0x6cae40){var _0x423b28=_0x220b21['query']['test']?0x1f4:_0x6cae40['statusCode']||0x1f4;logger[_0xb5a7('0x19')](_0xb5a7('0x6e'),_0xb5a7('0x56'),_0x423b28,JSON[_0xb5a7('0x6f')](_0x6cae40));delete _0x6cae40[_0xb5a7('0x28')];if(_0x423b28===0x191){_0x423b28=0x190;}_0x521bd4[_0xb5a7('0x1d')](_0x423b28)[_0xb5a7('0x29')](_0x220b21['query'][_0xb5a7('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x6cae40[_0xb5a7('0x71')]}:_0x6cae40);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ae7e371..85aa9bb 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 _0xfb0b=['../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c02a1,_0x4b816e){var _0xdaec12=function(_0x553bb6){while(--_0x553bb6){_0x4c02a1['push'](_0x4c02a1['shift']());}};_0xdaec12(++_0x4b816e);}(_0xfb0b,0x94));var _0xbfb0=function(_0x410baf,_0x502507){_0x410baf=_0x410baf-0x0;var _0xd97439=_0xfb0b[_0x410baf];return _0xd97439;};'use strict';var _=require(_0xbfb0('0x0'));var util=require(_0xbfb0('0x1'));var logger=require(_0xbfb0('0x2'))('api');var moment=require(_0xbfb0('0x3'));var BPromise=require(_0xbfb0('0x4'));var rp=require('request-promise');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xbfb0('0x5'));module['exports']=function(_0x238a87,_0x1e821c){return _0x238a87[_0xbfb0('0x6')](_0xbfb0('0x7'),attributes,{'tableName':_0xbfb0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdfb1=['api','bluebird','request-promise','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x2aa95b,_0x3be607){_0x2aa95b=_0x2aa95b-0x0;var _0x50caca=_0xdfb1[_0x2aa95b];return _0x50caca;};'use strict';var _=require(_0x1dfb('0x0'));var util=require(_0x1dfb('0x1'));var logger=require(_0x1dfb('0x2'))(_0x1dfb('0x3'));var moment=require('moment');var BPromise=require(_0x1dfb('0x4'));var rp=require(_0x1dfb('0x5'));var attributes=require(_0x1dfb('0x6'));var integrations=require(_0x1dfb('0x7'));module['exports']=function(_0x51ad43,_0x4ba239){return _0x51ad43[_0x1dfb('0x8')](_0x1dfb('0x9'),attributes,{'tableName':_0x1dfb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index af0af02..2bb91d8 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 _0x427d=['client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','where','attributes','include','model','map','debug','ShowDeskAccount','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x277162,_0x96df18){var _0x19472e=function(_0x5977fa){while(--_0x5977fa){_0x277162['push'](_0x277162['shift']());}};_0x19472e(++_0x96df18);}(_0x427d,0xe4));var _0xd427=function(_0x33060b,_0x415754){_0x33060b=_0x33060b-0x0;var _0xedc3b0=_0x427d[_0x33060b];return _0xedc3b0;};'use strict';var _=require(_0xd427('0x0'));var util=require('util');var moment=require(_0xd427('0x1'));var BPromise=require(_0xd427('0x2'));var rs=require(_0xd427('0x3'));var fs=require('fs');var db=require(_0xd427('0x4'))['db'];var utils=require(_0xd427('0x5'));var logger=require(_0xd427('0x6'))(_0xd427('0x7'));var config=require(_0xd427('0x8'));var jayson=require(_0xd427('0x9'));var client=jayson[_0xd427('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b8a8,_0x12f710,_0x250cc0){return new BPromise(function(_0x574cf2,_0x2a4815){return client[_0xd427('0xb')](_0x22b8a8,_0x250cc0)[_0xd427('0xc')](function(_0x3392a7){logger[_0xd427('0xd')](_0xd427('0xe'),_0x12f710,_0xd427('0xf'));logger['debug'](_0xd427('0x10'),_0x12f710,_0xd427('0xf'),JSON[_0xd427('0x11')](_0x3392a7));if(_0x3392a7['error']){if(_0x3392a7[_0xd427('0x12')][_0xd427('0x13')]===0x1f4){logger[_0xd427('0x12')]('DeskAccount,\x20%s,\x20%s',_0x12f710,_0x3392a7[_0xd427('0x12')][_0xd427('0x14')]);return _0x2a4815(_0x3392a7['error']['message']);}logger[_0xd427('0x12')](_0xd427('0xe'),_0x12f710,_0x3392a7[_0xd427('0x12')]['message']);return _0x574cf2(_0x3392a7[_0xd427('0x12')][_0xd427('0x14')]);}else{logger[_0xd427('0xd')](_0xd427('0xe'),_0x12f710,_0xd427('0xf'));_0x574cf2(_0x3392a7[_0xd427('0x15')][_0xd427('0x14')]);}})[_0xd427('0x16')](function(_0x2de95d){logger[_0xd427('0x12')]('DeskAccount,\x20%s,\x20%s',_0x12f710,_0x2de95d);_0x2a4815(_0x2de95d);});});}exports[_0xd427('0x17')]=function(_0xf3a24b){var _0x5922b0=this;return new Promise(function(_0x38598d,_0x122825){return db[_0xd427('0x18')]['findAll']({'raw':_0xf3a24b[_0xd427('0x19')]?_0xf3a24b['options']['raw']===undefined?!![]:![]:!![],'where':_0xf3a24b[_0xd427('0x19')]?_0xf3a24b[_0xd427('0x19')][_0xd427('0x1a')]||null:null,'attributes':_0xf3a24b[_0xd427('0x19')]?_0xf3a24b['options'][_0xd427('0x1b')]||null:null,'limit':_0xf3a24b[_0xd427('0x19')]?_0xf3a24b[_0xd427('0x19')]['limit']||null:null,'include':_0xf3a24b[_0xd427('0x19')]?_0xf3a24b[_0xd427('0x19')][_0xd427('0x1c')]?_['map'](_0xf3a24b[_0xd427('0x19')][_0xd427('0x1c')],function(_0x2e07b9){return{'model':db[_0x2e07b9[_0xd427('0x1d')]],'as':_0x2e07b9['as'],'attributes':_0x2e07b9[_0xd427('0x1b')],'include':_0x2e07b9[_0xd427('0x1c')]?_[_0xd427('0x1e')](_0x2e07b9[_0xd427('0x1c')],function(_0x4a2568){return{'model':db[_0x4a2568[_0xd427('0x1d')]],'as':_0x4a2568['as'],'attributes':_0x4a2568['attributes'],'include':_0x4a2568['include']?_['map'](_0x4a2568[_0xd427('0x1c')],function(_0x176afd){return{'model':db[_0x176afd[_0xd427('0x1d')]],'as':_0x176afd['as'],'attributes':_0x176afd[_0xd427('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e7f62){logger['info']('GetDeskAccount',_0xf3a24b);logger[_0xd427('0x1f')](_0xd427('0x17'),_0xf3a24b,JSON[_0xd427('0x11')](_0x3e7f62));_0x38598d(_0x3e7f62);})[_0xd427('0x16')](function(_0x37ced2){logger[_0xd427('0x12')](_0xd427('0x17'),_0x37ced2[_0xd427('0x14')],_0xf3a24b);_0x122825(_0x5922b0[_0xd427('0x12')](0x1f4,_0x37ced2['message']));});});};exports[_0xd427('0x20')]=function(_0x51c356){var _0x1627f6=this;return new Promise(function(_0x458211,_0x34d174){return db[_0xd427('0x18')]['find']({'raw':_0x51c356[_0xd427('0x19')]?_0x51c356['options'][_0xd427('0x21')]===undefined?!![]:![]:!![],'where':_0x51c356[_0xd427('0x19')]?_0x51c356[_0xd427('0x19')][_0xd427('0x1a')]||null:null,'attributes':_0x51c356[_0xd427('0x19')]?_0x51c356['options'][_0xd427('0x1b')]||null:null,'include':_0x51c356[_0xd427('0x19')]?_0x51c356[_0xd427('0x19')][_0xd427('0x1c')]?_[_0xd427('0x1e')](_0x51c356[_0xd427('0x19')][_0xd427('0x1c')],function(_0x54e688){return{'model':db[_0x54e688[_0xd427('0x1d')]],'as':_0x54e688['as'],'attributes':_0x54e688[_0xd427('0x1b')],'include':_0x54e688['include']?_[_0xd427('0x1e')](_0x54e688[_0xd427('0x1c')],function(_0x32d2e6){return{'model':db[_0x32d2e6[_0xd427('0x1d')]],'as':_0x32d2e6['as'],'attributes':_0x32d2e6['attributes'],'include':_0x32d2e6[_0xd427('0x1c')]?_[_0xd427('0x1e')](_0x32d2e6[_0xd427('0x1c')],function(_0x37b7fc){return{'model':db[_0x37b7fc[_0xd427('0x1d')]],'as':_0x37b7fc['as'],'attributes':_0x37b7fc[_0xd427('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd427('0xc')](function(_0x42d410){logger[_0xd427('0xd')](_0xd427('0x20'),_0x51c356);logger[_0xd427('0x1f')](_0xd427('0x20'),_0x51c356,JSON[_0xd427('0x11')](_0x42d410));_0x458211(_0x42d410);})[_0xd427('0x16')](function(_0x760cb4){logger[_0xd427('0x12')](_0xd427('0x20'),_0x760cb4[_0xd427('0x14')],_0x51c356);_0x34d174(_0x1627f6['error'](0x1f4,_0x760cb4[_0xd427('0x14')]));});});}; \ No newline at end of file +var _0x3f84=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','limit','include','map','model','ShowDeskAccount','find','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x5c0ca4,_0x191abb){var _0x597047=function(_0x3a4dd4){while(--_0x3a4dd4){_0x5c0ca4['push'](_0x5c0ca4['shift']());}};_0x597047(++_0x191abb);}(_0x3f84,0x99));var _0x43f8=function(_0x56abe6,_0x1dfa2b){_0x56abe6=_0x56abe6-0x0;var _0x39a04d=_0x3f84[_0x56abe6];return _0x39a04d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x43f8('0x0'));var BPromise=require(_0x43f8('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x43f8('0x2'))['db'];var utils=require(_0x43f8('0x3'));var logger=require(_0x43f8('0x4'))(_0x43f8('0x5'));var config=require('../../config/environment');var jayson=require(_0x43f8('0x6'));var client=jayson[_0x43f8('0x7')][_0x43f8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e6944,_0x4cb3c7,_0x105ec3){return new BPromise(function(_0x5169e7,_0x588e3b){return client['request'](_0x5e6944,_0x105ec3)[_0x43f8('0x9')](function(_0x20a4d3){logger[_0x43f8('0xa')](_0x43f8('0xb'),_0x4cb3c7,_0x43f8('0xc'));logger[_0x43f8('0xd')](_0x43f8('0xe'),_0x4cb3c7,'request\x20sent',JSON[_0x43f8('0xf')](_0x20a4d3));if(_0x20a4d3[_0x43f8('0x10')]){if(_0x20a4d3['error'][_0x43f8('0x11')]===0x1f4){logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);return _0x588e3b(_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);}logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x20a4d3[_0x43f8('0x10')]['message']);return _0x5169e7(_0x20a4d3[_0x43f8('0x10')][_0x43f8('0x12')]);}else{logger['info'](_0x43f8('0xb'),_0x4cb3c7,_0x43f8('0xc'));_0x5169e7(_0x20a4d3[_0x43f8('0x13')]['message']);}})[_0x43f8('0x14')](function(_0x22c0a4){logger[_0x43f8('0x10')](_0x43f8('0xb'),_0x4cb3c7,_0x22c0a4);_0x588e3b(_0x22c0a4);});});}exports[_0x43f8('0x15')]=function(_0x571026){var _0x4e21cc=this;return new Promise(function(_0x24120a,_0x157f5a){return db[_0x43f8('0x16')]['findAll']({'raw':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x18')]===undefined?!![]:![]:!![],'where':_0x571026['options']?_0x571026[_0x43f8('0x17')][_0x43f8('0x19')]||null:null,'attributes':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1a')]||null:null,'limit':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1b')]||null:null,'include':_0x571026[_0x43f8('0x17')]?_0x571026[_0x43f8('0x17')][_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x571026[_0x43f8('0x17')][_0x43f8('0x1c')],function(_0x189a67){return{'model':db[_0x189a67[_0x43f8('0x1e')]],'as':_0x189a67['as'],'attributes':_0x189a67['attributes'],'include':_0x189a67[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x189a67[_0x43f8('0x1c')],function(_0x17c61){return{'model':db[_0x17c61[_0x43f8('0x1e')]],'as':_0x17c61['as'],'attributes':_0x17c61[_0x43f8('0x1a')],'include':_0x17c61[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x17c61[_0x43f8('0x1c')],function(_0x455a90){return{'model':db[_0x455a90['model']],'as':_0x455a90['as'],'attributes':_0x455a90[_0x43f8('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a143d){logger[_0x43f8('0xa')]('GetDeskAccount',_0x571026);logger[_0x43f8('0xd')](_0x43f8('0x15'),_0x571026,JSON[_0x43f8('0xf')](_0x3a143d));_0x24120a(_0x3a143d);})[_0x43f8('0x14')](function(_0x7acd4c){logger[_0x43f8('0x10')](_0x43f8('0x15'),_0x7acd4c['message'],_0x571026);_0x157f5a(_0x4e21cc[_0x43f8('0x10')](0x1f4,_0x7acd4c[_0x43f8('0x12')]));});});};exports[_0x43f8('0x1f')]=function(_0x515e2f){var _0x40a2f8=this;return new Promise(function(_0x5c8964,_0x4375f0){return db[_0x43f8('0x16')][_0x43f8('0x20')]({'raw':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')][_0x43f8('0x18')]===undefined?!![]:![]:!![],'where':_0x515e2f[_0x43f8('0x17')]?_0x515e2f['options'][_0x43f8('0x19')]||null:null,'attributes':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')][_0x43f8('0x1a')]||null:null,'include':_0x515e2f[_0x43f8('0x17')]?_0x515e2f[_0x43f8('0x17')]['include']?_[_0x43f8('0x1d')](_0x515e2f[_0x43f8('0x17')]['include'],function(_0x3d15ff){return{'model':db[_0x3d15ff['model']],'as':_0x3d15ff['as'],'attributes':_0x3d15ff['attributes'],'include':_0x3d15ff[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x3d15ff[_0x43f8('0x1c')],function(_0x359190){return{'model':db[_0x359190[_0x43f8('0x1e')]],'as':_0x359190['as'],'attributes':_0x359190[_0x43f8('0x1a')],'include':_0x359190[_0x43f8('0x1c')]?_[_0x43f8('0x1d')](_0x359190['include'],function(_0x81fac9){return{'model':db[_0x81fac9['model']],'as':_0x81fac9['as'],'attributes':_0x81fac9[_0x43f8('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x43f8('0x9')](function(_0x5b8a4e){logger['info'](_0x43f8('0x1f'),_0x515e2f);logger['debug']('ShowDeskAccount',_0x515e2f,JSON[_0x43f8('0xf')](_0x5b8a4e));_0x5c8964(_0x5b8a4e);})[_0x43f8('0x14')](function(_0x4c7f78){logger[_0x43f8('0x10')]('ShowDeskAccount',_0x4c7f78[_0x43f8('0x12')],_0x515e2f);_0x4375f0(_0x40a2f8['error'](0x1f4,_0x4c7f78[_0x43f8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 6bb7002..d446860 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=['post','create','setTags','put','update','delete','destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags'];(function(_0x48b8b1,_0x3dfa9d){var _0x5ee976=function(_0x20c4da){while(--_0x20c4da){_0x48b8b1['push'](_0x48b8b1['shift']());}};_0x5ee976(++_0x3dfa9d);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var express=require(_0x49c4('0x1'));var router=express[_0x49c4('0x2')]();var auth=require(_0x49c4('0x3'));var interaction=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var controller=require('./intDeskConfiguration.controller');router['get']('/',auth[_0x49c4('0x6')](),controller['index']);router[_0x49c4('0x7')](_0x49c4('0x8'),auth[_0x49c4('0x6')](),controller[_0x49c4('0x9')]);router[_0x49c4('0x7')]('/:id/fields',auth[_0x49c4('0x6')](),controller[_0x49c4('0xa')]);router[_0x49c4('0x7')](_0x49c4('0xb'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x49c4('0x7')](_0x49c4('0xc'),auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0x7')]('/:id/tags',auth['isAuthenticated'](),controller[_0x49c4('0xe')]);router[_0x49c4('0xf')]('/',auth['isAuthenticated'](),controller[_0x49c4('0x10')]);router[_0x49c4('0xf')]('/:id/tags',auth[_0x49c4('0x6')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0x8'),auth[_0x49c4('0x6')](),controller[_0x49c4('0x13')]);router[_0x49c4('0x14')](_0x49c4('0x8'),auth['isAuthenticated'](),controller[_0x49c4('0x15')]);module[_0x49c4('0x16')]=router; \ No newline at end of file +var _0xedd9=['delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','put','update'];(function(_0x58562c,_0x4fd99e){var _0xc23738=function(_0x1a31d2){while(--_0x1a31d2){_0x58562c['push'](_0x58562c['shift']());}};_0xc23738(++_0x4fd99e);}(_0xedd9,0xfc));var _0x9edd=function(_0x555e07,_0x2d41d4){_0x555e07=_0x555e07-0x0;var _0x2ad74e=_0xedd9[_0x555e07];return _0x2ad74e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var express=require(_0x9edd('0x2'));var router=express[_0x9edd('0x3')]();var auth=require(_0x9edd('0x4'));var interaction=require(_0x9edd('0x5'));var config=require(_0x9edd('0x6'));var controller=require(_0x9edd('0x7'));router['get']('/',auth[_0x9edd('0x8')](),controller[_0x9edd('0x9')]);router[_0x9edd('0xa')](_0x9edd('0xb'),auth['isAuthenticated'](),controller[_0x9edd('0xc')]);router['get'](_0x9edd('0xd'),auth[_0x9edd('0x8')](),controller[_0x9edd('0xe')]);router[_0x9edd('0xa')]('/:id/subjects',auth[_0x9edd('0x8')](),controller['getSubjects']);router[_0x9edd('0xa')](_0x9edd('0xf'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0xa')]('/:id/tags',auth[_0x9edd('0x8')](),controller[_0x9edd('0x11')]);router[_0x9edd('0x12')]('/',auth[_0x9edd('0x8')](),controller[_0x9edd('0x13')]);router[_0x9edd('0x12')](_0x9edd('0x14'),auth[_0x9edd('0x8')](),controller['setTags']);router[_0x9edd('0x15')](_0x9edd('0xb'),auth[_0x9edd('0x8')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x17')](_0x9edd('0xb'),auth[_0x9edd('0x8')](),controller[_0x9edd('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index ea6734a..3f9623e 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 _0xc27e=['STRING','sequelize','exports'];(function(_0x1cb56b,_0x3f23a4){var _0xbdc1ec=function(_0x103738){while(--_0x103738){_0x1cb56b['push'](_0x1cb56b['shift']());}};_0xbdc1ec(++_0x3f23a4);}(_0xc27e,0x73));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xec27('0x0'));module[_0xec27('0x1')]={'name':{'type':Sequelize[_0xec27('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb328=['exports','STRING'];(function(_0xdf21ac,_0x521373){var _0x460b6c=function(_0x2daae8){while(--_0x2daae8){_0xdf21ac['push'](_0xdf21ac['shift']());}};_0x460b6c(++_0x521373);}(_0xb328,0x158));var _0x8b32=function(_0x1bbf01,_0x2c5f05){_0x1bbf01=_0x1bbf01-0x0;var _0x1865ce=_0xb328[_0x1bbf01];return _0x1865ce;};'use strict';var Sequelize=require('sequelize');module[_0x8b32('0x0')]={'name':{'type':Sequelize[_0x8b32('0x1')]},'description':{'type':Sequelize[_0x8b32('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 992f9c1..37b288c 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 _0x6803=['limit','set','Content-Range','json','apply','save','update','destroy','stack','name','send','DeskConfiguration','model','keys','query','dateEnd','intersection','attributes','length','nolimit','order','sort','filters','pick','dateStart','add','day','merge','filter','where','options','includeAll','include','rows','show','rawAttributes','fields','find','create','body','params','getFields','findOne','map','hasOwnProperty','getSubjects','getDescriptions','DeskField','getTags','Tag','setTags','ids','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','count','offset'];(function(_0x57fa5c,_0x22d1e7){var _0x270ebe=function(_0xf97a43){while(--_0xf97a43){_0x57fa5c['push'](_0x57fa5c['shift']());}};_0x270ebe(++_0x22d1e7);}(_0x6803,0x142));var _0x3680=function(_0x1316a8,_0x3e518a){_0x1316a8=_0x1316a8-0x0;var _0xa543a7=_0x6803[_0x1316a8];return _0xa543a7;};'use strict';var jsonpatch=require(_0x3680('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3680('0x1'));var Mustache=require('mustache');var util=require(_0x3680('0x2'));var path=require(_0x3680('0x3'));var sox=require('sox');var csv=require(_0x3680('0x4'));var ejs=require(_0x3680('0x5'));var fs=require('fs');var _=require(_0x3680('0x6'));var squel=require(_0x3680('0x7'));var crypto=require(_0x3680('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x3680('0x9'));var toCsv=require('to-csv');var querystring=require(_0x3680('0xa'));var Papa=require(_0x3680('0xb'));var qs=require('../../components/parsers/qs');var logger=require(_0x3680('0xc'))(_0x3680('0xd'));var utils=require(_0x3680('0xe'));var config=require(_0x3680('0xf'));var db=require(_0x3680('0x10'))['db'];var jayson=require(_0x3680('0x11'));var client=jayson[_0x3680('0x12')][_0x3680('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5abd6a,_0x27378f,_0x398800,_0x101a7d){return new BPromise(function(_0x1ab294,_0x355566){var _0x2fbbc9=_0x101a7d||client;return _0x2fbbc9[_0x3680('0x14')](_0x5abd6a,_0x398800)[_0x3680('0x15')](function(_0x52c4b2){logger['info'](_0x3680('0x16'),_0x27378f,_0x3680('0x17'));logger[_0x3680('0x18')](_0x3680('0x19'),_0x27378f,_0x3680('0x17'),JSON[_0x3680('0x1a')](_0x52c4b2));if(_0x52c4b2['error']){if(_0x52c4b2[_0x3680('0x1b')][_0x3680('0x1c')]===0x1f4){logger[_0x3680('0x1b')](_0x3680('0x16'),_0x27378f,_0x52c4b2[_0x3680('0x1b')]['message']);return _0x355566(_0x52c4b2[_0x3680('0x1b')]['message']);}logger['error'](_0x3680('0x16'),_0x27378f,_0x52c4b2[_0x3680('0x1b')][_0x3680('0x1d')]);return _0x1ab294(_0x52c4b2[_0x3680('0x1b')][_0x3680('0x1d')]);}else{logger[_0x3680('0x1e')]('DeskConfiguration,\x20%s,\x20%s',_0x27378f,'request\x20sent');_0x1ab294(_0x52c4b2[_0x3680('0x1f')]['message']);}})[_0x3680('0x20')](function(_0x468188){logger[_0x3680('0x1b')](_0x3680('0x16'),_0x27378f,_0x468188);_0x355566(_0x468188);});});}function respondWithStatusCode(_0x30e1d2,_0x50211e){_0x50211e=_0x50211e||0xcc;return function(_0x32c77c){if(_0x32c77c){return _0x30e1d2[_0x3680('0x21')](_0x50211e);}return _0x30e1d2[_0x3680('0x22')](_0x50211e)[_0x3680('0x23')]();};}function respondWithResult(_0x31325a,_0xdafdc7){_0xdafdc7=_0xdafdc7||0xc8;return function(_0x3316fc){if(_0x3316fc){return _0x31325a[_0x3680('0x22')](_0xdafdc7)['json'](_0x3316fc);}};}function respondWithFilteredResult(_0x9df89e,_0x139534){return function(_0x5a8d5c){if(_0x5a8d5c){var _0x163339=_0x5a8d5c[_0x3680('0x24')],_0xbb8425=_0x139534[_0x3680('0x25')],_0x4d9b1e=_0x139534[_0x3680('0x25')]+_0x139534[_0x3680('0x26')],_0x34c6c7;if(_0x4d9b1e>=_0x163339){_0x4d9b1e=_0x163339;_0x34c6c7=0xc8;}else{_0x34c6c7=0xce;}_0x9df89e[_0x3680('0x22')](_0x34c6c7);return _0x9df89e[_0x3680('0x27')](_0x3680('0x28'),_0xbb8425+'-'+_0x4d9b1e+'/'+_0x163339)[_0x3680('0x29')](_0x5a8d5c);}return null;};}function patchUpdates(_0x4f9d40){return function(_0x381c91){try{jsonpatch[_0x3680('0x2a')](_0x381c91,_0x4f9d40,!![]);}catch(_0x56af8b){return BPromise['reject'](_0x56af8b);}return _0x381c91[_0x3680('0x2b')]();};}function saveUpdates(_0x32bf39,_0x42e139){return function(_0x5a44c9){if(_0x5a44c9){return _0x5a44c9[_0x3680('0x2c')](_0x32bf39)[_0x3680('0x15')](function(_0x24ffd6){return _0x24ffd6;});}return null;};}function removeEntity(_0x59bef4,_0x21968a){return function(_0x25b087){if(_0x25b087){return _0x25b087[_0x3680('0x2d')]()['then'](function(){_0x59bef4[_0x3680('0x22')](0xcc)[_0x3680('0x23')]();});}};}function handleEntityNotFound(_0x14c50d,_0x557f87){return function(_0x3bee39){if(!_0x3bee39){_0x14c50d[_0x3680('0x21')](0x194);}return _0x3bee39;};}function handleError(_0x2e8f07,_0x473169){_0x473169=_0x473169||0x1f4;return function(_0x304d08){logger['error'](_0x304d08[_0x3680('0x2e')]);if(_0x304d08[_0x3680('0x2f')]){delete _0x304d08['name'];}_0x2e8f07['status'](_0x473169)[_0x3680('0x30')](_0x304d08);};}exports['index']=function(_0x53a3f0,_0x4edb85){var _0x343c3d={},_0x4abc11={},_0x15b0f9={'count':0x0,'rows':[]};var _0x5d319b=db[_0x3680('0x31')]['rawAttributes'];_0x4abc11[_0x3680('0x32')]=_[_0x3680('0x33')](_0x5d319b);var _0x3d7549={'dateStart':_0x53a3f0[_0x3680('0x34')]['dateStart'],'dateEnd':_0x53a3f0[_0x3680('0x34')][_0x3680('0x35')]};delete _0x53a3f0[_0x3680('0x34')]['dateStart'];delete _0x53a3f0[_0x3680('0x34')][_0x3680('0x35')];_0x4abc11['query']=_[_0x3680('0x33')](_0x53a3f0[_0x3680('0x34')]);_0x4abc11['filters']=_[_0x3680('0x36')](_0x4abc11[_0x3680('0x32')],_0x4abc11[_0x3680('0x34')]);_0x343c3d[_0x3680('0x37')]=_[_0x3680('0x36')](_0x4abc11[_0x3680('0x32')],qs['fields'](_0x53a3f0[_0x3680('0x34')]['fields']));_0x343c3d[_0x3680('0x37')]=_0x343c3d['attributes'][_0x3680('0x38')]?_0x343c3d['attributes']:_0x4abc11['model'];if(!_0x53a3f0[_0x3680('0x34')]['hasOwnProperty'](_0x3680('0x39'))){_0x343c3d['limit']=qs[_0x3680('0x26')](_0x53a3f0[_0x3680('0x34')]['limit']);_0x343c3d[_0x3680('0x25')]=qs[_0x3680('0x25')](_0x53a3f0['query']['offset']);}_0x343c3d[_0x3680('0x3a')]=qs[_0x3680('0x3b')](_0x53a3f0['query']['sort']);_0x343c3d['where']=qs[_0x3680('0x3c')](_[_0x3680('0x3d')](_0x53a3f0['query'],_0x4abc11[_0x3680('0x3c')]));if(_0x3d7549[_0x3680('0x3e')]){if(_0x3d7549['dateEnd']){_0x3d7549[_0x3680('0x35')]=moment(_0x3d7549[_0x3680('0x35')])[_0x3680('0x3f')](0x1,_0x3680('0x40'));}else{_0x3d7549['dateEnd']=moment(_0x3d7549[_0x3680('0x3e')])[_0x3680('0x3f')](0x1,_0x3680('0x40'));}_[_0x3680('0x41')](_0x343c3d['where'],{'createdAt':{'$gte':_0x3d7549[_0x3680('0x3e')],'$lte':_0x3d7549[_0x3680('0x35')]}});}if(_0x53a3f0[_0x3680('0x34')][_0x3680('0x42')]){_0x343c3d[_0x3680('0x43')]=_['merge'](_0x343c3d[_0x3680('0x43')],{'$or':_['map'](_0x343c3d[_0x3680('0x37')],function(_0x4c079d){var _0x57de0c={};_0x57de0c[_0x4c079d]={'$like':'%'+_0x53a3f0[_0x3680('0x34')]['filter']+'%'};return _0x57de0c;})});}_0x343c3d=_[_0x3680('0x41')]({},_0x343c3d,_0x53a3f0[_0x3680('0x44')]);var _0x53d0c0={'where':_0x343c3d[_0x3680('0x43')]};return db[_0x3680('0x31')][_0x3680('0x24')](_0x53d0c0)['then'](function(_0x5a66a6){_0x15b0f9[_0x3680('0x24')]=_0x5a66a6;if(_0x53a3f0[_0x3680('0x34')][_0x3680('0x45')]){_0x343c3d[_0x3680('0x46')]=[{'all':!![]}];}return db[_0x3680('0x31')]['findAll'](_0x343c3d);})['then'](function(_0x3b8084){_0x15b0f9[_0x3680('0x47')]=_0x3b8084;return _0x15b0f9;})[_0x3680('0x15')](respondWithFilteredResult(_0x4edb85,_0x343c3d))[_0x3680('0x20')](handleError(_0x4edb85,null));};exports[_0x3680('0x48')]=function(_0x271f0a,_0x41b125){var _0x4fc250={'raw':![],'where':{'id':_0x271f0a['params']['id']}},_0x796e42={};_0x796e42['model']=_[_0x3680('0x33')](db[_0x3680('0x31')][_0x3680('0x49')]);_0x796e42[_0x3680('0x34')]=_[_0x3680('0x33')](_0x271f0a[_0x3680('0x34')]);_0x796e42[_0x3680('0x3c')]=_['intersection'](_0x796e42[_0x3680('0x32')],_0x796e42[_0x3680('0x34')]);_0x4fc250[_0x3680('0x37')]=_[_0x3680('0x36')](_0x796e42[_0x3680('0x32')],qs[_0x3680('0x4a')](_0x271f0a[_0x3680('0x34')]['fields']));_0x4fc250['attributes']=_0x4fc250[_0x3680('0x37')][_0x3680('0x38')]?_0x4fc250['attributes']:_0x796e42[_0x3680('0x32')];if(_0x271f0a[_0x3680('0x34')][_0x3680('0x45')]){_0x4fc250[_0x3680('0x46')]=[{'all':!![]}];}_0x4fc250=_[_0x3680('0x41')]({},_0x4fc250,_0x271f0a[_0x3680('0x44')]);return db[_0x3680('0x31')][_0x3680('0x4b')](_0x4fc250)['then'](handleEntityNotFound(_0x41b125,null))['then'](respondWithResult(_0x41b125,null))[_0x3680('0x20')](handleError(_0x41b125,null));};exports[_0x3680('0x4c')]=function(_0x169bef,_0x4f6ce0){return db[_0x3680('0x31')][_0x3680('0x4c')](_0x169bef[_0x3680('0x4d')],{})['then'](respondWithResult(_0x4f6ce0,0xc9))[_0x3680('0x20')](handleError(_0x4f6ce0,null));};exports[_0x3680('0x2c')]=function(_0xdafca7,_0x1ece9b){if(_0xdafca7[_0x3680('0x4d')]['id']){delete _0xdafca7[_0x3680('0x4d')]['id'];}return db[_0x3680('0x31')]['find']({'where':{'id':_0xdafca7['params']['id']}})[_0x3680('0x15')](handleEntityNotFound(_0x1ece9b,null))[_0x3680('0x15')](saveUpdates(_0xdafca7[_0x3680('0x4d')],null))[_0x3680('0x15')](respondWithResult(_0x1ece9b,null))[_0x3680('0x20')](handleError(_0x1ece9b,null));};exports[_0x3680('0x2d')]=function(_0x84ea6a,_0x378a54){return db['DeskConfiguration'][_0x3680('0x4b')]({'where':{'id':_0x84ea6a[_0x3680('0x4e')]['id']}})[_0x3680('0x15')](handleEntityNotFound(_0x378a54,null))[_0x3680('0x15')](removeEntity(_0x378a54,null))[_0x3680('0x20')](handleError(_0x378a54,null));};exports[_0x3680('0x4f')]=function(_0x59bd7b,_0xe90723,_0x20a718){var _0x5ae32c={};var _0x28db06={};var _0x417a9c;var _0x7d4584;return db[_0x3680('0x31')][_0x3680('0x50')]({'where':{'id':_0x59bd7b[_0x3680('0x4e')]['id']}})[_0x3680('0x15')](handleEntityNotFound(_0xe90723,null))['then'](function(_0x1a24fc){if(_0x1a24fc){_0x417a9c=_0x1a24fc;_0x28db06[_0x3680('0x32')]=_[_0x3680('0x33')](db['DeskField'][_0x3680('0x49')]);_0x28db06['query']=_[_0x3680('0x33')](_0x59bd7b[_0x3680('0x34')]);_0x28db06[_0x3680('0x3c')]=_[_0x3680('0x36')](_0x28db06[_0x3680('0x32')],_0x28db06[_0x3680('0x34')]);_0x5ae32c['attributes']=_[_0x3680('0x36')](_0x28db06[_0x3680('0x32')],qs[_0x3680('0x4a')](_0x59bd7b['query'][_0x3680('0x4a')]));_0x5ae32c['attributes']=_0x5ae32c[_0x3680('0x37')][_0x3680('0x38')]?_0x5ae32c[_0x3680('0x37')]:_0x28db06[_0x3680('0x32')];_0x5ae32c[_0x3680('0x3a')]=qs['sort'](_0x59bd7b[_0x3680('0x34')][_0x3680('0x3b')]);_0x5ae32c[_0x3680('0x43')]=qs[_0x3680('0x3c')](_[_0x3680('0x3d')](_0x59bd7b[_0x3680('0x34')],_0x28db06[_0x3680('0x3c')]));if(_0x59bd7b[_0x3680('0x34')][_0x3680('0x42')]){_0x5ae32c[_0x3680('0x43')]=_[_0x3680('0x41')](_0x5ae32c[_0x3680('0x43')],{'$or':_[_0x3680('0x51')](_0x5ae32c[_0x3680('0x37')],function(_0x1bded3){var _0x467a44={};_0x467a44[_0x1bded3]={'$like':'%'+_0x59bd7b[_0x3680('0x34')][_0x3680('0x42')]+'%'};return _0x467a44;})});}_0x5ae32c=_[_0x3680('0x41')]({},_0x5ae32c,_0x59bd7b[_0x3680('0x44')]);return _0x417a9c[_0x3680('0x4f')](_0x5ae32c);}})[_0x3680('0x15')](function(_0x2bda76){if(_0x2bda76){_0x7d4584=_0x2bda76[_0x3680('0x38')];if(!_0x59bd7b[_0x3680('0x34')][_0x3680('0x52')](_0x3680('0x39'))){_0x5ae32c[_0x3680('0x26')]=qs[_0x3680('0x26')](_0x59bd7b[_0x3680('0x34')][_0x3680('0x26')]);_0x5ae32c['offset']=qs[_0x3680('0x25')](_0x59bd7b[_0x3680('0x34')][_0x3680('0x25')]);}return _0x417a9c['getFields'](_0x5ae32c);}})[_0x3680('0x15')](function(_0x55f1be){if(_0x55f1be){return _0x55f1be?{'count':_0x7d4584,'rows':_0x55f1be}:null;}})['then'](respondWithResult(_0xe90723,null))[_0x3680('0x20')](handleError(_0xe90723,null));};exports[_0x3680('0x53')]=function(_0x4542d3,_0x51b245,_0x2fd044){var _0x44ef5d={};var _0x13beff={};var _0x362377;var _0x13ea99;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4542d3[_0x3680('0x4e')]['id']}})['then'](handleEntityNotFound(_0x51b245,null))['then'](function(_0x24ea97){if(_0x24ea97){_0x362377=_0x24ea97;_0x13beff[_0x3680('0x32')]=_[_0x3680('0x33')](db['DeskField'][_0x3680('0x49')]);_0x13beff[_0x3680('0x34')]=_['keys'](_0x4542d3['query']);_0x13beff[_0x3680('0x3c')]=_[_0x3680('0x36')](_0x13beff[_0x3680('0x32')],_0x13beff['query']);_0x44ef5d[_0x3680('0x37')]=_['intersection'](_0x13beff['model'],qs['fields'](_0x4542d3[_0x3680('0x34')]['fields']));_0x44ef5d[_0x3680('0x37')]=_0x44ef5d[_0x3680('0x37')][_0x3680('0x38')]?_0x44ef5d[_0x3680('0x37')]:_0x13beff[_0x3680('0x32')];_0x44ef5d[_0x3680('0x3a')]=qs[_0x3680('0x3b')](_0x4542d3['query'][_0x3680('0x3b')]);_0x44ef5d[_0x3680('0x43')]=qs[_0x3680('0x3c')](_['pick'](_0x4542d3[_0x3680('0x34')],_0x13beff['filters']));if(_0x4542d3['query']['filter']){_0x44ef5d['where']=_[_0x3680('0x41')](_0x44ef5d[_0x3680('0x43')],{'$or':_['map'](_0x44ef5d[_0x3680('0x37')],function(_0x234919){var _0x49a04b={};_0x49a04b[_0x234919]={'$like':'%'+_0x4542d3[_0x3680('0x34')][_0x3680('0x42')]+'%'};return _0x49a04b;})});}_0x44ef5d=_['merge']({},_0x44ef5d,_0x4542d3[_0x3680('0x44')]);return _0x362377[_0x3680('0x53')](_0x44ef5d);}})[_0x3680('0x15')](function(_0x54dd5b){if(_0x54dd5b){_0x13ea99=_0x54dd5b['length'];if(!_0x4542d3[_0x3680('0x34')][_0x3680('0x52')](_0x3680('0x39'))){_0x44ef5d['limit']=qs[_0x3680('0x26')](_0x4542d3[_0x3680('0x34')][_0x3680('0x26')]);_0x44ef5d[_0x3680('0x25')]=qs[_0x3680('0x25')](_0x4542d3['query'][_0x3680('0x25')]);}return _0x362377[_0x3680('0x53')](_0x44ef5d);}})[_0x3680('0x15')](function(_0x27251f){if(_0x27251f){return _0x27251f?{'count':_0x13ea99,'rows':_0x27251f}:null;}})[_0x3680('0x15')](respondWithResult(_0x51b245,null))['catch'](handleError(_0x51b245,null));};exports[_0x3680('0x54')]=function(_0x7e826c,_0x1047a5,_0x20db85){var _0xfb59d7={};var _0x35ad6b={};var _0x3e011e;var _0x3707cd;return db['DeskConfiguration'][_0x3680('0x50')]({'where':{'id':_0x7e826c['params']['id']}})[_0x3680('0x15')](handleEntityNotFound(_0x1047a5,null))[_0x3680('0x15')](function(_0x4ba42c){if(_0x4ba42c){_0x3e011e=_0x4ba42c;_0x35ad6b['model']=_['keys'](db[_0x3680('0x55')][_0x3680('0x49')]);_0x35ad6b[_0x3680('0x34')]=_[_0x3680('0x33')](_0x7e826c[_0x3680('0x34')]);_0x35ad6b[_0x3680('0x3c')]=_[_0x3680('0x36')](_0x35ad6b[_0x3680('0x32')],_0x35ad6b[_0x3680('0x34')]);_0xfb59d7[_0x3680('0x37')]=_['intersection'](_0x35ad6b[_0x3680('0x32')],qs[_0x3680('0x4a')](_0x7e826c[_0x3680('0x34')][_0x3680('0x4a')]));_0xfb59d7[_0x3680('0x37')]=_0xfb59d7['attributes'][_0x3680('0x38')]?_0xfb59d7[_0x3680('0x37')]:_0x35ad6b[_0x3680('0x32')];_0xfb59d7[_0x3680('0x3a')]=qs[_0x3680('0x3b')](_0x7e826c['query'][_0x3680('0x3b')]);_0xfb59d7[_0x3680('0x43')]=qs['filters'](_[_0x3680('0x3d')](_0x7e826c[_0x3680('0x34')],_0x35ad6b[_0x3680('0x3c')]));if(_0x7e826c[_0x3680('0x34')][_0x3680('0x42')]){_0xfb59d7[_0x3680('0x43')]=_[_0x3680('0x41')](_0xfb59d7[_0x3680('0x43')],{'$or':_[_0x3680('0x51')](_0xfb59d7['attributes'],function(_0x36389e){var _0x15a611={};_0x15a611[_0x36389e]={'$like':'%'+_0x7e826c[_0x3680('0x34')][_0x3680('0x42')]+'%'};return _0x15a611;})});}_0xfb59d7=_['merge']({},_0xfb59d7,_0x7e826c[_0x3680('0x44')]);return _0x3e011e['getDescriptions'](_0xfb59d7);}})[_0x3680('0x15')](function(_0x4e4132){if(_0x4e4132){_0x3707cd=_0x4e4132['length'];if(!_0x7e826c['query'][_0x3680('0x52')](_0x3680('0x39'))){_0xfb59d7[_0x3680('0x26')]=qs['limit'](_0x7e826c[_0x3680('0x34')][_0x3680('0x26')]);_0xfb59d7['offset']=qs[_0x3680('0x25')](_0x7e826c[_0x3680('0x34')][_0x3680('0x25')]);}return _0x3e011e[_0x3680('0x54')](_0xfb59d7);}})['then'](function(_0x1fd9c0){if(_0x1fd9c0){return _0x1fd9c0?{'count':_0x3707cd,'rows':_0x1fd9c0}:null;}})[_0x3680('0x15')](respondWithResult(_0x1047a5,null))[_0x3680('0x20')](handleError(_0x1047a5,null));};exports[_0x3680('0x56')]=function(_0x1d91f5,_0x20a844,_0x13033e){var _0x209fd2={};var _0x45a17f={};var _0x2af4c1;var _0x25111f;return db[_0x3680('0x31')][_0x3680('0x50')]({'where':{'id':_0x1d91f5[_0x3680('0x4e')]['id']}})['then'](handleEntityNotFound(_0x20a844,null))[_0x3680('0x15')](function(_0x3c196a){if(_0x3c196a){_0x2af4c1=_0x3c196a;_0x45a17f[_0x3680('0x32')]=_[_0x3680('0x33')](db[_0x3680('0x57')][_0x3680('0x49')]);_0x45a17f['query']=_[_0x3680('0x33')](_0x1d91f5[_0x3680('0x34')]);_0x45a17f[_0x3680('0x3c')]=_['intersection'](_0x45a17f[_0x3680('0x32')],_0x45a17f['query']);_0x209fd2['attributes']=_['intersection'](_0x45a17f[_0x3680('0x32')],qs['fields'](_0x1d91f5[_0x3680('0x34')][_0x3680('0x4a')]));_0x209fd2[_0x3680('0x37')]=_0x209fd2[_0x3680('0x37')][_0x3680('0x38')]?_0x209fd2[_0x3680('0x37')]:_0x45a17f[_0x3680('0x32')];_0x209fd2[_0x3680('0x3a')]=qs['sort'](_0x1d91f5[_0x3680('0x34')][_0x3680('0x3b')]);_0x209fd2[_0x3680('0x43')]=qs[_0x3680('0x3c')](_[_0x3680('0x3d')](_0x1d91f5['query'],_0x45a17f['filters']));if(_0x1d91f5['query'][_0x3680('0x42')]){_0x209fd2[_0x3680('0x43')]=_['merge'](_0x209fd2[_0x3680('0x43')],{'$or':_[_0x3680('0x51')](_0x209fd2[_0x3680('0x37')],function(_0x126180){var _0x2c41f9={};_0x2c41f9[_0x126180]={'$like':'%'+_0x1d91f5[_0x3680('0x34')][_0x3680('0x42')]+'%'};return _0x2c41f9;})});}_0x209fd2=_[_0x3680('0x41')]({},_0x209fd2,_0x1d91f5[_0x3680('0x44')]);return _0x2af4c1['getTags'](_0x209fd2);}})[_0x3680('0x15')](function(_0x112529){if(_0x112529){_0x25111f=_0x112529[_0x3680('0x38')];if(!_0x1d91f5[_0x3680('0x34')][_0x3680('0x52')](_0x3680('0x39'))){_0x209fd2[_0x3680('0x26')]=qs[_0x3680('0x26')](_0x1d91f5[_0x3680('0x34')][_0x3680('0x26')]);_0x209fd2[_0x3680('0x25')]=qs['offset'](_0x1d91f5[_0x3680('0x34')][_0x3680('0x25')]);}return _0x2af4c1['getTags'](_0x209fd2);}})[_0x3680('0x15')](function(_0x4a29cf){if(_0x4a29cf){return _0x4a29cf?{'count':_0x25111f,'rows':_0x4a29cf}:null;}})[_0x3680('0x15')](respondWithResult(_0x20a844,null))['catch'](handleError(_0x20a844,null));};exports[_0x3680('0x58')]=function(_0x1ebd1f,_0x2c9f32,_0x53a339){if(_0x1ebd1f['body']['id']){delete _0x1ebd1f['body']['id'];}return db[_0x3680('0x31')][_0x3680('0x50')]({'where':{'id':_0x1ebd1f[_0x3680('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2c9f32,null))['then'](function(_0x144437){if(_0x144437){return _0x144437[_0x3680('0x58')](_0x1ebd1f['body'][_0x3680('0x59')]||[]);}return null;})[_0x3680('0x15')](respondWithResult(_0x2c9f32,null))[_0x3680('0x20')](handleError(_0x2c9f32,null));}; \ No newline at end of file +var _0x98dc=['options','count','includeAll','include','findAll','show','params','fields','find','create','body','destroy','getFields','findOne','DeskField','map','getSubjects','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','end','status','json','offset','limit','Content-Range','apply','reject','update','sendStatus','stack','name','send','index','DeskConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter'];(function(_0x20a237,_0x3db0ed){var _0x5632e7=function(_0x1c534b){while(--_0x1c534b){_0x20a237['push'](_0x20a237['shift']());}};_0x5632e7(++_0x3db0ed);}(_0x98dc,0x11b));var _0xc98d=function(_0x39bf60,_0x2ceb09){_0x39bf60=_0x39bf60-0x0;var _0xf77b5b=_0x98dc[_0x39bf60];return _0xf77b5b;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc98d('0x0'));var moment=require(_0xc98d('0x1'));var BPromise=require(_0xc98d('0x2'));var Mustache=require(_0xc98d('0x3'));var util=require(_0xc98d('0x4'));var path=require(_0xc98d('0x5'));var sox=require(_0xc98d('0x6'));var csv=require(_0xc98d('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc98d('0x8'));var crypto=require(_0xc98d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc98d('0xa'));var toCsv=require(_0xc98d('0x7'));var querystring=require(_0xc98d('0xb'));var Papa=require(_0xc98d('0xc'));var qs=require(_0xc98d('0xd'));var logger=require(_0xc98d('0xe'))(_0xc98d('0xf'));var utils=require('../../config/utils');var config=require(_0xc98d('0x10'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xc98d('0x11')][_0xc98d('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x26a4f9,_0x272a8a,_0x19d752,_0x45f5ad){return new BPromise(function(_0x1d6411,_0x58dbda){var _0x39dc99=_0x45f5ad||client;return _0x39dc99['request'](_0x26a4f9,_0x19d752)[_0xc98d('0x13')](function(_0x25c7ee){logger[_0xc98d('0x14')](_0xc98d('0x15'),_0x272a8a,_0xc98d('0x16'));logger[_0xc98d('0x17')](_0xc98d('0x18'),_0x272a8a,'request\x20sent',JSON['stringify'](_0x25c7ee));if(_0x25c7ee[_0xc98d('0x19')]){if(_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1a')]===0x1f4){logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x25c7ee['error'][_0xc98d('0x1b')]);return _0x58dbda(_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1b')]);}logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x25c7ee[_0xc98d('0x19')][_0xc98d('0x1b')]);return _0x1d6411(_0x25c7ee['error'][_0xc98d('0x1b')]);}else{logger[_0xc98d('0x14')](_0xc98d('0x15'),_0x272a8a,_0xc98d('0x16'));_0x1d6411(_0x25c7ee[_0xc98d('0x1c')]['message']);}})[_0xc98d('0x1d')](function(_0x5bafd4){logger[_0xc98d('0x19')](_0xc98d('0x15'),_0x272a8a,_0x5bafd4);_0x58dbda(_0x5bafd4);});});}function respondWithStatusCode(_0x10fa35,_0x1693db){_0x1693db=_0x1693db||0xcc;return function(_0x49d93d){if(_0x49d93d){return _0x10fa35['sendStatus'](_0x1693db);}return _0x10fa35['status'](_0x1693db)[_0xc98d('0x1e')]();};}function respondWithResult(_0x3b5edd,_0x509b62){_0x509b62=_0x509b62||0xc8;return function(_0x11f5f8){if(_0x11f5f8){return _0x3b5edd[_0xc98d('0x1f')](_0x509b62)[_0xc98d('0x20')](_0x11f5f8);}};}function respondWithFilteredResult(_0x295aa9,_0x305488){return function(_0x34754b){if(_0x34754b){var _0x132465=_0x34754b['count'],_0x166719=_0x305488[_0xc98d('0x21')],_0x54c720=_0x305488[_0xc98d('0x21')]+_0x305488[_0xc98d('0x22')],_0x368315;if(_0x54c720>=_0x132465){_0x54c720=_0x132465;_0x368315=0xc8;}else{_0x368315=0xce;}_0x295aa9['status'](_0x368315);return _0x295aa9['set'](_0xc98d('0x23'),_0x166719+'-'+_0x54c720+'/'+_0x132465)[_0xc98d('0x20')](_0x34754b);}return null;};}function patchUpdates(_0x3c9d3b){return function(_0x4c7fc5){try{jsonpatch[_0xc98d('0x24')](_0x4c7fc5,_0x3c9d3b,!![]);}catch(_0x3e0413){return BPromise[_0xc98d('0x25')](_0x3e0413);}return _0x4c7fc5['save']();};}function saveUpdates(_0x36bd6a,_0x58912b){return function(_0x679401){if(_0x679401){return _0x679401[_0xc98d('0x26')](_0x36bd6a)[_0xc98d('0x13')](function(_0x103283){return _0x103283;});}return null;};}function removeEntity(_0x4795d6,_0x3bb4d6){return function(_0x27c2b7){if(_0x27c2b7){return _0x27c2b7['destroy']()[_0xc98d('0x13')](function(){_0x4795d6['status'](0xcc)[_0xc98d('0x1e')]();});}};}function handleEntityNotFound(_0x3ddb51,_0x54ccfe){return function(_0x2c5503){if(!_0x2c5503){_0x3ddb51[_0xc98d('0x27')](0x194);}return _0x2c5503;};}function handleError(_0x42ec99,_0x56417c){_0x56417c=_0x56417c||0x1f4;return function(_0x7ef6e5){logger['error'](_0x7ef6e5[_0xc98d('0x28')]);if(_0x7ef6e5[_0xc98d('0x29')]){delete _0x7ef6e5['name'];}_0x42ec99[_0xc98d('0x1f')](_0x56417c)[_0xc98d('0x2a')](_0x7ef6e5);};}exports[_0xc98d('0x2b')]=function(_0x1ea268,_0x48581a){var _0x251c60={},_0x2903f6={},_0x23a2cb={'count':0x0,'rows':[]};var _0xd500ad=db[_0xc98d('0x2c')][_0xc98d('0x2d')];_0x2903f6[_0xc98d('0x2e')]=_['keys'](_0xd500ad);var _0x49ef38={'dateStart':_0x1ea268['query'][_0xc98d('0x2f')],'dateEnd':_0x1ea268['query']['dateEnd']};delete _0x1ea268[_0xc98d('0x30')][_0xc98d('0x2f')];delete _0x1ea268['query'][_0xc98d('0x31')];_0x2903f6['query']=_[_0xc98d('0x32')](_0x1ea268['query']);_0x2903f6[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x2903f6[_0xc98d('0x2e')],_0x2903f6[_0xc98d('0x30')]);_0x251c60[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x2903f6[_0xc98d('0x2e')],qs['fields'](_0x1ea268[_0xc98d('0x30')]['fields']));_0x251c60['attributes']=_0x251c60['attributes'][_0xc98d('0x36')]?_0x251c60[_0xc98d('0x35')]:_0x2903f6['model'];if(!_0x1ea268[_0xc98d('0x30')][_0xc98d('0x37')](_0xc98d('0x38'))){_0x251c60[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x1ea268['query'][_0xc98d('0x22')]);_0x251c60[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x1ea268[_0xc98d('0x30')][_0xc98d('0x21')]);}_0x251c60[_0xc98d('0x39')]=qs['sort'](_0x1ea268['query'][_0xc98d('0x3a')]);_0x251c60[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_[_0xc98d('0x3c')](_0x1ea268[_0xc98d('0x30')],_0x2903f6['filters']));if(_0x49ef38[_0xc98d('0x2f')]){if(_0x49ef38[_0xc98d('0x31')]){_0x49ef38[_0xc98d('0x31')]=moment(_0x49ef38[_0xc98d('0x31')])['add'](0x1,'day');}else{_0x49ef38[_0xc98d('0x31')]=moment(_0x49ef38['dateStart'])[_0xc98d('0x3d')](0x1,_0xc98d('0x3e'));}_[_0xc98d('0x3f')](_0x251c60[_0xc98d('0x3b')],{'createdAt':{'$gte':_0x49ef38[_0xc98d('0x2f')],'$lte':_0x49ef38[_0xc98d('0x31')]}});}if(_0x1ea268[_0xc98d('0x30')][_0xc98d('0x40')]){_0x251c60[_0xc98d('0x3b')]=_[_0xc98d('0x3f')](_0x251c60['where'],{'$or':_['map'](_0x251c60[_0xc98d('0x35')],function(_0x15ee7b){var _0xf5da1c={};_0xf5da1c[_0x15ee7b]={'$like':'%'+_0x1ea268[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0xf5da1c;})});}_0x251c60=_['merge']({},_0x251c60,_0x1ea268[_0xc98d('0x41')]);var _0x77f7b6={'where':_0x251c60['where']};return db[_0xc98d('0x2c')][_0xc98d('0x42')](_0x77f7b6)[_0xc98d('0x13')](function(_0x2fe1bf){_0x23a2cb[_0xc98d('0x42')]=_0x2fe1bf;if(_0x1ea268[_0xc98d('0x30')][_0xc98d('0x43')]){_0x251c60[_0xc98d('0x44')]=[{'all':!![]}];}return db[_0xc98d('0x2c')][_0xc98d('0x45')](_0x251c60);})[_0xc98d('0x13')](function(_0x1cb0dd){_0x23a2cb['rows']=_0x1cb0dd;return _0x23a2cb;})[_0xc98d('0x13')](respondWithFilteredResult(_0x48581a,_0x251c60))[_0xc98d('0x1d')](handleError(_0x48581a,null));};exports[_0xc98d('0x46')]=function(_0x15eb4f,_0x2cd348){var _0x5e9f9b={'raw':![],'where':{'id':_0x15eb4f[_0xc98d('0x47')]['id']}},_0x1eb137={};_0x1eb137[_0xc98d('0x2e')]=_[_0xc98d('0x32')](db[_0xc98d('0x2c')][_0xc98d('0x2d')]);_0x1eb137[_0xc98d('0x30')]=_[_0xc98d('0x32')](_0x15eb4f['query']);_0x1eb137[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x1eb137[_0xc98d('0x2e')],_0x1eb137[_0xc98d('0x30')]);_0x5e9f9b[_0xc98d('0x35')]=_['intersection'](_0x1eb137['model'],qs[_0xc98d('0x48')](_0x15eb4f[_0xc98d('0x30')][_0xc98d('0x48')]));_0x5e9f9b['attributes']=_0x5e9f9b[_0xc98d('0x35')][_0xc98d('0x36')]?_0x5e9f9b['attributes']:_0x1eb137[_0xc98d('0x2e')];if(_0x15eb4f[_0xc98d('0x30')][_0xc98d('0x43')]){_0x5e9f9b[_0xc98d('0x44')]=[{'all':!![]}];}_0x5e9f9b=_[_0xc98d('0x3f')]({},_0x5e9f9b,_0x15eb4f[_0xc98d('0x41')]);return db[_0xc98d('0x2c')][_0xc98d('0x49')](_0x5e9f9b)[_0xc98d('0x13')](handleEntityNotFound(_0x2cd348,null))[_0xc98d('0x13')](respondWithResult(_0x2cd348,null))[_0xc98d('0x1d')](handleError(_0x2cd348,null));};exports['create']=function(_0x4a1ad5,_0x4792d7){return db[_0xc98d('0x2c')][_0xc98d('0x4a')](_0x4a1ad5[_0xc98d('0x4b')],{})[_0xc98d('0x13')](respondWithResult(_0x4792d7,0xc9))[_0xc98d('0x1d')](handleError(_0x4792d7,null));};exports[_0xc98d('0x26')]=function(_0x8ebd80,_0x236aa3){if(_0x8ebd80[_0xc98d('0x4b')]['id']){delete _0x8ebd80[_0xc98d('0x4b')]['id'];}return db[_0xc98d('0x2c')]['find']({'where':{'id':_0x8ebd80[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x236aa3,null))['then'](saveUpdates(_0x8ebd80[_0xc98d('0x4b')],null))[_0xc98d('0x13')](respondWithResult(_0x236aa3,null))[_0xc98d('0x1d')](handleError(_0x236aa3,null));};exports[_0xc98d('0x4c')]=function(_0x262371,_0x2cce38){return db['DeskConfiguration'][_0xc98d('0x49')]({'where':{'id':_0x262371[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x2cce38,null))[_0xc98d('0x13')](removeEntity(_0x2cce38,null))[_0xc98d('0x1d')](handleError(_0x2cce38,null));};exports[_0xc98d('0x4d')]=function(_0x31649e,_0xf1d10d,_0x39968d){var _0x2add9a={};var _0x56ef0f={};var _0x58b5ec;var _0x57ac30;return db['DeskConfiguration'][_0xc98d('0x4e')]({'where':{'id':_0x31649e['params']['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0xf1d10d,null))[_0xc98d('0x13')](function(_0x37d99f){if(_0x37d99f){_0x58b5ec=_0x37d99f;_0x56ef0f[_0xc98d('0x2e')]=_['keys'](db[_0xc98d('0x4f')]['rawAttributes']);_0x56ef0f['query']=_[_0xc98d('0x32')](_0x31649e[_0xc98d('0x30')]);_0x56ef0f[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x56ef0f[_0xc98d('0x2e')],_0x56ef0f['query']);_0x2add9a['attributes']=_[_0xc98d('0x34')](_0x56ef0f['model'],qs['fields'](_0x31649e[_0xc98d('0x30')][_0xc98d('0x48')]));_0x2add9a['attributes']=_0x2add9a[_0xc98d('0x35')]['length']?_0x2add9a[_0xc98d('0x35')]:_0x56ef0f[_0xc98d('0x2e')];_0x2add9a[_0xc98d('0x39')]=qs[_0xc98d('0x3a')](_0x31649e[_0xc98d('0x30')][_0xc98d('0x3a')]);_0x2add9a[_0xc98d('0x3b')]=qs['filters'](_[_0xc98d('0x3c')](_0x31649e[_0xc98d('0x30')],_0x56ef0f[_0xc98d('0x33')]));if(_0x31649e[_0xc98d('0x30')][_0xc98d('0x40')]){_0x2add9a[_0xc98d('0x3b')]=_['merge'](_0x2add9a[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x2add9a['attributes'],function(_0x315628){var _0xb7873a={};_0xb7873a[_0x315628]={'$like':'%'+_0x31649e[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0xb7873a;})});}_0x2add9a=_[_0xc98d('0x3f')]({},_0x2add9a,_0x31649e[_0xc98d('0x41')]);return _0x58b5ec[_0xc98d('0x4d')](_0x2add9a);}})[_0xc98d('0x13')](function(_0xacf442){if(_0xacf442){_0x57ac30=_0xacf442[_0xc98d('0x36')];if(!_0x31649e[_0xc98d('0x30')]['hasOwnProperty'](_0xc98d('0x38'))){_0x2add9a[_0xc98d('0x22')]=qs['limit'](_0x31649e['query'][_0xc98d('0x22')]);_0x2add9a[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x31649e[_0xc98d('0x30')]['offset']);}return _0x58b5ec[_0xc98d('0x4d')](_0x2add9a);}})[_0xc98d('0x13')](function(_0x266ee2){if(_0x266ee2){return _0x266ee2?{'count':_0x57ac30,'rows':_0x266ee2}:null;}})['then'](respondWithResult(_0xf1d10d,null))[_0xc98d('0x1d')](handleError(_0xf1d10d,null));};exports[_0xc98d('0x51')]=function(_0x1a0387,_0x501a63,_0x5070a2){var _0xbf418b={};var _0x5092fc={};var _0x370ca8;var _0x4d4e58;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x1a0387[_0xc98d('0x47')]['id']}})['then'](handleEntityNotFound(_0x501a63,null))['then'](function(_0x5400ae){if(_0x5400ae){_0x370ca8=_0x5400ae;_0x5092fc[_0xc98d('0x2e')]=_['keys'](db[_0xc98d('0x4f')][_0xc98d('0x2d')]);_0x5092fc[_0xc98d('0x30')]=_['keys'](_0x1a0387['query']);_0x5092fc[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x5092fc['model'],_0x5092fc[_0xc98d('0x30')]);_0xbf418b[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x5092fc[_0xc98d('0x2e')],qs[_0xc98d('0x48')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x48')]));_0xbf418b['attributes']=_0xbf418b[_0xc98d('0x35')][_0xc98d('0x36')]?_0xbf418b['attributes']:_0x5092fc[_0xc98d('0x2e')];_0xbf418b['order']=qs[_0xc98d('0x3a')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x3a')]);_0xbf418b[_0xc98d('0x3b')]=qs['filters'](_[_0xc98d('0x3c')](_0x1a0387[_0xc98d('0x30')],_0x5092fc['filters']));if(_0x1a0387['query'][_0xc98d('0x40')]){_0xbf418b['where']=_[_0xc98d('0x3f')](_0xbf418b['where'],{'$or':_['map'](_0xbf418b[_0xc98d('0x35')],function(_0x27d54d){var _0x1e5a6e={};_0x1e5a6e[_0x27d54d]={'$like':'%'+_0x1a0387[_0xc98d('0x30')][_0xc98d('0x40')]+'%'};return _0x1e5a6e;})});}_0xbf418b=_[_0xc98d('0x3f')]({},_0xbf418b,_0x1a0387['options']);return _0x370ca8['getSubjects'](_0xbf418b);}})[_0xc98d('0x13')](function(_0xb48b92){if(_0xb48b92){_0x4d4e58=_0xb48b92['length'];if(!_0x1a0387[_0xc98d('0x30')][_0xc98d('0x37')]('nolimit')){_0xbf418b[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x1a0387['query'][_0xc98d('0x22')]);_0xbf418b[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x1a0387[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x370ca8[_0xc98d('0x51')](_0xbf418b);}})[_0xc98d('0x13')](function(_0x14914e){if(_0x14914e){return _0x14914e?{'count':_0x4d4e58,'rows':_0x14914e}:null;}})[_0xc98d('0x13')](respondWithResult(_0x501a63,null))[_0xc98d('0x1d')](handleError(_0x501a63,null));};exports[_0xc98d('0x52')]=function(_0x3e9631,_0x4cf035,_0x1325e7){var _0x42baf1={};var _0x7d4c62={};var _0x20db47;var _0x5a4433;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x3e9631[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x4cf035,null))['then'](function(_0xc51f29){if(_0xc51f29){_0x20db47=_0xc51f29;_0x7d4c62['model']=_[_0xc98d('0x32')](db[_0xc98d('0x4f')][_0xc98d('0x2d')]);_0x7d4c62['query']=_[_0xc98d('0x32')](_0x3e9631[_0xc98d('0x30')]);_0x7d4c62[_0xc98d('0x33')]=_['intersection'](_0x7d4c62[_0xc98d('0x2e')],_0x7d4c62[_0xc98d('0x30')]);_0x42baf1[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x7d4c62[_0xc98d('0x2e')],qs['fields'](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x48')]));_0x42baf1[_0xc98d('0x35')]=_0x42baf1['attributes'][_0xc98d('0x36')]?_0x42baf1[_0xc98d('0x35')]:_0x7d4c62['model'];_0x42baf1[_0xc98d('0x39')]=qs[_0xc98d('0x3a')](_0x3e9631['query'][_0xc98d('0x3a')]);_0x42baf1[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_['pick'](_0x3e9631[_0xc98d('0x30')],_0x7d4c62[_0xc98d('0x33')]));if(_0x3e9631[_0xc98d('0x30')][_0xc98d('0x40')]){_0x42baf1[_0xc98d('0x3b')]=_['merge'](_0x42baf1[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x42baf1['attributes'],function(_0xb91e68){var _0x240fe3={};_0x240fe3[_0xb91e68]={'$like':'%'+_0x3e9631['query']['filter']+'%'};return _0x240fe3;})});}_0x42baf1=_[_0xc98d('0x3f')]({},_0x42baf1,_0x3e9631[_0xc98d('0x41')]);return _0x20db47['getDescriptions'](_0x42baf1);}})[_0xc98d('0x13')](function(_0xdada6e){if(_0xdada6e){_0x5a4433=_0xdada6e['length'];if(!_0x3e9631['query'][_0xc98d('0x37')]('nolimit')){_0x42baf1[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x22')]);_0x42baf1[_0xc98d('0x21')]=qs[_0xc98d('0x21')](_0x3e9631[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x20db47[_0xc98d('0x52')](_0x42baf1);}})['then'](function(_0x392687){if(_0x392687){return _0x392687?{'count':_0x5a4433,'rows':_0x392687}:null;}})[_0xc98d('0x13')](respondWithResult(_0x4cf035,null))[_0xc98d('0x1d')](handleError(_0x4cf035,null));};exports[_0xc98d('0x53')]=function(_0x457416,_0x3efcce,_0x157e7c){var _0x4faa5f={};var _0x1068b7={};var _0x5c16bc;var _0x3ef65f;return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x457416[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x3efcce,null))['then'](function(_0x4de093){if(_0x4de093){_0x5c16bc=_0x4de093;_0x1068b7[_0xc98d('0x2e')]=_[_0xc98d('0x32')](db[_0xc98d('0x54')][_0xc98d('0x2d')]);_0x1068b7['query']=_[_0xc98d('0x32')](_0x457416[_0xc98d('0x30')]);_0x1068b7[_0xc98d('0x33')]=_[_0xc98d('0x34')](_0x1068b7[_0xc98d('0x2e')],_0x1068b7[_0xc98d('0x30')]);_0x4faa5f[_0xc98d('0x35')]=_[_0xc98d('0x34')](_0x1068b7[_0xc98d('0x2e')],qs[_0xc98d('0x48')](_0x457416[_0xc98d('0x30')][_0xc98d('0x48')]));_0x4faa5f['attributes']=_0x4faa5f[_0xc98d('0x35')][_0xc98d('0x36')]?_0x4faa5f[_0xc98d('0x35')]:_0x1068b7['model'];_0x4faa5f['order']=qs[_0xc98d('0x3a')](_0x457416['query'][_0xc98d('0x3a')]);_0x4faa5f[_0xc98d('0x3b')]=qs[_0xc98d('0x33')](_[_0xc98d('0x3c')](_0x457416['query'],_0x1068b7['filters']));if(_0x457416[_0xc98d('0x30')]['filter']){_0x4faa5f[_0xc98d('0x3b')]=_[_0xc98d('0x3f')](_0x4faa5f[_0xc98d('0x3b')],{'$or':_[_0xc98d('0x50')](_0x4faa5f[_0xc98d('0x35')],function(_0x25d873){var _0x1bfec2={};_0x1bfec2[_0x25d873]={'$like':'%'+_0x457416['query'][_0xc98d('0x40')]+'%'};return _0x1bfec2;})});}_0x4faa5f=_['merge']({},_0x4faa5f,_0x457416['options']);return _0x5c16bc[_0xc98d('0x53')](_0x4faa5f);}})['then'](function(_0x31d279){if(_0x31d279){_0x3ef65f=_0x31d279[_0xc98d('0x36')];if(!_0x457416[_0xc98d('0x30')][_0xc98d('0x37')](_0xc98d('0x38'))){_0x4faa5f[_0xc98d('0x22')]=qs[_0xc98d('0x22')](_0x457416[_0xc98d('0x30')][_0xc98d('0x22')]);_0x4faa5f[_0xc98d('0x21')]=qs['offset'](_0x457416[_0xc98d('0x30')][_0xc98d('0x21')]);}return _0x5c16bc[_0xc98d('0x53')](_0x4faa5f);}})['then'](function(_0xbc17a2){if(_0xbc17a2){return _0xbc17a2?{'count':_0x3ef65f,'rows':_0xbc17a2}:null;}})[_0xc98d('0x13')](respondWithResult(_0x3efcce,null))[_0xc98d('0x1d')](handleError(_0x3efcce,null));};exports[_0xc98d('0x55')]=function(_0x3df4f6,_0x1650a9,_0x516a3d){if(_0x3df4f6['body']['id']){delete _0x3df4f6[_0xc98d('0x4b')]['id'];}return db[_0xc98d('0x2c')][_0xc98d('0x4e')]({'where':{'id':_0x3df4f6[_0xc98d('0x47')]['id']}})[_0xc98d('0x13')](handleEntityNotFound(_0x1650a9,null))['then'](function(_0x33ef91){if(_0x33ef91){return _0x33ef91[_0xc98d('0x55')](_0x3df4f6[_0xc98d('0x4b')][_0xc98d('0x56')]||[]);}return null;})[_0xc98d('0x13')](respondWithResult(_0x1650a9,null))[_0xc98d('0x1d')](handleError(_0x1650a9,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0c13ca3..89a983c 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 _0x5c3c=['../../config/logger','api','bluebird','request-promise','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util'];(function(_0x3ab13f,_0x36440d){var _0x5a2081=function(_0xd83069){while(--_0xd83069){_0x3ab13f['push'](_0x3ab13f['shift']());}};_0x5a2081(++_0x36440d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x5c3c[_0x24259d];return _0x5a701;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var attributes=require(_0xc5c3('0x6'));module[_0xc5c3('0x7')]=function(_0x2535e0,_0x36525d){return _0x2535e0[_0xc5c3('0x8')](_0xc5c3('0x9'),attributes,{'tableName':_0xc5c3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14a0=['api','moment','bluebird','request-promise','./intDeskConfiguration.attributes','define','DeskConfiguration','util','../../config/logger'];(function(_0x1587d1,_0x4ac855){var _0x376394=function(_0x513269){while(--_0x513269){_0x1587d1['push'](_0x1587d1['shift']());}};_0x376394(++_0x4ac855);}(_0x14a0,0x8e));var _0x014a=function(_0x47d972,_0x115aa5){_0x47d972=_0x47d972-0x0;var _0x15936b=_0x14a0[_0x47d972];return _0x15936b;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var logger=require(_0x014a('0x1'))(_0x014a('0x2'));var moment=require(_0x014a('0x3'));var BPromise=require(_0x014a('0x4'));var rp=require(_0x014a('0x5'));var attributes=require(_0x014a('0x6'));module['exports']=function(_0x57a522,_0x1730a5){return _0x57a522[_0x014a('0x7')](_0x014a('0x8'),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 665ee62..7396962 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 _0xa9e0=['error','message','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1bc0ae,_0x439dfe){var _0x501104=function(_0x2ade0d){while(--_0x2ade0d){_0x1bc0ae['push'](_0x1bc0ae['shift']());}};_0x501104(++_0x439dfe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 db=require(_0x0a9e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a9e('0x4'))(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var jayson=require(_0x0a9e('0x7'));var client=jayson[_0x0a9e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x219af0,_0x441e3a,_0x2cc193){return new BPromise(function(_0x5f41ea,_0x503809){return client[_0x0a9e('0x9')](_0x219af0,_0x2cc193)['then'](function(_0x52cace){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x441e3a,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x441e3a,_0x0a9e('0xc'),JSON['stringify'](_0x52cace));if(_0x52cace['error']){if(_0x52cace['error']['code']===0x1f4){logger[_0x0a9e('0xf')](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x503809(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}logger['error'](_0x0a9e('0xb'),_0x441e3a,_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);return _0x5f41ea(_0x52cace[_0x0a9e('0xf')][_0x0a9e('0x10')]);}else{logger[_0x0a9e('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x441e3a,_0x0a9e('0xc'));_0x5f41ea(_0x52cace['result'][_0x0a9e('0x10')]);}})['catch'](function(_0x16033c){logger[_0x0a9e('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x441e3a,_0x16033c);_0x503809(_0x16033c);});});} \ No newline at end of file +var _0x9ffd=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','lodash'];(function(_0x388744,_0x315d33){var _0x2a57fd=function(_0x2e00ff){while(--_0x2e00ff){_0x388744['push'](_0x388744['shift']());}};_0x2a57fd(++_0x315d33);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1830e1,_0x40be07){_0x1830e1=_0x1830e1-0x0;var _0x20777d=_0x9ffd[_0x1830e1];return _0x20777d;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var db=require(_0xd9ff('0x4'))['db'];var utils=require(_0xd9ff('0x5'));var logger=require(_0xd9ff('0x6'))('rpc');var config=require(_0xd9ff('0x7'));var jayson=require(_0xd9ff('0x8'));var client=jayson['client'][_0xd9ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2982c3,_0x13ea8c,_0x270eb2){return new BPromise(function(_0x45c60a,_0x66282d){return client[_0xd9ff('0xa')](_0x2982c3,_0x270eb2)[_0xd9ff('0xb')](function(_0x977487){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x13ea8c,'request\x20sent');logger['debug'](_0xd9ff('0xc'),_0x13ea8c,_0xd9ff('0xd'),JSON[_0xd9ff('0xe')](_0x977487));if(_0x977487[_0xd9ff('0xf')]){if(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x10')]===0x1f4){logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487['error']['message']);return _0x66282d(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}logger[_0xd9ff('0xf')](_0xd9ff('0x11'),_0x13ea8c,_0x977487[_0xd9ff('0xf')]['message']);return _0x45c60a(_0x977487[_0xd9ff('0xf')][_0xd9ff('0x12')]);}else{logger['info'](_0xd9ff('0x11'),_0x13ea8c,'request\x20sent');_0x45c60a(_0x977487['result']['message']);}})['catch'](function(_0x271287){logger['error'](_0xd9ff('0x11'),_0x13ea8c,_0x271287);_0x66282d(_0x271287);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index eddeefd..83636e6 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 _0xe8fc=['update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xe8fc,0x144));var _0xce8f=function(_0x457cff,_0x4beaf6){_0x457cff=_0x457cff-0x0;var _0x314e85=_0xe8fc[_0x457cff];return _0x314e85;};'use strict';var multer=require('multer');var util=require(_0xce8f('0x0'));var path=require(_0xce8f('0x1'));var express=require(_0xce8f('0x2'));var router=express[_0xce8f('0x3')]();var auth=require(_0xce8f('0x4'));var interaction=require(_0xce8f('0x5'));var config=require(_0xce8f('0x6'));var controller=require(_0xce8f('0x7'));router[_0xce8f('0x8')]('/',auth[_0xce8f('0x9')](),controller[_0xce8f('0xa')]);router['get']('/:id',auth[_0xce8f('0x9')](),controller[_0xce8f('0xb')]);router[_0xce8f('0xc')]('/',auth[_0xce8f('0x9')](),controller[_0xce8f('0xd')]);router[_0xce8f('0xe')](_0xce8f('0xf'),auth[_0xce8f('0x9')](),controller[_0xce8f('0x10')]);router[_0xce8f('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xce8f('0x12')]);module[_0xce8f('0x13')]=router; \ No newline at end of file +var _0xd978=['util','path','express','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','multer'];(function(_0x226dec,_0x620d40){var _0x267d7a=function(_0x4ae3ad){while(--_0x4ae3ad){_0x226dec['push'](_0x226dec['shift']());}};_0x267d7a(++_0x620d40);}(_0xd978,0x17f));var _0x8d97=function(_0x5cc5dc,_0x1af669){_0x5cc5dc=_0x5cc5dc-0x0;var _0x421a9c=_0xd978[_0x5cc5dc];return _0x421a9c;};'use strict';var multer=require(_0x8d97('0x0'));var util=require(_0x8d97('0x1'));var path=require(_0x8d97('0x2'));var express=require(_0x8d97('0x3'));var router=express['Router']();var auth=require(_0x8d97('0x4'));var interaction=require(_0x8d97('0x5'));var config=require('../../config/environment');var controller=require(_0x8d97('0x6'));router['get']('/',auth[_0x8d97('0x7')](),controller[_0x8d97('0x8')]);router[_0x8d97('0x9')](_0x8d97('0xa'),auth['isAuthenticated'](),controller[_0x8d97('0xb')]);router[_0x8d97('0xc')]('/',auth['isAuthenticated'](),controller[_0x8d97('0xd')]);router['put'](_0x8d97('0xa'),auth[_0x8d97('0x7')](),controller[_0x8d97('0xe')]);router[_0x8d97('0xf')](_0x8d97('0xa'),auth[_0x8d97('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 238c5a8..72e26a5 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 _0x668b=['keyValue','STRING','ENUM','customVariable','BOOLEAN','sequelize','exports','string','variable'];(function(_0x1022a8,_0x60804f){var _0x1813a0=function(_0x5c867c){while(--_0x5c867c){_0x1022a8['push'](_0x1022a8['shift']());}};_0x1813a0(++_0x60804f);}(_0x668b,0x140));var _0xb668=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0x668b[_0x25b24a];return _0x224e68;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb668('0x2'),_0xb668('0x3'),'customVariable',_0xb668('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb668('0x5')]},'key':{'type':Sequelize[_0xb668('0x5')]},'keyType':{'type':Sequelize[_0xb668('0x6')]('string',_0xb668('0x3'),_0xb668('0x7'))},'keyContent':{'type':Sequelize[_0xb668('0x5')]},'idField':{'type':Sequelize[_0xb668('0x5')]},'nameField':{'type':Sequelize[_0xb668('0x5')]},'customField':{'type':Sequelize[_0xb668('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbdb7=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1cbcb2,_0x1237a3){_0x1cbcb2=_0x1cbcb2-0x0;var _0x41ac9f=_0xbdb7[_0x1cbcb2];return _0x41ac9f;};'use strict';var Sequelize=require(_0x7bdb('0x0'));module[_0x7bdb('0x1')]={'type':{'type':Sequelize[_0x7bdb('0x2')](_0x7bdb('0x3'),_0x7bdb('0x4'),_0x7bdb('0x5'),_0x7bdb('0x6')),'defaultValue':_0x7bdb('0x3')},'content':{'type':Sequelize[_0x7bdb('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7bdb('0x2')]('string','variable',_0x7bdb('0x5'))},'keyContent':{'type':Sequelize[_0x7bdb('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7bdb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7bdb('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 25f3af8..51896c9 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 _0xef66=['show','params','include','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','DeskField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','sort','add','day','merge','where','map','filter','options','includeAll','findAll','rows','catch'];(function(_0x4ac2ce,_0x55d1ec){var _0x3d10e1=function(_0x413aca){while(--_0x413aca){_0x4ac2ce['push'](_0x4ac2ce['shift']());}};_0x3d10e1(++_0x55d1ec);}(_0xef66,0x1db));var _0x6ef6=function(_0x2211b0,_0x495936){_0x2211b0=_0x2211b0-0x0;var _0x1bda6f=_0xef66[_0x2211b0];return _0x1bda6f;};'use strict';var jsonpatch=require(_0x6ef6('0x0'));var rp=require(_0x6ef6('0x1'));var moment=require(_0x6ef6('0x2'));var BPromise=require(_0x6ef6('0x3'));var Mustache=require(_0x6ef6('0x4'));var util=require('util');var path=require('path');var sox=require(_0x6ef6('0x5'));var csv=require(_0x6ef6('0x6'));var ejs=require(_0x6ef6('0x7'));var fs=require('fs');var _=require(_0x6ef6('0x8'));var squel=require(_0x6ef6('0x9'));var crypto=require(_0x6ef6('0xa'));var jsforce=require(_0x6ef6('0xb'));var deskjs=require(_0x6ef6('0xc'));var toCsv=require(_0x6ef6('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x6ef6('0xd'));var logger=require(_0x6ef6('0xe'))(_0x6ef6('0xf'));var utils=require(_0x6ef6('0x10'));var config=require(_0x6ef6('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c719e,_0x4bf459){_0x4bf459=_0x4bf459||0xcc;return function(_0x53db5e){if(_0x53db5e){return _0x1c719e[_0x6ef6('0x12')](_0x4bf459);}return _0x1c719e['status'](_0x4bf459)[_0x6ef6('0x13')]();};}function respondWithResult(_0x30df0c,_0x28cec8){_0x28cec8=_0x28cec8||0xc8;return function(_0x331113){if(_0x331113){return _0x30df0c['status'](_0x28cec8)[_0x6ef6('0x14')](_0x331113);}};}function respondWithFilteredResult(_0x22b44e,_0x34edc8){return function(_0xf1e310){if(_0xf1e310){var _0x5ba663=_0xf1e310[_0x6ef6('0x15')],_0x265583=_0x34edc8['offset'],_0x5845b7=_0x34edc8[_0x6ef6('0x16')]+_0x34edc8[_0x6ef6('0x17')],_0x40d198;if(_0x5845b7>=_0x5ba663){_0x5845b7=_0x5ba663;_0x40d198=0xc8;}else{_0x40d198=0xce;}_0x22b44e[_0x6ef6('0x18')](_0x40d198);return _0x22b44e[_0x6ef6('0x19')](_0x6ef6('0x1a'),_0x265583+'-'+_0x5845b7+'/'+_0x5ba663)[_0x6ef6('0x14')](_0xf1e310);}return null;};}function patchUpdates(_0x4ea222){return function(_0x30b8e8){try{jsonpatch[_0x6ef6('0x1b')](_0x30b8e8,_0x4ea222,!![]);}catch(_0x2ddb6a){return BPromise['reject'](_0x2ddb6a);}return _0x30b8e8[_0x6ef6('0x1c')]();};}function saveUpdates(_0x2510be,_0x292af9){return function(_0x37d2ef){if(_0x37d2ef){return _0x37d2ef[_0x6ef6('0x1d')](_0x2510be)[_0x6ef6('0x1e')](function(_0xb9a5fa){return _0xb9a5fa;});}return null;};}function removeEntity(_0x5a87e9,_0xe3d8e0){return function(_0x20ef96){if(_0x20ef96){return _0x20ef96[_0x6ef6('0x1f')]()[_0x6ef6('0x1e')](function(){_0x5a87e9['status'](0xcc)[_0x6ef6('0x13')]();});}};}function handleEntityNotFound(_0xc0514c,_0xed332b){return function(_0x4f6df6){if(!_0x4f6df6){_0xc0514c[_0x6ef6('0x12')](0x194);}return _0x4f6df6;};}function handleError(_0x1096de,_0x5c943c){_0x5c943c=_0x5c943c||0x1f4;return function(_0x39b0d8){logger[_0x6ef6('0x20')](_0x39b0d8['stack']);if(_0x39b0d8[_0x6ef6('0x21')]){delete _0x39b0d8[_0x6ef6('0x21')];}_0x1096de[_0x6ef6('0x18')](_0x5c943c)[_0x6ef6('0x22')](_0x39b0d8);};}exports[_0x6ef6('0x23')]=function(_0x3246df,_0x1cd549){var _0x499d4f={},_0x2e5059={},_0x503379={'count':0x0,'rows':[]};var _0x39d3cc=db[_0x6ef6('0x24')][_0x6ef6('0x25')];_0x2e5059[_0x6ef6('0x26')]=_[_0x6ef6('0x27')](_0x39d3cc);var _0xf69d3d={'dateStart':_0x3246df[_0x6ef6('0x28')][_0x6ef6('0x29')],'dateEnd':_0x3246df[_0x6ef6('0x28')][_0x6ef6('0x2a')]};delete _0x3246df[_0x6ef6('0x28')][_0x6ef6('0x29')];delete _0x3246df[_0x6ef6('0x28')][_0x6ef6('0x2a')];_0x2e5059[_0x6ef6('0x28')]=_[_0x6ef6('0x27')](_0x3246df[_0x6ef6('0x28')]);_0x2e5059[_0x6ef6('0x2b')]=_[_0x6ef6('0x2c')](_0x2e5059[_0x6ef6('0x26')],_0x2e5059['query']);_0x499d4f[_0x6ef6('0x2d')]=_['intersection'](_0x2e5059[_0x6ef6('0x26')],qs[_0x6ef6('0x2e')](_0x3246df[_0x6ef6('0x28')]['fields']));_0x499d4f['attributes']=_0x499d4f[_0x6ef6('0x2d')][_0x6ef6('0x2f')]?_0x499d4f[_0x6ef6('0x2d')]:_0x2e5059['model'];if(!_0x3246df[_0x6ef6('0x28')]['hasOwnProperty'](_0x6ef6('0x30'))){_0x499d4f[_0x6ef6('0x17')]=qs['limit'](_0x3246df['query'][_0x6ef6('0x17')]);_0x499d4f['offset']=qs[_0x6ef6('0x16')](_0x3246df['query'][_0x6ef6('0x16')]);}_0x499d4f['order']=qs['sort'](_0x3246df[_0x6ef6('0x28')][_0x6ef6('0x31')]);_0x499d4f['where']=qs[_0x6ef6('0x2b')](_['pick'](_0x3246df[_0x6ef6('0x28')],_0x2e5059['filters']));if(_0xf69d3d[_0x6ef6('0x29')]){if(_0xf69d3d['dateEnd']){_0xf69d3d[_0x6ef6('0x2a')]=moment(_0xf69d3d[_0x6ef6('0x2a')])[_0x6ef6('0x32')](0x1,'day');}else{_0xf69d3d['dateEnd']=moment(_0xf69d3d[_0x6ef6('0x29')])[_0x6ef6('0x32')](0x1,_0x6ef6('0x33'));}_[_0x6ef6('0x34')](_0x499d4f['where'],{'createdAt':{'$gte':_0xf69d3d['dateStart'],'$lte':_0xf69d3d[_0x6ef6('0x2a')]}});}if(_0x3246df['query']['filter']){_0x499d4f[_0x6ef6('0x35')]=_['merge'](_0x499d4f[_0x6ef6('0x35')],{'$or':_[_0x6ef6('0x36')](_0x499d4f[_0x6ef6('0x2d')],function(_0x31facc){var _0x2828ef={};_0x2828ef[_0x31facc]={'$like':'%'+_0x3246df[_0x6ef6('0x28')][_0x6ef6('0x37')]+'%'};return _0x2828ef;})});}_0x499d4f=_['merge']({},_0x499d4f,_0x3246df[_0x6ef6('0x38')]);var _0x58fed8={'where':_0x499d4f['where']};return db[_0x6ef6('0x24')][_0x6ef6('0x15')](_0x58fed8)[_0x6ef6('0x1e')](function(_0x4da800){_0x503379[_0x6ef6('0x15')]=_0x4da800;if(_0x3246df[_0x6ef6('0x28')][_0x6ef6('0x39')]){_0x499d4f['include']=[{'all':!![]}];}return db[_0x6ef6('0x24')][_0x6ef6('0x3a')](_0x499d4f);})[_0x6ef6('0x1e')](function(_0x1bf2af){_0x503379[_0x6ef6('0x3b')]=_0x1bf2af;return _0x503379;})[_0x6ef6('0x1e')](respondWithFilteredResult(_0x1cd549,_0x499d4f))[_0x6ef6('0x3c')](handleError(_0x1cd549,null));};exports[_0x6ef6('0x3d')]=function(_0x2c03a7,_0x230f30){var _0x51b0a1={'raw':!![],'where':{'id':_0x2c03a7[_0x6ef6('0x3e')]['id']}},_0xf46913={};_0xf46913[_0x6ef6('0x26')]=_[_0x6ef6('0x27')](db[_0x6ef6('0x24')][_0x6ef6('0x25')]);_0xf46913[_0x6ef6('0x28')]=_[_0x6ef6('0x27')](_0x2c03a7[_0x6ef6('0x28')]);_0xf46913[_0x6ef6('0x2b')]=_[_0x6ef6('0x2c')](_0xf46913['model'],_0xf46913[_0x6ef6('0x28')]);_0x51b0a1['attributes']=_[_0x6ef6('0x2c')](_0xf46913['model'],qs[_0x6ef6('0x2e')](_0x2c03a7[_0x6ef6('0x28')]['fields']));_0x51b0a1[_0x6ef6('0x2d')]=_0x51b0a1[_0x6ef6('0x2d')][_0x6ef6('0x2f')]?_0x51b0a1[_0x6ef6('0x2d')]:_0xf46913[_0x6ef6('0x26')];if(_0x2c03a7['query'][_0x6ef6('0x39')]){_0x51b0a1[_0x6ef6('0x3f')]=[{'all':!![]}];}_0x51b0a1=_[_0x6ef6('0x34')]({},_0x51b0a1,_0x2c03a7[_0x6ef6('0x38')]);return db[_0x6ef6('0x24')][_0x6ef6('0x40')](_0x51b0a1)[_0x6ef6('0x1e')](handleEntityNotFound(_0x230f30,null))[_0x6ef6('0x1e')](respondWithResult(_0x230f30,null))['catch'](handleError(_0x230f30,null));};exports[_0x6ef6('0x41')]=function(_0x2d54c0,_0x52e93f){return db['DeskField'][_0x6ef6('0x41')](_0x2d54c0['body'],{})[_0x6ef6('0x1e')](respondWithResult(_0x52e93f,0xc9))['catch'](handleError(_0x52e93f,null));};exports[_0x6ef6('0x1d')]=function(_0x712015,_0x23edde){if(_0x712015[_0x6ef6('0x42')]['id']){delete _0x712015['body']['id'];}return db['DeskField']['find']({'where':{'id':_0x712015['params']['id']}})[_0x6ef6('0x1e')](handleEntityNotFound(_0x23edde,null))[_0x6ef6('0x1e')](saveUpdates(_0x712015[_0x6ef6('0x42')],null))['then'](respondWithResult(_0x23edde,null))[_0x6ef6('0x3c')](handleError(_0x23edde,null));};exports[_0x6ef6('0x1f')]=function(_0x30a2a5,_0x43fda4){return db[_0x6ef6('0x24')][_0x6ef6('0x40')]({'where':{'id':_0x30a2a5[_0x6ef6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x43fda4,null))[_0x6ef6('0x1e')](removeEntity(_0x43fda4,null))['catch'](handleError(_0x43fda4,null));}; \ No newline at end of file +var _0x8cda=['stack','name','send','index','DeskField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','add','day','filter','merge','map','options','includeAll','rows','include','find','create','body','catch','params','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../mysqldb','status','end','json','count','offset','limit','apply','reject','update','then','destroy','error'];(function(_0x224f9b,_0x220287){var _0x313ad6=function(_0x28e96b){while(--_0x28e96b){_0x224f9b['push'](_0x224f9b['shift']());}};_0x313ad6(++_0x220287);}(_0x8cda,0x1db));var _0xa8cd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8cda[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa8cd('0x0'));var moment=require(_0xa8cd('0x1'));var BPromise=require(_0xa8cd('0x2'));var Mustache=require(_0xa8cd('0x3'));var util=require(_0xa8cd('0x4'));var path=require(_0xa8cd('0x5'));var sox=require('sox');var csv=require(_0xa8cd('0x6'));var ejs=require(_0xa8cd('0x7'));var fs=require('fs');var _=require(_0xa8cd('0x8'));var squel=require('squel');var crypto=require(_0xa8cd('0x9'));var jsforce=require(_0xa8cd('0xa'));var deskjs=require(_0xa8cd('0xb'));var toCsv=require(_0xa8cd('0x6'));var querystring=require(_0xa8cd('0xc'));var Papa=require(_0xa8cd('0xd'));var qs=require(_0xa8cd('0xe'));var logger=require(_0xa8cd('0xf'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa8cd('0x10'))['db'];function respondWithStatusCode(_0x4dfa9f,_0x1cb52f){_0x1cb52f=_0x1cb52f||0xcc;return function(_0x3e6bed){if(_0x3e6bed){return _0x4dfa9f['sendStatus'](_0x1cb52f);}return _0x4dfa9f[_0xa8cd('0x11')](_0x1cb52f)[_0xa8cd('0x12')]();};}function respondWithResult(_0x598d4c,_0x56083d){_0x56083d=_0x56083d||0xc8;return function(_0xec5e4){if(_0xec5e4){return _0x598d4c[_0xa8cd('0x11')](_0x56083d)[_0xa8cd('0x13')](_0xec5e4);}};}function respondWithFilteredResult(_0xefdff9,_0x144881){return function(_0x53a5d3){if(_0x53a5d3){var _0x3a87ff=_0x53a5d3[_0xa8cd('0x14')],_0x51d29e=_0x144881['offset'],_0x16f366=_0x144881[_0xa8cd('0x15')]+_0x144881[_0xa8cd('0x16')],_0x5ccd85;if(_0x16f366>=_0x3a87ff){_0x16f366=_0x3a87ff;_0x5ccd85=0xc8;}else{_0x5ccd85=0xce;}_0xefdff9[_0xa8cd('0x11')](_0x5ccd85);return _0xefdff9['set']('Content-Range',_0x51d29e+'-'+_0x16f366+'/'+_0x3a87ff)[_0xa8cd('0x13')](_0x53a5d3);}return null;};}function patchUpdates(_0x6d5f40){return function(_0x2494cf){try{jsonpatch[_0xa8cd('0x17')](_0x2494cf,_0x6d5f40,!![]);}catch(_0x55c494){return BPromise[_0xa8cd('0x18')](_0x55c494);}return _0x2494cf['save']();};}function saveUpdates(_0x1cacd5,_0x2ef224){return function(_0x572230){if(_0x572230){return _0x572230[_0xa8cd('0x19')](_0x1cacd5)[_0xa8cd('0x1a')](function(_0x56d8cf){return _0x56d8cf;});}return null;};}function removeEntity(_0x2acedd,_0x385224){return function(_0x1ecce0){if(_0x1ecce0){return _0x1ecce0[_0xa8cd('0x1b')]()[_0xa8cd('0x1a')](function(){_0x2acedd['status'](0xcc)[_0xa8cd('0x12')]();});}};}function handleEntityNotFound(_0x3e43fc,_0x426baf){return function(_0x447d7f){if(!_0x447d7f){_0x3e43fc['sendStatus'](0x194);}return _0x447d7f;};}function handleError(_0x1f15c0,_0x514665){_0x514665=_0x514665||0x1f4;return function(_0x50d0ec){logger[_0xa8cd('0x1c')](_0x50d0ec[_0xa8cd('0x1d')]);if(_0x50d0ec['name']){delete _0x50d0ec[_0xa8cd('0x1e')];}_0x1f15c0[_0xa8cd('0x11')](_0x514665)[_0xa8cd('0x1f')](_0x50d0ec);};}exports[_0xa8cd('0x20')]=function(_0x27b672,_0x2d1ef5){var _0x1f369d={},_0x4a5221={},_0x3c5812={'count':0x0,'rows':[]};var _0x42ae30=db[_0xa8cd('0x21')][_0xa8cd('0x22')];_0x4a5221[_0xa8cd('0x23')]=_[_0xa8cd('0x24')](_0x42ae30);var _0x4e5230={'dateStart':_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x26')],'dateEnd':_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x27')]};delete _0x27b672[_0xa8cd('0x25')][_0xa8cd('0x26')];delete _0x27b672[_0xa8cd('0x25')][_0xa8cd('0x27')];_0x4a5221[_0xa8cd('0x25')]=_[_0xa8cd('0x24')](_0x27b672[_0xa8cd('0x25')]);_0x4a5221[_0xa8cd('0x28')]=_[_0xa8cd('0x29')](_0x4a5221[_0xa8cd('0x23')],_0x4a5221[_0xa8cd('0x25')]);_0x1f369d[_0xa8cd('0x2a')]=_['intersection'](_0x4a5221['model'],qs['fields'](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x2b')]));_0x1f369d[_0xa8cd('0x2a')]=_0x1f369d[_0xa8cd('0x2a')][_0xa8cd('0x2c')]?_0x1f369d[_0xa8cd('0x2a')]:_0x4a5221['model'];if(!_0x27b672['query']['hasOwnProperty'](_0xa8cd('0x2d'))){_0x1f369d[_0xa8cd('0x16')]=qs[_0xa8cd('0x16')](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x16')]);_0x1f369d[_0xa8cd('0x15')]=qs[_0xa8cd('0x15')](_0x27b672['query'][_0xa8cd('0x15')]);}_0x1f369d[_0xa8cd('0x2e')]=qs['sort'](_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x2f')]);_0x1f369d[_0xa8cd('0x30')]=qs[_0xa8cd('0x28')](_['pick'](_0x27b672[_0xa8cd('0x25')],_0x4a5221[_0xa8cd('0x28')]));if(_0x4e5230['dateStart']){if(_0x4e5230[_0xa8cd('0x27')]){_0x4e5230[_0xa8cd('0x27')]=moment(_0x4e5230[_0xa8cd('0x27')])[_0xa8cd('0x31')](0x1,'day');}else{_0x4e5230['dateEnd']=moment(_0x4e5230[_0xa8cd('0x26')])['add'](0x1,_0xa8cd('0x32'));}_['merge'](_0x1f369d[_0xa8cd('0x30')],{'createdAt':{'$gte':_0x4e5230[_0xa8cd('0x26')],'$lte':_0x4e5230['dateEnd']}});}if(_0x27b672[_0xa8cd('0x25')][_0xa8cd('0x33')]){_0x1f369d[_0xa8cd('0x30')]=_[_0xa8cd('0x34')](_0x1f369d[_0xa8cd('0x30')],{'$or':_[_0xa8cd('0x35')](_0x1f369d[_0xa8cd('0x2a')],function(_0x5100d5){var _0x2437b0={};_0x2437b0[_0x5100d5]={'$like':'%'+_0x27b672[_0xa8cd('0x25')]['filter']+'%'};return _0x2437b0;})});}_0x1f369d=_['merge']({},_0x1f369d,_0x27b672[_0xa8cd('0x36')]);var _0x3da42e={'where':_0x1f369d[_0xa8cd('0x30')]};return db[_0xa8cd('0x21')][_0xa8cd('0x14')](_0x3da42e)[_0xa8cd('0x1a')](function(_0x40cd4e){_0x3c5812[_0xa8cd('0x14')]=_0x40cd4e;if(_0x27b672['query'][_0xa8cd('0x37')]){_0x1f369d['include']=[{'all':!![]}];}return db[_0xa8cd('0x21')]['findAll'](_0x1f369d);})[_0xa8cd('0x1a')](function(_0x27a64c){_0x3c5812[_0xa8cd('0x38')]=_0x27a64c;return _0x3c5812;})[_0xa8cd('0x1a')](respondWithFilteredResult(_0x2d1ef5,_0x1f369d))['catch'](handleError(_0x2d1ef5,null));};exports['show']=function(_0x5067d3,_0x5e8a6c){var _0x1b9f17={'raw':!![],'where':{'id':_0x5067d3['params']['id']}},_0x40c80d={};_0x40c80d[_0xa8cd('0x23')]=_[_0xa8cd('0x24')](db[_0xa8cd('0x21')][_0xa8cd('0x22')]);_0x40c80d[_0xa8cd('0x25')]=_[_0xa8cd('0x24')](_0x5067d3['query']);_0x40c80d['filters']=_[_0xa8cd('0x29')](_0x40c80d[_0xa8cd('0x23')],_0x40c80d[_0xa8cd('0x25')]);_0x1b9f17[_0xa8cd('0x2a')]=_['intersection'](_0x40c80d[_0xa8cd('0x23')],qs[_0xa8cd('0x2b')](_0x5067d3[_0xa8cd('0x25')][_0xa8cd('0x2b')]));_0x1b9f17['attributes']=_0x1b9f17['attributes']['length']?_0x1b9f17[_0xa8cd('0x2a')]:_0x40c80d[_0xa8cd('0x23')];if(_0x5067d3['query'][_0xa8cd('0x37')]){_0x1b9f17[_0xa8cd('0x39')]=[{'all':!![]}];}_0x1b9f17=_[_0xa8cd('0x34')]({},_0x1b9f17,_0x5067d3[_0xa8cd('0x36')]);return db[_0xa8cd('0x21')][_0xa8cd('0x3a')](_0x1b9f17)['then'](handleEntityNotFound(_0x5e8a6c,null))['then'](respondWithResult(_0x5e8a6c,null))['catch'](handleError(_0x5e8a6c,null));};exports[_0xa8cd('0x3b')]=function(_0x2f3d01,_0x97f52a){return db[_0xa8cd('0x21')][_0xa8cd('0x3b')](_0x2f3d01[_0xa8cd('0x3c')],{})[_0xa8cd('0x1a')](respondWithResult(_0x97f52a,0xc9))[_0xa8cd('0x3d')](handleError(_0x97f52a,null));};exports[_0xa8cd('0x19')]=function(_0x534f5a,_0x5429e8){if(_0x534f5a[_0xa8cd('0x3c')]['id']){delete _0x534f5a['body']['id'];}return db[_0xa8cd('0x21')][_0xa8cd('0x3a')]({'where':{'id':_0x534f5a[_0xa8cd('0x3e')]['id']}})[_0xa8cd('0x1a')](handleEntityNotFound(_0x5429e8,null))[_0xa8cd('0x1a')](saveUpdates(_0x534f5a['body'],null))[_0xa8cd('0x1a')](respondWithResult(_0x5429e8,null))['catch'](handleError(_0x5429e8,null));};exports[_0xa8cd('0x1b')]=function(_0x9dd1a3,_0x2114f2){return db[_0xa8cd('0x21')][_0xa8cd('0x3a')]({'where':{'id':_0x9dd1a3[_0xa8cd('0x3e')]['id']}})[_0xa8cd('0x1a')](handleEntityNotFound(_0x2114f2,null))[_0xa8cd('0x1a')](removeEntity(_0x2114f2,null))[_0xa8cd('0x3d')](handleError(_0x2114f2,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 54ca3c5..b9baac2 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 _0xac31=['DeskField','int_desk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac31,0xca));var _0x1ac3=function(_0x578fbe,_0x306ce2){_0x578fbe=_0x578fbe-0x0;var _0x3410b4=_0xac31[_0x578fbe];return _0x3410b4;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var attributes=require('./intDeskField.attributes');module[_0x1ac3('0x7')]=function(_0x434b5e,_0x4dcc96){return _0x434b5e['define'](_0x1ac3('0x8'),attributes,{'tableName':_0x1ac3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac31=['DeskField','int_desk_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xac31,0xca));var _0x1ac3=function(_0x3f7c8b,_0x3cbe20){_0x3f7c8b=_0x3f7c8b-0x0;var _0x57f478=_0xac31[_0x3f7c8b];return _0x57f478;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var attributes=require('./intDeskField.attributes');module[_0x1ac3('0x7')]=function(_0x434b5e,_0x4dcc96){return _0x434b5e['define'](_0x1ac3('0x8'),attributes,{'tableName':_0x1ac3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 102724e..ecb05b2 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 _0xa7d8=['../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xe0ade6,_0xf3352){var _0x5b7bce=function(_0x3a1122){while(--_0x3a1122){_0xe0ade6['push'](_0xe0ade6['shift']());}};_0x5b7bce(++_0xf3352);}(_0xa7d8,0x160));var _0x8a7d=function(_0x4cfc6e,_0x55adda){_0x4cfc6e=_0x4cfc6e-0x0;var _0x25098c=_0xa7d8[_0x4cfc6e];return _0x25098c;};'use strict';var _=require(_0x8a7d('0x0'));var util=require(_0x8a7d('0x1'));var moment=require(_0x8a7d('0x2'));var BPromise=require('bluebird');var rs=require(_0x8a7d('0x3'));var fs=require('fs');var db=require(_0x8a7d('0x4'))['db'];var utils=require(_0x8a7d('0x5'));var logger=require(_0x8a7d('0x6'))(_0x8a7d('0x7'));var config=require(_0x8a7d('0x8'));var jayson=require(_0x8a7d('0x9'));var client=jayson[_0x8a7d('0xa')][_0x8a7d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x189636,_0x1b1267,_0x55d143){return new BPromise(function(_0x223a36,_0x1d386d){return client[_0x8a7d('0xc')](_0x189636,_0x55d143)[_0x8a7d('0xd')](function(_0x1b8447){logger[_0x8a7d('0xe')](_0x8a7d('0xf'),_0x1b1267,_0x8a7d('0x10'));logger[_0x8a7d('0x11')](_0x8a7d('0x12'),_0x1b1267,'request\x20sent',JSON[_0x8a7d('0x13')](_0x1b8447));if(_0x1b8447[_0x8a7d('0x14')]){if(_0x1b8447[_0x8a7d('0x14')]['code']===0x1f4){logger[_0x8a7d('0x14')](_0x8a7d('0xf'),_0x1b1267,_0x1b8447[_0x8a7d('0x14')][_0x8a7d('0x15')]);return _0x1d386d(_0x1b8447[_0x8a7d('0x14')]['message']);}logger[_0x8a7d('0x14')](_0x8a7d('0xf'),_0x1b1267,_0x1b8447[_0x8a7d('0x14')][_0x8a7d('0x15')]);return _0x223a36(_0x1b8447[_0x8a7d('0x14')]['message']);}else{logger['info'](_0x8a7d('0xf'),_0x1b1267,_0x8a7d('0x10'));_0x223a36(_0x1b8447[_0x8a7d('0x16')][_0x8a7d('0x15')]);}})[_0x8a7d('0x17')](function(_0x98b9a5){logger[_0x8a7d('0x14')](_0x8a7d('0xf'),_0x1b1267,_0x98b9a5);_0x1d386d(_0x98b9a5);});});} \ No newline at end of file +var _0xf501=['debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xf501,0xcd));var _0x1f50=function(_0x3702cc,_0x25d4f4){_0x3702cc=_0x3702cc-0x0;var _0x307485=_0xf501[_0x3702cc];return _0x307485;};'use strict';var _=require(_0x1f50('0x0'));var util=require(_0x1f50('0x1'));var moment=require(_0x1f50('0x2'));var BPromise=require(_0x1f50('0x3'));var rs=require(_0x1f50('0x4'));var fs=require('fs');var db=require(_0x1f50('0x5'))['db'];var utils=require(_0x1f50('0x6'));var logger=require(_0x1f50('0x7'))(_0x1f50('0x8'));var config=require('../../config/environment');var jayson=require(_0x1f50('0x9'));var client=jayson[_0x1f50('0xa')][_0x1f50('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d3d7e,_0xf6cb7,_0x4e71cd){return new BPromise(function(_0x38f082,_0x412e5d){return client['request'](_0x3d3d7e,_0x4e71cd)['then'](function(_0x37b833){logger[_0x1f50('0xc')](_0x1f50('0xd'),_0xf6cb7,_0x1f50('0xe'));logger[_0x1f50('0xf')]('DeskField,\x20%s,\x20%s,\x20%s',_0xf6cb7,_0x1f50('0xe'),JSON[_0x1f50('0x10')](_0x37b833));if(_0x37b833[_0x1f50('0x11')]){if(_0x37b833[_0x1f50('0x11')]['code']===0x1f4){logger[_0x1f50('0x11')]('DeskField,\x20%s,\x20%s',_0xf6cb7,_0x37b833[_0x1f50('0x11')]['message']);return _0x412e5d(_0x37b833[_0x1f50('0x11')][_0x1f50('0x12')]);}logger['error'](_0x1f50('0xd'),_0xf6cb7,_0x37b833[_0x1f50('0x11')]['message']);return _0x38f082(_0x37b833[_0x1f50('0x11')][_0x1f50('0x12')]);}else{logger['info']('DeskField,\x20%s,\x20%s',_0xf6cb7,_0x1f50('0xe'));_0x38f082(_0x37b833['result']['message']);}})[_0x1f50('0x13')](function(_0x14d217){logger[_0x1f50('0x11')](_0x1f50('0xd'),_0xf6cb7,_0x14d217);_0x412e5d(_0x14d217);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 9ccec3f..de6db66 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 _0x0401=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0xfc36d8,_0x233b0b){var _0x234f42=function(_0xad4ac4){while(--_0xad4ac4){_0xfc36d8['push'](_0xfc36d8['shift']());}};_0x234f42(++_0x233b0b);}(_0x0401,0xab));var _0x1040=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x0401[_0x710815];return _0x5b3b89;};'use strict';var multer=require(_0x1040('0x0'));var util=require(_0x1040('0x1'));var path=require(_0x1040('0x2'));var express=require(_0x1040('0x3'));var router=express[_0x1040('0x4')]();var auth=require(_0x1040('0x5'));var interaction=require(_0x1040('0x6'));var config=require(_0x1040('0x7'));var controller=require(_0x1040('0x8'));router[_0x1040('0x9')]('/',auth[_0x1040('0xa')](),controller[_0x1040('0xb')]);router[_0x1040('0x9')](_0x1040('0xc'),auth[_0x1040('0xa')](),controller[_0x1040('0xd')]);router['get'](_0x1040('0xe'),auth[_0x1040('0xa')](),controller[_0x1040('0xf')]);router[_0x1040('0x9')](_0x1040('0x10'),auth[_0x1040('0xa')](),controller[_0x1040('0x11')]);router[_0x1040('0x12')]('/',auth[_0x1040('0xa')](),controller[_0x1040('0x13')]);router[_0x1040('0x12')](_0x1040('0xe'),auth['isAuthenticated'](),controller[_0x1040('0x14')]);router['put'](_0x1040('0xc'),auth[_0x1040('0xa')](),controller['update']);router['delete'](_0x1040('0xc'),auth[_0x1040('0xa')](),controller[_0x1040('0x15')]);module[_0x1040('0x16')]=router; \ No newline at end of file +var _0x535a=['Router','../../components/interaction/service','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5ff8d4,_0x32230e){var _0x4629d8=function(_0x3b4770){while(--_0x3b4770){_0x5ff8d4['push'](_0x5ff8d4['shift']());}};_0x4629d8(++_0x32230e);}(_0x535a,0x13f));var _0xa535=function(_0x5b6a83,_0x1a5635){_0x5b6a83=_0x5b6a83-0x0;var _0x10c365=_0x535a[_0x5b6a83];return _0x10c365;};'use strict';var multer=require(_0xa535('0x0'));var util=require(_0xa535('0x1'));var path=require(_0xa535('0x2'));var express=require(_0xa535('0x3'));var router=express[_0xa535('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa535('0x5'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0xa535('0x6')]('/',auth[_0xa535('0x7')](),controller['index']);router[_0xa535('0x6')](_0xa535('0x8'),auth[_0xa535('0x7')](),controller['show']);router[_0xa535('0x6')](_0xa535('0x9'),auth[_0xa535('0x7')](),controller[_0xa535('0xa')]);router['get'](_0xa535('0xb'),auth[_0xa535('0x7')](),controller[_0xa535('0xc')]);router[_0xa535('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0xa535('0x7')](),controller['addConfiguration']);router[_0xa535('0xe')]('/:id',auth[_0xa535('0x7')](),controller[_0xa535('0xf')]);router[_0xa535('0x10')]('/:id',auth[_0xa535('0x7')](),controller[_0xa535('0x11')]);module[_0xa535('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e54a0f4..1e4524d 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 _0x7b17=['remoteUri','sequelize','exports','STRING','username'];(function(_0x2bf0cb,_0x5dc503){var _0x5dcf51=function(_0x276868){while(--_0x276868){_0x2bf0cb['push'](_0x2bf0cb['shift']());}};_0x5dcf51(++_0x5dc503);}(_0x7b17,0x9c));var _0x77b1=function(_0x44c974,_0x1bcfde){_0x44c974=_0x44c974-0x0;var _0x5214c6=_0x7b17[_0x44c974];return _0x5214c6;};'use strict';var Sequelize=require(_0x77b1('0x0'));module[_0x77b1('0x1')]={'name':{'type':Sequelize[_0x77b1('0x2')]},'description':{'type':Sequelize[_0x77b1('0x2')]},'username':{'type':Sequelize[_0x77b1('0x2')],'unique':_0x77b1('0x3')},'apiKey':{'type':Sequelize[_0x77b1('0x2')]},'remoteUri':{'type':Sequelize[_0x77b1('0x2')],'unique':_0x77b1('0x4')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x97b7=['exports','STRING','username','sequelize'];(function(_0x35a140,_0x3aeac6){var _0x30ab82=function(_0x15a7c3){while(--_0x15a7c3){_0x35a140['push'](_0x35a140['shift']());}};_0x30ab82(++_0x3aeac6);}(_0x97b7,0x1bf));var _0x797b=function(_0x4351d0,_0xc369cc){_0x4351d0=_0x4351d0-0x0;var _0x1f8fd5=_0x97b7[_0x4351d0];return _0x1f8fd5;};'use strict';var Sequelize=require(_0x797b('0x0'));module[_0x797b('0x1')]={'name':{'type':Sequelize[_0x797b('0x2')]},'description':{'type':Sequelize[_0x797b('0x2')]},'username':{'type':Sequelize[_0x797b('0x2')],'unique':_0x797b('0x3')},'apiKey':{'type':Sequelize[_0x797b('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x797b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 074813a..a83d4da 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 _0x184d=['api','../../config/utils','../../config/environment','client','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FreshdeskAccount','rawAttributes','query','dateStart','dateEnd','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','options','includeAll','include','findAll','show','params','find','create','body','findOne','FreshdeskConfiguration','pick','getConfigurations','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','GET','%s%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x184d,0x69));var _0xd184=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x184d[_0x26f702];return _0x11417d;};'use strict';var jsonpatch=require(_0xd184('0x0'));var rp=require(_0xd184('0x1'));var moment=require(_0xd184('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd184('0x3'));var path=require(_0xd184('0x4'));var sox=require(_0xd184('0x5'));var csv=require(_0xd184('0x6'));var ejs=require(_0xd184('0x7'));var fs=require('fs');var _=require(_0xd184('0x8'));var squel=require(_0xd184('0x9'));var crypto=require(_0xd184('0xa'));var jsforce=require(_0xd184('0xb'));var deskjs=require(_0xd184('0xc'));var toCsv=require(_0xd184('0x6'));var querystring=require(_0xd184('0xd'));var Papa=require(_0xd184('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0xd184('0xf'))(_0xd184('0x10'));var utils=require(_0xd184('0x11'));var config=require(_0xd184('0x12'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xd184('0x13')][_0xd184('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x54a3ad,_0x1e9e69,_0x2bdb1d,_0x4ed86f){return new BPromise(function(_0x4c0c17,_0x10d07b){var _0x4044cc=_0x4ed86f||client;return _0x4044cc['request'](_0x54a3ad,_0x2bdb1d)['then'](function(_0x23ab9e){logger[_0xd184('0x15')](_0xd184('0x16'),_0x1e9e69,_0xd184('0x17'));logger[_0xd184('0x18')](_0xd184('0x19'),_0x1e9e69,_0xd184('0x17'),JSON[_0xd184('0x1a')](_0x23ab9e));if(_0x23ab9e['error']){if(_0x23ab9e[_0xd184('0x1b')][_0xd184('0x1c')]===0x1f4){logger[_0xd184('0x1b')](_0xd184('0x16'),_0x1e9e69,_0x23ab9e[_0xd184('0x1b')][_0xd184('0x1d')]);return _0x10d07b(_0x23ab9e[_0xd184('0x1b')][_0xd184('0x1d')]);}logger[_0xd184('0x1b')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e9e69,_0x23ab9e[_0xd184('0x1b')][_0xd184('0x1d')]);return _0x4c0c17(_0x23ab9e[_0xd184('0x1b')][_0xd184('0x1d')]);}else{logger[_0xd184('0x15')](_0xd184('0x16'),_0x1e9e69,_0xd184('0x17'));_0x4c0c17(_0x23ab9e[_0xd184('0x1e')][_0xd184('0x1d')]);}})[_0xd184('0x1f')](function(_0x25861b){logger[_0xd184('0x1b')]('FreshdeskAccount,\x20%s,\x20%s',_0x1e9e69,_0x25861b);_0x10d07b(_0x25861b);});});}function respondWithStatusCode(_0x52279d,_0x3772cd){_0x3772cd=_0x3772cd||0xcc;return function(_0x5469e8){if(_0x5469e8){return _0x52279d[_0xd184('0x20')](_0x3772cd);}return _0x52279d['status'](_0x3772cd)[_0xd184('0x21')]();};}function respondWithResult(_0x5b1639,_0x45c290){_0x45c290=_0x45c290||0xc8;return function(_0x4f53bb){if(_0x4f53bb){return _0x5b1639['status'](_0x45c290)[_0xd184('0x22')](_0x4f53bb);}};}function respondWithFilteredResult(_0x39ab11,_0x12c8d5){return function(_0x19f9d2){if(_0x19f9d2){var _0x405f18=_0x19f9d2[_0xd184('0x23')],_0x480666=_0x12c8d5['offset'],_0x15137d=_0x12c8d5[_0xd184('0x24')]+_0x12c8d5[_0xd184('0x25')],_0x1fa0b0;if(_0x15137d>=_0x405f18){_0x15137d=_0x405f18;_0x1fa0b0=0xc8;}else{_0x1fa0b0=0xce;}_0x39ab11[_0xd184('0x26')](_0x1fa0b0);return _0x39ab11[_0xd184('0x27')](_0xd184('0x28'),_0x480666+'-'+_0x15137d+'/'+_0x405f18)['json'](_0x19f9d2);}return null;};}function patchUpdates(_0x4e2304){return function(_0x57b501){try{jsonpatch[_0xd184('0x29')](_0x57b501,_0x4e2304,!![]);}catch(_0x516fc9){return BPromise[_0xd184('0x2a')](_0x516fc9);}return _0x57b501[_0xd184('0x2b')]();};}function saveUpdates(_0x41a911,_0x3e3dd7){return function(_0x5108e9){if(_0x5108e9){return _0x5108e9[_0xd184('0x2c')](_0x41a911)[_0xd184('0x2d')](function(_0xee1d38){return _0xee1d38;});}return null;};}function removeEntity(_0x18906a,_0x510e49){return function(_0x156eae){if(_0x156eae){return _0x156eae[_0xd184('0x2e')]()[_0xd184('0x2d')](function(){_0x18906a['status'](0xcc)[_0xd184('0x21')]();});}};}function handleEntityNotFound(_0xcf18b7,_0x498ab7){return function(_0x4bc0de){if(!_0x4bc0de){_0xcf18b7['sendStatus'](0x194);}return _0x4bc0de;};}function handleError(_0x3f913a,_0x479326){_0x479326=_0x479326||0x1f4;return function(_0x4a8967){logger[_0xd184('0x1b')](_0x4a8967[_0xd184('0x2f')]);if(_0x4a8967[_0xd184('0x30')]){delete _0x4a8967[_0xd184('0x30')];}_0x3f913a[_0xd184('0x26')](_0x479326)[_0xd184('0x31')](_0x4a8967);};}exports[_0xd184('0x32')]=function(_0x479228,_0x4e2973){var _0x40b66b={},_0x3643c0={},_0x155a43={'count':0x0,'rows':[]};var _0x18e00c=db[_0xd184('0x33')][_0xd184('0x34')];_0x3643c0['model']=_['keys'](_0x18e00c);var _0x20f968={'dateStart':_0x479228[_0xd184('0x35')][_0xd184('0x36')],'dateEnd':_0x479228['query']['dateEnd']};delete _0x479228[_0xd184('0x35')][_0xd184('0x36')];delete _0x479228[_0xd184('0x35')][_0xd184('0x37')];_0x3643c0['query']=_[_0xd184('0x38')](_0x479228[_0xd184('0x35')]);_0x3643c0[_0xd184('0x39')]=_['intersection'](_0x3643c0[_0xd184('0x3a')],_0x3643c0['query']);_0x40b66b[_0xd184('0x3b')]=_[_0xd184('0x3c')](_0x3643c0[_0xd184('0x3a')],qs[_0xd184('0x3d')](_0x479228[_0xd184('0x35')]['fields']));_0x40b66b['attributes']=_0x40b66b['attributes'][_0xd184('0x3e')]?_0x40b66b['attributes']:_0x3643c0[_0xd184('0x3a')];if(!_0x479228[_0xd184('0x35')][_0xd184('0x3f')](_0xd184('0x40'))){_0x40b66b[_0xd184('0x25')]=qs['limit'](_0x479228[_0xd184('0x35')][_0xd184('0x25')]);_0x40b66b[_0xd184('0x24')]=qs[_0xd184('0x24')](_0x479228[_0xd184('0x35')]['offset']);}_0x40b66b[_0xd184('0x41')]=qs['sort'](_0x479228[_0xd184('0x35')][_0xd184('0x42')]);_0x40b66b['where']=qs['filters'](_['pick'](_0x479228[_0xd184('0x35')],_0x3643c0['filters']));if(_0x20f968['dateStart']){if(_0x20f968[_0xd184('0x37')]){_0x20f968[_0xd184('0x37')]=moment(_0x20f968[_0xd184('0x37')])[_0xd184('0x43')](0x1,_0xd184('0x44'));}else{_0x20f968[_0xd184('0x37')]=moment(_0x20f968[_0xd184('0x36')])[_0xd184('0x43')](0x1,_0xd184('0x44'));}_[_0xd184('0x45')](_0x40b66b[_0xd184('0x46')],{'createdAt':{'$gte':_0x20f968[_0xd184('0x36')],'$lte':_0x20f968[_0xd184('0x37')]}});}if(_0x479228['query'][_0xd184('0x47')]){_0x40b66b[_0xd184('0x46')]=_[_0xd184('0x45')](_0x40b66b[_0xd184('0x46')],{'$or':_[_0xd184('0x48')](_0x40b66b['attributes'],function(_0x43c50c){var _0x52bb7a={};_0x52bb7a[_0x43c50c]={'$like':'%'+_0x479228[_0xd184('0x35')][_0xd184('0x47')]+'%'};return _0x52bb7a;})});}_0x40b66b=_[_0xd184('0x45')]({},_0x40b66b,_0x479228[_0xd184('0x49')]);var _0x599206={'where':_0x40b66b['where']};return db[_0xd184('0x33')][_0xd184('0x23')](_0x599206)['then'](function(_0x394010){_0x155a43[_0xd184('0x23')]=_0x394010;if(_0x479228[_0xd184('0x35')][_0xd184('0x4a')]){_0x40b66b[_0xd184('0x4b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xd184('0x4c')](_0x40b66b);})['then'](function(_0x5932c7){_0x155a43['rows']=_0x5932c7;return _0x155a43;})[_0xd184('0x2d')](respondWithFilteredResult(_0x4e2973,_0x40b66b))['catch'](handleError(_0x4e2973,null));};exports[_0xd184('0x4d')]=function(_0x2431db,_0x1004ac){var _0x4a616b={'raw':![],'where':{'id':_0x2431db[_0xd184('0x4e')]['id']}},_0x347d10={};_0x347d10[_0xd184('0x3a')]=_[_0xd184('0x38')](db[_0xd184('0x33')][_0xd184('0x34')]);_0x347d10[_0xd184('0x35')]=_[_0xd184('0x38')](_0x2431db['query']);_0x347d10[_0xd184('0x39')]=_[_0xd184('0x3c')](_0x347d10[_0xd184('0x3a')],_0x347d10['query']);_0x4a616b[_0xd184('0x3b')]=_['intersection'](_0x347d10['model'],qs[_0xd184('0x3d')](_0x2431db[_0xd184('0x35')][_0xd184('0x3d')]));_0x4a616b[_0xd184('0x3b')]=_0x4a616b[_0xd184('0x3b')][_0xd184('0x3e')]?_0x4a616b[_0xd184('0x3b')]:_0x347d10[_0xd184('0x3a')];if(_0x2431db[_0xd184('0x35')][_0xd184('0x4a')]){_0x4a616b[_0xd184('0x4b')]=[{'all':!![]}];}_0x4a616b=_['merge']({},_0x4a616b,_0x2431db['options']);return db[_0xd184('0x33')][_0xd184('0x4f')](_0x4a616b)[_0xd184('0x2d')](handleEntityNotFound(_0x1004ac,null))[_0xd184('0x2d')](respondWithResult(_0x1004ac,null))[_0xd184('0x1f')](handleError(_0x1004ac,null));};exports[_0xd184('0x50')]=function(_0xdd854c,_0x1dc6ab){return db[_0xd184('0x33')][_0xd184('0x50')](_0xdd854c['body'],{})[_0xd184('0x2d')](respondWithResult(_0x1dc6ab,0xc9))['catch'](handleError(_0x1dc6ab,null));};exports['update']=function(_0x257a04,_0x314337){if(_0x257a04[_0xd184('0x51')]['id']){delete _0x257a04[_0xd184('0x51')]['id'];}return db['FreshdeskAccount'][_0xd184('0x4f')]({'where':{'id':_0x257a04[_0xd184('0x4e')]['id']}})[_0xd184('0x2d')](handleEntityNotFound(_0x314337,null))[_0xd184('0x2d')](saveUpdates(_0x257a04[_0xd184('0x51')],null))['then'](respondWithResult(_0x314337,null))[_0xd184('0x1f')](handleError(_0x314337,null));};exports[_0xd184('0x2e')]=function(_0x2a9b91,_0x457d40){return db[_0xd184('0x33')]['find']({'where':{'id':_0x2a9b91[_0xd184('0x4e')]['id']}})[_0xd184('0x2d')](handleEntityNotFound(_0x457d40,null))[_0xd184('0x2d')](removeEntity(_0x457d40,null))[_0xd184('0x1f')](handleError(_0x457d40,null));};exports['getConfigurations']=function(_0x13abae,_0xdcc448,_0x1b73f6){var _0x24b0f5={};var _0x2f353a={};var _0x15ef75;var _0x1b2725;return db[_0xd184('0x33')][_0xd184('0x52')]({'where':{'id':_0x13abae['params']['id']}})[_0xd184('0x2d')](handleEntityNotFound(_0xdcc448,null))[_0xd184('0x2d')](function(_0x19d585){if(_0x19d585){_0x15ef75=_0x19d585;_0x2f353a[_0xd184('0x3a')]=_['keys'](db[_0xd184('0x53')]['rawAttributes']);_0x2f353a[_0xd184('0x35')]=_[_0xd184('0x38')](_0x13abae[_0xd184('0x35')]);_0x2f353a[_0xd184('0x39')]=_['intersection'](_0x2f353a[_0xd184('0x3a')],_0x2f353a[_0xd184('0x35')]);_0x24b0f5[_0xd184('0x3b')]=_[_0xd184('0x3c')](_0x2f353a[_0xd184('0x3a')],qs[_0xd184('0x3d')](_0x13abae['query'][_0xd184('0x3d')]));_0x24b0f5[_0xd184('0x3b')]=_0x24b0f5[_0xd184('0x3b')][_0xd184('0x3e')]?_0x24b0f5[_0xd184('0x3b')]:_0x2f353a['model'];_0x24b0f5[_0xd184('0x41')]=qs[_0xd184('0x42')](_0x13abae[_0xd184('0x35')][_0xd184('0x42')]);_0x24b0f5['where']=qs[_0xd184('0x39')](_[_0xd184('0x54')](_0x13abae['query'],_0x2f353a[_0xd184('0x39')]));if(_0x13abae['query'][_0xd184('0x47')]){_0x24b0f5['where']=_[_0xd184('0x45')](_0x24b0f5[_0xd184('0x46')],{'$or':_['map'](_0x24b0f5[_0xd184('0x3b')],function(_0x249271){var _0x30baf7={};_0x30baf7[_0x249271]={'$like':'%'+_0x13abae[_0xd184('0x35')][_0xd184('0x47')]+'%'};return _0x30baf7;})});}_0x24b0f5=_[_0xd184('0x45')]({},_0x24b0f5,_0x13abae[_0xd184('0x49')]);return _0x15ef75[_0xd184('0x55')](_0x24b0f5);}})[_0xd184('0x2d')](function(_0x521b58){if(_0x521b58){_0x1b2725=_0x521b58[_0xd184('0x3e')];if(!_0x13abae['query'][_0xd184('0x3f')](_0xd184('0x40'))){_0x24b0f5[_0xd184('0x25')]=qs[_0xd184('0x25')](_0x13abae[_0xd184('0x35')][_0xd184('0x25')]);_0x24b0f5['offset']=qs[_0xd184('0x24')](_0x13abae[_0xd184('0x35')][_0xd184('0x24')]);}return _0x15ef75['getConfigurations'](_0x24b0f5);}})[_0xd184('0x2d')](function(_0x16c649){if(_0x16c649){return _0x16c649?{'count':_0x1b2725,'rows':_0x16c649}:null;}})[_0xd184('0x2d')](respondWithResult(_0xdcc448,null))[_0xd184('0x1f')](handleError(_0xdcc448,null));};exports[_0xd184('0x56')]=function(_0x35d449,_0xb56853,_0x3dcbc8){if(_0x35d449[_0xd184('0x51')]['id']){delete _0x35d449[_0xd184('0x51')]['id'];}return db['FreshdeskAccount'][_0xd184('0x52')]({'where':{'id':_0x35d449[_0xd184('0x4e')]['id']}})[_0xd184('0x2d')](handleEntityNotFound(_0xb56853,null))[_0xd184('0x2d')](function(_0x1c9334){if(_0x1c9334){_0x35d449[_0xd184('0x51')][_0xd184('0x57')]=_0x1c9334['id'];_0x35d449[_0xd184('0x51')][_0xd184('0x58')]=integrations['getSubjects'](_0x35d449[_0xd184('0x51')][_0xd184('0x59')],_0x35d449[_0xd184('0x51')][_0xd184('0x5a')]);_0x35d449[_0xd184('0x51')][_0xd184('0x5b')]=integrations[_0xd184('0x5c')](_0x35d449['body'][_0xd184('0x59')],_0x35d449[_0xd184('0x51')][_0xd184('0x5a')]);return db[_0xd184('0x53')][_0xd184('0x50')](_0x35d449[_0xd184('0x51')],{'include':[{'model':db[_0xd184('0x5d')],'as':_0xd184('0x58')},{'model':db['FreshdeskField'],'as':_0xd184('0x5b')}]});}return null;})[_0xd184('0x2d')](respondWithResult(_0xb56853,null))[_0xd184('0x1f')](handleError(_0xb56853,null));};exports[_0xd184('0x5e')]=function(_0xa8403b,_0x5101b9,_0x39219f){return db[_0xd184('0x33')][_0xd184('0x52')]({'where':{'id':_0xa8403b[_0xd184('0x4e')]['id']},'attributes':['id',_0xd184('0x5f'),_0xd184('0x60')]})[_0xd184('0x2d')](handleEntityNotFound(_0x5101b9,null))[_0xd184('0x2d')](function(_0x3b93b3){if(_0x3b93b3){return rp({'method':_0xd184('0x61'),'uri':util['format'](_0xd184('0x62'),_0x3b93b3[_0xd184('0x5f')],_0xd184('0x63')),'headers':{'Authorization':util[_0xd184('0x64')](_0xd184('0x65'),new Buffer(util[_0xd184('0x64')](_0xd184('0x66'),_0x3b93b3[_0xd184('0x60')]))[_0xd184('0x67')](_0xd184('0x68')))},'json':!![]});}})[_0xd184('0x2d')](function(_0x319cb2){if(_0x319cb2){var _0x3b0fa2=[_0xd184('0x69'),_0xd184('0x6a'),_0xd184('0x6b'),'description',_0xd184('0x26'),_0xd184('0x6c'),_0xd184('0x6d'),_0xd184('0x6e'),'ticket_type',_0xd184('0x6d'),'company'];_['remove'](_0x319cb2,function(_0xf0133f){return _0x3b0fa2[_0xd184('0x6f')](_0xf0133f[_0xd184('0x30')])||!_0xf0133f[_0xd184('0x70')]&&_0xf0133f['type']!==_0xd184('0x71');});return{'count':_0x319cb2[_0xd184('0x3e')],'rows':_[_0xd184('0x48')](_0x319cb2,function(_0x4cff33){return{'id':_0x4cff33[_0xd184('0x30')],'name':_0x4cff33[_0xd184('0x72')],'custom':!_0x4cff33[_0xd184('0x70')],'options':_0x4cff33[_0xd184('0x73')]?_[_0xd184('0x48')](_0x4cff33[_0xd184('0x73')],function(_0x3ba17e){return{'name':_[_0xd184('0x74')](_0x3ba17e),'value':_0x3ba17e};}):[]};})};}})[_0xd184('0x2d')](respondWithResult(_0x5101b9,null))[_0xd184('0x1f')](function(_0xd4be34){var _0x2fe9e3=_0xa8403b[_0xd184('0x35')][_0xd184('0x75')]?0x1f4:_0xd4be34[_0xd184('0x76')]||0x1f4;logger[_0xd184('0x1b')](_0xd184('0x77'),_0xd184('0x5e'),_0x2fe9e3,JSON[_0xd184('0x1a')](_0xd4be34));delete _0xd4be34[_0xd184('0x30')];if(_0x2fe9e3===0x191){_0x2fe9e3=0x190;}_0x5101b9[_0xd184('0x26')](_0x2fe9e3)[_0xd184('0x31')](_0xa8403b['query'][_0xd184('0x75')]?{'message':_0xd184('0x78'),'statusCode':_0xd4be34[_0xd184('0x76')]}:_0xd4be34);});}; \ No newline at end of file +var _0x039a=['mustache','util','path','to-csv','ejs','lodash','crypto','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','client','http','then','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskAccount,\x20%s,\x20%s','catch','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','send','index','FreshdeskAccount','keys','query','dateEnd','dateStart','filters','model','attributes','intersection','fields','length','order','where','pick','add','day','merge','filter','count','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','findOne','sort','map','hasOwnProperty','getConfigurations','AccountId','channel','type','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','source','group','company','remove','includes','default','custom_text','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','request-promise','bluebird'];(function(_0x1f5070,_0x3fa65f){var _0x2b9cfd=function(_0x3a2cae){while(--_0x3a2cae){_0x1f5070['push'](_0x1f5070['shift']());}};_0x2b9cfd(++_0x3fa65f);}(_0x039a,0x6f));var _0xa039=function(_0x177dc7,_0x13501c){_0x177dc7=_0x177dc7-0x0;var _0x19b7dc=_0x039a[_0x177dc7];return _0x19b7dc;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa039('0x0'));var moment=require('moment');var BPromise=require(_0xa039('0x1'));var Mustache=require(_0xa039('0x2'));var util=require(_0xa039('0x3'));var path=require(_0xa039('0x4'));var sox=require('sox');var csv=require(_0xa039('0x5'));var ejs=require(_0xa039('0x6'));var fs=require('fs');var _=require(_0xa039('0x7'));var squel=require('squel');var crypto=require(_0xa039('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xa039('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xa039('0xa'));var logger=require(_0xa039('0xb'))(_0xa039('0xc'));var utils=require(_0xa039('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xa039('0xe')][_0xa039('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x1b2820,_0x589759,_0x4656af,_0x29e7c5){return new BPromise(function(_0x57971b,_0x38b775){var _0x26a294=_0x29e7c5||client;return _0x26a294['request'](_0x1b2820,_0x4656af)[_0xa039('0x10')](function(_0x191c45){logger[_0xa039('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0xa039('0x12'));logger[_0xa039('0x13')](_0xa039('0x14'),_0x589759,_0xa039('0x12'),JSON[_0xa039('0x15')](_0x191c45));if(_0x191c45[_0xa039('0x16')]){if(_0x191c45[_0xa039('0x16')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x191c45[_0xa039('0x16')][_0xa039('0x17')]);return _0x38b775(_0x191c45[_0xa039('0x16')]['message']);}logger[_0xa039('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x191c45[_0xa039('0x16')]['message']);return _0x57971b(_0x191c45[_0xa039('0x16')][_0xa039('0x17')]);}else{logger['info'](_0xa039('0x18'),_0x589759,_0xa039('0x12'));_0x57971b(_0x191c45['result']['message']);}})[_0xa039('0x19')](function(_0x23b3df){logger[_0xa039('0x16')]('FreshdeskAccount,\x20%s,\x20%s',_0x589759,_0x23b3df);_0x38b775(_0x23b3df);});});}function respondWithStatusCode(_0x5af279,_0x1c764f){_0x1c764f=_0x1c764f||0xcc;return function(_0x45c769){if(_0x45c769){return _0x5af279['sendStatus'](_0x1c764f);}return _0x5af279[_0xa039('0x1a')](_0x1c764f)['end']();};}function respondWithResult(_0x305e4e,_0x3ee72e){_0x3ee72e=_0x3ee72e||0xc8;return function(_0x50b986){if(_0x50b986){return _0x305e4e[_0xa039('0x1a')](_0x3ee72e)[_0xa039('0x1b')](_0x50b986);}};}function respondWithFilteredResult(_0x5bdbba,_0x49e9c0){return function(_0x4de9c2){if(_0x4de9c2){var _0x3a4410=_0x4de9c2['count'],_0xbe36ad=_0x49e9c0[_0xa039('0x1c')],_0x33ea45=_0x49e9c0[_0xa039('0x1c')]+_0x49e9c0[_0xa039('0x1d')],_0x4b86a9;if(_0x33ea45>=_0x3a4410){_0x33ea45=_0x3a4410;_0x4b86a9=0xc8;}else{_0x4b86a9=0xce;}_0x5bdbba[_0xa039('0x1a')](_0x4b86a9);return _0x5bdbba[_0xa039('0x1e')](_0xa039('0x1f'),_0xbe36ad+'-'+_0x33ea45+'/'+_0x3a4410)[_0xa039('0x1b')](_0x4de9c2);}return null;};}function patchUpdates(_0x417a29){return function(_0x1b4a9a){try{jsonpatch[_0xa039('0x20')](_0x1b4a9a,_0x417a29,!![]);}catch(_0x4ffcde){return BPromise[_0xa039('0x21')](_0x4ffcde);}return _0x1b4a9a[_0xa039('0x22')]();};}function saveUpdates(_0x47b923,_0x2cad7a){return function(_0x33a1cb){if(_0x33a1cb){return _0x33a1cb[_0xa039('0x23')](_0x47b923)[_0xa039('0x10')](function(_0x206e01){return _0x206e01;});}return null;};}function removeEntity(_0x4a46f7,_0x1b1d30){return function(_0x2fdf02){if(_0x2fdf02){return _0x2fdf02[_0xa039('0x24')]()[_0xa039('0x10')](function(){_0x4a46f7[_0xa039('0x1a')](0xcc)[_0xa039('0x25')]();});}};}function handleEntityNotFound(_0x560a75,_0x4f59f6){return function(_0x438da7){if(!_0x438da7){_0x560a75[_0xa039('0x26')](0x194);}return _0x438da7;};}function handleError(_0x112d35,_0x48a1ee){_0x48a1ee=_0x48a1ee||0x1f4;return function(_0x2c1355){logger[_0xa039('0x16')](_0x2c1355[_0xa039('0x27')]);if(_0x2c1355[_0xa039('0x28')]){delete _0x2c1355[_0xa039('0x28')];}_0x112d35[_0xa039('0x1a')](_0x48a1ee)[_0xa039('0x29')](_0x2c1355);};}exports[_0xa039('0x2a')]=function(_0x4038f7,_0x18fd59){var _0x5aa6fb={},_0x4cfc5f={},_0x32da30={'count':0x0,'rows':[]};var _0x4240d4=db[_0xa039('0x2b')]['rawAttributes'];_0x4cfc5f['model']=_[_0xa039('0x2c')](_0x4240d4);var _0x213203={'dateStart':_0x4038f7[_0xa039('0x2d')]['dateStart'],'dateEnd':_0x4038f7[_0xa039('0x2d')][_0xa039('0x2e')]};delete _0x4038f7[_0xa039('0x2d')][_0xa039('0x2f')];delete _0x4038f7[_0xa039('0x2d')][_0xa039('0x2e')];_0x4cfc5f[_0xa039('0x2d')]=_[_0xa039('0x2c')](_0x4038f7['query']);_0x4cfc5f[_0xa039('0x30')]=_['intersection'](_0x4cfc5f[_0xa039('0x31')],_0x4cfc5f[_0xa039('0x2d')]);_0x5aa6fb[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4cfc5f[_0xa039('0x31')],qs['fields'](_0x4038f7['query'][_0xa039('0x34')]));_0x5aa6fb[_0xa039('0x32')]=_0x5aa6fb['attributes'][_0xa039('0x35')]?_0x5aa6fb['attributes']:_0x4cfc5f[_0xa039('0x31')];if(!_0x4038f7[_0xa039('0x2d')]['hasOwnProperty']('nolimit')){_0x5aa6fb[_0xa039('0x1d')]=qs[_0xa039('0x1d')](_0x4038f7[_0xa039('0x2d')][_0xa039('0x1d')]);_0x5aa6fb[_0xa039('0x1c')]=qs[_0xa039('0x1c')](_0x4038f7['query'][_0xa039('0x1c')]);}_0x5aa6fb[_0xa039('0x36')]=qs['sort'](_0x4038f7[_0xa039('0x2d')]['sort']);_0x5aa6fb[_0xa039('0x37')]=qs['filters'](_[_0xa039('0x38')](_0x4038f7[_0xa039('0x2d')],_0x4cfc5f[_0xa039('0x30')]));if(_0x213203[_0xa039('0x2f')]){if(_0x213203[_0xa039('0x2e')]){_0x213203[_0xa039('0x2e')]=moment(_0x213203['dateEnd'])[_0xa039('0x39')](0x1,_0xa039('0x3a'));}else{_0x213203['dateEnd']=moment(_0x213203[_0xa039('0x2f')])[_0xa039('0x39')](0x1,_0xa039('0x3a'));}_[_0xa039('0x3b')](_0x5aa6fb['where'],{'createdAt':{'$gte':_0x213203[_0xa039('0x2f')],'$lte':_0x213203[_0xa039('0x2e')]}});}if(_0x4038f7['query'][_0xa039('0x3c')]){_0x5aa6fb[_0xa039('0x37')]=_[_0xa039('0x3b')](_0x5aa6fb[_0xa039('0x37')],{'$or':_['map'](_0x5aa6fb[_0xa039('0x32')],function(_0x56d746){var _0x41eabf={};_0x41eabf[_0x56d746]={'$like':'%'+_0x4038f7['query']['filter']+'%'};return _0x41eabf;})});}_0x5aa6fb=_[_0xa039('0x3b')]({},_0x5aa6fb,_0x4038f7['options']);var _0xfb6d70={'where':_0x5aa6fb[_0xa039('0x37')]};return db[_0xa039('0x2b')]['count'](_0xfb6d70)[_0xa039('0x10')](function(_0x5f0f8b){_0x32da30[_0xa039('0x3d')]=_0x5f0f8b;if(_0x4038f7['query'][_0xa039('0x3e')]){_0x5aa6fb['include']=[{'all':!![]}];}return db[_0xa039('0x2b')][_0xa039('0x3f')](_0x5aa6fb);})[_0xa039('0x10')](function(_0x84bbc7){_0x32da30[_0xa039('0x40')]=_0x84bbc7;return _0x32da30;})[_0xa039('0x10')](respondWithFilteredResult(_0x18fd59,_0x5aa6fb))[_0xa039('0x19')](handleError(_0x18fd59,null));};exports[_0xa039('0x41')]=function(_0x1e99c8,_0x16f396){var _0x19d688={'raw':![],'where':{'id':_0x1e99c8[_0xa039('0x42')]['id']}},_0x4db92f={};_0x4db92f[_0xa039('0x31')]=_['keys'](db['FreshdeskAccount'][_0xa039('0x43')]);_0x4db92f[_0xa039('0x2d')]=_['keys'](_0x1e99c8[_0xa039('0x2d')]);_0x4db92f[_0xa039('0x30')]=_[_0xa039('0x33')](_0x4db92f[_0xa039('0x31')],_0x4db92f[_0xa039('0x2d')]);_0x19d688[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4db92f['model'],qs[_0xa039('0x34')](_0x1e99c8[_0xa039('0x2d')][_0xa039('0x34')]));_0x19d688[_0xa039('0x32')]=_0x19d688[_0xa039('0x32')][_0xa039('0x35')]?_0x19d688[_0xa039('0x32')]:_0x4db92f[_0xa039('0x31')];if(_0x1e99c8[_0xa039('0x2d')]['includeAll']){_0x19d688[_0xa039('0x44')]=[{'all':!![]}];}_0x19d688=_[_0xa039('0x3b')]({},_0x19d688,_0x1e99c8['options']);return db[_0xa039('0x2b')][_0xa039('0x45')](_0x19d688)[_0xa039('0x10')](handleEntityNotFound(_0x16f396,null))[_0xa039('0x10')](respondWithResult(_0x16f396,null))[_0xa039('0x19')](handleError(_0x16f396,null));};exports[_0xa039('0x46')]=function(_0x432727,_0xfd6dd8){return db[_0xa039('0x2b')][_0xa039('0x46')](_0x432727['body'],{})['then'](respondWithResult(_0xfd6dd8,0xc9))[_0xa039('0x19')](handleError(_0xfd6dd8,null));};exports[_0xa039('0x23')]=function(_0x3d9f2c,_0x5cefc3){if(_0x3d9f2c[_0xa039('0x47')]['id']){delete _0x3d9f2c[_0xa039('0x47')]['id'];}return db['FreshdeskAccount'][_0xa039('0x45')]({'where':{'id':_0x3d9f2c[_0xa039('0x42')]['id']}})['then'](handleEntityNotFound(_0x5cefc3,null))[_0xa039('0x10')](saveUpdates(_0x3d9f2c['body'],null))[_0xa039('0x10')](respondWithResult(_0x5cefc3,null))[_0xa039('0x19')](handleError(_0x5cefc3,null));};exports[_0xa039('0x24')]=function(_0x4445e0,_0x24823e){return db[_0xa039('0x2b')]['find']({'where':{'id':_0x4445e0[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0x24823e,null))['then'](removeEntity(_0x24823e,null))[_0xa039('0x19')](handleError(_0x24823e,null));};exports['getConfigurations']=function(_0x3e1798,_0xe4d701,_0xcef48e){var _0x1eb59a={};var _0x4e6f45={};var _0x47b615;var _0x5e61a4;return db[_0xa039('0x2b')][_0xa039('0x48')]({'where':{'id':_0x3e1798[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0xe4d701,null))['then'](function(_0x4d432e){if(_0x4d432e){_0x47b615=_0x4d432e;_0x4e6f45[_0xa039('0x31')]=_[_0xa039('0x2c')](db['FreshdeskConfiguration'][_0xa039('0x43')]);_0x4e6f45[_0xa039('0x2d')]=_['keys'](_0x3e1798[_0xa039('0x2d')]);_0x4e6f45[_0xa039('0x30')]=_[_0xa039('0x33')](_0x4e6f45[_0xa039('0x31')],_0x4e6f45[_0xa039('0x2d')]);_0x1eb59a[_0xa039('0x32')]=_[_0xa039('0x33')](_0x4e6f45[_0xa039('0x31')],qs[_0xa039('0x34')](_0x3e1798['query']['fields']));_0x1eb59a[_0xa039('0x32')]=_0x1eb59a[_0xa039('0x32')]['length']?_0x1eb59a['attributes']:_0x4e6f45[_0xa039('0x31')];_0x1eb59a[_0xa039('0x36')]=qs['sort'](_0x3e1798['query'][_0xa039('0x49')]);_0x1eb59a[_0xa039('0x37')]=qs[_0xa039('0x30')](_['pick'](_0x3e1798[_0xa039('0x2d')],_0x4e6f45[_0xa039('0x30')]));if(_0x3e1798[_0xa039('0x2d')][_0xa039('0x3c')]){_0x1eb59a[_0xa039('0x37')]=_[_0xa039('0x3b')](_0x1eb59a[_0xa039('0x37')],{'$or':_[_0xa039('0x4a')](_0x1eb59a[_0xa039('0x32')],function(_0x5d3184){var _0x9d8a94={};_0x9d8a94[_0x5d3184]={'$like':'%'+_0x3e1798[_0xa039('0x2d')][_0xa039('0x3c')]+'%'};return _0x9d8a94;})});}_0x1eb59a=_[_0xa039('0x3b')]({},_0x1eb59a,_0x3e1798['options']);return _0x47b615['getConfigurations'](_0x1eb59a);}})[_0xa039('0x10')](function(_0x3d8809){if(_0x3d8809){_0x5e61a4=_0x3d8809[_0xa039('0x35')];if(!_0x3e1798[_0xa039('0x2d')][_0xa039('0x4b')]('nolimit')){_0x1eb59a[_0xa039('0x1d')]=qs[_0xa039('0x1d')](_0x3e1798[_0xa039('0x2d')][_0xa039('0x1d')]);_0x1eb59a[_0xa039('0x1c')]=qs[_0xa039('0x1c')](_0x3e1798['query'][_0xa039('0x1c')]);}return _0x47b615[_0xa039('0x4c')](_0x1eb59a);}})[_0xa039('0x10')](function(_0x435ad8){if(_0x435ad8){return _0x435ad8?{'count':_0x5e61a4,'rows':_0x435ad8}:null;}})['then'](respondWithResult(_0xe4d701,null))[_0xa039('0x19')](handleError(_0xe4d701,null));};exports['addConfiguration']=function(_0xf0c655,_0x543acc,_0x577bca){if(_0xf0c655[_0xa039('0x47')]['id']){delete _0xf0c655[_0xa039('0x47')]['id'];}return db[_0xa039('0x2b')][_0xa039('0x48')]({'where':{'id':_0xf0c655[_0xa039('0x42')]['id']}})[_0xa039('0x10')](handleEntityNotFound(_0x543acc,null))['then'](function(_0x283d18){if(_0x283d18){_0xf0c655['body'][_0xa039('0x4d')]=_0x283d18['id'];_0xf0c655['body']['Subjects']=integrations['getSubjects'](_0xf0c655[_0xa039('0x47')][_0xa039('0x4e')],_0xf0c655['body'][_0xa039('0x4f')]);_0xf0c655[_0xa039('0x47')][_0xa039('0x50')]=integrations[_0xa039('0x51')](_0xf0c655[_0xa039('0x47')][_0xa039('0x4e')],_0xf0c655[_0xa039('0x47')][_0xa039('0x4f')]);return db['FreshdeskConfiguration'][_0xa039('0x46')](_0xf0c655['body'],{'include':[{'model':db[_0xa039('0x52')],'as':_0xa039('0x53')},{'model':db[_0xa039('0x52')],'as':_0xa039('0x50')}]});}return null;})[_0xa039('0x10')](respondWithResult(_0x543acc,null))[_0xa039('0x19')](handleError(_0x543acc,null));};exports[_0xa039('0x54')]=function(_0x5229f2,_0x577568,_0x379b59){return db[_0xa039('0x2b')]['findOne']({'where':{'id':_0x5229f2['params']['id']},'attributes':['id',_0xa039('0x55'),_0xa039('0x56')]})['then'](handleEntityNotFound(_0x577568,null))[_0xa039('0x10')](function(_0xb174a0){if(_0xb174a0){return rp({'method':_0xa039('0x57'),'uri':util['format']('%s%s',_0xb174a0[_0xa039('0x55')],_0xa039('0x58')),'headers':{'Authorization':util[_0xa039('0x59')](_0xa039('0x5a'),new Buffer(util[_0xa039('0x59')](_0xa039('0x5b'),_0xb174a0[_0xa039('0x56')]))[_0xa039('0x5c')](_0xa039('0x5d')))},'json':!![]});}})[_0xa039('0x10')](function(_0x292b11){if(_0x292b11){var _0x3d900e=[_0xa039('0x5e'),_0xa039('0x5f'),_0xa039('0x60'),_0xa039('0x61'),'status',_0xa039('0x62'),'group',_0xa039('0x63'),'ticket_type',_0xa039('0x64'),_0xa039('0x65')];_[_0xa039('0x66')](_0x292b11,function(_0x5453cd){return _0x3d900e[_0xa039('0x67')](_0x5453cd[_0xa039('0x28')])||!_0x5453cd[_0xa039('0x68')]&&_0x5453cd['type']!==_0xa039('0x69');});return{'count':_0x292b11[_0xa039('0x35')],'rows':_[_0xa039('0x4a')](_0x292b11,function(_0x44f6e4){return{'id':_0x44f6e4[_0xa039('0x28')],'name':_0x44f6e4[_0xa039('0x6a')],'custom':!_0x44f6e4[_0xa039('0x68')],'options':_0x44f6e4['choices']?_[_0xa039('0x4a')](_0x44f6e4[_0xa039('0x6b')],function(_0x1e0ace){return{'name':_[_0xa039('0x6c')](_0x1e0ace),'value':_0x1e0ace};}):[]};})};}})[_0xa039('0x10')](respondWithResult(_0x577568,null))[_0xa039('0x19')](function(_0x25d34e){var _0x17fa65=_0x5229f2[_0xa039('0x2d')][_0xa039('0x6d')]?0x1f4:_0x25d34e[_0xa039('0x6e')]||0x1f4;logger[_0xa039('0x16')](_0xa039('0x6f'),_0xa039('0x54'),_0x17fa65,JSON[_0xa039('0x15')](_0x25d34e));delete _0x25d34e['name'];if(_0x17fa65===0x191){_0x17fa65=0x190;}_0x577568[_0xa039('0x1a')](_0x17fa65)[_0xa039('0x29')](_0x5229f2[_0xa039('0x2d')][_0xa039('0x6d')]?{'message':_0xa039('0x70'),'statusCode':_0x25d34e[_0xa039('0x6e')]}:_0x25d34e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index bdaa03d..86e75a9 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 _0x20c6=['exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../components/integrations/configuration'];(function(_0x19318e,_0x46c067){var _0x425540=function(_0xb4e055){while(--_0xb4e055){_0x19318e['push'](_0x19318e['shift']());}};_0x425540(++_0x46c067);}(_0x20c6,0x1e8));var _0x620c=function(_0x175f33,_0x58b838){_0x175f33=_0x175f33-0x0;var _0x250a92=_0x20c6[_0x175f33];return _0x250a92;};'use strict';var _=require(_0x620c('0x0'));var util=require(_0x620c('0x1'));var logger=require(_0x620c('0x2'))(_0x620c('0x3'));var moment=require(_0x620c('0x4'));var BPromise=require(_0x620c('0x5'));var rp=require('request-promise');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x620c('0x6'));module[_0x620c('0x7')]=function(_0x1c3e39,_0x5bf2dd){return _0x1c3e39[_0x620c('0x8')](_0x620c('0x9'),attributes,{'tableName':_0x620c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0624=['moment','bluebird','request-promise','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x5df332,_0x261dbe){var _0x42dc78=function(_0xb5f83b){while(--_0xb5f83b){_0x5df332['push'](_0x5df332['shift']());}};_0x42dc78(++_0x261dbe);}(_0x0624,0x132));var _0x4062=function(_0x49f69c,_0x5d4ff6){_0x49f69c=_0x49f69c-0x0;var _0x2c3029=_0x0624[_0x49f69c];return _0x2c3029;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4062('0x0'));var BPromise=require(_0x4062('0x1'));var rp=require(_0x4062('0x2'));var attributes=require(_0x4062('0x3'));var integrations=require(_0x4062('0x4'));module[_0x4062('0x5')]=function(_0x4bb157,_0x553d08){return _0x4bb157[_0x4062('0x6')](_0x4062('0x7'),attributes,{'tableName':_0x4062('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 72f0d4c..37c7cec 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 _0x7948=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','FreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','GetFreshdeskAccount','find','where','ShowFreshdeskAccount','catch','lodash'];(function(_0x42233a,_0x1982ea){var _0x3c8f0b=function(_0x543d35){while(--_0x543d35){_0x42233a['push'](_0x42233a['shift']());}};_0x3c8f0b(++_0x1982ea);}(_0x7948,0x185));var _0x8794=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x7948[_0x576266];return _0x18234f;};'use strict';var _=require(_0x8794('0x0'));var util=require(_0x8794('0x1'));var moment=require(_0x8794('0x2'));var BPromise=require(_0x8794('0x3'));var rs=require(_0x8794('0x4'));var fs=require('fs');var db=require(_0x8794('0x5'))['db'];var utils=require(_0x8794('0x6'));var logger=require(_0x8794('0x7'))(_0x8794('0x8'));var config=require(_0x8794('0x9'));var jayson=require(_0x8794('0xa'));var client=jayson[_0x8794('0xb')][_0x8794('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1540b9,_0x28d12e,_0x2276f2){return new BPromise(function(_0x22b452,_0x27f31e){return client[_0x8794('0xd')](_0x1540b9,_0x2276f2)[_0x8794('0xe')](function(_0x1a8f7f){logger[_0x8794('0xf')](_0x8794('0x10'),_0x28d12e,_0x8794('0x11'));logger[_0x8794('0x12')](_0x8794('0x13'),_0x28d12e,_0x8794('0x11'),JSON[_0x8794('0x14')](_0x1a8f7f));if(_0x1a8f7f[_0x8794('0x15')]){if(_0x1a8f7f[_0x8794('0x15')][_0x8794('0x16')]===0x1f4){logger['error'](_0x8794('0x10'),_0x28d12e,_0x1a8f7f[_0x8794('0x15')][_0x8794('0x17')]);return _0x27f31e(_0x1a8f7f[_0x8794('0x15')][_0x8794('0x17')]);}logger[_0x8794('0x15')](_0x8794('0x10'),_0x28d12e,_0x1a8f7f[_0x8794('0x15')][_0x8794('0x17')]);return _0x22b452(_0x1a8f7f[_0x8794('0x15')][_0x8794('0x17')]);}else{logger[_0x8794('0xf')](_0x8794('0x10'),_0x28d12e,'request\x20sent');_0x22b452(_0x1a8f7f[_0x8794('0x18')]['message']);}})['catch'](function(_0x31f66c){logger[_0x8794('0x15')](_0x8794('0x10'),_0x28d12e,_0x31f66c);_0x27f31e(_0x31f66c);});});}exports['GetFreshdeskAccount']=function(_0x24ae6a){var _0x206039=this;return new Promise(function(_0x46be4d,_0x5c2300){return db[_0x8794('0x19')][_0x8794('0x1a')]({'raw':_0x24ae6a[_0x8794('0x1b')]?_0x24ae6a['options'][_0x8794('0x1c')]===undefined?!![]:![]:!![],'where':_0x24ae6a[_0x8794('0x1b')]?_0x24ae6a[_0x8794('0x1b')]['where']||null:null,'attributes':_0x24ae6a[_0x8794('0x1b')]?_0x24ae6a['options'][_0x8794('0x1d')]||null:null,'limit':_0x24ae6a[_0x8794('0x1b')]?_0x24ae6a[_0x8794('0x1b')][_0x8794('0x1e')]||null:null,'include':_0x24ae6a[_0x8794('0x1b')]?_0x24ae6a[_0x8794('0x1b')][_0x8794('0x1f')]?_[_0x8794('0x20')](_0x24ae6a[_0x8794('0x1b')][_0x8794('0x1f')],function(_0x518eb6){return{'model':db[_0x518eb6[_0x8794('0x21')]],'as':_0x518eb6['as'],'attributes':_0x518eb6['attributes'],'include':_0x518eb6[_0x8794('0x1f')]?_[_0x8794('0x20')](_0x518eb6['include'],function(_0x1b0169){return{'model':db[_0x1b0169['model']],'as':_0x1b0169['as'],'attributes':_0x1b0169[_0x8794('0x1d')],'include':_0x1b0169['include']?_[_0x8794('0x20')](_0x1b0169['include'],function(_0x17cbd2){return{'model':db[_0x17cbd2[_0x8794('0x21')]],'as':_0x17cbd2['as'],'attributes':_0x17cbd2[_0x8794('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e3afc){logger[_0x8794('0xf')](_0x8794('0x22'),_0x24ae6a);logger[_0x8794('0x12')]('GetFreshdeskAccount',_0x24ae6a,JSON[_0x8794('0x14')](_0x5e3afc));_0x46be4d(_0x5e3afc);})['catch'](function(_0x4cb01c){logger[_0x8794('0x15')](_0x8794('0x22'),_0x4cb01c[_0x8794('0x17')],_0x24ae6a);_0x5c2300(_0x206039[_0x8794('0x15')](0x1f4,_0x4cb01c[_0x8794('0x17')]));});});};exports['ShowFreshdeskAccount']=function(_0x2d695c){var _0x375ac1=this;return new Promise(function(_0x2b23ae,_0x344409){return db['FreshdeskAccount'][_0x8794('0x23')]({'raw':_0x2d695c[_0x8794('0x1b')]?_0x2d695c['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d695c[_0x8794('0x1b')]?_0x2d695c[_0x8794('0x1b')][_0x8794('0x24')]||null:null,'attributes':_0x2d695c[_0x8794('0x1b')]?_0x2d695c['options']['attributes']||null:null,'include':_0x2d695c[_0x8794('0x1b')]?_0x2d695c[_0x8794('0x1b')][_0x8794('0x1f')]?_[_0x8794('0x20')](_0x2d695c[_0x8794('0x1b')][_0x8794('0x1f')],function(_0x2080e9){return{'model':db[_0x2080e9[_0x8794('0x21')]],'as':_0x2080e9['as'],'attributes':_0x2080e9[_0x8794('0x1d')],'include':_0x2080e9[_0x8794('0x1f')]?_[_0x8794('0x20')](_0x2080e9['include'],function(_0x3e149b){return{'model':db[_0x3e149b[_0x8794('0x21')]],'as':_0x3e149b['as'],'attributes':_0x3e149b[_0x8794('0x1d')],'include':_0x3e149b[_0x8794('0x1f')]?_['map'](_0x3e149b['include'],function(_0x265078){return{'model':db[_0x265078[_0x8794('0x21')]],'as':_0x265078['as'],'attributes':_0x265078[_0x8794('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8794('0xe')](function(_0x3b69ff){logger[_0x8794('0xf')](_0x8794('0x25'),_0x2d695c);logger[_0x8794('0x12')]('ShowFreshdeskAccount',_0x2d695c,JSON[_0x8794('0x14')](_0x3b69ff));_0x2b23ae(_0x3b69ff);})[_0x8794('0x26')](function(_0x279a01){logger['error'](_0x8794('0x25'),_0x279a01[_0x8794('0x17')],_0x2d695c);_0x344409(_0x375ac1[_0x8794('0x15')](0x1f4,_0x279a01[_0x8794('0x17')]));});});}; \ No newline at end of file +var _0x689b=['result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','FreshdeskAccount','find','stringify','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','code','FreshdeskAccount,\x20%s,\x20%s','message'];(function(_0x56fb02,_0x179d7a){var _0x177f5b=function(_0x47e149){while(--_0x47e149){_0x56fb02['push'](_0x56fb02['shift']());}};_0x177f5b(++_0x179d7a);}(_0x689b,0x142));var _0xb689=function(_0x443ed0,_0x532284){_0x443ed0=_0x443ed0-0x0;var _0x4425d1=_0x689b[_0x443ed0];return _0x4425d1;};'use strict';var _=require(_0xb689('0x0'));var util=require('util');var moment=require(_0xb689('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xb689('0x2'))['db'];var utils=require(_0xb689('0x3'));var logger=require(_0xb689('0x4'))(_0xb689('0x5'));var config=require(_0xb689('0x6'));var jayson=require(_0xb689('0x7'));var client=jayson[_0xb689('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b9fed,_0x5ee263,_0x47752c){return new BPromise(function(_0x56c6ba,_0x6eaf58){return client[_0xb689('0x9')](_0x1b9fed,_0x47752c)[_0xb689('0xa')](function(_0x4e7c57){logger[_0xb689('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,'request\x20sent');logger[_0xb689('0xc')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x5ee263,_0xb689('0xd'),JSON['stringify'](_0x4e7c57));if(_0x4e7c57[_0xb689('0xe')]){if(_0x4e7c57[_0xb689('0xe')][_0xb689('0xf')]===0x1f4){logger[_0xb689('0xe')](_0xb689('0x10'),_0x5ee263,_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);return _0x6eaf58(_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);}logger['error'](_0xb689('0x10'),_0x5ee263,_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);return _0x56c6ba(_0x4e7c57[_0xb689('0xe')][_0xb689('0x11')]);}else{logger[_0xb689('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,_0xb689('0xd'));_0x56c6ba(_0x4e7c57[_0xb689('0x12')]['message']);}})[_0xb689('0x13')](function(_0x51647d){logger[_0xb689('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x5ee263,_0x51647d);_0x6eaf58(_0x51647d);});});}exports['GetFreshdeskAccount']=function(_0x37ece8){var _0x143b5c=this;return new Promise(function(_0x55a414,_0x4439ef){return db['FreshdeskAccount'][_0xb689('0x14')]({'raw':_0x37ece8['options']?_0x37ece8[_0xb689('0x15')][_0xb689('0x16')]===undefined?!![]:![]:!![],'where':_0x37ece8[_0xb689('0x15')]?_0x37ece8[_0xb689('0x15')][_0xb689('0x17')]||null:null,'attributes':_0x37ece8[_0xb689('0x15')]?_0x37ece8[_0xb689('0x15')][_0xb689('0x18')]||null:null,'limit':_0x37ece8['options']?_0x37ece8[_0xb689('0x15')][_0xb689('0x19')]||null:null,'include':_0x37ece8['options']?_0x37ece8['options'][_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x37ece8[_0xb689('0x15')][_0xb689('0x1a')],function(_0x2f7d0f){return{'model':db[_0x2f7d0f[_0xb689('0x1c')]],'as':_0x2f7d0f['as'],'attributes':_0x2f7d0f[_0xb689('0x18')],'include':_0x2f7d0f[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x2f7d0f[_0xb689('0x1a')],function(_0xf821f2){return{'model':db[_0xf821f2[_0xb689('0x1c')]],'as':_0xf821f2['as'],'attributes':_0xf821f2[_0xb689('0x18')],'include':_0xf821f2[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0xf821f2['include'],function(_0x1d8fb4){return{'model':db[_0x1d8fb4[_0xb689('0x1c')]],'as':_0x1d8fb4['as'],'attributes':_0x1d8fb4[_0xb689('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb689('0xa')](function(_0x2dca44){logger[_0xb689('0xb')](_0xb689('0x1d'),_0x37ece8);logger[_0xb689('0xc')](_0xb689('0x1d'),_0x37ece8,JSON['stringify'](_0x2dca44));_0x55a414(_0x2dca44);})['catch'](function(_0xd73d16){logger[_0xb689('0xe')](_0xb689('0x1d'),_0xd73d16[_0xb689('0x11')],_0x37ece8);_0x4439ef(_0x143b5c[_0xb689('0xe')](0x1f4,_0xd73d16[_0xb689('0x11')]));});});};exports[_0xb689('0x1e')]=function(_0x5ef406){var _0x5bf627=this;return new Promise(function(_0x5572f5,_0x155bc2){return db[_0xb689('0x1f')][_0xb689('0x20')]({'raw':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')][_0xb689('0x16')]===undefined?!![]:![]:!![],'where':_0x5ef406['options']?_0x5ef406[_0xb689('0x15')][_0xb689('0x17')]||null:null,'attributes':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')]['attributes']||null:null,'include':_0x5ef406[_0xb689('0x15')]?_0x5ef406[_0xb689('0x15')]['include']?_[_0xb689('0x1b')](_0x5ef406[_0xb689('0x15')]['include'],function(_0x17fb7c){return{'model':db[_0x17fb7c['model']],'as':_0x17fb7c['as'],'attributes':_0x17fb7c[_0xb689('0x18')],'include':_0x17fb7c[_0xb689('0x1a')]?_[_0xb689('0x1b')](_0x17fb7c['include'],function(_0xa868f){return{'model':db[_0xa868f[_0xb689('0x1c')]],'as':_0xa868f['as'],'attributes':_0xa868f[_0xb689('0x18')],'include':_0xa868f[_0xb689('0x1a')]?_['map'](_0xa868f[_0xb689('0x1a')],function(_0x3f1d40){return{'model':db[_0x3f1d40[_0xb689('0x1c')]],'as':_0x3f1d40['as'],'attributes':_0x3f1d40[_0xb689('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54f608){logger[_0xb689('0xb')]('ShowFreshdeskAccount',_0x5ef406);logger[_0xb689('0xc')](_0xb689('0x1e'),_0x5ef406,JSON[_0xb689('0x21')](_0x54f608));_0x5572f5(_0x54f608);})[_0xb689('0x13')](function(_0x4e9896){logger[_0xb689('0xe')](_0xb689('0x1e'),_0x4e9896[_0xb689('0x11')],_0x5ef406);_0x155bc2(_0x5bf627[_0xb689('0xe')](0x1f4,_0x4e9896[_0xb689('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 658b8e7..cc45009 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 _0xa9e0=['index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x1e2690,_0x3c570a){var _0x537b8d=function(_0x3cbb63){while(--_0x3cbb63){_0x1e2690['push'](_0x1e2690['shift']());}};_0x537b8d(++_0x3c570a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/fields',auth[_0x0a9e('0x7')](),controller['getFields']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x7')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file +var _0xa9e0=['index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','exports','multer','util','path','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated'];(function(_0x31b728,_0x5567ad){var _0x53dfd0=function(_0x4e058a){while(--_0x4e058a){_0x31b728['push'](_0x31b728['shift']());}};_0x53dfd0(++_0x5567ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/fields',auth[_0x0a9e('0x7')](),controller['getFields']);router['get'](_0x0a9e('0xb'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0x6')](_0x0a9e('0xd'),auth[_0x0a9e('0x7')](),controller['getDescriptions']);router['get']('/:id/tags',auth['isAuthenticated'](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0x11'),auth['isAuthenticated'](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x15')]('/:id',auth[_0x0a9e('0x7')](),controller['destroy']);module[_0x0a9e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index aad5ce7..762edcb 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 _0x40bf=['exports','STRING'];(function(_0x5e58b2,_0x1b7ed4){var _0x4facd0=function(_0x58d136){while(--_0x58d136){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x4facd0(++_0x1b7ed4);}(_0x40bf,0x10e));var _0xf40b=function(_0x4394b6,_0x12357f){_0x4394b6=_0x4394b6-0x0;var _0x360244=_0x40bf[_0x4394b6];return _0x360244;};'use strict';var Sequelize=require('sequelize');module[_0xf40b('0x0')]={'name':{'type':Sequelize[_0xf40b('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x117a=['exports','STRING'];(function(_0x1c901e,_0x84a234){var _0x5ee1c3=function(_0x1ff904){while(--_0x1ff904){_0x1c901e['push'](_0x1c901e['shift']());}};_0x5ee1c3(++_0x84a234);}(_0x117a,0x1aa));var _0xa117=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x117a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xa117('0x0')]={'name':{'type':Sequelize[_0xa117('0x1')]},'description':{'type':Sequelize[_0xa117('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 753d10b..7aadd16 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 _0xf3e3=['update','destroy','then','sendStatus','stack','name','send','index','FreshdeskConfiguration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','length','nolimit','order','sort','pick','day','add','merge','where','filter','options','count','includeAll','include','findAll','rows','show','fields','create','body','params','findOne','FreshdeskField','getFields','map','getSubjects','hasOwnProperty','getDescriptions','getTags','Tag','setTags','ids','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','end','status','json','offset','limit','set','Content-Range','apply','save'];(function(_0x142fbb,_0x3fbc24){var _0x2beb34=function(_0x46abcb){while(--_0x46abcb){_0x142fbb['push'](_0x142fbb['shift']());}};_0x2beb34(++_0x3fbc24);}(_0xf3e3,0x146));var _0x3f3e=function(_0x2230a4,_0x499a58){_0x2230a4=_0x2230a4-0x0;var _0x542232=_0xf3e3[_0x2230a4];return _0x542232;};'use strict';var jsonpatch=require(_0x3f3e('0x0'));var rp=require(_0x3f3e('0x1'));var moment=require(_0x3f3e('0x2'));var BPromise=require(_0x3f3e('0x3'));var Mustache=require(_0x3f3e('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3f3e('0x5'));var csv=require(_0x3f3e('0x6'));var ejs=require(_0x3f3e('0x7'));var fs=require('fs');var _=require(_0x3f3e('0x8'));var squel=require(_0x3f3e('0x9'));var crypto=require(_0x3f3e('0xa'));var jsforce=require(_0x3f3e('0xb'));var deskjs=require(_0x3f3e('0xc'));var toCsv=require(_0x3f3e('0x6'));var querystring=require(_0x3f3e('0xd'));var Papa=require(_0x3f3e('0xe'));var qs=require(_0x3f3e('0xf'));var logger=require(_0x3f3e('0x10'))(_0x3f3e('0x11'));var utils=require(_0x3f3e('0x12'));var config=require(_0x3f3e('0x13'));var db=require(_0x3f3e('0x14'))['db'];var jayson=require(_0x3f3e('0x15'));var client=jayson[_0x3f3e('0x16')][_0x3f3e('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x1b86b5,_0x192568,_0x533f50,_0x5c9aa3){return new BPromise(function(_0x59afd5,_0x50efe9){var _0x519d41=_0x5c9aa3||client;return _0x519d41[_0x3f3e('0x18')](_0x1b86b5,_0x533f50)['then'](function(_0x1a2f22){logger[_0x3f3e('0x19')](_0x3f3e('0x1a'),_0x192568,_0x3f3e('0x1b'));logger[_0x3f3e('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x192568,_0x3f3e('0x1b'),JSON[_0x3f3e('0x1d')](_0x1a2f22));if(_0x1a2f22[_0x3f3e('0x1e')]){if(_0x1a2f22[_0x3f3e('0x1e')]['code']===0x1f4){logger[_0x3f3e('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x192568,_0x1a2f22['error']['message']);return _0x50efe9(_0x1a2f22[_0x3f3e('0x1e')][_0x3f3e('0x1f')]);}logger[_0x3f3e('0x1e')](_0x3f3e('0x1a'),_0x192568,_0x1a2f22[_0x3f3e('0x1e')]['message']);return _0x59afd5(_0x1a2f22['error'][_0x3f3e('0x1f')]);}else{logger[_0x3f3e('0x19')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x192568,_0x3f3e('0x1b'));_0x59afd5(_0x1a2f22['result'][_0x3f3e('0x1f')]);}})[_0x3f3e('0x20')](function(_0x2d003a){logger[_0x3f3e('0x1e')](_0x3f3e('0x1a'),_0x192568,_0x2d003a);_0x50efe9(_0x2d003a);});});}function respondWithStatusCode(_0x21731e,_0x567353){_0x567353=_0x567353||0xcc;return function(_0x57fd64){if(_0x57fd64){return _0x21731e['sendStatus'](_0x567353);}return _0x21731e['status'](_0x567353)[_0x3f3e('0x21')]();};}function respondWithResult(_0xec8832,_0x1959be){_0x1959be=_0x1959be||0xc8;return function(_0x21befa){if(_0x21befa){return _0xec8832[_0x3f3e('0x22')](_0x1959be)[_0x3f3e('0x23')](_0x21befa);}};}function respondWithFilteredResult(_0x1379fd,_0x23886f){return function(_0x31a557){if(_0x31a557){var _0x5ee805=_0x31a557['count'],_0x15f5d7=_0x23886f['offset'],_0xedd75c=_0x23886f[_0x3f3e('0x24')]+_0x23886f[_0x3f3e('0x25')],_0xf8531d;if(_0xedd75c>=_0x5ee805){_0xedd75c=_0x5ee805;_0xf8531d=0xc8;}else{_0xf8531d=0xce;}_0x1379fd[_0x3f3e('0x22')](_0xf8531d);return _0x1379fd[_0x3f3e('0x26')](_0x3f3e('0x27'),_0x15f5d7+'-'+_0xedd75c+'/'+_0x5ee805)[_0x3f3e('0x23')](_0x31a557);}return null;};}function patchUpdates(_0x54d332){return function(_0x104b9a){try{jsonpatch[_0x3f3e('0x28')](_0x104b9a,_0x54d332,!![]);}catch(_0x12326f){return BPromise['reject'](_0x12326f);}return _0x104b9a[_0x3f3e('0x29')]();};}function saveUpdates(_0x4b9cc9,_0x3f210d){return function(_0x2a5d23){if(_0x2a5d23){return _0x2a5d23[_0x3f3e('0x2a')](_0x4b9cc9)['then'](function(_0x11a2ba){return _0x11a2ba;});}return null;};}function removeEntity(_0x2066a9,_0x50b73d){return function(_0x2e4509){if(_0x2e4509){return _0x2e4509[_0x3f3e('0x2b')]()[_0x3f3e('0x2c')](function(){_0x2066a9[_0x3f3e('0x22')](0xcc)[_0x3f3e('0x21')]();});}};}function handleEntityNotFound(_0x1e7e0c,_0x1efd18){return function(_0x5cf966){if(!_0x5cf966){_0x1e7e0c[_0x3f3e('0x2d')](0x194);}return _0x5cf966;};}function handleError(_0x28c11c,_0x547ada){_0x547ada=_0x547ada||0x1f4;return function(_0x34d148){logger[_0x3f3e('0x1e')](_0x34d148[_0x3f3e('0x2e')]);if(_0x34d148[_0x3f3e('0x2f')]){delete _0x34d148[_0x3f3e('0x2f')];}_0x28c11c['status'](_0x547ada)[_0x3f3e('0x30')](_0x34d148);};}exports[_0x3f3e('0x31')]=function(_0x4f3907,_0x522976){var _0x3d9312={},_0x5ac8cb={},_0x4a672d={'count':0x0,'rows':[]};var _0xe2fc39=db[_0x3f3e('0x32')][_0x3f3e('0x33')];_0x5ac8cb[_0x3f3e('0x34')]=_[_0x3f3e('0x35')](_0xe2fc39);var _0x59c54e={'dateStart':_0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x37')],'dateEnd':_0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x38')]};delete _0x4f3907['query'][_0x3f3e('0x37')];delete _0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x38')];_0x5ac8cb['query']=_[_0x3f3e('0x35')](_0x4f3907[_0x3f3e('0x36')]);_0x5ac8cb[_0x3f3e('0x39')]=_[_0x3f3e('0x3a')](_0x5ac8cb['model'],_0x5ac8cb[_0x3f3e('0x36')]);_0x3d9312[_0x3f3e('0x3b')]=_[_0x3f3e('0x3a')](_0x5ac8cb[_0x3f3e('0x34')],qs['fields'](_0x4f3907[_0x3f3e('0x36')]['fields']));_0x3d9312[_0x3f3e('0x3b')]=_0x3d9312[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0x3d9312['attributes']:_0x5ac8cb[_0x3f3e('0x34')];if(!_0x4f3907[_0x3f3e('0x36')]['hasOwnProperty'](_0x3f3e('0x3d'))){_0x3d9312['limit']=qs[_0x3f3e('0x25')](_0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x25')]);_0x3d9312[_0x3f3e('0x24')]=qs['offset'](_0x4f3907['query'][_0x3f3e('0x24')]);}_0x3d9312[_0x3f3e('0x3e')]=qs[_0x3f3e('0x3f')](_0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x3f')]);_0x3d9312['where']=qs[_0x3f3e('0x39')](_[_0x3f3e('0x40')](_0x4f3907[_0x3f3e('0x36')],_0x5ac8cb[_0x3f3e('0x39')]));if(_0x59c54e[_0x3f3e('0x37')]){if(_0x59c54e[_0x3f3e('0x38')]){_0x59c54e['dateEnd']=moment(_0x59c54e[_0x3f3e('0x38')])['add'](0x1,_0x3f3e('0x41'));}else{_0x59c54e[_0x3f3e('0x38')]=moment(_0x59c54e[_0x3f3e('0x37')])[_0x3f3e('0x42')](0x1,_0x3f3e('0x41'));}_[_0x3f3e('0x43')](_0x3d9312[_0x3f3e('0x44')],{'createdAt':{'$gte':_0x59c54e[_0x3f3e('0x37')],'$lte':_0x59c54e['dateEnd']}});}if(_0x4f3907['query'][_0x3f3e('0x45')]){_0x3d9312[_0x3f3e('0x44')]=_[_0x3f3e('0x43')](_0x3d9312['where'],{'$or':_['map'](_0x3d9312[_0x3f3e('0x3b')],function(_0x542c3f){var _0x42d1a8={};_0x42d1a8[_0x542c3f]={'$like':'%'+_0x4f3907[_0x3f3e('0x36')][_0x3f3e('0x45')]+'%'};return _0x42d1a8;})});}_0x3d9312=_[_0x3f3e('0x43')]({},_0x3d9312,_0x4f3907[_0x3f3e('0x46')]);var _0x1f9c9e={'where':_0x3d9312['where']};return db[_0x3f3e('0x32')][_0x3f3e('0x47')](_0x1f9c9e)[_0x3f3e('0x2c')](function(_0x416bd1){_0x4a672d['count']=_0x416bd1;if(_0x4f3907['query'][_0x3f3e('0x48')]){_0x3d9312[_0x3f3e('0x49')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x3f3e('0x4a')](_0x3d9312);})[_0x3f3e('0x2c')](function(_0x5de29f){_0x4a672d[_0x3f3e('0x4b')]=_0x5de29f;return _0x4a672d;})[_0x3f3e('0x2c')](respondWithFilteredResult(_0x522976,_0x3d9312))['catch'](handleError(_0x522976,null));};exports[_0x3f3e('0x4c')]=function(_0x103ccd,_0x32c873){var _0xc0e83d={'raw':![],'where':{'id':_0x103ccd['params']['id']}},_0x127a7f={};_0x127a7f[_0x3f3e('0x34')]=_[_0x3f3e('0x35')](db[_0x3f3e('0x32')][_0x3f3e('0x33')]);_0x127a7f['query']=_['keys'](_0x103ccd[_0x3f3e('0x36')]);_0x127a7f[_0x3f3e('0x39')]=_[_0x3f3e('0x3a')](_0x127a7f['model'],_0x127a7f[_0x3f3e('0x36')]);_0xc0e83d[_0x3f3e('0x3b')]=_[_0x3f3e('0x3a')](_0x127a7f[_0x3f3e('0x34')],qs['fields'](_0x103ccd[_0x3f3e('0x36')][_0x3f3e('0x4d')]));_0xc0e83d[_0x3f3e('0x3b')]=_0xc0e83d[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0xc0e83d['attributes']:_0x127a7f['model'];if(_0x103ccd[_0x3f3e('0x36')]['includeAll']){_0xc0e83d[_0x3f3e('0x49')]=[{'all':!![]}];}_0xc0e83d=_[_0x3f3e('0x43')]({},_0xc0e83d,_0x103ccd[_0x3f3e('0x46')]);return db[_0x3f3e('0x32')]['find'](_0xc0e83d)[_0x3f3e('0x2c')](handleEntityNotFound(_0x32c873,null))['then'](respondWithResult(_0x32c873,null))[_0x3f3e('0x20')](handleError(_0x32c873,null));};exports[_0x3f3e('0x4e')]=function(_0xc8219f,_0x2410c7){return db['FreshdeskConfiguration'][_0x3f3e('0x4e')](_0xc8219f[_0x3f3e('0x4f')],{})[_0x3f3e('0x2c')](respondWithResult(_0x2410c7,0xc9))[_0x3f3e('0x20')](handleError(_0x2410c7,null));};exports[_0x3f3e('0x2a')]=function(_0x29c77c,_0x343ee0){if(_0x29c77c['body']['id']){delete _0x29c77c['body']['id'];}return db[_0x3f3e('0x32')]['find']({'where':{'id':_0x29c77c[_0x3f3e('0x50')]['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0x343ee0,null))[_0x3f3e('0x2c')](saveUpdates(_0x29c77c[_0x3f3e('0x4f')],null))[_0x3f3e('0x2c')](respondWithResult(_0x343ee0,null))[_0x3f3e('0x20')](handleError(_0x343ee0,null));};exports[_0x3f3e('0x2b')]=function(_0x5a4d27,_0x49cbef){return db[_0x3f3e('0x32')]['find']({'where':{'id':_0x5a4d27[_0x3f3e('0x50')]['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0x49cbef,null))[_0x3f3e('0x2c')](removeEntity(_0x49cbef,null))[_0x3f3e('0x20')](handleError(_0x49cbef,null));};exports['getFields']=function(_0x5627c9,_0xc3bb0f,_0xfde53d){var _0x4fbf35={};var _0x40ecc6={};var _0x3f7555;var _0x42b446;return db[_0x3f3e('0x32')][_0x3f3e('0x51')]({'where':{'id':_0x5627c9[_0x3f3e('0x50')]['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0xc3bb0f,null))[_0x3f3e('0x2c')](function(_0x29ec33){if(_0x29ec33){_0x3f7555=_0x29ec33;_0x40ecc6['model']=_['keys'](db[_0x3f3e('0x52')][_0x3f3e('0x33')]);_0x40ecc6[_0x3f3e('0x36')]=_['keys'](_0x5627c9[_0x3f3e('0x36')]);_0x40ecc6[_0x3f3e('0x39')]=_['intersection'](_0x40ecc6[_0x3f3e('0x34')],_0x40ecc6[_0x3f3e('0x36')]);_0x4fbf35[_0x3f3e('0x3b')]=_[_0x3f3e('0x3a')](_0x40ecc6[_0x3f3e('0x34')],qs[_0x3f3e('0x4d')](_0x5627c9[_0x3f3e('0x36')][_0x3f3e('0x4d')]));_0x4fbf35[_0x3f3e('0x3b')]=_0x4fbf35[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0x4fbf35[_0x3f3e('0x3b')]:_0x40ecc6['model'];_0x4fbf35[_0x3f3e('0x3e')]=qs[_0x3f3e('0x3f')](_0x5627c9['query'][_0x3f3e('0x3f')]);_0x4fbf35[_0x3f3e('0x44')]=qs['filters'](_['pick'](_0x5627c9[_0x3f3e('0x36')],_0x40ecc6[_0x3f3e('0x39')]));if(_0x5627c9['query']['filter']){_0x4fbf35[_0x3f3e('0x44')]=_[_0x3f3e('0x43')](_0x4fbf35[_0x3f3e('0x44')],{'$or':_['map'](_0x4fbf35[_0x3f3e('0x3b')],function(_0xfd3493){var _0x405e48={};_0x405e48[_0xfd3493]={'$like':'%'+_0x5627c9[_0x3f3e('0x36')][_0x3f3e('0x45')]+'%'};return _0x405e48;})});}_0x4fbf35=_['merge']({},_0x4fbf35,_0x5627c9['options']);return _0x3f7555[_0x3f3e('0x53')](_0x4fbf35);}})[_0x3f3e('0x2c')](function(_0x5c3383){if(_0x5c3383){_0x42b446=_0x5c3383['length'];if(!_0x5627c9[_0x3f3e('0x36')]['hasOwnProperty']('nolimit')){_0x4fbf35[_0x3f3e('0x25')]=qs[_0x3f3e('0x25')](_0x5627c9['query']['limit']);_0x4fbf35[_0x3f3e('0x24')]=qs['offset'](_0x5627c9[_0x3f3e('0x36')][_0x3f3e('0x24')]);}return _0x3f7555[_0x3f3e('0x53')](_0x4fbf35);}})[_0x3f3e('0x2c')](function(_0x59b86a){if(_0x59b86a){return _0x59b86a?{'count':_0x42b446,'rows':_0x59b86a}:null;}})[_0x3f3e('0x2c')](respondWithResult(_0xc3bb0f,null))[_0x3f3e('0x20')](handleError(_0xc3bb0f,null));};exports['getSubjects']=function(_0x2ba12c,_0x86e0dd,_0x6bbb6){var _0x1e7c8f={};var _0x2366fe={};var _0x74008a;var _0x52a0a9;return db[_0x3f3e('0x32')][_0x3f3e('0x51')]({'where':{'id':_0x2ba12c[_0x3f3e('0x50')]['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0x86e0dd,null))[_0x3f3e('0x2c')](function(_0x3394b3){if(_0x3394b3){_0x74008a=_0x3394b3;_0x2366fe['model']=_[_0x3f3e('0x35')](db[_0x3f3e('0x52')][_0x3f3e('0x33')]);_0x2366fe[_0x3f3e('0x36')]=_[_0x3f3e('0x35')](_0x2ba12c[_0x3f3e('0x36')]);_0x2366fe['filters']=_[_0x3f3e('0x3a')](_0x2366fe[_0x3f3e('0x34')],_0x2366fe[_0x3f3e('0x36')]);_0x1e7c8f[_0x3f3e('0x3b')]=_['intersection'](_0x2366fe[_0x3f3e('0x34')],qs[_0x3f3e('0x4d')](_0x2ba12c['query'][_0x3f3e('0x4d')]));_0x1e7c8f['attributes']=_0x1e7c8f[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0x1e7c8f[_0x3f3e('0x3b')]:_0x2366fe['model'];_0x1e7c8f[_0x3f3e('0x3e')]=qs['sort'](_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x3f')]);_0x1e7c8f[_0x3f3e('0x44')]=qs[_0x3f3e('0x39')](_[_0x3f3e('0x40')](_0x2ba12c['query'],_0x2366fe['filters']));if(_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x45')]){_0x1e7c8f[_0x3f3e('0x44')]=_[_0x3f3e('0x43')](_0x1e7c8f[_0x3f3e('0x44')],{'$or':_[_0x3f3e('0x54')](_0x1e7c8f[_0x3f3e('0x3b')],function(_0x3e3ea4){var _0x2c7afa={};_0x2c7afa[_0x3e3ea4]={'$like':'%'+_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x45')]+'%'};return _0x2c7afa;})});}_0x1e7c8f=_['merge']({},_0x1e7c8f,_0x2ba12c[_0x3f3e('0x46')]);return _0x74008a[_0x3f3e('0x55')](_0x1e7c8f);}})[_0x3f3e('0x2c')](function(_0x2aa5f2){if(_0x2aa5f2){_0x52a0a9=_0x2aa5f2[_0x3f3e('0x3c')];if(!_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x56')]('nolimit')){_0x1e7c8f[_0x3f3e('0x25')]=qs[_0x3f3e('0x25')](_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x25')]);_0x1e7c8f['offset']=qs[_0x3f3e('0x24')](_0x2ba12c[_0x3f3e('0x36')][_0x3f3e('0x24')]);}return _0x74008a[_0x3f3e('0x55')](_0x1e7c8f);}})['then'](function(_0x52d3c1){if(_0x52d3c1){return _0x52d3c1?{'count':_0x52a0a9,'rows':_0x52d3c1}:null;}})[_0x3f3e('0x2c')](respondWithResult(_0x86e0dd,null))[_0x3f3e('0x20')](handleError(_0x86e0dd,null));};exports[_0x3f3e('0x57')]=function(_0x1805fc,_0x324285,_0x41885b){var _0xc9c9fd={};var _0x4f24b1={};var _0x3b93ab;var _0x2fcad9;return db[_0x3f3e('0x32')][_0x3f3e('0x51')]({'where':{'id':_0x1805fc[_0x3f3e('0x50')]['id']}})['then'](handleEntityNotFound(_0x324285,null))[_0x3f3e('0x2c')](function(_0x473b4e){if(_0x473b4e){_0x3b93ab=_0x473b4e;_0x4f24b1[_0x3f3e('0x34')]=_[_0x3f3e('0x35')](db['FreshdeskField'][_0x3f3e('0x33')]);_0x4f24b1['query']=_['keys'](_0x1805fc[_0x3f3e('0x36')]);_0x4f24b1[_0x3f3e('0x39')]=_[_0x3f3e('0x3a')](_0x4f24b1[_0x3f3e('0x34')],_0x4f24b1['query']);_0xc9c9fd[_0x3f3e('0x3b')]=_[_0x3f3e('0x3a')](_0x4f24b1['model'],qs[_0x3f3e('0x4d')](_0x1805fc['query'][_0x3f3e('0x4d')]));_0xc9c9fd[_0x3f3e('0x3b')]=_0xc9c9fd[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0xc9c9fd['attributes']:_0x4f24b1['model'];_0xc9c9fd[_0x3f3e('0x3e')]=qs['sort'](_0x1805fc['query'][_0x3f3e('0x3f')]);_0xc9c9fd[_0x3f3e('0x44')]=qs[_0x3f3e('0x39')](_[_0x3f3e('0x40')](_0x1805fc['query'],_0x4f24b1['filters']));if(_0x1805fc[_0x3f3e('0x36')][_0x3f3e('0x45')]){_0xc9c9fd[_0x3f3e('0x44')]=_[_0x3f3e('0x43')](_0xc9c9fd['where'],{'$or':_[_0x3f3e('0x54')](_0xc9c9fd[_0x3f3e('0x3b')],function(_0x5b941c){var _0x5a30d8={};_0x5a30d8[_0x5b941c]={'$like':'%'+_0x1805fc[_0x3f3e('0x36')]['filter']+'%'};return _0x5a30d8;})});}_0xc9c9fd=_['merge']({},_0xc9c9fd,_0x1805fc[_0x3f3e('0x46')]);return _0x3b93ab[_0x3f3e('0x57')](_0xc9c9fd);}})[_0x3f3e('0x2c')](function(_0x37f5d6){if(_0x37f5d6){_0x2fcad9=_0x37f5d6[_0x3f3e('0x3c')];if(!_0x1805fc['query'][_0x3f3e('0x56')](_0x3f3e('0x3d'))){_0xc9c9fd['limit']=qs[_0x3f3e('0x25')](_0x1805fc['query'][_0x3f3e('0x25')]);_0xc9c9fd[_0x3f3e('0x24')]=qs[_0x3f3e('0x24')](_0x1805fc[_0x3f3e('0x36')]['offset']);}return _0x3b93ab['getDescriptions'](_0xc9c9fd);}})[_0x3f3e('0x2c')](function(_0x3c218d){if(_0x3c218d){return _0x3c218d?{'count':_0x2fcad9,'rows':_0x3c218d}:null;}})[_0x3f3e('0x2c')](respondWithResult(_0x324285,null))[_0x3f3e('0x20')](handleError(_0x324285,null));};exports[_0x3f3e('0x58')]=function(_0x5a8b41,_0x1409ed,_0x187913){var _0x25115f={};var _0x471555={};var _0x464e25;var _0x5b957b;return db[_0x3f3e('0x32')][_0x3f3e('0x51')]({'where':{'id':_0x5a8b41['params']['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0x1409ed,null))[_0x3f3e('0x2c')](function(_0x3bbb0a){if(_0x3bbb0a){_0x464e25=_0x3bbb0a;_0x471555[_0x3f3e('0x34')]=_[_0x3f3e('0x35')](db[_0x3f3e('0x59')]['rawAttributes']);_0x471555[_0x3f3e('0x36')]=_[_0x3f3e('0x35')](_0x5a8b41[_0x3f3e('0x36')]);_0x471555[_0x3f3e('0x39')]=_[_0x3f3e('0x3a')](_0x471555['model'],_0x471555['query']);_0x25115f[_0x3f3e('0x3b')]=_[_0x3f3e('0x3a')](_0x471555['model'],qs[_0x3f3e('0x4d')](_0x5a8b41[_0x3f3e('0x36')][_0x3f3e('0x4d')]));_0x25115f['attributes']=_0x25115f[_0x3f3e('0x3b')][_0x3f3e('0x3c')]?_0x25115f[_0x3f3e('0x3b')]:_0x471555[_0x3f3e('0x34')];_0x25115f[_0x3f3e('0x3e')]=qs[_0x3f3e('0x3f')](_0x5a8b41[_0x3f3e('0x36')][_0x3f3e('0x3f')]);_0x25115f['where']=qs[_0x3f3e('0x39')](_[_0x3f3e('0x40')](_0x5a8b41['query'],_0x471555[_0x3f3e('0x39')]));if(_0x5a8b41[_0x3f3e('0x36')]['filter']){_0x25115f[_0x3f3e('0x44')]=_[_0x3f3e('0x43')](_0x25115f['where'],{'$or':_['map'](_0x25115f['attributes'],function(_0x54b2a1){var _0x563dd9={};_0x563dd9[_0x54b2a1]={'$like':'%'+_0x5a8b41[_0x3f3e('0x36')][_0x3f3e('0x45')]+'%'};return _0x563dd9;})});}_0x25115f=_[_0x3f3e('0x43')]({},_0x25115f,_0x5a8b41[_0x3f3e('0x46')]);return _0x464e25[_0x3f3e('0x58')](_0x25115f);}})[_0x3f3e('0x2c')](function(_0x13ad3f){if(_0x13ad3f){_0x5b957b=_0x13ad3f[_0x3f3e('0x3c')];if(!_0x5a8b41['query']['hasOwnProperty'](_0x3f3e('0x3d'))){_0x25115f[_0x3f3e('0x25')]=qs[_0x3f3e('0x25')](_0x5a8b41[_0x3f3e('0x36')][_0x3f3e('0x25')]);_0x25115f[_0x3f3e('0x24')]=qs[_0x3f3e('0x24')](_0x5a8b41[_0x3f3e('0x36')][_0x3f3e('0x24')]);}return _0x464e25[_0x3f3e('0x58')](_0x25115f);}})['then'](function(_0x36dd12){if(_0x36dd12){return _0x36dd12?{'count':_0x5b957b,'rows':_0x36dd12}:null;}})[_0x3f3e('0x2c')](respondWithResult(_0x1409ed,null))[_0x3f3e('0x20')](handleError(_0x1409ed,null));};exports[_0x3f3e('0x5a')]=function(_0x5010f4,_0x44a099,_0x3221b1){if(_0x5010f4[_0x3f3e('0x4f')]['id']){delete _0x5010f4[_0x3f3e('0x4f')]['id'];}return db[_0x3f3e('0x32')][_0x3f3e('0x51')]({'where':{'id':_0x5010f4['params']['id']}})[_0x3f3e('0x2c')](handleEntityNotFound(_0x44a099,null))[_0x3f3e('0x2c')](function(_0x257585){if(_0x257585){return _0x257585['setTags'](_0x5010f4[_0x3f3e('0x4f')][_0x3f3e('0x5b')]||[]);}return null;})['then'](respondWithResult(_0x44a099,null))[_0x3f3e('0x20')](handleError(_0x44a099,null));}; \ No newline at end of file +var _0x84bc=['../../mysqldb','jayson/promise','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','stack','name','send','index','FreshdeskConfiguration','keys','query','dateStart','dateEnd','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','add','day','merge','where','map','filter','options','include','rows','show','rawAttributes','includeAll','find','create','body','params','getFields','findOne','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','papaparse','../../config/logger','../../config/utils'];(function(_0x1c510a,_0x1413a9){var _0x23cedd=function(_0x3f3e43){while(--_0x3f3e43){_0x1c510a['push'](_0x1c510a['shift']());}};_0x23cedd(++_0x1413a9);}(_0x84bc,0x9b));var _0xc84b=function(_0x567be2,_0x1b2e31){_0x567be2=_0x567be2-0x0;var _0x325c75=_0x84bc[_0x567be2];return _0x325c75;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc84b('0x0'));var moment=require(_0xc84b('0x1'));var BPromise=require(_0xc84b('0x2'));var Mustache=require('mustache');var util=require(_0xc84b('0x3'));var path=require(_0xc84b('0x4'));var sox=require(_0xc84b('0x5'));var csv=require(_0xc84b('0x6'));var ejs=require(_0xc84b('0x7'));var fs=require('fs');var _=require(_0xc84b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc84b('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc84b('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xc84b('0xb'))('api');var utils=require(_0xc84b('0xc'));var config=require('../../config/environment');var db=require(_0xc84b('0xd'))['db'];var jayson=require(_0xc84b('0xe'));var client=jayson['client'][_0xc84b('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x5a8e12,_0x9645ed,_0x550441,_0x128ec7){return new BPromise(function(_0x1439ff,_0x402f48){var _0xd44dba=_0x128ec7||client;return _0xd44dba['request'](_0x5a8e12,_0x550441)[_0xc84b('0x10')](function(_0x406a11){logger[_0xc84b('0x11')](_0xc84b('0x12'),_0x9645ed,'request\x20sent');logger[_0xc84b('0x13')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x9645ed,_0xc84b('0x14'),JSON[_0xc84b('0x15')](_0x406a11));if(_0x406a11[_0xc84b('0x16')]){if(_0x406a11[_0xc84b('0x16')][_0xc84b('0x17')]===0x1f4){logger['error'](_0xc84b('0x12'),_0x9645ed,_0x406a11[_0xc84b('0x16')][_0xc84b('0x18')]);return _0x402f48(_0x406a11['error'][_0xc84b('0x18')]);}logger[_0xc84b('0x16')](_0xc84b('0x12'),_0x9645ed,_0x406a11[_0xc84b('0x16')][_0xc84b('0x18')]);return _0x1439ff(_0x406a11['error'][_0xc84b('0x18')]);}else{logger[_0xc84b('0x11')](_0xc84b('0x12'),_0x9645ed,_0xc84b('0x14'));_0x1439ff(_0x406a11[_0xc84b('0x19')]['message']);}})[_0xc84b('0x1a')](function(_0x193fb5){logger[_0xc84b('0x16')](_0xc84b('0x12'),_0x9645ed,_0x193fb5);_0x402f48(_0x193fb5);});});}function respondWithStatusCode(_0x4e688d,_0x5c702d){_0x5c702d=_0x5c702d||0xcc;return function(_0x5a5355){if(_0x5a5355){return _0x4e688d[_0xc84b('0x1b')](_0x5c702d);}return _0x4e688d[_0xc84b('0x1c')](_0x5c702d)[_0xc84b('0x1d')]();};}function respondWithResult(_0x20521f,_0x55186d){_0x55186d=_0x55186d||0xc8;return function(_0x524732){if(_0x524732){return _0x20521f[_0xc84b('0x1c')](_0x55186d)['json'](_0x524732);}};}function respondWithFilteredResult(_0x8a989e,_0x59e7c1){return function(_0x79901d){if(_0x79901d){var _0x5e5c79=_0x79901d[_0xc84b('0x1e')],_0x3c7ae1=_0x59e7c1[_0xc84b('0x1f')],_0x464116=_0x59e7c1[_0xc84b('0x1f')]+_0x59e7c1[_0xc84b('0x20')],_0x22ef38;if(_0x464116>=_0x5e5c79){_0x464116=_0x5e5c79;_0x22ef38=0xc8;}else{_0x22ef38=0xce;}_0x8a989e[_0xc84b('0x1c')](_0x22ef38);return _0x8a989e[_0xc84b('0x21')](_0xc84b('0x22'),_0x3c7ae1+'-'+_0x464116+'/'+_0x5e5c79)[_0xc84b('0x23')](_0x79901d);}return null;};}function patchUpdates(_0x1d73e8){return function(_0x3e333b){try{jsonpatch[_0xc84b('0x24')](_0x3e333b,_0x1d73e8,!![]);}catch(_0x53906a){return BPromise['reject'](_0x53906a);}return _0x3e333b['save']();};}function saveUpdates(_0x2bcac3,_0x4e571b){return function(_0x117f2a){if(_0x117f2a){return _0x117f2a[_0xc84b('0x25')](_0x2bcac3)['then'](function(_0x45e0ac){return _0x45e0ac;});}return null;};}function removeEntity(_0x34b51b,_0x27e687){return function(_0x2c043c){if(_0x2c043c){return _0x2c043c[_0xc84b('0x26')]()[_0xc84b('0x10')](function(){_0x34b51b['status'](0xcc)[_0xc84b('0x1d')]();});}};}function handleEntityNotFound(_0x197f9c,_0x467994){return function(_0x1ad213){if(!_0x1ad213){_0x197f9c['sendStatus'](0x194);}return _0x1ad213;};}function handleError(_0x5c0672,_0x4de9c0){_0x4de9c0=_0x4de9c0||0x1f4;return function(_0x2bd7c7){logger[_0xc84b('0x16')](_0x2bd7c7[_0xc84b('0x27')]);if(_0x2bd7c7[_0xc84b('0x28')]){delete _0x2bd7c7[_0xc84b('0x28')];}_0x5c0672['status'](_0x4de9c0)[_0xc84b('0x29')](_0x2bd7c7);};}exports[_0xc84b('0x2a')]=function(_0x24d52c,_0x216af2){var _0x513311={},_0x5ab553={},_0x10e6ca={'count':0x0,'rows':[]};var _0x2ba508=db[_0xc84b('0x2b')]['rawAttributes'];_0x5ab553['model']=_[_0xc84b('0x2c')](_0x2ba508);var _0x474170={'dateStart':_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x2e')],'dateEnd':_0x24d52c['query'][_0xc84b('0x2f')]};delete _0x24d52c[_0xc84b('0x2d')][_0xc84b('0x2e')];delete _0x24d52c['query'][_0xc84b('0x2f')];_0x5ab553['query']=_[_0xc84b('0x2c')](_0x24d52c[_0xc84b('0x2d')]);_0x5ab553['filters']=_['intersection'](_0x5ab553[_0xc84b('0x30')],_0x5ab553[_0xc84b('0x2d')]);_0x513311[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x5ab553[_0xc84b('0x30')],qs['fields'](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x513311[_0xc84b('0x31')]=_0x513311[_0xc84b('0x31')][_0xc84b('0x34')]?_0x513311[_0xc84b('0x31')]:_0x5ab553['model'];if(!_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x513311[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x24d52c['query'][_0xc84b('0x20')]);_0x513311[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x1f')]);}_0x513311[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x513311['where']=qs['filters'](_[_0xc84b('0x39')](_0x24d52c[_0xc84b('0x2d')],_0x5ab553[_0xc84b('0x3a')]));if(_0x474170[_0xc84b('0x2e')]){if(_0x474170[_0xc84b('0x2f')]){_0x474170['dateEnd']=moment(_0x474170[_0xc84b('0x2f')])[_0xc84b('0x3b')](0x1,_0xc84b('0x3c'));}else{_0x474170[_0xc84b('0x2f')]=moment(_0x474170['dateStart'])['add'](0x1,_0xc84b('0x3c'));}_[_0xc84b('0x3d')](_0x513311[_0xc84b('0x3e')],{'createdAt':{'$gte':_0x474170[_0xc84b('0x2e')],'$lte':_0x474170[_0xc84b('0x2f')]}});}if(_0x24d52c['query']['filter']){_0x513311['where']=_['merge'](_0x513311['where'],{'$or':_[_0xc84b('0x3f')](_0x513311['attributes'],function(_0x1a542d){var _0x15f1ae={};_0x15f1ae[_0x1a542d]={'$like':'%'+_0x24d52c[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x15f1ae;})});}_0x513311=_[_0xc84b('0x3d')]({},_0x513311,_0x24d52c[_0xc84b('0x41')]);var _0x4e8a4c={'where':_0x513311[_0xc84b('0x3e')]};return db[_0xc84b('0x2b')]['count'](_0x4e8a4c)['then'](function(_0x3d4aa8){_0x10e6ca['count']=_0x3d4aa8;if(_0x24d52c[_0xc84b('0x2d')]['includeAll']){_0x513311[_0xc84b('0x42')]=[{'all':!![]}];}return db[_0xc84b('0x2b')]['findAll'](_0x513311);})[_0xc84b('0x10')](function(_0x1d0c0a){_0x10e6ca[_0xc84b('0x43')]=_0x1d0c0a;return _0x10e6ca;})[_0xc84b('0x10')](respondWithFilteredResult(_0x216af2,_0x513311))[_0xc84b('0x1a')](handleError(_0x216af2,null));};exports[_0xc84b('0x44')]=function(_0x3d164a,_0x537252){var _0x40eb6d={'raw':![],'where':{'id':_0x3d164a['params']['id']}},_0x1db1b8={};_0x1db1b8['model']=_[_0xc84b('0x2c')](db[_0xc84b('0x2b')][_0xc84b('0x45')]);_0x1db1b8[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x3d164a[_0xc84b('0x2d')]);_0x1db1b8[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x1db1b8[_0xc84b('0x30')],_0x1db1b8[_0xc84b('0x2d')]);_0x40eb6d[_0xc84b('0x31')]=_['intersection'](_0x1db1b8[_0xc84b('0x30')],qs['fields'](_0x3d164a[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x40eb6d['attributes']=_0x40eb6d[_0xc84b('0x31')][_0xc84b('0x34')]?_0x40eb6d['attributes']:_0x1db1b8[_0xc84b('0x30')];if(_0x3d164a[_0xc84b('0x2d')][_0xc84b('0x46')]){_0x40eb6d[_0xc84b('0x42')]=[{'all':!![]}];}_0x40eb6d=_[_0xc84b('0x3d')]({},_0x40eb6d,_0x3d164a[_0xc84b('0x41')]);return db[_0xc84b('0x2b')][_0xc84b('0x47')](_0x40eb6d)[_0xc84b('0x10')](handleEntityNotFound(_0x537252,null))[_0xc84b('0x10')](respondWithResult(_0x537252,null))['catch'](handleError(_0x537252,null));};exports[_0xc84b('0x48')]=function(_0x157ad,_0x65dcc){return db[_0xc84b('0x2b')][_0xc84b('0x48')](_0x157ad[_0xc84b('0x49')],{})[_0xc84b('0x10')](respondWithResult(_0x65dcc,0xc9))[_0xc84b('0x1a')](handleError(_0x65dcc,null));};exports[_0xc84b('0x25')]=function(_0x4a0303,_0x49f15b){if(_0x4a0303[_0xc84b('0x49')]['id']){delete _0x4a0303['body']['id'];}return db[_0xc84b('0x2b')][_0xc84b('0x47')]({'where':{'id':_0x4a0303['params']['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x49f15b,null))[_0xc84b('0x10')](saveUpdates(_0x4a0303['body'],null))['then'](respondWithResult(_0x49f15b,null))[_0xc84b('0x1a')](handleError(_0x49f15b,null));};exports[_0xc84b('0x26')]=function(_0x5b8cde,_0x51f30d){return db[_0xc84b('0x2b')][_0xc84b('0x47')]({'where':{'id':_0x5b8cde[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x51f30d,null))[_0xc84b('0x10')](removeEntity(_0x51f30d,null))[_0xc84b('0x1a')](handleError(_0x51f30d,null));};exports[_0xc84b('0x4b')]=function(_0x463e1a,_0x3096e5,_0x1e34c1){var _0x4548e8={};var _0x4ab377={};var _0x2f2fb6;var _0x2ab23b;return db['FreshdeskConfiguration'][_0xc84b('0x4c')]({'where':{'id':_0x463e1a[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x3096e5,null))['then'](function(_0x67cd64){if(_0x67cd64){_0x2f2fb6=_0x67cd64;_0x4ab377[_0xc84b('0x30')]=_['keys'](db['FreshdeskField'][_0xc84b('0x45')]);_0x4ab377[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x463e1a['query']);_0x4ab377[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x4ab377['model'],_0x4ab377[_0xc84b('0x2d')]);_0x4548e8['attributes']=_[_0xc84b('0x32')](_0x4ab377[_0xc84b('0x30')],qs[_0xc84b('0x33')](_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x33')]));_0x4548e8[_0xc84b('0x31')]=_0x4548e8['attributes'][_0xc84b('0x34')]?_0x4548e8[_0xc84b('0x31')]:_0x4ab377['model'];_0x4548e8[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x463e1a[_0xc84b('0x2d')]['sort']);_0x4548e8[_0xc84b('0x3e')]=qs[_0xc84b('0x3a')](_[_0xc84b('0x39')](_0x463e1a[_0xc84b('0x2d')],_0x4ab377[_0xc84b('0x3a')]));if(_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x4548e8[_0xc84b('0x3e')]=_[_0xc84b('0x3d')](_0x4548e8[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0x4548e8[_0xc84b('0x31')],function(_0x31db32){var _0x2285cf={};_0x2285cf[_0x31db32]={'$like':'%'+_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x2285cf;})});}_0x4548e8=_[_0xc84b('0x3d')]({},_0x4548e8,_0x463e1a[_0xc84b('0x41')]);return _0x2f2fb6[_0xc84b('0x4b')](_0x4548e8);}})[_0xc84b('0x10')](function(_0x3188ed){if(_0x3188ed){_0x2ab23b=_0x3188ed[_0xc84b('0x34')];if(!_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x4548e8[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x463e1a['query']['limit']);_0x4548e8[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x463e1a[_0xc84b('0x2d')][_0xc84b('0x1f')]);}return _0x2f2fb6['getFields'](_0x4548e8);}})[_0xc84b('0x10')](function(_0x1f2619){if(_0x1f2619){return _0x1f2619?{'count':_0x2ab23b,'rows':_0x1f2619}:null;}})[_0xc84b('0x10')](respondWithResult(_0x3096e5,null))['catch'](handleError(_0x3096e5,null));};exports[_0xc84b('0x4d')]=function(_0x405da4,_0x1e6825,_0x1f256f){var _0x261a1d={};var _0x2dff20={};var _0x3b2930;var _0x58df03;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x405da4[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x1e6825,null))[_0xc84b('0x10')](function(_0x32705d){if(_0x32705d){_0x3b2930=_0x32705d;_0x2dff20[_0xc84b('0x30')]=_[_0xc84b('0x2c')](db[_0xc84b('0x4e')][_0xc84b('0x45')]);_0x2dff20['query']=_[_0xc84b('0x2c')](_0x405da4[_0xc84b('0x2d')]);_0x2dff20[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x2dff20[_0xc84b('0x30')],_0x2dff20['query']);_0x261a1d[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x2dff20[_0xc84b('0x30')],qs['fields'](_0x405da4['query'][_0xc84b('0x33')]));_0x261a1d[_0xc84b('0x31')]=_0x261a1d[_0xc84b('0x31')][_0xc84b('0x34')]?_0x261a1d[_0xc84b('0x31')]:_0x2dff20['model'];_0x261a1d[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x261a1d['where']=qs[_0xc84b('0x3a')](_['pick'](_0x405da4['query'],_0x2dff20[_0xc84b('0x3a')]));if(_0x405da4[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x261a1d[_0xc84b('0x3e')]=_[_0xc84b('0x3d')](_0x261a1d['where'],{'$or':_[_0xc84b('0x3f')](_0x261a1d[_0xc84b('0x31')],function(_0x535d5){var _0x17594e={};_0x17594e[_0x535d5]={'$like':'%'+_0x405da4[_0xc84b('0x2d')][_0xc84b('0x40')]+'%'};return _0x17594e;})});}_0x261a1d=_['merge']({},_0x261a1d,_0x405da4[_0xc84b('0x41')]);return _0x3b2930[_0xc84b('0x4d')](_0x261a1d);}})['then'](function(_0x19da64){if(_0x19da64){_0x58df03=_0x19da64['length'];if(!_0x405da4[_0xc84b('0x2d')][_0xc84b('0x35')](_0xc84b('0x36'))){_0x261a1d[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x20')]);_0x261a1d[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x405da4[_0xc84b('0x2d')][_0xc84b('0x1f')]);}return _0x3b2930[_0xc84b('0x4d')](_0x261a1d);}})[_0xc84b('0x10')](function(_0x3c0ea5){if(_0x3c0ea5){return _0x3c0ea5?{'count':_0x58df03,'rows':_0x3c0ea5}:null;}})[_0xc84b('0x10')](respondWithResult(_0x1e6825,null))[_0xc84b('0x1a')](handleError(_0x1e6825,null));};exports[_0xc84b('0x4f')]=function(_0x3aae9e,_0x1eb84e,_0x13d41a){var _0xe377a5={};var _0x5ded21={};var _0x3a27a3;var _0x5839f2;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x3aae9e[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1eb84e,null))[_0xc84b('0x10')](function(_0x59a874){if(_0x59a874){_0x3a27a3=_0x59a874;_0x5ded21[_0xc84b('0x30')]=_['keys'](db[_0xc84b('0x4e')][_0xc84b('0x45')]);_0x5ded21[_0xc84b('0x2d')]=_[_0xc84b('0x2c')](_0x3aae9e[_0xc84b('0x2d')]);_0x5ded21[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x5ded21[_0xc84b('0x30')],_0x5ded21[_0xc84b('0x2d')]);_0xe377a5[_0xc84b('0x31')]=_[_0xc84b('0x32')](_0x5ded21['model'],qs[_0xc84b('0x33')](_0x3aae9e[_0xc84b('0x2d')]['fields']));_0xe377a5[_0xc84b('0x31')]=_0xe377a5[_0xc84b('0x31')]['length']?_0xe377a5[_0xc84b('0x31')]:_0x5ded21['model'];_0xe377a5['order']=qs[_0xc84b('0x38')](_0x3aae9e[_0xc84b('0x2d')][_0xc84b('0x38')]);_0xe377a5[_0xc84b('0x3e')]=qs[_0xc84b('0x3a')](_[_0xc84b('0x39')](_0x3aae9e[_0xc84b('0x2d')],_0x5ded21[_0xc84b('0x3a')]));if(_0x3aae9e['query'][_0xc84b('0x40')]){_0xe377a5['where']=_['merge'](_0xe377a5[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0xe377a5['attributes'],function(_0x2970e9){var _0x440f86={};_0x440f86[_0x2970e9]={'$like':'%'+_0x3aae9e['query'][_0xc84b('0x40')]+'%'};return _0x440f86;})});}_0xe377a5=_['merge']({},_0xe377a5,_0x3aae9e[_0xc84b('0x41')]);return _0x3a27a3[_0xc84b('0x4f')](_0xe377a5);}})[_0xc84b('0x10')](function(_0x4b888e){if(_0x4b888e){_0x5839f2=_0x4b888e[_0xc84b('0x34')];if(!_0x3aae9e[_0xc84b('0x2d')][_0xc84b('0x35')]('nolimit')){_0xe377a5[_0xc84b('0x20')]=qs['limit'](_0x3aae9e['query']['limit']);_0xe377a5[_0xc84b('0x1f')]=qs['offset'](_0x3aae9e['query']['offset']);}return _0x3a27a3[_0xc84b('0x4f')](_0xe377a5);}})[_0xc84b('0x10')](function(_0x5d3d00){if(_0x5d3d00){return _0x5d3d00?{'count':_0x5839f2,'rows':_0x5d3d00}:null;}})[_0xc84b('0x10')](respondWithResult(_0x1eb84e,null))['catch'](handleError(_0x1eb84e,null));};exports[_0xc84b('0x50')]=function(_0x1a590a,_0x155446,_0x33d454){var _0x5484aa={};var _0x2beb20={};var _0x182808;var _0x4fd848;return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x1a590a[_0xc84b('0x4a')]['id']}})[_0xc84b('0x10')](handleEntityNotFound(_0x155446,null))['then'](function(_0x1d9e28){if(_0x1d9e28){_0x182808=_0x1d9e28;_0x2beb20[_0xc84b('0x30')]=_[_0xc84b('0x2c')](db[_0xc84b('0x51')][_0xc84b('0x45')]);_0x2beb20[_0xc84b('0x2d')]=_['keys'](_0x1a590a[_0xc84b('0x2d')]);_0x2beb20[_0xc84b('0x3a')]=_[_0xc84b('0x32')](_0x2beb20[_0xc84b('0x30')],_0x2beb20['query']);_0x5484aa['attributes']=_[_0xc84b('0x32')](_0x2beb20[_0xc84b('0x30')],qs[_0xc84b('0x33')](_0x1a590a[_0xc84b('0x2d')]['fields']));_0x5484aa['attributes']=_0x5484aa[_0xc84b('0x31')]['length']?_0x5484aa['attributes']:_0x2beb20[_0xc84b('0x30')];_0x5484aa[_0xc84b('0x37')]=qs[_0xc84b('0x38')](_0x1a590a[_0xc84b('0x2d')][_0xc84b('0x38')]);_0x5484aa[_0xc84b('0x3e')]=qs['filters'](_[_0xc84b('0x39')](_0x1a590a[_0xc84b('0x2d')],_0x2beb20[_0xc84b('0x3a')]));if(_0x1a590a[_0xc84b('0x2d')][_0xc84b('0x40')]){_0x5484aa['where']=_[_0xc84b('0x3d')](_0x5484aa[_0xc84b('0x3e')],{'$or':_[_0xc84b('0x3f')](_0x5484aa[_0xc84b('0x31')],function(_0x45bf83){var _0x4a40f0={};_0x4a40f0[_0x45bf83]={'$like':'%'+_0x1a590a['query']['filter']+'%'};return _0x4a40f0;})});}_0x5484aa=_[_0xc84b('0x3d')]({},_0x5484aa,_0x1a590a['options']);return _0x182808[_0xc84b('0x50')](_0x5484aa);}})[_0xc84b('0x10')](function(_0x642769){if(_0x642769){_0x4fd848=_0x642769[_0xc84b('0x34')];if(!_0x1a590a['query'][_0xc84b('0x35')](_0xc84b('0x36'))){_0x5484aa[_0xc84b('0x20')]=qs[_0xc84b('0x20')](_0x1a590a[_0xc84b('0x2d')]['limit']);_0x5484aa[_0xc84b('0x1f')]=qs[_0xc84b('0x1f')](_0x1a590a[_0xc84b('0x2d')]['offset']);}return _0x182808[_0xc84b('0x50')](_0x5484aa);}})[_0xc84b('0x10')](function(_0x19ccfe){if(_0x19ccfe){return _0x19ccfe?{'count':_0x4fd848,'rows':_0x19ccfe}:null;}})[_0xc84b('0x10')](respondWithResult(_0x155446,null))[_0xc84b('0x1a')](handleError(_0x155446,null));};exports[_0xc84b('0x52')]=function(_0x1b5241,_0x5a63b1,_0x5d6bc2){if(_0x1b5241[_0xc84b('0x49')]['id']){delete _0x1b5241[_0xc84b('0x49')]['id'];}return db[_0xc84b('0x2b')][_0xc84b('0x4c')]({'where':{'id':_0x1b5241[_0xc84b('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a63b1,null))[_0xc84b('0x10')](function(_0x21c8f3){if(_0x21c8f3){return _0x21c8f3[_0xc84b('0x52')](_0x1b5241[_0xc84b('0x49')][_0xc84b('0x53')]||[]);}return null;})[_0xc84b('0x10')](respondWithResult(_0x5a63b1,null))[_0xc84b('0x1a')](handleError(_0x5a63b1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index fae1f77..230c6d0 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 _0xf9fd=['lodash','util','../../config/logger','moment','bluebird','./intFreshdeskConfiguration.attributes','FreshdeskConfiguration','int_freshdesk_configurations'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0xf9fd,0x118));var _0xdf9f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf9fd[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xdf9f('0x0'));var util=require(_0xdf9f('0x1'));var logger=require(_0xdf9f('0x2'))('api');var moment=require(_0xdf9f('0x3'));var BPromise=require(_0xdf9f('0x4'));var rp=require('request-promise');var attributes=require(_0xdf9f('0x5'));module['exports']=function(_0x544f5a,_0x214830){return _0x544f5a['define'](_0xdf9f('0x6'),attributes,{'tableName':_0xdf9f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2ca=['util','../../config/logger','moment','bluebird','request-promise','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash'];(function(_0x27880a,_0x527c39){var _0x1487b1=function(_0x74803){while(--_0x74803){_0x27880a['push'](_0x27880a['shift']());}};_0x1487b1(++_0x527c39);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0xf2ca[_0x512973];return _0x32f2e1;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var attributes=require(_0xaf2c('0x6'));module[_0xaf2c('0x7')]=function(_0x10c910,_0x5b8c81){return _0x10c910[_0xaf2c('0x8')](_0xaf2c('0x9'),attributes,{'tableName':_0xaf2c('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 3d24c1f..36fa237 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 _0xf632=['request','then','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x2d5ff6,_0x2282ed){var _0x348700=function(_0x49812a){while(--_0x49812a){_0x2d5ff6['push'](_0x2d5ff6['shift']());}};_0x348700(++_0x2282ed);}(_0xf632,0x1b0));var _0x2f63=function(_0x5466f9,_0x3f6032){_0x5466f9=_0x5466f9-0x0;var _0xfbe096=_0xf632[_0x5466f9];return _0xfbe096;};'use strict';var _=require(_0x2f63('0x0'));var util=require(_0x2f63('0x1'));var moment=require(_0x2f63('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2f63('0x3'));var logger=require('../../config/logger')(_0x2f63('0x4'));var config=require(_0x2f63('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2f63('0x6')][_0x2f63('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x297b1f,_0x386b97,_0xd42f31){return new BPromise(function(_0x562dc5,_0x3243ce){return client[_0x2f63('0x8')](_0x297b1f,_0xd42f31)[_0x2f63('0x9')](function(_0x14abc5){logger['info'](_0x2f63('0xa'),_0x386b97,'request\x20sent');logger[_0x2f63('0xb')](_0x2f63('0xc'),_0x386b97,_0x2f63('0xd'),JSON['stringify'](_0x14abc5));if(_0x14abc5['error']){if(_0x14abc5[_0x2f63('0xe')][_0x2f63('0xf')]===0x1f4){logger['error'](_0x2f63('0xa'),_0x386b97,_0x14abc5[_0x2f63('0xe')][_0x2f63('0x10')]);return _0x3243ce(_0x14abc5[_0x2f63('0xe')][_0x2f63('0x10')]);}logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x386b97,_0x14abc5[_0x2f63('0xe')][_0x2f63('0x10')]);return _0x562dc5(_0x14abc5[_0x2f63('0xe')][_0x2f63('0x10')]);}else{logger[_0x2f63('0x11')](_0x2f63('0xa'),_0x386b97,'request\x20sent');_0x562dc5(_0x14abc5[_0x2f63('0x12')][_0x2f63('0x10')]);}})[_0x2f63('0x13')](function(_0x3d52){logger['error'](_0x2f63('0xa'),_0x386b97,_0x3d52);_0x3243ce(_0x3d52);});});} \ No newline at end of file +var _0x8c6a=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x5d6a51,_0x30c4c0){var _0x551c72=function(_0x46c92d){while(--_0x46c92d){_0x5d6a51['push'](_0x5d6a51['shift']());}};_0x551c72(++_0x30c4c0);}(_0x8c6a,0xe4));var _0xa8c6=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x8c6a[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xa8c6('0x0'));var util=require(_0xa8c6('0x1'));var moment=require(_0xa8c6('0x2'));var BPromise=require(_0xa8c6('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xa8c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa8c6('0x5'));var config=require('../../config/environment');var jayson=require(_0xa8c6('0x6'));var client=jayson[_0xa8c6('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cbdc,_0x56975c,_0x582d12){return new BPromise(function(_0x36f68f,_0x5cb78e){return client[_0xa8c6('0x8')](_0x34cbdc,_0x582d12)[_0xa8c6('0x9')](function(_0x2b6ba0){logger[_0xa8c6('0xa')](_0xa8c6('0xb'),_0x56975c,'request\x20sent');logger[_0xa8c6('0xc')](_0xa8c6('0xd'),_0x56975c,_0xa8c6('0xe'),JSON[_0xa8c6('0xf')](_0x2b6ba0));if(_0x2b6ba0[_0xa8c6('0x10')]){if(_0x2b6ba0[_0xa8c6('0x10')]['code']===0x1f4){logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x2b6ba0[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x5cb78e(_0x2b6ba0[_0xa8c6('0x10')]['message']);}logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x2b6ba0[_0xa8c6('0x10')][_0xa8c6('0x11')]);return _0x36f68f(_0x2b6ba0['error'][_0xa8c6('0x11')]);}else{logger['info'](_0xa8c6('0xb'),_0x56975c,'request\x20sent');_0x36f68f(_0x2b6ba0[_0xa8c6('0x12')][_0xa8c6('0x11')]);}})[_0xa8c6('0x13')](function(_0x307e73){logger[_0xa8c6('0x10')](_0xa8c6('0xb'),_0x56975c,_0x307e73);_0x5cb78e(_0x307e73);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7117545..cda8a46 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 _0x850c=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x4bc22f,_0xdb0284){var _0x55414b=function(_0x36d90b){while(--_0x36d90b){_0x4bc22f['push'](_0x4bc22f['shift']());}};_0x55414b(++_0xdb0284);}(_0x850c,0x1a9));var _0xc850=function(_0xc3c325,_0x3a684e){_0xc3c325=_0xc3c325-0x0;var _0x47edc2=_0x850c[_0xc3c325];return _0x47edc2;};'use strict';var multer=require(_0xc850('0x0'));var util=require(_0xc850('0x1'));var path=require(_0xc850('0x2'));var express=require(_0xc850('0x3'));var router=express[_0xc850('0x4')]();var auth=require(_0xc850('0x5'));var interaction=require(_0xc850('0x6'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0xc850('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc850('0x7')](_0xc850('0x8'),auth[_0xc850('0x9')](),controller[_0xc850('0xa')]);router[_0xc850('0xb')]('/',auth[_0xc850('0x9')](),controller['create']);router[_0xc850('0xc')](_0xc850('0x8'),auth[_0xc850('0x9')](),controller[_0xc850('0xd')]);router[_0xc850('0xe')](_0xc850('0x8'),auth[_0xc850('0x9')](),controller[_0xc850('0xf')]);module[_0xc850('0x10')]=router; \ No newline at end of file +var _0x62fc=['get','isAuthenticated','show','put','update','/:id','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x62fc,0xda));var _0xc62f=function(_0xb51a2d,_0x5c7437){_0xb51a2d=_0xb51a2d-0x0;var _0x1ea1e0=_0x62fc[_0xb51a2d];return _0x1ea1e0;};'use strict';var multer=require('multer');var util=require(_0xc62f('0x0'));var path=require('path');var express=require(_0xc62f('0x1'));var router=express[_0xc62f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xc62f('0x3'));var config=require(_0xc62f('0x4'));var controller=require(_0xc62f('0x5'));router[_0xc62f('0x6')]('/',auth[_0xc62f('0x7')](),controller['index']);router[_0xc62f('0x6')]('/:id',auth[_0xc62f('0x7')](),controller[_0xc62f('0x8')]);router['post']('/',auth[_0xc62f('0x7')](),controller['create']);router[_0xc62f('0x9')]('/:id',auth[_0xc62f('0x7')](),controller[_0xc62f('0xa')]);router['delete'](_0xc62f('0xb'),auth[_0xc62f('0x7')](),controller[_0xc62f('0xc')]);module[_0xc62f('0xd')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 82956ae..94e4f4b 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 _0x2dae=['keyValue','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0xaea390,_0x4963bd){var _0x5e884a=function(_0x55bb3a){while(--_0x55bb3a){_0xaea390['push'](_0xaea390['shift']());}};_0x5e884a(++_0x4963bd);}(_0x2dae,0xc3));var _0xe2da=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x2dae[_0x2f6f50];return _0x2cf365;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'type':{'type':Sequelize[_0xe2da('0x1')](_0xe2da('0x2'),_0xe2da('0x3'),_0xe2da('0x4'),_0xe2da('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xe2da('0x6')]},'key':{'type':Sequelize[_0xe2da('0x6')]},'keyType':{'type':Sequelize[_0xe2da('0x1')](_0xe2da('0x2'),'variable',_0xe2da('0x4'))},'keyContent':{'type':Sequelize[_0xe2da('0x6')]},'idField':{'type':Sequelize[_0xe2da('0x6')]},'nameField':{'type':Sequelize[_0xe2da('0x6')]},'customField':{'type':Sequelize[_0xe2da('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe2da('0x6')]}}; \ No newline at end of file +var _0x6e6c=['variable','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x40f59c,_0x1a7c33){var _0x36f110=function(_0x494939){while(--_0x494939){_0x40f59c['push'](_0x40f59c['shift']());}};_0x36f110(++_0x1a7c33);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable','keyValue'),'defaultValue':_0xc6e6('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc6e6('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xc6e6('0x2'),_0xc6e6('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc6e6('0x4')]},'idField':{'type':Sequelize[_0xc6e6('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc6e6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc6e6('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c146fb8..b54801a 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 _0xe9ef=['keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','FreshdeskField','rawAttributes','model'];(function(_0x4e7384,_0x3d7631){var _0x2f150e=function(_0x47746a){while(--_0x47746a){_0x4e7384['push'](_0x4e7384['shift']());}};_0x2f150e(++_0x3d7631);}(_0xe9ef,0x16e));var _0xfe9e=function(_0x5ca353,_0x21eb37){_0x5ca353=_0x5ca353-0x0;var _0x4f2fe5=_0xe9ef[_0x5ca353];return _0x4f2fe5;};'use strict';var jsonpatch=require(_0xfe9e('0x0'));var rp=require('request-promise');var moment=require(_0xfe9e('0x1'));var BPromise=require(_0xfe9e('0x2'));var Mustache=require('mustache');var util=require(_0xfe9e('0x3'));var path=require('path');var sox=require(_0xfe9e('0x4'));var csv=require(_0xfe9e('0x5'));var ejs=require(_0xfe9e('0x6'));var fs=require('fs');var _=require(_0xfe9e('0x7'));var squel=require('squel');var crypto=require(_0xfe9e('0x8'));var jsforce=require(_0xfe9e('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfe9e('0xa'));var Papa=require('papaparse');var qs=require(_0xfe9e('0xb'));var logger=require(_0xfe9e('0xc'))(_0xfe9e('0xd'));var utils=require('../../config/utils');var config=require(_0xfe9e('0xe'));var db=require(_0xfe9e('0xf'))['db'];function respondWithStatusCode(_0xba1c64,_0x5ab3bd){_0x5ab3bd=_0x5ab3bd||0xcc;return function(_0x1cc515){if(_0x1cc515){return _0xba1c64['sendStatus'](_0x5ab3bd);}return _0xba1c64[_0xfe9e('0x10')](_0x5ab3bd)[_0xfe9e('0x11')]();};}function respondWithResult(_0x37a8ba,_0x1d8b9b){_0x1d8b9b=_0x1d8b9b||0xc8;return function(_0x232908){if(_0x232908){return _0x37a8ba[_0xfe9e('0x10')](_0x1d8b9b)[_0xfe9e('0x12')](_0x232908);}};}function respondWithFilteredResult(_0x3ec8de,_0x3f4c32){return function(_0x551d72){if(_0x551d72){var _0x2805cb=_0x551d72[_0xfe9e('0x13')],_0x173e46=_0x3f4c32[_0xfe9e('0x14')],_0x55ac95=_0x3f4c32[_0xfe9e('0x14')]+_0x3f4c32['limit'],_0x344a80;if(_0x55ac95>=_0x2805cb){_0x55ac95=_0x2805cb;_0x344a80=0xc8;}else{_0x344a80=0xce;}_0x3ec8de['status'](_0x344a80);return _0x3ec8de[_0xfe9e('0x15')](_0xfe9e('0x16'),_0x173e46+'-'+_0x55ac95+'/'+_0x2805cb)[_0xfe9e('0x12')](_0x551d72);}return null;};}function patchUpdates(_0x30ad77){return function(_0x487cc6){try{jsonpatch[_0xfe9e('0x17')](_0x487cc6,_0x30ad77,!![]);}catch(_0x158cbf){return BPromise[_0xfe9e('0x18')](_0x158cbf);}return _0x487cc6[_0xfe9e('0x19')]();};}function saveUpdates(_0x495344,_0x299d8c){return function(_0x114434){if(_0x114434){return _0x114434[_0xfe9e('0x1a')](_0x495344)[_0xfe9e('0x1b')](function(_0x138cc3){return _0x138cc3;});}return null;};}function removeEntity(_0x583641,_0x5df7ea){return function(_0x255305){if(_0x255305){return _0x255305[_0xfe9e('0x1c')]()[_0xfe9e('0x1b')](function(){_0x583641[_0xfe9e('0x10')](0xcc)[_0xfe9e('0x11')]();});}};}function handleEntityNotFound(_0x147ae5,_0x11e615){return function(_0xb5d636){if(!_0xb5d636){_0x147ae5[_0xfe9e('0x1d')](0x194);}return _0xb5d636;};}function handleError(_0xa7d9d8,_0x1988ac){_0x1988ac=_0x1988ac||0x1f4;return function(_0x132e78){logger['error'](_0x132e78[_0xfe9e('0x1e')]);if(_0x132e78[_0xfe9e('0x1f')]){delete _0x132e78['name'];}_0xa7d9d8[_0xfe9e('0x10')](_0x1988ac)['send'](_0x132e78);};}exports[_0xfe9e('0x20')]=function(_0x1df6cd,_0x56308e){var _0x162ce2={},_0x3b5aea={},_0x28d2cb={'count':0x0,'rows':[]};var _0x344746=db[_0xfe9e('0x21')][_0xfe9e('0x22')];_0x3b5aea[_0xfe9e('0x23')]=_[_0xfe9e('0x24')](_0x344746);var _0x37bd9e={'dateStart':_0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x26')],'dateEnd':_0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x27')]};delete _0x1df6cd['query']['dateStart'];delete _0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x27')];_0x3b5aea[_0xfe9e('0x25')]=_[_0xfe9e('0x24')](_0x1df6cd['query']);_0x3b5aea[_0xfe9e('0x28')]=_['intersection'](_0x3b5aea['model'],_0x3b5aea['query']);_0x162ce2[_0xfe9e('0x29')]=_[_0xfe9e('0x2a')](_0x3b5aea[_0xfe9e('0x23')],qs['fields'](_0x1df6cd['query'][_0xfe9e('0x2b')]));_0x162ce2[_0xfe9e('0x29')]=_0x162ce2[_0xfe9e('0x29')][_0xfe9e('0x2c')]?_0x162ce2[_0xfe9e('0x29')]:_0x3b5aea['model'];if(!_0x1df6cd['query'][_0xfe9e('0x2d')](_0xfe9e('0x2e'))){_0x162ce2[_0xfe9e('0x2f')]=qs[_0xfe9e('0x2f')](_0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x2f')]);_0x162ce2[_0xfe9e('0x14')]=qs[_0xfe9e('0x14')](_0x1df6cd['query'][_0xfe9e('0x14')]);}_0x162ce2[_0xfe9e('0x30')]=qs[_0xfe9e('0x31')](_0x1df6cd['query'][_0xfe9e('0x31')]);_0x162ce2[_0xfe9e('0x32')]=qs['filters'](_['pick'](_0x1df6cd[_0xfe9e('0x25')],_0x3b5aea[_0xfe9e('0x28')]));if(_0x37bd9e[_0xfe9e('0x26')]){if(_0x37bd9e[_0xfe9e('0x27')]){_0x37bd9e[_0xfe9e('0x27')]=moment(_0x37bd9e[_0xfe9e('0x27')])[_0xfe9e('0x33')](0x1,'day');}else{_0x37bd9e['dateEnd']=moment(_0x37bd9e[_0xfe9e('0x26')])[_0xfe9e('0x33')](0x1,_0xfe9e('0x34'));}_[_0xfe9e('0x35')](_0x162ce2[_0xfe9e('0x32')],{'createdAt':{'$gte':_0x37bd9e[_0xfe9e('0x26')],'$lte':_0x37bd9e[_0xfe9e('0x27')]}});}if(_0x1df6cd['query'][_0xfe9e('0x36')]){_0x162ce2['where']=_[_0xfe9e('0x35')](_0x162ce2['where'],{'$or':_[_0xfe9e('0x37')](_0x162ce2['attributes'],function(_0xaff270){var _0x31c4ea={};_0x31c4ea[_0xaff270]={'$like':'%'+_0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x36')]+'%'};return _0x31c4ea;})});}_0x162ce2=_[_0xfe9e('0x35')]({},_0x162ce2,_0x1df6cd[_0xfe9e('0x38')]);var _0x58e703={'where':_0x162ce2['where']};return db[_0xfe9e('0x21')]['count'](_0x58e703)[_0xfe9e('0x1b')](function(_0x43abfe){_0x28d2cb['count']=_0x43abfe;if(_0x1df6cd[_0xfe9e('0x25')][_0xfe9e('0x39')]){_0x162ce2[_0xfe9e('0x3a')]=[{'all':!![]}];}return db[_0xfe9e('0x21')][_0xfe9e('0x3b')](_0x162ce2);})['then'](function(_0x258156){_0x28d2cb[_0xfe9e('0x3c')]=_0x258156;return _0x28d2cb;})[_0xfe9e('0x1b')](respondWithFilteredResult(_0x56308e,_0x162ce2))[_0xfe9e('0x3d')](handleError(_0x56308e,null));};exports[_0xfe9e('0x3e')]=function(_0x29c297,_0x160575){var _0x3caf7b={'raw':!![],'where':{'id':_0x29c297['params']['id']}},_0x30d892={};_0x30d892[_0xfe9e('0x23')]=_[_0xfe9e('0x24')](db[_0xfe9e('0x21')][_0xfe9e('0x22')]);_0x30d892[_0xfe9e('0x25')]=_['keys'](_0x29c297[_0xfe9e('0x25')]);_0x30d892[_0xfe9e('0x28')]=_[_0xfe9e('0x2a')](_0x30d892[_0xfe9e('0x23')],_0x30d892[_0xfe9e('0x25')]);_0x3caf7b['attributes']=_[_0xfe9e('0x2a')](_0x30d892[_0xfe9e('0x23')],qs[_0xfe9e('0x2b')](_0x29c297[_0xfe9e('0x25')][_0xfe9e('0x2b')]));_0x3caf7b[_0xfe9e('0x29')]=_0x3caf7b['attributes']['length']?_0x3caf7b[_0xfe9e('0x29')]:_0x30d892[_0xfe9e('0x23')];if(_0x29c297[_0xfe9e('0x25')][_0xfe9e('0x39')]){_0x3caf7b[_0xfe9e('0x3a')]=[{'all':!![]}];}_0x3caf7b=_[_0xfe9e('0x35')]({},_0x3caf7b,_0x29c297['options']);return db['FreshdeskField'][_0xfe9e('0x3f')](_0x3caf7b)[_0xfe9e('0x1b')](handleEntityNotFound(_0x160575,null))[_0xfe9e('0x1b')](respondWithResult(_0x160575,null))['catch'](handleError(_0x160575,null));};exports[_0xfe9e('0x40')]=function(_0x8682eb,_0xad0a90){return db[_0xfe9e('0x21')]['create'](_0x8682eb[_0xfe9e('0x41')],{})[_0xfe9e('0x1b')](respondWithResult(_0xad0a90,0xc9))[_0xfe9e('0x3d')](handleError(_0xad0a90,null));};exports[_0xfe9e('0x1a')]=function(_0x1b870a,_0x52e445){if(_0x1b870a[_0xfe9e('0x41')]['id']){delete _0x1b870a[_0xfe9e('0x41')]['id'];}return db[_0xfe9e('0x21')][_0xfe9e('0x3f')]({'where':{'id':_0x1b870a['params']['id']}})['then'](handleEntityNotFound(_0x52e445,null))[_0xfe9e('0x1b')](saveUpdates(_0x1b870a[_0xfe9e('0x41')],null))[_0xfe9e('0x1b')](respondWithResult(_0x52e445,null))[_0xfe9e('0x3d')](handleError(_0x52e445,null));};exports[_0xfe9e('0x1c')]=function(_0x3c6c03,_0x3e4acd){return db[_0xfe9e('0x21')][_0xfe9e('0x3f')]({'where':{'id':_0x3c6c03[_0xfe9e('0x42')]['id']}})[_0xfe9e('0x1b')](handleEntityNotFound(_0x3e4acd,null))[_0xfe9e('0x1b')](removeEntity(_0x3e4acd,null))['catch'](handleError(_0x3e4acd,null));}; \ No newline at end of file +var _0xd1f8=['util','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','FreshdeskField','rawAttributes','keys','query','dateEnd','filters','intersection','model','attributes','fields','length','nolimit','order','sort','dateStart','day','add','where','filter','map','merge','options','include','rows','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','bluebird'];(function(_0x45cb2b,_0x285349){var _0x9411a6=function(_0x15da36){while(--_0x15da36){_0x45cb2b['push'](_0x45cb2b['shift']());}};_0x9411a6(++_0x285349);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x402c8f,_0x30cc1d){_0x402c8f=_0x402c8f-0x0;var _0x11e809=_0xd1f8[_0x402c8f];return _0x11e809;};'use strict';var jsonpatch=require(_0x8d1f('0x0'));var rp=require(_0x8d1f('0x1'));var moment=require(_0x8d1f('0x2'));var BPromise=require(_0x8d1f('0x3'));var Mustache=require('mustache');var util=require(_0x8d1f('0x4'));var path=require('path');var sox=require(_0x8d1f('0x5'));var csv=require('to-csv');var ejs=require(_0x8d1f('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8d1f('0x7'));var crypto=require(_0x8d1f('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x8d1f('0x9'));var toCsv=require(_0x8d1f('0xa'));var querystring=require(_0x8d1f('0xb'));var Papa=require(_0x8d1f('0xc'));var qs=require(_0x8d1f('0xd'));var logger=require('../../config/logger')(_0x8d1f('0xe'));var utils=require(_0x8d1f('0xf'));var config=require('../../config/environment');var db=require(_0x8d1f('0x10'))['db'];function respondWithStatusCode(_0x470e55,_0x228a85){_0x228a85=_0x228a85||0xcc;return function(_0x425838){if(_0x425838){return _0x470e55[_0x8d1f('0x11')](_0x228a85);}return _0x470e55['status'](_0x228a85)['end']();};}function respondWithResult(_0x140dfa,_0x525334){_0x525334=_0x525334||0xc8;return function(_0x236eaf){if(_0x236eaf){return _0x140dfa[_0x8d1f('0x12')](_0x525334)['json'](_0x236eaf);}};}function respondWithFilteredResult(_0x52cd91,_0x2052f6){return function(_0x50ccc){if(_0x50ccc){var _0x5e0805=_0x50ccc[_0x8d1f('0x13')],_0x7d9ae5=_0x2052f6[_0x8d1f('0x14')],_0x8c423c=_0x2052f6[_0x8d1f('0x14')]+_0x2052f6[_0x8d1f('0x15')],_0x443511;if(_0x8c423c>=_0x5e0805){_0x8c423c=_0x5e0805;_0x443511=0xc8;}else{_0x443511=0xce;}_0x52cd91[_0x8d1f('0x12')](_0x443511);return _0x52cd91[_0x8d1f('0x16')](_0x8d1f('0x17'),_0x7d9ae5+'-'+_0x8c423c+'/'+_0x5e0805)[_0x8d1f('0x18')](_0x50ccc);}return null;};}function patchUpdates(_0x1c106a){return function(_0x431beb){try{jsonpatch[_0x8d1f('0x19')](_0x431beb,_0x1c106a,!![]);}catch(_0x3b33c9){return BPromise[_0x8d1f('0x1a')](_0x3b33c9);}return _0x431beb[_0x8d1f('0x1b')]();};}function saveUpdates(_0x495655,_0x4c39d9){return function(_0x1f921a){if(_0x1f921a){return _0x1f921a[_0x8d1f('0x1c')](_0x495655)[_0x8d1f('0x1d')](function(_0x11948d){return _0x11948d;});}return null;};}function removeEntity(_0x224b46,_0x20241e){return function(_0x59bd2f){if(_0x59bd2f){return _0x59bd2f[_0x8d1f('0x1e')]()[_0x8d1f('0x1d')](function(){_0x224b46[_0x8d1f('0x12')](0xcc)[_0x8d1f('0x1f')]();});}};}function handleEntityNotFound(_0x4d5466,_0x47cfb0){return function(_0x4519bc){if(!_0x4519bc){_0x4d5466[_0x8d1f('0x11')](0x194);}return _0x4519bc;};}function handleError(_0x5175a5,_0xc7f18e){_0xc7f18e=_0xc7f18e||0x1f4;return function(_0x55faa4){logger[_0x8d1f('0x20')](_0x55faa4[_0x8d1f('0x21')]);if(_0x55faa4[_0x8d1f('0x22')]){delete _0x55faa4[_0x8d1f('0x22')];}_0x5175a5[_0x8d1f('0x12')](_0xc7f18e)[_0x8d1f('0x23')](_0x55faa4);};}exports[_0x8d1f('0x24')]=function(_0x38170b,_0x296d0c){var _0x4ba072={},_0x24c04a={},_0x213321={'count':0x0,'rows':[]};var _0x584157=db[_0x8d1f('0x25')][_0x8d1f('0x26')];_0x24c04a['model']=_[_0x8d1f('0x27')](_0x584157);var _0x2dbc3d={'dateStart':_0x38170b[_0x8d1f('0x28')]['dateStart'],'dateEnd':_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x29')]};delete _0x38170b[_0x8d1f('0x28')]['dateStart'];delete _0x38170b[_0x8d1f('0x28')]['dateEnd'];_0x24c04a['query']=_[_0x8d1f('0x27')](_0x38170b[_0x8d1f('0x28')]);_0x24c04a[_0x8d1f('0x2a')]=_[_0x8d1f('0x2b')](_0x24c04a[_0x8d1f('0x2c')],_0x24c04a[_0x8d1f('0x28')]);_0x4ba072[_0x8d1f('0x2d')]=_[_0x8d1f('0x2b')](_0x24c04a['model'],qs[_0x8d1f('0x2e')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x2e')]));_0x4ba072[_0x8d1f('0x2d')]=_0x4ba072[_0x8d1f('0x2d')][_0x8d1f('0x2f')]?_0x4ba072['attributes']:_0x24c04a[_0x8d1f('0x2c')];if(!_0x38170b[_0x8d1f('0x28')]['hasOwnProperty'](_0x8d1f('0x30'))){_0x4ba072[_0x8d1f('0x15')]=qs['limit'](_0x38170b['query']['limit']);_0x4ba072[_0x8d1f('0x14')]=qs[_0x8d1f('0x14')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x14')]);}_0x4ba072[_0x8d1f('0x31')]=qs[_0x8d1f('0x32')](_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x32')]);_0x4ba072['where']=qs['filters'](_['pick'](_0x38170b[_0x8d1f('0x28')],_0x24c04a[_0x8d1f('0x2a')]));if(_0x2dbc3d[_0x8d1f('0x33')]){if(_0x2dbc3d[_0x8d1f('0x29')]){_0x2dbc3d[_0x8d1f('0x29')]=moment(_0x2dbc3d[_0x8d1f('0x29')])['add'](0x1,_0x8d1f('0x34'));}else{_0x2dbc3d['dateEnd']=moment(_0x2dbc3d[_0x8d1f('0x33')])[_0x8d1f('0x35')](0x1,'day');}_['merge'](_0x4ba072[_0x8d1f('0x36')],{'createdAt':{'$gte':_0x2dbc3d[_0x8d1f('0x33')],'$lte':_0x2dbc3d[_0x8d1f('0x29')]}});}if(_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x37')]){_0x4ba072[_0x8d1f('0x36')]=_['merge'](_0x4ba072[_0x8d1f('0x36')],{'$or':_[_0x8d1f('0x38')](_0x4ba072[_0x8d1f('0x2d')],function(_0x19273f){var _0x331a10={};_0x331a10[_0x19273f]={'$like':'%'+_0x38170b[_0x8d1f('0x28')][_0x8d1f('0x37')]+'%'};return _0x331a10;})});}_0x4ba072=_[_0x8d1f('0x39')]({},_0x4ba072,_0x38170b[_0x8d1f('0x3a')]);var _0x2f1c93={'where':_0x4ba072[_0x8d1f('0x36')]};return db['FreshdeskField'][_0x8d1f('0x13')](_0x2f1c93)[_0x8d1f('0x1d')](function(_0x1dfa97){_0x213321['count']=_0x1dfa97;if(_0x38170b['query']['includeAll']){_0x4ba072[_0x8d1f('0x3b')]=[{'all':!![]}];}return db[_0x8d1f('0x25')]['findAll'](_0x4ba072);})[_0x8d1f('0x1d')](function(_0x1dfd62){_0x213321[_0x8d1f('0x3c')]=_0x1dfd62;return _0x213321;})[_0x8d1f('0x1d')](respondWithFilteredResult(_0x296d0c,_0x4ba072))[_0x8d1f('0x3d')](handleError(_0x296d0c,null));};exports[_0x8d1f('0x3e')]=function(_0x345d19,_0x279e9a){var _0x1b8186={'raw':!![],'where':{'id':_0x345d19[_0x8d1f('0x3f')]['id']}},_0x2d891e={};_0x2d891e['model']=_[_0x8d1f('0x27')](db[_0x8d1f('0x25')]['rawAttributes']);_0x2d891e[_0x8d1f('0x28')]=_[_0x8d1f('0x27')](_0x345d19[_0x8d1f('0x28')]);_0x2d891e[_0x8d1f('0x2a')]=_['intersection'](_0x2d891e['model'],_0x2d891e['query']);_0x1b8186['attributes']=_[_0x8d1f('0x2b')](_0x2d891e[_0x8d1f('0x2c')],qs['fields'](_0x345d19[_0x8d1f('0x28')]['fields']));_0x1b8186['attributes']=_0x1b8186['attributes'][_0x8d1f('0x2f')]?_0x1b8186[_0x8d1f('0x2d')]:_0x2d891e[_0x8d1f('0x2c')];if(_0x345d19[_0x8d1f('0x28')]['includeAll']){_0x1b8186[_0x8d1f('0x3b')]=[{'all':!![]}];}_0x1b8186=_['merge']({},_0x1b8186,_0x345d19['options']);return db[_0x8d1f('0x25')][_0x8d1f('0x40')](_0x1b8186)[_0x8d1f('0x1d')](handleEntityNotFound(_0x279e9a,null))[_0x8d1f('0x1d')](respondWithResult(_0x279e9a,null))[_0x8d1f('0x3d')](handleError(_0x279e9a,null));};exports[_0x8d1f('0x41')]=function(_0x103957,_0x436125){return db[_0x8d1f('0x25')]['create'](_0x103957[_0x8d1f('0x42')],{})[_0x8d1f('0x1d')](respondWithResult(_0x436125,0xc9))[_0x8d1f('0x3d')](handleError(_0x436125,null));};exports[_0x8d1f('0x1c')]=function(_0x174093,_0x239111){if(_0x174093[_0x8d1f('0x42')]['id']){delete _0x174093[_0x8d1f('0x42')]['id'];}return db[_0x8d1f('0x25')][_0x8d1f('0x40')]({'where':{'id':_0x174093[_0x8d1f('0x3f')]['id']}})[_0x8d1f('0x1d')](handleEntityNotFound(_0x239111,null))[_0x8d1f('0x1d')](saveUpdates(_0x174093[_0x8d1f('0x42')],null))[_0x8d1f('0x1d')](respondWithResult(_0x239111,null))[_0x8d1f('0x3d')](handleError(_0x239111,null));};exports['destroy']=function(_0x21a44a,_0xe7e4e3){return db[_0x8d1f('0x25')][_0x8d1f('0x40')]({'where':{'id':_0x21a44a[_0x8d1f('0x3f')]['id']}})[_0x8d1f('0x1d')](handleEntityNotFound(_0xe7e4e3,null))[_0x8d1f('0x1d')](removeEntity(_0xe7e4e3,null))[_0x8d1f('0x3d')](handleError(_0xe7e4e3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 6853b4e..de89b77 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 _0xccde=['moment','bluebird','exports','define','FreshdeskField','lodash','../../config/logger'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xccde,0x1e1));var _0xeccd=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xccde[_0x411add];return _0x238242;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var logger=require(_0xeccd('0x1'))('api');var moment=require(_0xeccd('0x2'));var BPromise=require(_0xeccd('0x3'));var rp=require('request-promise');var attributes=require('./intFreshdeskField.attributes');module[_0xeccd('0x4')]=function(_0x3eede4,_0x175682){return _0x3eede4[_0xeccd('0x5')](_0xeccd('0x6'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccde=['moment','bluebird','exports','define','FreshdeskField','lodash','../../config/logger'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xccde,0x1e1));var _0xeccd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xccde[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0xeccd('0x0'));var util=require('util');var logger=require(_0xeccd('0x1'))('api');var moment=require(_0xeccd('0x2'));var BPromise=require(_0xeccd('0x3'));var rp=require('request-promise');var attributes=require('./intFreshdeskField.attributes');module[_0xeccd('0x4')]=function(_0x3eede4,_0x175682){return _0x3eede4[_0xeccd('0x5')](_0xeccd('0x6'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index 19cf4b4..6d3d58a 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 _0x609a=['info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x160060,_0x17db49){var _0x4a5749=function(_0x6a62ea){while(--_0x6a62ea){_0x160060['push'](_0x160060['shift']());}};_0x4a5749(++_0x17db49);}(_0x609a,0x1e9));var _0xa609=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x609a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa609('0x0'));var util=require('util');var moment=require(_0xa609('0x1'));var BPromise=require(_0xa609('0x2'));var rs=require(_0xa609('0x3'));var fs=require('fs');var db=require(_0xa609('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa609('0x5'))('rpc');var config=require(_0xa609('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa609('0x7')][_0xa609('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5dc9d4,_0x5ce3c8,_0x188761){return new BPromise(function(_0x1a29fa,_0x4d3292){return client[_0xa609('0x9')](_0x5dc9d4,_0x188761)[_0xa609('0xa')](function(_0x3b4ebd){logger[_0xa609('0xb')](_0xa609('0xc'),_0x5ce3c8,'request\x20sent');logger[_0xa609('0xd')](_0xa609('0xe'),_0x5ce3c8,_0xa609('0xf'),JSON['stringify'](_0x3b4ebd));if(_0x3b4ebd[_0xa609('0x10')]){if(_0x3b4ebd[_0xa609('0x10')][_0xa609('0x11')]===0x1f4){logger[_0xa609('0x10')](_0xa609('0xc'),_0x5ce3c8,_0x3b4ebd[_0xa609('0x10')]['message']);return _0x4d3292(_0x3b4ebd[_0xa609('0x10')][_0xa609('0x12')]);}logger[_0xa609('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x5ce3c8,_0x3b4ebd[_0xa609('0x10')][_0xa609('0x12')]);return _0x1a29fa(_0x3b4ebd[_0xa609('0x10')]['message']);}else{logger[_0xa609('0xb')](_0xa609('0xc'),_0x5ce3c8,_0xa609('0xf'));_0x1a29fa(_0x3b4ebd[_0xa609('0x13')]['message']);}})['catch'](function(_0x28ec62){logger[_0xa609('0x10')](_0xa609('0xc'),_0x5ce3c8,_0x28ec62);_0x4d3292(_0x28ec62);});});} \ No newline at end of file +var _0x8dda=['http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5053b6,_0x128dd9){var _0xf5b176=function(_0x1b301c){while(--_0x1b301c){_0x5053b6['push'](_0x5053b6['shift']());}};_0xf5b176(++_0x128dd9);}(_0x8dda,0x13a));var _0xa8dd=function(_0x5443e2,_0xe2863c){_0x5443e2=_0x5443e2-0x0;var _0x5cb7c0=_0x8dda[_0x5443e2];return _0x5cb7c0;};'use strict';var _=require(_0xa8dd('0x0'));var util=require('util');var moment=require(_0xa8dd('0x1'));var BPromise=require(_0xa8dd('0x2'));var rs=require(_0xa8dd('0x3'));var fs=require('fs');var db=require(_0xa8dd('0x4'))['db'];var utils=require(_0xa8dd('0x5'));var logger=require(_0xa8dd('0x6'))(_0xa8dd('0x7'));var config=require(_0xa8dd('0x8'));var jayson=require(_0xa8dd('0x9'));var client=jayson[_0xa8dd('0xa')][_0xa8dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x39108c,_0x2b167c,_0x5de8be){return new BPromise(function(_0x89cf0e,_0x5246fb){return client[_0xa8dd('0xc')](_0x39108c,_0x5de8be)[_0xa8dd('0xd')](function(_0x59fa60){logger[_0xa8dd('0xe')](_0xa8dd('0xf'),_0x2b167c,_0xa8dd('0x10'));logger[_0xa8dd('0x11')](_0xa8dd('0x12'),_0x2b167c,_0xa8dd('0x10'),JSON[_0xa8dd('0x13')](_0x59fa60));if(_0x59fa60[_0xa8dd('0x14')]){if(_0x59fa60['error'][_0xa8dd('0x15')]===0x1f4){logger[_0xa8dd('0x14')](_0xa8dd('0xf'),_0x2b167c,_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);return _0x5246fb(_0x59fa60['error'][_0xa8dd('0x16')]);}logger[_0xa8dd('0x14')]('FreshdeskField,\x20%s,\x20%s',_0x2b167c,_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);return _0x89cf0e(_0x59fa60[_0xa8dd('0x14')][_0xa8dd('0x16')]);}else{logger['info'](_0xa8dd('0xf'),_0x2b167c,_0xa8dd('0x10'));_0x89cf0e(_0x59fa60[_0xa8dd('0x17')][_0xa8dd('0x16')]);}})[_0xa8dd('0x18')](function(_0x18feef){logger['error'](_0xa8dd('0xf'),_0x2b167c,_0x18feef);_0x5246fb(_0x18feef);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 7b6d6a7..fff1448 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 _0x5f69=['express','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy','multer','path'];(function(_0x823be0,_0x47c79d){var _0x4b5bd5=function(_0x4d316c){while(--_0x4d316c){_0x823be0['push'](_0x823be0['shift']());}};_0x4b5bd5(++_0x47c79d);}(_0x5f69,0xda));var _0x95f6=function(_0x274dd7,_0x2e6051){_0x274dd7=_0x274dd7-0x0;var _0x148829=_0x5f69[_0x274dd7];return _0x148829;};'use strict';var multer=require(_0x95f6('0x0'));var util=require('util');var path=require(_0x95f6('0x1'));var express=require(_0x95f6('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x95f6('0x3'));var config=require(_0x95f6('0x4'));var controller=require(_0x95f6('0x5'));router[_0x95f6('0x6')]('/',auth[_0x95f6('0x7')](),controller[_0x95f6('0x8')]);router[_0x95f6('0x6')](_0x95f6('0x9'),auth[_0x95f6('0x7')](),controller['show']);router[_0x95f6('0x6')](_0x95f6('0xa'),auth[_0x95f6('0x7')](),controller[_0x95f6('0xb')]);router[_0x95f6('0x6')](_0x95f6('0xc'),auth[_0x95f6('0x7')](),controller[_0x95f6('0xd')]);router['post']('/',auth[_0x95f6('0x7')](),controller[_0x95f6('0xe')]);router[_0x95f6('0xf')](_0x95f6('0xa'),auth[_0x95f6('0x7')](),controller[_0x95f6('0x10')]);router[_0x95f6('0x11')]('/:id',auth[_0x95f6('0x7')](),controller[_0x95f6('0x12')]);router['delete'](_0x95f6('0x9'),auth[_0x95f6('0x7')](),controller[_0x95f6('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb0b3=['../../components/auth/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','post','addConfiguration','put','update','delete','destroy','util','express','Router'];(function(_0xd8dd34,_0x308cbc){var _0x467266=function(_0x40d598){while(--_0x40d598){_0xd8dd34['push'](_0xd8dd34['shift']());}};_0x467266(++_0x308cbc);}(_0xb0b3,0x7b));var _0x3b0b=function(_0x29996e,_0x429c6a){_0x29996e=_0x29996e-0x0;var _0xe026a5=_0xb0b3[_0x29996e];return _0xe026a5;};'use strict';var multer=require('multer');var util=require(_0x3b0b('0x0'));var path=require('path');var express=require(_0x3b0b('0x1'));var router=express[_0x3b0b('0x2')]();var auth=require(_0x3b0b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x3b0b('0x4'));var controller=require(_0x3b0b('0x5'));router[_0x3b0b('0x6')]('/',auth['isAuthenticated'](),controller[_0x3b0b('0x7')]);router[_0x3b0b('0x6')](_0x3b0b('0x8'),auth['isAuthenticated'](),controller[_0x3b0b('0x9')]);router[_0x3b0b('0x6')](_0x3b0b('0xa'),auth[_0x3b0b('0xb')](),controller['getConfigurations']);router[_0x3b0b('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x3b0b('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3b0b('0xc')](_0x3b0b('0xa'),auth[_0x3b0b('0xb')](),controller[_0x3b0b('0xd')]);router[_0x3b0b('0xe')]('/:id',auth[_0x3b0b('0xb')](),controller[_0x3b0b('0xf')]);router[_0x3b0b('0x10')]('/:id',auth[_0x3b0b('0xb')](),controller[_0x3b0b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index bd7c31f..bb784ca 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 _0xf031=['newTab','integrationTab','sequelize','exports','STRING','username'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xf031,0x92));var _0x1f03=function(_0x3d2fe6,_0x2a181b){_0x3d2fe6=_0x3d2fe6-0x0;var _0x569e2f=_0xf031[_0x3d2fe6];return _0x569e2f;};'use strict';var Sequelize=require(_0x1f03('0x0'));module[_0x1f03('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f03('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1f03('0x3')},'remoteUri':{'type':Sequelize[_0x1f03('0x2')]},'password':{'type':Sequelize[_0x1f03('0x2')]},'clientId':{'type':Sequelize[_0x1f03('0x2')]},'clientSecret':{'type':Sequelize[_0x1f03('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1f03('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x1f03('0x4')),'defaultValue':_0x1f03('0x5')}}; \ No newline at end of file +var _0x9f2a=['ENUM','integrationTab','sequelize','STRING','username'];(function(_0x2df84d,_0x56d874){var _0x2634ce=function(_0x8e8e31){while(--_0x8e8e31){_0x2df84d['push'](_0x2df84d['shift']());}};_0x2634ce(++_0x56d874);}(_0x9f2a,0xc5));var _0xa9f2=function(_0x3518e1,_0x5b3c10){_0x3518e1=_0x3518e1-0x0;var _0x54e74a=_0x9f2a[_0x3518e1];return _0x54e74a;};'use strict';var Sequelize=require(_0xa9f2('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9f2('0x1')]},'description':{'type':Sequelize[_0xa9f2('0x1')]},'username':{'type':Sequelize[_0xa9f2('0x1')],'unique':_0xa9f2('0x2')},'remoteUri':{'type':Sequelize[_0xa9f2('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0xa9f2('0x1')]},'serverUrl':{'type':Sequelize[_0xa9f2('0x1')]},'type':{'type':Sequelize[_0xa9f2('0x3')](_0xa9f2('0x4'),'newTab'),'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 5665072..bfd7c04 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 _0x06b4=['../../config/utils','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','SalesforceAccount','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','add','day','merge','where','filter','include','findAll','rows','show','params','includeAll','options','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','map','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','SalesforceField','clientSecret','password','securityToken','remoteUri','clientId','concat','CallDisposition','CallDurationInSeconds','CallObject','CallType','Status','Type','remove','custom','includes','label','picklistValues','value','test','statusCode','getFields','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api'];(function(_0x4c71a5,_0x463757){var _0x573eb9=function(_0x4ee493){while(--_0x4ee493){_0x4c71a5['push'](_0x4c71a5['shift']());}};_0x573eb9(++_0x463757);}(_0x06b4,0x14a));var _0x406b=function(_0x2620bd,_0x22304a){_0x2620bd=_0x2620bd-0x0;var _0xd85ef5=_0x06b4[_0x2620bd];return _0xd85ef5;};'use strict';var jsonpatch=require(_0x406b('0x0'));var rp=require(_0x406b('0x1'));var moment=require(_0x406b('0x2'));var BPromise=require(_0x406b('0x3'));var Mustache=require('mustache');var util=require(_0x406b('0x4'));var path=require(_0x406b('0x5'));var sox=require('sox');var csv=require(_0x406b('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x406b('0x7'));var squel=require(_0x406b('0x8'));var crypto=require('crypto');var jsforce=require(_0x406b('0x9'));var deskjs=require(_0x406b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x406b('0xb'));var qs=require(_0x406b('0xc'));var logger=require(_0x406b('0xd'))(_0x406b('0xe'));var utils=require(_0x406b('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x406b('0x10'));var jayson=require(_0x406b('0x11'));var client=jayson[_0x406b('0x12')][_0x406b('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x3c02d6,_0xff150d,_0x16a2cc,_0x1e14a4){return new BPromise(function(_0x3513b9,_0x6c69bb){var _0x3490fb=_0x1e14a4||client;return _0x3490fb[_0x406b('0x14')](_0x3c02d6,_0x16a2cc)[_0x406b('0x15')](function(_0x1bd782){logger[_0x406b('0x16')](_0x406b('0x17'),_0xff150d,_0x406b('0x18'));logger[_0x406b('0x19')](_0x406b('0x1a'),_0xff150d,'request\x20sent',JSON[_0x406b('0x1b')](_0x1bd782));if(_0x1bd782[_0x406b('0x1c')]){if(_0x1bd782[_0x406b('0x1c')][_0x406b('0x1d')]===0x1f4){logger[_0x406b('0x1c')](_0x406b('0x17'),_0xff150d,_0x1bd782['error'][_0x406b('0x1e')]);return _0x6c69bb(_0x1bd782[_0x406b('0x1c')]['message']);}logger[_0x406b('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0xff150d,_0x1bd782[_0x406b('0x1c')]['message']);return _0x3513b9(_0x1bd782[_0x406b('0x1c')][_0x406b('0x1e')]);}else{logger[_0x406b('0x16')](_0x406b('0x17'),_0xff150d,_0x406b('0x18'));_0x3513b9(_0x1bd782[_0x406b('0x1f')][_0x406b('0x1e')]);}})[_0x406b('0x20')](function(_0x3255da){logger[_0x406b('0x1c')]('SalesforceAccount,\x20%s,\x20%s',_0xff150d,_0x3255da);_0x6c69bb(_0x3255da);});});}function respondWithStatusCode(_0x72ed9c,_0x58fcb2){_0x58fcb2=_0x58fcb2||0xcc;return function(_0x3951dc){if(_0x3951dc){return _0x72ed9c[_0x406b('0x21')](_0x58fcb2);}return _0x72ed9c['status'](_0x58fcb2)[_0x406b('0x22')]();};}function respondWithResult(_0x1165a7,_0x1d1b31){_0x1d1b31=_0x1d1b31||0xc8;return function(_0x47b497){if(_0x47b497){return _0x1165a7[_0x406b('0x23')](_0x1d1b31)[_0x406b('0x24')](_0x47b497);}};}function respondWithFilteredResult(_0x5ad409,_0x30abe8){return function(_0x160e57){if(_0x160e57){var _0x44aaa1=_0x160e57[_0x406b('0x25')],_0x154653=_0x30abe8['offset'],_0x20d856=_0x30abe8[_0x406b('0x26')]+_0x30abe8[_0x406b('0x27')],_0x207b5c;if(_0x20d856>=_0x44aaa1){_0x20d856=_0x44aaa1;_0x207b5c=0xc8;}else{_0x207b5c=0xce;}_0x5ad409['status'](_0x207b5c);return _0x5ad409[_0x406b('0x28')]('Content-Range',_0x154653+'-'+_0x20d856+'/'+_0x44aaa1)[_0x406b('0x24')](_0x160e57);}return null;};}function patchUpdates(_0x352dfa){return function(_0x5484c0){try{jsonpatch[_0x406b('0x29')](_0x5484c0,_0x352dfa,!![]);}catch(_0x48c6e1){return BPromise[_0x406b('0x2a')](_0x48c6e1);}return _0x5484c0[_0x406b('0x2b')]();};}function saveUpdates(_0x3504ba,_0x4a9d6d){return function(_0x374cf2){if(_0x374cf2){return _0x374cf2[_0x406b('0x2c')](_0x3504ba)[_0x406b('0x15')](function(_0x24a1be){return _0x24a1be;});}return null;};}function removeEntity(_0x28e605,_0x3ad2fb){return function(_0x5d56cf){if(_0x5d56cf){return _0x5d56cf[_0x406b('0x2d')]()[_0x406b('0x15')](function(){_0x28e605['status'](0xcc)[_0x406b('0x22')]();});}};}function handleEntityNotFound(_0x5b2907,_0x55f14f){return function(_0x4a48da){if(!_0x4a48da){_0x5b2907['sendStatus'](0x194);}return _0x4a48da;};}function handleError(_0x325b4c,_0x5a60a9){_0x5a60a9=_0x5a60a9||0x1f4;return function(_0x34ff4e){logger[_0x406b('0x1c')](_0x34ff4e[_0x406b('0x2e')]);if(_0x34ff4e[_0x406b('0x2f')]){delete _0x34ff4e['name'];}_0x325b4c[_0x406b('0x23')](_0x5a60a9)[_0x406b('0x30')](_0x34ff4e);};}exports[_0x406b('0x31')]=function(_0x21605e,_0x1752e5){var _0x4af1d1={},_0x1c88d7={},_0x12de42={'count':0x0,'rows':[]};var _0x397961=db[_0x406b('0x32')][_0x406b('0x33')];_0x1c88d7[_0x406b('0x34')]=_[_0x406b('0x35')](_0x397961);var _0x372a2c={'dateStart':_0x21605e[_0x406b('0x36')]['dateStart'],'dateEnd':_0x21605e[_0x406b('0x36')][_0x406b('0x37')]};delete _0x21605e[_0x406b('0x36')][_0x406b('0x38')];delete _0x21605e[_0x406b('0x36')][_0x406b('0x37')];_0x1c88d7['query']=_[_0x406b('0x35')](_0x21605e['query']);_0x1c88d7[_0x406b('0x39')]=_['intersection'](_0x1c88d7['model'],_0x1c88d7[_0x406b('0x36')]);_0x4af1d1[_0x406b('0x3a')]=_[_0x406b('0x3b')](_0x1c88d7[_0x406b('0x34')],qs[_0x406b('0x3c')](_0x21605e[_0x406b('0x36')][_0x406b('0x3c')]));_0x4af1d1[_0x406b('0x3a')]=_0x4af1d1['attributes'][_0x406b('0x3d')]?_0x4af1d1[_0x406b('0x3a')]:_0x1c88d7[_0x406b('0x34')];if(!_0x21605e[_0x406b('0x36')][_0x406b('0x3e')](_0x406b('0x3f'))){_0x4af1d1[_0x406b('0x27')]=qs['limit'](_0x21605e[_0x406b('0x36')]['limit']);_0x4af1d1[_0x406b('0x26')]=qs['offset'](_0x21605e['query'][_0x406b('0x26')]);}_0x4af1d1['order']=qs[_0x406b('0x40')](_0x21605e[_0x406b('0x36')][_0x406b('0x40')]);_0x4af1d1['where']=qs[_0x406b('0x39')](_[_0x406b('0x41')](_0x21605e['query'],_0x1c88d7['filters']));if(_0x372a2c[_0x406b('0x38')]){if(_0x372a2c[_0x406b('0x37')]){_0x372a2c[_0x406b('0x37')]=moment(_0x372a2c['dateEnd'])[_0x406b('0x42')](0x1,_0x406b('0x43'));}else{_0x372a2c['dateEnd']=moment(_0x372a2c[_0x406b('0x38')])[_0x406b('0x42')](0x1,_0x406b('0x43'));}_[_0x406b('0x44')](_0x4af1d1[_0x406b('0x45')],{'createdAt':{'$gte':_0x372a2c[_0x406b('0x38')],'$lte':_0x372a2c[_0x406b('0x37')]}});}if(_0x21605e[_0x406b('0x36')][_0x406b('0x46')]){_0x4af1d1[_0x406b('0x45')]=_[_0x406b('0x44')](_0x4af1d1[_0x406b('0x45')],{'$or':_['map'](_0x4af1d1[_0x406b('0x3a')],function(_0x5723c0){var _0x135475={};_0x135475[_0x5723c0]={'$like':'%'+_0x21605e[_0x406b('0x36')][_0x406b('0x46')]+'%'};return _0x135475;})});}_0x4af1d1=_[_0x406b('0x44')]({},_0x4af1d1,_0x21605e['options']);var _0x3b5698={'where':_0x4af1d1['where']};return db[_0x406b('0x32')][_0x406b('0x25')](_0x3b5698)[_0x406b('0x15')](function(_0x53fcd5){_0x12de42[_0x406b('0x25')]=_0x53fcd5;if(_0x21605e[_0x406b('0x36')]['includeAll']){_0x4af1d1[_0x406b('0x47')]=[{'all':!![]}];}return db[_0x406b('0x32')][_0x406b('0x48')](_0x4af1d1);})[_0x406b('0x15')](function(_0x4c9ab7){_0x12de42[_0x406b('0x49')]=_0x4c9ab7;return _0x12de42;})[_0x406b('0x15')](respondWithFilteredResult(_0x1752e5,_0x4af1d1))['catch'](handleError(_0x1752e5,null));};exports[_0x406b('0x4a')]=function(_0x405bcc,_0x312815){var _0x366a40={'raw':![],'where':{'id':_0x405bcc[_0x406b('0x4b')]['id']}},_0x435ffc={};_0x435ffc[_0x406b('0x34')]=_[_0x406b('0x35')](db[_0x406b('0x32')][_0x406b('0x33')]);_0x435ffc['query']=_[_0x406b('0x35')](_0x405bcc[_0x406b('0x36')]);_0x435ffc['filters']=_[_0x406b('0x3b')](_0x435ffc[_0x406b('0x34')],_0x435ffc[_0x406b('0x36')]);_0x366a40[_0x406b('0x3a')]=_[_0x406b('0x3b')](_0x435ffc[_0x406b('0x34')],qs[_0x406b('0x3c')](_0x405bcc['query'][_0x406b('0x3c')]));_0x366a40[_0x406b('0x3a')]=_0x366a40[_0x406b('0x3a')][_0x406b('0x3d')]?_0x366a40[_0x406b('0x3a')]:_0x435ffc['model'];if(_0x405bcc[_0x406b('0x36')][_0x406b('0x4c')]){_0x366a40[_0x406b('0x47')]=[{'all':!![]}];}_0x366a40=_[_0x406b('0x44')]({},_0x366a40,_0x405bcc[_0x406b('0x4d')]);return db['SalesforceAccount'][_0x406b('0x4e')](_0x366a40)[_0x406b('0x15')](handleEntityNotFound(_0x312815,null))[_0x406b('0x15')](respondWithResult(_0x312815,null))[_0x406b('0x20')](handleError(_0x312815,null));};exports[_0x406b('0x4f')]=function(_0x582539,_0x1263c0){return db[_0x406b('0x32')][_0x406b('0x4f')](_0x582539[_0x406b('0x50')],{})[_0x406b('0x15')](respondWithResult(_0x1263c0,0xc9))[_0x406b('0x20')](handleError(_0x1263c0,null));};exports['update']=function(_0x19833f,_0x2f8a79){if(_0x19833f[_0x406b('0x50')]['id']){delete _0x19833f[_0x406b('0x50')]['id'];}return db['SalesforceAccount'][_0x406b('0x4e')]({'where':{'id':_0x19833f[_0x406b('0x4b')]['id']}})[_0x406b('0x15')](handleEntityNotFound(_0x2f8a79,null))[_0x406b('0x15')](saveUpdates(_0x19833f[_0x406b('0x50')],null))['then'](respondWithResult(_0x2f8a79,null))[_0x406b('0x20')](handleError(_0x2f8a79,null));};exports[_0x406b('0x2d')]=function(_0x24784b,_0x1591fc){return db[_0x406b('0x32')][_0x406b('0x4e')]({'where':{'id':_0x24784b[_0x406b('0x4b')]['id']}})[_0x406b('0x15')](handleEntityNotFound(_0x1591fc,null))['then'](removeEntity(_0x1591fc,null))[_0x406b('0x20')](handleError(_0x1591fc,null));};exports[_0x406b('0x51')]=function(_0x464a54,_0x1f4235,_0x4e8f1c){var _0x5abfe8={};var _0x26c9b2={};var _0xa2184c;var _0x1708e7;return db[_0x406b('0x32')][_0x406b('0x52')]({'where':{'id':_0x464a54[_0x406b('0x4b')]['id']}})[_0x406b('0x15')](handleEntityNotFound(_0x1f4235,null))[_0x406b('0x15')](function(_0x4af403){if(_0x4af403){_0xa2184c=_0x4af403;_0x26c9b2[_0x406b('0x34')]=_[_0x406b('0x35')](db[_0x406b('0x53')]['rawAttributes']);_0x26c9b2[_0x406b('0x36')]=_['keys'](_0x464a54[_0x406b('0x36')]);_0x26c9b2[_0x406b('0x39')]=_[_0x406b('0x3b')](_0x26c9b2[_0x406b('0x34')],_0x26c9b2[_0x406b('0x36')]);_0x5abfe8[_0x406b('0x3a')]=_[_0x406b('0x3b')](_0x26c9b2['model'],qs[_0x406b('0x3c')](_0x464a54['query'][_0x406b('0x3c')]));_0x5abfe8[_0x406b('0x3a')]=_0x5abfe8['attributes'][_0x406b('0x3d')]?_0x5abfe8[_0x406b('0x3a')]:_0x26c9b2[_0x406b('0x34')];_0x5abfe8[_0x406b('0x54')]=qs[_0x406b('0x40')](_0x464a54[_0x406b('0x36')][_0x406b('0x40')]);_0x5abfe8[_0x406b('0x45')]=qs['filters'](_[_0x406b('0x41')](_0x464a54[_0x406b('0x36')],_0x26c9b2[_0x406b('0x39')]));if(_0x464a54[_0x406b('0x36')][_0x406b('0x46')]){_0x5abfe8[_0x406b('0x45')]=_['merge'](_0x5abfe8[_0x406b('0x45')],{'$or':_[_0x406b('0x55')](_0x5abfe8['attributes'],function(_0x382a39){var _0x2fc3={};_0x2fc3[_0x382a39]={'$like':'%'+_0x464a54[_0x406b('0x36')][_0x406b('0x46')]+'%'};return _0x2fc3;})});}_0x5abfe8=_['merge']({},_0x5abfe8,_0x464a54[_0x406b('0x4d')]);return _0xa2184c[_0x406b('0x51')](_0x5abfe8);}})['then'](function(_0x28e899){if(_0x28e899){_0x1708e7=_0x28e899[_0x406b('0x3d')];if(!_0x464a54[_0x406b('0x36')]['hasOwnProperty'](_0x406b('0x3f'))){_0x5abfe8[_0x406b('0x27')]=qs[_0x406b('0x27')](_0x464a54['query'][_0x406b('0x27')]);_0x5abfe8[_0x406b('0x26')]=qs[_0x406b('0x26')](_0x464a54[_0x406b('0x36')]['offset']);}return _0xa2184c['getConfigurations'](_0x5abfe8);}})[_0x406b('0x15')](function(_0x3f9684){if(_0x3f9684){return _0x3f9684?{'count':_0x1708e7,'rows':_0x3f9684}:null;}})[_0x406b('0x15')](respondWithResult(_0x1f4235,null))['catch'](handleError(_0x1f4235,null));};exports[_0x406b('0x56')]=function(_0x1d9494,_0x5e0ab2,_0x3f5bb8){if(_0x1d9494[_0x406b('0x50')]['id']){delete _0x1d9494['body']['id'];}return db['SalesforceAccount']['findOne']({'where':{'id':_0x1d9494[_0x406b('0x4b')]['id']}})[_0x406b('0x15')](handleEntityNotFound(_0x5e0ab2,null))[_0x406b('0x15')](function(_0x1ef064){if(_0x1ef064){_0x1d9494[_0x406b('0x50')][_0x406b('0x57')]=_0x1ef064['id'];_0x1d9494[_0x406b('0x50')][_0x406b('0x58')]=integrations[_0x406b('0x59')](_0x1d9494[_0x406b('0x50')][_0x406b('0x5a')],_0x1d9494[_0x406b('0x50')][_0x406b('0x5b')]);_0x1d9494['body'][_0x406b('0x5c')]=integrations['getDescriptions'](_0x1d9494[_0x406b('0x50')]['channel'],_0x1d9494[_0x406b('0x50')][_0x406b('0x5b')]);return db['SalesforceConfiguration']['create'](_0x1d9494[_0x406b('0x50')],{'include':[{'model':db[_0x406b('0x5d')],'as':_0x406b('0x58')},{'model':db[_0x406b('0x5d')],'as':_0x406b('0x5c')}]});}return null;})[_0x406b('0x15')](respondWithResult(_0x5e0ab2,null))[_0x406b('0x20')](handleError(_0x5e0ab2,null));};exports['getFields']=function(_0x5d0c92,_0x55d815,_0x697a0a){var _0x458cf5;return db[_0x406b('0x32')][_0x406b('0x52')]({'where':{'id':_0x5d0c92['params']['id']},'attributes':['id','remoteUri','clientId',_0x406b('0x5e'),'username',_0x406b('0x5f'),_0x406b('0x60')]})['then'](handleEntityNotFound(_0x55d815,null))[_0x406b('0x15')](function(_0x55a6b8){if(_0x55a6b8){_0x458cf5=new jsforce['Connection']({'oauth2':{'loginUrl':_0x55a6b8[_0x406b('0x61')],'clientId':_0x55a6b8[_0x406b('0x62')],'clientSecret':_0x55a6b8[_0x406b('0x5e')]}});return _0x458cf5['login'](_0x55a6b8['username'],_0x55a6b8[_0x406b('0x5f')][_0x406b('0x63')](_0x55a6b8['securityToken']));}})[_0x406b('0x15')](function(_0x4e1916){if(_0x4e1916){return _0x458cf5['sobject']('Task')['describe']();}})[_0x406b('0x15')](function(_0x1b1109){var _0xf8ad3a=[_0x406b('0x64'),_0x406b('0x65'),_0x406b('0x66'),_0x406b('0x67'),'IsArchived','Priority',_0x406b('0x68'),_0x406b('0x69')];if(_0x1b1109){_[_0x406b('0x6a')](_0x1b1109[_0x406b('0x3c')],function(_0x2cc876){return _0x2cc876[_0x406b('0x6b')]===![]&&!_0xf8ad3a[_0x406b('0x6c')](_0x2cc876[_0x406b('0x2f')]);});return{'count':_0x1b1109['fields'][_0x406b('0x3d')],'rows':_[_0x406b('0x55')](_0x1b1109[_0x406b('0x3c')],function(_0x1de3b5){return{'id':_0x1de3b5[_0x406b('0x2f')],'name':_0x1de3b5[_0x406b('0x6d')],'custom':_0x1de3b5[_0x406b('0x6b')],'options':_0x1de3b5[_0x406b('0x6e')]?_[_0x406b('0x55')](_0x1de3b5[_0x406b('0x6e')],function(_0x37298a){return{'name':_0x37298a['label'],'value':_0x37298a[_0x406b('0x6f')]};}):[]};})};}})[_0x406b('0x15')](respondWithResult(_0x55d815,null))[_0x406b('0x20')](function(_0x4d541d){var _0x540f57=_0x5d0c92[_0x406b('0x36')][_0x406b('0x70')]?0x1f4:_0x4d541d[_0x406b('0x71')]||0x1f4;logger[_0x406b('0x1c')]('getFields,\x20%s,\x20%s,\x20%s',_0x406b('0x72'),_0x540f57,JSON[_0x406b('0x1b')](_0x4d541d));delete _0x4d541d[_0x406b('0x2f')];if(_0x540f57===0x191){_0x540f57=0x190;}_0x55d815[_0x406b('0x23')](_0x540f57)[_0x406b('0x30')](_0x5d0c92[_0x406b('0x36')][_0x406b('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x4d541d[_0x406b('0x71')]}:_0x4d541d);});}; \ No newline at end of file +var _0xf28a=['intersection','fields','attributes','nolimit','order','pick','day','merge','where','map','options','include','findAll','rows','includeAll','create','update','body','find','params','destroy','findOne','SalesforceConfiguration','length','sort','filter','getConfigurations','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SalesforceField','remoteUri','clientSecret','password','securityToken','Connection','login','username','sobject','Task','describe','CallDisposition','CallObject','CallType','Priority','Status','Type','remove','custom','includes','picklistValues','label','value','test','getFields','stringify','statusCode','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','stack','name','send','SalesforceAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xf28a,0x1a1));var _0xaf28=function(_0x58aa35,_0x14d356){_0x58aa35=_0x58aa35-0x0;var _0x7066c8=_0xf28a[_0x58aa35];return _0x7066c8;};'use strict';var jsonpatch=require(_0xaf28('0x0'));var rp=require('request-promise');var moment=require(_0xaf28('0x1'));var BPromise=require(_0xaf28('0x2'));var Mustache=require(_0xaf28('0x3'));var util=require(_0xaf28('0x4'));var path=require(_0xaf28('0x5'));var sox=require(_0xaf28('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xaf28('0x7'));var squel=require(_0xaf28('0x8'));var crypto=require(_0xaf28('0x9'));var jsforce=require(_0xaf28('0xa'));var deskjs=require(_0xaf28('0xb'));var toCsv=require(_0xaf28('0xc'));var querystring=require(_0xaf28('0xd'));var Papa=require('papaparse');var qs=require(_0xaf28('0xe'));var logger=require(_0xaf28('0xf'))(_0xaf28('0x10'));var utils=require(_0xaf28('0x11'));var config=require(_0xaf28('0x12'));var db=require(_0xaf28('0x13'))['db'];var integrations=require(_0xaf28('0x14'));var jayson=require(_0xaf28('0x15'));var client=jayson[_0xaf28('0x16')][_0xaf28('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x3c60af,_0x5cdaf9,_0x28709d,_0x446e45){return new BPromise(function(_0x53e6d6,_0x4897c1){var _0x49607d=_0x446e45||client;return _0x49607d[_0xaf28('0x18')](_0x3c60af,_0x28709d)[_0xaf28('0x19')](function(_0x275c76){logger[_0xaf28('0x1a')](_0xaf28('0x1b'),_0x5cdaf9,'request\x20sent');logger[_0xaf28('0x1c')](_0xaf28('0x1d'),_0x5cdaf9,_0xaf28('0x1e'),JSON['stringify'](_0x275c76));if(_0x275c76[_0xaf28('0x1f')]){if(_0x275c76[_0xaf28('0x1f')][_0xaf28('0x20')]===0x1f4){logger[_0xaf28('0x1f')](_0xaf28('0x1b'),_0x5cdaf9,_0x275c76[_0xaf28('0x1f')][_0xaf28('0x21')]);return _0x4897c1(_0x275c76[_0xaf28('0x1f')][_0xaf28('0x21')]);}logger[_0xaf28('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x5cdaf9,_0x275c76['error']['message']);return _0x53e6d6(_0x275c76[_0xaf28('0x1f')]['message']);}else{logger[_0xaf28('0x1a')](_0xaf28('0x1b'),_0x5cdaf9,_0xaf28('0x1e'));_0x53e6d6(_0x275c76[_0xaf28('0x22')][_0xaf28('0x21')]);}})[_0xaf28('0x23')](function(_0x1cd52a){logger[_0xaf28('0x1f')]('SalesforceAccount,\x20%s,\x20%s',_0x5cdaf9,_0x1cd52a);_0x4897c1(_0x1cd52a);});});}function respondWithStatusCode(_0x11fbac,_0x28a330){_0x28a330=_0x28a330||0xcc;return function(_0x3dadf0){if(_0x3dadf0){return _0x11fbac[_0xaf28('0x24')](_0x28a330);}return _0x11fbac['status'](_0x28a330)[_0xaf28('0x25')]();};}function respondWithResult(_0x1b8470,_0x677258){_0x677258=_0x677258||0xc8;return function(_0x5d7556){if(_0x5d7556){return _0x1b8470[_0xaf28('0x26')](_0x677258)[_0xaf28('0x27')](_0x5d7556);}};}function respondWithFilteredResult(_0x54705a,_0x25e35d){return function(_0x16cd9d){if(_0x16cd9d){var _0x285c97=_0x16cd9d[_0xaf28('0x28')],_0x4efd62=_0x25e35d[_0xaf28('0x29')],_0x5f3b32=_0x25e35d['offset']+_0x25e35d[_0xaf28('0x2a')],_0xd308;if(_0x5f3b32>=_0x285c97){_0x5f3b32=_0x285c97;_0xd308=0xc8;}else{_0xd308=0xce;}_0x54705a['status'](_0xd308);return _0x54705a[_0xaf28('0x2b')](_0xaf28('0x2c'),_0x4efd62+'-'+_0x5f3b32+'/'+_0x285c97)[_0xaf28('0x27')](_0x16cd9d);}return null;};}function patchUpdates(_0x1ed9fb){return function(_0x466ba0){try{jsonpatch[_0xaf28('0x2d')](_0x466ba0,_0x1ed9fb,!![]);}catch(_0x4132c6){return BPromise[_0xaf28('0x2e')](_0x4132c6);}return _0x466ba0[_0xaf28('0x2f')]();};}function saveUpdates(_0x529ff1,_0x7c242c){return function(_0x5a69a4){if(_0x5a69a4){return _0x5a69a4['update'](_0x529ff1)[_0xaf28('0x19')](function(_0x34f3bf){return _0x34f3bf;});}return null;};}function removeEntity(_0x4f3d92,_0xeb34f9){return function(_0x59d99b){if(_0x59d99b){return _0x59d99b['destroy']()[_0xaf28('0x19')](function(){_0x4f3d92[_0xaf28('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c9409,_0x4d0206){return function(_0x4aa562){if(!_0x4aa562){_0x4c9409['sendStatus'](0x194);}return _0x4aa562;};}function handleError(_0x1091c0,_0x1a237d){_0x1a237d=_0x1a237d||0x1f4;return function(_0x5c880){logger[_0xaf28('0x1f')](_0x5c880[_0xaf28('0x30')]);if(_0x5c880[_0xaf28('0x31')]){delete _0x5c880[_0xaf28('0x31')];}_0x1091c0[_0xaf28('0x26')](_0x1a237d)[_0xaf28('0x32')](_0x5c880);};}exports['index']=function(_0x3948b8,_0x331ab7){var _0x35fa7a={},_0x1d38e4={},_0x75cdcb={'count':0x0,'rows':[]};var _0x352f20=db[_0xaf28('0x33')][_0xaf28('0x34')];_0x1d38e4[_0xaf28('0x35')]=_[_0xaf28('0x36')](_0x352f20);var _0x8b137c={'dateStart':_0x3948b8[_0xaf28('0x37')][_0xaf28('0x38')],'dateEnd':_0x3948b8[_0xaf28('0x37')]['dateEnd']};delete _0x3948b8[_0xaf28('0x37')]['dateStart'];delete _0x3948b8[_0xaf28('0x37')][_0xaf28('0x39')];_0x1d38e4[_0xaf28('0x37')]=_['keys'](_0x3948b8[_0xaf28('0x37')]);_0x1d38e4[_0xaf28('0x3a')]=_[_0xaf28('0x3b')](_0x1d38e4[_0xaf28('0x35')],_0x1d38e4[_0xaf28('0x37')]);_0x35fa7a['attributes']=_[_0xaf28('0x3b')](_0x1d38e4[_0xaf28('0x35')],qs['fields'](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x3c')]));_0x35fa7a[_0xaf28('0x3d')]=_0x35fa7a['attributes']['length']?_0x35fa7a['attributes']:_0x1d38e4['model'];if(!_0x3948b8[_0xaf28('0x37')]['hasOwnProperty'](_0xaf28('0x3e'))){_0x35fa7a[_0xaf28('0x2a')]=qs[_0xaf28('0x2a')](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x2a')]);_0x35fa7a['offset']=qs[_0xaf28('0x29')](_0x3948b8[_0xaf28('0x37')][_0xaf28('0x29')]);}_0x35fa7a[_0xaf28('0x3f')]=qs['sort'](_0x3948b8[_0xaf28('0x37')]['sort']);_0x35fa7a['where']=qs[_0xaf28('0x3a')](_[_0xaf28('0x40')](_0x3948b8['query'],_0x1d38e4[_0xaf28('0x3a')]));if(_0x8b137c[_0xaf28('0x38')]){if(_0x8b137c[_0xaf28('0x39')]){_0x8b137c[_0xaf28('0x39')]=moment(_0x8b137c[_0xaf28('0x39')])['add'](0x1,_0xaf28('0x41'));}else{_0x8b137c[_0xaf28('0x39')]=moment(_0x8b137c[_0xaf28('0x38')])['add'](0x1,_0xaf28('0x41'));}_[_0xaf28('0x42')](_0x35fa7a['where'],{'createdAt':{'$gte':_0x8b137c[_0xaf28('0x38')],'$lte':_0x8b137c[_0xaf28('0x39')]}});}if(_0x3948b8['query']['filter']){_0x35fa7a[_0xaf28('0x43')]=_['merge'](_0x35fa7a['where'],{'$or':_[_0xaf28('0x44')](_0x35fa7a[_0xaf28('0x3d')],function(_0x586d24){var _0x35f1cd={};_0x35f1cd[_0x586d24]={'$like':'%'+_0x3948b8[_0xaf28('0x37')]['filter']+'%'};return _0x35f1cd;})});}_0x35fa7a=_['merge']({},_0x35fa7a,_0x3948b8[_0xaf28('0x45')]);var _0x59d573={'where':_0x35fa7a['where']};return db[_0xaf28('0x33')][_0xaf28('0x28')](_0x59d573)[_0xaf28('0x19')](function(_0x13675a){_0x75cdcb[_0xaf28('0x28')]=_0x13675a;if(_0x3948b8[_0xaf28('0x37')]['includeAll']){_0x35fa7a[_0xaf28('0x46')]=[{'all':!![]}];}return db[_0xaf28('0x33')][_0xaf28('0x47')](_0x35fa7a);})[_0xaf28('0x19')](function(_0x1b06a9){_0x75cdcb[_0xaf28('0x48')]=_0x1b06a9;return _0x75cdcb;})[_0xaf28('0x19')](respondWithFilteredResult(_0x331ab7,_0x35fa7a))[_0xaf28('0x23')](handleError(_0x331ab7,null));};exports['show']=function(_0x522f19,_0x45f307){var _0x34dcd3={'raw':![],'where':{'id':_0x522f19['params']['id']}},_0x230ac2={};_0x230ac2[_0xaf28('0x35')]=_[_0xaf28('0x36')](db[_0xaf28('0x33')][_0xaf28('0x34')]);_0x230ac2[_0xaf28('0x37')]=_[_0xaf28('0x36')](_0x522f19[_0xaf28('0x37')]);_0x230ac2['filters']=_[_0xaf28('0x3b')](_0x230ac2[_0xaf28('0x35')],_0x230ac2[_0xaf28('0x37')]);_0x34dcd3['attributes']=_[_0xaf28('0x3b')](_0x230ac2[_0xaf28('0x35')],qs[_0xaf28('0x3c')](_0x522f19[_0xaf28('0x37')][_0xaf28('0x3c')]));_0x34dcd3['attributes']=_0x34dcd3[_0xaf28('0x3d')]['length']?_0x34dcd3['attributes']:_0x230ac2[_0xaf28('0x35')];if(_0x522f19['query'][_0xaf28('0x49')]){_0x34dcd3['include']=[{'all':!![]}];}_0x34dcd3=_[_0xaf28('0x42')]({},_0x34dcd3,_0x522f19[_0xaf28('0x45')]);return db[_0xaf28('0x33')]['find'](_0x34dcd3)['then'](handleEntityNotFound(_0x45f307,null))[_0xaf28('0x19')](respondWithResult(_0x45f307,null))[_0xaf28('0x23')](handleError(_0x45f307,null));};exports[_0xaf28('0x4a')]=function(_0x1450d5,_0x5333ad){return db['SalesforceAccount'][_0xaf28('0x4a')](_0x1450d5['body'],{})[_0xaf28('0x19')](respondWithResult(_0x5333ad,0xc9))[_0xaf28('0x23')](handleError(_0x5333ad,null));};exports[_0xaf28('0x4b')]=function(_0x53b2fb,_0x2b8172){if(_0x53b2fb['body']['id']){delete _0x53b2fb[_0xaf28('0x4c')]['id'];}return db[_0xaf28('0x33')][_0xaf28('0x4d')]({'where':{'id':_0x53b2fb[_0xaf28('0x4e')]['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x2b8172,null))[_0xaf28('0x19')](saveUpdates(_0x53b2fb[_0xaf28('0x4c')],null))['then'](respondWithResult(_0x2b8172,null))['catch'](handleError(_0x2b8172,null));};exports[_0xaf28('0x4f')]=function(_0x234012,_0x2ac183){return db[_0xaf28('0x33')][_0xaf28('0x4d')]({'where':{'id':_0x234012['params']['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x2ac183,null))[_0xaf28('0x19')](removeEntity(_0x2ac183,null))[_0xaf28('0x23')](handleError(_0x2ac183,null));};exports['getConfigurations']=function(_0x4c1a9c,_0x13793f,_0x327b27){var _0x47178e={};var _0x12675f={};var _0x151ca3;var _0x4bae33;return db['SalesforceAccount'][_0xaf28('0x50')]({'where':{'id':_0x4c1a9c[_0xaf28('0x4e')]['id']}})['then'](handleEntityNotFound(_0x13793f,null))['then'](function(_0x2262aa){if(_0x2262aa){_0x151ca3=_0x2262aa;_0x12675f[_0xaf28('0x35')]=_[_0xaf28('0x36')](db[_0xaf28('0x51')][_0xaf28('0x34')]);_0x12675f[_0xaf28('0x37')]=_['keys'](_0x4c1a9c[_0xaf28('0x37')]);_0x12675f[_0xaf28('0x3a')]=_[_0xaf28('0x3b')](_0x12675f[_0xaf28('0x35')],_0x12675f['query']);_0x47178e[_0xaf28('0x3d')]=_[_0xaf28('0x3b')](_0x12675f[_0xaf28('0x35')],qs['fields'](_0x4c1a9c['query'][_0xaf28('0x3c')]));_0x47178e[_0xaf28('0x3d')]=_0x47178e[_0xaf28('0x3d')][_0xaf28('0x52')]?_0x47178e[_0xaf28('0x3d')]:_0x12675f[_0xaf28('0x35')];_0x47178e['order']=qs[_0xaf28('0x53')](_0x4c1a9c['query'][_0xaf28('0x53')]);_0x47178e[_0xaf28('0x43')]=qs['filters'](_[_0xaf28('0x40')](_0x4c1a9c['query'],_0x12675f['filters']));if(_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x54')]){_0x47178e[_0xaf28('0x43')]=_[_0xaf28('0x42')](_0x47178e[_0xaf28('0x43')],{'$or':_[_0xaf28('0x44')](_0x47178e[_0xaf28('0x3d')],function(_0x50e876){var _0x296c2d={};_0x296c2d[_0x50e876]={'$like':'%'+_0x4c1a9c[_0xaf28('0x37')]['filter']+'%'};return _0x296c2d;})});}_0x47178e=_[_0xaf28('0x42')]({},_0x47178e,_0x4c1a9c[_0xaf28('0x45')]);return _0x151ca3[_0xaf28('0x55')](_0x47178e);}})[_0xaf28('0x19')](function(_0x423eb6){if(_0x423eb6){_0x4bae33=_0x423eb6['length'];if(!_0x4c1a9c[_0xaf28('0x37')]['hasOwnProperty'](_0xaf28('0x3e'))){_0x47178e[_0xaf28('0x2a')]=qs['limit'](_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x2a')]);_0x47178e[_0xaf28('0x29')]=qs[_0xaf28('0x29')](_0x4c1a9c[_0xaf28('0x37')][_0xaf28('0x29')]);}return _0x151ca3[_0xaf28('0x55')](_0x47178e);}})[_0xaf28('0x19')](function(_0x4c9690){if(_0x4c9690){return _0x4c9690?{'count':_0x4bae33,'rows':_0x4c9690}:null;}})['then'](respondWithResult(_0x13793f,null))[_0xaf28('0x23')](handleError(_0x13793f,null));};exports['addConfiguration']=function(_0x1211f3,_0x21ea56,_0x2835b0){if(_0x1211f3[_0xaf28('0x4c')]['id']){delete _0x1211f3[_0xaf28('0x4c')]['id'];}return db['SalesforceAccount'][_0xaf28('0x50')]({'where':{'id':_0x1211f3[_0xaf28('0x4e')]['id']}})[_0xaf28('0x19')](handleEntityNotFound(_0x21ea56,null))[_0xaf28('0x19')](function(_0x36f672){if(_0x36f672){_0x1211f3[_0xaf28('0x4c')]['AccountId']=_0x36f672['id'];_0x1211f3[_0xaf28('0x4c')][_0xaf28('0x56')]=integrations[_0xaf28('0x57')](_0x1211f3['body'][_0xaf28('0x58')],_0x1211f3[_0xaf28('0x4c')][_0xaf28('0x59')]);_0x1211f3['body'][_0xaf28('0x5a')]=integrations[_0xaf28('0x5b')](_0x1211f3['body'][_0xaf28('0x58')],_0x1211f3['body']['type']);return db[_0xaf28('0x51')][_0xaf28('0x4a')](_0x1211f3[_0xaf28('0x4c')],{'include':[{'model':db[_0xaf28('0x5c')],'as':_0xaf28('0x56')},{'model':db[_0xaf28('0x5c')],'as':_0xaf28('0x5a')}]});}return null;})[_0xaf28('0x19')](respondWithResult(_0x21ea56,null))[_0xaf28('0x23')](handleError(_0x21ea56,null));};exports['getFields']=function(_0x10ca1c,_0x1677ef,_0x1efcfa){var _0x164eaf;return db[_0xaf28('0x33')]['findOne']({'where':{'id':_0x10ca1c[_0xaf28('0x4e')]['id']},'attributes':['id',_0xaf28('0x5d'),'clientId',_0xaf28('0x5e'),'username',_0xaf28('0x5f'),_0xaf28('0x60')]})['then'](handleEntityNotFound(_0x1677ef,null))['then'](function(_0x46cce2){if(_0x46cce2){_0x164eaf=new jsforce[(_0xaf28('0x61'))]({'oauth2':{'loginUrl':_0x46cce2['remoteUri'],'clientId':_0x46cce2['clientId'],'clientSecret':_0x46cce2[_0xaf28('0x5e')]}});return _0x164eaf[_0xaf28('0x62')](_0x46cce2[_0xaf28('0x63')],_0x46cce2['password']['concat'](_0x46cce2['securityToken']));}})[_0xaf28('0x19')](function(_0x44274c){if(_0x44274c){return _0x164eaf[_0xaf28('0x64')](_0xaf28('0x65'))[_0xaf28('0x66')]();}})[_0xaf28('0x19')](function(_0x485e11){var _0x33b883=[_0xaf28('0x67'),'CallDurationInSeconds',_0xaf28('0x68'),_0xaf28('0x69'),'IsArchived',_0xaf28('0x6a'),_0xaf28('0x6b'),_0xaf28('0x6c')];if(_0x485e11){_[_0xaf28('0x6d')](_0x485e11[_0xaf28('0x3c')],function(_0x132505){return _0x132505[_0xaf28('0x6e')]===![]&&!_0x33b883[_0xaf28('0x6f')](_0x132505[_0xaf28('0x31')]);});return{'count':_0x485e11[_0xaf28('0x3c')][_0xaf28('0x52')],'rows':_[_0xaf28('0x44')](_0x485e11[_0xaf28('0x3c')],function(_0x192270){return{'id':_0x192270[_0xaf28('0x31')],'name':_0x192270['label'],'custom':_0x192270[_0xaf28('0x6e')],'options':_0x192270['picklistValues']?_['map'](_0x192270[_0xaf28('0x70')],function(_0xbfe72e){return{'name':_0xbfe72e[_0xaf28('0x71')],'value':_0xbfe72e[_0xaf28('0x72')]};}):[]};})};}})[_0xaf28('0x19')](respondWithResult(_0x1677ef,null))[_0xaf28('0x23')](function(_0x1f037e){var _0x2e3918=_0x10ca1c['query'][_0xaf28('0x73')]?0x1f4:_0x1f037e['statusCode']||0x1f4;logger[_0xaf28('0x1f')]('getFields,\x20%s,\x20%s,\x20%s',_0xaf28('0x74'),_0x2e3918,JSON[_0xaf28('0x75')](_0x1f037e));delete _0x1f037e[_0xaf28('0x31')];if(_0x2e3918===0x191){_0x2e3918=0x190;}_0x1677ef[_0xaf28('0x26')](_0x2e3918)['send'](_0x10ca1c[_0xaf28('0x37')][_0xaf28('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f037e[_0xaf28('0x76')]}:_0x1f037e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fecb3f5..33fc7b0 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 _0xc271=['lodash','api','moment','bluebird','request-promise','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc271,0xf0));var _0x1c27=function(_0x5a40b1,_0x1b0589){_0x5a40b1=_0x5a40b1-0x0;var _0x42c19f=_0xc271[_0x5a40b1];return _0x42c19f;};'use strict';var _=require(_0x1c27('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1c27('0x1'));var moment=require(_0x1c27('0x2'));var BPromise=require(_0x1c27('0x3'));var rp=require(_0x1c27('0x4'));var attributes=require(_0x1c27('0x5'));var integrations=require(_0x1c27('0x6'));module['exports']=function(_0x141af4,_0x43c7ec){return _0x141af4[_0x1c27('0x7')](_0x1c27('0x8'),attributes,{'tableName':_0x1c27('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd380=['bluebird','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','util','moment'];(function(_0x29d21a,_0x184b5f){var _0x18b135=function(_0x2fdee1){while(--_0x2fdee1){_0x29d21a['push'](_0x29d21a['shift']());}};_0x18b135(++_0x184b5f);}(_0xd380,0x13e));var _0x0d38=function(_0x4446bc,_0x29eb08){_0x4446bc=_0x4446bc-0x0;var _0x4c53a2=_0xd380[_0x4446bc];return _0x4c53a2;};'use strict';var _=require('lodash');var util=require(_0x0d38('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0d38('0x1'));var BPromise=require(_0x0d38('0x2'));var rp=require('request-promise');var attributes=require(_0x0d38('0x3'));var integrations=require(_0x0d38('0x4'));module[_0x0d38('0x5')]=function(_0x114bb7,_0x35e0e4){return _0x114bb7[_0x0d38('0x6')](_0x0d38('0x7'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 3ec5da3..9c8be7e 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 _0x7045=['error','code','message','info','result','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowSalesforceAccount','SalesforceAccount','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32e7d6,_0x682bc5){var _0x5427cf=function(_0x365c2d){while(--_0x365c2d){_0x32e7d6['push'](_0x32e7d6['shift']());}};_0x5427cf(++_0x682bc5);}(_0x7045,0x144));var _0x5704=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7045[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5704('0x0'));var BPromise=require('bluebird');var rs=require(_0x5704('0x1'));var fs=require('fs');var db=require(_0x5704('0x2'))['db'];var utils=require(_0x5704('0x3'));var logger=require(_0x5704('0x4'))(_0x5704('0x5'));var config=require(_0x5704('0x6'));var jayson=require(_0x5704('0x7'));var client=jayson['client'][_0x5704('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34e9bf,_0x22881f,_0x3e8354){return new BPromise(function(_0x3dd946,_0x383b32){return client[_0x5704('0x9')](_0x34e9bf,_0x3e8354)[_0x5704('0xa')](function(_0x3b4764){logger['info'](_0x5704('0xb'),_0x22881f,_0x5704('0xc'));logger[_0x5704('0xd')](_0x5704('0xe'),_0x22881f,_0x5704('0xc'),JSON[_0x5704('0xf')](_0x3b4764));if(_0x3b4764[_0x5704('0x10')]){if(_0x3b4764[_0x5704('0x10')][_0x5704('0x11')]===0x1f4){logger[_0x5704('0x10')](_0x5704('0xb'),_0x22881f,_0x3b4764[_0x5704('0x10')][_0x5704('0x12')]);return _0x383b32(_0x3b4764['error'][_0x5704('0x12')]);}logger[_0x5704('0x10')](_0x5704('0xb'),_0x22881f,_0x3b4764[_0x5704('0x10')][_0x5704('0x12')]);return _0x3dd946(_0x3b4764['error'][_0x5704('0x12')]);}else{logger[_0x5704('0x13')](_0x5704('0xb'),_0x22881f,_0x5704('0xc'));_0x3dd946(_0x3b4764[_0x5704('0x14')]['message']);}})['catch'](function(_0x399647){logger[_0x5704('0x10')](_0x5704('0xb'),_0x22881f,_0x399647);_0x383b32(_0x399647);});});}exports[_0x5704('0x15')]=function(_0x374d78){var _0x4c030c=this;return new Promise(function(_0x17d89a,_0x5e1b08){return db['SalesforceAccount'][_0x5704('0x16')]({'raw':_0x374d78[_0x5704('0x17')]?_0x374d78[_0x5704('0x17')][_0x5704('0x18')]===undefined?!![]:![]:!![],'where':_0x374d78[_0x5704('0x17')]?_0x374d78[_0x5704('0x17')][_0x5704('0x19')]||null:null,'attributes':_0x374d78[_0x5704('0x17')]?_0x374d78['options'][_0x5704('0x1a')]||null:null,'limit':_0x374d78['options']?_0x374d78[_0x5704('0x17')][_0x5704('0x1b')]||null:null,'include':_0x374d78[_0x5704('0x17')]?_0x374d78[_0x5704('0x17')][_0x5704('0x1c')]?_[_0x5704('0x1d')](_0x374d78[_0x5704('0x17')][_0x5704('0x1c')],function(_0xbf0041){return{'model':db[_0xbf0041[_0x5704('0x1e')]],'as':_0xbf0041['as'],'attributes':_0xbf0041[_0x5704('0x1a')],'include':_0xbf0041['include']?_['map'](_0xbf0041[_0x5704('0x1c')],function(_0x558aae){return{'model':db[_0x558aae[_0x5704('0x1e')]],'as':_0x558aae['as'],'attributes':_0x558aae[_0x5704('0x1a')],'include':_0x558aae['include']?_[_0x5704('0x1d')](_0x558aae[_0x5704('0x1c')],function(_0x55a419){return{'model':db[_0x55a419['model']],'as':_0x55a419['as'],'attributes':_0x55a419[_0x5704('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5704('0xa')](function(_0x569424){logger[_0x5704('0x13')](_0x5704('0x15'),_0x374d78);logger['debug'](_0x5704('0x15'),_0x374d78,JSON['stringify'](_0x569424));_0x17d89a(_0x569424);})['catch'](function(_0x1cfa76){logger[_0x5704('0x10')](_0x5704('0x15'),_0x1cfa76['message'],_0x374d78);_0x5e1b08(_0x4c030c['error'](0x1f4,_0x1cfa76['message']));});});};exports[_0x5704('0x1f')]=function(_0x1d4acd){var _0x5f34bb=this;return new Promise(function(_0x260a2e,_0x366adc){return db[_0x5704('0x20')]['find']({'raw':_0x1d4acd[_0x5704('0x17')]?_0x1d4acd[_0x5704('0x17')][_0x5704('0x18')]===undefined?!![]:![]:!![],'where':_0x1d4acd[_0x5704('0x17')]?_0x1d4acd[_0x5704('0x17')][_0x5704('0x19')]||null:null,'attributes':_0x1d4acd['options']?_0x1d4acd['options'][_0x5704('0x1a')]||null:null,'include':_0x1d4acd[_0x5704('0x17')]?_0x1d4acd['options'][_0x5704('0x1c')]?_[_0x5704('0x1d')](_0x1d4acd['options']['include'],function(_0x123650){return{'model':db[_0x123650[_0x5704('0x1e')]],'as':_0x123650['as'],'attributes':_0x123650[_0x5704('0x1a')],'include':_0x123650[_0x5704('0x1c')]?_[_0x5704('0x1d')](_0x123650[_0x5704('0x1c')],function(_0xfadc44){return{'model':db[_0xfadc44[_0x5704('0x1e')]],'as':_0xfadc44['as'],'attributes':_0xfadc44[_0x5704('0x1a')],'include':_0xfadc44[_0x5704('0x1c')]?_['map'](_0xfadc44[_0x5704('0x1c')],function(_0x10958c){return{'model':db[_0x10958c[_0x5704('0x1e')]],'as':_0x10958c['as'],'attributes':_0x10958c[_0x5704('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5704('0xa')](function(_0xe2b405){logger['info'](_0x5704('0x1f'),_0x1d4acd);logger[_0x5704('0xd')]('ShowSalesforceAccount',_0x1d4acd,JSON[_0x5704('0xf')](_0xe2b405));_0x260a2e(_0xe2b405);})[_0x5704('0x21')](function(_0x493a96){logger[_0x5704('0x10')](_0x5704('0x1f'),_0x493a96[_0x5704('0x12')],_0x1d4acd);_0x366adc(_0x5f34bb[_0x5704('0x10')](0x1f4,_0x493a96[_0x5704('0x12')]));});});}; \ No newline at end of file +var _0x5ca0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','attributes','limit','include','map','model','then','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird'];(function(_0x2e05dd,_0x327206){var _0x5798d6=function(_0x5e4ae6){while(--_0x5e4ae6){_0x2e05dd['push'](_0x2e05dd['shift']());}};_0x5798d6(++_0x327206);}(_0x5ca0,0x12e));var _0x05ca=function(_0x1d6fa0,_0x2be621){_0x1d6fa0=_0x1d6fa0-0x0;var _0x195c93=_0x5ca0[_0x1d6fa0];return _0x195c93;};'use strict';var _=require(_0x05ca('0x0'));var util=require(_0x05ca('0x1'));var moment=require(_0x05ca('0x2'));var BPromise=require(_0x05ca('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x05ca('0x4'));var logger=require(_0x05ca('0x5'))(_0x05ca('0x6'));var config=require(_0x05ca('0x7'));var jayson=require(_0x05ca('0x8'));var client=jayson[_0x05ca('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c226f,_0x208e73,_0x411ccc){return new BPromise(function(_0x518451,_0x2ace84){return client['request'](_0x3c226f,_0x411ccc)['then'](function(_0xf80079){logger[_0x05ca('0xa')](_0x05ca('0xb'),_0x208e73,_0x05ca('0xc'));logger[_0x05ca('0xd')](_0x05ca('0xe'),_0x208e73,_0x05ca('0xc'),JSON[_0x05ca('0xf')](_0xf80079));if(_0xf80079[_0x05ca('0x10')]){if(_0xf80079[_0x05ca('0x10')][_0x05ca('0x11')]===0x1f4){logger[_0x05ca('0x10')](_0x05ca('0xb'),_0x208e73,_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);return _0x2ace84(_0xf80079[_0x05ca('0x10')]['message']);}logger['error'](_0x05ca('0xb'),_0x208e73,_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);return _0x518451(_0xf80079[_0x05ca('0x10')][_0x05ca('0x12')]);}else{logger[_0x05ca('0xa')](_0x05ca('0xb'),_0x208e73,_0x05ca('0xc'));_0x518451(_0xf80079[_0x05ca('0x13')][_0x05ca('0x12')]);}})[_0x05ca('0x14')](function(_0x30fd04){logger[_0x05ca('0x10')](_0x05ca('0xb'),_0x208e73,_0x30fd04);_0x2ace84(_0x30fd04);});});}exports[_0x05ca('0x15')]=function(_0x2775ea){var _0x37511f=this;return new Promise(function(_0x294195,_0x37344b){return db[_0x05ca('0x16')]['findAll']({'raw':_0x2775ea['options']?_0x2775ea[_0x05ca('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2775ea[_0x05ca('0x17')]?_0x2775ea[_0x05ca('0x17')][_0x05ca('0x18')]||null:null,'attributes':_0x2775ea[_0x05ca('0x17')]?_0x2775ea[_0x05ca('0x17')][_0x05ca('0x19')]||null:null,'limit':_0x2775ea[_0x05ca('0x17')]?_0x2775ea['options'][_0x05ca('0x1a')]||null:null,'include':_0x2775ea[_0x05ca('0x17')]?_0x2775ea['options'][_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x2775ea['options']['include'],function(_0x492fbd){return{'model':db[_0x492fbd[_0x05ca('0x1d')]],'as':_0x492fbd['as'],'attributes':_0x492fbd[_0x05ca('0x19')],'include':_0x492fbd[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x492fbd[_0x05ca('0x1b')],function(_0x6a22a8){return{'model':db[_0x6a22a8[_0x05ca('0x1d')]],'as':_0x6a22a8['as'],'attributes':_0x6a22a8[_0x05ca('0x19')],'include':_0x6a22a8[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x6a22a8['include'],function(_0x457392){return{'model':db[_0x457392[_0x05ca('0x1d')]],'as':_0x457392['as'],'attributes':_0x457392[_0x05ca('0x19')]};}):[]};}):[]};}):[]:[]})[_0x05ca('0x1e')](function(_0x29867f){logger[_0x05ca('0xa')]('GetSalesforceAccount',_0x2775ea);logger[_0x05ca('0xd')](_0x05ca('0x15'),_0x2775ea,JSON[_0x05ca('0xf')](_0x29867f));_0x294195(_0x29867f);})[_0x05ca('0x14')](function(_0x29f307){logger[_0x05ca('0x10')](_0x05ca('0x15'),_0x29f307[_0x05ca('0x12')],_0x2775ea);_0x37344b(_0x37511f[_0x05ca('0x10')](0x1f4,_0x29f307[_0x05ca('0x12')]));});});};exports[_0x05ca('0x1f')]=function(_0x2679fb){var _0x4710d0=this;return new Promise(function(_0x43d3dd,_0x304762){return db[_0x05ca('0x16')][_0x05ca('0x20')]({'raw':_0x2679fb[_0x05ca('0x17')]?_0x2679fb['options'][_0x05ca('0x21')]===undefined?!![]:![]:!![],'where':_0x2679fb[_0x05ca('0x17')]?_0x2679fb['options']['where']||null:null,'attributes':_0x2679fb['options']?_0x2679fb[_0x05ca('0x17')][_0x05ca('0x19')]||null:null,'include':_0x2679fb[_0x05ca('0x17')]?_0x2679fb[_0x05ca('0x17')][_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x2679fb[_0x05ca('0x17')][_0x05ca('0x1b')],function(_0x30cf7b){return{'model':db[_0x30cf7b[_0x05ca('0x1d')]],'as':_0x30cf7b['as'],'attributes':_0x30cf7b['attributes'],'include':_0x30cf7b[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x30cf7b[_0x05ca('0x1b')],function(_0x26df59){return{'model':db[_0x26df59[_0x05ca('0x1d')]],'as':_0x26df59['as'],'attributes':_0x26df59[_0x05ca('0x19')],'include':_0x26df59[_0x05ca('0x1b')]?_[_0x05ca('0x1c')](_0x26df59[_0x05ca('0x1b')],function(_0xa4415d){return{'model':db[_0xa4415d[_0x05ca('0x1d')]],'as':_0xa4415d['as'],'attributes':_0xa4415d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x59f9aa){logger[_0x05ca('0xa')](_0x05ca('0x1f'),_0x2679fb);logger['debug'](_0x05ca('0x1f'),_0x2679fb,JSON['stringify'](_0x59f9aa));_0x43d3dd(_0x59f9aa);})[_0x05ca('0x14')](function(_0x141295){logger['error'](_0x05ca('0x1f'),_0x141295[_0x05ca('0x12')],_0x2679fb);_0x304762(_0x4710d0['error'](0x1f4,_0x141295[_0x05ca('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6f8f476..c53c5cc 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 _0x1336=['create','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x52090d,_0x2b65b3){var _0x53cbf0=function(_0x5b9e44){while(--_0x5b9e44){_0x52090d['push'](_0x52090d['shift']());}};_0x53cbf0(++_0x2b65b3);}(_0x1336,0xe1));var _0x6133=function(_0x5d8bc5,_0x42b012){_0x5d8bc5=_0x5d8bc5-0x0;var _0x540538=_0x1336[_0x5d8bc5];return _0x540538;};'use strict';var multer=require(_0x6133('0x0'));var util=require('util');var path=require(_0x6133('0x1'));var express=require(_0x6133('0x2'));var router=express[_0x6133('0x3')]();var auth=require(_0x6133('0x4'));var interaction=require(_0x6133('0x5'));var config=require('../../config/environment');var controller=require('./intSalesforceConfiguration.controller');router[_0x6133('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6133('0x6')](_0x6133('0x7'),auth[_0x6133('0x8')](),controller['show']);router[_0x6133('0x6')](_0x6133('0x9'),auth['isAuthenticated'](),controller[_0x6133('0xa')]);router[_0x6133('0x6')](_0x6133('0xb'),auth[_0x6133('0x8')](),controller[_0x6133('0xc')]);router[_0x6133('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x6133('0xd')]);router[_0x6133('0xe')]('/',auth[_0x6133('0x8')](),controller[_0x6133('0xf')]);router[_0x6133('0x10')](_0x6133('0x7'),auth[_0x6133('0x8')](),controller[_0x6133('0x11')]);router[_0x6133('0x12')](_0x6133('0x7'),auth[_0x6133('0x8')](),controller['destroy']);module[_0x6133('0x13')]=router; \ No newline at end of file +var _0xc88f=['index','/:id','show','/:id/fields','getFields','/:id/subjects','post','create','put','update','delete','destroy','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','isAuthenticated'];(function(_0x4bc80a,_0x204c27){var _0x373c51=function(_0x2bbf06){while(--_0x2bbf06){_0x4bc80a['push'](_0x4bc80a['shift']());}};_0x373c51(++_0x204c27);}(_0xc88f,0xf3));var _0xfc88=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc88f[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xfc88('0x0'));var util=require(_0xfc88('0x1'));var path=require('path');var express=require(_0xfc88('0x2'));var router=express[_0xfc88('0x3')]();var auth=require(_0xfc88('0x4'));var interaction=require(_0xfc88('0x5'));var config=require('../../config/environment');var controller=require(_0xfc88('0x6'));router[_0xfc88('0x7')]('/',auth[_0xfc88('0x8')](),controller[_0xfc88('0x9')]);router[_0xfc88('0x7')](_0xfc88('0xa'),auth[_0xfc88('0x8')](),controller[_0xfc88('0xb')]);router[_0xfc88('0x7')](_0xfc88('0xc'),auth[_0xfc88('0x8')](),controller[_0xfc88('0xd')]);router[_0xfc88('0x7')](_0xfc88('0xe'),auth[_0xfc88('0x8')](),controller['getSubjects']);router[_0xfc88('0x7')]('/:id/descriptions',auth[_0xfc88('0x8')](),controller['getDescriptions']);router[_0xfc88('0xf')]('/',auth[_0xfc88('0x8')](),controller[_0xfc88('0x10')]);router[_0xfc88('0x11')](_0xfc88('0xa'),auth['isAuthenticated'](),controller[_0xfc88('0x12')]);router[_0xfc88('0x13')](_0xfc88('0xa'),auth[_0xfc88('0x8')](),controller[_0xfc88('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index f5643ee..405a047 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 _0x3af8=['exports','STRING','ENUM','contact_lead','contact','lead','sequelize'];(function(_0x561ea1,_0x1afd08){var _0x51fbbf=function(_0xfb889){while(--_0xfb889){_0x561ea1['push'](_0x561ea1['shift']());}};_0x51fbbf(++_0x1afd08);}(_0x3af8,0x172));var _0x83af=function(_0x1f040c,_0x14e5a2){_0x1f040c=_0x1f040c-0x0;var _0x24f202=_0x3af8[_0x1f040c];return _0x24f202;};'use strict';var Sequelize=require(_0x83af('0x0'));module[_0x83af('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x83af('0x2')]},'moduleSearch':{'type':Sequelize[_0x83af('0x3')](_0x83af('0x4'),_0x83af('0x5'),'lead'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x83af('0x3')]('nothing',_0x83af('0x5'),_0x83af('0x6')),'defaultValue':'lead'}}; \ No newline at end of file +var _0xc607=['contact_lead','contact','lead','nothing','sequelize','exports','STRING','ENUM'];(function(_0x145b3c,_0x31ea4a){var _0x1b6e36=function(_0xfccee6){while(--_0xfccee6){_0x145b3c['push'](_0x145b3c['shift']());}};_0x1b6e36(++_0x31ea4a);}(_0xc607,0x1c4));var _0x7c60=function(_0x1197d3,_0xb59c45){_0x1197d3=_0x1197d3-0x0;var _0x5402e9=_0xc607[_0x1197d3];return _0x5402e9;};'use strict';var Sequelize=require(_0x7c60('0x0'));module[_0x7c60('0x1')]={'name':{'type':Sequelize[_0x7c60('0x2')]},'description':{'type':Sequelize[_0x7c60('0x2')]},'moduleSearch':{'type':Sequelize[_0x7c60('0x3')](_0x7c60('0x4'),_0x7c60('0x5'),_0x7c60('0x6')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize['ENUM'](_0x7c60('0x7'),_0x7c60('0x5'),'lead'),'defaultValue':_0x7c60('0x6')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 80d76ef..12d0e5f 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 _0xa9e0=['limit','status','Content-Range','apply','reject','save','update','sendStatus','name','send','index','SalesforceConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','rows','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','pick','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','json','offset'];(function(_0x300915,_0x320ae4){var _0x5887ed=function(_0x211c35){while(--_0x211c35){_0x300915['push'](_0x300915['shift']());}};_0x5887ed(++_0x320ae4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4a4c56,_0x50dfb2,_0x527cdd,_0x4cfe67){return new BPromise(function(_0x273d4d,_0x36471c){var _0xd5b662=_0x4cfe67||client;return _0xd5b662[_0x0a9e('0x12')](_0x4a4c56,_0x527cdd)[_0x0a9e('0x13')](function(_0x69aeb7){logger['info'](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));logger[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x50dfb2,_0x0a9e('0x15'),JSON[_0x0a9e('0x18')](_0x69aeb7));if(_0x69aeb7['error']){if(_0x69aeb7[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x36471c(_0x69aeb7['error'][_0x0a9e('0x1a')]);}logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x273d4d(_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x1b')](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));_0x273d4d(_0x69aeb7[_0x0a9e('0x1c')][_0x0a9e('0x1a')]);}})[_0x0a9e('0x1d')](function(_0x105080){logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x105080);_0x36471c(_0x105080);});});}function respondWithStatusCode(_0x155cce,_0x53682f){_0x53682f=_0x53682f||0xcc;return function(_0x20f109){if(_0x20f109){return _0x155cce['sendStatus'](_0x53682f);}return _0x155cce['status'](_0x53682f)[_0x0a9e('0x1e')]();};}function respondWithResult(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xc8;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['status'](_0x38e7c4)[_0x0a9e('0x1f')](_0x30bae6);}};}function respondWithFilteredResult(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){var _0x370d86=_0x4d00e6['count'],_0x42ac8f=_0x3b45bc[_0x0a9e('0x20')],_0x16b1ca=_0x3b45bc[_0x0a9e('0x20')]+_0x3b45bc[_0x0a9e('0x21')],_0x5ea472;if(_0x16b1ca>=_0x370d86){_0x16b1ca=_0x370d86;_0x5ea472=0xc8;}else{_0x5ea472=0xce;}_0x2fb0e4[_0x0a9e('0x22')](_0x5ea472);return _0x2fb0e4['set'](_0x0a9e('0x23'),_0x42ac8f+'-'+_0x16b1ca+'/'+_0x370d86)['json'](_0x4d00e6);}return null;};}function patchUpdates(_0x45a1e7){return function(_0x5bfb33){try{jsonpatch[_0x0a9e('0x24')](_0x5bfb33,_0x45a1e7,!![]);}catch(_0x34dc65){return BPromise[_0x0a9e('0x25')](_0x34dc65);}return _0x5bfb33[_0x0a9e('0x26')]();};}function saveUpdates(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){return _0x11c3b6[_0x0a9e('0x27')](_0x140511)['then'](function(_0x3652a7){return _0x3652a7;});}return null;};}function removeEntity(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['destroy']()[_0x0a9e('0x13')](function(){_0x468813[_0x0a9e('0x22')](0xcc)[_0x0a9e('0x1e')]();});}};}function handleEntityNotFound(_0x824a4f,_0x58b06f){return function(_0x563b45){if(!_0x563b45){_0x824a4f[_0x0a9e('0x28')](0x194);}return _0x563b45;};}function handleError(_0x2e8759,_0x1dbde2){_0x1dbde2=_0x1dbde2||0x1f4;return function(_0x540530){logger[_0x0a9e('0x19')](_0x540530['stack']);if(_0x540530[_0x0a9e('0x29')]){delete _0x540530[_0x0a9e('0x29')];}_0x2e8759[_0x0a9e('0x22')](_0x1dbde2)[_0x0a9e('0x2a')](_0x540530);};}exports[_0x0a9e('0x2b')]=function(_0x5180f1,_0x66c1d2){var _0x46f0a5={},_0x40cb85={},_0x2da5c0={'count':0x0,'rows':[]};var _0x2b45ea=db[_0x0a9e('0x2c')][_0x0a9e('0x2d')];_0x40cb85[_0x0a9e('0x2e')]=_['keys'](_0x2b45ea);var _0x44295a={'dateStart':_0x5180f1['query'][_0x0a9e('0x2f')],'dateEnd':_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')]};delete _0x5180f1[_0x0a9e('0x30')]['dateStart'];delete _0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')];_0x40cb85[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x5180f1['query']);_0x40cb85['filters']=_[_0x0a9e('0x33')](_0x40cb85['model'],_0x40cb85[_0x0a9e('0x30')]);_0x46f0a5[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x40cb85[_0x0a9e('0x2e')],qs['fields'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x46f0a5[_0x0a9e('0x34')]=_0x46f0a5['attributes'][_0x0a9e('0x36')]?_0x46f0a5[_0x0a9e('0x34')]:_0x40cb85[_0x0a9e('0x2e')];if(!_0x5180f1['query']['hasOwnProperty'](_0x0a9e('0x37'))){_0x46f0a5[_0x0a9e('0x21')]=qs['limit'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x46f0a5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5180f1['query']['offset']);}_0x46f0a5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5180f1['query'][_0x0a9e('0x39')]);_0x46f0a5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x5180f1[_0x0a9e('0x30')],_0x40cb85[_0x0a9e('0x3b')]));if(_0x44295a[_0x0a9e('0x2f')]){if(_0x44295a[_0x0a9e('0x31')]){_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x31')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}else{_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x2f')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'createdAt':{'$gte':_0x44295a[_0x0a9e('0x2f')],'$lte':_0x44295a['dateEnd']}});}if(_0x5180f1['query'][_0x0a9e('0x3f')]){_0x46f0a5[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x46f0a5[_0x0a9e('0x34')],function(_0x10b040){var _0x445e25={};_0x445e25[_0x10b040]={'$like':'%'+_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x445e25;})});}_0x46f0a5=_[_0x0a9e('0x3e')]({},_0x46f0a5,_0x5180f1[_0x0a9e('0x41')]);var _0x5026aa={'where':_0x46f0a5[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x42')](_0x5026aa)[_0x0a9e('0x13')](function(_0x2e8caf){_0x2da5c0[_0x0a9e('0x42')]=_0x2e8caf;if(_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x46f0a5['include']=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x46f0a5);})[_0x0a9e('0x13')](function(_0x476688){_0x2da5c0[_0x0a9e('0x44')]=_0x476688;return _0x2da5c0;})['then'](respondWithFilteredResult(_0x66c1d2,_0x46f0a5))[_0x0a9e('0x1d')](handleError(_0x66c1d2,null));};exports[_0x0a9e('0x45')]=function(_0x4774f4,_0x34aa5a){var _0x45c845={'raw':![],'where':{'id':_0x4774f4[_0x0a9e('0x46')]['id']}},_0x37be73={};_0x37be73['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x37be73[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x4774f4[_0x0a9e('0x30')]);_0x37be73[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x37be73[_0x0a9e('0x2e')],_0x37be73['query']);_0x45c845[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x37be73['model'],qs['fields'](_0x4774f4['query'][_0x0a9e('0x35')]));_0x45c845[_0x0a9e('0x34')]=_0x45c845[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x45c845[_0x0a9e('0x34')]:_0x37be73[_0x0a9e('0x2e')];if(_0x4774f4[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x45c845['include']=[{'all':!![]}];}_0x45c845=_['merge']({},_0x45c845,_0x4774f4['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x47')](_0x45c845)[_0x0a9e('0x13')](handleEntityNotFound(_0x34aa5a,null))['then'](respondWithResult(_0x34aa5a,null))[_0x0a9e('0x1d')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x48')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x2c')]['create'](_0x53d113[_0x0a9e('0x49')],{})['then'](respondWithResult(_0x5a88da,0xc9))[_0x0a9e('0x1d')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x27')]=function(_0x439340,_0x53613a){if(_0x439340[_0x0a9e('0x49')]['id']){delete _0x439340[_0x0a9e('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x439340[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x53613a,null))['then'](saveUpdates(_0x439340[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x1d')](handleError(_0x53613a,null));};exports['destroy']=function(_0xe22ccc,_0x4a6deb){return db['SalesforceConfiguration']['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x13')](removeEntity(_0x4a6deb,null))[_0x0a9e('0x1d')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x4a')]=function(_0x19b4df,_0x232830,_0x272738){var _0xd10662={};var _0x28d814={};var _0x4e67ab;var _0x1c693e;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x19b4df[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x13')](function(_0x5d86e9){if(_0x5d86e9){_0x4e67ab=_0x5d86e9;_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x32')](db['SalesforceField'][_0x0a9e('0x2d')]);_0x28d814['query']=_[_0x0a9e('0x32')](_0x19b4df['query']);_0x28d814['filters']=_['intersection'](_0x28d814[_0x0a9e('0x2e')],_0x28d814['query']);_0xd10662[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x28d814[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0xd10662['attributes']=_0xd10662[_0x0a9e('0x34')]['length']?_0xd10662[_0x0a9e('0x34')]:_0x28d814[_0x0a9e('0x2e')];_0xd10662[_0x0a9e('0x38')]=qs['sort'](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0xd10662[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x19b4df[_0x0a9e('0x30')],_0x28d814[_0x0a9e('0x3b')]));if(_0x19b4df['query'][_0x0a9e('0x3f')]){_0xd10662[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0xd10662[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0xd10662['attributes'],function(_0x176840){var _0x2937e0={};_0x2937e0[_0x176840]={'$like':'%'+_0x19b4df[_0x0a9e('0x30')]['filter']+'%'};return _0x2937e0;})});}_0xd10662=_[_0x0a9e('0x3e')]({},_0xd10662,_0x19b4df['options']);return _0x4e67ab['getFields'](_0xd10662);}})[_0x0a9e('0x13')](function(_0x4556c5){if(_0x4556c5){_0x1c693e=_0x4556c5[_0x0a9e('0x36')];if(!_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0xd10662[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0xd10662[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x20')]);}return _0x4e67ab[_0x0a9e('0x4a')](_0xd10662);}})[_0x0a9e('0x13')](function(_0x2a28c0){if(_0x2a28c0){return _0x2a28c0?{'count':_0x1c693e,'rows':_0x2a28c0}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x4d')]=function(_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={};var _0x4b341d;var _0x83f0b2;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x295763[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x243d12,null))['then'](function(_0x50cdce){if(_0x50cdce){_0x4b341d=_0x50cdce;_0x30944e['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x30944e[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x295763[_0x0a9e('0x30')]);_0x30944e[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x30944e['model'],_0x30944e[_0x0a9e('0x30')]);_0x1148a1[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x30944e['model'],qs[_0x0a9e('0x35')](_0x295763['query'][_0x0a9e('0x35')]));_0x1148a1[_0x0a9e('0x34')]=_0x1148a1['attributes'][_0x0a9e('0x36')]?_0x1148a1[_0x0a9e('0x34')]:_0x30944e[_0x0a9e('0x2e')];_0x1148a1[_0x0a9e('0x38')]=qs['sort'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x1148a1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x295763[_0x0a9e('0x30')],_0x30944e[_0x0a9e('0x3b')]));if(_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x1148a1['where']=_[_0x0a9e('0x3e')](_0x1148a1[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x1148a1[_0x0a9e('0x34')],function(_0x332367){var _0xdb98ca={};_0xdb98ca[_0x332367]={'$like':'%'+_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0xdb98ca;})});}_0x1148a1=_[_0x0a9e('0x3e')]({},_0x1148a1,_0x295763[_0x0a9e('0x41')]);return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x25744a){if(_0x25744a){_0x83f0b2=_0x25744a[_0x0a9e('0x36')];if(!_0x295763['query'][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x1148a1[_0x0a9e('0x21')]=qs['limit'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x1148a1[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x295763['query']['offset']);}return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x4c54fa){if(_0x4c54fa){return _0x4c54fa?{'count':_0x83f0b2,'rows':_0x4c54fa}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x243d12,null))['catch'](handleError(_0x243d12,null));};exports[_0x0a9e('0x4f')]=function(_0x8ebf02,_0x5637a1,_0x28a942){var _0x41cf12={};var _0x2d2286={};var _0x42b959;var _0x3755fe;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x8ebf02['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5637a1,null))[_0x0a9e('0x13')](function(_0x45c109){if(_0x45c109){_0x42b959=_0x45c109;_0x2d2286[_0x0a9e('0x2e')]=_['keys'](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x2d2286['query']=_[_0x0a9e('0x32')](_0x8ebf02['query']);_0x2d2286[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x2d2286[_0x0a9e('0x2e')],_0x2d2286[_0x0a9e('0x30')]);_0x41cf12['attributes']=_['intersection'](_0x2d2286[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x8ebf02[_0x0a9e('0x30')]['fields']));_0x41cf12[_0x0a9e('0x34')]=_0x41cf12[_0x0a9e('0x34')]['length']?_0x41cf12['attributes']:_0x2d2286[_0x0a9e('0x2e')];_0x41cf12['order']=qs['sort'](_0x8ebf02['query'][_0x0a9e('0x39')]);_0x41cf12[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x50')](_0x8ebf02[_0x0a9e('0x30')],_0x2d2286[_0x0a9e('0x3b')]));if(_0x8ebf02['query'][_0x0a9e('0x3f')]){_0x41cf12['where']=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x41cf12[_0x0a9e('0x34')],function(_0x50f8d7){var _0x46c9ac={};_0x46c9ac[_0x50f8d7]={'$like':'%'+_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x46c9ac;})});}_0x41cf12=_['merge']({},_0x41cf12,_0x8ebf02[_0x0a9e('0x41')]);return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})[_0x0a9e('0x13')](function(_0x22063c){if(_0x22063c){_0x3755fe=_0x22063c[_0x0a9e('0x36')];if(!_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x41cf12['limit']=qs[_0x0a9e('0x21')](_0x8ebf02[_0x0a9e('0x30')]['limit']);_0x41cf12[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x8ebf02[_0x0a9e('0x30')]['offset']);}return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){return _0x8c8fbe?{'count':_0x3755fe,'rows':_0x8c8fbe}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x5637a1,null))[_0x0a9e('0x1d')](handleError(_0x5637a1,null));}; \ No newline at end of file +var _0xa9e0=['limit','status','Content-Range','apply','reject','save','update','sendStatus','name','send','index','SalesforceConfiguration','rawAttributes','model','dateStart','query','dateEnd','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','add','day','merge','filter','map','options','count','includeAll','rows','show','params','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','SalesforceField','getDescriptions','pick','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','json','offset'];(function(_0x5e4fcb,_0x4d4b1f){var _0x60d949=function(_0x3a22ae){while(--_0x3a22ae){_0x5e4fcb['push'](_0x5e4fcb['shift']());}};_0x60d949(++_0x4d4b1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var jayson=require(_0x0a9e('0xf'));var client=jayson[_0x0a9e('0x10')][_0x0a9e('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x4a4c56,_0x50dfb2,_0x527cdd,_0x4cfe67){return new BPromise(function(_0x273d4d,_0x36471c){var _0xd5b662=_0x4cfe67||client;return _0xd5b662[_0x0a9e('0x12')](_0x4a4c56,_0x527cdd)[_0x0a9e('0x13')](function(_0x69aeb7){logger['info'](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));logger[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x50dfb2,_0x0a9e('0x15'),JSON[_0x0a9e('0x18')](_0x69aeb7));if(_0x69aeb7['error']){if(_0x69aeb7[_0x0a9e('0x19')]['code']===0x1f4){logger[_0x0a9e('0x19')]('SalesforceConfiguration,\x20%s,\x20%s',_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x36471c(_0x69aeb7['error'][_0x0a9e('0x1a')]);}logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);return _0x273d4d(_0x69aeb7[_0x0a9e('0x19')][_0x0a9e('0x1a')]);}else{logger[_0x0a9e('0x1b')](_0x0a9e('0x14'),_0x50dfb2,_0x0a9e('0x15'));_0x273d4d(_0x69aeb7[_0x0a9e('0x1c')][_0x0a9e('0x1a')]);}})[_0x0a9e('0x1d')](function(_0x105080){logger['error'](_0x0a9e('0x14'),_0x50dfb2,_0x105080);_0x36471c(_0x105080);});});}function respondWithStatusCode(_0x155cce,_0x53682f){_0x53682f=_0x53682f||0xcc;return function(_0x20f109){if(_0x20f109){return _0x155cce['sendStatus'](_0x53682f);}return _0x155cce['status'](_0x53682f)[_0x0a9e('0x1e')]();};}function respondWithResult(_0x432e56,_0x38e7c4){_0x38e7c4=_0x38e7c4||0xc8;return function(_0x30bae6){if(_0x30bae6){return _0x432e56['status'](_0x38e7c4)[_0x0a9e('0x1f')](_0x30bae6);}};}function respondWithFilteredResult(_0x2fb0e4,_0x3b45bc){return function(_0x4d00e6){if(_0x4d00e6){var _0x370d86=_0x4d00e6['count'],_0x42ac8f=_0x3b45bc[_0x0a9e('0x20')],_0x16b1ca=_0x3b45bc[_0x0a9e('0x20')]+_0x3b45bc[_0x0a9e('0x21')],_0x5ea472;if(_0x16b1ca>=_0x370d86){_0x16b1ca=_0x370d86;_0x5ea472=0xc8;}else{_0x5ea472=0xce;}_0x2fb0e4[_0x0a9e('0x22')](_0x5ea472);return _0x2fb0e4['set'](_0x0a9e('0x23'),_0x42ac8f+'-'+_0x16b1ca+'/'+_0x370d86)['json'](_0x4d00e6);}return null;};}function patchUpdates(_0x45a1e7){return function(_0x5bfb33){try{jsonpatch[_0x0a9e('0x24')](_0x5bfb33,_0x45a1e7,!![]);}catch(_0x34dc65){return BPromise[_0x0a9e('0x25')](_0x34dc65);}return _0x5bfb33[_0x0a9e('0x26')]();};}function saveUpdates(_0x140511,_0x1538a4){return function(_0x11c3b6){if(_0x11c3b6){return _0x11c3b6[_0x0a9e('0x27')](_0x140511)['then'](function(_0x3652a7){return _0x3652a7;});}return null;};}function removeEntity(_0x468813,_0x2b1f27){return function(_0x2ec755){if(_0x2ec755){return _0x2ec755['destroy']()[_0x0a9e('0x13')](function(){_0x468813[_0x0a9e('0x22')](0xcc)[_0x0a9e('0x1e')]();});}};}function handleEntityNotFound(_0x824a4f,_0x58b06f){return function(_0x563b45){if(!_0x563b45){_0x824a4f[_0x0a9e('0x28')](0x194);}return _0x563b45;};}function handleError(_0x2e8759,_0x1dbde2){_0x1dbde2=_0x1dbde2||0x1f4;return function(_0x540530){logger[_0x0a9e('0x19')](_0x540530['stack']);if(_0x540530[_0x0a9e('0x29')]){delete _0x540530[_0x0a9e('0x29')];}_0x2e8759[_0x0a9e('0x22')](_0x1dbde2)[_0x0a9e('0x2a')](_0x540530);};}exports[_0x0a9e('0x2b')]=function(_0x5180f1,_0x66c1d2){var _0x46f0a5={},_0x40cb85={},_0x2da5c0={'count':0x0,'rows':[]};var _0x2b45ea=db[_0x0a9e('0x2c')][_0x0a9e('0x2d')];_0x40cb85[_0x0a9e('0x2e')]=_['keys'](_0x2b45ea);var _0x44295a={'dateStart':_0x5180f1['query'][_0x0a9e('0x2f')],'dateEnd':_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')]};delete _0x5180f1[_0x0a9e('0x30')]['dateStart'];delete _0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x31')];_0x40cb85[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x5180f1['query']);_0x40cb85['filters']=_[_0x0a9e('0x33')](_0x40cb85['model'],_0x40cb85[_0x0a9e('0x30')]);_0x46f0a5[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x40cb85[_0x0a9e('0x2e')],qs['fields'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0x46f0a5[_0x0a9e('0x34')]=_0x46f0a5['attributes'][_0x0a9e('0x36')]?_0x46f0a5[_0x0a9e('0x34')]:_0x40cb85[_0x0a9e('0x2e')];if(!_0x5180f1['query']['hasOwnProperty'](_0x0a9e('0x37'))){_0x46f0a5[_0x0a9e('0x21')]=qs['limit'](_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x46f0a5[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x5180f1['query']['offset']);}_0x46f0a5[_0x0a9e('0x38')]=qs[_0x0a9e('0x39')](_0x5180f1['query'][_0x0a9e('0x39')]);_0x46f0a5[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x5180f1[_0x0a9e('0x30')],_0x40cb85[_0x0a9e('0x3b')]));if(_0x44295a[_0x0a9e('0x2f')]){if(_0x44295a[_0x0a9e('0x31')]){_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x31')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}else{_0x44295a[_0x0a9e('0x31')]=moment(_0x44295a[_0x0a9e('0x2f')])[_0x0a9e('0x3c')](0x1,_0x0a9e('0x3d'));}_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'createdAt':{'$gte':_0x44295a[_0x0a9e('0x2f')],'$lte':_0x44295a['dateEnd']}});}if(_0x5180f1['query'][_0x0a9e('0x3f')]){_0x46f0a5[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0x46f0a5[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x46f0a5[_0x0a9e('0x34')],function(_0x10b040){var _0x445e25={};_0x445e25[_0x10b040]={'$like':'%'+_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x445e25;})});}_0x46f0a5=_[_0x0a9e('0x3e')]({},_0x46f0a5,_0x5180f1[_0x0a9e('0x41')]);var _0x5026aa={'where':_0x46f0a5[_0x0a9e('0x3a')]};return db[_0x0a9e('0x2c')][_0x0a9e('0x42')](_0x5026aa)[_0x0a9e('0x13')](function(_0x2e8caf){_0x2da5c0[_0x0a9e('0x42')]=_0x2e8caf;if(_0x5180f1[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x46f0a5['include']=[{'all':!![]}];}return db[_0x0a9e('0x2c')]['findAll'](_0x46f0a5);})[_0x0a9e('0x13')](function(_0x476688){_0x2da5c0[_0x0a9e('0x44')]=_0x476688;return _0x2da5c0;})['then'](respondWithFilteredResult(_0x66c1d2,_0x46f0a5))[_0x0a9e('0x1d')](handleError(_0x66c1d2,null));};exports[_0x0a9e('0x45')]=function(_0x4774f4,_0x34aa5a){var _0x45c845={'raw':![],'where':{'id':_0x4774f4[_0x0a9e('0x46')]['id']}},_0x37be73={};_0x37be73['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x2c')][_0x0a9e('0x2d')]);_0x37be73[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x4774f4[_0x0a9e('0x30')]);_0x37be73[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x37be73[_0x0a9e('0x2e')],_0x37be73['query']);_0x45c845[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x37be73['model'],qs['fields'](_0x4774f4['query'][_0x0a9e('0x35')]));_0x45c845[_0x0a9e('0x34')]=_0x45c845[_0x0a9e('0x34')][_0x0a9e('0x36')]?_0x45c845[_0x0a9e('0x34')]:_0x37be73[_0x0a9e('0x2e')];if(_0x4774f4[_0x0a9e('0x30')][_0x0a9e('0x43')]){_0x45c845['include']=[{'all':!![]}];}_0x45c845=_['merge']({},_0x45c845,_0x4774f4['options']);return db[_0x0a9e('0x2c')][_0x0a9e('0x47')](_0x45c845)[_0x0a9e('0x13')](handleEntityNotFound(_0x34aa5a,null))['then'](respondWithResult(_0x34aa5a,null))[_0x0a9e('0x1d')](handleError(_0x34aa5a,null));};exports[_0x0a9e('0x48')]=function(_0x53d113,_0x5a88da){return db[_0x0a9e('0x2c')]['create'](_0x53d113[_0x0a9e('0x49')],{})['then'](respondWithResult(_0x5a88da,0xc9))[_0x0a9e('0x1d')](handleError(_0x5a88da,null));};exports[_0x0a9e('0x27')]=function(_0x439340,_0x53613a){if(_0x439340[_0x0a9e('0x49')]['id']){delete _0x439340[_0x0a9e('0x49')]['id'];}return db['SalesforceConfiguration']['find']({'where':{'id':_0x439340[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x53613a,null))['then'](saveUpdates(_0x439340[_0x0a9e('0x49')],null))['then'](respondWithResult(_0x53613a,null))[_0x0a9e('0x1d')](handleError(_0x53613a,null));};exports['destroy']=function(_0xe22ccc,_0x4a6deb){return db['SalesforceConfiguration']['find']({'where':{'id':_0xe22ccc[_0x0a9e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a6deb,null))[_0x0a9e('0x13')](removeEntity(_0x4a6deb,null))[_0x0a9e('0x1d')](handleError(_0x4a6deb,null));};exports[_0x0a9e('0x4a')]=function(_0x19b4df,_0x232830,_0x272738){var _0xd10662={};var _0x28d814={};var _0x4e67ab;var _0x1c693e;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x19b4df[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x232830,null))[_0x0a9e('0x13')](function(_0x5d86e9){if(_0x5d86e9){_0x4e67ab=_0x5d86e9;_0x28d814[_0x0a9e('0x2e')]=_[_0x0a9e('0x32')](db['SalesforceField'][_0x0a9e('0x2d')]);_0x28d814['query']=_[_0x0a9e('0x32')](_0x19b4df['query']);_0x28d814['filters']=_['intersection'](_0x28d814[_0x0a9e('0x2e')],_0x28d814['query']);_0xd10662[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x28d814[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x35')]));_0xd10662['attributes']=_0xd10662[_0x0a9e('0x34')]['length']?_0xd10662[_0x0a9e('0x34')]:_0x28d814[_0x0a9e('0x2e')];_0xd10662[_0x0a9e('0x38')]=qs['sort'](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0xd10662[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x19b4df[_0x0a9e('0x30')],_0x28d814[_0x0a9e('0x3b')]));if(_0x19b4df['query'][_0x0a9e('0x3f')]){_0xd10662[_0x0a9e('0x3a')]=_[_0x0a9e('0x3e')](_0xd10662[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0xd10662['attributes'],function(_0x176840){var _0x2937e0={};_0x2937e0[_0x176840]={'$like':'%'+_0x19b4df[_0x0a9e('0x30')]['filter']+'%'};return _0x2937e0;})});}_0xd10662=_[_0x0a9e('0x3e')]({},_0xd10662,_0x19b4df['options']);return _0x4e67ab['getFields'](_0xd10662);}})[_0x0a9e('0x13')](function(_0x4556c5){if(_0x4556c5){_0x1c693e=_0x4556c5[_0x0a9e('0x36')];if(!_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0xd10662[_0x0a9e('0x21')]=qs[_0x0a9e('0x21')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0xd10662[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x19b4df[_0x0a9e('0x30')][_0x0a9e('0x20')]);}return _0x4e67ab[_0x0a9e('0x4a')](_0xd10662);}})[_0x0a9e('0x13')](function(_0x2a28c0){if(_0x2a28c0){return _0x2a28c0?{'count':_0x1c693e,'rows':_0x2a28c0}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x232830,null))['catch'](handleError(_0x232830,null));};exports[_0x0a9e('0x4d')]=function(_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={};var _0x4b341d;var _0x83f0b2;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x295763[_0x0a9e('0x46')]['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x243d12,null))['then'](function(_0x50cdce){if(_0x50cdce){_0x4b341d=_0x50cdce;_0x30944e['model']=_[_0x0a9e('0x32')](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x30944e[_0x0a9e('0x30')]=_[_0x0a9e('0x32')](_0x295763[_0x0a9e('0x30')]);_0x30944e[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x30944e['model'],_0x30944e[_0x0a9e('0x30')]);_0x1148a1[_0x0a9e('0x34')]=_[_0x0a9e('0x33')](_0x30944e['model'],qs[_0x0a9e('0x35')](_0x295763['query'][_0x0a9e('0x35')]));_0x1148a1[_0x0a9e('0x34')]=_0x1148a1['attributes'][_0x0a9e('0x36')]?_0x1148a1[_0x0a9e('0x34')]:_0x30944e[_0x0a9e('0x2e')];_0x1148a1[_0x0a9e('0x38')]=qs['sort'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x39')]);_0x1148a1[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_['pick'](_0x295763[_0x0a9e('0x30')],_0x30944e[_0x0a9e('0x3b')]));if(_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]){_0x1148a1['where']=_[_0x0a9e('0x3e')](_0x1148a1[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x1148a1[_0x0a9e('0x34')],function(_0x332367){var _0xdb98ca={};_0xdb98ca[_0x332367]={'$like':'%'+_0x295763[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0xdb98ca;})});}_0x1148a1=_[_0x0a9e('0x3e')]({},_0x1148a1,_0x295763[_0x0a9e('0x41')]);return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x25744a){if(_0x25744a){_0x83f0b2=_0x25744a[_0x0a9e('0x36')];if(!_0x295763['query'][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x1148a1[_0x0a9e('0x21')]=qs['limit'](_0x295763[_0x0a9e('0x30')][_0x0a9e('0x21')]);_0x1148a1[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x295763['query']['offset']);}return _0x4b341d[_0x0a9e('0x4d')](_0x1148a1);}})[_0x0a9e('0x13')](function(_0x4c54fa){if(_0x4c54fa){return _0x4c54fa?{'count':_0x83f0b2,'rows':_0x4c54fa}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x243d12,null))['catch'](handleError(_0x243d12,null));};exports[_0x0a9e('0x4f')]=function(_0x8ebf02,_0x5637a1,_0x28a942){var _0x41cf12={};var _0x2d2286={};var _0x42b959;var _0x3755fe;return db[_0x0a9e('0x2c')][_0x0a9e('0x4b')]({'where':{'id':_0x8ebf02['params']['id']}})[_0x0a9e('0x13')](handleEntityNotFound(_0x5637a1,null))[_0x0a9e('0x13')](function(_0x45c109){if(_0x45c109){_0x42b959=_0x45c109;_0x2d2286[_0x0a9e('0x2e')]=_['keys'](db[_0x0a9e('0x4e')][_0x0a9e('0x2d')]);_0x2d2286['query']=_[_0x0a9e('0x32')](_0x8ebf02['query']);_0x2d2286[_0x0a9e('0x3b')]=_[_0x0a9e('0x33')](_0x2d2286[_0x0a9e('0x2e')],_0x2d2286[_0x0a9e('0x30')]);_0x41cf12['attributes']=_['intersection'](_0x2d2286[_0x0a9e('0x2e')],qs[_0x0a9e('0x35')](_0x8ebf02[_0x0a9e('0x30')]['fields']));_0x41cf12[_0x0a9e('0x34')]=_0x41cf12[_0x0a9e('0x34')]['length']?_0x41cf12['attributes']:_0x2d2286[_0x0a9e('0x2e')];_0x41cf12['order']=qs['sort'](_0x8ebf02['query'][_0x0a9e('0x39')]);_0x41cf12[_0x0a9e('0x3a')]=qs[_0x0a9e('0x3b')](_[_0x0a9e('0x50')](_0x8ebf02[_0x0a9e('0x30')],_0x2d2286[_0x0a9e('0x3b')]));if(_0x8ebf02['query'][_0x0a9e('0x3f')]){_0x41cf12['where']=_[_0x0a9e('0x3e')](_0x41cf12[_0x0a9e('0x3a')],{'$or':_[_0x0a9e('0x40')](_0x41cf12[_0x0a9e('0x34')],function(_0x50f8d7){var _0x46c9ac={};_0x46c9ac[_0x50f8d7]={'$like':'%'+_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x3f')]+'%'};return _0x46c9ac;})});}_0x41cf12=_['merge']({},_0x41cf12,_0x8ebf02[_0x0a9e('0x41')]);return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})[_0x0a9e('0x13')](function(_0x22063c){if(_0x22063c){_0x3755fe=_0x22063c[_0x0a9e('0x36')];if(!_0x8ebf02[_0x0a9e('0x30')][_0x0a9e('0x4c')](_0x0a9e('0x37'))){_0x41cf12['limit']=qs[_0x0a9e('0x21')](_0x8ebf02[_0x0a9e('0x30')]['limit']);_0x41cf12[_0x0a9e('0x20')]=qs[_0x0a9e('0x20')](_0x8ebf02[_0x0a9e('0x30')]['offset']);}return _0x42b959[_0x0a9e('0x4f')](_0x41cf12);}})['then'](function(_0x8c8fbe){if(_0x8c8fbe){return _0x8c8fbe?{'count':_0x3755fe,'rows':_0x8c8fbe}:null;}})[_0x0a9e('0x13')](respondWithResult(_0x5637a1,null))[_0x0a9e('0x1d')](handleError(_0x5637a1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 7033c9d..8daa01a 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 _0x3f18=['bluebird','request-promise','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','api','moment'];(function(_0xb4bba6,_0xbd6de7){var _0x3136fe=function(_0x5dcb14){while(--_0x5dcb14){_0xb4bba6['push'](_0xb4bba6['shift']());}};_0x3136fe(++_0xbd6de7);}(_0x3f18,0xc9));var _0x83f1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3f18[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x83f1('0x0'));var moment=require(_0x83f1('0x1'));var BPromise=require(_0x83f1('0x2'));var rp=require(_0x83f1('0x3'));var attributes=require(_0x83f1('0x4'));module[_0x83f1('0x5')]=function(_0x2990d0,_0x201e83){return _0x2990d0['define']('SalesforceConfiguration',attributes,{'tableName':_0x83f1('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5416=['api','moment','request-promise','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5416,0x13d));var _0x6541=function(_0x1feff5,_0x1ba7b0){_0x1feff5=_0x1feff5-0x0;var _0x133b8e=_0x5416[_0x1feff5];return _0x133b8e;};'use strict';var _=require(_0x6541('0x0'));var util=require(_0x6541('0x1'));var logger=require(_0x6541('0x2'))(_0x6541('0x3'));var moment=require(_0x6541('0x4'));var BPromise=require('bluebird');var rp=require(_0x6541('0x5'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x6541('0x6')]=function(_0x3df648,_0x5052e9){return _0x3df648[_0x6541('0x7')](_0x6541('0x8'),attributes,{'tableName':_0x6541('0x9'),'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 8709765..9bdee9e 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 _0xcef7=['result','catch','lodash','util','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x4fda7,_0x8a0ea2){var _0xe1dab6=function(_0x1bf853){while(--_0x1bf853){_0x4fda7['push'](_0x4fda7['shift']());}};_0xe1dab6(++_0x8a0ea2);}(_0xcef7,0x1a4));var _0x7cef=function(_0xba0778,_0x4e916f){_0xba0778=_0xba0778-0x0;var _0x8fd376=_0xcef7[_0xba0778];return _0x8fd376;};'use strict';var _=require(_0x7cef('0x0'));var util=require(_0x7cef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7cef('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7cef('0x3'));var logger=require('../../config/logger')(_0x7cef('0x4'));var config=require(_0x7cef('0x5'));var jayson=require(_0x7cef('0x6'));var client=jayson[_0x7cef('0x7')][_0x7cef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x55dc7e,_0x4bd542,_0x12bc6e){return new BPromise(function(_0x886ecc,_0x303139){return client[_0x7cef('0x9')](_0x55dc7e,_0x12bc6e)[_0x7cef('0xa')](function(_0x57dd5){logger[_0x7cef('0xb')](_0x7cef('0xc'),_0x4bd542,'request\x20sent');logger[_0x7cef('0xd')](_0x7cef('0xe'),_0x4bd542,_0x7cef('0xf'),JSON[_0x7cef('0x10')](_0x57dd5));if(_0x57dd5['error']){if(_0x57dd5[_0x7cef('0x11')][_0x7cef('0x12')]===0x1f4){logger[_0x7cef('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4bd542,_0x57dd5[_0x7cef('0x11')]['message']);return _0x303139(_0x57dd5['error'][_0x7cef('0x13')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4bd542,_0x57dd5[_0x7cef('0x11')][_0x7cef('0x13')]);return _0x886ecc(_0x57dd5[_0x7cef('0x11')][_0x7cef('0x13')]);}else{logger[_0x7cef('0xb')](_0x7cef('0xc'),_0x4bd542,_0x7cef('0xf'));_0x886ecc(_0x57dd5[_0x7cef('0x14')][_0x7cef('0x13')]);}})[_0x7cef('0x15')](function(_0xbf1c57){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4bd542,_0xbf1c57);_0x303139(_0xbf1c57);});});} \ No newline at end of file +var _0x49d3=['request','then','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2865fe,_0x33910f){var _0x4573cc=function(_0x45b71d){while(--_0x45b71d){_0x2865fe['push'](_0x2865fe['shift']());}};_0x4573cc(++_0x33910f);}(_0x49d3,0x13b));var _0x349d=function(_0x36cd04,_0x1f2a87){_0x36cd04=_0x36cd04-0x0;var _0x4826d6=_0x49d3[_0x36cd04];return _0x4826d6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x349d('0x0'));var BPromise=require('bluebird');var rs=require(_0x349d('0x1'));var fs=require('fs');var db=require(_0x349d('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x349d('0x3'));var config=require(_0x349d('0x4'));var jayson=require(_0x349d('0x5'));var client=jayson[_0x349d('0x6')][_0x349d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5c8050,_0x3ff5f6,_0x608632){return new BPromise(function(_0x34d19e,_0x327b2e){return client[_0x349d('0x8')](_0x5c8050,_0x608632)[_0x349d('0x9')](function(_0x430e93){logger['info'](_0x349d('0xa'),_0x3ff5f6,'request\x20sent');logger[_0x349d('0xb')](_0x349d('0xc'),_0x3ff5f6,_0x349d('0xd'),JSON[_0x349d('0xe')](_0x430e93));if(_0x430e93[_0x349d('0xf')]){if(_0x430e93[_0x349d('0xf')]['code']===0x1f4){logger[_0x349d('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ff5f6,_0x430e93[_0x349d('0xf')][_0x349d('0x10')]);return _0x327b2e(_0x430e93[_0x349d('0xf')]['message']);}logger['error'](_0x349d('0xa'),_0x3ff5f6,_0x430e93['error'][_0x349d('0x10')]);return _0x34d19e(_0x430e93[_0x349d('0xf')][_0x349d('0x10')]);}else{logger[_0x349d('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3ff5f6,'request\x20sent');_0x34d19e(_0x430e93['result'][_0x349d('0x10')]);}})[_0x349d('0x12')](function(_0x3e1b41){logger[_0x349d('0xf')](_0x349d('0xa'),_0x3ff5f6,_0x3e1b41);_0x327b2e(_0x3e1b41);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index bc64f47..a81c616 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 _0x5a89=['/:id','post','create','update','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index'];(function(_0x180f6d,_0x7f2785){var _0x312d2e=function(_0x22a2ae){while(--_0x22a2ae){_0x180f6d['push'](_0x180f6d['shift']());}};_0x312d2e(++_0x7f2785);}(_0x5a89,0x18d));var _0x95a8=function(_0xea3bc2,_0x21ec34){_0xea3bc2=_0xea3bc2-0x0;var _0x237972=_0x5a89[_0xea3bc2];return _0x237972;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x95a8('0x0'));var router=express[_0x95a8('0x1')]();var auth=require(_0x95a8('0x2'));var interaction=require(_0x95a8('0x3'));var config=require(_0x95a8('0x4'));var controller=require(_0x95a8('0x5'));router['get']('/',auth[_0x95a8('0x6')](),controller[_0x95a8('0x7')]);router['get'](_0x95a8('0x8'),auth[_0x95a8('0x6')](),controller['show']);router[_0x95a8('0x9')]('/',auth[_0x95a8('0x6')](),controller[_0x95a8('0xa')]);router['put'](_0x95a8('0x8'),auth['isAuthenticated'](),controller[_0x95a8('0xb')]);router[_0x95a8('0xc')](_0x95a8('0x8'),auth[_0x95a8('0x6')](),controller[_0x95a8('0xd')]);module[_0x95a8('0xe')]=router; \ No newline at end of file +var _0x30d3=['show','post','create','put','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','index','get','/:id','isAuthenticated'];(function(_0x47c4c3,_0x51d162){var _0x350c9a=function(_0x2bd9a2){while(--_0x2bd9a2){_0x47c4c3['push'](_0x47c4c3['shift']());}};_0x350c9a(++_0x51d162);}(_0x30d3,0xc6));var _0x330d=function(_0x3c9b22,_0x1d7424){_0x3c9b22=_0x3c9b22-0x0;var _0x143630=_0x30d3[_0x3c9b22];return _0x143630;};'use strict';var multer=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var path=require('path');var express=require('express');var router=express[_0x330d('0x2')]();var auth=require(_0x330d('0x3'));var interaction=require(_0x330d('0x4'));var config=require(_0x330d('0x5'));var controller=require(_0x330d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x330d('0x7')]);router[_0x330d('0x8')](_0x330d('0x9'),auth[_0x330d('0xa')](),controller[_0x330d('0xb')]);router[_0x330d('0xc')]('/',auth[_0x330d('0xa')](),controller[_0x330d('0xd')]);router[_0x330d('0xe')]('/:id',auth[_0x330d('0xa')](),controller[_0x330d('0xf')]);router[_0x330d('0x10')](_0x330d('0x9'),auth[_0x330d('0xa')](),controller[_0x330d('0x11')]);module[_0x330d('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b7497bb..c283656 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 _0x1094=['STRING','ENUM','customVariable','exports','string','variable','keyValue'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x1094,0xa4));var _0x4109=function(_0x501401,_0x2d8737){_0x501401=_0x501401-0x0;var _0xfd0a47=_0x1094[_0x501401];return _0xfd0a47;};'use strict';var Sequelize=require('sequelize');module[_0x4109('0x0')]={'type':{'type':Sequelize['ENUM'](_0x4109('0x1'),_0x4109('0x2'),'customVariable',_0x4109('0x3')),'defaultValue':_0x4109('0x1')},'content':{'type':Sequelize[_0x4109('0x4')]},'key':{'type':Sequelize[_0x4109('0x4')]},'keyType':{'type':Sequelize[_0x4109('0x5')]('string','variable',_0x4109('0x6'))},'keyContent':{'type':Sequelize[_0x4109('0x4')]},'idField':{'type':Sequelize[_0x4109('0x4')]},'variableName':{'type':Sequelize[_0x4109('0x4')]}}; \ No newline at end of file +var _0x052f=['ENUM','string','variable','customVariable','keyValue','STRING','sequelize'];(function(_0x2d0910,_0x692f39){var _0x5537a5=function(_0x286196){while(--_0x286196){_0x2d0910['push'](_0x2d0910['shift']());}};_0x5537a5(++_0x692f39);}(_0x052f,0xfb));var _0xf052=function(_0x3337c3,_0x58d8a5){_0x3337c3=_0x3337c3-0x0;var _0x3ffdf6=_0x052f[_0x3337c3];return _0x3ffdf6;};'use strict';var Sequelize=require(_0xf052('0x0'));module['exports']={'type':{'type':Sequelize[_0xf052('0x1')](_0xf052('0x2'),_0xf052('0x3'),_0xf052('0x4'),_0xf052('0x5')),'defaultValue':_0xf052('0x2')},'content':{'type':Sequelize[_0xf052('0x6')]},'key':{'type':Sequelize[_0xf052('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf052('0x3'),_0xf052('0x4'))},'keyContent':{'type':Sequelize[_0xf052('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xf052('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index bc6479e..6653c34 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 _0x0eef=['catch','show','params','include','options','find','create','body','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','set','apply','save','update','then','error','stack','name','send','index','SalesforceField','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','map','count','includeAll','findAll','rows'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x0eef,0x1e4));var _0xf0ee=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0eef[_0xfae23b];return _0x200640;};'use strict';var jsonpatch=require(_0xf0ee('0x0'));var rp=require(_0xf0ee('0x1'));var moment=require(_0xf0ee('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf0ee('0x3'));var path=require('path');var sox=require(_0xf0ee('0x4'));var csv=require(_0xf0ee('0x5'));var ejs=require(_0xf0ee('0x6'));var fs=require('fs');var _=require(_0xf0ee('0x7'));var squel=require(_0xf0ee('0x8'));var crypto=require(_0xf0ee('0x9'));var jsforce=require(_0xf0ee('0xa'));var deskjs=require(_0xf0ee('0xb'));var toCsv=require(_0xf0ee('0x5'));var querystring=require(_0xf0ee('0xc'));var Papa=require(_0xf0ee('0xd'));var qs=require(_0xf0ee('0xe'));var logger=require(_0xf0ee('0xf'))(_0xf0ee('0x10'));var utils=require(_0xf0ee('0x11'));var config=require(_0xf0ee('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x575b95,_0xdc98d5){_0xdc98d5=_0xdc98d5||0xcc;return function(_0x41800e){if(_0x41800e){return _0x575b95[_0xf0ee('0x13')](_0xdc98d5);}return _0x575b95[_0xf0ee('0x14')](_0xdc98d5)[_0xf0ee('0x15')]();};}function respondWithResult(_0x501063,_0x3f3992){_0x3f3992=_0x3f3992||0xc8;return function(_0x4daafb){if(_0x4daafb){return _0x501063[_0xf0ee('0x14')](_0x3f3992)['json'](_0x4daafb);}};}function respondWithFilteredResult(_0x18ef6f,_0x506888){return function(_0x5b485e){if(_0x5b485e){var _0x5b750f=_0x5b485e['count'],_0x4dac24=_0x506888[_0xf0ee('0x16')],_0x380be9=_0x506888[_0xf0ee('0x16')]+_0x506888['limit'],_0x239293;if(_0x380be9>=_0x5b750f){_0x380be9=_0x5b750f;_0x239293=0xc8;}else{_0x239293=0xce;}_0x18ef6f['status'](_0x239293);return _0x18ef6f[_0xf0ee('0x17')]('Content-Range',_0x4dac24+'-'+_0x380be9+'/'+_0x5b750f)['json'](_0x5b485e);}return null;};}function patchUpdates(_0x4cd16b){return function(_0x2c35d2){try{jsonpatch[_0xf0ee('0x18')](_0x2c35d2,_0x4cd16b,!![]);}catch(_0x333e83){return BPromise['reject'](_0x333e83);}return _0x2c35d2[_0xf0ee('0x19')]();};}function saveUpdates(_0x4761bf,_0x2e2b1c){return function(_0x4a926f){if(_0x4a926f){return _0x4a926f[_0xf0ee('0x1a')](_0x4761bf)[_0xf0ee('0x1b')](function(_0x206f23){return _0x206f23;});}return null;};}function removeEntity(_0x2f6252,_0x21d75b){return function(_0x2c9f0a){if(_0x2c9f0a){return _0x2c9f0a['destroy']()[_0xf0ee('0x1b')](function(){_0x2f6252[_0xf0ee('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b595,_0x399f58){return function(_0x41dc40){if(!_0x41dc40){_0x28b595[_0xf0ee('0x13')](0x194);}return _0x41dc40;};}function handleError(_0x1a7fb8,_0x498ae9){_0x498ae9=_0x498ae9||0x1f4;return function(_0x430b41){logger[_0xf0ee('0x1c')](_0x430b41[_0xf0ee('0x1d')]);if(_0x430b41[_0xf0ee('0x1e')]){delete _0x430b41[_0xf0ee('0x1e')];}_0x1a7fb8[_0xf0ee('0x14')](_0x498ae9)[_0xf0ee('0x1f')](_0x430b41);};}exports[_0xf0ee('0x20')]=function(_0x75ef9e,_0x4a96ef){var _0x4a06bc={},_0xd40af2={},_0x2b7601={'count':0x0,'rows':[]};var _0x40d2d0=db[_0xf0ee('0x21')][_0xf0ee('0x22')];_0xd40af2[_0xf0ee('0x23')]=_['keys'](_0x40d2d0);var _0x197d7f={'dateStart':_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x25')],'dateEnd':_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x26')]};delete _0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x25')];delete _0x75ef9e['query'][_0xf0ee('0x26')];_0xd40af2['query']=_[_0xf0ee('0x27')](_0x75ef9e[_0xf0ee('0x24')]);_0xd40af2[_0xf0ee('0x28')]=_['intersection'](_0xd40af2[_0xf0ee('0x23')],_0xd40af2['query']);_0x4a06bc[_0xf0ee('0x29')]=_[_0xf0ee('0x2a')](_0xd40af2['model'],qs['fields'](_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x2b')]));_0x4a06bc[_0xf0ee('0x29')]=_0x4a06bc[_0xf0ee('0x29')][_0xf0ee('0x2c')]?_0x4a06bc[_0xf0ee('0x29')]:_0xd40af2['model'];if(!_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x2d')](_0xf0ee('0x2e'))){_0x4a06bc[_0xf0ee('0x2f')]=qs['limit'](_0x75ef9e[_0xf0ee('0x24')]['limit']);_0x4a06bc[_0xf0ee('0x16')]=qs[_0xf0ee('0x16')](_0x75ef9e['query']['offset']);}_0x4a06bc[_0xf0ee('0x30')]=qs[_0xf0ee('0x31')](_0x75ef9e['query'][_0xf0ee('0x31')]);_0x4a06bc[_0xf0ee('0x32')]=qs['filters'](_['pick'](_0x75ef9e[_0xf0ee('0x24')],_0xd40af2['filters']));if(_0x197d7f[_0xf0ee('0x25')]){if(_0x197d7f[_0xf0ee('0x26')]){_0x197d7f[_0xf0ee('0x26')]=moment(_0x197d7f['dateEnd'])[_0xf0ee('0x33')](0x1,'day');}else{_0x197d7f['dateEnd']=moment(_0x197d7f['dateStart'])[_0xf0ee('0x33')](0x1,_0xf0ee('0x34'));}_[_0xf0ee('0x35')](_0x4a06bc[_0xf0ee('0x32')],{'createdAt':{'$gte':_0x197d7f[_0xf0ee('0x25')],'$lte':_0x197d7f[_0xf0ee('0x26')]}});}if(_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x36')]){_0x4a06bc[_0xf0ee('0x32')]=_[_0xf0ee('0x35')](_0x4a06bc[_0xf0ee('0x32')],{'$or':_[_0xf0ee('0x37')](_0x4a06bc[_0xf0ee('0x29')],function(_0x6255c4){var _0x4c176d={};_0x4c176d[_0x6255c4]={'$like':'%'+_0x75ef9e[_0xf0ee('0x24')]['filter']+'%'};return _0x4c176d;})});}_0x4a06bc=_[_0xf0ee('0x35')]({},_0x4a06bc,_0x75ef9e['options']);var _0x1c0620={'where':_0x4a06bc['where']};return db[_0xf0ee('0x21')][_0xf0ee('0x38')](_0x1c0620)[_0xf0ee('0x1b')](function(_0x2405b5){_0x2b7601['count']=_0x2405b5;if(_0x75ef9e[_0xf0ee('0x24')][_0xf0ee('0x39')]){_0x4a06bc['include']=[{'all':!![]}];}return db[_0xf0ee('0x21')][_0xf0ee('0x3a')](_0x4a06bc);})[_0xf0ee('0x1b')](function(_0x3c0648){_0x2b7601[_0xf0ee('0x3b')]=_0x3c0648;return _0x2b7601;})[_0xf0ee('0x1b')](respondWithFilteredResult(_0x4a96ef,_0x4a06bc))[_0xf0ee('0x3c')](handleError(_0x4a96ef,null));};exports[_0xf0ee('0x3d')]=function(_0x428ddd,_0x586bfb){var _0x316bd1={'raw':!![],'where':{'id':_0x428ddd[_0xf0ee('0x3e')]['id']}},_0x15a535={};_0x15a535[_0xf0ee('0x23')]=_[_0xf0ee('0x27')](db[_0xf0ee('0x21')][_0xf0ee('0x22')]);_0x15a535['query']=_['keys'](_0x428ddd[_0xf0ee('0x24')]);_0x15a535[_0xf0ee('0x28')]=_[_0xf0ee('0x2a')](_0x15a535['model'],_0x15a535[_0xf0ee('0x24')]);_0x316bd1['attributes']=_[_0xf0ee('0x2a')](_0x15a535[_0xf0ee('0x23')],qs[_0xf0ee('0x2b')](_0x428ddd[_0xf0ee('0x24')][_0xf0ee('0x2b')]));_0x316bd1[_0xf0ee('0x29')]=_0x316bd1[_0xf0ee('0x29')][_0xf0ee('0x2c')]?_0x316bd1['attributes']:_0x15a535['model'];if(_0x428ddd[_0xf0ee('0x24')][_0xf0ee('0x39')]){_0x316bd1[_0xf0ee('0x3f')]=[{'all':!![]}];}_0x316bd1=_[_0xf0ee('0x35')]({},_0x316bd1,_0x428ddd[_0xf0ee('0x40')]);return db[_0xf0ee('0x21')][_0xf0ee('0x41')](_0x316bd1)[_0xf0ee('0x1b')](handleEntityNotFound(_0x586bfb,null))[_0xf0ee('0x1b')](respondWithResult(_0x586bfb,null))[_0xf0ee('0x3c')](handleError(_0x586bfb,null));};exports[_0xf0ee('0x42')]=function(_0x4c7652,_0x561b35){return db[_0xf0ee('0x21')][_0xf0ee('0x42')](_0x4c7652[_0xf0ee('0x43')],{})['then'](respondWithResult(_0x561b35,0xc9))[_0xf0ee('0x3c')](handleError(_0x561b35,null));};exports[_0xf0ee('0x1a')]=function(_0x5db157,_0x21f6df){if(_0x5db157[_0xf0ee('0x43')]['id']){delete _0x5db157[_0xf0ee('0x43')]['id'];}return db[_0xf0ee('0x21')][_0xf0ee('0x41')]({'where':{'id':_0x5db157[_0xf0ee('0x3e')]['id']}})[_0xf0ee('0x1b')](handleEntityNotFound(_0x21f6df,null))[_0xf0ee('0x1b')](saveUpdates(_0x5db157[_0xf0ee('0x43')],null))['then'](respondWithResult(_0x21f6df,null))[_0xf0ee('0x3c')](handleError(_0x21f6df,null));};exports['destroy']=function(_0x40cb3b,_0x1e867f){return db['SalesforceField']['find']({'where':{'id':_0x40cb3b[_0xf0ee('0x3e')]['id']}})[_0xf0ee('0x1b')](handleEntityNotFound(_0x1e867f,null))[_0xf0ee('0x1b')](removeEntity(_0x1e867f,null))['catch'](handleError(_0x1e867f,null));}; \ No newline at end of file +var _0xe703=['includeAll','include','rows','catch','show','params','find','create','body','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','limit','status','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','model','query','dateStart','dateEnd','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','add','day','merge','filter','options','SalesforceField'];(function(_0x58dc25,_0x49b9d5){var _0x21b0a7=function(_0x38a186){while(--_0x38a186){_0x58dc25['push'](_0x58dc25['shift']());}};_0x21b0a7(++_0x49b9d5);}(_0xe703,0x149));var _0x3e70=function(_0x13188a,_0x2f635f){_0x13188a=_0x13188a-0x0;var _0x2f5716=_0xe703[_0x13188a];return _0x2f5716;};'use strict';var jsonpatch=require(_0x3e70('0x0'));var rp=require(_0x3e70('0x1'));var moment=require(_0x3e70('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3e70('0x3'));var util=require(_0x3e70('0x4'));var path=require(_0x3e70('0x5'));var sox=require('sox');var csv=require(_0x3e70('0x6'));var ejs=require(_0x3e70('0x7'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e70('0x8'));var jsforce=require(_0x3e70('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x3e70('0x6'));var querystring=require(_0x3e70('0xa'));var Papa=require(_0x3e70('0xb'));var qs=require(_0x3e70('0xc'));var logger=require(_0x3e70('0xd'))(_0x3e70('0xe'));var utils=require(_0x3e70('0xf'));var config=require(_0x3e70('0x10'));var db=require(_0x3e70('0x11'))['db'];function respondWithStatusCode(_0x54a1fa,_0x274daf){_0x274daf=_0x274daf||0xcc;return function(_0x4fc118){if(_0x4fc118){return _0x54a1fa[_0x3e70('0x12')](_0x274daf);}return _0x54a1fa['status'](_0x274daf)[_0x3e70('0x13')]();};}function respondWithResult(_0x2fe8c3,_0x4b3786){_0x4b3786=_0x4b3786||0xc8;return function(_0x587c70){if(_0x587c70){return _0x2fe8c3['status'](_0x4b3786)['json'](_0x587c70);}};}function respondWithFilteredResult(_0xd94b1c,_0x34ea0c){return function(_0x12e4ba){if(_0x12e4ba){var _0x54f4cb=_0x12e4ba['count'],_0x5e2a40=_0x34ea0c[_0x3e70('0x14')],_0x1821a2=_0x34ea0c['offset']+_0x34ea0c[_0x3e70('0x15')],_0xed4105;if(_0x1821a2>=_0x54f4cb){_0x1821a2=_0x54f4cb;_0xed4105=0xc8;}else{_0xed4105=0xce;}_0xd94b1c[_0x3e70('0x16')](_0xed4105);return _0xd94b1c['set']('Content-Range',_0x5e2a40+'-'+_0x1821a2+'/'+_0x54f4cb)[_0x3e70('0x17')](_0x12e4ba);}return null;};}function patchUpdates(_0x2bf749){return function(_0x580e74){try{jsonpatch['apply'](_0x580e74,_0x2bf749,!![]);}catch(_0x233764){return BPromise['reject'](_0x233764);}return _0x580e74[_0x3e70('0x18')]();};}function saveUpdates(_0x5c2721,_0x484c4e){return function(_0x877053){if(_0x877053){return _0x877053[_0x3e70('0x19')](_0x5c2721)[_0x3e70('0x1a')](function(_0x1e6ed2){return _0x1e6ed2;});}return null;};}function removeEntity(_0x60d623,_0xb4e2ec){return function(_0x23ca89){if(_0x23ca89){return _0x23ca89[_0x3e70('0x1b')]()[_0x3e70('0x1a')](function(){_0x60d623[_0x3e70('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x498afe,_0x407da0){return function(_0x2ae811){if(!_0x2ae811){_0x498afe[_0x3e70('0x12')](0x194);}return _0x2ae811;};}function handleError(_0x579abd,_0xb40f73){_0xb40f73=_0xb40f73||0x1f4;return function(_0x526ace){logger[_0x3e70('0x1c')](_0x526ace[_0x3e70('0x1d')]);if(_0x526ace[_0x3e70('0x1e')]){delete _0x526ace[_0x3e70('0x1e')];}_0x579abd[_0x3e70('0x16')](_0xb40f73)[_0x3e70('0x1f')](_0x526ace);};}exports[_0x3e70('0x20')]=function(_0xeb879f,_0x1b5849){var _0x582d1c={},_0x5cbbc2={},_0x2f3cda={'count':0x0,'rows':[]};var _0x2d6436=db['SalesforceField'][_0x3e70('0x21')];_0x5cbbc2[_0x3e70('0x22')]=_['keys'](_0x2d6436);var _0x39c820={'dateStart':_0xeb879f[_0x3e70('0x23')][_0x3e70('0x24')],'dateEnd':_0xeb879f[_0x3e70('0x23')][_0x3e70('0x25')]};delete _0xeb879f[_0x3e70('0x23')][_0x3e70('0x24')];delete _0xeb879f[_0x3e70('0x23')]['dateEnd'];_0x5cbbc2[_0x3e70('0x23')]=_[_0x3e70('0x26')](_0xeb879f[_0x3e70('0x23')]);_0x5cbbc2['filters']=_[_0x3e70('0x27')](_0x5cbbc2[_0x3e70('0x22')],_0x5cbbc2['query']);_0x582d1c[_0x3e70('0x28')]=_['intersection'](_0x5cbbc2[_0x3e70('0x22')],qs['fields'](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x29')]));_0x582d1c[_0x3e70('0x28')]=_0x582d1c[_0x3e70('0x28')][_0x3e70('0x2a')]?_0x582d1c[_0x3e70('0x28')]:_0x5cbbc2[_0x3e70('0x22')];if(!_0xeb879f['query'][_0x3e70('0x2b')](_0x3e70('0x2c'))){_0x582d1c[_0x3e70('0x15')]=qs[_0x3e70('0x15')](_0xeb879f['query']['limit']);_0x582d1c[_0x3e70('0x14')]=qs[_0x3e70('0x14')](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x14')]);}_0x582d1c[_0x3e70('0x2d')]=qs[_0x3e70('0x2e')](_0xeb879f[_0x3e70('0x23')][_0x3e70('0x2e')]);_0x582d1c[_0x3e70('0x2f')]=qs[_0x3e70('0x30')](_['pick'](_0xeb879f['query'],_0x5cbbc2['filters']));if(_0x39c820[_0x3e70('0x24')]){if(_0x39c820['dateEnd']){_0x39c820['dateEnd']=moment(_0x39c820[_0x3e70('0x25')])[_0x3e70('0x31')](0x1,_0x3e70('0x32'));}else{_0x39c820[_0x3e70('0x25')]=moment(_0x39c820['dateStart'])[_0x3e70('0x31')](0x1,'day');}_[_0x3e70('0x33')](_0x582d1c[_0x3e70('0x2f')],{'createdAt':{'$gte':_0x39c820[_0x3e70('0x24')],'$lte':_0x39c820[_0x3e70('0x25')]}});}if(_0xeb879f[_0x3e70('0x23')][_0x3e70('0x34')]){_0x582d1c[_0x3e70('0x2f')]=_[_0x3e70('0x33')](_0x582d1c['where'],{'$or':_['map'](_0x582d1c[_0x3e70('0x28')],function(_0x1ca8b1){var _0x3cad15={};_0x3cad15[_0x1ca8b1]={'$like':'%'+_0xeb879f['query'][_0x3e70('0x34')]+'%'};return _0x3cad15;})});}_0x582d1c=_[_0x3e70('0x33')]({},_0x582d1c,_0xeb879f[_0x3e70('0x35')]);var _0x2dd0b5={'where':_0x582d1c['where']};return db[_0x3e70('0x36')]['count'](_0x2dd0b5)[_0x3e70('0x1a')](function(_0x489d73){_0x2f3cda['count']=_0x489d73;if(_0xeb879f[_0x3e70('0x23')][_0x3e70('0x37')]){_0x582d1c[_0x3e70('0x38')]=[{'all':!![]}];}return db[_0x3e70('0x36')]['findAll'](_0x582d1c);})['then'](function(_0x5e85e0){_0x2f3cda[_0x3e70('0x39')]=_0x5e85e0;return _0x2f3cda;})[_0x3e70('0x1a')](respondWithFilteredResult(_0x1b5849,_0x582d1c))[_0x3e70('0x3a')](handleError(_0x1b5849,null));};exports[_0x3e70('0x3b')]=function(_0xf28beb,_0x3124fa){var _0x5b19e8={'raw':!![],'where':{'id':_0xf28beb[_0x3e70('0x3c')]['id']}},_0x2c6334={};_0x2c6334['model']=_[_0x3e70('0x26')](db['SalesforceField'][_0x3e70('0x21')]);_0x2c6334[_0x3e70('0x23')]=_[_0x3e70('0x26')](_0xf28beb[_0x3e70('0x23')]);_0x2c6334[_0x3e70('0x30')]=_[_0x3e70('0x27')](_0x2c6334[_0x3e70('0x22')],_0x2c6334[_0x3e70('0x23')]);_0x5b19e8[_0x3e70('0x28')]=_['intersection'](_0x2c6334[_0x3e70('0x22')],qs[_0x3e70('0x29')](_0xf28beb['query']['fields']));_0x5b19e8[_0x3e70('0x28')]=_0x5b19e8['attributes'][_0x3e70('0x2a')]?_0x5b19e8[_0x3e70('0x28')]:_0x2c6334[_0x3e70('0x22')];if(_0xf28beb[_0x3e70('0x23')][_0x3e70('0x37')]){_0x5b19e8[_0x3e70('0x38')]=[{'all':!![]}];}_0x5b19e8=_[_0x3e70('0x33')]({},_0x5b19e8,_0xf28beb[_0x3e70('0x35')]);return db[_0x3e70('0x36')][_0x3e70('0x3d')](_0x5b19e8)[_0x3e70('0x1a')](handleEntityNotFound(_0x3124fa,null))[_0x3e70('0x1a')](respondWithResult(_0x3124fa,null))['catch'](handleError(_0x3124fa,null));};exports[_0x3e70('0x3e')]=function(_0x3c9a9c,_0x1f4210){return db[_0x3e70('0x36')][_0x3e70('0x3e')](_0x3c9a9c[_0x3e70('0x3f')],{})['then'](respondWithResult(_0x1f4210,0xc9))[_0x3e70('0x3a')](handleError(_0x1f4210,null));};exports['update']=function(_0x38c6f3,_0x29673b){if(_0x38c6f3[_0x3e70('0x3f')]['id']){delete _0x38c6f3[_0x3e70('0x3f')]['id'];}return db[_0x3e70('0x36')][_0x3e70('0x3d')]({'where':{'id':_0x38c6f3[_0x3e70('0x3c')]['id']}})[_0x3e70('0x1a')](handleEntityNotFound(_0x29673b,null))[_0x3e70('0x1a')](saveUpdates(_0x38c6f3['body'],null))[_0x3e70('0x1a')](respondWithResult(_0x29673b,null))['catch'](handleError(_0x29673b,null));};exports['destroy']=function(_0x4fdfd7,_0x4db77c){return db[_0x3e70('0x36')][_0x3e70('0x3d')]({'where':{'id':_0x4fdfd7[_0x3e70('0x3c')]['id']}})[_0x3e70('0x1a')](handleEntityNotFound(_0x4db77c,null))[_0x3e70('0x1a')](removeEntity(_0x4db77c,null))[_0x3e70('0x3a')](handleError(_0x4db77c,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index dc9bbc4..0b95345 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 _0xbd6d=['util','../../config/logger','api','moment','request-promise','./intSalesforceField.attributes','exports','int_salesforce_fields','lodash'];(function(_0x22658d,_0x328f29){var _0x49a56b=function(_0x27b3a7){while(--_0x27b3a7){_0x22658d['push'](_0x22658d['shift']());}};_0x49a56b(++_0x328f29);}(_0xbd6d,0xc5));var _0xdbd6=function(_0x58dbe0,_0x429360){_0x58dbe0=_0x58dbe0-0x0;var _0x3b7e28=_0xbd6d[_0x58dbe0];return _0x3b7e28;};'use strict';var _=require(_0xdbd6('0x0'));var util=require(_0xdbd6('0x1'));var logger=require(_0xdbd6('0x2'))(_0xdbd6('0x3'));var moment=require(_0xdbd6('0x4'));var BPromise=require('bluebird');var rp=require(_0xdbd6('0x5'));var attributes=require(_0xdbd6('0x6'));module[_0xdbd6('0x7')]=function(_0x47d153,_0x145a5f){return _0x47d153['define']('SalesforceField',attributes,{'tableName':_0xdbd6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf161=['define','int_salesforce_fields','lodash','util','api','bluebird','request-promise','exports'];(function(_0x5e6e15,_0x1cdfcf){var _0x2e8e41=function(_0x3ed20e){while(--_0x3ed20e){_0x5e6e15['push'](_0x5e6e15['shift']());}};_0x2e8e41(++_0x1cdfcf);}(_0xf161,0xa2));var _0x1f16=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xf161[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0x1f16('0x0'));var util=require(_0x1f16('0x1'));var logger=require('../../config/logger')(_0x1f16('0x2'));var moment=require('moment');var BPromise=require(_0x1f16('0x3'));var rp=require(_0x1f16('0x4'));var attributes=require('./intSalesforceField.attributes');module[_0x1f16('0x5')]=function(_0x449f46,_0x521ebb){return _0x449f46[_0x1f16('0x6')]('SalesforceField',attributes,{'tableName':_0x1f16('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 8d0b813..c08f0ab 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 _0x913b=['SalesforceField,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x293a6b,_0x3b9ede){var _0x2d371c=function(_0x2b115a){while(--_0x2b115a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x2d371c(++_0x3b9ede);}(_0x913b,0x10a));var _0xb913=function(_0x4eda22,_0x3d2db4){_0x4eda22=_0x4eda22-0x0;var _0x4a5706=_0x913b[_0x4eda22];return _0x4a5706;};'use strict';var _=require(_0xb913('0x0'));var util=require(_0xb913('0x1'));var moment=require(_0xb913('0x2'));var BPromise=require(_0xb913('0x3'));var rs=require(_0xb913('0x4'));var fs=require('fs');var db=require(_0xb913('0x5'))['db'];var utils=require(_0xb913('0x6'));var logger=require(_0xb913('0x7'))(_0xb913('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb913('0x9')][_0xb913('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50247f,_0x128995,_0x57c6a1){return new BPromise(function(_0x29a71b,_0x4c2f3a){return client[_0xb913('0xb')](_0x50247f,_0x57c6a1)[_0xb913('0xc')](function(_0xfe4794){logger[_0xb913('0xd')](_0xb913('0xe'),_0x128995,_0xb913('0xf'));logger['debug']('SalesforceField,\x20%s,\x20%s,\x20%s',_0x128995,_0xb913('0xf'),JSON['stringify'](_0xfe4794));if(_0xfe4794[_0xb913('0x10')]){if(_0xfe4794[_0xb913('0x10')]['code']===0x1f4){logger[_0xb913('0x10')](_0xb913('0xe'),_0x128995,_0xfe4794['error'][_0xb913('0x11')]);return _0x4c2f3a(_0xfe4794[_0xb913('0x10')][_0xb913('0x11')]);}logger['error'](_0xb913('0xe'),_0x128995,_0xfe4794[_0xb913('0x10')][_0xb913('0x11')]);return _0x29a71b(_0xfe4794[_0xb913('0x10')][_0xb913('0x11')]);}else{logger[_0xb913('0xd')](_0xb913('0xe'),_0x128995,_0xb913('0xf'));_0x29a71b(_0xfe4794[_0xb913('0x12')][_0xb913('0x11')]);}})[_0xb913('0x13')](function(_0x3fd8b3){logger[_0xb913('0x10')](_0xb913('0xe'),_0x128995,_0x3fd8b3);_0x4c2f3a(_0x3fd8b3);});});} \ No newline at end of file +var _0x21bf=['stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5f2134,_0x319f6d){var _0x4c7887=function(_0x1a3118){while(--_0x1a3118){_0x5f2134['push'](_0x5f2134['shift']());}};_0x4c7887(++_0x319f6d);}(_0x21bf,0x1d4));var _0xf21b=function(_0x39277b,_0x3a84b4){_0x39277b=_0x39277b-0x0;var _0x17627f=_0x21bf[_0x39277b];return _0x17627f;};'use strict';var _=require(_0xf21b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf21b('0x1'));var rs=require(_0xf21b('0x2'));var fs=require('fs');var db=require(_0xf21b('0x3'))['db'];var utils=require(_0xf21b('0x4'));var logger=require(_0xf21b('0x5'))(_0xf21b('0x6'));var config=require(_0xf21b('0x7'));var jayson=require(_0xf21b('0x8'));var client=jayson['client'][_0xf21b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x593ef8,_0x5d0537,_0x21e4e3){return new BPromise(function(_0x12c9b3,_0x2f7d18){return client[_0xf21b('0xa')](_0x593ef8,_0x21e4e3)[_0xf21b('0xb')](function(_0x4619b4){logger['info'](_0xf21b('0xc'),_0x5d0537,_0xf21b('0xd'));logger[_0xf21b('0xe')](_0xf21b('0xf'),_0x5d0537,_0xf21b('0xd'),JSON[_0xf21b('0x10')](_0x4619b4));if(_0x4619b4[_0xf21b('0x11')]){if(_0x4619b4[_0xf21b('0x11')][_0xf21b('0x12')]===0x1f4){logger['error'](_0xf21b('0xc'),_0x5d0537,_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);return _0x2f7d18(_0x4619b4['error']['message']);}logger[_0xf21b('0x11')]('SalesforceField,\x20%s,\x20%s',_0x5d0537,_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);return _0x12c9b3(_0x4619b4[_0xf21b('0x11')][_0xf21b('0x13')]);}else{logger['info'](_0xf21b('0xc'),_0x5d0537,'request\x20sent');_0x12c9b3(_0x4619b4[_0xf21b('0x14')][_0xf21b('0x13')]);}})[_0xf21b('0x15')](function(_0x18280f){logger[_0xf21b('0x11')](_0xf21b('0xc'),_0x5d0537,_0x18280f);_0x2f7d18(_0x18280f);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index fe951da..dd01004 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 _0x52dc=['Router','../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path'];(function(_0x57d176,_0x245db7){var _0x47ffbf=function(_0x67109b){while(--_0x67109b){_0x57d176['push'](_0x57d176['shift']());}};_0x47ffbf(++_0x245db7);}(_0x52dc,0x178));var _0xc52d=function(_0xc6164b,_0x58eafe){_0xc6164b=_0xc6164b-0x0;var _0x463d70=_0x52dc[_0xc6164b];return _0x463d70;};'use strict';var multer=require('multer');var util=require(_0xc52d('0x0'));var path=require(_0xc52d('0x1'));var express=require('express');var router=express[_0xc52d('0x2')]();var auth=require(_0xc52d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc52d('0x4'));var controller=require(_0xc52d('0x5'));router[_0xc52d('0x6')]('/',auth[_0xc52d('0x7')](),controller[_0xc52d('0x8')]);router[_0xc52d('0x6')](_0xc52d('0x9'),auth[_0xc52d('0x7')](),controller['show']);router[_0xc52d('0x6')](_0xc52d('0xa'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xc52d('0x6')](_0xc52d('0xb'),auth['isAuthenticated'](),controller[_0xc52d('0xc')]);router[_0xc52d('0xd')]('/',auth['isAuthenticated'](),controller[_0xc52d('0xe')]);router['post'](_0xc52d('0xa'),auth[_0xc52d('0x7')](),controller[_0xc52d('0xf')]);router[_0xc52d('0x10')]('/:id',auth[_0xc52d('0x7')](),controller[_0xc52d('0x11')]);router[_0xc52d('0x12')](_0xc52d('0x9'),auth[_0xc52d('0x7')](),controller[_0xc52d('0x13')]);module[_0xc52d('0x14')]=router; \ No newline at end of file +var _0x3f1b=['../../components/auth/service','../../config/environment','./intSugarcrmAccount.controller','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','multer','util','path','Router'];(function(_0x484835,_0x35e6da){var _0x7b9306=function(_0x38f8ec){while(--_0x38f8ec){_0x484835['push'](_0x484835['shift']());}};_0x7b9306(++_0x35e6da);}(_0x3f1b,0x178));var _0xb3f1=function(_0x1fbbc4,_0x543f0b){_0x1fbbc4=_0x1fbbc4-0x0;var _0x5e7ef3=_0x3f1b[_0x1fbbc4];return _0x5e7ef3;};'use strict';var multer=require(_0xb3f1('0x0'));var util=require(_0xb3f1('0x1'));var path=require(_0xb3f1('0x2'));var express=require('express');var router=express[_0xb3f1('0x3')]();var auth=require(_0xb3f1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb3f1('0x5'));var controller=require(_0xb3f1('0x6'));router[_0xb3f1('0x7')]('/',auth[_0xb3f1('0x8')](),controller['index']);router[_0xb3f1('0x7')]('/:id',auth[_0xb3f1('0x8')](),controller['show']);router[_0xb3f1('0x7')](_0xb3f1('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb3f1('0x7')](_0xb3f1('0xa'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0xb')]);router[_0xb3f1('0xc')]('/',auth[_0xb3f1('0x8')](),controller[_0xb3f1('0xd')]);router[_0xb3f1('0xc')](_0xb3f1('0x9'),auth['isAuthenticated'](),controller[_0xb3f1('0xe')]);router[_0xb3f1('0xf')](_0xb3f1('0x10'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0x11')]);router[_0xb3f1('0x12')](_0xb3f1('0x10'),auth[_0xb3f1('0x8')](),controller[_0xb3f1('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index f62c52c..20fd0e0 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 _0xe542=['remoteUri','sequelize','exports','STRING'];(function(_0x26ec0e,_0x55d2e3){var _0x4da538=function(_0x2aecf0){while(--_0x2aecf0){_0x26ec0e['push'](_0x26ec0e['shift']());}};_0x4da538(++_0x55d2e3);}(_0xe542,0x16d));var _0x2e54=function(_0x422a85,_0x3d047a){_0x422a85=_0x422a85-0x0;var _0x1be50f=_0xe542[_0x422a85];return _0x1be50f;};'use strict';var Sequelize=require(_0x2e54('0x0'));module[_0x2e54('0x1')]={'name':{'type':Sequelize[_0x2e54('0x2')]},'description':{'type':Sequelize[_0x2e54('0x2')]},'username':{'type':Sequelize[_0x2e54('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2e54('0x2')],'unique':_0x2e54('0x3')},'serverUrl':{'type':Sequelize[_0x2e54('0x2')]}}; \ No newline at end of file +var _0xd2b7=['STRING','username','sequelize','exports'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xd2b7,0x1f2));var _0x7d2b=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0xd2b7[_0x50f0a9];return _0x5a33d9;};'use strict';var Sequelize=require(_0x7d2b('0x0'));module[_0x7d2b('0x1')]={'name':{'type':Sequelize[_0x7d2b('0x2')]},'description':{'type':Sequelize[_0x7d2b('0x2')]},'username':{'type':Sequelize[_0x7d2b('0x2')],'unique':_0x7d2b('0x3')},'password':{'type':Sequelize[_0x7d2b('0x2')]},'remoteUri':{'type':Sequelize[_0x7d2b('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x7d2b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 2ffd035..6144840 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 _0x093c=['../../components/integrations/configuration','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','destroy','stack','name','send','index','SugarcrmAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','sort','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','SugarcrmField','getFields','username','password','remoteUri','POST','format','login','JSON','xCALLY\x20Motion\x20Integration','%s%s','/service/v4_1/rest.php','Calls','values','module_fields','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','request-promise','moment','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb'];(function(_0x158eb5,_0x53e90f){var _0x364709=function(_0x49c494){while(--_0x49c494){_0x158eb5['push'](_0x158eb5['shift']());}};_0x364709(++_0x53e90f);}(_0x093c,0xcd));var _0xc093=function(_0x3071f5,_0x586f50){_0x3071f5=_0x3071f5-0x0;var _0xed8c60=_0x093c[_0x3071f5];return _0xed8c60;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc093('0x0'));var moment=require(_0xc093('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc093('0x2'));var util=require(_0xc093('0x3'));var path=require('path');var sox=require(_0xc093('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xc093('0x5'));var squel=require('squel');var crypto=require(_0xc093('0x6'));var jsforce=require(_0xc093('0x7'));var deskjs=require(_0xc093('0x8'));var toCsv=require(_0xc093('0x9'));var querystring=require(_0xc093('0xa'));var Papa=require('papaparse');var qs=require(_0xc093('0xb'));var logger=require(_0xc093('0xc'))('api');var utils=require(_0xc093('0xd'));var config=require('../../config/environment');var db=require(_0xc093('0xe'))['db'];var integrations=require(_0xc093('0xf'));var jayson=require(_0xc093('0x10'));var client=jayson['client'][_0xc093('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x23ce37,_0x549f8f,_0x201fbb,_0x2a2b40){return new BPromise(function(_0x328f3a,_0xb879c2){var _0x2b1617=_0x2a2b40||client;return _0x2b1617[_0xc093('0x12')](_0x23ce37,_0x201fbb)[_0xc093('0x13')](function(_0x4481d7){logger[_0xc093('0x14')](_0xc093('0x15'),_0x549f8f,_0xc093('0x16'));logger['debug'](_0xc093('0x17'),_0x549f8f,_0xc093('0x16'),JSON[_0xc093('0x18')](_0x4481d7));if(_0x4481d7[_0xc093('0x19')]){if(_0x4481d7['error'][_0xc093('0x1a')]===0x1f4){logger[_0xc093('0x19')]('SugarcrmAccount,\x20%s,\x20%s',_0x549f8f,_0x4481d7[_0xc093('0x19')]['message']);return _0xb879c2(_0x4481d7[_0xc093('0x19')][_0xc093('0x1b')]);}logger[_0xc093('0x19')]('SugarcrmAccount,\x20%s,\x20%s',_0x549f8f,_0x4481d7[_0xc093('0x19')][_0xc093('0x1b')]);return _0x328f3a(_0x4481d7[_0xc093('0x19')][_0xc093('0x1b')]);}else{logger[_0xc093('0x14')](_0xc093('0x15'),_0x549f8f,'request\x20sent');_0x328f3a(_0x4481d7['result']['message']);}})[_0xc093('0x1c')](function(_0x33854a){logger['error'](_0xc093('0x15'),_0x549f8f,_0x33854a);_0xb879c2(_0x33854a);});});}function respondWithStatusCode(_0x16404b,_0x42be7d){_0x42be7d=_0x42be7d||0xcc;return function(_0x203b61){if(_0x203b61){return _0x16404b[_0xc093('0x1d')](_0x42be7d);}return _0x16404b[_0xc093('0x1e')](_0x42be7d)[_0xc093('0x1f')]();};}function respondWithResult(_0x10446b,_0x20e9f1){_0x20e9f1=_0x20e9f1||0xc8;return function(_0x29a20a){if(_0x29a20a){return _0x10446b[_0xc093('0x1e')](_0x20e9f1)[_0xc093('0x20')](_0x29a20a);}};}function respondWithFilteredResult(_0x56e629,_0xd99194){return function(_0x160198){if(_0x160198){var _0x216906=_0x160198[_0xc093('0x21')],_0x130c89=_0xd99194[_0xc093('0x22')],_0xfa666f=_0xd99194[_0xc093('0x22')]+_0xd99194['limit'],_0x1aa10a;if(_0xfa666f>=_0x216906){_0xfa666f=_0x216906;_0x1aa10a=0xc8;}else{_0x1aa10a=0xce;}_0x56e629['status'](_0x1aa10a);return _0x56e629[_0xc093('0x23')](_0xc093('0x24'),_0x130c89+'-'+_0xfa666f+'/'+_0x216906)[_0xc093('0x20')](_0x160198);}return null;};}function patchUpdates(_0x36581a){return function(_0x16bda9){try{jsonpatch[_0xc093('0x25')](_0x16bda9,_0x36581a,!![]);}catch(_0x32d2ee){return BPromise['reject'](_0x32d2ee);}return _0x16bda9[_0xc093('0x26')]();};}function saveUpdates(_0xa46c1b,_0x2344a6){return function(_0x458d23){if(_0x458d23){return _0x458d23['update'](_0xa46c1b)[_0xc093('0x13')](function(_0x170ac3){return _0x170ac3;});}return null;};}function removeEntity(_0x265799,_0x3dbad6){return function(_0x4dd4c7){if(_0x4dd4c7){return _0x4dd4c7[_0xc093('0x27')]()[_0xc093('0x13')](function(){_0x265799[_0xc093('0x1e')](0xcc)[_0xc093('0x1f')]();});}};}function handleEntityNotFound(_0x337b75,_0x3e7c96){return function(_0x5ba099){if(!_0x5ba099){_0x337b75['sendStatus'](0x194);}return _0x5ba099;};}function handleError(_0xe476b9,_0x491b0a){_0x491b0a=_0x491b0a||0x1f4;return function(_0x185d59){logger[_0xc093('0x19')](_0x185d59[_0xc093('0x28')]);if(_0x185d59[_0xc093('0x29')]){delete _0x185d59[_0xc093('0x29')];}_0xe476b9['status'](_0x491b0a)[_0xc093('0x2a')](_0x185d59);};}exports[_0xc093('0x2b')]=function(_0x46612c,_0x16d1eb){var _0x42966c={},_0x279755={},_0xe5a5f8={'count':0x0,'rows':[]};var _0x3db020=db[_0xc093('0x2c')][_0xc093('0x2d')];_0x279755['model']=_[_0xc093('0x2e')](_0x3db020);var _0x4d8cf3={'dateStart':_0x46612c[_0xc093('0x2f')][_0xc093('0x30')],'dateEnd':_0x46612c[_0xc093('0x2f')][_0xc093('0x31')]};delete _0x46612c['query'][_0xc093('0x30')];delete _0x46612c[_0xc093('0x2f')][_0xc093('0x31')];_0x279755['query']=_[_0xc093('0x2e')](_0x46612c[_0xc093('0x2f')]);_0x279755[_0xc093('0x32')]=_[_0xc093('0x33')](_0x279755[_0xc093('0x34')],_0x279755[_0xc093('0x2f')]);_0x42966c[_0xc093('0x35')]=_[_0xc093('0x33')](_0x279755[_0xc093('0x34')],qs[_0xc093('0x36')](_0x46612c[_0xc093('0x2f')][_0xc093('0x36')]));_0x42966c[_0xc093('0x35')]=_0x42966c[_0xc093('0x35')][_0xc093('0x37')]?_0x42966c[_0xc093('0x35')]:_0x279755[_0xc093('0x34')];if(!_0x46612c[_0xc093('0x2f')][_0xc093('0x38')](_0xc093('0x39'))){_0x42966c[_0xc093('0x3a')]=qs[_0xc093('0x3a')](_0x46612c[_0xc093('0x2f')][_0xc093('0x3a')]);_0x42966c[_0xc093('0x22')]=qs[_0xc093('0x22')](_0x46612c[_0xc093('0x2f')][_0xc093('0x22')]);}_0x42966c[_0xc093('0x3b')]=qs['sort'](_0x46612c[_0xc093('0x2f')]['sort']);_0x42966c[_0xc093('0x3c')]=qs[_0xc093('0x32')](_['pick'](_0x46612c['query'],_0x279755[_0xc093('0x32')]));if(_0x4d8cf3['dateStart']){if(_0x4d8cf3[_0xc093('0x31')]){_0x4d8cf3[_0xc093('0x31')]=moment(_0x4d8cf3['dateEnd'])[_0xc093('0x3d')](0x1,'day');}else{_0x4d8cf3['dateEnd']=moment(_0x4d8cf3[_0xc093('0x30')])[_0xc093('0x3d')](0x1,_0xc093('0x3e'));}_[_0xc093('0x3f')](_0x42966c['where'],{'createdAt':{'$gte':_0x4d8cf3['dateStart'],'$lte':_0x4d8cf3['dateEnd']}});}if(_0x46612c[_0xc093('0x2f')][_0xc093('0x40')]){_0x42966c[_0xc093('0x3c')]=_[_0xc093('0x3f')](_0x42966c[_0xc093('0x3c')],{'$or':_[_0xc093('0x41')](_0x42966c['attributes'],function(_0x2eda9d){var _0x47148e={};_0x47148e[_0x2eda9d]={'$like':'%'+_0x46612c['query'][_0xc093('0x40')]+'%'};return _0x47148e;})});}_0x42966c=_[_0xc093('0x3f')]({},_0x42966c,_0x46612c[_0xc093('0x42')]);var _0x5c6660={'where':_0x42966c[_0xc093('0x3c')]};return db['SugarcrmAccount'][_0xc093('0x21')](_0x5c6660)[_0xc093('0x13')](function(_0x3ff3fc){_0xe5a5f8['count']=_0x3ff3fc;if(_0x46612c['query'][_0xc093('0x43')]){_0x42966c[_0xc093('0x44')]=[{'all':!![]}];}return db[_0xc093('0x2c')][_0xc093('0x45')](_0x42966c);})[_0xc093('0x13')](function(_0x307b9f){_0xe5a5f8[_0xc093('0x46')]=_0x307b9f;return _0xe5a5f8;})[_0xc093('0x13')](respondWithFilteredResult(_0x16d1eb,_0x42966c))['catch'](handleError(_0x16d1eb,null));};exports[_0xc093('0x47')]=function(_0x74cbd7,_0x34ad57){var _0x427b24={'raw':![],'where':{'id':_0x74cbd7[_0xc093('0x48')]['id']}},_0x1fea49={};_0x1fea49['model']=_[_0xc093('0x2e')](db[_0xc093('0x2c')][_0xc093('0x2d')]);_0x1fea49['query']=_[_0xc093('0x2e')](_0x74cbd7[_0xc093('0x2f')]);_0x1fea49[_0xc093('0x32')]=_[_0xc093('0x33')](_0x1fea49[_0xc093('0x34')],_0x1fea49['query']);_0x427b24[_0xc093('0x35')]=_[_0xc093('0x33')](_0x1fea49['model'],qs[_0xc093('0x36')](_0x74cbd7[_0xc093('0x2f')][_0xc093('0x36')]));_0x427b24[_0xc093('0x35')]=_0x427b24[_0xc093('0x35')][_0xc093('0x37')]?_0x427b24[_0xc093('0x35')]:_0x1fea49['model'];if(_0x74cbd7[_0xc093('0x2f')][_0xc093('0x43')]){_0x427b24['include']=[{'all':!![]}];}_0x427b24=_[_0xc093('0x3f')]({},_0x427b24,_0x74cbd7[_0xc093('0x42')]);return db[_0xc093('0x2c')]['find'](_0x427b24)[_0xc093('0x13')](handleEntityNotFound(_0x34ad57,null))[_0xc093('0x13')](respondWithResult(_0x34ad57,null))[_0xc093('0x1c')](handleError(_0x34ad57,null));};exports[_0xc093('0x49')]=function(_0x26ba33,_0x40bc5c){return db[_0xc093('0x2c')][_0xc093('0x49')](_0x26ba33[_0xc093('0x4a')],{})['then'](respondWithResult(_0x40bc5c,0xc9))[_0xc093('0x1c')](handleError(_0x40bc5c,null));};exports['update']=function(_0x2d903d,_0x72174b){if(_0x2d903d['body']['id']){delete _0x2d903d[_0xc093('0x4a')]['id'];}return db[_0xc093('0x2c')][_0xc093('0x4b')]({'where':{'id':_0x2d903d[_0xc093('0x48')]['id']}})['then'](handleEntityNotFound(_0x72174b,null))['then'](saveUpdates(_0x2d903d['body'],null))['then'](respondWithResult(_0x72174b,null))[_0xc093('0x1c')](handleError(_0x72174b,null));};exports[_0xc093('0x27')]=function(_0x5b0e94,_0x543784){return db[_0xc093('0x2c')][_0xc093('0x4b')]({'where':{'id':_0x5b0e94['params']['id']}})['then'](handleEntityNotFound(_0x543784,null))[_0xc093('0x13')](removeEntity(_0x543784,null))['catch'](handleError(_0x543784,null));};exports[_0xc093('0x4c')]=function(_0x2a6c69,_0x122224,_0xf52b24){var _0x51f426={};var _0x51750f={};var _0x2cf852;var _0x2305a2;return db[_0xc093('0x2c')][_0xc093('0x4d')]({'where':{'id':_0x2a6c69[_0xc093('0x48')]['id']}})[_0xc093('0x13')](handleEntityNotFound(_0x122224,null))[_0xc093('0x13')](function(_0x3b635f){if(_0x3b635f){_0x2cf852=_0x3b635f;_0x51750f[_0xc093('0x34')]=_[_0xc093('0x2e')](db[_0xc093('0x4e')][_0xc093('0x2d')]);_0x51750f[_0xc093('0x2f')]=_['keys'](_0x2a6c69[_0xc093('0x2f')]);_0x51750f['filters']=_[_0xc093('0x33')](_0x51750f[_0xc093('0x34')],_0x51750f[_0xc093('0x2f')]);_0x51f426[_0xc093('0x35')]=_[_0xc093('0x33')](_0x51750f[_0xc093('0x34')],qs[_0xc093('0x36')](_0x2a6c69[_0xc093('0x2f')][_0xc093('0x36')]));_0x51f426[_0xc093('0x35')]=_0x51f426[_0xc093('0x35')][_0xc093('0x37')]?_0x51f426[_0xc093('0x35')]:_0x51750f[_0xc093('0x34')];_0x51f426['order']=qs[_0xc093('0x4f')](_0x2a6c69['query'][_0xc093('0x4f')]);_0x51f426[_0xc093('0x3c')]=qs['filters'](_[_0xc093('0x50')](_0x2a6c69[_0xc093('0x2f')],_0x51750f[_0xc093('0x32')]));if(_0x2a6c69['query']['filter']){_0x51f426[_0xc093('0x3c')]=_[_0xc093('0x3f')](_0x51f426[_0xc093('0x3c')],{'$or':_[_0xc093('0x41')](_0x51f426[_0xc093('0x35')],function(_0x199974){var _0x564c06={};_0x564c06[_0x199974]={'$like':'%'+_0x2a6c69[_0xc093('0x2f')][_0xc093('0x40')]+'%'};return _0x564c06;})});}_0x51f426=_['merge']({},_0x51f426,_0x2a6c69[_0xc093('0x42')]);return _0x2cf852[_0xc093('0x4c')](_0x51f426);}})[_0xc093('0x13')](function(_0x26d09a){if(_0x26d09a){_0x2305a2=_0x26d09a[_0xc093('0x37')];if(!_0x2a6c69[_0xc093('0x2f')][_0xc093('0x38')](_0xc093('0x39'))){_0x51f426['limit']=qs[_0xc093('0x3a')](_0x2a6c69[_0xc093('0x2f')][_0xc093('0x3a')]);_0x51f426[_0xc093('0x22')]=qs[_0xc093('0x22')](_0x2a6c69[_0xc093('0x2f')][_0xc093('0x22')]);}return _0x2cf852[_0xc093('0x4c')](_0x51f426);}})['then'](function(_0x2ebd6f){if(_0x2ebd6f){return _0x2ebd6f?{'count':_0x2305a2,'rows':_0x2ebd6f}:null;}})[_0xc093('0x13')](respondWithResult(_0x122224,null))[_0xc093('0x1c')](handleError(_0x122224,null));};exports[_0xc093('0x51')]=function(_0x1bebdb,_0x1617e9,_0x24b797){if(_0x1bebdb[_0xc093('0x4a')]['id']){delete _0x1bebdb['body']['id'];}return db[_0xc093('0x2c')][_0xc093('0x4d')]({'where':{'id':_0x1bebdb['params']['id']}})[_0xc093('0x13')](handleEntityNotFound(_0x1617e9,null))[_0xc093('0x13')](function(_0x1c923a){if(_0x1c923a){_0x1bebdb[_0xc093('0x4a')][_0xc093('0x52')]=_0x1c923a['id'];_0x1bebdb['body'][_0xc093('0x53')]=integrations[_0xc093('0x54')](_0x1bebdb['body'][_0xc093('0x55')],_0x1bebdb[_0xc093('0x4a')][_0xc093('0x56')]);_0x1bebdb[_0xc093('0x4a')][_0xc093('0x57')]=integrations[_0xc093('0x58')](_0x1bebdb[_0xc093('0x4a')][_0xc093('0x55')],_0x1bebdb[_0xc093('0x4a')][_0xc093('0x56')]);return db[_0xc093('0x4e')][_0xc093('0x49')](_0x1bebdb[_0xc093('0x4a')],{'include':[{'model':db[_0xc093('0x59')],'as':_0xc093('0x53')},{'model':db['SugarcrmField'],'as':_0xc093('0x57')}]});}return null;})[_0xc093('0x13')](respondWithResult(_0x1617e9,null))[_0xc093('0x1c')](handleError(_0x1617e9,null));};exports[_0xc093('0x5a')]=function(_0x2cefca,_0xf8ab8c,_0x462bdf){var _0x4d1529;return db[_0xc093('0x2c')][_0xc093('0x4d')]({'where':{'id':_0x2cefca[_0xc093('0x48')]['id']},'attributes':['id',_0xc093('0x5b'),_0xc093('0x5c'),_0xc093('0x5d')]})[_0xc093('0x13')](handleEntityNotFound(_0xf8ab8c,null))[_0xc093('0x13')](function(_0x4ce9b1){if(_0x4ce9b1){_0x4d1529=_0x4ce9b1[_0xc093('0x5d')];return rp({'method':_0xc093('0x5e'),'uri':util[_0xc093('0x5f')]('%s%s',_0x4d1529,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xc093('0x60'),'input_type':_0xc093('0x61'),'response_type':_0xc093('0x61'),'rest_data':JSON[_0xc093('0x18')]({'user_auth':{'user_name':_0x4ce9b1[_0xc093('0x5b')],'password':_0x4ce9b1[_0xc093('0x5c')],'encryption':'PLAIN'},'application':_0xc093('0x62')})}});}})['then'](function(_0xd648a2){if(_0xd648a2){return rp({'method':_0xc093('0x5e'),'uri':util[_0xc093('0x5f')](_0xc093('0x63'),_0x4d1529,_0xc093('0x64')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xc093('0x61'),'response_type':_0xc093('0x61'),'rest_data':JSON[_0xc093('0x18')]({'session':_0xd648a2['id'],'module_name':_0xc093('0x65')})}});}})['then'](function(_0x456722){if(_0x456722){var _0x217886=_[_0xc093('0x66')](_0x456722[_0xc093('0x67')]);return{'count':_0x217886[_0xc093('0x37')],'rows':_[_0xc093('0x41')](_0x217886,function(_0x52cb97){return{'id':_0x52cb97['name'],'name':_0x52cb97[_0xc093('0x68')],'custom':_[_0xc093('0x69')](_0x52cb97[_0xc093('0x29')],'_c')?!![]:![],'options':_0x52cb97[_0xc093('0x42')]?_['map'](_['values'](_0x52cb97[_0xc093('0x42')]),function(_0xabcb83){return{'name':_0xabcb83[_0xc093('0x6a')],'value':_0xabcb83[_0xc093('0x29')]};}):[]};})};}})['then'](respondWithResult(_0xf8ab8c,null))['catch'](function(_0xd609ec){var _0x5b58bd=_0x2cefca[_0xc093('0x2f')][_0xc093('0x6b')]?0x1f4:_0xd609ec['statusCode']||0x1f4;logger[_0xc093('0x19')](_0xc093('0x6c'),_0xc093('0x5a'),_0x5b58bd,JSON[_0xc093('0x18')](_0xd609ec));delete _0xd609ec[_0xc093('0x29')];if(_0x5b58bd===0x191){_0x5b58bd=0x190;}_0xf8ab8c[_0xc093('0x1e')](_0x5b58bd)[_0xc093('0x2a')](_0x2cefca[_0xc093('0x2f')]['test']?{'message':_0xc093('0x6d'),'statusCode':_0xd609ec['statusCode']}:_0xd609ec);});}; \ No newline at end of file +var _0x7dab=['SugarcrmConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','type','channel','SugarcrmField','Descriptions','getFields','password','remoteUri','POST','format','/service/v4_1/rest.php','login','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','%s%s','get_module_fields','stringify','Calls','module_fields','label','endsWith','values','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','sendStatus','stack','name','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','add','day','merge','where','filter','map','include','SugarcrmAccount','findAll','rows','catch','show','params','includeAll','options','find','create','body','getConfigurations','findOne'];(function(_0x501125,_0x38cfc8){var _0x160566=function(_0x1b5c1d){while(--_0x1b5c1d){_0x501125['push'](_0x501125['shift']());}};_0x160566(++_0x38cfc8);}(_0x7dab,0x10a));var _0xb7da=function(_0x147494,_0x502d36){_0x147494=_0x147494-0x0;var _0x2593f4=_0x7dab[_0x147494];return _0x2593f4;};'use strict';var jsonpatch=require(_0xb7da('0x0'));var rp=require(_0xb7da('0x1'));var moment=require('moment');var BPromise=require(_0xb7da('0x2'));var Mustache=require(_0xb7da('0x3'));var util=require(_0xb7da('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb7da('0x5'));var ejs=require(_0xb7da('0x6'));var fs=require('fs');var _=require(_0xb7da('0x7'));var squel=require(_0xb7da('0x8'));var crypto=require(_0xb7da('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb7da('0xa'));var toCsv=require(_0xb7da('0x5'));var querystring=require(_0xb7da('0xb'));var Papa=require(_0xb7da('0xc'));var qs=require(_0xb7da('0xd'));var logger=require(_0xb7da('0xe'))(_0xb7da('0xf'));var utils=require(_0xb7da('0x10'));var config=require(_0xb7da('0x11'));var db=require(_0xb7da('0x12'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb7da('0x13'));var client=jayson[_0xb7da('0x14')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7bb0,_0x54b200,_0x30a834,_0x30a1bc){return new BPromise(function(_0x48a6c5,_0x55a055){var _0x47151d=_0x30a1bc||client;return _0x47151d[_0xb7da('0x15')](_0x2b7bb0,_0x30a834)[_0xb7da('0x16')](function(_0x1fee1d){logger[_0xb7da('0x17')](_0xb7da('0x18'),_0x54b200,_0xb7da('0x19'));logger[_0xb7da('0x1a')](_0xb7da('0x1b'),_0x54b200,_0xb7da('0x19'),JSON['stringify'](_0x1fee1d));if(_0x1fee1d[_0xb7da('0x1c')]){if(_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1d')]===0x1f4){logger[_0xb7da('0x1c')]('SugarcrmAccount,\x20%s,\x20%s',_0x54b200,_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);return _0x55a055(_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);}logger[_0xb7da('0x1c')](_0xb7da('0x18'),_0x54b200,_0x1fee1d[_0xb7da('0x1c')][_0xb7da('0x1e')]);return _0x48a6c5(_0x1fee1d[_0xb7da('0x1c')]['message']);}else{logger[_0xb7da('0x17')]('SugarcrmAccount,\x20%s,\x20%s',_0x54b200,_0xb7da('0x19'));_0x48a6c5(_0x1fee1d['result']['message']);}})['catch'](function(_0x5e5b98){logger[_0xb7da('0x1c')](_0xb7da('0x18'),_0x54b200,_0x5e5b98);_0x55a055(_0x5e5b98);});});}function respondWithStatusCode(_0x43efc7,_0x18b4e0){_0x18b4e0=_0x18b4e0||0xcc;return function(_0x807233){if(_0x807233){return _0x43efc7['sendStatus'](_0x18b4e0);}return _0x43efc7[_0xb7da('0x1f')](_0x18b4e0)[_0xb7da('0x20')]();};}function respondWithResult(_0x40b9cb,_0x466272){_0x466272=_0x466272||0xc8;return function(_0x452ff5){if(_0x452ff5){return _0x40b9cb['status'](_0x466272)[_0xb7da('0x21')](_0x452ff5);}};}function respondWithFilteredResult(_0x592e04,_0x5d541f){return function(_0x399898){if(_0x399898){var _0x2f7719=_0x399898[_0xb7da('0x22')],_0x2eee23=_0x5d541f[_0xb7da('0x23')],_0x109779=_0x5d541f[_0xb7da('0x23')]+_0x5d541f[_0xb7da('0x24')],_0x259fc8;if(_0x109779>=_0x2f7719){_0x109779=_0x2f7719;_0x259fc8=0xc8;}else{_0x259fc8=0xce;}_0x592e04[_0xb7da('0x1f')](_0x259fc8);return _0x592e04[_0xb7da('0x25')](_0xb7da('0x26'),_0x2eee23+'-'+_0x109779+'/'+_0x2f7719)[_0xb7da('0x21')](_0x399898);}return null;};}function patchUpdates(_0x4251d9){return function(_0x53bc9e){try{jsonpatch[_0xb7da('0x27')](_0x53bc9e,_0x4251d9,!![]);}catch(_0xd7bd8){return BPromise[_0xb7da('0x28')](_0xd7bd8);}return _0x53bc9e['save']();};}function saveUpdates(_0x324f7d,_0x5417b1){return function(_0x1f7cdf){if(_0x1f7cdf){return _0x1f7cdf[_0xb7da('0x29')](_0x324f7d)[_0xb7da('0x16')](function(_0xd98a53){return _0xd98a53;});}return null;};}function removeEntity(_0x4f3929,_0x239464){return function(_0x1c36a4){if(_0x1c36a4){return _0x1c36a4[_0xb7da('0x2a')]()[_0xb7da('0x16')](function(){_0x4f3929[_0xb7da('0x1f')](0xcc)[_0xb7da('0x20')]();});}};}function handleEntityNotFound(_0x4a85d1,_0x28e50f){return function(_0x346013){if(!_0x346013){_0x4a85d1[_0xb7da('0x2b')](0x194);}return _0x346013;};}function handleError(_0x121a64,_0x10a821){_0x10a821=_0x10a821||0x1f4;return function(_0x55bd29){logger[_0xb7da('0x1c')](_0x55bd29[_0xb7da('0x2c')]);if(_0x55bd29[_0xb7da('0x2d')]){delete _0x55bd29[_0xb7da('0x2d')];}_0x121a64['status'](_0x10a821)['send'](_0x55bd29);};}exports[_0xb7da('0x2e')]=function(_0x412c42,_0x5316b9){var _0x11abe4={},_0xd1b014={},_0x13a4f2={'count':0x0,'rows':[]};var _0x166eb8=db['SugarcrmAccount'][_0xb7da('0x2f')];_0xd1b014[_0xb7da('0x30')]=_[_0xb7da('0x31')](_0x166eb8);var _0xffcdfc={'dateStart':_0x412c42[_0xb7da('0x32')][_0xb7da('0x33')],'dateEnd':_0x412c42[_0xb7da('0x32')][_0xb7da('0x34')]};delete _0x412c42[_0xb7da('0x32')][_0xb7da('0x33')];delete _0x412c42[_0xb7da('0x32')][_0xb7da('0x34')];_0xd1b014[_0xb7da('0x32')]=_['keys'](_0x412c42[_0xb7da('0x32')]);_0xd1b014[_0xb7da('0x35')]=_['intersection'](_0xd1b014[_0xb7da('0x30')],_0xd1b014['query']);_0x11abe4[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0xd1b014['model'],qs[_0xb7da('0x38')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x38')]));_0x11abe4[_0xb7da('0x36')]=_0x11abe4[_0xb7da('0x36')][_0xb7da('0x39')]?_0x11abe4[_0xb7da('0x36')]:_0xd1b014['model'];if(!_0x412c42[_0xb7da('0x32')][_0xb7da('0x3a')](_0xb7da('0x3b'))){_0x11abe4[_0xb7da('0x24')]=qs[_0xb7da('0x24')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x24')]);_0x11abe4[_0xb7da('0x23')]=qs[_0xb7da('0x23')](_0x412c42['query'][_0xb7da('0x23')]);}_0x11abe4[_0xb7da('0x3c')]=qs[_0xb7da('0x3d')](_0x412c42[_0xb7da('0x32')][_0xb7da('0x3d')]);_0x11abe4['where']=qs[_0xb7da('0x35')](_['pick'](_0x412c42['query'],_0xd1b014[_0xb7da('0x35')]));if(_0xffcdfc[_0xb7da('0x33')]){if(_0xffcdfc[_0xb7da('0x34')]){_0xffcdfc[_0xb7da('0x34')]=moment(_0xffcdfc[_0xb7da('0x34')])[_0xb7da('0x3e')](0x1,_0xb7da('0x3f'));}else{_0xffcdfc[_0xb7da('0x34')]=moment(_0xffcdfc['dateStart'])[_0xb7da('0x3e')](0x1,'day');}_[_0xb7da('0x40')](_0x11abe4[_0xb7da('0x41')],{'createdAt':{'$gte':_0xffcdfc[_0xb7da('0x33')],'$lte':_0xffcdfc[_0xb7da('0x34')]}});}if(_0x412c42[_0xb7da('0x32')][_0xb7da('0x42')]){_0x11abe4[_0xb7da('0x41')]=_[_0xb7da('0x40')](_0x11abe4['where'],{'$or':_[_0xb7da('0x43')](_0x11abe4['attributes'],function(_0x5bc5b2){var _0x119430={};_0x119430[_0x5bc5b2]={'$like':'%'+_0x412c42['query'][_0xb7da('0x42')]+'%'};return _0x119430;})});}_0x11abe4=_[_0xb7da('0x40')]({},_0x11abe4,_0x412c42['options']);var _0x50a643={'where':_0x11abe4[_0xb7da('0x41')]};return db['SugarcrmAccount'][_0xb7da('0x22')](_0x50a643)[_0xb7da('0x16')](function(_0x49a7b8){_0x13a4f2[_0xb7da('0x22')]=_0x49a7b8;if(_0x412c42[_0xb7da('0x32')]['includeAll']){_0x11abe4[_0xb7da('0x44')]=[{'all':!![]}];}return db[_0xb7da('0x45')][_0xb7da('0x46')](_0x11abe4);})[_0xb7da('0x16')](function(_0x18b01c){_0x13a4f2[_0xb7da('0x47')]=_0x18b01c;return _0x13a4f2;})['then'](respondWithFilteredResult(_0x5316b9,_0x11abe4))[_0xb7da('0x48')](handleError(_0x5316b9,null));};exports[_0xb7da('0x49')]=function(_0x4a2ca1,_0x49176a){var _0x5937d3={'raw':![],'where':{'id':_0x4a2ca1[_0xb7da('0x4a')]['id']}},_0x179c6e={};_0x179c6e['model']=_[_0xb7da('0x31')](db[_0xb7da('0x45')][_0xb7da('0x2f')]);_0x179c6e[_0xb7da('0x32')]=_[_0xb7da('0x31')](_0x4a2ca1[_0xb7da('0x32')]);_0x179c6e['filters']=_[_0xb7da('0x37')](_0x179c6e[_0xb7da('0x30')],_0x179c6e['query']);_0x5937d3[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x179c6e[_0xb7da('0x30')],qs[_0xb7da('0x38')](_0x4a2ca1[_0xb7da('0x32')][_0xb7da('0x38')]));_0x5937d3[_0xb7da('0x36')]=_0x5937d3[_0xb7da('0x36')]['length']?_0x5937d3['attributes']:_0x179c6e[_0xb7da('0x30')];if(_0x4a2ca1[_0xb7da('0x32')][_0xb7da('0x4b')]){_0x5937d3['include']=[{'all':!![]}];}_0x5937d3=_['merge']({},_0x5937d3,_0x4a2ca1[_0xb7da('0x4c')]);return db[_0xb7da('0x45')][_0xb7da('0x4d')](_0x5937d3)[_0xb7da('0x16')](handleEntityNotFound(_0x49176a,null))[_0xb7da('0x16')](respondWithResult(_0x49176a,null))[_0xb7da('0x48')](handleError(_0x49176a,null));};exports[_0xb7da('0x4e')]=function(_0x303474,_0x432532){return db['SugarcrmAccount'][_0xb7da('0x4e')](_0x303474[_0xb7da('0x4f')],{})[_0xb7da('0x16')](respondWithResult(_0x432532,0xc9))[_0xb7da('0x48')](handleError(_0x432532,null));};exports[_0xb7da('0x29')]=function(_0x5782e2,_0x50defd){if(_0x5782e2[_0xb7da('0x4f')]['id']){delete _0x5782e2['body']['id'];}return db['SugarcrmAccount']['find']({'where':{'id':_0x5782e2[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x50defd,null))[_0xb7da('0x16')](saveUpdates(_0x5782e2[_0xb7da('0x4f')],null))[_0xb7da('0x16')](respondWithResult(_0x50defd,null))[_0xb7da('0x48')](handleError(_0x50defd,null));};exports[_0xb7da('0x2a')]=function(_0x4ccde4,_0xb15405){return db['SugarcrmAccount'][_0xb7da('0x4d')]({'where':{'id':_0x4ccde4[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0xb15405,null))[_0xb7da('0x16')](removeEntity(_0xb15405,null))[_0xb7da('0x48')](handleError(_0xb15405,null));};exports[_0xb7da('0x50')]=function(_0xb78761,_0x463740,_0x184d36){var _0x3fcd8c={};var _0x22dd9d={};var _0x228342;var _0x25fa3c;return db[_0xb7da('0x45')][_0xb7da('0x51')]({'where':{'id':_0xb78761[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x463740,null))[_0xb7da('0x16')](function(_0x20dd43){if(_0x20dd43){_0x228342=_0x20dd43;_0x22dd9d[_0xb7da('0x30')]=_[_0xb7da('0x31')](db[_0xb7da('0x52')][_0xb7da('0x2f')]);_0x22dd9d[_0xb7da('0x32')]=_['keys'](_0xb78761[_0xb7da('0x32')]);_0x22dd9d['filters']=_['intersection'](_0x22dd9d[_0xb7da('0x30')],_0x22dd9d[_0xb7da('0x32')]);_0x3fcd8c[_0xb7da('0x36')]=_[_0xb7da('0x37')](_0x22dd9d[_0xb7da('0x30')],qs[_0xb7da('0x38')](_0xb78761[_0xb7da('0x32')]['fields']));_0x3fcd8c[_0xb7da('0x36')]=_0x3fcd8c['attributes'][_0xb7da('0x39')]?_0x3fcd8c[_0xb7da('0x36')]:_0x22dd9d[_0xb7da('0x30')];_0x3fcd8c[_0xb7da('0x3c')]=qs['sort'](_0xb78761[_0xb7da('0x32')][_0xb7da('0x3d')]);_0x3fcd8c[_0xb7da('0x41')]=qs[_0xb7da('0x35')](_[_0xb7da('0x53')](_0xb78761[_0xb7da('0x32')],_0x22dd9d['filters']));if(_0xb78761[_0xb7da('0x32')]['filter']){_0x3fcd8c[_0xb7da('0x41')]=_[_0xb7da('0x40')](_0x3fcd8c['where'],{'$or':_[_0xb7da('0x43')](_0x3fcd8c['attributes'],function(_0x1cfc32){var _0x14d130={};_0x14d130[_0x1cfc32]={'$like':'%'+_0xb78761[_0xb7da('0x32')][_0xb7da('0x42')]+'%'};return _0x14d130;})});}_0x3fcd8c=_[_0xb7da('0x40')]({},_0x3fcd8c,_0xb78761['options']);return _0x228342[_0xb7da('0x50')](_0x3fcd8c);}})[_0xb7da('0x16')](function(_0x4ea48a){if(_0x4ea48a){_0x25fa3c=_0x4ea48a[_0xb7da('0x39')];if(!_0xb78761[_0xb7da('0x32')][_0xb7da('0x3a')](_0xb7da('0x3b'))){_0x3fcd8c['limit']=qs[_0xb7da('0x24')](_0xb78761['query'][_0xb7da('0x24')]);_0x3fcd8c['offset']=qs[_0xb7da('0x23')](_0xb78761[_0xb7da('0x32')][_0xb7da('0x23')]);}return _0x228342[_0xb7da('0x50')](_0x3fcd8c);}})['then'](function(_0x19fac3){if(_0x19fac3){return _0x19fac3?{'count':_0x25fa3c,'rows':_0x19fac3}:null;}})[_0xb7da('0x16')](respondWithResult(_0x463740,null))[_0xb7da('0x48')](handleError(_0x463740,null));};exports[_0xb7da('0x54')]=function(_0x6f85d4,_0x390a5d,_0x545cc4){if(_0x6f85d4[_0xb7da('0x4f')]['id']){delete _0x6f85d4[_0xb7da('0x4f')]['id'];}return db[_0xb7da('0x45')]['findOne']({'where':{'id':_0x6f85d4[_0xb7da('0x4a')]['id']}})[_0xb7da('0x16')](handleEntityNotFound(_0x390a5d,null))[_0xb7da('0x16')](function(_0x14b843){if(_0x14b843){_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x55')]=_0x14b843['id'];_0x6f85d4['body'][_0xb7da('0x56')]=integrations[_0xb7da('0x57')](_0x6f85d4[_0xb7da('0x4f')]['channel'],_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x58')]);_0x6f85d4[_0xb7da('0x4f')]['Descriptions']=integrations['getDescriptions'](_0x6f85d4[_0xb7da('0x4f')][_0xb7da('0x59')],_0x6f85d4[_0xb7da('0x4f')]['type']);return db[_0xb7da('0x52')][_0xb7da('0x4e')](_0x6f85d4['body'],{'include':[{'model':db[_0xb7da('0x5a')],'as':_0xb7da('0x56')},{'model':db[_0xb7da('0x5a')],'as':_0xb7da('0x5b')}]});}return null;})['then'](respondWithResult(_0x390a5d,null))[_0xb7da('0x48')](handleError(_0x390a5d,null));};exports[_0xb7da('0x5c')]=function(_0x4d6524,_0x22788c,_0x15b533){var _0xb11b26;return db[_0xb7da('0x45')]['findOne']({'where':{'id':_0x4d6524[_0xb7da('0x4a')]['id']},'attributes':['id','username',_0xb7da('0x5d'),_0xb7da('0x5e')]})[_0xb7da('0x16')](handleEntityNotFound(_0x22788c,null))[_0xb7da('0x16')](function(_0x3e05ff){if(_0x3e05ff){_0xb11b26=_0x3e05ff[_0xb7da('0x5e')];return rp({'method':_0xb7da('0x5f'),'uri':util[_0xb7da('0x60')]('%s%s',_0xb11b26,_0xb7da('0x61')),'json':!![],'form':{'method':_0xb7da('0x62'),'input_type':_0xb7da('0x63'),'response_type':_0xb7da('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x3e05ff[_0xb7da('0x64')],'password':_0x3e05ff[_0xb7da('0x5d')],'encryption':_0xb7da('0x65')},'application':_0xb7da('0x66')})}});}})[_0xb7da('0x16')](function(_0x206bc3){if(_0x206bc3){return rp({'method':_0xb7da('0x5f'),'uri':util['format'](_0xb7da('0x67'),_0xb11b26,_0xb7da('0x61')),'json':!![],'form':{'method':_0xb7da('0x68'),'input_type':_0xb7da('0x63'),'response_type':_0xb7da('0x63'),'rest_data':JSON[_0xb7da('0x69')]({'session':_0x206bc3['id'],'module_name':_0xb7da('0x6a')})}});}})[_0xb7da('0x16')](function(_0x3d5ac6){if(_0x3d5ac6){var _0x5e4322=_['values'](_0x3d5ac6[_0xb7da('0x6b')]);return{'count':_0x5e4322['length'],'rows':_[_0xb7da('0x43')](_0x5e4322,function(_0x7eaeaf){return{'id':_0x7eaeaf[_0xb7da('0x2d')],'name':_0x7eaeaf[_0xb7da('0x6c')],'custom':_[_0xb7da('0x6d')](_0x7eaeaf[_0xb7da('0x2d')],'_c')?!![]:![],'options':_0x7eaeaf[_0xb7da('0x4c')]?_[_0xb7da('0x43')](_[_0xb7da('0x6e')](_0x7eaeaf[_0xb7da('0x4c')]),function(_0x11a74c){return{'name':_0x11a74c[_0xb7da('0x6f')],'value':_0x11a74c[_0xb7da('0x2d')]};}):[]};})};}})[_0xb7da('0x16')](respondWithResult(_0x22788c,null))[_0xb7da('0x48')](function(_0x2005c7){var _0x2582cb=_0x4d6524[_0xb7da('0x32')][_0xb7da('0x70')]?0x1f4:_0x2005c7[_0xb7da('0x71')]||0x1f4;logger[_0xb7da('0x1c')](_0xb7da('0x72'),'getFields',_0x2582cb,JSON[_0xb7da('0x69')](_0x2005c7));delete _0x2005c7[_0xb7da('0x2d')];if(_0x2582cb===0x191){_0x2582cb=0x190;}_0x22788c[_0xb7da('0x1f')](_0x2582cb)[_0xb7da('0x73')](_0x4d6524['query'][_0xb7da('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x2005c7[_0xb7da('0x71')]}:_0x2005c7);});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index e523e19..56e659c 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 _0x4748=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e2dde,_0x231def){var _0x32d8c0=function(_0xfe0a53){while(--_0xfe0a53){_0x2e2dde['push'](_0x2e2dde['shift']());}};_0x32d8c0(++_0x231def);}(_0x4748,0x69));var _0x8474=function(_0x579c52,_0x197c52){_0x579c52=_0x579c52-0x0;var _0x252ad1=_0x4748[_0x579c52];return _0x252ad1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8474('0x0'))(_0x8474('0x1'));var moment=require(_0x8474('0x2'));var BPromise=require(_0x8474('0x3'));var rp=require(_0x8474('0x4'));var attributes=require(_0x8474('0x5'));var integrations=require(_0x8474('0x6'));module[_0x8474('0x7')]=function(_0x26bd79,_0x5c9af2){return _0x26bd79[_0x8474('0x8')](_0x8474('0x9'),attributes,{'tableName':_0x8474('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8858=['SugarcrmAccount','lodash','../../config/logger','api','bluebird','request-promise','../../components/integrations/configuration','exports','define'];(function(_0x467918,_0x30a84c){var _0xd65d72=function(_0x568134){while(--_0x568134){_0x467918['push'](_0x467918['shift']());}};_0xd65d72(++_0x30a84c);}(_0x8858,0xf4));var _0x8885=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x8858[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x8885('0x0'));var util=require('util');var logger=require(_0x8885('0x1'))(_0x8885('0x2'));var moment=require('moment');var BPromise=require(_0x8885('0x3'));var rp=require(_0x8885('0x4'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x8885('0x5'));module[_0x8885('0x6')]=function(_0x319b50,_0x3d2694){return _0x319b50[_0x8885('0x7')](_0x8885('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 6cf7ec1..3b1b90c 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 _0xf5c1=['util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSugarcrmAccount','find','lodash'];(function(_0x1b51ea,_0x394fd9){var _0x18bbdc=function(_0x45b83f){while(--_0x45b83f){_0x1b51ea['push'](_0x1b51ea['shift']());}};_0x18bbdc(++_0x394fd9);}(_0xf5c1,0xb3));var _0x1f5c=function(_0x4a18f0,_0x903c50){_0x4a18f0=_0x4a18f0-0x0;var _0x158316=_0xf5c1[_0x4a18f0];return _0x158316;};'use strict';var _=require(_0x1f5c('0x0'));var util=require(_0x1f5c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1f5c('0x2'));var fs=require('fs');var db=require(_0x1f5c('0x3'))['db'];var utils=require(_0x1f5c('0x4'));var logger=require(_0x1f5c('0x5'))(_0x1f5c('0x6'));var config=require(_0x1f5c('0x7'));var jayson=require(_0x1f5c('0x8'));var client=jayson['client'][_0x1f5c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56f724,_0x228bdc,_0x395968){return new BPromise(function(_0xb9ca1,_0x52d6a6){return client[_0x1f5c('0xa')](_0x56f724,_0x395968)[_0x1f5c('0xb')](function(_0x7df39b){logger[_0x1f5c('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x228bdc,_0x1f5c('0xd'));logger[_0x1f5c('0xe')](_0x1f5c('0xf'),_0x228bdc,_0x1f5c('0xd'),JSON['stringify'](_0x7df39b));if(_0x7df39b[_0x1f5c('0x10')]){if(_0x7df39b[_0x1f5c('0x10')][_0x1f5c('0x11')]===0x1f4){logger['error'](_0x1f5c('0x12'),_0x228bdc,_0x7df39b['error'][_0x1f5c('0x13')]);return _0x52d6a6(_0x7df39b[_0x1f5c('0x10')][_0x1f5c('0x13')]);}logger[_0x1f5c('0x10')](_0x1f5c('0x12'),_0x228bdc,_0x7df39b[_0x1f5c('0x10')][_0x1f5c('0x13')]);return _0xb9ca1(_0x7df39b[_0x1f5c('0x10')][_0x1f5c('0x13')]);}else{logger[_0x1f5c('0xc')](_0x1f5c('0x12'),_0x228bdc,_0x1f5c('0xd'));_0xb9ca1(_0x7df39b[_0x1f5c('0x14')]['message']);}})[_0x1f5c('0x15')](function(_0x4f2522){logger[_0x1f5c('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x228bdc,_0x4f2522);_0x52d6a6(_0x4f2522);});});}exports[_0x1f5c('0x16')]=function(_0x2e9b7d){var _0x260389=this;return new Promise(function(_0x34aa06,_0x5f37a4){return db[_0x1f5c('0x17')][_0x1f5c('0x18')]({'raw':_0x2e9b7d[_0x1f5c('0x19')]?_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e9b7d['options']?_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1b')]||null:null,'attributes':_0x2e9b7d[_0x1f5c('0x19')]?_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1c')]||null:null,'limit':_0x2e9b7d[_0x1f5c('0x19')]?_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1d')]||null:null,'include':_0x2e9b7d[_0x1f5c('0x19')]?_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x2e9b7d[_0x1f5c('0x19')][_0x1f5c('0x1e')],function(_0x263b23){return{'model':db[_0x263b23[_0x1f5c('0x20')]],'as':_0x263b23['as'],'attributes':_0x263b23[_0x1f5c('0x1c')],'include':_0x263b23[_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x263b23['include'],function(_0x31c8f9){return{'model':db[_0x31c8f9[_0x1f5c('0x20')]],'as':_0x31c8f9['as'],'attributes':_0x31c8f9[_0x1f5c('0x1c')],'include':_0x31c8f9[_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x31c8f9[_0x1f5c('0x1e')],function(_0x313ef6){return{'model':db[_0x313ef6[_0x1f5c('0x20')]],'as':_0x313ef6['as'],'attributes':_0x313ef6[_0x1f5c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1f5c('0xb')](function(_0x1f28b4){logger[_0x1f5c('0xc')](_0x1f5c('0x16'),_0x2e9b7d);logger[_0x1f5c('0xe')]('GetSugarcrmAccount',_0x2e9b7d,JSON[_0x1f5c('0x21')](_0x1f28b4));_0x34aa06(_0x1f28b4);})[_0x1f5c('0x15')](function(_0x931c69){logger['error'](_0x1f5c('0x16'),_0x931c69[_0x1f5c('0x13')],_0x2e9b7d);_0x5f37a4(_0x260389['error'](0x1f4,_0x931c69['message']));});});};exports[_0x1f5c('0x22')]=function(_0x24e5a1){var _0x43b0c5=this;return new Promise(function(_0x40314d,_0x13d684){return db[_0x1f5c('0x17')][_0x1f5c('0x23')]({'raw':_0x24e5a1[_0x1f5c('0x19')]?_0x24e5a1['options'][_0x1f5c('0x1a')]===undefined?!![]:![]:!![],'where':_0x24e5a1[_0x1f5c('0x19')]?_0x24e5a1[_0x1f5c('0x19')][_0x1f5c('0x1b')]||null:null,'attributes':_0x24e5a1[_0x1f5c('0x19')]?_0x24e5a1[_0x1f5c('0x19')][_0x1f5c('0x1c')]||null:null,'include':_0x24e5a1['options']?_0x24e5a1[_0x1f5c('0x19')][_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x24e5a1[_0x1f5c('0x19')][_0x1f5c('0x1e')],function(_0x861d8b){return{'model':db[_0x861d8b[_0x1f5c('0x20')]],'as':_0x861d8b['as'],'attributes':_0x861d8b[_0x1f5c('0x1c')],'include':_0x861d8b[_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x861d8b[_0x1f5c('0x1e')],function(_0x85afd3){return{'model':db[_0x85afd3[_0x1f5c('0x20')]],'as':_0x85afd3['as'],'attributes':_0x85afd3['attributes'],'include':_0x85afd3[_0x1f5c('0x1e')]?_[_0x1f5c('0x1f')](_0x85afd3[_0x1f5c('0x1e')],function(_0x455f0c){return{'model':db[_0x455f0c[_0x1f5c('0x20')]],'as':_0x455f0c['as'],'attributes':_0x455f0c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1f5c('0xb')](function(_0x304cec){logger[_0x1f5c('0xc')](_0x1f5c('0x22'),_0x24e5a1);logger['debug'](_0x1f5c('0x22'),_0x24e5a1,JSON['stringify'](_0x304cec));_0x40314d(_0x304cec);})['catch'](function(_0x4face9){logger[_0x1f5c('0x10')]('ShowSugarcrmAccount',_0x4face9[_0x1f5c('0x13')],_0x24e5a1);_0x13d684(_0x43b0c5[_0x1f5c('0x10')](0x1f4,_0x4face9[_0x1f5c('0x13')]));});});}; \ No newline at end of file +var _0x3d11=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SugarcrmAccount,\x20%s,\x20%s','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','attributes','limit','map','model','include','then','find','where','debug','ShowSugarcrmAccount','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x31e2be,_0x463b36){var _0x3de32e=function(_0x18a103){while(--_0x18a103){_0x31e2be['push'](_0x31e2be['shift']());}};_0x3de32e(++_0x463b36);}(_0x3d11,0x158));var _0x13d1=function(_0x25ac2d,_0x154c4e){_0x25ac2d=_0x25ac2d-0x0;var _0x1c7365=_0x3d11[_0x25ac2d];return _0x1c7365;};'use strict';var _=require(_0x13d1('0x0'));var util=require(_0x13d1('0x1'));var moment=require(_0x13d1('0x2'));var BPromise=require('bluebird');var rs=require(_0x13d1('0x3'));var fs=require('fs');var db=require(_0x13d1('0x4'))['db'];var utils=require(_0x13d1('0x5'));var logger=require(_0x13d1('0x6'))(_0x13d1('0x7'));var config=require(_0x13d1('0x8'));var jayson=require(_0x13d1('0x9'));var client=jayson[_0x13d1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3288d1,_0x36eb01,_0x270fbf){return new BPromise(function(_0x435266,_0x2d6718){return client[_0x13d1('0xb')](_0x3288d1,_0x270fbf)['then'](function(_0x2f14a5){logger[_0x13d1('0xc')](_0x13d1('0xd'),_0x36eb01,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x36eb01,'request\x20sent',JSON['stringify'](_0x2f14a5));if(_0x2f14a5[_0x13d1('0xe')]){if(_0x2f14a5[_0x13d1('0xe')]['code']===0x1f4){logger[_0x13d1('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x36eb01,_0x2f14a5[_0x13d1('0xe')][_0x13d1('0xf')]);return _0x2d6718(_0x2f14a5[_0x13d1('0xe')][_0x13d1('0xf')]);}logger[_0x13d1('0xe')](_0x13d1('0xd'),_0x36eb01,_0x2f14a5['error'][_0x13d1('0xf')]);return _0x435266(_0x2f14a5[_0x13d1('0xe')]['message']);}else{logger[_0x13d1('0xc')](_0x13d1('0xd'),_0x36eb01,_0x13d1('0x10'));_0x435266(_0x2f14a5[_0x13d1('0x11')][_0x13d1('0xf')]);}})[_0x13d1('0x12')](function(_0x289aa6){logger[_0x13d1('0xe')](_0x13d1('0xd'),_0x36eb01,_0x289aa6);_0x2d6718(_0x289aa6);});});}exports[_0x13d1('0x13')]=function(_0x3f1185){var _0xa41afd=this;return new Promise(function(_0x4b0885,_0x4933c9){return db[_0x13d1('0x14')][_0x13d1('0x15')]({'raw':_0x3f1185[_0x13d1('0x16')]?_0x3f1185[_0x13d1('0x16')][_0x13d1('0x17')]===undefined?!![]:![]:!![],'where':_0x3f1185[_0x13d1('0x16')]?_0x3f1185['options']['where']||null:null,'attributes':_0x3f1185['options']?_0x3f1185['options'][_0x13d1('0x18')]||null:null,'limit':_0x3f1185['options']?_0x3f1185[_0x13d1('0x16')][_0x13d1('0x19')]||null:null,'include':_0x3f1185[_0x13d1('0x16')]?_0x3f1185[_0x13d1('0x16')]['include']?_[_0x13d1('0x1a')](_0x3f1185[_0x13d1('0x16')]['include'],function(_0xde0d43){return{'model':db[_0xde0d43[_0x13d1('0x1b')]],'as':_0xde0d43['as'],'attributes':_0xde0d43[_0x13d1('0x18')],'include':_0xde0d43[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0xde0d43[_0x13d1('0x1c')],function(_0x37acf7){return{'model':db[_0x37acf7[_0x13d1('0x1b')]],'as':_0x37acf7['as'],'attributes':_0x37acf7[_0x13d1('0x18')],'include':_0x37acf7['include']?_['map'](_0x37acf7['include'],function(_0x5517d5){return{'model':db[_0x5517d5[_0x13d1('0x1b')]],'as':_0x5517d5['as'],'attributes':_0x5517d5[_0x13d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x13d1('0x1d')](function(_0x434f32){logger[_0x13d1('0xc')](_0x13d1('0x13'),_0x3f1185);logger['debug']('GetSugarcrmAccount',_0x3f1185,JSON['stringify'](_0x434f32));_0x4b0885(_0x434f32);})[_0x13d1('0x12')](function(_0x9f32dc){logger[_0x13d1('0xe')](_0x13d1('0x13'),_0x9f32dc['message'],_0x3f1185);_0x4933c9(_0xa41afd[_0x13d1('0xe')](0x1f4,_0x9f32dc[_0x13d1('0xf')]));});});};exports['ShowSugarcrmAccount']=function(_0x3b502c){var _0x54952d=this;return new Promise(function(_0x40524e,_0x450f0f){return db[_0x13d1('0x14')][_0x13d1('0x1e')]({'raw':_0x3b502c['options']?_0x3b502c[_0x13d1('0x16')][_0x13d1('0x17')]===undefined?!![]:![]:!![],'where':_0x3b502c[_0x13d1('0x16')]?_0x3b502c[_0x13d1('0x16')][_0x13d1('0x1f')]||null:null,'attributes':_0x3b502c['options']?_0x3b502c['options'][_0x13d1('0x18')]||null:null,'include':_0x3b502c['options']?_0x3b502c['options'][_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x3b502c[_0x13d1('0x16')]['include'],function(_0x514855){return{'model':db[_0x514855[_0x13d1('0x1b')]],'as':_0x514855['as'],'attributes':_0x514855[_0x13d1('0x18')],'include':_0x514855[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x514855[_0x13d1('0x1c')],function(_0x4c565b){return{'model':db[_0x4c565b[_0x13d1('0x1b')]],'as':_0x4c565b['as'],'attributes':_0x4c565b[_0x13d1('0x18')],'include':_0x4c565b[_0x13d1('0x1c')]?_[_0x13d1('0x1a')](_0x4c565b[_0x13d1('0x1c')],function(_0xa38bbb){return{'model':db[_0xa38bbb[_0x13d1('0x1b')]],'as':_0xa38bbb['as'],'attributes':_0xa38bbb[_0x13d1('0x18')]};}):[]};}):[]};}):[]:[]})[_0x13d1('0x1d')](function(_0x2df717){logger[_0x13d1('0xc')]('ShowSugarcrmAccount',_0x3b502c);logger[_0x13d1('0x20')](_0x13d1('0x21'),_0x3b502c,JSON[_0x13d1('0x22')](_0x2df717));_0x40524e(_0x2df717);})['catch'](function(_0x1fa51a){logger['error'](_0x13d1('0x21'),_0x1fa51a[_0x13d1('0xf')],_0x3b502c);_0x450f0f(_0x54952d[_0x13d1('0xe')](0x1f4,_0x1fa51a[_0x13d1('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index a1bfa11..4b05fba 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 _0x5269=['post','create','put','/:id','delete','destroy','multer','path','express','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','show','/:id/fields','/:id/subjects','getDescriptions'];(function(_0x4358af,_0x2e9041){var _0x580ae5=function(_0x5ae282){while(--_0x5ae282){_0x4358af['push'](_0x4358af['shift']());}};_0x580ae5(++_0x2e9041);}(_0x5269,0x138));var _0x9526=function(_0xc8d5cb,_0x3ad08f){_0xc8d5cb=_0xc8d5cb-0x0;var _0xd09569=_0x5269[_0xc8d5cb];return _0xd09569;};'use strict';var multer=require(_0x9526('0x0'));var util=require('util');var path=require(_0x9526('0x1'));var express=require(_0x9526('0x2'));var router=express['Router']();var auth=require(_0x9526('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9526('0x4'));var controller=require(_0x9526('0x5'));router[_0x9526('0x6')]('/',auth[_0x9526('0x7')](),controller['index']);router[_0x9526('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x9526('0x8')]);router[_0x9526('0x6')](_0x9526('0x9'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x9526('0xa'),auth[_0x9526('0x7')](),controller['getSubjects']);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x9526('0xb')]);router[_0x9526('0xc')]('/',auth[_0x9526('0x7')](),controller[_0x9526('0xd')]);router[_0x9526('0xe')](_0x9526('0xf'),auth[_0x9526('0x7')](),controller['update']);router[_0x9526('0x10')](_0x9526('0xf'),auth[_0x9526('0x7')](),controller[_0x9526('0x11')]);module['exports']=router; \ No newline at end of file +var _0x62fe=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x62fe,0x111));var _0xe62f=function(_0x5ce42c,_0x13c493){_0x5ce42c=_0x5ce42c-0x0;var _0x68a914=_0x62fe[_0x5ce42c];return _0x68a914;};'use strict';var multer=require(_0xe62f('0x0'));var util=require(_0xe62f('0x1'));var path=require('path');var express=require(_0xe62f('0x2'));var router=express[_0xe62f('0x3')]();var auth=require(_0xe62f('0x4'));var interaction=require(_0xe62f('0x5'));var config=require(_0xe62f('0x6'));var controller=require(_0xe62f('0x7'));router[_0xe62f('0x8')]('/',auth[_0xe62f('0x9')](),controller['index']);router[_0xe62f('0x8')](_0xe62f('0xa'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xb')]);router['get'](_0xe62f('0xc'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xd')]);router[_0xe62f('0x8')](_0xe62f('0xe'),auth[_0xe62f('0x9')](),controller[_0xe62f('0xf')]);router[_0xe62f('0x8')](_0xe62f('0x10'),auth[_0xe62f('0x9')](),controller[_0xe62f('0x11')]);router[_0xe62f('0x12')]('/',auth[_0xe62f('0x9')](),controller[_0xe62f('0x13')]);router[_0xe62f('0x14')]('/:id',auth[_0xe62f('0x9')](),controller[_0xe62f('0x15')]);router[_0xe62f('0x16')](_0xe62f('0xa'),auth['isAuthenticated'](),controller[_0xe62f('0x17')]);module[_0xe62f('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 6b769b4..e938891 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 _0xba7a=['exports','STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba7a,0xd7));var _0xaba7=function(_0x465bb4,_0x477d66){_0x465bb4=_0x465bb4-0x0;var _0xf74165=_0xba7a[_0x465bb4];return _0xf74165;};'use strict';var Sequelize=require(_0xaba7('0x0'));module[_0xaba7('0x1')]={'name':{'type':Sequelize[_0xaba7('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe676=['exports','STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe676,0x6e));var _0x6e67=function(_0x5d860f,_0x467498){_0x5d860f=_0x5d860f-0x0;var _0x236490=_0xe676[_0x5d860f];return _0x236490;};'use strict';var Sequelize=require(_0x6e67('0x0'));module[_0x6e67('0x1')]={'name':{'type':Sequelize[_0x6e67('0x2')]},'description':{'type':Sequelize[_0x6e67('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 67f8117..f8cd748 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 _0x9e0c=['nolimit','order','sort','pick','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','then','info','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','destroy','stack','name','send','index','SugarcrmConfiguration','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','length'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x9e0c,0x16e));var _0xc9e0=function(_0x4d4ded,_0x517798){_0x4d4ded=_0x4d4ded-0x0;var _0x51bda7=_0x9e0c[_0x4d4ded];return _0x51bda7;};'use strict';var jsonpatch=require(_0xc9e0('0x0'));var rp=require(_0xc9e0('0x1'));var moment=require(_0xc9e0('0x2'));var BPromise=require(_0xc9e0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc9e0('0x4'));var sox=require(_0xc9e0('0x5'));var csv=require(_0xc9e0('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9e0('0x7'));var squel=require(_0xc9e0('0x8'));var crypto=require(_0xc9e0('0x9'));var jsforce=require(_0xc9e0('0xa'));var deskjs=require(_0xc9e0('0xb'));var toCsv=require(_0xc9e0('0x6'));var querystring=require(_0xc9e0('0xc'));var Papa=require(_0xc9e0('0xd'));var qs=require(_0xc9e0('0xe'));var logger=require(_0xc9e0('0xf'))(_0xc9e0('0x10'));var utils=require(_0xc9e0('0x11'));var config=require(_0xc9e0('0x12'));var db=require(_0xc9e0('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc9e0('0x14')][_0xc9e0('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x1e3dfe,_0xbbeaac,_0x2f200a,_0x466ec7){return new BPromise(function(_0x123f48,_0x25660e){var _0x530332=_0x466ec7||client;return _0x530332['request'](_0x1e3dfe,_0x2f200a)[_0xc9e0('0x16')](function(_0x5b90d3){logger[_0xc9e0('0x17')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xbbeaac,'request\x20sent');logger[_0xc9e0('0x18')](_0xc9e0('0x19'),_0xbbeaac,'request\x20sent',JSON['stringify'](_0x5b90d3));if(_0x5b90d3[_0xc9e0('0x1a')]){if(_0x5b90d3[_0xc9e0('0x1a')][_0xc9e0('0x1b')]===0x1f4){logger[_0xc9e0('0x1a')](_0xc9e0('0x1c'),_0xbbeaac,_0x5b90d3[_0xc9e0('0x1a')][_0xc9e0('0x1d')]);return _0x25660e(_0x5b90d3[_0xc9e0('0x1a')][_0xc9e0('0x1d')]);}logger[_0xc9e0('0x1a')](_0xc9e0('0x1c'),_0xbbeaac,_0x5b90d3[_0xc9e0('0x1a')][_0xc9e0('0x1d')]);return _0x123f48(_0x5b90d3[_0xc9e0('0x1a')][_0xc9e0('0x1d')]);}else{logger[_0xc9e0('0x17')](_0xc9e0('0x1c'),_0xbbeaac,_0xc9e0('0x1e'));_0x123f48(_0x5b90d3[_0xc9e0('0x1f')][_0xc9e0('0x1d')]);}})[_0xc9e0('0x20')](function(_0x3221e0){logger['error'](_0xc9e0('0x1c'),_0xbbeaac,_0x3221e0);_0x25660e(_0x3221e0);});});}function respondWithStatusCode(_0x4b1d67,_0x44ab5e){_0x44ab5e=_0x44ab5e||0xcc;return function(_0x5a2ec9){if(_0x5a2ec9){return _0x4b1d67[_0xc9e0('0x21')](_0x44ab5e);}return _0x4b1d67[_0xc9e0('0x22')](_0x44ab5e)[_0xc9e0('0x23')]();};}function respondWithResult(_0x3cc59e,_0x20db9c){_0x20db9c=_0x20db9c||0xc8;return function(_0x499ce6){if(_0x499ce6){return _0x3cc59e[_0xc9e0('0x22')](_0x20db9c)['json'](_0x499ce6);}};}function respondWithFilteredResult(_0x4d5778,_0x3c0b53){return function(_0x11c65d){if(_0x11c65d){var _0x1ca5cb=_0x11c65d[_0xc9e0('0x24')],_0x22f8ce=_0x3c0b53[_0xc9e0('0x25')],_0x10280b=_0x3c0b53[_0xc9e0('0x25')]+_0x3c0b53[_0xc9e0('0x26')],_0x575d73;if(_0x10280b>=_0x1ca5cb){_0x10280b=_0x1ca5cb;_0x575d73=0xc8;}else{_0x575d73=0xce;}_0x4d5778[_0xc9e0('0x22')](_0x575d73);return _0x4d5778['set'](_0xc9e0('0x27'),_0x22f8ce+'-'+_0x10280b+'/'+_0x1ca5cb)['json'](_0x11c65d);}return null;};}function patchUpdates(_0x44248c){return function(_0x2584cd){try{jsonpatch[_0xc9e0('0x28')](_0x2584cd,_0x44248c,!![]);}catch(_0x355af2){return BPromise[_0xc9e0('0x29')](_0x355af2);}return _0x2584cd['save']();};}function saveUpdates(_0x51fe39,_0xcc1a76){return function(_0xda4d1b){if(_0xda4d1b){return _0xda4d1b['update'](_0x51fe39)[_0xc9e0('0x16')](function(_0x593a89){return _0x593a89;});}return null;};}function removeEntity(_0x24cd45,_0x3dd3b6){return function(_0x4a1a91){if(_0x4a1a91){return _0x4a1a91[_0xc9e0('0x2a')]()[_0xc9e0('0x16')](function(){_0x24cd45[_0xc9e0('0x22')](0xcc)[_0xc9e0('0x23')]();});}};}function handleEntityNotFound(_0x3b5e37,_0x195ab4){return function(_0x578ceb){if(!_0x578ceb){_0x3b5e37[_0xc9e0('0x21')](0x194);}return _0x578ceb;};}function handleError(_0x3132db,_0x15988b){_0x15988b=_0x15988b||0x1f4;return function(_0x15bdad){logger['error'](_0x15bdad[_0xc9e0('0x2b')]);if(_0x15bdad[_0xc9e0('0x2c')]){delete _0x15bdad[_0xc9e0('0x2c')];}_0x3132db['status'](_0x15988b)[_0xc9e0('0x2d')](_0x15bdad);};}exports[_0xc9e0('0x2e')]=function(_0x1c1a53,_0x4ee211){var _0x2fbd99={},_0x32fb92={},_0x41b010={'count':0x0,'rows':[]};var _0x6c53e8=db[_0xc9e0('0x2f')][_0xc9e0('0x30')];_0x32fb92['model']=_['keys'](_0x6c53e8);var _0x5859bd={'dateStart':_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x32')],'dateEnd':_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x33')]};delete _0x1c1a53['query']['dateStart'];delete _0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x33')];_0x32fb92[_0xc9e0('0x31')]=_[_0xc9e0('0x34')](_0x1c1a53['query']);_0x32fb92[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x32fb92[_0xc9e0('0x37')],_0x32fb92['query']);_0x2fbd99[_0xc9e0('0x38')]=_[_0xc9e0('0x36')](_0x32fb92[_0xc9e0('0x37')],qs[_0xc9e0('0x39')](_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x39')]));_0x2fbd99[_0xc9e0('0x38')]=_0x2fbd99['attributes'][_0xc9e0('0x3a')]?_0x2fbd99[_0xc9e0('0x38')]:_0x32fb92[_0xc9e0('0x37')];if(!_0x1c1a53[_0xc9e0('0x31')]['hasOwnProperty'](_0xc9e0('0x3b'))){_0x2fbd99[_0xc9e0('0x26')]=qs[_0xc9e0('0x26')](_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x26')]);_0x2fbd99[_0xc9e0('0x25')]=qs[_0xc9e0('0x25')](_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x25')]);}_0x2fbd99[_0xc9e0('0x3c')]=qs[_0xc9e0('0x3d')](_0x1c1a53[_0xc9e0('0x31')]['sort']);_0x2fbd99['where']=qs[_0xc9e0('0x35')](_[_0xc9e0('0x3e')](_0x1c1a53[_0xc9e0('0x31')],_0x32fb92[_0xc9e0('0x35')]));if(_0x5859bd[_0xc9e0('0x32')]){if(_0x5859bd[_0xc9e0('0x33')]){_0x5859bd['dateEnd']=moment(_0x5859bd[_0xc9e0('0x33')])[_0xc9e0('0x3f')](0x1,_0xc9e0('0x40'));}else{_0x5859bd['dateEnd']=moment(_0x5859bd['dateStart'])[_0xc9e0('0x3f')](0x1,_0xc9e0('0x40'));}_[_0xc9e0('0x41')](_0x2fbd99['where'],{'createdAt':{'$gte':_0x5859bd[_0xc9e0('0x32')],'$lte':_0x5859bd[_0xc9e0('0x33')]}});}if(_0x1c1a53['query']['filter']){_0x2fbd99[_0xc9e0('0x42')]=_[_0xc9e0('0x41')](_0x2fbd99[_0xc9e0('0x42')],{'$or':_[_0xc9e0('0x43')](_0x2fbd99[_0xc9e0('0x38')],function(_0x930d1c){var _0xa9fef0={};_0xa9fef0[_0x930d1c]={'$like':'%'+_0x1c1a53[_0xc9e0('0x31')][_0xc9e0('0x44')]+'%'};return _0xa9fef0;})});}_0x2fbd99=_['merge']({},_0x2fbd99,_0x1c1a53[_0xc9e0('0x45')]);var _0x5e6eca={'where':_0x2fbd99[_0xc9e0('0x42')]};return db[_0xc9e0('0x2f')][_0xc9e0('0x24')](_0x5e6eca)['then'](function(_0x548677){_0x41b010[_0xc9e0('0x24')]=_0x548677;if(_0x1c1a53['query'][_0xc9e0('0x46')]){_0x2fbd99[_0xc9e0('0x47')]=[{'all':!![]}];}return db[_0xc9e0('0x2f')][_0xc9e0('0x48')](_0x2fbd99);})[_0xc9e0('0x16')](function(_0x539440){_0x41b010[_0xc9e0('0x49')]=_0x539440;return _0x41b010;})[_0xc9e0('0x16')](respondWithFilteredResult(_0x4ee211,_0x2fbd99))[_0xc9e0('0x20')](handleError(_0x4ee211,null));};exports[_0xc9e0('0x4a')]=function(_0x1b2f4a,_0x527593){var _0x3233cf={'raw':![],'where':{'id':_0x1b2f4a[_0xc9e0('0x4b')]['id']}},_0x3262ff={};_0x3262ff[_0xc9e0('0x37')]=_['keys'](db[_0xc9e0('0x2f')]['rawAttributes']);_0x3262ff['query']=_[_0xc9e0('0x34')](_0x1b2f4a[_0xc9e0('0x31')]);_0x3262ff[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x3262ff[_0xc9e0('0x37')],_0x3262ff[_0xc9e0('0x31')]);_0x3233cf[_0xc9e0('0x38')]=_[_0xc9e0('0x36')](_0x3262ff['model'],qs[_0xc9e0('0x39')](_0x1b2f4a[_0xc9e0('0x31')][_0xc9e0('0x39')]));_0x3233cf['attributes']=_0x3233cf[_0xc9e0('0x38')][_0xc9e0('0x3a')]?_0x3233cf[_0xc9e0('0x38')]:_0x3262ff['model'];if(_0x1b2f4a['query'][_0xc9e0('0x46')]){_0x3233cf[_0xc9e0('0x47')]=[{'all':!![]}];}_0x3233cf=_[_0xc9e0('0x41')]({},_0x3233cf,_0x1b2f4a['options']);return db[_0xc9e0('0x2f')][_0xc9e0('0x4c')](_0x3233cf)[_0xc9e0('0x16')](handleEntityNotFound(_0x527593,null))[_0xc9e0('0x16')](respondWithResult(_0x527593,null))[_0xc9e0('0x20')](handleError(_0x527593,null));};exports[_0xc9e0('0x4d')]=function(_0x4ea915,_0x1aa66c){return db[_0xc9e0('0x2f')][_0xc9e0('0x4d')](_0x4ea915[_0xc9e0('0x4e')],{})[_0xc9e0('0x16')](respondWithResult(_0x1aa66c,0xc9))[_0xc9e0('0x20')](handleError(_0x1aa66c,null));};exports['update']=function(_0x3ee452,_0x5e31d6){if(_0x3ee452['body']['id']){delete _0x3ee452[_0xc9e0('0x4e')]['id'];}return db[_0xc9e0('0x2f')][_0xc9e0('0x4c')]({'where':{'id':_0x3ee452[_0xc9e0('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5e31d6,null))[_0xc9e0('0x16')](saveUpdates(_0x3ee452[_0xc9e0('0x4e')],null))[_0xc9e0('0x16')](respondWithResult(_0x5e31d6,null))['catch'](handleError(_0x5e31d6,null));};exports[_0xc9e0('0x2a')]=function(_0x9ba8ca,_0x17a79b){return db[_0xc9e0('0x2f')]['find']({'where':{'id':_0x9ba8ca[_0xc9e0('0x4b')]['id']}})[_0xc9e0('0x16')](handleEntityNotFound(_0x17a79b,null))[_0xc9e0('0x16')](removeEntity(_0x17a79b,null))['catch'](handleError(_0x17a79b,null));};exports[_0xc9e0('0x4f')]=function(_0x35f136,_0x3f0bed,_0x38f3b0){var _0x14d3f4={};var _0x881f43={};var _0x3101de;var _0x59a941;return db[_0xc9e0('0x2f')][_0xc9e0('0x50')]({'where':{'id':_0x35f136[_0xc9e0('0x4b')]['id']}})[_0xc9e0('0x16')](handleEntityNotFound(_0x3f0bed,null))[_0xc9e0('0x16')](function(_0x39525d){if(_0x39525d){_0x3101de=_0x39525d;_0x881f43[_0xc9e0('0x37')]=_[_0xc9e0('0x34')](db[_0xc9e0('0x51')][_0xc9e0('0x30')]);_0x881f43[_0xc9e0('0x31')]=_[_0xc9e0('0x34')](_0x35f136[_0xc9e0('0x31')]);_0x881f43[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x881f43[_0xc9e0('0x37')],_0x881f43[_0xc9e0('0x31')]);_0x14d3f4[_0xc9e0('0x38')]=_[_0xc9e0('0x36')](_0x881f43['model'],qs['fields'](_0x35f136[_0xc9e0('0x31')]['fields']));_0x14d3f4['attributes']=_0x14d3f4[_0xc9e0('0x38')][_0xc9e0('0x3a')]?_0x14d3f4[_0xc9e0('0x38')]:_0x881f43[_0xc9e0('0x37')];_0x14d3f4[_0xc9e0('0x3c')]=qs['sort'](_0x35f136[_0xc9e0('0x31')][_0xc9e0('0x3d')]);_0x14d3f4[_0xc9e0('0x42')]=qs[_0xc9e0('0x35')](_[_0xc9e0('0x3e')](_0x35f136[_0xc9e0('0x31')],_0x881f43[_0xc9e0('0x35')]));if(_0x35f136[_0xc9e0('0x31')][_0xc9e0('0x44')]){_0x14d3f4[_0xc9e0('0x42')]=_[_0xc9e0('0x41')](_0x14d3f4[_0xc9e0('0x42')],{'$or':_['map'](_0x14d3f4['attributes'],function(_0x38c98f){var _0x2408b4={};_0x2408b4[_0x38c98f]={'$like':'%'+_0x35f136[_0xc9e0('0x31')][_0xc9e0('0x44')]+'%'};return _0x2408b4;})});}_0x14d3f4=_[_0xc9e0('0x41')]({},_0x14d3f4,_0x35f136[_0xc9e0('0x45')]);return _0x3101de[_0xc9e0('0x4f')](_0x14d3f4);}})[_0xc9e0('0x16')](function(_0x2bb30e){if(_0x2bb30e){_0x59a941=_0x2bb30e['length'];if(!_0x35f136[_0xc9e0('0x31')][_0xc9e0('0x52')]('nolimit')){_0x14d3f4[_0xc9e0('0x26')]=qs[_0xc9e0('0x26')](_0x35f136[_0xc9e0('0x31')][_0xc9e0('0x26')]);_0x14d3f4['offset']=qs[_0xc9e0('0x25')](_0x35f136['query'][_0xc9e0('0x25')]);}return _0x3101de[_0xc9e0('0x4f')](_0x14d3f4);}})[_0xc9e0('0x16')](function(_0x2a61c0){if(_0x2a61c0){return _0x2a61c0?{'count':_0x59a941,'rows':_0x2a61c0}:null;}})[_0xc9e0('0x16')](respondWithResult(_0x3f0bed,null))[_0xc9e0('0x20')](handleError(_0x3f0bed,null));};exports[_0xc9e0('0x53')]=function(_0x5e4548,_0x62d7b2,_0x1ab905){var _0x103713={};var _0x3d685c={};var _0x284e54;var _0x16bba4;return db[_0xc9e0('0x2f')][_0xc9e0('0x50')]({'where':{'id':_0x5e4548[_0xc9e0('0x4b')]['id']}})[_0xc9e0('0x16')](handleEntityNotFound(_0x62d7b2,null))['then'](function(_0x43fa0b){if(_0x43fa0b){_0x284e54=_0x43fa0b;_0x3d685c[_0xc9e0('0x37')]=_[_0xc9e0('0x34')](db['SugarcrmField'][_0xc9e0('0x30')]);_0x3d685c['query']=_[_0xc9e0('0x34')](_0x5e4548[_0xc9e0('0x31')]);_0x3d685c[_0xc9e0('0x35')]=_[_0xc9e0('0x36')](_0x3d685c[_0xc9e0('0x37')],_0x3d685c[_0xc9e0('0x31')]);_0x103713[_0xc9e0('0x38')]=_[_0xc9e0('0x36')](_0x3d685c[_0xc9e0('0x37')],qs[_0xc9e0('0x39')](_0x5e4548['query'][_0xc9e0('0x39')]));_0x103713[_0xc9e0('0x38')]=_0x103713[_0xc9e0('0x38')][_0xc9e0('0x3a')]?_0x103713[_0xc9e0('0x38')]:_0x3d685c['model'];_0x103713[_0xc9e0('0x3c')]=qs[_0xc9e0('0x3d')](_0x5e4548[_0xc9e0('0x31')][_0xc9e0('0x3d')]);_0x103713[_0xc9e0('0x42')]=qs[_0xc9e0('0x35')](_['pick'](_0x5e4548[_0xc9e0('0x31')],_0x3d685c['filters']));if(_0x5e4548[_0xc9e0('0x31')][_0xc9e0('0x44')]){_0x103713[_0xc9e0('0x42')]=_['merge'](_0x103713[_0xc9e0('0x42')],{'$or':_[_0xc9e0('0x43')](_0x103713[_0xc9e0('0x38')],function(_0x13a9eb){var _0x27a0de={};_0x27a0de[_0x13a9eb]={'$like':'%'+_0x5e4548[_0xc9e0('0x31')][_0xc9e0('0x44')]+'%'};return _0x27a0de;})});}_0x103713=_[_0xc9e0('0x41')]({},_0x103713,_0x5e4548[_0xc9e0('0x45')]);return _0x284e54[_0xc9e0('0x53')](_0x103713);}})[_0xc9e0('0x16')](function(_0x4525e1){if(_0x4525e1){_0x16bba4=_0x4525e1['length'];if(!_0x5e4548[_0xc9e0('0x31')][_0xc9e0('0x52')](_0xc9e0('0x3b'))){_0x103713[_0xc9e0('0x26')]=qs[_0xc9e0('0x26')](_0x5e4548[_0xc9e0('0x31')]['limit']);_0x103713[_0xc9e0('0x25')]=qs[_0xc9e0('0x25')](_0x5e4548[_0xc9e0('0x31')][_0xc9e0('0x25')]);}return _0x284e54[_0xc9e0('0x53')](_0x103713);}})['then'](function(_0x221eaf){if(_0x221eaf){return _0x221eaf?{'count':_0x16bba4,'rows':_0x221eaf}:null;}})[_0xc9e0('0x16')](respondWithResult(_0x62d7b2,null))['catch'](handleError(_0x62d7b2,null));};exports[_0xc9e0('0x54')]=function(_0x230cff,_0x1f738b,_0x18fd5e){var _0x18a185={};var _0x1aee70={};var _0xe8767d;var _0x8290a1;return db[_0xc9e0('0x2f')][_0xc9e0('0x50')]({'where':{'id':_0x230cff[_0xc9e0('0x4b')]['id']}})[_0xc9e0('0x16')](handleEntityNotFound(_0x1f738b,null))['then'](function(_0x5f17d7){if(_0x5f17d7){_0xe8767d=_0x5f17d7;_0x1aee70[_0xc9e0('0x37')]=_['keys'](db[_0xc9e0('0x51')]['rawAttributes']);_0x1aee70[_0xc9e0('0x31')]=_[_0xc9e0('0x34')](_0x230cff['query']);_0x1aee70['filters']=_[_0xc9e0('0x36')](_0x1aee70['model'],_0x1aee70[_0xc9e0('0x31')]);_0x18a185[_0xc9e0('0x38')]=_[_0xc9e0('0x36')](_0x1aee70[_0xc9e0('0x37')],qs[_0xc9e0('0x39')](_0x230cff[_0xc9e0('0x31')][_0xc9e0('0x39')]));_0x18a185[_0xc9e0('0x38')]=_0x18a185['attributes'][_0xc9e0('0x3a')]?_0x18a185[_0xc9e0('0x38')]:_0x1aee70[_0xc9e0('0x37')];_0x18a185[_0xc9e0('0x3c')]=qs[_0xc9e0('0x3d')](_0x230cff[_0xc9e0('0x31')][_0xc9e0('0x3d')]);_0x18a185[_0xc9e0('0x42')]=qs[_0xc9e0('0x35')](_[_0xc9e0('0x3e')](_0x230cff[_0xc9e0('0x31')],_0x1aee70[_0xc9e0('0x35')]));if(_0x230cff[_0xc9e0('0x31')][_0xc9e0('0x44')]){_0x18a185[_0xc9e0('0x42')]=_[_0xc9e0('0x41')](_0x18a185[_0xc9e0('0x42')],{'$or':_[_0xc9e0('0x43')](_0x18a185[_0xc9e0('0x38')],function(_0x281b8c){var _0x37f9c1={};_0x37f9c1[_0x281b8c]={'$like':'%'+_0x230cff[_0xc9e0('0x31')][_0xc9e0('0x44')]+'%'};return _0x37f9c1;})});}_0x18a185=_[_0xc9e0('0x41')]({},_0x18a185,_0x230cff['options']);return _0xe8767d['getDescriptions'](_0x18a185);}})[_0xc9e0('0x16')](function(_0x474055){if(_0x474055){_0x8290a1=_0x474055[_0xc9e0('0x3a')];if(!_0x230cff[_0xc9e0('0x31')][_0xc9e0('0x52')](_0xc9e0('0x3b'))){_0x18a185[_0xc9e0('0x26')]=qs[_0xc9e0('0x26')](_0x230cff['query'][_0xc9e0('0x26')]);_0x18a185[_0xc9e0('0x25')]=qs[_0xc9e0('0x25')](_0x230cff['query'][_0xc9e0('0x25')]);}return _0xe8767d[_0xc9e0('0x54')](_0x18a185);}})['then'](function(_0x1d9a36){if(_0x1d9a36){return _0x1d9a36?{'count':_0x8290a1,'rows':_0x1d9a36}:null;}})[_0xc9e0('0x16')](respondWithResult(_0x1f738b,null))['catch'](handleError(_0x1f738b,null));}; \ No newline at end of file +var _0xb3a3=['destroy','getFields','getSubjects','findOne','getDescriptions','SugarcrmField','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','name','index','SugarcrmConfiguration','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','params','rawAttributes','length','find','create','body'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb3a3,0x1a5));var _0x3b3a=function(_0x2d7427,_0x4a9645){_0x2d7427=_0x2d7427-0x0;var _0x15d012=_0xb3a3[_0x2d7427];return _0x15d012;};'use strict';var jsonpatch=require(_0x3b3a('0x0'));var rp=require(_0x3b3a('0x1'));var moment=require(_0x3b3a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3b3a('0x3'));var util=require(_0x3b3a('0x4'));var path=require(_0x3b3a('0x5'));var sox=require('sox');var csv=require(_0x3b3a('0x6'));var ejs=require(_0x3b3a('0x7'));var fs=require('fs');var _=require(_0x3b3a('0x8'));var squel=require(_0x3b3a('0x9'));var crypto=require(_0x3b3a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x3b3a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x3b3a('0xc'));var Papa=require('papaparse');var qs=require(_0x3b3a('0xd'));var logger=require(_0x3b3a('0xe'))(_0x3b3a('0xf'));var utils=require(_0x3b3a('0x10'));var config=require(_0x3b3a('0x11'));var db=require(_0x3b3a('0x12'))['db'];var jayson=require(_0x3b3a('0x13'));var client=jayson[_0x3b3a('0x14')][_0x3b3a('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x56c3de,_0x5223b9,_0x7dde6c,_0x4793cb){return new BPromise(function(_0x48cb60,_0x32664f){var _0x51bf70=_0x4793cb||client;return _0x51bf70['request'](_0x56c3de,_0x7dde6c)[_0x3b3a('0x16')](function(_0x1eeeca){logger['info'](_0x3b3a('0x17'),_0x5223b9,_0x3b3a('0x18'));logger[_0x3b3a('0x19')](_0x3b3a('0x1a'),_0x5223b9,_0x3b3a('0x18'),JSON['stringify'](_0x1eeeca));if(_0x1eeeca[_0x3b3a('0x1b')]){if(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1c')]===0x1f4){logger['error'](_0x3b3a('0x17'),_0x5223b9,_0x1eeeca[_0x3b3a('0x1b')]['message']);return _0x32664f(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1d')]);}logger[_0x3b3a('0x1b')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5223b9,_0x1eeeca['error']['message']);return _0x48cb60(_0x1eeeca[_0x3b3a('0x1b')][_0x3b3a('0x1d')]);}else{logger['info'](_0x3b3a('0x17'),_0x5223b9,'request\x20sent');_0x48cb60(_0x1eeeca[_0x3b3a('0x1e')][_0x3b3a('0x1d')]);}})[_0x3b3a('0x1f')](function(_0x55e7c7){logger[_0x3b3a('0x1b')](_0x3b3a('0x17'),_0x5223b9,_0x55e7c7);_0x32664f(_0x55e7c7);});});}function respondWithStatusCode(_0x4f31d4,_0x3ae5d6){_0x3ae5d6=_0x3ae5d6||0xcc;return function(_0x60f1f){if(_0x60f1f){return _0x4f31d4[_0x3b3a('0x20')](_0x3ae5d6);}return _0x4f31d4[_0x3b3a('0x21')](_0x3ae5d6)[_0x3b3a('0x22')]();};}function respondWithResult(_0x399caf,_0x2bf671){_0x2bf671=_0x2bf671||0xc8;return function(_0xcaa903){if(_0xcaa903){return _0x399caf[_0x3b3a('0x21')](_0x2bf671)[_0x3b3a('0x23')](_0xcaa903);}};}function respondWithFilteredResult(_0x2ae35b,_0x217383){return function(_0x2160de){if(_0x2160de){var _0x2855c2=_0x2160de[_0x3b3a('0x24')],_0x46ada6=_0x217383[_0x3b3a('0x25')],_0x1ca6a0=_0x217383['offset']+_0x217383['limit'],_0x4531c7;if(_0x1ca6a0>=_0x2855c2){_0x1ca6a0=_0x2855c2;_0x4531c7=0xc8;}else{_0x4531c7=0xce;}_0x2ae35b[_0x3b3a('0x21')](_0x4531c7);return _0x2ae35b[_0x3b3a('0x26')](_0x3b3a('0x27'),_0x46ada6+'-'+_0x1ca6a0+'/'+_0x2855c2)['json'](_0x2160de);}return null;};}function patchUpdates(_0x2e9c16){return function(_0x1a93a4){try{jsonpatch[_0x3b3a('0x28')](_0x1a93a4,_0x2e9c16,!![]);}catch(_0x24162b){return BPromise['reject'](_0x24162b);}return _0x1a93a4[_0x3b3a('0x29')]();};}function saveUpdates(_0x542133,_0xe11af0){return function(_0x4ddf78){if(_0x4ddf78){return _0x4ddf78[_0x3b3a('0x2a')](_0x542133)['then'](function(_0x55db6c){return _0x55db6c;});}return null;};}function removeEntity(_0x1018ad,_0x4f3934){return function(_0x48a8fe){if(_0x48a8fe){return _0x48a8fe['destroy']()['then'](function(){_0x1018ad[_0x3b3a('0x21')](0xcc)[_0x3b3a('0x22')]();});}};}function handleEntityNotFound(_0x1820e2,_0x36e712){return function(_0x2aa0a8){if(!_0x2aa0a8){_0x1820e2[_0x3b3a('0x20')](0x194);}return _0x2aa0a8;};}function handleError(_0x19dd91,_0x348dbb){_0x348dbb=_0x348dbb||0x1f4;return function(_0x3075bc){logger[_0x3b3a('0x1b')](_0x3075bc['stack']);if(_0x3075bc[_0x3b3a('0x2b')]){delete _0x3075bc[_0x3b3a('0x2b')];}_0x19dd91[_0x3b3a('0x21')](_0x348dbb)['send'](_0x3075bc);};}exports[_0x3b3a('0x2c')]=function(_0x31b9d4,_0xbf7b13){var _0x48c502={},_0x154b71={},_0x240866={'count':0x0,'rows':[]};var _0x501c76=db[_0x3b3a('0x2d')]['rawAttributes'];_0x154b71[_0x3b3a('0x2e')]=_[_0x3b3a('0x2f')](_0x501c76);var _0x5bc760={'dateStart':_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x31')],'dateEnd':_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x32')]};delete _0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x31')];delete _0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x32')];_0x154b71[_0x3b3a('0x30')]=_['keys'](_0x31b9d4[_0x3b3a('0x30')]);_0x154b71[_0x3b3a('0x33')]=_['intersection'](_0x154b71[_0x3b3a('0x2e')],_0x154b71['query']);_0x48c502['attributes']=_[_0x3b3a('0x34')](_0x154b71[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x48c502[_0x3b3a('0x36')]=_0x48c502[_0x3b3a('0x36')]['length']?_0x48c502['attributes']:_0x154b71[_0x3b3a('0x2e')];if(!_0x31b9d4['query'][_0x3b3a('0x37')](_0x3b3a('0x38'))){_0x48c502[_0x3b3a('0x39')]=qs[_0x3b3a('0x39')](_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x48c502['offset']=qs[_0x3b3a('0x25')](_0x31b9d4['query'][_0x3b3a('0x25')]);}_0x48c502[_0x3b3a('0x3a')]=qs[_0x3b3a('0x3b')](_0x31b9d4[_0x3b3a('0x30')]['sort']);_0x48c502[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0x31b9d4[_0x3b3a('0x30')],_0x154b71[_0x3b3a('0x33')]));if(_0x5bc760['dateStart']){if(_0x5bc760[_0x3b3a('0x32')]){_0x5bc760['dateEnd']=moment(_0x5bc760['dateEnd'])[_0x3b3a('0x3e')](0x1,_0x3b3a('0x3f'));}else{_0x5bc760['dateEnd']=moment(_0x5bc760['dateStart'])[_0x3b3a('0x3e')](0x1,_0x3b3a('0x3f'));}_[_0x3b3a('0x40')](_0x48c502[_0x3b3a('0x3c')],{'createdAt':{'$gte':_0x5bc760[_0x3b3a('0x31')],'$lte':_0x5bc760[_0x3b3a('0x32')]}});}if(_0x31b9d4['query'][_0x3b3a('0x41')]){_0x48c502[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x48c502[_0x3b3a('0x3c')],{'$or':_[_0x3b3a('0x42')](_0x48c502['attributes'],function(_0x2afa1d){var _0x18fb01={};_0x18fb01[_0x2afa1d]={'$like':'%'+_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x18fb01;})});}_0x48c502=_[_0x3b3a('0x40')]({},_0x48c502,_0x31b9d4[_0x3b3a('0x43')]);var _0x505fd2={'where':_0x48c502[_0x3b3a('0x3c')]};return db[_0x3b3a('0x2d')][_0x3b3a('0x24')](_0x505fd2)[_0x3b3a('0x16')](function(_0x4a5f0e){_0x240866[_0x3b3a('0x24')]=_0x4a5f0e;if(_0x31b9d4[_0x3b3a('0x30')][_0x3b3a('0x44')]){_0x48c502[_0x3b3a('0x45')]=[{'all':!![]}];}return db[_0x3b3a('0x2d')][_0x3b3a('0x46')](_0x48c502);})['then'](function(_0x3cf72f){_0x240866['rows']=_0x3cf72f;return _0x240866;})[_0x3b3a('0x16')](respondWithFilteredResult(_0xbf7b13,_0x48c502))[_0x3b3a('0x1f')](handleError(_0xbf7b13,null));};exports['show']=function(_0x1ccdd7,_0xbbbd46){var _0x3ae5c2={'raw':![],'where':{'id':_0x1ccdd7[_0x3b3a('0x47')]['id']}},_0x3584f0={};_0x3584f0[_0x3b3a('0x2e')]=_['keys'](db[_0x3b3a('0x2d')][_0x3b3a('0x48')]);_0x3584f0[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0x1ccdd7[_0x3b3a('0x30')]);_0x3584f0[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x3584f0[_0x3b3a('0x2e')],_0x3584f0[_0x3b3a('0x30')]);_0x3ae5c2[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x3584f0[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x1ccdd7[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x3ae5c2['attributes']=_0x3ae5c2[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x3ae5c2[_0x3b3a('0x36')]:_0x3584f0[_0x3b3a('0x2e')];if(_0x1ccdd7[_0x3b3a('0x30')][_0x3b3a('0x44')]){_0x3ae5c2[_0x3b3a('0x45')]=[{'all':!![]}];}_0x3ae5c2=_[_0x3b3a('0x40')]({},_0x3ae5c2,_0x1ccdd7[_0x3b3a('0x43')]);return db['SugarcrmConfiguration'][_0x3b3a('0x4a')](_0x3ae5c2)[_0x3b3a('0x16')](handleEntityNotFound(_0xbbbd46,null))[_0x3b3a('0x16')](respondWithResult(_0xbbbd46,null))[_0x3b3a('0x1f')](handleError(_0xbbbd46,null));};exports['create']=function(_0xbac751,_0xc16104){return db[_0x3b3a('0x2d')][_0x3b3a('0x4b')](_0xbac751[_0x3b3a('0x4c')],{})['then'](respondWithResult(_0xc16104,0xc9))[_0x3b3a('0x1f')](handleError(_0xc16104,null));};exports['update']=function(_0x7809c8,_0x35fdac){if(_0x7809c8[_0x3b3a('0x4c')]['id']){delete _0x7809c8[_0x3b3a('0x4c')]['id'];}return db['SugarcrmConfiguration'][_0x3b3a('0x4a')]({'where':{'id':_0x7809c8['params']['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x35fdac,null))[_0x3b3a('0x16')](saveUpdates(_0x7809c8[_0x3b3a('0x4c')],null))[_0x3b3a('0x16')](respondWithResult(_0x35fdac,null))[_0x3b3a('0x1f')](handleError(_0x35fdac,null));};exports[_0x3b3a('0x4d')]=function(_0x2fe5cb,_0x3d5265){return db[_0x3b3a('0x2d')]['find']({'where':{'id':_0x2fe5cb[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x3d5265,null))[_0x3b3a('0x16')](removeEntity(_0x3d5265,null))['catch'](handleError(_0x3d5265,null));};exports[_0x3b3a('0x4e')]=function(_0x342231,_0x5448d4,_0x16ef18){var _0x9fb738={};var _0x4a3f16={};var _0x19fd6;var _0x1ab7d0;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x342231[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x5448d4,null))[_0x3b3a('0x16')](function(_0x3721ad){if(_0x3721ad){_0x19fd6=_0x3721ad;_0x4a3f16[_0x3b3a('0x2e')]=_[_0x3b3a('0x2f')](db['SugarcrmField'][_0x3b3a('0x48')]);_0x4a3f16[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0x342231[_0x3b3a('0x30')]);_0x4a3f16[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x4a3f16[_0x3b3a('0x2e')],_0x4a3f16['query']);_0x9fb738[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x4a3f16[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x9fb738[_0x3b3a('0x36')]=_0x9fb738[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x9fb738['attributes']:_0x4a3f16['model'];_0x9fb738['order']=qs[_0x3b3a('0x3b')](_0x342231['query']['sort']);_0x9fb738[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0x342231['query'],_0x4a3f16[_0x3b3a('0x33')]));if(_0x342231[_0x3b3a('0x30')][_0x3b3a('0x41')]){_0x9fb738[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x9fb738[_0x3b3a('0x3c')],{'$or':_[_0x3b3a('0x42')](_0x9fb738[_0x3b3a('0x36')],function(_0x30205b){var _0x3de122={};_0x3de122[_0x30205b]={'$like':'%'+_0x342231[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x3de122;})});}_0x9fb738=_[_0x3b3a('0x40')]({},_0x9fb738,_0x342231[_0x3b3a('0x43')]);return _0x19fd6[_0x3b3a('0x4e')](_0x9fb738);}})['then'](function(_0x4de33b){if(_0x4de33b){_0x1ab7d0=_0x4de33b[_0x3b3a('0x49')];if(!_0x342231[_0x3b3a('0x30')][_0x3b3a('0x37')]('nolimit')){_0x9fb738['limit']=qs[_0x3b3a('0x39')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x9fb738[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0x342231[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x19fd6[_0x3b3a('0x4e')](_0x9fb738);}})['then'](function(_0x126891){if(_0x126891){return _0x126891?{'count':_0x1ab7d0,'rows':_0x126891}:null;}})['then'](respondWithResult(_0x5448d4,null))[_0x3b3a('0x1f')](handleError(_0x5448d4,null));};exports[_0x3b3a('0x4f')]=function(_0xf415a6,_0x51d26c,_0x188501){var _0x759db8={};var _0x1894c8={};var _0x178c78;var _0x44fc3e;return db[_0x3b3a('0x2d')][_0x3b3a('0x50')]({'where':{'id':_0xf415a6[_0x3b3a('0x47')]['id']}})[_0x3b3a('0x16')](handleEntityNotFound(_0x51d26c,null))[_0x3b3a('0x16')](function(_0x3c232f){if(_0x3c232f){_0x178c78=_0x3c232f;_0x1894c8['model']=_['keys'](db['SugarcrmField'][_0x3b3a('0x48')]);_0x1894c8[_0x3b3a('0x30')]=_[_0x3b3a('0x2f')](_0xf415a6[_0x3b3a('0x30')]);_0x1894c8[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x1894c8['model'],_0x1894c8['query']);_0x759db8['attributes']=_[_0x3b3a('0x34')](_0x1894c8[_0x3b3a('0x2e')],qs['fields'](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x759db8['attributes']=_0x759db8[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x759db8[_0x3b3a('0x36')]:_0x1894c8[_0x3b3a('0x2e')];_0x759db8['order']=qs[_0x3b3a('0x3b')](_0xf415a6['query'][_0x3b3a('0x3b')]);_0x759db8[_0x3b3a('0x3c')]=qs[_0x3b3a('0x33')](_[_0x3b3a('0x3d')](_0xf415a6[_0x3b3a('0x30')],_0x1894c8[_0x3b3a('0x33')]));if(_0xf415a6[_0x3b3a('0x30')]['filter']){_0x759db8[_0x3b3a('0x3c')]=_[_0x3b3a('0x40')](_0x759db8['where'],{'$or':_[_0x3b3a('0x42')](_0x759db8['attributes'],function(_0x3d9817){var _0x56cdd6={};_0x56cdd6[_0x3d9817]={'$like':'%'+_0xf415a6['query']['filter']+'%'};return _0x56cdd6;})});}_0x759db8=_['merge']({},_0x759db8,_0xf415a6[_0x3b3a('0x43')]);return _0x178c78[_0x3b3a('0x4f')](_0x759db8);}})[_0x3b3a('0x16')](function(_0x1e725e){if(_0x1e725e){_0x44fc3e=_0x1e725e[_0x3b3a('0x49')];if(!_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x37')]('nolimit')){_0x759db8[_0x3b3a('0x39')]=qs[_0x3b3a('0x39')](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x759db8[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0xf415a6[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x178c78[_0x3b3a('0x4f')](_0x759db8);}})[_0x3b3a('0x16')](function(_0x491987){if(_0x491987){return _0x491987?{'count':_0x44fc3e,'rows':_0x491987}:null;}})['then'](respondWithResult(_0x51d26c,null))[_0x3b3a('0x1f')](handleError(_0x51d26c,null));};exports[_0x3b3a('0x51')]=function(_0x43e71d,_0x292d1e,_0x536fc2){var _0x570505={};var _0x5686aa={};var _0x2b12e5;var _0x44b9e1;return db['SugarcrmConfiguration'][_0x3b3a('0x50')]({'where':{'id':_0x43e71d[_0x3b3a('0x47')]['id']}})['then'](handleEntityNotFound(_0x292d1e,null))[_0x3b3a('0x16')](function(_0x26b32e){if(_0x26b32e){_0x2b12e5=_0x26b32e;_0x5686aa[_0x3b3a('0x2e')]=_['keys'](db[_0x3b3a('0x52')][_0x3b3a('0x48')]);_0x5686aa['query']=_[_0x3b3a('0x2f')](_0x43e71d[_0x3b3a('0x30')]);_0x5686aa[_0x3b3a('0x33')]=_[_0x3b3a('0x34')](_0x5686aa[_0x3b3a('0x2e')],_0x5686aa[_0x3b3a('0x30')]);_0x570505[_0x3b3a('0x36')]=_[_0x3b3a('0x34')](_0x5686aa[_0x3b3a('0x2e')],qs[_0x3b3a('0x35')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x35')]));_0x570505[_0x3b3a('0x36')]=_0x570505[_0x3b3a('0x36')][_0x3b3a('0x49')]?_0x570505[_0x3b3a('0x36')]:_0x5686aa[_0x3b3a('0x2e')];_0x570505[_0x3b3a('0x3a')]=qs[_0x3b3a('0x3b')](_0x43e71d['query'][_0x3b3a('0x3b')]);_0x570505['where']=qs[_0x3b3a('0x33')](_['pick'](_0x43e71d[_0x3b3a('0x30')],_0x5686aa['filters']));if(_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x41')]){_0x570505['where']=_['merge'](_0x570505['where'],{'$or':_[_0x3b3a('0x42')](_0x570505[_0x3b3a('0x36')],function(_0x39c6ee){var _0x3f8b76={};_0x3f8b76[_0x39c6ee]={'$like':'%'+_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x41')]+'%'};return _0x3f8b76;})});}_0x570505=_['merge']({},_0x570505,_0x43e71d['options']);return _0x2b12e5[_0x3b3a('0x51')](_0x570505);}})[_0x3b3a('0x16')](function(_0x1b9ba5){if(_0x1b9ba5){_0x44b9e1=_0x1b9ba5[_0x3b3a('0x49')];if(!_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x37')](_0x3b3a('0x38'))){_0x570505['limit']=qs[_0x3b3a('0x39')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x39')]);_0x570505[_0x3b3a('0x25')]=qs[_0x3b3a('0x25')](_0x43e71d[_0x3b3a('0x30')][_0x3b3a('0x25')]);}return _0x2b12e5['getDescriptions'](_0x570505);}})[_0x3b3a('0x16')](function(_0xa3dc48){if(_0xa3dc48){return _0xa3dc48?{'count':_0x44b9e1,'rows':_0xa3dc48}:null;}})[_0x3b3a('0x16')](respondWithResult(_0x292d1e,null))[_0x3b3a('0x1f')](handleError(_0x292d1e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8d0c010..a4c2b4c 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 _0xa1b4=['moment','bluebird','exports','define','SugarcrmConfiguration','lodash','util','../../config/logger','api'];(function(_0x5447aa,_0x3afc00){var _0xb21e53=function(_0x2d05f6){while(--_0x2d05f6){_0x5447aa['push'](_0x5447aa['shift']());}};_0xb21e53(++_0x3afc00);}(_0xa1b4,0x83));var _0x4a1b=function(_0x11b58d,_0x555c55){_0x11b58d=_0x11b58d-0x0;var _0xc2811b=_0xa1b4[_0x11b58d];return _0xc2811b;};'use strict';var _=require(_0x4a1b('0x0'));var util=require(_0x4a1b('0x1'));var logger=require(_0x4a1b('0x2'))(_0x4a1b('0x3'));var moment=require(_0x4a1b('0x4'));var BPromise=require(_0x4a1b('0x5'));var rp=require('request-promise');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x4a1b('0x6')]=function(_0xf9f868,_0x2bd33e){return _0xf9f868[_0x4a1b('0x7')](_0x4a1b('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3cd=['lodash','util','../../config/logger','request-promise','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xe3cd,0x1e0));var _0xde3c=function(_0x3ad60e,_0x2fb035){_0x3ad60e=_0x3ad60e-0x0;var _0xba9aad=_0xe3cd[_0x3ad60e];return _0xba9aad;};'use strict';var _=require(_0xde3c('0x0'));var util=require(_0xde3c('0x1'));var logger=require(_0xde3c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde3c('0x3'));var attributes=require(_0xde3c('0x4'));module[_0xde3c('0x5')]=function(_0x215a40,_0x120d61){return _0x215a40['define'](_0xde3c('0x6'),attributes,{'tableName':_0xde3c('0x7'),'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 6ac17f2..6870774 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 _0x2af6=['client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x2af6,0xae));var _0x62af=function(_0x2af3d7,_0x5e46db){_0x2af3d7=_0x2af3d7-0x0;var _0xdee22=_0x2af6[_0x2af3d7];return _0xdee22;};'use strict';var _=require('lodash');var util=require(_0x62af('0x0'));var moment=require(_0x62af('0x1'));var BPromise=require(_0x62af('0x2'));var rs=require(_0x62af('0x3'));var fs=require('fs');var db=require(_0x62af('0x4'))['db'];var utils=require(_0x62af('0x5'));var logger=require(_0x62af('0x6'))(_0x62af('0x7'));var config=require(_0x62af('0x8'));var jayson=require(_0x62af('0x9'));var client=jayson[_0x62af('0xa')][_0x62af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21efe6,_0x20b730,_0x4b5bca){return new BPromise(function(_0x35a1eb,_0x5a796c){return client[_0x62af('0xc')](_0x21efe6,_0x4b5bca)[_0x62af('0xd')](function(_0x29ad62){logger[_0x62af('0xe')](_0x62af('0xf'),_0x20b730,_0x62af('0x10'));logger[_0x62af('0x11')](_0x62af('0x12'),_0x20b730,_0x62af('0x10'),JSON['stringify'](_0x29ad62));if(_0x29ad62['error']){if(_0x29ad62[_0x62af('0x13')][_0x62af('0x14')]===0x1f4){logger[_0x62af('0x13')](_0x62af('0xf'),_0x20b730,_0x29ad62[_0x62af('0x13')][_0x62af('0x15')]);return _0x5a796c(_0x29ad62[_0x62af('0x13')][_0x62af('0x15')]);}logger[_0x62af('0x13')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x20b730,_0x29ad62['error'][_0x62af('0x15')]);return _0x35a1eb(_0x29ad62[_0x62af('0x13')][_0x62af('0x15')]);}else{logger[_0x62af('0xe')](_0x62af('0xf'),_0x20b730,_0x62af('0x10'));_0x35a1eb(_0x29ad62[_0x62af('0x16')][_0x62af('0x15')]);}})['catch'](function(_0x15960f){logger[_0x62af('0x13')](_0x62af('0xf'),_0x20b730,_0x15960f);_0x5a796c(_0x15960f);});});} \ No newline at end of file +var _0xe5c7=['request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0xe5c7,0x1a5));var _0x7e5c=function(_0x587c9f,_0x549043){_0x587c9f=_0x587c9f-0x0;var _0x10d54e=_0xe5c7[_0x587c9f];return _0x10d54e;};'use strict';var _=require(_0x7e5c('0x0'));var util=require(_0x7e5c('0x1'));var moment=require(_0x7e5c('0x2'));var BPromise=require(_0x7e5c('0x3'));var rs=require(_0x7e5c('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x7e5c('0x5'));var logger=require(_0x7e5c('0x6'))(_0x7e5c('0x7'));var config=require(_0x7e5c('0x8'));var jayson=require(_0x7e5c('0x9'));var client=jayson[_0x7e5c('0xa')][_0x7e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13fbfa,_0x1a90c9,_0x32dba5){return new BPromise(function(_0x31e32e,_0x212243){return client[_0x7e5c('0xc')](_0x13fbfa,_0x32dba5)[_0x7e5c('0xd')](function(_0x277b02){logger[_0x7e5c('0xe')](_0x7e5c('0xf'),_0x1a90c9,_0x7e5c('0x10'));logger['debug'](_0x7e5c('0x11'),_0x1a90c9,_0x7e5c('0x10'),JSON['stringify'](_0x277b02));if(_0x277b02[_0x7e5c('0x12')]){if(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x13')]===0x1f4){logger[_0x7e5c('0x12')](_0x7e5c('0xf'),_0x1a90c9,_0x277b02[_0x7e5c('0x12')]['message']);return _0x212243(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x14')]);}logger[_0x7e5c('0x12')](_0x7e5c('0xf'),_0x1a90c9,_0x277b02['error'][_0x7e5c('0x14')]);return _0x31e32e(_0x277b02[_0x7e5c('0x12')][_0x7e5c('0x14')]);}else{logger['info'](_0x7e5c('0xf'),_0x1a90c9,'request\x20sent');_0x31e32e(_0x277b02[_0x7e5c('0x15')][_0x7e5c('0x14')]);}})[_0x7e5c('0x16')](function(_0x8aa188){logger[_0x7e5c('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1a90c9,_0x8aa188);_0x212243(_0x8aa188);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index b9a4ebd..d76baff 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 _0xfb65=['./intSugarcrmField.controller','get','isAuthenticated','index','show','post','put','/:id','update','exports','util','path','Router','../../components/interaction/service','../../config/environment'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xfb65,0x82));var _0x5fb6=function(_0x105c23,_0x7baa7c){_0x105c23=_0x105c23-0x0;var _0xddd291=_0xfb65[_0x105c23];return _0xddd291;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var express=require('express');var router=express[_0x5fb6('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x5fb6('0x3'));var config=require(_0x5fb6('0x4'));var controller=require(_0x5fb6('0x5'));router[_0x5fb6('0x6')]('/',auth[_0x5fb6('0x7')](),controller[_0x5fb6('0x8')]);router['get']('/:id',auth[_0x5fb6('0x7')](),controller[_0x5fb6('0x9')]);router[_0x5fb6('0xa')]('/',auth[_0x5fb6('0x7')](),controller['create']);router[_0x5fb6('0xb')](_0x5fb6('0xc'),auth[_0x5fb6('0x7')](),controller[_0x5fb6('0xd')]);router['delete'](_0x5fb6('0xc'),auth[_0x5fb6('0x7')](),controller['destroy']);module[_0x5fb6('0xe')]=router; \ No newline at end of file +var _0xbd51=['show','post','create','/:id','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','isAuthenticated','index','get'];(function(_0x5c7eb9,_0x1f4029){var _0x25fff2=function(_0x5b5022){while(--_0x5b5022){_0x5c7eb9['push'](_0x5c7eb9['shift']());}};_0x25fff2(++_0x1f4029);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x5f247d,_0x12f88e){_0x5f247d=_0x5f247d-0x0;var _0x585d4e=_0xbd51[_0x5f247d];return _0x585d4e;};'use strict';var multer=require(_0x1bd5('0x0'));var util=require('util');var path=require(_0x1bd5('0x1'));var express=require(_0x1bd5('0x2'));var router=express[_0x1bd5('0x3')]();var auth=require(_0x1bd5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router['get']('/',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0x6')]);router[_0x1bd5('0x7')]('/:id',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0x8')]);router[_0x1bd5('0x9')]('/',auth[_0x1bd5('0x5')](),controller[_0x1bd5('0xa')]);router['put'](_0x1bd5('0xb'),auth['isAuthenticated'](),controller[_0x1bd5('0xc')]);router[_0x1bd5('0xd')](_0x1bd5('0xb'),auth[_0x1bd5('0x5')](),controller[_0x1bd5('0xe')]);module[_0x1bd5('0xf')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 303e66a..920a360 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 _0xac4a=['exports','ENUM','string','variable','customVariable','STRING','BOOLEAN','sequelize'];(function(_0x4e658c,_0x3139a5){var _0x3a2973=function(_0x479a80){while(--_0x479a80){_0x4e658c['push'](_0x4e658c['shift']());}};_0x3a2973(++_0x3139a5);}(_0xac4a,0x13f));var _0xaac4=function(_0x14deb2,_0x124bc8){_0x14deb2=_0x14deb2-0x0;var _0x1a9024=_0xac4a[_0x14deb2];return _0x1a9024;};'use strict';var Sequelize=require(_0xaac4('0x0'));module[_0xaac4('0x1')]={'type':{'type':Sequelize[_0xaac4('0x2')](_0xaac4('0x3'),_0xaac4('0x4'),_0xaac4('0x5'),'keyValue'),'defaultValue':'string'},'content':{'type':Sequelize[_0xaac4('0x6')]},'key':{'type':Sequelize[_0xaac4('0x6')]},'keyType':{'type':Sequelize[_0xaac4('0x2')]('string',_0xaac4('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xaac4('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaac4('0x6')]},'customField':{'type':Sequelize[_0xaac4('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb43b=['ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','STRING'];(function(_0x8a0d94,_0x16fcee){var _0x48f382=function(_0x46ab83){while(--_0x46ab83){_0x8a0d94['push'](_0x8a0d94['shift']());}};_0x48f382(++_0x16fcee);}(_0xb43b,0x1b2));var _0xbb43=function(_0x504561,_0x289695){_0x504561=_0x504561-0x0;var _0x1fc536=_0xb43b[_0x504561];return _0x1fc536;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'type':{'type':Sequelize['ENUM'](_0xbb43('0x2'),_0xbb43('0x3'),_0xbb43('0x4'),'keyValue'),'defaultValue':_0xbb43('0x2')},'content':{'type':Sequelize[_0xbb43('0x5')]},'key':{'type':Sequelize[_0xbb43('0x5')]},'keyType':{'type':Sequelize[_0xbb43('0x6')]('string','variable',_0xbb43('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbb43('0x5')]},'nameField':{'type':Sequelize[_0xbb43('0x5')]},'customField':{'type':Sequelize[_0xbb43('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb43('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 7b7af31..586f5b9 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 _0x685b=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','desk.js','to-csv','../../config/logger','../../config/utils','../../mysqldb','status','end','count','offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','SugarcrmField','rawAttributes','keys','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','filters','pick','dateStart','add','day','merge','filter','where','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy'];(function(_0x41a7b3,_0x9df83a){var _0x5eb096=function(_0x131578){while(--_0x131578){_0x41a7b3['push'](_0x41a7b3['shift']());}};_0x5eb096(++_0x9df83a);}(_0x685b,0xbd));var _0xb685=function(_0x3ea360,_0x4a3b9e){_0x3ea360=_0x3ea360-0x0;var _0x330457=_0x685b[_0x3ea360];return _0x330457;};'use strict';var jsonpatch=require(_0xb685('0x0'));var rp=require(_0xb685('0x1'));var moment=require(_0xb685('0x2'));var BPromise=require(_0xb685('0x3'));var Mustache=require(_0xb685('0x4'));var util=require('util');var path=require(_0xb685('0x5'));var sox=require(_0xb685('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb685('0x7'));var squel=require(_0xb685('0x8'));var crypto=require(_0xb685('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb685('0xa'));var toCsv=require(_0xb685('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xb685('0xc'))('api');var utils=require(_0xb685('0xd'));var config=require('../../config/environment');var db=require(_0xb685('0xe'))['db'];function respondWithStatusCode(_0xfcd2,_0x22052e){_0x22052e=_0x22052e||0xcc;return function(_0x17a28b){if(_0x17a28b){return _0xfcd2['sendStatus'](_0x22052e);}return _0xfcd2[_0xb685('0xf')](_0x22052e)[_0xb685('0x10')]();};}function respondWithResult(_0x29262a,_0x37abd1){_0x37abd1=_0x37abd1||0xc8;return function(_0x49fb58){if(_0x49fb58){return _0x29262a['status'](_0x37abd1)['json'](_0x49fb58);}};}function respondWithFilteredResult(_0x268049,_0x4d5717){return function(_0x36e98e){if(_0x36e98e){var _0x249814=_0x36e98e[_0xb685('0x11')],_0x211774=_0x4d5717[_0xb685('0x12')],_0x1bf0bc=_0x4d5717[_0xb685('0x12')]+_0x4d5717['limit'],_0x3127ba;if(_0x1bf0bc>=_0x249814){_0x1bf0bc=_0x249814;_0x3127ba=0xc8;}else{_0x3127ba=0xce;}_0x268049[_0xb685('0xf')](_0x3127ba);return _0x268049[_0xb685('0x13')](_0xb685('0x14'),_0x211774+'-'+_0x1bf0bc+'/'+_0x249814)['json'](_0x36e98e);}return null;};}function patchUpdates(_0x30836b){return function(_0x39bf9e){try{jsonpatch[_0xb685('0x15')](_0x39bf9e,_0x30836b,!![]);}catch(_0x2d6c05){return BPromise[_0xb685('0x16')](_0x2d6c05);}return _0x39bf9e[_0xb685('0x17')]();};}function saveUpdates(_0x2c18c6,_0x43be9f){return function(_0x4f4932){if(_0x4f4932){return _0x4f4932[_0xb685('0x18')](_0x2c18c6)[_0xb685('0x19')](function(_0x18290e){return _0x18290e;});}return null;};}function removeEntity(_0x367400,_0x501559){return function(_0x7ececd){if(_0x7ececd){return _0x7ececd['destroy']()[_0xb685('0x19')](function(){_0x367400[_0xb685('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b4e0a,_0x2e0af3){return function(_0x8933c1){if(!_0x8933c1){_0x4b4e0a['sendStatus'](0x194);}return _0x8933c1;};}function handleError(_0x3743a3,_0x5160bd){_0x5160bd=_0x5160bd||0x1f4;return function(_0x36506a){logger['error'](_0x36506a[_0xb685('0x1a')]);if(_0x36506a[_0xb685('0x1b')]){delete _0x36506a[_0xb685('0x1b')];}_0x3743a3['status'](_0x5160bd)[_0xb685('0x1c')](_0x36506a);};}exports[_0xb685('0x1d')]=function(_0x52b320,_0x178496){var _0x368c67={},_0xdfc74d={},_0x2f24da={'count':0x0,'rows':[]};var _0x49a89b=db[_0xb685('0x1e')][_0xb685('0x1f')];_0xdfc74d['model']=_[_0xb685('0x20')](_0x49a89b);var _0x3d1634={'dateStart':_0x52b320[_0xb685('0x21')]['dateStart'],'dateEnd':_0x52b320[_0xb685('0x21')][_0xb685('0x22')]};delete _0x52b320[_0xb685('0x21')]['dateStart'];delete _0x52b320[_0xb685('0x21')][_0xb685('0x22')];_0xdfc74d[_0xb685('0x21')]=_[_0xb685('0x20')](_0x52b320[_0xb685('0x21')]);_0xdfc74d['filters']=_[_0xb685('0x23')](_0xdfc74d[_0xb685('0x24')],_0xdfc74d[_0xb685('0x21')]);_0x368c67[_0xb685('0x25')]=_[_0xb685('0x23')](_0xdfc74d[_0xb685('0x24')],qs[_0xb685('0x26')](_0x52b320['query'][_0xb685('0x26')]));_0x368c67[_0xb685('0x25')]=_0x368c67['attributes'][_0xb685('0x27')]?_0x368c67[_0xb685('0x25')]:_0xdfc74d[_0xb685('0x24')];if(!_0x52b320[_0xb685('0x21')][_0xb685('0x28')](_0xb685('0x29'))){_0x368c67[_0xb685('0x2a')]=qs['limit'](_0x52b320[_0xb685('0x21')][_0xb685('0x2a')]);_0x368c67[_0xb685('0x12')]=qs[_0xb685('0x12')](_0x52b320[_0xb685('0x21')][_0xb685('0x12')]);}_0x368c67['order']=qs[_0xb685('0x2b')](_0x52b320[_0xb685('0x21')][_0xb685('0x2b')]);_0x368c67['where']=qs[_0xb685('0x2c')](_[_0xb685('0x2d')](_0x52b320[_0xb685('0x21')],_0xdfc74d[_0xb685('0x2c')]));if(_0x3d1634[_0xb685('0x2e')]){if(_0x3d1634[_0xb685('0x22')]){_0x3d1634[_0xb685('0x22')]=moment(_0x3d1634[_0xb685('0x22')])[_0xb685('0x2f')](0x1,_0xb685('0x30'));}else{_0x3d1634[_0xb685('0x22')]=moment(_0x3d1634[_0xb685('0x2e')])[_0xb685('0x2f')](0x1,_0xb685('0x30'));}_[_0xb685('0x31')](_0x368c67['where'],{'createdAt':{'$gte':_0x3d1634['dateStart'],'$lte':_0x3d1634['dateEnd']}});}if(_0x52b320['query'][_0xb685('0x32')]){_0x368c67['where']=_[_0xb685('0x31')](_0x368c67[_0xb685('0x33')],{'$or':_['map'](_0x368c67['attributes'],function(_0x37ad75){var _0x55e3d4={};_0x55e3d4[_0x37ad75]={'$like':'%'+_0x52b320[_0xb685('0x21')][_0xb685('0x32')]+'%'};return _0x55e3d4;})});}_0x368c67=_[_0xb685('0x31')]({},_0x368c67,_0x52b320[_0xb685('0x34')]);var _0x1826fa={'where':_0x368c67[_0xb685('0x33')]};return db[_0xb685('0x1e')][_0xb685('0x11')](_0x1826fa)[_0xb685('0x19')](function(_0x27fb53){_0x2f24da['count']=_0x27fb53;if(_0x52b320['query'][_0xb685('0x35')]){_0x368c67[_0xb685('0x36')]=[{'all':!![]}];}return db[_0xb685('0x1e')][_0xb685('0x37')](_0x368c67);})[_0xb685('0x19')](function(_0x409491){_0x2f24da[_0xb685('0x38')]=_0x409491;return _0x2f24da;})[_0xb685('0x19')](respondWithFilteredResult(_0x178496,_0x368c67))[_0xb685('0x39')](handleError(_0x178496,null));};exports['show']=function(_0x3c0464,_0x37934f){var _0x30ca32={'raw':!![],'where':{'id':_0x3c0464[_0xb685('0x3a')]['id']}},_0x880286={};_0x880286[_0xb685('0x24')]=_[_0xb685('0x20')](db[_0xb685('0x1e')]['rawAttributes']);_0x880286[_0xb685('0x21')]=_['keys'](_0x3c0464[_0xb685('0x21')]);_0x880286[_0xb685('0x2c')]=_[_0xb685('0x23')](_0x880286['model'],_0x880286['query']);_0x30ca32['attributes']=_['intersection'](_0x880286[_0xb685('0x24')],qs[_0xb685('0x26')](_0x3c0464[_0xb685('0x21')]['fields']));_0x30ca32[_0xb685('0x25')]=_0x30ca32[_0xb685('0x25')][_0xb685('0x27')]?_0x30ca32[_0xb685('0x25')]:_0x880286[_0xb685('0x24')];if(_0x3c0464[_0xb685('0x21')][_0xb685('0x35')]){_0x30ca32[_0xb685('0x36')]=[{'all':!![]}];}_0x30ca32=_[_0xb685('0x31')]({},_0x30ca32,_0x3c0464[_0xb685('0x34')]);return db[_0xb685('0x1e')][_0xb685('0x3b')](_0x30ca32)[_0xb685('0x19')](handleEntityNotFound(_0x37934f,null))[_0xb685('0x19')](respondWithResult(_0x37934f,null))[_0xb685('0x39')](handleError(_0x37934f,null));};exports[_0xb685('0x3c')]=function(_0x1368c1,_0x5bbb9d){return db['SugarcrmField'][_0xb685('0x3c')](_0x1368c1[_0xb685('0x3d')],{})[_0xb685('0x19')](respondWithResult(_0x5bbb9d,0xc9))[_0xb685('0x39')](handleError(_0x5bbb9d,null));};exports[_0xb685('0x18')]=function(_0x5d6f0a,_0x3a7fb5){if(_0x5d6f0a[_0xb685('0x3d')]['id']){delete _0x5d6f0a[_0xb685('0x3d')]['id'];}return db[_0xb685('0x1e')]['find']({'where':{'id':_0x5d6f0a[_0xb685('0x3a')]['id']}})['then'](handleEntityNotFound(_0x3a7fb5,null))[_0xb685('0x19')](saveUpdates(_0x5d6f0a['body'],null))[_0xb685('0x19')](respondWithResult(_0x3a7fb5,null))[_0xb685('0x39')](handleError(_0x3a7fb5,null));};exports[_0xb685('0x3e')]=function(_0x1a18f2,_0x418ed6){return db[_0xb685('0x1e')]['find']({'where':{'id':_0x1a18f2['params']['id']}})['then'](handleEntityNotFound(_0x418ed6,null))[_0xb685('0x19')](removeEntity(_0x418ed6,null))['catch'](handleError(_0x418ed6,null));}; \ No newline at end of file +var _0x381e=['ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','apply','reject','update','then','error','name','send','index','SugarcrmField','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x85ce6,_0x4b6efc){var _0x21dfc3=function(_0x345adc){while(--_0x345adc){_0x85ce6['push'](_0x85ce6['shift']());}};_0x21dfc3(++_0x4b6efc);}(_0x381e,0x18f));var _0xe381=function(_0x46f77c,_0x43a1db){_0x46f77c=_0x46f77c-0x0;var _0x375630=_0x381e[_0x46f77c];return _0x375630;};'use strict';var jsonpatch=require(_0xe381('0x0'));var rp=require(_0xe381('0x1'));var moment=require(_0xe381('0x2'));var BPromise=require(_0xe381('0x3'));var Mustache=require(_0xe381('0x4'));var util=require(_0xe381('0x5'));var path=require(_0xe381('0x6'));var sox=require(_0xe381('0x7'));var csv=require(_0xe381('0x8'));var ejs=require(_0xe381('0x9'));var fs=require('fs');var _=require(_0xe381('0xa'));var squel=require('squel');var crypto=require(_0xe381('0xb'));var jsforce=require(_0xe381('0xc'));var deskjs=require(_0xe381('0xd'));var toCsv=require(_0xe381('0x8'));var querystring=require(_0xe381('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xe381('0xf'))(_0xe381('0x10'));var utils=require('../../config/utils');var config=require(_0xe381('0x11'));var db=require(_0xe381('0x12'))['db'];function respondWithStatusCode(_0x155546,_0x4df107){_0x4df107=_0x4df107||0xcc;return function(_0xcb3f0c){if(_0xcb3f0c){return _0x155546[_0xe381('0x13')](_0x4df107);}return _0x155546['status'](_0x4df107)[_0xe381('0x14')]();};}function respondWithResult(_0x156964,_0x2a9994){_0x2a9994=_0x2a9994||0xc8;return function(_0x4077d4){if(_0x4077d4){return _0x156964[_0xe381('0x15')](_0x2a9994)[_0xe381('0x16')](_0x4077d4);}};}function respondWithFilteredResult(_0x564452,_0x3094f3){return function(_0x1924e3){if(_0x1924e3){var _0x49febc=_0x1924e3['count'],_0xf4135b=_0x3094f3[_0xe381('0x17')],_0x588857=_0x3094f3[_0xe381('0x17')]+_0x3094f3[_0xe381('0x18')],_0x398e15;if(_0x588857>=_0x49febc){_0x588857=_0x49febc;_0x398e15=0xc8;}else{_0x398e15=0xce;}_0x564452[_0xe381('0x15')](_0x398e15);return _0x564452[_0xe381('0x19')]('Content-Range',_0xf4135b+'-'+_0x588857+'/'+_0x49febc)[_0xe381('0x16')](_0x1924e3);}return null;};}function patchUpdates(_0x37623e){return function(_0x242976){try{jsonpatch[_0xe381('0x1a')](_0x242976,_0x37623e,!![]);}catch(_0x2d3179){return BPromise[_0xe381('0x1b')](_0x2d3179);}return _0x242976['save']();};}function saveUpdates(_0xf4813f,_0x513ef0){return function(_0x466480){if(_0x466480){return _0x466480[_0xe381('0x1c')](_0xf4813f)[_0xe381('0x1d')](function(_0x197f10){return _0x197f10;});}return null;};}function removeEntity(_0x295ed7,_0x4e5c09){return function(_0x3acbdd){if(_0x3acbdd){return _0x3acbdd['destroy']()[_0xe381('0x1d')](function(){_0x295ed7[_0xe381('0x15')](0xcc)[_0xe381('0x14')]();});}};}function handleEntityNotFound(_0x3db835,_0x14039b){return function(_0x43c0af){if(!_0x43c0af){_0x3db835[_0xe381('0x13')](0x194);}return _0x43c0af;};}function handleError(_0x251017,_0x22713d){_0x22713d=_0x22713d||0x1f4;return function(_0x45b4ed){logger[_0xe381('0x1e')](_0x45b4ed['stack']);if(_0x45b4ed[_0xe381('0x1f')]){delete _0x45b4ed[_0xe381('0x1f')];}_0x251017[_0xe381('0x15')](_0x22713d)[_0xe381('0x20')](_0x45b4ed);};}exports[_0xe381('0x21')]=function(_0x1cc452,_0x3e7125){var _0x5ee9bf={},_0x339d35={},_0x4b76a8={'count':0x0,'rows':[]};var _0x8b303c=db[_0xe381('0x22')][_0xe381('0x23')];_0x339d35[_0xe381('0x24')]=_['keys'](_0x8b303c);var _0xa14de6={'dateStart':_0x1cc452[_0xe381('0x25')][_0xe381('0x26')],'dateEnd':_0x1cc452['query'][_0xe381('0x27')]};delete _0x1cc452['query'][_0xe381('0x26')];delete _0x1cc452['query'][_0xe381('0x27')];_0x339d35[_0xe381('0x25')]=_[_0xe381('0x28')](_0x1cc452[_0xe381('0x25')]);_0x339d35[_0xe381('0x29')]=_[_0xe381('0x2a')](_0x339d35[_0xe381('0x24')],_0x339d35[_0xe381('0x25')]);_0x5ee9bf[_0xe381('0x2b')]=_[_0xe381('0x2a')](_0x339d35[_0xe381('0x24')],qs[_0xe381('0x2c')](_0x1cc452[_0xe381('0x25')][_0xe381('0x2c')]));_0x5ee9bf[_0xe381('0x2b')]=_0x5ee9bf[_0xe381('0x2b')][_0xe381('0x2d')]?_0x5ee9bf[_0xe381('0x2b')]:_0x339d35[_0xe381('0x24')];if(!_0x1cc452[_0xe381('0x25')]['hasOwnProperty']('nolimit')){_0x5ee9bf['limit']=qs[_0xe381('0x18')](_0x1cc452[_0xe381('0x25')][_0xe381('0x18')]);_0x5ee9bf[_0xe381('0x17')]=qs[_0xe381('0x17')](_0x1cc452[_0xe381('0x25')][_0xe381('0x17')]);}_0x5ee9bf[_0xe381('0x2e')]=qs[_0xe381('0x2f')](_0x1cc452[_0xe381('0x25')]['sort']);_0x5ee9bf[_0xe381('0x30')]=qs[_0xe381('0x29')](_[_0xe381('0x31')](_0x1cc452[_0xe381('0x25')],_0x339d35['filters']));if(_0xa14de6[_0xe381('0x26')]){if(_0xa14de6[_0xe381('0x27')]){_0xa14de6[_0xe381('0x27')]=moment(_0xa14de6[_0xe381('0x27')])[_0xe381('0x32')](0x1,_0xe381('0x33'));}else{_0xa14de6[_0xe381('0x27')]=moment(_0xa14de6[_0xe381('0x26')])[_0xe381('0x32')](0x1,_0xe381('0x33'));}_[_0xe381('0x34')](_0x5ee9bf['where'],{'createdAt':{'$gte':_0xa14de6[_0xe381('0x26')],'$lte':_0xa14de6[_0xe381('0x27')]}});}if(_0x1cc452['query'][_0xe381('0x35')]){_0x5ee9bf['where']=_['merge'](_0x5ee9bf[_0xe381('0x30')],{'$or':_[_0xe381('0x36')](_0x5ee9bf[_0xe381('0x2b')],function(_0x14414a){var _0x3bf3b5={};_0x3bf3b5[_0x14414a]={'$like':'%'+_0x1cc452[_0xe381('0x25')][_0xe381('0x35')]+'%'};return _0x3bf3b5;})});}_0x5ee9bf=_[_0xe381('0x34')]({},_0x5ee9bf,_0x1cc452[_0xe381('0x37')]);var _0x38be83={'where':_0x5ee9bf[_0xe381('0x30')]};return db[_0xe381('0x22')][_0xe381('0x38')](_0x38be83)[_0xe381('0x1d')](function(_0x1962bd){_0x4b76a8[_0xe381('0x38')]=_0x1962bd;if(_0x1cc452[_0xe381('0x25')][_0xe381('0x39')]){_0x5ee9bf[_0xe381('0x3a')]=[{'all':!![]}];}return db[_0xe381('0x22')][_0xe381('0x3b')](_0x5ee9bf);})['then'](function(_0x4cf556){_0x4b76a8[_0xe381('0x3c')]=_0x4cf556;return _0x4b76a8;})['then'](respondWithFilteredResult(_0x3e7125,_0x5ee9bf))[_0xe381('0x3d')](handleError(_0x3e7125,null));};exports[_0xe381('0x3e')]=function(_0x30dadd,_0x1d61e9){var _0x174d6d={'raw':!![],'where':{'id':_0x30dadd[_0xe381('0x3f')]['id']}},_0x332a37={};_0x332a37[_0xe381('0x24')]=_[_0xe381('0x28')](db[_0xe381('0x22')]['rawAttributes']);_0x332a37[_0xe381('0x25')]=_['keys'](_0x30dadd[_0xe381('0x25')]);_0x332a37[_0xe381('0x29')]=_[_0xe381('0x2a')](_0x332a37[_0xe381('0x24')],_0x332a37[_0xe381('0x25')]);_0x174d6d['attributes']=_[_0xe381('0x2a')](_0x332a37[_0xe381('0x24')],qs[_0xe381('0x2c')](_0x30dadd['query'][_0xe381('0x2c')]));_0x174d6d['attributes']=_0x174d6d[_0xe381('0x2b')][_0xe381('0x2d')]?_0x174d6d[_0xe381('0x2b')]:_0x332a37['model'];if(_0x30dadd[_0xe381('0x25')][_0xe381('0x39')]){_0x174d6d[_0xe381('0x3a')]=[{'all':!![]}];}_0x174d6d=_[_0xe381('0x34')]({},_0x174d6d,_0x30dadd[_0xe381('0x37')]);return db[_0xe381('0x22')][_0xe381('0x40')](_0x174d6d)[_0xe381('0x1d')](handleEntityNotFound(_0x1d61e9,null))[_0xe381('0x1d')](respondWithResult(_0x1d61e9,null))[_0xe381('0x3d')](handleError(_0x1d61e9,null));};exports[_0xe381('0x41')]=function(_0xab7c08,_0x16fe87){return db['SugarcrmField'][_0xe381('0x41')](_0xab7c08[_0xe381('0x42')],{})['then'](respondWithResult(_0x16fe87,0xc9))[_0xe381('0x3d')](handleError(_0x16fe87,null));};exports[_0xe381('0x1c')]=function(_0x4985a7,_0x1154a8){if(_0x4985a7[_0xe381('0x42')]['id']){delete _0x4985a7['body']['id'];}return db[_0xe381('0x22')][_0xe381('0x40')]({'where':{'id':_0x4985a7[_0xe381('0x3f')]['id']}})[_0xe381('0x1d')](handleEntityNotFound(_0x1154a8,null))[_0xe381('0x1d')](saveUpdates(_0x4985a7[_0xe381('0x42')],null))[_0xe381('0x1d')](respondWithResult(_0x1154a8,null))['catch'](handleError(_0x1154a8,null));};exports[_0xe381('0x43')]=function(_0x12c8cf,_0x1fcecd){return db['SugarcrmField'][_0xe381('0x40')]({'where':{'id':_0x12c8cf['params']['id']}})[_0xe381('0x1d')](handleEntityNotFound(_0x1fcecd,null))[_0xe381('0x1d')](removeEntity(_0x1fcecd,null))[_0xe381('0x3d')](handleError(_0x1fcecd,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index eddd4c9..3a20753 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 _0xa08e=['int_sugarcrm_fields','util','api','moment','bluebird','./intSugarcrmField.attributes','exports','define','SugarcrmField'];(function(_0x4ba79a,_0x95cd45){var _0x4be3e8=function(_0x505f24){while(--_0x505f24){_0x4ba79a['push'](_0x4ba79a['shift']());}};_0x4be3e8(++_0x95cd45);}(_0xa08e,0x106));var _0xea08=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0xa08e[_0x483e3a];return _0x43fca9;};'use strict';var _=require('lodash');var util=require(_0xea08('0x0'));var logger=require('../../config/logger')(_0xea08('0x1'));var moment=require(_0xea08('0x2'));var BPromise=require(_0xea08('0x3'));var rp=require('request-promise');var attributes=require(_0xea08('0x4'));module[_0xea08('0x5')]=function(_0x3ee466,_0x392f62){return _0x3ee466[_0xea08('0x6')](_0xea08('0x7'),attributes,{'tableName':_0xea08('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x63d6=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x532b64,_0x19811f){var _0x27a875=function(_0x45998d){while(--_0x45998d){_0x532b64['push'](_0x532b64['shift']());}};_0x27a875(++_0x19811f);}(_0x63d6,0x17a));var _0x663d=function(_0x14ee98,_0x3fe42f){_0x14ee98=_0x14ee98-0x0;var _0x4d16c0=_0x63d6[_0x14ee98];return _0x4d16c0;};'use strict';var _=require('lodash');var util=require(_0x663d('0x0'));var logger=require(_0x663d('0x1'))(_0x663d('0x2'));var moment=require(_0x663d('0x3'));var BPromise=require(_0x663d('0x4'));var rp=require(_0x663d('0x5'));var attributes=require('./intSugarcrmField.attributes');module[_0x663d('0x6')]=function(_0x2ce437,_0x24cc9c){return _0x2ce437[_0x663d('0x7')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 8047339..8a557ea 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 _0xd5e4=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x270eae,_0x455b15){var _0x4b78ec=function(_0x1e3d28){while(--_0x1e3d28){_0x270eae['push'](_0x270eae['shift']());}};_0x4b78ec(++_0x455b15);}(_0xd5e4,0x17f));var _0x4d5e=function(_0x54abd8,_0x173341){_0x54abd8=_0x54abd8-0x0;var _0x43c65c=_0xd5e4[_0x54abd8];return _0x43c65c;};'use strict';var _=require('lodash');var util=require(_0x4d5e('0x0'));var moment=require(_0x4d5e('0x1'));var BPromise=require('bluebird');var rs=require(_0x4d5e('0x2'));var fs=require('fs');var db=require(_0x4d5e('0x3'))['db'];var utils=require(_0x4d5e('0x4'));var logger=require(_0x4d5e('0x5'))('rpc');var config=require(_0x4d5e('0x6'));var jayson=require(_0x4d5e('0x7'));var client=jayson[_0x4d5e('0x8')][_0x4d5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b27ea,_0x1a403d,_0xf2c7a){return new BPromise(function(_0x24f78f,_0x3a7a3a){return client[_0x4d5e('0xa')](_0x4b27ea,_0xf2c7a)[_0x4d5e('0xb')](function(_0x475277){logger[_0x4d5e('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1a403d,_0x4d5e('0xd'));logger[_0x4d5e('0xe')](_0x4d5e('0xf'),_0x1a403d,'request\x20sent',JSON[_0x4d5e('0x10')](_0x475277));if(_0x475277['error']){if(_0x475277[_0x4d5e('0x11')]['code']===0x1f4){logger[_0x4d5e('0x11')](_0x4d5e('0x12'),_0x1a403d,_0x475277[_0x4d5e('0x11')][_0x4d5e('0x13')]);return _0x3a7a3a(_0x475277['error']['message']);}logger['error'](_0x4d5e('0x12'),_0x1a403d,_0x475277[_0x4d5e('0x11')]['message']);return _0x24f78f(_0x475277[_0x4d5e('0x11')][_0x4d5e('0x13')]);}else{logger[_0x4d5e('0xc')](_0x4d5e('0x12'),_0x1a403d,_0x4d5e('0xd'));_0x24f78f(_0x475277[_0x4d5e('0x14')][_0x4d5e('0x13')]);}})[_0x4d5e('0x15')](function(_0xbec7fd){logger[_0x4d5e('0x11')](_0x4d5e('0x12'),_0x1a403d,_0xbec7fd);_0x3a7a3a(_0xbec7fd);});});} \ No newline at end of file +var _0x4428=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3b1899,_0x3d2575){var _0x505d4b=function(_0x124679){while(--_0x124679){_0x3b1899['push'](_0x3b1899['shift']());}};_0x505d4b(++_0x3d2575);}(_0x4428,0x65));var _0x8442=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x4428[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x8442('0x0'));var moment=require(_0x8442('0x1'));var BPromise=require(_0x8442('0x2'));var rs=require(_0x8442('0x3'));var fs=require('fs');var db=require(_0x8442('0x4'))['db'];var utils=require(_0x8442('0x5'));var logger=require(_0x8442('0x6'))(_0x8442('0x7'));var config=require(_0x8442('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8442('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e6971,_0xfb4e24,_0x14bb42){return new BPromise(function(_0x65c70c,_0x188f9f){return client[_0x8442('0xa')](_0x4e6971,_0x14bb42)[_0x8442('0xb')](function(_0x21fd7b){logger[_0x8442('0xc')](_0x8442('0xd'),_0xfb4e24,_0x8442('0xe'));logger[_0x8442('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xfb4e24,'request\x20sent',JSON['stringify'](_0x21fd7b));if(_0x21fd7b['error']){if(_0x21fd7b['error'][_0x8442('0x10')]===0x1f4){logger[_0x8442('0x11')]('SugarcrmField,\x20%s,\x20%s',_0xfb4e24,_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);return _0x188f9f(_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);}logger[_0x8442('0x11')](_0x8442('0xd'),_0xfb4e24,_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);return _0x65c70c(_0x21fd7b[_0x8442('0x11')][_0x8442('0x12')]);}else{logger['info'](_0x8442('0xd'),_0xfb4e24,_0x8442('0xe'));_0x65c70c(_0x21fd7b[_0x8442('0x13')]['message']);}})[_0x8442('0x14')](function(_0x280664){logger[_0x8442('0x11')](_0x8442('0xd'),_0xfb4e24,_0x280664);_0x188f9f(_0x280664);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 99e1b0c..f2ecc88 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 _0x0f41=['multer','util','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post','create','update','delete','destroy','exports'];(function(_0x51ab59,_0x658f8c){var _0x143fc1=function(_0xa40db3){while(--_0xa40db3){_0x51ab59['push'](_0x51ab59['shift']());}};_0x143fc1(++_0x658f8c);}(_0x0f41,0x143));var _0x10f4=function(_0x2233a5,_0x5b2253){_0x2233a5=_0x2233a5-0x0;var _0x1635d9=_0x0f41[_0x2233a5];return _0x1635d9;};'use strict';var multer=require(_0x10f4('0x0'));var util=require(_0x10f4('0x1'));var path=require('path');var express=require('express');var router=express[_0x10f4('0x2')]();var auth=require(_0x10f4('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x10f4('0x4'));var controller=require(_0x10f4('0x5'));router['get']('/',auth[_0x10f4('0x6')](),controller[_0x10f4('0x7')]);router[_0x10f4('0x8')](_0x10f4('0x9'),auth[_0x10f4('0x6')](),controller['show']);router[_0x10f4('0x8')](_0x10f4('0xa'),auth['isAuthenticated'](),controller[_0x10f4('0xb')]);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0x10f4('0xc')]);router[_0x10f4('0xd')]('/',auth[_0x10f4('0x6')](),controller[_0x10f4('0xe')]);router[_0x10f4('0xd')](_0x10f4('0xa'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x10f4('0x9'),auth[_0x10f4('0x6')](),controller[_0x10f4('0xf')]);router[_0x10f4('0x10')](_0x10f4('0x9'),auth[_0x10f4('0x6')](),controller[_0x10f4('0x11')]);module[_0x10f4('0x12')]=router; \ No newline at end of file +var _0xcb68=['../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xcb68,0x104));var _0x8cb6=function(_0x10c8e1,_0x5eeec7){_0x10c8e1=_0x10c8e1-0x0;var _0x43ace6=_0xcb68[_0x10c8e1];return _0x43ace6;};'use strict';var multer=require('multer');var util=require(_0x8cb6('0x0'));var path=require(_0x8cb6('0x1'));var express=require(_0x8cb6('0x2'));var router=express[_0x8cb6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x8cb6('0x4'));var config=require(_0x8cb6('0x5'));var controller=require(_0x8cb6('0x6'));router[_0x8cb6('0x7')]('/',auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x9')]);router[_0x8cb6('0x7')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller['show']);router['get'](_0x8cb6('0xb'),auth['isAuthenticated'](),controller[_0x8cb6('0xc')]);router[_0x8cb6('0x7')](_0x8cb6('0xd'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0xe')]);router[_0x8cb6('0xf')]('/',auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x10')]);router[_0x8cb6('0xf')](_0x8cb6('0xb'),auth[_0x8cb6('0x8')](),controller['addConfiguration']);router[_0x8cb6('0x11')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x12')]);router[_0x8cb6('0x13')](_0x8cb6('0xa'),auth[_0x8cb6('0x8')](),controller[_0x8cb6('0x14')]);module[_0x8cb6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 12c8137..47ced82 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 _0x0693=['exports','STRING','HelpDesk'];(function(_0x203467,_0x4e5272){var _0x515e3b=function(_0x48ded4){while(--_0x48ded4){_0x203467['push'](_0x203467['shift']());}};_0x515e3b(++_0x4e5272);}(_0x0693,0x198));var _0x3069=function(_0x3986d7,_0x33937a){_0x3986d7=_0x3986d7-0x0;var _0x1860ae=_0x0693[_0x3986d7];return _0x1860ae;};'use strict';var Sequelize=require('sequelize');module[_0x3069('0x0')]={'name':{'type':Sequelize[_0x3069('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x3069('0x1')]},'username':{'type':Sequelize[_0x3069('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x3069('0x1')],'allowNull':![],'defaultValue':_0x3069('0x2')},'remoteUri':{'type':Sequelize[_0x3069('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x3069('0x1')]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xa932=['exports','STRING','HelpDesk','sequelize'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xa932,0xbb));var _0x2a93=function(_0x36665f,_0x4f9488){_0x36665f=_0x36665f-0x0;var _0x481d25=_0xa932[_0x36665f];return _0x481d25;};'use strict';var Sequelize=require(_0x2a93('0x0'));module[_0x2a93('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![],'defaultValue':_0x2a93('0x3')},'remoteUri':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x2a93('0x2')]},'accessKey':{'type':Sequelize[_0x2a93('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6108214..e327559 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 _0xe605=['sessionName','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','statusCode','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','http','request','then','info','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','VtigerAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','count','offset','set','json','apply','update','stack','name','VtigerAccount','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','add','day','merge','where','map','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','findOne','VtigerConfiguration','getConfigurations','nolimit','Subjects','getSubjects','type','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','remoteUri','serverUrl','accessKey','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe'];(function(_0x721e8b,_0x5e679d){var _0x3a0b53=function(_0x1b3fd3){while(--_0x1b3fd3){_0x721e8b['push'](_0x721e8b['shift']());}};_0x3a0b53(++_0x5e679d);}(_0xe605,0x92));var _0x5e60=function(_0x19fce6,_0x1ba65d){_0x19fce6=_0x19fce6-0x0;var _0x4861ef=_0xe605[_0x19fce6];return _0x4861ef;};'use strict';var jsonpatch=require(_0x5e60('0x0'));var rp=require(_0x5e60('0x1'));var moment=require('moment');var BPromise=require(_0x5e60('0x2'));var Mustache=require(_0x5e60('0x3'));var util=require(_0x5e60('0x4'));var path=require(_0x5e60('0x5'));var sox=require(_0x5e60('0x6'));var csv=require(_0x5e60('0x7'));var ejs=require(_0x5e60('0x8'));var fs=require('fs');var _=require(_0x5e60('0x9'));var squel=require(_0x5e60('0xa'));var crypto=require(_0x5e60('0xb'));var jsforce=require(_0x5e60('0xc'));var deskjs=require(_0x5e60('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5e60('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x5e60('0xf'));var utils=require(_0x5e60('0x10'));var config=require(_0x5e60('0x11'));var db=require(_0x5e60('0x12'))['db'];var integrations=require(_0x5e60('0x13'));var jayson=require(_0x5e60('0x14'));var client=jayson['client'][_0x5e60('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x527f7b,_0x1d2558,_0x15035f,_0xcf1188){return new BPromise(function(_0x51e7f6,_0x371df7){var _0x178782=_0xcf1188||client;return _0x178782[_0x5e60('0x16')](_0x527f7b,_0x15035f)[_0x5e60('0x17')](function(_0x2874c4){logger[_0x5e60('0x18')]('VtigerAccount,\x20%s,\x20%s',_0x1d2558,_0x5e60('0x19'));logger[_0x5e60('0x1a')](_0x5e60('0x1b'),_0x1d2558,_0x5e60('0x19'),JSON['stringify'](_0x2874c4));if(_0x2874c4[_0x5e60('0x1c')]){if(_0x2874c4['error'][_0x5e60('0x1d')]===0x1f4){logger[_0x5e60('0x1c')]('VtigerAccount,\x20%s,\x20%s',_0x1d2558,_0x2874c4[_0x5e60('0x1c')][_0x5e60('0x1e')]);return _0x371df7(_0x2874c4[_0x5e60('0x1c')][_0x5e60('0x1e')]);}logger['error'](_0x5e60('0x1f'),_0x1d2558,_0x2874c4[_0x5e60('0x1c')]['message']);return _0x51e7f6(_0x2874c4[_0x5e60('0x1c')][_0x5e60('0x1e')]);}else{logger[_0x5e60('0x18')](_0x5e60('0x1f'),_0x1d2558,_0x5e60('0x19'));_0x51e7f6(_0x2874c4[_0x5e60('0x20')][_0x5e60('0x1e')]);}})[_0x5e60('0x21')](function(_0x3282e4){logger[_0x5e60('0x1c')](_0x5e60('0x1f'),_0x1d2558,_0x3282e4);_0x371df7(_0x3282e4);});});}function respondWithStatusCode(_0x578437,_0x15e738){_0x15e738=_0x15e738||0xcc;return function(_0x5d77dd){if(_0x5d77dd){return _0x578437[_0x5e60('0x22')](_0x15e738);}return _0x578437[_0x5e60('0x23')](_0x15e738)[_0x5e60('0x24')]();};}function respondWithResult(_0x144808,_0x34e98d){_0x34e98d=_0x34e98d||0xc8;return function(_0x2a499e){if(_0x2a499e){return _0x144808[_0x5e60('0x23')](_0x34e98d)['json'](_0x2a499e);}};}function respondWithFilteredResult(_0x18d527,_0x7dbdb7){return function(_0x19f37b){if(_0x19f37b){var _0x4dd9fb=_0x19f37b[_0x5e60('0x25')],_0x45cb62=_0x7dbdb7['offset'],_0x56e3a5=_0x7dbdb7[_0x5e60('0x26')]+_0x7dbdb7['limit'],_0x2d8aac;if(_0x56e3a5>=_0x4dd9fb){_0x56e3a5=_0x4dd9fb;_0x2d8aac=0xc8;}else{_0x2d8aac=0xce;}_0x18d527[_0x5e60('0x23')](_0x2d8aac);return _0x18d527[_0x5e60('0x27')]('Content-Range',_0x45cb62+'-'+_0x56e3a5+'/'+_0x4dd9fb)[_0x5e60('0x28')](_0x19f37b);}return null;};}function patchUpdates(_0x19e5ab){return function(_0x5b1b46){try{jsonpatch[_0x5e60('0x29')](_0x5b1b46,_0x19e5ab,!![]);}catch(_0xac9c7a){return BPromise['reject'](_0xac9c7a);}return _0x5b1b46['save']();};}function saveUpdates(_0x52f668,_0xf25956){return function(_0x235cc7){if(_0x235cc7){return _0x235cc7[_0x5e60('0x2a')](_0x52f668)[_0x5e60('0x17')](function(_0x3ccfee){return _0x3ccfee;});}return null;};}function removeEntity(_0x558197,_0x168ce6){return function(_0x405461){if(_0x405461){return _0x405461['destroy']()[_0x5e60('0x17')](function(){_0x558197['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1035b0,_0x3c4340){return function(_0x1f474b){if(!_0x1f474b){_0x1035b0[_0x5e60('0x22')](0x194);}return _0x1f474b;};}function handleError(_0xaf3a35,_0xbf5b7a){_0xbf5b7a=_0xbf5b7a||0x1f4;return function(_0x655cb0){logger[_0x5e60('0x1c')](_0x655cb0[_0x5e60('0x2b')]);if(_0x655cb0[_0x5e60('0x2c')]){delete _0x655cb0['name'];}_0xaf3a35[_0x5e60('0x23')](_0xbf5b7a)['send'](_0x655cb0);};}exports['index']=function(_0x478415,_0x317206){var _0x4fd910={},_0x307e54={},_0x576c70={'count':0x0,'rows':[]};var _0x3757fc=db[_0x5e60('0x2d')][_0x5e60('0x2e')];_0x307e54[_0x5e60('0x2f')]=_[_0x5e60('0x30')](_0x3757fc);var _0x23498b={'dateStart':_0x478415[_0x5e60('0x31')][_0x5e60('0x32')],'dateEnd':_0x478415['query'][_0x5e60('0x33')]};delete _0x478415[_0x5e60('0x31')][_0x5e60('0x32')];delete _0x478415[_0x5e60('0x31')][_0x5e60('0x33')];_0x307e54[_0x5e60('0x31')]=_[_0x5e60('0x30')](_0x478415['query']);_0x307e54[_0x5e60('0x34')]=_[_0x5e60('0x35')](_0x307e54['model'],_0x307e54['query']);_0x4fd910[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0x307e54[_0x5e60('0x2f')],qs[_0x5e60('0x37')](_0x478415[_0x5e60('0x31')]['fields']));_0x4fd910[_0x5e60('0x36')]=_0x4fd910[_0x5e60('0x36')][_0x5e60('0x38')]?_0x4fd910[_0x5e60('0x36')]:_0x307e54[_0x5e60('0x2f')];if(!_0x478415[_0x5e60('0x31')][_0x5e60('0x39')]('nolimit')){_0x4fd910[_0x5e60('0x3a')]=qs[_0x5e60('0x3a')](_0x478415['query']['limit']);_0x4fd910['offset']=qs[_0x5e60('0x26')](_0x478415[_0x5e60('0x31')][_0x5e60('0x26')]);}_0x4fd910[_0x5e60('0x3b')]=qs['sort'](_0x478415[_0x5e60('0x31')][_0x5e60('0x3c')]);_0x4fd910['where']=qs['filters'](_[_0x5e60('0x3d')](_0x478415[_0x5e60('0x31')],_0x307e54[_0x5e60('0x34')]));if(_0x23498b[_0x5e60('0x32')]){if(_0x23498b[_0x5e60('0x33')]){_0x23498b[_0x5e60('0x33')]=moment(_0x23498b[_0x5e60('0x33')])[_0x5e60('0x3e')](0x1,_0x5e60('0x3f'));}else{_0x23498b['dateEnd']=moment(_0x23498b[_0x5e60('0x32')])[_0x5e60('0x3e')](0x1,'day');}_[_0x5e60('0x40')](_0x4fd910[_0x5e60('0x41')],{'createdAt':{'$gte':_0x23498b[_0x5e60('0x32')],'$lte':_0x23498b[_0x5e60('0x33')]}});}if(_0x478415[_0x5e60('0x31')]['filter']){_0x4fd910[_0x5e60('0x41')]=_[_0x5e60('0x40')](_0x4fd910[_0x5e60('0x41')],{'$or':_[_0x5e60('0x42')](_0x4fd910['attributes'],function(_0x4d9787){var _0x5b9f5a={};_0x5b9f5a[_0x4d9787]={'$like':'%'+_0x478415[_0x5e60('0x31')][_0x5e60('0x43')]+'%'};return _0x5b9f5a;})});}_0x4fd910=_[_0x5e60('0x40')]({},_0x4fd910,_0x478415[_0x5e60('0x44')]);var _0x39c131={'where':_0x4fd910[_0x5e60('0x41')]};return db['VtigerAccount'][_0x5e60('0x25')](_0x39c131)[_0x5e60('0x17')](function(_0x165bea){_0x576c70[_0x5e60('0x25')]=_0x165bea;if(_0x478415[_0x5e60('0x31')][_0x5e60('0x45')]){_0x4fd910[_0x5e60('0x46')]=[{'all':!![]}];}return db['VtigerAccount'][_0x5e60('0x47')](_0x4fd910);})[_0x5e60('0x17')](function(_0x21a116){_0x576c70[_0x5e60('0x48')]=_0x21a116;return _0x576c70;})[_0x5e60('0x17')](respondWithFilteredResult(_0x317206,_0x4fd910))[_0x5e60('0x21')](handleError(_0x317206,null));};exports[_0x5e60('0x49')]=function(_0x4470bd,_0x1518bd){var _0x350d6d={'raw':![],'where':{'id':_0x4470bd[_0x5e60('0x4a')]['id']}},_0xe5e675={};_0xe5e675[_0x5e60('0x2f')]=_[_0x5e60('0x30')](db[_0x5e60('0x2d')][_0x5e60('0x2e')]);_0xe5e675[_0x5e60('0x31')]=_[_0x5e60('0x30')](_0x4470bd['query']);_0xe5e675['filters']=_[_0x5e60('0x35')](_0xe5e675['model'],_0xe5e675[_0x5e60('0x31')]);_0x350d6d[_0x5e60('0x36')]=_[_0x5e60('0x35')](_0xe5e675[_0x5e60('0x2f')],qs[_0x5e60('0x37')](_0x4470bd[_0x5e60('0x31')]['fields']));_0x350d6d['attributes']=_0x350d6d[_0x5e60('0x36')][_0x5e60('0x38')]?_0x350d6d[_0x5e60('0x36')]:_0xe5e675['model'];if(_0x4470bd['query'][_0x5e60('0x45')]){_0x350d6d[_0x5e60('0x46')]=[{'all':!![]}];}_0x350d6d=_[_0x5e60('0x40')]({},_0x350d6d,_0x4470bd['options']);return db[_0x5e60('0x2d')][_0x5e60('0x4b')](_0x350d6d)[_0x5e60('0x17')](handleEntityNotFound(_0x1518bd,null))[_0x5e60('0x17')](respondWithResult(_0x1518bd,null))[_0x5e60('0x21')](handleError(_0x1518bd,null));};exports[_0x5e60('0x4c')]=function(_0x4ae313,_0x412be1){return db[_0x5e60('0x2d')]['create'](_0x4ae313[_0x5e60('0x4d')],{})[_0x5e60('0x17')](respondWithResult(_0x412be1,0xc9))[_0x5e60('0x21')](handleError(_0x412be1,null));};exports['update']=function(_0xbe0bd5,_0x17429d){if(_0xbe0bd5['body']['id']){delete _0xbe0bd5[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x4b')]({'where':{'id':_0xbe0bd5[_0x5e60('0x4a')]['id']}})['then'](handleEntityNotFound(_0x17429d,null))[_0x5e60('0x17')](saveUpdates(_0xbe0bd5[_0x5e60('0x4d')],null))['then'](respondWithResult(_0x17429d,null))[_0x5e60('0x21')](handleError(_0x17429d,null));};exports['destroy']=function(_0x8d00b9,_0x5220fc){return db[_0x5e60('0x2d')][_0x5e60('0x4b')]({'where':{'id':_0x8d00b9['params']['id']}})[_0x5e60('0x17')](handleEntityNotFound(_0x5220fc,null))['then'](removeEntity(_0x5220fc,null))[_0x5e60('0x21')](handleError(_0x5220fc,null));};exports['getConfigurations']=function(_0x157787,_0x5b4daa,_0x1481d0){var _0x17e178={};var _0xb1ef22={};var _0x28c2de;var _0x252fa3;return db[_0x5e60('0x2d')][_0x5e60('0x4e')]({'where':{'id':_0x157787['params']['id']}})[_0x5e60('0x17')](handleEntityNotFound(_0x5b4daa,null))[_0x5e60('0x17')](function(_0x442dbf){if(_0x442dbf){_0x28c2de=_0x442dbf;_0xb1ef22[_0x5e60('0x2f')]=_[_0x5e60('0x30')](db[_0x5e60('0x4f')]['rawAttributes']);_0xb1ef22['query']=_['keys'](_0x157787[_0x5e60('0x31')]);_0xb1ef22[_0x5e60('0x34')]=_['intersection'](_0xb1ef22[_0x5e60('0x2f')],_0xb1ef22[_0x5e60('0x31')]);_0x17e178['attributes']=_[_0x5e60('0x35')](_0xb1ef22[_0x5e60('0x2f')],qs[_0x5e60('0x37')](_0x157787[_0x5e60('0x31')][_0x5e60('0x37')]));_0x17e178[_0x5e60('0x36')]=_0x17e178[_0x5e60('0x36')][_0x5e60('0x38')]?_0x17e178[_0x5e60('0x36')]:_0xb1ef22[_0x5e60('0x2f')];_0x17e178[_0x5e60('0x3b')]=qs[_0x5e60('0x3c')](_0x157787[_0x5e60('0x31')][_0x5e60('0x3c')]);_0x17e178[_0x5e60('0x41')]=qs[_0x5e60('0x34')](_[_0x5e60('0x3d')](_0x157787['query'],_0xb1ef22[_0x5e60('0x34')]));if(_0x157787[_0x5e60('0x31')][_0x5e60('0x43')]){_0x17e178['where']=_[_0x5e60('0x40')](_0x17e178[_0x5e60('0x41')],{'$or':_['map'](_0x17e178[_0x5e60('0x36')],function(_0x6f4d2f){var _0x5bbaaf={};_0x5bbaaf[_0x6f4d2f]={'$like':'%'+_0x157787[_0x5e60('0x31')][_0x5e60('0x43')]+'%'};return _0x5bbaaf;})});}_0x17e178=_[_0x5e60('0x40')]({},_0x17e178,_0x157787[_0x5e60('0x44')]);return _0x28c2de[_0x5e60('0x50')](_0x17e178);}})[_0x5e60('0x17')](function(_0x221f35){if(_0x221f35){_0x252fa3=_0x221f35[_0x5e60('0x38')];if(!_0x157787[_0x5e60('0x31')]['hasOwnProperty'](_0x5e60('0x51'))){_0x17e178[_0x5e60('0x3a')]=qs[_0x5e60('0x3a')](_0x157787['query'][_0x5e60('0x3a')]);_0x17e178[_0x5e60('0x26')]=qs[_0x5e60('0x26')](_0x157787[_0x5e60('0x31')][_0x5e60('0x26')]);}return _0x28c2de['getConfigurations'](_0x17e178);}})[_0x5e60('0x17')](function(_0x213c7e){if(_0x213c7e){return _0x213c7e?{'count':_0x252fa3,'rows':_0x213c7e}:null;}})[_0x5e60('0x17')](respondWithResult(_0x5b4daa,null))['catch'](handleError(_0x5b4daa,null));};exports['addConfiguration']=function(_0x3ecfbe,_0x265b5a,_0x13c6dc){if(_0x3ecfbe[_0x5e60('0x4d')]['id']){delete _0x3ecfbe[_0x5e60('0x4d')]['id'];}return db[_0x5e60('0x2d')][_0x5e60('0x4e')]({'where':{'id':_0x3ecfbe['params']['id']}})[_0x5e60('0x17')](handleEntityNotFound(_0x265b5a,null))[_0x5e60('0x17')](function(_0x3b9358){if(_0x3b9358){_0x3ecfbe['body']['AccountId']=_0x3b9358['id'];_0x3ecfbe[_0x5e60('0x4d')][_0x5e60('0x52')]=integrations[_0x5e60('0x53')](_0x3ecfbe['body']['channel'],_0x3ecfbe[_0x5e60('0x4d')][_0x5e60('0x54')]);_0x3ecfbe[_0x5e60('0x4d')][_0x5e60('0x55')]=integrations[_0x5e60('0x56')](_0x3ecfbe[_0x5e60('0x4d')]['channel'],_0x3ecfbe[_0x5e60('0x4d')][_0x5e60('0x54')]);return db[_0x5e60('0x4f')][_0x5e60('0x4c')](_0x3ecfbe[_0x5e60('0x4d')],{'include':[{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x52')},{'model':db[_0x5e60('0x57')],'as':_0x5e60('0x55')}]});}return null;})['then'](respondWithResult(_0x265b5a,null))[_0x5e60('0x21')](handleError(_0x265b5a,null));};var md5=require(_0x5e60('0x58'));exports['getFields']=function(_0x306e7c,_0x26508b,_0x530a21){var _0x312ae3=null;var _0x32580f=null;var _0x391505=null;var _0x1b4aee=null;return db[_0x5e60('0x2d')][_0x5e60('0x4e')]({'where':{'id':_0x306e7c['params']['id']},'attributes':['id',_0x5e60('0x2c'),_0x5e60('0x59'),_0x5e60('0x5a'),_0x5e60('0x5b'),_0x5e60('0x5c'),_0x5e60('0x5d'),_0x5e60('0x5e')]})[_0x5e60('0x17')](handleEntityNotFound(_0x26508b,null))[_0x5e60('0x17')](function(_0x58e900){if(_0x58e900){_0x312ae3=_0x58e900[_0x5e60('0x59')];_0x32580f=_0x58e900[_0x5e60('0x5e')];_0x391505=_0x58e900[_0x5e60('0x5b')];_0x1b4aee=util[_0x5e60('0x5f')](_0x5e60('0x60'),_0x58e900[_0x5e60('0x5c')]);var _0x338637={'method':_0x5e60('0x61'),'uri':_0x1b4aee,'qs':{'operation':_0x5e60('0x62'),'username':_0x58e900[_0x5e60('0x59')]},'json':!![]};return rp(_0x338637);}})['then'](function(_0x5ab78f){if(_0x5ab78f['success']){var _0x3da48b={'method':_0x5e60('0x63'),'uri':_0x1b4aee,'form':{'operation':_0x5e60('0x64'),'username':_0x312ae3,'accessKey':md5(_0x5ab78f[_0x5e60('0x20')][_0x5e60('0x65')]+_0x32580f)},'json':!![]};return rp(_0x3da48b);}})[_0x5e60('0x17')](function(_0x3ea45e){if(_0x3ea45e[_0x5e60('0x66')]){var _0x120fab={'method':'GET','uri':_0x1b4aee,'qs':{'operation':_0x5e60('0x67'),'username':_0x312ae3,'sessionName':_0x3ea45e[_0x5e60('0x20')][_0x5e60('0x68')],'elementType':_0x391505},'json':!![]};return rp(_0x120fab);}})['then'](function(_0x1976f2){if(_0x1976f2['success']){var _0x521645=['autogenerated',_0x5e60('0x69'),_0x5e60('0x6a')];_[_0x5e60('0x6b')](_0x1976f2[_0x5e60('0x20')][_0x5e60('0x37')],function(_0x1a721b){return _0x521645[_0x5e60('0x6c')](_0x1a721b[_0x5e60('0x54')][_0x5e60('0x2c')]);});_['remove'](_0x1976f2[_0x5e60('0x20')][_0x5e60('0x37')],function(_0x7f2d9b){return _0x7f2d9b[_0x5e60('0x6d')]===_0x5e60('0x6e');});return{'count':_0x1976f2[_0x5e60('0x20')][_0x5e60('0x37')][_0x5e60('0x38')],'rows':_[_0x5e60('0x42')](_0x1976f2[_0x5e60('0x20')][_0x5e60('0x37')],function(_0xb8f01e){return{'id':_0xb8f01e['name'],'name':_0xb8f01e[_0x5e60('0x6f')],'custom':_[_0x5e60('0x70')](_0xb8f01e[_0x5e60('0x2c')],_0x5e60('0x71'))?!![]:![],'options':_0xb8f01e[_0x5e60('0x54')][_0x5e60('0x2c')]===_0x5e60('0x72')&&_0xb8f01e[_0x5e60('0x54')][_0x5e60('0x73')][_0x5e60('0x38')]>0x0?_[_0x5e60('0x42')](_0xb8f01e[_0x5e60('0x54')][_0x5e60('0x73')],function(_0x280b5f){return{'name':_0x280b5f[_0x5e60('0x6f')],'value':_0x280b5f[_0x5e60('0x74')]};}):[]};})};}})[_0x5e60('0x17')](respondWithResult(_0x26508b,null))[_0x5e60('0x21')](function(_0x358bb5){console[_0x5e60('0x75')]('vTiger\x20error:\x20'+_0x358bb5);var _0x40ec50=_0x306e7c[_0x5e60('0x31')][_0x5e60('0x76')]?0x1f4:_0x358bb5['statusCode']||0x1f4;logger['error'](_0x5e60('0x77'),_0x5e60('0x78'),_0x40ec50,JSON[_0x5e60('0x79')](_0x358bb5));delete _0x358bb5[_0x5e60('0x2c')];if(_0x40ec50===0x191){_0x40ec50=0x190;}_0x26508b[_0x5e60('0x23')](_0x40ec50)[_0x5e60('0x7a')](_0x306e7c[_0x5e60('0x31')][_0x5e60('0x76')]?{'message':_0x5e60('0x7b'),'statusCode':_0x358bb5[_0x5e60('0x7c')]}:_0x358bb5);});}; \ No newline at end of file +var _0xffdc=['value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','http','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','end','status','json','count','offset','set','Content-Range','apply','reject','save','destroy','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','VtigerAccount','includeAll','include','findAll','rows','show','params','filters','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','VtigerField','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','format','GET','getchallenge','success','token','describe','sessionName','autogenerated','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues'];(function(_0x478098,_0x4d9d5a){var _0x48da53=function(_0x4477ea){while(--_0x4477ea){_0x478098['push'](_0x478098['shift']());}};_0x48da53(++_0x4d9d5a);}(_0xffdc,0x7f));var _0xcffd=function(_0x274394,_0x6fd912){_0x274394=_0x274394-0x0;var _0x2a2773=_0xffdc[_0x274394];return _0x2a2773;};'use strict';var jsonpatch=require(_0xcffd('0x0'));var rp=require(_0xcffd('0x1'));var moment=require('moment');var BPromise=require(_0xcffd('0x2'));var Mustache=require(_0xcffd('0x3'));var util=require('util');var path=require(_0xcffd('0x4'));var sox=require(_0xcffd('0x5'));var csv=require(_0xcffd('0x6'));var ejs=require(_0xcffd('0x7'));var fs=require('fs');var _=require(_0xcffd('0x8'));var squel=require('squel');var crypto=require(_0xcffd('0x9'));var jsforce=require(_0xcffd('0xa'));var deskjs=require(_0xcffd('0xb'));var toCsv=require(_0xcffd('0x6'));var querystring=require(_0xcffd('0xc'));var Papa=require(_0xcffd('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0xcffd('0xe'))(_0xcffd('0xf'));var utils=require('../../config/utils');var config=require(_0xcffd('0x10'));var db=require(_0xcffd('0x11'))['db'];var integrations=require(_0xcffd('0x12'));var jayson=require('jayson/promise');var client=jayson[_0xcffd('0x13')][_0xcffd('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1f6494,_0x457c9b,_0x4cb73e,_0x55a51a){return new BPromise(function(_0x1d010a,_0x187ca8){var _0x1340b0=_0x55a51a||client;return _0x1340b0['request'](_0x1f6494,_0x4cb73e)[_0xcffd('0x15')](function(_0x4dcb59){logger['info'](_0xcffd('0x16'),_0x457c9b,_0xcffd('0x17'));logger['debug'](_0xcffd('0x18'),_0x457c9b,_0xcffd('0x17'),JSON[_0xcffd('0x19')](_0x4dcb59));if(_0x4dcb59[_0xcffd('0x1a')]){if(_0x4dcb59['error']['code']===0x1f4){logger[_0xcffd('0x1a')](_0xcffd('0x16'),_0x457c9b,_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);return _0x187ca8(_0x4dcb59[_0xcffd('0x1a')]['message']);}logger[_0xcffd('0x1a')]('VtigerAccount,\x20%s,\x20%s',_0x457c9b,_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);return _0x1d010a(_0x4dcb59[_0xcffd('0x1a')][_0xcffd('0x1b')]);}else{logger[_0xcffd('0x1c')](_0xcffd('0x16'),_0x457c9b,_0xcffd('0x17'));_0x1d010a(_0x4dcb59[_0xcffd('0x1d')]['message']);}})[_0xcffd('0x1e')](function(_0x1f36f4){logger[_0xcffd('0x1a')](_0xcffd('0x16'),_0x457c9b,_0x1f36f4);_0x187ca8(_0x1f36f4);});});}function respondWithStatusCode(_0x44f32d,_0x17c273){_0x17c273=_0x17c273||0xcc;return function(_0x1ad69f){if(_0x1ad69f){return _0x44f32d['sendStatus'](_0x17c273);}return _0x44f32d['status'](_0x17c273)[_0xcffd('0x1f')]();};}function respondWithResult(_0x2fa778,_0x44f901){_0x44f901=_0x44f901||0xc8;return function(_0x3935ff){if(_0x3935ff){return _0x2fa778[_0xcffd('0x20')](_0x44f901)[_0xcffd('0x21')](_0x3935ff);}};}function respondWithFilteredResult(_0x2723db,_0x2ea762){return function(_0x2162a6){if(_0x2162a6){var _0x19e0d9=_0x2162a6[_0xcffd('0x22')],_0x37185d=_0x2ea762[_0xcffd('0x23')],_0x1f232a=_0x2ea762[_0xcffd('0x23')]+_0x2ea762['limit'],_0x544ae7;if(_0x1f232a>=_0x19e0d9){_0x1f232a=_0x19e0d9;_0x544ae7=0xc8;}else{_0x544ae7=0xce;}_0x2723db[_0xcffd('0x20')](_0x544ae7);return _0x2723db[_0xcffd('0x24')](_0xcffd('0x25'),_0x37185d+'-'+_0x1f232a+'/'+_0x19e0d9)['json'](_0x2162a6);}return null;};}function patchUpdates(_0x4f0078){return function(_0x214271){try{jsonpatch[_0xcffd('0x26')](_0x214271,_0x4f0078,!![]);}catch(_0x4b1c7d){return BPromise[_0xcffd('0x27')](_0x4b1c7d);}return _0x214271[_0xcffd('0x28')]();};}function saveUpdates(_0x5a97cf,_0x3f46ea){return function(_0x3ab051){if(_0x3ab051){return _0x3ab051['update'](_0x5a97cf)['then'](function(_0x3a9634){return _0x3a9634;});}return null;};}function removeEntity(_0x1c40fb,_0x318cdf){return function(_0x5eea07){if(_0x5eea07){return _0x5eea07[_0xcffd('0x29')]()[_0xcffd('0x15')](function(){_0x1c40fb['status'](0xcc)[_0xcffd('0x1f')]();});}};}function handleEntityNotFound(_0xd2a94,_0x567ca7){return function(_0x4216e2){if(!_0x4216e2){_0xd2a94['sendStatus'](0x194);}return _0x4216e2;};}function handleError(_0x3547f0,_0x19d3ca){_0x19d3ca=_0x19d3ca||0x1f4;return function(_0x481c36){logger[_0xcffd('0x1a')](_0x481c36['stack']);if(_0x481c36['name']){delete _0x481c36[_0xcffd('0x2a')];}_0x3547f0[_0xcffd('0x20')](_0x19d3ca)[_0xcffd('0x2b')](_0x481c36);};}exports['index']=function(_0x4c9fcf,_0x7ab8be){var _0x434cfb={},_0x4dd5c0={},_0x50c2f6={'count':0x0,'rows':[]};var _0x3e2888=db['VtigerAccount'][_0xcffd('0x2c')];_0x4dd5c0[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](_0x3e2888);var _0x40a6d3={'dateStart':_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x30')],'dateEnd':_0x4c9fcf['query'][_0xcffd('0x31')]};delete _0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x30')];delete _0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x31')];_0x4dd5c0[_0xcffd('0x2f')]=_['keys'](_0x4c9fcf[_0xcffd('0x2f')]);_0x4dd5c0['filters']=_[_0xcffd('0x32')](_0x4dd5c0['model'],_0x4dd5c0[_0xcffd('0x2f')]);_0x434cfb[_0xcffd('0x33')]=_[_0xcffd('0x32')](_0x4dd5c0[_0xcffd('0x2d')],qs[_0xcffd('0x34')](_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x34')]));_0x434cfb['attributes']=_0x434cfb[_0xcffd('0x33')][_0xcffd('0x35')]?_0x434cfb[_0xcffd('0x33')]:_0x4dd5c0['model'];if(!_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x36')](_0xcffd('0x37'))){_0x434cfb['limit']=qs['limit'](_0x4c9fcf['query'][_0xcffd('0x38')]);_0x434cfb[_0xcffd('0x23')]=qs[_0xcffd('0x23')](_0x4c9fcf['query'][_0xcffd('0x23')]);}_0x434cfb[_0xcffd('0x39')]=qs[_0xcffd('0x3a')](_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x3a')]);_0x434cfb[_0xcffd('0x3b')]=qs['filters'](_[_0xcffd('0x3c')](_0x4c9fcf[_0xcffd('0x2f')],_0x4dd5c0['filters']));if(_0x40a6d3[_0xcffd('0x30')]){if(_0x40a6d3[_0xcffd('0x31')]){_0x40a6d3['dateEnd']=moment(_0x40a6d3[_0xcffd('0x31')])[_0xcffd('0x3d')](0x1,_0xcffd('0x3e'));}else{_0x40a6d3[_0xcffd('0x31')]=moment(_0x40a6d3[_0xcffd('0x30')])[_0xcffd('0x3d')](0x1,_0xcffd('0x3e'));}_[_0xcffd('0x3f')](_0x434cfb[_0xcffd('0x3b')],{'createdAt':{'$gte':_0x40a6d3[_0xcffd('0x30')],'$lte':_0x40a6d3['dateEnd']}});}if(_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x40')]){_0x434cfb['where']=_['merge'](_0x434cfb[_0xcffd('0x3b')],{'$or':_[_0xcffd('0x41')](_0x434cfb[_0xcffd('0x33')],function(_0x14be8a){var _0x447c36={};_0x447c36[_0x14be8a]={'$like':'%'+_0x4c9fcf['query']['filter']+'%'};return _0x447c36;})});}_0x434cfb=_['merge']({},_0x434cfb,_0x4c9fcf[_0xcffd('0x42')]);var _0x432bfe={'where':_0x434cfb[_0xcffd('0x3b')]};return db[_0xcffd('0x43')][_0xcffd('0x22')](_0x432bfe)[_0xcffd('0x15')](function(_0x2b655e){_0x50c2f6[_0xcffd('0x22')]=_0x2b655e;if(_0x4c9fcf[_0xcffd('0x2f')][_0xcffd('0x44')]){_0x434cfb[_0xcffd('0x45')]=[{'all':!![]}];}return db[_0xcffd('0x43')][_0xcffd('0x46')](_0x434cfb);})[_0xcffd('0x15')](function(_0x52f2cd){_0x50c2f6[_0xcffd('0x47')]=_0x52f2cd;return _0x50c2f6;})['then'](respondWithFilteredResult(_0x7ab8be,_0x434cfb))['catch'](handleError(_0x7ab8be,null));};exports[_0xcffd('0x48')]=function(_0x54dea5,_0x6e3701){var _0x42b396={'raw':![],'where':{'id':_0x54dea5[_0xcffd('0x49')]['id']}},_0x589e6c={};_0x589e6c[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](db[_0xcffd('0x43')][_0xcffd('0x2c')]);_0x589e6c['query']=_[_0xcffd('0x2e')](_0x54dea5[_0xcffd('0x2f')]);_0x589e6c[_0xcffd('0x4a')]=_[_0xcffd('0x32')](_0x589e6c[_0xcffd('0x2d')],_0x589e6c[_0xcffd('0x2f')]);_0x42b396[_0xcffd('0x33')]=_['intersection'](_0x589e6c['model'],qs['fields'](_0x54dea5['query']['fields']));_0x42b396[_0xcffd('0x33')]=_0x42b396['attributes']['length']?_0x42b396[_0xcffd('0x33')]:_0x589e6c[_0xcffd('0x2d')];if(_0x54dea5[_0xcffd('0x2f')][_0xcffd('0x44')]){_0x42b396[_0xcffd('0x45')]=[{'all':!![]}];}_0x42b396=_[_0xcffd('0x3f')]({},_0x42b396,_0x54dea5[_0xcffd('0x42')]);return db[_0xcffd('0x43')][_0xcffd('0x4b')](_0x42b396)[_0xcffd('0x15')](handleEntityNotFound(_0x6e3701,null))[_0xcffd('0x15')](respondWithResult(_0x6e3701,null))[_0xcffd('0x1e')](handleError(_0x6e3701,null));};exports[_0xcffd('0x4c')]=function(_0x255fc1,_0x177e7b){return db['VtigerAccount'][_0xcffd('0x4c')](_0x255fc1[_0xcffd('0x4d')],{})[_0xcffd('0x15')](respondWithResult(_0x177e7b,0xc9))[_0xcffd('0x1e')](handleError(_0x177e7b,null));};exports[_0xcffd('0x4e')]=function(_0x32389e,_0x36d275){if(_0x32389e[_0xcffd('0x4d')]['id']){delete _0x32389e[_0xcffd('0x4d')]['id'];}return db[_0xcffd('0x43')][_0xcffd('0x4b')]({'where':{'id':_0x32389e[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x36d275,null))[_0xcffd('0x15')](saveUpdates(_0x32389e[_0xcffd('0x4d')],null))[_0xcffd('0x15')](respondWithResult(_0x36d275,null))[_0xcffd('0x1e')](handleError(_0x36d275,null));};exports['destroy']=function(_0x7f0a57,_0x35caa5){return db['VtigerAccount']['find']({'where':{'id':_0x7f0a57[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x35caa5,null))['then'](removeEntity(_0x35caa5,null))[_0xcffd('0x1e')](handleError(_0x35caa5,null));};exports[_0xcffd('0x4f')]=function(_0x1d4c10,_0x5eec57,_0x335cee){var _0x36e991={};var _0x304706={};var _0x440af8;var _0x236818;return db[_0xcffd('0x43')][_0xcffd('0x50')]({'where':{'id':_0x1d4c10[_0xcffd('0x49')]['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x5eec57,null))[_0xcffd('0x15')](function(_0xa9aa45){if(_0xa9aa45){_0x440af8=_0xa9aa45;_0x304706[_0xcffd('0x2d')]=_[_0xcffd('0x2e')](db[_0xcffd('0x51')][_0xcffd('0x2c')]);_0x304706[_0xcffd('0x2f')]=_[_0xcffd('0x2e')](_0x1d4c10[_0xcffd('0x2f')]);_0x304706[_0xcffd('0x4a')]=_[_0xcffd('0x32')](_0x304706[_0xcffd('0x2d')],_0x304706[_0xcffd('0x2f')]);_0x36e991[_0xcffd('0x33')]=_[_0xcffd('0x32')](_0x304706[_0xcffd('0x2d')],qs[_0xcffd('0x34')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x34')]));_0x36e991[_0xcffd('0x33')]=_0x36e991['attributes'][_0xcffd('0x35')]?_0x36e991['attributes']:_0x304706[_0xcffd('0x2d')];_0x36e991[_0xcffd('0x39')]=qs[_0xcffd('0x3a')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x3a')]);_0x36e991[_0xcffd('0x3b')]=qs[_0xcffd('0x4a')](_[_0xcffd('0x3c')](_0x1d4c10[_0xcffd('0x2f')],_0x304706[_0xcffd('0x4a')]));if(_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x40')]){_0x36e991['where']=_['merge'](_0x36e991[_0xcffd('0x3b')],{'$or':_[_0xcffd('0x41')](_0x36e991[_0xcffd('0x33')],function(_0x2e15d0){var _0x2c7d09={};_0x2c7d09[_0x2e15d0]={'$like':'%'+_0x1d4c10['query'][_0xcffd('0x40')]+'%'};return _0x2c7d09;})});}_0x36e991=_['merge']({},_0x36e991,_0x1d4c10[_0xcffd('0x42')]);return _0x440af8[_0xcffd('0x4f')](_0x36e991);}})[_0xcffd('0x15')](function(_0x1ee2ea){if(_0x1ee2ea){_0x236818=_0x1ee2ea[_0xcffd('0x35')];if(!_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x36')](_0xcffd('0x37'))){_0x36e991[_0xcffd('0x38')]=qs[_0xcffd('0x38')](_0x1d4c10[_0xcffd('0x2f')]['limit']);_0x36e991[_0xcffd('0x23')]=qs[_0xcffd('0x23')](_0x1d4c10[_0xcffd('0x2f')][_0xcffd('0x23')]);}return _0x440af8[_0xcffd('0x4f')](_0x36e991);}})[_0xcffd('0x15')](function(_0x50b3fe){if(_0x50b3fe){return _0x50b3fe?{'count':_0x236818,'rows':_0x50b3fe}:null;}})[_0xcffd('0x15')](respondWithResult(_0x5eec57,null))['catch'](handleError(_0x5eec57,null));};exports['addConfiguration']=function(_0x2feedb,_0x1cd67c,_0x46b124){if(_0x2feedb['body']['id']){delete _0x2feedb[_0xcffd('0x4d')]['id'];}return db[_0xcffd('0x43')][_0xcffd('0x50')]({'where':{'id':_0x2feedb['params']['id']}})[_0xcffd('0x15')](handleEntityNotFound(_0x1cd67c,null))[_0xcffd('0x15')](function(_0x12a542){if(_0x12a542){_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x52')]=_0x12a542['id'];_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x53')]=integrations[_0xcffd('0x54')](_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x55')],_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x56')]);_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x57')]=integrations['getDescriptions'](_0x2feedb[_0xcffd('0x4d')][_0xcffd('0x55')],_0x2feedb[_0xcffd('0x4d')]['type']);return db[_0xcffd('0x51')][_0xcffd('0x4c')](_0x2feedb[_0xcffd('0x4d')],{'include':[{'model':db[_0xcffd('0x58')],'as':_0xcffd('0x53')},{'model':db['VtigerField'],'as':_0xcffd('0x57')}]});}return null;})[_0xcffd('0x15')](respondWithResult(_0x1cd67c,null))[_0xcffd('0x1e')](handleError(_0x1cd67c,null));};var md5=require('md5');exports[_0xcffd('0x59')]=function(_0x1b166e,_0x4779e0,_0x4fad1a){var _0x43ce1c=null;var _0x2780b6=null;var _0x3baee1=null;var _0x4f8494=null;return db[_0xcffd('0x43')]['findOne']({'where':{'id':_0x1b166e[_0xcffd('0x49')]['id']},'attributes':['id',_0xcffd('0x2a'),'username',_0xcffd('0x5a'),_0xcffd('0x5b'),_0xcffd('0x5c'),_0xcffd('0x5d'),_0xcffd('0x5e')]})[_0xcffd('0x15')](handleEntityNotFound(_0x4779e0,null))[_0xcffd('0x15')](function(_0xe8fcc2){if(_0xe8fcc2){_0x43ce1c=_0xe8fcc2[_0xcffd('0x5f')];_0x2780b6=_0xe8fcc2[_0xcffd('0x5e')];_0x3baee1=_0xe8fcc2[_0xcffd('0x5b')];_0x4f8494=util[_0xcffd('0x60')]('%s/webservice.php',_0xe8fcc2[_0xcffd('0x5c')]);var _0x17cc7a={'method':_0xcffd('0x61'),'uri':_0x4f8494,'qs':{'operation':_0xcffd('0x62'),'username':_0xe8fcc2[_0xcffd('0x5f')]},'json':!![]};return rp(_0x17cc7a);}})[_0xcffd('0x15')](function(_0x3cfa9e){if(_0x3cfa9e[_0xcffd('0x63')]){var _0x54151c={'method':'POST','uri':_0x4f8494,'form':{'operation':'login','username':_0x43ce1c,'accessKey':md5(_0x3cfa9e['result'][_0xcffd('0x64')]+_0x2780b6)},'json':!![]};return rp(_0x54151c);}})[_0xcffd('0x15')](function(_0x500916){if(_0x500916['success']){var _0x26daf9={'method':_0xcffd('0x61'),'uri':_0x4f8494,'qs':{'operation':_0xcffd('0x65'),'username':_0x43ce1c,'sessionName':_0x500916[_0xcffd('0x1d')][_0xcffd('0x66')],'elementType':_0x3baee1},'json':!![]};return rp(_0x26daf9);}})[_0xcffd('0x15')](function(_0x53e9eb){if(_0x53e9eb['success']){var _0x17ad39=[_0xcffd('0x67'),'reference',_0xcffd('0x68')];_[_0xcffd('0x69')](_0x53e9eb['result'][_0xcffd('0x34')],function(_0x334122){return _0x17ad39['includes'](_0x334122[_0xcffd('0x56')][_0xcffd('0x2a')]);});_[_0xcffd('0x69')](_0x53e9eb[_0xcffd('0x1d')]['fields'],function(_0x2f1f1d){return _0x2f1f1d[_0xcffd('0x6a')]===_0xcffd('0x6b');});return{'count':_0x53e9eb[_0xcffd('0x1d')][_0xcffd('0x34')][_0xcffd('0x35')],'rows':_['map'](_0x53e9eb[_0xcffd('0x1d')][_0xcffd('0x34')],function(_0x411f2d){return{'id':_0x411f2d['name'],'name':_0x411f2d[_0xcffd('0x6c')],'custom':_[_0xcffd('0x6d')](_0x411f2d[_0xcffd('0x2a')],_0xcffd('0x6e'))?!![]:![],'options':_0x411f2d['type']['name']===_0xcffd('0x6f')&&_0x411f2d[_0xcffd('0x56')][_0xcffd('0x70')]['length']>0x0?_[_0xcffd('0x41')](_0x411f2d['type']['picklistValues'],function(_0x1d7acb){return{'name':_0x1d7acb[_0xcffd('0x6c')],'value':_0x1d7acb[_0xcffd('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x4779e0,null))['catch'](function(_0x18d7fe){console[_0xcffd('0x72')](_0xcffd('0x73')+_0x18d7fe);var _0x2a0681=_0x1b166e[_0xcffd('0x2f')]['test']?0x1f4:_0x18d7fe[_0xcffd('0x74')]||0x1f4;logger[_0xcffd('0x1a')](_0xcffd('0x75'),_0xcffd('0x59'),_0x2a0681,JSON[_0xcffd('0x19')](_0x18d7fe));delete _0x18d7fe['name'];if(_0x2a0681===0x191){_0x2a0681=0x190;}_0x4779e0[_0xcffd('0x20')](_0x2a0681)[_0xcffd('0x2b')](_0x1b166e['query'][_0xcffd('0x76')]?{'message':_0xcffd('0x77'),'statusCode':_0x18d7fe[_0xcffd('0x74')]}:_0x18d7fe);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 822fe3a..368c80f 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 _0xf551=['../../components/integrations/configuration','exports','define','lodash','util','../../config/logger','moment','bluebird','./intVtigerAccount.attributes'];(function(_0x20c793,_0x4f9bdf){var _0x4ad72b=function(_0xe647a2){while(--_0xe647a2){_0x20c793['push'](_0x20c793['shift']());}};_0x4ad72b(++_0x4f9bdf);}(_0xf551,0x13e));var _0x1f55=function(_0xdc4e56,_0x6a8e02){_0xdc4e56=_0xdc4e56-0x0;var _0x179f65=_0xf551[_0xdc4e56];return _0x179f65;};'use strict';var _=require(_0x1f55('0x0'));var util=require(_0x1f55('0x1'));var logger=require(_0x1f55('0x2'))('api');var moment=require(_0x1f55('0x3'));var BPromise=require(_0x1f55('0x4'));var rp=require('request-promise');var attributes=require(_0x1f55('0x5'));var integrations=require(_0x1f55('0x6'));module[_0x1f55('0x7')]=function(_0x3eb8a7,_0x19d89f){return _0x3eb8a7[_0x1f55('0x8')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c75=['int_vtiger_accounts','lodash','util','../../config/logger','moment','request-promise','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0xde5d8a,_0x4afa17){var _0x2b3040=function(_0x112a1e){while(--_0x112a1e){_0xde5d8a['push'](_0xde5d8a['shift']());}};_0x2b3040(++_0x4afa17);}(_0x3c75,0xe8));var _0x53c7=function(_0x58776f,_0x35bef3){_0x58776f=_0x58776f-0x0;var _0x18ed26=_0x3c75[_0x58776f];return _0x18ed26;};'use strict';var _=require(_0x53c7('0x0'));var util=require(_0x53c7('0x1'));var logger=require(_0x53c7('0x2'))('api');var moment=require(_0x53c7('0x3'));var BPromise=require('bluebird');var rp=require(_0x53c7('0x4'));var attributes=require(_0x53c7('0x5'));var integrations=require(_0x53c7('0x6'));module[_0x53c7('0x7')]=function(_0x3552d0,_0xb53c63){return _0x3552d0[_0x53c7('0x8')](_0x53c7('0x9'),attributes,{'tableName':_0x53c7('0xa'),'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 a405c80..70d4feb 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 _0xa665=['stringify','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowVtigerAccount','VtigerAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa5a595,_0x2ffe27){var _0x14bde8=function(_0x37c2e7){while(--_0x37c2e7){_0xa5a595['push'](_0xa5a595['shift']());}};_0x14bde8(++_0x2ffe27);}(_0xa665,0x14f));var _0x5a66=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0xa665[_0x224090];return _0xd97361;};'use strict';var _=require(_0x5a66('0x0'));var util=require(_0x5a66('0x1'));var moment=require('moment');var BPromise=require(_0x5a66('0x2'));var rs=require(_0x5a66('0x3'));var fs=require('fs');var db=require(_0x5a66('0x4'))['db'];var utils=require(_0x5a66('0x5'));var logger=require(_0x5a66('0x6'))(_0x5a66('0x7'));var config=require('../../config/environment');var jayson=require(_0x5a66('0x8'));var client=jayson['client'][_0x5a66('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x29ac9b,_0xae9800,_0x3599ea){return new BPromise(function(_0x20ea21,_0xf61c84){return client[_0x5a66('0xa')](_0x29ac9b,_0x3599ea)['then'](function(_0x1bd704){logger[_0x5a66('0xb')](_0x5a66('0xc'),_0xae9800,_0x5a66('0xd'));logger['debug'](_0x5a66('0xe'),_0xae9800,_0x5a66('0xd'),JSON[_0x5a66('0xf')](_0x1bd704));if(_0x1bd704[_0x5a66('0x10')]){if(_0x1bd704[_0x5a66('0x10')][_0x5a66('0x11')]===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xae9800,_0x1bd704[_0x5a66('0x10')][_0x5a66('0x12')]);return _0xf61c84(_0x1bd704[_0x5a66('0x10')][_0x5a66('0x12')]);}logger[_0x5a66('0x10')](_0x5a66('0xc'),_0xae9800,_0x1bd704['error'][_0x5a66('0x12')]);return _0x20ea21(_0x1bd704[_0x5a66('0x10')]['message']);}else{logger[_0x5a66('0xb')]('VtigerAccount,\x20%s,\x20%s',_0xae9800,_0x5a66('0xd'));_0x20ea21(_0x1bd704[_0x5a66('0x13')][_0x5a66('0x12')]);}})[_0x5a66('0x14')](function(_0x1b5eda){logger[_0x5a66('0x10')](_0x5a66('0xc'),_0xae9800,_0x1b5eda);_0xf61c84(_0x1b5eda);});});}exports[_0x5a66('0x15')]=function(_0x341bc1){var _0x15cda0=this;return new Promise(function(_0x1e2e99,_0x12bcfb){return db['VtigerAccount'][_0x5a66('0x16')]({'raw':_0x341bc1[_0x5a66('0x17')]?_0x341bc1[_0x5a66('0x17')][_0x5a66('0x18')]===undefined?!![]:![]:!![],'where':_0x341bc1[_0x5a66('0x17')]?_0x341bc1[_0x5a66('0x17')][_0x5a66('0x19')]||null:null,'attributes':_0x341bc1[_0x5a66('0x17')]?_0x341bc1[_0x5a66('0x17')][_0x5a66('0x1a')]||null:null,'limit':_0x341bc1[_0x5a66('0x17')]?_0x341bc1[_0x5a66('0x17')][_0x5a66('0x1b')]||null:null,'include':_0x341bc1[_0x5a66('0x17')]?_0x341bc1[_0x5a66('0x17')][_0x5a66('0x1c')]?_['map'](_0x341bc1['options'][_0x5a66('0x1c')],function(_0x301cb4){return{'model':db[_0x301cb4[_0x5a66('0x1d')]],'as':_0x301cb4['as'],'attributes':_0x301cb4[_0x5a66('0x1a')],'include':_0x301cb4[_0x5a66('0x1c')]?_[_0x5a66('0x1e')](_0x301cb4[_0x5a66('0x1c')],function(_0x1cc026){return{'model':db[_0x1cc026[_0x5a66('0x1d')]],'as':_0x1cc026['as'],'attributes':_0x1cc026[_0x5a66('0x1a')],'include':_0x1cc026[_0x5a66('0x1c')]?_[_0x5a66('0x1e')](_0x1cc026['include'],function(_0x446b70){return{'model':db[_0x446b70[_0x5a66('0x1d')]],'as':_0x446b70['as'],'attributes':_0x446b70[_0x5a66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5a66('0x1f')](function(_0x33e58e){logger[_0x5a66('0xb')]('GetVtigerAccount',_0x341bc1);logger['debug'](_0x5a66('0x15'),_0x341bc1,JSON['stringify'](_0x33e58e));_0x1e2e99(_0x33e58e);})[_0x5a66('0x14')](function(_0x586022){logger[_0x5a66('0x10')]('GetVtigerAccount',_0x586022[_0x5a66('0x12')],_0x341bc1);_0x12bcfb(_0x15cda0[_0x5a66('0x10')](0x1f4,_0x586022['message']));});});};exports[_0x5a66('0x20')]=function(_0x985885){var _0x59b31d=this;return new Promise(function(_0x367dfe,_0x18e048){return db[_0x5a66('0x21')][_0x5a66('0x22')]({'raw':_0x985885[_0x5a66('0x17')]?_0x985885['options']['raw']===undefined?!![]:![]:!![],'where':_0x985885[_0x5a66('0x17')]?_0x985885[_0x5a66('0x17')][_0x5a66('0x19')]||null:null,'attributes':_0x985885[_0x5a66('0x17')]?_0x985885[_0x5a66('0x17')]['attributes']||null:null,'include':_0x985885[_0x5a66('0x17')]?_0x985885[_0x5a66('0x17')]['include']?_[_0x5a66('0x1e')](_0x985885['options'][_0x5a66('0x1c')],function(_0x310a84){return{'model':db[_0x310a84[_0x5a66('0x1d')]],'as':_0x310a84['as'],'attributes':_0x310a84[_0x5a66('0x1a')],'include':_0x310a84[_0x5a66('0x1c')]?_[_0x5a66('0x1e')](_0x310a84[_0x5a66('0x1c')],function(_0x5a1ce6){return{'model':db[_0x5a1ce6[_0x5a66('0x1d')]],'as':_0x5a1ce6['as'],'attributes':_0x5a1ce6[_0x5a66('0x1a')],'include':_0x5a1ce6['include']?_['map'](_0x5a1ce6[_0x5a66('0x1c')],function(_0x4da4bf){return{'model':db[_0x4da4bf[_0x5a66('0x1d')]],'as':_0x4da4bf['as'],'attributes':_0x4da4bf[_0x5a66('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5a66('0x1f')](function(_0x13cad5){logger[_0x5a66('0xb')](_0x5a66('0x20'),_0x985885);logger['debug']('ShowVtigerAccount',_0x985885,JSON[_0x5a66('0xf')](_0x13cad5));_0x367dfe(_0x13cad5);})[_0x5a66('0x14')](function(_0x751e65){logger[_0x5a66('0x10')](_0x5a66('0x20'),_0x751e65[_0x5a66('0x12')],_0x985885);_0x18e048(_0x59b31d[_0x5a66('0x10')](0x1f4,_0x751e65['message']));});});}; \ No newline at end of file +var _0xe0a8=['model','then','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','rpc','../../config/environment','client','http','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x1a75f2,_0x5bb75b){var _0x269a6a=function(_0x7c28d){while(--_0x7c28d){_0x1a75f2['push'](_0x1a75f2['shift']());}};_0x269a6a(++_0x5bb75b);}(_0xe0a8,0x7c));var _0x8e0a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0a8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x8e0a('0x0'));var util=require(_0x8e0a('0x1'));var moment=require(_0x8e0a('0x2'));var BPromise=require('bluebird');var rs=require(_0x8e0a('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8e0a('0x4'));var config=require(_0x8e0a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8e0a('0x6')][_0x8e0a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d7e1,_0x271271,_0x2752ba){return new BPromise(function(_0x18594b,_0x421b42){return client['request'](_0x3d7e1,_0x2752ba)['then'](function(_0x2ef98b){logger[_0x8e0a('0x8')](_0x8e0a('0x9'),_0x271271,_0x8e0a('0xa'));logger[_0x8e0a('0xb')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x271271,_0x8e0a('0xa'),JSON[_0x8e0a('0xc')](_0x2ef98b));if(_0x2ef98b[_0x8e0a('0xd')]){if(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xe')]===0x1f4){logger[_0x8e0a('0xd')](_0x8e0a('0x9'),_0x271271,_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);return _0x421b42(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);}logger[_0x8e0a('0xd')](_0x8e0a('0x9'),_0x271271,_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);return _0x18594b(_0x2ef98b[_0x8e0a('0xd')][_0x8e0a('0xf')]);}else{logger['info'](_0x8e0a('0x9'),_0x271271,_0x8e0a('0xa'));_0x18594b(_0x2ef98b['result'][_0x8e0a('0xf')]);}})[_0x8e0a('0x10')](function(_0x327337){logger['error'](_0x8e0a('0x9'),_0x271271,_0x327337);_0x421b42(_0x327337);});});}exports[_0x8e0a('0x11')]=function(_0x4e30ea){var _0x8455f1=this;return new Promise(function(_0x2a96ba,_0x1f8562){return db['VtigerAccount'][_0x8e0a('0x12')]({'raw':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea['options'][_0x8e0a('0x14')]===undefined?!![]:![]:!![],'where':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x15')]||null:null,'attributes':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x16')]||null:null,'limit':_0x4e30ea[_0x8e0a('0x13')]?_0x4e30ea['options'][_0x8e0a('0x17')]||null:null,'include':_0x4e30ea['options']?_0x4e30ea[_0x8e0a('0x13')][_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x4e30ea[_0x8e0a('0x13')]['include'],function(_0x3c148d){return{'model':db[_0x3c148d['model']],'as':_0x3c148d['as'],'attributes':_0x3c148d[_0x8e0a('0x16')],'include':_0x3c148d[_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x3c148d[_0x8e0a('0x18')],function(_0x38adcd){return{'model':db[_0x38adcd[_0x8e0a('0x1a')]],'as':_0x38adcd['as'],'attributes':_0x38adcd['attributes'],'include':_0x38adcd[_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x38adcd[_0x8e0a('0x18')],function(_0x4c9c83){return{'model':db[_0x4c9c83[_0x8e0a('0x1a')]],'as':_0x4c9c83['as'],'attributes':_0x4c9c83['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e0a('0x1b')](function(_0xe7923e){logger['info'](_0x8e0a('0x11'),_0x4e30ea);logger[_0x8e0a('0xb')](_0x8e0a('0x11'),_0x4e30ea,JSON['stringify'](_0xe7923e));_0x2a96ba(_0xe7923e);})[_0x8e0a('0x10')](function(_0x4d75b8){logger[_0x8e0a('0xd')]('GetVtigerAccount',_0x4d75b8[_0x8e0a('0xf')],_0x4e30ea);_0x1f8562(_0x8455f1['error'](0x1f4,_0x4d75b8[_0x8e0a('0xf')]));});});};exports[_0x8e0a('0x1c')]=function(_0x130007){var _0x142433=this;return new Promise(function(_0x48a9ed,_0x5a6fad){return db[_0x8e0a('0x1d')]['find']({'raw':_0x130007[_0x8e0a('0x13')]?_0x130007[_0x8e0a('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x130007[_0x8e0a('0x13')]?_0x130007['options'][_0x8e0a('0x15')]||null:null,'attributes':_0x130007['options']?_0x130007['options'][_0x8e0a('0x16')]||null:null,'include':_0x130007[_0x8e0a('0x13')]?_0x130007[_0x8e0a('0x13')][_0x8e0a('0x18')]?_[_0x8e0a('0x19')](_0x130007[_0x8e0a('0x13')][_0x8e0a('0x18')],function(_0x497152){return{'model':db[_0x497152[_0x8e0a('0x1a')]],'as':_0x497152['as'],'attributes':_0x497152[_0x8e0a('0x16')],'include':_0x497152[_0x8e0a('0x18')]?_['map'](_0x497152[_0x8e0a('0x18')],function(_0x40f1b6){return{'model':db[_0x40f1b6['model']],'as':_0x40f1b6['as'],'attributes':_0x40f1b6['attributes'],'include':_0x40f1b6[_0x8e0a('0x18')]?_['map'](_0x40f1b6[_0x8e0a('0x18')],function(_0x211567){return{'model':db[_0x211567['model']],'as':_0x211567['as'],'attributes':_0x211567[_0x8e0a('0x16')]};}):[]};}):[]};}):[]:[]})[_0x8e0a('0x1b')](function(_0x327f25){logger[_0x8e0a('0x8')](_0x8e0a('0x1c'),_0x130007);logger[_0x8e0a('0xb')](_0x8e0a('0x1c'),_0x130007,JSON[_0x8e0a('0xc')](_0x327f25));_0x48a9ed(_0x327f25);})[_0x8e0a('0x10')](function(_0x33ccf9){logger[_0x8e0a('0xd')](_0x8e0a('0x1c'),_0x33ccf9[_0x8e0a('0xf')],_0x130007);_0x5a6fad(_0x142433[_0x8e0a('0xd')](0x1f4,_0x33ccf9[_0x8e0a('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 042ec96..27684bb 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 _0xf4d4=['express','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','/:id/fields','getFields','/:id/subjects','getDescriptions','update','destroy','exports','multer','path'];(function(_0x3e11fe,_0x2130da){var _0x343a51=function(_0x902725){while(--_0x902725){_0x3e11fe['push'](_0x3e11fe['shift']());}};_0x343a51(++_0x2130da);}(_0xf4d4,0x148));var _0x4f4d=function(_0x1892ab,_0x28293f){_0x1892ab=_0x1892ab-0x0;var _0x10b358=_0xf4d4[_0x1892ab];return _0x10b358;};'use strict';var multer=require(_0x4f4d('0x0'));var util=require('util');var path=require(_0x4f4d('0x1'));var express=require(_0x4f4d('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4f4d('0x3'));var config=require(_0x4f4d('0x4'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x4f4d('0x5')](),controller['index']);router[_0x4f4d('0x6')](_0x4f4d('0x7'),auth[_0x4f4d('0x5')](),controller['show']);router[_0x4f4d('0x6')](_0x4f4d('0x8'),auth['isAuthenticated'](),controller[_0x4f4d('0x9')]);router[_0x4f4d('0x6')](_0x4f4d('0xa'),auth[_0x4f4d('0x5')](),controller['getSubjects']);router[_0x4f4d('0x6')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4f4d('0xb')]);router['post']('/',auth[_0x4f4d('0x5')](),controller['create']);router['put']('/:id',auth[_0x4f4d('0x5')](),controller[_0x4f4d('0xc')]);router['delete'](_0x4f4d('0x7'),auth[_0x4f4d('0x5')](),controller[_0x4f4d('0xd')]);module[_0x4f4d('0xe')]=router; \ No newline at end of file +var _0x616e=['destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/descriptions','getDescriptions','update','delete'];(function(_0x32b30c,_0x4c5567){var _0x59bc79=function(_0x5ef43d){while(--_0x5ef43d){_0x32b30c['push'](_0x32b30c['shift']());}};_0x59bc79(++_0x4c5567);}(_0x616e,0x17e));var _0xe616=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x616e[_0x4f5108];return _0x2d56ca;};'use strict';var multer=require('multer');var util=require(_0xe616('0x0'));var path=require('path');var express=require('express');var router=express[_0xe616('0x1')]();var auth=require(_0xe616('0x2'));var interaction=require(_0xe616('0x3'));var config=require(_0xe616('0x4'));var controller=require(_0xe616('0x5'));router[_0xe616('0x6')]('/',auth['isAuthenticated'](),controller[_0xe616('0x7')]);router[_0xe616('0x6')](_0xe616('0x8'),auth[_0xe616('0x9')](),controller[_0xe616('0xa')]);router[_0xe616('0x6')](_0xe616('0xb'),auth['isAuthenticated'](),controller[_0xe616('0xc')]);router[_0xe616('0x6')]('/:id/subjects',auth[_0xe616('0x9')](),controller['getSubjects']);router['get'](_0xe616('0xd'),auth[_0xe616('0x9')](),controller[_0xe616('0xe')]);router['post']('/',auth[_0xe616('0x9')](),controller['create']);router['put']('/:id',auth[_0xe616('0x9')](),controller[_0xe616('0xf')]);router[_0xe616('0x10')]('/:id',auth[_0xe616('0x9')](),controller[_0xe616('0x11')]);module[_0xe616('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 1f8da6f..954e34a 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 _0x220e=['exports','STRING','sequelize'];(function(_0x346f54,_0x200840){var _0x1e55db=function(_0x1a0494){while(--_0x1a0494){_0x346f54['push'](_0x346f54['shift']());}};_0x1e55db(++_0x200840);}(_0x220e,0xda));var _0xe220=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x220e[_0x3a607e];return _0x37b106;};'use strict';var Sequelize=require(_0xe220('0x0'));module[_0xe220('0x1')]={'name':{'type':Sequelize[_0xe220('0x2')]},'description':{'type':Sequelize[_0xe220('0x2')]}}; \ No newline at end of file +var _0xf3cd=['STRING','sequelize','exports'];(function(_0x305b20,_0x5e57e9){var _0x26d64a=function(_0x2e17f0){while(--_0x2e17f0){_0x305b20['push'](_0x305b20['shift']());}};_0x26d64a(++_0x5e57e9);}(_0xf3cd,0x17e));var _0xdf3c=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0xf3cd[_0x3c42ff];return _0x4c0f6d;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'description':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index e46a158..b575204 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 _0x6e6c=['sort','where','pick','add','day','merge','filter','options','count','includeAll','findAll','rows','show','params','keys','include','create','body','update','find','getFields','findOne','VtigerField','order','map','getSubjects','getDescriptions','fast-json-patch','request-promise','bluebird','mustache','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','destroy','end','name','index','VtigerConfiguration','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit'];(function(_0x5653bb,_0x1f403e){var _0x2b3f73=function(_0x2b3303){while(--_0x2b3303){_0x5653bb['push'](_0x5653bb['shift']());}};_0x2b3f73(++_0x1f403e);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var jsonpatch=require(_0xc6e6('0x0'));var rp=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var Mustache=require(_0xc6e6('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc6e6('0x4'));var csv=require('to-csv');var ejs=require(_0xc6e6('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc6e6('0x6'));var crypto=require(_0xc6e6('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xc6e6('0x8'));var toCsv=require(_0xc6e6('0x9'));var querystring=require('querystring');var Papa=require(_0xc6e6('0xa'));var qs=require(_0xc6e6('0xb'));var logger=require('../../config/logger')(_0xc6e6('0xc'));var utils=require('../../config/utils');var config=require(_0xc6e6('0xd'));var db=require(_0xc6e6('0xe'))['db'];var jayson=require(_0xc6e6('0xf'));var client=jayson[_0xc6e6('0x10')][_0xc6e6('0x11')]({'port':0x232a});function respondWithRpcPromise(_0xbf9ffc,_0x1f9ed3,_0x10aae5,_0x2c205d){return new BPromise(function(_0x58540d,_0x3ac3a5){var _0x525d60=_0x2c205d||client;return _0x525d60[_0xc6e6('0x12')](_0xbf9ffc,_0x10aae5)[_0xc6e6('0x13')](function(_0x33aea0){logger[_0xc6e6('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x1f9ed3,_0xc6e6('0x15'));logger[_0xc6e6('0x16')](_0xc6e6('0x17'),_0x1f9ed3,_0xc6e6('0x15'),JSON[_0xc6e6('0x18')](_0x33aea0));if(_0x33aea0['error']){if(_0x33aea0[_0xc6e6('0x19')][_0xc6e6('0x1a')]===0x1f4){logger['error'](_0xc6e6('0x1b'),_0x1f9ed3,_0x33aea0[_0xc6e6('0x19')][_0xc6e6('0x1c')]);return _0x3ac3a5(_0x33aea0['error']['message']);}logger['error'](_0xc6e6('0x1b'),_0x1f9ed3,_0x33aea0['error'][_0xc6e6('0x1c')]);return _0x58540d(_0x33aea0[_0xc6e6('0x19')][_0xc6e6('0x1c')]);}else{logger[_0xc6e6('0x14')](_0xc6e6('0x1b'),_0x1f9ed3,_0xc6e6('0x15'));_0x58540d(_0x33aea0[_0xc6e6('0x1d')][_0xc6e6('0x1c')]);}})[_0xc6e6('0x1e')](function(_0x3d734d){logger['error'](_0xc6e6('0x1b'),_0x1f9ed3,_0x3d734d);_0x3ac3a5(_0x3d734d);});});}function respondWithStatusCode(_0x4ad70e,_0x1c34cc){_0x1c34cc=_0x1c34cc||0xcc;return function(_0x1667b8){if(_0x1667b8){return _0x4ad70e[_0xc6e6('0x1f')](_0x1c34cc);}return _0x4ad70e[_0xc6e6('0x20')](_0x1c34cc)['end']();};}function respondWithResult(_0x35253d,_0xc87d11){_0xc87d11=_0xc87d11||0xc8;return function(_0x3a96df){if(_0x3a96df){return _0x35253d[_0xc6e6('0x20')](_0xc87d11)[_0xc6e6('0x21')](_0x3a96df);}};}function respondWithFilteredResult(_0x4c35ae,_0x41fe96){return function(_0x51fe51){if(_0x51fe51){var _0x266786=_0x51fe51['count'],_0x1ec62a=_0x41fe96[_0xc6e6('0x22')],_0x2e5e0e=_0x41fe96['offset']+_0x41fe96[_0xc6e6('0x23')],_0x64e1dc;if(_0x2e5e0e>=_0x266786){_0x2e5e0e=_0x266786;_0x64e1dc=0xc8;}else{_0x64e1dc=0xce;}_0x4c35ae['status'](_0x64e1dc);return _0x4c35ae[_0xc6e6('0x24')](_0xc6e6('0x25'),_0x1ec62a+'-'+_0x2e5e0e+'/'+_0x266786)[_0xc6e6('0x21')](_0x51fe51);}return null;};}function patchUpdates(_0x41e7c2){return function(_0x66a240){try{jsonpatch['apply'](_0x66a240,_0x41e7c2,!![]);}catch(_0x346480){return BPromise[_0xc6e6('0x26')](_0x346480);}return _0x66a240[_0xc6e6('0x27')]();};}function saveUpdates(_0x1af05c,_0x4d1284){return function(_0x34ae96){if(_0x34ae96){return _0x34ae96['update'](_0x1af05c)[_0xc6e6('0x13')](function(_0x7d7890){return _0x7d7890;});}return null;};}function removeEntity(_0x12c616,_0xc578b3){return function(_0xd3b63){if(_0xd3b63){return _0xd3b63[_0xc6e6('0x28')]()[_0xc6e6('0x13')](function(){_0x12c616[_0xc6e6('0x20')](0xcc)[_0xc6e6('0x29')]();});}};}function handleEntityNotFound(_0x1eb477,_0x92af28){return function(_0x214d6a){if(!_0x214d6a){_0x1eb477[_0xc6e6('0x1f')](0x194);}return _0x214d6a;};}function handleError(_0x410ba5,_0x3db0ae){_0x3db0ae=_0x3db0ae||0x1f4;return function(_0x45360d){logger[_0xc6e6('0x19')](_0x45360d['stack']);if(_0x45360d[_0xc6e6('0x2a')]){delete _0x45360d[_0xc6e6('0x2a')];}_0x410ba5['status'](_0x3db0ae)['send'](_0x45360d);};}exports[_0xc6e6('0x2b')]=function(_0x1f4c50,_0x106903){var _0x152e45={},_0x3899fc={},_0x243cea={'count':0x0,'rows':[]};var _0x59a8f0=db[_0xc6e6('0x2c')][_0xc6e6('0x2d')];_0x3899fc[_0xc6e6('0x2e')]=_['keys'](_0x59a8f0);var _0x518d4f={'dateStart':_0x1f4c50[_0xc6e6('0x2f')][_0xc6e6('0x30')],'dateEnd':_0x1f4c50[_0xc6e6('0x2f')][_0xc6e6('0x31')]};delete _0x1f4c50['query']['dateStart'];delete _0x1f4c50[_0xc6e6('0x2f')]['dateEnd'];_0x3899fc[_0xc6e6('0x2f')]=_['keys'](_0x1f4c50[_0xc6e6('0x2f')]);_0x3899fc[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x3899fc[_0xc6e6('0x2e')],_0x3899fc['query']);_0x152e45['attributes']=_[_0xc6e6('0x33')](_0x3899fc[_0xc6e6('0x2e')],qs[_0xc6e6('0x34')](_0x1f4c50[_0xc6e6('0x2f')]['fields']));_0x152e45['attributes']=_0x152e45[_0xc6e6('0x35')][_0xc6e6('0x36')]?_0x152e45[_0xc6e6('0x35')]:_0x3899fc[_0xc6e6('0x2e')];if(!_0x1f4c50['query'][_0xc6e6('0x37')](_0xc6e6('0x38'))){_0x152e45['limit']=qs['limit'](_0x1f4c50[_0xc6e6('0x2f')]['limit']);_0x152e45[_0xc6e6('0x22')]=qs[_0xc6e6('0x22')](_0x1f4c50['query'][_0xc6e6('0x22')]);}_0x152e45['order']=qs[_0xc6e6('0x39')](_0x1f4c50['query'][_0xc6e6('0x39')]);_0x152e45[_0xc6e6('0x3a')]=qs[_0xc6e6('0x32')](_[_0xc6e6('0x3b')](_0x1f4c50[_0xc6e6('0x2f')],_0x3899fc[_0xc6e6('0x32')]));if(_0x518d4f[_0xc6e6('0x30')]){if(_0x518d4f[_0xc6e6('0x31')]){_0x518d4f[_0xc6e6('0x31')]=moment(_0x518d4f['dateEnd'])[_0xc6e6('0x3c')](0x1,_0xc6e6('0x3d'));}else{_0x518d4f[_0xc6e6('0x31')]=moment(_0x518d4f[_0xc6e6('0x30')])['add'](0x1,_0xc6e6('0x3d'));}_[_0xc6e6('0x3e')](_0x152e45[_0xc6e6('0x3a')],{'createdAt':{'$gte':_0x518d4f[_0xc6e6('0x30')],'$lte':_0x518d4f['dateEnd']}});}if(_0x1f4c50[_0xc6e6('0x2f')][_0xc6e6('0x3f')]){_0x152e45[_0xc6e6('0x3a')]=_[_0xc6e6('0x3e')](_0x152e45[_0xc6e6('0x3a')],{'$or':_['map'](_0x152e45[_0xc6e6('0x35')],function(_0x518fa2){var _0x35eb24={};_0x35eb24[_0x518fa2]={'$like':'%'+_0x1f4c50['query'][_0xc6e6('0x3f')]+'%'};return _0x35eb24;})});}_0x152e45=_[_0xc6e6('0x3e')]({},_0x152e45,_0x1f4c50[_0xc6e6('0x40')]);var _0xeba15={'where':_0x152e45[_0xc6e6('0x3a')]};return db[_0xc6e6('0x2c')][_0xc6e6('0x41')](_0xeba15)[_0xc6e6('0x13')](function(_0x48bc79){_0x243cea[_0xc6e6('0x41')]=_0x48bc79;if(_0x1f4c50[_0xc6e6('0x2f')][_0xc6e6('0x42')]){_0x152e45['include']=[{'all':!![]}];}return db[_0xc6e6('0x2c')][_0xc6e6('0x43')](_0x152e45);})[_0xc6e6('0x13')](function(_0x42ed90){_0x243cea[_0xc6e6('0x44')]=_0x42ed90;return _0x243cea;})[_0xc6e6('0x13')](respondWithFilteredResult(_0x106903,_0x152e45))[_0xc6e6('0x1e')](handleError(_0x106903,null));};exports[_0xc6e6('0x45')]=function(_0x157daf,_0x11af09){var _0x3bfe85={'raw':![],'where':{'id':_0x157daf[_0xc6e6('0x46')]['id']}},_0x470167={};_0x470167[_0xc6e6('0x2e')]=_['keys'](db[_0xc6e6('0x2c')]['rawAttributes']);_0x470167[_0xc6e6('0x2f')]=_[_0xc6e6('0x47')](_0x157daf['query']);_0x470167['filters']=_['intersection'](_0x470167['model'],_0x470167['query']);_0x3bfe85[_0xc6e6('0x35')]=_[_0xc6e6('0x33')](_0x470167[_0xc6e6('0x2e')],qs[_0xc6e6('0x34')](_0x157daf[_0xc6e6('0x2f')]['fields']));_0x3bfe85['attributes']=_0x3bfe85[_0xc6e6('0x35')][_0xc6e6('0x36')]?_0x3bfe85[_0xc6e6('0x35')]:_0x470167[_0xc6e6('0x2e')];if(_0x157daf['query'][_0xc6e6('0x42')]){_0x3bfe85[_0xc6e6('0x48')]=[{'all':!![]}];}_0x3bfe85=_[_0xc6e6('0x3e')]({},_0x3bfe85,_0x157daf[_0xc6e6('0x40')]);return db[_0xc6e6('0x2c')]['find'](_0x3bfe85)[_0xc6e6('0x13')](handleEntityNotFound(_0x11af09,null))[_0xc6e6('0x13')](respondWithResult(_0x11af09,null))[_0xc6e6('0x1e')](handleError(_0x11af09,null));};exports['create']=function(_0x3df0db,_0x2c2ece){return db[_0xc6e6('0x2c')][_0xc6e6('0x49')](_0x3df0db[_0xc6e6('0x4a')],{})['then'](respondWithResult(_0x2c2ece,0xc9))[_0xc6e6('0x1e')](handleError(_0x2c2ece,null));};exports[_0xc6e6('0x4b')]=function(_0x7c088c,_0x3e7ec5){if(_0x7c088c[_0xc6e6('0x4a')]['id']){delete _0x7c088c['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x7c088c[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x13')](handleEntityNotFound(_0x3e7ec5,null))[_0xc6e6('0x13')](saveUpdates(_0x7c088c[_0xc6e6('0x4a')],null))[_0xc6e6('0x13')](respondWithResult(_0x3e7ec5,null))[_0xc6e6('0x1e')](handleError(_0x3e7ec5,null));};exports['destroy']=function(_0xcd3d5d,_0x50f52a){return db[_0xc6e6('0x2c')][_0xc6e6('0x4c')]({'where':{'id':_0xcd3d5d[_0xc6e6('0x46')]['id']}})['then'](handleEntityNotFound(_0x50f52a,null))[_0xc6e6('0x13')](removeEntity(_0x50f52a,null))['catch'](handleError(_0x50f52a,null));};exports[_0xc6e6('0x4d')]=function(_0x50ac31,_0x4a3bb1,_0x18e101){var _0x4f3bdd={};var _0x53bacd={};var _0x44cab4;var _0x26df05;return db[_0xc6e6('0x2c')][_0xc6e6('0x4e')]({'where':{'id':_0x50ac31[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x13')](handleEntityNotFound(_0x4a3bb1,null))[_0xc6e6('0x13')](function(_0x461d2b){if(_0x461d2b){_0x44cab4=_0x461d2b;_0x53bacd['model']=_[_0xc6e6('0x47')](db[_0xc6e6('0x4f')][_0xc6e6('0x2d')]);_0x53bacd[_0xc6e6('0x2f')]=_['keys'](_0x50ac31[_0xc6e6('0x2f')]);_0x53bacd[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x53bacd['model'],_0x53bacd['query']);_0x4f3bdd[_0xc6e6('0x35')]=_['intersection'](_0x53bacd['model'],qs[_0xc6e6('0x34')](_0x50ac31[_0xc6e6('0x2f')][_0xc6e6('0x34')]));_0x4f3bdd[_0xc6e6('0x35')]=_0x4f3bdd[_0xc6e6('0x35')][_0xc6e6('0x36')]?_0x4f3bdd[_0xc6e6('0x35')]:_0x53bacd[_0xc6e6('0x2e')];_0x4f3bdd[_0xc6e6('0x50')]=qs[_0xc6e6('0x39')](_0x50ac31[_0xc6e6('0x2f')]['sort']);_0x4f3bdd['where']=qs[_0xc6e6('0x32')](_['pick'](_0x50ac31['query'],_0x53bacd[_0xc6e6('0x32')]));if(_0x50ac31[_0xc6e6('0x2f')][_0xc6e6('0x3f')]){_0x4f3bdd['where']=_[_0xc6e6('0x3e')](_0x4f3bdd[_0xc6e6('0x3a')],{'$or':_['map'](_0x4f3bdd['attributes'],function(_0x3267b4){var _0x31329c={};_0x31329c[_0x3267b4]={'$like':'%'+_0x50ac31[_0xc6e6('0x2f')][_0xc6e6('0x3f')]+'%'};return _0x31329c;})});}_0x4f3bdd=_[_0xc6e6('0x3e')]({},_0x4f3bdd,_0x50ac31[_0xc6e6('0x40')]);return _0x44cab4['getFields'](_0x4f3bdd);}})[_0xc6e6('0x13')](function(_0x12d300){if(_0x12d300){_0x26df05=_0x12d300[_0xc6e6('0x36')];if(!_0x50ac31[_0xc6e6('0x2f')][_0xc6e6('0x37')]('nolimit')){_0x4f3bdd[_0xc6e6('0x23')]=qs[_0xc6e6('0x23')](_0x50ac31[_0xc6e6('0x2f')][_0xc6e6('0x23')]);_0x4f3bdd[_0xc6e6('0x22')]=qs[_0xc6e6('0x22')](_0x50ac31['query'][_0xc6e6('0x22')]);}return _0x44cab4['getFields'](_0x4f3bdd);}})[_0xc6e6('0x13')](function(_0x5c2cfc){if(_0x5c2cfc){return _0x5c2cfc?{'count':_0x26df05,'rows':_0x5c2cfc}:null;}})['then'](respondWithResult(_0x4a3bb1,null))[_0xc6e6('0x1e')](handleError(_0x4a3bb1,null));};exports['getSubjects']=function(_0x31cca2,_0x13628e,_0x3fdb63){var _0x20fa1f={};var _0x1c26ab={};var _0x5a9ba5;var _0x3ac0ed;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x31cca2[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x13')](handleEntityNotFound(_0x13628e,null))[_0xc6e6('0x13')](function(_0x5597ce){if(_0x5597ce){_0x5a9ba5=_0x5597ce;_0x1c26ab[_0xc6e6('0x2e')]=_['keys'](db['VtigerField'][_0xc6e6('0x2d')]);_0x1c26ab['query']=_[_0xc6e6('0x47')](_0x31cca2[_0xc6e6('0x2f')]);_0x1c26ab[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x1c26ab['model'],_0x1c26ab[_0xc6e6('0x2f')]);_0x20fa1f[_0xc6e6('0x35')]=_[_0xc6e6('0x33')](_0x1c26ab[_0xc6e6('0x2e')],qs[_0xc6e6('0x34')](_0x31cca2['query'][_0xc6e6('0x34')]));_0x20fa1f[_0xc6e6('0x35')]=_0x20fa1f[_0xc6e6('0x35')][_0xc6e6('0x36')]?_0x20fa1f['attributes']:_0x1c26ab['model'];_0x20fa1f[_0xc6e6('0x50')]=qs[_0xc6e6('0x39')](_0x31cca2[_0xc6e6('0x2f')][_0xc6e6('0x39')]);_0x20fa1f[_0xc6e6('0x3a')]=qs[_0xc6e6('0x32')](_[_0xc6e6('0x3b')](_0x31cca2[_0xc6e6('0x2f')],_0x1c26ab[_0xc6e6('0x32')]));if(_0x31cca2['query']['filter']){_0x20fa1f[_0xc6e6('0x3a')]=_['merge'](_0x20fa1f[_0xc6e6('0x3a')],{'$or':_[_0xc6e6('0x51')](_0x20fa1f[_0xc6e6('0x35')],function(_0x516b4c){var _0x5b0c3b={};_0x5b0c3b[_0x516b4c]={'$like':'%'+_0x31cca2[_0xc6e6('0x2f')]['filter']+'%'};return _0x5b0c3b;})});}_0x20fa1f=_[_0xc6e6('0x3e')]({},_0x20fa1f,_0x31cca2['options']);return _0x5a9ba5[_0xc6e6('0x52')](_0x20fa1f);}})[_0xc6e6('0x13')](function(_0x5d867e){if(_0x5d867e){_0x3ac0ed=_0x5d867e[_0xc6e6('0x36')];if(!_0x31cca2[_0xc6e6('0x2f')][_0xc6e6('0x37')]('nolimit')){_0x20fa1f[_0xc6e6('0x23')]=qs[_0xc6e6('0x23')](_0x31cca2[_0xc6e6('0x2f')]['limit']);_0x20fa1f[_0xc6e6('0x22')]=qs[_0xc6e6('0x22')](_0x31cca2['query']['offset']);}return _0x5a9ba5['getSubjects'](_0x20fa1f);}})[_0xc6e6('0x13')](function(_0x358d50){if(_0x358d50){return _0x358d50?{'count':_0x3ac0ed,'rows':_0x358d50}:null;}})[_0xc6e6('0x13')](respondWithResult(_0x13628e,null))[_0xc6e6('0x1e')](handleError(_0x13628e,null));};exports[_0xc6e6('0x53')]=function(_0xcde47f,_0x58aef4,_0x21b965){var _0x597a7d={};var _0x24b7d0={};var _0x389199;var _0x24ac2d;return db['VtigerConfiguration']['findOne']({'where':{'id':_0xcde47f[_0xc6e6('0x46')]['id']}})[_0xc6e6('0x13')](handleEntityNotFound(_0x58aef4,null))[_0xc6e6('0x13')](function(_0x2bb6c7){if(_0x2bb6c7){_0x389199=_0x2bb6c7;_0x24b7d0[_0xc6e6('0x2e')]=_[_0xc6e6('0x47')](db[_0xc6e6('0x4f')][_0xc6e6('0x2d')]);_0x24b7d0['query']=_['keys'](_0xcde47f[_0xc6e6('0x2f')]);_0x24b7d0[_0xc6e6('0x32')]=_[_0xc6e6('0x33')](_0x24b7d0[_0xc6e6('0x2e')],_0x24b7d0[_0xc6e6('0x2f')]);_0x597a7d['attributes']=_['intersection'](_0x24b7d0[_0xc6e6('0x2e')],qs[_0xc6e6('0x34')](_0xcde47f['query']['fields']));_0x597a7d[_0xc6e6('0x35')]=_0x597a7d[_0xc6e6('0x35')][_0xc6e6('0x36')]?_0x597a7d[_0xc6e6('0x35')]:_0x24b7d0['model'];_0x597a7d[_0xc6e6('0x50')]=qs[_0xc6e6('0x39')](_0xcde47f[_0xc6e6('0x2f')]['sort']);_0x597a7d['where']=qs[_0xc6e6('0x32')](_[_0xc6e6('0x3b')](_0xcde47f['query'],_0x24b7d0['filters']));if(_0xcde47f[_0xc6e6('0x2f')][_0xc6e6('0x3f')]){_0x597a7d[_0xc6e6('0x3a')]=_['merge'](_0x597a7d[_0xc6e6('0x3a')],{'$or':_[_0xc6e6('0x51')](_0x597a7d[_0xc6e6('0x35')],function(_0x390d1e){var _0xf23854={};_0xf23854[_0x390d1e]={'$like':'%'+_0xcde47f[_0xc6e6('0x2f')]['filter']+'%'};return _0xf23854;})});}_0x597a7d=_[_0xc6e6('0x3e')]({},_0x597a7d,_0xcde47f[_0xc6e6('0x40')]);return _0x389199[_0xc6e6('0x53')](_0x597a7d);}})[_0xc6e6('0x13')](function(_0x51341f){if(_0x51341f){_0x24ac2d=_0x51341f[_0xc6e6('0x36')];if(!_0xcde47f[_0xc6e6('0x2f')][_0xc6e6('0x37')]('nolimit')){_0x597a7d[_0xc6e6('0x23')]=qs[_0xc6e6('0x23')](_0xcde47f[_0xc6e6('0x2f')][_0xc6e6('0x23')]);_0x597a7d[_0xc6e6('0x22')]=qs['offset'](_0xcde47f[_0xc6e6('0x2f')][_0xc6e6('0x22')]);}return _0x389199[_0xc6e6('0x53')](_0x597a7d);}})[_0xc6e6('0x13')](function(_0x295d9e){if(_0x295d9e){return _0x295d9e?{'count':_0x24ac2d,'rows':_0x295d9e}:null;}})[_0xc6e6('0x13')](respondWithResult(_0x58aef4,null))['catch'](handleError(_0x58aef4,null));}; \ No newline at end of file +var _0x5423=['jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','VtigerConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','params','create','body','find','getFields','findOne','VtigerField','getSubjects','getDescriptions','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4192ec,_0xc3c2ea){var _0x30168b=function(_0x14748f){while(--_0x14748f){_0x4192ec['push'](_0x4192ec['shift']());}};_0x30168b(++_0xc3c2ea);}(_0x5423,0xe3));var _0x3542=function(_0x3650cf,_0x475b22){_0x3650cf=_0x3650cf-0x0;var _0x15d255=_0x5423[_0x3650cf];return _0x15d255;};'use strict';var jsonpatch=require(_0x3542('0x0'));var rp=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var Mustache=require(_0x3542('0x3'));var util=require('util');var path=require(_0x3542('0x4'));var sox=require(_0x3542('0x5'));var csv=require(_0x3542('0x6'));var ejs=require(_0x3542('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3542('0x8'));var crypto=require(_0x3542('0x9'));var jsforce=require(_0x3542('0xa'));var deskjs=require(_0x3542('0xb'));var toCsv=require(_0x3542('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x3542('0xc'));var logger=require(_0x3542('0xd'))('api');var utils=require(_0x3542('0xe'));var config=require(_0x3542('0xf'));var db=require('../../mysqldb')['db'];var jayson=require(_0x3542('0x10'));var client=jayson[_0x3542('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3180,_0x702b64,_0x48ae2a,_0x328e56){return new BPromise(function(_0x471ea0,_0x3bb6a0){var _0x1cf710=_0x328e56||client;return _0x1cf710[_0x3542('0x12')](_0x1d3180,_0x48ae2a)[_0x3542('0x13')](function(_0x1a9062){logger[_0x3542('0x14')](_0x3542('0x15'),_0x702b64,_0x3542('0x16'));logger['debug'](_0x3542('0x17'),_0x702b64,'request\x20sent',JSON[_0x3542('0x18')](_0x1a9062));if(_0x1a9062[_0x3542('0x19')]){if(_0x1a9062[_0x3542('0x19')]['code']===0x1f4){logger[_0x3542('0x19')](_0x3542('0x15'),_0x702b64,_0x1a9062[_0x3542('0x19')]['message']);return _0x3bb6a0(_0x1a9062[_0x3542('0x19')][_0x3542('0x1a')]);}logger[_0x3542('0x19')](_0x3542('0x15'),_0x702b64,_0x1a9062['error'][_0x3542('0x1a')]);return _0x471ea0(_0x1a9062['error'][_0x3542('0x1a')]);}else{logger[_0x3542('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x702b64,_0x3542('0x16'));_0x471ea0(_0x1a9062[_0x3542('0x1b')][_0x3542('0x1a')]);}})[_0x3542('0x1c')](function(_0x212950){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x702b64,_0x212950);_0x3bb6a0(_0x212950);});});}function respondWithStatusCode(_0x4c58f1,_0x17e3cf){_0x17e3cf=_0x17e3cf||0xcc;return function(_0x527222){if(_0x527222){return _0x4c58f1[_0x3542('0x1d')](_0x17e3cf);}return _0x4c58f1['status'](_0x17e3cf)[_0x3542('0x1e')]();};}function respondWithResult(_0x55774d,_0x4ccefa){_0x4ccefa=_0x4ccefa||0xc8;return function(_0x3eacd0){if(_0x3eacd0){return _0x55774d[_0x3542('0x1f')](_0x4ccefa)['json'](_0x3eacd0);}};}function respondWithFilteredResult(_0x5d05b2,_0x3fc964){return function(_0x5123f0){if(_0x5123f0){var _0x160caa=_0x5123f0[_0x3542('0x20')],_0x367146=_0x3fc964[_0x3542('0x21')],_0x1e0723=_0x3fc964[_0x3542('0x21')]+_0x3fc964[_0x3542('0x22')],_0x2f2e63;if(_0x1e0723>=_0x160caa){_0x1e0723=_0x160caa;_0x2f2e63=0xc8;}else{_0x2f2e63=0xce;}_0x5d05b2[_0x3542('0x1f')](_0x2f2e63);return _0x5d05b2[_0x3542('0x23')](_0x3542('0x24'),_0x367146+'-'+_0x1e0723+'/'+_0x160caa)[_0x3542('0x25')](_0x5123f0);}return null;};}function patchUpdates(_0x220021){return function(_0x9d9ca4){try{jsonpatch[_0x3542('0x26')](_0x9d9ca4,_0x220021,!![]);}catch(_0x39050a){return BPromise[_0x3542('0x27')](_0x39050a);}return _0x9d9ca4[_0x3542('0x28')]();};}function saveUpdates(_0x3bd666,_0x5590a2){return function(_0x31ad47){if(_0x31ad47){return _0x31ad47[_0x3542('0x29')](_0x3bd666)[_0x3542('0x13')](function(_0x4a3ad0){return _0x4a3ad0;});}return null;};}function removeEntity(_0x402c97,_0xc6f23b){return function(_0x2e883a){if(_0x2e883a){return _0x2e883a[_0x3542('0x2a')]()['then'](function(){_0x402c97['status'](0xcc)[_0x3542('0x1e')]();});}};}function handleEntityNotFound(_0x326498,_0xd19bf4){return function(_0x44e8f7){if(!_0x44e8f7){_0x326498[_0x3542('0x1d')](0x194);}return _0x44e8f7;};}function handleError(_0x1e5789,_0x1f43d2){_0x1f43d2=_0x1f43d2||0x1f4;return function(_0x49b18a){logger['error'](_0x49b18a[_0x3542('0x2b')]);if(_0x49b18a['name']){delete _0x49b18a['name'];}_0x1e5789[_0x3542('0x1f')](_0x1f43d2)['send'](_0x49b18a);};}exports['index']=function(_0x412ee3,_0x3daf41){var _0x1bf178={},_0x595a4d={},_0x1ef7b4={'count':0x0,'rows':[]};var _0x49b523=db[_0x3542('0x2c')][_0x3542('0x2d')];_0x595a4d['model']=_[_0x3542('0x2e')](_0x49b523);var _0x487514={'dateStart':_0x412ee3[_0x3542('0x2f')][_0x3542('0x30')],'dateEnd':_0x412ee3[_0x3542('0x2f')]['dateEnd']};delete _0x412ee3[_0x3542('0x2f')]['dateStart'];delete _0x412ee3[_0x3542('0x2f')][_0x3542('0x31')];_0x595a4d[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x412ee3[_0x3542('0x2f')]);_0x595a4d[_0x3542('0x32')]=_[_0x3542('0x33')](_0x595a4d[_0x3542('0x34')],_0x595a4d[_0x3542('0x2f')]);_0x1bf178[_0x3542('0x35')]=_[_0x3542('0x33')](_0x595a4d[_0x3542('0x34')],qs[_0x3542('0x36')](_0x412ee3['query'][_0x3542('0x36')]));_0x1bf178['attributes']=_0x1bf178['attributes'][_0x3542('0x37')]?_0x1bf178[_0x3542('0x35')]:_0x595a4d[_0x3542('0x34')];if(!_0x412ee3[_0x3542('0x2f')][_0x3542('0x38')](_0x3542('0x39'))){_0x1bf178[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x412ee3['query'][_0x3542('0x22')]);_0x1bf178['offset']=qs[_0x3542('0x21')](_0x412ee3[_0x3542('0x2f')]['offset']);}_0x1bf178[_0x3542('0x3a')]=qs[_0x3542('0x3b')](_0x412ee3['query'][_0x3542('0x3b')]);_0x1bf178[_0x3542('0x3c')]=qs['filters'](_[_0x3542('0x3d')](_0x412ee3[_0x3542('0x2f')],_0x595a4d[_0x3542('0x32')]));if(_0x487514[_0x3542('0x30')]){if(_0x487514[_0x3542('0x31')]){_0x487514[_0x3542('0x31')]=moment(_0x487514[_0x3542('0x31')])['add'](0x1,'day');}else{_0x487514[_0x3542('0x31')]=moment(_0x487514[_0x3542('0x30')])[_0x3542('0x3e')](0x1,_0x3542('0x3f'));}_[_0x3542('0x40')](_0x1bf178['where'],{'createdAt':{'$gte':_0x487514[_0x3542('0x30')],'$lte':_0x487514['dateEnd']}});}if(_0x412ee3[_0x3542('0x2f')][_0x3542('0x41')]){_0x1bf178[_0x3542('0x3c')]=_['merge'](_0x1bf178[_0x3542('0x3c')],{'$or':_[_0x3542('0x42')](_0x1bf178['attributes'],function(_0x4090d0){var _0x4491f3={};_0x4491f3[_0x4090d0]={'$like':'%'+_0x412ee3[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x4491f3;})});}_0x1bf178=_[_0x3542('0x40')]({},_0x1bf178,_0x412ee3[_0x3542('0x43')]);var _0x2da4f4={'where':_0x1bf178[_0x3542('0x3c')]};return db['VtigerConfiguration']['count'](_0x2da4f4)['then'](function(_0x3b3719){_0x1ef7b4[_0x3542('0x20')]=_0x3b3719;if(_0x412ee3[_0x3542('0x2f')][_0x3542('0x44')]){_0x1bf178[_0x3542('0x45')]=[{'all':!![]}];}return db[_0x3542('0x2c')][_0x3542('0x46')](_0x1bf178);})['then'](function(_0x157683){_0x1ef7b4[_0x3542('0x47')]=_0x157683;return _0x1ef7b4;})[_0x3542('0x13')](respondWithFilteredResult(_0x3daf41,_0x1bf178))[_0x3542('0x1c')](handleError(_0x3daf41,null));};exports['show']=function(_0x2d8854,_0x1d8184){var _0x55b43a={'raw':![],'where':{'id':_0x2d8854[_0x3542('0x48')]['id']}},_0x528f8c={};_0x528f8c[_0x3542('0x34')]=_[_0x3542('0x2e')](db[_0x3542('0x2c')][_0x3542('0x2d')]);_0x528f8c[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x2d8854['query']);_0x528f8c[_0x3542('0x32')]=_[_0x3542('0x33')](_0x528f8c[_0x3542('0x34')],_0x528f8c[_0x3542('0x2f')]);_0x55b43a[_0x3542('0x35')]=_[_0x3542('0x33')](_0x528f8c[_0x3542('0x34')],qs[_0x3542('0x36')](_0x2d8854[_0x3542('0x2f')]['fields']));_0x55b43a['attributes']=_0x55b43a[_0x3542('0x35')]['length']?_0x55b43a['attributes']:_0x528f8c['model'];if(_0x2d8854[_0x3542('0x2f')][_0x3542('0x44')]){_0x55b43a[_0x3542('0x45')]=[{'all':!![]}];}_0x55b43a=_['merge']({},_0x55b43a,_0x2d8854[_0x3542('0x43')]);return db[_0x3542('0x2c')]['find'](_0x55b43a)[_0x3542('0x13')](handleEntityNotFound(_0x1d8184,null))[_0x3542('0x13')](respondWithResult(_0x1d8184,null))[_0x3542('0x1c')](handleError(_0x1d8184,null));};exports[_0x3542('0x49')]=function(_0x179249,_0x518ad6){return db[_0x3542('0x2c')][_0x3542('0x49')](_0x179249[_0x3542('0x4a')],{})[_0x3542('0x13')](respondWithResult(_0x518ad6,0xc9))[_0x3542('0x1c')](handleError(_0x518ad6,null));};exports['update']=function(_0x513ea9,_0x429a7b){if(_0x513ea9[_0x3542('0x4a')]['id']){delete _0x513ea9[_0x3542('0x4a')]['id'];}return db['VtigerConfiguration'][_0x3542('0x4b')]({'where':{'id':_0x513ea9[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x429a7b,null))[_0x3542('0x13')](saveUpdates(_0x513ea9[_0x3542('0x4a')],null))['then'](respondWithResult(_0x429a7b,null))['catch'](handleError(_0x429a7b,null));};exports[_0x3542('0x2a')]=function(_0x4cd6fd,_0x1fd8c8){return db[_0x3542('0x2c')]['find']({'where':{'id':_0x4cd6fd[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x1fd8c8,null))[_0x3542('0x13')](removeEntity(_0x1fd8c8,null))[_0x3542('0x1c')](handleError(_0x1fd8c8,null));};exports[_0x3542('0x4c')]=function(_0x52a75b,_0x4cb73f,_0x271dd0){var _0x56b920={};var _0x1ffa0a={};var _0x3a23a8;var _0x219922;return db['VtigerConfiguration'][_0x3542('0x4d')]({'where':{'id':_0x52a75b[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x4cb73f,null))[_0x3542('0x13')](function(_0x1bf743){if(_0x1bf743){_0x3a23a8=_0x1bf743;_0x1ffa0a[_0x3542('0x34')]=_['keys'](db[_0x3542('0x4e')][_0x3542('0x2d')]);_0x1ffa0a[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x52a75b[_0x3542('0x2f')]);_0x1ffa0a[_0x3542('0x32')]=_['intersection'](_0x1ffa0a[_0x3542('0x34')],_0x1ffa0a[_0x3542('0x2f')]);_0x56b920[_0x3542('0x35')]=_[_0x3542('0x33')](_0x1ffa0a['model'],qs[_0x3542('0x36')](_0x52a75b[_0x3542('0x2f')]['fields']));_0x56b920['attributes']=_0x56b920[_0x3542('0x35')]['length']?_0x56b920[_0x3542('0x35')]:_0x1ffa0a['model'];_0x56b920['order']=qs[_0x3542('0x3b')](_0x52a75b[_0x3542('0x2f')][_0x3542('0x3b')]);_0x56b920[_0x3542('0x3c')]=qs[_0x3542('0x32')](_[_0x3542('0x3d')](_0x52a75b[_0x3542('0x2f')],_0x1ffa0a['filters']));if(_0x52a75b[_0x3542('0x2f')][_0x3542('0x41')]){_0x56b920[_0x3542('0x3c')]=_[_0x3542('0x40')](_0x56b920[_0x3542('0x3c')],{'$or':_['map'](_0x56b920[_0x3542('0x35')],function(_0x15d58c){var _0x2c5546={};_0x2c5546[_0x15d58c]={'$like':'%'+_0x52a75b[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x2c5546;})});}_0x56b920=_[_0x3542('0x40')]({},_0x56b920,_0x52a75b[_0x3542('0x43')]);return _0x3a23a8['getFields'](_0x56b920);}})[_0x3542('0x13')](function(_0x5e8411){if(_0x5e8411){_0x219922=_0x5e8411[_0x3542('0x37')];if(!_0x52a75b[_0x3542('0x2f')][_0x3542('0x38')](_0x3542('0x39'))){_0x56b920['limit']=qs['limit'](_0x52a75b['query'][_0x3542('0x22')]);_0x56b920[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x52a75b[_0x3542('0x2f')][_0x3542('0x21')]);}return _0x3a23a8[_0x3542('0x4c')](_0x56b920);}})[_0x3542('0x13')](function(_0x77f0af){if(_0x77f0af){return _0x77f0af?{'count':_0x219922,'rows':_0x77f0af}:null;}})[_0x3542('0x13')](respondWithResult(_0x4cb73f,null))['catch'](handleError(_0x4cb73f,null));};exports[_0x3542('0x4f')]=function(_0x2820b1,_0x3d9acc,_0x2d41dc){var _0x2af318={};var _0x576ee5={};var _0x4a5851;var _0x51b83c;return db[_0x3542('0x2c')]['findOne']({'where':{'id':_0x2820b1[_0x3542('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d9acc,null))[_0x3542('0x13')](function(_0x5ab738){if(_0x5ab738){_0x4a5851=_0x5ab738;_0x576ee5[_0x3542('0x34')]=_[_0x3542('0x2e')](db['VtigerField']['rawAttributes']);_0x576ee5['query']=_[_0x3542('0x2e')](_0x2820b1['query']);_0x576ee5[_0x3542('0x32')]=_[_0x3542('0x33')](_0x576ee5['model'],_0x576ee5[_0x3542('0x2f')]);_0x2af318[_0x3542('0x35')]=_[_0x3542('0x33')](_0x576ee5['model'],qs[_0x3542('0x36')](_0x2820b1['query'][_0x3542('0x36')]));_0x2af318['attributes']=_0x2af318[_0x3542('0x35')][_0x3542('0x37')]?_0x2af318[_0x3542('0x35')]:_0x576ee5['model'];_0x2af318[_0x3542('0x3a')]=qs[_0x3542('0x3b')](_0x2820b1[_0x3542('0x2f')][_0x3542('0x3b')]);_0x2af318['where']=qs['filters'](_[_0x3542('0x3d')](_0x2820b1[_0x3542('0x2f')],_0x576ee5[_0x3542('0x32')]));if(_0x2820b1[_0x3542('0x2f')][_0x3542('0x41')]){_0x2af318[_0x3542('0x3c')]=_[_0x3542('0x40')](_0x2af318[_0x3542('0x3c')],{'$or':_[_0x3542('0x42')](_0x2af318[_0x3542('0x35')],function(_0x43f9ff){var _0x1c318c={};_0x1c318c[_0x43f9ff]={'$like':'%'+_0x2820b1[_0x3542('0x2f')][_0x3542('0x41')]+'%'};return _0x1c318c;})});}_0x2af318=_[_0x3542('0x40')]({},_0x2af318,_0x2820b1[_0x3542('0x43')]);return _0x4a5851[_0x3542('0x4f')](_0x2af318);}})[_0x3542('0x13')](function(_0x4e04b6){if(_0x4e04b6){_0x51b83c=_0x4e04b6[_0x3542('0x37')];if(!_0x2820b1[_0x3542('0x2f')]['hasOwnProperty']('nolimit')){_0x2af318[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x2820b1[_0x3542('0x2f')][_0x3542('0x22')]);_0x2af318['offset']=qs[_0x3542('0x21')](_0x2820b1[_0x3542('0x2f')]['offset']);}return _0x4a5851[_0x3542('0x4f')](_0x2af318);}})['then'](function(_0x140bac){if(_0x140bac){return _0x140bac?{'count':_0x51b83c,'rows':_0x140bac}:null;}})['then'](respondWithResult(_0x3d9acc,null))[_0x3542('0x1c')](handleError(_0x3d9acc,null));};exports[_0x3542('0x50')]=function(_0x26e903,_0x23e66f,_0x3787cd){var _0x293ad0={};var _0x32586c={};var _0x59e3bc;var _0x350c2a;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x26e903[_0x3542('0x48')]['id']}})[_0x3542('0x13')](handleEntityNotFound(_0x23e66f,null))[_0x3542('0x13')](function(_0x40c19c){if(_0x40c19c){_0x59e3bc=_0x40c19c;_0x32586c['model']=_[_0x3542('0x2e')](db[_0x3542('0x4e')][_0x3542('0x2d')]);_0x32586c[_0x3542('0x2f')]=_[_0x3542('0x2e')](_0x26e903[_0x3542('0x2f')]);_0x32586c[_0x3542('0x32')]=_[_0x3542('0x33')](_0x32586c[_0x3542('0x34')],_0x32586c[_0x3542('0x2f')]);_0x293ad0['attributes']=_['intersection'](_0x32586c[_0x3542('0x34')],qs['fields'](_0x26e903[_0x3542('0x2f')][_0x3542('0x36')]));_0x293ad0[_0x3542('0x35')]=_0x293ad0['attributes'][_0x3542('0x37')]?_0x293ad0[_0x3542('0x35')]:_0x32586c[_0x3542('0x34')];_0x293ad0['order']=qs[_0x3542('0x3b')](_0x26e903['query'][_0x3542('0x3b')]);_0x293ad0[_0x3542('0x3c')]=qs[_0x3542('0x32')](_['pick'](_0x26e903[_0x3542('0x2f')],_0x32586c['filters']));if(_0x26e903[_0x3542('0x2f')]['filter']){_0x293ad0['where']=_[_0x3542('0x40')](_0x293ad0[_0x3542('0x3c')],{'$or':_['map'](_0x293ad0[_0x3542('0x35')],function(_0x5432be){var _0x157700={};_0x157700[_0x5432be]={'$like':'%'+_0x26e903['query'][_0x3542('0x41')]+'%'};return _0x157700;})});}_0x293ad0=_[_0x3542('0x40')]({},_0x293ad0,_0x26e903[_0x3542('0x43')]);return _0x59e3bc[_0x3542('0x50')](_0x293ad0);}})[_0x3542('0x13')](function(_0x4accdb){if(_0x4accdb){_0x350c2a=_0x4accdb[_0x3542('0x37')];if(!_0x26e903[_0x3542('0x2f')][_0x3542('0x38')]('nolimit')){_0x293ad0[_0x3542('0x22')]=qs[_0x3542('0x22')](_0x26e903[_0x3542('0x2f')][_0x3542('0x22')]);_0x293ad0[_0x3542('0x21')]=qs[_0x3542('0x21')](_0x26e903[_0x3542('0x2f')]['offset']);}return _0x59e3bc[_0x3542('0x50')](_0x293ad0);}})[_0x3542('0x13')](function(_0x5d5cbd){if(_0x5d5cbd){return _0x5d5cbd?{'count':_0x350c2a,'rows':_0x5d5cbd}:null;}})['then'](respondWithResult(_0x23e66f,null))['catch'](handleError(_0x23e66f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 1775772..cc8f739 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 _0x37a1=['util','../../config/logger','api','request-promise','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash'];(function(_0x26641c,_0x1ba2a5){var _0x42c01a=function(_0x15c7da){while(--_0x15c7da){_0x26641c['push'](_0x26641c['shift']());}};_0x42c01a(++_0x1ba2a5);}(_0x37a1,0x128));var _0x137a=function(_0x20024c,_0x26c053){_0x20024c=_0x20024c-0x0;var _0x1fb75c=_0x37a1[_0x20024c];return _0x1fb75c;};'use strict';var _=require(_0x137a('0x0'));var util=require(_0x137a('0x1'));var logger=require(_0x137a('0x2'))(_0x137a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x137a('0x4'));var attributes=require(_0x137a('0x5'));module[_0x137a('0x6')]=function(_0x23b4b1,_0x3b63a8){return _0x23b4b1[_0x137a('0x7')](_0x137a('0x8'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf645=['moment','bluebird','request-promise','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x562553,_0x410c2a){var _0x154f70=function(_0xde5d88){while(--_0xde5d88){_0x562553['push'](_0x562553['shift']());}};_0x154f70(++_0x410c2a);}(_0xf645,0x67));var _0x5f64=function(_0x4c64d7,_0x5d93e6){_0x4c64d7=_0x4c64d7-0x0;var _0x5d613d=_0xf645[_0x4c64d7];return _0x5d613d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5f64('0x0'))(_0x5f64('0x1'));var moment=require(_0x5f64('0x2'));var BPromise=require(_0x5f64('0x3'));var rp=require(_0x5f64('0x4'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x53580e,_0x19d4bb){return _0x53580e['define'](_0x5f64('0x5'),attributes,{'tableName':_0x5f64('0x6'),'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 721401c..ac21a9a 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 _0x99ef=['util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x99ef,0xea));var _0xf99e=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x99ef[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require(_0xf99e('0x0'));var moment=require('moment');var BPromise=require(_0xf99e('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf99e('0x2'));var logger=require('../../config/logger')(_0xf99e('0x3'));var config=require(_0xf99e('0x4'));var jayson=require(_0xf99e('0x5'));var client=jayson[_0xf99e('0x6')][_0xf99e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e0a4d,_0x121aa2,_0x23a2e9){return new BPromise(function(_0x55732b,_0x13925a){return client[_0xf99e('0x8')](_0x1e0a4d,_0x23a2e9)['then'](function(_0x38855e){logger[_0xf99e('0x9')]('VtigerConfiguration,\x20%s,\x20%s',_0x121aa2,_0xf99e('0xa'));logger[_0xf99e('0xb')](_0xf99e('0xc'),_0x121aa2,'request\x20sent',JSON[_0xf99e('0xd')](_0x38855e));if(_0x38855e['error']){if(_0x38855e['error'][_0xf99e('0xe')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x121aa2,_0x38855e[_0xf99e('0xf')][_0xf99e('0x10')]);return _0x13925a(_0x38855e[_0xf99e('0xf')]['message']);}logger[_0xf99e('0xf')](_0xf99e('0x11'),_0x121aa2,_0x38855e[_0xf99e('0xf')][_0xf99e('0x10')]);return _0x55732b(_0x38855e[_0xf99e('0xf')][_0xf99e('0x10')]);}else{logger[_0xf99e('0x9')](_0xf99e('0x11'),_0x121aa2,_0xf99e('0xa'));_0x55732b(_0x38855e['result']['message']);}})['catch'](function(_0x97a165){logger['error'](_0xf99e('0x11'),_0x121aa2,_0x97a165);_0x13925a(_0x97a165);});});} \ No newline at end of file +var _0x4dff=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x12fc2c,_0x155251){var _0x118444=function(_0x5ab61f){while(--_0x5ab61f){_0x12fc2c['push'](_0x12fc2c['shift']());}};_0x118444(++_0x155251);}(_0x4dff,0x70));var _0xf4df=function(_0xd6fefa,_0x413784){_0xd6fefa=_0xd6fefa-0x0;var _0x131e73=_0x4dff[_0xd6fefa];return _0x131e73;};'use strict';var _=require(_0xf4df('0x0'));var util=require(_0xf4df('0x1'));var moment=require(_0xf4df('0x2'));var BPromise=require(_0xf4df('0x3'));var rs=require(_0xf4df('0x4'));var fs=require('fs');var db=require(_0xf4df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4df('0x6'))('rpc');var config=require(_0xf4df('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf4df('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa792b0,_0x2f6fc7,_0xf3d51){return new BPromise(function(_0x232db8,_0xd8a982){return client[_0xf4df('0x9')](_0xa792b0,_0xf3d51)[_0xf4df('0xa')](function(_0x643afa){logger[_0xf4df('0xb')](_0xf4df('0xc'),_0x2f6fc7,_0xf4df('0xd'));logger[_0xf4df('0xe')](_0xf4df('0xf'),_0x2f6fc7,_0xf4df('0xd'),JSON['stringify'](_0x643afa));if(_0x643afa['error']){if(_0x643afa[_0xf4df('0x10')][_0xf4df('0x11')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x2f6fc7,_0x643afa[_0xf4df('0x10')][_0xf4df('0x12')]);return _0xd8a982(_0x643afa['error']['message']);}logger[_0xf4df('0x10')](_0xf4df('0xc'),_0x2f6fc7,_0x643afa[_0xf4df('0x10')][_0xf4df('0x12')]);return _0x232db8(_0x643afa['error'][_0xf4df('0x12')]);}else{logger[_0xf4df('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x2f6fc7,_0xf4df('0xd'));_0x232db8(_0x643afa[_0xf4df('0x13')]['message']);}})[_0xf4df('0x14')](function(_0x234387){logger[_0xf4df('0x10')](_0xf4df('0xc'),_0x2f6fc7,_0x234387);_0xd8a982(_0x234387);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9027a70..b9b8682 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 _0x40bd=['exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','put','delete'];(function(_0x276468,_0x29685a){var _0x36dc3a=function(_0x291f0a){while(--_0x291f0a){_0x276468['push'](_0x276468['shift']());}};_0x36dc3a(++_0x29685a);}(_0x40bd,0x1d2));var _0xd40b=function(_0x563cd7,_0x46ac7c){_0x563cd7=_0x563cd7-0x0;var _0x3bc852=_0x40bd[_0x563cd7];return _0x3bc852;};'use strict';var multer=require(_0xd40b('0x0'));var util=require(_0xd40b('0x1'));var path=require('path');var express=require('express');var router=express[_0xd40b('0x2')]();var auth=require(_0xd40b('0x3'));var interaction=require(_0xd40b('0x4'));var config=require(_0xd40b('0x5'));var controller=require(_0xd40b('0x6'));router[_0xd40b('0x7')]('/',auth[_0xd40b('0x8')](),controller[_0xd40b('0x9')]);router['get'](_0xd40b('0xa'),auth[_0xd40b('0x8')](),controller[_0xd40b('0xb')]);router['post']('/',auth[_0xd40b('0x8')](),controller['create']);router[_0xd40b('0xc')]('/:id',auth[_0xd40b('0x8')](),controller['update']);router[_0xd40b('0xd')](_0xd40b('0xa'),auth[_0xd40b('0x8')](),controller['destroy']);module[_0xd40b('0xe')]=router; \ No newline at end of file +var _0xe574=['update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','post','put'];(function(_0x3b7503,_0x18682c){var _0x1ce4c8=function(_0x2403fe){while(--_0x2403fe){_0x3b7503['push'](_0x3b7503['shift']());}};_0x1ce4c8(++_0x18682c);}(_0xe574,0x100));var _0x4e57=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe574[_0x19950b];return _0x3c6b41;};'use strict';var multer=require(_0x4e57('0x0'));var util=require('util');var path=require(_0x4e57('0x1'));var express=require(_0x4e57('0x2'));var router=express[_0x4e57('0x3')]();var auth=require(_0x4e57('0x4'));var interaction=require(_0x4e57('0x5'));var config=require(_0x4e57('0x6'));var controller=require(_0x4e57('0x7'));router[_0x4e57('0x8')]('/',auth[_0x4e57('0x9')](),controller[_0x4e57('0xa')]);router[_0x4e57('0x8')](_0x4e57('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x4e57('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e57('0xd')](_0x4e57('0xb'),auth[_0x4e57('0x9')](),controller[_0x4e57('0xe')]);router[_0x4e57('0xf')]('/:id',auth[_0x4e57('0x9')](),controller[_0x4e57('0x10')]);module[_0x4e57('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 83f97f1..c98fe84 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 _0xa75b=['customVariable','keyValue','STRING','ENUM','sequelize','string','variable'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa75b,0x170));var _0xba75=function(_0x5d1d48,_0x49ec74){_0x5d1d48=_0x5d1d48-0x0;var _0x38ebce=_0xa75b[_0x5d1d48];return _0x38ebce;};'use strict';var Sequelize=require(_0xba75('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'),_0xba75('0x4')),'defaultValue':_0xba75('0x1')},'content':{'type':Sequelize[_0xba75('0x5')]},'key':{'type':Sequelize[_0xba75('0x5')]},'keyType':{'type':Sequelize[_0xba75('0x6')](_0xba75('0x1'),_0xba75('0x2'),_0xba75('0x3'))},'keyContent':{'type':Sequelize[_0xba75('0x5')]},'idField':{'type':Sequelize[_0xba75('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xba75('0x5')]}}; \ No newline at end of file +var _0x5c00=['string','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0xc23d0e,_0x1d7215){var _0x3e6928=function(_0x26e528){while(--_0x26e528){_0xc23d0e['push'](_0xc23d0e['shift']());}};_0x3e6928(++_0x1d7215);}(_0x5c00,0x17e));var _0x05c0=function(_0x38ce4c,_0xfdbe8c){_0x38ce4c=_0x38ce4c-0x0;var _0x5d4544=_0x5c00[_0x38ce4c];return _0x5d4544;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'type':{'type':Sequelize[_0x05c0('0x2')]('string',_0x05c0('0x3'),'customVariable',_0x05c0('0x4')),'defaultValue':_0x05c0('0x5')},'content':{'type':Sequelize[_0x05c0('0x6')]},'key':{'type':Sequelize[_0x05c0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x05c0('0x5'),_0x05c0('0x3'),_0x05c0('0x7'))},'keyContent':{'type':Sequelize[_0x05c0('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x05c0('0x6')]},'customField':{'type':Sequelize[_0x05c0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x05c0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 86db3ce..e974783 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 _0x1aab=['destroy','end','name','send','index','VtigerField','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','length','nolimit','limit','sort','where','filters','add','day','merge','filter','options','count','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','set','Content-Range','json','apply','reject','save','update','then'];(function(_0x5a81a6,_0x5cfbb3){var _0x1d60fc=function(_0x20a1d9){while(--_0x20a1d9){_0x5a81a6['push'](_0x5a81a6['shift']());}};_0x1d60fc(++_0x5cfbb3);}(_0x1aab,0x15a));var _0xb1aa=function(_0x25f3b7,_0x163ff4){_0x25f3b7=_0x25f3b7-0x0;var _0x349ce3=_0x1aab[_0x25f3b7];return _0x349ce3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb1aa('0x0'));var BPromise=require(_0xb1aa('0x1'));var Mustache=require(_0xb1aa('0x2'));var util=require(_0xb1aa('0x3'));var path=require(_0xb1aa('0x4'));var sox=require(_0xb1aa('0x5'));var csv=require(_0xb1aa('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb1aa('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb1aa('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb1aa('0x9'));var Papa=require(_0xb1aa('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0xb1aa('0xb'))(_0xb1aa('0xc'));var utils=require(_0xb1aa('0xd'));var config=require(_0xb1aa('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f7308,_0x168a36){_0x168a36=_0x168a36||0xcc;return function(_0x4e582c){if(_0x4e582c){return _0x3f7308[_0xb1aa('0xf')](_0x168a36);}return _0x3f7308[_0xb1aa('0x10')](_0x168a36)['end']();};}function respondWithResult(_0x4342ff,_0x5c8fe5){_0x5c8fe5=_0x5c8fe5||0xc8;return function(_0x331e0f){if(_0x331e0f){return _0x4342ff['status'](_0x5c8fe5)['json'](_0x331e0f);}};}function respondWithFilteredResult(_0x29a278,_0x4f47e3){return function(_0x18fd0e){if(_0x18fd0e){var _0x58628b=_0x18fd0e['count'],_0x28e2d3=_0x4f47e3[_0xb1aa('0x11')],_0x3c1e52=_0x4f47e3[_0xb1aa('0x11')]+_0x4f47e3['limit'],_0x19b6aa;if(_0x3c1e52>=_0x58628b){_0x3c1e52=_0x58628b;_0x19b6aa=0xc8;}else{_0x19b6aa=0xce;}_0x29a278[_0xb1aa('0x10')](_0x19b6aa);return _0x29a278[_0xb1aa('0x12')](_0xb1aa('0x13'),_0x28e2d3+'-'+_0x3c1e52+'/'+_0x58628b)[_0xb1aa('0x14')](_0x18fd0e);}return null;};}function patchUpdates(_0xbaaf7c){return function(_0x1b2b40){try{jsonpatch[_0xb1aa('0x15')](_0x1b2b40,_0xbaaf7c,!![]);}catch(_0xb06270){return BPromise[_0xb1aa('0x16')](_0xb06270);}return _0x1b2b40[_0xb1aa('0x17')]();};}function saveUpdates(_0x47c8dc,_0x2bd67b){return function(_0x3e7b2d){if(_0x3e7b2d){return _0x3e7b2d[_0xb1aa('0x18')](_0x47c8dc)[_0xb1aa('0x19')](function(_0x31edf9){return _0x31edf9;});}return null;};}function removeEntity(_0x495172,_0x1da10e){return function(_0x522a38){if(_0x522a38){return _0x522a38[_0xb1aa('0x1a')]()[_0xb1aa('0x19')](function(){_0x495172[_0xb1aa('0x10')](0xcc)[_0xb1aa('0x1b')]();});}};}function handleEntityNotFound(_0x47a471,_0x3c1c32){return function(_0x5a4ce0){if(!_0x5a4ce0){_0x47a471['sendStatus'](0x194);}return _0x5a4ce0;};}function handleError(_0x275653,_0x2abce2){_0x2abce2=_0x2abce2||0x1f4;return function(_0x5ce12a){logger['error'](_0x5ce12a['stack']);if(_0x5ce12a[_0xb1aa('0x1c')]){delete _0x5ce12a[_0xb1aa('0x1c')];}_0x275653[_0xb1aa('0x10')](_0x2abce2)[_0xb1aa('0x1d')](_0x5ce12a);};}exports[_0xb1aa('0x1e')]=function(_0x1e18ad,_0x202b95){var _0x3e5b96={},_0x1994e5={},_0x28d766={'count':0x0,'rows':[]};var _0x2fe29e=db[_0xb1aa('0x1f')]['rawAttributes'];_0x1994e5[_0xb1aa('0x20')]=_['keys'](_0x2fe29e);var _0x4791ce={'dateStart':_0x1e18ad['query'][_0xb1aa('0x21')],'dateEnd':_0x1e18ad['query'][_0xb1aa('0x22')]};delete _0x1e18ad[_0xb1aa('0x23')][_0xb1aa('0x21')];delete _0x1e18ad[_0xb1aa('0x23')][_0xb1aa('0x22')];_0x1994e5[_0xb1aa('0x23')]=_[_0xb1aa('0x24')](_0x1e18ad[_0xb1aa('0x23')]);_0x1994e5['filters']=_[_0xb1aa('0x25')](_0x1994e5['model'],_0x1994e5[_0xb1aa('0x23')]);_0x3e5b96[_0xb1aa('0x26')]=_[_0xb1aa('0x25')](_0x1994e5['model'],qs[_0xb1aa('0x27')](_0x1e18ad[_0xb1aa('0x23')][_0xb1aa('0x27')]));_0x3e5b96['attributes']=_0x3e5b96[_0xb1aa('0x26')][_0xb1aa('0x28')]?_0x3e5b96[_0xb1aa('0x26')]:_0x1994e5[_0xb1aa('0x20')];if(!_0x1e18ad[_0xb1aa('0x23')]['hasOwnProperty'](_0xb1aa('0x29'))){_0x3e5b96[_0xb1aa('0x2a')]=qs[_0xb1aa('0x2a')](_0x1e18ad['query']['limit']);_0x3e5b96[_0xb1aa('0x11')]=qs[_0xb1aa('0x11')](_0x1e18ad[_0xb1aa('0x23')]['offset']);}_0x3e5b96['order']=qs[_0xb1aa('0x2b')](_0x1e18ad[_0xb1aa('0x23')]['sort']);_0x3e5b96[_0xb1aa('0x2c')]=qs['filters'](_['pick'](_0x1e18ad[_0xb1aa('0x23')],_0x1994e5[_0xb1aa('0x2d')]));if(_0x4791ce['dateStart']){if(_0x4791ce[_0xb1aa('0x22')]){_0x4791ce[_0xb1aa('0x22')]=moment(_0x4791ce[_0xb1aa('0x22')])[_0xb1aa('0x2e')](0x1,'day');}else{_0x4791ce[_0xb1aa('0x22')]=moment(_0x4791ce['dateStart'])[_0xb1aa('0x2e')](0x1,_0xb1aa('0x2f'));}_[_0xb1aa('0x30')](_0x3e5b96[_0xb1aa('0x2c')],{'createdAt':{'$gte':_0x4791ce[_0xb1aa('0x21')],'$lte':_0x4791ce[_0xb1aa('0x22')]}});}if(_0x1e18ad[_0xb1aa('0x23')][_0xb1aa('0x31')]){_0x3e5b96[_0xb1aa('0x2c')]=_[_0xb1aa('0x30')](_0x3e5b96[_0xb1aa('0x2c')],{'$or':_['map'](_0x3e5b96[_0xb1aa('0x26')],function(_0x3e0b32){var _0x470429={};_0x470429[_0x3e0b32]={'$like':'%'+_0x1e18ad['query']['filter']+'%'};return _0x470429;})});}_0x3e5b96=_[_0xb1aa('0x30')]({},_0x3e5b96,_0x1e18ad[_0xb1aa('0x32')]);var _0x45a9d6={'where':_0x3e5b96[_0xb1aa('0x2c')]};return db[_0xb1aa('0x1f')][_0xb1aa('0x33')](_0x45a9d6)[_0xb1aa('0x19')](function(_0x37d48a){_0x28d766[_0xb1aa('0x33')]=_0x37d48a;if(_0x1e18ad['query'][_0xb1aa('0x34')]){_0x3e5b96[_0xb1aa('0x35')]=[{'all':!![]}];}return db[_0xb1aa('0x1f')][_0xb1aa('0x36')](_0x3e5b96);})[_0xb1aa('0x19')](function(_0x457a18){_0x28d766['rows']=_0x457a18;return _0x28d766;})[_0xb1aa('0x19')](respondWithFilteredResult(_0x202b95,_0x3e5b96))[_0xb1aa('0x37')](handleError(_0x202b95,null));};exports[_0xb1aa('0x38')]=function(_0x170e2e,_0x49431b){var _0x447c16={'raw':!![],'where':{'id':_0x170e2e['params']['id']}},_0x1b0975={};_0x1b0975[_0xb1aa('0x20')]=_[_0xb1aa('0x24')](db[_0xb1aa('0x1f')][_0xb1aa('0x39')]);_0x1b0975[_0xb1aa('0x23')]=_['keys'](_0x170e2e[_0xb1aa('0x23')]);_0x1b0975[_0xb1aa('0x2d')]=_['intersection'](_0x1b0975[_0xb1aa('0x20')],_0x1b0975[_0xb1aa('0x23')]);_0x447c16[_0xb1aa('0x26')]=_[_0xb1aa('0x25')](_0x1b0975['model'],qs[_0xb1aa('0x27')](_0x170e2e[_0xb1aa('0x23')][_0xb1aa('0x27')]));_0x447c16[_0xb1aa('0x26')]=_0x447c16[_0xb1aa('0x26')]['length']?_0x447c16[_0xb1aa('0x26')]:_0x1b0975['model'];if(_0x170e2e['query'][_0xb1aa('0x34')]){_0x447c16[_0xb1aa('0x35')]=[{'all':!![]}];}_0x447c16=_[_0xb1aa('0x30')]({},_0x447c16,_0x170e2e['options']);return db[_0xb1aa('0x1f')]['find'](_0x447c16)[_0xb1aa('0x19')](handleEntityNotFound(_0x49431b,null))[_0xb1aa('0x19')](respondWithResult(_0x49431b,null))[_0xb1aa('0x37')](handleError(_0x49431b,null));};exports['create']=function(_0x5b0ffa,_0x1a3f6e){return db['VtigerField'][_0xb1aa('0x3a')](_0x5b0ffa[_0xb1aa('0x3b')],{})[_0xb1aa('0x19')](respondWithResult(_0x1a3f6e,0xc9))[_0xb1aa('0x37')](handleError(_0x1a3f6e,null));};exports['update']=function(_0x23c31f,_0x283351){if(_0x23c31f[_0xb1aa('0x3b')]['id']){delete _0x23c31f[_0xb1aa('0x3b')]['id'];}return db[_0xb1aa('0x1f')][_0xb1aa('0x3c')]({'where':{'id':_0x23c31f['params']['id']}})[_0xb1aa('0x19')](handleEntityNotFound(_0x283351,null))[_0xb1aa('0x19')](saveUpdates(_0x23c31f[_0xb1aa('0x3b')],null))[_0xb1aa('0x19')](respondWithResult(_0x283351,null))[_0xb1aa('0x37')](handleError(_0x283351,null));};exports[_0xb1aa('0x1a')]=function(_0x38457b,_0x218085){return db[_0xb1aa('0x1f')][_0xb1aa('0x3c')]({'where':{'id':_0x38457b[_0xb1aa('0x3d')]['id']}})[_0xb1aa('0x19')](handleEntityNotFound(_0x218085,null))[_0xb1aa('0x19')](removeEntity(_0x218085,null))['catch'](handleError(_0x218085,null));}; \ No newline at end of file +var _0x92d2=['offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','rawAttributes','model','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','options','VtigerField','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','fast-json-patch','moment','bluebird','util','path','ejs','lodash','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count'];(function(_0x46ba84,_0x1cd8f7){var _0x545a31=function(_0xaf84cb){while(--_0xaf84cb){_0x46ba84['push'](_0x46ba84['shift']());}};_0x545a31(++_0x1cd8f7);}(_0x92d2,0x6f));var _0x292d=function(_0x9ddb44,_0x40acb1){_0x9ddb44=_0x9ddb44-0x0;var _0x36fb24=_0x92d2[_0x9ddb44];return _0x36fb24;};'use strict';var jsonpatch=require(_0x292d('0x0'));var rp=require('request-promise');var moment=require(_0x292d('0x1'));var BPromise=require(_0x292d('0x2'));var Mustache=require('mustache');var util=require(_0x292d('0x3'));var path=require(_0x292d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x292d('0x5'));var fs=require('fs');var _=require(_0x292d('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x292d('0x7'));var toCsv=require(_0x292d('0x8'));var querystring=require(_0x292d('0x9'));var Papa=require(_0x292d('0xa'));var qs=require(_0x292d('0xb'));var logger=require('../../config/logger')(_0x292d('0xc'));var utils=require(_0x292d('0xd'));var config=require(_0x292d('0xe'));var db=require(_0x292d('0xf'))['db'];function respondWithStatusCode(_0x493b27,_0x17bbf4){_0x17bbf4=_0x17bbf4||0xcc;return function(_0x5b798f){if(_0x5b798f){return _0x493b27[_0x292d('0x10')](_0x17bbf4);}return _0x493b27[_0x292d('0x11')](_0x17bbf4)[_0x292d('0x12')]();};}function respondWithResult(_0x44d4d7,_0x52fb0a){_0x52fb0a=_0x52fb0a||0xc8;return function(_0x3830c9){if(_0x3830c9){return _0x44d4d7[_0x292d('0x11')](_0x52fb0a)[_0x292d('0x13')](_0x3830c9);}};}function respondWithFilteredResult(_0x5dc837,_0x4544c5){return function(_0x23dd59){if(_0x23dd59){var _0x1e729a=_0x23dd59[_0x292d('0x14')],_0x324e14=_0x4544c5[_0x292d('0x15')],_0x11cfbf=_0x4544c5[_0x292d('0x15')]+_0x4544c5[_0x292d('0x16')],_0x46b67d;if(_0x11cfbf>=_0x1e729a){_0x11cfbf=_0x1e729a;_0x46b67d=0xc8;}else{_0x46b67d=0xce;}_0x5dc837[_0x292d('0x11')](_0x46b67d);return _0x5dc837['set'](_0x292d('0x17'),_0x324e14+'-'+_0x11cfbf+'/'+_0x1e729a)['json'](_0x23dd59);}return null;};}function patchUpdates(_0x54c082){return function(_0x3ed3d3){try{jsonpatch[_0x292d('0x18')](_0x3ed3d3,_0x54c082,!![]);}catch(_0x593d53){return BPromise[_0x292d('0x19')](_0x593d53);}return _0x3ed3d3[_0x292d('0x1a')]();};}function saveUpdates(_0x24ab60,_0x1cdc92){return function(_0x5e57b5){if(_0x5e57b5){return _0x5e57b5[_0x292d('0x1b')](_0x24ab60)[_0x292d('0x1c')](function(_0x481365){return _0x481365;});}return null;};}function removeEntity(_0x2905ea,_0x215fb6){return function(_0x4d2c01){if(_0x4d2c01){return _0x4d2c01[_0x292d('0x1d')]()[_0x292d('0x1c')](function(){_0x2905ea[_0x292d('0x11')](0xcc)[_0x292d('0x12')]();});}};}function handleEntityNotFound(_0x4ae60c,_0xc4d7ef){return function(_0x44a614){if(!_0x44a614){_0x4ae60c[_0x292d('0x10')](0x194);}return _0x44a614;};}function handleError(_0x2ef7c0,_0x154a53){_0x154a53=_0x154a53||0x1f4;return function(_0x5ae668){logger[_0x292d('0x1e')](_0x5ae668['stack']);if(_0x5ae668['name']){delete _0x5ae668[_0x292d('0x1f')];}_0x2ef7c0[_0x292d('0x11')](_0x154a53)[_0x292d('0x20')](_0x5ae668);};}exports[_0x292d('0x21')]=function(_0x497962,_0x30c59d){var _0x14994f={},_0x2fad24={},_0x57336d={'count':0x0,'rows':[]};var _0x4f0bda=db['VtigerField'][_0x292d('0x22')];_0x2fad24[_0x292d('0x23')]=_['keys'](_0x4f0bda);var _0x5e8f27={'dateStart':_0x497962['query']['dateStart'],'dateEnd':_0x497962[_0x292d('0x24')]['dateEnd']};delete _0x497962[_0x292d('0x24')][_0x292d('0x25')];delete _0x497962[_0x292d('0x24')][_0x292d('0x26')];_0x2fad24[_0x292d('0x24')]=_['keys'](_0x497962[_0x292d('0x24')]);_0x2fad24['filters']=_['intersection'](_0x2fad24[_0x292d('0x23')],_0x2fad24[_0x292d('0x24')]);_0x14994f[_0x292d('0x27')]=_[_0x292d('0x28')](_0x2fad24['model'],qs[_0x292d('0x29')](_0x497962[_0x292d('0x24')]['fields']));_0x14994f['attributes']=_0x14994f[_0x292d('0x27')][_0x292d('0x2a')]?_0x14994f[_0x292d('0x27')]:_0x2fad24['model'];if(!_0x497962['query'][_0x292d('0x2b')]('nolimit')){_0x14994f[_0x292d('0x16')]=qs[_0x292d('0x16')](_0x497962[_0x292d('0x24')][_0x292d('0x16')]);_0x14994f[_0x292d('0x15')]=qs['offset'](_0x497962['query']['offset']);}_0x14994f[_0x292d('0x2c')]=qs[_0x292d('0x2d')](_0x497962[_0x292d('0x24')][_0x292d('0x2d')]);_0x14994f[_0x292d('0x2e')]=qs[_0x292d('0x2f')](_[_0x292d('0x30')](_0x497962['query'],_0x2fad24[_0x292d('0x2f')]));if(_0x5e8f27[_0x292d('0x25')]){if(_0x5e8f27['dateEnd']){_0x5e8f27['dateEnd']=moment(_0x5e8f27['dateEnd'])[_0x292d('0x31')](0x1,_0x292d('0x32'));}else{_0x5e8f27['dateEnd']=moment(_0x5e8f27[_0x292d('0x25')])[_0x292d('0x31')](0x1,_0x292d('0x32'));}_[_0x292d('0x33')](_0x14994f[_0x292d('0x2e')],{'createdAt':{'$gte':_0x5e8f27[_0x292d('0x25')],'$lte':_0x5e8f27[_0x292d('0x26')]}});}if(_0x497962[_0x292d('0x24')][_0x292d('0x34')]){_0x14994f[_0x292d('0x2e')]=_[_0x292d('0x33')](_0x14994f[_0x292d('0x2e')],{'$or':_['map'](_0x14994f['attributes'],function(_0x1353e1){var _0x1f4924={};_0x1f4924[_0x1353e1]={'$like':'%'+_0x497962[_0x292d('0x24')]['filter']+'%'};return _0x1f4924;})});}_0x14994f=_[_0x292d('0x33')]({},_0x14994f,_0x497962[_0x292d('0x35')]);var _0x2b53f1={'where':_0x14994f[_0x292d('0x2e')]};return db[_0x292d('0x36')][_0x292d('0x14')](_0x2b53f1)[_0x292d('0x1c')](function(_0x4ab811){_0x57336d[_0x292d('0x14')]=_0x4ab811;if(_0x497962[_0x292d('0x24')][_0x292d('0x37')]){_0x14994f[_0x292d('0x38')]=[{'all':!![]}];}return db[_0x292d('0x36')][_0x292d('0x39')](_0x14994f);})[_0x292d('0x1c')](function(_0x2f2379){_0x57336d[_0x292d('0x3a')]=_0x2f2379;return _0x57336d;})['then'](respondWithFilteredResult(_0x30c59d,_0x14994f))[_0x292d('0x3b')](handleError(_0x30c59d,null));};exports[_0x292d('0x3c')]=function(_0x5f520b,_0x853499){var _0x1c6d65={'raw':!![],'where':{'id':_0x5f520b[_0x292d('0x3d')]['id']}},_0x4f2df1={};_0x4f2df1[_0x292d('0x23')]=_[_0x292d('0x3e')](db['VtigerField'][_0x292d('0x22')]);_0x4f2df1['query']=_['keys'](_0x5f520b[_0x292d('0x24')]);_0x4f2df1[_0x292d('0x2f')]=_[_0x292d('0x28')](_0x4f2df1[_0x292d('0x23')],_0x4f2df1['query']);_0x1c6d65[_0x292d('0x27')]=_[_0x292d('0x28')](_0x4f2df1[_0x292d('0x23')],qs[_0x292d('0x29')](_0x5f520b[_0x292d('0x24')][_0x292d('0x29')]));_0x1c6d65[_0x292d('0x27')]=_0x1c6d65[_0x292d('0x27')][_0x292d('0x2a')]?_0x1c6d65[_0x292d('0x27')]:_0x4f2df1[_0x292d('0x23')];if(_0x5f520b['query'][_0x292d('0x37')]){_0x1c6d65[_0x292d('0x38')]=[{'all':!![]}];}_0x1c6d65=_['merge']({},_0x1c6d65,_0x5f520b[_0x292d('0x35')]);return db['VtigerField'][_0x292d('0x3f')](_0x1c6d65)['then'](handleEntityNotFound(_0x853499,null))[_0x292d('0x1c')](respondWithResult(_0x853499,null))[_0x292d('0x3b')](handleError(_0x853499,null));};exports['create']=function(_0x2e4515,_0x2aa73b){return db[_0x292d('0x36')][_0x292d('0x40')](_0x2e4515[_0x292d('0x41')],{})['then'](respondWithResult(_0x2aa73b,0xc9))[_0x292d('0x3b')](handleError(_0x2aa73b,null));};exports[_0x292d('0x1b')]=function(_0x2e742f,_0x35d74d){if(_0x2e742f[_0x292d('0x41')]['id']){delete _0x2e742f[_0x292d('0x41')]['id'];}return db[_0x292d('0x36')]['find']({'where':{'id':_0x2e742f[_0x292d('0x3d')]['id']}})[_0x292d('0x1c')](handleEntityNotFound(_0x35d74d,null))[_0x292d('0x1c')](saveUpdates(_0x2e742f[_0x292d('0x41')],null))[_0x292d('0x1c')](respondWithResult(_0x35d74d,null))['catch'](handleError(_0x35d74d,null));};exports[_0x292d('0x1d')]=function(_0x3d6521,_0x2e49a1){return db[_0x292d('0x36')]['find']({'where':{'id':_0x3d6521[_0x292d('0x3d')]['id']}})[_0x292d('0x1c')](handleEntityNotFound(_0x2e49a1,null))[_0x292d('0x1c')](removeEntity(_0x2e49a1,null))[_0x292d('0x3b')](handleError(_0x2e49a1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 87afe00..9e9385b 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 _0x8a64=['exports','define','VtigerField','int_vtiger_fields','lodash','util','api','moment','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x51aafc,_0x462a24){var _0x4f3942=function(_0xe8e812){while(--_0xe8e812){_0x51aafc['push'](_0x51aafc['shift']());}};_0x4f3942(++_0x462a24);}(_0x8a64,0x9e));var _0x48a6=function(_0x1e8c9f,_0x51bcc9){_0x1e8c9f=_0x1e8c9f-0x0;var _0x219c6f=_0x8a64[_0x1e8c9f];return _0x219c6f;};'use strict';var _=require(_0x48a6('0x0'));var util=require(_0x48a6('0x1'));var logger=require('../../config/logger')(_0x48a6('0x2'));var moment=require(_0x48a6('0x3'));var BPromise=require(_0x48a6('0x4'));var rp=require(_0x48a6('0x5'));var attributes=require(_0x48a6('0x6'));module[_0x48a6('0x7')]=function(_0x3dea13,_0x1f0496){return _0x3dea13[_0x48a6('0x8')](_0x48a6('0x9'),attributes,{'tableName':_0x48a6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa04=['VtigerField','util','../../config/logger','moment','bluebird','request-promise','./intVtigerField.attributes'];(function(_0x32c25f,_0x65d6ea){var _0x8065f4=function(_0x1367d4){while(--_0x1367d4){_0x32c25f['push'](_0x32c25f['shift']());}};_0x8065f4(++_0x65d6ea);}(_0xfa04,0x1ba));var _0x4fa0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4fa0('0x0'));var logger=require(_0x4fa0('0x1'))('api');var moment=require(_0x4fa0('0x2'));var BPromise=require(_0x4fa0('0x3'));var rp=require(_0x4fa0('0x4'));var attributes=require(_0x4fa0('0x5'));module['exports']=function(_0x4cb150,_0x10ee8d){return _0x4cb150['define'](_0x4fa0('0x6'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index c92674c..6a52bd6 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 _0xbf07=['../../config/environment','jayson/promise','http','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x1b05c1,_0x387b32){var _0x2db39f=function(_0x42d707){while(--_0x42d707){_0x1b05c1['push'](_0x1b05c1['shift']());}};_0x2db39f(++_0x387b32);}(_0xbf07,0x13a));var _0x7bf0=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xbf07[_0x4fe19c];return _0x952ac7;};'use strict';var _=require(_0x7bf0('0x0'));var util=require(_0x7bf0('0x1'));var moment=require(_0x7bf0('0x2'));var BPromise=require(_0x7bf0('0x3'));var rs=require(_0x7bf0('0x4'));var fs=require('fs');var db=require(_0x7bf0('0x5'))['db'];var utils=require(_0x7bf0('0x6'));var logger=require('../../config/logger')(_0x7bf0('0x7'));var config=require(_0x7bf0('0x8'));var jayson=require(_0x7bf0('0x9'));var client=jayson['client'][_0x7bf0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfd3a8b,_0x111bab,_0x2bd950){return new BPromise(function(_0x166f41,_0x642f51){return client['request'](_0xfd3a8b,_0x2bd950)[_0x7bf0('0xb')](function(_0x5bac1c){logger['info']('VtigerField,\x20%s,\x20%s',_0x111bab,'request\x20sent');logger[_0x7bf0('0xc')](_0x7bf0('0xd'),_0x111bab,_0x7bf0('0xe'),JSON[_0x7bf0('0xf')](_0x5bac1c));if(_0x5bac1c[_0x7bf0('0x10')]){if(_0x5bac1c[_0x7bf0('0x10')][_0x7bf0('0x11')]===0x1f4){logger[_0x7bf0('0x10')](_0x7bf0('0x12'),_0x111bab,_0x5bac1c[_0x7bf0('0x10')][_0x7bf0('0x13')]);return _0x642f51(_0x5bac1c[_0x7bf0('0x10')][_0x7bf0('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x111bab,_0x5bac1c['error'][_0x7bf0('0x13')]);return _0x166f41(_0x5bac1c[_0x7bf0('0x10')]['message']);}else{logger[_0x7bf0('0x14')](_0x7bf0('0x12'),_0x111bab,'request\x20sent');_0x166f41(_0x5bac1c[_0x7bf0('0x15')]['message']);}})[_0x7bf0('0x16')](function(_0x1b0659){logger[_0x7bf0('0x10')]('VtigerField,\x20%s,\x20%s',_0x111bab,_0x1b0659);_0x642f51(_0x1b0659);});});} \ No newline at end of file +var _0xe959=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe959,0x170));var _0x9e95=function(_0xfa96da,_0x5b77c7){_0xfa96da=_0xfa96da-0x0;var _0x1b22a4=_0xe959[_0xfa96da];return _0x1b22a4;};'use strict';var _=require(_0x9e95('0x0'));var util=require(_0x9e95('0x1'));var moment=require(_0x9e95('0x2'));var BPromise=require(_0x9e95('0x3'));var rs=require(_0x9e95('0x4'));var fs=require('fs');var db=require(_0x9e95('0x5'))['db'];var utils=require(_0x9e95('0x6'));var logger=require(_0x9e95('0x7'))(_0x9e95('0x8'));var config=require(_0x9e95('0x9'));var jayson=require(_0x9e95('0xa'));var client=jayson[_0x9e95('0xb')][_0x9e95('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1657f6,_0x26d9b0,_0x1c2de2){return new BPromise(function(_0x357e90,_0xc58e78){return client[_0x9e95('0xd')](_0x1657f6,_0x1c2de2)[_0x9e95('0xe')](function(_0x9cf333){logger[_0x9e95('0xf')](_0x9e95('0x10'),_0x26d9b0,_0x9e95('0x11'));logger[_0x9e95('0x12')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x26d9b0,'request\x20sent',JSON['stringify'](_0x9cf333));if(_0x9cf333[_0x9e95('0x13')]){if(_0x9cf333[_0x9e95('0x13')]['code']===0x1f4){logger['error'](_0x9e95('0x10'),_0x26d9b0,_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);return _0xc58e78(_0x9cf333['error']['message']);}logger[_0x9e95('0x13')]('VtigerField,\x20%s,\x20%s',_0x26d9b0,_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);return _0x357e90(_0x9cf333[_0x9e95('0x13')][_0x9e95('0x14')]);}else{logger[_0x9e95('0xf')](_0x9e95('0x10'),_0x26d9b0,_0x9e95('0x11'));_0x357e90(_0x9cf333[_0x9e95('0x15')][_0x9e95('0x14')]);}})[_0x9e95('0x16')](function(_0x283430){logger['error']('VtigerField,\x20%s,\x20%s',_0x26d9b0,_0x283430);_0xc58e78(_0x283430);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 68a877a..1ff1132 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 _0x9782=['post','addConfiguration','put','/:id','destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields','create'];(function(_0x5b6a86,_0x59489c){var _0x425888=function(_0x38fdfd){while(--_0x38fdfd){_0x5b6a86['push'](_0x5b6a86['shift']());}};_0x425888(++_0x59489c);}(_0x9782,0xf6));var _0x2978=function(_0x36e3ba,_0x1912e8){_0x36e3ba=_0x36e3ba-0x0;var _0x7972c7=_0x9782[_0x36e3ba];return _0x7972c7;};'use strict';var multer=require(_0x2978('0x0'));var util=require(_0x2978('0x1'));var path=require('path');var express=require(_0x2978('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2978('0x3'));var config=require(_0x2978('0x4'));var controller=require(_0x2978('0x5'));router[_0x2978('0x6')]('/',auth[_0x2978('0x7')](),controller[_0x2978('0x8')]);router[_0x2978('0x6')]('/:id',auth[_0x2978('0x7')](),controller['show']);router[_0x2978('0x6')](_0x2978('0x9'),auth[_0x2978('0x7')](),controller[_0x2978('0xa')]);router[_0x2978('0x6')](_0x2978('0xb'),auth[_0x2978('0x7')](),controller[_0x2978('0xc')]);router['post']('/',auth[_0x2978('0x7')](),controller[_0x2978('0xd')]);router[_0x2978('0xe')](_0x2978('0x9'),auth[_0x2978('0x7')](),controller[_0x2978('0xf')]);router[_0x2978('0x10')](_0x2978('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2978('0x12')]);module[_0x2978('0x13')]=router; \ No newline at end of file +var _0xd906=['destroy','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','put','update','delete'];(function(_0x5f0e5e,_0x2bdf03){var _0x55ece9=function(_0x10272c){while(--_0x10272c){_0x5f0e5e['push'](_0x5f0e5e['shift']());}};_0x55ece9(++_0x2bdf03);}(_0xd906,0x6b));var _0x6d90=function(_0x35c52c,_0x33a7a5){_0x35c52c=_0x35c52c-0x0;var _0x4bc5b9=_0xd906[_0x35c52c];return _0x4bc5b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6d90('0x0'));var express=require(_0x6d90('0x1'));var router=express[_0x6d90('0x2')]();var auth=require(_0x6d90('0x3'));var interaction=require(_0x6d90('0x4'));var config=require('../../config/environment');var controller=require(_0x6d90('0x5'));router[_0x6d90('0x6')]('/',auth[_0x6d90('0x7')](),controller[_0x6d90('0x8')]);router['get'](_0x6d90('0x9'),auth[_0x6d90('0x7')](),controller[_0x6d90('0xa')]);router[_0x6d90('0x6')](_0x6d90('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x6d90('0xc'),auth[_0x6d90('0x7')](),controller[_0x6d90('0xd')]);router[_0x6d90('0xe')]('/',auth[_0x6d90('0x7')](),controller[_0x6d90('0xf')]);router[_0x6d90('0xe')]('/:id/configurations',auth[_0x6d90('0x7')](),controller['addConfiguration']);router[_0x6d90('0x10')]('/:id',auth[_0x6d90('0x7')](),controller[_0x6d90('0x11')]);router[_0x6d90('0x12')](_0x6d90('0x9'),auth[_0x6d90('0x7')](),controller[_0x6d90('0x13')]);module[_0x6d90('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 0e9884f..752d929 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 _0x5d3c=['integrationTab','sequelize','exports','STRING','remoteUri','ENUM','password','token'];(function(_0x22d7e1,_0x348a5d){var _0x3d811a=function(_0x437710){while(--_0x437710){_0x22d7e1['push'](_0x22d7e1['shift']());}};_0x3d811a(++_0x348a5d);}(_0x5d3c,0x159));var _0xc5d3=function(_0x22cb88,_0x4dd43b){_0x22cb88=_0x22cb88-0x0;var _0x4aa2dd=_0x5d3c[_0x22cb88];return _0x4aa2dd;};'use strict';var Sequelize=require(_0xc5d3('0x0'));module[_0xc5d3('0x1')]={'name':{'type':Sequelize[_0xc5d3('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc5d3('0x2')],'unique':'username'},'password':{'type':Sequelize[_0xc5d3('0x2')]},'token':{'type':Sequelize[_0xc5d3('0x2')]},'remoteUri':{'type':Sequelize[_0xc5d3('0x2')],'unique':_0xc5d3('0x3')},'authType':{'type':Sequelize[_0xc5d3('0x4')](_0xc5d3('0x5'),_0xc5d3('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc5d3('0x4')](_0xc5d3('0x7'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2f0d=['username','remoteUri','ENUM','password','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x53a0df,_0x38a129){var _0x3ddb74=function(_0x48c11e){while(--_0x48c11e){_0x53a0df['push'](_0x53a0df['shift']());}};_0x3ddb74(++_0x38a129);}(_0x2f0d,0xa8));var _0xd2f0=function(_0xccece6,_0x9d3ffa){_0xccece6=_0xccece6-0x0;var _0x4e7e47=_0x2f0d[_0xccece6];return _0x4e7e47;};'use strict';var Sequelize=require(_0xd2f0('0x0'));module[_0xd2f0('0x1')]={'name':{'type':Sequelize[_0xd2f0('0x2')]},'description':{'type':Sequelize[_0xd2f0('0x2')]},'username':{'type':Sequelize[_0xd2f0('0x2')],'unique':_0xd2f0('0x3')},'password':{'type':Sequelize[_0xd2f0('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd2f0('0x2')],'unique':_0xd2f0('0x4')},'authType':{'type':Sequelize[_0xd2f0('0x5')](_0xd2f0('0x6'),'token'),'defaultValue':_0xd2f0('0x6')},'serverUrl':{'type':Sequelize[_0xd2f0('0x2')]},'type':{'type':Sequelize[_0xd2f0('0x5')](_0xd2f0('0x7'),_0xd2f0('0x8')),'defaultValue':_0xd2f0('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 84fced7..f30ae4b 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 _0x4b07=['stringify','Wrong\x20credentials','statusCode','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','status','json','count','offset','limit','apply','save','update','destroy','end','sendStatus','stack','name','send','index','ZendeskAccount','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','fields','length','body','find','getConfigurations','findOne','addConfiguration','AccountId','Subjects','channel','type','getDescriptions','ZendeskField','Descriptions','getFields','username','authType','remoteUri','GET','format','%s%s','password','Basic\x20%s','%s:%s','toString','base64','token','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','ticket_fields','includes','position','system_field_options','test','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x4b07,0x7a));var _0x74b0=function(_0x553e29,_0x15f532){_0x553e29=_0x553e29-0x0;var _0x5c5edb=_0x4b07[_0x553e29];return _0x5c5edb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x74b0('0x0'));var moment=require(_0x74b0('0x1'));var BPromise=require(_0x74b0('0x2'));var Mustache=require(_0x74b0('0x3'));var util=require(_0x74b0('0x4'));var path=require(_0x74b0('0x5'));var sox=require(_0x74b0('0x6'));var csv=require('to-csv');var ejs=require(_0x74b0('0x7'));var fs=require('fs');var _=require(_0x74b0('0x8'));var squel=require(_0x74b0('0x9'));var crypto=require(_0x74b0('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x74b0('0xb'));var querystring=require(_0x74b0('0xc'));var Papa=require(_0x74b0('0xd'));var qs=require(_0x74b0('0xe'));var logger=require('../../config/logger')(_0x74b0('0xf'));var utils=require(_0x74b0('0x10'));var config=require(_0x74b0('0x11'));var db=require(_0x74b0('0x12'))['db'];var integrations=require(_0x74b0('0x13'));var jayson=require(_0x74b0('0x14'));var client=jayson[_0x74b0('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb6f1,_0x26cc5a,_0x116e97,_0xf623c0){return new BPromise(function(_0x1bd833,_0x46d06c){var _0x21d4b6=_0xf623c0||client;return _0x21d4b6[_0x74b0('0x16')](_0x2cb6f1,_0x116e97)[_0x74b0('0x17')](function(_0x24d2be){logger['info'](_0x74b0('0x18'),_0x26cc5a,_0x74b0('0x19'));logger[_0x74b0('0x1a')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x26cc5a,_0x74b0('0x19'),JSON['stringify'](_0x24d2be));if(_0x24d2be[_0x74b0('0x1b')]){if(_0x24d2be[_0x74b0('0x1b')][_0x74b0('0x1c')]===0x1f4){logger[_0x74b0('0x1b')]('ZendeskAccount,\x20%s,\x20%s',_0x26cc5a,_0x24d2be[_0x74b0('0x1b')][_0x74b0('0x1d')]);return _0x46d06c(_0x24d2be['error'][_0x74b0('0x1d')]);}logger[_0x74b0('0x1b')](_0x74b0('0x18'),_0x26cc5a,_0x24d2be[_0x74b0('0x1b')][_0x74b0('0x1d')]);return _0x1bd833(_0x24d2be[_0x74b0('0x1b')][_0x74b0('0x1d')]);}else{logger[_0x74b0('0x1e')]('ZendeskAccount,\x20%s,\x20%s',_0x26cc5a,'request\x20sent');_0x1bd833(_0x24d2be['result'][_0x74b0('0x1d')]);}})['catch'](function(_0x49e528){logger[_0x74b0('0x1b')](_0x74b0('0x18'),_0x26cc5a,_0x49e528);_0x46d06c(_0x49e528);});});}function respondWithStatusCode(_0x3050a0,_0x510a31){_0x510a31=_0x510a31||0xcc;return function(_0x28297b){if(_0x28297b){return _0x3050a0['sendStatus'](_0x510a31);}return _0x3050a0[_0x74b0('0x1f')](_0x510a31)['end']();};}function respondWithResult(_0x2e17b6,_0xd1200e){_0xd1200e=_0xd1200e||0xc8;return function(_0x5d089f){if(_0x5d089f){return _0x2e17b6[_0x74b0('0x1f')](_0xd1200e)[_0x74b0('0x20')](_0x5d089f);}};}function respondWithFilteredResult(_0x1d42f8,_0x2bf588){return function(_0x3fe07b){if(_0x3fe07b){var _0x274d89=_0x3fe07b[_0x74b0('0x21')],_0xec883d=_0x2bf588[_0x74b0('0x22')],_0x43c111=_0x2bf588[_0x74b0('0x22')]+_0x2bf588[_0x74b0('0x23')],_0x4bceb7;if(_0x43c111>=_0x274d89){_0x43c111=_0x274d89;_0x4bceb7=0xc8;}else{_0x4bceb7=0xce;}_0x1d42f8['status'](_0x4bceb7);return _0x1d42f8['set']('Content-Range',_0xec883d+'-'+_0x43c111+'/'+_0x274d89)[_0x74b0('0x20')](_0x3fe07b);}return null;};}function patchUpdates(_0x358898){return function(_0x1adb24){try{jsonpatch[_0x74b0('0x24')](_0x1adb24,_0x358898,!![]);}catch(_0x1469b9){return BPromise['reject'](_0x1469b9);}return _0x1adb24[_0x74b0('0x25')]();};}function saveUpdates(_0x465d80,_0x17a4a9){return function(_0x2cd452){if(_0x2cd452){return _0x2cd452[_0x74b0('0x26')](_0x465d80)['then'](function(_0x514d54){return _0x514d54;});}return null;};}function removeEntity(_0x3e5837,_0x331638){return function(_0x287651){if(_0x287651){return _0x287651[_0x74b0('0x27')]()[_0x74b0('0x17')](function(){_0x3e5837['status'](0xcc)[_0x74b0('0x28')]();});}};}function handleEntityNotFound(_0x2cf40c,_0x1be824){return function(_0x5a9b34){if(!_0x5a9b34){_0x2cf40c[_0x74b0('0x29')](0x194);}return _0x5a9b34;};}function handleError(_0x193ac3,_0x43b529){_0x43b529=_0x43b529||0x1f4;return function(_0x84ea34){logger['error'](_0x84ea34[_0x74b0('0x2a')]);if(_0x84ea34[_0x74b0('0x2b')]){delete _0x84ea34[_0x74b0('0x2b')];}_0x193ac3[_0x74b0('0x1f')](_0x43b529)[_0x74b0('0x2c')](_0x84ea34);};}exports[_0x74b0('0x2d')]=function(_0x2ffb5b,_0x216e89){var _0x55e768={},_0x93aad2={},_0x51a981={'count':0x0,'rows':[]};var _0x225975=db[_0x74b0('0x2e')][_0x74b0('0x2f')];_0x93aad2[_0x74b0('0x30')]=_[_0x74b0('0x31')](_0x225975);var _0x52d67b={'dateStart':_0x2ffb5b['query'][_0x74b0('0x32')],'dateEnd':_0x2ffb5b['query'][_0x74b0('0x33')]};delete _0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x32')];delete _0x2ffb5b[_0x74b0('0x34')]['dateEnd'];_0x93aad2[_0x74b0('0x34')]=_[_0x74b0('0x31')](_0x2ffb5b[_0x74b0('0x34')]);_0x93aad2[_0x74b0('0x35')]=_[_0x74b0('0x36')](_0x93aad2[_0x74b0('0x30')],_0x93aad2[_0x74b0('0x34')]);_0x55e768[_0x74b0('0x37')]=_[_0x74b0('0x36')](_0x93aad2[_0x74b0('0x30')],qs['fields'](_0x2ffb5b[_0x74b0('0x34')]['fields']));_0x55e768[_0x74b0('0x37')]=_0x55e768[_0x74b0('0x37')]['length']?_0x55e768[_0x74b0('0x37')]:_0x93aad2[_0x74b0('0x30')];if(!_0x2ffb5b['query'][_0x74b0('0x38')]('nolimit')){_0x55e768[_0x74b0('0x23')]=qs[_0x74b0('0x23')](_0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x23')]);_0x55e768['offset']=qs[_0x74b0('0x22')](_0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x22')]);}_0x55e768[_0x74b0('0x39')]=qs[_0x74b0('0x3a')](_0x2ffb5b['query'][_0x74b0('0x3a')]);_0x55e768[_0x74b0('0x3b')]=qs[_0x74b0('0x35')](_[_0x74b0('0x3c')](_0x2ffb5b[_0x74b0('0x34')],_0x93aad2[_0x74b0('0x35')]));if(_0x52d67b[_0x74b0('0x32')]){if(_0x52d67b[_0x74b0('0x33')]){_0x52d67b[_0x74b0('0x33')]=moment(_0x52d67b[_0x74b0('0x33')])['add'](0x1,_0x74b0('0x3d'));}else{_0x52d67b[_0x74b0('0x33')]=moment(_0x52d67b[_0x74b0('0x32')])[_0x74b0('0x3e')](0x1,_0x74b0('0x3d'));}_[_0x74b0('0x3f')](_0x55e768[_0x74b0('0x3b')],{'createdAt':{'$gte':_0x52d67b[_0x74b0('0x32')],'$lte':_0x52d67b['dateEnd']}});}if(_0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x40')]){_0x55e768[_0x74b0('0x3b')]=_['merge'](_0x55e768[_0x74b0('0x3b')],{'$or':_[_0x74b0('0x41')](_0x55e768[_0x74b0('0x37')],function(_0x3cfb6a){var _0x1b65ea={};_0x1b65ea[_0x3cfb6a]={'$like':'%'+_0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x40')]+'%'};return _0x1b65ea;})});}_0x55e768=_[_0x74b0('0x3f')]({},_0x55e768,_0x2ffb5b[_0x74b0('0x42')]);var _0x4ab217={'where':_0x55e768['where']};return db['ZendeskAccount']['count'](_0x4ab217)['then'](function(_0x9aafbe){_0x51a981[_0x74b0('0x21')]=_0x9aafbe;if(_0x2ffb5b[_0x74b0('0x34')][_0x74b0('0x43')]){_0x55e768[_0x74b0('0x44')]=[{'all':!![]}];}return db[_0x74b0('0x2e')][_0x74b0('0x45')](_0x55e768);})[_0x74b0('0x17')](function(_0x2ba492){_0x51a981[_0x74b0('0x46')]=_0x2ba492;return _0x51a981;})[_0x74b0('0x17')](respondWithFilteredResult(_0x216e89,_0x55e768))[_0x74b0('0x47')](handleError(_0x216e89,null));};exports[_0x74b0('0x48')]=function(_0x4bb906,_0x42b00b){var _0xc26a05={'raw':![],'where':{'id':_0x4bb906[_0x74b0('0x49')]['id']}},_0x100094={};_0x100094[_0x74b0('0x30')]=_[_0x74b0('0x31')](db[_0x74b0('0x2e')][_0x74b0('0x2f')]);_0x100094[_0x74b0('0x34')]=_[_0x74b0('0x31')](_0x4bb906[_0x74b0('0x34')]);_0x100094[_0x74b0('0x35')]=_[_0x74b0('0x36')](_0x100094['model'],_0x100094['query']);_0xc26a05[_0x74b0('0x37')]=_[_0x74b0('0x36')](_0x100094[_0x74b0('0x30')],qs[_0x74b0('0x4a')](_0x4bb906[_0x74b0('0x34')][_0x74b0('0x4a')]));_0xc26a05['attributes']=_0xc26a05['attributes'][_0x74b0('0x4b')]?_0xc26a05[_0x74b0('0x37')]:_0x100094['model'];if(_0x4bb906[_0x74b0('0x34')]['includeAll']){_0xc26a05['include']=[{'all':!![]}];}_0xc26a05=_[_0x74b0('0x3f')]({},_0xc26a05,_0x4bb906[_0x74b0('0x42')]);return db[_0x74b0('0x2e')]['find'](_0xc26a05)[_0x74b0('0x17')](handleEntityNotFound(_0x42b00b,null))[_0x74b0('0x17')](respondWithResult(_0x42b00b,null))['catch'](handleError(_0x42b00b,null));};exports['create']=function(_0x3e98a0,_0x3030c6){return db['ZendeskAccount']['create'](_0x3e98a0[_0x74b0('0x4c')],{})[_0x74b0('0x17')](respondWithResult(_0x3030c6,0xc9))[_0x74b0('0x47')](handleError(_0x3030c6,null));};exports[_0x74b0('0x26')]=function(_0xe0e854,_0x144291){if(_0xe0e854['body']['id']){delete _0xe0e854[_0x74b0('0x4c')]['id'];}return db[_0x74b0('0x2e')][_0x74b0('0x4d')]({'where':{'id':_0xe0e854[_0x74b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x144291,null))[_0x74b0('0x17')](saveUpdates(_0xe0e854[_0x74b0('0x4c')],null))[_0x74b0('0x17')](respondWithResult(_0x144291,null))[_0x74b0('0x47')](handleError(_0x144291,null));};exports['destroy']=function(_0x4a338a,_0x17c52f){return db[_0x74b0('0x2e')][_0x74b0('0x4d')]({'where':{'id':_0x4a338a['params']['id']}})['then'](handleEntityNotFound(_0x17c52f,null))[_0x74b0('0x17')](removeEntity(_0x17c52f,null))['catch'](handleError(_0x17c52f,null));};exports[_0x74b0('0x4e')]=function(_0x16c779,_0xdfa88a,_0x2ccf3b){var _0x1dcb36={};var _0x5063db={};var _0x31e681;var _0x38f20e;return db[_0x74b0('0x2e')][_0x74b0('0x4f')]({'where':{'id':_0x16c779[_0x74b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xdfa88a,null))[_0x74b0('0x17')](function(_0x2d27ea){if(_0x2d27ea){_0x31e681=_0x2d27ea;_0x5063db[_0x74b0('0x30')]=_[_0x74b0('0x31')](db['ZendeskConfiguration'][_0x74b0('0x2f')]);_0x5063db['query']=_[_0x74b0('0x31')](_0x16c779[_0x74b0('0x34')]);_0x5063db['filters']=_[_0x74b0('0x36')](_0x5063db[_0x74b0('0x30')],_0x5063db[_0x74b0('0x34')]);_0x1dcb36[_0x74b0('0x37')]=_[_0x74b0('0x36')](_0x5063db[_0x74b0('0x30')],qs[_0x74b0('0x4a')](_0x16c779[_0x74b0('0x34')][_0x74b0('0x4a')]));_0x1dcb36[_0x74b0('0x37')]=_0x1dcb36[_0x74b0('0x37')][_0x74b0('0x4b')]?_0x1dcb36[_0x74b0('0x37')]:_0x5063db[_0x74b0('0x30')];_0x1dcb36[_0x74b0('0x39')]=qs[_0x74b0('0x3a')](_0x16c779[_0x74b0('0x34')][_0x74b0('0x3a')]);_0x1dcb36['where']=qs[_0x74b0('0x35')](_['pick'](_0x16c779[_0x74b0('0x34')],_0x5063db['filters']));if(_0x16c779['query'][_0x74b0('0x40')]){_0x1dcb36['where']=_[_0x74b0('0x3f')](_0x1dcb36[_0x74b0('0x3b')],{'$or':_[_0x74b0('0x41')](_0x1dcb36[_0x74b0('0x37')],function(_0x1b9d4a){var _0x5551a1={};_0x5551a1[_0x1b9d4a]={'$like':'%'+_0x16c779[_0x74b0('0x34')][_0x74b0('0x40')]+'%'};return _0x5551a1;})});}_0x1dcb36=_[_0x74b0('0x3f')]({},_0x1dcb36,_0x16c779[_0x74b0('0x42')]);return _0x31e681[_0x74b0('0x4e')](_0x1dcb36);}})['then'](function(_0x58631b){if(_0x58631b){_0x38f20e=_0x58631b[_0x74b0('0x4b')];if(!_0x16c779[_0x74b0('0x34')][_0x74b0('0x38')]('nolimit')){_0x1dcb36[_0x74b0('0x23')]=qs[_0x74b0('0x23')](_0x16c779[_0x74b0('0x34')][_0x74b0('0x23')]);_0x1dcb36[_0x74b0('0x22')]=qs[_0x74b0('0x22')](_0x16c779[_0x74b0('0x34')][_0x74b0('0x22')]);}return _0x31e681[_0x74b0('0x4e')](_0x1dcb36);}})[_0x74b0('0x17')](function(_0x32b1f1){if(_0x32b1f1){return _0x32b1f1?{'count':_0x38f20e,'rows':_0x32b1f1}:null;}})[_0x74b0('0x17')](respondWithResult(_0xdfa88a,null))[_0x74b0('0x47')](handleError(_0xdfa88a,null));};exports[_0x74b0('0x50')]=function(_0x53ae49,_0x25517c,_0x25deb9){if(_0x53ae49[_0x74b0('0x4c')]['id']){delete _0x53ae49['body']['id'];}return db[_0x74b0('0x2e')][_0x74b0('0x4f')]({'where':{'id':_0x53ae49[_0x74b0('0x49')]['id']}})['then'](handleEntityNotFound(_0x25517c,null))['then'](function(_0x5e276f){if(_0x5e276f){_0x53ae49['body'][_0x74b0('0x51')]=_0x5e276f['id'];_0x53ae49[_0x74b0('0x4c')][_0x74b0('0x52')]=integrations['getSubjects'](_0x53ae49[_0x74b0('0x4c')][_0x74b0('0x53')],_0x53ae49[_0x74b0('0x4c')][_0x74b0('0x54')]);_0x53ae49[_0x74b0('0x4c')]['Descriptions']=integrations[_0x74b0('0x55')](_0x53ae49['body'][_0x74b0('0x53')],_0x53ae49[_0x74b0('0x4c')]['type']);return db['ZendeskConfiguration']['create'](_0x53ae49['body'],{'include':[{'model':db[_0x74b0('0x56')],'as':_0x74b0('0x52')},{'model':db['ZendeskField'],'as':_0x74b0('0x57')}]});}return null;})[_0x74b0('0x17')](respondWithResult(_0x25517c,null))['catch'](handleError(_0x25517c,null));};exports[_0x74b0('0x58')]=function(_0x4c150e,_0x42e5e2,_0x2d0802){return db[_0x74b0('0x2e')][_0x74b0('0x4f')]({'where':{'id':_0x4c150e[_0x74b0('0x49')]['id']},'attributes':['id',_0x74b0('0x59'),'password','token',_0x74b0('0x5a'),_0x74b0('0x5b')]})[_0x74b0('0x17')](handleEntityNotFound(_0x42e5e2,null))[_0x74b0('0x17')](function(_0x2e4ae5){if(_0x2e4ae5){var _0x4923f7={'method':_0x74b0('0x5c'),'uri':util[_0x74b0('0x5d')](_0x74b0('0x5e'),_0x2e4ae5[_0x74b0('0x5b')],'ticket_fields'),'json':!![]};switch(_0x2e4ae5['authType']){case _0x74b0('0x5f'):_0x4923f7['headers']={'Authorization':util[_0x74b0('0x5d')](_0x74b0('0x60'),new Buffer(util['format'](_0x74b0('0x61'),_0x2e4ae5[_0x74b0('0x59')],_0x2e4ae5[_0x74b0('0x5f')]))[_0x74b0('0x62')](_0x74b0('0x63')))};break;case _0x74b0('0x64'):_0x4923f7['headers']={'Authorization':util[_0x74b0('0x5d')](_0x74b0('0x60'),new Buffer(util[_0x74b0('0x5d')](_0x74b0('0x65'),_0x2e4ae5[_0x74b0('0x59')],_0x2e4ae5['token']))['toString']('base64'))};break;default:throw new db[(_0x74b0('0x66'))][(_0x74b0('0x67'))](_0x74b0('0x68'));}return rp(_0x4923f7);}})[_0x74b0('0x17')](function(_0xfccb65){if(_0xfccb65){var _0x4c06ab=[_0x74b0('0x69'),_0x74b0('0x6a'),_0x74b0('0x6b'),_0x74b0('0x6c')];_[_0x74b0('0x6d')](_0xfccb65[_0x74b0('0x6e')],function(_0x29bccb){return _0x4c06ab[_0x74b0('0x6f')](_0x29bccb[_0x74b0('0x54')]);});return{'count':_0xfccb65[_0x74b0('0x6e')][_0x74b0('0x4b')],'rows':_[_0x74b0('0x41')](_0xfccb65[_0x74b0('0x6e')],function(_0x568d54){return{'id':_0x568d54['id'],'name':_0x568d54[_0x74b0('0x70')]>0x7?_0x568d54['title']:_0x568d54[_0x74b0('0x54')],'custom':_0x568d54[_0x74b0('0x70')]>0x7?!![]:![],'options':_0x568d54[_0x74b0('0x71')]?_0x568d54[_0x74b0('0x71')]:[]};})};}})[_0x74b0('0x17')](respondWithResult(_0x42e5e2,null))[_0x74b0('0x47')](function(_0x10f047){var _0x5857d9=_0x4c150e['query'][_0x74b0('0x72')]?0x1f4:_0x10f047['statusCode']||0x1f4;logger[_0x74b0('0x1b')](_0x74b0('0x73'),_0x74b0('0x58'),_0x5857d9,JSON[_0x74b0('0x74')](_0x10f047));delete _0x10f047[_0x74b0('0x2b')];if(_0x5857d9===0x191){_0x5857d9=0x190;}_0x42e5e2['status'](_0x5857d9)[_0x74b0('0x2c')](_0x4c150e[_0x74b0('0x34')][_0x74b0('0x72')]?{'message':_0x74b0('0x75'),'statusCode':_0x10f047[_0x74b0('0x76')]}:_0x10f047);});}; \ No newline at end of file +var _0x4017=['fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','map','options','count','findAll','rows','params','rawAttributes','include','create','body','find','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','getSubjects','type','Descriptions','channel','ZendeskField','Subjects','password','token','authType','remoteUri','GET','format','Basic\x20%s','%s:%s','username','toString','base64','headers','%s/token:%s','Sequelize','ValidationError','Unknown\x20authentication\x20type','remove','ticket_fields','includes','title','position','system_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../components/integrations/configuration','jayson/promise','client','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ZendeskAccount','model','keys','query','dateStart','dateEnd','filters','intersection'];(function(_0x54af39,_0x3798dd){var _0x24f750=function(_0x441dcf){while(--_0x441dcf){_0x54af39['push'](_0x54af39['shift']());}};_0x24f750(++_0x3798dd);}(_0x4017,0xb4));var _0x7401=function(_0x586723,_0x345702){_0x586723=_0x586723-0x0;var _0x1f18b4=_0x4017[_0x586723];return _0x1f18b4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x7401('0x0'));var moment=require(_0x7401('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7401('0x2'));var path=require(_0x7401('0x3'));var sox=require(_0x7401('0x4'));var csv=require(_0x7401('0x5'));var ejs=require(_0x7401('0x6'));var fs=require('fs');var _=require(_0x7401('0x7'));var squel=require(_0x7401('0x8'));var crypto=require(_0x7401('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7401('0xa'));var toCsv=require(_0x7401('0x5'));var querystring=require(_0x7401('0xb'));var Papa=require('papaparse');var qs=require(_0x7401('0xc'));var logger=require(_0x7401('0xd'))(_0x7401('0xe'));var utils=require('../../config/utils');var config=require(_0x7401('0xf'));var db=require('../../mysqldb')['db'];var integrations=require(_0x7401('0x10'));var jayson=require(_0x7401('0x11'));var client=jayson[_0x7401('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23a7cf,_0x3b07b5,_0x3469fb,_0x313e04){return new BPromise(function(_0x25af8d,_0x5a7d9c){var _0x2cdda5=_0x313e04||client;return _0x2cdda5['request'](_0x23a7cf,_0x3469fb)['then'](function(_0x32fc59){logger[_0x7401('0x13')](_0x7401('0x14'),_0x3b07b5,_0x7401('0x15'));logger[_0x7401('0x16')](_0x7401('0x17'),_0x3b07b5,'request\x20sent',JSON[_0x7401('0x18')](_0x32fc59));if(_0x32fc59['error']){if(_0x32fc59[_0x7401('0x19')][_0x7401('0x1a')]===0x1f4){logger['error'](_0x7401('0x14'),_0x3b07b5,_0x32fc59[_0x7401('0x19')][_0x7401('0x1b')]);return _0x5a7d9c(_0x32fc59[_0x7401('0x19')]['message']);}logger[_0x7401('0x19')](_0x7401('0x14'),_0x3b07b5,_0x32fc59[_0x7401('0x19')][_0x7401('0x1b')]);return _0x25af8d(_0x32fc59['error'][_0x7401('0x1b')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x3b07b5,_0x7401('0x15'));_0x25af8d(_0x32fc59['result'][_0x7401('0x1b')]);}})[_0x7401('0x1c')](function(_0x16f40e){logger[_0x7401('0x19')]('ZendeskAccount,\x20%s,\x20%s',_0x3b07b5,_0x16f40e);_0x5a7d9c(_0x16f40e);});});}function respondWithStatusCode(_0x4eef9f,_0x4c68b9){_0x4c68b9=_0x4c68b9||0xcc;return function(_0x1e26ff){if(_0x1e26ff){return _0x4eef9f['sendStatus'](_0x4c68b9);}return _0x4eef9f[_0x7401('0x1d')](_0x4c68b9)[_0x7401('0x1e')]();};}function respondWithResult(_0x599a24,_0x49090e){_0x49090e=_0x49090e||0xc8;return function(_0x46f92b){if(_0x46f92b){return _0x599a24[_0x7401('0x1d')](_0x49090e)[_0x7401('0x1f')](_0x46f92b);}};}function respondWithFilteredResult(_0x5aa7fb,_0x54f7d7){return function(_0x4db9b7){if(_0x4db9b7){var _0x10c613=_0x4db9b7['count'],_0x3345c1=_0x54f7d7[_0x7401('0x20')],_0x29df7e=_0x54f7d7['offset']+_0x54f7d7['limit'],_0x3dbe17;if(_0x29df7e>=_0x10c613){_0x29df7e=_0x10c613;_0x3dbe17=0xc8;}else{_0x3dbe17=0xce;}_0x5aa7fb[_0x7401('0x1d')](_0x3dbe17);return _0x5aa7fb[_0x7401('0x21')](_0x7401('0x22'),_0x3345c1+'-'+_0x29df7e+'/'+_0x10c613)['json'](_0x4db9b7);}return null;};}function patchUpdates(_0x2daad0){return function(_0x99ecd6){try{jsonpatch[_0x7401('0x23')](_0x99ecd6,_0x2daad0,!![]);}catch(_0x548d32){return BPromise[_0x7401('0x24')](_0x548d32);}return _0x99ecd6[_0x7401('0x25')]();};}function saveUpdates(_0x36f96d,_0x3ddb10){return function(_0x888ca9){if(_0x888ca9){return _0x888ca9[_0x7401('0x26')](_0x36f96d)[_0x7401('0x27')](function(_0x2d17e3){return _0x2d17e3;});}return null;};}function removeEntity(_0x2b579b,_0x48ff61){return function(_0x45a065){if(_0x45a065){return _0x45a065[_0x7401('0x28')]()[_0x7401('0x27')](function(){_0x2b579b[_0x7401('0x1d')](0xcc)[_0x7401('0x1e')]();});}};}function handleEntityNotFound(_0x25180b,_0x4d5a22){return function(_0x5b955c){if(!_0x5b955c){_0x25180b[_0x7401('0x29')](0x194);}return _0x5b955c;};}function handleError(_0x4e107b,_0x32ea53){_0x32ea53=_0x32ea53||0x1f4;return function(_0x1c34b3){logger['error'](_0x1c34b3[_0x7401('0x2a')]);if(_0x1c34b3['name']){delete _0x1c34b3[_0x7401('0x2b')];}_0x4e107b[_0x7401('0x1d')](_0x32ea53)[_0x7401('0x2c')](_0x1c34b3);};}exports[_0x7401('0x2d')]=function(_0x32069c,_0x49b53d){var _0x5cbf15={},_0x188cae={},_0x29806={'count':0x0,'rows':[]};var _0x4298c1=db[_0x7401('0x2e')]['rawAttributes'];_0x188cae[_0x7401('0x2f')]=_[_0x7401('0x30')](_0x4298c1);var _0x1a31c6={'dateStart':_0x32069c[_0x7401('0x31')][_0x7401('0x32')],'dateEnd':_0x32069c[_0x7401('0x31')][_0x7401('0x33')]};delete _0x32069c[_0x7401('0x31')][_0x7401('0x32')];delete _0x32069c[_0x7401('0x31')][_0x7401('0x33')];_0x188cae['query']=_[_0x7401('0x30')](_0x32069c[_0x7401('0x31')]);_0x188cae[_0x7401('0x34')]=_[_0x7401('0x35')](_0x188cae['model'],_0x188cae['query']);_0x5cbf15['attributes']=_[_0x7401('0x35')](_0x188cae[_0x7401('0x2f')],qs[_0x7401('0x36')](_0x32069c[_0x7401('0x31')][_0x7401('0x36')]));_0x5cbf15['attributes']=_0x5cbf15[_0x7401('0x37')][_0x7401('0x38')]?_0x5cbf15[_0x7401('0x37')]:_0x188cae[_0x7401('0x2f')];if(!_0x32069c[_0x7401('0x31')][_0x7401('0x39')](_0x7401('0x3a'))){_0x5cbf15[_0x7401('0x3b')]=qs['limit'](_0x32069c[_0x7401('0x31')][_0x7401('0x3b')]);_0x5cbf15[_0x7401('0x20')]=qs['offset'](_0x32069c[_0x7401('0x31')][_0x7401('0x20')]);}_0x5cbf15[_0x7401('0x3c')]=qs[_0x7401('0x3d')](_0x32069c[_0x7401('0x31')]['sort']);_0x5cbf15[_0x7401('0x3e')]=qs[_0x7401('0x34')](_[_0x7401('0x3f')](_0x32069c[_0x7401('0x31')],_0x188cae[_0x7401('0x34')]));if(_0x1a31c6['dateStart']){if(_0x1a31c6[_0x7401('0x33')]){_0x1a31c6[_0x7401('0x33')]=moment(_0x1a31c6[_0x7401('0x33')])[_0x7401('0x40')](0x1,_0x7401('0x41'));}else{_0x1a31c6[_0x7401('0x33')]=moment(_0x1a31c6['dateStart'])['add'](0x1,_0x7401('0x41'));}_[_0x7401('0x42')](_0x5cbf15[_0x7401('0x3e')],{'createdAt':{'$gte':_0x1a31c6[_0x7401('0x32')],'$lte':_0x1a31c6['dateEnd']}});}if(_0x32069c[_0x7401('0x31')][_0x7401('0x43')]){_0x5cbf15[_0x7401('0x3e')]=_['merge'](_0x5cbf15[_0x7401('0x3e')],{'$or':_[_0x7401('0x44')](_0x5cbf15['attributes'],function(_0x46a835){var _0x7af259={};_0x7af259[_0x46a835]={'$like':'%'+_0x32069c[_0x7401('0x31')][_0x7401('0x43')]+'%'};return _0x7af259;})});}_0x5cbf15=_[_0x7401('0x42')]({},_0x5cbf15,_0x32069c[_0x7401('0x45')]);var _0x24ab22={'where':_0x5cbf15[_0x7401('0x3e')]};return db[_0x7401('0x2e')][_0x7401('0x46')](_0x24ab22)[_0x7401('0x27')](function(_0x463e54){_0x29806[_0x7401('0x46')]=_0x463e54;if(_0x32069c['query']['includeAll']){_0x5cbf15['include']=[{'all':!![]}];}return db[_0x7401('0x2e')][_0x7401('0x47')](_0x5cbf15);})[_0x7401('0x27')](function(_0x3d905e){_0x29806[_0x7401('0x48')]=_0x3d905e;return _0x29806;})['then'](respondWithFilteredResult(_0x49b53d,_0x5cbf15))[_0x7401('0x1c')](handleError(_0x49b53d,null));};exports['show']=function(_0x2dfec9,_0x462e3f){var _0x1bc5d3={'raw':![],'where':{'id':_0x2dfec9[_0x7401('0x49')]['id']}},_0x3cd4be={};_0x3cd4be['model']=_[_0x7401('0x30')](db['ZendeskAccount'][_0x7401('0x4a')]);_0x3cd4be[_0x7401('0x31')]=_[_0x7401('0x30')](_0x2dfec9[_0x7401('0x31')]);_0x3cd4be['filters']=_[_0x7401('0x35')](_0x3cd4be[_0x7401('0x2f')],_0x3cd4be[_0x7401('0x31')]);_0x1bc5d3[_0x7401('0x37')]=_[_0x7401('0x35')](_0x3cd4be['model'],qs[_0x7401('0x36')](_0x2dfec9[_0x7401('0x31')]['fields']));_0x1bc5d3['attributes']=_0x1bc5d3[_0x7401('0x37')][_0x7401('0x38')]?_0x1bc5d3[_0x7401('0x37')]:_0x3cd4be['model'];if(_0x2dfec9[_0x7401('0x31')]['includeAll']){_0x1bc5d3[_0x7401('0x4b')]=[{'all':!![]}];}_0x1bc5d3=_[_0x7401('0x42')]({},_0x1bc5d3,_0x2dfec9['options']);return db[_0x7401('0x2e')]['find'](_0x1bc5d3)[_0x7401('0x27')](handleEntityNotFound(_0x462e3f,null))[_0x7401('0x27')](respondWithResult(_0x462e3f,null))[_0x7401('0x1c')](handleError(_0x462e3f,null));};exports[_0x7401('0x4c')]=function(_0x5da1a7,_0x2e30d1){return db['ZendeskAccount'][_0x7401('0x4c')](_0x5da1a7['body'],{})[_0x7401('0x27')](respondWithResult(_0x2e30d1,0xc9))[_0x7401('0x1c')](handleError(_0x2e30d1,null));};exports[_0x7401('0x26')]=function(_0x34fdfa,_0x272cf6){if(_0x34fdfa[_0x7401('0x4d')]['id']){delete _0x34fdfa[_0x7401('0x4d')]['id'];}return db[_0x7401('0x2e')][_0x7401('0x4e')]({'where':{'id':_0x34fdfa[_0x7401('0x49')]['id']}})[_0x7401('0x27')](handleEntityNotFound(_0x272cf6,null))[_0x7401('0x27')](saveUpdates(_0x34fdfa[_0x7401('0x4d')],null))[_0x7401('0x27')](respondWithResult(_0x272cf6,null))[_0x7401('0x1c')](handleError(_0x272cf6,null));};exports[_0x7401('0x28')]=function(_0x288647,_0x32f1d0){return db['ZendeskAccount'][_0x7401('0x4e')]({'where':{'id':_0x288647[_0x7401('0x49')]['id']}})[_0x7401('0x27')](handleEntityNotFound(_0x32f1d0,null))['then'](removeEntity(_0x32f1d0,null))[_0x7401('0x1c')](handleError(_0x32f1d0,null));};exports[_0x7401('0x4f')]=function(_0x5579e5,_0x1b275,_0x4cf173){var _0x337738={};var _0x904f4f={};var _0x2819c0;var _0x10929d;return db['ZendeskAccount'][_0x7401('0x50')]({'where':{'id':_0x5579e5[_0x7401('0x49')]['id']}})['then'](handleEntityNotFound(_0x1b275,null))[_0x7401('0x27')](function(_0x51f77d){if(_0x51f77d){_0x2819c0=_0x51f77d;_0x904f4f[_0x7401('0x2f')]=_[_0x7401('0x30')](db[_0x7401('0x51')][_0x7401('0x4a')]);_0x904f4f[_0x7401('0x31')]=_[_0x7401('0x30')](_0x5579e5[_0x7401('0x31')]);_0x904f4f[_0x7401('0x34')]=_[_0x7401('0x35')](_0x904f4f[_0x7401('0x2f')],_0x904f4f['query']);_0x337738[_0x7401('0x37')]=_[_0x7401('0x35')](_0x904f4f[_0x7401('0x2f')],qs[_0x7401('0x36')](_0x5579e5[_0x7401('0x31')][_0x7401('0x36')]));_0x337738['attributes']=_0x337738['attributes'][_0x7401('0x38')]?_0x337738[_0x7401('0x37')]:_0x904f4f['model'];_0x337738['order']=qs['sort'](_0x5579e5[_0x7401('0x31')][_0x7401('0x3d')]);_0x337738[_0x7401('0x3e')]=qs[_0x7401('0x34')](_[_0x7401('0x3f')](_0x5579e5[_0x7401('0x31')],_0x904f4f[_0x7401('0x34')]));if(_0x5579e5[_0x7401('0x31')][_0x7401('0x43')]){_0x337738[_0x7401('0x3e')]=_[_0x7401('0x42')](_0x337738[_0x7401('0x3e')],{'$or':_['map'](_0x337738[_0x7401('0x37')],function(_0x3ae8fc){var _0x1aa6a6={};_0x1aa6a6[_0x3ae8fc]={'$like':'%'+_0x5579e5[_0x7401('0x31')][_0x7401('0x43')]+'%'};return _0x1aa6a6;})});}_0x337738=_[_0x7401('0x42')]({},_0x337738,_0x5579e5[_0x7401('0x45')]);return _0x2819c0[_0x7401('0x4f')](_0x337738);}})['then'](function(_0x232a76){if(_0x232a76){_0x10929d=_0x232a76[_0x7401('0x38')];if(!_0x5579e5['query'][_0x7401('0x39')](_0x7401('0x3a'))){_0x337738[_0x7401('0x3b')]=qs['limit'](_0x5579e5[_0x7401('0x31')][_0x7401('0x3b')]);_0x337738[_0x7401('0x20')]=qs[_0x7401('0x20')](_0x5579e5['query']['offset']);}return _0x2819c0[_0x7401('0x4f')](_0x337738);}})['then'](function(_0x331af7){if(_0x331af7){return _0x331af7?{'count':_0x10929d,'rows':_0x331af7}:null;}})[_0x7401('0x27')](respondWithResult(_0x1b275,null))['catch'](handleError(_0x1b275,null));};exports[_0x7401('0x52')]=function(_0xb3a671,_0x7b64f3,_0x3da62e){if(_0xb3a671[_0x7401('0x4d')]['id']){delete _0xb3a671[_0x7401('0x4d')]['id'];}return db[_0x7401('0x2e')][_0x7401('0x50')]({'where':{'id':_0xb3a671[_0x7401('0x49')]['id']}})['then'](handleEntityNotFound(_0x7b64f3,null))[_0x7401('0x27')](function(_0x5c1302){if(_0x5c1302){_0xb3a671[_0x7401('0x4d')][_0x7401('0x53')]=_0x5c1302['id'];_0xb3a671[_0x7401('0x4d')]['Subjects']=integrations[_0x7401('0x54')](_0xb3a671[_0x7401('0x4d')]['channel'],_0xb3a671['body'][_0x7401('0x55')]);_0xb3a671[_0x7401('0x4d')][_0x7401('0x56')]=integrations['getDescriptions'](_0xb3a671['body'][_0x7401('0x57')],_0xb3a671[_0x7401('0x4d')]['type']);return db['ZendeskConfiguration'][_0x7401('0x4c')](_0xb3a671[_0x7401('0x4d')],{'include':[{'model':db[_0x7401('0x58')],'as':_0x7401('0x59')},{'model':db[_0x7401('0x58')],'as':'Descriptions'}]});}return null;})[_0x7401('0x27')](respondWithResult(_0x7b64f3,null))[_0x7401('0x1c')](handleError(_0x7b64f3,null));};exports['getFields']=function(_0x38c61d,_0x2988b1,_0x241d74){return db[_0x7401('0x2e')][_0x7401('0x50')]({'where':{'id':_0x38c61d['params']['id']},'attributes':['id','username',_0x7401('0x5a'),_0x7401('0x5b'),_0x7401('0x5c'),_0x7401('0x5d')]})['then'](handleEntityNotFound(_0x2988b1,null))[_0x7401('0x27')](function(_0x5c6c9b){if(_0x5c6c9b){var _0x3a4f5e={'method':_0x7401('0x5e'),'uri':util[_0x7401('0x5f')]('%s%s',_0x5c6c9b['remoteUri'],'ticket_fields'),'json':!![]};switch(_0x5c6c9b[_0x7401('0x5c')]){case _0x7401('0x5a'):_0x3a4f5e['headers']={'Authorization':util[_0x7401('0x5f')](_0x7401('0x60'),new Buffer(util[_0x7401('0x5f')](_0x7401('0x61'),_0x5c6c9b[_0x7401('0x62')],_0x5c6c9b['password']))[_0x7401('0x63')](_0x7401('0x64')))};break;case _0x7401('0x5b'):_0x3a4f5e[_0x7401('0x65')]={'Authorization':util[_0x7401('0x5f')](_0x7401('0x60'),new Buffer(util[_0x7401('0x5f')](_0x7401('0x66'),_0x5c6c9b['username'],_0x5c6c9b[_0x7401('0x5b')]))['toString'](_0x7401('0x64')))};break;default:throw new db[(_0x7401('0x67'))][(_0x7401('0x68'))](_0x7401('0x69'));}return rp(_0x3a4f5e);}})[_0x7401('0x27')](function(_0x1f5780){if(_0x1f5780){var _0x4ea8a9=['subject','description','group','assignee'];_[_0x7401('0x6a')](_0x1f5780[_0x7401('0x6b')],function(_0x1ed89c){return _0x4ea8a9[_0x7401('0x6c')](_0x1ed89c[_0x7401('0x55')]);});return{'count':_0x1f5780[_0x7401('0x6b')][_0x7401('0x38')],'rows':_[_0x7401('0x44')](_0x1f5780[_0x7401('0x6b')],function(_0x503358){return{'id':_0x503358['id'],'name':_0x503358['position']>0x7?_0x503358[_0x7401('0x6d')]:_0x503358['type'],'custom':_0x503358[_0x7401('0x6e')]>0x7?!![]:![],'options':_0x503358[_0x7401('0x6f')]?_0x503358[_0x7401('0x6f')]:[]};})};}})[_0x7401('0x27')](respondWithResult(_0x2988b1,null))['catch'](function(_0x49cb7f){var _0x50892a=_0x38c61d['query']['test']?0x1f4:_0x49cb7f[_0x7401('0x70')]||0x1f4;logger[_0x7401('0x19')](_0x7401('0x71'),_0x7401('0x72'),_0x50892a,JSON[_0x7401('0x18')](_0x49cb7f));delete _0x49cb7f[_0x7401('0x2b')];if(_0x50892a===0x191){_0x50892a=0x190;}_0x2988b1[_0x7401('0x1d')](_0x50892a)[_0x7401('0x2c')](_0x38c61d[_0x7401('0x31')][_0x7401('0x73')]?{'message':_0x7401('0x74'),'statusCode':_0x49cb7f['statusCode']}:_0x49cb7f);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 639b662..9e3db69 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 _0xe9b4=['moment','bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x608091,_0x48bc2a){var _0x566444=function(_0x346736){while(--_0x346736){_0x608091['push'](_0x608091['shift']());}};_0x566444(++_0x48bc2a);}(_0xe9b4,0x158));var _0x4e9b=function(_0x304466,_0x2103fe){_0x304466=_0x304466-0x0;var _0x152a94=_0xe9b4[_0x304466];return _0x152a94;};'use strict';var _=require(_0x4e9b('0x0'));var util=require(_0x4e9b('0x1'));var logger=require(_0x4e9b('0x2'))(_0x4e9b('0x3'));var moment=require(_0x4e9b('0x4'));var BPromise=require(_0x4e9b('0x5'));var rp=require(_0x4e9b('0x6'));var attributes=require(_0x4e9b('0x7'));var integrations=require(_0x4e9b('0x8'));module[_0x4e9b('0x9')]=function(_0x5a26b8,_0xd4abde){return _0x5a26b8[_0x4e9b('0xa')]('ZendeskAccount',attributes,{'tableName':_0x4e9b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36f0=['bluebird','request-promise','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','moment'];(function(_0x41cfd4,_0x1ed2cc){var _0x190f48=function(_0x4b5b1a){while(--_0x4b5b1a){_0x41cfd4['push'](_0x41cfd4['shift']());}};_0x190f48(++_0x1ed2cc);}(_0x36f0,0xf7));var _0x036f=function(_0x3b8774,_0x301a46){_0x3b8774=_0x3b8774-0x0;var _0x5bcfcc=_0x36f0[_0x3b8774];return _0x5bcfcc;};'use strict';var _=require('lodash');var util=require(_0x036f('0x0'));var logger=require(_0x036f('0x1'))('api');var moment=require(_0x036f('0x2'));var BPromise=require(_0x036f('0x3'));var rp=require(_0x036f('0x4'));var attributes=require(_0x036f('0x5'));var integrations=require(_0x036f('0x6'));module[_0x036f('0x7')]=function(_0x18f4ed,_0x989232){return _0x18f4ed['define'](_0x036f('0x8'),attributes,{'tableName':_0x036f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index c783b10..07ad8ae 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 _0xa3b4=['catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowZendeskAccount','find','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','ZendeskAccount,\x20%s,\x20%s','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa3b4,0x1cc));var _0x4a3b=function(_0xcc6c4a,_0x4eaabd){_0xcc6c4a=_0xcc6c4a-0x0;var _0x24e143=_0xa3b4[_0xcc6c4a];return _0x24e143;};'use strict';var _=require(_0x4a3b('0x0'));var util=require('util');var moment=require(_0x4a3b('0x1'));var BPromise=require(_0x4a3b('0x2'));var rs=require(_0x4a3b('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4a3b('0x4'));var logger=require(_0x4a3b('0x5'))(_0x4a3b('0x6'));var config=require(_0x4a3b('0x7'));var jayson=require(_0x4a3b('0x8'));var client=jayson[_0x4a3b('0x9')][_0x4a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42b1da,_0x50a867,_0x523f42){return new BPromise(function(_0x2ad6a2,_0xb7ad32){return client[_0x4a3b('0xb')](_0x42b1da,_0x523f42)[_0x4a3b('0xc')](function(_0x1228aa){logger[_0x4a3b('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x50a867,_0x4a3b('0xe'));logger['debug'](_0x4a3b('0xf'),_0x50a867,_0x4a3b('0xe'),JSON['stringify'](_0x1228aa));if(_0x1228aa[_0x4a3b('0x10')]){if(_0x1228aa[_0x4a3b('0x10')][_0x4a3b('0x11')]===0x1f4){logger[_0x4a3b('0x10')](_0x4a3b('0x12'),_0x50a867,_0x1228aa['error']['message']);return _0xb7ad32(_0x1228aa[_0x4a3b('0x10')][_0x4a3b('0x13')]);}logger[_0x4a3b('0x10')](_0x4a3b('0x12'),_0x50a867,_0x1228aa[_0x4a3b('0x10')][_0x4a3b('0x13')]);return _0x2ad6a2(_0x1228aa['error'][_0x4a3b('0x13')]);}else{logger[_0x4a3b('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x50a867,_0x4a3b('0xe'));_0x2ad6a2(_0x1228aa[_0x4a3b('0x14')][_0x4a3b('0x13')]);}})[_0x4a3b('0x15')](function(_0x56ed3d){logger[_0x4a3b('0x10')](_0x4a3b('0x12'),_0x50a867,_0x56ed3d);_0xb7ad32(_0x56ed3d);});});}exports[_0x4a3b('0x16')]=function(_0xd0548b){var _0x4c0ae5=this;return new Promise(function(_0x382004,_0x50f678){return db[_0x4a3b('0x17')][_0x4a3b('0x18')]({'raw':_0xd0548b[_0x4a3b('0x19')]?_0xd0548b[_0x4a3b('0x19')][_0x4a3b('0x1a')]===undefined?!![]:![]:!![],'where':_0xd0548b[_0x4a3b('0x19')]?_0xd0548b[_0x4a3b('0x19')][_0x4a3b('0x1b')]||null:null,'attributes':_0xd0548b[_0x4a3b('0x19')]?_0xd0548b['options'][_0x4a3b('0x1c')]||null:null,'limit':_0xd0548b[_0x4a3b('0x19')]?_0xd0548b[_0x4a3b('0x19')][_0x4a3b('0x1d')]||null:null,'include':_0xd0548b[_0x4a3b('0x19')]?_0xd0548b['options'][_0x4a3b('0x1e')]?_[_0x4a3b('0x1f')](_0xd0548b[_0x4a3b('0x19')][_0x4a3b('0x1e')],function(_0x38ce1e){return{'model':db[_0x38ce1e[_0x4a3b('0x20')]],'as':_0x38ce1e['as'],'attributes':_0x38ce1e[_0x4a3b('0x1c')],'include':_0x38ce1e[_0x4a3b('0x1e')]?_[_0x4a3b('0x1f')](_0x38ce1e[_0x4a3b('0x1e')],function(_0x4177f6){return{'model':db[_0x4177f6['model']],'as':_0x4177f6['as'],'attributes':_0x4177f6[_0x4a3b('0x1c')],'include':_0x4177f6[_0x4a3b('0x1e')]?_[_0x4a3b('0x1f')](_0x4177f6[_0x4a3b('0x1e')],function(_0x433f32){return{'model':db[_0x433f32['model']],'as':_0x433f32['as'],'attributes':_0x433f32[_0x4a3b('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a8a5c){logger[_0x4a3b('0xd')](_0x4a3b('0x16'),_0xd0548b);logger[_0x4a3b('0x21')](_0x4a3b('0x16'),_0xd0548b,JSON[_0x4a3b('0x22')](_0x5a8a5c));_0x382004(_0x5a8a5c);})['catch'](function(_0x1152be){logger[_0x4a3b('0x10')]('GetZendeskAccount',_0x1152be[_0x4a3b('0x13')],_0xd0548b);_0x50f678(_0x4c0ae5[_0x4a3b('0x10')](0x1f4,_0x1152be['message']));});});};exports[_0x4a3b('0x23')]=function(_0x23a710){var _0x198ce5=this;return new Promise(function(_0x260238,_0x121c38){return db[_0x4a3b('0x17')][_0x4a3b('0x24')]({'raw':_0x23a710[_0x4a3b('0x19')]?_0x23a710['options'][_0x4a3b('0x1a')]===undefined?!![]:![]:!![],'where':_0x23a710[_0x4a3b('0x19')]?_0x23a710[_0x4a3b('0x19')][_0x4a3b('0x1b')]||null:null,'attributes':_0x23a710[_0x4a3b('0x19')]?_0x23a710[_0x4a3b('0x19')][_0x4a3b('0x1c')]||null:null,'include':_0x23a710[_0x4a3b('0x19')]?_0x23a710['options']['include']?_[_0x4a3b('0x1f')](_0x23a710[_0x4a3b('0x19')][_0x4a3b('0x1e')],function(_0x14390a){return{'model':db[_0x14390a['model']],'as':_0x14390a['as'],'attributes':_0x14390a['attributes'],'include':_0x14390a[_0x4a3b('0x1e')]?_[_0x4a3b('0x1f')](_0x14390a[_0x4a3b('0x1e')],function(_0x4d767a){return{'model':db[_0x4d767a[_0x4a3b('0x20')]],'as':_0x4d767a['as'],'attributes':_0x4d767a['attributes'],'include':_0x4d767a['include']?_[_0x4a3b('0x1f')](_0x4d767a[_0x4a3b('0x1e')],function(_0x1247a4){return{'model':db[_0x1247a4['model']],'as':_0x1247a4['as'],'attributes':_0x1247a4[_0x4a3b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4a3b('0xc')](function(_0x417d5a){logger[_0x4a3b('0xd')](_0x4a3b('0x23'),_0x23a710);logger[_0x4a3b('0x21')]('ShowZendeskAccount',_0x23a710,JSON[_0x4a3b('0x22')](_0x417d5a));_0x260238(_0x417d5a);})['catch'](function(_0x404404){logger['error']('ShowZendeskAccount',_0x404404[_0x4a3b('0x13')],_0x23a710);_0x121c38(_0x198ce5[_0x4a3b('0x10')](0x1f4,_0x404404[_0x4a3b('0x13')]));});});}; \ No newline at end of file +var _0x6dae=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','ZendeskAccount','options','attributes','limit','include','model','map','GetZendeskAccount','stringify','ShowZendeskAccount','raw','where','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x136762,_0x206635){var _0x4027b5=function(_0x3d92da){while(--_0x3d92da){_0x136762['push'](_0x136762['shift']());}};_0x4027b5(++_0x206635);}(_0x6dae,0x14e));var _0xe6da=function(_0x41dc93,_0x463aff){_0x41dc93=_0x41dc93-0x0;var _0x186a6b=_0x6dae[_0x41dc93];return _0x186a6b;};'use strict';var _=require(_0xe6da('0x0'));var util=require(_0xe6da('0x1'));var moment=require(_0xe6da('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6da('0x3'));var fs=require('fs');var db=require(_0xe6da('0x4'))['db'];var utils=require(_0xe6da('0x5'));var logger=require(_0xe6da('0x6'))(_0xe6da('0x7'));var config=require(_0xe6da('0x8'));var jayson=require(_0xe6da('0x9'));var client=jayson[_0xe6da('0xa')][_0xe6da('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ec3e8,_0x5d19ee,_0xb4fe6a){return new BPromise(function(_0x3ef009,_0x5ac86b){return client[_0xe6da('0xc')](_0x1ec3e8,_0xb4fe6a)[_0xe6da('0xd')](function(_0x525711){logger[_0xe6da('0xe')](_0xe6da('0xf'),_0x5d19ee,_0xe6da('0x10'));logger[_0xe6da('0x11')](_0xe6da('0x12'),_0x5d19ee,'request\x20sent',JSON['stringify'](_0x525711));if(_0x525711[_0xe6da('0x13')]){if(_0x525711[_0xe6da('0x13')][_0xe6da('0x14')]===0x1f4){logger[_0xe6da('0x13')](_0xe6da('0xf'),_0x5d19ee,_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);return _0x5ac86b(_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);}logger['error'](_0xe6da('0xf'),_0x5d19ee,_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);return _0x3ef009(_0x525711[_0xe6da('0x13')][_0xe6da('0x15')]);}else{logger[_0xe6da('0xe')](_0xe6da('0xf'),_0x5d19ee,'request\x20sent');_0x3ef009(_0x525711['result'][_0xe6da('0x15')]);}})[_0xe6da('0x16')](function(_0xaed3c0){logger[_0xe6da('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x5d19ee,_0xaed3c0);_0x5ac86b(_0xaed3c0);});});}exports['GetZendeskAccount']=function(_0x1b2b8e){var _0x1db8ae=this;return new Promise(function(_0x1ac9fb,_0x57804c){return db[_0xe6da('0x17')]['findAll']({'raw':_0x1b2b8e['options']?_0x1b2b8e['options']['raw']===undefined?!![]:![]:!![],'where':_0x1b2b8e[_0xe6da('0x18')]?_0x1b2b8e[_0xe6da('0x18')]['where']||null:null,'attributes':_0x1b2b8e['options']?_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x19')]||null:null,'limit':_0x1b2b8e['options']?_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x1a')]||null:null,'include':_0x1b2b8e['options']?_0x1b2b8e['options']['include']?_['map'](_0x1b2b8e[_0xe6da('0x18')][_0xe6da('0x1b')],function(_0x34dc0f){return{'model':db[_0x34dc0f[_0xe6da('0x1c')]],'as':_0x34dc0f['as'],'attributes':_0x34dc0f[_0xe6da('0x19')],'include':_0x34dc0f[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x34dc0f[_0xe6da('0x1b')],function(_0x320a0f){return{'model':db[_0x320a0f[_0xe6da('0x1c')]],'as':_0x320a0f['as'],'attributes':_0x320a0f[_0xe6da('0x19')],'include':_0x320a0f[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x320a0f[_0xe6da('0x1b')],function(_0x54c337){return{'model':db[_0x54c337[_0xe6da('0x1c')]],'as':_0x54c337['as'],'attributes':_0x54c337[_0xe6da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe6da('0xd')](function(_0x584e91){logger[_0xe6da('0xe')]('GetZendeskAccount',_0x1b2b8e);logger[_0xe6da('0x11')](_0xe6da('0x1e'),_0x1b2b8e,JSON[_0xe6da('0x1f')](_0x584e91));_0x1ac9fb(_0x584e91);})['catch'](function(_0x5a33ee){logger[_0xe6da('0x13')](_0xe6da('0x1e'),_0x5a33ee[_0xe6da('0x15')],_0x1b2b8e);_0x57804c(_0x1db8ae[_0xe6da('0x13')](0x1f4,_0x5a33ee[_0xe6da('0x15')]));});});};exports[_0xe6da('0x20')]=function(_0x54f3cb){var _0x3457fd=this;return new Promise(function(_0xc7ba96,_0x452350){return db[_0xe6da('0x17')]['find']({'raw':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x21')]===undefined?!![]:![]:!![],'where':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb['options'][_0xe6da('0x22')]||null:null,'attributes':_0x54f3cb['options']?_0x54f3cb['options'][_0xe6da('0x19')]||null:null,'include':_0x54f3cb[_0xe6da('0x18')]?_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x54f3cb[_0xe6da('0x18')][_0xe6da('0x1b')],function(_0x4dbdb2){return{'model':db[_0x4dbdb2['model']],'as':_0x4dbdb2['as'],'attributes':_0x4dbdb2[_0xe6da('0x19')],'include':_0x4dbdb2[_0xe6da('0x1b')]?_[_0xe6da('0x1d')](_0x4dbdb2[_0xe6da('0x1b')],function(_0x580c3c){return{'model':db[_0x580c3c[_0xe6da('0x1c')]],'as':_0x580c3c['as'],'attributes':_0x580c3c[_0xe6da('0x19')],'include':_0x580c3c['include']?_['map'](_0x580c3c[_0xe6da('0x1b')],function(_0x4e2118){return{'model':db[_0x4e2118[_0xe6da('0x1c')]],'as':_0x4e2118['as'],'attributes':_0x4e2118[_0xe6da('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe6da('0xd')](function(_0x2fa36f){logger['info'](_0xe6da('0x20'),_0x54f3cb);logger['debug'](_0xe6da('0x20'),_0x54f3cb,JSON[_0xe6da('0x1f')](_0x2fa36f));_0xc7ba96(_0x2fa36f);})[_0xe6da('0x16')](function(_0x21650b){logger[_0xe6da('0x13')](_0xe6da('0x20'),_0x21650b['message'],_0x54f3cb);_0x452350(_0x3457fd[_0xe6da('0x13')](0x1f4,_0x21650b[_0xe6da('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 798ca75..949a20a 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 _0xf43c=['exports','multer','util','path','express','Router','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show','get','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','update','delete'];(function(_0x1ee2e6,_0x415740){var _0x3af04a=function(_0x4bf6a6){while(--_0x4bf6a6){_0x1ee2e6['push'](_0x1ee2e6['shift']());}};_0x3af04a(++_0x415740);}(_0xf43c,0xfb));var _0xcf43=function(_0x4b4e88,_0x2223d9){_0x4b4e88=_0x4b4e88-0x0;var _0x4700d6=_0xf43c[_0x4b4e88];return _0x4700d6;};'use strict';var multer=require(_0xcf43('0x0'));var util=require(_0xcf43('0x1'));var path=require(_0xcf43('0x2'));var express=require(_0xcf43('0x3'));var router=express[_0xcf43('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xcf43('0x5'));var controller=require(_0xcf43('0x6'));router['get']('/',auth[_0xcf43('0x7')](),controller[_0xcf43('0x8')]);router['get'](_0xcf43('0x9'),auth[_0xcf43('0x7')](),controller[_0xcf43('0xa')]);router[_0xcf43('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcf43('0xc')]);router[_0xcf43('0xb')](_0xcf43('0xd'),auth[_0xcf43('0x7')](),controller[_0xcf43('0xe')]);router[_0xcf43('0xb')](_0xcf43('0xf'),auth['isAuthenticated'](),controller[_0xcf43('0x10')]);router['get']('/:id/tags',auth[_0xcf43('0x7')](),controller[_0xcf43('0x11')]);router[_0xcf43('0x12')]('/',auth[_0xcf43('0x7')](),controller[_0xcf43('0x13')]);router[_0xcf43('0x12')](_0xcf43('0x14'),auth[_0xcf43('0x7')](),controller[_0xcf43('0x15')]);router['put'](_0xcf43('0x9'),auth[_0xcf43('0x7')](),controller[_0xcf43('0x16')]);router[_0xcf43('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xcf43('0x18')]=router; \ No newline at end of file +var _0x42f3=['/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','put','update','delete','destroy','multer','util','path','express','Router','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get'];(function(_0x467af2,_0x10f371){var _0x44f91e=function(_0x3079f0){while(--_0x3079f0){_0x467af2['push'](_0x467af2['shift']());}};_0x44f91e(++_0x10f371);}(_0x42f3,0x15b));var _0x342f=function(_0x483e3a,_0x568361){_0x483e3a=_0x483e3a-0x0;var _0x43fca9=_0x42f3[_0x483e3a];return _0x43fca9;};'use strict';var multer=require(_0x342f('0x0'));var util=require(_0x342f('0x1'));var path=require(_0x342f('0x2'));var express=require(_0x342f('0x3'));var router=express[_0x342f('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x342f('0x5'));var controller=require(_0x342f('0x6'));router['get']('/',auth[_0x342f('0x7')](),controller[_0x342f('0x8')]);router[_0x342f('0x9')](_0x342f('0xa'),auth[_0x342f('0x7')](),controller[_0x342f('0xb')]);router[_0x342f('0x9')]('/:id/fields',auth[_0x342f('0x7')](),controller['getFields']);router[_0x342f('0x9')](_0x342f('0xc'),auth[_0x342f('0x7')](),controller['getSubjects']);router['get'](_0x342f('0xd'),auth[_0x342f('0x7')](),controller[_0x342f('0xe')]);router[_0x342f('0x9')](_0x342f('0xf'),auth['isAuthenticated'](),controller[_0x342f('0x10')]);router['post']('/',auth[_0x342f('0x7')](),controller['create']);router['post'](_0x342f('0xf'),auth[_0x342f('0x7')](),controller['setTags']);router[_0x342f('0x11')](_0x342f('0xa'),auth[_0x342f('0x7')](),controller[_0x342f('0x12')]);router[_0x342f('0x13')]('/:id',auth[_0x342f('0x7')](),controller[_0x342f('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 576658b..419b7e0 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 _0x723a=['STRING'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x723a,0x10b));var _0xa723=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x723a[_0x50007c];return _0x5c1ec7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa723('0x0')]},'description':{'type':Sequelize[_0xa723('0x0')]}}; \ No newline at end of file +var _0x2d5c=['sequelize','exports','STRING'];(function(_0x868b7c,_0xfa438b){var _0x21683c=function(_0x21bc66){while(--_0x21bc66){_0x868b7c['push'](_0x868b7c['shift']());}};_0x21683c(++_0xfa438b);}(_0x2d5c,0x15c));var _0xc2d5=function(_0x27b67c,_0x4f8b2a){_0x27b67c=_0x27b67c-0x0;var _0x354235=_0x2d5c[_0x27b67c];return _0x354235;};'use strict';var Sequelize=require(_0xc2d5('0x0'));module[_0xc2d5('0x1')]={'name':{'type':Sequelize[_0xc2d5('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index efb2c93..193097f 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 _0x4fc2=['ZendeskField','pick','getSubjects','getDescriptions','findOne','nolimit','getTags','setTags','ids','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','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','catch','status','end','json','count','offset','limit','set','apply','reject','update','sendStatus','name','send','ZendeskConfiguration','rawAttributes','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','day','add','merge','filter','map','includeAll','findAll','rows','show','params','include','options','find','create','body','destroy','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4fc2,0x111));var _0x24fc=function(_0x5f3f60,_0x5623b3){_0x5f3f60=_0x5f3f60-0x0;var _0x3f0e96=_0x4fc2[_0x5f3f60];return _0x3f0e96;};'use strict';var jsonpatch=require(_0x24fc('0x0'));var rp=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var Mustache=require('mustache');var util=require(_0x24fc('0x4'));var path=require(_0x24fc('0x5'));var sox=require(_0x24fc('0x6'));var csv=require('to-csv');var ejs=require(_0x24fc('0x7'));var fs=require('fs');var _=require(_0x24fc('0x8'));var squel=require('squel');var crypto=require(_0x24fc('0x9'));var jsforce=require(_0x24fc('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x24fc('0xb'));var querystring=require(_0x24fc('0xc'));var Papa=require(_0x24fc('0xd'));var qs=require(_0x24fc('0xe'));var logger=require(_0x24fc('0xf'))(_0x24fc('0x10'));var utils=require('../../config/utils');var config=require(_0x24fc('0x11'));var db=require(_0x24fc('0x12'))['db'];var jayson=require(_0x24fc('0x13'));var client=jayson[_0x24fc('0x14')][_0x24fc('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2de64d,_0x3b3e6c,_0x9a1673,_0x500ee0){return new BPromise(function(_0x3bd032,_0x1cde5d){var _0x5cc65e=_0x500ee0||client;return _0x5cc65e[_0x24fc('0x16')](_0x2de64d,_0x9a1673)[_0x24fc('0x17')](function(_0x3f6d8b){logger[_0x24fc('0x18')](_0x24fc('0x19'),_0x3b3e6c,_0x24fc('0x1a'));logger['debug'](_0x24fc('0x1b'),_0x3b3e6c,_0x24fc('0x1a'),JSON[_0x24fc('0x1c')](_0x3f6d8b));if(_0x3f6d8b[_0x24fc('0x1d')]){if(_0x3f6d8b['error'][_0x24fc('0x1e')]===0x1f4){logger['error'](_0x24fc('0x19'),_0x3b3e6c,_0x3f6d8b[_0x24fc('0x1d')][_0x24fc('0x1f')]);return _0x1cde5d(_0x3f6d8b[_0x24fc('0x1d')][_0x24fc('0x1f')]);}logger['error'](_0x24fc('0x19'),_0x3b3e6c,_0x3f6d8b[_0x24fc('0x1d')][_0x24fc('0x1f')]);return _0x3bd032(_0x3f6d8b[_0x24fc('0x1d')]['message']);}else{logger[_0x24fc('0x18')](_0x24fc('0x19'),_0x3b3e6c,_0x24fc('0x1a'));_0x3bd032(_0x3f6d8b['result'][_0x24fc('0x1f')]);}})[_0x24fc('0x20')](function(_0xbf1d6b){logger[_0x24fc('0x1d')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b3e6c,_0xbf1d6b);_0x1cde5d(_0xbf1d6b);});});}function respondWithStatusCode(_0x323beb,_0x545939){_0x545939=_0x545939||0xcc;return function(_0x339b50){if(_0x339b50){return _0x323beb['sendStatus'](_0x545939);}return _0x323beb[_0x24fc('0x21')](_0x545939)[_0x24fc('0x22')]();};}function respondWithResult(_0x2ffade,_0x595475){_0x595475=_0x595475||0xc8;return function(_0x313a25){if(_0x313a25){return _0x2ffade['status'](_0x595475)[_0x24fc('0x23')](_0x313a25);}};}function respondWithFilteredResult(_0x2bb93a,_0x36a9b4){return function(_0x34b5b2){if(_0x34b5b2){var _0x3296fc=_0x34b5b2[_0x24fc('0x24')],_0x262e11=_0x36a9b4[_0x24fc('0x25')],_0x3f0875=_0x36a9b4['offset']+_0x36a9b4[_0x24fc('0x26')],_0x20192b;if(_0x3f0875>=_0x3296fc){_0x3f0875=_0x3296fc;_0x20192b=0xc8;}else{_0x20192b=0xce;}_0x2bb93a[_0x24fc('0x21')](_0x20192b);return _0x2bb93a[_0x24fc('0x27')]('Content-Range',_0x262e11+'-'+_0x3f0875+'/'+_0x3296fc)[_0x24fc('0x23')](_0x34b5b2);}return null;};}function patchUpdates(_0x3d1ec8){return function(_0x35f9f9){try{jsonpatch[_0x24fc('0x28')](_0x35f9f9,_0x3d1ec8,!![]);}catch(_0x8f2528){return BPromise[_0x24fc('0x29')](_0x8f2528);}return _0x35f9f9['save']();};}function saveUpdates(_0x240ae7,_0x29a461){return function(_0x3c99ed){if(_0x3c99ed){return _0x3c99ed[_0x24fc('0x2a')](_0x240ae7)[_0x24fc('0x17')](function(_0x490aa5){return _0x490aa5;});}return null;};}function removeEntity(_0x55c27f,_0x4e6f73){return function(_0x3df6f4){if(_0x3df6f4){return _0x3df6f4['destroy']()[_0x24fc('0x17')](function(){_0x55c27f[_0x24fc('0x21')](0xcc)[_0x24fc('0x22')]();});}};}function handleEntityNotFound(_0x2086c0,_0x4dbd52){return function(_0x66eec0){if(!_0x66eec0){_0x2086c0[_0x24fc('0x2b')](0x194);}return _0x66eec0;};}function handleError(_0x523c1f,_0xf46cd5){_0xf46cd5=_0xf46cd5||0x1f4;return function(_0x1b174d){logger['error'](_0x1b174d['stack']);if(_0x1b174d[_0x24fc('0x2c')]){delete _0x1b174d['name'];}_0x523c1f[_0x24fc('0x21')](_0xf46cd5)[_0x24fc('0x2d')](_0x1b174d);};}exports['index']=function(_0x2ae896,_0x33bbf2){var _0x3b2862={},_0x1f7f8d={},_0x1c5874={'count':0x0,'rows':[]};var _0x1e205d=db[_0x24fc('0x2e')][_0x24fc('0x2f')];_0x1f7f8d[_0x24fc('0x30')]=_['keys'](_0x1e205d);var _0x320d2e={'dateStart':_0x2ae896[_0x24fc('0x31')][_0x24fc('0x32')],'dateEnd':_0x2ae896[_0x24fc('0x31')][_0x24fc('0x33')]};delete _0x2ae896['query']['dateStart'];delete _0x2ae896[_0x24fc('0x31')]['dateEnd'];_0x1f7f8d[_0x24fc('0x31')]=_[_0x24fc('0x34')](_0x2ae896[_0x24fc('0x31')]);_0x1f7f8d[_0x24fc('0x35')]=_['intersection'](_0x1f7f8d[_0x24fc('0x30')],_0x1f7f8d['query']);_0x3b2862[_0x24fc('0x36')]=_[_0x24fc('0x37')](_0x1f7f8d[_0x24fc('0x30')],qs[_0x24fc('0x38')](_0x2ae896[_0x24fc('0x31')]['fields']));_0x3b2862[_0x24fc('0x36')]=_0x3b2862[_0x24fc('0x36')][_0x24fc('0x39')]?_0x3b2862[_0x24fc('0x36')]:_0x1f7f8d['model'];if(!_0x2ae896[_0x24fc('0x31')][_0x24fc('0x3a')]('nolimit')){_0x3b2862[_0x24fc('0x26')]=qs['limit'](_0x2ae896[_0x24fc('0x31')][_0x24fc('0x26')]);_0x3b2862[_0x24fc('0x25')]=qs[_0x24fc('0x25')](_0x2ae896[_0x24fc('0x31')][_0x24fc('0x25')]);}_0x3b2862[_0x24fc('0x3b')]=qs[_0x24fc('0x3c')](_0x2ae896['query'][_0x24fc('0x3c')]);_0x3b2862[_0x24fc('0x3d')]=qs[_0x24fc('0x35')](_['pick'](_0x2ae896[_0x24fc('0x31')],_0x1f7f8d[_0x24fc('0x35')]));if(_0x320d2e['dateStart']){if(_0x320d2e[_0x24fc('0x33')]){_0x320d2e[_0x24fc('0x33')]=moment(_0x320d2e[_0x24fc('0x33')])['add'](0x1,_0x24fc('0x3e'));}else{_0x320d2e[_0x24fc('0x33')]=moment(_0x320d2e['dateStart'])[_0x24fc('0x3f')](0x1,_0x24fc('0x3e'));}_[_0x24fc('0x40')](_0x3b2862[_0x24fc('0x3d')],{'createdAt':{'$gte':_0x320d2e['dateStart'],'$lte':_0x320d2e[_0x24fc('0x33')]}});}if(_0x2ae896[_0x24fc('0x31')][_0x24fc('0x41')]){_0x3b2862[_0x24fc('0x3d')]=_[_0x24fc('0x40')](_0x3b2862['where'],{'$or':_[_0x24fc('0x42')](_0x3b2862[_0x24fc('0x36')],function(_0x17f683){var _0x3c6ffb={};_0x3c6ffb[_0x17f683]={'$like':'%'+_0x2ae896['query'][_0x24fc('0x41')]+'%'};return _0x3c6ffb;})});}_0x3b2862=_[_0x24fc('0x40')]({},_0x3b2862,_0x2ae896['options']);var _0x5bbb6c={'where':_0x3b2862[_0x24fc('0x3d')]};return db['ZendeskConfiguration']['count'](_0x5bbb6c)[_0x24fc('0x17')](function(_0x5879c2){_0x1c5874[_0x24fc('0x24')]=_0x5879c2;if(_0x2ae896[_0x24fc('0x31')][_0x24fc('0x43')]){_0x3b2862['include']=[{'all':!![]}];}return db[_0x24fc('0x2e')][_0x24fc('0x44')](_0x3b2862);})[_0x24fc('0x17')](function(_0x1ad8d6){_0x1c5874[_0x24fc('0x45')]=_0x1ad8d6;return _0x1c5874;})[_0x24fc('0x17')](respondWithFilteredResult(_0x33bbf2,_0x3b2862))[_0x24fc('0x20')](handleError(_0x33bbf2,null));};exports[_0x24fc('0x46')]=function(_0x4ada06,_0x4eeb2e){var _0x266378={'raw':![],'where':{'id':_0x4ada06[_0x24fc('0x47')]['id']}},_0x2f1a99={};_0x2f1a99['model']=_['keys'](db[_0x24fc('0x2e')][_0x24fc('0x2f')]);_0x2f1a99[_0x24fc('0x31')]=_[_0x24fc('0x34')](_0x4ada06[_0x24fc('0x31')]);_0x2f1a99[_0x24fc('0x35')]=_[_0x24fc('0x37')](_0x2f1a99[_0x24fc('0x30')],_0x2f1a99[_0x24fc('0x31')]);_0x266378[_0x24fc('0x36')]=_[_0x24fc('0x37')](_0x2f1a99[_0x24fc('0x30')],qs['fields'](_0x4ada06[_0x24fc('0x31')][_0x24fc('0x38')]));_0x266378[_0x24fc('0x36')]=_0x266378[_0x24fc('0x36')][_0x24fc('0x39')]?_0x266378['attributes']:_0x2f1a99[_0x24fc('0x30')];if(_0x4ada06['query'][_0x24fc('0x43')]){_0x266378[_0x24fc('0x48')]=[{'all':!![]}];}_0x266378=_[_0x24fc('0x40')]({},_0x266378,_0x4ada06[_0x24fc('0x49')]);return db[_0x24fc('0x2e')][_0x24fc('0x4a')](_0x266378)['then'](handleEntityNotFound(_0x4eeb2e,null))[_0x24fc('0x17')](respondWithResult(_0x4eeb2e,null))[_0x24fc('0x20')](handleError(_0x4eeb2e,null));};exports[_0x24fc('0x4b')]=function(_0x31a2ef,_0x28f799){return db[_0x24fc('0x2e')]['create'](_0x31a2ef[_0x24fc('0x4c')],{})[_0x24fc('0x17')](respondWithResult(_0x28f799,0xc9))[_0x24fc('0x20')](handleError(_0x28f799,null));};exports[_0x24fc('0x2a')]=function(_0x3e739d,_0x385968){if(_0x3e739d[_0x24fc('0x4c')]['id']){delete _0x3e739d['body']['id'];}return db[_0x24fc('0x2e')][_0x24fc('0x4a')]({'where':{'id':_0x3e739d['params']['id']}})[_0x24fc('0x17')](handleEntityNotFound(_0x385968,null))[_0x24fc('0x17')](saveUpdates(_0x3e739d[_0x24fc('0x4c')],null))[_0x24fc('0x17')](respondWithResult(_0x385968,null))[_0x24fc('0x20')](handleError(_0x385968,null));};exports[_0x24fc('0x4d')]=function(_0x50302e,_0x28a44c){return db['ZendeskConfiguration'][_0x24fc('0x4a')]({'where':{'id':_0x50302e[_0x24fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x28a44c,null))[_0x24fc('0x17')](removeEntity(_0x28a44c,null))['catch'](handleError(_0x28a44c,null));};exports[_0x24fc('0x4e')]=function(_0x595c47,_0xdff811,_0x27b612){var _0x57daaf={};var _0x2edef7={};var _0x5d6539;var _0x191bc6;return db[_0x24fc('0x2e')]['findOne']({'where':{'id':_0x595c47[_0x24fc('0x47')]['id']}})[_0x24fc('0x17')](handleEntityNotFound(_0xdff811,null))[_0x24fc('0x17')](function(_0x47179d){if(_0x47179d){_0x5d6539=_0x47179d;_0x2edef7[_0x24fc('0x30')]=_['keys'](db[_0x24fc('0x4f')][_0x24fc('0x2f')]);_0x2edef7[_0x24fc('0x31')]=_[_0x24fc('0x34')](_0x595c47[_0x24fc('0x31')]);_0x2edef7['filters']=_['intersection'](_0x2edef7[_0x24fc('0x30')],_0x2edef7[_0x24fc('0x31')]);_0x57daaf['attributes']=_['intersection'](_0x2edef7[_0x24fc('0x30')],qs[_0x24fc('0x38')](_0x595c47[_0x24fc('0x31')][_0x24fc('0x38')]));_0x57daaf['attributes']=_0x57daaf[_0x24fc('0x36')][_0x24fc('0x39')]?_0x57daaf[_0x24fc('0x36')]:_0x2edef7[_0x24fc('0x30')];_0x57daaf[_0x24fc('0x3b')]=qs[_0x24fc('0x3c')](_0x595c47[_0x24fc('0x31')][_0x24fc('0x3c')]);_0x57daaf[_0x24fc('0x3d')]=qs[_0x24fc('0x35')](_[_0x24fc('0x50')](_0x595c47[_0x24fc('0x31')],_0x2edef7[_0x24fc('0x35')]));if(_0x595c47[_0x24fc('0x31')][_0x24fc('0x41')]){_0x57daaf['where']=_[_0x24fc('0x40')](_0x57daaf[_0x24fc('0x3d')],{'$or':_[_0x24fc('0x42')](_0x57daaf[_0x24fc('0x36')],function(_0x3354f5){var _0x2eb6dc={};_0x2eb6dc[_0x3354f5]={'$like':'%'+_0x595c47[_0x24fc('0x31')][_0x24fc('0x41')]+'%'};return _0x2eb6dc;})});}_0x57daaf=_['merge']({},_0x57daaf,_0x595c47[_0x24fc('0x49')]);return _0x5d6539[_0x24fc('0x4e')](_0x57daaf);}})[_0x24fc('0x17')](function(_0xba111d){if(_0xba111d){_0x191bc6=_0xba111d['length'];if(!_0x595c47[_0x24fc('0x31')][_0x24fc('0x3a')]('nolimit')){_0x57daaf['limit']=qs['limit'](_0x595c47[_0x24fc('0x31')][_0x24fc('0x26')]);_0x57daaf[_0x24fc('0x25')]=qs[_0x24fc('0x25')](_0x595c47[_0x24fc('0x31')][_0x24fc('0x25')]);}return _0x5d6539['getFields'](_0x57daaf);}})[_0x24fc('0x17')](function(_0x15e8a3){if(_0x15e8a3){return _0x15e8a3?{'count':_0x191bc6,'rows':_0x15e8a3}:null;}})['then'](respondWithResult(_0xdff811,null))['catch'](handleError(_0xdff811,null));};exports[_0x24fc('0x51')]=function(_0x2f5101,_0x3cc8c4,_0x537348){var _0x2c730b={};var _0x7640fa={};var _0x33f04e;var _0x4f5547;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2f5101['params']['id']}})['then'](handleEntityNotFound(_0x3cc8c4,null))[_0x24fc('0x17')](function(_0x7e93d0){if(_0x7e93d0){_0x33f04e=_0x7e93d0;_0x7640fa[_0x24fc('0x30')]=_[_0x24fc('0x34')](db['ZendeskField'][_0x24fc('0x2f')]);_0x7640fa['query']=_[_0x24fc('0x34')](_0x2f5101['query']);_0x7640fa[_0x24fc('0x35')]=_[_0x24fc('0x37')](_0x7640fa[_0x24fc('0x30')],_0x7640fa[_0x24fc('0x31')]);_0x2c730b[_0x24fc('0x36')]=_[_0x24fc('0x37')](_0x7640fa[_0x24fc('0x30')],qs['fields'](_0x2f5101[_0x24fc('0x31')][_0x24fc('0x38')]));_0x2c730b[_0x24fc('0x36')]=_0x2c730b['attributes']['length']?_0x2c730b[_0x24fc('0x36')]:_0x7640fa[_0x24fc('0x30')];_0x2c730b['order']=qs[_0x24fc('0x3c')](_0x2f5101[_0x24fc('0x31')]['sort']);_0x2c730b[_0x24fc('0x3d')]=qs[_0x24fc('0x35')](_['pick'](_0x2f5101[_0x24fc('0x31')],_0x7640fa[_0x24fc('0x35')]));if(_0x2f5101[_0x24fc('0x31')][_0x24fc('0x41')]){_0x2c730b[_0x24fc('0x3d')]=_[_0x24fc('0x40')](_0x2c730b['where'],{'$or':_['map'](_0x2c730b[_0x24fc('0x36')],function(_0x5a1c55){var _0x29bd9f={};_0x29bd9f[_0x5a1c55]={'$like':'%'+_0x2f5101['query']['filter']+'%'};return _0x29bd9f;})});}_0x2c730b=_[_0x24fc('0x40')]({},_0x2c730b,_0x2f5101[_0x24fc('0x49')]);return _0x33f04e[_0x24fc('0x51')](_0x2c730b);}})[_0x24fc('0x17')](function(_0x66de4f){if(_0x66de4f){_0x4f5547=_0x66de4f[_0x24fc('0x39')];if(!_0x2f5101[_0x24fc('0x31')][_0x24fc('0x3a')]('nolimit')){_0x2c730b[_0x24fc('0x26')]=qs[_0x24fc('0x26')](_0x2f5101['query']['limit']);_0x2c730b[_0x24fc('0x25')]=qs[_0x24fc('0x25')](_0x2f5101[_0x24fc('0x31')][_0x24fc('0x25')]);}return _0x33f04e[_0x24fc('0x51')](_0x2c730b);}})['then'](function(_0x216781){if(_0x216781){return _0x216781?{'count':_0x4f5547,'rows':_0x216781}:null;}})[_0x24fc('0x17')](respondWithResult(_0x3cc8c4,null))['catch'](handleError(_0x3cc8c4,null));};exports[_0x24fc('0x52')]=function(_0x400fa7,_0x235ae2,_0x534d34){var _0x1b41f7={};var _0x4752ba={};var _0x3399fe;var _0x2c573b;return db[_0x24fc('0x2e')][_0x24fc('0x53')]({'where':{'id':_0x400fa7[_0x24fc('0x47')]['id']}})[_0x24fc('0x17')](handleEntityNotFound(_0x235ae2,null))[_0x24fc('0x17')](function(_0x54f379){if(_0x54f379){_0x3399fe=_0x54f379;_0x4752ba[_0x24fc('0x30')]=_[_0x24fc('0x34')](db[_0x24fc('0x4f')]['rawAttributes']);_0x4752ba['query']=_['keys'](_0x400fa7[_0x24fc('0x31')]);_0x4752ba['filters']=_[_0x24fc('0x37')](_0x4752ba[_0x24fc('0x30')],_0x4752ba['query']);_0x1b41f7[_0x24fc('0x36')]=_['intersection'](_0x4752ba[_0x24fc('0x30')],qs['fields'](_0x400fa7[_0x24fc('0x31')][_0x24fc('0x38')]));_0x1b41f7[_0x24fc('0x36')]=_0x1b41f7[_0x24fc('0x36')][_0x24fc('0x39')]?_0x1b41f7[_0x24fc('0x36')]:_0x4752ba['model'];_0x1b41f7[_0x24fc('0x3b')]=qs[_0x24fc('0x3c')](_0x400fa7[_0x24fc('0x31')][_0x24fc('0x3c')]);_0x1b41f7[_0x24fc('0x3d')]=qs[_0x24fc('0x35')](_[_0x24fc('0x50')](_0x400fa7[_0x24fc('0x31')],_0x4752ba[_0x24fc('0x35')]));if(_0x400fa7['query'][_0x24fc('0x41')]){_0x1b41f7[_0x24fc('0x3d')]=_[_0x24fc('0x40')](_0x1b41f7[_0x24fc('0x3d')],{'$or':_['map'](_0x1b41f7[_0x24fc('0x36')],function(_0x3287ac){var _0xc2be0f={};_0xc2be0f[_0x3287ac]={'$like':'%'+_0x400fa7['query'][_0x24fc('0x41')]+'%'};return _0xc2be0f;})});}_0x1b41f7=_['merge']({},_0x1b41f7,_0x400fa7['options']);return _0x3399fe['getDescriptions'](_0x1b41f7);}})[_0x24fc('0x17')](function(_0x49c35c){if(_0x49c35c){_0x2c573b=_0x49c35c[_0x24fc('0x39')];if(!_0x400fa7[_0x24fc('0x31')][_0x24fc('0x3a')](_0x24fc('0x54'))){_0x1b41f7['limit']=qs[_0x24fc('0x26')](_0x400fa7[_0x24fc('0x31')][_0x24fc('0x26')]);_0x1b41f7[_0x24fc('0x25')]=qs[_0x24fc('0x25')](_0x400fa7['query'][_0x24fc('0x25')]);}return _0x3399fe[_0x24fc('0x52')](_0x1b41f7);}})[_0x24fc('0x17')](function(_0xdc1cb7){if(_0xdc1cb7){return _0xdc1cb7?{'count':_0x2c573b,'rows':_0xdc1cb7}:null;}})['then'](respondWithResult(_0x235ae2,null))['catch'](handleError(_0x235ae2,null));};exports[_0x24fc('0x55')]=function(_0x4216da,_0x24e27e,_0x188d0d){var _0x1f263c={};var _0x49e6f2={};var _0x44e610;var _0x31dad1;return db[_0x24fc('0x2e')]['findOne']({'where':{'id':_0x4216da[_0x24fc('0x47')]['id']}})[_0x24fc('0x17')](handleEntityNotFound(_0x24e27e,null))[_0x24fc('0x17')](function(_0x1e1474){if(_0x1e1474){_0x44e610=_0x1e1474;_0x49e6f2[_0x24fc('0x30')]=_['keys'](db['Tag']['rawAttributes']);_0x49e6f2[_0x24fc('0x31')]=_[_0x24fc('0x34')](_0x4216da[_0x24fc('0x31')]);_0x49e6f2[_0x24fc('0x35')]=_[_0x24fc('0x37')](_0x49e6f2[_0x24fc('0x30')],_0x49e6f2[_0x24fc('0x31')]);_0x1f263c[_0x24fc('0x36')]=_[_0x24fc('0x37')](_0x49e6f2[_0x24fc('0x30')],qs[_0x24fc('0x38')](_0x4216da[_0x24fc('0x31')]['fields']));_0x1f263c['attributes']=_0x1f263c[_0x24fc('0x36')]['length']?_0x1f263c[_0x24fc('0x36')]:_0x49e6f2[_0x24fc('0x30')];_0x1f263c[_0x24fc('0x3b')]=qs[_0x24fc('0x3c')](_0x4216da[_0x24fc('0x31')][_0x24fc('0x3c')]);_0x1f263c[_0x24fc('0x3d')]=qs[_0x24fc('0x35')](_[_0x24fc('0x50')](_0x4216da['query'],_0x49e6f2[_0x24fc('0x35')]));if(_0x4216da[_0x24fc('0x31')]['filter']){_0x1f263c['where']=_[_0x24fc('0x40')](_0x1f263c[_0x24fc('0x3d')],{'$or':_[_0x24fc('0x42')](_0x1f263c[_0x24fc('0x36')],function(_0x9cecee){var _0x6d6162={};_0x6d6162[_0x9cecee]={'$like':'%'+_0x4216da['query'][_0x24fc('0x41')]+'%'};return _0x6d6162;})});}_0x1f263c=_[_0x24fc('0x40')]({},_0x1f263c,_0x4216da[_0x24fc('0x49')]);return _0x44e610[_0x24fc('0x55')](_0x1f263c);}})['then'](function(_0x2fb68a){if(_0x2fb68a){_0x31dad1=_0x2fb68a[_0x24fc('0x39')];if(!_0x4216da[_0x24fc('0x31')]['hasOwnProperty'](_0x24fc('0x54'))){_0x1f263c[_0x24fc('0x26')]=qs[_0x24fc('0x26')](_0x4216da['query'][_0x24fc('0x26')]);_0x1f263c[_0x24fc('0x25')]=qs['offset'](_0x4216da['query'][_0x24fc('0x25')]);}return _0x44e610[_0x24fc('0x55')](_0x1f263c);}})[_0x24fc('0x17')](function(_0x2029cd){if(_0x2029cd){return _0x2029cd?{'count':_0x31dad1,'rows':_0x2029cd}:null;}})[_0x24fc('0x17')](respondWithResult(_0x24e27e,null))[_0x24fc('0x20')](handleError(_0x24e27e,null));};exports['setTags']=function(_0xfc5410,_0x1e67c4,_0x17a6a9){if(_0xfc5410[_0x24fc('0x4c')]['id']){delete _0xfc5410[_0x24fc('0x4c')]['id'];}return db[_0x24fc('0x2e')]['findOne']({'where':{'id':_0xfc5410[_0x24fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e67c4,null))['then'](function(_0x260a62){if(_0x260a62){return _0x260a62[_0x24fc('0x56')](_0xfc5410['body'][_0x24fc('0x57')]||[]);}return null;})[_0x24fc('0x17')](respondWithResult(_0x1e67c4,null))[_0x24fc('0x20')](handleError(_0x1e67c4,null));}; \ No newline at end of file +var _0xb688=['dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','where','add','day','merge','filter','map','options','count','includeAll','include','params','find','create','body','getFields','findOne','ZendeskField','length','order','sort','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','message','ZendeskConfiguration,\x20%s,\x20%s','catch','sendStatus','end','status','json','limit','set','apply','reject','save','update','stack','name','send','index','ZendeskConfiguration','rawAttributes','model','keys','query','dateStart'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xb688,0xcf));var _0x8b68=function(_0x23ed68,_0x22c9b0){_0x23ed68=_0x23ed68-0x0;var _0x33f998=_0xb688[_0x23ed68];return _0x33f998;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8b68('0x0'));var moment=require(_0x8b68('0x1'));var BPromise=require(_0x8b68('0x2'));var Mustache=require(_0x8b68('0x3'));var util=require(_0x8b68('0x4'));var path=require(_0x8b68('0x5'));var sox=require('sox');var csv=require(_0x8b68('0x6'));var ejs=require(_0x8b68('0x7'));var fs=require('fs');var _=require(_0x8b68('0x8'));var squel=require(_0x8b68('0x9'));var crypto=require('crypto');var jsforce=require(_0x8b68('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8b68('0x6'));var querystring=require(_0x8b68('0xb'));var Papa=require(_0x8b68('0xc'));var qs=require(_0x8b68('0xd'));var logger=require(_0x8b68('0xe'))(_0x8b68('0xf'));var utils=require(_0x8b68('0x10'));var config=require(_0x8b68('0x11'));var db=require(_0x8b68('0x12'))['db'];var jayson=require(_0x8b68('0x13'));var client=jayson[_0x8b68('0x14')][_0x8b68('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2a852a,_0x502727,_0x2c0f3b,_0x4426d1){return new BPromise(function(_0x5e76c,_0x2d8472){var _0x1965cf=_0x4426d1||client;return _0x1965cf[_0x8b68('0x16')](_0x2a852a,_0x2c0f3b)[_0x8b68('0x17')](function(_0x137c8e){logger[_0x8b68('0x18')]('ZendeskConfiguration,\x20%s,\x20%s',_0x502727,_0x8b68('0x19'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x502727,_0x8b68('0x19'),JSON[_0x8b68('0x1a')](_0x137c8e));if(_0x137c8e[_0x8b68('0x1b')]){if(_0x137c8e['error']['code']===0x1f4){logger[_0x8b68('0x1b')]('ZendeskConfiguration,\x20%s,\x20%s',_0x502727,_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);return _0x2d8472(_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);}logger['error'](_0x8b68('0x1d'),_0x502727,_0x137c8e[_0x8b68('0x1b')]['message']);return _0x5e76c(_0x137c8e[_0x8b68('0x1b')][_0x8b68('0x1c')]);}else{logger[_0x8b68('0x18')](_0x8b68('0x1d'),_0x502727,_0x8b68('0x19'));_0x5e76c(_0x137c8e['result'][_0x8b68('0x1c')]);}})[_0x8b68('0x1e')](function(_0x59e9b1){logger[_0x8b68('0x1b')](_0x8b68('0x1d'),_0x502727,_0x59e9b1);_0x2d8472(_0x59e9b1);});});}function respondWithStatusCode(_0x1dbc1d,_0x5603d4){_0x5603d4=_0x5603d4||0xcc;return function(_0x571adf){if(_0x571adf){return _0x1dbc1d[_0x8b68('0x1f')](_0x5603d4);}return _0x1dbc1d['status'](_0x5603d4)[_0x8b68('0x20')]();};}function respondWithResult(_0x30b6d0,_0x13aee5){_0x13aee5=_0x13aee5||0xc8;return function(_0x21ecca){if(_0x21ecca){return _0x30b6d0[_0x8b68('0x21')](_0x13aee5)[_0x8b68('0x22')](_0x21ecca);}};}function respondWithFilteredResult(_0x59bb8a,_0x1a6fe8){return function(_0x46e827){if(_0x46e827){var _0x4ca77d=_0x46e827['count'],_0x1c5808=_0x1a6fe8['offset'],_0x3cf8d2=_0x1a6fe8['offset']+_0x1a6fe8[_0x8b68('0x23')],_0x240b0b;if(_0x3cf8d2>=_0x4ca77d){_0x3cf8d2=_0x4ca77d;_0x240b0b=0xc8;}else{_0x240b0b=0xce;}_0x59bb8a[_0x8b68('0x21')](_0x240b0b);return _0x59bb8a[_0x8b68('0x24')]('Content-Range',_0x1c5808+'-'+_0x3cf8d2+'/'+_0x4ca77d)[_0x8b68('0x22')](_0x46e827);}return null;};}function patchUpdates(_0x53aaa2){return function(_0x4cf89d){try{jsonpatch[_0x8b68('0x25')](_0x4cf89d,_0x53aaa2,!![]);}catch(_0x59b3ce){return BPromise[_0x8b68('0x26')](_0x59b3ce);}return _0x4cf89d[_0x8b68('0x27')]();};}function saveUpdates(_0x48e2c8,_0x494ce4){return function(_0x357635){if(_0x357635){return _0x357635[_0x8b68('0x28')](_0x48e2c8)[_0x8b68('0x17')](function(_0xfb4f06){return _0xfb4f06;});}return null;};}function removeEntity(_0x210926,_0x2ad2df){return function(_0x460c37){if(_0x460c37){return _0x460c37['destroy']()[_0x8b68('0x17')](function(){_0x210926['status'](0xcc)[_0x8b68('0x20')]();});}};}function handleEntityNotFound(_0x133b75,_0x4c276f){return function(_0x216aa6){if(!_0x216aa6){_0x133b75[_0x8b68('0x1f')](0x194);}return _0x216aa6;};}function handleError(_0x26fe0e,_0x49ce2d){_0x49ce2d=_0x49ce2d||0x1f4;return function(_0x51f169){logger[_0x8b68('0x1b')](_0x51f169[_0x8b68('0x29')]);if(_0x51f169[_0x8b68('0x2a')]){delete _0x51f169[_0x8b68('0x2a')];}_0x26fe0e[_0x8b68('0x21')](_0x49ce2d)[_0x8b68('0x2b')](_0x51f169);};}exports[_0x8b68('0x2c')]=function(_0x3e646e,_0x12abb8){var _0x7fe301={},_0x49e2db={},_0x15027a={'count':0x0,'rows':[]};var _0x232fa9=db[_0x8b68('0x2d')][_0x8b68('0x2e')];_0x49e2db[_0x8b68('0x2f')]=_[_0x8b68('0x30')](_0x232fa9);var _0x2a7dd5={'dateStart':_0x3e646e[_0x8b68('0x31')][_0x8b68('0x32')],'dateEnd':_0x3e646e[_0x8b68('0x31')][_0x8b68('0x33')]};delete _0x3e646e['query']['dateStart'];delete _0x3e646e[_0x8b68('0x31')][_0x8b68('0x33')];_0x49e2db[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x3e646e[_0x8b68('0x31')]);_0x49e2db[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0x49e2db[_0x8b68('0x2f')],_0x49e2db['query']);_0x7fe301[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x49e2db[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x3e646e[_0x8b68('0x31')][_0x8b68('0x37')]));_0x7fe301[_0x8b68('0x36')]=_0x7fe301[_0x8b68('0x36')]['length']?_0x7fe301[_0x8b68('0x36')]:_0x49e2db[_0x8b68('0x2f')];if(!_0x3e646e[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x7fe301[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x3e646e['query'][_0x8b68('0x23')]);_0x7fe301[_0x8b68('0x3a')]=qs['offset'](_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3a')]);}_0x7fe301['order']=qs['sort'](_0x3e646e['query']['sort']);_0x7fe301[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_['pick'](_0x3e646e[_0x8b68('0x31')],_0x49e2db['filters']));if(_0x2a7dd5[_0x8b68('0x32')]){if(_0x2a7dd5[_0x8b68('0x33')]){_0x2a7dd5['dateEnd']=moment(_0x2a7dd5[_0x8b68('0x33')])['add'](0x1,'day');}else{_0x2a7dd5['dateEnd']=moment(_0x2a7dd5[_0x8b68('0x32')])[_0x8b68('0x3c')](0x1,_0x8b68('0x3d'));}_[_0x8b68('0x3e')](_0x7fe301['where'],{'createdAt':{'$gte':_0x2a7dd5[_0x8b68('0x32')],'$lte':_0x2a7dd5['dateEnd']}});}if(_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x7fe301['where']=_[_0x8b68('0x3e')](_0x7fe301[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x7fe301[_0x8b68('0x36')],function(_0x5f136f){var _0x14fa5a={};_0x14fa5a[_0x5f136f]={'$like':'%'+_0x3e646e[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x14fa5a;})});}_0x7fe301=_[_0x8b68('0x3e')]({},_0x7fe301,_0x3e646e[_0x8b68('0x41')]);var _0x1362d3={'where':_0x7fe301[_0x8b68('0x3b')]};return db[_0x8b68('0x2d')][_0x8b68('0x42')](_0x1362d3)[_0x8b68('0x17')](function(_0x1ec2c4){_0x15027a[_0x8b68('0x42')]=_0x1ec2c4;if(_0x3e646e[_0x8b68('0x31')][_0x8b68('0x43')]){_0x7fe301[_0x8b68('0x44')]=[{'all':!![]}];}return db[_0x8b68('0x2d')]['findAll'](_0x7fe301);})[_0x8b68('0x17')](function(_0x20681a){_0x15027a['rows']=_0x20681a;return _0x15027a;})[_0x8b68('0x17')](respondWithFilteredResult(_0x12abb8,_0x7fe301))['catch'](handleError(_0x12abb8,null));};exports['show']=function(_0x59a4a6,_0x1c8a3e){var _0x35874b={'raw':![],'where':{'id':_0x59a4a6[_0x8b68('0x45')]['id']}},_0x34047c={};_0x34047c['model']=_['keys'](db[_0x8b68('0x2d')][_0x8b68('0x2e')]);_0x34047c[_0x8b68('0x31')]=_['keys'](_0x59a4a6[_0x8b68('0x31')]);_0x34047c[_0x8b68('0x34')]=_['intersection'](_0x34047c[_0x8b68('0x2f')],_0x34047c[_0x8b68('0x31')]);_0x35874b['attributes']=_[_0x8b68('0x35')](_0x34047c[_0x8b68('0x2f')],qs['fields'](_0x59a4a6[_0x8b68('0x31')][_0x8b68('0x37')]));_0x35874b['attributes']=_0x35874b['attributes']['length']?_0x35874b[_0x8b68('0x36')]:_0x34047c[_0x8b68('0x2f')];if(_0x59a4a6[_0x8b68('0x31')][_0x8b68('0x43')]){_0x35874b['include']=[{'all':!![]}];}_0x35874b=_['merge']({},_0x35874b,_0x59a4a6[_0x8b68('0x41')]);return db[_0x8b68('0x2d')][_0x8b68('0x46')](_0x35874b)['then'](handleEntityNotFound(_0x1c8a3e,null))[_0x8b68('0x17')](respondWithResult(_0x1c8a3e,null))[_0x8b68('0x1e')](handleError(_0x1c8a3e,null));};exports[_0x8b68('0x47')]=function(_0x4dda69,_0x49dc86){return db['ZendeskConfiguration'][_0x8b68('0x47')](_0x4dda69[_0x8b68('0x48')],{})['then'](respondWithResult(_0x49dc86,0xc9))[_0x8b68('0x1e')](handleError(_0x49dc86,null));};exports[_0x8b68('0x28')]=function(_0x6ac18,_0xcd88b4){if(_0x6ac18[_0x8b68('0x48')]['id']){delete _0x6ac18['body']['id'];}return db[_0x8b68('0x2d')][_0x8b68('0x46')]({'where':{'id':_0x6ac18[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0xcd88b4,null))[_0x8b68('0x17')](saveUpdates(_0x6ac18[_0x8b68('0x48')],null))[_0x8b68('0x17')](respondWithResult(_0xcd88b4,null))[_0x8b68('0x1e')](handleError(_0xcd88b4,null));};exports['destroy']=function(_0x3f423e,_0x1a85da){return db[_0x8b68('0x2d')][_0x8b68('0x46')]({'where':{'id':_0x3f423e[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x1a85da,null))[_0x8b68('0x17')](removeEntity(_0x1a85da,null))[_0x8b68('0x1e')](handleError(_0x1a85da,null));};exports[_0x8b68('0x49')]=function(_0x271dbe,_0x368c86,_0x42871e){var _0x1019cb={};var _0x275b31={};var _0x28e7aa;var _0xd7e86d;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x271dbe[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x368c86,null))['then'](function(_0xaac776){if(_0xaac776){_0x28e7aa=_0xaac776;_0x275b31['model']=_['keys'](db[_0x8b68('0x4b')]['rawAttributes']);_0x275b31[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x271dbe[_0x8b68('0x31')]);_0x275b31['filters']=_[_0x8b68('0x35')](_0x275b31[_0x8b68('0x2f')],_0x275b31[_0x8b68('0x31')]);_0x1019cb[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x275b31[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x271dbe['query']['fields']));_0x1019cb[_0x8b68('0x36')]=_0x1019cb[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x1019cb[_0x8b68('0x36')]:_0x275b31[_0x8b68('0x2f')];_0x1019cb[_0x8b68('0x4d')]=qs[_0x8b68('0x4e')](_0x271dbe[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x1019cb[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x271dbe[_0x8b68('0x31')],_0x275b31[_0x8b68('0x34')]));if(_0x271dbe[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x1019cb[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x1019cb['where'],{'$or':_['map'](_0x1019cb[_0x8b68('0x36')],function(_0x23e01a){var _0x5bd581={};_0x5bd581[_0x23e01a]={'$like':'%'+_0x271dbe['query']['filter']+'%'};return _0x5bd581;})});}_0x1019cb=_[_0x8b68('0x3e')]({},_0x1019cb,_0x271dbe[_0x8b68('0x41')]);return _0x28e7aa[_0x8b68('0x49')](_0x1019cb);}})[_0x8b68('0x17')](function(_0xc52321){if(_0xc52321){_0xd7e86d=_0xc52321['length'];if(!_0x271dbe[_0x8b68('0x31')][_0x8b68('0x38')]('nolimit')){_0x1019cb[_0x8b68('0x23')]=qs['limit'](_0x271dbe['query']['limit']);_0x1019cb[_0x8b68('0x3a')]=qs[_0x8b68('0x3a')](_0x271dbe[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x28e7aa[_0x8b68('0x49')](_0x1019cb);}})[_0x8b68('0x17')](function(_0x35b22b){if(_0x35b22b){return _0x35b22b?{'count':_0xd7e86d,'rows':_0x35b22b}:null;}})[_0x8b68('0x17')](respondWithResult(_0x368c86,null))[_0x8b68('0x1e')](handleError(_0x368c86,null));};exports[_0x8b68('0x50')]=function(_0x55e04f,_0x3a8d15,_0x335b3b){var _0x310ec9={};var _0x49cce6={};var _0x5deaba;var _0x1854a9;return db[_0x8b68('0x2d')]['findOne']({'where':{'id':_0x55e04f[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x3a8d15,null))[_0x8b68('0x17')](function(_0x2c2f6d){if(_0x2c2f6d){_0x5deaba=_0x2c2f6d;_0x49cce6['model']=_[_0x8b68('0x30')](db['ZendeskField']['rawAttributes']);_0x49cce6[_0x8b68('0x31')]=_['keys'](_0x55e04f[_0x8b68('0x31')]);_0x49cce6[_0x8b68('0x34')]=_['intersection'](_0x49cce6[_0x8b68('0x2f')],_0x49cce6[_0x8b68('0x31')]);_0x310ec9[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0x49cce6[_0x8b68('0x2f')],qs['fields'](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x37')]));_0x310ec9[_0x8b68('0x36')]=_0x310ec9[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x310ec9['attributes']:_0x49cce6['model'];_0x310ec9[_0x8b68('0x4d')]=qs['sort'](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x310ec9[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x55e04f[_0x8b68('0x31')],_0x49cce6[_0x8b68('0x34')]));if(_0x55e04f['query'][_0x8b68('0x3f')]){_0x310ec9['where']=_[_0x8b68('0x3e')](_0x310ec9[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x310ec9['attributes'],function(_0x3141d3){var _0x50d0b9={};_0x50d0b9[_0x3141d3]={'$like':'%'+_0x55e04f[_0x8b68('0x31')]['filter']+'%'};return _0x50d0b9;})});}_0x310ec9=_[_0x8b68('0x3e')]({},_0x310ec9,_0x55e04f[_0x8b68('0x41')]);return _0x5deaba[_0x8b68('0x50')](_0x310ec9);}})['then'](function(_0x33b775){if(_0x33b775){_0x1854a9=_0x33b775[_0x8b68('0x4c')];if(!_0x55e04f[_0x8b68('0x31')][_0x8b68('0x38')](_0x8b68('0x39'))){_0x310ec9[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x23')]);_0x310ec9['offset']=qs[_0x8b68('0x3a')](_0x55e04f[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x5deaba[_0x8b68('0x50')](_0x310ec9);}})[_0x8b68('0x17')](function(_0x543468){if(_0x543468){return _0x543468?{'count':_0x1854a9,'rows':_0x543468}:null;}})[_0x8b68('0x17')](respondWithResult(_0x3a8d15,null))['catch'](handleError(_0x3a8d15,null));};exports[_0x8b68('0x51')]=function(_0x2de166,_0x524763,_0x20c8b4){var _0x75af51={};var _0xa7890f={};var _0x4c9e0f;var _0x3cca8c;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x2de166[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x524763,null))[_0x8b68('0x17')](function(_0x541cf2){if(_0x541cf2){_0x4c9e0f=_0x541cf2;_0xa7890f[_0x8b68('0x2f')]=_[_0x8b68('0x30')](db[_0x8b68('0x4b')]['rawAttributes']);_0xa7890f[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x2de166[_0x8b68('0x31')]);_0xa7890f[_0x8b68('0x34')]=_[_0x8b68('0x35')](_0xa7890f[_0x8b68('0x2f')],_0xa7890f[_0x8b68('0x31')]);_0x75af51[_0x8b68('0x36')]=_[_0x8b68('0x35')](_0xa7890f[_0x8b68('0x2f')],qs[_0x8b68('0x37')](_0x2de166['query']['fields']));_0x75af51[_0x8b68('0x36')]=_0x75af51[_0x8b68('0x36')][_0x8b68('0x4c')]?_0x75af51[_0x8b68('0x36')]:_0xa7890f[_0x8b68('0x2f')];_0x75af51['order']=qs[_0x8b68('0x4e')](_0x2de166[_0x8b68('0x31')][_0x8b68('0x4e')]);_0x75af51[_0x8b68('0x3b')]=qs['filters'](_['pick'](_0x2de166[_0x8b68('0x31')],_0xa7890f[_0x8b68('0x34')]));if(_0x2de166[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x75af51[_0x8b68('0x3b')]=_[_0x8b68('0x3e')](_0x75af51[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x75af51['attributes'],function(_0x7864cf){var _0x3fa9be={};_0x3fa9be[_0x7864cf]={'$like':'%'+_0x2de166[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x3fa9be;})});}_0x75af51=_[_0x8b68('0x3e')]({},_0x75af51,_0x2de166[_0x8b68('0x41')]);return _0x4c9e0f['getDescriptions'](_0x75af51);}})[_0x8b68('0x17')](function(_0x14a888){if(_0x14a888){_0x3cca8c=_0x14a888[_0x8b68('0x4c')];if(!_0x2de166['query'][_0x8b68('0x38')]('nolimit')){_0x75af51[_0x8b68('0x23')]=qs['limit'](_0x2de166[_0x8b68('0x31')][_0x8b68('0x23')]);_0x75af51[_0x8b68('0x3a')]=qs[_0x8b68('0x3a')](_0x2de166[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x4c9e0f['getDescriptions'](_0x75af51);}})['then'](function(_0x58e99a){if(_0x58e99a){return _0x58e99a?{'count':_0x3cca8c,'rows':_0x58e99a}:null;}})[_0x8b68('0x17')](respondWithResult(_0x524763,null))[_0x8b68('0x1e')](handleError(_0x524763,null));};exports[_0x8b68('0x52')]=function(_0x198b79,_0x30db03,_0x401229){var _0x3cbd15={};var _0x3b1644={};var _0x2846ca;var _0x60f6e5;return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x198b79[_0x8b68('0x45')]['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x30db03,null))[_0x8b68('0x17')](function(_0x5e76ac){if(_0x5e76ac){_0x2846ca=_0x5e76ac;_0x3b1644['model']=_['keys'](db[_0x8b68('0x53')][_0x8b68('0x2e')]);_0x3b1644[_0x8b68('0x31')]=_[_0x8b68('0x30')](_0x198b79[_0x8b68('0x31')]);_0x3b1644['filters']=_[_0x8b68('0x35')](_0x3b1644['model'],_0x3b1644[_0x8b68('0x31')]);_0x3cbd15['attributes']=_[_0x8b68('0x35')](_0x3b1644['model'],qs[_0x8b68('0x37')](_0x198b79['query'][_0x8b68('0x37')]));_0x3cbd15[_0x8b68('0x36')]=_0x3cbd15['attributes'][_0x8b68('0x4c')]?_0x3cbd15[_0x8b68('0x36')]:_0x3b1644['model'];_0x3cbd15[_0x8b68('0x4d')]=qs['sort'](_0x198b79[_0x8b68('0x31')]['sort']);_0x3cbd15[_0x8b68('0x3b')]=qs[_0x8b68('0x34')](_[_0x8b68('0x4f')](_0x198b79[_0x8b68('0x31')],_0x3b1644[_0x8b68('0x34')]));if(_0x198b79[_0x8b68('0x31')][_0x8b68('0x3f')]){_0x3cbd15['where']=_[_0x8b68('0x3e')](_0x3cbd15[_0x8b68('0x3b')],{'$or':_[_0x8b68('0x40')](_0x3cbd15[_0x8b68('0x36')],function(_0x333f4f){var _0x36335f={};_0x36335f[_0x333f4f]={'$like':'%'+_0x198b79[_0x8b68('0x31')][_0x8b68('0x3f')]+'%'};return _0x36335f;})});}_0x3cbd15=_[_0x8b68('0x3e')]({},_0x3cbd15,_0x198b79[_0x8b68('0x41')]);return _0x2846ca[_0x8b68('0x52')](_0x3cbd15);}})[_0x8b68('0x17')](function(_0x255f24){if(_0x255f24){_0x60f6e5=_0x255f24[_0x8b68('0x4c')];if(!_0x198b79['query'][_0x8b68('0x38')](_0x8b68('0x39'))){_0x3cbd15[_0x8b68('0x23')]=qs[_0x8b68('0x23')](_0x198b79[_0x8b68('0x31')][_0x8b68('0x23')]);_0x3cbd15['offset']=qs[_0x8b68('0x3a')](_0x198b79[_0x8b68('0x31')][_0x8b68('0x3a')]);}return _0x2846ca[_0x8b68('0x52')](_0x3cbd15);}})[_0x8b68('0x17')](function(_0x5e2270){if(_0x5e2270){return _0x5e2270?{'count':_0x60f6e5,'rows':_0x5e2270}:null;}})[_0x8b68('0x17')](respondWithResult(_0x30db03,null))[_0x8b68('0x1e')](handleError(_0x30db03,null));};exports[_0x8b68('0x54')]=function(_0x5731ee,_0x31d70c,_0x4df181){if(_0x5731ee['body']['id']){delete _0x5731ee['body']['id'];}return db[_0x8b68('0x2d')][_0x8b68('0x4a')]({'where':{'id':_0x5731ee['params']['id']}})[_0x8b68('0x17')](handleEntityNotFound(_0x31d70c,null))[_0x8b68('0x17')](function(_0x56f8af){if(_0x56f8af){return _0x56f8af[_0x8b68('0x54')](_0x5731ee[_0x8b68('0x48')][_0x8b68('0x55')]||[]);}return null;})[_0x8b68('0x17')](respondWithResult(_0x31d70c,null))[_0x8b68('0x1e')](handleError(_0x31d70c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 9d20646..65df8eb 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 _0x0e64=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./intZendeskConfiguration.attributes','int_zendesk_configurations'];(function(_0x2a4bb7,_0x436ab4){var _0x106a5e=function(_0x2ab012){while(--_0x2ab012){_0x2a4bb7['push'](_0x2a4bb7['shift']());}};_0x106a5e(++_0x436ab4);}(_0x0e64,0x1c2));var _0x40e6=function(_0x300f62,_0x53c59c){_0x300f62=_0x300f62-0x0;var _0x3afa19=_0x0e64[_0x300f62];return _0x3afa19;};'use strict';var _=require(_0x40e6('0x0'));var util=require(_0x40e6('0x1'));var logger=require(_0x40e6('0x2'))(_0x40e6('0x3'));var moment=require(_0x40e6('0x4'));var BPromise=require(_0x40e6('0x5'));var rp=require(_0x40e6('0x6'));var attributes=require(_0x40e6('0x7'));module['exports']=function(_0x14657b,_0x1233cd){return _0x14657b['define']('ZendeskConfiguration',attributes,{'tableName':_0x40e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00a9=['bluebird','request-promise','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x24ce88,_0x53da68){var _0x49e044=function(_0x193c63){while(--_0x193c63){_0x24ce88['push'](_0x24ce88['shift']());}};_0x49e044(++_0x53da68);}(_0x00a9,0x1cf));var _0x900a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x00a9[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var logger=require(_0x900a('0x2'))(_0x900a('0x3'));var moment=require(_0x900a('0x4'));var BPromise=require(_0x900a('0x5'));var rp=require(_0x900a('0x6'));var attributes=require(_0x900a('0x7'));module[_0x900a('0x8')]=function(_0x3a9b07,_0x569f92){return _0x3a9b07[_0x900a('0x9')](_0x900a('0xa'),attributes,{'tableName':_0x900a('0xb'),'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 dda63c3..00e9c01 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 _0xd77d=['../../config/utils','rpc','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x58b6c7,_0x3bf35e){var _0x5f50d0=function(_0x532e10){while(--_0x532e10){_0x58b6c7['push'](_0x58b6c7['shift']());}};_0x5f50d0(++_0x3bf35e);}(_0xd77d,0x94));var _0xdd77=function(_0x1d74ce,_0x4b51f5){_0x1d74ce=_0x1d74ce-0x0;var _0x1fc1db=_0xd77d[_0x1d74ce];return _0x1fc1db;};'use strict';var _=require(_0xdd77('0x0'));var util=require(_0xdd77('0x1'));var moment=require(_0xdd77('0x2'));var BPromise=require(_0xdd77('0x3'));var rs=require(_0xdd77('0x4'));var fs=require('fs');var db=require(_0xdd77('0x5'))['db'];var utils=require(_0xdd77('0x6'));var logger=require('../../config/logger')(_0xdd77('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdd77('0x8')][_0xdd77('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a1f53,_0x3e2ad8,_0x49ee7e){return new BPromise(function(_0x42c795,_0xbcfa37){return client['request'](_0x4a1f53,_0x49ee7e)[_0xdd77('0xa')](function(_0x1ea879){logger[_0xdd77('0xb')](_0xdd77('0xc'),_0x3e2ad8,_0xdd77('0xd'));logger[_0xdd77('0xe')](_0xdd77('0xf'),_0x3e2ad8,_0xdd77('0xd'),JSON[_0xdd77('0x10')](_0x1ea879));if(_0x1ea879[_0xdd77('0x11')]){if(_0x1ea879[_0xdd77('0x11')][_0xdd77('0x12')]===0x1f4){logger[_0xdd77('0x11')](_0xdd77('0xc'),_0x3e2ad8,_0x1ea879[_0xdd77('0x11')]['message']);return _0xbcfa37(_0x1ea879[_0xdd77('0x11')][_0xdd77('0x13')]);}logger[_0xdd77('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3e2ad8,_0x1ea879['error']['message']);return _0x42c795(_0x1ea879[_0xdd77('0x11')]['message']);}else{logger['info'](_0xdd77('0xc'),_0x3e2ad8,_0xdd77('0xd'));_0x42c795(_0x1ea879[_0xdd77('0x14')]['message']);}})[_0xdd77('0x15')](function(_0x38ed27){logger[_0xdd77('0x11')](_0xdd77('0xc'),_0x3e2ad8,_0x38ed27);_0xbcfa37(_0x38ed27);});});} \ No newline at end of file +var _0x7c21=['error','code','message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x868fc8,_0x21fd7e){var _0x5d3178=function(_0x2b082b){while(--_0x2b082b){_0x868fc8['push'](_0x868fc8['shift']());}};_0x5d3178(++_0x21fd7e);}(_0x7c21,0x1df));var _0x17c2=function(_0xca9ecb,_0x5138e8){_0xca9ecb=_0xca9ecb-0x0;var _0x35378f=_0x7c21[_0xca9ecb];return _0x35378f;};'use strict';var _=require(_0x17c2('0x0'));var util=require(_0x17c2('0x1'));var moment=require(_0x17c2('0x2'));var BPromise=require('bluebird');var rs=require(_0x17c2('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x17c2('0x4'));var logger=require(_0x17c2('0x5'))(_0x17c2('0x6'));var config=require(_0x17c2('0x7'));var jayson=require(_0x17c2('0x8'));var client=jayson['client'][_0x17c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x385485,_0x2d2b93,_0x448703){return new BPromise(function(_0x23e53,_0x2b4d78){return client[_0x17c2('0xa')](_0x385485,_0x448703)['then'](function(_0x224de5){logger[_0x17c2('0xb')](_0x17c2('0xc'),_0x2d2b93,_0x17c2('0xd'));logger[_0x17c2('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2d2b93,_0x17c2('0xd'),JSON['stringify'](_0x224de5));if(_0x224de5['error']){if(_0x224de5[_0x17c2('0xf')][_0x17c2('0x10')]===0x1f4){logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x224de5[_0x17c2('0xf')]['message']);return _0x2b4d78(_0x224de5[_0x17c2('0xf')][_0x17c2('0x11')]);}logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x224de5[_0x17c2('0xf')][_0x17c2('0x11')]);return _0x23e53(_0x224de5['error']['message']);}else{logger[_0x17c2('0xb')](_0x17c2('0xc'),_0x2d2b93,_0x17c2('0xd'));_0x23e53(_0x224de5[_0x17c2('0x12')][_0x17c2('0x11')]);}})['catch'](function(_0x103a7b){logger[_0x17c2('0xf')](_0x17c2('0xc'),_0x2d2b93,_0x103a7b);_0x2b4d78(_0x103a7b);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 21f8843..9470053 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 _0x083b=['post','create','update','delete','/:id','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','index','isAuthenticated','show'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x083b,0x1e7));var _0xb083=function(_0x65c903,_0x41e920){_0x65c903=_0x65c903-0x0;var _0x23e1d7=_0x083b[_0x65c903];return _0x23e1d7;};'use strict';var multer=require(_0xb083('0x0'));var util=require('util');var path=require(_0xb083('0x1'));var express=require('express');var router=express[_0xb083('0x2')]();var auth=require(_0xb083('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xb083('0x4'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xb083('0x5')]);router['get']('/:id',auth[_0xb083('0x6')](),controller[_0xb083('0x7')]);router[_0xb083('0x8')]('/',auth[_0xb083('0x6')](),controller[_0xb083('0x9')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xb083('0xa')]);router[_0xb083('0xb')](_0xb083('0xc'),auth[_0xb083('0x6')](),controller[_0xb083('0xd')]);module[_0xb083('0xe')]=router; \ No newline at end of file +var _0x3bc1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer','util','express','Router'];(function(_0xcd5a3d,_0x3c5b33){var _0xd43207=function(_0x17d976){while(--_0x17d976){_0xcd5a3d['push'](_0xcd5a3d['shift']());}};_0xd43207(++_0x3c5b33);}(_0x3bc1,0x1d0));var _0x13bc=function(_0x18bc81,_0x4c8ba2){_0x18bc81=_0x18bc81-0x0;var _0x5293ca=_0x3bc1[_0x18bc81];return _0x5293ca;};'use strict';var multer=require(_0x13bc('0x0'));var util=require(_0x13bc('0x1'));var path=require('path');var express=require(_0x13bc('0x2'));var router=express[_0x13bc('0x3')]();var auth=require(_0x13bc('0x4'));var interaction=require(_0x13bc('0x5'));var config=require(_0x13bc('0x6'));var controller=require(_0x13bc('0x7'));router[_0x13bc('0x8')]('/',auth['isAuthenticated'](),controller[_0x13bc('0x9')]);router[_0x13bc('0x8')](_0x13bc('0xa'),auth[_0x13bc('0xb')](),controller['show']);router[_0x13bc('0xc')]('/',auth['isAuthenticated'](),controller[_0x13bc('0xd')]);router['put'](_0x13bc('0xa'),auth['isAuthenticated'](),controller[_0x13bc('0xe')]);router[_0x13bc('0xf')](_0x13bc('0xa'),auth[_0x13bc('0xb')](),controller[_0x13bc('0x10')]);module[_0x13bc('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 1b35e36..88ce1e9 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 _0x5ff3=['STRING','ENUM','variable','exports','string','customVariable','keyValue'];(function(_0x26b462,_0x4a2fe2){var _0x5050af=function(_0xf22d68){while(--_0xf22d68){_0x26b462['push'](_0x26b462['shift']());}};_0x5050af(++_0x4a2fe2);}(_0x5ff3,0x17d));var _0x35ff=function(_0x1a2b01,_0x5a668f){_0x1a2b01=_0x1a2b01-0x0;var _0x20f169=_0x5ff3[_0x1a2b01];return _0x20f169;};'use strict';var Sequelize=require('sequelize');module[_0x35ff('0x0')]={'type':{'type':Sequelize['ENUM'](_0x35ff('0x1'),'variable',_0x35ff('0x2'),_0x35ff('0x3')),'defaultValue':_0x35ff('0x1')},'content':{'type':Sequelize[_0x35ff('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x35ff('0x5')](_0x35ff('0x1'),_0x35ff('0x6'),_0x35ff('0x2'))},'keyContent':{'type':Sequelize[_0x35ff('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x35ff('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35ff('0x4')]}}; \ No newline at end of file +var _0x91a7=['STRING','exports','ENUM','string','customVariable'];(function(_0x4c0c6a,_0x13e50e){var _0x1652db=function(_0x4afb11){while(--_0x4afb11){_0x4c0c6a['push'](_0x4c0c6a['shift']());}};_0x1652db(++_0x13e50e);}(_0x91a7,0xe7));var _0x791a=function(_0x1c6ff6,_0x2926d6){_0x1c6ff6=_0x1c6ff6-0x0;var _0x667cca=_0x91a7[_0x1c6ff6];return _0x667cca;};'use strict';var Sequelize=require('sequelize');module[_0x791a('0x0')]={'type':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'),'keyValue'),'defaultValue':_0x791a('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x791a('0x1')](_0x791a('0x2'),'variable',_0x791a('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x791a('0x4')]},'nameField':{'type':Sequelize[_0x791a('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x791a('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 40055d8..e8a576b 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 _0x32b6=['sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','ZendeskField','includeAll','rows','show','params','include','catch','create','body','find','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x32b6,0x1d1));var _0x632b=function(_0x9e5611,_0x47ad4b){_0x9e5611=_0x9e5611-0x0;var _0x3c2664=_0x32b6[_0x9e5611];return _0x3c2664;};'use strict';var jsonpatch=require(_0x632b('0x0'));var rp=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var Mustache=require(_0x632b('0x3'));var util=require('util');var path=require('path');var sox=require(_0x632b('0x4'));var csv=require(_0x632b('0x5'));var ejs=require(_0x632b('0x6'));var fs=require('fs');var _=require(_0x632b('0x7'));var squel=require(_0x632b('0x8'));var crypto=require(_0x632b('0x9'));var jsforce=require(_0x632b('0xa'));var deskjs=require(_0x632b('0xb'));var toCsv=require(_0x632b('0x5'));var querystring=require(_0x632b('0xc'));var Papa=require('papaparse');var qs=require(_0x632b('0xd'));var logger=require(_0x632b('0xe'))(_0x632b('0xf'));var utils=require(_0x632b('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56e7b6,_0x3ce569){_0x3ce569=_0x3ce569||0xcc;return function(_0x484b3a){if(_0x484b3a){return _0x56e7b6[_0x632b('0x11')](_0x3ce569);}return _0x56e7b6[_0x632b('0x12')](_0x3ce569)[_0x632b('0x13')]();};}function respondWithResult(_0x485440,_0x249417){_0x249417=_0x249417||0xc8;return function(_0x2e1dbc){if(_0x2e1dbc){return _0x485440[_0x632b('0x12')](_0x249417)[_0x632b('0x14')](_0x2e1dbc);}};}function respondWithFilteredResult(_0x22c182,_0x536aa2){return function(_0xb5416c){if(_0xb5416c){var _0x286f75=_0xb5416c[_0x632b('0x15')],_0x9246a6=_0x536aa2[_0x632b('0x16')],_0x5a97da=_0x536aa2[_0x632b('0x16')]+_0x536aa2[_0x632b('0x17')],_0x721883;if(_0x5a97da>=_0x286f75){_0x5a97da=_0x286f75;_0x721883=0xc8;}else{_0x721883=0xce;}_0x22c182[_0x632b('0x12')](_0x721883);return _0x22c182['set'](_0x632b('0x18'),_0x9246a6+'-'+_0x5a97da+'/'+_0x286f75)['json'](_0xb5416c);}return null;};}function patchUpdates(_0x4fdef2){return function(_0x1109d5){try{jsonpatch['apply'](_0x1109d5,_0x4fdef2,!![]);}catch(_0x2c8340){return BPromise[_0x632b('0x19')](_0x2c8340);}return _0x1109d5[_0x632b('0x1a')]();};}function saveUpdates(_0x51c894,_0x2f3e88){return function(_0x32ca1){if(_0x32ca1){return _0x32ca1[_0x632b('0x1b')](_0x51c894)[_0x632b('0x1c')](function(_0x5baa04){return _0x5baa04;});}return null;};}function removeEntity(_0x472e34,_0xd9d29f){return function(_0x4f377f){if(_0x4f377f){return _0x4f377f[_0x632b('0x1d')]()['then'](function(){_0x472e34['status'](0xcc)[_0x632b('0x13')]();});}};}function handleEntityNotFound(_0x5ce3fa,_0xc9d237){return function(_0x1c4530){if(!_0x1c4530){_0x5ce3fa[_0x632b('0x11')](0x194);}return _0x1c4530;};}function handleError(_0x540bfb,_0x10fc32){_0x10fc32=_0x10fc32||0x1f4;return function(_0x43cf26){logger['error'](_0x43cf26[_0x632b('0x1e')]);if(_0x43cf26[_0x632b('0x1f')]){delete _0x43cf26[_0x632b('0x1f')];}_0x540bfb[_0x632b('0x12')](_0x10fc32)[_0x632b('0x20')](_0x43cf26);};}exports[_0x632b('0x21')]=function(_0x5ec5ea,_0x5e7b20){var _0x11fe61={},_0x4d3a70={},_0x4ebd26={'count':0x0,'rows':[]};var _0x954fa0=db['ZendeskField'][_0x632b('0x22')];_0x4d3a70[_0x632b('0x23')]=_[_0x632b('0x24')](_0x954fa0);var _0x18dc8c={'dateStart':_0x5ec5ea[_0x632b('0x25')][_0x632b('0x26')],'dateEnd':_0x5ec5ea[_0x632b('0x25')][_0x632b('0x27')]};delete _0x5ec5ea[_0x632b('0x25')]['dateStart'];delete _0x5ec5ea[_0x632b('0x25')][_0x632b('0x27')];_0x4d3a70[_0x632b('0x25')]=_[_0x632b('0x24')](_0x5ec5ea[_0x632b('0x25')]);_0x4d3a70[_0x632b('0x28')]=_[_0x632b('0x29')](_0x4d3a70[_0x632b('0x23')],_0x4d3a70[_0x632b('0x25')]);_0x11fe61[_0x632b('0x2a')]=_[_0x632b('0x29')](_0x4d3a70[_0x632b('0x23')],qs[_0x632b('0x2b')](_0x5ec5ea[_0x632b('0x25')][_0x632b('0x2b')]));_0x11fe61[_0x632b('0x2a')]=_0x11fe61[_0x632b('0x2a')][_0x632b('0x2c')]?_0x11fe61[_0x632b('0x2a')]:_0x4d3a70[_0x632b('0x23')];if(!_0x5ec5ea['query'][_0x632b('0x2d')](_0x632b('0x2e'))){_0x11fe61[_0x632b('0x17')]=qs[_0x632b('0x17')](_0x5ec5ea['query'][_0x632b('0x17')]);_0x11fe61['offset']=qs[_0x632b('0x16')](_0x5ec5ea[_0x632b('0x25')]['offset']);}_0x11fe61[_0x632b('0x2f')]=qs[_0x632b('0x30')](_0x5ec5ea[_0x632b('0x25')][_0x632b('0x30')]);_0x11fe61[_0x632b('0x31')]=qs[_0x632b('0x28')](_[_0x632b('0x32')](_0x5ec5ea[_0x632b('0x25')],_0x4d3a70['filters']));if(_0x18dc8c['dateStart']){if(_0x18dc8c[_0x632b('0x27')]){_0x18dc8c[_0x632b('0x27')]=moment(_0x18dc8c[_0x632b('0x27')])[_0x632b('0x33')](0x1,_0x632b('0x34'));}else{_0x18dc8c[_0x632b('0x27')]=moment(_0x18dc8c[_0x632b('0x26')])[_0x632b('0x33')](0x1,'day');}_['merge'](_0x11fe61[_0x632b('0x31')],{'createdAt':{'$gte':_0x18dc8c['dateStart'],'$lte':_0x18dc8c[_0x632b('0x27')]}});}if(_0x5ec5ea[_0x632b('0x25')][_0x632b('0x35')]){_0x11fe61[_0x632b('0x31')]=_[_0x632b('0x36')](_0x11fe61[_0x632b('0x31')],{'$or':_[_0x632b('0x37')](_0x11fe61[_0x632b('0x2a')],function(_0x2730c2){var _0x3eb3e0={};_0x3eb3e0[_0x2730c2]={'$like':'%'+_0x5ec5ea[_0x632b('0x25')][_0x632b('0x35')]+'%'};return _0x3eb3e0;})});}_0x11fe61=_[_0x632b('0x36')]({},_0x11fe61,_0x5ec5ea[_0x632b('0x38')]);var _0x13beaa={'where':_0x11fe61[_0x632b('0x31')]};return db[_0x632b('0x39')]['count'](_0x13beaa)['then'](function(_0x58e3cc){_0x4ebd26['count']=_0x58e3cc;if(_0x5ec5ea['query'][_0x632b('0x3a')]){_0x11fe61['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x11fe61);})[_0x632b('0x1c')](function(_0x4490d4){_0x4ebd26[_0x632b('0x3b')]=_0x4490d4;return _0x4ebd26;})[_0x632b('0x1c')](respondWithFilteredResult(_0x5e7b20,_0x11fe61))['catch'](handleError(_0x5e7b20,null));};exports[_0x632b('0x3c')]=function(_0x238297,_0x387fce){var _0x4dbe4b={'raw':!![],'where':{'id':_0x238297[_0x632b('0x3d')]['id']}},_0x15bb30={};_0x15bb30[_0x632b('0x23')]=_[_0x632b('0x24')](db[_0x632b('0x39')][_0x632b('0x22')]);_0x15bb30['query']=_[_0x632b('0x24')](_0x238297[_0x632b('0x25')]);_0x15bb30[_0x632b('0x28')]=_[_0x632b('0x29')](_0x15bb30['model'],_0x15bb30['query']);_0x4dbe4b[_0x632b('0x2a')]=_[_0x632b('0x29')](_0x15bb30[_0x632b('0x23')],qs[_0x632b('0x2b')](_0x238297[_0x632b('0x25')][_0x632b('0x2b')]));_0x4dbe4b['attributes']=_0x4dbe4b[_0x632b('0x2a')][_0x632b('0x2c')]?_0x4dbe4b[_0x632b('0x2a')]:_0x15bb30[_0x632b('0x23')];if(_0x238297[_0x632b('0x25')][_0x632b('0x3a')]){_0x4dbe4b[_0x632b('0x3e')]=[{'all':!![]}];}_0x4dbe4b=_[_0x632b('0x36')]({},_0x4dbe4b,_0x238297['options']);return db[_0x632b('0x39')]['find'](_0x4dbe4b)[_0x632b('0x1c')](handleEntityNotFound(_0x387fce,null))['then'](respondWithResult(_0x387fce,null))[_0x632b('0x3f')](handleError(_0x387fce,null));};exports[_0x632b('0x40')]=function(_0x16dfc7,_0x2c4561){return db[_0x632b('0x39')]['create'](_0x16dfc7[_0x632b('0x41')],{})[_0x632b('0x1c')](respondWithResult(_0x2c4561,0xc9))[_0x632b('0x3f')](handleError(_0x2c4561,null));};exports['update']=function(_0x253aec,_0x16eb80){if(_0x253aec[_0x632b('0x41')]['id']){delete _0x253aec[_0x632b('0x41')]['id'];}return db[_0x632b('0x39')]['find']({'where':{'id':_0x253aec[_0x632b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x16eb80,null))[_0x632b('0x1c')](saveUpdates(_0x253aec[_0x632b('0x41')],null))[_0x632b('0x1c')](respondWithResult(_0x16eb80,null))[_0x632b('0x3f')](handleError(_0x16eb80,null));};exports[_0x632b('0x1d')]=function(_0x52785a,_0x4c9b4e){return db[_0x632b('0x39')][_0x632b('0x42')]({'where':{'id':_0x52785a[_0x632b('0x3d')]['id']}})[_0x632b('0x1c')](handleEntityNotFound(_0x4c9b4e,null))[_0x632b('0x1c')](removeEntity(_0x4c9b4e,null))[_0x632b('0x3f')](handleError(_0x4c9b4e,null));}; \ No newline at end of file +var _0xfef3=['rows','catch','show','params','rawAttributes','create','body','find','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','index','keys','dateStart','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','filter','map','options','ZendeskField','count','includeAll','include','findAll'];(function(_0x27dba4,_0x419253){var _0x35ec9d=function(_0x2d13b2){while(--_0x2d13b2){_0x27dba4['push'](_0x27dba4['shift']());}};_0x35ec9d(++_0x419253);}(_0xfef3,0x118));var _0x3fef=function(_0x2a9f4,_0x25c14a){_0x2a9f4=_0x2a9f4-0x0;var _0x3c39e0=_0xfef3[_0x2a9f4];return _0x3c39e0;};'use strict';var jsonpatch=require(_0x3fef('0x0'));var rp=require('request-promise');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3fef('0x2'));var util=require(_0x3fef('0x3'));var path=require('path');var sox=require(_0x3fef('0x4'));var csv=require(_0x3fef('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3fef('0x6'));var squel=require(_0x3fef('0x7'));var crypto=require('crypto');var jsforce=require(_0x3fef('0x8'));var deskjs=require(_0x3fef('0x9'));var toCsv=require(_0x3fef('0x5'));var querystring=require(_0x3fef('0xa'));var Papa=require(_0x3fef('0xb'));var qs=require(_0x3fef('0xc'));var logger=require(_0x3fef('0xd'))(_0x3fef('0xe'));var utils=require(_0x3fef('0xf'));var config=require(_0x3fef('0x10'));var db=require(_0x3fef('0x11'))['db'];function respondWithStatusCode(_0x16252b,_0x1a7ef7){_0x1a7ef7=_0x1a7ef7||0xcc;return function(_0x7cc5b){if(_0x7cc5b){return _0x16252b['sendStatus'](_0x1a7ef7);}return _0x16252b[_0x3fef('0x12')](_0x1a7ef7)[_0x3fef('0x13')]();};}function respondWithResult(_0x11696d,_0x49d216){_0x49d216=_0x49d216||0xc8;return function(_0x1c20b3){if(_0x1c20b3){return _0x11696d['status'](_0x49d216)[_0x3fef('0x14')](_0x1c20b3);}};}function respondWithFilteredResult(_0x3d2c2d,_0x2da64b){return function(_0x5b164c){if(_0x5b164c){var _0x42c3d2=_0x5b164c['count'],_0x4be62f=_0x2da64b[_0x3fef('0x15')],_0x15b757=_0x2da64b[_0x3fef('0x15')]+_0x2da64b[_0x3fef('0x16')],_0x14c053;if(_0x15b757>=_0x42c3d2){_0x15b757=_0x42c3d2;_0x14c053=0xc8;}else{_0x14c053=0xce;}_0x3d2c2d[_0x3fef('0x12')](_0x14c053);return _0x3d2c2d[_0x3fef('0x17')](_0x3fef('0x18'),_0x4be62f+'-'+_0x15b757+'/'+_0x42c3d2)['json'](_0x5b164c);}return null;};}function patchUpdates(_0x1cbdbb){return function(_0x5b969a){try{jsonpatch[_0x3fef('0x19')](_0x5b969a,_0x1cbdbb,!![]);}catch(_0x3f2997){return BPromise[_0x3fef('0x1a')](_0x3f2997);}return _0x5b969a[_0x3fef('0x1b')]();};}function saveUpdates(_0x53d993,_0x36669d){return function(_0x3eb287){if(_0x3eb287){return _0x3eb287['update'](_0x53d993)[_0x3fef('0x1c')](function(_0x51a554){return _0x51a554;});}return null;};}function removeEntity(_0x42e095,_0x218f91){return function(_0x245332){if(_0x245332){return _0x245332[_0x3fef('0x1d')]()[_0x3fef('0x1c')](function(){_0x42e095[_0x3fef('0x12')](0xcc)[_0x3fef('0x13')]();});}};}function handleEntityNotFound(_0xd64bf4,_0x1f5aaf){return function(_0x3bb110){if(!_0x3bb110){_0xd64bf4[_0x3fef('0x1e')](0x194);}return _0x3bb110;};}function handleError(_0x39a8ea,_0x433a3e){_0x433a3e=_0x433a3e||0x1f4;return function(_0x58f6cf){logger['error'](_0x58f6cf['stack']);if(_0x58f6cf[_0x3fef('0x1f')]){delete _0x58f6cf[_0x3fef('0x1f')];}_0x39a8ea[_0x3fef('0x12')](_0x433a3e)['send'](_0x58f6cf);};}exports[_0x3fef('0x20')]=function(_0x56c542,_0x45464b){var _0x2c0848={},_0x64d3e6={},_0xf2b269={'count':0x0,'rows':[]};var _0x30e17a=db['ZendeskField']['rawAttributes'];_0x64d3e6['model']=_[_0x3fef('0x21')](_0x30e17a);var _0x3baa52={'dateStart':_0x56c542['query'][_0x3fef('0x22')],'dateEnd':_0x56c542[_0x3fef('0x23')]['dateEnd']};delete _0x56c542[_0x3fef('0x23')][_0x3fef('0x22')];delete _0x56c542[_0x3fef('0x23')][_0x3fef('0x24')];_0x64d3e6[_0x3fef('0x23')]=_[_0x3fef('0x21')](_0x56c542[_0x3fef('0x23')]);_0x64d3e6['filters']=_[_0x3fef('0x25')](_0x64d3e6[_0x3fef('0x26')],_0x64d3e6[_0x3fef('0x23')]);_0x2c0848[_0x3fef('0x27')]=_['intersection'](_0x64d3e6[_0x3fef('0x26')],qs['fields'](_0x56c542[_0x3fef('0x23')][_0x3fef('0x28')]));_0x2c0848[_0x3fef('0x27')]=_0x2c0848[_0x3fef('0x27')][_0x3fef('0x29')]?_0x2c0848[_0x3fef('0x27')]:_0x64d3e6[_0x3fef('0x26')];if(!_0x56c542[_0x3fef('0x23')][_0x3fef('0x2a')](_0x3fef('0x2b'))){_0x2c0848['limit']=qs['limit'](_0x56c542[_0x3fef('0x23')]['limit']);_0x2c0848[_0x3fef('0x15')]=qs[_0x3fef('0x15')](_0x56c542[_0x3fef('0x23')][_0x3fef('0x15')]);}_0x2c0848[_0x3fef('0x2c')]=qs[_0x3fef('0x2d')](_0x56c542[_0x3fef('0x23')][_0x3fef('0x2d')]);_0x2c0848[_0x3fef('0x2e')]=qs[_0x3fef('0x2f')](_[_0x3fef('0x30')](_0x56c542[_0x3fef('0x23')],_0x64d3e6[_0x3fef('0x2f')]));if(_0x3baa52[_0x3fef('0x22')]){if(_0x3baa52['dateEnd']){_0x3baa52[_0x3fef('0x24')]=moment(_0x3baa52[_0x3fef('0x24')])[_0x3fef('0x31')](0x1,_0x3fef('0x32'));}else{_0x3baa52[_0x3fef('0x24')]=moment(_0x3baa52[_0x3fef('0x22')])['add'](0x1,'day');}_[_0x3fef('0x33')](_0x2c0848[_0x3fef('0x2e')],{'createdAt':{'$gte':_0x3baa52[_0x3fef('0x22')],'$lte':_0x3baa52[_0x3fef('0x24')]}});}if(_0x56c542[_0x3fef('0x23')][_0x3fef('0x34')]){_0x2c0848[_0x3fef('0x2e')]=_[_0x3fef('0x33')](_0x2c0848[_0x3fef('0x2e')],{'$or':_[_0x3fef('0x35')](_0x2c0848[_0x3fef('0x27')],function(_0x560aae){var _0x9c7d86={};_0x9c7d86[_0x560aae]={'$like':'%'+_0x56c542[_0x3fef('0x23')]['filter']+'%'};return _0x9c7d86;})});}_0x2c0848=_['merge']({},_0x2c0848,_0x56c542[_0x3fef('0x36')]);var _0x3dda68={'where':_0x2c0848[_0x3fef('0x2e')]};return db[_0x3fef('0x37')][_0x3fef('0x38')](_0x3dda68)[_0x3fef('0x1c')](function(_0x17aff8){_0xf2b269[_0x3fef('0x38')]=_0x17aff8;if(_0x56c542['query'][_0x3fef('0x39')]){_0x2c0848[_0x3fef('0x3a')]=[{'all':!![]}];}return db[_0x3fef('0x37')][_0x3fef('0x3b')](_0x2c0848);})[_0x3fef('0x1c')](function(_0x2143ec){_0xf2b269[_0x3fef('0x3c')]=_0x2143ec;return _0xf2b269;})[_0x3fef('0x1c')](respondWithFilteredResult(_0x45464b,_0x2c0848))[_0x3fef('0x3d')](handleError(_0x45464b,null));};exports[_0x3fef('0x3e')]=function(_0x12867c,_0x254880){var _0x2e1d7f={'raw':!![],'where':{'id':_0x12867c[_0x3fef('0x3f')]['id']}},_0x15d2c7={};_0x15d2c7['model']=_[_0x3fef('0x21')](db[_0x3fef('0x37')][_0x3fef('0x40')]);_0x15d2c7[_0x3fef('0x23')]=_[_0x3fef('0x21')](_0x12867c[_0x3fef('0x23')]);_0x15d2c7['filters']=_[_0x3fef('0x25')](_0x15d2c7['model'],_0x15d2c7[_0x3fef('0x23')]);_0x2e1d7f[_0x3fef('0x27')]=_['intersection'](_0x15d2c7[_0x3fef('0x26')],qs['fields'](_0x12867c[_0x3fef('0x23')][_0x3fef('0x28')]));_0x2e1d7f[_0x3fef('0x27')]=_0x2e1d7f[_0x3fef('0x27')][_0x3fef('0x29')]?_0x2e1d7f[_0x3fef('0x27')]:_0x15d2c7[_0x3fef('0x26')];if(_0x12867c[_0x3fef('0x23')][_0x3fef('0x39')]){_0x2e1d7f[_0x3fef('0x3a')]=[{'all':!![]}];}_0x2e1d7f=_[_0x3fef('0x33')]({},_0x2e1d7f,_0x12867c[_0x3fef('0x36')]);return db[_0x3fef('0x37')]['find'](_0x2e1d7f)[_0x3fef('0x1c')](handleEntityNotFound(_0x254880,null))[_0x3fef('0x1c')](respondWithResult(_0x254880,null))['catch'](handleError(_0x254880,null));};exports[_0x3fef('0x41')]=function(_0x4210d6,_0x2f00c0){return db['ZendeskField'][_0x3fef('0x41')](_0x4210d6[_0x3fef('0x42')],{})['then'](respondWithResult(_0x2f00c0,0xc9))[_0x3fef('0x3d')](handleError(_0x2f00c0,null));};exports['update']=function(_0x48322c,_0x15fb2c){if(_0x48322c['body']['id']){delete _0x48322c[_0x3fef('0x42')]['id'];}return db[_0x3fef('0x37')]['find']({'where':{'id':_0x48322c[_0x3fef('0x3f')]['id']}})[_0x3fef('0x1c')](handleEntityNotFound(_0x15fb2c,null))[_0x3fef('0x1c')](saveUpdates(_0x48322c['body'],null))[_0x3fef('0x1c')](respondWithResult(_0x15fb2c,null))[_0x3fef('0x3d')](handleError(_0x15fb2c,null));};exports[_0x3fef('0x1d')]=function(_0x5b1acb,_0x324f70){return db[_0x3fef('0x37')][_0x3fef('0x43')]({'where':{'id':_0x5b1acb[_0x3fef('0x3f')]['id']}})[_0x3fef('0x1c')](handleEntityNotFound(_0x324f70,null))['then'](removeEntity(_0x324f70,null))[_0x3fef('0x3d')](handleError(_0x324f70,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 239b56b..966bd2e 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 _0xaf1d=['define','ZendeskField','../../config/logger','api','./intZendeskField.attributes'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0xaf1d,0x1d8));var _0xdaf1=function(_0x43479c,_0x230bc3){_0x43479c=_0x43479c-0x0;var _0x4ed5dd=_0xaf1d[_0x43479c];return _0x4ed5dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdaf1('0x0'))(_0xdaf1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xdaf1('0x2'));module['exports']=function(_0x4ecfe3,_0x57e7df){return _0x4ecfe3[_0xdaf1('0x3')](_0xdaf1('0x4'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb094=['lodash','util','../../config/logger','bluebird','request-promise','./intZendeskField.attributes','int_zendesk_fields'];(function(_0x454ab7,_0x1d3745){var _0x4baa7f=function(_0x3343dd){while(--_0x3343dd){_0x454ab7['push'](_0x454ab7['shift']());}};_0x4baa7f(++_0x1d3745);}(_0xb094,0xee));var _0x4b09=function(_0x317fdc,_0x53096e){_0x317fdc=_0x317fdc-0x0;var _0x3786ea=_0xb094[_0x317fdc];return _0x3786ea;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var logger=require(_0x4b09('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4b09('0x3'));var rp=require(_0x4b09('0x4'));var attributes=require(_0x4b09('0x5'));module['exports']=function(_0x45488b,_0x4e1ee3){return _0x45488b['define']('ZendeskField',attributes,{'tableName':_0x4b09('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index fbae954..30b7183 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 _0x009e=['util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','request','info','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x009e,0xe9));var _0xe009=function(_0x5510f5,_0xfd5f3c){_0x5510f5=_0x5510f5-0x0;var _0x5cabb2=_0x009e[_0x5510f5];return _0x5cabb2;};'use strict';var _=require(_0xe009('0x0'));var util=require(_0xe009('0x1'));var moment=require(_0xe009('0x2'));var BPromise=require(_0xe009('0x3'));var rs=require(_0xe009('0x4'));var fs=require('fs');var db=require(_0xe009('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe009('0x6'));var config=require('../../config/environment');var jayson=require(_0xe009('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fede6,_0x39d5b7,_0x47dd33){return new BPromise(function(_0x24400c,_0x5e0a37){return client[_0xe009('0x8')](_0x3fede6,_0x47dd33)['then'](function(_0x4a43a4){logger[_0xe009('0x9')]('ZendeskField,\x20%s,\x20%s',_0x39d5b7,_0xe009('0xa'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x39d5b7,'request\x20sent',JSON[_0xe009('0xb')](_0x4a43a4));if(_0x4a43a4['error']){if(_0x4a43a4[_0xe009('0xc')][_0xe009('0xd')]===0x1f4){logger['error'](_0xe009('0xe'),_0x39d5b7,_0x4a43a4[_0xe009('0xc')][_0xe009('0xf')]);return _0x5e0a37(_0x4a43a4[_0xe009('0xc')]['message']);}logger[_0xe009('0xc')]('ZendeskField,\x20%s,\x20%s',_0x39d5b7,_0x4a43a4[_0xe009('0xc')][_0xe009('0xf')]);return _0x24400c(_0x4a43a4[_0xe009('0xc')][_0xe009('0xf')]);}else{logger[_0xe009('0x9')]('ZendeskField,\x20%s,\x20%s',_0x39d5b7,_0xe009('0xa'));_0x24400c(_0x4a43a4[_0xe009('0x10')][_0xe009('0xf')]);}})[_0xe009('0x11')](function(_0x3a88c0){logger['error']('ZendeskField,\x20%s,\x20%s',_0x39d5b7,_0x3a88c0);_0x5e0a37(_0x3a88c0);});});} \ No newline at end of file +var _0x7a2b=['http','request','then','info','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','ZendeskField,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7a2b,0x189));var _0xb7a2=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7a2b[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0xb7a2('0x0'));var moment=require('moment');var BPromise=require(_0xb7a2('0x1'));var rs=require(_0xb7a2('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xb7a2('0x3'));var logger=require(_0xb7a2('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb7a2('0x5'));var client=jayson[_0xb7a2('0x6')][_0xb7a2('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5dfe52,_0x3fbd79,_0x442260){return new BPromise(function(_0x570592,_0x3a8b04){return client[_0xb7a2('0x8')](_0x5dfe52,_0x442260)[_0xb7a2('0x9')](function(_0x1deb0a){logger[_0xb7a2('0xa')]('ZendeskField,\x20%s,\x20%s',_0x3fbd79,_0xb7a2('0xb'));logger[_0xb7a2('0xc')](_0xb7a2('0xd'),_0x3fbd79,_0xb7a2('0xb'),JSON['stringify'](_0x1deb0a));if(_0x1deb0a[_0xb7a2('0xe')]){if(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0xf')]===0x1f4){logger['error'](_0xb7a2('0x10'),_0x3fbd79,_0x1deb0a['error'][_0xb7a2('0x11')]);return _0x3a8b04(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0x11')]);}logger[_0xb7a2('0xe')](_0xb7a2('0x10'),_0x3fbd79,_0x1deb0a['error'][_0xb7a2('0x11')]);return _0x570592(_0x1deb0a[_0xb7a2('0xe')][_0xb7a2('0x11')]);}else{logger[_0xb7a2('0xa')]('ZendeskField,\x20%s,\x20%s',_0x3fbd79,_0xb7a2('0xb'));_0x570592(_0x1deb0a[_0xb7a2('0x12')]['message']);}})[_0xb7a2('0x13')](function(_0x32e7c1){logger[_0xb7a2('0xe')](_0xb7a2('0x10'),_0x3fbd79,_0x32e7c1);_0x3a8b04(_0x32e7c1);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 26ffe26..3360841 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 _0xd51f=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','destroy','multer','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','/:id','isAuthenticated','show'];(function(_0x36de10,_0xfe25e8){var _0x58100f=function(_0x1fee3f){while(--_0x1fee3f){_0x36de10['push'](_0x36de10['shift']());}};_0x58100f(++_0xfe25e8);}(_0xd51f,0x129));var _0xfd51=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd51f[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0xfd51('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0xfd51('0x1')]();var auth=require(_0xfd51('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xfd51('0x3'));var controller=require(_0xfd51('0x4'));router[_0xfd51('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfd51('0x5')](_0xfd51('0x6'),auth[_0xfd51('0x7')](),controller[_0xfd51('0x8')]);router['get'](_0xfd51('0x9'),auth[_0xfd51('0x7')](),controller[_0xfd51('0xa')]);router[_0xfd51('0x5')](_0xfd51('0xb'),auth[_0xfd51('0x7')](),controller[_0xfd51('0xc')]);router['post']('/',auth[_0xfd51('0x7')](),controller['create']);router[_0xfd51('0xd')]('/:id/configurations',auth[_0xfd51('0x7')](),controller[_0xfd51('0xe')]);router[_0xfd51('0xf')](_0xfd51('0x6'),auth[_0xfd51('0x7')](),controller[_0xfd51('0x10')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfd51('0x11')]);module['exports']=router; \ No newline at end of file +var _0xcccc=['multer','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','destroy','exports'];(function(_0x1790a6,_0x5c9bfb){var _0x46c345=function(_0x3604ac){while(--_0x3604ac){_0x1790a6['push'](_0x1790a6['shift']());}};_0x46c345(++_0x5c9bfb);}(_0xcccc,0x143));var _0xcccc=function(_0x1dad92,_0x2f948c){_0x1dad92=_0x1dad92-0x0;var _0x90a9f6=_0xcccc[_0x1dad92];return _0x90a9f6;};'use strict';var multer=require(_0xcccc('0x0'));var util=require('util');var path=require('path');var express=require(_0xcccc('0x1'));var router=express[_0xcccc('0x2')]();var auth=require(_0xcccc('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcccc('0x4'));var controller=require('./intZohoAccount.controller');router[_0xcccc('0x5')]('/',auth[_0xcccc('0x6')](),controller[_0xcccc('0x7')]);router[_0xcccc('0x5')](_0xcccc('0x8'),auth[_0xcccc('0x6')](),controller[_0xcccc('0x9')]);router[_0xcccc('0x5')](_0xcccc('0xa'),auth[_0xcccc('0x6')](),controller[_0xcccc('0xb')]);router[_0xcccc('0x5')](_0xcccc('0xc'),auth['isAuthenticated'](),controller[_0xcccc('0xd')]);router[_0xcccc('0xe')]('/',auth[_0xcccc('0x6')](),controller[_0xcccc('0xf')]);router[_0xcccc('0xe')](_0xcccc('0xa'),auth[_0xcccc('0x6')](),controller['addConfiguration']);router[_0xcccc('0x10')]('/:id',auth[_0xcccc('0x6')](),controller['update']);router['delete'](_0xcccc('0x8'),auth[_0xcccc('0x6')](),controller[_0xcccc('0x11')]);module[_0xcccc('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 68e93d2..7008538 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 _0x22a9=['STRING','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x22a9,0x10b));var _0x922a=function(_0x2556f7,_0x2f0611){_0x2556f7=_0x2556f7-0x0;var _0xd0fb19=_0x22a9[_0x2556f7];return _0xd0fb19;};'use strict';var Sequelize=require(_0x922a('0x0'));module['exports']={'name':{'type':Sequelize[_0x922a('0x1')]},'description':{'type':Sequelize[_0x922a('0x1')]},'authToken':{'type':Sequelize[_0x922a('0x1')]},'host':{'type':Sequelize[_0x922a('0x1')]},'serverUrl':{'type':Sequelize[_0x922a('0x1')]}}; \ No newline at end of file +var _0x238d=['sequelize','STRING'];(function(_0x57338e,_0x49889f){var _0x3da2b7=function(_0xd32650){while(--_0xd32650){_0x57338e['push'](_0x57338e['shift']());}};_0x3da2b7(++_0x49889f);}(_0x238d,0x104));var _0xd238=function(_0x4dc7b8,_0x174337){_0x4dc7b8=_0x4dc7b8-0x0;var _0x5433df=_0x238d[_0x4dc7b8];return _0x5433df;};'use strict';var Sequelize=require(_0xd238('0x0'));module['exports']={'name':{'type':Sequelize[_0xd238('0x1')]},'description':{'type':Sequelize[_0xd238('0x1')]},'authToken':{'type':Sequelize[_0xd238('0x1')]},'host':{'type':Sequelize[_0xd238('0x1')]},'serverUrl':{'type':Sequelize[_0xd238('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index a2715b5..de1d000 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 _0x34bb=['statusCode','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','ZohoAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','count','offset','limit','json','reject','save','destroy','name','send','ZohoAccount','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','map','filter','includeAll','include','findAll','params','length','find','create','body','update','ZohoConfiguration','rawAttributes','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoField','findOne','host','authToken','GET','format','response','Calls','section','Call\x20Purpose','label','customfield','true','Pick\x20List','val','test','getFields'];(function(_0x14ff95,_0xe1af9b){var _0x85e2a8=function(_0x51509e){while(--_0x51509e){_0x14ff95['push'](_0x14ff95['shift']());}};_0x85e2a8(++_0xe1af9b);}(_0x34bb,0x12a));var _0xb34b=function(_0x41e565,_0x170d15){_0x41e565=_0x41e565-0x0;var _0x449739=_0x34bb[_0x41e565];return _0x449739;};'use strict';var jsonpatch=require(_0xb34b('0x0'));var rp=require(_0xb34b('0x1'));var moment=require('moment');var BPromise=require(_0xb34b('0x2'));var Mustache=require(_0xb34b('0x3'));var util=require(_0xb34b('0x4'));var path=require(_0xb34b('0x5'));var sox=require(_0xb34b('0x6'));var csv=require('to-csv');var ejs=require(_0xb34b('0x7'));var fs=require('fs');var _=require(_0xb34b('0x8'));var squel=require(_0xb34b('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb34b('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xb34b('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0xb34b('0xc'));var config=require(_0xb34b('0xd'));var db=require(_0xb34b('0xe'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0xb34b('0xf'));var client=jayson[_0xb34b('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4781d4,_0x3fb350,_0x41ac52,_0x104e01){return new BPromise(function(_0x5edb7a,_0x55b2fc){var _0xee934=_0x104e01||client;return _0xee934[_0xb34b('0x11')](_0x4781d4,_0x41ac52)[_0xb34b('0x12')](function(_0x2bfd65){logger[_0xb34b('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x3fb350,_0xb34b('0x14'));logger[_0xb34b('0x15')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x3fb350,_0xb34b('0x14'),JSON[_0xb34b('0x16')](_0x2bfd65));if(_0x2bfd65[_0xb34b('0x17')]){if(_0x2bfd65['error']['code']===0x1f4){logger[_0xb34b('0x17')](_0xb34b('0x18'),_0x3fb350,_0x2bfd65[_0xb34b('0x17')][_0xb34b('0x19')]);return _0x55b2fc(_0x2bfd65[_0xb34b('0x17')][_0xb34b('0x19')]);}logger['error'](_0xb34b('0x18'),_0x3fb350,_0x2bfd65[_0xb34b('0x17')][_0xb34b('0x19')]);return _0x5edb7a(_0x2bfd65['error']['message']);}else{logger[_0xb34b('0x13')](_0xb34b('0x18'),_0x3fb350,_0xb34b('0x14'));_0x5edb7a(_0x2bfd65[_0xb34b('0x1a')]['message']);}})[_0xb34b('0x1b')](function(_0x4675d2){logger[_0xb34b('0x17')](_0xb34b('0x18'),_0x3fb350,_0x4675d2);_0x55b2fc(_0x4675d2);});});}function respondWithStatusCode(_0x9ea0a,_0x584b07){_0x584b07=_0x584b07||0xcc;return function(_0x2b3dd3){if(_0x2b3dd3){return _0x9ea0a[_0xb34b('0x1c')](_0x584b07);}return _0x9ea0a[_0xb34b('0x1d')](_0x584b07)[_0xb34b('0x1e')]();};}function respondWithResult(_0x25e564,_0x3697ac){_0x3697ac=_0x3697ac||0xc8;return function(_0x30e893){if(_0x30e893){return _0x25e564[_0xb34b('0x1d')](_0x3697ac)['json'](_0x30e893);}};}function respondWithFilteredResult(_0x1729fd,_0x1d2272){return function(_0x594906){if(_0x594906){var _0x95277d=_0x594906[_0xb34b('0x1f')],_0x1440b6=_0x1d2272[_0xb34b('0x20')],_0x1db303=_0x1d2272[_0xb34b('0x20')]+_0x1d2272[_0xb34b('0x21')],_0x2cce79;if(_0x1db303>=_0x95277d){_0x1db303=_0x95277d;_0x2cce79=0xc8;}else{_0x2cce79=0xce;}_0x1729fd['status'](_0x2cce79);return _0x1729fd['set']('Content-Range',_0x1440b6+'-'+_0x1db303+'/'+_0x95277d)[_0xb34b('0x22')](_0x594906);}return null;};}function patchUpdates(_0x31dba5){return function(_0x3d543d){try{jsonpatch['apply'](_0x3d543d,_0x31dba5,!![]);}catch(_0x382092){return BPromise[_0xb34b('0x23')](_0x382092);}return _0x3d543d[_0xb34b('0x24')]();};}function saveUpdates(_0x233a00,_0x114657){return function(_0x518a5a){if(_0x518a5a){return _0x518a5a['update'](_0x233a00)[_0xb34b('0x12')](function(_0x48b5d5){return _0x48b5d5;});}return null;};}function removeEntity(_0x50c066,_0x30597a){return function(_0x5432ea){if(_0x5432ea){return _0x5432ea[_0xb34b('0x25')]()[_0xb34b('0x12')](function(){_0x50c066[_0xb34b('0x1d')](0xcc)[_0xb34b('0x1e')]();});}};}function handleEntityNotFound(_0x3ebd73,_0x3e255b){return function(_0x32320e){if(!_0x32320e){_0x3ebd73['sendStatus'](0x194);}return _0x32320e;};}function handleError(_0x14a679,_0x5cda25){_0x5cda25=_0x5cda25||0x1f4;return function(_0x526198){logger[_0xb34b('0x17')](_0x526198['stack']);if(_0x526198[_0xb34b('0x26')]){delete _0x526198['name'];}_0x14a679[_0xb34b('0x1d')](_0x5cda25)[_0xb34b('0x27')](_0x526198);};}exports['index']=function(_0xdb6549,_0x1caac1){var _0x552044={},_0x1ba3b1={},_0x5598b5={'count':0x0,'rows':[]};var _0x256913=db[_0xb34b('0x28')]['rawAttributes'];_0x1ba3b1[_0xb34b('0x29')]=_[_0xb34b('0x2a')](_0x256913);var _0x5853f0={'dateStart':_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x2c')],'dateEnd':_0xdb6549[_0xb34b('0x2b')]['dateEnd']};delete _0xdb6549[_0xb34b('0x2b')][_0xb34b('0x2c')];delete _0xdb6549[_0xb34b('0x2b')][_0xb34b('0x2d')];_0x1ba3b1[_0xb34b('0x2b')]=_['keys'](_0xdb6549[_0xb34b('0x2b')]);_0x1ba3b1[_0xb34b('0x2e')]=_[_0xb34b('0x2f')](_0x1ba3b1[_0xb34b('0x29')],_0x1ba3b1['query']);_0x552044[_0xb34b('0x30')]=_['intersection'](_0x1ba3b1[_0xb34b('0x29')],qs['fields'](_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x31')]));_0x552044[_0xb34b('0x30')]=_0x552044[_0xb34b('0x30')]['length']?_0x552044[_0xb34b('0x30')]:_0x1ba3b1['model'];if(!_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x32')](_0xb34b('0x33'))){_0x552044[_0xb34b('0x21')]=qs['limit'](_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x21')]);_0x552044[_0xb34b('0x20')]=qs[_0xb34b('0x20')](_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x20')]);}_0x552044[_0xb34b('0x34')]=qs[_0xb34b('0x35')](_0xdb6549[_0xb34b('0x2b')]['sort']);_0x552044['where']=qs[_0xb34b('0x2e')](_[_0xb34b('0x36')](_0xdb6549['query'],_0x1ba3b1['filters']));if(_0x5853f0[_0xb34b('0x2c')]){if(_0x5853f0[_0xb34b('0x2d')]){_0x5853f0[_0xb34b('0x2d')]=moment(_0x5853f0[_0xb34b('0x2d')])['add'](0x1,_0xb34b('0x37'));}else{_0x5853f0[_0xb34b('0x2d')]=moment(_0x5853f0[_0xb34b('0x2c')])[_0xb34b('0x38')](0x1,'day');}_[_0xb34b('0x39')](_0x552044[_0xb34b('0x3a')],{'createdAt':{'$gte':_0x5853f0[_0xb34b('0x2c')],'$lte':_0x5853f0[_0xb34b('0x2d')]}});}if(_0xdb6549['query']['filter']){_0x552044[_0xb34b('0x3a')]=_[_0xb34b('0x39')](_0x552044[_0xb34b('0x3a')],{'$or':_[_0xb34b('0x3b')](_0x552044[_0xb34b('0x30')],function(_0xa980e1){var _0x51312d={};_0x51312d[_0xa980e1]={'$like':'%'+_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x3c')]+'%'};return _0x51312d;})});}_0x552044=_[_0xb34b('0x39')]({},_0x552044,_0xdb6549['options']);var _0x3106d2={'where':_0x552044['where']};return db['ZohoAccount'][_0xb34b('0x1f')](_0x3106d2)[_0xb34b('0x12')](function(_0x4df8d0){_0x5598b5[_0xb34b('0x1f')]=_0x4df8d0;if(_0xdb6549[_0xb34b('0x2b')][_0xb34b('0x3d')]){_0x552044[_0xb34b('0x3e')]=[{'all':!![]}];}return db[_0xb34b('0x28')][_0xb34b('0x3f')](_0x552044);})['then'](function(_0xd50627){_0x5598b5['rows']=_0xd50627;return _0x5598b5;})[_0xb34b('0x12')](respondWithFilteredResult(_0x1caac1,_0x552044))[_0xb34b('0x1b')](handleError(_0x1caac1,null));};exports['show']=function(_0x2c40c5,_0x238b38){var _0x4faa5f={'raw':![],'where':{'id':_0x2c40c5[_0xb34b('0x40')]['id']}},_0x2421f9={};_0x2421f9[_0xb34b('0x29')]=_[_0xb34b('0x2a')](db[_0xb34b('0x28')]['rawAttributes']);_0x2421f9[_0xb34b('0x2b')]=_[_0xb34b('0x2a')](_0x2c40c5[_0xb34b('0x2b')]);_0x2421f9['filters']=_['intersection'](_0x2421f9[_0xb34b('0x29')],_0x2421f9[_0xb34b('0x2b')]);_0x4faa5f[_0xb34b('0x30')]=_[_0xb34b('0x2f')](_0x2421f9[_0xb34b('0x29')],qs['fields'](_0x2c40c5[_0xb34b('0x2b')]['fields']));_0x4faa5f[_0xb34b('0x30')]=_0x4faa5f[_0xb34b('0x30')][_0xb34b('0x41')]?_0x4faa5f[_0xb34b('0x30')]:_0x2421f9[_0xb34b('0x29')];if(_0x2c40c5[_0xb34b('0x2b')][_0xb34b('0x3d')]){_0x4faa5f[_0xb34b('0x3e')]=[{'all':!![]}];}_0x4faa5f=_['merge']({},_0x4faa5f,_0x2c40c5['options']);return db[_0xb34b('0x28')][_0xb34b('0x42')](_0x4faa5f)['then'](handleEntityNotFound(_0x238b38,null))[_0xb34b('0x12')](respondWithResult(_0x238b38,null))[_0xb34b('0x1b')](handleError(_0x238b38,null));};exports[_0xb34b('0x43')]=function(_0x335437,_0xa8b019){return db[_0xb34b('0x28')][_0xb34b('0x43')](_0x335437[_0xb34b('0x44')],{})[_0xb34b('0x12')](respondWithResult(_0xa8b019,0xc9))[_0xb34b('0x1b')](handleError(_0xa8b019,null));};exports[_0xb34b('0x45')]=function(_0x3c1604,_0x8bbc2d){if(_0x3c1604[_0xb34b('0x44')]['id']){delete _0x3c1604[_0xb34b('0x44')]['id'];}return db[_0xb34b('0x28')][_0xb34b('0x42')]({'where':{'id':_0x3c1604[_0xb34b('0x40')]['id']}})[_0xb34b('0x12')](handleEntityNotFound(_0x8bbc2d,null))[_0xb34b('0x12')](saveUpdates(_0x3c1604[_0xb34b('0x44')],null))[_0xb34b('0x12')](respondWithResult(_0x8bbc2d,null))[_0xb34b('0x1b')](handleError(_0x8bbc2d,null));};exports[_0xb34b('0x25')]=function(_0x150003,_0x2304e1){return db[_0xb34b('0x28')]['find']({'where':{'id':_0x150003[_0xb34b('0x40')]['id']}})['then'](handleEntityNotFound(_0x2304e1,null))[_0xb34b('0x12')](removeEntity(_0x2304e1,null))[_0xb34b('0x1b')](handleError(_0x2304e1,null));};exports['getConfigurations']=function(_0x570c6e,_0x232716,_0x4d1fb2){var _0x5eca7c={};var _0x309149={};var _0x10de93;var _0x111be7;return db[_0xb34b('0x28')]['findOne']({'where':{'id':_0x570c6e[_0xb34b('0x40')]['id']}})[_0xb34b('0x12')](handleEntityNotFound(_0x232716,null))[_0xb34b('0x12')](function(_0x5eb412){if(_0x5eb412){_0x10de93=_0x5eb412;_0x309149[_0xb34b('0x29')]=_[_0xb34b('0x2a')](db[_0xb34b('0x46')][_0xb34b('0x47')]);_0x309149[_0xb34b('0x2b')]=_[_0xb34b('0x2a')](_0x570c6e[_0xb34b('0x2b')]);_0x309149[_0xb34b('0x2e')]=_['intersection'](_0x309149['model'],_0x309149[_0xb34b('0x2b')]);_0x5eca7c['attributes']=_[_0xb34b('0x2f')](_0x309149['model'],qs[_0xb34b('0x31')](_0x570c6e[_0xb34b('0x2b')][_0xb34b('0x31')]));_0x5eca7c['attributes']=_0x5eca7c[_0xb34b('0x30')][_0xb34b('0x41')]?_0x5eca7c[_0xb34b('0x30')]:_0x309149[_0xb34b('0x29')];_0x5eca7c[_0xb34b('0x34')]=qs[_0xb34b('0x35')](_0x570c6e[_0xb34b('0x2b')]['sort']);_0x5eca7c[_0xb34b('0x3a')]=qs[_0xb34b('0x2e')](_[_0xb34b('0x36')](_0x570c6e[_0xb34b('0x2b')],_0x309149[_0xb34b('0x2e')]));if(_0x570c6e[_0xb34b('0x2b')]['filter']){_0x5eca7c['where']=_[_0xb34b('0x39')](_0x5eca7c[_0xb34b('0x3a')],{'$or':_['map'](_0x5eca7c[_0xb34b('0x30')],function(_0x3a17a0){var _0x47fa5e={};_0x47fa5e[_0x3a17a0]={'$like':'%'+_0x570c6e['query'][_0xb34b('0x3c')]+'%'};return _0x47fa5e;})});}_0x5eca7c=_[_0xb34b('0x39')]({},_0x5eca7c,_0x570c6e['options']);return _0x10de93['getConfigurations'](_0x5eca7c);}})['then'](function(_0x1c542d){if(_0x1c542d){_0x111be7=_0x1c542d[_0xb34b('0x41')];if(!_0x570c6e[_0xb34b('0x2b')]['hasOwnProperty'](_0xb34b('0x33'))){_0x5eca7c[_0xb34b('0x21')]=qs['limit'](_0x570c6e['query'][_0xb34b('0x21')]);_0x5eca7c['offset']=qs[_0xb34b('0x20')](_0x570c6e['query'][_0xb34b('0x20')]);}return _0x10de93[_0xb34b('0x48')](_0x5eca7c);}})['then'](function(_0x4058dc){if(_0x4058dc){return _0x4058dc?{'count':_0x111be7,'rows':_0x4058dc}:null;}})[_0xb34b('0x12')](respondWithResult(_0x232716,null))[_0xb34b('0x1b')](handleError(_0x232716,null));};exports[_0xb34b('0x49')]=function(_0x12b7ae,_0x800742,_0x27b1c0){if(_0x12b7ae[_0xb34b('0x44')]['id']){delete _0x12b7ae[_0xb34b('0x44')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x12b7ae[_0xb34b('0x40')]['id']}})[_0xb34b('0x12')](handleEntityNotFound(_0x800742,null))[_0xb34b('0x12')](function(_0x166158){if(_0x166158){_0x12b7ae[_0xb34b('0x44')][_0xb34b('0x4a')]=_0x166158['id'];_0x12b7ae[_0xb34b('0x44')][_0xb34b('0x4b')]=integrations[_0xb34b('0x4c')](_0x12b7ae[_0xb34b('0x44')][_0xb34b('0x4d')],_0x12b7ae[_0xb34b('0x44')][_0xb34b('0x4e')]);_0x12b7ae[_0xb34b('0x44')][_0xb34b('0x4f')]=integrations[_0xb34b('0x50')](_0x12b7ae[_0xb34b('0x44')]['channel'],_0x12b7ae[_0xb34b('0x44')]['type']);return db[_0xb34b('0x46')][_0xb34b('0x43')](_0x12b7ae[_0xb34b('0x44')],{'include':[{'model':db[_0xb34b('0x51')],'as':_0xb34b('0x4b')},{'model':db[_0xb34b('0x51')],'as':'Descriptions'}]});}return null;})[_0xb34b('0x12')](respondWithResult(_0x800742,null))['catch'](handleError(_0x800742,null));};exports['getFields']=function(_0x367ada,_0x41cad8,_0x1769ba){return db['ZohoAccount'][_0xb34b('0x52')]({'where':{'id':_0x367ada[_0xb34b('0x40')]['id']},'attributes':['id',_0xb34b('0x53'),_0xb34b('0x54')]})['then'](handleEntityNotFound(_0x41cad8,null))['then'](function(_0x3947cf){if(_0x3947cf){return rp({'method':_0xb34b('0x55'),'uri':util[_0xb34b('0x56')]('https://crm.%s/crm/private/json/Calls/getFields',_0x3947cf[_0xb34b('0x53')]),'qs':{'authtoken':_0x3947cf['authToken'],'scope':'crmapi'},'json':!![]});}})[_0xb34b('0x12')](function(_0x52c08a){if(_0x52c08a){if(_0x52c08a['response']&&_0x52c08a[_0xb34b('0x57')]['error']){throw new Error(_0x52c08a['response'][_0xb34b('0x17')][_0xb34b('0x19')]);}var _0xa98ddb=[];if(_0x52c08a[_0xb34b('0x58')]&&_0x52c08a[_0xb34b('0x58')][_0xb34b('0x59')]){if(_0x52c08a[_0xb34b('0x58')]['section']['FL']){var _0x2c4bd6=[_0xb34b('0x5a')];for(var _0x3d45e8=0x0,_0x4c8c29=_0x52c08a['Calls'][_0xb34b('0x59')]['FL'][_0xb34b('0x41')];_0x3d45e8<_0x4c8c29;_0x3d45e8++){if(_['includes'](_0x2c4bd6,_0x52c08a[_0xb34b('0x58')][_0xb34b('0x59')]['FL'][_0x3d45e8]['dv'])){_0xa98ddb['push']({'id':_0x52c08a['Calls'][_0xb34b('0x59')]['FL'][_0x3d45e8]['dv'],'name':_0x52c08a[_0xb34b('0x58')][_0xb34b('0x59')]['FL'][_0x3d45e8][_0xb34b('0x5b')],'custom':_0x52c08a['Calls']['section']['FL'][_0x3d45e8][_0xb34b('0x5c')]===_0xb34b('0x5d')?!![]:![],'options':_0x52c08a[_0xb34b('0x58')]['section']['FL'][_0x3d45e8][_0xb34b('0x4e')]===_0xb34b('0x5e')&&_0x52c08a['Calls'][_0xb34b('0x59')]['FL'][_0x3d45e8][_0xb34b('0x5f')]?_['map'](_0x52c08a['Calls'][_0xb34b('0x59')]['FL'][_0x3d45e8][_0xb34b('0x5f')],function(_0x116e4a){return{'name':_0x116e4a,'value':_0x116e4a};}):[]});}}}}return{'count':_0xa98ddb[_0xb34b('0x41')],'rows':_0xa98ddb};}})[_0xb34b('0x12')](respondWithResult(_0x41cad8,null))[_0xb34b('0x1b')](function(_0x1b5f1d){var _0x4bc579=_0x367ada[_0xb34b('0x2b')][_0xb34b('0x60')]?0x1f4:_0x1b5f1d['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xb34b('0x61'),_0x4bc579,JSON[_0xb34b('0x16')](_0x1b5f1d));delete _0x1b5f1d[_0xb34b('0x26')];if(_0x4bc579===0x191){_0x4bc579=0x190;}_0x41cad8['status'](_0x4bc579)[_0xb34b('0x27')](_0x367ada['query'][_0xb34b('0x60')]?{'message':'Wrong\x20credentials','statusCode':_0x1b5f1d[_0xb34b('0x62')]}:_0x1b5f1d);});}; \ No newline at end of file +var _0x2eac=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','dateStart','day','merge','filter','map','options','includeAll','include','findAll','show','keys','find','create','body','params','getConfigurations','findOne','ZohoConfiguration','addConfiguration','getSubjects','type','Descriptions','getDescriptions','ZohoField','host','authToken','format','https://crm.%s/crm/private/json/Calls/getFields','crmapi','response','Calls','section','Call\x20Purpose','includes','push','label','customfield','Pick\x20List','val','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','../../components/integrations/configuration','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','ZohoAccount','rawAttributes','model','query','dateEnd'];(function(_0x404238,_0x12a383){var _0x253b29=function(_0x33ebad){while(--_0x33ebad){_0x404238['push'](_0x404238['shift']());}};_0x253b29(++_0x12a383);}(_0x2eac,0x108));var _0xc2ea=function(_0x357a32,_0x330db8){_0x357a32=_0x357a32-0x0;var _0x16233b=_0x2eac[_0x357a32];return _0x16233b;};'use strict';var jsonpatch=require(_0xc2ea('0x0'));var rp=require(_0xc2ea('0x1'));var moment=require(_0xc2ea('0x2'));var BPromise=require(_0xc2ea('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc2ea('0x4'));var sox=require(_0xc2ea('0x5'));var csv=require(_0xc2ea('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xc2ea('0x7'));var crypto=require('crypto');var jsforce=require(_0xc2ea('0x8'));var deskjs=require(_0xc2ea('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc2ea('0xa'));var Papa=require(_0xc2ea('0xb'));var qs=require(_0xc2ea('0xc'));var logger=require(_0xc2ea('0xd'))('api');var utils=require('../../config/utils');var config=require(_0xc2ea('0xe'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc2ea('0xf'));var jayson=require(_0xc2ea('0x10'));var client=jayson[_0xc2ea('0x11')][_0xc2ea('0x12')]({'port':0x232a});function respondWithRpcPromise(_0xb1dfb3,_0x39e3d8,_0x6794f1,_0x55802f){return new BPromise(function(_0x23e44f,_0x4ef2fe){var _0x3de153=_0x55802f||client;return _0x3de153[_0xc2ea('0x13')](_0xb1dfb3,_0x6794f1)[_0xc2ea('0x14')](function(_0x56feff){logger['info'](_0xc2ea('0x15'),_0x39e3d8,_0xc2ea('0x16'));logger[_0xc2ea('0x17')](_0xc2ea('0x18'),_0x39e3d8,'request\x20sent',JSON[_0xc2ea('0x19')](_0x56feff));if(_0x56feff[_0xc2ea('0x1a')]){if(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1b')]===0x1f4){logger['error'](_0xc2ea('0x15'),_0x39e3d8,_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);return _0x4ef2fe(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}logger[_0xc2ea('0x1a')](_0xc2ea('0x15'),_0x39e3d8,_0x56feff['error'][_0xc2ea('0x1c')]);return _0x23e44f(_0x56feff[_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}else{logger[_0xc2ea('0x1d')](_0xc2ea('0x15'),_0x39e3d8,_0xc2ea('0x16'));_0x23e44f(_0x56feff[_0xc2ea('0x1e')][_0xc2ea('0x1c')]);}})[_0xc2ea('0x1f')](function(_0x526c02){logger[_0xc2ea('0x1a')]('ZohoAccount,\x20%s,\x20%s',_0x39e3d8,_0x526c02);_0x4ef2fe(_0x526c02);});});}function respondWithStatusCode(_0x5c415a,_0x5179b8){_0x5179b8=_0x5179b8||0xcc;return function(_0x1b31d4){if(_0x1b31d4){return _0x5c415a[_0xc2ea('0x20')](_0x5179b8);}return _0x5c415a[_0xc2ea('0x21')](_0x5179b8)[_0xc2ea('0x22')]();};}function respondWithResult(_0x18b4d1,_0x1bea47){_0x1bea47=_0x1bea47||0xc8;return function(_0x4c158d){if(_0x4c158d){return _0x18b4d1['status'](_0x1bea47)[_0xc2ea('0x23')](_0x4c158d);}};}function respondWithFilteredResult(_0x41f8d5,_0x3918df){return function(_0x1350c7){if(_0x1350c7){var _0x5c88fe=_0x1350c7[_0xc2ea('0x24')],_0x383feb=_0x3918df[_0xc2ea('0x25')],_0x11a9dd=_0x3918df[_0xc2ea('0x25')]+_0x3918df[_0xc2ea('0x26')],_0x545be9;if(_0x11a9dd>=_0x5c88fe){_0x11a9dd=_0x5c88fe;_0x545be9=0xc8;}else{_0x545be9=0xce;}_0x41f8d5['status'](_0x545be9);return _0x41f8d5[_0xc2ea('0x27')](_0xc2ea('0x28'),_0x383feb+'-'+_0x11a9dd+'/'+_0x5c88fe)[_0xc2ea('0x23')](_0x1350c7);}return null;};}function patchUpdates(_0x4b2335){return function(_0x581be1){try{jsonpatch[_0xc2ea('0x29')](_0x581be1,_0x4b2335,!![]);}catch(_0x500de6){return BPromise[_0xc2ea('0x2a')](_0x500de6);}return _0x581be1[_0xc2ea('0x2b')]();};}function saveUpdates(_0x1c4857,_0x3c1cc0){return function(_0x357c7b){if(_0x357c7b){return _0x357c7b[_0xc2ea('0x2c')](_0x1c4857)[_0xc2ea('0x14')](function(_0x34743d){return _0x34743d;});}return null;};}function removeEntity(_0x2ea9ae,_0x386fc7){return function(_0x266f02){if(_0x266f02){return _0x266f02[_0xc2ea('0x2d')]()['then'](function(){_0x2ea9ae['status'](0xcc)[_0xc2ea('0x22')]();});}};}function handleEntityNotFound(_0x97e3de,_0x312a8a){return function(_0x12e51b){if(!_0x12e51b){_0x97e3de[_0xc2ea('0x20')](0x194);}return _0x12e51b;};}function handleError(_0x55860a,_0x42a435){_0x42a435=_0x42a435||0x1f4;return function(_0x547d51){logger[_0xc2ea('0x1a')](_0x547d51[_0xc2ea('0x2e')]);if(_0x547d51['name']){delete _0x547d51[_0xc2ea('0x2f')];}_0x55860a[_0xc2ea('0x21')](_0x42a435)[_0xc2ea('0x30')](_0x547d51);};}exports['index']=function(_0x3291dc,_0x52dc8b){var _0x51da6f={},_0x485724={},_0x4ba840={'count':0x0,'rows':[]};var _0x15bc7e=db[_0xc2ea('0x31')][_0xc2ea('0x32')];_0x485724[_0xc2ea('0x33')]=_['keys'](_0x15bc7e);var _0x580ede={'dateStart':_0x3291dc[_0xc2ea('0x34')]['dateStart'],'dateEnd':_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x35')]};delete _0x3291dc[_0xc2ea('0x34')]['dateStart'];delete _0x3291dc[_0xc2ea('0x34')]['dateEnd'];_0x485724[_0xc2ea('0x34')]=_['keys'](_0x3291dc[_0xc2ea('0x34')]);_0x485724[_0xc2ea('0x36')]=_[_0xc2ea('0x37')](_0x485724['model'],_0x485724['query']);_0x51da6f[_0xc2ea('0x38')]=_[_0xc2ea('0x37')](_0x485724['model'],qs[_0xc2ea('0x39')](_0x3291dc['query'][_0xc2ea('0x39')]));_0x51da6f['attributes']=_0x51da6f[_0xc2ea('0x38')][_0xc2ea('0x3a')]?_0x51da6f['attributes']:_0x485724[_0xc2ea('0x33')];if(!_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x3b')]('nolimit')){_0x51da6f[_0xc2ea('0x26')]=qs['limit'](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x26')]);_0x51da6f[_0xc2ea('0x25')]=qs[_0xc2ea('0x25')](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x25')]);}_0x51da6f[_0xc2ea('0x3c')]=qs[_0xc2ea('0x3d')](_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x3d')]);_0x51da6f[_0xc2ea('0x3e')]=qs[_0xc2ea('0x36')](_['pick'](_0x3291dc[_0xc2ea('0x34')],_0x485724['filters']));if(_0x580ede[_0xc2ea('0x3f')]){if(_0x580ede[_0xc2ea('0x35')]){_0x580ede[_0xc2ea('0x35')]=moment(_0x580ede['dateEnd'])['add'](0x1,_0xc2ea('0x40'));}else{_0x580ede[_0xc2ea('0x35')]=moment(_0x580ede[_0xc2ea('0x3f')])['add'](0x1,'day');}_[_0xc2ea('0x41')](_0x51da6f['where'],{'createdAt':{'$gte':_0x580ede[_0xc2ea('0x3f')],'$lte':_0x580ede[_0xc2ea('0x35')]}});}if(_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x42')]){_0x51da6f[_0xc2ea('0x3e')]=_['merge'](_0x51da6f[_0xc2ea('0x3e')],{'$or':_[_0xc2ea('0x43')](_0x51da6f[_0xc2ea('0x38')],function(_0x3e3220){var _0xcbcea6={};_0xcbcea6[_0x3e3220]={'$like':'%'+_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x42')]+'%'};return _0xcbcea6;})});}_0x51da6f=_[_0xc2ea('0x41')]({},_0x51da6f,_0x3291dc[_0xc2ea('0x44')]);var _0x3a14da={'where':_0x51da6f[_0xc2ea('0x3e')]};return db[_0xc2ea('0x31')][_0xc2ea('0x24')](_0x3a14da)[_0xc2ea('0x14')](function(_0x4bd211){_0x4ba840[_0xc2ea('0x24')]=_0x4bd211;if(_0x3291dc[_0xc2ea('0x34')][_0xc2ea('0x45')]){_0x51da6f[_0xc2ea('0x46')]=[{'all':!![]}];}return db['ZohoAccount'][_0xc2ea('0x47')](_0x51da6f);})[_0xc2ea('0x14')](function(_0x40fd0b){_0x4ba840['rows']=_0x40fd0b;return _0x4ba840;})[_0xc2ea('0x14')](respondWithFilteredResult(_0x52dc8b,_0x51da6f))[_0xc2ea('0x1f')](handleError(_0x52dc8b,null));};exports[_0xc2ea('0x48')]=function(_0x596816,_0x17c045){var _0x18eb89={'raw':![],'where':{'id':_0x596816['params']['id']}},_0x34120e={};_0x34120e[_0xc2ea('0x33')]=_['keys'](db[_0xc2ea('0x31')]['rawAttributes']);_0x34120e[_0xc2ea('0x34')]=_[_0xc2ea('0x49')](_0x596816['query']);_0x34120e[_0xc2ea('0x36')]=_['intersection'](_0x34120e['model'],_0x34120e['query']);_0x18eb89[_0xc2ea('0x38')]=_[_0xc2ea('0x37')](_0x34120e[_0xc2ea('0x33')],qs[_0xc2ea('0x39')](_0x596816['query'][_0xc2ea('0x39')]));_0x18eb89[_0xc2ea('0x38')]=_0x18eb89['attributes'][_0xc2ea('0x3a')]?_0x18eb89[_0xc2ea('0x38')]:_0x34120e[_0xc2ea('0x33')];if(_0x596816[_0xc2ea('0x34')][_0xc2ea('0x45')]){_0x18eb89[_0xc2ea('0x46')]=[{'all':!![]}];}_0x18eb89=_[_0xc2ea('0x41')]({},_0x18eb89,_0x596816[_0xc2ea('0x44')]);return db['ZohoAccount'][_0xc2ea('0x4a')](_0x18eb89)[_0xc2ea('0x14')](handleEntityNotFound(_0x17c045,null))['then'](respondWithResult(_0x17c045,null))[_0xc2ea('0x1f')](handleError(_0x17c045,null));};exports[_0xc2ea('0x4b')]=function(_0x329d1e,_0x539ada){return db[_0xc2ea('0x31')][_0xc2ea('0x4b')](_0x329d1e['body'],{})[_0xc2ea('0x14')](respondWithResult(_0x539ada,0xc9))[_0xc2ea('0x1f')](handleError(_0x539ada,null));};exports[_0xc2ea('0x2c')]=function(_0x276d1e,_0x225e5d){if(_0x276d1e[_0xc2ea('0x4c')]['id']){delete _0x276d1e[_0xc2ea('0x4c')]['id'];}return db[_0xc2ea('0x31')][_0xc2ea('0x4a')]({'where':{'id':_0x276d1e['params']['id']}})[_0xc2ea('0x14')](handleEntityNotFound(_0x225e5d,null))[_0xc2ea('0x14')](saveUpdates(_0x276d1e[_0xc2ea('0x4c')],null))[_0xc2ea('0x14')](respondWithResult(_0x225e5d,null))['catch'](handleError(_0x225e5d,null));};exports[_0xc2ea('0x2d')]=function(_0x287f86,_0x29d3cf){return db[_0xc2ea('0x31')][_0xc2ea('0x4a')]({'where':{'id':_0x287f86[_0xc2ea('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29d3cf,null))[_0xc2ea('0x14')](removeEntity(_0x29d3cf,null))['catch'](handleError(_0x29d3cf,null));};exports[_0xc2ea('0x4e')]=function(_0x4ee6cb,_0x3f6b8e,_0x56a111){var _0x181072={};var _0x1cbdac={};var _0x1af43c;var _0x5b4445;return db[_0xc2ea('0x31')][_0xc2ea('0x4f')]({'where':{'id':_0x4ee6cb[_0xc2ea('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3f6b8e,null))['then'](function(_0x566fcb){if(_0x566fcb){_0x1af43c=_0x566fcb;_0x1cbdac[_0xc2ea('0x33')]=_[_0xc2ea('0x49')](db[_0xc2ea('0x50')][_0xc2ea('0x32')]);_0x1cbdac[_0xc2ea('0x34')]=_[_0xc2ea('0x49')](_0x4ee6cb['query']);_0x1cbdac[_0xc2ea('0x36')]=_['intersection'](_0x1cbdac[_0xc2ea('0x33')],_0x1cbdac[_0xc2ea('0x34')]);_0x181072['attributes']=_[_0xc2ea('0x37')](_0x1cbdac[_0xc2ea('0x33')],qs[_0xc2ea('0x39')](_0x4ee6cb[_0xc2ea('0x34')]['fields']));_0x181072[_0xc2ea('0x38')]=_0x181072[_0xc2ea('0x38')][_0xc2ea('0x3a')]?_0x181072[_0xc2ea('0x38')]:_0x1cbdac[_0xc2ea('0x33')];_0x181072[_0xc2ea('0x3c')]=qs[_0xc2ea('0x3d')](_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x3d')]);_0x181072[_0xc2ea('0x3e')]=qs[_0xc2ea('0x36')](_['pick'](_0x4ee6cb['query'],_0x1cbdac['filters']));if(_0x4ee6cb[_0xc2ea('0x34')]['filter']){_0x181072[_0xc2ea('0x3e')]=_[_0xc2ea('0x41')](_0x181072[_0xc2ea('0x3e')],{'$or':_['map'](_0x181072[_0xc2ea('0x38')],function(_0x70dfa4){var _0x5c9e68={};_0x5c9e68[_0x70dfa4]={'$like':'%'+_0x4ee6cb['query'][_0xc2ea('0x42')]+'%'};return _0x5c9e68;})});}_0x181072=_[_0xc2ea('0x41')]({},_0x181072,_0x4ee6cb[_0xc2ea('0x44')]);return _0x1af43c['getConfigurations'](_0x181072);}})[_0xc2ea('0x14')](function(_0x3a8b2a){if(_0x3a8b2a){_0x5b4445=_0x3a8b2a[_0xc2ea('0x3a')];if(!_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x3b')]('nolimit')){_0x181072[_0xc2ea('0x26')]=qs['limit'](_0x4ee6cb['query'][_0xc2ea('0x26')]);_0x181072[_0xc2ea('0x25')]=qs[_0xc2ea('0x25')](_0x4ee6cb[_0xc2ea('0x34')][_0xc2ea('0x25')]);}return _0x1af43c['getConfigurations'](_0x181072);}})[_0xc2ea('0x14')](function(_0xda4dee){if(_0xda4dee){return _0xda4dee?{'count':_0x5b4445,'rows':_0xda4dee}:null;}})[_0xc2ea('0x14')](respondWithResult(_0x3f6b8e,null))['catch'](handleError(_0x3f6b8e,null));};exports[_0xc2ea('0x51')]=function(_0x1629b6,_0x3e018a,_0xee5918){if(_0x1629b6['body']['id']){delete _0x1629b6[_0xc2ea('0x4c')]['id'];}return db[_0xc2ea('0x31')]['findOne']({'where':{'id':_0x1629b6[_0xc2ea('0x4d')]['id']}})[_0xc2ea('0x14')](handleEntityNotFound(_0x3e018a,null))[_0xc2ea('0x14')](function(_0x1a2c09){if(_0x1a2c09){_0x1629b6[_0xc2ea('0x4c')]['AccountId']=_0x1a2c09['id'];_0x1629b6[_0xc2ea('0x4c')]['Subjects']=integrations[_0xc2ea('0x52')](_0x1629b6['body']['channel'],_0x1629b6[_0xc2ea('0x4c')][_0xc2ea('0x53')]);_0x1629b6[_0xc2ea('0x4c')][_0xc2ea('0x54')]=integrations[_0xc2ea('0x55')](_0x1629b6[_0xc2ea('0x4c')]['channel'],_0x1629b6['body'][_0xc2ea('0x53')]);return db[_0xc2ea('0x50')][_0xc2ea('0x4b')](_0x1629b6[_0xc2ea('0x4c')],{'include':[{'model':db[_0xc2ea('0x56')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0xc2ea('0x54')}]});}return null;})[_0xc2ea('0x14')](respondWithResult(_0x3e018a,null))[_0xc2ea('0x1f')](handleError(_0x3e018a,null));};exports['getFields']=function(_0x5b680b,_0x4efa18,_0x58c456){return db['ZohoAccount']['findOne']({'where':{'id':_0x5b680b[_0xc2ea('0x4d')]['id']},'attributes':['id',_0xc2ea('0x57'),_0xc2ea('0x58')]})[_0xc2ea('0x14')](handleEntityNotFound(_0x4efa18,null))[_0xc2ea('0x14')](function(_0x260a35){if(_0x260a35){return rp({'method':'GET','uri':util[_0xc2ea('0x59')](_0xc2ea('0x5a'),_0x260a35[_0xc2ea('0x57')]),'qs':{'authtoken':_0x260a35[_0xc2ea('0x58')],'scope':_0xc2ea('0x5b')},'json':!![]});}})[_0xc2ea('0x14')](function(_0xf5d9){if(_0xf5d9){if(_0xf5d9[_0xc2ea('0x5c')]&&_0xf5d9[_0xc2ea('0x5c')]['error']){throw new Error(_0xf5d9['response'][_0xc2ea('0x1a')][_0xc2ea('0x1c')]);}var _0x3ecea7=[];if(_0xf5d9[_0xc2ea('0x5d')]&&_0xf5d9['Calls']['section']){if(_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL']){var _0x28b872=[_0xc2ea('0x5f')];for(var _0x49c806=0x0,_0x159cc6=_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0xc2ea('0x3a')];_0x49c806<_0x159cc6;_0x49c806++){if(_[_0xc2ea('0x60')](_0x28b872,_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806]['dv'])){_0x3ecea7[_0xc2ea('0x61')]({'id':_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806]['dv'],'name':_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x62')],'custom':_0xf5d9['Calls']['section']['FL'][_0x49c806][_0xc2ea('0x63')]==='true'?!![]:![],'options':_0xf5d9['Calls'][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x53')]===_0xc2ea('0x64')&&_0xf5d9['Calls'][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x65')]?_[_0xc2ea('0x43')](_0xf5d9[_0xc2ea('0x5d')][_0xc2ea('0x5e')]['FL'][_0x49c806][_0xc2ea('0x65')],function(_0x4f4883){return{'name':_0x4f4883,'value':_0x4f4883};}):[]});}}}}return{'count':_0x3ecea7[_0xc2ea('0x3a')],'rows':_0x3ecea7};}})[_0xc2ea('0x14')](respondWithResult(_0x4efa18,null))[_0xc2ea('0x1f')](function(_0x145e01){var _0x3a273d=_0x5b680b[_0xc2ea('0x34')][_0xc2ea('0x66')]?0x1f4:_0x145e01[_0xc2ea('0x67')]||0x1f4;logger['error'](_0xc2ea('0x68'),_0xc2ea('0x69'),_0x3a273d,JSON[_0xc2ea('0x19')](_0x145e01));delete _0x145e01[_0xc2ea('0x2f')];if(_0x3a273d===0x191){_0x3a273d=0x190;}_0x4efa18[_0xc2ea('0x21')](_0x3a273d)[_0xc2ea('0x30')](_0x5b680b[_0xc2ea('0x34')][_0xc2ea('0x66')]?{'message':'Wrong\x20credentials','statusCode':_0x145e01[_0xc2ea('0x67')]}:_0x145e01);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index a91a75e..ceba684 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 _0x3474=['ZohoAccount','int_zoho_accounts','lodash','util','../../config/logger','api','moment','bluebird','../../components/integrations/configuration','define'];(function(_0x64faac,_0x395bb6){var _0x4a4600=function(_0x93c534){while(--_0x93c534){_0x64faac['push'](_0x64faac['shift']());}};_0x4a4600(++_0x395bb6);}(_0x3474,0x1ec));var _0x4347=function(_0x1e75cd,_0x51487d){_0x1e75cd=_0x1e75cd-0x0;var _0x16c97e=_0x3474[_0x1e75cd];return _0x16c97e;};'use strict';var _=require(_0x4347('0x0'));var util=require(_0x4347('0x1'));var logger=require(_0x4347('0x2'))(_0x4347('0x3'));var moment=require(_0x4347('0x4'));var BPromise=require(_0x4347('0x5'));var rp=require('request-promise');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x4347('0x6'));module['exports']=function(_0x37dd86,_0x40a912){return _0x37dd86[_0x4347('0x7')](_0x4347('0x8'),attributes,{'tableName':_0x4347('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa805=['request-promise','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa805,0x19a));var _0x5a80=function(_0x5924fd,_0x54e06f){_0x5924fd=_0x5924fd-0x0;var _0x4475d0=_0xa805[_0x5924fd];return _0x4475d0;};'use strict';var _=require(_0x5a80('0x0'));var util=require(_0x5a80('0x1'));var logger=require(_0x5a80('0x2'))(_0x5a80('0x3'));var moment=require(_0x5a80('0x4'));var BPromise=require(_0x5a80('0x5'));var rp=require(_0x5a80('0x6'));var attributes=require(_0x5a80('0x7'));var integrations=require(_0x5a80('0x8'));module[_0x5a80('0x9')]=function(_0x415b5c,_0x26132f){return _0x415b5c[_0x5a80('0xa')](_0x5a80('0xb'),attributes,{'tableName':_0x5a80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index c7c344e..177add6 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 _0xb6e6=['ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','ShowZohoAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount'];(function(_0x1b9a0f,_0x8d8fbb){var _0x2caa85=function(_0x554189){while(--_0x554189){_0x1b9a0f['push'](_0x1b9a0f['shift']());}};_0x2caa85(++_0x8d8fbb);}(_0xb6e6,0xbf));var _0x6b6e=function(_0x2c0eb4,_0x3067ae){_0x2c0eb4=_0x2c0eb4-0x0;var _0xee6b17=_0xb6e6[_0x2c0eb4];return _0xee6b17;};'use strict';var _=require(_0x6b6e('0x0'));var util=require('util');var moment=require(_0x6b6e('0x1'));var BPromise=require(_0x6b6e('0x2'));var rs=require(_0x6b6e('0x3'));var fs=require('fs');var db=require(_0x6b6e('0x4'))['db'];var utils=require(_0x6b6e('0x5'));var logger=require(_0x6b6e('0x6'))(_0x6b6e('0x7'));var config=require(_0x6b6e('0x8'));var jayson=require(_0x6b6e('0x9'));var client=jayson[_0x6b6e('0xa')][_0x6b6e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29ab81,_0x1fd5ca,_0xa31bef){return new BPromise(function(_0x3f17fb,_0x3ea5ca){return client['request'](_0x29ab81,_0xa31bef)[_0x6b6e('0xc')](function(_0x25d238){logger[_0x6b6e('0xd')](_0x6b6e('0xe'),_0x1fd5ca,_0x6b6e('0xf'));logger[_0x6b6e('0x10')](_0x6b6e('0x11'),_0x1fd5ca,_0x6b6e('0xf'),JSON[_0x6b6e('0x12')](_0x25d238));if(_0x25d238[_0x6b6e('0x13')]){if(_0x25d238['error'][_0x6b6e('0x14')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x1fd5ca,_0x25d238[_0x6b6e('0x13')][_0x6b6e('0x15')]);return _0x3ea5ca(_0x25d238[_0x6b6e('0x13')][_0x6b6e('0x15')]);}logger[_0x6b6e('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x1fd5ca,_0x25d238[_0x6b6e('0x13')]['message']);return _0x3f17fb(_0x25d238[_0x6b6e('0x13')][_0x6b6e('0x15')]);}else{logger[_0x6b6e('0xd')](_0x6b6e('0xe'),_0x1fd5ca,_0x6b6e('0xf'));_0x3f17fb(_0x25d238[_0x6b6e('0x16')]['message']);}})[_0x6b6e('0x17')](function(_0x2e7dd9){logger['error'](_0x6b6e('0xe'),_0x1fd5ca,_0x2e7dd9);_0x3ea5ca(_0x2e7dd9);});});}exports[_0x6b6e('0x18')]=function(_0x494a93){var _0xa84b4a=this;return new Promise(function(_0x1c8fb9,_0x2b2d0e){return db[_0x6b6e('0x19')][_0x6b6e('0x1a')]({'raw':_0x494a93['options']?_0x494a93[_0x6b6e('0x1b')][_0x6b6e('0x1c')]===undefined?!![]:![]:!![],'where':_0x494a93[_0x6b6e('0x1b')]?_0x494a93[_0x6b6e('0x1b')][_0x6b6e('0x1d')]||null:null,'attributes':_0x494a93['options']?_0x494a93[_0x6b6e('0x1b')][_0x6b6e('0x1e')]||null:null,'limit':_0x494a93['options']?_0x494a93[_0x6b6e('0x1b')][_0x6b6e('0x1f')]||null:null,'include':_0x494a93['options']?_0x494a93[_0x6b6e('0x1b')]['include']?_[_0x6b6e('0x20')](_0x494a93[_0x6b6e('0x1b')][_0x6b6e('0x21')],function(_0x30dfb9){return{'model':db[_0x30dfb9[_0x6b6e('0x22')]],'as':_0x30dfb9['as'],'attributes':_0x30dfb9[_0x6b6e('0x1e')],'include':_0x30dfb9['include']?_[_0x6b6e('0x20')](_0x30dfb9['include'],function(_0x195cfc){return{'model':db[_0x195cfc['model']],'as':_0x195cfc['as'],'attributes':_0x195cfc[_0x6b6e('0x1e')],'include':_0x195cfc[_0x6b6e('0x21')]?_[_0x6b6e('0x20')](_0x195cfc[_0x6b6e('0x21')],function(_0x459ac0){return{'model':db[_0x459ac0['model']],'as':_0x459ac0['as'],'attributes':_0x459ac0[_0x6b6e('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6b6e('0xc')](function(_0x3d87fa){logger[_0x6b6e('0xd')](_0x6b6e('0x18'),_0x494a93);logger[_0x6b6e('0x10')]('GetZohoAccount',_0x494a93,JSON[_0x6b6e('0x12')](_0x3d87fa));_0x1c8fb9(_0x3d87fa);})[_0x6b6e('0x17')](function(_0x50d359){logger['error'](_0x6b6e('0x18'),_0x50d359['message'],_0x494a93);_0x2b2d0e(_0xa84b4a['error'](0x1f4,_0x50d359[_0x6b6e('0x15')]));});});};exports[_0x6b6e('0x23')]=function(_0x279355){var _0x14655d=this;return new Promise(function(_0x187bc1,_0x25dc0c){return db[_0x6b6e('0x19')]['find']({'raw':_0x279355[_0x6b6e('0x1b')]?_0x279355[_0x6b6e('0x1b')][_0x6b6e('0x1c')]===undefined?!![]:![]:!![],'where':_0x279355[_0x6b6e('0x1b')]?_0x279355[_0x6b6e('0x1b')][_0x6b6e('0x1d')]||null:null,'attributes':_0x279355[_0x6b6e('0x1b')]?_0x279355[_0x6b6e('0x1b')]['attributes']||null:null,'include':_0x279355[_0x6b6e('0x1b')]?_0x279355[_0x6b6e('0x1b')][_0x6b6e('0x21')]?_[_0x6b6e('0x20')](_0x279355[_0x6b6e('0x1b')]['include'],function(_0xe458dd){return{'model':db[_0xe458dd[_0x6b6e('0x22')]],'as':_0xe458dd['as'],'attributes':_0xe458dd['attributes'],'include':_0xe458dd['include']?_['map'](_0xe458dd[_0x6b6e('0x21')],function(_0x341bf5){return{'model':db[_0x341bf5['model']],'as':_0x341bf5['as'],'attributes':_0x341bf5[_0x6b6e('0x1e')],'include':_0x341bf5['include']?_['map'](_0x341bf5['include'],function(_0x365d39){return{'model':db[_0x365d39['model']],'as':_0x365d39['as'],'attributes':_0x365d39[_0x6b6e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3710e9){logger[_0x6b6e('0xd')](_0x6b6e('0x23'),_0x279355);logger[_0x6b6e('0x10')](_0x6b6e('0x23'),_0x279355,JSON[_0x6b6e('0x12')](_0x3710e9));_0x187bc1(_0x3710e9);})[_0x6b6e('0x17')](function(_0x526b25){logger['error']('ShowZohoAccount',_0x526b25[_0x6b6e('0x15')],_0x279355);_0x25dc0c(_0x14655d[_0x6b6e('0x13')](0x1f4,_0x526b25['message']));});});}; \ No newline at end of file +var _0x0592=['GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','info','result'];(function(_0x408658,_0x46bc4c){var _0x2f8e64=function(_0x361924){while(--_0x361924){_0x408658['push'](_0x408658['shift']());}};_0x2f8e64(++_0x46bc4c);}(_0x0592,0xf3));var _0x2059=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x0592[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x2059('0x0'));var util=require(_0x2059('0x1'));var moment=require(_0x2059('0x2'));var BPromise=require(_0x2059('0x3'));var rs=require(_0x2059('0x4'));var fs=require('fs');var db=require(_0x2059('0x5'))['db'];var utils=require(_0x2059('0x6'));var logger=require('../../config/logger')(_0x2059('0x7'));var config=require(_0x2059('0x8'));var jayson=require(_0x2059('0x9'));var client=jayson[_0x2059('0xa')][_0x2059('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xca0d47,_0x5f226e,_0xc6e0){return new BPromise(function(_0x3de42a,_0xcf4993){return client[_0x2059('0xc')](_0xca0d47,_0xc6e0)[_0x2059('0xd')](function(_0xad5ab1){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x5f226e,_0x2059('0xe'));logger[_0x2059('0xf')](_0x2059('0x10'),_0x5f226e,_0x2059('0xe'),JSON['stringify'](_0xad5ab1));if(_0xad5ab1[_0x2059('0x11')]){if(_0xad5ab1[_0x2059('0x11')][_0x2059('0x12')]===0x1f4){logger['error'](_0x2059('0x13'),_0x5f226e,_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);return _0xcf4993(_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);}logger[_0x2059('0x11')](_0x2059('0x13'),_0x5f226e,_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);return _0x3de42a(_0xad5ab1[_0x2059('0x11')][_0x2059('0x14')]);}else{logger[_0x2059('0x15')](_0x2059('0x13'),_0x5f226e,'request\x20sent');_0x3de42a(_0xad5ab1[_0x2059('0x16')][_0x2059('0x14')]);}})['catch'](function(_0x48da00){logger['error'](_0x2059('0x13'),_0x5f226e,_0x48da00);_0xcf4993(_0x48da00);});});}exports[_0x2059('0x17')]=function(_0x4c21ca){var _0x5c9171=this;return new Promise(function(_0x39a618,_0x444860){return db[_0x2059('0x18')][_0x2059('0x19')]({'raw':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca[_0x2059('0x1a')][_0x2059('0x1c')]||null:null,'attributes':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1d')]||null:null,'limit':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca[_0x2059('0x1a')][_0x2059('0x1e')]||null:null,'include':_0x4c21ca[_0x2059('0x1a')]?_0x4c21ca['options'][_0x2059('0x1f')]?_[_0x2059('0x20')](_0x4c21ca['options'][_0x2059('0x1f')],function(_0x48bd4d){return{'model':db[_0x48bd4d['model']],'as':_0x48bd4d['as'],'attributes':_0x48bd4d[_0x2059('0x1d')],'include':_0x48bd4d[_0x2059('0x1f')]?_[_0x2059('0x20')](_0x48bd4d[_0x2059('0x1f')],function(_0x165670){return{'model':db[_0x165670['model']],'as':_0x165670['as'],'attributes':_0x165670['attributes'],'include':_0x165670[_0x2059('0x1f')]?_[_0x2059('0x20')](_0x165670[_0x2059('0x1f')],function(_0x1f0e78){return{'model':db[_0x1f0e78[_0x2059('0x21')]],'as':_0x1f0e78['as'],'attributes':_0x1f0e78[_0x2059('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2059('0xd')](function(_0x119286){logger[_0x2059('0x15')](_0x2059('0x17'),_0x4c21ca);logger['debug'](_0x2059('0x17'),_0x4c21ca,JSON[_0x2059('0x22')](_0x119286));_0x39a618(_0x119286);})[_0x2059('0x23')](function(_0x2f0456){logger[_0x2059('0x11')]('GetZohoAccount',_0x2f0456[_0x2059('0x14')],_0x4c21ca);_0x444860(_0x5c9171['error'](0x1f4,_0x2f0456[_0x2059('0x14')]));});});};exports[_0x2059('0x24')]=function(_0xb168d7){var _0x20a88b=this;return new Promise(function(_0x20b9ea,_0x27b211){return db['ZohoAccount'][_0x2059('0x25')]({'raw':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')][_0x2059('0x1c')]||null:null,'attributes':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['attributes']||null:null,'include':_0xb168d7[_0x2059('0x1a')]?_0xb168d7[_0x2059('0x1a')]['include']?_[_0x2059('0x20')](_0xb168d7['options']['include'],function(_0x39ff56){return{'model':db[_0x39ff56[_0x2059('0x21')]],'as':_0x39ff56['as'],'attributes':_0x39ff56[_0x2059('0x1d')],'include':_0x39ff56[_0x2059('0x1f')]?_['map'](_0x39ff56[_0x2059('0x1f')],function(_0x51f0b6){return{'model':db[_0x51f0b6[_0x2059('0x21')]],'as':_0x51f0b6['as'],'attributes':_0x51f0b6[_0x2059('0x1d')],'include':_0x51f0b6[_0x2059('0x1f')]?_['map'](_0x51f0b6['include'],function(_0x29a2ee){return{'model':db[_0x29a2ee['model']],'as':_0x29a2ee['as'],'attributes':_0x29a2ee['attributes']};}):[]};}):[]};}):[]:[]})[_0x2059('0xd')](function(_0x470b9f){logger[_0x2059('0x15')](_0x2059('0x24'),_0xb168d7);logger[_0x2059('0xf')]('ShowZohoAccount',_0xb168d7,JSON[_0x2059('0x22')](_0x470b9f));_0x20b9ea(_0x470b9f);})[_0x2059('0x23')](function(_0x4e4934){logger[_0x2059('0x11')]('ShowZohoAccount',_0x4e4934['message'],_0xb168d7);_0x27b211(_0x20a88b['error'](0x1f4,_0x4e4934[_0x2059('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index ba24949..dcd1538 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 _0xc558=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','getFields'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xc558,0x135));var _0x8c55=function(_0x510ce5,_0x5b0ce7){_0x510ce5=_0x510ce5-0x0;var _0x171a29=_0xc558[_0x510ce5];return _0x171a29;};'use strict';var multer=require(_0x8c55('0x0'));var util=require(_0x8c55('0x1'));var path=require('path');var express=require(_0x8c55('0x2'));var router=express[_0x8c55('0x3')]();var auth=require(_0x8c55('0x4'));var interaction=require(_0x8c55('0x5'));var config=require('../../config/environment');var controller=require(_0x8c55('0x6'));router[_0x8c55('0x7')]('/',auth['isAuthenticated'](),controller[_0x8c55('0x8')]);router[_0x8c55('0x7')]('/:id',auth[_0x8c55('0x9')](),controller[_0x8c55('0xa')]);router[_0x8c55('0x7')](_0x8c55('0xb'),auth[_0x8c55('0x9')](),controller[_0x8c55('0xc')]);router[_0x8c55('0x7')](_0x8c55('0xd'),auth[_0x8c55('0x9')](),controller[_0x8c55('0xe')]);router['get'](_0x8c55('0xf'),auth[_0x8c55('0x9')](),controller[_0x8c55('0x10')]);router[_0x8c55('0x11')]('/',auth[_0x8c55('0x9')](),controller['create']);router[_0x8c55('0x12')](_0x8c55('0x13'),auth[_0x8c55('0x9')](),controller['update']);router[_0x8c55('0x14')](_0x8c55('0x13'),auth[_0x8c55('0x9')](),controller[_0x8c55('0x15')]);module[_0x8c55('0x16')]=router; \ No newline at end of file +var _0x53cd=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects'];(function(_0x7600df,_0x31daf2){var _0x1b85d9=function(_0x17866e){while(--_0x17866e){_0x7600df['push'](_0x7600df['shift']());}};_0x1b85d9(++_0x31daf2);}(_0x53cd,0xca));var _0xd53c=function(_0xb2b125,_0x12b79a){_0xb2b125=_0xb2b125-0x0;var _0xa40c87=_0x53cd[_0xb2b125];return _0xa40c87;};'use strict';var multer=require(_0xd53c('0x0'));var util=require(_0xd53c('0x1'));var path=require(_0xd53c('0x2'));var express=require(_0xd53c('0x3'));var router=express[_0xd53c('0x4')]();var auth=require(_0xd53c('0x5'));var interaction=require(_0xd53c('0x6'));var config=require(_0xd53c('0x7'));var controller=require(_0xd53c('0x8'));router[_0xd53c('0x9')]('/',auth[_0xd53c('0xa')](),controller['index']);router[_0xd53c('0x9')](_0xd53c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd53c('0x9')](_0xd53c('0xc'),auth[_0xd53c('0xa')](),controller['getFields']);router[_0xd53c('0x9')](_0xd53c('0xd'),auth[_0xd53c('0xa')](),controller[_0xd53c('0xe')]);router[_0xd53c('0x9')](_0xd53c('0xf'),auth[_0xd53c('0xa')](),controller[_0xd53c('0x10')]);router[_0xd53c('0x11')]('/',auth[_0xd53c('0xa')](),controller[_0xd53c('0x12')]);router[_0xd53c('0x13')](_0xd53c('0xb'),auth[_0xd53c('0xa')](),controller[_0xd53c('0x14')]);router[_0xd53c('0x15')]('/:id',auth[_0xd53c('0xa')](),controller[_0xd53c('0x16')]);module[_0xd53c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3722116..6fee0fc 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 _0xf936=['STRING','sequelize','exports'];(function(_0x4eabc7,_0x2a3dad){var _0x20ec11=function(_0x565db0){while(--_0x565db0){_0x4eabc7['push'](_0x4eabc7['shift']());}};_0x20ec11(++_0x2a3dad);}(_0xf936,0x1db));var _0x6f93=function(_0x2cf820,_0x29b1d8){_0x2cf820=_0x2cf820-0x0;var _0x11b373=_0xf936[_0x2cf820];return _0x11b373;};'use strict';var Sequelize=require(_0x6f93('0x0'));module[_0x6f93('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6f93('0x2')]}}; \ No newline at end of file +var _0x8343=['sequelize','exports','STRING'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x8343,0x78));var _0x3834=function(_0x3e87b3,_0x2347b8){_0x3e87b3=_0x3e87b3-0x0;var _0x1c627a=_0x8343[_0x3e87b3];return _0x1c627a;};'use strict';var Sequelize=require(_0x3834('0x0'));module[_0x3834('0x1')]={'name':{'type':Sequelize[_0x3834('0x2')]},'description':{'type':Sequelize[_0x3834('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d264c2c..9bef08c 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 _0xb10b=['save','update','sendStatus','stack','name','index','ZohoConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','filter','map','merge','options','includeAll','include','findAll','show','params','intersection','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x2fb68e,_0x179697){var _0x4b33ef=function(_0x421103){while(--_0x421103){_0x2fb68e['push'](_0x2fb68e['shift']());}};_0x4b33ef(++_0x179697);}(_0xb10b,0x12a));var _0xbb10=function(_0x571a36,_0x5936f2){_0x571a36=_0x571a36-0x0;var _0x4dd68e=_0xb10b[_0x571a36];return _0x4dd68e;};'use strict';var jsonpatch=require(_0xbb10('0x0'));var rp=require('request-promise');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var Mustache=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var csv=require(_0xbb10('0x6'));var ejs=require(_0xbb10('0x7'));var fs=require('fs');var _=require(_0xbb10('0x8'));var squel=require(_0xbb10('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb10('0xa'));var deskjs=require(_0xbb10('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbb10('0xc'));var Papa=require(_0xbb10('0xd'));var qs=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var utils=require(_0xbb10('0x11'));var config=require(_0xbb10('0x12'));var db=require(_0xbb10('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbb10('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x118a74,_0xce64f3,_0x5e136d,_0x408248){return new BPromise(function(_0x5be7e0,_0x44fb19){var _0x916a32=_0x408248||client;return _0x916a32[_0xbb10('0x15')](_0x118a74,_0x5e136d)[_0xbb10('0x16')](function(_0x442548){logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0xce64f3,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x442548));if(_0x442548[_0xbb10('0x1c')]){if(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548['error'][_0xbb10('0x1f')]);return _0x44fb19(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);return _0x5be7e0(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}else{logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));_0x5be7e0(_0x442548[_0xbb10('0x20')][_0xbb10('0x1f')]);}})[_0xbb10('0x21')](function(_0xdf237d){logger[_0xbb10('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xdf237d);_0x44fb19(_0xdf237d);});});}function respondWithStatusCode(_0x12f888,_0x12ef77){_0x12ef77=_0x12ef77||0xcc;return function(_0x50aea1){if(_0x50aea1){return _0x12f888['sendStatus'](_0x12ef77);}return _0x12f888[_0xbb10('0x22')](_0x12ef77)[_0xbb10('0x23')]();};}function respondWithResult(_0x2e911d,_0x317da4){_0x317da4=_0x317da4||0xc8;return function(_0x445761){if(_0x445761){return _0x2e911d[_0xbb10('0x22')](_0x317da4)[_0xbb10('0x24')](_0x445761);}};}function respondWithFilteredResult(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){var _0x3ba6cd=_0x395404['count'],_0x26ad93=_0x7f2377[_0xbb10('0x25')],_0x537898=_0x7f2377[_0xbb10('0x25')]+_0x7f2377[_0xbb10('0x26')],_0x4fedac;if(_0x537898>=_0x3ba6cd){_0x537898=_0x3ba6cd;_0x4fedac=0xc8;}else{_0x4fedac=0xce;}_0x436104['status'](_0x4fedac);return _0x436104[_0xbb10('0x27')](_0xbb10('0x28'),_0x26ad93+'-'+_0x537898+'/'+_0x3ba6cd)[_0xbb10('0x24')](_0x395404);}return null;};}function patchUpdates(_0x1d5e95){return function(_0x1acce9){try{jsonpatch[_0xbb10('0x29')](_0x1acce9,_0x1d5e95,!![]);}catch(_0x2a0e8b){return BPromise['reject'](_0x2a0e8b);}return _0x1acce9[_0xbb10('0x2a')]();};}function saveUpdates(_0x21ac54,_0xfc3595){return function(_0x2e0249){if(_0x2e0249){return _0x2e0249[_0xbb10('0x2b')](_0x21ac54)[_0xbb10('0x16')](function(_0x5d5c80){return _0x5d5c80;});}return null;};}function removeEntity(_0x221624,_0x4ee02e){return function(_0x448d5c){if(_0x448d5c){return _0x448d5c['destroy']()[_0xbb10('0x16')](function(){_0x221624[_0xbb10('0x22')](0xcc)[_0xbb10('0x23')]();});}};}function handleEntityNotFound(_0x491db4,_0x518d47){return function(_0x4c3744){if(!_0x4c3744){_0x491db4[_0xbb10('0x2c')](0x194);}return _0x4c3744;};}function handleError(_0x4f590d,_0x359ad4){_0x359ad4=_0x359ad4||0x1f4;return function(_0x37dde7){logger[_0xbb10('0x1c')](_0x37dde7[_0xbb10('0x2d')]);if(_0x37dde7[_0xbb10('0x2e')]){delete _0x37dde7[_0xbb10('0x2e')];}_0x4f590d[_0xbb10('0x22')](_0x359ad4)['send'](_0x37dde7);};}exports[_0xbb10('0x2f')]=function(_0x1da9c9,_0x441d15){var _0x8c1ce6={},_0xfb2c5e={},_0x9de708={'count':0x0,'rows':[]};var _0x188cbd=db[_0xbb10('0x30')][_0xbb10('0x31')];_0xfb2c5e['model']=_[_0xbb10('0x32')](_0x188cbd);var _0x150107={'dateStart':_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x34')],'dateEnd':_0x1da9c9['query'][_0xbb10('0x35')]};delete _0x1da9c9['query']['dateStart'];delete _0x1da9c9[_0xbb10('0x33')][_0xbb10('0x35')];_0xfb2c5e[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x1da9c9[_0xbb10('0x33')]);_0xfb2c5e[_0xbb10('0x36')]=_['intersection'](_0xfb2c5e[_0xbb10('0x37')],_0xfb2c5e[_0xbb10('0x33')]);_0x8c1ce6['attributes']=_['intersection'](_0xfb2c5e['model'],qs[_0xbb10('0x38')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x38')]));_0x8c1ce6['attributes']=_0x8c1ce6[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x8c1ce6[_0xbb10('0x39')]:_0xfb2c5e['model'];if(!_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x8c1ce6[_0xbb10('0x26')]=qs['limit'](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x26')]);_0x8c1ce6['offset']=qs[_0xbb10('0x25')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x25')]);}_0x8c1ce6[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x1da9c9[_0xbb10('0x33')]['sort']);_0x8c1ce6[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x1da9c9[_0xbb10('0x33')],_0xfb2c5e['filters']));if(_0x150107[_0xbb10('0x34')]){if(_0x150107[_0xbb10('0x35')]){_0x150107[_0xbb10('0x35')]=moment(_0x150107[_0xbb10('0x35')])['add'](0x1,_0xbb10('0x41'));}else{_0x150107[_0xbb10('0x35')]=moment(_0x150107['dateStart'])['add'](0x1,_0xbb10('0x41'));}_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'createdAt':{'$gte':_0x150107[_0xbb10('0x34')],'$lte':_0x150107['dateEnd']}});}if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]){_0x8c1ce6[_0xbb10('0x3f')]=_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x8c1ce6[_0xbb10('0x39')],function(_0x32b729){var _0x36e1fa={};_0x36e1fa[_0x32b729]={'$like':'%'+_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x36e1fa;})});}_0x8c1ce6=_[_0xbb10('0x44')]({},_0x8c1ce6,_0x1da9c9[_0xbb10('0x45')]);var _0x43b948={'where':_0x8c1ce6[_0xbb10('0x3f')]};return db[_0xbb10('0x30')]['count'](_0x43b948)[_0xbb10('0x16')](function(_0x41bbf8){_0x9de708['count']=_0x41bbf8;if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x46')]){_0x8c1ce6[_0xbb10('0x47')]=[{'all':!![]}];}return db[_0xbb10('0x30')][_0xbb10('0x48')](_0x8c1ce6);})[_0xbb10('0x16')](function(_0x3e06b0){_0x9de708['rows']=_0x3e06b0;return _0x9de708;})['then'](respondWithFilteredResult(_0x441d15,_0x8c1ce6))[_0xbb10('0x21')](handleError(_0x441d15,null));};exports[_0xbb10('0x49')]=function(_0x2b12bd,_0x57d2c0){var _0x5f0c12={'raw':![],'where':{'id':_0x2b12bd[_0xbb10('0x4a')]['id']}},_0x3cd6f3={};_0x3cd6f3[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x30')][_0xbb10('0x31')]);_0x3cd6f3[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x2b12bd[_0xbb10('0x33')]);_0x3cd6f3[_0xbb10('0x36')]=_['intersection'](_0x3cd6f3['model'],_0x3cd6f3[_0xbb10('0x33')]);_0x5f0c12[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x3cd6f3[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x38')]));_0x5f0c12[_0xbb10('0x39')]=_0x5f0c12[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x5f0c12[_0xbb10('0x39')]:_0x3cd6f3[_0xbb10('0x37')];if(_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x46')]){_0x5f0c12[_0xbb10('0x47')]=[{'all':!![]}];}_0x5f0c12=_['merge']({},_0x5f0c12,_0x2b12bd[_0xbb10('0x45')]);return db['ZohoConfiguration'][_0xbb10('0x4c')](_0x5f0c12)[_0xbb10('0x16')](handleEntityNotFound(_0x57d2c0,null))[_0xbb10('0x16')](respondWithResult(_0x57d2c0,null))[_0xbb10('0x21')](handleError(_0x57d2c0,null));};exports[_0xbb10('0x4d')]=function(_0x32d8e9,_0x2e3326){return db[_0xbb10('0x30')][_0xbb10('0x4d')](_0x32d8e9[_0xbb10('0x4e')],{})[_0xbb10('0x16')](respondWithResult(_0x2e3326,0xc9))[_0xbb10('0x21')](handleError(_0x2e3326,null));};exports[_0xbb10('0x2b')]=function(_0x3d7e17,_0x4475e1){if(_0x3d7e17['body']['id']){delete _0x3d7e17[_0xbb10('0x4e')]['id'];}return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x3d7e17[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4475e1,null))[_0xbb10('0x16')](saveUpdates(_0x3d7e17['body'],null))[_0xbb10('0x16')](respondWithResult(_0x4475e1,null))[_0xbb10('0x21')](handleError(_0x4475e1,null));};exports[_0xbb10('0x4f')]=function(_0x14fed3,_0x432728){return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x14fed3[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x16')](removeEntity(_0x432728,null))[_0xbb10('0x21')](handleError(_0x432728,null));};exports[_0xbb10('0x50')]=function(_0x16932f,_0x4e7fac,_0x4ea1a6){var _0x16272d={};var _0x3e6338={};var _0x3d0cb7;var _0x8b0a7d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x16932f[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4e7fac,null))[_0xbb10('0x16')](function(_0x2dd150){if(_0x2dd150){_0x3d0cb7=_0x2dd150;_0x3e6338[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')]['rawAttributes']);_0x3e6338[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x16932f['query']);_0x3e6338['filters']=_['intersection'](_0x3e6338[_0xbb10('0x37')],_0x3e6338[_0xbb10('0x33')]);_0x16272d[_0xbb10('0x39')]=_['intersection'](_0x3e6338['model'],qs['fields'](_0x16932f[_0xbb10('0x33')][_0xbb10('0x38')]));_0x16272d[_0xbb10('0x39')]=_0x16272d['attributes'][_0xbb10('0x3a')]?_0x16272d[_0xbb10('0x39')]:_0x3e6338['model'];_0x16272d['order']=qs[_0xbb10('0x3e')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x16272d[_0xbb10('0x3f')]=qs['filters'](_[_0xbb10('0x40')](_0x16932f[_0xbb10('0x33')],_0x3e6338[_0xbb10('0x36')]));if(_0x16932f['query'][_0xbb10('0x42')]){_0x16272d[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x16272d['where'],{'$or':_[_0xbb10('0x43')](_0x16272d[_0xbb10('0x39')],function(_0x3b0f08){var _0x37b65f={};_0x37b65f[_0x3b0f08]={'$like':'%'+_0x16932f['query'][_0xbb10('0x42')]+'%'};return _0x37b65f;})});}_0x16272d=_[_0xbb10('0x44')]({},_0x16272d,_0x16932f[_0xbb10('0x45')]);return _0x3d0cb7[_0xbb10('0x50')](_0x16272d);}})['then'](function(_0x354ea7){if(_0x354ea7){_0x8b0a7d=_0x354ea7[_0xbb10('0x3a')];if(!_0x16932f[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x16272d[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x16932f['query']['limit']);_0x16272d['offset']=qs[_0xbb10('0x25')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x25')]);}return _0x3d0cb7['getFields'](_0x16272d);}})['then'](function(_0x46f462){if(_0x46f462){return _0x46f462?{'count':_0x8b0a7d,'rows':_0x46f462}:null;}})[_0xbb10('0x16')](respondWithResult(_0x4e7fac,null))[_0xbb10('0x21')](handleError(_0x4e7fac,null));};exports[_0xbb10('0x52')]=function(_0x260e06,_0x1ad2ed,_0x4cf2f3){var _0x1a5ca5={};var _0x15fae2={};var _0x270fdb;var _0x14f16b;return db[_0xbb10('0x30')]['findOne']({'where':{'id':_0x260e06['params']['id']}})['then'](handleEntityNotFound(_0x1ad2ed,null))[_0xbb10('0x16')](function(_0x1e0569){if(_0x1e0569){_0x270fdb=_0x1e0569;_0x15fae2[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')][_0xbb10('0x31')]);_0x15fae2['query']=_[_0xbb10('0x32')](_0x260e06['query']);_0x15fae2['filters']=_['intersection'](_0x15fae2[_0xbb10('0x37')],_0x15fae2[_0xbb10('0x33')]);_0x1a5ca5[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x15fae2['model'],qs[_0xbb10('0x38')](_0x260e06['query']['fields']));_0x1a5ca5[_0xbb10('0x39')]=_0x1a5ca5[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x1a5ca5[_0xbb10('0x39')]:_0x15fae2[_0xbb10('0x37')];_0x1a5ca5['order']=qs[_0xbb10('0x3e')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x1a5ca5[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x260e06[_0xbb10('0x33')],_0x15fae2['filters']));if(_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]){_0x1a5ca5[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x1a5ca5[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x1a5ca5[_0xbb10('0x39')],function(_0x312a08){var _0x5a4429={};_0x5a4429[_0x312a08]={'$like':'%'+_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x5a4429;})});}_0x1a5ca5=_[_0xbb10('0x44')]({},_0x1a5ca5,_0x260e06['options']);return _0x270fdb['getSubjects'](_0x1a5ca5);}})['then'](function(_0x23286d){if(_0x23286d){_0x14f16b=_0x23286d['length'];if(!_0x260e06['query'][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x1a5ca5[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x26')]);_0x1a5ca5[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x260e06[_0xbb10('0x33')]['offset']);}return _0x270fdb[_0xbb10('0x52')](_0x1a5ca5);}})[_0xbb10('0x16')](function(_0x46b6d2){if(_0x46b6d2){return _0x46b6d2?{'count':_0x14f16b,'rows':_0x46b6d2}:null;}})[_0xbb10('0x16')](respondWithResult(_0x1ad2ed,null))['catch'](handleError(_0x1ad2ed,null));};exports['getDescriptions']=function(_0x3547a3,_0x2280bd,_0x30f0a4){var _0x32bb25={};var _0x5ee705={};var _0x17d596;var _0x275bce;return db[_0xbb10('0x30')][_0xbb10('0x53')]({'where':{'id':_0x3547a3[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2280bd,null))['then'](function(_0x372636){if(_0x372636){_0x17d596=_0x372636;_0x5ee705[_0xbb10('0x37')]=_[_0xbb10('0x32')](db['ZohoField'][_0xbb10('0x31')]);_0x5ee705[_0xbb10('0x33')]=_['keys'](_0x3547a3['query']);_0x5ee705[_0xbb10('0x36')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],_0x5ee705['query']);_0x32bb25[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x38')]));_0x32bb25[_0xbb10('0x39')]=_0x32bb25[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x32bb25['attributes']:_0x5ee705[_0xbb10('0x37')];_0x32bb25[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x32bb25[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x3547a3[_0xbb10('0x33')],_0x5ee705[_0xbb10('0x36')]));if(_0x3547a3[_0xbb10('0x33')][_0xbb10('0x42')]){_0x32bb25['where']=_['merge'](_0x32bb25[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x32bb25[_0xbb10('0x39')],function(_0x3fd367){var _0x238c7a={};_0x238c7a[_0x3fd367]={'$like':'%'+_0x3547a3['query'][_0xbb10('0x42')]+'%'};return _0x238c7a;})});}_0x32bb25=_[_0xbb10('0x44')]({},_0x32bb25,_0x3547a3[_0xbb10('0x45')]);return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})[_0xbb10('0x16')](function(_0x379d49){if(_0x379d49){_0x275bce=_0x379d49['length'];if(!_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3b')]('nolimit')){_0x32bb25[_0xbb10('0x26')]=qs['limit'](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x26')]);_0x32bb25[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x3547a3[_0xbb10('0x33')]['offset']);}return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})['then'](function(_0x3fcc55){if(_0x3fcc55){return _0x3fcc55?{'count':_0x275bce,'rows':_0x3fcc55}:null;}})[_0xbb10('0x16')](respondWithResult(_0x2280bd,null))['catch'](handleError(_0x2280bd,null));}; \ No newline at end of file +var _0xb10b=['save','update','sendStatus','stack','name','index','ZohoConfiguration','rawAttributes','keys','query','dateStart','dateEnd','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','filter','map','merge','options','includeAll','include','findAll','show','params','intersection','find','create','body','destroy','getFields','ZohoField','getSubjects','findOne','getDescriptions','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','status','end','json','offset','limit','set','Content-Range','apply'];(function(_0x197127,_0x48bbfd){var _0x558ca6=function(_0x580faf){while(--_0x580faf){_0x197127['push'](_0x197127['shift']());}};_0x558ca6(++_0x48bbfd);}(_0xb10b,0x12a));var _0xbb10=function(_0x27332e,_0x247ad6){_0x27332e=_0x27332e-0x0;var _0x5882fc=_0xb10b[_0x27332e];return _0x5882fc;};'use strict';var jsonpatch=require(_0xbb10('0x0'));var rp=require('request-promise');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var Mustache=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var sox=require(_0xbb10('0x5'));var csv=require(_0xbb10('0x6'));var ejs=require(_0xbb10('0x7'));var fs=require('fs');var _=require(_0xbb10('0x8'));var squel=require(_0xbb10('0x9'));var crypto=require('crypto');var jsforce=require(_0xbb10('0xa'));var deskjs=require(_0xbb10('0xb'));var toCsv=require('to-csv');var querystring=require(_0xbb10('0xc'));var Papa=require(_0xbb10('0xd'));var qs=require(_0xbb10('0xe'));var logger=require(_0xbb10('0xf'))(_0xbb10('0x10'));var utils=require(_0xbb10('0x11'));var config=require(_0xbb10('0x12'));var db=require(_0xbb10('0x13'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xbb10('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x118a74,_0xce64f3,_0x5e136d,_0x408248){return new BPromise(function(_0x5be7e0,_0x44fb19){var _0x916a32=_0x408248||client;return _0x916a32[_0xbb10('0x15')](_0x118a74,_0x5e136d)[_0xbb10('0x16')](function(_0x442548){logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));logger[_0xbb10('0x19')](_0xbb10('0x1a'),_0xce64f3,_0xbb10('0x18'),JSON[_0xbb10('0x1b')](_0x442548));if(_0x442548[_0xbb10('0x1c')]){if(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1d')]===0x1f4){logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548['error'][_0xbb10('0x1f')]);return _0x44fb19(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}logger[_0xbb10('0x1c')](_0xbb10('0x1e'),_0xce64f3,_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);return _0x5be7e0(_0x442548[_0xbb10('0x1c')][_0xbb10('0x1f')]);}else{logger[_0xbb10('0x17')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xbb10('0x18'));_0x5be7e0(_0x442548[_0xbb10('0x20')][_0xbb10('0x1f')]);}})[_0xbb10('0x21')](function(_0xdf237d){logger[_0xbb10('0x1c')]('ZohoConfiguration,\x20%s,\x20%s',_0xce64f3,_0xdf237d);_0x44fb19(_0xdf237d);});});}function respondWithStatusCode(_0x12f888,_0x12ef77){_0x12ef77=_0x12ef77||0xcc;return function(_0x50aea1){if(_0x50aea1){return _0x12f888['sendStatus'](_0x12ef77);}return _0x12f888[_0xbb10('0x22')](_0x12ef77)[_0xbb10('0x23')]();};}function respondWithResult(_0x2e911d,_0x317da4){_0x317da4=_0x317da4||0xc8;return function(_0x445761){if(_0x445761){return _0x2e911d[_0xbb10('0x22')](_0x317da4)[_0xbb10('0x24')](_0x445761);}};}function respondWithFilteredResult(_0x436104,_0x7f2377){return function(_0x395404){if(_0x395404){var _0x3ba6cd=_0x395404['count'],_0x26ad93=_0x7f2377[_0xbb10('0x25')],_0x537898=_0x7f2377[_0xbb10('0x25')]+_0x7f2377[_0xbb10('0x26')],_0x4fedac;if(_0x537898>=_0x3ba6cd){_0x537898=_0x3ba6cd;_0x4fedac=0xc8;}else{_0x4fedac=0xce;}_0x436104['status'](_0x4fedac);return _0x436104[_0xbb10('0x27')](_0xbb10('0x28'),_0x26ad93+'-'+_0x537898+'/'+_0x3ba6cd)[_0xbb10('0x24')](_0x395404);}return null;};}function patchUpdates(_0x1d5e95){return function(_0x1acce9){try{jsonpatch[_0xbb10('0x29')](_0x1acce9,_0x1d5e95,!![]);}catch(_0x2a0e8b){return BPromise['reject'](_0x2a0e8b);}return _0x1acce9[_0xbb10('0x2a')]();};}function saveUpdates(_0x21ac54,_0xfc3595){return function(_0x2e0249){if(_0x2e0249){return _0x2e0249[_0xbb10('0x2b')](_0x21ac54)[_0xbb10('0x16')](function(_0x5d5c80){return _0x5d5c80;});}return null;};}function removeEntity(_0x221624,_0x4ee02e){return function(_0x448d5c){if(_0x448d5c){return _0x448d5c['destroy']()[_0xbb10('0x16')](function(){_0x221624[_0xbb10('0x22')](0xcc)[_0xbb10('0x23')]();});}};}function handleEntityNotFound(_0x491db4,_0x518d47){return function(_0x4c3744){if(!_0x4c3744){_0x491db4[_0xbb10('0x2c')](0x194);}return _0x4c3744;};}function handleError(_0x4f590d,_0x359ad4){_0x359ad4=_0x359ad4||0x1f4;return function(_0x37dde7){logger[_0xbb10('0x1c')](_0x37dde7[_0xbb10('0x2d')]);if(_0x37dde7[_0xbb10('0x2e')]){delete _0x37dde7[_0xbb10('0x2e')];}_0x4f590d[_0xbb10('0x22')](_0x359ad4)['send'](_0x37dde7);};}exports[_0xbb10('0x2f')]=function(_0x1da9c9,_0x441d15){var _0x8c1ce6={},_0xfb2c5e={},_0x9de708={'count':0x0,'rows':[]};var _0x188cbd=db[_0xbb10('0x30')][_0xbb10('0x31')];_0xfb2c5e['model']=_[_0xbb10('0x32')](_0x188cbd);var _0x150107={'dateStart':_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x34')],'dateEnd':_0x1da9c9['query'][_0xbb10('0x35')]};delete _0x1da9c9['query']['dateStart'];delete _0x1da9c9[_0xbb10('0x33')][_0xbb10('0x35')];_0xfb2c5e[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x1da9c9[_0xbb10('0x33')]);_0xfb2c5e[_0xbb10('0x36')]=_['intersection'](_0xfb2c5e[_0xbb10('0x37')],_0xfb2c5e[_0xbb10('0x33')]);_0x8c1ce6['attributes']=_['intersection'](_0xfb2c5e['model'],qs[_0xbb10('0x38')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x38')]));_0x8c1ce6['attributes']=_0x8c1ce6[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x8c1ce6[_0xbb10('0x39')]:_0xfb2c5e['model'];if(!_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x8c1ce6[_0xbb10('0x26')]=qs['limit'](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x26')]);_0x8c1ce6['offset']=qs[_0xbb10('0x25')](_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x25')]);}_0x8c1ce6[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x1da9c9[_0xbb10('0x33')]['sort']);_0x8c1ce6[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x1da9c9[_0xbb10('0x33')],_0xfb2c5e['filters']));if(_0x150107[_0xbb10('0x34')]){if(_0x150107[_0xbb10('0x35')]){_0x150107[_0xbb10('0x35')]=moment(_0x150107[_0xbb10('0x35')])['add'](0x1,_0xbb10('0x41'));}else{_0x150107[_0xbb10('0x35')]=moment(_0x150107['dateStart'])['add'](0x1,_0xbb10('0x41'));}_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'createdAt':{'$gte':_0x150107[_0xbb10('0x34')],'$lte':_0x150107['dateEnd']}});}if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]){_0x8c1ce6[_0xbb10('0x3f')]=_['merge'](_0x8c1ce6[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x8c1ce6[_0xbb10('0x39')],function(_0x32b729){var _0x36e1fa={};_0x36e1fa[_0x32b729]={'$like':'%'+_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x36e1fa;})});}_0x8c1ce6=_[_0xbb10('0x44')]({},_0x8c1ce6,_0x1da9c9[_0xbb10('0x45')]);var _0x43b948={'where':_0x8c1ce6[_0xbb10('0x3f')]};return db[_0xbb10('0x30')]['count'](_0x43b948)[_0xbb10('0x16')](function(_0x41bbf8){_0x9de708['count']=_0x41bbf8;if(_0x1da9c9[_0xbb10('0x33')][_0xbb10('0x46')]){_0x8c1ce6[_0xbb10('0x47')]=[{'all':!![]}];}return db[_0xbb10('0x30')][_0xbb10('0x48')](_0x8c1ce6);})[_0xbb10('0x16')](function(_0x3e06b0){_0x9de708['rows']=_0x3e06b0;return _0x9de708;})['then'](respondWithFilteredResult(_0x441d15,_0x8c1ce6))[_0xbb10('0x21')](handleError(_0x441d15,null));};exports[_0xbb10('0x49')]=function(_0x2b12bd,_0x57d2c0){var _0x5f0c12={'raw':![],'where':{'id':_0x2b12bd[_0xbb10('0x4a')]['id']}},_0x3cd6f3={};_0x3cd6f3[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x30')][_0xbb10('0x31')]);_0x3cd6f3[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x2b12bd[_0xbb10('0x33')]);_0x3cd6f3[_0xbb10('0x36')]=_['intersection'](_0x3cd6f3['model'],_0x3cd6f3[_0xbb10('0x33')]);_0x5f0c12[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x3cd6f3[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x38')]));_0x5f0c12[_0xbb10('0x39')]=_0x5f0c12[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x5f0c12[_0xbb10('0x39')]:_0x3cd6f3[_0xbb10('0x37')];if(_0x2b12bd[_0xbb10('0x33')][_0xbb10('0x46')]){_0x5f0c12[_0xbb10('0x47')]=[{'all':!![]}];}_0x5f0c12=_['merge']({},_0x5f0c12,_0x2b12bd[_0xbb10('0x45')]);return db['ZohoConfiguration'][_0xbb10('0x4c')](_0x5f0c12)[_0xbb10('0x16')](handleEntityNotFound(_0x57d2c0,null))[_0xbb10('0x16')](respondWithResult(_0x57d2c0,null))[_0xbb10('0x21')](handleError(_0x57d2c0,null));};exports[_0xbb10('0x4d')]=function(_0x32d8e9,_0x2e3326){return db[_0xbb10('0x30')][_0xbb10('0x4d')](_0x32d8e9[_0xbb10('0x4e')],{})[_0xbb10('0x16')](respondWithResult(_0x2e3326,0xc9))[_0xbb10('0x21')](handleError(_0x2e3326,null));};exports[_0xbb10('0x2b')]=function(_0x3d7e17,_0x4475e1){if(_0x3d7e17['body']['id']){delete _0x3d7e17[_0xbb10('0x4e')]['id'];}return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x3d7e17[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4475e1,null))[_0xbb10('0x16')](saveUpdates(_0x3d7e17['body'],null))[_0xbb10('0x16')](respondWithResult(_0x4475e1,null))[_0xbb10('0x21')](handleError(_0x4475e1,null));};exports[_0xbb10('0x4f')]=function(_0x14fed3,_0x432728){return db[_0xbb10('0x30')][_0xbb10('0x4c')]({'where':{'id':_0x14fed3[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x432728,null))[_0xbb10('0x16')](removeEntity(_0x432728,null))[_0xbb10('0x21')](handleError(_0x432728,null));};exports[_0xbb10('0x50')]=function(_0x16932f,_0x4e7fac,_0x4ea1a6){var _0x16272d={};var _0x3e6338={};var _0x3d0cb7;var _0x8b0a7d;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x16932f[_0xbb10('0x4a')]['id']}})[_0xbb10('0x16')](handleEntityNotFound(_0x4e7fac,null))[_0xbb10('0x16')](function(_0x2dd150){if(_0x2dd150){_0x3d0cb7=_0x2dd150;_0x3e6338[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')]['rawAttributes']);_0x3e6338[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x16932f['query']);_0x3e6338['filters']=_['intersection'](_0x3e6338[_0xbb10('0x37')],_0x3e6338[_0xbb10('0x33')]);_0x16272d[_0xbb10('0x39')]=_['intersection'](_0x3e6338['model'],qs['fields'](_0x16932f[_0xbb10('0x33')][_0xbb10('0x38')]));_0x16272d[_0xbb10('0x39')]=_0x16272d['attributes'][_0xbb10('0x3a')]?_0x16272d[_0xbb10('0x39')]:_0x3e6338['model'];_0x16272d['order']=qs[_0xbb10('0x3e')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x16272d[_0xbb10('0x3f')]=qs['filters'](_[_0xbb10('0x40')](_0x16932f[_0xbb10('0x33')],_0x3e6338[_0xbb10('0x36')]));if(_0x16932f['query'][_0xbb10('0x42')]){_0x16272d[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x16272d['where'],{'$or':_[_0xbb10('0x43')](_0x16272d[_0xbb10('0x39')],function(_0x3b0f08){var _0x37b65f={};_0x37b65f[_0x3b0f08]={'$like':'%'+_0x16932f['query'][_0xbb10('0x42')]+'%'};return _0x37b65f;})});}_0x16272d=_[_0xbb10('0x44')]({},_0x16272d,_0x16932f[_0xbb10('0x45')]);return _0x3d0cb7[_0xbb10('0x50')](_0x16272d);}})['then'](function(_0x354ea7){if(_0x354ea7){_0x8b0a7d=_0x354ea7[_0xbb10('0x3a')];if(!_0x16932f[_0xbb10('0x33')][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x16272d[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x16932f['query']['limit']);_0x16272d['offset']=qs[_0xbb10('0x25')](_0x16932f[_0xbb10('0x33')][_0xbb10('0x25')]);}return _0x3d0cb7['getFields'](_0x16272d);}})['then'](function(_0x46f462){if(_0x46f462){return _0x46f462?{'count':_0x8b0a7d,'rows':_0x46f462}:null;}})[_0xbb10('0x16')](respondWithResult(_0x4e7fac,null))[_0xbb10('0x21')](handleError(_0x4e7fac,null));};exports[_0xbb10('0x52')]=function(_0x260e06,_0x1ad2ed,_0x4cf2f3){var _0x1a5ca5={};var _0x15fae2={};var _0x270fdb;var _0x14f16b;return db[_0xbb10('0x30')]['findOne']({'where':{'id':_0x260e06['params']['id']}})['then'](handleEntityNotFound(_0x1ad2ed,null))[_0xbb10('0x16')](function(_0x1e0569){if(_0x1e0569){_0x270fdb=_0x1e0569;_0x15fae2[_0xbb10('0x37')]=_[_0xbb10('0x32')](db[_0xbb10('0x51')][_0xbb10('0x31')]);_0x15fae2['query']=_[_0xbb10('0x32')](_0x260e06['query']);_0x15fae2['filters']=_['intersection'](_0x15fae2[_0xbb10('0x37')],_0x15fae2[_0xbb10('0x33')]);_0x1a5ca5[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x15fae2['model'],qs[_0xbb10('0x38')](_0x260e06['query']['fields']));_0x1a5ca5[_0xbb10('0x39')]=_0x1a5ca5[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x1a5ca5[_0xbb10('0x39')]:_0x15fae2[_0xbb10('0x37')];_0x1a5ca5['order']=qs[_0xbb10('0x3e')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x1a5ca5[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x260e06[_0xbb10('0x33')],_0x15fae2['filters']));if(_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]){_0x1a5ca5[_0xbb10('0x3f')]=_[_0xbb10('0x44')](_0x1a5ca5[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x1a5ca5[_0xbb10('0x39')],function(_0x312a08){var _0x5a4429={};_0x5a4429[_0x312a08]={'$like':'%'+_0x260e06[_0xbb10('0x33')][_0xbb10('0x42')]+'%'};return _0x5a4429;})});}_0x1a5ca5=_[_0xbb10('0x44')]({},_0x1a5ca5,_0x260e06['options']);return _0x270fdb['getSubjects'](_0x1a5ca5);}})['then'](function(_0x23286d){if(_0x23286d){_0x14f16b=_0x23286d['length'];if(!_0x260e06['query'][_0xbb10('0x3b')](_0xbb10('0x3c'))){_0x1a5ca5[_0xbb10('0x26')]=qs[_0xbb10('0x26')](_0x260e06[_0xbb10('0x33')][_0xbb10('0x26')]);_0x1a5ca5[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x260e06[_0xbb10('0x33')]['offset']);}return _0x270fdb[_0xbb10('0x52')](_0x1a5ca5);}})[_0xbb10('0x16')](function(_0x46b6d2){if(_0x46b6d2){return _0x46b6d2?{'count':_0x14f16b,'rows':_0x46b6d2}:null;}})[_0xbb10('0x16')](respondWithResult(_0x1ad2ed,null))['catch'](handleError(_0x1ad2ed,null));};exports['getDescriptions']=function(_0x3547a3,_0x2280bd,_0x30f0a4){var _0x32bb25={};var _0x5ee705={};var _0x17d596;var _0x275bce;return db[_0xbb10('0x30')][_0xbb10('0x53')]({'where':{'id':_0x3547a3[_0xbb10('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2280bd,null))['then'](function(_0x372636){if(_0x372636){_0x17d596=_0x372636;_0x5ee705[_0xbb10('0x37')]=_[_0xbb10('0x32')](db['ZohoField'][_0xbb10('0x31')]);_0x5ee705[_0xbb10('0x33')]=_['keys'](_0x3547a3['query']);_0x5ee705[_0xbb10('0x36')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],_0x5ee705['query']);_0x32bb25[_0xbb10('0x39')]=_[_0xbb10('0x4b')](_0x5ee705[_0xbb10('0x37')],qs[_0xbb10('0x38')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x38')]));_0x32bb25[_0xbb10('0x39')]=_0x32bb25[_0xbb10('0x39')][_0xbb10('0x3a')]?_0x32bb25['attributes']:_0x5ee705[_0xbb10('0x37')];_0x32bb25[_0xbb10('0x3d')]=qs[_0xbb10('0x3e')](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3e')]);_0x32bb25[_0xbb10('0x3f')]=qs[_0xbb10('0x36')](_[_0xbb10('0x40')](_0x3547a3[_0xbb10('0x33')],_0x5ee705[_0xbb10('0x36')]));if(_0x3547a3[_0xbb10('0x33')][_0xbb10('0x42')]){_0x32bb25['where']=_['merge'](_0x32bb25[_0xbb10('0x3f')],{'$or':_[_0xbb10('0x43')](_0x32bb25[_0xbb10('0x39')],function(_0x3fd367){var _0x238c7a={};_0x238c7a[_0x3fd367]={'$like':'%'+_0x3547a3['query'][_0xbb10('0x42')]+'%'};return _0x238c7a;})});}_0x32bb25=_[_0xbb10('0x44')]({},_0x32bb25,_0x3547a3[_0xbb10('0x45')]);return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})[_0xbb10('0x16')](function(_0x379d49){if(_0x379d49){_0x275bce=_0x379d49['length'];if(!_0x3547a3[_0xbb10('0x33')][_0xbb10('0x3b')]('nolimit')){_0x32bb25[_0xbb10('0x26')]=qs['limit'](_0x3547a3[_0xbb10('0x33')][_0xbb10('0x26')]);_0x32bb25[_0xbb10('0x25')]=qs[_0xbb10('0x25')](_0x3547a3[_0xbb10('0x33')]['offset']);}return _0x17d596[_0xbb10('0x54')](_0x32bb25);}})['then'](function(_0x3fcc55){if(_0x3fcc55){return _0x3fcc55?{'count':_0x275bce,'rows':_0x3fcc55}:null;}})[_0xbb10('0x16')](respondWithResult(_0x2280bd,null))['catch'](handleError(_0x2280bd,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index d1e4fb6..66eeeba 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 _0x8664=['moment','bluebird','request-promise','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x487c82,_0xf93698){var _0x4fa4b9=function(_0x4f4fc3){while(--_0x4f4fc3){_0x487c82['push'](_0x487c82['shift']());}};_0x4fa4b9(++_0xf93698);}(_0x8664,0x11a));var _0x4866=function(_0x36f7dd,_0x4550e7){_0x36f7dd=_0x36f7dd-0x0;var _0x300279=_0x8664[_0x36f7dd];return _0x300279;};'use strict';var _=require(_0x4866('0x0'));var util=require(_0x4866('0x1'));var logger=require(_0x4866('0x2'))(_0x4866('0x3'));var moment=require(_0x4866('0x4'));var BPromise=require(_0x4866('0x5'));var rp=require(_0x4866('0x6'));var attributes=require(_0x4866('0x7'));module[_0x4866('0x8')]=function(_0x4a2986,_0x1d8d7a){return _0x4a2986['define'](_0x4866('0x9'),attributes,{'tableName':_0x4866('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e63=['util','../../config/logger','moment','bluebird','request-promise','exports','ZohoConfiguration','int_zoho_configurations','lodash'];(function(_0xb4e606,_0x2657e9){var _0x36efbe=function(_0x5e757b){while(--_0x5e757b){_0xb4e606['push'](_0xb4e606['shift']());}};_0x36efbe(++_0x2657e9);}(_0x7e63,0x74));var _0x37e6=function(_0x1104bd,_0x359388){_0x1104bd=_0x1104bd-0x0;var _0x5856d2=_0x7e63[_0x1104bd];return _0x5856d2;};'use strict';var _=require(_0x37e6('0x0'));var util=require(_0x37e6('0x1'));var logger=require(_0x37e6('0x2'))('api');var moment=require(_0x37e6('0x3'));var BPromise=require(_0x37e6('0x4'));var rp=require(_0x37e6('0x5'));var attributes=require('./intZohoConfiguration.attributes');module[_0x37e6('0x6')]=function(_0x44c003,_0x4ad1a9){return _0x44c003['define'](_0x37e6('0x7'),attributes,{'tableName':_0x37e6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index db36a4c..1c74a7a 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 _0xb10b=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f288d,_0x3c7a97){_0x3f288d=_0x3f288d-0x0;var _0x5e8468=_0xb10b[_0x3f288d];return _0x5e8468;};'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 db=require('../../mysqldb')['db'];var utils=require(_0xbb10('0x4'));var logger=require(_0xbb10('0x5'))(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var jayson=require(_0xbb10('0x8'));var client=jayson[_0xbb10('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x328583,_0x3cdd53,_0x513741){return new BPromise(function(_0x1b9e94,_0x3fb675){return client[_0xbb10('0xa')](_0x328583,_0x513741)[_0xbb10('0xb')](function(_0x2353ef){logger[_0xbb10('0xc')](_0xbb10('0xd'),_0x3cdd53,_0xbb10('0xe'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3cdd53,_0xbb10('0xe'),JSON[_0xbb10('0xf')](_0x2353ef));if(_0x2353ef[_0xbb10('0x10')]){if(_0x2353ef['error'][_0xbb10('0x11')]===0x1f4){logger['error'](_0xbb10('0xd'),_0x3cdd53,_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);return _0x3fb675(_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);}logger[_0xbb10('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3cdd53,_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);return _0x1b9e94(_0x2353ef[_0xbb10('0x10')][_0xbb10('0x12')]);}else{logger[_0xbb10('0xc')](_0xbb10('0xd'),_0x3cdd53,_0xbb10('0xe'));_0x1b9e94(_0x2353ef[_0xbb10('0x13')][_0xbb10('0x12')]);}})[_0xbb10('0x14')](function(_0x4a2bfc){logger[_0xbb10('0x10')](_0xbb10('0xd'),_0x3cdd53,_0x4a2bfc);_0x3fb675(_0x4a2bfc);});});} \ No newline at end of file +var _0xadb5=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x230bf0,_0x2f9370){var _0x3d5812=function(_0x5ac196){while(--_0x5ac196){_0x230bf0['push'](_0x230bf0['shift']());}};_0x3d5812(++_0x2f9370);}(_0xadb5,0xad));var _0x5adb=function(_0x200427,_0x4aa670){_0x200427=_0x200427-0x0;var _0x4032cd=_0xadb5[_0x200427];return _0x4032cd;};'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 db=require(_0x5adb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5adb('0x4'))(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5adb('0x7')][_0x5adb('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3e2555,_0x3213e8,_0xdf3776){return new BPromise(function(_0x353885,_0x47228a){return client[_0x5adb('0x9')](_0x3e2555,_0xdf3776)[_0x5adb('0xa')](function(_0x7293ab){logger[_0x5adb('0xb')](_0x5adb('0xc'),_0x3213e8,_0x5adb('0xd'));logger[_0x5adb('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3213e8,'request\x20sent',JSON[_0x5adb('0xf')](_0x7293ab));if(_0x7293ab[_0x5adb('0x10')]){if(_0x7293ab[_0x5adb('0x10')]['code']===0x1f4){logger[_0x5adb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x7293ab[_0x5adb('0x10')]['message']);return _0x47228a(_0x7293ab[_0x5adb('0x10')][_0x5adb('0x11')]);}logger[_0x5adb('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x7293ab[_0x5adb('0x10')][_0x5adb('0x11')]);return _0x353885(_0x7293ab[_0x5adb('0x10')]['message']);}else{logger[_0x5adb('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x3213e8,_0x5adb('0xd'));_0x353885(_0x7293ab[_0x5adb('0x12')][_0x5adb('0x11')]);}})[_0x5adb('0x13')](function(_0x1c0f97){logger[_0x5adb('0x10')](_0x5adb('0xc'),_0x3213e8,_0x1c0f97);_0x47228a(_0x1c0f97);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f320e4e..4a25247 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 _0x7a35=['../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','path','express','Router','../../components/auth/service'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0x7a35,0x11c));var _0x57a3=function(_0xa40210,_0x51c664){_0xa40210=_0xa40210-0x0;var _0xae0140=_0x7a35[_0xa40210];return _0xae0140;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x57a3('0x0'));var express=require(_0x57a3('0x1'));var router=express[_0x57a3('0x2')]();var auth=require(_0x57a3('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x57a3('0x4'));var controller=require(_0x57a3('0x5'));router['get']('/',auth[_0x57a3('0x6')](),controller[_0x57a3('0x7')]);router[_0x57a3('0x8')](_0x57a3('0x9'),auth[_0x57a3('0x6')](),controller[_0x57a3('0xa')]);router[_0x57a3('0xb')]('/',auth[_0x57a3('0x6')](),controller[_0x57a3('0xc')]);router[_0x57a3('0xd')](_0x57a3('0x9'),auth[_0x57a3('0x6')](),controller['update']);router[_0x57a3('0xe')](_0x57a3('0x9'),auth[_0x57a3('0x6')](),controller[_0x57a3('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf940=['put','update','delete','destroy','exports','multer','util','path','express','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x19fbc5,_0x267255){var _0x3836f2=function(_0x55f16b){while(--_0x55f16b){_0x19fbc5['push'](_0x19fbc5['shift']());}};_0x3836f2(++_0x267255);}(_0xf940,0x95));var _0x0f94=function(_0x57d074,_0x444670){_0x57d074=_0x57d074-0x0;var _0x1aa706=_0xf940[_0x57d074];return _0x1aa706;};'use strict';var multer=require(_0x0f94('0x0'));var util=require(_0x0f94('0x1'));var path=require(_0x0f94('0x2'));var express=require(_0x0f94('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x0f94('0x4')]('/',auth['isAuthenticated'](),controller[_0x0f94('0x5')]);router['get'](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0x8')]);router[_0x0f94('0x9')]('/',auth[_0x0f94('0x7')](),controller[_0x0f94('0xa')]);router[_0x0f94('0xb')](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0xc')]);router[_0x0f94('0xd')](_0x0f94('0x6'),auth[_0x0f94('0x7')](),controller[_0x0f94('0xe')]);module[_0x0f94('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 63ecc31..6b53b69 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 _0xe706=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x47e93d,_0x26bbdd){var _0xe86c46=function(_0x10e072){while(--_0x10e072){_0x47e93d['push'](_0x47e93d['shift']());}};_0xe86c46(++_0x26bbdd);}(_0xe706,0xa3));var _0x6e70=function(_0x55cc6a,_0x5dbd65){_0x55cc6a=_0x55cc6a-0x0;var _0x26e2cd=_0xe706[_0x55cc6a];return _0x26e2cd;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'type':{'type':Sequelize[_0x6e70('0x2')]('string',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')),'defaultValue':_0x6e70('0x6')},'content':{'type':Sequelize[_0x6e70('0x7')]},'key':{'type':Sequelize[_0x6e70('0x7')]},'keyType':{'type':Sequelize[_0x6e70('0x2')](_0x6e70('0x6'),_0x6e70('0x3'),_0x6e70('0x4'))},'keyContent':{'type':Sequelize[_0x6e70('0x7')]},'idField':{'type':Sequelize[_0x6e70('0x7')]},'nameField':{'type':Sequelize[_0x6e70('0x7')]},'customField':{'type':Sequelize[_0x6e70('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e70('0x7')]}}; \ No newline at end of file +var _0xec56=['customVariable','keyValue','STRING','ENUM','BOOLEAN','sequelize','string','variable'];(function(_0x128715,_0xbad57e){var _0x5be107=function(_0xd2f07c){while(--_0xd2f07c){_0x128715['push'](_0x128715['shift']());}};_0x5be107(++_0xbad57e);}(_0xec56,0x1bd));var _0x6ec5=function(_0x5a7014,_0xa1c884){_0x5a7014=_0x5a7014-0x0;var _0x169050=_0xec56[_0x5a7014];return _0x169050;};'use strict';var Sequelize=require(_0x6ec5('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'),_0x6ec5('0x4')),'defaultValue':_0x6ec5('0x1')},'content':{'type':Sequelize[_0x6ec5('0x5')]},'key':{'type':Sequelize[_0x6ec5('0x5')]},'keyType':{'type':Sequelize[_0x6ec5('0x6')](_0x6ec5('0x1'),_0x6ec5('0x2'),_0x6ec5('0x3'))},'keyContent':{'type':Sequelize[_0x6ec5('0x5')]},'idField':{'type':Sequelize[_0x6ec5('0x5')]},'nameField':{'type':Sequelize[_0x6ec5('0x5')]},'customField':{'type':Sequelize[_0x6ec5('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ec5('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 16a0b41..6ff4856 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 _0x4e02=['sort','pick','day','add','merge','where','map','filter','options','includeAll','catch','length','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','stack','name','send','index','ZohoField','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','order'];(function(_0x3710e6,_0x4ed6f8){var _0x202266=function(_0x2a9eac){while(--_0x2a9eac){_0x3710e6['push'](_0x3710e6['shift']());}};_0x202266(++_0x4ed6f8);}(_0x4e02,0x1d0));var _0x24e0=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0x4e02[_0x44c935];return _0x465bee;};'use strict';var jsonpatch=require(_0x24e0('0x0'));var rp=require(_0x24e0('0x1'));var moment=require(_0x24e0('0x2'));var BPromise=require(_0x24e0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x24e0('0x4'));var sox=require(_0x24e0('0x5'));var csv=require(_0x24e0('0x6'));var ejs=require(_0x24e0('0x7'));var fs=require('fs');var _=require(_0x24e0('0x8'));var squel=require(_0x24e0('0x9'));var crypto=require(_0x24e0('0xa'));var jsforce=require(_0x24e0('0xb'));var deskjs=require(_0x24e0('0xc'));var toCsv=require(_0x24e0('0x6'));var querystring=require('querystring');var Papa=require(_0x24e0('0xd'));var qs=require(_0x24e0('0xe'));var logger=require(_0x24e0('0xf'))(_0x24e0('0x10'));var utils=require('../../config/utils');var config=require(_0x24e0('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fd1b8,_0x1ce00c){_0x1ce00c=_0x1ce00c||0xcc;return function(_0x4d335b){if(_0x4d335b){return _0x2fd1b8['sendStatus'](_0x1ce00c);}return _0x2fd1b8[_0x24e0('0x12')](_0x1ce00c)[_0x24e0('0x13')]();};}function respondWithResult(_0xd074d1,_0x47ae8c){_0x47ae8c=_0x47ae8c||0xc8;return function(_0xd4b087){if(_0xd4b087){return _0xd074d1[_0x24e0('0x12')](_0x47ae8c)['json'](_0xd4b087);}};}function respondWithFilteredResult(_0x461ac3,_0x5552a1){return function(_0x4b2f5d){if(_0x4b2f5d){var _0x1affae=_0x4b2f5d[_0x24e0('0x14')],_0x208d1e=_0x5552a1[_0x24e0('0x15')],_0x3c4ab2=_0x5552a1[_0x24e0('0x15')]+_0x5552a1[_0x24e0('0x16')],_0x14cb17;if(_0x3c4ab2>=_0x1affae){_0x3c4ab2=_0x1affae;_0x14cb17=0xc8;}else{_0x14cb17=0xce;}_0x461ac3[_0x24e0('0x12')](_0x14cb17);return _0x461ac3[_0x24e0('0x17')](_0x24e0('0x18'),_0x208d1e+'-'+_0x3c4ab2+'/'+_0x1affae)[_0x24e0('0x19')](_0x4b2f5d);}return null;};}function patchUpdates(_0x24022e){return function(_0x2dab1a){try{jsonpatch[_0x24e0('0x1a')](_0x2dab1a,_0x24022e,!![]);}catch(_0x5cfda5){return BPromise['reject'](_0x5cfda5);}return _0x2dab1a[_0x24e0('0x1b')]();};}function saveUpdates(_0x2986e8,_0xccb659){return function(_0x257793){if(_0x257793){return _0x257793[_0x24e0('0x1c')](_0x2986e8)[_0x24e0('0x1d')](function(_0x18c7fe){return _0x18c7fe;});}return null;};}function removeEntity(_0x5344fd,_0x526a50){return function(_0xd189a1){if(_0xd189a1){return _0xd189a1[_0x24e0('0x1e')]()[_0x24e0('0x1d')](function(){_0x5344fd[_0x24e0('0x12')](0xcc)[_0x24e0('0x13')]();});}};}function handleEntityNotFound(_0x50f455,_0x27d2ea){return function(_0xfaa8bc){if(!_0xfaa8bc){_0x50f455[_0x24e0('0x1f')](0x194);}return _0xfaa8bc;};}function handleError(_0x53a9e1,_0x435f9f){_0x435f9f=_0x435f9f||0x1f4;return function(_0x4a6a1c){logger['error'](_0x4a6a1c[_0x24e0('0x20')]);if(_0x4a6a1c[_0x24e0('0x21')]){delete _0x4a6a1c[_0x24e0('0x21')];}_0x53a9e1['status'](_0x435f9f)[_0x24e0('0x22')](_0x4a6a1c);};}exports[_0x24e0('0x23')]=function(_0x26cf57,_0x461084){var _0x524575={},_0x419210={},_0x1b5702={'count':0x0,'rows':[]};var _0x5ebc33=db[_0x24e0('0x24')][_0x24e0('0x25')];_0x419210[_0x24e0('0x26')]=_[_0x24e0('0x27')](_0x5ebc33);var _0x2eec40={'dateStart':_0x26cf57[_0x24e0('0x28')][_0x24e0('0x29')],'dateEnd':_0x26cf57[_0x24e0('0x28')][_0x24e0('0x2a')]};delete _0x26cf57['query']['dateStart'];delete _0x26cf57['query'][_0x24e0('0x2a')];_0x419210[_0x24e0('0x28')]=_[_0x24e0('0x27')](_0x26cf57[_0x24e0('0x28')]);_0x419210[_0x24e0('0x2b')]=_[_0x24e0('0x2c')](_0x419210['model'],_0x419210['query']);_0x524575[_0x24e0('0x2d')]=_[_0x24e0('0x2c')](_0x419210[_0x24e0('0x26')],qs[_0x24e0('0x2e')](_0x26cf57['query'][_0x24e0('0x2e')]));_0x524575[_0x24e0('0x2d')]=_0x524575[_0x24e0('0x2d')]['length']?_0x524575['attributes']:_0x419210[_0x24e0('0x26')];if(!_0x26cf57[_0x24e0('0x28')]['hasOwnProperty']('nolimit')){_0x524575['limit']=qs['limit'](_0x26cf57[_0x24e0('0x28')]['limit']);_0x524575['offset']=qs[_0x24e0('0x15')](_0x26cf57[_0x24e0('0x28')][_0x24e0('0x15')]);}_0x524575[_0x24e0('0x2f')]=qs[_0x24e0('0x30')](_0x26cf57[_0x24e0('0x28')][_0x24e0('0x30')]);_0x524575['where']=qs['filters'](_[_0x24e0('0x31')](_0x26cf57[_0x24e0('0x28')],_0x419210['filters']));if(_0x2eec40[_0x24e0('0x29')]){if(_0x2eec40[_0x24e0('0x2a')]){_0x2eec40['dateEnd']=moment(_0x2eec40[_0x24e0('0x2a')])['add'](0x1,_0x24e0('0x32'));}else{_0x2eec40['dateEnd']=moment(_0x2eec40[_0x24e0('0x29')])[_0x24e0('0x33')](0x1,'day');}_[_0x24e0('0x34')](_0x524575[_0x24e0('0x35')],{'createdAt':{'$gte':_0x2eec40[_0x24e0('0x29')],'$lte':_0x2eec40[_0x24e0('0x2a')]}});}if(_0x26cf57['query']['filter']){_0x524575[_0x24e0('0x35')]=_['merge'](_0x524575[_0x24e0('0x35')],{'$or':_[_0x24e0('0x36')](_0x524575[_0x24e0('0x2d')],function(_0xb206dd){var _0xb9c562={};_0xb9c562[_0xb206dd]={'$like':'%'+_0x26cf57[_0x24e0('0x28')][_0x24e0('0x37')]+'%'};return _0xb9c562;})});}_0x524575=_['merge']({},_0x524575,_0x26cf57[_0x24e0('0x38')]);var _0x4b5df0={'where':_0x524575[_0x24e0('0x35')]};return db[_0x24e0('0x24')][_0x24e0('0x14')](_0x4b5df0)[_0x24e0('0x1d')](function(_0x2fadf3){_0x1b5702[_0x24e0('0x14')]=_0x2fadf3;if(_0x26cf57[_0x24e0('0x28')][_0x24e0('0x39')]){_0x524575['include']=[{'all':!![]}];}return db[_0x24e0('0x24')]['findAll'](_0x524575);})[_0x24e0('0x1d')](function(_0x204640){_0x1b5702['rows']=_0x204640;return _0x1b5702;})[_0x24e0('0x1d')](respondWithFilteredResult(_0x461084,_0x524575))[_0x24e0('0x3a')](handleError(_0x461084,null));};exports['show']=function(_0x19b406,_0x29f88f){var _0x2d4d34={'raw':!![],'where':{'id':_0x19b406['params']['id']}},_0x1de707={};_0x1de707[_0x24e0('0x26')]=_['keys'](db['ZohoField'][_0x24e0('0x25')]);_0x1de707[_0x24e0('0x28')]=_[_0x24e0('0x27')](_0x19b406[_0x24e0('0x28')]);_0x1de707[_0x24e0('0x2b')]=_['intersection'](_0x1de707[_0x24e0('0x26')],_0x1de707[_0x24e0('0x28')]);_0x2d4d34['attributes']=_[_0x24e0('0x2c')](_0x1de707[_0x24e0('0x26')],qs[_0x24e0('0x2e')](_0x19b406[_0x24e0('0x28')][_0x24e0('0x2e')]));_0x2d4d34[_0x24e0('0x2d')]=_0x2d4d34[_0x24e0('0x2d')][_0x24e0('0x3b')]?_0x2d4d34[_0x24e0('0x2d')]:_0x1de707[_0x24e0('0x26')];if(_0x19b406['query'][_0x24e0('0x39')]){_0x2d4d34['include']=[{'all':!![]}];}_0x2d4d34=_[_0x24e0('0x34')]({},_0x2d4d34,_0x19b406[_0x24e0('0x38')]);return db[_0x24e0('0x24')][_0x24e0('0x3c')](_0x2d4d34)[_0x24e0('0x1d')](handleEntityNotFound(_0x29f88f,null))[_0x24e0('0x1d')](respondWithResult(_0x29f88f,null))[_0x24e0('0x3a')](handleError(_0x29f88f,null));};exports[_0x24e0('0x3d')]=function(_0x25478f,_0x49cfcd){return db[_0x24e0('0x24')][_0x24e0('0x3d')](_0x25478f[_0x24e0('0x3e')],{})[_0x24e0('0x1d')](respondWithResult(_0x49cfcd,0xc9))[_0x24e0('0x3a')](handleError(_0x49cfcd,null));};exports[_0x24e0('0x1c')]=function(_0x73c1a7,_0x58ae8d){if(_0x73c1a7[_0x24e0('0x3e')]['id']){delete _0x73c1a7[_0x24e0('0x3e')]['id'];}return db[_0x24e0('0x24')][_0x24e0('0x3c')]({'where':{'id':_0x73c1a7[_0x24e0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x58ae8d,null))[_0x24e0('0x1d')](saveUpdates(_0x73c1a7[_0x24e0('0x3e')],null))[_0x24e0('0x1d')](respondWithResult(_0x58ae8d,null))['catch'](handleError(_0x58ae8d,null));};exports[_0x24e0('0x1e')]=function(_0x232c9b,_0x32eb50){return db[_0x24e0('0x24')][_0x24e0('0x3c')]({'where':{'id':_0x232c9b[_0x24e0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x32eb50,null))[_0x24e0('0x1d')](removeEntity(_0x32eb50,null))[_0x24e0('0x3a')](handleError(_0x32eb50,null));}; \ No newline at end of file +var _0x942a=['model','dateStart','query','dateEnd','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','ZohoField','rawAttributes'];(function(_0x5857a7,_0x3f8601){var _0x2c35e4=function(_0x1e3492){while(--_0x1e3492){_0x5857a7['push'](_0x5857a7['shift']());}};_0x2c35e4(++_0x3f8601);}(_0x942a,0xa3));var _0xa942=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x942a[_0x373dee];return _0x46798f;};'use strict';var jsonpatch=require(_0xa942('0x0'));var rp=require(_0xa942('0x1'));var moment=require('moment');var BPromise=require(_0xa942('0x2'));var Mustache=require('mustache');var util=require(_0xa942('0x3'));var path=require(_0xa942('0x4'));var sox=require('sox');var csv=require(_0xa942('0x5'));var ejs=require(_0xa942('0x6'));var fs=require('fs');var _=require(_0xa942('0x7'));var squel=require(_0xa942('0x8'));var crypto=require(_0xa942('0x9'));var jsforce=require(_0xa942('0xa'));var deskjs=require(_0xa942('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xa942('0xc'));var logger=require('../../config/logger')(_0xa942('0xd'));var utils=require('../../config/utils');var config=require(_0xa942('0xe'));var db=require(_0xa942('0xf'))['db'];function respondWithStatusCode(_0x59b047,_0x322186){_0x322186=_0x322186||0xcc;return function(_0x380dde){if(_0x380dde){return _0x59b047[_0xa942('0x10')](_0x322186);}return _0x59b047[_0xa942('0x11')](_0x322186)['end']();};}function respondWithResult(_0x4d1715,_0xf90d00){_0xf90d00=_0xf90d00||0xc8;return function(_0xdc74ba){if(_0xdc74ba){return _0x4d1715['status'](_0xf90d00)[_0xa942('0x12')](_0xdc74ba);}};}function respondWithFilteredResult(_0x1a6145,_0x7f085){return function(_0x28651f){if(_0x28651f){var _0x5c2fa2=_0x28651f[_0xa942('0x13')],_0x59f2af=_0x7f085[_0xa942('0x14')],_0x3e3f03=_0x7f085[_0xa942('0x14')]+_0x7f085[_0xa942('0x15')],_0x4d7536;if(_0x3e3f03>=_0x5c2fa2){_0x3e3f03=_0x5c2fa2;_0x4d7536=0xc8;}else{_0x4d7536=0xce;}_0x1a6145[_0xa942('0x11')](_0x4d7536);return _0x1a6145['set'](_0xa942('0x16'),_0x59f2af+'-'+_0x3e3f03+'/'+_0x5c2fa2)[_0xa942('0x12')](_0x28651f);}return null;};}function patchUpdates(_0x1137f1){return function(_0x5547cf){try{jsonpatch[_0xa942('0x17')](_0x5547cf,_0x1137f1,!![]);}catch(_0x1a7929){return BPromise[_0xa942('0x18')](_0x1a7929);}return _0x5547cf[_0xa942('0x19')]();};}function saveUpdates(_0x2791fe,_0x2fe12c){return function(_0x3e15e8){if(_0x3e15e8){return _0x3e15e8[_0xa942('0x1a')](_0x2791fe)[_0xa942('0x1b')](function(_0x5b9a4d){return _0x5b9a4d;});}return null;};}function removeEntity(_0x138701,_0xf2a52c){return function(_0x4ada09){if(_0x4ada09){return _0x4ada09[_0xa942('0x1c')]()[_0xa942('0x1b')](function(){_0x138701[_0xa942('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d458c,_0x117d2f){return function(_0x5af3c4){if(!_0x5af3c4){_0x1d458c[_0xa942('0x10')](0x194);}return _0x5af3c4;};}function handleError(_0x546c19,_0x1df937){_0x1df937=_0x1df937||0x1f4;return function(_0x45a071){logger[_0xa942('0x1d')](_0x45a071[_0xa942('0x1e')]);if(_0x45a071[_0xa942('0x1f')]){delete _0x45a071[_0xa942('0x1f')];}_0x546c19[_0xa942('0x11')](_0x1df937)[_0xa942('0x20')](_0x45a071);};}exports['index']=function(_0x258bc1,_0xee1aa4){var _0x1e92e1={},_0x2ff5b7={},_0x58373d={'count':0x0,'rows':[]};var _0x13910c=db[_0xa942('0x21')][_0xa942('0x22')];_0x2ff5b7[_0xa942('0x23')]=_['keys'](_0x13910c);var _0x554dbd={'dateStart':_0x258bc1['query'][_0xa942('0x24')],'dateEnd':_0x258bc1[_0xa942('0x25')][_0xa942('0x26')]};delete _0x258bc1[_0xa942('0x25')]['dateStart'];delete _0x258bc1[_0xa942('0x25')][_0xa942('0x26')];_0x2ff5b7[_0xa942('0x25')]=_[_0xa942('0x27')](_0x258bc1[_0xa942('0x25')]);_0x2ff5b7[_0xa942('0x28')]=_[_0xa942('0x29')](_0x2ff5b7[_0xa942('0x23')],_0x2ff5b7[_0xa942('0x25')]);_0x1e92e1[_0xa942('0x2a')]=_['intersection'](_0x2ff5b7[_0xa942('0x23')],qs['fields'](_0x258bc1['query'][_0xa942('0x2b')]));_0x1e92e1['attributes']=_0x1e92e1[_0xa942('0x2a')][_0xa942('0x2c')]?_0x1e92e1['attributes']:_0x2ff5b7[_0xa942('0x23')];if(!_0x258bc1[_0xa942('0x25')][_0xa942('0x2d')](_0xa942('0x2e'))){_0x1e92e1['limit']=qs[_0xa942('0x15')](_0x258bc1[_0xa942('0x25')][_0xa942('0x15')]);_0x1e92e1[_0xa942('0x14')]=qs[_0xa942('0x14')](_0x258bc1['query'][_0xa942('0x14')]);}_0x1e92e1[_0xa942('0x2f')]=qs[_0xa942('0x30')](_0x258bc1[_0xa942('0x25')][_0xa942('0x30')]);_0x1e92e1[_0xa942('0x31')]=qs[_0xa942('0x28')](_[_0xa942('0x32')](_0x258bc1['query'],_0x2ff5b7['filters']));if(_0x554dbd['dateStart']){if(_0x554dbd[_0xa942('0x26')]){_0x554dbd[_0xa942('0x26')]=moment(_0x554dbd[_0xa942('0x26')])[_0xa942('0x33')](0x1,_0xa942('0x34'));}else{_0x554dbd['dateEnd']=moment(_0x554dbd[_0xa942('0x24')])[_0xa942('0x33')](0x1,_0xa942('0x34'));}_[_0xa942('0x35')](_0x1e92e1['where'],{'createdAt':{'$gte':_0x554dbd[_0xa942('0x24')],'$lte':_0x554dbd[_0xa942('0x26')]}});}if(_0x258bc1[_0xa942('0x25')]['filter']){_0x1e92e1['where']=_[_0xa942('0x35')](_0x1e92e1['where'],{'$or':_['map'](_0x1e92e1[_0xa942('0x2a')],function(_0x82db4d){var _0x4235ec={};_0x4235ec[_0x82db4d]={'$like':'%'+_0x258bc1[_0xa942('0x25')][_0xa942('0x36')]+'%'};return _0x4235ec;})});}_0x1e92e1=_[_0xa942('0x35')]({},_0x1e92e1,_0x258bc1[_0xa942('0x37')]);var _0x131e1f={'where':_0x1e92e1[_0xa942('0x31')]};return db['ZohoField']['count'](_0x131e1f)['then'](function(_0x506244){_0x58373d[_0xa942('0x13')]=_0x506244;if(_0x258bc1[_0xa942('0x25')][_0xa942('0x38')]){_0x1e92e1[_0xa942('0x39')]=[{'all':!![]}];}return db[_0xa942('0x21')][_0xa942('0x3a')](_0x1e92e1);})[_0xa942('0x1b')](function(_0x1c5701){_0x58373d[_0xa942('0x3b')]=_0x1c5701;return _0x58373d;})['then'](respondWithFilteredResult(_0xee1aa4,_0x1e92e1))['catch'](handleError(_0xee1aa4,null));};exports[_0xa942('0x3c')]=function(_0x5d61dc,_0x27bb4a){var _0x5ec056={'raw':!![],'where':{'id':_0x5d61dc[_0xa942('0x3d')]['id']}},_0x2a41ff={};_0x2a41ff[_0xa942('0x23')]=_['keys'](db['ZohoField'][_0xa942('0x22')]);_0x2a41ff[_0xa942('0x25')]=_[_0xa942('0x27')](_0x5d61dc['query']);_0x2a41ff[_0xa942('0x28')]=_[_0xa942('0x29')](_0x2a41ff['model'],_0x2a41ff[_0xa942('0x25')]);_0x5ec056[_0xa942('0x2a')]=_[_0xa942('0x29')](_0x2a41ff['model'],qs[_0xa942('0x2b')](_0x5d61dc['query'][_0xa942('0x2b')]));_0x5ec056[_0xa942('0x2a')]=_0x5ec056[_0xa942('0x2a')][_0xa942('0x2c')]?_0x5ec056[_0xa942('0x2a')]:_0x2a41ff[_0xa942('0x23')];if(_0x5d61dc[_0xa942('0x25')][_0xa942('0x38')]){_0x5ec056[_0xa942('0x39')]=[{'all':!![]}];}_0x5ec056=_[_0xa942('0x35')]({},_0x5ec056,_0x5d61dc['options']);return db[_0xa942('0x21')][_0xa942('0x3e')](_0x5ec056)[_0xa942('0x1b')](handleEntityNotFound(_0x27bb4a,null))['then'](respondWithResult(_0x27bb4a,null))[_0xa942('0x3f')](handleError(_0x27bb4a,null));};exports[_0xa942('0x40')]=function(_0x5541ac,_0x17fb2a){return db['ZohoField'][_0xa942('0x40')](_0x5541ac[_0xa942('0x41')],{})[_0xa942('0x1b')](respondWithResult(_0x17fb2a,0xc9))[_0xa942('0x3f')](handleError(_0x17fb2a,null));};exports['update']=function(_0xe04ad4,_0x4d338b){if(_0xe04ad4[_0xa942('0x41')]['id']){delete _0xe04ad4[_0xa942('0x41')]['id'];}return db[_0xa942('0x21')][_0xa942('0x3e')]({'where':{'id':_0xe04ad4[_0xa942('0x3d')]['id']}})[_0xa942('0x1b')](handleEntityNotFound(_0x4d338b,null))[_0xa942('0x1b')](saveUpdates(_0xe04ad4['body'],null))['then'](respondWithResult(_0x4d338b,null))['catch'](handleError(_0x4d338b,null));};exports['destroy']=function(_0x470720,_0x5defcb){return db[_0xa942('0x21')][_0xa942('0x3e')]({'where':{'id':_0x470720[_0xa942('0x3d')]['id']}})[_0xa942('0x1b')](handleEntityNotFound(_0x5defcb,null))[_0xa942('0x1b')](removeEntity(_0x5defcb,null))['catch'](handleError(_0x5defcb,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7b4538c..5a5734a 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 _0xbef0=['ZohoField','lodash','util','../../config/logger','api','moment','request-promise','./intZohoField.attributes','exports','define'];(function(_0x4d5d5e,_0x2404d1){var _0x44be92=function(_0x31490d){while(--_0x31490d){_0x4d5d5e['push'](_0x4d5d5e['shift']());}};_0x44be92(++_0x2404d1);}(_0xbef0,0x1cd));var _0x0bef=function(_0x5aba17,_0x30c0a5){_0x5aba17=_0x5aba17-0x0;var _0x369470=_0xbef0[_0x5aba17];return _0x369470;};'use strict';var _=require(_0x0bef('0x0'));var util=require(_0x0bef('0x1'));var logger=require(_0x0bef('0x2'))(_0x0bef('0x3'));var moment=require(_0x0bef('0x4'));var BPromise=require('bluebird');var rp=require(_0x0bef('0x5'));var attributes=require(_0x0bef('0x6'));module[_0x0bef('0x7')]=function(_0x4bfe5e,_0x3e9e1d){return _0x4bfe5e[_0x0bef('0x8')](_0x0bef('0x9'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f20=['request-promise','exports','int_zoho_fields','lodash','../../config/logger','api','moment','bluebird'];(function(_0x28c892,_0x161089){var _0x163993=function(_0x1a13af){while(--_0x1a13af){_0x28c892['push'](_0x28c892['shift']());}};_0x163993(++_0x161089);}(_0x2f20,0x103));var _0x02f2=function(_0xfa634c,_0x414e0e){_0xfa634c=_0xfa634c-0x0;var _0x73e478=_0x2f20[_0xfa634c];return _0x73e478;};'use strict';var _=require(_0x02f2('0x0'));var util=require('util');var logger=require(_0x02f2('0x1'))(_0x02f2('0x2'));var moment=require(_0x02f2('0x3'));var BPromise=require(_0x02f2('0x4'));var rp=require(_0x02f2('0x5'));var attributes=require('./intZohoField.attributes');module[_0x02f2('0x6')]=function(_0x5c649c,_0x2c14d2){return _0x5c649c['define']('ZohoField',attributes,{'tableName':_0x02f2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index c40cd19..617fb26 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 _0x9973=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xce5ca4,_0x3dc2c9){var _0x48f38e=function(_0xe61406){while(--_0xe61406){_0xce5ca4['push'](_0xce5ca4['shift']());}};_0x48f38e(++_0x3dc2c9);}(_0x9973,0x157));var _0x3997=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9973[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x3997('0x0'));var moment=require(_0x3997('0x1'));var BPromise=require('bluebird');var rs=require(_0x3997('0x2'));var fs=require('fs');var db=require(_0x3997('0x3'))['db'];var utils=require(_0x3997('0x4'));var logger=require(_0x3997('0x5'))(_0x3997('0x6'));var config=require(_0x3997('0x7'));var jayson=require(_0x3997('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x320340,_0x114d26,_0x3c6b75){return new BPromise(function(_0x483d44,_0x569ddf){return client['request'](_0x320340,_0x3c6b75)[_0x3997('0x9')](function(_0x461310){logger[_0x3997('0xa')](_0x3997('0xb'),_0x114d26,_0x3997('0xc'));logger[_0x3997('0xd')](_0x3997('0xe'),_0x114d26,_0x3997('0xc'),JSON[_0x3997('0xf')](_0x461310));if(_0x461310[_0x3997('0x10')]){if(_0x461310[_0x3997('0x10')][_0x3997('0x11')]===0x1f4){logger[_0x3997('0x10')](_0x3997('0xb'),_0x114d26,_0x461310[_0x3997('0x10')][_0x3997('0x12')]);return _0x569ddf(_0x461310[_0x3997('0x10')][_0x3997('0x12')]);}logger[_0x3997('0x10')](_0x3997('0xb'),_0x114d26,_0x461310[_0x3997('0x10')][_0x3997('0x12')]);return _0x483d44(_0x461310[_0x3997('0x10')]['message']);}else{logger[_0x3997('0xa')](_0x3997('0xb'),_0x114d26,_0x3997('0xc'));_0x483d44(_0x461310[_0x3997('0x13')]['message']);}})[_0x3997('0x14')](function(_0x3b66f3){logger['error']('ZohoField,\x20%s,\x20%s',_0x114d26,_0x3b66f3);_0x569ddf(_0x3b66f3);});});} \ No newline at end of file +var _0xed5c=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s'];(function(_0x37bbfc,_0x4821cc){var _0x4417d9=function(_0x461526){while(--_0x461526){_0x37bbfc['push'](_0x37bbfc['shift']());}};_0x4417d9(++_0x4821cc);}(_0xed5c,0x81));var _0xced5=function(_0x41f818,_0x34e4ed){_0x41f818=_0x41f818-0x0;var _0x560ca8=_0xed5c[_0x41f818];return _0x560ca8;};'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 db=require(_0xced5('0x5'))['db'];var utils=require(_0xced5('0x6'));var logger=require(_0xced5('0x7'))(_0xced5('0x8'));var config=require(_0xced5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xced5('0xa')][_0xced5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b7807,_0x5c59d1,_0x31a495){return new BPromise(function(_0xc738da,_0x2857d8){return client[_0xced5('0xc')](_0x4b7807,_0x31a495)[_0xced5('0xd')](function(_0x56d986){logger['info'](_0xced5('0xe'),_0x5c59d1,_0xced5('0xf'));logger[_0xced5('0x10')](_0xced5('0x11'),_0x5c59d1,'request\x20sent',JSON[_0xced5('0x12')](_0x56d986));if(_0x56d986['error']){if(_0x56d986[_0xced5('0x13')][_0xced5('0x14')]===0x1f4){logger['error'](_0xced5('0xe'),_0x5c59d1,_0x56d986['error'][_0xced5('0x15')]);return _0x2857d8(_0x56d986[_0xced5('0x13')][_0xced5('0x15')]);}logger[_0xced5('0x13')](_0xced5('0xe'),_0x5c59d1,_0x56d986[_0xced5('0x13')][_0xced5('0x15')]);return _0xc738da(_0x56d986['error']['message']);}else{logger[_0xced5('0x16')](_0xced5('0xe'),_0x5c59d1,_0xced5('0xf'));_0xc738da(_0x56d986['result']['message']);}})[_0xced5('0x17')](function(_0x1c8c90){logger[_0xced5('0x13')](_0xced5('0xe'),_0x5c59d1,_0x1c8c90);_0x2857d8(_0x1c8c90);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 9a83390..71042db 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 _0x8107=['multer','util','../../components/auth/service'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x8107,0xe4));var _0x7810=function(_0x506e4e,_0x1e893b){_0x506e4e=_0x506e4e-0x0;var _0x23719c=_0x8107[_0x506e4e];return _0x23719c;};'use strict';var multer=require(_0x7810('0x0'));var util=require(_0x7810('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x7810('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xd3cc=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd3cc,0x1d3));var _0xcd3c=function(_0x5c51df,_0x25b8a3){_0x5c51df=_0x5c51df-0x0;var _0x3dad1f=_0xd3cc[_0x5c51df];return _0x3dad1f;};'use strict';var multer=require(_0xcd3c('0x0'));var util=require(_0xcd3c('0x1'));var path=require(_0xcd3c('0x2'));var express=require(_0xcd3c('0x3'));var router=express[_0xcd3c('0x4')]();var auth=require(_0xcd3c('0x5'));var interaction=require(_0xcd3c('0x6'));var config=require(_0xcd3c('0x7'));module[_0xcd3c('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 0170cd1..8c9c2a4 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 _0x14c0=['INTEGER','BOOLEAN','state','unique_name_and_version','STRING','app.js'];(function(_0x2382e2,_0x1c07e6){var _0x5e9fab=function(_0xfc8c77){while(--_0xfc8c77){_0x2382e2['push'](_0x2382e2['shift']());}};_0x5e9fab(++_0x1c07e6);}(_0x14c0,0xf3));var _0x014c=function(_0x27cb6c,_0x525942){_0x27cb6c=_0x27cb6c-0x0;var _0x50698a=_0x14c0[_0x27cb6c];return _0x50698a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x014c('0x0')},'version':{'type':Sequelize[_0x014c('0x1')],'allowNull':![],'unique':_0x014c('0x0')},'main':{'type':Sequelize[_0x014c('0x1')],'defaultValue':_0x014c('0x2')},'filename':{'type':Sequelize[_0x014c('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x014c('0x1')]},'size':{'type':Sequelize[_0x014c('0x3')]},'active':{'type':Sequelize[_0x014c('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x014c('0x1')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize['STRING'],'unique':_0x014c('0x5')},'description':{'type':Sequelize[_0x014c('0x1')]},'title':{'type':Sequelize[_0x014c('0x1')]},'remoteUri':{'type':Sequelize[_0x014c('0x1')]},'link':{'type':Sequelize[_0x014c('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0x1447=['unique_name_and_version','app.js','INTEGER','BOOLEAN','state','exports','STRING'];(function(_0x590721,_0x7b78b1){var _0x380017=function(_0x4d8470){while(--_0x4d8470){_0x590721['push'](_0x590721['shift']());}};_0x380017(++_0x7b78b1);}(_0x1447,0x18d));var _0x7144=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1447[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7144('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x7144('0x1')],'allowNull':![],'unique':_0x7144('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x7144('0x3')},'filename':{'type':Sequelize[_0x7144('0x1')]},'path':{'type':Sequelize[_0x7144('0x1')]},'type':{'type':Sequelize[_0x7144('0x1')]},'size':{'type':Sequelize[_0x7144('0x4')]},'active':{'type':Sequelize[_0x7144('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x7144('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x7144('0x6')},'description':{'type':Sequelize[_0x7144('0x1')]},'title':{'type':Sequelize[_0x7144('0x1')]},'remoteUri':{'type':Sequelize[_0x7144('0x1')]},'link':{'type':Sequelize[_0x7144('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 29d489e..72164dd 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 _0xc0f6=['filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','add','day','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','reject','save','update','then','destroy','stack','name','index','Integration','rawAttributes','model','dateStart','query','dateEnd'];(function(_0x408a12,_0x2bbe20){var _0x22e968=function(_0x564d5f){while(--_0x564d5f){_0x408a12['push'](_0x408a12['shift']());}};_0x22e968(++_0x2bbe20);}(_0xc0f6,0xa2));var _0x6c0f=function(_0x14d382,_0x54b6bd){_0x14d382=_0x14d382-0x0;var _0x31c6a7=_0xc0f6[_0x14d382];return _0x31c6a7;};'use strict';var jsonpatch=require(_0x6c0f('0x0'));var rp=require(_0x6c0f('0x1'));var moment=require(_0x6c0f('0x2'));var BPromise=require(_0x6c0f('0x3'));var Mustache=require('mustache');var util=require(_0x6c0f('0x4'));var path=require(_0x6c0f('0x5'));var sox=require(_0x6c0f('0x6'));var csv=require(_0x6c0f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6c0f('0x8'));var squel=require(_0x6c0f('0x9'));var crypto=require(_0x6c0f('0xa'));var jsforce=require(_0x6c0f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x6c0f('0x7'));var querystring=require(_0x6c0f('0xc'));var Papa=require(_0x6c0f('0xd'));var qs=require(_0x6c0f('0xe'));var logger=require(_0x6c0f('0xf'))(_0x6c0f('0x10'));var utils=require(_0x6c0f('0x11'));var config=require(_0x6c0f('0x12'));var db=require(_0x6c0f('0x13'))['db'];function respondWithStatusCode(_0x2bd658,_0x2f3cea){_0x2f3cea=_0x2f3cea||0xcc;return function(_0x4c0e0e){if(_0x4c0e0e){return _0x2bd658[_0x6c0f('0x14')](_0x2f3cea);}return _0x2bd658[_0x6c0f('0x15')](_0x2f3cea)[_0x6c0f('0x16')]();};}function respondWithResult(_0x4e8bdd,_0x330e34){_0x330e34=_0x330e34||0xc8;return function(_0x21c422){if(_0x21c422){return _0x4e8bdd[_0x6c0f('0x15')](_0x330e34)[_0x6c0f('0x17')](_0x21c422);}};}function respondWithFilteredResult(_0x273837,_0x512db9){return function(_0x4af5bc){if(_0x4af5bc){var _0xe40c5f=_0x4af5bc[_0x6c0f('0x18')],_0x5149e0=_0x512db9[_0x6c0f('0x19')],_0xbe6f1c=_0x512db9[_0x6c0f('0x19')]+_0x512db9['limit'],_0x1e3a54;if(_0xbe6f1c>=_0xe40c5f){_0xbe6f1c=_0xe40c5f;_0x1e3a54=0xc8;}else{_0x1e3a54=0xce;}_0x273837[_0x6c0f('0x15')](_0x1e3a54);return _0x273837[_0x6c0f('0x1a')](_0x6c0f('0x1b'),_0x5149e0+'-'+_0xbe6f1c+'/'+_0xe40c5f)['json'](_0x4af5bc);}return null;};}function patchUpdates(_0x4235eb){return function(_0x5d194f){try{jsonpatch['apply'](_0x5d194f,_0x4235eb,!![]);}catch(_0x5f5cb2){return BPromise[_0x6c0f('0x1c')](_0x5f5cb2);}return _0x5d194f[_0x6c0f('0x1d')]();};}function saveUpdates(_0x12374c,_0x142c3f){return function(_0x19d45a){if(_0x19d45a){return _0x19d45a[_0x6c0f('0x1e')](_0x12374c)[_0x6c0f('0x1f')](function(_0x594442){return _0x594442;});}return null;};}function removeEntity(_0x18e7f1,_0x44cf34){return function(_0x425214){if(_0x425214){return _0x425214[_0x6c0f('0x20')]()[_0x6c0f('0x1f')](function(){_0x18e7f1[_0x6c0f('0x15')](0xcc)[_0x6c0f('0x16')]();});}};}function handleEntityNotFound(_0x40e77b,_0x33234e){return function(_0x5148e3){if(!_0x5148e3){_0x40e77b[_0x6c0f('0x14')](0x194);}return _0x5148e3;};}function handleError(_0x394895,_0x146a18){_0x146a18=_0x146a18||0x1f4;return function(_0x271f22){logger['error'](_0x271f22[_0x6c0f('0x21')]);if(_0x271f22[_0x6c0f('0x22')]){delete _0x271f22[_0x6c0f('0x22')];}_0x394895['status'](_0x146a18)['send'](_0x271f22);};}exports[_0x6c0f('0x23')]=function(_0x432e7c,_0x1b6165){var _0x3bce85={},_0x370147={},_0x293469={'count':0x0,'rows':[]};var _0x229648=db[_0x6c0f('0x24')][_0x6c0f('0x25')];_0x370147[_0x6c0f('0x26')]=_['keys'](_0x229648);var _0x1b7dbc={'dateStart':_0x432e7c['query'][_0x6c0f('0x27')],'dateEnd':_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x29')]};delete _0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x27')];delete _0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x29')];_0x370147[_0x6c0f('0x28')]=_['keys'](_0x432e7c[_0x6c0f('0x28')]);_0x370147[_0x6c0f('0x2a')]=_[_0x6c0f('0x2b')](_0x370147[_0x6c0f('0x26')],_0x370147[_0x6c0f('0x28')]);_0x3bce85[_0x6c0f('0x2c')]=_[_0x6c0f('0x2b')](_0x370147['model'],qs[_0x6c0f('0x2d')](_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x2d')]));_0x3bce85['attributes']=_0x3bce85['attributes'][_0x6c0f('0x2e')]?_0x3bce85['attributes']:_0x370147[_0x6c0f('0x26')];if(!_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x2f')]('nolimit')){_0x3bce85[_0x6c0f('0x30')]=qs['limit'](_0x432e7c[_0x6c0f('0x28')]['limit']);_0x3bce85['offset']=qs[_0x6c0f('0x19')](_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x19')]);}_0x3bce85['order']=qs[_0x6c0f('0x31')](_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x31')]);_0x3bce85[_0x6c0f('0x32')]=qs[_0x6c0f('0x2a')](_[_0x6c0f('0x33')](_0x432e7c[_0x6c0f('0x28')],_0x370147[_0x6c0f('0x2a')]));if(_0x1b7dbc[_0x6c0f('0x27')]){if(_0x1b7dbc[_0x6c0f('0x29')]){_0x1b7dbc['dateEnd']=moment(_0x1b7dbc[_0x6c0f('0x29')])[_0x6c0f('0x34')](0x1,_0x6c0f('0x35'));}else{_0x1b7dbc[_0x6c0f('0x29')]=moment(_0x1b7dbc['dateStart'])[_0x6c0f('0x34')](0x1,_0x6c0f('0x35'));}_[_0x6c0f('0x36')](_0x3bce85[_0x6c0f('0x32')],{'createdAt':{'$gte':_0x1b7dbc['dateStart'],'$lte':_0x1b7dbc['dateEnd']}});}if(_0x432e7c[_0x6c0f('0x28')]['filter']){_0x3bce85[_0x6c0f('0x32')]=_[_0x6c0f('0x36')](_0x3bce85['where'],{'$or':_['map'](_0x3bce85['attributes'],function(_0x34d757){var _0x2b4994={};_0x2b4994[_0x34d757]={'$like':'%'+_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x37')]+'%'};return _0x2b4994;})});}_0x3bce85=_[_0x6c0f('0x36')]({},_0x3bce85,_0x432e7c[_0x6c0f('0x38')]);var _0x3cda9d={'where':_0x3bce85['where']};return db['Integration']['count'](_0x3cda9d)[_0x6c0f('0x1f')](function(_0x49f179){_0x293469[_0x6c0f('0x18')]=_0x49f179;if(_0x432e7c[_0x6c0f('0x28')][_0x6c0f('0x39')]){_0x3bce85[_0x6c0f('0x3a')]=[{'all':!![]}];}return db[_0x6c0f('0x24')][_0x6c0f('0x3b')](_0x3bce85);})['then'](function(_0x286fae){_0x293469[_0x6c0f('0x3c')]=_0x286fae;return _0x293469;})['then'](respondWithFilteredResult(_0x1b6165,_0x3bce85))[_0x6c0f('0x3d')](handleError(_0x1b6165,null));};exports[_0x6c0f('0x3e')]=function(_0x37deca,_0x646ab6){var _0x59a22d={'raw':![],'where':{'id':_0x37deca[_0x6c0f('0x3f')]['id']}},_0x32ca09={};_0x32ca09[_0x6c0f('0x26')]=_['keys'](db['Integration'][_0x6c0f('0x25')]);_0x32ca09[_0x6c0f('0x28')]=_[_0x6c0f('0x40')](_0x37deca[_0x6c0f('0x28')]);_0x32ca09['filters']=_[_0x6c0f('0x2b')](_0x32ca09[_0x6c0f('0x26')],_0x32ca09['query']);_0x59a22d[_0x6c0f('0x2c')]=_[_0x6c0f('0x2b')](_0x32ca09[_0x6c0f('0x26')],qs[_0x6c0f('0x2d')](_0x37deca[_0x6c0f('0x28')][_0x6c0f('0x2d')]));_0x59a22d[_0x6c0f('0x2c')]=_0x59a22d[_0x6c0f('0x2c')]['length']?_0x59a22d['attributes']:_0x32ca09['model'];if(_0x37deca[_0x6c0f('0x28')][_0x6c0f('0x39')]){_0x59a22d[_0x6c0f('0x3a')]=[{'all':!![]}];}_0x59a22d=_[_0x6c0f('0x36')]({},_0x59a22d,_0x37deca[_0x6c0f('0x38')]);return db[_0x6c0f('0x24')]['find'](_0x59a22d)[_0x6c0f('0x1f')](handleEntityNotFound(_0x646ab6,null))['then'](respondWithResult(_0x646ab6,null))['catch'](handleError(_0x646ab6,null));};exports[_0x6c0f('0x41')]=function(_0x7c853d,_0x14f78b){return db[_0x6c0f('0x24')]['create'](_0x7c853d[_0x6c0f('0x42')],{})['then'](respondWithResult(_0x14f78b,0xc9))[_0x6c0f('0x3d')](handleError(_0x14f78b,null));};exports['update']=function(_0x4c5aca,_0x3fc071){if(_0x4c5aca['body']['id']){delete _0x4c5aca[_0x6c0f('0x42')]['id'];}return db[_0x6c0f('0x24')][_0x6c0f('0x43')]({'where':{'id':_0x4c5aca[_0x6c0f('0x3f')]['id']}})[_0x6c0f('0x1f')](handleEntityNotFound(_0x3fc071,null))[_0x6c0f('0x1f')](saveUpdates(_0x4c5aca['body'],null))[_0x6c0f('0x1f')](respondWithResult(_0x3fc071,null))['catch'](handleError(_0x3fc071,null));};exports[_0x6c0f('0x20')]=function(_0x549b8c,_0x340d85){return db[_0x6c0f('0x24')][_0x6c0f('0x43')]({'where':{'id':_0x549b8c[_0x6c0f('0x3f')]['id']}})[_0x6c0f('0x1f')](handleEntityNotFound(_0x340d85,null))[_0x6c0f('0x1f')](removeEntity(_0x340d85,null))['catch'](handleError(_0x340d85,null));}; \ No newline at end of file +var _0xeed1=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','Content-Range','json','update','then','stack','name','send','index','Integration','rawAttributes','keys','query','dateStart','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','pick','dateEnd','add','day','merge','filter','map','includeAll','include','findAll','show','params','filters','options','find','catch','create','body','destroy','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x46451c,_0x88ddd){var _0x12dce4=function(_0x2e4087){while(--_0x2e4087){_0x46451c['push'](_0x46451c['shift']());}};_0x12dce4(++_0x88ddd);}(_0xeed1,0x17a));var _0x1eed=function(_0x1dcf37,_0x150062){_0x1dcf37=_0x1dcf37-0x0;var _0x4323ea=_0xeed1[_0x1dcf37];return _0x4323ea;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x1eed('0x0'));var moment=require(_0x1eed('0x1'));var BPromise=require(_0x1eed('0x2'));var Mustache=require(_0x1eed('0x3'));var util=require('util');var path=require(_0x1eed('0x4'));var sox=require('sox');var csv=require(_0x1eed('0x5'));var ejs=require(_0x1eed('0x6'));var fs=require('fs');var _=require(_0x1eed('0x7'));var squel=require(_0x1eed('0x8'));var crypto=require(_0x1eed('0x9'));var jsforce=require(_0x1eed('0xa'));var deskjs=require(_0x1eed('0xb'));var toCsv=require(_0x1eed('0x5'));var querystring=require('querystring');var Papa=require(_0x1eed('0xc'));var qs=require(_0x1eed('0xd'));var logger=require(_0x1eed('0xe'))(_0x1eed('0xf'));var utils=require(_0x1eed('0x10'));var config=require(_0x1eed('0x11'));var db=require(_0x1eed('0x12'))['db'];function respondWithStatusCode(_0x41b19d,_0x335736){_0x335736=_0x335736||0xcc;return function(_0xfff7cb){if(_0xfff7cb){return _0x41b19d['sendStatus'](_0x335736);}return _0x41b19d[_0x1eed('0x13')](_0x335736)[_0x1eed('0x14')]();};}function respondWithResult(_0x365d1a,_0x500f16){_0x500f16=_0x500f16||0xc8;return function(_0x2f9a61){if(_0x2f9a61){return _0x365d1a[_0x1eed('0x13')](_0x500f16)['json'](_0x2f9a61);}};}function respondWithFilteredResult(_0x479bdc,_0x12828c){return function(_0x31380d){if(_0x31380d){var _0xd1361d=_0x31380d[_0x1eed('0x15')],_0x518099=_0x12828c[_0x1eed('0x16')],_0x1e38f1=_0x12828c[_0x1eed('0x16')]+_0x12828c['limit'],_0x405562;if(_0x1e38f1>=_0xd1361d){_0x1e38f1=_0xd1361d;_0x405562=0xc8;}else{_0x405562=0xce;}_0x479bdc[_0x1eed('0x13')](_0x405562);return _0x479bdc['set'](_0x1eed('0x17'),_0x518099+'-'+_0x1e38f1+'/'+_0xd1361d)[_0x1eed('0x18')](_0x31380d);}return null;};}function patchUpdates(_0x4f1713){return function(_0x35dd79){try{jsonpatch['apply'](_0x35dd79,_0x4f1713,!![]);}catch(_0x3a73de){return BPromise['reject'](_0x3a73de);}return _0x35dd79['save']();};}function saveUpdates(_0x1feb88,_0x3b0fc){return function(_0x2dd3a6){if(_0x2dd3a6){return _0x2dd3a6[_0x1eed('0x19')](_0x1feb88)[_0x1eed('0x1a')](function(_0x2c7ac5){return _0x2c7ac5;});}return null;};}function removeEntity(_0x24d848,_0x59f31c){return function(_0x52e971){if(_0x52e971){return _0x52e971['destroy']()[_0x1eed('0x1a')](function(){_0x24d848[_0x1eed('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b525d,_0x49c1ff){return function(_0x14def6){if(!_0x14def6){_0x2b525d['sendStatus'](0x194);}return _0x14def6;};}function handleError(_0x46d7ea,_0x317b1e){_0x317b1e=_0x317b1e||0x1f4;return function(_0x74839c){logger['error'](_0x74839c[_0x1eed('0x1b')]);if(_0x74839c[_0x1eed('0x1c')]){delete _0x74839c[_0x1eed('0x1c')];}_0x46d7ea[_0x1eed('0x13')](_0x317b1e)[_0x1eed('0x1d')](_0x74839c);};}exports[_0x1eed('0x1e')]=function(_0x27f1f2,_0x2c777f){var _0x1ed8a9={},_0x282cfd={},_0x46a72b={'count':0x0,'rows':[]};var _0x27e4b1=db[_0x1eed('0x1f')][_0x1eed('0x20')];_0x282cfd['model']=_[_0x1eed('0x21')](_0x27e4b1);var _0x58ff9e={'dateStart':_0x27f1f2[_0x1eed('0x22')]['dateStart'],'dateEnd':_0x27f1f2[_0x1eed('0x22')]['dateEnd']};delete _0x27f1f2[_0x1eed('0x22')][_0x1eed('0x23')];delete _0x27f1f2[_0x1eed('0x22')]['dateEnd'];_0x282cfd['query']=_[_0x1eed('0x21')](_0x27f1f2[_0x1eed('0x22')]);_0x282cfd['filters']=_[_0x1eed('0x24')](_0x282cfd[_0x1eed('0x25')],_0x282cfd['query']);_0x1ed8a9[_0x1eed('0x26')]=_[_0x1eed('0x24')](_0x282cfd[_0x1eed('0x25')],qs['fields'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x27')]));_0x1ed8a9[_0x1eed('0x26')]=_0x1ed8a9[_0x1eed('0x26')][_0x1eed('0x28')]?_0x1ed8a9[_0x1eed('0x26')]:_0x282cfd[_0x1eed('0x25')];if(!_0x27f1f2[_0x1eed('0x22')]['hasOwnProperty'](_0x1eed('0x29'))){_0x1ed8a9[_0x1eed('0x2a')]=qs[_0x1eed('0x2a')](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x2a')]);_0x1ed8a9[_0x1eed('0x16')]=qs['offset'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x16')]);}_0x1ed8a9[_0x1eed('0x2b')]=qs['sort'](_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x2c')]);_0x1ed8a9[_0x1eed('0x2d')]=qs['filters'](_[_0x1eed('0x2e')](_0x27f1f2[_0x1eed('0x22')],_0x282cfd['filters']));if(_0x58ff9e[_0x1eed('0x23')]){if(_0x58ff9e[_0x1eed('0x2f')]){_0x58ff9e[_0x1eed('0x2f')]=moment(_0x58ff9e[_0x1eed('0x2f')])[_0x1eed('0x30')](0x1,_0x1eed('0x31'));}else{_0x58ff9e[_0x1eed('0x2f')]=moment(_0x58ff9e[_0x1eed('0x23')])[_0x1eed('0x30')](0x1,'day');}_[_0x1eed('0x32')](_0x1ed8a9[_0x1eed('0x2d')],{'createdAt':{'$gte':_0x58ff9e['dateStart'],'$lte':_0x58ff9e[_0x1eed('0x2f')]}});}if(_0x27f1f2['query'][_0x1eed('0x33')]){_0x1ed8a9['where']=_[_0x1eed('0x32')](_0x1ed8a9['where'],{'$or':_[_0x1eed('0x34')](_0x1ed8a9[_0x1eed('0x26')],function(_0x32b8ea){var _0xf75c60={};_0xf75c60[_0x32b8ea]={'$like':'%'+_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x33')]+'%'};return _0xf75c60;})});}_0x1ed8a9=_['merge']({},_0x1ed8a9,_0x27f1f2['options']);var _0x2cc3b2={'where':_0x1ed8a9[_0x1eed('0x2d')]};return db[_0x1eed('0x1f')][_0x1eed('0x15')](_0x2cc3b2)[_0x1eed('0x1a')](function(_0x563907){_0x46a72b[_0x1eed('0x15')]=_0x563907;if(_0x27f1f2[_0x1eed('0x22')][_0x1eed('0x35')]){_0x1ed8a9[_0x1eed('0x36')]=[{'all':!![]}];}return db['Integration'][_0x1eed('0x37')](_0x1ed8a9);})[_0x1eed('0x1a')](function(_0x26f325){_0x46a72b['rows']=_0x26f325;return _0x46a72b;})[_0x1eed('0x1a')](respondWithFilteredResult(_0x2c777f,_0x1ed8a9))['catch'](handleError(_0x2c777f,null));};exports[_0x1eed('0x38')]=function(_0x41b1b7,_0x45dfeb){var _0x5e0705={'raw':![],'where':{'id':_0x41b1b7[_0x1eed('0x39')]['id']}},_0x33fe14={};_0x33fe14[_0x1eed('0x25')]=_[_0x1eed('0x21')](db[_0x1eed('0x1f')][_0x1eed('0x20')]);_0x33fe14['query']=_[_0x1eed('0x21')](_0x41b1b7['query']);_0x33fe14[_0x1eed('0x3a')]=_[_0x1eed('0x24')](_0x33fe14[_0x1eed('0x25')],_0x33fe14[_0x1eed('0x22')]);_0x5e0705[_0x1eed('0x26')]=_[_0x1eed('0x24')](_0x33fe14[_0x1eed('0x25')],qs['fields'](_0x41b1b7[_0x1eed('0x22')][_0x1eed('0x27')]));_0x5e0705[_0x1eed('0x26')]=_0x5e0705[_0x1eed('0x26')]['length']?_0x5e0705[_0x1eed('0x26')]:_0x33fe14[_0x1eed('0x25')];if(_0x41b1b7[_0x1eed('0x22')]['includeAll']){_0x5e0705['include']=[{'all':!![]}];}_0x5e0705=_[_0x1eed('0x32')]({},_0x5e0705,_0x41b1b7[_0x1eed('0x3b')]);return db['Integration'][_0x1eed('0x3c')](_0x5e0705)[_0x1eed('0x1a')](handleEntityNotFound(_0x45dfeb,null))[_0x1eed('0x1a')](respondWithResult(_0x45dfeb,null))[_0x1eed('0x3d')](handleError(_0x45dfeb,null));};exports[_0x1eed('0x3e')]=function(_0x3dc625,_0x5c6cae){return db[_0x1eed('0x1f')][_0x1eed('0x3e')](_0x3dc625['body'],{})[_0x1eed('0x1a')](respondWithResult(_0x5c6cae,0xc9))[_0x1eed('0x3d')](handleError(_0x5c6cae,null));};exports[_0x1eed('0x19')]=function(_0x62af10,_0x5c81d0){if(_0x62af10[_0x1eed('0x3f')]['id']){delete _0x62af10[_0x1eed('0x3f')]['id'];}return db[_0x1eed('0x1f')][_0x1eed('0x3c')]({'where':{'id':_0x62af10[_0x1eed('0x39')]['id']}})['then'](handleEntityNotFound(_0x5c81d0,null))[_0x1eed('0x1a')](saveUpdates(_0x62af10['body'],null))[_0x1eed('0x1a')](respondWithResult(_0x5c81d0,null))[_0x1eed('0x3d')](handleError(_0x5c81d0,null));};exports[_0x1eed('0x40')]=function(_0x5174e5,_0x34f690){return db[_0x1eed('0x1f')][_0x1eed('0x3c')]({'where':{'id':_0x5174e5['params']['id']}})[_0x1eed('0x1a')](handleEntityNotFound(_0x34f690,null))['then'](removeEntity(_0x34f690,null))[_0x1eed('0x3d')](handleError(_0x34f690,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 1cc2d8e..6b438ea 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 _0x4819=['api','moment','bluebird','request-promise','./integration.attributes','exports','Integration','util','../../config/logger'];(function(_0x5bd697,_0x13647d){var _0xeed818=function(_0x37553e){while(--_0x37553e){_0x5bd697['push'](_0x5bd697['shift']());}};_0xeed818(++_0x13647d);}(_0x4819,0xcd));var _0x9481=function(_0x287184,_0x1231a7){_0x287184=_0x287184-0x0;var _0x1b59f3=_0x4819[_0x287184];return _0x1b59f3;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var attributes=require(_0x9481('0x6'));module[_0x9481('0x7')]=function(_0xc39edf,_0x16c617){return _0xc39edf['define'](_0x9481('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['integrations','util','../../config/logger','api','moment','bluebird','request-promise','./integration.attributes','exports','Integration'];(function(_0x274cfc,_0xf7e8e1){var _0x3e2e5b=function(_0x3c1767){while(--_0x3c1767){_0x274cfc['push'](_0x274cfc['shift']());}};_0x3e2e5b(++_0xf7e8e1);}(_0x1967,0x173));var _0x7196=function(_0x326d7f,_0x1813ee){_0x326d7f=_0x326d7f-0x0;var _0x4be844=_0x1967[_0x326d7f];return _0x4be844;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var attributes=require(_0x7196('0x6'));module[_0x7196('0x7')]=function(_0x458ae8,_0x3ae43f){return _0x458ae8['define'](_0x7196('0x8'),attributes,{'tableName':_0x7196('0x9'),'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 6fc3c0f..06ecaab 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 _0x14a0=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','info','result','util','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x14a0,0x8e));var _0x014a=function(_0x3e4dd3,_0x16afec){_0x3e4dd3=_0x3e4dd3-0x0;var _0x5db220=_0x14a0[_0x3e4dd3];return _0x5db220;};'use strict';var _=require('lodash');var util=require(_0x014a('0x0'));var moment=require(_0x014a('0x1'));var BPromise=require(_0x014a('0x2'));var rs=require(_0x014a('0x3'));var fs=require('fs');var db=require(_0x014a('0x4'))['db'];var utils=require(_0x014a('0x5'));var logger=require(_0x014a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x014a('0x7'));var client=jayson[_0x014a('0x8')][_0x014a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ec84d,_0x5a61ac,_0x11b8ce){return new BPromise(function(_0x6d05f2,_0x22f17c){return client['request'](_0x5ec84d,_0x11b8ce)['then'](function(_0x2519e3){logger['info']('Integration,\x20%s,\x20%s',_0x5a61ac,'request\x20sent');logger['debug'](_0x014a('0xa'),_0x5a61ac,'request\x20sent',JSON[_0x014a('0xb')](_0x2519e3));if(_0x2519e3[_0x014a('0xc')]){if(_0x2519e3['error'][_0x014a('0xd')]===0x1f4){logger[_0x014a('0xc')](_0x014a('0xe'),_0x5a61ac,_0x2519e3[_0x014a('0xc')][_0x014a('0xf')]);return _0x22f17c(_0x2519e3[_0x014a('0xc')][_0x014a('0xf')]);}logger[_0x014a('0xc')](_0x014a('0xe'),_0x5a61ac,_0x2519e3[_0x014a('0xc')][_0x014a('0xf')]);return _0x6d05f2(_0x2519e3[_0x014a('0xc')]['message']);}else{logger[_0x014a('0x10')](_0x014a('0xe'),_0x5a61ac,'request\x20sent');_0x6d05f2(_0x2519e3[_0x014a('0x11')][_0x014a('0xf')]);}})['catch'](function(_0x16e6fc){logger[_0x014a('0xc')](_0x014a('0xe'),_0x5a61ac,_0x16e6fc);_0x22f17c(_0x16e6fc);});});} \ No newline at end of file +var _0xd824=['../../config/utils','../../config/logger','rpc','../../config/environment','http','then','Integration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var db=require(_0x4d82('0x3'))['db'];var utils=require(_0x4d82('0x4'));var logger=require(_0x4d82('0x5'))(_0x4d82('0x6'));var config=require(_0x4d82('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4d82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x583c7c,_0x4b842f,_0x464caf){return new BPromise(function(_0xb54db2,_0x13d624){return client['request'](_0x583c7c,_0x464caf)[_0x4d82('0x9')](function(_0x522801){logger['info'](_0x4d82('0xa'),_0x4b842f,_0x4d82('0xb'));logger[_0x4d82('0xc')]('Integration,\x20%s,\x20%s,\x20%s',_0x4b842f,_0x4d82('0xb'),JSON['stringify'](_0x522801));if(_0x522801[_0x4d82('0xd')]){if(_0x522801[_0x4d82('0xd')][_0x4d82('0xe')]===0x1f4){logger['error']('Integration,\x20%s,\x20%s',_0x4b842f,_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);return _0x13d624(_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);}logger['error'](_0x4d82('0xa'),_0x4b842f,_0x522801[_0x4d82('0xd')][_0x4d82('0xf')]);return _0xb54db2(_0x522801['error'][_0x4d82('0xf')]);}else{logger['info'](_0x4d82('0xa'),_0x4b842f,'request\x20sent');_0xb54db2(_0x522801[_0x4d82('0x10')]['message']);}})[_0x4d82('0x11')](function(_0xb1640d){logger[_0x4d82('0xd')](_0x4d82('0xa'),_0x4b842f,_0xb1640d);_0x13d624(_0xb1640d);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 80087d7..00a8f6e 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 _0xce8c=['isAuthenticated','/describe','/:id','post','create','put','update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get'];(function(_0x14a9dc,_0x4cd2eb){var _0x251b79=function(_0x56eade){while(--_0x56eade){_0x14a9dc['push'](_0x14a9dc['shift']());}};_0x251b79(++_0x4cd2eb);}(_0xce8c,0xe1));var _0xcce8=function(_0x19392c,_0x1a4f5a){_0x19392c=_0x19392c-0x0;var _0xbde4ef=_0xce8c[_0x19392c];return _0xbde4ef;};'use strict';var multer=require(_0xcce8('0x0'));var util=require(_0xcce8('0x1'));var path=require('path');var express=require(_0xcce8('0x2'));var router=express[_0xcce8('0x3')]();var auth=require(_0xcce8('0x4'));var interaction=require(_0xcce8('0x5'));var config=require(_0xcce8('0x6'));var controller=require(_0xcce8('0x7'));router[_0xcce8('0x8')]('/',auth[_0xcce8('0x9')](),controller['index']);router[_0xcce8('0x8')](_0xcce8('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xcce8('0x8')](_0xcce8('0xb'),auth[_0xcce8('0x9')](),controller['show']);router[_0xcce8('0xc')]('/',auth[_0xcce8('0x9')](),controller[_0xcce8('0xd')]);router[_0xcce8('0xe')](_0xcce8('0xb'),auth[_0xcce8('0x9')](),controller[_0xcce8('0xf')]);router['delete'](_0xcce8('0xb'),auth[_0xcce8('0x9')](),controller[_0xcce8('0x10')]);module[_0xcce8('0x11')]=router; \ No newline at end of file +var _0xd510=['./integrationReport.controller','get','index','/describe','isAuthenticated','describe','show','post','update','delete','/:id','destroy','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xd510,0x198));var _0x0d51=function(_0x2833fd,_0x28c021){_0x2833fd=_0x2833fd-0x0;var _0x3331a0=_0xd510[_0x2833fd];return _0x3331a0;};'use strict';var multer=require(_0x0d51('0x0'));var util=require('util');var path=require(_0x0d51('0x1'));var express=require('express');var router=express[_0x0d51('0x2')]();var auth=require(_0x0d51('0x3'));var interaction=require(_0x0d51('0x4'));var config=require(_0x0d51('0x5'));var controller=require(_0x0d51('0x6'));router[_0x0d51('0x7')]('/',auth['isAuthenticated'](),controller[_0x0d51('0x8')]);router[_0x0d51('0x7')](_0x0d51('0x9'),auth[_0x0d51('0xa')](),controller[_0x0d51('0xb')]);router['get']('/:id',auth[_0x0d51('0xa')](),controller[_0x0d51('0xc')]);router[_0x0d51('0xd')]('/',auth[_0x0d51('0xa')](),controller['create']);router['put']('/:id',auth[_0x0d51('0xa')](),controller[_0x0d51('0xe')]);router[_0x0d51('0xf')](_0x0d51('0x10'),auth[_0x0d51('0xa')](),controller[_0x0d51('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1c2ba7a..6116e0b 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 _0x2b97=['DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','sequelize','exports','STRING','INTEGER'];(function(_0x454519,_0x56c4b8){var _0x55f582=function(_0x203c62){while(--_0x203c62){_0x454519['push'](_0x454519['shift']());}};_0x55f582(++_0x56c4b8);}(_0x2b97,0x1be));var _0x72b9=function(_0x22afe4,_0x2cf045){_0x22afe4=_0x22afe4-0x0;var _0x31064d=_0x2b97[_0x22afe4];return _0x31064d;};'use strict';var Sequelize=require(_0x72b9('0x0'));module[_0x72b9('0x1')]={'integration':{'type':Sequelize[_0x72b9('0x2')]},'eventChannel':{'type':Sequelize[_0x72b9('0x2')]},'exitStatus':{'type':Sequelize[_0x72b9('0x2')]},'ticketId':{'type':Sequelize[_0x72b9('0x2')]},'integrationId':{'type':Sequelize[_0x72b9('0x3')]},'contacts':{'type':Sequelize[_0x72b9('0x2')]},'uniqueid':{'type':Sequelize[_0x72b9('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x72b9('0x4')]},'agentconnectAt':{'type':Sequelize[_0x72b9('0x4')]},'holdtime':{'type':Sequelize[_0x72b9('0x3')]},'agentcomplete':{'type':Sequelize[_0x72b9('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x72b9('0x4')]},'talktime':{'type':Sequelize[_0x72b9('0x3')]},'agentacw':{'type':Sequelize[_0x72b9('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x72b9('0x3')]},'reason':{'type':Sequelize[_0x72b9('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x72b9('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x72b9('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x72b9('0x2')]},'channelstate':{'type':Sequelize[_0x72b9('0x3')]},'channelstatedesc':{'type':Sequelize[_0x72b9('0x2')]},'connectedlinenum':{'type':Sequelize[_0x72b9('0x2')]},'connectedlinename':{'type':Sequelize[_0x72b9('0x2')]},'language':{'type':Sequelize[_0x72b9('0x2')]},'accountcode':{'type':Sequelize[_0x72b9('0x2')]},'context':{'type':Sequelize[_0x72b9('0x2')]},'exten':{'type':Sequelize[_0x72b9('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x72b9('0x2')]},'destchannelstate':{'type':Sequelize[_0x72b9('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x72b9('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x72b9('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x72b9('0x2')]},'destlanguage':{'type':Sequelize[_0x72b9('0x2')]},'destaccountcode':{'type':Sequelize[_0x72b9('0x2')]},'destcontext':{'type':Sequelize[_0x72b9('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x72b9('0x2')]},'messageId':{'type':Sequelize[_0x72b9('0x2')]},'inReplyTo':{'type':Sequelize[_0x72b9('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x72b9('0x2')]},'to':{'type':Sequelize[_0x72b9('0x2')]},'cc':{'type':Sequelize[_0x72b9('0x2')]},'attachment':{'type':Sequelize[_0x72b9('0x6')]},'html':{'type':Sequelize[_0x72b9('0x6')]},'text':{'type':Sequelize[_0x72b9('0x6')]},'status':{'type':Sequelize[_0x72b9('0x7')](_0x72b9('0x8'),'SENDING',_0x72b9('0x9'),'FAILED')},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x72b9('0x2')]},'appdata':{'type':Sequelize[_0x72b9('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc4f1=['SENDING','RECEIVED','FAILED','STRING','INTEGER','DATE','TEXT','ENUM','SENT'];(function(_0x2f2a91,_0x228a7c){var _0x251c01=function(_0x5ab8d6){while(--_0x5ab8d6){_0x2f2a91['push'](_0x2f2a91['shift']());}};_0x251c01(++_0x228a7c);}(_0xc4f1,0xb7));var _0x1c4f=function(_0x16c2b1,_0x36a70c){_0x16c2b1=_0x16c2b1-0x0;var _0x199ac4=_0xc4f1[_0x16c2b1];return _0x199ac4;};'use strict';var Sequelize=require('sequelize');module['exports']={'integration':{'type':Sequelize[_0x1c4f('0x0')]},'eventChannel':{'type':Sequelize[_0x1c4f('0x0')]},'exitStatus':{'type':Sequelize[_0x1c4f('0x0')]},'ticketId':{'type':Sequelize[_0x1c4f('0x0')]},'integrationId':{'type':Sequelize[_0x1c4f('0x1')]},'contacts':{'type':Sequelize[_0x1c4f('0x0')]},'uniqueid':{'type':Sequelize[_0x1c4f('0x0')]},'calleridnum':{'type':Sequelize[_0x1c4f('0x0')]},'calleridname':{'type':Sequelize[_0x1c4f('0x0')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x1c4f('0x0')]},'membername':{'type':Sequelize[_0x1c4f('0x0')]},'agentcalledAt':{'type':Sequelize[_0x1c4f('0x2')]},'agentconnectAt':{'type':Sequelize[_0x1c4f('0x2')]},'holdtime':{'type':Sequelize[_0x1c4f('0x1')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x1c4f('0x2')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1c4f('0x1')]},'reason':{'type':Sequelize[_0x1c4f('0x0')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x1c4f('0x0')]},'channel':{'type':Sequelize[_0x1c4f('0x0')]},'channelstate':{'type':Sequelize[_0x1c4f('0x1')]},'channelstatedesc':{'type':Sequelize[_0x1c4f('0x0')]},'connectedlinenum':{'type':Sequelize[_0x1c4f('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c4f('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1c4f('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x1c4f('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x1c4f('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x1c4f('0x0')]},'destcalleridnum':{'type':Sequelize[_0x1c4f('0x0')]},'destcalleridname':{'type':Sequelize[_0x1c4f('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x1c4f('0x0')]},'destconnectedlinename':{'type':Sequelize[_0x1c4f('0x0')]},'destlanguage':{'type':Sequelize[_0x1c4f('0x0')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x1c4f('0x0')]},'destexten':{'type':Sequelize[_0x1c4f('0x0')]},'destpriority':{'type':Sequelize[_0x1c4f('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x1c4f('0x0')]},'inReplyTo':{'type':Sequelize[_0x1c4f('0x0')]},'subject':{'type':Sequelize[_0x1c4f('0x0')]},'from':{'type':Sequelize[_0x1c4f('0x0')]},'to':{'type':Sequelize[_0x1c4f('0x0')]},'cc':{'type':Sequelize[_0x1c4f('0x0')]},'attachment':{'type':Sequelize[_0x1c4f('0x3')]},'html':{'type':Sequelize[_0x1c4f('0x3')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x1c4f('0x4')](_0x1c4f('0x5'),_0x1c4f('0x6'),_0x1c4f('0x7'),_0x1c4f('0x8'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x1c4f('0x0')]},'projectId':{'type':Sequelize[_0x1c4f('0x1')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index ae8e252..7a3b77f 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 _0xe71a=['merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','reject','save','then','sendStatus','stack','name','index','IntegrationReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','day','add'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0xe71a,0xde));var _0xae71=function(_0xead88d,_0x7fbc25){_0xead88d=_0xead88d-0x0;var _0x32d3a8=_0xe71a[_0xead88d];return _0x32d3a8;};'use strict';var jsonpatch=require(_0xae71('0x0'));var rp=require(_0xae71('0x1'));var moment=require(_0xae71('0x2'));var BPromise=require(_0xae71('0x3'));var Mustache=require(_0xae71('0x4'));var util=require(_0xae71('0x5'));var path=require(_0xae71('0x6'));var sox=require(_0xae71('0x7'));var csv=require(_0xae71('0x8'));var ejs=require(_0xae71('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0xae71('0xa'));var crypto=require(_0xae71('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xae71('0xc'));var toCsv=require(_0xae71('0x8'));var querystring=require('querystring');var Papa=require(_0xae71('0xd'));var qs=require(_0xae71('0xe'));var logger=require(_0xae71('0xf'))(_0xae71('0x10'));var utils=require(_0xae71('0x11'));var config=require('../../config/environment');var db=require(_0xae71('0x12'))['db'];function respondWithStatusCode(_0x43a0b6,_0x342048){_0x342048=_0x342048||0xcc;return function(_0x541583){if(_0x541583){return _0x43a0b6['sendStatus'](_0x342048);}return _0x43a0b6['status'](_0x342048)[_0xae71('0x13')]();};}function respondWithResult(_0x4cbbdd,_0x3bfa4a){_0x3bfa4a=_0x3bfa4a||0xc8;return function(_0x48edb4){if(_0x48edb4){return _0x4cbbdd['status'](_0x3bfa4a)[_0xae71('0x14')](_0x48edb4);}};}function respondWithFilteredResult(_0x582f30,_0x5cd28a){return function(_0x16b714){if(_0x16b714){var _0x1faf9b=_0x16b714[_0xae71('0x15')],_0x7473ce=_0x5cd28a['offset'],_0x32bfaa=_0x5cd28a[_0xae71('0x16')]+_0x5cd28a[_0xae71('0x17')],_0xb3115f;if(_0x32bfaa>=_0x1faf9b){_0x32bfaa=_0x1faf9b;_0xb3115f=0xc8;}else{_0xb3115f=0xce;}_0x582f30[_0xae71('0x18')](_0xb3115f);return _0x582f30[_0xae71('0x19')](_0xae71('0x1a'),_0x7473ce+'-'+_0x32bfaa+'/'+_0x1faf9b)['json'](_0x16b714);}return null;};}function patchUpdates(_0x1e1607){return function(_0xda8b8f){try{jsonpatch[_0xae71('0x1b')](_0xda8b8f,_0x1e1607,!![]);}catch(_0x4686ee){return BPromise[_0xae71('0x1c')](_0x4686ee);}return _0xda8b8f[_0xae71('0x1d')]();};}function saveUpdates(_0x5eba44,_0x37842d){return function(_0x1f4834){if(_0x1f4834){return _0x1f4834['update'](_0x5eba44)[_0xae71('0x1e')](function(_0x367b8c){return _0x367b8c;});}return null;};}function removeEntity(_0x1f161b,_0x4f790b){return function(_0x52e4cd){if(_0x52e4cd){return _0x52e4cd['destroy']()[_0xae71('0x1e')](function(){_0x1f161b[_0xae71('0x18')](0xcc)[_0xae71('0x13')]();});}};}function handleEntityNotFound(_0x451126,_0xb1a941){return function(_0x2a6698){if(!_0x2a6698){_0x451126[_0xae71('0x1f')](0x194);}return _0x2a6698;};}function handleError(_0x5a47f0,_0x7d97bd){_0x7d97bd=_0x7d97bd||0x1f4;return function(_0x4fc5f3){logger['error'](_0x4fc5f3[_0xae71('0x20')]);if(_0x4fc5f3[_0xae71('0x21')]){delete _0x4fc5f3[_0xae71('0x21')];}_0x5a47f0[_0xae71('0x18')](_0x7d97bd)['send'](_0x4fc5f3);};}exports[_0xae71('0x22')]=function(_0x57335e,_0xce00d7){var _0x47cac7={},_0x247df8={},_0x5310bb={'count':0x0,'rows':[]};var _0x6707a4=db[_0xae71('0x23')][_0xae71('0x24')];_0x247df8[_0xae71('0x25')]=_[_0xae71('0x26')](_0x6707a4);var _0x3bc977={'dateStart':_0x57335e[_0xae71('0x27')][_0xae71('0x28')],'dateEnd':_0x57335e[_0xae71('0x27')][_0xae71('0x29')]};delete _0x57335e[_0xae71('0x27')][_0xae71('0x28')];delete _0x57335e['query']['dateEnd'];_0x247df8[_0xae71('0x27')]=_[_0xae71('0x26')](_0x57335e[_0xae71('0x27')]);_0x247df8[_0xae71('0x2a')]=_[_0xae71('0x2b')](_0x247df8[_0xae71('0x25')],_0x247df8[_0xae71('0x27')]);_0x47cac7['attributes']=_[_0xae71('0x2b')](_0x247df8[_0xae71('0x25')],qs[_0xae71('0x2c')](_0x57335e[_0xae71('0x27')]['fields']));_0x47cac7['attributes']=_0x47cac7[_0xae71('0x2d')][_0xae71('0x2e')]?_0x47cac7[_0xae71('0x2d')]:_0x247df8[_0xae71('0x25')];if(!_0x57335e[_0xae71('0x27')][_0xae71('0x2f')](_0xae71('0x30'))){_0x47cac7[_0xae71('0x17')]=qs['limit'](_0x57335e['query'][_0xae71('0x17')]);_0x47cac7['offset']=qs[_0xae71('0x16')](_0x57335e[_0xae71('0x27')][_0xae71('0x16')]);}_0x47cac7['order']=qs[_0xae71('0x31')](_0x57335e[_0xae71('0x27')][_0xae71('0x31')]);_0x47cac7[_0xae71('0x32')]=qs['filters'](_[_0xae71('0x33')](_0x57335e[_0xae71('0x27')],_0x247df8[_0xae71('0x2a')]));if(_0x3bc977[_0xae71('0x28')]){if(_0x3bc977[_0xae71('0x29')]){_0x3bc977['dateEnd']=moment(_0x3bc977[_0xae71('0x29')])['add'](0x1,_0xae71('0x34'));}else{_0x3bc977['dateEnd']=moment(_0x3bc977['dateStart'])[_0xae71('0x35')](0x1,_0xae71('0x34'));}_[_0xae71('0x36')](_0x47cac7[_0xae71('0x32')],{'createdAt':{'$gte':_0x3bc977[_0xae71('0x28')],'$lte':_0x3bc977[_0xae71('0x29')]}});}if(_0x57335e[_0xae71('0x27')][_0xae71('0x37')]){_0x47cac7[_0xae71('0x32')]=_[_0xae71('0x36')](_0x47cac7[_0xae71('0x32')],{'$or':_[_0xae71('0x38')](_0x47cac7['attributes'],function(_0xe5a0ee){var _0x46f3f1={};_0x46f3f1[_0xe5a0ee]={'$like':'%'+_0x57335e[_0xae71('0x27')][_0xae71('0x37')]+'%'};return _0x46f3f1;})});}_0x47cac7=_[_0xae71('0x36')]({},_0x47cac7,_0x57335e[_0xae71('0x39')]);var _0x3b0b0e={'where':_0x47cac7[_0xae71('0x32')]};return db[_0xae71('0x23')][_0xae71('0x15')](_0x3b0b0e)[_0xae71('0x1e')](function(_0x530790){_0x5310bb[_0xae71('0x15')]=_0x530790;if(_0x57335e['query'][_0xae71('0x3a')]){_0x47cac7[_0xae71('0x3b')]=[{'all':!![]}];}return db[_0xae71('0x23')][_0xae71('0x3c')](_0x47cac7);})[_0xae71('0x1e')](function(_0x232def){_0x5310bb['rows']=_0x232def;return _0x5310bb;})[_0xae71('0x1e')](respondWithFilteredResult(_0xce00d7,_0x47cac7))[_0xae71('0x3d')](handleError(_0xce00d7,null));};exports[_0xae71('0x3e')]=function(_0x9262de,_0x2bf89c){var _0x4f8861={'raw':![],'where':{'id':_0x9262de[_0xae71('0x3f')]['id']}},_0x4e9e25={};_0x4e9e25['model']=_[_0xae71('0x26')](db[_0xae71('0x23')][_0xae71('0x24')]);_0x4e9e25['query']=_[_0xae71('0x26')](_0x9262de['query']);_0x4e9e25[_0xae71('0x2a')]=_[_0xae71('0x2b')](_0x4e9e25[_0xae71('0x25')],_0x4e9e25[_0xae71('0x27')]);_0x4f8861[_0xae71('0x2d')]=_['intersection'](_0x4e9e25['model'],qs['fields'](_0x9262de[_0xae71('0x27')]['fields']));_0x4f8861[_0xae71('0x2d')]=_0x4f8861['attributes'][_0xae71('0x2e')]?_0x4f8861['attributes']:_0x4e9e25[_0xae71('0x25')];if(_0x9262de['query'][_0xae71('0x3a')]){_0x4f8861['include']=[{'all':!![]}];}_0x4f8861=_[_0xae71('0x36')]({},_0x4f8861,_0x9262de['options']);return db[_0xae71('0x23')][_0xae71('0x40')](_0x4f8861)[_0xae71('0x1e')](handleEntityNotFound(_0x2bf89c,null))['then'](respondWithResult(_0x2bf89c,null))['catch'](handleError(_0x2bf89c,null));};exports[_0xae71('0x41')]=function(_0xafe60e,_0xee8d08){return db[_0xae71('0x23')][_0xae71('0x41')](_0xafe60e['body'],{})['then'](respondWithResult(_0xee8d08,0xc9))['catch'](handleError(_0xee8d08,null));};exports['update']=function(_0xd586ce,_0x5e6e09){if(_0xd586ce[_0xae71('0x42')]['id']){delete _0xd586ce[_0xae71('0x42')]['id'];}return db[_0xae71('0x23')][_0xae71('0x40')]({'where':{'id':_0xd586ce[_0xae71('0x3f')]['id']}})[_0xae71('0x1e')](handleEntityNotFound(_0x5e6e09,null))['then'](saveUpdates(_0xd586ce['body'],null))[_0xae71('0x1e')](respondWithResult(_0x5e6e09,null))[_0xae71('0x3d')](handleError(_0x5e6e09,null));};exports[_0xae71('0x43')]=function(_0x50613a,_0x60a0f3){return db[_0xae71('0x23')][_0xae71('0x40')]({'where':{'id':_0x50613a[_0xae71('0x3f')]['id']}})['then'](handleEntityNotFound(_0x60a0f3,null))['then'](removeEntity(_0x60a0f3,null))[_0xae71('0x3d')](handleError(_0x60a0f3,null));};exports[_0xae71('0x44')]=function(_0x34b501,_0x2ad9ea){return db[_0xae71('0x23')]['describe']()[_0xae71('0x1e')](respondWithResult(_0x2ad9ea,null))[_0xae71('0x3d')](handleError(_0x2ad9ea,null));}; \ No newline at end of file +var _0x4fa0=['status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','IntegrationReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','includeAll','include','findAll','rows','catch','length','options','create','body','params','find','describe','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fa0,0xbd));var _0x04fa=function(_0x2d1da8,_0x5606b9){_0x2d1da8=_0x2d1da8-0x0;var _0x53ae73=_0x4fa0[_0x2d1da8];return _0x53ae73;};'use strict';var jsonpatch=require(_0x04fa('0x0'));var rp=require(_0x04fa('0x1'));var moment=require(_0x04fa('0x2'));var BPromise=require(_0x04fa('0x3'));var Mustache=require('mustache');var util=require(_0x04fa('0x4'));var path=require(_0x04fa('0x5'));var sox=require('sox');var csv=require(_0x04fa('0x6'));var ejs=require(_0x04fa('0x7'));var fs=require('fs');var _=require(_0x04fa('0x8'));var squel=require(_0x04fa('0x9'));var crypto=require(_0x04fa('0xa'));var jsforce=require(_0x04fa('0xb'));var deskjs=require(_0x04fa('0xc'));var toCsv=require(_0x04fa('0x6'));var querystring=require(_0x04fa('0xd'));var Papa=require('papaparse');var qs=require(_0x04fa('0xe'));var logger=require(_0x04fa('0xf'))(_0x04fa('0x10'));var utils=require(_0x04fa('0x11'));var config=require(_0x04fa('0x12'));var db=require(_0x04fa('0x13'))['db'];function respondWithStatusCode(_0x1f5ff2,_0x508050){_0x508050=_0x508050||0xcc;return function(_0x32ea12){if(_0x32ea12){return _0x1f5ff2['sendStatus'](_0x508050);}return _0x1f5ff2['status'](_0x508050)[_0x04fa('0x14')]();};}function respondWithResult(_0x4798f0,_0x6d02e8){_0x6d02e8=_0x6d02e8||0xc8;return function(_0x625036){if(_0x625036){return _0x4798f0[_0x04fa('0x15')](_0x6d02e8)[_0x04fa('0x16')](_0x625036);}};}function respondWithFilteredResult(_0x40d04e,_0x13c9f8){return function(_0x451fc7){if(_0x451fc7){var _0x4ee469=_0x451fc7[_0x04fa('0x17')],_0x38ae28=_0x13c9f8[_0x04fa('0x18')],_0x72d299=_0x13c9f8[_0x04fa('0x18')]+_0x13c9f8[_0x04fa('0x19')],_0x48b3da;if(_0x72d299>=_0x4ee469){_0x72d299=_0x4ee469;_0x48b3da=0xc8;}else{_0x48b3da=0xce;}_0x40d04e[_0x04fa('0x15')](_0x48b3da);return _0x40d04e['set'](_0x04fa('0x1a'),_0x38ae28+'-'+_0x72d299+'/'+_0x4ee469)[_0x04fa('0x16')](_0x451fc7);}return null;};}function patchUpdates(_0x12fc75){return function(_0x5b0e9b){try{jsonpatch[_0x04fa('0x1b')](_0x5b0e9b,_0x12fc75,!![]);}catch(_0x37704a){return BPromise['reject'](_0x37704a);}return _0x5b0e9b[_0x04fa('0x1c')]();};}function saveUpdates(_0x2762de,_0x45da78){return function(_0x50dca8){if(_0x50dca8){return _0x50dca8[_0x04fa('0x1d')](_0x2762de)[_0x04fa('0x1e')](function(_0x324e22){return _0x324e22;});}return null;};}function removeEntity(_0x3e7dd9,_0x54eff7){return function(_0x541f89){if(_0x541f89){return _0x541f89[_0x04fa('0x1f')]()[_0x04fa('0x1e')](function(){_0x3e7dd9[_0x04fa('0x15')](0xcc)[_0x04fa('0x14')]();});}};}function handleEntityNotFound(_0x46cfb0,_0x57c7e0){return function(_0x2a17d6){if(!_0x2a17d6){_0x46cfb0[_0x04fa('0x20')](0x194);}return _0x2a17d6;};}function handleError(_0x37fb6c,_0x319990){_0x319990=_0x319990||0x1f4;return function(_0x32e4b6){logger[_0x04fa('0x21')](_0x32e4b6[_0x04fa('0x22')]);if(_0x32e4b6['name']){delete _0x32e4b6[_0x04fa('0x23')];}_0x37fb6c[_0x04fa('0x15')](_0x319990)[_0x04fa('0x24')](_0x32e4b6);};}exports[_0x04fa('0x25')]=function(_0x20ae5e,_0x47d3d7){var _0x3e5d8d={},_0x1cd7f8={},_0x339f3b={'count':0x0,'rows':[]};var _0xdb6d9d=db[_0x04fa('0x26')][_0x04fa('0x27')];_0x1cd7f8[_0x04fa('0x28')]=_[_0x04fa('0x29')](_0xdb6d9d);var _0x599061={'dateStart':_0x20ae5e['query'][_0x04fa('0x2a')],'dateEnd':_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x2c')]};delete _0x20ae5e['query'][_0x04fa('0x2a')];delete _0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x2c')];_0x1cd7f8[_0x04fa('0x2b')]=_[_0x04fa('0x29')](_0x20ae5e[_0x04fa('0x2b')]);_0x1cd7f8[_0x04fa('0x2d')]=_[_0x04fa('0x2e')](_0x1cd7f8['model'],_0x1cd7f8[_0x04fa('0x2b')]);_0x3e5d8d['attributes']=_[_0x04fa('0x2e')](_0x1cd7f8[_0x04fa('0x28')],qs['fields'](_0x20ae5e['query'][_0x04fa('0x2f')]));_0x3e5d8d['attributes']=_0x3e5d8d[_0x04fa('0x30')]['length']?_0x3e5d8d['attributes']:_0x1cd7f8[_0x04fa('0x28')];if(!_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x31')](_0x04fa('0x32'))){_0x3e5d8d[_0x04fa('0x19')]=qs[_0x04fa('0x19')](_0x20ae5e['query'][_0x04fa('0x19')]);_0x3e5d8d[_0x04fa('0x18')]=qs['offset'](_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x18')]);}_0x3e5d8d[_0x04fa('0x33')]=qs['sort'](_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x34')]);_0x3e5d8d['where']=qs[_0x04fa('0x2d')](_[_0x04fa('0x35')](_0x20ae5e[_0x04fa('0x2b')],_0x1cd7f8[_0x04fa('0x2d')]));if(_0x599061[_0x04fa('0x2a')]){if(_0x599061[_0x04fa('0x2c')]){_0x599061[_0x04fa('0x2c')]=moment(_0x599061[_0x04fa('0x2c')])[_0x04fa('0x36')](0x1,'day');}else{_0x599061[_0x04fa('0x2c')]=moment(_0x599061[_0x04fa('0x2a')])['add'](0x1,_0x04fa('0x37'));}_[_0x04fa('0x38')](_0x3e5d8d[_0x04fa('0x39')],{'createdAt':{'$gte':_0x599061[_0x04fa('0x2a')],'$lte':_0x599061[_0x04fa('0x2c')]}});}if(_0x20ae5e[_0x04fa('0x2b')]['filter']){_0x3e5d8d[_0x04fa('0x39')]=_[_0x04fa('0x38')](_0x3e5d8d[_0x04fa('0x39')],{'$or':_['map'](_0x3e5d8d['attributes'],function(_0x3d2230){var _0x5e0802={};_0x5e0802[_0x3d2230]={'$like':'%'+_0x20ae5e['query']['filter']+'%'};return _0x5e0802;})});}_0x3e5d8d=_[_0x04fa('0x38')]({},_0x3e5d8d,_0x20ae5e['options']);var _0x27ccf8={'where':_0x3e5d8d[_0x04fa('0x39')]};return db[_0x04fa('0x26')][_0x04fa('0x17')](_0x27ccf8)['then'](function(_0x4c9d3e){_0x339f3b[_0x04fa('0x17')]=_0x4c9d3e;if(_0x20ae5e[_0x04fa('0x2b')][_0x04fa('0x3a')]){_0x3e5d8d[_0x04fa('0x3b')]=[{'all':!![]}];}return db[_0x04fa('0x26')][_0x04fa('0x3c')](_0x3e5d8d);})['then'](function(_0x4acd2b){_0x339f3b[_0x04fa('0x3d')]=_0x4acd2b;return _0x339f3b;})[_0x04fa('0x1e')](respondWithFilteredResult(_0x47d3d7,_0x3e5d8d))[_0x04fa('0x3e')](handleError(_0x47d3d7,null));};exports['show']=function(_0x8d12fb,_0x45559b){var _0x5a5772={'raw':![],'where':{'id':_0x8d12fb['params']['id']}},_0x589b0c={};_0x589b0c[_0x04fa('0x28')]=_[_0x04fa('0x29')](db['IntegrationReport']['rawAttributes']);_0x589b0c[_0x04fa('0x2b')]=_[_0x04fa('0x29')](_0x8d12fb['query']);_0x589b0c[_0x04fa('0x2d')]=_['intersection'](_0x589b0c[_0x04fa('0x28')],_0x589b0c['query']);_0x5a5772['attributes']=_[_0x04fa('0x2e')](_0x589b0c[_0x04fa('0x28')],qs[_0x04fa('0x2f')](_0x8d12fb[_0x04fa('0x2b')]['fields']));_0x5a5772[_0x04fa('0x30')]=_0x5a5772[_0x04fa('0x30')][_0x04fa('0x3f')]?_0x5a5772[_0x04fa('0x30')]:_0x589b0c[_0x04fa('0x28')];if(_0x8d12fb['query']['includeAll']){_0x5a5772[_0x04fa('0x3b')]=[{'all':!![]}];}_0x5a5772=_['merge']({},_0x5a5772,_0x8d12fb[_0x04fa('0x40')]);return db[_0x04fa('0x26')]['find'](_0x5a5772)[_0x04fa('0x1e')](handleEntityNotFound(_0x45559b,null))[_0x04fa('0x1e')](respondWithResult(_0x45559b,null))[_0x04fa('0x3e')](handleError(_0x45559b,null));};exports[_0x04fa('0x41')]=function(_0x2ed44e,_0x598ba7){return db[_0x04fa('0x26')]['create'](_0x2ed44e[_0x04fa('0x42')],{})[_0x04fa('0x1e')](respondWithResult(_0x598ba7,0xc9))[_0x04fa('0x3e')](handleError(_0x598ba7,null));};exports[_0x04fa('0x1d')]=function(_0x42395b,_0x3c534e){if(_0x42395b[_0x04fa('0x42')]['id']){delete _0x42395b[_0x04fa('0x42')]['id'];}return db[_0x04fa('0x26')]['find']({'where':{'id':_0x42395b[_0x04fa('0x43')]['id']}})[_0x04fa('0x1e')](handleEntityNotFound(_0x3c534e,null))[_0x04fa('0x1e')](saveUpdates(_0x42395b[_0x04fa('0x42')],null))[_0x04fa('0x1e')](respondWithResult(_0x3c534e,null))[_0x04fa('0x3e')](handleError(_0x3c534e,null));};exports[_0x04fa('0x1f')]=function(_0x22f62c,_0x4904fd){return db[_0x04fa('0x26')][_0x04fa('0x44')]({'where':{'id':_0x22f62c[_0x04fa('0x43')]['id']}})[_0x04fa('0x1e')](handleEntityNotFound(_0x4904fd,null))[_0x04fa('0x1e')](removeEntity(_0x4904fd,null))[_0x04fa('0x3e')](handleError(_0x4904fd,null));};exports[_0x04fa('0x45')]=function(_0x240340,_0x5a52ee){return db[_0x04fa('0x26')][_0x04fa('0x45')]()['then'](respondWithResult(_0x5a52ee,null))['catch'](handleError(_0x5a52ee,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d39c0a6..f7062b3 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 _0xfcf0=['IntegrationReport','report_integration','lodash','util','api','moment','bluebird','request-promise','exports','define'];(function(_0x88820c,_0x171fae){var _0x14ba07=function(_0x5cdaff){while(--_0x5cdaff){_0x88820c['push'](_0x88820c['shift']());}};_0x14ba07(++_0x171fae);}(_0xfcf0,0x138));var _0x0fcf=function(_0x53d172,_0x46611b){_0x53d172=_0x53d172-0x0;var _0x1bd0a2=_0xfcf0[_0x53d172];return _0x1bd0a2;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var logger=require('../../config/logger')(_0x0fcf('0x2'));var moment=require(_0x0fcf('0x3'));var BPromise=require(_0x0fcf('0x4'));var rp=require(_0x0fcf('0x5'));var attributes=require('./integrationReport.attributes');module[_0x0fcf('0x6')]=function(_0x265968,_0x3bd34d){return _0x265968[_0x0fcf('0x7')](_0x0fcf('0x8'),attributes,{'tableName':_0x0fcf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6050=['report_integration','lodash','util','../../config/logger','api','moment','bluebird','./integrationReport.attributes','exports'];(function(_0x2eb5bc,_0x4634c6){var _0x51c7b1=function(_0x1af430){while(--_0x1af430){_0x2eb5bc['push'](_0x2eb5bc['shift']());}};_0x51c7b1(++_0x4634c6);}(_0x6050,0x196));var _0x0605=function(_0x2dba76,_0x116116){_0x2dba76=_0x2dba76-0x0;var _0x3a5419=_0x6050[_0x2dba76];return _0x3a5419;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var logger=require(_0x0605('0x2'))(_0x0605('0x3'));var moment=require(_0x0605('0x4'));var BPromise=require(_0x0605('0x5'));var rp=require('request-promise');var attributes=require(_0x0605('0x6'));module[_0x0605('0x7')]=function(_0x43403d,_0x5797b0){return _0x43403d['define']('IntegrationReport',attributes,{'tableName':_0x0605('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 88ae9ed..54e9338 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 _0x4340=['debug','stringify','code','error','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent'];(function(_0x432d74,_0x51d55b){var _0x3b2daa=function(_0x4debd2){while(--_0x4debd2){_0x432d74['push'](_0x432d74['shift']());}};_0x3b2daa(++_0x51d55b);}(_0x4340,0xe3));var _0x0434=function(_0x217fd7,_0x247049){_0x217fd7=_0x217fd7-0x0;var _0x101b7c=_0x4340[_0x217fd7];return _0x101b7c;};'use strict';var _=require(_0x0434('0x0'));var util=require('util');var moment=require(_0x0434('0x1'));var BPromise=require(_0x0434('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x0434('0x3'))['db'];var utils=require(_0x0434('0x4'));var logger=require('../../config/logger')(_0x0434('0x5'));var config=require(_0x0434('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0434('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19e12d,_0x2ce086,_0xb43f4f){return new BPromise(function(_0x4674cd,_0x50951a){return client[_0x0434('0x8')](_0x19e12d,_0xb43f4f)[_0x0434('0x9')](function(_0x4dc980){logger[_0x0434('0xa')](_0x0434('0xb'),_0x2ce086,_0x0434('0xc'));logger[_0x0434('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2ce086,_0x0434('0xc'),JSON[_0x0434('0xe')](_0x4dc980));if(_0x4dc980['error']){if(_0x4dc980['error'][_0x0434('0xf')]===0x1f4){logger[_0x0434('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x2ce086,_0x4dc980[_0x0434('0x10')][_0x0434('0x11')]);return _0x50951a(_0x4dc980['error']['message']);}logger[_0x0434('0x10')](_0x0434('0xb'),_0x2ce086,_0x4dc980[_0x0434('0x10')]['message']);return _0x4674cd(_0x4dc980[_0x0434('0x10')][_0x0434('0x11')]);}else{logger[_0x0434('0xa')](_0x0434('0xb'),_0x2ce086,_0x0434('0xc'));_0x4674cd(_0x4dc980[_0x0434('0x12')][_0x0434('0x11')]);}})[_0x0434('0x13')](function(_0x17f1a6){logger[_0x0434('0x10')](_0x0434('0xb'),_0x2ce086,_0x17f1a6);_0x50951a(_0x17f1a6);});});} \ No newline at end of file +var _0x0dac=['bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dac,0x151));var _0xc0da=function(_0x3f13d8,_0x4bb7b4){_0x3f13d8=_0x3f13d8-0x0;var _0x343c39=_0x0dac[_0x3f13d8];return _0x343c39;};'use strict';var _=require(_0xc0da('0x0'));var util=require(_0xc0da('0x1'));var moment=require(_0xc0da('0x2'));var BPromise=require(_0xc0da('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc0da('0x4'));var logger=require(_0xc0da('0x5'))(_0xc0da('0x6'));var config=require(_0xc0da('0x7'));var jayson=require(_0xc0da('0x8'));var client=jayson[_0xc0da('0x9')][_0xc0da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xebf088,_0x4b1845,_0x3cb192){return new BPromise(function(_0x1ee5e9,_0x281b19){return client[_0xc0da('0xb')](_0xebf088,_0x3cb192)[_0xc0da('0xc')](function(_0x110a6c){logger['info'](_0xc0da('0xd'),_0x4b1845,_0xc0da('0xe'));logger['debug'](_0xc0da('0xf'),_0x4b1845,_0xc0da('0xe'),JSON['stringify'](_0x110a6c));if(_0x110a6c[_0xc0da('0x10')]){if(_0x110a6c[_0xc0da('0x10')][_0xc0da('0x11')]===0x1f4){logger[_0xc0da('0x10')](_0xc0da('0xd'),_0x4b1845,_0x110a6c[_0xc0da('0x10')][_0xc0da('0x12')]);return _0x281b19(_0x110a6c[_0xc0da('0x10')]['message']);}logger[_0xc0da('0x10')]('IntegrationReport,\x20%s,\x20%s',_0x4b1845,_0x110a6c['error'][_0xc0da('0x12')]);return _0x1ee5e9(_0x110a6c['error'][_0xc0da('0x12')]);}else{logger['info'](_0xc0da('0xd'),_0x4b1845,'request\x20sent');_0x1ee5e9(_0x110a6c[_0xc0da('0x13')][_0xc0da('0x12')]);}})['catch'](function(_0x52752b){logger['error'](_0xc0da('0xd'),_0x4b1845,_0x52752b);_0x281b19(_0x52752b);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 06471cc..839a996 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 _0xb862=['Router','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','update','exports','util','path','express'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb862,0x19b));var _0x2b86=function(_0x32037d,_0x3a8ef6){_0x32037d=_0x32037d-0x0;var _0x181660=_0xb862[_0x32037d];return _0x181660;};'use strict';var multer=require('multer');var util=require(_0x2b86('0x0'));var path=require(_0x2b86('0x1'));var express=require(_0x2b86('0x2'));var router=express[_0x2b86('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b86('0x4'));router[_0x2b86('0x5')]('/',auth[_0x2b86('0x6')](),controller[_0x2b86('0x7')]);router[_0x2b86('0x5')](_0x2b86('0x8'),auth[_0x2b86('0x6')](),controller[_0x2b86('0x9')]);router[_0x2b86('0x5')](_0x2b86('0xa'),auth[_0x2b86('0x6')](),controller['getIntervals']);router[_0x2b86('0xb')]('/',auth[_0x2b86('0x6')](),controller[_0x2b86('0xc')]);router['post'](_0x2b86('0xa'),auth[_0x2b86('0x6')](),controller[_0x2b86('0xd')]);router[_0x2b86('0xb')](_0x2b86('0xe'),auth['isAuthenticated'](),controller[_0x2b86('0xf')]);router['put'](_0x2b86('0x8'),auth[_0x2b86('0x6')](),controller[_0x2b86('0x10')]);router['delete'](_0x2b86('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b86('0x11')]=router; \ No newline at end of file +var _0xdf32=['create','post','/:id/sub_intervals','/:id/sub_intervals/create_many','destroy','util','path','express','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals'];(function(_0x292cfd,_0x2fab3b){var _0x8fb994=function(_0x31013c){while(--_0x31013c){_0x292cfd['push'](_0x292cfd['shift']());}};_0x8fb994(++_0x2fab3b);}(_0xdf32,0x105));var _0x2df3=function(_0x171fd3,_0x448be0){_0x171fd3=_0x171fd3-0x0;var _0x487d2d=_0xdf32[_0x171fd3];return _0x487d2d;};'use strict';var multer=require('multer');var util=require(_0x2df3('0x0'));var path=require(_0x2df3('0x1'));var express=require(_0x2df3('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x2df3('0x3'));var config=require(_0x2df3('0x4'));var controller=require('./interval.controller');router[_0x2df3('0x5')]('/',auth[_0x2df3('0x6')](),controller[_0x2df3('0x7')]);router[_0x2df3('0x5')](_0x2df3('0x8'),auth['isAuthenticated'](),controller[_0x2df3('0x9')]);router['get']('/:id/sub_intervals',auth[_0x2df3('0x6')](),controller[_0x2df3('0xa')]);router['post']('/',auth[_0x2df3('0x6')](),controller[_0x2df3('0xb')]);router[_0x2df3('0xc')](_0x2df3('0xd'),auth['isAuthenticated'](),controller['addInterval']);router['post'](_0x2df3('0xe'),auth[_0x2df3('0x6')](),controller['addIntervals']);router['put'](_0x2df3('0x8'),auth[_0x2df3('0x6')](),controller['update']);router['delete'](_0x2df3('0x8'),auth[_0x2df3('0x6')](),controller[_0x2df3('0xf')]);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 fafd781..b59d668 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 _0x1735=['STRING','sequelize','exports'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x1735,0x85));var _0x5173=function(_0xa228e9,_0x4eede0){_0xa228e9=_0xa228e9-0x0;var _0x300908=_0x1735[_0xa228e9];return _0x300908;};'use strict';var Sequelize=require(_0x5173('0x0'));module[_0x5173('0x1')]={'name':{'type':Sequelize[_0x5173('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xad17=['STRING','sequelize','exports'];(function(_0x5102cd,_0x53e2bd){var _0x4b4ac4=function(_0x5c18cd){while(--_0x5c18cd){_0x5102cd['push'](_0x5102cd['shift']());}};_0x4b4ac4(++_0x53e2bd);}(_0xad17,0xb8));var _0x7ad1=function(_0x45f5df,_0x3b4325){_0x45f5df=_0x45f5df-0x0;var _0x81465d=_0xad17[_0x45f5df];return _0x81465d;};'use strict';var Sequelize=require(_0x7ad1('0x0'));module[_0x7ad1('0x1')]={'name':{'type':Sequelize[_0x7ad1('0x2')]},'description':{'type':Sequelize[_0x7ad1('0x2')]},'interval':{'type':Sequelize[_0x7ad1('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 2e87678..83d213c 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 _0x4d59=['count','limit','set','json','apply','reject','save','then','destroy','error','name','send','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','nolimit','offset','order','sort','where','pick','add','day','merge','filter','map','options','Interval','includeAll','findAll','catch','show','length','include','find','create','update','body','params','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate','request-promise','moment','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0x300736,_0x1e1aab){var _0x3a8c5a=function(_0x42d636){while(--_0x42d636){_0x300736['push'](_0x300736['shift']());}};_0x3a8c5a(++_0x1e1aab);}(_0x4d59,0x1f2));var _0x94d5=function(_0x1ef61c,_0x23dea0){_0x1ef61c=_0x1ef61c-0x0;var _0x8af961=_0x4d59[_0x1ef61c];return _0x8af961;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x94d5('0x0'));var moment=require(_0x94d5('0x1'));var BPromise=require(_0x94d5('0x2'));var Mustache=require('mustache');var util=require(_0x94d5('0x3'));var path=require(_0x94d5('0x4'));var sox=require('sox');var csv=require(_0x94d5('0x5'));var ejs=require(_0x94d5('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x94d5('0x7'));var crypto=require(_0x94d5('0x8'));var jsforce=require(_0x94d5('0x9'));var deskjs=require(_0x94d5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x94d5('0xb'));var qs=require(_0x94d5('0xc'));var logger=require(_0x94d5('0xd'))(_0x94d5('0xe'));var utils=require(_0x94d5('0xf'));var config=require(_0x94d5('0x10'));var db=require('../../mysqldb')['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x26d48e,_0x4b91bf){_0x4b91bf=_0x4b91bf||0xcc;return function(_0x4b18ae){if(_0x4b18ae){return _0x26d48e[_0x94d5('0x11')](_0x4b91bf);}return _0x26d48e[_0x94d5('0x12')](_0x4b91bf)[_0x94d5('0x13')]();};}function respondWithResult(_0x91651a,_0x2c6b54){_0x2c6b54=_0x2c6b54||0xc8;return function(_0xf4f1c8){if(_0xf4f1c8){return _0x91651a[_0x94d5('0x12')](_0x2c6b54)['json'](_0xf4f1c8);}};}function respondWithFilteredResult(_0xfccec3,_0x43b376){return function(_0x5e1bd7){if(_0x5e1bd7){var _0x206683=_0x5e1bd7[_0x94d5('0x14')],_0x3fa6a7=_0x43b376['offset'],_0x15518f=_0x43b376['offset']+_0x43b376[_0x94d5('0x15')],_0x54d8e6;if(_0x15518f>=_0x206683){_0x15518f=_0x206683;_0x54d8e6=0xc8;}else{_0x54d8e6=0xce;}_0xfccec3[_0x94d5('0x12')](_0x54d8e6);return _0xfccec3[_0x94d5('0x16')]('Content-Range',_0x3fa6a7+'-'+_0x15518f+'/'+_0x206683)[_0x94d5('0x17')](_0x5e1bd7);}return null;};}function patchUpdates(_0x73c20b){return function(_0x1d921b){try{jsonpatch[_0x94d5('0x18')](_0x1d921b,_0x73c20b,!![]);}catch(_0x2866df){return BPromise[_0x94d5('0x19')](_0x2866df);}return _0x1d921b[_0x94d5('0x1a')]();};}function saveUpdates(_0x4c40ab,_0xf7c226){return function(_0x26999a){if(_0x26999a){return _0x26999a['update'](_0x4c40ab)[_0x94d5('0x1b')](function(_0x1f276c){return _0x1f276c;});}return null;};}function removeEntity(_0x2a10f5,_0x57b226){return function(_0x5be9d7){if(_0x5be9d7){return _0x5be9d7[_0x94d5('0x1c')]()[_0x94d5('0x1b')](function(){_0x2a10f5[_0x94d5('0x12')](0xcc)[_0x94d5('0x13')]();});}};}function handleEntityNotFound(_0x21af27,_0xe34b22){return function(_0x16d3c6){if(!_0x16d3c6){_0x21af27[_0x94d5('0x11')](0x194);}return _0x16d3c6;};}function handleError(_0x1a41cb,_0x489446){_0x489446=_0x489446||0x1f4;return function(_0x1ac117){logger[_0x94d5('0x1d')](_0x1ac117['stack']);if(_0x1ac117[_0x94d5('0x1e')]){delete _0x1ac117[_0x94d5('0x1e')];}_0x1a41cb[_0x94d5('0x12')](_0x489446)[_0x94d5('0x1f')](_0x1ac117);};}exports['index']=function(_0x12ef6a,_0x452bb6){var _0x32561d={},_0x1ab711={},_0x327f16={'count':0x0,'rows':[]};var _0x507f36=db['Interval'][_0x94d5('0x20')];_0x1ab711['model']=_[_0x94d5('0x21')](_0x507f36);var _0x185646={'dateStart':_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x23')],'dateEnd':_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x24')]};delete _0x12ef6a[_0x94d5('0x22')][_0x94d5('0x23')];delete _0x12ef6a[_0x94d5('0x22')][_0x94d5('0x24')];_0x1ab711[_0x94d5('0x22')]=_['keys'](_0x12ef6a['query']);_0x1ab711[_0x94d5('0x25')]=_[_0x94d5('0x26')](_0x1ab711['model'],_0x1ab711[_0x94d5('0x22')]);_0x32561d[_0x94d5('0x27')]=_['intersection'](_0x1ab711[_0x94d5('0x28')],qs[_0x94d5('0x29')](_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x29')]));_0x32561d[_0x94d5('0x27')]=_0x32561d[_0x94d5('0x27')]['length']?_0x32561d[_0x94d5('0x27')]:_0x1ab711[_0x94d5('0x28')];if(!_0x12ef6a[_0x94d5('0x22')]['hasOwnProperty'](_0x94d5('0x2a'))){_0x32561d[_0x94d5('0x15')]=qs[_0x94d5('0x15')](_0x12ef6a['query'][_0x94d5('0x15')]);_0x32561d[_0x94d5('0x2b')]=qs[_0x94d5('0x2b')](_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x2b')]);}_0x32561d[_0x94d5('0x2c')]=qs[_0x94d5('0x2d')](_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x2d')]);_0x32561d[_0x94d5('0x2e')]=qs[_0x94d5('0x25')](_[_0x94d5('0x2f')](_0x12ef6a[_0x94d5('0x22')],_0x1ab711[_0x94d5('0x25')]));if(_0x185646['dateStart']){if(_0x185646['dateEnd']){_0x185646[_0x94d5('0x24')]=moment(_0x185646[_0x94d5('0x24')])[_0x94d5('0x30')](0x1,_0x94d5('0x31'));}else{_0x185646[_0x94d5('0x24')]=moment(_0x185646[_0x94d5('0x23')])[_0x94d5('0x30')](0x1,_0x94d5('0x31'));}_[_0x94d5('0x32')](_0x32561d[_0x94d5('0x2e')],{'createdAt':{'$gte':_0x185646[_0x94d5('0x23')],'$lte':_0x185646['dateEnd']}});}if(_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x33')]){_0x32561d[_0x94d5('0x2e')]=_[_0x94d5('0x32')](_0x32561d[_0x94d5('0x2e')],{'$or':_[_0x94d5('0x34')](_0x32561d['attributes'],function(_0x201e31){var _0x53b13d={};_0x53b13d[_0x201e31]={'$like':'%'+_0x12ef6a['query'][_0x94d5('0x33')]+'%'};return _0x53b13d;})});}_0x32561d=_['merge']({},_0x32561d,_0x12ef6a[_0x94d5('0x35')]);var _0x376eed={'where':_0x32561d[_0x94d5('0x2e')]};return db[_0x94d5('0x36')]['count'](_0x376eed)[_0x94d5('0x1b')](function(_0x220434){_0x327f16[_0x94d5('0x14')]=_0x220434;if(_0x12ef6a[_0x94d5('0x22')][_0x94d5('0x37')]){_0x32561d['include']=[{'all':!![]}];}return db[_0x94d5('0x36')][_0x94d5('0x38')](_0x32561d);})[_0x94d5('0x1b')](function(_0xbdeadf){_0x327f16['rows']=_0xbdeadf;return _0x327f16;})[_0x94d5('0x1b')](respondWithFilteredResult(_0x452bb6,_0x32561d))[_0x94d5('0x39')](handleError(_0x452bb6,null));};exports[_0x94d5('0x3a')]=function(_0x39b019,_0x3afdf6){var _0x26fbe1={'raw':!![],'where':{'id':_0x39b019['params']['id']}},_0x67993={};_0x67993[_0x94d5('0x28')]=_[_0x94d5('0x21')](db[_0x94d5('0x36')][_0x94d5('0x20')]);_0x67993[_0x94d5('0x22')]=_[_0x94d5('0x21')](_0x39b019[_0x94d5('0x22')]);_0x67993['filters']=_[_0x94d5('0x26')](_0x67993['model'],_0x67993[_0x94d5('0x22')]);_0x26fbe1['attributes']=_[_0x94d5('0x26')](_0x67993[_0x94d5('0x28')],qs['fields'](_0x39b019[_0x94d5('0x22')][_0x94d5('0x29')]));_0x26fbe1[_0x94d5('0x27')]=_0x26fbe1[_0x94d5('0x27')][_0x94d5('0x3b')]?_0x26fbe1[_0x94d5('0x27')]:_0x67993['model'];if(_0x39b019[_0x94d5('0x22')][_0x94d5('0x37')]){_0x26fbe1[_0x94d5('0x3c')]=[{'all':!![]}];}_0x26fbe1=_[_0x94d5('0x32')]({},_0x26fbe1,_0x39b019[_0x94d5('0x35')]);return db['Interval'][_0x94d5('0x3d')](_0x26fbe1)['then'](handleEntityNotFound(_0x3afdf6,null))[_0x94d5('0x1b')](respondWithResult(_0x3afdf6,null))[_0x94d5('0x39')](handleError(_0x3afdf6,null));};exports['create']=function(_0x559b42,_0x3c6257){return db[_0x94d5('0x36')][_0x94d5('0x3e')](_0x559b42['body'],{})[_0x94d5('0x1b')](respondWithResult(_0x3c6257,0xc9))[_0x94d5('0x39')](handleError(_0x3c6257,null));};exports[_0x94d5('0x3f')]=function(_0x46a7b2,_0x3013c7){if(_0x46a7b2['body']['id']){delete _0x46a7b2[_0x94d5('0x40')]['id'];}return db[_0x94d5('0x36')]['find']({'where':{'id':_0x46a7b2[_0x94d5('0x41')]['id']}})[_0x94d5('0x1b')](handleEntityNotFound(_0x3013c7,null))['then'](saveUpdates(_0x46a7b2[_0x94d5('0x40')],null))[_0x94d5('0x1b')](respondWithResult(_0x3013c7,null))[_0x94d5('0x39')](handleError(_0x3013c7,null));};exports[_0x94d5('0x1c')]=function(_0x5034dc,_0x2bb66a){return db[_0x94d5('0x36')][_0x94d5('0x3d')]({'where':{'id':_0x5034dc['params']['id']}})[_0x94d5('0x1b')](handleEntityNotFound(_0x2bb66a,null))[_0x94d5('0x1b')](removeEntity(_0x2bb66a,null))[_0x94d5('0x39')](handleError(_0x2bb66a,null));};exports[_0x94d5('0x42')]=function(_0x51a099,_0x348e91,_0x42527b){if(_0x51a099[_0x94d5('0x40')]['id']){delete _0x51a099['body']['id'];}return db[_0x94d5('0x36')]['find']({'where':{'id':_0x51a099[_0x94d5('0x41')]['id']}})[_0x94d5('0x1b')](handleEntityNotFound(_0x348e91,null))[_0x94d5('0x1b')](function(_0x551da6){if(_0x551da6){_0x51a099[_0x94d5('0x40')][_0x94d5('0x43')]=_0x551da6['id'];return db[_0x94d5('0x36')][_0x94d5('0x3e')](_0x51a099[_0x94d5('0x40')]);}})[_0x94d5('0x1b')](respondWithResult(_0x348e91,null))[_0x94d5('0x39')](handleError(_0x348e91,null));};exports[_0x94d5('0x44')]=function(_0x2873ea,_0x44cf67,_0x36c8af){var _0xfd005f={};var _0x41b988={};var _0x16c7cf;var _0x35e1b8;return db[_0x94d5('0x36')][_0x94d5('0x45')]({'where':{'id':_0x2873ea[_0x94d5('0x41')]['id']}})[_0x94d5('0x1b')](handleEntityNotFound(_0x44cf67,null))[_0x94d5('0x1b')](function(_0x3a0cec){if(_0x3a0cec){_0x16c7cf=_0x3a0cec;_0x41b988[_0x94d5('0x28')]=_[_0x94d5('0x21')](db[_0x94d5('0x36')][_0x94d5('0x20')]);_0x41b988[_0x94d5('0x22')]=_[_0x94d5('0x21')](_0x2873ea['query']);_0x41b988['filters']=_[_0x94d5('0x26')](_0x41b988['model'],_0x41b988[_0x94d5('0x22')]);_0xfd005f[_0x94d5('0x27')]=_[_0x94d5('0x26')](_0x41b988[_0x94d5('0x28')],qs['fields'](_0x2873ea[_0x94d5('0x22')][_0x94d5('0x29')]));_0xfd005f[_0x94d5('0x27')]=_0xfd005f[_0x94d5('0x27')][_0x94d5('0x3b')]?_0xfd005f[_0x94d5('0x27')]:_0x41b988['model'];_0xfd005f[_0x94d5('0x2c')]=qs['sort'](_0x2873ea[_0x94d5('0x22')][_0x94d5('0x2d')]);_0xfd005f['where']=qs[_0x94d5('0x25')](_[_0x94d5('0x2f')](_0x2873ea[_0x94d5('0x22')],_0x41b988[_0x94d5('0x25')]));if(_0x2873ea[_0x94d5('0x22')][_0x94d5('0x33')]){_0xfd005f['where']=_['merge'](_0xfd005f['where'],{'$or':_['map'](_0xfd005f[_0x94d5('0x27')],function(_0xc0198b){var _0x137d86={};_0x137d86[_0xc0198b]={'$like':'%'+_0x2873ea['query'][_0x94d5('0x33')]+'%'};return _0x137d86;})});}_0xfd005f=_[_0x94d5('0x32')]({},_0xfd005f,_0x2873ea[_0x94d5('0x35')]);return _0x16c7cf[_0x94d5('0x44')](_0xfd005f);}})['then'](function(_0x199819){if(_0x199819){_0x35e1b8=_0x199819[_0x94d5('0x3b')];if(!_0x2873ea[_0x94d5('0x22')][_0x94d5('0x46')](_0x94d5('0x2a'))){_0xfd005f[_0x94d5('0x15')]=qs[_0x94d5('0x15')](_0x2873ea[_0x94d5('0x22')][_0x94d5('0x15')]);_0xfd005f['offset']=qs[_0x94d5('0x2b')](_0x2873ea[_0x94d5('0x22')][_0x94d5('0x2b')]);}return _0x16c7cf[_0x94d5('0x44')](_0xfd005f);}})[_0x94d5('0x1b')](function(_0x55465c){if(_0x55465c){return _0x55465c?{'count':_0x35e1b8,'rows':_0x55465c}:null;}})[_0x94d5('0x1b')](respondWithResult(_0x44cf67,null))[_0x94d5('0x39')](handleError(_0x44cf67,null));};exports[_0x94d5('0x47')]=function(_0x27d4e3,_0x591468,_0x6e6c5c){return db[_0x94d5('0x36')]['findOne']({'where':{'id':_0x27d4e3[_0x94d5('0x41')]['id']}})[_0x94d5('0x1b')](handleEntityNotFound(_0x591468,null))[_0x94d5('0x1b')](function(_0x11e1b3){if(_0x11e1b3){return db[_0x94d5('0x48')]['transaction'](function(_0x232877){return db[_0x94d5('0x36')][_0x94d5('0x1c')]({'where':{'IntervalId':_0x27d4e3[_0x94d5('0x41')]['id']},'transaction':_0x232877})[_0x94d5('0x1b')](function(_0x262ec9){var _0xb18c3c=_[_0x94d5('0x34')](_0x27d4e3['body'],function(_0x915f86){delete _0x915f86['id'];_0x915f86[_0x94d5('0x43')]=_0x27d4e3['params']['id'];return _0x915f86;});return db[_0x94d5('0x36')][_0x94d5('0x49')](_0xb18c3c,{'transaction':_0x232877});});})['then'](function(){return db[_0x94d5('0x36')][_0x94d5('0x38')]({'where':{'IntervalId':_0x27d4e3[_0x94d5('0x41')]['id']}});});}})[_0x94d5('0x1b')](respondWithResult(_0x591468,null))['catch'](handleError(_0x591468,null));}; \ No newline at end of file +var _0x5147=['util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','limit','set','Content-Range','save','then','stack','name','send','index','Interval','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','count','includeAll','include','rows','catch','params','options','find','create','body','update','destroy','addInterval','IntervalId','getIntervals','findOne','sequelize','transaction','bulkCreate','findAll','fast-json-patch','mustache'];(function(_0x3e50ec,_0x1b83e7){var _0x43743e=function(_0x5dc51f){while(--_0x5dc51f){_0x3e50ec['push'](_0x3e50ec['shift']());}};_0x43743e(++_0x1b83e7);}(_0x5147,0x1b4));var _0x7514=function(_0x2b2839,_0x4f46d3){_0x2b2839=_0x2b2839-0x0;var _0x292664=_0x5147[_0x2b2839];return _0x292664;};'use strict';var jsonpatch=require(_0x7514('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7514('0x1'));var util=require(_0x7514('0x2'));var path=require('path');var sox=require('sox');var csv=require(_0x7514('0x3'));var ejs=require(_0x7514('0x4'));var fs=require('fs');var _=require(_0x7514('0x5'));var squel=require(_0x7514('0x6'));var crypto=require(_0x7514('0x7'));var jsforce=require(_0x7514('0x8'));var deskjs=require(_0x7514('0x9'));var toCsv=require(_0x7514('0x3'));var querystring=require(_0x7514('0xa'));var Papa=require(_0x7514('0xb'));var qs=require(_0x7514('0xc'));var logger=require(_0x7514('0xd'))(_0x7514('0xe'));var utils=require('../../config/utils');var config=require(_0x7514('0xf'));var db=require(_0x7514('0x10'))['db'];var extensions=require(_0x7514('0x11'));function respondWithStatusCode(_0x1e594d,_0x340f9e){_0x340f9e=_0x340f9e||0xcc;return function(_0x1cadf3){if(_0x1cadf3){return _0x1e594d[_0x7514('0x12')](_0x340f9e);}return _0x1e594d[_0x7514('0x13')](_0x340f9e)[_0x7514('0x14')]();};}function respondWithResult(_0xbb3fa7,_0xa83309){_0xa83309=_0xa83309||0xc8;return function(_0x5c7254){if(_0x5c7254){return _0xbb3fa7['status'](_0xa83309)['json'](_0x5c7254);}};}function respondWithFilteredResult(_0x4ad5cd,_0x3f4315){return function(_0x10feb8){if(_0x10feb8){var _0x4ef2bd=_0x10feb8['count'],_0x18483b=_0x3f4315[_0x7514('0x15')],_0x212b5c=_0x3f4315[_0x7514('0x15')]+_0x3f4315[_0x7514('0x16')],_0x475179;if(_0x212b5c>=_0x4ef2bd){_0x212b5c=_0x4ef2bd;_0x475179=0xc8;}else{_0x475179=0xce;}_0x4ad5cd['status'](_0x475179);return _0x4ad5cd[_0x7514('0x17')](_0x7514('0x18'),_0x18483b+'-'+_0x212b5c+'/'+_0x4ef2bd)['json'](_0x10feb8);}return null;};}function patchUpdates(_0x45fa73){return function(_0x63608a){try{jsonpatch['apply'](_0x63608a,_0x45fa73,!![]);}catch(_0x3f5cfa){return BPromise['reject'](_0x3f5cfa);}return _0x63608a[_0x7514('0x19')]();};}function saveUpdates(_0x17c260,_0x185bb2){return function(_0x344135){if(_0x344135){return _0x344135['update'](_0x17c260)[_0x7514('0x1a')](function(_0x2d71ec){return _0x2d71ec;});}return null;};}function removeEntity(_0x657904,_0x5b72f9){return function(_0x5bbca3){if(_0x5bbca3){return _0x5bbca3['destroy']()['then'](function(){_0x657904[_0x7514('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17956c,_0x4b3bb7){return function(_0x566b3e){if(!_0x566b3e){_0x17956c[_0x7514('0x12')](0x194);}return _0x566b3e;};}function handleError(_0x4252b0,_0x1a1c83){_0x1a1c83=_0x1a1c83||0x1f4;return function(_0x4627df){logger['error'](_0x4627df[_0x7514('0x1b')]);if(_0x4627df[_0x7514('0x1c')]){delete _0x4627df['name'];}_0x4252b0[_0x7514('0x13')](_0x1a1c83)[_0x7514('0x1d')](_0x4627df);};}exports[_0x7514('0x1e')]=function(_0x222a71,_0x79523a){var _0x493ee3={},_0x29ca96={},_0x5a4d24={'count':0x0,'rows':[]};var _0x42b049=db[_0x7514('0x1f')][_0x7514('0x20')];_0x29ca96['model']=_[_0x7514('0x21')](_0x42b049);var _0x2fc193={'dateStart':_0x222a71[_0x7514('0x22')][_0x7514('0x23')],'dateEnd':_0x222a71[_0x7514('0x22')][_0x7514('0x24')]};delete _0x222a71[_0x7514('0x22')]['dateStart'];delete _0x222a71['query'][_0x7514('0x24')];_0x29ca96[_0x7514('0x22')]=_[_0x7514('0x21')](_0x222a71[_0x7514('0x22')]);_0x29ca96[_0x7514('0x25')]=_[_0x7514('0x26')](_0x29ca96[_0x7514('0x27')],_0x29ca96['query']);_0x493ee3[_0x7514('0x28')]=_[_0x7514('0x26')](_0x29ca96['model'],qs[_0x7514('0x29')](_0x222a71['query'][_0x7514('0x29')]));_0x493ee3[_0x7514('0x28')]=_0x493ee3[_0x7514('0x28')][_0x7514('0x2a')]?_0x493ee3['attributes']:_0x29ca96[_0x7514('0x27')];if(!_0x222a71[_0x7514('0x22')][_0x7514('0x2b')](_0x7514('0x2c'))){_0x493ee3[_0x7514('0x16')]=qs[_0x7514('0x16')](_0x222a71[_0x7514('0x22')][_0x7514('0x16')]);_0x493ee3[_0x7514('0x15')]=qs[_0x7514('0x15')](_0x222a71[_0x7514('0x22')][_0x7514('0x15')]);}_0x493ee3[_0x7514('0x2d')]=qs[_0x7514('0x2e')](_0x222a71[_0x7514('0x22')][_0x7514('0x2e')]);_0x493ee3[_0x7514('0x2f')]=qs[_0x7514('0x25')](_['pick'](_0x222a71[_0x7514('0x22')],_0x29ca96[_0x7514('0x25')]));if(_0x2fc193[_0x7514('0x23')]){if(_0x2fc193[_0x7514('0x24')]){_0x2fc193['dateEnd']=moment(_0x2fc193['dateEnd'])['add'](0x1,'day');}else{_0x2fc193['dateEnd']=moment(_0x2fc193[_0x7514('0x23')])[_0x7514('0x30')](0x1,_0x7514('0x31'));}_[_0x7514('0x32')](_0x493ee3[_0x7514('0x2f')],{'createdAt':{'$gte':_0x2fc193[_0x7514('0x23')],'$lte':_0x2fc193[_0x7514('0x24')]}});}if(_0x222a71['query'][_0x7514('0x33')]){_0x493ee3[_0x7514('0x2f')]=_[_0x7514('0x32')](_0x493ee3[_0x7514('0x2f')],{'$or':_[_0x7514('0x34')](_0x493ee3['attributes'],function(_0x599971){var _0x58c449={};_0x58c449[_0x599971]={'$like':'%'+_0x222a71[_0x7514('0x22')][_0x7514('0x33')]+'%'};return _0x58c449;})});}_0x493ee3=_[_0x7514('0x32')]({},_0x493ee3,_0x222a71['options']);var _0x368849={'where':_0x493ee3['where']};return db['Interval'][_0x7514('0x35')](_0x368849)['then'](function(_0x49529a){_0x5a4d24['count']=_0x49529a;if(_0x222a71[_0x7514('0x22')][_0x7514('0x36')]){_0x493ee3[_0x7514('0x37')]=[{'all':!![]}];}return db['Interval']['findAll'](_0x493ee3);})[_0x7514('0x1a')](function(_0x25acf9){_0x5a4d24[_0x7514('0x38')]=_0x25acf9;return _0x5a4d24;})[_0x7514('0x1a')](respondWithFilteredResult(_0x79523a,_0x493ee3))[_0x7514('0x39')](handleError(_0x79523a,null));};exports['show']=function(_0x4099ca,_0x56b6e6){var _0x5d7315={'raw':!![],'where':{'id':_0x4099ca[_0x7514('0x3a')]['id']}},_0x5be62a={};_0x5be62a['model']=_[_0x7514('0x21')](db[_0x7514('0x1f')][_0x7514('0x20')]);_0x5be62a[_0x7514('0x22')]=_[_0x7514('0x21')](_0x4099ca[_0x7514('0x22')]);_0x5be62a['filters']=_['intersection'](_0x5be62a[_0x7514('0x27')],_0x5be62a[_0x7514('0x22')]);_0x5d7315[_0x7514('0x28')]=_[_0x7514('0x26')](_0x5be62a[_0x7514('0x27')],qs[_0x7514('0x29')](_0x4099ca[_0x7514('0x22')][_0x7514('0x29')]));_0x5d7315[_0x7514('0x28')]=_0x5d7315[_0x7514('0x28')][_0x7514('0x2a')]?_0x5d7315[_0x7514('0x28')]:_0x5be62a[_0x7514('0x27')];if(_0x4099ca['query'][_0x7514('0x36')]){_0x5d7315[_0x7514('0x37')]=[{'all':!![]}];}_0x5d7315=_[_0x7514('0x32')]({},_0x5d7315,_0x4099ca[_0x7514('0x3b')]);return db[_0x7514('0x1f')][_0x7514('0x3c')](_0x5d7315)[_0x7514('0x1a')](handleEntityNotFound(_0x56b6e6,null))[_0x7514('0x1a')](respondWithResult(_0x56b6e6,null))[_0x7514('0x39')](handleError(_0x56b6e6,null));};exports[_0x7514('0x3d')]=function(_0x1b8a0e,_0x294748){return db[_0x7514('0x1f')][_0x7514('0x3d')](_0x1b8a0e[_0x7514('0x3e')],{})[_0x7514('0x1a')](respondWithResult(_0x294748,0xc9))[_0x7514('0x39')](handleError(_0x294748,null));};exports[_0x7514('0x3f')]=function(_0x316be3,_0x1fd9e7){if(_0x316be3[_0x7514('0x3e')]['id']){delete _0x316be3[_0x7514('0x3e')]['id'];}return db['Interval'][_0x7514('0x3c')]({'where':{'id':_0x316be3['params']['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x1fd9e7,null))[_0x7514('0x1a')](saveUpdates(_0x316be3[_0x7514('0x3e')],null))[_0x7514('0x1a')](respondWithResult(_0x1fd9e7,null))[_0x7514('0x39')](handleError(_0x1fd9e7,null));};exports[_0x7514('0x40')]=function(_0x4fb80e,_0x1e1955){return db[_0x7514('0x1f')][_0x7514('0x3c')]({'where':{'id':_0x4fb80e[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x1e1955,null))[_0x7514('0x1a')](removeEntity(_0x1e1955,null))[_0x7514('0x39')](handleError(_0x1e1955,null));};exports[_0x7514('0x41')]=function(_0xe8cdc,_0x36c21b,_0x1d36a6){if(_0xe8cdc[_0x7514('0x3e')]['id']){delete _0xe8cdc[_0x7514('0x3e')]['id'];}return db['Interval']['find']({'where':{'id':_0xe8cdc[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x36c21b,null))[_0x7514('0x1a')](function(_0x597918){if(_0x597918){_0xe8cdc[_0x7514('0x3e')][_0x7514('0x42')]=_0x597918['id'];return db[_0x7514('0x1f')]['create'](_0xe8cdc[_0x7514('0x3e')]);}})['then'](respondWithResult(_0x36c21b,null))['catch'](handleError(_0x36c21b,null));};exports[_0x7514('0x43')]=function(_0x456600,_0x3a0016,_0xbc583a){var _0x3d8b99={};var _0x5a44ab={};var _0x12bc48;var _0x597b35;return db[_0x7514('0x1f')][_0x7514('0x44')]({'where':{'id':_0x456600[_0x7514('0x3a')]['id']}})[_0x7514('0x1a')](handleEntityNotFound(_0x3a0016,null))['then'](function(_0x4d9139){if(_0x4d9139){_0x12bc48=_0x4d9139;_0x5a44ab[_0x7514('0x27')]=_[_0x7514('0x21')](db[_0x7514('0x1f')]['rawAttributes']);_0x5a44ab['query']=_[_0x7514('0x21')](_0x456600[_0x7514('0x22')]);_0x5a44ab[_0x7514('0x25')]=_[_0x7514('0x26')](_0x5a44ab[_0x7514('0x27')],_0x5a44ab[_0x7514('0x22')]);_0x3d8b99[_0x7514('0x28')]=_[_0x7514('0x26')](_0x5a44ab[_0x7514('0x27')],qs['fields'](_0x456600['query'][_0x7514('0x29')]));_0x3d8b99[_0x7514('0x28')]=_0x3d8b99[_0x7514('0x28')][_0x7514('0x2a')]?_0x3d8b99['attributes']:_0x5a44ab[_0x7514('0x27')];_0x3d8b99[_0x7514('0x2d')]=qs[_0x7514('0x2e')](_0x456600[_0x7514('0x22')][_0x7514('0x2e')]);_0x3d8b99[_0x7514('0x2f')]=qs['filters'](_['pick'](_0x456600['query'],_0x5a44ab[_0x7514('0x25')]));if(_0x456600[_0x7514('0x22')][_0x7514('0x33')]){_0x3d8b99[_0x7514('0x2f')]=_['merge'](_0x3d8b99[_0x7514('0x2f')],{'$or':_[_0x7514('0x34')](_0x3d8b99[_0x7514('0x28')],function(_0x134a67){var _0xc7fe9a={};_0xc7fe9a[_0x134a67]={'$like':'%'+_0x456600[_0x7514('0x22')]['filter']+'%'};return _0xc7fe9a;})});}_0x3d8b99=_['merge']({},_0x3d8b99,_0x456600['options']);return _0x12bc48['getIntervals'](_0x3d8b99);}})[_0x7514('0x1a')](function(_0x4989e5){if(_0x4989e5){_0x597b35=_0x4989e5[_0x7514('0x2a')];if(!_0x456600[_0x7514('0x22')][_0x7514('0x2b')]('nolimit')){_0x3d8b99['limit']=qs[_0x7514('0x16')](_0x456600['query'][_0x7514('0x16')]);_0x3d8b99['offset']=qs['offset'](_0x456600['query']['offset']);}return _0x12bc48[_0x7514('0x43')](_0x3d8b99);}})[_0x7514('0x1a')](function(_0x33111b){if(_0x33111b){return _0x33111b?{'count':_0x597b35,'rows':_0x33111b}:null;}})[_0x7514('0x1a')](respondWithResult(_0x3a0016,null))['catch'](handleError(_0x3a0016,null));};exports['addIntervals']=function(_0xabe173,_0x5f4fe6,_0x4e58c6){return db['Interval'][_0x7514('0x44')]({'where':{'id':_0xabe173['params']['id']}})['then'](handleEntityNotFound(_0x5f4fe6,null))[_0x7514('0x1a')](function(_0x65105f){if(_0x65105f){return db[_0x7514('0x45')][_0x7514('0x46')](function(_0x561ad9){return db[_0x7514('0x1f')][_0x7514('0x40')]({'where':{'IntervalId':_0xabe173[_0x7514('0x3a')]['id']},'transaction':_0x561ad9})[_0x7514('0x1a')](function(_0x37db04){var _0xfcfcaa=_[_0x7514('0x34')](_0xabe173['body'],function(_0x566bb2){delete _0x566bb2['id'];_0x566bb2[_0x7514('0x42')]=_0xabe173['params']['id'];return _0x566bb2;});return db[_0x7514('0x1f')][_0x7514('0x47')](_0xfcfcaa,{'transaction':_0x561ad9});});})[_0x7514('0x1a')](function(){return db['Interval'][_0x7514('0x48')]({'where':{'IntervalId':_0xabe173['params']['id']}});});}})[_0x7514('0x1a')](respondWithResult(_0x5f4fe6,null))[_0x7514('0x39')](handleError(_0x5f4fe6,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 03c773f..705c02c 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 _0x2738=['request-promise','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x50f19a,_0xa5fafe){var _0xde90b6=function(_0x5ab3d5){while(--_0x5ab3d5){_0x50f19a['push'](_0x50f19a['shift']());}};_0xde90b6(++_0xa5fafe);}(_0x2738,0x118));var _0x8273=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x2738[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x8273('0x0'));var util=require(_0x8273('0x1'));var logger=require(_0x8273('0x2'))(_0x8273('0x3'));var moment=require(_0x8273('0x4'));var BPromise=require(_0x8273('0x5'));var rp=require(_0x8273('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0x8273('0x7'));module[_0x8273('0x8')]=function(_0x5130c6,_0x46b4a6){return _0x5130c6[_0x8273('0x9')](_0x8273('0xa'),attributes,{'tableName':_0x8273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1e17d8,_0x5cc41c){extensions['rewrite'](_0x5130c6,_0x1e17d8);},'afterBulkCreate':function(_0x20c305,_0xb9a80b,_0x48243e){_0x48243e();extensions[_0x8273('0xc')](_0x5130c6,_0x20c305[0x0]);},'afterUpdate':function(_0xead05e,_0xb6042f){extensions[_0x8273('0xc')](_0x5130c6,_0xead05e);},'afterDestroy':function(_0xcbadd8,_0x4c22a3){extensions[_0x8273('0xc')](_0x5130c6,_0xcbadd8);}}});}; \ No newline at end of file +var _0x21ad=['moment','bluebird','request-promise','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','../../config/logger','api'];(function(_0x5a45cc,_0x597330){var _0x149ef0=function(_0x35870e){while(--_0x35870e){_0x5a45cc['push'](_0x5a45cc['shift']());}};_0x149ef0(++_0x597330);}(_0x21ad,0x8c));var _0xd21a=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x21ad[_0x618414];return _0x21c19a;};'use strict';var _=require(_0xd21a('0x0'));var util=require(_0xd21a('0x1'));var logger=require(_0xd21a('0x2'))(_0xd21a('0x3'));var moment=require(_0xd21a('0x4'));var BPromise=require(_0xd21a('0x5'));var rp=require(_0xd21a('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xd21a('0x7'));module[_0xd21a('0x8')]=function(_0x5210a9,_0x33b581){return _0x5210a9[_0xd21a('0x9')](_0xd21a('0xa'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3ad7a3,_0x43b935){extensions[_0xd21a('0xb')](_0x5210a9,_0x3ad7a3);},'afterBulkCreate':function(_0x21f2f4,_0x2be673,_0x4d0f4b){_0x4d0f4b();extensions[_0xd21a('0xb')](_0x5210a9,_0x21f2f4[0x0]);},'afterUpdate':function(_0x406bf6,_0x4598a1){extensions[_0xd21a('0xb')](_0x5210a9,_0x406bf6);},'afterDestroy':function(_0x3e8592,_0x346701){extensions[_0xd21a('0xb')](_0x5210a9,_0x3e8592);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index fad7ac8..0547323 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 _0x2d85=['result','catch','GetInterval','findAll','options','where','include','map','model','stringify','ShowInterval','Interval','find','raw','attributes','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','error','code','Interval,\x20%s,\x20%s','message'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2d85,0xaf));var _0x52d8=function(_0x32ad94,_0x2a0ac0){_0x32ad94=_0x32ad94-0x0;var _0x57ab0e=_0x2d85[_0x32ad94];return _0x57ab0e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x52d8('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x52d8('0x1'));var logger=require(_0x52d8('0x2'))(_0x52d8('0x3'));var config=require('../../config/environment');var jayson=require(_0x52d8('0x4'));var client=jayson[_0x52d8('0x5')][_0x52d8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x412ae8,_0x24f7d0,_0x4fbd38){return new BPromise(function(_0x282e0c,_0x21d7dd){return client[_0x52d8('0x7')](_0x412ae8,_0x4fbd38)[_0x52d8('0x8')](function(_0xd427f){logger[_0x52d8('0x9')]('Interval,\x20%s,\x20%s',_0x24f7d0,_0x52d8('0xa'));logger[_0x52d8('0xb')](_0x52d8('0xc'),_0x24f7d0,_0x52d8('0xa'),JSON['stringify'](_0xd427f));if(_0xd427f[_0x52d8('0xd')]){if(_0xd427f['error'][_0x52d8('0xe')]===0x1f4){logger[_0x52d8('0xd')](_0x52d8('0xf'),_0x24f7d0,_0xd427f['error'][_0x52d8('0x10')]);return _0x21d7dd(_0xd427f[_0x52d8('0xd')]['message']);}logger['error']('Interval,\x20%s,\x20%s',_0x24f7d0,_0xd427f[_0x52d8('0xd')][_0x52d8('0x10')]);return _0x282e0c(_0xd427f['error']['message']);}else{logger['info']('Interval,\x20%s,\x20%s',_0x24f7d0,'request\x20sent');_0x282e0c(_0xd427f[_0x52d8('0x11')][_0x52d8('0x10')]);}})[_0x52d8('0x12')](function(_0x50bdda){logger[_0x52d8('0xd')](_0x52d8('0xf'),_0x24f7d0,_0x50bdda);_0x21d7dd(_0x50bdda);});});}exports[_0x52d8('0x13')]=function(_0x452220){var _0x606547=this;return new Promise(function(_0x13aeb7,_0x126a61){return db['Interval'][_0x52d8('0x14')]({'raw':_0x452220[_0x52d8('0x15')]?_0x452220['options']['raw']===undefined?!![]:![]:!![],'where':_0x452220[_0x52d8('0x15')]?_0x452220[_0x52d8('0x15')][_0x52d8('0x16')]||null:null,'attributes':_0x452220[_0x52d8('0x15')]?_0x452220[_0x52d8('0x15')]['attributes']||null:null,'limit':_0x452220[_0x52d8('0x15')]?_0x452220[_0x52d8('0x15')]['limit']||null:null,'include':_0x452220[_0x52d8('0x15')]?_0x452220[_0x52d8('0x15')][_0x52d8('0x17')]?_[_0x52d8('0x18')](_0x452220[_0x52d8('0x15')][_0x52d8('0x17')],function(_0x2f04e7){return{'model':db[_0x2f04e7[_0x52d8('0x19')]],'as':_0x2f04e7['as'],'attributes':_0x2f04e7['attributes'],'include':_0x2f04e7[_0x52d8('0x17')]?_[_0x52d8('0x18')](_0x2f04e7['include'],function(_0x5a35b9){return{'model':db[_0x5a35b9[_0x52d8('0x19')]],'as':_0x5a35b9['as'],'attributes':_0x5a35b9['attributes'],'include':_0x5a35b9[_0x52d8('0x17')]?_[_0x52d8('0x18')](_0x5a35b9[_0x52d8('0x17')],function(_0x4dfbfb){return{'model':db[_0x4dfbfb[_0x52d8('0x19')]],'as':_0x4dfbfb['as'],'attributes':_0x4dfbfb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x405ba0){logger['info'](_0x52d8('0x13'),_0x452220);logger['debug'](_0x52d8('0x13'),_0x452220,JSON[_0x52d8('0x1a')](_0x405ba0));_0x13aeb7(_0x405ba0);})['catch'](function(_0x522a27){logger[_0x52d8('0xd')](_0x52d8('0x13'),_0x522a27[_0x52d8('0x10')],_0x452220);_0x126a61(_0x606547['error'](0x1f4,_0x522a27[_0x52d8('0x10')]));});});};exports[_0x52d8('0x1b')]=function(_0x421bd8){var _0x38e894=this;return new Promise(function(_0x2c950a,_0x45e49f){return db[_0x52d8('0x1c')][_0x52d8('0x1d')]({'raw':_0x421bd8[_0x52d8('0x15')]?_0x421bd8[_0x52d8('0x15')][_0x52d8('0x1e')]===undefined?!![]:![]:!![],'where':_0x421bd8[_0x52d8('0x15')]?_0x421bd8['options']['where']||null:null,'attributes':_0x421bd8[_0x52d8('0x15')]?_0x421bd8['options'][_0x52d8('0x1f')]||null:null,'include':_0x421bd8[_0x52d8('0x15')]?_0x421bd8[_0x52d8('0x15')][_0x52d8('0x17')]?_[_0x52d8('0x18')](_0x421bd8['options'][_0x52d8('0x17')],function(_0x10859b){return{'model':db[_0x10859b[_0x52d8('0x19')]],'as':_0x10859b['as'],'attributes':_0x10859b['attributes'],'include':_0x10859b[_0x52d8('0x17')]?_['map'](_0x10859b[_0x52d8('0x17')],function(_0x54a4a9){return{'model':db[_0x54a4a9[_0x52d8('0x19')]],'as':_0x54a4a9['as'],'attributes':_0x54a4a9[_0x52d8('0x1f')],'include':_0x54a4a9[_0x52d8('0x17')]?_[_0x52d8('0x18')](_0x54a4a9[_0x52d8('0x17')],function(_0x5f4548){return{'model':db[_0x5f4548[_0x52d8('0x19')]],'as':_0x5f4548['as'],'attributes':_0x5f4548[_0x52d8('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x555fb4){logger[_0x52d8('0x9')](_0x52d8('0x1b'),_0x421bd8);logger[_0x52d8('0xb')](_0x52d8('0x1b'),_0x421bd8,JSON[_0x52d8('0x1a')](_0x555fb4));_0x2c950a(_0x555fb4);})['catch'](function(_0x50086a){logger[_0x52d8('0xd')](_0x52d8('0x1b'),_0x50086a[_0x52d8('0x10')],_0x421bd8);_0x45e49f(_0x38e894[_0x52d8('0xd')](0x1f4,_0x50086a['message']));});});}; \ No newline at end of file +var _0xbd9d=['model','ShowInterval','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x4aa7a1,_0x1ef969){var _0x3e0c8a=function(_0x538272){while(--_0x538272){_0x4aa7a1['push'](_0x4aa7a1['shift']());}};_0x3e0c8a(++_0x1ef969);}(_0xbd9d,0x135));var _0xdbd9=function(_0x285afc,_0x146b2e){_0x285afc=_0x285afc-0x0;var _0x2dc641=_0xbd9d[_0x285afc];return _0x2dc641;};'use strict';var _=require('lodash');var util=require(_0xdbd9('0x0'));var moment=require(_0xdbd9('0x1'));var BPromise=require(_0xdbd9('0x2'));var rs=require(_0xdbd9('0x3'));var fs=require('fs');var db=require(_0xdbd9('0x4'))['db'];var utils=require(_0xdbd9('0x5'));var logger=require(_0xdbd9('0x6'))('rpc');var config=require(_0xdbd9('0x7'));var jayson=require(_0xdbd9('0x8'));var client=jayson[_0xdbd9('0x9')][_0xdbd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fa314,_0x527cba,_0x29ebf9){return new BPromise(function(_0x459535,_0x3fb002){return client['request'](_0x1fa314,_0x29ebf9)[_0xdbd9('0xb')](function(_0x994d40){logger[_0xdbd9('0xc')](_0xdbd9('0xd'),_0x527cba,_0xdbd9('0xe'));logger['debug'](_0xdbd9('0xf'),_0x527cba,'request\x20sent',JSON[_0xdbd9('0x10')](_0x994d40));if(_0x994d40[_0xdbd9('0x11')]){if(_0x994d40['error'][_0xdbd9('0x12')]===0x1f4){logger[_0xdbd9('0x11')](_0xdbd9('0xd'),_0x527cba,_0x994d40['error'][_0xdbd9('0x13')]);return _0x3fb002(_0x994d40[_0xdbd9('0x11')][_0xdbd9('0x13')]);}logger['error'](_0xdbd9('0xd'),_0x527cba,_0x994d40[_0xdbd9('0x11')][_0xdbd9('0x13')]);return _0x459535(_0x994d40['error'][_0xdbd9('0x13')]);}else{logger[_0xdbd9('0xc')](_0xdbd9('0xd'),_0x527cba,'request\x20sent');_0x459535(_0x994d40['result'][_0xdbd9('0x13')]);}})[_0xdbd9('0x14')](function(_0x56b737){logger[_0xdbd9('0x11')]('Interval,\x20%s,\x20%s',_0x527cba,_0x56b737);_0x3fb002(_0x56b737);});});}exports[_0xdbd9('0x15')]=function(_0xbb07dc){var _0x408284=this;return new Promise(function(_0x5ea55d,_0x196d14){return db[_0xdbd9('0x16')][_0xdbd9('0x17')]({'raw':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x19')]===undefined?!![]:![]:!![],'where':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc['options'][_0xdbd9('0x1a')]||null:null,'attributes':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1b')]||null:null,'limit':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1c')]||null:null,'include':_0xbb07dc[_0xdbd9('0x18')]?_0xbb07dc[_0xdbd9('0x18')][_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0xbb07dc[_0xdbd9('0x18')]['include'],function(_0x3cef52){return{'model':db[_0x3cef52[_0xdbd9('0x1f')]],'as':_0x3cef52['as'],'attributes':_0x3cef52['attributes'],'include':_0x3cef52['include']?_['map'](_0x3cef52['include'],function(_0x11e7a1){return{'model':db[_0x11e7a1[_0xdbd9('0x1f')]],'as':_0x11e7a1['as'],'attributes':_0x11e7a1[_0xdbd9('0x1b')],'include':_0x11e7a1[_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0x11e7a1[_0xdbd9('0x1d')],function(_0x33c22a){return{'model':db[_0x33c22a[_0xdbd9('0x1f')]],'as':_0x33c22a['as'],'attributes':_0x33c22a[_0xdbd9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xdbd9('0xb')](function(_0x33e03d){logger['info'](_0xdbd9('0x15'),_0xbb07dc);logger['debug'](_0xdbd9('0x15'),_0xbb07dc,JSON[_0xdbd9('0x10')](_0x33e03d));_0x5ea55d(_0x33e03d);})[_0xdbd9('0x14')](function(_0x12da0a){logger['error'](_0xdbd9('0x15'),_0x12da0a['message'],_0xbb07dc);_0x196d14(_0x408284[_0xdbd9('0x11')](0x1f4,_0x12da0a['message']));});});};exports[_0xdbd9('0x20')]=function(_0x182b8f){var _0x1ff426=this;return new Promise(function(_0xb647ec,_0x5a4435){return db[_0xdbd9('0x16')][_0xdbd9('0x21')]({'raw':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f['options']['raw']===undefined?!![]:![]:!![],'where':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1a')]||null:null,'attributes':_0x182b8f['options']?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1b')]||null:null,'include':_0x182b8f[_0xdbd9('0x18')]?_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1d')]?_[_0xdbd9('0x1e')](_0x182b8f[_0xdbd9('0x18')][_0xdbd9('0x1d')],function(_0x2d5654){return{'model':db[_0x2d5654[_0xdbd9('0x1f')]],'as':_0x2d5654['as'],'attributes':_0x2d5654[_0xdbd9('0x1b')],'include':_0x2d5654[_0xdbd9('0x1d')]?_['map'](_0x2d5654[_0xdbd9('0x1d')],function(_0xcaa06e){return{'model':db[_0xcaa06e['model']],'as':_0xcaa06e['as'],'attributes':_0xcaa06e[_0xdbd9('0x1b')],'include':_0xcaa06e['include']?_[_0xdbd9('0x1e')](_0xcaa06e[_0xdbd9('0x1d')],function(_0x39f0f4){return{'model':db[_0x39f0f4[_0xdbd9('0x1f')]],'as':_0x39f0f4['as'],'attributes':_0x39f0f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xdbd9('0xb')](function(_0x43bd6e){logger['info'](_0xdbd9('0x20'),_0x182b8f);logger['debug']('ShowInterval',_0x182b8f,JSON[_0xdbd9('0x10')](_0x43bd6e));_0xb647ec(_0x43bd6e);})['catch'](function(_0xb3e73){logger[_0xdbd9('0x11')]('ShowInterval',_0xb3e73[_0xdbd9('0x13')],_0x182b8f);_0x5a4435(_0x1ff426[_0xdbd9('0x11')](0x1f4,_0xb3e73[_0xdbd9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 6cac330..3baa0dd 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 _0x2032=['isAuthenticated','send','Router','../../components/auth/service','./jira.controller'];(function(_0x477b5e,_0x291d0c){var _0x514209=function(_0x17a7e7){while(--_0x17a7e7){_0x477b5e['push'](_0x477b5e['shift']());}};_0x514209(++_0x291d0c);}(_0x2032,0xd9));var _0x2203=function(_0x42e39f,_0x364a99){_0x42e39f=_0x42e39f-0x0;var _0x9976c0=_0x2032[_0x42e39f];return _0x9976c0;};'use strict';var express=require('express');var router=express[_0x2203('0x0')]();var auth=require(_0x2203('0x1'));var controller=require(_0x2203('0x2'));router['post']('/',auth[_0x2203('0x3')](),controller[_0x2203('0x4')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index eeb4d23..c3f085a 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 _0xbaf0=['description','stringify','issuetype','fields','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_10102','track.xcallymotion.com','POST','Basic\x20','toString','base64','setEncoding','utf8','data','end','statusCode','json','parse','error','status','api.jira','write','openIssue','send','body','headers','x-forwarded-for','remoteAddress','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20'];(function(_0x58dd70,_0xc638e9){var _0x350d1b=function(_0x176156){while(--_0x176156){_0x58dd70['push'](_0x58dd70['shift']());}};_0x350d1b(++_0xc638e9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var BPromise=require('bluebird');var https=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var USERNAME=_0x0baf('0x3');var PASSWORD=_0x0baf('0x4');function openIssue(_0x4d2e72,_0x5a3e42){var _0x232cc7={'fields':{'project':{'key':_0x4d2e72[_0x0baf('0x5')]||_0x0baf('0x6')},'summary':(_0x4d2e72[_0x0baf('0x7')]||_0x0baf('0x8'))+_0x0baf('0x9')+_0x4d2e72['ip'],'description':_0x4d2e72[_0x0baf('0xa')]||JSON[_0x0baf('0xb')](_0x4d2e72),'issuetype':{'name':_0x4d2e72[_0x0baf('0xc')]||'Bug'}}};_0x232cc7[_0x0baf('0xd')]['customfield_11500']=_0x4d2e72[_0x0baf('0xe')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0xf')]=_0x4d2e72[_0x0baf('0x10')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x11')]=_0x4d2e72[_0x0baf('0x12')];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x13')]=_0x4d2e72[_0x0baf('0x14')];_0x232cc7[_0x0baf('0xd')]['customfield_11504']=_0x4d2e72['reason'];_0x232cc7[_0x0baf('0xd')][_0x0baf('0x15')]=_0x4d2e72['ip'];var _0x5db689={'host':_0x0baf('0x16'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x0baf('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x0baf('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0baf('0x19')](_0x0baf('0x1a'))}};var _0x2bc381=JSON[_0x0baf('0xb')](_0x232cc7);var _0x469599=https['request'](_0x5db689,function(_0x4cd79d){_0x4cd79d[_0x0baf('0x1b')](_0x0baf('0x1c'));var _0x283408='';_0x4cd79d['on'](_0x0baf('0x1d'),function(_0x2cf7da){_0x283408+=_0x2cf7da;});_0x4cd79d['on'](_0x0baf('0x1e'),function(){if(_0x5a3e42){return _0x5a3e42['status'](_0x4cd79d[_0x0baf('0x1f')])[_0x0baf('0x20')](JSON[_0x0baf('0x21')](_0x283408));}});});_0x469599['on'](_0x0baf('0x22'),function(_0x47070d){if(_0x5a3e42){return _0x5a3e42[_0x0baf('0x23')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x0baf('0x24')}]});}});_0x469599[_0x0baf('0x25')](_0x2bc381);_0x469599[_0x0baf('0x1e')]();}exports[_0x0baf('0x26')]=openIssue;exports[_0x0baf('0x27')]=function(_0x3e3e20,_0x210cd8){_0x3e3e20[_0x0baf('0x28')]['ip']=_0x3e3e20[_0x0baf('0x29')][_0x0baf('0x2a')]||_0x3e3e20['connection'][_0x0baf('0x2b')]||_0x3e3e20['socket'][_0x0baf('0x2b')]||_0x3e3e20['connection']['socket'][_0x0baf('0x2b')];return openIssue(_0x3e3e20['body'],_0x210cd8);}; \ No newline at end of file +var _0xd8b0=['fields','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','remoteAddress','socket','connection','bluebird','https','3eAmWpBVP0','key','Report','\x20from\x20','description','issuetype','Bug','customfield_11500','email'];(function(_0x173c92,_0x1215b7){var _0x5b1687=function(_0x7ffc17){while(--_0x7ffc17){_0x173c92['push'](_0x173c92['shift']());}};_0x5b1687(++_0x1215b7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var https=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x0d8b('0x2');function openIssue(_0x5b9b89,_0x43bca1){var _0x364286={'fields':{'project':{'key':_0x5b9b89[_0x0d8b('0x3')]||'MOTGUI'},'summary':(_0x5b9b89['summary']||_0x0d8b('0x4'))+_0x0d8b('0x5')+_0x5b9b89['ip'],'description':_0x5b9b89[_0x0d8b('0x6')]||JSON['stringify'](_0x5b9b89),'issuetype':{'name':_0x5b9b89[_0x0d8b('0x7')]||_0x0d8b('0x8')}}};_0x364286['fields'][_0x0d8b('0x9')]=_0x5b9b89[_0x0d8b('0xa')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0xc')]=_0x5b9b89[_0x0d8b('0xd')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0xe')]=_0x5b9b89[_0x0d8b('0xf')];_0x364286['fields'][_0x0d8b('0x10')]=_0x5b9b89['name'];_0x364286[_0x0d8b('0xb')][_0x0d8b('0x11')]=_0x5b9b89[_0x0d8b('0x12')];_0x364286[_0x0d8b('0xb')][_0x0d8b('0x13')]=_0x5b9b89['ip'];var _0x32bb1a={'host':_0x0d8b('0x14'),'port':0x1bb,'path':_0x0d8b('0x15'),'method':_0x0d8b('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x0d8b('0x17'),'Authorization':_0x0d8b('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x0d8b('0x19')](_0x0d8b('0x1a'))}};var _0x2d4e1c=JSON['stringify'](_0x364286);var _0x23eb7b=https[_0x0d8b('0x1b')](_0x32bb1a,function(_0x17f7df){_0x17f7df[_0x0d8b('0x1c')](_0x0d8b('0x1d'));var _0x5cd485='';_0x17f7df['on'](_0x0d8b('0x1e'),function(_0x4586c2){_0x5cd485+=_0x4586c2;});_0x17f7df['on'](_0x0d8b('0x1f'),function(){if(_0x43bca1){return _0x43bca1[_0x0d8b('0x20')](_0x17f7df[_0x0d8b('0x21')])[_0x0d8b('0x22')](JSON[_0x0d8b('0x23')](_0x5cd485));}});});_0x23eb7b['on'](_0x0d8b('0x24'),function(_0x4a15bf){if(_0x43bca1){return _0x43bca1[_0x0d8b('0x20')](0x1f4)[_0x0d8b('0x22')]({'errors':[{'message':_0x0d8b('0x25'),'type':_0x0d8b('0x26')}]});}});_0x23eb7b[_0x0d8b('0x27')](_0x2d4e1c);_0x23eb7b[_0x0d8b('0x1f')]();}exports[_0x0d8b('0x28')]=openIssue;exports[_0x0d8b('0x29')]=function(_0x50ec1e,_0x4f0a1a){_0x50ec1e[_0x0d8b('0x2a')]['ip']=_0x50ec1e['headers']['x-forwarded-for']||_0x50ec1e['connection'][_0x0d8b('0x2b')]||_0x50ec1e[_0x0d8b('0x2c')][_0x0d8b('0x2b')]||_0x50ec1e[_0x0d8b('0x2d')][_0x0d8b('0x2c')][_0x0d8b('0x2b')];return openIssue(_0x50ec1e[_0x0d8b('0x2a')],_0x4f0a1a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a4f3451..eee3e9e 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 _0x9cdb=['delete','destroy','multer','util','express','Router','../../components/auth/service','get','isAuthenticated','/describe','describe','post','create','put','/:id','update'];(function(_0x1d2bc8,_0x2860bc){var _0x1857e1=function(_0x3a3073){while(--_0x3a3073){_0x1d2bc8['push'](_0x1d2bc8['shift']());}};_0x1857e1(++_0x2860bc);}(_0x9cdb,0x142));var _0xb9cd=function(_0x57e51,_0x27de3a){_0x57e51=_0x57e51-0x0;var _0x17c798=_0x9cdb[_0x57e51];return _0x17c798;};'use strict';var multer=require(_0xb9cd('0x0'));var util=require(_0xb9cd('0x1'));var path=require('path');var express=require(_0xb9cd('0x2'));var router=express[_0xb9cd('0x3')]();var auth=require(_0xb9cd('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyAnswerReport.controller');router[_0xb9cd('0x5')]('/',auth[_0xb9cd('0x6')](),controller['index']);router[_0xb9cd('0x5')](_0xb9cd('0x7'),auth['isAuthenticated'](),controller[_0xb9cd('0x8')]);router['get']('/:id',auth[_0xb9cd('0x6')](),controller['show']);router[_0xb9cd('0x9')]('/',auth[_0xb9cd('0x6')](),controller[_0xb9cd('0xa')]);router[_0xb9cd('0xb')](_0xb9cd('0xc'),auth['isAuthenticated'](),controller[_0xb9cd('0xd')]);router[_0xb9cd('0xe')](_0xb9cd('0xc'),auth[_0xb9cd('0x6')](),controller[_0xb9cd('0xf')]);module['exports']=router; \ No newline at end of file +var _0xed3e=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','post','put'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xed3e,0xe8));var _0xeed3=function(_0x9278f5,_0xa3afdf){_0x9278f5=_0x9278f5-0x0;var _0x486601=_0xed3e[_0x9278f5];return _0x486601;};'use strict';var multer=require(_0xeed3('0x0'));var util=require(_0xeed3('0x1'));var path=require(_0xeed3('0x2'));var express=require(_0xeed3('0x3'));var router=express[_0xeed3('0x4')]();var auth=require(_0xeed3('0x5'));var interaction=require(_0xeed3('0x6'));var config=require(_0xeed3('0x7'));var controller=require('./jscriptyAnswerReport.controller');router['get']('/',auth[_0xeed3('0x8')](),controller['index']);router[_0xeed3('0x9')](_0xeed3('0xa'),auth['isAuthenticated'](),controller[_0xeed3('0xb')]);router[_0xeed3('0x9')](_0xeed3('0xc'),auth[_0xeed3('0x8')](),controller['show']);router[_0xeed3('0xd')]('/',auth[_0xeed3('0x8')](),controller['create']);router[_0xeed3('0xe')](_0xeed3('0xc'),auth[_0xeed3('0x8')](),controller[_0xeed3('0xf')]);router[_0xeed3('0x10')](_0xeed3('0xc'),auth['isAuthenticated'](),controller[_0xeed3('0x11')]);module[_0xeed3('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index d34a358..060c4d0 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 _0xfbac=['STRING','TEXT','long','exports'];(function(_0x54081b,_0x1e291c){var _0x36a5ee=function(_0x27f865){while(--_0x27f865){_0x54081b['push'](_0x54081b['shift']());}};_0x36a5ee(++_0x1e291c);}(_0xfbac,0x167));var _0xcfba=function(_0x42f0a4,_0x3e3c2a){_0x42f0a4=_0x42f0a4-0x0;var _0x4aa7e3=_0xfbac[_0x42f0a4];return _0x4aa7e3;};'use strict';var Sequelize=require('sequelize');module[_0xcfba('0x0')]={'question':{'type':Sequelize[_0xcfba('0x1')]},'answer':{'type':Sequelize[_0xcfba('0x2')](_0xcfba('0x3'))},'membername':{'type':Sequelize[_0xcfba('0x1')]},'projectname':{'type':Sequelize[_0xcfba('0x1')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcfba('0x1')]},'calleridnum':{'type':Sequelize[_0xcfba('0x1')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8aa7=['TEXT','long','exports','STRING'];(function(_0x5f3f68,_0x46967f){var _0xf03920=function(_0x2088e8){while(--_0x2088e8){_0x5f3f68['push'](_0x5f3f68['shift']());}};_0xf03920(++_0x46967f);}(_0x8aa7,0xb6));var _0x78aa=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x8aa7[_0x40bffc];return _0x3007e9;};'use strict';var Sequelize=require('sequelize');module[_0x78aa('0x0')]={'question':{'type':Sequelize[_0x78aa('0x1')]},'answer':{'type':Sequelize[_0x78aa('0x2')](_0x78aa('0x3'))},'membername':{'type':Sequelize[_0x78aa('0x1')]},'projectname':{'type':Sequelize[_0x78aa('0x1')]},'queue':{'type':Sequelize[_0x78aa('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x78aa('0x1')]},'calleridnum':{'type':Sequelize[_0x78aa('0x1')]},'questionId':{'type':Sequelize[_0x78aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index a1ef530..eacf7f2 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 _0x8dab=['limit','set','Content-Range','apply','save','update','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','add','day','merge','filter','map','options','then','includeAll','include','findAll','catch','show','params','find','create','body','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset'];(function(_0x585e3e,_0x15b4c1){var _0x3240cd=function(_0x1991b3){while(--_0x1991b3){_0x585e3e['push'](_0x585e3e['shift']());}};_0x3240cd(++_0x15b4c1);}(_0x8dab,0x13d));var _0xb8da=function(_0x28a465,_0x558c2c){_0x28a465=_0x28a465-0x0;var _0x258386=_0x8dab[_0x28a465];return _0x258386;};'use strict';var jsonpatch=require(_0xb8da('0x0'));var rp=require(_0xb8da('0x1'));var moment=require('moment');var BPromise=require(_0xb8da('0x2'));var Mustache=require('mustache');var util=require(_0xb8da('0x3'));var path=require(_0xb8da('0x4'));var sox=require(_0xb8da('0x5'));var csv=require(_0xb8da('0x6'));var ejs=require(_0xb8da('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb8da('0x8'));var crypto=require(_0xb8da('0x9'));var jsforce=require(_0xb8da('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8da('0xb'));var Papa=require(_0xb8da('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xb8da('0xd'))(_0xb8da('0xe'));var utils=require(_0xb8da('0xf'));var config=require(_0xb8da('0x10'));var db=require(_0xb8da('0x11'))['db'];function respondWithStatusCode(_0x187fe7,_0x50c0f1){_0x50c0f1=_0x50c0f1||0xcc;return function(_0xe8791d){if(_0xe8791d){return _0x187fe7[_0xb8da('0x12')](_0x50c0f1);}return _0x187fe7[_0xb8da('0x13')](_0x50c0f1)['end']();};}function respondWithResult(_0x10910b,_0x22810d){_0x22810d=_0x22810d||0xc8;return function(_0x4e1e3c){if(_0x4e1e3c){return _0x10910b[_0xb8da('0x13')](_0x22810d)[_0xb8da('0x14')](_0x4e1e3c);}};}function respondWithFilteredResult(_0x227d9a,_0x4ef506){return function(_0x130328){if(_0x130328){var _0xde7f7c=_0x130328[_0xb8da('0x15')],_0x1e9fbc=_0x4ef506['offset'],_0x491baa=_0x4ef506[_0xb8da('0x16')]+_0x4ef506[_0xb8da('0x17')],_0x3447dd;if(_0x491baa>=_0xde7f7c){_0x491baa=_0xde7f7c;_0x3447dd=0xc8;}else{_0x3447dd=0xce;}_0x227d9a[_0xb8da('0x13')](_0x3447dd);return _0x227d9a[_0xb8da('0x18')](_0xb8da('0x19'),_0x1e9fbc+'-'+_0x491baa+'/'+_0xde7f7c)[_0xb8da('0x14')](_0x130328);}return null;};}function patchUpdates(_0x4ddb5d){return function(_0x4cadde){try{jsonpatch[_0xb8da('0x1a')](_0x4cadde,_0x4ddb5d,!![]);}catch(_0x26eb60){return BPromise['reject'](_0x26eb60);}return _0x4cadde[_0xb8da('0x1b')]();};}function saveUpdates(_0x565e06,_0x54e4fa){return function(_0x38dd3b){if(_0x38dd3b){return _0x38dd3b[_0xb8da('0x1c')](_0x565e06)['then'](function(_0x47c71a){return _0x47c71a;});}return null;};}function removeEntity(_0x43c810,_0x11be13){return function(_0x19679f){if(_0x19679f){return _0x19679f[_0xb8da('0x1d')]()['then'](function(){_0x43c810[_0xb8da('0x13')](0xcc)[_0xb8da('0x1e')]();});}};}function handleEntityNotFound(_0x1460b6,_0x9d95c1){return function(_0x23f454){if(!_0x23f454){_0x1460b6[_0xb8da('0x12')](0x194);}return _0x23f454;};}function handleError(_0x2894d9,_0x53e9b4){_0x53e9b4=_0x53e9b4||0x1f4;return function(_0x4ced17){logger[_0xb8da('0x1f')](_0x4ced17[_0xb8da('0x20')]);if(_0x4ced17[_0xb8da('0x21')]){delete _0x4ced17[_0xb8da('0x21')];}_0x2894d9['status'](_0x53e9b4)[_0xb8da('0x22')](_0x4ced17);};}exports[_0xb8da('0x23')]=function(_0x1236aa,_0x4ad039){var _0x42d6d8={},_0x3f1368={},_0x51cb58={'count':0x0,'rows':[]};var _0x2e558e=db[_0xb8da('0x24')][_0xb8da('0x25')];_0x3f1368[_0xb8da('0x26')]=_[_0xb8da('0x27')](_0x2e558e);var _0x1e39bc={'dateStart':_0x1236aa[_0xb8da('0x28')]['dateStart'],'dateEnd':_0x1236aa[_0xb8da('0x28')][_0xb8da('0x29')]};delete _0x1236aa[_0xb8da('0x28')][_0xb8da('0x2a')];delete _0x1236aa['query'][_0xb8da('0x29')];_0x3f1368[_0xb8da('0x28')]=_['keys'](_0x1236aa[_0xb8da('0x28')]);_0x3f1368[_0xb8da('0x2b')]=_[_0xb8da('0x2c')](_0x3f1368['model'],_0x3f1368[_0xb8da('0x28')]);_0x42d6d8[_0xb8da('0x2d')]=_[_0xb8da('0x2c')](_0x3f1368[_0xb8da('0x26')],qs[_0xb8da('0x2e')](_0x1236aa[_0xb8da('0x28')][_0xb8da('0x2e')]));_0x42d6d8['attributes']=_0x42d6d8[_0xb8da('0x2d')][_0xb8da('0x2f')]?_0x42d6d8[_0xb8da('0x2d')]:_0x3f1368[_0xb8da('0x26')];if(!_0x1236aa[_0xb8da('0x28')]['hasOwnProperty'](_0xb8da('0x30'))){_0x42d6d8['limit']=qs['limit'](_0x1236aa[_0xb8da('0x28')][_0xb8da('0x17')]);_0x42d6d8[_0xb8da('0x16')]=qs[_0xb8da('0x16')](_0x1236aa[_0xb8da('0x28')][_0xb8da('0x16')]);}_0x42d6d8['order']=qs[_0xb8da('0x31')](_0x1236aa[_0xb8da('0x28')][_0xb8da('0x31')]);_0x42d6d8[_0xb8da('0x32')]=qs[_0xb8da('0x2b')](_[_0xb8da('0x33')](_0x1236aa[_0xb8da('0x28')],_0x3f1368[_0xb8da('0x2b')]));if(_0x1e39bc[_0xb8da('0x2a')]){if(_0x1e39bc[_0xb8da('0x29')]){_0x1e39bc[_0xb8da('0x29')]=moment(_0x1e39bc[_0xb8da('0x29')])[_0xb8da('0x34')](0x1,_0xb8da('0x35'));}else{_0x1e39bc[_0xb8da('0x29')]=moment(_0x1e39bc[_0xb8da('0x2a')])[_0xb8da('0x34')](0x1,_0xb8da('0x35'));}_[_0xb8da('0x36')](_0x42d6d8[_0xb8da('0x32')],{'createdAt':{'$gte':_0x1e39bc[_0xb8da('0x2a')],'$lte':_0x1e39bc[_0xb8da('0x29')]}});}if(_0x1236aa[_0xb8da('0x28')][_0xb8da('0x37')]){_0x42d6d8['where']=_[_0xb8da('0x36')](_0x42d6d8[_0xb8da('0x32')],{'$or':_[_0xb8da('0x38')](_0x42d6d8[_0xb8da('0x2d')],function(_0x135c97){var _0x4447d9={};_0x4447d9[_0x135c97]={'$like':'%'+_0x1236aa['query'][_0xb8da('0x37')]+'%'};return _0x4447d9;})});}_0x42d6d8=_['merge']({},_0x42d6d8,_0x1236aa[_0xb8da('0x39')]);var _0x324c98={'where':_0x42d6d8[_0xb8da('0x32')]};return db[_0xb8da('0x24')]['count'](_0x324c98)[_0xb8da('0x3a')](function(_0x4920bb){_0x51cb58[_0xb8da('0x15')]=_0x4920bb;if(_0x1236aa[_0xb8da('0x28')][_0xb8da('0x3b')]){_0x42d6d8[_0xb8da('0x3c')]=[{'all':!![]}];}return db[_0xb8da('0x24')][_0xb8da('0x3d')](_0x42d6d8);})[_0xb8da('0x3a')](function(_0x4786e5){_0x51cb58['rows']=_0x4786e5;return _0x51cb58;})[_0xb8da('0x3a')](respondWithFilteredResult(_0x4ad039,_0x42d6d8))[_0xb8da('0x3e')](handleError(_0x4ad039,null));};exports[_0xb8da('0x3f')]=function(_0x5bee20,_0x539b3c){var _0x70a43a={'raw':!![],'where':{'id':_0x5bee20[_0xb8da('0x40')]['id']}},_0x58528f={};_0x58528f[_0xb8da('0x26')]=_[_0xb8da('0x27')](db[_0xb8da('0x24')]['rawAttributes']);_0x58528f[_0xb8da('0x28')]=_[_0xb8da('0x27')](_0x5bee20['query']);_0x58528f[_0xb8da('0x2b')]=_[_0xb8da('0x2c')](_0x58528f[_0xb8da('0x26')],_0x58528f[_0xb8da('0x28')]);_0x70a43a[_0xb8da('0x2d')]=_[_0xb8da('0x2c')](_0x58528f[_0xb8da('0x26')],qs[_0xb8da('0x2e')](_0x5bee20[_0xb8da('0x28')][_0xb8da('0x2e')]));_0x70a43a[_0xb8da('0x2d')]=_0x70a43a[_0xb8da('0x2d')]['length']?_0x70a43a[_0xb8da('0x2d')]:_0x58528f[_0xb8da('0x26')];if(_0x5bee20[_0xb8da('0x28')]['includeAll']){_0x70a43a[_0xb8da('0x3c')]=[{'all':!![]}];}_0x70a43a=_['merge']({},_0x70a43a,_0x5bee20[_0xb8da('0x39')]);return db['JscriptyAnswerReport'][_0xb8da('0x41')](_0x70a43a)[_0xb8da('0x3a')](handleEntityNotFound(_0x539b3c,null))['then'](respondWithResult(_0x539b3c,null))[_0xb8da('0x3e')](handleError(_0x539b3c,null));};exports[_0xb8da('0x42')]=function(_0x57c2a6,_0x5d53f6){return db['JscriptyAnswerReport'][_0xb8da('0x42')](_0x57c2a6[_0xb8da('0x43')],{})[_0xb8da('0x3a')](respondWithResult(_0x5d53f6,0xc9))['catch'](handleError(_0x5d53f6,null));};exports[_0xb8da('0x1c')]=function(_0x846f9,_0x13e8e4){if(_0x846f9[_0xb8da('0x43')]['id']){delete _0x846f9['body']['id'];}return db[_0xb8da('0x24')][_0xb8da('0x41')]({'where':{'id':_0x846f9[_0xb8da('0x40')]['id']}})[_0xb8da('0x3a')](handleEntityNotFound(_0x13e8e4,null))[_0xb8da('0x3a')](saveUpdates(_0x846f9[_0xb8da('0x43')],null))['then'](respondWithResult(_0x13e8e4,null))[_0xb8da('0x3e')](handleError(_0x13e8e4,null));};exports[_0xb8da('0x1d')]=function(_0xf25908,_0x262b63){return db[_0xb8da('0x24')]['find']({'where':{'id':_0xf25908[_0xb8da('0x40')]['id']}})[_0xb8da('0x3a')](handleEntityNotFound(_0x262b63,null))[_0xb8da('0x3a')](removeEntity(_0x262b63,null))[_0xb8da('0x3e')](handleError(_0x262b63,null));};exports['describe']=function(_0xf709e9,_0x15e7f8){return db[_0xb8da('0x24')]['describe']()[_0xb8da('0x3a')](respondWithResult(_0x15e7f8,null))[_0xb8da('0x3e')](handleError(_0x15e7f8,null));}; \ No newline at end of file +var _0x7c4f=['apply','reject','save','update','then','sendStatus','error','stack','send','index','JscriptyAnswerReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','day','merge','where','map','options','includeAll','include','findAll','rows','show','params','find','catch','body','fast-json-patch','request-promise','moment','bluebird','ejs','lodash','squel','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','set','Content-Range'];(function(_0x5a650b,_0x3d26e7){var _0x1ad832=function(_0x31a923){while(--_0x31a923){_0x5a650b['push'](_0x5a650b['shift']());}};_0x1ad832(++_0x3d26e7);}(_0x7c4f,0x1e3));var _0xf7c4=function(_0x510250,_0x1b2593){_0x510250=_0x510250-0x0;var _0x5d39e8=_0x7c4f[_0x510250];return _0x5d39e8;};'use strict';var jsonpatch=require(_0xf7c4('0x0'));var rp=require(_0xf7c4('0x1'));var moment=require(_0xf7c4('0x2'));var BPromise=require(_0xf7c4('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf7c4('0x4'));var fs=require('fs');var _=require(_0xf7c4('0x5'));var squel=require(_0xf7c4('0x6'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf7c4('0x7'));var toCsv=require(_0xf7c4('0x8'));var querystring=require('querystring');var Papa=require(_0xf7c4('0x9'));var qs=require(_0xf7c4('0xa'));var logger=require(_0xf7c4('0xb'))(_0xf7c4('0xc'));var utils=require(_0xf7c4('0xd'));var config=require(_0xf7c4('0xe'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d5fb2,_0xaccb40){_0xaccb40=_0xaccb40||0xcc;return function(_0x2cf8de){if(_0x2cf8de){return _0x1d5fb2['sendStatus'](_0xaccb40);}return _0x1d5fb2[_0xf7c4('0xf')](_0xaccb40)[_0xf7c4('0x10')]();};}function respondWithResult(_0x2981db,_0x54286c){_0x54286c=_0x54286c||0xc8;return function(_0x3bf4e7){if(_0x3bf4e7){return _0x2981db[_0xf7c4('0xf')](_0x54286c)[_0xf7c4('0x11')](_0x3bf4e7);}};}function respondWithFilteredResult(_0x455d5c,_0x34724d){return function(_0x54dfef){if(_0x54dfef){var _0x47a70e=_0x54dfef['count'],_0x197dfd=_0x34724d['offset'],_0x5ef8af=_0x34724d[_0xf7c4('0x12')]+_0x34724d['limit'],_0xf60b3e;if(_0x5ef8af>=_0x47a70e){_0x5ef8af=_0x47a70e;_0xf60b3e=0xc8;}else{_0xf60b3e=0xce;}_0x455d5c[_0xf7c4('0xf')](_0xf60b3e);return _0x455d5c[_0xf7c4('0x13')](_0xf7c4('0x14'),_0x197dfd+'-'+_0x5ef8af+'/'+_0x47a70e)[_0xf7c4('0x11')](_0x54dfef);}return null;};}function patchUpdates(_0x3e3cd2){return function(_0x40f792){try{jsonpatch[_0xf7c4('0x15')](_0x40f792,_0x3e3cd2,!![]);}catch(_0x5da783){return BPromise[_0xf7c4('0x16')](_0x5da783);}return _0x40f792[_0xf7c4('0x17')]();};}function saveUpdates(_0x132d99,_0x3d337e){return function(_0x2cb206){if(_0x2cb206){return _0x2cb206[_0xf7c4('0x18')](_0x132d99)[_0xf7c4('0x19')](function(_0x24d37a){return _0x24d37a;});}return null;};}function removeEntity(_0x33dafd,_0x559a91){return function(_0x415bbd){if(_0x415bbd){return _0x415bbd['destroy']()['then'](function(){_0x33dafd[_0xf7c4('0xf')](0xcc)[_0xf7c4('0x10')]();});}};}function handleEntityNotFound(_0x4f3d71,_0xe70c1a){return function(_0x5b78d7){if(!_0x5b78d7){_0x4f3d71[_0xf7c4('0x1a')](0x194);}return _0x5b78d7;};}function handleError(_0x4c8b7b,_0x11140b){_0x11140b=_0x11140b||0x1f4;return function(_0x56483c){logger[_0xf7c4('0x1b')](_0x56483c[_0xf7c4('0x1c')]);if(_0x56483c['name']){delete _0x56483c['name'];}_0x4c8b7b[_0xf7c4('0xf')](_0x11140b)[_0xf7c4('0x1d')](_0x56483c);};}exports[_0xf7c4('0x1e')]=function(_0x5bef82,_0x31658f){var _0x3f253d={},_0x1ee71a={},_0x4b8eb0={'count':0x0,'rows':[]};var _0x599aa4=db[_0xf7c4('0x1f')][_0xf7c4('0x20')];_0x1ee71a[_0xf7c4('0x21')]=_[_0xf7c4('0x22')](_0x599aa4);var _0x47440a={'dateStart':_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x24')],'dateEnd':_0x5bef82[_0xf7c4('0x23')]['dateEnd']};delete _0x5bef82[_0xf7c4('0x23')]['dateStart'];delete _0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x25')];_0x1ee71a['query']=_[_0xf7c4('0x22')](_0x5bef82['query']);_0x1ee71a[_0xf7c4('0x26')]=_['intersection'](_0x1ee71a[_0xf7c4('0x21')],_0x1ee71a[_0xf7c4('0x23')]);_0x3f253d[_0xf7c4('0x27')]=_[_0xf7c4('0x28')](_0x1ee71a[_0xf7c4('0x21')],qs['fields'](_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x29')]));_0x3f253d[_0xf7c4('0x27')]=_0x3f253d[_0xf7c4('0x27')][_0xf7c4('0x2a')]?_0x3f253d[_0xf7c4('0x27')]:_0x1ee71a['model'];if(!_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x2b')](_0xf7c4('0x2c'))){_0x3f253d[_0xf7c4('0x2d')]=qs[_0xf7c4('0x2d')](_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x2d')]);_0x3f253d[_0xf7c4('0x12')]=qs['offset'](_0x5bef82['query']['offset']);}_0x3f253d[_0xf7c4('0x2e')]=qs[_0xf7c4('0x2f')](_0x5bef82[_0xf7c4('0x23')]['sort']);_0x3f253d['where']=qs['filters'](_[_0xf7c4('0x30')](_0x5bef82[_0xf7c4('0x23')],_0x1ee71a[_0xf7c4('0x26')]));if(_0x47440a[_0xf7c4('0x24')]){if(_0x47440a[_0xf7c4('0x25')]){_0x47440a['dateEnd']=moment(_0x47440a[_0xf7c4('0x25')])['add'](0x1,_0xf7c4('0x31'));}else{_0x47440a[_0xf7c4('0x25')]=moment(_0x47440a[_0xf7c4('0x24')])['add'](0x1,_0xf7c4('0x31'));}_[_0xf7c4('0x32')](_0x3f253d[_0xf7c4('0x33')],{'createdAt':{'$gte':_0x47440a[_0xf7c4('0x24')],'$lte':_0x47440a[_0xf7c4('0x25')]}});}if(_0x5bef82[_0xf7c4('0x23')]['filter']){_0x3f253d['where']=_[_0xf7c4('0x32')](_0x3f253d[_0xf7c4('0x33')],{'$or':_[_0xf7c4('0x34')](_0x3f253d['attributes'],function(_0x4f708c){var _0x231895={};_0x231895[_0x4f708c]={'$like':'%'+_0x5bef82['query']['filter']+'%'};return _0x231895;})});}_0x3f253d=_['merge']({},_0x3f253d,_0x5bef82[_0xf7c4('0x35')]);var _0xf4b7bf={'where':_0x3f253d['where']};return db[_0xf7c4('0x1f')]['count'](_0xf4b7bf)[_0xf7c4('0x19')](function(_0x37abc2){_0x4b8eb0['count']=_0x37abc2;if(_0x5bef82[_0xf7c4('0x23')][_0xf7c4('0x36')]){_0x3f253d[_0xf7c4('0x37')]=[{'all':!![]}];}return db[_0xf7c4('0x1f')][_0xf7c4('0x38')](_0x3f253d);})['then'](function(_0x26bdc2){_0x4b8eb0[_0xf7c4('0x39')]=_0x26bdc2;return _0x4b8eb0;})['then'](respondWithFilteredResult(_0x31658f,_0x3f253d))['catch'](handleError(_0x31658f,null));};exports[_0xf7c4('0x3a')]=function(_0x14cfcb,_0x36076c){var _0x189208={'raw':!![],'where':{'id':_0x14cfcb[_0xf7c4('0x3b')]['id']}},_0x1d1edc={};_0x1d1edc['model']=_[_0xf7c4('0x22')](db[_0xf7c4('0x1f')][_0xf7c4('0x20')]);_0x1d1edc[_0xf7c4('0x23')]=_[_0xf7c4('0x22')](_0x14cfcb[_0xf7c4('0x23')]);_0x1d1edc[_0xf7c4('0x26')]=_[_0xf7c4('0x28')](_0x1d1edc[_0xf7c4('0x21')],_0x1d1edc[_0xf7c4('0x23')]);_0x189208[_0xf7c4('0x27')]=_[_0xf7c4('0x28')](_0x1d1edc[_0xf7c4('0x21')],qs['fields'](_0x14cfcb[_0xf7c4('0x23')]['fields']));_0x189208[_0xf7c4('0x27')]=_0x189208['attributes'][_0xf7c4('0x2a')]?_0x189208['attributes']:_0x1d1edc[_0xf7c4('0x21')];if(_0x14cfcb[_0xf7c4('0x23')][_0xf7c4('0x36')]){_0x189208[_0xf7c4('0x37')]=[{'all':!![]}];}_0x189208=_['merge']({},_0x189208,_0x14cfcb[_0xf7c4('0x35')]);return db[_0xf7c4('0x1f')][_0xf7c4('0x3c')](_0x189208)[_0xf7c4('0x19')](handleEntityNotFound(_0x36076c,null))['then'](respondWithResult(_0x36076c,null))[_0xf7c4('0x3d')](handleError(_0x36076c,null));};exports['create']=function(_0x3d73c0,_0x5357c8){return db['JscriptyAnswerReport']['create'](_0x3d73c0[_0xf7c4('0x3e')],{})[_0xf7c4('0x19')](respondWithResult(_0x5357c8,0xc9))[_0xf7c4('0x3d')](handleError(_0x5357c8,null));};exports[_0xf7c4('0x18')]=function(_0x98a6d1,_0x28ae65){if(_0x98a6d1[_0xf7c4('0x3e')]['id']){delete _0x98a6d1[_0xf7c4('0x3e')]['id'];}return db[_0xf7c4('0x1f')]['find']({'where':{'id':_0x98a6d1[_0xf7c4('0x3b')]['id']}})['then'](handleEntityNotFound(_0x28ae65,null))[_0xf7c4('0x19')](saveUpdates(_0x98a6d1['body'],null))['then'](respondWithResult(_0x28ae65,null))[_0xf7c4('0x3d')](handleError(_0x28ae65,null));};exports['destroy']=function(_0x56e649,_0x45b9ec){return db['JscriptyAnswerReport'][_0xf7c4('0x3c')]({'where':{'id':_0x56e649[_0xf7c4('0x3b')]['id']}})[_0xf7c4('0x19')](handleEntityNotFound(_0x45b9ec,null))[_0xf7c4('0x19')](removeEntity(_0x45b9ec,null))[_0xf7c4('0x3d')](handleError(_0x45b9ec,null));};exports['describe']=function(_0x132683,_0x30ee39){return db[_0xf7c4('0x1f')]['describe']()[_0xf7c4('0x19')](respondWithResult(_0x30ee39,null))[_0xf7c4('0x3d')](handleError(_0x30ee39,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 35996a4..3d181f6 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 _0xcc4e=['lodash','util','api','moment','bluebird','request-promise','exports'];(function(_0x28d7cb,_0x1fe6e1){var _0x13e192=function(_0x3be433){while(--_0x3be433){_0x28d7cb['push'](_0x28d7cb['shift']());}};_0x13e192(++_0x1fe6e1);}(_0xcc4e,0x118));var _0xecc4=function(_0x418807,_0x3ac103){_0x418807=_0x418807-0x0;var _0x12b596=_0xcc4e[_0x418807];return _0x12b596;};'use strict';var _=require(_0xecc4('0x0'));var util=require(_0xecc4('0x1'));var logger=require('../../config/logger')(_0xecc4('0x2'));var moment=require(_0xecc4('0x3'));var BPromise=require(_0xecc4('0x4'));var rp=require(_0xecc4('0x5'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xecc4('0x6')]=function(_0x1dce5b,_0x178f88){return _0x1dce5b['define']('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9955=['./jscriptyAnswerReport.attributes','JscriptyAnswerReport','report_jscripty_answers','api','moment','bluebird','request-promise'];(function(_0x31cea9,_0x4dbaf5){var _0x485fa2=function(_0x2851c4){while(--_0x2851c4){_0x31cea9['push'](_0x31cea9['shift']());}};_0x485fa2(++_0x4dbaf5);}(_0x9955,0x16f));var _0x5995=function(_0x5d04c1,_0x351817){_0x5d04c1=_0x5d04c1-0x0;var _0x3b1771=_0x9955[_0x5d04c1];return _0x3b1771;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5995('0x0'));var moment=require(_0x5995('0x1'));var BPromise=require(_0x5995('0x2'));var rp=require(_0x5995('0x3'));var attributes=require(_0x5995('0x4'));module['exports']=function(_0x60ed71,_0x294745){return _0x60ed71['define'](_0x5995('0x5'),attributes,{'tableName':_0x5995('0x6'),'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 69e63f2..87d56a0 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 _0x41dd=['error','message','result','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x41dd,0x17f));var _0xd41d=function(_0x3f50ff,_0x4c0545){_0x3f50ff=_0x3f50ff-0x0;var _0x7a792d=_0x41dd[_0x3f50ff];return _0x7a792d;};'use strict';var _=require(_0xd41d('0x0'));var util=require(_0xd41d('0x1'));var moment=require(_0xd41d('0x2'));var BPromise=require(_0xd41d('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd41d('0x4'));var logger=require(_0xd41d('0x5'))(_0xd41d('0x6'));var config=require(_0xd41d('0x7'));var jayson=require(_0xd41d('0x8'));var client=jayson[_0xd41d('0x9')][_0xd41d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf09935,_0xfae0e,_0x3295df){return new BPromise(function(_0x42f86c,_0x2d1dca){return client[_0xd41d('0xb')](_0xf09935,_0x3295df)[_0xd41d('0xc')](function(_0x29b9b9){logger[_0xd41d('0xd')](_0xd41d('0xe'),_0xfae0e,_0xd41d('0xf'));logger['debug']('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0xfae0e,_0xd41d('0xf'),JSON[_0xd41d('0x10')](_0x29b9b9));if(_0x29b9b9[_0xd41d('0x11')]){if(_0x29b9b9['error']['code']===0x1f4){logger[_0xd41d('0x11')](_0xd41d('0xe'),_0xfae0e,_0x29b9b9[_0xd41d('0x11')]['message']);return _0x2d1dca(_0x29b9b9['error'][_0xd41d('0x12')]);}logger[_0xd41d('0x11')](_0xd41d('0xe'),_0xfae0e,_0x29b9b9['error'][_0xd41d('0x12')]);return _0x42f86c(_0x29b9b9[_0xd41d('0x11')]['message']);}else{logger['info'](_0xd41d('0xe'),_0xfae0e,'request\x20sent');_0x42f86c(_0x29b9b9[_0xd41d('0x13')][_0xd41d('0x12')]);}})['catch'](function(_0xcf8995){logger[_0xd41d('0x11')](_0xd41d('0xe'),_0xfae0e,_0xcf8995);_0x2d1dca(_0xcf8995);});});} \ No newline at end of file +var _0xe484=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x346e28,_0x3f22ba){var _0x23df8c=function(_0x3bed59){while(--_0x3bed59){_0x346e28['push'](_0x346e28['shift']());}};_0x23df8c(++_0x3f22ba);}(_0xe484,0x181));var _0x4e48=function(_0x52a321,_0x1916ce){_0x52a321=_0x52a321-0x0;var _0x49b178=_0xe484[_0x52a321];return _0x49b178;};'use strict';var _=require(_0x4e48('0x0'));var util=require(_0x4e48('0x1'));var moment=require(_0x4e48('0x2'));var BPromise=require(_0x4e48('0x3'));var rs=require(_0x4e48('0x4'));var fs=require('fs');var db=require(_0x4e48('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e48('0x6'));var config=require(_0x4e48('0x7'));var jayson=require(_0x4e48('0x8'));var client=jayson['client'][_0x4e48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a3fe,_0x22333c,_0x4da0df){return new BPromise(function(_0x2ad51a,_0x22b2c4){return client[_0x4e48('0xa')](_0x27a3fe,_0x4da0df)[_0x4e48('0xb')](function(_0x23cef2){logger[_0x4e48('0xc')](_0x4e48('0xd'),_0x22333c,_0x4e48('0xe'));logger[_0x4e48('0xf')](_0x4e48('0x10'),_0x22333c,_0x4e48('0xe'),JSON[_0x4e48('0x11')](_0x23cef2));if(_0x23cef2[_0x4e48('0x12')]){if(_0x23cef2['error'][_0x4e48('0x13')]===0x1f4){logger[_0x4e48('0x12')](_0x4e48('0xd'),_0x22333c,_0x23cef2[_0x4e48('0x12')][_0x4e48('0x14')]);return _0x22b2c4(_0x23cef2[_0x4e48('0x12')][_0x4e48('0x14')]);}logger['error'](_0x4e48('0xd'),_0x22333c,_0x23cef2['error'][_0x4e48('0x14')]);return _0x2ad51a(_0x23cef2['error'][_0x4e48('0x14')]);}else{logger['info'](_0x4e48('0xd'),_0x22333c,_0x4e48('0xe'));_0x2ad51a(_0x23cef2[_0x4e48('0x15')][_0x4e48('0x14')]);}})['catch'](function(_0x29b49e){logger[_0x4e48('0x12')](_0x4e48('0xd'),_0x22333c,_0x29b49e);_0x22b2c4(_0x29b49e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0233e35..1399c02 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 _0x7a54=['path','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getAnswers','/:id/summary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer','util'];(function(_0x54876e,_0x20f5e1){var _0x9d0a08=function(_0x2f92ea){while(--_0x2f92ea){_0x54876e['push'](_0x54876e['shift']());}};_0x9d0a08(++_0x20f5e1);}(_0x7a54,0x106));var _0x47a5=function(_0xe99ab,_0x9100ad){_0xe99ab=_0xe99ab-0x0;var _0x43b7b0=_0x7a54[_0xe99ab];return _0x43b7b0;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id/sessions',auth[_0x47a5('0x8')](),controller['getSessions']);router['get']('/:id/answers',auth[_0x47a5('0x8')](),controller[_0x47a5('0xc')]);router['get'](_0x47a5('0xd'),auth['isAuthenticated'](),controller['getSummary']);router[_0x47a5('0xe')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0xf')]);router[_0x47a5('0xe')](_0x47a5('0x10'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x11')]);router['put'](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x13')](_0x47a5('0xa'),auth[_0x47a5('0x8')](),controller[_0x47a5('0x14')]);module[_0x47a5('0x15')]=router; \ No newline at end of file +var _0x6f47=['exports','util','path','Router','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','/:id/summary','post','create','/:id/clone','clone','put','update','delete'];(function(_0x428a5e,_0x37c2ef){var _0x453253=function(_0x399f1b){while(--_0x399f1b){_0x428a5e['push'](_0x428a5e['shift']());}};_0x453253(++_0x37c2ef);}(_0x6f47,0xc7));var _0x76f4=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x6f47[_0x2a6809];return _0x11c371;};'use strict';var multer=require('multer');var util=require(_0x76f4('0x0'));var path=require(_0x76f4('0x1'));var express=require('express');var router=express[_0x76f4('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x76f4('0x3'));var config=require('../../config/environment');var controller=require(_0x76f4('0x4'));router[_0x76f4('0x5')]('/',auth[_0x76f4('0x6')](),controller[_0x76f4('0x7')]);router['get'](_0x76f4('0x8'),auth[_0x76f4('0x6')](),controller[_0x76f4('0x9')]);router['get'](_0x76f4('0xa'),auth[_0x76f4('0x6')](),controller[_0x76f4('0xb')]);router[_0x76f4('0x5')](_0x76f4('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x76f4('0x5')](_0x76f4('0xd'),auth['isAuthenticated'](),controller['getSummary']);router[_0x76f4('0xe')]('/',auth[_0x76f4('0x6')](),controller[_0x76f4('0xf')]);router[_0x76f4('0xe')](_0x76f4('0x10'),auth[_0x76f4('0x6')](),controller[_0x76f4('0x11')]);router[_0x76f4('0x12')](_0x76f4('0x8'),auth['isAuthenticated'](),controller[_0x76f4('0x13')]);router[_0x76f4('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x76f4('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7370638..e673cd5 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 _0xd2d6=['setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash','util','exports','STRING','name','TEXT','long','formData','stringify'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xd2d6,0xac));var _0x6d2d=function(_0x2d95e7,_0x554e79){_0x2d95e7=_0x2d95e7-0x0;var _0x81fcdc=_0xd2d6[_0x2d95e7];return _0x81fcdc;};'use strict';var Sequelize=require(_0x6d2d('0x0'));var _=require(_0x6d2d('0x1'));var util=require(_0x6d2d('0x2'));module[_0x6d2d('0x3')]={'name':{'type':Sequelize[_0x6d2d('0x4')],'unique':_0x6d2d('0x5')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x6d2d('0x6')](_0x6d2d('0x7')),'set':function(_0x1d8561){if(_['isObjectLike'](_0x1d8561)){this['setDataValue'](_0x6d2d('0x8'),JSON[_0x6d2d('0x9')](_0x1d8561));}else if(_['isString'](_0x1d8561)){this[_0x6d2d('0xa')]('formData',_0x1d8561);}else{this[_0x6d2d('0xa')](_0x6d2d('0x8'),util['format'](_0x6d2d('0xb'),this[_0x6d2d('0xc')]('name')||'',this[_0x6d2d('0xc')](_0x6d2d('0xd'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x4797=['TEXT','isObjectLike','setDataValue','formData','isString','format','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','name'];(function(_0x2bfc39,_0x53718e){var _0x43fed3=function(_0x23845e){while(--_0x23845e){_0x2bfc39['push'](_0x2bfc39['shift']());}};_0x43fed3(++_0x53718e);}(_0x4797,0x1c9));var _0x7479=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4797[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7479('0x0'));var _=require(_0x7479('0x1'));var util=require(_0x7479('0x2'));module[_0x7479('0x3')]={'name':{'type':Sequelize['STRING'],'unique':_0x7479('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x7479('0x5')]('long'),'set':function(_0x4b5425){if(_[_0x7479('0x6')](_0x4b5425)){this[_0x7479('0x7')](_0x7479('0x8'),JSON['stringify'](_0x4b5425));}else if(_[_0x7479('0x9')](_0x4b5425)){this[_0x7479('0x7')]('formData',_0x4b5425);}else{this[_0x7479('0x7')](_0x7479('0x8'),util[_0x7479('0xa')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x7479('0xb')]('name')||'',this[_0x7479('0xb')](_0x7479('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7479('0xd')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 00c4726..49890a6 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 _0x86d2=['omit','createdAt','updatedAt','getSessions','findOne','hasOwnProperty','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','push','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Jscripty_Project_%d_Summary_%s.csv','setHeader','text/csv','download','fast-json-patch','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','stack','name','send','JscriptyProject','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','day','add','filter','map','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','clone','get'];(function(_0x424262,_0x4337ae){var _0x191c89=function(_0x947ada){while(--_0x947ada){_0x424262['push'](_0x424262['shift']());}};_0x191c89(++_0x4337ae);}(_0x86d2,0xe2));var _0x286d=function(_0x1e3bdd,_0x413a8e){_0x1e3bdd=_0x1e3bdd-0x0;var _0x2153e8=_0x86d2[_0x1e3bdd];return _0x2153e8;};'use strict';var jsonpatch=require(_0x286d('0x0'));var rp=require('request-promise');var moment=require(_0x286d('0x1'));var BPromise=require(_0x286d('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x286d('0x3'));var sox=require(_0x286d('0x4'));var csv=require(_0x286d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x286d('0x6'));var squel=require(_0x286d('0x7'));var crypto=require(_0x286d('0x8'));var jsforce=require(_0x286d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x286d('0x5'));var querystring=require(_0x286d('0xa'));var Papa=require(_0x286d('0xb'));var qs=require(_0x286d('0xc'));var logger=require(_0x286d('0xd'))(_0x286d('0xe'));var utils=require(_0x286d('0xf'));var config=require(_0x286d('0x10'));var db=require(_0x286d('0x11'))['db'];function respondWithStatusCode(_0x8cace7,_0x558689){_0x558689=_0x558689||0xcc;return function(_0x305eb0){if(_0x305eb0){return _0x8cace7['sendStatus'](_0x558689);}return _0x8cace7[_0x286d('0x12')](_0x558689)[_0x286d('0x13')]();};}function respondWithResult(_0x520430,_0x54f48c){_0x54f48c=_0x54f48c||0xc8;return function(_0x1839c4){if(_0x1839c4){return _0x520430[_0x286d('0x12')](_0x54f48c)['json'](_0x1839c4);}};}function respondWithFilteredResult(_0x282e87,_0x18f36f){return function(_0x157dcb){if(_0x157dcb){var _0x212af6=_0x157dcb[_0x286d('0x14')],_0x1b166a=_0x18f36f[_0x286d('0x15')],_0x2567a9=_0x18f36f[_0x286d('0x15')]+_0x18f36f[_0x286d('0x16')],_0x4726f5;if(_0x2567a9>=_0x212af6){_0x2567a9=_0x212af6;_0x4726f5=0xc8;}else{_0x4726f5=0xce;}_0x282e87[_0x286d('0x12')](_0x4726f5);return _0x282e87[_0x286d('0x17')](_0x286d('0x18'),_0x1b166a+'-'+_0x2567a9+'/'+_0x212af6)[_0x286d('0x19')](_0x157dcb);}return null;};}function patchUpdates(_0x4716fe){return function(_0x2d41db){try{jsonpatch[_0x286d('0x1a')](_0x2d41db,_0x4716fe,!![]);}catch(_0x37f738){return BPromise['reject'](_0x37f738);}return _0x2d41db['save']();};}function saveUpdates(_0x3b5f3b,_0x22aadf){return function(_0x293701){if(_0x293701){return _0x293701[_0x286d('0x1b')](_0x3b5f3b)[_0x286d('0x1c')](function(_0x30957e){return _0x30957e;});}return null;};}function removeEntity(_0x577965,_0x530a85){return function(_0x4d218b){if(_0x4d218b){return _0x4d218b[_0x286d('0x1d')]()[_0x286d('0x1c')](function(){_0x577965[_0x286d('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ab034,_0x5cf001){return function(_0x58d5ad){if(!_0x58d5ad){_0x5ab034['sendStatus'](0x194);}return _0x58d5ad;};}function handleError(_0x352f93,_0x430107){_0x430107=_0x430107||0x1f4;return function(_0x4f80fe){logger['error'](_0x4f80fe[_0x286d('0x1e')]);if(_0x4f80fe[_0x286d('0x1f')]){delete _0x4f80fe[_0x286d('0x1f')];}_0x352f93[_0x286d('0x12')](_0x430107)[_0x286d('0x20')](_0x4f80fe);};}exports['index']=function(_0x554c6e,_0x2723d0){var _0x1eff59={},_0x44e7ef={},_0x349657={'count':0x0,'rows':[]};var _0x50c2ba=db[_0x286d('0x21')][_0x286d('0x22')];_0x44e7ef[_0x286d('0x23')]=_[_0x286d('0x24')](_0x50c2ba);var _0x7d4e01={'dateStart':_0x554c6e[_0x286d('0x25')][_0x286d('0x26')],'dateEnd':_0x554c6e[_0x286d('0x25')][_0x286d('0x27')]};delete _0x554c6e[_0x286d('0x25')][_0x286d('0x26')];delete _0x554c6e['query'][_0x286d('0x27')];_0x44e7ef['query']=_[_0x286d('0x24')](_0x554c6e[_0x286d('0x25')]);_0x44e7ef[_0x286d('0x28')]=_['intersection'](_0x44e7ef['model'],_0x44e7ef[_0x286d('0x25')]);_0x1eff59[_0x286d('0x29')]=_[_0x286d('0x2a')](_0x44e7ef['model'],qs[_0x286d('0x2b')](_0x554c6e[_0x286d('0x25')][_0x286d('0x2b')]));_0x1eff59[_0x286d('0x29')]=_0x1eff59[_0x286d('0x29')][_0x286d('0x2c')]?_0x1eff59[_0x286d('0x29')]:_0x44e7ef['model'];if(!_0x554c6e[_0x286d('0x25')]['hasOwnProperty'](_0x286d('0x2d'))){_0x1eff59[_0x286d('0x16')]=qs[_0x286d('0x16')](_0x554c6e['query'][_0x286d('0x16')]);_0x1eff59[_0x286d('0x15')]=qs['offset'](_0x554c6e[_0x286d('0x25')][_0x286d('0x15')]);}_0x1eff59[_0x286d('0x2e')]=qs[_0x286d('0x2f')](_0x554c6e[_0x286d('0x25')][_0x286d('0x2f')]);_0x1eff59[_0x286d('0x30')]=qs[_0x286d('0x28')](_[_0x286d('0x31')](_0x554c6e[_0x286d('0x25')],_0x44e7ef[_0x286d('0x28')]));if(_0x7d4e01['dateStart']){if(_0x7d4e01[_0x286d('0x27')]){_0x7d4e01[_0x286d('0x27')]=moment(_0x7d4e01['dateEnd'])['add'](0x1,_0x286d('0x32'));}else{_0x7d4e01[_0x286d('0x27')]=moment(_0x7d4e01[_0x286d('0x26')])[_0x286d('0x33')](0x1,'day');}_['merge'](_0x1eff59['where'],{'createdAt':{'$gte':_0x7d4e01['dateStart'],'$lte':_0x7d4e01[_0x286d('0x27')]}});}if(_0x554c6e[_0x286d('0x25')][_0x286d('0x34')]){_0x1eff59[_0x286d('0x30')]=_['merge'](_0x1eff59[_0x286d('0x30')],{'$or':_[_0x286d('0x35')](_0x1eff59[_0x286d('0x29')],function(_0x55783a){var _0x3596eb={};_0x3596eb[_0x55783a]={'$like':'%'+_0x554c6e['query']['filter']+'%'};return _0x3596eb;})});}_0x1eff59=_['merge']({},_0x1eff59,_0x554c6e[_0x286d('0x36')]);var _0x370f6b={'where':_0x1eff59['where']};return db[_0x286d('0x21')][_0x286d('0x14')](_0x370f6b)['then'](function(_0x17375f){_0x349657[_0x286d('0x14')]=_0x17375f;if(_0x554c6e[_0x286d('0x25')][_0x286d('0x37')]){_0x1eff59[_0x286d('0x38')]=[{'all':!![]}];}return db[_0x286d('0x21')][_0x286d('0x39')](_0x1eff59);})['then'](function(_0x5ad112){_0x349657[_0x286d('0x3a')]=_0x5ad112;return _0x349657;})['then'](respondWithFilteredResult(_0x2723d0,_0x1eff59))[_0x286d('0x3b')](handleError(_0x2723d0,null));};exports[_0x286d('0x3c')]=function(_0x3f9902,_0x1cc002){var _0x480e9b={'raw':![],'where':{'id':_0x3f9902[_0x286d('0x3d')]['id']}},_0x545faa={};_0x545faa[_0x286d('0x23')]=_[_0x286d('0x24')](db[_0x286d('0x21')][_0x286d('0x22')]);_0x545faa[_0x286d('0x25')]=_['keys'](_0x3f9902['query']);_0x545faa[_0x286d('0x28')]=_[_0x286d('0x2a')](_0x545faa['model'],_0x545faa[_0x286d('0x25')]);_0x480e9b['attributes']=_[_0x286d('0x2a')](_0x545faa[_0x286d('0x23')],qs[_0x286d('0x2b')](_0x3f9902[_0x286d('0x25')][_0x286d('0x2b')]));_0x480e9b[_0x286d('0x29')]=_0x480e9b[_0x286d('0x29')][_0x286d('0x2c')]?_0x480e9b['attributes']:_0x545faa['model'];if(_0x3f9902[_0x286d('0x25')][_0x286d('0x37')]){_0x480e9b[_0x286d('0x38')]=[{'all':!![]}];}_0x480e9b=_[_0x286d('0x3e')]({},_0x480e9b,_0x3f9902[_0x286d('0x36')]);return db[_0x286d('0x21')][_0x286d('0x3f')](_0x480e9b)[_0x286d('0x1c')](handleEntityNotFound(_0x1cc002,null))['then'](respondWithResult(_0x1cc002,null))['catch'](handleError(_0x1cc002,null));};exports[_0x286d('0x40')]=function(_0x201d72,_0x2a7182){return db[_0x286d('0x21')][_0x286d('0x40')](_0x201d72[_0x286d('0x41')],{})[_0x286d('0x1c')](respondWithResult(_0x2a7182,0xc9))['catch'](handleError(_0x2a7182,null));};exports[_0x286d('0x42')]=function(_0x1974a8,_0x1872ad){var _0xbbffb5={'raw':![],'where':{'id':_0x1974a8[_0x286d('0x3d')]['id']}},_0x27aa9b={};_0x27aa9b['model']=_[_0x286d('0x24')](db[_0x286d('0x21')]['rawAttributes']);_0xbbffb5[_0x286d('0x29')]=_[_0x286d('0x2a')](_0x27aa9b['model'],qs['fields'](_0x1974a8[_0x286d('0x25')][_0x286d('0x2b')]));_0xbbffb5[_0x286d('0x29')]=_0xbbffb5[_0x286d('0x29')][_0x286d('0x2c')]?_0xbbffb5[_0x286d('0x29')]:_0x27aa9b[_0x286d('0x23')];if(_0x1974a8['query'][_0x286d('0x37')]){_0xbbffb5[_0x286d('0x38')]=[{'all':!![]}];}_0xbbffb5=_[_0x286d('0x3e')]({},_0xbbffb5,_0x1974a8['options']);return db[_0x286d('0x21')]['find'](_0xbbffb5)['then'](handleEntityNotFound(_0x1872ad,null))[_0x286d('0x1c')](function(_0x1a5d08){if(_0x1a5d08){var _0x57d219=_0x1a5d08[_0x286d('0x43')]({'plain':!![]});_0x57d219=qs[_0x286d('0x44')](_0x57d219,['id',_0x286d('0x45'),_0x286d('0x46')]);_0x1974a8['body']=_[_0x286d('0x44')](_0x1974a8[_0x286d('0x41')],['id','createdAt',_0x286d('0x46')]);return db[_0x286d('0x21')][_0x286d('0x40')](_[_0x286d('0x3e')](_0x57d219,_0x1974a8[_0x286d('0x41')]),{'include':_0x1974a8['query'][_0x286d('0x37')]?[{'all':!![]}]:undefined});}})[_0x286d('0x1c')](respondWithResult(_0x1872ad,0xc9))[_0x286d('0x3b')](handleError(_0x1872ad,null));};exports['update']=function(_0x280d90,_0x4327c9){if(_0x280d90[_0x286d('0x41')]['id']){delete _0x280d90[_0x286d('0x41')]['id'];}return db[_0x286d('0x21')][_0x286d('0x3f')]({'where':{'id':_0x280d90[_0x286d('0x3d')]['id']}})[_0x286d('0x1c')](handleEntityNotFound(_0x4327c9,null))[_0x286d('0x1c')](saveUpdates(_0x280d90[_0x286d('0x41')],null))['then'](respondWithResult(_0x4327c9,null))[_0x286d('0x3b')](handleError(_0x4327c9,null));};exports[_0x286d('0x1d')]=function(_0x307456,_0x4f1c0c){return db[_0x286d('0x21')]['find']({'where':{'id':_0x307456['params']['id']}})['then'](handleEntityNotFound(_0x4f1c0c,null))[_0x286d('0x1c')](removeEntity(_0x4f1c0c,null))[_0x286d('0x3b')](handleError(_0x4f1c0c,null));};exports[_0x286d('0x47')]=function(_0x189c2c,_0x3a37d3,_0x4bb2d8){var _0x183873={'raw':!![],'where':{}};var _0x37c737={};var _0x3fc50f={'count':0x0,'rows':[]};return db[_0x286d('0x21')][_0x286d('0x48')]({'where':{'id':_0x189c2c[_0x286d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3a37d3,null))[_0x286d('0x1c')](function(_0x33b2be){if(_0x33b2be){_0x37c737['model']=_[_0x286d('0x24')](db['JscriptySessionReport'][_0x286d('0x22')]);_0x37c737['query']=_[_0x286d('0x24')](_0x189c2c[_0x286d('0x25')]);_0x37c737['filters']=_[_0x286d('0x2a')](_0x37c737[_0x286d('0x23')],_0x37c737[_0x286d('0x25')]);_0x183873[_0x286d('0x29')]=_[_0x286d('0x2a')](_0x37c737['model'],qs[_0x286d('0x2b')](_0x189c2c[_0x286d('0x25')][_0x286d('0x2b')]));_0x183873[_0x286d('0x29')]=_0x183873[_0x286d('0x29')]['length']?_0x183873[_0x286d('0x29')]:_0x37c737[_0x286d('0x23')];if(!_0x189c2c['query'][_0x286d('0x49')](_0x286d('0x2d'))){_0x183873[_0x286d('0x16')]=qs[_0x286d('0x16')](_0x189c2c[_0x286d('0x25')][_0x286d('0x16')]);_0x183873[_0x286d('0x15')]=qs[_0x286d('0x15')](_0x189c2c[_0x286d('0x25')]['offset']);}_0x183873['order']=qs[_0x286d('0x2f')](_0x189c2c['query'][_0x286d('0x2f')]);_0x183873[_0x286d('0x30')]=qs['filters'](_[_0x286d('0x31')](_0x189c2c[_0x286d('0x25')],_0x37c737[_0x286d('0x28')]));_0x183873['where'][_0x286d('0x4a')]=_0x33b2be['id'];if(_0x189c2c[_0x286d('0x25')][_0x286d('0x34')]){_0x183873[_0x286d('0x30')]=_[_0x286d('0x3e')](_0x183873[_0x286d('0x30')],{'$or':_[_0x286d('0x35')](_0x183873[_0x286d('0x29')],function(_0x21c627){var _0x12e5fb={};_0x12e5fb[_0x21c627]={'$like':'%'+_0x189c2c[_0x286d('0x25')]['filter']+'%'};return _0x12e5fb;})});}_0x183873=_[_0x286d('0x3e')]({},_0x183873,_0x189c2c[_0x286d('0x36')]);return db[_0x286d('0x4b')][_0x286d('0x14')]({'where':_0x183873[_0x286d('0x30')]})[_0x286d('0x1c')](function(_0x511266){_0x3fc50f[_0x286d('0x14')]=_0x511266;if(_0x189c2c[_0x286d('0x25')]['includeAll']){_0x183873['include']=[{'all':!![]}];}return db[_0x286d('0x4b')][_0x286d('0x39')](_0x183873);})[_0x286d('0x1c')](function(_0x3b8726){_0x3fc50f['rows']=_0x3b8726;return _0x3fc50f;});}})[_0x286d('0x1c')](respondWithFilteredResult(_0x3a37d3,_0x183873))[_0x286d('0x3b')](handleError(_0x3a37d3,null));};exports[_0x286d('0x4c')]=function(_0x15a90e,_0x5bf750,_0x453959){var _0x34c9e8={'raw':!![],'where':{}};var _0x435704={};var _0x50e5fc={'count':0x0,'rows':[]};var _0x516f12={'dateStart':_0x15a90e[_0x286d('0x25')][_0x286d('0x26')],'dateEnd':_0x15a90e[_0x286d('0x25')][_0x286d('0x27')]};delete _0x15a90e[_0x286d('0x25')][_0x286d('0x26')];delete _0x15a90e[_0x286d('0x25')][_0x286d('0x27')];return db[_0x286d('0x21')][_0x286d('0x48')]({'where':{'id':_0x15a90e['params']['id']}})['then'](handleEntityNotFound(_0x5bf750,null))[_0x286d('0x1c')](function(_0x4102db){if(_0x4102db){_0x435704['model']=_[_0x286d('0x24')](db[_0x286d('0x4d')][_0x286d('0x22')]);_0x435704[_0x286d('0x25')]=_[_0x286d('0x24')](_0x15a90e[_0x286d('0x25')]);_0x435704[_0x286d('0x28')]=_[_0x286d('0x2a')](_0x435704[_0x286d('0x23')],_0x435704[_0x286d('0x25')]);_0x34c9e8[_0x286d('0x29')]=_[_0x286d('0x2a')](_0x435704[_0x286d('0x23')],qs[_0x286d('0x2b')](_0x15a90e[_0x286d('0x25')]['fields']));_0x34c9e8['attributes']=_0x34c9e8[_0x286d('0x29')][_0x286d('0x2c')]?_0x34c9e8[_0x286d('0x29')]:_0x435704[_0x286d('0x23')];if(!_0x15a90e['query'][_0x286d('0x49')](_0x286d('0x2d'))){_0x34c9e8[_0x286d('0x16')]=qs[_0x286d('0x16')](_0x15a90e[_0x286d('0x25')][_0x286d('0x16')]);_0x34c9e8[_0x286d('0x15')]=qs['offset'](_0x15a90e['query'][_0x286d('0x15')]);}_0x34c9e8[_0x286d('0x2e')]=qs[_0x286d('0x2f')](_0x15a90e[_0x286d('0x25')][_0x286d('0x2f')]);_0x34c9e8[_0x286d('0x30')]=qs['filters'](_[_0x286d('0x31')](_0x15a90e[_0x286d('0x25')],_0x435704['filters']));_0x34c9e8[_0x286d('0x30')]['ProjectId']=_0x4102db['id'];if(_0x516f12[_0x286d('0x26')]){if(_0x516f12[_0x286d('0x27')]){_0x516f12[_0x286d('0x27')]=moment(_0x516f12[_0x286d('0x27')])[_0x286d('0x33')](0x1,_0x286d('0x32'));}else{_0x516f12[_0x286d('0x27')]=moment(_0x516f12['dateStart'])[_0x286d('0x33')](0x1,_0x286d('0x32'));}_['merge'](_0x34c9e8[_0x286d('0x30')],{'createdAt':{'$gte':_0x516f12['dateStart'],'$lte':_0x516f12[_0x286d('0x27')]}});}if(_0x15a90e[_0x286d('0x25')][_0x286d('0x34')]){_0x34c9e8[_0x286d('0x30')]=_[_0x286d('0x3e')](_0x34c9e8['where'],{'$or':_[_0x286d('0x35')](_0x34c9e8[_0x286d('0x29')],function(_0x47f86a){var _0x1416ff={};_0x1416ff[_0x47f86a]={'$like':'%'+_0x15a90e[_0x286d('0x25')][_0x286d('0x34')]+'%'};return _0x1416ff;})});}_0x34c9e8=_[_0x286d('0x3e')]({},_0x34c9e8,_0x15a90e['options']);return db[_0x286d('0x4d')][_0x286d('0x14')]({'where':_0x34c9e8['where']})[_0x286d('0x1c')](function(_0x3041f2){_0x50e5fc['count']=_0x3041f2;if(_0x15a90e['query'][_0x286d('0x37')]){_0x34c9e8[_0x286d('0x38')]=[{'all':!![]}];}return db[_0x286d('0x4d')][_0x286d('0x39')](_0x34c9e8);})[_0x286d('0x1c')](function(_0x27e187){_0x50e5fc[_0x286d('0x3a')]=_0x27e187;return _0x50e5fc;});}})[_0x286d('0x1c')](respondWithFilteredResult(_0x5bf750,_0x34c9e8))['catch'](handleError(_0x5bf750,null));};function char(_0x35fdfe){return _0x286d('0x4e')===typeof _0x35fdfe?String[_0x286d('0x4f')][_0x286d('0x1a')](null,arguments):_0x35fdfe;}function needsEncapsulation(_0x329f18){return!!_0x329f18&&(_0x329f18[_0x286d('0x50')]()[_0x286d('0x51')](char(0xd))>=0x0||_0x329f18[_0x286d('0x50')]()['indexOf'](char(0xa))>=0x0||_0x329f18[_0x286d('0x50')]()[_0x286d('0x51')](char(0x2c))>=0x0||_0x329f18[_0x286d('0x50')]()[_0x286d('0x51')](char(0x22))>=0x0);}function encapsulate(_0x3c6509){var _0x6d474d=char(0x22),_0x69e96b='\x5c'+char(0x22),_0x58fd8f=_0x3c6509[_0x286d('0x50')]()[_0x286d('0x52')](new RegExp(_0x6d474d,'g'),_0x69e96b);return _0x6d474d+_0x58fd8f+_0x6d474d;}exports[_0x286d('0x53')]=function(_0xef0462,_0x3cd0cd,_0x6af3){var _0x5e2bd7,_0x1c54a6;var _0x3c57bc={'dateStart':_0xef0462[_0x286d('0x25')][_0x286d('0x26')],'dateEnd':_0xef0462[_0x286d('0x25')][_0x286d('0x27')]};delete _0xef0462[_0x286d('0x25')]['dateStart'];delete _0xef0462['query'][_0x286d('0x27')];if(_0x3c57bc[_0x286d('0x26')]){if(_0x3c57bc[_0x286d('0x27')]){_0x3c57bc[_0x286d('0x27')]=moment(_0x3c57bc[_0x286d('0x27')])[_0x286d('0x33')](0x1,_0x286d('0x32'));}else{_0x3c57bc[_0x286d('0x27')]=moment(_0x3c57bc[_0x286d('0x26')])[_0x286d('0x33')](0x1,_0x286d('0x32'));}}return db[_0x286d('0x4b')]['findAll']({'where':{'ProjectId':_0xef0462[_0x286d('0x3d')]['id'],'starttime':{'$gte':_0x3c57bc[_0x286d('0x26')],'$lte':_0x3c57bc[_0x286d('0x27')]}}})[_0x286d('0x1c')](handleEntityNotFound(_0x3cd0cd,null))[_0x286d('0x1c')](function(_0x2de98a){if(_0x2de98a){_0x5e2bd7=_0x2de98a;return db[_0x286d('0x54')][_0x286d('0x39')]({'where':{'SessionId':{'$in':_[_0x286d('0x35')](_0x5e2bd7,'id')},'ProjectId':_0xef0462['params']['id']},'order':_0x286d('0x55')});}})['then'](handleEntityNotFound(_0x3cd0cd,null))[_0x286d('0x1c')](function(_0x3bc1c8){if(_0x3bc1c8){_0x1c54a6=_0x3bc1c8;var _0x3f0021={};for(var _0x5e911a=0x0,_0x4042c8=_0x1c54a6[_0x286d('0x2c')];_0x5e911a<_0x4042c8;_0x5e911a++){if(!_0x3f0021[_0x286d('0x49')](_0x1c54a6[_0x5e911a]['questionId'])){_0x3f0021[_0x1c54a6[_0x5e911a][_0x286d('0x56')]]=needsEncapsulation(_0x1c54a6[_0x5e911a]['question'])?encapsulate(_0x1c54a6[_0x5e911a][_0x286d('0x57')]):_0x1c54a6[_0x5e911a][_0x286d('0x57')];}}var _0x3fb312=[],_0x1fb430={};for(var _0x10522b=0x0,_0xd15e51=_0x5e2bd7[_0x286d('0x2c')];_0x10522b<_0xd15e51;_0x10522b++){_0x1fb430={'ProjectId':_0xef0462[_0x286d('0x3d')]['id'],'SessionId':_0x5e2bd7[_0x10522b]['id'],'StartTime':moment(_0x5e2bd7[_0x10522b]['starttime'])[_0x286d('0x58')](_0x286d('0x59'))};for(var _0x38dce6=0x0,_0x5d76bc=_0x1c54a6[_0x286d('0x2c')];_0x38dce6<_0x5d76bc;_0x38dce6++){if(_0x1c54a6[_0x38dce6][_0x286d('0x5a')]==_0x5e2bd7[_0x10522b]['id']&&_0x3f0021[_0x286d('0x49')](_0x1c54a6[_0x38dce6][_0x286d('0x56')])){_0x1fb430[_0x3f0021[_0x1c54a6[_0x38dce6][_0x286d('0x56')]]]=_0x1c54a6[_0x38dce6]['answer'];}}for(var _0x7581af in _0x3f0021){if(!_0x1fb430[_0x286d('0x49')](_0x3f0021[_0x7581af])){_0x1fb430[_0x3f0021[_0x7581af]]=null;}}_0x3fb312[_0x286d('0x5b')](_0x1fb430);}return _0x3fb312;}})[_0x286d('0x1c')](function(_0x4eb90d){if(!_['isEmpty'](_0x4eb90d)){var _0x2318af=toCsv(_0x4eb90d);var _0x1e1bc4=Date['now']();fs[_0x286d('0x5c')](util[_0x286d('0x58')](_0x286d('0x5d'),_0xef0462[_0x286d('0x3d')]['id'],_0x1e1bc4),_0x2318af);_0x3cd0cd['setHeader']('Content-disposition','attachment;\x20filename='+util[_0x286d('0x58')](_0x286d('0x5e'),_0xef0462[_0x286d('0x3d')]['id'],_0x1e1bc4));_0x3cd0cd[_0x286d('0x5f')]('Content-type',_0x286d('0x60'));return _0x3cd0cd[_0x286d('0x61')](util[_0x286d('0x58')](_0x286d('0x5d'),_0xef0462[_0x286d('0x3d')]['id'],_0x1e1bc4));}else{return _0x3cd0cd['sendStatus'](0xcc);}})['catch'](handleError(_0x3cd0cd,null));}; \ No newline at end of file +var _0x3b9a=['filter','map','options','JscriptyProject','count','includeAll','rows','catch','show','params','rawAttributes','find','create','body','clone','omit','createdAt','updatedAt','getSessions','JscriptySessionReport','ProjectId','include','getAnswers','JscriptyAnswerReport','findAll','toString','indexOf','replace','getSummary','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','text/csv','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','jsforce','desk.js','api','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','model','keys','query','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','dateEnd','add','day','merge','where'];(function(_0x2d0726,_0x8b5733){var _0x5aceea=function(_0x351c70){while(--_0x351c70){_0x2d0726['push'](_0x2d0726['shift']());}};_0x5aceea(++_0x8b5733);}(_0x3b9a,0x198));var _0xa3b9=function(_0x4a6992,_0x5d52ee){_0x4a6992=_0x4a6992-0x0;var _0x4c640a=_0x3b9a[_0x4a6992];return _0x4c640a;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa3b9('0x0'));var moment=require(_0xa3b9('0x1'));var BPromise=require(_0xa3b9('0x2'));var Mustache=require(_0xa3b9('0x3'));var util=require('util');var path=require('path');var sox=require(_0xa3b9('0x4'));var csv=require(_0xa3b9('0x5'));var ejs=require(_0xa3b9('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa3b9('0x7'));var crypto=require('crypto');var jsforce=require(_0xa3b9('0x8'));var deskjs=require(_0xa3b9('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xa3b9('0xa'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xa3b9('0xb'))['db'];function respondWithStatusCode(_0x5b3bf4,_0x566a03){_0x566a03=_0x566a03||0xcc;return function(_0x8a06e7){if(_0x8a06e7){return _0x5b3bf4[_0xa3b9('0xc')](_0x566a03);}return _0x5b3bf4[_0xa3b9('0xd')](_0x566a03)[_0xa3b9('0xe')]();};}function respondWithResult(_0x51a74b,_0x2452de){_0x2452de=_0x2452de||0xc8;return function(_0x36e8d2){if(_0x36e8d2){return _0x51a74b[_0xa3b9('0xd')](_0x2452de)[_0xa3b9('0xf')](_0x36e8d2);}};}function respondWithFilteredResult(_0x320980,_0x17b871){return function(_0x40f5e5){if(_0x40f5e5){var _0x314ba8=_0x40f5e5['count'],_0x571c30=_0x17b871[_0xa3b9('0x10')],_0x45263c=_0x17b871[_0xa3b9('0x10')]+_0x17b871[_0xa3b9('0x11')],_0x580516;if(_0x45263c>=_0x314ba8){_0x45263c=_0x314ba8;_0x580516=0xc8;}else{_0x580516=0xce;}_0x320980[_0xa3b9('0xd')](_0x580516);return _0x320980['set'](_0xa3b9('0x12'),_0x571c30+'-'+_0x45263c+'/'+_0x314ba8)[_0xa3b9('0xf')](_0x40f5e5);}return null;};}function patchUpdates(_0x54997f){return function(_0x7f5948){try{jsonpatch[_0xa3b9('0x13')](_0x7f5948,_0x54997f,!![]);}catch(_0x42f1e4){return BPromise[_0xa3b9('0x14')](_0x42f1e4);}return _0x7f5948[_0xa3b9('0x15')]();};}function saveUpdates(_0x59f460,_0x574d47){return function(_0x3cd616){if(_0x3cd616){return _0x3cd616[_0xa3b9('0x16')](_0x59f460)[_0xa3b9('0x17')](function(_0x1144fb){return _0x1144fb;});}return null;};}function removeEntity(_0x10a854,_0x3e0c55){return function(_0x2a9d46){if(_0x2a9d46){return _0x2a9d46[_0xa3b9('0x18')]()[_0xa3b9('0x17')](function(){_0x10a854[_0xa3b9('0xd')](0xcc)[_0xa3b9('0xe')]();});}};}function handleEntityNotFound(_0x351613,_0xf6f68b){return function(_0x8f8712){if(!_0x8f8712){_0x351613[_0xa3b9('0xc')](0x194);}return _0x8f8712;};}function handleError(_0x31e624,_0x5e62fa){_0x5e62fa=_0x5e62fa||0x1f4;return function(_0x2680f0){logger['error'](_0x2680f0[_0xa3b9('0x19')]);if(_0x2680f0[_0xa3b9('0x1a')]){delete _0x2680f0[_0xa3b9('0x1a')];}_0x31e624[_0xa3b9('0xd')](_0x5e62fa)['send'](_0x2680f0);};}exports[_0xa3b9('0x1b')]=function(_0x53a725,_0x35df78){var _0x5bad69={},_0x5767e2={},_0x578ab4={'count':0x0,'rows':[]};var _0xb4e701=db['JscriptyProject']['rawAttributes'];_0x5767e2[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](_0xb4e701);var _0x151be5={'dateStart':_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0x53a725[_0xa3b9('0x1e')]['dateEnd']};delete _0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x1f')];delete _0x53a725['query']['dateEnd'];_0x5767e2[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x53a725['query']);_0x5767e2[_0xa3b9('0x20')]=_['intersection'](_0x5767e2[_0xa3b9('0x1c')],_0x5767e2['query']);_0x5bad69['attributes']=_[_0xa3b9('0x21')](_0x5767e2[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x22')]));_0x5bad69[_0xa3b9('0x23')]=_0x5bad69[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x5bad69[_0xa3b9('0x23')]:_0x5767e2['model'];if(!_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x25')](_0xa3b9('0x26'))){_0x5bad69[_0xa3b9('0x11')]=qs[_0xa3b9('0x11')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x5bad69['offset']=qs[_0xa3b9('0x10')](_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x5bad69[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x53a725[_0xa3b9('0x1e')]['sort']);_0x5bad69['where']=qs[_0xa3b9('0x20')](_[_0xa3b9('0x29')](_0x53a725[_0xa3b9('0x1e')],_0x5767e2[_0xa3b9('0x20')]));if(_0x151be5[_0xa3b9('0x1f')]){if(_0x151be5[_0xa3b9('0x2a')]){_0x151be5[_0xa3b9('0x2a')]=moment(_0x151be5[_0xa3b9('0x2a')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}else{_0x151be5[_0xa3b9('0x2a')]=moment(_0x151be5[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}_[_0xa3b9('0x2d')](_0x5bad69[_0xa3b9('0x2e')],{'createdAt':{'$gte':_0x151be5[_0xa3b9('0x1f')],'$lte':_0x151be5[_0xa3b9('0x2a')]}});}if(_0x53a725['query'][_0xa3b9('0x2f')]){_0x5bad69[_0xa3b9('0x2e')]=_[_0xa3b9('0x2d')](_0x5bad69['where'],{'$or':_[_0xa3b9('0x30')](_0x5bad69[_0xa3b9('0x23')],function(_0x4360ce){var _0xa22d98={};_0xa22d98[_0x4360ce]={'$like':'%'+_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x2f')]+'%'};return _0xa22d98;})});}_0x5bad69=_[_0xa3b9('0x2d')]({},_0x5bad69,_0x53a725[_0xa3b9('0x31')]);var _0x135be9={'where':_0x5bad69[_0xa3b9('0x2e')]};return db[_0xa3b9('0x32')][_0xa3b9('0x33')](_0x135be9)['then'](function(_0x42b200){_0x578ab4[_0xa3b9('0x33')]=_0x42b200;if(_0x53a725[_0xa3b9('0x1e')][_0xa3b9('0x34')]){_0x5bad69['include']=[{'all':!![]}];}return db[_0xa3b9('0x32')]['findAll'](_0x5bad69);})[_0xa3b9('0x17')](function(_0x12b773){_0x578ab4[_0xa3b9('0x35')]=_0x12b773;return _0x578ab4;})[_0xa3b9('0x17')](respondWithFilteredResult(_0x35df78,_0x5bad69))[_0xa3b9('0x36')](handleError(_0x35df78,null));};exports[_0xa3b9('0x37')]=function(_0x4dcd67,_0xee6921){var _0x531ba9={'raw':![],'where':{'id':_0x4dcd67[_0xa3b9('0x38')]['id']}},_0x105782={};_0x105782[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x32')][_0xa3b9('0x39')]);_0x105782[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x4dcd67[_0xa3b9('0x1e')]);_0x105782[_0xa3b9('0x20')]=_[_0xa3b9('0x21')](_0x105782[_0xa3b9('0x1c')],_0x105782[_0xa3b9('0x1e')]);_0x531ba9['attributes']=_[_0xa3b9('0x21')](_0x105782['model'],qs['fields'](_0x4dcd67['query'][_0xa3b9('0x22')]));_0x531ba9[_0xa3b9('0x23')]=_0x531ba9[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x531ba9[_0xa3b9('0x23')]:_0x105782[_0xa3b9('0x1c')];if(_0x4dcd67['query'][_0xa3b9('0x34')]){_0x531ba9['include']=[{'all':!![]}];}_0x531ba9=_[_0xa3b9('0x2d')]({},_0x531ba9,_0x4dcd67[_0xa3b9('0x31')]);return db[_0xa3b9('0x32')][_0xa3b9('0x3a')](_0x531ba9)['then'](handleEntityNotFound(_0xee6921,null))[_0xa3b9('0x17')](respondWithResult(_0xee6921,null))[_0xa3b9('0x36')](handleError(_0xee6921,null));};exports['create']=function(_0x18583c,_0x32bdf1){return db['JscriptyProject'][_0xa3b9('0x3b')](_0x18583c[_0xa3b9('0x3c')],{})[_0xa3b9('0x17')](respondWithResult(_0x32bdf1,0xc9))[_0xa3b9('0x36')](handleError(_0x32bdf1,null));};exports[_0xa3b9('0x3d')]=function(_0x29a079,_0x2a102d){var _0x5b3311={'raw':![],'where':{'id':_0x29a079['params']['id']}},_0x3c68a4={};_0x3c68a4[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x32')][_0xa3b9('0x39')]);_0x5b3311['attributes']=_[_0xa3b9('0x21')](_0x3c68a4['model'],qs[_0xa3b9('0x22')](_0x29a079[_0xa3b9('0x1e')]['fields']));_0x5b3311[_0xa3b9('0x23')]=_0x5b3311[_0xa3b9('0x23')]['length']?_0x5b3311[_0xa3b9('0x23')]:_0x3c68a4[_0xa3b9('0x1c')];if(_0x29a079[_0xa3b9('0x1e')][_0xa3b9('0x34')]){_0x5b3311['include']=[{'all':!![]}];}_0x5b3311=_[_0xa3b9('0x2d')]({},_0x5b3311,_0x29a079[_0xa3b9('0x31')]);return db[_0xa3b9('0x32')][_0xa3b9('0x3a')](_0x5b3311)['then'](handleEntityNotFound(_0x2a102d,null))[_0xa3b9('0x17')](function(_0x5f207f){if(_0x5f207f){var _0x57da37=_0x5f207f['get']({'plain':!![]});_0x57da37=qs[_0xa3b9('0x3e')](_0x57da37,['id',_0xa3b9('0x3f'),'updatedAt']);_0x29a079[_0xa3b9('0x3c')]=_['omit'](_0x29a079[_0xa3b9('0x3c')],['id','createdAt',_0xa3b9('0x40')]);return db['JscriptyProject'][_0xa3b9('0x3b')](_[_0xa3b9('0x2d')](_0x57da37,_0x29a079['body']),{'include':_0x29a079[_0xa3b9('0x1e')][_0xa3b9('0x34')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x2a102d,0xc9))[_0xa3b9('0x36')](handleError(_0x2a102d,null));};exports[_0xa3b9('0x16')]=function(_0x285843,_0x306350){if(_0x285843[_0xa3b9('0x3c')]['id']){delete _0x285843[_0xa3b9('0x3c')]['id'];}return db[_0xa3b9('0x32')][_0xa3b9('0x3a')]({'where':{'id':_0x285843[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x306350,null))[_0xa3b9('0x17')](saveUpdates(_0x285843[_0xa3b9('0x3c')],null))[_0xa3b9('0x17')](respondWithResult(_0x306350,null))[_0xa3b9('0x36')](handleError(_0x306350,null));};exports['destroy']=function(_0x147d06,_0x36105f){return db[_0xa3b9('0x32')]['find']({'where':{'id':_0x147d06[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x36105f,null))[_0xa3b9('0x17')](removeEntity(_0x36105f,null))[_0xa3b9('0x36')](handleError(_0x36105f,null));};exports[_0xa3b9('0x41')]=function(_0x1a56e7,_0xa4c5b8,_0x4e5d69){var _0x1bc537={'raw':!![],'where':{}};var _0x5b1d03={};var _0x3d5fca={'count':0x0,'rows':[]};return db[_0xa3b9('0x32')]['findOne']({'where':{'id':_0x1a56e7[_0xa3b9('0x38')]['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0xa4c5b8,null))[_0xa3b9('0x17')](function(_0x4701a6){if(_0x4701a6){_0x5b1d03[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x42')]['rawAttributes']);_0x5b1d03['query']=_[_0xa3b9('0x1d')](_0x1a56e7[_0xa3b9('0x1e')]);_0x5b1d03[_0xa3b9('0x20')]=_['intersection'](_0x5b1d03[_0xa3b9('0x1c')],_0x5b1d03[_0xa3b9('0x1e')]);_0x1bc537[_0xa3b9('0x23')]=_[_0xa3b9('0x21')](_0x5b1d03[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x1a56e7[_0xa3b9('0x1e')]['fields']));_0x1bc537['attributes']=_0x1bc537[_0xa3b9('0x23')][_0xa3b9('0x24')]?_0x1bc537[_0xa3b9('0x23')]:_0x5b1d03[_0xa3b9('0x1c')];if(!_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x25')](_0xa3b9('0x26'))){_0x1bc537['limit']=qs[_0xa3b9('0x11')](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x1bc537[_0xa3b9('0x10')]=qs['offset'](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x1bc537[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x28')]);_0x1bc537[_0xa3b9('0x2e')]=qs['filters'](_['pick'](_0x1a56e7[_0xa3b9('0x1e')],_0x5b1d03[_0xa3b9('0x20')]));_0x1bc537[_0xa3b9('0x2e')][_0xa3b9('0x43')]=_0x4701a6['id'];if(_0x1a56e7['query'][_0xa3b9('0x2f')]){_0x1bc537[_0xa3b9('0x2e')]=_['merge'](_0x1bc537['where'],{'$or':_[_0xa3b9('0x30')](_0x1bc537['attributes'],function(_0x8656cc){var _0x32b8fc={};_0x32b8fc[_0x8656cc]={'$like':'%'+_0x1a56e7[_0xa3b9('0x1e')][_0xa3b9('0x2f')]+'%'};return _0x32b8fc;})});}_0x1bc537=_[_0xa3b9('0x2d')]({},_0x1bc537,_0x1a56e7[_0xa3b9('0x31')]);return db[_0xa3b9('0x42')][_0xa3b9('0x33')]({'where':_0x1bc537[_0xa3b9('0x2e')]})[_0xa3b9('0x17')](function(_0xbf61ac){_0x3d5fca[_0xa3b9('0x33')]=_0xbf61ac;if(_0x1a56e7['query'][_0xa3b9('0x34')]){_0x1bc537[_0xa3b9('0x44')]=[{'all':!![]}];}return db[_0xa3b9('0x42')]['findAll'](_0x1bc537);})[_0xa3b9('0x17')](function(_0x108133){_0x3d5fca[_0xa3b9('0x35')]=_0x108133;return _0x3d5fca;});}})[_0xa3b9('0x17')](respondWithFilteredResult(_0xa4c5b8,_0x1bc537))['catch'](handleError(_0xa4c5b8,null));};exports[_0xa3b9('0x45')]=function(_0x5ca225,_0x75a32b,_0x2c053b){var _0x4684dc={'raw':!![],'where':{}};var _0x485ed6={};var _0x1e773b={'count':0x0,'rows':[]};var _0x2a766f={'dateStart':_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x2a')]};delete _0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x1f')];delete _0x5ca225['query'][_0xa3b9('0x2a')];return db[_0xa3b9('0x32')]['findOne']({'where':{'id':_0x5ca225['params']['id']}})[_0xa3b9('0x17')](handleEntityNotFound(_0x75a32b,null))['then'](function(_0x5a92e5){if(_0x5a92e5){_0x485ed6[_0xa3b9('0x1c')]=_[_0xa3b9('0x1d')](db[_0xa3b9('0x46')]['rawAttributes']);_0x485ed6[_0xa3b9('0x1e')]=_[_0xa3b9('0x1d')](_0x5ca225[_0xa3b9('0x1e')]);_0x485ed6[_0xa3b9('0x20')]=_[_0xa3b9('0x21')](_0x485ed6[_0xa3b9('0x1c')],_0x485ed6[_0xa3b9('0x1e')]);_0x4684dc['attributes']=_[_0xa3b9('0x21')](_0x485ed6[_0xa3b9('0x1c')],qs[_0xa3b9('0x22')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x22')]));_0x4684dc['attributes']=_0x4684dc['attributes'][_0xa3b9('0x24')]?_0x4684dc['attributes']:_0x485ed6[_0xa3b9('0x1c')];if(!_0x5ca225[_0xa3b9('0x1e')]['hasOwnProperty'](_0xa3b9('0x26'))){_0x4684dc[_0xa3b9('0x11')]=qs[_0xa3b9('0x11')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x11')]);_0x4684dc[_0xa3b9('0x10')]=qs[_0xa3b9('0x10')](_0x5ca225[_0xa3b9('0x1e')][_0xa3b9('0x10')]);}_0x4684dc[_0xa3b9('0x27')]=qs[_0xa3b9('0x28')](_0x5ca225[_0xa3b9('0x1e')]['sort']);_0x4684dc[_0xa3b9('0x2e')]=qs['filters'](_[_0xa3b9('0x29')](_0x5ca225[_0xa3b9('0x1e')],_0x485ed6[_0xa3b9('0x20')]));_0x4684dc[_0xa3b9('0x2e')]['ProjectId']=_0x5a92e5['id'];if(_0x2a766f[_0xa3b9('0x1f')]){if(_0x2a766f[_0xa3b9('0x2a')]){_0x2a766f[_0xa3b9('0x2a')]=moment(_0x2a766f['dateEnd'])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}else{_0x2a766f[_0xa3b9('0x2a')]=moment(_0x2a766f[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}_[_0xa3b9('0x2d')](_0x4684dc[_0xa3b9('0x2e')],{'createdAt':{'$gte':_0x2a766f['dateStart'],'$lte':_0x2a766f[_0xa3b9('0x2a')]}});}if(_0x5ca225[_0xa3b9('0x1e')]['filter']){_0x4684dc[_0xa3b9('0x2e')]=_['merge'](_0x4684dc['where'],{'$or':_[_0xa3b9('0x30')](_0x4684dc[_0xa3b9('0x23')],function(_0x569b07){var _0x4f0894={};_0x4f0894[_0x569b07]={'$like':'%'+_0x5ca225[_0xa3b9('0x1e')]['filter']+'%'};return _0x4f0894;})});}_0x4684dc=_[_0xa3b9('0x2d')]({},_0x4684dc,_0x5ca225[_0xa3b9('0x31')]);return db[_0xa3b9('0x46')][_0xa3b9('0x33')]({'where':_0x4684dc[_0xa3b9('0x2e')]})[_0xa3b9('0x17')](function(_0x5d4a74){_0x1e773b['count']=_0x5d4a74;if(_0x5ca225['query'][_0xa3b9('0x34')]){_0x4684dc['include']=[{'all':!![]}];}return db[_0xa3b9('0x46')][_0xa3b9('0x47')](_0x4684dc);})[_0xa3b9('0x17')](function(_0x138904){_0x1e773b[_0xa3b9('0x35')]=_0x138904;return _0x1e773b;});}})[_0xa3b9('0x17')](respondWithFilteredResult(_0x75a32b,_0x4684dc))['catch'](handleError(_0x75a32b,null));};function char(_0x367a58){return'number'===typeof _0x367a58?String['fromCharCode']['apply'](null,arguments):_0x367a58;}function needsEncapsulation(_0x1b52c1){return!!_0x1b52c1&&(_0x1b52c1[_0xa3b9('0x48')]()['indexOf'](char(0xd))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()['indexOf'](char(0xa))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()[_0xa3b9('0x49')](char(0x2c))>=0x0||_0x1b52c1[_0xa3b9('0x48')]()[_0xa3b9('0x49')](char(0x22))>=0x0);}function encapsulate(_0x4aad36){var _0x525280=char(0x22),_0x4147ba='\x5c'+char(0x22),_0x4e6999=_0x4aad36[_0xa3b9('0x48')]()[_0xa3b9('0x4a')](new RegExp(_0x525280,'g'),_0x4147ba);return _0x525280+_0x4e6999+_0x525280;}exports[_0xa3b9('0x4b')]=function(_0xb3740b,_0x346a57,_0x5197ad){var _0x459a1a,_0x58fc00;var _0x34a599={'dateStart':_0xb3740b[_0xa3b9('0x1e')][_0xa3b9('0x1f')],'dateEnd':_0xb3740b[_0xa3b9('0x1e')][_0xa3b9('0x2a')]};delete _0xb3740b[_0xa3b9('0x1e')]['dateStart'];delete _0xb3740b[_0xa3b9('0x1e')]['dateEnd'];if(_0x34a599[_0xa3b9('0x1f')]){if(_0x34a599['dateEnd']){_0x34a599[_0xa3b9('0x2a')]=moment(_0x34a599[_0xa3b9('0x2a')])['add'](0x1,_0xa3b9('0x2c'));}else{_0x34a599[_0xa3b9('0x2a')]=moment(_0x34a599[_0xa3b9('0x1f')])[_0xa3b9('0x2b')](0x1,_0xa3b9('0x2c'));}}return db[_0xa3b9('0x42')]['findAll']({'where':{'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id'],'starttime':{'$gte':_0x34a599[_0xa3b9('0x1f')],'$lte':_0x34a599[_0xa3b9('0x2a')]}}})[_0xa3b9('0x17')](handleEntityNotFound(_0x346a57,null))[_0xa3b9('0x17')](function(_0x2ce5e5){if(_0x2ce5e5){_0x459a1a=_0x2ce5e5;return db[_0xa3b9('0x4c')]['findAll']({'where':{'SessionId':{'$in':_[_0xa3b9('0x30')](_0x459a1a,'id')},'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id']},'order':_0xa3b9('0x4d')});}})[_0xa3b9('0x17')](handleEntityNotFound(_0x346a57,null))[_0xa3b9('0x17')](function(_0x11f012){if(_0x11f012){_0x58fc00=_0x11f012;var _0x3066b5={};for(var _0x4c091f=0x0,_0x33bbde=_0x58fc00[_0xa3b9('0x24')];_0x4c091f<_0x33bbde;_0x4c091f++){if(!_0x3066b5[_0xa3b9('0x25')](_0x58fc00[_0x4c091f]['questionId'])){_0x3066b5[_0x58fc00[_0x4c091f][_0xa3b9('0x4e')]]=needsEncapsulation(_0x58fc00[_0x4c091f][_0xa3b9('0x4f')])?encapsulate(_0x58fc00[_0x4c091f][_0xa3b9('0x4f')]):_0x58fc00[_0x4c091f]['question'];}}var _0x15681c=[],_0x7627e3={};for(var _0x8883ff=0x0,_0xad740c=_0x459a1a[_0xa3b9('0x24')];_0x8883ff<_0xad740c;_0x8883ff++){_0x7627e3={'ProjectId':_0xb3740b[_0xa3b9('0x38')]['id'],'SessionId':_0x459a1a[_0x8883ff]['id'],'StartTime':moment(_0x459a1a[_0x8883ff][_0xa3b9('0x50')])[_0xa3b9('0x51')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x970f2c=0x0,_0x3c6037=_0x58fc00[_0xa3b9('0x24')];_0x970f2c<_0x3c6037;_0x970f2c++){if(_0x58fc00[_0x970f2c][_0xa3b9('0x52')]==_0x459a1a[_0x8883ff]['id']&&_0x3066b5[_0xa3b9('0x25')](_0x58fc00[_0x970f2c][_0xa3b9('0x4e')])){_0x7627e3[_0x3066b5[_0x58fc00[_0x970f2c]['questionId']]]=_0x58fc00[_0x970f2c][_0xa3b9('0x53')];}}for(var _0x250ed3 in _0x3066b5){if(!_0x7627e3['hasOwnProperty'](_0x3066b5[_0x250ed3])){_0x7627e3[_0x3066b5[_0x250ed3]]=null;}}_0x15681c[_0xa3b9('0x54')](_0x7627e3);}return _0x15681c;}})[_0xa3b9('0x17')](function(_0x251eb4){if(!_[_0xa3b9('0x55')](_0x251eb4)){var _0x13b564=toCsv(_0x251eb4);var _0x3f484c=Date['now']();fs[_0xa3b9('0x56')](util['format'](_0xa3b9('0x57'),_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c),_0x13b564);_0x346a57[_0xa3b9('0x58')]('Content-disposition',_0xa3b9('0x59')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c));_0x346a57['setHeader']('Content-type',_0xa3b9('0x5a'));return _0x346a57['download'](util['format'](_0xa3b9('0x57'),_0xb3740b[_0xa3b9('0x38')]['id'],_0x3f484c));}else{return _0x346a57[_0xa3b9('0xc')](0xcc);}})[_0xa3b9('0x36')](handleError(_0x346a57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 15da8fd..9ac7b66 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 _0xe44d=['request-promise','define','JscriptyProject','jscripty_projects','lodash','util','api'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe44d,0x138));var _0xde44=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe44d[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xde44('0x0'));var util=require(_0xde44('0x1'));var logger=require('../../config/logger')(_0xde44('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde44('0x3'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x57b24e,_0x2619ce){return _0x57b24e[_0xde44('0x4')](_0xde44('0x5'),attributes,{'tableName':_0xde44('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe68c=['jscripty_projects','lodash','util','api','bluebird','request-promise','./jscriptyProject.attributes','exports','JscriptyProject'];(function(_0x4c0f67,_0x4c121f){var _0x415340=function(_0x333f4e){while(--_0x333f4e){_0x4c0f67['push'](_0x4c0f67['shift']());}};_0x415340(++_0x4c121f);}(_0xe68c,0xfd));var _0xce68=function(_0x365c78,_0x23ab28){_0x365c78=_0x365c78-0x0;var _0x40d398=_0xe68c[_0x365c78];return _0x40d398;};'use strict';var _=require(_0xce68('0x0'));var util=require(_0xce68('0x1'));var logger=require('../../config/logger')(_0xce68('0x2'));var moment=require('moment');var BPromise=require(_0xce68('0x3'));var rp=require(_0xce68('0x4'));var attributes=require(_0xce68('0x5'));module[_0xce68('0x6')]=function(_0x472987,_0x3441bb){return _0x472987['define'](_0xce68('0x7'),attributes,{'tableName':_0xce68('0x8'),'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 edfcfe6..24367af 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 _0x7e31=['message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyProject,\x20%s,\x20%s'];(function(_0x1498dd,_0x3155dd){var _0x46b1a7=function(_0x2bfa78){while(--_0x2bfa78){_0x1498dd['push'](_0x1498dd['shift']());}};_0x46b1a7(++_0x3155dd);}(_0x7e31,0x1a7));var _0x17e3=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0x7e31[_0x3ab928];return _0xf47692;};'use strict';var _=require(_0x17e3('0x0'));var util=require(_0x17e3('0x1'));var moment=require(_0x17e3('0x2'));var BPromise=require(_0x17e3('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x17e3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x17e3('0x5'))(_0x17e3('0x6'));var config=require('../../config/environment');var jayson=require(_0x17e3('0x7'));var client=jayson[_0x17e3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eac02,_0x31ff4e,_0x59640c){return new BPromise(function(_0x863408,_0x321d36){return client[_0x17e3('0x9')](_0x4eac02,_0x59640c)['then'](function(_0xf41ba0){logger[_0x17e3('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x31ff4e,_0x17e3('0xb'));logger[_0x17e3('0xc')](_0x17e3('0xd'),_0x31ff4e,'request\x20sent',JSON[_0x17e3('0xe')](_0xf41ba0));if(_0xf41ba0[_0x17e3('0xf')]){if(_0xf41ba0[_0x17e3('0xf')][_0x17e3('0x10')]===0x1f4){logger[_0x17e3('0xf')](_0x17e3('0x11'),_0x31ff4e,_0xf41ba0[_0x17e3('0xf')]['message']);return _0x321d36(_0xf41ba0['error']['message']);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x31ff4e,_0xf41ba0[_0x17e3('0xf')][_0x17e3('0x12')]);return _0x863408(_0xf41ba0[_0x17e3('0xf')][_0x17e3('0x12')]);}else{logger[_0x17e3('0xa')]('JscriptyProject,\x20%s,\x20%s',_0x31ff4e,_0x17e3('0xb'));_0x863408(_0xf41ba0[_0x17e3('0x13')]['message']);}})[_0x17e3('0x14')](function(_0x3b09d9){logger['error'](_0x17e3('0x11'),_0x31ff4e,_0x3b09d9);_0x321d36(_0x3b09d9);});});} \ No newline at end of file +var _0xa7a8=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','JscriptyProject,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7a8,0xc0));var _0x8a7a=function(_0xd0e89,_0x3b5d2e){_0xd0e89=_0xd0e89-0x0;var _0x5bccf2=_0xa7a8[_0xd0e89];return _0x5bccf2;};'use strict';var _=require('lodash');var util=require(_0x8a7a('0x0'));var moment=require(_0x8a7a('0x1'));var BPromise=require(_0x8a7a('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x8a7a('0x3'))['db'];var utils=require(_0x8a7a('0x4'));var logger=require(_0x8a7a('0x5'))(_0x8a7a('0x6'));var config=require(_0x8a7a('0x7'));var jayson=require(_0x8a7a('0x8'));var client=jayson[_0x8a7a('0x9')][_0x8a7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d27dc,_0x146d2f,_0x3e4cc5){return new BPromise(function(_0x4c8fac,_0x504777){return client[_0x8a7a('0xb')](_0x1d27dc,_0x3e4cc5)[_0x8a7a('0xc')](function(_0x195599){logger[_0x8a7a('0xd')]('JscriptyProject,\x20%s,\x20%s',_0x146d2f,'request\x20sent');logger[_0x8a7a('0xe')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x146d2f,_0x8a7a('0xf'),JSON['stringify'](_0x195599));if(_0x195599[_0x8a7a('0x10')]){if(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x11')]===0x1f4){logger['error'](_0x8a7a('0x12'),_0x146d2f,_0x195599['error'][_0x8a7a('0x13')]);return _0x504777(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);}logger[_0x8a7a('0x10')](_0x8a7a('0x12'),_0x146d2f,_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);return _0x4c8fac(_0x195599[_0x8a7a('0x10')][_0x8a7a('0x13')]);}else{logger[_0x8a7a('0xd')](_0x8a7a('0x12'),_0x146d2f,'request\x20sent');_0x4c8fac(_0x195599[_0x8a7a('0x14')][_0x8a7a('0x13')]);}})[_0x8a7a('0x15')](function(_0x1b16d3){logger[_0x8a7a('0x10')](_0x8a7a('0x12'),_0x146d2f,_0x1b16d3);_0x504777(_0x1b16d3);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 5e2d27d..3f44ff6 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 _0x6cb7=['../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express'];(function(_0x360523,_0x26d59){var _0x6aa78e=function(_0x83ef0){while(--_0x83ef0){_0x360523['push'](_0x360523['shift']());}};_0x6aa78e(++_0x26d59);}(_0x6cb7,0x19f));var _0x76cb=function(_0x5b33b2,_0x3a3f12){_0x5b33b2=_0x5b33b2-0x0;var _0x45575e=_0x6cb7[_0x5b33b2];return _0x45575e;};'use strict';var multer=require('multer');var util=require(_0x76cb('0x0'));var path=require(_0x76cb('0x1'));var express=require(_0x76cb('0x2'));var router=express['Router']();var auth=require(_0x76cb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x76cb('0x4'));var controller=require(_0x76cb('0x5'));router[_0x76cb('0x6')]('/',auth[_0x76cb('0x7')](),controller[_0x76cb('0x8')]);router[_0x76cb('0x6')](_0x76cb('0x9'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x76cb('0xa'),auth['isAuthenticated'](),controller[_0x76cb('0xb')]);router[_0x76cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x76cb('0xd')]);router[_0x76cb('0xe')]('/:id',auth[_0x76cb('0x7')](),controller[_0x76cb('0xf')]);router[_0x76cb('0x10')]('/:id',auth[_0x76cb('0x7')](),controller[_0x76cb('0x11')]);module[_0x76cb('0x12')]=router; \ No newline at end of file +var _0x4ef1=['/:id','show','post','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe'];(function(_0x20b55b,_0x387ba6){var _0x106f72=function(_0x2c74dd){while(--_0x2c74dd){_0x20b55b['push'](_0x20b55b['shift']());}};_0x106f72(++_0x387ba6);}(_0x4ef1,0xeb));var _0x14ef=function(_0x493d76,_0xa55cc7){_0x493d76=_0x493d76-0x0;var _0x50bc2e=_0x4ef1[_0x493d76];return _0x50bc2e;};'use strict';var multer=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var path=require('path');var express=require(_0x14ef('0x2'));var router=express[_0x14ef('0x3')]();var auth=require(_0x14ef('0x4'));var interaction=require(_0x14ef('0x5'));var config=require(_0x14ef('0x6'));var controller=require(_0x14ef('0x7'));router[_0x14ef('0x8')]('/',auth[_0x14ef('0x9')](),controller[_0x14ef('0xa')]);router[_0x14ef('0x8')]('/describe',auth[_0x14ef('0x9')](),controller[_0x14ef('0xb')]);router['get'](_0x14ef('0xc'),auth[_0x14ef('0x9')](),controller[_0x14ef('0xd')]);router[_0x14ef('0xe')]('/',auth[_0x14ef('0x9')](),controller['create']);router[_0x14ef('0xf')]('/:id',auth[_0x14ef('0x9')](),controller[_0x14ef('0x10')]);router[_0x14ef('0x11')](_0x14ef('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x14ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 5dd24ea..7676fa4 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 _0xd73a=['exports','STRING','TEXT','long','sequelize'];(function(_0x581665,_0x4697e7){var _0x4d7518=function(_0x380bef){while(--_0x380bef){_0x581665['push'](_0x581665['shift']());}};_0x4d7518(++_0x4697e7);}(_0xd73a,0x171));var _0xad73=function(_0x163c98,_0x4efbd6){_0x163c98=_0x163c98-0x0;var _0x4f3052=_0xd73a[_0x163c98];return _0x4f3052;};'use strict';var Sequelize=require(_0xad73('0x0'));module[_0xad73('0x1')]={'question':{'type':Sequelize[_0xad73('0x2')]},'answer':{'type':Sequelize[_0xad73('0x3')](_0xad73('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xad73('0x2')]},'uniqueid':{'type':Sequelize[_0xad73('0x2')]},'calleridname':{'type':Sequelize[_0xad73('0x2')]},'calleridnum':{'type':Sequelize[_0xad73('0x2')]},'questionId':{'type':Sequelize[_0xad73('0x2')]}}; \ No newline at end of file +var _0xce25=['STRING'];(function(_0x368428,_0x20ad69){var _0x591467=function(_0x445e80){while(--_0x445e80){_0x368428['push'](_0x368428['shift']());}};_0x591467(++_0x20ad69);}(_0xce25,0x196));var _0x5ce2=function(_0x1e8ec7,_0x589fd4){_0x1e8ec7=_0x1e8ec7-0x0;var _0x4bd170=_0xce25[_0x1e8ec7];return _0x4bd170;};'use strict';var Sequelize=require('sequelize');module['exports']={'question':{'type':Sequelize[_0x5ce2('0x0')]},'answer':{'type':Sequelize['TEXT']('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x5ce2('0x0')]},'queue':{'type':Sequelize[_0x5ce2('0x0')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5ce2('0x0')]},'calleridnum':{'type':Sequelize[_0x5ce2('0x0')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 736b90d..92149f5 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 _0x3f33=['json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyQuestionReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','add','merge','filter','map','options','findAll','rows','catch','show','params','includeAll','find','create','body','describe','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status'];(function(_0x40b343,_0x464279){var _0xc875fd=function(_0x1a857f){while(--_0x1a857f){_0x40b343['push'](_0x40b343['shift']());}};_0xc875fd(++_0x464279);}(_0x3f33,0x6f));var _0x33f3=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0x3f33[_0x230e39];return _0xa804e;};'use strict';var jsonpatch=require(_0x33f3('0x0'));var rp=require('request-promise');var moment=require(_0x33f3('0x1'));var BPromise=require(_0x33f3('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x33f3('0x3'));var sox=require(_0x33f3('0x4'));var csv=require(_0x33f3('0x5'));var ejs=require(_0x33f3('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x33f3('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x33f3('0x8'));var toCsv=require(_0x33f3('0x5'));var querystring=require(_0x33f3('0x9'));var Papa=require(_0x33f3('0xa'));var qs=require(_0x33f3('0xb'));var logger=require(_0x33f3('0xc'))(_0x33f3('0xd'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x33f3('0xe'))['db'];function respondWithStatusCode(_0x2139cd,_0x1000ef){_0x1000ef=_0x1000ef||0xcc;return function(_0x55ca5e){if(_0x55ca5e){return _0x2139cd[_0x33f3('0xf')](_0x1000ef);}return _0x2139cd[_0x33f3('0x10')](_0x1000ef)['end']();};}function respondWithResult(_0x1db96a,_0x537f79){_0x537f79=_0x537f79||0xc8;return function(_0xd0cdce){if(_0xd0cdce){return _0x1db96a[_0x33f3('0x10')](_0x537f79)[_0x33f3('0x11')](_0xd0cdce);}};}function respondWithFilteredResult(_0x6755d8,_0x5c0495){return function(_0x16e0ab){if(_0x16e0ab){var _0x2e7a7d=_0x16e0ab[_0x33f3('0x12')],_0x5f779=_0x5c0495[_0x33f3('0x13')],_0x313e2e=_0x5c0495[_0x33f3('0x13')]+_0x5c0495[_0x33f3('0x14')],_0xb785a0;if(_0x313e2e>=_0x2e7a7d){_0x313e2e=_0x2e7a7d;_0xb785a0=0xc8;}else{_0xb785a0=0xce;}_0x6755d8[_0x33f3('0x10')](_0xb785a0);return _0x6755d8[_0x33f3('0x15')](_0x33f3('0x16'),_0x5f779+'-'+_0x313e2e+'/'+_0x2e7a7d)[_0x33f3('0x11')](_0x16e0ab);}return null;};}function patchUpdates(_0x2aee7c){return function(_0x45add2){try{jsonpatch[_0x33f3('0x17')](_0x45add2,_0x2aee7c,!![]);}catch(_0x5aeaa6){return BPromise['reject'](_0x5aeaa6);}return _0x45add2[_0x33f3('0x18')]();};}function saveUpdates(_0x48b1b,_0x1b90d0){return function(_0x19d6cc){if(_0x19d6cc){return _0x19d6cc['update'](_0x48b1b)[_0x33f3('0x19')](function(_0x3a9398){return _0x3a9398;});}return null;};}function removeEntity(_0x402864,_0x536ab1){return function(_0x389ff2){if(_0x389ff2){return _0x389ff2[_0x33f3('0x1a')]()[_0x33f3('0x19')](function(){_0x402864[_0x33f3('0x10')](0xcc)[_0x33f3('0x1b')]();});}};}function handleEntityNotFound(_0x1d6b7f,_0x1a9d94){return function(_0x45bbf3){if(!_0x45bbf3){_0x1d6b7f[_0x33f3('0xf')](0x194);}return _0x45bbf3;};}function handleError(_0x20aa15,_0x2ce8ff){_0x2ce8ff=_0x2ce8ff||0x1f4;return function(_0x55f2ed){logger[_0x33f3('0x1c')](_0x55f2ed[_0x33f3('0x1d')]);if(_0x55f2ed[_0x33f3('0x1e')]){delete _0x55f2ed[_0x33f3('0x1e')];}_0x20aa15['status'](_0x2ce8ff)[_0x33f3('0x1f')](_0x55f2ed);};}exports[_0x33f3('0x20')]=function(_0x2feda1,_0x26342d){var _0x3ace79={},_0x1ced43={},_0x145f8f={'count':0x0,'rows':[]};var _0x258ff6=db[_0x33f3('0x21')][_0x33f3('0x22')];_0x1ced43[_0x33f3('0x23')]=_[_0x33f3('0x24')](_0x258ff6);var _0x29b95f={'dateStart':_0x2feda1['query'][_0x33f3('0x25')],'dateEnd':_0x2feda1[_0x33f3('0x26')][_0x33f3('0x27')]};delete _0x2feda1[_0x33f3('0x26')][_0x33f3('0x25')];delete _0x2feda1[_0x33f3('0x26')][_0x33f3('0x27')];_0x1ced43[_0x33f3('0x26')]=_['keys'](_0x2feda1[_0x33f3('0x26')]);_0x1ced43[_0x33f3('0x28')]=_[_0x33f3('0x29')](_0x1ced43[_0x33f3('0x23')],_0x1ced43['query']);_0x3ace79[_0x33f3('0x2a')]=_[_0x33f3('0x29')](_0x1ced43[_0x33f3('0x23')],qs[_0x33f3('0x2b')](_0x2feda1[_0x33f3('0x26')]['fields']));_0x3ace79[_0x33f3('0x2a')]=_0x3ace79[_0x33f3('0x2a')][_0x33f3('0x2c')]?_0x3ace79[_0x33f3('0x2a')]:_0x1ced43[_0x33f3('0x23')];if(!_0x2feda1[_0x33f3('0x26')][_0x33f3('0x2d')](_0x33f3('0x2e'))){_0x3ace79[_0x33f3('0x14')]=qs[_0x33f3('0x14')](_0x2feda1[_0x33f3('0x26')][_0x33f3('0x14')]);_0x3ace79[_0x33f3('0x13')]=qs['offset'](_0x2feda1['query']['offset']);}_0x3ace79['order']=qs[_0x33f3('0x2f')](_0x2feda1[_0x33f3('0x26')][_0x33f3('0x2f')]);_0x3ace79[_0x33f3('0x30')]=qs[_0x33f3('0x28')](_['pick'](_0x2feda1[_0x33f3('0x26')],_0x1ced43[_0x33f3('0x28')]));if(_0x29b95f['dateStart']){if(_0x29b95f['dateEnd']){_0x29b95f[_0x33f3('0x27')]=moment(_0x29b95f[_0x33f3('0x27')])[_0x33f3('0x31')](0x1,'day');}else{_0x29b95f[_0x33f3('0x27')]=moment(_0x29b95f[_0x33f3('0x25')])[_0x33f3('0x31')](0x1,'day');}_[_0x33f3('0x32')](_0x3ace79[_0x33f3('0x30')],{'createdAt':{'$gte':_0x29b95f['dateStart'],'$lte':_0x29b95f[_0x33f3('0x27')]}});}if(_0x2feda1[_0x33f3('0x26')][_0x33f3('0x33')]){_0x3ace79['where']=_[_0x33f3('0x32')](_0x3ace79[_0x33f3('0x30')],{'$or':_[_0x33f3('0x34')](_0x3ace79[_0x33f3('0x2a')],function(_0x5d9bc4){var _0x5d6d20={};_0x5d6d20[_0x5d9bc4]={'$like':'%'+_0x2feda1['query'][_0x33f3('0x33')]+'%'};return _0x5d6d20;})});}_0x3ace79=_['merge']({},_0x3ace79,_0x2feda1[_0x33f3('0x35')]);var _0x3d69d2={'where':_0x3ace79['where']};return db['JscriptyQuestionReport'][_0x33f3('0x12')](_0x3d69d2)[_0x33f3('0x19')](function(_0x357024){_0x145f8f[_0x33f3('0x12')]=_0x357024;if(_0x2feda1[_0x33f3('0x26')]['includeAll']){_0x3ace79['include']=[{'all':!![]}];}return db[_0x33f3('0x21')][_0x33f3('0x36')](_0x3ace79);})['then'](function(_0x4d5c14){_0x145f8f[_0x33f3('0x37')]=_0x4d5c14;return _0x145f8f;})[_0x33f3('0x19')](respondWithFilteredResult(_0x26342d,_0x3ace79))[_0x33f3('0x38')](handleError(_0x26342d,null));};exports[_0x33f3('0x39')]=function(_0x222fb6,_0x707a9a){var _0x302cec={'raw':!![],'where':{'id':_0x222fb6[_0x33f3('0x3a')]['id']}},_0x99e6f7={};_0x99e6f7[_0x33f3('0x23')]=_[_0x33f3('0x24')](db[_0x33f3('0x21')][_0x33f3('0x22')]);_0x99e6f7['query']=_['keys'](_0x222fb6[_0x33f3('0x26')]);_0x99e6f7['filters']=_['intersection'](_0x99e6f7[_0x33f3('0x23')],_0x99e6f7[_0x33f3('0x26')]);_0x302cec[_0x33f3('0x2a')]=_['intersection'](_0x99e6f7['model'],qs[_0x33f3('0x2b')](_0x222fb6['query'][_0x33f3('0x2b')]));_0x302cec[_0x33f3('0x2a')]=_0x302cec[_0x33f3('0x2a')]['length']?_0x302cec[_0x33f3('0x2a')]:_0x99e6f7[_0x33f3('0x23')];if(_0x222fb6[_0x33f3('0x26')][_0x33f3('0x3b')]){_0x302cec['include']=[{'all':!![]}];}_0x302cec=_[_0x33f3('0x32')]({},_0x302cec,_0x222fb6[_0x33f3('0x35')]);return db[_0x33f3('0x21')][_0x33f3('0x3c')](_0x302cec)['then'](handleEntityNotFound(_0x707a9a,null))[_0x33f3('0x19')](respondWithResult(_0x707a9a,null))['catch'](handleError(_0x707a9a,null));};exports['create']=function(_0x1a1e80,_0x22df9c){return db[_0x33f3('0x21')][_0x33f3('0x3d')](_0x1a1e80[_0x33f3('0x3e')],{})['then'](respondWithResult(_0x22df9c,0xc9))['catch'](handleError(_0x22df9c,null));};exports['update']=function(_0x2d337f,_0x5735ec){if(_0x2d337f[_0x33f3('0x3e')]['id']){delete _0x2d337f[_0x33f3('0x3e')]['id'];}return db[_0x33f3('0x21')][_0x33f3('0x3c')]({'where':{'id':_0x2d337f[_0x33f3('0x3a')]['id']}})[_0x33f3('0x19')](handleEntityNotFound(_0x5735ec,null))[_0x33f3('0x19')](saveUpdates(_0x2d337f['body'],null))[_0x33f3('0x19')](respondWithResult(_0x5735ec,null))['catch'](handleError(_0x5735ec,null));};exports[_0x33f3('0x1a')]=function(_0x36f9c2,_0x1cd684){return db[_0x33f3('0x21')][_0x33f3('0x3c')]({'where':{'id':_0x36f9c2[_0x33f3('0x3a')]['id']}})[_0x33f3('0x19')](handleEntityNotFound(_0x1cd684,null))[_0x33f3('0x19')](removeEntity(_0x1cd684,null))[_0x33f3('0x38')](handleError(_0x1cd684,null));};exports[_0x33f3('0x3f')]=function(_0x4fa0c5,_0x289bd3){return db[_0x33f3('0x21')][_0x33f3('0x3f')]()[_0x33f3('0x19')](respondWithResult(_0x289bd3,null))[_0x33f3('0x38')](handleError(_0x289bd3,null));}; \ No newline at end of file +var _0x471c=['json','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','JscriptyQuestionReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','add','day','filter','map','merge','findAll','catch','show','params','length','include','options','find','create','body','describe','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','sendStatus','status','end'];(function(_0x4f2b79,_0x4a47e2){var _0x42c9a8=function(_0x58f843){while(--_0x58f843){_0x4f2b79['push'](_0x4f2b79['shift']());}};_0x42c9a8(++_0x4a47e2);}(_0x471c,0x136));var _0xc471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x471c[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xc471('0x0'));var rp=require(_0xc471('0x1'));var moment=require('moment');var BPromise=require(_0xc471('0x2'));var Mustache=require(_0xc471('0x3'));var util=require('util');var path=require('path');var sox=require(_0xc471('0x4'));var csv=require(_0xc471('0x5'));var ejs=require(_0xc471('0x6'));var fs=require('fs');var _=require(_0xc471('0x7'));var squel=require(_0xc471('0x8'));var crypto=require(_0xc471('0x9'));var jsforce=require(_0xc471('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xc471('0x5'));var querystring=require(_0xc471('0xb'));var Papa=require(_0xc471('0xc'));var qs=require(_0xc471('0xd'));var logger=require(_0xc471('0xe'))(_0xc471('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xc471('0x10'))['db'];function respondWithStatusCode(_0x193d06,_0x12c398){_0x12c398=_0x12c398||0xcc;return function(_0x2e8142){if(_0x2e8142){return _0x193d06[_0xc471('0x11')](_0x12c398);}return _0x193d06[_0xc471('0x12')](_0x12c398)[_0xc471('0x13')]();};}function respondWithResult(_0xb6f1d5,_0x11c0cb){_0x11c0cb=_0x11c0cb||0xc8;return function(_0x2d7188){if(_0x2d7188){return _0xb6f1d5[_0xc471('0x12')](_0x11c0cb)[_0xc471('0x14')](_0x2d7188);}};}function respondWithFilteredResult(_0x2080f4,_0x2b385e){return function(_0x50826d){if(_0x50826d){var _0x564304=_0x50826d[_0xc471('0x15')],_0x4f8d8a=_0x2b385e[_0xc471('0x16')],_0x4b7635=_0x2b385e[_0xc471('0x16')]+_0x2b385e[_0xc471('0x17')],_0x4e5933;if(_0x4b7635>=_0x564304){_0x4b7635=_0x564304;_0x4e5933=0xc8;}else{_0x4e5933=0xce;}_0x2080f4[_0xc471('0x12')](_0x4e5933);return _0x2080f4[_0xc471('0x18')]('Content-Range',_0x4f8d8a+'-'+_0x4b7635+'/'+_0x564304)[_0xc471('0x14')](_0x50826d);}return null;};}function patchUpdates(_0x443e61){return function(_0x4242dd){try{jsonpatch[_0xc471('0x19')](_0x4242dd,_0x443e61,!![]);}catch(_0x1c401a){return BPromise[_0xc471('0x1a')](_0x1c401a);}return _0x4242dd[_0xc471('0x1b')]();};}function saveUpdates(_0x400de6,_0x3b6a5b){return function(_0x16cd87){if(_0x16cd87){return _0x16cd87[_0xc471('0x1c')](_0x400de6)[_0xc471('0x1d')](function(_0x156a8f){return _0x156a8f;});}return null;};}function removeEntity(_0x41b836,_0x2be26e){return function(_0x6446d0){if(_0x6446d0){return _0x6446d0[_0xc471('0x1e')]()[_0xc471('0x1d')](function(){_0x41b836[_0xc471('0x12')](0xcc)[_0xc471('0x13')]();});}};}function handleEntityNotFound(_0x45818b,_0x3232a8){return function(_0x5779b8){if(!_0x5779b8){_0x45818b[_0xc471('0x11')](0x194);}return _0x5779b8;};}function handleError(_0x1830ab,_0x376bbf){_0x376bbf=_0x376bbf||0x1f4;return function(_0x378c93){logger['error'](_0x378c93[_0xc471('0x1f')]);if(_0x378c93['name']){delete _0x378c93[_0xc471('0x20')];}_0x1830ab['status'](_0x376bbf)[_0xc471('0x21')](_0x378c93);};}exports['index']=function(_0x32e02f,_0x1c1efb){var _0x4fe59d={},_0x142305={},_0x22afff={'count':0x0,'rows':[]};var _0x3a7a9f=db[_0xc471('0x22')][_0xc471('0x23')];_0x142305[_0xc471('0x24')]=_[_0xc471('0x25')](_0x3a7a9f);var _0x3ca71c={'dateStart':_0x32e02f[_0xc471('0x26')][_0xc471('0x27')],'dateEnd':_0x32e02f[_0xc471('0x26')][_0xc471('0x28')]};delete _0x32e02f[_0xc471('0x26')][_0xc471('0x27')];delete _0x32e02f[_0xc471('0x26')]['dateEnd'];_0x142305[_0xc471('0x26')]=_[_0xc471('0x25')](_0x32e02f[_0xc471('0x26')]);_0x142305[_0xc471('0x29')]=_[_0xc471('0x2a')](_0x142305[_0xc471('0x24')],_0x142305['query']);_0x4fe59d[_0xc471('0x2b')]=_[_0xc471('0x2a')](_0x142305[_0xc471('0x24')],qs[_0xc471('0x2c')](_0x32e02f[_0xc471('0x26')][_0xc471('0x2c')]));_0x4fe59d[_0xc471('0x2b')]=_0x4fe59d['attributes']['length']?_0x4fe59d['attributes']:_0x142305[_0xc471('0x24')];if(!_0x32e02f['query'][_0xc471('0x2d')]('nolimit')){_0x4fe59d[_0xc471('0x17')]=qs[_0xc471('0x17')](_0x32e02f[_0xc471('0x26')][_0xc471('0x17')]);_0x4fe59d[_0xc471('0x16')]=qs['offset'](_0x32e02f[_0xc471('0x26')]['offset']);}_0x4fe59d[_0xc471('0x2e')]=qs[_0xc471('0x2f')](_0x32e02f[_0xc471('0x26')][_0xc471('0x2f')]);_0x4fe59d[_0xc471('0x30')]=qs[_0xc471('0x29')](_[_0xc471('0x31')](_0x32e02f[_0xc471('0x26')],_0x142305[_0xc471('0x29')]));if(_0x3ca71c['dateStart']){if(_0x3ca71c['dateEnd']){_0x3ca71c[_0xc471('0x28')]=moment(_0x3ca71c[_0xc471('0x28')])[_0xc471('0x32')](0x1,_0xc471('0x33'));}else{_0x3ca71c[_0xc471('0x28')]=moment(_0x3ca71c[_0xc471('0x27')])[_0xc471('0x32')](0x1,_0xc471('0x33'));}_['merge'](_0x4fe59d['where'],{'createdAt':{'$gte':_0x3ca71c[_0xc471('0x27')],'$lte':_0x3ca71c[_0xc471('0x28')]}});}if(_0x32e02f[_0xc471('0x26')][_0xc471('0x34')]){_0x4fe59d[_0xc471('0x30')]=_['merge'](_0x4fe59d['where'],{'$or':_[_0xc471('0x35')](_0x4fe59d[_0xc471('0x2b')],function(_0x49c1c6){var _0x58e29a={};_0x58e29a[_0x49c1c6]={'$like':'%'+_0x32e02f['query'][_0xc471('0x34')]+'%'};return _0x58e29a;})});}_0x4fe59d=_[_0xc471('0x36')]({},_0x4fe59d,_0x32e02f['options']);var _0x2065c1={'where':_0x4fe59d['where']};return db[_0xc471('0x22')][_0xc471('0x15')](_0x2065c1)['then'](function(_0x2ec528){_0x22afff[_0xc471('0x15')]=_0x2ec528;if(_0x32e02f[_0xc471('0x26')]['includeAll']){_0x4fe59d['include']=[{'all':!![]}];}return db[_0xc471('0x22')][_0xc471('0x37')](_0x4fe59d);})['then'](function(_0x5be66e){_0x22afff['rows']=_0x5be66e;return _0x22afff;})['then'](respondWithFilteredResult(_0x1c1efb,_0x4fe59d))[_0xc471('0x38')](handleError(_0x1c1efb,null));};exports[_0xc471('0x39')]=function(_0x30ac4d,_0x149b8d){var _0x34e849={'raw':!![],'where':{'id':_0x30ac4d[_0xc471('0x3a')]['id']}},_0x19df25={};_0x19df25[_0xc471('0x24')]=_[_0xc471('0x25')](db[_0xc471('0x22')][_0xc471('0x23')]);_0x19df25['query']=_['keys'](_0x30ac4d[_0xc471('0x26')]);_0x19df25[_0xc471('0x29')]=_[_0xc471('0x2a')](_0x19df25[_0xc471('0x24')],_0x19df25[_0xc471('0x26')]);_0x34e849['attributes']=_[_0xc471('0x2a')](_0x19df25[_0xc471('0x24')],qs[_0xc471('0x2c')](_0x30ac4d[_0xc471('0x26')][_0xc471('0x2c')]));_0x34e849[_0xc471('0x2b')]=_0x34e849[_0xc471('0x2b')][_0xc471('0x3b')]?_0x34e849[_0xc471('0x2b')]:_0x19df25[_0xc471('0x24')];if(_0x30ac4d['query']['includeAll']){_0x34e849[_0xc471('0x3c')]=[{'all':!![]}];}_0x34e849=_[_0xc471('0x36')]({},_0x34e849,_0x30ac4d[_0xc471('0x3d')]);return db[_0xc471('0x22')][_0xc471('0x3e')](_0x34e849)[_0xc471('0x1d')](handleEntityNotFound(_0x149b8d,null))['then'](respondWithResult(_0x149b8d,null))[_0xc471('0x38')](handleError(_0x149b8d,null));};exports[_0xc471('0x3f')]=function(_0x2abb71,_0x273f0d){return db['JscriptyQuestionReport'][_0xc471('0x3f')](_0x2abb71[_0xc471('0x40')],{})['then'](respondWithResult(_0x273f0d,0xc9))['catch'](handleError(_0x273f0d,null));};exports[_0xc471('0x1c')]=function(_0x9f213c,_0x1cec1d){if(_0x9f213c[_0xc471('0x40')]['id']){delete _0x9f213c[_0xc471('0x40')]['id'];}return db['JscriptyQuestionReport'][_0xc471('0x3e')]({'where':{'id':_0x9f213c['params']['id']}})[_0xc471('0x1d')](handleEntityNotFound(_0x1cec1d,null))[_0xc471('0x1d')](saveUpdates(_0x9f213c[_0xc471('0x40')],null))[_0xc471('0x1d')](respondWithResult(_0x1cec1d,null))[_0xc471('0x38')](handleError(_0x1cec1d,null));};exports[_0xc471('0x1e')]=function(_0x1c5fd0,_0x309159){return db[_0xc471('0x22')]['find']({'where':{'id':_0x1c5fd0[_0xc471('0x3a')]['id']}})[_0xc471('0x1d')](handleEntityNotFound(_0x309159,null))[_0xc471('0x1d')](removeEntity(_0x309159,null))[_0xc471('0x38')](handleError(_0x309159,null));};exports[_0xc471('0x41')]=function(_0x491e6f,_0x5d5c73){return db['JscriptyQuestionReport'][_0xc471('0x41')]()[_0xc471('0x1d')](respondWithResult(_0x5d5c73,null))[_0xc471('0x38')](handleError(_0x5d5c73,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 140f430..05b7721 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 _0xf09f=['util','../../config/logger','api','moment','bluebird','request-promise','exports','define','JscriptyQuestionReport','report_jscripty_questions'];(function(_0x26bbd1,_0xb274f3){var _0x26b1eb=function(_0x4cf794){while(--_0x4cf794){_0x26bbd1['push'](_0x26bbd1['shift']());}};_0x26b1eb(++_0xb274f3);}(_0xf09f,0x1cc));var _0xff09=function(_0x5b9b23,_0x2bc546){_0x5b9b23=_0x5b9b23-0x0;var _0x4e906f=_0xf09f[_0x5b9b23];return _0x4e906f;};'use strict';var _=require('lodash');var util=require(_0xff09('0x0'));var logger=require(_0xff09('0x1'))(_0xff09('0x2'));var moment=require(_0xff09('0x3'));var BPromise=require(_0xff09('0x4'));var rp=require(_0xff09('0x5'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xff09('0x6')]=function(_0x3249f0,_0x40e9e1){return _0x3249f0[_0xff09('0x7')](_0xff09('0x8'),attributes,{'tableName':_0xff09('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21aa=['lodash','../../config/logger','api','moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x33e152,_0x3510cf){var _0x53cbf9=function(_0x5d984b){while(--_0x5d984b){_0x33e152['push'](_0x33e152['shift']());}};_0x53cbf9(++_0x3510cf);}(_0x21aa,0x154));var _0xa21a=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x21aa[_0x9dfc10];return _0x4f938a;};'use strict';var _=require(_0xa21a('0x0'));var util=require('util');var logger=require(_0xa21a('0x1'))(_0xa21a('0x2'));var moment=require(_0xa21a('0x3'));var BPromise=require(_0xa21a('0x4'));var rp=require(_0xa21a('0x5'));var attributes=require(_0xa21a('0x6'));module[_0xa21a('0x7')]=function(_0x4f8f64,_0xd059a){return _0x4f8f64[_0xa21a('0x8')](_0xa21a('0x9'),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 488c18e..54e04af 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 _0x0045=['error','code','message','result','catch','moment','../../config/utils','rpc','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0045,0xa5));var _0x5004=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0045[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5004('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5004('0x1'));var logger=require('../../config/logger')(_0x5004('0x2'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5004('0x3')]({'port':0x232a});function respondWithRpcPromise(_0x330caf,_0xf6d92a,_0x1951b3){return new BPromise(function(_0x5c569e,_0x5070a7){return client[_0x5004('0x4')](_0x330caf,_0x1951b3)['then'](function(_0xe68000){logger[_0x5004('0x5')](_0x5004('0x6'),_0xf6d92a,'request\x20sent');logger[_0x5004('0x7')](_0x5004('0x8'),_0xf6d92a,_0x5004('0x9'),JSON[_0x5004('0xa')](_0xe68000));if(_0xe68000[_0x5004('0xb')]){if(_0xe68000[_0x5004('0xb')][_0x5004('0xc')]===0x1f4){logger['error'](_0x5004('0x6'),_0xf6d92a,_0xe68000[_0x5004('0xb')][_0x5004('0xd')]);return _0x5070a7(_0xe68000[_0x5004('0xb')][_0x5004('0xd')]);}logger[_0x5004('0xb')](_0x5004('0x6'),_0xf6d92a,_0xe68000['error'][_0x5004('0xd')]);return _0x5c569e(_0xe68000[_0x5004('0xb')][_0x5004('0xd')]);}else{logger['info'](_0x5004('0x6'),_0xf6d92a,'request\x20sent');_0x5c569e(_0xe68000[_0x5004('0xe')]['message']);}})[_0x5004('0xf')](function(_0x4894a3){logger[_0x5004('0xb')](_0x5004('0x6'),_0xf6d92a,_0x4894a3);_0x5070a7(_0x4894a3);});});} \ No newline at end of file +var _0x7bcf=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0xc447b0,_0x171735){var _0x571a9d=function(_0x371eb6){while(--_0x371eb6){_0xc447b0['push'](_0xc447b0['shift']());}};_0x571a9d(++_0x171735);}(_0x7bcf,0x8c));var _0xf7bc=function(_0x10a11e,_0x1b5c6d){_0x10a11e=_0x10a11e-0x0;var _0x5a8609=_0x7bcf[_0x10a11e];return _0x5a8609;};'use strict';var _=require('lodash');var util=require(_0xf7bc('0x0'));var moment=require('moment');var BPromise=require(_0xf7bc('0x1'));var rs=require(_0xf7bc('0x2'));var fs=require('fs');var db=require(_0xf7bc('0x3'))['db'];var utils=require(_0xf7bc('0x4'));var logger=require(_0xf7bc('0x5'))(_0xf7bc('0x6'));var config=require(_0xf7bc('0x7'));var jayson=require(_0xf7bc('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f6ab9,_0x2e0e1c,_0xcaf7ad){return new BPromise(function(_0x51b2fe,_0x500d7c){return client[_0xf7bc('0x9')](_0x3f6ab9,_0xcaf7ad)[_0xf7bc('0xa')](function(_0x31659e){logger[_0xf7bc('0xb')](_0xf7bc('0xc'),_0x2e0e1c,_0xf7bc('0xd'));logger[_0xf7bc('0xe')](_0xf7bc('0xf'),_0x2e0e1c,_0xf7bc('0xd'),JSON['stringify'](_0x31659e));if(_0x31659e[_0xf7bc('0x10')]){if(_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x11')]===0x1f4){logger['error'](_0xf7bc('0xc'),_0x2e0e1c,_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x12')]);return _0x500d7c(_0x31659e['error'][_0xf7bc('0x12')]);}logger[_0xf7bc('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2e0e1c,_0x31659e[_0xf7bc('0x10')]['message']);return _0x51b2fe(_0x31659e[_0xf7bc('0x10')][_0xf7bc('0x12')]);}else{logger[_0xf7bc('0xb')](_0xf7bc('0xc'),_0x2e0e1c,_0xf7bc('0xd'));_0x51b2fe(_0x31659e[_0xf7bc('0x13')][_0xf7bc('0x12')]);}})['catch'](function(_0x16dae5){logger[_0xf7bc('0x10')](_0xf7bc('0xc'),_0x2e0e1c,_0x16dae5);_0x500d7c(_0x16dae5);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index b8a3470..d4e63d3 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 _0xd1a4=['/:id','show','getQuestions','post','create','put','delete','exports','multer','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','get','/describe','describe'];(function(_0x21c2c8,_0x44257e){var _0x4dd745=function(_0x1b3196){while(--_0x1b3196){_0x21c2c8['push'](_0x21c2c8['shift']());}};_0x4dd745(++_0x44257e);}(_0xd1a4,0x1ca));var _0x4d1a=function(_0x497141,_0x365823){_0x497141=_0x497141-0x0;var _0x281aa5=_0xd1a4[_0x497141];return _0x281aa5;};'use strict';var multer=require(_0x4d1a('0x0'));var util=require('util');var path=require(_0x4d1a('0x1'));var express=require('express');var router=express['Router']();var auth=require(_0x4d1a('0x2'));var interaction=require(_0x4d1a('0x3'));var config=require(_0x4d1a('0x4'));var controller=require(_0x4d1a('0x5'));router['get']('/',auth[_0x4d1a('0x6')](),controller['index']);router[_0x4d1a('0x7')](_0x4d1a('0x8'),auth[_0x4d1a('0x6')](),controller[_0x4d1a('0x9')]);router['get'](_0x4d1a('0xa'),auth[_0x4d1a('0x6')](),controller[_0x4d1a('0xb')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller[_0x4d1a('0xc')]);router[_0x4d1a('0xd')]('/',auth[_0x4d1a('0x6')](),controller[_0x4d1a('0xe')]);router[_0x4d1a('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4d1a('0x10')](_0x4d1a('0xa'),auth[_0x4d1a('0x6')](),controller['destroy']);module[_0x4d1a('0x11')]=router; \ No newline at end of file +var _0x6327=['update','delete','util','path','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/questions','getQuestions','post','create','put','/:id'];(function(_0x3a4fd8,_0x1df182){var _0x2c6580=function(_0x4893b2){while(--_0x4893b2){_0x3a4fd8['push'](_0x3a4fd8['shift']());}};_0x2c6580(++_0x1df182);}(_0x6327,0x191));var _0x7632=function(_0x2c6120,_0x1f3e60){_0x2c6120=_0x2c6120-0x0;var _0x5fb114=_0x6327[_0x2c6120];return _0x5fb114;};'use strict';var multer=require('multer');var util=require(_0x7632('0x0'));var path=require(_0x7632('0x1'));var express=require(_0x7632('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7632('0x3'));var config=require(_0x7632('0x4'));var controller=require('./jscriptySessionReport.controller');router[_0x7632('0x5')]('/',auth['isAuthenticated'](),controller[_0x7632('0x6')]);router[_0x7632('0x5')](_0x7632('0x7'),auth[_0x7632('0x8')](),controller[_0x7632('0x9')]);router[_0x7632('0x5')]('/:id',auth[_0x7632('0x8')](),controller[_0x7632('0xa')]);router['get'](_0x7632('0xb'),auth[_0x7632('0x8')](),controller[_0x7632('0xc')]);router[_0x7632('0xd')]('/',auth[_0x7632('0x8')](),controller[_0x7632('0xe')]);router[_0x7632('0xf')](_0x7632('0x10'),auth[_0x7632('0x8')](),controller[_0x7632('0x11')]);router[_0x7632('0x12')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 5172cce..9694300 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 _0xf1b1=['exports','DATE','setDataValue','endtime','format','STRING','BOOLEAN','sequelize'];(function(_0x288a32,_0x453c3b){var _0x335a6f=function(_0x248009){while(--_0x248009){_0x288a32['push'](_0x288a32['shift']());}};_0x335a6f(++_0x453c3b);}(_0xf1b1,0x197));var _0x1f1b=function(_0x42e25e,_0x46cfd1){_0x42e25e=_0x42e25e-0x0;var _0x1ed3a6=_0xf1b1[_0x42e25e];return _0x1ed3a6;};'use strict';var moment=require('moment');var Sequelize=require(_0x1f1b('0x0'));module[_0x1f1b('0x1')]={'starttime':{'type':Sequelize[_0x1f1b('0x2')],'set':function(_0x15a725){this[_0x1f1b('0x3')]('starttime',_0x15a725);this['setDataValue'](_0x1f1b('0x4'),moment()[_0x1f1b('0x5')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x1f1b('0x2')]},'membername':{'type':Sequelize[_0x1f1b('0x6')]},'projectname':{'type':Sequelize[_0x1f1b('0x6')]},'queue':{'type':Sequelize[_0x1f1b('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1f1b('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x1f1b('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x1177=['endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x5c8edb,_0x105253){var _0x5a1451=function(_0x5371f8){while(--_0x5371f8){_0x5c8edb['push'](_0x5c8edb['shift']());}};_0x5a1451(++_0x105253);}(_0x1177,0x10b));var _0x7117=function(_0x400c9d,_0x101ef1){_0x400c9d=_0x400c9d-0x0;var _0x5e4276=_0x1177[_0x400c9d];return _0x5e4276;};'use strict';var moment=require('moment');var Sequelize=require(_0x7117('0x0'));module[_0x7117('0x1')]={'starttime':{'type':Sequelize[_0x7117('0x2')],'set':function(_0x4be118){this[_0x7117('0x3')](_0x7117('0x4'),_0x4be118);this[_0x7117('0x3')](_0x7117('0x5'),moment()['format'](_0x7117('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7117('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7117('0x7')]},'calleridname':{'type':Sequelize[_0x7117('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 27993b8..6c93183 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 _0x0199=['rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','add','day','merge','where','filter','map','options','then','includeAll','include','findAll','rows','catch','show','create','body','find','describe','findOne','params','JscriptyQuestionReport','nolimit','pick','SessionId','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','to-csv','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','send','index','JscriptySessionReport'];(function(_0x5d4d94,_0xa638a5){var _0x5ac17a=function(_0x23e005){while(--_0x23e005){_0x5d4d94['push'](_0x5d4d94['shift']());}};_0x5ac17a(++_0xa638a5);}(_0x0199,0xb2));var _0x9019=function(_0x25f163,_0x2bd897){_0x25f163=_0x25f163-0x0;var _0x19bc37=_0x0199[_0x25f163];return _0x19bc37;};'use strict';var jsonpatch=require(_0x9019('0x0'));var rp=require(_0x9019('0x1'));var moment=require(_0x9019('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9019('0x3'));var util=require(_0x9019('0x4'));var path=require(_0x9019('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9019('0x6'));var fs=require('fs');var _=require(_0x9019('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9019('0x8'));var querystring=require(_0x9019('0x9'));var Papa=require('papaparse');var qs=require(_0x9019('0xa'));var logger=require(_0x9019('0xb'))(_0x9019('0xc'));var utils=require('../../config/utils');var config=require(_0x9019('0xd'));var db=require(_0x9019('0xe'))['db'];function respondWithStatusCode(_0x5b12ae,_0x4689bb){_0x4689bb=_0x4689bb||0xcc;return function(_0x59bdc9){if(_0x59bdc9){return _0x5b12ae[_0x9019('0xf')](_0x4689bb);}return _0x5b12ae[_0x9019('0x10')](_0x4689bb)[_0x9019('0x11')]();};}function respondWithResult(_0x1e6294,_0x3c51cc){_0x3c51cc=_0x3c51cc||0xc8;return function(_0x4973bc){if(_0x4973bc){return _0x1e6294[_0x9019('0x10')](_0x3c51cc)[_0x9019('0x12')](_0x4973bc);}};}function respondWithFilteredResult(_0x1327ab,_0x25880a){return function(_0x2f2dc7){if(_0x2f2dc7){var _0x3bcb65=_0x2f2dc7[_0x9019('0x13')],_0x3f6668=_0x25880a[_0x9019('0x14')],_0x4850bd=_0x25880a[_0x9019('0x14')]+_0x25880a[_0x9019('0x15')],_0xdeaf6c;if(_0x4850bd>=_0x3bcb65){_0x4850bd=_0x3bcb65;_0xdeaf6c=0xc8;}else{_0xdeaf6c=0xce;}_0x1327ab['status'](_0xdeaf6c);return _0x1327ab[_0x9019('0x16')](_0x9019('0x17'),_0x3f6668+'-'+_0x4850bd+'/'+_0x3bcb65)[_0x9019('0x12')](_0x2f2dc7);}return null;};}function patchUpdates(_0x30fc23){return function(_0x24a46f){try{jsonpatch[_0x9019('0x18')](_0x24a46f,_0x30fc23,!![]);}catch(_0x1d490b){return BPromise[_0x9019('0x19')](_0x1d490b);}return _0x24a46f['save']();};}function saveUpdates(_0x28b5fa,_0x19e9c8){return function(_0x3250b9){if(_0x3250b9){return _0x3250b9[_0x9019('0x1a')](_0x28b5fa)['then'](function(_0x44259f){return _0x44259f;});}return null;};}function removeEntity(_0x43c041,_0x10eb60){return function(_0x306acd){if(_0x306acd){return _0x306acd[_0x9019('0x1b')]()['then'](function(){_0x43c041[_0x9019('0x10')](0xcc)[_0x9019('0x11')]();});}};}function handleEntityNotFound(_0x44b8f7,_0x23607d){return function(_0x9508b7){if(!_0x9508b7){_0x44b8f7[_0x9019('0xf')](0x194);}return _0x9508b7;};}function handleError(_0x5d5616,_0x4bba6c){_0x4bba6c=_0x4bba6c||0x1f4;return function(_0x39c05c){logger['error'](_0x39c05c[_0x9019('0x1c')]);if(_0x39c05c['name']){delete _0x39c05c['name'];}_0x5d5616[_0x9019('0x10')](_0x4bba6c)[_0x9019('0x1d')](_0x39c05c);};}exports[_0x9019('0x1e')]=function(_0x1fe336,_0x31328c){var _0x3ca6b3={},_0x36c196={},_0x3bca2f={'count':0x0,'rows':[]};var _0x24c8aa=db[_0x9019('0x1f')][_0x9019('0x20')];_0x36c196[_0x9019('0x21')]=_['keys'](_0x24c8aa);var _0x24bba6={'dateStart':_0x1fe336[_0x9019('0x22')][_0x9019('0x23')],'dateEnd':_0x1fe336[_0x9019('0x22')][_0x9019('0x24')]};delete _0x1fe336[_0x9019('0x22')]['dateStart'];delete _0x1fe336[_0x9019('0x22')][_0x9019('0x24')];_0x36c196['query']=_[_0x9019('0x25')](_0x1fe336[_0x9019('0x22')]);_0x36c196[_0x9019('0x26')]=_['intersection'](_0x36c196['model'],_0x36c196[_0x9019('0x22')]);_0x3ca6b3['attributes']=_[_0x9019('0x27')](_0x36c196[_0x9019('0x21')],qs[_0x9019('0x28')](_0x1fe336['query']['fields']));_0x3ca6b3['attributes']=_0x3ca6b3[_0x9019('0x29')][_0x9019('0x2a')]?_0x3ca6b3['attributes']:_0x36c196['model'];if(!_0x1fe336[_0x9019('0x22')][_0x9019('0x2b')]('nolimit')){_0x3ca6b3['limit']=qs[_0x9019('0x15')](_0x1fe336[_0x9019('0x22')][_0x9019('0x15')]);_0x3ca6b3[_0x9019('0x14')]=qs[_0x9019('0x14')](_0x1fe336[_0x9019('0x22')][_0x9019('0x14')]);}_0x3ca6b3[_0x9019('0x2c')]=qs[_0x9019('0x2d')](_0x1fe336[_0x9019('0x22')][_0x9019('0x2d')]);_0x3ca6b3['where']=qs['filters'](_['pick'](_0x1fe336[_0x9019('0x22')],_0x36c196['filters']));if(_0x24bba6['dateStart']){if(_0x24bba6['dateEnd']){_0x24bba6['dateEnd']=moment(_0x24bba6['dateEnd'])[_0x9019('0x2e')](0x1,_0x9019('0x2f'));}else{_0x24bba6[_0x9019('0x24')]=moment(_0x24bba6['dateStart'])[_0x9019('0x2e')](0x1,_0x9019('0x2f'));}_[_0x9019('0x30')](_0x3ca6b3[_0x9019('0x31')],{'createdAt':{'$gte':_0x24bba6['dateStart'],'$lte':_0x24bba6[_0x9019('0x24')]}});}if(_0x1fe336[_0x9019('0x22')][_0x9019('0x32')]){_0x3ca6b3['where']=_[_0x9019('0x30')](_0x3ca6b3[_0x9019('0x31')],{'$or':_[_0x9019('0x33')](_0x3ca6b3['attributes'],function(_0x5bd621){var _0x50d43e={};_0x50d43e[_0x5bd621]={'$like':'%'+_0x1fe336[_0x9019('0x22')][_0x9019('0x32')]+'%'};return _0x50d43e;})});}_0x3ca6b3=_[_0x9019('0x30')]({},_0x3ca6b3,_0x1fe336[_0x9019('0x34')]);var _0x1c2a8d={'where':_0x3ca6b3['where']};return db[_0x9019('0x1f')][_0x9019('0x13')](_0x1c2a8d)[_0x9019('0x35')](function(_0x1e0736){_0x3bca2f[_0x9019('0x13')]=_0x1e0736;if(_0x1fe336[_0x9019('0x22')][_0x9019('0x36')]){_0x3ca6b3[_0x9019('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x9019('0x38')](_0x3ca6b3);})[_0x9019('0x35')](function(_0xbfccce){_0x3bca2f[_0x9019('0x39')]=_0xbfccce;return _0x3bca2f;})[_0x9019('0x35')](respondWithFilteredResult(_0x31328c,_0x3ca6b3))[_0x9019('0x3a')](handleError(_0x31328c,null));};exports[_0x9019('0x3b')]=function(_0x11c892,_0x222f81){var _0x4323a7={'raw':!![],'where':{'id':_0x11c892['params']['id']}},_0x312d6e={};_0x312d6e['model']=_['keys'](db['JscriptySessionReport'][_0x9019('0x20')]);_0x312d6e['query']=_[_0x9019('0x25')](_0x11c892[_0x9019('0x22')]);_0x312d6e[_0x9019('0x26')]=_[_0x9019('0x27')](_0x312d6e[_0x9019('0x21')],_0x312d6e[_0x9019('0x22')]);_0x4323a7['attributes']=_[_0x9019('0x27')](_0x312d6e[_0x9019('0x21')],qs[_0x9019('0x28')](_0x11c892[_0x9019('0x22')][_0x9019('0x28')]));_0x4323a7['attributes']=_0x4323a7['attributes'][_0x9019('0x2a')]?_0x4323a7[_0x9019('0x29')]:_0x312d6e[_0x9019('0x21')];if(_0x11c892[_0x9019('0x22')][_0x9019('0x36')]){_0x4323a7[_0x9019('0x37')]=[{'all':!![]}];}_0x4323a7=_[_0x9019('0x30')]({},_0x4323a7,_0x11c892[_0x9019('0x34')]);return db['JscriptySessionReport']['find'](_0x4323a7)[_0x9019('0x35')](handleEntityNotFound(_0x222f81,null))['then'](respondWithResult(_0x222f81,null))[_0x9019('0x3a')](handleError(_0x222f81,null));};exports[_0x9019('0x3c')]=function(_0x1bb168,_0x57779c){return db[_0x9019('0x1f')][_0x9019('0x3c')](_0x1bb168[_0x9019('0x3d')],{})[_0x9019('0x35')](respondWithResult(_0x57779c,0xc9))[_0x9019('0x3a')](handleError(_0x57779c,null));};exports['update']=function(_0x215d54,_0x3260a9){if(_0x215d54[_0x9019('0x3d')]['id']){delete _0x215d54[_0x9019('0x3d')]['id'];}return db[_0x9019('0x1f')]['find']({'where':{'id':_0x215d54['params']['id']}})[_0x9019('0x35')](handleEntityNotFound(_0x3260a9,null))[_0x9019('0x35')](saveUpdates(_0x215d54[_0x9019('0x3d')],null))[_0x9019('0x35')](respondWithResult(_0x3260a9,null))['catch'](handleError(_0x3260a9,null));};exports[_0x9019('0x1b')]=function(_0xf0a518,_0x590c45){return db[_0x9019('0x1f')][_0x9019('0x3e')]({'where':{'id':_0xf0a518['params']['id']}})[_0x9019('0x35')](handleEntityNotFound(_0x590c45,null))[_0x9019('0x35')](removeEntity(_0x590c45,null))[_0x9019('0x3a')](handleError(_0x590c45,null));};exports[_0x9019('0x3f')]=function(_0x5ba22d,_0x5cbf37){return db[_0x9019('0x1f')][_0x9019('0x3f')]()[_0x9019('0x35')](respondWithResult(_0x5cbf37,null))[_0x9019('0x3a')](handleError(_0x5cbf37,null));};exports['getQuestions']=function(_0x13a643,_0x2daae9,_0x514bbd){var _0x157c51={'raw':!![],'where':{}};var _0x3b7d89={};var _0x526d27={'count':0x0,'rows':[]};return db[_0x9019('0x1f')][_0x9019('0x40')]({'where':{'id':_0x13a643[_0x9019('0x41')]['id']}})[_0x9019('0x35')](handleEntityNotFound(_0x2daae9,null))['then'](function(_0x41787a){if(_0x41787a){_0x3b7d89[_0x9019('0x21')]=_['keys'](db[_0x9019('0x42')][_0x9019('0x20')]);_0x3b7d89[_0x9019('0x22')]=_[_0x9019('0x25')](_0x13a643[_0x9019('0x22')]);_0x3b7d89[_0x9019('0x26')]=_[_0x9019('0x27')](_0x3b7d89[_0x9019('0x21')],_0x3b7d89[_0x9019('0x22')]);_0x157c51[_0x9019('0x29')]=_[_0x9019('0x27')](_0x3b7d89['model'],qs[_0x9019('0x28')](_0x13a643[_0x9019('0x22')][_0x9019('0x28')]));_0x157c51[_0x9019('0x29')]=_0x157c51[_0x9019('0x29')][_0x9019('0x2a')]?_0x157c51['attributes']:_0x3b7d89['model'];if(!_0x13a643['query'][_0x9019('0x2b')](_0x9019('0x43'))){_0x157c51['limit']=qs[_0x9019('0x15')](_0x13a643['query']['limit']);_0x157c51[_0x9019('0x14')]=qs[_0x9019('0x14')](_0x13a643[_0x9019('0x22')][_0x9019('0x14')]);}_0x157c51[_0x9019('0x2c')]=qs[_0x9019('0x2d')](_0x13a643['query'][_0x9019('0x2d')]);_0x157c51[_0x9019('0x31')]=qs[_0x9019('0x26')](_[_0x9019('0x44')](_0x13a643[_0x9019('0x22')],_0x3b7d89[_0x9019('0x26')]));_0x157c51[_0x9019('0x31')][_0x9019('0x45')]=_0x41787a['id'];if(_0x13a643[_0x9019('0x22')][_0x9019('0x32')]){_0x157c51['where']=_[_0x9019('0x30')](_0x157c51[_0x9019('0x31')],{'$or':_['map'](_0x157c51[_0x9019('0x29')],function(_0x222f18){var _0x282a41={};_0x282a41[_0x222f18]={'$like':'%'+_0x13a643['query'][_0x9019('0x32')]+'%'};return _0x282a41;})});}_0x157c51=_[_0x9019('0x30')]({},_0x157c51,_0x13a643[_0x9019('0x34')]);return db['JscriptyQuestionReport'][_0x9019('0x13')]({'where':_0x157c51[_0x9019('0x31')]})[_0x9019('0x35')](function(_0x1c1d36){_0x526d27[_0x9019('0x13')]=_0x1c1d36;if(_0x13a643['query'][_0x9019('0x36')]){_0x157c51['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x9019('0x38')](_0x157c51);})[_0x9019('0x35')](function(_0x17a06b){_0x526d27[_0x9019('0x39')]=_0x17a06b;return _0x526d27;});}})[_0x9019('0x35')](respondWithFilteredResult(_0x2daae9,_0x157c51))[_0x9019('0x3a')](handleError(_0x2daae9,null));}; \ No newline at end of file +var _0x48ea=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','findOne','JscriptyQuestionReport','SessionId','rows','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','JscriptySessionReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters'];(function(_0x7c493f,_0x68e442){var _0x210564=function(_0x22d574){while(--_0x22d574){_0x7c493f['push'](_0x7c493f['shift']());}};_0x210564(++_0x68e442);}(_0x48ea,0xaf));var _0xa48e=function(_0x5bd620,_0x4ab05e){_0x5bd620=_0x5bd620-0x0;var _0x55c678=_0x48ea[_0x5bd620];return _0x55c678;};'use strict';var jsonpatch=require(_0xa48e('0x0'));var rp=require(_0xa48e('0x1'));var moment=require(_0xa48e('0x2'));var BPromise=require(_0xa48e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa48e('0x4'));var sox=require(_0xa48e('0x5'));var csv=require(_0xa48e('0x6'));var ejs=require(_0xa48e('0x7'));var fs=require('fs');var _=require(_0xa48e('0x8'));var squel=require(_0xa48e('0x9'));var crypto=require(_0xa48e('0xa'));var jsforce=require(_0xa48e('0xb'));var deskjs=require(_0xa48e('0xc'));var toCsv=require(_0xa48e('0x6'));var querystring=require('querystring');var Papa=require(_0xa48e('0xd'));var qs=require(_0xa48e('0xe'));var logger=require('../../config/logger')(_0xa48e('0xf'));var utils=require(_0xa48e('0x10'));var config=require('../../config/environment');var db=require(_0xa48e('0x11'))['db'];function respondWithStatusCode(_0x372d25,_0x1b2673){_0x1b2673=_0x1b2673||0xcc;return function(_0xceb3b5){if(_0xceb3b5){return _0x372d25[_0xa48e('0x12')](_0x1b2673);}return _0x372d25[_0xa48e('0x13')](_0x1b2673)[_0xa48e('0x14')]();};}function respondWithResult(_0x5e8bf3,_0x259696){_0x259696=_0x259696||0xc8;return function(_0x2b1476){if(_0x2b1476){return _0x5e8bf3['status'](_0x259696)[_0xa48e('0x15')](_0x2b1476);}};}function respondWithFilteredResult(_0x64195f,_0x428bcd){return function(_0x2b023a){if(_0x2b023a){var _0x449da5=_0x2b023a[_0xa48e('0x16')],_0x4a2bd7=_0x428bcd[_0xa48e('0x17')],_0x2b31fa=_0x428bcd[_0xa48e('0x17')]+_0x428bcd[_0xa48e('0x18')],_0x48abe7;if(_0x2b31fa>=_0x449da5){_0x2b31fa=_0x449da5;_0x48abe7=0xc8;}else{_0x48abe7=0xce;}_0x64195f[_0xa48e('0x13')](_0x48abe7);return _0x64195f['set'](_0xa48e('0x19'),_0x4a2bd7+'-'+_0x2b31fa+'/'+_0x449da5)[_0xa48e('0x15')](_0x2b023a);}return null;};}function patchUpdates(_0x4ff3f5){return function(_0x6feb8f){try{jsonpatch[_0xa48e('0x1a')](_0x6feb8f,_0x4ff3f5,!![]);}catch(_0x4ac335){return BPromise[_0xa48e('0x1b')](_0x4ac335);}return _0x6feb8f[_0xa48e('0x1c')]();};}function saveUpdates(_0x21b530,_0x132d5b){return function(_0x2b5131){if(_0x2b5131){return _0x2b5131[_0xa48e('0x1d')](_0x21b530)[_0xa48e('0x1e')](function(_0x58c09b){return _0x58c09b;});}return null;};}function removeEntity(_0xd74294,_0x295fba){return function(_0x217da6){if(_0x217da6){return _0x217da6[_0xa48e('0x1f')]()[_0xa48e('0x1e')](function(){_0xd74294['status'](0xcc)[_0xa48e('0x14')]();});}};}function handleEntityNotFound(_0x25e14d,_0x3eee01){return function(_0xdf44f0){if(!_0xdf44f0){_0x25e14d['sendStatus'](0x194);}return _0xdf44f0;};}function handleError(_0x4e889c,_0x11b5cf){_0x11b5cf=_0x11b5cf||0x1f4;return function(_0x257dff){logger['error'](_0x257dff[_0xa48e('0x20')]);if(_0x257dff[_0xa48e('0x21')]){delete _0x257dff[_0xa48e('0x21')];}_0x4e889c[_0xa48e('0x13')](_0x11b5cf)[_0xa48e('0x22')](_0x257dff);};}exports[_0xa48e('0x23')]=function(_0x32bc14,_0x5751bd){var _0x4f128f={},_0x1ea466={},_0x5db979={'count':0x0,'rows':[]};var _0x55c8c7=db[_0xa48e('0x24')][_0xa48e('0x25')];_0x1ea466[_0xa48e('0x26')]=_[_0xa48e('0x27')](_0x55c8c7);var _0x4c8bed={'dateStart':_0x32bc14[_0xa48e('0x28')]['dateStart'],'dateEnd':_0x32bc14['query'][_0xa48e('0x29')]};delete _0x32bc14[_0xa48e('0x28')][_0xa48e('0x2a')];delete _0x32bc14['query'][_0xa48e('0x29')];_0x1ea466[_0xa48e('0x28')]=_[_0xa48e('0x27')](_0x32bc14['query']);_0x1ea466[_0xa48e('0x2b')]=_[_0xa48e('0x2c')](_0x1ea466[_0xa48e('0x26')],_0x1ea466[_0xa48e('0x28')]);_0x4f128f[_0xa48e('0x2d')]=_['intersection'](_0x1ea466['model'],qs[_0xa48e('0x2e')](_0x32bc14[_0xa48e('0x28')][_0xa48e('0x2e')]));_0x4f128f['attributes']=_0x4f128f['attributes'][_0xa48e('0x2f')]?_0x4f128f[_0xa48e('0x2d')]:_0x1ea466['model'];if(!_0x32bc14[_0xa48e('0x28')][_0xa48e('0x30')](_0xa48e('0x31'))){_0x4f128f['limit']=qs['limit'](_0x32bc14[_0xa48e('0x28')]['limit']);_0x4f128f[_0xa48e('0x17')]=qs['offset'](_0x32bc14[_0xa48e('0x28')]['offset']);}_0x4f128f[_0xa48e('0x32')]=qs['sort'](_0x32bc14[_0xa48e('0x28')][_0xa48e('0x33')]);_0x4f128f[_0xa48e('0x34')]=qs['filters'](_['pick'](_0x32bc14[_0xa48e('0x28')],_0x1ea466['filters']));if(_0x4c8bed['dateStart']){if(_0x4c8bed[_0xa48e('0x29')]){_0x4c8bed[_0xa48e('0x29')]=moment(_0x4c8bed[_0xa48e('0x29')])['add'](0x1,'day');}else{_0x4c8bed[_0xa48e('0x29')]=moment(_0x4c8bed[_0xa48e('0x2a')])[_0xa48e('0x35')](0x1,_0xa48e('0x36'));}_[_0xa48e('0x37')](_0x4f128f[_0xa48e('0x34')],{'createdAt':{'$gte':_0x4c8bed[_0xa48e('0x2a')],'$lte':_0x4c8bed[_0xa48e('0x29')]}});}if(_0x32bc14[_0xa48e('0x28')][_0xa48e('0x38')]){_0x4f128f['where']=_[_0xa48e('0x37')](_0x4f128f[_0xa48e('0x34')],{'$or':_[_0xa48e('0x39')](_0x4f128f['attributes'],function(_0x2796b1){var _0x4d6958={};_0x4d6958[_0x2796b1]={'$like':'%'+_0x32bc14[_0xa48e('0x28')][_0xa48e('0x38')]+'%'};return _0x4d6958;})});}_0x4f128f=_['merge']({},_0x4f128f,_0x32bc14[_0xa48e('0x3a')]);var _0x1ef4ca={'where':_0x4f128f['where']};return db[_0xa48e('0x24')][_0xa48e('0x16')](_0x1ef4ca)['then'](function(_0x2cdeb9){_0x5db979[_0xa48e('0x16')]=_0x2cdeb9;if(_0x32bc14['query'][_0xa48e('0x3b')]){_0x4f128f[_0xa48e('0x3c')]=[{'all':!![]}];}return db[_0xa48e('0x24')][_0xa48e('0x3d')](_0x4f128f);})[_0xa48e('0x1e')](function(_0x4f84b6){_0x5db979['rows']=_0x4f84b6;return _0x5db979;})['then'](respondWithFilteredResult(_0x5751bd,_0x4f128f))[_0xa48e('0x3e')](handleError(_0x5751bd,null));};exports[_0xa48e('0x3f')]=function(_0x268241,_0x5e3789){var _0x2c4563={'raw':!![],'where':{'id':_0x268241[_0xa48e('0x40')]['id']}},_0x4fabb3={};_0x4fabb3[_0xa48e('0x26')]=_['keys'](db[_0xa48e('0x24')][_0xa48e('0x25')]);_0x4fabb3['query']=_[_0xa48e('0x27')](_0x268241[_0xa48e('0x28')]);_0x4fabb3[_0xa48e('0x2b')]=_[_0xa48e('0x2c')](_0x4fabb3[_0xa48e('0x26')],_0x4fabb3[_0xa48e('0x28')]);_0x2c4563[_0xa48e('0x2d')]=_[_0xa48e('0x2c')](_0x4fabb3['model'],qs[_0xa48e('0x2e')](_0x268241[_0xa48e('0x28')]['fields']));_0x2c4563[_0xa48e('0x2d')]=_0x2c4563[_0xa48e('0x2d')][_0xa48e('0x2f')]?_0x2c4563[_0xa48e('0x2d')]:_0x4fabb3[_0xa48e('0x26')];if(_0x268241[_0xa48e('0x28')][_0xa48e('0x3b')]){_0x2c4563['include']=[{'all':!![]}];}_0x2c4563=_[_0xa48e('0x37')]({},_0x2c4563,_0x268241['options']);return db['JscriptySessionReport'][_0xa48e('0x41')](_0x2c4563)[_0xa48e('0x1e')](handleEntityNotFound(_0x5e3789,null))[_0xa48e('0x1e')](respondWithResult(_0x5e3789,null))[_0xa48e('0x3e')](handleError(_0x5e3789,null));};exports[_0xa48e('0x42')]=function(_0x1c79d9,_0x495e92){return db['JscriptySessionReport'][_0xa48e('0x42')](_0x1c79d9[_0xa48e('0x43')],{})[_0xa48e('0x1e')](respondWithResult(_0x495e92,0xc9))['catch'](handleError(_0x495e92,null));};exports['update']=function(_0x2094b7,_0x33e8ca){if(_0x2094b7[_0xa48e('0x43')]['id']){delete _0x2094b7[_0xa48e('0x43')]['id'];}return db['JscriptySessionReport'][_0xa48e('0x41')]({'where':{'id':_0x2094b7[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x33e8ca,null))[_0xa48e('0x1e')](saveUpdates(_0x2094b7['body'],null))[_0xa48e('0x1e')](respondWithResult(_0x33e8ca,null))[_0xa48e('0x3e')](handleError(_0x33e8ca,null));};exports['destroy']=function(_0x11772e,_0x4406a0){return db[_0xa48e('0x24')][_0xa48e('0x41')]({'where':{'id':_0x11772e[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x4406a0,null))[_0xa48e('0x1e')](removeEntity(_0x4406a0,null))[_0xa48e('0x3e')](handleError(_0x4406a0,null));};exports[_0xa48e('0x44')]=function(_0xfc485a,_0x24c802){return db[_0xa48e('0x24')]['describe']()[_0xa48e('0x1e')](respondWithResult(_0x24c802,null))[_0xa48e('0x3e')](handleError(_0x24c802,null));};exports['getQuestions']=function(_0x4e0fd8,_0x288f11,_0x5e08b7){var _0x11d647={'raw':!![],'where':{}};var _0x14b311={};var _0x2b05bb={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xa48e('0x45')]({'where':{'id':_0x4e0fd8[_0xa48e('0x40')]['id']}})[_0xa48e('0x1e')](handleEntityNotFound(_0x288f11,null))[_0xa48e('0x1e')](function(_0x4581b6){if(_0x4581b6){_0x14b311[_0xa48e('0x26')]=_[_0xa48e('0x27')](db[_0xa48e('0x46')][_0xa48e('0x25')]);_0x14b311[_0xa48e('0x28')]=_[_0xa48e('0x27')](_0x4e0fd8[_0xa48e('0x28')]);_0x14b311['filters']=_['intersection'](_0x14b311[_0xa48e('0x26')],_0x14b311[_0xa48e('0x28')]);_0x11d647[_0xa48e('0x2d')]=_[_0xa48e('0x2c')](_0x14b311['model'],qs['fields'](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x2e')]));_0x11d647[_0xa48e('0x2d')]=_0x11d647[_0xa48e('0x2d')][_0xa48e('0x2f')]?_0x11d647[_0xa48e('0x2d')]:_0x14b311['model'];if(!_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x30')](_0xa48e('0x31'))){_0x11d647['limit']=qs[_0xa48e('0x18')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x18')]);_0x11d647[_0xa48e('0x17')]=qs[_0xa48e('0x17')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x17')]);}_0x11d647['order']=qs[_0xa48e('0x33')](_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x33')]);_0x11d647[_0xa48e('0x34')]=qs[_0xa48e('0x2b')](_['pick'](_0x4e0fd8[_0xa48e('0x28')],_0x14b311['filters']));_0x11d647['where'][_0xa48e('0x47')]=_0x4581b6['id'];if(_0x4e0fd8[_0xa48e('0x28')]['filter']){_0x11d647[_0xa48e('0x34')]=_[_0xa48e('0x37')](_0x11d647[_0xa48e('0x34')],{'$or':_[_0xa48e('0x39')](_0x11d647['attributes'],function(_0x38b3a3){var _0x306bd6={};_0x306bd6[_0x38b3a3]={'$like':'%'+_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x38')]+'%'};return _0x306bd6;})});}_0x11d647=_[_0xa48e('0x37')]({},_0x11d647,_0x4e0fd8[_0xa48e('0x3a')]);return db[_0xa48e('0x46')][_0xa48e('0x16')]({'where':_0x11d647['where']})[_0xa48e('0x1e')](function(_0x182348){_0x2b05bb['count']=_0x182348;if(_0x4e0fd8[_0xa48e('0x28')][_0xa48e('0x3b')]){_0x11d647[_0xa48e('0x3c')]=[{'all':!![]}];}return db[_0xa48e('0x46')][_0xa48e('0x3d')](_0x11d647);})['then'](function(_0x4a053f){_0x2b05bb[_0xa48e('0x48')]=_0x4a053f;return _0x2b05bb;});}})['then'](respondWithFilteredResult(_0x288f11,_0x11d647))[_0xa48e('0x3e')](handleError(_0x288f11,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 50c3064..cbfc69c 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 _0x36e8=['./jscriptySessionReport.attributes','define','lodash','util','../../config/logger','api','request-promise'];(function(_0x21c3dd,_0x279102){var _0x182a3d=function(_0x2333bf){while(--_0x2333bf){_0x21c3dd['push'](_0x21c3dd['shift']());}};_0x182a3d(++_0x279102);}(_0x36e8,0x191));var _0x836e=function(_0x356da1,_0x46c618){_0x356da1=_0x356da1-0x0;var _0x1de2ef=_0x36e8[_0x356da1];return _0x1de2ef;};'use strict';var _=require(_0x836e('0x0'));var util=require(_0x836e('0x1'));var logger=require(_0x836e('0x2'))(_0x836e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x836e('0x4'));var attributes=require(_0x836e('0x5'));module['exports']=function(_0x4be21d,_0x4484f6){return _0x4be21d[_0x836e('0x6')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1190=['define','../../config/logger','api','moment','request-promise','./jscriptySessionReport.attributes'];(function(_0x52e31a,_0x2da71a){var _0x20997d=function(_0xaa1fc7){while(--_0xaa1fc7){_0x52e31a['push'](_0x52e31a['shift']());}};_0x20997d(++_0x2da71a);}(_0x1190,0x145));var _0x0119=function(_0xcd9a96,_0x34bb7d){_0xcd9a96=_0xcd9a96-0x0;var _0x28002c=_0x1190[_0xcd9a96];return _0x28002c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0119('0x0'))(_0x0119('0x1'));var moment=require(_0x0119('0x2'));var BPromise=require('bluebird');var rp=require(_0x0119('0x3'));var attributes=require(_0x0119('0x4'));module['exports']=function(_0x50cbd5,_0xd49350){return _0x50cbd5[_0x0119('0x5')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index cb50f12..0af1eea 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 _0x6974=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','message','JscriptySessionReport,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','then','info'];(function(_0x18ec01,_0x5cfb78){var _0x51bf51=function(_0xd690f1){while(--_0xd690f1){_0x18ec01['push'](_0x18ec01['shift']());}};_0x51bf51(++_0x5cfb78);}(_0x6974,0x97));var _0x4697=function(_0x52c2d3,_0x13f218){_0x52c2d3=_0x52c2d3-0x0;var _0x44e2c2=_0x6974[_0x52c2d3];return _0x44e2c2;};'use strict';var _=require(_0x4697('0x0'));var util=require(_0x4697('0x1'));var moment=require(_0x4697('0x2'));var BPromise=require(_0x4697('0x3'));var rs=require(_0x4697('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4697('0x5'));var logger=require('../../config/logger')(_0x4697('0x6'));var config=require('../../config/environment');var jayson=require(_0x4697('0x7'));var client=jayson[_0x4697('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x120fac,_0x29d45c,_0x1ea9fb){return new BPromise(function(_0x5b9d80,_0x24ac15){return client['request'](_0x120fac,_0x1ea9fb)[_0x4697('0x9')](function(_0x4f372b){logger[_0x4697('0xa')]('JscriptySessionReport,\x20%s,\x20%s',_0x29d45c,_0x4697('0xb'));logger[_0x4697('0xc')](_0x4697('0xd'),_0x29d45c,'request\x20sent',JSON['stringify'](_0x4f372b));if(_0x4f372b['error']){if(_0x4f372b['error']['code']===0x1f4){logger[_0x4697('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x29d45c,_0x4f372b['error'][_0x4697('0xf')]);return _0x24ac15(_0x4f372b[_0x4697('0xe')][_0x4697('0xf')]);}logger[_0x4697('0xe')](_0x4697('0x10'),_0x29d45c,_0x4f372b[_0x4697('0xe')][_0x4697('0xf')]);return _0x5b9d80(_0x4f372b[_0x4697('0xe')][_0x4697('0xf')]);}else{logger[_0x4697('0xa')]('JscriptySessionReport,\x20%s,\x20%s',_0x29d45c,_0x4697('0xb'));_0x5b9d80(_0x4f372b['result'][_0x4697('0xf')]);}})[_0x4697('0x11')](function(_0x3bae13){logger['error'](_0x4697('0x10'),_0x29d45c,_0x3bae13);_0x24ac15(_0x3bae13);});});} \ No newline at end of file +var _0x0301=['then','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x40f4f6,_0x3d2d78){var _0xb3c081=function(_0x163fef){while(--_0x163fef){_0x40f4f6['push'](_0x40f4f6['shift']());}};_0xb3c081(++_0x3d2d78);}(_0x0301,0x120));var _0x1030=function(_0x3f7e37,_0x32f790){_0x3f7e37=_0x3f7e37-0x0;var _0x2a3ec7=_0x0301[_0x3f7e37];return _0x2a3ec7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1030('0x0'));var BPromise=require(_0x1030('0x1'));var rs=require(_0x1030('0x2'));var fs=require('fs');var db=require(_0x1030('0x3'))['db'];var utils=require(_0x1030('0x4'));var logger=require(_0x1030('0x5'))('rpc');var config=require(_0x1030('0x6'));var jayson=require(_0x1030('0x7'));var client=jayson[_0x1030('0x8')][_0x1030('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d3c04,_0x1e56bf,_0x2d2bfd){return new BPromise(function(_0x42d420,_0x380252){return client[_0x1030('0xa')](_0x3d3c04,_0x2d2bfd)[_0x1030('0xb')](function(_0x4f51f9){logger[_0x1030('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x1e56bf,_0x1030('0xd'));logger[_0x1030('0xe')](_0x1030('0xf'),_0x1e56bf,_0x1030('0xd'),JSON[_0x1030('0x10')](_0x4f51f9));if(_0x4f51f9[_0x1030('0x11')]){if(_0x4f51f9['error'][_0x1030('0x12')]===0x1f4){logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x4f51f9['error'][_0x1030('0x14')]);return _0x380252(_0x4f51f9[_0x1030('0x11')][_0x1030('0x14')]);}logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x4f51f9[_0x1030('0x11')]['message']);return _0x42d420(_0x4f51f9['error'][_0x1030('0x14')]);}else{logger['info'](_0x1030('0x13'),_0x1e56bf,_0x1030('0xd'));_0x42d420(_0x4f51f9[_0x1030('0x15')][_0x1030('0x14')]);}})[_0x1030('0x16')](function(_0x2e44b4){logger[_0x1030('0x11')](_0x1030('0x13'),_0x1e56bf,_0x2e44b4);_0x380252(_0x2e44b4);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index a46b595..6baf4d2 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 _0x38e8=['Router','./license.controller','put','isAuthenticated','update','multer','path'];(function(_0x5d8a61,_0x2ae42c){var _0x25d388=function(_0x428eb5){while(--_0x428eb5){_0x5d8a61['push'](_0x5d8a61['shift']());}};_0x25d388(++_0x2ae42c);}(_0x38e8,0x98));var _0x838e=function(_0x406800,_0x2ac9ad){_0x406800=_0x406800-0x0;var _0xf1c41=_0x38e8[_0x406800];return _0xf1c41;};'use strict';var multer=require(_0x838e('0x0'));var util=require('util');var path=require(_0x838e('0x1'));var express=require('express');var router=express[_0x838e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x838e('0x3'));router['get']('/',controller['index']);router[_0x838e('0x4')]('/:id',auth[_0x838e('0x5')](),controller[_0x838e('0x6')]);module['exports']=router; \ No newline at end of file +var _0x3887=['multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','put','update','exports'];(function(_0x32ccdb,_0x398aa7){var _0x546444=function(_0x593adc){while(--_0x593adc){_0x32ccdb['push'](_0x32ccdb['shift']());}};_0x546444(++_0x398aa7);}(_0x3887,0x82));var _0x7388=function(_0x52adce,_0x5fe2fe){_0x52adce=_0x52adce-0x0;var _0x1d9490=_0x3887[_0x52adce];return _0x1d9490;};'use strict';var multer=require(_0x7388('0x0'));var util=require(_0x7388('0x1'));var path=require('path');var express=require('express');var router=express['Router']();var auth=require(_0x7388('0x2'));var interaction=require(_0x7388('0x3'));var config=require(_0x7388('0x4'));var controller=require(_0x7388('0x5'));router[_0x7388('0x6')]('/',controller['index']);router[_0x7388('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7388('0x8')]);module[_0x7388('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index b740450..b6b79ba 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 _0x195b=['INTEGER','sequelize','exports','TEXT','STRING'];(function(_0x44a23c,_0x1aa147){var _0x506f60=function(_0x58a15c){while(--_0x58a15c){_0x44a23c['push'](_0x44a23c['shift']());}};_0x506f60(++_0x1aa147);}(_0x195b,0x11e));var _0xb195=function(_0xe1865b,_0x2129af){_0xe1865b=_0xe1865b-0x0;var _0x4a313f=_0x195b[_0xe1865b];return _0x4a313f;};'use strict';var Sequelize=require(_0xb195('0x0'));module[_0xb195('0x1')]={'license':{'type':Sequelize[_0xb195('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xb195('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0xb195('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6320=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x103080,_0x40ac65){var _0x2d05a0=function(_0x3f844d){while(--_0x3f844d){_0x103080['push'](_0x103080['shift']());}};_0x2d05a0(++_0x40ac65);}(_0x6320,0xa8));var _0x0632=function(_0x7dbb9d,_0x262278){_0x7dbb9d=_0x7dbb9d-0x0;var _0x1adf16=_0x6320[_0x7dbb9d];return _0x1adf16;};'use strict';var Sequelize=require(_0x0632('0x0'));module[_0x0632('0x1')]={'license':{'type':Sequelize[_0x0632('0x2')]},'data1':{'type':Sequelize[_0x0632('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x0632('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 6d08855..126ab5a 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 _0x2fcf=['apply','reject','save','update','destroy','then','error','stack','send','index','keys','License','query','filters','intersection','model','attributes','fields','length','options','catch','body','find','params','get','checkLicense','key','demo','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range'];(function(_0x5e707b,_0xa3adde){var _0x5857ce=function(_0x5625e4){while(--_0x5625e4){_0x5e707b['push'](_0x5e707b['shift']());}};_0x5857ce(++_0xa3adde);}(_0x2fcf,0x125));var _0xf2fc=function(_0x1b3a09,_0x20c774){_0x1b3a09=_0x1b3a09-0x0;var _0x357bb8=_0x2fcf[_0x1b3a09];return _0x357bb8;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2fc('0x0'));var BPromise=require(_0xf2fc('0x1'));var Mustache=require(_0xf2fc('0x2'));var util=require(_0xf2fc('0x3'));var path=require(_0xf2fc('0x4'));var sox=require('sox');var csv=require(_0xf2fc('0x5'));var ejs=require(_0xf2fc('0x6'));var fs=require('fs');var _=require(_0xf2fc('0x7'));var squel=require(_0xf2fc('0x8'));var crypto=require(_0xf2fc('0x9'));var jsforce=require(_0xf2fc('0xa'));var deskjs=require(_0xf2fc('0xb'));var toCsv=require(_0xf2fc('0x5'));var querystring=require(_0xf2fc('0xc'));var Papa=require('papaparse');var qs=require(_0xf2fc('0xd'));var logger=require(_0xf2fc('0xe'))(_0xf2fc('0xf'));var utils=require(_0xf2fc('0x10'));var config=require(_0xf2fc('0x11'));var db=require(_0xf2fc('0x12'))['db'];function respondWithStatusCode(_0x55a653,_0x277c20){_0x277c20=_0x277c20||0xcc;return function(_0x3783e0){if(_0x3783e0){return _0x55a653[_0xf2fc('0x13')](_0x277c20);}return _0x55a653[_0xf2fc('0x14')](_0x277c20)[_0xf2fc('0x15')]();};}function respondWithResult(_0xdf7296,_0x417ebf){_0x417ebf=_0x417ebf||0xc8;return function(_0xb32d6b){if(_0xb32d6b){return _0xdf7296[_0xf2fc('0x14')](_0x417ebf)['json'](_0xb32d6b);}};}function respondWithFilteredResult(_0x481d2c,_0x3583ad){return function(_0x1d1e53){if(_0x1d1e53){var _0x50b732=_0x1d1e53['count'],_0x29fda2=_0x3583ad[_0xf2fc('0x16')],_0xb8f137=_0x3583ad['offset']+_0x3583ad['limit'],_0x7285e;if(_0xb8f137>=_0x50b732){_0xb8f137=_0x50b732;_0x7285e=0xc8;}else{_0x7285e=0xce;}_0x481d2c[_0xf2fc('0x14')](_0x7285e);return _0x481d2c[_0xf2fc('0x17')](_0xf2fc('0x18'),_0x29fda2+'-'+_0xb8f137+'/'+_0x50b732)['json'](_0x1d1e53);}return null;};}function patchUpdates(_0x69c5d7){return function(_0x59f5e6){try{jsonpatch[_0xf2fc('0x19')](_0x59f5e6,_0x69c5d7,!![]);}catch(_0x5c913d){return BPromise[_0xf2fc('0x1a')](_0x5c913d);}return _0x59f5e6[_0xf2fc('0x1b')]();};}function saveUpdates(_0x5e068f,_0x34f0d2){return function(_0x113463){if(_0x113463){return _0x113463[_0xf2fc('0x1c')](_0x5e068f)['then'](function(_0x2fe91d){return _0x2fe91d;});}return null;};}function removeEntity(_0x529551,_0x25d5f9){return function(_0x241514){if(_0x241514){return _0x241514[_0xf2fc('0x1d')]()[_0xf2fc('0x1e')](function(){_0x529551[_0xf2fc('0x14')](0xcc)[_0xf2fc('0x15')]();});}};}function handleEntityNotFound(_0x252e23,_0x184523){return function(_0x582f4d){if(!_0x582f4d){_0x252e23[_0xf2fc('0x13')](0x194);}return _0x582f4d;};}function handleError(_0x2f7d31,_0x1fcd43){_0x1fcd43=_0x1fcd43||0x1f4;return function(_0x91d2d3){logger[_0xf2fc('0x1f')](_0x91d2d3[_0xf2fc('0x20')]);if(_0x91d2d3['name']){delete _0x91d2d3['name'];}_0x2f7d31['status'](_0x1fcd43)[_0xf2fc('0x21')](_0x91d2d3);};}var utilLicense=require('../../config/license/util');exports[_0xf2fc('0x22')]=function(_0x3a4f20,_0x54e9a2){var _0xbc824d={'raw':!![],'where':{'id':0x1}},_0x28a501={};_0x28a501['model']=_[_0xf2fc('0x23')](db[_0xf2fc('0x24')]['rawAttributes']);_0x28a501[_0xf2fc('0x25')]=_[_0xf2fc('0x23')](_0x3a4f20['query']);_0x28a501[_0xf2fc('0x26')]=_[_0xf2fc('0x27')](_0x28a501[_0xf2fc('0x28')],_0x28a501[_0xf2fc('0x25')]);_0xbc824d[_0xf2fc('0x29')]=_[_0xf2fc('0x27')](_0x28a501[_0xf2fc('0x28')],qs[_0xf2fc('0x2a')](_0x3a4f20[_0xf2fc('0x25')][_0xf2fc('0x2a')]));_0xbc824d[_0xf2fc('0x29')]=_0xbc824d[_0xf2fc('0x29')][_0xf2fc('0x2b')]?_0xbc824d['attributes']:_0x28a501[_0xf2fc('0x28')];_0xbc824d=_['merge']({},_0xbc824d,_0x3a4f20[_0xf2fc('0x2c')]);return utilLicense['getLicense'](_0xbc824d)[_0xf2fc('0x1e')](respondWithResult(_0x54e9a2,null))[_0xf2fc('0x2d')](handleError(_0x54e9a2,null));};exports['update']=function(_0x514775,_0x2f2811){if(_0x514775[_0xf2fc('0x2e')]['id']){delete _0x514775[_0xf2fc('0x2e')]['id'];}return db[_0xf2fc('0x24')][_0xf2fc('0x2f')]({'where':{'id':_0x514775[_0xf2fc('0x30')]['id']}})['then'](handleEntityNotFound(_0x2f2811,null))[_0xf2fc('0x1e')](function(_0x57856d){var _0x189c27=_0x57856d[_0xf2fc('0x31')]({'plain':!![]});return utilLicense[_0xf2fc('0x32')](_0x189c27,_0x514775['body'][_0xf2fc('0x33')]);})[_0xf2fc('0x1e')](function(_0x3a7364){if(!_0x3a7364[_0xf2fc('0x34')]){return saveUpdates(_0x514775['body'],null);}return _0x3a7364;})['then'](respondWithResult(_0x2f2811,null))[_0xf2fc('0x2d')](handleError(_0x2f2811,null));}; \ No newline at end of file +var _0xd897=['end','count','offset','limit','status','set','Content-Range','json','apply','save','update','then','error','stack','name','../../config/license/util','model','keys','License','query','filters','intersection','fields','attributes','length','merge','options','getLicense','catch','body','params','get','checkLicense','key','demo','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/logger','../../config/utils','../../mysqldb','sendStatus'];(function(_0x37ce3e,_0xebe77f){var _0x1309d9=function(_0x14cdeb){while(--_0x14cdeb){_0x37ce3e['push'](_0x37ce3e['shift']());}};_0x1309d9(++_0xebe77f);}(_0xd897,0x127));var _0x7d89=function(_0x13a7f0,_0x458815){_0x13a7f0=_0x13a7f0-0x0;var _0x3b897d=_0xd897[_0x13a7f0];return _0x3b897d;};'use strict';var jsonpatch=require(_0x7d89('0x0'));var rp=require(_0x7d89('0x1'));var moment=require('moment');var BPromise=require(_0x7d89('0x2'));var Mustache=require('mustache');var util=require(_0x7d89('0x3'));var path=require(_0x7d89('0x4'));var sox=require('sox');var csv=require(_0x7d89('0x5'));var ejs=require(_0x7d89('0x6'));var fs=require('fs');var _=require(_0x7d89('0x7'));var squel=require(_0x7d89('0x8'));var crypto=require(_0x7d89('0x9'));var jsforce=require(_0x7d89('0xa'));var deskjs=require(_0x7d89('0xb'));var toCsv=require(_0x7d89('0x5'));var querystring=require(_0x7d89('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x7d89('0xd'))('api');var utils=require(_0x7d89('0xe'));var config=require('../../config/environment');var db=require(_0x7d89('0xf'))['db'];function respondWithStatusCode(_0x3fa0a4,_0x44d869){_0x44d869=_0x44d869||0xcc;return function(_0x22f9e3){if(_0x22f9e3){return _0x3fa0a4[_0x7d89('0x10')](_0x44d869);}return _0x3fa0a4['status'](_0x44d869)[_0x7d89('0x11')]();};}function respondWithResult(_0x237a25,_0x333e8d){_0x333e8d=_0x333e8d||0xc8;return function(_0x3e58a3){if(_0x3e58a3){return _0x237a25['status'](_0x333e8d)['json'](_0x3e58a3);}};}function respondWithFilteredResult(_0x1a2f2b,_0x5bda9b){return function(_0x355475){if(_0x355475){var _0x7b7565=_0x355475[_0x7d89('0x12')],_0x296855=_0x5bda9b[_0x7d89('0x13')],_0x4113bb=_0x5bda9b[_0x7d89('0x13')]+_0x5bda9b[_0x7d89('0x14')],_0x5e53e9;if(_0x4113bb>=_0x7b7565){_0x4113bb=_0x7b7565;_0x5e53e9=0xc8;}else{_0x5e53e9=0xce;}_0x1a2f2b[_0x7d89('0x15')](_0x5e53e9);return _0x1a2f2b[_0x7d89('0x16')](_0x7d89('0x17'),_0x296855+'-'+_0x4113bb+'/'+_0x7b7565)[_0x7d89('0x18')](_0x355475);}return null;};}function patchUpdates(_0x485f7f){return function(_0x2842d9){try{jsonpatch[_0x7d89('0x19')](_0x2842d9,_0x485f7f,!![]);}catch(_0x4a90e7){return BPromise['reject'](_0x4a90e7);}return _0x2842d9[_0x7d89('0x1a')]();};}function saveUpdates(_0xc16703,_0x1bad44){return function(_0x4ee445){if(_0x4ee445){return _0x4ee445[_0x7d89('0x1b')](_0xc16703)[_0x7d89('0x1c')](function(_0x47d7fa){return _0x47d7fa;});}return null;};}function removeEntity(_0x7eea41,_0x58a0aa){return function(_0x302107){if(_0x302107){return _0x302107['destroy']()['then'](function(){_0x7eea41['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166cc1,_0x555046){return function(_0x4c882e){if(!_0x4c882e){_0x166cc1[_0x7d89('0x10')](0x194);}return _0x4c882e;};}function handleError(_0x3bf663,_0xddec94){_0xddec94=_0xddec94||0x1f4;return function(_0x3696af){logger[_0x7d89('0x1d')](_0x3696af[_0x7d89('0x1e')]);if(_0x3696af[_0x7d89('0x1f')]){delete _0x3696af[_0x7d89('0x1f')];}_0x3bf663['status'](_0xddec94)['send'](_0x3696af);};}var utilLicense=require(_0x7d89('0x20'));exports['index']=function(_0x563672,_0x4e3dc6){var _0x45d573={'raw':!![],'where':{'id':0x1}},_0x517981={};_0x517981[_0x7d89('0x21')]=_[_0x7d89('0x22')](db[_0x7d89('0x23')]['rawAttributes']);_0x517981[_0x7d89('0x24')]=_['keys'](_0x563672[_0x7d89('0x24')]);_0x517981[_0x7d89('0x25')]=_[_0x7d89('0x26')](_0x517981['model'],_0x517981[_0x7d89('0x24')]);_0x45d573['attributes']=_[_0x7d89('0x26')](_0x517981[_0x7d89('0x21')],qs[_0x7d89('0x27')](_0x563672['query']['fields']));_0x45d573[_0x7d89('0x28')]=_0x45d573[_0x7d89('0x28')][_0x7d89('0x29')]?_0x45d573[_0x7d89('0x28')]:_0x517981['model'];_0x45d573=_[_0x7d89('0x2a')]({},_0x45d573,_0x563672[_0x7d89('0x2b')]);return utilLicense[_0x7d89('0x2c')](_0x45d573)['then'](respondWithResult(_0x4e3dc6,null))[_0x7d89('0x2d')](handleError(_0x4e3dc6,null));};exports[_0x7d89('0x1b')]=function(_0x3dff08,_0x2500c6){if(_0x3dff08['body']['id']){delete _0x3dff08[_0x7d89('0x2e')]['id'];}return db[_0x7d89('0x23')]['find']({'where':{'id':_0x3dff08[_0x7d89('0x2f')]['id']}})[_0x7d89('0x1c')](handleEntityNotFound(_0x2500c6,null))[_0x7d89('0x1c')](function(_0x33d409){var _0x27eb28=_0x33d409[_0x7d89('0x30')]({'plain':!![]});return utilLicense[_0x7d89('0x31')](_0x27eb28,_0x3dff08['body'][_0x7d89('0x32')]);})[_0x7d89('0x1c')](function(_0x990c){if(!_0x990c[_0x7d89('0x33')]){return saveUpdates(_0x3dff08['body'],null);}return _0x990c;})[_0x7d89('0x1c')](respondWithResult(_0x2500c6,null))[_0x7d89('0x2d')](handleError(_0x2500c6,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 6cdabde..23057ac 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 _0xe64a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./license.attributes','License','license'];(function(_0xd204b0,_0x4c7d1d){var _0xfc8310=function(_0x4f4b5a){while(--_0x4f4b5a){_0xd204b0['push'](_0xd204b0['shift']());}};_0xfc8310(++_0x4c7d1d);}(_0xe64a,0x1e0));var _0xae64=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe64a[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var logger=require(_0xae64('0x2'))(_0xae64('0x3'));var moment=require(_0xae64('0x4'));var BPromise=require(_0xae64('0x5'));var rp=require(_0xae64('0x6'));var attributes=require(_0xae64('0x7'));module['exports']=function(_0x4a2982,_0x5f5b89){return _0x4a2982['define'](_0xae64('0x8'),attributes,{'tableName':_0xae64('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd58c=['../../config/logger','moment','request-promise','exports','define','License','lodash','util'];(function(_0x4c2294,_0x984c5){var _0x4f9a06=function(_0x4e392c){while(--_0x4e392c){_0x4c2294['push'](_0x4c2294['shift']());}};_0x4f9a06(++_0x984c5);}(_0xd58c,0xb6));var _0xcd58=function(_0x368c56,_0x1b7db9){_0x368c56=_0x368c56-0x0;var _0x4de7cc=_0xd58c[_0x368c56];return _0x4de7cc;};'use strict';var _=require(_0xcd58('0x0'));var util=require(_0xcd58('0x1'));var logger=require(_0xcd58('0x2'))('api');var moment=require(_0xcd58('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd58('0x4'));var attributes=require('./license.attributes');module[_0xcd58('0x5')]=function(_0x2a22bd,_0x2f4382){return _0x2a22bd[_0xcd58('0x6')](_0xcd58('0x7'),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 f6c00b2..5c52d9a 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 _0x43f2=['moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x321118,_0x39f50c){var _0x299425=function(_0x2c956d){while(--_0x2c956d){_0x321118['push'](_0x321118['shift']());}};_0x299425(++_0x39f50c);}(_0x43f2,0x1d9));var _0x243f=function(_0x3fd8c7,_0xc76d47){_0x3fd8c7=_0x3fd8c7-0x0;var _0x3831c3=_0x43f2[_0x3fd8c7];return _0x3831c3;};'use strict';var _=require(_0x243f('0x0'));var util=require(_0x243f('0x1'));var moment=require(_0x243f('0x2'));var BPromise=require(_0x243f('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x243f('0x4'))['db'];var utils=require(_0x243f('0x5'));var logger=require(_0x243f('0x6'))(_0x243f('0x7'));var config=require(_0x243f('0x8'));var jayson=require(_0x243f('0x9'));var client=jayson[_0x243f('0xa')][_0x243f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50c5b9,_0x319468,_0x526b35){return new BPromise(function(_0x3abbf2,_0x5be43b){return client[_0x243f('0xc')](_0x50c5b9,_0x526b35)[_0x243f('0xd')](function(_0x32effc){logger['info'](_0x243f('0xe'),_0x319468,_0x243f('0xf'));logger[_0x243f('0x10')](_0x243f('0x11'),_0x319468,_0x243f('0xf'),JSON[_0x243f('0x12')](_0x32effc));if(_0x32effc[_0x243f('0x13')]){if(_0x32effc[_0x243f('0x13')][_0x243f('0x14')]===0x1f4){logger[_0x243f('0x13')]('License,\x20%s,\x20%s',_0x319468,_0x32effc['error']['message']);return _0x5be43b(_0x32effc[_0x243f('0x13')][_0x243f('0x15')]);}logger['error'](_0x243f('0xe'),_0x319468,_0x32effc[_0x243f('0x13')][_0x243f('0x15')]);return _0x3abbf2(_0x32effc[_0x243f('0x13')][_0x243f('0x15')]);}else{logger[_0x243f('0x16')](_0x243f('0xe'),_0x319468,_0x243f('0xf'));_0x3abbf2(_0x32effc[_0x243f('0x17')][_0x243f('0x15')]);}})[_0x243f('0x18')](function(_0x1bbcc6){logger[_0x243f('0x13')](_0x243f('0xe'),_0x319468,_0x1bbcc6);_0x5be43b(_0x1bbcc6);});});} \ No newline at end of file +var _0xbcfe=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x263f9d,_0x3d854e){var _0x4c4efa=function(_0x48d506){while(--_0x48d506){_0x263f9d['push'](_0x263f9d['shift']());}};_0x4c4efa(++_0x3d854e);}(_0xbcfe,0x1f0));var _0xebcf=function(_0x557761,_0x5d3f43){_0x557761=_0x557761-0x0;var _0x1e88de=_0xbcfe[_0x557761];return _0x1e88de;};'use strict';var _=require(_0xebcf('0x0'));var util=require(_0xebcf('0x1'));var moment=require('moment');var BPromise=require(_0xebcf('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xebcf('0x3'))['db'];var utils=require(_0xebcf('0x4'));var logger=require(_0xebcf('0x5'))(_0xebcf('0x6'));var config=require('../../config/environment');var jayson=require(_0xebcf('0x7'));var client=jayson[_0xebcf('0x8')][_0xebcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x78e13e,_0x3d93a2,_0x55ee77){return new BPromise(function(_0x126948,_0x5e3bac){return client[_0xebcf('0xa')](_0x78e13e,_0x55ee77)[_0xebcf('0xb')](function(_0x31f251){logger[_0xebcf('0xc')](_0xebcf('0xd'),_0x3d93a2,_0xebcf('0xe'));logger[_0xebcf('0xf')](_0xebcf('0x10'),_0x3d93a2,_0xebcf('0xe'),JSON[_0xebcf('0x11')](_0x31f251));if(_0x31f251[_0xebcf('0x12')]){if(_0x31f251[_0xebcf('0x12')][_0xebcf('0x13')]===0x1f4){logger[_0xebcf('0x12')](_0xebcf('0xd'),_0x3d93a2,_0x31f251[_0xebcf('0x12')]['message']);return _0x5e3bac(_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);}logger[_0xebcf('0x12')](_0xebcf('0xd'),_0x3d93a2,_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);return _0x126948(_0x31f251[_0xebcf('0x12')][_0xebcf('0x14')]);}else{logger[_0xebcf('0xc')](_0xebcf('0xd'),_0x3d93a2,_0xebcf('0xe'));_0x126948(_0x31f251['result'][_0xebcf('0x14')]);}})['catch'](function(_0x29ae25){logger['error'](_0xebcf('0xd'),_0x3d93a2,_0x29ae25);_0x5e3bac(_0x29ae25);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 8f46016..3efb75c 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 _0x8bec=['removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/:id','/:id/dispositions','/:id/canned_answers','getImap','/:id/out_servers','getInteractions','/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addSmtp','/:id/interactions','addInteraction','addApplications','/:id/send','send','addAgents','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp'];(function(_0x16787f,_0x5b5a74){var _0x334ad6=function(_0x5d734e){while(--_0x5d734e){_0x16787f['push'](_0x16787f['shift']());}};_0x334ad6(++_0x5b5a74);}(_0x8bec,0x83));var _0xc8be=function(_0x4f9976,_0x266742){_0x4f9976=_0x4f9976-0x0;var _0x2ddf39=_0x8bec[_0x4f9976];return _0x2ddf39;};'use strict';var multer=require(_0xc8be('0x0'));var util=require(_0xc8be('0x1'));var path=require(_0xc8be('0x2'));var express=require(_0xc8be('0x3'));var router=express['Router']();var auth=require(_0xc8be('0x4'));var interaction=require(_0xc8be('0x5'));var config=require(_0xc8be('0x6'));var controller=require(_0xc8be('0x7'));router[_0xc8be('0x8')]('/',auth[_0xc8be('0x9')](),controller['index']);router['get']('/describe',auth[_0xc8be('0x9')](),controller['describe']);router['get'](_0xc8be('0xa'),auth[_0xc8be('0x9')](),controller['show']);router['get'](_0xc8be('0xb'),auth[_0xc8be('0x9')](),controller['getDispositions']);router[_0xc8be('0x8')](_0xc8be('0xc'),auth[_0xc8be('0x9')](),controller['getAnswers']);router['get']('/:id/in_servers',auth[_0xc8be('0x9')](),controller[_0xc8be('0xd')]);router['get'](_0xc8be('0xe'),auth['isAuthenticated'](),controller['getSmtp']);router[_0xc8be('0x8')]('/:id/interactions',auth[_0xc8be('0x9')](),controller[_0xc8be('0xf')]);router['get'](_0xc8be('0x10'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x11')]);router[_0xc8be('0x8')]('/:id/messages',auth[_0xc8be('0x9')](),controller[_0xc8be('0x12')]);router['get'](_0xc8be('0x13'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x14')]);router[_0xc8be('0x8')](_0xc8be('0x15'),auth['isAuthenticated'](),controller[_0xc8be('0x16')]);router[_0xc8be('0x17')](_0xc8be('0xb'),auth['isAuthenticated'](),controller[_0xc8be('0x18')]);router[_0xc8be('0x17')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc8be('0x19')]);router[_0xc8be('0x17')]('/',auth[_0xc8be('0x9')](),controller[_0xc8be('0x1a')]);router[_0xc8be('0x17')](_0xc8be('0x1b'),auth[_0xc8be('0x9')](),controller['addImap']);router[_0xc8be('0x17')](_0xc8be('0xe'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x1c')]);router[_0xc8be('0x17')](_0xc8be('0x1d'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x1e')]);router[_0xc8be('0x17')](_0xc8be('0x10'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x1f')]);router[_0xc8be('0x17')](_0xc8be('0x20'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x21')]);router['post'](_0xc8be('0x15'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x22')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc8be('0x23')]);router[_0xc8be('0x24')](_0xc8be('0xb'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x25')]);router[_0xc8be('0x24')]('/:id/canned_answers',auth[_0xc8be('0x9')](),controller[_0xc8be('0x26')]);router[_0xc8be('0x24')](_0xc8be('0x1b'),auth['isAuthenticated'](),controller[_0xc8be('0x27')]);router['delete'](_0xc8be('0xe'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x28')]);router[_0xc8be('0x24')](_0xc8be('0xa'),auth[_0xc8be('0x9')](),controller['destroy']);router['delete'](_0xc8be('0x15'),auth[_0xc8be('0x9')](),controller[_0xc8be('0x29')]);module[_0xc8be('0x2a')]=router; \ No newline at end of file +var _0xa478=['/describe','describe','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','/:id/users','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addApplications','send','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','/:id','destroy','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa478,0x136));var _0x8a47=function(_0xd60031,_0x5efb93){_0xd60031=_0xd60031-0x0;var _0x43d00a=_0xa478[_0xd60031];return _0x43d00a;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var express=require(_0x8a47('0x3'));var router=express[_0x8a47('0x4')]();var auth=require(_0x8a47('0x5'));var interaction=require(_0x8a47('0x6'));var config=require(_0x8a47('0x7'));var controller=require(_0x8a47('0x8'));router[_0x8a47('0x9')]('/',auth[_0x8a47('0xa')](),controller[_0x8a47('0xb')]);router['get'](_0x8a47('0xc'),auth[_0x8a47('0xa')](),controller[_0x8a47('0xd')]);router[_0x8a47('0x9')]('/:id',auth[_0x8a47('0xa')](),controller['show']);router[_0x8a47('0x9')](_0x8a47('0xe'),auth[_0x8a47('0xa')](),controller['getDispositions']);router[_0x8a47('0x9')](_0x8a47('0xf'),auth['isAuthenticated'](),controller[_0x8a47('0x10')]);router['get'](_0x8a47('0x11'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x12')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0x8a47('0x13')]);router[_0x8a47('0x9')]('/:id/interactions',auth[_0x8a47('0xa')](),controller[_0x8a47('0x14')]);router[_0x8a47('0x9')](_0x8a47('0x15'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x16')]);router[_0x8a47('0x9')](_0x8a47('0x17'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x18')]);router[_0x8a47('0x9')](_0x8a47('0x19'),auth[_0x8a47('0xa')](),controller['verifySmtp']);router[_0x8a47('0x9')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller['getAgents']);router[_0x8a47('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x8a47('0x1c')]);router[_0x8a47('0x1b')](_0x8a47('0xf'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x1d')]);router[_0x8a47('0x1b')]('/',auth[_0x8a47('0xa')](),controller[_0x8a47('0x1e')]);router[_0x8a47('0x1b')](_0x8a47('0x11'),auth['isAuthenticated'](),controller[_0x8a47('0x1f')]);router['post'](_0x8a47('0x20'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x21')]);router[_0x8a47('0x1b')]('/:id/interactions',auth[_0x8a47('0xa')](),controller['addInteraction']);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x8a47('0x22')]);router[_0x8a47('0x1b')]('/:id/send',auth[_0x8a47('0xa')](),controller[_0x8a47('0x23')]);router[_0x8a47('0x1b')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x24')]);router[_0x8a47('0x25')]('/:id',auth[_0x8a47('0xa')](),controller['update']);router[_0x8a47('0x26')](_0x8a47('0xe'),auth['isAuthenticated'](),controller[_0x8a47('0x27')]);router['delete']('/:id/canned_answers',auth[_0x8a47('0xa')](),controller[_0x8a47('0x28')]);router[_0x8a47('0x26')](_0x8a47('0x11'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x29')]);router['delete'](_0x8a47('0x20'),auth['isAuthenticated'](),controller['removeSmtp']);router[_0x8a47('0x26')](_0x8a47('0x2a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x2b')]);router[_0x8a47('0x26')](_0x8a47('0x1a'),auth[_0x8a47('0xa')](),controller[_0x8a47('0x2c')]);module[_0x8a47('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 38fe184..2fc47af 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 _0x9099=['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}}','sequelize','STRING','BOOLEAN','TEXT'];(function(_0x552fa1,_0x1985c7){var _0x5eac48=function(_0x21c6e0){while(--_0x21c6e0){_0x552fa1['push'](_0x552fa1['shift']());}};_0x5eac48(++_0x1985c7);}(_0x9099,0x1ac));var _0x9909=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0x9099[_0x5037ab];return _0x512adb;};'use strict';var Sequelize=require(_0x9909('0x0'));module['exports']={'description':{'type':Sequelize[_0x9909('0x1')]},'name':{'type':Sequelize[_0x9909('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9909('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9909('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9909('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9909('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9909('0x3')]},'markAsUnread':{'type':Sequelize[_0x9909('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9909('0x1')],'allowNull':![],'defaultValue':_0x9909('0x4')},'fontSize':{'type':Sequelize[_0x9909('0x5')](0x2)[_0x9909('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9909('0x3')],'defaultValue':function(){return _0x9909('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9909('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9909('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x4899=['TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','sequelize','STRING','BOOLEAN'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0x4899,0x74));var _0x9489=function(_0x2bf8ae,_0x48ef3e){_0x2bf8ae=_0x2bf8ae-0x0;var _0x27ee6f=_0x4899[_0x2bf8ae];return _0x27ee6f;};'use strict';var Sequelize=require(_0x9489('0x0'));module['exports']={'description':{'type':Sequelize[_0x9489('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9489('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9489('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9489('0x3')]},'markAsUnread':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9489('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x9489('0x4')](0x2)[_0x9489('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9489('0x3')],'defaultValue':function(){return _0x9489('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9489('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9489('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9489('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 28c064b..38795ce 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 _0x7217=['port','service','user','pass','cpassword','getImap','setImap','getSmtp','findOne','addSmtp','removeSmtp','addInteraction','MailInteraction','map','CmContact','Contact','User','fullname','internal','Tag','color','tag','addApplications','sequelize','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','updatedAt','from','attachments','root','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','./mailAccount.socket','register','jayson/promise','client','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','destroy','stack','name','index','MailServerIn','Imap','MailServerOut','Smtp','rawAttributes','keys','query','dateStart','dateEnd','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','filter','options','include','MailAccount','rows','params','includeAll','find','update','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','removeDispositions','ids','addAnswer','create','getAnswers','CannedAnswer','findAll','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','cuser','password','authentication','host'];(function(_0x1cadd9,_0x4e73e9){var _0x3778e0=function(_0x50fe71){while(--_0x50fe71){_0x1cadd9['push'](_0x1cadd9['shift']());}};_0x3778e0(++_0x4e73e9);}(_0x7217,0x19e));var _0x7721=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x7217[_0x34bc30];return _0x5706de;};'use strict';var jsonpatch=require(_0x7721('0x0'));var rp=require('request-promise');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var Mustache=require(_0x7721('0x3'));var util=require(_0x7721('0x4'));var path=require(_0x7721('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7721('0x6'));var fs=require('fs');var _=require(_0x7721('0x7'));var squel=require(_0x7721('0x8'));var crypto=require(_0x7721('0x9'));var jsforce=require(_0x7721('0xa'));var deskjs=require(_0x7721('0xb'));var toCsv=require(_0x7721('0xc'));var querystring=require(_0x7721('0xd'));var Papa=require(_0x7721('0xe'));var qs=require(_0x7721('0xf'));var logger=require(_0x7721('0x10'))(_0x7721('0x11'));var utils=require(_0x7721('0x12'));var config=require(_0x7721('0x13'));var db=require(_0x7721('0x14'))['db'];var socket=require('socket.io-emitter')({'host':_0x7721('0x15'),'port':0x18eb});require(_0x7721('0x16'))[_0x7721('0x17')](socket);var jayson=require(_0x7721('0x18'));var client=jayson[_0x7721('0x19')][_0x7721('0x1a')]({'port':0x232b});function respondWithRpcPromise(_0x1e7fd7,_0x27b36b,_0x55b4ca,_0x2911ec){return new BPromise(function(_0x199930,_0x57ff6d){var _0x109900=_0x2911ec||client;return _0x109900[_0x7721('0x1b')](_0x1e7fd7,_0x55b4ca)[_0x7721('0x1c')](function(_0x2e9752){logger['info'](_0x7721('0x1d'),_0x27b36b,_0x7721('0x1e'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x27b36b,'request\x20sent',JSON[_0x7721('0x1f')](_0x2e9752));if(_0x2e9752[_0x7721('0x20')]){if(_0x2e9752[_0x7721('0x20')][_0x7721('0x21')]===0x1f4){logger['error'](_0x7721('0x1d'),_0x27b36b,_0x2e9752['error'][_0x7721('0x22')]);return _0x57ff6d(_0x2e9752['error'][_0x7721('0x22')]);}logger[_0x7721('0x20')](_0x7721('0x1d'),_0x27b36b,_0x2e9752[_0x7721('0x20')][_0x7721('0x22')]);return _0x199930(_0x2e9752[_0x7721('0x20')][_0x7721('0x22')]);}else{logger[_0x7721('0x23')](_0x7721('0x1d'),_0x27b36b,_0x7721('0x1e'));_0x199930(_0x2e9752['result'][_0x7721('0x22')]);}})[_0x7721('0x24')](function(_0x3a053f){logger[_0x7721('0x20')]('MailAccount,\x20%s,\x20%s',_0x27b36b,_0x3a053f);_0x57ff6d(_0x3a053f);});});}function respondWithStatusCode(_0x28f5a6,_0x512f31){_0x512f31=_0x512f31||0xcc;return function(_0xb9e9dd){if(_0xb9e9dd){return _0x28f5a6[_0x7721('0x25')](_0x512f31);}return _0x28f5a6[_0x7721('0x26')](_0x512f31)[_0x7721('0x27')]();};}function respondWithResult(_0x121cc4,_0x395b15){_0x395b15=_0x395b15||0xc8;return function(_0x2c6b7b){if(_0x2c6b7b){return _0x121cc4['status'](_0x395b15)[_0x7721('0x28')](_0x2c6b7b);}};}function respondWithFilteredResult(_0x1abedb,_0x125564){return function(_0x1f67c7){if(_0x1f67c7){var _0x40d550=_0x1f67c7[_0x7721('0x29')],_0x16355a=_0x125564['offset'],_0x424e05=_0x125564[_0x7721('0x2a')]+_0x125564['limit'],_0xf753f1;if(_0x424e05>=_0x40d550){_0x424e05=_0x40d550;_0xf753f1=0xc8;}else{_0xf753f1=0xce;}_0x1abedb['status'](_0xf753f1);return _0x1abedb[_0x7721('0x2b')](_0x7721('0x2c'),_0x16355a+'-'+_0x424e05+'/'+_0x40d550)[_0x7721('0x28')](_0x1f67c7);}return null;};}function patchUpdates(_0x158d98){return function(_0x1ea4d){try{jsonpatch[_0x7721('0x2d')](_0x1ea4d,_0x158d98,!![]);}catch(_0xd7d703){return BPromise[_0x7721('0x2e')](_0xd7d703);}return _0x1ea4d['save']();};}function saveUpdates(_0x471651,_0x2871c5){return function(_0x497f9f){if(_0x497f9f){return _0x497f9f['update'](_0x471651)[_0x7721('0x1c')](function(_0x220bbf){return _0x220bbf;});}return null;};}function removeEntity(_0x48f329,_0x46f772){return function(_0x4651b5){if(_0x4651b5){return _0x4651b5[_0x7721('0x2f')]()['then'](function(){_0x48f329[_0x7721('0x26')](0xcc)[_0x7721('0x27')]();});}};}function handleEntityNotFound(_0x1492d4,_0x3f15e2){return function(_0xc0f3c4){if(!_0xc0f3c4){_0x1492d4['sendStatus'](0x194);}return _0xc0f3c4;};}function handleError(_0x195ffb,_0x3e4e56){_0x3e4e56=_0x3e4e56||0x1f4;return function(_0xb2386d){logger['error'](_0xb2386d[_0x7721('0x30')]);if(_0xb2386d[_0x7721('0x31')]){delete _0xb2386d['name'];}_0x195ffb[_0x7721('0x26')](_0x3e4e56)['send'](_0xb2386d);};}exports[_0x7721('0x32')]=function(_0x326c50,_0x19d082){var _0x1d894b={'include':[{'model':db[_0x7721('0x33')],'as':_0x7721('0x34')},{'model':db[_0x7721('0x35')],'as':_0x7721('0x36')}]},_0x1c84c0={},_0x13c635={'count':0x0,'rows':[]};var _0x385454=db['MailAccount'][_0x7721('0x37')];_0x1c84c0['model']=_[_0x7721('0x38')](_0x385454);var _0x35614c={'dateStart':_0x326c50[_0x7721('0x39')][_0x7721('0x3a')],'dateEnd':_0x326c50[_0x7721('0x39')][_0x7721('0x3b')]};delete _0x326c50['query']['dateStart'];delete _0x326c50['query']['dateEnd'];_0x1c84c0[_0x7721('0x39')]=_[_0x7721('0x38')](_0x326c50[_0x7721('0x39')]);_0x1c84c0[_0x7721('0x3c')]=_['intersection'](_0x1c84c0[_0x7721('0x3d')],_0x1c84c0['query']);_0x1d894b[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x1c84c0['model'],qs[_0x7721('0x40')](_0x326c50[_0x7721('0x39')]['fields']));_0x1d894b['attributes']=_0x1d894b[_0x7721('0x3e')][_0x7721('0x41')]?_0x1d894b[_0x7721('0x3e')]:_0x1c84c0[_0x7721('0x3d')];if(!_0x326c50['query'][_0x7721('0x42')](_0x7721('0x43'))){_0x1d894b[_0x7721('0x44')]=qs[_0x7721('0x44')](_0x326c50[_0x7721('0x39')]['limit']);_0x1d894b[_0x7721('0x2a')]=qs['offset'](_0x326c50[_0x7721('0x39')]['offset']);}_0x1d894b[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x326c50[_0x7721('0x39')]['sort']);_0x1d894b[_0x7721('0x47')]=qs[_0x7721('0x3c')](_[_0x7721('0x48')](_0x326c50['query'],_0x1c84c0[_0x7721('0x3c')]));if(_0x35614c[_0x7721('0x3a')]){if(_0x35614c[_0x7721('0x3b')]){_0x35614c[_0x7721('0x3b')]=moment(_0x35614c[_0x7721('0x3b')])[_0x7721('0x49')](0x1,_0x7721('0x4a'));}else{_0x35614c['dateEnd']=moment(_0x35614c['dateStart'])[_0x7721('0x49')](0x1,_0x7721('0x4a'));}_[_0x7721('0x4b')](_0x1d894b[_0x7721('0x47')],{'createdAt':{'$gte':_0x35614c[_0x7721('0x3a')],'$lte':_0x35614c[_0x7721('0x3b')]}});}if(_0x326c50[_0x7721('0x39')][_0x7721('0x4c')]){_0x1d894b[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x1d894b['where'],{'$or':_['map'](_0x1d894b[_0x7721('0x3e')],function(_0x6a4664){var _0x151f69={};_0x151f69[_0x6a4664]={'$like':'%'+_0x326c50[_0x7721('0x39')]['filter']+'%'};return _0x151f69;})});}_0x1d894b=_[_0x7721('0x4b')]({},_0x1d894b,_0x326c50[_0x7721('0x4d')]);var _0x56c3d9={'where':_0x1d894b[_0x7721('0x47')]};return db['MailAccount'][_0x7721('0x29')](_0x56c3d9)['then'](function(_0x334f23){_0x13c635[_0x7721('0x29')]=_0x334f23;if(_0x326c50[_0x7721('0x39')]['includeAll']){_0x1d894b[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x4f')]['findAll'](_0x1d894b);})[_0x7721('0x1c')](function(_0x1196c2){_0x13c635[_0x7721('0x50')]=_0x1196c2;return _0x13c635;})['then'](respondWithFilteredResult(_0x19d082,_0x1d894b))[_0x7721('0x24')](handleError(_0x19d082,null));};exports['show']=function(_0xdb1ca8,_0x310549){var _0x4738ef={'raw':![],'where':{'id':_0xdb1ca8[_0x7721('0x51')]['id']},'include':[{'model':db[_0x7721('0x33')],'as':_0x7721('0x34')},{'model':db[_0x7721('0x35')],'as':_0x7721('0x36')}]},_0x443503={};_0x443503[_0x7721('0x3d')]=_[_0x7721('0x38')](db[_0x7721('0x4f')][_0x7721('0x37')]);_0x443503[_0x7721('0x39')]=_[_0x7721('0x38')](_0xdb1ca8['query']);_0x443503[_0x7721('0x3c')]=_[_0x7721('0x3f')](_0x443503[_0x7721('0x3d')],_0x443503[_0x7721('0x39')]);_0x4738ef[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x443503[_0x7721('0x3d')],qs['fields'](_0xdb1ca8[_0x7721('0x39')][_0x7721('0x40')]));_0x4738ef[_0x7721('0x3e')]=_0x4738ef[_0x7721('0x3e')][_0x7721('0x41')]?_0x4738ef[_0x7721('0x3e')]:_0x443503[_0x7721('0x3d')];if(_0xdb1ca8[_0x7721('0x39')][_0x7721('0x52')]){_0x4738ef[_0x7721('0x4e')]=[{'all':!![]}];}_0x4738ef=_[_0x7721('0x4b')]({},_0x4738ef,_0xdb1ca8['options']);return db[_0x7721('0x4f')][_0x7721('0x53')](_0x4738ef)[_0x7721('0x1c')](handleEntityNotFound(_0x310549,null))[_0x7721('0x1c')](respondWithResult(_0x310549,null))[_0x7721('0x24')](handleError(_0x310549,null));};exports[_0x7721('0x54')]=function(_0x41644f,_0x36fe6f){if(_0x41644f[_0x7721('0x55')]['id']){delete _0x41644f[_0x7721('0x55')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x41644f[_0x7721('0x51')]['id']},'include':[{'model':db[_0x7721('0x33')],'as':_0x7721('0x34')},{'model':db['MailServerOut'],'as':'Smtp'}]})['then'](handleEntityNotFound(_0x36fe6f,null))[_0x7721('0x1c')](saveUpdates(_0x41644f['body'],null))['then'](function(_0x57348c){if(_0x57348c&&_0x41644f['body'][_0x7721('0x34')]){return db[_0x7721('0x33')][_0x7721('0x54')](_0x41644f['body'][_0x7721('0x34')],{'where':{'MailAccountId':_0x57348c['id']}})['then'](function(){return _0x57348c;});}return _0x57348c;})['then'](function(_0x484b8e){if(_0x484b8e&&_0x41644f[_0x7721('0x55')]['Smtp']){return db['MailServerOut']['update'](_0x41644f[_0x7721('0x55')][_0x7721('0x36')],{'where':{'MailAccountId':_0x484b8e['id']}})[_0x7721('0x1c')](function(){return _0x484b8e;});}return _0x484b8e;})['then'](respondWithResult(_0x36fe6f,null))[_0x7721('0x24')](handleError(_0x36fe6f,null));};exports[_0x7721('0x56')]=function(_0x2c95d0,_0x168343){return db[_0x7721('0x4f')][_0x7721('0x56')]()[_0x7721('0x1c')](respondWithResult(_0x168343,null))[_0x7721('0x24')](handleError(_0x168343,null));};exports[_0x7721('0x57')]=function(_0x197b73,_0x3b03cf,_0x10666e){if(_0x197b73[_0x7721('0x55')]['id']){delete _0x197b73[_0x7721('0x55')]['id'];}return db[_0x7721('0x4f')]['find']({'where':{'id':_0x197b73[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x3b03cf,null))[_0x7721('0x1c')](function(_0xb6db23){if(_0xb6db23){_0x197b73['body'][_0x7721('0x58')]=_0xb6db23['id'];return db[_0x7721('0x59')]['create'](_0x197b73[_0x7721('0x55')]);}})['then'](respondWithResult(_0x3b03cf,null))[_0x7721('0x24')](handleError(_0x3b03cf,null));};exports[_0x7721('0x5a')]=function(_0x36a3a6,_0x3f9eaa,_0x3d2b7d){var _0x158aae={'raw':![],'where':{}};var _0x3121e0={};var _0x167ce7={'count':0x0,'rows':[]};return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x36a3a6[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x3f9eaa,null))[_0x7721('0x1c')](function(_0x3a11e2){if(_0x3a11e2){_0x3121e0[_0x7721('0x3d')]=_[_0x7721('0x38')](db[_0x7721('0x59')]['rawAttributes']);_0x3121e0[_0x7721('0x39')]=_[_0x7721('0x38')](_0x36a3a6['query']);_0x3121e0[_0x7721('0x3c')]=_['intersection'](_0x3121e0[_0x7721('0x3d')],_0x3121e0[_0x7721('0x39')]);_0x158aae[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x3121e0[_0x7721('0x3d')],qs[_0x7721('0x40')](_0x36a3a6[_0x7721('0x39')]['fields']));_0x158aae[_0x7721('0x3e')]=_0x158aae[_0x7721('0x3e')][_0x7721('0x41')]?_0x158aae['attributes']:_0x3121e0['model'];if(!_0x36a3a6['query']['hasOwnProperty']('nolimit')){_0x158aae[_0x7721('0x44')]=qs[_0x7721('0x44')](_0x36a3a6['query'][_0x7721('0x44')]);_0x158aae[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x36a3a6[_0x7721('0x39')]['offset']);}_0x158aae[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x36a3a6[_0x7721('0x39')][_0x7721('0x46')]);_0x158aae[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x36a3a6[_0x7721('0x39')],_0x3121e0[_0x7721('0x3c')]));_0x158aae['where']['MailAccountId']=_0x3a11e2['id'];if(_0x36a3a6[_0x7721('0x39')][_0x7721('0x4c')]){_0x158aae[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x158aae[_0x7721('0x47')],{'$or':_['map'](_0x158aae['attributes'],function(_0x263070){var _0x1bd97e={};_0x1bd97e[_0x263070]={'$like':'%'+_0x36a3a6[_0x7721('0x39')][_0x7721('0x4c')]+'%'};return _0x1bd97e;})});}_0x158aae=_[_0x7721('0x4b')]({},_0x158aae,_0x36a3a6[_0x7721('0x4d')]);return db[_0x7721('0x59')]['count']({'where':_0x158aae[_0x7721('0x47')]})[_0x7721('0x1c')](function(_0x27d7f1){_0x167ce7['count']=_0x27d7f1;if(_0x36a3a6[_0x7721('0x39')][_0x7721('0x52')]){_0x158aae[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x59')]['findAll'](_0x158aae);})['then'](function(_0x37f8f8){_0x167ce7[_0x7721('0x50')]=_0x37f8f8;return _0x167ce7;});}})[_0x7721('0x1c')](respondWithFilteredResult(_0x3f9eaa,_0x158aae))[_0x7721('0x24')](handleError(_0x3f9eaa,null));};exports[_0x7721('0x5b')]=function(_0x2581b3,_0x59e80c,_0x3855d5){var _0x42bb5a;return db[_0x7721('0x4f')]['find']({'where':{'id':_0x2581b3[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x59e80c,null))[_0x7721('0x1c')](function(_0xc20188){if(_0xc20188){return _0xc20188[_0x7721('0x5b')](_0x2581b3['query'][_0x7721('0x5c')]);}})['then'](respondWithStatusCode(_0x59e80c,null))[_0x7721('0x24')](handleError(_0x59e80c,null));};exports[_0x7721('0x5d')]=function(_0x2d5433,_0x7f0598,_0x963dbe){if(_0x2d5433[_0x7721('0x55')]['id']){delete _0x2d5433[_0x7721('0x55')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x2d5433[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x7f0598,null))['then'](function(_0x19fad6){if(_0x19fad6){_0x2d5433[_0x7721('0x55')][_0x7721('0x58')]=_0x19fad6['id'];return db['CannedAnswer'][_0x7721('0x5e')](_0x2d5433[_0x7721('0x55')]);}})[_0x7721('0x1c')](respondWithResult(_0x7f0598,null))[_0x7721('0x24')](handleError(_0x7f0598,null));};exports[_0x7721('0x5f')]=function(_0x594059,_0x1276ce,_0x22f15a){var _0x44326d={'raw':![],'where':{}};var _0x21b365={};var _0x30326d={'count':0x0,'rows':[]};return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x594059[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x1276ce,null))['then'](function(_0x72b86){if(_0x72b86){_0x21b365['model']=_[_0x7721('0x38')](db[_0x7721('0x60')]['rawAttributes']);_0x21b365[_0x7721('0x39')]=_['keys'](_0x594059['query']);_0x21b365['filters']=_[_0x7721('0x3f')](_0x21b365[_0x7721('0x3d')],_0x21b365[_0x7721('0x39')]);_0x44326d['attributes']=_['intersection'](_0x21b365['model'],qs[_0x7721('0x40')](_0x594059[_0x7721('0x39')][_0x7721('0x40')]));_0x44326d[_0x7721('0x3e')]=_0x44326d[_0x7721('0x3e')][_0x7721('0x41')]?_0x44326d['attributes']:_0x21b365[_0x7721('0x3d')];if(!_0x594059[_0x7721('0x39')][_0x7721('0x42')](_0x7721('0x43'))){_0x44326d[_0x7721('0x44')]=qs[_0x7721('0x44')](_0x594059[_0x7721('0x39')][_0x7721('0x44')]);_0x44326d[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x594059[_0x7721('0x39')][_0x7721('0x2a')]);}_0x44326d['order']=qs['sort'](_0x594059[_0x7721('0x39')][_0x7721('0x46')]);_0x44326d['where']=qs[_0x7721('0x3c')](_['pick'](_0x594059['query'],_0x21b365[_0x7721('0x3c')]));_0x44326d['where']['MailAccountId']=_0x72b86['id'];if(_0x594059[_0x7721('0x39')][_0x7721('0x4c')]){_0x44326d[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x44326d[_0x7721('0x47')],{'$or':_['map'](_0x44326d[_0x7721('0x3e')],function(_0xcf2c06){var _0x3df933={};_0x3df933[_0xcf2c06]={'$like':'%'+_0x594059[_0x7721('0x39')]['filter']+'%'};return _0x3df933;})});}_0x44326d=_['merge']({},_0x44326d,_0x594059[_0x7721('0x4d')]);return db[_0x7721('0x60')]['count']({'where':_0x44326d[_0x7721('0x47')]})[_0x7721('0x1c')](function(_0x58f7b1){_0x30326d['count']=_0x58f7b1;if(_0x594059[_0x7721('0x39')][_0x7721('0x52')]){_0x44326d[_0x7721('0x4e')]=[{'all':!![]}];}return db[_0x7721('0x60')][_0x7721('0x61')](_0x44326d);})[_0x7721('0x1c')](function(_0x996071){_0x30326d[_0x7721('0x50')]=_0x996071;return _0x30326d;});}})['then'](respondWithFilteredResult(_0x1276ce,_0x44326d))[_0x7721('0x24')](handleError(_0x1276ce,null));};exports[_0x7721('0x62')]=function(_0x3ce0f6,_0x1c4f14,_0xe1c795){var _0x9b5f60;return db[_0x7721('0x4f')]['find']({'where':{'id':_0x3ce0f6[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x1c4f14,null))['then'](function(_0x9b3e44){if(_0x9b3e44){return _0x9b3e44[_0x7721('0x62')](_0x3ce0f6[_0x7721('0x39')][_0x7721('0x5c')]);}})[_0x7721('0x1c')](respondWithStatusCode(_0x1c4f14,null))[_0x7721('0x24')](handleError(_0x1c4f14,null));};exports[_0x7721('0x5e')]=function(_0xef8270,_0x3f4020){var _0x402665={'name':_0xef8270['body'][_0x7721('0x31')],'key':_0xef8270[_0x7721('0x55')][_0x7721('0x63')],'email':_0xef8270[_0x7721('0x55')][_0x7721('0x64')],'ListId':_0xef8270[_0x7721('0x55')][_0x7721('0x65')],'active':!_[_0x7721('0x66')](_0xef8270[_0x7721('0x55')][_0x7721('0x67')])?_0xef8270[_0x7721('0x55')][_0x7721('0x67')]:!![],'description':_0xef8270[_0x7721('0x55')][_0x7721('0x68')]||null,'Imap':{},'Smtp':{}};if(_[_0x7721('0x66')](_0xef8270[_0x7721('0x55')][_0x7721('0x69')])){if(_0xef8270[_0x7721('0x55')][_0x7721('0x6a')]){_0x402665[_0x7721('0x34')]['user']=_0x402665[_0x7721('0x36')]['user']=_0xef8270[_0x7721('0x55')][_0x7721('0x6b')];_0x402665[_0x7721('0x34')][_0x7721('0x6c')]=_0x402665[_0x7721('0x36')]['pass']=_0xef8270['body']['cpassword'];}else{_0x402665['Imap'][_0x7721('0x6d')]=_0x402665[_0x7721('0x36')][_0x7721('0x6d')]=![];}_0x402665[_0x7721('0x34')][_0x7721('0x6e')]=_0xef8270['body'][_0x7721('0x34')]['host'];_0x402665[_0x7721('0x34')][_0x7721('0x6f')]=_0xef8270[_0x7721('0x55')][_0x7721('0x34')][_0x7721('0x6f')];_0x402665[_0x7721('0x36')]['host']=_0xef8270[_0x7721('0x55')]['Smtp']['host'];_0x402665[_0x7721('0x36')][_0x7721('0x6f')]=_0xef8270[_0x7721('0x55')][_0x7721('0x36')][_0x7721('0x6f')];}else{_0x402665['Imap'][_0x7721('0x70')]=_0x402665[_0x7721('0x36')][_0x7721('0x70')]=_0xef8270[_0x7721('0x55')][_0x7721('0x69')];_0x402665[_0x7721('0x34')][_0x7721('0x71')]=_0x402665['Smtp'][_0x7721('0x71')]=_0xef8270[_0x7721('0x55')][_0x7721('0x6b')];_0x402665[_0x7721('0x34')][_0x7721('0x6c')]=_0x402665['Smtp'][_0x7721('0x72')]=_0xef8270[_0x7721('0x55')][_0x7721('0x73')];}return db['MailAccount'][_0x7721('0x5e')](_0x402665,{'include':[{'model':db[_0x7721('0x35')],'as':'Smtp'},{'model':db[_0x7721('0x33')],'as':_0x7721('0x34')}]})[_0x7721('0x1c')](respondWithResult(_0x3f4020,0xc9))[_0x7721('0x24')](handleError(_0x3f4020,null));};exports['getImap']=function(_0x40beb8,_0x47c503,_0x340fd9){return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x40beb8[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x47c503,null))['then'](function(_0x29968c){if(_0x29968c){return _0x29968c[_0x7721('0x74')]();}return null;})['then'](respondWithResult(_0x47c503,null))[_0x7721('0x24')](handleError(_0x47c503,null));};exports['addImap']=function(_0x240b0a,_0x20380a,_0x271632){if(_0x240b0a['body']['id']){delete _0x240b0a[_0x7721('0x55')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x240b0a[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x20380a,null))[_0x7721('0x1c')](function(_0x335852){if(_0x335852){_0x240b0a[_0x7721('0x55')]['MailAccountId']=_0x335852['id'];return db[_0x7721('0x33')][_0x7721('0x5e')](_0x240b0a[_0x7721('0x55')]);}})[_0x7721('0x1c')](respondWithResult(_0x20380a,null))[_0x7721('0x24')](handleError(_0x20380a,null));};exports['removeImap']=function(_0x22f899,_0x568b64,_0x180db8){return db['MailAccount']['findOne']({'where':{'id':_0x22f899[_0x7721('0x51')]['id']}})['then'](handleEntityNotFound(_0x568b64,null))['then'](function(_0x1cdf1a){if(_0x1cdf1a){return _0x1cdf1a[_0x7721('0x75')](null);}return null;})[_0x7721('0x1c')](respondWithStatusCode(_0x568b64,null))['catch'](handleError(_0x568b64,null));};exports[_0x7721('0x76')]=function(_0x4d49ca,_0x4ac09d,_0x56cb9a){return db[_0x7721('0x4f')][_0x7721('0x77')]({'where':{'id':_0x4d49ca[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x4ac09d,null))[_0x7721('0x1c')](function(_0x37d8d4){if(_0x37d8d4){return _0x37d8d4[_0x7721('0x76')]();}return null;})[_0x7721('0x1c')](respondWithResult(_0x4ac09d,null))[_0x7721('0x24')](handleError(_0x4ac09d,null));};exports[_0x7721('0x78')]=function(_0x25bf32,_0x4ec3c6,_0xf69320){if(_0x25bf32[_0x7721('0x55')]['id']){delete _0x25bf32[_0x7721('0x55')]['id'];}return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x25bf32[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x4ec3c6,null))['then'](function(_0x4f95f5){if(_0x4f95f5){_0x25bf32[_0x7721('0x55')][_0x7721('0x58')]=_0x4f95f5['id'];return db[_0x7721('0x35')][_0x7721('0x5e')](_0x25bf32['body']);}})[_0x7721('0x1c')](respondWithResult(_0x4ec3c6,null))['catch'](handleError(_0x4ec3c6,null));};exports[_0x7721('0x79')]=function(_0x54ee47,_0x18dfd6,_0x3e7800){return db[_0x7721('0x4f')][_0x7721('0x77')]({'where':{'id':_0x54ee47[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x18dfd6,null))['then'](function(_0x509f2d){if(_0x509f2d){return _0x509f2d['setSmtp'](null);}return null;})[_0x7721('0x1c')](respondWithStatusCode(_0x18dfd6,null))['catch'](handleError(_0x18dfd6,null));};exports[_0x7721('0x7a')]=function(_0x186ada,_0x569923,_0x340926){return db[_0x7721('0x7b')][_0x7721('0x53')]({'where':{'id':_0x186ada['params']['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x569923,null))[_0x7721('0x1c')](function(_0x5652f9){if(_0x5652f9){return _0x5652f9['addInteraction'](_0x186ada[_0x7721('0x55')][_0x7721('0x5c')],_['omit'](_0x186ada[_0x7721('0x55')],[_0x7721('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x569923,null))['catch'](handleError(_0x569923,null));};exports['getInteractions']=function(_0x48a377,_0x19be6b,_0x38ab13){var _0xb42b38={'raw':![],'where':{}};var _0x5eb23b={};var _0x4c456b={'count':0x0,'rows':[]};return db[_0x7721('0x4f')][_0x7721('0x77')]({'where':{'id':_0x48a377[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x19be6b,null))[_0x7721('0x1c')](function(_0x2fd86f){if(_0x2fd86f){_0x5eb23b[_0x7721('0x3d')]=_[_0x7721('0x38')](db[_0x7721('0x7b')]['rawAttributes']);_0x5eb23b['query']=_[_0x7721('0x38')](_0x48a377['query']);_0x5eb23b[_0x7721('0x3c')]=_['intersection'](_0x5eb23b[_0x7721('0x3d')],_0x5eb23b['query']);_0xb42b38[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x5eb23b['model'],qs['fields'](_0x48a377[_0x7721('0x39')][_0x7721('0x40')]));_0xb42b38[_0x7721('0x3e')]=_0xb42b38[_0x7721('0x3e')][_0x7721('0x41')]?_0xb42b38['attributes']:_0x5eb23b[_0x7721('0x3d')];if(!_0x48a377[_0x7721('0x39')][_0x7721('0x42')]('nolimit')){_0xb42b38[_0x7721('0x44')]=qs[_0x7721('0x44')](_0x48a377[_0x7721('0x39')][_0x7721('0x44')]);_0xb42b38[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x48a377[_0x7721('0x39')][_0x7721('0x2a')]);}_0xb42b38[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x48a377[_0x7721('0x39')]['sort']);_0xb42b38[_0x7721('0x47')]=qs[_0x7721('0x3c')](_[_0x7721('0x48')](_0x48a377[_0x7721('0x39')],_0x5eb23b[_0x7721('0x3c')]));_0xb42b38[_0x7721('0x47')][_0x7721('0x58')]=_0x2fd86f['id'];if(_0x48a377['query'][_0x7721('0x4c')]){_0xb42b38['where']=_[_0x7721('0x4b')](_0xb42b38[_0x7721('0x47')],{'$or':_[_0x7721('0x7c')](_0xb42b38[_0x7721('0x3e')],function(_0x37b607){var _0x3d6d41={};_0x3d6d41[_0x37b607]={'$like':'%'+_0x48a377['query'][_0x7721('0x4c')]+'%'};return _0x3d6d41;})});}_0xb42b38=_['merge']({},_0xb42b38,_0x48a377[_0x7721('0x4d')]);return db[_0x7721('0x7b')][_0x7721('0x29')]({'where':_0xb42b38['where']})[_0x7721('0x1c')](function(_0x3eebc0){_0x4c456b[_0x7721('0x29')]=_0x3eebc0;if(_0x48a377[_0x7721('0x39')]['includeAll']){_0xb42b38[_0x7721('0x4e')]=[{'model':db[_0x7721('0x7d')],'as':_0x7721('0x7e'),'required':![]},{'model':db[_0x7721('0x7f')],'as':'Owner','attributes':[_0x7721('0x31'),_0x7721('0x80'),_0x7721('0x81')],'required':![]},{'model':db[_0x7721('0x82')],'as':'Tags','attributes':['id',_0x7721('0x31'),_0x7721('0x83')],'where':_0x48a377[_0x7721('0x39')][_0x7721('0x84')]?{'id':_0x48a377[_0x7721('0x39')][_0x7721('0x84')]}:undefined,'required':_0x48a377[_0x7721('0x39')][_0x7721('0x84')]?!![]:![]}];}return db[_0x7721('0x7b')]['findAll'](_0xb42b38);})[_0x7721('0x1c')](function(_0x412443){_0x4c456b[_0x7721('0x50')]=_0x412443;return _0x4c456b;});}})[_0x7721('0x1c')](respondWithFilteredResult(_0x19be6b,_0xb42b38))[_0x7721('0x24')](handleError(_0x19be6b,null));};exports[_0x7721('0x85')]=function(_0x1a6f68,_0xfbc75b,_0x1952f0){return db[_0x7721('0x4f')][_0x7721('0x77')]({'where':{'id':_0x1a6f68[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0xfbc75b,null))[_0x7721('0x1c')](function(_0x224a12){if(_0x224a12){return db[_0x7721('0x86')]['transaction'](function(_0x2097b9){return db[_0x7721('0x87')][_0x7721('0x2f')]({'where':{'MailAccountId':_0x1a6f68[_0x7721('0x51')]['id']},'transaction':_0x2097b9})[_0x7721('0x1c')](function(_0x857c38){var _0x36862d=_[_0x7721('0x7c')](_0x1a6f68[_0x7721('0x55')],function(_0x38d031){_0x38d031[_0x7721('0x58')]=_0x1a6f68[_0x7721('0x51')]['id'];return _0x38d031;});return db['MailApplication']['bulkCreate'](_0x36862d,{'transaction':_0x2097b9});});})[_0x7721('0x1c')](function(){return db[_0x7721('0x87')][_0x7721('0x88')]({'where':{'MailAccountId':_0x1a6f68[_0x7721('0x51')]['id']},'order':_0x7721('0x89')});});}})['then'](respondWithResult(_0xfbc75b,null))[_0x7721('0x24')](handleError(_0xfbc75b,null));};exports[_0x7721('0x8a')]=function(_0x23b8f9,_0x117446,_0x459cf0){var _0x309b41={};var _0xc0f448={};var _0x3dc688;var _0x298aca;return db[_0x7721('0x4f')][_0x7721('0x77')]({'where':{'id':_0x23b8f9[_0x7721('0x51')]['id']}})['then'](handleEntityNotFound(_0x117446,null))[_0x7721('0x1c')](function(_0x342ebd){if(_0x342ebd){_0x3dc688=_0x342ebd;_0xc0f448[_0x7721('0x3d')]=_['keys'](db[_0x7721('0x87')][_0x7721('0x37')]);_0xc0f448[_0x7721('0x39')]=_['keys'](_0x23b8f9[_0x7721('0x39')]);_0xc0f448['filters']=_['intersection'](_0xc0f448[_0x7721('0x3d')],_0xc0f448[_0x7721('0x39')]);_0x309b41[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0xc0f448['model'],qs[_0x7721('0x40')](_0x23b8f9[_0x7721('0x39')][_0x7721('0x40')]));_0x309b41[_0x7721('0x3e')]=_0x309b41[_0x7721('0x3e')]['length']?_0x309b41[_0x7721('0x3e')]:_0xc0f448[_0x7721('0x3d')];_0x309b41[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x23b8f9[_0x7721('0x39')][_0x7721('0x46')]);_0x309b41[_0x7721('0x47')]=qs[_0x7721('0x3c')](_[_0x7721('0x48')](_0x23b8f9[_0x7721('0x39')],_0xc0f448[_0x7721('0x3c')]));if(_0x23b8f9[_0x7721('0x39')][_0x7721('0x4c')]){_0x309b41[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x309b41[_0x7721('0x47')],{'$or':_[_0x7721('0x7c')](_0x309b41[_0x7721('0x3e')],function(_0x3219ad){var _0x3fca4f={};_0x3fca4f[_0x3219ad]={'$like':'%'+_0x23b8f9[_0x7721('0x39')][_0x7721('0x4c')]+'%'};return _0x3fca4f;})});}_0x309b41=_['merge']({},_0x309b41,_0x23b8f9[_0x7721('0x4d')]);return _0x3dc688['getApplications'](_0x309b41);}})[_0x7721('0x1c')](function(_0x12a75e){if(_0x12a75e){_0x298aca=_0x12a75e[_0x7721('0x41')];if(!_0x23b8f9[_0x7721('0x39')]['hasOwnProperty'](_0x7721('0x43'))){_0x309b41[_0x7721('0x44')]=qs['limit'](_0x23b8f9[_0x7721('0x39')][_0x7721('0x44')]);_0x309b41['offset']=qs[_0x7721('0x2a')](_0x23b8f9[_0x7721('0x39')][_0x7721('0x2a')]);}return _0x3dc688[_0x7721('0x8a')](_0x309b41);}})[_0x7721('0x1c')](function(_0x55c43c){if(_0x55c43c){return _0x55c43c?{'count':_0x298aca,'rows':_0x55c43c}:null;}})['then'](respondWithResult(_0x117446,null))[_0x7721('0x24')](handleError(_0x117446,null));};exports[_0x7721('0x8b')]=function(_0x482439,_0x58efb1,_0x35dda4){var _0x4a38c8={'raw':!![],'where':{}};var _0x1c23e3={};var _0x2e8e1a={'count':0x0,'rows':[]};return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x482439[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x58efb1,null))[_0x7721('0x1c')](function(_0x32a7fb){if(_0x32a7fb){_0x1c23e3[_0x7721('0x3d')]=_[_0x7721('0x38')](db[_0x7721('0x8c')][_0x7721('0x37')]);_0x1c23e3['query']=_[_0x7721('0x38')](_0x482439[_0x7721('0x39')]);_0x1c23e3[_0x7721('0x3c')]=_[_0x7721('0x3f')](_0x1c23e3[_0x7721('0x3d')],_0x1c23e3['query']);_0x4a38c8[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x1c23e3[_0x7721('0x3d')],qs[_0x7721('0x40')](_0x482439[_0x7721('0x39')][_0x7721('0x40')]));_0x4a38c8[_0x7721('0x3e')]=_0x4a38c8[_0x7721('0x3e')][_0x7721('0x41')]?_0x4a38c8[_0x7721('0x3e')]:_0x1c23e3[_0x7721('0x3d')];if(!_0x482439['query'][_0x7721('0x42')](_0x7721('0x43'))){_0x4a38c8[_0x7721('0x44')]=qs[_0x7721('0x44')](_0x482439[_0x7721('0x39')][_0x7721('0x44')]);_0x4a38c8[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x482439[_0x7721('0x39')][_0x7721('0x2a')]);}_0x4a38c8[_0x7721('0x45')]=qs[_0x7721('0x46')](_0x482439[_0x7721('0x39')][_0x7721('0x46')]);_0x4a38c8[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x482439['query'],_0x1c23e3['filters']));_0x4a38c8[_0x7721('0x47')]['MailAccountId']=_0x32a7fb['id'];if(_0x482439[_0x7721('0x39')][_0x7721('0x4c')]){_0x4a38c8[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x4a38c8['where'],{'$or':_['map'](_0x4a38c8[_0x7721('0x3e')],function(_0x3d8787){var _0x40afa7={};_0x40afa7[_0x3d8787]={'$like':'%'+_0x482439[_0x7721('0x39')][_0x7721('0x4c')]+'%'};return _0x40afa7;})});}if(_0x482439[_0x7721('0x39')][_0x7721('0x8d')]){var _0x5c7b6c=_0x482439[_0x7721('0x39')]['$gte'][_0x7721('0x8e')](',');var _0x3b4137={};_0x3b4137[_0x5c7b6c[0x0]]={'$gte':moment(_0x5c7b6c[0x1])[_0x7721('0x8f')](_0x7721('0x90'))};_0x4a38c8[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x4a38c8[_0x7721('0x47')],_0x3b4137);}_0x4a38c8=_[_0x7721('0x4b')]({},_0x4a38c8,_0x482439[_0x7721('0x4d')]);return db[_0x7721('0x8c')][_0x7721('0x29')]({'where':_0x4a38c8[_0x7721('0x47')]})[_0x7721('0x1c')](function(_0x3b3528){_0x2e8e1a[_0x7721('0x29')]=_0x3b3528;if(_0x482439[_0x7721('0x39')][_0x7721('0x52')]){_0x4a38c8[_0x7721('0x4e')]=[{'all':!![]}];}return db['MailMessage'][_0x7721('0x61')](_0x4a38c8);})[_0x7721('0x1c')](function(_0x4455e4){_0x2e8e1a[_0x7721('0x50')]=_0x4455e4;return _0x2e8e1a;});}})[_0x7721('0x1c')](respondWithFilteredResult(_0x58efb1,_0x4a38c8))[_0x7721('0x24')](handleError(_0x58efb1,null));};exports['send']=function(_0x341362,_0x23b863,_0x3fdc3d){var _0x480f08,_0x1bdadb={},_0x57a437;if(_0x341362[_0x7721('0x55')]['to']){_0x57a437=_0x341362['body']['to'][_0x7721('0x8e')](',')[0x0];}return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x341362[_0x7721('0x51')]['id']},'include':[{'model':db['CmList'],'as':_0x7721('0x91'),'include':[{'model':db[_0x7721('0x7d')],'as':_0x7721('0x92'),'where':{'email':_0x57a437},'limit':0x1,'order':[[_0x7721('0x93'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x7721('0x36'),'raw':!![]}]})['then'](handleEntityNotFound(_0x23b863,null))[_0x7721('0x1c')](function(_0x3be243){if(_0x3be243){_0x480f08=_0x3be243;if(_0x3be243[_0x7721('0x36')]){if(_[_0x7721('0x66')](_0x341362[_0x7721('0x55')][_0x7721('0x94')])){_0x341362[_0x7721('0x55')][_0x7721('0x94')]=util[_0x7721('0x8f')]('%s\x20<%s>',_0x3be243[_0x7721('0x31')],_0x3be243[_0x7721('0x64')]||_0x3be243[_0x7721('0x36')]['user']);}if(_0x341362['body'][_0x7721('0x95')]&&_0x341362[_0x7721('0x55')][_0x7721('0x95')][_0x7721('0x41')]){for(var _0x13aa6e=0x0;_0x13aa6e<_0x341362[_0x7721('0x55')]['attachments'][_0x7721('0x41')];_0x13aa6e+=0x1){_0x341362[_0x7721('0x55')]['attachments'][_0x13aa6e]={'filename':_0x341362[_0x7721('0x55')]['attachments'][_0x13aa6e][_0x7721('0x31')],'path':path['join'](config[_0x7721('0x96')],'server/files/attachments',_0x341362['body']['attachments'][_0x13aa6e][_0x7721('0x97')])};}}var _0x510c04={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x3be243['Smtp']['service'])){if(_0x3be243[_0x7721('0x36')][_0x7721('0x6d')]){_0x510c04[_0x7721('0x98')]={'user':_0x3be243[_0x7721('0x36')][_0x7721('0x71')],'pass':_0x3be243['Smtp'][_0x7721('0x72')]};}_0x510c04[_0x7721('0x6e')]=_0x3be243['Smtp'][_0x7721('0x6e')];_0x510c04[_0x7721('0x6f')]=_0x3be243[_0x7721('0x36')][_0x7721('0x6f')];_0x510c04[_0x7721('0x99')]=_0x3be243[_0x7721('0x36')][_0x7721('0x99')];}else{_0x510c04[_0x7721('0x70')]=_0x3be243['Smtp'][_0x7721('0x70')];_0x510c04[_0x7721('0x98')]={'user':_0x3be243[_0x7721('0x36')][_0x7721('0x71')],'pass':_0x3be243[_0x7721('0x36')][_0x7721('0x72')]};}return respondWithRpcPromise(_0x7721('0x9a'),_0x7721('0x9b'),{'account':_0x510c04,'message':_0x341362['body']});}else{throw new Error(_0x7721('0x9c'));}}})[_0x7721('0x1c')](function(_0x17c3e7){if(_0x17c3e7){_0x1bdadb=_0x17c3e7;if(_0x480f08[_0x7721('0x91')]){if(_0x480f08[_0x7721('0x91')]['Contacts'][_0x7721('0x41')]){return _0x480f08[_0x7721('0x91')][_0x7721('0x92')][0x0];}else{return db[_0x7721('0x7d')][_0x7721('0x5e')](_['defaults'](_0x341362[_0x7721('0x55')],{'firstName':_0x341362[_0x7721('0x55')]['to'],'email':_0x341362['body']['to'],'phone':_0x341362[_0x7721('0x55')]['to'],'ListId':_0x480f08[_0x7721('0x65')]}));}}else{throw new Error(_0x7721('0x9c'));}}})[_0x7721('0x1c')](function(_0x46c989){if(_0x46c989){var _0x54dc21={'UserId':_0x341362[_0x7721('0x71')]['id'],'ContactId':_0x46c989['id'],'MailAccountId':_0x480f08['id'],'inReplyTo':_0x1bdadb[_0x7721('0x9d')],'to':_0x341362['body']['from'],'cc':_0x341362[_0x7721('0x55')]['cc'],'subject':_0x341362[_0x7721('0x55')][_0x7721('0x9e')],'attach':_0x341362['body'][_0x7721('0x9f')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x7721('0x90')),'lastMsgDirection':_0x7721('0xa0'),'lastMsgBody':_0x341362[_0x7721('0x55')][_0x7721('0x55')],'Messages':[_[_0x7721('0x4b')](_0x341362['body'],{'messageId':_0x1bdadb[_0x7721('0x9d')],'sentAt':moment()[_0x7721('0x8f')](_0x7721('0x90')),'read':!![],'MailAccountId':_0x480f08['id'],'UserId':_0x341362[_0x7721('0x71')]['id'],'ContactId':_0x46c989['id']})]};if(_0x341362[_0x7721('0x55')]['Interaction']){_0x54dc21=_[_0x7721('0x4b')](_0x54dc21,_0x341362['body'][_0x7721('0xa1')]);}return db[_0x7721('0x7b')][_0x7721('0x5e')](_0x54dc21,{'include':[{'model':db['MailMessage'],'as':_0x7721('0xa2')}]});}})['then'](respondWithResult(_0x23b863,null))[_0x7721('0x24')](handleError(_0x23b863,null));};exports[_0x7721('0xa3')]=function(_0x6858a7,_0x40bea0,_0x39e196){return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x6858a7[_0x7721('0x51')]['id']},'include':[{'model':db[_0x7721('0x35')],'as':_0x7721('0x36'),'raw':!![]}]})['then'](handleEntityNotFound(_0x40bea0,null))[_0x7721('0x1c')](function(_0x32463b){if(_0x32463b&&_0x32463b[_0x7721('0x36')]){var _0x3493c8={'id':_0x32463b['id'],'tls':{'rejectUnauthorized':![]}};if(_0x32463b[_0x7721('0x36')]['service']){_0x3493c8[_0x7721('0x70')]=_0x32463b[_0x7721('0x36')][_0x7721('0x70')];}else{_0x3493c8['host']=_0x32463b[_0x7721('0x36')][_0x7721('0x6e')];_0x3493c8[_0x7721('0x6f')]=_0x32463b[_0x7721('0x36')][_0x7721('0x6f')];_0x3493c8[_0x7721('0x99')]=_0x32463b[_0x7721('0x36')][_0x7721('0x99')];}if(_0x32463b[_0x7721('0x36')][_0x7721('0x6d')]){_0x3493c8['auth']={'user':_0x32463b[_0x7721('0x36')][_0x7721('0x71')],'pass':_0x32463b[_0x7721('0x36')][_0x7721('0x72')]};}return respondWithRpcPromise(_0x7721('0xa4'),_0x7721('0xa3'),{'account':_0x3493c8});}})[_0x7721('0x1c')](respondWithResult(_0x40bea0,null))[_0x7721('0x24')](handleError(_0x40bea0,null));};exports[_0x7721('0x2f')]=function(_0x3b3dc7,_0x10cd90){return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x3b3dc7[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x10cd90,null))[_0x7721('0x1c')](function(_0x81ea1c){if(_0x81ea1c&&_0x81ea1c['service']){throw new db['Sequelize'][(_0x7721('0xa5'))](_0x7721('0xa6'));}return _0x81ea1c;})[_0x7721('0x1c')](removeEntity(_0x10cd90,null))[_0x7721('0x24')](handleError(_0x10cd90,null));};exports['addAgents']=function(_0x3af59c,_0x49f369,_0x4d60fe){return db[_0x7721('0x4f')][_0x7721('0x53')]({'where':{'id':_0x3af59c['params']['id']}})['then'](handleEntityNotFound(_0x49f369,null))['then'](function(_0x329081){if(_0x329081){return _0x329081[_0x7721('0xa7')](_0x3af59c[_0x7721('0x55')][_0x7721('0x5c')],_[_0x7721('0xa8')](_0x3af59c['body'],[_0x7721('0x5c'),'id'])||{})[_0x7721('0xa9')](function(_0x14b374){for(var _0x52266a=0x0;_0x52266a<_0x3af59c[_0x7721('0x55')][_0x7721('0x5c')][_0x7721('0x41')];_0x52266a+=0x1){socket['emit'](_0x7721('0xaa'),{'UserId':_0x3af59c[_0x7721('0x55')][_0x7721('0x5c')][_0x52266a],'MailAccountId':_0x3af59c['params']['id']});}return _0x14b374;});}})[_0x7721('0x1c')](respondWithResult(_0x49f369,null))[_0x7721('0x24')](handleError(_0x49f369,null));};exports[_0x7721('0xab')]=function(_0x2c5f34,_0x3db45f,_0x5c1413){var _0x2e2610;return db['MailAccount']['find']({'where':{'id':_0x2c5f34[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x3db45f,null))[_0x7721('0x1c')](function(_0x2a8ec6){if(_0x2a8ec6){return _0x2a8ec6[_0x7721('0xab')](_0x2c5f34['query'][_0x7721('0x5c')])[_0x7721('0x1c')](function(_0x314180){if(_[_0x7721('0xac')](_0x2c5f34[_0x7721('0x39')][_0x7721('0x5c')])){for(var _0x151044=0x0;_0x151044<_0x2c5f34[_0x7721('0x39')][_0x7721('0x5c')][_0x7721('0x41')];_0x151044+=0x1){socket['emit'](_0x7721('0xad'),{'UserId':_0x2c5f34[_0x7721('0x39')]['ids'][_0x151044],'MailAccountId':_0x2c5f34[_0x7721('0x51')]['id']});}}else{socket['emit'](_0x7721('0xad'),{'UserId':_0x2c5f34['query'][_0x7721('0x5c')],'MailAccountId':_0x2c5f34['params']['id']});}});}})['then'](respondWithStatusCode(_0x3db45f,null))['catch'](handleError(_0x3db45f,null));};exports['getAgents']=function(_0x77b244,_0x57ba82,_0x6c01e4){var _0x3afb6e={};var _0x463e21={};var _0x45a896;var _0xfa8926;return db[_0x7721('0x4f')]['findOne']({'where':{'id':_0x77b244[_0x7721('0x51')]['id']}})[_0x7721('0x1c')](handleEntityNotFound(_0x57ba82,null))['then'](function(_0x55da13){if(_0x55da13){_0x45a896=_0x55da13;_0x463e21[_0x7721('0x3d')]=_[_0x7721('0x38')](db[_0x7721('0x7f')]['rawAttributes']);_0x463e21[_0x7721('0x39')]=_[_0x7721('0x38')](_0x77b244[_0x7721('0x39')]);_0x463e21[_0x7721('0x3c')]=_[_0x7721('0x3f')](_0x463e21['model'],_0x463e21[_0x7721('0x39')]);_0x3afb6e[_0x7721('0x3e')]=_[_0x7721('0x3f')](_0x463e21[_0x7721('0x3d')],qs[_0x7721('0x40')](_0x77b244[_0x7721('0x39')][_0x7721('0x40')]));_0x3afb6e[_0x7721('0x3e')]=_0x3afb6e['attributes']['length']?_0x3afb6e[_0x7721('0x3e')]:_0x463e21[_0x7721('0x3d')];_0x3afb6e['order']=qs[_0x7721('0x46')](_0x77b244['query']['sort']);_0x3afb6e[_0x7721('0x47')]=qs['filters'](_[_0x7721('0x48')](_0x77b244['query'],_0x463e21[_0x7721('0x3c')]));if(_0x77b244[_0x7721('0x39')]['filter']){_0x3afb6e[_0x7721('0x47')]=_[_0x7721('0x4b')](_0x3afb6e[_0x7721('0x47')],{'$or':_[_0x7721('0x7c')](_0x3afb6e[_0x7721('0x3e')],function(_0x493478){var _0x3b4b33={};_0x3b4b33[_0x493478]={'$like':'%'+_0x77b244[_0x7721('0x39')][_0x7721('0x4c')]+'%'};return _0x3b4b33;})});}_0x3afb6e=_[_0x7721('0x4b')]({},_0x3afb6e,_0x77b244[_0x7721('0x4d')]);return _0x45a896[_0x7721('0xae')](_0x3afb6e);}})[_0x7721('0x1c')](function(_0x47940f){if(_0x47940f){_0xfa8926=_0x47940f[_0x7721('0x41')];if(!_0x77b244[_0x7721('0x39')][_0x7721('0x42')](_0x7721('0x43'))){_0x3afb6e[_0x7721('0x44')]=qs['limit'](_0x77b244[_0x7721('0x39')][_0x7721('0x44')]);_0x3afb6e[_0x7721('0x2a')]=qs[_0x7721('0x2a')](_0x77b244[_0x7721('0x39')][_0x7721('0x2a')]);}return _0x45a896[_0x7721('0xae')](_0x3afb6e);}})[_0x7721('0x1c')](function(_0x2550f1){if(_0x2550f1){return _0x2550f1?{'count':_0xfa8926,'rows':_0x2550f1}:null;}})[_0x7721('0x1c')](respondWithResult(_0x57ba82,null))['catch'](handleError(_0x57ba82,null));}; \ No newline at end of file +var _0x814b=['getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','CmContact','updatedAt','from','%s\x20<%s>','email','attachments','join','root','server/files/attachments','basename','auth','pass','secure','SendMail','List\x20not\x20found','Contacts','defaults','messageId','subject','out','Interaction','Messages','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailAccount.socket','register','client','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','save','destroy','stack','name','send','index','Imap','MailServerOut','Smtp','MailAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','fields','length','hasOwnProperty','nolimit','order','where','pick','add','day','merge','map','attributes','filter','options','includeAll','include','findAll','rows','params','MailServerIn','find','catch','body','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','sort','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','authentication','host','port','service'];(function(_0x33db6b,_0x447f6c){var _0x4d2a24=function(_0x26def8){while(--_0x26def8){_0x33db6b['push'](_0x33db6b['shift']());}};_0x4d2a24(++_0x447f6c);}(_0x814b,0x1a2));var _0xb814=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x814b[_0x4e6eac];return _0x79f963;};'use strict';var jsonpatch=require(_0xb814('0x0'));var rp=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var Mustache=require(_0xb814('0x4'));var util=require(_0xb814('0x5'));var path=require('path');var sox=require(_0xb814('0x6'));var csv=require(_0xb814('0x7'));var ejs=require(_0xb814('0x8'));var fs=require('fs');var _=require(_0xb814('0x9'));var squel=require(_0xb814('0xa'));var crypto=require(_0xb814('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb814('0xc'));var toCsv=require(_0xb814('0x7'));var querystring=require('querystring');var Papa=require(_0xb814('0xd'));var qs=require(_0xb814('0xe'));var logger=require(_0xb814('0xf'))(_0xb814('0x10'));var utils=require(_0xb814('0x11'));var config=require(_0xb814('0x12'));var db=require(_0xb814('0x13'))['db'];var socket=require(_0xb814('0x14'))({'host':_0xb814('0x15'),'port':0x18eb});require(_0xb814('0x16'))[_0xb814('0x17')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb814('0x18')]['http']({'port':0x232b});function respondWithRpcPromise(_0x26b35f,_0x15d6ef,_0x35b10d,_0x2cc46b){return new BPromise(function(_0x2ce718,_0x3bde14){var _0x1438e7=_0x2cc46b||client;return _0x1438e7[_0xb814('0x19')](_0x26b35f,_0x35b10d)[_0xb814('0x1a')](function(_0x2ab627){logger[_0xb814('0x1b')](_0xb814('0x1c'),_0x15d6ef,_0xb814('0x1d'));logger[_0xb814('0x1e')](_0xb814('0x1f'),_0x15d6ef,_0xb814('0x1d'),JSON[_0xb814('0x20')](_0x2ab627));if(_0x2ab627[_0xb814('0x21')]){if(_0x2ab627[_0xb814('0x21')][_0xb814('0x22')]===0x1f4){logger[_0xb814('0x21')]('MailAccount,\x20%s,\x20%s',_0x15d6ef,_0x2ab627[_0xb814('0x21')]['message']);return _0x3bde14(_0x2ab627[_0xb814('0x21')][_0xb814('0x23')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x15d6ef,_0x2ab627['error'][_0xb814('0x23')]);return _0x2ce718(_0x2ab627['error']['message']);}else{logger[_0xb814('0x1b')](_0xb814('0x1c'),_0x15d6ef,_0xb814('0x1d'));_0x2ce718(_0x2ab627['result'][_0xb814('0x23')]);}})['catch'](function(_0x1e6393){logger[_0xb814('0x21')](_0xb814('0x1c'),_0x15d6ef,_0x1e6393);_0x3bde14(_0x1e6393);});});}function respondWithStatusCode(_0x470e81,_0x27352e){_0x27352e=_0x27352e||0xcc;return function(_0x2bd039){if(_0x2bd039){return _0x470e81[_0xb814('0x24')](_0x27352e);}return _0x470e81['status'](_0x27352e)[_0xb814('0x25')]();};}function respondWithResult(_0x52b7a3,_0x3f81d0){_0x3f81d0=_0x3f81d0||0xc8;return function(_0x457dac){if(_0x457dac){return _0x52b7a3[_0xb814('0x26')](_0x3f81d0)[_0xb814('0x27')](_0x457dac);}};}function respondWithFilteredResult(_0x1c8a2e,_0xb9e57d){return function(_0x3d836c){if(_0x3d836c){var _0x5755ea=_0x3d836c[_0xb814('0x28')],_0x392222=_0xb9e57d[_0xb814('0x29')],_0xc0ef66=_0xb9e57d[_0xb814('0x29')]+_0xb9e57d[_0xb814('0x2a')],_0x1c2625;if(_0xc0ef66>=_0x5755ea){_0xc0ef66=_0x5755ea;_0x1c2625=0xc8;}else{_0x1c2625=0xce;}_0x1c8a2e[_0xb814('0x26')](_0x1c2625);return _0x1c8a2e['set'](_0xb814('0x2b'),_0x392222+'-'+_0xc0ef66+'/'+_0x5755ea)[_0xb814('0x27')](_0x3d836c);}return null;};}function patchUpdates(_0x52ed64){return function(_0x9008b2){try{jsonpatch[_0xb814('0x2c')](_0x9008b2,_0x52ed64,!![]);}catch(_0x530744){return BPromise['reject'](_0x530744);}return _0x9008b2[_0xb814('0x2d')]();};}function saveUpdates(_0x2051d0,_0x58c3ca){return function(_0x338a28){if(_0x338a28){return _0x338a28['update'](_0x2051d0)[_0xb814('0x1a')](function(_0x5f3e9b){return _0x5f3e9b;});}return null;};}function removeEntity(_0x4cfc58,_0x419cd9){return function(_0x4a4f27){if(_0x4a4f27){return _0x4a4f27[_0xb814('0x2e')]()[_0xb814('0x1a')](function(){_0x4cfc58[_0xb814('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d5ae,_0x26d3a9){return function(_0x336e2b){if(!_0x336e2b){_0x51d5ae['sendStatus'](0x194);}return _0x336e2b;};}function handleError(_0x2c8943,_0xe558d5){_0xe558d5=_0xe558d5||0x1f4;return function(_0x692c72){logger[_0xb814('0x21')](_0x692c72[_0xb814('0x2f')]);if(_0x692c72[_0xb814('0x30')]){delete _0x692c72[_0xb814('0x30')];}_0x2c8943['status'](_0xe558d5)[_0xb814('0x31')](_0x692c72);};}exports[_0xb814('0x32')]=function(_0x30de5a,_0x424e2b){var _0x14100d={'include':[{'model':db['MailServerIn'],'as':_0xb814('0x33')},{'model':db[_0xb814('0x34')],'as':_0xb814('0x35')}]},_0x4ff31a={},_0x16ef82={'count':0x0,'rows':[]};var _0x492d5e=db[_0xb814('0x36')][_0xb814('0x37')];_0x4ff31a['model']=_[_0xb814('0x38')](_0x492d5e);var _0x2d0e27={'dateStart':_0x30de5a[_0xb814('0x39')][_0xb814('0x3a')],'dateEnd':_0x30de5a[_0xb814('0x39')][_0xb814('0x3b')]};delete _0x30de5a['query'][_0xb814('0x3a')];delete _0x30de5a['query'][_0xb814('0x3b')];_0x4ff31a['query']=_[_0xb814('0x38')](_0x30de5a['query']);_0x4ff31a[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x4ff31a['model'],_0x4ff31a['query']);_0x14100d['attributes']=_['intersection'](_0x4ff31a[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x30de5a[_0xb814('0x39')][_0xb814('0x3f')]));_0x14100d['attributes']=_0x14100d['attributes'][_0xb814('0x40')]?_0x14100d['attributes']:_0x4ff31a[_0xb814('0x3e')];if(!_0x30de5a[_0xb814('0x39')][_0xb814('0x41')](_0xb814('0x42'))){_0x14100d[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x30de5a[_0xb814('0x39')][_0xb814('0x2a')]);_0x14100d[_0xb814('0x29')]=qs['offset'](_0x30de5a['query']['offset']);}_0x14100d[_0xb814('0x43')]=qs['sort'](_0x30de5a[_0xb814('0x39')]['sort']);_0x14100d[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x30de5a[_0xb814('0x39')],_0x4ff31a['filters']));if(_0x2d0e27[_0xb814('0x3a')]){if(_0x2d0e27[_0xb814('0x3b')]){_0x2d0e27[_0xb814('0x3b')]=moment(_0x2d0e27[_0xb814('0x3b')])[_0xb814('0x46')](0x1,_0xb814('0x47'));}else{_0x2d0e27['dateEnd']=moment(_0x2d0e27[_0xb814('0x3a')])[_0xb814('0x46')](0x1,_0xb814('0x47'));}_[_0xb814('0x48')](_0x14100d[_0xb814('0x44')],{'createdAt':{'$gte':_0x2d0e27[_0xb814('0x3a')],'$lte':_0x2d0e27[_0xb814('0x3b')]}});}if(_0x30de5a['query']['filter']){_0x14100d[_0xb814('0x44')]=_[_0xb814('0x48')](_0x14100d[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x14100d[_0xb814('0x4a')],function(_0x40e627){var _0x24b697={};_0x24b697[_0x40e627]={'$like':'%'+_0x30de5a[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x24b697;})});}_0x14100d=_[_0xb814('0x48')]({},_0x14100d,_0x30de5a[_0xb814('0x4c')]);var _0x5c7a49={'where':_0x14100d[_0xb814('0x44')]};return db[_0xb814('0x36')]['count'](_0x5c7a49)[_0xb814('0x1a')](function(_0x55234d){_0x16ef82[_0xb814('0x28')]=_0x55234d;if(_0x30de5a[_0xb814('0x39')][_0xb814('0x4d')]){_0x14100d[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x36')][_0xb814('0x4f')](_0x14100d);})[_0xb814('0x1a')](function(_0x45480e){_0x16ef82[_0xb814('0x50')]=_0x45480e;return _0x16ef82;})[_0xb814('0x1a')](respondWithFilteredResult(_0x424e2b,_0x14100d))['catch'](handleError(_0x424e2b,null));};exports['show']=function(_0x32eca6,_0x30f07b){var _0x4156d8={'raw':![],'where':{'id':_0x32eca6[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x52')],'as':_0xb814('0x33')},{'model':db['MailServerOut'],'as':_0xb814('0x35')}]},_0x3f8e29={};_0x3f8e29[_0xb814('0x3e')]=_[_0xb814('0x38')](db['MailAccount'][_0xb814('0x37')]);_0x3f8e29['query']=_[_0xb814('0x38')](_0x32eca6['query']);_0x3f8e29[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x3f8e29['model'],_0x3f8e29[_0xb814('0x39')]);_0x4156d8[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x3f8e29['model'],qs[_0xb814('0x3f')](_0x32eca6['query'][_0xb814('0x3f')]));_0x4156d8[_0xb814('0x4a')]=_0x4156d8['attributes'][_0xb814('0x40')]?_0x4156d8['attributes']:_0x3f8e29['model'];if(_0x32eca6[_0xb814('0x39')][_0xb814('0x4d')]){_0x4156d8[_0xb814('0x4e')]=[{'all':!![]}];}_0x4156d8=_['merge']({},_0x4156d8,_0x32eca6[_0xb814('0x4c')]);return db['MailAccount'][_0xb814('0x53')](_0x4156d8)[_0xb814('0x1a')](handleEntityNotFound(_0x30f07b,null))['then'](respondWithResult(_0x30f07b,null))[_0xb814('0x54')](handleError(_0x30f07b,null));};exports['update']=function(_0x25a607,_0x1656ed){if(_0x25a607[_0xb814('0x55')]['id']){delete _0x25a607[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x25a607[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x52')],'as':'Imap'},{'model':db[_0xb814('0x34')],'as':_0xb814('0x35')}]})['then'](handleEntityNotFound(_0x1656ed,null))[_0xb814('0x1a')](saveUpdates(_0x25a607[_0xb814('0x55')],null))['then'](function(_0x371000){if(_0x371000&&_0x25a607['body']['Imap']){return db[_0xb814('0x52')]['update'](_0x25a607[_0xb814('0x55')][_0xb814('0x33')],{'where':{'MailAccountId':_0x371000['id']}})[_0xb814('0x1a')](function(){return _0x371000;});}return _0x371000;})['then'](function(_0x1a0ef4){if(_0x1a0ef4&&_0x25a607['body'][_0xb814('0x35')]){return db[_0xb814('0x34')][_0xb814('0x56')](_0x25a607[_0xb814('0x55')][_0xb814('0x35')],{'where':{'MailAccountId':_0x1a0ef4['id']}})[_0xb814('0x1a')](function(){return _0x1a0ef4;});}return _0x1a0ef4;})[_0xb814('0x1a')](respondWithResult(_0x1656ed,null))[_0xb814('0x54')](handleError(_0x1656ed,null));};exports[_0xb814('0x57')]=function(_0x4d611d,_0x211194){return db[_0xb814('0x36')][_0xb814('0x57')]()[_0xb814('0x1a')](respondWithResult(_0x211194,null))[_0xb814('0x54')](handleError(_0x211194,null));};exports[_0xb814('0x58')]=function(_0x52edfa,_0x135e13,_0x4ccd94){if(_0x52edfa[_0xb814('0x55')]['id']){delete _0x52edfa[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')]['find']({'where':{'id':_0x52edfa[_0xb814('0x51')]['id']}})['then'](handleEntityNotFound(_0x135e13,null))[_0xb814('0x1a')](function(_0x4a65d0){if(_0x4a65d0){_0x52edfa[_0xb814('0x55')][_0xb814('0x59')]=_0x4a65d0['id'];return db[_0xb814('0x5a')][_0xb814('0x5b')](_0x52edfa[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x135e13,null))[_0xb814('0x54')](handleError(_0x135e13,null));};exports['getDispositions']=function(_0x44088d,_0x51ca51,_0x255047){var _0x22c73f={'raw':![],'where':{}};var _0x1b989d={};var _0x3dcaeb={'count':0x0,'rows':[]};return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x44088d['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x51ca51,null))[_0xb814('0x1a')](function(_0x4a49ba){if(_0x4a49ba){_0x1b989d[_0xb814('0x3e')]=_[_0xb814('0x38')](db[_0xb814('0x5a')][_0xb814('0x37')]);_0x1b989d[_0xb814('0x39')]=_['keys'](_0x44088d[_0xb814('0x39')]);_0x1b989d['filters']=_[_0xb814('0x3d')](_0x1b989d[_0xb814('0x3e')],_0x1b989d[_0xb814('0x39')]);_0x22c73f[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x1b989d[_0xb814('0x3e')],qs['fields'](_0x44088d['query']['fields']));_0x22c73f[_0xb814('0x4a')]=_0x22c73f['attributes'][_0xb814('0x40')]?_0x22c73f[_0xb814('0x4a')]:_0x1b989d[_0xb814('0x3e')];if(!_0x44088d['query'][_0xb814('0x41')](_0xb814('0x42'))){_0x22c73f[_0xb814('0x2a')]=qs['limit'](_0x44088d[_0xb814('0x39')][_0xb814('0x2a')]);_0x22c73f[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x44088d['query']['offset']);}_0x22c73f[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x44088d[_0xb814('0x39')][_0xb814('0x5d')]);_0x22c73f[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x44088d[_0xb814('0x39')],_0x1b989d[_0xb814('0x3c')]));_0x22c73f[_0xb814('0x44')][_0xb814('0x59')]=_0x4a49ba['id'];if(_0x44088d[_0xb814('0x39')][_0xb814('0x4b')]){_0x22c73f[_0xb814('0x44')]=_[_0xb814('0x48')](_0x22c73f['where'],{'$or':_[_0xb814('0x49')](_0x22c73f[_0xb814('0x4a')],function(_0xfc9a65){var _0x357b90={};_0x357b90[_0xfc9a65]={'$like':'%'+_0x44088d[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x357b90;})});}_0x22c73f=_['merge']({},_0x22c73f,_0x44088d[_0xb814('0x4c')]);return db['Disposition'][_0xb814('0x28')]({'where':_0x22c73f[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x2292e6){_0x3dcaeb[_0xb814('0x28')]=_0x2292e6;if(_0x44088d['query']['includeAll']){_0x22c73f[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x5a')][_0xb814('0x4f')](_0x22c73f);})[_0xb814('0x1a')](function(_0x488ef2){_0x3dcaeb[_0xb814('0x50')]=_0x488ef2;return _0x3dcaeb;});}})['then'](respondWithFilteredResult(_0x51ca51,_0x22c73f))[_0xb814('0x54')](handleError(_0x51ca51,null));};exports[_0xb814('0x5e')]=function(_0x488314,_0x58b016,_0x2fa6b7){var _0x52e17a;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x488314[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x58b016,null))[_0xb814('0x1a')](function(_0x420bde){if(_0x420bde){return _0x420bde[_0xb814('0x5e')](_0x488314['query'][_0xb814('0x5f')]);}})['then'](respondWithStatusCode(_0x58b016,null))[_0xb814('0x54')](handleError(_0x58b016,null));};exports['addAnswer']=function(_0x2838cb,_0x43ee60,_0x58d56c){if(_0x2838cb[_0xb814('0x55')]['id']){delete _0x2838cb['body']['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x2838cb['params']['id']}})['then'](handleEntityNotFound(_0x43ee60,null))[_0xb814('0x1a')](function(_0x25d976){if(_0x25d976){_0x2838cb[_0xb814('0x55')][_0xb814('0x59')]=_0x25d976['id'];return db[_0xb814('0x60')][_0xb814('0x5b')](_0x2838cb[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x43ee60,null))[_0xb814('0x54')](handleError(_0x43ee60,null));};exports[_0xb814('0x61')]=function(_0x53e705,_0x5b0fcd,_0x5bee4d){var _0x5470e4={'raw':![],'where':{}};var _0x52b6da={};var _0x45a202={'count':0x0,'rows':[]};return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x53e705['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x5b0fcd,null))[_0xb814('0x1a')](function(_0x31c072){if(_0x31c072){_0x52b6da[_0xb814('0x3e')]=_[_0xb814('0x38')](db[_0xb814('0x60')][_0xb814('0x37')]);_0x52b6da[_0xb814('0x39')]=_['keys'](_0x53e705[_0xb814('0x39')]);_0x52b6da[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x52b6da[_0xb814('0x3e')],_0x52b6da['query']);_0x5470e4[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x52b6da[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x53e705[_0xb814('0x39')]['fields']));_0x5470e4['attributes']=_0x5470e4[_0xb814('0x4a')]['length']?_0x5470e4[_0xb814('0x4a')]:_0x52b6da[_0xb814('0x3e')];if(!_0x53e705['query'][_0xb814('0x41')]('nolimit')){_0x5470e4[_0xb814('0x2a')]=qs['limit'](_0x53e705[_0xb814('0x39')][_0xb814('0x2a')]);_0x5470e4[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x53e705[_0xb814('0x39')][_0xb814('0x29')]);}_0x5470e4[_0xb814('0x43')]=qs['sort'](_0x53e705['query'][_0xb814('0x5d')]);_0x5470e4['where']=qs['filters'](_[_0xb814('0x45')](_0x53e705[_0xb814('0x39')],_0x52b6da[_0xb814('0x3c')]));_0x5470e4['where'][_0xb814('0x59')]=_0x31c072['id'];if(_0x53e705['query'][_0xb814('0x4b')]){_0x5470e4[_0xb814('0x44')]=_[_0xb814('0x48')](_0x5470e4[_0xb814('0x44')],{'$or':_['map'](_0x5470e4[_0xb814('0x4a')],function(_0xc0ff3c){var _0x23ce94={};_0x23ce94[_0xc0ff3c]={'$like':'%'+_0x53e705['query'][_0xb814('0x4b')]+'%'};return _0x23ce94;})});}_0x5470e4=_[_0xb814('0x48')]({},_0x5470e4,_0x53e705[_0xb814('0x4c')]);return db['CannedAnswer'][_0xb814('0x28')]({'where':_0x5470e4[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x216d67){_0x45a202[_0xb814('0x28')]=_0x216d67;if(_0x53e705[_0xb814('0x39')][_0xb814('0x4d')]){_0x5470e4[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x60')][_0xb814('0x4f')](_0x5470e4);})[_0xb814('0x1a')](function(_0x2569a5){_0x45a202[_0xb814('0x50')]=_0x2569a5;return _0x45a202;});}})['then'](respondWithFilteredResult(_0x5b0fcd,_0x5470e4))['catch'](handleError(_0x5b0fcd,null));};exports[_0xb814('0x62')]=function(_0x50697f,_0x320296,_0x3949fd){var _0x43ab12;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x50697f[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x320296,null))['then'](function(_0x4a460a){if(_0x4a460a){return _0x4a460a[_0xb814('0x62')](_0x50697f['query'][_0xb814('0x5f')]);}})[_0xb814('0x1a')](respondWithStatusCode(_0x320296,null))[_0xb814('0x54')](handleError(_0x320296,null));};exports['create']=function(_0x342f2b,_0x28c358){var _0x35c60f={'name':_0x342f2b[_0xb814('0x55')][_0xb814('0x30')],'key':_0x342f2b['body'][_0xb814('0x63')],'email':_0x342f2b[_0xb814('0x55')]['email'],'ListId':_0x342f2b[_0xb814('0x55')][_0xb814('0x64')],'active':!_[_0xb814('0x65')](_0x342f2b['body'][_0xb814('0x66')])?_0x342f2b[_0xb814('0x55')]['active']:!![],'description':_0x342f2b[_0xb814('0x55')][_0xb814('0x67')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x342f2b[_0xb814('0x55')][_0xb814('0x68')])){if(_0x342f2b[_0xb814('0x55')][_0xb814('0x69')]){_0x35c60f[_0xb814('0x33')][_0xb814('0x6a')]=_0x35c60f[_0xb814('0x35')][_0xb814('0x6a')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x6b')];_0x35c60f[_0xb814('0x33')][_0xb814('0x6c')]=_0x35c60f['Smtp']['pass']=_0x342f2b[_0xb814('0x55')]['cpassword'];}else{_0x35c60f['Imap'][_0xb814('0x6d')]=_0x35c60f['Smtp']['authentication']=![];}_0x35c60f['Imap'][_0xb814('0x6e')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x33')]['host'];_0x35c60f[_0xb814('0x33')]['port']=_0x342f2b[_0xb814('0x55')][_0xb814('0x33')]['port'];_0x35c60f[_0xb814('0x35')]['host']=_0x342f2b[_0xb814('0x55')][_0xb814('0x35')][_0xb814('0x6e')];_0x35c60f[_0xb814('0x35')][_0xb814('0x6f')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x35')][_0xb814('0x6f')];}else{_0x35c60f[_0xb814('0x33')][_0xb814('0x70')]=_0x35c60f[_0xb814('0x35')][_0xb814('0x70')]=_0x342f2b[_0xb814('0x55')][_0xb814('0x68')];_0x35c60f[_0xb814('0x33')]['user']=_0x35c60f[_0xb814('0x35')][_0xb814('0x6a')]=_0x342f2b['body'][_0xb814('0x6b')];_0x35c60f[_0xb814('0x33')][_0xb814('0x6c')]=_0x35c60f['Smtp']['pass']=_0x342f2b[_0xb814('0x55')]['cpassword'];}return db[_0xb814('0x36')]['create'](_0x35c60f,{'include':[{'model':db[_0xb814('0x34')],'as':'Smtp'},{'model':db['MailServerIn'],'as':_0xb814('0x33')}]})[_0xb814('0x1a')](respondWithResult(_0x28c358,0xc9))[_0xb814('0x54')](handleError(_0x28c358,null));};exports[_0xb814('0x71')]=function(_0x396d76,_0x4339a2,_0x2101b5){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x396d76[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x4339a2,null))['then'](function(_0x5bd85){if(_0x5bd85){return _0x5bd85['getImap']();}return null;})[_0xb814('0x1a')](respondWithResult(_0x4339a2,null))[_0xb814('0x54')](handleError(_0x4339a2,null));};exports[_0xb814('0x72')]=function(_0x4fde6a,_0x6e5486,_0x18fb74){if(_0x4fde6a[_0xb814('0x55')]['id']){delete _0x4fde6a[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x4fde6a[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x6e5486,null))[_0xb814('0x1a')](function(_0x11d14f){if(_0x11d14f){_0x4fde6a[_0xb814('0x55')][_0xb814('0x59')]=_0x11d14f['id'];return db[_0xb814('0x52')][_0xb814('0x5b')](_0x4fde6a[_0xb814('0x55')]);}})['then'](respondWithResult(_0x6e5486,null))[_0xb814('0x54')](handleError(_0x6e5486,null));};exports[_0xb814('0x73')]=function(_0x3e61eb,_0x5200ec,_0x5d8ad5){return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x3e61eb['params']['id']}})['then'](handleEntityNotFound(_0x5200ec,null))['then'](function(_0xaf75b7){if(_0xaf75b7){return _0xaf75b7[_0xb814('0x74')](null);}return null;})['then'](respondWithStatusCode(_0x5200ec,null))[_0xb814('0x54')](handleError(_0x5200ec,null));};exports[_0xb814('0x75')]=function(_0x21485c,_0x3d24c3,_0x277b9a){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x21485c[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x3d24c3,null))[_0xb814('0x1a')](function(_0x2b82c6){if(_0x2b82c6){return _0x2b82c6['getSmtp']();}return null;})[_0xb814('0x1a')](respondWithResult(_0x3d24c3,null))['catch'](handleError(_0x3d24c3,null));};exports[_0xb814('0x76')]=function(_0x8c4544,_0x35e8f7,_0xa7ff62){if(_0x8c4544[_0xb814('0x55')]['id']){delete _0x8c4544[_0xb814('0x55')]['id'];}return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x8c4544['params']['id']}})['then'](handleEntityNotFound(_0x35e8f7,null))['then'](function(_0xfe3ae4){if(_0xfe3ae4){_0x8c4544[_0xb814('0x55')][_0xb814('0x59')]=_0xfe3ae4['id'];return db[_0xb814('0x34')][_0xb814('0x5b')](_0x8c4544[_0xb814('0x55')]);}})[_0xb814('0x1a')](respondWithResult(_0x35e8f7,null))[_0xb814('0x54')](handleError(_0x35e8f7,null));};exports[_0xb814('0x77')]=function(_0x1a5685,_0x51313d,_0x5c989a){return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x1a5685[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x51313d,null))[_0xb814('0x1a')](function(_0x2642ab){if(_0x2642ab){return _0x2642ab['setSmtp'](null);}return null;})[_0xb814('0x1a')](respondWithStatusCode(_0x51313d,null))['catch'](handleError(_0x51313d,null));};exports[_0xb814('0x78')]=function(_0x27b898,_0x205c6c,_0x94aa05){return db[_0xb814('0x79')][_0xb814('0x53')]({'where':{'id':_0x27b898[_0xb814('0x51')]['id']}})['then'](handleEntityNotFound(_0x205c6c,null))[_0xb814('0x1a')](function(_0x217fbd){if(_0x217fbd){return _0x217fbd[_0xb814('0x78')](_0x27b898[_0xb814('0x55')]['ids'],_[_0xb814('0x7a')](_0x27b898[_0xb814('0x55')],[_0xb814('0x5f'),'id'])||{});}})[_0xb814('0x1a')](respondWithResult(_0x205c6c,null))[_0xb814('0x54')](handleError(_0x205c6c,null));};exports['getInteractions']=function(_0x3812d1,_0x477511,_0x2406c1){var _0x561fcc={'raw':![],'where':{}};var _0x406fb8={};var _0x52ef26={'count':0x0,'rows':[]};return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x3812d1[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x477511,null))[_0xb814('0x1a')](function(_0x2b4601){if(_0x2b4601){_0x406fb8['model']=_[_0xb814('0x38')](db[_0xb814('0x79')][_0xb814('0x37')]);_0x406fb8[_0xb814('0x39')]=_[_0xb814('0x38')](_0x3812d1[_0xb814('0x39')]);_0x406fb8[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x406fb8[_0xb814('0x3e')],_0x406fb8[_0xb814('0x39')]);_0x561fcc[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x406fb8[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x3812d1[_0xb814('0x39')]['fields']));_0x561fcc[_0xb814('0x4a')]=_0x561fcc[_0xb814('0x4a')][_0xb814('0x40')]?_0x561fcc[_0xb814('0x4a')]:_0x406fb8[_0xb814('0x3e')];if(!_0x3812d1[_0xb814('0x39')]['hasOwnProperty'](_0xb814('0x42'))){_0x561fcc[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x3812d1[_0xb814('0x39')]['limit']);_0x561fcc['offset']=qs[_0xb814('0x29')](_0x3812d1[_0xb814('0x39')][_0xb814('0x29')]);}_0x561fcc[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x3812d1[_0xb814('0x39')]['sort']);_0x561fcc[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x3812d1[_0xb814('0x39')],_0x406fb8['filters']));_0x561fcc[_0xb814('0x44')][_0xb814('0x59')]=_0x2b4601['id'];if(_0x3812d1[_0xb814('0x39')][_0xb814('0x4b')]){_0x561fcc[_0xb814('0x44')]=_['merge'](_0x561fcc[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x561fcc[_0xb814('0x4a')],function(_0x2ba1e6){var _0x21981d={};_0x21981d[_0x2ba1e6]={'$like':'%'+_0x3812d1[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x21981d;})});}_0x561fcc=_[_0xb814('0x48')]({},_0x561fcc,_0x3812d1[_0xb814('0x4c')]);return db[_0xb814('0x79')][_0xb814('0x28')]({'where':_0x561fcc[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x4adfe9){_0x52ef26['count']=_0x4adfe9;if(_0x3812d1[_0xb814('0x39')][_0xb814('0x4d')]){_0x561fcc[_0xb814('0x4e')]=[{'model':db['CmContact'],'as':_0xb814('0x7b'),'required':![]},{'model':db[_0xb814('0x7c')],'as':_0xb814('0x7d'),'attributes':['name',_0xb814('0x7e'),_0xb814('0x7f')],'required':![]},{'model':db[_0xb814('0x80')],'as':_0xb814('0x81'),'attributes':['id',_0xb814('0x30'),_0xb814('0x82')],'where':_0x3812d1['query'][_0xb814('0x83')]?{'id':_0x3812d1['query'][_0xb814('0x83')]}:undefined,'required':_0x3812d1['query'][_0xb814('0x83')]?!![]:![]}];}return db[_0xb814('0x79')][_0xb814('0x4f')](_0x561fcc);})['then'](function(_0x197413){_0x52ef26[_0xb814('0x50')]=_0x197413;return _0x52ef26;});}})[_0xb814('0x1a')](respondWithFilteredResult(_0x477511,_0x561fcc))['catch'](handleError(_0x477511,null));};exports[_0xb814('0x84')]=function(_0x5d28cd,_0x47336c,_0x296dc9){return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x5d28cd[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x47336c,null))[_0xb814('0x1a')](function(_0xadf11b){if(_0xadf11b){return db['sequelize'][_0xb814('0x85')](function(_0x2ce263){return db[_0xb814('0x86')][_0xb814('0x2e')]({'where':{'MailAccountId':_0x5d28cd[_0xb814('0x51')]['id']},'transaction':_0x2ce263})[_0xb814('0x1a')](function(_0x8d77cd){var _0xa579c5=_[_0xb814('0x49')](_0x5d28cd['body'],function(_0x2fe47b){_0x2fe47b[_0xb814('0x59')]=_0x5d28cd[_0xb814('0x51')]['id'];return _0x2fe47b;});return db['MailApplication'][_0xb814('0x87')](_0xa579c5,{'transaction':_0x2ce263});});})['then'](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5d28cd[_0xb814('0x51')]['id']},'order':'priority'});});}})[_0xb814('0x1a')](respondWithResult(_0x47336c,null))[_0xb814('0x54')](handleError(_0x47336c,null));};exports['getApplications']=function(_0x5b6325,_0x40e5ca,_0x5634b5){var _0x35e464={};var _0x50f72a={};var _0x335b58;var _0x3e5b4d;return db[_0xb814('0x36')]['findOne']({'where':{'id':_0x5b6325['params']['id']}})['then'](handleEntityNotFound(_0x40e5ca,null))[_0xb814('0x1a')](function(_0x5018ea){if(_0x5018ea){_0x335b58=_0x5018ea;_0x50f72a['model']=_[_0xb814('0x38')](db['MailApplication']['rawAttributes']);_0x50f72a['query']=_[_0xb814('0x38')](_0x5b6325[_0xb814('0x39')]);_0x50f72a[_0xb814('0x3c')]=_['intersection'](_0x50f72a[_0xb814('0x3e')],_0x50f72a[_0xb814('0x39')]);_0x35e464[_0xb814('0x4a')]=_[_0xb814('0x3d')](_0x50f72a[_0xb814('0x3e')],qs[_0xb814('0x3f')](_0x5b6325['query'][_0xb814('0x3f')]));_0x35e464[_0xb814('0x4a')]=_0x35e464[_0xb814('0x4a')][_0xb814('0x40')]?_0x35e464['attributes']:_0x50f72a[_0xb814('0x3e')];_0x35e464[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x5b6325[_0xb814('0x39')][_0xb814('0x5d')]);_0x35e464[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x5b6325[_0xb814('0x39')],_0x50f72a[_0xb814('0x3c')]));if(_0x5b6325['query'][_0xb814('0x4b')]){_0x35e464[_0xb814('0x44')]=_['merge'](_0x35e464[_0xb814('0x44')],{'$or':_['map'](_0x35e464[_0xb814('0x4a')],function(_0x2c702d){var _0x5e2273={};_0x5e2273[_0x2c702d]={'$like':'%'+_0x5b6325[_0xb814('0x39')]['filter']+'%'};return _0x5e2273;})});}_0x35e464=_[_0xb814('0x48')]({},_0x35e464,_0x5b6325[_0xb814('0x4c')]);return _0x335b58[_0xb814('0x88')](_0x35e464);}})[_0xb814('0x1a')](function(_0x218de8){if(_0x218de8){_0x3e5b4d=_0x218de8['length'];if(!_0x5b6325[_0xb814('0x39')]['hasOwnProperty'](_0xb814('0x42'))){_0x35e464[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x5b6325[_0xb814('0x39')][_0xb814('0x2a')]);_0x35e464[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x5b6325[_0xb814('0x39')][_0xb814('0x29')]);}return _0x335b58['getApplications'](_0x35e464);}})[_0xb814('0x1a')](function(_0x261d02){if(_0x261d02){return _0x261d02?{'count':_0x3e5b4d,'rows':_0x261d02}:null;}})[_0xb814('0x1a')](respondWithResult(_0x40e5ca,null))[_0xb814('0x54')](handleError(_0x40e5ca,null));};exports['getMessages']=function(_0x328c09,_0x345fea,_0x4e9063){var _0x3364d1={'raw':!![],'where':{}};var _0x51a22c={};var _0x4f1deb={'count':0x0,'rows':[]};return db['MailAccount'][_0xb814('0x5c')]({'where':{'id':_0x328c09[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x345fea,null))[_0xb814('0x1a')](function(_0x2581b0){if(_0x2581b0){_0x51a22c['model']=_[_0xb814('0x38')](db[_0xb814('0x89')]['rawAttributes']);_0x51a22c[_0xb814('0x39')]=_['keys'](_0x328c09[_0xb814('0x39')]);_0x51a22c[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x51a22c[_0xb814('0x3e')],_0x51a22c[_0xb814('0x39')]);_0x3364d1[_0xb814('0x4a')]=_['intersection'](_0x51a22c['model'],qs[_0xb814('0x3f')](_0x328c09['query'][_0xb814('0x3f')]));_0x3364d1['attributes']=_0x3364d1[_0xb814('0x4a')][_0xb814('0x40')]?_0x3364d1[_0xb814('0x4a')]:_0x51a22c[_0xb814('0x3e')];if(!_0x328c09['query'][_0xb814('0x41')]('nolimit')){_0x3364d1['limit']=qs[_0xb814('0x2a')](_0x328c09[_0xb814('0x39')]['limit']);_0x3364d1[_0xb814('0x29')]=qs[_0xb814('0x29')](_0x328c09[_0xb814('0x39')][_0xb814('0x29')]);}_0x3364d1['order']=qs[_0xb814('0x5d')](_0x328c09[_0xb814('0x39')][_0xb814('0x5d')]);_0x3364d1[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x328c09[_0xb814('0x39')],_0x51a22c[_0xb814('0x3c')]));_0x3364d1[_0xb814('0x44')][_0xb814('0x59')]=_0x2581b0['id'];if(_0x328c09[_0xb814('0x39')][_0xb814('0x4b')]){_0x3364d1[_0xb814('0x44')]=_['merge'](_0x3364d1[_0xb814('0x44')],{'$or':_[_0xb814('0x49')](_0x3364d1[_0xb814('0x4a')],function(_0x158904){var _0x1a065b={};_0x1a065b[_0x158904]={'$like':'%'+_0x328c09[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x1a065b;})});}if(_0x328c09[_0xb814('0x39')]['$gte']){var _0x400dc9=_0x328c09[_0xb814('0x39')][_0xb814('0x8a')][_0xb814('0x8b')](',');var _0x3ec548={};_0x3ec548[_0x400dc9[0x0]]={'$gte':moment(_0x400dc9[0x1])[_0xb814('0x8c')](_0xb814('0x8d'))};_0x3364d1[_0xb814('0x44')]=_['merge'](_0x3364d1[_0xb814('0x44')],_0x3ec548);}_0x3364d1=_['merge']({},_0x3364d1,_0x328c09['options']);return db[_0xb814('0x89')]['count']({'where':_0x3364d1[_0xb814('0x44')]})[_0xb814('0x1a')](function(_0x2daa63){_0x4f1deb['count']=_0x2daa63;if(_0x328c09[_0xb814('0x39')][_0xb814('0x4d')]){_0x3364d1[_0xb814('0x4e')]=[{'all':!![]}];}return db[_0xb814('0x89')][_0xb814('0x4f')](_0x3364d1);})['then'](function(_0x1dafa9){_0x4f1deb[_0xb814('0x50')]=_0x1dafa9;return _0x4f1deb;});}})[_0xb814('0x1a')](respondWithFilteredResult(_0x345fea,_0x3364d1))['catch'](handleError(_0x345fea,null));};exports[_0xb814('0x31')]=function(_0x26f149,_0x3fc239,_0x3c79c5){var _0x1f0823,_0x1271ce={},_0x4c1805;if(_0x26f149[_0xb814('0x55')]['to']){_0x4c1805=_0x26f149[_0xb814('0x55')]['to'][_0xb814('0x8b')](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x26f149[_0xb814('0x51')]['id']},'include':[{'model':db[_0xb814('0x8e')],'as':_0xb814('0x8f'),'include':[{'model':db[_0xb814('0x90')],'as':'Contacts','where':{'email':_0x4c1805},'limit':0x1,'order':[[_0xb814('0x91'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0xb814('0x1a')](handleEntityNotFound(_0x3fc239,null))[_0xb814('0x1a')](function(_0xdcb11d){if(_0xdcb11d){_0x1f0823=_0xdcb11d;if(_0xdcb11d[_0xb814('0x35')]){if(_[_0xb814('0x65')](_0x26f149['body'][_0xb814('0x92')])){_0x26f149[_0xb814('0x55')][_0xb814('0x92')]=util[_0xb814('0x8c')](_0xb814('0x93'),_0xdcb11d[_0xb814('0x30')],_0xdcb11d[_0xb814('0x94')]||_0xdcb11d['Smtp']['user']);}if(_0x26f149['body'][_0xb814('0x95')]&&_0x26f149['body'][_0xb814('0x95')][_0xb814('0x40')]){for(var _0x2a1d69=0x0;_0x2a1d69<_0x26f149['body'][_0xb814('0x95')][_0xb814('0x40')];_0x2a1d69+=0x1){_0x26f149['body'][_0xb814('0x95')][_0x2a1d69]={'filename':_0x26f149[_0xb814('0x55')][_0xb814('0x95')][_0x2a1d69][_0xb814('0x30')],'path':path[_0xb814('0x96')](config[_0xb814('0x97')],_0xb814('0x98'),_0x26f149[_0xb814('0x55')][_0xb814('0x95')][_0x2a1d69][_0xb814('0x99')])};}}var _0x5ba901={'tls':{'rejectUnauthorized':![]}};if(_[_0xb814('0x65')](_0xdcb11d['Smtp'][_0xb814('0x70')])){if(_0xdcb11d[_0xb814('0x35')][_0xb814('0x6d')]){_0x5ba901[_0xb814('0x9a')]={'user':_0xdcb11d[_0xb814('0x35')]['user'],'pass':_0xdcb11d[_0xb814('0x35')][_0xb814('0x9b')]};}_0x5ba901[_0xb814('0x6e')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x6e')];_0x5ba901[_0xb814('0x6f')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x6f')];_0x5ba901[_0xb814('0x9c')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x9c')];}else{_0x5ba901[_0xb814('0x70')]=_0xdcb11d[_0xb814('0x35')][_0xb814('0x70')];_0x5ba901[_0xb814('0x9a')]={'user':_0xdcb11d[_0xb814('0x35')][_0xb814('0x6a')],'pass':_0xdcb11d[_0xb814('0x35')][_0xb814('0x9b')]};}return respondWithRpcPromise(_0xb814('0x9d'),'sendMail',{'account':_0x5ba901,'message':_0x26f149[_0xb814('0x55')]});}else{throw new Error(_0xb814('0x9e'));}}})[_0xb814('0x1a')](function(_0x39f158){if(_0x39f158){_0x1271ce=_0x39f158;if(_0x1f0823[_0xb814('0x8f')]){if(_0x1f0823[_0xb814('0x8f')]['Contacts'][_0xb814('0x40')]){return _0x1f0823[_0xb814('0x8f')][_0xb814('0x9f')][0x0];}else{return db[_0xb814('0x90')][_0xb814('0x5b')](_[_0xb814('0xa0')](_0x26f149[_0xb814('0x55')],{'firstName':_0x26f149[_0xb814('0x55')]['to'],'email':_0x26f149[_0xb814('0x55')]['to'],'phone':_0x26f149[_0xb814('0x55')]['to'],'ListId':_0x1f0823[_0xb814('0x64')]}));}}else{throw new Error(_0xb814('0x9e'));}}})[_0xb814('0x1a')](function(_0x347191){if(_0x347191){var _0x5b59cb={'UserId':_0x26f149[_0xb814('0x6a')]['id'],'ContactId':_0x347191['id'],'MailAccountId':_0x1f0823['id'],'inReplyTo':_0x1271ce[_0xb814('0xa1')],'to':_0x26f149[_0xb814('0x55')][_0xb814('0x92')],'cc':_0x26f149[_0xb814('0x55')]['cc'],'subject':_0x26f149[_0xb814('0x55')][_0xb814('0xa2')],'attach':_0x26f149[_0xb814('0x55')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xb814('0x8c')](_0xb814('0x8d')),'lastMsgDirection':_0xb814('0xa3'),'lastMsgBody':_0x26f149[_0xb814('0x55')][_0xb814('0x55')],'Messages':[_['merge'](_0x26f149[_0xb814('0x55')],{'messageId':_0x1271ce[_0xb814('0xa1')],'sentAt':moment()[_0xb814('0x8c')](_0xb814('0x8d')),'read':!![],'MailAccountId':_0x1f0823['id'],'UserId':_0x26f149['user']['id'],'ContactId':_0x347191['id']})]};if(_0x26f149['body'][_0xb814('0xa4')]){_0x5b59cb=_[_0xb814('0x48')](_0x5b59cb,_0x26f149[_0xb814('0x55')]['Interaction']);}return db[_0xb814('0x79')][_0xb814('0x5b')](_0x5b59cb,{'include':[{'model':db[_0xb814('0x89')],'as':_0xb814('0xa5')}]});}})['then'](respondWithResult(_0x3fc239,null))['catch'](handleError(_0x3fc239,null));};exports[_0xb814('0xa6')]=function(_0x400e18,_0x34950f,_0x54cc97){return db['MailAccount']['find']({'where':{'id':_0x400e18['params']['id']},'include':[{'model':db[_0xb814('0x34')],'as':_0xb814('0x35'),'raw':!![]}]})['then'](handleEntityNotFound(_0x34950f,null))[_0xb814('0x1a')](function(_0xe11205){if(_0xe11205&&_0xe11205[_0xb814('0x35')]){var _0x39e6ae={'id':_0xe11205['id'],'tls':{'rejectUnauthorized':![]}};if(_0xe11205[_0xb814('0x35')][_0xb814('0x70')]){_0x39e6ae[_0xb814('0x70')]=_0xe11205['Smtp'][_0xb814('0x70')];}else{_0x39e6ae[_0xb814('0x6e')]=_0xe11205[_0xb814('0x35')][_0xb814('0x6e')];_0x39e6ae[_0xb814('0x6f')]=_0xe11205[_0xb814('0x35')][_0xb814('0x6f')];_0x39e6ae[_0xb814('0x9c')]=_0xe11205[_0xb814('0x35')][_0xb814('0x9c')];}if(_0xe11205['Smtp'][_0xb814('0x6d')]){_0x39e6ae['auth']={'user':_0xe11205[_0xb814('0x35')]['user'],'pass':_0xe11205['Smtp'][_0xb814('0x9b')]};}return respondWithRpcPromise('VerifySmtp','verifySmtp',{'account':_0x39e6ae});}})[_0xb814('0x1a')](respondWithResult(_0x34950f,null))[_0xb814('0x54')](handleError(_0x34950f,null));};exports[_0xb814('0x2e')]=function(_0x4bc8aa,_0x58f887){return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x4bc8aa['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x58f887,null))[_0xb814('0x1a')](function(_0xae733a){if(_0xae733a&&_0xae733a[_0xb814('0x70')]){throw new db[(_0xb814('0xa7'))]['ValidationError'](_0xb814('0xa8'));}return _0xae733a;})['then'](removeEntity(_0x58f887,null))[_0xb814('0x54')](handleError(_0x58f887,null));};exports[_0xb814('0xa9')]=function(_0x19ad31,_0x30c1b6,_0xe64c48){return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x19ad31[_0xb814('0x51')]['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x30c1b6,null))[_0xb814('0x1a')](function(_0x433cb0){if(_0x433cb0){return _0x433cb0['addAgents'](_0x19ad31[_0xb814('0x55')][_0xb814('0x5f')],_[_0xb814('0x7a')](_0x19ad31[_0xb814('0x55')],[_0xb814('0x5f'),'id'])||{})[_0xb814('0xaa')](function(_0x5411f7){for(var _0x44b006=0x0;_0x44b006<_0x19ad31['body'][_0xb814('0x5f')][_0xb814('0x40')];_0x44b006+=0x1){socket[_0xb814('0xab')](_0xb814('0xac'),{'UserId':_0x19ad31[_0xb814('0x55')][_0xb814('0x5f')][_0x44b006],'MailAccountId':_0x19ad31['params']['id']});}return _0x5411f7;});}})['then'](respondWithResult(_0x30c1b6,null))[_0xb814('0x54')](handleError(_0x30c1b6,null));};exports[_0xb814('0xad')]=function(_0x500277,_0x392380,_0x9b96a3){var _0x5bd99c;return db[_0xb814('0x36')][_0xb814('0x53')]({'where':{'id':_0x500277['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x392380,null))[_0xb814('0x1a')](function(_0x3e4250){if(_0x3e4250){return _0x3e4250[_0xb814('0xad')](_0x500277['query'][_0xb814('0x5f')])['then'](function(_0x54f37a){if(_[_0xb814('0xae')](_0x500277[_0xb814('0x39')][_0xb814('0x5f')])){for(var _0x55b2dc=0x0;_0x55b2dc<_0x500277[_0xb814('0x39')][_0xb814('0x5f')][_0xb814('0x40')];_0x55b2dc+=0x1){socket[_0xb814('0xab')](_0xb814('0xaf'),{'UserId':_0x500277['query'][_0xb814('0x5f')][_0x55b2dc],'MailAccountId':_0x500277['params']['id']});}}else{socket[_0xb814('0xab')](_0xb814('0xaf'),{'UserId':_0x500277['query'][_0xb814('0x5f')],'MailAccountId':_0x500277[_0xb814('0x51')]['id']});}});}})['then'](respondWithStatusCode(_0x392380,null))[_0xb814('0x54')](handleError(_0x392380,null));};exports['getAgents']=function(_0x3f2f27,_0x5de4ed,_0x588941){var _0x5e2e23={};var _0x60b176={};var _0x35ebde;var _0x43c470;return db[_0xb814('0x36')][_0xb814('0x5c')]({'where':{'id':_0x3f2f27['params']['id']}})[_0xb814('0x1a')](handleEntityNotFound(_0x5de4ed,null))[_0xb814('0x1a')](function(_0xcec6da){if(_0xcec6da){_0x35ebde=_0xcec6da;_0x60b176['model']=_[_0xb814('0x38')](db[_0xb814('0x7c')]['rawAttributes']);_0x60b176['query']=_[_0xb814('0x38')](_0x3f2f27[_0xb814('0x39')]);_0x60b176[_0xb814('0x3c')]=_[_0xb814('0x3d')](_0x60b176[_0xb814('0x3e')],_0x60b176['query']);_0x5e2e23['attributes']=_[_0xb814('0x3d')](_0x60b176['model'],qs['fields'](_0x3f2f27[_0xb814('0x39')][_0xb814('0x3f')]));_0x5e2e23[_0xb814('0x4a')]=_0x5e2e23[_0xb814('0x4a')][_0xb814('0x40')]?_0x5e2e23['attributes']:_0x60b176[_0xb814('0x3e')];_0x5e2e23[_0xb814('0x43')]=qs[_0xb814('0x5d')](_0x3f2f27[_0xb814('0x39')][_0xb814('0x5d')]);_0x5e2e23[_0xb814('0x44')]=qs[_0xb814('0x3c')](_[_0xb814('0x45')](_0x3f2f27[_0xb814('0x39')],_0x60b176['filters']));if(_0x3f2f27[_0xb814('0x39')][_0xb814('0x4b')]){_0x5e2e23[_0xb814('0x44')]=_['merge'](_0x5e2e23['where'],{'$or':_[_0xb814('0x49')](_0x5e2e23[_0xb814('0x4a')],function(_0x37b42c){var _0x58b74a={};_0x58b74a[_0x37b42c]={'$like':'%'+_0x3f2f27[_0xb814('0x39')][_0xb814('0x4b')]+'%'};return _0x58b74a;})});}_0x5e2e23=_[_0xb814('0x48')]({},_0x5e2e23,_0x3f2f27[_0xb814('0x4c')]);return _0x35ebde[_0xb814('0xb0')](_0x5e2e23);}})[_0xb814('0x1a')](function(_0x1eff0c){if(_0x1eff0c){_0x43c470=_0x1eff0c[_0xb814('0x40')];if(!_0x3f2f27['query'][_0xb814('0x41')](_0xb814('0x42'))){_0x5e2e23[_0xb814('0x2a')]=qs[_0xb814('0x2a')](_0x3f2f27[_0xb814('0x39')][_0xb814('0x2a')]);_0x5e2e23[_0xb814('0x29')]=qs['offset'](_0x3f2f27[_0xb814('0x39')]['offset']);}return _0x35ebde[_0xb814('0xb0')](_0x5e2e23);}})[_0xb814('0x1a')](function(_0xb12802){if(_0xb12802){return _0xb12802?{'count':_0x43c470,'rows':_0xb12802}:null;}})[_0xb814('0x1a')](respondWithResult(_0x5de4ed,null))[_0xb814('0x54')](handleError(_0x5de4ed,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 4b0463f..7db6306 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 _0x3a10=['events','MailAccount','save','update','remove','emit','exports'];(function(_0x27f718,_0x39d58f){var _0x57ddb0=function(_0x327f1b){while(--_0x327f1b){_0x27f718['push'](_0x27f718['shift']());}};_0x57ddb0(++_0x39d58f);}(_0x3a10,0x1b9));var _0x03a1=function(_0x1c49da,_0x182cd1){_0x1c49da=_0x1c49da-0x0;var _0x2fff7b=_0x3a10[_0x1c49da];return _0x2fff7b;};'use strict';var EventEmitter=require(_0x03a1('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x03a1('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03a1('0x2'),'afterUpdate':_0x03a1('0x3'),'afterDestroy':_0x03a1('0x4')};function emitEvent(_0x2051e3){return function(_0x4f2beb,_0x5a147d,_0x5b93a0){MailAccountEvents[_0x03a1('0x5')](_0x2051e3+':'+_0x4f2beb['id'],_0x4f2beb);MailAccountEvents[_0x03a1('0x5')](_0x2051e3,_0x4f2beb);_0x5b93a0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x03a1('0x6')]=MailAccountEvents; \ No newline at end of file +var _0xfe49=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xfe49,0x1e5));var _0x9fe4=function(_0x22b570,_0x583648){_0x22b570=_0x22b570-0x0;var _0x4739a4=_0xfe49[_0x22b570];return _0x4739a4;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0x9fe4('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x9fe4('0x1')](0x0);var events={'afterCreate':_0x9fe4('0x2'),'afterUpdate':_0x9fe4('0x3'),'afterDestroy':_0x9fe4('0x4')};function emitEvent(_0x481bd6){return function(_0x3f8f9a,_0x22e534,_0x1c58b9){MailAccountEvents['emit'](_0x481bd6+':'+_0x3f8f9a['id'],_0x3f8f9a);MailAccountEvents['emit'](_0x481bd6,_0x3f8f9a);_0x1c58b9(null);};}for(var e in events){if(events[_0x9fe4('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x9fe4('0x6')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index aa7bdba..7d3b46e 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 _0x9529=['moment','request-promise','./mailAccount.attributes','exports','define','MailAccount','util','../../config/logger','api'];(function(_0x4c55cf,_0x4e4e8e){var _0x49b3f3=function(_0xc2128c){while(--_0xc2128c){_0x4c55cf['push'](_0x4c55cf['shift']());}};_0x49b3f3(++_0x4e4e8e);}(_0x9529,0x1ad));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x9952('0x0'));var logger=require(_0x9952('0x1'))(_0x9952('0x2'));var moment=require(_0x9952('0x3'));var BPromise=require('bluebird');var rp=require(_0x9952('0x4'));var attributes=require(_0x9952('0x5'));module[_0x9952('0x6')]=function(_0x16c8a4,_0x10c73a){return _0x16c8a4[_0x9952('0x7')](_0x9952('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85f1=['../../config/logger','bluebird','request-promise','define','mail_accounts','lodash'];(function(_0x2174d7,_0x32bc09){var _0x1d82c1=function(_0x1a80ea){while(--_0x1a80ea){_0x2174d7['push'](_0x2174d7['shift']());}};_0x1d82c1(++_0x32bc09);}(_0x85f1,0x107));var _0x185f=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x85f1[_0x24237f];return _0x48298e;};'use strict';var _=require(_0x185f('0x0'));var util=require('util');var logger=require(_0x185f('0x1'))('api');var moment=require('moment');var BPromise=require(_0x185f('0x2'));var rp=require(_0x185f('0x3'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x35c3ac,_0x267ddc){return _0x35c3ac[_0x185f('0x4')]('MailAccount',attributes,{'tableName':_0x185f('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 477ec3f..f651d5c 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 _0x26f3=['register','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','ShowMailAccount','find','map','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','MailServerOut','Smtp','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','defaults','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','MailInteraction','create','Contact\x20not\x20found','spread','update','get','interaction','created','attachments','originTo','Attachment','Attachments','User','name','waitForTheAssignedAgent','startRouting','Start','util','moment','randomstring','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x26f3,0x183));var _0x326f=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x26f3[_0x500c0];return _0xdd146f;};'use strict';var _=require('lodash');var util=require(_0x326f('0x0'));var moment=require(_0x326f('0x1'));var BPromise=require('bluebird');var rs=require(_0x326f('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x326f('0x3'))(_0x326f('0x4'));var config=require(_0x326f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x326f('0x6')][_0x326f('0x7')]({'port':0x232c});var socket=require(_0x326f('0x8'))({'host':'localhost','port':0x18eb});require('./mailAccount.socket')[_0x326f('0x9')](socket);function respondWithRpcPromise(_0xc18147,_0x66c773,_0x544e9c){return new BPromise(function(_0xaf6bf1,_0x57d81a){return client[_0x326f('0xa')](_0xc18147,_0x544e9c)[_0x326f('0xb')](function(_0x38b705){logger['info'](_0x326f('0xc'),_0x66c773,'request\x20sent');logger[_0x326f('0xd')](_0x326f('0xe'),_0x66c773,_0x326f('0xf'),JSON[_0x326f('0x10')](_0x38b705));if(_0x38b705[_0x326f('0x11')]){if(_0x38b705[_0x326f('0x11')][_0x326f('0x12')]===0x1f4){logger['error'](_0x326f('0xc'),_0x66c773,_0x38b705[_0x326f('0x11')]['message']);return _0x57d81a(_0x38b705[_0x326f('0x11')][_0x326f('0x13')]);}logger[_0x326f('0x11')](_0x326f('0xc'),_0x66c773,_0x38b705[_0x326f('0x11')]['message']);return _0xaf6bf1(_0x38b705[_0x326f('0x11')]['message']);}else{logger[_0x326f('0x14')](_0x326f('0xc'),_0x66c773,_0x326f('0xf'));_0xaf6bf1(_0x38b705[_0x326f('0x15')][_0x326f('0x13')]);}})[_0x326f('0x16')](function(_0xa4fca5){logger[_0x326f('0x11')](_0x326f('0xc'),_0x66c773,_0xa4fca5);_0x57d81a(_0xa4fca5);});});}exports[_0x326f('0x17')]=function(_0x35d62b){var _0x21e1e0=this;return new Promise(function(_0x11f97e,_0xb95f){return db[_0x326f('0x18')]['findAll']({'raw':_0x35d62b['options']?_0x35d62b[_0x326f('0x19')][_0x326f('0x1a')]===undefined?!![]:![]:!![],'where':_0x35d62b[_0x326f('0x19')]?_0x35d62b[_0x326f('0x19')][_0x326f('0x1b')]||null:null,'attributes':_0x35d62b[_0x326f('0x19')]?_0x35d62b[_0x326f('0x19')][_0x326f('0x1c')]||null:null,'limit':_0x35d62b[_0x326f('0x19')]?_0x35d62b[_0x326f('0x19')][_0x326f('0x1d')]||null:null,'include':_0x35d62b['options']?_0x35d62b[_0x326f('0x19')][_0x326f('0x1e')]?_['map'](_0x35d62b[_0x326f('0x19')]['include'],function(_0x436faf){return{'model':db[_0x436faf['model']],'as':_0x436faf['as'],'attributes':_0x436faf[_0x326f('0x1c')],'include':_0x436faf[_0x326f('0x1e')]?_['map'](_0x436faf['include'],function(_0x10c0db){return{'model':db[_0x10c0db[_0x326f('0x1f')]],'as':_0x10c0db['as'],'attributes':_0x10c0db[_0x326f('0x1c')],'include':_0x10c0db[_0x326f('0x1e')]?_['map'](_0x10c0db[_0x326f('0x1e')],function(_0x50b9f5){return{'model':db[_0x50b9f5['model']],'as':_0x50b9f5['as'],'attributes':_0x50b9f5[_0x326f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x326f('0xb')](function(_0x8b4caa){logger[_0x326f('0x14')](_0x326f('0x17'),_0x35d62b);logger[_0x326f('0xd')]('GetMailAccount',_0x35d62b,JSON['stringify'](_0x8b4caa));_0x11f97e(_0x8b4caa);})[_0x326f('0x16')](function(_0x171917){logger[_0x326f('0x11')](_0x326f('0x17'),_0x171917['message'],_0x35d62b);_0xb95f(_0x21e1e0['error'](0x1f4,_0x171917[_0x326f('0x13')]));});});};exports[_0x326f('0x20')]=function(_0x27abdf){var _0x4f3a90=this;return new Promise(function(_0x4b297a,_0xeabac3){return db[_0x326f('0x18')][_0x326f('0x21')]({'raw':_0x27abdf['options']?_0x27abdf['options'][_0x326f('0x1a')]===undefined?!![]:![]:!![],'where':_0x27abdf[_0x326f('0x19')]?_0x27abdf[_0x326f('0x19')][_0x326f('0x1b')]||null:null,'attributes':_0x27abdf[_0x326f('0x19')]?_0x27abdf[_0x326f('0x19')][_0x326f('0x1c')]||null:null,'include':_0x27abdf[_0x326f('0x19')]?_0x27abdf[_0x326f('0x19')][_0x326f('0x1e')]?_[_0x326f('0x22')](_0x27abdf[_0x326f('0x19')][_0x326f('0x1e')],function(_0x1086ab){return{'model':db[_0x1086ab[_0x326f('0x1f')]],'as':_0x1086ab['as'],'attributes':_0x1086ab[_0x326f('0x1c')],'include':_0x1086ab['include']?_[_0x326f('0x22')](_0x1086ab['include'],function(_0x5d26e1){return{'model':db[_0x5d26e1[_0x326f('0x1f')]],'as':_0x5d26e1['as'],'attributes':_0x5d26e1['attributes'],'include':_0x5d26e1['include']?_[_0x326f('0x22')](_0x5d26e1['include'],function(_0x148605){return{'model':db[_0x148605['model']],'as':_0x148605['as'],'attributes':_0x148605[_0x326f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dd44d){logger['info'](_0x326f('0x20'),_0x27abdf);logger[_0x326f('0xd')]('ShowMailAccount',_0x27abdf,JSON['stringify'](_0x2dd44d));_0x4b297a(_0x2dd44d);})[_0x326f('0x16')](function(_0x591304){logger[_0x326f('0x11')](_0x326f('0x20'),_0x591304[_0x326f('0x13')],_0x27abdf);_0xeabac3(_0x4f3a90[_0x326f('0x11')](0x1f4,_0x591304[_0x326f('0x13')]));});});};exports[_0x326f('0x23')]=function(_0x43314b){var _0x14766e=this;return new Promise(function(_0x59cc73,_0xb50e8b){var _0x19f45e={'body':_0x43314b[_0x326f('0x24')],'channel':_0x326f('0x25')};var _0x1fdff3=_[_0x326f('0x26')](_[_0x326f('0x27')](db[_0x326f('0x28')][_0x326f('0x29')]),['createdAt','updatedAt',_0x326f('0x2a'),_0x326f('0x2b')]);var _0x55cfa3=![];if(_0x43314b[_0x326f('0x24')]['id']){delete _0x43314b[_0x326f('0x24')]['id'];}if(_[_0x326f('0x2c')](_0x43314b[_0x326f('0x24')][_0x326f('0x2d')])){return _0xb50e8b(_0x14766e['error'](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x326f('0x2c')](_0x43314b[_0x326f('0x24')][_0x326f('0x24')])||_0x43314b[_0x326f('0x24')][_0x326f('0x24')]===''){return _0xb50e8b(_0x14766e[_0x326f('0x11')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x326f('0x2c')](_0x43314b['body'][_0x326f('0x2e')])){return _0xb50e8b(_0x14766e['error'](0x1f4,_0x326f('0x2f')+_0x1fdff3));}if(!_[_0x326f('0x30')](_0x1fdff3,_0x43314b[_0x326f('0x24')][_0x326f('0x2e')])){return _0xb50e8b(_0x14766e[_0x326f('0x11')](0x1f4,_0x326f('0x31')+_0x1fdff3));}var _0x5d853a={};_0x5d853a[_0x43314b[_0x326f('0x24')]['mapKey']]=_0x43314b[_0x326f('0x24')][_0x326f('0x2d')];return db[_0x326f('0x18')][_0x326f('0x21')]({'where':{'id':_0x43314b[_0x326f('0x32')]['id']},'include':[{'model':db[_0x326f('0x33')],'as':_0x326f('0x34'),'include':[{'model':db[_0x326f('0x28')],'as':_0x326f('0x35'),'where':_0x5d853a,'limit':0x1,'order':[[_0x326f('0x36'),_0x326f('0x37')]]}]},{'model':db[_0x326f('0x38')],'as':'Applications'},{'model':db[_0x326f('0x39')],'as':_0x326f('0x3a')}]})[_0x326f('0xb')](function(_0x2213c1){if(_0x2213c1&&_0x2213c1['List']){var _0x58d50b=_0x2213c1['get']({'plain':!![]});_0x19f45e['account']=_[_0x326f('0x3b')](_0x58d50b,[_0x326f('0x3c'),_0x326f('0x34')]);_0x19f45e[_0x326f('0x3d')]=_0x58d50b[_0x326f('0x3c')];_0x19f45e[_0x326f('0x3e')]=_0x58d50b['List'];_0x19f45e[_0x326f('0x3d')]=_[_0x326f('0x3f')](_0x19f45e[_0x326f('0x3d')],[_0x326f('0x40')],[_0x326f('0x41')]);if(_0x19f45e[_0x326f('0x32')]&&_0x19f45e[_0x326f('0x32')][_0x326f('0x42')]){_0x19f45e[_0x326f('0x3d')][_0x326f('0x43')]({'id':0x0,'priority':_0x19f45e[_0x326f('0x3d')]['length']+0x1,'app':_0x326f('0x44'),'appdata':_0x326f('0x42'),'interval':_0x326f('0x45')});}if(_0x19f45e['account']['Applications']){delete _0x19f45e[_0x326f('0x32')][_0x326f('0x3c')];}if(_0x19f45e[_0x326f('0x32')]['List']){delete _0x19f45e[_0x326f('0x32')][_0x326f('0x34')];}if(_0x58d50b[_0x326f('0x34')][_0x326f('0x35')][_0x326f('0x46')]){return _0x58d50b[_0x326f('0x34')][_0x326f('0x35')][0x0];}var _0x4fa97b=_[_0x326f('0x47')](_0x43314b[_0x326f('0x24')],{'firstName':_0x43314b[_0x326f('0x24')][_0x326f('0x2d')],'ListId':_0x58d50b[_0x326f('0x2b')]});_0x4fa97b[_0x43314b['body']['mapKey']]=_0x43314b[_0x326f('0x24')][_0x326f('0x2d')];return db[_0x326f('0x28')]['create'](_0x4fa97b);}else{throw new Error(_0x326f('0x48'));}})[_0x326f('0xb')](function(_0x4dcb8f){_0x19f45e[_0x326f('0x49')]=_0x4dcb8f;if(_0x4dcb8f){if(!_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4a')]){_0x43314b['body'][_0x326f('0x13')]['messageId']=rs[_0x326f('0x4b')]()+'\x20'+_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['from'];}var _0x1b6395={'ContactId':_0x4dcb8f['id'],'MailAccountId':_0x43314b[_0x326f('0x32')]['id'],'inReplyTo':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4a')],'to':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x2d')],'cc':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['cc'],'subject':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4c')],'attach':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4d')],'lastMsgAt':moment()[_0x326f('0x4e')](_0x326f('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x43314b[_0x326f('0x24')][_0x326f('0x24')]};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x43314b[_0x326f('0x32')]['id']},'include':[{'model':db[_0x326f('0x50')],'as':_0x326f('0x51'),'attributes':['messageId'],'where':{'messageId':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['inReplyTo']}}]})[_0x326f('0xb')](function(_0x57f186){if(_0x57f186){return[_0x57f186,![]];}return db[_0x326f('0x52')][_0x326f('0x53')](_0x1b6395)[_0x326f('0xb')](function(_0x5eba64){return[_0x5eba64,!![]];});});}else{throw new Error(_0x326f('0x54'));}})[_0x326f('0x55')](function(_0x2f9057,_0x40af48){if(_0x2f9057){_0x55cfa3=_0x40af48;if(!_0x40af48){return _0x2f9057[_0x326f('0x56')]({'inReplyTo':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['messageId'],'to':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['from'],'cc':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['cc'],'subject':_0x43314b['body'][_0x326f('0x13')][_0x326f('0x4c')],'attach':_0x2f9057[_0x326f('0x4d')]?_0x2f9057[_0x326f('0x4d')]:_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4d')],'substatus':null,'substatusAt':moment()[_0x326f('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x326f('0x4f')),'lastMsgDirection':'in','lastMsgBody':_0x43314b[_0x326f('0x24')][_0x326f('0x24')]});}else{return _0x2f9057;}}})[_0x326f('0xb')](function(_0x5a8e06){_0x19f45e['interaction']=_0x5a8e06[_0x326f('0x57')]({'plain':!![]});_0x19f45e[_0x326f('0x58')][_0x326f('0x59')]=_0x55cfa3;return db[_0x326f('0x50')][_0x326f('0x53')]({'body':_0x43314b[_0x326f('0x24')][_0x326f('0x24')],'MailAccountId':_0x43314b[_0x326f('0x32')]['id'],'MailInteractionId':_0x5a8e06['id'],'direction':'in','ContactId':_0x19f45e[_0x326f('0x49')]['id'],'messageId':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4a')],'from':_0x43314b[_0x326f('0x24')]['message'][_0x326f('0x2d')],'to':_0x43314b[_0x326f('0x24')]['message']['to'],'cc':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['cc'],'subject':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4c')],'attach':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x4d')],'Attachments':_0x43314b['body'][_0x326f('0x13')][_0x326f('0x5a')],'originTo':_0x43314b[_0x326f('0x24')][_0x326f('0x13')][_0x326f('0x5b')],'originCc':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['originCc'],'bcc':_0x43314b[_0x326f('0x24')][_0x326f('0x13')]['bcc']},{'include':[{'model':db[_0x326f('0x5c')],'as':_0x326f('0x5d')}]});})[_0x326f('0xb')](function(_0x1fd8be){_0x19f45e[_0x326f('0x13')]=_0x1fd8be;if(_0x19f45e[_0x326f('0x58')]['UserId']){return db[_0x326f('0x5e')][_0x326f('0x21')]({'attributes':['id',_0x326f('0x5f')],'where':{'id':_0x19f45e[_0x326f('0x58')]['UserId']}})[_0x326f('0xb')](function(_0x42b366){if(_0x42b366){_0x19f45e[_0x326f('0x3d')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x42b366[_0x326f('0x5f')]+','+(_0x19f45e['account'][_0x326f('0x60')]||0xa),'interval':_0x326f('0x45')});}return respondWithRpcPromise('Start',_0x326f('0x61'),_0x19f45e);});}return respondWithRpcPromise(_0x326f('0x62'),_0x326f('0x61'),_0x19f45e);})[_0x326f('0xb')](function(_0x5ad2f9){_0x59cc73(_0x5ad2f9);})[_0x326f('0x16')](function(_0x33e885){_0xb50e8b(_0x14766e[_0x326f('0x11')](0x1f4,_0x33e885[_0x326f('0x13')]));});});}; \ No newline at end of file +var _0x2726=['info','catch','ShowMailAccount','raw','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','ListId','body','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','from','account','CmList','List','Contacts','updatedAt','DESC','Applications','MailServerOut','get','omit','list','applications','orderBy','asc','autoclose','push','length','close','*,*,*,*','defaults','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','find','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','update','created','attachments','originCc','bcc','Attachment','Attachments','name','interaction','UserId','unshift','startRouting','Start','lodash','util','bluebird','randomstring','rpc','jayson/promise','client','http','socket.io-emitter','localhost','./mailAccount.socket','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','where','attributes','map','include','model'];(function(_0x1e1158,_0x233f4b){var _0x138526=function(_0x339bcf){while(--_0x339bcf){_0x1e1158['push'](_0x1e1158['shift']());}};_0x138526(++_0x233f4b);}(_0x2726,0x1d0));var _0x6272=function(_0x2118ad,_0xe8e3fd){_0x2118ad=_0x2118ad-0x0;var _0x4b5715=_0x2726[_0x2118ad];return _0x4b5715;};'use strict';var _=require(_0x6272('0x0'));var util=require(_0x6272('0x1'));var moment=require('moment');var BPromise=require(_0x6272('0x2'));var rs=require(_0x6272('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6272('0x4'));var config=require('../../config/environment');var jayson=require(_0x6272('0x5'));var client=jayson[_0x6272('0x6')][_0x6272('0x7')]({'port':0x232c});var socket=require(_0x6272('0x8'))({'host':_0x6272('0x9'),'port':0x18eb});require(_0x6272('0xa'))[_0x6272('0xb')](socket);function respondWithRpcPromise(_0x4e686e,_0x474731,_0x54849e){return new BPromise(function(_0x17dc82,_0x10e5c7){return client[_0x6272('0xc')](_0x4e686e,_0x54849e)[_0x6272('0xd')](function(_0x408267){logger['info']('MailAccount,\x20%s,\x20%s',_0x474731,_0x6272('0xe'));logger[_0x6272('0xf')](_0x6272('0x10'),_0x474731,_0x6272('0xe'),JSON[_0x6272('0x11')](_0x408267));if(_0x408267[_0x6272('0x12')]){if(_0x408267['error']['code']===0x1f4){logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x408267[_0x6272('0x12')][_0x6272('0x14')]);return _0x10e5c7(_0x408267[_0x6272('0x12')]['message']);}logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x408267[_0x6272('0x12')][_0x6272('0x14')]);return _0x17dc82(_0x408267['error'][_0x6272('0x14')]);}else{logger['info'](_0x6272('0x13'),_0x474731,_0x6272('0xe'));_0x17dc82(_0x408267[_0x6272('0x15')][_0x6272('0x14')]);}})['catch'](function(_0x6f209e){logger[_0x6272('0x12')](_0x6272('0x13'),_0x474731,_0x6f209e);_0x10e5c7(_0x6f209e);});});}exports[_0x6272('0x16')]=function(_0x297ee0){var _0x2731e7=this;return new Promise(function(_0x41e5b6,_0x21a862){return db[_0x6272('0x17')][_0x6272('0x18')]({'raw':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')][_0x6272('0x1a')]||null:null,'attributes':_0x297ee0[_0x6272('0x19')]?_0x297ee0['options'][_0x6272('0x1b')]||null:null,'limit':_0x297ee0[_0x6272('0x19')]?_0x297ee0[_0x6272('0x19')]['limit']||null:null,'include':_0x297ee0['options']?_0x297ee0[_0x6272('0x19')]['include']?_[_0x6272('0x1c')](_0x297ee0[_0x6272('0x19')][_0x6272('0x1d')],function(_0xcac3ba){return{'model':db[_0xcac3ba['model']],'as':_0xcac3ba['as'],'attributes':_0xcac3ba[_0x6272('0x1b')],'include':_0xcac3ba[_0x6272('0x1d')]?_['map'](_0xcac3ba['include'],function(_0x25f545){return{'model':db[_0x25f545['model']],'as':_0x25f545['as'],'attributes':_0x25f545[_0x6272('0x1b')],'include':_0x25f545[_0x6272('0x1d')]?_['map'](_0x25f545[_0x6272('0x1d')],function(_0x3652ce){return{'model':db[_0x3652ce[_0x6272('0x1e')]],'as':_0x3652ce['as'],'attributes':_0x3652ce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1faf44){logger[_0x6272('0x1f')](_0x6272('0x16'),_0x297ee0);logger[_0x6272('0xf')](_0x6272('0x16'),_0x297ee0,JSON[_0x6272('0x11')](_0x1faf44));_0x41e5b6(_0x1faf44);})[_0x6272('0x20')](function(_0x3204e1){logger[_0x6272('0x12')](_0x6272('0x16'),_0x3204e1['message'],_0x297ee0);_0x21a862(_0x2731e7[_0x6272('0x12')](0x1f4,_0x3204e1[_0x6272('0x14')]));});});};exports[_0x6272('0x21')]=function(_0x4723da){var _0x4b6718=this;return new Promise(function(_0x14beac,_0xb4ee0e){return db[_0x6272('0x17')]['find']({'raw':_0x4723da[_0x6272('0x19')]?_0x4723da['options'][_0x6272('0x22')]===undefined?!![]:![]:!![],'where':_0x4723da[_0x6272('0x19')]?_0x4723da[_0x6272('0x19')][_0x6272('0x1a')]||null:null,'attributes':_0x4723da['options']?_0x4723da[_0x6272('0x19')][_0x6272('0x1b')]||null:null,'include':_0x4723da['options']?_0x4723da[_0x6272('0x19')]['include']?_[_0x6272('0x1c')](_0x4723da[_0x6272('0x19')][_0x6272('0x1d')],function(_0x3f5917){return{'model':db[_0x3f5917[_0x6272('0x1e')]],'as':_0x3f5917['as'],'attributes':_0x3f5917['attributes'],'include':_0x3f5917[_0x6272('0x1d')]?_[_0x6272('0x1c')](_0x3f5917[_0x6272('0x1d')],function(_0x1d7f5c){return{'model':db[_0x1d7f5c['model']],'as':_0x1d7f5c['as'],'attributes':_0x1d7f5c[_0x6272('0x1b')],'include':_0x1d7f5c[_0x6272('0x1d')]?_['map'](_0x1d7f5c[_0x6272('0x1d')],function(_0x5b3911){return{'model':db[_0x5b3911[_0x6272('0x1e')]],'as':_0x5b3911['as'],'attributes':_0x5b3911[_0x6272('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6272('0xd')](function(_0x163f19){logger[_0x6272('0x1f')](_0x6272('0x21'),_0x4723da);logger[_0x6272('0xf')](_0x6272('0x21'),_0x4723da,JSON[_0x6272('0x11')](_0x163f19));_0x14beac(_0x163f19);})[_0x6272('0x20')](function(_0x11a2b3){logger[_0x6272('0x12')](_0x6272('0x21'),_0x11a2b3['message'],_0x4723da);_0xb4ee0e(_0x4b6718['error'](0x1f4,_0x11a2b3[_0x6272('0x14')]));});});};exports[_0x6272('0x23')]=function(_0x27bbea){var _0x345f2e=this;return new Promise(function(_0x45c2b9,_0x578069){var _0x327acb={'body':_0x27bbea['body'],'channel':_0x6272('0x24')};var _0x15c143=_[_0x6272('0x25')](_[_0x6272('0x26')](db[_0x6272('0x27')][_0x6272('0x28')]),[_0x6272('0x29'),'updatedAt','CompanyId',_0x6272('0x2a')]);var _0x4c8075=![];if(_0x27bbea[_0x6272('0x2b')]['id']){delete _0x27bbea[_0x6272('0x2b')]['id'];}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')]['from'])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')][_0x6272('0x2b')])||_0x27bbea[_0x6272('0x2b')]['body']===''){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x2d')));}if(_[_0x6272('0x2c')](_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x2f')+_0x15c143));}if(!_[_0x6272('0x30')](_0x15c143,_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')])){return _0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6272('0x31')+_0x15c143));}var _0x4104e5={};_0x4104e5[_0x27bbea['body']['mapKey']]=_0x27bbea[_0x6272('0x2b')][_0x6272('0x32')];return db[_0x6272('0x17')]['find']({'where':{'id':_0x27bbea[_0x6272('0x33')]['id']},'include':[{'model':db[_0x6272('0x34')],'as':_0x6272('0x35'),'include':[{'model':db[_0x6272('0x27')],'as':_0x6272('0x36'),'where':_0x4104e5,'limit':0x1,'order':[[_0x6272('0x37'),_0x6272('0x38')]]}]},{'model':db['MailApplication'],'as':_0x6272('0x39')},{'model':db[_0x6272('0x3a')],'as':'Smtp'}]})[_0x6272('0xd')](function(_0x5420e4){if(_0x5420e4&&_0x5420e4[_0x6272('0x35')]){var _0x273c07=_0x5420e4[_0x6272('0x3b')]({'plain':!![]});_0x327acb['account']=_[_0x6272('0x3c')](_0x273c07,[_0x6272('0x39'),_0x6272('0x35')]);_0x327acb['applications']=_0x273c07['Applications'];_0x327acb[_0x6272('0x3d')]=_0x273c07[_0x6272('0x35')];_0x327acb[_0x6272('0x3e')]=_[_0x6272('0x3f')](_0x327acb[_0x6272('0x3e')],['priority'],[_0x6272('0x40')]);if(_0x327acb[_0x6272('0x33')]&&_0x327acb[_0x6272('0x33')][_0x6272('0x41')]){_0x327acb[_0x6272('0x3e')][_0x6272('0x42')]({'id':0x0,'priority':_0x327acb[_0x6272('0x3e')][_0x6272('0x43')]+0x1,'app':_0x6272('0x44'),'appdata':_0x6272('0x41'),'interval':_0x6272('0x45')});}if(_0x327acb[_0x6272('0x33')][_0x6272('0x39')]){delete _0x327acb[_0x6272('0x33')][_0x6272('0x39')];}if(_0x327acb[_0x6272('0x33')]['List']){delete _0x327acb[_0x6272('0x33')][_0x6272('0x35')];}if(_0x273c07[_0x6272('0x35')][_0x6272('0x36')][_0x6272('0x43')]){return _0x273c07[_0x6272('0x35')][_0x6272('0x36')][0x0];}var _0x39b236=_[_0x6272('0x46')](_0x27bbea[_0x6272('0x2b')],{'firstName':_0x27bbea[_0x6272('0x2b')]['from'],'ListId':_0x273c07[_0x6272('0x2a')]});_0x39b236[_0x27bbea[_0x6272('0x2b')][_0x6272('0x2e')]]=_0x27bbea[_0x6272('0x2b')][_0x6272('0x32')];return db['CmContact']['create'](_0x39b236);}else{throw new Error(_0x6272('0x47'));}})['then'](function(_0x4648a7){_0x327acb[_0x6272('0x48')]=_0x4648a7;if(_0x4648a7){if(!_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')]){_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')]=rs['generate']()+'\x20'+_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x32')];}var _0x1772a0={'ContactId':_0x4648a7['id'],'MailAccountId':_0x27bbea[_0x6272('0x33')]['id'],'inReplyTo':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x49')],'to':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'cc':_0x27bbea['body'][_0x6272('0x14')]['cc'],'subject':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x4a')],'attach':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4b')],'lastMsgAt':moment()[_0x6272('0x4c')](_0x6272('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x27bbea[_0x6272('0x2b')][_0x6272('0x2b')]};return db[_0x6272('0x4e')][_0x6272('0x4f')]({'where':{'closed':![],'MailAccountId':_0x27bbea[_0x6272('0x33')]['id']},'include':[{'model':db[_0x6272('0x50')],'as':_0x6272('0x51'),'attributes':[_0x6272('0x49')],'where':{'messageId':_0x27bbea['body'][_0x6272('0x14')][_0x6272('0x52')]}}]})[_0x6272('0xd')](function(_0x67488d){if(_0x67488d){return[_0x67488d,![]];}return db[_0x6272('0x4e')][_0x6272('0x53')](_0x1772a0)['then'](function(_0x3d350d){return[_0x3d350d,!![]];});});}else{throw new Error(_0x6272('0x54'));}})[_0x6272('0x55')](function(_0xbace65,_0x476ed6){if(_0xbace65){_0x4c8075=_0x476ed6;if(!_0x476ed6){return _0xbace65[_0x6272('0x56')]({'inReplyTo':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x49')],'to':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'cc':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['cc'],'subject':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x4a')],'attach':_0xbace65[_0x6272('0x4b')]?_0xbace65['attach']:_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4b')],'substatus':null,'substatusAt':moment()[_0x6272('0x4c')](_0x6272('0x4d')),'lastMsgAt':moment()['format'](_0x6272('0x4d')),'lastMsgDirection':'in','lastMsgBody':_0x27bbea[_0x6272('0x2b')]['body']});}else{return _0xbace65;}}})['then'](function(_0x253435){_0x327acb['interaction']=_0x253435[_0x6272('0x3b')]({'plain':!![]});_0x327acb['interaction'][_0x6272('0x57')]=_0x4c8075;return db[_0x6272('0x50')][_0x6272('0x53')]({'body':_0x27bbea['body']['body'],'MailAccountId':_0x27bbea['account']['id'],'MailInteractionId':_0x253435['id'],'direction':'in','ContactId':_0x327acb['contact']['id'],'messageId':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x49')],'from':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['from'],'to':_0x27bbea['body'][_0x6272('0x14')]['to'],'cc':_0x27bbea[_0x6272('0x2b')]['message']['cc'],'subject':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x4a')],'attach':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['attach'],'Attachments':_0x27bbea[_0x6272('0x2b')]['message'][_0x6272('0x58')],'originTo':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')]['originTo'],'originCc':_0x27bbea['body'][_0x6272('0x14')][_0x6272('0x59')],'bcc':_0x27bbea[_0x6272('0x2b')][_0x6272('0x14')][_0x6272('0x5a')]},{'include':[{'model':db[_0x6272('0x5b')],'as':_0x6272('0x5c')}]});})[_0x6272('0xd')](function(_0x26ee6d){_0x327acb['message']=_0x26ee6d;if(_0x327acb['interaction']['UserId']){return db['User'][_0x6272('0x4f')]({'attributes':['id',_0x6272('0x5d')],'where':{'id':_0x327acb[_0x6272('0x5e')][_0x6272('0x5f')]}})[_0x6272('0xd')](function(_0x57efeb){if(_0x57efeb){_0x327acb['applications'][_0x6272('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x57efeb[_0x6272('0x5d')]+','+(_0x327acb[_0x6272('0x33')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x6272('0x61'),_0x327acb);});}return respondWithRpcPromise(_0x6272('0x62'),'startRouting',_0x327acb);})['then'](function(_0x3ca624){_0x45c2b9(_0x3ca624);})[_0x6272('0x20')](function(_0x6f300e){_0x578069(_0x345f2e[_0x6272('0x12')](0x1f4,_0x6f300e[_0x6272('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index ad1fef6..abf9031 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 _0xa3a9=['removeListener','register','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x5d900a,_0x49d04b){var _0x47b960=function(_0x1e482c){while(--_0x1e482c){_0x5d900a['push'](_0x5d900a['shift']());}};_0x47b960(++_0x49d04b);}(_0xa3a9,0xab));var _0x9a3a=function(_0x50199e,_0x3b1c45){_0x50199e=_0x50199e-0x0;var _0x1babb8=_0xa3a9[_0x50199e];return _0x1babb8;};'use strict';var MailAccountEvents=require(_0x9a3a('0x0'));var events=[_0x9a3a('0x1'),_0x9a3a('0x2'),_0x9a3a('0x3')];function createListener(_0x49c933,_0x1b91eb){return function(_0x3b8d5e){_0x1b91eb[_0x9a3a('0x4')](_0x49c933,_0x3b8d5e);};}function removeListener(_0x6dbd63,_0x36dfa2){return function(){MailAccountEvents[_0x9a3a('0x5')](_0x6dbd63,_0x36dfa2);};}exports[_0x9a3a('0x6')]=function(_0x373d4){for(var _0x30ba72=0x0,_0x31c311=events['length'];_0x30ba72<_0x31c311;_0x30ba72++){var _0x41a251=events[_0x30ba72];var _0x4afbef=createListener(_0x9a3a('0x7')+_0x41a251,_0x373d4);MailAccountEvents['on'](_0x41a251,_0x4afbef);}}; \ No newline at end of file +var _0xb845=['register','length','./mailAccount.events','remove','update','emit','removeListener'];(function(_0x47a3eb,_0x1d3f98){var _0x17abb6=function(_0x2d44bb){while(--_0x2d44bb){_0x47a3eb['push'](_0x47a3eb['shift']());}};_0x17abb6(++_0x1d3f98);}(_0xb845,0x1f3));var _0x5b84=function(_0x178474,_0x37d82d){_0x178474=_0x178474-0x0;var _0x35cc54=_0xb845[_0x178474];return _0x35cc54;};'use strict';var MailAccountEvents=require(_0x5b84('0x0'));var events=['save',_0x5b84('0x1'),_0x5b84('0x2')];function createListener(_0xcabdf6,_0x2c7728){return function(_0x236c18){_0x2c7728[_0x5b84('0x3')](_0xcabdf6,_0x236c18);};}function removeListener(_0x19ebb4,_0xbd2052){return function(){MailAccountEvents[_0x5b84('0x4')](_0x19ebb4,_0xbd2052);};}exports[_0x5b84('0x5')]=function(_0x219115){for(var _0x23cb57=0x0,_0x60c476=events[_0x5b84('0x6')];_0x23cb57<_0x60c476;_0x23cb57++){var _0x3c2a71=events[_0x23cb57];var _0x485552=createListener('mailAccount:'+_0x3c2a71,_0x219115);MailAccountEvents['on'](_0x3c2a71,_0x485552);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 37c7a72..f2ce309 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 _0xf37b=['../../config/environment','./mailApplication.controller','/:id','isAuthenticated','update','delete','path','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xf37b,0xec));var _0xbf37=function(_0x53afe9,_0x2c9f40){_0x53afe9=_0x53afe9-0x0;var _0x396396=_0xf37b[_0x53afe9];return _0x396396;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf37('0x0'));var express=require('express');var router=express[_0xbf37('0x1')]();var auth=require(_0xbf37('0x2'));var interaction=require(_0xbf37('0x3'));var config=require(_0xbf37('0x4'));var controller=require(_0xbf37('0x5'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['put'](_0xbf37('0x6'),auth[_0xbf37('0x7')](),controller[_0xbf37('0x8')]);router[_0xbf37('0x9')]('/:id',auth[_0xbf37('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3d98=['update','delete','isAuthenticated','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','put','/:id'];(function(_0x55c66e,_0x55b8a2){var _0x150ceb=function(_0x12344e){while(--_0x12344e){_0x55c66e['push'](_0x55c66e['shift']());}};_0x150ceb(++_0x55b8a2);}(_0x3d98,0xc7));var _0x83d9=function(_0x1c29ec,_0x5303c4){_0x1c29ec=_0x1c29ec-0x0;var _0x2b8d1c=_0x3d98[_0x1c29ec];return _0x2b8d1c;};'use strict';var multer=require(_0x83d9('0x0'));var util=require(_0x83d9('0x1'));var path=require(_0x83d9('0x2'));var express=require(_0x83d9('0x3'));var router=express['Router']();var auth=require(_0x83d9('0x4'));var interaction=require(_0x83d9('0x5'));var config=require('../../config/environment');var controller=require(_0x83d9('0x6'));router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x83d9('0x7')](_0x83d9('0x8'),auth['isAuthenticated'](),controller[_0x83d9('0x9')]);router[_0x83d9('0xa')](_0x83d9('0x8'),auth[_0x83d9('0xb')](),controller[_0x83d9('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 2880fa6..7733cdc 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 _0x12dc=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x592785,_0x4d7aa1){var _0x295080=function(_0x1aa0d8){while(--_0x1aa0d8){_0x592785['push'](_0x592785['shift']());}};_0x295080(++_0x4d7aa1);}(_0x12dc,0xfd));var _0xc12d=function(_0x51ab63,_0x2a9835){_0x51ab63=_0x51ab63-0x0;var _0x442a1b=_0x12dc[_0x51ab63];return _0x442a1b;};'use strict';var Sequelize=require(_0xc12d('0x0'));module[_0xc12d('0x1')]={'priority':{'type':Sequelize[_0xc12d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc12d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xc12d('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc12d('0x3')],'defaultValue':_0xc12d('0x4')}}; \ No newline at end of file +var _0xf6b8=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x2d4e02,_0x2a75e0){var _0x316dba=function(_0x24524e){while(--_0x24524e){_0x2d4e02['push'](_0x2d4e02['shift']());}};_0x316dba(++_0x2a75e0);}(_0xf6b8,0x1eb));var _0x8f6b=function(_0x8065e0,_0x530006){_0x8065e0=_0x8065e0-0x0;var _0x5b0f55=_0xf6b8[_0x8065e0];return _0x5b0f55;};'use strict';var Sequelize=require(_0x8f6b('0x0'));module[_0x8f6b('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8f6b('0x2')],'allowNull':![],'defaultValue':_0x8f6b('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x8f6b('0x2')]},'interval':{'type':Sequelize[_0x8f6b('0x2')],'defaultValue':_0x8f6b('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 11f82d2..7ffc8fd 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 _0xcffe=['../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','reject','save','then','destroy','stack','name','send','show','params','model','rawAttributes','keys','query','filters','intersection','fields','attributes','length','includeAll','include','options','MailApplication','catch','update','body','find','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x4bcf38,_0x3c12be){var _0x4a89be=function(_0x3215a6){while(--_0x3215a6){_0x4bcf38['push'](_0x4bcf38['shift']());}};_0x4a89be(++_0x3c12be);}(_0xcffe,0x1a1));var _0xecff=function(_0xeaf92d,_0x26a3bf){_0xeaf92d=_0xeaf92d-0x0;var _0x573a6a=_0xcffe[_0xeaf92d];return _0x573a6a;};'use strict';var jsonpatch=require(_0xecff('0x0'));var rp=require(_0xecff('0x1'));var moment=require(_0xecff('0x2'));var BPromise=require(_0xecff('0x3'));var Mustache=require(_0xecff('0x4'));var util=require(_0xecff('0x5'));var path=require(_0xecff('0x6'));var sox=require(_0xecff('0x7'));var csv=require(_0xecff('0x8'));var ejs=require(_0xecff('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0xecff('0xa'));var jsforce=require(_0xecff('0xb'));var deskjs=require(_0xecff('0xc'));var toCsv=require(_0xecff('0x8'));var querystring=require(_0xecff('0xd'));var Papa=require(_0xecff('0xe'));var qs=require(_0xecff('0xf'));var logger=require('../../config/logger')(_0xecff('0x10'));var utils=require(_0xecff('0x11'));var config=require(_0xecff('0x12'));var db=require(_0xecff('0x13'))['db'];function respondWithStatusCode(_0x698e40,_0x4fa444){_0x4fa444=_0x4fa444||0xcc;return function(_0x425380){if(_0x425380){return _0x698e40[_0xecff('0x14')](_0x4fa444);}return _0x698e40[_0xecff('0x15')](_0x4fa444)[_0xecff('0x16')]();};}function respondWithResult(_0x332475,_0x3f407c){_0x3f407c=_0x3f407c||0xc8;return function(_0x16c5dd){if(_0x16c5dd){return _0x332475[_0xecff('0x15')](_0x3f407c)[_0xecff('0x17')](_0x16c5dd);}};}function respondWithFilteredResult(_0x151a79,_0x1f67d2){return function(_0x2b0507){if(_0x2b0507){var _0x1e5973=_0x2b0507[_0xecff('0x18')],_0xb8745f=_0x1f67d2[_0xecff('0x19')],_0x5495f9=_0x1f67d2['offset']+_0x1f67d2[_0xecff('0x1a')],_0x4b1893;if(_0x5495f9>=_0x1e5973){_0x5495f9=_0x1e5973;_0x4b1893=0xc8;}else{_0x4b1893=0xce;}_0x151a79[_0xecff('0x15')](_0x4b1893);return _0x151a79[_0xecff('0x1b')]('Content-Range',_0xb8745f+'-'+_0x5495f9+'/'+_0x1e5973)['json'](_0x2b0507);}return null;};}function patchUpdates(_0x24abef){return function(_0xa5816b){try{jsonpatch['apply'](_0xa5816b,_0x24abef,!![]);}catch(_0x42d6c1){return BPromise[_0xecff('0x1c')](_0x42d6c1);}return _0xa5816b[_0xecff('0x1d')]();};}function saveUpdates(_0x2393db,_0x2fc1f9){return function(_0x1682a2){if(_0x1682a2){return _0x1682a2['update'](_0x2393db)[_0xecff('0x1e')](function(_0x422bd8){return _0x422bd8;});}return null;};}function removeEntity(_0x2c487c,_0x2badd7){return function(_0x49d0e2){if(_0x49d0e2){return _0x49d0e2[_0xecff('0x1f')]()[_0xecff('0x1e')](function(){_0x2c487c[_0xecff('0x15')](0xcc)[_0xecff('0x16')]();});}};}function handleEntityNotFound(_0x284458,_0x2402e0){return function(_0x494754){if(!_0x494754){_0x284458[_0xecff('0x14')](0x194);}return _0x494754;};}function handleError(_0x520d6d,_0x572ec2){_0x572ec2=_0x572ec2||0x1f4;return function(_0x2d16f1){logger['error'](_0x2d16f1[_0xecff('0x20')]);if(_0x2d16f1['name']){delete _0x2d16f1[_0xecff('0x21')];}_0x520d6d['status'](_0x572ec2)[_0xecff('0x22')](_0x2d16f1);};}exports[_0xecff('0x23')]=function(_0x505e20,_0x9f173d){var _0x18f4d4={'raw':!![],'where':{'id':_0x505e20[_0xecff('0x24')]['id']}},_0x393312={};_0x393312[_0xecff('0x25')]=_['keys'](db['MailApplication'][_0xecff('0x26')]);_0x393312['query']=_[_0xecff('0x27')](_0x505e20[_0xecff('0x28')]);_0x393312[_0xecff('0x29')]=_[_0xecff('0x2a')](_0x393312['model'],_0x393312['query']);_0x18f4d4['attributes']=_[_0xecff('0x2a')](_0x393312[_0xecff('0x25')],qs[_0xecff('0x2b')](_0x505e20[_0xecff('0x28')]['fields']));_0x18f4d4[_0xecff('0x2c')]=_0x18f4d4[_0xecff('0x2c')][_0xecff('0x2d')]?_0x18f4d4['attributes']:_0x393312[_0xecff('0x25')];if(_0x505e20[_0xecff('0x28')][_0xecff('0x2e')]){_0x18f4d4[_0xecff('0x2f')]=[{'all':!![]}];}_0x18f4d4=_['merge']({},_0x18f4d4,_0x505e20[_0xecff('0x30')]);return db[_0xecff('0x31')]['find'](_0x18f4d4)[_0xecff('0x1e')](handleEntityNotFound(_0x9f173d,null))[_0xecff('0x1e')](respondWithResult(_0x9f173d,null))[_0xecff('0x32')](handleError(_0x9f173d,null));};exports[_0xecff('0x33')]=function(_0x589339,_0x120eb3){if(_0x589339[_0xecff('0x34')]['id']){delete _0x589339[_0xecff('0x34')]['id'];}return db['MailApplication'][_0xecff('0x35')]({'where':{'id':_0x589339[_0xecff('0x24')]['id']}})[_0xecff('0x1e')](handleEntityNotFound(_0x120eb3,null))[_0xecff('0x1e')](saveUpdates(_0x589339[_0xecff('0x34')],null))[_0xecff('0x1e')](respondWithResult(_0x120eb3,null))['catch'](handleError(_0x120eb3,null));};exports['destroy']=function(_0x4dd43c,_0x2d2f8b){return db['MailApplication'][_0xecff('0x35')]({'where':{'id':_0x4dd43c[_0xecff('0x24')]['id']}})['then'](handleEntityNotFound(_0x2d2f8b,null))[_0xecff('0x1e')](removeEntity(_0x2d2f8b,null))[_0xecff('0x32')](handleError(_0x2d2f8b,null));}; \ No newline at end of file +var _0xb2e7=['find','catch','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','MailApplication','rawAttributes','keys','intersection','fields','query','length','attributes','includeAll','merge','options'];(function(_0x1a4011,_0x36ab2d){var _0x11b237=function(_0x4599c8){while(--_0x4599c8){_0x1a4011['push'](_0x1a4011['shift']());}};_0x11b237(++_0x36ab2d);}(_0xb2e7,0x111));var _0x7b2e=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb2e7[_0x42cae2];return _0x5f256f;};'use strict';var jsonpatch=require(_0x7b2e('0x0'));var rp=require(_0x7b2e('0x1'));var moment=require(_0x7b2e('0x2'));var BPromise=require(_0x7b2e('0x3'));var Mustache=require(_0x7b2e('0x4'));var util=require(_0x7b2e('0x5'));var path=require('path');var sox=require(_0x7b2e('0x6'));var csv=require(_0x7b2e('0x7'));var ejs=require(_0x7b2e('0x8'));var fs=require('fs');var _=require(_0x7b2e('0x9'));var squel=require('squel');var crypto=require(_0x7b2e('0xa'));var jsforce=require(_0x7b2e('0xb'));var deskjs=require(_0x7b2e('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7b2e('0xd'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x7b2e('0xe'))(_0x7b2e('0xf'));var utils=require(_0x7b2e('0x10'));var config=require(_0x7b2e('0x11'));var db=require(_0x7b2e('0x12'))['db'];function respondWithStatusCode(_0x197273,_0x1c760d){_0x1c760d=_0x1c760d||0xcc;return function(_0x34d8d3){if(_0x34d8d3){return _0x197273[_0x7b2e('0x13')](_0x1c760d);}return _0x197273['status'](_0x1c760d)[_0x7b2e('0x14')]();};}function respondWithResult(_0x3d475e,_0x2ef443){_0x2ef443=_0x2ef443||0xc8;return function(_0x23e9e){if(_0x23e9e){return _0x3d475e[_0x7b2e('0x15')](_0x2ef443)[_0x7b2e('0x16')](_0x23e9e);}};}function respondWithFilteredResult(_0xe79216,_0x53dd0b){return function(_0x3a5554){if(_0x3a5554){var _0x214e57=_0x3a5554[_0x7b2e('0x17')],_0x1c1286=_0x53dd0b[_0x7b2e('0x18')],_0x3ceef2=_0x53dd0b['offset']+_0x53dd0b['limit'],_0x3b1440;if(_0x3ceef2>=_0x214e57){_0x3ceef2=_0x214e57;_0x3b1440=0xc8;}else{_0x3b1440=0xce;}_0xe79216['status'](_0x3b1440);return _0xe79216[_0x7b2e('0x19')](_0x7b2e('0x1a'),_0x1c1286+'-'+_0x3ceef2+'/'+_0x214e57)[_0x7b2e('0x16')](_0x3a5554);}return null;};}function patchUpdates(_0x4791e5){return function(_0x9bcbf1){try{jsonpatch[_0x7b2e('0x1b')](_0x9bcbf1,_0x4791e5,!![]);}catch(_0x28f626){return BPromise[_0x7b2e('0x1c')](_0x28f626);}return _0x9bcbf1[_0x7b2e('0x1d')]();};}function saveUpdates(_0xe38f2e,_0x230346){return function(_0x46c2fd){if(_0x46c2fd){return _0x46c2fd[_0x7b2e('0x1e')](_0xe38f2e)['then'](function(_0x57abcb){return _0x57abcb;});}return null;};}function removeEntity(_0x118292,_0x1bf0b7){return function(_0x5d10dc){if(_0x5d10dc){return _0x5d10dc[_0x7b2e('0x1f')]()[_0x7b2e('0x20')](function(){_0x118292[_0x7b2e('0x15')](0xcc)[_0x7b2e('0x14')]();});}};}function handleEntityNotFound(_0x5bd96c,_0x22865c){return function(_0x440a24){if(!_0x440a24){_0x5bd96c[_0x7b2e('0x13')](0x194);}return _0x440a24;};}function handleError(_0x12caff,_0x146765){_0x146765=_0x146765||0x1f4;return function(_0x2497d7){logger[_0x7b2e('0x21')](_0x2497d7[_0x7b2e('0x22')]);if(_0x2497d7['name']){delete _0x2497d7[_0x7b2e('0x23')];}_0x12caff[_0x7b2e('0x15')](_0x146765)[_0x7b2e('0x24')](_0x2497d7);};}exports[_0x7b2e('0x25')]=function(_0xbeaab9,_0x54017e){var _0x562cf6={'raw':!![],'where':{'id':_0xbeaab9[_0x7b2e('0x26')]['id']}},_0x443809={};_0x443809[_0x7b2e('0x27')]=_['keys'](db[_0x7b2e('0x28')][_0x7b2e('0x29')]);_0x443809['query']=_[_0x7b2e('0x2a')](_0xbeaab9['query']);_0x443809['filters']=_['intersection'](_0x443809['model'],_0x443809['query']);_0x562cf6['attributes']=_[_0x7b2e('0x2b')](_0x443809['model'],qs[_0x7b2e('0x2c')](_0xbeaab9[_0x7b2e('0x2d')]['fields']));_0x562cf6['attributes']=_0x562cf6['attributes'][_0x7b2e('0x2e')]?_0x562cf6[_0x7b2e('0x2f')]:_0x443809[_0x7b2e('0x27')];if(_0xbeaab9['query'][_0x7b2e('0x30')]){_0x562cf6['include']=[{'all':!![]}];}_0x562cf6=_[_0x7b2e('0x31')]({},_0x562cf6,_0xbeaab9[_0x7b2e('0x32')]);return db[_0x7b2e('0x28')][_0x7b2e('0x33')](_0x562cf6)['then'](handleEntityNotFound(_0x54017e,null))['then'](respondWithResult(_0x54017e,null))[_0x7b2e('0x34')](handleError(_0x54017e,null));};exports[_0x7b2e('0x1e')]=function(_0x1f879a,_0x8a74d2){if(_0x1f879a[_0x7b2e('0x35')]['id']){delete _0x1f879a[_0x7b2e('0x35')]['id'];}return db[_0x7b2e('0x28')]['find']({'where':{'id':_0x1f879a[_0x7b2e('0x26')]['id']}})[_0x7b2e('0x20')](handleEntityNotFound(_0x8a74d2,null))['then'](saveUpdates(_0x1f879a[_0x7b2e('0x35')],null))[_0x7b2e('0x20')](respondWithResult(_0x8a74d2,null))[_0x7b2e('0x34')](handleError(_0x8a74d2,null));};exports[_0x7b2e('0x1f')]=function(_0x329e11,_0x8467d1){return db['MailApplication']['find']({'where':{'id':_0x329e11[_0x7b2e('0x26')]['id']}})[_0x7b2e('0x20')](handleEntityNotFound(_0x8467d1,null))[_0x7b2e('0x20')](removeEntity(_0x8467d1,null))[_0x7b2e('0x34')](handleError(_0x8467d1,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index d661062..8a25960 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 _0x582b=['../../config/logger','api','bluebird','request-promise','./mailApplication.attributes','exports','MailApplication'];(function(_0x24ae77,_0x1fcf25){var _0x8e7cd5=function(_0x302fe9){while(--_0x302fe9){_0x24ae77['push'](_0x24ae77['shift']());}};_0x8e7cd5(++_0x1fcf25);}(_0x582b,0x111));var _0xb582=function(_0x5d56df,_0x5830d0){_0x5d56df=_0x5d56df-0x0;var _0x1fed50=_0x582b[_0x5d56df];return _0x1fed50;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb582('0x0'))(_0xb582('0x1'));var moment=require('moment');var BPromise=require(_0xb582('0x2'));var rp=require(_0xb582('0x3'));var attributes=require(_0xb582('0x4'));module[_0xb582('0x5')]=function(_0x46e0cd,_0x3de842){return _0x46e0cd['define'](_0xb582('0x6'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c63=['util','../../config/logger','moment','bluebird','./mailApplication.attributes','exports','define','MailApplication','mail_applications','lodash'];(function(_0x194e34,_0x112814){var _0x11d944=function(_0x5804fb){while(--_0x5804fb){_0x194e34['push'](_0x194e34['shift']());}};_0x11d944(++_0x112814);}(_0x5c63,0x1ad));var _0x35c6=function(_0x43ce56,_0x50de72){_0x43ce56=_0x43ce56-0x0;var _0x464e9c=_0x5c63[_0x43ce56];return _0x464e9c;};'use strict';var _=require(_0x35c6('0x0'));var util=require(_0x35c6('0x1'));var logger=require(_0x35c6('0x2'))('api');var moment=require(_0x35c6('0x3'));var BPromise=require(_0x35c6('0x4'));var rp=require('request-promise');var attributes=require(_0x35c6('0x5'));module[_0x35c6('0x6')]=function(_0x2a5d72,_0x4b28cb){return _0x2a5d72[_0x35c6('0x7')](_0x35c6('0x8'),attributes,{'tableName':_0x35c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 139fde0..03c0f24 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 _0xf84f=['debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','body','options','raw','attributes','limit','lodash','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x2e5b6c,_0x959421){var _0x18c6b8=function(_0x31b6e6){while(--_0x31b6e6){_0x2e5b6c['push'](_0x2e5b6c['shift']());}};_0x18c6b8(++_0x959421);}(_0xf84f,0x160));var _0xff84=function(_0x2cf67d,_0xcd8677){_0x2cf67d=_0x2cf67d-0x0;var _0x5132ae=_0xf84f[_0x2cf67d];return _0x5132ae;};'use strict';var _=require(_0xff84('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xff84('0x1'))(_0xff84('0x2'));var config=require(_0xff84('0x3'));var jayson=require(_0xff84('0x4'));var client=jayson[_0xff84('0x5')][_0xff84('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x23907b,_0xde5791,_0x721fc5){return new BPromise(function(_0x1c1bf6,_0x2f4ee7){return client[_0xff84('0x7')](_0x23907b,_0x721fc5)[_0xff84('0x8')](function(_0x444c44){logger[_0xff84('0x9')](_0xff84('0xa'),_0xde5791,_0xff84('0xb'));logger[_0xff84('0xc')](_0xff84('0xd'),_0xde5791,'request\x20sent',JSON[_0xff84('0xe')](_0x444c44));if(_0x444c44[_0xff84('0xf')]){if(_0x444c44['error'][_0xff84('0x10')]===0x1f4){logger['error'](_0xff84('0xa'),_0xde5791,_0x444c44[_0xff84('0xf')][_0xff84('0x11')]);return _0x2f4ee7(_0x444c44['error']['message']);}logger['error'](_0xff84('0xa'),_0xde5791,_0x444c44[_0xff84('0xf')]['message']);return _0x1c1bf6(_0x444c44[_0xff84('0xf')][_0xff84('0x11')]);}else{logger['info'](_0xff84('0xa'),_0xde5791,_0xff84('0xb'));_0x1c1bf6(_0x444c44[_0xff84('0x12')][_0xff84('0x11')]);}})['catch'](function(_0x1024bf){logger[_0xff84('0xf')]('MailApplication,\x20%s,\x20%s',_0xde5791,_0x1024bf);_0x2f4ee7(_0x1024bf);});});}exports[_0xff84('0x13')]=function(_0x13639d){var _0x3aeded=this;return new Promise(function(_0xfe1a5e,_0x61267c){return db[_0xff84('0x14')]['update'](_0x13639d[_0xff84('0x15')],{'raw':_0x13639d[_0xff84('0x16')]?_0x13639d[_0xff84('0x16')][_0xff84('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13639d[_0xff84('0x16')]?_0x13639d[_0xff84('0x16')]['where']||null:null,'attributes':_0x13639d[_0xff84('0x16')]?_0x13639d[_0xff84('0x16')][_0xff84('0x18')]||null:null,'limit':_0x13639d[_0xff84('0x16')]?_0x13639d[_0xff84('0x16')][_0xff84('0x19')]||null:null})[_0xff84('0x8')](function(_0x33cec3){logger[_0xff84('0x9')](_0xff84('0x13'),_0x13639d);logger[_0xff84('0xc')](_0xff84('0x13'),_0x13639d,JSON['stringify'](_0x33cec3));_0xfe1a5e(_0x33cec3);})['catch'](function(_0x4fb8b6){logger[_0xff84('0xf')]('UpdateMailApplication',_0x4fb8b6[_0xff84('0x11')],_0x13639d);_0x61267c(_0x3aeded[_0xff84('0xf')](0x1f4,_0x4fb8b6[_0xff84('0x11')]));});});}; \ No newline at end of file +var _0x81e4=['then','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','MailApplication,\x20%s,\x20%s','result','MailApplication','update','body','options','raw','where','attributes','limit','UpdateMailApplication','debug','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x81e4,0x75));var _0x481e=function(_0x1e6e39,_0x3c98ed){_0x1e6e39=_0x1e6e39-0x0;var _0x2d9029=_0x81e4[_0x1e6e39];return _0x2d9029;};'use strict';var _=require(_0x481e('0x0'));var util=require(_0x481e('0x1'));var moment=require(_0x481e('0x2'));var BPromise=require(_0x481e('0x3'));var rs=require(_0x481e('0x4'));var fs=require('fs');var db=require(_0x481e('0x5'))['db'];var utils=require(_0x481e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x481e('0x7'));var jayson=require(_0x481e('0x8'));var client=jayson[_0x481e('0x9')][_0x481e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1846e5,_0x2fe2d5,_0x5911d7){return new BPromise(function(_0x95de8,_0x40a85a){return client['request'](_0x1846e5,_0x5911d7)[_0x481e('0xb')](function(_0x53c1f4){logger['info']('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x481e('0xc'));logger['debug'](_0x481e('0xd'),_0x2fe2d5,_0x481e('0xc'),JSON[_0x481e('0xe')](_0x53c1f4));if(_0x53c1f4['error']){if(_0x53c1f4[_0x481e('0xf')][_0x481e('0x10')]===0x1f4){logger[_0x481e('0xf')]('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x53c1f4[_0x481e('0xf')][_0x481e('0x11')]);return _0x40a85a(_0x53c1f4[_0x481e('0xf')][_0x481e('0x11')]);}logger['error']('MailApplication,\x20%s,\x20%s',_0x2fe2d5,_0x53c1f4['error'][_0x481e('0x11')]);return _0x95de8(_0x53c1f4['error']['message']);}else{logger[_0x481e('0x12')](_0x481e('0x13'),_0x2fe2d5,_0x481e('0xc'));_0x95de8(_0x53c1f4[_0x481e('0x14')][_0x481e('0x11')]);}})['catch'](function(_0x486c8b){logger[_0x481e('0xf')](_0x481e('0x13'),_0x2fe2d5,_0x486c8b);_0x40a85a(_0x486c8b);});});}exports['UpdateMailApplication']=function(_0x2f6816){var _0x5299bd=this;return new Promise(function(_0x5cb2ca,_0x9aab49){return db[_0x481e('0x15')][_0x481e('0x16')](_0x2f6816[_0x481e('0x17')],{'raw':_0x2f6816['options']?_0x2f6816[_0x481e('0x18')][_0x481e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f6816[_0x481e('0x18')]?_0x2f6816['options'][_0x481e('0x1a')]||null:null,'attributes':_0x2f6816['options']?_0x2f6816[_0x481e('0x18')][_0x481e('0x1b')]||null:null,'limit':_0x2f6816['options']?_0x2f6816['options'][_0x481e('0x1c')]||null:null})[_0x481e('0xb')](function(_0x3202fb){logger[_0x481e('0x12')](_0x481e('0x1d'),_0x2f6816);logger[_0x481e('0x1e')](_0x481e('0x1d'),_0x2f6816,JSON[_0x481e('0xe')](_0x3202fb));_0x5cb2ca(_0x3202fb);})[_0x481e('0x1f')](function(_0x373f38){logger[_0x481e('0xf')](_0x481e('0x1d'),_0x373f38['message'],_0x2f6816);_0x9aab49(_0x5299bd[_0x481e('0xf')](0x1f4,_0x373f38[_0x481e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 024127a..6514df3 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 _0xc097=['mail','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','/:id/tags','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','create','post','addMessage','tracked','mailinteraction:addtags','addTags','put'];(function(_0x215b7f,_0x50001e){var _0x609f86=function(_0xd625c4){while(--_0xd625c4){_0x215b7f['push'](_0x215b7f['shift']());}};_0x609f86(++_0x50001e);}(_0xc097,0x7b));var _0x7c09=function(_0x5a0249,_0x22688e){_0x5a0249=_0x5a0249-0x0;var _0x15632f=_0xc097[_0x5a0249];return _0x15632f;};'use strict';var multer=require(_0x7c09('0x0'));var util=require('util');var path=require(_0x7c09('0x1'));var express=require('express');var router=express[_0x7c09('0x2')]();var auth=require(_0x7c09('0x3'));var interaction=require(_0x7c09('0x4'));var config=require(_0x7c09('0x5'));var controller=require('./mailInteraction.controller');router[_0x7c09('0x6')]('/',auth[_0x7c09('0x7')](),controller[_0x7c09('0x8')]);router['get'](_0x7c09('0x9'),auth[_0x7c09('0x7')](),controller[_0x7c09('0xa')]);router[_0x7c09('0x6')](_0x7c09('0xb'),auth[_0x7c09('0x7')](),controller[_0x7c09('0xc')]);router[_0x7c09('0x6')](_0x7c09('0xd'),auth[_0x7c09('0x7')](),controller[_0x7c09('0xe')]);router['post']('/',auth[_0x7c09('0x7')](),controller[_0x7c09('0xf')]);router[_0x7c09('0x10')](_0x7c09('0xd'),auth['isAuthenticated'](),controller[_0x7c09('0x11')]);router[_0x7c09('0x10')]('/:id/tags',auth[_0x7c09('0x7')](),interaction[_0x7c09('0x12')]('mail',_0x7c09('0x13')),controller[_0x7c09('0x14')]);router[_0x7c09('0x15')](_0x7c09('0xb'),auth[_0x7c09('0x7')](),interaction['tracked'](_0x7c09('0x16'),_0x7c09('0x17')),controller[_0x7c09('0x18')]);router['delete'](_0x7c09('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x7c09('0x16'),_0x7c09('0x19')),controller[_0x7c09('0x1a')]);router[_0x7c09('0x1b')](_0x7c09('0x1c'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0x6628=['delete','mailinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','addMessage','/:id/tags','mailinteraction:addtags','addTags','put','tracked','mail','mailinteraction:update','update'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0x6628,0x11c));var _0x8662=function(_0x4c7c7a,_0x38e50){_0x4c7c7a=_0x4c7c7a-0x0;var _0x7b803f=_0x6628[_0x4c7c7a];return _0x7b803f;};'use strict';var multer=require(_0x8662('0x0'));var util=require(_0x8662('0x1'));var path=require(_0x8662('0x2'));var express=require(_0x8662('0x3'));var router=express[_0x8662('0x4')]();var auth=require(_0x8662('0x5'));var interaction=require(_0x8662('0x6'));var config=require(_0x8662('0x7'));var controller=require('./mailInteraction.controller');router[_0x8662('0x8')]('/',auth[_0x8662('0x9')](),controller[_0x8662('0xa')]);router[_0x8662('0x8')](_0x8662('0xb'),auth[_0x8662('0x9')](),controller[_0x8662('0xc')]);router[_0x8662('0x8')](_0x8662('0xd'),auth['isAuthenticated'](),controller[_0x8662('0xe')]);router[_0x8662('0x8')](_0x8662('0xf'),auth['isAuthenticated'](),controller[_0x8662('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8662('0xf'),auth[_0x8662('0x9')](),controller[_0x8662('0x11')]);router['post'](_0x8662('0x12'),auth[_0x8662('0x9')](),interaction['tracked']('mail',_0x8662('0x13')),controller[_0x8662('0x14')]);router[_0x8662('0x15')](_0x8662('0xd'),auth[_0x8662('0x9')](),interaction[_0x8662('0x16')](_0x8662('0x17'),_0x8662('0x18')),controller[_0x8662('0x19')]);router[_0x8662('0x1a')](_0x8662('0xd'),auth['isAuthenticated'](),interaction[_0x8662('0x16')]('mail',_0x8662('0x1b')),controller[_0x8662('0x1c')]);router[_0x8662('0x1a')](_0x8662('0x12'),auth['isAuthenticated'](),controller[_0x8662('0x1d')]);module[_0x8662('0x1e')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 6aa6edf..a01dee1 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 _0x674d=['\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','ENUM','out','lastMsgBody','getDataValue','split','slice','join','sequelize','html-to-text','iconv','exports','DATE','STRING','TEXT','long'];(function(_0x10f886,_0x22c46e){var _0x1b4576=function(_0x1c42aa){while(--_0x1c42aa){_0x10f886['push'](_0x10f886['shift']());}};_0x1b4576(++_0x22c46e);}(_0x674d,0xa8));var _0xd674=function(_0x14e8d3,_0x67e3a){_0x14e8d3=_0x14e8d3-0x0;var _0x1f565b=_0x674d[_0x14e8d3];return _0x1f565b;};'use strict';var Sequelize=require(_0xd674('0x0'));var htmlToText=require(_0xd674('0x1'));var iconv=require(_0xd674('0x2'));module[_0xd674('0x3')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd674('0x4')]},'disposition':{'type':Sequelize[_0xd674('0x5')]},'note':{'type':Sequelize[_0xd674('0x5')]},'inReplyTo':{'type':Sequelize[_0xd674('0x5')](0xbe)},'to':{'type':Sequelize[_0xd674('0x5')]},'cc':{'type':Sequelize[_0xd674('0x6')](_0xd674('0x7'))},'subject':{'type':Sequelize[_0xd674('0x6')]('')+_0xd674('0x8')},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd674('0x4')]},'substatus':{'type':Sequelize[_0xd674('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xd674('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xd674('0x9')]('in',_0xd674('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd674('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xd674('0xa')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize['TEXT'](_0xd674('0x7'))+'\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','get':function(){try{return this['getDataValue'](_0xd674('0xb'))?htmlToText['fromString'](this[_0xd674('0xc')](_0xd674('0xb')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0xd674('0xd')]('\x0a')[_0xd674('0xe')](0x0,0x6)[_0xd674('0xf')]('\x0a'):null;}catch(_0x5eb1c0){return null;}}}}; \ No newline at end of file +var _0x2d56=['html-to-text','iconv','BOOLEAN','STRING','\x20CHARSET\x20utf8mb4\x20COLLATE\x20utf8mb4_unicode_ci','DATE','ENUM','out','TEXT','getDataValue','lastMsgBody','fromString','split'];(function(_0xa2f2c0,_0x1bd315){var _0x3f2623=function(_0x38ff37){while(--_0x38ff37){_0xa2f2c0['push'](_0xa2f2c0['shift']());}};_0x3f2623(++_0x1bd315);}(_0x2d56,0x193));var _0x62d5=function(_0x5c8c85,_0x24f818){_0x5c8c85=_0x5c8c85-0x0;var _0x3d9d95=_0x2d56[_0x5c8c85];return _0x3d9d95;};'use strict';var Sequelize=require('sequelize');var htmlToText=require(_0x62d5('0x0'));var iconv=require(_0x62d5('0x1'));module['exports']={'closed':{'type':Sequelize[_0x62d5('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x62d5('0x3')]},'inReplyTo':{'type':Sequelize[_0x62d5('0x3')](0xbe)},'to':{'type':Sequelize[_0x62d5('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize['TEXT']('')+_0x62d5('0x4')},'attach':{'type':Sequelize[_0x62d5('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x62d5('0x5')]},'substatus':{'type':Sequelize[_0x62d5('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x62d5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x62d5('0x6')]('in',_0x62d5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x62d5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x62d5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x62d5('0x8')]('long')+_0x62d5('0x4'),'get':function(){try{return this[_0x62d5('0x9')](_0x62d5('0xa'))?htmlToText[_0x62d5('0xb')](this[_0x62d5('0x9')](_0x62d5('0xa')),{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'ignoreImage':!![]})[_0x62d5('0xc')]('\x0a')['slice'](0x0,0x6)['join']('\x0a'):null;}catch(_0x3c550b){return null;}}}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a57f399..9ef9759 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 _0xec44=['offset','sort','where','pick','add','day','merge','filter','map','options','include','tag','push','Tag','Tags','distinct','read','Messages','createdAt','includeAll','User','Users','Owner','fullname','MailAccount','Account','email','MailMessage','direction','color','findAll','rows','keys','rawAttributes','find','catch','create','body','update','params','describe','addMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','mailInteractionTags:save','removeTags','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','./mailInteraction.socket','sendStatus','status','end','json','count','limit','set','apply','save','then','destroy','name','send','index','MailInteraction','model','query','dateEnd','dateStart','filters','intersection','attributes','fields','nolimit'];(function(_0x34e111,_0x3c2abd){var _0x4dcc22=function(_0x5d9293){while(--_0x5d9293){_0x34e111['push'](_0x34e111['shift']());}};_0x4dcc22(++_0x3c2abd);}(_0xec44,0x161));var _0x4ec4=function(_0x35007a,_0x58a0d4){_0x35007a=_0x35007a-0x0;var _0x574f68=_0xec44[_0x35007a];return _0x574f68;};'use strict';var jsonpatch=require(_0x4ec4('0x0'));var rp=require(_0x4ec4('0x1'));var moment=require(_0x4ec4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4ec4('0x3'));var util=require(_0x4ec4('0x4'));var path=require('path');var sox=require(_0x4ec4('0x5'));var csv=require(_0x4ec4('0x6'));var ejs=require(_0x4ec4('0x7'));var fs=require('fs');var _=require(_0x4ec4('0x8'));var squel=require(_0x4ec4('0x9'));var crypto=require(_0x4ec4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4ec4('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4ec4('0xc'));var Papa=require(_0x4ec4('0xd'));var qs=require(_0x4ec4('0xe'));var logger=require('../../config/logger')(_0x4ec4('0xf'));var utils=require('../../config/utils');var config=require(_0x4ec4('0x10'));var db=require(_0x4ec4('0x11'))['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x4ec4('0x12'))['register'](socket);function respondWithStatusCode(_0x2d5da0,_0x38a6cb){_0x38a6cb=_0x38a6cb||0xcc;return function(_0x2a557c){if(_0x2a557c){return _0x2d5da0[_0x4ec4('0x13')](_0x38a6cb);}return _0x2d5da0[_0x4ec4('0x14')](_0x38a6cb)[_0x4ec4('0x15')]();};}function respondWithResult(_0x3db712,_0x2d458a){_0x2d458a=_0x2d458a||0xc8;return function(_0x1aceb8){if(_0x1aceb8){return _0x3db712[_0x4ec4('0x14')](_0x2d458a)[_0x4ec4('0x16')](_0x1aceb8);}};}function respondWithFilteredResult(_0x4e1da4,_0x2e5be6){return function(_0x483f04){if(_0x483f04){var _0x505c2a=_0x483f04[_0x4ec4('0x17')],_0x43b89d=_0x2e5be6['offset'],_0x3dc9e7=_0x2e5be6['offset']+_0x2e5be6[_0x4ec4('0x18')],_0x3a981b;if(_0x3dc9e7>=_0x505c2a){_0x3dc9e7=_0x505c2a;_0x3a981b=0xc8;}else{_0x3a981b=0xce;}_0x4e1da4[_0x4ec4('0x14')](_0x3a981b);return _0x4e1da4[_0x4ec4('0x19')]('Content-Range',_0x43b89d+'-'+_0x3dc9e7+'/'+_0x505c2a)[_0x4ec4('0x16')](_0x483f04);}return null;};}function patchUpdates(_0x297bf6){return function(_0x3bc13d){try{jsonpatch[_0x4ec4('0x1a')](_0x3bc13d,_0x297bf6,!![]);}catch(_0x1bde79){return BPromise['reject'](_0x1bde79);}return _0x3bc13d[_0x4ec4('0x1b')]();};}function saveUpdates(_0x3c88de,_0x39be40){return function(_0x452364){if(_0x452364){return _0x452364['update'](_0x3c88de)[_0x4ec4('0x1c')](function(_0x43492b){return _0x43492b;});}return null;};}function removeEntity(_0xeae048,_0x34def2){return function(_0x515e86){if(_0x515e86){return _0x515e86[_0x4ec4('0x1d')]()[_0x4ec4('0x1c')](function(){_0xeae048[_0x4ec4('0x14')](0xcc)[_0x4ec4('0x15')]();});}};}function handleEntityNotFound(_0x5d20ec,_0x3a1644){return function(_0x39c953){if(!_0x39c953){_0x5d20ec[_0x4ec4('0x13')](0x194);}return _0x39c953;};}function handleError(_0x1b21c6,_0x448c61){_0x448c61=_0x448c61||0x1f4;return function(_0x331732){logger['error'](_0x331732['stack']);if(_0x331732[_0x4ec4('0x1e')]){delete _0x331732[_0x4ec4('0x1e')];}_0x1b21c6[_0x4ec4('0x14')](_0x448c61)[_0x4ec4('0x1f')](_0x331732);};}exports[_0x4ec4('0x20')]=function(_0x10a5ba,_0x4e16c6){var _0x481199={},_0x2db11e={},_0x44ee11={'count':0x0,'rows':[]};var _0x3e6fbb=db[_0x4ec4('0x21')]['rawAttributes'];_0x2db11e[_0x4ec4('0x22')]=_['keys'](_0x3e6fbb);var _0x532512={'dateStart':_0x10a5ba[_0x4ec4('0x23')]['dateStart'],'dateEnd':_0x10a5ba['query'][_0x4ec4('0x24')]};delete _0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x25')];delete _0x10a5ba['query'][_0x4ec4('0x24')];_0x2db11e[_0x4ec4('0x23')]=_['keys'](_0x10a5ba[_0x4ec4('0x23')]);_0x2db11e[_0x4ec4('0x26')]=_[_0x4ec4('0x27')](_0x2db11e[_0x4ec4('0x22')],_0x2db11e['query']);_0x481199[_0x4ec4('0x28')]=_['intersection'](_0x2db11e['model'],qs[_0x4ec4('0x29')](_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x29')]));_0x481199['attributes']=_0x481199['attributes']['length']?_0x481199[_0x4ec4('0x28')]:_0x2db11e[_0x4ec4('0x22')];if(!_0x10a5ba['query']['hasOwnProperty'](_0x4ec4('0x2a'))){_0x481199[_0x4ec4('0x18')]=qs['limit'](_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x18')]);_0x481199[_0x4ec4('0x2b')]=qs[_0x4ec4('0x2b')](_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x2b')]);}_0x481199['order']=qs[_0x4ec4('0x2c')](_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x2c')]);_0x481199[_0x4ec4('0x2d')]=qs['filters'](_[_0x4ec4('0x2e')](_0x10a5ba[_0x4ec4('0x23')],_0x2db11e['filters']));if(_0x532512['dateStart']){if(_0x532512[_0x4ec4('0x24')]){_0x532512['dateEnd']=moment(_0x532512[_0x4ec4('0x24')])[_0x4ec4('0x2f')](0x1,_0x4ec4('0x30'));}else{_0x532512['dateEnd']=moment(_0x532512[_0x4ec4('0x25')])[_0x4ec4('0x2f')](0x1,_0x4ec4('0x30'));}_[_0x4ec4('0x31')](_0x481199[_0x4ec4('0x2d')],{'createdAt':{'$gte':_0x532512[_0x4ec4('0x25')],'$lte':_0x532512[_0x4ec4('0x24')]}});}if(_0x10a5ba['query'][_0x4ec4('0x32')]){_0x481199[_0x4ec4('0x2d')]=_[_0x4ec4('0x31')](_0x481199[_0x4ec4('0x2d')],{'$or':_[_0x4ec4('0x33')](_0x481199[_0x4ec4('0x28')],function(_0x367051){var _0x225309={};_0x225309[_0x367051]={'$like':'%'+_0x10a5ba['query'][_0x4ec4('0x32')]+'%'};return _0x225309;})});}_0x481199=_['merge']({},_0x481199,_0x10a5ba[_0x4ec4('0x34')]);var _0x42713b={'where':_0x481199[_0x4ec4('0x2d')]};_0x42713b[_0x4ec4('0x35')]=[];if(_0x10a5ba['query'][_0x4ec4('0x36')]){_0x42713b[_0x4ec4('0x35')][_0x4ec4('0x37')]({'model':db[_0x4ec4('0x38')],'as':_0x4ec4('0x39'),'attributes':['id'],'where':{'id':_0x10a5ba['query'][_0x4ec4('0x36')]},'required':!![]});_0x42713b[_0x4ec4('0x3a')]=!![];}if(_0x10a5ba['query'][_0x4ec4('0x3b')]){_0x42713b['include'][_0x4ec4('0x37')]({'model':db['MailMessage'],'as':_0x4ec4('0x3c'),'attributes':['id','direction',_0x4ec4('0x3d'),_0x4ec4('0x3b')],'where':{'direction':'in','read':_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x3b')]||![]},'required':!![]});_0x42713b[_0x4ec4('0x3a')]=!![];}return db['MailInteraction']['count'](_0x42713b)[_0x4ec4('0x1c')](function(_0x16a435){_0x44ee11['count']=_0x16a435;if(_0x10a5ba['query'][_0x4ec4('0x3e')]){_0x481199[_0x4ec4('0x35')]=[{'model':db[_0x4ec4('0x3f')],'as':_0x4ec4('0x40'),'required':![],'attributes':['id',_0x4ec4('0x1e'),'fullname']},{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x4ec4('0x3f')],'as':_0x4ec4('0x41'),'attributes':[_0x4ec4('0x1e'),_0x4ec4('0x42'),'internal'],'required':![]},{'model':db[_0x4ec4('0x43')],'as':_0x4ec4('0x44'),'attributes':['name','key',_0x4ec4('0x45')],'required':![]},{'model':db[_0x4ec4('0x46')],'as':_0x4ec4('0x3c'),'attributes':['id',_0x4ec4('0x47'),'createdAt','read'],'where':{'direction':'in','read':_0x10a5ba[_0x4ec4('0x23')]['read']||![]},'required':_0x10a5ba['query'][_0x4ec4('0x3b')]||![]},{'model':db[_0x4ec4('0x38')],'as':_0x4ec4('0x39'),'attributes':['id',_0x4ec4('0x1e'),'color'],'required':_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x36')]?!![]:![]},{'model':db[_0x4ec4('0x38')],'as':'ThroughTags','attributes':['id','name',_0x4ec4('0x48')],'through':_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x36')]?{'attributes':[],'where':{'TagId':_0x10a5ba[_0x4ec4('0x23')]['tag']||undefined}}:{},'required':_0x10a5ba[_0x4ec4('0x23')][_0x4ec4('0x36')]?!![]:![]}];}return db['MailInteraction'][_0x4ec4('0x49')](_0x481199);})[_0x4ec4('0x1c')](function(_0x40fd10){_0x44ee11[_0x4ec4('0x4a')]=_0x40fd10;return _0x44ee11;})[_0x4ec4('0x1c')](respondWithFilteredResult(_0x4e16c6,_0x481199))['catch'](handleError(_0x4e16c6,null));};exports['show']=function(_0x48f693,_0xae26b6){var _0x27866e={'raw':![],'where':{'id':_0x48f693['params']['id']}},_0x1cb3cf={};_0x1cb3cf[_0x4ec4('0x22')]=_[_0x4ec4('0x4b')](db[_0x4ec4('0x21')][_0x4ec4('0x4c')]);_0x1cb3cf['query']=_[_0x4ec4('0x4b')](_0x48f693[_0x4ec4('0x23')]);_0x1cb3cf['filters']=_[_0x4ec4('0x27')](_0x1cb3cf[_0x4ec4('0x22')],_0x1cb3cf[_0x4ec4('0x23')]);_0x27866e[_0x4ec4('0x28')]=_[_0x4ec4('0x27')](_0x1cb3cf['model'],qs[_0x4ec4('0x29')](_0x48f693[_0x4ec4('0x23')][_0x4ec4('0x29')]));_0x27866e[_0x4ec4('0x28')]=_0x27866e['attributes']['length']?_0x27866e[_0x4ec4('0x28')]:_0x1cb3cf[_0x4ec4('0x22')];if(_0x48f693[_0x4ec4('0x23')][_0x4ec4('0x3e')]){_0x27866e[_0x4ec4('0x35')]=[{'all':!![]}];}_0x27866e=_['merge']({},_0x27866e,_0x48f693[_0x4ec4('0x34')]);return db[_0x4ec4('0x21')][_0x4ec4('0x4d')](_0x27866e)[_0x4ec4('0x1c')](handleEntityNotFound(_0xae26b6,null))[_0x4ec4('0x1c')](respondWithResult(_0xae26b6,null))[_0x4ec4('0x4e')](handleError(_0xae26b6,null));};exports[_0x4ec4('0x4f')]=function(_0x36169b,_0x199271){return db[_0x4ec4('0x21')][_0x4ec4('0x4f')](_0x36169b[_0x4ec4('0x50')],{})[_0x4ec4('0x1c')](respondWithResult(_0x199271,0xc9))['catch'](handleError(_0x199271,null));};exports[_0x4ec4('0x51')]=function(_0x165d2a,_0x419090){if(_0x165d2a['body']['id']){delete _0x165d2a[_0x4ec4('0x50')]['id'];}return db[_0x4ec4('0x21')][_0x4ec4('0x4d')]({'where':{'id':_0x165d2a[_0x4ec4('0x52')]['id']}})[_0x4ec4('0x1c')](handleEntityNotFound(_0x419090,null))[_0x4ec4('0x1c')](saveUpdates(_0x165d2a['body'],null))[_0x4ec4('0x1c')](respondWithResult(_0x419090,null))[_0x4ec4('0x4e')](handleError(_0x419090,null));};exports[_0x4ec4('0x1d')]=function(_0x5a6778,_0x301a43){return db['MailInteraction']['find']({'where':{'id':_0x5a6778[_0x4ec4('0x52')]['id']}})[_0x4ec4('0x1c')](handleEntityNotFound(_0x301a43,null))[_0x4ec4('0x1c')](removeEntity(_0x301a43,null))[_0x4ec4('0x4e')](handleError(_0x301a43,null));};exports[_0x4ec4('0x53')]=function(_0x507600,_0x2d3f00){return db[_0x4ec4('0x21')]['describe']()[_0x4ec4('0x1c')](respondWithResult(_0x2d3f00,null))['catch'](handleError(_0x2d3f00,null));};exports[_0x4ec4('0x54')]=function(_0x4947b9,_0x289350,_0x1c26ab){return db[_0x4ec4('0x46')][_0x4ec4('0x4d')]({'where':{'id':_0x4947b9[_0x4ec4('0x52')]['id']}})['then'](handleEntityNotFound(_0x289350,null))[_0x4ec4('0x1c')](function(_0x2cccfc){if(_0x2cccfc){return _0x2cccfc[_0x4ec4('0x54')](_0x4947b9['body']['ids'],_[_0x4ec4('0x55')](_0x4947b9['body'],[_0x4ec4('0x56'),'id'])||{});}})[_0x4ec4('0x1c')](respondWithResult(_0x289350,null))['catch'](handleError(_0x289350,null));};exports[_0x4ec4('0x57')]=function(_0x148cdf,_0x593834,_0x345355){var _0x4dadf5={'raw':![],'where':{}};var _0x10a82c={};var _0x7b1685={'count':0x0,'rows':[]};return db[_0x4ec4('0x21')][_0x4ec4('0x58')]({'where':{'id':_0x148cdf[_0x4ec4('0x52')]['id']}})[_0x4ec4('0x1c')](handleEntityNotFound(_0x593834,null))[_0x4ec4('0x1c')](function(_0x3b3b73){if(_0x3b3b73){_0x10a82c[_0x4ec4('0x22')]=_['keys'](db['MailMessage'][_0x4ec4('0x4c')]);_0x10a82c[_0x4ec4('0x23')]=_['keys'](_0x148cdf[_0x4ec4('0x23')]);_0x10a82c[_0x4ec4('0x26')]=_['intersection'](_0x10a82c[_0x4ec4('0x22')],_0x10a82c[_0x4ec4('0x23')]);_0x4dadf5[_0x4ec4('0x28')]=_[_0x4ec4('0x27')](_0x10a82c[_0x4ec4('0x22')],qs[_0x4ec4('0x29')](_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x29')]));_0x4dadf5[_0x4ec4('0x28')]=_0x4dadf5['attributes'][_0x4ec4('0x59')]?_0x4dadf5[_0x4ec4('0x28')]:_0x10a82c['model'];if(!_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x5a')](_0x4ec4('0x2a'))){_0x4dadf5[_0x4ec4('0x18')]=qs['limit'](_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x18')]);_0x4dadf5[_0x4ec4('0x2b')]=qs['offset'](_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x2b')]);}_0x4dadf5['order']=qs['sort'](_0x148cdf[_0x4ec4('0x23')]['sort']);_0x4dadf5[_0x4ec4('0x2d')]=qs['filters'](_['pick'](_0x148cdf[_0x4ec4('0x23')],_0x10a82c[_0x4ec4('0x26')]));_0x4dadf5[_0x4ec4('0x2d')][_0x4ec4('0x5b')]=_0x3b3b73['id'];if(_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x32')]){_0x4dadf5[_0x4ec4('0x2d')]=_['merge'](_0x4dadf5[_0x4ec4('0x2d')],{'$or':_[_0x4ec4('0x33')](_0x4dadf5[_0x4ec4('0x28')],function(_0x3b939e){var _0x4fbed6={};_0x4fbed6[_0x3b939e]={'$like':'%'+_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x32')]+'%'};return _0x4fbed6;})});}if(_0x148cdf[_0x4ec4('0x23')]['$gte']){var _0x13e0e5=_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x5c')][_0x4ec4('0x5d')](',');var _0x1a4e7d={};_0x1a4e7d[_0x13e0e5[0x0]]={'$gte':moment(_0x13e0e5[0x1])[_0x4ec4('0x5e')](_0x4ec4('0x5f'))};_0x4dadf5[_0x4ec4('0x2d')]=_[_0x4ec4('0x31')](_0x4dadf5['where'],_0x1a4e7d);}_0x4dadf5=_[_0x4ec4('0x31')]({},_0x4dadf5,_0x148cdf[_0x4ec4('0x34')]);return db[_0x4ec4('0x46')]['count']({'where':_0x4dadf5[_0x4ec4('0x2d')]})[_0x4ec4('0x1c')](function(_0x5e2c85){_0x7b1685[_0x4ec4('0x17')]=_0x5e2c85;if(_0x148cdf[_0x4ec4('0x23')][_0x4ec4('0x3e')]){_0x4dadf5[_0x4ec4('0x35')]=[{'all':!![]}];}return db[_0x4ec4('0x46')][_0x4ec4('0x49')](_0x4dadf5);})[_0x4ec4('0x1c')](function(_0x5a31dd){_0x7b1685[_0x4ec4('0x4a')]=_0x5a31dd;return _0x7b1685;});}})[_0x4ec4('0x1c')](respondWithFilteredResult(_0x593834,_0x4dadf5))[_0x4ec4('0x4e')](handleError(_0x593834,null));};exports['addTags']=function(_0x574b9e,_0x34844e,_0x431f29){return db[_0x4ec4('0x21')][_0x4ec4('0x4d')]({'where':{'id':_0x574b9e[_0x4ec4('0x52')]['id']}})[_0x4ec4('0x1c')](handleEntityNotFound(_0x34844e,null))[_0x4ec4('0x1c')](function(_0x392d77){if(_0x392d77){return _0x392d77[_0x4ec4('0x60')](_0x574b9e[_0x4ec4('0x50')]['ids'],_[_0x4ec4('0x55')](_0x574b9e[_0x4ec4('0x50')],[_0x4ec4('0x56'),'id'])||{})['spread'](function(){return db[_0x4ec4('0x38')][_0x4ec4('0x49')]({'attributes':['id',_0x4ec4('0x1e'),_0x4ec4('0x48')],'where':{'id':_0x574b9e['body'][_0x4ec4('0x56')]}});})[_0x4ec4('0x1c')](function(_0x5a6e6b){socket['emit'](_0x4ec4('0x61'),{'id':Number(_0x574b9e[_0x4ec4('0x52')]['id']),'tags':_0x5a6e6b||[]});return{'id':Number(_0x574b9e['params']['id']),'tags':_0x5a6e6b||[]};});}})[_0x4ec4('0x1c')](respondWithResult(_0x34844e,null))[_0x4ec4('0x4e')](handleError(_0x34844e,null));};exports[_0x4ec4('0x62')]=function(_0x212a3f,_0x43a09a,_0x3d049c){var _0x2ba5ee;return db[_0x4ec4('0x21')][_0x4ec4('0x4d')]({'where':{'id':_0x212a3f['params']['id']}})[_0x4ec4('0x1c')](handleEntityNotFound(_0x43a09a,null))[_0x4ec4('0x1c')](function(_0xd5f8d7){if(_0xd5f8d7){return _0xd5f8d7[_0x4ec4('0x62')](_0x212a3f['query'][_0x4ec4('0x56')]);}})[_0x4ec4('0x1c')](respondWithStatusCode(_0x43a09a,null))[_0x4ec4('0x4e')](handleError(_0x43a09a,null));}; \ No newline at end of file +var _0x0cfd=['order','sort','where','pick','add','day','merge','filter','map','options','include','tag','Tag','Tags','read','push','MailMessage','Messages','distinct','MailInteraction','includeAll','User','Users','CmContact','Contact','Owner','fullname','internal','MailAccount','Account','key','email','direction','createdAt','ThroughTags','color','findAll','catch','params','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','MailInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','removeTags','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailInteraction.socket','sendStatus','end','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','then','name','send','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x1b129f,_0x6d1483){var _0x117f95=function(_0x445ad7){while(--_0x445ad7){_0x1b129f['push'](_0x1b129f['shift']());}};_0x117f95(++_0x6d1483);}(_0x0cfd,0x17c));var _0xd0cf=function(_0x4502f1,_0x5720d6){_0x4502f1=_0x4502f1-0x0;var _0x4544dc=_0x0cfd[_0x4502f1];return _0x4544dc;};'use strict';var jsonpatch=require(_0xd0cf('0x0'));var rp=require(_0xd0cf('0x1'));var moment=require(_0xd0cf('0x2'));var BPromise=require(_0xd0cf('0x3'));var Mustache=require(_0xd0cf('0x4'));var util=require(_0xd0cf('0x5'));var path=require(_0xd0cf('0x6'));var sox=require(_0xd0cf('0x7'));var csv=require(_0xd0cf('0x8'));var ejs=require(_0xd0cf('0x9'));var fs=require('fs');var _=require(_0xd0cf('0xa'));var squel=require(_0xd0cf('0xb'));var crypto=require(_0xd0cf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0cf('0xd'));var toCsv=require(_0xd0cf('0x8'));var querystring=require(_0xd0cf('0xe'));var Papa=require('papaparse');var qs=require(_0xd0cf('0xf'));var logger=require(_0xd0cf('0x10'))(_0xd0cf('0x11'));var utils=require(_0xd0cf('0x12'));var config=require(_0xd0cf('0x13'));var db=require(_0xd0cf('0x14'))['db'];var socket=require(_0xd0cf('0x15'))({'host':_0xd0cf('0x16'),'port':0x18eb});require(_0xd0cf('0x17'))['register'](socket);function respondWithStatusCode(_0x5d25f8,_0x5742ca){_0x5742ca=_0x5742ca||0xcc;return function(_0x28af78){if(_0x28af78){return _0x5d25f8[_0xd0cf('0x18')](_0x5742ca);}return _0x5d25f8['status'](_0x5742ca)[_0xd0cf('0x19')]();};}function respondWithResult(_0x5da299,_0x4de031){_0x4de031=_0x4de031||0xc8;return function(_0x378225){if(_0x378225){return _0x5da299[_0xd0cf('0x1a')](_0x4de031)[_0xd0cf('0x1b')](_0x378225);}};}function respondWithFilteredResult(_0x11a071,_0x2a3263){return function(_0x25688a){if(_0x25688a){var _0x420bc2=_0x25688a[_0xd0cf('0x1c')],_0x2cd2dc=_0x2a3263[_0xd0cf('0x1d')],_0xa0c983=_0x2a3263[_0xd0cf('0x1d')]+_0x2a3263[_0xd0cf('0x1e')],_0x414fb8;if(_0xa0c983>=_0x420bc2){_0xa0c983=_0x420bc2;_0x414fb8=0xc8;}else{_0x414fb8=0xce;}_0x11a071[_0xd0cf('0x1a')](_0x414fb8);return _0x11a071['set'](_0xd0cf('0x1f'),_0x2cd2dc+'-'+_0xa0c983+'/'+_0x420bc2)[_0xd0cf('0x1b')](_0x25688a);}return null;};}function patchUpdates(_0x2dc1ac){return function(_0xa51f09){try{jsonpatch['apply'](_0xa51f09,_0x2dc1ac,!![]);}catch(_0x3f23af){return BPromise[_0xd0cf('0x20')](_0x3f23af);}return _0xa51f09[_0xd0cf('0x21')]();};}function saveUpdates(_0x4373c7,_0x1df16d){return function(_0x28cd86){if(_0x28cd86){return _0x28cd86[_0xd0cf('0x22')](_0x4373c7)['then'](function(_0x4b48f3){return _0x4b48f3;});}return null;};}function removeEntity(_0x420174,_0xcade24){return function(_0x33f9aa){if(_0x33f9aa){return _0x33f9aa[_0xd0cf('0x23')]()[_0xd0cf('0x24')](function(){_0x420174['status'](0xcc)[_0xd0cf('0x19')]();});}};}function handleEntityNotFound(_0x1b0df7,_0xb0a45d){return function(_0x266480){if(!_0x266480){_0x1b0df7[_0xd0cf('0x18')](0x194);}return _0x266480;};}function handleError(_0xba689f,_0x2177d8){_0x2177d8=_0x2177d8||0x1f4;return function(_0x450c35){logger['error'](_0x450c35['stack']);if(_0x450c35[_0xd0cf('0x25')]){delete _0x450c35[_0xd0cf('0x25')];}_0xba689f[_0xd0cf('0x1a')](_0x2177d8)[_0xd0cf('0x26')](_0x450c35);};}exports['index']=function(_0x4715f3,_0x540ac1){var _0x1819ef={},_0x11f629={},_0x227341={'count':0x0,'rows':[]};var _0x2e24c1=db['MailInteraction'][_0xd0cf('0x27')];_0x11f629[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](_0x2e24c1);var _0x48a756={'dateStart':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2b')],'dateEnd':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2c')]};delete _0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2b')];delete _0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x2c')];_0x11f629[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x4715f3[_0xd0cf('0x2a')]);_0x11f629[_0xd0cf('0x2d')]=_['intersection'](_0x11f629['model'],_0x11f629['query']);_0x1819ef[_0xd0cf('0x2e')]=_[_0xd0cf('0x2f')](_0x11f629[_0xd0cf('0x28')],qs[_0xd0cf('0x30')](_0x4715f3['query'][_0xd0cf('0x30')]));_0x1819ef['attributes']=_0x1819ef['attributes'][_0xd0cf('0x31')]?_0x1819ef[_0xd0cf('0x2e')]:_0x11f629[_0xd0cf('0x28')];if(!_0x4715f3['query'][_0xd0cf('0x32')](_0xd0cf('0x33'))){_0x1819ef[_0xd0cf('0x1e')]=qs[_0xd0cf('0x1e')](_0x4715f3[_0xd0cf('0x2a')]['limit']);_0x1819ef['offset']=qs['offset'](_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x1d')]);}_0x1819ef[_0xd0cf('0x34')]=qs[_0xd0cf('0x35')](_0x4715f3[_0xd0cf('0x2a')]['sort']);_0x1819ef[_0xd0cf('0x36')]=qs['filters'](_[_0xd0cf('0x37')](_0x4715f3[_0xd0cf('0x2a')],_0x11f629['filters']));if(_0x48a756['dateStart']){if(_0x48a756[_0xd0cf('0x2c')]){_0x48a756[_0xd0cf('0x2c')]=moment(_0x48a756[_0xd0cf('0x2c')])[_0xd0cf('0x38')](0x1,_0xd0cf('0x39'));}else{_0x48a756[_0xd0cf('0x2c')]=moment(_0x48a756[_0xd0cf('0x2b')])['add'](0x1,'day');}_[_0xd0cf('0x3a')](_0x1819ef[_0xd0cf('0x36')],{'createdAt':{'$gte':_0x48a756[_0xd0cf('0x2b')],'$lte':_0x48a756['dateEnd']}});}if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3b')]){_0x1819ef[_0xd0cf('0x36')]=_[_0xd0cf('0x3a')](_0x1819ef['where'],{'$or':_[_0xd0cf('0x3c')](_0x1819ef[_0xd0cf('0x2e')],function(_0x4294a0){var _0x1cf34b={};_0x1cf34b[_0x4294a0]={'$like':'%'+_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3b')]+'%'};return _0x1cf34b;})});}_0x1819ef=_[_0xd0cf('0x3a')]({},_0x1819ef,_0x4715f3[_0xd0cf('0x3d')]);var _0x4822d8={'where':_0x1819ef[_0xd0cf('0x36')]};_0x4822d8[_0xd0cf('0x3e')]=[];if(_0x4715f3['query'][_0xd0cf('0x3f')]){_0x4822d8[_0xd0cf('0x3e')]['push']({'model':db[_0xd0cf('0x40')],'as':_0xd0cf('0x41'),'attributes':['id'],'where':{'id':_0x4715f3['query'][_0xd0cf('0x3f')]},'required':!![]});_0x4822d8['distinct']=!![];}if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]){_0x4822d8[_0xd0cf('0x3e')][_0xd0cf('0x43')]({'model':db[_0xd0cf('0x44')],'as':_0xd0cf('0x45'),'attributes':['id','direction','createdAt',_0xd0cf('0x42')],'where':{'direction':'in','read':_0x4715f3['query']['read']||![]},'required':!![]});_0x4822d8[_0xd0cf('0x46')]=!![];}return db[_0xd0cf('0x47')][_0xd0cf('0x1c')](_0x4822d8)[_0xd0cf('0x24')](function(_0x2bcac8){_0x227341[_0xd0cf('0x1c')]=_0x2bcac8;if(_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x48')]){_0x1819ef[_0xd0cf('0x3e')]=[{'model':db[_0xd0cf('0x49')],'as':_0xd0cf('0x4a'),'required':![],'attributes':['id',_0xd0cf('0x25'),'fullname']},{'model':db[_0xd0cf('0x4b')],'as':_0xd0cf('0x4c'),'required':![]},{'model':db[_0xd0cf('0x49')],'as':_0xd0cf('0x4d'),'attributes':[_0xd0cf('0x25'),_0xd0cf('0x4e'),_0xd0cf('0x4f')],'required':![]},{'model':db[_0xd0cf('0x50')],'as':_0xd0cf('0x51'),'attributes':[_0xd0cf('0x25'),_0xd0cf('0x52'),_0xd0cf('0x53')],'required':![]},{'model':db['MailMessage'],'as':_0xd0cf('0x45'),'attributes':['id',_0xd0cf('0x54'),_0xd0cf('0x55'),_0xd0cf('0x42')],'where':{'direction':'in','read':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]||![]},'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x42')]||![]},{'model':db[_0xd0cf('0x40')],'as':'Tags','attributes':['id',_0xd0cf('0x25'),'color'],'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?!![]:![]},{'model':db['Tag'],'as':_0xd0cf('0x56'),'attributes':['id',_0xd0cf('0x25'),_0xd0cf('0x57')],'through':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?{'attributes':[],'where':{'TagId':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]||undefined}}:{},'required':_0x4715f3[_0xd0cf('0x2a')][_0xd0cf('0x3f')]?!![]:![]}];}return db[_0xd0cf('0x47')][_0xd0cf('0x58')](_0x1819ef);})[_0xd0cf('0x24')](function(_0x3d98ad){_0x227341['rows']=_0x3d98ad;return _0x227341;})[_0xd0cf('0x24')](respondWithFilteredResult(_0x540ac1,_0x1819ef))[_0xd0cf('0x59')](handleError(_0x540ac1,null));};exports['show']=function(_0x50efdb,_0x4a9112){var _0x23bc9e={'raw':![],'where':{'id':_0x50efdb[_0xd0cf('0x5a')]['id']}},_0x4ecf9={};_0x4ecf9[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](db['MailInteraction']['rawAttributes']);_0x4ecf9[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x50efdb[_0xd0cf('0x2a')]);_0x4ecf9[_0xd0cf('0x2d')]=_[_0xd0cf('0x2f')](_0x4ecf9['model'],_0x4ecf9['query']);_0x23bc9e[_0xd0cf('0x2e')]=_[_0xd0cf('0x2f')](_0x4ecf9['model'],qs[_0xd0cf('0x30')](_0x50efdb['query'][_0xd0cf('0x30')]));_0x23bc9e['attributes']=_0x23bc9e['attributes']['length']?_0x23bc9e[_0xd0cf('0x2e')]:_0x4ecf9['model'];if(_0x50efdb['query'][_0xd0cf('0x48')]){_0x23bc9e[_0xd0cf('0x3e')]=[{'all':!![]}];}_0x23bc9e=_[_0xd0cf('0x3a')]({},_0x23bc9e,_0x50efdb[_0xd0cf('0x3d')]);return db[_0xd0cf('0x47')][_0xd0cf('0x5b')](_0x23bc9e)[_0xd0cf('0x24')](handleEntityNotFound(_0x4a9112,null))[_0xd0cf('0x24')](respondWithResult(_0x4a9112,null))[_0xd0cf('0x59')](handleError(_0x4a9112,null));};exports[_0xd0cf('0x5c')]=function(_0x190269,_0x5d2d54){return db[_0xd0cf('0x47')][_0xd0cf('0x5c')](_0x190269[_0xd0cf('0x5d')],{})[_0xd0cf('0x24')](respondWithResult(_0x5d2d54,0xc9))['catch'](handleError(_0x5d2d54,null));};exports[_0xd0cf('0x22')]=function(_0x308147,_0x465a5a){if(_0x308147[_0xd0cf('0x5d')]['id']){delete _0x308147['body']['id'];}return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x308147['params']['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x465a5a,null))['then'](saveUpdates(_0x308147['body'],null))[_0xd0cf('0x24')](respondWithResult(_0x465a5a,null))[_0xd0cf('0x59')](handleError(_0x465a5a,null));};exports['destroy']=function(_0x1851aa,_0x451972){return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x1851aa[_0xd0cf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x451972,null))['then'](removeEntity(_0x451972,null))[_0xd0cf('0x59')](handleError(_0x451972,null));};exports[_0xd0cf('0x5e')]=function(_0x2621d7,_0x5684d9){return db[_0xd0cf('0x47')][_0xd0cf('0x5e')]()[_0xd0cf('0x24')](respondWithResult(_0x5684d9,null))['catch'](handleError(_0x5684d9,null));};exports['addMessage']=function(_0x387f4a,_0x375360,_0x25285c){return db[_0xd0cf('0x44')][_0xd0cf('0x5b')]({'where':{'id':_0x387f4a[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x375360,null))[_0xd0cf('0x24')](function(_0x45b3bd){if(_0x45b3bd){return _0x45b3bd[_0xd0cf('0x5f')](_0x387f4a[_0xd0cf('0x5d')][_0xd0cf('0x60')],_[_0xd0cf('0x61')](_0x387f4a[_0xd0cf('0x5d')],[_0xd0cf('0x60'),'id'])||{});}})[_0xd0cf('0x24')](respondWithResult(_0x375360,null))[_0xd0cf('0x59')](handleError(_0x375360,null));};exports[_0xd0cf('0x62')]=function(_0x30220a,_0x1b13e2,_0x40dba4){var _0x55049c={'raw':![],'where':{}};var _0x33974d={};var _0xf5b2ca={'count':0x0,'rows':[]};return db[_0xd0cf('0x47')][_0xd0cf('0x63')]({'where':{'id':_0x30220a[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x1b13e2,null))[_0xd0cf('0x24')](function(_0x555a53){if(_0x555a53){_0x33974d[_0xd0cf('0x28')]=_[_0xd0cf('0x29')](db['MailMessage'][_0xd0cf('0x27')]);_0x33974d[_0xd0cf('0x2a')]=_[_0xd0cf('0x29')](_0x30220a['query']);_0x33974d[_0xd0cf('0x2d')]=_[_0xd0cf('0x2f')](_0x33974d[_0xd0cf('0x28')],_0x33974d['query']);_0x55049c[_0xd0cf('0x2e')]=_['intersection'](_0x33974d[_0xd0cf('0x28')],qs[_0xd0cf('0x30')](_0x30220a['query'][_0xd0cf('0x30')]));_0x55049c[_0xd0cf('0x2e')]=_0x55049c['attributes'][_0xd0cf('0x31')]?_0x55049c[_0xd0cf('0x2e')]:_0x33974d['model'];if(!_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x32')](_0xd0cf('0x33'))){_0x55049c[_0xd0cf('0x1e')]=qs['limit'](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x1e')]);_0x55049c[_0xd0cf('0x1d')]=qs[_0xd0cf('0x1d')](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x1d')]);}_0x55049c[_0xd0cf('0x34')]=qs[_0xd0cf('0x35')](_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x35')]);_0x55049c[_0xd0cf('0x36')]=qs[_0xd0cf('0x2d')](_[_0xd0cf('0x37')](_0x30220a['query'],_0x33974d[_0xd0cf('0x2d')]));_0x55049c['where'][_0xd0cf('0x64')]=_0x555a53['id'];if(_0x30220a['query'][_0xd0cf('0x3b')]){_0x55049c[_0xd0cf('0x36')]=_[_0xd0cf('0x3a')](_0x55049c[_0xd0cf('0x36')],{'$or':_['map'](_0x55049c[_0xd0cf('0x2e')],function(_0x464819){var _0x2453a9={};_0x2453a9[_0x464819]={'$like':'%'+_0x30220a['query'][_0xd0cf('0x3b')]+'%'};return _0x2453a9;})});}if(_0x30220a['query'][_0xd0cf('0x65')]){var _0x3573f8=_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x65')][_0xd0cf('0x66')](',');var _0x110243={};_0x110243[_0x3573f8[0x0]]={'$gte':moment(_0x3573f8[0x1])[_0xd0cf('0x67')](_0xd0cf('0x68'))};_0x55049c[_0xd0cf('0x36')]=_['merge'](_0x55049c['where'],_0x110243);}_0x55049c=_[_0xd0cf('0x3a')]({},_0x55049c,_0x30220a[_0xd0cf('0x3d')]);return db[_0xd0cf('0x44')][_0xd0cf('0x1c')]({'where':_0x55049c['where']})[_0xd0cf('0x24')](function(_0x715cbf){_0xf5b2ca[_0xd0cf('0x1c')]=_0x715cbf;if(_0x30220a[_0xd0cf('0x2a')][_0xd0cf('0x48')]){_0x55049c[_0xd0cf('0x3e')]=[{'all':!![]}];}return db[_0xd0cf('0x44')][_0xd0cf('0x58')](_0x55049c);})['then'](function(_0x32cb57){_0xf5b2ca['rows']=_0x32cb57;return _0xf5b2ca;});}})['then'](respondWithFilteredResult(_0x1b13e2,_0x55049c))[_0xd0cf('0x59')](handleError(_0x1b13e2,null));};exports['addTags']=function(_0x1a29fc,_0x3628cb,_0x5a6e40){return db[_0xd0cf('0x47')][_0xd0cf('0x5b')]({'where':{'id':_0x1a29fc[_0xd0cf('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3628cb,null))['then'](function(_0x45b952){if(_0x45b952){return _0x45b952[_0xd0cf('0x69')](_0x1a29fc['body'][_0xd0cf('0x60')],_['omit'](_0x1a29fc[_0xd0cf('0x5d')],[_0xd0cf('0x60'),'id'])||{})[_0xd0cf('0x6a')](function(){return db[_0xd0cf('0x40')]['findAll']({'attributes':['id',_0xd0cf('0x25'),_0xd0cf('0x57')],'where':{'id':_0x1a29fc[_0xd0cf('0x5d')]['ids']}});})[_0xd0cf('0x24')](function(_0x684edb){socket['emit']('mailInteractionTags:save',{'id':Number(_0x1a29fc[_0xd0cf('0x5a')]['id']),'tags':_0x684edb||[]});return{'id':Number(_0x1a29fc[_0xd0cf('0x5a')]['id']),'tags':_0x684edb||[]};});}})[_0xd0cf('0x24')](respondWithResult(_0x3628cb,null))[_0xd0cf('0x59')](handleError(_0x3628cb,null));};exports['removeTags']=function(_0x4c9812,_0x18bf18,_0x23ff32){var _0x5e6272;return db['MailInteraction']['find']({'where':{'id':_0x4c9812[_0xd0cf('0x5a')]['id']}})[_0xd0cf('0x24')](handleEntityNotFound(_0x18bf18,null))[_0xd0cf('0x24')](function(_0x236fbc){if(_0x236fbc){return _0x236fbc[_0xd0cf('0x6b')](_0x4c9812[_0xd0cf('0x2a')][_0xd0cf('0x60')]);}})['then'](respondWithStatusCode(_0x18bf18,null))[_0xd0cf('0x59')](handleError(_0x18bf18,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index cb6b624..b93c036 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 _0x5a5e=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save','update'];(function(_0x116048,_0x1bd177){var _0x2f9fe4=function(_0x307558){while(--_0x307558){_0x116048['push'](_0x116048['shift']());}};_0x2f9fe4(++_0x1bd177);}(_0x5a5e,0xd6));var _0xe5a5=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x5a5e[_0xacb1e2];return _0x463815;};'use strict';var EventEmitter=require(_0xe5a5('0x0'));var MailInteraction=require(_0xe5a5('0x1'))['db'][_0xe5a5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xe5a5('0x3')](0x0);var events={'afterCreate':_0xe5a5('0x4'),'afterUpdate':_0xe5a5('0x5'),'afterDestroy':'remove'};function emitEvent(_0x440431){return function(_0x56bbcf,_0x28b099,_0x5e46d5){MailInteractionEvents[_0xe5a5('0x6')](_0x440431+':'+_0x56bbcf['id'],_0x56bbcf);MailInteractionEvents[_0xe5a5('0x6')](_0x440431,_0x56bbcf);_0x5e46d5(null);};}for(var e in events){if(events[_0xe5a5('0x7')](e)){var event=events[e];MailInteraction[_0xe5a5('0x8')](e,emitEvent(event));}}module[_0xe5a5('0x9')]=MailInteractionEvents; \ No newline at end of file +var _0xf259=['../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty','hook','events'];(function(_0x417699,_0xd54f87){var _0x279405=function(_0x5b2cff){while(--_0x5b2cff){_0x417699['push'](_0x417699['shift']());}};_0x279405(++_0xd54f87);}(_0xf259,0x1db));var _0x9f25=function(_0x5b6526,_0x544991){_0x5b6526=_0x5b6526-0x0;var _0x2a21e9=_0xf259[_0x5b6526];return _0x2a21e9;};'use strict';var EventEmitter=require(_0x9f25('0x0'));var MailInteraction=require(_0x9f25('0x1'))['db']['MailInteraction'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9f25('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x9f25('0x3')};function emitEvent(_0xb83e45){return function(_0x14e2e4,_0xb7b499,_0x2314ef){MailInteractionEvents['emit'](_0xb83e45+':'+_0x14e2e4['id'],_0x14e2e4);MailInteractionEvents[_0x9f25('0x4')](_0xb83e45,_0x14e2e4);_0x2314ef(null);};}for(var e in events){if(events[_0x9f25('0x5')](e)){var event=events[e];MailInteraction[_0x9f25('0x6')](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 3b74ff5..8dc007b 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 _0x934f=['moment','bluebird','request-promise','./mailInteraction.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0x934f,0x1d2));var _0xf934=function(_0x374a3,_0x451296){_0x374a3=_0x374a3-0x0;var _0x38f7ad=_0x934f[_0x374a3];return _0x38f7ad;};'use strict';var _=require(_0xf934('0x0'));var util=require(_0xf934('0x1'));var logger=require(_0xf934('0x2'))(_0xf934('0x3'));var moment=require(_0xf934('0x4'));var BPromise=require(_0xf934('0x5'));var rp=require(_0xf934('0x6'));var attributes=require(_0xf934('0x7'));module[_0xf934('0x8')]=function(_0x508239,_0x2371d4){return _0x508239[_0xf934('0x9')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea11=['api','moment','bluebird','request-promise','exports','MailInteraction','mail_interactions','lodash','util'];(function(_0x480683,_0x5683d6){var _0xea4168=function(_0xd899f5){while(--_0xd899f5){_0x480683['push'](_0x480683['shift']());}};_0xea4168(++_0x5683d6);}(_0xea11,0x10c));var _0x1ea1=function(_0x3296c0,_0x2c3a86){_0x3296c0=_0x3296c0-0x0;var _0xad5062=_0xea11[_0x3296c0];return _0xad5062;};'use strict';var _=require(_0x1ea1('0x0'));var util=require(_0x1ea1('0x1'));var logger=require('../../config/logger')(_0x1ea1('0x2'));var moment=require(_0x1ea1('0x3'));var BPromise=require(_0x1ea1('0x4'));var rp=require(_0x1ea1('0x5'));var attributes=require('./mailInteraction.attributes');module[_0x1ea1('0x6')]=function(_0x2654c6,_0x27a918){return _0x2654c6['define'](_0x1ea1('0x7'),attributes,{'tableName':_0x1ea1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 8de1394..eb643c3 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 _0xd340=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','localhost','./mailInteraction.socket','register','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailInteraction,\x20%s,\x20%s','result','UpdateMailInteraction','MailInteraction','options','raw','where','attributes','limit','catch','AddTagsToMailInteraction','find','addTags','ids','body','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2a6754,_0x277259){var _0x17feda=function(_0x5745be){while(--_0x5745be){_0x2a6754['push'](_0x2a6754['shift']());}};_0x17feda(++_0x277259);}(_0xd340,0x1db));var _0x0d34=function(_0xc1dc7f,_0x3a5bd4){_0xc1dc7f=_0xc1dc7f-0x0;var _0x2b00ed=_0xd340[_0xc1dc7f];return _0x2b00ed;};'use strict';var _=require('lodash');var util=require(_0x0d34('0x0'));var moment=require(_0x0d34('0x1'));var BPromise=require(_0x0d34('0x2'));var rs=require(_0x0d34('0x3'));var fs=require('fs');var db=require(_0x0d34('0x4'))['db'];var utils=require(_0x0d34('0x5'));var logger=require(_0x0d34('0x6'))(_0x0d34('0x7'));var config=require(_0x0d34('0x8'));var jayson=require(_0x0d34('0x9'));var client=jayson[_0x0d34('0xa')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x0d34('0xb'),'port':0x18eb});require(_0x0d34('0xc'))[_0x0d34('0xd')](socket);function respondWithRpcPromise(_0x53a4f1,_0x23ea2e,_0x2b8b06){return new BPromise(function(_0x14c503,_0x1cd8e8){return client['request'](_0x53a4f1,_0x2b8b06)[_0x0d34('0xe')](function(_0x3cbc5e){logger[_0x0d34('0xf')]('MailInteraction,\x20%s,\x20%s',_0x23ea2e,_0x0d34('0x10'));logger[_0x0d34('0x11')](_0x0d34('0x12'),_0x23ea2e,_0x0d34('0x10'),JSON[_0x0d34('0x13')](_0x3cbc5e));if(_0x3cbc5e[_0x0d34('0x14')]){if(_0x3cbc5e[_0x0d34('0x14')][_0x0d34('0x15')]===0x1f4){logger[_0x0d34('0x14')]('MailInteraction,\x20%s,\x20%s',_0x23ea2e,_0x3cbc5e[_0x0d34('0x14')][_0x0d34('0x16')]);return _0x1cd8e8(_0x3cbc5e[_0x0d34('0x14')][_0x0d34('0x16')]);}logger[_0x0d34('0x14')](_0x0d34('0x17'),_0x23ea2e,_0x3cbc5e[_0x0d34('0x14')][_0x0d34('0x16')]);return _0x14c503(_0x3cbc5e[_0x0d34('0x14')][_0x0d34('0x16')]);}else{logger[_0x0d34('0xf')](_0x0d34('0x17'),_0x23ea2e,_0x0d34('0x10'));_0x14c503(_0x3cbc5e[_0x0d34('0x18')][_0x0d34('0x16')]);}})['catch'](function(_0x20edf9){logger['error']('MailInteraction,\x20%s,\x20%s',_0x23ea2e,_0x20edf9);_0x1cd8e8(_0x20edf9);});});}exports[_0x0d34('0x19')]=function(_0x33d535){var _0x54ea20=this;return new Promise(function(_0x35872a,_0x20e827){return db[_0x0d34('0x1a')]['update'](_0x33d535['body'],{'raw':_0x33d535[_0x0d34('0x1b')]?_0x33d535[_0x0d34('0x1b')][_0x0d34('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d535[_0x0d34('0x1b')]?_0x33d535[_0x0d34('0x1b')][_0x0d34('0x1d')]||null:null,'attributes':_0x33d535[_0x0d34('0x1b')]?_0x33d535[_0x0d34('0x1b')][_0x0d34('0x1e')]||null:null,'limit':_0x33d535['options']?_0x33d535[_0x0d34('0x1b')][_0x0d34('0x1f')]||null:null})[_0x0d34('0xe')](function(_0x39ba58){logger[_0x0d34('0xf')](_0x0d34('0x19'),_0x33d535);logger[_0x0d34('0x11')](_0x0d34('0x19'),_0x33d535,JSON[_0x0d34('0x13')](_0x39ba58));_0x35872a(_0x39ba58);})[_0x0d34('0x20')](function(_0x319bc4){logger[_0x0d34('0x14')](_0x0d34('0x19'),_0x319bc4[_0x0d34('0x16')],_0x33d535);_0x20e827(_0x54ea20[_0x0d34('0x14')](0x1f4,_0x319bc4[_0x0d34('0x16')]));});});};exports[_0x0d34('0x21')]=function(_0x107933){return new Promise(function(_0x39d98c,_0x307b40){return db[_0x0d34('0x1a')][_0x0d34('0x22')]({'where':_0x107933[_0x0d34('0x1b')]?_0x107933['options'][_0x0d34('0x1d')]||null:null})['then'](function(_0x45a7f1){if(_0x45a7f1){return _0x45a7f1[_0x0d34('0x23')](_0x107933['body'][_0x0d34('0x24')],_['omit'](_0x107933[_0x0d34('0x25')],[_0x0d34('0x24'),'id'])||{});}})[_0x0d34('0x26')](function(_0x2606c0){logger[_0x0d34('0xf')]('AddTags',_0x107933);logger[_0x0d34('0x11')](_0x0d34('0x27'),_0x107933,JSON[_0x0d34('0x13')](_0x2606c0));_0x39d98c(_0x2606c0);})[_0x0d34('0x20')](function(_0x586fb7){logger[_0x0d34('0x14')](_0x0d34('0x27'),_0x586fb7[_0x0d34('0x16')],_0x107933);_0x307b40(_this[_0x0d34('0x14')](0x1f4,_0x586fb7['message']));});});}; \ No newline at end of file +var _0x1d21=['info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','AddTagsToMailInteraction','find','body','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','localhost','./mailInteraction.socket','register','request','then'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0x1d21,0xb1));var _0x11d2=function(_0x48f7cf,_0x4baa04){_0x48f7cf=_0x48f7cf-0x0;var _0xc201c0=_0x1d21[_0x48f7cf];return _0xc201c0;};'use strict';var _=require('lodash');var util=require(_0x11d2('0x0'));var moment=require(_0x11d2('0x1'));var BPromise=require(_0x11d2('0x2'));var rs=require(_0x11d2('0x3'));var fs=require('fs');var db=require(_0x11d2('0x4'))['db'];var utils=require(_0x11d2('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x11d2('0x6'));var client=jayson['client'][_0x11d2('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x11d2('0x8'),'port':0x18eb});require(_0x11d2('0x9'))[_0x11d2('0xa')](socket);function respondWithRpcPromise(_0x49a874,_0x18efc7,_0x2ead4d){return new BPromise(function(_0x2052aa,_0x43501c){return client[_0x11d2('0xb')](_0x49a874,_0x2ead4d)[_0x11d2('0xc')](function(_0x802e76){logger[_0x11d2('0xd')](_0x11d2('0xe'),_0x18efc7,'request\x20sent');logger[_0x11d2('0xf')](_0x11d2('0x10'),_0x18efc7,'request\x20sent',JSON[_0x11d2('0x11')](_0x802e76));if(_0x802e76['error']){if(_0x802e76[_0x11d2('0x12')][_0x11d2('0x13')]===0x1f4){logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x802e76['error'][_0x11d2('0x14')]);return _0x43501c(_0x802e76[_0x11d2('0x12')][_0x11d2('0x14')]);}logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x802e76[_0x11d2('0x12')]['message']);return _0x2052aa(_0x802e76[_0x11d2('0x12')][_0x11d2('0x14')]);}else{logger[_0x11d2('0xd')](_0x11d2('0xe'),_0x18efc7,_0x11d2('0x15'));_0x2052aa(_0x802e76[_0x11d2('0x16')][_0x11d2('0x14')]);}})[_0x11d2('0x17')](function(_0x5992aa){logger[_0x11d2('0x12')](_0x11d2('0xe'),_0x18efc7,_0x5992aa);_0x43501c(_0x5992aa);});});}exports[_0x11d2('0x18')]=function(_0x5e6a30){var _0x4a822c=this;return new Promise(function(_0x24bacd,_0xa60b20){return db[_0x11d2('0x19')][_0x11d2('0x1a')](_0x5e6a30['body'],{'raw':_0x5e6a30['options']?_0x5e6a30[_0x11d2('0x1b')][_0x11d2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e6a30['options']?_0x5e6a30['options'][_0x11d2('0x1d')]||null:null,'attributes':_0x5e6a30['options']?_0x5e6a30[_0x11d2('0x1b')][_0x11d2('0x1e')]||null:null,'limit':_0x5e6a30[_0x11d2('0x1b')]?_0x5e6a30[_0x11d2('0x1b')]['limit']||null:null})['then'](function(_0x52b870){logger[_0x11d2('0xd')](_0x11d2('0x18'),_0x5e6a30);logger['debug'](_0x11d2('0x18'),_0x5e6a30,JSON['stringify'](_0x52b870));_0x24bacd(_0x52b870);})[_0x11d2('0x17')](function(_0x7abc91){logger['error'](_0x11d2('0x18'),_0x7abc91[_0x11d2('0x14')],_0x5e6a30);_0xa60b20(_0x4a822c[_0x11d2('0x12')](0x1f4,_0x7abc91[_0x11d2('0x14')]));});});};exports[_0x11d2('0x1f')]=function(_0x460074){return new Promise(function(_0x597f34,_0x4d6a4e){return db[_0x11d2('0x19')][_0x11d2('0x20')]({'where':_0x460074[_0x11d2('0x1b')]?_0x460074['options'][_0x11d2('0x1d')]||null:null})[_0x11d2('0xc')](function(_0x49479b){if(_0x49479b){return _0x49479b['addTags'](_0x460074[_0x11d2('0x21')][_0x11d2('0x22')],_[_0x11d2('0x23')](_0x460074[_0x11d2('0x21')],[_0x11d2('0x22'),'id'])||{});}})[_0x11d2('0x24')](function(_0x4e87b8){logger[_0x11d2('0xd')](_0x11d2('0x25'),_0x460074);logger[_0x11d2('0xf')](_0x11d2('0x25'),_0x460074,JSON['stringify'](_0x4e87b8));_0x597f34(_0x4e87b8);})[_0x11d2('0x17')](function(_0x21b77f){logger[_0x11d2('0x12')]('AddTags',_0x21b77f[_0x11d2('0x14')],_0x460074);_0x4d6a4e(_this[_0x11d2('0x12')](0x1f4,_0x21b77f[_0x11d2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 54cc747..3895b03 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 _0xb6bb=['mailInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xb6bb,0x14a));var _0xbb6b=function(_0x458d78,_0xb25319){_0x458d78=_0x458d78-0x0;var _0x6c654c=_0xb6bb[_0x458d78];return _0x6c654c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xbb6b('0x0'),_0xbb6b('0x1'),_0xbb6b('0x2')];function createListener(_0x555ba4,_0x5aebb6){return function(_0x21bbe5){_0x5aebb6[_0xbb6b('0x3')](_0x555ba4,_0x21bbe5);};}function removeListener(_0x1ebeac,_0x18a1ec){return function(){MailInteractionEvents[_0xbb6b('0x4')](_0x1ebeac,_0x18a1ec);};}exports[_0xbb6b('0x5')]=function(_0x58cb24){for(var _0x40eb5a=0x0,_0x4c06c7=events['length'];_0x40eb5a<_0x4c06c7;_0x40eb5a++){var _0x58b488=events[_0x40eb5a];var _0x326914=createListener(_0xbb6b('0x6')+_0x58b488,_0x58cb24);MailInteractionEvents['on'](_0x58b488,_0x326914);}}; \ No newline at end of file +var _0x8f16=['update','emit','removeListener','length','./mailInteraction.events','save','remove'];(function(_0x56bbee,_0xa53b0e){var _0x2f8a3d=function(_0x4810fe){while(--_0x4810fe){_0x56bbee['push'](_0x56bbee['shift']());}};_0x2f8a3d(++_0xa53b0e);}(_0x8f16,0xcf));var _0x68f1=function(_0xfbca44,_0x1888c6){_0xfbca44=_0xfbca44-0x0;var _0x1f3b5a=_0x8f16[_0xfbca44];return _0x1f3b5a;};'use strict';var MailInteractionEvents=require(_0x68f1('0x0'));var events=[_0x68f1('0x1'),_0x68f1('0x2'),_0x68f1('0x3')];function createListener(_0x4e2b40,_0x2846c4){return function(_0x170220){_0x2846c4[_0x68f1('0x4')](_0x4e2b40,_0x170220);};}function removeListener(_0x34a2a3,_0x303ff9){return function(){MailInteractionEvents[_0x68f1('0x5')](_0x34a2a3,_0x303ff9);};}exports['register']=function(_0xfaba30){for(var _0x934e8c=0x0,_0x4e459c=events[_0x68f1('0x6')];_0x934e8c<_0x4e459c;_0x934e8c++){var _0x386211=events[_0x934e8c];var _0x429891=createListener('mailInteraction:'+_0x386211,_0xfaba30);MailInteractionEvents['on'](_0x386211,_0x429891);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 4da2b5d..d0cde56 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 _0x514c=['path','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','/:id','show','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','multer'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x514c,0xfc));var _0xc514=function(_0x5ee6cc,_0x42e49e){_0x5ee6cc=_0x5ee6cc-0x0;var _0x5cc6e0=_0x514c[_0x5ee6cc];return _0x5cc6e0;};'use strict';var multer=require(_0xc514('0x0'));var util=require('util');var path=require(_0xc514('0x1'));var express=require(_0xc514('0x2'));var router=express[_0xc514('0x3')]();var auth=require(_0xc514('0x4'));var interaction=require(_0xc514('0x5'));var config=require('../../config/environment');var controller=require('./mailMessage.controller');router['get']('/',auth[_0xc514('0x6')](),controller[_0xc514('0x7')]);router['get'](_0xc514('0x8'),auth['isAuthenticated'](),controller[_0xc514('0x9')]);router['get'](_0xc514('0xa'),auth['isAuthenticated'](),controller[_0xc514('0xb')]);router['post']('/',auth[_0xc514('0x6')](),interaction[_0xc514('0xc')](_0xc514('0xd'),_0xc514('0xe')),controller[_0xc514('0xf')]);router[_0xc514('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc514('0x11')]);router['put'](_0xc514('0x12'),auth['isAuthenticated'](),controller[_0xc514('0x13')]);router['put'](_0xc514('0x14'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xc514('0xa'),auth[_0xc514('0x6')](),controller[_0xc514('0x15')]);module[_0xc514('0x16')]=router; \ No newline at end of file +var _0x94c6=['describe','/:id','show','tracked','mail','create','update','put','accept','reject','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x12c2c5,_0x3f84a6){var _0x3572d2=function(_0x4adbad){while(--_0x4adbad){_0x12c2c5['push'](_0x12c2c5['shift']());}};_0x3572d2(++_0x3f84a6);}(_0x94c6,0x12c));var _0x694c=function(_0x4e2826,_0x1495b2){_0x4e2826=_0x4e2826-0x0;var _0x47677c=_0x94c6[_0x4e2826];return _0x47677c;};'use strict';var multer=require('multer');var util=require(_0x694c('0x0'));var path=require(_0x694c('0x1'));var express=require(_0x694c('0x2'));var router=express[_0x694c('0x3')]();var auth=require(_0x694c('0x4'));var interaction=require(_0x694c('0x5'));var config=require(_0x694c('0x6'));var controller=require(_0x694c('0x7'));router[_0x694c('0x8')]('/',auth[_0x694c('0x9')](),controller[_0x694c('0xa')]);router[_0x694c('0x8')](_0x694c('0xb'),auth[_0x694c('0x9')](),controller[_0x694c('0xc')]);router[_0x694c('0x8')](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0xe')]);router['post']('/',auth[_0x694c('0x9')](),interaction[_0x694c('0xf')](_0x694c('0x10'),'mailmessage:create'),controller[_0x694c('0x11')]);router['put'](_0x694c('0xd'),auth[_0x694c('0x9')](),controller[_0x694c('0x12')]);router[_0x694c('0x13')]('/:id/accept',auth[_0x694c('0x9')](),controller[_0x694c('0x14')]);router[_0x694c('0x13')]('/:id/reject',auth[_0x694c('0x9')](),controller[_0x694c('0x15')]);router[_0x694c('0x16')]('/:id',auth[_0x694c('0x9')](),controller[_0x694c('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 2535002..02c8380 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 _0xf897=['TEXT','long','BOOLEAN','ENUM','out','STRING','INTEGER','DATE','sequelize','lodash','exports'];(function(_0x3e8c23,_0x3e1887){var _0x3fa914=function(_0x5e0814){while(--_0x5e0814){_0x3e8c23['push'](_0x3e8c23['shift']());}};_0x3fa914(++_0x3e1887);}(_0xf897,0xe4));var _0x7f89=function(_0x10f8a3,_0x26de37){_0x10f8a3=_0x10f8a3-0x0;var _0x370ec6=_0xf897[_0x10f8a3];return _0x370ec6;};'use strict';var Sequelize=require(_0x7f89('0x0'));var _=require(_0x7f89('0x1'));module[_0x7f89('0x2')]={'body':{'type':Sequelize[_0x7f89('0x3')](_0x7f89('0x4')),'allowNull':![]},'read':{'type':Sequelize[_0x7f89('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f89('0x6')]('in',_0x7f89('0x7')),'defaultValue':_0x7f89('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7f89('0x8')](0xbe)},'from':{'type':Sequelize[_0x7f89('0x8')]},'to':{'type':Sequelize[_0x7f89('0x3')](_0x7f89('0x4'))},'cc':{'type':Sequelize['TEXT'](_0x7f89('0x4'))},'bcc':{'type':Sequelize[_0x7f89('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x7f89('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x7f89('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x7f89('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0x7f89('0x4'))},'originCc':{'type':Sequelize[_0x7f89('0x3')](_0x7f89('0x4'))}}; \ No newline at end of file +var _0x1cbb=['sequelize','lodash','exports','TEXT','BOOLEAN','ENUM','STRING','long','DATE'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x1cbb,0x105));var _0xb1cb=function(_0x3c73a8,_0x340042){_0x3c73a8=_0x3c73a8-0x0;var _0x10064e=_0x1cbb[_0x3c73a8];return _0x10064e;};'use strict';var Sequelize=require(_0xb1cb('0x0'));var _=require(_0xb1cb('0x1'));module[_0xb1cb('0x2')]={'body':{'type':Sequelize[_0xb1cb('0x3')]('long'),'allowNull':![]},'read':{'type':Sequelize[_0xb1cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb1cb('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xb1cb('0x6')](0xbe)},'from':{'type':Sequelize[_0xb1cb('0x6')]},'to':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))},'cc':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))},'bcc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0xb1cb('0x3')]},'sentAt':{'type':Sequelize[_0xb1cb('0x8')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xb1cb('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xb1cb('0x8')]},'originTo':{'type':Sequelize['TEXT'](_0xb1cb('0x7'))},'originCc':{'type':Sequelize[_0xb1cb('0x3')](_0xb1cb('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 4ab8ee2..b144901 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 _0xfaec=['host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','read','UserId','CmContact','Contact','get','interaction','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','MailInteraction','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','localhost','./mailMessage.socket','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','query','dateStart','dateEnd','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','filter','merge','options','MailMessage','includeAll','findAll','rows','params','keys','include','find','body','describe','direction','out','secret','MailAccount','findOne','MailAccountId','Smtp','isNil','service'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0xfaec,0x12f));var _0xcfae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfaec[_0x1facfa];return _0x9ec701;};'use strict';var jsonpatch=require(_0xcfae('0x0'));var rp=require(_0xcfae('0x1'));var moment=require(_0xcfae('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xcfae('0x3'));var sox=require(_0xcfae('0x4'));var csv=require(_0xcfae('0x5'));var ejs=require(_0xcfae('0x6'));var fs=require('fs');var _=require(_0xcfae('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcfae('0x8'));var deskjs=require(_0xcfae('0x9'));var toCsv=require('to-csv');var querystring=require(_0xcfae('0xa'));var Papa=require(_0xcfae('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xcfae('0xc'));var utils=require(_0xcfae('0xd'));var config=require(_0xcfae('0xe'));var db=require(_0xcfae('0xf'))['db'];var socket=require('socket.io-emitter')({'host':_0xcfae('0x10'),'port':0x18eb});require(_0xcfae('0x11'))['register'](socket);var jayson=require(_0xcfae('0x12'));var client=jayson[_0xcfae('0x13')][_0xcfae('0x14')]({'port':0x232c});var client9003=jayson[_0xcfae('0x13')]['http']({'port':0x232b});var client9002=jayson[_0xcfae('0x13')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24c38b,_0x25623f,_0x247676,_0x5e6ae3){return new BPromise(function(_0x170af6,_0x224fa1){var _0xaf069d=_0x5e6ae3||client;return _0xaf069d[_0xcfae('0x15')](_0x24c38b,_0x247676)[_0xcfae('0x16')](function(_0x58940b){logger[_0xcfae('0x17')](_0xcfae('0x18'),_0x25623f,_0xcfae('0x19'));logger[_0xcfae('0x1a')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x25623f,_0xcfae('0x19'),JSON[_0xcfae('0x1b')](_0x58940b));if(_0x58940b[_0xcfae('0x1c')]){if(_0x58940b['error']['code']===0x1f4){logger[_0xcfae('0x1c')]('MailMessage,\x20%s,\x20%s',_0x25623f,_0x58940b['error'][_0xcfae('0x1d')]);return _0x224fa1(_0x58940b['error'][_0xcfae('0x1d')]);}logger['error'](_0xcfae('0x18'),_0x25623f,_0x58940b[_0xcfae('0x1c')]['message']);return _0x170af6(_0x58940b[_0xcfae('0x1c')][_0xcfae('0x1d')]);}else{logger[_0xcfae('0x17')](_0xcfae('0x18'),_0x25623f,_0xcfae('0x19'));_0x170af6(_0x58940b[_0xcfae('0x1e')][_0xcfae('0x1d')]);}})[_0xcfae('0x1f')](function(_0x44b9a6){logger[_0xcfae('0x1c')](_0xcfae('0x18'),_0x25623f,_0x44b9a6);_0x224fa1(_0x44b9a6);});});}function respondWithStatusCode(_0x561583,_0x9a83e5){_0x9a83e5=_0x9a83e5||0xcc;return function(_0x12087f){if(_0x12087f){return _0x561583[_0xcfae('0x20')](_0x9a83e5);}return _0x561583[_0xcfae('0x21')](_0x9a83e5)[_0xcfae('0x22')]();};}function respondWithResult(_0x1486ea,_0x3c90f6){_0x3c90f6=_0x3c90f6||0xc8;return function(_0x4991ff){if(_0x4991ff){return _0x1486ea[_0xcfae('0x21')](_0x3c90f6)[_0xcfae('0x23')](_0x4991ff);}};}function respondWithFilteredResult(_0x2cd487,_0x212b3b){return function(_0x20f61e){if(_0x20f61e){var _0x47a753=_0x20f61e[_0xcfae('0x24')],_0x70e40d=_0x212b3b['offset'],_0x4d92b7=_0x212b3b[_0xcfae('0x25')]+_0x212b3b[_0xcfae('0x26')],_0x1d2cad;if(_0x4d92b7>=_0x47a753){_0x4d92b7=_0x47a753;_0x1d2cad=0xc8;}else{_0x1d2cad=0xce;}_0x2cd487[_0xcfae('0x21')](_0x1d2cad);return _0x2cd487[_0xcfae('0x27')](_0xcfae('0x28'),_0x70e40d+'-'+_0x4d92b7+'/'+_0x47a753)[_0xcfae('0x23')](_0x20f61e);}return null;};}function patchUpdates(_0x5ca97b){return function(_0x5d1ccb){try{jsonpatch[_0xcfae('0x29')](_0x5d1ccb,_0x5ca97b,!![]);}catch(_0x5c4abe){return BPromise[_0xcfae('0x2a')](_0x5c4abe);}return _0x5d1ccb[_0xcfae('0x2b')]();};}function saveUpdates(_0x33e401,_0x3f1369){return function(_0x2d25dc){if(_0x2d25dc){return _0x2d25dc[_0xcfae('0x2c')](_0x33e401)[_0xcfae('0x16')](function(_0x511788){return _0x511788;});}return null;};}function removeEntity(_0x40c355,_0x2a1263){return function(_0x1b286c){if(_0x1b286c){return _0x1b286c[_0xcfae('0x2d')]()[_0xcfae('0x16')](function(){_0x40c355[_0xcfae('0x21')](0xcc)[_0xcfae('0x22')]();});}};}function handleEntityNotFound(_0xe23568,_0x4fd2e3){return function(_0x549989){if(!_0x549989){_0xe23568[_0xcfae('0x20')](0x194);}return _0x549989;};}function handleError(_0x1c0450,_0x1777ad){_0x1777ad=_0x1777ad||0x1f4;return function(_0x1af63b){logger[_0xcfae('0x1c')](_0x1af63b[_0xcfae('0x2e')]);if(_0x1af63b[_0xcfae('0x2f')]){delete _0x1af63b[_0xcfae('0x2f')];}_0x1c0450[_0xcfae('0x21')](_0x1777ad)[_0xcfae('0x30')](_0x1af63b);};}exports['index']=function(_0xe104b,_0x1f982a){var _0x201026={},_0x2a020d={},_0x988a54={'count':0x0,'rows':[]};var _0x2d9ac5=db['MailMessage']['rawAttributes'];_0x2a020d['model']=_['keys'](_0x2d9ac5);var _0x4da4da={'dateStart':_0xe104b[_0xcfae('0x31')][_0xcfae('0x32')],'dateEnd':_0xe104b['query'][_0xcfae('0x33')]};delete _0xe104b['query']['dateStart'];delete _0xe104b[_0xcfae('0x31')]['dateEnd'];_0x2a020d['query']=_['keys'](_0xe104b[_0xcfae('0x31')]);_0x2a020d[_0xcfae('0x34')]=_[_0xcfae('0x35')](_0x2a020d['model'],_0x2a020d[_0xcfae('0x31')]);_0x201026[_0xcfae('0x36')]=_[_0xcfae('0x35')](_0x2a020d[_0xcfae('0x37')],qs[_0xcfae('0x38')](_0xe104b['query'][_0xcfae('0x38')]));_0x201026['attributes']=_0x201026[_0xcfae('0x36')][_0xcfae('0x39')]?_0x201026[_0xcfae('0x36')]:_0x2a020d[_0xcfae('0x37')];if(!_0xe104b['query'][_0xcfae('0x3a')](_0xcfae('0x3b'))){_0x201026[_0xcfae('0x26')]=qs[_0xcfae('0x26')](_0xe104b['query'][_0xcfae('0x26')]);_0x201026[_0xcfae('0x25')]=qs[_0xcfae('0x25')](_0xe104b[_0xcfae('0x31')]['offset']);}_0x201026['order']=qs[_0xcfae('0x3c')](_0xe104b['query'][_0xcfae('0x3c')]);_0x201026[_0xcfae('0x3d')]=qs[_0xcfae('0x34')](_[_0xcfae('0x3e')](_0xe104b[_0xcfae('0x31')],_0x2a020d['filters']));if(_0x4da4da[_0xcfae('0x32')]){if(_0x4da4da[_0xcfae('0x33')]){_0x4da4da[_0xcfae('0x33')]=moment(_0x4da4da[_0xcfae('0x33')])[_0xcfae('0x3f')](0x1,_0xcfae('0x40'));}else{_0x4da4da[_0xcfae('0x33')]=moment(_0x4da4da['dateStart'])[_0xcfae('0x3f')](0x1,_0xcfae('0x40'));}_['merge'](_0x201026[_0xcfae('0x3d')],{'createdAt':{'$gte':_0x4da4da['dateStart'],'$lte':_0x4da4da['dateEnd']}});}if(_0xe104b[_0xcfae('0x31')][_0xcfae('0x41')]){_0x201026[_0xcfae('0x3d')]=_[_0xcfae('0x42')](_0x201026[_0xcfae('0x3d')],{'$or':_['map'](_0x201026['attributes'],function(_0x3fa9a3){var _0x3e1afd={};_0x3e1afd[_0x3fa9a3]={'$like':'%'+_0xe104b[_0xcfae('0x31')]['filter']+'%'};return _0x3e1afd;})});}_0x201026=_[_0xcfae('0x42')]({},_0x201026,_0xe104b[_0xcfae('0x43')]);var _0x254157={'where':_0x201026[_0xcfae('0x3d')]};return db[_0xcfae('0x44')][_0xcfae('0x24')](_0x254157)['then'](function(_0x4151d4){_0x988a54['count']=_0x4151d4;if(_0xe104b['query'][_0xcfae('0x45')]){_0x201026['include']=[{'all':!![]}];}return db['MailMessage'][_0xcfae('0x46')](_0x201026);})[_0xcfae('0x16')](function(_0x3afeea){_0x988a54[_0xcfae('0x47')]=_0x3afeea;return _0x988a54;})[_0xcfae('0x16')](respondWithFilteredResult(_0x1f982a,_0x201026))[_0xcfae('0x1f')](handleError(_0x1f982a,null));};exports['show']=function(_0x1a63ce,_0x35ffa3){var _0xf1a1a0={'raw':!![],'where':{'id':_0x1a63ce[_0xcfae('0x48')]['id']}},_0x174bcc={};_0x174bcc[_0xcfae('0x37')]=_[_0xcfae('0x49')](db[_0xcfae('0x44')]['rawAttributes']);_0x174bcc[_0xcfae('0x31')]=_[_0xcfae('0x49')](_0x1a63ce[_0xcfae('0x31')]);_0x174bcc[_0xcfae('0x34')]=_['intersection'](_0x174bcc[_0xcfae('0x37')],_0x174bcc[_0xcfae('0x31')]);_0xf1a1a0[_0xcfae('0x36')]=_['intersection'](_0x174bcc['model'],qs[_0xcfae('0x38')](_0x1a63ce[_0xcfae('0x31')][_0xcfae('0x38')]));_0xf1a1a0[_0xcfae('0x36')]=_0xf1a1a0[_0xcfae('0x36')][_0xcfae('0x39')]?_0xf1a1a0[_0xcfae('0x36')]:_0x174bcc[_0xcfae('0x37')];if(_0x1a63ce[_0xcfae('0x31')][_0xcfae('0x45')]){_0xf1a1a0[_0xcfae('0x4a')]=[{'all':!![]}];}_0xf1a1a0=_[_0xcfae('0x42')]({},_0xf1a1a0,_0x1a63ce[_0xcfae('0x43')]);return db[_0xcfae('0x44')][_0xcfae('0x4b')](_0xf1a1a0)[_0xcfae('0x16')](handleEntityNotFound(_0x35ffa3,null))[_0xcfae('0x16')](respondWithResult(_0x35ffa3,null))['catch'](handleError(_0x35ffa3,null));};exports[_0xcfae('0x2c')]=function(_0x299121,_0x2d62bb){if(_0x299121[_0xcfae('0x4c')]['id']){delete _0x299121['body']['id'];}return db[_0xcfae('0x44')][_0xcfae('0x4b')]({'where':{'id':_0x299121[_0xcfae('0x48')]['id']}})[_0xcfae('0x16')](handleEntityNotFound(_0x2d62bb,null))[_0xcfae('0x16')](saveUpdates(_0x299121['body'],null))[_0xcfae('0x16')](respondWithResult(_0x2d62bb,null))[_0xcfae('0x1f')](handleError(_0x2d62bb,null));};exports[_0xcfae('0x2d')]=function(_0x58e4b1,_0xca88af){return db[_0xcfae('0x44')][_0xcfae('0x4b')]({'where':{'id':_0x58e4b1['params']['id']}})[_0xcfae('0x16')](handleEntityNotFound(_0xca88af,null))[_0xcfae('0x16')](removeEntity(_0xca88af,null))[_0xcfae('0x1f')](handleError(_0xca88af,null));};exports['describe']=function(_0x664ea0,_0x2493b5){return db[_0xcfae('0x44')][_0xcfae('0x4d')]()['then'](respondWithResult(_0x2493b5,null))['catch'](handleError(_0x2493b5,null));};exports['create']=function(_0x280be0,_0x10699b){return db['MailMessage']['create'](_0x280be0[_0xcfae('0x4c')])[_0xcfae('0x16')](function(_0x42b911){if(_0x42b911){if(_0x42b911[_0xcfae('0x4e')]===_0xcfae('0x4f')&&!_0x42b911[_0xcfae('0x50')]){return db[_0xcfae('0x51')][_0xcfae('0x52')]({'where':{'id':_0x42b911[_0xcfae('0x53')]},'include':[{'model':db['MailServerOut'],'as':_0xcfae('0x54'),'raw':!![]}]})[_0xcfae('0x16')](function(_0x3bf441){if(_0x3bf441&&_0x3bf441[_0xcfae('0x54')]){var _0x2d400d={'tls':{'rejectUnauthorized':![]}};if(_[_0xcfae('0x55')](_0x3bf441[_0xcfae('0x54')][_0xcfae('0x56')])){_0x2d400d[_0xcfae('0x57')]=_0x3bf441[_0xcfae('0x54')]['host'];_0x2d400d[_0xcfae('0x58')]=_0x3bf441[_0xcfae('0x54')]['port'];_0x2d400d[_0xcfae('0x59')]=_0x3bf441[_0xcfae('0x54')]['secure'];if(_0x3bf441[_0xcfae('0x54')][_0xcfae('0x5a')]){_0x2d400d[_0xcfae('0x5b')]={'user':_0x3bf441[_0xcfae('0x54')][_0xcfae('0x5c')],'pass':_0x3bf441[_0xcfae('0x54')][_0xcfae('0x5d')]};}}else{_0x2d400d[_0xcfae('0x56')]=_0x3bf441[_0xcfae('0x54')][_0xcfae('0x56')];_0x2d400d[_0xcfae('0x5b')]={'user':_0x3bf441[_0xcfae('0x54')][_0xcfae('0x5c')],'pass':_0x3bf441[_0xcfae('0x54')][_0xcfae('0x5d')]};_0x2d400d[_0xcfae('0x59')]=_0x3bf441[_0xcfae('0x54')]['secure'];}if(_0x280be0['body'][_0xcfae('0x5e')]&&_0x280be0[_0xcfae('0x4c')][_0xcfae('0x5e')][_0xcfae('0x39')]){for(var _0x26eee1=0x0;_0x26eee1<_0x280be0[_0xcfae('0x4c')]['attachments']['length'];_0x26eee1+=0x1){_0x280be0[_0xcfae('0x4c')][_0xcfae('0x5e')][_0x26eee1]={'filename':_0x280be0[_0xcfae('0x4c')]['attachments'][_0x26eee1]['name'],'path':path[_0xcfae('0x5f')](config[_0xcfae('0x60')],_0xcfae('0x61'),_0x280be0[_0xcfae('0x4c')][_0xcfae('0x5e')][_0x26eee1][_0xcfae('0x62')])};}}return{'account':_0x2d400d,'message':_0x280be0['body']};}})['then'](function(_0x5d2301){if(_0x5d2301){return respondWithRpcPromise('SendMail',_0xcfae('0x63'),_0x5d2301,client9003)[_0xcfae('0x16')](function(_0x1bcc92){return _0x42b911['update']({'read':!![],'messageId':_0x1bcc92[_0xcfae('0x64')],'sentAt':moment()[_0xcfae('0x65')](_0xcfae('0x66'))});})[_0xcfae('0x1f')](function(_0x19374c){logger[_0xcfae('0x1c')]('%s',JSON['stringify'](_0x19374c));return _0x42b911;});}return _0x42b911;});}return _0x42b911;}})[_0xcfae('0x16')](respondWithResult(_0x10699b,0xc9))[_0xcfae('0x1f')](handleError(_0x10699b,null));};var interaction_log=require(_0xcfae('0x67'))(_0xcfae('0x68'));exports[_0xcfae('0x69')]=function(_0x3f9f64,_0x24237f,_0x57e1eb){var _0x5109b6={'channel':'mail'};if(_0x3f9f64[_0xcfae('0x4c')]['id']){delete _0x3f9f64[_0xcfae('0x4c')]['id'];}_0x3f9f64[_0xcfae('0x4c')][_0xcfae('0x6a')]=!![];_0x3f9f64[_0xcfae('0x4c')]['readAt']=moment()[_0xcfae('0x65')](_0xcfae('0x66'));_0x3f9f64[_0xcfae('0x4c')][_0xcfae('0x6b')]=_0x3f9f64[_0xcfae('0x4c')][_0xcfae('0x6b')]||_0x3f9f64[_0xcfae('0x5c')]['id'];return db[_0xcfae('0x44')][_0xcfae('0x4b')]({'where':{'id':_0x3f9f64[_0xcfae('0x48')]['id'],'UserId':null},'include':[{'model':db[_0xcfae('0x6c')],'as':_0xcfae('0x6d')}]})['then'](handleEntityNotFound(_0x24237f,null))['then'](saveUpdates(_0x3f9f64['body'],null))[_0xcfae('0x16')](function(_0x52f2d4){if(_0x52f2d4){_0x5109b6[_0xcfae('0x1d')]=_0x52f2d4[_0xcfae('0x6e')]({'plain':!![]});return db['MailInteraction'][_0xcfae('0x4b')]({'where':{'id':_0x52f2d4['MailInteractionId']}});}return null;})[_0xcfae('0x16')](handleEntityNotFound(_0x24237f,null))[_0xcfae('0x16')](function(_0x160d08){if(_0x160d08){return _0x160d08['update']({'UserId':_0x3f9f64['body'][_0xcfae('0x6b')],'read1stAt':_[_0xcfae('0x55')](_0x160d08['read1stAt'])?moment()['format'](_0xcfae('0x66')):undefined});}return null;})[_0xcfae('0x16')](function(_0x2b5e58){if(_0x2b5e58){_0x5109b6[_0xcfae('0x6f')]=_0x2b5e58[_0xcfae('0x6e')]({'plain':!![]});interaction_log[_0xcfae('0x17')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f9f64[_0xcfae('0x5c')]['id'],_0x3f9f64[_0xcfae('0x5c')][_0xcfae('0x2f')],_0x3f9f64[_0xcfae('0x5c')][_0xcfae('0x70')],_0x5109b6[_0xcfae('0x6f')]['id'],_0x3f9f64[_0xcfae('0x4c')]?JSON[_0xcfae('0x1b')](_0x3f9f64[_0xcfae('0x4c')]):_0xcfae('0x71'));return respondWithRpcPromise(_0xcfae('0x72'),_0xcfae('0x73'),_0x5109b6);}return null;})['then'](function(_0x23e4ea){if(_0x23e4ea){if(_0x3f9f64[_0xcfae('0x4c')][_0xcfae('0x74')]){_0x5109b6[_0xcfae('0x1d')][_0xcfae('0x75')]=util[_0xcfae('0x65')](_0xcfae('0x76'),_0x3f9f64['user'][_0xcfae('0x2f')]);_0x5109b6[_0xcfae('0x1d')]['channel']=_0x5109b6[_0xcfae('0x77')];_0x5109b6[_0xcfae('0x1d')][_0xcfae('0x78')]=_0xcfae('0x69');return respondWithRpcPromise(_0xcfae('0x79'),_0xcfae('0x79'),{'event':_0xcfae('0x7a'),'message':_0x5109b6[_0xcfae('0x1d')]},client9002)[_0xcfae('0x16')](function(){return _0x5109b6;});}return _0x5109b6;}return null;})[_0xcfae('0x16')](respondWithResult(_0x24237f,null))['catch'](handleError(_0x24237f,null));};var interaction_log=require(_0xcfae('0x67'))(_0xcfae('0x68'));exports[_0xcfae('0x2a')]=function(_0xa8d984,_0x9608a1,_0x5c0bb6){var _0x58f562={'agent':{},'channel':'mail'};if(_0xa8d984[_0xcfae('0x4c')]['id']){delete _0xa8d984[_0xcfae('0x4c')]['id'];}_0xa8d984['body'][_0xcfae('0x6b')]=_0xa8d984[_0xcfae('0x4c')][_0xcfae('0x6b')]||_0xa8d984[_0xcfae('0x5c')]['id'];_0x58f562[_0xcfae('0x7b')]['id']=_0xa8d984[_0xcfae('0x4c')][_0xcfae('0x6b')];return db[_0xcfae('0x44')][_0xcfae('0x4b')]({'where':{'id':_0xa8d984['params']['id'],'UserId':null}})[_0xcfae('0x16')](handleEntityNotFound(_0x9608a1,null))[_0xcfae('0x16')](function(_0x2d811e){if(_0x2d811e){_0x58f562[_0xcfae('0x1d')]=_0x2d811e[_0xcfae('0x6e')]({'plain':!![]});return db[_0xcfae('0x7c')]['find']({'where':{'id':_0x2d811e[_0xcfae('0x7d')]}});}return null;})[_0xcfae('0x16')](handleEntityNotFound(_0x9608a1,null))[_0xcfae('0x16')](function(_0x3d0bb4){if(_0x3d0bb4){_0x58f562[_0xcfae('0x6f')]=_0x3d0bb4[_0xcfae('0x6e')]({'plain':!![]});interaction_log['info'](_0xcfae('0x7e'),_0xa8d984[_0xcfae('0x5c')]['id'],_0xa8d984[_0xcfae('0x5c')]['name'],_0xa8d984['user']['role'],_0x58f562[_0xcfae('0x6f')]['id'],_0xa8d984[_0xcfae('0x4c')]?JSON[_0xcfae('0x1b')](_0xa8d984[_0xcfae('0x4c')]):'null');return respondWithRpcPromise(_0xcfae('0x7f'),_0xcfae('0x80'),_0x58f562);}return null;})[_0xcfae('0x16')](function(_0x47a776){if(_0x47a776){_0x47a776[_0xcfae('0x1d')]['interface']=util[_0xcfae('0x65')](_0xcfae('0x76'),_0xa8d984[_0xcfae('0x5c')]['name']);_0x47a776['message'][_0xcfae('0x77')]=_0x58f562[_0xcfae('0x77')];_0x47a776['message'][_0xcfae('0x78')]='reject';respondWithRpcPromise('EventManager',_0xcfae('0x79'),{'event':_0xcfae('0x81'),'message':_0x47a776[_0xcfae('0x1d')]},client9002);return _0x58f562;}return null;})[_0xcfae('0x16')](respondWithResult(_0x9608a1,null))[_0xcfae('0x1f')](handleError(_0x9608a1,null));}; \ No newline at end of file +var _0x4b8a=['fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','includeAll','rows','show','params','include','options','find','body','describe','create','direction','out','secret','MailAccount','findOne','MailAccountId','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','UserId','CmContact','Contact','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','agent','role','RejectMessage','rejectMessage','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','end','stack','name','send','index','MailMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes'];(function(_0x3fa59c,_0x2302f9){var _0x239a2c=function(_0x410d0f){while(--_0x410d0f){_0x3fa59c['push'](_0x3fa59c['shift']());}};_0x239a2c(++_0x2302f9);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4b8a[_0x3bf83f];return _0x22c4a9;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xa4b8('0x0'));var moment=require('moment');var BPromise=require(_0xa4b8('0x1'));var Mustache=require(_0xa4b8('0x2'));var util=require(_0xa4b8('0x3'));var path=require(_0xa4b8('0x4'));var sox=require(_0xa4b8('0x5'));var csv=require(_0xa4b8('0x6'));var ejs=require(_0xa4b8('0x7'));var fs=require('fs');var _=require(_0xa4b8('0x8'));var squel=require(_0xa4b8('0x9'));var crypto=require(_0xa4b8('0xa'));var jsforce=require(_0xa4b8('0xb'));var deskjs=require(_0xa4b8('0xc'));var toCsv=require(_0xa4b8('0x6'));var querystring=require(_0xa4b8('0xd'));var Papa=require('papaparse');var qs=require(_0xa4b8('0xe'));var logger=require(_0xa4b8('0xf'))(_0xa4b8('0x10'));var utils=require(_0xa4b8('0x11'));var config=require(_0xa4b8('0x12'));var db=require(_0xa4b8('0x13'))['db'];var socket=require(_0xa4b8('0x14'))({'host':_0xa4b8('0x15'),'port':0x18eb});require(_0xa4b8('0x16'))[_0xa4b8('0x17')](socket);var jayson=require(_0xa4b8('0x18'));var client=jayson[_0xa4b8('0x19')][_0xa4b8('0x1a')]({'port':0x232c});var client9003=jayson[_0xa4b8('0x19')]['http']({'port':0x232b});var client9002=jayson['client'][_0xa4b8('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x488b99,_0x1da512,_0x43481b,_0x5ab232){return new BPromise(function(_0x2f3199,_0x157d7f){var _0x1c8369=_0x5ab232||client;return _0x1c8369[_0xa4b8('0x1b')](_0x488b99,_0x43481b)[_0xa4b8('0x1c')](function(_0x3bba1b){logger[_0xa4b8('0x1d')](_0xa4b8('0x1e'),_0x1da512,_0xa4b8('0x1f'));logger['debug'](_0xa4b8('0x20'),_0x1da512,_0xa4b8('0x1f'),JSON['stringify'](_0x3bba1b));if(_0x3bba1b[_0xa4b8('0x21')]){if(_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x22')]===0x1f4){logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x3bba1b['error']['message']);return _0x157d7f(_0x3bba1b['error']['message']);}logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x23')]);return _0x2f3199(_0x3bba1b[_0xa4b8('0x21')][_0xa4b8('0x23')]);}else{logger[_0xa4b8('0x1d')](_0xa4b8('0x1e'),_0x1da512,_0xa4b8('0x1f'));_0x2f3199(_0x3bba1b[_0xa4b8('0x24')][_0xa4b8('0x23')]);}})[_0xa4b8('0x25')](function(_0x144e62){logger[_0xa4b8('0x21')](_0xa4b8('0x1e'),_0x1da512,_0x144e62);_0x157d7f(_0x144e62);});});}function respondWithStatusCode(_0xeb5ae1,_0x34f5d2){_0x34f5d2=_0x34f5d2||0xcc;return function(_0x4b28ae){if(_0x4b28ae){return _0xeb5ae1[_0xa4b8('0x26')](_0x34f5d2);}return _0xeb5ae1[_0xa4b8('0x27')](_0x34f5d2)['end']();};}function respondWithResult(_0xf5638b,_0x1f66a7){_0x1f66a7=_0x1f66a7||0xc8;return function(_0x5b0257){if(_0x5b0257){return _0xf5638b['status'](_0x1f66a7)['json'](_0x5b0257);}};}function respondWithFilteredResult(_0xc17660,_0x2adaa0){return function(_0x239b62){if(_0x239b62){var _0xa11b76=_0x239b62[_0xa4b8('0x28')],_0x5242ec=_0x2adaa0[_0xa4b8('0x29')],_0x3ff3de=_0x2adaa0['offset']+_0x2adaa0[_0xa4b8('0x2a')],_0x1508fe;if(_0x3ff3de>=_0xa11b76){_0x3ff3de=_0xa11b76;_0x1508fe=0xc8;}else{_0x1508fe=0xce;}_0xc17660[_0xa4b8('0x27')](_0x1508fe);return _0xc17660[_0xa4b8('0x2b')](_0xa4b8('0x2c'),_0x5242ec+'-'+_0x3ff3de+'/'+_0xa11b76)[_0xa4b8('0x2d')](_0x239b62);}return null;};}function patchUpdates(_0x3a6652){return function(_0x3d60ff){try{jsonpatch[_0xa4b8('0x2e')](_0x3d60ff,_0x3a6652,!![]);}catch(_0x2005c1){return BPromise[_0xa4b8('0x2f')](_0x2005c1);}return _0x3d60ff[_0xa4b8('0x30')]();};}function saveUpdates(_0x127d1d,_0x513aa8){return function(_0x218f56){if(_0x218f56){return _0x218f56[_0xa4b8('0x31')](_0x127d1d)[_0xa4b8('0x1c')](function(_0x574b6c){return _0x574b6c;});}return null;};}function removeEntity(_0x3b87b0,_0x4485af){return function(_0x50729e){if(_0x50729e){return _0x50729e['destroy']()['then'](function(){_0x3b87b0['status'](0xcc)[_0xa4b8('0x32')]();});}};}function handleEntityNotFound(_0x555c5c,_0x6ef72a){return function(_0x34f9a5){if(!_0x34f9a5){_0x555c5c[_0xa4b8('0x26')](0x194);}return _0x34f9a5;};}function handleError(_0x5abb24,_0x463797){_0x463797=_0x463797||0x1f4;return function(_0x2e9c41){logger[_0xa4b8('0x21')](_0x2e9c41[_0xa4b8('0x33')]);if(_0x2e9c41[_0xa4b8('0x34')]){delete _0x2e9c41['name'];}_0x5abb24[_0xa4b8('0x27')](_0x463797)[_0xa4b8('0x35')](_0x2e9c41);};}exports[_0xa4b8('0x36')]=function(_0xa590e,_0x32fc2a){var _0x2c11bc={},_0x3d773d={},_0x4f923c={'count':0x0,'rows':[]};var _0x395aea=db[_0xa4b8('0x37')][_0xa4b8('0x38')];_0x3d773d[_0xa4b8('0x39')]=_[_0xa4b8('0x3a')](_0x395aea);var _0x4c236c={'dateStart':_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3c')],'dateEnd':_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3d')]};delete _0xa590e['query']['dateStart'];delete _0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x3d')];_0x3d773d[_0xa4b8('0x3b')]=_[_0xa4b8('0x3a')](_0xa590e[_0xa4b8('0x3b')]);_0x3d773d[_0xa4b8('0x3e')]=_[_0xa4b8('0x3f')](_0x3d773d[_0xa4b8('0x39')],_0x3d773d[_0xa4b8('0x3b')]);_0x2c11bc[_0xa4b8('0x40')]=_[_0xa4b8('0x3f')](_0x3d773d[_0xa4b8('0x39')],qs[_0xa4b8('0x41')](_0xa590e[_0xa4b8('0x3b')]['fields']));_0x2c11bc[_0xa4b8('0x40')]=_0x2c11bc['attributes'][_0xa4b8('0x42')]?_0x2c11bc[_0xa4b8('0x40')]:_0x3d773d['model'];if(!_0xa590e['query'][_0xa4b8('0x43')](_0xa4b8('0x44'))){_0x2c11bc[_0xa4b8('0x2a')]=qs[_0xa4b8('0x2a')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x2a')]);_0x2c11bc['offset']=qs[_0xa4b8('0x29')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x29')]);}_0x2c11bc['order']=qs[_0xa4b8('0x45')](_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x45')]);_0x2c11bc[_0xa4b8('0x46')]=qs[_0xa4b8('0x3e')](_[_0xa4b8('0x47')](_0xa590e[_0xa4b8('0x3b')],_0x3d773d[_0xa4b8('0x3e')]));if(_0x4c236c[_0xa4b8('0x3c')]){if(_0x4c236c['dateEnd']){_0x4c236c[_0xa4b8('0x3d')]=moment(_0x4c236c[_0xa4b8('0x3d')])[_0xa4b8('0x48')](0x1,_0xa4b8('0x49'));}else{_0x4c236c[_0xa4b8('0x3d')]=moment(_0x4c236c[_0xa4b8('0x3c')])[_0xa4b8('0x48')](0x1,'day');}_[_0xa4b8('0x4a')](_0x2c11bc['where'],{'createdAt':{'$gte':_0x4c236c[_0xa4b8('0x3c')],'$lte':_0x4c236c[_0xa4b8('0x3d')]}});}if(_0xa590e['query'][_0xa4b8('0x4b')]){_0x2c11bc['where']=_[_0xa4b8('0x4a')](_0x2c11bc[_0xa4b8('0x46')],{'$or':_[_0xa4b8('0x4c')](_0x2c11bc[_0xa4b8('0x40')],function(_0x1c3a2f){var _0x162854={};_0x162854[_0x1c3a2f]={'$like':'%'+_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x4b')]+'%'};return _0x162854;})});}_0x2c11bc=_[_0xa4b8('0x4a')]({},_0x2c11bc,_0xa590e['options']);var _0xae0c15={'where':_0x2c11bc['where']};return db[_0xa4b8('0x37')][_0xa4b8('0x28')](_0xae0c15)[_0xa4b8('0x1c')](function(_0x551638){_0x4f923c['count']=_0x551638;if(_0xa590e[_0xa4b8('0x3b')][_0xa4b8('0x4d')]){_0x2c11bc['include']=[{'all':!![]}];}return db[_0xa4b8('0x37')]['findAll'](_0x2c11bc);})[_0xa4b8('0x1c')](function(_0x6b9b99){_0x4f923c[_0xa4b8('0x4e')]=_0x6b9b99;return _0x4f923c;})['then'](respondWithFilteredResult(_0x32fc2a,_0x2c11bc))[_0xa4b8('0x25')](handleError(_0x32fc2a,null));};exports[_0xa4b8('0x4f')]=function(_0x396db2,_0x57f8ab){var _0x57d027={'raw':!![],'where':{'id':_0x396db2[_0xa4b8('0x50')]['id']}},_0x36a0d2={};_0x36a0d2[_0xa4b8('0x39')]=_[_0xa4b8('0x3a')](db[_0xa4b8('0x37')]['rawAttributes']);_0x36a0d2[_0xa4b8('0x3b')]=_['keys'](_0x396db2[_0xa4b8('0x3b')]);_0x36a0d2[_0xa4b8('0x3e')]=_[_0xa4b8('0x3f')](_0x36a0d2['model'],_0x36a0d2[_0xa4b8('0x3b')]);_0x57d027[_0xa4b8('0x40')]=_[_0xa4b8('0x3f')](_0x36a0d2[_0xa4b8('0x39')],qs[_0xa4b8('0x41')](_0x396db2[_0xa4b8('0x3b')][_0xa4b8('0x41')]));_0x57d027[_0xa4b8('0x40')]=_0x57d027[_0xa4b8('0x40')][_0xa4b8('0x42')]?_0x57d027[_0xa4b8('0x40')]:_0x36a0d2['model'];if(_0x396db2[_0xa4b8('0x3b')][_0xa4b8('0x4d')]){_0x57d027[_0xa4b8('0x51')]=[{'all':!![]}];}_0x57d027=_[_0xa4b8('0x4a')]({},_0x57d027,_0x396db2[_0xa4b8('0x52')]);return db[_0xa4b8('0x37')][_0xa4b8('0x53')](_0x57d027)['then'](handleEntityNotFound(_0x57f8ab,null))['then'](respondWithResult(_0x57f8ab,null))[_0xa4b8('0x25')](handleError(_0x57f8ab,null));};exports[_0xa4b8('0x31')]=function(_0x532741,_0x559403){if(_0x532741['body']['id']){delete _0x532741['body']['id'];}return db['MailMessage'][_0xa4b8('0x53')]({'where':{'id':_0x532741[_0xa4b8('0x50')]['id']}})[_0xa4b8('0x1c')](handleEntityNotFound(_0x559403,null))[_0xa4b8('0x1c')](saveUpdates(_0x532741[_0xa4b8('0x54')],null))[_0xa4b8('0x1c')](respondWithResult(_0x559403,null))['catch'](handleError(_0x559403,null));};exports['destroy']=function(_0x503cdc,_0x52f331){return db[_0xa4b8('0x37')][_0xa4b8('0x53')]({'where':{'id':_0x503cdc[_0xa4b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x52f331,null))[_0xa4b8('0x1c')](removeEntity(_0x52f331,null))['catch'](handleError(_0x52f331,null));};exports[_0xa4b8('0x55')]=function(_0x53164c,_0x560a40){return db['MailMessage'][_0xa4b8('0x55')]()['then'](respondWithResult(_0x560a40,null))[_0xa4b8('0x25')](handleError(_0x560a40,null));};exports[_0xa4b8('0x56')]=function(_0x25ddb1,_0x4fb182){return db[_0xa4b8('0x37')][_0xa4b8('0x56')](_0x25ddb1[_0xa4b8('0x54')])[_0xa4b8('0x1c')](function(_0x2dd93e){if(_0x2dd93e){if(_0x2dd93e[_0xa4b8('0x57')]===_0xa4b8('0x58')&&!_0x2dd93e[_0xa4b8('0x59')]){return db[_0xa4b8('0x5a')][_0xa4b8('0x5b')]({'where':{'id':_0x2dd93e[_0xa4b8('0x5c')]},'include':[{'model':db[_0xa4b8('0x5d')],'as':_0xa4b8('0x5e'),'raw':!![]}]})[_0xa4b8('0x1c')](function(_0x24eca8){if(_0x24eca8&&_0x24eca8[_0xa4b8('0x5e')]){var _0x157850={'tls':{'rejectUnauthorized':![]}};if(_[_0xa4b8('0x5f')](_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x60')])){_0x157850[_0xa4b8('0x61')]=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x61')];_0x157850['port']=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x62')];_0x157850['secure']=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x63')];if(_0x24eca8['Smtp'][_0xa4b8('0x64')]){_0x157850[_0xa4b8('0x65')]={'user':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x66')],'pass':_0x24eca8['Smtp'][_0xa4b8('0x67')]};}}else{_0x157850['service']=_0x24eca8['Smtp']['service'];_0x157850['auth']={'user':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x66')],'pass':_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x67')]};_0x157850[_0xa4b8('0x63')]=_0x24eca8[_0xa4b8('0x5e')][_0xa4b8('0x63')];}if(_0x25ddb1['body'][_0xa4b8('0x68')]&&_0x25ddb1[_0xa4b8('0x54')][_0xa4b8('0x68')][_0xa4b8('0x42')]){for(var _0x3962e6=0x0;_0x3962e6<_0x25ddb1['body'][_0xa4b8('0x68')][_0xa4b8('0x42')];_0x3962e6+=0x1){_0x25ddb1[_0xa4b8('0x54')][_0xa4b8('0x68')][_0x3962e6]={'filename':_0x25ddb1['body']['attachments'][_0x3962e6][_0xa4b8('0x34')],'path':path[_0xa4b8('0x69')](config[_0xa4b8('0x6a')],_0xa4b8('0x6b'),_0x25ddb1['body'][_0xa4b8('0x68')][_0x3962e6][_0xa4b8('0x6c')])};}}return{'account':_0x157850,'message':_0x25ddb1[_0xa4b8('0x54')]};}})[_0xa4b8('0x1c')](function(_0x50c735){if(_0x50c735){return respondWithRpcPromise(_0xa4b8('0x6d'),'sendMail',_0x50c735,client9003)[_0xa4b8('0x1c')](function(_0x44835f){return _0x2dd93e['update']({'read':!![],'messageId':_0x44835f[_0xa4b8('0x6e')],'sentAt':moment()[_0xa4b8('0x6f')](_0xa4b8('0x70'))});})['catch'](function(_0x1a6031){logger['error']('%s',JSON['stringify'](_0x1a6031));return _0x2dd93e;});}return _0x2dd93e;});}return _0x2dd93e;}})[_0xa4b8('0x1c')](respondWithResult(_0x4fb182,0xc9))[_0xa4b8('0x25')](handleError(_0x4fb182,null));};var interaction_log=require('../../config/logger')('mail-interactions');exports[_0xa4b8('0x71')]=function(_0x43481f,_0xe07b02,_0x16064d){var _0x3551f5={'channel':_0xa4b8('0x72')};if(_0x43481f[_0xa4b8('0x54')]['id']){delete _0x43481f[_0xa4b8('0x54')]['id'];}_0x43481f['body'][_0xa4b8('0x73')]=!![];_0x43481f[_0xa4b8('0x54')]['readAt']=moment()[_0xa4b8('0x6f')]('YYYY-MM-DD\x20HH:mm:ss');_0x43481f[_0xa4b8('0x54')]['UserId']=_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x74')]||_0x43481f[_0xa4b8('0x66')]['id'];return db['MailMessage'][_0xa4b8('0x53')]({'where':{'id':_0x43481f[_0xa4b8('0x50')]['id'],'UserId':null},'include':[{'model':db[_0xa4b8('0x75')],'as':_0xa4b8('0x76')}]})[_0xa4b8('0x1c')](handleEntityNotFound(_0xe07b02,null))['then'](saveUpdates(_0x43481f[_0xa4b8('0x54')],null))[_0xa4b8('0x1c')](function(_0x17b60c){if(_0x17b60c){_0x3551f5[_0xa4b8('0x23')]=_0x17b60c[_0xa4b8('0x77')]({'plain':!![]});return db[_0xa4b8('0x78')][_0xa4b8('0x53')]({'where':{'id':_0x17b60c['MailInteractionId']}});}return null;})[_0xa4b8('0x1c')](handleEntityNotFound(_0xe07b02,null))['then'](function(_0x22d0e3){if(_0x22d0e3){return _0x22d0e3[_0xa4b8('0x31')]({'UserId':_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x74')],'read1stAt':_['isNil'](_0x22d0e3[_0xa4b8('0x79')])?moment()[_0xa4b8('0x6f')](_0xa4b8('0x70')):undefined});}return null;})[_0xa4b8('0x1c')](function(_0x2c9cc2){if(_0x2c9cc2){_0x3551f5[_0xa4b8('0x7a')]=_0x2c9cc2[_0xa4b8('0x77')]({'plain':!![]});interaction_log[_0xa4b8('0x1d')](_0xa4b8('0x7b'),_0x43481f[_0xa4b8('0x66')]['id'],_0x43481f[_0xa4b8('0x66')][_0xa4b8('0x34')],_0x43481f[_0xa4b8('0x66')]['role'],_0x3551f5[_0xa4b8('0x7a')]['id'],_0x43481f[_0xa4b8('0x54')]?JSON[_0xa4b8('0x7c')](_0x43481f[_0xa4b8('0x54')]):_0xa4b8('0x7d'));return respondWithRpcPromise('AcceptMessage',_0xa4b8('0x7e'),_0x3551f5);}return null;})['then'](function(_0xc3778d){if(_0xc3778d){if(_0x43481f[_0xa4b8('0x54')][_0xa4b8('0x7f')]){_0x3551f5[_0xa4b8('0x23')]['interface']=util[_0xa4b8('0x6f')](_0xa4b8('0x80'),_0x43481f['user']['name']);_0x3551f5['message'][_0xa4b8('0x81')]=_0x3551f5[_0xa4b8('0x81')];_0x3551f5[_0xa4b8('0x23')][_0xa4b8('0x82')]=_0xa4b8('0x71');return respondWithRpcPromise('EventManager',_0xa4b8('0x83'),{'event':_0xa4b8('0x84'),'message':_0x3551f5['message']},client9002)[_0xa4b8('0x1c')](function(){return _0x3551f5;});}return _0x3551f5;}return null;})[_0xa4b8('0x1c')](respondWithResult(_0xe07b02,null))['catch'](handleError(_0xe07b02,null));};var interaction_log=require(_0xa4b8('0xf'))(_0xa4b8('0x85'));exports[_0xa4b8('0x2f')]=function(_0x18a536,_0x592b63,_0x388322){var _0x14067c={'agent':{},'channel':_0xa4b8('0x72')};if(_0x18a536[_0xa4b8('0x54')]['id']){delete _0x18a536[_0xa4b8('0x54')]['id'];}_0x18a536[_0xa4b8('0x54')]['UserId']=_0x18a536[_0xa4b8('0x54')][_0xa4b8('0x74')]||_0x18a536[_0xa4b8('0x66')]['id'];_0x14067c[_0xa4b8('0x86')]['id']=_0x18a536[_0xa4b8('0x54')][_0xa4b8('0x74')];return db[_0xa4b8('0x37')][_0xa4b8('0x53')]({'where':{'id':_0x18a536[_0xa4b8('0x50')]['id'],'UserId':null}})[_0xa4b8('0x1c')](handleEntityNotFound(_0x592b63,null))[_0xa4b8('0x1c')](function(_0x1e1328){if(_0x1e1328){_0x14067c[_0xa4b8('0x23')]=_0x1e1328[_0xa4b8('0x77')]({'plain':!![]});return db['MailInteraction'][_0xa4b8('0x53')]({'where':{'id':_0x1e1328['MailInteractionId']}});}return null;})[_0xa4b8('0x1c')](handleEntityNotFound(_0x592b63,null))[_0xa4b8('0x1c')](function(_0x11c2bd){if(_0x11c2bd){_0x14067c[_0xa4b8('0x7a')]=_0x11c2bd[_0xa4b8('0x77')]({'plain':!![]});interaction_log[_0xa4b8('0x1d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x18a536[_0xa4b8('0x66')]['id'],_0x18a536[_0xa4b8('0x66')][_0xa4b8('0x34')],_0x18a536[_0xa4b8('0x66')][_0xa4b8('0x87')],_0x14067c[_0xa4b8('0x7a')]['id'],_0x18a536[_0xa4b8('0x54')]?JSON[_0xa4b8('0x7c')](_0x18a536[_0xa4b8('0x54')]):_0xa4b8('0x7d'));return respondWithRpcPromise(_0xa4b8('0x88'),_0xa4b8('0x89'),_0x14067c);}return null;})[_0xa4b8('0x1c')](function(_0x194198){if(_0x194198){_0x194198[_0xa4b8('0x23')]['interface']=util['format'](_0xa4b8('0x80'),_0x18a536['user'][_0xa4b8('0x34')]);_0x194198[_0xa4b8('0x23')][_0xa4b8('0x81')]=_0x14067c[_0xa4b8('0x81')];_0x194198['message'][_0xa4b8('0x82')]='reject';respondWithRpcPromise(_0xa4b8('0x83'),'EventManager',{'event':'rejectmessage','message':_0x194198[_0xa4b8('0x23')]},client9002);return _0x14067c;}return null;})['then'](respondWithResult(_0x592b63,null))[_0xa4b8('0x25')](handleError(_0x592b63,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 636ef8e..5e8da00 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 _0x746f=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x22d50a,_0x45a4f5){var _0x2bc774=function(_0x44a079){while(--_0x44a079){_0x22d50a['push'](_0x22d50a['shift']());}};_0x2bc774(++_0x45a4f5);}(_0x746f,0x9c));var _0xf746=function(_0x171722,_0x3a682c){_0x171722=_0x171722-0x0;var _0x2047a2=_0x746f[_0x171722];return _0x2047a2;};'use strict';var EventEmitter=require(_0xf746('0x0'));var MailMessage=require(_0xf746('0x1'))['db'][_0xf746('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf746('0x3')](0x0);var events={'afterCreate':_0xf746('0x4'),'afterUpdate':_0xf746('0x5'),'afterDestroy':_0xf746('0x6')};function emitEvent(_0x1be178){return function(_0x357b8e,_0x150d39,_0x10974f){MailMessageEvents[_0xf746('0x7')](_0x1be178+':'+_0x357b8e['id'],_0x357b8e);MailMessageEvents[_0xf746('0x7')](_0x1be178,_0x357b8e);_0x10974f(null);};}for(var e in events){if(events[_0xf746('0x8')](e)){var event=events[e];MailMessage[_0xf746('0x9')](e,emitEvent(event));}}module[_0xf746('0xa')]=MailMessageEvents; \ No newline at end of file +var _0x23f4=['remove','emit','hook','exports','../../mysqldb','save','update'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x23f4,0x1ee));var _0x423f=function(_0x4e78a4,_0x531083){_0x4e78a4=_0x4e78a4-0x0;var _0x13f17c=_0x23f4[_0x4e78a4];return _0x13f17c;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0x423f('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x423f('0x1'),'afterUpdate':_0x423f('0x2'),'afterDestroy':_0x423f('0x3')};function emitEvent(_0x3503a0){return function(_0x1ab106,_0x129dba,_0x34bf9e){MailMessageEvents[_0x423f('0x4')](_0x3503a0+':'+_0x1ab106['id'],_0x1ab106);MailMessageEvents[_0x423f('0x4')](_0x3503a0,_0x1ab106);_0x34bf9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x423f('0x5')](e,emitEvent(event));}}module[_0x423f('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 95dd93b..db0796d 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 _0x4e6e=['mail_messages','messageId','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports'];(function(_0x58e504,_0x8ec848){var _0x31917f=function(_0xdbc479){while(--_0xdbc479){_0x58e504['push'](_0x58e504['shift']());}};_0x31917f(++_0x8ec848);}(_0x4e6e,0x70));var _0xe4e6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4e6e[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xe4e6('0x0'));var logger=require(_0xe4e6('0x1'))(_0xe4e6('0x2'));var moment=require(_0xe4e6('0x3'));var BPromise=require(_0xe4e6('0x4'));var rp=require(_0xe4e6('0x5'));var attributes=require(_0xe4e6('0x6'));module[_0xe4e6('0x7')]=function(_0x11cb6f,_0x12c81c){return _0x11cb6f['define']('MailMessage',attributes,{'tableName':_0xe4e6('0x8'),'paranoid':![],'indexes':[{'name':_0xe4e6('0x9'),'fields':[_0xe4e6('0x9')]}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1df7=['exports','define','MailMessage','messageId','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0x1df7,0x6e));var _0x71df=function(_0x442992,_0x35224c){_0x442992=_0x442992-0x0;var _0x47614c=_0x1df7[_0x442992];return _0x47614c;};'use strict';var _=require('lodash');var util=require(_0x71df('0x0'));var logger=require(_0x71df('0x1'))(_0x71df('0x2'));var moment=require(_0x71df('0x3'));var BPromise=require(_0x71df('0x4'));var rp=require(_0x71df('0x5'));var attributes=require(_0x71df('0x6'));module[_0x71df('0x7')]=function(_0x20c662,_0x2b8342){return _0x20c662[_0x71df('0x8')](_0x71df('0x9'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x71df('0xa'),'fields':['messageId']}],'timestamps':!![],'charset':_0x71df('0xb'),'collate':_0x71df('0xc')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 119d147..1190142 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 _0x3eda=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','localhost','./mailMessage.socket','request','then','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util'];(function(_0x20aadb,_0x5a607a){var _0x520018=function(_0x1d258a){while(--_0x1d258a){_0x20aadb['push'](_0x20aadb['shift']());}};_0x520018(++_0x5a607a);}(_0x3eda,0xbe));var _0xa3ed=function(_0xe0b53a,_0x18c800){_0xe0b53a=_0xe0b53a-0x0;var _0x3a974f=_0x3eda[_0xe0b53a];return _0x3a974f;};'use strict';var _=require(_0xa3ed('0x0'));var util=require(_0xa3ed('0x1'));var moment=require(_0xa3ed('0x2'));var BPromise=require(_0xa3ed('0x3'));var rs=require(_0xa3ed('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xa3ed('0x5'));var logger=require(_0xa3ed('0x6'))(_0xa3ed('0x7'));var config=require(_0xa3ed('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa3ed('0x9')][_0xa3ed('0xa')]({'port':0x232a});var socket=require(_0xa3ed('0xb'))({'host':_0xa3ed('0xc'),'port':0x18eb});require(_0xa3ed('0xd'))['register'](socket);function respondWithRpcPromise(_0x2466eb,_0x5b5b9c,_0x189cc5){return new BPromise(function(_0x40e08a,_0x31ba64){return client[_0xa3ed('0xe')](_0x2466eb,_0x189cc5)[_0xa3ed('0xf')](function(_0x4ca587){logger[_0xa3ed('0x10')](_0xa3ed('0x11'),_0x5b5b9c,'request\x20sent');logger[_0xa3ed('0x12')](_0xa3ed('0x13'),_0x5b5b9c,_0xa3ed('0x14'),JSON[_0xa3ed('0x15')](_0x4ca587));if(_0x4ca587[_0xa3ed('0x16')]){if(_0x4ca587[_0xa3ed('0x16')]['code']===0x1f4){logger[_0xa3ed('0x16')](_0xa3ed('0x11'),_0x5b5b9c,_0x4ca587[_0xa3ed('0x16')]['message']);return _0x31ba64(_0x4ca587[_0xa3ed('0x16')]['message']);}logger[_0xa3ed('0x16')](_0xa3ed('0x11'),_0x5b5b9c,_0x4ca587[_0xa3ed('0x16')][_0xa3ed('0x17')]);return _0x40e08a(_0x4ca587[_0xa3ed('0x16')][_0xa3ed('0x17')]);}else{logger['info'](_0xa3ed('0x11'),_0x5b5b9c,_0xa3ed('0x14'));_0x40e08a(_0x4ca587[_0xa3ed('0x18')]['message']);}})[_0xa3ed('0x19')](function(_0x5cfd20){logger['error'](_0xa3ed('0x11'),_0x5b5b9c,_0x5cfd20);_0x31ba64(_0x5cfd20);});});}exports[_0xa3ed('0x1a')]=function(_0x394b97){var _0x181fc4=this;return new Promise(function(_0x4cf98b,_0x55ed9e){return db[_0xa3ed('0x1b')][_0xa3ed('0x1c')](_0x394b97[_0xa3ed('0x1d')],{'raw':_0x394b97[_0xa3ed('0x1e')]?_0x394b97[_0xa3ed('0x1e')][_0xa3ed('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x1c42b5){logger[_0xa3ed('0x10')](_0xa3ed('0x1a'),_0x394b97);logger[_0xa3ed('0x12')](_0xa3ed('0x1a'),_0x394b97,JSON[_0xa3ed('0x15')](_0x1c42b5));_0x4cf98b(_0x1c42b5);})['catch'](function(_0x533f73){logger[_0xa3ed('0x16')](_0xa3ed('0x1a'),_0x533f73[_0xa3ed('0x17')],_0x394b97);_0x55ed9e(_0x181fc4['error'](0x1f4,_0x533f73[_0xa3ed('0x17')]));});});}; \ No newline at end of file +var _0xc3ae=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash'];(function(_0x29f1c1,_0x3220ed){var _0x5a8deb=function(_0x2ec6eb){while(--_0x2ec6eb){_0x29f1c1['push'](_0x29f1c1['shift']());}};_0x5a8deb(++_0x3220ed);}(_0xc3ae,0xbf));var _0xec3a=function(_0x5ec9df,_0x565096){_0x5ec9df=_0x5ec9df-0x0;var _0x25f4ae=_0xc3ae[_0x5ec9df];return _0x25f4ae;};'use strict';var _=require(_0xec3a('0x0'));var util=require(_0xec3a('0x1'));var moment=require(_0xec3a('0x2'));var BPromise=require(_0xec3a('0x3'));var rs=require(_0xec3a('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xec3a('0x5'));var logger=require(_0xec3a('0x6'))(_0xec3a('0x7'));var config=require(_0xec3a('0x8'));var jayson=require(_0xec3a('0x9'));var client=jayson['client'][_0xec3a('0xa')]({'port':0x232a});var socket=require(_0xec3a('0xb'))({'host':'localhost','port':0x18eb});require(_0xec3a('0xc'))[_0xec3a('0xd')](socket);function respondWithRpcPromise(_0x57777f,_0x56a25c,_0x34c1e9){return new BPromise(function(_0x506566,_0x40a5aa){return client[_0xec3a('0xe')](_0x57777f,_0x34c1e9)[_0xec3a('0xf')](function(_0x534841){logger[_0xec3a('0x10')](_0xec3a('0x11'),_0x56a25c,_0xec3a('0x12'));logger[_0xec3a('0x13')](_0xec3a('0x14'),_0x56a25c,'request\x20sent',JSON['stringify'](_0x534841));if(_0x534841[_0xec3a('0x15')]){if(_0x534841[_0xec3a('0x15')][_0xec3a('0x16')]===0x1f4){logger['error'](_0xec3a('0x11'),_0x56a25c,_0x534841['error'][_0xec3a('0x17')]);return _0x40a5aa(_0x534841[_0xec3a('0x15')][_0xec3a('0x17')]);}logger[_0xec3a('0x15')]('MailMessage,\x20%s,\x20%s',_0x56a25c,_0x534841[_0xec3a('0x15')][_0xec3a('0x17')]);return _0x506566(_0x534841[_0xec3a('0x15')]['message']);}else{logger[_0xec3a('0x10')](_0xec3a('0x11'),_0x56a25c,_0xec3a('0x12'));_0x506566(_0x534841[_0xec3a('0x18')][_0xec3a('0x17')]);}})[_0xec3a('0x19')](function(_0x20ec8c){logger[_0xec3a('0x15')](_0xec3a('0x11'),_0x56a25c,_0x20ec8c);_0x40a5aa(_0x20ec8c);});});}exports[_0xec3a('0x1a')]=function(_0x1f4b71){var _0x87e1eb=this;return new Promise(function(_0x3ed1c6,_0x40e7e0){return db[_0xec3a('0x1b')][_0xec3a('0x1c')](_0x1f4b71[_0xec3a('0x1d')],{'raw':_0x1f4b71[_0xec3a('0x1e')]?_0x1f4b71[_0xec3a('0x1e')][_0xec3a('0x1f')]===undefined?!![]:![]:!![]})[_0xec3a('0xf')](function(_0x255f2e){logger['info'](_0xec3a('0x1a'),_0x1f4b71);logger[_0xec3a('0x13')](_0xec3a('0x1a'),_0x1f4b71,JSON['stringify'](_0x255f2e));_0x3ed1c6(_0x255f2e);})[_0xec3a('0x19')](function(_0x350335){logger[_0xec3a('0x15')]('CreateMailMessage',_0x350335[_0xec3a('0x17')],_0x1f4b71);_0x40e7e0(_0x87e1eb[_0xec3a('0x15')](0x1f4,_0x350335[_0xec3a('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7b645a5..9fc8669 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 _0x7126=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7126,0xb9));var _0x6712=function(_0x304442,_0x2ee621){_0x304442=_0x304442-0x0;var _0x515684=_0x7126[_0x304442];return _0x515684;};'use strict';var MailMessageEvents=require(_0x6712('0x0'));var events=[_0x6712('0x1'),_0x6712('0x2'),_0x6712('0x3')];function createListener(_0x255baa,_0x4bb5b0){return function(_0x5f0c1f){_0x4bb5b0['emit'](_0x255baa,_0x5f0c1f);};}function removeListener(_0xfc25b0,_0x576e75){return function(){MailMessageEvents[_0x6712('0x4')](_0xfc25b0,_0x576e75);};}exports[_0x6712('0x5')]=function(_0x299ec4){for(var _0x1edbda=0x0,_0x411392=events[_0x6712('0x6')];_0x1edbda<_0x411392;_0x1edbda++){var _0x43f9e8=events[_0x1edbda];var _0x1a0cd8=createListener(_0x6712('0x7')+_0x43f9e8,_0x299ec4);MailMessageEvents['on'](_0x43f9e8,_0x1a0cd8);}}; \ No newline at end of file +var _0xf156=['register','length','mailMessage:','save','remove','emit','removeListener'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xf156,0x137));var _0x6f15=function(_0x235b57,_0x3bf022){_0x235b57=_0x235b57-0x0;var _0x237d3e=_0xf156[_0x235b57];return _0x237d3e;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x6f15('0x0'),_0x6f15('0x1'),'update'];function createListener(_0x1a466f,_0x5a416a){return function(_0x1a6bee){_0x5a416a[_0x6f15('0x2')](_0x1a466f,_0x1a6bee);};}function removeListener(_0x15bc29,_0x247772){return function(){MailMessageEvents[_0x6f15('0x3')](_0x15bc29,_0x247772);};}exports[_0x6f15('0x4')]=function(_0x5aed1c){for(var _0x5d740f=0x0,_0x423cb5=events[_0x6f15('0x5')];_0x5d740f<_0x423cb5;_0x5d740f++){var _0x4f60ee=events[_0x5d740f];var _0x3d1ca9=createListener(_0x6f15('0x6')+_0x4f60ee,_0x5aed1c);MailMessageEvents['on'](_0x4f60ee,_0x3d1ca9);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index f85ba41..bd32f7a 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 _0x6049=['get','isAuthenticated','index','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeAgents','exports','util','path','express','Router','../../config/environment','./mailQueue.controller'];(function(_0x3ffc45,_0x28b91c){var _0x35a4ce=function(_0x43b1c7){while(--_0x43b1c7){_0x3ffc45['push'](_0x3ffc45['shift']());}};_0x35a4ce(++_0x28b91c);}(_0x6049,0x180));var _0x9604=function(_0x2bd193,_0x34fdc3){_0x2bd193=_0x2bd193-0x0;var _0x70f7d7=_0x6049[_0x2bd193];return _0x70f7d7;};'use strict';var multer=require('multer');var util=require(_0x9604('0x0'));var path=require(_0x9604('0x1'));var express=require(_0x9604('0x2'));var router=express[_0x9604('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9604('0x4'));var controller=require(_0x9604('0x5'));router[_0x9604('0x6')]('/',auth[_0x9604('0x7')](),controller[_0x9604('0x8')]);router[_0x9604('0x6')](_0x9604('0x9'),auth[_0x9604('0x7')](),controller[_0x9604('0xa')]);router[_0x9604('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9604('0x6')](_0x9604('0xb'),auth[_0x9604('0x7')](),controller[_0x9604('0xc')]);router[_0x9604('0x6')](_0x9604('0xd'),auth[_0x9604('0x7')](),controller[_0x9604('0xe')]);router['get'](_0x9604('0xf'),auth[_0x9604('0x7')](),controller[_0x9604('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9604('0x11')]);router[_0x9604('0x12')](_0x9604('0xd'),auth[_0x9604('0x7')](),controller['addTeams']);router[_0x9604('0x12')]('/:id/users',auth['isAuthenticated'](),controller[_0x9604('0x13')]);router[_0x9604('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x9604('0x15')]);router[_0x9604('0x16')]('/:id',auth[_0x9604('0x7')](),controller[_0x9604('0x17')]);router[_0x9604('0x16')](_0x9604('0xd'),auth[_0x9604('0x7')](),controller['removeTeams']);router[_0x9604('0x16')]('/:id/users',auth[_0x9604('0x7')](),controller[_0x9604('0x18')]);module[_0x9604('0x19')]=router; \ No newline at end of file +var _0x5b00=['util','express','Router','../../components/interaction/service','../../config/environment','./mailQueue.controller','index','get','/describe','isAuthenticated','describe','/:id','show','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5b00,0x113));var _0x05b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b00[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x05b0('0x0'));var path=require('path');var express=require(_0x05b0('0x1'));var router=express[_0x05b0('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x05b0('0x3'));var config=require(_0x05b0('0x4'));var controller=require(_0x05b0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x05b0('0x6')]);router[_0x05b0('0x7')](_0x05b0('0x8'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xa')]);router[_0x05b0('0x7')](_0x05b0('0xb'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xc')]);router[_0x05b0('0x7')]('/:id/members',auth[_0x05b0('0x9')](),controller['getMembers']);router[_0x05b0('0x7')](_0x05b0('0xd'),auth[_0x05b0('0x9')](),controller[_0x05b0('0xe')]);router[_0x05b0('0x7')](_0x05b0('0xf'),auth[_0x05b0('0x9')](),controller['getAgents']);router[_0x05b0('0x10')]('/',auth['isAuthenticated'](),controller[_0x05b0('0x11')]);router[_0x05b0('0x10')]('/:id/teams',auth[_0x05b0('0x9')](),controller[_0x05b0('0x12')]);router[_0x05b0('0x10')](_0x05b0('0xf'),auth['isAuthenticated'](),controller[_0x05b0('0x13')]);router['put'](_0x05b0('0xb'),auth['isAuthenticated'](),controller[_0x05b0('0x14')]);router[_0x05b0('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x05b0('0x16')]);router[_0x05b0('0x15')](_0x05b0('0xd'),auth[_0x05b0('0x9')](),controller[_0x05b0('0x17')]);router[_0x05b0('0x15')](_0x05b0('0xf'),auth[_0x05b0('0x9')](),controller['removeAgents']);module[_0x05b0('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b5e561d..6dd7fd3 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 _0xe604=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x2170da,_0x28c77f){var _0x174318=function(_0x11b45a){while(--_0x11b45a){_0x2170da['push'](_0x2170da['shift']());}};_0x174318(++_0x28c77f);}(_0xe604,0x13f));var _0x4e60=function(_0x4878f2,_0x338715){_0x4878f2=_0x4878f2-0x0;var _0x41eb6e=_0xe604[_0x4878f2];return _0x41eb6e;};'use strict';var Sequelize=require(_0x4e60('0x0'));module[_0x4e60('0x1')]={'name':{'type':Sequelize[_0x4e60('0x2')],'unique':_0x4e60('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4e60('0x2')]},'timeout':{'type':Sequelize[_0x4e60('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4e60('0x5')](_0x4e60('0x6'),_0x4e60('0x7'),_0x4e60('0x8'))}}; \ No newline at end of file +var _0x1324=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x10f98b,_0x3608f1){var _0xbd4035=function(_0x18cb68){while(--_0x18cb68){_0x10f98b['push'](_0x10f98b['shift']());}};_0xbd4035(++_0x3608f1);}(_0x1324,0x14c));var _0x4132=function(_0x3f5330,_0x179db7){_0x3f5330=_0x3f5330-0x0;var _0x5ce9c2=_0x1324[_0x3f5330];return _0x5ce9c2;};'use strict';var Sequelize=require(_0x4132('0x0'));module[_0x4132('0x1')]={'name':{'type':Sequelize[_0x4132('0x2')],'unique':_0x4132('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4132('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4132('0x4')](_0x4132('0x5'),_0x4132('0x6'),_0x4132('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index ddb3fb2..bfa6cc2 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 _0xc772=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./mailQueue.socket','register','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','destroy','then','error','stack','name','index','MailQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','add','day','filter','map','merge','options','include','findAll','rows','includeAll','find','create','catch','body','params','describe','getMembers','findOne','get','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','Team','getTeams','addTeams','ids','Agents','union','addAgents','removeAgents','removeTeams','omit','spread','emit','isArray','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x1f2f86,_0x57341c){var _0x43a6b3=function(_0x30430b){while(--_0x30430b){_0x1f2f86['push'](_0x1f2f86['shift']());}};_0x43a6b3(++_0x57341c);}(_0xc772,0x12f));var _0x2c77=function(_0x6c9f1c,_0x88d5f3){_0x6c9f1c=_0x6c9f1c-0x0;var _0x3f089b=_0xc772[_0x6c9f1c];return _0x3f089b;};'use strict';var jsonpatch=require(_0x2c77('0x0'));var rp=require(_0x2c77('0x1'));var moment=require(_0x2c77('0x2'));var BPromise=require(_0x2c77('0x3'));var Mustache=require('mustache');var util=require(_0x2c77('0x4'));var path=require(_0x2c77('0x5'));var sox=require(_0x2c77('0x6'));var csv=require(_0x2c77('0x7'));var ejs=require(_0x2c77('0x8'));var fs=require('fs');var _=require(_0x2c77('0x9'));var squel=require(_0x2c77('0xa'));var crypto=require('crypto');var jsforce=require(_0x2c77('0xb'));var deskjs=require(_0x2c77('0xc'));var toCsv=require(_0x2c77('0x7'));var querystring=require(_0x2c77('0xd'));var Papa=require(_0x2c77('0xe'));var qs=require(_0x2c77('0xf'));var logger=require(_0x2c77('0x10'))(_0x2c77('0x11'));var utils=require(_0x2c77('0x12'));var config=require(_0x2c77('0x13'));var db=require(_0x2c77('0x14'))['db'];var socket=require(_0x2c77('0x15'))({'host':_0x2c77('0x16'),'port':0x18eb});require(_0x2c77('0x17'))[_0x2c77('0x18')](socket);function respondWithStatusCode(_0x1568a1,_0x556da6){_0x556da6=_0x556da6||0xcc;return function(_0x1b6f47){if(_0x1b6f47){return _0x1568a1['sendStatus'](_0x556da6);}return _0x1568a1['status'](_0x556da6)[_0x2c77('0x19')]();};}function respondWithResult(_0x503cac,_0x156958){_0x156958=_0x156958||0xc8;return function(_0x50139f){if(_0x50139f){return _0x503cac['status'](_0x156958)['json'](_0x50139f);}};}function respondWithFilteredResult(_0x1e270f,_0x3e9840){return function(_0x575eb4){if(_0x575eb4){var _0x59fa47=_0x575eb4[_0x2c77('0x1a')],_0x2a2678=_0x3e9840[_0x2c77('0x1b')],_0x3a835d=_0x3e9840[_0x2c77('0x1b')]+_0x3e9840[_0x2c77('0x1c')],_0xf3c127;if(_0x3a835d>=_0x59fa47){_0x3a835d=_0x59fa47;_0xf3c127=0xc8;}else{_0xf3c127=0xce;}_0x1e270f[_0x2c77('0x1d')](_0xf3c127);return _0x1e270f[_0x2c77('0x1e')](_0x2c77('0x1f'),_0x2a2678+'-'+_0x3a835d+'/'+_0x59fa47)[_0x2c77('0x20')](_0x575eb4);}return null;};}function patchUpdates(_0x2f9044){return function(_0x35b46f){try{jsonpatch['apply'](_0x35b46f,_0x2f9044,!![]);}catch(_0x3efc29){return BPromise[_0x2c77('0x21')](_0x3efc29);}return _0x35b46f[_0x2c77('0x22')]();};}function saveUpdates(_0x10dd21,_0x1a0312){return function(_0x285e9f){if(_0x285e9f){return _0x285e9f[_0x2c77('0x23')](_0x10dd21)['then'](function(_0x3f83db){return _0x3f83db;});}return null;};}function removeEntity(_0x2e82a1,_0x24b982){return function(_0x295361){if(_0x295361){return _0x295361[_0x2c77('0x24')]()[_0x2c77('0x25')](function(){_0x2e82a1[_0x2c77('0x1d')](0xcc)[_0x2c77('0x19')]();});}};}function handleEntityNotFound(_0x16d275,_0xb163d0){return function(_0x2dfbfe){if(!_0x2dfbfe){_0x16d275['sendStatus'](0x194);}return _0x2dfbfe;};}function handleError(_0x5202fb,_0xf9e31e){_0xf9e31e=_0xf9e31e||0x1f4;return function(_0x4d83b3){logger[_0x2c77('0x26')](_0x4d83b3[_0x2c77('0x27')]);if(_0x4d83b3[_0x2c77('0x28')]){delete _0x4d83b3[_0x2c77('0x28')];}_0x5202fb[_0x2c77('0x1d')](_0xf9e31e)['send'](_0x4d83b3);};}exports[_0x2c77('0x29')]=function(_0xebdd61,_0xde995f){var _0x13a356={},_0x1fbd0f={},_0x35a4f3={'count':0x0,'rows':[]};var _0x3694ab=db[_0x2c77('0x2a')][_0x2c77('0x2b')];_0x1fbd0f[_0x2c77('0x2c')]=_[_0x2c77('0x2d')](_0x3694ab);var _0x5c2d34={'dateStart':_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x2f')],'dateEnd':_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x30')]};delete _0xebdd61[_0x2c77('0x2e')][_0x2c77('0x2f')];delete _0xebdd61[_0x2c77('0x2e')][_0x2c77('0x30')];_0x1fbd0f['query']=_[_0x2c77('0x2d')](_0xebdd61[_0x2c77('0x2e')]);_0x1fbd0f[_0x2c77('0x31')]=_['intersection'](_0x1fbd0f[_0x2c77('0x2c')],_0x1fbd0f[_0x2c77('0x2e')]);_0x13a356[_0x2c77('0x32')]=_[_0x2c77('0x33')](_0x1fbd0f[_0x2c77('0x2c')],qs[_0x2c77('0x34')](_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x34')]));_0x13a356[_0x2c77('0x32')]=_0x13a356[_0x2c77('0x32')][_0x2c77('0x35')]?_0x13a356[_0x2c77('0x32')]:_0x1fbd0f[_0x2c77('0x2c')];if(!_0xebdd61[_0x2c77('0x2e')]['hasOwnProperty'](_0x2c77('0x36'))){_0x13a356[_0x2c77('0x1c')]=qs['limit'](_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x1c')]);_0x13a356[_0x2c77('0x1b')]=qs[_0x2c77('0x1b')](_0xebdd61[_0x2c77('0x2e')]['offset']);}_0x13a356[_0x2c77('0x37')]=qs[_0x2c77('0x38')](_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x38')]);_0x13a356[_0x2c77('0x39')]=qs[_0x2c77('0x31')](_[_0x2c77('0x3a')](_0xebdd61['query'],_0x1fbd0f[_0x2c77('0x31')]));if(_0x5c2d34['dateStart']){if(_0x5c2d34[_0x2c77('0x30')]){_0x5c2d34[_0x2c77('0x30')]=moment(_0x5c2d34[_0x2c77('0x30')])['add'](0x1,'day');}else{_0x5c2d34[_0x2c77('0x30')]=moment(_0x5c2d34[_0x2c77('0x2f')])[_0x2c77('0x3b')](0x1,_0x2c77('0x3c'));}_['merge'](_0x13a356[_0x2c77('0x39')],{'createdAt':{'$gte':_0x5c2d34[_0x2c77('0x2f')],'$lte':_0x5c2d34[_0x2c77('0x30')]}});}if(_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x3d')]){_0x13a356[_0x2c77('0x39')]=_['merge'](_0x13a356[_0x2c77('0x39')],{'$or':_[_0x2c77('0x3e')](_0x13a356[_0x2c77('0x32')],function(_0x39e055){var _0x27d98d={};_0x27d98d[_0x39e055]={'$like':'%'+_0xebdd61[_0x2c77('0x2e')][_0x2c77('0x3d')]+'%'};return _0x27d98d;})});}_0x13a356=_[_0x2c77('0x3f')]({},_0x13a356,_0xebdd61[_0x2c77('0x40')]);var _0x241e12={'where':_0x13a356['where']};return db[_0x2c77('0x2a')][_0x2c77('0x1a')](_0x241e12)[_0x2c77('0x25')](function(_0x1d4b5b){_0x35a4f3[_0x2c77('0x1a')]=_0x1d4b5b;if(_0xebdd61['query']['includeAll']){_0x13a356[_0x2c77('0x41')]=[{'all':!![]}];}return db['MailQueue'][_0x2c77('0x42')](_0x13a356);})['then'](function(_0x4bb096){_0x35a4f3[_0x2c77('0x43')]=_0x4bb096;return _0x35a4f3;})[_0x2c77('0x25')](respondWithFilteredResult(_0xde995f,_0x13a356))['catch'](handleError(_0xde995f,null));};exports['show']=function(_0x8b73b,_0x1065c1){var _0x3d81ea={'raw':!![],'where':{'id':_0x8b73b['params']['id']}},_0x245307={};_0x245307[_0x2c77('0x2c')]=_[_0x2c77('0x2d')](db[_0x2c77('0x2a')][_0x2c77('0x2b')]);_0x245307[_0x2c77('0x2e')]=_[_0x2c77('0x2d')](_0x8b73b[_0x2c77('0x2e')]);_0x245307[_0x2c77('0x31')]=_['intersection'](_0x245307[_0x2c77('0x2c')],_0x245307[_0x2c77('0x2e')]);_0x3d81ea[_0x2c77('0x32')]=_['intersection'](_0x245307['model'],qs[_0x2c77('0x34')](_0x8b73b[_0x2c77('0x2e')]['fields']));_0x3d81ea[_0x2c77('0x32')]=_0x3d81ea[_0x2c77('0x32')][_0x2c77('0x35')]?_0x3d81ea[_0x2c77('0x32')]:_0x245307[_0x2c77('0x2c')];if(_0x8b73b[_0x2c77('0x2e')][_0x2c77('0x44')]){_0x3d81ea[_0x2c77('0x41')]=[{'all':!![]}];}_0x3d81ea=_[_0x2c77('0x3f')]({},_0x3d81ea,_0x8b73b[_0x2c77('0x40')]);return db[_0x2c77('0x2a')][_0x2c77('0x45')](_0x3d81ea)['then'](handleEntityNotFound(_0x1065c1,null))['then'](respondWithResult(_0x1065c1,null))['catch'](handleError(_0x1065c1,null));};exports[_0x2c77('0x46')]=function(_0x49c89b,_0x36d1aa){return db[_0x2c77('0x2a')][_0x2c77('0x46')](_0x49c89b['body'],{})[_0x2c77('0x25')](respondWithResult(_0x36d1aa,0xc9))[_0x2c77('0x47')](handleError(_0x36d1aa,null));};exports['update']=function(_0x8f3a73,_0x5fe2fd){if(_0x8f3a73[_0x2c77('0x48')]['id']){delete _0x8f3a73['body']['id'];}return db[_0x2c77('0x2a')][_0x2c77('0x45')]({'where':{'id':_0x8f3a73[_0x2c77('0x49')]['id']}})[_0x2c77('0x25')](handleEntityNotFound(_0x5fe2fd,null))[_0x2c77('0x25')](saveUpdates(_0x8f3a73['body'],null))[_0x2c77('0x25')](respondWithResult(_0x5fe2fd,null))[_0x2c77('0x47')](handleError(_0x5fe2fd,null));};exports[_0x2c77('0x24')]=function(_0x15c9e7,_0x4a445a){return db[_0x2c77('0x2a')]['find']({'where':{'id':_0x15c9e7[_0x2c77('0x49')]['id']}})[_0x2c77('0x25')](handleEntityNotFound(_0x4a445a,null))['then'](removeEntity(_0x4a445a,null))[_0x2c77('0x47')](handleError(_0x4a445a,null));};exports[_0x2c77('0x4a')]=function(_0x22db1f,_0x224680){return db['MailQueue']['describe']()[_0x2c77('0x25')](respondWithResult(_0x224680,null))[_0x2c77('0x47')](handleError(_0x224680,null));};exports[_0x2c77('0x4b')]=function(_0xc0bc43,_0x3774d3,_0x110665){var _0x49132d={'raw':!![],'where':{}},_0x226191={},_0x1ce0cf;return db[_0x2c77('0x2a')][_0x2c77('0x4c')]({'where':{'id':_0xc0bc43[_0x2c77('0x49')]['id']}})['then'](handleEntityNotFound(_0x3774d3,null))[_0x2c77('0x25')](function(_0x30c971){if(_0x30c971){_0x1ce0cf=_0x30c971[_0x2c77('0x4d')]({'plain':!![]});_0x226191[_0x2c77('0x2c')]=_['keys'](db[_0x2c77('0x4e')][_0x2c77('0x2b')]);_0x226191[_0x2c77('0x2e')]=_['keys'](_0xc0bc43[_0x2c77('0x2e')]);_0x226191[_0x2c77('0x31')]=_[_0x2c77('0x33')](_0x226191[_0x2c77('0x2c')],_0x226191['query']);_0x49132d[_0x2c77('0x32')]=_[_0x2c77('0x33')](_0x226191[_0x2c77('0x2c')],qs[_0x2c77('0x34')](_0xc0bc43[_0x2c77('0x2e')]['fields']));_0x49132d[_0x2c77('0x32')]=_0x49132d['attributes'][_0x2c77('0x35')]?_0x49132d[_0x2c77('0x32')]:_0x226191[_0x2c77('0x2c')];if(!_0xc0bc43[_0x2c77('0x2e')][_0x2c77('0x4f')](_0x2c77('0x36'))){_0x49132d[_0x2c77('0x1c')]=qs['limit'](_0xc0bc43[_0x2c77('0x2e')][_0x2c77('0x1c')]);_0x49132d[_0x2c77('0x1b')]=qs[_0x2c77('0x1b')](_0xc0bc43['query'][_0x2c77('0x1b')]);}_0x49132d[_0x2c77('0x37')]=qs[_0x2c77('0x38')](_0xc0bc43[_0x2c77('0x2e')][_0x2c77('0x38')]);_0x49132d[_0x2c77('0x39')]=qs['filters'](_[_0x2c77('0x3a')](_0xc0bc43[_0x2c77('0x2e')],_0x226191[_0x2c77('0x31')]));_0x49132d[_0x2c77('0x39')][_0x2c77('0x50')]=_0x30c971['id'];if(_0xc0bc43[_0x2c77('0x2e')]['filter']){_0x49132d[_0x2c77('0x39')]=_[_0x2c77('0x3f')](_0x49132d[_0x2c77('0x39')],{'$or':_[_0x2c77('0x3e')](_0x49132d['attributes'],function(_0x46c5a7){var _0x52b498={};_0x52b498[_0x46c5a7]={'$like':'%'+_0xc0bc43[_0x2c77('0x2e')][_0x2c77('0x3d')]+'%'};return _0x52b498;})});}_0x49132d=_['merge']({},_0x49132d,_0xc0bc43[_0x2c77('0x40')]);return db['UserMailQueue']['findAll'](_0x49132d);}})[_0x2c77('0x25')](function(_0x59fd1b){if(_0x59fd1b){return db[_0x2c77('0x51')][_0x2c77('0x52')]({'where':{'id':_['map'](_0x59fd1b,_0x2c77('0x53')),'role':_0x2c77('0x54')},'attributes':['id',_0x2c77('0x28'),'mailPause',_0x2c77('0x55'),_0x2c77('0x56')]});}})[_0x2c77('0x25')](function(_0x198cca){if(_0x198cca){return{'count':_0x198cca[_0x2c77('0x1a')],'rows':_[_0x2c77('0x3e')](_0x198cca[_0x2c77('0x43')],function(_0x234c2e){return{'membername':_0x234c2e['name'],'UserId':_0x234c2e['id'],'queue_name':_0x1ce0cf[_0x2c77('0x28')],'MailQueueId':_0x1ce0cf['id'],'interface':util[_0x2c77('0x57')](_0x2c77('0x58'),'SIP',_0x234c2e['name']),'penalty':0x0,'paused':_0x234c2e['mailPause'],'createdAt':_0x234c2e['createdAt'],'updatedAt':_0x234c2e[_0x2c77('0x55')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3774d3,_0x49132d))['catch'](handleError(_0x3774d3,null));};exports['getTeams']=function(_0xbc517c,_0x35d6b7,_0x59c35c){var _0x550940={};var _0xd9203f={};var _0x23d87d;var _0x2d2ccd;return db['MailQueue']['findOne']({'where':{'id':_0xbc517c[_0x2c77('0x49')]['id']}})['then'](handleEntityNotFound(_0x35d6b7,null))[_0x2c77('0x25')](function(_0x45c35){if(_0x45c35){_0x23d87d=_0x45c35;_0xd9203f[_0x2c77('0x2c')]=_[_0x2c77('0x2d')](db[_0x2c77('0x59')][_0x2c77('0x2b')]);_0xd9203f[_0x2c77('0x2e')]=_[_0x2c77('0x2d')](_0xbc517c[_0x2c77('0x2e')]);_0xd9203f[_0x2c77('0x31')]=_['intersection'](_0xd9203f[_0x2c77('0x2c')],_0xd9203f[_0x2c77('0x2e')]);_0x550940[_0x2c77('0x32')]=_[_0x2c77('0x33')](_0xd9203f[_0x2c77('0x2c')],qs[_0x2c77('0x34')](_0xbc517c[_0x2c77('0x2e')][_0x2c77('0x34')]));_0x550940[_0x2c77('0x32')]=_0x550940[_0x2c77('0x32')][_0x2c77('0x35')]?_0x550940[_0x2c77('0x32')]:_0xd9203f[_0x2c77('0x2c')];_0x550940['order']=qs['sort'](_0xbc517c[_0x2c77('0x2e')][_0x2c77('0x38')]);_0x550940[_0x2c77('0x39')]=qs[_0x2c77('0x31')](_[_0x2c77('0x3a')](_0xbc517c[_0x2c77('0x2e')],_0xd9203f[_0x2c77('0x31')]));if(_0xbc517c[_0x2c77('0x2e')][_0x2c77('0x3d')]){_0x550940[_0x2c77('0x39')]=_['merge'](_0x550940[_0x2c77('0x39')],{'$or':_[_0x2c77('0x3e')](_0x550940[_0x2c77('0x32')],function(_0x5b1e1f){var _0x438838={};_0x438838[_0x5b1e1f]={'$like':'%'+_0xbc517c[_0x2c77('0x2e')]['filter']+'%'};return _0x438838;})});}_0x550940=_['merge']({},_0x550940,_0xbc517c[_0x2c77('0x40')]);return _0x23d87d[_0x2c77('0x5a')](_0x550940);}})[_0x2c77('0x25')](function(_0x15c004){if(_0x15c004){_0x2d2ccd=_0x15c004[_0x2c77('0x35')];if(!_0xbc517c['query'][_0x2c77('0x4f')](_0x2c77('0x36'))){_0x550940['limit']=qs[_0x2c77('0x1c')](_0xbc517c[_0x2c77('0x2e')][_0x2c77('0x1c')]);_0x550940[_0x2c77('0x1b')]=qs[_0x2c77('0x1b')](_0xbc517c[_0x2c77('0x2e')][_0x2c77('0x1b')]);}return _0x23d87d['getTeams'](_0x550940);}})[_0x2c77('0x25')](function(_0x196027){if(_0x196027){return _0x196027?{'count':_0x2d2ccd,'rows':_0x196027}:null;}})[_0x2c77('0x25')](respondWithResult(_0x35d6b7,null))[_0x2c77('0x47')](handleError(_0x35d6b7,null));};exports[_0x2c77('0x5b')]=function(_0x898c49,_0x4950a0,_0x590243){var _0x13d6ed=[];var _0x53d795;return db[_0x2c77('0x59')][_0x2c77('0x42')]({'where':{'id':_0x898c49[_0x2c77('0x48')][_0x2c77('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x2c77('0x51')],'as':_0x2c77('0x5d'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x4f0592){if(_0x4f0592){for(var _0x2eaf1c=0x0;_0x2eaf1c<_0x4f0592[_0x2c77('0x35')];_0x2eaf1c+=0x1){for(var _0x5e27ea=0x0;_0x5e27ea<_0x4f0592[_0x2eaf1c][_0x2c77('0x5d')][_0x2c77('0x35')];_0x5e27ea+=0x1){_0x13d6ed=_[_0x2c77('0x5e')](_0x13d6ed,[_0x4f0592[_0x2eaf1c]['Agents'][_0x5e27ea]['id']]);}}return _0x13d6ed;}})[_0x2c77('0x25')](function(_0x42b861){if(_0x42b861){return db[_0x2c77('0x2a')][_0x2c77('0x45')]({'where':{'id':_0x898c49[_0x2c77('0x49')]['id']}});}})[_0x2c77('0x25')](function(_0x245da0){if(_0x245da0){_0x53d795=_0x245da0;return _0x53d795[_0x2c77('0x5f')](_0x13d6ed,{'penalty':_0x898c49[_0x2c77('0x48')]['penalty']});}})[_0x2c77('0x25')](function(_0xacb9d0){if(_0xacb9d0){return _0x53d795[_0x2c77('0x5b')](_0x898c49[_0x2c77('0x48')][_0x2c77('0x5c')]);}})['then'](handleEntityNotFound(_0x4950a0,null))[_0x2c77('0x25')](respondWithStatusCode(_0x4950a0,null))[_0x2c77('0x47')](handleError(_0x4950a0,null));};exports['removeTeams']=function(_0x53a3eb,_0x19d77d,_0x24eb4d){var _0xd1665=[];var _0x20b4b3;return db[_0x2c77('0x59')]['findAll']({'where':{'id':_0x53a3eb[_0x2c77('0x2e')][_0x2c77('0x5c')]},'attributes':['id'],'include':[{'model':db[_0x2c77('0x51')],'as':_0x2c77('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x2c77('0x25')](function(_0x5e0a9a){if(_0x5e0a9a){for(var _0x328209=0x0;_0x328209<_0x5e0a9a[_0x2c77('0x35')];_0x328209+=0x1){for(var _0xffbba=0x0;_0xffbba<_0x5e0a9a[_0x328209]['Agents'][_0x2c77('0x35')];_0xffbba+=0x1){_0xd1665=_['union'](_0xd1665,[_0x5e0a9a[_0x328209]['Agents'][_0xffbba]['id']]);}}return _0xd1665;}})[_0x2c77('0x25')](function(_0x1f4fa8){if(_0x1f4fa8){return db[_0x2c77('0x2a')][_0x2c77('0x45')]({'where':{'id':_0x53a3eb[_0x2c77('0x49')]['id']}});}})[_0x2c77('0x25')](function(_0x5c2ea0){if(_0x5c2ea0){_0x20b4b3=_0x5c2ea0;return _0x20b4b3[_0x2c77('0x60')](_0xd1665);}})['then'](function(_0x5d0777){if(_0x20b4b3){return _0x20b4b3[_0x2c77('0x61')](_0x53a3eb[_0x2c77('0x2e')][_0x2c77('0x5c')]);}})[_0x2c77('0x25')](handleEntityNotFound(_0x19d77d,null))['then'](respondWithStatusCode(_0x19d77d,null))['catch'](handleError(_0x19d77d,null));};exports[_0x2c77('0x5f')]=function(_0x3d8d93,_0x6aa95b,_0x3fee60){return db['MailQueue'][_0x2c77('0x45')]({'where':{'id':_0x3d8d93[_0x2c77('0x49')]['id']}})[_0x2c77('0x25')](handleEntityNotFound(_0x6aa95b,null))['then'](function(_0x1a2430){if(_0x1a2430){return _0x1a2430['addAgents'](_0x3d8d93[_0x2c77('0x48')][_0x2c77('0x5c')],_[_0x2c77('0x62')](_0x3d8d93[_0x2c77('0x48')],[_0x2c77('0x5c'),'id'])||{})[_0x2c77('0x63')](function(_0x16b2d9){for(var _0x5381c7=0x0;_0x5381c7<_0x3d8d93[_0x2c77('0x48')]['ids'][_0x2c77('0x35')];_0x5381c7+=0x1){socket[_0x2c77('0x64')]('userMailQueue:save',{'UserId':_0x3d8d93[_0x2c77('0x48')][_0x2c77('0x5c')][_0x5381c7],'MailQueueId':_0x3d8d93['params']['id']});}return _0x16b2d9;});}})[_0x2c77('0x25')](respondWithResult(_0x6aa95b,null))[_0x2c77('0x47')](handleError(_0x6aa95b,null));};exports[_0x2c77('0x60')]=function(_0x3bb8ea,_0x346365,_0x1090b0){var _0x5cbdcf;return db[_0x2c77('0x2a')][_0x2c77('0x45')]({'where':{'id':_0x3bb8ea[_0x2c77('0x49')]['id']}})[_0x2c77('0x25')](handleEntityNotFound(_0x346365,null))['then'](function(_0x3f7a01){if(_0x3f7a01){return _0x3f7a01[_0x2c77('0x60')](_0x3bb8ea[_0x2c77('0x2e')][_0x2c77('0x5c')])[_0x2c77('0x25')](function(_0x4225ca){if(_[_0x2c77('0x65')](_0x3bb8ea['query'][_0x2c77('0x5c')])){for(var _0x2d185d=0x0;_0x2d185d<_0x3bb8ea['query'][_0x2c77('0x5c')][_0x2c77('0x35')];_0x2d185d+=0x1){socket[_0x2c77('0x64')]('userMailQueue:remove',{'UserId':_0x3bb8ea[_0x2c77('0x2e')]['ids'][_0x2d185d],'MailQueueId':_0x3bb8ea[_0x2c77('0x49')]['id']});}}else{socket[_0x2c77('0x64')]('userMailQueue:remove',{'UserId':_0x3bb8ea[_0x2c77('0x2e')][_0x2c77('0x5c')],'MailQueueId':_0x3bb8ea[_0x2c77('0x49')]['id']});}});}})['then'](respondWithStatusCode(_0x346365,null))[_0x2c77('0x47')](handleError(_0x346365,null));};exports[_0x2c77('0x66')]=function(_0x42c58d,_0x13fba6,_0x4cdf4f){var _0x112776={};var _0x291cb7={};var _0xc36d05;var _0x1c609f;return db[_0x2c77('0x2a')]['findOne']({'where':{'id':_0x42c58d[_0x2c77('0x49')]['id']}})[_0x2c77('0x25')](handleEntityNotFound(_0x13fba6,null))[_0x2c77('0x25')](function(_0x442f0d){if(_0x442f0d){_0xc36d05=_0x442f0d;_0x291cb7[_0x2c77('0x2c')]=_[_0x2c77('0x2d')](db[_0x2c77('0x51')][_0x2c77('0x2b')]);_0x291cb7['query']=_[_0x2c77('0x2d')](_0x42c58d[_0x2c77('0x2e')]);_0x291cb7[_0x2c77('0x31')]=_[_0x2c77('0x33')](_0x291cb7[_0x2c77('0x2c')],_0x291cb7['query']);_0x112776[_0x2c77('0x32')]=_[_0x2c77('0x33')](_0x291cb7[_0x2c77('0x2c')],qs['fields'](_0x42c58d[_0x2c77('0x2e')][_0x2c77('0x34')]));_0x112776[_0x2c77('0x32')]=_0x112776[_0x2c77('0x32')][_0x2c77('0x35')]?_0x112776[_0x2c77('0x32')]:_0x291cb7['model'];_0x112776['order']=qs[_0x2c77('0x38')](_0x42c58d[_0x2c77('0x2e')]['sort']);_0x112776[_0x2c77('0x39')]=qs[_0x2c77('0x31')](_['pick'](_0x42c58d['query'],_0x291cb7[_0x2c77('0x31')]));if(_0x42c58d[_0x2c77('0x2e')][_0x2c77('0x3d')]){_0x112776[_0x2c77('0x39')]=_['merge'](_0x112776['where'],{'$or':_[_0x2c77('0x3e')](_0x112776[_0x2c77('0x32')],function(_0x1d03e4){var _0x1571e0={};_0x1571e0[_0x1d03e4]={'$like':'%'+_0x42c58d[_0x2c77('0x2e')][_0x2c77('0x3d')]+'%'};return _0x1571e0;})});}_0x112776=_[_0x2c77('0x3f')]({},_0x112776,_0x42c58d[_0x2c77('0x40')]);return _0xc36d05[_0x2c77('0x66')](_0x112776);}})['then'](function(_0x185313){if(_0x185313){_0x1c609f=_0x185313['length'];if(!_0x42c58d[_0x2c77('0x2e')]['hasOwnProperty'](_0x2c77('0x36'))){_0x112776[_0x2c77('0x1c')]=qs[_0x2c77('0x1c')](_0x42c58d['query'][_0x2c77('0x1c')]);_0x112776[_0x2c77('0x1b')]=qs[_0x2c77('0x1b')](_0x42c58d[_0x2c77('0x2e')][_0x2c77('0x1b')]);}return _0xc36d05['getAgents'](_0x112776);}})[_0x2c77('0x25')](function(_0x3d486e){if(_0x3d486e){return _0x3d486e?{'count':_0x1c609f,'rows':_0x3d486e}:null;}})[_0x2c77('0x25')](respondWithResult(_0x13fba6,null))[_0x2c77('0x47')](handleError(_0x13fba6,null));}; \ No newline at end of file +var _0x1a55=['params','include','create','body','destroy','find','describe','getMembers','findOne','get','UserMailQueue','pick','MailQueueId','options','findAll','findAndCountAll','UserId','mailPause','updatedAt','%s/%s','SIP','createdAt','getTeams','addTeams','Team','ids','User','Agents','union','addAgents','removeTeams','removeAgents','omit','spread','emit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','localhost','./mailQueue.socket','end','status','json','offset','limit','set','Content-Range','reject','save','update','then','sendStatus','stack','name','send','index','MailQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','merge','filter','map','count','includeAll','rows','catch','show'];(function(_0x30eb6b,_0x4ac481){var _0x39ab11=function(_0x2dc324){while(--_0x2dc324){_0x30eb6b['push'](_0x30eb6b['shift']());}};_0x39ab11(++_0x4ac481);}(_0x1a55,0x90));var _0x51a5=function(_0x198e19,_0x534a20){_0x198e19=_0x198e19-0x0;var _0x9c7e5b=_0x1a55[_0x198e19];return _0x9c7e5b;};'use strict';var jsonpatch=require(_0x51a5('0x0'));var rp=require(_0x51a5('0x1'));var moment=require(_0x51a5('0x2'));var BPromise=require(_0x51a5('0x3'));var Mustache=require(_0x51a5('0x4'));var util=require(_0x51a5('0x5'));var path=require(_0x51a5('0x6'));var sox=require(_0x51a5('0x7'));var csv=require(_0x51a5('0x8'));var ejs=require(_0x51a5('0x9'));var fs=require('fs');var _=require(_0x51a5('0xa'));var squel=require(_0x51a5('0xb'));var crypto=require(_0x51a5('0xc'));var jsforce=require(_0x51a5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x51a5('0x8'));var querystring=require(_0x51a5('0xe'));var Papa=require(_0x51a5('0xf'));var qs=require(_0x51a5('0x10'));var logger=require(_0x51a5('0x11'))('api');var utils=require(_0x51a5('0x12'));var config=require(_0x51a5('0x13'));var db=require(_0x51a5('0x14'))['db'];var socket=require('socket.io-emitter')({'host':_0x51a5('0x15'),'port':0x18eb});require(_0x51a5('0x16'))['register'](socket);function respondWithStatusCode(_0x2ec1a5,_0x371e8d){_0x371e8d=_0x371e8d||0xcc;return function(_0x45644d){if(_0x45644d){return _0x2ec1a5['sendStatus'](_0x371e8d);}return _0x2ec1a5['status'](_0x371e8d)[_0x51a5('0x17')]();};}function respondWithResult(_0x139799,_0x30eec7){_0x30eec7=_0x30eec7||0xc8;return function(_0x6fc54a){if(_0x6fc54a){return _0x139799[_0x51a5('0x18')](_0x30eec7)[_0x51a5('0x19')](_0x6fc54a);}};}function respondWithFilteredResult(_0x501342,_0x476bb2){return function(_0x29cd11){if(_0x29cd11){var _0x4f70cb=_0x29cd11['count'],_0x300f75=_0x476bb2[_0x51a5('0x1a')],_0x1ccb18=_0x476bb2[_0x51a5('0x1a')]+_0x476bb2[_0x51a5('0x1b')],_0x3b0d44;if(_0x1ccb18>=_0x4f70cb){_0x1ccb18=_0x4f70cb;_0x3b0d44=0xc8;}else{_0x3b0d44=0xce;}_0x501342[_0x51a5('0x18')](_0x3b0d44);return _0x501342[_0x51a5('0x1c')](_0x51a5('0x1d'),_0x300f75+'-'+_0x1ccb18+'/'+_0x4f70cb)[_0x51a5('0x19')](_0x29cd11);}return null;};}function patchUpdates(_0x2fe31e){return function(_0x5db1af){try{jsonpatch['apply'](_0x5db1af,_0x2fe31e,!![]);}catch(_0x12ee4b){return BPromise[_0x51a5('0x1e')](_0x12ee4b);}return _0x5db1af[_0x51a5('0x1f')]();};}function saveUpdates(_0x28a71b,_0x2ccda8){return function(_0x5d077c){if(_0x5d077c){return _0x5d077c[_0x51a5('0x20')](_0x28a71b)[_0x51a5('0x21')](function(_0x46dcbc){return _0x46dcbc;});}return null;};}function removeEntity(_0x16d082,_0x360ecb){return function(_0x55f91c){if(_0x55f91c){return _0x55f91c['destroy']()[_0x51a5('0x21')](function(){_0x16d082[_0x51a5('0x18')](0xcc)[_0x51a5('0x17')]();});}};}function handleEntityNotFound(_0x142a09,_0x4988fe){return function(_0xd2da59){if(!_0xd2da59){_0x142a09[_0x51a5('0x22')](0x194);}return _0xd2da59;};}function handleError(_0x1493c3,_0x5bc110){_0x5bc110=_0x5bc110||0x1f4;return function(_0x1de5b6){logger['error'](_0x1de5b6[_0x51a5('0x23')]);if(_0x1de5b6[_0x51a5('0x24')]){delete _0x1de5b6[_0x51a5('0x24')];}_0x1493c3[_0x51a5('0x18')](_0x5bc110)[_0x51a5('0x25')](_0x1de5b6);};}exports[_0x51a5('0x26')]=function(_0x22ec0d,_0x42eb01){var _0x47e653={},_0x3cdf45={},_0x39e5cc={'count':0x0,'rows':[]};var _0x40d4a8=db[_0x51a5('0x27')][_0x51a5('0x28')];_0x3cdf45[_0x51a5('0x29')]=_[_0x51a5('0x2a')](_0x40d4a8);var _0x1fb192={'dateStart':_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2c')],'dateEnd':_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2d')]};delete _0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x2c')];delete _0x22ec0d['query'][_0x51a5('0x2d')];_0x3cdf45[_0x51a5('0x2b')]=_['keys'](_0x22ec0d[_0x51a5('0x2b')]);_0x3cdf45[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x3cdf45[_0x51a5('0x29')],_0x3cdf45[_0x51a5('0x2b')]);_0x47e653[_0x51a5('0x30')]=_[_0x51a5('0x2f')](_0x3cdf45['model'],qs[_0x51a5('0x31')](_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x47e653[_0x51a5('0x30')]=_0x47e653['attributes'][_0x51a5('0x32')]?_0x47e653[_0x51a5('0x30')]:_0x3cdf45[_0x51a5('0x29')];if(!_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x47e653[_0x51a5('0x1b')]=qs[_0x51a5('0x1b')](_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x47e653[_0x51a5('0x1a')]=qs[_0x51a5('0x1a')](_0x22ec0d['query']['offset']);}_0x47e653[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x22ec0d['query'][_0x51a5('0x36')]);_0x47e653[_0x51a5('0x37')]=qs[_0x51a5('0x2e')](_['pick'](_0x22ec0d[_0x51a5('0x2b')],_0x3cdf45[_0x51a5('0x2e')]));if(_0x1fb192[_0x51a5('0x2c')]){if(_0x1fb192['dateEnd']){_0x1fb192[_0x51a5('0x2d')]=moment(_0x1fb192['dateEnd'])[_0x51a5('0x38')](0x1,_0x51a5('0x39'));}else{_0x1fb192[_0x51a5('0x2d')]=moment(_0x1fb192[_0x51a5('0x2c')])[_0x51a5('0x38')](0x1,'day');}_[_0x51a5('0x3a')](_0x47e653[_0x51a5('0x37')],{'createdAt':{'$gte':_0x1fb192[_0x51a5('0x2c')],'$lte':_0x1fb192[_0x51a5('0x2d')]}});}if(_0x22ec0d['query'][_0x51a5('0x3b')]){_0x47e653[_0x51a5('0x37')]=_['merge'](_0x47e653[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x47e653['attributes'],function(_0x1e3c4b){var _0x2d6cfe={};_0x2d6cfe[_0x1e3c4b]={'$like':'%'+_0x22ec0d[_0x51a5('0x2b')]['filter']+'%'};return _0x2d6cfe;})});}_0x47e653=_[_0x51a5('0x3a')]({},_0x47e653,_0x22ec0d['options']);var _0x17f732={'where':_0x47e653[_0x51a5('0x37')]};return db[_0x51a5('0x27')][_0x51a5('0x3d')](_0x17f732)[_0x51a5('0x21')](function(_0x5f027d){_0x39e5cc[_0x51a5('0x3d')]=_0x5f027d;if(_0x22ec0d[_0x51a5('0x2b')][_0x51a5('0x3e')]){_0x47e653['include']=[{'all':!![]}];}return db['MailQueue']['findAll'](_0x47e653);})[_0x51a5('0x21')](function(_0x9d9232){_0x39e5cc[_0x51a5('0x3f')]=_0x9d9232;return _0x39e5cc;})[_0x51a5('0x21')](respondWithFilteredResult(_0x42eb01,_0x47e653))[_0x51a5('0x40')](handleError(_0x42eb01,null));};exports[_0x51a5('0x41')]=function(_0xbb4a1f,_0x3a81c4){var _0x1d591c={'raw':!![],'where':{'id':_0xbb4a1f[_0x51a5('0x42')]['id']}},_0x3a0bf1={};_0x3a0bf1[_0x51a5('0x29')]=_['keys'](db[_0x51a5('0x27')][_0x51a5('0x28')]);_0x3a0bf1[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0xbb4a1f['query']);_0x3a0bf1[_0x51a5('0x2e')]=_['intersection'](_0x3a0bf1[_0x51a5('0x29')],_0x3a0bf1['query']);_0x1d591c['attributes']=_['intersection'](_0x3a0bf1[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0xbb4a1f[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x1d591c[_0x51a5('0x30')]=_0x1d591c['attributes']['length']?_0x1d591c[_0x51a5('0x30')]:_0x3a0bf1[_0x51a5('0x29')];if(_0xbb4a1f[_0x51a5('0x2b')][_0x51a5('0x3e')]){_0x1d591c[_0x51a5('0x43')]=[{'all':!![]}];}_0x1d591c=_[_0x51a5('0x3a')]({},_0x1d591c,_0xbb4a1f['options']);return db[_0x51a5('0x27')]['find'](_0x1d591c)[_0x51a5('0x21')](handleEntityNotFound(_0x3a81c4,null))['then'](respondWithResult(_0x3a81c4,null))[_0x51a5('0x40')](handleError(_0x3a81c4,null));};exports[_0x51a5('0x44')]=function(_0x409bbb,_0x4da4f1){return db[_0x51a5('0x27')]['create'](_0x409bbb[_0x51a5('0x45')],{})['then'](respondWithResult(_0x4da4f1,0xc9))['catch'](handleError(_0x4da4f1,null));};exports['update']=function(_0x31038a,_0x2377f1){if(_0x31038a['body']['id']){delete _0x31038a['body']['id'];}return db[_0x51a5('0x27')]['find']({'where':{'id':_0x31038a[_0x51a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x2377f1,null))[_0x51a5('0x21')](saveUpdates(_0x31038a[_0x51a5('0x45')],null))[_0x51a5('0x21')](respondWithResult(_0x2377f1,null))[_0x51a5('0x40')](handleError(_0x2377f1,null));};exports[_0x51a5('0x46')]=function(_0x1b8b2a,_0x483225){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x1b8b2a['params']['id']}})['then'](handleEntityNotFound(_0x483225,null))[_0x51a5('0x21')](removeEntity(_0x483225,null))[_0x51a5('0x40')](handleError(_0x483225,null));};exports[_0x51a5('0x48')]=function(_0x93a6,_0x4b5eda){return db[_0x51a5('0x27')][_0x51a5('0x48')]()[_0x51a5('0x21')](respondWithResult(_0x4b5eda,null))['catch'](handleError(_0x4b5eda,null));};exports[_0x51a5('0x49')]=function(_0x1d3b2f,_0x52dbfd,_0x1cd6cc){var _0x4ca7ba={'raw':!![],'where':{}},_0x565f94={},_0x3d9c2b;return db[_0x51a5('0x27')][_0x51a5('0x4a')]({'where':{'id':_0x1d3b2f[_0x51a5('0x42')]['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x52dbfd,null))[_0x51a5('0x21')](function(_0x13e6af){if(_0x13e6af){_0x3d9c2b=_0x13e6af[_0x51a5('0x4b')]({'plain':!![]});_0x565f94[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db[_0x51a5('0x4c')][_0x51a5('0x28')]);_0x565f94['query']=_[_0x51a5('0x2a')](_0x1d3b2f[_0x51a5('0x2b')]);_0x565f94[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x565f94[_0x51a5('0x29')],_0x565f94['query']);_0x4ca7ba[_0x51a5('0x30')]=_[_0x51a5('0x2f')](_0x565f94[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x1d3b2f['query'][_0x51a5('0x31')]));_0x4ca7ba[_0x51a5('0x30')]=_0x4ca7ba[_0x51a5('0x30')][_0x51a5('0x32')]?_0x4ca7ba[_0x51a5('0x30')]:_0x565f94[_0x51a5('0x29')];if(!_0x1d3b2f[_0x51a5('0x2b')]['hasOwnProperty']('nolimit')){_0x4ca7ba[_0x51a5('0x1b')]=qs['limit'](_0x1d3b2f[_0x51a5('0x2b')]['limit']);_0x4ca7ba[_0x51a5('0x1a')]=qs['offset'](_0x1d3b2f['query'][_0x51a5('0x1a')]);}_0x4ca7ba[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x1d3b2f[_0x51a5('0x2b')][_0x51a5('0x36')]);_0x4ca7ba['where']=qs[_0x51a5('0x2e')](_[_0x51a5('0x4d')](_0x1d3b2f['query'],_0x565f94[_0x51a5('0x2e')]));_0x4ca7ba['where'][_0x51a5('0x4e')]=_0x13e6af['id'];if(_0x1d3b2f[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x4ca7ba[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x4ca7ba[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x4ca7ba['attributes'],function(_0x4628dd){var _0x45badf={};_0x45badf[_0x4628dd]={'$like':'%'+_0x1d3b2f['query'][_0x51a5('0x3b')]+'%'};return _0x45badf;})});}_0x4ca7ba=_['merge']({},_0x4ca7ba,_0x1d3b2f[_0x51a5('0x4f')]);return db[_0x51a5('0x4c')][_0x51a5('0x50')](_0x4ca7ba);}})[_0x51a5('0x21')](function(_0x4f5eb7){if(_0x4f5eb7){return db['User'][_0x51a5('0x51')]({'where':{'id':_['map'](_0x4f5eb7,_0x51a5('0x52')),'role':'agent'},'attributes':['id','name',_0x51a5('0x53'),_0x51a5('0x54'),'createdAt']});}})['then'](function(_0x1a6422){if(_0x1a6422){return{'count':_0x1a6422['count'],'rows':_[_0x51a5('0x3c')](_0x1a6422[_0x51a5('0x3f')],function(_0x2aa70c){return{'membername':_0x2aa70c[_0x51a5('0x24')],'UserId':_0x2aa70c['id'],'queue_name':_0x3d9c2b['name'],'MailQueueId':_0x3d9c2b['id'],'interface':util['format'](_0x51a5('0x55'),_0x51a5('0x56'),_0x2aa70c[_0x51a5('0x24')]),'penalty':0x0,'paused':_0x2aa70c[_0x51a5('0x53')],'createdAt':_0x2aa70c[_0x51a5('0x57')],'updatedAt':_0x2aa70c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x51a5('0x21')](respondWithFilteredResult(_0x52dbfd,_0x4ca7ba))['catch'](handleError(_0x52dbfd,null));};exports['getTeams']=function(_0x21bcbf,_0x179244,_0x42e952){var _0x55f5cd={};var _0x4d281f={};var _0x488977;var _0x2a2d6e;return db[_0x51a5('0x27')]['findOne']({'where':{'id':_0x21bcbf[_0x51a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x179244,null))[_0x51a5('0x21')](function(_0x432615){if(_0x432615){_0x488977=_0x432615;_0x4d281f[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db['Team']['rawAttributes']);_0x4d281f[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0x21bcbf['query']);_0x4d281f[_0x51a5('0x2e')]=_[_0x51a5('0x2f')](_0x4d281f[_0x51a5('0x29')],_0x4d281f['query']);_0x55f5cd['attributes']=_['intersection'](_0x4d281f[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x55f5cd[_0x51a5('0x30')]=_0x55f5cd[_0x51a5('0x30')][_0x51a5('0x32')]?_0x55f5cd[_0x51a5('0x30')]:_0x4d281f[_0x51a5('0x29')];_0x55f5cd[_0x51a5('0x35')]=qs[_0x51a5('0x36')](_0x21bcbf['query'][_0x51a5('0x36')]);_0x55f5cd['where']=qs[_0x51a5('0x2e')](_[_0x51a5('0x4d')](_0x21bcbf['query'],_0x4d281f[_0x51a5('0x2e')]));if(_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x55f5cd[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x55f5cd[_0x51a5('0x37')],{'$or':_['map'](_0x55f5cd[_0x51a5('0x30')],function(_0x28c82a){var _0x1d33d7={};_0x1d33d7[_0x28c82a]={'$like':'%'+_0x21bcbf[_0x51a5('0x2b')]['filter']+'%'};return _0x1d33d7;})});}_0x55f5cd=_[_0x51a5('0x3a')]({},_0x55f5cd,_0x21bcbf[_0x51a5('0x4f')]);return _0x488977[_0x51a5('0x58')](_0x55f5cd);}})[_0x51a5('0x21')](function(_0x38d665){if(_0x38d665){_0x2a2d6e=_0x38d665[_0x51a5('0x32')];if(!_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x55f5cd[_0x51a5('0x1b')]=qs['limit'](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x55f5cd[_0x51a5('0x1a')]=qs[_0x51a5('0x1a')](_0x21bcbf[_0x51a5('0x2b')][_0x51a5('0x1a')]);}return _0x488977[_0x51a5('0x58')](_0x55f5cd);}})['then'](function(_0xa6ef9a){if(_0xa6ef9a){return _0xa6ef9a?{'count':_0x2a2d6e,'rows':_0xa6ef9a}:null;}})['then'](respondWithResult(_0x179244,null))[_0x51a5('0x40')](handleError(_0x179244,null));};exports[_0x51a5('0x59')]=function(_0x13cf52,_0x5f3d59,_0x3fa4bf){var _0x1fcecf=[];var _0x2701f4;return db[_0x51a5('0x5a')][_0x51a5('0x50')]({'where':{'id':_0x13cf52[_0x51a5('0x45')][_0x51a5('0x5b')]},'attributes':['id'],'include':[{'model':db[_0x51a5('0x5c')],'as':_0x51a5('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x51a5('0x21')](function(_0x589e15){if(_0x589e15){for(var _0x1ec6a5=0x0;_0x1ec6a5<_0x589e15[_0x51a5('0x32')];_0x1ec6a5+=0x1){for(var _0x64cacb=0x0;_0x64cacb<_0x589e15[_0x1ec6a5][_0x51a5('0x5d')][_0x51a5('0x32')];_0x64cacb+=0x1){_0x1fcecf=_[_0x51a5('0x5e')](_0x1fcecf,[_0x589e15[_0x1ec6a5][_0x51a5('0x5d')][_0x64cacb]['id']]);}}return _0x1fcecf;}})[_0x51a5('0x21')](function(_0x45082f){if(_0x45082f){return db['MailQueue']['find']({'where':{'id':_0x13cf52[_0x51a5('0x42')]['id']}});}})[_0x51a5('0x21')](function(_0x27cf44){if(_0x27cf44){_0x2701f4=_0x27cf44;return _0x2701f4[_0x51a5('0x5f')](_0x1fcecf,{'penalty':_0x13cf52[_0x51a5('0x45')]['penalty']});}})[_0x51a5('0x21')](function(_0x24aa84){if(_0x24aa84){return _0x2701f4['addTeams'](_0x13cf52[_0x51a5('0x45')]['ids']);}})[_0x51a5('0x21')](handleEntityNotFound(_0x5f3d59,null))[_0x51a5('0x21')](respondWithStatusCode(_0x5f3d59,null))[_0x51a5('0x40')](handleError(_0x5f3d59,null));};exports[_0x51a5('0x60')]=function(_0x599da2,_0x33f126,_0x135eb6){var _0x5ddbe8=[];var _0x5bf330;return db[_0x51a5('0x5a')]['findAll']({'where':{'id':_0x599da2[_0x51a5('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x51a5('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x51a5('0x21')](function(_0x51c185){if(_0x51c185){for(var _0x1ce244=0x0;_0x1ce244<_0x51c185[_0x51a5('0x32')];_0x1ce244+=0x1){for(var _0x4affbf=0x0;_0x4affbf<_0x51c185[_0x1ce244]['Agents']['length'];_0x4affbf+=0x1){_0x5ddbe8=_[_0x51a5('0x5e')](_0x5ddbe8,[_0x51c185[_0x1ce244][_0x51a5('0x5d')][_0x4affbf]['id']]);}}return _0x5ddbe8;}})['then'](function(_0x4519ef){if(_0x4519ef){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x599da2[_0x51a5('0x42')]['id']}});}})[_0x51a5('0x21')](function(_0x2326f0){if(_0x2326f0){_0x5bf330=_0x2326f0;return _0x5bf330[_0x51a5('0x61')](_0x5ddbe8);}})[_0x51a5('0x21')](function(_0x5c78af){if(_0x5bf330){return _0x5bf330[_0x51a5('0x60')](_0x599da2[_0x51a5('0x2b')]['ids']);}})['then'](handleEntityNotFound(_0x33f126,null))['then'](respondWithStatusCode(_0x33f126,null))[_0x51a5('0x40')](handleError(_0x33f126,null));};exports[_0x51a5('0x5f')]=function(_0x50ff7d,_0x65410f,_0x986f14){return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x50ff7d[_0x51a5('0x42')]['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x65410f,null))[_0x51a5('0x21')](function(_0x25ca52){if(_0x25ca52){return _0x25ca52[_0x51a5('0x5f')](_0x50ff7d[_0x51a5('0x45')][_0x51a5('0x5b')],_[_0x51a5('0x62')](_0x50ff7d[_0x51a5('0x45')],[_0x51a5('0x5b'),'id'])||{})[_0x51a5('0x63')](function(_0x231bb6){for(var _0x59e3ae=0x0;_0x59e3ae<_0x50ff7d[_0x51a5('0x45')][_0x51a5('0x5b')]['length'];_0x59e3ae+=0x1){socket[_0x51a5('0x64')](_0x51a5('0x65'),{'UserId':_0x50ff7d[_0x51a5('0x45')]['ids'][_0x59e3ae],'MailQueueId':_0x50ff7d[_0x51a5('0x42')]['id']});}return _0x231bb6;});}})[_0x51a5('0x21')](respondWithResult(_0x65410f,null))[_0x51a5('0x40')](handleError(_0x65410f,null));};exports[_0x51a5('0x61')]=function(_0x347dec,_0x464078,_0x3fa281){var _0x5b22c4;return db[_0x51a5('0x27')][_0x51a5('0x47')]({'where':{'id':_0x347dec['params']['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x464078,null))[_0x51a5('0x21')](function(_0x3c8d99){if(_0x3c8d99){return _0x3c8d99[_0x51a5('0x61')](_0x347dec['query'][_0x51a5('0x5b')])[_0x51a5('0x21')](function(_0x18da37){if(_[_0x51a5('0x66')](_0x347dec['query'][_0x51a5('0x5b')])){for(var _0x181d80=0x0;_0x181d80<_0x347dec[_0x51a5('0x2b')]['ids']['length'];_0x181d80+=0x1){socket['emit'](_0x51a5('0x67'),{'UserId':_0x347dec['query'][_0x51a5('0x5b')][_0x181d80],'MailQueueId':_0x347dec['params']['id']});}}else{socket[_0x51a5('0x64')](_0x51a5('0x67'),{'UserId':_0x347dec['query'][_0x51a5('0x5b')],'MailQueueId':_0x347dec[_0x51a5('0x42')]['id']});}});}})['then'](respondWithStatusCode(_0x464078,null))[_0x51a5('0x40')](handleError(_0x464078,null));};exports['getAgents']=function(_0x148a08,_0x25a95d,_0x547f70){var _0x26741e={};var _0x33135a={};var _0x380f72;var _0x1db989;return db['MailQueue'][_0x51a5('0x4a')]({'where':{'id':_0x148a08['params']['id']}})[_0x51a5('0x21')](handleEntityNotFound(_0x25a95d,null))['then'](function(_0x511c09){if(_0x511c09){_0x380f72=_0x511c09;_0x33135a[_0x51a5('0x29')]=_[_0x51a5('0x2a')](db[_0x51a5('0x5c')]['rawAttributes']);_0x33135a[_0x51a5('0x2b')]=_[_0x51a5('0x2a')](_0x148a08[_0x51a5('0x2b')]);_0x33135a[_0x51a5('0x2e')]=_['intersection'](_0x33135a['model'],_0x33135a[_0x51a5('0x2b')]);_0x26741e[_0x51a5('0x30')]=_['intersection'](_0x33135a[_0x51a5('0x29')],qs[_0x51a5('0x31')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x31')]));_0x26741e[_0x51a5('0x30')]=_0x26741e[_0x51a5('0x30')][_0x51a5('0x32')]?_0x26741e['attributes']:_0x33135a[_0x51a5('0x29')];_0x26741e['order']=qs[_0x51a5('0x36')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x36')]);_0x26741e[_0x51a5('0x37')]=qs['filters'](_[_0x51a5('0x4d')](_0x148a08[_0x51a5('0x2b')],_0x33135a['filters']));if(_0x148a08[_0x51a5('0x2b')][_0x51a5('0x3b')]){_0x26741e[_0x51a5('0x37')]=_[_0x51a5('0x3a')](_0x26741e[_0x51a5('0x37')],{'$or':_[_0x51a5('0x3c')](_0x26741e[_0x51a5('0x30')],function(_0x3e0fbc){var _0x1cf23e={};_0x1cf23e[_0x3e0fbc]={'$like':'%'+_0x148a08[_0x51a5('0x2b')][_0x51a5('0x3b')]+'%'};return _0x1cf23e;})});}_0x26741e=_[_0x51a5('0x3a')]({},_0x26741e,_0x148a08['options']);return _0x380f72[_0x51a5('0x68')](_0x26741e);}})[_0x51a5('0x21')](function(_0x4706f8){if(_0x4706f8){_0x1db989=_0x4706f8[_0x51a5('0x32')];if(!_0x148a08[_0x51a5('0x2b')][_0x51a5('0x33')](_0x51a5('0x34'))){_0x26741e[_0x51a5('0x1b')]=qs[_0x51a5('0x1b')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x1b')]);_0x26741e['offset']=qs[_0x51a5('0x1a')](_0x148a08[_0x51a5('0x2b')][_0x51a5('0x1a')]);}return _0x380f72[_0x51a5('0x68')](_0x26741e);}})[_0x51a5('0x21')](function(_0x5dea86){if(_0x5dea86){return _0x5dea86?{'count':_0x1db989,'rows':_0x5dea86}:null;}})[_0x51a5('0x21')](respondWithResult(_0x25a95d,null))['catch'](handleError(_0x25a95d,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 406cfbb..7832152 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 _0xa652=['exports','MailQueue','save','update','remove','emit','hook'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xa652,0x189));var _0x2a65=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa652[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x2a65('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a65('0x1'),'afterUpdate':_0x2a65('0x2'),'afterDestroy':_0x2a65('0x3')};function emitEvent(_0x37f1c4){return function(_0xc33452,_0x1ae0e0,_0x56aea0){MailQueueEvents[_0x2a65('0x4')](_0x37f1c4+':'+_0xc33452['id'],_0xc33452);MailQueueEvents[_0x2a65('0x4')](_0x37f1c4,_0xc33452);_0x56aea0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x2a65('0x5')](e,emitEvent(event));}}module[_0x2a65('0x6')]=MailQueueEvents; \ No newline at end of file +var _0x1d75=['../../mysqldb','MailQueue','setMaxListeners','save','emit','hasOwnProperty','exports','events'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0x1d75,0x7f));var _0x51d7=function(_0xeffc63,_0x4acafd){_0xeffc63=_0xeffc63-0x0;var _0x175db2=_0x1d75[_0xeffc63];return _0x175db2;};'use strict';var EventEmitter=require(_0x51d7('0x0'));var MailQueue=require(_0x51d7('0x1'))['db'][_0x51d7('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x51d7('0x3')](0x0);var events={'afterCreate':_0x51d7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1abb09){return function(_0x36fcda,_0x586558,_0x5bdcc2){MailQueueEvents['emit'](_0x1abb09+':'+_0x36fcda['id'],_0x36fcda);MailQueueEvents[_0x51d7('0x5')](_0x1abb09,_0x36fcda);_0x5bdcc2(null);};}for(var e in events){if(events[_0x51d7('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x51d7('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8004cab..4ae811e 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 _0xacbc=['define','MailQueue','mail_queues','util','../../config/logger','bluebird','./mailQueue.attributes','exports'];(function(_0x57ad5b,_0x2de725){var _0x5248ed=function(_0x4a342a){while(--_0x4a342a){_0x57ad5b['push'](_0x57ad5b['shift']());}};_0x5248ed(++_0x2de725);}(_0xacbc,0x1eb));var _0xcacb=function(_0x31ab90,_0x145a96){_0x31ab90=_0x31ab90-0x0;var _0x2d6123=_0xacbc[_0x31ab90];return _0x2d6123;};'use strict';var _=require('lodash');var util=require(_0xcacb('0x0'));var logger=require(_0xcacb('0x1'))('api');var moment=require('moment');var BPromise=require(_0xcacb('0x2'));var rp=require('request-promise');var attributes=require(_0xcacb('0x3'));module[_0xcacb('0x4')]=function(_0x9a15e8,_0x551e87){return _0x9a15e8[_0xcacb('0x5')](_0xcacb('0x6'),attributes,{'tableName':_0xcacb('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b0=['api','moment','bluebird','request-promise','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger'];(function(_0xb48cde,_0x171ba0){var _0x974087=function(_0x5eb548){while(--_0x5eb548){_0xb48cde['push'](_0xb48cde['shift']());}};_0x974087(++_0x171ba0);}(_0x26b0,0x19f));var _0x026b=function(_0xe32406,_0x45e983){_0xe32406=_0xe32406-0x0;var _0x187a0b=_0x26b0[_0xe32406];return _0x187a0b;};'use strict';var _=require(_0x026b('0x0'));var util=require(_0x026b('0x1'));var logger=require(_0x026b('0x2'))(_0x026b('0x3'));var moment=require(_0x026b('0x4'));var BPromise=require(_0x026b('0x5'));var rp=require(_0x026b('0x6'));var attributes=require('./mailQueue.attributes');module[_0x026b('0x7')]=function(_0x3155e7,_0x4b7d47){return _0x3155e7[_0x026b('0x8')](_0x026b('0x9'),attributes,{'tableName':_0x026b('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 65fd009..b82bc54 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 _0xeae4=['options','raw','where','attributes','limit','include','model','map','MailQueue','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','socket.io-emitter','localhost','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','message','error','catch','GetMailQueue','findAll'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xeae4,0xe8));var _0x4eae=function(_0x442d09,_0x1cd5d6){_0x442d09=_0x442d09-0x0;var _0x438fb8=_0xeae4[_0x442d09];return _0x438fb8;};'use strict';var _=require(_0x4eae('0x0'));var util=require(_0x4eae('0x1'));var moment=require(_0x4eae('0x2'));var BPromise=require(_0x4eae('0x3'));var rs=require(_0x4eae('0x4'));var fs=require('fs');var db=require(_0x4eae('0x5'))['db'];var utils=require(_0x4eae('0x6'));var logger=require(_0x4eae('0x7'))(_0x4eae('0x8'));var config=require(_0x4eae('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4eae('0xa')]['http']({'port':0x232a});var socket=require(_0x4eae('0xb'))({'host':_0x4eae('0xc'),'port':0x18eb});require(_0x4eae('0xd'))[_0x4eae('0xe')](socket);function respondWithRpcPromise(_0x4c8b35,_0x1c8370,_0x4f7adc){return new BPromise(function(_0x35bb48,_0x3a7bb0){return client['request'](_0x4c8b35,_0x4f7adc)[_0x4eae('0xf')](function(_0x5df637){logger[_0x4eae('0x10')](_0x4eae('0x11'),_0x1c8370,_0x4eae('0x12'));logger[_0x4eae('0x13')](_0x4eae('0x14'),_0x1c8370,_0x4eae('0x12'),JSON[_0x4eae('0x15')](_0x5df637));if(_0x5df637['error']){if(_0x5df637['error']['code']===0x1f4){logger['error'](_0x4eae('0x11'),_0x1c8370,_0x5df637['error'][_0x4eae('0x16')]);return _0x3a7bb0(_0x5df637[_0x4eae('0x17')][_0x4eae('0x16')]);}logger[_0x4eae('0x17')](_0x4eae('0x11'),_0x1c8370,_0x5df637[_0x4eae('0x17')][_0x4eae('0x16')]);return _0x35bb48(_0x5df637[_0x4eae('0x17')][_0x4eae('0x16')]);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x1c8370,_0x4eae('0x12'));_0x35bb48(_0x5df637['result']['message']);}})[_0x4eae('0x18')](function(_0x5a95c0){logger[_0x4eae('0x17')](_0x4eae('0x11'),_0x1c8370,_0x5a95c0);_0x3a7bb0(_0x5a95c0);});});}exports[_0x4eae('0x19')]=function(_0x299b9c){var _0x4aafa3=this;return new Promise(function(_0x188e4c,_0x13c2fb){return db['MailQueue'][_0x4eae('0x1a')]({'raw':_0x299b9c['options']?_0x299b9c[_0x4eae('0x1b')][_0x4eae('0x1c')]===undefined?!![]:![]:!![],'where':_0x299b9c['options']?_0x299b9c[_0x4eae('0x1b')][_0x4eae('0x1d')]||null:null,'attributes':_0x299b9c[_0x4eae('0x1b')]?_0x299b9c['options'][_0x4eae('0x1e')]||null:null,'limit':_0x299b9c['options']?_0x299b9c[_0x4eae('0x1b')][_0x4eae('0x1f')]||null:null,'include':_0x299b9c['options']?_0x299b9c[_0x4eae('0x1b')][_0x4eae('0x20')]?_['map'](_0x299b9c['options'][_0x4eae('0x20')],function(_0x3c7b07){return{'model':db[_0x3c7b07[_0x4eae('0x21')]],'as':_0x3c7b07['as'],'attributes':_0x3c7b07[_0x4eae('0x1e')],'include':_0x3c7b07[_0x4eae('0x20')]?_[_0x4eae('0x22')](_0x3c7b07[_0x4eae('0x20')],function(_0x450433){return{'model':db[_0x450433['model']],'as':_0x450433['as'],'attributes':_0x450433[_0x4eae('0x1e')],'include':_0x450433['include']?_[_0x4eae('0x22')](_0x450433['include'],function(_0x334ca1){return{'model':db[_0x334ca1['model']],'as':_0x334ca1['as'],'attributes':_0x334ca1[_0x4eae('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1cf72e){logger[_0x4eae('0x10')](_0x4eae('0x19'),_0x299b9c);logger[_0x4eae('0x13')](_0x4eae('0x19'),_0x299b9c,JSON[_0x4eae('0x15')](_0x1cf72e));_0x188e4c(_0x1cf72e);})[_0x4eae('0x18')](function(_0x177aa4){logger[_0x4eae('0x17')](_0x4eae('0x19'),_0x177aa4[_0x4eae('0x16')],_0x299b9c);_0x13c2fb(_0x4aafa3[_0x4eae('0x17')](0x1f4,_0x177aa4[_0x4eae('0x16')]));});});};exports['ShowMailQueue']=function(_0x299c60){var _0x3df4e8=this;return new Promise(function(_0x5557a5,_0x38a415){return db[_0x4eae('0x23')]['find']({'raw':_0x299c60[_0x4eae('0x1b')]?_0x299c60[_0x4eae('0x1b')][_0x4eae('0x1c')]===undefined?!![]:![]:!![],'where':_0x299c60['options']?_0x299c60[_0x4eae('0x1b')]['where']||null:null,'attributes':_0x299c60[_0x4eae('0x1b')]?_0x299c60[_0x4eae('0x1b')][_0x4eae('0x1e')]||null:null,'include':_0x299c60['options']?_0x299c60[_0x4eae('0x1b')][_0x4eae('0x20')]?_[_0x4eae('0x22')](_0x299c60[_0x4eae('0x1b')]['include'],function(_0x5eb5e3){return{'model':db[_0x5eb5e3['model']],'as':_0x5eb5e3['as'],'attributes':_0x5eb5e3['attributes'],'include':_0x5eb5e3['include']?_[_0x4eae('0x22')](_0x5eb5e3[_0x4eae('0x20')],function(_0x372844){return{'model':db[_0x372844[_0x4eae('0x21')]],'as':_0x372844['as'],'attributes':_0x372844[_0x4eae('0x1e')],'include':_0x372844[_0x4eae('0x20')]?_[_0x4eae('0x22')](_0x372844[_0x4eae('0x20')],function(_0x196476){return{'model':db[_0x196476[_0x4eae('0x21')]],'as':_0x196476['as'],'attributes':_0x196476['attributes']};}):[]};}):[]};}):[]:[]})[_0x4eae('0xf')](function(_0x1fd534){logger[_0x4eae('0x10')](_0x4eae('0x24'),_0x299c60);logger['debug'](_0x4eae('0x24'),_0x299c60,JSON[_0x4eae('0x15')](_0x1fd534));_0x5557a5(_0x1fd534);})[_0x4eae('0x18')](function(_0x22ec98){logger['error'](_0x4eae('0x24'),_0x22ec98[_0x4eae('0x16')],_0x299c60);_0x38a415(_0x3df4e8[_0x4eae('0x17')](0x1f4,_0x22ec98[_0x4eae('0x16')]));});});}; \ No newline at end of file +var _0xb954=['findAll','options','raw','where','attributes','limit','map','include','model','debug','ShowMailQueue','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./mailQueue.socket','register','request','then','MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailQueue','MailQueue'];(function(_0xf6e834,_0x1b8457){var _0x1ce4c8=function(_0x361787){while(--_0x361787){_0xf6e834['push'](_0xf6e834['shift']());}};_0x1ce4c8(++_0x1b8457);}(_0xb954,0x115));var _0x4b95=function(_0x55456f,_0x3f561a){_0x55456f=_0x55456f-0x0;var _0x34d223=_0xb954[_0x55456f];return _0x34d223;};'use strict';var _=require(_0x4b95('0x0'));var util=require(_0x4b95('0x1'));var moment=require(_0x4b95('0x2'));var BPromise=require(_0x4b95('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x4b95('0x4'));var logger=require('../../config/logger')(_0x4b95('0x5'));var config=require(_0x4b95('0x6'));var jayson=require(_0x4b95('0x7'));var client=jayson[_0x4b95('0x8')]['http']({'port':0x232a});var socket=require(_0x4b95('0x9'))({'host':_0x4b95('0xa'),'port':0x18eb});require(_0x4b95('0xb'))[_0x4b95('0xc')](socket);function respondWithRpcPromise(_0xe9710c,_0x2d2116,_0x3997f7){return new BPromise(function(_0x10d1ef,_0x4869a5){return client[_0x4b95('0xd')](_0xe9710c,_0x3997f7)[_0x4b95('0xe')](function(_0x293a63){logger['info'](_0x4b95('0xf'),_0x2d2116,_0x4b95('0x10'));logger['debug'](_0x4b95('0x11'),_0x2d2116,_0x4b95('0x10'),JSON[_0x4b95('0x12')](_0x293a63));if(_0x293a63[_0x4b95('0x13')]){if(_0x293a63['error'][_0x4b95('0x14')]===0x1f4){logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x293a63[_0x4b95('0x13')]['message']);return _0x4869a5(_0x293a63['error'][_0x4b95('0x15')]);}logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x293a63[_0x4b95('0x13')][_0x4b95('0x15')]);return _0x10d1ef(_0x293a63['error'][_0x4b95('0x15')]);}else{logger[_0x4b95('0x16')](_0x4b95('0xf'),_0x2d2116,_0x4b95('0x10'));_0x10d1ef(_0x293a63[_0x4b95('0x17')][_0x4b95('0x15')]);}})[_0x4b95('0x18')](function(_0x530676){logger[_0x4b95('0x13')](_0x4b95('0xf'),_0x2d2116,_0x530676);_0x4869a5(_0x530676);});});}exports[_0x4b95('0x19')]=function(_0x6d4313){var _0x5a4b66=this;return new Promise(function(_0x565915,_0x3c9a98){return db[_0x4b95('0x1a')][_0x4b95('0x1b')]({'raw':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1d')]===undefined?!![]:![]:!![],'where':_0x6d4313['options']?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1e')]||null:null,'attributes':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x1f')]||null:null,'limit':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x20')]||null:null,'include':_0x6d4313[_0x4b95('0x1c')]?_0x6d4313[_0x4b95('0x1c')]['include']?_[_0x4b95('0x21')](_0x6d4313[_0x4b95('0x1c')][_0x4b95('0x22')],function(_0x4e12b7){return{'model':db[_0x4e12b7[_0x4b95('0x23')]],'as':_0x4e12b7['as'],'attributes':_0x4e12b7[_0x4b95('0x1f')],'include':_0x4e12b7[_0x4b95('0x22')]?_['map'](_0x4e12b7[_0x4b95('0x22')],function(_0x1b60f9){return{'model':db[_0x1b60f9[_0x4b95('0x23')]],'as':_0x1b60f9['as'],'attributes':_0x1b60f9['attributes'],'include':_0x1b60f9[_0x4b95('0x22')]?_['map'](_0x1b60f9[_0x4b95('0x22')],function(_0x4fad1a){return{'model':db[_0x4fad1a[_0x4b95('0x23')]],'as':_0x4fad1a['as'],'attributes':_0x4fad1a[_0x4b95('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4b95('0xe')](function(_0x11ea9a){logger[_0x4b95('0x16')](_0x4b95('0x19'),_0x6d4313);logger[_0x4b95('0x24')](_0x4b95('0x19'),_0x6d4313,JSON[_0x4b95('0x12')](_0x11ea9a));_0x565915(_0x11ea9a);})['catch'](function(_0x3c2b89){logger[_0x4b95('0x13')](_0x4b95('0x19'),_0x3c2b89[_0x4b95('0x15')],_0x6d4313);_0x3c9a98(_0x5a4b66[_0x4b95('0x13')](0x1f4,_0x3c2b89['message']));});});};exports[_0x4b95('0x25')]=function(_0xc8d8ac){var _0x1e17c1=this;return new Promise(function(_0x398d3a,_0x420616){return db[_0x4b95('0x1a')]['find']({'raw':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x1d')]===undefined?!![]:![]:!![],'where':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x1e')]||null:null,'attributes':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac[_0x4b95('0x1c')]['attributes']||null:null,'include':_0xc8d8ac[_0x4b95('0x1c')]?_0xc8d8ac['options']['include']?_[_0x4b95('0x21')](_0xc8d8ac[_0x4b95('0x1c')][_0x4b95('0x22')],function(_0x53c82c){return{'model':db[_0x53c82c[_0x4b95('0x23')]],'as':_0x53c82c['as'],'attributes':_0x53c82c['attributes'],'include':_0x53c82c[_0x4b95('0x22')]?_['map'](_0x53c82c[_0x4b95('0x22')],function(_0x1b0bbd){return{'model':db[_0x1b0bbd['model']],'as':_0x1b0bbd['as'],'attributes':_0x1b0bbd['attributes'],'include':_0x1b0bbd['include']?_[_0x4b95('0x21')](_0x1b0bbd['include'],function(_0x573310){return{'model':db[_0x573310[_0x4b95('0x23')]],'as':_0x573310['as'],'attributes':_0x573310['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x35eae9){logger[_0x4b95('0x16')](_0x4b95('0x25'),_0xc8d8ac);logger[_0x4b95('0x24')]('ShowMailQueue',_0xc8d8ac,JSON[_0x4b95('0x12')](_0x35eae9));_0x398d3a(_0x35eae9);})['catch'](function(_0x4cf517){logger[_0x4b95('0x13')](_0x4b95('0x25'),_0x4cf517['message'],_0xc8d8ac);_0x420616(_0x1e17c1['error'](0x1f4,_0x4cf517[_0x4b95('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d74820a..fd94827 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 _0x4485=['./mailQueue.events','save','update','emit','removeListener','length','mailQueue:'];(function(_0x211936,_0x499910){var _0x149913=function(_0x4f6077){while(--_0x4f6077){_0x211936['push'](_0x211936['shift']());}};_0x149913(++_0x499910);}(_0x4485,0x1ce));var _0x5448=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0x4485[_0xd3b0ac];return _0x3d773e;};'use strict';var MailQueueEvents=require(_0x5448('0x0'));var events=[_0x5448('0x1'),'remove',_0x5448('0x2')];function createListener(_0x24e7f4,_0xb79d3f){return function(_0xa56b82){_0xb79d3f[_0x5448('0x3')](_0x24e7f4,_0xa56b82);};}function removeListener(_0x576305,_0x16f3ae){return function(){MailQueueEvents[_0x5448('0x4')](_0x576305,_0x16f3ae);};}exports['register']=function(_0x36737d){for(var _0x347c82=0x0,_0x54577a=events[_0x5448('0x5')];_0x347c82<_0x54577a;_0x347c82++){var _0x5ab7be=events[_0x347c82];var _0x2a6ca3=createListener(_0x5448('0x6')+_0x5ab7be,_0x36737d);MailQueueEvents['on'](_0x5ab7be,_0x2a6ca3);}}; \ No newline at end of file +var _0x2f33=['save','remove','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x5254ea,_0x1af3fd){var _0x192890=function(_0x33bd22){while(--_0x33bd22){_0x5254ea['push'](_0x5254ea['shift']());}};_0x192890(++_0x1af3fd);}(_0x2f33,0xdf));var _0x32f3=function(_0x2c9f41,_0x133c52){_0x2c9f41=_0x2c9f41-0x0;var _0x19e2fa=_0x2f33[_0x2c9f41];return _0x19e2fa;};'use strict';var MailQueueEvents=require(_0x32f3('0x0'));var events=[_0x32f3('0x1'),_0x32f3('0x2'),'update'];function createListener(_0x5f24dd,_0xa0d64a){return function(_0x55d536){_0xa0d64a[_0x32f3('0x3')](_0x5f24dd,_0x55d536);};}function removeListener(_0x443e9d,_0x222516){return function(){MailQueueEvents[_0x32f3('0x4')](_0x443e9d,_0x222516);};}exports[_0x32f3('0x5')]=function(_0x311fb1){for(var _0x343890=0x0,_0x1ef5a5=events[_0x32f3('0x6')];_0x343890<_0x1ef5a5;_0x343890++){var _0xf7a85f=events[_0x343890];var _0x3c8c98=createListener(_0x32f3('0x7')+_0xf7a85f,_0x311fb1);MailQueueEvents['on'](_0xf7a85f,_0x3c8c98);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 6025254..470c472 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 _0xe1b1=['put','update','delete','multer','util','path','express','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xe1b1,0x17d));var _0x1e1b=function(_0x301eed,_0x27ec5b){_0x301eed=_0x301eed-0x0;var _0x1a85d8=_0xe1b1[_0x301eed];return _0x1a85d8;};'use strict';var multer=require(_0x1e1b('0x0'));var util=require(_0x1e1b('0x1'));var path=require(_0x1e1b('0x2'));var express=require(_0x1e1b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1e1b('0x4'));var config=require(_0x1e1b('0x5'));var controller=require(_0x1e1b('0x6'));router[_0x1e1b('0x7')]('/',auth[_0x1e1b('0x8')](),controller[_0x1e1b('0x9')]);router[_0x1e1b('0x7')]('/describe',auth[_0x1e1b('0x8')](),controller[_0x1e1b('0xa')]);router['get'](_0x1e1b('0xb'),auth[_0x1e1b('0x8')](),controller[_0x1e1b('0xc')]);router[_0x1e1b('0xd')]('/',auth[_0x1e1b('0x8')](),controller[_0x1e1b('0xe')]);router[_0x1e1b('0xf')](_0x1e1b('0xb'),auth[_0x1e1b('0x8')](),controller[_0x1e1b('0x10')]);router[_0x1e1b('0x11')](_0x1e1b('0xb'),auth[_0x1e1b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbcf5=['../../config/environment','./mailQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','post','create','put','update','delete','multer','path','express','../../components/interaction/service'];(function(_0xb3caf6,_0x1e0b11){var _0x241c56=function(_0x26b5f3){while(--_0x26b5f3){_0xb3caf6['push'](_0xb3caf6['shift']());}};_0x241c56(++_0x1e0b11);}(_0xbcf5,0xec));var _0x5bcf=function(_0xefa912,_0x290e4f){_0xefa912=_0xefa912-0x0;var _0x3e73c0=_0xbcf5[_0xefa912];return _0x3e73c0;};'use strict';var multer=require(_0x5bcf('0x0'));var util=require('util');var path=require(_0x5bcf('0x1'));var express=require(_0x5bcf('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5bcf('0x3'));var config=require(_0x5bcf('0x4'));var controller=require(_0x5bcf('0x5'));router['get']('/',auth[_0x5bcf('0x6')](),controller['index']);router[_0x5bcf('0x7')](_0x5bcf('0x8'),auth['isAuthenticated'](),controller[_0x5bcf('0x9')]);router[_0x5bcf('0x7')](_0x5bcf('0xa'),auth[_0x5bcf('0x6')](),controller['show']);router[_0x5bcf('0xb')]('/',auth[_0x5bcf('0x6')](),controller[_0x5bcf('0xc')]);router[_0x5bcf('0xd')]('/:id',auth[_0x5bcf('0x6')](),controller[_0x5bcf('0xe')]);router[_0x5bcf('0xf')](_0x5bcf('0xa'),auth[_0x5bcf('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e98917f..97177a3 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 _0x49fe=['DATE','moment','STRING'];(function(_0x1fd441,_0x2629bf){var _0x411a91=function(_0x5d14e3){while(--_0x5d14e3){_0x1fd441['push'](_0x1fd441['shift']());}};_0x411a91(++_0x2629bf);}(_0x49fe,0x154));var _0xe49f=function(_0x1877bb,_0x69b635){_0x1877bb=_0x1877bb-0x0;var _0x49abd8=_0x49fe[_0x1877bb];return _0x49abd8;};'use strict';var moment=require(_0xe49f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xe49f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xe49f('0x1')]},'joinAt':{'type':Sequelize[_0xe49f('0x2')]},'leaveAt':{'type':Sequelize[_0xe49f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe49f('0x2')]},'reason':{'type':Sequelize[_0xe49f('0x1')]}}; \ No newline at end of file +var _0x1953=['moment','sequelize','STRING','DATE'];(function(_0x6de927,_0x497926){var _0x30b526=function(_0x406b9b){while(--_0x406b9b){_0x6de927['push'](_0x6de927['shift']());}};_0x30b526(++_0x497926);}(_0x1953,0x144));var _0x3195=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1953[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x3195('0x0'));var Sequelize=require(_0x3195('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3195('0x2')]},'joinAt':{'type':Sequelize[_0x3195('0x3')]},'leaveAt':{'type':Sequelize[_0x3195('0x3')]},'acceptAt':{'type':Sequelize[_0x3195('0x3')]},'exitAt':{'type':Sequelize[_0x3195('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ad9c9a8..2218b03 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 _0xa9cc=['describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','add','merge','filter','map','options','MailQueueReport','count','includeAll','include','findAll','rows','catch','show','find','body','params','destroy'];(function(_0x485989,_0x42c5f0){var _0x45ce9d=function(_0x15fb1a){while(--_0x15fb1a){_0x485989['push'](_0x485989['shift']());}};_0x45ce9d(++_0x42c5f0);}(_0xa9cc,0x1dd));var _0xca9c=function(_0x9cd148,_0x5982a9){_0x9cd148=_0x9cd148-0x0;var _0x76a87f=_0xa9cc[_0x9cd148];return _0x76a87f;};'use strict';var jsonpatch=require(_0xca9c('0x0'));var rp=require('request-promise');var moment=require(_0xca9c('0x1'));var BPromise=require(_0xca9c('0x2'));var Mustache=require(_0xca9c('0x3'));var util=require(_0xca9c('0x4'));var path=require(_0xca9c('0x5'));var sox=require(_0xca9c('0x6'));var csv=require(_0xca9c('0x7'));var ejs=require(_0xca9c('0x8'));var fs=require('fs');var _=require(_0xca9c('0x9'));var squel=require(_0xca9c('0xa'));var crypto=require('crypto');var jsforce=require(_0xca9c('0xb'));var deskjs=require(_0xca9c('0xc'));var toCsv=require(_0xca9c('0x7'));var querystring=require(_0xca9c('0xd'));var Papa=require('papaparse');var qs=require(_0xca9c('0xe'));var logger=require(_0xca9c('0xf'))(_0xca9c('0x10'));var utils=require(_0xca9c('0x11'));var config=require(_0xca9c('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x312a3c,_0x58d8dd){_0x58d8dd=_0x58d8dd||0xcc;return function(_0x96e880){if(_0x96e880){return _0x312a3c[_0xca9c('0x13')](_0x58d8dd);}return _0x312a3c['status'](_0x58d8dd)['end']();};}function respondWithResult(_0x5033bb,_0x5e824f){_0x5e824f=_0x5e824f||0xc8;return function(_0x27da60){if(_0x27da60){return _0x5033bb[_0xca9c('0x14')](_0x5e824f)[_0xca9c('0x15')](_0x27da60);}};}function respondWithFilteredResult(_0x6664d2,_0x4fed2e){return function(_0x49b0c6){if(_0x49b0c6){var _0x2939ba=_0x49b0c6['count'],_0x28f07e=_0x4fed2e['offset'],_0x6114f7=_0x4fed2e[_0xca9c('0x16')]+_0x4fed2e[_0xca9c('0x17')],_0x3f36d6;if(_0x6114f7>=_0x2939ba){_0x6114f7=_0x2939ba;_0x3f36d6=0xc8;}else{_0x3f36d6=0xce;}_0x6664d2['status'](_0x3f36d6);return _0x6664d2[_0xca9c('0x18')](_0xca9c('0x19'),_0x28f07e+'-'+_0x6114f7+'/'+_0x2939ba)[_0xca9c('0x15')](_0x49b0c6);}return null;};}function patchUpdates(_0x3ed31f){return function(_0x48b4ca){try{jsonpatch[_0xca9c('0x1a')](_0x48b4ca,_0x3ed31f,!![]);}catch(_0x3e5830){return BPromise[_0xca9c('0x1b')](_0x3e5830);}return _0x48b4ca[_0xca9c('0x1c')]();};}function saveUpdates(_0x583705,_0x1fdc20){return function(_0x5c6617){if(_0x5c6617){return _0x5c6617[_0xca9c('0x1d')](_0x583705)[_0xca9c('0x1e')](function(_0x1e4d12){return _0x1e4d12;});}return null;};}function removeEntity(_0x308427,_0x567021){return function(_0x1855b4){if(_0x1855b4){return _0x1855b4['destroy']()['then'](function(){_0x308427['status'](0xcc)[_0xca9c('0x1f')]();});}};}function handleEntityNotFound(_0x34d1fe,_0x5b8270){return function(_0x13dfdd){if(!_0x13dfdd){_0x34d1fe[_0xca9c('0x13')](0x194);}return _0x13dfdd;};}function handleError(_0x15f616,_0x7f1ac9){_0x7f1ac9=_0x7f1ac9||0x1f4;return function(_0x46aedf){logger['error'](_0x46aedf[_0xca9c('0x20')]);if(_0x46aedf[_0xca9c('0x21')]){delete _0x46aedf[_0xca9c('0x21')];}_0x15f616[_0xca9c('0x14')](_0x7f1ac9)[_0xca9c('0x22')](_0x46aedf);};}exports['index']=function(_0x4c6bab,_0x212fde){var _0x3d96f5={},_0x4468da={},_0x140d52={'count':0x0,'rows':[]};var _0x3eab78=db['MailQueueReport'][_0xca9c('0x23')];_0x4468da[_0xca9c('0x24')]=_['keys'](_0x3eab78);var _0x4e383d={'dateStart':_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x26')],'dateEnd':_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x27')]};delete _0x4c6bab['query']['dateStart'];delete _0x4c6bab[_0xca9c('0x25')][_0xca9c('0x27')];_0x4468da[_0xca9c('0x25')]=_[_0xca9c('0x28')](_0x4c6bab[_0xca9c('0x25')]);_0x4468da[_0xca9c('0x29')]=_[_0xca9c('0x2a')](_0x4468da[_0xca9c('0x24')],_0x4468da[_0xca9c('0x25')]);_0x3d96f5[_0xca9c('0x2b')]=_[_0xca9c('0x2a')](_0x4468da[_0xca9c('0x24')],qs[_0xca9c('0x2c')](_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x2c')]));_0x3d96f5[_0xca9c('0x2b')]=_0x3d96f5[_0xca9c('0x2b')][_0xca9c('0x2d')]?_0x3d96f5[_0xca9c('0x2b')]:_0x4468da[_0xca9c('0x24')];if(!_0x4c6bab[_0xca9c('0x25')]['hasOwnProperty'](_0xca9c('0x2e'))){_0x3d96f5['limit']=qs[_0xca9c('0x17')](_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x17')]);_0x3d96f5[_0xca9c('0x16')]=qs[_0xca9c('0x16')](_0x4c6bab['query'][_0xca9c('0x16')]);}_0x3d96f5[_0xca9c('0x2f')]=qs[_0xca9c('0x30')](_0x4c6bab['query'][_0xca9c('0x30')]);_0x3d96f5[_0xca9c('0x31')]=qs[_0xca9c('0x29')](_['pick'](_0x4c6bab[_0xca9c('0x25')],_0x4468da[_0xca9c('0x29')]));if(_0x4e383d['dateStart']){if(_0x4e383d[_0xca9c('0x27')]){_0x4e383d[_0xca9c('0x27')]=moment(_0x4e383d['dateEnd'])['add'](0x1,'day');}else{_0x4e383d['dateEnd']=moment(_0x4e383d[_0xca9c('0x26')])[_0xca9c('0x32')](0x1,'day');}_[_0xca9c('0x33')](_0x3d96f5[_0xca9c('0x31')],{'createdAt':{'$gte':_0x4e383d['dateStart'],'$lte':_0x4e383d[_0xca9c('0x27')]}});}if(_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x34')]){_0x3d96f5[_0xca9c('0x31')]=_[_0xca9c('0x33')](_0x3d96f5[_0xca9c('0x31')],{'$or':_[_0xca9c('0x35')](_0x3d96f5[_0xca9c('0x2b')],function(_0x17e40f){var _0x27ca20={};_0x27ca20[_0x17e40f]={'$like':'%'+_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x34')]+'%'};return _0x27ca20;})});}_0x3d96f5=_['merge']({},_0x3d96f5,_0x4c6bab[_0xca9c('0x36')]);var _0x5bcf3f={'where':_0x3d96f5['where']};return db[_0xca9c('0x37')][_0xca9c('0x38')](_0x5bcf3f)['then'](function(_0x3a03e9){_0x140d52[_0xca9c('0x38')]=_0x3a03e9;if(_0x4c6bab[_0xca9c('0x25')][_0xca9c('0x39')]){_0x3d96f5[_0xca9c('0x3a')]=[{'all':!![]}];}return db[_0xca9c('0x37')][_0xca9c('0x3b')](_0x3d96f5);})['then'](function(_0x1b7d9e){_0x140d52[_0xca9c('0x3c')]=_0x1b7d9e;return _0x140d52;})[_0xca9c('0x1e')](respondWithFilteredResult(_0x212fde,_0x3d96f5))[_0xca9c('0x3d')](handleError(_0x212fde,null));};exports[_0xca9c('0x3e')]=function(_0x379d76,_0x2a5cc7){var _0x3bca4e={'raw':!![],'where':{'id':_0x379d76['params']['id']}},_0x23196f={};_0x23196f[_0xca9c('0x24')]=_[_0xca9c('0x28')](db[_0xca9c('0x37')][_0xca9c('0x23')]);_0x23196f[_0xca9c('0x25')]=_[_0xca9c('0x28')](_0x379d76[_0xca9c('0x25')]);_0x23196f[_0xca9c('0x29')]=_['intersection'](_0x23196f[_0xca9c('0x24')],_0x23196f['query']);_0x3bca4e[_0xca9c('0x2b')]=_[_0xca9c('0x2a')](_0x23196f['model'],qs['fields'](_0x379d76['query'][_0xca9c('0x2c')]));_0x3bca4e[_0xca9c('0x2b')]=_0x3bca4e['attributes'][_0xca9c('0x2d')]?_0x3bca4e[_0xca9c('0x2b')]:_0x23196f[_0xca9c('0x24')];if(_0x379d76[_0xca9c('0x25')][_0xca9c('0x39')]){_0x3bca4e['include']=[{'all':!![]}];}_0x3bca4e=_[_0xca9c('0x33')]({},_0x3bca4e,_0x379d76[_0xca9c('0x36')]);return db[_0xca9c('0x37')][_0xca9c('0x3f')](_0x3bca4e)[_0xca9c('0x1e')](handleEntityNotFound(_0x2a5cc7,null))[_0xca9c('0x1e')](respondWithResult(_0x2a5cc7,null))[_0xca9c('0x3d')](handleError(_0x2a5cc7,null));};exports['create']=function(_0x286929,_0x743c40){return db[_0xca9c('0x37')]['create'](_0x286929[_0xca9c('0x40')],{})[_0xca9c('0x1e')](respondWithResult(_0x743c40,0xc9))[_0xca9c('0x3d')](handleError(_0x743c40,null));};exports['update']=function(_0x314858,_0x1cc4df){if(_0x314858['body']['id']){delete _0x314858[_0xca9c('0x40')]['id'];}return db['MailQueueReport'][_0xca9c('0x3f')]({'where':{'id':_0x314858[_0xca9c('0x41')]['id']}})[_0xca9c('0x1e')](handleEntityNotFound(_0x1cc4df,null))[_0xca9c('0x1e')](saveUpdates(_0x314858['body'],null))[_0xca9c('0x1e')](respondWithResult(_0x1cc4df,null))['catch'](handleError(_0x1cc4df,null));};exports[_0xca9c('0x42')]=function(_0x20e6cd,_0x3047fb){return db[_0xca9c('0x37')][_0xca9c('0x3f')]({'where':{'id':_0x20e6cd[_0xca9c('0x41')]['id']}})[_0xca9c('0x1e')](handleEntityNotFound(_0x3047fb,null))[_0xca9c('0x1e')](removeEntity(_0x3047fb,null))['catch'](handleError(_0x3047fb,null));};exports[_0xca9c('0x43')]=function(_0x5addf5,_0x49f0ed){return db[_0xca9c('0x37')]['describe']()[_0xca9c('0x1e')](respondWithResult(_0x49f0ed,null))[_0xca9c('0x3d')](handleError(_0x49f0ed,null));}; \ No newline at end of file +var _0x7ba4=['include','findAll','catch','show','params','find','create','body','update','describe','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','MailQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','filter','map','options'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7ba4,0x1ca));var _0x47ba=function(_0x55d2d1,_0x280954){_0x55d2d1=_0x55d2d1-0x0;var _0x39769d=_0x7ba4[_0x55d2d1];return _0x39769d;};'use strict';var jsonpatch=require(_0x47ba('0x0'));var rp=require('request-promise');var moment=require(_0x47ba('0x1'));var BPromise=require(_0x47ba('0x2'));var Mustache=require('mustache');var util=require(_0x47ba('0x3'));var path=require('path');var sox=require(_0x47ba('0x4'));var csv=require(_0x47ba('0x5'));var ejs=require(_0x47ba('0x6'));var fs=require('fs');var _=require(_0x47ba('0x7'));var squel=require(_0x47ba('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x47ba('0x5'));var querystring=require(_0x47ba('0x9'));var Papa=require('papaparse');var qs=require(_0x47ba('0xa'));var logger=require(_0x47ba('0xb'))('api');var utils=require(_0x47ba('0xc'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x475636,_0x461c6f){_0x461c6f=_0x461c6f||0xcc;return function(_0x5b8cb7){if(_0x5b8cb7){return _0x475636[_0x47ba('0xd')](_0x461c6f);}return _0x475636[_0x47ba('0xe')](_0x461c6f)[_0x47ba('0xf')]();};}function respondWithResult(_0x17f370,_0x3e738d){_0x3e738d=_0x3e738d||0xc8;return function(_0x3100c0){if(_0x3100c0){return _0x17f370[_0x47ba('0xe')](_0x3e738d)[_0x47ba('0x10')](_0x3100c0);}};}function respondWithFilteredResult(_0x2642f7,_0x1a55ba){return function(_0x546c92){if(_0x546c92){var _0xd823a0=_0x546c92[_0x47ba('0x11')],_0x5bfbab=_0x1a55ba[_0x47ba('0x12')],_0x567f33=_0x1a55ba['offset']+_0x1a55ba[_0x47ba('0x13')],_0x3bc254;if(_0x567f33>=_0xd823a0){_0x567f33=_0xd823a0;_0x3bc254=0xc8;}else{_0x3bc254=0xce;}_0x2642f7[_0x47ba('0xe')](_0x3bc254);return _0x2642f7[_0x47ba('0x14')](_0x47ba('0x15'),_0x5bfbab+'-'+_0x567f33+'/'+_0xd823a0)[_0x47ba('0x10')](_0x546c92);}return null;};}function patchUpdates(_0x1ea242){return function(_0x269eb3){try{jsonpatch[_0x47ba('0x16')](_0x269eb3,_0x1ea242,!![]);}catch(_0x1d4956){return BPromise[_0x47ba('0x17')](_0x1d4956);}return _0x269eb3[_0x47ba('0x18')]();};}function saveUpdates(_0x4aa3c7,_0x2d1063){return function(_0x1077a7){if(_0x1077a7){return _0x1077a7['update'](_0x4aa3c7)[_0x47ba('0x19')](function(_0x2d6ea6){return _0x2d6ea6;});}return null;};}function removeEntity(_0x64e5ca,_0x4ddbb4){return function(_0x549720){if(_0x549720){return _0x549720[_0x47ba('0x1a')]()['then'](function(){_0x64e5ca['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x479781,_0x56812d){return function(_0x369328){if(!_0x369328){_0x479781[_0x47ba('0xd')](0x194);}return _0x369328;};}function handleError(_0x543aff,_0x32cd88){_0x32cd88=_0x32cd88||0x1f4;return function(_0x474e2f){logger[_0x47ba('0x1b')](_0x474e2f[_0x47ba('0x1c')]);if(_0x474e2f['name']){delete _0x474e2f[_0x47ba('0x1d')];}_0x543aff[_0x47ba('0xe')](_0x32cd88)[_0x47ba('0x1e')](_0x474e2f);};}exports['index']=function(_0x4c06c7,_0x74f205){var _0x24610c={},_0x130aa1={},_0x3ff585={'count':0x0,'rows':[]};var _0x3a66cb=db[_0x47ba('0x1f')][_0x47ba('0x20')];_0x130aa1[_0x47ba('0x21')]=_[_0x47ba('0x22')](_0x3a66cb);var _0x25554a={'dateStart':_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x24')],'dateEnd':_0x4c06c7['query'][_0x47ba('0x25')]};delete _0x4c06c7['query'][_0x47ba('0x24')];delete _0x4c06c7['query'][_0x47ba('0x25')];_0x130aa1['query']=_[_0x47ba('0x22')](_0x4c06c7[_0x47ba('0x23')]);_0x130aa1[_0x47ba('0x26')]=_[_0x47ba('0x27')](_0x130aa1[_0x47ba('0x21')],_0x130aa1['query']);_0x24610c[_0x47ba('0x28')]=_[_0x47ba('0x27')](_0x130aa1['model'],qs[_0x47ba('0x29')](_0x4c06c7['query'][_0x47ba('0x29')]));_0x24610c['attributes']=_0x24610c[_0x47ba('0x28')][_0x47ba('0x2a')]?_0x24610c[_0x47ba('0x28')]:_0x130aa1[_0x47ba('0x21')];if(!_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x2b')](_0x47ba('0x2c'))){_0x24610c['limit']=qs['limit'](_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x13')]);_0x24610c[_0x47ba('0x12')]=qs['offset'](_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x12')]);}_0x24610c['order']=qs[_0x47ba('0x2d')](_0x4c06c7[_0x47ba('0x23')]['sort']);_0x24610c[_0x47ba('0x2e')]=qs[_0x47ba('0x26')](_[_0x47ba('0x2f')](_0x4c06c7['query'],_0x130aa1[_0x47ba('0x26')]));if(_0x25554a['dateStart']){if(_0x25554a[_0x47ba('0x25')]){_0x25554a[_0x47ba('0x25')]=moment(_0x25554a['dateEnd'])[_0x47ba('0x30')](0x1,_0x47ba('0x31'));}else{_0x25554a[_0x47ba('0x25')]=moment(_0x25554a[_0x47ba('0x24')])['add'](0x1,_0x47ba('0x31'));}_[_0x47ba('0x32')](_0x24610c['where'],{'createdAt':{'$gte':_0x25554a[_0x47ba('0x24')],'$lte':_0x25554a[_0x47ba('0x25')]}});}if(_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x33')]){_0x24610c[_0x47ba('0x2e')]=_[_0x47ba('0x32')](_0x24610c[_0x47ba('0x2e')],{'$or':_[_0x47ba('0x34')](_0x24610c[_0x47ba('0x28')],function(_0x384bff){var _0x334142={};_0x334142[_0x384bff]={'$like':'%'+_0x4c06c7[_0x47ba('0x23')][_0x47ba('0x33')]+'%'};return _0x334142;})});}_0x24610c=_[_0x47ba('0x32')]({},_0x24610c,_0x4c06c7[_0x47ba('0x35')]);var _0x344ee7={'where':_0x24610c['where']};return db[_0x47ba('0x1f')]['count'](_0x344ee7)[_0x47ba('0x19')](function(_0xa30aa0){_0x3ff585[_0x47ba('0x11')]=_0xa30aa0;if(_0x4c06c7[_0x47ba('0x23')]['includeAll']){_0x24610c[_0x47ba('0x36')]=[{'all':!![]}];}return db['MailQueueReport'][_0x47ba('0x37')](_0x24610c);})['then'](function(_0xb90c02){_0x3ff585['rows']=_0xb90c02;return _0x3ff585;})[_0x47ba('0x19')](respondWithFilteredResult(_0x74f205,_0x24610c))[_0x47ba('0x38')](handleError(_0x74f205,null));};exports[_0x47ba('0x39')]=function(_0x923aaf,_0x564ff9){var _0x7bee4c={'raw':!![],'where':{'id':_0x923aaf[_0x47ba('0x3a')]['id']}},_0x2ca811={};_0x2ca811['model']=_[_0x47ba('0x22')](db[_0x47ba('0x1f')][_0x47ba('0x20')]);_0x2ca811[_0x47ba('0x23')]=_[_0x47ba('0x22')](_0x923aaf[_0x47ba('0x23')]);_0x2ca811[_0x47ba('0x26')]=_[_0x47ba('0x27')](_0x2ca811['model'],_0x2ca811['query']);_0x7bee4c[_0x47ba('0x28')]=_[_0x47ba('0x27')](_0x2ca811[_0x47ba('0x21')],qs[_0x47ba('0x29')](_0x923aaf[_0x47ba('0x23')][_0x47ba('0x29')]));_0x7bee4c['attributes']=_0x7bee4c[_0x47ba('0x28')][_0x47ba('0x2a')]?_0x7bee4c[_0x47ba('0x28')]:_0x2ca811[_0x47ba('0x21')];if(_0x923aaf[_0x47ba('0x23')]['includeAll']){_0x7bee4c[_0x47ba('0x36')]=[{'all':!![]}];}_0x7bee4c=_[_0x47ba('0x32')]({},_0x7bee4c,_0x923aaf[_0x47ba('0x35')]);return db['MailQueueReport'][_0x47ba('0x3b')](_0x7bee4c)[_0x47ba('0x19')](handleEntityNotFound(_0x564ff9,null))['then'](respondWithResult(_0x564ff9,null))[_0x47ba('0x38')](handleError(_0x564ff9,null));};exports[_0x47ba('0x3c')]=function(_0x1b3cef,_0x58f5f6){return db[_0x47ba('0x1f')][_0x47ba('0x3c')](_0x1b3cef[_0x47ba('0x3d')],{})[_0x47ba('0x19')](respondWithResult(_0x58f5f6,0xc9))['catch'](handleError(_0x58f5f6,null));};exports[_0x47ba('0x3e')]=function(_0x20348d,_0x54487d){if(_0x20348d[_0x47ba('0x3d')]['id']){delete _0x20348d[_0x47ba('0x3d')]['id'];}return db[_0x47ba('0x1f')][_0x47ba('0x3b')]({'where':{'id':_0x20348d[_0x47ba('0x3a')]['id']}})[_0x47ba('0x19')](handleEntityNotFound(_0x54487d,null))[_0x47ba('0x19')](saveUpdates(_0x20348d[_0x47ba('0x3d')],null))[_0x47ba('0x19')](respondWithResult(_0x54487d,null))[_0x47ba('0x38')](handleError(_0x54487d,null));};exports[_0x47ba('0x1a')]=function(_0x10afb5,_0x12e170){return db[_0x47ba('0x1f')][_0x47ba('0x3b')]({'where':{'id':_0x10afb5['params']['id']}})[_0x47ba('0x19')](handleEntityNotFound(_0x12e170,null))[_0x47ba('0x19')](removeEntity(_0x12e170,null))[_0x47ba('0x38')](handleError(_0x12e170,null));};exports[_0x47ba('0x3f')]=function(_0x5123c1,_0x20b719){return db['MailQueueReport']['describe']()[_0x47ba('0x19')](respondWithResult(_0x20b719,null))[_0x47ba('0x38')](handleError(_0x20b719,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index da55ed9..51f55ae 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 _0x5bcd=['MailQueueReport','report_mail_queue','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','./mailQueueReport.attributes','exports','define'];(function(_0x16cfae,_0x3c3596){var _0x5a04cf=function(_0x578063){while(--_0x578063){_0x16cfae['push'](_0x16cfae['shift']());}};_0x5a04cf(++_0x3c3596);}(_0x5bcd,0x10b));var _0xd5bc=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5bcd[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0xd5bc('0x0'));var util=require('util');var logger=require(_0xd5bc('0x1'))(_0xd5bc('0x2'));var moment=require('moment');var BPromise=require(_0xd5bc('0x3'));var rp=require(_0xd5bc('0x4'));var attributes=require(_0xd5bc('0x5'));module[_0xd5bc('0x6')]=function(_0x488ad6,_0x329f26){return _0x488ad6[_0xd5bc('0x7')](_0xd5bc('0x8'),attributes,{'tableName':_0xd5bc('0x9'),'paranoid':![],'indexes':[{'name':_0xd5bc('0xa'),'fields':[_0xd5bc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b9c=['lodash','util','../../config/logger','api','moment','bluebird','exports','define','MailQueueReport','uniqueid'];(function(_0x391ddf,_0x1baaed){var _0x8fe7b0=function(_0x204aa9){while(--_0x204aa9){_0x391ddf['push'](_0x391ddf['shift']());}};_0x8fe7b0(++_0x1baaed);}(_0x9b9c,0xf0));var _0xc9b9=function(_0x23827e,_0x31b0e0){_0x23827e=_0x23827e-0x0;var _0x9acf45=_0x9b9c[_0x23827e];return _0x9acf45;};'use strict';var _=require(_0xc9b9('0x0'));var util=require(_0xc9b9('0x1'));var logger=require(_0xc9b9('0x2'))(_0xc9b9('0x3'));var moment=require(_0xc9b9('0x4'));var BPromise=require(_0xc9b9('0x5'));var rp=require('request-promise');var attributes=require('./mailQueueReport.attributes');module[_0xc9b9('0x6')]=function(_0x5dc3a1,_0x436401){return _0x5dc3a1[_0xc9b9('0x7')](_0xc9b9('0x8'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xc9b9('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index be8cbea..5397b9d 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 _0xf1e8=['result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','MailQueueReport,\x20%s,\x20%s','debug','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x439949,_0x434aa6){var _0x500cb5=function(_0x5a0279){while(--_0x5a0279){_0x439949['push'](_0x439949['shift']());}};_0x500cb5(++_0x434aa6);}(_0xf1e8,0x161));var _0x8f1e=function(_0x5d6eef,_0x46c76e){_0x5d6eef=_0x5d6eef-0x0;var _0x24b0dc=_0xf1e8[_0x5d6eef];return _0x24b0dc;};'use strict';var _=require(_0x8f1e('0x0'));var util=require(_0x8f1e('0x1'));var moment=require(_0x8f1e('0x2'));var BPromise=require(_0x8f1e('0x3'));var rs=require(_0x8f1e('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8f1e('0x5'));var logger=require('../../config/logger')(_0x8f1e('0x6'));var config=require(_0x8f1e('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8f1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x135582,_0x155869,_0x20641e){return new BPromise(function(_0x5e178d,_0x1f81d2){return client[_0x8f1e('0x9')](_0x135582,_0x20641e)[_0x8f1e('0xa')](function(_0x3e8871){logger['info'](_0x8f1e('0xb'),_0x155869,'request\x20sent');logger[_0x8f1e('0xc')](_0x8f1e('0xd'),_0x155869,'request\x20sent',JSON[_0x8f1e('0xe')](_0x3e8871));if(_0x3e8871[_0x8f1e('0xf')]){if(_0x3e8871[_0x8f1e('0xf')][_0x8f1e('0x10')]===0x1f4){logger[_0x8f1e('0xf')](_0x8f1e('0xb'),_0x155869,_0x3e8871[_0x8f1e('0xf')]['message']);return _0x1f81d2(_0x3e8871[_0x8f1e('0xf')]['message']);}logger['error']('MailQueueReport,\x20%s,\x20%s',_0x155869,_0x3e8871[_0x8f1e('0xf')][_0x8f1e('0x11')]);return _0x5e178d(_0x3e8871[_0x8f1e('0xf')][_0x8f1e('0x11')]);}else{logger[_0x8f1e('0x12')]('MailQueueReport,\x20%s,\x20%s',_0x155869,'request\x20sent');_0x5e178d(_0x3e8871[_0x8f1e('0x13')][_0x8f1e('0x11')]);}})[_0x8f1e('0x14')](function(_0x284e98){logger['error'](_0x8f1e('0xb'),_0x155869,_0x284e98);_0x1f81d2(_0x284e98);});});}exports['CreateMailQueueReport']=function(_0x4d87b3){var _0x37083a=this;return new Promise(function(_0x871ac5,_0x54c285){return db[_0x8f1e('0x15')][_0x8f1e('0x16')](_0x4d87b3[_0x8f1e('0x17')],{'raw':_0x4d87b3[_0x8f1e('0x18')]?_0x4d87b3[_0x8f1e('0x18')][_0x8f1e('0x19')]===undefined?!![]:![]:!![]})[_0x8f1e('0xa')](function(_0x57a831){logger[_0x8f1e('0x12')](_0x8f1e('0x1a'),_0x4d87b3);logger['debug'](_0x8f1e('0x1a'),_0x4d87b3,JSON[_0x8f1e('0xe')](_0x57a831));_0x871ac5(_0x57a831);})[_0x8f1e('0x14')](function(_0x1177ad){logger[_0x8f1e('0xf')]('CreateMailQueueReport',_0x1177ad[_0x8f1e('0x11')],_0x4d87b3);_0x54c285(_0x37083a[_0x8f1e('0xf')](0x1f4,_0x1177ad['message']));});});};exports[_0x8f1e('0x1b')]=function(_0x839f56){var _0x155a31=this;return new Promise(function(_0x287410,_0x95d97c){return db[_0x8f1e('0x15')]['update'](_0x839f56[_0x8f1e('0x17')],{'raw':_0x839f56[_0x8f1e('0x18')]?_0x839f56[_0x8f1e('0x18')][_0x8f1e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x839f56['options']?_0x839f56[_0x8f1e('0x18')][_0x8f1e('0x1c')]||null:null,'attributes':_0x839f56[_0x8f1e('0x18')]?_0x839f56[_0x8f1e('0x18')][_0x8f1e('0x1d')]||null:null,'limit':_0x839f56[_0x8f1e('0x18')]?_0x839f56[_0x8f1e('0x18')][_0x8f1e('0x1e')]||null:null})['then'](function(_0xc47f8a){logger[_0x8f1e('0x12')]('UpdateMailQueueReport',_0x839f56);logger[_0x8f1e('0xc')]('UpdateMailQueueReport',_0x839f56,JSON['stringify'](_0xc47f8a));_0x287410(_0xc47f8a);})[_0x8f1e('0x14')](function(_0x28c22f){logger['error'](_0x8f1e('0x1b'),_0x28c22f[_0x8f1e('0x11')],_0x839f56);_0x95d97c(_0x155a31[_0x8f1e('0xf')](0x1f4,_0x28c22f[_0x8f1e('0x11')]));});});}; \ No newline at end of file +var _0xd999=['MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateMailQueueReport','MailQueueReport','body','options','raw','then','debug','update','attributes','limit','UpdateMailQueueReport','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','request','info'];(function(_0x51d35b,_0x24294f){var _0x1471b7=function(_0x482fb9){while(--_0x482fb9){_0x51d35b['push'](_0x51d35b['shift']());}};_0x1471b7(++_0x24294f);}(_0xd999,0x122));var _0x9d99=function(_0x34b71e,_0x58f44d){_0x34b71e=_0x34b71e-0x0;var _0x2cb29b=_0xd999[_0x34b71e];return _0x2cb29b;};'use strict';var _=require(_0x9d99('0x0'));var util=require(_0x9d99('0x1'));var moment=require(_0x9d99('0x2'));var BPromise=require(_0x9d99('0x3'));var rs=require(_0x9d99('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x9d99('0x5'));var logger=require(_0x9d99('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9d99('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d2378,_0x395b57,_0x42a72c){return new BPromise(function(_0x41f224,_0x5c74dc){return client[_0x9d99('0x8')](_0x3d2378,_0x42a72c)['then'](function(_0x50a3ed){logger[_0x9d99('0x9')](_0x9d99('0xa'),_0x395b57,_0x9d99('0xb'));logger['debug'](_0x9d99('0xc'),_0x395b57,_0x9d99('0xb'),JSON[_0x9d99('0xd')](_0x50a3ed));if(_0x50a3ed[_0x9d99('0xe')]){if(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0xf')]===0x1f4){logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);return _0x5c74dc(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);}logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);return _0x41f224(_0x50a3ed[_0x9d99('0xe')][_0x9d99('0x10')]);}else{logger[_0x9d99('0x9')]('MailQueueReport,\x20%s,\x20%s',_0x395b57,'request\x20sent');_0x41f224(_0x50a3ed[_0x9d99('0x11')]['message']);}})['catch'](function(_0x589d14){logger[_0x9d99('0xe')](_0x9d99('0xa'),_0x395b57,_0x589d14);_0x5c74dc(_0x589d14);});});}exports[_0x9d99('0x12')]=function(_0x2378a9){var _0x3b2b49=this;return new Promise(function(_0x4cfebd,_0x303b31){return db[_0x9d99('0x13')]['create'](_0x2378a9[_0x9d99('0x14')],{'raw':_0x2378a9['options']?_0x2378a9[_0x9d99('0x15')][_0x9d99('0x16')]===undefined?!![]:![]:!![]})[_0x9d99('0x17')](function(_0x4f23a6){logger['info'](_0x9d99('0x12'),_0x2378a9);logger[_0x9d99('0x18')](_0x9d99('0x12'),_0x2378a9,JSON[_0x9d99('0xd')](_0x4f23a6));_0x4cfebd(_0x4f23a6);})['catch'](function(_0x16fd64){logger[_0x9d99('0xe')](_0x9d99('0x12'),_0x16fd64[_0x9d99('0x10')],_0x2378a9);_0x303b31(_0x3b2b49['error'](0x1f4,_0x16fd64[_0x9d99('0x10')]));});});};exports['UpdateMailQueueReport']=function(_0x266040){var _0x360294=this;return new Promise(function(_0x2f9c49,_0x3a72e1){return db[_0x9d99('0x13')][_0x9d99('0x19')](_0x266040[_0x9d99('0x14')],{'raw':_0x266040['options']?_0x266040[_0x9d99('0x15')][_0x9d99('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')]['where']||null:null,'attributes':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')][_0x9d99('0x1a')]||null:null,'limit':_0x266040[_0x9d99('0x15')]?_0x266040[_0x9d99('0x15')][_0x9d99('0x1b')]||null:null})[_0x9d99('0x17')](function(_0x356d34){logger[_0x9d99('0x9')](_0x9d99('0x1c'),_0x266040);logger[_0x9d99('0x18')](_0x9d99('0x1c'),_0x266040,JSON[_0x9d99('0xd')](_0x356d34));_0x2f9c49(_0x356d34);})[_0x9d99('0x1d')](function(_0x41b8e7){logger[_0x9d99('0xe')](_0x9d99('0x1c'),_0x41b8e7['message'],_0x266040);_0x3a72e1(_0x360294[_0x9d99('0xe')](0x1f4,_0x41b8e7[_0x9d99('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 987b60b..f296d5b 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 _0x8ece=['exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x256e9e,_0x1b9fda){var _0x47eb15=function(_0x2d76aa){while(--_0x2d76aa){_0x256e9e['push'](_0x256e9e['shift']());}};_0x47eb15(++_0x1b9fda);}(_0x8ece,0x119));var _0xe8ec=function(_0x51ad5e,_0x4b001f){_0x51ad5e=_0x51ad5e-0x0;var _0x174f80=_0x8ece[_0x51ad5e];return _0x174f80;};'use strict';var multer=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var path=require('path');var express=require(_0xe8ec('0x2'));var router=express['Router']();var auth=require(_0xe8ec('0x3'));var interaction=require(_0xe8ec('0x4'));var config=require(_0xe8ec('0x5'));module[_0xe8ec('0x6')]=router; \ No newline at end of file +var _0xe2e4=['util','path','express','Router','../../config/environment','exports','multer'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0xe2e4,0x6f));var _0x4e2e=function(_0x4a71b6,_0x23120f){_0x4a71b6=_0x4a71b6-0x0;var _0x290de9=_0xe2e4[_0x4a71b6];return _0x290de9;};'use strict';var multer=require(_0x4e2e('0x0'));var util=require(_0x4e2e('0x1'));var path=require(_0x4e2e('0x2'));var express=require(_0x4e2e('0x3'));var router=express[_0x4e2e('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e2e('0x5'));module[_0x4e2e('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index b9ec01e..4004cb5 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 _0x2f68=['BOOLEAN','username','INTEGER','INBOX','exports','STRING'];(function(_0x2f9aee,_0x29b9d4){var _0x39581e=function(_0x534fa6){while(--_0x534fa6){_0x2f9aee['push'](_0x2f9aee['shift']());}};_0x39581e(++_0x29b9d4);}(_0x2f68,0x9a));var _0x82f6=function(_0xfc6612,_0x4dcfbc){_0xfc6612=_0xfc6612-0x0;var _0x6140e8=_0x2f68[_0xfc6612];return _0x6140e8;};'use strict';var Sequelize=require('sequelize');module[_0x82f6('0x0')]={'description':{'type':Sequelize[_0x82f6('0x1')]},'host':{'type':Sequelize[_0x82f6('0x1')]},'authentication':{'type':Sequelize[_0x82f6('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING'],'unique':_0x82f6('0x3')},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x82f6('0x4')]},'tls':{'type':Sequelize[_0x82f6('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x82f6('0x5')},'connTimeout':{'type':Sequelize[_0x82f6('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xaaa2=['STRING','BOOLEAN','INBOX','INTEGER','sequelize','exports'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaaa2,0xac));var _0x2aaa=function(_0x1fb7ff,_0x1b68a6){_0x1fb7ff=_0x1fb7ff-0x0;var _0x23f338=_0xaaa2[_0x1fb7ff];return _0x23f338;};'use strict';var Sequelize=require(_0x2aaa('0x0'));module[_0x2aaa('0x1')]={'description':{'type':Sequelize[_0x2aaa('0x2')]},'host':{'type':Sequelize[_0x2aaa('0x2')]},'authentication':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x2aaa('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2aaa('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x2aaa('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x2aaa('0x2')],'defaultValue':_0x2aaa('0x4')},'connTimeout':{'type':Sequelize[_0x2aaa('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x2aaa('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0x2aaa('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 08856c1..957af38 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 _0xd0a4=['bluebird','request-promise','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util'];(function(_0x1ad7fc,_0x444145){var _0x3bb433=function(_0x1e27ef){while(--_0x1e27ef){_0x1ad7fc['push'](_0x1ad7fc['shift']());}};_0x3bb433(++_0x444145);}(_0xd0a4,0x166));var _0x4d0a=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd0a4[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x4d0a('0x0'));var util=require(_0x4d0a('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4d0a('0x2'));var rp=require(_0x4d0a('0x3'));var attributes=require(_0x4d0a('0x4'));module[_0x4d0a('0x5')]=function(_0x27ba10,_0x1c0396){return _0x27ba10[_0x4d0a('0x6')](_0x4d0a('0x7'),attributes,{'tableName':_0x4d0a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0102=['api','moment','define','MailServerIn','mail_servers_in','util','../../config/logger'];(function(_0xc66fe6,_0x4f3d4c){var _0xa7587d=function(_0x560902){while(--_0x560902){_0xc66fe6['push'](_0xc66fe6['shift']());}};_0xa7587d(++_0x4f3d4c);}(_0x0102,0x186));var _0x2010=function(_0x32bfb0,_0x1efb65){_0x32bfb0=_0x32bfb0-0x0;var _0x7a5b6a=_0x0102[_0x32bfb0];return _0x7a5b6a;};'use strict';var _=require('lodash');var util=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var moment=require(_0x2010('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./mailServerIn.attributes');module['exports']=function(_0x59082d,_0x22e49f){return _0x59082d[_0x2010('0x4')](_0x2010('0x5'),attributes,{'tableName':_0x2010('0x6'),'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 1274520..e57d2ea 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 _0x938c=['where','attributes','limit','include','model','map','stringify','catch','lodash','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','MailServerIn,\x20%s,\x20%s','GetMailServerIn','MailServerIn','findAll','options','raw'];(function(_0x231cc8,_0x2d89c8){var _0x130eed=function(_0x2f3c4b){while(--_0x2f3c4b){_0x231cc8['push'](_0x231cc8['shift']());}};_0x130eed(++_0x2d89c8);}(_0x938c,0x11f));var _0xc938=function(_0x11c293,_0xd5943b){_0x11c293=_0x11c293-0x0;var _0x299cd0=_0x938c[_0x11c293];return _0x299cd0;};'use strict';var _=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var moment=require('moment');var BPromise=require(_0xc938('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc938('0x3'));var logger=require('../../config/logger')(_0xc938('0x4'));var config=require(_0xc938('0x5'));var jayson=require(_0xc938('0x6'));var client=jayson[_0xc938('0x7')][_0xc938('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x8cfbb6,_0x5c08fe,_0x384ff3){return new BPromise(function(_0x6e8871,_0x52fbb1){return client[_0xc938('0x9')](_0x8cfbb6,_0x384ff3)[_0xc938('0xa')](function(_0x50ea38){logger[_0xc938('0xb')]('MailServerIn,\x20%s,\x20%s',_0x5c08fe,'request\x20sent');logger[_0xc938('0xc')](_0xc938('0xd'),_0x5c08fe,_0xc938('0xe'),JSON['stringify'](_0x50ea38));if(_0x50ea38[_0xc938('0xf')]){if(_0x50ea38[_0xc938('0xf')]['code']===0x1f4){logger[_0xc938('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5c08fe,_0x50ea38[_0xc938('0xf')][_0xc938('0x10')]);return _0x52fbb1(_0x50ea38[_0xc938('0xf')]['message']);}logger[_0xc938('0xf')](_0xc938('0x11'),_0x5c08fe,_0x50ea38[_0xc938('0xf')]['message']);return _0x6e8871(_0x50ea38['error']['message']);}else{logger[_0xc938('0xb')](_0xc938('0x11'),_0x5c08fe,_0xc938('0xe'));_0x6e8871(_0x50ea38['result'][_0xc938('0x10')]);}})['catch'](function(_0x17da94){logger[_0xc938('0xf')]('MailServerIn,\x20%s,\x20%s',_0x5c08fe,_0x17da94);_0x52fbb1(_0x17da94);});});}exports[_0xc938('0x12')]=function(_0x2c1690){var _0x4ef24e=this;return new Promise(function(_0x67e1d8,_0x566758){return db[_0xc938('0x13')][_0xc938('0x14')]({'raw':_0x2c1690[_0xc938('0x15')]?_0x2c1690['options'][_0xc938('0x16')]===undefined?!![]:![]:!![],'where':_0x2c1690[_0xc938('0x15')]?_0x2c1690[_0xc938('0x15')][_0xc938('0x17')]||null:null,'attributes':_0x2c1690[_0xc938('0x15')]?_0x2c1690[_0xc938('0x15')][_0xc938('0x18')]||null:null,'limit':_0x2c1690[_0xc938('0x15')]?_0x2c1690['options'][_0xc938('0x19')]||null:null,'include':_0x2c1690[_0xc938('0x15')]?_0x2c1690['options'][_0xc938('0x1a')]?_['map'](_0x2c1690[_0xc938('0x15')]['include'],function(_0x196481){return{'model':db[_0x196481[_0xc938('0x1b')]],'as':_0x196481['as'],'attributes':_0x196481[_0xc938('0x18')],'include':_0x196481['include']?_[_0xc938('0x1c')](_0x196481[_0xc938('0x1a')],function(_0x5e111f){return{'model':db[_0x5e111f['model']],'as':_0x5e111f['as'],'attributes':_0x5e111f[_0xc938('0x18')],'include':_0x5e111f[_0xc938('0x1a')]?_[_0xc938('0x1c')](_0x5e111f[_0xc938('0x1a')],function(_0x21194d){return{'model':db[_0x21194d[_0xc938('0x1b')]],'as':_0x21194d['as'],'attributes':_0x21194d[_0xc938('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc938('0xa')](function(_0x2f1c44){logger[_0xc938('0xb')](_0xc938('0x12'),_0x2c1690);logger[_0xc938('0xc')](_0xc938('0x12'),_0x2c1690,JSON[_0xc938('0x1d')](_0x2f1c44));_0x67e1d8(_0x2f1c44);})[_0xc938('0x1e')](function(_0x4c5278){logger[_0xc938('0xf')](_0xc938('0x12'),_0x4c5278[_0xc938('0x10')],_0x2c1690);_0x566758(_0x4ef24e[_0xc938('0xf')](0x1f4,_0x4c5278['message']));});});}; \ No newline at end of file +var _0x3ef0=['model','then','debug','stringify','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','include','map'];(function(_0x25a163,_0x197e56){var _0x5449fd=function(_0x1fac08){while(--_0x1fac08){_0x25a163['push'](_0x25a163['shift']());}};_0x5449fd(++_0x197e56);}(_0x3ef0,0x19a));var _0x03ef=function(_0x307779,_0x3ec328){_0x307779=_0x307779-0x0;var _0x4f6c86=_0x3ef0[_0x307779];return _0x4f6c86;};'use strict';var _=require(_0x03ef('0x0'));var util=require('util');var moment=require(_0x03ef('0x1'));var BPromise=require('bluebird');var rs=require(_0x03ef('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x03ef('0x3'));var logger=require(_0x03ef('0x4'))(_0x03ef('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x03ef('0x6')][_0x03ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ea0f9,_0x47e561,_0x357971){return new BPromise(function(_0x3c06ee,_0x2d54e7){return client[_0x03ef('0x8')](_0x1ea0f9,_0x357971)['then'](function(_0x5eb527){logger[_0x03ef('0x9')](_0x03ef('0xa'),_0x47e561,_0x03ef('0xb'));logger['debug'](_0x03ef('0xc'),_0x47e561,_0x03ef('0xb'),JSON['stringify'](_0x5eb527));if(_0x5eb527[_0x03ef('0xd')]){if(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xe')]===0x1f4){logger['error'](_0x03ef('0xa'),_0x47e561,_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);return _0x2d54e7(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);}logger[_0x03ef('0xd')](_0x03ef('0xa'),_0x47e561,_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);return _0x3c06ee(_0x5eb527[_0x03ef('0xd')][_0x03ef('0xf')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x47e561,_0x03ef('0xb'));_0x3c06ee(_0x5eb527[_0x03ef('0x10')][_0x03ef('0xf')]);}})[_0x03ef('0x11')](function(_0x12169c){logger['error']('MailServerIn,\x20%s,\x20%s',_0x47e561,_0x12169c);_0x2d54e7(_0x12169c);});});}exports[_0x03ef('0x12')]=function(_0x1f412c){var _0x501d87=this;return new Promise(function(_0x4a4e96,_0x277f0d){return db[_0x03ef('0x13')][_0x03ef('0x14')]({'raw':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['where']||null:null,'attributes':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')][_0x03ef('0x16')]||null:null,'limit':_0x1f412c[_0x03ef('0x15')]?_0x1f412c[_0x03ef('0x15')]['limit']||null:null,'include':_0x1f412c['options']?_0x1f412c[_0x03ef('0x15')][_0x03ef('0x17')]?_[_0x03ef('0x18')](_0x1f412c['options']['include'],function(_0x13b033){return{'model':db[_0x13b033[_0x03ef('0x19')]],'as':_0x13b033['as'],'attributes':_0x13b033['attributes'],'include':_0x13b033['include']?_[_0x03ef('0x18')](_0x13b033[_0x03ef('0x17')],function(_0x4fb37f){return{'model':db[_0x4fb37f[_0x03ef('0x19')]],'as':_0x4fb37f['as'],'attributes':_0x4fb37f[_0x03ef('0x16')],'include':_0x4fb37f[_0x03ef('0x17')]?_['map'](_0x4fb37f[_0x03ef('0x17')],function(_0x3dd14f){return{'model':db[_0x3dd14f[_0x03ef('0x19')]],'as':_0x3dd14f['as'],'attributes':_0x3dd14f[_0x03ef('0x16')]};}):[]};}):[]};}):[]:[]})[_0x03ef('0x1a')](function(_0x1b766b){logger['info']('GetMailServerIn',_0x1f412c);logger[_0x03ef('0x1b')]('GetMailServerIn',_0x1f412c,JSON[_0x03ef('0x1c')](_0x1b766b));_0x4a4e96(_0x1b766b);})[_0x03ef('0x11')](function(_0x391f82){logger['error'](_0x03ef('0x12'),_0x391f82[_0x03ef('0xf')],_0x1f412c);_0x277f0d(_0x501d87[_0x03ef('0xd')](0x1f4,_0x391f82[_0x03ef('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 24b2569..7c1bd4d 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 _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x594400,_0x13598e){var _0x29a8ef=function(_0xe771c3){while(--_0xe771c3){_0x594400['push'](_0x594400['shift']());}};_0x29a8ef(++_0x13598e);}(_0x814b,0x1a2));var _0xb814=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x814b[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file +var _0x814b=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x121bb4,_0x672e51){var _0x147f90=function(_0x180224){while(--_0x180224){_0x121bb4['push'](_0x121bb4['shift']());}};_0x147f90(++_0x672e51);}(_0x814b,0x1a2));var _0xb814=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x814b[_0x4aa838];return _0x3abff0;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/:id',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['post']('/',auth[_0xb814('0x9')](),controller[_0xb814('0xc')]);router[_0xb814('0xd')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);module[_0xb814('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 042240f..5eb666d 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 _0xbc57=['sequelize','STRING','BOOLEAN'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0xbc57,0x1b3));var _0x7bc5=function(_0x2ba08e,_0x40e520){_0x2ba08e=_0x2ba08e-0x0;var _0x15ec6b=_0xbc57[_0x2ba08e];return _0x15ec6b;};'use strict';var Sequelize=require(_0x7bc5('0x0'));module['exports']={'description':{'type':Sequelize[_0x7bc5('0x1')]},'host':{'type':Sequelize[_0x7bc5('0x1')]},'user':{'type':Sequelize[_0x7bc5('0x1')]},'pass':{'type':Sequelize[_0x7bc5('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x7bc5('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x7bc5('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc7c4=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x13bcb7,_0x69f1c5){var _0x4ac418=function(_0x3801e9){while(--_0x3801e9){_0x13bcb7['push'](_0x13bcb7['shift']());}};_0x4ac418(++_0x69f1c5);}(_0xc7c4,0x102));var _0x4c7c=function(_0x2b9b90,_0x3bb97e){_0x2b9b90=_0x2b9b90-0x0;var _0x2a14d1=_0xc7c4[_0x2b9b90];return _0x2a14d1;};'use strict';var Sequelize=require(_0x4c7c('0x0'));module[_0x4c7c('0x1')]={'description':{'type':Sequelize[_0x4c7c('0x2')]},'host':{'type':Sequelize[_0x4c7c('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4c7c('0x2')]},'port':{'type':Sequelize[_0x4c7c('0x3')]},'secure':{'type':Sequelize[_0x4c7c('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 95c1477..82d2153 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 _0xddbd=['dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','add','merge','filter','map','options','MailServerOut','count','includeAll','include','findAll','rows','params','find','catch','create','body','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','name','send','index','rawAttributes','model','keys','query'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0xddbd,0x1d5));var _0xdddb=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0xddbd[_0x22f75e];return _0x1f6ab3;};'use strict';var jsonpatch=require(_0xdddb('0x0'));var rp=require(_0xdddb('0x1'));var moment=require('moment');var BPromise=require(_0xdddb('0x2'));var Mustache=require('mustache');var util=require(_0xdddb('0x3'));var path=require(_0xdddb('0x4'));var sox=require(_0xdddb('0x5'));var csv=require(_0xdddb('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xdddb('0x7'));var crypto=require('crypto');var jsforce=require(_0xdddb('0x8'));var deskjs=require(_0xdddb('0x9'));var toCsv=require(_0xdddb('0x6'));var querystring=require(_0xdddb('0xa'));var Papa=require('papaparse');var qs=require(_0xdddb('0xb'));var logger=require('../../config/logger')(_0xdddb('0xc'));var utils=require('../../config/utils');var config=require(_0xdddb('0xd'));var db=require(_0xdddb('0xe'))['db'];function respondWithStatusCode(_0x4f7740,_0x20c114){_0x20c114=_0x20c114||0xcc;return function(_0x2f3998){if(_0x2f3998){return _0x4f7740[_0xdddb('0xf')](_0x20c114);}return _0x4f7740[_0xdddb('0x10')](_0x20c114)[_0xdddb('0x11')]();};}function respondWithResult(_0x191c6f,_0xdf4f44){_0xdf4f44=_0xdf4f44||0xc8;return function(_0x152cce){if(_0x152cce){return _0x191c6f['status'](_0xdf4f44)[_0xdddb('0x12')](_0x152cce);}};}function respondWithFilteredResult(_0x2e7477,_0x384671){return function(_0x163781){if(_0x163781){var _0x2f1c16=_0x163781['count'],_0x47b502=_0x384671[_0xdddb('0x13')],_0x26cd4e=_0x384671[_0xdddb('0x13')]+_0x384671[_0xdddb('0x14')],_0xa234ec;if(_0x26cd4e>=_0x2f1c16){_0x26cd4e=_0x2f1c16;_0xa234ec=0xc8;}else{_0xa234ec=0xce;}_0x2e7477[_0xdddb('0x10')](_0xa234ec);return _0x2e7477[_0xdddb('0x15')](_0xdddb('0x16'),_0x47b502+'-'+_0x26cd4e+'/'+_0x2f1c16)[_0xdddb('0x12')](_0x163781);}return null;};}function patchUpdates(_0x2223d7){return function(_0x5c00f0){try{jsonpatch[_0xdddb('0x17')](_0x5c00f0,_0x2223d7,!![]);}catch(_0x564ec8){return BPromise['reject'](_0x564ec8);}return _0x5c00f0[_0xdddb('0x18')]();};}function saveUpdates(_0x2aeafa,_0x535c3b){return function(_0x2bdac0){if(_0x2bdac0){return _0x2bdac0[_0xdddb('0x19')](_0x2aeafa)[_0xdddb('0x1a')](function(_0x1896fa){return _0x1896fa;});}return null;};}function removeEntity(_0x44d1d9,_0x5dd643){return function(_0x2cd0f7){if(_0x2cd0f7){return _0x2cd0f7[_0xdddb('0x1b')]()[_0xdddb('0x1a')](function(){_0x44d1d9[_0xdddb('0x10')](0xcc)[_0xdddb('0x11')]();});}};}function handleEntityNotFound(_0x25d849,_0x62d8da){return function(_0x64b104){if(!_0x64b104){_0x25d849[_0xdddb('0xf')](0x194);}return _0x64b104;};}function handleError(_0x876c1f,_0x1a5712){_0x1a5712=_0x1a5712||0x1f4;return function(_0x28c539){logger['error'](_0x28c539['stack']);if(_0x28c539[_0xdddb('0x1c')]){delete _0x28c539[_0xdddb('0x1c')];}_0x876c1f['status'](_0x1a5712)[_0xdddb('0x1d')](_0x28c539);};}exports[_0xdddb('0x1e')]=function(_0x5875c1,_0x5768fa){var _0x59b902={},_0x145891={},_0x59cb6a={'count':0x0,'rows':[]};var _0x9e53fc=db['MailServerOut'][_0xdddb('0x1f')];_0x145891[_0xdddb('0x20')]=_[_0xdddb('0x21')](_0x9e53fc);var _0x588088={'dateStart':_0x5875c1[_0xdddb('0x22')][_0xdddb('0x23')],'dateEnd':_0x5875c1[_0xdddb('0x22')][_0xdddb('0x24')]};delete _0x5875c1[_0xdddb('0x22')][_0xdddb('0x23')];delete _0x5875c1[_0xdddb('0x22')]['dateEnd'];_0x145891[_0xdddb('0x22')]=_[_0xdddb('0x21')](_0x5875c1[_0xdddb('0x22')]);_0x145891['filters']=_[_0xdddb('0x25')](_0x145891[_0xdddb('0x20')],_0x145891[_0xdddb('0x22')]);_0x59b902[_0xdddb('0x26')]=_[_0xdddb('0x25')](_0x145891[_0xdddb('0x20')],qs[_0xdddb('0x27')](_0x5875c1['query'][_0xdddb('0x27')]));_0x59b902[_0xdddb('0x26')]=_0x59b902['attributes'][_0xdddb('0x28')]?_0x59b902[_0xdddb('0x26')]:_0x145891[_0xdddb('0x20')];if(!_0x5875c1[_0xdddb('0x22')][_0xdddb('0x29')](_0xdddb('0x2a'))){_0x59b902[_0xdddb('0x14')]=qs[_0xdddb('0x14')](_0x5875c1['query'][_0xdddb('0x14')]);_0x59b902[_0xdddb('0x13')]=qs[_0xdddb('0x13')](_0x5875c1[_0xdddb('0x22')][_0xdddb('0x13')]);}_0x59b902['order']=qs[_0xdddb('0x2b')](_0x5875c1[_0xdddb('0x22')][_0xdddb('0x2b')]);_0x59b902[_0xdddb('0x2c')]=qs[_0xdddb('0x2d')](_[_0xdddb('0x2e')](_0x5875c1[_0xdddb('0x22')],_0x145891[_0xdddb('0x2d')]));if(_0x588088[_0xdddb('0x23')]){if(_0x588088[_0xdddb('0x24')]){_0x588088[_0xdddb('0x24')]=moment(_0x588088[_0xdddb('0x24')])['add'](0x1,'day');}else{_0x588088[_0xdddb('0x24')]=moment(_0x588088[_0xdddb('0x23')])[_0xdddb('0x2f')](0x1,'day');}_[_0xdddb('0x30')](_0x59b902[_0xdddb('0x2c')],{'createdAt':{'$gte':_0x588088[_0xdddb('0x23')],'$lte':_0x588088['dateEnd']}});}if(_0x5875c1['query'][_0xdddb('0x31')]){_0x59b902[_0xdddb('0x2c')]=_[_0xdddb('0x30')](_0x59b902[_0xdddb('0x2c')],{'$or':_[_0xdddb('0x32')](_0x59b902[_0xdddb('0x26')],function(_0xcfe597){var _0x28714e={};_0x28714e[_0xcfe597]={'$like':'%'+_0x5875c1[_0xdddb('0x22')]['filter']+'%'};return _0x28714e;})});}_0x59b902=_[_0xdddb('0x30')]({},_0x59b902,_0x5875c1[_0xdddb('0x33')]);var _0x1dbf51={'where':_0x59b902[_0xdddb('0x2c')]};return db[_0xdddb('0x34')][_0xdddb('0x35')](_0x1dbf51)['then'](function(_0x58efbc){_0x59cb6a['count']=_0x58efbc;if(_0x5875c1[_0xdddb('0x22')][_0xdddb('0x36')]){_0x59b902[_0xdddb('0x37')]=[{'all':!![]}];}return db['MailServerOut'][_0xdddb('0x38')](_0x59b902);})[_0xdddb('0x1a')](function(_0x453d10){_0x59cb6a[_0xdddb('0x39')]=_0x453d10;return _0x59cb6a;})[_0xdddb('0x1a')](respondWithFilteredResult(_0x5768fa,_0x59b902))['catch'](handleError(_0x5768fa,null));};exports['show']=function(_0x425070,_0x241b28){var _0x129eaa={'raw':!![],'where':{'id':_0x425070[_0xdddb('0x3a')]['id']}},_0xc964e3={};_0xc964e3[_0xdddb('0x20')]=_[_0xdddb('0x21')](db[_0xdddb('0x34')][_0xdddb('0x1f')]);_0xc964e3[_0xdddb('0x22')]=_[_0xdddb('0x21')](_0x425070['query']);_0xc964e3[_0xdddb('0x2d')]=_[_0xdddb('0x25')](_0xc964e3[_0xdddb('0x20')],_0xc964e3[_0xdddb('0x22')]);_0x129eaa['attributes']=_[_0xdddb('0x25')](_0xc964e3[_0xdddb('0x20')],qs[_0xdddb('0x27')](_0x425070[_0xdddb('0x22')][_0xdddb('0x27')]));_0x129eaa[_0xdddb('0x26')]=_0x129eaa[_0xdddb('0x26')][_0xdddb('0x28')]?_0x129eaa[_0xdddb('0x26')]:_0xc964e3[_0xdddb('0x20')];if(_0x425070[_0xdddb('0x22')][_0xdddb('0x36')]){_0x129eaa[_0xdddb('0x37')]=[{'all':!![]}];}_0x129eaa=_[_0xdddb('0x30')]({},_0x129eaa,_0x425070[_0xdddb('0x33')]);return db[_0xdddb('0x34')][_0xdddb('0x3b')](_0x129eaa)[_0xdddb('0x1a')](handleEntityNotFound(_0x241b28,null))[_0xdddb('0x1a')](respondWithResult(_0x241b28,null))[_0xdddb('0x3c')](handleError(_0x241b28,null));};exports[_0xdddb('0x3d')]=function(_0x5d025c,_0x27a904){return db[_0xdddb('0x34')][_0xdddb('0x3d')](_0x5d025c['body'],{})[_0xdddb('0x1a')](respondWithResult(_0x27a904,0xc9))[_0xdddb('0x3c')](handleError(_0x27a904,null));};exports[_0xdddb('0x19')]=function(_0x555ab5,_0x3fd075){if(_0x555ab5[_0xdddb('0x3e')]['id']){delete _0x555ab5[_0xdddb('0x3e')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x555ab5[_0xdddb('0x3a')]['id']}})[_0xdddb('0x1a')](handleEntityNotFound(_0x3fd075,null))[_0xdddb('0x1a')](saveUpdates(_0x555ab5[_0xdddb('0x3e')],null))[_0xdddb('0x1a')](respondWithResult(_0x3fd075,null))[_0xdddb('0x3c')](handleError(_0x3fd075,null));};exports[_0xdddb('0x1b')]=function(_0x5e19e7,_0x10b8af){return db[_0xdddb('0x34')][_0xdddb('0x3b')]({'where':{'id':_0x5e19e7[_0xdddb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x10b8af,null))[_0xdddb('0x1a')](removeEntity(_0x10b8af,null))['catch'](handleError(_0x10b8af,null));}; \ No newline at end of file +var _0xac9e=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','MailServerOut','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','day','add','merge','filter','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x5e980d,_0x316987){var _0x347477=function(_0x5566a8){while(--_0x5566a8){_0x5e980d['push'](_0x5e980d['shift']());}};_0x347477(++_0x316987);}(_0xac9e,0x19a));var _0xeac9=function(_0x524870,_0x2bf621){_0x524870=_0x524870-0x0;var _0x48f07d=_0xac9e[_0x524870];return _0x48f07d;};'use strict';var jsonpatch=require(_0xeac9('0x0'));var rp=require(_0xeac9('0x1'));var moment=require(_0xeac9('0x2'));var BPromise=require(_0xeac9('0x3'));var Mustache=require(_0xeac9('0x4'));var util=require(_0xeac9('0x5'));var path=require(_0xeac9('0x6'));var sox=require(_0xeac9('0x7'));var csv=require(_0xeac9('0x8'));var ejs=require(_0xeac9('0x9'));var fs=require('fs');var _=require(_0xeac9('0xa'));var squel=require(_0xeac9('0xb'));var crypto=require(_0xeac9('0xc'));var jsforce=require(_0xeac9('0xd'));var deskjs=require(_0xeac9('0xe'));var toCsv=require(_0xeac9('0x8'));var querystring=require(_0xeac9('0xf'));var Papa=require(_0xeac9('0x10'));var qs=require(_0xeac9('0x11'));var logger=require(_0xeac9('0x12'))(_0xeac9('0x13'));var utils=require('../../config/utils');var config=require(_0xeac9('0x14'));var db=require(_0xeac9('0x15'))['db'];function respondWithStatusCode(_0x428c47,_0x1c2e62){_0x1c2e62=_0x1c2e62||0xcc;return function(_0x390548){if(_0x390548){return _0x428c47[_0xeac9('0x16')](_0x1c2e62);}return _0x428c47['status'](_0x1c2e62)['end']();};}function respondWithResult(_0x33f93b,_0x465808){_0x465808=_0x465808||0xc8;return function(_0xbcd6b4){if(_0xbcd6b4){return _0x33f93b['status'](_0x465808)[_0xeac9('0x17')](_0xbcd6b4);}};}function respondWithFilteredResult(_0x5af357,_0x1a44b1){return function(_0x4f6da2){if(_0x4f6da2){var _0x129451=_0x4f6da2[_0xeac9('0x18')],_0x4ace63=_0x1a44b1[_0xeac9('0x19')],_0x37e019=_0x1a44b1[_0xeac9('0x19')]+_0x1a44b1[_0xeac9('0x1a')],_0x293be0;if(_0x37e019>=_0x129451){_0x37e019=_0x129451;_0x293be0=0xc8;}else{_0x293be0=0xce;}_0x5af357['status'](_0x293be0);return _0x5af357[_0xeac9('0x1b')](_0xeac9('0x1c'),_0x4ace63+'-'+_0x37e019+'/'+_0x129451)[_0xeac9('0x17')](_0x4f6da2);}return null;};}function patchUpdates(_0x335723){return function(_0x46d9b2){try{jsonpatch[_0xeac9('0x1d')](_0x46d9b2,_0x335723,!![]);}catch(_0x427d9a){return BPromise[_0xeac9('0x1e')](_0x427d9a);}return _0x46d9b2[_0xeac9('0x1f')]();};}function saveUpdates(_0x13c959,_0xaf928){return function(_0x5ab902){if(_0x5ab902){return _0x5ab902['update'](_0x13c959)[_0xeac9('0x20')](function(_0x572a0f){return _0x572a0f;});}return null;};}function removeEntity(_0x478511,_0x187575){return function(_0x5a06f){if(_0x5a06f){return _0x5a06f[_0xeac9('0x21')]()[_0xeac9('0x20')](function(){_0x478511['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x19504d,_0x346d13){return function(_0x572cd1){if(!_0x572cd1){_0x19504d[_0xeac9('0x16')](0x194);}return _0x572cd1;};}function handleError(_0x2255c3,_0x3a4d57){_0x3a4d57=_0x3a4d57||0x1f4;return function(_0x125bc2){logger['error'](_0x125bc2[_0xeac9('0x22')]);if(_0x125bc2[_0xeac9('0x23')]){delete _0x125bc2[_0xeac9('0x23')];}_0x2255c3['status'](_0x3a4d57)[_0xeac9('0x24')](_0x125bc2);};}exports[_0xeac9('0x25')]=function(_0x31397c,_0x33bce7){var _0x38e7aa={},_0x24c648={},_0x3d4f86={'count':0x0,'rows':[]};var _0x365eab=db[_0xeac9('0x26')][_0xeac9('0x27')];_0x24c648['model']=_['keys'](_0x365eab);var _0x28699e={'dateStart':_0x31397c[_0xeac9('0x28')][_0xeac9('0x29')],'dateEnd':_0x31397c['query']['dateEnd']};delete _0x31397c[_0xeac9('0x28')][_0xeac9('0x29')];delete _0x31397c[_0xeac9('0x28')][_0xeac9('0x2a')];_0x24c648['query']=_[_0xeac9('0x2b')](_0x31397c[_0xeac9('0x28')]);_0x24c648[_0xeac9('0x2c')]=_[_0xeac9('0x2d')](_0x24c648[_0xeac9('0x2e')],_0x24c648[_0xeac9('0x28')]);_0x38e7aa[_0xeac9('0x2f')]=_[_0xeac9('0x2d')](_0x24c648['model'],qs['fields'](_0x31397c[_0xeac9('0x28')][_0xeac9('0x30')]));_0x38e7aa[_0xeac9('0x2f')]=_0x38e7aa[_0xeac9('0x2f')]['length']?_0x38e7aa[_0xeac9('0x2f')]:_0x24c648[_0xeac9('0x2e')];if(!_0x31397c[_0xeac9('0x28')][_0xeac9('0x31')]('nolimit')){_0x38e7aa['limit']=qs['limit'](_0x31397c[_0xeac9('0x28')][_0xeac9('0x1a')]);_0x38e7aa[_0xeac9('0x19')]=qs['offset'](_0x31397c['query']['offset']);}_0x38e7aa['order']=qs[_0xeac9('0x32')](_0x31397c[_0xeac9('0x28')][_0xeac9('0x32')]);_0x38e7aa[_0xeac9('0x33')]=qs['filters'](_[_0xeac9('0x34')](_0x31397c[_0xeac9('0x28')],_0x24c648['filters']));if(_0x28699e[_0xeac9('0x29')]){if(_0x28699e['dateEnd']){_0x28699e[_0xeac9('0x2a')]=moment(_0x28699e[_0xeac9('0x2a')])['add'](0x1,_0xeac9('0x35'));}else{_0x28699e[_0xeac9('0x2a')]=moment(_0x28699e['dateStart'])[_0xeac9('0x36')](0x1,_0xeac9('0x35'));}_[_0xeac9('0x37')](_0x38e7aa['where'],{'createdAt':{'$gte':_0x28699e[_0xeac9('0x29')],'$lte':_0x28699e[_0xeac9('0x2a')]}});}if(_0x31397c[_0xeac9('0x28')][_0xeac9('0x38')]){_0x38e7aa[_0xeac9('0x33')]=_['merge'](_0x38e7aa[_0xeac9('0x33')],{'$or':_['map'](_0x38e7aa[_0xeac9('0x2f')],function(_0x108620){var _0x4aa31a={};_0x4aa31a[_0x108620]={'$like':'%'+_0x31397c['query']['filter']+'%'};return _0x4aa31a;})});}_0x38e7aa=_['merge']({},_0x38e7aa,_0x31397c[_0xeac9('0x39')]);var _0x419d3d={'where':_0x38e7aa[_0xeac9('0x33')]};return db['MailServerOut'][_0xeac9('0x18')](_0x419d3d)['then'](function(_0x5578c8){_0x3d4f86['count']=_0x5578c8;if(_0x31397c[_0xeac9('0x28')][_0xeac9('0x3a')]){_0x38e7aa['include']=[{'all':!![]}];}return db[_0xeac9('0x26')][_0xeac9('0x3b')](_0x38e7aa);})[_0xeac9('0x20')](function(_0x5801f4){_0x3d4f86[_0xeac9('0x3c')]=_0x5801f4;return _0x3d4f86;})[_0xeac9('0x20')](respondWithFilteredResult(_0x33bce7,_0x38e7aa))[_0xeac9('0x3d')](handleError(_0x33bce7,null));};exports[_0xeac9('0x3e')]=function(_0x4abe6a,_0x110ec6){var _0x50a83b={'raw':!![],'where':{'id':_0x4abe6a[_0xeac9('0x3f')]['id']}},_0x3378fe={};_0x3378fe[_0xeac9('0x2e')]=_[_0xeac9('0x2b')](db['MailServerOut'][_0xeac9('0x27')]);_0x3378fe['query']=_[_0xeac9('0x2b')](_0x4abe6a[_0xeac9('0x28')]);_0x3378fe[_0xeac9('0x2c')]=_[_0xeac9('0x2d')](_0x3378fe[_0xeac9('0x2e')],_0x3378fe[_0xeac9('0x28')]);_0x50a83b[_0xeac9('0x2f')]=_[_0xeac9('0x2d')](_0x3378fe[_0xeac9('0x2e')],qs[_0xeac9('0x30')](_0x4abe6a[_0xeac9('0x28')][_0xeac9('0x30')]));_0x50a83b[_0xeac9('0x2f')]=_0x50a83b['attributes'][_0xeac9('0x40')]?_0x50a83b[_0xeac9('0x2f')]:_0x3378fe[_0xeac9('0x2e')];if(_0x4abe6a['query']['includeAll']){_0x50a83b[_0xeac9('0x41')]=[{'all':!![]}];}_0x50a83b=_[_0xeac9('0x37')]({},_0x50a83b,_0x4abe6a[_0xeac9('0x39')]);return db['MailServerOut'][_0xeac9('0x42')](_0x50a83b)[_0xeac9('0x20')](handleEntityNotFound(_0x110ec6,null))[_0xeac9('0x20')](respondWithResult(_0x110ec6,null))['catch'](handleError(_0x110ec6,null));};exports['create']=function(_0x3473a4,_0x21b89e){return db[_0xeac9('0x26')][_0xeac9('0x43')](_0x3473a4[_0xeac9('0x44')],{})[_0xeac9('0x20')](respondWithResult(_0x21b89e,0xc9))['catch'](handleError(_0x21b89e,null));};exports[_0xeac9('0x45')]=function(_0x42a5ac,_0x24158e){if(_0x42a5ac['body']['id']){delete _0x42a5ac[_0xeac9('0x44')]['id'];}return db['MailServerOut']['find']({'where':{'id':_0x42a5ac[_0xeac9('0x3f')]['id']}})[_0xeac9('0x20')](handleEntityNotFound(_0x24158e,null))['then'](saveUpdates(_0x42a5ac['body'],null))[_0xeac9('0x20')](respondWithResult(_0x24158e,null))[_0xeac9('0x3d')](handleError(_0x24158e,null));};exports['destroy']=function(_0x17f593,_0x1bc7d9){return db['MailServerOut'][_0xeac9('0x42')]({'where':{'id':_0x17f593[_0xeac9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1bc7d9,null))[_0xeac9('0x20')](removeEntity(_0x1bc7d9,null))[_0xeac9('0x3d')](handleError(_0x1bc7d9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 63f22bc..7e97da1 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 _0xd8fb=['mail_servers_out','lodash','util','../../config/logger','api','./mailServerOut.attributes','exports','define'];(function(_0x1708c8,_0x16b2c1){var _0x5ece80=function(_0xe1f4b1){while(--_0xe1f4b1){_0x1708c8['push'](_0x1708c8['shift']());}};_0x5ece80(++_0x16b2c1);}(_0xd8fb,0x99));var _0xbd8f=function(_0x13bc05,_0x463ca3){_0x13bc05=_0x13bc05-0x0;var _0x23b3d1=_0xd8fb[_0x13bc05];return _0x23b3d1;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xbd8f('0x4'));module[_0xbd8f('0x5')]=function(_0x53cccc,_0x400dfb){return _0x53cccc[_0xbd8f('0x6')]('MailServerOut',attributes,{'tableName':_0xbd8f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba18=['bluebird','request-promise','./mailServerOut.attributes','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x2e8dc1,_0xacba6a){var _0xea5a76=function(_0x1b9a2f){while(--_0x1b9a2f){_0x2e8dc1['push'](_0x2e8dc1['shift']());}};_0xea5a76(++_0xacba6a);}(_0xba18,0x1ea));var _0x8ba1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba18[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ba1('0x0'));var util=require(_0x8ba1('0x1'));var logger=require(_0x8ba1('0x2'))(_0x8ba1('0x3'));var moment=require(_0x8ba1('0x4'));var BPromise=require(_0x8ba1('0x5'));var rp=require(_0x8ba1('0x6'));var attributes=require(_0x8ba1('0x7'));module['exports']=function(_0xe3bc16,_0x3136d7){return _0xe3bc16[_0x8ba1('0x8')](_0x8ba1('0x9'),attributes,{'tableName':_0x8ba1('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 dcdccd3..68bda61 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 _0x282b=['randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1a9d37,_0x499855){var _0x368550=function(_0x1f94bd){while(--_0x1f94bd){_0x1a9d37['push'](_0x1a9d37['shift']());}};_0x368550(++_0x499855);}(_0x282b,0xec));var _0xb282=function(_0x41ce69,_0x257fab){_0x41ce69=_0x41ce69-0x0;var _0x2de43f=_0x282b[_0x41ce69];return _0x2de43f;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb282('0x5'))('rpc');var config=require(_0xb282('0x6'));var jayson=require(_0xb282('0x7'));var client=jayson[_0xb282('0x8')][_0xb282('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3cad41,_0x33635f,_0x4f0410){return new BPromise(function(_0x4a0d28,_0x17fba1){return client[_0xb282('0xa')](_0x3cad41,_0x4f0410)['then'](function(_0x2928cf){logger[_0xb282('0xb')](_0xb282('0xc'),_0x33635f,_0xb282('0xd'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0x33635f,_0xb282('0xd'),JSON[_0xb282('0xe')](_0x2928cf));if(_0x2928cf[_0xb282('0xf')]){if(_0x2928cf[_0xb282('0xf')][_0xb282('0x10')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x33635f,_0x2928cf[_0xb282('0xf')][_0xb282('0x11')]);return _0x17fba1(_0x2928cf[_0xb282('0xf')][_0xb282('0x11')]);}logger[_0xb282('0xf')]('MailServerOut,\x20%s,\x20%s',_0x33635f,_0x2928cf[_0xb282('0xf')]['message']);return _0x4a0d28(_0x2928cf[_0xb282('0xf')][_0xb282('0x11')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x33635f,'request\x20sent');_0x4a0d28(_0x2928cf[_0xb282('0x12')][_0xb282('0x11')]);}})[_0xb282('0x13')](function(_0xbb182){logger[_0xb282('0xf')]('MailServerOut,\x20%s,\x20%s',_0x33635f,_0xbb182);_0x17fba1(_0xbb182);});});} \ No newline at end of file +var _0x3b59=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','debug','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x38fb0d,_0x52b5db){var _0x30a5d6=function(_0x31eba6){while(--_0x31eba6){_0x38fb0d['push'](_0x38fb0d['shift']());}};_0x30a5d6(++_0x52b5db);}(_0x3b59,0x9c));var _0x93b5=function(_0x550c07,_0x5b70c0){_0x550c07=_0x550c07-0x0;var _0x5eabb7=_0x3b59[_0x550c07];return _0x5eabb7;};'use strict';var _=require(_0x93b5('0x0'));var util=require(_0x93b5('0x1'));var moment=require(_0x93b5('0x2'));var BPromise=require(_0x93b5('0x3'));var rs=require(_0x93b5('0x4'));var fs=require('fs');var db=require(_0x93b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x93b5('0x6'))('rpc');var config=require(_0x93b5('0x7'));var jayson=require(_0x93b5('0x8'));var client=jayson[_0x93b5('0x9')][_0x93b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5665a9,_0x3ecbe3,_0x34650d){return new BPromise(function(_0x4485b6,_0x484849){return client[_0x93b5('0xb')](_0x5665a9,_0x34650d)[_0x93b5('0xc')](function(_0x395ee1){logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x3ecbe3,'request\x20sent');logger[_0x93b5('0xf')](_0x93b5('0x10'),_0x3ecbe3,_0x93b5('0x11'),JSON[_0x93b5('0x12')](_0x395ee1));if(_0x395ee1[_0x93b5('0x13')]){if(_0x395ee1['error'][_0x93b5('0x14')]===0x1f4){logger[_0x93b5('0x13')]('MailServerOut,\x20%s,\x20%s',_0x3ecbe3,_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);return _0x484849(_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);}logger[_0x93b5('0x13')]('MailServerOut,\x20%s,\x20%s',_0x3ecbe3,_0x395ee1[_0x93b5('0x13')][_0x93b5('0x15')]);return _0x4485b6(_0x395ee1['error'][_0x93b5('0x15')]);}else{logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x3ecbe3,'request\x20sent');_0x4485b6(_0x395ee1[_0x93b5('0x16')]['message']);}})['catch'](function(_0x2bb397){logger['error'](_0x93b5('0xe'),_0x3ecbe3,_0x2bb397);_0x484849(_0x2bb397);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9d77d18..d66c451 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 _0x06ef=['../../config/environment','./mailSubstatus.controller','get','index','isAuthenticated','show','post','create','/:id','delete','destroy','exports','path'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x06ef,0x185));var _0xf06e=function(_0x305ac2,_0x3fae6e){_0x305ac2=_0x305ac2-0x0;var _0x54cd61=_0x06ef[_0x305ac2];return _0x54cd61;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf06e('0x0'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf06e('0x1'));var controller=require(_0xf06e('0x2'));router[_0xf06e('0x3')]('/',auth['isAuthenticated'](),controller[_0xf06e('0x4')]);router[_0xf06e('0x3')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xf06e('0x5')](),controller[_0xf06e('0x6')]);router[_0xf06e('0x7')]('/',auth[_0xf06e('0x5')](),controller[_0xf06e('0x8')]);router['put'](_0xf06e('0x9'),auth[_0xf06e('0x5')](),controller['update']);router[_0xf06e('0xa')](_0xf06e('0x9'),auth[_0xf06e('0x5')](),controller[_0xf06e('0xb')]);module[_0xf06e('0xc')]=router; \ No newline at end of file +var _0x131e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','get','/describe','show','post','create','/:id','update','delete','destroy','express'];(function(_0x1d6fda,_0x38b3dd){var _0x14dc96=function(_0x517573){while(--_0x517573){_0x1d6fda['push'](_0x1d6fda['shift']());}};_0x14dc96(++_0x38b3dd);}(_0x131e,0x1ec));var _0xe131=function(_0x51bf2a,_0x5cd025){_0x51bf2a=_0x51bf2a-0x0;var _0x394621=_0x131e[_0x51bf2a];return _0x394621;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xe131('0x0'));var router=express[_0xe131('0x1')]();var auth=require(_0xe131('0x2'));var interaction=require(_0xe131('0x3'));var config=require(_0xe131('0x4'));var controller=require(_0xe131('0x5'));router['get']('/',auth[_0xe131('0x6')](),controller[_0xe131('0x7')]);router[_0xe131('0x8')](_0xe131('0x9'),auth[_0xe131('0x6')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe131('0xa')]);router[_0xe131('0xb')]('/',auth['isAuthenticated'](),controller[_0xe131('0xc')]);router['put'](_0xe131('0xd'),auth[_0xe131('0x6')](),controller[_0xe131('0xe')]);router[_0xe131('0xf')](_0xe131('0xd'),auth[_0xe131('0x6')](),controller[_0xe131('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 9da94ee..eee4db9 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 _0xf45e=['STRING','sequelize'];(function(_0x1dc24d,_0x541fa4){var _0x5d7fb2=function(_0x7ccd26){while(--_0x7ccd26){_0x1dc24d['push'](_0x1dc24d['shift']());}};_0x5d7fb2(++_0x541fa4);}(_0xf45e,0x115));var _0xef45=function(_0x4da905,_0x1728d1){_0x4da905=_0x4da905-0x0;var _0x149042=_0xf45e[_0x4da905];return _0x149042;};'use strict';var Sequelize=require(_0xef45('0x0'));module['exports']={'name':{'type':Sequelize[_0xef45('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xef45('0x1')]}}; \ No newline at end of file +var _0x02a7=['STRING','name','exports'];(function(_0x44585b,_0x5c43fc){var _0x173bf9=function(_0x21787c){while(--_0x21787c){_0x44585b['push'](_0x44585b['shift']());}};_0x173bf9(++_0x5c43fc);}(_0x02a7,0x1a6));var _0x702a=function(_0x4694dd,_0xc7d3ff){_0x4694dd=_0x4694dd-0x0;var _0x330af3=_0x02a7[_0x4694dd];return _0x330af3;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize[_0x702a('0x1')],'unique':_0x702a('0x2'),'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 2318412..43f715c 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 _0x30a3=['attributes','fields','hasOwnProperty','nolimit','limit','order','where','dateEnd','add','day','merge','filter','options','MailSubstatus','count','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','Content-Range','apply','reject','update','then','error','stack','index','rawAttributes','model','keys','dateStart','query','filters','intersection'];(function(_0x2f859a,_0x30915e){var _0x217fa3=function(_0x2c09e4){while(--_0x2c09e4){_0x2f859a['push'](_0x2f859a['shift']());}};_0x217fa3(++_0x30915e);}(_0x30a3,0x1a8));var _0x330a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x30a3[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0x330a('0x0'));var rp=require(_0x330a('0x1'));var moment=require(_0x330a('0x2'));var BPromise=require(_0x330a('0x3'));var Mustache=require(_0x330a('0x4'));var util=require('util');var path=require(_0x330a('0x5'));var sox=require(_0x330a('0x6'));var csv=require(_0x330a('0x7'));var ejs=require(_0x330a('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x330a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x330a('0xa'));var toCsv=require('to-csv');var querystring=require(_0x330a('0xb'));var Papa=require(_0x330a('0xc'));var qs=require(_0x330a('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0x330a('0xe'));var config=require(_0x330a('0xf'));var db=require(_0x330a('0x10'))['db'];function respondWithStatusCode(_0x211d02,_0x3e01ff){_0x3e01ff=_0x3e01ff||0xcc;return function(_0x1c2f78){if(_0x1c2f78){return _0x211d02[_0x330a('0x11')](_0x3e01ff);}return _0x211d02['status'](_0x3e01ff)[_0x330a('0x12')]();};}function respondWithResult(_0x3c37be,_0x10676f){_0x10676f=_0x10676f||0xc8;return function(_0x6837c){if(_0x6837c){return _0x3c37be[_0x330a('0x13')](_0x10676f)[_0x330a('0x14')](_0x6837c);}};}function respondWithFilteredResult(_0x4ebd8e,_0x9c1eb9){return function(_0x545217){if(_0x545217){var _0x36b8fe=_0x545217['count'],_0x24d42c=_0x9c1eb9[_0x330a('0x15')],_0x252960=_0x9c1eb9[_0x330a('0x15')]+_0x9c1eb9['limit'],_0x638f10;if(_0x252960>=_0x36b8fe){_0x252960=_0x36b8fe;_0x638f10=0xc8;}else{_0x638f10=0xce;}_0x4ebd8e[_0x330a('0x13')](_0x638f10);return _0x4ebd8e[_0x330a('0x16')](_0x330a('0x17'),_0x24d42c+'-'+_0x252960+'/'+_0x36b8fe)['json'](_0x545217);}return null;};}function patchUpdates(_0x43bef8){return function(_0x48bf36){try{jsonpatch[_0x330a('0x18')](_0x48bf36,_0x43bef8,!![]);}catch(_0x35ceb3){return BPromise[_0x330a('0x19')](_0x35ceb3);}return _0x48bf36['save']();};}function saveUpdates(_0x59d924,_0x5e9973){return function(_0x74e6fe){if(_0x74e6fe){return _0x74e6fe[_0x330a('0x1a')](_0x59d924)['then'](function(_0x543a36){return _0x543a36;});}return null;};}function removeEntity(_0x809c80,_0x216211){return function(_0x583120){if(_0x583120){return _0x583120['destroy']()[_0x330a('0x1b')](function(){_0x809c80[_0x330a('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3eed,_0x572b2a){return function(_0x300df5){if(!_0x300df5){_0x2d3eed[_0x330a('0x11')](0x194);}return _0x300df5;};}function handleError(_0x39afd2,_0x14b063){_0x14b063=_0x14b063||0x1f4;return function(_0x2237c1){logger[_0x330a('0x1c')](_0x2237c1[_0x330a('0x1d')]);if(_0x2237c1['name']){delete _0x2237c1['name'];}_0x39afd2[_0x330a('0x13')](_0x14b063)['send'](_0x2237c1);};}exports[_0x330a('0x1e')]=function(_0x539adb,_0x577415){var _0x25a715={},_0x296ac1={},_0x26dd4f={'count':0x0,'rows':[]};var _0x1ba3ef=db['MailSubstatus'][_0x330a('0x1f')];_0x296ac1[_0x330a('0x20')]=_[_0x330a('0x21')](_0x1ba3ef);var _0x5806c0={'dateStart':_0x539adb['query'][_0x330a('0x22')],'dateEnd':_0x539adb[_0x330a('0x23')]['dateEnd']};delete _0x539adb['query'][_0x330a('0x22')];delete _0x539adb[_0x330a('0x23')]['dateEnd'];_0x296ac1['query']=_[_0x330a('0x21')](_0x539adb['query']);_0x296ac1[_0x330a('0x24')]=_[_0x330a('0x25')](_0x296ac1[_0x330a('0x20')],_0x296ac1['query']);_0x25a715[_0x330a('0x26')]=_[_0x330a('0x25')](_0x296ac1[_0x330a('0x20')],qs[_0x330a('0x27')](_0x539adb[_0x330a('0x23')][_0x330a('0x27')]));_0x25a715[_0x330a('0x26')]=_0x25a715[_0x330a('0x26')]['length']?_0x25a715[_0x330a('0x26')]:_0x296ac1['model'];if(!_0x539adb[_0x330a('0x23')][_0x330a('0x28')](_0x330a('0x29'))){_0x25a715[_0x330a('0x2a')]=qs['limit'](_0x539adb[_0x330a('0x23')]['limit']);_0x25a715[_0x330a('0x15')]=qs['offset'](_0x539adb[_0x330a('0x23')]['offset']);}_0x25a715[_0x330a('0x2b')]=qs['sort'](_0x539adb[_0x330a('0x23')]['sort']);_0x25a715[_0x330a('0x2c')]=qs[_0x330a('0x24')](_['pick'](_0x539adb['query'],_0x296ac1['filters']));if(_0x5806c0[_0x330a('0x22')]){if(_0x5806c0['dateEnd']){_0x5806c0[_0x330a('0x2d')]=moment(_0x5806c0[_0x330a('0x2d')])[_0x330a('0x2e')](0x1,_0x330a('0x2f'));}else{_0x5806c0['dateEnd']=moment(_0x5806c0[_0x330a('0x22')])['add'](0x1,'day');}_[_0x330a('0x30')](_0x25a715['where'],{'createdAt':{'$gte':_0x5806c0[_0x330a('0x22')],'$lte':_0x5806c0['dateEnd']}});}if(_0x539adb[_0x330a('0x23')]['filter']){_0x25a715[_0x330a('0x2c')]=_['merge'](_0x25a715['where'],{'$or':_['map'](_0x25a715[_0x330a('0x26')],function(_0x22a84a){var _0x56a76f={};_0x56a76f[_0x22a84a]={'$like':'%'+_0x539adb['query'][_0x330a('0x31')]+'%'};return _0x56a76f;})});}_0x25a715=_[_0x330a('0x30')]({},_0x25a715,_0x539adb[_0x330a('0x32')]);var _0x1ab3ed={'where':_0x25a715[_0x330a('0x2c')]};return db[_0x330a('0x33')][_0x330a('0x34')](_0x1ab3ed)['then'](function(_0x1797b7){_0x26dd4f['count']=_0x1797b7;if(_0x539adb['query']['includeAll']){_0x25a715[_0x330a('0x35')]=[{'all':!![]}];}return db[_0x330a('0x33')][_0x330a('0x36')](_0x25a715);})['then'](function(_0x556ef8){_0x26dd4f[_0x330a('0x37')]=_0x556ef8;return _0x26dd4f;})[_0x330a('0x1b')](respondWithFilteredResult(_0x577415,_0x25a715))[_0x330a('0x38')](handleError(_0x577415,null));};exports[_0x330a('0x39')]=function(_0x4f9a65,_0x219b46){var _0xabf35={'raw':!![],'where':{'id':_0x4f9a65[_0x330a('0x3a')]['id']}},_0x59a3ff={};_0x59a3ff['model']=_[_0x330a('0x21')](db['MailSubstatus']['rawAttributes']);_0x59a3ff[_0x330a('0x23')]=_[_0x330a('0x21')](_0x4f9a65[_0x330a('0x23')]);_0x59a3ff[_0x330a('0x24')]=_[_0x330a('0x25')](_0x59a3ff[_0x330a('0x20')],_0x59a3ff[_0x330a('0x23')]);_0xabf35[_0x330a('0x26')]=_['intersection'](_0x59a3ff[_0x330a('0x20')],qs[_0x330a('0x27')](_0x4f9a65[_0x330a('0x23')][_0x330a('0x27')]));_0xabf35[_0x330a('0x26')]=_0xabf35[_0x330a('0x26')][_0x330a('0x3b')]?_0xabf35[_0x330a('0x26')]:_0x59a3ff[_0x330a('0x20')];if(_0x4f9a65[_0x330a('0x23')][_0x330a('0x3c')]){_0xabf35[_0x330a('0x35')]=[{'all':!![]}];}_0xabf35=_[_0x330a('0x30')]({},_0xabf35,_0x4f9a65[_0x330a('0x32')]);return db['MailSubstatus'][_0x330a('0x3d')](_0xabf35)[_0x330a('0x1b')](handleEntityNotFound(_0x219b46,null))['then'](respondWithResult(_0x219b46,null))[_0x330a('0x38')](handleError(_0x219b46,null));};exports[_0x330a('0x3e')]=function(_0x53016,_0x1ce644){return db[_0x330a('0x33')][_0x330a('0x3e')](_0x53016[_0x330a('0x3f')],{})[_0x330a('0x1b')](respondWithResult(_0x1ce644,0xc9))['catch'](handleError(_0x1ce644,null));};exports[_0x330a('0x1a')]=function(_0x28942e,_0x5e8a56){if(_0x28942e[_0x330a('0x3f')]['id']){delete _0x28942e[_0x330a('0x3f')]['id'];}return db[_0x330a('0x33')][_0x330a('0x3d')]({'where':{'id':_0x28942e[_0x330a('0x3a')]['id']}})[_0x330a('0x1b')](handleEntityNotFound(_0x5e8a56,null))[_0x330a('0x1b')](saveUpdates(_0x28942e[_0x330a('0x3f')],null))['then'](respondWithResult(_0x5e8a56,null))[_0x330a('0x38')](handleError(_0x5e8a56,null));};exports[_0x330a('0x40')]=function(_0x4556db,_0x4adc95){return db[_0x330a('0x33')][_0x330a('0x3d')]({'where':{'id':_0x4556db[_0x330a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4adc95,null))[_0x330a('0x1b')](removeEntity(_0x4adc95,null))['catch'](handleError(_0x4adc95,null));};exports['describe']=function(_0x1639b4,_0x47ced7){return db[_0x330a('0x33')][_0x330a('0x41')]()['then'](respondWithResult(_0x47ced7,null))[_0x330a('0x38')](handleError(_0x47ced7,null));}; \ No newline at end of file +var _0x32bc=['path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','status','json','count','offset','set','apply','reject','save','update','then','end','error','stack','name','send','index','MailSubstatus','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','add','day','merge','where','filter','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment'];(function(_0x3df246,_0x489654){var _0x4c639f=function(_0x28c83){while(--_0x28c83){_0x3df246['push'](_0x3df246['shift']());}};_0x4c639f(++_0x489654);}(_0x32bc,0x195));var _0xc32b=function(_0x387056,_0x5550a5){_0x387056=_0x387056-0x0;var _0x3b276d=_0x32bc[_0x387056];return _0x3b276d;};'use strict';var jsonpatch=require(_0xc32b('0x0'));var rp=require(_0xc32b('0x1'));var moment=require(_0xc32b('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc32b('0x3'));var sox=require(_0xc32b('0x4'));var csv=require('to-csv');var ejs=require(_0xc32b('0x5'));var fs=require('fs');var _=require(_0xc32b('0x6'));var squel=require('squel');var crypto=require(_0xc32b('0x7'));var jsforce=require(_0xc32b('0x8'));var deskjs=require(_0xc32b('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc32b('0xa'));var Papa=require(_0xc32b('0xb'));var qs=require(_0xc32b('0xc'));var logger=require(_0xc32b('0xd'))('api');var utils=require(_0xc32b('0xe'));var config=require(_0xc32b('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1319a7,_0x58f58e){_0x58f58e=_0x58f58e||0xcc;return function(_0x22a5ea){if(_0x22a5ea){return _0x1319a7['sendStatus'](_0x58f58e);}return _0x1319a7[_0xc32b('0x10')](_0x58f58e)['end']();};}function respondWithResult(_0x2181a1,_0x5b2c65){_0x5b2c65=_0x5b2c65||0xc8;return function(_0x458865){if(_0x458865){return _0x2181a1[_0xc32b('0x10')](_0x5b2c65)[_0xc32b('0x11')](_0x458865);}};}function respondWithFilteredResult(_0x53d3c2,_0x5eada8){return function(_0x44194f){if(_0x44194f){var _0x3da2de=_0x44194f[_0xc32b('0x12')],_0x339308=_0x5eada8['offset'],_0x26a449=_0x5eada8[_0xc32b('0x13')]+_0x5eada8['limit'],_0x45774f;if(_0x26a449>=_0x3da2de){_0x26a449=_0x3da2de;_0x45774f=0xc8;}else{_0x45774f=0xce;}_0x53d3c2['status'](_0x45774f);return _0x53d3c2[_0xc32b('0x14')]('Content-Range',_0x339308+'-'+_0x26a449+'/'+_0x3da2de)[_0xc32b('0x11')](_0x44194f);}return null;};}function patchUpdates(_0x20e636){return function(_0x128efe){try{jsonpatch[_0xc32b('0x15')](_0x128efe,_0x20e636,!![]);}catch(_0x285100){return BPromise[_0xc32b('0x16')](_0x285100);}return _0x128efe[_0xc32b('0x17')]();};}function saveUpdates(_0x3a9f06,_0x4566ab){return function(_0x363786){if(_0x363786){return _0x363786[_0xc32b('0x18')](_0x3a9f06)[_0xc32b('0x19')](function(_0x1b5c32){return _0x1b5c32;});}return null;};}function removeEntity(_0x2a1fa5,_0x21ff9e){return function(_0x3d49ae){if(_0x3d49ae){return _0x3d49ae['destroy']()['then'](function(){_0x2a1fa5[_0xc32b('0x10')](0xcc)[_0xc32b('0x1a')]();});}};}function handleEntityNotFound(_0x8a1827,_0x353267){return function(_0x20e1c4){if(!_0x20e1c4){_0x8a1827['sendStatus'](0x194);}return _0x20e1c4;};}function handleError(_0x2522e1,_0x43a246){_0x43a246=_0x43a246||0x1f4;return function(_0x55ce80){logger[_0xc32b('0x1b')](_0x55ce80[_0xc32b('0x1c')]);if(_0x55ce80[_0xc32b('0x1d')]){delete _0x55ce80[_0xc32b('0x1d')];}_0x2522e1[_0xc32b('0x10')](_0x43a246)[_0xc32b('0x1e')](_0x55ce80);};}exports[_0xc32b('0x1f')]=function(_0x12d28d,_0x4a1224){var _0x6ce7e={},_0xe76758={},_0x147342={'count':0x0,'rows':[]};var _0x21d626=db[_0xc32b('0x20')][_0xc32b('0x21')];_0xe76758[_0xc32b('0x22')]=_[_0xc32b('0x23')](_0x21d626);var _0x3a014d={'dateStart':_0x12d28d[_0xc32b('0x24')][_0xc32b('0x25')],'dateEnd':_0x12d28d[_0xc32b('0x24')][_0xc32b('0x26')]};delete _0x12d28d[_0xc32b('0x24')]['dateStart'];delete _0x12d28d[_0xc32b('0x24')][_0xc32b('0x26')];_0xe76758['query']=_[_0xc32b('0x23')](_0x12d28d[_0xc32b('0x24')]);_0xe76758['filters']=_[_0xc32b('0x27')](_0xe76758[_0xc32b('0x22')],_0xe76758['query']);_0x6ce7e[_0xc32b('0x28')]=_['intersection'](_0xe76758[_0xc32b('0x22')],qs[_0xc32b('0x29')](_0x12d28d[_0xc32b('0x24')][_0xc32b('0x29')]));_0x6ce7e['attributes']=_0x6ce7e[_0xc32b('0x28')][_0xc32b('0x2a')]?_0x6ce7e[_0xc32b('0x28')]:_0xe76758[_0xc32b('0x22')];if(!_0x12d28d[_0xc32b('0x24')][_0xc32b('0x2b')](_0xc32b('0x2c'))){_0x6ce7e[_0xc32b('0x2d')]=qs[_0xc32b('0x2d')](_0x12d28d[_0xc32b('0x24')]['limit']);_0x6ce7e[_0xc32b('0x13')]=qs['offset'](_0x12d28d['query'][_0xc32b('0x13')]);}_0x6ce7e[_0xc32b('0x2e')]=qs['sort'](_0x12d28d[_0xc32b('0x24')][_0xc32b('0x2f')]);_0x6ce7e['where']=qs[_0xc32b('0x30')](_['pick'](_0x12d28d[_0xc32b('0x24')],_0xe76758[_0xc32b('0x30')]));if(_0x3a014d[_0xc32b('0x25')]){if(_0x3a014d[_0xc32b('0x26')]){_0x3a014d[_0xc32b('0x26')]=moment(_0x3a014d['dateEnd'])[_0xc32b('0x31')](0x1,_0xc32b('0x32'));}else{_0x3a014d[_0xc32b('0x26')]=moment(_0x3a014d['dateStart'])['add'](0x1,'day');}_[_0xc32b('0x33')](_0x6ce7e[_0xc32b('0x34')],{'createdAt':{'$gte':_0x3a014d[_0xc32b('0x25')],'$lte':_0x3a014d['dateEnd']}});}if(_0x12d28d[_0xc32b('0x24')][_0xc32b('0x35')]){_0x6ce7e[_0xc32b('0x34')]=_[_0xc32b('0x33')](_0x6ce7e[_0xc32b('0x34')],{'$or':_[_0xc32b('0x36')](_0x6ce7e[_0xc32b('0x28')],function(_0x34c781){var _0x46c4b8={};_0x46c4b8[_0x34c781]={'$like':'%'+_0x12d28d[_0xc32b('0x24')][_0xc32b('0x35')]+'%'};return _0x46c4b8;})});}_0x6ce7e=_['merge']({},_0x6ce7e,_0x12d28d[_0xc32b('0x37')]);var _0xe20add={'where':_0x6ce7e[_0xc32b('0x34')]};return db[_0xc32b('0x20')][_0xc32b('0x12')](_0xe20add)[_0xc32b('0x19')](function(_0x193bfb){_0x147342[_0xc32b('0x12')]=_0x193bfb;if(_0x12d28d[_0xc32b('0x24')][_0xc32b('0x38')]){_0x6ce7e[_0xc32b('0x39')]=[{'all':!![]}];}return db[_0xc32b('0x20')][_0xc32b('0x3a')](_0x6ce7e);})[_0xc32b('0x19')](function(_0x3b54df){_0x147342[_0xc32b('0x3b')]=_0x3b54df;return _0x147342;})[_0xc32b('0x19')](respondWithFilteredResult(_0x4a1224,_0x6ce7e))['catch'](handleError(_0x4a1224,null));};exports[_0xc32b('0x3c')]=function(_0x58901f,_0x12883b){var _0x3508e9={'raw':!![],'where':{'id':_0x58901f[_0xc32b('0x3d')]['id']}},_0x861ca6={};_0x861ca6[_0xc32b('0x22')]=_[_0xc32b('0x23')](db['MailSubstatus']['rawAttributes']);_0x861ca6[_0xc32b('0x24')]=_[_0xc32b('0x23')](_0x58901f[_0xc32b('0x24')]);_0x861ca6[_0xc32b('0x30')]=_[_0xc32b('0x27')](_0x861ca6['model'],_0x861ca6[_0xc32b('0x24')]);_0x3508e9[_0xc32b('0x28')]=_[_0xc32b('0x27')](_0x861ca6[_0xc32b('0x22')],qs[_0xc32b('0x29')](_0x58901f[_0xc32b('0x24')]['fields']));_0x3508e9[_0xc32b('0x28')]=_0x3508e9[_0xc32b('0x28')]['length']?_0x3508e9['attributes']:_0x861ca6[_0xc32b('0x22')];if(_0x58901f[_0xc32b('0x24')]['includeAll']){_0x3508e9['include']=[{'all':!![]}];}_0x3508e9=_[_0xc32b('0x33')]({},_0x3508e9,_0x58901f[_0xc32b('0x37')]);return db[_0xc32b('0x20')][_0xc32b('0x3e')](_0x3508e9)[_0xc32b('0x19')](handleEntityNotFound(_0x12883b,null))['then'](respondWithResult(_0x12883b,null))[_0xc32b('0x3f')](handleError(_0x12883b,null));};exports[_0xc32b('0x40')]=function(_0x2cf31c,_0xdd5b04){return db[_0xc32b('0x20')][_0xc32b('0x40')](_0x2cf31c[_0xc32b('0x41')],{})[_0xc32b('0x19')](respondWithResult(_0xdd5b04,0xc9))['catch'](handleError(_0xdd5b04,null));};exports[_0xc32b('0x18')]=function(_0x163ddf,_0x1c74f2){if(_0x163ddf['body']['id']){delete _0x163ddf[_0xc32b('0x41')]['id'];}return db[_0xc32b('0x20')][_0xc32b('0x3e')]({'where':{'id':_0x163ddf[_0xc32b('0x3d')]['id']}})[_0xc32b('0x19')](handleEntityNotFound(_0x1c74f2,null))['then'](saveUpdates(_0x163ddf[_0xc32b('0x41')],null))[_0xc32b('0x19')](respondWithResult(_0x1c74f2,null))[_0xc32b('0x3f')](handleError(_0x1c74f2,null));};exports[_0xc32b('0x42')]=function(_0x1eecad,_0x5b7a7d){return db[_0xc32b('0x20')][_0xc32b('0x3e')]({'where':{'id':_0x1eecad[_0xc32b('0x3d')]['id']}})[_0xc32b('0x19')](handleEntityNotFound(_0x5b7a7d,null))[_0xc32b('0x19')](removeEntity(_0x5b7a7d,null))[_0xc32b('0x3f')](handleError(_0x5b7a7d,null));};exports[_0xc32b('0x43')]=function(_0xa0ac06,_0x2c3ea1){return db[_0xc32b('0x20')][_0xc32b('0x43')]()[_0xc32b('0x19')](respondWithResult(_0x2c3ea1,null))[_0xc32b('0x3f')](handleError(_0x2c3ea1,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 911a87a..380b3e0 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 _0x6021=['moment','bluebird','exports','define','MailSubstatus','lodash','util'];(function(_0x5191e5,_0x354417){var _0x5c57d4=function(_0x475bd9){while(--_0x475bd9){_0x5191e5['push'](_0x5191e5['shift']());}};_0x5c57d4(++_0x354417);}(_0x6021,0x124));var _0x1602=function(_0x1c7b38,_0x3a96d1){_0x1c7b38=_0x1c7b38-0x0;var _0x3d198d=_0x6021[_0x1c7b38];return _0x3d198d;};'use strict';var _=require(_0x1602('0x0'));var util=require(_0x1602('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1602('0x2'));var BPromise=require(_0x1602('0x3'));var rp=require('request-promise');var attributes=require('./mailSubstatus.attributes');module[_0x1602('0x4')]=function(_0x1b05ff,_0x5476c1){return _0x1b05ff[_0x1602('0x5')](_0x1602('0x6'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b1=['../../config/logger','api','./mailSubstatus.attributes','exports','MailSubstatus','lodash','util'];(function(_0x5602d4,_0x5a74f9){var _0x55e5ae=function(_0x184a4b){while(--_0x184a4b){_0x5602d4['push'](_0x5602d4['shift']());}};_0x55e5ae(++_0x5a74f9);}(_0x28b1,0x1a2));var _0x128b=function(_0x4ebe59,_0x734c2){_0x4ebe59=_0x4ebe59-0x0;var _0x3242b=_0x28b1[_0x4ebe59];return _0x3242b;};'use strict';var _=require(_0x128b('0x0'));var util=require(_0x128b('0x1'));var logger=require(_0x128b('0x2'))(_0x128b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x128b('0x4'));module[_0x128b('0x5')]=function(_0x541024,_0x3a80c9){return _0x541024['define'](_0x128b('0x6'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 7c28bce..ac7842c 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 _0x7d1b=['stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s'];(function(_0x2d4554,_0x58451b){var _0x23f3d8=function(_0x1af9ff){while(--_0x1af9ff){_0x2d4554['push'](_0x2d4554['shift']());}};_0x23f3d8(++_0x58451b);}(_0x7d1b,0x175));var _0xb7d1=function(_0x9a27b9,_0x5c5181){_0x9a27b9=_0x9a27b9-0x0;var _0x75f17b=_0x7d1b[_0x9a27b9];return _0x75f17b;};'use strict';var _=require(_0xb7d1('0x0'));var util=require(_0xb7d1('0x1'));var moment=require(_0xb7d1('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7d1('0x3'));var fs=require('fs');var db=require(_0xb7d1('0x4'))['db'];var utils=require(_0xb7d1('0x5'));var logger=require(_0xb7d1('0x6'))(_0xb7d1('0x7'));var config=require(_0xb7d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb7d1('0x9')][_0xb7d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2649df,_0x2b1704,_0x5aa594){return new BPromise(function(_0x21f69d,_0x189c66){return client[_0xb7d1('0xb')](_0x2649df,_0x5aa594)[_0xb7d1('0xc')](function(_0x49e82a){logger[_0xb7d1('0xd')](_0xb7d1('0xe'),_0x2b1704,_0xb7d1('0xf'));logger[_0xb7d1('0x10')](_0xb7d1('0x11'),_0x2b1704,'request\x20sent',JSON[_0xb7d1('0x12')](_0x49e82a));if(_0x49e82a[_0xb7d1('0x13')]){if(_0x49e82a[_0xb7d1('0x13')]['code']===0x1f4){logger[_0xb7d1('0x13')](_0xb7d1('0xe'),_0x2b1704,_0x49e82a[_0xb7d1('0x13')]['message']);return _0x189c66(_0x49e82a['error'][_0xb7d1('0x14')]);}logger[_0xb7d1('0x13')](_0xb7d1('0xe'),_0x2b1704,_0x49e82a[_0xb7d1('0x13')]['message']);return _0x21f69d(_0x49e82a[_0xb7d1('0x13')][_0xb7d1('0x14')]);}else{logger[_0xb7d1('0xd')](_0xb7d1('0xe'),_0x2b1704,_0xb7d1('0xf'));_0x21f69d(_0x49e82a[_0xb7d1('0x15')][_0xb7d1('0x14')]);}})[_0xb7d1('0x16')](function(_0x56ecd8){logger[_0xb7d1('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x2b1704,_0x56ecd8);_0x189c66(_0x56ecd8);});});} \ No newline at end of file +var _0xdb81=['request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x378eb1,_0x97b24b){var _0x2b9291=function(_0x444cec){while(--_0x444cec){_0x378eb1['push'](_0x378eb1['shift']());}};_0x2b9291(++_0x97b24b);}(_0xdb81,0x191));var _0x1db8=function(_0x28da79,_0x54d56b){_0x28da79=_0x28da79-0x0;var _0x477817=_0xdb81[_0x28da79];return _0x477817;};'use strict';var _=require(_0x1db8('0x0'));var util=require(_0x1db8('0x1'));var moment=require(_0x1db8('0x2'));var BPromise=require('bluebird');var rs=require(_0x1db8('0x3'));var fs=require('fs');var db=require(_0x1db8('0x4'))['db'];var utils=require(_0x1db8('0x5'));var logger=require('../../config/logger')(_0x1db8('0x6'));var config=require(_0x1db8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1db8('0x8')][_0x1db8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35c4b9,_0x94bea2,_0x5b84e9){return new BPromise(function(_0x57c053,_0x37f05c){return client[_0x1db8('0xa')](_0x35c4b9,_0x5b84e9)[_0x1db8('0xb')](function(_0xcc9db7){logger[_0x1db8('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x94bea2,_0x1db8('0xd'));logger[_0x1db8('0xe')](_0x1db8('0xf'),_0x94bea2,_0x1db8('0xd'),JSON[_0x1db8('0x10')](_0xcc9db7));if(_0xcc9db7[_0x1db8('0x11')]){if(_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x12')]===0x1f4){logger[_0x1db8('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x94bea2,_0xcc9db7[_0x1db8('0x11')]['message']);return _0x37f05c(_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x13')]);}logger[_0x1db8('0x11')](_0x1db8('0x14'),_0x94bea2,_0xcc9db7[_0x1db8('0x11')][_0x1db8('0x13')]);return _0x57c053(_0xcc9db7['error'][_0x1db8('0x13')]);}else{logger[_0x1db8('0xc')](_0x1db8('0x14'),_0x94bea2,'request\x20sent');_0x57c053(_0xcc9db7[_0x1db8('0x15')][_0x1db8('0x13')]);}})[_0x1db8('0x16')](function(_0x13ecc7){logger[_0x1db8('0x11')](_0x1db8('0x14'),_0x94bea2,_0x13ecc7);_0x37f05c(_0x13ecc7);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 2b6b472..fdc9c66 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 _0xec85=['path','express','Router','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','exports','multer','util'];(function(_0x4dc8bf,_0xb228f0){var _0x2565df=function(_0x5c97cc){while(--_0x5c97cc){_0x4dc8bf['push'](_0x4dc8bf['shift']());}};_0x2565df(++_0xb228f0);}(_0xec85,0x18d));var _0x5ec8=function(_0x7bf2ef,_0x3f0809){_0x7bf2ef=_0x7bf2ef-0x0;var _0x9a0b50=_0xec85[_0x7bf2ef];return _0x9a0b50;};'use strict';var multer=require(_0x5ec8('0x0'));var util=require(_0x5ec8('0x1'));var path=require(_0x5ec8('0x2'));var express=require(_0x5ec8('0x3'));var router=express[_0x5ec8('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x5ec8('0x5'));var config=require(_0x5ec8('0x6'));var controller=require(_0x5ec8('0x7'));router[_0x5ec8('0x8')]('/',auth[_0x5ec8('0x9')](),controller[_0x5ec8('0xa')]);router[_0x5ec8('0x8')](_0x5ec8('0xb'),auth[_0x5ec8('0x9')](),controller[_0x5ec8('0xc')]);router[_0x5ec8('0x8')](_0x5ec8('0xd'),auth[_0x5ec8('0x9')](),controller[_0x5ec8('0xe')]);router[_0x5ec8('0xf')]('/',auth[_0x5ec8('0x9')](),controller[_0x5ec8('0x10')]);router[_0x5ec8('0x11')](_0x5ec8('0xd'),auth[_0x5ec8('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x5ec8('0x12')]=router; \ No newline at end of file +var _0x4a5c=['index','/describe','describe','show','post','create','put','/:id','update','delete','destroy','exports','express','../../components/auth/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x4a5c,0x150));var _0xc4a5=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x4a5c[_0x4a3acd];return _0x3efdaa;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xc4a5('0x0'));var router=express['Router']();var auth=require(_0xc4a5('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0xc4a5('0x2'));var controller=require(_0xc4a5('0x3'));router[_0xc4a5('0x4')]('/',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x6')]);router[_0xc4a5('0x4')](_0xc4a5('0x7'),auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x8')]);router['get']('/:id',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x9')]);router[_0xc4a5('0xa')]('/',auth[_0xc4a5('0x5')](),controller[_0xc4a5('0xb')]);router[_0xc4a5('0xc')](_0xc4a5('0xd'),auth['isAuthenticated'](),controller[_0xc4a5('0xe')]);router[_0xc4a5('0xf')](_0xc4a5('0xd'),auth[_0xc4a5('0x5')](),controller[_0xc4a5('0x10')]);module[_0xc4a5('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 816f5a0..276e763 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 _0xd99f=['exports','STRING','ENUM','agent','queue','DATE','NOW','moment','sequelize'];(function(_0xa69645,_0x59c99b){var _0x5883c8=function(_0x1187a6){while(--_0x1187a6){_0xa69645['push'](_0xa69645['shift']());}};_0x5883c8(++_0x59c99b);}(_0xd99f,0x130));var _0xfd99=function(_0x17f29e,_0x312605){_0x17f29e=_0x17f29e-0x0;var _0x574623=_0xd99f[_0x17f29e];return _0x574623;};'use strict';var moment=require(_0xfd99('0x0'));var Sequelize=require(_0xfd99('0x1'));module[_0xfd99('0x2')]={'uniqueid':{'type':Sequelize[_0xfd99('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xfd99('0x4')]('account',_0xfd99('0x5'),_0xfd99('0x6')),'allowNull':![],'defaultValue':_0xfd99('0x6')},'transferredAt':{'type':Sequelize[_0xfd99('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xfd99('0x8')]}}; \ No newline at end of file +var _0xa679=['queue','DATE','NOW','moment','exports','STRING','ENUM','account','agent'];(function(_0x44f085,_0x2324b1){var _0x1917f0=function(_0x2417b0){while(--_0x2417b0){_0x44f085['push'](_0x44f085['shift']());}};_0x1917f0(++_0x2324b1);}(_0xa679,0x93));var _0x9a67=function(_0x1c3c8f,_0x3c21ab){_0x1c3c8f=_0x1c3c8f-0x0;var _0x49a449=_0xa679[_0x1c3c8f];return _0x49a449;};'use strict';var moment=require(_0x9a67('0x0'));var Sequelize=require('sequelize');module[_0x9a67('0x1')]={'uniqueid':{'type':Sequelize[_0x9a67('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9a67('0x3')](_0x9a67('0x4'),_0x9a67('0x5'),_0x9a67('0x6')),'allowNull':![],'defaultValue':_0x9a67('0x6')},'transferredAt':{'type':Sequelize[_0x9a67('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x9a67('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index f20b2e2..9d93ed1 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 _0x2d15=['limit','sort','where','pick','day','merge','filter','options','findAll','catch','show','params','length','create','body','find','describe','fast-json-patch','bluebird','util','path','to-csv','lodash','crypto','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','MailTransferReport','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x8b631b,_0x386724){var _0x3e6832=function(_0x17a132){while(--_0x17a132){_0x8b631b['push'](_0x8b631b['shift']());}};_0x3e6832(++_0x386724);}(_0x2d15,0x173));var _0x52d1=function(_0x376225,_0x14681e){_0x376225=_0x376225-0x0;var _0x594e97=_0x2d15[_0x376225];return _0x594e97;};'use strict';var jsonpatch=require(_0x52d1('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x52d1('0x1'));var Mustache=require('mustache');var util=require(_0x52d1('0x2'));var path=require(_0x52d1('0x3'));var sox=require('sox');var csv=require(_0x52d1('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x52d1('0x5'));var squel=require('squel');var crypto=require(_0x52d1('0x6'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x52d1('0x4'));var querystring=require('querystring');var Papa=require(_0x52d1('0x7'));var qs=require(_0x52d1('0x8'));var logger=require(_0x52d1('0x9'))(_0x52d1('0xa'));var utils=require('../../config/utils');var config=require(_0x52d1('0xb'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f753a,_0x44f77b){_0x44f77b=_0x44f77b||0xcc;return function(_0x4aac8c){if(_0x4aac8c){return _0x4f753a[_0x52d1('0xc')](_0x44f77b);}return _0x4f753a[_0x52d1('0xd')](_0x44f77b)[_0x52d1('0xe')]();};}function respondWithResult(_0x493206,_0x5cda01){_0x5cda01=_0x5cda01||0xc8;return function(_0x424930){if(_0x424930){return _0x493206[_0x52d1('0xd')](_0x5cda01)[_0x52d1('0xf')](_0x424930);}};}function respondWithFilteredResult(_0x57a171,_0x13974f){return function(_0x12bb73){if(_0x12bb73){var _0xe24d48=_0x12bb73[_0x52d1('0x10')],_0x436c10=_0x13974f[_0x52d1('0x11')],_0x170184=_0x13974f[_0x52d1('0x11')]+_0x13974f['limit'],_0x421b31;if(_0x170184>=_0xe24d48){_0x170184=_0xe24d48;_0x421b31=0xc8;}else{_0x421b31=0xce;}_0x57a171[_0x52d1('0xd')](_0x421b31);return _0x57a171[_0x52d1('0x12')](_0x52d1('0x13'),_0x436c10+'-'+_0x170184+'/'+_0xe24d48)[_0x52d1('0xf')](_0x12bb73);}return null;};}function patchUpdates(_0x4c9382){return function(_0x32aa47){try{jsonpatch[_0x52d1('0x14')](_0x32aa47,_0x4c9382,!![]);}catch(_0x48d355){return BPromise['reject'](_0x48d355);}return _0x32aa47[_0x52d1('0x15')]();};}function saveUpdates(_0x3c196a,_0x265f93){return function(_0x317bd5){if(_0x317bd5){return _0x317bd5[_0x52d1('0x16')](_0x3c196a)[_0x52d1('0x17')](function(_0x40e265){return _0x40e265;});}return null;};}function removeEntity(_0x50cae8,_0x4ba1ba){return function(_0x3f3aa3){if(_0x3f3aa3){return _0x3f3aa3[_0x52d1('0x18')]()[_0x52d1('0x17')](function(){_0x50cae8[_0x52d1('0xd')](0xcc)[_0x52d1('0xe')]();});}};}function handleEntityNotFound(_0x5a3333,_0x57c962){return function(_0x493b3f){if(!_0x493b3f){_0x5a3333[_0x52d1('0xc')](0x194);}return _0x493b3f;};}function handleError(_0x35253d,_0x5d98f6){_0x5d98f6=_0x5d98f6||0x1f4;return function(_0x53a2af){logger['error'](_0x53a2af[_0x52d1('0x19')]);if(_0x53a2af[_0x52d1('0x1a')]){delete _0x53a2af[_0x52d1('0x1a')];}_0x35253d['status'](_0x5d98f6)[_0x52d1('0x1b')](_0x53a2af);};}exports[_0x52d1('0x1c')]=function(_0x6aacb7,_0xa3220e){var _0x3bc4ce={},_0x3e8e75={},_0xf00439={'count':0x0,'rows':[]};var _0x4a4dcf=db[_0x52d1('0x1d')][_0x52d1('0x1e')];_0x3e8e75[_0x52d1('0x1f')]=_[_0x52d1('0x20')](_0x4a4dcf);var _0x454dd9={'dateStart':_0x6aacb7['query'][_0x52d1('0x21')],'dateEnd':_0x6aacb7['query'][_0x52d1('0x22')]};delete _0x6aacb7[_0x52d1('0x23')][_0x52d1('0x21')];delete _0x6aacb7['query'][_0x52d1('0x22')];_0x3e8e75['query']=_[_0x52d1('0x20')](_0x6aacb7[_0x52d1('0x23')]);_0x3e8e75[_0x52d1('0x24')]=_['intersection'](_0x3e8e75[_0x52d1('0x1f')],_0x3e8e75[_0x52d1('0x23')]);_0x3bc4ce['attributes']=_[_0x52d1('0x25')](_0x3e8e75[_0x52d1('0x1f')],qs[_0x52d1('0x26')](_0x6aacb7[_0x52d1('0x23')][_0x52d1('0x26')]));_0x3bc4ce[_0x52d1('0x27')]=_0x3bc4ce[_0x52d1('0x27')]['length']?_0x3bc4ce[_0x52d1('0x27')]:_0x3e8e75['model'];if(!_0x6aacb7['query'][_0x52d1('0x28')](_0x52d1('0x29'))){_0x3bc4ce[_0x52d1('0x2a')]=qs[_0x52d1('0x2a')](_0x6aacb7[_0x52d1('0x23')]['limit']);_0x3bc4ce[_0x52d1('0x11')]=qs[_0x52d1('0x11')](_0x6aacb7[_0x52d1('0x23')][_0x52d1('0x11')]);}_0x3bc4ce['order']=qs[_0x52d1('0x2b')](_0x6aacb7[_0x52d1('0x23')][_0x52d1('0x2b')]);_0x3bc4ce[_0x52d1('0x2c')]=qs[_0x52d1('0x24')](_[_0x52d1('0x2d')](_0x6aacb7[_0x52d1('0x23')],_0x3e8e75[_0x52d1('0x24')]));if(_0x454dd9[_0x52d1('0x21')]){if(_0x454dd9[_0x52d1('0x22')]){_0x454dd9[_0x52d1('0x22')]=moment(_0x454dd9[_0x52d1('0x22')])['add'](0x1,'day');}else{_0x454dd9[_0x52d1('0x22')]=moment(_0x454dd9['dateStart'])['add'](0x1,_0x52d1('0x2e'));}_[_0x52d1('0x2f')](_0x3bc4ce['where'],{'createdAt':{'$gte':_0x454dd9['dateStart'],'$lte':_0x454dd9[_0x52d1('0x22')]}});}if(_0x6aacb7[_0x52d1('0x23')][_0x52d1('0x30')]){_0x3bc4ce[_0x52d1('0x2c')]=_[_0x52d1('0x2f')](_0x3bc4ce[_0x52d1('0x2c')],{'$or':_['map'](_0x3bc4ce[_0x52d1('0x27')],function(_0x1c9ab5){var _0x4b6e4d={};_0x4b6e4d[_0x1c9ab5]={'$like':'%'+_0x6aacb7[_0x52d1('0x23')][_0x52d1('0x30')]+'%'};return _0x4b6e4d;})});}_0x3bc4ce=_['merge']({},_0x3bc4ce,_0x6aacb7[_0x52d1('0x31')]);var _0x25da31={'where':_0x3bc4ce['where']};return db[_0x52d1('0x1d')][_0x52d1('0x10')](_0x25da31)[_0x52d1('0x17')](function(_0x392b53){_0xf00439[_0x52d1('0x10')]=_0x392b53;if(_0x6aacb7[_0x52d1('0x23')]['includeAll']){_0x3bc4ce['include']=[{'all':!![]}];}return db[_0x52d1('0x1d')][_0x52d1('0x32')](_0x3bc4ce);})[_0x52d1('0x17')](function(_0x3497d1){_0xf00439['rows']=_0x3497d1;return _0xf00439;})[_0x52d1('0x17')](respondWithFilteredResult(_0xa3220e,_0x3bc4ce))[_0x52d1('0x33')](handleError(_0xa3220e,null));};exports[_0x52d1('0x34')]=function(_0x367e28,_0x2dbad7){var _0x39bc6d={'raw':!![],'where':{'id':_0x367e28[_0x52d1('0x35')]['id']}},_0x3c5ef6={};_0x3c5ef6[_0x52d1('0x1f')]=_['keys'](db[_0x52d1('0x1d')][_0x52d1('0x1e')]);_0x3c5ef6[_0x52d1('0x23')]=_['keys'](_0x367e28[_0x52d1('0x23')]);_0x3c5ef6[_0x52d1('0x24')]=_[_0x52d1('0x25')](_0x3c5ef6[_0x52d1('0x1f')],_0x3c5ef6[_0x52d1('0x23')]);_0x39bc6d['attributes']=_['intersection'](_0x3c5ef6[_0x52d1('0x1f')],qs[_0x52d1('0x26')](_0x367e28[_0x52d1('0x23')][_0x52d1('0x26')]));_0x39bc6d[_0x52d1('0x27')]=_0x39bc6d['attributes'][_0x52d1('0x36')]?_0x39bc6d[_0x52d1('0x27')]:_0x3c5ef6[_0x52d1('0x1f')];if(_0x367e28[_0x52d1('0x23')]['includeAll']){_0x39bc6d['include']=[{'all':!![]}];}_0x39bc6d=_[_0x52d1('0x2f')]({},_0x39bc6d,_0x367e28[_0x52d1('0x31')]);return db[_0x52d1('0x1d')]['find'](_0x39bc6d)[_0x52d1('0x17')](handleEntityNotFound(_0x2dbad7,null))['then'](respondWithResult(_0x2dbad7,null))[_0x52d1('0x33')](handleError(_0x2dbad7,null));};exports['create']=function(_0x47b0cb,_0x1c5171){return db[_0x52d1('0x1d')][_0x52d1('0x37')](_0x47b0cb[_0x52d1('0x38')],{})[_0x52d1('0x17')](respondWithResult(_0x1c5171,0xc9))[_0x52d1('0x33')](handleError(_0x1c5171,null));};exports[_0x52d1('0x16')]=function(_0x150cef,_0x26207c){if(_0x150cef[_0x52d1('0x38')]['id']){delete _0x150cef[_0x52d1('0x38')]['id'];}return db['MailTransferReport'][_0x52d1('0x39')]({'where':{'id':_0x150cef[_0x52d1('0x35')]['id']}})[_0x52d1('0x17')](handleEntityNotFound(_0x26207c,null))[_0x52d1('0x17')](saveUpdates(_0x150cef['body'],null))[_0x52d1('0x17')](respondWithResult(_0x26207c,null))[_0x52d1('0x33')](handleError(_0x26207c,null));};exports[_0x52d1('0x18')]=function(_0xbb8db3,_0x9d0bc6){return db[_0x52d1('0x1d')]['find']({'where':{'id':_0xbb8db3[_0x52d1('0x35')]['id']}})[_0x52d1('0x17')](handleEntityNotFound(_0x9d0bc6,null))[_0x52d1('0x17')](removeEntity(_0x9d0bc6,null))['catch'](handleError(_0x9d0bc6,null));};exports[_0x52d1('0x3a')]=function(_0x1ad196,_0x10e308){return db['MailTransferReport'][_0x52d1('0x3a')]()['then'](respondWithResult(_0x10e308,null))[_0x52d1('0x33')](handleError(_0x10e308,null));}; \ No newline at end of file +var _0xa7fa=['ejs','lodash','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','json','reject','update','stack','name','send','index','MailTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','options','then','includeAll','include','findAll','rows','find','catch','create','body','params','destroy','describe','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x1b9be2,_0x5b71c0){var _0x401557=function(_0x210f0e){while(--_0x210f0e){_0x1b9be2['push'](_0x1b9be2['shift']());}};_0x401557(++_0x5b71c0);}(_0xa7fa,0x143));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var jsonpatch=require(_0xaa7f('0x0'));var rp=require('request-promise');var moment=require(_0xaa7f('0x1'));var BPromise=require(_0xaa7f('0x2'));var Mustache=require(_0xaa7f('0x3'));var util=require('util');var path=require(_0xaa7f('0x4'));var sox=require(_0xaa7f('0x5'));var csv=require(_0xaa7f('0x6'));var ejs=require(_0xaa7f('0x7'));var fs=require('fs');var _=require(_0xaa7f('0x8'));var squel=require(_0xaa7f('0x9'));var crypto=require(_0xaa7f('0xa'));var jsforce=require(_0xaa7f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa7f('0x6'));var querystring=require(_0xaa7f('0xc'));var Papa=require('papaparse');var qs=require(_0xaa7f('0xd'));var logger=require(_0xaa7f('0xe'))(_0xaa7f('0xf'));var utils=require(_0xaa7f('0x10'));var config=require(_0xaa7f('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27f233,_0x560a35){_0x560a35=_0x560a35||0xcc;return function(_0x2586ce){if(_0x2586ce){return _0x27f233[_0xaa7f('0x12')](_0x560a35);}return _0x27f233[_0xaa7f('0x13')](_0x560a35)[_0xaa7f('0x14')]();};}function respondWithResult(_0x3df1ac,_0x5ba95f){_0x5ba95f=_0x5ba95f||0xc8;return function(_0x1c6581){if(_0x1c6581){return _0x3df1ac[_0xaa7f('0x13')](_0x5ba95f)['json'](_0x1c6581);}};}function respondWithFilteredResult(_0x148893,_0x321678){return function(_0x41b11d){if(_0x41b11d){var _0x28e510=_0x41b11d[_0xaa7f('0x15')],_0xcbd0c7=_0x321678[_0xaa7f('0x16')],_0x315574=_0x321678[_0xaa7f('0x16')]+_0x321678[_0xaa7f('0x17')],_0x10bdbd;if(_0x315574>=_0x28e510){_0x315574=_0x28e510;_0x10bdbd=0xc8;}else{_0x10bdbd=0xce;}_0x148893[_0xaa7f('0x13')](_0x10bdbd);return _0x148893[_0xaa7f('0x18')]('Content-Range',_0xcbd0c7+'-'+_0x315574+'/'+_0x28e510)[_0xaa7f('0x19')](_0x41b11d);}return null;};}function patchUpdates(_0x14580c){return function(_0xece51e){try{jsonpatch['apply'](_0xece51e,_0x14580c,!![]);}catch(_0x197d05){return BPromise[_0xaa7f('0x1a')](_0x197d05);}return _0xece51e['save']();};}function saveUpdates(_0x48872d,_0x5c0ce5){return function(_0x1ba1ee){if(_0x1ba1ee){return _0x1ba1ee[_0xaa7f('0x1b')](_0x48872d)['then'](function(_0x2d2ede){return _0x2d2ede;});}return null;};}function removeEntity(_0x8ab65d,_0x5117e6){return function(_0x56d943){if(_0x56d943){return _0x56d943['destroy']()['then'](function(){_0x8ab65d[_0xaa7f('0x13')](0xcc)[_0xaa7f('0x14')]();});}};}function handleEntityNotFound(_0x261a13,_0x131b38){return function(_0x31b2d3){if(!_0x31b2d3){_0x261a13[_0xaa7f('0x12')](0x194);}return _0x31b2d3;};}function handleError(_0x2cf2e7,_0x361e7e){_0x361e7e=_0x361e7e||0x1f4;return function(_0x22e099){logger['error'](_0x22e099[_0xaa7f('0x1c')]);if(_0x22e099[_0xaa7f('0x1d')]){delete _0x22e099[_0xaa7f('0x1d')];}_0x2cf2e7[_0xaa7f('0x13')](_0x361e7e)[_0xaa7f('0x1e')](_0x22e099);};}exports[_0xaa7f('0x1f')]=function(_0x1f048b,_0x11fd31){var _0x1a700f={},_0x177704={},_0x9dcd4f={'count':0x0,'rows':[]};var _0x2b8881=db[_0xaa7f('0x20')][_0xaa7f('0x21')];_0x177704[_0xaa7f('0x22')]=_[_0xaa7f('0x23')](_0x2b8881);var _0x1c9c5b={'dateStart':_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x25')],'dateEnd':_0x1f048b[_0xaa7f('0x24')]['dateEnd']};delete _0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x25')];delete _0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x26')];_0x177704[_0xaa7f('0x24')]=_[_0xaa7f('0x23')](_0x1f048b['query']);_0x177704[_0xaa7f('0x27')]=_['intersection'](_0x177704['model'],_0x177704[_0xaa7f('0x24')]);_0x1a700f[_0xaa7f('0x28')]=_[_0xaa7f('0x29')](_0x177704[_0xaa7f('0x22')],qs['fields'](_0x1f048b['query'][_0xaa7f('0x2a')]));_0x1a700f[_0xaa7f('0x28')]=_0x1a700f[_0xaa7f('0x28')][_0xaa7f('0x2b')]?_0x1a700f[_0xaa7f('0x28')]:_0x177704[_0xaa7f('0x22')];if(!_0x1f048b['query'][_0xaa7f('0x2c')]('nolimit')){_0x1a700f[_0xaa7f('0x17')]=qs[_0xaa7f('0x17')](_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x17')]);_0x1a700f[_0xaa7f('0x16')]=qs[_0xaa7f('0x16')](_0x1f048b[_0xaa7f('0x24')]['offset']);}_0x1a700f[_0xaa7f('0x2d')]=qs[_0xaa7f('0x2e')](_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x2e')]);_0x1a700f[_0xaa7f('0x2f')]=qs[_0xaa7f('0x27')](_[_0xaa7f('0x30')](_0x1f048b['query'],_0x177704[_0xaa7f('0x27')]));if(_0x1c9c5b['dateStart']){if(_0x1c9c5b[_0xaa7f('0x26')]){_0x1c9c5b[_0xaa7f('0x26')]=moment(_0x1c9c5b[_0xaa7f('0x26')])[_0xaa7f('0x31')](0x1,_0xaa7f('0x32'));}else{_0x1c9c5b[_0xaa7f('0x26')]=moment(_0x1c9c5b[_0xaa7f('0x25')])[_0xaa7f('0x31')](0x1,_0xaa7f('0x32'));}_[_0xaa7f('0x33')](_0x1a700f['where'],{'createdAt':{'$gte':_0x1c9c5b[_0xaa7f('0x25')],'$lte':_0x1c9c5b[_0xaa7f('0x26')]}});}if(_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x34')]){_0x1a700f['where']=_[_0xaa7f('0x33')](_0x1a700f[_0xaa7f('0x2f')],{'$or':_['map'](_0x1a700f[_0xaa7f('0x28')],function(_0x5f0cb6){var _0x575aa2={};_0x575aa2[_0x5f0cb6]={'$like':'%'+_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x34')]+'%'};return _0x575aa2;})});}_0x1a700f=_['merge']({},_0x1a700f,_0x1f048b[_0xaa7f('0x35')]);var _0x21390d={'where':_0x1a700f[_0xaa7f('0x2f')]};return db[_0xaa7f('0x20')]['count'](_0x21390d)[_0xaa7f('0x36')](function(_0x25fbbf){_0x9dcd4f[_0xaa7f('0x15')]=_0x25fbbf;if(_0x1f048b[_0xaa7f('0x24')][_0xaa7f('0x37')]){_0x1a700f[_0xaa7f('0x38')]=[{'all':!![]}];}return db[_0xaa7f('0x20')][_0xaa7f('0x39')](_0x1a700f);})[_0xaa7f('0x36')](function(_0x431e12){_0x9dcd4f[_0xaa7f('0x3a')]=_0x431e12;return _0x9dcd4f;})[_0xaa7f('0x36')](respondWithFilteredResult(_0x11fd31,_0x1a700f))['catch'](handleError(_0x11fd31,null));};exports['show']=function(_0x4e7473,_0x46cf22){var _0x5843bb={'raw':!![],'where':{'id':_0x4e7473['params']['id']}},_0x12ce9a={};_0x12ce9a[_0xaa7f('0x22')]=_[_0xaa7f('0x23')](db[_0xaa7f('0x20')][_0xaa7f('0x21')]);_0x12ce9a[_0xaa7f('0x24')]=_[_0xaa7f('0x23')](_0x4e7473[_0xaa7f('0x24')]);_0x12ce9a['filters']=_['intersection'](_0x12ce9a[_0xaa7f('0x22')],_0x12ce9a[_0xaa7f('0x24')]);_0x5843bb[_0xaa7f('0x28')]=_[_0xaa7f('0x29')](_0x12ce9a[_0xaa7f('0x22')],qs[_0xaa7f('0x2a')](_0x4e7473[_0xaa7f('0x24')]['fields']));_0x5843bb[_0xaa7f('0x28')]=_0x5843bb[_0xaa7f('0x28')][_0xaa7f('0x2b')]?_0x5843bb['attributes']:_0x12ce9a[_0xaa7f('0x22')];if(_0x4e7473[_0xaa7f('0x24')][_0xaa7f('0x37')]){_0x5843bb['include']=[{'all':!![]}];}_0x5843bb=_['merge']({},_0x5843bb,_0x4e7473['options']);return db[_0xaa7f('0x20')][_0xaa7f('0x3b')](_0x5843bb)['then'](handleEntityNotFound(_0x46cf22,null))[_0xaa7f('0x36')](respondWithResult(_0x46cf22,null))[_0xaa7f('0x3c')](handleError(_0x46cf22,null));};exports[_0xaa7f('0x3d')]=function(_0x203a55,_0x27b031){return db[_0xaa7f('0x20')]['create'](_0x203a55[_0xaa7f('0x3e')],{})[_0xaa7f('0x36')](respondWithResult(_0x27b031,0xc9))['catch'](handleError(_0x27b031,null));};exports['update']=function(_0x502a9a,_0x5336dc){if(_0x502a9a['body']['id']){delete _0x502a9a[_0xaa7f('0x3e')]['id'];}return db['MailTransferReport'][_0xaa7f('0x3b')]({'where':{'id':_0x502a9a[_0xaa7f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5336dc,null))[_0xaa7f('0x36')](saveUpdates(_0x502a9a['body'],null))[_0xaa7f('0x36')](respondWithResult(_0x5336dc,null))[_0xaa7f('0x3c')](handleError(_0x5336dc,null));};exports[_0xaa7f('0x40')]=function(_0x143ef7,_0x4b53b5){return db['MailTransferReport'][_0xaa7f('0x3b')]({'where':{'id':_0x143ef7[_0xaa7f('0x3f')]['id']}})[_0xaa7f('0x36')](handleEntityNotFound(_0x4b53b5,null))[_0xaa7f('0x36')](removeEntity(_0x4b53b5,null))[_0xaa7f('0x3c')](handleError(_0x4b53b5,null));};exports[_0xaa7f('0x41')]=function(_0xeeac50,_0x159015){return db[_0xaa7f('0x20')][_0xaa7f('0x41')]()['then'](respondWithResult(_0x159015,null))[_0xaa7f('0x3c')](handleError(_0x159015,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 574123c..c734999 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 _0x060a=['report_mail_transfer','uniqueid','util','../../config/logger','api','moment','request-promise','exports','define','MailTransferReport'];(function(_0x49fcfb,_0x504dec){var _0x964926=function(_0x327977){while(--_0x327977){_0x49fcfb['push'](_0x49fcfb['shift']());}};_0x964926(++_0x504dec);}(_0x060a,0x192));var _0xa060=function(_0x45b896,_0x4741a4){_0x45b896=_0x45b896-0x0;var _0x3efa36=_0x060a[_0x45b896];return _0x3efa36;};'use strict';var _=require('lodash');var util=require(_0xa060('0x0'));var logger=require(_0xa060('0x1'))(_0xa060('0x2'));var moment=require(_0xa060('0x3'));var BPromise=require('bluebird');var rp=require(_0xa060('0x4'));var attributes=require('./mailTransferReport.attributes');module[_0xa060('0x5')]=function(_0x15897e,_0x5146a7){return _0x15897e[_0xa060('0x6')](_0xa060('0x7'),attributes,{'tableName':_0xa060('0x8'),'paranoid':![],'indexes':[{'name':_0xa060('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x689b=['report_mail_transfer','lodash','util','../../config/logger','api','moment','bluebird','exports','MailTransferReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x689b,0xeb));var _0xb689=function(_0x4ce85e,_0x25c6d7){_0x4ce85e=_0x4ce85e-0x0;var _0x58b8e6=_0x689b[_0x4ce85e];return _0x58b8e6;};'use strict';var _=require(_0xb689('0x0'));var util=require(_0xb689('0x1'));var logger=require(_0xb689('0x2'))(_0xb689('0x3'));var moment=require(_0xb689('0x4'));var BPromise=require(_0xb689('0x5'));var rp=require('request-promise');var attributes=require('./mailTransferReport.attributes');module[_0xb689('0x6')]=function(_0x20f77c,_0x416068){return _0x20f77c['define'](_0xb689('0x7'),attributes,{'tableName':_0xb689('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 0917ecf..7b9c695 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 _0xc5ad=['result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1d3c58,_0x55a4a1){var _0x426ecd=function(_0x445e69){while(--_0x445e69){_0x1d3c58['push'](_0x1d3c58['shift']());}};_0x426ecd(++_0x55a4a1);}(_0xc5ad,0x136));var _0xdc5a=function(_0x5da62e,_0x242037){_0x5da62e=_0x5da62e-0x0;var _0x54d991=_0xc5ad[_0x5da62e];return _0x54d991;};'use strict';var _=require('lodash');var util=require(_0xdc5a('0x0'));var moment=require('moment');var BPromise=require(_0xdc5a('0x1'));var rs=require(_0xdc5a('0x2'));var fs=require('fs');var db=require(_0xdc5a('0x3'))['db'];var utils=require(_0xdc5a('0x4'));var logger=require(_0xdc5a('0x5'))(_0xdc5a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdc5a('0x7')][_0xdc5a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x855db7,_0x34d401,_0x9e5fb1){return new BPromise(function(_0x557531,_0x1adfdb){return client[_0xdc5a('0x9')](_0x855db7,_0x9e5fb1)[_0xdc5a('0xa')](function(_0x327c07){logger[_0xdc5a('0xb')](_0xdc5a('0xc'),_0x34d401,_0xdc5a('0xd'));logger[_0xdc5a('0xe')](_0xdc5a('0xf'),_0x34d401,_0xdc5a('0xd'),JSON[_0xdc5a('0x10')](_0x327c07));if(_0x327c07[_0xdc5a('0x11')]){if(_0x327c07[_0xdc5a('0x11')][_0xdc5a('0x12')]===0x1f4){logger[_0xdc5a('0x11')](_0xdc5a('0xc'),_0x34d401,_0x327c07['error'][_0xdc5a('0x13')]);return _0x1adfdb(_0x327c07[_0xdc5a('0x11')][_0xdc5a('0x13')]);}logger[_0xdc5a('0x11')](_0xdc5a('0xc'),_0x34d401,_0x327c07['error']['message']);return _0x557531(_0x327c07[_0xdc5a('0x11')][_0xdc5a('0x13')]);}else{logger[_0xdc5a('0xb')]('MailTransferReport,\x20%s,\x20%s',_0x34d401,'request\x20sent');_0x557531(_0x327c07[_0xdc5a('0x14')][_0xdc5a('0x13')]);}})[_0xdc5a('0x15')](function(_0x33d1d9){logger[_0xdc5a('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x34d401,_0x33d1d9);_0x1adfdb(_0x33d1d9);});});} \ No newline at end of file +var _0xb77a=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','MailTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x345587,_0x1f2483){var _0x1c0a7e=function(_0x34e277){while(--_0x34e277){_0x345587['push'](_0x345587['shift']());}};_0x1c0a7e(++_0x1f2483);}(_0xb77a,0xd7));var _0xab77=function(_0x282c65,_0x25e173){_0x282c65=_0x282c65-0x0;var _0x1b389f=_0xb77a[_0x282c65];return _0x1b389f;};'use strict';var _=require(_0xab77('0x0'));var util=require(_0xab77('0x1'));var moment=require(_0xab77('0x2'));var BPromise=require(_0xab77('0x3'));var rs=require(_0xab77('0x4'));var fs=require('fs');var db=require(_0xab77('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab77('0x6'))('rpc');var config=require(_0xab77('0x7'));var jayson=require(_0xab77('0x8'));var client=jayson[_0xab77('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15cf68,_0x3c5aac,_0x13492d){return new BPromise(function(_0x3e4358,_0x2de5fa){return client[_0xab77('0xa')](_0x15cf68,_0x13492d)[_0xab77('0xb')](function(_0x369724){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x3c5aac,_0xab77('0xc'));logger[_0xab77('0xd')](_0xab77('0xe'),_0x3c5aac,_0xab77('0xc'),JSON[_0xab77('0xf')](_0x369724));if(_0x369724['error']){if(_0x369724[_0xab77('0x10')]['code']===0x1f4){logger[_0xab77('0x10')](_0xab77('0x11'),_0x3c5aac,_0x369724[_0xab77('0x10')][_0xab77('0x12')]);return _0x2de5fa(_0x369724['error'][_0xab77('0x12')]);}logger[_0xab77('0x10')](_0xab77('0x11'),_0x3c5aac,_0x369724[_0xab77('0x10')][_0xab77('0x12')]);return _0x3e4358(_0x369724[_0xab77('0x10')][_0xab77('0x12')]);}else{logger[_0xab77('0x13')](_0xab77('0x11'),_0x3c5aac,_0xab77('0xc'));_0x3e4358(_0x369724[_0xab77('0x14')]['message']);}})[_0xab77('0x15')](function(_0x525c3b){logger['error'](_0xab77('0x11'),_0x3c5aac,_0x525c3b);_0x2de5fa(_0x525c3b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index d458336..0818326 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 _0xec2c=['post','put','/:id','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x49bff6,_0xc0f4){var _0x2df1b8=function(_0x27bbe1){while(--_0x27bbe1){_0x49bff6['push'](_0x49bff6['shift']());}};_0x2df1b8(++_0xc0f4);}(_0xec2c,0x1b5));var _0xcec2=function(_0x3feab5,_0x1849cb){_0x3feab5=_0x3feab5-0x0;var _0x4fb9e9=_0xec2c[_0x3feab5];return _0x4fb9e9;};'use strict';var multer=require(_0xcec2('0x0'));var util=require(_0xcec2('0x1'));var path=require('path');var express=require(_0xcec2('0x2'));var router=express[_0xcec2('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcec2('0x4'));var config=require(_0xcec2('0x5'));var controller=require('./memberReport.controller');router[_0xcec2('0x6')]('/',auth[_0xcec2('0x7')](),controller[_0xcec2('0x8')]);router[_0xcec2('0x6')](_0xcec2('0x9'),auth[_0xcec2('0x7')](),controller[_0xcec2('0xa')]);router[_0xcec2('0x6')]('/:id',auth[_0xcec2('0x7')](),controller['show']);router[_0xcec2('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xcec2('0xc')](_0xcec2('0xd'),auth[_0xcec2('0x7')](),controller['update']);router['delete'](_0xcec2('0xd'),auth['isAuthenticated'](),controller[_0xcec2('0xe')]);module[_0xcec2('0xf')]=router; \ No newline at end of file +var _0x629a=['./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x2fd7da,_0x33e2a3){var _0x1eef62=function(_0x3a57b9){while(--_0x3a57b9){_0x2fd7da['push'](_0x2fd7da['shift']());}};_0x1eef62(++_0x33e2a3);}(_0x629a,0x13d));var _0xa629=function(_0x3df9eb,_0x5d1f59){_0x3df9eb=_0x3df9eb-0x0;var _0x41aa0e=_0x629a[_0x3df9eb];return _0x41aa0e;};'use strict';var multer=require(_0xa629('0x0'));var util=require(_0xa629('0x1'));var path=require('path');var express=require(_0xa629('0x2'));var router=express[_0xa629('0x3')]();var auth=require(_0xa629('0x4'));var interaction=require(_0xa629('0x5'));var config=require('../../config/environment');var controller=require(_0xa629('0x6'));router[_0xa629('0x7')]('/',auth[_0xa629('0x8')](),controller[_0xa629('0x9')]);router[_0xa629('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xa629('0xa')]);router[_0xa629('0x7')](_0xa629('0xb'),auth[_0xa629('0x8')](),controller[_0xa629('0xc')]);router[_0xa629('0xd')]('/',auth['isAuthenticated'](),controller[_0xa629('0xe')]);router[_0xa629('0xf')]('/:id',auth[_0xa629('0x8')](),controller[_0xa629('0x10')]);router[_0xa629('0x11')](_0xa629('0xb'),auth[_0xa629('0x8')](),controller['destroy']);module[_0xa629('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 283e990..140e450 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 _0x4284=['LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x4284,0xec));var _0x4428=function(_0x226908,_0x43865a){_0x226908=_0x226908-0x0;var _0x55a8ff=_0x4284[_0x226908];return _0x55a8ff;};'use strict';var Sequelize=require(_0x4428('0x0'));var moment=require(_0x4428('0x1'));module[_0x4428('0x2')]={'channel':{'type':Sequelize[_0x4428('0x3')]},'membername':{'type':Sequelize[_0x4428('0x3')]},'interface':{'type':Sequelize[_0x4428('0x3')]},'type':{'type':Sequelize[_0x4428('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x4428('0x4')},'duration':{'type':Sequelize[_0x4428('0x5')]},'enterAt':{'type':Sequelize[_0x4428('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x5adcb7){var _0x2bd9a7=moment(_0x5adcb7);var _0x21dd12=moment(this['getDataValue'](_0x4428('0x7')));var _0x39aa37=_0x2bd9a7[_0x4428('0x8')](_0x21dd12,'seconds');this[_0x4428('0x9')](_0x4428('0xa'),_0x5adcb7);this[_0x4428('0x9')](_0x4428('0xb'),_0x39aa37||null);}},'data1':{'type':Sequelize[_0x4428('0x3')],'comment':_0x4428('0xc')},'data2':{'type':Sequelize[_0x4428('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4428('0x3')],'comment':_0x4428('0xd')},'data4':{'type':Sequelize['STRING'],'comment':_0x4428('0xe')},'data5':{'type':Sequelize[_0x4428('0x3')],'comment':_0x4428('0xf')},'role':{'type':Sequelize[_0x4428('0x3')]},'internal':{'type':Sequelize[_0x4428('0x5')]},'uniqueid':{'type':Sequelize[_0x4428('0x3')]}}; \ No newline at end of file +var _0x25f1=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x2f63fb,_0x5a9e65){var _0x6e1cae=function(_0x128da3){while(--_0x128da3){_0x2f63fb['push'](_0x2f63fb['shift']());}};_0x6e1cae(++_0x5a9e65);}(_0x25f1,0x132));var _0x125f=function(_0x5380cd,_0x1ea634){_0x5380cd=_0x5380cd-0x0;var _0x25dd61=_0x25f1[_0x5380cd];return _0x25dd61;};'use strict';var Sequelize=require(_0x125f('0x0'));var moment=require(_0x125f('0x1'));module[_0x125f('0x2')]={'channel':{'type':Sequelize[_0x125f('0x3')]},'membername':{'type':Sequelize[_0x125f('0x3')]},'interface':{'type':Sequelize[_0x125f('0x3')]},'type':{'type':Sequelize[_0x125f('0x3')],'defaultValue':_0x125f('0x4'),'comment':_0x125f('0x5')},'duration':{'type':Sequelize[_0x125f('0x6')]},'enterAt':{'type':Sequelize[_0x125f('0x7')]},'exitAt':{'type':Sequelize[_0x125f('0x7')],'set':function(_0x5e2a64){var _0x159c07=moment(_0x5e2a64);var _0x27c9ff=moment(this[_0x125f('0x8')](_0x125f('0x9')));var _0x32a8e8=_0x159c07[_0x125f('0xa')](_0x27c9ff,_0x125f('0xb'));this['setDataValue'](_0x125f('0xc'),_0x5e2a64);this['setDataValue']('duration',_0x32a8e8||null);}},'data1':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xd')},'data2':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xe')},'data3':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0xf')},'data4':{'type':Sequelize[_0x125f('0x3')],'comment':_0x125f('0x10')},'data5':{'type':Sequelize['STRING'],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x125f('0x6')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 83fa075..52166f6 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 _0x7f08=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','filter','merge','map','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','MemberReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters'];(function(_0x19725e,_0x36a662){var _0x14ab18=function(_0x503c69){while(--_0x503c69){_0x19725e['push'](_0x19725e['shift']());}};_0x14ab18(++_0x36a662);}(_0x7f08,0x12d));var _0x87f0=function(_0x12a468,_0x1d0ef2){_0x12a468=_0x12a468-0x0;var _0x5a6887=_0x7f08[_0x12a468];return _0x5a6887;};'use strict';var jsonpatch=require(_0x87f0('0x0'));var rp=require(_0x87f0('0x1'));var moment=require('moment');var BPromise=require(_0x87f0('0x2'));var Mustache=require(_0x87f0('0x3'));var util=require(_0x87f0('0x4'));var path=require(_0x87f0('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x87f0('0x6'));var fs=require('fs');var _=require(_0x87f0('0x7'));var squel=require(_0x87f0('0x8'));var crypto=require('crypto');var jsforce=require(_0x87f0('0x9'));var deskjs=require(_0x87f0('0xa'));var toCsv=require(_0x87f0('0xb'));var querystring=require(_0x87f0('0xc'));var Papa=require(_0x87f0('0xd'));var qs=require('../../components/parsers/qs');var logger=require(_0x87f0('0xe'))(_0x87f0('0xf'));var utils=require(_0x87f0('0x10'));var config=require('../../config/environment');var db=require(_0x87f0('0x11'))['db'];function respondWithStatusCode(_0x4c85f3,_0x1e361a){_0x1e361a=_0x1e361a||0xcc;return function(_0x594f5e){if(_0x594f5e){return _0x4c85f3[_0x87f0('0x12')](_0x1e361a);}return _0x4c85f3[_0x87f0('0x13')](_0x1e361a)[_0x87f0('0x14')]();};}function respondWithResult(_0x12de90,_0x307c7b){_0x307c7b=_0x307c7b||0xc8;return function(_0xeb12ab){if(_0xeb12ab){return _0x12de90[_0x87f0('0x13')](_0x307c7b)[_0x87f0('0x15')](_0xeb12ab);}};}function respondWithFilteredResult(_0x127f62,_0x24ec01){return function(_0x4b4ef2){if(_0x4b4ef2){var _0x237b1a=_0x4b4ef2[_0x87f0('0x16')],_0x575e78=_0x24ec01[_0x87f0('0x17')],_0x1ea82d=_0x24ec01['offset']+_0x24ec01[_0x87f0('0x18')],_0x32ecdf;if(_0x1ea82d>=_0x237b1a){_0x1ea82d=_0x237b1a;_0x32ecdf=0xc8;}else{_0x32ecdf=0xce;}_0x127f62[_0x87f0('0x13')](_0x32ecdf);return _0x127f62[_0x87f0('0x19')]('Content-Range',_0x575e78+'-'+_0x1ea82d+'/'+_0x237b1a)[_0x87f0('0x15')](_0x4b4ef2);}return null;};}function patchUpdates(_0x5512bc){return function(_0x4c4cc0){try{jsonpatch[_0x87f0('0x1a')](_0x4c4cc0,_0x5512bc,!![]);}catch(_0x383493){return BPromise[_0x87f0('0x1b')](_0x383493);}return _0x4c4cc0[_0x87f0('0x1c')]();};}function saveUpdates(_0x33cb5f,_0x1f6954){return function(_0x26edc9){if(_0x26edc9){return _0x26edc9[_0x87f0('0x1d')](_0x33cb5f)[_0x87f0('0x1e')](function(_0x309920){return _0x309920;});}return null;};}function removeEntity(_0x36ab19,_0x3b639f){return function(_0x566fd7){if(_0x566fd7){return _0x566fd7[_0x87f0('0x1f')]()['then'](function(){_0x36ab19[_0x87f0('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fa183,_0x2c1a56){return function(_0x13d42c){if(!_0x13d42c){_0x3fa183[_0x87f0('0x12')](0x194);}return _0x13d42c;};}function handleError(_0x5324bc,_0x61f406){_0x61f406=_0x61f406||0x1f4;return function(_0x373f70){logger[_0x87f0('0x20')](_0x373f70[_0x87f0('0x21')]);if(_0x373f70['name']){delete _0x373f70[_0x87f0('0x22')];}_0x5324bc[_0x87f0('0x13')](_0x61f406)[_0x87f0('0x23')](_0x373f70);};}exports['index']=function(_0x1c6c52,_0x36ce28){var _0x4145a4={},_0x396572={},_0x4f0c0d={'count':0x0,'rows':[]};var _0x38886c=db[_0x87f0('0x24')][_0x87f0('0x25')];_0x396572[_0x87f0('0x26')]=_[_0x87f0('0x27')](_0x38886c);var _0x4192e9={'dateStart':_0x1c6c52[_0x87f0('0x28')][_0x87f0('0x29')],'dateEnd':_0x1c6c52['query'][_0x87f0('0x2a')]};delete _0x1c6c52[_0x87f0('0x28')][_0x87f0('0x29')];delete _0x1c6c52[_0x87f0('0x28')][_0x87f0('0x2a')];_0x396572[_0x87f0('0x28')]=_[_0x87f0('0x27')](_0x1c6c52['query']);_0x396572[_0x87f0('0x2b')]=_[_0x87f0('0x2c')](_0x396572[_0x87f0('0x26')],_0x396572[_0x87f0('0x28')]);_0x4145a4[_0x87f0('0x2d')]=_[_0x87f0('0x2c')](_0x396572[_0x87f0('0x26')],qs[_0x87f0('0x2e')](_0x1c6c52[_0x87f0('0x28')]['fields']));_0x4145a4[_0x87f0('0x2d')]=_0x4145a4[_0x87f0('0x2d')][_0x87f0('0x2f')]?_0x4145a4[_0x87f0('0x2d')]:_0x396572['model'];if(!_0x1c6c52['query'][_0x87f0('0x30')]('nolimit')){_0x4145a4[_0x87f0('0x18')]=qs['limit'](_0x1c6c52['query']['limit']);_0x4145a4[_0x87f0('0x17')]=qs[_0x87f0('0x17')](_0x1c6c52['query']['offset']);}_0x4145a4[_0x87f0('0x31')]=qs['sort'](_0x1c6c52[_0x87f0('0x28')][_0x87f0('0x32')]);_0x4145a4[_0x87f0('0x33')]=qs[_0x87f0('0x2b')](_[_0x87f0('0x34')](_0x1c6c52['query'],_0x396572['filters']));if(_0x4192e9['dateStart']){if(_0x4192e9[_0x87f0('0x2a')]){_0x4192e9[_0x87f0('0x2a')]=moment(_0x4192e9['dateEnd'])[_0x87f0('0x35')](0x1,'day');}else{_0x4192e9['dateEnd']=moment(_0x4192e9[_0x87f0('0x29')])[_0x87f0('0x35')](0x1,_0x87f0('0x36'));}_['merge'](_0x4145a4[_0x87f0('0x33')],{'createdAt':{'$gte':_0x4192e9[_0x87f0('0x29')],'$lte':_0x4192e9['dateEnd']}});}if(_0x1c6c52[_0x87f0('0x28')][_0x87f0('0x37')]){_0x4145a4[_0x87f0('0x33')]=_[_0x87f0('0x38')](_0x4145a4[_0x87f0('0x33')],{'$or':_[_0x87f0('0x39')](_0x4145a4[_0x87f0('0x2d')],function(_0x16f7af){var _0x16d0a3={};_0x16d0a3[_0x16f7af]={'$like':'%'+_0x1c6c52[_0x87f0('0x28')][_0x87f0('0x37')]+'%'};return _0x16d0a3;})});}_0x4145a4=_['merge']({},_0x4145a4,_0x1c6c52['options']);var _0x17aab1={'where':_0x4145a4['where']};return db[_0x87f0('0x24')][_0x87f0('0x16')](_0x17aab1)['then'](function(_0x33462e){_0x4f0c0d[_0x87f0('0x16')]=_0x33462e;if(_0x1c6c52['query'][_0x87f0('0x3a')]){_0x4145a4[_0x87f0('0x3b')]=[{'all':!![]}];}return db[_0x87f0('0x24')][_0x87f0('0x3c')](_0x4145a4);})['then'](function(_0x5d8232){_0x4f0c0d['rows']=_0x5d8232;return _0x4f0c0d;})[_0x87f0('0x1e')](respondWithFilteredResult(_0x36ce28,_0x4145a4))[_0x87f0('0x3d')](handleError(_0x36ce28,null));};exports[_0x87f0('0x3e')]=function(_0xe9c554,_0x55c2d6){var _0x350067={'raw':!![],'where':{'id':_0xe9c554['params']['id']}},_0x2097da={};_0x2097da[_0x87f0('0x26')]=_[_0x87f0('0x27')](db[_0x87f0('0x24')][_0x87f0('0x25')]);_0x2097da[_0x87f0('0x28')]=_[_0x87f0('0x27')](_0xe9c554[_0x87f0('0x28')]);_0x2097da[_0x87f0('0x2b')]=_[_0x87f0('0x2c')](_0x2097da[_0x87f0('0x26')],_0x2097da[_0x87f0('0x28')]);_0x350067['attributes']=_[_0x87f0('0x2c')](_0x2097da[_0x87f0('0x26')],qs[_0x87f0('0x2e')](_0xe9c554[_0x87f0('0x28')][_0x87f0('0x2e')]));_0x350067[_0x87f0('0x2d')]=_0x350067[_0x87f0('0x2d')]['length']?_0x350067['attributes']:_0x2097da['model'];if(_0xe9c554[_0x87f0('0x28')][_0x87f0('0x3a')]){_0x350067[_0x87f0('0x3b')]=[{'all':!![]}];}_0x350067=_[_0x87f0('0x38')]({},_0x350067,_0xe9c554[_0x87f0('0x3f')]);return db[_0x87f0('0x24')][_0x87f0('0x40')](_0x350067)[_0x87f0('0x1e')](handleEntityNotFound(_0x55c2d6,null))[_0x87f0('0x1e')](respondWithResult(_0x55c2d6,null))[_0x87f0('0x3d')](handleError(_0x55c2d6,null));};exports[_0x87f0('0x41')]=function(_0x130422,_0x162bea){return db['MemberReport'][_0x87f0('0x41')](_0x130422[_0x87f0('0x42')],{})['then'](respondWithResult(_0x162bea,0xc9))[_0x87f0('0x3d')](handleError(_0x162bea,null));};exports[_0x87f0('0x1d')]=function(_0x17621f,_0x3ad090){if(_0x17621f[_0x87f0('0x42')]['id']){delete _0x17621f['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x17621f[_0x87f0('0x43')]['id']}})[_0x87f0('0x1e')](handleEntityNotFound(_0x3ad090,null))['then'](saveUpdates(_0x17621f[_0x87f0('0x42')],null))[_0x87f0('0x1e')](respondWithResult(_0x3ad090,null))[_0x87f0('0x3d')](handleError(_0x3ad090,null));};exports[_0x87f0('0x1f')]=function(_0x4aaf56,_0x2ef458){return db[_0x87f0('0x24')][_0x87f0('0x40')]({'where':{'id':_0x4aaf56['params']['id']}})[_0x87f0('0x1e')](handleEntityNotFound(_0x2ef458,null))['then'](removeEntity(_0x2ef458,null))[_0x87f0('0x3d')](handleError(_0x2ef458,null));};exports[_0x87f0('0x44')]=function(_0x4b0adc,_0x1f037f){return db[_0x87f0('0x24')][_0x87f0('0x44')]()['then'](respondWithResult(_0x1f037f,null))[_0x87f0('0x3d')](handleError(_0x1f037f,null));}; \ No newline at end of file +var _0x648a=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','apply','reject','save','update','then','destroy','error','stack','name','send','MemberReport','rawAttributes','model','query','dateEnd','dateStart','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','sort','pick','add','day','where','merge','map','filter','count','include','findAll','catch','show','params','includeAll','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring'];(function(_0x5e3f72,_0x4f82d7){var _0x105186=function(_0x585b28){while(--_0x585b28){_0x5e3f72['push'](_0x5e3f72['shift']());}};_0x105186(++_0x4f82d7);}(_0x648a,0x13d));var _0xa648=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x648a[_0x4f9b18];return _0x29f20c;};'use strict';var jsonpatch=require(_0xa648('0x0'));var rp=require(_0xa648('0x1'));var moment=require(_0xa648('0x2'));var BPromise=require(_0xa648('0x3'));var Mustache=require('mustache');var util=require(_0xa648('0x4'));var path=require(_0xa648('0x5'));var sox=require(_0xa648('0x6'));var csv=require(_0xa648('0x7'));var ejs=require(_0xa648('0x8'));var fs=require('fs');var _=require(_0xa648('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa648('0xa'));var deskjs=require(_0xa648('0xb'));var toCsv=require(_0xa648('0x7'));var querystring=require(_0xa648('0xc'));var Papa=require(_0xa648('0xd'));var qs=require(_0xa648('0xe'));var logger=require(_0xa648('0xf'))(_0xa648('0x10'));var utils=require(_0xa648('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21fc11,_0x576c14){_0x576c14=_0x576c14||0xcc;return function(_0x48aa27){if(_0x48aa27){return _0x21fc11[_0xa648('0x12')](_0x576c14);}return _0x21fc11[_0xa648('0x13')](_0x576c14)[_0xa648('0x14')]();};}function respondWithResult(_0xa04163,_0x1161eb){_0x1161eb=_0x1161eb||0xc8;return function(_0x50339c){if(_0x50339c){return _0xa04163[_0xa648('0x13')](_0x1161eb)[_0xa648('0x15')](_0x50339c);}};}function respondWithFilteredResult(_0x944830,_0x5bc636){return function(_0x3ddf00){if(_0x3ddf00){var _0x370395=_0x3ddf00['count'],_0x1801d4=_0x5bc636[_0xa648('0x16')],_0xcb09f=_0x5bc636['offset']+_0x5bc636['limit'],_0x5197bb;if(_0xcb09f>=_0x370395){_0xcb09f=_0x370395;_0x5197bb=0xc8;}else{_0x5197bb=0xce;}_0x944830['status'](_0x5197bb);return _0x944830['set']('Content-Range',_0x1801d4+'-'+_0xcb09f+'/'+_0x370395)[_0xa648('0x15')](_0x3ddf00);}return null;};}function patchUpdates(_0x324cc9){return function(_0x1aa45e){try{jsonpatch[_0xa648('0x17')](_0x1aa45e,_0x324cc9,!![]);}catch(_0x2c2d17){return BPromise[_0xa648('0x18')](_0x2c2d17);}return _0x1aa45e[_0xa648('0x19')]();};}function saveUpdates(_0x532748,_0x2f3a9d){return function(_0x4825d2){if(_0x4825d2){return _0x4825d2[_0xa648('0x1a')](_0x532748)[_0xa648('0x1b')](function(_0x19fde7){return _0x19fde7;});}return null;};}function removeEntity(_0x431c78,_0x12e955){return function(_0x29faae){if(_0x29faae){return _0x29faae[_0xa648('0x1c')]()[_0xa648('0x1b')](function(){_0x431c78[_0xa648('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ed9fa,_0x1e738d){return function(_0x393698){if(!_0x393698){_0x5ed9fa['sendStatus'](0x194);}return _0x393698;};}function handleError(_0x1a6571,_0x2d60ea){_0x2d60ea=_0x2d60ea||0x1f4;return function(_0x1e1f9d){logger[_0xa648('0x1d')](_0x1e1f9d[_0xa648('0x1e')]);if(_0x1e1f9d['name']){delete _0x1e1f9d[_0xa648('0x1f')];}_0x1a6571['status'](_0x2d60ea)[_0xa648('0x20')](_0x1e1f9d);};}exports['index']=function(_0x4f887c,_0x296407){var _0x3c0692={},_0x8fa2db={},_0x2796e2={'count':0x0,'rows':[]};var _0x330172=db[_0xa648('0x21')][_0xa648('0x22')];_0x8fa2db[_0xa648('0x23')]=_['keys'](_0x330172);var _0xa0d8f8={'dateStart':_0x4f887c[_0xa648('0x24')]['dateStart'],'dateEnd':_0x4f887c[_0xa648('0x24')][_0xa648('0x25')]};delete _0x4f887c['query'][_0xa648('0x26')];delete _0x4f887c[_0xa648('0x24')][_0xa648('0x25')];_0x8fa2db[_0xa648('0x24')]=_[_0xa648('0x27')](_0x4f887c[_0xa648('0x24')]);_0x8fa2db[_0xa648('0x28')]=_[_0xa648('0x29')](_0x8fa2db[_0xa648('0x23')],_0x8fa2db['query']);_0x3c0692[_0xa648('0x2a')]=_['intersection'](_0x8fa2db[_0xa648('0x23')],qs['fields'](_0x4f887c[_0xa648('0x24')][_0xa648('0x2b')]));_0x3c0692[_0xa648('0x2a')]=_0x3c0692[_0xa648('0x2a')]['length']?_0x3c0692[_0xa648('0x2a')]:_0x8fa2db[_0xa648('0x23')];if(!_0x4f887c[_0xa648('0x24')][_0xa648('0x2c')](_0xa648('0x2d'))){_0x3c0692[_0xa648('0x2e')]=qs[_0xa648('0x2e')](_0x4f887c[_0xa648('0x24')]['limit']);_0x3c0692['offset']=qs[_0xa648('0x16')](_0x4f887c[_0xa648('0x24')][_0xa648('0x16')]);}_0x3c0692['order']=qs[_0xa648('0x2f')](_0x4f887c[_0xa648('0x24')][_0xa648('0x2f')]);_0x3c0692['where']=qs[_0xa648('0x28')](_[_0xa648('0x30')](_0x4f887c[_0xa648('0x24')],_0x8fa2db[_0xa648('0x28')]));if(_0xa0d8f8[_0xa648('0x26')]){if(_0xa0d8f8['dateEnd']){_0xa0d8f8['dateEnd']=moment(_0xa0d8f8['dateEnd'])[_0xa648('0x31')](0x1,'day');}else{_0xa0d8f8['dateEnd']=moment(_0xa0d8f8[_0xa648('0x26')])['add'](0x1,_0xa648('0x32'));}_['merge'](_0x3c0692[_0xa648('0x33')],{'createdAt':{'$gte':_0xa0d8f8[_0xa648('0x26')],'$lte':_0xa0d8f8['dateEnd']}});}if(_0x4f887c[_0xa648('0x24')]['filter']){_0x3c0692[_0xa648('0x33')]=_[_0xa648('0x34')](_0x3c0692['where'],{'$or':_[_0xa648('0x35')](_0x3c0692[_0xa648('0x2a')],function(_0x493b8e){var _0x35acda={};_0x35acda[_0x493b8e]={'$like':'%'+_0x4f887c[_0xa648('0x24')][_0xa648('0x36')]+'%'};return _0x35acda;})});}_0x3c0692=_[_0xa648('0x34')]({},_0x3c0692,_0x4f887c['options']);var _0x256430={'where':_0x3c0692[_0xa648('0x33')]};return db[_0xa648('0x21')][_0xa648('0x37')](_0x256430)[_0xa648('0x1b')](function(_0x2cf8de){_0x2796e2['count']=_0x2cf8de;if(_0x4f887c[_0xa648('0x24')]['includeAll']){_0x3c0692[_0xa648('0x38')]=[{'all':!![]}];}return db[_0xa648('0x21')][_0xa648('0x39')](_0x3c0692);})[_0xa648('0x1b')](function(_0x14b936){_0x2796e2['rows']=_0x14b936;return _0x2796e2;})[_0xa648('0x1b')](respondWithFilteredResult(_0x296407,_0x3c0692))[_0xa648('0x3a')](handleError(_0x296407,null));};exports[_0xa648('0x3b')]=function(_0x498cd4,_0x156a63){var _0x596a72={'raw':!![],'where':{'id':_0x498cd4[_0xa648('0x3c')]['id']}},_0x2bdf93={};_0x2bdf93[_0xa648('0x23')]=_[_0xa648('0x27')](db['MemberReport']['rawAttributes']);_0x2bdf93[_0xa648('0x24')]=_[_0xa648('0x27')](_0x498cd4[_0xa648('0x24')]);_0x2bdf93['filters']=_[_0xa648('0x29')](_0x2bdf93[_0xa648('0x23')],_0x2bdf93['query']);_0x596a72[_0xa648('0x2a')]=_[_0xa648('0x29')](_0x2bdf93['model'],qs['fields'](_0x498cd4[_0xa648('0x24')]['fields']));_0x596a72[_0xa648('0x2a')]=_0x596a72[_0xa648('0x2a')]['length']?_0x596a72[_0xa648('0x2a')]:_0x2bdf93[_0xa648('0x23')];if(_0x498cd4[_0xa648('0x24')][_0xa648('0x3d')]){_0x596a72[_0xa648('0x38')]=[{'all':!![]}];}_0x596a72=_[_0xa648('0x34')]({},_0x596a72,_0x498cd4['options']);return db[_0xa648('0x21')]['find'](_0x596a72)[_0xa648('0x1b')](handleEntityNotFound(_0x156a63,null))[_0xa648('0x1b')](respondWithResult(_0x156a63,null))[_0xa648('0x3a')](handleError(_0x156a63,null));};exports[_0xa648('0x3e')]=function(_0x3afc20,_0x5e7956){return db[_0xa648('0x21')][_0xa648('0x3e')](_0x3afc20['body'],{})['then'](respondWithResult(_0x5e7956,0xc9))[_0xa648('0x3a')](handleError(_0x5e7956,null));};exports[_0xa648('0x1a')]=function(_0x3eb719,_0x5cb31e){if(_0x3eb719[_0xa648('0x3f')]['id']){delete _0x3eb719['body']['id'];}return db[_0xa648('0x21')][_0xa648('0x40')]({'where':{'id':_0x3eb719[_0xa648('0x3c')]['id']}})[_0xa648('0x1b')](handleEntityNotFound(_0x5cb31e,null))['then'](saveUpdates(_0x3eb719[_0xa648('0x3f')],null))[_0xa648('0x1b')](respondWithResult(_0x5cb31e,null))[_0xa648('0x3a')](handleError(_0x5cb31e,null));};exports['destroy']=function(_0x227af1,_0x38452e){return db[_0xa648('0x21')][_0xa648('0x40')]({'where':{'id':_0x227af1[_0xa648('0x3c')]['id']}})[_0xa648('0x1b')](handleEntityNotFound(_0x38452e,null))[_0xa648('0x1b')](removeEntity(_0x38452e,null))['catch'](handleError(_0x38452e,null));};exports[_0xa648('0x41')]=function(_0x24e6f9,_0x2bf136){return db[_0xa648('0x21')][_0xa648('0x41')]()[_0xa648('0x1b')](respondWithResult(_0x2bf136,null))[_0xa648('0x3a')](handleError(_0x2bf136,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 660f75a..7be027a 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 _0xb181=['lodash','util','api','moment','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x513ed2,_0x3f3449){var _0x3fdb79=function(_0x33f05f){while(--_0x33f05f){_0x513ed2['push'](_0x513ed2['shift']());}};_0x3fdb79(++_0x3f3449);}(_0xb181,0x1a4));var _0x1b18=function(_0x4eb913,_0xcbd670){_0x4eb913=_0x4eb913-0x0;var _0x5e0c78=_0xb181[_0x4eb913];return _0x5e0c78;};'use strict';var _=require(_0x1b18('0x0'));var util=require(_0x1b18('0x1'));var logger=require('../../config/logger')(_0x1b18('0x2'));var moment=require(_0x1b18('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x1b18('0x4'));module[_0x1b18('0x5')]=function(_0x5855e1,_0x53aad1){return _0x5855e1[_0x1b18('0x6')](_0x1b18('0x7'),attributes,{'tableName':_0x1b18('0x8'),'paranoid':![],'indexes':[{'name':_0x1b18('0x9'),'fields':[_0x1b18('0xa'),_0x1b18('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9f5=['../../config/logger','api','bluebird','request-promise','./memberReport.attributes','exports','MemberReport','membername_interface','membername','interface','util'];(function(_0x2b92cb,_0x551063){var _0x49a836=function(_0x2f1977){while(--_0x2f1977){_0x2b92cb['push'](_0x2b92cb['shift']());}};_0x49a836(++_0x551063);}(_0xd9f5,0x1e3));var _0x5d9f=function(_0x25fded,_0x34216e){_0x25fded=_0x25fded-0x0;var _0x269156=_0xd9f5[_0x25fded];return _0x269156;};'use strict';var _=require('lodash');var util=require(_0x5d9f('0x0'));var logger=require(_0x5d9f('0x1'))(_0x5d9f('0x2'));var moment=require('moment');var BPromise=require(_0x5d9f('0x3'));var rp=require(_0x5d9f('0x4'));var attributes=require(_0x5d9f('0x5'));module[_0x5d9f('0x6')]=function(_0x1991d9,_0x29677f){return _0x1991d9['define'](_0x5d9f('0x7'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x5d9f('0x8'),'fields':[_0x5d9f('0x9'),_0x5d9f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index cce4e75..1c236d4 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 _0xf18d=['model','CreateMemberReport','create','body','UpdateMemberReport','update','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','attributes','limit','include','map'];(function(_0x5c8827,_0x5bc5d7){var _0x50ffd5=function(_0x4121bc){while(--_0x4121bc){_0x5c8827['push'](_0x5c8827['shift']());}};_0x50ffd5(++_0x5bc5d7);}(_0xf18d,0x1e7));var _0xdf18=function(_0x1381ba,_0x529ddf){_0x1381ba=_0x1381ba-0x0;var _0x58a341=_0xf18d[_0x1381ba];return _0x58a341;};'use strict';var _=require(_0xdf18('0x0'));var util=require('util');var moment=require(_0xdf18('0x1'));var BPromise=require(_0xdf18('0x2'));var rs=require(_0xdf18('0x3'));var fs=require('fs');var db=require(_0xdf18('0x4'))['db'];var utils=require(_0xdf18('0x5'));var logger=require(_0xdf18('0x6'))(_0xdf18('0x7'));var config=require(_0xdf18('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdf18('0x9')][_0xdf18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22a917,_0x21d72b,_0x189b29){return new BPromise(function(_0x5c597c,_0x28d42b){return client[_0xdf18('0xb')](_0x22a917,_0x189b29)[_0xdf18('0xc')](function(_0x281499){logger[_0xdf18('0xd')](_0xdf18('0xe'),_0x21d72b,_0xdf18('0xf'));logger[_0xdf18('0x10')](_0xdf18('0x11'),_0x21d72b,'request\x20sent',JSON[_0xdf18('0x12')](_0x281499));if(_0x281499[_0xdf18('0x13')]){if(_0x281499['error'][_0xdf18('0x14')]===0x1f4){logger[_0xdf18('0x13')]('MemberReport,\x20%s,\x20%s',_0x21d72b,_0x281499[_0xdf18('0x13')][_0xdf18('0x15')]);return _0x28d42b(_0x281499[_0xdf18('0x13')][_0xdf18('0x15')]);}logger[_0xdf18('0x13')](_0xdf18('0xe'),_0x21d72b,_0x281499['error'][_0xdf18('0x15')]);return _0x5c597c(_0x281499[_0xdf18('0x13')][_0xdf18('0x15')]);}else{logger[_0xdf18('0xd')](_0xdf18('0xe'),_0x21d72b,'request\x20sent');_0x5c597c(_0x281499[_0xdf18('0x16')][_0xdf18('0x15')]);}})[_0xdf18('0x17')](function(_0x58fe3c){logger[_0xdf18('0x13')](_0xdf18('0xe'),_0x21d72b,_0x58fe3c);_0x28d42b(_0x58fe3c);});});}exports[_0xdf18('0x18')]=function(_0x5bb40e){var _0x321b7a=this;return new Promise(function(_0x9c7ff8,_0x2a2d5a){return db[_0xdf18('0x19')][_0xdf18('0x1a')]({'raw':_0x5bb40e[_0xdf18('0x1b')]?_0x5bb40e[_0xdf18('0x1b')][_0xdf18('0x1c')]===undefined?!![]:![]:!![],'where':_0x5bb40e[_0xdf18('0x1b')]?_0x5bb40e[_0xdf18('0x1b')]['where']||null:null,'attributes':_0x5bb40e['options']?_0x5bb40e[_0xdf18('0x1b')][_0xdf18('0x1d')]||null:null,'limit':_0x5bb40e['options']?_0x5bb40e['options'][_0xdf18('0x1e')]||null:null,'include':_0x5bb40e[_0xdf18('0x1b')]?_0x5bb40e[_0xdf18('0x1b')][_0xdf18('0x1f')]?_[_0xdf18('0x20')](_0x5bb40e[_0xdf18('0x1b')]['include'],function(_0x372695){return{'model':db[_0x372695[_0xdf18('0x21')]],'as':_0x372695['as'],'attributes':_0x372695[_0xdf18('0x1d')],'include':_0x372695[_0xdf18('0x1f')]?_['map'](_0x372695[_0xdf18('0x1f')],function(_0x219ed6){return{'model':db[_0x219ed6[_0xdf18('0x21')]],'as':_0x219ed6['as'],'attributes':_0x219ed6[_0xdf18('0x1d')],'include':_0x219ed6[_0xdf18('0x1f')]?_[_0xdf18('0x20')](_0x219ed6[_0xdf18('0x1f')],function(_0x23c5aa){return{'model':db[_0x23c5aa[_0xdf18('0x21')]],'as':_0x23c5aa['as'],'attributes':_0x23c5aa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x39e535){logger[_0xdf18('0xd')](_0xdf18('0x18'),_0x5bb40e);logger['debug']('GetMemberReport',_0x5bb40e,JSON[_0xdf18('0x12')](_0x39e535));_0x9c7ff8(_0x39e535);})[_0xdf18('0x17')](function(_0xb4149e){logger[_0xdf18('0x13')](_0xdf18('0x18'),_0xb4149e[_0xdf18('0x15')],_0x5bb40e);_0x2a2d5a(_0x321b7a['error'](0x1f4,_0xb4149e[_0xdf18('0x15')]));});});};exports[_0xdf18('0x22')]=function(_0x78cee1){var _0x4705f3=this;return new Promise(function(_0x24ea45,_0x59fecb){return db[_0xdf18('0x19')][_0xdf18('0x23')](_0x78cee1[_0xdf18('0x24')],{'raw':_0x78cee1[_0xdf18('0x1b')]?_0x78cee1[_0xdf18('0x1b')][_0xdf18('0x1c')]===undefined?!![]:![]:!![]})[_0xdf18('0xc')](function(_0x4f3c60){logger[_0xdf18('0xd')](_0xdf18('0x22'),_0x78cee1);logger[_0xdf18('0x10')]('CreateMemberReport',_0x78cee1,JSON[_0xdf18('0x12')](_0x4f3c60));_0x24ea45(_0x4f3c60);})[_0xdf18('0x17')](function(_0x34605e){logger['error'](_0xdf18('0x22'),_0x34605e[_0xdf18('0x15')],_0x78cee1);_0x59fecb(_0x4705f3[_0xdf18('0x13')](0x1f4,_0x34605e[_0xdf18('0x15')]));});});};exports[_0xdf18('0x25')]=function(_0x4eb1c3){var _0xbc91d9=this;return new Promise(function(_0x4d0e7b,_0x5da7cd){return db['MemberReport'][_0xdf18('0x26')](_0x4eb1c3[_0xdf18('0x24')],{'raw':_0x4eb1c3[_0xdf18('0x1b')]?_0x4eb1c3[_0xdf18('0x1b')][_0xdf18('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eb1c3[_0xdf18('0x1b')]?_0x4eb1c3['options'][_0xdf18('0x27')]||null:null,'attributes':_0x4eb1c3[_0xdf18('0x1b')]?_0x4eb1c3[_0xdf18('0x1b')][_0xdf18('0x1d')]||null:null,'limit':_0x4eb1c3[_0xdf18('0x1b')]?_0x4eb1c3['options'][_0xdf18('0x1e')]||null:null})[_0xdf18('0xc')](function(_0x3c315a){logger[_0xdf18('0xd')]('UpdateMemberReport',_0x4eb1c3);logger[_0xdf18('0x10')]('UpdateMemberReport',_0x4eb1c3,JSON[_0xdf18('0x12')](_0x3c315a));_0x4d0e7b(_0x3c315a);})[_0xdf18('0x17')](function(_0x10bb54){logger[_0xdf18('0x13')](_0xdf18('0x25'),_0x10bb54[_0xdf18('0x15')],_0x4eb1c3);_0x5da7cd(_0xbc91d9[_0xdf18('0x13')](0x1f4,_0x10bb54[_0xdf18('0x15')]));});});}; \ No newline at end of file +var _0xa6be=['error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c466d,_0x11ee15){var _0x580ca5=function(_0x176110){while(--_0x176110){_0x4c466d['push'](_0x4c466d['shift']());}};_0x580ca5(++_0x11ee15);}(_0xa6be,0xab));var _0xea6b=function(_0x7cb569,_0x5e872f){_0x7cb569=_0x7cb569-0x0;var _0x7d6da7=_0xa6be[_0x7cb569];return _0x7d6da7;};'use strict';var _=require(_0xea6b('0x0'));var util=require(_0xea6b('0x1'));var moment=require(_0xea6b('0x2'));var BPromise=require(_0xea6b('0x3'));var rs=require(_0xea6b('0x4'));var fs=require('fs');var db=require(_0xea6b('0x5'))['db'];var utils=require(_0xea6b('0x6'));var logger=require(_0xea6b('0x7'))(_0xea6b('0x8'));var config=require(_0xea6b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xea6b('0xa')][_0xea6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x75b2e,_0x52de9e,_0x36c621){return new BPromise(function(_0x38f84f,_0x291f0a){return client['request'](_0x75b2e,_0x36c621)[_0xea6b('0xc')](function(_0xb19431){logger[_0xea6b('0xd')](_0xea6b('0xe'),_0x52de9e,_0xea6b('0xf'));logger[_0xea6b('0x10')](_0xea6b('0x11'),_0x52de9e,_0xea6b('0xf'),JSON[_0xea6b('0x12')](_0xb19431));if(_0xb19431[_0xea6b('0x13')]){if(_0xb19431[_0xea6b('0x13')][_0xea6b('0x14')]===0x1f4){logger[_0xea6b('0x13')](_0xea6b('0xe'),_0x52de9e,_0xb19431['error']['message']);return _0x291f0a(_0xb19431[_0xea6b('0x13')]['message']);}logger['error'](_0xea6b('0xe'),_0x52de9e,_0xb19431[_0xea6b('0x13')][_0xea6b('0x15')]);return _0x38f84f(_0xb19431[_0xea6b('0x13')]['message']);}else{logger[_0xea6b('0xd')](_0xea6b('0xe'),_0x52de9e,_0xea6b('0xf'));_0x38f84f(_0xb19431[_0xea6b('0x16')]['message']);}})[_0xea6b('0x17')](function(_0x107877){logger['error'](_0xea6b('0xe'),_0x52de9e,_0x107877);_0x291f0a(_0x107877);});});}exports[_0xea6b('0x18')]=function(_0x2e53cc){var _0x5eedb6=this;return new Promise(function(_0xa2789f,_0x53aec1){return db[_0xea6b('0x19')][_0xea6b('0x1a')]({'raw':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1d')]||null:null,'attributes':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc['options'][_0xea6b('0x1e')]||null:null,'limit':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x1f')]||null:null,'include':_0x2e53cc[_0xea6b('0x1b')]?_0x2e53cc['options']['include']?_[_0xea6b('0x20')](_0x2e53cc[_0xea6b('0x1b')][_0xea6b('0x21')],function(_0x1ea965){return{'model':db[_0x1ea965[_0xea6b('0x22')]],'as':_0x1ea965['as'],'attributes':_0x1ea965[_0xea6b('0x1e')],'include':_0x1ea965['include']?_[_0xea6b('0x20')](_0x1ea965[_0xea6b('0x21')],function(_0x4b33db){return{'model':db[_0x4b33db[_0xea6b('0x22')]],'as':_0x4b33db['as'],'attributes':_0x4b33db[_0xea6b('0x1e')],'include':_0x4b33db[_0xea6b('0x21')]?_['map'](_0x4b33db[_0xea6b('0x21')],function(_0x516ba8){return{'model':db[_0x516ba8[_0xea6b('0x22')]],'as':_0x516ba8['as'],'attributes':_0x516ba8[_0xea6b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x58ddd8){logger[_0xea6b('0xd')](_0xea6b('0x18'),_0x2e53cc);logger[_0xea6b('0x10')](_0xea6b('0x18'),_0x2e53cc,JSON['stringify'](_0x58ddd8));_0xa2789f(_0x58ddd8);})['catch'](function(_0x3a9a5c){logger[_0xea6b('0x13')](_0xea6b('0x18'),_0x3a9a5c[_0xea6b('0x15')],_0x2e53cc);_0x53aec1(_0x5eedb6[_0xea6b('0x13')](0x1f4,_0x3a9a5c[_0xea6b('0x15')]));});});};exports[_0xea6b('0x23')]=function(_0x47d301){var _0x846d21=this;return new Promise(function(_0x5dacd4,_0x3feb71){return db[_0xea6b('0x19')]['create'](_0x47d301['body'],{'raw':_0x47d301[_0xea6b('0x1b')]?_0x47d301['options'][_0xea6b('0x1c')]===undefined?!![]:![]:!![]})[_0xea6b('0xc')](function(_0x2f6f13){logger[_0xea6b('0xd')](_0xea6b('0x23'),_0x47d301);logger[_0xea6b('0x10')](_0xea6b('0x23'),_0x47d301,JSON[_0xea6b('0x12')](_0x2f6f13));_0x5dacd4(_0x2f6f13);})[_0xea6b('0x17')](function(_0x29d7b4){logger['error'](_0xea6b('0x23'),_0x29d7b4[_0xea6b('0x15')],_0x47d301);_0x3feb71(_0x846d21[_0xea6b('0x13')](0x1f4,_0x29d7b4[_0xea6b('0x15')]));});});};exports[_0xea6b('0x24')]=function(_0x47b911){var _0x2e1137=this;return new Promise(function(_0x5d84d9,_0x565fa2){return db[_0xea6b('0x19')][_0xea6b('0x25')](_0x47b911['body'],{'raw':_0x47b911[_0xea6b('0x1b')]?_0x47b911[_0xea6b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b911['options']?_0x47b911[_0xea6b('0x1b')][_0xea6b('0x1d')]||null:null,'attributes':_0x47b911[_0xea6b('0x1b')]?_0x47b911['options'][_0xea6b('0x1e')]||null:null,'limit':_0x47b911[_0xea6b('0x1b')]?_0x47b911[_0xea6b('0x1b')][_0xea6b('0x1f')]||null:null})[_0xea6b('0xc')](function(_0x20977d){logger[_0xea6b('0xd')](_0xea6b('0x24'),_0x47b911);logger[_0xea6b('0x10')](_0xea6b('0x24'),_0x47b911,JSON['stringify'](_0x20977d));_0x5d84d9(_0x20977d);})['catch'](function(_0x5099fa){logger['error']('UpdateMemberReport',_0x5099fa['message'],_0x47b911);_0x565fa2(_0x2e1137['error'](0x1f4,_0x5099fa[_0xea6b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f97bd21..49001b8 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 _0x0d15=['get','multer','util','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x165a0e,_0xad09a8){var _0x59aa46=function(_0x3038d3){while(--_0x3038d3){_0x165a0e['push'](_0x165a0e['shift']());}};_0x59aa46(++_0xad09a8);}(_0x0d15,0x158));var _0x50d1=function(_0x50e40b,_0x29fdae){_0x50e40b=_0x50e40b-0x0;var _0x2f57e8=_0x0d15[_0x50e40b];return _0x2f57e8;};'use strict';var multer=require(_0x50d1('0x0'));var util=require(_0x50d1('0x1'));var path=require(_0x50d1('0x2'));var express=require(_0x50d1('0x3'));var router=express['Router']();var auth=require(_0x50d1('0x4'));var interaction=require(_0x50d1('0x5'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x50d1('0x6')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x6317=['../../components/interaction/service','../../config/environment','./migration.controller','get','multer','util','express','Router','../../components/auth/service'];(function(_0x3d43aa,_0xc0892){var _0x38dd59=function(_0xa10673){while(--_0xa10673){_0x3d43aa['push'](_0x3d43aa['shift']());}};_0x38dd59(++_0xc0892);}(_0x6317,0xf7));var _0x7631=function(_0x58f5aa,_0x2278fb){_0x58f5aa=_0x58f5aa-0x0;var _0x1129e3=_0x6317[_0x58f5aa];return _0x1129e3;};'use strict';var multer=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var path=require('path');var express=require(_0x7631('0x2'));var router=express[_0x7631('0x3')]();var auth=require(_0x7631('0x4'));var interaction=require(_0x7631('0x5'));var config=require(_0x7631('0x6'));var controller=require(_0x7631('0x7'));router[_0x7631('0x8')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 28fef4d..7b5b02d 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 _0x03cf=['STRING','sequelize'];(function(_0x4ad762,_0x57db87){var _0x29842f=function(_0x29b808){while(--_0x29b808){_0x4ad762['push'](_0x4ad762['shift']());}};_0x29842f(++_0x57db87);}(_0x03cf,0x67));var _0xf03c=function(_0x70d4e7,_0x54e3e5){_0x70d4e7=_0x70d4e7-0x0;var _0x5b3c1d=_0x03cf[_0x70d4e7];return _0x5b3c1d;};'use strict';var Sequelize=require(_0xf03c('0x0'));module['exports']={'version':{'type':Sequelize[_0xf03c('0x1')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file +var _0x6acc=['exports','STRING','sequelize'];(function(_0x51171b,_0x452147){var _0xcc8a63=function(_0x923eb6){while(--_0x923eb6){_0x51171b['push'](_0x51171b['shift']());}};_0xcc8a63(++_0x452147);}(_0x6acc,0x167));var _0xc6ac=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x6acc[_0x39c734];return _0xb2a2f9;};'use strict';var Sequelize=require(_0xc6ac('0x0'));module[_0xc6ac('0x1')]={'version':{'type':Sequelize[_0xc6ac('0x2')],'primaryKey':!![],'autoIncrement':![]}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index a55ddc2..ca3b52b 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 _0x7d1c=['apply','reject','save','update','then','stack','name','send','index','model','keys','query','dateStart','dateEnd','filters','attributes','fields','hasOwnProperty','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','findAll','rows','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x7be5a6,_0x5009e6){var _0x177eb4=function(_0x1198d0){while(--_0x1198d0){_0x7be5a6['push'](_0x7be5a6['shift']());}};_0x177eb4(++_0x5009e6);}(_0x7d1c,0x1a7));var _0xc7d1=function(_0x2b84c8,_0x183d8e){_0x2b84c8=_0x2b84c8-0x0;var _0x5cea29=_0x7d1c[_0x2b84c8];return _0x5cea29;};'use strict';var jsonpatch=require(_0xc7d1('0x0'));var rp=require('request-promise');var moment=require(_0xc7d1('0x1'));var BPromise=require(_0xc7d1('0x2'));var Mustache=require(_0xc7d1('0x3'));var util=require(_0xc7d1('0x4'));var path=require(_0xc7d1('0x5'));var sox=require(_0xc7d1('0x6'));var csv=require('to-csv');var ejs=require(_0xc7d1('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc7d1('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc7d1('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc7d1('0xa'));var Papa=require('papaparse');var qs=require(_0xc7d1('0xb'));var logger=require(_0xc7d1('0xc'))(_0xc7d1('0xd'));var utils=require(_0xc7d1('0xe'));var config=require(_0xc7d1('0xf'));var db=require(_0xc7d1('0x10'))['db'];function respondWithStatusCode(_0x3a9d77,_0x29c744){_0x29c744=_0x29c744||0xcc;return function(_0x3917f4){if(_0x3917f4){return _0x3a9d77[_0xc7d1('0x11')](_0x29c744);}return _0x3a9d77[_0xc7d1('0x12')](_0x29c744)[_0xc7d1('0x13')]();};}function respondWithResult(_0x23973a,_0xd5929d){_0xd5929d=_0xd5929d||0xc8;return function(_0x4a8654){if(_0x4a8654){return _0x23973a[_0xc7d1('0x12')](_0xd5929d)[_0xc7d1('0x14')](_0x4a8654);}};}function respondWithFilteredResult(_0x370fd8,_0xe31b92){return function(_0x2eaf4a){if(_0x2eaf4a){var _0x46698d=_0x2eaf4a[_0xc7d1('0x15')],_0x206328=_0xe31b92['offset'],_0x34f8e7=_0xe31b92[_0xc7d1('0x16')]+_0xe31b92[_0xc7d1('0x17')],_0x97045b;if(_0x34f8e7>=_0x46698d){_0x34f8e7=_0x46698d;_0x97045b=0xc8;}else{_0x97045b=0xce;}_0x370fd8[_0xc7d1('0x12')](_0x97045b);return _0x370fd8[_0xc7d1('0x18')]('Content-Range',_0x206328+'-'+_0x34f8e7+'/'+_0x46698d)[_0xc7d1('0x14')](_0x2eaf4a);}return null;};}function patchUpdates(_0x30608c){return function(_0x25d9aa){try{jsonpatch[_0xc7d1('0x19')](_0x25d9aa,_0x30608c,!![]);}catch(_0x28d8c5){return BPromise[_0xc7d1('0x1a')](_0x28d8c5);}return _0x25d9aa[_0xc7d1('0x1b')]();};}function saveUpdates(_0x2a5ef9,_0x346c12){return function(_0x19ec9e){if(_0x19ec9e){return _0x19ec9e[_0xc7d1('0x1c')](_0x2a5ef9)[_0xc7d1('0x1d')](function(_0x4958cc){return _0x4958cc;});}return null;};}function removeEntity(_0x45a72f,_0x351b03){return function(_0x501e72){if(_0x501e72){return _0x501e72['destroy']()[_0xc7d1('0x1d')](function(){_0x45a72f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e8a7,_0xc73196){return function(_0x15a6f7){if(!_0x15a6f7){_0x21e8a7[_0xc7d1('0x11')](0x194);}return _0x15a6f7;};}function handleError(_0x3de9c2,_0x2be817){_0x2be817=_0x2be817||0x1f4;return function(_0x492750){logger['error'](_0x492750[_0xc7d1('0x1e')]);if(_0x492750['name']){delete _0x492750[_0xc7d1('0x1f')];}_0x3de9c2[_0xc7d1('0x12')](_0x2be817)[_0xc7d1('0x20')](_0x492750);};}exports[_0xc7d1('0x21')]=function(_0x406677,_0x5ba6fc){var _0x14f499={},_0x4f2b64={},_0xb2b4fa={'count':0x0,'rows':[]};var _0xd9d6b=db['Migration']['rawAttributes'];_0x4f2b64[_0xc7d1('0x22')]=_[_0xc7d1('0x23')](_0xd9d6b);var _0x3a6f5d={'dateStart':_0x406677[_0xc7d1('0x24')][_0xc7d1('0x25')],'dateEnd':_0x406677['query']['dateEnd']};delete _0x406677[_0xc7d1('0x24')][_0xc7d1('0x25')];delete _0x406677[_0xc7d1('0x24')][_0xc7d1('0x26')];_0x4f2b64[_0xc7d1('0x24')]=_[_0xc7d1('0x23')](_0x406677['query']);_0x4f2b64[_0xc7d1('0x27')]=_['intersection'](_0x4f2b64[_0xc7d1('0x22')],_0x4f2b64[_0xc7d1('0x24')]);_0x14f499[_0xc7d1('0x28')]=_['intersection'](_0x4f2b64['model'],qs[_0xc7d1('0x29')](_0x406677[_0xc7d1('0x24')][_0xc7d1('0x29')]));_0x14f499[_0xc7d1('0x28')]=_0x14f499[_0xc7d1('0x28')]['length']?_0x14f499[_0xc7d1('0x28')]:_0x4f2b64[_0xc7d1('0x22')];if(!_0x406677[_0xc7d1('0x24')][_0xc7d1('0x2a')]('nolimit')){_0x14f499[_0xc7d1('0x17')]=qs[_0xc7d1('0x17')](_0x406677[_0xc7d1('0x24')][_0xc7d1('0x17')]);_0x14f499[_0xc7d1('0x16')]=qs[_0xc7d1('0x16')](_0x406677[_0xc7d1('0x24')][_0xc7d1('0x16')]);}_0x14f499['order']=qs[_0xc7d1('0x2b')](_0x406677[_0xc7d1('0x24')][_0xc7d1('0x2b')]);_0x14f499[_0xc7d1('0x2c')]=qs[_0xc7d1('0x27')](_[_0xc7d1('0x2d')](_0x406677[_0xc7d1('0x24')],_0x4f2b64[_0xc7d1('0x27')]));if(_0x3a6f5d[_0xc7d1('0x25')]){if(_0x3a6f5d[_0xc7d1('0x26')]){_0x3a6f5d['dateEnd']=moment(_0x3a6f5d['dateEnd'])[_0xc7d1('0x2e')](0x1,_0xc7d1('0x2f'));}else{_0x3a6f5d[_0xc7d1('0x26')]=moment(_0x3a6f5d[_0xc7d1('0x25')])['add'](0x1,_0xc7d1('0x2f'));}_['merge'](_0x14f499[_0xc7d1('0x2c')],{'createdAt':{'$gte':_0x3a6f5d['dateStart'],'$lte':_0x3a6f5d[_0xc7d1('0x26')]}});}if(_0x406677[_0xc7d1('0x24')][_0xc7d1('0x30')]){_0x14f499[_0xc7d1('0x2c')]=_[_0xc7d1('0x31')](_0x14f499['where'],{'$or':_[_0xc7d1('0x32')](_0x14f499[_0xc7d1('0x28')],function(_0x27f06c){var _0x1a45b0={};_0x1a45b0[_0x27f06c]={'$like':'%'+_0x406677[_0xc7d1('0x24')][_0xc7d1('0x30')]+'%'};return _0x1a45b0;})});}_0x14f499=_['merge']({},_0x14f499,_0x406677[_0xc7d1('0x33')]);var _0x13c156={'where':_0x14f499[_0xc7d1('0x2c')]};return db['Migration'][_0xc7d1('0x15')](_0x13c156)[_0xc7d1('0x1d')](function(_0x3ac68e){_0xb2b4fa['count']=_0x3ac68e;if(_0x406677[_0xc7d1('0x24')][_0xc7d1('0x34')]){_0x14f499[_0xc7d1('0x35')]=[{'all':!![]}];}return db['Migration'][_0xc7d1('0x36')](_0x14f499);})[_0xc7d1('0x1d')](function(_0x58a860){_0xb2b4fa[_0xc7d1('0x37')]=_0x58a860;return _0xb2b4fa;})[_0xc7d1('0x1d')](respondWithFilteredResult(_0x5ba6fc,_0x14f499))['catch'](handleError(_0x5ba6fc,null));}; \ No newline at end of file +var _0xf198=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','json','apply','reject','save','update','then','error','stack','name','index','Migration','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','day','add','merge','filter','options','count','includeAll','include','findAll','catch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x15be66,_0x3a86c1){var _0x1d5d87=function(_0x4dd8d0){while(--_0x4dd8d0){_0x15be66['push'](_0x15be66['shift']());}};_0x1d5d87(++_0x3a86c1);}(_0xf198,0x126));var _0x8f19=function(_0xff84e0,_0x140f53){_0xff84e0=_0xff84e0-0x0;var _0x52973a=_0xf198[_0xff84e0];return _0x52973a;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x8f19('0x0'));var moment=require(_0x8f19('0x1'));var BPromise=require(_0x8f19('0x2'));var Mustache=require(_0x8f19('0x3'));var util=require(_0x8f19('0x4'));var path=require(_0x8f19('0x5'));var sox=require(_0x8f19('0x6'));var csv=require('to-csv');var ejs=require(_0x8f19('0x7'));var fs=require('fs');var _=require(_0x8f19('0x8'));var squel=require(_0x8f19('0x9'));var crypto=require(_0x8f19('0xa'));var jsforce=require(_0x8f19('0xb'));var deskjs=require(_0x8f19('0xc'));var toCsv=require(_0x8f19('0xd'));var querystring=require(_0x8f19('0xe'));var Papa=require(_0x8f19('0xf'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x8f19('0x10'));var config=require(_0x8f19('0x11'));var db=require(_0x8f19('0x12'))['db'];function respondWithStatusCode(_0x39aa6b,_0x4f62a6){_0x4f62a6=_0x4f62a6||0xcc;return function(_0x4bc1dd){if(_0x4bc1dd){return _0x39aa6b[_0x8f19('0x13')](_0x4f62a6);}return _0x39aa6b[_0x8f19('0x14')](_0x4f62a6)[_0x8f19('0x15')]();};}function respondWithResult(_0x584f08,_0x54dd1e){_0x54dd1e=_0x54dd1e||0xc8;return function(_0x2d5f22){if(_0x2d5f22){return _0x584f08['status'](_0x54dd1e)['json'](_0x2d5f22);}};}function respondWithFilteredResult(_0x43214e,_0x3da188){return function(_0x205a02){if(_0x205a02){var _0x5eaff9=_0x205a02['count'],_0xa23246=_0x3da188[_0x8f19('0x16')],_0x2c170c=_0x3da188[_0x8f19('0x16')]+_0x3da188['limit'],_0x3ce4f7;if(_0x2c170c>=_0x5eaff9){_0x2c170c=_0x5eaff9;_0x3ce4f7=0xc8;}else{_0x3ce4f7=0xce;}_0x43214e[_0x8f19('0x14')](_0x3ce4f7);return _0x43214e[_0x8f19('0x17')]('Content-Range',_0xa23246+'-'+_0x2c170c+'/'+_0x5eaff9)[_0x8f19('0x18')](_0x205a02);}return null;};}function patchUpdates(_0x3f3bbb){return function(_0x27a744){try{jsonpatch[_0x8f19('0x19')](_0x27a744,_0x3f3bbb,!![]);}catch(_0x4fabad){return BPromise[_0x8f19('0x1a')](_0x4fabad);}return _0x27a744[_0x8f19('0x1b')]();};}function saveUpdates(_0x200da7,_0x41bf37){return function(_0x3b3f69){if(_0x3b3f69){return _0x3b3f69[_0x8f19('0x1c')](_0x200da7)[_0x8f19('0x1d')](function(_0x4d66ac){return _0x4d66ac;});}return null;};}function removeEntity(_0x4211a3,_0x6e48e4){return function(_0xb60787){if(_0xb60787){return _0xb60787['destroy']()[_0x8f19('0x1d')](function(){_0x4211a3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x465d98,_0x4cac9d){return function(_0x3fc4b8){if(!_0x3fc4b8){_0x465d98[_0x8f19('0x13')](0x194);}return _0x3fc4b8;};}function handleError(_0x35f417,_0x3d8d15){_0x3d8d15=_0x3d8d15||0x1f4;return function(_0x40b49){logger[_0x8f19('0x1e')](_0x40b49[_0x8f19('0x1f')]);if(_0x40b49['name']){delete _0x40b49[_0x8f19('0x20')];}_0x35f417[_0x8f19('0x14')](_0x3d8d15)['send'](_0x40b49);};}exports[_0x8f19('0x21')]=function(_0x41fd2f,_0x544864){var _0x950600={},_0x3bf475={},_0x3f9e8b={'count':0x0,'rows':[]};var _0x276b89=db[_0x8f19('0x22')][_0x8f19('0x23')];_0x3bf475[_0x8f19('0x24')]=_[_0x8f19('0x25')](_0x276b89);var _0x35196e={'dateStart':_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x27')],'dateEnd':_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x28')]};delete _0x41fd2f[_0x8f19('0x26')][_0x8f19('0x27')];delete _0x41fd2f[_0x8f19('0x26')]['dateEnd'];_0x3bf475[_0x8f19('0x26')]=_[_0x8f19('0x25')](_0x41fd2f['query']);_0x3bf475[_0x8f19('0x29')]=_[_0x8f19('0x2a')](_0x3bf475[_0x8f19('0x24')],_0x3bf475[_0x8f19('0x26')]);_0x950600[_0x8f19('0x2b')]=_[_0x8f19('0x2a')](_0x3bf475['model'],qs[_0x8f19('0x2c')](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x2c')]));_0x950600[_0x8f19('0x2b')]=_0x950600[_0x8f19('0x2b')][_0x8f19('0x2d')]?_0x950600[_0x8f19('0x2b')]:_0x3bf475[_0x8f19('0x24')];if(!_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x2e')]('nolimit')){_0x950600[_0x8f19('0x2f')]=qs[_0x8f19('0x2f')](_0x41fd2f['query'][_0x8f19('0x2f')]);_0x950600[_0x8f19('0x16')]=qs['offset'](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x16')]);}_0x950600[_0x8f19('0x30')]=qs[_0x8f19('0x31')](_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x31')]);_0x950600[_0x8f19('0x32')]=qs[_0x8f19('0x29')](_[_0x8f19('0x33')](_0x41fd2f['query'],_0x3bf475[_0x8f19('0x29')]));if(_0x35196e[_0x8f19('0x27')]){if(_0x35196e['dateEnd']){_0x35196e[_0x8f19('0x28')]=moment(_0x35196e[_0x8f19('0x28')])['add'](0x1,_0x8f19('0x34'));}else{_0x35196e[_0x8f19('0x28')]=moment(_0x35196e[_0x8f19('0x27')])[_0x8f19('0x35')](0x1,_0x8f19('0x34'));}_[_0x8f19('0x36')](_0x950600['where'],{'createdAt':{'$gte':_0x35196e[_0x8f19('0x27')],'$lte':_0x35196e[_0x8f19('0x28')]}});}if(_0x41fd2f['query'][_0x8f19('0x37')]){_0x950600[_0x8f19('0x32')]=_[_0x8f19('0x36')](_0x950600[_0x8f19('0x32')],{'$or':_['map'](_0x950600[_0x8f19('0x2b')],function(_0x8ca734){var _0xae74d5={};_0xae74d5[_0x8ca734]={'$like':'%'+_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x37')]+'%'};return _0xae74d5;})});}_0x950600=_[_0x8f19('0x36')]({},_0x950600,_0x41fd2f[_0x8f19('0x38')]);var _0x1ce4e1={'where':_0x950600[_0x8f19('0x32')]};return db['Migration']['count'](_0x1ce4e1)['then'](function(_0x5ecd04){_0x3f9e8b[_0x8f19('0x39')]=_0x5ecd04;if(_0x41fd2f[_0x8f19('0x26')][_0x8f19('0x3a')]){_0x950600[_0x8f19('0x3b')]=[{'all':!![]}];}return db[_0x8f19('0x22')][_0x8f19('0x3c')](_0x950600);})[_0x8f19('0x1d')](function(_0x40819e){_0x3f9e8b['rows']=_0x40819e;return _0x3f9e8b;})[_0x8f19('0x1d')](respondWithFilteredResult(_0x544864,_0x950600))[_0x8f19('0x3d')](handleError(_0x544864,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f1ef7b4..3662b66 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 _0x5d0a=['./migration.attributes','define','Migration','migrations','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x25766b,_0x1db30a){var _0x3a69a1=function(_0x9881c4){while(--_0x9881c4){_0x25766b['push'](_0x25766b['shift']());}};_0x3a69a1(++_0x1db30a);}(_0x5d0a,0x175));var _0xa5d0=function(_0x5a7de3,_0xe27f25){_0x5a7de3=_0x5a7de3-0x0;var _0x2f32bc=_0x5d0a[_0x5a7de3];return _0x2f32bc;};'use strict';var _=require(_0xa5d0('0x0'));var util=require('util');var logger=require(_0xa5d0('0x1'))('api');var moment=require(_0xa5d0('0x2'));var BPromise=require(_0xa5d0('0x3'));var rp=require(_0xa5d0('0x4'));var attributes=require(_0xa5d0('0x5'));module['exports']=function(_0x24b2b5,_0x81c8f7){return _0x24b2b5[_0xa5d0('0x6')](_0xa5d0('0x7'),attributes,{'tableName':_0xa5d0('0x8'),'paranoid':![],'indexes':[],'timestamps':![]});}; \ No newline at end of file +var _0x002d=['Migration','migrations','lodash','util','../../config/logger','bluebird','request-promise','./migration.attributes','exports','define'];(function(_0x1b5947,_0x14b999){var _0x158c24=function(_0x5d9b2a){while(--_0x5d9b2a){_0x1b5947['push'](_0x1b5947['shift']());}};_0x158c24(++_0x14b999);}(_0x002d,0xca));var _0xd002=function(_0x3a1f55,_0x515cb5){_0x3a1f55=_0x3a1f55-0x0;var _0x4ab364=_0x002d[_0x3a1f55];return _0x4ab364;};'use strict';var _=require(_0xd002('0x0'));var util=require(_0xd002('0x1'));var logger=require(_0xd002('0x2'))('api');var moment=require('moment');var BPromise=require(_0xd002('0x3'));var rp=require(_0xd002('0x4'));var attributes=require(_0xd002('0x5'));module[_0xd002('0x6')]=function(_0x1323f0,_0x179915){return _0x1323f0[_0xd002('0x7')](_0xd002('0x8'),attributes,{'tableName':_0xd002('0x9'),'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 79bb12d..99ef84b 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 _0x68ff=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2776db,_0xfb2eda){var _0x572930=function(_0x5e1032){while(--_0x5e1032){_0x2776db['push'](_0x2776db['shift']());}};_0x572930(++_0xfb2eda);}(_0x68ff,0x64));var _0xf68f=function(_0x24e244,_0x18e366){_0x24e244=_0x24e244-0x0;var _0x123660=_0x68ff[_0x24e244];return _0x123660;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf68f('0x0'));var BPromise=require(_0xf68f('0x1'));var rs=require(_0xf68f('0x2'));var fs=require('fs');var db=require(_0xf68f('0x3'))['db'];var utils=require(_0xf68f('0x4'));var logger=require(_0xf68f('0x5'))(_0xf68f('0x6'));var config=require(_0xf68f('0x7'));var jayson=require(_0xf68f('0x8'));var client=jayson[_0xf68f('0x9')][_0xf68f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5071cb,_0x13e3c1,_0x31c830){return new BPromise(function(_0x3c4874,_0xd64e6b){return client[_0xf68f('0xb')](_0x5071cb,_0x31c830)['then'](function(_0x5690e8){logger[_0xf68f('0xc')](_0xf68f('0xd'),_0x13e3c1,'request\x20sent');logger[_0xf68f('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x13e3c1,'request\x20sent',JSON[_0xf68f('0xf')](_0x5690e8));if(_0x5690e8[_0xf68f('0x10')]){if(_0x5690e8['error'][_0xf68f('0x11')]===0x1f4){logger[_0xf68f('0x10')](_0xf68f('0xd'),_0x13e3c1,_0x5690e8[_0xf68f('0x10')][_0xf68f('0x12')]);return _0xd64e6b(_0x5690e8['error']['message']);}logger[_0xf68f('0x10')](_0xf68f('0xd'),_0x13e3c1,_0x5690e8[_0xf68f('0x10')][_0xf68f('0x12')]);return _0x3c4874(_0x5690e8['error']['message']);}else{logger[_0xf68f('0xc')](_0xf68f('0xd'),_0x13e3c1,'request\x20sent');_0x3c4874(_0x5690e8[_0xf68f('0x13')][_0xf68f('0x12')]);}})[_0xf68f('0x14')](function(_0x585400){logger[_0xf68f('0x10')](_0xf68f('0xd'),_0x13e3c1,_0x585400);_0xd64e6b(_0x585400);});});} \ No newline at end of file +var _0x06f7=['Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug'];(function(_0x1074ff,_0x549c4c){var _0x2cd9df=function(_0x18d160){while(--_0x18d160){_0x1074ff['push'](_0x1074ff['shift']());}};_0x2cd9df(++_0x549c4c);}(_0x06f7,0xce));var _0x706f=function(_0x57966a,_0x477964){_0x57966a=_0x57966a-0x0;var _0x191765=_0x06f7[_0x57966a];return _0x191765;};'use strict';var _=require('lodash');var util=require(_0x706f('0x0'));var moment=require('moment');var BPromise=require(_0x706f('0x1'));var rs=require(_0x706f('0x2'));var fs=require('fs');var db=require(_0x706f('0x3'))['db'];var utils=require(_0x706f('0x4'));var logger=require('../../config/logger')(_0x706f('0x5'));var config=require('../../config/environment');var jayson=require(_0x706f('0x6'));var client=jayson[_0x706f('0x7')][_0x706f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20ca84,_0x2e3c73,_0x2906b8){return new BPromise(function(_0x3fee18,_0x3d1352){return client[_0x706f('0x9')](_0x20ca84,_0x2906b8)[_0x706f('0xa')](function(_0x294b75){logger[_0x706f('0xb')](_0x706f('0xc'),_0x2e3c73,'request\x20sent');logger[_0x706f('0xd')](_0x706f('0xe'),_0x2e3c73,'request\x20sent',JSON[_0x706f('0xf')](_0x294b75));if(_0x294b75[_0x706f('0x10')]){if(_0x294b75[_0x706f('0x10')][_0x706f('0x11')]===0x1f4){logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);return _0x3d1352(_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);}logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x294b75[_0x706f('0x10')][_0x706f('0x12')]);return _0x3fee18(_0x294b75['error']['message']);}else{logger[_0x706f('0xb')](_0x706f('0xc'),_0x2e3c73,_0x706f('0x13'));_0x3fee18(_0x294b75[_0x706f('0x14')][_0x706f('0x12')]);}})[_0x706f('0x15')](function(_0x586715){logger[_0x706f('0x10')](_0x706f('0xc'),_0x2e3c73,_0x586715);_0x3d1352(_0x586715);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index ae4a7ee..08297da 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 _0x326f=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','update','delete','/:id'];(function(_0x406859,_0x41ea31){var _0x128e86=function(_0x511a64){while(--_0x511a64){_0x406859['push'](_0x406859['shift']());}};_0x128e86(++_0x41ea31);}(_0x326f,0xd1));var _0xf326=function(_0x262bd2,_0x13bfdc){_0x262bd2=_0x262bd2-0x0;var _0x5de606=_0x326f[_0x262bd2];return _0x5de606;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var express=require(_0xf326('0x1'));var router=express[_0xf326('0x2')]();var auth=require(_0xf326('0x3'));var interaction=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var controller=require(_0xf326('0x6'));router[_0xf326('0x7')]('/',auth[_0xf326('0x8')](),controller[_0xf326('0x9')]);router[_0xf326('0x7')]('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xa')]);router[_0xf326('0xb')]('/',auth[_0xf326('0x8')](),controller['create']);router['put']('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')](_0xf326('0xe'),auth[_0xf326('0x8')](),controller['destroy']);module[_0xf326('0xf')]=router; \ No newline at end of file +var _0x326f=['exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','show','post','update','delete','/:id'];(function(_0xd765af,_0x176212){var _0x3b9421=function(_0x59e038){while(--_0x59e038){_0xd765af['push'](_0xd765af['shift']());}};_0x3b9421(++_0x176212);}(_0x326f,0xd1));var _0xf326=function(_0x175ad5,_0xc7b14e){_0x175ad5=_0x175ad5-0x0;var _0x4e0aea=_0x326f[_0x175ad5];return _0x4e0aea;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var express=require(_0xf326('0x1'));var router=express[_0xf326('0x2')]();var auth=require(_0xf326('0x3'));var interaction=require(_0xf326('0x4'));var config=require(_0xf326('0x5'));var controller=require(_0xf326('0x6'));router[_0xf326('0x7')]('/',auth[_0xf326('0x8')](),controller[_0xf326('0x9')]);router[_0xf326('0x7')]('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xa')]);router[_0xf326('0xb')]('/',auth[_0xf326('0x8')](),controller['create']);router['put']('/:id',auth[_0xf326('0x8')](),controller[_0xf326('0xc')]);router[_0xf326('0xd')](_0xf326('0xe'),auth[_0xf326('0x8')](),controller['destroy']);module[_0xf326('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 37e0734..1535b0b 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 _0xb159=['exports','externip','STRING','sequelize'];(function(_0x3e3f94,_0x27528b){var _0x5548bb=function(_0x272be9){while(--_0x272be9){_0x3e3f94['push'](_0x3e3f94['shift']());}};_0x5548bb(++_0x27528b);}(_0xb159,0xcf));var _0x9b15=function(_0x3210e1,_0x242a75){_0x3210e1=_0x3210e1-0x0;var _0x35551c=_0xb159[_0x3210e1];return _0x35551c;};'use strict';var Sequelize=require(_0x9b15('0x0'));module[_0x9b15('0x1')]={'type':{'type':Sequelize['ENUM']('localnet',_0x9b15('0x2'))},'value':{'type':Sequelize[_0x9b15('0x3')]}}; \ No newline at end of file +var _0x7a75=['ENUM','externip','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x7a75,0x1e8));var _0x57a7=function(_0x4624d9,_0x2fb5a4){_0x4624d9=_0x4624d9-0x0;var _0x4471fe=_0x7a75[_0x4624d9];return _0x4471fe;};'use strict';var Sequelize=require(_0x57a7('0x0'));module['exports']={'type':{'type':Sequelize[_0x57a7('0x1')]('localnet',_0x57a7('0x2'))},'value':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0602ba5..34e5b74 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 _0x3a6d=['index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','where','pick','add','day','merge','map','options','Network','count','includeAll','include','findAll','params','find','create','transaction','body','join','root','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','type','utf8','writeFileSync','destroy','readFileSync','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','end','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3a6d,0x143));var _0xd3a6=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x3a6d[_0x5c2e3e];return _0x53f64a;};'use strict';var jsonpatch=require(_0xd3a6('0x0'));var rp=require(_0xd3a6('0x1'));var moment=require('moment');var BPromise=require(_0xd3a6('0x2'));var Mustache=require(_0xd3a6('0x3'));var util=require(_0xd3a6('0x4'));var path=require(_0xd3a6('0x5'));var sox=require(_0xd3a6('0x6'));var csv=require('to-csv');var ejs=require(_0xd3a6('0x7'));var fs=require('fs');var _=require(_0xd3a6('0x8'));var squel=require(_0xd3a6('0x9'));var crypto=require(_0xd3a6('0xa'));var jsforce=require(_0xd3a6('0xb'));var deskjs=require(_0xd3a6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd3a6('0xd'));var Papa=require(_0xd3a6('0xe'));var qs=require(_0xd3a6('0xf'));var logger=require(_0xd3a6('0x10'))(_0xd3a6('0x11'));var utils=require(_0xd3a6('0x12'));var config=require(_0xd3a6('0x13'));var db=require(_0xd3a6('0x14'))['db'];var jayson=require(_0xd3a6('0x15'));var client=jayson['client'][_0xd3a6('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x1a00f7,_0x3f4d74,_0x225399,_0x2bd4f0){return new BPromise(function(_0x517a3b,_0x5430c0){var _0x4b0467=_0x2bd4f0||client;return _0x4b0467[_0xd3a6('0x17')](_0x1a00f7,_0x225399)[_0xd3a6('0x18')](function(_0xd7a20c){logger[_0xd3a6('0x19')](_0xd3a6('0x1a'),_0x3f4d74,_0xd3a6('0x1b'));logger[_0xd3a6('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x3f4d74,_0xd3a6('0x1b'),JSON[_0xd3a6('0x1d')](_0xd7a20c));if(_0xd7a20c[_0xd3a6('0x1e')]){if(_0xd7a20c['error'][_0xd3a6('0x1f')]===0x1f4){logger[_0xd3a6('0x1e')](_0xd3a6('0x1a'),_0x3f4d74,_0xd7a20c['error'][_0xd3a6('0x20')]);return _0x5430c0(_0xd7a20c['error']['message']);}logger[_0xd3a6('0x1e')](_0xd3a6('0x1a'),_0x3f4d74,_0xd7a20c[_0xd3a6('0x1e')][_0xd3a6('0x20')]);return _0x517a3b(_0xd7a20c[_0xd3a6('0x1e')][_0xd3a6('0x20')]);}else{logger[_0xd3a6('0x19')]('Network,\x20%s,\x20%s',_0x3f4d74,_0xd3a6('0x1b'));_0x517a3b(_0xd7a20c['result'][_0xd3a6('0x20')]);}})[_0xd3a6('0x21')](function(_0x12f2c1){logger[_0xd3a6('0x1e')](_0xd3a6('0x1a'),_0x3f4d74,_0x12f2c1);_0x5430c0(_0x12f2c1);});});}function respondWithStatusCode(_0x6ecd88,_0x54c193){_0x54c193=_0x54c193||0xcc;return function(_0xe7d595){if(_0xe7d595){return _0x6ecd88[_0xd3a6('0x22')](_0x54c193);}return _0x6ecd88['status'](_0x54c193)['end']();};}function respondWithResult(_0x5846bc,_0x573870){_0x573870=_0x573870||0xc8;return function(_0x5c9075){if(_0x5c9075){return _0x5846bc[_0xd3a6('0x23')](_0x573870)[_0xd3a6('0x24')](_0x5c9075);}};}function respondWithFilteredResult(_0x3d0b28,_0x5abd33){return function(_0x456541){if(_0x456541){var _0x58e53a=_0x456541['count'],_0x350a11=_0x5abd33[_0xd3a6('0x25')],_0x16afc8=_0x5abd33[_0xd3a6('0x25')]+_0x5abd33[_0xd3a6('0x26')],_0x429079;if(_0x16afc8>=_0x58e53a){_0x16afc8=_0x58e53a;_0x429079=0xc8;}else{_0x429079=0xce;}_0x3d0b28[_0xd3a6('0x23')](_0x429079);return _0x3d0b28[_0xd3a6('0x27')](_0xd3a6('0x28'),_0x350a11+'-'+_0x16afc8+'/'+_0x58e53a)['json'](_0x456541);}return null;};}function patchUpdates(_0x30df90){return function(_0x2b5448){try{jsonpatch[_0xd3a6('0x29')](_0x2b5448,_0x30df90,!![]);}catch(_0x3f6d35){return BPromise[_0xd3a6('0x2a')](_0x3f6d35);}return _0x2b5448[_0xd3a6('0x2b')]();};}function saveUpdates(_0x5c2186,_0x535bd4){return function(_0x1f4859){if(_0x1f4859){return _0x1f4859[_0xd3a6('0x2c')](_0x5c2186)[_0xd3a6('0x18')](function(_0x1fd9e5){return _0x1fd9e5;});}return null;};}function removeEntity(_0x4c05a2,_0x3de3bb){return function(_0xa4efd){if(_0xa4efd){return _0xa4efd['destroy']()[_0xd3a6('0x18')](function(){_0x4c05a2['status'](0xcc)[_0xd3a6('0x2d')]();});}};}function handleEntityNotFound(_0x7f636e,_0x1eb499){return function(_0x87b75a){if(!_0x87b75a){_0x7f636e[_0xd3a6('0x22')](0x194);}return _0x87b75a;};}function handleError(_0xe27818,_0x2dbc2b){_0x2dbc2b=_0x2dbc2b||0x1f4;return function(_0x5dfa81){logger['error'](_0x5dfa81[_0xd3a6('0x2e')]);if(_0x5dfa81[_0xd3a6('0x2f')]){delete _0x5dfa81[_0xd3a6('0x2f')];}_0xe27818['status'](_0x2dbc2b)[_0xd3a6('0x30')](_0x5dfa81);};}exports[_0xd3a6('0x31')]=function(_0x244651,_0x1603d9){var _0x3ebd0d={},_0x36b28a={},_0x21c23f={'count':0x0,'rows':[]};var _0x10352a=db['Network'][_0xd3a6('0x32')];_0x36b28a[_0xd3a6('0x33')]=_[_0xd3a6('0x34')](_0x10352a);var _0x1f3c48={'dateStart':_0x244651[_0xd3a6('0x35')][_0xd3a6('0x36')],'dateEnd':_0x244651['query'][_0xd3a6('0x37')]};delete _0x244651['query'][_0xd3a6('0x36')];delete _0x244651[_0xd3a6('0x35')][_0xd3a6('0x37')];_0x36b28a[_0xd3a6('0x35')]=_['keys'](_0x244651['query']);_0x36b28a[_0xd3a6('0x38')]=_[_0xd3a6('0x39')](_0x36b28a[_0xd3a6('0x33')],_0x36b28a['query']);_0x3ebd0d[_0xd3a6('0x3a')]=_[_0xd3a6('0x39')](_0x36b28a['model'],qs[_0xd3a6('0x3b')](_0x244651['query'][_0xd3a6('0x3b')]));_0x3ebd0d[_0xd3a6('0x3a')]=_0x3ebd0d['attributes'][_0xd3a6('0x3c')]?_0x3ebd0d['attributes']:_0x36b28a[_0xd3a6('0x33')];if(!_0x244651[_0xd3a6('0x35')]['hasOwnProperty'](_0xd3a6('0x3d'))){_0x3ebd0d[_0xd3a6('0x26')]=qs[_0xd3a6('0x26')](_0x244651[_0xd3a6('0x35')]['limit']);_0x3ebd0d[_0xd3a6('0x25')]=qs[_0xd3a6('0x25')](_0x244651[_0xd3a6('0x35')][_0xd3a6('0x25')]);}_0x3ebd0d[_0xd3a6('0x3e')]=qs['sort'](_0x244651[_0xd3a6('0x35')]['sort']);_0x3ebd0d[_0xd3a6('0x3f')]=qs[_0xd3a6('0x38')](_[_0xd3a6('0x40')](_0x244651['query'],_0x36b28a[_0xd3a6('0x38')]));if(_0x1f3c48['dateStart']){if(_0x1f3c48[_0xd3a6('0x37')]){_0x1f3c48['dateEnd']=moment(_0x1f3c48[_0xd3a6('0x37')])[_0xd3a6('0x41')](0x1,_0xd3a6('0x42'));}else{_0x1f3c48[_0xd3a6('0x37')]=moment(_0x1f3c48[_0xd3a6('0x36')])[_0xd3a6('0x41')](0x1,_0xd3a6('0x42'));}_['merge'](_0x3ebd0d[_0xd3a6('0x3f')],{'createdAt':{'$gte':_0x1f3c48[_0xd3a6('0x36')],'$lte':_0x1f3c48[_0xd3a6('0x37')]}});}if(_0x244651[_0xd3a6('0x35')]['filter']){_0x3ebd0d[_0xd3a6('0x3f')]=_[_0xd3a6('0x43')](_0x3ebd0d[_0xd3a6('0x3f')],{'$or':_[_0xd3a6('0x44')](_0x3ebd0d[_0xd3a6('0x3a')],function(_0x168a68){var _0x3a6531={};_0x3a6531[_0x168a68]={'$like':'%'+_0x244651[_0xd3a6('0x35')]['filter']+'%'};return _0x3a6531;})});}_0x3ebd0d=_[_0xd3a6('0x43')]({},_0x3ebd0d,_0x244651[_0xd3a6('0x45')]);var _0x438dd3={'where':_0x3ebd0d[_0xd3a6('0x3f')]};return db[_0xd3a6('0x46')]['count'](_0x438dd3)[_0xd3a6('0x18')](function(_0x7a7f23){_0x21c23f[_0xd3a6('0x47')]=_0x7a7f23;if(_0x244651[_0xd3a6('0x35')][_0xd3a6('0x48')]){_0x3ebd0d[_0xd3a6('0x49')]=[{'all':!![]}];}return db[_0xd3a6('0x46')][_0xd3a6('0x4a')](_0x3ebd0d);})['then'](function(_0x7828c2){_0x21c23f['rows']=_0x7828c2;return _0x21c23f;})[_0xd3a6('0x18')](respondWithFilteredResult(_0x1603d9,_0x3ebd0d))[_0xd3a6('0x21')](handleError(_0x1603d9,null));};exports['show']=function(_0x1134ac,_0x1ede75){var _0x3cf99a={'raw':!![],'where':{'id':_0x1134ac[_0xd3a6('0x4b')]['id']}},_0x375067={};_0x375067[_0xd3a6('0x33')]=_[_0xd3a6('0x34')](db[_0xd3a6('0x46')][_0xd3a6('0x32')]);_0x375067[_0xd3a6('0x35')]=_['keys'](_0x1134ac[_0xd3a6('0x35')]);_0x375067[_0xd3a6('0x38')]=_[_0xd3a6('0x39')](_0x375067[_0xd3a6('0x33')],_0x375067[_0xd3a6('0x35')]);_0x3cf99a[_0xd3a6('0x3a')]=_[_0xd3a6('0x39')](_0x375067[_0xd3a6('0x33')],qs[_0xd3a6('0x3b')](_0x1134ac[_0xd3a6('0x35')]['fields']));_0x3cf99a[_0xd3a6('0x3a')]=_0x3cf99a[_0xd3a6('0x3a')][_0xd3a6('0x3c')]?_0x3cf99a['attributes']:_0x375067[_0xd3a6('0x33')];if(_0x1134ac['query']['includeAll']){_0x3cf99a['include']=[{'all':!![]}];}_0x3cf99a=_['merge']({},_0x3cf99a,_0x1134ac[_0xd3a6('0x45')]);return db[_0xd3a6('0x46')][_0xd3a6('0x4c')](_0x3cf99a)[_0xd3a6('0x18')](handleEntityNotFound(_0x1ede75,null))[_0xd3a6('0x18')](respondWithResult(_0x1ede75,null))[_0xd3a6('0x21')](handleError(_0x1ede75,null));};exports[_0xd3a6('0x4d')]=function(_0x2a8b59,_0x347e71,_0x1ecb5c){var _0x4c1c41;return db['sequelize'][_0xd3a6('0x4e')](function(_0x14f7b6){return db[_0xd3a6('0x46')][_0xd3a6('0x4d')](_0x2a8b59[_0xd3a6('0x4f')],{'raw':!![]})['then'](function(_0x224483){_0x4c1c41=_0x224483;return db[_0xd3a6('0x46')][_0xd3a6('0x4a')]({'where':{'type':_0x2a8b59[_0xd3a6('0x4f')]['type']},'raw':!![]});})['then'](function(_0x3badf8){var _0x4e8f31=fs['readFileSync'](path[_0xd3a6('0x50')](config[_0xd3a6('0x51')],_0xd3a6('0x52')),'utf8');var _0xfdfcad=ejs[_0xd3a6('0x53')](_0x4e8f31,{'networks':_0x3badf8||[]});fs['writeFileSync'](util[_0xd3a6('0x54')](_0xd3a6('0x55'),_0x2a8b59['body']['type'][_0xd3a6('0x56')]()),_0xfdfcad);})[_0xd3a6('0x18')](function(){return respondWithRpcPromise('Reload','create',{'module':_0xd3a6('0x57')});})['then'](function(){return _0x4c1c41;});})[_0xd3a6('0x18')](respondWithResult(_0x347e71,0xc9))[_0xd3a6('0x21')](handleError(_0x347e71,null));};exports['update']=function(_0x130f5d,_0x4b9a38,_0x59426d){var _0x19bba0;return db['sequelize'][_0xd3a6('0x4e')](function(_0x1140e1){return db[_0xd3a6('0x46')][_0xd3a6('0x4c')]({'where':{'id':_0x130f5d[_0xd3a6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b9a38,null))[_0xd3a6('0x18')](saveUpdates(_0x130f5d[_0xd3a6('0x4f')],null))[_0xd3a6('0x18')](function(_0x42316b){if(_0x42316b){_0x19bba0=_0x42316b;return db['Network'][_0xd3a6('0x4a')]({'where':{'type':_0x19bba0[_0xd3a6('0x58')]},'raw':!![]});}return null;})[_0xd3a6('0x18')](function(_0x2a3432){if(_0x2a3432){var _0x39ba04=fs['readFileSync'](path['join'](config[_0xd3a6('0x51')],'server/files/templates/network.ejs'),_0xd3a6('0x59'));var _0x2a1d67=ejs[_0xd3a6('0x53')](_0x39ba04,{'networks':_0x2a3432||[]});fs[_0xd3a6('0x5a')](util[_0xd3a6('0x54')]('/etc/asterisk/sip_xcally_%s.conf',_0x19bba0['type'][_0xd3a6('0x56')]()),_0x2a1d67);return respondWithRpcPromise('Reload','update',{'module':_0xd3a6('0x57')});}return null;})[_0xd3a6('0x18')](function(_0x476b69){if(_0x476b69){return _0x19bba0;}return null;});})[_0xd3a6('0x18')](respondWithResult(_0x4b9a38,null))[_0xd3a6('0x21')](handleError(_0x4b9a38,null));};exports[_0xd3a6('0x5b')]=function(_0x4d54f4,_0x24cb61,_0x9d70cd){var _0x3f5e21;return db['Network'][_0xd3a6('0x4c')]({'where':{'id':_0x4d54f4[_0xd3a6('0x4b')]['id']}})['then'](function(_0x224b20){_0x3f5e21=_0x224b20;return _0x224b20;})['then'](handleEntityNotFound(_0x24cb61,null))[_0xd3a6('0x18')](removeEntity(_0x24cb61,null))[_0xd3a6('0x18')](function(){if(_0x3f5e21){return db[_0xd3a6('0x46')]['findAll']({'where':{'type':_0x3f5e21[_0xd3a6('0x58')]},'raw':!![]});}})['then'](function(_0x49e826){if(_0x49e826){var _0x3da7c0=fs[_0xd3a6('0x5c')](path['join'](config[_0xd3a6('0x51')],_0xd3a6('0x52')),'utf8');var _0x3327f7=ejs[_0xd3a6('0x53')](_0x3da7c0,{'networks':_0x49e826||[]});fs[_0xd3a6('0x5a')](util[_0xd3a6('0x54')](_0xd3a6('0x55'),_0x3f5e21[_0xd3a6('0x58')]['toLowerCase']()),_0x3327f7);return respondWithRpcPromise('Reload',_0xd3a6('0x5b'),{'module':_0xd3a6('0x57')});}})[_0xd3a6('0x21')](handleError(_0x24cb61,null));}; \ No newline at end of file +var _0xd101=['chan_sip.so','format','destroy','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','status','json','count','offset','limit','set','Content-Range','apply','reject','update','end','sendStatus','name','send','Network','keys','query','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','dateStart','day','add','merge','where','filter','options','includeAll','include','rows','catch','show','params','find','sequelize','transaction','body','findAll','readFileSync','join','root','server/files/templates/network.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','type','toLowerCase','Reload','create'];(function(_0x294084,_0x5a0b9){var _0x38abee=function(_0x586adb){while(--_0x586adb){_0x294084['push'](_0x294084['shift']());}};_0x38abee(++_0x5a0b9);}(_0xd101,0xc1));var _0x1d10=function(_0x402cb1,_0x108082){_0x402cb1=_0x402cb1-0x0;var _0xa0d002=_0xd101[_0x402cb1];return _0xa0d002;};'use strict';var jsonpatch=require(_0x1d10('0x0'));var rp=require('request-promise');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var Mustache=require(_0x1d10('0x3'));var util=require(_0x1d10('0x4'));var path=require(_0x1d10('0x5'));var sox=require(_0x1d10('0x6'));var csv=require(_0x1d10('0x7'));var ejs=require(_0x1d10('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1d10('0x9'));var crypto=require(_0x1d10('0xa'));var jsforce=require(_0x1d10('0xb'));var deskjs=require(_0x1d10('0xc'));var toCsv=require(_0x1d10('0x7'));var querystring=require(_0x1d10('0xd'));var Papa=require(_0x1d10('0xe'));var qs=require(_0x1d10('0xf'));var logger=require(_0x1d10('0x10'))(_0x1d10('0x11'));var utils=require(_0x1d10('0x12'));var config=require(_0x1d10('0x13'));var db=require(_0x1d10('0x14'))['db'];var jayson=require(_0x1d10('0x15'));var client=jayson[_0x1d10('0x16')][_0x1d10('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x450b22,_0x54face,_0x3a2050,_0x93cb59){return new BPromise(function(_0x322bf4,_0x190d4c){var _0x268506=_0x93cb59||client;return _0x268506['request'](_0x450b22,_0x3a2050)[_0x1d10('0x18')](function(_0x1f6f83){logger[_0x1d10('0x19')](_0x1d10('0x1a'),_0x54face,_0x1d10('0x1b'));logger[_0x1d10('0x1c')]('Network,\x20%s,\x20%s,\x20%s',_0x54face,_0x1d10('0x1b'),JSON[_0x1d10('0x1d')](_0x1f6f83));if(_0x1f6f83[_0x1d10('0x1e')]){if(_0x1f6f83[_0x1d10('0x1e')]['code']===0x1f4){logger[_0x1d10('0x1e')](_0x1d10('0x1a'),_0x54face,_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);return _0x190d4c(_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);}logger[_0x1d10('0x1e')]('Network,\x20%s,\x20%s',_0x54face,_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);return _0x322bf4(_0x1f6f83[_0x1d10('0x1e')][_0x1d10('0x1f')]);}else{logger[_0x1d10('0x19')]('Network,\x20%s,\x20%s',_0x54face,'request\x20sent');_0x322bf4(_0x1f6f83[_0x1d10('0x20')]['message']);}})['catch'](function(_0x5774f9){logger[_0x1d10('0x1e')](_0x1d10('0x1a'),_0x54face,_0x5774f9);_0x190d4c(_0x5774f9);});});}function respondWithStatusCode(_0x24717c,_0x250395){_0x250395=_0x250395||0xcc;return function(_0x4ce84a){if(_0x4ce84a){return _0x24717c['sendStatus'](_0x250395);}return _0x24717c[_0x1d10('0x21')](_0x250395)['end']();};}function respondWithResult(_0x68b09,_0x474321){_0x474321=_0x474321||0xc8;return function(_0x160802){if(_0x160802){return _0x68b09[_0x1d10('0x21')](_0x474321)[_0x1d10('0x22')](_0x160802);}};}function respondWithFilteredResult(_0x3601ba,_0x2305c8){return function(_0x3af06d){if(_0x3af06d){var _0x4168e=_0x3af06d[_0x1d10('0x23')],_0x84055f=_0x2305c8[_0x1d10('0x24')],_0xf1e4c8=_0x2305c8[_0x1d10('0x24')]+_0x2305c8[_0x1d10('0x25')],_0x5abc58;if(_0xf1e4c8>=_0x4168e){_0xf1e4c8=_0x4168e;_0x5abc58=0xc8;}else{_0x5abc58=0xce;}_0x3601ba[_0x1d10('0x21')](_0x5abc58);return _0x3601ba[_0x1d10('0x26')](_0x1d10('0x27'),_0x84055f+'-'+_0xf1e4c8+'/'+_0x4168e)[_0x1d10('0x22')](_0x3af06d);}return null;};}function patchUpdates(_0x4f7837){return function(_0x355e10){try{jsonpatch[_0x1d10('0x28')](_0x355e10,_0x4f7837,!![]);}catch(_0x59b5eb){return BPromise[_0x1d10('0x29')](_0x59b5eb);}return _0x355e10['save']();};}function saveUpdates(_0x4db221,_0x41b5b8){return function(_0x597aea){if(_0x597aea){return _0x597aea[_0x1d10('0x2a')](_0x4db221)[_0x1d10('0x18')](function(_0x453737){return _0x453737;});}return null;};}function removeEntity(_0x15fdac,_0x1a43fd){return function(_0x9c6cb9){if(_0x9c6cb9){return _0x9c6cb9['destroy']()['then'](function(){_0x15fdac[_0x1d10('0x21')](0xcc)[_0x1d10('0x2b')]();});}};}function handleEntityNotFound(_0x96756b,_0x2e870f){return function(_0xe89535){if(!_0xe89535){_0x96756b[_0x1d10('0x2c')](0x194);}return _0xe89535;};}function handleError(_0x2c9c59,_0x1c6cad){_0x1c6cad=_0x1c6cad||0x1f4;return function(_0x8f4818){logger[_0x1d10('0x1e')](_0x8f4818['stack']);if(_0x8f4818[_0x1d10('0x2d')]){delete _0x8f4818['name'];}_0x2c9c59[_0x1d10('0x21')](_0x1c6cad)[_0x1d10('0x2e')](_0x8f4818);};}exports['index']=function(_0x339bb2,_0x47cd79){var _0x336f4f={},_0x2d4121={},_0x32ada3={'count':0x0,'rows':[]};var _0x2f8530=db[_0x1d10('0x2f')]['rawAttributes'];_0x2d4121['model']=_[_0x1d10('0x30')](_0x2f8530);var _0x1e3a6b={'dateStart':_0x339bb2[_0x1d10('0x31')]['dateStart'],'dateEnd':_0x339bb2['query']['dateEnd']};delete _0x339bb2[_0x1d10('0x31')]['dateStart'];delete _0x339bb2[_0x1d10('0x31')][_0x1d10('0x32')];_0x2d4121[_0x1d10('0x31')]=_[_0x1d10('0x30')](_0x339bb2['query']);_0x2d4121['filters']=_[_0x1d10('0x33')](_0x2d4121[_0x1d10('0x34')],_0x2d4121[_0x1d10('0x31')]);_0x336f4f[_0x1d10('0x35')]=_['intersection'](_0x2d4121[_0x1d10('0x34')],qs['fields'](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x36')]));_0x336f4f[_0x1d10('0x35')]=_0x336f4f[_0x1d10('0x35')][_0x1d10('0x37')]?_0x336f4f[_0x1d10('0x35')]:_0x2d4121[_0x1d10('0x34')];if(!_0x339bb2[_0x1d10('0x31')][_0x1d10('0x38')](_0x1d10('0x39'))){_0x336f4f[_0x1d10('0x25')]=qs[_0x1d10('0x25')](_0x339bb2[_0x1d10('0x31')]['limit']);_0x336f4f['offset']=qs[_0x1d10('0x24')](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x24')]);}_0x336f4f[_0x1d10('0x3a')]=qs[_0x1d10('0x3b')](_0x339bb2[_0x1d10('0x31')][_0x1d10('0x3b')]);_0x336f4f['where']=qs[_0x1d10('0x3c')](_[_0x1d10('0x3d')](_0x339bb2[_0x1d10('0x31')],_0x2d4121['filters']));if(_0x1e3a6b[_0x1d10('0x3e')]){if(_0x1e3a6b[_0x1d10('0x32')]){_0x1e3a6b[_0x1d10('0x32')]=moment(_0x1e3a6b['dateEnd'])['add'](0x1,_0x1d10('0x3f'));}else{_0x1e3a6b[_0x1d10('0x32')]=moment(_0x1e3a6b[_0x1d10('0x3e')])[_0x1d10('0x40')](0x1,_0x1d10('0x3f'));}_[_0x1d10('0x41')](_0x336f4f[_0x1d10('0x42')],{'createdAt':{'$gte':_0x1e3a6b['dateStart'],'$lte':_0x1e3a6b[_0x1d10('0x32')]}});}if(_0x339bb2[_0x1d10('0x31')]['filter']){_0x336f4f[_0x1d10('0x42')]=_['merge'](_0x336f4f[_0x1d10('0x42')],{'$or':_['map'](_0x336f4f['attributes'],function(_0x11f446){var _0x3183b4={};_0x3183b4[_0x11f446]={'$like':'%'+_0x339bb2[_0x1d10('0x31')][_0x1d10('0x43')]+'%'};return _0x3183b4;})});}_0x336f4f=_[_0x1d10('0x41')]({},_0x336f4f,_0x339bb2[_0x1d10('0x44')]);var _0x4490a5={'where':_0x336f4f[_0x1d10('0x42')]};return db[_0x1d10('0x2f')]['count'](_0x4490a5)['then'](function(_0x1ce4e9){_0x32ada3[_0x1d10('0x23')]=_0x1ce4e9;if(_0x339bb2[_0x1d10('0x31')][_0x1d10('0x45')]){_0x336f4f[_0x1d10('0x46')]=[{'all':!![]}];}return db[_0x1d10('0x2f')]['findAll'](_0x336f4f);})[_0x1d10('0x18')](function(_0x1b8513){_0x32ada3[_0x1d10('0x47')]=_0x1b8513;return _0x32ada3;})[_0x1d10('0x18')](respondWithFilteredResult(_0x47cd79,_0x336f4f))[_0x1d10('0x48')](handleError(_0x47cd79,null));};exports[_0x1d10('0x49')]=function(_0x8226b4,_0x2c036e){var _0x39bf64={'raw':!![],'where':{'id':_0x8226b4[_0x1d10('0x4a')]['id']}},_0x32a9a9={};_0x32a9a9[_0x1d10('0x34')]=_[_0x1d10('0x30')](db[_0x1d10('0x2f')]['rawAttributes']);_0x32a9a9['query']=_[_0x1d10('0x30')](_0x8226b4['query']);_0x32a9a9['filters']=_[_0x1d10('0x33')](_0x32a9a9[_0x1d10('0x34')],_0x32a9a9[_0x1d10('0x31')]);_0x39bf64[_0x1d10('0x35')]=_[_0x1d10('0x33')](_0x32a9a9['model'],qs['fields'](_0x8226b4['query']['fields']));_0x39bf64[_0x1d10('0x35')]=_0x39bf64[_0x1d10('0x35')][_0x1d10('0x37')]?_0x39bf64[_0x1d10('0x35')]:_0x32a9a9['model'];if(_0x8226b4[_0x1d10('0x31')][_0x1d10('0x45')]){_0x39bf64[_0x1d10('0x46')]=[{'all':!![]}];}_0x39bf64=_['merge']({},_0x39bf64,_0x8226b4[_0x1d10('0x44')]);return db['Network'][_0x1d10('0x4b')](_0x39bf64)[_0x1d10('0x18')](handleEntityNotFound(_0x2c036e,null))[_0x1d10('0x18')](respondWithResult(_0x2c036e,null))[_0x1d10('0x48')](handleError(_0x2c036e,null));};exports['create']=function(_0x27f665,_0x10d724,_0xcf775){var _0x46dc9a;return db[_0x1d10('0x4c')][_0x1d10('0x4d')](function(_0x50910c){return db[_0x1d10('0x2f')]['create'](_0x27f665[_0x1d10('0x4e')],{'raw':!![]})['then'](function(_0x387291){_0x46dc9a=_0x387291;return db[_0x1d10('0x2f')][_0x1d10('0x4f')]({'where':{'type':_0x27f665[_0x1d10('0x4e')]['type']},'raw':!![]});})[_0x1d10('0x18')](function(_0x88812c){var _0x2c9fb0=fs[_0x1d10('0x50')](path[_0x1d10('0x51')](config[_0x1d10('0x52')],_0x1d10('0x53')),_0x1d10('0x54'));var _0x3f41f2=ejs[_0x1d10('0x55')](_0x2c9fb0,{'networks':_0x88812c||[]});fs[_0x1d10('0x56')](util['format'](_0x1d10('0x57'),_0x27f665['body'][_0x1d10('0x58')][_0x1d10('0x59')]()),_0x3f41f2);})[_0x1d10('0x18')](function(){return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x5b'),{'module':_0x1d10('0x5c')});})[_0x1d10('0x18')](function(){return _0x46dc9a;});})[_0x1d10('0x18')](respondWithResult(_0x10d724,0xc9))[_0x1d10('0x48')](handleError(_0x10d724,null));};exports[_0x1d10('0x2a')]=function(_0x440028,_0x471d5c,_0x7ad59f){var _0x223c3c;return db[_0x1d10('0x4c')]['transaction'](function(_0xdf0879){return db[_0x1d10('0x2f')][_0x1d10('0x4b')]({'where':{'id':_0x440028['params']['id']}})[_0x1d10('0x18')](handleEntityNotFound(_0x471d5c,null))[_0x1d10('0x18')](saveUpdates(_0x440028[_0x1d10('0x4e')],null))[_0x1d10('0x18')](function(_0x27a29c){if(_0x27a29c){_0x223c3c=_0x27a29c;return db[_0x1d10('0x2f')][_0x1d10('0x4f')]({'where':{'type':_0x223c3c[_0x1d10('0x58')]},'raw':!![]});}return null;})[_0x1d10('0x18')](function(_0x57e582){if(_0x57e582){var _0x426397=fs[_0x1d10('0x50')](path[_0x1d10('0x51')](config[_0x1d10('0x52')],_0x1d10('0x53')),_0x1d10('0x54'));var _0x7c500c=ejs['render'](_0x426397,{'networks':_0x57e582||[]});fs[_0x1d10('0x56')](util['format'](_0x1d10('0x57'),_0x223c3c[_0x1d10('0x58')][_0x1d10('0x59')]()),_0x7c500c);return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x2a'),{'module':_0x1d10('0x5c')});}return null;})[_0x1d10('0x18')](function(_0x4dded6){if(_0x4dded6){return _0x223c3c;}return null;});})['then'](respondWithResult(_0x471d5c,null))[_0x1d10('0x48')](handleError(_0x471d5c,null));};exports['destroy']=function(_0xcc062d,_0x3da7d0,_0x2e9db3){var _0x1a2efd;return db['Network'][_0x1d10('0x4b')]({'where':{'id':_0xcc062d['params']['id']}})[_0x1d10('0x18')](function(_0x4745ee){_0x1a2efd=_0x4745ee;return _0x4745ee;})[_0x1d10('0x18')](handleEntityNotFound(_0x3da7d0,null))[_0x1d10('0x18')](removeEntity(_0x3da7d0,null))['then'](function(){if(_0x1a2efd){return db['Network']['findAll']({'where':{'type':_0x1a2efd['type']},'raw':!![]});}})[_0x1d10('0x18')](function(_0x37de2a){if(_0x37de2a){var _0x527e0b=fs['readFileSync'](path['join'](config[_0x1d10('0x52')],'server/files/templates/network.ejs'),_0x1d10('0x54'));var _0xd41420=ejs['render'](_0x527e0b,{'networks':_0x37de2a||[]});fs[_0x1d10('0x56')](util[_0x1d10('0x5d')](_0x1d10('0x57'),_0x1a2efd[_0x1d10('0x58')][_0x1d10('0x59')]()),_0xd41420);return respondWithRpcPromise(_0x1d10('0x5a'),_0x1d10('0x5e'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x3da7d0,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index a1c0312..c8a3097 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 _0x3ba8=['api','bluebird','request-promise','./network.attributes','exports','Network','network','lodash','util','../../config/logger'];(function(_0x457ef8,_0x1a19ae){var _0x596c56=function(_0x3b3b8f){while(--_0x3b3b8f){_0x457ef8['push'](_0x457ef8['shift']());}};_0x596c56(++_0x1a19ae);}(_0x3ba8,0x6b));var _0x83ba=function(_0x6fc664,_0x1a1c9c){_0x6fc664=_0x6fc664-0x0;var _0x508b0e=_0x3ba8[_0x6fc664];return _0x508b0e;};'use strict';var _=require(_0x83ba('0x0'));var util=require(_0x83ba('0x1'));var logger=require(_0x83ba('0x2'))(_0x83ba('0x3'));var moment=require('moment');var BPromise=require(_0x83ba('0x4'));var rp=require(_0x83ba('0x5'));var attributes=require(_0x83ba('0x6'));module[_0x83ba('0x7')]=function(_0x5a6634,_0x146d1a){return _0x5a6634['define'](_0x83ba('0x8'),attributes,{'tableName':_0x83ba('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdcfb=['api','moment','bluebird','exports','define','network'];(function(_0x349e84,_0x50a497){var _0x51df08=function(_0x2b2f8e){while(--_0x2b2f8e){_0x349e84['push'](_0x349e84['shift']());}};_0x51df08(++_0x50a497);}(_0xdcfb,0x1b6));var _0xbdcf=function(_0x4659b5,_0xd07142){_0x4659b5=_0x4659b5-0x0;var _0x2cd685=_0xdcfb[_0x4659b5];return _0x2cd685;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xbdcf('0x0'));var moment=require(_0xbdcf('0x1'));var BPromise=require(_0xbdcf('0x2'));var rp=require('request-promise');var attributes=require('./network.attributes');module[_0xbdcf('0x3')]=function(_0x11aec2,_0x298417){return _0x11aec2[_0xbdcf('0x4')]('Network',attributes,{'tableName':_0xbdcf('0x5'),'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 319d91a..5ec7a8f 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 _0xd791=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd791,0x1d4));var _0x1d79=function(_0xb22e94,_0xc843c6){_0xb22e94=_0xb22e94-0x0;var _0xcaada6=_0xd791[_0xb22e94];return _0xcaada6;};'use strict';var _=require(_0x1d79('0x0'));var util=require(_0x1d79('0x1'));var moment=require(_0x1d79('0x2'));var BPromise=require('bluebird');var rs=require(_0x1d79('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1d79('0x4'))(_0x1d79('0x5'));var config=require(_0x1d79('0x6'));var jayson=require(_0x1d79('0x7'));var client=jayson[_0x1d79('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e4268,_0x1c6a54,_0x40a727){return new BPromise(function(_0x296ff6,_0x55ddf5){return client[_0x1d79('0x9')](_0x3e4268,_0x40a727)['then'](function(_0x431405){logger[_0x1d79('0xa')](_0x1d79('0xb'),_0x1c6a54,_0x1d79('0xc'));logger[_0x1d79('0xd')](_0x1d79('0xe'),_0x1c6a54,_0x1d79('0xc'),JSON[_0x1d79('0xf')](_0x431405));if(_0x431405[_0x1d79('0x10')]){if(_0x431405[_0x1d79('0x10')][_0x1d79('0x11')]===0x1f4){logger['error'](_0x1d79('0xb'),_0x1c6a54,_0x431405[_0x1d79('0x10')]['message']);return _0x55ddf5(_0x431405[_0x1d79('0x10')]['message']);}logger[_0x1d79('0x10')](_0x1d79('0xb'),_0x1c6a54,_0x431405[_0x1d79('0x10')][_0x1d79('0x12')]);return _0x296ff6(_0x431405[_0x1d79('0x10')]['message']);}else{logger[_0x1d79('0xa')](_0x1d79('0xb'),_0x1c6a54,_0x1d79('0xc'));_0x296ff6(_0x431405[_0x1d79('0x13')][_0x1d79('0x12')]);}})[_0x1d79('0x14')](function(_0x242565){logger[_0x1d79('0x10')](_0x1d79('0xb'),_0x1c6a54,_0x242565);_0x55ddf5(_0x242565);});});} \ No newline at end of file +var _0xa581=['Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info'];(function(_0x291c2d,_0x4b4a9d){var _0x422f9d=function(_0x34d166){while(--_0x34d166){_0x291c2d['push'](_0x291c2d['shift']());}};_0x422f9d(++_0x4b4a9d);}(_0xa581,0x171));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x1a58('0x0'));var moment=require(_0x1a58('0x1'));var BPromise=require(_0x1a58('0x2'));var rs=require(_0x1a58('0x3'));var fs=require('fs');var db=require(_0x1a58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1a58('0x5'))(_0x1a58('0x6'));var config=require(_0x1a58('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1a58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1120c9,_0x43f0a4,_0x15fcfc){return new BPromise(function(_0x37cef7,_0x5d122c){return client['request'](_0x1120c9,_0x15fcfc)[_0x1a58('0x9')](function(_0x4b8672){logger[_0x1a58('0xa')](_0x1a58('0xb'),_0x43f0a4,_0x1a58('0xc'));logger[_0x1a58('0xd')](_0x1a58('0xe'),_0x43f0a4,_0x1a58('0xc'),JSON[_0x1a58('0xf')](_0x4b8672));if(_0x4b8672[_0x1a58('0x10')]){if(_0x4b8672[_0x1a58('0x10')][_0x1a58('0x11')]===0x1f4){logger['error'](_0x1a58('0xb'),_0x43f0a4,_0x4b8672[_0x1a58('0x10')][_0x1a58('0x12')]);return _0x5d122c(_0x4b8672[_0x1a58('0x10')]['message']);}logger[_0x1a58('0x10')](_0x1a58('0xb'),_0x43f0a4,_0x4b8672['error'][_0x1a58('0x12')]);return _0x37cef7(_0x4b8672['error'][_0x1a58('0x12')]);}else{logger['info'](_0x1a58('0xb'),_0x43f0a4,_0x1a58('0xc'));_0x37cef7(_0x4b8672[_0x1a58('0x13')][_0x1a58('0x12')]);}})['catch'](function(_0x1e9f4e){logger[_0x1a58('0x10')](_0x1a58('0xb'),_0x43f0a4,_0x1e9f4e);_0x5d122c(_0x1e9f4e);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 8820134..ea23e46 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 _0xc519=['addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','addAnswer'];(function(_0x44669d,_0xa186ec){var _0x48b9d5=function(_0x562a29){while(--_0x562a29){_0x44669d['push'](_0x44669d['shift']());}};_0x48b9d5(++_0xa186ec);}(_0xc519,0xbf));var _0x9c51=function(_0x4f096e,_0x30d3c3){_0x4f096e=_0x4f096e-0x0;var _0x4a33ce=_0xc519[_0x4f096e];return _0x4a33ce;};'use strict';var multer=require(_0x9c51('0x0'));var util=require(_0x9c51('0x1'));var path=require(_0x9c51('0x2'));var express=require(_0x9c51('0x3'));var router=express[_0x9c51('0x4')]();var auth=require(_0x9c51('0x5'));var interaction=require(_0x9c51('0x6'));var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x9c51('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9c51('0x8')]);router[_0x9c51('0x7')](_0x9c51('0x9'),auth[_0x9c51('0xa')](),controller[_0x9c51('0xb')]);router[_0x9c51('0x7')](_0x9c51('0xc'),auth[_0x9c51('0xa')](),controller[_0x9c51('0xd')]);router[_0x9c51('0x7')](_0x9c51('0xe'),auth[_0x9c51('0xa')](),controller[_0x9c51('0xf')]);router[_0x9c51('0x7')](_0x9c51('0x10'),auth[_0x9c51('0xa')](),controller['getApplications']);router[_0x9c51('0x7')](_0x9c51('0x11'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x12')]);router['get'](_0x9c51('0x13'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x14')]);router['post']('/',auth[_0x9c51('0xa')](),controller[_0x9c51('0x15')]);router[_0x9c51('0x16')](_0x9c51('0xc'),auth['isAuthenticated'](),controller[_0x9c51('0x17')]);router['post'](_0x9c51('0xe'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x18')]);router['post']('/:id/notify',controller['notify']);router[_0x9c51('0x16')](_0x9c51('0x10'),auth['isAuthenticated'](),controller['addApplications']);router[_0x9c51('0x16')](_0x9c51('0x13'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x19')]);router['post'](_0x9c51('0x1a'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x1b')]);router[_0x9c51('0x1c')](_0x9c51('0x9'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x1d')]);router[_0x9c51('0x1e')](_0x9c51('0x9'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x1f')]);router['delete'](_0x9c51('0xc'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x20')]);router[_0x9c51('0x1e')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9c51('0x21')]);router[_0x9c51('0x1e')](_0x9c51('0x13'),auth[_0x9c51('0xa')](),controller[_0x9c51('0x22')]);module[_0x9c51('0x23')]=router; \ No newline at end of file +var _0xe309=['update','delete','destroy','removeDispositions','removeAgents','multer','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getInteractions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','addApplications','/:id/users','addAgents','send'];(function(_0x53d172,_0x46611b){var _0x1bd0a2=function(_0x19fb52){while(--_0x19fb52){_0x53d172['push'](_0x53d172['shift']());}};_0x1bd0a2(++_0x46611b);}(_0xe309,0x1f4));var _0x9e30=function(_0x2fbe6a,_0x327090){_0x2fbe6a=_0x2fbe6a-0x0;var _0x3ce1c1=_0xe309[_0x2fbe6a];return _0x3ce1c1;};'use strict';var multer=require(_0x9e30('0x0'));var util=require('util');var path=require(_0x9e30('0x1'));var express=require('express');var router=express[_0x9e30('0x2')]();var auth=require(_0x9e30('0x3'));var interaction=require(_0x9e30('0x4'));var config=require(_0x9e30('0x5'));var controller=require('./openchannelAccount.controller');router[_0x9e30('0x6')]('/',auth[_0x9e30('0x7')](),controller[_0x9e30('0x8')]);router[_0x9e30('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x9e30('0x9')]);router[_0x9e30('0x6')](_0x9e30('0xa'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xb')]);router[_0x9e30('0x6')](_0x9e30('0xc'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xd')]);router[_0x9e30('0x6')](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller[_0x9e30('0xf')]);router[_0x9e30('0x6')](_0x9e30('0x10'),auth[_0x9e30('0x7')](),controller['getApplications']);router['get']('/:id/interactions',auth[_0x9e30('0x7')](),controller[_0x9e30('0x11')]);router[_0x9e30('0x6')]('/:id/users',auth[_0x9e30('0x7')](),controller[_0x9e30('0x12')]);router[_0x9e30('0x13')]('/',auth[_0x9e30('0x7')](),controller[_0x9e30('0x14')]);router[_0x9e30('0x13')](_0x9e30('0xc'),auth['isAuthenticated'](),controller[_0x9e30('0x15')]);router[_0x9e30('0x13')](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x16')]);router[_0x9e30('0x13')](_0x9e30('0x17'),controller['notify']);router[_0x9e30('0x13')](_0x9e30('0x10'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x18')]);router['post'](_0x9e30('0x19'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x1a')]);router[_0x9e30('0x13')]('/:id/send',auth[_0x9e30('0x7')](),controller[_0x9e30('0x1b')]);router['put'](_0x9e30('0xa'),auth['isAuthenticated'](),controller[_0x9e30('0x1c')]);router[_0x9e30('0x1d')]('/:id',auth[_0x9e30('0x7')](),controller[_0x9e30('0x1e')]);router['delete'](_0x9e30('0xc'),auth[_0x9e30('0x7')](),controller[_0x9e30('0x1f')]);router['delete'](_0x9e30('0xe'),auth[_0x9e30('0x7')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x9e30('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index dd5359a..50cd1a6 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 _0x55ca=['sequelize','randomstring','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2714a3,_0x534d98){var _0x5ab3a4=function(_0x1f1cca){while(--_0x1f1cca){_0x2714a3['push'](_0x2714a3['shift']());}};_0x5ab3a4(++_0x534d98);}(_0x55ca,0x126));var _0xa55c=function(_0x8b1a5e,_0x2744eb){_0x8b1a5e=_0x8b1a5e-0x0;var _0x1146b1=_0x55ca[_0x8b1a5e];return _0x1146b1;};'use strict';var Sequelize=require(_0xa55c('0x0'));var rs=require(_0xa55c('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa55c('0x2')]},'token':{'type':Sequelize[_0xa55c('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xa55c('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa55c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa55c('0x3')],'defaultValue':function(){return _0xa55c('0x4');}},'notificationSound':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xa55c('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa55c('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x3e74=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','sequelize','exports','STRING','name','generate'];(function(_0x38312b,_0xbddfbc){var _0x3df78a=function(_0x179424){while(--_0x179424){_0x38312b['push'](_0x38312b['shift']());}};_0x3df78a(++_0xbddfbc);}(_0x3e74,0x175));var _0x43e7=function(_0x360d39,_0x23b57b){_0x360d39=_0x360d39-0x0;var _0x106998=_0x3e74[_0x360d39];return _0x106998;};'use strict';var Sequelize=require(_0x43e7('0x0'));var rs=require('randomstring');module[_0x43e7('0x1')]={'name':{'type':Sequelize[_0x43e7('0x2')],'unique':_0x43e7('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x43e7('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x43e7('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x43e7('0x5')],'defaultValue':function(){return _0x43e7('0x6');}},'notificationSound':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x43e7('0x2')]},'queueTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x43e7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x43e7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x43e7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 8e0d61f..e1f2b70 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 _0xe820=['close','unmanaged','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','findAndCountAll','getApplications','getInteractions','OpenchannelAccountId','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','DESC','user','out','Messages','dataValues','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./openchannelAccount.socket','register','jayson/promise','client','http','then','request\x20sent','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','save','destroy','stack','name','send','index','OpenchannelAccount','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','order','sort','where','add','day','merge','filter','map','options','count','includeAll','rows','show','params','keys','include','find','create','body','describe','addDisposition','Disposition','getDispositions','findOne','hasOwnProperty','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','OpenchannelApplication','Applications','List','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','lastName','OpenchannelInteraction','threadId','externalUrl','ContactId','spread','update','interaction','get','autoclose','push'];(function(_0x21ccba,_0x24f36a){var _0x2f2283=function(_0x29f307){while(--_0x29f307){_0x21ccba['push'](_0x21ccba['shift']());}};_0x2f2283(++_0x24f36a);}(_0xe820,0xd2));var _0x0e82=function(_0x2ffddc,_0x20c914){_0x2ffddc=_0x2ffddc-0x0;var _0x356ba6=_0xe820[_0x2ffddc];return _0x356ba6;};'use strict';var jsonpatch=require(_0x0e82('0x0'));var rp=require('request-promise');var moment=require(_0x0e82('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0e82('0x2'));var path=require(_0x0e82('0x3'));var sox=require(_0x0e82('0x4'));var csv=require('to-csv');var ejs=require(_0x0e82('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0e82('0x6'));var crypto=require(_0x0e82('0x7'));var jsforce=require(_0x0e82('0x8'));var deskjs=require(_0x0e82('0x9'));var toCsv=require(_0x0e82('0xa'));var querystring=require('querystring');var Papa=require(_0x0e82('0xb'));var qs=require(_0x0e82('0xc'));var logger=require(_0x0e82('0xd'))(_0x0e82('0xe'));var utils=require(_0x0e82('0xf'));var config=require('../../config/environment');var db=require(_0x0e82('0x10'))['db'];var socket=require(_0x0e82('0x11'))({'host':_0x0e82('0x12'),'port':0x18eb});require(_0x0e82('0x13'))[_0x0e82('0x14')](socket);var jayson=require(_0x0e82('0x15'));var client=jayson[_0x0e82('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x0e82('0x16')][_0x0e82('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x21c40b,_0x1da28a,_0x166dc2,_0x1f44d2){return new BPromise(function(_0x47b0ff,_0x49751){var _0x5c161c=_0x1f44d2||client;return _0x5c161c['request'](_0x21c40b,_0x166dc2)[_0x0e82('0x18')](function(_0x4b748a){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x1da28a,_0x0e82('0x19'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x1da28a,_0x0e82('0x19'),JSON['stringify'](_0x4b748a));if(_0x4b748a[_0x0e82('0x1a')]){if(_0x4b748a[_0x0e82('0x1a')][_0x0e82('0x1b')]===0x1f4){logger[_0x0e82('0x1a')]('OpenchannelAccount,\x20%s,\x20%s',_0x1da28a,_0x4b748a[_0x0e82('0x1a')][_0x0e82('0x1c')]);return _0x49751(_0x4b748a[_0x0e82('0x1a')][_0x0e82('0x1c')]);}logger[_0x0e82('0x1a')](_0x0e82('0x1d'),_0x1da28a,_0x4b748a[_0x0e82('0x1a')][_0x0e82('0x1c')]);return _0x47b0ff(_0x4b748a[_0x0e82('0x1a')][_0x0e82('0x1c')]);}else{logger[_0x0e82('0x1e')]('OpenchannelAccount,\x20%s,\x20%s',_0x1da28a,'request\x20sent');_0x47b0ff(_0x4b748a[_0x0e82('0x1f')][_0x0e82('0x1c')]);}})[_0x0e82('0x20')](function(_0xb0a31){logger[_0x0e82('0x1a')](_0x0e82('0x1d'),_0x1da28a,_0xb0a31);_0x49751(_0xb0a31);});});}function respondWithStatusCode(_0x39fcbe,_0x2688f9){_0x2688f9=_0x2688f9||0xcc;return function(_0x56b3ad){if(_0x56b3ad){return _0x39fcbe[_0x0e82('0x21')](_0x2688f9);}return _0x39fcbe[_0x0e82('0x22')](_0x2688f9)[_0x0e82('0x23')]();};}function respondWithResult(_0x24f883,_0x507f08){_0x507f08=_0x507f08||0xc8;return function(_0xee85dd){if(_0xee85dd){return _0x24f883[_0x0e82('0x22')](_0x507f08)[_0x0e82('0x24')](_0xee85dd);}};}function respondWithFilteredResult(_0x16e11c,_0x4900d3){return function(_0x1ef751){if(_0x1ef751){var _0x51dbcd=_0x1ef751['count'],_0x595319=_0x4900d3[_0x0e82('0x25')],_0x384f88=_0x4900d3[_0x0e82('0x25')]+_0x4900d3[_0x0e82('0x26')],_0x168dbe;if(_0x384f88>=_0x51dbcd){_0x384f88=_0x51dbcd;_0x168dbe=0xc8;}else{_0x168dbe=0xce;}_0x16e11c['status'](_0x168dbe);return _0x16e11c[_0x0e82('0x27')](_0x0e82('0x28'),_0x595319+'-'+_0x384f88+'/'+_0x51dbcd)['json'](_0x1ef751);}return null;};}function patchUpdates(_0xabc536){return function(_0x59a5b6){try{jsonpatch[_0x0e82('0x29')](_0x59a5b6,_0xabc536,!![]);}catch(_0x3ec302){return BPromise['reject'](_0x3ec302);}return _0x59a5b6[_0x0e82('0x2a')]();};}function saveUpdates(_0x268af5,_0x661718){return function(_0x4d74d0){if(_0x4d74d0){return _0x4d74d0['update'](_0x268af5)[_0x0e82('0x18')](function(_0x4a8c43){return _0x4a8c43;});}return null;};}function removeEntity(_0x11211a,_0x581fe3){return function(_0x1a3b2e){if(_0x1a3b2e){return _0x1a3b2e[_0x0e82('0x2b')]()[_0x0e82('0x18')](function(){_0x11211a['status'](0xcc)[_0x0e82('0x23')]();});}};}function handleEntityNotFound(_0x59d2f8,_0x3bf19c){return function(_0x2228a1){if(!_0x2228a1){_0x59d2f8[_0x0e82('0x21')](0x194);}return _0x2228a1;};}function handleError(_0x30c993,_0x44eefb){_0x44eefb=_0x44eefb||0x1f4;return function(_0x53ce82){logger['error'](_0x53ce82[_0x0e82('0x2c')]);if(_0x53ce82[_0x0e82('0x2d')]){delete _0x53ce82[_0x0e82('0x2d')];}_0x30c993[_0x0e82('0x22')](_0x44eefb)[_0x0e82('0x2e')](_0x53ce82);};}exports[_0x0e82('0x2f')]=function(_0x399f16,_0x4bf80){var _0xfd7924={},_0x193d03={},_0x3ac1a5={'count':0x0,'rows':[]};var _0x1a77a3=db[_0x0e82('0x30')][_0x0e82('0x31')];_0x193d03[_0x0e82('0x32')]=_['keys'](_0x1a77a3);var _0x18643f={'dateStart':_0x399f16[_0x0e82('0x33')][_0x0e82('0x34')],'dateEnd':_0x399f16[_0x0e82('0x33')]['dateEnd']};delete _0x399f16[_0x0e82('0x33')][_0x0e82('0x34')];delete _0x399f16['query'][_0x0e82('0x35')];_0x193d03['query']=_['keys'](_0x399f16[_0x0e82('0x33')]);_0x193d03[_0x0e82('0x36')]=_[_0x0e82('0x37')](_0x193d03[_0x0e82('0x32')],_0x193d03[_0x0e82('0x33')]);_0xfd7924[_0x0e82('0x38')]=_[_0x0e82('0x37')](_0x193d03['model'],qs['fields'](_0x399f16[_0x0e82('0x33')][_0x0e82('0x39')]));_0xfd7924[_0x0e82('0x38')]=_0xfd7924[_0x0e82('0x38')][_0x0e82('0x3a')]?_0xfd7924[_0x0e82('0x38')]:_0x193d03[_0x0e82('0x32')];if(!_0x399f16[_0x0e82('0x33')]['hasOwnProperty'](_0x0e82('0x3b'))){_0xfd7924[_0x0e82('0x26')]=qs[_0x0e82('0x26')](_0x399f16[_0x0e82('0x33')][_0x0e82('0x26')]);_0xfd7924[_0x0e82('0x25')]=qs[_0x0e82('0x25')](_0x399f16['query'][_0x0e82('0x25')]);}_0xfd7924[_0x0e82('0x3c')]=qs[_0x0e82('0x3d')](_0x399f16[_0x0e82('0x33')][_0x0e82('0x3d')]);_0xfd7924[_0x0e82('0x3e')]=qs[_0x0e82('0x36')](_['pick'](_0x399f16['query'],_0x193d03['filters']));if(_0x18643f['dateStart']){if(_0x18643f['dateEnd']){_0x18643f['dateEnd']=moment(_0x18643f[_0x0e82('0x35')])[_0x0e82('0x3f')](0x1,_0x0e82('0x40'));}else{_0x18643f[_0x0e82('0x35')]=moment(_0x18643f[_0x0e82('0x34')])[_0x0e82('0x3f')](0x1,_0x0e82('0x40'));}_[_0x0e82('0x41')](_0xfd7924['where'],{'createdAt':{'$gte':_0x18643f['dateStart'],'$lte':_0x18643f[_0x0e82('0x35')]}});}if(_0x399f16[_0x0e82('0x33')][_0x0e82('0x42')]){_0xfd7924[_0x0e82('0x3e')]=_[_0x0e82('0x41')](_0xfd7924[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0xfd7924[_0x0e82('0x38')],function(_0x51b409){var _0x1841a7={};_0x1841a7[_0x51b409]={'$like':'%'+_0x399f16['query'][_0x0e82('0x42')]+'%'};return _0x1841a7;})});}_0xfd7924=_['merge']({},_0xfd7924,_0x399f16[_0x0e82('0x44')]);var _0x4fd25d={'where':_0xfd7924[_0x0e82('0x3e')]};return db[_0x0e82('0x30')][_0x0e82('0x45')](_0x4fd25d)['then'](function(_0x59ee6d){_0x3ac1a5[_0x0e82('0x45')]=_0x59ee6d;if(_0x399f16[_0x0e82('0x33')][_0x0e82('0x46')]){_0xfd7924['include']=[{'all':!![]}];}return db[_0x0e82('0x30')]['findAll'](_0xfd7924);})[_0x0e82('0x18')](function(_0x414745){_0x3ac1a5[_0x0e82('0x47')]=_0x414745;return _0x3ac1a5;})[_0x0e82('0x18')](respondWithFilteredResult(_0x4bf80,_0xfd7924))[_0x0e82('0x20')](handleError(_0x4bf80,null));};exports[_0x0e82('0x48')]=function(_0x27f59f,_0x43df7d){var _0x1bd904={'raw':![],'where':{'id':_0x27f59f[_0x0e82('0x49')]['id']}},_0x287abc={};_0x287abc[_0x0e82('0x32')]=_['keys'](db[_0x0e82('0x30')][_0x0e82('0x31')]);_0x287abc['query']=_[_0x0e82('0x4a')](_0x27f59f['query']);_0x287abc['filters']=_[_0x0e82('0x37')](_0x287abc['model'],_0x287abc[_0x0e82('0x33')]);_0x1bd904[_0x0e82('0x38')]=_[_0x0e82('0x37')](_0x287abc[_0x0e82('0x32')],qs[_0x0e82('0x39')](_0x27f59f['query'][_0x0e82('0x39')]));_0x1bd904['attributes']=_0x1bd904[_0x0e82('0x38')][_0x0e82('0x3a')]?_0x1bd904[_0x0e82('0x38')]:_0x287abc[_0x0e82('0x32')];if(_0x27f59f[_0x0e82('0x33')]['includeAll']){_0x1bd904[_0x0e82('0x4b')]=[{'all':!![]}];}_0x1bd904=_[_0x0e82('0x41')]({},_0x1bd904,_0x27f59f[_0x0e82('0x44')]);return db[_0x0e82('0x30')][_0x0e82('0x4c')](_0x1bd904)['then'](handleEntityNotFound(_0x43df7d,null))[_0x0e82('0x18')](respondWithResult(_0x43df7d,null))[_0x0e82('0x20')](handleError(_0x43df7d,null));};exports[_0x0e82('0x4d')]=function(_0x1e6d69,_0x37fb3c){return db[_0x0e82('0x30')][_0x0e82('0x4d')](_0x1e6d69[_0x0e82('0x4e')],{})[_0x0e82('0x18')](respondWithResult(_0x37fb3c,0xc9))[_0x0e82('0x20')](handleError(_0x37fb3c,null));};exports['update']=function(_0x597ce7,_0x5ba392){if(_0x597ce7[_0x0e82('0x4e')]['id']){delete _0x597ce7['body']['id'];}return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x597ce7['params']['id']}})['then'](handleEntityNotFound(_0x5ba392,null))[_0x0e82('0x18')](saveUpdates(_0x597ce7[_0x0e82('0x4e')],null))[_0x0e82('0x18')](respondWithResult(_0x5ba392,null))[_0x0e82('0x20')](handleError(_0x5ba392,null));};exports[_0x0e82('0x2b')]=function(_0x432bcd,_0x34c5b3){return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x432bcd[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x34c5b3,null))[_0x0e82('0x18')](removeEntity(_0x34c5b3,null))[_0x0e82('0x20')](handleError(_0x34c5b3,null));};exports[_0x0e82('0x4f')]=function(_0x62fca8,_0x35c587){return db[_0x0e82('0x30')][_0x0e82('0x4f')]()[_0x0e82('0x18')](respondWithResult(_0x35c587,null))['catch'](handleError(_0x35c587,null));};exports[_0x0e82('0x50')]=function(_0x3c7e1a,_0x31c66e,_0x1ea2fc){if(_0x3c7e1a[_0x0e82('0x4e')]['id']){delete _0x3c7e1a[_0x0e82('0x4e')]['id'];}return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x3c7e1a[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x31c66e,null))[_0x0e82('0x18')](function(_0x530741){if(_0x530741){_0x3c7e1a[_0x0e82('0x4e')]['OpnechannelAccountId']=_0x530741['id'];return db[_0x0e82('0x51')][_0x0e82('0x4d')](_0x3c7e1a['body']);}})[_0x0e82('0x18')](respondWithResult(_0x31c66e,null))[_0x0e82('0x20')](handleError(_0x31c66e,null));};exports[_0x0e82('0x52')]=function(_0x2730fb,_0x336df1,_0x5a5a96){var _0x21051c={'raw':![],'where':{}};var _0x4d5c6e={};var _0x5c173e={'count':0x0,'rows':[]};return db[_0x0e82('0x30')][_0x0e82('0x53')]({'where':{'id':_0x2730fb[_0x0e82('0x49')]['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x336df1,null))[_0x0e82('0x18')](function(_0xa4fe1f){if(_0xa4fe1f){_0x4d5c6e[_0x0e82('0x32')]=_[_0x0e82('0x4a')](db[_0x0e82('0x51')][_0x0e82('0x31')]);_0x4d5c6e['query']=_['keys'](_0x2730fb[_0x0e82('0x33')]);_0x4d5c6e['filters']=_[_0x0e82('0x37')](_0x4d5c6e[_0x0e82('0x32')],_0x4d5c6e['query']);_0x21051c[_0x0e82('0x38')]=_[_0x0e82('0x37')](_0x4d5c6e['model'],qs[_0x0e82('0x39')](_0x2730fb[_0x0e82('0x33')]['fields']));_0x21051c[_0x0e82('0x38')]=_0x21051c['attributes'][_0x0e82('0x3a')]?_0x21051c[_0x0e82('0x38')]:_0x4d5c6e[_0x0e82('0x32')];if(!_0x2730fb[_0x0e82('0x33')][_0x0e82('0x54')](_0x0e82('0x3b'))){_0x21051c[_0x0e82('0x26')]=qs[_0x0e82('0x26')](_0x2730fb[_0x0e82('0x33')][_0x0e82('0x26')]);_0x21051c['offset']=qs[_0x0e82('0x25')](_0x2730fb['query'][_0x0e82('0x25')]);}_0x21051c[_0x0e82('0x3c')]=qs[_0x0e82('0x3d')](_0x2730fb['query'][_0x0e82('0x3d')]);_0x21051c[_0x0e82('0x3e')]=qs[_0x0e82('0x36')](_[_0x0e82('0x55')](_0x2730fb[_0x0e82('0x33')],_0x4d5c6e['filters']));_0x21051c[_0x0e82('0x3e')]['OpenchannelAccountId']=_0xa4fe1f['id'];if(_0x2730fb[_0x0e82('0x33')][_0x0e82('0x42')]){_0x21051c['where']=_['merge'](_0x21051c[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0x21051c[_0x0e82('0x38')],function(_0x22791b){var _0x1b6fcd={};_0x1b6fcd[_0x22791b]={'$like':'%'+_0x2730fb[_0x0e82('0x33')][_0x0e82('0x42')]+'%'};return _0x1b6fcd;})});}_0x21051c=_[_0x0e82('0x41')]({},_0x21051c,_0x2730fb[_0x0e82('0x44')]);return db['Disposition'][_0x0e82('0x45')]({'where':_0x21051c[_0x0e82('0x3e')]})['then'](function(_0x4e34ba){_0x5c173e['count']=_0x4e34ba;if(_0x2730fb[_0x0e82('0x33')][_0x0e82('0x46')]){_0x21051c[_0x0e82('0x4b')]=[{'all':!![]}];}return db['Disposition'][_0x0e82('0x56')](_0x21051c);})['then'](function(_0x1ed977){_0x5c173e[_0x0e82('0x47')]=_0x1ed977;return _0x5c173e;});}})[_0x0e82('0x18')](respondWithFilteredResult(_0x336df1,_0x21051c))[_0x0e82('0x20')](handleError(_0x336df1,null));};exports[_0x0e82('0x57')]=function(_0x48ac18,_0x28097c,_0x28eb04){var _0x48873d;return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x48ac18[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x28097c,null))[_0x0e82('0x18')](function(_0x51d9a7){if(_0x51d9a7){return _0x51d9a7[_0x0e82('0x57')](_0x48ac18[_0x0e82('0x33')][_0x0e82('0x58')]);}})[_0x0e82('0x18')](respondWithStatusCode(_0x28097c,null))[_0x0e82('0x20')](handleError(_0x28097c,null));};exports[_0x0e82('0x59')]=function(_0x203f3d,_0x472afb,_0x4a1e4d){if(_0x203f3d[_0x0e82('0x4e')]['id']){delete _0x203f3d[_0x0e82('0x4e')]['id'];}return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x203f3d[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x472afb,null))[_0x0e82('0x18')](function(_0x4fadaa){if(_0x4fadaa){_0x203f3d[_0x0e82('0x4e')]['OpenchannelAccountId']=_0x4fadaa['id'];return db[_0x0e82('0x5a')][_0x0e82('0x4d')](_0x203f3d['body']);}})[_0x0e82('0x18')](respondWithResult(_0x472afb,null))[_0x0e82('0x20')](handleError(_0x472afb,null));};exports[_0x0e82('0x5b')]=function(_0x5d07d6,_0x5777c2,_0x593ab3){var _0xa5bd26={'raw':![],'where':{}};var _0x2dfab1={};var _0x2c7f9a={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0e82('0x53')]({'where':{'id':_0x5d07d6[_0x0e82('0x49')]['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x5777c2,null))[_0x0e82('0x18')](function(_0x183fe7){if(_0x183fe7){_0x2dfab1[_0x0e82('0x32')]=_[_0x0e82('0x4a')](db[_0x0e82('0x5a')]['rawAttributes']);_0x2dfab1[_0x0e82('0x33')]=_[_0x0e82('0x4a')](_0x5d07d6[_0x0e82('0x33')]);_0x2dfab1[_0x0e82('0x36')]=_[_0x0e82('0x37')](_0x2dfab1[_0x0e82('0x32')],_0x2dfab1[_0x0e82('0x33')]);_0xa5bd26[_0x0e82('0x38')]=_['intersection'](_0x2dfab1[_0x0e82('0x32')],qs['fields'](_0x5d07d6['query']['fields']));_0xa5bd26[_0x0e82('0x38')]=_0xa5bd26[_0x0e82('0x38')][_0x0e82('0x3a')]?_0xa5bd26[_0x0e82('0x38')]:_0x2dfab1['model'];if(!_0x5d07d6[_0x0e82('0x33')]['hasOwnProperty'](_0x0e82('0x3b'))){_0xa5bd26[_0x0e82('0x26')]=qs['limit'](_0x5d07d6[_0x0e82('0x33')]['limit']);_0xa5bd26['offset']=qs[_0x0e82('0x25')](_0x5d07d6[_0x0e82('0x33')]['offset']);}_0xa5bd26['order']=qs[_0x0e82('0x3d')](_0x5d07d6[_0x0e82('0x33')][_0x0e82('0x3d')]);_0xa5bd26[_0x0e82('0x3e')]=qs[_0x0e82('0x36')](_[_0x0e82('0x55')](_0x5d07d6[_0x0e82('0x33')],_0x2dfab1[_0x0e82('0x36')]));_0xa5bd26['where']['OpenchannelAccountId']=_0x183fe7['id'];if(_0x5d07d6[_0x0e82('0x33')][_0x0e82('0x42')]){_0xa5bd26[_0x0e82('0x3e')]=_[_0x0e82('0x41')](_0xa5bd26[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0xa5bd26[_0x0e82('0x38')],function(_0x56804d){var _0x3ef124={};_0x3ef124[_0x56804d]={'$like':'%'+_0x5d07d6['query']['filter']+'%'};return _0x3ef124;})});}_0xa5bd26=_[_0x0e82('0x41')]({},_0xa5bd26,_0x5d07d6['options']);return db[_0x0e82('0x5a')][_0x0e82('0x45')]({'where':_0xa5bd26['where']})[_0x0e82('0x18')](function(_0x3c6340){_0x2c7f9a[_0x0e82('0x45')]=_0x3c6340;if(_0x5d07d6[_0x0e82('0x33')][_0x0e82('0x46')]){_0xa5bd26[_0x0e82('0x4b')]=[{'all':!![]}];}return db[_0x0e82('0x5a')]['findAll'](_0xa5bd26);})[_0x0e82('0x18')](function(_0x55a7a4){_0x2c7f9a['rows']=_0x55a7a4;return _0x2c7f9a;});}})['then'](respondWithFilteredResult(_0x5777c2,_0xa5bd26))[_0x0e82('0x20')](handleError(_0x5777c2,null));};exports[_0x0e82('0x5c')]=function(_0x3bb220,_0x275551,_0xc6def3){var _0x33eaa3;return db['OpenchannelAccount'][_0x0e82('0x4c')]({'where':{'id':_0x3bb220['params']['id']}})['then'](handleEntityNotFound(_0x275551,null))['then'](function(_0x1fad5a){if(_0x1fad5a){return _0x1fad5a['removeAnswers'](_0x3bb220['query'][_0x0e82('0x58')]);}})[_0x0e82('0x18')](respondWithStatusCode(_0x275551,null))['catch'](handleError(_0x275551,null));};exports[_0x0e82('0x5d')]=function(_0x463093,_0x4d1ea3,_0x267568){var _0x1eee00={'body':_0x463093[_0x0e82('0x4e')],'channel':'openchannel'};var _0x408886=[];var _0x1c76a9=[];var _0x5937b7={};var _0x28e077=![];return db[_0x0e82('0x5e')]['describe']()[_0x0e82('0x18')](function(_0x17a608){if(!_0x17a608){throw new db['Sequelize'][(_0x0e82('0x5f'))](_0x0e82('0x60'));}_0x408886=_[_0x0e82('0x61')](_[_0x0e82('0x4a')](_0x17a608),['createdAt','updatedAt']);_0x1c76a9=_[_0x0e82('0x61')](_[_0x0e82('0x4a')](_0x17a608),[_0x0e82('0x62'),_0x0e82('0x63'),_0x0e82('0x64'),_0x0e82('0x65')]);if(_0x463093[_0x0e82('0x4e')]['id']){delete _0x463093[_0x0e82('0x4e')]['id'];}if(_[_0x0e82('0x66')](_0x463093['body'][_0x0e82('0x67')])){throw new db[(_0x0e82('0x68'))][(_0x0e82('0x5f'))](_0x0e82('0x69'));}if(_['isNil'](_0x463093[_0x0e82('0x4e')][_0x0e82('0x4e')])||_0x463093['body'][_0x0e82('0x4e')]===''){throw new db[(_0x0e82('0x68'))][(_0x0e82('0x5f'))](_0x0e82('0x6a'));}if(_[_0x0e82('0x66')](_0x463093[_0x0e82('0x4e')]['mapKey'])){throw new db[(_0x0e82('0x68'))]['ValidationError'](_0x0e82('0x6b')+_0x1c76a9);}if(!_[_0x0e82('0x6c')](_0x1c76a9,_0x463093[_0x0e82('0x4e')][_0x0e82('0x6d')])){throw new db[(_0x0e82('0x68'))][(_0x0e82('0x5f'))](_0x0e82('0x6e')+_0x1c76a9);}_0x5937b7[_0x463093[_0x0e82('0x4e')]['mapKey']]=_0x463093[_0x0e82('0x4e')][_0x0e82('0x67')];})[_0x0e82('0x18')](function(){return db['OpenchannelAccount'][_0x0e82('0x4c')]({'where':{'id':_0x463093['params']['id']},'include':[{'model':db[_0x0e82('0x6f')],'as':'List','include':[{'model':db[_0x0e82('0x5e')],'as':_0x0e82('0x70'),'where':_0x5937b7,'limit':0x1,'order':[[_0x0e82('0x63'),'DESC']]}]},{'model':db[_0x0e82('0x71')],'as':_0x0e82('0x72')}]});})[_0x0e82('0x18')](handleEntityNotFound(_0x4d1ea3,null))[_0x0e82('0x18')](function(_0x52397d){if(_0x52397d&&_0x52397d[_0x0e82('0x73')]){_0x1eee00[_0x0e82('0x74')]=_0x52397d;_0x1eee00[_0x0e82('0x75')]=_0x52397d[_0x0e82('0x72')];_0x1eee00[_0x0e82('0x76')]=_0x52397d['List'];_0x1eee00[_0x0e82('0x75')]=_[_0x0e82('0x77')](_0x1eee00[_0x0e82('0x75')],[_0x0e82('0x78')],[_0x0e82('0x79')]);if(_0x1eee00['account']['Applications']){delete _0x1eee00[_0x0e82('0x74')][_0x0e82('0x72')];}if(_0x1eee00['account']['List']&&_0x1eee00[_0x0e82('0x74')][_0x0e82('0x73')][_0x0e82('0x70')][_0x0e82('0x3a')]){return _0x1eee00[_0x0e82('0x74')][_0x0e82('0x73')]['Contacts'][0x0];}var _0x2e3c9a=_[_0x0e82('0x7a')](_0x463093[_0x0e82('0x4e')],{'firstName':_0x463093[_0x0e82('0x4e')]['from'],'ListId':_0x52397d['ListId']});_0x2e3c9a[_0x463093[_0x0e82('0x4e')][_0x0e82('0x6d')]]=_0x463093[_0x0e82('0x4e')][_0x0e82('0x67')];return db[_0x0e82('0x5e')]['create'](_0x2e3c9a,{'fields':_0x408886,'raw':!![]});}})['then'](handleEntityNotFound(_0x4d1ea3,null))[_0x0e82('0x18')](function(_0x4f8663){_0x1eee00[_0x0e82('0x7b')]=_0x4f8663;if(_0x4f8663){var _0x55c9f4={'ContactId':_0x4f8663['id'],'OpenchannelAccountId':_0x463093[_0x0e82('0x49')]['id'],'from':(_0x4f8663[_0x0e82('0x7c')]||'')+'\x20'+(_0x4f8663[_0x0e82('0x7d')]||'')};var _0x34d730={'OpenchannelAccountId':_0x463093[_0x0e82('0x49')]['id'],'closed':![]};if(_0x463093[_0x0e82('0x4e')]['threadId']){_0x34d730['threadId']=_0x463093[_0x0e82('0x4e')]['threadId'];return db[_0x0e82('0x7e')][_0x0e82('0x4c')]({'where':_0x34d730})[_0x0e82('0x18')](function(_0x1c5350){if(_0x1c5350){return[_0x1c5350,![]];}_0x55c9f4[_0x0e82('0x7f')]=_0x463093[_0x0e82('0x4e')][_0x0e82('0x7f')];_0x55c9f4[_0x0e82('0x80')]=_0x463093[_0x0e82('0x4e')]['externalUrl'];return db[_0x0e82('0x7e')][_0x0e82('0x4d')](_0x55c9f4)[_0x0e82('0x18')](function(_0x2857e9){return[_0x2857e9,!![]];});});}else{_0x34d730[_0x0e82('0x7f')]=null;}_0x34d730[_0x0e82('0x81')]=_0x4f8663['id'];return db['OpenchannelInteraction'][_0x0e82('0x4c')]({'where':_0x34d730})[_0x0e82('0x18')](function(_0x2c9570){if(_0x2c9570){return[_0x2c9570,![]];}return db['OpenchannelInteraction'][_0x0e82('0x4d')](_0x55c9f4)[_0x0e82('0x18')](function(_0x5581e6){return[_0x5581e6,!![]];});});}})[_0x0e82('0x82')](function(_0x312813,_0x524665){if(_0x312813){_0x28e077=_0x524665;if(!_0x524665){return _0x312813[_0x0e82('0x83')]({'from':(_0x1eee00[_0x0e82('0x7b')][_0x0e82('0x7c')]||'')+'\x20'+(_0x1eee00[_0x0e82('0x7b')][_0x0e82('0x7d')]||'')});}else{return _0x312813;}}})[_0x0e82('0x18')](function(_0x3a72e0){_0x1eee00[_0x0e82('0x84')]=_0x3a72e0[_0x0e82('0x85')]({'plain':!![]});_0x1eee00[_0x0e82('0x84')]['created']=_0x28e077;if(_0x1eee00[_0x0e82('0x84')]['created']){if(_0x1eee00['account'][_0x0e82('0x86')]){_0x1eee00['applications'][_0x0e82('0x87')]({'id':0x0,'priority':_0x1eee00[_0x0e82('0x75')][_0x0e82('0x3a')]+0x1,'app':_0x0e82('0x88'),'appdata':_0x0e82('0x89'),'interval':'*,*,*,*'});}}return db[_0x0e82('0x8a')][_0x0e82('0x4d')]({'body':_0x463093['body']['body'],'OpenchannelAccountId':_0x463093[_0x0e82('0x49')]['id'],'OpenchannelInteractionId':_0x3a72e0['id'],'direction':'in','ContactId':_0x1eee00['contact']['id'],'AttachmentId':_0x463093[_0x0e82('0x4e')][_0x0e82('0x8b')]});})[_0x0e82('0x18')](function(_0x4f2118){_0x1eee00['message']=_0x4f2118;if(_0x1eee00[_0x0e82('0x84')]['UserId']){return db[_0x0e82('0x8c')]['find']({'attributes':['id',_0x0e82('0x2d')],'where':{'id':_0x1eee00[_0x0e82('0x84')]['UserId']}})[_0x0e82('0x18')](function(_0x2c56da){if(_0x2c56da){_0x1eee00['applications'][_0x0e82('0x8d')]({'id':0x0,'priority':0x0,'app':_0x0e82('0x8e'),'appdata':_0x2c56da['name']+','+(_0x1eee00['account'][_0x0e82('0x8f')]||0xa),'interval':'*,*,*,*'});_0x1eee00[_0x0e82('0x90')]=![];}return respondWithRpcPromise(_0x0e82('0x91'),'startRouting',_0x1eee00);});}return respondWithRpcPromise('Start',_0x0e82('0x92'),_0x1eee00);})['then'](function(_0x2493b8){respondWithRpcPromise(_0x0e82('0x93'),_0x0e82('0x93'),{'event':_0x0e82('0x5d'),'message':_0x2493b8},client9002);return _0x2493b8;})['then'](respondWithResult(_0x4d1ea3,null))['catch'](handleError(_0x4d1ea3,null));};exports[_0x0e82('0x94')]=function(_0x196626,_0x3f725e,_0x1c54a1){return db['OpenchannelAccount'][_0x0e82('0x53')]({'where':{'id':_0x196626['params']['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x3f725e,null))[_0x0e82('0x18')](function(_0x4ef3df){if(_0x4ef3df){return db[_0x0e82('0x95')]['transaction'](function(_0x5ebba5){return db[_0x0e82('0x71')][_0x0e82('0x2b')]({'where':{'OpenchannelAccountId':_0x196626[_0x0e82('0x49')]['id']},'transaction':_0x5ebba5})[_0x0e82('0x18')](function(_0x1ac9a8){var _0x8353d9=_[_0x0e82('0x43')](_0x196626['body'],function(_0x5a4385){_0x5a4385['OpenchannelAccountId']=_0x196626[_0x0e82('0x49')]['id'];return _0x5a4385;});return db[_0x0e82('0x71')]['bulkCreate'](_0x8353d9,{'transaction':_0x5ebba5});});})[_0x0e82('0x18')](function(){return db[_0x0e82('0x71')][_0x0e82('0x96')]({'where':{'OpenchannelAccountId':_0x196626[_0x0e82('0x49')]['id']},'order':_0x0e82('0x78')});});}})[_0x0e82('0x18')](respondWithResult(_0x3f725e,null))['catch'](handleError(_0x3f725e,null));};exports[_0x0e82('0x97')]=function(_0x748b6,_0x3e4d27,_0x1d63bf){var _0x447179={};var _0x252c19={};var _0x2e2d00;var _0xab2287;return db[_0x0e82('0x30')][_0x0e82('0x53')]({'where':{'id':_0x748b6[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x3e4d27,null))[_0x0e82('0x18')](function(_0x32c978){if(_0x32c978){_0x2e2d00=_0x32c978;_0x252c19[_0x0e82('0x32')]=_[_0x0e82('0x4a')](db[_0x0e82('0x71')][_0x0e82('0x31')]);_0x252c19['query']=_[_0x0e82('0x4a')](_0x748b6['query']);_0x252c19[_0x0e82('0x36')]=_['intersection'](_0x252c19[_0x0e82('0x32')],_0x252c19[_0x0e82('0x33')]);_0x447179['attributes']=_[_0x0e82('0x37')](_0x252c19['model'],qs['fields'](_0x748b6['query']['fields']));_0x447179[_0x0e82('0x38')]=_0x447179[_0x0e82('0x38')][_0x0e82('0x3a')]?_0x447179['attributes']:_0x252c19[_0x0e82('0x32')];_0x447179[_0x0e82('0x3c')]=qs[_0x0e82('0x3d')](_0x748b6['query']['sort']);_0x447179[_0x0e82('0x3e')]=qs[_0x0e82('0x36')](_[_0x0e82('0x55')](_0x748b6[_0x0e82('0x33')],_0x252c19[_0x0e82('0x36')]));if(_0x748b6[_0x0e82('0x33')]['filter']){_0x447179[_0x0e82('0x3e')]=_[_0x0e82('0x41')](_0x447179[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0x447179[_0x0e82('0x38')],function(_0x3b8d7e){var _0x33d8ca={};_0x33d8ca[_0x3b8d7e]={'$like':'%'+_0x748b6[_0x0e82('0x33')]['filter']+'%'};return _0x33d8ca;})});}_0x447179=_[_0x0e82('0x41')]({},_0x447179,_0x748b6[_0x0e82('0x44')]);return _0x2e2d00[_0x0e82('0x97')](_0x447179);}})[_0x0e82('0x18')](function(_0x2e6d1a){if(_0x2e6d1a){_0xab2287=_0x2e6d1a[_0x0e82('0x3a')];if(!_0x748b6[_0x0e82('0x33')]['hasOwnProperty']('nolimit')){_0x447179[_0x0e82('0x26')]=qs[_0x0e82('0x26')](_0x748b6[_0x0e82('0x33')][_0x0e82('0x26')]);_0x447179['offset']=qs[_0x0e82('0x25')](_0x748b6[_0x0e82('0x33')][_0x0e82('0x25')]);}return _0x2e2d00['getApplications'](_0x447179);}})[_0x0e82('0x18')](function(_0x2d3ba7){if(_0x2d3ba7){return _0x2d3ba7?{'count':_0xab2287,'rows':_0x2d3ba7}:null;}})[_0x0e82('0x18')](respondWithResult(_0x3e4d27,null))[_0x0e82('0x20')](handleError(_0x3e4d27,null));};exports[_0x0e82('0x98')]=function(_0x45afa0,_0x2816da,_0x187256){var _0x23797f={'raw':![],'where':{}};var _0xda165b={};var _0x55449b={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x0e82('0x53')]({'where':{'id':_0x45afa0[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x2816da,null))[_0x0e82('0x18')](function(_0x268ba1){if(_0x268ba1){_0xda165b[_0x0e82('0x32')]=_[_0x0e82('0x4a')](db['OpenchannelInteraction']['rawAttributes']);_0xda165b[_0x0e82('0x33')]=_[_0x0e82('0x4a')](_0x45afa0[_0x0e82('0x33')]);_0xda165b[_0x0e82('0x36')]=_[_0x0e82('0x37')](_0xda165b[_0x0e82('0x32')],_0xda165b[_0x0e82('0x33')]);_0x23797f[_0x0e82('0x38')]=_['intersection'](_0xda165b[_0x0e82('0x32')],qs[_0x0e82('0x39')](_0x45afa0['query'][_0x0e82('0x39')]));_0x23797f[_0x0e82('0x38')]=_0x23797f['attributes']['length']?_0x23797f[_0x0e82('0x38')]:_0xda165b[_0x0e82('0x32')];if(!_0x45afa0['query'][_0x0e82('0x54')]('nolimit')){_0x23797f[_0x0e82('0x26')]=qs[_0x0e82('0x26')](_0x45afa0['query'][_0x0e82('0x26')]);_0x23797f['offset']=qs['offset'](_0x45afa0['query'][_0x0e82('0x25')]);}_0x23797f[_0x0e82('0x3c')]=qs[_0x0e82('0x3d')](_0x45afa0['query'][_0x0e82('0x3d')]);_0x23797f[_0x0e82('0x3e')]=qs['filters'](_['pick'](_0x45afa0[_0x0e82('0x33')],_0xda165b[_0x0e82('0x36')]));_0x23797f[_0x0e82('0x3e')][_0x0e82('0x99')]=_0x268ba1['id'];if(_0x45afa0['query'][_0x0e82('0x42')]){_0x23797f[_0x0e82('0x3e')]=_['merge'](_0x23797f[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0x23797f['attributes'],function(_0x446488){var _0x5c7607={};_0x5c7607[_0x446488]={'$like':'%'+_0x45afa0[_0x0e82('0x33')][_0x0e82('0x42')]+'%'};return _0x5c7607;})});}_0x23797f=_[_0x0e82('0x41')]({},_0x23797f,_0x45afa0[_0x0e82('0x44')]);return db['OpenchannelInteraction']['count']({'where':_0x23797f[_0x0e82('0x3e')]})[_0x0e82('0x18')](function(_0x2cd77b){_0x55449b['count']=_0x2cd77b;if(_0x45afa0[_0x0e82('0x33')][_0x0e82('0x46')]){_0x23797f[_0x0e82('0x4b')]=[{'model':db[_0x0e82('0x5e')],'as':_0x0e82('0x9a'),'required':![]},{'model':db[_0x0e82('0x8c')],'as':_0x0e82('0x9b'),'attributes':[_0x0e82('0x2d'),_0x0e82('0x9c'),_0x0e82('0x9d')],'required':![]},{'model':db[_0x0e82('0x9e')],'as':_0x0e82('0x9f'),'attributes':['id','name',_0x0e82('0xa0')],'where':_0x45afa0['query'][_0x0e82('0xa1')]?{'id':_0x45afa0[_0x0e82('0x33')][_0x0e82('0xa1')]}:undefined,'required':_0x45afa0[_0x0e82('0x33')]['tag']?!![]:![]}];}return db[_0x0e82('0x7e')][_0x0e82('0x56')](_0x23797f);})['then'](function(_0x1a7631){_0x55449b[_0x0e82('0x47')]=_0x1a7631;return _0x55449b;});}})[_0x0e82('0x18')](respondWithFilteredResult(_0x2816da,_0x23797f))['catch'](handleError(_0x2816da,null));};exports[_0x0e82('0xa2')]=function(_0x5dae3c,_0x30d560,_0x3350ae){return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x5dae3c['params']['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x30d560,null))['then'](function(_0x206a98){if(_0x206a98){return _0x206a98[_0x0e82('0xa2')](_0x5dae3c[_0x0e82('0x4e')][_0x0e82('0x58')],_['omit'](_0x5dae3c['body'],[_0x0e82('0x58'),'id'])||{})[_0x0e82('0x82')](function(_0x3c75b0){for(var _0x94eb5c=0x0;_0x94eb5c<_0x5dae3c['body'][_0x0e82('0x58')]['length'];_0x94eb5c+=0x1){socket['emit'](_0x0e82('0xa3'),{'UserId':_0x5dae3c['body'][_0x0e82('0x58')][_0x94eb5c],'OpenchannelAccountId':_0x5dae3c[_0x0e82('0x49')]['id']});}return _0x3c75b0;});}})['then'](respondWithResult(_0x30d560,null))[_0x0e82('0x20')](handleError(_0x30d560,null));};exports[_0x0e82('0xa4')]=function(_0x58f984,_0x94c7c0,_0x3d7a2e){var _0x3a27f7;return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0x58f984['params']['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x94c7c0,null))['then'](function(_0x7f65ff){if(_0x7f65ff){return _0x7f65ff['removeAgents'](_0x58f984[_0x0e82('0x33')][_0x0e82('0x58')])['then'](function(_0x480f3c){if(_['isArray'](_0x58f984[_0x0e82('0x33')][_0x0e82('0x58')])){for(var _0x2d5c1b=0x0;_0x2d5c1b<_0x58f984[_0x0e82('0x33')][_0x0e82('0x58')][_0x0e82('0x3a')];_0x2d5c1b+=0x1){socket[_0x0e82('0xa5')]('userOpenchannelAccount:remove',{'UserId':_0x58f984[_0x0e82('0x33')][_0x0e82('0x58')][_0x2d5c1b],'OpenchannelAccountId':_0x58f984[_0x0e82('0x49')]['id']});}}else{socket[_0x0e82('0xa5')](_0x0e82('0xa6'),{'UserId':_0x58f984[_0x0e82('0x33')][_0x0e82('0x58')],'OpenchannelAccountId':_0x58f984[_0x0e82('0x49')]['id']});}});}})[_0x0e82('0x18')](respondWithStatusCode(_0x94c7c0,null))['catch'](handleError(_0x94c7c0,null));};exports[_0x0e82('0xa7')]=function(_0x36061f,_0x5a4845,_0x5c3694){var _0x17bb14={};var _0x302e7d={};var _0x4d08b7;var _0x28e4b1;return db[_0x0e82('0x30')][_0x0e82('0x53')]({'where':{'id':_0x36061f[_0x0e82('0x49')]['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x5a4845,null))[_0x0e82('0x18')](function(_0x22d7db){if(_0x22d7db){_0x4d08b7=_0x22d7db;_0x302e7d[_0x0e82('0x32')]=_[_0x0e82('0x4a')](db[_0x0e82('0x8c')]['rawAttributes']);_0x302e7d[_0x0e82('0x33')]=_[_0x0e82('0x4a')](_0x36061f[_0x0e82('0x33')]);_0x302e7d[_0x0e82('0x36')]=_['intersection'](_0x302e7d[_0x0e82('0x32')],_0x302e7d[_0x0e82('0x33')]);_0x17bb14['attributes']=_[_0x0e82('0x37')](_0x302e7d[_0x0e82('0x32')],qs[_0x0e82('0x39')](_0x36061f[_0x0e82('0x33')][_0x0e82('0x39')]));_0x17bb14['attributes']=_0x17bb14[_0x0e82('0x38')][_0x0e82('0x3a')]?_0x17bb14[_0x0e82('0x38')]:_0x302e7d['model'];_0x17bb14[_0x0e82('0x3c')]=qs[_0x0e82('0x3d')](_0x36061f[_0x0e82('0x33')]['sort']);_0x17bb14['where']=qs[_0x0e82('0x36')](_[_0x0e82('0x55')](_0x36061f[_0x0e82('0x33')],_0x302e7d[_0x0e82('0x36')]));if(_0x36061f[_0x0e82('0x33')][_0x0e82('0x42')]){_0x17bb14[_0x0e82('0x3e')]=_['merge'](_0x17bb14[_0x0e82('0x3e')],{'$or':_[_0x0e82('0x43')](_0x17bb14[_0x0e82('0x38')],function(_0x299cba){var _0xf5b3e1={};_0xf5b3e1[_0x299cba]={'$like':'%'+_0x36061f[_0x0e82('0x33')][_0x0e82('0x42')]+'%'};return _0xf5b3e1;})});}_0x17bb14=_[_0x0e82('0x41')]({},_0x17bb14,_0x36061f[_0x0e82('0x44')]);return _0x4d08b7[_0x0e82('0xa7')](_0x17bb14);}})[_0x0e82('0x18')](function(_0x3c0d95){if(_0x3c0d95){_0x28e4b1=_0x3c0d95[_0x0e82('0x3a')];if(!_0x36061f[_0x0e82('0x33')][_0x0e82('0x54')](_0x0e82('0x3b'))){_0x17bb14['limit']=qs['limit'](_0x36061f['query'][_0x0e82('0x26')]);_0x17bb14[_0x0e82('0x25')]=qs[_0x0e82('0x25')](_0x36061f[_0x0e82('0x33')]['offset']);}return _0x4d08b7['getAgents'](_0x17bb14);}})['then'](function(_0x5939cb){if(_0x5939cb){return _0x5939cb?{'count':_0x28e4b1,'rows':_0x5939cb}:null;}})[_0x0e82('0x18')](respondWithResult(_0x5a4845,null))['catch'](handleError(_0x5a4845,null));};exports['send']=function(_0x18515a,_0x5d510b,_0x56ca4d){var _0x27328f,_0x3bd01e,_0x2717fd;if(_[_0x0e82('0x66')](_0x18515a['body'][_0x0e82('0x4e')])||_0x18515a['body'][_0x0e82('0x4e')]===''){throw new db[(_0x0e82('0x68'))][(_0x0e82('0x5f'))](_0x0e82('0x6a'));}if(_[_0x0e82('0x66')](_0x18515a['body']['to'])){}_0x27328f=_0x18515a[_0x0e82('0x4e')]['to'];return db[_0x0e82('0x30')][_0x0e82('0x53')]({'where':{'id':_0x18515a['params']['id']}})[_0x0e82('0x18')](handleEntityNotFound(_0x5d510b,null))[_0x0e82('0x18')](function(_0xf233c4){if(_0xf233c4){return db[_0x0e82('0x30')][_0x0e82('0x4c')]({'where':{'id':_0xf233c4['id']},'include':[{'model':db[_0x0e82('0x6f')],'as':_0x0e82('0x73'),'include':[{'model':db[_0x0e82('0x5e')],'as':_0x0e82('0x70'),'where':{[_0xf233c4[_0x0e82('0x6d')]]:_0x27328f},'limit':0x1,'order':[[_0x0e82('0x63'),_0x0e82('0xa8')]]}]}]})['then'](handleEntityNotFound(_0x5d510b,null))[_0x0e82('0x18')](function(_0x2952c2){if(_0x2952c2&&_0x2952c2[_0x0e82('0x73')]){_0x3bd01e=_0x2952c2[_0x0e82('0x85')]({'plain':!![]});if(_0x3bd01e['List']&&_0x3bd01e[_0x0e82('0x73')][_0x0e82('0x70')][_0x0e82('0x3a')]){return _0x3bd01e[_0x0e82('0x73')][_0x0e82('0x70')][0x0];}return db['CmContact'][_0x0e82('0x4d')](_[_0x0e82('0x7a')](_0x18515a[_0x0e82('0x4e')],{'firstName':_0x27328f,[_0x2952c2['mapKey']]:_0x27328f,'phone':_0x27328f,'ListId':_0x3bd01e[_0x0e82('0x65')]}));}})['then'](handleEntityNotFound(_0x5d510b,null))[_0x0e82('0x18')](function(_0x587484){if(_0x587484){_0x2717fd=_0x587484;return db[_0x0e82('0x7e')][_0x0e82('0x4c')]({'where':{'ContactId':_0x2717fd['id'],'closed':![],'OpenchannelAccountId':_0x3bd01e['id']}})[_0x0e82('0x18')](function(_0x210345){if(_0x210345){return[_0x210345,![]];}return db[_0x0e82('0x7e')][_0x0e82('0x4d')]({'UserId':_0x18515a[_0x0e82('0xa9')]['id'],'ContactId':_0x2717fd['id'],'OpenchannelAccountId':_0x3bd01e['id'],'lastMsgDirection':_0x0e82('0xaa'),'Messages':[_[_0x0e82('0x41')](_0x18515a[_0x0e82('0x4e')],{'read':![],'body':_0x18515a['body'][_0x0e82('0x4e')],'OpenchannelAccountId':_0x3bd01e['id'],'UserId':_0x18515a[_0x0e82('0xa9')]['id'],'ContactId':_0x2717fd['id']})]},{'include':[{'model':db[_0x0e82('0x8a')],'as':_0x0e82('0xab')}]})[_0x0e82('0x18')](function(_0xbb2b8c){return[_0xbb2b8c,!![]];});});}})[_0x0e82('0x82')](function(_0x50bd57,_0x19188a){if(_0x19188a){return _0x50bd57;}return db['OpenchannelMessage'][_0x0e82('0x4d')](_[_0x0e82('0x41')](_0x18515a[_0x0e82('0x4e')],{'read':![],'body':_0x18515a[_0x0e82('0x4e')][_0x0e82('0x4e')],'OpenchannelAccountId':_0x3bd01e['id'],'OpenchannelInteractionId':_0x50bd57['id'],'UserId':_0x18515a['user']['id'],'ContactId':_0x2717fd['id']}))[_0x0e82('0x18')](function(_0x3563a2){_0x50bd57[_0x0e82('0xac')][_0x0e82('0xab')]=[];_0x50bd57['dataValues'][_0x0e82('0xab')][_0x0e82('0x87')](_0x3563a2[_0x0e82('0xac')]);return _0x50bd57;});});}})['then'](respondWithResult(_0x5d510b,null))['catch'](handleError(_0x5d510b,null));}; \ No newline at end of file +var _0xa5fa=['EventManager','addApplications','transaction','OpenchannelApplication','bulkCreate','priority','getApplications','getInteractions','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','DESC','user','OpenchannelMessage','Messages','dataValues','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','localhost','jayson/promise','http','client','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','set','apply','update','destroy','end','stack','name','send','index','OpenchannelAccount','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','map','options','count','includeAll','include','findAll','rows','show','params','merge','find','create','body','describe','addDisposition','OpnechannelAccountId','Disposition','getDispositions','findOne','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','createdAt','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','Applications','applications','list','asc','account','defaults','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','get','created','interaction','push','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting'];(function(_0x3c4453,_0x47f08d){var _0x1791e5=function(_0x144921){while(--_0x144921){_0x3c4453['push'](_0x3c4453['shift']());}};_0x1791e5(++_0x47f08d);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x3765e2,_0x4e1fba){_0x3765e2=_0x3765e2-0x0;var _0x144efb=_0xa5fa[_0x3765e2];return _0x144efb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xaa5f('0x0'));var moment=require(_0xaa5f('0x1'));var BPromise=require(_0xaa5f('0x2'));var Mustache=require(_0xaa5f('0x3'));var util=require('util');var path=require(_0xaa5f('0x4'));var sox=require(_0xaa5f('0x5'));var csv=require('to-csv');var ejs=require(_0xaa5f('0x6'));var fs=require('fs');var _=require(_0xaa5f('0x7'));var squel=require(_0xaa5f('0x8'));var crypto=require(_0xaa5f('0x9'));var jsforce=require(_0xaa5f('0xa'));var deskjs=require(_0xaa5f('0xb'));var toCsv=require(_0xaa5f('0xc'));var querystring=require(_0xaa5f('0xd'));var Papa=require(_0xaa5f('0xe'));var qs=require(_0xaa5f('0xf'));var logger=require(_0xaa5f('0x10'))('api');var utils=require(_0xaa5f('0x11'));var config=require(_0xaa5f('0x12'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0xaa5f('0x13'),'port':0x18eb});require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xaa5f('0x14'));var client=jayson['client'][_0xaa5f('0x15')]({'port':0x232c});var client9002=jayson[_0xaa5f('0x16')][_0xaa5f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x9aeae9,_0x252ae0,_0x48d1d3,_0xbd4e10){return new BPromise(function(_0x552c53,_0x372881){var _0x23f872=_0xbd4e10||client;return _0x23f872[_0xaa5f('0x17')](_0x9aeae9,_0x48d1d3)[_0xaa5f('0x18')](function(_0x2e1ca5){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x252ae0,_0xaa5f('0x19'));logger[_0xaa5f('0x1a')](_0xaa5f('0x1b'),_0x252ae0,_0xaa5f('0x19'),JSON[_0xaa5f('0x1c')](_0x2e1ca5));if(_0x2e1ca5[_0xaa5f('0x1d')]){if(_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x1e')]===0x1f4){logger[_0xaa5f('0x1d')](_0xaa5f('0x1f'),_0x252ae0,_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);return _0x372881(_0x2e1ca5['error'][_0xaa5f('0x20')]);}logger[_0xaa5f('0x1d')](_0xaa5f('0x1f'),_0x252ae0,_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);return _0x552c53(_0x2e1ca5[_0xaa5f('0x1d')][_0xaa5f('0x20')]);}else{logger[_0xaa5f('0x21')](_0xaa5f('0x1f'),_0x252ae0,_0xaa5f('0x19'));_0x552c53(_0x2e1ca5[_0xaa5f('0x22')][_0xaa5f('0x20')]);}})[_0xaa5f('0x23')](function(_0x5238a8){logger[_0xaa5f('0x1d')]('OpenchannelAccount,\x20%s,\x20%s',_0x252ae0,_0x5238a8);_0x372881(_0x5238a8);});});}function respondWithStatusCode(_0x2e04e6,_0x34ca72){_0x34ca72=_0x34ca72||0xcc;return function(_0x561381){if(_0x561381){return _0x2e04e6[_0xaa5f('0x24')](_0x34ca72);}return _0x2e04e6[_0xaa5f('0x25')](_0x34ca72)['end']();};}function respondWithResult(_0xf6a8c3,_0x15f70b){_0x15f70b=_0x15f70b||0xc8;return function(_0x32cd16){if(_0x32cd16){return _0xf6a8c3[_0xaa5f('0x25')](_0x15f70b)[_0xaa5f('0x26')](_0x32cd16);}};}function respondWithFilteredResult(_0xacbded,_0x3d7bca){return function(_0x2fba7d){if(_0x2fba7d){var _0x51eb55=_0x2fba7d['count'],_0x2445a6=_0x3d7bca[_0xaa5f('0x27')],_0x3a66e8=_0x3d7bca[_0xaa5f('0x27')]+_0x3d7bca[_0xaa5f('0x28')],_0x1ed8eb;if(_0x3a66e8>=_0x51eb55){_0x3a66e8=_0x51eb55;_0x1ed8eb=0xc8;}else{_0x1ed8eb=0xce;}_0xacbded['status'](_0x1ed8eb);return _0xacbded[_0xaa5f('0x29')]('Content-Range',_0x2445a6+'-'+_0x3a66e8+'/'+_0x51eb55)['json'](_0x2fba7d);}return null;};}function patchUpdates(_0x27d1a4){return function(_0x50998f){try{jsonpatch[_0xaa5f('0x2a')](_0x50998f,_0x27d1a4,!![]);}catch(_0x4e0ec9){return BPromise['reject'](_0x4e0ec9);}return _0x50998f['save']();};}function saveUpdates(_0x26a90d,_0x4ddebd){return function(_0x310828){if(_0x310828){return _0x310828[_0xaa5f('0x2b')](_0x26a90d)['then'](function(_0x58f608){return _0x58f608;});}return null;};}function removeEntity(_0x169637,_0x5e858a){return function(_0x13e1bb){if(_0x13e1bb){return _0x13e1bb[_0xaa5f('0x2c')]()['then'](function(){_0x169637[_0xaa5f('0x25')](0xcc)[_0xaa5f('0x2d')]();});}};}function handleEntityNotFound(_0x9c733b,_0x5d3f84){return function(_0xecaac7){if(!_0xecaac7){_0x9c733b[_0xaa5f('0x24')](0x194);}return _0xecaac7;};}function handleError(_0x527866,_0x57591f){_0x57591f=_0x57591f||0x1f4;return function(_0x586210){logger['error'](_0x586210[_0xaa5f('0x2e')]);if(_0x586210[_0xaa5f('0x2f')]){delete _0x586210[_0xaa5f('0x2f')];}_0x527866[_0xaa5f('0x25')](_0x57591f)[_0xaa5f('0x30')](_0x586210);};}exports[_0xaa5f('0x31')]=function(_0x3887dd,_0x501dc3){var _0x1ab07f={},_0x32a678={},_0x440845={'count':0x0,'rows':[]};var _0x1f3268=db[_0xaa5f('0x32')][_0xaa5f('0x33')];_0x32a678['model']=_[_0xaa5f('0x34')](_0x1f3268);var _0x3131c2={'dateStart':_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x36')],'dateEnd':_0x3887dd[_0xaa5f('0x35')]['dateEnd']};delete _0x3887dd['query'][_0xaa5f('0x36')];delete _0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x37')];_0x32a678[_0xaa5f('0x35')]=_['keys'](_0x3887dd[_0xaa5f('0x35')]);_0x32a678[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x32a678[_0xaa5f('0x3a')],_0x32a678[_0xaa5f('0x35')]);_0x1ab07f[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x32a678[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x1ab07f['attributes']=_0x1ab07f[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x1ab07f[_0xaa5f('0x3b')]:_0x32a678[_0xaa5f('0x3a')];if(!_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x1ab07f[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x3887dd[_0xaa5f('0x35')]['limit']);_0x1ab07f[_0xaa5f('0x27')]=qs['offset'](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x27')]);}_0x1ab07f[_0xaa5f('0x40')]=qs['sort'](_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x1ab07f[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x3887dd[_0xaa5f('0x35')],_0x32a678[_0xaa5f('0x38')]));if(_0x3131c2[_0xaa5f('0x36')]){if(_0x3131c2['dateEnd']){_0x3131c2[_0xaa5f('0x37')]=moment(_0x3131c2[_0xaa5f('0x37')])[_0xaa5f('0x44')](0x1,_0xaa5f('0x45'));}else{_0x3131c2[_0xaa5f('0x37')]=moment(_0x3131c2[_0xaa5f('0x36')])[_0xaa5f('0x44')](0x1,_0xaa5f('0x45'));}_['merge'](_0x1ab07f[_0xaa5f('0x42')],{'createdAt':{'$gte':_0x3131c2['dateStart'],'$lte':_0x3131c2[_0xaa5f('0x37')]}});}if(_0x3887dd['query'][_0xaa5f('0x46')]){_0x1ab07f[_0xaa5f('0x42')]=_['merge'](_0x1ab07f[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x1ab07f[_0xaa5f('0x3b')],function(_0x5151ce){var _0x53343a={};_0x53343a[_0x5151ce]={'$like':'%'+_0x3887dd['query'][_0xaa5f('0x46')]+'%'};return _0x53343a;})});}_0x1ab07f=_['merge']({},_0x1ab07f,_0x3887dd[_0xaa5f('0x48')]);var _0x44600c={'where':_0x1ab07f[_0xaa5f('0x42')]};return db[_0xaa5f('0x32')]['count'](_0x44600c)[_0xaa5f('0x18')](function(_0x187542){_0x440845[_0xaa5f('0x49')]=_0x187542;if(_0x3887dd[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x1ab07f[_0xaa5f('0x4b')]=[{'all':!![]}];}return db[_0xaa5f('0x32')][_0xaa5f('0x4c')](_0x1ab07f);})[_0xaa5f('0x18')](function(_0x16f8bf){_0x440845[_0xaa5f('0x4d')]=_0x16f8bf;return _0x440845;})[_0xaa5f('0x18')](respondWithFilteredResult(_0x501dc3,_0x1ab07f))[_0xaa5f('0x23')](handleError(_0x501dc3,null));};exports[_0xaa5f('0x4e')]=function(_0x690fcc,_0x803c2d){var _0x554e6d={'raw':![],'where':{'id':_0x690fcc[_0xaa5f('0x4f')]['id']}},_0x3412f8={};_0x3412f8[_0xaa5f('0x3a')]=_[_0xaa5f('0x34')](db[_0xaa5f('0x32')][_0xaa5f('0x33')]);_0x3412f8[_0xaa5f('0x35')]=_['keys'](_0x690fcc[_0xaa5f('0x35')]);_0x3412f8[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x3412f8[_0xaa5f('0x3a')],_0x3412f8['query']);_0x554e6d[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x3412f8[_0xaa5f('0x3a')],qs['fields'](_0x690fcc['query']['fields']));_0x554e6d['attributes']=_0x554e6d['attributes']['length']?_0x554e6d[_0xaa5f('0x3b')]:_0x3412f8[_0xaa5f('0x3a')];if(_0x690fcc[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x554e6d[_0xaa5f('0x4b')]=[{'all':!![]}];}_0x554e6d=_[_0xaa5f('0x50')]({},_0x554e6d,_0x690fcc['options']);return db['OpenchannelAccount'][_0xaa5f('0x51')](_0x554e6d)[_0xaa5f('0x18')](handleEntityNotFound(_0x803c2d,null))['then'](respondWithResult(_0x803c2d,null))[_0xaa5f('0x23')](handleError(_0x803c2d,null));};exports[_0xaa5f('0x52')]=function(_0x2b815d,_0x294657){return db[_0xaa5f('0x32')][_0xaa5f('0x52')](_0x2b815d[_0xaa5f('0x53')],{})['then'](respondWithResult(_0x294657,0xc9))['catch'](handleError(_0x294657,null));};exports[_0xaa5f('0x2b')]=function(_0x2ba3e6,_0x5da797){if(_0x2ba3e6['body']['id']){delete _0x2ba3e6['body']['id'];}return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x2ba3e6[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5da797,null))['then'](saveUpdates(_0x2ba3e6[_0xaa5f('0x53')],null))[_0xaa5f('0x18')](respondWithResult(_0x5da797,null))[_0xaa5f('0x23')](handleError(_0x5da797,null));};exports['destroy']=function(_0x3630c2,_0x239e51){return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x3630c2[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x239e51,null))['then'](removeEntity(_0x239e51,null))[_0xaa5f('0x23')](handleError(_0x239e51,null));};exports[_0xaa5f('0x54')]=function(_0x455702,_0x3fdc46){return db[_0xaa5f('0x32')][_0xaa5f('0x54')]()[_0xaa5f('0x18')](respondWithResult(_0x3fdc46,null))[_0xaa5f('0x23')](handleError(_0x3fdc46,null));};exports[_0xaa5f('0x55')]=function(_0x5ed3b8,_0x7e4313,_0x199360){if(_0x5ed3b8[_0xaa5f('0x53')]['id']){delete _0x5ed3b8[_0xaa5f('0x53')]['id'];}return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x5ed3b8[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x7e4313,null))['then'](function(_0x436b9e){if(_0x436b9e){_0x5ed3b8['body'][_0xaa5f('0x56')]=_0x436b9e['id'];return db[_0xaa5f('0x57')][_0xaa5f('0x52')](_0x5ed3b8[_0xaa5f('0x53')]);}})['then'](respondWithResult(_0x7e4313,null))[_0xaa5f('0x23')](handleError(_0x7e4313,null));};exports[_0xaa5f('0x58')]=function(_0x36384b,_0x4cb590,_0x2c5b30){var _0x524f42={'raw':![],'where':{}};var _0x42ea3b={};var _0x5e7a74={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x36384b[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4cb590,null))['then'](function(_0x3f5ced){if(_0x3f5ced){_0x42ea3b[_0xaa5f('0x3a')]=_['keys'](db['Disposition'][_0xaa5f('0x33')]);_0x42ea3b[_0xaa5f('0x35')]=_['keys'](_0x36384b[_0xaa5f('0x35')]);_0x42ea3b[_0xaa5f('0x38')]=_[_0xaa5f('0x39')](_0x42ea3b['model'],_0x42ea3b[_0xaa5f('0x35')]);_0x524f42[_0xaa5f('0x3b')]=_['intersection'](_0x42ea3b[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x36384b[_0xaa5f('0x35')]['fields']));_0x524f42[_0xaa5f('0x3b')]=_0x524f42[_0xaa5f('0x3b')]['length']?_0x524f42[_0xaa5f('0x3b')]:_0x42ea3b[_0xaa5f('0x3a')];if(!_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x524f42['limit']=qs[_0xaa5f('0x28')](_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x524f42[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x36384b['query'][_0xaa5f('0x27')]);}_0x524f42['order']=qs[_0xaa5f('0x41')](_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x524f42[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x36384b[_0xaa5f('0x35')],_0x42ea3b[_0xaa5f('0x38')]));_0x524f42[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x3f5ced['id'];if(_0x36384b[_0xaa5f('0x35')]['filter']){_0x524f42['where']=_[_0xaa5f('0x50')](_0x524f42[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x524f42[_0xaa5f('0x3b')],function(_0x461cab){var _0x5dc6df={};_0x5dc6df[_0x461cab]={'$like':'%'+_0x36384b['query'][_0xaa5f('0x46')]+'%'};return _0x5dc6df;})});}_0x524f42=_[_0xaa5f('0x50')]({},_0x524f42,_0x36384b['options']);return db[_0xaa5f('0x57')]['count']({'where':_0x524f42[_0xaa5f('0x42')]})[_0xaa5f('0x18')](function(_0x49fd15){_0x5e7a74[_0xaa5f('0x49')]=_0x49fd15;if(_0x36384b[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x524f42[_0xaa5f('0x4b')]=[{'all':!![]}];}return db[_0xaa5f('0x57')][_0xaa5f('0x4c')](_0x524f42);})[_0xaa5f('0x18')](function(_0x59e2be){_0x5e7a74[_0xaa5f('0x4d')]=_0x59e2be;return _0x5e7a74;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x4cb590,_0x524f42))[_0xaa5f('0x23')](handleError(_0x4cb590,null));};exports['removeDispositions']=function(_0x12fedd,_0x1376e1,_0x3c11c7){var _0xf30b84;return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x12fedd[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x1376e1,null))[_0xaa5f('0x18')](function(_0x23cccb){if(_0x23cccb){return _0x23cccb[_0xaa5f('0x5b')](_0x12fedd[_0xaa5f('0x35')][_0xaa5f('0x5c')]);}})[_0xaa5f('0x18')](respondWithStatusCode(_0x1376e1,null))[_0xaa5f('0x23')](handleError(_0x1376e1,null));};exports[_0xaa5f('0x5d')]=function(_0x47bf08,_0x4f24f9,_0xb7292d){if(_0x47bf08[_0xaa5f('0x53')]['id']){delete _0x47bf08[_0xaa5f('0x53')]['id'];}return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x47bf08[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4f24f9,null))[_0xaa5f('0x18')](function(_0x59c314){if(_0x59c314){_0x47bf08[_0xaa5f('0x53')][_0xaa5f('0x5a')]=_0x59c314['id'];return db[_0xaa5f('0x5e')]['create'](_0x47bf08['body']);}})[_0xaa5f('0x18')](respondWithResult(_0x4f24f9,null))[_0xaa5f('0x23')](handleError(_0x4f24f9,null));};exports[_0xaa5f('0x5f')]=function(_0x2ccb31,_0x31e252,_0x46d08b){var _0x47786e={'raw':![],'where':{}};var _0x284194={};var _0x39c2d5={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')]['findOne']({'where':{'id':_0x2ccb31[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x31e252,null))[_0xaa5f('0x18')](function(_0x46ab86){if(_0x46ab86){_0x284194[_0xaa5f('0x3a')]=_['keys'](db[_0xaa5f('0x5e')][_0xaa5f('0x33')]);_0x284194[_0xaa5f('0x35')]=_['keys'](_0x2ccb31['query']);_0x284194['filters']=_[_0xaa5f('0x39')](_0x284194[_0xaa5f('0x3a')],_0x284194[_0xaa5f('0x35')]);_0x47786e[_0xaa5f('0x3b')]=_['intersection'](_0x284194[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x47786e[_0xaa5f('0x3b')]=_0x47786e[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x47786e[_0xaa5f('0x3b')]:_0x284194[_0xaa5f('0x3a')];if(!_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x3e')](_0xaa5f('0x3f'))){_0x47786e[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x47786e[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x2ccb31[_0xaa5f('0x35')]['offset']);}_0x47786e[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x47786e[_0xaa5f('0x42')]=qs['filters'](_[_0xaa5f('0x43')](_0x2ccb31['query'],_0x284194[_0xaa5f('0x38')]));_0x47786e[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x46ab86['id'];if(_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x46')]){_0x47786e[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x47786e['where'],{'$or':_[_0xaa5f('0x47')](_0x47786e['attributes'],function(_0x9f4d9d){var _0x40f2fa={};_0x40f2fa[_0x9f4d9d]={'$like':'%'+_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x46')]+'%'};return _0x40f2fa;})});}_0x47786e=_['merge']({},_0x47786e,_0x2ccb31[_0xaa5f('0x48')]);return db['CannedAnswer'][_0xaa5f('0x49')]({'where':_0x47786e['where']})[_0xaa5f('0x18')](function(_0x517b5b){_0x39c2d5[_0xaa5f('0x49')]=_0x517b5b;if(_0x2ccb31[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x47786e[_0xaa5f('0x4b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xaa5f('0x4c')](_0x47786e);})['then'](function(_0x21d7b5){_0x39c2d5[_0xaa5f('0x4d')]=_0x21d7b5;return _0x39c2d5;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x31e252,_0x47786e))[_0xaa5f('0x23')](handleError(_0x31e252,null));};exports[_0xaa5f('0x60')]=function(_0x59196a,_0x25f710,_0x1e74dc){var _0x226e45;return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x59196a[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x25f710,null))[_0xaa5f('0x18')](function(_0x46b920){if(_0x46b920){return _0x46b920['removeAnswers'](_0x59196a[_0xaa5f('0x35')][_0xaa5f('0x5c')]);}})[_0xaa5f('0x18')](respondWithStatusCode(_0x25f710,null))[_0xaa5f('0x23')](handleError(_0x25f710,null));};exports[_0xaa5f('0x61')]=function(_0x4acc9c,_0xf707e6,_0x17e27c){var _0x4d368d={'body':_0x4acc9c[_0xaa5f('0x53')],'channel':_0xaa5f('0x62')};var _0x476a2b=[];var _0x4c4378=[];var _0x4b10ac={};var _0x130c6b=![];return db['CmContact']['describe']()['then'](function(_0x599a7c){if(!_0x599a7c){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x476a2b=_['difference'](_[_0xaa5f('0x34')](_0x599a7c),[_0xaa5f('0x63'),_0xaa5f('0x64')]);_0x4c4378=_['difference'](_[_0xaa5f('0x34')](_0x599a7c),[_0xaa5f('0x63'),_0xaa5f('0x64'),'CompanyId',_0xaa5f('0x65')]);if(_0x4acc9c[_0xaa5f('0x53')]['id']){delete _0x4acc9c[_0xaa5f('0x53')]['id'];}if(_['isNil'](_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')])){throw new db['Sequelize'][(_0xaa5f('0x67'))](_0xaa5f('0x68'));}if(_[_0xaa5f('0x69')](_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')])||_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')]===''){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xaa5f('0x69')](_0x4acc9c[_0xaa5f('0x53')]['mapKey'])){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))](_0xaa5f('0x6b')+_0x4c4378);}if(!_[_0xaa5f('0x6c')](_0x4c4378,_0x4acc9c['body'][_0xaa5f('0x6d')])){throw new db[(_0xaa5f('0x6a'))][(_0xaa5f('0x67'))](_0xaa5f('0x6e')+_0x4c4378);}_0x4b10ac[_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x6d')]]=_0x4acc9c[_0xaa5f('0x53')]['from'];})['then'](function(){return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x4acc9c[_0xaa5f('0x4f')]['id']},'include':[{'model':db[_0xaa5f('0x6f')],'as':_0xaa5f('0x70'),'include':[{'model':db[_0xaa5f('0x71')],'as':_0xaa5f('0x72'),'where':_0x4b10ac,'limit':0x1,'order':[[_0xaa5f('0x64'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0xaa5f('0x73')}]});})[_0xaa5f('0x18')](handleEntityNotFound(_0xf707e6,null))['then'](function(_0x2303ef){if(_0x2303ef&&_0x2303ef[_0xaa5f('0x70')]){_0x4d368d['account']=_0x2303ef;_0x4d368d[_0xaa5f('0x74')]=_0x2303ef[_0xaa5f('0x73')];_0x4d368d[_0xaa5f('0x75')]=_0x2303ef[_0xaa5f('0x70')];_0x4d368d[_0xaa5f('0x74')]=_['orderBy'](_0x4d368d[_0xaa5f('0x74')],['priority'],[_0xaa5f('0x76')]);if(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x73')]){delete _0x4d368d['account'][_0xaa5f('0x73')];}if(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')]&&_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')][_0xaa5f('0x72')][_0xaa5f('0x3d')]){return _0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x70')][_0xaa5f('0x72')][0x0];}var _0x51757b=_[_0xaa5f('0x78')](_0x4acc9c[_0xaa5f('0x53')],{'firstName':_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')],'ListId':_0x2303ef['ListId']});_0x51757b[_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x6d')]]=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x66')];return db['CmContact']['create'](_0x51757b,{'fields':_0x476a2b,'raw':!![]});}})[_0xaa5f('0x18')](handleEntityNotFound(_0xf707e6,null))[_0xaa5f('0x18')](function(_0x513a69){_0x4d368d['contact']=_0x513a69;if(_0x513a69){var _0xcc51f5={'ContactId':_0x513a69['id'],'OpenchannelAccountId':_0x4acc9c['params']['id'],'from':(_0x513a69[_0xaa5f('0x79')]||'')+'\x20'+(_0x513a69[_0xaa5f('0x7a')]||'')};var _0x11fc30={'OpenchannelAccountId':_0x4acc9c[_0xaa5f('0x4f')]['id'],'closed':![]};if(_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7b')]){_0x11fc30[_0xaa5f('0x7b')]=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7b')];return db[_0xaa5f('0x7c')]['find']({'where':_0x11fc30})[_0xaa5f('0x18')](function(_0x23a565){if(_0x23a565){return[_0x23a565,![]];}_0xcc51f5['threadId']=_0x4acc9c[_0xaa5f('0x53')]['threadId'];_0xcc51f5['externalUrl']=_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x7d')];return db[_0xaa5f('0x7c')][_0xaa5f('0x52')](_0xcc51f5)[_0xaa5f('0x18')](function(_0x316e19){return[_0x316e19,!![]];});});}else{_0x11fc30[_0xaa5f('0x7b')]=null;}_0x11fc30['ContactId']=_0x513a69['id'];return db[_0xaa5f('0x7c')][_0xaa5f('0x51')]({'where':_0x11fc30})['then'](function(_0x3c4e40){if(_0x3c4e40){return[_0x3c4e40,![]];}return db[_0xaa5f('0x7c')][_0xaa5f('0x52')](_0xcc51f5)[_0xaa5f('0x18')](function(_0xf4bae){return[_0xf4bae,!![]];});});}})[_0xaa5f('0x7e')](function(_0x1f06f6,_0x4859fe){if(_0x1f06f6){_0x130c6b=_0x4859fe;if(!_0x4859fe){return _0x1f06f6[_0xaa5f('0x2b')]({'from':(_0x4d368d['contact'][_0xaa5f('0x79')]||'')+'\x20'+(_0x4d368d['contact'][_0xaa5f('0x7a')]||'')});}else{return _0x1f06f6;}}})[_0xaa5f('0x18')](function(_0x5943b7){_0x4d368d['interaction']=_0x5943b7[_0xaa5f('0x7f')]({'plain':!![]});_0x4d368d['interaction'][_0xaa5f('0x80')]=_0x130c6b;if(_0x4d368d[_0xaa5f('0x81')][_0xaa5f('0x80')]){if(_0x4d368d[_0xaa5f('0x77')]['autoclose']){_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x82')]({'id':0x0,'priority':_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x3d')]+0x1,'app':_0xaa5f('0x83'),'appdata':_0xaa5f('0x84'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0xaa5f('0x52')]({'body':_0x4acc9c[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4acc9c[_0xaa5f('0x4f')]['id'],'OpenchannelInteractionId':_0x5943b7['id'],'direction':'in','ContactId':_0x4d368d['contact']['id'],'AttachmentId':_0x4acc9c['body'][_0xaa5f('0x85')]});})[_0xaa5f('0x18')](function(_0x4b7ca0){_0x4d368d[_0xaa5f('0x20')]=_0x4b7ca0;if(_0x4d368d[_0xaa5f('0x81')][_0xaa5f('0x86')]){return db[_0xaa5f('0x87')]['find']({'attributes':['id',_0xaa5f('0x2f')],'where':{'id':_0x4d368d[_0xaa5f('0x81')]['UserId']}})[_0xaa5f('0x18')](function(_0x252685){if(_0x252685){_0x4d368d[_0xaa5f('0x74')][_0xaa5f('0x88')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x252685['name']+','+(_0x4d368d[_0xaa5f('0x77')][_0xaa5f('0x89')]||0xa),'interval':_0xaa5f('0x8a')});_0x4d368d[_0xaa5f('0x8b')]=![];}return respondWithRpcPromise(_0xaa5f('0x8c'),'startRouting',_0x4d368d);});}return respondWithRpcPromise('Start',_0xaa5f('0x8d'),_0x4d368d);})['then'](function(_0x421a7b){respondWithRpcPromise(_0xaa5f('0x8e'),_0xaa5f('0x8e'),{'event':_0xaa5f('0x61'),'message':_0x421a7b},client9002);return _0x421a7b;})['then'](respondWithResult(_0xf707e6,null))['catch'](handleError(_0xf707e6,null));};exports[_0xaa5f('0x8f')]=function(_0x4a9839,_0x58e77e,_0x3688b5){return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x4a9839[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x58e77e,null))['then'](function(_0x59fa62){if(_0x59fa62){return db['sequelize'][_0xaa5f('0x90')](function(_0xf7c2fd){return db[_0xaa5f('0x91')][_0xaa5f('0x2c')]({'where':{'OpenchannelAccountId':_0x4a9839[_0xaa5f('0x4f')]['id']},'transaction':_0xf7c2fd})[_0xaa5f('0x18')](function(_0x2b1757){var _0x2eb534=_['map'](_0x4a9839[_0xaa5f('0x53')],function(_0x181385){_0x181385[_0xaa5f('0x5a')]=_0x4a9839[_0xaa5f('0x4f')]['id'];return _0x181385;});return db[_0xaa5f('0x91')][_0xaa5f('0x92')](_0x2eb534,{'transaction':_0xf7c2fd});});})[_0xaa5f('0x18')](function(){return db[_0xaa5f('0x91')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x4a9839[_0xaa5f('0x4f')]['id']},'order':_0xaa5f('0x93')});});}})[_0xaa5f('0x18')](respondWithResult(_0x58e77e,null))['catch'](handleError(_0x58e77e,null));};exports[_0xaa5f('0x94')]=function(_0x34ca25,_0x743731,_0x12a749){var _0x5440c7={};var _0x14ee5f={};var _0x32566a;var _0x520063;return db['OpenchannelAccount'][_0xaa5f('0x59')]({'where':{'id':_0x34ca25[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x743731,null))[_0xaa5f('0x18')](function(_0x21f370){if(_0x21f370){_0x32566a=_0x21f370;_0x14ee5f[_0xaa5f('0x3a')]=_['keys'](db[_0xaa5f('0x91')]['rawAttributes']);_0x14ee5f[_0xaa5f('0x35')]=_['keys'](_0x34ca25[_0xaa5f('0x35')]);_0x14ee5f['filters']=_[_0xaa5f('0x39')](_0x14ee5f['model'],_0x14ee5f[_0xaa5f('0x35')]);_0x5440c7[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x14ee5f['model'],qs[_0xaa5f('0x3c')](_0x34ca25['query']['fields']));_0x5440c7[_0xaa5f('0x3b')]=_0x5440c7[_0xaa5f('0x3b')][_0xaa5f('0x3d')]?_0x5440c7['attributes']:_0x14ee5f[_0xaa5f('0x3a')];_0x5440c7[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x34ca25[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x5440c7[_0xaa5f('0x42')]=qs[_0xaa5f('0x38')](_[_0xaa5f('0x43')](_0x34ca25[_0xaa5f('0x35')],_0x14ee5f[_0xaa5f('0x38')]));if(_0x34ca25[_0xaa5f('0x35')]['filter']){_0x5440c7[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x5440c7[_0xaa5f('0x42')],{'$or':_[_0xaa5f('0x47')](_0x5440c7[_0xaa5f('0x3b')],function(_0x495252){var _0xa182b7={};_0xa182b7[_0x495252]={'$like':'%'+_0x34ca25['query'][_0xaa5f('0x46')]+'%'};return _0xa182b7;})});}_0x5440c7=_['merge']({},_0x5440c7,_0x34ca25[_0xaa5f('0x48')]);return _0x32566a['getApplications'](_0x5440c7);}})[_0xaa5f('0x18')](function(_0x18eeb5){if(_0x18eeb5){_0x520063=_0x18eeb5[_0xaa5f('0x3d')];if(!_0x34ca25[_0xaa5f('0x35')]['hasOwnProperty']('nolimit')){_0x5440c7[_0xaa5f('0x28')]=qs[_0xaa5f('0x28')](_0x34ca25['query'][_0xaa5f('0x28')]);_0x5440c7[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x34ca25[_0xaa5f('0x35')][_0xaa5f('0x27')]);}return _0x32566a[_0xaa5f('0x94')](_0x5440c7);}})[_0xaa5f('0x18')](function(_0x1914d9){if(_0x1914d9){return _0x1914d9?{'count':_0x520063,'rows':_0x1914d9}:null;}})[_0xaa5f('0x18')](respondWithResult(_0x743731,null))[_0xaa5f('0x23')](handleError(_0x743731,null));};exports[_0xaa5f('0x95')]=function(_0x280edc,_0x4f81b4,_0x5564d5){var _0x478c82={'raw':![],'where':{}};var _0x2b5c02={};var _0x443fcb={'count':0x0,'rows':[]};return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x280edc['params']['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x4f81b4,null))[_0xaa5f('0x18')](function(_0x3a989d){if(_0x3a989d){_0x2b5c02['model']=_['keys'](db[_0xaa5f('0x7c')]['rawAttributes']);_0x2b5c02['query']=_['keys'](_0x280edc[_0xaa5f('0x35')]);_0x2b5c02['filters']=_[_0xaa5f('0x39')](_0x2b5c02[_0xaa5f('0x3a')],_0x2b5c02[_0xaa5f('0x35')]);_0x478c82[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x2b5c02[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x478c82[_0xaa5f('0x3b')]=_0x478c82['attributes'][_0xaa5f('0x3d')]?_0x478c82[_0xaa5f('0x3b')]:_0x2b5c02[_0xaa5f('0x3a')];if(!_0x280edc[_0xaa5f('0x35')]['hasOwnProperty'](_0xaa5f('0x3f'))){_0x478c82[_0xaa5f('0x28')]=qs['limit'](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x28')]);_0x478c82[_0xaa5f('0x27')]=qs[_0xaa5f('0x27')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x27')]);}_0x478c82[_0xaa5f('0x40')]=qs[_0xaa5f('0x41')](_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x41')]);_0x478c82['where']=qs['filters'](_[_0xaa5f('0x43')](_0x280edc[_0xaa5f('0x35')],_0x2b5c02[_0xaa5f('0x38')]));_0x478c82[_0xaa5f('0x42')][_0xaa5f('0x5a')]=_0x3a989d['id'];if(_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x46')]){_0x478c82[_0xaa5f('0x42')]=_[_0xaa5f('0x50')](_0x478c82['where'],{'$or':_[_0xaa5f('0x47')](_0x478c82[_0xaa5f('0x3b')],function(_0x4bc495){var _0x1d02c8={};_0x1d02c8[_0x4bc495]={'$like':'%'+_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x46')]+'%'};return _0x1d02c8;})});}_0x478c82=_[_0xaa5f('0x50')]({},_0x478c82,_0x280edc[_0xaa5f('0x48')]);return db[_0xaa5f('0x7c')][_0xaa5f('0x49')]({'where':_0x478c82['where']})[_0xaa5f('0x18')](function(_0x460ac8){_0x443fcb[_0xaa5f('0x49')]=_0x460ac8;if(_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x4a')]){_0x478c82[_0xaa5f('0x4b')]=[{'model':db[_0xaa5f('0x71')],'as':_0xaa5f('0x96'),'required':![]},{'model':db['User'],'as':_0xaa5f('0x97'),'attributes':['name',_0xaa5f('0x98'),'internal'],'required':![]},{'model':db[_0xaa5f('0x99')],'as':_0xaa5f('0x9a'),'attributes':['id',_0xaa5f('0x2f'),'color'],'where':_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x9b')]?{'id':_0x280edc['query'][_0xaa5f('0x9b')]}:undefined,'required':_0x280edc[_0xaa5f('0x35')][_0xaa5f('0x9b')]?!![]:![]}];}return db['OpenchannelInteraction'][_0xaa5f('0x4c')](_0x478c82);})['then'](function(_0x391eda){_0x443fcb['rows']=_0x391eda;return _0x443fcb;});}})[_0xaa5f('0x18')](respondWithFilteredResult(_0x4f81b4,_0x478c82))['catch'](handleError(_0x4f81b4,null));};exports['addAgents']=function(_0x286cc1,_0x35bb9a,_0x1786aa){return db['OpenchannelAccount'][_0xaa5f('0x51')]({'where':{'id':_0x286cc1['params']['id']}})['then'](handleEntityNotFound(_0x35bb9a,null))[_0xaa5f('0x18')](function(_0x3d9bb7){if(_0x3d9bb7){return _0x3d9bb7[_0xaa5f('0x9c')](_0x286cc1[_0xaa5f('0x53')][_0xaa5f('0x5c')],_[_0xaa5f('0x9d')](_0x286cc1['body'],[_0xaa5f('0x5c'),'id'])||{})['spread'](function(_0x371b3b){for(var _0x1e04f2=0x0;_0x1e04f2<_0x286cc1[_0xaa5f('0x53')][_0xaa5f('0x5c')][_0xaa5f('0x3d')];_0x1e04f2+=0x1){socket[_0xaa5f('0x9e')](_0xaa5f('0x9f'),{'UserId':_0x286cc1[_0xaa5f('0x53')]['ids'][_0x1e04f2],'OpenchannelAccountId':_0x286cc1[_0xaa5f('0x4f')]['id']});}return _0x371b3b;});}})[_0xaa5f('0x18')](respondWithResult(_0x35bb9a,null))['catch'](handleError(_0x35bb9a,null));};exports[_0xaa5f('0xa0')]=function(_0x47330c,_0x1ed576,_0x4ad337){var _0xbf76b6;return db[_0xaa5f('0x32')][_0xaa5f('0x51')]({'where':{'id':_0x47330c[_0xaa5f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1ed576,null))['then'](function(_0x448a2d){if(_0x448a2d){return _0x448a2d[_0xaa5f('0xa0')](_0x47330c[_0xaa5f('0x35')]['ids'])[_0xaa5f('0x18')](function(_0x3562d0){if(_['isArray'](_0x47330c[_0xaa5f('0x35')][_0xaa5f('0x5c')])){for(var _0x3e8ad1=0x0;_0x3e8ad1<_0x47330c[_0xaa5f('0x35')][_0xaa5f('0x5c')][_0xaa5f('0x3d')];_0x3e8ad1+=0x1){socket[_0xaa5f('0x9e')](_0xaa5f('0xa1'),{'UserId':_0x47330c['query'][_0xaa5f('0x5c')][_0x3e8ad1],'OpenchannelAccountId':_0x47330c[_0xaa5f('0x4f')]['id']});}}else{socket[_0xaa5f('0x9e')](_0xaa5f('0xa1'),{'UserId':_0x47330c[_0xaa5f('0x35')]['ids'],'OpenchannelAccountId':_0x47330c[_0xaa5f('0x4f')]['id']});}});}})[_0xaa5f('0x18')](respondWithStatusCode(_0x1ed576,null))[_0xaa5f('0x23')](handleError(_0x1ed576,null));};exports[_0xaa5f('0xa2')]=function(_0x5a7eae,_0x406f9f,_0x3d6848){var _0x3252fd={};var _0x56a6eb={};var _0x34bef5;var _0x36a092;return db['OpenchannelAccount'][_0xaa5f('0x59')]({'where':{'id':_0x5a7eae[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x406f9f,null))[_0xaa5f('0x18')](function(_0x49304e){if(_0x49304e){_0x34bef5=_0x49304e;_0x56a6eb[_0xaa5f('0x3a')]=_[_0xaa5f('0x34')](db['User']['rawAttributes']);_0x56a6eb[_0xaa5f('0x35')]=_[_0xaa5f('0x34')](_0x5a7eae[_0xaa5f('0x35')]);_0x56a6eb['filters']=_[_0xaa5f('0x39')](_0x56a6eb[_0xaa5f('0x3a')],_0x56a6eb['query']);_0x3252fd[_0xaa5f('0x3b')]=_[_0xaa5f('0x39')](_0x56a6eb[_0xaa5f('0x3a')],qs[_0xaa5f('0x3c')](_0x5a7eae[_0xaa5f('0x35')][_0xaa5f('0x3c')]));_0x3252fd['attributes']=_0x3252fd[_0xaa5f('0x3b')]['length']?_0x3252fd[_0xaa5f('0x3b')]:_0x56a6eb['model'];_0x3252fd[_0xaa5f('0x40')]=qs['sort'](_0x5a7eae[_0xaa5f('0x35')]['sort']);_0x3252fd[_0xaa5f('0x42')]=qs[_0xaa5f('0x38')](_[_0xaa5f('0x43')](_0x5a7eae[_0xaa5f('0x35')],_0x56a6eb[_0xaa5f('0x38')]));if(_0x5a7eae[_0xaa5f('0x35')]['filter']){_0x3252fd[_0xaa5f('0x42')]=_['merge'](_0x3252fd['where'],{'$or':_[_0xaa5f('0x47')](_0x3252fd[_0xaa5f('0x3b')],function(_0x50c3ef){var _0x5f6900={};_0x5f6900[_0x50c3ef]={'$like':'%'+_0x5a7eae['query'][_0xaa5f('0x46')]+'%'};return _0x5f6900;})});}_0x3252fd=_[_0xaa5f('0x50')]({},_0x3252fd,_0x5a7eae[_0xaa5f('0x48')]);return _0x34bef5['getAgents'](_0x3252fd);}})['then'](function(_0x489ad1){if(_0x489ad1){_0x36a092=_0x489ad1['length'];if(!_0x5a7eae[_0xaa5f('0x35')]['hasOwnProperty'](_0xaa5f('0x3f'))){_0x3252fd[_0xaa5f('0x28')]=qs['limit'](_0x5a7eae[_0xaa5f('0x35')]['limit']);_0x3252fd[_0xaa5f('0x27')]=qs['offset'](_0x5a7eae['query']['offset']);}return _0x34bef5[_0xaa5f('0xa2')](_0x3252fd);}})[_0xaa5f('0x18')](function(_0x3655de){if(_0x3655de){return _0x3655de?{'count':_0x36a092,'rows':_0x3655de}:null;}})[_0xaa5f('0x18')](respondWithResult(_0x406f9f,null))[_0xaa5f('0x23')](handleError(_0x406f9f,null));};exports[_0xaa5f('0x30')]=function(_0x4117cc,_0x138b9d,_0x749d19){var _0xf3f12d,_0x4f12a6,_0x1c1495;if(_['isNil'](_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')])||_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')]===''){throw new db['Sequelize'][(_0xaa5f('0x67'))](_0xaa5f('0xa3'));}if(_[_0xaa5f('0x69')](_0x4117cc[_0xaa5f('0x53')]['to'])){}_0xf3f12d=_0x4117cc[_0xaa5f('0x53')]['to'];return db[_0xaa5f('0x32')][_0xaa5f('0x59')]({'where':{'id':_0x4117cc[_0xaa5f('0x4f')]['id']}})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))[_0xaa5f('0x18')](function(_0x484172){if(_0x484172){return db[_0xaa5f('0x32')]['find']({'where':{'id':_0x484172['id']},'include':[{'model':db['CmList'],'as':_0xaa5f('0x70'),'include':[{'model':db[_0xaa5f('0x71')],'as':'Contacts','where':{[_0x484172[_0xaa5f('0x6d')]]:_0xf3f12d},'limit':0x1,'order':[[_0xaa5f('0x64'),_0xaa5f('0xa4')]]}]}]})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))[_0xaa5f('0x18')](function(_0x9dc8ff){if(_0x9dc8ff&&_0x9dc8ff['List']){_0x4f12a6=_0x9dc8ff[_0xaa5f('0x7f')]({'plain':!![]});if(_0x4f12a6[_0xaa5f('0x70')]&&_0x4f12a6[_0xaa5f('0x70')]['Contacts'][_0xaa5f('0x3d')]){return _0x4f12a6[_0xaa5f('0x70')][_0xaa5f('0x72')][0x0];}return db[_0xaa5f('0x71')]['create'](_['defaults'](_0x4117cc[_0xaa5f('0x53')],{'firstName':_0xf3f12d,[_0x9dc8ff[_0xaa5f('0x6d')]]:_0xf3f12d,'phone':_0xf3f12d,'ListId':_0x4f12a6[_0xaa5f('0x65')]}));}})[_0xaa5f('0x18')](handleEntityNotFound(_0x138b9d,null))['then'](function(_0x2f79c1){if(_0x2f79c1){_0x1c1495=_0x2f79c1;return db['OpenchannelInteraction'][_0xaa5f('0x51')]({'where':{'ContactId':_0x1c1495['id'],'closed':![],'OpenchannelAccountId':_0x4f12a6['id']}})[_0xaa5f('0x18')](function(_0x5b7e9c){if(_0x5b7e9c){return[_0x5b7e9c,![]];}return db['OpenchannelInteraction'][_0xaa5f('0x52')]({'UserId':_0x4117cc[_0xaa5f('0xa5')]['id'],'ContactId':_0x1c1495['id'],'OpenchannelAccountId':_0x4f12a6['id'],'lastMsgDirection':'out','Messages':[_[_0xaa5f('0x50')](_0x4117cc[_0xaa5f('0x53')],{'read':![],'body':_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4f12a6['id'],'UserId':_0x4117cc['user']['id'],'ContactId':_0x1c1495['id']})]},{'include':[{'model':db[_0xaa5f('0xa6')],'as':_0xaa5f('0xa7')}]})[_0xaa5f('0x18')](function(_0xcc3b77){return[_0xcc3b77,!![]];});});}})[_0xaa5f('0x7e')](function(_0x32b547,_0x33703a){if(_0x33703a){return _0x32b547;}return db['OpenchannelMessage'][_0xaa5f('0x52')](_[_0xaa5f('0x50')](_0x4117cc['body'],{'read':![],'body':_0x4117cc[_0xaa5f('0x53')][_0xaa5f('0x53')],'OpenchannelAccountId':_0x4f12a6['id'],'OpenchannelInteractionId':_0x32b547['id'],'UserId':_0x4117cc['user']['id'],'ContactId':_0x1c1495['id']}))[_0xaa5f('0x18')](function(_0x4f0619){_0x32b547[_0xaa5f('0xa8')]['Messages']=[];_0x32b547[_0xaa5f('0xa8')][_0xaa5f('0xa7')]['push'](_0x4f0619['dataValues']);return _0x32b547;});});}})[_0xaa5f('0x18')](respondWithResult(_0x138b9d,null))[_0xaa5f('0x23')](handleError(_0x138b9d,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index da8e493..d67ee56 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 _0x575f=['save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','OpenchannelAccount','setMaxListeners'];(function(_0x35decb,_0x2c7932){var _0xca0580=function(_0x2cdcb6){while(--_0x2cdcb6){_0x35decb['push'](_0x35decb['shift']());}};_0xca0580(++_0x2c7932);}(_0x575f,0xb1));var _0xf575=function(_0x718a85,_0x5272fb){_0x718a85=_0x718a85-0x0;var _0x180486=_0x575f[_0x718a85];return _0x180486;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf575('0x0'))['db'][_0xf575('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf575('0x2')](0x0);var events={'afterCreate':_0xf575('0x3'),'afterUpdate':_0xf575('0x4'),'afterDestroy':_0xf575('0x5')};function emitEvent(_0x42d68d){return function(_0x4b31f0,_0x30cc1d,_0x38b559){OpenchannelAccountEvents['emit'](_0x42d68d+':'+_0x4b31f0['id'],_0x4b31f0);OpenchannelAccountEvents[_0xf575('0x6')](_0x42d68d,_0x4b31f0);_0x38b559(null);};}for(var e in events){if(events[_0xf575('0x7')](e)){var event=events[e];OpenchannelAccount[_0xf575('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file +var _0xdccc=['remove','emit','hasOwnProperty','hook','events','OpenchannelAccount','setMaxListeners','update'];(function(_0x1e54a7,_0x4e7ea3){var _0x41d78e=function(_0xbf0801){while(--_0xbf0801){_0x1e54a7['push'](_0x1e54a7['shift']());}};_0x41d78e(++_0x4e7ea3);}(_0xdccc,0x144));var _0xcdcc=function(_0x4df16c,_0x540635){_0x4df16c=_0x4df16c-0x0;var _0x165da9=_0xdccc[_0x4df16c];return _0x165da9;};'use strict';var EventEmitter=require(_0xcdcc('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xcdcc('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xcdcc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcdcc('0x3'),'afterDestroy':_0xcdcc('0x4')};function emitEvent(_0x1668a5){return function(_0x134271,_0xda9134,_0x39fa2e){OpenchannelAccountEvents[_0xcdcc('0x5')](_0x1668a5+':'+_0x134271['id'],_0x134271);OpenchannelAccountEvents[_0xcdcc('0x5')](_0x1668a5,_0x134271);_0x39fa2e(null);};}for(var e in events){if(events[_0xcdcc('0x6')](e)){var event=events[e];OpenchannelAccount[_0xcdcc('0x7')](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 b8b646e..d49b60b 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 _0x757a=['request-promise','./openchannelAccount.attributes','exports','define','openchannel_accounts','util','../../config/logger'];(function(_0x15c8e0,_0x332c04){var _0xcf223b=function(_0x1dbadb){while(--_0x1dbadb){_0x15c8e0['push'](_0x15c8e0['shift']());}};_0xcf223b(++_0x332c04);}(_0x757a,0xde));var _0xa757=function(_0x2f9416,_0x11175e){_0x2f9416=_0x2f9416-0x0;var _0x2b14c7=_0x757a[_0x2f9416];return _0x2b14c7;};'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 attributes=require(_0xa757('0x3'));module[_0xa757('0x4')]=function(_0x453d07,_0x32630d){return _0x453d07[_0xa757('0x5')]('OpenchannelAccount',attributes,{'tableName':_0xa757('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['openchannel_accounts','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelAccount'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_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 attributes=require('./openchannelAccount.attributes');module[_0x3071('0x5')]=function(_0x7b18a4,_0x33a70c){return _0x7b18a4[_0x3071('0x6')](_0x3071('0x7'),attributes,{'tableName':_0x3071('0x8'),'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 70aa59c..9f1f9f4 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 _0x98d3=['message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','client','http','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x359c17,_0x23aa00){var _0x7d9532=function(_0x35ad31){while(--_0x35ad31){_0x359c17['push'](_0x359c17['shift']());}};_0x7d9532(++_0x23aa00);}(_0x98d3,0x173));var _0x398d=function(_0x597bf0,_0x4a1ae9){_0x597bf0=_0x597bf0-0x0;var _0x387b34=_0x98d3[_0x597bf0];return _0x387b34;};'use strict';var _=require(_0x398d('0x0'));var util=require(_0x398d('0x1'));var moment=require('moment');var BPromise=require(_0x398d('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x398d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x398d('0x4'))(_0x398d('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x398d('0x6')][_0x398d('0x7')]({'port':0x232a});var socket=require(_0x398d('0x8'))({'host':'localhost','port':0x18eb});require(_0x398d('0x9'))[_0x398d('0xa')](socket);function respondWithRpcPromise(_0x3029f3,_0x399598,_0x2f654c){return new BPromise(function(_0x54c349,_0x3a1934){return client[_0x398d('0xb')](_0x3029f3,_0x2f654c)[_0x398d('0xc')](function(_0x3841e6){logger[_0x398d('0xd')](_0x398d('0xe'),_0x399598,_0x398d('0xf'));logger[_0x398d('0x10')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x399598,_0x398d('0xf'),JSON[_0x398d('0x11')](_0x3841e6));if(_0x3841e6[_0x398d('0x12')]){if(_0x3841e6[_0x398d('0x12')][_0x398d('0x13')]===0x1f4){logger[_0x398d('0x12')](_0x398d('0xe'),_0x399598,_0x3841e6[_0x398d('0x12')][_0x398d('0x14')]);return _0x3a1934(_0x3841e6[_0x398d('0x12')][_0x398d('0x14')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x399598,_0x3841e6[_0x398d('0x12')][_0x398d('0x14')]);return _0x54c349(_0x3841e6[_0x398d('0x12')][_0x398d('0x14')]);}else{logger[_0x398d('0xd')](_0x398d('0xe'),_0x399598,_0x398d('0xf'));_0x54c349(_0x3841e6[_0x398d('0x15')]['message']);}})[_0x398d('0x16')](function(_0x54e717){logger[_0x398d('0x12')](_0x398d('0xe'),_0x399598,_0x54e717);_0x3a1934(_0x54e717);});});} \ No newline at end of file +var _0x3c94=['client','socket.io-emitter','localhost','./openchannelAccount.socket','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16c00b,_0x32497e){var _0x421981=function(_0x31b218){while(--_0x31b218){_0x16c00b['push'](_0x16c00b['shift']());}};_0x421981(++_0x32497e);}(_0x3c94,0xcd));var _0x43c9=function(_0x3977dc,_0x18499a){_0x3977dc=_0x3977dc-0x0;var _0x40e46e=_0x3c94[_0x3977dc];return _0x40e46e;};'use strict';var _=require(_0x43c9('0x0'));var util=require(_0x43c9('0x1'));var moment=require(_0x43c9('0x2'));var BPromise=require(_0x43c9('0x3'));var rs=require(_0x43c9('0x4'));var fs=require('fs');var db=require(_0x43c9('0x5'))['db'];var utils=require(_0x43c9('0x6'));var logger=require(_0x43c9('0x7'))(_0x43c9('0x8'));var config=require(_0x43c9('0x9'));var jayson=require(_0x43c9('0xa'));var client=jayson[_0x43c9('0xb')]['http']({'port':0x232a});var socket=require(_0x43c9('0xc'))({'host':_0x43c9('0xd'),'port':0x18eb});require(_0x43c9('0xe'))[_0x43c9('0xf')](socket);function respondWithRpcPromise(_0x383adb,_0x7a0f6b,_0x28aa11){return new BPromise(function(_0x4725aa,_0x45f3a1){return client['request'](_0x383adb,_0x28aa11)[_0x43c9('0x10')](function(_0x18a5c9){logger[_0x43c9('0x11')](_0x43c9('0x12'),_0x7a0f6b,_0x43c9('0x13'));logger[_0x43c9('0x14')](_0x43c9('0x15'),_0x7a0f6b,_0x43c9('0x13'),JSON[_0x43c9('0x16')](_0x18a5c9));if(_0x18a5c9[_0x43c9('0x17')]){if(_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x18')]===0x1f4){logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x19')]);return _0x45f3a1(_0x18a5c9[_0x43c9('0x17')]['message']);}logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x18a5c9[_0x43c9('0x17')][_0x43c9('0x19')]);return _0x4725aa(_0x18a5c9[_0x43c9('0x17')]['message']);}else{logger['info'](_0x43c9('0x12'),_0x7a0f6b,_0x43c9('0x13'));_0x4725aa(_0x18a5c9[_0x43c9('0x1a')][_0x43c9('0x19')]);}})['catch'](function(_0x1d63cf){logger[_0x43c9('0x17')](_0x43c9('0x12'),_0x7a0f6b,_0x1d63cf);_0x45f3a1(_0x1d63cf);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 8fcd54d..4d5e456 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 _0xe690=['./openchannelAccount.events','remove','update','emit','removeListener','length','openchannelAccount:'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xe690,0xc4));var _0x0e69=function(_0x4e2683,_0x12f6db){_0x4e2683=_0x4e2683-0x0;var _0x7bc309=_0xe690[_0x4e2683];return _0x7bc309;};'use strict';var OpenchannelAccountEvents=require(_0x0e69('0x0'));var events=['save',_0x0e69('0x1'),_0x0e69('0x2')];function createListener(_0x663176,_0x3cf98e){return function(_0xd253e8){_0x3cf98e[_0x0e69('0x3')](_0x663176,_0xd253e8);};}function removeListener(_0x1209e3,_0x528219){return function(){OpenchannelAccountEvents[_0x0e69('0x4')](_0x1209e3,_0x528219);};}exports['register']=function(_0x9d2140){for(var _0x2d6b46=0x0,_0x1dc190=events[_0x0e69('0x5')];_0x2d6b46<_0x1dc190;_0x2d6b46++){var _0xe7e271=events[_0x2d6b46];var _0x3e061d=createListener(_0x0e69('0x6')+_0xe7e271,_0x9d2140);OpenchannelAccountEvents['on'](_0xe7e271,_0x3e061d);}}; \ No newline at end of file +var _0xf510=['remove','removeListener','register','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x40174f,_0x3a6751){var _0x40717c=function(_0x5ae03d){while(--_0x5ae03d){_0x40174f['push'](_0x40174f['shift']());}};_0x40717c(++_0x3a6751);}(_0xf510,0x191));var _0x0f51=function(_0x2e83e9,_0x308711){_0x2e83e9=_0x2e83e9-0x0;var _0x33208a=_0xf510[_0x2e83e9];return _0x33208a;};'use strict';var OpenchannelAccountEvents=require(_0x0f51('0x0'));var events=['save',_0x0f51('0x1'),'update'];function createListener(_0x27df24,_0x1f7c73){return function(_0x199ee1){_0x1f7c73['emit'](_0x27df24,_0x199ee1);};}function removeListener(_0x399a7b,_0x49821e){return function(){OpenchannelAccountEvents[_0x0f51('0x2')](_0x399a7b,_0x49821e);};}exports[_0x0f51('0x3')]=function(_0x3c8749){for(var _0x2d8cd3=0x0,_0x82413b=events[_0x0f51('0x4')];_0x2d8cd3<_0x82413b;_0x2d8cd3++){var _0x2eb32f=events[_0x2d8cd3];var _0x597db3=createListener(_0x0f51('0x5')+_0x2eb32f,_0x3c8749);OpenchannelAccountEvents['on'](_0x2eb32f,_0x597db3);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f9227ad..95c4757 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 _0xda3f=['get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','util','path','../../components/interaction/service','./openchannelApplication.controller'];(function(_0x4037c3,_0x1a6eb0){var _0x3b5b8a=function(_0x1eb88d){while(--_0x1eb88d){_0x4037c3['push'](_0x4037c3['shift']());}};_0x3b5b8a(++_0x1a6eb0);}(_0xda3f,0xec));var _0xfda3=function(_0x2658a4,_0x1de6c2){_0x2658a4=_0x2658a4-0x0;var _0x1347ac=_0xda3f[_0x2658a4];return _0x1347ac;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x2'));var config=require('../../config/environment');var controller=require(_0xfda3('0x3'));router[_0xfda3('0x4')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x5')]);router[_0xfda3('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xfda3('0x6')]);router[_0xfda3('0x7')]('/',auth[_0xfda3('0x8')](),controller[_0xfda3('0x9')]);router[_0xfda3('0xa')](_0xfda3('0xb'),auth[_0xfda3('0x8')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0xb'),auth[_0xfda3('0x8')](),controller[_0xfda3('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index'];(function(_0x41e3db,_0x2243c5){var _0x2f549c=function(_0x305e17){while(--_0x305e17){_0x41e3db['push'](_0x41e3db['shift']());}};_0x2f549c(++_0x2243c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router['put']('/:id',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e3e19bd..b0c720a 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 _0xaa46=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x2501bc,_0x466ec9){var _0x35a237=function(_0x36176b){while(--_0x36176b){_0x2501bc['push'](_0x2501bc['shift']());}};_0x35a237(++_0x466ec9);}(_0xaa46,0xf4));var _0x6aa4=function(_0x3149c5,_0x58701a){_0x3149c5=_0x3149c5-0x0;var _0x34658d=_0xaa46[_0x3149c5];return _0x34658d;};'use strict';var Sequelize=require(_0x6aa4('0x0'));module[_0x6aa4('0x1')]={'priority':{'type':Sequelize[_0x6aa4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6aa4('0x3')],'allowNull':![],'defaultValue':_0x6aa4('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6aa4('0x3')],'defaultValue':_0x6aa4('0x5')}}; \ No newline at end of file +var _0x589f=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x121cce,_0x3d7e2e){var _0x10a17f=function(_0xd2053){while(--_0xd2053){_0x121cce['push'](_0x121cce['shift']());}};_0x10a17f(++_0x3d7e2e);}(_0x589f,0xc6));var _0xf589=function(_0x4ec3ab,_0x50a5de){_0x4ec3ab=_0x4ec3ab-0x0;var _0x229613=_0x589f[_0x4ec3ab];return _0x229613;};'use strict';var Sequelize=require(_0xf589('0x0'));module[_0xf589('0x1')]={'priority':{'type':Sequelize[_0xf589('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf589('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xf589('0x3')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf589('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 400fc6a..f83d8c7 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 _0xe40f=['filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','OpenchannelApplication','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','length','attributes','hasOwnProperty','sort','pick','add','day','where'];(function(_0xac6d17,_0x7d78da){var _0xf07a70=function(_0x37ad12){while(--_0x37ad12){_0xac6d17['push'](_0xac6d17['shift']());}};_0xf07a70(++_0x7d78da);}(_0xe40f,0x15d));var _0xfe40=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xe40f[_0x17d9e3];return _0x14192d;};'use strict';var jsonpatch=require(_0xfe40('0x0'));var rp=require(_0xfe40('0x1'));var moment=require(_0xfe40('0x2'));var BPromise=require(_0xfe40('0x3'));var Mustache=require(_0xfe40('0x4'));var util=require(_0xfe40('0x5'));var path=require(_0xfe40('0x6'));var sox=require(_0xfe40('0x7'));var csv=require(_0xfe40('0x8'));var ejs=require(_0xfe40('0x9'));var fs=require('fs');var _=require(_0xfe40('0xa'));var squel=require('squel');var crypto=require(_0xfe40('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfe40('0xc'));var toCsv=require(_0xfe40('0x8'));var querystring=require('querystring');var Papa=require(_0xfe40('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xfe40('0xe'));var utils=require(_0xfe40('0xf'));var config=require(_0xfe40('0x10'));var db=require(_0xfe40('0x11'))['db'];function respondWithStatusCode(_0x84c02e,_0x241345){_0x241345=_0x241345||0xcc;return function(_0x4d888e){if(_0x4d888e){return _0x84c02e[_0xfe40('0x12')](_0x241345);}return _0x84c02e[_0xfe40('0x13')](_0x241345)['end']();};}function respondWithResult(_0x2be78e,_0x145d3b){_0x145d3b=_0x145d3b||0xc8;return function(_0x2b6c52){if(_0x2b6c52){return _0x2be78e[_0xfe40('0x13')](_0x145d3b)[_0xfe40('0x14')](_0x2b6c52);}};}function respondWithFilteredResult(_0x22a592,_0x3a74f2){return function(_0x31d86d){if(_0x31d86d){var _0x488837=_0x31d86d['count'],_0xad5219=_0x3a74f2[_0xfe40('0x15')],_0x90d6e7=_0x3a74f2[_0xfe40('0x15')]+_0x3a74f2[_0xfe40('0x16')],_0x4a6570;if(_0x90d6e7>=_0x488837){_0x90d6e7=_0x488837;_0x4a6570=0xc8;}else{_0x4a6570=0xce;}_0x22a592[_0xfe40('0x13')](_0x4a6570);return _0x22a592[_0xfe40('0x17')](_0xfe40('0x18'),_0xad5219+'-'+_0x90d6e7+'/'+_0x488837)[_0xfe40('0x14')](_0x31d86d);}return null;};}function patchUpdates(_0x1d01ec){return function(_0x260c9b){try{jsonpatch['apply'](_0x260c9b,_0x1d01ec,!![]);}catch(_0x88657a){return BPromise[_0xfe40('0x19')](_0x88657a);}return _0x260c9b[_0xfe40('0x1a')]();};}function saveUpdates(_0x31312d,_0x402d32){return function(_0x5c79cf){if(_0x5c79cf){return _0x5c79cf[_0xfe40('0x1b')](_0x31312d)[_0xfe40('0x1c')](function(_0x54dacf){return _0x54dacf;});}return null;};}function removeEntity(_0x54be14,_0x57b620){return function(_0x50a982){if(_0x50a982){return _0x50a982[_0xfe40('0x1d')]()[_0xfe40('0x1c')](function(){_0x54be14[_0xfe40('0x13')](0xcc)[_0xfe40('0x1e')]();});}};}function handleEntityNotFound(_0x208203,_0x4374d2){return function(_0x497c57){if(!_0x497c57){_0x208203[_0xfe40('0x12')](0x194);}return _0x497c57;};}function handleError(_0x14c071,_0x2f51c7){_0x2f51c7=_0x2f51c7||0x1f4;return function(_0x5b3e03){logger[_0xfe40('0x1f')](_0x5b3e03[_0xfe40('0x20')]);if(_0x5b3e03[_0xfe40('0x21')]){delete _0x5b3e03[_0xfe40('0x21')];}_0x14c071['status'](_0x2f51c7)[_0xfe40('0x22')](_0x5b3e03);};}exports['index']=function(_0x4ceb9a,_0x326a18){var _0x25444a={},_0x37f007={},_0xe37196={'count':0x0,'rows':[]};var _0x3dc8e3=db[_0xfe40('0x23')][_0xfe40('0x24')];_0x37f007['model']=_['keys'](_0x3dc8e3);var _0x12da28={'dateStart':_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x26')],'dateEnd':_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x27')]};delete _0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x26')];delete _0x4ceb9a[_0xfe40('0x25')]['dateEnd'];_0x37f007['query']=_[_0xfe40('0x28')](_0x4ceb9a[_0xfe40('0x25')]);_0x37f007[_0xfe40('0x29')]=_[_0xfe40('0x2a')](_0x37f007[_0xfe40('0x2b')],_0x37f007['query']);_0x25444a['attributes']=_[_0xfe40('0x2a')](_0x37f007[_0xfe40('0x2b')],qs[_0xfe40('0x2c')](_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x2c')]));_0x25444a['attributes']=_0x25444a['attributes'][_0xfe40('0x2d')]?_0x25444a[_0xfe40('0x2e')]:_0x37f007[_0xfe40('0x2b')];if(!_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x2f')]('nolimit')){_0x25444a[_0xfe40('0x16')]=qs[_0xfe40('0x16')](_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x16')]);_0x25444a[_0xfe40('0x15')]=qs[_0xfe40('0x15')](_0x4ceb9a['query'][_0xfe40('0x15')]);}_0x25444a['order']=qs[_0xfe40('0x30')](_0x4ceb9a[_0xfe40('0x25')]['sort']);_0x25444a['where']=qs['filters'](_[_0xfe40('0x31')](_0x4ceb9a[_0xfe40('0x25')],_0x37f007['filters']));if(_0x12da28[_0xfe40('0x26')]){if(_0x12da28[_0xfe40('0x27')]){_0x12da28[_0xfe40('0x27')]=moment(_0x12da28['dateEnd'])[_0xfe40('0x32')](0x1,_0xfe40('0x33'));}else{_0x12da28[_0xfe40('0x27')]=moment(_0x12da28['dateStart'])[_0xfe40('0x32')](0x1,_0xfe40('0x33'));}_['merge'](_0x25444a[_0xfe40('0x34')],{'createdAt':{'$gte':_0x12da28[_0xfe40('0x26')],'$lte':_0x12da28[_0xfe40('0x27')]}});}if(_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x35')]){_0x25444a['where']=_[_0xfe40('0x36')](_0x25444a[_0xfe40('0x34')],{'$or':_['map'](_0x25444a[_0xfe40('0x2e')],function(_0x493105){var _0x11c5ec={};_0x11c5ec[_0x493105]={'$like':'%'+_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x35')]+'%'};return _0x11c5ec;})});}_0x25444a=_[_0xfe40('0x36')]({},_0x25444a,_0x4ceb9a[_0xfe40('0x37')]);var _0x46dffb={'where':_0x25444a['where']};return db[_0xfe40('0x23')][_0xfe40('0x38')](_0x46dffb)['then'](function(_0x34b97e){_0xe37196[_0xfe40('0x38')]=_0x34b97e;if(_0x4ceb9a[_0xfe40('0x25')][_0xfe40('0x39')]){_0x25444a[_0xfe40('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xfe40('0x3b')](_0x25444a);})['then'](function(_0x180798){_0xe37196[_0xfe40('0x3c')]=_0x180798;return _0xe37196;})[_0xfe40('0x1c')](respondWithFilteredResult(_0x326a18,_0x25444a))[_0xfe40('0x3d')](handleError(_0x326a18,null));};exports[_0xfe40('0x3e')]=function(_0x4b9412,_0x4433aa){var _0x3cef00={'raw':!![],'where':{'id':_0x4b9412['params']['id']}},_0x1959a4={};_0x1959a4['model']=_[_0xfe40('0x28')](db[_0xfe40('0x23')][_0xfe40('0x24')]);_0x1959a4[_0xfe40('0x25')]=_[_0xfe40('0x28')](_0x4b9412[_0xfe40('0x25')]);_0x1959a4[_0xfe40('0x29')]=_['intersection'](_0x1959a4[_0xfe40('0x2b')],_0x1959a4[_0xfe40('0x25')]);_0x3cef00['attributes']=_[_0xfe40('0x2a')](_0x1959a4[_0xfe40('0x2b')],qs['fields'](_0x4b9412[_0xfe40('0x25')][_0xfe40('0x2c')]));_0x3cef00['attributes']=_0x3cef00[_0xfe40('0x2e')][_0xfe40('0x2d')]?_0x3cef00[_0xfe40('0x2e')]:_0x1959a4[_0xfe40('0x2b')];if(_0x4b9412[_0xfe40('0x25')][_0xfe40('0x39')]){_0x3cef00[_0xfe40('0x3a')]=[{'all':!![]}];}_0x3cef00=_[_0xfe40('0x36')]({},_0x3cef00,_0x4b9412['options']);return db[_0xfe40('0x23')][_0xfe40('0x3f')](_0x3cef00)['then'](handleEntityNotFound(_0x4433aa,null))[_0xfe40('0x1c')](respondWithResult(_0x4433aa,null))[_0xfe40('0x3d')](handleError(_0x4433aa,null));};exports[_0xfe40('0x40')]=function(_0x453b48,_0x3ccb51){return db[_0xfe40('0x23')][_0xfe40('0x40')](_0x453b48[_0xfe40('0x41')],{})['then'](respondWithResult(_0x3ccb51,0xc9))[_0xfe40('0x3d')](handleError(_0x3ccb51,null));};exports[_0xfe40('0x1b')]=function(_0x115289,_0x27a17e){if(_0x115289[_0xfe40('0x41')]['id']){delete _0x115289[_0xfe40('0x41')]['id'];}return db[_0xfe40('0x23')][_0xfe40('0x3f')]({'where':{'id':_0x115289[_0xfe40('0x42')]['id']}})[_0xfe40('0x1c')](handleEntityNotFound(_0x27a17e,null))[_0xfe40('0x1c')](saveUpdates(_0x115289[_0xfe40('0x41')],null))[_0xfe40('0x1c')](respondWithResult(_0x27a17e,null))[_0xfe40('0x3d')](handleError(_0x27a17e,null));};exports['destroy']=function(_0xd101e8,_0x15431b){return db[_0xfe40('0x23')][_0xfe40('0x3f')]({'where':{'id':_0xd101e8[_0xfe40('0x42')]['id']}})['then'](handleEntityNotFound(_0x15431b,null))[_0xfe40('0x1c')](removeEntity(_0x15431b,null))[_0xfe40('0x3d')](handleError(_0x15431b,null));}; \ No newline at end of file +var _0x8005=['filters','include','create','find','body','destroy','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','OpenchannelApplication','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','findAll','rows','catch','show','params'];(function(_0x1cce04,_0x515fef){var _0x3deb5e=function(_0x4e839a){while(--_0x4e839a){_0x1cce04['push'](_0x1cce04['shift']());}};_0x3deb5e(++_0x515fef);}(_0x8005,0x11a));var _0x5800=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x8005[_0x72895a];return _0x5226d5;};'use strict';var jsonpatch=require(_0x5800('0x0'));var rp=require(_0x5800('0x1'));var moment=require(_0x5800('0x2'));var BPromise=require(_0x5800('0x3'));var Mustache=require('mustache');var util=require(_0x5800('0x4'));var path=require(_0x5800('0x5'));var sox=require('sox');var csv=require(_0x5800('0x6'));var ejs=require(_0x5800('0x7'));var fs=require('fs');var _=require(_0x5800('0x8'));var squel=require(_0x5800('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5800('0xa'));var toCsv=require(_0x5800('0x6'));var querystring=require(_0x5800('0xb'));var Papa=require(_0x5800('0xc'));var qs=require(_0x5800('0xd'));var logger=require(_0x5800('0xe'))(_0x5800('0xf'));var utils=require(_0x5800('0x10'));var config=require(_0x5800('0x11'));var db=require(_0x5800('0x12'))['db'];function respondWithStatusCode(_0x3eac8e,_0x562c67){_0x562c67=_0x562c67||0xcc;return function(_0x49a334){if(_0x49a334){return _0x3eac8e[_0x5800('0x13')](_0x562c67);}return _0x3eac8e[_0x5800('0x14')](_0x562c67)['end']();};}function respondWithResult(_0x9f6d90,_0x13a677){_0x13a677=_0x13a677||0xc8;return function(_0x58f1c6){if(_0x58f1c6){return _0x9f6d90[_0x5800('0x14')](_0x13a677)[_0x5800('0x15')](_0x58f1c6);}};}function respondWithFilteredResult(_0x19e133,_0xf1e087){return function(_0x1bdcbf){if(_0x1bdcbf){var _0x2aed78=_0x1bdcbf[_0x5800('0x16')],_0x1d330a=_0xf1e087[_0x5800('0x17')],_0x559663=_0xf1e087[_0x5800('0x17')]+_0xf1e087[_0x5800('0x18')],_0x29c729;if(_0x559663>=_0x2aed78){_0x559663=_0x2aed78;_0x29c729=0xc8;}else{_0x29c729=0xce;}_0x19e133[_0x5800('0x14')](_0x29c729);return _0x19e133[_0x5800('0x19')](_0x5800('0x1a'),_0x1d330a+'-'+_0x559663+'/'+_0x2aed78)['json'](_0x1bdcbf);}return null;};}function patchUpdates(_0x18651a){return function(_0x4f4141){try{jsonpatch['apply'](_0x4f4141,_0x18651a,!![]);}catch(_0x531ecb){return BPromise[_0x5800('0x1b')](_0x531ecb);}return _0x4f4141[_0x5800('0x1c')]();};}function saveUpdates(_0x13a6b8,_0x39d660){return function(_0x3ad76f){if(_0x3ad76f){return _0x3ad76f[_0x5800('0x1d')](_0x13a6b8)[_0x5800('0x1e')](function(_0x3a2374){return _0x3a2374;});}return null;};}function removeEntity(_0x3efb25,_0x157332){return function(_0x1aa12e){if(_0x1aa12e){return _0x1aa12e['destroy']()['then'](function(){_0x3efb25['status'](0xcc)[_0x5800('0x1f')]();});}};}function handleEntityNotFound(_0xaa11ea,_0x188c53){return function(_0x11c936){if(!_0x11c936){_0xaa11ea[_0x5800('0x13')](0x194);}return _0x11c936;};}function handleError(_0x24db06,_0x7c7aef){_0x7c7aef=_0x7c7aef||0x1f4;return function(_0x44b91e){logger[_0x5800('0x20')](_0x44b91e[_0x5800('0x21')]);if(_0x44b91e[_0x5800('0x22')]){delete _0x44b91e[_0x5800('0x22')];}_0x24db06['status'](_0x7c7aef)['send'](_0x44b91e);};}exports['index']=function(_0x1f1080,_0x5a2ae1){var _0x57d0eb={},_0x4cfd8b={},_0x24018d={'count':0x0,'rows':[]};var _0xecbca9=db[_0x5800('0x23')][_0x5800('0x24')];_0x4cfd8b[_0x5800('0x25')]=_[_0x5800('0x26')](_0xecbca9);var _0x583ac8={'dateStart':_0x1f1080[_0x5800('0x27')][_0x5800('0x28')],'dateEnd':_0x1f1080[_0x5800('0x27')]['dateEnd']};delete _0x1f1080[_0x5800('0x27')]['dateStart'];delete _0x1f1080[_0x5800('0x27')][_0x5800('0x29')];_0x4cfd8b[_0x5800('0x27')]=_[_0x5800('0x26')](_0x1f1080[_0x5800('0x27')]);_0x4cfd8b['filters']=_[_0x5800('0x2a')](_0x4cfd8b['model'],_0x4cfd8b[_0x5800('0x27')]);_0x57d0eb[_0x5800('0x2b')]=_[_0x5800('0x2a')](_0x4cfd8b[_0x5800('0x25')],qs[_0x5800('0x2c')](_0x1f1080[_0x5800('0x27')][_0x5800('0x2c')]));_0x57d0eb['attributes']=_0x57d0eb[_0x5800('0x2b')][_0x5800('0x2d')]?_0x57d0eb[_0x5800('0x2b')]:_0x4cfd8b[_0x5800('0x25')];if(!_0x1f1080[_0x5800('0x27')]['hasOwnProperty'](_0x5800('0x2e'))){_0x57d0eb['limit']=qs[_0x5800('0x18')](_0x1f1080['query'][_0x5800('0x18')]);_0x57d0eb[_0x5800('0x17')]=qs[_0x5800('0x17')](_0x1f1080[_0x5800('0x27')][_0x5800('0x17')]);}_0x57d0eb[_0x5800('0x2f')]=qs['sort'](_0x1f1080[_0x5800('0x27')][_0x5800('0x30')]);_0x57d0eb[_0x5800('0x31')]=qs['filters'](_[_0x5800('0x32')](_0x1f1080['query'],_0x4cfd8b['filters']));if(_0x583ac8[_0x5800('0x28')]){if(_0x583ac8[_0x5800('0x29')]){_0x583ac8[_0x5800('0x29')]=moment(_0x583ac8['dateEnd'])[_0x5800('0x33')](0x1,'day');}else{_0x583ac8[_0x5800('0x29')]=moment(_0x583ac8[_0x5800('0x28')])[_0x5800('0x33')](0x1,_0x5800('0x34'));}_[_0x5800('0x35')](_0x57d0eb[_0x5800('0x31')],{'createdAt':{'$gte':_0x583ac8['dateStart'],'$lte':_0x583ac8[_0x5800('0x29')]}});}if(_0x1f1080[_0x5800('0x27')][_0x5800('0x36')]){_0x57d0eb[_0x5800('0x31')]=_[_0x5800('0x35')](_0x57d0eb[_0x5800('0x31')],{'$or':_[_0x5800('0x37')](_0x57d0eb[_0x5800('0x2b')],function(_0x378d5f){var _0x2d3359={};_0x2d3359[_0x378d5f]={'$like':'%'+_0x1f1080['query'][_0x5800('0x36')]+'%'};return _0x2d3359;})});}_0x57d0eb=_[_0x5800('0x35')]({},_0x57d0eb,_0x1f1080[_0x5800('0x38')]);var _0x11b156={'where':_0x57d0eb[_0x5800('0x31')]};return db[_0x5800('0x23')][_0x5800('0x16')](_0x11b156)[_0x5800('0x1e')](function(_0x2e1924){_0x24018d['count']=_0x2e1924;if(_0x1f1080[_0x5800('0x27')][_0x5800('0x39')]){_0x57d0eb['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0x5800('0x3a')](_0x57d0eb);})[_0x5800('0x1e')](function(_0xcf6fb8){_0x24018d[_0x5800('0x3b')]=_0xcf6fb8;return _0x24018d;})[_0x5800('0x1e')](respondWithFilteredResult(_0x5a2ae1,_0x57d0eb))[_0x5800('0x3c')](handleError(_0x5a2ae1,null));};exports[_0x5800('0x3d')]=function(_0x598149,_0x3da0a1){var _0x41578c={'raw':!![],'where':{'id':_0x598149[_0x5800('0x3e')]['id']}},_0x47bfd4={};_0x47bfd4[_0x5800('0x25')]=_[_0x5800('0x26')](db[_0x5800('0x23')][_0x5800('0x24')]);_0x47bfd4[_0x5800('0x27')]=_[_0x5800('0x26')](_0x598149[_0x5800('0x27')]);_0x47bfd4[_0x5800('0x3f')]=_[_0x5800('0x2a')](_0x47bfd4['model'],_0x47bfd4[_0x5800('0x27')]);_0x41578c['attributes']=_[_0x5800('0x2a')](_0x47bfd4[_0x5800('0x25')],qs[_0x5800('0x2c')](_0x598149[_0x5800('0x27')][_0x5800('0x2c')]));_0x41578c['attributes']=_0x41578c['attributes']['length']?_0x41578c[_0x5800('0x2b')]:_0x47bfd4['model'];if(_0x598149[_0x5800('0x27')][_0x5800('0x39')]){_0x41578c[_0x5800('0x40')]=[{'all':!![]}];}_0x41578c=_[_0x5800('0x35')]({},_0x41578c,_0x598149['options']);return db[_0x5800('0x23')]['find'](_0x41578c)[_0x5800('0x1e')](handleEntityNotFound(_0x3da0a1,null))['then'](respondWithResult(_0x3da0a1,null))[_0x5800('0x3c')](handleError(_0x3da0a1,null));};exports[_0x5800('0x41')]=function(_0x2645a2,_0x383bc2){return db[_0x5800('0x23')]['create'](_0x2645a2['body'],{})[_0x5800('0x1e')](respondWithResult(_0x383bc2,0xc9))[_0x5800('0x3c')](handleError(_0x383bc2,null));};exports[_0x5800('0x1d')]=function(_0xd9a035,_0x16f777){if(_0xd9a035['body']['id']){delete _0xd9a035['body']['id'];}return db[_0x5800('0x23')][_0x5800('0x42')]({'where':{'id':_0xd9a035[_0x5800('0x3e')]['id']}})[_0x5800('0x1e')](handleEntityNotFound(_0x16f777,null))[_0x5800('0x1e')](saveUpdates(_0xd9a035[_0x5800('0x43')],null))['then'](respondWithResult(_0x16f777,null))['catch'](handleError(_0x16f777,null));};exports[_0x5800('0x44')]=function(_0x29c5d9,_0x3af670){return db['OpenchannelApplication'][_0x5800('0x42')]({'where':{'id':_0x29c5d9[_0x5800('0x3e')]['id']}})[_0x5800('0x1e')](handleEntityNotFound(_0x3af670,null))[_0x5800('0x1e')](removeEntity(_0x3af670,null))[_0x5800('0x3c')](handleError(_0x3af670,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 418a637..5d54f50 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 _0x331d=['api','moment','bluebird','request-promise','define','openchannel_applications','lodash'];(function(_0x60387b,_0x1dea06){var _0x42f420=function(_0x2e2639){while(--_0x2e2639){_0x60387b['push'](_0x60387b['shift']());}};_0x42f420(++_0x1dea06);}(_0x331d,0xc3));var _0xd331=function(_0x52bd20,_0x50c5b3){_0x52bd20=_0x52bd20-0x0;var _0x4815f2=_0x331d[_0x52bd20];return _0x4815f2;};'use strict';var _=require(_0xd331('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd331('0x1'));var moment=require(_0xd331('0x2'));var BPromise=require(_0xd331('0x3'));var rp=require(_0xd331('0x4'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0xf3803a,_0x56c1e3){return _0xf3803a[_0xd331('0x5')]('OpenchannelApplication',attributes,{'tableName':_0xd331('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c6a=['exports','openchannel_applications','../../config/logger','moment','bluebird','request-promise'];(function(_0x1dd82f,_0x52acb7){var _0x353ca4=function(_0x5ee4c9){while(--_0x5ee4c9){_0x1dd82f['push'](_0x1dd82f['shift']());}};_0x353ca4(++_0x52acb7);}(_0x3c6a,0x13a));var _0xa3c6=function(_0xab9f3d,_0xb336fa){_0xab9f3d=_0xab9f3d-0x0;var _0x5283bf=_0x3c6a[_0xab9f3d];return _0x5283bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3c6('0x0'))('api');var moment=require(_0xa3c6('0x1'));var BPromise=require(_0xa3c6('0x2'));var rp=require(_0xa3c6('0x3'));var attributes=require('./openchannelApplication.attributes');module[_0xa3c6('0x4')]=function(_0x11e738,_0x1e3139){return _0x11e738['define']('OpenchannelApplication',attributes,{'tableName':_0xa3c6('0x5'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index e34068a..06b7956 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 _0x723e=['code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','raw','options','where','attributes','limit','debug','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x11d0ce,_0x3ef4ad){var _0x47a481=function(_0x4dce4d){while(--_0x4dce4d){_0x11d0ce['push'](_0x11d0ce['shift']());}};_0x47a481(++_0x3ef4ad);}(_0x723e,0x179));var _0xe723=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0x723e[_0x9a7d08];return _0x58e6e8;};'use strict';var _=require('lodash');var util=require(_0xe723('0x0'));var moment=require(_0xe723('0x1'));var BPromise=require(_0xe723('0x2'));var rs=require(_0xe723('0x3'));var fs=require('fs');var db=require(_0xe723('0x4'))['db'];var utils=require(_0xe723('0x5'));var logger=require(_0xe723('0x6'))(_0xe723('0x7'));var config=require(_0xe723('0x8'));var jayson=require(_0xe723('0x9'));var client=jayson['client'][_0xe723('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20c13b,_0x1335cd,_0x3bf082){return new BPromise(function(_0x2aebbd,_0xe50f7){return client[_0xe723('0xb')](_0x20c13b,_0x3bf082)[_0xe723('0xc')](function(_0x4a6983){logger[_0xe723('0xd')](_0xe723('0xe'),_0x1335cd,_0xe723('0xf'));logger['debug'](_0xe723('0x10'),_0x1335cd,_0xe723('0xf'),JSON[_0xe723('0x11')](_0x4a6983));if(_0x4a6983['error']){if(_0x4a6983[_0xe723('0x12')][_0xe723('0x13')]===0x1f4){logger[_0xe723('0x12')](_0xe723('0xe'),_0x1335cd,_0x4a6983[_0xe723('0x12')]['message']);return _0xe50f7(_0x4a6983[_0xe723('0x12')]['message']);}logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x1335cd,_0x4a6983['error'][_0xe723('0x14')]);return _0x2aebbd(_0x4a6983[_0xe723('0x12')][_0xe723('0x14')]);}else{logger[_0xe723('0xd')](_0xe723('0xe'),_0x1335cd,'request\x20sent');_0x2aebbd(_0x4a6983[_0xe723('0x15')][_0xe723('0x14')]);}})[_0xe723('0x16')](function(_0x2ec702){logger[_0xe723('0x12')](_0xe723('0xe'),_0x1335cd,_0x2ec702);_0xe50f7(_0x2ec702);});});}exports[_0xe723('0x17')]=function(_0x4a6f95){var _0x17e2c1=this;return new Promise(function(_0x3906ea,_0x2057d7){return db[_0xe723('0x18')][_0xe723('0x19')](_0x4a6f95[_0xe723('0x1a')],{'raw':_0x4a6f95['options']?_0x4a6f95['options'][_0xe723('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a6f95[_0xe723('0x1c')]?_0x4a6f95['options'][_0xe723('0x1d')]||null:null,'attributes':_0x4a6f95[_0xe723('0x1c')]?_0x4a6f95['options'][_0xe723('0x1e')]||null:null,'limit':_0x4a6f95['options']?_0x4a6f95[_0xe723('0x1c')][_0xe723('0x1f')]||null:null})[_0xe723('0xc')](function(_0x1fe43d){logger[_0xe723('0xd')](_0xe723('0x17'),_0x4a6f95);logger[_0xe723('0x20')](_0xe723('0x17'),_0x4a6f95,JSON[_0xe723('0x11')](_0x1fe43d));_0x3906ea(_0x1fe43d);})[_0xe723('0x16')](function(_0x4a0899){logger[_0xe723('0x12')]('UpdateOpenchannelApplication',_0x4a0899[_0xe723('0x14')],_0x4a6f95);_0x2057d7(_0x17e2c1['error'](0x1f4,_0x4a0899[_0xe723('0x14')]));});});}; \ No newline at end of file +var _0xbd10=['raw','options','where','attributes','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelApplication','update','body'];(function(_0x3d2227,_0x3d7cc1){var _0xdddd19=function(_0x3add88){while(--_0x3add88){_0x3d2227['push'](_0x3d2227['shift']());}};_0xdddd19(++_0x3d7cc1);}(_0xbd10,0x85));var _0x0bd1=function(_0xb9a03a,_0x4d9ea2){_0xb9a03a=_0xb9a03a-0x0;var _0x567724=_0xbd10[_0xb9a03a];return _0x567724;};'use strict';var _=require(_0x0bd1('0x0'));var util=require(_0x0bd1('0x1'));var moment=require(_0x0bd1('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd1('0x3'));var fs=require('fs');var db=require(_0x0bd1('0x4'))['db'];var utils=require(_0x0bd1('0x5'));var logger=require('../../config/logger')(_0x0bd1('0x6'));var config=require(_0x0bd1('0x7'));var jayson=require(_0x0bd1('0x8'));var client=jayson[_0x0bd1('0x9')][_0x0bd1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46c432,_0x4c129c,_0x143a85){return new BPromise(function(_0x4dbb43,_0x639350){return client[_0x0bd1('0xb')](_0x46c432,_0x143a85)[_0x0bd1('0xc')](function(_0x468e7c){logger['info'](_0x0bd1('0xd'),_0x4c129c,_0x0bd1('0xe'));logger[_0x0bd1('0xf')](_0x0bd1('0x10'),_0x4c129c,_0x0bd1('0xe'),JSON[_0x0bd1('0x11')](_0x468e7c));if(_0x468e7c['error']){if(_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x13')]===0x1f4){logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x14')]);return _0x639350(_0x468e7c['error'][_0x0bd1('0x14')]);}logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x468e7c['error']['message']);return _0x4dbb43(_0x468e7c[_0x0bd1('0x12')][_0x0bd1('0x14')]);}else{logger[_0x0bd1('0x15')]('OpenchannelApplication,\x20%s,\x20%s',_0x4c129c,'request\x20sent');_0x4dbb43(_0x468e7c[_0x0bd1('0x16')][_0x0bd1('0x14')]);}})[_0x0bd1('0x17')](function(_0x5ab359){logger[_0x0bd1('0x12')](_0x0bd1('0xd'),_0x4c129c,_0x5ab359);_0x639350(_0x5ab359);});});}exports[_0x0bd1('0x18')]=function(_0x3042c6){var _0x4790eb=this;return new Promise(function(_0x11479e,_0x3d1170){return db['OpenchannelApplication'][_0x0bd1('0x19')](_0x3042c6[_0x0bd1('0x1a')],{'raw':_0x3042c6['options']?_0x3042c6['options'][_0x0bd1('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6[_0x0bd1('0x1c')][_0x0bd1('0x1d')]||null:null,'attributes':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6[_0x0bd1('0x1c')][_0x0bd1('0x1e')]||null:null,'limit':_0x3042c6[_0x0bd1('0x1c')]?_0x3042c6['options'][_0x0bd1('0x1f')]||null:null})[_0x0bd1('0xc')](function(_0x31eaf5){logger[_0x0bd1('0x15')](_0x0bd1('0x18'),_0x3042c6);logger['debug'](_0x0bd1('0x18'),_0x3042c6,JSON['stringify'](_0x31eaf5));_0x11479e(_0x31eaf5);})['catch'](function(_0x9bb815){logger[_0x0bd1('0x12')](_0x0bd1('0x18'),_0x9bb815[_0x0bd1('0x14')],_0x3042c6);_0x3d1170(_0x4790eb[_0x0bd1('0x12')](0x1f4,_0x9bb815[_0x0bd1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 719929c..7f21527 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 _0x01e0=['/describe','describe','get','show','getMessages','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','put','/:id','openchannelinteraction:update','delete','openchannelinteraction:destroy','multer','util','path','express','Router','../../components/interaction/service','./openchannelInteraction.controller','isAuthenticated'];(function(_0x285e03,_0x31fef7){var _0x38fc84=function(_0x36fa84){while(--_0x36fa84){_0x285e03['push'](_0x285e03['shift']());}};_0x38fc84(++_0x31fef7);}(_0x01e0,0x16f));var _0x001e=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0x01e0[_0x29dda1];return _0x21b0ef;};'use strict';var multer=require(_0x001e('0x0'));var util=require(_0x001e('0x1'));var path=require(_0x001e('0x2'));var express=require(_0x001e('0x3'));var router=express[_0x001e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x001e('0x5'));var config=require('../../config/environment');var controller=require(_0x001e('0x6'));router['get']('/',auth[_0x001e('0x7')](),controller['index']);router['get'](_0x001e('0x8'),auth['isAuthenticated'](),controller[_0x001e('0x9')]);router[_0x001e('0xa')]('/:id',auth[_0x001e('0x7')](),controller[_0x001e('0xb')]);router[_0x001e('0xa')]('/:id/messages',auth[_0x001e('0x7')](),controller[_0x001e('0xc')]);router[_0x001e('0xd')]('/',auth[_0x001e('0x7')](),controller[_0x001e('0xe')]);router[_0x001e('0xd')](_0x001e('0xf'),auth[_0x001e('0x7')](),controller[_0x001e('0x10')]);router['post'](_0x001e('0x11'),auth[_0x001e('0x7')](),interaction[_0x001e('0x12')](_0x001e('0x13'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x001e('0x14')](_0x001e('0x15'),auth[_0x001e('0x7')](),interaction[_0x001e('0x12')](_0x001e('0x13'),_0x001e('0x16')),controller['update']);router[_0x001e('0x17')](_0x001e('0x15'),auth[_0x001e('0x7')](),interaction[_0x001e('0x12')](_0x001e('0x13'),_0x001e('0x18')),controller['destroy']);router['delete']('/:id/tags',auth[_0x001e('0x7')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xf61f=['multer','util','path','express','Router','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','create','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy'];(function(_0x98ec03,_0x177ec5){var _0x37f874=function(_0x5f1c0f){while(--_0x5f1c0f){_0x98ec03['push'](_0x98ec03['shift']());}};_0x37f874(++_0x177ec5);}(_0xf61f,0xb6));var _0xff61=function(_0x2f8d56,_0x376c64){_0x2f8d56=_0x2f8d56-0x0;var _0x36081d=_0xf61f[_0x2f8d56];return _0x36081d;};'use strict';var multer=require(_0xff61('0x0'));var util=require(_0xff61('0x1'));var path=require(_0xff61('0x2'));var express=require(_0xff61('0x3'));var router=express[_0xff61('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router[_0xff61('0x5')]('/',auth[_0xff61('0x6')](),controller[_0xff61('0x7')]);router[_0xff61('0x5')](_0xff61('0x8'),auth[_0xff61('0x6')](),controller[_0xff61('0x9')]);router['get'](_0xff61('0xa'),auth[_0xff61('0x6')](),controller['show']);router[_0xff61('0x5')](_0xff61('0xb'),auth[_0xff61('0x6')](),controller[_0xff61('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff61('0xd')]);router['post'](_0xff61('0xb'),auth[_0xff61('0x6')](),controller[_0xff61('0xe')]);router[_0xff61('0xf')](_0xff61('0x10'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')](_0xff61('0x12'),_0xff61('0x13')),controller['addTags']);router[_0xff61('0x14')](_0xff61('0xa'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')](_0xff61('0x12'),_0xff61('0x15')),controller[_0xff61('0x16')]);router[_0xff61('0x17')](_0xff61('0xa'),auth[_0xff61('0x6')](),interaction[_0xff61('0x11')]('openchannel',_0xff61('0x18')),controller[_0xff61('0x19')]);router['delete'](_0xff61('0x10'),auth[_0xff61('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 42b661a..721c1a7 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 _0xd5b2=['STRING','DATE','exports','BOOLEAN'];(function(_0x943ee9,_0x34a5b5){var _0x6614a6=function(_0x20a6be){while(--_0x20a6be){_0x943ee9['push'](_0x943ee9['shift']());}};_0x6614a6(++_0x34a5b5);}(_0xd5b2,0x10e));var _0x2d5b=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xd5b2[_0x18ab2a];return _0x16dcee;};'use strict';var Sequelize=require('sequelize');module[_0x2d5b('0x0')]={'closed':{'type':Sequelize[_0x2d5b('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x2d5b('0x2')]},'note':{'type':Sequelize[_0x2d5b('0x2')]},'read1stAt':{'type':Sequelize[_0x2d5b('0x3')]},'threadId':{'type':Sequelize[_0x2d5b('0x2')]},'externalUrl':{'type':Sequelize[_0x2d5b('0x2')]},'lastMsgAt':{'type':Sequelize[_0x2d5b('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcea5=['DATE','STRING','out','sequelize','exports','BOOLEAN'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcea5,0xed));var _0x5cea=function(_0x581a72,_0x40c56f){_0x581a72=_0x581a72-0x0;var _0x15483f=_0xcea5[_0x581a72];return _0x15483f;};'use strict';var Sequelize=require(_0x5cea('0x0'));module[_0x5cea('0x1')]={'closed':{'type':Sequelize[_0x5cea('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5cea('0x3')]},'disposition':{'type':Sequelize[_0x5cea('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x5cea('0x3')]},'threadId':{'type':Sequelize[_0x5cea('0x4')]},'externalUrl':{'type':Sequelize[_0x5cea('0x4')]},'lastMsgAt':{'type':Sequelize[_0x5cea('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x5cea('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x5cea('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index a08a0c6..8688059 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 _0xd3ea=['dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','add','day','merge','filter','options','include','tag','push','Tag','Tags','distinct','read','OpenchannelMessage','Messages','direction','createdAt','includeAll','Users','CmContact','Contact','fullname','internal','OpenchannelAccount','color','ThroughTags','findAll','catch','show','length','create','body','find','describe','addMessage','omit','ids','getMessages','findOne','params','order','OpenchannelInteractionId','$gte','format','addTags','setTags','spread','emit','removeTags','moment','bluebird','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','end','error','stack','name','index','OpenchannelInteraction','rawAttributes','model','keys','query'];(function(_0x433a46,_0x105fcc){var _0xb5ba01=function(_0x257e81){while(--_0x257e81){_0x433a46['push'](_0x433a46['shift']());}};_0xb5ba01(++_0x105fcc);}(_0xd3ea,0x9e));var _0xad3e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd3ea[_0x1facfa];return _0x9ec701;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xad3e('0x0'));var BPromise=require(_0xad3e('0x1'));var Mustache=require(_0xad3e('0x2'));var util=require(_0xad3e('0x3'));var path=require(_0xad3e('0x4'));var sox=require(_0xad3e('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xad3e('0x6'));var squel=require(_0xad3e('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xad3e('0x8'));var toCsv=require(_0xad3e('0x9'));var querystring=require(_0xad3e('0xa'));var Papa=require(_0xad3e('0xb'));var qs=require(_0xad3e('0xc'));var logger=require(_0xad3e('0xd'))(_0xad3e('0xe'));var utils=require(_0xad3e('0xf'));var config=require(_0xad3e('0x10'));var db=require(_0xad3e('0x11'))['db'];var socket=require(_0xad3e('0x12'))({'host':'localhost','port':0x18eb});require('./openchannelInteraction.socket')[_0xad3e('0x13')](socket);function respondWithStatusCode(_0x3ac5ad,_0x1fe51c){_0x1fe51c=_0x1fe51c||0xcc;return function(_0x56fd54){if(_0x56fd54){return _0x3ac5ad[_0xad3e('0x14')](_0x1fe51c);}return _0x3ac5ad[_0xad3e('0x15')](_0x1fe51c)['end']();};}function respondWithResult(_0x4381df,_0x462669){_0x462669=_0x462669||0xc8;return function(_0x17cfce){if(_0x17cfce){return _0x4381df[_0xad3e('0x15')](_0x462669)[_0xad3e('0x16')](_0x17cfce);}};}function respondWithFilteredResult(_0x4d58f4,_0x43cbdd){return function(_0x26f914){if(_0x26f914){var _0x5db383=_0x26f914[_0xad3e('0x17')],_0x1820c3=_0x43cbdd[_0xad3e('0x18')],_0x38eec7=_0x43cbdd['offset']+_0x43cbdd[_0xad3e('0x19')],_0x25cbcd;if(_0x38eec7>=_0x5db383){_0x38eec7=_0x5db383;_0x25cbcd=0xc8;}else{_0x25cbcd=0xce;}_0x4d58f4[_0xad3e('0x15')](_0x25cbcd);return _0x4d58f4[_0xad3e('0x1a')](_0xad3e('0x1b'),_0x1820c3+'-'+_0x38eec7+'/'+_0x5db383)[_0xad3e('0x16')](_0x26f914);}return null;};}function patchUpdates(_0x647f30){return function(_0x1cfce3){try{jsonpatch[_0xad3e('0x1c')](_0x1cfce3,_0x647f30,!![]);}catch(_0x44661d){return BPromise['reject'](_0x44661d);}return _0x1cfce3['save']();};}function saveUpdates(_0x59ef57,_0x24bb98){return function(_0x53dad6){if(_0x53dad6){return _0x53dad6[_0xad3e('0x1d')](_0x59ef57)[_0xad3e('0x1e')](function(_0x2bff61){return _0x2bff61;});}return null;};}function removeEntity(_0x5dfbbd,_0x40ab13){return function(_0x16ecf6){if(_0x16ecf6){return _0x16ecf6[_0xad3e('0x1f')]()[_0xad3e('0x1e')](function(){_0x5dfbbd[_0xad3e('0x15')](0xcc)[_0xad3e('0x20')]();});}};}function handleEntityNotFound(_0x42d6eb,_0xd08c68){return function(_0x150823){if(!_0x150823){_0x42d6eb[_0xad3e('0x14')](0x194);}return _0x150823;};}function handleError(_0x17cf9d,_0x2aef9d){_0x2aef9d=_0x2aef9d||0x1f4;return function(_0x34a671){logger[_0xad3e('0x21')](_0x34a671[_0xad3e('0x22')]);if(_0x34a671[_0xad3e('0x23')]){delete _0x34a671[_0xad3e('0x23')];}_0x17cf9d[_0xad3e('0x15')](_0x2aef9d)['send'](_0x34a671);};}exports[_0xad3e('0x24')]=function(_0x174767,_0x341b61){var _0x1c31bf={},_0x2b7f4a={},_0x65c5c2={'count':0x0,'rows':[]};var _0x27f506=db[_0xad3e('0x25')][_0xad3e('0x26')];_0x2b7f4a[_0xad3e('0x27')]=_[_0xad3e('0x28')](_0x27f506);var _0x12778c={'dateStart':_0x174767[_0xad3e('0x29')][_0xad3e('0x2a')],'dateEnd':_0x174767['query'][_0xad3e('0x2b')]};delete _0x174767[_0xad3e('0x29')][_0xad3e('0x2a')];delete _0x174767[_0xad3e('0x29')][_0xad3e('0x2b')];_0x2b7f4a['query']=_[_0xad3e('0x28')](_0x174767[_0xad3e('0x29')]);_0x2b7f4a[_0xad3e('0x2c')]=_[_0xad3e('0x2d')](_0x2b7f4a[_0xad3e('0x27')],_0x2b7f4a[_0xad3e('0x29')]);_0x1c31bf[_0xad3e('0x2e')]=_[_0xad3e('0x2d')](_0x2b7f4a[_0xad3e('0x27')],qs['fields'](_0x174767[_0xad3e('0x29')][_0xad3e('0x2f')]));_0x1c31bf['attributes']=_0x1c31bf[_0xad3e('0x2e')]['length']?_0x1c31bf['attributes']:_0x2b7f4a[_0xad3e('0x27')];if(!_0x174767['query'][_0xad3e('0x30')]('nolimit')){_0x1c31bf[_0xad3e('0x19')]=qs['limit'](_0x174767[_0xad3e('0x29')]['limit']);_0x1c31bf[_0xad3e('0x18')]=qs[_0xad3e('0x18')](_0x174767['query'][_0xad3e('0x18')]);}_0x1c31bf['order']=qs['sort'](_0x174767[_0xad3e('0x29')][_0xad3e('0x31')]);_0x1c31bf[_0xad3e('0x32')]=qs[_0xad3e('0x2c')](_[_0xad3e('0x33')](_0x174767[_0xad3e('0x29')],_0x2b7f4a[_0xad3e('0x2c')]));if(_0x12778c[_0xad3e('0x2a')]){if(_0x12778c[_0xad3e('0x2b')]){_0x12778c['dateEnd']=moment(_0x12778c[_0xad3e('0x2b')])[_0xad3e('0x34')](0x1,_0xad3e('0x35'));}else{_0x12778c[_0xad3e('0x2b')]=moment(_0x12778c[_0xad3e('0x2a')])['add'](0x1,'day');}_[_0xad3e('0x36')](_0x1c31bf[_0xad3e('0x32')],{'createdAt':{'$gte':_0x12778c[_0xad3e('0x2a')],'$lte':_0x12778c[_0xad3e('0x2b')]}});}if(_0x174767['query'][_0xad3e('0x37')]){_0x1c31bf[_0xad3e('0x32')]=_[_0xad3e('0x36')](_0x1c31bf[_0xad3e('0x32')],{'$or':_['map'](_0x1c31bf[_0xad3e('0x2e')],function(_0xd86450){var _0x3d7107={};_0x3d7107[_0xd86450]={'$like':'%'+_0x174767['query']['filter']+'%'};return _0x3d7107;})});}_0x1c31bf=_['merge']({},_0x1c31bf,_0x174767[_0xad3e('0x38')]);var _0x196b34={'where':_0x1c31bf[_0xad3e('0x32')]};_0x196b34[_0xad3e('0x39')]=[];if(_0x174767[_0xad3e('0x29')][_0xad3e('0x3a')]){_0x196b34[_0xad3e('0x39')][_0xad3e('0x3b')]({'model':db[_0xad3e('0x3c')],'as':_0xad3e('0x3d'),'attributes':['id'],'where':{'id':_0x174767[_0xad3e('0x29')][_0xad3e('0x3a')]},'required':!![]});_0x196b34[_0xad3e('0x3e')]=!![];}if(_0x174767[_0xad3e('0x29')][_0xad3e('0x3f')]){_0x196b34[_0xad3e('0x39')][_0xad3e('0x3b')]({'model':db[_0xad3e('0x40')],'as':_0xad3e('0x41'),'attributes':['id',_0xad3e('0x42'),_0xad3e('0x43'),_0xad3e('0x3f')],'where':{'direction':'in','read':_0x174767[_0xad3e('0x29')][_0xad3e('0x3f')]||![]},'required':!![]});_0x196b34[_0xad3e('0x3e')]=!![];}return db['OpenchannelInteraction'][_0xad3e('0x17')](_0x196b34)[_0xad3e('0x1e')](function(_0x1c5a2a){_0x65c5c2['count']=_0x1c5a2a;if(_0x174767[_0xad3e('0x29')][_0xad3e('0x44')]){_0x1c31bf[_0xad3e('0x39')]=[{'model':db['User'],'as':_0xad3e('0x45'),'required':![],'attributes':['id','name','fullname']},{'model':db[_0xad3e('0x46')],'as':_0xad3e('0x47'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xad3e('0x23'),_0xad3e('0x48'),_0xad3e('0x49')],'required':![]},{'model':db[_0xad3e('0x4a')],'as':'Account','attributes':['name','key'],'required':![]},{'model':db[_0xad3e('0x40')],'as':_0xad3e('0x41'),'attributes':['id',_0xad3e('0x42'),_0xad3e('0x43'),_0xad3e('0x3f')],'where':{'direction':'in','read':_0x174767['query']['read']||![]},'required':_0x174767[_0xad3e('0x29')][_0xad3e('0x3f')]||![]},{'model':db[_0xad3e('0x3c')],'as':_0xad3e('0x3d'),'attributes':['id','name',_0xad3e('0x4b')],'required':_0x174767[_0xad3e('0x29')][_0xad3e('0x3a')]?!![]:![]},{'model':db['Tag'],'as':_0xad3e('0x4c'),'attributes':['id',_0xad3e('0x23'),'color'],'through':_0x174767['query'][_0xad3e('0x3a')]?{'attributes':[],'where':{'TagId':_0x174767[_0xad3e('0x29')][_0xad3e('0x3a')]||undefined}}:{},'required':_0x174767[_0xad3e('0x29')][_0xad3e('0x3a')]?!![]:![]}];}return db[_0xad3e('0x25')][_0xad3e('0x4d')](_0x1c31bf);})[_0xad3e('0x1e')](function(_0xbbb091){_0x65c5c2['rows']=_0xbbb091;return _0x65c5c2;})[_0xad3e('0x1e')](respondWithFilteredResult(_0x341b61,_0x1c31bf))[_0xad3e('0x4e')](handleError(_0x341b61,null));};exports[_0xad3e('0x4f')]=function(_0x3324e0,_0x318f26){var _0x5cb152={'raw':![],'where':{'id':_0x3324e0['params']['id']}},_0x336bf9={};_0x336bf9[_0xad3e('0x27')]=_[_0xad3e('0x28')](db['OpenchannelInteraction']['rawAttributes']);_0x336bf9[_0xad3e('0x29')]=_[_0xad3e('0x28')](_0x3324e0[_0xad3e('0x29')]);_0x336bf9[_0xad3e('0x2c')]=_[_0xad3e('0x2d')](_0x336bf9[_0xad3e('0x27')],_0x336bf9['query']);_0x5cb152[_0xad3e('0x2e')]=_[_0xad3e('0x2d')](_0x336bf9['model'],qs['fields'](_0x3324e0[_0xad3e('0x29')][_0xad3e('0x2f')]));_0x5cb152[_0xad3e('0x2e')]=_0x5cb152['attributes'][_0xad3e('0x50')]?_0x5cb152[_0xad3e('0x2e')]:_0x336bf9[_0xad3e('0x27')];if(_0x3324e0[_0xad3e('0x29')][_0xad3e('0x44')]){_0x5cb152[_0xad3e('0x39')]=[{'all':!![]}];}_0x5cb152=_['merge']({},_0x5cb152,_0x3324e0[_0xad3e('0x38')]);return db['OpenchannelInteraction']['find'](_0x5cb152)[_0xad3e('0x1e')](handleEntityNotFound(_0x318f26,null))[_0xad3e('0x1e')](respondWithResult(_0x318f26,null))['catch'](handleError(_0x318f26,null));};exports[_0xad3e('0x51')]=function(_0x677c75,_0x57681f){return db[_0xad3e('0x25')][_0xad3e('0x51')](_0x677c75[_0xad3e('0x52')],{})[_0xad3e('0x1e')](respondWithResult(_0x57681f,0xc9))[_0xad3e('0x4e')](handleError(_0x57681f,null));};exports[_0xad3e('0x1d')]=function(_0x1450dd,_0x505421){if(_0x1450dd['body']['id']){delete _0x1450dd['body']['id'];}return db['OpenchannelInteraction'][_0xad3e('0x53')]({'where':{'id':_0x1450dd['params']['id']}})[_0xad3e('0x1e')](handleEntityNotFound(_0x505421,null))[_0xad3e('0x1e')](saveUpdates(_0x1450dd[_0xad3e('0x52')],null))[_0xad3e('0x1e')](respondWithResult(_0x505421,null))[_0xad3e('0x4e')](handleError(_0x505421,null));};exports[_0xad3e('0x1f')]=function(_0x3b893f,_0x54c5a0){return db[_0xad3e('0x25')][_0xad3e('0x53')]({'where':{'id':_0x3b893f['params']['id']}})['then'](handleEntityNotFound(_0x54c5a0,null))[_0xad3e('0x1e')](removeEntity(_0x54c5a0,null))[_0xad3e('0x4e')](handleError(_0x54c5a0,null));};exports[_0xad3e('0x54')]=function(_0x2dffbf,_0x179e79){return db['OpenchannelInteraction'][_0xad3e('0x54')]()[_0xad3e('0x1e')](respondWithResult(_0x179e79,null))['catch'](handleError(_0x179e79,null));};exports['addMessage']=function(_0x528b09,_0xefff9,_0xe8fe7d){return db[_0xad3e('0x40')][_0xad3e('0x53')]({'where':{'id':_0x528b09['params']['id']}})[_0xad3e('0x1e')](handleEntityNotFound(_0xefff9,null))[_0xad3e('0x1e')](function(_0x2add97){if(_0x2add97){return _0x2add97[_0xad3e('0x55')](_0x528b09[_0xad3e('0x52')]['ids'],_[_0xad3e('0x56')](_0x528b09[_0xad3e('0x52')],[_0xad3e('0x57'),'id'])||{});}})['then'](respondWithResult(_0xefff9,null))[_0xad3e('0x4e')](handleError(_0xefff9,null));};exports[_0xad3e('0x58')]=function(_0x23ba04,_0x47276f,_0x4ce840){var _0x181564={'raw':![],'where':{}};var _0x5d4871={};var _0x1d8045={'count':0x0,'rows':[]};return db[_0xad3e('0x25')][_0xad3e('0x59')]({'where':{'id':_0x23ba04[_0xad3e('0x5a')]['id']}})[_0xad3e('0x1e')](handleEntityNotFound(_0x47276f,null))[_0xad3e('0x1e')](function(_0x37d5de){if(_0x37d5de){_0x5d4871['model']=_[_0xad3e('0x28')](db[_0xad3e('0x40')]['rawAttributes']);_0x5d4871[_0xad3e('0x29')]=_[_0xad3e('0x28')](_0x23ba04[_0xad3e('0x29')]);_0x5d4871[_0xad3e('0x2c')]=_['intersection'](_0x5d4871[_0xad3e('0x27')],_0x5d4871[_0xad3e('0x29')]);_0x181564[_0xad3e('0x2e')]=_[_0xad3e('0x2d')](_0x5d4871[_0xad3e('0x27')],qs[_0xad3e('0x2f')](_0x23ba04[_0xad3e('0x29')][_0xad3e('0x2f')]));_0x181564[_0xad3e('0x2e')]=_0x181564['attributes'][_0xad3e('0x50')]?_0x181564[_0xad3e('0x2e')]:_0x5d4871['model'];if(!_0x23ba04['query']['hasOwnProperty']('nolimit')){_0x181564[_0xad3e('0x19')]=qs[_0xad3e('0x19')](_0x23ba04[_0xad3e('0x29')][_0xad3e('0x19')]);_0x181564[_0xad3e('0x18')]=qs[_0xad3e('0x18')](_0x23ba04[_0xad3e('0x29')][_0xad3e('0x18')]);}_0x181564[_0xad3e('0x5b')]=qs[_0xad3e('0x31')](_0x23ba04[_0xad3e('0x29')][_0xad3e('0x31')]);_0x181564[_0xad3e('0x32')]=qs[_0xad3e('0x2c')](_[_0xad3e('0x33')](_0x23ba04['query'],_0x5d4871[_0xad3e('0x2c')]));_0x181564[_0xad3e('0x32')][_0xad3e('0x5c')]=_0x37d5de['id'];if(_0x23ba04[_0xad3e('0x29')]['filter']){_0x181564['where']=_[_0xad3e('0x36')](_0x181564[_0xad3e('0x32')],{'$or':_['map'](_0x181564[_0xad3e('0x2e')],function(_0xae6c9){var _0x28adc9={};_0x28adc9[_0xae6c9]={'$like':'%'+_0x23ba04['query'][_0xad3e('0x37')]+'%'};return _0x28adc9;})});}if(_0x23ba04[_0xad3e('0x29')][_0xad3e('0x5d')]){var _0x3ce75c=_0x23ba04['query'][_0xad3e('0x5d')]['split'](',');var _0x496b9e={};_0x496b9e[_0x3ce75c[0x0]]={'$gte':moment(_0x3ce75c[0x1])[_0xad3e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss')};_0x181564[_0xad3e('0x32')]=_[_0xad3e('0x36')](_0x181564[_0xad3e('0x32')],_0x496b9e);}_0x181564=_[_0xad3e('0x36')]({},_0x181564,_0x23ba04['options']);return db[_0xad3e('0x40')][_0xad3e('0x17')]({'where':_0x181564[_0xad3e('0x32')]})['then'](function(_0x1b19d7){_0x1d8045[_0xad3e('0x17')]=_0x1b19d7;if(_0x23ba04[_0xad3e('0x29')][_0xad3e('0x44')]){_0x181564['include']=[{'all':!![]}];}return db[_0xad3e('0x40')][_0xad3e('0x4d')](_0x181564);})[_0xad3e('0x1e')](function(_0x367d65){_0x1d8045['rows']=_0x367d65;return _0x1d8045;});}})['then'](respondWithFilteredResult(_0x47276f,_0x181564))[_0xad3e('0x4e')](handleError(_0x47276f,null));};exports[_0xad3e('0x5f')]=function(_0x640c76,_0x3e053e,_0x554581){return db[_0xad3e('0x25')]['find']({'where':{'id':_0x640c76[_0xad3e('0x5a')]['id']}})[_0xad3e('0x1e')](handleEntityNotFound(_0x3e053e,null))[_0xad3e('0x1e')](function(_0xd17342){if(_0xd17342){return _0xd17342[_0xad3e('0x60')](_0x640c76[_0xad3e('0x52')][_0xad3e('0x57')],_[_0xad3e('0x56')](_0x640c76['body'],[_0xad3e('0x57'),'id'])||{})[_0xad3e('0x61')](function(){return db[_0xad3e('0x3c')]['findAll']({'attributes':['id',_0xad3e('0x23'),'color'],'where':{'id':_0x640c76['body'][_0xad3e('0x57')]}});})[_0xad3e('0x1e')](function(_0x4be8ea){socket[_0xad3e('0x62')]('openchannelInteractionTags:save',{'id':Number(_0x640c76[_0xad3e('0x5a')]['id']),'tags':_0x4be8ea||[]});return{'id':Number(_0x640c76[_0xad3e('0x5a')]['id']),'tags':_0x4be8ea||[]};});}})[_0xad3e('0x1e')](respondWithResult(_0x3e053e,null))[_0xad3e('0x4e')](handleError(_0x3e053e,null));};exports[_0xad3e('0x63')]=function(_0x2968a9,_0x4c52cc,_0x27ba35){var _0x300757;return db[_0xad3e('0x25')]['find']({'where':{'id':_0x2968a9[_0xad3e('0x5a')]['id']}})[_0xad3e('0x1e')](handleEntityNotFound(_0x4c52cc,null))[_0xad3e('0x1e')](function(_0x1f34b5){if(_0x1f34b5){return _0x1f34b5[_0xad3e('0x63')](_0x2968a9[_0xad3e('0x29')][_0xad3e('0x57')]);}})['then'](respondWithStatusCode(_0x4c52cc,null))['catch'](handleError(_0x4c52cc,null));}; \ No newline at end of file +var _0xc7e3=['add','day','merge','map','filter','options','tag','include','Tag','Tags','distinct','push','OpenchannelMessage','Messages','direction','createdAt','read','includeAll','Users','CmContact','Contact','User','Owner','fullname','OpenchannelAccount','Account','key','ThroughTags','color','findAll','catch','params','keys','find','create','body','describe','addMessage','ids','hasOwnProperty','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','emit','openchannelInteractionTags:save','removeTags','fast-json-patch','moment','mustache','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','OpenchannelInteraction','rawAttributes','model','query','dateEnd','dateStart','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','pick'];(function(_0x392dff,_0x128a59){var _0x453041=function(_0x5c9fec){while(--_0x5c9fec){_0x392dff['push'](_0x392dff['shift']());}};_0x453041(++_0x128a59);}(_0xc7e3,0xfc));var _0x3c7e=function(_0x1d397b,_0x29ffdf){_0x1d397b=_0x1d397b-0x0;var _0x482905=_0xc7e3[_0x1d397b];return _0x482905;};'use strict';var jsonpatch=require(_0x3c7e('0x0'));var rp=require('request-promise');var moment=require(_0x3c7e('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x3c7e('0x2'));var util=require('util');var path=require('path');var sox=require(_0x3c7e('0x3'));var csv=require('to-csv');var ejs=require(_0x3c7e('0x4'));var fs=require('fs');var _=require(_0x3c7e('0x5'));var squel=require(_0x3c7e('0x6'));var crypto=require('crypto');var jsforce=require(_0x3c7e('0x7'));var deskjs=require(_0x3c7e('0x8'));var toCsv=require('to-csv');var querystring=require(_0x3c7e('0x9'));var Papa=require(_0x3c7e('0xa'));var qs=require(_0x3c7e('0xb'));var logger=require(_0x3c7e('0xc'))('api');var utils=require(_0x3c7e('0xd'));var config=require('../../config/environment');var db=require(_0x3c7e('0xe'))['db'];var socket=require(_0x3c7e('0xf'))({'host':'localhost','port':0x18eb});require(_0x3c7e('0x10'))[_0x3c7e('0x11')](socket);function respondWithStatusCode(_0x3b2f73,_0x99ae51){_0x99ae51=_0x99ae51||0xcc;return function(_0x55d2fc){if(_0x55d2fc){return _0x3b2f73[_0x3c7e('0x12')](_0x99ae51);}return _0x3b2f73[_0x3c7e('0x13')](_0x99ae51)['end']();};}function respondWithResult(_0x3a1516,_0x19298c){_0x19298c=_0x19298c||0xc8;return function(_0x5197e6){if(_0x5197e6){return _0x3a1516[_0x3c7e('0x13')](_0x19298c)[_0x3c7e('0x14')](_0x5197e6);}};}function respondWithFilteredResult(_0x256e18,_0x539234){return function(_0x8979b){if(_0x8979b){var _0x30b2d2=_0x8979b[_0x3c7e('0x15')],_0x581551=_0x539234['offset'],_0x345829=_0x539234['offset']+_0x539234[_0x3c7e('0x16')],_0x286daa;if(_0x345829>=_0x30b2d2){_0x345829=_0x30b2d2;_0x286daa=0xc8;}else{_0x286daa=0xce;}_0x256e18['status'](_0x286daa);return _0x256e18[_0x3c7e('0x17')](_0x3c7e('0x18'),_0x581551+'-'+_0x345829+'/'+_0x30b2d2)['json'](_0x8979b);}return null;};}function patchUpdates(_0x5c1b1f){return function(_0x53bb1f){try{jsonpatch[_0x3c7e('0x19')](_0x53bb1f,_0x5c1b1f,!![]);}catch(_0x1578a9){return BPromise[_0x3c7e('0x1a')](_0x1578a9);}return _0x53bb1f['save']();};}function saveUpdates(_0x60f5ca,_0x350fc7){return function(_0x31e707){if(_0x31e707){return _0x31e707[_0x3c7e('0x1b')](_0x60f5ca)[_0x3c7e('0x1c')](function(_0x34ebff){return _0x34ebff;});}return null;};}function removeEntity(_0x250f70,_0x4c3f56){return function(_0x2eedab){if(_0x2eedab){return _0x2eedab[_0x3c7e('0x1d')]()[_0x3c7e('0x1c')](function(){_0x250f70['status'](0xcc)[_0x3c7e('0x1e')]();});}};}function handleEntityNotFound(_0x243cff,_0x4f5240){return function(_0x15f38b){if(!_0x15f38b){_0x243cff[_0x3c7e('0x12')](0x194);}return _0x15f38b;};}function handleError(_0x4fafdc,_0x5be5bd){_0x5be5bd=_0x5be5bd||0x1f4;return function(_0x24b757){logger[_0x3c7e('0x1f')](_0x24b757[_0x3c7e('0x20')]);if(_0x24b757[_0x3c7e('0x21')]){delete _0x24b757[_0x3c7e('0x21')];}_0x4fafdc[_0x3c7e('0x13')](_0x5be5bd)['send'](_0x24b757);};}exports['index']=function(_0x2d8274,_0x3e7e19){var _0x1fe23c={},_0x4750dd={},_0x351c75={'count':0x0,'rows':[]};var _0x1764ac=db[_0x3c7e('0x22')][_0x3c7e('0x23')];_0x4750dd[_0x3c7e('0x24')]=_['keys'](_0x1764ac);var _0x5e4387={'dateStart':_0x2d8274['query']['dateStart'],'dateEnd':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x26')]};delete _0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x27')];delete _0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x26')];_0x4750dd[_0x3c7e('0x25')]=_['keys'](_0x2d8274['query']);_0x4750dd['filters']=_['intersection'](_0x4750dd[_0x3c7e('0x24')],_0x4750dd[_0x3c7e('0x25')]);_0x1fe23c[_0x3c7e('0x28')]=_[_0x3c7e('0x29')](_0x4750dd['model'],qs[_0x3c7e('0x2a')](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2a')]));_0x1fe23c[_0x3c7e('0x28')]=_0x1fe23c[_0x3c7e('0x28')][_0x3c7e('0x2b')]?_0x1fe23c[_0x3c7e('0x28')]:_0x4750dd['model'];if(!_0x2d8274[_0x3c7e('0x25')]['hasOwnProperty'](_0x3c7e('0x2c'))){_0x1fe23c[_0x3c7e('0x16')]=qs[_0x3c7e('0x16')](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x16')]);_0x1fe23c[_0x3c7e('0x2d')]=qs['offset'](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2d')]);}_0x1fe23c[_0x3c7e('0x2e')]=qs['sort'](_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x2f')]);_0x1fe23c[_0x3c7e('0x30')]=qs[_0x3c7e('0x31')](_[_0x3c7e('0x32')](_0x2d8274[_0x3c7e('0x25')],_0x4750dd[_0x3c7e('0x31')]));if(_0x5e4387[_0x3c7e('0x27')]){if(_0x5e4387['dateEnd']){_0x5e4387[_0x3c7e('0x26')]=moment(_0x5e4387[_0x3c7e('0x26')])[_0x3c7e('0x33')](0x1,_0x3c7e('0x34'));}else{_0x5e4387['dateEnd']=moment(_0x5e4387[_0x3c7e('0x27')])[_0x3c7e('0x33')](0x1,_0x3c7e('0x34'));}_[_0x3c7e('0x35')](_0x1fe23c['where'],{'createdAt':{'$gte':_0x5e4387[_0x3c7e('0x27')],'$lte':_0x5e4387[_0x3c7e('0x26')]}});}if(_0x2d8274['query']['filter']){_0x1fe23c[_0x3c7e('0x30')]=_[_0x3c7e('0x35')](_0x1fe23c['where'],{'$or':_[_0x3c7e('0x36')](_0x1fe23c['attributes'],function(_0x14f539){var _0x4846b2={};_0x4846b2[_0x14f539]={'$like':'%'+_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x37')]+'%'};return _0x4846b2;})});}_0x1fe23c=_[_0x3c7e('0x35')]({},_0x1fe23c,_0x2d8274[_0x3c7e('0x38')]);var _0x44afc9={'where':_0x1fe23c['where']};_0x44afc9['include']=[];if(_0x2d8274['query'][_0x3c7e('0x39')]){_0x44afc9[_0x3c7e('0x3a')]['push']({'model':db[_0x3c7e('0x3b')],'as':_0x3c7e('0x3c'),'attributes':['id'],'where':{'id':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]},'required':!![]});_0x44afc9[_0x3c7e('0x3d')]=!![];}if(_0x2d8274[_0x3c7e('0x25')]['read']){_0x44afc9[_0x3c7e('0x3a')][_0x3c7e('0x3e')]({'model':db[_0x3c7e('0x3f')],'as':_0x3c7e('0x40'),'attributes':['id',_0x3c7e('0x41'),_0x3c7e('0x42'),_0x3c7e('0x43')],'where':{'direction':'in','read':_0x2d8274['query'][_0x3c7e('0x43')]||![]},'required':!![]});_0x44afc9[_0x3c7e('0x3d')]=!![];}return db[_0x3c7e('0x22')][_0x3c7e('0x15')](_0x44afc9)[_0x3c7e('0x1c')](function(_0x560800){_0x351c75['count']=_0x560800;if(_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x44')]){_0x1fe23c[_0x3c7e('0x3a')]=[{'model':db['User'],'as':_0x3c7e('0x45'),'required':![],'attributes':['id',_0x3c7e('0x21'),'fullname']},{'model':db[_0x3c7e('0x46')],'as':_0x3c7e('0x47'),'required':![]},{'model':db[_0x3c7e('0x48')],'as':_0x3c7e('0x49'),'attributes':[_0x3c7e('0x21'),_0x3c7e('0x4a'),'internal'],'required':![]},{'model':db[_0x3c7e('0x4b')],'as':_0x3c7e('0x4c'),'attributes':[_0x3c7e('0x21'),_0x3c7e('0x4d')],'required':![]},{'model':db[_0x3c7e('0x3f')],'as':'Messages','attributes':['id',_0x3c7e('0x41'),_0x3c7e('0x42'),'read'],'where':{'direction':'in','read':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x43')]||![]},'required':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x43')]||![]},{'model':db[_0x3c7e('0x3b')],'as':_0x3c7e('0x3c'),'attributes':['id',_0x3c7e('0x21'),'color'],'required':_0x2d8274['query']['tag']?!![]:![]},{'model':db['Tag'],'as':_0x3c7e('0x4e'),'attributes':['id',_0x3c7e('0x21'),_0x3c7e('0x4f')],'through':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]?{'attributes':[],'where':{'TagId':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]||undefined}}:{},'required':_0x2d8274[_0x3c7e('0x25')][_0x3c7e('0x39')]?!![]:![]}];}return db[_0x3c7e('0x22')][_0x3c7e('0x50')](_0x1fe23c);})[_0x3c7e('0x1c')](function(_0x57f2dd){_0x351c75['rows']=_0x57f2dd;return _0x351c75;})['then'](respondWithFilteredResult(_0x3e7e19,_0x1fe23c))[_0x3c7e('0x51')](handleError(_0x3e7e19,null));};exports['show']=function(_0x5c337a,_0x378a5e){var _0x3664d0={'raw':![],'where':{'id':_0x5c337a[_0x3c7e('0x52')]['id']}},_0x25aa7c={};_0x25aa7c[_0x3c7e('0x24')]=_['keys'](db[_0x3c7e('0x22')][_0x3c7e('0x23')]);_0x25aa7c[_0x3c7e('0x25')]=_[_0x3c7e('0x53')](_0x5c337a[_0x3c7e('0x25')]);_0x25aa7c['filters']=_[_0x3c7e('0x29')](_0x25aa7c['model'],_0x25aa7c[_0x3c7e('0x25')]);_0x3664d0['attributes']=_[_0x3c7e('0x29')](_0x25aa7c[_0x3c7e('0x24')],qs[_0x3c7e('0x2a')](_0x5c337a[_0x3c7e('0x25')][_0x3c7e('0x2a')]));_0x3664d0[_0x3c7e('0x28')]=_0x3664d0[_0x3c7e('0x28')]['length']?_0x3664d0[_0x3c7e('0x28')]:_0x25aa7c[_0x3c7e('0x24')];if(_0x5c337a[_0x3c7e('0x25')][_0x3c7e('0x44')]){_0x3664d0['include']=[{'all':!![]}];}_0x3664d0=_[_0x3c7e('0x35')]({},_0x3664d0,_0x5c337a[_0x3c7e('0x38')]);return db[_0x3c7e('0x22')][_0x3c7e('0x54')](_0x3664d0)['then'](handleEntityNotFound(_0x378a5e,null))[_0x3c7e('0x1c')](respondWithResult(_0x378a5e,null))[_0x3c7e('0x51')](handleError(_0x378a5e,null));};exports[_0x3c7e('0x55')]=function(_0x21984d,_0x23dd25){return db[_0x3c7e('0x22')]['create'](_0x21984d[_0x3c7e('0x56')],{})[_0x3c7e('0x1c')](respondWithResult(_0x23dd25,0xc9))[_0x3c7e('0x51')](handleError(_0x23dd25,null));};exports[_0x3c7e('0x1b')]=function(_0x14e118,_0x34c3a4){if(_0x14e118['body']['id']){delete _0x14e118[_0x3c7e('0x56')]['id'];}return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x14e118[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x34c3a4,null))[_0x3c7e('0x1c')](saveUpdates(_0x14e118[_0x3c7e('0x56')],null))[_0x3c7e('0x1c')](respondWithResult(_0x34c3a4,null))['catch'](handleError(_0x34c3a4,null));};exports['destroy']=function(_0x366660,_0x81e157){return db['OpenchannelInteraction']['find']({'where':{'id':_0x366660[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x81e157,null))['then'](removeEntity(_0x81e157,null))[_0x3c7e('0x51')](handleError(_0x81e157,null));};exports[_0x3c7e('0x57')]=function(_0x2acdd6,_0x690340){return db[_0x3c7e('0x22')][_0x3c7e('0x57')]()[_0x3c7e('0x1c')](respondWithResult(_0x690340,null))['catch'](handleError(_0x690340,null));};exports['addMessage']=function(_0xe23583,_0x5c4100,_0x231434){return db[_0x3c7e('0x3f')][_0x3c7e('0x54')]({'where':{'id':_0xe23583[_0x3c7e('0x52')]['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x5c4100,null))[_0x3c7e('0x1c')](function(_0x10e7d7){if(_0x10e7d7){return _0x10e7d7[_0x3c7e('0x58')](_0xe23583[_0x3c7e('0x56')][_0x3c7e('0x59')],_['omit'](_0xe23583['body'],[_0x3c7e('0x59'),'id'])||{});}})['then'](respondWithResult(_0x5c4100,null))['catch'](handleError(_0x5c4100,null));};exports['getMessages']=function(_0x59260d,_0x27635d,_0x62238d){var _0x206fa0={'raw':![],'where':{}};var _0x7b47a4={};var _0x12709a={'count':0x0,'rows':[]};return db[_0x3c7e('0x22')]['findOne']({'where':{'id':_0x59260d['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x27635d,null))[_0x3c7e('0x1c')](function(_0x318b1f){if(_0x318b1f){_0x7b47a4[_0x3c7e('0x24')]=_[_0x3c7e('0x53')](db['OpenchannelMessage'][_0x3c7e('0x23')]);_0x7b47a4['query']=_[_0x3c7e('0x53')](_0x59260d[_0x3c7e('0x25')]);_0x7b47a4[_0x3c7e('0x31')]=_[_0x3c7e('0x29')](_0x7b47a4[_0x3c7e('0x24')],_0x7b47a4['query']);_0x206fa0[_0x3c7e('0x28')]=_[_0x3c7e('0x29')](_0x7b47a4['model'],qs[_0x3c7e('0x2a')](_0x59260d[_0x3c7e('0x25')]['fields']));_0x206fa0[_0x3c7e('0x28')]=_0x206fa0[_0x3c7e('0x28')]['length']?_0x206fa0['attributes']:_0x7b47a4['model'];if(!_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x5a')](_0x3c7e('0x2c'))){_0x206fa0[_0x3c7e('0x16')]=qs[_0x3c7e('0x16')](_0x59260d[_0x3c7e('0x25')]['limit']);_0x206fa0[_0x3c7e('0x2d')]=qs[_0x3c7e('0x2d')](_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x2d')]);}_0x206fa0['order']=qs[_0x3c7e('0x2f')](_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x2f')]);_0x206fa0['where']=qs[_0x3c7e('0x31')](_[_0x3c7e('0x32')](_0x59260d[_0x3c7e('0x25')],_0x7b47a4[_0x3c7e('0x31')]));_0x206fa0[_0x3c7e('0x30')]['OpenchannelInteractionId']=_0x318b1f['id'];if(_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x37')]){_0x206fa0['where']=_[_0x3c7e('0x35')](_0x206fa0['where'],{'$or':_[_0x3c7e('0x36')](_0x206fa0[_0x3c7e('0x28')],function(_0x23908f){var _0x13a66b={};_0x13a66b[_0x23908f]={'$like':'%'+_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x37')]+'%'};return _0x13a66b;})});}if(_0x59260d[_0x3c7e('0x25')]['$gte']){var _0x150be5=_0x59260d[_0x3c7e('0x25')][_0x3c7e('0x5b')][_0x3c7e('0x5c')](',');var _0x452805={};_0x452805[_0x150be5[0x0]]={'$gte':moment(_0x150be5[0x1])[_0x3c7e('0x5d')](_0x3c7e('0x5e'))};_0x206fa0[_0x3c7e('0x30')]=_[_0x3c7e('0x35')](_0x206fa0['where'],_0x452805);}_0x206fa0=_[_0x3c7e('0x35')]({},_0x206fa0,_0x59260d[_0x3c7e('0x38')]);return db[_0x3c7e('0x3f')][_0x3c7e('0x15')]({'where':_0x206fa0[_0x3c7e('0x30')]})[_0x3c7e('0x1c')](function(_0x4ac871){_0x12709a['count']=_0x4ac871;if(_0x59260d[_0x3c7e('0x25')]['includeAll']){_0x206fa0[_0x3c7e('0x3a')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x3c7e('0x50')](_0x206fa0);})['then'](function(_0x565af1){_0x12709a[_0x3c7e('0x5f')]=_0x565af1;return _0x12709a;});}})[_0x3c7e('0x1c')](respondWithFilteredResult(_0x27635d,_0x206fa0))[_0x3c7e('0x51')](handleError(_0x27635d,null));};exports[_0x3c7e('0x60')]=function(_0x165aa7,_0x835b8e,_0x9ff3e7){return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x165aa7['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0x835b8e,null))['then'](function(_0x4654c7){if(_0x4654c7){return _0x4654c7['setTags'](_0x165aa7[_0x3c7e('0x56')][_0x3c7e('0x59')],_['omit'](_0x165aa7['body'],[_0x3c7e('0x59'),'id'])||{})[_0x3c7e('0x61')](function(){return db[_0x3c7e('0x3b')][_0x3c7e('0x50')]({'attributes':['id',_0x3c7e('0x21'),'color'],'where':{'id':_0x165aa7['body'][_0x3c7e('0x59')]}});})[_0x3c7e('0x1c')](function(_0x288368){socket[_0x3c7e('0x62')](_0x3c7e('0x63'),{'id':Number(_0x165aa7[_0x3c7e('0x52')]['id']),'tags':_0x288368||[]});return{'id':Number(_0x165aa7[_0x3c7e('0x52')]['id']),'tags':_0x288368||[]};});}})[_0x3c7e('0x1c')](respondWithResult(_0x835b8e,null))['catch'](handleError(_0x835b8e,null));};exports[_0x3c7e('0x64')]=function(_0x4a4294,_0xe54315,_0xa7f327){var _0x3a5d48;return db[_0x3c7e('0x22')][_0x3c7e('0x54')]({'where':{'id':_0x4a4294['params']['id']}})[_0x3c7e('0x1c')](handleEntityNotFound(_0xe54315,null))[_0x3c7e('0x1c')](function(_0x361bab){if(_0x361bab){return _0x361bab['removeTags'](_0x4a4294[_0x3c7e('0x25')]['ids']);}})['then'](respondWithStatusCode(_0xe54315,null))[_0x3c7e('0x51')](handleError(_0xe54315,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 5ad9200..5caa514 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 _0x35f7=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x57d7f7,_0x335c81){var _0x1a6800=function(_0x251345){while(--_0x251345){_0x57d7f7['push'](_0x57d7f7['shift']());}};_0x1a6800(++_0x335c81);}(_0x35f7,0x19f));var _0x735f=function(_0x55015b,_0x51f8d2){_0x55015b=_0x55015b-0x0;var _0x547d02=_0x35f7[_0x55015b];return _0x547d02;};'use strict';var EventEmitter=require(_0x735f('0x0'));var OpenchannelInteraction=require(_0x735f('0x1'))['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x735f('0x2')](0x0);var events={'afterCreate':_0x735f('0x3'),'afterUpdate':_0x735f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x49da90){return function(_0x273ff1,_0x38f0f7,_0x56f09f){OpenchannelInteractionEvents[_0x735f('0x5')](_0x49da90+':'+_0x273ff1['id'],_0x273ff1);OpenchannelInteractionEvents[_0x735f('0x5')](_0x49da90,_0x273ff1);_0x56f09f(null);};}for(var e in events){if(events[_0x735f('0x6')](e)){var event=events[e];OpenchannelInteraction[_0x735f('0x7')](e,emitEvent(event));}}module[_0x735f('0x8')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb19e=['setMaxListeners','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x267029,_0x5bee38){var _0x1c979a=function(_0x2a9dc1){while(--_0x2a9dc1){_0x267029['push'](_0x267029['shift']());}};_0x1c979a(++_0x5bee38);}(_0xb19e,0xd0));var _0xeb19=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xb19e[_0x29d2d2];return _0x3f6476;};'use strict';var EventEmitter=require(_0xeb19('0x0'));var OpenchannelInteraction=require(_0xeb19('0x1'))['db']['OpenchannelInteraction'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeb19('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x33f6c3){return function(_0x42433d,_0x468288,_0x2f6e3a){OpenchannelInteractionEvents[_0xeb19('0x3')](_0x33f6c3+':'+_0x42433d['id'],_0x42433d);OpenchannelInteractionEvents[_0xeb19('0x3')](_0x33f6c3,_0x42433d);_0x2f6e3a(null);};}for(var e in events){if(events[_0xeb19('0x4')](e)){var event=events[e];OpenchannelInteraction[_0xeb19('0x5')](e,emitEvent(event));}}module[_0xeb19('0x6')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 76d2911..4118597 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 _0xc982=['exports','define','OpenchannelInteraction','openchannel_interactions','lodash','../../config/logger','moment','request-promise','./openchannelInteraction.attributes'];(function(_0x21b706,_0x59f0ab){var _0x1807f5=function(_0x28723c){while(--_0x28723c){_0x21b706['push'](_0x21b706['shift']());}};_0x1807f5(++_0x59f0ab);}(_0xc982,0x11b));var _0x2c98=function(_0x10bb45,_0xa57a18){_0x10bb45=_0x10bb45-0x0;var _0x4f1846=_0xc982[_0x10bb45];return _0x4f1846;};'use strict';var _=require(_0x2c98('0x0'));var util=require('util');var logger=require(_0x2c98('0x1'))('api');var moment=require(_0x2c98('0x2'));var BPromise=require('bluebird');var rp=require(_0x2c98('0x3'));var attributes=require(_0x2c98('0x4'));module[_0x2c98('0x5')]=function(_0x4da16c,_0x493d9b){return _0x4da16c[_0x2c98('0x6')](_0x2c98('0x7'),attributes,{'tableName':_0x2c98('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7067=['util','api','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','lodash'];(function(_0x3bf747,_0x20352d){var _0x425334=function(_0x11b0e8){while(--_0x11b0e8){_0x3bf747['push'](_0x3bf747['shift']());}};_0x425334(++_0x20352d);}(_0x7067,0x87));var _0x7706=function(_0x29ea19,_0x3f842e){_0x29ea19=_0x29ea19-0x0;var _0x152d89=_0x7067[_0x29ea19];return _0x152d89;};'use strict';var _=require(_0x7706('0x0'));var util=require(_0x7706('0x1'));var logger=require('../../config/logger')(_0x7706('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x7706('0x3'));module[_0x7706('0x4')]=function(_0x2b5c7d,_0x173d72){return _0x2b5c7d[_0x7706('0x5')](_0x7706('0x6'),attributes,{'tableName':_0x7706('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3c3946d..8487c40 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 _0x61d0=['socket.io-emitter','localhost','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x43777c,_0x3c6f51){var _0x23c7d3=function(_0x45e7f2){while(--_0x45e7f2){_0x43777c['push'](_0x43777c['shift']());}};_0x23c7d3(++_0x3c6f51);}(_0x61d0,0x187));var _0x061d=function(_0x32c8ed,_0x45fef2){_0x32c8ed=_0x32c8ed-0x0;var _0x580764=_0x61d0[_0x32c8ed];return _0x580764;};'use strict';var _=require(_0x061d('0x0'));var util=require('util');var moment=require(_0x061d('0x1'));var BPromise=require(_0x061d('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x061d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x061d('0x4'))(_0x061d('0x5'));var config=require('../../config/environment');var jayson=require(_0x061d('0x6'));var client=jayson[_0x061d('0x7')][_0x061d('0x8')]({'port':0x232a});var socket=require(_0x061d('0x9'))({'host':_0x061d('0xa'),'port':0x18eb});require(_0x061d('0xb'))[_0x061d('0xc')](socket);function respondWithRpcPromise(_0x572b0e,_0x4b6606,_0x54b498){return new BPromise(function(_0x311d7c,_0x5d5a4b){return client[_0x061d('0xd')](_0x572b0e,_0x54b498)[_0x061d('0xe')](function(_0x517437){logger[_0x061d('0xf')](_0x061d('0x10'),_0x4b6606,_0x061d('0x11'));logger[_0x061d('0x12')](_0x061d('0x13'),_0x4b6606,_0x061d('0x11'),JSON[_0x061d('0x14')](_0x517437));if(_0x517437['error']){if(_0x517437[_0x061d('0x15')][_0x061d('0x16')]===0x1f4){logger[_0x061d('0x15')](_0x061d('0x10'),_0x4b6606,_0x517437[_0x061d('0x15')][_0x061d('0x17')]);return _0x5d5a4b(_0x517437[_0x061d('0x15')][_0x061d('0x17')]);}logger[_0x061d('0x15')](_0x061d('0x10'),_0x4b6606,_0x517437['error'][_0x061d('0x17')]);return _0x311d7c(_0x517437[_0x061d('0x15')][_0x061d('0x17')]);}else{logger['info'](_0x061d('0x10'),_0x4b6606,'request\x20sent');_0x311d7c(_0x517437['result'][_0x061d('0x17')]);}})[_0x061d('0x18')](function(_0x5b4a8a){logger[_0x061d('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x4b6606,_0x5b4a8a);_0x5d5a4b(_0x5b4a8a);});});}exports[_0x061d('0x19')]=function(_0xfa15ea){var _0x3ae47b=this;return new Promise(function(_0x5aca21,_0x207b0a){return db[_0x061d('0x1a')][_0x061d('0x1b')](_0xfa15ea[_0x061d('0x1c')],{'raw':_0xfa15ea['options']?_0xfa15ea[_0x061d('0x1d')][_0x061d('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xfa15ea['options']?_0xfa15ea[_0x061d('0x1d')][_0x061d('0x1f')]||null:null,'attributes':_0xfa15ea[_0x061d('0x1d')]?_0xfa15ea[_0x061d('0x1d')][_0x061d('0x20')]||null:null,'limit':_0xfa15ea[_0x061d('0x1d')]?_0xfa15ea[_0x061d('0x1d')][_0x061d('0x21')]||null:null})['then'](function(_0x358d87){logger[_0x061d('0xf')]('UpdateOpenchannelInteraction',_0xfa15ea);logger[_0x061d('0x12')](_0x061d('0x19'),_0xfa15ea,JSON['stringify'](_0x358d87));_0x5aca21(_0x358d87);})['catch'](function(_0x300b39){logger[_0x061d('0x15')](_0x061d('0x19'),_0x300b39[_0x061d('0x17')],_0xfa15ea);_0x207b0a(_0x3ae47b[_0x061d('0x15')](0x1f4,_0x300b39[_0x061d('0x17')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x526702){return new Promise(function(_0x2d189c,_0x16f1db){return db['OpenchannelInteraction'][_0x061d('0x22')]({'where':_0x526702['options']?_0x526702[_0x061d('0x1d')][_0x061d('0x1f')]||null:null})[_0x061d('0xe')](function(_0x366188){if(_0x366188){return _0x366188[_0x061d('0x23')](_0x526702[_0x061d('0x1c')][_0x061d('0x24')],_[_0x061d('0x25')](_0x526702[_0x061d('0x1c')],[_0x061d('0x24'),'id'])||{});}})[_0x061d('0x26')](function(_0xbf9d7b){logger['info'](_0x061d('0x27'),_0x526702);logger[_0x061d('0x12')](_0x061d('0x27'),_0x526702,JSON[_0x061d('0x14')](_0xbf9d7b));_0x2d189c(_0xbf9d7b);})['catch'](function(_0x3fa14e){logger['error'](_0x061d('0x27'),_0x3fa14e['message'],_0x526702);_0x16f1db(_this[_0x061d('0x15')](0x1f4,_0x3fa14e[_0x061d('0x17')]));});});}; \ No newline at end of file +var _0x9d1f=['find','addTags','ids','spread','AddTags','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./openchannelInteraction.socket','register','info','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelInteraction,\x20%s,\x20%s','message','catch','body','options','raw','where','limit','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','OpenchannelInteraction'];(function(_0x5637f4,_0x28bb07){var _0xdd68c0=function(_0x1c465b){while(--_0x1c465b){_0x5637f4['push'](_0x5637f4['shift']());}};_0xdd68c0(++_0x28bb07);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x48326a,_0x8cfa0c){_0x48326a=_0x48326a-0x0;var _0x466709=_0x9d1f[_0x48326a];return _0x466709;};'use strict';var _=require(_0xf9d1('0x0'));var util=require('util');var moment=require(_0xf9d1('0x1'));var BPromise=require(_0xf9d1('0x2'));var rs=require(_0xf9d1('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xf9d1('0x4'));var logger=require('../../config/logger')(_0xf9d1('0x5'));var config=require(_0xf9d1('0x6'));var jayson=require(_0xf9d1('0x7'));var client=jayson['client'][_0xf9d1('0x8')]({'port':0x232a});var socket=require(_0xf9d1('0x9'))({'host':'localhost','port':0x18eb});require(_0xf9d1('0xa'))[_0xf9d1('0xb')](socket);function respondWithRpcPromise(_0x41c1bc,_0x582512,_0x354715){return new BPromise(function(_0xe42be1,_0x9a36f){return client['request'](_0x41c1bc,_0x354715)['then'](function(_0x22f7c1){logger[_0xf9d1('0xc')]('OpenchannelInteraction,\x20%s,\x20%s',_0x582512,'request\x20sent');logger[_0xf9d1('0xd')](_0xf9d1('0xe'),_0x582512,_0xf9d1('0xf'),JSON[_0xf9d1('0x10')](_0x22f7c1));if(_0x22f7c1['error']){if(_0x22f7c1[_0xf9d1('0x11')]['code']===0x1f4){logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x22f7c1['error'][_0xf9d1('0x13')]);return _0x9a36f(_0x22f7c1[_0xf9d1('0x11')][_0xf9d1('0x13')]);}logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x22f7c1[_0xf9d1('0x11')]['message']);return _0xe42be1(_0x22f7c1[_0xf9d1('0x11')][_0xf9d1('0x13')]);}else{logger[_0xf9d1('0xc')](_0xf9d1('0x12'),_0x582512,_0xf9d1('0xf'));_0xe42be1(_0x22f7c1['result'][_0xf9d1('0x13')]);}})[_0xf9d1('0x14')](function(_0x3b68c4){logger[_0xf9d1('0x11')](_0xf9d1('0x12'),_0x582512,_0x3b68c4);_0x9a36f(_0x3b68c4);});});}exports['UpdateOpenchannelInteraction']=function(_0x396f6b){var _0x41c146=this;return new Promise(function(_0x4f66b6,_0x22307d){return db['OpenchannelInteraction']['update'](_0x396f6b[_0xf9d1('0x15')],{'raw':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x18')]||null:null,'attributes':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')]['attributes']||null:null,'limit':_0x396f6b[_0xf9d1('0x16')]?_0x396f6b[_0xf9d1('0x16')][_0xf9d1('0x19')]||null:null})[_0xf9d1('0x1a')](function(_0x34416c){logger['info'](_0xf9d1('0x1b'),_0x396f6b);logger['debug'](_0xf9d1('0x1b'),_0x396f6b,JSON[_0xf9d1('0x10')](_0x34416c));_0x4f66b6(_0x34416c);})[_0xf9d1('0x14')](function(_0x31db63){logger[_0xf9d1('0x11')](_0xf9d1('0x1b'),_0x31db63[_0xf9d1('0x13')],_0x396f6b);_0x22307d(_0x41c146['error'](0x1f4,_0x31db63['message']));});});};exports[_0xf9d1('0x1c')]=function(_0x4c884a){return new Promise(function(_0x34cdfc,_0x549075){return db[_0xf9d1('0x1d')][_0xf9d1('0x1e')]({'where':_0x4c884a['options']?_0x4c884a[_0xf9d1('0x16')]['where']||null:null})['then'](function(_0x191e57){if(_0x191e57){return _0x191e57[_0xf9d1('0x1f')](_0x4c884a['body'][_0xf9d1('0x20')],_['omit'](_0x4c884a['body'],['ids','id'])||{});}})[_0xf9d1('0x21')](function(_0x48d875){logger[_0xf9d1('0xc')](_0xf9d1('0x22'),_0x4c884a);logger[_0xf9d1('0xd')](_0xf9d1('0x22'),_0x4c884a,JSON[_0xf9d1('0x10')](_0x48d875));_0x34cdfc(_0x48d875);})[_0xf9d1('0x14')](function(_0x2194bd){logger[_0xf9d1('0x11')](_0xf9d1('0x22'),_0x2194bd['message'],_0x4c884a);_0x549075(_this[_0xf9d1('0x11')](0x1f4,_0x2194bd['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 2bd2b90..a0e13de 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 _0x04d0=['length','openchannelInteraction:','remove','update'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x04d0,0xb2));var _0x004d=function(_0x1ecdaf,_0x7356df){_0x1ecdaf=_0x1ecdaf-0x0;var _0x29dee4=_0x04d0[_0x1ecdaf];return _0x29dee4;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0x004d('0x0'),_0x004d('0x1')];function createListener(_0x253e30,_0x11914b){return function(_0xad2fa0){_0x11914b['emit'](_0x253e30,_0xad2fa0);};}function removeListener(_0x3dbf81,_0x35f651){return function(){OpenchannelInteractionEvents['removeListener'](_0x3dbf81,_0x35f651);};}exports['register']=function(_0x5e920b){for(var _0x50b703=0x0,_0x536cf8=events[_0x004d('0x2')];_0x50b703<_0x536cf8;_0x50b703++){var _0x4f1c3c=events[_0x50b703];var _0x213b1f=createListener(_0x004d('0x3')+_0x4f1c3c,_0x5e920b);OpenchannelInteractionEvents['on'](_0x4f1c3c,_0x213b1f);}}; \ No newline at end of file +var _0x0f96=['register','length','./openchannelInteraction.events','save','remove','emit','removeListener'];(function(_0x11b739,_0x261e1b){var _0x384b18=function(_0x54be27){while(--_0x54be27){_0x11b739['push'](_0x11b739['shift']());}};_0x384b18(++_0x261e1b);}(_0x0f96,0x10c));var _0x60f9=function(_0x174cc0,_0x3c2b04){_0x174cc0=_0x174cc0-0x0;var _0x3e931b=_0x0f96[_0x174cc0];return _0x3e931b;};'use strict';var OpenchannelInteractionEvents=require(_0x60f9('0x0'));var events=[_0x60f9('0x1'),_0x60f9('0x2'),'update'];function createListener(_0x2f483b,_0x5ed6c2){return function(_0x19a99d){_0x5ed6c2[_0x60f9('0x3')](_0x2f483b,_0x19a99d);};}function removeListener(_0xe628d,_0x19e966){return function(){OpenchannelInteractionEvents[_0x60f9('0x4')](_0xe628d,_0x19e966);};}exports[_0x60f9('0x5')]=function(_0x24c5de){for(var _0x1c8f3b=0x0,_0xb9357b=events[_0x60f9('0x6')];_0x1c8f3b<_0xb9357b;_0x1c8f3b++){var _0x54487d=events[_0x1c8f3b];var _0x5b6614=createListener('openchannelInteraction:'+_0x54487d,_0x24c5de);OpenchannelInteractionEvents['on'](_0x54487d,_0x5b6614);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index acaf023..9972319 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 _0xae79=['destroy','exports','multer','util','express','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','tracked','openchannel','create','put','/:id','accept','/:id/reject','delete'];(function(_0xf37710,_0x182161){var _0x241897=function(_0x4e498b){while(--_0x4e498b){_0xf37710['push'](_0xf37710['shift']());}};_0x241897(++_0x182161);}(_0xae79,0x86));var _0x9ae7=function(_0x1f794a,_0x2e7cc3){_0x1f794a=_0x1f794a-0x0;var _0x207e05=_0xae79[_0x1f794a];return _0x207e05;};'use strict';var multer=require(_0x9ae7('0x0'));var util=require(_0x9ae7('0x1'));var path=require('path');var express=require(_0x9ae7('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9ae7('0x3'));var config=require(_0x9ae7('0x4'));var controller=require('./openchannelMessage.controller');router[_0x9ae7('0x5')]('/',auth['isAuthenticated'](),controller[_0x9ae7('0x6')]);router[_0x9ae7('0x5')](_0x9ae7('0x7'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9ae7('0xa')]);router[_0x9ae7('0xb')]('/',auth[_0x9ae7('0x8')](),interaction[_0x9ae7('0xc')](_0x9ae7('0xd'),'openchannelmessage:create'),controller[_0x9ae7('0xe')]);router[_0x9ae7('0xf')](_0x9ae7('0x10'),auth['isAuthenticated'](),controller['update']);router['put']('/:id/accept',auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x11')]);router[_0x9ae7('0xf')](_0x9ae7('0x12'),auth[_0x9ae7('0x8')](),controller['reject']);router[_0x9ae7('0x13')](_0x9ae7('0x10'),auth[_0x9ae7('0x8')](),controller[_0x9ae7('0x14')]);module[_0x9ae7('0x15')]=router; \ No newline at end of file +var _0x4297=['multer','util','path','express','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','create','put','update','/:id/accept','/:id/reject','reject','delete','exports'];(function(_0x1c35b1,_0x52a6ad){var _0x1bd1d4=function(_0x1a4760){while(--_0x1a4760){_0x1c35b1['push'](_0x1c35b1['shift']());}};_0x1bd1d4(++_0x52a6ad);}(_0x4297,0x96));var _0x7429=function(_0x15bd45,_0x49f738){_0x15bd45=_0x15bd45-0x0;var _0x3a9660=_0x4297[_0x15bd45];return _0x3a9660;};'use strict';var multer=require(_0x7429('0x0'));var util=require(_0x7429('0x1'));var path=require(_0x7429('0x2'));var express=require(_0x7429('0x3'));var router=express[_0x7429('0x4')]();var auth=require(_0x7429('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7429('0x6'));var controller=require(_0x7429('0x7'));router[_0x7429('0x8')]('/',auth[_0x7429('0x9')](),controller[_0x7429('0xa')]);router[_0x7429('0x8')](_0x7429('0xb'),auth[_0x7429('0x9')](),controller[_0x7429('0xc')]);router[_0x7429('0x8')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller[_0x7429('0xe')]);router[_0x7429('0xf')]('/',auth['isAuthenticated'](),interaction[_0x7429('0x10')]('openchannel','openchannelmessage:create'),controller[_0x7429('0x11')]);router[_0x7429('0x12')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller[_0x7429('0x13')]);router['put'](_0x7429('0x14'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x7429('0x15'),auth[_0x7429('0x9')](),controller[_0x7429('0x16')]);router[_0x7429('0x17')](_0x7429('0xd'),auth[_0x7429('0x9')](),controller['destroy']);module[_0x7429('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 05ab5eb..748edde 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 _0x0155=['out','sequelize','exports','BOOLEAN','ENUM'];(function(_0x332e84,_0x9eae5a){var _0x2c9367=function(_0x437394){while(--_0x437394){_0x332e84['push'](_0x332e84['shift']());}};_0x2c9367(++_0x9eae5a);}(_0x0155,0x19b));var _0x5015=function(_0x3cddc9,_0x156161){_0x3cddc9=_0x3cddc9-0x0;var _0x4a8dfc=_0x0155[_0x3cddc9];return _0x4a8dfc;};'use strict';var Sequelize=require(_0x5015('0x0'));module[_0x5015('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5015('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5015('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5015('0x3')]('in',_0x5015('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x6fc1=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xf7f8ae,_0x516795){var _0x2b957f=function(_0x5c7f0f){while(--_0x5c7f0f){_0xf7f8ae['push'](_0xf7f8ae['shift']());}};_0x2b957f(++_0x516795);}(_0x6fc1,0x14a));var _0x16fc=function(_0x29392f,_0x48bcd0){_0x29392f=_0x29392f-0x0;var _0x5b9110=_0x6fc1[_0x29392f];return _0x5b9110;};'use strict';var Sequelize=require('sequelize');module[_0x16fc('0x0')]={'body':{'type':Sequelize[_0x16fc('0x1')](_0x16fc('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x16fc('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x16fc('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x16fc('0x4')]('in',_0x16fc('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x16fc('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 002b915..66d54e2 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 _0x6806=['readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','OpenchannelInteractionId','isNil','interaction','role','stringify','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','agent','OpenchannelInteraction','RejectMessage','fast-json-patch','request-promise','mustache','util','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','socket.io-emitter','localhost','./openchannelMessage.socket','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','Content-Range','apply','save','then','destroy','name','send','OpenchannelMessage','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','add','day','filter','merge','map','count','includeAll','include','rows','show','params','intersection','options','find','create','body','update','describe','openchannel-interactions','accept','openchannel'];(function(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0x6806,0x1ca));var _0x6680=function(_0x219c8b,_0x10236a){_0x219c8b=_0x219c8b-0x0;var _0x5989f5=_0x6806[_0x219c8b];return _0x5989f5;};'use strict';var jsonpatch=require(_0x6680('0x0'));var rp=require(_0x6680('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6680('0x2'));var util=require(_0x6680('0x3'));var path=require('path');var sox=require(_0x6680('0x4'));var csv=require('to-csv');var ejs=require(_0x6680('0x5'));var fs=require('fs');var _=require(_0x6680('0x6'));var squel=require('squel');var crypto=require(_0x6680('0x7'));var jsforce=require(_0x6680('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x6680('0x9'));var querystring=require(_0x6680('0xa'));var Papa=require(_0x6680('0xb'));var qs=require(_0x6680('0xc'));var logger=require(_0x6680('0xd'))(_0x6680('0xe'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0x6680('0xf'))({'host':_0x6680('0x10'),'port':0x18eb});require(_0x6680('0x11'))['register'](socket);var jayson=require(_0x6680('0x12'));var client=jayson[_0x6680('0x13')]['http']({'port':0x232c});var client9002=jayson[_0x6680('0x13')][_0x6680('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x1a13df,_0x3cc085,_0x3b49e5,_0x1f8aa4){return new BPromise(function(_0x3fd61c,_0x214a8e){var _0xe5f806=_0x1f8aa4||client;return _0xe5f806[_0x6680('0x15')](_0x1a13df,_0x3b49e5)['then'](function(_0xaf02b){logger['info'](_0x6680('0x16'),_0x3cc085,_0x6680('0x17'));logger[_0x6680('0x18')](_0x6680('0x19'),_0x3cc085,_0x6680('0x17'),JSON['stringify'](_0xaf02b));if(_0xaf02b[_0x6680('0x1a')]){if(_0xaf02b['error'][_0x6680('0x1b')]===0x1f4){logger['error'](_0x6680('0x16'),_0x3cc085,_0xaf02b[_0x6680('0x1a')][_0x6680('0x1c')]);return _0x214a8e(_0xaf02b['error'][_0x6680('0x1c')]);}logger[_0x6680('0x1a')]('OpenchannelMessage,\x20%s,\x20%s',_0x3cc085,_0xaf02b[_0x6680('0x1a')][_0x6680('0x1c')]);return _0x3fd61c(_0xaf02b['error']['message']);}else{logger[_0x6680('0x1d')](_0x6680('0x16'),_0x3cc085,_0x6680('0x17'));_0x3fd61c(_0xaf02b[_0x6680('0x1e')][_0x6680('0x1c')]);}})[_0x6680('0x1f')](function(_0x393532){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x3cc085,_0x393532);_0x214a8e(_0x393532);});});}function respondWithStatusCode(_0x3acded,_0x54bb03){_0x54bb03=_0x54bb03||0xcc;return function(_0x578720){if(_0x578720){return _0x3acded[_0x6680('0x20')](_0x54bb03);}return _0x3acded['status'](_0x54bb03)[_0x6680('0x21')]();};}function respondWithResult(_0x404633,_0x1a50e4){_0x1a50e4=_0x1a50e4||0xc8;return function(_0x24f374){if(_0x24f374){return _0x404633[_0x6680('0x22')](_0x1a50e4)[_0x6680('0x23')](_0x24f374);}};}function respondWithFilteredResult(_0x3f7332,_0x30a48e){return function(_0x57ec2f){if(_0x57ec2f){var _0x5cf79b=_0x57ec2f['count'],_0xbc6d35=_0x30a48e[_0x6680('0x24')],_0x5b81b7=_0x30a48e[_0x6680('0x24')]+_0x30a48e[_0x6680('0x25')],_0x33421b;if(_0x5b81b7>=_0x5cf79b){_0x5b81b7=_0x5cf79b;_0x33421b=0xc8;}else{_0x33421b=0xce;}_0x3f7332['status'](_0x33421b);return _0x3f7332['set'](_0x6680('0x26'),_0xbc6d35+'-'+_0x5b81b7+'/'+_0x5cf79b)['json'](_0x57ec2f);}return null;};}function patchUpdates(_0x3a8662){return function(_0x3eedf8){try{jsonpatch[_0x6680('0x27')](_0x3eedf8,_0x3a8662,!![]);}catch(_0xfc9f74){return BPromise['reject'](_0xfc9f74);}return _0x3eedf8[_0x6680('0x28')]();};}function saveUpdates(_0xf24151,_0x38440b){return function(_0x29dace){if(_0x29dace){return _0x29dace['update'](_0xf24151)[_0x6680('0x29')](function(_0x4df74b){return _0x4df74b;});}return null;};}function removeEntity(_0x46a6d9,_0xe83802){return function(_0x268053){if(_0x268053){return _0x268053[_0x6680('0x2a')]()[_0x6680('0x29')](function(){_0x46a6d9[_0x6680('0x22')](0xcc)[_0x6680('0x21')]();});}};}function handleEntityNotFound(_0x32ddbe,_0x2b9d5d){return function(_0x4026fe){if(!_0x4026fe){_0x32ddbe[_0x6680('0x20')](0x194);}return _0x4026fe;};}function handleError(_0x48237e,_0x842aef){_0x842aef=_0x842aef||0x1f4;return function(_0xa68448){logger['error'](_0xa68448['stack']);if(_0xa68448[_0x6680('0x2b')]){delete _0xa68448[_0x6680('0x2b')];}_0x48237e[_0x6680('0x22')](_0x842aef)[_0x6680('0x2c')](_0xa68448);};}exports['index']=function(_0xae2e52,_0x41537b){var _0x30af88={},_0x5974be={},_0x28e28f={'count':0x0,'rows':[]};var _0x2c8751=db[_0x6680('0x2d')][_0x6680('0x2e')];_0x5974be[_0x6680('0x2f')]=_[_0x6680('0x30')](_0x2c8751);var _0x42cc0c={'dateStart':_0xae2e52[_0x6680('0x31')][_0x6680('0x32')],'dateEnd':_0xae2e52[_0x6680('0x31')][_0x6680('0x33')]};delete _0xae2e52[_0x6680('0x31')][_0x6680('0x32')];delete _0xae2e52[_0x6680('0x31')][_0x6680('0x33')];_0x5974be[_0x6680('0x31')]=_[_0x6680('0x30')](_0xae2e52['query']);_0x5974be[_0x6680('0x34')]=_['intersection'](_0x5974be[_0x6680('0x2f')],_0x5974be['query']);_0x30af88[_0x6680('0x35')]=_['intersection'](_0x5974be[_0x6680('0x2f')],qs['fields'](_0xae2e52['query'][_0x6680('0x36')]));_0x30af88['attributes']=_0x30af88[_0x6680('0x35')][_0x6680('0x37')]?_0x30af88[_0x6680('0x35')]:_0x5974be[_0x6680('0x2f')];if(!_0xae2e52[_0x6680('0x31')][_0x6680('0x38')](_0x6680('0x39'))){_0x30af88['limit']=qs[_0x6680('0x25')](_0xae2e52[_0x6680('0x31')][_0x6680('0x25')]);_0x30af88[_0x6680('0x24')]=qs['offset'](_0xae2e52['query'][_0x6680('0x24')]);}_0x30af88[_0x6680('0x3a')]=qs[_0x6680('0x3b')](_0xae2e52['query'][_0x6680('0x3b')]);_0x30af88[_0x6680('0x3c')]=qs['filters'](_['pick'](_0xae2e52[_0x6680('0x31')],_0x5974be[_0x6680('0x34')]));if(_0x42cc0c[_0x6680('0x32')]){if(_0x42cc0c[_0x6680('0x33')]){_0x42cc0c[_0x6680('0x33')]=moment(_0x42cc0c[_0x6680('0x33')])[_0x6680('0x3d')](0x1,_0x6680('0x3e'));}else{_0x42cc0c[_0x6680('0x33')]=moment(_0x42cc0c[_0x6680('0x32')])[_0x6680('0x3d')](0x1,_0x6680('0x3e'));}_['merge'](_0x30af88[_0x6680('0x3c')],{'createdAt':{'$gte':_0x42cc0c['dateStart'],'$lte':_0x42cc0c[_0x6680('0x33')]}});}if(_0xae2e52[_0x6680('0x31')][_0x6680('0x3f')]){_0x30af88[_0x6680('0x3c')]=_[_0x6680('0x40')](_0x30af88[_0x6680('0x3c')],{'$or':_[_0x6680('0x41')](_0x30af88[_0x6680('0x35')],function(_0x57eaf1){var _0x1d0119={};_0x1d0119[_0x57eaf1]={'$like':'%'+_0xae2e52[_0x6680('0x31')][_0x6680('0x3f')]+'%'};return _0x1d0119;})});}_0x30af88=_[_0x6680('0x40')]({},_0x30af88,_0xae2e52['options']);var _0x55632f={'where':_0x30af88[_0x6680('0x3c')]};return db[_0x6680('0x2d')]['count'](_0x55632f)[_0x6680('0x29')](function(_0x448deb){_0x28e28f[_0x6680('0x42')]=_0x448deb;if(_0xae2e52[_0x6680('0x31')][_0x6680('0x43')]){_0x30af88[_0x6680('0x44')]=[{'all':!![]}];}return db[_0x6680('0x2d')]['findAll'](_0x30af88);})[_0x6680('0x29')](function(_0x178a92){_0x28e28f[_0x6680('0x45')]=_0x178a92;return _0x28e28f;})[_0x6680('0x29')](respondWithFilteredResult(_0x41537b,_0x30af88))['catch'](handleError(_0x41537b,null));};exports[_0x6680('0x46')]=function(_0xed8e88,_0x26a5be){var _0x99250b={'raw':!![],'where':{'id':_0xed8e88[_0x6680('0x47')]['id']}},_0x34cd7b={};_0x34cd7b[_0x6680('0x2f')]=_[_0x6680('0x30')](db[_0x6680('0x2d')][_0x6680('0x2e')]);_0x34cd7b[_0x6680('0x31')]=_['keys'](_0xed8e88[_0x6680('0x31')]);_0x34cd7b[_0x6680('0x34')]=_[_0x6680('0x48')](_0x34cd7b[_0x6680('0x2f')],_0x34cd7b[_0x6680('0x31')]);_0x99250b[_0x6680('0x35')]=_[_0x6680('0x48')](_0x34cd7b[_0x6680('0x2f')],qs['fields'](_0xed8e88['query'][_0x6680('0x36')]));_0x99250b['attributes']=_0x99250b[_0x6680('0x35')]['length']?_0x99250b['attributes']:_0x34cd7b['model'];if(_0xed8e88[_0x6680('0x31')][_0x6680('0x43')]){_0x99250b[_0x6680('0x44')]=[{'all':!![]}];}_0x99250b=_[_0x6680('0x40')]({},_0x99250b,_0xed8e88[_0x6680('0x49')]);return db[_0x6680('0x2d')][_0x6680('0x4a')](_0x99250b)[_0x6680('0x29')](handleEntityNotFound(_0x26a5be,null))['then'](respondWithResult(_0x26a5be,null))[_0x6680('0x1f')](handleError(_0x26a5be,null));};exports[_0x6680('0x4b')]=function(_0x54a402,_0x246335){return db['OpenchannelMessage'][_0x6680('0x4b')](_0x54a402[_0x6680('0x4c')],{})[_0x6680('0x29')](respondWithResult(_0x246335,0xc9))[_0x6680('0x1f')](handleError(_0x246335,null));};exports[_0x6680('0x4d')]=function(_0x3ee10a,_0x418ebc){if(_0x3ee10a[_0x6680('0x4c')]['id']){delete _0x3ee10a[_0x6680('0x4c')]['id'];}return db['OpenchannelMessage'][_0x6680('0x4a')]({'where':{'id':_0x3ee10a[_0x6680('0x47')]['id']}})[_0x6680('0x29')](handleEntityNotFound(_0x418ebc,null))[_0x6680('0x29')](saveUpdates(_0x3ee10a[_0x6680('0x4c')],null))[_0x6680('0x29')](respondWithResult(_0x418ebc,null))[_0x6680('0x1f')](handleError(_0x418ebc,null));};exports[_0x6680('0x2a')]=function(_0x2c4b38,_0x1f4f40){return db[_0x6680('0x2d')]['find']({'where':{'id':_0x2c4b38[_0x6680('0x47')]['id']}})['then'](handleEntityNotFound(_0x1f4f40,null))[_0x6680('0x29')](removeEntity(_0x1f4f40,null))[_0x6680('0x1f')](handleError(_0x1f4f40,null));};exports[_0x6680('0x4e')]=function(_0x341495,_0x8e7f60){return db[_0x6680('0x2d')]['describe']()[_0x6680('0x29')](respondWithResult(_0x8e7f60,null))[_0x6680('0x1f')](handleError(_0x8e7f60,null));};var interaction_log=require(_0x6680('0xd'))(_0x6680('0x4f'));exports[_0x6680('0x50')]=function(_0x3c003c,_0x5a9412,_0x1d44b6){var _0x309098={'channel':_0x6680('0x51')};if(_0x3c003c[_0x6680('0x4c')]['id']){delete _0x3c003c[_0x6680('0x4c')]['id'];}_0x3c003c['body']['read']=!![];_0x3c003c[_0x6680('0x4c')][_0x6680('0x52')]=moment()[_0x6680('0x53')](_0x6680('0x54'));_0x3c003c[_0x6680('0x4c')][_0x6680('0x55')]=_0x3c003c[_0x6680('0x4c')]['UserId']||_0x3c003c[_0x6680('0x56')]['id'];return db['OpenchannelMessage']['find']({'where':{'id':_0x3c003c[_0x6680('0x47')]['id'],'UserId':null},'include':[{'model':db[_0x6680('0x57')],'as':_0x6680('0x58')}]})[_0x6680('0x29')](handleEntityNotFound(_0x5a9412,null))[_0x6680('0x29')](saveUpdates(_0x3c003c[_0x6680('0x4c')],null))[_0x6680('0x29')](function(_0x38a5f3){if(_0x38a5f3){_0x309098['message']=_0x38a5f3[_0x6680('0x59')]({'plain':!![]});return db['OpenchannelInteraction'][_0x6680('0x4a')]({'where':{'id':_0x38a5f3[_0x6680('0x5a')]}});}return null;})[_0x6680('0x29')](handleEntityNotFound(_0x5a9412,null))[_0x6680('0x29')](function(_0x3a5389){if(_0x3a5389){return _0x3a5389[_0x6680('0x4d')]({'UserId':_0x3c003c[_0x6680('0x4c')][_0x6680('0x55')],'read1stAt':_[_0x6680('0x5b')](_0x3a5389['read1stAt'])?moment()[_0x6680('0x53')](_0x6680('0x54')):undefined});}return null;})[_0x6680('0x29')](function(_0x21a5b1){if(_0x21a5b1){_0x309098[_0x6680('0x5c')]=_0x21a5b1[_0x6680('0x59')]({'plain':!![]});interaction_log[_0x6680('0x1d')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3c003c[_0x6680('0x56')]['id'],_0x3c003c[_0x6680('0x56')][_0x6680('0x2b')],_0x3c003c[_0x6680('0x56')][_0x6680('0x5d')],_0x309098['interaction']['id'],_0x3c003c[_0x6680('0x4c')]?JSON[_0x6680('0x5e')](_0x3c003c['body']):'null');return respondWithRpcPromise(_0x6680('0x5f'),_0x6680('0x60'),_0x309098);}return null;})[_0x6680('0x29')](function(_0x165c0d){if(_0x165c0d){if(_0x3c003c[_0x6680('0x4c')][_0x6680('0x61')]){_0x309098['message'][_0x6680('0x62')]=util[_0x6680('0x53')](_0x6680('0x63'),_0x3c003c['user'][_0x6680('0x2b')]);_0x309098[_0x6680('0x1c')][_0x6680('0x64')]=_0x309098[_0x6680('0x64')];_0x309098[_0x6680('0x1c')][_0x6680('0x65')]=_0x6680('0x50');return respondWithRpcPromise(_0x6680('0x66'),'EventManager',{'event':_0x6680('0x67'),'message':_0x309098[_0x6680('0x1c')]},client9002)[_0x6680('0x29')](function(){return _0x309098;});}return _0x309098;}return null;})[_0x6680('0x29')](respondWithResult(_0x5a9412,null))[_0x6680('0x1f')](handleError(_0x5a9412,null));};var interaction_log=require(_0x6680('0xd'))('openchannel-interactions');exports[_0x6680('0x68')]=function(_0x5b3705,_0x479e0e,_0x4c80e1){var _0x441341={'agent':{},'channel':'openchannel'};if(_0x5b3705[_0x6680('0x4c')]['id']){delete _0x5b3705[_0x6680('0x4c')]['id'];}_0x5b3705['body']['UserId']=_0x5b3705[_0x6680('0x4c')][_0x6680('0x55')]||_0x5b3705[_0x6680('0x56')]['id'];_0x441341[_0x6680('0x69')]['id']=_0x5b3705[_0x6680('0x4c')][_0x6680('0x55')];return db[_0x6680('0x2d')]['find']({'where':{'id':_0x5b3705[_0x6680('0x47')]['id'],'UserId':null}})[_0x6680('0x29')](handleEntityNotFound(_0x479e0e,null))[_0x6680('0x29')](function(_0x1c9b69){if(_0x1c9b69){_0x441341[_0x6680('0x1c')]=_0x1c9b69[_0x6680('0x59')]({'plain':!![]});return db[_0x6680('0x6a')][_0x6680('0x4a')]({'where':{'id':_0x1c9b69[_0x6680('0x5a')]}});}return null;})['then'](handleEntityNotFound(_0x479e0e,null))[_0x6680('0x29')](function(_0x1e6d3c){if(_0x1e6d3c){_0x441341[_0x6680('0x5c')]=_0x1e6d3c['get']({'plain':!![]});interaction_log[_0x6680('0x1d')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5b3705[_0x6680('0x56')]['id'],_0x5b3705['user'][_0x6680('0x2b')],_0x5b3705[_0x6680('0x56')][_0x6680('0x5d')],_0x441341['interaction']['id'],_0x5b3705[_0x6680('0x4c')]?JSON['stringify'](_0x5b3705[_0x6680('0x4c')]):'null');return respondWithRpcPromise(_0x6680('0x6b'),'rejectMessage',_0x441341);}return null;})[_0x6680('0x29')](function(_0x28887e){if(_0x28887e){_0x28887e[_0x6680('0x1c')][_0x6680('0x62')]=util['format'](_0x6680('0x63'),_0x5b3705[_0x6680('0x56')][_0x6680('0x2b')]);_0x28887e['message']['channel']=_0x441341[_0x6680('0x64')];_0x28887e[_0x6680('0x1c')][_0x6680('0x65')]=_0x6680('0x68');respondWithRpcPromise(_0x6680('0x66'),'EventManager',{'event':'rejectmessage','message':_0x28887e['message']},client9002);return _0x441341;}return null;})[_0x6680('0x29')](respondWithResult(_0x479e0e,null))[_0x6680('0x1f')](handleError(_0x479e0e,null));}; \ No newline at end of file +var _0x966e=['merge','filter','options','rows','params','includeAll','include','find','create','body','destroy','describe','openchannel','readAt','format','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','interface','SIP/%s','channel','EventManager','acceptmessage','openchannel-interactions','agent','RejectMessage','event','rejectmessage','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','localhost','jayson/promise','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','count','offset','limit','set','json','apply','reject','update','name','OpenchannelMessage','rawAttributes','model','keys','query','dateStart','dateEnd','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','day','add'];(function(_0x4e2336,_0x542e26){var _0x256261=function(_0x1b24bb){while(--_0x1b24bb){_0x4e2336['push'](_0x4e2336['shift']());}};_0x256261(++_0x542e26);}(_0x966e,0xf4));var _0xe966=function(_0x1f0ca7,_0x403fe9){_0x1f0ca7=_0x1f0ca7-0x0;var _0x107ec2=_0x966e[_0x1f0ca7];return _0x107ec2;};'use strict';var jsonpatch=require(_0xe966('0x0'));var rp=require(_0xe966('0x1'));var moment=require(_0xe966('0x2'));var BPromise=require(_0xe966('0x3'));var Mustache=require('mustache');var util=require(_0xe966('0x4'));var path=require(_0xe966('0x5'));var sox=require(_0xe966('0x6'));var csv=require(_0xe966('0x7'));var ejs=require(_0xe966('0x8'));var fs=require('fs');var _=require(_0xe966('0x9'));var squel=require(_0xe966('0xa'));var crypto=require('crypto');var jsforce=require(_0xe966('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xe966('0x7'));var querystring=require(_0xe966('0xc'));var Papa=require(_0xe966('0xd'));var qs=require(_0xe966('0xe'));var logger=require(_0xe966('0xf'))(_0xe966('0x10'));var utils=require(_0xe966('0x11'));var config=require(_0xe966('0x12'));var db=require(_0xe966('0x13'))['db'];var socket=require('socket.io-emitter')({'host':_0xe966('0x14'),'port':0x18eb});require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0xe966('0x15'));var client=jayson['client'][_0xe966('0x16')]({'port':0x232c});var client9002=jayson['client'][_0xe966('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x3ca8e4,_0x382ddc,_0x4aefe2,_0x5a1623){return new BPromise(function(_0x306c79,_0x4e8c0e){var _0x149bf1=_0x5a1623||client;return _0x149bf1[_0xe966('0x17')](_0x3ca8e4,_0x4aefe2)[_0xe966('0x18')](function(_0x12e0fb){logger[_0xe966('0x19')](_0xe966('0x1a'),_0x382ddc,'request\x20sent');logger[_0xe966('0x1b')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x382ddc,_0xe966('0x1c'),JSON[_0xe966('0x1d')](_0x12e0fb));if(_0x12e0fb[_0xe966('0x1e')]){if(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x1f')]===0x1f4){logger[_0xe966('0x1e')](_0xe966('0x1a'),_0x382ddc,_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);return _0x4e8c0e(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);}logger[_0xe966('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0x382ddc,_0x12e0fb['error'][_0xe966('0x20')]);return _0x306c79(_0x12e0fb[_0xe966('0x1e')][_0xe966('0x20')]);}else{logger[_0xe966('0x19')](_0xe966('0x1a'),_0x382ddc,_0xe966('0x1c'));_0x306c79(_0x12e0fb['result']['message']);}})[_0xe966('0x21')](function(_0x5aff82){logger[_0xe966('0x1e')](_0xe966('0x1a'),_0x382ddc,_0x5aff82);_0x4e8c0e(_0x5aff82);});});}function respondWithStatusCode(_0x29a752,_0x42dd51){_0x42dd51=_0x42dd51||0xcc;return function(_0x5df350){if(_0x5df350){return _0x29a752[_0xe966('0x22')](_0x42dd51);}return _0x29a752[_0xe966('0x23')](_0x42dd51)[_0xe966('0x24')]();};}function respondWithResult(_0x5694db,_0x3b64e8){_0x3b64e8=_0x3b64e8||0xc8;return function(_0x1a7dbd){if(_0x1a7dbd){return _0x5694db[_0xe966('0x23')](_0x3b64e8)['json'](_0x1a7dbd);}};}function respondWithFilteredResult(_0x2455c4,_0x9c4049){return function(_0xd2dbb9){if(_0xd2dbb9){var _0x3dbefa=_0xd2dbb9[_0xe966('0x25')],_0x5687c5=_0x9c4049['offset'],_0x574584=_0x9c4049[_0xe966('0x26')]+_0x9c4049[_0xe966('0x27')],_0x40a4d5;if(_0x574584>=_0x3dbefa){_0x574584=_0x3dbefa;_0x40a4d5=0xc8;}else{_0x40a4d5=0xce;}_0x2455c4[_0xe966('0x23')](_0x40a4d5);return _0x2455c4[_0xe966('0x28')]('Content-Range',_0x5687c5+'-'+_0x574584+'/'+_0x3dbefa)[_0xe966('0x29')](_0xd2dbb9);}return null;};}function patchUpdates(_0x24714f){return function(_0x296179){try{jsonpatch[_0xe966('0x2a')](_0x296179,_0x24714f,!![]);}catch(_0x462dbf){return BPromise[_0xe966('0x2b')](_0x462dbf);}return _0x296179['save']();};}function saveUpdates(_0x1e6e30,_0x49ffc3){return function(_0x547d62){if(_0x547d62){return _0x547d62[_0xe966('0x2c')](_0x1e6e30)[_0xe966('0x18')](function(_0xa24896){return _0xa24896;});}return null;};}function removeEntity(_0x37a931,_0x146851){return function(_0xb24cad){if(_0xb24cad){return _0xb24cad['destroy']()[_0xe966('0x18')](function(){_0x37a931[_0xe966('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2544e8,_0x592dab){return function(_0x49f54d){if(!_0x49f54d){_0x2544e8['sendStatus'](0x194);}return _0x49f54d;};}function handleError(_0x6bf101,_0x3994b1){_0x3994b1=_0x3994b1||0x1f4;return function(_0x96b213){logger['error'](_0x96b213['stack']);if(_0x96b213[_0xe966('0x2d')]){delete _0x96b213[_0xe966('0x2d')];}_0x6bf101[_0xe966('0x23')](_0x3994b1)['send'](_0x96b213);};}exports['index']=function(_0x511021,_0xcf5fe4){var _0x45ad52={},_0x28dcc5={},_0x2437d0={'count':0x0,'rows':[]};var _0x51834e=db[_0xe966('0x2e')][_0xe966('0x2f')];_0x28dcc5[_0xe966('0x30')]=_[_0xe966('0x31')](_0x51834e);var _0x10ccf7={'dateStart':_0x511021[_0xe966('0x32')][_0xe966('0x33')],'dateEnd':_0x511021['query'][_0xe966('0x34')]};delete _0x511021['query'][_0xe966('0x33')];delete _0x511021[_0xe966('0x32')][_0xe966('0x34')];_0x28dcc5[_0xe966('0x32')]=_['keys'](_0x511021[_0xe966('0x32')]);_0x28dcc5['filters']=_['intersection'](_0x28dcc5[_0xe966('0x30')],_0x28dcc5[_0xe966('0x32')]);_0x45ad52[_0xe966('0x35')]=_[_0xe966('0x36')](_0x28dcc5[_0xe966('0x30')],qs[_0xe966('0x37')](_0x511021[_0xe966('0x32')][_0xe966('0x37')]));_0x45ad52[_0xe966('0x35')]=_0x45ad52[_0xe966('0x35')][_0xe966('0x38')]?_0x45ad52['attributes']:_0x28dcc5[_0xe966('0x30')];if(!_0x511021[_0xe966('0x32')][_0xe966('0x39')](_0xe966('0x3a'))){_0x45ad52[_0xe966('0x27')]=qs['limit'](_0x511021['query'][_0xe966('0x27')]);_0x45ad52[_0xe966('0x26')]=qs['offset'](_0x511021[_0xe966('0x32')][_0xe966('0x26')]);}_0x45ad52['order']=qs[_0xe966('0x3b')](_0x511021[_0xe966('0x32')]['sort']);_0x45ad52[_0xe966('0x3c')]=qs[_0xe966('0x3d')](_[_0xe966('0x3e')](_0x511021[_0xe966('0x32')],_0x28dcc5['filters']));if(_0x10ccf7[_0xe966('0x33')]){if(_0x10ccf7[_0xe966('0x34')]){_0x10ccf7['dateEnd']=moment(_0x10ccf7[_0xe966('0x34')])['add'](0x1,_0xe966('0x3f'));}else{_0x10ccf7[_0xe966('0x34')]=moment(_0x10ccf7['dateStart'])[_0xe966('0x40')](0x1,'day');}_[_0xe966('0x41')](_0x45ad52[_0xe966('0x3c')],{'createdAt':{'$gte':_0x10ccf7[_0xe966('0x33')],'$lte':_0x10ccf7['dateEnd']}});}if(_0x511021[_0xe966('0x32')][_0xe966('0x42')]){_0x45ad52[_0xe966('0x3c')]=_[_0xe966('0x41')](_0x45ad52[_0xe966('0x3c')],{'$or':_['map'](_0x45ad52['attributes'],function(_0x304795){var _0x198974={};_0x198974[_0x304795]={'$like':'%'+_0x511021['query'][_0xe966('0x42')]+'%'};return _0x198974;})});}_0x45ad52=_[_0xe966('0x41')]({},_0x45ad52,_0x511021[_0xe966('0x43')]);var _0x32d819={'where':_0x45ad52[_0xe966('0x3c')]};return db[_0xe966('0x2e')]['count'](_0x32d819)[_0xe966('0x18')](function(_0x4d5b3c){_0x2437d0[_0xe966('0x25')]=_0x4d5b3c;if(_0x511021[_0xe966('0x32')]['includeAll']){_0x45ad52['include']=[{'all':!![]}];}return db[_0xe966('0x2e')]['findAll'](_0x45ad52);})[_0xe966('0x18')](function(_0x1a8c17){_0x2437d0[_0xe966('0x44')]=_0x1a8c17;return _0x2437d0;})['then'](respondWithFilteredResult(_0xcf5fe4,_0x45ad52))[_0xe966('0x21')](handleError(_0xcf5fe4,null));};exports['show']=function(_0x8cbbe2,_0x21bac8){var _0x5e7e27={'raw':!![],'where':{'id':_0x8cbbe2[_0xe966('0x45')]['id']}},_0x1cfb1f={};_0x1cfb1f['model']=_['keys'](db[_0xe966('0x2e')]['rawAttributes']);_0x1cfb1f[_0xe966('0x32')]=_[_0xe966('0x31')](_0x8cbbe2[_0xe966('0x32')]);_0x1cfb1f[_0xe966('0x3d')]=_[_0xe966('0x36')](_0x1cfb1f[_0xe966('0x30')],_0x1cfb1f[_0xe966('0x32')]);_0x5e7e27[_0xe966('0x35')]=_[_0xe966('0x36')](_0x1cfb1f[_0xe966('0x30')],qs['fields'](_0x8cbbe2[_0xe966('0x32')][_0xe966('0x37')]));_0x5e7e27[_0xe966('0x35')]=_0x5e7e27[_0xe966('0x35')][_0xe966('0x38')]?_0x5e7e27[_0xe966('0x35')]:_0x1cfb1f[_0xe966('0x30')];if(_0x8cbbe2['query'][_0xe966('0x46')]){_0x5e7e27[_0xe966('0x47')]=[{'all':!![]}];}_0x5e7e27=_['merge']({},_0x5e7e27,_0x8cbbe2[_0xe966('0x43')]);return db[_0xe966('0x2e')][_0xe966('0x48')](_0x5e7e27)['then'](handleEntityNotFound(_0x21bac8,null))['then'](respondWithResult(_0x21bac8,null))[_0xe966('0x21')](handleError(_0x21bac8,null));};exports['create']=function(_0x451867,_0x2759b6){return db['OpenchannelMessage'][_0xe966('0x49')](_0x451867[_0xe966('0x4a')],{})['then'](respondWithResult(_0x2759b6,0xc9))[_0xe966('0x21')](handleError(_0x2759b6,null));};exports[_0xe966('0x2c')]=function(_0x55f3db,_0x20c002){if(_0x55f3db[_0xe966('0x4a')]['id']){delete _0x55f3db[_0xe966('0x4a')]['id'];}return db[_0xe966('0x2e')]['find']({'where':{'id':_0x55f3db['params']['id']}})[_0xe966('0x18')](handleEntityNotFound(_0x20c002,null))[_0xe966('0x18')](saveUpdates(_0x55f3db['body'],null))[_0xe966('0x18')](respondWithResult(_0x20c002,null))[_0xe966('0x21')](handleError(_0x20c002,null));};exports[_0xe966('0x4b')]=function(_0x2633a0,_0x332b07){return db[_0xe966('0x2e')]['find']({'where':{'id':_0x2633a0[_0xe966('0x45')]['id']}})['then'](handleEntityNotFound(_0x332b07,null))['then'](removeEntity(_0x332b07,null))[_0xe966('0x21')](handleError(_0x332b07,null));};exports[_0xe966('0x4c')]=function(_0x315bae,_0x9baf51){return db['OpenchannelMessage'][_0xe966('0x4c')]()[_0xe966('0x18')](respondWithResult(_0x9baf51,null))[_0xe966('0x21')](handleError(_0x9baf51,null));};var interaction_log=require('../../config/logger')('openchannel-interactions');exports['accept']=function(_0x209727,_0x34525c,_0x5846d2){var _0x1b0eb8={'channel':_0xe966('0x4d')};if(_0x209727[_0xe966('0x4a')]['id']){delete _0x209727[_0xe966('0x4a')]['id'];}_0x209727[_0xe966('0x4a')]['read']=!![];_0x209727['body'][_0xe966('0x4e')]=moment()[_0xe966('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x209727[_0xe966('0x4a')][_0xe966('0x50')]=_0x209727[_0xe966('0x4a')][_0xe966('0x50')]||_0x209727[_0xe966('0x51')]['id'];return db[_0xe966('0x2e')][_0xe966('0x48')]({'where':{'id':_0x209727[_0xe966('0x45')]['id'],'UserId':null},'include':[{'model':db[_0xe966('0x52')],'as':'Contact'}]})[_0xe966('0x18')](handleEntityNotFound(_0x34525c,null))[_0xe966('0x18')](saveUpdates(_0x209727['body'],null))['then'](function(_0x20549c){if(_0x20549c){_0x1b0eb8[_0xe966('0x20')]=_0x20549c[_0xe966('0x53')]({'plain':!![]});return db[_0xe966('0x54')]['find']({'where':{'id':_0x20549c[_0xe966('0x55')]}});}return null;})[_0xe966('0x18')](handleEntityNotFound(_0x34525c,null))[_0xe966('0x18')](function(_0x48cb54){if(_0x48cb54){return _0x48cb54[_0xe966('0x2c')]({'UserId':_0x209727[_0xe966('0x4a')]['UserId'],'read1stAt':_[_0xe966('0x56')](_0x48cb54[_0xe966('0x57')])?moment()[_0xe966('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xe966('0x18')](function(_0x324049){if(_0x324049){_0x1b0eb8[_0xe966('0x58')]=_0x324049[_0xe966('0x53')]({'plain':!![]});interaction_log['info'](_0xe966('0x59'),_0x209727[_0xe966('0x51')]['id'],_0x209727['user'][_0xe966('0x2d')],_0x209727[_0xe966('0x51')][_0xe966('0x5a')],_0x1b0eb8[_0xe966('0x58')]['id'],_0x209727[_0xe966('0x4a')]?JSON['stringify'](_0x209727['body']):_0xe966('0x5b'));return respondWithRpcPromise(_0xe966('0x5c'),'acceptMessage',_0x1b0eb8);}return null;})[_0xe966('0x18')](function(_0x1bd532){if(_0x1bd532){if(_0x209727[_0xe966('0x4a')]['manual']){_0x1b0eb8[_0xe966('0x20')][_0xe966('0x5d')]=util['format'](_0xe966('0x5e'),_0x209727[_0xe966('0x51')][_0xe966('0x2d')]);_0x1b0eb8[_0xe966('0x20')][_0xe966('0x5f')]=_0x1b0eb8[_0xe966('0x5f')];_0x1b0eb8[_0xe966('0x20')]['event']='accept';return respondWithRpcPromise(_0xe966('0x60'),'EventManager',{'event':_0xe966('0x61'),'message':_0x1b0eb8[_0xe966('0x20')]},client9002)[_0xe966('0x18')](function(){return _0x1b0eb8;});}return _0x1b0eb8;}return null;})[_0xe966('0x18')](respondWithResult(_0x34525c,null))[_0xe966('0x21')](handleError(_0x34525c,null));};var interaction_log=require(_0xe966('0xf'))(_0xe966('0x62'));exports[_0xe966('0x2b')]=function(_0x285614,_0x2cec91,_0x349fbd){var _0x4f3d8e={'agent':{},'channel':_0xe966('0x4d')};if(_0x285614[_0xe966('0x4a')]['id']){delete _0x285614[_0xe966('0x4a')]['id'];}_0x285614[_0xe966('0x4a')][_0xe966('0x50')]=_0x285614[_0xe966('0x4a')][_0xe966('0x50')]||_0x285614[_0xe966('0x51')]['id'];_0x4f3d8e[_0xe966('0x63')]['id']=_0x285614[_0xe966('0x4a')][_0xe966('0x50')];return db['OpenchannelMessage'][_0xe966('0x48')]({'where':{'id':_0x285614[_0xe966('0x45')]['id'],'UserId':null}})[_0xe966('0x18')](handleEntityNotFound(_0x2cec91,null))[_0xe966('0x18')](function(_0x2c230a){if(_0x2c230a){_0x4f3d8e[_0xe966('0x20')]=_0x2c230a[_0xe966('0x53')]({'plain':!![]});return db[_0xe966('0x54')][_0xe966('0x48')]({'where':{'id':_0x2c230a[_0xe966('0x55')]}});}return null;})[_0xe966('0x18')](handleEntityNotFound(_0x2cec91,null))[_0xe966('0x18')](function(_0x441e63){if(_0x441e63){_0x4f3d8e['interaction']=_0x441e63[_0xe966('0x53')]({'plain':!![]});interaction_log[_0xe966('0x19')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x285614[_0xe966('0x51')]['id'],_0x285614[_0xe966('0x51')]['name'],_0x285614[_0xe966('0x51')][_0xe966('0x5a')],_0x4f3d8e[_0xe966('0x58')]['id'],_0x285614['body']?JSON[_0xe966('0x1d')](_0x285614[_0xe966('0x4a')]):'null');return respondWithRpcPromise(_0xe966('0x64'),'rejectMessage',_0x4f3d8e);}return null;})[_0xe966('0x18')](function(_0x258451){if(_0x258451){_0x258451[_0xe966('0x20')][_0xe966('0x5d')]=util['format'](_0xe966('0x5e'),_0x285614['user']['name']);_0x258451['message'][_0xe966('0x5f')]=_0x4f3d8e['channel'];_0x258451[_0xe966('0x20')][_0xe966('0x65')]=_0xe966('0x2b');respondWithRpcPromise(_0xe966('0x60'),_0xe966('0x60'),{'event':_0xe966('0x66'),'message':_0x258451[_0xe966('0x20')]},client9002);return _0x4f3d8e;}return null;})[_0xe966('0x18')](respondWithResult(_0x2cec91,null))[_0xe966('0x21')](handleError(_0x2cec91,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 23e80c8..7a430f4 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 _0x3482=['emit','hasOwnProperty','hook','exports','OpenchannelMessage','setMaxListeners','update','remove'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x3482,0x1bc));var _0x2348=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x3482[_0x15ea09];return _0x3e9c78;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require('../../mysqldb')['db'][_0x2348('0x0')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x2348('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2348('0x2'),'afterDestroy':_0x2348('0x3')};function emitEvent(_0x2f4b4e){return function(_0x2e5165,_0x37cb16,_0x270cf4){OpenchannelMessageEvents[_0x2348('0x4')](_0x2f4b4e+':'+_0x2e5165['id'],_0x2e5165);OpenchannelMessageEvents[_0x2348('0x4')](_0x2f4b4e,_0x2e5165);_0x270cf4(null);};}for(var e in events){if(events[_0x2348('0x5')](e)){var event=events[e];OpenchannelMessage[_0x2348('0x6')](e,emitEvent(event));}}module[_0x2348('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xbb1e=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbb1e[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xebb1('0x0'))['db'][_0xebb1('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xebb1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xebb1('0x3'),'afterDestroy':_0xebb1('0x4')};function emitEvent(_0x13490a){return function(_0x414a02,_0x2d2a7d,_0x446d6c){OpenchannelMessageEvents[_0xebb1('0x5')](_0x13490a+':'+_0x414a02['id'],_0x414a02);OpenchannelMessageEvents[_0xebb1('0x5')](_0x13490a,_0x414a02);_0x446d6c(null);};}for(var e in events){if(events[_0xebb1('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xebb1('0x7')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 09faa19..fa3a926 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 _0x636f=['then','createdAt','catch','error','describe','OpenchannelAccount','find','Interactions','CmContact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','Contact','GET','update','inspect','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','exports','define','OpenchannelMessage','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId'];(function(_0x115d1f,_0xc8262){var _0x357a9e=function(_0x510cb1){while(--_0x510cb1){_0x115d1f['push'](_0x115d1f['shift']());}};_0x357a9e(++_0xc8262);}(_0x636f,0x188));var _0xf636=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x636f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf636('0x0'))(_0xf636('0x1'));var moment=require(_0xf636('0x2'));var BPromise=require(_0xf636('0x3'));var rp=require(_0xf636('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0xf636('0x5')]=function(_0x1479ae,_0x1291af){return _0x1479ae[_0xf636('0x6')](_0xf636('0x7'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdae985,_0x46a395,_0x2da859){var _0x3f6dfb=_0x1479ae[_0xf636('0x8')];var _0x1b4f04=_0xdae985[_0xf636('0x9')]({'plain':!![]});if(_0x1b4f04[_0xf636('0xa')][_0xf636('0xb')]()==='in'||_0x1b4f04[_0xf636('0xa')]['toLowerCase']()===_0xf636('0xc')&&!_0x1b4f04[_0xf636('0xd')]&&!_['isNil'](_0x1b4f04[_0xf636('0xe')])){_0x3f6dfb[_0xf636('0xf')][_0xf636('0x10')]({'where':{'id':_0x1b4f04[_0xf636('0x11')]}})[_0xf636('0x12')](function(_0xf8d0e9){if(_0xf8d0e9){_0xf8d0e9['update']({'lastMsgAt':_0x1b4f04[_0xf636('0x13')],'lastMsgDirection':_0x1b4f04[_0xf636('0xa')][_0xf636('0xb')](),'lastMsgBody':_0x1b4f04['body']});}})[_0xf636('0x14')](function(_0x579d8d){console[_0xf636('0x15')](_0x579d8d);});}if(_0x1b4f04[_0xf636('0xa')]==='out'&&!_0x1b4f04[_0xf636('0xd')]){var _0x7d8ebf;_0x3f6dfb['CmContact'][_0xf636('0x16')]()[_0xf636('0x12')](function(_0x13c314){return _0x3f6dfb[_0xf636('0x17')][_0xf636('0x18')]({'where':{'id':_0x1b4f04['OpenchannelAccountId']},'include':[{'model':_0x3f6dfb[_0xf636('0xf')],'as':_0xf636('0x19'),'where':{'id':_0x1b4f04['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3f6dfb[_0xf636('0x1a')],'as':'Contact','attributes':_['keys'](_0x13c314)}]}]});})[_0xf636('0x12')](function(_0x122ec1){_0x7d8ebf=_0x122ec1['get']({'plain':!![]});if(_0x7d8ebf&&_0x7d8ebf['replyUri']){logger[_0xf636('0x1b')](_0xf636('0x1c'),_0xf636('0x1d'),util[_0xf636('0x1e')](_0xf636('0x1f'),_0x1b4f04['id'],_0x7d8ebf[_0xf636('0x20')]));if(_0x7d8ebf[_0xf636('0x19')]&&_0x7d8ebf[_0xf636('0x19')][_0xf636('0x21')]){_0x1b4f04[_0xf636('0x22')]=_['omit'](_0x7d8ebf[_0xf636('0x19')][0x0],_0xf636('0x23'));_0x1b4f04[_0xf636('0x23')]=_0x7d8ebf[_0xf636('0x19')][0x0][_0xf636('0x23')];}var _0x46a395={'method':'POST','uri':encodeURI(_0x7d8ebf[_0xf636('0x20')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46a395['method']){case _0xf636('0x24'):_0x46a395['qs']=_0x1b4f04;break;case'POST':_0x46a395['body']=_0x1b4f04;break;}return rp(_0x46a395)['then'](function(_0x46bc60){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xf636('0x1d'),util[_0xf636('0x1e')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x1b4f04['id'],_0x7d8ebf[_0xf636('0x20')]));return _0xdae985[_0xf636('0x25')]({'read':!![]});})[_0xf636('0x14')](function(_0xf28059){logger[_0xf636('0x15')]('OpenchannelMessage,\x20%s,\x20%s',_0xf636('0x1d'),util[_0xf636('0x26')](_0xf28059,{'showHidden':![],'depth':null}));_0x2da859();});}else{_0x2da859();}})['finally'](function(){_0x2da859();});}else{_0x2da859();}}},'charset':_0xf636('0x27'),'collate':_0xf636('0x28')});}; \ No newline at end of file +var _0x073e=['../../config/logger','api','./openchannelMessage.attributes','exports','openchannel_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','then','update','body','catch','error','CmContact','describe','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','POST','Message\x20%d\x20forwarded\x20to\x20%s','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x27eb79,_0xeea111){var _0x51e1c4=function(_0x2c63ad){while(--_0x2c63ad){_0x27eb79['push'](_0x27eb79['shift']());}};_0x51e1c4(++_0xeea111);}(_0x073e,0x181));var _0xe073=function(_0x381476,_0x1c520f){_0x381476=_0x381476-0x0;var _0x5b20fb=_0x073e[_0x381476];return _0x5b20fb;};'use strict';var _=require(_0xe073('0x0'));var util=require(_0xe073('0x1'));var logger=require(_0xe073('0x2'))(_0xe073('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe073('0x4'));module[_0xe073('0x5')]=function(_0x29444b,_0x5ce161){return _0x29444b['define']('OpenchannelMessage',attributes,{'tableName':_0xe073('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x44092d,_0x1bcaae,_0x3b4fc7){var _0x373bf6=_0x29444b[_0xe073('0x7')];var _0x483f85=_0x44092d[_0xe073('0x8')]({'plain':!![]});if(_0x483f85[_0xe073('0x9')][_0xe073('0xa')]()==='in'||_0x483f85[_0xe073('0x9')]['toLowerCase']()===_0xe073('0xb')&&!_0x483f85[_0xe073('0xc')]&&!_[_0xe073('0xd')](_0x483f85[_0xe073('0xe')])){_0x373bf6[_0xe073('0xf')][_0xe073('0x10')]({'where':{'id':_0x483f85['OpenchannelInteractionId']}})[_0xe073('0x11')](function(_0x56e3f5){if(_0x56e3f5){_0x56e3f5[_0xe073('0x12')]({'lastMsgAt':_0x483f85['createdAt'],'lastMsgDirection':_0x483f85[_0xe073('0x9')]['toLowerCase'](),'lastMsgBody':_0x483f85[_0xe073('0x13')]});}})[_0xe073('0x14')](function(_0x47828d){console[_0xe073('0x15')](_0x47828d);});}if(_0x483f85[_0xe073('0x9')]===_0xe073('0xb')&&!_0x483f85[_0xe073('0xc')]){var _0xfb28f5;_0x373bf6[_0xe073('0x16')][_0xe073('0x17')]()[_0xe073('0x11')](function(_0x512fe8){return _0x373bf6['OpenchannelAccount']['find']({'where':{'id':_0x483f85[_0xe073('0x18')]},'include':[{'model':_0x373bf6[_0xe073('0xf')],'as':_0xe073('0x19'),'where':{'id':_0x483f85[_0xe073('0x1a')]},'limit':0x1,'include':[{'model':_0x373bf6['CmContact'],'as':_0xe073('0x1b'),'attributes':_[_0xe073('0x1c')](_0x512fe8)}]}]});})[_0xe073('0x11')](function(_0x54c10e){_0xfb28f5=_0x54c10e[_0xe073('0x8')]({'plain':!![]});if(_0xfb28f5&&_0xfb28f5[_0xe073('0x1d')]){logger[_0xe073('0x1e')](_0xe073('0x1f'),_0xe073('0x20'),util[_0xe073('0x21')](_0xe073('0x22'),_0x483f85['id'],_0xfb28f5[_0xe073('0x1d')]));if(_0xfb28f5[_0xe073('0x19')]&&_0xfb28f5[_0xe073('0x19')]['length']){_0x483f85[_0xe073('0x23')]=_[_0xe073('0x24')](_0xfb28f5[_0xe073('0x19')][0x0],_0xe073('0x1b'));_0x483f85[_0xe073('0x1b')]=_0xfb28f5[_0xe073('0x19')][0x0]['Contact'];}var _0x1bcaae={'method':_0xe073('0x25'),'uri':encodeURI(_0xfb28f5['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1bcaae['method']){case'GET':_0x1bcaae['qs']=_0x483f85;break;case'POST':_0x1bcaae['body']=_0x483f85;break;}return rp(_0x1bcaae)['then'](function(_0x23537f){logger[_0xe073('0x1e')]('OpenchannelMessage,\x20%s,\x20%s',_0xe073('0x20'),util[_0xe073('0x21')](_0xe073('0x26'),_0x483f85['id'],_0xfb28f5['replyUri']));return _0x44092d[_0xe073('0x12')]({'read':!![]});})['catch'](function(_0x255d91){logger[_0xe073('0x15')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0xe073('0x27')](_0x255d91,{'showHidden':![],'depth':null}));_0x3b4fc7();});}else{_0x3b4fc7();}})[_0xe073('0x28')](function(){_0x3b4fc7();});}else{_0x3b4fc7();}}},'charset':_0xe073('0x29'),'collate':_0xe073('0x2a')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8139618..ebee954 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 _0x008c=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateOpenchannelMessage','options','debug','catch'];(function(_0x519afe,_0x2e89ff){var _0xcc2498=function(_0x95006b){while(--_0x95006b){_0x519afe['push'](_0x519afe['shift']());}};_0xcc2498(++_0x2e89ff);}(_0x008c,0x188));var _0xc008=function(_0x4326eb,_0x1801c5){_0x4326eb=_0x4326eb-0x0;var _0x2735a3=_0x008c[_0x4326eb];return _0x2735a3;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var jayson=require(_0xc008('0x9'));var client=jayson[_0xc008('0xa')][_0xc008('0xb')]({'port':0x232a});var socket=require(_0xc008('0xc'))({'host':_0xc008('0xd'),'port':0x18eb});require('./openchannelMessage.socket')[_0xc008('0xe')](socket);function respondWithRpcPromise(_0x5aa09b,_0x30be38,_0x5b64f8){return new BPromise(function(_0x52041f,_0x27830d){return client[_0xc008('0xf')](_0x5aa09b,_0x5b64f8)['then'](function(_0x51ba7d){logger['info'](_0xc008('0x10'),_0x30be38,_0xc008('0x11'));logger['debug'](_0xc008('0x12'),_0x30be38,_0xc008('0x11'),JSON[_0xc008('0x13')](_0x51ba7d));if(_0x51ba7d[_0xc008('0x14')]){if(_0x51ba7d[_0xc008('0x14')][_0xc008('0x15')]===0x1f4){logger[_0xc008('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x30be38,_0x51ba7d['error'][_0xc008('0x16')]);return _0x27830d(_0x51ba7d['error'][_0xc008('0x16')]);}logger[_0xc008('0x14')](_0xc008('0x10'),_0x30be38,_0x51ba7d[_0xc008('0x14')][_0xc008('0x16')]);return _0x52041f(_0x51ba7d['error']['message']);}else{logger['info'](_0xc008('0x10'),_0x30be38,_0xc008('0x11'));_0x52041f(_0x51ba7d[_0xc008('0x17')][_0xc008('0x16')]);}})['catch'](function(_0x53b06e){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x30be38,_0x53b06e);_0x27830d(_0x53b06e);});});}exports[_0xc008('0x18')]=function(_0x462af5){var _0x501137=this;return new Promise(function(_0x813397,_0x5906e6){return db['OpenchannelMessage']['create'](_0x462af5['body'],{'raw':_0x462af5[_0xc008('0x19')]?_0x462af5['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4a582d){logger['info'](_0xc008('0x18'),_0x462af5);logger[_0xc008('0x1a')](_0xc008('0x18'),_0x462af5,JSON[_0xc008('0x13')](_0x4a582d));_0x813397(_0x4a582d);})[_0xc008('0x1b')](function(_0x110128){logger['error'](_0xc008('0x18'),_0x110128['message'],_0x462af5);_0x5906e6(_0x501137['error'](0x1f4,_0x110128[_0xc008('0x16')]));});});}; \ No newline at end of file +var _0x55ca=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','options','raw','lodash','util','../../mysqldb'];(function(_0x4b02d5,_0x4d87ed){var _0x3d1bfb=function(_0x30774d){while(--_0x30774d){_0x4b02d5['push'](_0x4b02d5['shift']());}};_0x3d1bfb(++_0x4d87ed);}(_0x55ca,0x126));var _0xa55c=function(_0x17791f,_0x1d16d8){_0x17791f=_0x17791f-0x0;var _0x332dc4=_0x55ca[_0x17791f];return _0x332dc4;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xa55c('0x2'))['db'];var utils=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var jayson=require(_0xa55c('0x6'));var client=jayson[_0xa55c('0x7')][_0xa55c('0x8')]({'port':0x232a});var socket=require(_0xa55c('0x9'))({'host':_0xa55c('0xa'),'port':0x18eb});require('./openchannelMessage.socket')[_0xa55c('0xb')](socket);function respondWithRpcPromise(_0x2537f0,_0x57e069,_0x291996){return new BPromise(function(_0x290d28,_0x52a3bc){return client['request'](_0x2537f0,_0x291996)[_0xa55c('0xc')](function(_0x20c76a){logger[_0xa55c('0xd')](_0xa55c('0xe'),_0x57e069,_0xa55c('0xf'));logger[_0xa55c('0x10')](_0xa55c('0x11'),_0x57e069,_0xa55c('0xf'),JSON[_0xa55c('0x12')](_0x20c76a));if(_0x20c76a[_0xa55c('0x13')]){if(_0x20c76a['error']['code']===0x1f4){logger[_0xa55c('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x57e069,_0x20c76a['error']['message']);return _0x52a3bc(_0x20c76a[_0xa55c('0x13')][_0xa55c('0x14')]);}logger[_0xa55c('0x13')](_0xa55c('0xe'),_0x57e069,_0x20c76a[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x290d28(_0x20c76a['error'][_0xa55c('0x14')]);}else{logger[_0xa55c('0xd')](_0xa55c('0xe'),_0x57e069,_0xa55c('0xf'));_0x290d28(_0x20c76a[_0xa55c('0x15')][_0xa55c('0x14')]);}})[_0xa55c('0x16')](function(_0x2d09d8){logger[_0xa55c('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x57e069,_0x2d09d8);_0x52a3bc(_0x2d09d8);});});}exports[_0xa55c('0x17')]=function(_0x104a99){var _0x461284=this;return new Promise(function(_0x358b61,_0x23a1ae){return db[_0xa55c('0x18')]['create'](_0x104a99['body'],{'raw':_0x104a99[_0xa55c('0x19')]?_0x104a99[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x383d92){logger[_0xa55c('0xd')]('CreateOpenchannelMessage',_0x104a99);logger[_0xa55c('0x10')](_0xa55c('0x17'),_0x104a99,JSON[_0xa55c('0x12')](_0x383d92));_0x358b61(_0x383d92);})[_0xa55c('0x16')](function(_0x234372){logger['error'](_0xa55c('0x17'),_0x234372['message'],_0x104a99);_0x23a1ae(_0x461284['error'](0x1f4,_0x234372['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 4c95047..9560f58 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 _0x3685=['./openchannelMessage.events','remove','update','emit','removeListener','register','length','openchannelMessage:'];(function(_0xb05fd2,_0x1d6c8c){var _0x30bf7d=function(_0x1e38a4){while(--_0x1e38a4){_0xb05fd2['push'](_0xb05fd2['shift']());}};_0x30bf7d(++_0x1d6c8c);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var OpenchannelMessageEvents=require(_0x5368('0x0'));var events=['save',_0x5368('0x1'),_0x5368('0x2')];function createListener(_0x1e4f48,_0x3ee78f){return function(_0x38e06c){_0x3ee78f[_0x5368('0x3')](_0x1e4f48,_0x38e06c);};}function removeListener(_0x271e21,_0x2c9c35){return function(){OpenchannelMessageEvents[_0x5368('0x4')](_0x271e21,_0x2c9c35);};}exports[_0x5368('0x5')]=function(_0x4fc6ed){for(var _0x1a4450=0x0,_0x2529a2=events[_0x5368('0x6')];_0x1a4450<_0x2529a2;_0x1a4450++){var _0xaf4549=events[_0x1a4450];var _0x55fb7d=createListener(_0x5368('0x7')+_0xaf4549,_0x4fc6ed);OpenchannelMessageEvents['on'](_0xaf4549,_0x55fb7d);}}; \ No newline at end of file +var _0xe14b=['removeListener','register','length','./openchannelMessage.events','save','emit'];(function(_0x5a5337,_0x20e15f){var _0x5af3b3=function(_0x542634){while(--_0x542634){_0x5a5337['push'](_0x5a5337['shift']());}};_0x5af3b3(++_0x20e15f);}(_0xe14b,0x93));var _0xbe14=function(_0x3c4c00,_0x25a6ea){_0x3c4c00=_0x3c4c00-0x0;var _0xad1fdb=_0xe14b[_0x3c4c00];return _0xad1fdb;};'use strict';var OpenchannelMessageEvents=require(_0xbe14('0x0'));var events=[_0xbe14('0x1'),'remove','update'];function createListener(_0x11c3a0,_0x36393a){return function(_0x48a116){_0x36393a[_0xbe14('0x2')](_0x11c3a0,_0x48a116);};}function removeListener(_0x5ce8fb,_0x496c04){return function(){OpenchannelMessageEvents[_0xbe14('0x3')](_0x5ce8fb,_0x496c04);};}exports[_0xbe14('0x4')]=function(_0x1fe204){for(var _0x1ff100=0x0,_0x1d9ade=events[_0xbe14('0x5')];_0x1ff100<_0x1d9ade;_0x1ff100++){var _0x196fca=events[_0x1ff100];var _0x566ae7=createListener('openchannelMessage:'+_0x196fca,_0x1fe204);OpenchannelMessageEvents['on'](_0x196fca,_0x566ae7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index a936bf9..fa84edd 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 _0x25a1=['describe','get','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','create','addTeams','/:id/users','addAgents','put','delete','removeTeams','removeAgents','exports','multer','util','path','Router','../../components/auth/service','index','/describe','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x25a1,0x172));var _0x125a=function(_0x345ae7,_0x206d95){_0x345ae7=_0x345ae7-0x0;var _0x45dcdc=_0x25a1[_0x345ae7];return _0x45dcdc;};'use strict';var multer=require(_0x125a('0x0'));var util=require(_0x125a('0x1'));var path=require(_0x125a('0x2'));var express=require('express');var router=express[_0x125a('0x3')]();var auth=require(_0x125a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x125a('0x5')]);router['get'](_0x125a('0x6'),auth[_0x125a('0x7')](),controller[_0x125a('0x8')]);router[_0x125a('0x9')](_0x125a('0xa'),auth['isAuthenticated'](),controller[_0x125a('0xb')]);router[_0x125a('0x9')](_0x125a('0xc'),auth['isAuthenticated'](),controller[_0x125a('0xd')]);router[_0x125a('0x9')](_0x125a('0xe'),auth['isAuthenticated'](),controller[_0x125a('0xf')]);router[_0x125a('0x9')]('/:id/users',auth[_0x125a('0x7')](),controller[_0x125a('0x10')]);router[_0x125a('0x11')]('/',auth[_0x125a('0x7')](),controller[_0x125a('0x12')]);router[_0x125a('0x11')](_0x125a('0xe'),auth['isAuthenticated'](),controller[_0x125a('0x13')]);router['post'](_0x125a('0x14'),auth[_0x125a('0x7')](),controller[_0x125a('0x15')]);router[_0x125a('0x16')](_0x125a('0xa'),auth[_0x125a('0x7')](),controller['update']);router[_0x125a('0x17')]('/:id',auth[_0x125a('0x7')](),controller['destroy']);router[_0x125a('0x17')](_0x125a('0xe'),auth[_0x125a('0x7')](),controller[_0x125a('0x18')]);router[_0x125a('0x17')](_0x125a('0x14'),auth[_0x125a('0x7')](),controller[_0x125a('0x19')]);module[_0x125a('0x1a')]=router; \ No newline at end of file +var _0x057b=['post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x4358e1,_0x3dc825){var _0xb759a1=function(_0x2055ff){while(--_0x2055ff){_0x4358e1['push'](_0x4358e1['shift']());}};_0xb759a1(++_0x3dc825);}(_0x057b,0x140));var _0xb057=function(_0x1eba2c,_0x43896a){_0x1eba2c=_0x1eba2c-0x0;var _0xa955ca=_0x057b[_0x1eba2c];return _0xa955ca;};'use strict';var multer=require(_0xb057('0x0'));var util=require(_0xb057('0x1'));var path=require(_0xb057('0x2'));var express=require(_0xb057('0x3'));var router=express[_0xb057('0x4')]();var auth=require(_0xb057('0x5'));var interaction=require(_0xb057('0x6'));var config=require(_0xb057('0x7'));var controller=require(_0xb057('0x8'));router[_0xb057('0x9')]('/',auth[_0xb057('0xa')](),controller[_0xb057('0xb')]);router[_0xb057('0x9')](_0xb057('0xc'),auth[_0xb057('0xa')](),controller[_0xb057('0xd')]);router[_0xb057('0x9')](_0xb057('0xe'),auth['isAuthenticated'](),controller[_0xb057('0xf')]);router[_0xb057('0x9')](_0xb057('0x10'),auth['isAuthenticated'](),controller[_0xb057('0x11')]);router[_0xb057('0x9')](_0xb057('0x12'),auth[_0xb057('0xa')](),controller[_0xb057('0x13')]);router['get'](_0xb057('0x14'),auth[_0xb057('0xa')](),controller['getAgents']);router['post']('/',auth[_0xb057('0xa')](),controller['create']);router[_0xb057('0x15')]('/:id/teams',auth[_0xb057('0xa')](),controller[_0xb057('0x16')]);router[_0xb057('0x15')](_0xb057('0x14'),auth[_0xb057('0xa')](),controller[_0xb057('0x17')]);router[_0xb057('0x18')](_0xb057('0xe'),auth[_0xb057('0xa')](),controller[_0xb057('0x19')]);router[_0xb057('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xb057('0x1b')]);router[_0xb057('0x1a')](_0xb057('0x12'),auth[_0xb057('0xa')](),controller[_0xb057('0x1c')]);router[_0xb057('0x1a')]('/:id/users',auth[_0xb057('0xa')](),controller[_0xb057('0x1d')]);module[_0xb057('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index d9334a7..5e85d39 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 _0x145c=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM'];(function(_0x350966,_0x184135){var _0x9b2ca5=function(_0x228cb9){while(--_0x228cb9){_0x350966['push'](_0x350966['shift']());}};_0x9b2ca5(++_0x184135);}(_0x145c,0x79));var _0xc145=function(_0x3599ec,_0x134d0e){_0x3599ec=_0x3599ec-0x0;var _0x1f1efe=_0x145c[_0x3599ec];return _0x1f1efe;};'use strict';var Sequelize=require(_0xc145('0x0'));module[_0xc145('0x1')]={'name':{'type':Sequelize[_0xc145('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc145('0x2')]},'timeout':{'type':Sequelize[_0xc145('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc145('0x4')]('rrmemory',_0xc145('0x5'),_0xc145('0x6'))}}; \ No newline at end of file +var _0xefef=['beepall','roundrobin','sequelize','name','STRING','INTEGER','ENUM','rrmemory'];(function(_0x57ed06,_0x589749){var _0x2e1d10=function(_0x208f2a){while(--_0x208f2a){_0x57ed06['push'](_0x57ed06['shift']());}};_0x2e1d10(++_0x589749);}(_0xefef,0x8a));var _0xfefe=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0xefef[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0xfefe('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xfefe('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfefe('0x2')]},'timeout':{'type':Sequelize[_0xfefe('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfefe('0x4')](_0xfefe('0x5'),_0xfefe('0x6'),_0xfefe('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 783e67d..388b432 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 _0xe783=['crypto','desk.js','querystring','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','count','offset','set','apply','reject','then','destroy','error','stack','name','index','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','add','merge','where','filter','options','include','OpenchannelQueue','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','update','params','describe','get','pick','OpenchannelQueueId','map','UserOpenchannelQueue','findAndCountAll','agent','openchannelPause','updatedAt','%s/%s','SIP','Team','getTeams','nolimit','ids','Agents','addAgents','penalty','addTeams','removeTeams','User','union','removeAgents','spread','emit','userOpenchannelQueue:save','userOpenchannelQueue:remove','getAgents','findOne','request-promise','bluebird','path','sox','to-csv','squel'];(function(_0x51f900,_0x2ab840){var _0x270c3b=function(_0x3ab0ab){while(--_0x3ab0ab){_0x51f900['push'](_0x51f900['shift']());}};_0x270c3b(++_0x2ab840);}(_0xe783,0x1d0));var _0x3e78=function(_0x6f474b,_0x5f4be5){_0x6f474b=_0x6f474b-0x0;var _0x1f6fc6=_0xe783[_0x6f474b];return _0x1f6fc6;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x3e78('0x0'));var moment=require('moment');var BPromise=require(_0x3e78('0x1'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e78('0x2'));var sox=require(_0x3e78('0x3'));var csv=require(_0x3e78('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3e78('0x5'));var crypto=require(_0x3e78('0x6'));var jsforce=require('jsforce');var deskjs=require(_0x3e78('0x7'));var toCsv=require('to-csv');var querystring=require(_0x3e78('0x8'));var Papa=require(_0x3e78('0x9'));var qs=require('../../components/parsers/qs');var logger=require(_0x3e78('0xa'))(_0x3e78('0xb'));var utils=require('../../config/utils');var config=require(_0x3e78('0xc'));var db=require(_0x3e78('0xd'))['db'];var socket=require('socket.io-emitter')({'host':_0x3e78('0xe'),'port':0x18eb});require(_0x3e78('0xf'))[_0x3e78('0x10')](socket);function respondWithStatusCode(_0x39fd7d,_0x135983){_0x135983=_0x135983||0xcc;return function(_0x477ce3){if(_0x477ce3){return _0x39fd7d[_0x3e78('0x11')](_0x135983);}return _0x39fd7d[_0x3e78('0x12')](_0x135983)[_0x3e78('0x13')]();};}function respondWithResult(_0x35c199,_0x4bf01c){_0x4bf01c=_0x4bf01c||0xc8;return function(_0x2c6645){if(_0x2c6645){return _0x35c199[_0x3e78('0x12')](_0x4bf01c)[_0x3e78('0x14')](_0x2c6645);}};}function respondWithFilteredResult(_0x592bb4,_0x5212c2){return function(_0x58d1f1){if(_0x58d1f1){var _0x1672bf=_0x58d1f1[_0x3e78('0x15')],_0x3980bb=_0x5212c2[_0x3e78('0x16')],_0x42ee41=_0x5212c2['offset']+_0x5212c2['limit'],_0x31aff3;if(_0x42ee41>=_0x1672bf){_0x42ee41=_0x1672bf;_0x31aff3=0xc8;}else{_0x31aff3=0xce;}_0x592bb4[_0x3e78('0x12')](_0x31aff3);return _0x592bb4[_0x3e78('0x17')]('Content-Range',_0x3980bb+'-'+_0x42ee41+'/'+_0x1672bf)[_0x3e78('0x14')](_0x58d1f1);}return null;};}function patchUpdates(_0x131cb6){return function(_0x3ceb82){try{jsonpatch[_0x3e78('0x18')](_0x3ceb82,_0x131cb6,!![]);}catch(_0x661077){return BPromise[_0x3e78('0x19')](_0x661077);}return _0x3ceb82['save']();};}function saveUpdates(_0x33bd74,_0x489f18){return function(_0x3f7705){if(_0x3f7705){return _0x3f7705['update'](_0x33bd74)[_0x3e78('0x1a')](function(_0x12cc31){return _0x12cc31;});}return null;};}function removeEntity(_0x49c7cd,_0x2eaaba){return function(_0x418475){if(_0x418475){return _0x418475[_0x3e78('0x1b')]()[_0x3e78('0x1a')](function(){_0x49c7cd[_0x3e78('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x459dde,_0x5e4f32){return function(_0x234581){if(!_0x234581){_0x459dde['sendStatus'](0x194);}return _0x234581;};}function handleError(_0x14c94d,_0x284d01){_0x284d01=_0x284d01||0x1f4;return function(_0x514da8){logger[_0x3e78('0x1c')](_0x514da8[_0x3e78('0x1d')]);if(_0x514da8[_0x3e78('0x1e')]){delete _0x514da8[_0x3e78('0x1e')];}_0x14c94d['status'](_0x284d01)['send'](_0x514da8);};}exports[_0x3e78('0x1f')]=function(_0x4c0a67,_0x5b35d7){var _0x3b3d72={},_0x1fb9c8={},_0x39d383={'count':0x0,'rows':[]};var _0x186d10=db['OpenchannelQueue']['rawAttributes'];_0x1fb9c8[_0x3e78('0x20')]=_[_0x3e78('0x21')](_0x186d10);var _0x1e696e={'dateStart':_0x4c0a67['query'][_0x3e78('0x22')],'dateEnd':_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x24')]};delete _0x4c0a67['query'][_0x3e78('0x22')];delete _0x4c0a67[_0x3e78('0x23')][_0x3e78('0x24')];_0x1fb9c8[_0x3e78('0x23')]=_['keys'](_0x4c0a67[_0x3e78('0x23')]);_0x1fb9c8[_0x3e78('0x25')]=_[_0x3e78('0x26')](_0x1fb9c8[_0x3e78('0x20')],_0x1fb9c8[_0x3e78('0x23')]);_0x3b3d72[_0x3e78('0x27')]=_[_0x3e78('0x26')](_0x1fb9c8[_0x3e78('0x20')],qs['fields'](_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x28')]));_0x3b3d72[_0x3e78('0x27')]=_0x3b3d72[_0x3e78('0x27')][_0x3e78('0x29')]?_0x3b3d72[_0x3e78('0x27')]:_0x1fb9c8[_0x3e78('0x20')];if(!_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x2a')]('nolimit')){_0x3b3d72['limit']=qs[_0x3e78('0x2b')](_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x2b')]);_0x3b3d72[_0x3e78('0x16')]=qs[_0x3e78('0x16')](_0x4c0a67[_0x3e78('0x23')]['offset']);}_0x3b3d72[_0x3e78('0x2c')]=qs[_0x3e78('0x2d')](_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x2d')]);_0x3b3d72['where']=qs['filters'](_['pick'](_0x4c0a67[_0x3e78('0x23')],_0x1fb9c8[_0x3e78('0x25')]));if(_0x1e696e['dateStart']){if(_0x1e696e[_0x3e78('0x24')]){_0x1e696e[_0x3e78('0x24')]=moment(_0x1e696e['dateEnd'])[_0x3e78('0x2e')](0x1,'day');}else{_0x1e696e[_0x3e78('0x24')]=moment(_0x1e696e['dateStart'])[_0x3e78('0x2e')](0x1,'day');}_[_0x3e78('0x2f')](_0x3b3d72[_0x3e78('0x30')],{'createdAt':{'$gte':_0x1e696e[_0x3e78('0x22')],'$lte':_0x1e696e[_0x3e78('0x24')]}});}if(_0x4c0a67[_0x3e78('0x23')][_0x3e78('0x31')]){_0x3b3d72['where']=_[_0x3e78('0x2f')](_0x3b3d72[_0x3e78('0x30')],{'$or':_['map'](_0x3b3d72['attributes'],function(_0x29502e){var _0x2e2a9c={};_0x2e2a9c[_0x29502e]={'$like':'%'+_0x4c0a67['query']['filter']+'%'};return _0x2e2a9c;})});}_0x3b3d72=_['merge']({},_0x3b3d72,_0x4c0a67[_0x3e78('0x32')]);var _0x23cc32={'where':_0x3b3d72['where']};return db['OpenchannelQueue']['count'](_0x23cc32)[_0x3e78('0x1a')](function(_0x6a3c11){_0x39d383['count']=_0x6a3c11;if(_0x4c0a67[_0x3e78('0x23')]['includeAll']){_0x3b3d72[_0x3e78('0x33')]=[{'all':!![]}];}return db[_0x3e78('0x34')][_0x3e78('0x35')](_0x3b3d72);})[_0x3e78('0x1a')](function(_0x107dd0){_0x39d383[_0x3e78('0x36')]=_0x107dd0;return _0x39d383;})['then'](respondWithFilteredResult(_0x5b35d7,_0x3b3d72))[_0x3e78('0x37')](handleError(_0x5b35d7,null));};exports[_0x3e78('0x38')]=function(_0x5045f2,_0x484d6d){var _0x114bfd={'raw':!![],'where':{'id':_0x5045f2['params']['id']}},_0x56c674={};_0x56c674[_0x3e78('0x20')]=_[_0x3e78('0x21')](db['OpenchannelQueue'][_0x3e78('0x39')]);_0x56c674['query']=_[_0x3e78('0x21')](_0x5045f2[_0x3e78('0x23')]);_0x56c674[_0x3e78('0x25')]=_[_0x3e78('0x26')](_0x56c674[_0x3e78('0x20')],_0x56c674['query']);_0x114bfd['attributes']=_['intersection'](_0x56c674[_0x3e78('0x20')],qs[_0x3e78('0x28')](_0x5045f2['query'][_0x3e78('0x28')]));_0x114bfd[_0x3e78('0x27')]=_0x114bfd['attributes'][_0x3e78('0x29')]?_0x114bfd[_0x3e78('0x27')]:_0x56c674[_0x3e78('0x20')];if(_0x5045f2[_0x3e78('0x23')][_0x3e78('0x3a')]){_0x114bfd['include']=[{'all':!![]}];}_0x114bfd=_[_0x3e78('0x2f')]({},_0x114bfd,_0x5045f2[_0x3e78('0x32')]);return db[_0x3e78('0x34')][_0x3e78('0x3b')](_0x114bfd)[_0x3e78('0x1a')](handleEntityNotFound(_0x484d6d,null))['then'](respondWithResult(_0x484d6d,null))['catch'](handleError(_0x484d6d,null));};exports[_0x3e78('0x3c')]=function(_0x127d91,_0xe77e4e){return db[_0x3e78('0x34')][_0x3e78('0x3c')](_0x127d91[_0x3e78('0x3d')],{})[_0x3e78('0x1a')](respondWithResult(_0xe77e4e,0xc9))[_0x3e78('0x37')](handleError(_0xe77e4e,null));};exports[_0x3e78('0x3e')]=function(_0x4ae846,_0x333f26){if(_0x4ae846[_0x3e78('0x3d')]['id']){delete _0x4ae846[_0x3e78('0x3d')]['id'];}return db[_0x3e78('0x34')][_0x3e78('0x3b')]({'where':{'id':_0x4ae846[_0x3e78('0x3f')]['id']}})[_0x3e78('0x1a')](handleEntityNotFound(_0x333f26,null))[_0x3e78('0x1a')](saveUpdates(_0x4ae846[_0x3e78('0x3d')],null))[_0x3e78('0x1a')](respondWithResult(_0x333f26,null))[_0x3e78('0x37')](handleError(_0x333f26,null));};exports[_0x3e78('0x1b')]=function(_0x2e68c0,_0x539238){return db['OpenchannelQueue'][_0x3e78('0x3b')]({'where':{'id':_0x2e68c0[_0x3e78('0x3f')]['id']}})['then'](handleEntityNotFound(_0x539238,null))['then'](removeEntity(_0x539238,null))[_0x3e78('0x37')](handleError(_0x539238,null));};exports['describe']=function(_0x3cf4d7,_0xef720c){return db[_0x3e78('0x34')][_0x3e78('0x40')]()[_0x3e78('0x1a')](respondWithResult(_0xef720c,null))[_0x3e78('0x37')](handleError(_0xef720c,null));};exports['getMembers']=function(_0x5d53c3,_0x3ad16a,_0x3353ff){var _0x49f3d4={'raw':!![],'where':{}},_0x1fbfc1={},_0x5792a1;return db[_0x3e78('0x34')]['findOne']({'where':{'id':_0x5d53c3[_0x3e78('0x3f')]['id']}})[_0x3e78('0x1a')](handleEntityNotFound(_0x3ad16a,null))[_0x3e78('0x1a')](function(_0x2b4695){if(_0x2b4695){_0x5792a1=_0x2b4695[_0x3e78('0x41')]({'plain':!![]});_0x1fbfc1[_0x3e78('0x20')]=_['keys'](db['UserOpenchannelQueue'][_0x3e78('0x39')]);_0x1fbfc1[_0x3e78('0x23')]=_[_0x3e78('0x21')](_0x5d53c3[_0x3e78('0x23')]);_0x1fbfc1[_0x3e78('0x25')]=_[_0x3e78('0x26')](_0x1fbfc1[_0x3e78('0x20')],_0x1fbfc1['query']);_0x49f3d4[_0x3e78('0x27')]=_[_0x3e78('0x26')](_0x1fbfc1['model'],qs['fields'](_0x5d53c3[_0x3e78('0x23')][_0x3e78('0x28')]));_0x49f3d4[_0x3e78('0x27')]=_0x49f3d4[_0x3e78('0x27')][_0x3e78('0x29')]?_0x49f3d4['attributes']:_0x1fbfc1['model'];if(!_0x5d53c3[_0x3e78('0x23')][_0x3e78('0x2a')]('nolimit')){_0x49f3d4[_0x3e78('0x2b')]=qs[_0x3e78('0x2b')](_0x5d53c3[_0x3e78('0x23')][_0x3e78('0x2b')]);_0x49f3d4['offset']=qs[_0x3e78('0x16')](_0x5d53c3[_0x3e78('0x23')][_0x3e78('0x16')]);}_0x49f3d4[_0x3e78('0x2c')]=qs[_0x3e78('0x2d')](_0x5d53c3['query']['sort']);_0x49f3d4[_0x3e78('0x30')]=qs[_0x3e78('0x25')](_[_0x3e78('0x42')](_0x5d53c3[_0x3e78('0x23')],_0x1fbfc1[_0x3e78('0x25')]));_0x49f3d4[_0x3e78('0x30')][_0x3e78('0x43')]=_0x2b4695['id'];if(_0x5d53c3[_0x3e78('0x23')]['filter']){_0x49f3d4['where']=_['merge'](_0x49f3d4[_0x3e78('0x30')],{'$or':_[_0x3e78('0x44')](_0x49f3d4[_0x3e78('0x27')],function(_0x433761){var _0x442d15={};_0x442d15[_0x433761]={'$like':'%'+_0x5d53c3[_0x3e78('0x23')]['filter']+'%'};return _0x442d15;})});}_0x49f3d4=_[_0x3e78('0x2f')]({},_0x49f3d4,_0x5d53c3['options']);return db[_0x3e78('0x45')][_0x3e78('0x35')](_0x49f3d4);}})[_0x3e78('0x1a')](function(_0x5b3992){if(_0x5b3992){return db['User'][_0x3e78('0x46')]({'where':{'id':_[_0x3e78('0x44')](_0x5b3992,'UserId'),'role':_0x3e78('0x47')},'attributes':['id',_0x3e78('0x1e'),_0x3e78('0x48'),_0x3e78('0x49'),'createdAt']});}})['then'](function(_0x10ac55){if(_0x10ac55){return{'count':_0x10ac55[_0x3e78('0x15')],'rows':_[_0x3e78('0x44')](_0x10ac55['rows'],function(_0x301f85){return{'membername':_0x301f85[_0x3e78('0x1e')],'UserId':_0x301f85['id'],'queue_name':_0x5792a1[_0x3e78('0x1e')],'OpenchannelQueueId':_0x5792a1['id'],'interface':util['format'](_0x3e78('0x4a'),_0x3e78('0x4b'),_0x301f85[_0x3e78('0x1e')]),'penalty':0x0,'paused':_0x301f85['openchannelPause'],'createdAt':_0x301f85['createdAt'],'updatedAt':_0x301f85['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x3e78('0x1a')](respondWithFilteredResult(_0x3ad16a,_0x49f3d4))[_0x3e78('0x37')](handleError(_0x3ad16a,null));};exports['getTeams']=function(_0x4624a4,_0x4aab52,_0x4f6296){var _0x34062a={};var _0x5c8c9f={};var _0x3e2dff;var _0x1d3ac2;return db[_0x3e78('0x34')]['findOne']({'where':{'id':_0x4624a4[_0x3e78('0x3f')]['id']}})[_0x3e78('0x1a')](handleEntityNotFound(_0x4aab52,null))[_0x3e78('0x1a')](function(_0x22dabc){if(_0x22dabc){_0x3e2dff=_0x22dabc;_0x5c8c9f[_0x3e78('0x20')]=_[_0x3e78('0x21')](db[_0x3e78('0x4c')][_0x3e78('0x39')]);_0x5c8c9f[_0x3e78('0x23')]=_[_0x3e78('0x21')](_0x4624a4[_0x3e78('0x23')]);_0x5c8c9f['filters']=_[_0x3e78('0x26')](_0x5c8c9f[_0x3e78('0x20')],_0x5c8c9f[_0x3e78('0x23')]);_0x34062a[_0x3e78('0x27')]=_['intersection'](_0x5c8c9f['model'],qs[_0x3e78('0x28')](_0x4624a4[_0x3e78('0x23')]['fields']));_0x34062a[_0x3e78('0x27')]=_0x34062a[_0x3e78('0x27')][_0x3e78('0x29')]?_0x34062a['attributes']:_0x5c8c9f[_0x3e78('0x20')];_0x34062a[_0x3e78('0x2c')]=qs['sort'](_0x4624a4[_0x3e78('0x23')][_0x3e78('0x2d')]);_0x34062a['where']=qs['filters'](_[_0x3e78('0x42')](_0x4624a4['query'],_0x5c8c9f[_0x3e78('0x25')]));if(_0x4624a4['query'][_0x3e78('0x31')]){_0x34062a[_0x3e78('0x30')]=_[_0x3e78('0x2f')](_0x34062a[_0x3e78('0x30')],{'$or':_[_0x3e78('0x44')](_0x34062a[_0x3e78('0x27')],function(_0x25a9f6){var _0x2a581e={};_0x2a581e[_0x25a9f6]={'$like':'%'+_0x4624a4['query'][_0x3e78('0x31')]+'%'};return _0x2a581e;})});}_0x34062a=_['merge']({},_0x34062a,_0x4624a4['options']);return _0x3e2dff[_0x3e78('0x4d')](_0x34062a);}})[_0x3e78('0x1a')](function(_0x14fd19){if(_0x14fd19){_0x1d3ac2=_0x14fd19[_0x3e78('0x29')];if(!_0x4624a4[_0x3e78('0x23')]['hasOwnProperty'](_0x3e78('0x4e'))){_0x34062a[_0x3e78('0x2b')]=qs['limit'](_0x4624a4[_0x3e78('0x23')][_0x3e78('0x2b')]);_0x34062a['offset']=qs[_0x3e78('0x16')](_0x4624a4[_0x3e78('0x23')][_0x3e78('0x16')]);}return _0x3e2dff[_0x3e78('0x4d')](_0x34062a);}})['then'](function(_0x1908fb){if(_0x1908fb){return _0x1908fb?{'count':_0x1d3ac2,'rows':_0x1908fb}:null;}})[_0x3e78('0x1a')](respondWithResult(_0x4aab52,null))[_0x3e78('0x37')](handleError(_0x4aab52,null));};exports['addTeams']=function(_0x26f770,_0x1d30af,_0x4b16ed){var _0x40db71=[];var _0x49f036;return db[_0x3e78('0x4c')]['findAll']({'where':{'id':_0x26f770[_0x3e78('0x3d')][_0x3e78('0x4f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x3e78('0x50'),'attributes':['id'],'raw':!![]}]})[_0x3e78('0x1a')](function(_0x255f9f){if(_0x255f9f){for(var _0x24f605=0x0;_0x24f605<_0x255f9f['length'];_0x24f605+=0x1){for(var _0x8c51f8=0x0;_0x8c51f8<_0x255f9f[_0x24f605][_0x3e78('0x50')][_0x3e78('0x29')];_0x8c51f8+=0x1){_0x40db71=_['union'](_0x40db71,[_0x255f9f[_0x24f605][_0x3e78('0x50')][_0x8c51f8]['id']]);}}return _0x40db71;}})[_0x3e78('0x1a')](function(_0x2cc10e){if(_0x2cc10e){return db[_0x3e78('0x34')][_0x3e78('0x3b')]({'where':{'id':_0x26f770['params']['id']}});}})[_0x3e78('0x1a')](function(_0x295d23){if(_0x295d23){_0x49f036=_0x295d23;return _0x49f036[_0x3e78('0x51')](_0x40db71,{'penalty':_0x26f770['body'][_0x3e78('0x52')]});}})[_0x3e78('0x1a')](function(_0x146880){if(_0x146880){return _0x49f036[_0x3e78('0x53')](_0x26f770[_0x3e78('0x3d')][_0x3e78('0x4f')]);}})['then'](handleEntityNotFound(_0x1d30af,null))[_0x3e78('0x1a')](respondWithStatusCode(_0x1d30af,null))[_0x3e78('0x37')](handleError(_0x1d30af,null));};exports[_0x3e78('0x54')]=function(_0x5e68e1,_0x671934,_0x6e1498){var _0x12f5a4=[];var _0x1fd3f6;return db[_0x3e78('0x4c')][_0x3e78('0x35')]({'where':{'id':_0x5e68e1[_0x3e78('0x23')][_0x3e78('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x3e78('0x55')],'as':_0x3e78('0x50'),'attributes':['id'],'raw':!![]}]})[_0x3e78('0x1a')](function(_0xa05db0){if(_0xa05db0){for(var _0x112acb=0x0;_0x112acb<_0xa05db0[_0x3e78('0x29')];_0x112acb+=0x1){for(var _0xa3ab26=0x0;_0xa3ab26<_0xa05db0[_0x112acb][_0x3e78('0x50')][_0x3e78('0x29')];_0xa3ab26+=0x1){_0x12f5a4=_[_0x3e78('0x56')](_0x12f5a4,[_0xa05db0[_0x112acb]['Agents'][_0xa3ab26]['id']]);}}return _0x12f5a4;}})[_0x3e78('0x1a')](function(_0x2bd08b){if(_0x2bd08b){return db[_0x3e78('0x34')]['find']({'where':{'id':_0x5e68e1['params']['id']}});}})[_0x3e78('0x1a')](function(_0x422c40){if(_0x422c40){_0x1fd3f6=_0x422c40;return _0x1fd3f6[_0x3e78('0x57')](_0x12f5a4);}})[_0x3e78('0x1a')](function(_0x1aa337){if(_0x1fd3f6){return _0x1fd3f6[_0x3e78('0x54')](_0x5e68e1[_0x3e78('0x23')][_0x3e78('0x4f')]);}})[_0x3e78('0x1a')](handleEntityNotFound(_0x671934,null))['then'](respondWithStatusCode(_0x671934,null))['catch'](handleError(_0x671934,null));};exports[_0x3e78('0x51')]=function(_0x30d37b,_0x63e8a1,_0x16ac8e){return db[_0x3e78('0x34')][_0x3e78('0x3b')]({'where':{'id':_0x30d37b[_0x3e78('0x3f')]['id']}})[_0x3e78('0x1a')](handleEntityNotFound(_0x63e8a1,null))[_0x3e78('0x1a')](function(_0x226820){if(_0x226820){return _0x226820[_0x3e78('0x51')](_0x30d37b[_0x3e78('0x3d')][_0x3e78('0x4f')],_['omit'](_0x30d37b[_0x3e78('0x3d')],[_0x3e78('0x4f'),'id'])||{})[_0x3e78('0x58')](function(_0x3f5c54){for(var _0x421152=0x0;_0x421152<_0x30d37b[_0x3e78('0x3d')][_0x3e78('0x4f')][_0x3e78('0x29')];_0x421152+=0x1){socket[_0x3e78('0x59')](_0x3e78('0x5a'),{'UserId':_0x30d37b[_0x3e78('0x3d')][_0x3e78('0x4f')][_0x421152],'OpenchannelQueueId':_0x30d37b[_0x3e78('0x3f')]['id']});}return _0x3f5c54;});}})[_0x3e78('0x1a')](respondWithResult(_0x63e8a1,null))[_0x3e78('0x37')](handleError(_0x63e8a1,null));};exports[_0x3e78('0x57')]=function(_0x494a41,_0x8011b,_0x585275){var _0x3a66b6;return db['OpenchannelQueue'][_0x3e78('0x3b')]({'where':{'id':_0x494a41['params']['id']}})[_0x3e78('0x1a')](handleEntityNotFound(_0x8011b,null))['then'](function(_0xd598e){if(_0xd598e){return _0xd598e[_0x3e78('0x57')](_0x494a41['query'][_0x3e78('0x4f')])[_0x3e78('0x1a')](function(_0x44b1a9){if(_['isArray'](_0x494a41[_0x3e78('0x23')][_0x3e78('0x4f')])){for(var _0x59fa6f=0x0;_0x59fa6f<_0x494a41[_0x3e78('0x23')]['ids'][_0x3e78('0x29')];_0x59fa6f+=0x1){socket['emit'](_0x3e78('0x5b'),{'UserId':_0x494a41[_0x3e78('0x23')][_0x3e78('0x4f')][_0x59fa6f],'OpenchannelQueueId':_0x494a41['params']['id']});}}else{socket[_0x3e78('0x59')](_0x3e78('0x5b'),{'UserId':_0x494a41['query'][_0x3e78('0x4f')],'OpenchannelQueueId':_0x494a41['params']['id']});}});}})['then'](respondWithStatusCode(_0x8011b,null))['catch'](handleError(_0x8011b,null));};exports[_0x3e78('0x5c')]=function(_0x3741e8,_0x2c8e4f,_0x2daf2a){var _0x3d549d={};var _0x3caa92={};var _0x46bc9c;var _0xba0016;return db[_0x3e78('0x34')][_0x3e78('0x5d')]({'where':{'id':_0x3741e8[_0x3e78('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c8e4f,null))[_0x3e78('0x1a')](function(_0x8cc795){if(_0x8cc795){_0x46bc9c=_0x8cc795;_0x3caa92[_0x3e78('0x20')]=_[_0x3e78('0x21')](db[_0x3e78('0x55')][_0x3e78('0x39')]);_0x3caa92['query']=_[_0x3e78('0x21')](_0x3741e8[_0x3e78('0x23')]);_0x3caa92[_0x3e78('0x25')]=_[_0x3e78('0x26')](_0x3caa92['model'],_0x3caa92[_0x3e78('0x23')]);_0x3d549d['attributes']=_['intersection'](_0x3caa92['model'],qs[_0x3e78('0x28')](_0x3741e8['query'][_0x3e78('0x28')]));_0x3d549d[_0x3e78('0x27')]=_0x3d549d[_0x3e78('0x27')][_0x3e78('0x29')]?_0x3d549d[_0x3e78('0x27')]:_0x3caa92[_0x3e78('0x20')];_0x3d549d['order']=qs[_0x3e78('0x2d')](_0x3741e8[_0x3e78('0x23')][_0x3e78('0x2d')]);_0x3d549d[_0x3e78('0x30')]=qs['filters'](_['pick'](_0x3741e8['query'],_0x3caa92[_0x3e78('0x25')]));if(_0x3741e8[_0x3e78('0x23')][_0x3e78('0x31')]){_0x3d549d[_0x3e78('0x30')]=_[_0x3e78('0x2f')](_0x3d549d[_0x3e78('0x30')],{'$or':_['map'](_0x3d549d['attributes'],function(_0xbb0cc7){var _0x8b706={};_0x8b706[_0xbb0cc7]={'$like':'%'+_0x3741e8[_0x3e78('0x23')][_0x3e78('0x31')]+'%'};return _0x8b706;})});}_0x3d549d=_[_0x3e78('0x2f')]({},_0x3d549d,_0x3741e8['options']);return _0x46bc9c[_0x3e78('0x5c')](_0x3d549d);}})[_0x3e78('0x1a')](function(_0x5b60e9){if(_0x5b60e9){_0xba0016=_0x5b60e9[_0x3e78('0x29')];if(!_0x3741e8[_0x3e78('0x23')]['hasOwnProperty'](_0x3e78('0x4e'))){_0x3d549d[_0x3e78('0x2b')]=qs[_0x3e78('0x2b')](_0x3741e8[_0x3e78('0x23')][_0x3e78('0x2b')]);_0x3d549d[_0x3e78('0x16')]=qs['offset'](_0x3741e8[_0x3e78('0x23')][_0x3e78('0x16')]);}return _0x46bc9c[_0x3e78('0x5c')](_0x3d549d);}})[_0x3e78('0x1a')](function(_0x439b0f){if(_0x439b0f){return _0x439b0f?{'count':_0xba0016,'rows':_0x439b0f}:null;}})['then'](respondWithResult(_0x2c8e4f,null))[_0x3e78('0x37')](handleError(_0x2c8e4f,null));}; \ No newline at end of file +var _0xf67f=['show','params','options','find','create','body','describe','getMembers','findOne','get','UserOpenchannelQueue','nolimit','pick','OpenchannelQueueId','User','findAndCountAll','UserId','agent','createdAt','format','openchannelPause','Team','order','getTeams','addTeams','Agents','union','penalty','removeTeams','ids','removeAgents','addAgents','omit','spread','userOpenchannelQueue:save','emit','userOpenchannelQueue:remove','getAgents','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','OpenchannelQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','sort','add','day','merge','filter','where','map','includeAll','include','findAll','rows','catch'];(function(_0x4c67a0,_0xd23c09){var _0x22c2f0=function(_0x754326){while(--_0x754326){_0x4c67a0['push'](_0x4c67a0['shift']());}};_0x22c2f0(++_0xd23c09);}(_0xf67f,0x8d));var _0xff67=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0xf67f[_0x55e059];return _0x1e6bb7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xff67('0x0'));var moment=require(_0xff67('0x1'));var BPromise=require(_0xff67('0x2'));var Mustache=require('mustache');var util=require(_0xff67('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xff67('0x4'));var ejs=require(_0xff67('0x5'));var fs=require('fs');var _=require(_0xff67('0x6'));var squel=require(_0xff67('0x7'));var crypto=require(_0xff67('0x8'));var jsforce=require(_0xff67('0x9'));var deskjs=require(_0xff67('0xa'));var toCsv=require(_0xff67('0x4'));var querystring=require('querystring');var Papa=require(_0xff67('0xb'));var qs=require(_0xff67('0xc'));var logger=require(_0xff67('0xd'))(_0xff67('0xe'));var utils=require(_0xff67('0xf'));var config=require(_0xff67('0x10'));var db=require(_0xff67('0x11'))['db'];var socket=require(_0xff67('0x12'))({'host':_0xff67('0x13'),'port':0x18eb});require('./openchannelQueue.socket')[_0xff67('0x14')](socket);function respondWithStatusCode(_0x2ff777,_0x5bb8f5){_0x5bb8f5=_0x5bb8f5||0xcc;return function(_0x2676fb){if(_0x2676fb){return _0x2ff777['sendStatus'](_0x5bb8f5);}return _0x2ff777[_0xff67('0x15')](_0x5bb8f5)[_0xff67('0x16')]();};}function respondWithResult(_0x31d0c3,_0x476caa){_0x476caa=_0x476caa||0xc8;return function(_0x17d7fe){if(_0x17d7fe){return _0x31d0c3[_0xff67('0x15')](_0x476caa)['json'](_0x17d7fe);}};}function respondWithFilteredResult(_0x542af9,_0xd111e5){return function(_0x4378ea){if(_0x4378ea){var _0x471576=_0x4378ea[_0xff67('0x17')],_0x17fe1a=_0xd111e5['offset'],_0x34c8c9=_0xd111e5[_0xff67('0x18')]+_0xd111e5[_0xff67('0x19')],_0x59ff9c;if(_0x34c8c9>=_0x471576){_0x34c8c9=_0x471576;_0x59ff9c=0xc8;}else{_0x59ff9c=0xce;}_0x542af9[_0xff67('0x15')](_0x59ff9c);return _0x542af9[_0xff67('0x1a')](_0xff67('0x1b'),_0x17fe1a+'-'+_0x34c8c9+'/'+_0x471576)[_0xff67('0x1c')](_0x4378ea);}return null;};}function patchUpdates(_0xc99647){return function(_0x596a93){try{jsonpatch[_0xff67('0x1d')](_0x596a93,_0xc99647,!![]);}catch(_0x282cf3){return BPromise[_0xff67('0x1e')](_0x282cf3);}return _0x596a93[_0xff67('0x1f')]();};}function saveUpdates(_0x178308,_0x2cf95b){return function(_0x57f299){if(_0x57f299){return _0x57f299[_0xff67('0x20')](_0x178308)[_0xff67('0x21')](function(_0x4a7db2){return _0x4a7db2;});}return null;};}function removeEntity(_0x518ee7,_0x30cdcf){return function(_0x44d37f){if(_0x44d37f){return _0x44d37f[_0xff67('0x22')]()[_0xff67('0x21')](function(){_0x518ee7[_0xff67('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16594b,_0x25dd92){return function(_0x5959ce){if(!_0x5959ce){_0x16594b[_0xff67('0x23')](0x194);}return _0x5959ce;};}function handleError(_0x5c2db2,_0x3a3460){_0x3a3460=_0x3a3460||0x1f4;return function(_0x469a1a){logger[_0xff67('0x24')](_0x469a1a['stack']);if(_0x469a1a[_0xff67('0x25')]){delete _0x469a1a['name'];}_0x5c2db2[_0xff67('0x15')](_0x3a3460)[_0xff67('0x26')](_0x469a1a);};}exports[_0xff67('0x27')]=function(_0x4d1b59,_0x1b4f8b){var _0x151bef={},_0x1b5bc1={},_0x4d4a7e={'count':0x0,'rows':[]};var _0x1002bb=db[_0xff67('0x28')][_0xff67('0x29')];_0x1b5bc1[_0xff67('0x2a')]=_[_0xff67('0x2b')](_0x1002bb);var _0x291326={'dateStart':_0x4d1b59[_0xff67('0x2c')][_0xff67('0x2d')],'dateEnd':_0x4d1b59[_0xff67('0x2c')][_0xff67('0x2e')]};delete _0x4d1b59[_0xff67('0x2c')][_0xff67('0x2d')];delete _0x4d1b59[_0xff67('0x2c')][_0xff67('0x2e')];_0x1b5bc1[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4d1b59['query']);_0x1b5bc1[_0xff67('0x2f')]=_['intersection'](_0x1b5bc1[_0xff67('0x2a')],_0x1b5bc1[_0xff67('0x2c')]);_0x151bef['attributes']=_[_0xff67('0x30')](_0x1b5bc1[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x31')]));_0x151bef[_0xff67('0x32')]=_0x151bef[_0xff67('0x32')][_0xff67('0x33')]?_0x151bef[_0xff67('0x32')]:_0x1b5bc1[_0xff67('0x2a')];if(!_0x4d1b59[_0xff67('0x2c')][_0xff67('0x34')]('nolimit')){_0x151bef['limit']=qs[_0xff67('0x19')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x19')]);_0x151bef[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x18')]);}_0x151bef['order']=qs[_0xff67('0x35')](_0x4d1b59[_0xff67('0x2c')][_0xff67('0x35')]);_0x151bef['where']=qs[_0xff67('0x2f')](_['pick'](_0x4d1b59[_0xff67('0x2c')],_0x1b5bc1['filters']));if(_0x291326['dateStart']){if(_0x291326[_0xff67('0x2e')]){_0x291326['dateEnd']=moment(_0x291326['dateEnd'])['add'](0x1,'day');}else{_0x291326[_0xff67('0x2e')]=moment(_0x291326[_0xff67('0x2d')])[_0xff67('0x36')](0x1,_0xff67('0x37'));}_[_0xff67('0x38')](_0x151bef['where'],{'createdAt':{'$gte':_0x291326[_0xff67('0x2d')],'$lte':_0x291326['dateEnd']}});}if(_0x4d1b59['query'][_0xff67('0x39')]){_0x151bef[_0xff67('0x3a')]=_[_0xff67('0x38')](_0x151bef['where'],{'$or':_[_0xff67('0x3b')](_0x151bef[_0xff67('0x32')],function(_0x5757d0){var _0x3c32db={};_0x3c32db[_0x5757d0]={'$like':'%'+_0x4d1b59['query'][_0xff67('0x39')]+'%'};return _0x3c32db;})});}_0x151bef=_[_0xff67('0x38')]({},_0x151bef,_0x4d1b59['options']);var _0x433e1c={'where':_0x151bef[_0xff67('0x3a')]};return db['OpenchannelQueue'][_0xff67('0x17')](_0x433e1c)[_0xff67('0x21')](function(_0x2b47b4){_0x4d4a7e[_0xff67('0x17')]=_0x2b47b4;if(_0x4d1b59[_0xff67('0x2c')][_0xff67('0x3c')]){_0x151bef[_0xff67('0x3d')]=[{'all':!![]}];}return db[_0xff67('0x28')][_0xff67('0x3e')](_0x151bef);})[_0xff67('0x21')](function(_0x44e3e6){_0x4d4a7e[_0xff67('0x3f')]=_0x44e3e6;return _0x4d4a7e;})[_0xff67('0x21')](respondWithFilteredResult(_0x1b4f8b,_0x151bef))[_0xff67('0x40')](handleError(_0x1b4f8b,null));};exports[_0xff67('0x41')]=function(_0x1d51a6,_0x5eb379){var _0x47d976={'raw':!![],'where':{'id':_0x1d51a6[_0xff67('0x42')]['id']}},_0x12e8e9={};_0x12e8e9[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x28')][_0xff67('0x29')]);_0x12e8e9[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x1d51a6[_0xff67('0x2c')]);_0x12e8e9[_0xff67('0x2f')]=_[_0xff67('0x30')](_0x12e8e9['model'],_0x12e8e9[_0xff67('0x2c')]);_0x47d976[_0xff67('0x32')]=_['intersection'](_0x12e8e9[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x1d51a6[_0xff67('0x2c')][_0xff67('0x31')]));_0x47d976[_0xff67('0x32')]=_0x47d976['attributes'][_0xff67('0x33')]?_0x47d976[_0xff67('0x32')]:_0x12e8e9[_0xff67('0x2a')];if(_0x1d51a6[_0xff67('0x2c')]['includeAll']){_0x47d976[_0xff67('0x3d')]=[{'all':!![]}];}_0x47d976=_[_0xff67('0x38')]({},_0x47d976,_0x1d51a6[_0xff67('0x43')]);return db[_0xff67('0x28')][_0xff67('0x44')](_0x47d976)['then'](handleEntityNotFound(_0x5eb379,null))[_0xff67('0x21')](respondWithResult(_0x5eb379,null))[_0xff67('0x40')](handleError(_0x5eb379,null));};exports[_0xff67('0x45')]=function(_0x41ed56,_0x58a21d){return db['OpenchannelQueue'][_0xff67('0x45')](_0x41ed56[_0xff67('0x46')],{})[_0xff67('0x21')](respondWithResult(_0x58a21d,0xc9))[_0xff67('0x40')](handleError(_0x58a21d,null));};exports[_0xff67('0x20')]=function(_0x4eb99d,_0x1f3ffd){if(_0x4eb99d[_0xff67('0x46')]['id']){delete _0x4eb99d[_0xff67('0x46')]['id'];}return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x4eb99d[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x1f3ffd,null))[_0xff67('0x21')](saveUpdates(_0x4eb99d['body'],null))[_0xff67('0x21')](respondWithResult(_0x1f3ffd,null))[_0xff67('0x40')](handleError(_0x1f3ffd,null));};exports['destroy']=function(_0x1e913a,_0x1eddbc){return db[_0xff67('0x28')]['find']({'where':{'id':_0x1e913a['params']['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x1eddbc,null))[_0xff67('0x21')](removeEntity(_0x1eddbc,null))[_0xff67('0x40')](handleError(_0x1eddbc,null));};exports[_0xff67('0x47')]=function(_0x27b76a,_0x34b40c){return db[_0xff67('0x28')]['describe']()[_0xff67('0x21')](respondWithResult(_0x34b40c,null))[_0xff67('0x40')](handleError(_0x34b40c,null));};exports[_0xff67('0x48')]=function(_0x4fc72a,_0xe6d6ef,_0x2741c9){var _0xeeed17={'raw':!![],'where':{}},_0x190e51={},_0x216256;return db['OpenchannelQueue'][_0xff67('0x49')]({'where':{'id':_0x4fc72a[_0xff67('0x42')]['id']}})['then'](handleEntityNotFound(_0xe6d6ef,null))['then'](function(_0xcbbb3f){if(_0xcbbb3f){_0x216256=_0xcbbb3f[_0xff67('0x4a')]({'plain':!![]});_0x190e51[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x4b')][_0xff67('0x29')]);_0x190e51[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4fc72a[_0xff67('0x2c')]);_0x190e51['filters']=_[_0xff67('0x30')](_0x190e51['model'],_0x190e51[_0xff67('0x2c')]);_0xeeed17[_0xff67('0x32')]=_[_0xff67('0x30')](_0x190e51[_0xff67('0x2a')],qs['fields'](_0x4fc72a[_0xff67('0x2c')]['fields']));_0xeeed17['attributes']=_0xeeed17[_0xff67('0x32')][_0xff67('0x33')]?_0xeeed17[_0xff67('0x32')]:_0x190e51[_0xff67('0x2a')];if(!_0x4fc72a[_0xff67('0x2c')][_0xff67('0x34')](_0xff67('0x4c'))){_0xeeed17[_0xff67('0x19')]=qs['limit'](_0x4fc72a[_0xff67('0x2c')]['limit']);_0xeeed17[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4fc72a[_0xff67('0x2c')]['offset']);}_0xeeed17['order']=qs[_0xff67('0x35')](_0x4fc72a[_0xff67('0x2c')]['sort']);_0xeeed17['where']=qs[_0xff67('0x2f')](_[_0xff67('0x4d')](_0x4fc72a['query'],_0x190e51[_0xff67('0x2f')]));_0xeeed17[_0xff67('0x3a')][_0xff67('0x4e')]=_0xcbbb3f['id'];if(_0x4fc72a[_0xff67('0x2c')][_0xff67('0x39')]){_0xeeed17[_0xff67('0x3a')]=_['merge'](_0xeeed17[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0xeeed17[_0xff67('0x32')],function(_0x11ecd2){var _0x1a6f71={};_0x1a6f71[_0x11ecd2]={'$like':'%'+_0x4fc72a[_0xff67('0x2c')][_0xff67('0x39')]+'%'};return _0x1a6f71;})});}_0xeeed17=_[_0xff67('0x38')]({},_0xeeed17,_0x4fc72a[_0xff67('0x43')]);return db[_0xff67('0x4b')]['findAll'](_0xeeed17);}})['then'](function(_0x201c47){if(_0x201c47){return db[_0xff67('0x4f')][_0xff67('0x50')]({'where':{'id':_[_0xff67('0x3b')](_0x201c47,_0xff67('0x51')),'role':_0xff67('0x52')},'attributes':['id',_0xff67('0x25'),'openchannelPause','updatedAt',_0xff67('0x53')]});}})[_0xff67('0x21')](function(_0x231888){if(_0x231888){return{'count':_0x231888[_0xff67('0x17')],'rows':_[_0xff67('0x3b')](_0x231888[_0xff67('0x3f')],function(_0x24287c){return{'membername':_0x24287c[_0xff67('0x25')],'UserId':_0x24287c['id'],'queue_name':_0x216256[_0xff67('0x25')],'OpenchannelQueueId':_0x216256['id'],'interface':util[_0xff67('0x54')]('%s/%s','SIP',_0x24287c[_0xff67('0x25')]),'penalty':0x0,'paused':_0x24287c[_0xff67('0x55')],'createdAt':_0x24287c['createdAt'],'updatedAt':_0x24287c['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xff67('0x21')](respondWithFilteredResult(_0xe6d6ef,_0xeeed17))[_0xff67('0x40')](handleError(_0xe6d6ef,null));};exports['getTeams']=function(_0x4a45ac,_0x1be698,_0x4dab47){var _0x4eef57={};var _0x4280fb={};var _0x262066;var _0x20276d;return db[_0xff67('0x28')]['findOne']({'where':{'id':_0x4a45ac['params']['id']}})['then'](handleEntityNotFound(_0x1be698,null))['then'](function(_0x4e44d8){if(_0x4e44d8){_0x262066=_0x4e44d8;_0x4280fb[_0xff67('0x2a')]=_[_0xff67('0x2b')](db[_0xff67('0x56')][_0xff67('0x29')]);_0x4280fb[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x4a45ac['query']);_0x4280fb[_0xff67('0x2f')]=_['intersection'](_0x4280fb[_0xff67('0x2a')],_0x4280fb[_0xff67('0x2c')]);_0x4eef57[_0xff67('0x32')]=_[_0xff67('0x30')](_0x4280fb[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x4a45ac[_0xff67('0x2c')][_0xff67('0x31')]));_0x4eef57['attributes']=_0x4eef57[_0xff67('0x32')][_0xff67('0x33')]?_0x4eef57[_0xff67('0x32')]:_0x4280fb['model'];_0x4eef57[_0xff67('0x57')]=qs[_0xff67('0x35')](_0x4a45ac['query'][_0xff67('0x35')]);_0x4eef57[_0xff67('0x3a')]=qs[_0xff67('0x2f')](_['pick'](_0x4a45ac['query'],_0x4280fb[_0xff67('0x2f')]));if(_0x4a45ac[_0xff67('0x2c')][_0xff67('0x39')]){_0x4eef57[_0xff67('0x3a')]=_['merge'](_0x4eef57[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0x4eef57[_0xff67('0x32')],function(_0x1bd4bd){var _0xd001b2={};_0xd001b2[_0x1bd4bd]={'$like':'%'+_0x4a45ac[_0xff67('0x2c')]['filter']+'%'};return _0xd001b2;})});}_0x4eef57=_[_0xff67('0x38')]({},_0x4eef57,_0x4a45ac['options']);return _0x262066[_0xff67('0x58')](_0x4eef57);}})[_0xff67('0x21')](function(_0x27e5fd){if(_0x27e5fd){_0x20276d=_0x27e5fd[_0xff67('0x33')];if(!_0x4a45ac[_0xff67('0x2c')]['hasOwnProperty'](_0xff67('0x4c'))){_0x4eef57[_0xff67('0x19')]=qs[_0xff67('0x19')](_0x4a45ac[_0xff67('0x2c')][_0xff67('0x19')]);_0x4eef57[_0xff67('0x18')]=qs[_0xff67('0x18')](_0x4a45ac[_0xff67('0x2c')]['offset']);}return _0x262066[_0xff67('0x58')](_0x4eef57);}})['then'](function(_0x3d3a6d){if(_0x3d3a6d){return _0x3d3a6d?{'count':_0x20276d,'rows':_0x3d3a6d}:null;}})['then'](respondWithResult(_0x1be698,null))[_0xff67('0x40')](handleError(_0x1be698,null));};exports[_0xff67('0x59')]=function(_0x137fab,_0x236bdc,_0x3a96d5){var _0x2d94de=[];var _0x26acf5;return db[_0xff67('0x56')][_0xff67('0x3e')]({'where':{'id':_0x137fab[_0xff67('0x46')]['ids']},'attributes':['id'],'include':[{'model':db[_0xff67('0x4f')],'as':_0xff67('0x5a'),'attributes':['id'],'raw':!![]}]})[_0xff67('0x21')](function(_0x2206eb){if(_0x2206eb){for(var _0x373a91=0x0;_0x373a91<_0x2206eb['length'];_0x373a91+=0x1){for(var _0x1b8d8b=0x0;_0x1b8d8b<_0x2206eb[_0x373a91]['Agents']['length'];_0x1b8d8b+=0x1){_0x2d94de=_[_0xff67('0x5b')](_0x2d94de,[_0x2206eb[_0x373a91][_0xff67('0x5a')][_0x1b8d8b]['id']]);}}return _0x2d94de;}})[_0xff67('0x21')](function(_0xe9dea3){if(_0xe9dea3){return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x137fab[_0xff67('0x42')]['id']}});}})[_0xff67('0x21')](function(_0x5bfff7){if(_0x5bfff7){_0x26acf5=_0x5bfff7;return _0x26acf5['addAgents'](_0x2d94de,{'penalty':_0x137fab[_0xff67('0x46')][_0xff67('0x5c')]});}})[_0xff67('0x21')](function(_0x59d76b){if(_0x59d76b){return _0x26acf5[_0xff67('0x59')](_0x137fab[_0xff67('0x46')]['ids']);}})[_0xff67('0x21')](handleEntityNotFound(_0x236bdc,null))[_0xff67('0x21')](respondWithStatusCode(_0x236bdc,null))[_0xff67('0x40')](handleError(_0x236bdc,null));};exports[_0xff67('0x5d')]=function(_0x290633,_0x284395,_0x1f4b38){var _0x12a2ae=[];var _0x5ebb4a;return db[_0xff67('0x56')][_0xff67('0x3e')]({'where':{'id':_0x290633[_0xff67('0x2c')][_0xff67('0x5e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xff67('0x5a'),'attributes':['id'],'raw':!![]}]})[_0xff67('0x21')](function(_0x5c8399){if(_0x5c8399){for(var _0x2df2b5=0x0;_0x2df2b5<_0x5c8399['length'];_0x2df2b5+=0x1){for(var _0x1c4e1b=0x0;_0x1c4e1b<_0x5c8399[_0x2df2b5][_0xff67('0x5a')][_0xff67('0x33')];_0x1c4e1b+=0x1){_0x12a2ae=_[_0xff67('0x5b')](_0x12a2ae,[_0x5c8399[_0x2df2b5]['Agents'][_0x1c4e1b]['id']]);}}return _0x12a2ae;}})[_0xff67('0x21')](function(_0x485627){if(_0x485627){return db[_0xff67('0x28')][_0xff67('0x44')]({'where':{'id':_0x290633[_0xff67('0x42')]['id']}});}})[_0xff67('0x21')](function(_0x58a99f){if(_0x58a99f){_0x5ebb4a=_0x58a99f;return _0x5ebb4a[_0xff67('0x5f')](_0x12a2ae);}})[_0xff67('0x21')](function(_0x191dbd){if(_0x5ebb4a){return _0x5ebb4a[_0xff67('0x5d')](_0x290633[_0xff67('0x2c')][_0xff67('0x5e')]);}})['then'](handleEntityNotFound(_0x284395,null))[_0xff67('0x21')](respondWithStatusCode(_0x284395,null))['catch'](handleError(_0x284395,null));};exports[_0xff67('0x60')]=function(_0x1570e2,_0x20b435,_0xe24e2b){return db['OpenchannelQueue'][_0xff67('0x44')]({'where':{'id':_0x1570e2[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x20b435,null))[_0xff67('0x21')](function(_0x3678f1){if(_0x3678f1){return _0x3678f1[_0xff67('0x60')](_0x1570e2[_0xff67('0x46')][_0xff67('0x5e')],_[_0xff67('0x61')](_0x1570e2[_0xff67('0x46')],[_0xff67('0x5e'),'id'])||{})[_0xff67('0x62')](function(_0x5a2fbf){for(var _0x35d245=0x0;_0x35d245<_0x1570e2['body']['ids']['length'];_0x35d245+=0x1){socket['emit'](_0xff67('0x63'),{'UserId':_0x1570e2['body'][_0xff67('0x5e')][_0x35d245],'OpenchannelQueueId':_0x1570e2[_0xff67('0x42')]['id']});}return _0x5a2fbf;});}})[_0xff67('0x21')](respondWithResult(_0x20b435,null))[_0xff67('0x40')](handleError(_0x20b435,null));};exports[_0xff67('0x5f')]=function(_0x4b8154,_0x5d5635,_0x534d8c){var _0x5152f6;return db[_0xff67('0x28')][_0xff67('0x44')]({'where':{'id':_0x4b8154[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0x5d5635,null))['then'](function(_0x50051a){if(_0x50051a){return _0x50051a[_0xff67('0x5f')](_0x4b8154[_0xff67('0x2c')]['ids'])[_0xff67('0x21')](function(_0x126229){if(_['isArray'](_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')])){for(var _0x163615=0x0;_0x163615<_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')]['length'];_0x163615+=0x1){socket[_0xff67('0x64')](_0xff67('0x65'),{'UserId':_0x4b8154[_0xff67('0x2c')]['ids'][_0x163615],'OpenchannelQueueId':_0x4b8154['params']['id']});}}else{socket['emit'](_0xff67('0x65'),{'UserId':_0x4b8154[_0xff67('0x2c')][_0xff67('0x5e')],'OpenchannelQueueId':_0x4b8154['params']['id']});}});}})[_0xff67('0x21')](respondWithStatusCode(_0x5d5635,null))[_0xff67('0x40')](handleError(_0x5d5635,null));};exports['getAgents']=function(_0x435d6f,_0xf82d3e,_0x2e5d34){var _0x23297a={};var _0x27a65f={};var _0x524a1f;var _0x506ab5;return db[_0xff67('0x28')][_0xff67('0x49')]({'where':{'id':_0x435d6f[_0xff67('0x42')]['id']}})[_0xff67('0x21')](handleEntityNotFound(_0xf82d3e,null))[_0xff67('0x21')](function(_0x34a865){if(_0x34a865){_0x524a1f=_0x34a865;_0x27a65f['model']=_['keys'](db[_0xff67('0x4f')][_0xff67('0x29')]);_0x27a65f[_0xff67('0x2c')]=_[_0xff67('0x2b')](_0x435d6f['query']);_0x27a65f[_0xff67('0x2f')]=_['intersection'](_0x27a65f[_0xff67('0x2a')],_0x27a65f[_0xff67('0x2c')]);_0x23297a[_0xff67('0x32')]=_[_0xff67('0x30')](_0x27a65f[_0xff67('0x2a')],qs[_0xff67('0x31')](_0x435d6f[_0xff67('0x2c')]['fields']));_0x23297a['attributes']=_0x23297a[_0xff67('0x32')][_0xff67('0x33')]?_0x23297a[_0xff67('0x32')]:_0x27a65f['model'];_0x23297a[_0xff67('0x57')]=qs[_0xff67('0x35')](_0x435d6f[_0xff67('0x2c')][_0xff67('0x35')]);_0x23297a[_0xff67('0x3a')]=qs['filters'](_[_0xff67('0x4d')](_0x435d6f[_0xff67('0x2c')],_0x27a65f[_0xff67('0x2f')]));if(_0x435d6f[_0xff67('0x2c')][_0xff67('0x39')]){_0x23297a[_0xff67('0x3a')]=_['merge'](_0x23297a[_0xff67('0x3a')],{'$or':_[_0xff67('0x3b')](_0x23297a[_0xff67('0x32')],function(_0x328719){var _0x1bb7de={};_0x1bb7de[_0x328719]={'$like':'%'+_0x435d6f[_0xff67('0x2c')][_0xff67('0x39')]+'%'};return _0x1bb7de;})});}_0x23297a=_['merge']({},_0x23297a,_0x435d6f[_0xff67('0x43')]);return _0x524a1f[_0xff67('0x66')](_0x23297a);}})[_0xff67('0x21')](function(_0x4e670b){if(_0x4e670b){_0x506ab5=_0x4e670b[_0xff67('0x33')];if(!_0x435d6f[_0xff67('0x2c')]['hasOwnProperty'](_0xff67('0x4c'))){_0x23297a[_0xff67('0x19')]=qs[_0xff67('0x19')](_0x435d6f[_0xff67('0x2c')]['limit']);_0x23297a[_0xff67('0x18')]=qs['offset'](_0x435d6f[_0xff67('0x2c')][_0xff67('0x18')]);}return _0x524a1f[_0xff67('0x66')](_0x23297a);}})[_0xff67('0x21')](function(_0x1a9544){if(_0x1a9544){return _0x1a9544?{'count':_0x506ab5,'rows':_0x1a9544}:null;}})[_0xff67('0x21')](respondWithResult(_0xf82d3e,null))[_0xff67('0x40')](handleError(_0xf82d3e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b508613..33252ca 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 _0x79ad=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x28f560,_0x285464){var _0x5c1ef5=function(_0x162aad){while(--_0x162aad){_0x28f560['push'](_0x28f560['shift']());}};_0x5c1ef5(++_0x285464);}(_0x79ad,0x77));var _0xd79a=function(_0x2799a3,_0x3bac20){_0x2799a3=_0x2799a3-0x0;var _0x77d0c1=_0x79ad[_0x2799a3];return _0x77d0c1;};'use strict';var EventEmitter=require(_0xd79a('0x0'));var OpenchannelQueue=require(_0xd79a('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xd79a('0x2')](0x0);var events={'afterCreate':_0xd79a('0x3'),'afterUpdate':_0xd79a('0x4'),'afterDestroy':_0xd79a('0x5')};function emitEvent(_0x28395d){return function(_0x1f6731,_0x195c7b,_0x13ed9e){OpenchannelQueueEvents[_0xd79a('0x6')](_0x28395d+':'+_0x1f6731['id'],_0x1f6731);OpenchannelQueueEvents[_0xd79a('0x6')](_0x28395d,_0x1f6731);_0x13ed9e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xd79a('0x7')](e,emitEvent(event));}}module[_0xd79a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x8784=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3c938b,_0x50aca4){var _0x2077c0=function(_0x412dbb){while(--_0x412dbb){_0x3c938b['push'](_0x3c938b['shift']());}};_0x2077c0(++_0x50aca4);}(_0x8784,0x1c8));var _0x4878=function(_0x33593e,_0x22ddd3){_0x33593e=_0x33593e-0x0;var _0x53db1a=_0x8784[_0x33593e];return _0x53db1a;};'use strict';var EventEmitter=require(_0x4878('0x0'));var OpenchannelQueue=require(_0x4878('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4878('0x2'),'afterDestroy':_0x4878('0x3')};function emitEvent(_0x48fa63){return function(_0x50faf9,_0x18a6e6,_0x2ecd00){OpenchannelQueueEvents[_0x4878('0x4')](_0x48fa63+':'+_0x50faf9['id'],_0x50faf9);OpenchannelQueueEvents['emit'](_0x48fa63,_0x50faf9);_0x2ecd00(null);};}for(var e in events){if(events[_0x4878('0x5')](e)){var event=events[e];OpenchannelQueue[_0x4878('0x6')](e,emitEvent(event));}}module[_0x4878('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 f765d96..0e1fa99 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 _0x593e=['request-promise','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x593e,0xcb));var _0xe593=function(_0x130d97,_0x43a7ad){_0x130d97=_0x130d97-0x0;var _0x40f6a4=_0x593e[_0x130d97];return _0x40f6a4;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var logger=require(_0xe593('0x2'))(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var rp=require(_0xe593('0x6'));var attributes=require(_0xe593('0x7'));module['exports']=function(_0x8a87e8,_0x2475f5){return _0x8a87e8[_0xe593('0x8')](_0xe593('0x9'),attributes,{'tableName':_0xe593('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f7a=['openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x115551,_0x50f4fe){var _0x170d93=function(_0x1318b5){while(--_0x1318b5){_0x115551['push'](_0x115551['shift']());}};_0x170d93(++_0x50f4fe);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3539e0,_0x627f0e){_0x3539e0=_0x3539e0-0x0;var _0x48942f=_0x6f7a[_0x3539e0];return _0x48942f;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var logger=require(_0xa6f7('0x2'))(_0xa6f7('0x3'));var moment=require('moment');var BPromise=require(_0xa6f7('0x4'));var rp=require(_0xa6f7('0x5'));var attributes=require(_0xa6f7('0x6'));module[_0xa6f7('0x7')]=function(_0x22e529,_0x1f5922){return _0x22e529[_0xa6f7('0x8')](_0xa6f7('0x9'),attributes,{'tableName':_0xa6f7('0xa'),'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 1e41b38..dfde790 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 _0xe809=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','register','then','info','OpenchannelQueue,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x21f927,_0x4f6297){var _0x131a2f=function(_0x49d7d7){while(--_0x49d7d7){_0x21f927['push'](_0x21f927['shift']());}};_0x131a2f(++_0x4f6297);}(_0xe809,0xb9));var _0x9e80=function(_0x65f883,_0xa8fff6){_0x65f883=_0x65f883-0x0;var _0x5c765e=_0xe809[_0x65f883];return _0x5c765e;};'use strict';var _=require(_0x9e80('0x0'));var util=require(_0x9e80('0x1'));var moment=require(_0x9e80('0x2'));var BPromise=require(_0x9e80('0x3'));var rs=require(_0x9e80('0x4'));var fs=require('fs');var db=require(_0x9e80('0x5'))['db'];var utils=require(_0x9e80('0x6'));var logger=require(_0x9e80('0x7'))(_0x9e80('0x8'));var config=require(_0x9e80('0x9'));var jayson=require(_0x9e80('0xa'));var client=jayson[_0x9e80('0xb')][_0x9e80('0xc')]({'port':0x232a});var socket=require(_0x9e80('0xd'))({'host':_0x9e80('0xe'),'port':0x18eb});require('./openchannelQueue.socket')[_0x9e80('0xf')](socket);function respondWithRpcPromise(_0x41476a,_0x48a82a,_0x46ed7b){return new BPromise(function(_0x3dea24,_0x2290e1){return client['request'](_0x41476a,_0x46ed7b)[_0x9e80('0x10')](function(_0x4405e1){logger[_0x9e80('0x11')](_0x9e80('0x12'),_0x48a82a,'request\x20sent');logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x48a82a,'request\x20sent',JSON[_0x9e80('0x13')](_0x4405e1));if(_0x4405e1[_0x9e80('0x14')]){if(_0x4405e1[_0x9e80('0x14')][_0x9e80('0x15')]===0x1f4){logger[_0x9e80('0x14')](_0x9e80('0x12'),_0x48a82a,_0x4405e1[_0x9e80('0x14')][_0x9e80('0x16')]);return _0x2290e1(_0x4405e1[_0x9e80('0x14')]['message']);}logger[_0x9e80('0x14')](_0x9e80('0x12'),_0x48a82a,_0x4405e1['error'][_0x9e80('0x16')]);return _0x3dea24(_0x4405e1[_0x9e80('0x14')][_0x9e80('0x16')]);}else{logger['info'](_0x9e80('0x12'),_0x48a82a,_0x9e80('0x17'));_0x3dea24(_0x4405e1[_0x9e80('0x18')][_0x9e80('0x16')]);}})[_0x9e80('0x19')](function(_0x34c98a){logger[_0x9e80('0x14')](_0x9e80('0x12'),_0x48a82a,_0x34c98a);_0x2290e1(_0x34c98a);});});}exports[_0x9e80('0x1a')]=function(_0x1ddee0){var _0x3d43e5=this;return new Promise(function(_0x4b7862,_0x4be802){return db[_0x9e80('0x1b')][_0x9e80('0x1c')]({'raw':_0x1ddee0[_0x9e80('0x1d')]?_0x1ddee0[_0x9e80('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x1ddee0[_0x9e80('0x1d')]?_0x1ddee0[_0x9e80('0x1d')][_0x9e80('0x1e')]||null:null,'attributes':_0x1ddee0[_0x9e80('0x1d')]?_0x1ddee0[_0x9e80('0x1d')][_0x9e80('0x1f')]||null:null,'limit':_0x1ddee0[_0x9e80('0x1d')]?_0x1ddee0[_0x9e80('0x1d')][_0x9e80('0x20')]||null:null,'include':_0x1ddee0[_0x9e80('0x1d')]?_0x1ddee0['options'][_0x9e80('0x21')]?_[_0x9e80('0x22')](_0x1ddee0[_0x9e80('0x1d')]['include'],function(_0x3d1b2b){return{'model':db[_0x3d1b2b[_0x9e80('0x23')]],'as':_0x3d1b2b['as'],'attributes':_0x3d1b2b['attributes'],'include':_0x3d1b2b['include']?_[_0x9e80('0x22')](_0x3d1b2b[_0x9e80('0x21')],function(_0x5c7782){return{'model':db[_0x5c7782[_0x9e80('0x23')]],'as':_0x5c7782['as'],'attributes':_0x5c7782['attributes'],'include':_0x5c7782[_0x9e80('0x21')]?_[_0x9e80('0x22')](_0x5c7782[_0x9e80('0x21')],function(_0x2af43c){return{'model':db[_0x2af43c[_0x9e80('0x23')]],'as':_0x2af43c['as'],'attributes':_0x2af43c[_0x9e80('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0x10')](function(_0x9e2103){logger[_0x9e80('0x11')](_0x9e80('0x1a'),_0x1ddee0);logger['debug'](_0x9e80('0x1a'),_0x1ddee0,JSON['stringify'](_0x9e2103));_0x4b7862(_0x9e2103);})['catch'](function(_0x90fc84){logger[_0x9e80('0x14')](_0x9e80('0x1a'),_0x90fc84[_0x9e80('0x16')],_0x1ddee0);_0x4be802(_0x3d43e5[_0x9e80('0x14')](0x1f4,_0x90fc84[_0x9e80('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x40a848){var _0x2575b2=this;return new Promise(function(_0x2ce5aa,_0x57cdc8){return db['OpenchannelQueue']['find']({'raw':_0x40a848['options']?_0x40a848[_0x9e80('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x40a848[_0x9e80('0x1d')]?_0x40a848[_0x9e80('0x1d')][_0x9e80('0x1e')]||null:null,'attributes':_0x40a848['options']?_0x40a848[_0x9e80('0x1d')][_0x9e80('0x1f')]||null:null,'include':_0x40a848[_0x9e80('0x1d')]?_0x40a848[_0x9e80('0x1d')][_0x9e80('0x21')]?_[_0x9e80('0x22')](_0x40a848['options']['include'],function(_0xbc5071){return{'model':db[_0xbc5071[_0x9e80('0x23')]],'as':_0xbc5071['as'],'attributes':_0xbc5071[_0x9e80('0x1f')],'include':_0xbc5071[_0x9e80('0x21')]?_[_0x9e80('0x22')](_0xbc5071[_0x9e80('0x21')],function(_0x2b3835){return{'model':db[_0x2b3835[_0x9e80('0x23')]],'as':_0x2b3835['as'],'attributes':_0x2b3835[_0x9e80('0x1f')],'include':_0x2b3835['include']?_[_0x9e80('0x22')](_0x2b3835['include'],function(_0x503c34){return{'model':db[_0x503c34[_0x9e80('0x23')]],'as':_0x503c34['as'],'attributes':_0x503c34[_0x9e80('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x9e80('0x10')](function(_0x1c8e50){logger[_0x9e80('0x11')](_0x9e80('0x24'),_0x40a848);logger['debug']('ShowOpenchannelQueue',_0x40a848,JSON[_0x9e80('0x13')](_0x1c8e50));_0x2ce5aa(_0x1c8e50);})['catch'](function(_0x5b43b9){logger[_0x9e80('0x14')](_0x9e80('0x24'),_0x5b43b9[_0x9e80('0x16')],_0x40a848);_0x57cdc8(_0x2575b2[_0x9e80('0x14')](0x1f4,_0x5b43b9[_0x9e80('0x16')]));});});}; \ No newline at end of file +var _0x094a=['where','attributes','include','map','model','then','GetOpenchannelQueue','debug','catch','find','ShowOpenchannelQueue','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','./openchannelQueue.socket','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','OpenchannelQueue','findAll','options','raw'];(function(_0x53263b,_0x299c08){var _0x3fd94b=function(_0x489939){while(--_0x489939){_0x53263b['push'](_0x53263b['shift']());}};_0x3fd94b(++_0x299c08);}(_0x094a,0x1a2));var _0xa094=function(_0x2adec5,_0x2e1b2d){_0x2adec5=_0x2adec5-0x0;var _0x175fc8=_0x094a[_0x2adec5];return _0x175fc8;};'use strict';var _=require(_0xa094('0x0'));var util=require('util');var moment=require(_0xa094('0x1'));var BPromise=require(_0xa094('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xa094('0x3'));var logger=require(_0xa094('0x4'))(_0xa094('0x5'));var config=require(_0xa094('0x6'));var jayson=require(_0xa094('0x7'));var client=jayson[_0xa094('0x8')]['http']({'port':0x232a});var socket=require(_0xa094('0x9'))({'host':_0xa094('0xa'),'port':0x18eb});require(_0xa094('0xb'))['register'](socket);function respondWithRpcPromise(_0x2bc2a6,_0x133f5e,_0x204961){return new BPromise(function(_0x1b8222,_0x116453){return client[_0xa094('0xc')](_0x2bc2a6,_0x204961)['then'](function(_0x36a6b8){logger['info'](_0xa094('0xd'),_0x133f5e,_0xa094('0xe'));logger['debug'](_0xa094('0xf'),_0x133f5e,_0xa094('0xe'),JSON[_0xa094('0x10')](_0x36a6b8));if(_0x36a6b8[_0xa094('0x11')]){if(_0x36a6b8[_0xa094('0x11')][_0xa094('0x12')]===0x1f4){logger[_0xa094('0x11')](_0xa094('0xd'),_0x133f5e,_0x36a6b8[_0xa094('0x11')]['message']);return _0x116453(_0x36a6b8[_0xa094('0x11')][_0xa094('0x13')]);}logger[_0xa094('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x133f5e,_0x36a6b8[_0xa094('0x11')][_0xa094('0x13')]);return _0x1b8222(_0x36a6b8[_0xa094('0x11')]['message']);}else{logger[_0xa094('0x14')](_0xa094('0xd'),_0x133f5e,_0xa094('0xe'));_0x1b8222(_0x36a6b8[_0xa094('0x15')][_0xa094('0x13')]);}})['catch'](function(_0xb6a62a){logger[_0xa094('0x11')](_0xa094('0xd'),_0x133f5e,_0xb6a62a);_0x116453(_0xb6a62a);});});}exports['GetOpenchannelQueue']=function(_0x3e5829){var _0x589f91=this;return new Promise(function(_0x27eed9,_0x2849d6){return db[_0xa094('0x16')][_0xa094('0x17')]({'raw':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x19')]===undefined?!![]:![]:!![],'where':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1a')]||null:null,'attributes':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1b')]||null:null,'limit':_0x3e5829['options']?_0x3e5829['options']['limit']||null:null,'include':_0x3e5829[_0xa094('0x18')]?_0x3e5829[_0xa094('0x18')][_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x3e5829[_0xa094('0x18')][_0xa094('0x1c')],function(_0x1363ad){return{'model':db[_0x1363ad[_0xa094('0x1e')]],'as':_0x1363ad['as'],'attributes':_0x1363ad[_0xa094('0x1b')],'include':_0x1363ad[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x1363ad[_0xa094('0x1c')],function(_0x245feb){return{'model':db[_0x245feb[_0xa094('0x1e')]],'as':_0x245feb['as'],'attributes':_0x245feb[_0xa094('0x1b')],'include':_0x245feb[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x245feb[_0xa094('0x1c')],function(_0x323518){return{'model':db[_0x323518[_0xa094('0x1e')]],'as':_0x323518['as'],'attributes':_0x323518[_0xa094('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa094('0x1f')](function(_0x10056f){logger[_0xa094('0x14')](_0xa094('0x20'),_0x3e5829);logger[_0xa094('0x21')](_0xa094('0x20'),_0x3e5829,JSON[_0xa094('0x10')](_0x10056f));_0x27eed9(_0x10056f);})[_0xa094('0x22')](function(_0x2aee11){logger['error'](_0xa094('0x20'),_0x2aee11[_0xa094('0x13')],_0x3e5829);_0x2849d6(_0x589f91['error'](0x1f4,_0x2aee11[_0xa094('0x13')]));});});};exports['ShowOpenchannelQueue']=function(_0x31ee21){var _0x14cb9a=this;return new Promise(function(_0x34d0aa,_0x16ec18){return db[_0xa094('0x16')][_0xa094('0x23')]({'raw':_0x31ee21[_0xa094('0x18')]?_0x31ee21[_0xa094('0x18')][_0xa094('0x19')]===undefined?!![]:![]:!![],'where':_0x31ee21[_0xa094('0x18')]?_0x31ee21[_0xa094('0x18')][_0xa094('0x1a')]||null:null,'attributes':_0x31ee21['options']?_0x31ee21[_0xa094('0x18')][_0xa094('0x1b')]||null:null,'include':_0x31ee21[_0xa094('0x18')]?_0x31ee21['options'][_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x31ee21['options'][_0xa094('0x1c')],function(_0x205f2b){return{'model':db[_0x205f2b[_0xa094('0x1e')]],'as':_0x205f2b['as'],'attributes':_0x205f2b['attributes'],'include':_0x205f2b[_0xa094('0x1c')]?_['map'](_0x205f2b[_0xa094('0x1c')],function(_0x4ecd71){return{'model':db[_0x4ecd71[_0xa094('0x1e')]],'as':_0x4ecd71['as'],'attributes':_0x4ecd71[_0xa094('0x1b')],'include':_0x4ecd71[_0xa094('0x1c')]?_[_0xa094('0x1d')](_0x4ecd71['include'],function(_0x3a1d56){return{'model':db[_0x3a1d56['model']],'as':_0x3a1d56['as'],'attributes':_0x3a1d56['attributes']};}):[]};}):[]};}):[]:[]})[_0xa094('0x1f')](function(_0x35a270){logger[_0xa094('0x14')](_0xa094('0x24'),_0x31ee21);logger['debug'](_0xa094('0x24'),_0x31ee21,JSON[_0xa094('0x10')](_0x35a270));_0x34d0aa(_0x35a270);})[_0xa094('0x22')](function(_0x6ec019){logger['error'](_0xa094('0x24'),_0x6ec019[_0xa094('0x13')],_0x31ee21);_0x16ec18(_0x14cb9a[_0xa094('0x11')](0x1f4,_0x6ec019['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 0bf4ee3..e92196b 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 _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelQueueEvents=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(){OpenchannelQueueEvents[_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);OpenchannelQueueEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 6d50bce..28197af 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 _0x7bbd=['./openchannelQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','path','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x5527e7,_0x31df57){var _0x49a798=function(_0x2bfe34){while(--_0x2bfe34){_0x5527e7['push'](_0x5527e7['shift']());}};_0x49a798(++_0x31df57);}(_0x7bbd,0x12a));var _0xd7bb=function(_0x298ffe,_0x2b5a1d){_0x298ffe=_0x298ffe-0x0;var _0xd75238=_0x7bbd[_0x298ffe];return _0xd75238;};'use strict';var multer=require(_0xd7bb('0x0'));var util=require('util');var path=require(_0xd7bb('0x1'));var express=require(_0xd7bb('0x2'));var router=express[_0xd7bb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xd7bb('0x4'));var config=require(_0xd7bb('0x5'));var controller=require(_0xd7bb('0x6'));router[_0xd7bb('0x7')]('/',auth[_0xd7bb('0x8')](),controller['index']);router[_0xd7bb('0x7')](_0xd7bb('0x9'),auth['isAuthenticated'](),controller[_0xd7bb('0xa')]);router[_0xd7bb('0x7')](_0xd7bb('0xb'),auth[_0xd7bb('0x8')](),controller[_0xd7bb('0xc')]);router[_0xd7bb('0xd')]('/',auth['isAuthenticated'](),controller[_0xd7bb('0xe')]);router[_0xd7bb('0xf')](_0xd7bb('0xb'),auth[_0xd7bb('0x8')](),controller[_0xd7bb('0x10')]);router[_0xd7bb('0x11')](_0xd7bb('0xb'),auth[_0xd7bb('0x8')](),controller[_0xd7bb('0x12')]);module['exports']=router; \ No newline at end of file +var _0xa8b0=['update','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','create','put'];(function(_0x51715b,_0xe852a9){var _0x3ba2e2=function(_0x565694){while(--_0x565694){_0x51715b['push'](_0x51715b['shift']());}};_0x3ba2e2(++_0xe852a9);}(_0xa8b0,0x1bc));var _0x0a8b=function(_0x1c9cfb,_0x4efc3b){_0x1c9cfb=_0x1c9cfb-0x0;var _0x32436a=_0xa8b0[_0x1c9cfb];return _0x32436a;};'use strict';var multer=require(_0x0a8b('0x0'));var util=require('util');var path=require(_0x0a8b('0x1'));var express=require(_0x0a8b('0x2'));var router=express[_0x0a8b('0x3')]();var auth=require(_0x0a8b('0x4'));var interaction=require(_0x0a8b('0x5'));var config=require('../../config/environment');var controller=require(_0x0a8b('0x6'));router[_0x0a8b('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a8b('0x8')]);router['get'](_0x0a8b('0x9'),auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xb')]);router['get'](_0x0a8b('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xd')]);router[_0x0a8b('0xe')]('/:id',auth[_0x0a8b('0xa')](),controller[_0x0a8b('0xf')]);router['delete'](_0x0a8b('0xc'),auth[_0x0a8b('0xa')](),controller[_0x0a8b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6544e6e..4d6c333 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 _0x4423=['sequelize','STRING','DATE','moment'];(function(_0x13af04,_0x34696c){var _0xd04e49=function(_0x3e5475){while(--_0x3e5475){_0x13af04['push'](_0x13af04['shift']());}};_0xd04e49(++_0x34696c);}(_0x4423,0x18b));var _0x3442=function(_0x243217,_0x522951){_0x243217=_0x243217-0x0;var _0x478029=_0x4423[_0x243217];return _0x478029;};'use strict';var moment=require(_0x3442('0x0'));var Sequelize=require(_0x3442('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3442('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3442('0x2')]},'joinAt':{'type':Sequelize[_0x3442('0x3')]},'leaveAt':{'type':Sequelize[_0x3442('0x3')]},'acceptAt':{'type':Sequelize[_0x3442('0x3')]},'exitAt':{'type':Sequelize[_0x3442('0x3')]},'reason':{'type':Sequelize[_0x3442('0x2')]}}; \ No newline at end of file +var _0x5445=['sequelize','exports','STRING','DATE'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x5445,0x11c));var _0x5544=function(_0x2f23dc,_0x583e49){_0x2f23dc=_0x2f23dc-0x0;var _0x1fcac7=_0x5445[_0x2f23dc];return _0x1fcac7;};'use strict';var moment=require('moment');var Sequelize=require(_0x5544('0x0'));module[_0x5544('0x1')]={'uniqueid':{'type':Sequelize[_0x5544('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x5544('0x2')]},'joinAt':{'type':Sequelize[_0x5544('0x3')]},'leaveAt':{'type':Sequelize[_0x5544('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5544('0x3')]},'reason':{'type':Sequelize[_0x5544('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a5f1536..2c7b58b 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 _0x77e6=['body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','OpenchannelQueueReport','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','merge','filter','map','options','then','includeAll','include','findAll','rows','show','params','find','create','catch'];(function(_0x18a4c0,_0x4e58bb){var _0x514ea6=function(_0x104012){while(--_0x104012){_0x18a4c0['push'](_0x18a4c0['shift']());}};_0x514ea6(++_0x4e58bb);}(_0x77e6,0x1a6));var _0x677e=function(_0x1418c3,_0x445f8e){_0x1418c3=_0x1418c3-0x0;var _0x555449=_0x77e6[_0x1418c3];return _0x555449;};'use strict';var jsonpatch=require(_0x677e('0x0'));var rp=require(_0x677e('0x1'));var moment=require(_0x677e('0x2'));var BPromise=require(_0x677e('0x3'));var Mustache=require(_0x677e('0x4'));var util=require(_0x677e('0x5'));var path=require(_0x677e('0x6'));var sox=require(_0x677e('0x7'));var csv=require('to-csv');var ejs=require(_0x677e('0x8'));var fs=require('fs');var _=require(_0x677e('0x9'));var squel=require('squel');var crypto=require(_0x677e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x677e('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x677e('0xc'));var qs=require(_0x677e('0xd'));var logger=require(_0x677e('0xe'))(_0x677e('0xf'));var utils=require('../../config/utils');var config=require(_0x677e('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cdbe3,_0x227084){_0x227084=_0x227084||0xcc;return function(_0x1e4fd9){if(_0x1e4fd9){return _0x3cdbe3[_0x677e('0x11')](_0x227084);}return _0x3cdbe3[_0x677e('0x12')](_0x227084)[_0x677e('0x13')]();};}function respondWithResult(_0x11306a,_0x3872f8){_0x3872f8=_0x3872f8||0xc8;return function(_0x1eb56a){if(_0x1eb56a){return _0x11306a[_0x677e('0x12')](_0x3872f8)[_0x677e('0x14')](_0x1eb56a);}};}function respondWithFilteredResult(_0x2a5f95,_0x2cf2f6){return function(_0x28faa1){if(_0x28faa1){var _0x55cffd=_0x28faa1[_0x677e('0x15')],_0x512631=_0x2cf2f6[_0x677e('0x16')],_0x5c7351=_0x2cf2f6[_0x677e('0x16')]+_0x2cf2f6[_0x677e('0x17')],_0x213a50;if(_0x5c7351>=_0x55cffd){_0x5c7351=_0x55cffd;_0x213a50=0xc8;}else{_0x213a50=0xce;}_0x2a5f95[_0x677e('0x12')](_0x213a50);return _0x2a5f95[_0x677e('0x18')](_0x677e('0x19'),_0x512631+'-'+_0x5c7351+'/'+_0x55cffd)[_0x677e('0x14')](_0x28faa1);}return null;};}function patchUpdates(_0x32d306){return function(_0x1e7f16){try{jsonpatch[_0x677e('0x1a')](_0x1e7f16,_0x32d306,!![]);}catch(_0x49d428){return BPromise[_0x677e('0x1b')](_0x49d428);}return _0x1e7f16[_0x677e('0x1c')]();};}function saveUpdates(_0x385b06,_0x221b6d){return function(_0xba1c26){if(_0xba1c26){return _0xba1c26[_0x677e('0x1d')](_0x385b06)['then'](function(_0x190a49){return _0x190a49;});}return null;};}function removeEntity(_0x4bfbb6,_0x18424e){return function(_0x267aac){if(_0x267aac){return _0x267aac[_0x677e('0x1e')]()['then'](function(){_0x4bfbb6[_0x677e('0x12')](0xcc)[_0x677e('0x13')]();});}};}function handleEntityNotFound(_0x15bc35,_0x1d6f7d){return function(_0x295964){if(!_0x295964){_0x15bc35[_0x677e('0x11')](0x194);}return _0x295964;};}function handleError(_0x3a7895,_0x52ee8b){_0x52ee8b=_0x52ee8b||0x1f4;return function(_0x4b1a2a){logger['error'](_0x4b1a2a[_0x677e('0x1f')]);if(_0x4b1a2a[_0x677e('0x20')]){delete _0x4b1a2a[_0x677e('0x20')];}_0x3a7895[_0x677e('0x12')](_0x52ee8b)[_0x677e('0x21')](_0x4b1a2a);};}exports[_0x677e('0x22')]=function(_0x1183b1,_0x42f2b8){var _0x2c51d3={},_0x3f0646={},_0x5e5397={'count':0x0,'rows':[]};var _0x5f0ba2=db[_0x677e('0x23')][_0x677e('0x24')];_0x3f0646['model']=_[_0x677e('0x25')](_0x5f0ba2);var _0x264ed3={'dateStart':_0x1183b1[_0x677e('0x26')][_0x677e('0x27')],'dateEnd':_0x1183b1[_0x677e('0x26')][_0x677e('0x28')]};delete _0x1183b1['query'][_0x677e('0x27')];delete _0x1183b1[_0x677e('0x26')][_0x677e('0x28')];_0x3f0646[_0x677e('0x26')]=_[_0x677e('0x25')](_0x1183b1[_0x677e('0x26')]);_0x3f0646[_0x677e('0x29')]=_[_0x677e('0x2a')](_0x3f0646[_0x677e('0x2b')],_0x3f0646['query']);_0x2c51d3[_0x677e('0x2c')]=_[_0x677e('0x2a')](_0x3f0646[_0x677e('0x2b')],qs[_0x677e('0x2d')](_0x1183b1[_0x677e('0x26')][_0x677e('0x2d')]));_0x2c51d3[_0x677e('0x2c')]=_0x2c51d3[_0x677e('0x2c')][_0x677e('0x2e')]?_0x2c51d3[_0x677e('0x2c')]:_0x3f0646['model'];if(!_0x1183b1[_0x677e('0x26')][_0x677e('0x2f')](_0x677e('0x30'))){_0x2c51d3[_0x677e('0x17')]=qs[_0x677e('0x17')](_0x1183b1[_0x677e('0x26')]['limit']);_0x2c51d3[_0x677e('0x16')]=qs[_0x677e('0x16')](_0x1183b1[_0x677e('0x26')]['offset']);}_0x2c51d3[_0x677e('0x31')]=qs[_0x677e('0x32')](_0x1183b1[_0x677e('0x26')][_0x677e('0x32')]);_0x2c51d3[_0x677e('0x33')]=qs['filters'](_[_0x677e('0x34')](_0x1183b1[_0x677e('0x26')],_0x3f0646[_0x677e('0x29')]));if(_0x264ed3[_0x677e('0x27')]){if(_0x264ed3['dateEnd']){_0x264ed3[_0x677e('0x28')]=moment(_0x264ed3[_0x677e('0x28')])[_0x677e('0x35')](0x1,'day');}else{_0x264ed3['dateEnd']=moment(_0x264ed3[_0x677e('0x27')])[_0x677e('0x35')](0x1,'day');}_[_0x677e('0x36')](_0x2c51d3[_0x677e('0x33')],{'createdAt':{'$gte':_0x264ed3['dateStart'],'$lte':_0x264ed3['dateEnd']}});}if(_0x1183b1[_0x677e('0x26')][_0x677e('0x37')]){_0x2c51d3['where']=_['merge'](_0x2c51d3[_0x677e('0x33')],{'$or':_[_0x677e('0x38')](_0x2c51d3[_0x677e('0x2c')],function(_0x5bb080){var _0x3008c5={};_0x3008c5[_0x5bb080]={'$like':'%'+_0x1183b1[_0x677e('0x26')][_0x677e('0x37')]+'%'};return _0x3008c5;})});}_0x2c51d3=_[_0x677e('0x36')]({},_0x2c51d3,_0x1183b1[_0x677e('0x39')]);var _0x4b34fa={'where':_0x2c51d3['where']};return db[_0x677e('0x23')][_0x677e('0x15')](_0x4b34fa)[_0x677e('0x3a')](function(_0x1db5b4){_0x5e5397[_0x677e('0x15')]=_0x1db5b4;if(_0x1183b1[_0x677e('0x26')][_0x677e('0x3b')]){_0x2c51d3[_0x677e('0x3c')]=[{'all':!![]}];}return db[_0x677e('0x23')][_0x677e('0x3d')](_0x2c51d3);})['then'](function(_0x56eb30){_0x5e5397[_0x677e('0x3e')]=_0x56eb30;return _0x5e5397;})[_0x677e('0x3a')](respondWithFilteredResult(_0x42f2b8,_0x2c51d3))['catch'](handleError(_0x42f2b8,null));};exports[_0x677e('0x3f')]=function(_0x511125,_0x16362e){var _0x29b9c0={'raw':!![],'where':{'id':_0x511125[_0x677e('0x40')]['id']}},_0x283aaa={};_0x283aaa[_0x677e('0x2b')]=_[_0x677e('0x25')](db['OpenchannelQueueReport'][_0x677e('0x24')]);_0x283aaa[_0x677e('0x26')]=_[_0x677e('0x25')](_0x511125[_0x677e('0x26')]);_0x283aaa[_0x677e('0x29')]=_[_0x677e('0x2a')](_0x283aaa['model'],_0x283aaa[_0x677e('0x26')]);_0x29b9c0['attributes']=_[_0x677e('0x2a')](_0x283aaa[_0x677e('0x2b')],qs[_0x677e('0x2d')](_0x511125[_0x677e('0x26')][_0x677e('0x2d')]));_0x29b9c0[_0x677e('0x2c')]=_0x29b9c0[_0x677e('0x2c')][_0x677e('0x2e')]?_0x29b9c0[_0x677e('0x2c')]:_0x283aaa[_0x677e('0x2b')];if(_0x511125['query'][_0x677e('0x3b')]){_0x29b9c0['include']=[{'all':!![]}];}_0x29b9c0=_['merge']({},_0x29b9c0,_0x511125[_0x677e('0x39')]);return db[_0x677e('0x23')][_0x677e('0x41')](_0x29b9c0)[_0x677e('0x3a')](handleEntityNotFound(_0x16362e,null))[_0x677e('0x3a')](respondWithResult(_0x16362e,null))['catch'](handleError(_0x16362e,null));};exports[_0x677e('0x42')]=function(_0x136b77,_0x3cb653){return db[_0x677e('0x23')][_0x677e('0x42')](_0x136b77['body'],{})[_0x677e('0x3a')](respondWithResult(_0x3cb653,0xc9))[_0x677e('0x43')](handleError(_0x3cb653,null));};exports[_0x677e('0x1d')]=function(_0x496627,_0x30ed5c){if(_0x496627['body']['id']){delete _0x496627[_0x677e('0x44')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x496627[_0x677e('0x40')]['id']}})[_0x677e('0x3a')](handleEntityNotFound(_0x30ed5c,null))[_0x677e('0x3a')](saveUpdates(_0x496627[_0x677e('0x44')],null))['then'](respondWithResult(_0x30ed5c,null))[_0x677e('0x43')](handleError(_0x30ed5c,null));};exports[_0x677e('0x1e')]=function(_0x51b2b8,_0x5e93e9){return db[_0x677e('0x23')][_0x677e('0x41')]({'where':{'id':_0x51b2b8[_0x677e('0x40')]['id']}})[_0x677e('0x3a')](handleEntityNotFound(_0x5e93e9,null))['then'](removeEntity(_0x5e93e9,null))[_0x677e('0x43')](handleError(_0x5e93e9,null));};exports['describe']=function(_0x5404a1,_0x3bb4d8){return db['OpenchannelQueueReport'][_0x677e('0x45')]()[_0x677e('0x3a')](respondWithResult(_0x3bb4d8,null))[_0x677e('0x43')](handleError(_0x3bb4d8,null));}; \ No newline at end of file +var _0x47c5=['bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','index','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','filter','OpenchannelQueueReport','includeAll','include','findAll','show','params','options','find','catch','create','body','destroy','describe','fast-json-patch','request-promise','moment'];(function(_0x538c62,_0x3399d6){var _0x445bf5=function(_0x167018){while(--_0x167018){_0x538c62['push'](_0x538c62['shift']());}};_0x445bf5(++_0x3399d6);}(_0x47c5,0x165));var _0x547c=function(_0x1e7600,_0x11348d){_0x1e7600=_0x1e7600-0x0;var _0x80b052=_0x47c5[_0x1e7600];return _0x80b052;};'use strict';var jsonpatch=require(_0x547c('0x0'));var rp=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var Mustache=require(_0x547c('0x4'));var util=require(_0x547c('0x5'));var path=require('path');var sox=require(_0x547c('0x6'));var csv=require(_0x547c('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x547c('0x8'));var squel=require(_0x547c('0x9'));var crypto=require('crypto');var jsforce=require(_0x547c('0xa'));var deskjs=require(_0x547c('0xb'));var toCsv=require(_0x547c('0x7'));var querystring=require(_0x547c('0xc'));var Papa=require(_0x547c('0xd'));var qs=require(_0x547c('0xe'));var logger=require(_0x547c('0xf'))(_0x547c('0x10'));var utils=require(_0x547c('0x11'));var config=require(_0x547c('0x12'));var db=require(_0x547c('0x13'))['db'];function respondWithStatusCode(_0x2c54e,_0x111457){_0x111457=_0x111457||0xcc;return function(_0x2455e9){if(_0x2455e9){return _0x2c54e[_0x547c('0x14')](_0x111457);}return _0x2c54e[_0x547c('0x15')](_0x111457)[_0x547c('0x16')]();};}function respondWithResult(_0x549bf0,_0x13a103){_0x13a103=_0x13a103||0xc8;return function(_0x39dce7){if(_0x39dce7){return _0x549bf0['status'](_0x13a103)[_0x547c('0x17')](_0x39dce7);}};}function respondWithFilteredResult(_0x201d95,_0x171ae4){return function(_0x5016e9){if(_0x5016e9){var _0x392a35=_0x5016e9[_0x547c('0x18')],_0x150317=_0x171ae4[_0x547c('0x19')],_0x2bc289=_0x171ae4[_0x547c('0x19')]+_0x171ae4[_0x547c('0x1a')],_0xa3c7b0;if(_0x2bc289>=_0x392a35){_0x2bc289=_0x392a35;_0xa3c7b0=0xc8;}else{_0xa3c7b0=0xce;}_0x201d95[_0x547c('0x15')](_0xa3c7b0);return _0x201d95[_0x547c('0x1b')](_0x547c('0x1c'),_0x150317+'-'+_0x2bc289+'/'+_0x392a35)[_0x547c('0x17')](_0x5016e9);}return null;};}function patchUpdates(_0x39498d){return function(_0x19d3dd){try{jsonpatch['apply'](_0x19d3dd,_0x39498d,!![]);}catch(_0x4a6c57){return BPromise[_0x547c('0x1d')](_0x4a6c57);}return _0x19d3dd[_0x547c('0x1e')]();};}function saveUpdates(_0xeb059e,_0x4a8901){return function(_0x248aca){if(_0x248aca){return _0x248aca[_0x547c('0x1f')](_0xeb059e)[_0x547c('0x20')](function(_0x58ddc9){return _0x58ddc9;});}return null;};}function removeEntity(_0x4511d3,_0x41149f){return function(_0x496c38){if(_0x496c38){return _0x496c38['destroy']()[_0x547c('0x20')](function(){_0x4511d3[_0x547c('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11e709,_0x16a3a6){return function(_0x592e46){if(!_0x592e46){_0x11e709[_0x547c('0x14')](0x194);}return _0x592e46;};}function handleError(_0x17fd97,_0x436e67){_0x436e67=_0x436e67||0x1f4;return function(_0x4c718c){logger[_0x547c('0x21')](_0x4c718c[_0x547c('0x22')]);if(_0x4c718c[_0x547c('0x23')]){delete _0x4c718c[_0x547c('0x23')];}_0x17fd97[_0x547c('0x15')](_0x436e67)[_0x547c('0x24')](_0x4c718c);};}exports[_0x547c('0x25')]=function(_0x17fa33,_0x507895){var _0x39c5f9={},_0x4c66b9={},_0x5b05f2={'count':0x0,'rows':[]};var _0x4855fd=db['OpenchannelQueueReport'][_0x547c('0x26')];_0x4c66b9['model']=_[_0x547c('0x27')](_0x4855fd);var _0x5729b0={'dateStart':_0x17fa33[_0x547c('0x28')]['dateStart'],'dateEnd':_0x17fa33[_0x547c('0x28')][_0x547c('0x29')]};delete _0x17fa33[_0x547c('0x28')][_0x547c('0x2a')];delete _0x17fa33[_0x547c('0x28')]['dateEnd'];_0x4c66b9['query']=_[_0x547c('0x27')](_0x17fa33['query']);_0x4c66b9[_0x547c('0x2b')]=_[_0x547c('0x2c')](_0x4c66b9[_0x547c('0x2d')],_0x4c66b9[_0x547c('0x28')]);_0x39c5f9[_0x547c('0x2e')]=_[_0x547c('0x2c')](_0x4c66b9[_0x547c('0x2d')],qs['fields'](_0x17fa33['query'][_0x547c('0x2f')]));_0x39c5f9[_0x547c('0x2e')]=_0x39c5f9[_0x547c('0x2e')][_0x547c('0x30')]?_0x39c5f9[_0x547c('0x2e')]:_0x4c66b9[_0x547c('0x2d')];if(!_0x17fa33[_0x547c('0x28')][_0x547c('0x31')](_0x547c('0x32'))){_0x39c5f9[_0x547c('0x1a')]=qs[_0x547c('0x1a')](_0x17fa33[_0x547c('0x28')][_0x547c('0x1a')]);_0x39c5f9[_0x547c('0x19')]=qs['offset'](_0x17fa33[_0x547c('0x28')]['offset']);}_0x39c5f9['order']=qs['sort'](_0x17fa33[_0x547c('0x28')][_0x547c('0x33')]);_0x39c5f9[_0x547c('0x34')]=qs[_0x547c('0x2b')](_[_0x547c('0x35')](_0x17fa33[_0x547c('0x28')],_0x4c66b9['filters']));if(_0x5729b0['dateStart']){if(_0x5729b0['dateEnd']){_0x5729b0[_0x547c('0x29')]=moment(_0x5729b0[_0x547c('0x29')])[_0x547c('0x36')](0x1,_0x547c('0x37'));}else{_0x5729b0[_0x547c('0x29')]=moment(_0x5729b0[_0x547c('0x2a')])['add'](0x1,_0x547c('0x37'));}_['merge'](_0x39c5f9[_0x547c('0x34')],{'createdAt':{'$gte':_0x5729b0[_0x547c('0x2a')],'$lte':_0x5729b0['dateEnd']}});}if(_0x17fa33[_0x547c('0x28')]['filter']){_0x39c5f9['where']=_[_0x547c('0x38')](_0x39c5f9[_0x547c('0x34')],{'$or':_[_0x547c('0x39')](_0x39c5f9[_0x547c('0x2e')],function(_0x4c36b9){var _0x52b962={};_0x52b962[_0x4c36b9]={'$like':'%'+_0x17fa33[_0x547c('0x28')][_0x547c('0x3a')]+'%'};return _0x52b962;})});}_0x39c5f9=_[_0x547c('0x38')]({},_0x39c5f9,_0x17fa33['options']);var _0x3886ae={'where':_0x39c5f9[_0x547c('0x34')]};return db[_0x547c('0x3b')]['count'](_0x3886ae)[_0x547c('0x20')](function(_0x3a6a0a){_0x5b05f2[_0x547c('0x18')]=_0x3a6a0a;if(_0x17fa33['query'][_0x547c('0x3c')]){_0x39c5f9[_0x547c('0x3d')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x547c('0x3e')](_0x39c5f9);})[_0x547c('0x20')](function(_0x9c3cb2){_0x5b05f2['rows']=_0x9c3cb2;return _0x5b05f2;})[_0x547c('0x20')](respondWithFilteredResult(_0x507895,_0x39c5f9))['catch'](handleError(_0x507895,null));};exports[_0x547c('0x3f')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':!![],'where':{'id':_0x5393a2[_0x547c('0x40')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x2d')]=_[_0x547c('0x27')](db['OpenchannelQueueReport']['rawAttributes']);_0x3d37d7[_0x547c('0x28')]=_[_0x547c('0x27')](_0x5393a2[_0x547c('0x28')]);_0x3d37d7['filters']=_[_0x547c('0x2c')](_0x3d37d7[_0x547c('0x2d')],_0x3d37d7[_0x547c('0x28')]);_0x414b9d[_0x547c('0x2e')]=_[_0x547c('0x2c')](_0x3d37d7[_0x547c('0x2d')],qs['fields'](_0x5393a2[_0x547c('0x28')][_0x547c('0x2f')]));_0x414b9d[_0x547c('0x2e')]=_0x414b9d['attributes'][_0x547c('0x30')]?_0x414b9d[_0x547c('0x2e')]:_0x3d37d7[_0x547c('0x2d')];if(_0x5393a2[_0x547c('0x28')]['includeAll']){_0x414b9d[_0x547c('0x3d')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x41')]);return db['OpenchannelQueueReport'][_0x547c('0x42')](_0x414b9d)[_0x547c('0x20')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x43')](handleError(_0xb86f5f,null));};exports[_0x547c('0x44')]=function(_0xa005cc,_0x1ddf30){return db['OpenchannelQueueReport'][_0x547c('0x44')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x43')](handleError(_0x1ddf30,null));};exports[_0x547c('0x1f')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x45')]['id']){delete _0x3e3f52[_0x547c('0x45')]['id'];}return db[_0x547c('0x3b')][_0x547c('0x42')]({'where':{'id':_0x3e3f52[_0x547c('0x40')]['id']}})[_0x547c('0x20')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x20')](saveUpdates(_0x3e3f52[_0x547c('0x45')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x46')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x3b')][_0x547c('0x42')]({'where':{'id':_0x21ea26[_0x547c('0x40')]['id']}})[_0x547c('0x20')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x20')](removeEntity(_0x48de6e,null))[_0x547c('0x43')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x3b')][_0x547c('0x47')]()[_0x547c('0x20')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 99ccd94..ce9b789 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 _0xaf9b=['define','report_openchannel_queue','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','./openchannelQueueReport.attributes'];(function(_0x39a07d,_0x3e3c94){var _0x3d7036=function(_0x100305){while(--_0x100305){_0x39a07d['push'](_0x39a07d['shift']());}};_0x3d7036(++_0x3e3c94);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x5dd450,_0x595992){_0x5dd450=_0x5dd450-0x0;var _0x4e4ef1=_0xaf9b[_0x5dd450];return _0x4e4ef1;};'use strict';var _=require(_0xbaf9('0x0'));var util=require('util');var logger=require(_0xbaf9('0x1'))('api');var moment=require(_0xbaf9('0x2'));var BPromise=require(_0xbaf9('0x3'));var rp=require(_0xbaf9('0x4'));var attributes=require(_0xbaf9('0x5'));module['exports']=function(_0x64585f,_0x178a7a){return _0x64585f[_0xbaf9('0x6')]('OpenchannelQueueReport',attributes,{'tableName':_0xbaf9('0x7'),'paranoid':![],'indexes':[{'name':_0xbaf9('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8eb=['moment','bluebird','request-promise','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util','../../config/logger'];(function(_0x41caac,_0x50c421){var _0x28d2ba=function(_0x2a2e12){while(--_0x2a2e12){_0x41caac['push'](_0x41caac['shift']());}};_0x28d2ba(++_0x50c421);}(_0xe8eb,0xce));var _0xbe8e=function(_0x1f1b89,_0x21f436){_0x1f1b89=_0x1f1b89-0x0;var _0x5ef63a=_0xe8eb[_0x1f1b89];return _0x5ef63a;};'use strict';var _=require(_0xbe8e('0x0'));var util=require(_0xbe8e('0x1'));var logger=require(_0xbe8e('0x2'))('api');var moment=require(_0xbe8e('0x3'));var BPromise=require(_0xbe8e('0x4'));var rp=require(_0xbe8e('0x5'));var attributes=require(_0xbe8e('0x6'));module[_0xbe8e('0x7')]=function(_0x3e8c47,_0x48fbfa){return _0x3e8c47[_0xbe8e('0x8')](_0xbe8e('0x9'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xbe8e('0xa'),'fields':[_0xbe8e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d63b24e..908d11c 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 _0x6299=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','info','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','moment','bluebird'];(function(_0x36f66f,_0x5cfe54){var _0x407a47=function(_0x5b0ee9){while(--_0x5b0ee9){_0x36f66f['push'](_0x36f66f['shift']());}};_0x407a47(++_0x5cfe54);}(_0x6299,0x1af));var _0x9629=function(_0x4fba43,_0x1bf047){_0x4fba43=_0x4fba43-0x0;var _0x4cb40c=_0x6299[_0x4fba43];return _0x4cb40c;};'use strict';var _=require(_0x9629('0x0'));var util=require('util');var moment=require(_0x9629('0x1'));var BPromise=require(_0x9629('0x2'));var rs=require(_0x9629('0x3'));var fs=require('fs');var db=require(_0x9629('0x4'))['db'];var utils=require(_0x9629('0x5'));var logger=require(_0x9629('0x6'))(_0x9629('0x7'));var config=require(_0x9629('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48c25e,_0x39e7f8,_0x226a04){return new BPromise(function(_0x2d73af,_0x54f2cb){return client['request'](_0x48c25e,_0x226a04)['then'](function(_0x46eeca){logger['info'](_0x9629('0x9'),_0x39e7f8,'request\x20sent');logger[_0x9629('0xa')](_0x9629('0xb'),_0x39e7f8,_0x9629('0xc'),JSON[_0x9629('0xd')](_0x46eeca));if(_0x46eeca[_0x9629('0xe')]){if(_0x46eeca['error'][_0x9629('0xf')]===0x1f4){logger[_0x9629('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x39e7f8,_0x46eeca[_0x9629('0xe')][_0x9629('0x10')]);return _0x54f2cb(_0x46eeca[_0x9629('0xe')][_0x9629('0x10')]);}logger[_0x9629('0xe')](_0x9629('0x9'),_0x39e7f8,_0x46eeca[_0x9629('0xe')]['message']);return _0x2d73af(_0x46eeca[_0x9629('0xe')][_0x9629('0x10')]);}else{logger['info'](_0x9629('0x9'),_0x39e7f8,_0x9629('0xc'));_0x2d73af(_0x46eeca[_0x9629('0x11')][_0x9629('0x10')]);}})[_0x9629('0x12')](function(_0x1b1c05){logger[_0x9629('0xe')](_0x9629('0x9'),_0x39e7f8,_0x1b1c05);_0x54f2cb(_0x1b1c05);});});}exports[_0x9629('0x13')]=function(_0xf8b902){var _0xc0d4ba=this;return new Promise(function(_0x43f2be,_0x332479){return db[_0x9629('0x14')]['create'](_0xf8b902[_0x9629('0x15')],{'raw':_0xf8b902[_0x9629('0x16')]?_0xf8b902['options'][_0x9629('0x17')]===undefined?!![]:![]:!![]})[_0x9629('0x18')](function(_0xe5f554){logger[_0x9629('0x19')](_0x9629('0x13'),_0xf8b902);logger[_0x9629('0xa')](_0x9629('0x13'),_0xf8b902,JSON[_0x9629('0xd')](_0xe5f554));_0x43f2be(_0xe5f554);})[_0x9629('0x12')](function(_0x9bb6c){logger[_0x9629('0xe')](_0x9629('0x13'),_0x9bb6c['message'],_0xf8b902);_0x332479(_0xc0d4ba[_0x9629('0xe')](0x1f4,_0x9bb6c[_0x9629('0x10')]));});});};exports[_0x9629('0x1a')]=function(_0x39645a){var _0x48086b=this;return new Promise(function(_0x375bb5,_0x188743){return db[_0x9629('0x14')][_0x9629('0x1b')](_0x39645a[_0x9629('0x15')],{'raw':_0x39645a[_0x9629('0x16')]?_0x39645a[_0x9629('0x16')][_0x9629('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39645a[_0x9629('0x16')]?_0x39645a[_0x9629('0x16')][_0x9629('0x1c')]||null:null,'attributes':_0x39645a['options']?_0x39645a[_0x9629('0x16')][_0x9629('0x1d')]||null:null,'limit':_0x39645a[_0x9629('0x16')]?_0x39645a[_0x9629('0x16')][_0x9629('0x1e')]||null:null})[_0x9629('0x18')](function(_0x5bdf99){logger[_0x9629('0x19')](_0x9629('0x1a'),_0x39645a);logger[_0x9629('0xa')](_0x9629('0x1a'),_0x39645a,JSON[_0x9629('0xd')](_0x5bdf99));_0x375bb5(_0x5bdf99);})[_0x9629('0x12')](function(_0x418011){logger[_0x9629('0xe')]('UpdateOpenchannelQueueReport',_0x418011['message'],_0x39645a);_0x188743(_0x48086b[_0x9629('0xe')](0x1f4,_0x418011[_0x9629('0x10')]));});});}; \ No newline at end of file +var _0xa3c0=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','debug','UpdateOpenchannelQueueReport','where','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xe891e2,_0xff02ea){var _0x20d382=function(_0x3e3f6f){while(--_0x3e3f6f){_0xe891e2['push'](_0xe891e2['shift']());}};_0x20d382(++_0xff02ea);}(_0xa3c0,0x11f));var _0x0a3c=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xa3c0[_0x236d24];return _0x1574cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0a3c('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0a3c('0x1'));var logger=require('../../config/logger')(_0x0a3c('0x2'));var config=require(_0x0a3c('0x3'));var jayson=require(_0x0a3c('0x4'));var client=jayson['client'][_0x0a3c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2af764,_0x2ae708,_0x44b2a6){return new BPromise(function(_0x2b118c,_0x4dd56e){return client[_0x0a3c('0x6')](_0x2af764,_0x44b2a6)[_0x0a3c('0x7')](function(_0x4fa4d3){logger[_0x0a3c('0x8')](_0x0a3c('0x9'),_0x2ae708,_0x0a3c('0xa'));logger['debug'](_0x0a3c('0xb'),_0x2ae708,_0x0a3c('0xa'),JSON[_0x0a3c('0xc')](_0x4fa4d3));if(_0x4fa4d3[_0x0a3c('0xd')]){if(_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xe')]===0x1f4){logger['error'](_0x0a3c('0x9'),_0x2ae708,_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);return _0x4dd56e(_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);}logger[_0x0a3c('0xd')](_0x0a3c('0x9'),_0x2ae708,_0x4fa4d3[_0x0a3c('0xd')][_0x0a3c('0xf')]);return _0x2b118c(_0x4fa4d3[_0x0a3c('0xd')]['message']);}else{logger[_0x0a3c('0x8')](_0x0a3c('0x9'),_0x2ae708,_0x0a3c('0xa'));_0x2b118c(_0x4fa4d3[_0x0a3c('0x10')][_0x0a3c('0xf')]);}})[_0x0a3c('0x11')](function(_0x1b6a67){logger[_0x0a3c('0xd')](_0x0a3c('0x9'),_0x2ae708,_0x1b6a67);_0x4dd56e(_0x1b6a67);});});}exports[_0x0a3c('0x12')]=function(_0x1dc1cb){var _0x50a02d=this;return new Promise(function(_0x3c2dd2,_0x12fbe6){return db[_0x0a3c('0x13')]['create'](_0x1dc1cb['body'],{'raw':_0x1dc1cb[_0x0a3c('0x14')]?_0x1dc1cb[_0x0a3c('0x14')][_0x0a3c('0x15')]===undefined?!![]:![]:!![]})[_0x0a3c('0x7')](function(_0x185867){logger[_0x0a3c('0x8')](_0x0a3c('0x12'),_0x1dc1cb);logger[_0x0a3c('0x16')](_0x0a3c('0x12'),_0x1dc1cb,JSON[_0x0a3c('0xc')](_0x185867));_0x3c2dd2(_0x185867);})[_0x0a3c('0x11')](function(_0x128509){logger[_0x0a3c('0xd')](_0x0a3c('0x12'),_0x128509[_0x0a3c('0xf')],_0x1dc1cb);_0x12fbe6(_0x50a02d[_0x0a3c('0xd')](0x1f4,_0x128509['message']));});});};exports[_0x0a3c('0x17')]=function(_0x14da60){var _0x59a837=this;return new Promise(function(_0x4264b4,_0x5242f4){return db['OpenchannelQueueReport']['update'](_0x14da60['body'],{'raw':_0x14da60['options']?_0x14da60[_0x0a3c('0x14')][_0x0a3c('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14da60[_0x0a3c('0x14')]?_0x14da60[_0x0a3c('0x14')][_0x0a3c('0x18')]||null:null,'attributes':_0x14da60['options']?_0x14da60['options']['attributes']||null:null,'limit':_0x14da60[_0x0a3c('0x14')]?_0x14da60[_0x0a3c('0x14')]['limit']||null:null})['then'](function(_0x3cf249){logger['info'](_0x0a3c('0x17'),_0x14da60);logger['debug'](_0x0a3c('0x17'),_0x14da60,JSON['stringify'](_0x3cf249));_0x4264b4(_0x3cf249);})['catch'](function(_0x391c1a){logger['error']('UpdateOpenchannelQueueReport',_0x391c1a[_0x0a3c('0xf')],_0x14da60);_0x5242f4(_0x59a837[_0x0a3c('0xd')](0x1f4,_0x391c1a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index e08909c..1d6efad 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 _0x0f3c=['../../components/interaction/service','isAuthenticated','describe','get','show','post','create','/:id','update','exports','express','Router'];(function(_0x260d17,_0x41db16){var _0x11dc8d=function(_0x1f0492){while(--_0x1f0492){_0x260d17['push'](_0x260d17['shift']());}};_0x11dc8d(++_0x41db16);}(_0x0f3c,0x76));var _0xc0f3=function(_0x24bff6,_0x5bbd0f){_0x24bff6=_0x24bff6-0x0;var _0x39c10f=_0x0f3c[_0x24bff6];return _0x39c10f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xc0f3('0x0'));var router=express[_0xc0f3('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xc0f3('0x2'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xc0f3('0x3')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc0f3('0x4')]);router[_0xc0f3('0x5')]('/:id',auth[_0xc0f3('0x3')](),controller[_0xc0f3('0x6')]);router[_0xc0f3('0x7')]('/',auth[_0xc0f3('0x3')](),controller[_0xc0f3('0x8')]);router['put'](_0xc0f3('0x9'),auth[_0xc0f3('0x3')](),controller[_0xc0f3('0xa')]);router['delete'](_0xc0f3('0x9'),auth[_0xc0f3('0x3')](),controller['destroy']);module[_0xc0f3('0xb')]=router; \ No newline at end of file +var _0x9387=['isAuthenticated','show','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','index','/describe','/:id'];(function(_0x211f6a,_0x1a2e20){var _0x3aaff0=function(_0x1c866d){while(--_0x1c866d){_0x211f6a['push'](_0x211f6a['shift']());}};_0x3aaff0(++_0x1a2e20);}(_0x9387,0x8e));var _0x7938=function(_0x2442ba,_0xc22da){_0x2442ba=_0x2442ba-0x0;var _0x2913d0=_0x9387[_0x2442ba];return _0x2913d0;};'use strict';var multer=require(_0x7938('0x0'));var util=require(_0x7938('0x1'));var path=require(_0x7938('0x2'));var express=require(_0x7938('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x7938('0x4'));var config=require(_0x7938('0x5'));var controller=require(_0x7938('0x6'));router[_0x7938('0x7')]('/',auth['isAuthenticated'](),controller[_0x7938('0x8')]);router[_0x7938('0x7')](_0x7938('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x7938('0x7')](_0x7938('0xa'),auth[_0x7938('0xb')](),controller[_0x7938('0xc')]);router['post']('/',auth[_0x7938('0xb')](),controller['create']);router[_0x7938('0xd')](_0x7938('0xa'),auth[_0x7938('0xb')](),controller[_0x7938('0xe')]);router[_0x7938('0xf')]('/:id',auth[_0x7938('0xb')](),controller[_0x7938('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index f66a386..f99518d 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 _0xa782=['sequelize','exports','STRING','ENUM','agent','queue','DATE','moment'];(function(_0x662abb,_0x197be9){var _0x5945e7=function(_0x47ac2d){while(--_0x47ac2d){_0x662abb['push'](_0x662abb['shift']());}};_0x5945e7(++_0x197be9);}(_0xa782,0x137));var _0x2a78=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xa782[_0x12fc8d];return _0x3f9d04;};'use strict';var moment=require(_0x2a78('0x0'));var Sequelize=require(_0x2a78('0x1'));module[_0x2a78('0x2')]={'uniqueid':{'type':Sequelize[_0x2a78('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x2a78('0x4')]('account',_0x2a78('0x5'),_0x2a78('0x6')),'allowNull':![],'defaultValue':_0x2a78('0x6')},'transferredAt':{'type':Sequelize[_0x2a78('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xfe06=['STRING','ENUM','account','queue','DATE','NOW','sequelize','exports'];(function(_0x19b84f,_0x48765e){var _0x18067b=function(_0x1c69aa){while(--_0x1c69aa){_0x19b84f['push'](_0x19b84f['shift']());}};_0x18067b(++_0x48765e);}(_0xfe06,0x18e));var _0x6fe0=function(_0x7ca275,_0x598d24){_0x7ca275=_0x7ca275-0x0;var _0x20bd00=_0xfe06[_0x7ca275];return _0x20bd00;};'use strict';var moment=require('moment');var Sequelize=require(_0x6fe0('0x0'));module[_0x6fe0('0x1')]={'uniqueid':{'type':Sequelize[_0x6fe0('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x6fe0('0x3')](_0x6fe0('0x4'),'agent',_0x6fe0('0x5')),'allowNull':![],'defaultValue':_0x6fe0('0x5')},'transferredAt':{'type':Sequelize[_0x6fe0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x6fe0('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 89fc74a..1402e20 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 _0xbdbc=['name','send','index','OpenchannelTransferReport','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','sort','where','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','stack'];(function(_0x316469,_0x32a8d4){var _0x43d3ae=function(_0x1dee88){while(--_0x1dee88){_0x316469['push'](_0x316469['shift']());}};_0x43d3ae(++_0x32a8d4);}(_0xbdbc,0xa8));var _0xcbdb=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0xbdbc[_0x360739];return _0x3e23a1;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcbdb('0x0'));var Mustache=require(_0xcbdb('0x1'));var util=require(_0xcbdb('0x2'));var path=require('path');var sox=require(_0xcbdb('0x3'));var csv=require(_0xcbdb('0x4'));var ejs=require(_0xcbdb('0x5'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcbdb('0x6'));var crypto=require(_0xcbdb('0x7'));var jsforce=require(_0xcbdb('0x8'));var deskjs=require(_0xcbdb('0x9'));var toCsv=require('to-csv');var querystring=require(_0xcbdb('0xa'));var Papa=require(_0xcbdb('0xb'));var qs=require(_0xcbdb('0xc'));var logger=require(_0xcbdb('0xd'))(_0xcbdb('0xe'));var utils=require('../../config/utils');var config=require(_0xcbdb('0xf'));var db=require(_0xcbdb('0x10'))['db'];function respondWithStatusCode(_0x22dd5e,_0x1b51b6){_0x1b51b6=_0x1b51b6||0xcc;return function(_0x489d95){if(_0x489d95){return _0x22dd5e[_0xcbdb('0x11')](_0x1b51b6);}return _0x22dd5e['status'](_0x1b51b6)[_0xcbdb('0x12')]();};}function respondWithResult(_0x28eba1,_0x30fbab){_0x30fbab=_0x30fbab||0xc8;return function(_0x11fa63){if(_0x11fa63){return _0x28eba1[_0xcbdb('0x13')](_0x30fbab)[_0xcbdb('0x14')](_0x11fa63);}};}function respondWithFilteredResult(_0x16dae5,_0xdb2a68){return function(_0x1df391){if(_0x1df391){var _0x976374=_0x1df391[_0xcbdb('0x15')],_0x5706b5=_0xdb2a68[_0xcbdb('0x16')],_0x19144b=_0xdb2a68[_0xcbdb('0x16')]+_0xdb2a68[_0xcbdb('0x17')],_0x573dff;if(_0x19144b>=_0x976374){_0x19144b=_0x976374;_0x573dff=0xc8;}else{_0x573dff=0xce;}_0x16dae5['status'](_0x573dff);return _0x16dae5[_0xcbdb('0x18')](_0xcbdb('0x19'),_0x5706b5+'-'+_0x19144b+'/'+_0x976374)['json'](_0x1df391);}return null;};}function patchUpdates(_0x514a8b){return function(_0x4939c8){try{jsonpatch[_0xcbdb('0x1a')](_0x4939c8,_0x514a8b,!![]);}catch(_0x128438){return BPromise[_0xcbdb('0x1b')](_0x128438);}return _0x4939c8['save']();};}function saveUpdates(_0x235a62,_0x1859f7){return function(_0xd5d59f){if(_0xd5d59f){return _0xd5d59f[_0xcbdb('0x1c')](_0x235a62)['then'](function(_0x1c9637){return _0x1c9637;});}return null;};}function removeEntity(_0x2eced9,_0x5e020b){return function(_0x55b9af){if(_0x55b9af){return _0x55b9af[_0xcbdb('0x1d')]()[_0xcbdb('0x1e')](function(){_0x2eced9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15678f,_0x442685){return function(_0x5a39ee){if(!_0x5a39ee){_0x15678f[_0xcbdb('0x11')](0x194);}return _0x5a39ee;};}function handleError(_0x327688,_0x4559f5){_0x4559f5=_0x4559f5||0x1f4;return function(_0x36100c){logger[_0xcbdb('0x1f')](_0x36100c[_0xcbdb('0x20')]);if(_0x36100c['name']){delete _0x36100c[_0xcbdb('0x21')];}_0x327688[_0xcbdb('0x13')](_0x4559f5)[_0xcbdb('0x22')](_0x36100c);};}exports[_0xcbdb('0x23')]=function(_0x3c928f,_0x9b935a){var _0x2d1479={},_0x3638d2={},_0x134193={'count':0x0,'rows':[]};var _0x15df82=db[_0xcbdb('0x24')]['rawAttributes'];_0x3638d2[_0xcbdb('0x25')]=_[_0xcbdb('0x26')](_0x15df82);var _0x392702={'dateStart':_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x28')],'dateEnd':_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x29')]};delete _0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x28')];delete _0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x29')];_0x3638d2[_0xcbdb('0x27')]=_[_0xcbdb('0x26')](_0x3c928f[_0xcbdb('0x27')]);_0x3638d2['filters']=_[_0xcbdb('0x2a')](_0x3638d2['model'],_0x3638d2[_0xcbdb('0x27')]);_0x2d1479['attributes']=_[_0xcbdb('0x2a')](_0x3638d2['model'],qs[_0xcbdb('0x2b')](_0x3c928f['query'][_0xcbdb('0x2b')]));_0x2d1479[_0xcbdb('0x2c')]=_0x2d1479[_0xcbdb('0x2c')][_0xcbdb('0x2d')]?_0x2d1479['attributes']:_0x3638d2[_0xcbdb('0x25')];if(!_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x2e')]('nolimit')){_0x2d1479[_0xcbdb('0x17')]=qs[_0xcbdb('0x17')](_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x17')]);_0x2d1479[_0xcbdb('0x16')]=qs[_0xcbdb('0x16')](_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x16')]);}_0x2d1479['order']=qs[_0xcbdb('0x2f')](_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x2f')]);_0x2d1479[_0xcbdb('0x30')]=qs[_0xcbdb('0x31')](_['pick'](_0x3c928f['query'],_0x3638d2[_0xcbdb('0x31')]));if(_0x392702[_0xcbdb('0x28')]){if(_0x392702[_0xcbdb('0x29')]){_0x392702[_0xcbdb('0x29')]=moment(_0x392702[_0xcbdb('0x29')])[_0xcbdb('0x32')](0x1,_0xcbdb('0x33'));}else{_0x392702[_0xcbdb('0x29')]=moment(_0x392702[_0xcbdb('0x28')])['add'](0x1,'day');}_[_0xcbdb('0x34')](_0x2d1479[_0xcbdb('0x30')],{'createdAt':{'$gte':_0x392702['dateStart'],'$lte':_0x392702[_0xcbdb('0x29')]}});}if(_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x35')]){_0x2d1479['where']=_['merge'](_0x2d1479[_0xcbdb('0x30')],{'$or':_[_0xcbdb('0x36')](_0x2d1479[_0xcbdb('0x2c')],function(_0x59ec0f){var _0x45a80e={};_0x45a80e[_0x59ec0f]={'$like':'%'+_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x35')]+'%'};return _0x45a80e;})});}_0x2d1479=_['merge']({},_0x2d1479,_0x3c928f[_0xcbdb('0x37')]);var _0x2b586e={'where':_0x2d1479[_0xcbdb('0x30')]};return db['OpenchannelTransferReport'][_0xcbdb('0x15')](_0x2b586e)[_0xcbdb('0x1e')](function(_0x5ad4fb){_0x134193['count']=_0x5ad4fb;if(_0x3c928f[_0xcbdb('0x27')][_0xcbdb('0x38')]){_0x2d1479[_0xcbdb('0x39')]=[{'all':!![]}];}return db[_0xcbdb('0x24')][_0xcbdb('0x3a')](_0x2d1479);})['then'](function(_0x3e5b9c){_0x134193[_0xcbdb('0x3b')]=_0x3e5b9c;return _0x134193;})[_0xcbdb('0x1e')](respondWithFilteredResult(_0x9b935a,_0x2d1479))['catch'](handleError(_0x9b935a,null));};exports[_0xcbdb('0x3c')]=function(_0x369122,_0x5ac5ac){var _0x4cdecb={'raw':!![],'where':{'id':_0x369122[_0xcbdb('0x3d')]['id']}},_0x513974={};_0x513974[_0xcbdb('0x25')]=_[_0xcbdb('0x26')](db['OpenchannelTransferReport']['rawAttributes']);_0x513974[_0xcbdb('0x27')]=_['keys'](_0x369122[_0xcbdb('0x27')]);_0x513974['filters']=_[_0xcbdb('0x2a')](_0x513974[_0xcbdb('0x25')],_0x513974['query']);_0x4cdecb[_0xcbdb('0x2c')]=_[_0xcbdb('0x2a')](_0x513974[_0xcbdb('0x25')],qs[_0xcbdb('0x2b')](_0x369122['query'][_0xcbdb('0x2b')]));_0x4cdecb[_0xcbdb('0x2c')]=_0x4cdecb[_0xcbdb('0x2c')][_0xcbdb('0x2d')]?_0x4cdecb[_0xcbdb('0x2c')]:_0x513974[_0xcbdb('0x25')];if(_0x369122[_0xcbdb('0x27')][_0xcbdb('0x38')]){_0x4cdecb['include']=[{'all':!![]}];}_0x4cdecb=_['merge']({},_0x4cdecb,_0x369122['options']);return db[_0xcbdb('0x24')][_0xcbdb('0x3e')](_0x4cdecb)[_0xcbdb('0x1e')](handleEntityNotFound(_0x5ac5ac,null))['then'](respondWithResult(_0x5ac5ac,null))[_0xcbdb('0x3f')](handleError(_0x5ac5ac,null));};exports[_0xcbdb('0x40')]=function(_0x4c3615,_0x57b736){return db['OpenchannelTransferReport'][_0xcbdb('0x40')](_0x4c3615[_0xcbdb('0x41')],{})[_0xcbdb('0x1e')](respondWithResult(_0x57b736,0xc9))[_0xcbdb('0x3f')](handleError(_0x57b736,null));};exports[_0xcbdb('0x1c')]=function(_0x497032,_0x124e1d){if(_0x497032[_0xcbdb('0x41')]['id']){delete _0x497032[_0xcbdb('0x41')]['id'];}return db[_0xcbdb('0x24')][_0xcbdb('0x3e')]({'where':{'id':_0x497032[_0xcbdb('0x3d')]['id']}})['then'](handleEntityNotFound(_0x124e1d,null))[_0xcbdb('0x1e')](saveUpdates(_0x497032[_0xcbdb('0x41')],null))[_0xcbdb('0x1e')](respondWithResult(_0x124e1d,null))[_0xcbdb('0x3f')](handleError(_0x124e1d,null));};exports['destroy']=function(_0x3c804e,_0x51087c){return db[_0xcbdb('0x24')][_0xcbdb('0x3e')]({'where':{'id':_0x3c804e['params']['id']}})['then'](handleEntityNotFound(_0x51087c,null))[_0xcbdb('0x1e')](removeEntity(_0x51087c,null))['catch'](handleError(_0x51087c,null));};exports[_0xcbdb('0x42')]=function(_0x1a3354,_0x2cf176){return db[_0xcbdb('0x24')][_0xcbdb('0x42')]()['then'](respondWithResult(_0x2cf176,null))[_0xcbdb('0x3f')](handleError(_0x2cf176,null));}; \ No newline at end of file +var _0x033e=['findAll','rows','show','find','create','update','body','catch','describe','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','api','../../mysqldb','end','json','count','offset','limit','status','set','Content-Range','apply','destroy','then','sendStatus','error','name','index','OpenchannelTransferReport','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','add','day','where','filter','map','merge','options','includeAll','include'];(function(_0x2db629,_0x316c51){var _0x474ccc=function(_0xcb9c12){while(--_0xcb9c12){_0x2db629['push'](_0x2db629['shift']());}};_0x474ccc(++_0x316c51);}(_0x033e,0x87));var _0xe033=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0x033e[_0x96b6a];return _0x3e16f3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xe033('0x0'));var moment=require(_0xe033('0x1'));var BPromise=require(_0xe033('0x2'));var Mustache=require(_0xe033('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe033('0x4'));var ejs=require(_0xe033('0x5'));var fs=require('fs');var _=require(_0xe033('0x6'));var squel=require(_0xe033('0x7'));var crypto=require('crypto');var jsforce=require(_0xe033('0x8'));var deskjs=require(_0xe033('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe033('0xa'));var Papa=require('papaparse');var qs=require(_0xe033('0xb'));var logger=require('../../config/logger')(_0xe033('0xc'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xe033('0xd'))['db'];function respondWithStatusCode(_0x37d65a,_0x39a78d){_0x39a78d=_0x39a78d||0xcc;return function(_0x2eee42){if(_0x2eee42){return _0x37d65a['sendStatus'](_0x39a78d);}return _0x37d65a['status'](_0x39a78d)[_0xe033('0xe')]();};}function respondWithResult(_0x1b3de5,_0x19c61c){_0x19c61c=_0x19c61c||0xc8;return function(_0x5b8e65){if(_0x5b8e65){return _0x1b3de5['status'](_0x19c61c)[_0xe033('0xf')](_0x5b8e65);}};}function respondWithFilteredResult(_0xdbdfc8,_0x355f2a){return function(_0x574d29){if(_0x574d29){var _0x353d1b=_0x574d29[_0xe033('0x10')],_0x1e7494=_0x355f2a[_0xe033('0x11')],_0x2cb37d=_0x355f2a[_0xe033('0x11')]+_0x355f2a[_0xe033('0x12')],_0x260124;if(_0x2cb37d>=_0x353d1b){_0x2cb37d=_0x353d1b;_0x260124=0xc8;}else{_0x260124=0xce;}_0xdbdfc8[_0xe033('0x13')](_0x260124);return _0xdbdfc8[_0xe033('0x14')](_0xe033('0x15'),_0x1e7494+'-'+_0x2cb37d+'/'+_0x353d1b)['json'](_0x574d29);}return null;};}function patchUpdates(_0x5ab505){return function(_0x7745b1){try{jsonpatch[_0xe033('0x16')](_0x7745b1,_0x5ab505,!![]);}catch(_0x306259){return BPromise['reject'](_0x306259);}return _0x7745b1['save']();};}function saveUpdates(_0x28329b,_0x1f3d29){return function(_0x44fc23){if(_0x44fc23){return _0x44fc23['update'](_0x28329b)['then'](function(_0x27f4e7){return _0x27f4e7;});}return null;};}function removeEntity(_0x578b8c,_0xb3d182){return function(_0x1fae53){if(_0x1fae53){return _0x1fae53[_0xe033('0x17')]()[_0xe033('0x18')](function(){_0x578b8c[_0xe033('0x13')](0xcc)[_0xe033('0xe')]();});}};}function handleEntityNotFound(_0x21fb57,_0x134f93){return function(_0x3bd381){if(!_0x3bd381){_0x21fb57[_0xe033('0x19')](0x194);}return _0x3bd381;};}function handleError(_0x3ef474,_0x2603c5){_0x2603c5=_0x2603c5||0x1f4;return function(_0x36ee92){logger[_0xe033('0x1a')](_0x36ee92['stack']);if(_0x36ee92[_0xe033('0x1b')]){delete _0x36ee92[_0xe033('0x1b')];}_0x3ef474[_0xe033('0x13')](_0x2603c5)['send'](_0x36ee92);};}exports[_0xe033('0x1c')]=function(_0x357ccb,_0x16dd5e){var _0x24e8f5={},_0x1197be={},_0x235003={'count':0x0,'rows':[]};var _0x53dd26=db[_0xe033('0x1d')][_0xe033('0x1e')];_0x1197be[_0xe033('0x1f')]=_[_0xe033('0x20')](_0x53dd26);var _0x5638a3={'dateStart':_0x357ccb['query'][_0xe033('0x21')],'dateEnd':_0x357ccb[_0xe033('0x22')][_0xe033('0x23')]};delete _0x357ccb['query']['dateStart'];delete _0x357ccb[_0xe033('0x22')][_0xe033('0x23')];_0x1197be['query']=_['keys'](_0x357ccb['query']);_0x1197be['filters']=_[_0xe033('0x24')](_0x1197be[_0xe033('0x1f')],_0x1197be[_0xe033('0x22')]);_0x24e8f5[_0xe033('0x25')]=_[_0xe033('0x24')](_0x1197be['model'],qs[_0xe033('0x26')](_0x357ccb[_0xe033('0x22')]['fields']));_0x24e8f5[_0xe033('0x25')]=_0x24e8f5[_0xe033('0x25')][_0xe033('0x27')]?_0x24e8f5[_0xe033('0x25')]:_0x1197be[_0xe033('0x1f')];if(!_0x357ccb[_0xe033('0x22')]['hasOwnProperty'](_0xe033('0x28'))){_0x24e8f5[_0xe033('0x12')]=qs[_0xe033('0x12')](_0x357ccb[_0xe033('0x22')][_0xe033('0x12')]);_0x24e8f5['offset']=qs[_0xe033('0x11')](_0x357ccb[_0xe033('0x22')][_0xe033('0x11')]);}_0x24e8f5[_0xe033('0x29')]=qs[_0xe033('0x2a')](_0x357ccb[_0xe033('0x22')][_0xe033('0x2a')]);_0x24e8f5['where']=qs[_0xe033('0x2b')](_[_0xe033('0x2c')](_0x357ccb[_0xe033('0x22')],_0x1197be[_0xe033('0x2b')]));if(_0x5638a3[_0xe033('0x21')]){if(_0x5638a3['dateEnd']){_0x5638a3[_0xe033('0x23')]=moment(_0x5638a3[_0xe033('0x23')])[_0xe033('0x2d')](0x1,'day');}else{_0x5638a3[_0xe033('0x23')]=moment(_0x5638a3[_0xe033('0x21')])[_0xe033('0x2d')](0x1,_0xe033('0x2e'));}_['merge'](_0x24e8f5[_0xe033('0x2f')],{'createdAt':{'$gte':_0x5638a3[_0xe033('0x21')],'$lte':_0x5638a3['dateEnd']}});}if(_0x357ccb[_0xe033('0x22')][_0xe033('0x30')]){_0x24e8f5[_0xe033('0x2f')]=_['merge'](_0x24e8f5[_0xe033('0x2f')],{'$or':_[_0xe033('0x31')](_0x24e8f5['attributes'],function(_0x52dde6){var _0xa45af0={};_0xa45af0[_0x52dde6]={'$like':'%'+_0x357ccb[_0xe033('0x22')][_0xe033('0x30')]+'%'};return _0xa45af0;})});}_0x24e8f5=_[_0xe033('0x32')]({},_0x24e8f5,_0x357ccb[_0xe033('0x33')]);var _0x323873={'where':_0x24e8f5[_0xe033('0x2f')]};return db[_0xe033('0x1d')][_0xe033('0x10')](_0x323873)['then'](function(_0x3daa9c){_0x235003['count']=_0x3daa9c;if(_0x357ccb[_0xe033('0x22')][_0xe033('0x34')]){_0x24e8f5[_0xe033('0x35')]=[{'all':!![]}];}return db[_0xe033('0x1d')][_0xe033('0x36')](_0x24e8f5);})[_0xe033('0x18')](function(_0x336cb7){_0x235003[_0xe033('0x37')]=_0x336cb7;return _0x235003;})[_0xe033('0x18')](respondWithFilteredResult(_0x16dd5e,_0x24e8f5))['catch'](handleError(_0x16dd5e,null));};exports[_0xe033('0x38')]=function(_0x5df62b,_0x223066){var _0x10c64b={'raw':!![],'where':{'id':_0x5df62b['params']['id']}},_0x4a4d1d={};_0x4a4d1d[_0xe033('0x1f')]=_['keys'](db[_0xe033('0x1d')][_0xe033('0x1e')]);_0x4a4d1d['query']=_[_0xe033('0x20')](_0x5df62b[_0xe033('0x22')]);_0x4a4d1d[_0xe033('0x2b')]=_['intersection'](_0x4a4d1d['model'],_0x4a4d1d['query']);_0x10c64b['attributes']=_['intersection'](_0x4a4d1d[_0xe033('0x1f')],qs[_0xe033('0x26')](_0x5df62b[_0xe033('0x22')][_0xe033('0x26')]));_0x10c64b['attributes']=_0x10c64b[_0xe033('0x25')][_0xe033('0x27')]?_0x10c64b[_0xe033('0x25')]:_0x4a4d1d['model'];if(_0x5df62b[_0xe033('0x22')][_0xe033('0x34')]){_0x10c64b[_0xe033('0x35')]=[{'all':!![]}];}_0x10c64b=_[_0xe033('0x32')]({},_0x10c64b,_0x5df62b[_0xe033('0x33')]);return db[_0xe033('0x1d')][_0xe033('0x39')](_0x10c64b)[_0xe033('0x18')](handleEntityNotFound(_0x223066,null))[_0xe033('0x18')](respondWithResult(_0x223066,null))['catch'](handleError(_0x223066,null));};exports[_0xe033('0x3a')]=function(_0x1113a8,_0x1716c9){return db[_0xe033('0x1d')]['create'](_0x1113a8['body'],{})[_0xe033('0x18')](respondWithResult(_0x1716c9,0xc9))['catch'](handleError(_0x1716c9,null));};exports[_0xe033('0x3b')]=function(_0x2e41ed,_0x5228c5){if(_0x2e41ed[_0xe033('0x3c')]['id']){delete _0x2e41ed[_0xe033('0x3c')]['id'];}return db[_0xe033('0x1d')]['find']({'where':{'id':_0x2e41ed['params']['id']}})[_0xe033('0x18')](handleEntityNotFound(_0x5228c5,null))[_0xe033('0x18')](saveUpdates(_0x2e41ed[_0xe033('0x3c')],null))[_0xe033('0x18')](respondWithResult(_0x5228c5,null))[_0xe033('0x3d')](handleError(_0x5228c5,null));};exports[_0xe033('0x17')]=function(_0x5dee2c,_0x258701){return db[_0xe033('0x1d')][_0xe033('0x39')]({'where':{'id':_0x5dee2c['params']['id']}})[_0xe033('0x18')](handleEntityNotFound(_0x258701,null))[_0xe033('0x18')](removeEntity(_0x258701,null))[_0xe033('0x3d')](handleError(_0x258701,null));};exports['describe']=function(_0x54ce89,_0x3bbe94){return db[_0xe033('0x1d')][_0xe033('0x3e')]()['then'](respondWithResult(_0x3bbe94,null))[_0xe033('0x3d')](handleError(_0x3bbe94,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 53016ae..b0bf243 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 _0x5f2f=['bluebird','request-promise','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x2873c0,_0x19ec35){var _0x453b8b=function(_0x4af8ca){while(--_0x4af8ca){_0x2873c0['push'](_0x2873c0['shift']());}};_0x453b8b(++_0x19ec35);}(_0x5f2f,0x73));var _0xf5f2=function(_0x541dc4,_0xb884e3){_0x541dc4=_0x541dc4-0x0;var _0x26aeda=_0x5f2f[_0x541dc4];return _0x26aeda;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var logger=require(_0xf5f2('0x2'))(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var BPromise=require(_0xf5f2('0x5'));var rp=require(_0xf5f2('0x6'));var attributes=require(_0xf5f2('0x7'));module['exports']=function(_0x4854b6,_0x1665c7){return _0x4854b6[_0xf5f2('0x8')](_0xf5f2('0x9'),attributes,{'tableName':_0xf5f2('0xa'),'paranoid':![],'indexes':[{'name':_0xf5f2('0xb'),'fields':[_0xf5f2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','./openchannelTransferReport.attributes','exports','define'];(function(_0x367bf2,_0x313a29){var _0x109455=function(_0x3eaedd){while(--_0x3eaedd){_0x367bf2['push'](_0x367bf2['shift']());}};_0x109455(++_0x313a29);}(_0x7a54,0x106));var _0x47a5=function(_0x9c55f8,_0x3ccfbc){_0x9c55f8=_0x9c55f8-0x0;var _0x58a1d4=_0x7a54[_0x9c55f8];return _0x58a1d4;};'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 attributes=require(_0x47a5('0x5'));module[_0x47a5('0x6')]=function(_0x2a1a7e,_0x3717e1){return _0x2a1a7e[_0x47a5('0x7')]('OpenchannelTransferReport',attributes,{'tableName':_0x47a5('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 3a8ac7f..9a7bac7 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 _0x13fe=['result','lodash','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','request','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','code','error','OpenchannelTransferReport,\x20%s,\x20%s','message'];(function(_0xe66d72,_0x5b6cb5){var _0x1c51b3=function(_0x510f3b){while(--_0x510f3b){_0xe66d72['push'](_0xe66d72['shift']());}};_0x1c51b3(++_0x5b6cb5);}(_0x13fe,0x131));var _0xe13f=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x13fe[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0xe13f('0x0'));var util=require('util');var moment=require(_0xe13f('0x1'));var BPromise=require('bluebird');var rs=require(_0xe13f('0x2'));var fs=require('fs');var db=require(_0xe13f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe13f('0x4'));var jayson=require(_0xe13f('0x5'));var client=jayson[_0xe13f('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa0e847,_0xb71957,_0x106f42){return new BPromise(function(_0x118f10,_0x16d339){return client[_0xe13f('0x7')](_0xa0e847,_0x106f42)['then'](function(_0x2a272d){logger[_0xe13f('0x8')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xb71957,_0xe13f('0x9'));logger['debug'](_0xe13f('0xa'),_0xb71957,_0xe13f('0x9'),JSON['stringify'](_0x2a272d));if(_0x2a272d['error']){if(_0x2a272d['error'][_0xe13f('0xb')]===0x1f4){logger[_0xe13f('0xc')](_0xe13f('0xd'),_0xb71957,_0x2a272d[_0xe13f('0xc')]['message']);return _0x16d339(_0x2a272d['error'][_0xe13f('0xe')]);}logger[_0xe13f('0xc')](_0xe13f('0xd'),_0xb71957,_0x2a272d[_0xe13f('0xc')][_0xe13f('0xe')]);return _0x118f10(_0x2a272d[_0xe13f('0xc')]['message']);}else{logger[_0xe13f('0x8')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xb71957,'request\x20sent');_0x118f10(_0x2a272d[_0xe13f('0xf')]['message']);}})['catch'](function(_0xfa0cdb){logger[_0xe13f('0xc')](_0xe13f('0xd'),_0xb71957,_0xfa0cdb);_0x16d339(_0xfa0cdb);});});} \ No newline at end of file +var _0xab61=['lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x2f9046,_0x241fb3){var _0x276175=function(_0x29a7ed){while(--_0x29a7ed){_0x2f9046['push'](_0x2f9046['shift']());}};_0x276175(++_0x241fb3);}(_0xab61,0x134));var _0x1ab6=function(_0x282594,_0x59d96c){_0x282594=_0x282594-0x0;var _0x6a619=_0xab61[_0x282594];return _0x6a619;};'use strict';var _=require(_0x1ab6('0x0'));var util=require('util');var moment=require(_0x1ab6('0x1'));var BPromise=require(_0x1ab6('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x1ab6('0x3'));var logger=require(_0x1ab6('0x4'))(_0x1ab6('0x5'));var config=require(_0x1ab6('0x6'));var jayson=require(_0x1ab6('0x7'));var client=jayson[_0x1ab6('0x8')][_0x1ab6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d5ac1,_0x331cdb,_0x264cfb){return new BPromise(function(_0x525755,_0x311fc8){return client['request'](_0x2d5ac1,_0x264cfb)[_0x1ab6('0xa')](function(_0x1a6c13){logger[_0x1ab6('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x331cdb,_0x1ab6('0xc'));logger[_0x1ab6('0xd')](_0x1ab6('0xe'),_0x331cdb,_0x1ab6('0xc'),JSON[_0x1ab6('0xf')](_0x1a6c13));if(_0x1a6c13[_0x1ab6('0x10')]){if(_0x1a6c13['error'][_0x1ab6('0x11')]===0x1f4){logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1a6c13[_0x1ab6('0x10')]['message']);return _0x311fc8(_0x1a6c13[_0x1ab6('0x10')][_0x1ab6('0x13')]);}logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1a6c13['error'][_0x1ab6('0x13')]);return _0x525755(_0x1a6c13[_0x1ab6('0x10')]['message']);}else{logger[_0x1ab6('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x331cdb,_0x1ab6('0xc'));_0x525755(_0x1a6c13[_0x1ab6('0x14')][_0x1ab6('0x13')]);}})[_0x1ab6('0x15')](function(_0x1bae1a){logger[_0x1ab6('0x10')](_0x1ab6('0x12'),_0x331cdb,_0x1bae1a);_0x311fc8(_0x1bae1a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 751bda5..c7301a4 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 _0x9572=['update','delete','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','create','put'];(function(_0x4acf9a,_0x517ad1){var _0xd1bfd9=function(_0x40d56e){while(--_0x40d56e){_0x4acf9a['push'](_0x4acf9a['shift']());}};_0xd1bfd9(++_0x517ad1);}(_0x9572,0x82));var _0x2957=function(_0x2c9d4f,_0x4fdde6){_0x2c9d4f=_0x2c9d4f-0x0;var _0x9c3300=_0x9572[_0x2c9d4f];return _0x9c3300;};'use strict';var multer=require(_0x2957('0x0'));var util=require('util');var path=require(_0x2957('0x1'));var express=require(_0x2957('0x2'));var router=express['Router']();var auth=require(_0x2957('0x3'));var interaction=require(_0x2957('0x4'));var config=require(_0x2957('0x5'));var controller=require(_0x2957('0x6'));router['get']('/',auth[_0x2957('0x7')](),controller[_0x2957('0x8')]);router[_0x2957('0x9')](_0x2957('0xa'),auth['isAuthenticated'](),controller[_0x2957('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2957('0xc')]);router[_0x2957('0xd')](_0x2957('0xa'),auth['isAuthenticated'](),controller[_0x2957('0xe')]);router[_0x2957('0xf')](_0x2957('0xa'),auth[_0x2957('0x7')](),controller[_0x2957('0x10')]);module[_0x2957('0x11')]=router; \ No newline at end of file +var _0x7cc5=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','destroy','exports','multer','util','path','express','Router'];(function(_0x21e834,_0x29609a){var _0x238b7b=function(_0x107fd0){while(--_0x107fd0){_0x21e834['push'](_0x21e834['shift']());}};_0x238b7b(++_0x29609a);}(_0x7cc5,0x199));var _0x57cc=function(_0x28006d,_0x892ccd){_0x28006d=_0x28006d-0x0;var _0x25a2bc=_0x7cc5[_0x28006d];return _0x25a2bc;};'use strict';var multer=require(_0x57cc('0x0'));var util=require(_0x57cc('0x1'));var path=require(_0x57cc('0x2'));var express=require(_0x57cc('0x3'));var router=express[_0x57cc('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x57cc('0x5'));var config=require(_0x57cc('0x6'));var controller=require(_0x57cc('0x7'));router[_0x57cc('0x8')]('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0xa')]);router[_0x57cc('0x8')](_0x57cc('0xb'),auth[_0x57cc('0x9')](),controller[_0x57cc('0xc')]);router['post']('/',auth[_0x57cc('0x9')](),controller[_0x57cc('0xd')]);router[_0x57cc('0xe')]('/:id',auth[_0x57cc('0x9')](),controller[_0x57cc('0xf')]);router['delete'](_0x57cc('0xb'),auth[_0x57cc('0x9')](),controller[_0x57cc('0x10')]);module[_0x57cc('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 0e91746..ca1c752 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 _0xa7fb=['exports','name','sequelize'];(function(_0x3b7f0e,_0x474591){var _0x558417=function(_0x3d72f6){while(--_0x3d72f6){_0x3b7f0e['push'](_0x3b7f0e['shift']());}};_0x558417(++_0x474591);}(_0xa7fb,0xe6));var _0xba7f=function(_0x76d2ec,_0x45ea7c){_0x76d2ec=_0x76d2ec-0x0;var _0x540bdc=_0xa7fb[_0x76d2ec];return _0x540bdc;};'use strict';var Sequelize=require(_0xba7f('0x0'));module[_0xba7f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xba7f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfc67=['name','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xfc67,0x1ce));var _0x7fc6=function(_0x36de4f,_0x350d30){_0x36de4f=_0x36de4f-0x0;var _0x1a91c2=_0xfc67[_0x36de4f];return _0x1a91c2;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x7fc6('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x7fc6('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 69bc507..a165ee6 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 _0x7118=['rawAttributes','find','catch','create','body','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','options','Pause','count','includeAll','include','findAll','show','params'];(function(_0xfb82f6,_0x7eb208){var _0x55da63=function(_0x4b2516){while(--_0x4b2516){_0xfb82f6['push'](_0xfb82f6['shift']());}};_0x55da63(++_0x7eb208);}(_0x7118,0x159));var _0x8711=function(_0x4a761e,_0x5309ed){_0x4a761e=_0x4a761e-0x0;var _0x29dde7=_0x7118[_0x4a761e];return _0x29dde7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8711('0x0'));var BPromise=require(_0x8711('0x1'));var Mustache=require('mustache');var util=require(_0x8711('0x2'));var path=require(_0x8711('0x3'));var sox=require(_0x8711('0x4'));var csv=require(_0x8711('0x5'));var ejs=require(_0x8711('0x6'));var fs=require('fs');var _=require(_0x8711('0x7'));var squel=require(_0x8711('0x8'));var crypto=require('crypto');var jsforce=require(_0x8711('0x9'));var deskjs=require(_0x8711('0xa'));var toCsv=require(_0x8711('0x5'));var querystring=require(_0x8711('0xb'));var Papa=require(_0x8711('0xc'));var qs=require(_0x8711('0xd'));var logger=require(_0x8711('0xe'))(_0x8711('0xf'));var utils=require(_0x8711('0x10'));var config=require(_0x8711('0x11'));var db=require(_0x8711('0x12'))['db'];function respondWithStatusCode(_0x4f74ae,_0x52f3e9){_0x52f3e9=_0x52f3e9||0xcc;return function(_0x2892a2){if(_0x2892a2){return _0x4f74ae[_0x8711('0x13')](_0x52f3e9);}return _0x4f74ae[_0x8711('0x14')](_0x52f3e9)['end']();};}function respondWithResult(_0x561b72,_0x162559){_0x162559=_0x162559||0xc8;return function(_0x89db9a){if(_0x89db9a){return _0x561b72['status'](_0x162559)['json'](_0x89db9a);}};}function respondWithFilteredResult(_0x11adb0,_0x3403f5){return function(_0x25a608){if(_0x25a608){var _0x2758ee=_0x25a608['count'],_0xc0a891=_0x3403f5[_0x8711('0x15')],_0x22f434=_0x3403f5[_0x8711('0x15')]+_0x3403f5[_0x8711('0x16')],_0x16b742;if(_0x22f434>=_0x2758ee){_0x22f434=_0x2758ee;_0x16b742=0xc8;}else{_0x16b742=0xce;}_0x11adb0[_0x8711('0x14')](_0x16b742);return _0x11adb0[_0x8711('0x17')](_0x8711('0x18'),_0xc0a891+'-'+_0x22f434+'/'+_0x2758ee)['json'](_0x25a608);}return null;};}function patchUpdates(_0x2f96a0){return function(_0x2e6f18){try{jsonpatch[_0x8711('0x19')](_0x2e6f18,_0x2f96a0,!![]);}catch(_0xe1e9b3){return BPromise[_0x8711('0x1a')](_0xe1e9b3);}return _0x2e6f18['save']();};}function saveUpdates(_0x5b2bf8,_0x569412){return function(_0x26dfb0){if(_0x26dfb0){return _0x26dfb0[_0x8711('0x1b')](_0x5b2bf8)[_0x8711('0x1c')](function(_0x5305c3){return _0x5305c3;});}return null;};}function removeEntity(_0x5042e1,_0x145549){return function(_0x16e628){if(_0x16e628){return _0x16e628[_0x8711('0x1d')]()[_0x8711('0x1c')](function(){_0x5042e1[_0x8711('0x14')](0xcc)[_0x8711('0x1e')]();});}};}function handleEntityNotFound(_0x142fa7,_0x349fc2){return function(_0xace829){if(!_0xace829){_0x142fa7[_0x8711('0x13')](0x194);}return _0xace829;};}function handleError(_0x4a35f5,_0x2613de){_0x2613de=_0x2613de||0x1f4;return function(_0x31cdc6){logger[_0x8711('0x1f')](_0x31cdc6[_0x8711('0x20')]);if(_0x31cdc6['name']){delete _0x31cdc6[_0x8711('0x21')];}_0x4a35f5[_0x8711('0x14')](_0x2613de)[_0x8711('0x22')](_0x31cdc6);};}exports['index']=function(_0xb20da2,_0x17bf7f){var _0x3e8281={},_0x217197={},_0x3f937b={'count':0x0,'rows':[]};var _0x514956=db['Pause']['rawAttributes'];_0x217197[_0x8711('0x23')]=_[_0x8711('0x24')](_0x514956);var _0x2d0901={'dateStart':_0xb20da2[_0x8711('0x25')][_0x8711('0x26')],'dateEnd':_0xb20da2[_0x8711('0x25')][_0x8711('0x27')]};delete _0xb20da2[_0x8711('0x25')][_0x8711('0x26')];delete _0xb20da2['query'][_0x8711('0x27')];_0x217197['query']=_[_0x8711('0x24')](_0xb20da2[_0x8711('0x25')]);_0x217197[_0x8711('0x28')]=_['intersection'](_0x217197[_0x8711('0x23')],_0x217197['query']);_0x3e8281[_0x8711('0x29')]=_[_0x8711('0x2a')](_0x217197[_0x8711('0x23')],qs['fields'](_0xb20da2['query'][_0x8711('0x2b')]));_0x3e8281[_0x8711('0x29')]=_0x3e8281[_0x8711('0x29')][_0x8711('0x2c')]?_0x3e8281[_0x8711('0x29')]:_0x217197[_0x8711('0x23')];if(!_0xb20da2[_0x8711('0x25')][_0x8711('0x2d')](_0x8711('0x2e'))){_0x3e8281[_0x8711('0x16')]=qs['limit'](_0xb20da2[_0x8711('0x25')][_0x8711('0x16')]);_0x3e8281[_0x8711('0x15')]=qs[_0x8711('0x15')](_0xb20da2[_0x8711('0x25')][_0x8711('0x15')]);}_0x3e8281[_0x8711('0x2f')]=qs[_0x8711('0x30')](_0xb20da2[_0x8711('0x25')][_0x8711('0x30')]);_0x3e8281['where']=qs[_0x8711('0x28')](_[_0x8711('0x31')](_0xb20da2[_0x8711('0x25')],_0x217197[_0x8711('0x28')]));if(_0x2d0901[_0x8711('0x26')]){if(_0x2d0901['dateEnd']){_0x2d0901[_0x8711('0x27')]=moment(_0x2d0901[_0x8711('0x27')])[_0x8711('0x32')](0x1,'day');}else{_0x2d0901[_0x8711('0x27')]=moment(_0x2d0901[_0x8711('0x26')])[_0x8711('0x32')](0x1,_0x8711('0x33'));}_[_0x8711('0x34')](_0x3e8281[_0x8711('0x35')],{'createdAt':{'$gte':_0x2d0901[_0x8711('0x26')],'$lte':_0x2d0901['dateEnd']}});}if(_0xb20da2[_0x8711('0x25')][_0x8711('0x36')]){_0x3e8281[_0x8711('0x35')]=_[_0x8711('0x34')](_0x3e8281['where'],{'$or':_['map'](_0x3e8281[_0x8711('0x29')],function(_0x18b82a){var _0x3074f2={};_0x3074f2[_0x18b82a]={'$like':'%'+_0xb20da2[_0x8711('0x25')][_0x8711('0x36')]+'%'};return _0x3074f2;})});}_0x3e8281=_[_0x8711('0x34')]({},_0x3e8281,_0xb20da2[_0x8711('0x37')]);var _0x2db474={'where':_0x3e8281[_0x8711('0x35')]};return db[_0x8711('0x38')][_0x8711('0x39')](_0x2db474)[_0x8711('0x1c')](function(_0x1efd42){_0x3f937b[_0x8711('0x39')]=_0x1efd42;if(_0xb20da2[_0x8711('0x25')][_0x8711('0x3a')]){_0x3e8281[_0x8711('0x3b')]=[{'all':!![]}];}return db[_0x8711('0x38')][_0x8711('0x3c')](_0x3e8281);})[_0x8711('0x1c')](function(_0x2fb5e8){_0x3f937b['rows']=_0x2fb5e8;return _0x3f937b;})[_0x8711('0x1c')](respondWithFilteredResult(_0x17bf7f,_0x3e8281))['catch'](handleError(_0x17bf7f,null));};exports[_0x8711('0x3d')]=function(_0x3d9562,_0x121971){var _0x38c0c4={'raw':!![],'where':{'id':_0x3d9562[_0x8711('0x3e')]['id']}},_0x5f2c0c={};_0x5f2c0c[_0x8711('0x23')]=_[_0x8711('0x24')](db[_0x8711('0x38')][_0x8711('0x3f')]);_0x5f2c0c[_0x8711('0x25')]=_['keys'](_0x3d9562[_0x8711('0x25')]);_0x5f2c0c[_0x8711('0x28')]=_[_0x8711('0x2a')](_0x5f2c0c[_0x8711('0x23')],_0x5f2c0c['query']);_0x38c0c4[_0x8711('0x29')]=_[_0x8711('0x2a')](_0x5f2c0c[_0x8711('0x23')],qs[_0x8711('0x2b')](_0x3d9562[_0x8711('0x25')]['fields']));_0x38c0c4['attributes']=_0x38c0c4[_0x8711('0x29')][_0x8711('0x2c')]?_0x38c0c4['attributes']:_0x5f2c0c[_0x8711('0x23')];if(_0x3d9562[_0x8711('0x25')][_0x8711('0x3a')]){_0x38c0c4[_0x8711('0x3b')]=[{'all':!![]}];}_0x38c0c4=_['merge']({},_0x38c0c4,_0x3d9562[_0x8711('0x37')]);return db[_0x8711('0x38')][_0x8711('0x40')](_0x38c0c4)['then'](handleEntityNotFound(_0x121971,null))[_0x8711('0x1c')](respondWithResult(_0x121971,null))[_0x8711('0x41')](handleError(_0x121971,null));};exports['create']=function(_0x3e9ab1,_0x14a815){return db['Pause'][_0x8711('0x42')](_0x3e9ab1[_0x8711('0x43')],{})['then'](respondWithResult(_0x14a815,0xc9))[_0x8711('0x41')](handleError(_0x14a815,null));};exports[_0x8711('0x1b')]=function(_0x1c55d8,_0x17a3f5){if(_0x1c55d8['body']['id']){delete _0x1c55d8[_0x8711('0x43')]['id'];}return db[_0x8711('0x38')]['find']({'where':{'id':_0x1c55d8[_0x8711('0x3e')]['id']}})[_0x8711('0x1c')](handleEntityNotFound(_0x17a3f5,null))['then'](saveUpdates(_0x1c55d8['body'],null))['then'](respondWithResult(_0x17a3f5,null))['catch'](handleError(_0x17a3f5,null));};exports[_0x8711('0x1d')]=function(_0x2efca0,_0x1c83f7){return db[_0x8711('0x38')][_0x8711('0x40')]({'where':{'id':_0x2efca0[_0x8711('0x3e')]['id']}})[_0x8711('0x1c')](handleEntityNotFound(_0x1c83f7,null))['then'](removeEntity(_0x1c83f7,null))['catch'](handleError(_0x1c83f7,null));}; \ No newline at end of file +var _0x3fa4=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','index','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','Pause','catch','find','create','body','params','fast-json-patch','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils'];(function(_0x50ee2b,_0x1c3e94){var _0x188f2f=function(_0x29ca57){while(--_0x29ca57){_0x50ee2b['push'](_0x50ee2b['shift']());}};_0x188f2f(++_0x1c3e94);}(_0x3fa4,0xf0));var _0x43fa=function(_0x58f6b4,_0x2e6835){_0x58f6b4=_0x58f6b4-0x0;var _0xc263d7=_0x3fa4[_0x58f6b4];return _0xc263d7;};'use strict';var jsonpatch=require(_0x43fa('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43fa('0x1'));var util=require(_0x43fa('0x2'));var path=require(_0x43fa('0x3'));var sox=require(_0x43fa('0x4'));var csv=require(_0x43fa('0x5'));var ejs=require(_0x43fa('0x6'));var fs=require('fs');var _=require(_0x43fa('0x7'));var squel=require('squel');var crypto=require(_0x43fa('0x8'));var jsforce=require(_0x43fa('0x9'));var deskjs=require(_0x43fa('0xa'));var toCsv=require('to-csv');var querystring=require(_0x43fa('0xb'));var Papa=require(_0x43fa('0xc'));var qs=require(_0x43fa('0xd'));var logger=require('../../config/logger')(_0x43fa('0xe'));var utils=require(_0x43fa('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe0c8cd,_0x388c29){_0x388c29=_0x388c29||0xcc;return function(_0x136821){if(_0x136821){return _0xe0c8cd[_0x43fa('0x10')](_0x388c29);}return _0xe0c8cd[_0x43fa('0x11')](_0x388c29)['end']();};}function respondWithResult(_0x464e7b,_0x1b50ee){_0x1b50ee=_0x1b50ee||0xc8;return function(_0x13df33){if(_0x13df33){return _0x464e7b['status'](_0x1b50ee)[_0x43fa('0x12')](_0x13df33);}};}function respondWithFilteredResult(_0x4353c1,_0x4665c1){return function(_0x529c85){if(_0x529c85){var _0x24fb1e=_0x529c85[_0x43fa('0x13')],_0x4bb4b0=_0x4665c1['offset'],_0x5bc292=_0x4665c1[_0x43fa('0x14')]+_0x4665c1[_0x43fa('0x15')],_0x4fba54;if(_0x5bc292>=_0x24fb1e){_0x5bc292=_0x24fb1e;_0x4fba54=0xc8;}else{_0x4fba54=0xce;}_0x4353c1['status'](_0x4fba54);return _0x4353c1[_0x43fa('0x16')](_0x43fa('0x17'),_0x4bb4b0+'-'+_0x5bc292+'/'+_0x24fb1e)[_0x43fa('0x12')](_0x529c85);}return null;};}function patchUpdates(_0x2439d4){return function(_0x2c68e0){try{jsonpatch[_0x43fa('0x18')](_0x2c68e0,_0x2439d4,!![]);}catch(_0x5d12ac){return BPromise['reject'](_0x5d12ac);}return _0x2c68e0[_0x43fa('0x19')]();};}function saveUpdates(_0x29b8aa,_0x1c2463){return function(_0x1d7adc){if(_0x1d7adc){return _0x1d7adc[_0x43fa('0x1a')](_0x29b8aa)[_0x43fa('0x1b')](function(_0xdf68a6){return _0xdf68a6;});}return null;};}function removeEntity(_0x2d8594,_0x3e39b7){return function(_0x4f8492){if(_0x4f8492){return _0x4f8492[_0x43fa('0x1c')]()[_0x43fa('0x1b')](function(){_0x2d8594[_0x43fa('0x11')](0xcc)[_0x43fa('0x1d')]();});}};}function handleEntityNotFound(_0x38c162,_0x4a98bb){return function(_0x2c6075){if(!_0x2c6075){_0x38c162[_0x43fa('0x10')](0x194);}return _0x2c6075;};}function handleError(_0x2db3dd,_0xa34fc6){_0xa34fc6=_0xa34fc6||0x1f4;return function(_0x194936){logger[_0x43fa('0x1e')](_0x194936[_0x43fa('0x1f')]);if(_0x194936[_0x43fa('0x20')]){delete _0x194936[_0x43fa('0x20')];}_0x2db3dd['status'](_0xa34fc6)['send'](_0x194936);};}exports[_0x43fa('0x21')]=function(_0x197eac,_0x28f695){var _0x78f105={},_0x40969a={},_0x243dda={'count':0x0,'rows':[]};var _0x5014fb=db['Pause'][_0x43fa('0x22')];_0x40969a[_0x43fa('0x23')]=_[_0x43fa('0x24')](_0x5014fb);var _0x4d88b1={'dateStart':_0x197eac['query'][_0x43fa('0x25')],'dateEnd':_0x197eac[_0x43fa('0x26')][_0x43fa('0x27')]};delete _0x197eac[_0x43fa('0x26')]['dateStart'];delete _0x197eac[_0x43fa('0x26')][_0x43fa('0x27')];_0x40969a[_0x43fa('0x26')]=_[_0x43fa('0x24')](_0x197eac[_0x43fa('0x26')]);_0x40969a[_0x43fa('0x28')]=_[_0x43fa('0x29')](_0x40969a[_0x43fa('0x23')],_0x40969a[_0x43fa('0x26')]);_0x78f105[_0x43fa('0x2a')]=_[_0x43fa('0x29')](_0x40969a[_0x43fa('0x23')],qs['fields'](_0x197eac['query'][_0x43fa('0x2b')]));_0x78f105[_0x43fa('0x2a')]=_0x78f105[_0x43fa('0x2a')][_0x43fa('0x2c')]?_0x78f105['attributes']:_0x40969a[_0x43fa('0x23')];if(!_0x197eac[_0x43fa('0x26')][_0x43fa('0x2d')]('nolimit')){_0x78f105[_0x43fa('0x15')]=qs[_0x43fa('0x15')](_0x197eac[_0x43fa('0x26')][_0x43fa('0x15')]);_0x78f105['offset']=qs[_0x43fa('0x14')](_0x197eac['query'][_0x43fa('0x14')]);}_0x78f105[_0x43fa('0x2e')]=qs[_0x43fa('0x2f')](_0x197eac['query'][_0x43fa('0x2f')]);_0x78f105['where']=qs['filters'](_[_0x43fa('0x30')](_0x197eac[_0x43fa('0x26')],_0x40969a[_0x43fa('0x28')]));if(_0x4d88b1['dateStart']){if(_0x4d88b1[_0x43fa('0x27')]){_0x4d88b1[_0x43fa('0x27')]=moment(_0x4d88b1[_0x43fa('0x27')])[_0x43fa('0x31')](0x1,_0x43fa('0x32'));}else{_0x4d88b1['dateEnd']=moment(_0x4d88b1[_0x43fa('0x25')])[_0x43fa('0x31')](0x1,_0x43fa('0x32'));}_[_0x43fa('0x33')](_0x78f105['where'],{'createdAt':{'$gte':_0x4d88b1['dateStart'],'$lte':_0x4d88b1[_0x43fa('0x27')]}});}if(_0x197eac[_0x43fa('0x26')][_0x43fa('0x34')]){_0x78f105[_0x43fa('0x35')]=_[_0x43fa('0x33')](_0x78f105['where'],{'$or':_[_0x43fa('0x36')](_0x78f105['attributes'],function(_0x4cb1bd){var _0x236332={};_0x236332[_0x4cb1bd]={'$like':'%'+_0x197eac['query'][_0x43fa('0x34')]+'%'};return _0x236332;})});}_0x78f105=_[_0x43fa('0x33')]({},_0x78f105,_0x197eac[_0x43fa('0x37')]);var _0x17403c={'where':_0x78f105['where']};return db['Pause']['count'](_0x17403c)[_0x43fa('0x1b')](function(_0x15ef49){_0x243dda['count']=_0x15ef49;if(_0x197eac[_0x43fa('0x26')][_0x43fa('0x38')]){_0x78f105[_0x43fa('0x39')]=[{'all':!![]}];}return db[_0x43fa('0x3a')]['findAll'](_0x78f105);})[_0x43fa('0x1b')](function(_0x23e156){_0x243dda['rows']=_0x23e156;return _0x243dda;})['then'](respondWithFilteredResult(_0x28f695,_0x78f105))[_0x43fa('0x3b')](handleError(_0x28f695,null));};exports['show']=function(_0x3a6d39,_0x137ef){var _0x5cef1e={'raw':!![],'where':{'id':_0x3a6d39['params']['id']}},_0x4735d1={};_0x4735d1[_0x43fa('0x23')]=_[_0x43fa('0x24')](db[_0x43fa('0x3a')]['rawAttributes']);_0x4735d1[_0x43fa('0x26')]=_[_0x43fa('0x24')](_0x3a6d39[_0x43fa('0x26')]);_0x4735d1[_0x43fa('0x28')]=_[_0x43fa('0x29')](_0x4735d1[_0x43fa('0x23')],_0x4735d1['query']);_0x5cef1e[_0x43fa('0x2a')]=_['intersection'](_0x4735d1[_0x43fa('0x23')],qs['fields'](_0x3a6d39[_0x43fa('0x26')][_0x43fa('0x2b')]));_0x5cef1e[_0x43fa('0x2a')]=_0x5cef1e[_0x43fa('0x2a')][_0x43fa('0x2c')]?_0x5cef1e['attributes']:_0x4735d1[_0x43fa('0x23')];if(_0x3a6d39['query']['includeAll']){_0x5cef1e['include']=[{'all':!![]}];}_0x5cef1e=_[_0x43fa('0x33')]({},_0x5cef1e,_0x3a6d39[_0x43fa('0x37')]);return db[_0x43fa('0x3a')][_0x43fa('0x3c')](_0x5cef1e)[_0x43fa('0x1b')](handleEntityNotFound(_0x137ef,null))['then'](respondWithResult(_0x137ef,null))[_0x43fa('0x3b')](handleError(_0x137ef,null));};exports[_0x43fa('0x3d')]=function(_0x305e90,_0x19b0f0){return db[_0x43fa('0x3a')][_0x43fa('0x3d')](_0x305e90[_0x43fa('0x3e')],{})[_0x43fa('0x1b')](respondWithResult(_0x19b0f0,0xc9))[_0x43fa('0x3b')](handleError(_0x19b0f0,null));};exports[_0x43fa('0x1a')]=function(_0x1ae6e0,_0x52d66f){if(_0x1ae6e0[_0x43fa('0x3e')]['id']){delete _0x1ae6e0[_0x43fa('0x3e')]['id'];}return db['Pause'][_0x43fa('0x3c')]({'where':{'id':_0x1ae6e0['params']['id']}})[_0x43fa('0x1b')](handleEntityNotFound(_0x52d66f,null))[_0x43fa('0x1b')](saveUpdates(_0x1ae6e0[_0x43fa('0x3e')],null))[_0x43fa('0x1b')](respondWithResult(_0x52d66f,null))[_0x43fa('0x3b')](handleError(_0x52d66f,null));};exports['destroy']=function(_0x1bbae4,_0x4a24f1){return db[_0x43fa('0x3a')][_0x43fa('0x3c')]({'where':{'id':_0x1bbae4[_0x43fa('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4a24f1,null))['then'](removeEntity(_0x4a24f1,null))[_0x43fa('0x3b')](handleError(_0x4a24f1,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index b2e6e32..55f91a5 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 _0xddf0=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x209e41,_0x3ea44a){var _0x5440ef=function(_0x3b997d){while(--_0x3b997d){_0x209e41['push'](_0x209e41['shift']());}};_0x5440ef(++_0x3ea44a);}(_0xddf0,0x194));var _0x0ddf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xddf0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0ddf('0x0'));var util=require(_0x0ddf('0x1'));var logger=require(_0x0ddf('0x2'))(_0x0ddf('0x3'));var moment=require('moment');var BPromise=require(_0x0ddf('0x4'));var rp=require(_0x0ddf('0x5'));var attributes=require('./pause.attributes');module[_0x0ddf('0x6')]=function(_0x403726,_0x2191c1){return _0x403726[_0x0ddf('0x7')](_0x0ddf('0x8'),attributes,{'tableName':_0x0ddf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde3e=['request-promise','./pause.attributes','exports','define','Pause','tools_pauses','util','../../config/logger','moment','bluebird'];(function(_0x54691d,_0x391ae4){var _0x4636bd=function(_0x4972a7){while(--_0x4972a7){_0x54691d['push'](_0x54691d['shift']());}};_0x4636bd(++_0x391ae4);}(_0xde3e,0xf6));var _0xede3=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xde3e[_0x5d4607];return _0x5e4a86;};'use strict';var _=require('lodash');var util=require(_0xede3('0x0'));var logger=require(_0xede3('0x1'))('api');var moment=require(_0xede3('0x2'));var BPromise=require(_0xede3('0x3'));var rp=require(_0xede3('0x4'));var attributes=require(_0xede3('0x5'));module[_0xede3('0x6')]=function(_0x3e84b7,_0xef77ef){return _0x3e84b7[_0xede3('0x7')](_0xede3('0x8'),attributes,{'tableName':_0xede3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index e1b4a75..29f627a 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 _0xacb1=['stringify','error','code','Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xacb1,0x1c2));var _0x1acb=function(_0x37afba,_0x21b12d){_0x37afba=_0x37afba-0x0;var _0x4af0b5=_0xacb1[_0x37afba];return _0x4af0b5;};'use strict';var _=require(_0x1acb('0x0'));var util=require(_0x1acb('0x1'));var moment=require(_0x1acb('0x2'));var BPromise=require(_0x1acb('0x3'));var rs=require(_0x1acb('0x4'));var fs=require('fs');var db=require(_0x1acb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1acb('0x6'))('rpc');var config=require(_0x1acb('0x7'));var jayson=require(_0x1acb('0x8'));var client=jayson[_0x1acb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x663e6f,_0xbba8b7,_0x3547d0){return new BPromise(function(_0x3b996f,_0x7f9551){return client[_0x1acb('0xa')](_0x663e6f,_0x3547d0)[_0x1acb('0xb')](function(_0x6b36bf){logger[_0x1acb('0xc')]('Pause,\x20%s,\x20%s',_0xbba8b7,_0x1acb('0xd'));logger[_0x1acb('0xe')]('Pause,\x20%s,\x20%s,\x20%s',_0xbba8b7,_0x1acb('0xd'),JSON[_0x1acb('0xf')](_0x6b36bf));if(_0x6b36bf[_0x1acb('0x10')]){if(_0x6b36bf[_0x1acb('0x10')][_0x1acb('0x11')]===0x1f4){logger[_0x1acb('0x10')](_0x1acb('0x12'),_0xbba8b7,_0x6b36bf['error'][_0x1acb('0x13')]);return _0x7f9551(_0x6b36bf[_0x1acb('0x10')][_0x1acb('0x13')]);}logger[_0x1acb('0x10')]('Pause,\x20%s,\x20%s',_0xbba8b7,_0x6b36bf[_0x1acb('0x10')][_0x1acb('0x13')]);return _0x3b996f(_0x6b36bf[_0x1acb('0x10')]['message']);}else{logger[_0x1acb('0xc')](_0x1acb('0x12'),_0xbba8b7,_0x1acb('0xd'));_0x3b996f(_0x6b36bf[_0x1acb('0x14')][_0x1acb('0x13')]);}})[_0x1acb('0x15')](function(_0x5d7d8d){logger['error'](_0x1acb('0x12'),_0xbba8b7,_0x5d7d8d);_0x7f9551(_0x5d7d8d);});});}exports[_0x1acb('0x16')]=function(_0x553df4){var _0x1c8db6=this;return new Promise(function(_0x17ae6b,_0x4b1ab5){return db[_0x1acb('0x17')]['find']({'raw':_0x553df4[_0x1acb('0x18')]?_0x553df4[_0x1acb('0x18')][_0x1acb('0x19')]===undefined?!![]:![]:!![],'where':_0x553df4['options']?_0x553df4[_0x1acb('0x18')][_0x1acb('0x1a')]||null:null,'attributes':_0x553df4[_0x1acb('0x18')]?_0x553df4[_0x1acb('0x18')][_0x1acb('0x1b')]||null:null,'include':_0x553df4[_0x1acb('0x18')]?_0x553df4['options'][_0x1acb('0x1c')]?_[_0x1acb('0x1d')](_0x553df4['options'][_0x1acb('0x1c')],function(_0x44dcf2){return{'model':db[_0x44dcf2[_0x1acb('0x1e')]],'as':_0x44dcf2['as'],'attributes':_0x44dcf2[_0x1acb('0x1b')],'include':_0x44dcf2[_0x1acb('0x1c')]?_[_0x1acb('0x1d')](_0x44dcf2['include'],function(_0x492087){return{'model':db[_0x492087[_0x1acb('0x1e')]],'as':_0x492087['as'],'attributes':_0x492087[_0x1acb('0x1b')],'include':_0x492087['include']?_['map'](_0x492087[_0x1acb('0x1c')],function(_0x165790){return{'model':db[_0x165790[_0x1acb('0x1e')]],'as':_0x165790['as'],'attributes':_0x165790['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4596a5){logger[_0x1acb('0xc')](_0x1acb('0x16'),_0x553df4);logger['debug']('ShowPause',_0x553df4,JSON['stringify'](_0x4596a5));_0x17ae6b(_0x4596a5);})[_0x1acb('0x15')](function(_0x5544d9){logger[_0x1acb('0x10')](_0x1acb('0x16'),_0x5544d9[_0x1acb('0x13')],_0x553df4);_0x4b1ab5(_0x1c8db6[_0x1acb('0x10')](0x1f4,_0x5544d9['message']));});});}; \ No newline at end of file +var _0x75e4=['message','result','ShowPause','find','options','raw','where','attributes','include','model','map','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x75e4,0x105));var _0x475e=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x75e4[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x475e('0x0'));var util=require(_0x475e('0x1'));var moment=require(_0x475e('0x2'));var BPromise=require(_0x475e('0x3'));var rs=require(_0x475e('0x4'));var fs=require('fs');var db=require(_0x475e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x475e('0x6'))(_0x475e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x475e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533139,_0x27c446,_0x47a194){return new BPromise(function(_0xf2b6b4,_0x43f5ff){return client[_0x475e('0x9')](_0x533139,_0x47a194)[_0x475e('0xa')](function(_0x5bf385){logger['info'](_0x475e('0xb'),_0x27c446,_0x475e('0xc'));logger[_0x475e('0xd')](_0x475e('0xe'),_0x27c446,_0x475e('0xc'),JSON[_0x475e('0xf')](_0x5bf385));if(_0x5bf385[_0x475e('0x10')]){if(_0x5bf385[_0x475e('0x10')][_0x475e('0x11')]===0x1f4){logger[_0x475e('0x10')](_0x475e('0xb'),_0x27c446,_0x5bf385['error']['message']);return _0x43f5ff(_0x5bf385[_0x475e('0x10')][_0x475e('0x12')]);}logger[_0x475e('0x10')](_0x475e('0xb'),_0x27c446,_0x5bf385['error'][_0x475e('0x12')]);return _0xf2b6b4(_0x5bf385[_0x475e('0x10')]['message']);}else{logger['info'](_0x475e('0xb'),_0x27c446,_0x475e('0xc'));_0xf2b6b4(_0x5bf385[_0x475e('0x13')][_0x475e('0x12')]);}})['catch'](function(_0x377466){logger['error'](_0x475e('0xb'),_0x27c446,_0x377466);_0x43f5ff(_0x377466);});});}exports[_0x475e('0x14')]=function(_0x4ca488){var _0x44128b=this;return new Promise(function(_0x589263,_0x2c7ef0){return db['Pause'][_0x475e('0x15')]({'raw':_0x4ca488[_0x475e('0x16')]?_0x4ca488[_0x475e('0x16')][_0x475e('0x17')]===undefined?!![]:![]:!![],'where':_0x4ca488['options']?_0x4ca488[_0x475e('0x16')][_0x475e('0x18')]||null:null,'attributes':_0x4ca488[_0x475e('0x16')]?_0x4ca488[_0x475e('0x16')][_0x475e('0x19')]||null:null,'include':_0x4ca488['options']?_0x4ca488[_0x475e('0x16')][_0x475e('0x1a')]?_['map'](_0x4ca488[_0x475e('0x16')][_0x475e('0x1a')],function(_0x2af8d9){return{'model':db[_0x2af8d9[_0x475e('0x1b')]],'as':_0x2af8d9['as'],'attributes':_0x2af8d9[_0x475e('0x19')],'include':_0x2af8d9['include']?_['map'](_0x2af8d9[_0x475e('0x1a')],function(_0x27b36b){return{'model':db[_0x27b36b[_0x475e('0x1b')]],'as':_0x27b36b['as'],'attributes':_0x27b36b[_0x475e('0x19')],'include':_0x27b36b[_0x475e('0x1a')]?_[_0x475e('0x1c')](_0x27b36b[_0x475e('0x1a')],function(_0x2972b3){return{'model':db[_0x2972b3[_0x475e('0x1b')]],'as':_0x2972b3['as'],'attributes':_0x2972b3[_0x475e('0x19')]};}):[]};}):[]};}):[]:[]})[_0x475e('0xa')](function(_0x510c2c){logger[_0x475e('0x1d')](_0x475e('0x14'),_0x4ca488);logger['debug'](_0x475e('0x14'),_0x4ca488,JSON['stringify'](_0x510c2c));_0x589263(_0x510c2c);})[_0x475e('0x1e')](function(_0x41a116){logger[_0x475e('0x10')](_0x475e('0x14'),_0x41a116[_0x475e('0x12')],_0x4ca488);_0x2c7ef0(_0x44128b['error'](0x1f4,_0x41a116[_0x475e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index fa1f37e..9d4950e 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 _0xddfb=['isAuthenticated','index','webhookGet','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','%s-%s%s','extname','now','upload','post','/webhook','webhookPost','put','/:id','delete','exports','multer','path','Router','../../components/interaction/service','./plugin.controller','get'];(function(_0x5900b6,_0x542703){var _0x33347b=function(_0x4971d6){while(--_0x4971d6){_0x5900b6['push'](_0x5900b6['shift']());}};_0x33347b(++_0x542703);}(_0xddfb,0x6a));var _0xbddf=function(_0x3f66d6,_0x174f84){_0x3f66d6=_0x3f66d6-0x0;var _0x1e1184=_0xddfb[_0x3f66d6];return _0x1e1184;};'use strict';var multer=require(_0xbddf('0x0'));var util=require('util');var path=require(_0xbddf('0x1'));var express=require('express');var router=express[_0xbddf('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xbddf('0x3'));var config=require('../../config/environment');var controller=require(_0xbddf('0x4'));router[_0xbddf('0x5')]('/',auth[_0xbddf('0x6')](),controller[_0xbddf('0x7')]);router[_0xbddf('0x5')]('/webhook',controller[_0xbddf('0x8')]);router[_0xbddf('0x5')]('/:id',auth[_0xbddf('0x6')](),controller[_0xbddf('0x9')]);router[_0xbddf('0x5')](_0xbddf('0xa'),auth['isAuthenticated'](),controller[_0xbddf('0xb')]);var upload=multer({'storage':multer[_0xbddf('0xc')]({'destination':function(_0x823552,_0x5c98fe,_0x36702b){_0x36702b(null,path[_0xbddf('0xd')](config[_0xbddf('0xe')],_0xbddf('0xf')));},'filename':function(_0x3a9496,_0x2a6bf5,_0x9bccd9){_0x2a6bf5['originalname']=_0x2a6bf5[_0xbddf('0x10')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9bccd9(null,util['format'](_0xbddf('0x11'),path['basename'](_0x2a6bf5[_0xbddf('0x10')],path[_0xbddf('0x12')](_0x2a6bf5['originalname'])),Date[_0xbddf('0x13')](),path[_0xbddf('0x12')](_0x2a6bf5[_0xbddf('0x10')])));}})});router['post']('/',upload['single']('file'),controller[_0xbddf('0x14')]);router[_0xbddf('0x15')](_0xbddf('0x16'),controller[_0xbddf('0x17')]);router[_0xbddf('0x18')](_0xbddf('0x19'),auth[_0xbddf('0x6')](),controller['update']);router['delete'](_0xbddf('0x19'),auth['isAuthenticated'](),controller[_0xbddf('0x1a')]);module[_0xbddf('0x1b')]=router; \ No newline at end of file +var _0xe8ea=['basename','extname','now','file','upload','post','webhookPost','put','/:id','update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','webhookGet','show','/:id/download','download','join','root','originalname','replace','format'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe8ea,0xbf));var _0xae8e=function(_0x156c41,_0x171054){_0x156c41=_0x156c41-0x0;var _0x410adf=_0xe8ea[_0x156c41];return _0x410adf;};'use strict';var multer=require('multer');var util=require(_0xae8e('0x0'));var path=require(_0xae8e('0x1'));var express=require('express');var router=express[_0xae8e('0x2')]();var auth=require(_0xae8e('0x3'));var interaction=require(_0xae8e('0x4'));var config=require(_0xae8e('0x5'));var controller=require(_0xae8e('0x6'));router[_0xae8e('0x7')]('/',auth[_0xae8e('0x8')](),controller[_0xae8e('0x9')]);router[_0xae8e('0x7')]('/webhook',controller[_0xae8e('0xa')]);router[_0xae8e('0x7')]('/:id',auth[_0xae8e('0x8')](),controller[_0xae8e('0xb')]);router[_0xae8e('0x7')](_0xae8e('0xc'),auth['isAuthenticated'](),controller[_0xae8e('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x582c50,_0xcec17e,_0x245017){_0x245017(null,path[_0xae8e('0xe')](config[_0xae8e('0xf')],'server/files/plugins'));},'filename':function(_0x7e198a,_0x3f772e,_0x135685){_0x3f772e[_0xae8e('0x10')]=_0x3f772e[_0xae8e('0x10')][_0xae8e('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x135685(null,util[_0xae8e('0x12')]('%s-%s%s',path[_0xae8e('0x13')](_0x3f772e[_0xae8e('0x10')],path[_0xae8e('0x14')](_0x3f772e['originalname'])),Date[_0xae8e('0x15')](),path[_0xae8e('0x14')](_0x3f772e['originalname'])));}})});router['post']('/',upload['single'](_0xae8e('0x16')),controller[_0xae8e('0x17')]);router[_0xae8e('0x18')]('/webhook',controller[_0xae8e('0x19')]);router[_0xae8e('0x1a')](_0xae8e('0x1b'),auth[_0xae8e('0x8')](),controller[_0xae8e('0x1c')]);router['delete'](_0xae8e('0x1b'),auth['isAuthenticated'](),controller['delete']);module[_0xae8e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2392032..29690d7 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 _0x410e=['html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','sequelize','exports','STRING','ENUM'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x410e,0xe6));var _0xe410=function(_0x535b69,_0x4c4fdb){_0x535b69=_0x535b69-0x0;var _0x1c4848=_0x410e[_0x535b69];return _0x1c4848;};'use strict';var Sequelize=require(_0xe410('0x0'));module[_0xe410('0x1')]={'name':{'type':Sequelize[_0xe410('0x2')]},'type':{'type':Sequelize[_0xe410('0x3')](_0xe410('0x4'),_0xe410('0x5'))},'description':{'type':Sequelize[_0xe410('0x6')]},'version':{'type':Sequelize[_0xe410('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0xe410('0x7')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xe410('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0xe410('0x9'),_0xe410('0xa'),'always',_0xe410('0xb')),'defaultValue':_0xe410('0xc'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe410('0x2')]},'scriptName':{'type':Sequelize[_0xe410('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x826f=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','never','always','sequelize','exports','STRING','ENUM','script','TEXT','BOOLEAN'];(function(_0x120f6b,_0x18933a){var _0x2275bc=function(_0x231fad){while(--_0x231fad){_0x120f6b['push'](_0x120f6b['shift']());}};_0x2275bc(++_0x18933a);}(_0x826f,0x143));var _0xf826=function(_0x3d734c,_0x4b30f8){_0x3d734c=_0x3d734c-0x0;var _0x3cad96=_0x826f[_0x3d734c];return _0x3cad96;};'use strict';var Sequelize=require(_0xf826('0x0'));module[_0xf826('0x1')]={'name':{'type':Sequelize[_0xf826('0x2')]},'type':{'type':Sequelize[_0xf826('0x3')]('html',_0xf826('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0xf826('0x5')]},'path':{'type':Sequelize[_0xf826('0x2')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf826('0x6')],'defaultValue':0x0,'comment':_0xf826('0x7')},'sidebar':{'type':Sequelize[_0xf826('0x3')](_0xf826('0x8'),'agentOnly','always',_0xf826('0x9')),'defaultValue':_0xf826('0xa'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xf826('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xf826('0x2')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5f9eb6b..e6c0cc0 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 _0x89a2=['Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','body','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','%s%s','headers','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','http://localhost:','method','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','extract-zip','rimraf','archiver','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','register','sendStatus','status','end','count','offset','limit','set','reject','save','then','destroy','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','filter','merge','options','Plugin','include','findAll','rows','catch','params','includeAll','find','download','path','join','root','createWriteStream','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','**/*','server/files/plugins','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','format','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','type','html','views'];(function(_0xe5ea74,_0x4713dd){var _0x54f245=function(_0x1b8a17){while(--_0x1b8a17){_0xe5ea74['push'](_0xe5ea74['shift']());}};_0x54f245(++_0x4713dd);}(_0x89a2,0x169));var _0x289a=function(_0x1f239e,_0x367b43){_0x1f239e=_0x1f239e-0x0;var _0x826971=_0x89a2[_0x1f239e];return _0x826971;};'use strict';var jsonpatch=require(_0x289a('0x0'));var rp=require(_0x289a('0x1'));var moment=require(_0x289a('0x2'));var BPromise=require(_0x289a('0x3'));var Mustache=require('mustache');var util=require(_0x289a('0x4'));var path=require('path');var sox=require(_0x289a('0x5'));var csv=require(_0x289a('0x6'));var ejs=require(_0x289a('0x7'));var fs=require('fs');var _=require(_0x289a('0x8'));var squel=require(_0x289a('0x9'));var crypto=require(_0x289a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x289a('0xb'));var toCsv=require(_0x289a('0x6'));var querystring=require(_0x289a('0xc'));var Papa=require(_0x289a('0xd'));var extract=require(_0x289a('0xe'));var rimraf=require(_0x289a('0xf'));var archiver=require(_0x289a('0x10'));var qs=require(_0x289a('0x11'));var logger=require(_0x289a('0x12'))(_0x289a('0x13'));var utils=require(_0x289a('0x14'));var config=require(_0x289a('0x15'));var db=require('../../mysqldb')['db'];var socket=require(_0x289a('0x16'))({'host':_0x289a('0x17'),'port':0x18eb});require('./plugin.socket')[_0x289a('0x18')](socket);function respondWithStatusCode(_0x28c323,_0x28f083){_0x28f083=_0x28f083||0xcc;return function(_0x4624ed){if(_0x4624ed){return _0x28c323[_0x289a('0x19')](_0x28f083);}return _0x28c323[_0x289a('0x1a')](_0x28f083)[_0x289a('0x1b')]();};}function respondWithResult(_0x26ffe5,_0x1553fb){_0x1553fb=_0x1553fb||0xc8;return function(_0xf2a6cd){if(_0xf2a6cd){return _0x26ffe5[_0x289a('0x1a')](_0x1553fb)['json'](_0xf2a6cd);}};}function respondWithFilteredResult(_0x26a1e1,_0xd149f9){return function(_0x3d47e1){if(_0x3d47e1){var _0x14c181=_0x3d47e1[_0x289a('0x1c')],_0x2d103c=_0xd149f9[_0x289a('0x1d')],_0x23212b=_0xd149f9[_0x289a('0x1d')]+_0xd149f9[_0x289a('0x1e')],_0x19e07f;if(_0x23212b>=_0x14c181){_0x23212b=_0x14c181;_0x19e07f=0xc8;}else{_0x19e07f=0xce;}_0x26a1e1['status'](_0x19e07f);return _0x26a1e1[_0x289a('0x1f')]('Content-Range',_0x2d103c+'-'+_0x23212b+'/'+_0x14c181)['json'](_0x3d47e1);}return null;};}function patchUpdates(_0x49dd52){return function(_0xf2496){try{jsonpatch['apply'](_0xf2496,_0x49dd52,!![]);}catch(_0x320201){return BPromise[_0x289a('0x20')](_0x320201);}return _0xf2496[_0x289a('0x21')]();};}function saveUpdates(_0x2d0cc5,_0x32f870){return function(_0x3a7093){if(_0x3a7093){return _0x3a7093['update'](_0x2d0cc5)[_0x289a('0x22')](function(_0x183626){return _0x183626;});}return null;};}function removeEntity(_0x51f451,_0x54b491){return function(_0xc28076){if(_0xc28076){return _0xc28076[_0x289a('0x23')]()['then'](function(){_0x51f451[_0x289a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x107901,_0x51ba51){return function(_0x322a05){if(!_0x322a05){_0x107901[_0x289a('0x19')](0x194);}return _0x322a05;};}function handleError(_0xc3b732,_0x573a8b){_0x573a8b=_0x573a8b||0x1f4;return function(_0x38275a){logger['error'](_0x38275a[_0x289a('0x24')]);if(_0x38275a[_0x289a('0x25')]){delete _0x38275a['name'];}_0xc3b732[_0x289a('0x1a')](_0x573a8b)[_0x289a('0x26')](_0x38275a);};}exports[_0x289a('0x27')]=function(_0x3fb0be,_0x514966){var _0x528840={},_0x8e04ca={},_0x542a2c={'count':0x0,'rows':[]};var _0x13c76f=db['Plugin'][_0x289a('0x28')];_0x8e04ca[_0x289a('0x29')]=_[_0x289a('0x2a')](_0x13c76f);var _0x350b3e={'dateStart':_0x3fb0be[_0x289a('0x2b')][_0x289a('0x2c')],'dateEnd':_0x3fb0be[_0x289a('0x2b')]['dateEnd']};delete _0x3fb0be[_0x289a('0x2b')][_0x289a('0x2c')];delete _0x3fb0be[_0x289a('0x2b')][_0x289a('0x2d')];_0x8e04ca['query']=_[_0x289a('0x2a')](_0x3fb0be[_0x289a('0x2b')]);_0x8e04ca[_0x289a('0x2e')]=_[_0x289a('0x2f')](_0x8e04ca[_0x289a('0x29')],_0x8e04ca['query']);_0x528840[_0x289a('0x30')]=_['intersection'](_0x8e04ca[_0x289a('0x29')],qs[_0x289a('0x31')](_0x3fb0be['query'][_0x289a('0x31')]));_0x528840[_0x289a('0x30')]=_0x528840[_0x289a('0x30')][_0x289a('0x32')]?_0x528840[_0x289a('0x30')]:_0x8e04ca['model'];if(!_0x3fb0be[_0x289a('0x2b')][_0x289a('0x33')](_0x289a('0x34'))){_0x528840['limit']=qs[_0x289a('0x1e')](_0x3fb0be[_0x289a('0x2b')]['limit']);_0x528840[_0x289a('0x1d')]=qs[_0x289a('0x1d')](_0x3fb0be[_0x289a('0x2b')]['offset']);}_0x528840[_0x289a('0x35')]=qs['sort'](_0x3fb0be[_0x289a('0x2b')][_0x289a('0x36')]);_0x528840[_0x289a('0x37')]=qs[_0x289a('0x2e')](_[_0x289a('0x38')](_0x3fb0be[_0x289a('0x2b')],_0x8e04ca[_0x289a('0x2e')]));if(_0x350b3e['dateStart']){if(_0x350b3e[_0x289a('0x2d')]){_0x350b3e[_0x289a('0x2d')]=moment(_0x350b3e[_0x289a('0x2d')])['add'](0x1,_0x289a('0x39'));}else{_0x350b3e['dateEnd']=moment(_0x350b3e['dateStart'])[_0x289a('0x3a')](0x1,_0x289a('0x39'));}_['merge'](_0x528840[_0x289a('0x37')],{'createdAt':{'$gte':_0x350b3e[_0x289a('0x2c')],'$lte':_0x350b3e[_0x289a('0x2d')]}});}if(_0x3fb0be['query'][_0x289a('0x3b')]){_0x528840[_0x289a('0x37')]=_[_0x289a('0x3c')](_0x528840['where'],{'$or':_['map'](_0x528840[_0x289a('0x30')],function(_0x3d9a0d){var _0xa02f8e={};_0xa02f8e[_0x3d9a0d]={'$like':'%'+_0x3fb0be['query']['filter']+'%'};return _0xa02f8e;})});}_0x528840=_['merge']({},_0x528840,_0x3fb0be[_0x289a('0x3d')]);var _0x8fa880={'where':_0x528840[_0x289a('0x37')]};return db[_0x289a('0x3e')]['count'](_0x8fa880)[_0x289a('0x22')](function(_0x5be5a2){_0x542a2c[_0x289a('0x1c')]=_0x5be5a2;if(_0x3fb0be['query']['includeAll']){_0x528840[_0x289a('0x3f')]=[{'all':!![]}];}return db[_0x289a('0x3e')][_0x289a('0x40')](_0x528840);})['then'](function(_0x2c10ca){_0x542a2c[_0x289a('0x41')]=_0x2c10ca;return _0x542a2c;})[_0x289a('0x22')](respondWithFilteredResult(_0x514966,_0x528840))[_0x289a('0x42')](handleError(_0x514966,null));};exports['show']=function(_0xe19cf5,_0x17a15b){var _0x2e7041={'raw':!![],'where':{'id':_0xe19cf5[_0x289a('0x43')]['id']}},_0x4dcecf={};_0x4dcecf[_0x289a('0x29')]=_['keys'](db[_0x289a('0x3e')][_0x289a('0x28')]);_0x4dcecf[_0x289a('0x2b')]=_[_0x289a('0x2a')](_0xe19cf5[_0x289a('0x2b')]);_0x4dcecf[_0x289a('0x2e')]=_[_0x289a('0x2f')](_0x4dcecf[_0x289a('0x29')],_0x4dcecf[_0x289a('0x2b')]);_0x2e7041[_0x289a('0x30')]=_[_0x289a('0x2f')](_0x4dcecf[_0x289a('0x29')],qs[_0x289a('0x31')](_0xe19cf5[_0x289a('0x2b')][_0x289a('0x31')]));_0x2e7041[_0x289a('0x30')]=_0x2e7041['attributes'][_0x289a('0x32')]?_0x2e7041[_0x289a('0x30')]:_0x4dcecf[_0x289a('0x29')];if(_0xe19cf5[_0x289a('0x2b')][_0x289a('0x44')]){_0x2e7041['include']=[{'all':!![]}];}_0x2e7041=_[_0x289a('0x3c')]({},_0x2e7041,_0xe19cf5[_0x289a('0x3d')]);return db[_0x289a('0x3e')][_0x289a('0x45')](_0x2e7041)[_0x289a('0x22')](handleEntityNotFound(_0x17a15b,null))[_0x289a('0x22')](respondWithResult(_0x17a15b,null))[_0x289a('0x42')](handleError(_0x17a15b,null));};exports[_0x289a('0x46')]=function(_0x31066e,_0x3279a2,_0xfc3b59){return db[_0x289a('0x3e')][_0x289a('0x45')]({'where':{'id':_0x31066e[_0x289a('0x43')]['id']},'attributes':['name',_0x289a('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x3279a2,null))[_0x289a('0x22')](function(_0x447be7){if(_0x447be7){var _0x384930=path[_0x289a('0x48')](config[_0x289a('0x49')],'server/files/plugins',util['format']('%s.zip',path['basename'](_0x447be7[_0x289a('0x47')])));var _0x3ef2b3=fs[_0x289a('0x4a')](_0x384930);var _0x2dedec=archiver(_0x289a('0x4b'),{'zlib':{'level':0x9}});_0x2dedec['on'](_0x289a('0x4c'),function(_0x3e6be9){if(_0x3e6be9[_0x289a('0x4d')]===_0x289a('0x4e')){logger[_0x289a('0x4f')](_0x3e6be9);}else{throw new db[(_0x289a('0x50'))][(_0x289a('0x51'))](_0x289a('0x52'));}});_0x2dedec['on'](_0x289a('0x4f'),function(_0x4b42b0){throw new db['Sequelize']['Error'](_0x289a('0x52'));});_0x2dedec['pipe'](_0x3ef2b3);_0x2dedec['glob'](_0x289a('0x53'),{'cwd':path[_0x289a('0x48')](config[_0x289a('0x49')],_0x289a('0x54'),path[_0x289a('0x55')](_0x447be7[_0x289a('0x47')])),'ignore':[path[_0x289a('0x48')](path[_0x289a('0x56')](_0x447be7[_0x289a('0x47')]),_0x289a('0x57')),path[_0x289a('0x48')](path[_0x289a('0x56')](_0x447be7[_0x289a('0x47')]),_0x289a('0x58'))],'nodir':!![]})[_0x289a('0x59')]();_0x3ef2b3['on'](_0x289a('0x5a'),function(){if(!fs[_0x289a('0x5b')](_0x384930)){throw new db['Sequelize']['Error'](_0x289a('0x5c'));}return _0x3279a2[_0x289a('0x46')](_0x384930,util[_0x289a('0x5d')](_0x289a('0x5e'),path[_0x289a('0x56')](_0x447be7['path'])),function(_0x28b18e){if(_0x28b18e){throw new db[(_0x289a('0x50'))]['Error'](_0x289a('0x5f'));}fs[_0x289a('0x60')](_0x384930);logger[_0x289a('0x61')](_0x289a('0x62'));logger[_0x289a('0x61')](_0x289a('0x63'));});});}return null;})['catch'](handleError(_0x3279a2,null));};exports[_0x289a('0x64')]=function(_0x3f70b6,_0x1c6845,_0x554d1d){var _0x5d5421=path[_0x289a('0x56')](_0x3f70b6['file']['filename'],path[_0x289a('0x65')](_0x3f70b6[_0x289a('0x66')][_0x289a('0x67')]));var _0x3ab556=path[_0x289a('0x48')](config[_0x289a('0x49')],_0x289a('0x54'),_0x3f70b6[_0x289a('0x66')][_0x289a('0x67')]);var _0x461760=path[_0x289a('0x48')](config[_0x289a('0x49')],'server/files/plugins',_0x5d5421);logger[_0x289a('0x61')](_0x289a('0x68'),_0x3ab556);logger[_0x289a('0x61')](_0x289a('0x69'),_0x461760);try{fs['chmodSync'](_0x3ab556,parseInt(_0x289a('0x6a'),0x8));extract(_0x3ab556,{'dir':_0x461760},function(_0x328e72){if(_0x328e72){logger[_0x289a('0x4f')](_0x328e72);handleError(_0x328e72,!![]);};var _0x2039e4=fs[_0x289a('0x6b')](_0x461760);if(_0x2039e4[_0x289a('0x32')]>0x1){removeReferences(_0x3ab556,_0x461760);logger[_0x289a('0x4f')]('Invalid\x20plugin\x20structure');return _0x554d1d(new Error(_0x289a('0x6c')));}var _0x78725a=fs[_0x289a('0x6d')](path[_0x289a('0x48')](_0x461760,_0x2039e4[0x0]));if(_0x78725a[_0x289a('0x6e')]()){removeReferences(_0x3ab556,_0x461760);logger[_0x289a('0x4f')](_0x289a('0x6c'));return _0x554d1d(new Error(_0x289a('0x6c')));}if(_0x78725a[_0x289a('0x6f')]()){var _0x4ee5e6=fs[_0x289a('0x6b')](path[_0x289a('0x48')](_0x461760,_0x2039e4[0x0]));if(_0x4ee5e6['length']===0x0){removeReferences(_0x3ab556,_0x461760);logger[_0x289a('0x4f')](_0x289a('0x6c'));return _0x554d1d(new Error(_0x289a('0x6c')));}var _0x450a35=_0x4ee5e6[_0x289a('0x70')](function(_0x599a13){return _0x599a13===_0x289a('0x71');});if(!_0x450a35){return _0x554d1d(new Error('Plugin\x20manifest\x20missing'));}var _0x3cbb27=fs[_0x289a('0x72')](path[_0x289a('0x48')](_0x461760,_0x2039e4[0x0],_0x289a('0x71')));var _0x15a801=JSON[_0x289a('0x73')](_0x3cbb27);if(_0x289a('0x74')==typeof _0x15a801['name']){return _0x554d1d(new Error(_0x289a('0x75')));}if('undefined'==typeof _0x15a801['type']){return _0x554d1d(new Error(_0x289a('0x76')));}if(_0x289a('0x74')==typeof _0x15a801[_0x289a('0x77')]){return _0x554d1d(new Error(_0x289a('0x78')));}if(_0x289a('0x74')==typeof _0x15a801[_0x289a('0x79')]){return _0x554d1d(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x15a801[_0x289a('0x7a')]===_0x289a('0x7b')){if(_0x289a('0x74')==typeof _0x15a801['parameters'][_0x289a('0x7c')]){return _0x554d1d(new Error(_0x289a('0x7d')));}if(_0x289a('0x74')==typeof _0x15a801['parameters'][_0x289a('0x7c')][_0x289a('0x7e')]&&_0x289a('0x74')==typeof _0x15a801[_0x289a('0x79')][_0x289a('0x7c')]['agent']){return _0x554d1d(new Error(_0x289a('0x7f')));}}else if(_0x15a801['type']===_0x289a('0x80')){if(_0x289a('0x74')==typeof _0x15a801['parameters']['scriptName']){return _0x554d1d(new Error(_0x289a('0x81')));}if('undefined'==typeof _0x15a801[_0x289a('0x79')][_0x289a('0x82')]){return _0x554d1d(new Error(_0x289a('0x83')));}}else{return _0x554d1d(new Error(_0x289a('0x84')));}var _0x5010b1=_0x15a801[_0x289a('0x25')];var _0x7b2ee9=_0x15a801['description'];var _0x838939=_0x15a801['type'];var _0x5b4a31=_0x15a801['sidebar']?_0x15a801[_0x289a('0x85')]:'always';var _0x5c39d1=_0x15a801[_0x289a('0x86')]?_0x15a801[_0x289a('0x86')]:_0x289a('0x87');var _0x370ae7='';var _0x55332a='';var _0x35d3cb='';var _0x334e60='';var _0x2a02cd=_0x15a801[_0x289a('0x77')];if(_0x838939===_0x289a('0x7b')){if(_0x289a('0x74')!=typeof _0x15a801['parameters'][_0x289a('0x7c')][_0x289a('0x7e')]){var _0x221391=_0x15a801[_0x289a('0x79')][_0x289a('0x7c')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x289a('0x88')](_0x221391)){_0x370ae7=path[_0x289a('0x48')](_0x289a('0x89'),_0x5d5421,_0x2039e4[0x0],_0x221391);}else{_0x370ae7=_0x221391;}}else{logger[_0x289a('0x61')](_0x289a('0x8a'));}if(_0x289a('0x74')!=typeof _0x15a801[_0x289a('0x79')][_0x289a('0x7c')][_0x289a('0x8b')]){var _0x421df9=_0x15a801['parameters']['views'][_0x289a('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x289a('0x88')](_0x421df9)){_0x55332a=path['join'](_0x289a('0x89'),_0x5d5421,_0x2039e4[0x0],_0x421df9);}else{_0x55332a=_0x421df9;}}else{logger[_0x289a('0x61')](_0x289a('0x8c'));}}else if(_0x838939===_0x289a('0x80')){_0x35d3cb=_0x15a801[_0x289a('0x79')][_0x289a('0x8d')];_0x334e60=_0x15a801['parameters'][_0x289a('0x82')];if('undefined'!=typeof _0x15a801[_0x289a('0x79')][_0x289a('0x7c')]){if(_0x289a('0x74')!=typeof _0x15a801[_0x289a('0x79')][_0x289a('0x7c')][_0x289a('0x7e')]){var _0x221391=_0x15a801[_0x289a('0x79')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x289a('0x88')](_0x221391)){_0x370ae7=path[_0x289a('0x48')]('plugins',_0x5d5421,_0x2039e4[0x0],_0x221391);}else{_0x370ae7=_0x221391;}}if(_0x289a('0x74')!=typeof _0x15a801[_0x289a('0x79')][_0x289a('0x7c')][_0x289a('0x8b')]){var _0x421df9=_0x15a801[_0x289a('0x79')][_0x289a('0x7c')][_0x289a('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x289a('0x88')](_0x421df9)){_0x55332a=path[_0x289a('0x48')](_0x289a('0x89'),_0x5d5421,_0x2039e4[0x0],_0x421df9);}else{_0x55332a=_0x421df9;}}}}var _0x58f210={'name':_0x5010b1,'description':_0x7b2ee9,'path':path['join'](_0x5d5421,_0x2039e4[0x0]),'type':_0x838939,'sidebar':_0x5b4a31,'icon':_0x5c39d1,'adminUrl':_0x370ae7,'agentUrl':_0x55332a,'scriptName':_0x35d3cb,'scriptPath':_0x334e60,'version':_0x2a02cd};removeReferences(_0x3ab556,null);return db[_0x289a('0x3e')][_0x289a('0x8e')](_0x58f210)[_0x289a('0x22')](respondWithResult(_0x1c6845,null))['catch'](handleError(_0x1c6845,null));}});}catch(_0x33e52a){_0x1c6845[_0x289a('0x1a')](0x1f4)[_0x289a('0x26')](_0x33e52a);}};function removeReferences(_0x5165b9,_0x19ebdf){try{if(_0x5165b9){fs['unlinkSync'](_0x5165b9);logger[_0x289a('0x61')](_0x289a('0x8f'));}if(_0x19ebdf){rimraf(_0x19ebdf,function(){});logger[_0x289a('0x61')](_0x289a('0x90'));}}catch(_0xff1b3e){logger[_0x289a('0x4f')](_0xff1b3e);}}exports[_0x289a('0x91')]=function(_0x3420e9,_0xc19b20,_0x4f84fc){return db['Plugin']['find']({'where':{'id':_0x3420e9[_0x289a('0x43')]['id']}})[_0x289a('0x22')](handleEntityNotFound(_0xc19b20,null))[_0x289a('0x22')](saveUpdates(_0x3420e9[_0x289a('0x92')],null))[_0x289a('0x22')](respondWithResult(_0xc19b20,null))['catch'](handleError(_0xc19b20,null));};exports[_0x289a('0x93')]=function(_0xe21b2e,_0x154ba5,_0x339a04){return db[_0x289a('0x3e')]['find']({'where':{'id':_0xe21b2e['params']['id']}})[_0x289a('0x22')](function(_0x132171){if(_0x132171){return _0x132171[_0x289a('0x23')]();}})[_0x289a('0x22')](function(_0x4d4866){rimraf(path[_0x289a('0x48')](config[_0x289a('0x49')],_0x289a('0x54'),path[_0x289a('0x55')](_0x4d4866[_0x289a('0x47')])),function(){});return _0x4d4866;})[_0x289a('0x22')](handleEntityNotFound(_0x154ba5,null))[_0x289a('0x22')](respondWithStatusCode(_0x154ba5,null))[_0x289a('0x42')](handleError(_0x154ba5,null));};exports[_0x289a('0x94')]=function(_0x4fa307,_0x1ba37a,_0x5142f9){return BPromise['resolve']()[_0x289a('0x22')](function(){if(!_0x4fa307[_0x289a('0x2b')][_0x289a('0x47')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x4fa307[_0x289a('0x2b')][_0x289a('0x95')]){throw new Error(_0x289a('0x96'));}var _0x2df3ff=_0x4fa307[_0x289a('0x2b')][_0x289a('0x97')]?_0x4fa307[_0x289a('0x2b')][_0x289a('0x97')]+':'+_0x4fa307['query'][_0x289a('0x95')]:'http://localhost:'+_0x4fa307[_0x289a('0x2b')][_0x289a('0x95')];var _0x2b3906=_0x4fa307['query'][_0x289a('0x98')]?_0x4fa307[_0x289a('0x2b')][_0x289a('0x98')]:!![];var _0x4b80c8=_0x4fa307['query'][_0x289a('0x99')]?_0x4fa307[_0x289a('0x2b')][_0x289a('0x99')]:null;var _0x1338ba={'method':_0x4fa307['method'],'uri':util[_0x289a('0x5d')](_0x289a('0x9a'),_0x2df3ff,_0x4fa307[_0x289a('0x2b')][_0x289a('0x47')]),'json':_0x2b3906,'resolveWithFullResponse':!![],'encoding':_0x4b80c8,'qs':_0x4fa307['query']};if(_0x4fa307[_0x289a('0x2b')]['headers']){_0x1338ba[_0x289a('0x9b')]=_0x4fa307[_0x289a('0x9b')];}return rp(_0x1338ba);})['then'](function(_0x4dbbf5){if(_0x4dbbf5){_0x1ba37a['set'](_0x4dbbf5[_0x289a('0x9b')]);logger[_0x289a('0x61')](_0x4dbbf5[_0x289a('0x92')]);if(_[_0x289a('0x9c')](_0x4fa307['query'][_0x289a('0x47')],'download')&&_0x4dbbf5[_0x289a('0x9d')]==0x1f4){return _0x1ba37a['sendStatus'](_0x4dbbf5['statusCode']);}else{return _0x1ba37a[_0x289a('0x1a')](_0x4dbbf5[_0x289a('0x9d')])[_0x289a('0x26')](_0x4dbbf5[_0x289a('0x92')]);}}else{return _0x1ba37a[_0x289a('0x19')](0xc8);}})[_0x289a('0x42')](handleError(_0x1ba37a,null));};exports[_0x289a('0x9e')]=function(_0x2020b5,_0x305388,_0x18f493){return BPromise['resolve']()[_0x289a('0x22')](function(){if(!_0x2020b5[_0x289a('0x2b')][_0x289a('0x47')]){throw new Error(_0x289a('0x9f'));}if(!_0x2020b5[_0x289a('0x2b')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x36905b=_0x2020b5['query'][_0x289a('0x97')]?_0x2020b5[_0x289a('0x2b')][_0x289a('0x97')]+':'+_0x2020b5[_0x289a('0x2b')][_0x289a('0x95')]:_0x289a('0xa0')+_0x2020b5[_0x289a('0x2b')][_0x289a('0x95')];var _0x3a5e55=_0x2020b5[_0x289a('0x2b')][_0x289a('0x98')]?_0x2020b5[_0x289a('0x2b')]['json']:!![];var _0x314923=_0x2020b5['query'][_0x289a('0x99')]?_0x2020b5[_0x289a('0x2b')][_0x289a('0x99')]:null;var _0x59790a={'method':_0x2020b5[_0x289a('0xa1')],'uri':util[_0x289a('0x5d')]('%s%s',_0x36905b,_0x2020b5[_0x289a('0x2b')][_0x289a('0x47')]),'json':_0x3a5e55,'resolveWithFullResponse':!![],'encoding':_0x314923,'body':_0x2020b5[_0x289a('0x92')]};if(_0x2020b5[_0x289a('0x2b')][_0x289a('0x9b')]){_0x59790a['headers']=_0x2020b5[_0x289a('0x9b')];}return rp(_0x59790a);})['then'](function(_0x4b201c){if(_0x4b201c){_0x305388[_0x289a('0x1f')](_0x4b201c[_0x289a('0x9b')]);logger['info'](_0x4b201c[_0x289a('0x92')]);return _0x305388[_0x289a('0x1a')](_0x4b201c[_0x289a('0x9d')])['send'](_0x4b201c[_0x289a('0x92')]);}else{return _0x305388['sendStatus'](0xc8);}})[_0x289a('0x42')](handleError(_0x305388,null));}; \ No newline at end of file +var _0x6e9f=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','type','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20parameters\x20missing','html','Invalid\x20manifest:\x20views\x20missing','parameters','admin','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','unlinkSync','update','delete','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','json','encoding','method','%s%s','headers','statusCode','body','webhookPost','resolve','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','rimraf','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','save','then','destroy','name','send','index','rawAttributes','query','dateStart','dateEnd','keys','filters','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','add','day','merge','map','filter','Plugin','include','findAll','rows','catch','show','params','length','find','join','server/files/plugins','format','%s.zip','basename','zip','code','error'];(function(_0x114fed,_0x11f20f){var _0x5a53f4=function(_0x35e3cf){while(--_0x35e3cf){_0x114fed['push'](_0x114fed['shift']());}};_0x5a53f4(++_0x11f20f);}(_0x6e9f,0x179));var _0xf6e9=function(_0x29600e,_0x1b6712){_0x29600e=_0x29600e-0x0;var _0x455f48=_0x6e9f[_0x29600e];return _0x455f48;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6e9('0x0'));var BPromise=require(_0xf6e9('0x1'));var Mustache=require(_0xf6e9('0x2'));var util=require(_0xf6e9('0x3'));var path=require(_0xf6e9('0x4'));var sox=require(_0xf6e9('0x5'));var csv=require(_0xf6e9('0x6'));var ejs=require(_0xf6e9('0x7'));var fs=require('fs');var _=require(_0xf6e9('0x8'));var squel=require(_0xf6e9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf6e9('0xa'));var toCsv=require(_0xf6e9('0x6'));var querystring=require(_0xf6e9('0xb'));var Papa=require(_0xf6e9('0xc'));var extract=require('extract-zip');var rimraf=require(_0xf6e9('0xd'));var archiver=require('archiver');var qs=require(_0xf6e9('0xe'));var logger=require(_0xf6e9('0xf'))(_0xf6e9('0x10'));var utils=require('../../config/utils');var config=require(_0xf6e9('0x11'));var db=require(_0xf6e9('0x12'))['db'];var socket=require(_0xf6e9('0x13'))({'host':_0xf6e9('0x14'),'port':0x18eb});require('./plugin.socket')[_0xf6e9('0x15')](socket);function respondWithStatusCode(_0x42843f,_0x348e48){_0x348e48=_0x348e48||0xcc;return function(_0x7f06ff){if(_0x7f06ff){return _0x42843f[_0xf6e9('0x16')](_0x348e48);}return _0x42843f[_0xf6e9('0x17')](_0x348e48)[_0xf6e9('0x18')]();};}function respondWithResult(_0x2ae4ab,_0x3905b6){_0x3905b6=_0x3905b6||0xc8;return function(_0x545548){if(_0x545548){return _0x2ae4ab['status'](_0x3905b6)['json'](_0x545548);}};}function respondWithFilteredResult(_0x6b854e,_0x58fc73){return function(_0x339fcf){if(_0x339fcf){var _0x3b3563=_0x339fcf[_0xf6e9('0x19')],_0xf34ce2=_0x58fc73['offset'],_0x343d2a=_0x58fc73[_0xf6e9('0x1a')]+_0x58fc73[_0xf6e9('0x1b')],_0x119d76;if(_0x343d2a>=_0x3b3563){_0x343d2a=_0x3b3563;_0x119d76=0xc8;}else{_0x119d76=0xce;}_0x6b854e['status'](_0x119d76);return _0x6b854e[_0xf6e9('0x1c')](_0xf6e9('0x1d'),_0xf34ce2+'-'+_0x343d2a+'/'+_0x3b3563)['json'](_0x339fcf);}return null;};}function patchUpdates(_0x45ac7d){return function(_0x1c3a6f){try{jsonpatch[_0xf6e9('0x1e')](_0x1c3a6f,_0x45ac7d,!![]);}catch(_0x4adce6){return BPromise['reject'](_0x4adce6);}return _0x1c3a6f[_0xf6e9('0x1f')]();};}function saveUpdates(_0x5a9047,_0x27c091){return function(_0x26b82a){if(_0x26b82a){return _0x26b82a['update'](_0x5a9047)[_0xf6e9('0x20')](function(_0x19fc9b){return _0x19fc9b;});}return null;};}function removeEntity(_0x24cd53,_0x597a84){return function(_0xc154a9){if(_0xc154a9){return _0xc154a9[_0xf6e9('0x21')]()[_0xf6e9('0x20')](function(){_0x24cd53[_0xf6e9('0x17')](0xcc)[_0xf6e9('0x18')]();});}};}function handleEntityNotFound(_0x170567,_0x1b3af6){return function(_0x3fb88e){if(!_0x3fb88e){_0x170567[_0xf6e9('0x16')](0x194);}return _0x3fb88e;};}function handleError(_0x22810a,_0x4d647f){_0x4d647f=_0x4d647f||0x1f4;return function(_0x316aa5){logger['error'](_0x316aa5['stack']);if(_0x316aa5[_0xf6e9('0x22')]){delete _0x316aa5['name'];}_0x22810a[_0xf6e9('0x17')](_0x4d647f)[_0xf6e9('0x23')](_0x316aa5);};}exports[_0xf6e9('0x24')]=function(_0x3fdbb4,_0xa89a1f){var _0x3bdeb8={},_0x1877f1={},_0x7123b4={'count':0x0,'rows':[]};var _0x5ed954=db['Plugin'][_0xf6e9('0x25')];_0x1877f1['model']=_['keys'](_0x5ed954);var _0x571c7c={'dateStart':_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x27')],'dateEnd':_0x3fdbb4['query'][_0xf6e9('0x28')]};delete _0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x27')];delete _0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x28')];_0x1877f1[_0xf6e9('0x26')]=_[_0xf6e9('0x29')](_0x3fdbb4[_0xf6e9('0x26')]);_0x1877f1[_0xf6e9('0x2a')]=_[_0xf6e9('0x2b')](_0x1877f1['model'],_0x1877f1[_0xf6e9('0x26')]);_0x3bdeb8['attributes']=_[_0xf6e9('0x2b')](_0x1877f1[_0xf6e9('0x2c')],qs[_0xf6e9('0x2d')](_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x2d')]));_0x3bdeb8[_0xf6e9('0x2e')]=_0x3bdeb8[_0xf6e9('0x2e')]['length']?_0x3bdeb8['attributes']:_0x1877f1[_0xf6e9('0x2c')];if(!_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x2f')]('nolimit')){_0x3bdeb8['limit']=qs[_0xf6e9('0x1b')](_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x1b')]);_0x3bdeb8[_0xf6e9('0x1a')]=qs[_0xf6e9('0x1a')](_0x3fdbb4['query'][_0xf6e9('0x1a')]);}_0x3bdeb8['order']=qs[_0xf6e9('0x30')](_0x3fdbb4['query']['sort']);_0x3bdeb8[_0xf6e9('0x31')]=qs[_0xf6e9('0x2a')](_[_0xf6e9('0x32')](_0x3fdbb4['query'],_0x1877f1['filters']));if(_0x571c7c['dateStart']){if(_0x571c7c[_0xf6e9('0x28')]){_0x571c7c[_0xf6e9('0x28')]=moment(_0x571c7c['dateEnd'])['add'](0x1,'day');}else{_0x571c7c[_0xf6e9('0x28')]=moment(_0x571c7c[_0xf6e9('0x27')])[_0xf6e9('0x33')](0x1,_0xf6e9('0x34'));}_[_0xf6e9('0x35')](_0x3bdeb8[_0xf6e9('0x31')],{'createdAt':{'$gte':_0x571c7c[_0xf6e9('0x27')],'$lte':_0x571c7c[_0xf6e9('0x28')]}});}if(_0x3fdbb4[_0xf6e9('0x26')]['filter']){_0x3bdeb8[_0xf6e9('0x31')]=_['merge'](_0x3bdeb8[_0xf6e9('0x31')],{'$or':_[_0xf6e9('0x36')](_0x3bdeb8[_0xf6e9('0x2e')],function(_0x1e5b5d){var _0x4bc547={};_0x4bc547[_0x1e5b5d]={'$like':'%'+_0x3fdbb4[_0xf6e9('0x26')][_0xf6e9('0x37')]+'%'};return _0x4bc547;})});}_0x3bdeb8=_[_0xf6e9('0x35')]({},_0x3bdeb8,_0x3fdbb4['options']);var _0x68a25a={'where':_0x3bdeb8[_0xf6e9('0x31')]};return db[_0xf6e9('0x38')][_0xf6e9('0x19')](_0x68a25a)[_0xf6e9('0x20')](function(_0x40e2da){_0x7123b4[_0xf6e9('0x19')]=_0x40e2da;if(_0x3fdbb4[_0xf6e9('0x26')]['includeAll']){_0x3bdeb8[_0xf6e9('0x39')]=[{'all':!![]}];}return db[_0xf6e9('0x38')][_0xf6e9('0x3a')](_0x3bdeb8);})[_0xf6e9('0x20')](function(_0x18d97f){_0x7123b4[_0xf6e9('0x3b')]=_0x18d97f;return _0x7123b4;})[_0xf6e9('0x20')](respondWithFilteredResult(_0xa89a1f,_0x3bdeb8))[_0xf6e9('0x3c')](handleError(_0xa89a1f,null));};exports[_0xf6e9('0x3d')]=function(_0x1a415f,_0xe13bdd){var _0x4ca93f={'raw':!![],'where':{'id':_0x1a415f[_0xf6e9('0x3e')]['id']}},_0x198273={};_0x198273['model']=_[_0xf6e9('0x29')](db[_0xf6e9('0x38')]['rawAttributes']);_0x198273[_0xf6e9('0x26')]=_[_0xf6e9('0x29')](_0x1a415f['query']);_0x198273[_0xf6e9('0x2a')]=_[_0xf6e9('0x2b')](_0x198273[_0xf6e9('0x2c')],_0x198273[_0xf6e9('0x26')]);_0x4ca93f[_0xf6e9('0x2e')]=_[_0xf6e9('0x2b')](_0x198273[_0xf6e9('0x2c')],qs['fields'](_0x1a415f[_0xf6e9('0x26')][_0xf6e9('0x2d')]));_0x4ca93f[_0xf6e9('0x2e')]=_0x4ca93f[_0xf6e9('0x2e')][_0xf6e9('0x3f')]?_0x4ca93f['attributes']:_0x198273[_0xf6e9('0x2c')];if(_0x1a415f[_0xf6e9('0x26')]['includeAll']){_0x4ca93f[_0xf6e9('0x39')]=[{'all':!![]}];}_0x4ca93f=_[_0xf6e9('0x35')]({},_0x4ca93f,_0x1a415f['options']);return db['Plugin'][_0xf6e9('0x40')](_0x4ca93f)[_0xf6e9('0x20')](handleEntityNotFound(_0xe13bdd,null))[_0xf6e9('0x20')](respondWithResult(_0xe13bdd,null))[_0xf6e9('0x3c')](handleError(_0xe13bdd,null));};exports['download']=function(_0x37a9a2,_0x7b43bb,_0x1f0d90){return db[_0xf6e9('0x38')][_0xf6e9('0x40')]({'where':{'id':_0x37a9a2[_0xf6e9('0x3e')]['id']},'attributes':[_0xf6e9('0x22'),_0xf6e9('0x4')],'raw':!![]})['then'](handleEntityNotFound(_0x7b43bb,null))['then'](function(_0x1bf0c3){if(_0x1bf0c3){var _0x56264c=path[_0xf6e9('0x41')](config['root'],_0xf6e9('0x42'),util[_0xf6e9('0x43')](_0xf6e9('0x44'),path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')])));var _0x5ea2e3=fs['createWriteStream'](_0x56264c);var _0x55bb76=archiver(_0xf6e9('0x46'),{'zlib':{'level':0x9}});_0x55bb76['on']('warning',function(_0x4a45f6){if(_0x4a45f6[_0xf6e9('0x47')]==='ENOENT'){logger[_0xf6e9('0x48')](_0x4a45f6);}else{throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x4b'));}});_0x55bb76['on']('error',function(_0x2800ca){throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x4b'));});_0x55bb76[_0xf6e9('0x4c')](_0x5ea2e3);_0x55bb76[_0xf6e9('0x4d')](_0xf6e9('0x4e'),{'cwd':path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],'server/files/plugins',path[_0xf6e9('0x50')](_0x1bf0c3['path'])),'ignore':[path[_0xf6e9('0x41')](path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')]),_0xf6e9('0x51')),path[_0xf6e9('0x41')](path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')]),_0xf6e9('0x52'))],'nodir':!![]})[_0xf6e9('0x53')]();_0x5ea2e3['on'](_0xf6e9('0x54'),function(){if(!fs[_0xf6e9('0x55')](_0x56264c)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x7b43bb[_0xf6e9('0x56')](_0x56264c,util[_0xf6e9('0x43')](_0xf6e9('0x44'),path[_0xf6e9('0x45')](_0x1bf0c3[_0xf6e9('0x4')])),function(_0x141c89){if(_0x141c89){throw new db[(_0xf6e9('0x49'))][(_0xf6e9('0x4a'))](_0xf6e9('0x57'));}fs['unlinkSync'](_0x56264c);logger[_0xf6e9('0x58')](_0xf6e9('0x59'));logger[_0xf6e9('0x58')]('Temporary\x20file\x20removed');});});}return null;})[_0xf6e9('0x3c')](handleError(_0x7b43bb,null));};exports[_0xf6e9('0x5a')]=function(_0x93705c,_0x241361,_0x13aca7){var _0x4923a0=path[_0xf6e9('0x45')](_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')],path[_0xf6e9('0x5d')](_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')]));var _0x5ac63b=path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],_0xf6e9('0x42'),_0x93705c[_0xf6e9('0x5b')][_0xf6e9('0x5c')]);var _0x49a40e=path[_0xf6e9('0x41')](config[_0xf6e9('0x4f')],'server/files/plugins',_0x4923a0);logger[_0xf6e9('0x58')](_0xf6e9('0x5e'),_0x5ac63b);logger[_0xf6e9('0x58')](_0xf6e9('0x5f'),_0x49a40e);try{fs[_0xf6e9('0x60')](_0x5ac63b,parseInt(_0xf6e9('0x61'),0x8));extract(_0x5ac63b,{'dir':_0x49a40e},function(_0x56b454){if(_0x56b454){logger[_0xf6e9('0x48')](_0x56b454);handleError(_0x56b454,!![]);};var _0x4b22cd=fs[_0xf6e9('0x62')](_0x49a40e);if(_0x4b22cd[_0xf6e9('0x3f')]>0x1){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')](_0xf6e9('0x63'));return _0x13aca7(new Error(_0xf6e9('0x63')));}var _0x48500d=fs[_0xf6e9('0x64')](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0]));if(_0x48500d[_0xf6e9('0x65')]()){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')]('Invalid\x20plugin\x20structure');return _0x13aca7(new Error(_0xf6e9('0x63')));}if(_0x48500d[_0xf6e9('0x66')]()){var _0x12dcde=fs['readdirSync'](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0]));if(_0x12dcde[_0xf6e9('0x3f')]===0x0){removeReferences(_0x5ac63b,_0x49a40e);logger[_0xf6e9('0x48')](_0xf6e9('0x63'));return _0x13aca7(new Error('Invalid\x20plugin\x20structure'));}var _0x56375b=_0x12dcde[_0xf6e9('0x67')](function(_0x128d72){return _0x128d72===_0xf6e9('0x68');});if(!_0x56375b){return _0x13aca7(new Error(_0xf6e9('0x69')));}var _0x580477=fs[_0xf6e9('0x6a')](path[_0xf6e9('0x41')](_0x49a40e,_0x4b22cd[0x0],_0xf6e9('0x68')));var _0x4cbf2d=JSON[_0xf6e9('0x6b')](_0x580477);if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x22')]){return _0x13aca7(new Error(_0xf6e9('0x6d')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x6e')]){return _0x13aca7(new Error(_0xf6e9('0x6f')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x70')]){return _0x13aca7(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters']){return _0x13aca7(new Error(_0xf6e9('0x71')));}if(_0x4cbf2d[_0xf6e9('0x6e')]===_0xf6e9('0x72')){if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters']['views']){return _0x13aca7(new Error(_0xf6e9('0x73')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x74')]['views'][_0xf6e9('0x75')]&&_0xf6e9('0x6c')==typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')]){return _0x13aca7(new Error(_0xf6e9('0x78')));}}else if(_0x4cbf2d['type']===_0xf6e9('0x79')){if('undefined'==typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x7a')]){return _0x13aca7(new Error(_0xf6e9('0x7b')));}if(_0xf6e9('0x6c')==typeof _0x4cbf2d['parameters'][_0xf6e9('0x7c')]){return _0x13aca7(new Error(_0xf6e9('0x7d')));}}else{return _0x13aca7(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x47dd7b=_0x4cbf2d[_0xf6e9('0x22')];var _0x2a0675=_0x4cbf2d['description'];var _0x7510f7=_0x4cbf2d[_0xf6e9('0x6e')];var _0x3b91e2=_0x4cbf2d[_0xf6e9('0x7e')]?_0x4cbf2d[_0xf6e9('0x7e')]:'always';var _0x180f50=_0x4cbf2d[_0xf6e9('0x7f')]?_0x4cbf2d['icon']:'icon-apps';var _0x1c05ef='';var _0x1eed5a='';var _0x461131='';var _0x11c5e4='';var _0xd4b565=_0x4cbf2d[_0xf6e9('0x70')];if(_0x7510f7===_0xf6e9('0x72')){if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x75')]){var _0x10142a=_0x4cbf2d['parameters'][_0xf6e9('0x76')][_0xf6e9('0x75')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x10142a)){_0x1c05ef=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x10142a);}else{_0x1c05ef=_0x10142a;}}else{logger[_0xf6e9('0x58')](_0xf6e9('0x82'));}if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')]){var _0x276d0c=_0x4cbf2d['parameters'][_0xf6e9('0x76')][_0xf6e9('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x276d0c)){_0x1eed5a=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x276d0c);}else{_0x1eed5a=_0x276d0c;}}else{logger[_0xf6e9('0x58')](_0xf6e9('0x83'));}}else if(_0x7510f7===_0xf6e9('0x79')){_0x461131=_0x4cbf2d[_0xf6e9('0x74')]['scriptName'];_0x11c5e4=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x7c')];if(_0xf6e9('0x6c')!=typeof _0x4cbf2d[_0xf6e9('0x74')]['views']){if('undefined'!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')]['admin']){var _0x10142a=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x75')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x10142a)){_0x1c05ef=path['join']('plugins',_0x4923a0,_0x4b22cd[0x0],_0x10142a);}else{_0x1c05ef=_0x10142a;}}if('undefined'!=typeof _0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')]['agent']){var _0x276d0c=_0x4cbf2d[_0xf6e9('0x74')][_0xf6e9('0x76')][_0xf6e9('0x77')];if(!/^(f|ht)tps?:\/\//i[_0xf6e9('0x80')](_0x276d0c)){_0x1eed5a=path[_0xf6e9('0x41')](_0xf6e9('0x81'),_0x4923a0,_0x4b22cd[0x0],_0x276d0c);}else{_0x1eed5a=_0x276d0c;}}}}var _0x639822={'name':_0x47dd7b,'description':_0x2a0675,'path':path['join'](_0x4923a0,_0x4b22cd[0x0]),'type':_0x7510f7,'sidebar':_0x3b91e2,'icon':_0x180f50,'adminUrl':_0x1c05ef,'agentUrl':_0x1eed5a,'scriptName':_0x461131,'scriptPath':_0x11c5e4,'version':_0xd4b565};removeReferences(_0x5ac63b,null);return db[_0xf6e9('0x38')]['create'](_0x639822)[_0xf6e9('0x20')](respondWithResult(_0x241361,null))['catch'](handleError(_0x241361,null));}});}catch(_0x41a07f){_0x241361[_0xf6e9('0x17')](0x1f4)['send'](_0x41a07f);}};function removeReferences(_0x37c634,_0x390581){try{if(_0x37c634){fs[_0xf6e9('0x84')](_0x37c634);logger[_0xf6e9('0x58')]('Zip\x20archive\x20removed');}if(_0x390581){rimraf(_0x390581,function(){});logger[_0xf6e9('0x58')]('Extracted\x20folder\x20removed');}}catch(_0x4031eb){logger[_0xf6e9('0x48')](_0x4031eb);}}exports[_0xf6e9('0x85')]=function(_0x25a4f6,_0x49cdb9,_0x2239c2){return db[_0xf6e9('0x38')][_0xf6e9('0x40')]({'where':{'id':_0x25a4f6['params']['id']}})[_0xf6e9('0x20')](handleEntityNotFound(_0x49cdb9,null))[_0xf6e9('0x20')](saveUpdates(_0x25a4f6['body'],null))[_0xf6e9('0x20')](respondWithResult(_0x49cdb9,null))[_0xf6e9('0x3c')](handleError(_0x49cdb9,null));};exports[_0xf6e9('0x86')]=function(_0x3e6ed9,_0x5adbf4,_0x3ef77e){return db[_0xf6e9('0x38')]['find']({'where':{'id':_0x3e6ed9[_0xf6e9('0x3e')]['id']}})[_0xf6e9('0x20')](function(_0x2698de){if(_0x2698de){return _0x2698de[_0xf6e9('0x21')]();}})[_0xf6e9('0x20')](function(_0x4201be){rimraf(path['join'](config[_0xf6e9('0x4f')],_0xf6e9('0x42'),path[_0xf6e9('0x50')](_0x4201be['path'])),function(){});return _0x4201be;})['then'](handleEntityNotFound(_0x5adbf4,null))[_0xf6e9('0x20')](respondWithStatusCode(_0x5adbf4,null))[_0xf6e9('0x3c')](handleError(_0x5adbf4,null));};exports[_0xf6e9('0x87')]=function(_0x21592e,_0x5db7e5,_0x33b844){return BPromise['resolve']()[_0xf6e9('0x20')](function(){if(!_0x21592e['query']['path']){throw new Error(_0xf6e9('0x88'));}if(!_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')]){throw new Error(_0xf6e9('0x8a'));}var _0x726c5e=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8b')]?_0x21592e[_0xf6e9('0x26')]['hostname']+':'+_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')]:_0xf6e9('0x8c')+_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x89')];var _0xf0071f=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8d')]?_0x21592e['query'][_0xf6e9('0x8d')]:!![];var _0x429352=_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x8e')]?_0x21592e['query'][_0xf6e9('0x8e')]:null;var _0x50e51a={'method':_0x21592e[_0xf6e9('0x8f')],'uri':util[_0xf6e9('0x43')](_0xf6e9('0x90'),_0x726c5e,_0x21592e['query'][_0xf6e9('0x4')]),'json':_0xf0071f,'resolveWithFullResponse':!![],'encoding':_0x429352,'qs':_0x21592e[_0xf6e9('0x26')]};if(_0x21592e['query'][_0xf6e9('0x91')]){_0x50e51a[_0xf6e9('0x91')]=_0x21592e[_0xf6e9('0x91')];}return rp(_0x50e51a);})[_0xf6e9('0x20')](function(_0x4d5354){if(_0x4d5354){_0x5db7e5['set'](_0x4d5354[_0xf6e9('0x91')]);logger[_0xf6e9('0x58')](_0x4d5354['body']);if(_['endsWith'](_0x21592e[_0xf6e9('0x26')][_0xf6e9('0x4')],_0xf6e9('0x56'))&&_0x4d5354[_0xf6e9('0x92')]==0x1f4){return _0x5db7e5['sendStatus'](_0x4d5354[_0xf6e9('0x92')]);}else{return _0x5db7e5[_0xf6e9('0x17')](_0x4d5354[_0xf6e9('0x92')])[_0xf6e9('0x23')](_0x4d5354[_0xf6e9('0x93')]);}}else{return _0x5db7e5[_0xf6e9('0x16')](0xc8);}})[_0xf6e9('0x3c')](handleError(_0x5db7e5,null));};exports[_0xf6e9('0x94')]=function(_0x1b2e27,_0x3a54d9,_0x19e9b2){return BPromise[_0xf6e9('0x95')]()[_0xf6e9('0x20')](function(){if(!_0x1b2e27[_0xf6e9('0x26')]['path']){throw new Error(_0xf6e9('0x88'));}if(!_0x1b2e27['query'][_0xf6e9('0x89')]){throw new Error(_0xf6e9('0x8a'));}var _0x26e09b=_0x1b2e27[_0xf6e9('0x26')]['hostname']?_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x8b')]+':'+_0x1b2e27['query'][_0xf6e9('0x89')]:_0xf6e9('0x8c')+_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x89')];var _0x41c906=_0x1b2e27['query'][_0xf6e9('0x8d')]?_0x1b2e27[_0xf6e9('0x26')]['json']:!![];var _0x170f36=_0x1b2e27[_0xf6e9('0x26')]['encoding']?_0x1b2e27['query']['encoding']:null;var _0x2766bf={'method':_0x1b2e27[_0xf6e9('0x8f')],'uri':util[_0xf6e9('0x43')]('%s%s',_0x26e09b,_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x4')]),'json':_0x41c906,'resolveWithFullResponse':!![],'encoding':_0x170f36,'body':_0x1b2e27[_0xf6e9('0x93')]};if(_0x1b2e27[_0xf6e9('0x26')][_0xf6e9('0x91')]){_0x2766bf[_0xf6e9('0x91')]=_0x1b2e27[_0xf6e9('0x91')];}return rp(_0x2766bf);})['then'](function(_0x1fef26){if(_0x1fef26){_0x3a54d9[_0xf6e9('0x1c')](_0x1fef26['headers']);logger['info'](_0x1fef26[_0xf6e9('0x93')]);return _0x3a54d9[_0xf6e9('0x17')](_0x1fef26['statusCode'])['send'](_0x1fef26[_0xf6e9('0x93')]);}else{return _0x3a54d9['sendStatus'](0xc8);}})[_0xf6e9('0x3c')](handleError(_0x3a54d9,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index fe4223c..642db0f 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 _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x304f7a,_0x33989c){var _0x42ef52=function(_0x5e621b){while(--_0x5e621b){_0x304f7a['push'](_0x304f7a['shift']());}};_0x42ef52(++_0x33989c);}(_0x7a54,0x106));var _0x47a5=function(_0xa2c0ea,_0x46e078){_0xa2c0ea=_0xa2c0ea-0x0;var _0x126acb=_0x7a54[_0xa2c0ea];return _0x126acb;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file +var _0x7a54=['Plugin','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x368831,_0x541da9){var _0x30d271=function(_0x205168){while(--_0x205168){_0x368831['push'](_0x368831['shift']());}};_0x30d271(++_0x541da9);}(_0x7a54,0x106));var _0x47a5=function(_0x168512,_0x2f8793){_0x168512=_0x168512-0x0;var _0x3f060f=_0x7a54[_0x168512];return _0x3f060f;};'use strict';var EventEmitter=require(_0x47a5('0x0'));var Plugin=require(_0x47a5('0x1'))['db'][_0x47a5('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x47a5('0x3'),'afterUpdate':_0x47a5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f7f12){return function(_0x11bf85,_0x2a1a7e,_0x3717e1){PluginEvents[_0x47a5('0x5')](_0x5f7f12+':'+_0x11bf85['id'],_0x11bf85);PluginEvents['emit'](_0x5f7f12,_0x11bf85);_0x3717e1(null);};}for(var e in events){if(events[_0x47a5('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x47a5('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 07068f7..2cc3cc7 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 _0xa72c=['request-promise','exports','define','Plugin','lodash','../../config/logger','api'];(function(_0x22c684,_0x753309){var _0x39fcbb=function(_0x38b631){while(--_0x38b631){_0x22c684['push'](_0x22c684['shift']());}};_0x39fcbb(++_0x753309);}(_0xa72c,0x138));var _0xca72=function(_0x4347ec,_0x41c4b8){_0x4347ec=_0x4347ec-0x0;var _0x4c8314=_0xa72c[_0x4347ec];return _0x4c8314;};'use strict';var _=require(_0xca72('0x0'));var util=require('util');var logger=require(_0xca72('0x1'))(_0xca72('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xca72('0x3'));var attributes=require('./plugin.attributes');module[_0xca72('0x4')]=function(_0x5bd2eb,_0x3edad3){return _0x5bd2eb[_0xca72('0x5')](_0xca72('0x6'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cdf=['exports','define','Plugin','plugins','../../config/logger','moment','bluebird','request-promise','./plugin.attributes'];(function(_0x3c989f,_0x4a0d20){var _0x240960=function(_0x531460){while(--_0x531460){_0x3c989f['push'](_0x3c989f['shift']());}};_0x240960(++_0x4a0d20);}(_0x0cdf,0x67));var _0xf0cd=function(_0x2ff8ae,_0x459670){_0x2ff8ae=_0x2ff8ae-0x0;var _0x52d112=_0x0cdf[_0x2ff8ae];return _0x52d112;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf0cd('0x0'))('api');var moment=require(_0xf0cd('0x1'));var BPromise=require(_0xf0cd('0x2'));var rp=require(_0xf0cd('0x3'));var attributes=require(_0xf0cd('0x4'));module[_0xf0cd('0x5')]=function(_0x25ae14,_0x39c98e){return _0x25ae14[_0xf0cd('0x6')](_0xf0cd('0x7'),attributes,{'tableName':_0xf0cd('0x8'),'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 41ce855..c811291 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 _0xac73=['request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','result','CreatePlugin','create','body','options','raw','then','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./plugin.socket','register','request','Plugin,\x20%s,\x20%s'];(function(_0x1514b0,_0x3f2abf){var _0x1c6c67=function(_0x57bd21){while(--_0x57bd21){_0x1514b0['push'](_0x1514b0['shift']());}};_0x1c6c67(++_0x3f2abf);}(_0xac73,0x186));var _0x3ac7=function(_0x2e5493,_0x4852be){_0x2e5493=_0x2e5493-0x0;var _0x3a31ac=_0xac73[_0x2e5493];return _0x3a31ac;};'use strict';var _=require(_0x3ac7('0x0'));var util=require(_0x3ac7('0x1'));var moment=require(_0x3ac7('0x2'));var BPromise=require(_0x3ac7('0x3'));var rs=require(_0x3ac7('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3ac7('0x5'))(_0x3ac7('0x6'));var config=require(_0x3ac7('0x7'));var jayson=require(_0x3ac7('0x8'));var client=jayson['client'][_0x3ac7('0x9')]({'port':0x232a});var socket=require(_0x3ac7('0xa'))({'host':_0x3ac7('0xb'),'port':0x18eb});require(_0x3ac7('0xc'))[_0x3ac7('0xd')](socket);function respondWithRpcPromise(_0x4ee9b7,_0x43b616,_0x13a247){return new BPromise(function(_0x455440,_0x556ce9){return client[_0x3ac7('0xe')](_0x4ee9b7,_0x13a247)['then'](function(_0x501fda){logger['info'](_0x3ac7('0xf'),_0x43b616,_0x3ac7('0x10'));logger[_0x3ac7('0x11')](_0x3ac7('0x12'),_0x43b616,'request\x20sent',JSON['stringify'](_0x501fda));if(_0x501fda[_0x3ac7('0x13')]){if(_0x501fda[_0x3ac7('0x13')][_0x3ac7('0x14')]===0x1f4){logger[_0x3ac7('0x13')](_0x3ac7('0xf'),_0x43b616,_0x501fda['error']['message']);return _0x556ce9(_0x501fda[_0x3ac7('0x13')][_0x3ac7('0x15')]);}logger[_0x3ac7('0x13')](_0x3ac7('0xf'),_0x43b616,_0x501fda['error']['message']);return _0x455440(_0x501fda[_0x3ac7('0x13')][_0x3ac7('0x15')]);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x43b616,_0x3ac7('0x10'));_0x455440(_0x501fda[_0x3ac7('0x16')][_0x3ac7('0x15')]);}})['catch'](function(_0x5058d1){logger[_0x3ac7('0x13')]('Plugin,\x20%s,\x20%s',_0x43b616,_0x5058d1);_0x556ce9(_0x5058d1);});});}exports[_0x3ac7('0x17')]=function(_0x1589b9){var _0x23b32e=this;return new Promise(function(_0x15a0c8,_0x1922ff){return db['Plugin'][_0x3ac7('0x18')](_0x1589b9[_0x3ac7('0x19')],{'raw':_0x1589b9[_0x3ac7('0x1a')]?_0x1589b9['options'][_0x3ac7('0x1b')]===undefined?!![]:![]:!![]})[_0x3ac7('0x1c')](function(_0xd1c06f){logger['info'](_0x3ac7('0x17'),_0x1589b9);logger['debug']('CreatePlugin',_0x1589b9,JSON['stringify'](_0xd1c06f));_0x15a0c8(_0xd1c06f);})['catch'](function(_0x227564){logger[_0x3ac7('0x13')](_0x3ac7('0x17'),_0x227564[_0x3ac7('0x15')],_0x1589b9);_0x1922ff(_0x23b32e[_0x3ac7('0x13')](0x1f4,_0x227564['message']));});});}; \ No newline at end of file +var _0x6f6d=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','CreatePlugin','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','client','http','socket.io-emitter','localhost','./plugin.socket','register','request','then'];(function(_0x349123,_0x5410c3){var _0x3f6170=function(_0x129730){while(--_0x129730){_0x349123['push'](_0x349123['shift']());}};_0x3f6170(++_0x5410c3);}(_0x6f6d,0x141));var _0xd6f6=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6f6d[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xd6f6('0x0'));var util=require(_0xd6f6('0x1'));var moment=require(_0xd6f6('0x2'));var BPromise=require(_0xd6f6('0x3'));var rs=require(_0xd6f6('0x4'));var fs=require('fs');var db=require(_0xd6f6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd6f6('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6f6('0x7')][_0xd6f6('0x8')]({'port':0x232a});var socket=require(_0xd6f6('0x9'))({'host':_0xd6f6('0xa'),'port':0x18eb});require(_0xd6f6('0xb'))[_0xd6f6('0xc')](socket);function respondWithRpcPromise(_0x5a2a00,_0x430c24,_0x54fc15){return new BPromise(function(_0x25b189,_0x4bf5af){return client[_0xd6f6('0xd')](_0x5a2a00,_0x54fc15)[_0xd6f6('0xe')](function(_0x6d8eb8){logger[_0xd6f6('0xf')](_0xd6f6('0x10'),_0x430c24,_0xd6f6('0x11'));logger[_0xd6f6('0x12')](_0xd6f6('0x13'),_0x430c24,_0xd6f6('0x11'),JSON['stringify'](_0x6d8eb8));if(_0x6d8eb8['error']){if(_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x15')]===0x1f4){logger[_0xd6f6('0x14')](_0xd6f6('0x10'),_0x430c24,_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);return _0x4bf5af(_0x6d8eb8['error']['message']);}logger[_0xd6f6('0x14')](_0xd6f6('0x10'),_0x430c24,_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);return _0x25b189(_0x6d8eb8[_0xd6f6('0x14')][_0xd6f6('0x16')]);}else{logger[_0xd6f6('0xf')](_0xd6f6('0x10'),_0x430c24,_0xd6f6('0x11'));_0x25b189(_0x6d8eb8['result']['message']);}})['catch'](function(_0x3ff757){logger[_0xd6f6('0x14')]('Plugin,\x20%s,\x20%s',_0x430c24,_0x3ff757);_0x4bf5af(_0x3ff757);});});}exports[_0xd6f6('0x17')]=function(_0x1a0fdd){var _0x259523=this;return new Promise(function(_0x359f3d,_0x270c48){return db['Plugin'][_0xd6f6('0x18')](_0x1a0fdd['body'],{'raw':_0x1a0fdd[_0xd6f6('0x19')]?_0x1a0fdd['options'][_0xd6f6('0x1a')]===undefined?!![]:![]:!![]})[_0xd6f6('0xe')](function(_0x1f17d0){logger['info'](_0xd6f6('0x17'),_0x1a0fdd);logger[_0xd6f6('0x12')](_0xd6f6('0x17'),_0x1a0fdd,JSON[_0xd6f6('0x1b')](_0x1f17d0));_0x359f3d(_0x1f17d0);})['catch'](function(_0x467102){logger[_0xd6f6('0x14')](_0xd6f6('0x17'),_0x467102[_0xd6f6('0x16')],_0x1a0fdd);_0x270c48(_0x259523[_0xd6f6('0x14')](0x1f4,_0x467102[_0xd6f6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 14d0e54..2ca4e23 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 _0x899b=['length','plugin:','./plugin.events','save','remove','update','emit','removeListener','register'];(function(_0x570e59,_0x27236e){var _0x235f4c=function(_0x4b0129){while(--_0x4b0129){_0x570e59['push'](_0x570e59['shift']());}};_0x235f4c(++_0x27236e);}(_0x899b,0xad));var _0xb899=function(_0x1f8da0,_0xbb56b0){_0x1f8da0=_0x1f8da0-0x0;var _0x3c779c=_0x899b[_0x1f8da0];return _0x3c779c;};'use strict';var PluginEvents=require(_0xb899('0x0'));var events=[_0xb899('0x1'),_0xb899('0x2'),_0xb899('0x3')];function createListener(_0x21ba44,_0x2acbf5){return function(_0x2e7854){_0x2acbf5[_0xb899('0x4')](_0x21ba44,_0x2e7854);};}function removeListener(_0x5527cf,_0x305c2e){return function(){PluginEvents[_0xb899('0x5')](_0x5527cf,_0x305c2e);};}exports[_0xb899('0x6')]=function(_0x4265f9){for(var _0x205add=0x0,_0x3f7383=events[_0xb899('0x7')];_0x205add<_0x3f7383;_0x205add++){var _0x47a345=events[_0x205add];var _0x418beb=createListener(_0xb899('0x8')+_0x47a345,_0x4265f9);PluginEvents['on'](_0x47a345,_0x418beb);}}; \ No newline at end of file +var _0x93ea=['length','plugin:','update','emit','removeListener','register'];(function(_0x2a275e,_0x5aa79b){var _0x2287fe=function(_0x2f2a70){while(--_0x2f2a70){_0x2a275e['push'](_0x2a275e['shift']());}};_0x2287fe(++_0x5aa79b);}(_0x93ea,0x1e2));var _0xa93e=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x93ea[_0x142ec2];return _0x45ef4e;};'use strict';var PluginEvents=require('./plugin.events');var events=['save','remove',_0xa93e('0x0')];function createListener(_0x25d6b0,_0x4911f1){return function(_0x4f3dd3){_0x4911f1[_0xa93e('0x1')](_0x25d6b0,_0x4f3dd3);};}function removeListener(_0x228dd4,_0x23ab98){return function(){PluginEvents[_0xa93e('0x2')](_0x228dd4,_0x23ab98);};}exports[_0xa93e('0x3')]=function(_0x18e590){for(var _0x33e25f=0x0,_0xf78a14=events[_0xa93e('0x4')];_0x33e25f<_0xf78a14;_0x33e25f++){var _0x5a11fc=events[_0x33e25f];var _0x24daa6=createListener(_0xa93e('0x5')+_0x5a11fc,_0x18e590);PluginEvents['on'](_0x5a11fc,_0x24daa6);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index ff49683..0e6eacd 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(_0x40070a,_0x4940de){var _0x16ea6a=function(_0x703008){while(--_0x703008){_0x40070a['push'](_0x40070a['shift']());}};_0x16ea6a(++_0x4940de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x56e77f,_0x4bdd35){var _0xaa20f7=function(_0xe3cb63){while(--_0xe3cb63){_0x56e77f['push'](_0x56e77f['shift']());}};_0xaa20f7(++_0x4bdd35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index c15345b..29ae358 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 _0x3b6b=['show','describe','params','catch','create','body','script','join','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','child_process','exec','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','length'];(function(_0x29ceb8,_0x4521b3){var _0x3608c8=function(_0x45595a){while(--_0x45595a){_0x29ceb8['push'](_0x29ceb8['shift']());}};_0x3608c8(++_0x4521b3);}(_0x3b6b,0x15c));var _0xb3b6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b6b[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xb3b6('0x0'));var pm2=require(_0xb3b6('0x1'));var logger=require(_0xb3b6('0x2'))(_0xb3b6('0x3'));var path=require('path');var exec=require(_0xb3b6('0x4'))[_0xb3b6('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5435c9,_0x56c67c){return function(_0x4d5846){if(!_0x4d5846){_0x5435c9[_0xb3b6('0x6')](0x194);;}return _0x4d5846;};}function respondWithResult(_0x35ae79,_0x38e668){_0x38e668=_0x38e668||0xc8;return function(_0x1c8dc5){if(_0x1c8dc5){return _0x35ae79[_0xb3b6('0x7')](_0x38e668)[_0xb3b6('0x8')](_0x1c8dc5);}return null;};}function handleError(_0x5b6816,_0x942f68){_0x942f68=_0x942f68||0x1f4;return function(_0x3ff0c9){logger[_0xb3b6('0x9')](_0x3ff0c9[_0xb3b6('0xa')]);if(_0x3ff0c9[_0xb3b6('0xb')]){delete _0x3ff0c9[_0xb3b6('0xb')];}_0x5b6816[_0xb3b6('0x7')](_0x942f68)[_0xb3b6('0xc')](_0x3ff0c9);};}function execChildProcess(){return new BPromise(function(_0x15990a,_0x13d1a7){exec(_0xb3b6('0xd'),function(_0x53e537,_0x1bc43c,_0x3983cc){logger[_0xb3b6('0xe')](_0x1bc43c);logger[_0xb3b6('0xe')](_0x3983cc);if(_0x53e537){logger[_0xb3b6('0x9')](_0x53e537);return _0x13d1a7(_0x53e537);}return _0x15990a(_0x1bc43c);});});}exports[_0xb3b6('0xf')]=function(_0x352c6e,_0x4d6a4c){return pm2[_0xb3b6('0x10')]()[_0xb3b6('0x11')](function(_0x20b48b){if(_0x20b48b){var _0x30a675=_[_0xb3b6('0x12')](_0x20b48b,function(_0x347927){return _0x347927[_0xb3b6('0xb')]==='express'||_0x347927[_0xb3b6('0xb')]===_0xb3b6('0x13');});return{'rows':_0x30a675,'count':_0x30a675[_0xb3b6('0x14')]};}return null;})['then'](respondWithResult(_0x4d6a4c,null))['catch'](handleError(_0x4d6a4c,null));};exports[_0xb3b6('0x15')]=function(_0x2f3ed7,_0x219ae7){return pm2[_0xb3b6('0x16')](_0x2f3ed7[_0xb3b6('0x17')]['id'])[_0xb3b6('0x11')](respondWithResult(_0x219ae7,null))[_0xb3b6('0x11')](handleEntityNotFound(_0x219ae7,null))[_0xb3b6('0x18')](handleError(_0x219ae7,null));};exports[_0xb3b6('0x19')]=function(_0x5685a6,_0x2c2cb3){if(_0x5685a6[_0xb3b6('0x1a')][_0xb3b6('0xb')]&&_0x5685a6['body'][_0xb3b6('0x1b')]){var _0x4826ab=path[_0xb3b6('0x1c')](__dirname,'../../files/plugins',_0x5685a6[_0xb3b6('0x1a')][_0xb3b6('0x1b')]);var _0x56b443=process['cwd']();process[_0xb3b6('0x1d')](path[_0xb3b6('0x1e')](_0x4826ab));return execChildProcess()[_0xb3b6('0x11')](function(_0x415ad4){process[_0xb3b6('0x1d')](_0x56b443);return pm2[_0xb3b6('0x1f')]({'name':_0x5685a6[_0xb3b6('0x1a')][_0xb3b6('0xb')],'script':_0x4826ab});})['then'](function(_0x580049){pm2[_0xb3b6('0x20')]();return _0x580049[0x0];})[_0xb3b6('0x11')](respondWithResult(_0x2c2cb3,0xc9))[_0xb3b6('0x18')](handleError(_0x2c2cb3,null));}else{return _0x2c2cb3[_0xb3b6('0x7')](0x1f4)['send']({'message':_0xb3b6('0x21')});}};exports[_0xb3b6('0x22')]=function(_0x5ee6e3,_0x344c08){if(_0x5ee6e3[_0xb3b6('0x1a')]['id']){delete _0x5ee6e3['body']['id'];}var _0xccfe08={'online':_0xb3b6('0x23'),'stopped':'stop'};if(_0xccfe08[_0xb3b6('0x24')](_0x5ee6e3[_0xb3b6('0x1a')][_0xb3b6('0x7')])){return pm2[_0xccfe08[_0x5ee6e3[_0xb3b6('0x1a')][_0xb3b6('0x7')]]](_0x5ee6e3[_0xb3b6('0x17')]['id'])['then'](respondWithResult(_0x344c08,0xc8))[_0xb3b6('0x18')](handleError(_0x344c08,null));}else{return _0x344c08[_0xb3b6('0x7')](0x1f4)['send']({'message':_0xb3b6('0x25')});}};exports[_0xb3b6('0x26')]=function(_0x25e1bc,_0x14f77f){if(_0x25e1bc[_0xb3b6('0x1a')]['id']){delete _0x25e1bc[_0xb3b6('0x1a')]['id'];}if(_0x25e1bc[_0xb3b6('0x17')]['id']){return pm2[_0xb3b6('0x27')](_0x25e1bc[_0xb3b6('0x17')]['id'])[_0xb3b6('0x11')](function(_0x59e671){pm2[_0xb3b6('0x20')]();return _0x59e671[0x0];})[_0xb3b6('0x11')](respondWithResult(_0x14f77f,null))[_0xb3b6('0x18')](handleError(_0x14f77f,null));}else{return _0x14f77f[_0xb3b6('0x7')](0x1f4)[_0xb3b6('0xc')]({'message':_0xb3b6('0x28')});}}; \ No newline at end of file +var _0x7711=['update','restart','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','exec','bluebird','sendStatus','status','error','stack','name','send','info','index','list','then','reject','express','motion2','length','catch','show','params','body','script','join','../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x467ca6,_0x58d1a6){var _0x43bd50=function(_0x3f76a4){while(--_0x3f76a4){_0x467ca6['push'](_0x467ca6['shift']());}};_0x43bd50(++_0x58d1a6);}(_0x7711,0xf7));var _0x1771=function(_0x7c2d18,_0x1ebdd6){_0x7c2d18=_0x7c2d18-0x0;var _0x1d3053=_0x7711[_0x7c2d18];return _0x1d3053;};'use strict';var _=require(_0x1771('0x0'));var pm2=require(_0x1771('0x1'));var logger=require(_0x1771('0x2'))('api');var path=require('path');var exec=require(_0x1771('0x3'))[_0x1771('0x4')];var BPromise=require(_0x1771('0x5'));function handleEntityNotFound(_0x3a7b2c,_0x5de408){return function(_0x222275){if(!_0x222275){_0x3a7b2c[_0x1771('0x6')](0x194);;}return _0x222275;};}function respondWithResult(_0x509859,_0x5eef6f){_0x5eef6f=_0x5eef6f||0xc8;return function(_0x1178a5){if(_0x1178a5){return _0x509859[_0x1771('0x7')](_0x5eef6f)['json'](_0x1178a5);}return null;};}function handleError(_0x561123,_0x4f080e){_0x4f080e=_0x4f080e||0x1f4;return function(_0x39b33f){logger[_0x1771('0x8')](_0x39b33f[_0x1771('0x9')]);if(_0x39b33f[_0x1771('0xa')]){delete _0x39b33f[_0x1771('0xa')];}_0x561123[_0x1771('0x7')](_0x4f080e)[_0x1771('0xb')](_0x39b33f);};}function execChildProcess(){return new BPromise(function(_0x248fe6,_0x382e5f){exec('npm\x20install',function(_0x430c89,_0x2b9d61,_0x3a2d06){logger[_0x1771('0xc')](_0x2b9d61);logger['info'](_0x3a2d06);if(_0x430c89){logger[_0x1771('0x8')](_0x430c89);return _0x382e5f(_0x430c89);}return _0x248fe6(_0x2b9d61);});});}exports[_0x1771('0xd')]=function(_0x2cbbc4,_0x178ef9){return pm2[_0x1771('0xe')]()[_0x1771('0xf')](function(_0x4a3937){if(_0x4a3937){var _0x41c504=_[_0x1771('0x10')](_0x4a3937,function(_0x1f6005){return _0x1f6005[_0x1771('0xa')]===_0x1771('0x11')||_0x1f6005[_0x1771('0xa')]===_0x1771('0x12');});return{'rows':_0x41c504,'count':_0x41c504[_0x1771('0x13')]};}return null;})[_0x1771('0xf')](respondWithResult(_0x178ef9,null))[_0x1771('0x14')](handleError(_0x178ef9,null));};exports[_0x1771('0x15')]=function(_0x5ad23,_0xf67b9d){return pm2['describe'](_0x5ad23[_0x1771('0x16')]['id'])[_0x1771('0xf')](respondWithResult(_0xf67b9d,null))[_0x1771('0xf')](handleEntityNotFound(_0xf67b9d,null))['catch'](handleError(_0xf67b9d,null));};exports['create']=function(_0x211b7a,_0xe9963a){if(_0x211b7a[_0x1771('0x17')]['name']&&_0x211b7a[_0x1771('0x17')][_0x1771('0x18')]){var _0x1162c1=path[_0x1771('0x19')](__dirname,_0x1771('0x1a'),_0x211b7a['body'][_0x1771('0x18')]);var _0x4f70cc=process[_0x1771('0x1b')]();process['chdir'](path[_0x1771('0x1c')](_0x1162c1));return execChildProcess()['then'](function(_0x3db27a){process[_0x1771('0x1d')](_0x4f70cc);return pm2[_0x1771('0x1e')]({'name':_0x211b7a[_0x1771('0x17')][_0x1771('0xa')],'script':_0x1162c1});})[_0x1771('0xf')](function(_0x4ed06f){pm2[_0x1771('0x1f')]();return _0x4ed06f[0x0];})['then'](respondWithResult(_0xe9963a,0xc9))['catch'](handleError(_0xe9963a,null));}else{return _0xe9963a[_0x1771('0x7')](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x20')});}};exports[_0x1771('0x21')]=function(_0x16ed6f,_0x506c96){if(_0x16ed6f[_0x1771('0x17')]['id']){delete _0x16ed6f[_0x1771('0x17')]['id'];}var _0x127f72={'online':_0x1771('0x22'),'stopped':'stop'};if(_0x127f72[_0x1771('0x23')](_0x16ed6f['body'][_0x1771('0x7')])){return pm2[_0x127f72[_0x16ed6f[_0x1771('0x17')]['status']]](_0x16ed6f['params']['id'])[_0x1771('0xf')](respondWithResult(_0x506c96,0xc8))['catch'](handleError(_0x506c96,null));}else{return _0x506c96[_0x1771('0x7')](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x24')});}};exports[_0x1771('0x25')]=function(_0x3978b1,_0x1e0c81){if(_0x3978b1[_0x1771('0x17')]['id']){delete _0x3978b1[_0x1771('0x17')]['id'];}if(_0x3978b1[_0x1771('0x16')]['id']){return pm2[_0x1771('0x26')](_0x3978b1['params']['id'])[_0x1771('0xf')](function(_0x500f32){pm2['dump']();return _0x500f32[0x0];})[_0x1771('0xf')](respondWithResult(_0x1e0c81,null))['catch'](handleError(_0x1e0c81,null));}else{return _0x1e0c81['status'](0x1f4)[_0x1771('0xb')]({'message':_0x1771('0x27')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index fd9920c..cde39d4 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 _0xc709=['path','express','Router','../../components/auth/service','../../config/environment','util'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0xc709,0x1b5));var _0x9c70=function(_0x47d6dc,_0xc036cc){_0x47d6dc=_0x47d6dc-0x0;var _0x1a1c93=_0xc709[_0x47d6dc];return _0x1a1c93;};'use strict';var multer=require('multer');var util=require(_0x9c70('0x0'));var path=require(_0x9c70('0x1'));var express=require(_0x9c70('0x2'));var router=express[_0x9c70('0x3')]();var auth=require(_0x9c70('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c70('0x5'));module['exports']=router; \ No newline at end of file +var _0x67ba=['../../components/interaction/service','exports','util','express','Router'];(function(_0x29e0bf,_0x23412f){var _0x218ae8=function(_0xfb3163){while(--_0xfb3163){_0x29e0bf['push'](_0x29e0bf['shift']());}};_0x218ae8(++_0x23412f);}(_0x67ba,0x1d3));var _0xa67b=function(_0x580688,_0x3570b6){_0x580688=_0x580688-0x0;var _0x177d1f=_0x67ba[_0x580688];return _0x177d1f;};'use strict';var multer=require('multer');var util=require(_0xa67b('0x0'));var path=require('path');var express=require(_0xa67b('0x1'));var router=express[_0xa67b('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xa67b('0x3'));var config=require('../../config/environment');module[_0xa67b('0x4')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ab7dcec..8d9d9df 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 _0x58b1=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x3da71c,_0x4e5bcd){var _0x16c784=function(_0x4322ad){while(--_0x4322ad){_0x3da71c['push'](_0x3da71c['shift']());}};_0x16c784(++_0x4e5bcd);}(_0x58b1,0xa4));var _0x158b=function(_0x470bfb,_0x389787){_0x470bfb=_0x470bfb-0x0;var _0x2f5d97=_0x58b1[_0x470bfb];return _0x2f5d97;};'use strict';var Sequelize=require(_0x158b('0x0'));module[_0x158b('0x1')]={'state':{'type':Sequelize[_0x158b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x158b('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x158b('0x3')]},'starttime':{'type':Sequelize[_0x158b('0x4')]},'responsetime':{'type':Sequelize[_0x158b('0x4')]},'ringtime':{'type':Sequelize[_0x158b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x158b('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd305=['exports','DATE','STRING','sequelize'];(function(_0x5ba50f,_0x24eff3){var _0x40a881=function(_0x1258af){while(--_0x1258af){_0x5ba50f['push'](_0x5ba50f['shift']());}};_0x40a881(++_0x24eff3);}(_0xd305,0x1ab));var _0x5d30=function(_0x443b1e,_0xf7ffe9){_0x443b1e=_0x443b1e-0x0;var _0x3beb6f=_0xd305[_0x443b1e];return _0x3beb6f;};'use strict';var Sequelize=require(_0x5d30('0x0'));module[_0x5d30('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x5d30('0x2')]},'uniqueid':{'type':Sequelize[_0x5d30('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x5d30('0x2')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x5d30('0x3')]},'campaigntype':{'type':Sequelize[_0x5d30('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index f3243e8..217ed60 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 _0x9a39=['report_agent_preview','lodash','moment','bluebird','request-promise','./reportAgentPreview.attributes','exports','ReportAgentPreview'];(function(_0x283519,_0x1d368d){var _0x26fa5d=function(_0x56c7b1){while(--_0x56c7b1){_0x283519['push'](_0x283519['shift']());}};_0x26fa5d(++_0x1d368d);}(_0x9a39,0xa9));var _0x99a3=function(_0x1d7ab4,_0x3d3dcc){_0x1d7ab4=_0x1d7ab4-0x0;var _0x174abd=_0x9a39[_0x1d7ab4];return _0x174abd;};'use strict';var _=require(_0x99a3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x99a3('0x1'));var BPromise=require(_0x99a3('0x2'));var rp=require(_0x99a3('0x3'));var attributes=require(_0x99a3('0x4'));module[_0x99a3('0x5')]=function(_0x1c84e3,_0x854425){return _0x1c84e3['define'](_0x99a3('0x6'),attributes,{'tableName':_0x99a3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec4=['request-promise','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger'];(function(_0x20d54d,_0x1adc8e){var _0x516e8b=function(_0x2754e1){while(--_0x2754e1){_0x20d54d['push'](_0x20d54d['shift']());}};_0x516e8b(++_0x1adc8e);}(_0xbec4,0x153));var _0x4bec=function(_0x4bb84e,_0x589e36){_0x4bb84e=_0x4bb84e-0x0;var _0x13225c=_0xbec4[_0x4bb84e];return _0x13225c;};'use strict';var _=require(_0x4bec('0x0'));var util=require(_0x4bec('0x1'));var logger=require(_0x4bec('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4bec('0x3'));var attributes=require(_0x4bec('0x4'));module[_0x4bec('0x5')]=function(_0x419f71,_0x55b05b){return _0x419f71[_0x4bec('0x6')](_0x4bec('0x7'),attributes,{'tableName':_0x4bec('0x8'),'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 82394ad..2a0ecc9 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 _0x33c5=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','util','moment'];(function(_0x550e29,_0x4047f){var _0x3515b6=function(_0x303fe2){while(--_0x303fe2){_0x550e29['push'](_0x550e29['shift']());}};_0x3515b6(++_0x4047f);}(_0x33c5,0xe6));var _0x533c=function(_0x4b1665,_0xb0c095){_0x4b1665=_0x4b1665-0x0;var _0x5850c0=_0x33c5[_0x4b1665];return _0x5850c0;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var db=require(_0x533c('0x3'))['db'];var utils=require(_0x533c('0x4'));var logger=require(_0x533c('0x5'))(_0x533c('0x6'));var config=require('../../config/environment');var jayson=require(_0x533c('0x7'));var client=jayson[_0x533c('0x8')][_0x533c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151732,_0x34ca89,_0x1699d5){return new BPromise(function(_0x3a009b,_0x36d74e){return client[_0x533c('0xa')](_0x151732,_0x1699d5)[_0x533c('0xb')](function(_0x1782eb){logger[_0x533c('0xc')](_0x533c('0xd'),_0x34ca89,_0x533c('0xe'));logger[_0x533c('0xf')](_0x533c('0x10'),_0x34ca89,'request\x20sent',JSON[_0x533c('0x11')](_0x1782eb));if(_0x1782eb[_0x533c('0x12')]){if(_0x1782eb[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')](_0x533c('0xd'),_0x34ca89,_0x1782eb['error'][_0x533c('0x14')]);return _0x36d74e(_0x1782eb[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xd'),_0x34ca89,_0x1782eb[_0x533c('0x12')][_0x533c('0x14')]);return _0x3a009b(_0x1782eb[_0x533c('0x12')]['message']);}else{logger[_0x533c('0xc')](_0x533c('0xd'),_0x34ca89,_0x533c('0xe'));_0x3a009b(_0x1782eb[_0x533c('0x15')]['message']);}})[_0x533c('0x16')](function(_0x1ed6ba){logger[_0x533c('0x12')](_0x533c('0xd'),_0x34ca89,_0x1ed6ba);_0x36d74e(_0x1ed6ba);});});}exports[_0x533c('0x17')]=function(_0x4abaa3){var _0x1f0a72=this;return new Promise(function(_0x35bfd3,_0x1f9f85){return db[_0x533c('0x18')][_0x533c('0x19')](_0x4abaa3[_0x533c('0x1a')],{'raw':_0x4abaa3[_0x533c('0x1b')]?_0x4abaa3[_0x533c('0x1b')][_0x533c('0x1c')]===undefined?!![]:![]:!![]})[_0x533c('0xb')](function(_0x1ded76){logger[_0x533c('0xc')]('CreateReportAgentPreview',_0x4abaa3);logger[_0x533c('0xf')]('CreateReportAgentPreview',_0x4abaa3,JSON['stringify'](_0x1ded76));_0x35bfd3(_0x1ded76);})[_0x533c('0x16')](function(_0x36d4e4){logger['error'](_0x533c('0x17'),_0x36d4e4[_0x533c('0x14')],_0x4abaa3);_0x1f9f85(_0x1f0a72[_0x533c('0x12')](0x1f4,_0x36d4e4[_0x533c('0x14')]));});});}; \ No newline at end of file +var _0xaba6=['jayson/promise','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateReportAgentPreview','create','options','lodash','util','../../config/utils','../../config/logger','../../config/environment'];(function(_0x324034,_0x51e4ca){var _0x208777=function(_0x2a535d){while(--_0x2a535d){_0x324034['push'](_0x324034['shift']());}};_0x208777(++_0x51e4ca);}(_0xaba6,0xe2));var _0x6aba=function(_0x44e4a1,_0x3d053a){_0x44e4a1=_0x44e4a1-0x0;var _0x546ad3=_0xaba6[_0x44e4a1];return _0x546ad3;};'use strict';var _=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x6aba('0x2'));var logger=require(_0x6aba('0x3'))('rpc');var config=require(_0x6aba('0x4'));var jayson=require(_0x6aba('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ae14c,_0x39c32a,_0x54416a){return new BPromise(function(_0x3766d4,_0x1a4fbc){return client['request'](_0x5ae14c,_0x54416a)[_0x6aba('0x6')](function(_0x27c8ba){logger['info'](_0x6aba('0x7'),_0x39c32a,_0x6aba('0x8'));logger[_0x6aba('0x9')](_0x6aba('0xa'),_0x39c32a,_0x6aba('0x8'),JSON[_0x6aba('0xb')](_0x27c8ba));if(_0x27c8ba[_0x6aba('0xc')]){if(_0x27c8ba['error'][_0x6aba('0xd')]===0x1f4){logger[_0x6aba('0xc')](_0x6aba('0x7'),_0x39c32a,_0x27c8ba[_0x6aba('0xc')]['message']);return _0x1a4fbc(_0x27c8ba[_0x6aba('0xc')][_0x6aba('0xe')]);}logger['error'](_0x6aba('0x7'),_0x39c32a,_0x27c8ba[_0x6aba('0xc')][_0x6aba('0xe')]);return _0x3766d4(_0x27c8ba['error'][_0x6aba('0xe')]);}else{logger[_0x6aba('0xf')](_0x6aba('0x7'),_0x39c32a,'request\x20sent');_0x3766d4(_0x27c8ba[_0x6aba('0x10')][_0x6aba('0xe')]);}})[_0x6aba('0x11')](function(_0x21921d){logger[_0x6aba('0xc')](_0x6aba('0x7'),_0x39c32a,_0x21921d);_0x1a4fbc(_0x21921d);});});}exports[_0x6aba('0x12')]=function(_0x564827){var _0x2291d7=this;return new Promise(function(_0x448f29,_0x1c2efe){return db['ReportAgentPreview'][_0x6aba('0x13')](_0x564827['body'],{'raw':_0x564827['options']?_0x564827[_0x6aba('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x6aba('0x6')](function(_0x1881ae){logger[_0x6aba('0xf')](_0x6aba('0x12'),_0x564827);logger[_0x6aba('0x9')](_0x6aba('0x12'),_0x564827,JSON[_0x6aba('0xb')](_0x1881ae));_0x448f29(_0x1881ae);})['catch'](function(_0x2e5f65){logger[_0x6aba('0xc')](_0x6aba('0x12'),_0x2e5f65[_0x6aba('0xe')],_0x564827);_0x1c2efe(_0x2291d7[_0x6aba('0xc')](0x1f4,_0x2e5f65[_0x6aba('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index edc45d6..d3b44ca 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 _0x8bd2=['chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','exports','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','outbound','outboundChannels','/agents','agents','put','/telephones','telephones','/trunks','trunks','/fax/accounts','faxAccounts'];(function(_0x4798dd,_0x540dfd){var _0x5dce59=function(_0x171ed7){while(--_0x171ed7){_0x4798dd['push'](_0x4798dd['shift']());}};_0x5dce59(++_0x540dfd);}(_0x8bd2,0x1d3));var _0x28bd=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x8bd2[_0x587693];return _0x510a1a;};'use strict';var multer=require('multer');var util=require(_0x28bd('0x0'));var path=require(_0x28bd('0x1'));var express=require(_0x28bd('0x2'));var router=express['Router']();var auth=require(_0x28bd('0x3'));var controller=require(_0x28bd('0x4'));router[_0x28bd('0x5')](_0x28bd('0x6'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x8')]);router[_0x28bd('0x5')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x28bd('0x7')](),controller[_0x28bd('0x9')]);router[_0x28bd('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x28bd('0x7')](),controller['voiceChannelStopMixMonitor']);router[_0x28bd('0x5')](_0x28bd('0xa'),auth['isAuthenticated'](),controller[_0x28bd('0xb')]);router[_0x28bd('0x5')](_0x28bd('0xc'),auth['isAuthenticated'](),controller[_0x28bd('0xd')]);router[_0x28bd('0x5')](_0x28bd('0xe'),auth[_0x28bd('0x7')](),controller['mailQueues']);router['get']('/mail/accounts',auth[_0x28bd('0x7')](),controller[_0x28bd('0xf')]);router[_0x28bd('0x5')](_0x28bd('0x10'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x11')]);router[_0x28bd('0x5')](_0x28bd('0x12'),auth['isAuthenticated'](),controller[_0x28bd('0x13')]);router[_0x28bd('0x5')](_0x28bd('0x14'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x28bd('0x5')](_0x28bd('0x15'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x16')]);router[_0x28bd('0x5')](_0x28bd('0x17'),auth[_0x28bd('0x7')](),controller['voiceQueuesChannels']);router[_0x28bd('0x5')](_0x28bd('0x18'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x19')]);router[_0x28bd('0x5')](_0x28bd('0x1a'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x1b')]);router[_0x28bd('0x5')](_0x28bd('0x1c'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x1d')]);router[_0x28bd('0x5')](_0x28bd('0x1e'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x1f')]);router[_0x28bd('0x5')](_0x28bd('0x20'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x21')]);router[_0x28bd('0x5')]('/outbound/channels',auth[_0x28bd('0x7')](),controller[_0x28bd('0x22')]);router[_0x28bd('0x5')](_0x28bd('0x23'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x24')]);router[_0x28bd('0x25')]('/agents/:id/capacity',auth[_0x28bd('0x7')](),controller['agentCapacity']);router[_0x28bd('0x5')](_0x28bd('0x26'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x27')]);router['get'](_0x28bd('0x28'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x29')]);router[_0x28bd('0x5')]('/campaigns',auth[_0x28bd('0x7')](),controller['campaigns']);router[_0x28bd('0x5')](_0x28bd('0x2a'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x2b')]);router['get']('/chat/queues/waitinginteractions',auth[_0x28bd('0x7')](),controller[_0x28bd('0x2c')]);router[_0x28bd('0x5')](_0x28bd('0x2d'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x2e')]);router[_0x28bd('0x5')](_0x28bd('0x2f'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x30')]);router[_0x28bd('0x5')]('/sms/queues/waitinginteractions',auth[_0x28bd('0x7')](),controller[_0x28bd('0x31')]);router[_0x28bd('0x5')](_0x28bd('0x32'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x33')]);router[_0x28bd('0x34')]('/mail/queues/:id/notify',auth[_0x28bd('0x7')](),controller[_0x28bd('0x35')](_0x28bd('0x36')));router[_0x28bd('0x5')]('/mail/queues/:id',auth[_0x28bd('0x7')](),controller[_0x28bd('0x37')]);router[_0x28bd('0x34')]('/chat/queues/:id/notify',auth[_0x28bd('0x7')](),controller[_0x28bd('0x35')](_0x28bd('0x38')));router[_0x28bd('0x5')](_0x28bd('0x39'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x3a')]);router['post'](_0x28bd('0x3b'),auth['isAuthenticated'](),controller[_0x28bd('0x35')](_0x28bd('0x3c')));router['get']('/fax/queues/:id',auth[_0x28bd('0x7')](),controller[_0x28bd('0x3d')]);router[_0x28bd('0x34')](_0x28bd('0x3e'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x35')](_0x28bd('0x3f')));router[_0x28bd('0x5')](_0x28bd('0x40'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x41')]);router[_0x28bd('0x34')](_0x28bd('0x42'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x35')](_0x28bd('0x43')));router[_0x28bd('0x5')](_0x28bd('0x44'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x45')]);router[_0x28bd('0x34')](_0x28bd('0x46'),auth[_0x28bd('0x7')](),controller[_0x28bd('0x47')]);module[_0x28bd('0x48')]=router; \ No newline at end of file +var _0xfaee=['/sms/queues/:id','showSmsQueues','agentNotify','exports','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/fax/queues','faxQueues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/outbound','outbound','outboundChannels','agents','/agents/:id/capacity','agentCapacity','/trunks','campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','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','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms'];(function(_0x17be50,_0xd2e24d){var _0x204d0f=function(_0x231688){while(--_0x231688){_0x17be50['push'](_0x17be50['shift']());}};_0x204d0f(++_0xd2e24d);}(_0xfaee,0x15d));var _0xefae=function(_0x5b5947,_0x11623c){_0x5b5947=_0x5b5947-0x0;var _0x7623e0=_0xfaee[_0x5b5947];return _0x7623e0;};'use strict';var multer=require(_0xefae('0x0'));var util=require(_0xefae('0x1'));var path=require('path');var express=require(_0xefae('0x2'));var router=express[_0xefae('0x3')]();var auth=require(_0xefae('0x4'));var controller=require(_0xefae('0x5'));router[_0xefae('0x6')](_0xefae('0x7'),auth[_0xefae('0x8')](),controller[_0xefae('0x9')]);router[_0xefae('0x6')](_0xefae('0xa'),auth['isAuthenticated'](),controller[_0xefae('0xb')]);router[_0xefae('0x6')](_0xefae('0xc'),auth[_0xefae('0x8')](),controller[_0xefae('0xd')]);router['get'](_0xefae('0xe'),auth[_0xefae('0x8')](),controller[_0xefae('0xf')]);router[_0xefae('0x6')]('/chat/queues',auth['isAuthenticated'](),controller[_0xefae('0x10')]);router[_0xefae('0x6')](_0xefae('0x11'),auth[_0xefae('0x8')](),controller[_0xefae('0x12')]);router['get'](_0xefae('0x13'),auth[_0xefae('0x8')](),controller[_0xefae('0x14')]);router[_0xefae('0x6')]('/openchannel/queues',auth[_0xefae('0x8')](),controller[_0xefae('0x15')]);router[_0xefae('0x6')]('/sms/queues',auth[_0xefae('0x8')](),controller[_0xefae('0x16')]);router[_0xefae('0x6')](_0xefae('0x17'),auth[_0xefae('0x8')](),controller[_0xefae('0x18')]);router[_0xefae('0x6')]('/voice/queues/preview/:id',auth[_0xefae('0x8')](),controller[_0xefae('0x19')]);router['get'](_0xefae('0x1a'),auth[_0xefae('0x8')](),controller[_0xefae('0x1b')]);router['get'](_0xefae('0x1c'),auth[_0xefae('0x8')](),controller[_0xefae('0x1d')]);router[_0xefae('0x6')](_0xefae('0x1e'),auth[_0xefae('0x8')](),controller['voiceQueuesChannelHangup']);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xefae('0x8')](),controller[_0xefae('0x1f')]);router[_0xefae('0x6')]('/voice/queues/:id',auth[_0xefae('0x8')](),controller['showVoiceQueues']);router['get'](_0xefae('0x20'),auth[_0xefae('0x8')](),controller[_0xefae('0x21')]);router[_0xefae('0x6')]('/outbound/channels',auth[_0xefae('0x8')](),controller[_0xefae('0x22')]);router[_0xefae('0x6')]('/agents',auth[_0xefae('0x8')](),controller[_0xefae('0x23')]);router['put'](_0xefae('0x24'),auth[_0xefae('0x8')](),controller[_0xefae('0x25')]);router[_0xefae('0x6')]('/telephones',auth[_0xefae('0x8')](),controller['telephones']);router[_0xefae('0x6')](_0xefae('0x26'),auth[_0xefae('0x8')](),controller['trunks']);router[_0xefae('0x6')]('/campaigns',auth[_0xefae('0x8')](),controller[_0xefae('0x27')]);router[_0xefae('0x6')](_0xefae('0x28'),auth['isAuthenticated'](),controller[_0xefae('0x29')]);router[_0xefae('0x6')]('/chat/queues/waitinginteractions',auth[_0xefae('0x8')](),controller[_0xefae('0x2a')]);router['get'](_0xefae('0x2b'),auth[_0xefae('0x8')](),controller['mailQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2c'),auth[_0xefae('0x8')](),controller['openchannelQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2d'),auth[_0xefae('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0xefae('0x6')](_0xefae('0x2e'),auth[_0xefae('0x8')](),controller['faxQueuesWaitingInteractions']);router[_0xefae('0x2f')](_0xefae('0x30'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x32')));router[_0xefae('0x6')](_0xefae('0x33'),auth[_0xefae('0x8')](),controller[_0xefae('0x34')]);router[_0xefae('0x2f')](_0xefae('0x35'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x36')));router[_0xefae('0x6')](_0xefae('0x37'),auth['isAuthenticated'](),controller[_0xefae('0x38')]);router[_0xefae('0x2f')](_0xefae('0x39'),auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x3a')));router[_0xefae('0x6')](_0xefae('0x3b'),auth[_0xefae('0x8')](),controller['showFaxQueues']);router[_0xefae('0x2f')](_0xefae('0x3c'),auth[_0xefae('0x8')](),controller['queueNotify'](_0xefae('0x3d')));router['get'](_0xefae('0x3e'),auth[_0xefae('0x8')](),controller[_0xefae('0x3f')]);router[_0xefae('0x2f')]('/sms/queues/:id/notify',auth[_0xefae('0x8')](),controller[_0xefae('0x31')](_0xefae('0x40')));router['get'](_0xefae('0x41'),auth[_0xefae('0x8')](),controller[_0xefae('0x42')]);router[_0xefae('0x2f')]('/agents/:id/notify',auth['isAuthenticated'](),controller[_0xefae('0x43')]);module[_0xefae('0x44')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index e044d9b..6710091 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 _0xadb4=['findOrCreate','SIP/','format','agent','AgentCapacity','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','showMailQueues','mailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','SmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','TransferReport','create','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','agentTransferTimeout','bluebird','moment','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes'];(function(_0x3e0763,_0x3d12be){var _0x351ca2=function(_0x9beae7){while(--_0x9beae7){_0x3e0763['push'](_0x3e0763['shift']());}};_0x351ca2(++_0x3d12be);}(_0xadb4,0x1e0));var _0x4adb=function(_0x20dc09,_0xf0843c){_0x20dc09=_0x20dc09-0x0;var _0x3a47d6=_0xadb4[_0x20dc09];return _0x3a47d6;};'use strict';var BPromise=require(_0x4adb('0x0'));var moment=require(_0x4adb('0x1'));var _=require('lodash');var db=require(_0x4adb('0x2'))['db'];var logger=require(_0x4adb('0x3'))('api');var jayson=require(_0x4adb('0x4'));var amiClient=jayson[_0x4adb('0x5')][_0x4adb('0x6')]({'port':0x232a});var mailClient=jayson[_0x4adb('0x5')][_0x4adb('0x6')]({'port':0x232b});var routingClient=jayson[_0x4adb('0x5')][_0x4adb('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x2a4ff7,_0x5526e5,_0x49c051){return new BPromise(function(_0x9c7ea2,_0x3a6a82){var _0x45964f=_0x49c051?_0x49c051:amiClient;return _0x45964f[_0x4adb('0x7')](_0x2a4ff7,_0x5526e5)[_0x4adb('0x8')](function(_0x985027){if(_0x985027[_0x4adb('0x9')]){if(_0x985027[_0x4adb('0x9')][_0x4adb('0xa')]===0x1f4){return _0x3a6a82(_0x985027['error'][_0x4adb('0xb')]);}return _0x9c7ea2(_0x985027[_0x4adb('0x9')][_0x4adb('0xb')]);}else{_0x9c7ea2(_0x985027['result']);}})[_0x4adb('0xc')](function(_0x5169aa){_0x3a6a82(_0x5169aa);});});}function respondWithResult(_0x4ffd11,_0x49ed5a){_0x49ed5a=_0x49ed5a||0xc8;return function(_0x13fb6f){if(_0x13fb6f){return _0x4ffd11[_0x4adb('0xd')](_0x49ed5a)[_0x4adb('0xe')](_0x13fb6f);}return _0x4ffd11[_0x4adb('0xf')](0x194);};}function handleError(_0x429e4f,_0x44a8f9){_0x44a8f9=_0x44a8f9||0x1f4;return function(_0x582646){logger[_0x4adb('0x9')](_0x582646['stack']);if(_0x582646[_0x4adb('0x10')]){delete _0x582646['name'];}_0x429e4f[_0x4adb('0xd')](_0x44a8f9)[_0x4adb('0x11')](_0x582646);};}function findById(_0x8f2aa2){return function(_0x374cfb){if(!_['isNil'](_0x8f2aa2)&&!_[_0x4adb('0x12')](_0x374cfb)&&!_[_0x4adb('0x12')](_0x374cfb[_0x4adb('0x13')])){return _[_0x4adb('0x14')](_0x374cfb[_0x4adb('0x13')],function(_0x4ecf32){return _0x4ecf32['id']==_0x8f2aa2;});}return null;};}exports[_0x4adb('0x15')]=function(_0x558230,_0x18cd43){return respondWithRpcPromise(_0x4adb('0x16'),_0x558230[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x18cd43,null))[_0x4adb('0xc')](handleError(_0x18cd43,null));};exports[_0x4adb('0x18')]=function(_0x5cbd99,_0x3a5165){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x4adb('0x19')](_0x5cbd99[_0x4adb('0x17')],_0x5cbd99[_0x4adb('0x1a')]))[_0x4adb('0x8')](respondWithResult(_0x3a5165,null))[_0x4adb('0xc')](handleError(_0x3a5165,null));};exports[_0x4adb('0x1b')]=function(_0x115004,_0x12bb5f){return respondWithRpcPromise(_0x4adb('0x1c'),_['merge'](_0x115004['query'],_0x115004[_0x4adb('0x1a')]))[_0x4adb('0x8')](respondWithResult(_0x12bb5f,null))[_0x4adb('0xc')](handleError(_0x12bb5f,null));};exports[_0x4adb('0x1d')]=function(_0x4e6688,_0x51a5b9){return respondWithRpcPromise(_0x4adb('0x1e'),_0x4e6688[_0x4adb('0x17')])['then'](respondWithResult(_0x51a5b9,null))[_0x4adb('0xc')](handleError(_0x51a5b9,null));};exports[_0x4adb('0x1f')]=function(_0x4fefa7,_0x3ec1fb){return respondWithRpcPromise('VoiceQueues',_0x4fefa7[_0x4adb('0x17')])[_0x4adb('0x8')](findById(_0x4fefa7[_0x4adb('0x1a')]['id']))[_0x4adb('0x8')](respondWithResult(_0x3ec1fb,null))[_0x4adb('0xc')](handleError(_0x3ec1fb,null));};exports['voiceQueuesPreview']=function(_0x925796,_0x2a15ae){return respondWithRpcPromise(_0x4adb('0x20'),_[_0x4adb('0x19')](_0x925796['query'],_0x925796['params']))[_0x4adb('0x8')](respondWithResult(_0x2a15ae,null))['catch'](handleError(_0x2a15ae,null));};exports['voiceQueuesChannels']=function(_0x5c4330,_0x284c03){return respondWithRpcPromise(_0x4adb('0x21'),_0x5c4330[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x284c03,null))[_0x4adb('0xc')](handleError(_0x284c03,null));};exports[_0x4adb('0x22')]=function(_0x40143b,_0x1bc8c2){return respondWithRpcPromise(_0x4adb('0x23'),_[_0x4adb('0x19')](_0x40143b[_0x4adb('0x17')],_0x40143b[_0x4adb('0x1a')]))[_0x4adb('0x8')](respondWithResult(_0x1bc8c2,null))[_0x4adb('0xc')](handleError(_0x1bc8c2,null));};exports[_0x4adb('0x24')]=function(_0x891981,_0x3b3272){return respondWithRpcPromise(_0x4adb('0x25'),_[_0x4adb('0x19')](_0x891981[_0x4adb('0x17')],_0x891981[_0x4adb('0x1a')]))[_0x4adb('0x8')](respondWithResult(_0x3b3272,null))['catch'](handleError(_0x3b3272,null));};exports[_0x4adb('0x26')]=function(_0x358732,_0xf513e1){return respondWithRpcPromise(_0x4adb('0x27'),_[_0x4adb('0x19')](_0x358732[_0x4adb('0x17')],_0x358732[_0x4adb('0x1a')]))[_0x4adb('0x8')](respondWithResult(_0xf513e1,null))['catch'](handleError(_0xf513e1,null));};exports['outbound']=function(_0x39b927,_0x5ef4a6){return respondWithRpcPromise(_0x4adb('0x28'),_0x39b927['query'])['then'](respondWithResult(_0x5ef4a6,null))[_0x4adb('0xc')](handleError(_0x5ef4a6,null));};exports[_0x4adb('0x29')]=function(_0x5054d4,_0x282244){return respondWithRpcPromise(_0x4adb('0x2a'),_0x5054d4[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x282244,null))[_0x4adb('0xc')](handleError(_0x282244,null));};exports[_0x4adb('0x2b')]=function(_0x28b4eb,_0x679985){var _0x4157ec;return respondWithRpcPromise('Agents',_0x28b4eb[_0x4adb('0x17')])['then'](function(_0x360cb0){_0x4157ec=_0x360cb0;return respondWithRpcPromise(_0x4adb('0x2c'),_0x28b4eb[_0x4adb('0x17')],routingClient);})['then'](function(_0x280d9a){return _[_0x4adb('0x19')]({},_0x280d9a,_0x4157ec);})['then'](respondWithResult(_0x679985,null))[_0x4adb('0xc')](handleError(_0x679985,null));};exports[_0x4adb('0x2d')]=function(_0x367b03,_0x26bf3f){if(_0x367b03['body']&&_0x367b03[_0x4adb('0x2e')][_0x4adb('0x2f')]&&_0x367b03['user']&&_0x367b03[_0x4adb('0x30')][_0x4adb('0x10')]){for(var _0x55f5d0 in _0x367b03[_0x4adb('0x2e')][_0x4adb('0x2f')]){if(_0x367b03[_0x4adb('0x2e')]['interaction'][_0x4adb('0x31')](_0x55f5d0)){db[_0x4adb('0x32')]['findAll']({'where':{'channel':_0x55f5d0,'membername':_0x367b03['user'][_0x4adb('0x10')],'type':_0x4adb('0x33'),'exitAt':null,'uniqueid':_0x367b03['body'][_0x4adb('0x2f')][_0x55f5d0]&&_0x367b03['body'][_0x4adb('0x2f')][_0x55f5d0][_0x4adb('0x34')]?{'$notIn':_0x367b03[_0x4adb('0x2e')][_0x4adb('0x2f')][_0x55f5d0]}:{'$ne':null}}})[_0x4adb('0x8')](function(_0x5614c3){var _0x4a0b73=moment()['format'](_0x4adb('0x35'));for(var _0x4f3e3f=0x0,_0x3d1ac9=_0x5614c3[_0x4adb('0x34')];_0x4f3e3f<_0x3d1ac9;_0x4f3e3f+=0x1){_0x5614c3[_0x4f3e3f][_0x4adb('0x36')]({'exitAt':_0x4a0b73});}});for(var _0x2adeac=0x0;_0x2adeac<_0x367b03[_0x4adb('0x2e')][_0x4adb('0x2f')][_0x55f5d0][_0x4adb('0x34')];_0x2adeac+=0x1){db[_0x4adb('0x32')][_0x4adb('0x37')]({'where':{'channel':_0x55f5d0,'membername':_0x367b03[_0x4adb('0x30')]['name'],'type':_0x4adb('0x33'),'uniqueid':_0x367b03[_0x4adb('0x2e')]['interaction'][_0x55f5d0][_0x2adeac],'exitAt':null},'defaults':{'channel':_0x55f5d0,'membername':_0x367b03[_0x4adb('0x30')][_0x4adb('0x10')],'interface':_0x4adb('0x38')+_0x367b03[_0x4adb('0x30')][_0x4adb('0x10')],'type':_0x4adb('0x33'),'enterAt':moment()[_0x4adb('0x39')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x4adb('0x3a'),'internal':_0x367b03[_0x4adb('0x30')]['internal'],'uniqueid':_0x367b03['body'][_0x4adb('0x2f')][_0x55f5d0][_0x2adeac]}});}}}}return respondWithRpcPromise(_0x4adb('0x3b'),{'id':_0x367b03[_0x4adb('0x1a')]['id'],'capacity':_0x367b03[_0x4adb('0x2e')]['capacity']},routingClient)[_0x4adb('0x8')](respondWithResult(_0x26bf3f,null))[_0x4adb('0xc')](handleError(_0x26bf3f,null));};exports['telephones']=function(_0x14840c,_0x4a9f10){return respondWithRpcPromise(_0x4adb('0x3c'),_0x14840c[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x4a9f10,null))['catch'](handleError(_0x4a9f10,null));};exports['trunks']=function(_0x50e08b,_0x4c2dba){return respondWithRpcPromise('Trunks',_0x50e08b[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x4c2dba,null))[_0x4adb('0xc')](handleError(_0x4c2dba,null));};exports[_0x4adb('0x3d')]=function(_0x5a9d1f,_0x390336){return respondWithRpcPromise(_0x4adb('0x3e'),_0x5a9d1f[_0x4adb('0x17')])[_0x4adb('0x8')](respondWithResult(_0x390336,null))[_0x4adb('0xc')](handleError(_0x390336,null));};exports[_0x4adb('0x3f')]=function(_0x33a162,_0x417ec1){return respondWithRpcPromise(_0x4adb('0x40'),_0x33a162['query'],routingClient)[_0x4adb('0x8')](respondWithResult(_0x417ec1,null))[_0x4adb('0xc')](handleError(_0x417ec1,null));};exports[_0x4adb('0x41')]=function(_0x3f53cf,_0x524bf7){return respondWithRpcPromise('ChatQueues',_0x3f53cf[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](findById(_0x3f53cf['params']['id']))[_0x4adb('0x8')](respondWithResult(_0x524bf7,null))[_0x4adb('0xc')](handleError(_0x524bf7,null));};exports['mailQueues']=function(_0x28f9ef,_0x345c2b){return respondWithRpcPromise('MailQueues',_0x28f9ef[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](respondWithResult(_0x345c2b,null))[_0x4adb('0xc')](handleError(_0x345c2b,null));};exports[_0x4adb('0x42')]=function(_0x4962de,_0x5ae2f5){return respondWithRpcPromise('MailQueues',_0x4962de[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](findById(_0x4962de['params']['id']))[_0x4adb('0x8')](respondWithResult(_0x5ae2f5,null))[_0x4adb('0xc')](handleError(_0x5ae2f5,null));};exports[_0x4adb('0x43')]=function(_0x11498b,_0x418113){return respondWithRpcPromise('MailAccounts',_0x11498b[_0x4adb('0x17')],mailClient)[_0x4adb('0x8')](respondWithResult(_0x418113,null))[_0x4adb('0xc')](handleError(_0x418113,null));};exports[_0x4adb('0x44')]=function(_0x1f7119,_0xf2d012){return respondWithRpcPromise('OpenchannelQueues',_0x1f7119[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](respondWithResult(_0xf2d012,null))[_0x4adb('0xc')](handleError(_0xf2d012,null));};exports[_0x4adb('0x45')]=function(_0x36e830,_0x21c1f0){return respondWithRpcPromise(_0x4adb('0x46'),_0x36e830['query'],routingClient)['then'](findById(_0x36e830[_0x4adb('0x1a')]['id']))['then'](respondWithResult(_0x21c1f0,null))[_0x4adb('0xc')](handleError(_0x21c1f0,null));};exports['smsQueues']=function(_0xa3be1b,_0x18ceca){return respondWithRpcPromise(_0x4adb('0x47'),_0xa3be1b[_0x4adb('0x17')],routingClient)['then'](respondWithResult(_0x18ceca,null))[_0x4adb('0xc')](handleError(_0x18ceca,null));};exports['showSmsQueues']=function(_0x4bbb52,_0x11995e){return respondWithRpcPromise(_0x4adb('0x47'),_0x4bbb52[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](findById(_0x4bbb52['params']['id']))[_0x4adb('0x8')](respondWithResult(_0x11995e,null))[_0x4adb('0xc')](handleError(_0x11995e,null));};exports[_0x4adb('0x48')]=function(_0xf6a7b2,_0x581908){return respondWithRpcPromise(_0x4adb('0x49'),_0xf6a7b2[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](respondWithResult(_0x581908,null))[_0x4adb('0xc')](handleError(_0x581908,null));};exports[_0x4adb('0x4a')]=function(_0x41ccd7,_0x45d496){return respondWithRpcPromise(_0x4adb('0x49'),_0x41ccd7[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](findById(_0x41ccd7[_0x4adb('0x1a')]['id']))['then'](respondWithResult(_0x45d496,null))[_0x4adb('0xc')](handleError(_0x45d496,null));};exports[_0x4adb('0x4b')]=function(_0x13385c,_0x707bea){return respondWithRpcPromise(_0x4adb('0x4c'),_0x13385c['query'])[_0x4adb('0x8')](respondWithResult(_0x707bea,null))[_0x4adb('0xc')](handleError(_0x707bea,null));};exports[_0x4adb('0x4d')]=function(_0x146ed1,_0x313b67){return respondWithRpcPromise(_0x4adb('0x4e'),_0x146ed1[_0x4adb('0x17')],routingClient)['then'](respondWithResult(_0x313b67,null))[_0x4adb('0xc')](handleError(_0x313b67,null));};exports['mailQueuesWaitingInteractions']=function(_0x710220,_0x5c125c){return respondWithRpcPromise(_0x4adb('0x4f'),_0x710220['query'],routingClient)[_0x4adb('0x8')](respondWithResult(_0x5c125c,null))[_0x4adb('0xc')](handleError(_0x5c125c,null));};exports[_0x4adb('0x50')]=function(_0x340431,_0x15aec0){return respondWithRpcPromise(_0x4adb('0x51'),_0x340431[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](respondWithResult(_0x15aec0,null))[_0x4adb('0xc')](handleError(_0x15aec0,null));};exports[_0x4adb('0x52')]=function(_0x38ceaf,_0x4582bb){return respondWithRpcPromise(_0x4adb('0x53'),_0x38ceaf[_0x4adb('0x17')],routingClient)['then'](respondWithResult(_0x4582bb,null))['catch'](handleError(_0x4582bb,null));};exports['faxQueuesWaitingInteractions']=function(_0x312abd,_0x1b69dc){return respondWithRpcPromise(_0x4adb('0x54'),_0x312abd[_0x4adb('0x17')],routingClient)[_0x4adb('0x8')](respondWithResult(_0x1b69dc,null))[_0x4adb('0xc')](handleError(_0x1b69dc,null));};exports[_0x4adb('0x55')]=function(_0x176332){return function(_0x336b00,_0x3f2a98){var _0x3bebff,_0x3ee42c;var _0x3e1ba7=_[_0x4adb('0x56')](_0x176332);var _0x436348=_0x176332===_0x4adb('0x57')?_0x4adb('0x58'):_0x4adb('0x59');return db[_0x3e1ba7+'Queue'][_0x4adb('0x5a')]({'raw':!![],'where':{'id':_0x336b00[_0x4adb('0x1a')]['id']}})['then'](function(_0x324916){if(_[_0x4adb('0x12')](_0x324916)){throw new Error(_0x3e1ba7+'\x20Queue\x20not\x20found');}_0x3bebff=_0x324916;return db[_0x3e1ba7+_0x4adb('0x5b')]['findOne']({'where':{'id':_0x336b00[_0x4adb('0x2e')][_0x4adb('0x5c')]},'include':[{'model':db[_0x3e1ba7+_0x4adb('0x5d')],'as':_0x4adb('0x5d')},{'model':db[_0x3e1ba7+_0x436348],'as':_0x4adb('0x59')}]});})[_0x4adb('0x8')](function(_0x38b5c7){if(_[_0x4adb('0x12')](_0x38b5c7)){throw new Error(_0x3e1ba7+_0x4adb('0x5e'));}_0x3ee42c=_0x38b5c7;return _0x38b5c7[_0x4adb('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x4adb('0x8')](function(){var _0x4b2d19={'uniqueid':_0x176332+'.'+_0x3ee42c['id']+'.'+_0x3ee42c[_0x4adb('0x5d')]['id'],'FromUserId':_0x336b00[_0x4adb('0x30')]['id'],'type':_0x4adb('0x60')};_0x4b2d19[_0x3e1ba7+_0x4adb('0x61')]=_0x3ee42c['id'];_0x4b2d19[_0x3e1ba7+_0x4adb('0x62')]=_0x3ee42c[_0x4adb('0x5d')]['id'];_0x4b2d19[_0x4adb('0x63')+_0x3e1ba7+_0x436348+'Id']=_0x3ee42c[_0x4adb('0x59')]['id'];_0x4b2d19['To'+_0x3e1ba7+'QueueId']=_0x3bebff['id'];return db[_0x3e1ba7+_0x4adb('0x64')][_0x4adb('0x65')](_0x4b2d19);})[_0x4adb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x176332,'interaction':_0x3ee42c[_0x4adb('0x5d')],'message':_0x3ee42c,'account':_0x3ee42c[_0x4adb('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4adb('0x60'),'appdata':_0x3bebff[_0x4adb('0x10')]+','+(_0x3ee42c[_0x4adb('0x59')]['queueTransferTimeout']||0x12c),'interval':_0x4adb('0x66')}]},routingClient);})[_0x4adb('0x8')](respondWithResult(_0x3f2a98,null))[_0x4adb('0xc')](handleError(_0x3f2a98,null));};};exports[_0x4adb('0x67')]=function(_0x5d119b,_0x44afc2){var _0x37cbf3,_0x188230;if(_['isNil'](_0x5d119b[_0x4adb('0x2e')][_0x4adb('0x68')])){throw new Error(_0x4adb('0x69'));}var _0x24ff18=_0x5d119b[_0x4adb('0x2e')][_0x4adb('0x68')];var _0x1cdc06=_[_0x4adb('0x56')](_0x24ff18);var _0x43b94f=_0x24ff18===_0x4adb('0x57')?_0x4adb('0x58'):_0x4adb('0x59');return db['User']['findOne']({'raw':!![],'where':{'id':_0x5d119b['params']['id'],'role':_0x4adb('0x3a')}})[_0x4adb('0x8')](function(_0x56ae65){if(_[_0x4adb('0x12')](_0x56ae65)){throw new Error('Agent\x20not\x20found');}_0x37cbf3=_0x56ae65;return db[_0x1cdc06+_0x4adb('0x5b')][_0x4adb('0x5a')]({'where':{'id':_0x5d119b[_0x4adb('0x2e')][_0x4adb('0x5c')]},'include':[{'model':db[_0x1cdc06+_0x4adb('0x5d')],'as':'Interaction'},{'model':db[_0x1cdc06+_0x43b94f],'as':_0x4adb('0x59')}]});})[_0x4adb('0x8')](function(_0x450024){if(_['isNil'](_0x450024)){throw new Error(_0x1cdc06+_0x4adb('0x5e'));}_0x188230=_0x450024;return _0x450024['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x4adb('0x8')](function(){var _0x5c95a5={'uniqueid':_0x24ff18+'.'+_0x188230['id']+'.'+_0x188230[_0x4adb('0x5d')]['id'],'FromUserId':_0x5d119b[_0x4adb('0x30')]['id'],'type':'queue','ToUserId':_0x37cbf3['id']};_0x5c95a5[_0x1cdc06+_0x4adb('0x61')]=_0x188230['id'];_0x5c95a5[_0x1cdc06+_0x4adb('0x62')]=_0x188230[_0x4adb('0x5d')]['id'];_0x5c95a5[_0x4adb('0x63')+_0x1cdc06+_0x43b94f+'Id']=_0x188230[_0x4adb('0x59')]['id'];return db[_0x1cdc06+_0x4adb('0x64')][_0x4adb('0x65')](_0x5c95a5);})[_0x4adb('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x24ff18,'interaction':_0x188230[_0x4adb('0x5d')],'message':_0x188230,'account':_0x188230[_0x4adb('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0x4adb('0x3a'),'appdata':_0x37cbf3[_0x4adb('0x10')]+','+(_0x188230[_0x4adb('0x59')][_0x4adb('0x6a')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x4adb('0x8')](respondWithResult(_0x44afc2,null))[_0x4adb('0xc')](handleError(_0x44afc2,null));}; \ No newline at end of file +var _0x0faf=['agent','bluebird','moment','../../mysqldb','api','jayson/promise','client','http','request','then','error','code','message','result','catch','json','sendStatus','stack','name','status','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','query','voiceQueues','VoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','body','user','interaction','hasOwnProperty','findAll','length','format','MemberReport','findOrCreate','INTERACTION','SIP/','YYYY-MM-DD\x20HH:mm:ss','capacity','Telephones','trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','faxQueues','FaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','messageId','InteractionId'];(function(_0x3314aa,_0x40cdb5){var _0x34ed53=function(_0x59862c){while(--_0x59862c){_0x3314aa['push'](_0x3314aa['shift']());}};_0x34ed53(++_0x40cdb5);}(_0x0faf,0xdf));var _0xf0fa=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0x0faf[_0x2601b4];return _0x3e3661;};'use strict';var BPromise=require(_0xf0fa('0x0'));var moment=require(_0xf0fa('0x1'));var _=require('lodash');var db=require(_0xf0fa('0x2'))['db'];var logger=require('../../config/logger')(_0xf0fa('0x3'));var jayson=require(_0xf0fa('0x4'));var amiClient=jayson['client']['http']({'port':0x232a});var mailClient=jayson[_0xf0fa('0x5')][_0xf0fa('0x6')]({'port':0x232b});var routingClient=jayson[_0xf0fa('0x5')][_0xf0fa('0x6')]({'port':0x232c});function respondWithRpcPromise(_0xe7ec0,_0x110595,_0x3dc765){return new BPromise(function(_0x3f352f,_0x12c05b){var _0x4eef59=_0x3dc765?_0x3dc765:amiClient;return _0x4eef59[_0xf0fa('0x7')](_0xe7ec0,_0x110595)[_0xf0fa('0x8')](function(_0x96d1b5){if(_0x96d1b5[_0xf0fa('0x9')]){if(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xa')]===0x1f4){return _0x12c05b(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xb')]);}return _0x3f352f(_0x96d1b5[_0xf0fa('0x9')][_0xf0fa('0xb')]);}else{_0x3f352f(_0x96d1b5[_0xf0fa('0xc')]);}})[_0xf0fa('0xd')](function(_0x43f049){_0x12c05b(_0x43f049);});});}function respondWithResult(_0x4181c4,_0x5099b0){_0x5099b0=_0x5099b0||0xc8;return function(_0x3fa72d){if(_0x3fa72d){return _0x4181c4['status'](_0x5099b0)[_0xf0fa('0xe')](_0x3fa72d);}return _0x4181c4[_0xf0fa('0xf')](0x194);};}function handleError(_0x291f39,_0x5e1a6c){_0x5e1a6c=_0x5e1a6c||0x1f4;return function(_0x458437){logger[_0xf0fa('0x9')](_0x458437[_0xf0fa('0x10')]);if(_0x458437[_0xf0fa('0x11')]){delete _0x458437[_0xf0fa('0x11')];}_0x291f39[_0xf0fa('0x12')](_0x5e1a6c)[_0xf0fa('0x13')](_0x458437);};}function findById(_0x223ed9){return function(_0x5a9aae){if(!_[_0xf0fa('0x14')](_0x223ed9)&&!_[_0xf0fa('0x14')](_0x5a9aae)&&!_[_0xf0fa('0x14')](_0x5a9aae['rows'])){return _[_0xf0fa('0x15')](_0x5a9aae[_0xf0fa('0x16')],function(_0x58b4ae){return _0x58b4ae['id']==_0x223ed9;});}return null;};}exports[_0xf0fa('0x17')]=function(_0x58d37b,_0x427fb0){return respondWithRpcPromise(_0xf0fa('0x18'),_0x58d37b['query'])['then'](respondWithResult(_0x427fb0,null))['catch'](handleError(_0x427fb0,null));};exports[_0xf0fa('0x19')]=function(_0x407d8c,_0x3885a6){return respondWithRpcPromise(_0xf0fa('0x1a'),_[_0xf0fa('0x1b')](_0x407d8c['query'],_0x407d8c[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x3885a6,null))[_0xf0fa('0xd')](handleError(_0x3885a6,null));};exports[_0xf0fa('0x1d')]=function(_0x61c5c2,_0x387dbe){return respondWithRpcPromise(_0xf0fa('0x1e'),_[_0xf0fa('0x1b')](_0x61c5c2[_0xf0fa('0x1f')],_0x61c5c2['params']))[_0xf0fa('0x8')](respondWithResult(_0x387dbe,null))[_0xf0fa('0xd')](handleError(_0x387dbe,null));};exports[_0xf0fa('0x20')]=function(_0x57eccd,_0x5c8833){return respondWithRpcPromise('VoiceQueues',_0x57eccd[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5c8833,null))[_0xf0fa('0xd')](handleError(_0x5c8833,null));};exports['showVoiceQueues']=function(_0x209ffd,_0x2f109f){return respondWithRpcPromise(_0xf0fa('0x21'),_0x209ffd[_0xf0fa('0x1f')])[_0xf0fa('0x8')](findById(_0x209ffd['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0x2f109f,null))[_0xf0fa('0xd')](handleError(_0x2f109f,null));};exports[_0xf0fa('0x22')]=function(_0x256561,_0x588820){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xf0fa('0x1b')](_0x256561[_0xf0fa('0x1f')],_0x256561[_0xf0fa('0x1c')]))['then'](respondWithResult(_0x588820,null))['catch'](handleError(_0x588820,null));};exports[_0xf0fa('0x23')]=function(_0xf3242f,_0x262344){return respondWithRpcPromise(_0xf0fa('0x24'),_0xf3242f[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x262344,null))[_0xf0fa('0xd')](handleError(_0x262344,null));};exports[_0xf0fa('0x25')]=function(_0x3f5fd0,_0x4e91dc){return respondWithRpcPromise('VoiceQueuesChannel',_['merge'](_0x3f5fd0[_0xf0fa('0x1f')],_0x3f5fd0[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x4e91dc,null))[_0xf0fa('0xd')](handleError(_0x4e91dc,null));};exports[_0xf0fa('0x26')]=function(_0x502df9,_0x556110){return respondWithRpcPromise(_0xf0fa('0x27'),_[_0xf0fa('0x1b')](_0x502df9[_0xf0fa('0x1f')],_0x502df9[_0xf0fa('0x1c')]))['then'](respondWithResult(_0x556110,null))[_0xf0fa('0xd')](handleError(_0x556110,null));};exports[_0xf0fa('0x28')]=function(_0x5d4716,_0x1a8d1d){return respondWithRpcPromise(_0xf0fa('0x29'),_['merge'](_0x5d4716['query'],_0x5d4716[_0xf0fa('0x1c')]))[_0xf0fa('0x8')](respondWithResult(_0x1a8d1d,null))[_0xf0fa('0xd')](handleError(_0x1a8d1d,null));};exports['outbound']=function(_0x48cd14,_0x52616f){return respondWithRpcPromise(_0xf0fa('0x2a'),_0x48cd14[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x52616f,null))[_0xf0fa('0xd')](handleError(_0x52616f,null));};exports[_0xf0fa('0x2b')]=function(_0x598ca2,_0x5b4b85){return respondWithRpcPromise('OutboundChannels',_0x598ca2[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5b4b85,null))[_0xf0fa('0xd')](handleError(_0x5b4b85,null));};exports[_0xf0fa('0x2c')]=function(_0x32cebd,_0xf8f944){var _0x457e6d;return respondWithRpcPromise('Agents',_0x32cebd[_0xf0fa('0x1f')])['then'](function(_0x3c333c){_0x457e6d=_0x3c333c;return respondWithRpcPromise(_0xf0fa('0x2d'),_0x32cebd[_0xf0fa('0x1f')],routingClient);})['then'](function(_0x1ec881){return _[_0xf0fa('0x1b')]({},_0x1ec881,_0x457e6d);})['then'](respondWithResult(_0xf8f944,null))[_0xf0fa('0xd')](handleError(_0xf8f944,null));};exports[_0xf0fa('0x2e')]=function(_0x449cf7,_0xb9fbba){if(_0x449cf7['body']&&_0x449cf7[_0xf0fa('0x2f')]['interaction']&&_0x449cf7[_0xf0fa('0x30')]&&_0x449cf7['user'][_0xf0fa('0x11')]){for(var _0x24c54d in _0x449cf7[_0xf0fa('0x2f')]['interaction']){if(_0x449cf7['body'][_0xf0fa('0x31')][_0xf0fa('0x32')](_0x24c54d)){db['MemberReport'][_0xf0fa('0x33')]({'where':{'channel':_0x24c54d,'membername':_0x449cf7['user'][_0xf0fa('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x449cf7['body']['interaction'][_0x24c54d]&&_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0xf0fa('0x34')]?{'$notIn':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d]}:{'$ne':null}}})[_0xf0fa('0x8')](function(_0x24fc49){var _0x5deb08=moment()[_0xf0fa('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x574576=0x0,_0x1cc716=_0x24fc49[_0xf0fa('0x34')];_0x574576<_0x1cc716;_0x574576+=0x1){_0x24fc49[_0x574576]['updateAttributes']({'exitAt':_0x5deb08});}});for(var _0x32b728=0x0;_0x32b728<_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0xf0fa('0x34')];_0x32b728+=0x1){db[_0xf0fa('0x36')][_0xf0fa('0x37')]({'where':{'channel':_0x24c54d,'membername':_0x449cf7[_0xf0fa('0x30')][_0xf0fa('0x11')],'type':_0xf0fa('0x38'),'uniqueid':_0x449cf7['body']['interaction'][_0x24c54d][_0x32b728],'exitAt':null},'defaults':{'channel':_0x24c54d,'membername':_0x449cf7['user']['name'],'interface':_0xf0fa('0x39')+_0x449cf7[_0xf0fa('0x30')][_0xf0fa('0x11')],'type':'INTERACTION','enterAt':moment()[_0xf0fa('0x35')](_0xf0fa('0x3a')),'role':'agent','internal':_0x449cf7[_0xf0fa('0x30')]['internal'],'uniqueid':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x31')][_0x24c54d][_0x32b728]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x449cf7['params']['id'],'capacity':_0x449cf7[_0xf0fa('0x2f')][_0xf0fa('0x3b')]},routingClient)[_0xf0fa('0x8')](respondWithResult(_0xb9fbba,null))[_0xf0fa('0xd')](handleError(_0xb9fbba,null));};exports['telephones']=function(_0x284d41,_0x5b4935){return respondWithRpcPromise(_0xf0fa('0x3c'),_0x284d41[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x5b4935,null))[_0xf0fa('0xd')](handleError(_0x5b4935,null));};exports[_0xf0fa('0x3d')]=function(_0x1ca984,_0x1ed2c8){return respondWithRpcPromise('Trunks',_0x1ca984[_0xf0fa('0x1f')])['then'](respondWithResult(_0x1ed2c8,null))[_0xf0fa('0xd')](handleError(_0x1ed2c8,null));};exports['campaigns']=function(_0x1c0712,_0x4dfad6){return respondWithRpcPromise(_0xf0fa('0x3e'),_0x1c0712[_0xf0fa('0x1f')])[_0xf0fa('0x8')](respondWithResult(_0x4dfad6,null))[_0xf0fa('0xd')](handleError(_0x4dfad6,null));};exports[_0xf0fa('0x3f')]=function(_0x176f21,_0x24bb20){return respondWithRpcPromise('ChatQueues',_0x176f21[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x24bb20,null))['catch'](handleError(_0x24bb20,null));};exports['showChatQueues']=function(_0x59f4f1,_0xa189e6){return respondWithRpcPromise(_0xf0fa('0x40'),_0x59f4f1[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](findById(_0x59f4f1['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0xa189e6,null))['catch'](handleError(_0xa189e6,null));};exports[_0xf0fa('0x41')]=function(_0x5c72f0,_0x78fdb6){return respondWithRpcPromise(_0xf0fa('0x42'),_0x5c72f0[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x78fdb6,null))[_0xf0fa('0xd')](handleError(_0x78fdb6,null));};exports[_0xf0fa('0x43')]=function(_0x10366c,_0x54ac7b){return respondWithRpcPromise(_0xf0fa('0x42'),_0x10366c[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x10366c[_0xf0fa('0x1c')]['id']))[_0xf0fa('0x8')](respondWithResult(_0x54ac7b,null))[_0xf0fa('0xd')](handleError(_0x54ac7b,null));};exports[_0xf0fa('0x44')]=function(_0x4da702,_0x2431ad){return respondWithRpcPromise('MailAccounts',_0x4da702['query'],mailClient)[_0xf0fa('0x8')](respondWithResult(_0x2431ad,null))['catch'](handleError(_0x2431ad,null));};exports[_0xf0fa('0x45')]=function(_0x32b81b,_0x6f9662){return respondWithRpcPromise(_0xf0fa('0x46'),_0x32b81b['query'],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x6f9662,null))[_0xf0fa('0xd')](handleError(_0x6f9662,null));};exports[_0xf0fa('0x47')]=function(_0x3ef9f0,_0x1199aa){return respondWithRpcPromise(_0xf0fa('0x46'),_0x3ef9f0[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x3ef9f0[_0xf0fa('0x1c')]['id']))['then'](respondWithResult(_0x1199aa,null))[_0xf0fa('0xd')](handleError(_0x1199aa,null));};exports[_0xf0fa('0x48')]=function(_0x5cabc0,_0x81498){return respondWithRpcPromise('SmsQueues',_0x5cabc0[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x81498,null))['catch'](handleError(_0x81498,null));};exports[_0xf0fa('0x49')]=function(_0x32a15e,_0x108716){return respondWithRpcPromise(_0xf0fa('0x4a'),_0x32a15e[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](findById(_0x32a15e['params']['id']))[_0xf0fa('0x8')](respondWithResult(_0x108716,null))[_0xf0fa('0xd')](handleError(_0x108716,null));};exports[_0xf0fa('0x4b')]=function(_0x2bb6b6,_0x42b2de){return respondWithRpcPromise(_0xf0fa('0x4c'),_0x2bb6b6[_0xf0fa('0x1f')],routingClient)['then'](respondWithResult(_0x42b2de,null))[_0xf0fa('0xd')](handleError(_0x42b2de,null));};exports['showFaxQueues']=function(_0x153317,_0x5cc28d){return respondWithRpcPromise(_0xf0fa('0x4c'),_0x153317[_0xf0fa('0x1f')],routingClient)['then'](findById(_0x153317[_0xf0fa('0x1c')]['id']))[_0xf0fa('0x8')](respondWithResult(_0x5cc28d,null))[_0xf0fa('0xd')](handleError(_0x5cc28d,null));};exports[_0xf0fa('0x4d')]=function(_0x1d510f,_0x30a636){return respondWithRpcPromise(_0xf0fa('0x4e'),_0x1d510f[_0xf0fa('0x1f')])['then'](respondWithResult(_0x30a636,null))[_0xf0fa('0xd')](handleError(_0x30a636,null));};exports[_0xf0fa('0x4f')]=function(_0x3e4891,_0xb642f7){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x3e4891['query'],routingClient)[_0xf0fa('0x8')](respondWithResult(_0xb642f7,null))[_0xf0fa('0xd')](handleError(_0xb642f7,null));};exports[_0xf0fa('0x50')]=function(_0x24a5e9,_0x4fafaf){return respondWithRpcPromise(_0xf0fa('0x51'),_0x24a5e9[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x4fafaf,null))[_0xf0fa('0xd')](handleError(_0x4fafaf,null));};exports[_0xf0fa('0x52')]=function(_0x54bc5d,_0x184201){return respondWithRpcPromise(_0xf0fa('0x53'),_0x54bc5d['query'],routingClient)['then'](respondWithResult(_0x184201,null))[_0xf0fa('0xd')](handleError(_0x184201,null));};exports['smsQueuesWaitingInteractions']=function(_0x234d8a,_0x356739){return respondWithRpcPromise(_0xf0fa('0x54'),_0x234d8a[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x356739,null))[_0xf0fa('0xd')](handleError(_0x356739,null));};exports[_0xf0fa('0x55')]=function(_0x157a2f,_0x18f8bf){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x157a2f[_0xf0fa('0x1f')],routingClient)[_0xf0fa('0x8')](respondWithResult(_0x18f8bf,null))['catch'](handleError(_0x18f8bf,null));};exports['queueNotify']=function(_0x19b0fb){return function(_0x36064d,_0x161abd){var _0x4f096f,_0x2bd6b7;var _0x1c6b80=_[_0xf0fa('0x56')](_0x19b0fb);var _0x1dab6e=_0x19b0fb===_0xf0fa('0x57')?_0xf0fa('0x58'):_0xf0fa('0x59');return db[_0x1c6b80+_0xf0fa('0x5a')][_0xf0fa('0x5b')]({'raw':!![],'where':{'id':_0x36064d['params']['id']}})[_0xf0fa('0x8')](function(_0x1bb175){if(_[_0xf0fa('0x14')](_0x1bb175)){throw new Error(_0x1c6b80+_0xf0fa('0x5c'));}_0x4f096f=_0x1bb175;return db[_0x1c6b80+_0xf0fa('0x5d')][_0xf0fa('0x5b')]({'where':{'id':_0x36064d[_0xf0fa('0x2f')]['messageId']},'include':[{'model':db[_0x1c6b80+'Interaction'],'as':_0xf0fa('0x5e')},{'model':db[_0x1c6b80+_0x1dab6e],'as':_0xf0fa('0x59')}]});})[_0xf0fa('0x8')](function(_0x63af3f){if(_[_0xf0fa('0x14')](_0x63af3f)){throw new Error(_0x1c6b80+_0xf0fa('0x5f'));}_0x2bd6b7=_0x63af3f;return _0x63af3f[_0xf0fa('0x60')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x57e063={'uniqueid':_0x19b0fb+'.'+_0x2bd6b7['id']+'.'+_0x2bd6b7[_0xf0fa('0x5e')]['id'],'FromUserId':_0x36064d[_0xf0fa('0x30')]['id'],'type':_0xf0fa('0x61')};_0x57e063[_0x1c6b80+_0xf0fa('0x62')]=_0x2bd6b7['id'];_0x57e063[_0x1c6b80+'InteractionId']=_0x2bd6b7[_0xf0fa('0x5e')]['id'];_0x57e063[_0xf0fa('0x63')+_0x1c6b80+_0x1dab6e+'Id']=_0x2bd6b7[_0xf0fa('0x59')]['id'];_0x57e063['To'+_0x1c6b80+_0xf0fa('0x64')]=_0x4f096f['id'];return db[_0x1c6b80+_0xf0fa('0x65')][_0xf0fa('0x66')](_0x57e063);})[_0xf0fa('0x8')](function(){return respondWithRpcPromise(_0xf0fa('0x67'),{'channel':_0x19b0fb,'interaction':_0x2bd6b7[_0xf0fa('0x5e')],'message':_0x2bd6b7,'account':_0x2bd6b7['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0xf0fa('0x61'),'appdata':_0x4f096f[_0xf0fa('0x11')]+','+(_0x2bd6b7[_0xf0fa('0x59')]['queueTransferTimeout']||0x12c),'interval':_0xf0fa('0x68')}]},routingClient);})[_0xf0fa('0x8')](respondWithResult(_0x161abd,null))[_0xf0fa('0xd')](handleError(_0x161abd,null));};};exports[_0xf0fa('0x69')]=function(_0x131cdf,_0x4d95ec){var _0x2e1e67,_0x544cac;if(_[_0xf0fa('0x14')](_0x131cdf['body'][_0xf0fa('0x6a')])){throw new Error(_0xf0fa('0x6b'));}var _0x584b4a=_0x131cdf[_0xf0fa('0x2f')]['channel'];var _0x300d69=_[_0xf0fa('0x56')](_0x584b4a);var _0x5d8283=_0x584b4a===_0xf0fa('0x57')?_0xf0fa('0x58'):'Account';return db['User'][_0xf0fa('0x5b')]({'raw':!![],'where':{'id':_0x131cdf[_0xf0fa('0x1c')]['id'],'role':'agent'}})['then'](function(_0x67ce13){if(_[_0xf0fa('0x14')](_0x67ce13)){throw new Error('Agent\x20not\x20found');}_0x2e1e67=_0x67ce13;return db[_0x300d69+_0xf0fa('0x5d')][_0xf0fa('0x5b')]({'where':{'id':_0x131cdf[_0xf0fa('0x2f')][_0xf0fa('0x6c')]},'include':[{'model':db[_0x300d69+_0xf0fa('0x5e')],'as':_0xf0fa('0x5e')},{'model':db[_0x300d69+_0x5d8283],'as':_0xf0fa('0x59')}]});})[_0xf0fa('0x8')](function(_0x3af630){if(_['isNil'](_0x3af630)){throw new Error(_0x300d69+_0xf0fa('0x5f'));}_0x544cac=_0x3af630;return _0x3af630[_0xf0fa('0x60')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf0fa('0x8')](function(){var _0x15ad5a={'uniqueid':_0x584b4a+'.'+_0x544cac['id']+'.'+_0x544cac[_0xf0fa('0x5e')]['id'],'FromUserId':_0x131cdf[_0xf0fa('0x30')]['id'],'type':'queue','ToUserId':_0x2e1e67['id']};_0x15ad5a[_0x300d69+_0xf0fa('0x62')]=_0x544cac['id'];_0x15ad5a[_0x300d69+_0xf0fa('0x6d')]=_0x544cac['Interaction']['id'];_0x15ad5a[_0xf0fa('0x63')+_0x300d69+_0x5d8283+'Id']=_0x544cac[_0xf0fa('0x59')]['id'];return db[_0x300d69+_0xf0fa('0x65')][_0xf0fa('0x66')](_0x15ad5a);})['then'](function(){return respondWithRpcPromise(_0xf0fa('0x67'),{'channel':_0x584b4a,'interaction':_0x544cac[_0xf0fa('0x5e')],'message':_0x544cac,'account':_0x544cac[_0xf0fa('0x59')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf0fa('0x6e'),'appdata':_0x2e1e67[_0xf0fa('0x11')]+','+(_0x544cac['Account']['agentTransferTimeout']||0x12c),'interval':_0xf0fa('0x68')}]},routingClient);})[_0xf0fa('0x8')](respondWithResult(_0x4d95ec,null))[_0xf0fa('0xd')](handleError(_0x4d95ec,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 5f7a2e5..f70fc65 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 _0x91ba=['put','/:id','delete','exports','multer','util','path','express','Router','../../components/interaction/service','get','isAuthenticated','index','run','post','create'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x91ba,0x74));var _0xa91b=function(_0x2295a2,_0x1ad405){_0x2295a2=_0x2295a2-0x0;var _0x371f46=_0x91ba[_0x2295a2];return _0x371f46;};'use strict';var multer=require(_0xa91b('0x0'));var util=require(_0xa91b('0x1'));var path=require(_0xa91b('0x2'));var express=require(_0xa91b('0x3'));var router=express[_0xa91b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa91b('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router[_0xa91b('0x6')]('/',auth[_0xa91b('0x7')](),controller[_0xa91b('0x8')]);router[_0xa91b('0x6')]('/:id',auth[_0xa91b('0x7')](),controller['show']);router['get']('/:id/run',auth[_0xa91b('0x7')](),controller[_0xa91b('0x9')]);router[_0xa91b('0xa')]('/',auth[_0xa91b('0x7')](),controller[_0xa91b('0xb')]);router[_0xa91b('0xc')](_0xa91b('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xa91b('0xe')](_0xa91b('0xd'),auth[_0xa91b('0x7')](),controller['destroy']);module[_0xa91b('0xf')]=router; \ No newline at end of file +var _0x1aa9=['put','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','./schedule.controller','get','index','/:id','isAuthenticated','post','create'];(function(_0x362ac5,_0x57cc65){var _0x204885=function(_0x317437){while(--_0x317437){_0x362ac5['push'](_0x362ac5['shift']());}};_0x204885(++_0x57cc65);}(_0x1aa9,0x1a3));var _0x91aa=function(_0x8f0275,_0x13edb0){_0x8f0275=_0x8f0275-0x0;var _0x24302b=_0x1aa9[_0x8f0275];return _0x24302b;};'use strict';var multer=require(_0x91aa('0x0'));var util=require(_0x91aa('0x1'));var path=require(_0x91aa('0x2'));var express=require(_0x91aa('0x3'));var router=express[_0x91aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x91aa('0x5'));var config=require('../../config/environment');var controller=require(_0x91aa('0x6'));router[_0x91aa('0x7')]('/',auth['isAuthenticated'](),controller[_0x91aa('0x8')]);router['get'](_0x91aa('0x9'),auth[_0x91aa('0xa')](),controller['show']);router[_0x91aa('0x7')]('/:id/run',auth[_0x91aa('0xa')](),controller['run']);router[_0x91aa('0xb')]('/',auth[_0x91aa('0xa')](),controller[_0x91aa('0xc')]);router[_0x91aa('0xd')](_0x91aa('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x91aa('0x9'),auth[_0x91aa('0xa')](),controller[_0x91aa('0xe')]);module[_0x91aa('0xf')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index c416ec6..bc4aab9 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 _0x88fd=['weeks','days','hours','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x3b205c,_0x170261){var _0x14e70a=function(_0x156c6c){while(--_0x156c6c){_0x3b205c['push'](_0x3b205c['shift']());}};_0x14e70a(++_0x170261);}(_0x88fd,0x157));var _0xd88f=function(_0x358c8d,_0x825478){_0x358c8d=_0x358c8d-0x0;var _0x1c7c0e=_0x88fd[_0x358c8d];return _0x1c7c0e;};'use strict';var Sequelize=require(_0xd88f('0x0'));module[_0xd88f('0x1')]={'name':{'type':Sequelize[_0xd88f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd88f('0x2')]},'active':{'type':Sequelize[_0xd88f('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd88f('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xd88f('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd88f('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xd88f('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd88f('0x6')](_0xd88f('0x7'),_0xd88f('0x8'),'months',_0xd88f('0x9'),_0xd88f('0xa'),_0xd88f('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xd88f('0xa')},'output':{'type':Sequelize['ENUM'](_0xd88f('0xc'),'pdf','xlsx'),'allowNull':![],'defaultValue':_0xd88f('0xc')},'type':{'type':Sequelize[_0xd88f('0x6')](_0xd88f('0xd'),_0xd88f('0xe')),'allowNull':![],'defaultValue':_0xd88f('0xd')},'sendMail':{'type':Sequelize[_0xd88f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd88f('0x2')]},'cc':{'type':Sequelize[_0xd88f('0xf')]},'bcc':{'type':Sequelize[_0xd88f('0xf')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5a6f=['pdf','xlsx','csv','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','INTEGER','ENUM','years','weeks','hours','minutes'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5a6f,0x136));var _0xf5a6=function(_0xd5edf7,_0x43c249){_0xd5edf7=_0xd5edf7-0x0;var _0x5cb898=_0x5a6f[_0xd5edf7];return _0x5cb898;};'use strict';var Sequelize=require(_0xf5a6('0x0'));module[_0xf5a6('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xf5a6('0x2')]},'active':{'type':Sequelize[_0xf5a6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf5a6('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf5a6('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf5a6('0x5')](_0xf5a6('0x6'),'quarters','months',_0xf5a6('0x7'),'days',_0xf5a6('0x8'),_0xf5a6('0x9')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xf5a6('0x5')]('csv',_0xf5a6('0xa'),_0xf5a6('0xb')),'allowNull':![],'defaultValue':_0xf5a6('0xc')},'type':{'type':Sequelize[_0xf5a6('0x5')](_0xf5a6('0xd'),_0xf5a6('0xe')),'allowNull':![],'defaultValue':_0xf5a6('0xd')},'sendMail':{'type':Sequelize[_0xf5a6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf5a6('0x2')]},'cc':{'type':Sequelize[_0xf5a6('0xf')]},'bcc':{'type':Sequelize[_0xf5a6('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xf5a6('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index dcbb0da..c399ab3 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 _0xa9e0=['keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','run','../../config/schedule','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','Schedule','rawAttributes'];(function(_0x3ce3c,_0x319337){var _0x55a2c9=function(_0x1568d0){while(--_0x1568d0){_0x3ce3c['push'](_0x3ce3c['shift']());}};_0x55a2c9(++_0x319337);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['Schedule'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x20')]['create'](_0x473dc8[_0x0a9e('0x3e')],{})[_0x0a9e('0x19')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x3a')](handleError(_0x476688,null));};exports[_0x0a9e('0x18')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x3e')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x45c845[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x19')](saveUpdates(_0x45c845[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x37be73,null))[_0x0a9e('0x3a')](handleError(_0x37be73,null));};exports[_0x0a9e('0x1a')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x20')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x19')](removeEntity(_0xe401a,null))[_0x0a9e('0x3a')](handleError(_0xe401a,null));};exports[_0x0a9e('0x3f')]=function(_0x11545a,_0x61bb17,_0x30decb){var _0x2e5165=require(_0x0a9e('0x40'));return db['Schedule']['find']({'where':{'id':_0x11545a['params']['id']},'raw':!![]})[_0x0a9e('0x19')](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x19')](function(){_0x2e5165[_0x0a9e('0x3f')](_0x11545a['params']['id']);})[_0x0a9e('0x19')](respondWithStatusCode(_0x61bb17,null))[_0x0a9e('0x3a')](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','run','../../config/schedule','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','Schedule','rawAttributes'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['Schedule'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x20')]['create'](_0x473dc8[_0x0a9e('0x3e')],{})[_0x0a9e('0x19')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x3a')](handleError(_0x476688,null));};exports[_0x0a9e('0x18')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x3e')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x45c845[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x19')](saveUpdates(_0x45c845[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x37be73,null))[_0x0a9e('0x3a')](handleError(_0x37be73,null));};exports[_0x0a9e('0x1a')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x20')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x19')](removeEntity(_0xe401a,null))[_0x0a9e('0x3a')](handleError(_0xe401a,null));};exports[_0x0a9e('0x3f')]=function(_0x11545a,_0x61bb17,_0x30decb){var _0x2e5165=require(_0x0a9e('0x40'));return db['Schedule']['find']({'where':{'id':_0x11545a['params']['id']},'raw':!![]})[_0x0a9e('0x19')](handleEntityNotFound(_0x61bb17,null))[_0x0a9e('0x19')](function(){_0x2e5165[_0x0a9e('0x3f')](_0x11545a['params']['id']);})[_0x0a9e('0x19')](respondWithStatusCode(_0x61bb17,null))[_0x0a9e('0x3a')](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 6d158ff..45f45a3 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 _0xc53d=['bluebird','./schedule.attributes','exports','define','tools_schedules','lodash','../../config/logger','api','moment'];(function(_0x2a4567,_0xede612){var _0x56dcec=function(_0x1c93c8){while(--_0x1c93c8){_0x2a4567['push'](_0x2a4567['shift']());}};_0x56dcec(++_0xede612);}(_0xc53d,0xc2));var _0xdc53=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc53d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xdc53('0x0'));var util=require('util');var logger=require(_0xdc53('0x1'))(_0xdc53('0x2'));var moment=require(_0xdc53('0x3'));var BPromise=require(_0xdc53('0x4'));var rp=require('request-promise');var attributes=require(_0xdc53('0x5'));module[_0xdc53('0x6')]=function(_0xa354c7,_0xef0e85){return _0xa354c7[_0xdc53('0x7')]('Schedule',attributes,{'tableName':_0xdc53('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3be1=['moment','bluebird','request-promise','./schedule.attributes','exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x162c7c,_0x1df9f1){var _0x4917dc=function(_0x580131){while(--_0x580131){_0x162c7c['push'](_0x162c7c['shift']());}};_0x4917dc(++_0x1df9f1);}(_0x3be1,0x1ac));var _0x13be=function(_0x33f7d6,_0x37ea1b){_0x33f7d6=_0x33f7d6-0x0;var _0x2ca34f=_0x3be1[_0x33f7d6];return _0x2ca34f;};'use strict';var _=require(_0x13be('0x0'));var util=require(_0x13be('0x1'));var logger=require(_0x13be('0x2'))(_0x13be('0x3'));var moment=require(_0x13be('0x4'));var BPromise=require(_0x13be('0x5'));var rp=require(_0x13be('0x6'));var attributes=require(_0x13be('0x7'));module[_0x13be('0x8')]=function(_0x539ff6,_0x6a3385){return _0x539ff6[_0x13be('0x9')](_0x13be('0xa'),attributes,{'tableName':_0x13be('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 17e96bc..e39ec50 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 _0x5bd5=['request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x383055,_0x31fce7){var _0x2cbabc=function(_0x37c2ec){while(--_0x37c2ec){_0x383055['push'](_0x383055['shift']());}};_0x2cbabc(++_0x31fce7);}(_0x5bd5,0x11c));var _0x55bd=function(_0x4aa838,_0x4aa14f){_0x4aa838=_0x4aa838-0x0;var _0x3abff0=_0x5bd5[_0x4aa838];return _0x3abff0;};'use strict';var _=require(_0x55bd('0x0'));var util=require(_0x55bd('0x1'));var moment=require(_0x55bd('0x2'));var BPromise=require('bluebird');var rs=require(_0x55bd('0x3'));var fs=require('fs');var db=require(_0x55bd('0x4'))['db'];var utils=require(_0x55bd('0x5'));var logger=require(_0x55bd('0x6'))(_0x55bd('0x7'));var config=require('../../config/environment');var jayson=require(_0x55bd('0x8'));var client=jayson[_0x55bd('0x9')][_0x55bd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a3be7,_0x4b9858,_0x548a03){return new BPromise(function(_0x4578dc,_0x4255a0){return client[_0x55bd('0xb')](_0x5a3be7,_0x548a03)[_0x55bd('0xc')](function(_0x2233ad){logger[_0x55bd('0xd')](_0x55bd('0xe'),_0x4b9858,_0x55bd('0xf'));logger['debug'](_0x55bd('0x10'),_0x4b9858,_0x55bd('0xf'),JSON[_0x55bd('0x11')](_0x2233ad));if(_0x2233ad['error']){if(_0x2233ad[_0x55bd('0x12')][_0x55bd('0x13')]===0x1f4){logger[_0x55bd('0x12')]('Schedule,\x20%s,\x20%s',_0x4b9858,_0x2233ad[_0x55bd('0x12')]['message']);return _0x4255a0(_0x2233ad[_0x55bd('0x12')][_0x55bd('0x14')]);}logger[_0x55bd('0x12')]('Schedule,\x20%s,\x20%s',_0x4b9858,_0x2233ad['error'][_0x55bd('0x14')]);return _0x4578dc(_0x2233ad[_0x55bd('0x12')][_0x55bd('0x14')]);}else{logger['info'](_0x55bd('0xe'),_0x4b9858,_0x55bd('0xf'));_0x4578dc(_0x2233ad[_0x55bd('0x15')]['message']);}})[_0x55bd('0x16')](function(_0x2796b4){logger[_0x55bd('0x12')](_0x55bd('0xe'),_0x4b9858,_0x2796b4);_0x4255a0(_0x2796b4);});});} \ No newline at end of file +var _0x3940=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','randomstring'];(function(_0x54a40d,_0x210ac4){var _0x18e84f=function(_0x843057){while(--_0x843057){_0x54a40d['push'](_0x54a40d['shift']());}};_0x18e84f(++_0x210ac4);}(_0x3940,0x13c));var _0x0394=function(_0xadd1c2,_0x31eaa1){_0xadd1c2=_0xadd1c2-0x0;var _0x9b2e45=_0x3940[_0xadd1c2];return _0x9b2e45;};'use strict';var _=require(_0x0394('0x0'));var util=require(_0x0394('0x1'));var moment=require(_0x0394('0x2'));var BPromise=require('bluebird');var rs=require(_0x0394('0x3'));var fs=require('fs');var db=require(_0x0394('0x4'))['db'];var utils=require(_0x0394('0x5'));var logger=require(_0x0394('0x6'))(_0x0394('0x7'));var config=require(_0x0394('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0394('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2bdf9d,_0x1f31ed,_0x117d8c){return new BPromise(function(_0x55d221,_0x19f0e5){return client[_0x0394('0xa')](_0x2bdf9d,_0x117d8c)[_0x0394('0xb')](function(_0x39767c){logger[_0x0394('0xc')](_0x0394('0xd'),_0x1f31ed,_0x0394('0xe'));logger[_0x0394('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x1f31ed,_0x0394('0xe'),JSON[_0x0394('0x10')](_0x39767c));if(_0x39767c[_0x0394('0x11')]){if(_0x39767c[_0x0394('0x11')]['code']===0x1f4){logger['error'](_0x0394('0xd'),_0x1f31ed,_0x39767c['error'][_0x0394('0x12')]);return _0x19f0e5(_0x39767c[_0x0394('0x11')]['message']);}logger[_0x0394('0x11')](_0x0394('0xd'),_0x1f31ed,_0x39767c['error'][_0x0394('0x12')]);return _0x55d221(_0x39767c[_0x0394('0x11')][_0x0394('0x12')]);}else{logger[_0x0394('0xc')]('Schedule,\x20%s,\x20%s',_0x1f31ed,_0x0394('0xe'));_0x55d221(_0x39767c['result'][_0x0394('0x12')]);}})[_0x0394('0x13')](function(_0x260678){logger[_0x0394('0x11')](_0x0394('0xd'),_0x1f31ed,_0x260678);_0x19f0e5(_0x260678);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 85094f6..30fc360 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 _0x9d2d=['%s%s','extname','originalname','single','file','addLogo','join','server/files/images/logos/','format','logologin','post','put','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','show','getLogo','getLogoLogin','/:id/gdpr','diskStorage','root'];(function(_0x4ee3ff,_0x3a1788){var _0xd5ad67=function(_0x3fb530){while(--_0x3fb530){_0x4ee3ff['push'](_0x4ee3ff['shift']());}};_0xd5ad67(++_0x3a1788);}(_0x9d2d,0x124));var _0xd9d2=function(_0x392669,_0x449bce){_0x392669=_0x392669-0x0;var _0x1d4b1b=_0x9d2d[_0x392669];return _0x1d4b1b;};'use strict';var multer=require('multer');var util=require(_0xd9d2('0x0'));var path=require(_0xd9d2('0x1'));var express=require(_0xd9d2('0x2'));var router=express[_0xd9d2('0x3')]();var auth=require(_0xd9d2('0x4'));var interaction=require(_0xd9d2('0x5'));var config=require(_0xd9d2('0x6'));var controller=require(_0xd9d2('0x7'));router[_0xd9d2('0x8')]('/',auth[_0xd9d2('0x9')](),controller[_0xd9d2('0xa')]);router[_0xd9d2('0x8')](_0xd9d2('0xb'),controller[_0xd9d2('0xc')]);router['get']('/:id/logo',controller[_0xd9d2('0xd')]);router[_0xd9d2('0x8')]('/:id/logo_login',controller[_0xd9d2('0xe')]);router['get'](_0xd9d2('0xf'),controller['gdpr']);var upload=multer({'storage':multer[_0xd9d2('0x10')]({'destination':function(_0x200ec6,_0x1bf2ae,_0x349656){_0x349656(null,path['join'](config[_0xd9d2('0x11')],'server/files/images/logos/'));},'filename':function(_0x1c83de,_0x471697,_0x1bd9cd){_0x1bd9cd(null,util['format'](_0xd9d2('0x12'),'logo',path[_0xd9d2('0x13')](_0x471697[_0xd9d2('0x14')])));}})});router['post']('/:id/logo',upload[_0xd9d2('0x15')](_0xd9d2('0x16')),controller[_0xd9d2('0x17')]);var upload=multer({'storage':multer[_0xd9d2('0x10')]({'destination':function(_0xe15009,_0x44a276,_0x501d4f){_0x501d4f(null,path[_0xd9d2('0x18')](config[_0xd9d2('0x11')],_0xd9d2('0x19')));},'filename':function(_0x32ccbe,_0x10e063,_0x334c9a){_0x334c9a(null,util[_0xd9d2('0x1a')]('%s%s',_0xd9d2('0x1b'),path[_0xd9d2('0x13')](_0x10e063[_0xd9d2('0x14')])));}})});router[_0xd9d2('0x1c')]('/:id/logo_login',upload['single'](_0xd9d2('0x16')),controller['addLogoLogin']);router[_0xd9d2('0x1d')](_0xd9d2('0xb'),auth[_0xd9d2('0x9')](),controller['update']);module[_0xd9d2('0x1e')]=router; \ No newline at end of file +var _0xf1c6=['/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','diskStorage','root','server/files/images/logos/','%s%s','logo','post','single','file','addLogo','format','extname','originalname','addLogoLogin','/:id','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','isAuthenticated','index','show'];(function(_0x41b8e1,_0x4b7d60){var _0x3b3de5=function(_0x4d8318){while(--_0x4d8318){_0x41b8e1['push'](_0x41b8e1['shift']());}};_0x3b3de5(++_0x4b7d60);}(_0xf1c6,0xf4));var _0x6f1c=function(_0xb5a86,_0x57eb47){_0xb5a86=_0xb5a86-0x0;var _0x5a863e=_0xf1c6[_0xb5a86];return _0x5a863e;};'use strict';var multer=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var path=require(_0x6f1c('0x2'));var express=require(_0x6f1c('0x3'));var router=express[_0x6f1c('0x4')]();var auth=require(_0x6f1c('0x5'));var interaction=require(_0x6f1c('0x6'));var config=require('../../config/environment');var controller=require(_0x6f1c('0x7'));router[_0x6f1c('0x8')]('/',auth[_0x6f1c('0x9')](),controller[_0x6f1c('0xa')]);router['get']('/:id',controller[_0x6f1c('0xb')]);router[_0x6f1c('0x8')](_0x6f1c('0xc'),controller[_0x6f1c('0xd')]);router[_0x6f1c('0x8')](_0x6f1c('0xe'),controller['getLogoLogin']);router['get'](_0x6f1c('0xf'),controller[_0x6f1c('0x10')]);var upload=multer({'storage':multer[_0x6f1c('0x11')]({'destination':function(_0x1d6a01,_0x1421aa,_0x2e4fa9){_0x2e4fa9(null,path['join'](config[_0x6f1c('0x12')],_0x6f1c('0x13')));},'filename':function(_0x5cc3de,_0x3886ad,_0x5b3e91){_0x5b3e91(null,util['format'](_0x6f1c('0x14'),_0x6f1c('0x15'),path['extname'](_0x3886ad['originalname'])));}})});router[_0x6f1c('0x16')]('/:id/logo',upload[_0x6f1c('0x17')](_0x6f1c('0x18')),controller[_0x6f1c('0x19')]);var upload=multer({'storage':multer[_0x6f1c('0x11')]({'destination':function(_0xa3cc6e,_0x229e31,_0xbac2ee){_0xbac2ee(null,path['join'](config[_0x6f1c('0x12')],'server/files/images/logos/'));},'filename':function(_0x20a8cf,_0x5a0a2d,_0x1d968f){_0x1d968f(null,util[_0x6f1c('0x1a')]('%s%s','logologin',path[_0x6f1c('0x1b')](_0x5a0a2d[_0x6f1c('0x1c')])));}})});router[_0x6f1c('0x16')]('/:id/logo_login',upload[_0x6f1c('0x17')](_0x6f1c('0x18')),controller[_0x6f1c('0x1d')]);router['put'](_0x6f1c('0x1e'),auth[_0x6f1c('0x9')](),controller[_0x6f1c('0x1f')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 22dc2e8..c3f2fbc 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 _0x91e1=['/var/opt/motion2/server/files/sounds/converted','BOOLEAN','exports','INTEGER','min_mailbox','STRING'];(function(_0x3b7314,_0x4da394){var _0x38dda7=function(_0x37957f){while(--_0x37957f){_0x3b7314['push'](_0x3b7314['shift']());}};_0x38dda7(++_0x4da394);}(_0x91e1,0x1ac));var _0x191e=function(_0x4d6c8e,_0x2755f5){_0x4d6c8e=_0x4d6c8e-0x0;var _0x3f1a5f=_0x91e1[_0x4d6c8e];return _0x3f1a5f;};'use strict';var Sequelize=require('sequelize');module[_0x191e('0x0')]={'min_internal':{'type':Sequelize[_0x191e('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x191e('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x191e('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x191e('0x3')],'defaultValue':_0x191e('0x4')},'logo':{'type':Sequelize[_0x191e('0x3')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x191e('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x191e('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x191e('0x3')]},'turnaddr':{'type':Sequelize[_0x191e('0x3')]},'turnusername':{'type':Sequelize[_0x191e('0x3')]},'turnpassword':{'type':Sequelize[_0x191e('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x191e('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x191e('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x191e('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x191e('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x191e('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x191e('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x191e('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x191e('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x191e('0x5')],'defaultValue':!![]}}; \ No newline at end of file +var _0x73bd=['BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x73bd,0x1e0));var _0xd73b=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x73bd[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0xd73b('0x0'));module[_0xd73b('0x1')]={'min_internal':{'type':Sequelize[_0xd73b('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0xd73b('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd73b('0x4')],'defaultValue':_0xd73b('0x5')},'logo':{'type':Sequelize[_0xd73b('0x4')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd73b('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd73b('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xd73b('0x4')]},'turnusername':{'type':Sequelize[_0xd73b('0x4')]},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd73b('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xd73b('0x7')},'enableEmailPreview':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xd73b('0x8')},'chatTimeout':{'type':Sequelize[_0xd73b('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd73b('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ab74443..ea0a278 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 _0xbbdc=['request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','sendStatus','status','end','json','count','offset','reject','update','destroy','stack','name','send','index','Setting','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','length','limit','order','sort','where','filters','pick','day','merge','filter','map','options','include','findAll','rows','show','params','fields','find','body','get','readFileSync','join','root','server/files/templates/stun.ejs','render','server/files/templates/turn.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','logo','filename','addLogoLogin','loginLogo','getLogo','getLicense','defaultLogo','defaultLoginLogo','existsSync','toLower','custom','default_logo.png','ValidationError','download','../../config/license/util','getLogoLogin','server/files/images/logos','default_loginLogo.png','default','upperFirst','Sequelize','Logo\x20not\x20found','gdpr','securePassword','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http'];(function(_0x59797d,_0x5cabbe){var _0x42e634=function(_0x1588ce){while(--_0x1588ce){_0x59797d['push'](_0x59797d['shift']());}};_0x42e634(++_0x5cabbe);}(_0xbbdc,0xca));var _0xcbbd=function(_0x1f5a63,_0x511504){_0x1f5a63=_0x1f5a63-0x0;var _0x30bb7a=_0xbbdc[_0x1f5a63];return _0x30bb7a;};'use strict';var jsonpatch=require(_0xcbbd('0x0'));var rp=require(_0xcbbd('0x1'));var moment=require('moment');var BPromise=require(_0xcbbd('0x2'));var Mustache=require(_0xcbbd('0x3'));var util=require(_0xcbbd('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xcbbd('0x5'));var ejs=require(_0xcbbd('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcbbd('0x7'));var crypto=require(_0xcbbd('0x8'));var jsforce=require(_0xcbbd('0x9'));var deskjs=require(_0xcbbd('0xa'));var toCsv=require(_0xcbbd('0x5'));var querystring=require(_0xcbbd('0xb'));var Papa=require(_0xcbbd('0xc'));var qs=require(_0xcbbd('0xd'));var logger=require(_0xcbbd('0xe'))(_0xcbbd('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xcbbd('0x10'))['db'];var jayson=require(_0xcbbd('0x11'));var client=jayson[_0xcbbd('0x12')][_0xcbbd('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x18f817,_0x3672be,_0x4e5a6d,_0x59f8a1){return new BPromise(function(_0xf9aea6,_0x92b6a3){var _0x1b2f89=_0x59f8a1||client;return _0x1b2f89[_0xcbbd('0x14')](_0x18f817,_0x4e5a6d)[_0xcbbd('0x15')](function(_0x550cbb){logger[_0xcbbd('0x16')](_0xcbbd('0x17'),_0x3672be,'request\x20sent');logger[_0xcbbd('0x18')](_0xcbbd('0x19'),_0x3672be,_0xcbbd('0x1a'),JSON['stringify'](_0x550cbb));if(_0x550cbb[_0xcbbd('0x1b')]){if(_0x550cbb[_0xcbbd('0x1b')]['code']===0x1f4){logger['error'](_0xcbbd('0x17'),_0x3672be,_0x550cbb[_0xcbbd('0x1b')][_0xcbbd('0x1c')]);return _0x92b6a3(_0x550cbb['error'][_0xcbbd('0x1c')]);}logger['error'](_0xcbbd('0x17'),_0x3672be,_0x550cbb[_0xcbbd('0x1b')][_0xcbbd('0x1c')]);return _0xf9aea6(_0x550cbb['error'][_0xcbbd('0x1c')]);}else{logger[_0xcbbd('0x16')](_0xcbbd('0x17'),_0x3672be,_0xcbbd('0x1a'));_0xf9aea6(_0x550cbb[_0xcbbd('0x1d')][_0xcbbd('0x1c')]);}})[_0xcbbd('0x1e')](function(_0x135645){logger[_0xcbbd('0x1b')](_0xcbbd('0x17'),_0x3672be,_0x135645);_0x92b6a3(_0x135645);});});}function respondWithStatusCode(_0x4f5428,_0x3e4816){_0x3e4816=_0x3e4816||0xcc;return function(_0x1cc0aa){if(_0x1cc0aa){return _0x4f5428[_0xcbbd('0x1f')](_0x3e4816);}return _0x4f5428[_0xcbbd('0x20')](_0x3e4816)[_0xcbbd('0x21')]();};}function respondWithResult(_0x1c0233,_0x474974){_0x474974=_0x474974||0xc8;return function(_0x19d366){if(_0x19d366){return _0x1c0233['status'](_0x474974)[_0xcbbd('0x22')](_0x19d366);}};}function respondWithFilteredResult(_0x353b0c,_0x4ea620){return function(_0x331f3b){if(_0x331f3b){var _0x1d6231=_0x331f3b[_0xcbbd('0x23')],_0x4f74af=_0x4ea620[_0xcbbd('0x24')],_0x5c7628=_0x4ea620[_0xcbbd('0x24')]+_0x4ea620['limit'],_0x3e8b63;if(_0x5c7628>=_0x1d6231){_0x5c7628=_0x1d6231;_0x3e8b63=0xc8;}else{_0x3e8b63=0xce;}_0x353b0c['status'](_0x3e8b63);return _0x353b0c['set']('Content-Range',_0x4f74af+'-'+_0x5c7628+'/'+_0x1d6231)[_0xcbbd('0x22')](_0x331f3b);}return null;};}function patchUpdates(_0x41f058){return function(_0x21dc51){try{jsonpatch['apply'](_0x21dc51,_0x41f058,!![]);}catch(_0x1106d9){return BPromise[_0xcbbd('0x25')](_0x1106d9);}return _0x21dc51['save']();};}function saveUpdates(_0x26bf72,_0x469397){return function(_0x38169e){if(_0x38169e){return _0x38169e[_0xcbbd('0x26')](_0x26bf72)[_0xcbbd('0x15')](function(_0x230b1e){return _0x230b1e;});}return null;};}function removeEntity(_0x43f266,_0xddb32){return function(_0x1cb8ea){if(_0x1cb8ea){return _0x1cb8ea[_0xcbbd('0x27')]()[_0xcbbd('0x15')](function(){_0x43f266[_0xcbbd('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf79ddd,_0x36d459){return function(_0x4ae036){if(!_0x4ae036){_0xf79ddd[_0xcbbd('0x1f')](0x194);}return _0x4ae036;};}function handleError(_0x153f59,_0x4875db){_0x4875db=_0x4875db||0x1f4;return function(_0x3f3b2f){logger['error'](_0x3f3b2f[_0xcbbd('0x28')]);if(_0x3f3b2f[_0xcbbd('0x29')]){delete _0x3f3b2f[_0xcbbd('0x29')];}_0x153f59['status'](_0x4875db)[_0xcbbd('0x2a')](_0x3f3b2f);};}exports[_0xcbbd('0x2b')]=function(_0x52b0f1,_0x23aaa5){var _0x6ea5c2={},_0x54f239={},_0x1ecd85={'count':0x0,'rows':[]};var _0x69c550=db[_0xcbbd('0x2c')][_0xcbbd('0x2d')];_0x54f239[_0xcbbd('0x2e')]=_[_0xcbbd('0x2f')](_0x69c550);var _0x2c1857={'dateStart':_0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x31')],'dateEnd':_0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x32')]};delete _0x52b0f1['query']['dateStart'];delete _0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x32')];_0x54f239['query']=_[_0xcbbd('0x2f')](_0x52b0f1[_0xcbbd('0x30')]);_0x54f239['filters']=_[_0xcbbd('0x33')](_0x54f239[_0xcbbd('0x2e')],_0x54f239['query']);_0x6ea5c2[_0xcbbd('0x34')]=_[_0xcbbd('0x33')](_0x54f239['model'],qs['fields'](_0x52b0f1[_0xcbbd('0x30')]['fields']));_0x6ea5c2[_0xcbbd('0x34')]=_0x6ea5c2[_0xcbbd('0x34')][_0xcbbd('0x35')]?_0x6ea5c2[_0xcbbd('0x34')]:_0x54f239[_0xcbbd('0x2e')];if(!_0x52b0f1[_0xcbbd('0x30')]['hasOwnProperty']('nolimit')){_0x6ea5c2[_0xcbbd('0x36')]=qs['limit'](_0x52b0f1[_0xcbbd('0x30')]['limit']);_0x6ea5c2[_0xcbbd('0x24')]=qs[_0xcbbd('0x24')](_0x52b0f1[_0xcbbd('0x30')]['offset']);}_0x6ea5c2[_0xcbbd('0x37')]=qs['sort'](_0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x38')]);_0x6ea5c2[_0xcbbd('0x39')]=qs[_0xcbbd('0x3a')](_[_0xcbbd('0x3b')](_0x52b0f1[_0xcbbd('0x30')],_0x54f239[_0xcbbd('0x3a')]));if(_0x2c1857[_0xcbbd('0x31')]){if(_0x2c1857[_0xcbbd('0x32')]){_0x2c1857[_0xcbbd('0x32')]=moment(_0x2c1857[_0xcbbd('0x32')])['add'](0x1,_0xcbbd('0x3c'));}else{_0x2c1857[_0xcbbd('0x32')]=moment(_0x2c1857[_0xcbbd('0x31')])['add'](0x1,_0xcbbd('0x3c'));}_[_0xcbbd('0x3d')](_0x6ea5c2[_0xcbbd('0x39')],{'createdAt':{'$gte':_0x2c1857[_0xcbbd('0x31')],'$lte':_0x2c1857['dateEnd']}});}if(_0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x3e')]){_0x6ea5c2['where']=_[_0xcbbd('0x3d')](_0x6ea5c2[_0xcbbd('0x39')],{'$or':_[_0xcbbd('0x3f')](_0x6ea5c2[_0xcbbd('0x34')],function(_0x1b4197){var _0x42b3d4={};_0x42b3d4[_0x1b4197]={'$like':'%'+_0x52b0f1[_0xcbbd('0x30')][_0xcbbd('0x3e')]+'%'};return _0x42b3d4;})});}_0x6ea5c2=_[_0xcbbd('0x3d')]({},_0x6ea5c2,_0x52b0f1[_0xcbbd('0x40')]);var _0x3d72e9={'where':_0x6ea5c2['where']};return db[_0xcbbd('0x2c')][_0xcbbd('0x23')](_0x3d72e9)['then'](function(_0x1a250c){_0x1ecd85[_0xcbbd('0x23')]=_0x1a250c;if(_0x52b0f1[_0xcbbd('0x30')]['includeAll']){_0x6ea5c2[_0xcbbd('0x41')]=[{'all':!![]}];}return db[_0xcbbd('0x2c')][_0xcbbd('0x42')](_0x6ea5c2);})[_0xcbbd('0x15')](function(_0x558700){_0x1ecd85[_0xcbbd('0x43')]=_0x558700;return _0x1ecd85;})[_0xcbbd('0x15')](respondWithFilteredResult(_0x23aaa5,_0x6ea5c2))[_0xcbbd('0x1e')](handleError(_0x23aaa5,null));};exports[_0xcbbd('0x44')]=function(_0x1c7859,_0x5477c2){var _0x209f02={'raw':![],'where':{'id':_0x1c7859[_0xcbbd('0x45')]['id']}},_0x26575c={};_0x26575c[_0xcbbd('0x2e')]=_['keys'](db['Setting']['rawAttributes']);_0x26575c[_0xcbbd('0x30')]=_[_0xcbbd('0x2f')](_0x1c7859[_0xcbbd('0x30')]);_0x26575c['filters']=_[_0xcbbd('0x33')](_0x26575c['model'],_0x26575c[_0xcbbd('0x30')]);_0x209f02['attributes']=_[_0xcbbd('0x33')](_0x26575c[_0xcbbd('0x2e')],qs['fields'](_0x1c7859[_0xcbbd('0x30')][_0xcbbd('0x46')]));_0x209f02[_0xcbbd('0x34')]=_0x209f02[_0xcbbd('0x34')][_0xcbbd('0x35')]?_0x209f02[_0xcbbd('0x34')]:_0x26575c[_0xcbbd('0x2e')];if(_0x1c7859[_0xcbbd('0x30')]['includeAll']){_0x209f02[_0xcbbd('0x41')]=[{'all':!![]}];}_0x209f02=_['merge']({},_0x209f02,_0x1c7859[_0xcbbd('0x40')]);return db['Setting'][_0xcbbd('0x47')](_0x209f02)['then'](handleEntityNotFound(_0x5477c2,null))['then'](respondWithResult(_0x5477c2,null))[_0xcbbd('0x1e')](handleError(_0x5477c2,null));};exports[_0xcbbd('0x26')]=function(_0xdb9868,_0x202acf,_0x2d0bff){var _0x48fbab;return db[_0xcbbd('0x2c')][_0xcbbd('0x47')]({'where':{'id':_0xdb9868[_0xcbbd('0x45')]['id']}})[_0xcbbd('0x15')](handleEntityNotFound(_0x202acf,null))['then'](saveUpdates(_0xdb9868[_0xcbbd('0x48')],null))[_0xcbbd('0x15')](function(_0x1fe29c){if(_0x1fe29c){_0x48fbab=_0x1fe29c[_0xcbbd('0x49')]({'plain':!![]});var _0x1d6d20=fs[_0xcbbd('0x4a')](path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0xcbbd('0x4d')),'utf8');var _0x42761d=ejs[_0xcbbd('0x4e')](_0x1d6d20,_0x48fbab);var _0x14b653=fs[_0xcbbd('0x4a')](path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0xcbbd('0x4f')),_0xcbbd('0x50'));var _0x382cdb=ejs['render'](_0x14b653,_0x48fbab);fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x42761d);fs[_0xcbbd('0x51')]('/etc/asterisk/turn_xcally.conf',_0x382cdb);return respondWithRpcPromise(_0xcbbd('0x52'),_0xcbbd('0x26'),{'module':_0xcbbd('0x53')});}})[_0xcbbd('0x15')](function(){return respondWithRpcPromise(_0xcbbd('0x52'),_0xcbbd('0x26'),{'module':_0xcbbd('0x54')});})[_0xcbbd('0x15')](function(){return _0x48fbab||null;})[_0xcbbd('0x15')](respondWithResult(_0x202acf,null))[_0xcbbd('0x1e')](handleError(_0x202acf,null));};exports[_0xcbbd('0x55')]=function(_0x165ed6,_0x576a7b,_0x17d2c4){if(_0x165ed6['file']&&_0x165ed6[_0xcbbd('0x56')]['filename']){_0x165ed6[_0xcbbd('0x48')][_0xcbbd('0x57')]=_0x165ed6[_0xcbbd('0x56')][_0xcbbd('0x58')];}return db[_0xcbbd('0x2c')][_0xcbbd('0x47')]({'where':{'id':_0x165ed6[_0xcbbd('0x45')]['id']}})[_0xcbbd('0x15')](handleEntityNotFound(_0x576a7b,null))[_0xcbbd('0x15')](saveUpdates(_0x165ed6[_0xcbbd('0x48')],null))[_0xcbbd('0x15')](respondWithResult(_0x576a7b,null))[_0xcbbd('0x1e')](handleError(_0x576a7b,null));};exports[_0xcbbd('0x59')]=function(_0x1f3f8b,_0x186bf0,_0x1d9bfa){if(_0x1f3f8b[_0xcbbd('0x56')]&&_0x1f3f8b['file']['filename']){_0x1f3f8b['body'][_0xcbbd('0x5a')]=_0x1f3f8b[_0xcbbd('0x56')][_0xcbbd('0x58')];}return db['Setting'][_0xcbbd('0x47')]({'where':{'id':_0x1f3f8b[_0xcbbd('0x45')]['id']}})[_0xcbbd('0x15')](handleEntityNotFound(_0x186bf0,null))[_0xcbbd('0x15')](saveUpdates(_0x1f3f8b[_0xcbbd('0x48')],null))[_0xcbbd('0x15')](respondWithResult(_0x186bf0,null))[_0xcbbd('0x1e')](handleError(_0x186bf0,null));};var utilLicense=require('../../config/license/util');exports[_0xcbbd('0x5b')]=function(_0x7ff9f,_0x25f1c2,_0x19e985){var _0x578eec='server/files/images/logos';var _0x2dde89={'custom':![]};return utilLicense[_0xcbbd('0x5c')]()[_0xcbbd('0x15')](function(_0x2cbe73){if(_0x2cbe73){_0x2dde89=_0x2cbe73;}return db[_0xcbbd('0x2c')][_0xcbbd('0x47')]({'where':{'id':_0x7ff9f[_0xcbbd('0x45')]['id']},'attributes':[_0xcbbd('0x57'),_0xcbbd('0x5a'),_0xcbbd('0x5d'),_0xcbbd('0x5e')],'raw':!![]});})[_0xcbbd('0x15')](handleEntityNotFound(_0x25f1c2,null))[_0xcbbd('0x15')](function(_0x434fb3){if(_0x434fb3){var _0x58db90=_0x434fb3[_0xcbbd('0x57')]&&fs[_0xcbbd('0x5f')](path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0x578eec,_[_0xcbbd('0x60')](_0x434fb3[_0xcbbd('0x57')])))?path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0x578eec,_[_0xcbbd('0x60')](_0x434fb3[_0xcbbd('0x57')])):path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0x578eec,_['toLower']('default_logo.png'));var _0x3386ee='default'+_['upperFirst'](_0xcbbd('0x57'));if(_0x434fb3[_0x3386ee]||!_0x2dde89[_0xcbbd('0x61')]){_0x58db90=path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0x578eec,_[_0xcbbd('0x60')](_0xcbbd('0x62')));}if(!fs[_0xcbbd('0x5f')](_0x58db90)){throw new db['Sequelize'][(_0xcbbd('0x63'))]('Logo\x20not\x20found');}return _0x25f1c2[_0xcbbd('0x64')](_0x58db90);}})['catch'](handleError(_0x25f1c2,null));};var utilLicense=require(_0xcbbd('0x65'));exports[_0xcbbd('0x66')]=function(_0x3d1b6e,_0x354936,_0x408216){var _0x581673=_0xcbbd('0x67');var _0x5bec6b={'custom':![]};return utilLicense['getLicense']()[_0xcbbd('0x15')](function(_0x5d28a4){if(_0x5d28a4){_0x5bec6b=_0x5d28a4;}return db[_0xcbbd('0x2c')][_0xcbbd('0x47')]({'where':{'id':_0x3d1b6e['params']['id']},'attributes':[_0xcbbd('0x57'),_0xcbbd('0x5a'),_0xcbbd('0x5d'),_0xcbbd('0x5e')],'raw':!![]});})[_0xcbbd('0x15')](handleEntityNotFound(_0x354936,null))[_0xcbbd('0x15')](function(_0x1e37be){if(_0x1e37be){var _0x536107=_0x1e37be['loginLogo']&&fs[_0xcbbd('0x5f')](path['join'](config[_0xcbbd('0x4c')],_0x581673,_[_0xcbbd('0x60')](_0x1e37be[_0xcbbd('0x5a')])))?path[_0xcbbd('0x4b')](config[_0xcbbd('0x4c')],_0x581673,_['toLower'](_0x1e37be['loginLogo'])):path[_0xcbbd('0x4b')](config['root'],_0x581673,_[_0xcbbd('0x60')](_0xcbbd('0x68')));var _0x413ff5=_0xcbbd('0x69')+_[_0xcbbd('0x6a')](_0xcbbd('0x5a'));if(_0x1e37be[_0x413ff5]||!_0x5bec6b['custom']){_0x536107=path['join'](config['root'],_0x581673,_[_0xcbbd('0x60')](_0xcbbd('0x68')));}if(!fs[_0xcbbd('0x5f')](_0x536107)){throw new db[(_0xcbbd('0x6b'))][(_0xcbbd('0x63'))](_0xcbbd('0x6c'));}return _0x354936[_0xcbbd('0x64')](_0x536107);}})[_0xcbbd('0x1e')](handleError(_0x354936,null));};exports[_0xcbbd('0x6d')]=function(_0x7452a3,_0x37923b){return db[_0xcbbd('0x2c')][_0xcbbd('0x47')]({'where':{'id':_0x7452a3[_0xcbbd('0x45')]['id']},'attributes':[_0xcbbd('0x6e')]})[_0xcbbd('0x15')](respondWithResult(_0x37923b,null))[_0xcbbd('0x1e')](handleError(_0x37923b,null));}; \ No newline at end of file +var _0x976f=['Setting','model','keys','dateStart','query','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','day','add','merge','filter','map','includeAll','include','findAll','rows','catch','options','find','params','get','join','root','utf8','render','readFileSync','server/files/templates/turn.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','res_rtp_asterisk.so','addLogo','file','filename','body','logo','addLogoLogin','../../config/license/util','getLogo','server/files/images/logos','getLicense','defaultLogo','defaultLoginLogo','existsSync','toLower','default_logo.png','upperFirst','custom','ValidationError','Logo\x20not\x20found','getLogoLogin','loginLogo','default_loginLogo.png','Sequelize','download','gdpr','securePassword','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','squel','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x976f,0x121));var _0xf976=function(_0x18da58,_0x46f2cf){_0x18da58=_0x18da58-0x0;var _0x37e602=_0x976f[_0x18da58];return _0x37e602;};'use strict';var jsonpatch=require(_0xf976('0x0'));var rp=require(_0xf976('0x1'));var moment=require(_0xf976('0x2'));var BPromise=require(_0xf976('0x3'));var Mustache=require('mustache');var util=require(_0xf976('0x4'));var path=require('path');var sox=require(_0xf976('0x5'));var csv=require('to-csv');var ejs=require(_0xf976('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf976('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf976('0x8'));var toCsv=require(_0xf976('0x9'));var querystring=require(_0xf976('0xa'));var Papa=require(_0xf976('0xb'));var qs=require(_0xf976('0xc'));var logger=require(_0xf976('0xd'))(_0xf976('0xe'));var utils=require(_0xf976('0xf'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x327f97,_0x23d112,_0x18a56e,_0x27bc90){return new BPromise(function(_0x4c2d51,_0x4dbf75){var _0x22c6b0=_0x27bc90||client;return _0x22c6b0[_0xf976('0x10')](_0x327f97,_0x18a56e)[_0xf976('0x11')](function(_0x4e0d97){logger[_0xf976('0x12')](_0xf976('0x13'),_0x23d112,_0xf976('0x14'));logger[_0xf976('0x15')]('Setting,\x20%s,\x20%s,\x20%s',_0x23d112,'request\x20sent',JSON[_0xf976('0x16')](_0x4e0d97));if(_0x4e0d97[_0xf976('0x17')]){if(_0x4e0d97[_0xf976('0x17')][_0xf976('0x18')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x23d112,_0x4e0d97['error'][_0xf976('0x19')]);return _0x4dbf75(_0x4e0d97['error'][_0xf976('0x19')]);}logger['error'](_0xf976('0x13'),_0x23d112,_0x4e0d97[_0xf976('0x17')][_0xf976('0x19')]);return _0x4c2d51(_0x4e0d97[_0xf976('0x17')][_0xf976('0x19')]);}else{logger[_0xf976('0x12')](_0xf976('0x13'),_0x23d112,_0xf976('0x14'));_0x4c2d51(_0x4e0d97['result'][_0xf976('0x19')]);}})['catch'](function(_0x46aaeb){logger[_0xf976('0x17')](_0xf976('0x13'),_0x23d112,_0x46aaeb);_0x4dbf75(_0x46aaeb);});});}function respondWithStatusCode(_0x2df469,_0x2ee38c){_0x2ee38c=_0x2ee38c||0xcc;return function(_0xeef397){if(_0xeef397){return _0x2df469['sendStatus'](_0x2ee38c);}return _0x2df469[_0xf976('0x1a')](_0x2ee38c)[_0xf976('0x1b')]();};}function respondWithResult(_0x526cca,_0x556662){_0x556662=_0x556662||0xc8;return function(_0x441a7c){if(_0x441a7c){return _0x526cca[_0xf976('0x1a')](_0x556662)[_0xf976('0x1c')](_0x441a7c);}};}function respondWithFilteredResult(_0x3c6cef,_0x7765a){return function(_0x25a09c){if(_0x25a09c){var _0x37ca5b=_0x25a09c[_0xf976('0x1d')],_0x1035d8=_0x7765a['offset'],_0x1a5db1=_0x7765a[_0xf976('0x1e')]+_0x7765a[_0xf976('0x1f')],_0x36bdf5;if(_0x1a5db1>=_0x37ca5b){_0x1a5db1=_0x37ca5b;_0x36bdf5=0xc8;}else{_0x36bdf5=0xce;}_0x3c6cef[_0xf976('0x1a')](_0x36bdf5);return _0x3c6cef[_0xf976('0x20')](_0xf976('0x21'),_0x1035d8+'-'+_0x1a5db1+'/'+_0x37ca5b)[_0xf976('0x1c')](_0x25a09c);}return null;};}function patchUpdates(_0x42d539){return function(_0x2bf0ec){try{jsonpatch[_0xf976('0x22')](_0x2bf0ec,_0x42d539,!![]);}catch(_0x34f47b){return BPromise[_0xf976('0x23')](_0x34f47b);}return _0x2bf0ec[_0xf976('0x24')]();};}function saveUpdates(_0x18dfef,_0x1d31a1){return function(_0x2ceb78){if(_0x2ceb78){return _0x2ceb78[_0xf976('0x25')](_0x18dfef)[_0xf976('0x11')](function(_0x521ab2){return _0x521ab2;});}return null;};}function removeEntity(_0x11c21a,_0x2a34ea){return function(_0x537c9b){if(_0x537c9b){return _0x537c9b[_0xf976('0x26')]()[_0xf976('0x11')](function(){_0x11c21a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x352e4e,_0x20c65f){return function(_0x120df5){if(!_0x120df5){_0x352e4e[_0xf976('0x27')](0x194);}return _0x120df5;};}function handleError(_0x19ec89,_0x135b16){_0x135b16=_0x135b16||0x1f4;return function(_0x7e7a45){logger['error'](_0x7e7a45[_0xf976('0x28')]);if(_0x7e7a45[_0xf976('0x29')]){delete _0x7e7a45[_0xf976('0x29')];}_0x19ec89[_0xf976('0x1a')](_0x135b16)[_0xf976('0x2a')](_0x7e7a45);};}exports[_0xf976('0x2b')]=function(_0x2155da,_0x462fd9){var _0x13de3f={},_0x55ec10={},_0x35af19={'count':0x0,'rows':[]};var _0x1c6126=db[_0xf976('0x2c')]['rawAttributes'];_0x55ec10[_0xf976('0x2d')]=_[_0xf976('0x2e')](_0x1c6126);var _0x35c751={'dateStart':_0x2155da['query'][_0xf976('0x2f')],'dateEnd':_0x2155da[_0xf976('0x30')][_0xf976('0x31')]};delete _0x2155da['query'][_0xf976('0x2f')];delete _0x2155da[_0xf976('0x30')][_0xf976('0x31')];_0x55ec10[_0xf976('0x30')]=_['keys'](_0x2155da[_0xf976('0x30')]);_0x55ec10[_0xf976('0x32')]=_[_0xf976('0x33')](_0x55ec10[_0xf976('0x2d')],_0x55ec10[_0xf976('0x30')]);_0x13de3f['attributes']=_['intersection'](_0x55ec10[_0xf976('0x2d')],qs['fields'](_0x2155da[_0xf976('0x30')][_0xf976('0x34')]));_0x13de3f[_0xf976('0x35')]=_0x13de3f[_0xf976('0x35')][_0xf976('0x36')]?_0x13de3f[_0xf976('0x35')]:_0x55ec10['model'];if(!_0x2155da['query'][_0xf976('0x37')](_0xf976('0x38'))){_0x13de3f[_0xf976('0x1f')]=qs[_0xf976('0x1f')](_0x2155da[_0xf976('0x30')][_0xf976('0x1f')]);_0x13de3f[_0xf976('0x1e')]=qs[_0xf976('0x1e')](_0x2155da[_0xf976('0x30')][_0xf976('0x1e')]);}_0x13de3f[_0xf976('0x39')]=qs[_0xf976('0x3a')](_0x2155da[_0xf976('0x30')][_0xf976('0x3a')]);_0x13de3f[_0xf976('0x3b')]=qs[_0xf976('0x32')](_[_0xf976('0x3c')](_0x2155da[_0xf976('0x30')],_0x55ec10[_0xf976('0x32')]));if(_0x35c751[_0xf976('0x2f')]){if(_0x35c751[_0xf976('0x31')]){_0x35c751[_0xf976('0x31')]=moment(_0x35c751[_0xf976('0x31')])['add'](0x1,_0xf976('0x3d'));}else{_0x35c751[_0xf976('0x31')]=moment(_0x35c751['dateStart'])[_0xf976('0x3e')](0x1,_0xf976('0x3d'));}_[_0xf976('0x3f')](_0x13de3f[_0xf976('0x3b')],{'createdAt':{'$gte':_0x35c751['dateStart'],'$lte':_0x35c751[_0xf976('0x31')]}});}if(_0x2155da['query'][_0xf976('0x40')]){_0x13de3f['where']=_[_0xf976('0x3f')](_0x13de3f['where'],{'$or':_[_0xf976('0x41')](_0x13de3f[_0xf976('0x35')],function(_0x35a76e){var _0x49b766={};_0x49b766[_0x35a76e]={'$like':'%'+_0x2155da[_0xf976('0x30')][_0xf976('0x40')]+'%'};return _0x49b766;})});}_0x13de3f=_[_0xf976('0x3f')]({},_0x13de3f,_0x2155da['options']);var _0x172377={'where':_0x13de3f[_0xf976('0x3b')]};return db[_0xf976('0x2c')]['count'](_0x172377)[_0xf976('0x11')](function(_0x1b1145){_0x35af19['count']=_0x1b1145;if(_0x2155da[_0xf976('0x30')][_0xf976('0x42')]){_0x13de3f[_0xf976('0x43')]=[{'all':!![]}];}return db[_0xf976('0x2c')][_0xf976('0x44')](_0x13de3f);})[_0xf976('0x11')](function(_0x3ef305){_0x35af19[_0xf976('0x45')]=_0x3ef305;return _0x35af19;})[_0xf976('0x11')](respondWithFilteredResult(_0x462fd9,_0x13de3f))[_0xf976('0x46')](handleError(_0x462fd9,null));};exports['show']=function(_0x4dcac1,_0x1719e9){var _0x3456bd={'raw':![],'where':{'id':_0x4dcac1['params']['id']}},_0x2912ea={};_0x2912ea[_0xf976('0x2d')]=_[_0xf976('0x2e')](db[_0xf976('0x2c')]['rawAttributes']);_0x2912ea[_0xf976('0x30')]=_['keys'](_0x4dcac1[_0xf976('0x30')]);_0x2912ea[_0xf976('0x32')]=_[_0xf976('0x33')](_0x2912ea['model'],_0x2912ea[_0xf976('0x30')]);_0x3456bd['attributes']=_['intersection'](_0x2912ea[_0xf976('0x2d')],qs[_0xf976('0x34')](_0x4dcac1[_0xf976('0x30')]['fields']));_0x3456bd[_0xf976('0x35')]=_0x3456bd[_0xf976('0x35')]['length']?_0x3456bd['attributes']:_0x2912ea[_0xf976('0x2d')];if(_0x4dcac1[_0xf976('0x30')]['includeAll']){_0x3456bd[_0xf976('0x43')]=[{'all':!![]}];}_0x3456bd=_['merge']({},_0x3456bd,_0x4dcac1[_0xf976('0x47')]);return db[_0xf976('0x2c')][_0xf976('0x48')](_0x3456bd)['then'](handleEntityNotFound(_0x1719e9,null))[_0xf976('0x11')](respondWithResult(_0x1719e9,null))['catch'](handleError(_0x1719e9,null));};exports[_0xf976('0x25')]=function(_0x5d6d16,_0x5bfed4,_0x3e5ec2){var _0x4e092e;return db['Setting'][_0xf976('0x48')]({'where':{'id':_0x5d6d16[_0xf976('0x49')]['id']}})[_0xf976('0x11')](handleEntityNotFound(_0x5bfed4,null))[_0xf976('0x11')](saveUpdates(_0x5d6d16['body'],null))[_0xf976('0x11')](function(_0x29e41d){if(_0x29e41d){_0x4e092e=_0x29e41d[_0xf976('0x4a')]({'plain':!![]});var _0x273fa4=fs['readFileSync'](path[_0xf976('0x4b')](config[_0xf976('0x4c')],'server/files/templates/stun.ejs'),_0xf976('0x4d'));var _0x44bc06=ejs[_0xf976('0x4e')](_0x273fa4,_0x4e092e);var _0x588cb2=fs[_0xf976('0x4f')](path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0xf976('0x50')),'utf8');var _0x2de55c=ejs['render'](_0x588cb2,_0x4e092e);fs[_0xf976('0x51')]('/etc/asterisk/stun_xcally.conf',_0x44bc06);fs[_0xf976('0x51')](_0xf976('0x52'),_0x2de55c);return respondWithRpcPromise('Reload',_0xf976('0x25'),{'module':_0xf976('0x53')});}})[_0xf976('0x11')](function(){return respondWithRpcPromise('Reload',_0xf976('0x25'),{'module':_0xf976('0x54')});})[_0xf976('0x11')](function(){return _0x4e092e||null;})[_0xf976('0x11')](respondWithResult(_0x5bfed4,null))[_0xf976('0x46')](handleError(_0x5bfed4,null));};exports[_0xf976('0x55')]=function(_0xff27fb,_0x147b41,_0x2484f3){if(_0xff27fb[_0xf976('0x56')]&&_0xff27fb[_0xf976('0x56')][_0xf976('0x57')]){_0xff27fb[_0xf976('0x58')][_0xf976('0x59')]=_0xff27fb[_0xf976('0x56')][_0xf976('0x57')];}return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0xff27fb[_0xf976('0x49')]['id']}})['then'](handleEntityNotFound(_0x147b41,null))[_0xf976('0x11')](saveUpdates(_0xff27fb['body'],null))[_0xf976('0x11')](respondWithResult(_0x147b41,null))[_0xf976('0x46')](handleError(_0x147b41,null));};exports[_0xf976('0x5a')]=function(_0x1db2dc,_0x59d634,_0xd8329a){if(_0x1db2dc[_0xf976('0x56')]&&_0x1db2dc[_0xf976('0x56')][_0xf976('0x57')]){_0x1db2dc[_0xf976('0x58')]['loginLogo']=_0x1db2dc['file'][_0xf976('0x57')];}return db['Setting'][_0xf976('0x48')]({'where':{'id':_0x1db2dc[_0xf976('0x49')]['id']}})[_0xf976('0x11')](handleEntityNotFound(_0x59d634,null))[_0xf976('0x11')](saveUpdates(_0x1db2dc['body'],null))['then'](respondWithResult(_0x59d634,null))[_0xf976('0x46')](handleError(_0x59d634,null));};var utilLicense=require(_0xf976('0x5b'));exports[_0xf976('0x5c')]=function(_0x18980a,_0x3b075e,_0x30416f){var _0x2adda3=_0xf976('0x5d');var _0x1d0b99={'custom':![]};return utilLicense[_0xf976('0x5e')]()['then'](function(_0x5c256c){if(_0x5c256c){_0x1d0b99=_0x5c256c;}return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0x18980a[_0xf976('0x49')]['id']},'attributes':['logo','loginLogo',_0xf976('0x5f'),_0xf976('0x60')],'raw':!![]});})[_0xf976('0x11')](handleEntityNotFound(_0x3b075e,null))[_0xf976('0x11')](function(_0x13bb49){if(_0x13bb49){var _0x221d93=_0x13bb49[_0xf976('0x59')]&&fs[_0xf976('0x61')](path[_0xf976('0x4b')](config['root'],_0x2adda3,_[_0xf976('0x62')](_0x13bb49[_0xf976('0x59')])))?path[_0xf976('0x4b')](config['root'],_0x2adda3,_['toLower'](_0x13bb49[_0xf976('0x59')])):path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x2adda3,_[_0xf976('0x62')](_0xf976('0x63')));var _0x5ef288='default'+_[_0xf976('0x64')](_0xf976('0x59'));if(_0x13bb49[_0x5ef288]||!_0x1d0b99[_0xf976('0x65')]){_0x221d93=path['join'](config[_0xf976('0x4c')],_0x2adda3,_['toLower'](_0xf976('0x63')));}if(!fs[_0xf976('0x61')](_0x221d93)){throw new db['Sequelize'][(_0xf976('0x66'))](_0xf976('0x67'));}return _0x3b075e['download'](_0x221d93);}})[_0xf976('0x46')](handleError(_0x3b075e,null));};var utilLicense=require('../../config/license/util');exports[_0xf976('0x68')]=function(_0x335709,_0x4efabe,_0xf95397){var _0x58ad96='server/files/images/logos';var _0x5377d6={'custom':![]};return utilLicense[_0xf976('0x5e')]()['then'](function(_0x114eed){if(_0x114eed){_0x5377d6=_0x114eed;}return db['Setting']['find']({'where':{'id':_0x335709[_0xf976('0x49')]['id']},'attributes':[_0xf976('0x59'),_0xf976('0x69'),'defaultLogo',_0xf976('0x60')],'raw':!![]});})[_0xf976('0x11')](handleEntityNotFound(_0x4efabe,null))[_0xf976('0x11')](function(_0x30770c){if(_0x30770c){var _0x3ab6cb=_0x30770c['loginLogo']&&fs[_0xf976('0x61')](path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_['toLower'](_0x30770c[_0xf976('0x69')])))?path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0x30770c['loginLogo'])):path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0xf976('0x6a')));var _0x4fb011='default'+_['upperFirst'](_0xf976('0x69'));if(_0x30770c[_0x4fb011]||!_0x5377d6['custom']){_0x3ab6cb=path[_0xf976('0x4b')](config[_0xf976('0x4c')],_0x58ad96,_[_0xf976('0x62')](_0xf976('0x6a')));}if(!fs[_0xf976('0x61')](_0x3ab6cb)){throw new db[(_0xf976('0x6b'))][(_0xf976('0x66'))](_0xf976('0x67'));}return _0x4efabe[_0xf976('0x6c')](_0x3ab6cb);}})[_0xf976('0x46')](handleError(_0x4efabe,null));};exports[_0xf976('0x6d')]=function(_0xfaa83d,_0x5216c1){return db[_0xf976('0x2c')][_0xf976('0x48')]({'where':{'id':_0xfaa83d[_0xf976('0x49')]['id']},'attributes':[_0xf976('0x6e')]})[_0xf976('0x11')](respondWithResult(_0x5216c1,null))[_0xf976('0x46')](handleError(_0x5216c1,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 300dba3..8bea8ff 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 _0xc076=['exports','define','Setting','lodash','../../config/logger','api','moment','./setting.attributes'];(function(_0x36865b,_0x32d6ac){var _0x55cfef=function(_0x152bff){while(--_0x152bff){_0x36865b['push'](_0x36865b['shift']());}};_0x55cfef(++_0x32d6ac);}(_0xc076,0x103));var _0x6c07=function(_0x5aac1f,_0x254b93){_0x5aac1f=_0x5aac1f-0x0;var _0x5dc397=_0xc076[_0x5aac1f];return _0x5dc397;};'use strict';var _=require(_0x6c07('0x0'));var util=require('util');var logger=require(_0x6c07('0x1'))(_0x6c07('0x2'));var moment=require(_0x6c07('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x6c07('0x4'));module[_0x6c07('0x5')]=function(_0x1bd303,_0x473603){return _0x1bd303[_0x6c07('0x6')](_0x6c07('0x7'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f0e=['./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0x7f0e,0xd1));var _0xe7f0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7f0e[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xe7f0('0x0'));var util=require(_0xe7f0('0x1'));var logger=require(_0xe7f0('0x2'))(_0xe7f0('0x3'));var moment=require(_0xe7f0('0x4'));var BPromise=require(_0xe7f0('0x5'));var rp=require(_0xe7f0('0x6'));var attributes=require(_0xe7f0('0x7'));module[_0xe7f0('0x8')]=function(_0x527be5,_0x16f305){return _0x527be5[_0xe7f0('0x9')](_0xe7f0('0xa'),attributes,{'tableName':_0xe7f0('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 67f7291..3d53590 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 _0xaa4e=['rpc','jayson/promise','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger'];(function(_0x2af28b,_0x3f2097){var _0x3ead78=function(_0x10e4a4){while(--_0x10e4a4){_0x2af28b['push'](_0x2af28b['shift']());}};_0x3ead78(++_0x3f2097);}(_0xaa4e,0x10c));var _0xeaa4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xaa4e[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xeaa4('0x0'));var util=require('util');var moment=require(_0xeaa4('0x1'));var BPromise=require(_0xeaa4('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xeaa4('0x3'));var logger=require(_0xeaa4('0x4'))(_0xeaa4('0x5'));var config=require('../../config/environment');var jayson=require(_0xeaa4('0x6'));var client=jayson[_0xeaa4('0x7')][_0xeaa4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a7d2a,_0x4aa5af,_0x2cd952){return new BPromise(function(_0x2d6c97,_0x3004aa){return client['request'](_0x4a7d2a,_0x2cd952)[_0xeaa4('0x9')](function(_0x4acf87){logger[_0xeaa4('0xa')]('Setting,\x20%s,\x20%s',_0x4aa5af,_0xeaa4('0xb'));logger[_0xeaa4('0xc')](_0xeaa4('0xd'),_0x4aa5af,_0xeaa4('0xb'),JSON[_0xeaa4('0xe')](_0x4acf87));if(_0x4acf87['error']){if(_0x4acf87[_0xeaa4('0xf')][_0xeaa4('0x10')]===0x1f4){logger[_0xeaa4('0xf')](_0xeaa4('0x11'),_0x4aa5af,_0x4acf87[_0xeaa4('0xf')]['message']);return _0x3004aa(_0x4acf87[_0xeaa4('0xf')][_0xeaa4('0x12')]);}logger['error'](_0xeaa4('0x11'),_0x4aa5af,_0x4acf87[_0xeaa4('0xf')]['message']);return _0x2d6c97(_0x4acf87['error']['message']);}else{logger[_0xeaa4('0xa')]('Setting,\x20%s,\x20%s',_0x4aa5af,_0xeaa4('0xb'));_0x2d6c97(_0x4acf87[_0xeaa4('0x13')][_0xeaa4('0x12')]);}})[_0xeaa4('0x14')](function(_0x1d11db){logger[_0xeaa4('0xf')](_0xeaa4('0x11'),_0x4aa5af,_0x1d11db);_0x3004aa(_0x1d11db);});});} \ No newline at end of file +var _0x65e5=['request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x65e5,0x1bd));var _0x565e=function(_0x4d67a3,_0xc2783d){_0x4d67a3=_0x4d67a3-0x0;var _0x41a734=_0x65e5[_0x4d67a3];return _0x41a734;};'use strict';var _=require(_0x565e('0x0'));var util=require(_0x565e('0x1'));var moment=require(_0x565e('0x2'));var BPromise=require('bluebird');var rs=require(_0x565e('0x3'));var fs=require('fs');var db=require(_0x565e('0x4'))['db'];var utils=require(_0x565e('0x5'));var logger=require(_0x565e('0x6'))('rpc');var config=require(_0x565e('0x7'));var jayson=require(_0x565e('0x8'));var client=jayson[_0x565e('0x9')][_0x565e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42ac34,_0x1b7cc3,_0x25e306){return new BPromise(function(_0x17f150,_0x2b5209){return client[_0x565e('0xb')](_0x42ac34,_0x25e306)[_0x565e('0xc')](function(_0x1d71c1){logger[_0x565e('0xd')](_0x565e('0xe'),_0x1b7cc3,_0x565e('0xf'));logger['debug'](_0x565e('0x10'),_0x1b7cc3,_0x565e('0xf'),JSON[_0x565e('0x11')](_0x1d71c1));if(_0x1d71c1[_0x565e('0x12')]){if(_0x1d71c1[_0x565e('0x12')][_0x565e('0x13')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x1b7cc3,_0x1d71c1[_0x565e('0x12')][_0x565e('0x14')]);return _0x2b5209(_0x1d71c1['error']['message']);}logger[_0x565e('0x12')](_0x565e('0xe'),_0x1b7cc3,_0x1d71c1[_0x565e('0x12')]['message']);return _0x17f150(_0x1d71c1[_0x565e('0x12')][_0x565e('0x14')]);}else{logger[_0x565e('0xd')](_0x565e('0xe'),_0x1b7cc3,_0x565e('0xf'));_0x17f150(_0x1d71c1[_0x565e('0x15')][_0x565e('0x14')]);}})[_0x565e('0x16')](function(_0x562728){logger[_0x565e('0x12')](_0x565e('0xe'),_0x1b7cc3,_0x562728);_0x2b5209(_0x562728);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9e85df0..22659f9 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 _0x76bb=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','post','addDisposition','/:id/notify','addApplications','/:id/send','/:id/status','status','put','update','delete','/:id','destroy','removeDispositions','removeAgents','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/dispositions'];(function(_0x1ace1c,_0x1f4acc){var _0x275bc1=function(_0x4c5612){while(--_0x4c5612){_0x1ace1c['push'](_0x1ace1c['shift']());}};_0x275bc1(++_0x1f4acc);}(_0x76bb,0x16a));var _0xb76b=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x76bb[_0x17c8cc];return _0x3db4eb;};'use strict';var multer=require('multer');var util=require(_0xb76b('0x0'));var path=require(_0xb76b('0x1'));var express=require(_0xb76b('0x2'));var router=express[_0xb76b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb76b('0x4'));var config=require(_0xb76b('0x5'));var controller=require('./smsAccount.controller');router[_0xb76b('0x6')]('/',auth[_0xb76b('0x7')](),controller['index']);router[_0xb76b('0x6')](_0xb76b('0x8'),auth[_0xb76b('0x7')](),controller[_0xb76b('0x9')]);router[_0xb76b('0x6')]('/:id',auth[_0xb76b('0x7')](),controller[_0xb76b('0xa')]);router[_0xb76b('0x6')](_0xb76b('0xb'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xb76b('0x6')](_0xb76b('0xc'),auth[_0xb76b('0x7')](),controller[_0xb76b('0xd')]);router[_0xb76b('0x6')](_0xb76b('0xe'),auth[_0xb76b('0x7')](),controller[_0xb76b('0xf')]);router['get'](_0xb76b('0x10'),auth['isAuthenticated'](),controller[_0xb76b('0x11')]);router[_0xb76b('0x6')](_0xb76b('0x12'),auth[_0xb76b('0x7')](),controller['getAgents']);router[_0xb76b('0x13')]('/',auth[_0xb76b('0x7')](),controller['create']);router[_0xb76b('0x13')]('/:id/dispositions',auth[_0xb76b('0x7')](),controller[_0xb76b('0x14')]);router[_0xb76b('0x13')](_0xb76b('0xc'),auth['isAuthenticated'](),controller['addAnswer']);router[_0xb76b('0x13')](_0xb76b('0x15'),controller['notify']);router[_0xb76b('0x13')](_0xb76b('0xe'),auth[_0xb76b('0x7')](),controller[_0xb76b('0x16')]);router[_0xb76b('0x13')](_0xb76b('0x17'),auth[_0xb76b('0x7')](),controller['send']);router['post'](_0xb76b('0x18'),controller[_0xb76b('0x19')]);router[_0xb76b('0x13')](_0xb76b('0x12'),auth[_0xb76b('0x7')](),controller['addAgents']);router[_0xb76b('0x1a')]('/:id',auth[_0xb76b('0x7')](),controller[_0xb76b('0x1b')]);router[_0xb76b('0x1c')](_0xb76b('0x1d'),auth['isAuthenticated'](),controller[_0xb76b('0x1e')]);router[_0xb76b('0x1c')](_0xb76b('0xb'),auth[_0xb76b('0x7')](),controller[_0xb76b('0x1f')]);router['delete'](_0xb76b('0xc'),auth[_0xb76b('0x7')](),controller['removeAnswers']);router[_0xb76b('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xb76b('0x20')]);module[_0xb76b('0x21')]=router; \ No newline at end of file +var _0x3cfb=['/:id/status','status','addAgents','put','update','destroy','delete','removeDispositions','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','post','addAnswer','/:id/notify','notify','/:id/send','send'];(function(_0x491f99,_0x178cd0){var _0xb10264=function(_0x63a0cf){while(--_0x63a0cf){_0x491f99['push'](_0x491f99['shift']());}};_0xb10264(++_0x178cd0);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x40a2ec,_0x53a4a2){_0x40a2ec=_0x40a2ec-0x0;var _0x1a35d9=_0x3cfb[_0x40a2ec];return _0x1a35d9;};'use strict';var multer=require(_0xb3cf('0x0'));var util=require(_0xb3cf('0x1'));var path=require(_0xb3cf('0x2'));var express=require(_0xb3cf('0x3'));var router=express[_0xb3cf('0x4')]();var auth=require(_0xb3cf('0x5'));var interaction=require(_0xb3cf('0x6'));var config=require(_0xb3cf('0x7'));var controller=require('./smsAccount.controller');router[_0xb3cf('0x8')]('/',auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xa')]);router['get'](_0xb3cf('0xb'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xc')]);router['get'](_0xb3cf('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb3cf('0x8')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0xf')]);router[_0xb3cf('0x8')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x11')]);router[_0xb3cf('0x8')](_0xb3cf('0x12'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x13')]);router[_0xb3cf('0x8')](_0xb3cf('0x14'),auth[_0xb3cf('0x9')](),controller['getInteractions']);router['get'](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller['getAgents']);router[_0xb3cf('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3cf('0x16')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller['addDisposition']);router[_0xb3cf('0x16')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x17')]);router[_0xb3cf('0x16')](_0xb3cf('0x18'),controller[_0xb3cf('0x19')]);router[_0xb3cf('0x16')](_0xb3cf('0x12'),auth[_0xb3cf('0x9')](),controller['addApplications']);router[_0xb3cf('0x16')](_0xb3cf('0x1a'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x1b')]);router['post'](_0xb3cf('0x1c'),controller[_0xb3cf('0x1d')]);router[_0xb3cf('0x16')](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x1e')]);router[_0xb3cf('0x1f')](_0xb3cf('0xd'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x20')]);router['delete'](_0xb3cf('0xd'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x21')]);router[_0xb3cf('0x22')](_0xb3cf('0xe'),auth[_0xb3cf('0x9')](),controller[_0xb3cf('0x23')]);router[_0xb3cf('0x22')](_0xb3cf('0x10'),auth[_0xb3cf('0x9')](),controller['removeAnswers']);router[_0xb3cf('0x22')](_0xb3cf('0x15'),auth[_0xb3cf('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 68c43db..696f4c6 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 _0x6d02=['classic','classic+','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','randomstring','STRING','name','generate','ENUM','skebby','clicksend','basic'];(function(_0x38b070,_0x1abc6e){var _0x6b0674=function(_0x4bb273){while(--_0x4bb273){_0x38b070['push'](_0x38b070['shift']());}};_0x6b0674(++_0x1abc6e);}(_0x6d02,0x68));var _0x26d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6d02[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x26d0('0x0'));module['exports']={'name':{'type':Sequelize[_0x26d0('0x1')],'unique':_0x26d0('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x26d0('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x26d0('0x1')],'defaultValue':function(){return rs[_0x26d0('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x26d0('0x4')]('twilio',_0x26d0('0x5'),'connectel',_0x26d0('0x6'),'plivo')},'accountSid':{'type':Sequelize[_0x26d0('0x1')]},'authId':{'type':Sequelize[_0x26d0('0x1')]},'authToken':{'type':Sequelize[_0x26d0('0x1')]},'smsMethod':{'type':Sequelize['ENUM'](_0x26d0('0x7'),_0x26d0('0x8'),_0x26d0('0x9'))},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x26d0('0x1')]},'senderString':{'type':Sequelize[_0x26d0('0x1')]},'deliveryReport':{'type':Sequelize[_0x26d0('0xa')],'defaultValue':![]},'description':{'type':Sequelize[_0x26d0('0x1')]},'notificationTemplate':{'type':Sequelize[_0x26d0('0xb')],'defaultValue':function(){return _0x26d0('0xc');}},'notificationSound':{'type':Sequelize[_0x26d0('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x26d0('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x26d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x26d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x26d0('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x26d0('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file +var _0x5d34=['name','STRING','generate','ENUM','twilio','skebby','connectel','plivo','basic','classic','classic+','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','sequelize','randomstring','exports'];(function(_0x11d9b,_0x5d9d4b){var _0xa42641=function(_0x57ac64){while(--_0x57ac64){_0x11d9b['push'](_0x11d9b['shift']());}};_0xa42641(++_0x5d9d4b);}(_0x5d34,0x140));var _0x45d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d34[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x45d3('0x0'));var rs=require(_0x45d3('0x1'));module[_0x45d3('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x45d3('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x45d3('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x45d3('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x45d3('0x5')]();}},'phone':{'type':Sequelize[_0x45d3('0x4')]},'type':{'type':Sequelize[_0x45d3('0x6')](_0x45d3('0x7'),_0x45d3('0x8'),_0x45d3('0x9'),'clicksend',_0x45d3('0xa'))},'accountSid':{'type':Sequelize[_0x45d3('0x4')]},'authId':{'type':Sequelize[_0x45d3('0x4')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize[_0x45d3('0x6')](_0x45d3('0xb'),_0x45d3('0xc'),_0x45d3('0xd'))},'username':{'type':Sequelize[_0x45d3('0x4')]},'password':{'type':Sequelize[_0x45d3('0x4')]},'senderString':{'type':Sequelize[_0x45d3('0x4')]},'deliveryReport':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x45d3('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x45d3('0xf');}},'notificationSound':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x45d3('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x45d3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index be4679b..5b4f322 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 _0x682e=['end','json','count','offset','limit','Content-Range','reject','save','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','add','day','merge','map','options','SmsAccount','includeAll','include','findAll','show','params','find','create','body','destroy','describe','addDisposition','SmsAccountId','getDispositions','Disposition','filter','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','notify','sms','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','type','From','MessageSid','skebby','from','sender','text','connectel','clicksend','message_id','plivo','Text','messageId','MessageUUID','isNil','Sequelize','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','list','omit','SmsInteraction','spread','get','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','Content-Type','findOne','sequelize','transaction','SmsApplication','findAndCountAll','getApplications','getInteractions','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','defaults','user','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','statusInt','requestid','status_code','DELIVERED','update','inspect','error_code','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','fast-json-patch','request-promise','bluebird','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','socket.io-emitter','localhost','./smsAccount.socket','register','jayson/promise','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status'];(function(_0x2164d1,_0x5f0080){var _0x88a1f5=function(_0x33fb29){while(--_0x33fb29){_0x2164d1['push'](_0x2164d1['shift']());}};_0x88a1f5(++_0x5f0080);}(_0x682e,0x158));var _0xe682=function(_0x5bc96c,_0x17f4c1){_0x5bc96c=_0x5bc96c-0x0;var _0x2e0933=_0x682e[_0x5bc96c];return _0x2e0933;};'use strict';var jsonpatch=require(_0xe682('0x0'));var rp=require(_0xe682('0x1'));var moment=require('moment');var BPromise=require(_0xe682('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe682('0x3'));var sox=require(_0xe682('0x4'));var csv=require(_0xe682('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe682('0x6'));var squel=require(_0xe682('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe682('0x8'));var toCsv=require(_0xe682('0x5'));var querystring=require(_0xe682('0x9'));var Papa=require(_0xe682('0xa'));var qs=require(_0xe682('0xb'));var logger=require('../../config/logger')(_0xe682('0xc'));var utils=require(_0xe682('0xd'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xe682('0xe'))({'host':_0xe682('0xf'),'port':0x18eb});require(_0xe682('0x10'))[_0xe682('0x11')](socket);var jayson=require(_0xe682('0x12'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x34898a,_0x265a12,_0x55b5d8,_0x2ae803){return new BPromise(function(_0x44f67c,_0x4d8e86){var _0x3a555d=_0x2ae803||client;return _0x3a555d[_0xe682('0x13')](_0x34898a,_0x55b5d8)[_0xe682('0x14')](function(_0x30e297){logger[_0xe682('0x15')](_0xe682('0x16'),_0x265a12,_0xe682('0x17'));logger[_0xe682('0x18')](_0xe682('0x19'),_0x265a12,'request\x20sent',JSON['stringify'](_0x30e297));if(_0x30e297[_0xe682('0x1a')]){if(_0x30e297[_0xe682('0x1a')][_0xe682('0x1b')]===0x1f4){logger[_0xe682('0x1a')](_0xe682('0x16'),_0x265a12,_0x30e297[_0xe682('0x1a')][_0xe682('0x1c')]);return _0x4d8e86(_0x30e297['error']['message']);}logger[_0xe682('0x1a')](_0xe682('0x16'),_0x265a12,_0x30e297['error'][_0xe682('0x1c')]);return _0x44f67c(_0x30e297['error']['message']);}else{logger[_0xe682('0x15')](_0xe682('0x16'),_0x265a12,_0xe682('0x17'));_0x44f67c(_0x30e297[_0xe682('0x1d')]['message']);}})[_0xe682('0x1e')](function(_0x3cba29){logger[_0xe682('0x1a')](_0xe682('0x16'),_0x265a12,_0x3cba29);_0x4d8e86(_0x3cba29);});});}function respondWithStatusCode(_0x2983f8,_0x542193){_0x542193=_0x542193||0xcc;return function(_0x39f4c5){if(_0x39f4c5){return _0x2983f8['sendStatus'](_0x542193);}return _0x2983f8[_0xe682('0x1f')](_0x542193)[_0xe682('0x20')]();};}function respondWithResult(_0x2dd55b,_0x31e7f8){_0x31e7f8=_0x31e7f8||0xc8;return function(_0x52bf7a){if(_0x52bf7a){return _0x2dd55b[_0xe682('0x1f')](_0x31e7f8)[_0xe682('0x21')](_0x52bf7a);}};}function respondWithFilteredResult(_0x3416a2,_0x319188){return function(_0x101816){if(_0x101816){var _0x288a08=_0x101816[_0xe682('0x22')],_0x4d9986=_0x319188[_0xe682('0x23')],_0x2b1bc0=_0x319188[_0xe682('0x23')]+_0x319188[_0xe682('0x24')],_0x558cec;if(_0x2b1bc0>=_0x288a08){_0x2b1bc0=_0x288a08;_0x558cec=0xc8;}else{_0x558cec=0xce;}_0x3416a2['status'](_0x558cec);return _0x3416a2['set'](_0xe682('0x25'),_0x4d9986+'-'+_0x2b1bc0+'/'+_0x288a08)[_0xe682('0x21')](_0x101816);}return null;};}function patchUpdates(_0x338da6){return function(_0x534502){try{jsonpatch['apply'](_0x534502,_0x338da6,!![]);}catch(_0x16e284){return BPromise[_0xe682('0x26')](_0x16e284);}return _0x534502[_0xe682('0x27')]();};}function saveUpdates(_0x595b44,_0x2f53ff){return function(_0x27aff6){if(_0x27aff6){return _0x27aff6['update'](_0x595b44)[_0xe682('0x14')](function(_0x441463){return _0x441463;});}return null;};}function removeEntity(_0x1213d2,_0xb7b4fe){return function(_0x3a1168){if(_0x3a1168){return _0x3a1168['destroy']()['then'](function(){_0x1213d2[_0xe682('0x1f')](0xcc)[_0xe682('0x20')]();});}};}function handleEntityNotFound(_0x2dc135,_0x49f352){return function(_0x14396c){if(!_0x14396c){_0x2dc135[_0xe682('0x28')](0x194);}return _0x14396c;};}function handleError(_0x3b12c2,_0x52c414){_0x52c414=_0x52c414||0x1f4;return function(_0xd3a143){logger['error'](_0xd3a143[_0xe682('0x29')]);if(_0xd3a143[_0xe682('0x2a')]){delete _0xd3a143[_0xe682('0x2a')];}_0x3b12c2[_0xe682('0x1f')](_0x52c414)[_0xe682('0x2b')](_0xd3a143);};}exports[_0xe682('0x2c')]=function(_0x48062f,_0x495735){var _0x56f524={},_0x20fe37={},_0x2827fa={'count':0x0,'rows':[]};var _0x366f40=db['SmsAccount'][_0xe682('0x2d')];_0x20fe37[_0xe682('0x2e')]=_[_0xe682('0x2f')](_0x366f40);var _0x33ed89={'dateStart':_0x48062f[_0xe682('0x30')][_0xe682('0x31')],'dateEnd':_0x48062f[_0xe682('0x30')][_0xe682('0x32')]};delete _0x48062f[_0xe682('0x30')][_0xe682('0x31')];delete _0x48062f['query'][_0xe682('0x32')];_0x20fe37[_0xe682('0x30')]=_[_0xe682('0x2f')](_0x48062f[_0xe682('0x30')]);_0x20fe37['filters']=_[_0xe682('0x33')](_0x20fe37[_0xe682('0x2e')],_0x20fe37[_0xe682('0x30')]);_0x56f524['attributes']=_[_0xe682('0x33')](_0x20fe37[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x48062f[_0xe682('0x30')]['fields']));_0x56f524['attributes']=_0x56f524[_0xe682('0x35')][_0xe682('0x36')]?_0x56f524[_0xe682('0x35')]:_0x20fe37[_0xe682('0x2e')];if(!_0x48062f['query'][_0xe682('0x37')](_0xe682('0x38'))){_0x56f524[_0xe682('0x24')]=qs[_0xe682('0x24')](_0x48062f[_0xe682('0x30')][_0xe682('0x24')]);_0x56f524[_0xe682('0x23')]=qs[_0xe682('0x23')](_0x48062f[_0xe682('0x30')][_0xe682('0x23')]);}_0x56f524[_0xe682('0x39')]=qs[_0xe682('0x3a')](_0x48062f[_0xe682('0x30')][_0xe682('0x3a')]);_0x56f524[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_[_0xe682('0x3d')](_0x48062f[_0xe682('0x30')],_0x20fe37[_0xe682('0x3c')]));if(_0x33ed89[_0xe682('0x31')]){if(_0x33ed89[_0xe682('0x32')]){_0x33ed89[_0xe682('0x32')]=moment(_0x33ed89[_0xe682('0x32')])[_0xe682('0x3e')](0x1,_0xe682('0x3f'));}else{_0x33ed89[_0xe682('0x32')]=moment(_0x33ed89['dateStart'])[_0xe682('0x3e')](0x1,_0xe682('0x3f'));}_[_0xe682('0x40')](_0x56f524[_0xe682('0x3b')],{'createdAt':{'$gte':_0x33ed89[_0xe682('0x31')],'$lte':_0x33ed89[_0xe682('0x32')]}});}if(_0x48062f['query']['filter']){_0x56f524[_0xe682('0x3b')]=_['merge'](_0x56f524[_0xe682('0x3b')],{'$or':_[_0xe682('0x41')](_0x56f524[_0xe682('0x35')],function(_0x32d86a){var _0x2a31e7={};_0x2a31e7[_0x32d86a]={'$like':'%'+_0x48062f[_0xe682('0x30')]['filter']+'%'};return _0x2a31e7;})});}_0x56f524=_[_0xe682('0x40')]({},_0x56f524,_0x48062f[_0xe682('0x42')]);var _0x204c00={'where':_0x56f524[_0xe682('0x3b')]};return db[_0xe682('0x43')]['count'](_0x204c00)['then'](function(_0x43f67f){_0x2827fa[_0xe682('0x22')]=_0x43f67f;if(_0x48062f['query'][_0xe682('0x44')]){_0x56f524[_0xe682('0x45')]=[{'all':!![]}];}return db[_0xe682('0x43')][_0xe682('0x46')](_0x56f524);})[_0xe682('0x14')](function(_0x1ffceb){_0x2827fa['rows']=_0x1ffceb;return _0x2827fa;})[_0xe682('0x14')](respondWithFilteredResult(_0x495735,_0x56f524))[_0xe682('0x1e')](handleError(_0x495735,null));};exports[_0xe682('0x47')]=function(_0x11376e,_0xd58ee2){var _0x502ae5={'raw':![],'where':{'id':_0x11376e[_0xe682('0x48')]['id']}},_0x282c60={};_0x282c60[_0xe682('0x2e')]=_['keys'](db[_0xe682('0x43')][_0xe682('0x2d')]);_0x282c60['query']=_['keys'](_0x11376e[_0xe682('0x30')]);_0x282c60['filters']=_[_0xe682('0x33')](_0x282c60['model'],_0x282c60[_0xe682('0x30')]);_0x502ae5[_0xe682('0x35')]=_['intersection'](_0x282c60[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x11376e[_0xe682('0x30')]['fields']));_0x502ae5[_0xe682('0x35')]=_0x502ae5[_0xe682('0x35')][_0xe682('0x36')]?_0x502ae5[_0xe682('0x35')]:_0x282c60[_0xe682('0x2e')];if(_0x11376e[_0xe682('0x30')][_0xe682('0x44')]){_0x502ae5[_0xe682('0x45')]=[{'all':!![]}];}_0x502ae5=_[_0xe682('0x40')]({},_0x502ae5,_0x11376e[_0xe682('0x42')]);return db['SmsAccount'][_0xe682('0x49')](_0x502ae5)['then'](handleEntityNotFound(_0xd58ee2,null))['then'](respondWithResult(_0xd58ee2,null))[_0xe682('0x1e')](handleError(_0xd58ee2,null));};exports[_0xe682('0x4a')]=function(_0x100629,_0x145e66){return db[_0xe682('0x43')][_0xe682('0x4a')](_0x100629['body'],{})[_0xe682('0x14')](respondWithResult(_0x145e66,0xc9))[_0xe682('0x1e')](handleError(_0x145e66,null));};exports['update']=function(_0x46b47d,_0x2984fd){if(_0x46b47d[_0xe682('0x4b')]['id']){delete _0x46b47d[_0xe682('0x4b')]['id'];}return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x46b47d[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x2984fd,null))[_0xe682('0x14')](saveUpdates(_0x46b47d[_0xe682('0x4b')],null))[_0xe682('0x14')](respondWithResult(_0x2984fd,null))[_0xe682('0x1e')](handleError(_0x2984fd,null));};exports[_0xe682('0x4c')]=function(_0x5e410e,_0x2c994d){return db['SmsAccount'][_0xe682('0x49')]({'where':{'id':_0x5e410e[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x2c994d,null))[_0xe682('0x14')](removeEntity(_0x2c994d,null))[_0xe682('0x1e')](handleError(_0x2c994d,null));};exports[_0xe682('0x4d')]=function(_0x227374,_0x5a6f6f){return db[_0xe682('0x43')][_0xe682('0x4d')]()[_0xe682('0x14')](respondWithResult(_0x5a6f6f,null))[_0xe682('0x1e')](handleError(_0x5a6f6f,null));};exports[_0xe682('0x4e')]=function(_0x68a63d,_0x4fbfed,_0x4a98b4){if(_0x68a63d[_0xe682('0x4b')]['id']){delete _0x68a63d[_0xe682('0x4b')]['id'];}return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x68a63d[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x4fbfed,null))[_0xe682('0x14')](function(_0x59c18b){if(_0x59c18b){_0x68a63d[_0xe682('0x4b')][_0xe682('0x4f')]=_0x59c18b['id'];return db['Disposition'][_0xe682('0x4a')](_0x68a63d[_0xe682('0x4b')]);}})[_0xe682('0x14')](respondWithResult(_0x4fbfed,null))['catch'](handleError(_0x4fbfed,null));};exports[_0xe682('0x50')]=function(_0x2adc18,_0x5f160b,_0x1a7e49){var _0x59a885={'raw':![],'where':{}};var _0x166c5f={};var _0x5e603d={'count':0x0,'rows':[]};return db[_0xe682('0x43')]['findOne']({'where':{'id':_0x2adc18[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x5f160b,null))['then'](function(_0x59fa3c){if(_0x59fa3c){_0x166c5f[_0xe682('0x2e')]=_['keys'](db[_0xe682('0x51')][_0xe682('0x2d')]);_0x166c5f[_0xe682('0x30')]=_[_0xe682('0x2f')](_0x2adc18['query']);_0x166c5f[_0xe682('0x3c')]=_[_0xe682('0x33')](_0x166c5f[_0xe682('0x2e')],_0x166c5f[_0xe682('0x30')]);_0x59a885[_0xe682('0x35')]=_[_0xe682('0x33')](_0x166c5f[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x2adc18[_0xe682('0x30')][_0xe682('0x34')]));_0x59a885['attributes']=_0x59a885[_0xe682('0x35')][_0xe682('0x36')]?_0x59a885[_0xe682('0x35')]:_0x166c5f['model'];if(!_0x2adc18[_0xe682('0x30')][_0xe682('0x37')](_0xe682('0x38'))){_0x59a885[_0xe682('0x24')]=qs['limit'](_0x2adc18[_0xe682('0x30')]['limit']);_0x59a885['offset']=qs[_0xe682('0x23')](_0x2adc18[_0xe682('0x30')][_0xe682('0x23')]);}_0x59a885['order']=qs[_0xe682('0x3a')](_0x2adc18[_0xe682('0x30')][_0xe682('0x3a')]);_0x59a885[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_['pick'](_0x2adc18[_0xe682('0x30')],_0x166c5f['filters']));_0x59a885[_0xe682('0x3b')][_0xe682('0x4f')]=_0x59fa3c['id'];if(_0x2adc18[_0xe682('0x30')]['filter']){_0x59a885['where']=_['merge'](_0x59a885[_0xe682('0x3b')],{'$or':_[_0xe682('0x41')](_0x59a885[_0xe682('0x35')],function(_0x34b250){var _0x5a3f7f={};_0x5a3f7f[_0x34b250]={'$like':'%'+_0x2adc18[_0xe682('0x30')][_0xe682('0x52')]+'%'};return _0x5a3f7f;})});}_0x59a885=_[_0xe682('0x40')]({},_0x59a885,_0x2adc18[_0xe682('0x42')]);return db[_0xe682('0x51')][_0xe682('0x22')]({'where':_0x59a885[_0xe682('0x3b')]})[_0xe682('0x14')](function(_0x370a57){_0x5e603d[_0xe682('0x22')]=_0x370a57;if(_0x2adc18['query'][_0xe682('0x44')]){_0x59a885['include']=[{'all':!![]}];}return db[_0xe682('0x51')][_0xe682('0x46')](_0x59a885);})[_0xe682('0x14')](function(_0x1b3fc4){_0x5e603d['rows']=_0x1b3fc4;return _0x5e603d;});}})[_0xe682('0x14')](respondWithFilteredResult(_0x5f160b,_0x59a885))['catch'](handleError(_0x5f160b,null));};exports[_0xe682('0x53')]=function(_0x3d93c6,_0x10737d,_0x7f0a99){var _0x2be87e;return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x3d93c6['params']['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x10737d,null))[_0xe682('0x14')](function(_0x278d2f){if(_0x278d2f){return _0x278d2f[_0xe682('0x53')](_0x3d93c6[_0xe682('0x30')][_0xe682('0x54')]);}})['then'](respondWithStatusCode(_0x10737d,null))[_0xe682('0x1e')](handleError(_0x10737d,null));};exports[_0xe682('0x55')]=function(_0x53e7d0,_0x16e5ee,_0x3f02e){if(_0x53e7d0[_0xe682('0x4b')]['id']){delete _0x53e7d0[_0xe682('0x4b')]['id'];}return db[_0xe682('0x43')]['find']({'where':{'id':_0x53e7d0['params']['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x16e5ee,null))[_0xe682('0x14')](function(_0x22db7d){if(_0x22db7d){_0x53e7d0[_0xe682('0x4b')][_0xe682('0x4f')]=_0x22db7d['id'];return db[_0xe682('0x56')][_0xe682('0x4a')](_0x53e7d0[_0xe682('0x4b')]);}})[_0xe682('0x14')](respondWithResult(_0x16e5ee,null))[_0xe682('0x1e')](handleError(_0x16e5ee,null));};exports[_0xe682('0x57')]=function(_0xccd098,_0x30b125,_0x2c2336){var _0x1e7975={'raw':![],'where':{}};var _0x5902c7={};var _0x5ddc25={'count':0x0,'rows':[]};return db[_0xe682('0x43')]['findOne']({'where':{'id':_0xccd098[_0xe682('0x48')]['id']}})['then'](handleEntityNotFound(_0x30b125,null))[_0xe682('0x14')](function(_0x1f10e2){if(_0x1f10e2){_0x5902c7['model']=_[_0xe682('0x2f')](db[_0xe682('0x56')][_0xe682('0x2d')]);_0x5902c7['query']=_['keys'](_0xccd098[_0xe682('0x30')]);_0x5902c7['filters']=_[_0xe682('0x33')](_0x5902c7[_0xe682('0x2e')],_0x5902c7[_0xe682('0x30')]);_0x1e7975[_0xe682('0x35')]=_[_0xe682('0x33')](_0x5902c7[_0xe682('0x2e')],qs[_0xe682('0x34')](_0xccd098[_0xe682('0x30')][_0xe682('0x34')]));_0x1e7975[_0xe682('0x35')]=_0x1e7975[_0xe682('0x35')]['length']?_0x1e7975[_0xe682('0x35')]:_0x5902c7[_0xe682('0x2e')];if(!_0xccd098[_0xe682('0x30')][_0xe682('0x37')](_0xe682('0x38'))){_0x1e7975['limit']=qs['limit'](_0xccd098[_0xe682('0x30')][_0xe682('0x24')]);_0x1e7975[_0xe682('0x23')]=qs[_0xe682('0x23')](_0xccd098[_0xe682('0x30')][_0xe682('0x23')]);}_0x1e7975['order']=qs[_0xe682('0x3a')](_0xccd098[_0xe682('0x30')]['sort']);_0x1e7975[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_[_0xe682('0x3d')](_0xccd098[_0xe682('0x30')],_0x5902c7['filters']));_0x1e7975[_0xe682('0x3b')][_0xe682('0x4f')]=_0x1f10e2['id'];if(_0xccd098['query'][_0xe682('0x52')]){_0x1e7975[_0xe682('0x3b')]=_[_0xe682('0x40')](_0x1e7975[_0xe682('0x3b')],{'$or':_[_0xe682('0x41')](_0x1e7975[_0xe682('0x35')],function(_0x2c9a05){var _0x251e20={};_0x251e20[_0x2c9a05]={'$like':'%'+_0xccd098['query'][_0xe682('0x52')]+'%'};return _0x251e20;})});}_0x1e7975=_[_0xe682('0x40')]({},_0x1e7975,_0xccd098[_0xe682('0x42')]);return db[_0xe682('0x56')][_0xe682('0x22')]({'where':_0x1e7975[_0xe682('0x3b')]})[_0xe682('0x14')](function(_0x420597){_0x5ddc25['count']=_0x420597;if(_0xccd098[_0xe682('0x30')][_0xe682('0x44')]){_0x1e7975['include']=[{'all':!![]}];}return db[_0xe682('0x56')]['findAll'](_0x1e7975);})[_0xe682('0x14')](function(_0x25e832){_0x5ddc25[_0xe682('0x58')]=_0x25e832;return _0x5ddc25;});}})['then'](respondWithFilteredResult(_0x30b125,_0x1e7975))[_0xe682('0x1e')](handleError(_0x30b125,null));};exports[_0xe682('0x59')]=function(_0x14a9a1,_0x449c95,_0x404f92){var _0x35d80a;return db['SmsAccount'][_0xe682('0x49')]({'where':{'id':_0x14a9a1[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x449c95,null))['then'](function(_0x307263){if(_0x307263){return _0x307263[_0xe682('0x59')](_0x14a9a1[_0xe682('0x30')][_0xe682('0x54')]);}})[_0xe682('0x14')](respondWithStatusCode(_0x449c95,null))[_0xe682('0x1e')](handleError(_0x449c95,null));};exports[_0xe682('0x5a')]=function(_0x573344,_0x10faa7,_0x62cf84){var _0x2dd429={'channel':_0xe682('0x5b')};var _0x36e269=[];var _0x49e810=[];var _0x11cc15={};return db[_0xe682('0x43')]['find']({'where':{'id':_0x573344['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0xe682('0x5c')}]})[_0xe682('0x14')](handleEntityNotFound(_0x10faa7,null))[_0xe682('0x14')](function(_0x4e1678){_0x2dd429[_0xe682('0x5d')]=_0x4e1678;_0x2dd429[_0xe682('0x5e')]=_[_0xe682('0x5f')](_0x4e1678[_0xe682('0x5c')],['priority'],[_0xe682('0x60')]);if(_0x2dd429[_0xe682('0x5d')][_0xe682('0x5c')]){delete _0x2dd429['account'][_0xe682('0x5c')];}return db[_0xe682('0x61')][_0xe682('0x4d')]();})['then'](function(_0x39943b){if(!_0x39943b){throw new db['Sequelize'][(_0xe682('0x62'))](_0xe682('0x63'));}_0x36e269=_[_0xe682('0x64')](_['keys'](_0x39943b),[_0xe682('0x65'),_0xe682('0x66')]);_0x49e810=_['difference'](_['keys'](_0x39943b),[_0xe682('0x65'),_0xe682('0x66'),_0xe682('0x67'),_0xe682('0x68')]);_0x2dd429['body']={'mapKey':'mobile'};if(_0x2dd429[_0xe682('0x5d')][_0xe682('0x69')]){switch(_0x2dd429['account'][_0xe682('0x69')]){case'twilio':_0x2dd429[_0xe682('0x4b')]['from']=_0x573344[_0xe682('0x4b')][_0xe682('0x6a')];_0x2dd429[_0xe682('0x4b')][_0xe682('0x4b')]=_0x573344[_0xe682('0x4b')]['Body'];_0x2dd429[_0xe682('0x4b')]['messageId']=_0x573344[_0xe682('0x4b')][_0xe682('0x6b')];break;case _0xe682('0x6c'):_0x2dd429[_0xe682('0x4b')][_0xe682('0x6d')]=_0x573344[_0xe682('0x4b')][_0xe682('0x6e')];_0x2dd429[_0xe682('0x4b')][_0xe682('0x4b')]=_0x573344['body'][_0xe682('0x6f')];break;case _0xe682('0x70'):_0x2dd429[_0xe682('0x4b')]['from']=_0x573344['body'][_0xe682('0x6d')];_0x2dd429[_0xe682('0x4b')]['body']=_0x573344[_0xe682('0x4b')]['message'];break;case _0xe682('0x71'):_0x2dd429[_0xe682('0x4b')][_0xe682('0x6d')]=_0x573344[_0xe682('0x4b')][_0xe682('0x6d')];_0x2dd429[_0xe682('0x4b')]['body']=_0x573344[_0xe682('0x4b')]['body'];_0x2dd429[_0xe682('0x4b')]['messageId']=_0x573344[_0xe682('0x4b')][_0xe682('0x72')];break;case _0xe682('0x73'):_0x2dd429['body'][_0xe682('0x6d')]=_0x573344[_0xe682('0x4b')][_0xe682('0x6a')];_0x2dd429[_0xe682('0x4b')]['body']=_0x573344[_0xe682('0x4b')][_0xe682('0x74')];_0x2dd429['body'][_0xe682('0x75')]=_0x573344[_0xe682('0x4b')][_0xe682('0x76')];break;}}if(_0x2dd429[_0xe682('0x4b')]['id']){delete _0x2dd429[_0xe682('0x4b')]['id'];}if(_[_0xe682('0x77')](_0x2dd429[_0xe682('0x4b')]['from'])){throw new db[(_0xe682('0x78'))]['ValidationError'](_0xe682('0x79'));}if(_[_0xe682('0x77')](_0x2dd429['body'][_0xe682('0x4b')])||_0x2dd429[_0xe682('0x4b')][_0xe682('0x4b')]===''){throw new db[(_0xe682('0x78'))][(_0xe682('0x62'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe682('0x77')](_0x2dd429[_0xe682('0x4b')][_0xe682('0x7a')])){throw new db[(_0xe682('0x78'))][(_0xe682('0x62'))](_0xe682('0x7b')+_0x49e810);}if(!_[_0xe682('0x7c')](_0x49e810,_0x2dd429[_0xe682('0x4b')][_0xe682('0x7a')])){throw new db[(_0xe682('0x78'))][(_0xe682('0x62'))](_0xe682('0x7d')+_0x49e810);}_0x11cc15[_0x2dd429[_0xe682('0x4b')][_0xe682('0x7a')]]=_0x2dd429[_0xe682('0x4b')][_0xe682('0x6d')];return db['CmList'][_0xe682('0x49')]({'where':{'id':_0x2dd429[_0xe682('0x5d')][_0xe682('0x68')]},'include':[{'model':db[_0xe682('0x61')],'as':_0xe682('0x7e'),'where':_0x11cc15,'limit':0x1,'order':[['updatedAt','DESC']]}]});})['then'](handleEntityNotFound(_0x10faa7,null))[_0xe682('0x14')](function(_0x45b0da){if(_0x45b0da){_0x2dd429[_0xe682('0x7f')]=_[_0xe682('0x80')](_0x45b0da,[_0xe682('0x7e')]);if(_0x45b0da['Contacts'][_0xe682('0x36')]){return _0x45b0da['Contacts'][0x0];}var _0x4ae41d=_['defaults'](_0x2dd429[_0xe682('0x4b')],{'firstName':_0x2dd429['body'][_0xe682('0x6d')],'ListId':_0x45b0da['id']});_0x4ae41d[_0x2dd429['body']['mapKey']]=_0x2dd429['body'][_0xe682('0x6d')];return db[_0xe682('0x61')][_0xe682('0x4a')](_0x4ae41d,{'fields':_0x36e269,'raw':!![]});}})[_0xe682('0x14')](handleEntityNotFound(_0x10faa7,null))[_0xe682('0x14')](function(_0x2fdd1a){if(_0x2fdd1a){_0x2dd429['contact']=_0x2fdd1a;var _0x997bee={'ContactId':_0x2fdd1a['id'],'phone':_0x2dd429[_0xe682('0x4b')][_0xe682('0x6d')],'SmsAccountId':_0x573344[_0xe682('0x48')]['id']};var _0x171da1={'ContactId':_0x2fdd1a['id'],'SmsAccountId':_0x573344['params']['id'],'closed':![]};return db[_0xe682('0x81')][_0xe682('0x49')]({'where':_0x171da1})[_0xe682('0x14')](function(_0x3cf24a){if(_0x3cf24a){return[_0x3cf24a,![]];}return db[_0xe682('0x81')][_0xe682('0x4a')](_0x997bee)[_0xe682('0x14')](function(_0x3078d6){return[_0x3078d6,!![]];});});}})[_0xe682('0x82')](function(_0x13b2b7,_0x5a972b){_0x2dd429['interaction']=_0x13b2b7[_0xe682('0x83')]({'plain':!![]});_0x2dd429[_0xe682('0x84')][_0xe682('0x85')]=![];if(_0x5a972b){if(_0x2dd429[_0xe682('0x5d')]['autoclose']){_0x2dd429[_0xe682('0x5e')]['push']({'id':0x0,'priority':_0x2dd429[_0xe682('0x5e')]['length']+0x1,'app':_0xe682('0x86'),'appdata':_0xe682('0x87'),'interval':_0xe682('0x88')});}_0x2dd429[_0xe682('0x84')][_0xe682('0x85')]=!![];}return db[_0xe682('0x89')][_0xe682('0x4a')]({'phone':_0x2dd429['body'][_0xe682('0x6d')],'messageId':_0x2dd429[_0xe682('0x4b')][_0xe682('0x75')],'body':_0x2dd429['body'][_0xe682('0x4b')],'SmsAccountId':_0x573344[_0xe682('0x48')]['id'],'SmsInteractionId':_0x13b2b7['id'],'direction':'in','ContactId':_0x13b2b7['ContactId'],'AttachmentId':_0x2dd429[_0xe682('0x4b')]['AttachmentId']});})[_0xe682('0x14')](function(_0x2984ce){_0x2dd429['message']=_0x2984ce;if(_0x2dd429[_0xe682('0x84')][_0xe682('0x8a')]){return db[_0xe682('0x8b')][_0xe682('0x49')]({'attributes':['id','name'],'where':{'id':_0x2dd429[_0xe682('0x84')][_0xe682('0x8a')]}})['then'](function(_0xe9d03e){if(_0xe9d03e){_0x2dd429[_0xe682('0x5e')][_0xe682('0x8c')]({'id':0x0,'priority':0x0,'app':_0xe682('0x8d'),'appdata':_0xe9d03e[_0xe682('0x2a')]+','+(_0x2dd429[_0xe682('0x5d')][_0xe682('0x8e')]||0xa),'interval':_0xe682('0x88')});}return respondWithRpcPromise(_0xe682('0x8f'),_0xe682('0x90'),_0x2dd429);});}return respondWithRpcPromise(_0xe682('0x8f'),_0xe682('0x90'),_0x2dd429);})[_0xe682('0x14')](function(_0x8b393a){if(_0x8b393a){var _0x28fbb1=0xc8;var _0xe326d6=_0xe682('0x91');logger['info'](_0xe682('0x19'),_0xe326d6,_0x28fbb1,'entity\x20found');logger[_0xe682('0x18')](_0xe682('0x92'),_0xe326d6,_0x28fbb1,_0xe682('0x93'),JSON[_0xe682('0x94')](_0x8b393a));if(_0x2dd429[_0xe682('0x5d')][_0xe682('0x69')]==='twilio'){return _0x10faa7['status'](_0x28fbb1)[_0xe682('0x95')](_0xe682('0x96'),'text/xml')[_0xe682('0x2b')]('\x0a');}else{return _0x10faa7[_0xe682('0x1f')](_0x28fbb1)['json'](_0x8b393a);}}})['catch'](handleError(_0x10faa7,null));};exports['addApplications']=function(_0x25d441,_0x3a09c8,_0x4e1800){return db[_0xe682('0x43')][_0xe682('0x97')]({'where':{'id':_0x25d441['params']['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x3a09c8,null))[_0xe682('0x14')](function(_0x2f20c3){if(_0x2f20c3){return db[_0xe682('0x98')][_0xe682('0x99')](function(_0x2b9600){return db['SmsApplication'][_0xe682('0x4c')]({'where':{'SmsAccountId':_0x25d441['params']['id']},'transaction':_0x2b9600})['then'](function(_0x18437b){var _0x3cb2a8=_[_0xe682('0x41')](_0x25d441[_0xe682('0x4b')],function(_0x5238bc){_0x5238bc[_0xe682('0x4f')]=_0x25d441[_0xe682('0x48')]['id'];return _0x5238bc;});return db[_0xe682('0x9a')]['bulkCreate'](_0x3cb2a8,{'transaction':_0x2b9600});});})[_0xe682('0x14')](function(){return db['SmsApplication'][_0xe682('0x9b')]({'where':{'SmsAccountId':_0x25d441[_0xe682('0x48')]['id']},'order':'priority'});});}})[_0xe682('0x14')](respondWithResult(_0x3a09c8,null))[_0xe682('0x1e')](handleError(_0x3a09c8,null));};exports['getApplications']=function(_0x1ddcc0,_0x4a47d6,_0x5246c2){var _0x20fdc7={};var _0x196543={};var _0x5a817c;var _0x23e97e;return db[_0xe682('0x43')][_0xe682('0x97')]({'where':{'id':_0x1ddcc0[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x4a47d6,null))[_0xe682('0x14')](function(_0x2be6f5){if(_0x2be6f5){_0x5a817c=_0x2be6f5;_0x196543['model']=_[_0xe682('0x2f')](db[_0xe682('0x9a')]['rawAttributes']);_0x196543['query']=_[_0xe682('0x2f')](_0x1ddcc0[_0xe682('0x30')]);_0x196543[_0xe682('0x3c')]=_[_0xe682('0x33')](_0x196543[_0xe682('0x2e')],_0x196543['query']);_0x20fdc7[_0xe682('0x35')]=_[_0xe682('0x33')](_0x196543[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x1ddcc0[_0xe682('0x30')]['fields']));_0x20fdc7[_0xe682('0x35')]=_0x20fdc7['attributes'][_0xe682('0x36')]?_0x20fdc7[_0xe682('0x35')]:_0x196543['model'];_0x20fdc7[_0xe682('0x39')]=qs[_0xe682('0x3a')](_0x1ddcc0[_0xe682('0x30')]['sort']);_0x20fdc7[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_['pick'](_0x1ddcc0[_0xe682('0x30')],_0x196543['filters']));if(_0x1ddcc0[_0xe682('0x30')][_0xe682('0x52')]){_0x20fdc7[_0xe682('0x3b')]=_[_0xe682('0x40')](_0x20fdc7[_0xe682('0x3b')],{'$or':_[_0xe682('0x41')](_0x20fdc7[_0xe682('0x35')],function(_0x2294d5){var _0x442d03={};_0x442d03[_0x2294d5]={'$like':'%'+_0x1ddcc0[_0xe682('0x30')]['filter']+'%'};return _0x442d03;})});}_0x20fdc7=_[_0xe682('0x40')]({},_0x20fdc7,_0x1ddcc0[_0xe682('0x42')]);return _0x5a817c['getApplications'](_0x20fdc7);}})['then'](function(_0x5e21dd){if(_0x5e21dd){_0x23e97e=_0x5e21dd[_0xe682('0x36')];if(!_0x1ddcc0[_0xe682('0x30')]['hasOwnProperty'](_0xe682('0x38'))){_0x20fdc7[_0xe682('0x24')]=qs[_0xe682('0x24')](_0x1ddcc0[_0xe682('0x30')][_0xe682('0x24')]);_0x20fdc7[_0xe682('0x23')]=qs['offset'](_0x1ddcc0['query'][_0xe682('0x23')]);}return _0x5a817c[_0xe682('0x9c')](_0x20fdc7);}})[_0xe682('0x14')](function(_0x2fbf3f){if(_0x2fbf3f){return _0x2fbf3f?{'count':_0x23e97e,'rows':_0x2fbf3f}:null;}})[_0xe682('0x14')](respondWithResult(_0x4a47d6,null))['catch'](handleError(_0x4a47d6,null));};exports[_0xe682('0x9d')]=function(_0x528dec,_0x59d67e,_0x598857){var _0x3a63cb={'raw':![],'where':{}};var _0xd708a9={};var _0x269351={'count':0x0,'rows':[]};return db[_0xe682('0x43')][_0xe682('0x97')]({'where':{'id':_0x528dec[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x59d67e,null))[_0xe682('0x14')](function(_0x2d9013){if(_0x2d9013){_0xd708a9[_0xe682('0x2e')]=_[_0xe682('0x2f')](db[_0xe682('0x81')][_0xe682('0x2d')]);_0xd708a9['query']=_[_0xe682('0x2f')](_0x528dec['query']);_0xd708a9[_0xe682('0x3c')]=_[_0xe682('0x33')](_0xd708a9['model'],_0xd708a9[_0xe682('0x30')]);_0x3a63cb['attributes']=_[_0xe682('0x33')](_0xd708a9[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x528dec['query'][_0xe682('0x34')]));_0x3a63cb[_0xe682('0x35')]=_0x3a63cb[_0xe682('0x35')]['length']?_0x3a63cb[_0xe682('0x35')]:_0xd708a9[_0xe682('0x2e')];if(!_0x528dec[_0xe682('0x30')]['hasOwnProperty'](_0xe682('0x38'))){_0x3a63cb[_0xe682('0x24')]=qs[_0xe682('0x24')](_0x528dec[_0xe682('0x30')]['limit']);_0x3a63cb['offset']=qs[_0xe682('0x23')](_0x528dec[_0xe682('0x30')][_0xe682('0x23')]);}_0x3a63cb[_0xe682('0x39')]=qs[_0xe682('0x3a')](_0x528dec[_0xe682('0x30')]['sort']);_0x3a63cb[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_[_0xe682('0x3d')](_0x528dec[_0xe682('0x30')],_0xd708a9[_0xe682('0x3c')]));_0x3a63cb[_0xe682('0x3b')][_0xe682('0x4f')]=_0x2d9013['id'];if(_0x528dec[_0xe682('0x30')]['filter']){_0x3a63cb[_0xe682('0x3b')]=_[_0xe682('0x40')](_0x3a63cb['where'],{'$or':_['map'](_0x3a63cb['attributes'],function(_0x5b3ea7){var _0x2cf54a={};_0x2cf54a[_0x5b3ea7]={'$like':'%'+_0x528dec[_0xe682('0x30')]['filter']+'%'};return _0x2cf54a;})});}_0x3a63cb=_['merge']({},_0x3a63cb,_0x528dec[_0xe682('0x42')]);return db[_0xe682('0x81')][_0xe682('0x22')]({'where':_0x3a63cb[_0xe682('0x3b')]})[_0xe682('0x14')](function(_0x54bbcd){_0x269351['count']=_0x54bbcd;if(_0x528dec['query']['includeAll']){_0x3a63cb[_0xe682('0x45')]=[{'model':db[_0xe682('0x61')],'as':'Contact','required':![]},{'model':db[_0xe682('0x8b')],'as':_0xe682('0x9e'),'attributes':[_0xe682('0x2a'),'fullname',_0xe682('0x9f')],'required':![]},{'model':db[_0xe682('0xa0')],'as':_0xe682('0xa1'),'attributes':['id',_0xe682('0x2a'),_0xe682('0xa2')],'where':_0x528dec['query'][_0xe682('0xa3')]?{'id':_0x528dec[_0xe682('0x30')][_0xe682('0xa3')]}:undefined,'required':_0x528dec['query'][_0xe682('0xa3')]?!![]:![]}];}return db[_0xe682('0x81')][_0xe682('0x46')](_0x3a63cb);})[_0xe682('0x14')](function(_0x3ef73d){_0x269351[_0xe682('0x58')]=_0x3ef73d;return _0x269351;});}})['then'](respondWithFilteredResult(_0x59d67e,_0x3a63cb))[_0xe682('0x1e')](handleError(_0x59d67e,null));};exports[_0xe682('0x2b')]=function(_0x24df71,_0x11d157,_0x414b0c){var _0x14a5d6,_0xb3ae22,_0x1e5884;if(_['isNil'](_0x24df71['body']['body'])||_0x24df71[_0xe682('0x4b')][_0xe682('0x4b')]===''){throw new db[(_0xe682('0x78'))][(_0xe682('0x62'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe682('0x77')](_0x24df71[_0xe682('0x4b')]['to'])){throw new db[(_0xe682('0x78'))][(_0xe682('0x62'))](_0xe682('0xa4'));}_0x14a5d6=_0x24df71['body']['to'];return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x24df71[_0xe682('0x48')]['id']},'include':[{'model':db[_0xe682('0xa5')],'as':_0xe682('0xa6'),'include':[{'model':db[_0xe682('0x61')],'as':_0xe682('0x7e'),'where':{'mobile':_0x14a5d6},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xe682('0x14')](handleEntityNotFound(_0x11d157,null))[_0xe682('0x14')](function(_0x35585f){if(_0x35585f&&_0x35585f[_0xe682('0xa6')]){_0xb3ae22=_0x35585f['get']({'plain':!![]});if(_0xb3ae22[_0xe682('0xa6')]&&_0xb3ae22[_0xe682('0xa6')][_0xe682('0x7e')][_0xe682('0x36')]){return _0xb3ae22[_0xe682('0xa6')][_0xe682('0x7e')][0x0];}return db[_0xe682('0x61')][_0xe682('0x4a')](_[_0xe682('0xa7')](_0x24df71[_0xe682('0x4b')],{'firstName':_0x14a5d6,'mobile':_0x14a5d6,'phone':_0x14a5d6,'ListId':_0xb3ae22[_0xe682('0x68')]}));}})[_0xe682('0x14')](handleEntityNotFound(_0x11d157,null))['then'](function(_0x3091f4){if(_0x3091f4){_0x1e5884=_0x3091f4;return db[_0xe682('0x81')][_0xe682('0x49')]({'where':{'ContactId':_0x1e5884['id'],'closed':![],'SmsAccountId':_0xb3ae22['id']}})['then'](function(_0x1812bc){if(_0x1812bc){return[_0x1812bc,![]];}return db[_0xe682('0x81')][_0xe682('0x4a')]({'UserId':_0x24df71[_0xe682('0xa8')]['id'],'ContactId':_0x1e5884['id'],'SmsAccountId':_0xb3ae22['id'],'phone':_0x14a5d6,'firstMsgDirection':_0xe682('0xa9'),'Messages':[_[_0xe682('0x40')](_0x24df71['body'],{'read':![],'body':_0x24df71[_0xe682('0x4b')][_0xe682('0x4b')],'phone':_0x14a5d6,'SmsAccountId':_0xb3ae22['id'],'UserId':_0x24df71[_0xe682('0xa8')]['id'],'ContactId':_0x1e5884['id']})]},{'include':[{'model':db[_0xe682('0x89')],'as':_0xe682('0xaa')}]})[_0xe682('0x14')](function(_0x553444){return[_0x553444,!![]];});});}})[_0xe682('0x82')](function(_0x23c126,_0x25aeba){if(_0x25aeba){return _0x23c126;}return db['SmsMessage'][_0xe682('0x4a')](_[_0xe682('0x40')](_0x24df71[_0xe682('0x4b')],{'read':![],'body':_0x24df71['body']['body'],'phone':_0x14a5d6,'SmsAccountId':_0xb3ae22['id'],'SmsInteractionId':_0x23c126['id'],'UserId':_0x24df71['user']['id'],'ContactId':_0x1e5884['id']}))['then'](function(_0x569fb5){_0x23c126[_0xe682('0xab')][_0xe682('0xaa')]=[];_0x23c126[_0xe682('0xab')][_0xe682('0xaa')]['push'](_0x569fb5[_0xe682('0xab')]);return _0x23c126;});})[_0xe682('0x14')](respondWithResult(_0x11d157,null))[_0xe682('0x1e')](handleError(_0x11d157,null));};exports['status']=function(_0x64477,_0x379576,_0x2d0ce6){if(_0x64477[_0xe682('0x4b')]['id']){delete _0x64477[_0xe682('0x4b')]['id'];}var _0x22f088,_0x576acc,_0x281911;return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x64477[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x379576,null))[_0xe682('0x14')](function(_0x35738a){if(_0x35738a){_0x281911=_0x35738a;logger[_0xe682('0x18')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xe682('0x1f'),_0xe682('0xac'),_0x35738a[_0xe682('0x69')],util['inspect'](_0x64477[_0xe682('0x4b')],{'showHidden':![],'depth':null}));switch(_0x35738a[_0xe682('0x69')]){case'skebby':if(_0x64477[_0xe682('0x4b')][_0xe682('0xad')]&&_0x64477['body'][_0xe682('0x1f')]){_0x576acc=_0x64477[_0xe682('0x4b')]['status'];return db[_0xe682('0x89')][_0xe682('0x49')]({'where':{'messageId':_0x64477[_0xe682('0x4b')][_0xe682('0xad')]}});}break;case'connectel':if(_0x64477[_0xe682('0x4b')]['requestid']&&_0x64477[_0xe682('0x4b')]['statusInt']){_0x576acc=_0x64477[_0xe682('0x4b')][_0xe682('0xae')];return db[_0xe682('0x89')][_0xe682('0x49')]({'where':{'messageId':_0x64477[_0xe682('0x4b')][_0xe682('0xaf')]}});}break;case'clicksend':if(_0x64477[_0xe682('0x4b')][_0xe682('0x72')]&&_0x64477[_0xe682('0x4b')][_0xe682('0xb0')]){_0x576acc=_0x64477[_0xe682('0x4b')]['status_code'];return db[_0xe682('0x89')][_0xe682('0x49')]({'where':{'messageId':_0x64477[_0xe682('0x4b')][_0xe682('0x72')]}});}break;}}})[_0xe682('0x14')](handleEntityNotFound(_0x379576,null))[_0xe682('0x14')](function(_0x4f6907){if(_0x4f6907){_0x22f088=_0x4f6907;switch(_0x281911[_0xe682('0x69')]){case'skebby':if(_0x576acc===_0xe682('0xb1')){return _0x22f088[_0xe682('0xb2')]({'read':!![]});}else{logger[_0xe682('0x1a')](_0xe682('0x19'),'status',_0xe682('0x6c'),util[_0xe682('0xb3')](_0x64477[_0xe682('0x4b')],{'showHidden':![],'depth':null}));}break;case _0xe682('0x70'):if(_0x576acc==='1'){return _0x22f088[_0xe682('0xb2')]({'read':!![]});}else{logger['error'](_0xe682('0x19'),_0xe682('0x1f'),_0xe682('0x6c'),util[_0xe682('0xb3')](_0x64477[_0xe682('0x4b')],{'showHidden':![],'depth':null}));}break;case _0xe682('0x71'):if(!_0x64477[_0xe682('0x4b')][_0xe682('0xb4')]&&_0x576acc>=0xc8&&_0x576acc<=0xce){return _0x22f088[_0xe682('0xb2')]({'read':!![]});}else{logger[_0xe682('0x1a')](_0xe682('0x19'),_0xe682('0x1f'),_0xe682('0x71'),util[_0xe682('0xb3')](_0x64477[_0xe682('0x4b')],{'showHidden':![],'depth':null}));}break;}return _0x22f088;}})['then'](respondWithResult(_0x379576,null))[_0xe682('0x1e')](handleError(_0x379576,null));};exports[_0xe682('0xb5')]=function(_0x5d528e,_0x148910,_0x4b5054){return db[_0xe682('0x43')][_0xe682('0x49')]({'where':{'id':_0x5d528e[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x148910,null))[_0xe682('0x14')](function(_0x1c7ba0){if(_0x1c7ba0){return _0x1c7ba0[_0xe682('0xb5')](_0x5d528e['body'][_0xe682('0x54')],_[_0xe682('0x80')](_0x5d528e[_0xe682('0x4b')],['ids','id'])||{})[_0xe682('0x82')](function(_0x3e9fa4){for(var _0x508a01=0x0;_0x508a01<_0x5d528e[_0xe682('0x4b')]['ids'][_0xe682('0x36')];_0x508a01+=0x1){socket[_0xe682('0xb6')](_0xe682('0xb7'),{'UserId':_0x5d528e[_0xe682('0x4b')][_0xe682('0x54')][_0x508a01],'SmsAccountId':_0x5d528e[_0xe682('0x48')]['id']});}return _0x3e9fa4;});}})[_0xe682('0x14')](respondWithResult(_0x148910,null))[_0xe682('0x1e')](handleError(_0x148910,null));};exports[_0xe682('0xb8')]=function(_0x6bf31b,_0x4b2a7a,_0x218ab1){var _0x1175de;return db['SmsAccount'][_0xe682('0x49')]({'where':{'id':_0x6bf31b[_0xe682('0x48')]['id']}})['then'](handleEntityNotFound(_0x4b2a7a,null))[_0xe682('0x14')](function(_0x2e2f79){if(_0x2e2f79){return _0x2e2f79['removeAgents'](_0x6bf31b[_0xe682('0x30')][_0xe682('0x54')])[_0xe682('0x14')](function(_0x2b5dd4){if(_[_0xe682('0xb9')](_0x6bf31b['query'][_0xe682('0x54')])){for(var _0x492c1e=0x0;_0x492c1e<_0x6bf31b[_0xe682('0x30')][_0xe682('0x54')][_0xe682('0x36')];_0x492c1e+=0x1){socket[_0xe682('0xb6')](_0xe682('0xba'),{'UserId':_0x6bf31b[_0xe682('0x30')]['ids'][_0x492c1e],'SmsAccountId':_0x6bf31b[_0xe682('0x48')]['id']});}}else{socket[_0xe682('0xb6')](_0xe682('0xba'),{'UserId':_0x6bf31b[_0xe682('0x30')][_0xe682('0x54')],'SmsAccountId':_0x6bf31b[_0xe682('0x48')]['id']});}});}})[_0xe682('0x14')](respondWithStatusCode(_0x4b2a7a,null))['catch'](handleError(_0x4b2a7a,null));};exports[_0xe682('0xbb')]=function(_0x287928,_0x5f2db9,_0x54601c){var _0x555cc5={};var _0x26af76={};var _0x97d683;var _0x4a0233;return db[_0xe682('0x43')][_0xe682('0x97')]({'where':{'id':_0x287928[_0xe682('0x48')]['id']}})[_0xe682('0x14')](handleEntityNotFound(_0x5f2db9,null))[_0xe682('0x14')](function(_0x415a7f){if(_0x415a7f){_0x97d683=_0x415a7f;_0x26af76[_0xe682('0x2e')]=_[_0xe682('0x2f')](db[_0xe682('0x8b')][_0xe682('0x2d')]);_0x26af76['query']=_[_0xe682('0x2f')](_0x287928[_0xe682('0x30')]);_0x26af76[_0xe682('0x3c')]=_[_0xe682('0x33')](_0x26af76[_0xe682('0x2e')],_0x26af76[_0xe682('0x30')]);_0x555cc5[_0xe682('0x35')]=_['intersection'](_0x26af76[_0xe682('0x2e')],qs[_0xe682('0x34')](_0x287928[_0xe682('0x30')]['fields']));_0x555cc5['attributes']=_0x555cc5[_0xe682('0x35')]['length']?_0x555cc5[_0xe682('0x35')]:_0x26af76[_0xe682('0x2e')];_0x555cc5['order']=qs[_0xe682('0x3a')](_0x287928[_0xe682('0x30')]['sort']);_0x555cc5[_0xe682('0x3b')]=qs[_0xe682('0x3c')](_[_0xe682('0x3d')](_0x287928[_0xe682('0x30')],_0x26af76['filters']));if(_0x287928[_0xe682('0x30')][_0xe682('0x52')]){_0x555cc5[_0xe682('0x3b')]=_['merge'](_0x555cc5[_0xe682('0x3b')],{'$or':_['map'](_0x555cc5[_0xe682('0x35')],function(_0x54616b){var _0x4deb4c={};_0x4deb4c[_0x54616b]={'$like':'%'+_0x287928[_0xe682('0x30')][_0xe682('0x52')]+'%'};return _0x4deb4c;})});}_0x555cc5=_[_0xe682('0x40')]({},_0x555cc5,_0x287928['options']);return _0x97d683['getAgents'](_0x555cc5);}})[_0xe682('0x14')](function(_0x2e7113){if(_0x2e7113){_0x4a0233=_0x2e7113[_0xe682('0x36')];if(!_0x287928[_0xe682('0x30')][_0xe682('0x37')](_0xe682('0x38'))){_0x555cc5[_0xe682('0x24')]=qs[_0xe682('0x24')](_0x287928[_0xe682('0x30')]['limit']);_0x555cc5[_0xe682('0x23')]=qs[_0xe682('0x23')](_0x287928[_0xe682('0x30')][_0xe682('0x23')]);}return _0x97d683['getAgents'](_0x555cc5);}})[_0xe682('0x14')](function(_0x45a18f){if(_0x45a18f){return _0x45a18f?{'count':_0x4a0233,'rows':_0x45a18f}:null;}})['then'](respondWithResult(_0x5f2db9,null))[_0xe682('0x1e')](handleError(_0x5f2db9,null));}; \ No newline at end of file +var _0xe665=['dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','connectel','error_code','addAgents','spread','removeAgents','emit','userSmsAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','name','SmsAccount','rawAttributes','model','dateStart','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','dateEnd','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','fields','find','create','body','params','describe','addDisposition','getDispositions','findOne','Disposition','SmsAccountId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','type','from','From','messageId','skebby','sender','clicksend','message_id','plivo','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','ListId','Contacts','omit','defaults','CmContact','contact','SmsInteraction','interaction','created','push','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','sequelize','transaction','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','to\x20is\x20mandatory','CmList','List','user','Messages'];(function(_0x5f2c9d,_0x15e841){var _0x47fdba=function(_0x140ba6){while(--_0x140ba6){_0x5f2c9d['push'](_0x5f2c9d['shift']());}};_0x47fdba(++_0x15e841);}(_0xe665,0xcd));var _0x5e66=function(_0x427037,_0x1bc0d6){_0x427037=_0x427037-0x0;var _0x2cb6a1=_0xe665[_0x427037];return _0x2cb6a1;};'use strict';var jsonpatch=require(_0x5e66('0x0'));var rp=require(_0x5e66('0x1'));var moment=require(_0x5e66('0x2'));var BPromise=require(_0x5e66('0x3'));var Mustache=require('mustache');var util=require(_0x5e66('0x4'));var path=require(_0x5e66('0x5'));var sox=require(_0x5e66('0x6'));var csv=require(_0x5e66('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5e66('0x8'));var squel=require(_0x5e66('0x9'));var crypto=require('crypto');var jsforce=require(_0x5e66('0xa'));var deskjs=require(_0x5e66('0xb'));var toCsv=require(_0x5e66('0x7'));var querystring=require(_0x5e66('0xc'));var Papa=require(_0x5e66('0xd'));var qs=require(_0x5e66('0xe'));var logger=require(_0x5e66('0xf'))(_0x5e66('0x10'));var utils=require('../../config/utils');var config=require(_0x5e66('0x11'));var db=require(_0x5e66('0x12'))['db'];var socket=require(_0x5e66('0x13'))({'host':_0x5e66('0x14'),'port':0x18eb});require(_0x5e66('0x15'))[_0x5e66('0x16')](socket);var jayson=require(_0x5e66('0x17'));var client=jayson[_0x5e66('0x18')][_0x5e66('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x252461,_0x40a86b,_0x1c6ee4,_0x176a9f){return new BPromise(function(_0x5cd1a2,_0x35f312){var _0x43fe17=_0x176a9f||client;return _0x43fe17[_0x5e66('0x1a')](_0x252461,_0x1c6ee4)[_0x5e66('0x1b')](function(_0x56007e){logger[_0x5e66('0x1c')](_0x5e66('0x1d'),_0x40a86b,_0x5e66('0x1e'));logger[_0x5e66('0x1f')](_0x5e66('0x20'),_0x40a86b,'request\x20sent',JSON[_0x5e66('0x21')](_0x56007e));if(_0x56007e['error']){if(_0x56007e[_0x5e66('0x22')][_0x5e66('0x23')]===0x1f4){logger['error'](_0x5e66('0x1d'),_0x40a86b,_0x56007e['error'][_0x5e66('0x24')]);return _0x35f312(_0x56007e['error'][_0x5e66('0x24')]);}logger[_0x5e66('0x22')](_0x5e66('0x1d'),_0x40a86b,_0x56007e[_0x5e66('0x22')][_0x5e66('0x24')]);return _0x5cd1a2(_0x56007e[_0x5e66('0x22')][_0x5e66('0x24')]);}else{logger[_0x5e66('0x1c')](_0x5e66('0x1d'),_0x40a86b,_0x5e66('0x1e'));_0x5cd1a2(_0x56007e['result']['message']);}})[_0x5e66('0x25')](function(_0xdd810e){logger['error'](_0x5e66('0x1d'),_0x40a86b,_0xdd810e);_0x35f312(_0xdd810e);});});}function respondWithStatusCode(_0x4f1f39,_0x12221a){_0x12221a=_0x12221a||0xcc;return function(_0x1fc0c1){if(_0x1fc0c1){return _0x4f1f39['sendStatus'](_0x12221a);}return _0x4f1f39[_0x5e66('0x26')](_0x12221a)[_0x5e66('0x27')]();};}function respondWithResult(_0x4976d5,_0x50d06f){_0x50d06f=_0x50d06f||0xc8;return function(_0x2f5456){if(_0x2f5456){return _0x4976d5['status'](_0x50d06f)['json'](_0x2f5456);}};}function respondWithFilteredResult(_0x37f14b,_0x45a0cc){return function(_0x21b4b6){if(_0x21b4b6){var _0x4ecad4=_0x21b4b6[_0x5e66('0x28')],_0x3c3e04=_0x45a0cc[_0x5e66('0x29')],_0x385b29=_0x45a0cc[_0x5e66('0x29')]+_0x45a0cc[_0x5e66('0x2a')],_0x90c37b;if(_0x385b29>=_0x4ecad4){_0x385b29=_0x4ecad4;_0x90c37b=0xc8;}else{_0x90c37b=0xce;}_0x37f14b['status'](_0x90c37b);return _0x37f14b[_0x5e66('0x2b')](_0x5e66('0x2c'),_0x3c3e04+'-'+_0x385b29+'/'+_0x4ecad4)[_0x5e66('0x2d')](_0x21b4b6);}return null;};}function patchUpdates(_0x4eed59){return function(_0x3d48be){try{jsonpatch[_0x5e66('0x2e')](_0x3d48be,_0x4eed59,!![]);}catch(_0x3436ed){return BPromise['reject'](_0x3436ed);}return _0x3d48be[_0x5e66('0x2f')]();};}function saveUpdates(_0x130003,_0x299165){return function(_0x21bc17){if(_0x21bc17){return _0x21bc17[_0x5e66('0x30')](_0x130003)[_0x5e66('0x1b')](function(_0x3feb9f){return _0x3feb9f;});}return null;};}function removeEntity(_0x4c8f47,_0x30e87a){return function(_0x5725b4){if(_0x5725b4){return _0x5725b4[_0x5e66('0x31')]()['then'](function(){_0x4c8f47[_0x5e66('0x26')](0xcc)[_0x5e66('0x27')]();});}};}function handleEntityNotFound(_0x53d9dc,_0x36a9c3){return function(_0x3191fd){if(!_0x3191fd){_0x53d9dc[_0x5e66('0x32')](0x194);}return _0x3191fd;};}function handleError(_0x421d61,_0x1465c8){_0x1465c8=_0x1465c8||0x1f4;return function(_0x37d2c7){logger[_0x5e66('0x22')](_0x37d2c7['stack']);if(_0x37d2c7[_0x5e66('0x33')]){delete _0x37d2c7[_0x5e66('0x33')];}_0x421d61['status'](_0x1465c8)['send'](_0x37d2c7);};}exports['index']=function(_0x39cbce,_0x32421b){var _0xaffc04={},_0x350fba={},_0x21ad3f={'count':0x0,'rows':[]};var _0x158a8d=db[_0x5e66('0x34')][_0x5e66('0x35')];_0x350fba[_0x5e66('0x36')]=_['keys'](_0x158a8d);var _0x171289={'dateStart':_0x39cbce['query'][_0x5e66('0x37')],'dateEnd':_0x39cbce['query']['dateEnd']};delete _0x39cbce[_0x5e66('0x38')]['dateStart'];delete _0x39cbce[_0x5e66('0x38')]['dateEnd'];_0x350fba['query']=_[_0x5e66('0x39')](_0x39cbce[_0x5e66('0x38')]);_0x350fba['filters']=_[_0x5e66('0x3a')](_0x350fba[_0x5e66('0x36')],_0x350fba[_0x5e66('0x38')]);_0xaffc04['attributes']=_[_0x5e66('0x3a')](_0x350fba[_0x5e66('0x36')],qs['fields'](_0x39cbce[_0x5e66('0x38')]['fields']));_0xaffc04[_0x5e66('0x3b')]=_0xaffc04['attributes'][_0x5e66('0x3c')]?_0xaffc04[_0x5e66('0x3b')]:_0x350fba[_0x5e66('0x36')];if(!_0x39cbce[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0xaffc04[_0x5e66('0x2a')]=qs[_0x5e66('0x2a')](_0x39cbce[_0x5e66('0x38')][_0x5e66('0x2a')]);_0xaffc04[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x39cbce['query'][_0x5e66('0x29')]);}_0xaffc04[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x39cbce[_0x5e66('0x38')]['sort']);_0xaffc04[_0x5e66('0x41')]=qs['filters'](_[_0x5e66('0x42')](_0x39cbce['query'],_0x350fba[_0x5e66('0x43')]));if(_0x171289[_0x5e66('0x37')]){if(_0x171289['dateEnd']){_0x171289[_0x5e66('0x44')]=moment(_0x171289[_0x5e66('0x44')])[_0x5e66('0x45')](0x1,_0x5e66('0x46'));}else{_0x171289[_0x5e66('0x44')]=moment(_0x171289[_0x5e66('0x37')])[_0x5e66('0x45')](0x1,_0x5e66('0x46'));}_[_0x5e66('0x47')](_0xaffc04[_0x5e66('0x41')],{'createdAt':{'$gte':_0x171289['dateStart'],'$lte':_0x171289[_0x5e66('0x44')]}});}if(_0x39cbce[_0x5e66('0x38')][_0x5e66('0x48')]){_0xaffc04[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0xaffc04[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0xaffc04[_0x5e66('0x3b')],function(_0x59724b){var _0xecbc4e={};_0xecbc4e[_0x59724b]={'$like':'%'+_0x39cbce[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0xecbc4e;})});}_0xaffc04=_[_0x5e66('0x47')]({},_0xaffc04,_0x39cbce[_0x5e66('0x4a')]);var _0x36b488={'where':_0xaffc04[_0x5e66('0x41')]};return db[_0x5e66('0x34')][_0x5e66('0x28')](_0x36b488)[_0x5e66('0x1b')](function(_0x13c7fd){_0x21ad3f[_0x5e66('0x28')]=_0x13c7fd;if(_0x39cbce[_0x5e66('0x38')][_0x5e66('0x4b')]){_0xaffc04[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x34')][_0x5e66('0x4d')](_0xaffc04);})[_0x5e66('0x1b')](function(_0x688609){_0x21ad3f[_0x5e66('0x4e')]=_0x688609;return _0x21ad3f;})[_0x5e66('0x1b')](respondWithFilteredResult(_0x32421b,_0xaffc04))[_0x5e66('0x25')](handleError(_0x32421b,null));};exports[_0x5e66('0x4f')]=function(_0xea88e5,_0x5a86d8){var _0x276cb5={'raw':![],'where':{'id':_0xea88e5['params']['id']}},_0x5a95dd={};_0x5a95dd['model']=_[_0x5e66('0x39')](db[_0x5e66('0x34')][_0x5e66('0x35')]);_0x5a95dd[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0xea88e5[_0x5e66('0x38')]);_0x5a95dd['filters']=_[_0x5e66('0x3a')](_0x5a95dd[_0x5e66('0x36')],_0x5a95dd[_0x5e66('0x38')]);_0x276cb5[_0x5e66('0x3b')]=_[_0x5e66('0x3a')](_0x5a95dd[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0xea88e5[_0x5e66('0x38')][_0x5e66('0x50')]));_0x276cb5['attributes']=_0x276cb5[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x276cb5['attributes']:_0x5a95dd['model'];if(_0xea88e5[_0x5e66('0x38')][_0x5e66('0x4b')]){_0x276cb5[_0x5e66('0x4c')]=[{'all':!![]}];}_0x276cb5=_['merge']({},_0x276cb5,_0xea88e5[_0x5e66('0x4a')]);return db[_0x5e66('0x34')][_0x5e66('0x51')](_0x276cb5)[_0x5e66('0x1b')](handleEntityNotFound(_0x5a86d8,null))[_0x5e66('0x1b')](respondWithResult(_0x5a86d8,null))[_0x5e66('0x25')](handleError(_0x5a86d8,null));};exports[_0x5e66('0x52')]=function(_0x48b80a,_0xe2f644){return db['SmsAccount'][_0x5e66('0x52')](_0x48b80a[_0x5e66('0x53')],{})[_0x5e66('0x1b')](respondWithResult(_0xe2f644,0xc9))['catch'](handleError(_0xe2f644,null));};exports[_0x5e66('0x30')]=function(_0x9eb41a,_0x171e64){if(_0x9eb41a[_0x5e66('0x53')]['id']){delete _0x9eb41a['body']['id'];}return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x9eb41a[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x171e64,null))[_0x5e66('0x1b')](saveUpdates(_0x9eb41a[_0x5e66('0x53')],null))[_0x5e66('0x1b')](respondWithResult(_0x171e64,null))[_0x5e66('0x25')](handleError(_0x171e64,null));};exports[_0x5e66('0x31')]=function(_0x573090,_0x398e64){return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x573090[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x398e64,null))[_0x5e66('0x1b')](removeEntity(_0x398e64,null))[_0x5e66('0x25')](handleError(_0x398e64,null));};exports[_0x5e66('0x55')]=function(_0x4c171f,_0x552b00){return db['SmsAccount']['describe']()[_0x5e66('0x1b')](respondWithResult(_0x552b00,null))[_0x5e66('0x25')](handleError(_0x552b00,null));};exports[_0x5e66('0x56')]=function(_0x539a55,_0x12066b,_0x2bd8a8){if(_0x539a55[_0x5e66('0x53')]['id']){delete _0x539a55[_0x5e66('0x53')]['id'];}return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x539a55[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x12066b,null))['then'](function(_0x9cc7f9){if(_0x9cc7f9){_0x539a55[_0x5e66('0x53')]['SmsAccountId']=_0x9cc7f9['id'];return db['Disposition'][_0x5e66('0x52')](_0x539a55[_0x5e66('0x53')]);}})['then'](respondWithResult(_0x12066b,null))[_0x5e66('0x25')](handleError(_0x12066b,null));};exports[_0x5e66('0x57')]=function(_0x54c2c2,_0x532a92,_0x12e324){var _0x25e54e={'raw':![],'where':{}};var _0x286360={};var _0x5a80ba={'count':0x0,'rows':[]};return db['SmsAccount'][_0x5e66('0x58')]({'where':{'id':_0x54c2c2[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x532a92,null))[_0x5e66('0x1b')](function(_0x514f36){if(_0x514f36){_0x286360[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0x59')][_0x5e66('0x35')]);_0x286360['query']=_['keys'](_0x54c2c2['query']);_0x286360[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x286360[_0x5e66('0x36')],_0x286360[_0x5e66('0x38')]);_0x25e54e[_0x5e66('0x3b')]=_['intersection'](_0x286360[_0x5e66('0x36')],qs['fields'](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x50')]));_0x25e54e[_0x5e66('0x3b')]=_0x25e54e[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x25e54e[_0x5e66('0x3b')]:_0x286360[_0x5e66('0x36')];if(!_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x25e54e['limit']=qs[_0x5e66('0x2a')](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x25e54e['offset']=qs[_0x5e66('0x29')](_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x29')]);}_0x25e54e[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x54c2c2[_0x5e66('0x38')]['sort']);_0x25e54e[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x54c2c2[_0x5e66('0x38')],_0x286360[_0x5e66('0x43')]));_0x25e54e[_0x5e66('0x41')][_0x5e66('0x5a')]=_0x514f36['id'];if(_0x54c2c2['query'][_0x5e66('0x48')]){_0x25e54e[_0x5e66('0x41')]=_['merge'](_0x25e54e[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x25e54e[_0x5e66('0x3b')],function(_0x170070){var _0x30ffe8={};_0x30ffe8[_0x170070]={'$like':'%'+_0x54c2c2[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x30ffe8;})});}_0x25e54e=_[_0x5e66('0x47')]({},_0x25e54e,_0x54c2c2['options']);return db['Disposition']['count']({'where':_0x25e54e[_0x5e66('0x41')]})[_0x5e66('0x1b')](function(_0x350b27){_0x5a80ba['count']=_0x350b27;if(_0x54c2c2['query'][_0x5e66('0x4b')]){_0x25e54e[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x59')]['findAll'](_0x25e54e);})[_0x5e66('0x1b')](function(_0x221d52){_0x5a80ba[_0x5e66('0x4e')]=_0x221d52;return _0x5a80ba;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x532a92,_0x25e54e))[_0x5e66('0x25')](handleError(_0x532a92,null));};exports[_0x5e66('0x5b')]=function(_0x13684b,_0x5a4e80,_0x3777a5){var _0x327946;return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x13684b[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x5a4e80,null))[_0x5e66('0x1b')](function(_0x2eee2e){if(_0x2eee2e){return _0x2eee2e['removeDispositions'](_0x13684b[_0x5e66('0x38')][_0x5e66('0x5c')]);}})[_0x5e66('0x1b')](respondWithStatusCode(_0x5a4e80,null))[_0x5e66('0x25')](handleError(_0x5a4e80,null));};exports['addAnswer']=function(_0x118ecf,_0x591684,_0x43b8df){if(_0x118ecf['body']['id']){delete _0x118ecf['body']['id'];}return db[_0x5e66('0x34')]['find']({'where':{'id':_0x118ecf[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x591684,null))['then'](function(_0x21b9af){if(_0x21b9af){_0x118ecf[_0x5e66('0x53')][_0x5e66('0x5a')]=_0x21b9af['id'];return db[_0x5e66('0x5d')][_0x5e66('0x52')](_0x118ecf[_0x5e66('0x53')]);}})['then'](respondWithResult(_0x591684,null))[_0x5e66('0x25')](handleError(_0x591684,null));};exports[_0x5e66('0x5e')]=function(_0x1847a6,_0x4b271e,_0x39e066){var _0x45238c={'raw':![],'where':{}};var _0x4c8714={};var _0x1e700e={'count':0x0,'rows':[]};return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x1847a6[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x4b271e,null))[_0x5e66('0x1b')](function(_0x19becf){if(_0x19becf){_0x4c8714[_0x5e66('0x36')]=_['keys'](db['CannedAnswer'][_0x5e66('0x35')]);_0x4c8714[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x1847a6[_0x5e66('0x38')]);_0x4c8714[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x4c8714[_0x5e66('0x36')],_0x4c8714[_0x5e66('0x38')]);_0x45238c[_0x5e66('0x3b')]=_['intersection'](_0x4c8714[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x1847a6[_0x5e66('0x38')]['fields']));_0x45238c['attributes']=_0x45238c[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x45238c[_0x5e66('0x3b')]:_0x4c8714[_0x5e66('0x36')];if(!_0x1847a6[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x45238c['limit']=qs[_0x5e66('0x2a')](_0x1847a6[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x45238c[_0x5e66('0x29')]=qs['offset'](_0x1847a6[_0x5e66('0x38')]['offset']);}_0x45238c[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x1847a6[_0x5e66('0x38')]['sort']);_0x45238c['where']=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x1847a6[_0x5e66('0x38')],_0x4c8714[_0x5e66('0x43')]));_0x45238c[_0x5e66('0x41')][_0x5e66('0x5a')]=_0x19becf['id'];if(_0x1847a6[_0x5e66('0x38')]['filter']){_0x45238c[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0x45238c[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x45238c[_0x5e66('0x3b')],function(_0x1ec810){var _0x347c4b={};_0x347c4b[_0x1ec810]={'$like':'%'+_0x1847a6[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x347c4b;})});}_0x45238c=_[_0x5e66('0x47')]({},_0x45238c,_0x1847a6['options']);return db[_0x5e66('0x5d')]['count']({'where':_0x45238c[_0x5e66('0x41')]})['then'](function(_0x5d4299){_0x1e700e[_0x5e66('0x28')]=_0x5d4299;if(_0x1847a6[_0x5e66('0x38')][_0x5e66('0x4b')]){_0x45238c[_0x5e66('0x4c')]=[{'all':!![]}];}return db[_0x5e66('0x5d')][_0x5e66('0x4d')](_0x45238c);})[_0x5e66('0x1b')](function(_0xc4c13f){_0x1e700e['rows']=_0xc4c13f;return _0x1e700e;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x4b271e,_0x45238c))[_0x5e66('0x25')](handleError(_0x4b271e,null));};exports[_0x5e66('0x5f')]=function(_0x14e581,_0x3538b9,_0x32faa0){var _0x22fc0f;return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x14e581[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x3538b9,null))[_0x5e66('0x1b')](function(_0x3a5cfe){if(_0x3a5cfe){return _0x3a5cfe['removeAnswers'](_0x14e581[_0x5e66('0x38')][_0x5e66('0x5c')]);}})['then'](respondWithStatusCode(_0x3538b9,null))[_0x5e66('0x25')](handleError(_0x3538b9,null));};exports[_0x5e66('0x60')]=function(_0x47884c,_0x87ac2e,_0x4771ae){var _0x2f8dc5={'channel':_0x5e66('0x61')};var _0x48afb0=[];var _0x581aff=[];var _0x46acd4={};return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x47884c[_0x5e66('0x54')]['id']},'include':[{'model':db[_0x5e66('0x62')],'as':_0x5e66('0x63')}]})['then'](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x4447a5){_0x2f8dc5[_0x5e66('0x64')]=_0x4447a5;_0x2f8dc5[_0x5e66('0x65')]=_[_0x5e66('0x66')](_0x4447a5[_0x5e66('0x63')],['priority'],[_0x5e66('0x67')]);if(_0x2f8dc5[_0x5e66('0x64')]['Applications']){delete _0x2f8dc5['account'][_0x5e66('0x63')];}return db['CmContact'][_0x5e66('0x55')]();})[_0x5e66('0x1b')](function(_0x258108){if(!_0x258108){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x6a'));}_0x48afb0=_[_0x5e66('0x6b')](_['keys'](_0x258108),[_0x5e66('0x6c'),'updatedAt']);_0x581aff=_[_0x5e66('0x6b')](_[_0x5e66('0x39')](_0x258108),[_0x5e66('0x6c'),_0x5e66('0x6d'),'CompanyId','ListId']);_0x2f8dc5[_0x5e66('0x53')]={'mapKey':_0x5e66('0x6e')};if(_0x2f8dc5['account'][_0x5e66('0x6f')]){switch(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x6f')]){case'twilio':_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x71')];_0x2f8dc5['body']['body']=_0x47884c['body']['Body'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c['body']['MessageSid'];break;case _0x5e66('0x73'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x74')];_0x2f8dc5['body']['body']=_0x47884c[_0x5e66('0x53')]['text'];break;case'connectel':_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')]['from'];_0x2f8dc5[_0x5e66('0x53')]['body']=_0x47884c['body'][_0x5e66('0x24')];break;case _0x5e66('0x75'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x70')];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x53')]=_0x47884c[_0x5e66('0x53')]['body'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x76')];break;case _0x5e66('0x77'):_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')]=_0x47884c[_0x5e66('0x53')][_0x5e66('0x71')];_0x2f8dc5[_0x5e66('0x53')]['body']=_0x47884c[_0x5e66('0x53')]['Text'];_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x72')]=_0x47884c[_0x5e66('0x53')]['MessageUUID'];break;}}if(_0x2f8dc5[_0x5e66('0x53')]['id']){delete _0x2f8dc5[_0x5e66('0x53')]['id'];}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x79'));}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')]['body'])||_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x53')]===''){throw new db['Sequelize'][(_0x5e66('0x69'))](_0x5e66('0x7a'));}if(_[_0x5e66('0x78')](_0x2f8dc5[_0x5e66('0x53')]['mapKey'])){throw new db['Sequelize'][(_0x5e66('0x69'))](_0x5e66('0x7b')+_0x581aff);}if(!_[_0x5e66('0x7c')](_0x581aff,_0x2f8dc5['body'][_0x5e66('0x7d')])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0x7e')+_0x581aff);}_0x46acd4[_0x2f8dc5['body']['mapKey']]=_0x2f8dc5[_0x5e66('0x53')][_0x5e66('0x70')];return db['CmList']['find']({'where':{'id':_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x7f')]},'include':[{'model':db['CmContact'],'as':_0x5e66('0x80'),'where':_0x46acd4,'limit':0x1,'order':[[_0x5e66('0x6d'),'DESC']]}]});})[_0x5e66('0x1b')](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x5d2ce1){if(_0x5d2ce1){_0x2f8dc5['list']=_[_0x5e66('0x81')](_0x5d2ce1,[_0x5e66('0x80')]);if(_0x5d2ce1[_0x5e66('0x80')]['length']){return _0x5d2ce1[_0x5e66('0x80')][0x0];}var _0x142f13=_[_0x5e66('0x82')](_0x2f8dc5[_0x5e66('0x53')],{'firstName':_0x2f8dc5[_0x5e66('0x53')]['from'],'ListId':_0x5d2ce1['id']});_0x142f13[_0x2f8dc5[_0x5e66('0x53')]['mapKey']]=_0x2f8dc5['body'][_0x5e66('0x70')];return db[_0x5e66('0x83')]['create'](_0x142f13,{'fields':_0x48afb0,'raw':!![]});}})['then'](handleEntityNotFound(_0x87ac2e,null))[_0x5e66('0x1b')](function(_0x9306c7){if(_0x9306c7){_0x2f8dc5[_0x5e66('0x84')]=_0x9306c7;var _0xd3d203={'ContactId':_0x9306c7['id'],'phone':_0x2f8dc5[_0x5e66('0x53')]['from'],'SmsAccountId':_0x47884c['params']['id']};var _0x2fe79b={'ContactId':_0x9306c7['id'],'SmsAccountId':_0x47884c[_0x5e66('0x54')]['id'],'closed':![]};return db[_0x5e66('0x85')][_0x5e66('0x51')]({'where':_0x2fe79b})[_0x5e66('0x1b')](function(_0x5b05c8){if(_0x5b05c8){return[_0x5b05c8,![]];}return db['SmsInteraction'][_0x5e66('0x52')](_0xd3d203)[_0x5e66('0x1b')](function(_0x1ba2ec){return[_0x1ba2ec,!![]];});});}})['spread'](function(_0x2684f0,_0x4013c5){_0x2f8dc5['interaction']=_0x2684f0['get']({'plain':!![]});_0x2f8dc5[_0x5e66('0x86')][_0x5e66('0x87')]=![];if(_0x4013c5){if(_0x2f8dc5[_0x5e66('0x64')]['autoclose']){_0x2f8dc5[_0x5e66('0x65')][_0x5e66('0x88')]({'id':0x0,'priority':_0x2f8dc5['applications'][_0x5e66('0x3c')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5e66('0x89')});}_0x2f8dc5[_0x5e66('0x86')]['created']=!![];}return db[_0x5e66('0x8a')]['create']({'phone':_0x2f8dc5[_0x5e66('0x53')]['from'],'messageId':_0x2f8dc5['body'][_0x5e66('0x72')],'body':_0x2f8dc5[_0x5e66('0x53')]['body'],'SmsAccountId':_0x47884c[_0x5e66('0x54')]['id'],'SmsInteractionId':_0x2684f0['id'],'direction':'in','ContactId':_0x2684f0[_0x5e66('0x8b')],'AttachmentId':_0x2f8dc5['body'][_0x5e66('0x8c')]});})[_0x5e66('0x1b')](function(_0x545dcb){_0x2f8dc5[_0x5e66('0x24')]=_0x545dcb;if(_0x2f8dc5[_0x5e66('0x86')][_0x5e66('0x8d')]){return db['User'][_0x5e66('0x51')]({'attributes':['id','name'],'where':{'id':_0x2f8dc5['interaction'][_0x5e66('0x8d')]}})[_0x5e66('0x1b')](function(_0x4576c6){if(_0x4576c6){_0x2f8dc5['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x5e66('0x8e'),'appdata':_0x4576c6[_0x5e66('0x33')]+','+(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x8f')]||0xa),'interval':_0x5e66('0x89')});}return respondWithRpcPromise(_0x5e66('0x90'),'startRouting',_0x2f8dc5);});}return respondWithRpcPromise(_0x5e66('0x90'),_0x5e66('0x91'),_0x2f8dc5);})['then'](function(_0x34291b){if(_0x34291b){var _0x39b41e=0xc8;var _0x4ae6d6=_0x5e66('0x92');logger[_0x5e66('0x1c')](_0x5e66('0x20'),_0x4ae6d6,_0x39b41e,_0x5e66('0x93'));logger[_0x5e66('0x1f')](_0x5e66('0x94'),_0x4ae6d6,_0x39b41e,_0x5e66('0x93'),JSON[_0x5e66('0x21')](_0x34291b));if(_0x2f8dc5[_0x5e66('0x64')][_0x5e66('0x6f')]===_0x5e66('0x95')){return _0x87ac2e[_0x5e66('0x26')](_0x39b41e)[_0x5e66('0x2b')](_0x5e66('0x96'),_0x5e66('0x97'))[_0x5e66('0x98')]('\x0a');}else{return _0x87ac2e[_0x5e66('0x26')](_0x39b41e)[_0x5e66('0x2d')](_0x34291b);}}})[_0x5e66('0x25')](handleError(_0x87ac2e,null));};exports['addApplications']=function(_0x3d080d,_0x37e0ae,_0x3b67ec){return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x3d080d[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x37e0ae,null))[_0x5e66('0x1b')](function(_0x20117d){if(_0x20117d){return db[_0x5e66('0x99')][_0x5e66('0x9a')](function(_0x325d09){return db[_0x5e66('0x62')][_0x5e66('0x31')]({'where':{'SmsAccountId':_0x3d080d[_0x5e66('0x54')]['id']},'transaction':_0x325d09})[_0x5e66('0x1b')](function(_0x59343a){var _0x114a3a=_[_0x5e66('0x49')](_0x3d080d[_0x5e66('0x53')],function(_0x3b6080){_0x3b6080[_0x5e66('0x5a')]=_0x3d080d[_0x5e66('0x54')]['id'];return _0x3b6080;});return db[_0x5e66('0x62')][_0x5e66('0x9b')](_0x114a3a,{'transaction':_0x325d09});});})[_0x5e66('0x1b')](function(){return db[_0x5e66('0x62')][_0x5e66('0x9c')]({'where':{'SmsAccountId':_0x3d080d[_0x5e66('0x54')]['id']},'order':_0x5e66('0x9d')});});}})['then'](respondWithResult(_0x37e0ae,null))[_0x5e66('0x25')](handleError(_0x37e0ae,null));};exports[_0x5e66('0x9e')]=function(_0x42e130,_0x47ce3a,_0x24ff9b){var _0x39d512={};var _0x41a42a={};var _0x11a03e;var _0x34a232;return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x42e130[_0x5e66('0x54')]['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x47ce3a,null))[_0x5e66('0x1b')](function(_0x4725bc){if(_0x4725bc){_0x11a03e=_0x4725bc;_0x41a42a[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0x62')][_0x5e66('0x35')]);_0x41a42a[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x42e130[_0x5e66('0x38')]);_0x41a42a[_0x5e66('0x43')]=_[_0x5e66('0x3a')](_0x41a42a[_0x5e66('0x36')],_0x41a42a[_0x5e66('0x38')]);_0x39d512[_0x5e66('0x3b')]=_['intersection'](_0x41a42a[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x42e130[_0x5e66('0x38')][_0x5e66('0x50')]));_0x39d512[_0x5e66('0x3b')]=_0x39d512[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x39d512[_0x5e66('0x3b')]:_0x41a42a[_0x5e66('0x36')];_0x39d512[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x42e130['query']['sort']);_0x39d512[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_[_0x5e66('0x42')](_0x42e130[_0x5e66('0x38')],_0x41a42a['filters']));if(_0x42e130[_0x5e66('0x38')]['filter']){_0x39d512[_0x5e66('0x41')]=_['merge'](_0x39d512[_0x5e66('0x41')],{'$or':_[_0x5e66('0x49')](_0x39d512[_0x5e66('0x3b')],function(_0x5b7fe0){var _0x761582={};_0x761582[_0x5b7fe0]={'$like':'%'+_0x42e130[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x761582;})});}_0x39d512=_[_0x5e66('0x47')]({},_0x39d512,_0x42e130['options']);return _0x11a03e[_0x5e66('0x9e')](_0x39d512);}})[_0x5e66('0x1b')](function(_0x1f6f72){if(_0x1f6f72){_0x34a232=_0x1f6f72[_0x5e66('0x3c')];if(!_0x42e130[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x39d512[_0x5e66('0x2a')]=qs['limit'](_0x42e130[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x39d512[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x42e130['query'][_0x5e66('0x29')]);}return _0x11a03e['getApplications'](_0x39d512);}})[_0x5e66('0x1b')](function(_0x1c1b6c){if(_0x1c1b6c){return _0x1c1b6c?{'count':_0x34a232,'rows':_0x1c1b6c}:null;}})[_0x5e66('0x1b')](respondWithResult(_0x47ce3a,null))[_0x5e66('0x25')](handleError(_0x47ce3a,null));};exports[_0x5e66('0x9f')]=function(_0x4988e7,_0x3efd24,_0x1d43ae){var _0x1f937f={'raw':![],'where':{}};var _0x41d460={};var _0x19e10a={'count':0x0,'rows':[]};return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x4988e7[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x3efd24,null))['then'](function(_0x3a579f){if(_0x3a579f){_0x41d460[_0x5e66('0x36')]=_[_0x5e66('0x39')](db['SmsInteraction'][_0x5e66('0x35')]);_0x41d460['query']=_['keys'](_0x4988e7[_0x5e66('0x38')]);_0x41d460['filters']=_['intersection'](_0x41d460[_0x5e66('0x36')],_0x41d460[_0x5e66('0x38')]);_0x1f937f[_0x5e66('0x3b')]=_['intersection'](_0x41d460[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x4988e7[_0x5e66('0x38')]['fields']));_0x1f937f[_0x5e66('0x3b')]=_0x1f937f[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x1f937f[_0x5e66('0x3b')]:_0x41d460[_0x5e66('0x36')];if(!_0x4988e7[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x1f937f[_0x5e66('0x2a')]=qs['limit'](_0x4988e7[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x1f937f[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x4988e7[_0x5e66('0x38')][_0x5e66('0x29')]);}_0x1f937f[_0x5e66('0x3f')]=qs[_0x5e66('0x40')](_0x4988e7['query'][_0x5e66('0x40')]);_0x1f937f[_0x5e66('0x41')]=qs[_0x5e66('0x43')](_['pick'](_0x4988e7['query'],_0x41d460[_0x5e66('0x43')]));_0x1f937f[_0x5e66('0x41')]['SmsAccountId']=_0x3a579f['id'];if(_0x4988e7[_0x5e66('0x38')]['filter']){_0x1f937f[_0x5e66('0x41')]=_['merge'](_0x1f937f['where'],{'$or':_['map'](_0x1f937f['attributes'],function(_0x289c9e){var _0x524a1f={};_0x524a1f[_0x289c9e]={'$like':'%'+_0x4988e7[_0x5e66('0x38')]['filter']+'%'};return _0x524a1f;})});}_0x1f937f=_[_0x5e66('0x47')]({},_0x1f937f,_0x4988e7[_0x5e66('0x4a')]);return db[_0x5e66('0x85')]['count']({'where':_0x1f937f[_0x5e66('0x41')]})[_0x5e66('0x1b')](function(_0x239919){_0x19e10a[_0x5e66('0x28')]=_0x239919;if(_0x4988e7['query'][_0x5e66('0x4b')]){_0x1f937f['include']=[{'model':db[_0x5e66('0x83')],'as':_0x5e66('0xa0'),'required':![]},{'model':db[_0x5e66('0xa1')],'as':_0x5e66('0xa2'),'attributes':[_0x5e66('0x33'),_0x5e66('0xa3'),_0x5e66('0xa4')],'required':![]},{'model':db[_0x5e66('0xa5')],'as':'Tags','attributes':['id',_0x5e66('0x33'),_0x5e66('0xa6')],'where':_0x4988e7[_0x5e66('0x38')][_0x5e66('0xa7')]?{'id':_0x4988e7[_0x5e66('0x38')][_0x5e66('0xa7')]}:undefined,'required':_0x4988e7[_0x5e66('0x38')]['tag']?!![]:![]}];}return db[_0x5e66('0x85')][_0x5e66('0x4d')](_0x1f937f);})[_0x5e66('0x1b')](function(_0x4d6883){_0x19e10a[_0x5e66('0x4e')]=_0x4d6883;return _0x19e10a;});}})[_0x5e66('0x1b')](respondWithFilteredResult(_0x3efd24,_0x1f937f))[_0x5e66('0x25')](handleError(_0x3efd24,null));};exports[_0x5e66('0x98')]=function(_0x43f6b4,_0x1ae70c,_0xcf5d52){var _0x19e077,_0xbf2172,_0x746a9e;if(_[_0x5e66('0x78')](_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')])||_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')]===''){throw new db['Sequelize'][(_0x5e66('0x69'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5e66('0x78')](_0x43f6b4['body']['to'])){throw new db[(_0x5e66('0x68'))][(_0x5e66('0x69'))](_0x5e66('0xa8'));}_0x19e077=_0x43f6b4['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x43f6b4[_0x5e66('0x54')]['id']},'include':[{'model':db[_0x5e66('0xa9')],'as':'List','include':[{'model':db['CmContact'],'as':_0x5e66('0x80'),'where':{'mobile':_0x19e077},'limit':0x1,'order':[[_0x5e66('0x6d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1ae70c,null))[_0x5e66('0x1b')](function(_0x1f0386){if(_0x1f0386&&_0x1f0386[_0x5e66('0xaa')]){_0xbf2172=_0x1f0386['get']({'plain':!![]});if(_0xbf2172[_0x5e66('0xaa')]&&_0xbf2172[_0x5e66('0xaa')]['Contacts'][_0x5e66('0x3c')]){return _0xbf2172['List']['Contacts'][0x0];}return db['CmContact'][_0x5e66('0x52')](_['defaults'](_0x43f6b4[_0x5e66('0x53')],{'firstName':_0x19e077,'mobile':_0x19e077,'phone':_0x19e077,'ListId':_0xbf2172['ListId']}));}})[_0x5e66('0x1b')](handleEntityNotFound(_0x1ae70c,null))[_0x5e66('0x1b')](function(_0x3da66b){if(_0x3da66b){_0x746a9e=_0x3da66b;return db[_0x5e66('0x85')][_0x5e66('0x51')]({'where':{'ContactId':_0x746a9e['id'],'closed':![],'SmsAccountId':_0xbf2172['id']}})[_0x5e66('0x1b')](function(_0x185a25){if(_0x185a25){return[_0x185a25,![]];}return db[_0x5e66('0x85')]['create']({'UserId':_0x43f6b4['user']['id'],'ContactId':_0x746a9e['id'],'SmsAccountId':_0xbf2172['id'],'phone':_0x19e077,'firstMsgDirection':'out','Messages':[_[_0x5e66('0x47')](_0x43f6b4[_0x5e66('0x53')],{'read':![],'body':_0x43f6b4['body'][_0x5e66('0x53')],'phone':_0x19e077,'SmsAccountId':_0xbf2172['id'],'UserId':_0x43f6b4[_0x5e66('0xab')]['id'],'ContactId':_0x746a9e['id']})]},{'include':[{'model':db[_0x5e66('0x8a')],'as':_0x5e66('0xac')}]})[_0x5e66('0x1b')](function(_0x249c2b){return[_0x249c2b,!![]];});});}})['spread'](function(_0x587f70,_0x313d9f){if(_0x313d9f){return _0x587f70;}return db[_0x5e66('0x8a')][_0x5e66('0x52')](_[_0x5e66('0x47')](_0x43f6b4[_0x5e66('0x53')],{'read':![],'body':_0x43f6b4[_0x5e66('0x53')][_0x5e66('0x53')],'phone':_0x19e077,'SmsAccountId':_0xbf2172['id'],'SmsInteractionId':_0x587f70['id'],'UserId':_0x43f6b4['user']['id'],'ContactId':_0x746a9e['id']}))[_0x5e66('0x1b')](function(_0x220e62){_0x587f70[_0x5e66('0xad')]['Messages']=[];_0x587f70['dataValues'][_0x5e66('0xac')][_0x5e66('0x88')](_0x220e62['dataValues']);return _0x587f70;});})[_0x5e66('0x1b')](respondWithResult(_0x1ae70c,null))[_0x5e66('0x25')](handleError(_0x1ae70c,null));};exports['status']=function(_0x155ee3,_0x273b1a,_0x1190f4){if(_0x155ee3[_0x5e66('0x53')]['id']){delete _0x155ee3['body']['id'];}var _0x17b891,_0x2c3cc3,_0x400cfc;return db['SmsAccount'][_0x5e66('0x51')]({'where':{'id':_0x155ee3['params']['id']}})['then'](handleEntityNotFound(_0x273b1a,null))[_0x5e66('0x1b')](function(_0x478018){if(_0x478018){_0x400cfc=_0x478018;logger[_0x5e66('0x1f')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0xae'),_0x478018[_0x5e66('0x6f')],util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));switch(_0x478018['type']){case'skebby':if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb0')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0x26')]){_0x2c3cc3=_0x155ee3[_0x5e66('0x53')]['status'];return db[_0x5e66('0x8a')][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb0')]}});}break;case'connectel':if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb1')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb2')]){_0x2c3cc3=_0x155ee3['body'][_0x5e66('0xb2')];return db['SmsMessage'][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')]['requestid']}});}break;case _0x5e66('0x75'):if(_0x155ee3[_0x5e66('0x53')][_0x5e66('0x76')]&&_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb3')]){_0x2c3cc3=_0x155ee3[_0x5e66('0x53')]['status_code'];return db['SmsMessage'][_0x5e66('0x51')]({'where':{'messageId':_0x155ee3[_0x5e66('0x53')][_0x5e66('0x76')]}});}break;}}})['then'](handleEntityNotFound(_0x273b1a,null))[_0x5e66('0x1b')](function(_0x5c7b1f){if(_0x5c7b1f){_0x17b891=_0x5c7b1f;switch(_0x400cfc[_0x5e66('0x6f')]){case _0x5e66('0x73'):if(_0x2c3cc3===_0x5e66('0xb4')){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger['error'](_0x5e66('0x20'),'status',_0x5e66('0x73'),util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));}break;case _0x5e66('0xb5'):if(_0x2c3cc3==='1'){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger[_0x5e66('0x22')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0x73'),util[_0x5e66('0xaf')](_0x155ee3[_0x5e66('0x53')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x155ee3[_0x5e66('0x53')][_0x5e66('0xb6')]&&_0x2c3cc3>=0xc8&&_0x2c3cc3<=0xce){return _0x17b891[_0x5e66('0x30')]({'read':!![]});}else{logger[_0x5e66('0x22')](_0x5e66('0x20'),_0x5e66('0x26'),_0x5e66('0x75'),util['inspect'](_0x155ee3['body'],{'showHidden':![],'depth':null}));}break;}return _0x17b891;}})[_0x5e66('0x1b')](respondWithResult(_0x273b1a,null))[_0x5e66('0x25')](handleError(_0x273b1a,null));};exports[_0x5e66('0xb7')]=function(_0x531d0a,_0x587fea,_0x5ab71c){return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x531d0a['params']['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x587fea,null))[_0x5e66('0x1b')](function(_0x5d85ca){if(_0x5d85ca){return _0x5d85ca[_0x5e66('0xb7')](_0x531d0a['body'][_0x5e66('0x5c')],_[_0x5e66('0x81')](_0x531d0a[_0x5e66('0x53')],[_0x5e66('0x5c'),'id'])||{})[_0x5e66('0xb8')](function(_0x53049f){for(var _0x537aa7=0x0;_0x537aa7<_0x531d0a['body'][_0x5e66('0x5c')][_0x5e66('0x3c')];_0x537aa7+=0x1){socket['emit']('userSmsAccount:save',{'UserId':_0x531d0a['body'][_0x5e66('0x5c')][_0x537aa7],'SmsAccountId':_0x531d0a[_0x5e66('0x54')]['id']});}return _0x53049f;});}})['then'](respondWithResult(_0x587fea,null))[_0x5e66('0x25')](handleError(_0x587fea,null));};exports['removeAgents']=function(_0x4d9fa5,_0x11088a,_0x1d53b3){var _0x2036a6;return db[_0x5e66('0x34')][_0x5e66('0x51')]({'where':{'id':_0x4d9fa5['params']['id']}})[_0x5e66('0x1b')](handleEntityNotFound(_0x11088a,null))[_0x5e66('0x1b')](function(_0x4e94c3){if(_0x4e94c3){return _0x4e94c3[_0x5e66('0xb9')](_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')])[_0x5e66('0x1b')](function(_0x575da2){if(_['isArray'](_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')])){for(var _0x5135f7=0x0;_0x5135f7<_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')][_0x5e66('0x3c')];_0x5135f7+=0x1){socket[_0x5e66('0xba')](_0x5e66('0xbb'),{'UserId':_0x4d9fa5[_0x5e66('0x38')]['ids'][_0x5135f7],'SmsAccountId':_0x4d9fa5[_0x5e66('0x54')]['id']});}}else{socket[_0x5e66('0xba')]('userSmsAccount:remove',{'UserId':_0x4d9fa5[_0x5e66('0x38')][_0x5e66('0x5c')],'SmsAccountId':_0x4d9fa5['params']['id']});}});}})['then'](respondWithStatusCode(_0x11088a,null))[_0x5e66('0x25')](handleError(_0x11088a,null));};exports[_0x5e66('0xbc')]=function(_0x518d48,_0x4aea9d,_0x527329){var _0x52779f={};var _0x3f3918={};var _0x45295f;var _0x484557;return db[_0x5e66('0x34')][_0x5e66('0x58')]({'where':{'id':_0x518d48[_0x5e66('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aea9d,null))[_0x5e66('0x1b')](function(_0x34e11e){if(_0x34e11e){_0x45295f=_0x34e11e;_0x3f3918[_0x5e66('0x36')]=_[_0x5e66('0x39')](db[_0x5e66('0xa1')]['rawAttributes']);_0x3f3918[_0x5e66('0x38')]=_[_0x5e66('0x39')](_0x518d48[_0x5e66('0x38')]);_0x3f3918[_0x5e66('0x43')]=_['intersection'](_0x3f3918[_0x5e66('0x36')],_0x3f3918['query']);_0x52779f[_0x5e66('0x3b')]=_[_0x5e66('0x3a')](_0x3f3918[_0x5e66('0x36')],qs[_0x5e66('0x50')](_0x518d48[_0x5e66('0x38')]['fields']));_0x52779f['attributes']=_0x52779f[_0x5e66('0x3b')][_0x5e66('0x3c')]?_0x52779f[_0x5e66('0x3b')]:_0x3f3918['model'];_0x52779f['order']=qs[_0x5e66('0x40')](_0x518d48[_0x5e66('0x38')]['sort']);_0x52779f[_0x5e66('0x41')]=qs['filters'](_[_0x5e66('0x42')](_0x518d48[_0x5e66('0x38')],_0x3f3918[_0x5e66('0x43')]));if(_0x518d48[_0x5e66('0x38')][_0x5e66('0x48')]){_0x52779f[_0x5e66('0x41')]=_[_0x5e66('0x47')](_0x52779f[_0x5e66('0x41')],{'$or':_['map'](_0x52779f[_0x5e66('0x3b')],function(_0x2f1d48){var _0x38b539={};_0x38b539[_0x2f1d48]={'$like':'%'+_0x518d48[_0x5e66('0x38')][_0x5e66('0x48')]+'%'};return _0x38b539;})});}_0x52779f=_[_0x5e66('0x47')]({},_0x52779f,_0x518d48[_0x5e66('0x4a')]);return _0x45295f[_0x5e66('0xbc')](_0x52779f);}})['then'](function(_0x54d88a){if(_0x54d88a){_0x484557=_0x54d88a[_0x5e66('0x3c')];if(!_0x518d48[_0x5e66('0x38')][_0x5e66('0x3d')](_0x5e66('0x3e'))){_0x52779f[_0x5e66('0x2a')]=qs['limit'](_0x518d48[_0x5e66('0x38')][_0x5e66('0x2a')]);_0x52779f[_0x5e66('0x29')]=qs[_0x5e66('0x29')](_0x518d48[_0x5e66('0x38')][_0x5e66('0x29')]);}return _0x45295f['getAgents'](_0x52779f);}})[_0x5e66('0x1b')](function(_0x1f8155){if(_0x1f8155){return _0x1f8155?{'count':_0x484557,'rows':_0x1f8155}:null;}})[_0x5e66('0x1b')](respondWithResult(_0x4aea9d,null))[_0x5e66('0x25')](handleError(_0x4aea9d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 134e5aa..3e810ce 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 _0x4e86=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','SmsAccount'];(function(_0x37657b,_0x4e3ee4){var _0x1e1394=function(_0x456518){while(--_0x456518){_0x37657b['push'](_0x37657b['shift']());}};_0x1e1394(++_0x4e3ee4);}(_0x4e86,0x94));var _0x64e8=function(_0x175296,_0x22773b){_0x175296=_0x175296-0x0;var _0x1ee423=_0x4e86[_0x175296];return _0x1ee423;};'use strict';var EventEmitter=require(_0x64e8('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x64e8('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x64e8('0x2')](0x0);var events={'afterCreate':_0x64e8('0x3'),'afterUpdate':_0x64e8('0x4'),'afterDestroy':_0x64e8('0x5')};function emitEvent(_0x4dc50a){return function(_0x3082de,_0x5372dc,_0x5e40f8){SmsAccountEvents[_0x64e8('0x6')](_0x4dc50a+':'+_0x3082de['id'],_0x3082de);SmsAccountEvents['emit'](_0x4dc50a,_0x3082de);_0x5e40f8(null);};}for(var e in events){if(events[_0x64e8('0x7')](e)){var event=events[e];SmsAccount[_0x64e8('0x8')](e,emitEvent(event));}}module[_0x64e8('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x2c81=['hook','exports','SmsAccount','save','update','emit','hasOwnProperty'];(function(_0x5a051b,_0x13d2aa){var _0x16f3c9=function(_0x2df679){while(--_0x2df679){_0x5a051b['push'](_0x5a051b['shift']());}};_0x16f3c9(++_0x13d2aa);}(_0x2c81,0xbf));var _0x12c8=function(_0x2e38c9,_0x54109b){_0x2e38c9=_0x2e38c9-0x0;var _0x7c3dc0=_0x2c81[_0x2e38c9];return _0x7c3dc0;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db'][_0x12c8('0x0')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x12c8('0x1'),'afterUpdate':_0x12c8('0x2'),'afterDestroy':'remove'};function emitEvent(_0xa9fc9c){return function(_0x1858cf,_0x48383c,_0x2abe4e){SmsAccountEvents[_0x12c8('0x3')](_0xa9fc9c+':'+_0x1858cf['id'],_0x1858cf);SmsAccountEvents['emit'](_0xa9fc9c,_0x1858cf);_0x2abe4e(null);};}for(var e in events){if(events[_0x12c8('0x4')](e)){var event=events[e];SmsAccount[_0x12c8('0x5')](e,emitEvent(event));}}module[_0x12c8('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index a28d2ec..56f790c 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 _0x9354=['bluebird','request-promise','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','../../config/logger','moment'];(function(_0x553ac2,_0x156cf0){var _0x2182d8=function(_0x594e0f){while(--_0x594e0f){_0x553ac2['push'](_0x553ac2['shift']());}};_0x2182d8(++_0x156cf0);}(_0x9354,0x96));var _0x4935=function(_0x37756b,_0x24db76){_0x37756b=_0x37756b-0x0;var _0x46efec=_0x9354[_0x37756b];return _0x46efec;};'use strict';var _=require('lodash');var util=require(_0x4935('0x0'));var logger=require(_0x4935('0x1'))('api');var moment=require(_0x4935('0x2'));var BPromise=require(_0x4935('0x3'));var rp=require(_0x4935('0x4'));var attributes=require(_0x4935('0x5'));module['exports']=function(_0x46c7f9,_0x2d509b){return _0x46c7f9[_0x4935('0x6')](_0x4935('0x7'),attributes,{'tableName':_0x4935('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x380a=['lodash','util','../../config/logger','moment','./smsAccount.attributes','define','SmsAccount'];(function(_0x336972,_0x1a4f73){var _0x39e226=function(_0x1a016c){while(--_0x1a016c){_0x336972['push'](_0x336972['shift']());}};_0x39e226(++_0x1a4f73);}(_0x380a,0x16c));var _0xa380=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0x380a[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0xa380('0x0'));var util=require(_0xa380('0x1'));var logger=require(_0xa380('0x2'))('api');var moment=require(_0xa380('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xa380('0x4'));module['exports']=function(_0x57953d,_0xf00c9a){return _0x57953d[_0xa380('0x5')](_0xa380('0x6'),attributes,{'tableName':'sms_accounts','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 42d9036..68decc7 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 _0x630b=['debug','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','include','model'];(function(_0x57e390,_0x7efc22){var _0x485260=function(_0x1cffeb){while(--_0x1cffeb){_0x57e390['push'](_0x57e390['shift']());}};_0x485260(++_0x7efc22);}(_0x630b,0x85));var _0xb630=function(_0x3afc10,_0x137b04){_0x3afc10=_0x3afc10-0x0;var _0xec688=_0x630b[_0x3afc10];return _0xec688;};'use strict';var _=require(_0xb630('0x0'));var util=require(_0xb630('0x1'));var moment=require(_0xb630('0x2'));var BPromise=require('bluebird');var rs=require(_0xb630('0x3'));var fs=require('fs');var db=require(_0xb630('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb630('0x5'));var jayson=require(_0xb630('0x6'));var client=jayson['client'][_0xb630('0x7')]({'port':0x232a});var socket=require(_0xb630('0x8'))({'host':_0xb630('0x9'),'port':0x18eb});require('./smsAccount.socket')[_0xb630('0xa')](socket);function respondWithRpcPromise(_0x3e827d,_0x1da999,_0x1bdb89){return new BPromise(function(_0x15f639,_0x537597){return client['request'](_0x3e827d,_0x1bdb89)[_0xb630('0xb')](function(_0x809c80){logger[_0xb630('0xc')](_0xb630('0xd'),_0x1da999,_0xb630('0xe'));logger['debug'](_0xb630('0xf'),_0x1da999,_0xb630('0xe'),JSON[_0xb630('0x10')](_0x809c80));if(_0x809c80[_0xb630('0x11')]){if(_0x809c80[_0xb630('0x11')][_0xb630('0x12')]===0x1f4){logger['error'](_0xb630('0xd'),_0x1da999,_0x809c80[_0xb630('0x11')]['message']);return _0x537597(_0x809c80[_0xb630('0x11')][_0xb630('0x13')]);}logger[_0xb630('0x11')](_0xb630('0xd'),_0x1da999,_0x809c80[_0xb630('0x11')][_0xb630('0x13')]);return _0x15f639(_0x809c80[_0xb630('0x11')][_0xb630('0x13')]);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x1da999,_0xb630('0xe'));_0x15f639(_0x809c80[_0xb630('0x14')][_0xb630('0x13')]);}})[_0xb630('0x15')](function(_0x112593){logger['error'](_0xb630('0xd'),_0x1da999,_0x112593);_0x537597(_0x112593);});});}exports[_0xb630('0x16')]=function(_0x2c9097){var _0x1e4ffd=this;return new Promise(function(_0x36bb00,_0xf6d80a){return db[_0xb630('0x17')][_0xb630('0x18')]({'raw':_0x2c9097[_0xb630('0x19')]?_0x2c9097[_0xb630('0x19')][_0xb630('0x1a')]===undefined?!![]:![]:!![],'where':_0x2c9097['options']?_0x2c9097[_0xb630('0x19')][_0xb630('0x1b')]||null:null,'attributes':_0x2c9097[_0xb630('0x19')]?_0x2c9097[_0xb630('0x19')][_0xb630('0x1c')]||null:null,'include':_0x2c9097['options']?_0x2c9097[_0xb630('0x19')]['include']?_[_0xb630('0x1d')](_0x2c9097[_0xb630('0x19')][_0xb630('0x1e')],function(_0x1a6794){return{'model':db[_0x1a6794[_0xb630('0x1f')]],'as':_0x1a6794['as'],'attributes':_0x1a6794[_0xb630('0x1c')],'include':_0x1a6794[_0xb630('0x1e')]?_['map'](_0x1a6794[_0xb630('0x1e')],function(_0x31c1b9){return{'model':db[_0x31c1b9[_0xb630('0x1f')]],'as':_0x31c1b9['as'],'attributes':_0x31c1b9['attributes'],'include':_0x31c1b9['include']?_[_0xb630('0x1d')](_0x31c1b9['include'],function(_0x20f008){return{'model':db[_0x20f008['model']],'as':_0x20f008['as'],'attributes':_0x20f008[_0xb630('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e8e52){logger['info'](_0xb630('0x16'),_0x2c9097);logger[_0xb630('0x20')]('ShowSmsAccount',_0x2c9097,JSON[_0xb630('0x10')](_0x3e8e52));_0x36bb00(_0x3e8e52);})[_0xb630('0x15')](function(_0x25ff00){logger[_0xb630('0x11')](_0xb630('0x16'),_0x25ff00[_0xb630('0x13')],_0x2c9097);_0xf6d80a(_0x1e4ffd[_0xb630('0x11')](0x1f4,_0x25ff00['message']));});});}; \ No newline at end of file +var _0xd3f5=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','include','model','attributes','map','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','localhost','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xd3f5,0xd0));var _0x5d3f=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xd3f5[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x5d3f('0x0'));var util=require(_0x5d3f('0x1'));var moment=require(_0x5d3f('0x2'));var BPromise=require(_0x5d3f('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5d3f('0x4'))(_0x5d3f('0x5'));var config=require(_0x5d3f('0x6'));var jayson=require(_0x5d3f('0x7'));var client=jayson['client']['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x5d3f('0x8'),'port':0x18eb});require('./smsAccount.socket')[_0x5d3f('0x9')](socket);function respondWithRpcPromise(_0xaa0b8,_0x3fa4a1,_0x2ed9b2){return new BPromise(function(_0x4d67c8,_0x286085){return client[_0x5d3f('0xa')](_0xaa0b8,_0x2ed9b2)[_0x5d3f('0xb')](function(_0xa8499c){logger[_0x5d3f('0xc')](_0x5d3f('0xd'),_0x3fa4a1,_0x5d3f('0xe'));logger[_0x5d3f('0xf')](_0x5d3f('0x10'),_0x3fa4a1,'request\x20sent',JSON[_0x5d3f('0x11')](_0xa8499c));if(_0xa8499c[_0x5d3f('0x12')]){if(_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x13')]===0x1f4){logger[_0x5d3f('0x12')]('SmsAccount,\x20%s,\x20%s',_0x3fa4a1,_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x14')]);return _0x286085(_0xa8499c[_0x5d3f('0x12')][_0x5d3f('0x14')]);}logger[_0x5d3f('0x12')](_0x5d3f('0xd'),_0x3fa4a1,_0xa8499c['error']['message']);return _0x4d67c8(_0xa8499c['error'][_0x5d3f('0x14')]);}else{logger[_0x5d3f('0xc')](_0x5d3f('0xd'),_0x3fa4a1,'request\x20sent');_0x4d67c8(_0xa8499c[_0x5d3f('0x15')][_0x5d3f('0x14')]);}})[_0x5d3f('0x16')](function(_0x1ea782){logger[_0x5d3f('0x12')](_0x5d3f('0xd'),_0x3fa4a1,_0x1ea782);_0x286085(_0x1ea782);});});}exports[_0x5d3f('0x17')]=function(_0x35d9ed){var _0x46f2cb=this;return new Promise(function(_0x3fb2d6,_0x5ac12a){return db[_0x5d3f('0x18')][_0x5d3f('0x19')]({'raw':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')][_0x5d3f('0x1b')]||null:null,'attributes':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed[_0x5d3f('0x1a')]['attributes']||null:null,'include':_0x35d9ed[_0x5d3f('0x1a')]?_0x35d9ed['options'][_0x5d3f('0x1c')]?_['map'](_0x35d9ed[_0x5d3f('0x1a')]['include'],function(_0x1eed39){return{'model':db[_0x1eed39[_0x5d3f('0x1d')]],'as':_0x1eed39['as'],'attributes':_0x1eed39[_0x5d3f('0x1e')],'include':_0x1eed39['include']?_[_0x5d3f('0x1f')](_0x1eed39['include'],function(_0x235571){return{'model':db[_0x235571[_0x5d3f('0x1d')]],'as':_0x235571['as'],'attributes':_0x235571[_0x5d3f('0x1e')],'include':_0x235571[_0x5d3f('0x1c')]?_[_0x5d3f('0x1f')](_0x235571[_0x5d3f('0x1c')],function(_0x1bb051){return{'model':db[_0x1bb051[_0x5d3f('0x1d')]],'as':_0x1bb051['as'],'attributes':_0x1bb051[_0x5d3f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5d3f('0xb')](function(_0x359109){logger['info'](_0x5d3f('0x17'),_0x35d9ed);logger[_0x5d3f('0xf')]('ShowSmsAccount',_0x35d9ed,JSON['stringify'](_0x359109));_0x3fb2d6(_0x359109);})[_0x5d3f('0x16')](function(_0x5e35f3){logger[_0x5d3f('0x12')](_0x5d3f('0x17'),_0x5e35f3[_0x5d3f('0x14')],_0x35d9ed);_0x5ac12a(_0x46f2cb[_0x5d3f('0x12')](0x1f4,_0x5e35f3[_0x5d3f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 952739e..b3506e7 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 _0xfd87=['./smsAccount.events','emit','removeListener','length','smsAccount:'];(function(_0x3632a6,_0x35998d){var _0x3438cb=function(_0x34a6a8){while(--_0x34a6a8){_0x3632a6['push'](_0x3632a6['shift']());}};_0x3438cb(++_0x35998d);}(_0xfd87,0xcd));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var SmsAccountEvents=require(_0x7fd8('0x0'));var events=['save','remove','update'];function createListener(_0x122e4c,_0x541ade){return function(_0x9350d0){_0x541ade[_0x7fd8('0x1')](_0x122e4c,_0x9350d0);};}function removeListener(_0x33e2cc,_0xae6254){return function(){SmsAccountEvents[_0x7fd8('0x2')](_0x33e2cc,_0xae6254);};}exports['register']=function(_0x5114ee){for(var _0x1f6aa4=0x0,_0x518660=events[_0x7fd8('0x3')];_0x1f6aa4<_0x518660;_0x1f6aa4++){var _0x22d6e3=events[_0x1f6aa4];var _0x58bc1d=createListener(_0x7fd8('0x4')+_0x22d6e3,_0x5114ee);SmsAccountEvents['on'](_0x22d6e3,_0x58bc1d);}}; \ No newline at end of file +var _0x8c66=['./smsAccount.events','save','update','removeListener','register','smsAccount:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c66,0x78));var _0x68c6=function(_0x312428,_0x458f28){_0x312428=_0x312428-0x0;var _0x583514=_0x8c66[_0x312428];return _0x583514;};'use strict';var SmsAccountEvents=require(_0x68c6('0x0'));var events=[_0x68c6('0x1'),'remove',_0x68c6('0x2')];function createListener(_0x3a0e1f,_0x1de682){return function(_0x3f8076){_0x1de682['emit'](_0x3a0e1f,_0x3f8076);};}function removeListener(_0x5a99ae,_0x3e074a){return function(){SmsAccountEvents[_0x68c6('0x3')](_0x5a99ae,_0x3e074a);};}exports[_0x68c6('0x4')]=function(_0x2e06aa){for(var _0x7db558=0x0,_0x32b3ca=events['length'];_0x7db558<_0x32b3ca;_0x7db558++){var _0x2d3484=events[_0x7db558];var _0x1182ca=createListener(_0x68c6('0x5')+_0x2d3484,_0x2e06aa);SmsAccountEvents['on'](_0x2d3484,_0x1182ca);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index a07110c..b8d74ee 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 _0xc5fe=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','multer','util'];(function(_0x5b29ef,_0x4000a6){var _0x1e13cd=function(_0x52f299){while(--_0x52f299){_0x5b29ef['push'](_0x5b29ef['shift']());}};_0x1e13cd(++_0x4000a6);}(_0xc5fe,0x1cf));var _0xec5f=function(_0x48f392,_0x4bbef4){_0x48f392=_0x48f392-0x0;var _0x19c1e3=_0xc5fe[_0x48f392];return _0x19c1e3;};'use strict';var multer=require(_0xec5f('0x0'));var util=require(_0xec5f('0x1'));var path=require(_0xec5f('0x2'));var express=require(_0xec5f('0x3'));var router=express[_0xec5f('0x4')]();var auth=require(_0xec5f('0x5'));var interaction=require(_0xec5f('0x6'));var config=require(_0xec5f('0x7'));var controller=require('./smsApplication.controller');router[_0xec5f('0x8')]('/',auth[_0xec5f('0x9')](),controller[_0xec5f('0xa')]);router[_0xec5f('0x8')](_0xec5f('0xb'),auth[_0xec5f('0x9')](),controller[_0xec5f('0xc')]);router[_0xec5f('0xd')]('/',auth[_0xec5f('0x9')](),controller['create']);router[_0xec5f('0xe')](_0xec5f('0xb'),auth[_0xec5f('0x9')](),controller['update']);router['delete'](_0xec5f('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xda66=['./smsApplication.controller','isAuthenticated','get','/:id','show','post','create','put','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4c0e5c,_0x32eb6a){var _0x5eceb3=function(_0x2a9bcf){while(--_0x2a9bcf){_0x4c0e5c['push'](_0x4c0e5c['shift']());}};_0x5eceb3(++_0x32eb6a);}(_0xda66,0xfa));var _0x6da6=function(_0x54b2b0,_0x55f332){_0x54b2b0=_0x54b2b0-0x0;var _0x1a0d6b=_0xda66[_0x54b2b0];return _0x1a0d6b;};'use strict';var multer=require('multer');var util=require(_0x6da6('0x0'));var path=require(_0x6da6('0x1'));var express=require('express');var router=express[_0x6da6('0x2')]();var auth=require(_0x6da6('0x3'));var interaction=require(_0x6da6('0x4'));var config=require(_0x6da6('0x5'));var controller=require(_0x6da6('0x6'));router['get']('/',auth[_0x6da6('0x7')](),controller['index']);router[_0x6da6('0x8')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller[_0x6da6('0xa')]);router[_0x6da6('0xb')]('/',auth['isAuthenticated'](),controller[_0x6da6('0xc')]);router[_0x6da6('0xd')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller['update']);router[_0x6da6('0xe')](_0x6da6('0x9'),auth[_0x6da6('0x7')](),controller['destroy']);module[_0x6da6('0xf')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index f665de6..dc980f6 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 _0x9859=['exports','INTEGER','STRING'];(function(_0x8410c8,_0xf98188){var _0x11863b=function(_0x5ce0e2){while(--_0x5ce0e2){_0x8410c8['push'](_0x8410c8['shift']());}};_0x11863b(++_0xf98188);}(_0x9859,0x13e));var _0x9985=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x9859[_0x1da527];return _0x40fc7c;};'use strict';var Sequelize=require('sequelize');module[_0x9985('0x0')]={'priority':{'type':Sequelize[_0x9985('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9985('0x2')](0x1000),'defaultValue':''},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9985('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xca27=['noop','*,*,*,*','exports','STRING'];(function(_0x5e4b85,_0x6cf965){var _0x5cd3cb=function(_0x589c9e){while(--_0x589c9e){_0x5e4b85['push'](_0x5e4b85['shift']());}};_0x5cd3cb(++_0x6cf965);}(_0xca27,0xde));var _0x7ca2=function(_0x58f7a9,_0x1a759f){_0x58f7a9=_0x58f7a9-0x0;var _0x270bee=_0xca27[_0x58f7a9];return _0x270bee;};'use strict';var Sequelize=require('sequelize');module[_0x7ca2('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7ca2('0x1')],'allowNull':![],'defaultValue':_0x7ca2('0x2')},'appdata':{'type':Sequelize[_0x7ca2('0x1')](0x1000),'defaultValue':''},'description':{'type':Sequelize[_0x7ca2('0x1')]},'interval':{'type':Sequelize[_0x7ca2('0x1')],'defaultValue':_0x7ca2('0x3')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 87763c9..b519f5f 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 _0xf6ca=['merge','where','filter','options','includeAll','include','findAll','rows','catch','show','params','SmsApplication','find','create','body','destroy','fast-json-patch','request-promise','moment','mustache','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','set','apply','reject','save','update','then','end','error','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','nolimit','limit','offset','sort','pick','day','add'];(function(_0xbf4920,_0x27d180){var _0x5861e4=function(_0x4355b8){while(--_0x4355b8){_0xbf4920['push'](_0xbf4920['shift']());}};_0x5861e4(++_0x27d180);}(_0xf6ca,0x15a));var _0xaf6c=function(_0x51e3db,_0x483e38){_0x51e3db=_0x51e3db-0x0;var _0x3f3a11=_0xf6ca[_0x51e3db];return _0x3f3a11;};'use strict';var jsonpatch=require(_0xaf6c('0x0'));var rp=require(_0xaf6c('0x1'));var moment=require(_0xaf6c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaf6c('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaf6c('0x4'));var fs=require('fs');var _=require(_0xaf6c('0x5'));var squel=require(_0xaf6c('0x6'));var crypto=require(_0xaf6c('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xaf6c('0x8'));var toCsv=require(_0xaf6c('0x9'));var querystring=require(_0xaf6c('0xa'));var Papa=require(_0xaf6c('0xb'));var qs=require(_0xaf6c('0xc'));var logger=require('../../config/logger')(_0xaf6c('0xd'));var utils=require('../../config/utils');var config=require(_0xaf6c('0xe'));var db=require(_0xaf6c('0xf'))['db'];function respondWithStatusCode(_0xadc085,_0x229cb3){_0x229cb3=_0x229cb3||0xcc;return function(_0x21c81e){if(_0x21c81e){return _0xadc085[_0xaf6c('0x10')](_0x229cb3);}return _0xadc085[_0xaf6c('0x11')](_0x229cb3)['end']();};}function respondWithResult(_0x29b406,_0x2e238e){_0x2e238e=_0x2e238e||0xc8;return function(_0x1e7a15){if(_0x1e7a15){return _0x29b406[_0xaf6c('0x11')](_0x2e238e)[_0xaf6c('0x12')](_0x1e7a15);}};}function respondWithFilteredResult(_0x717355,_0x5f71cf){return function(_0x497e93){if(_0x497e93){var _0x316a54=_0x497e93[_0xaf6c('0x13')],_0x2102d2=_0x5f71cf['offset'],_0x21b175=_0x5f71cf['offset']+_0x5f71cf['limit'],_0x111eb2;if(_0x21b175>=_0x316a54){_0x21b175=_0x316a54;_0x111eb2=0xc8;}else{_0x111eb2=0xce;}_0x717355[_0xaf6c('0x11')](_0x111eb2);return _0x717355[_0xaf6c('0x14')]('Content-Range',_0x2102d2+'-'+_0x21b175+'/'+_0x316a54)['json'](_0x497e93);}return null;};}function patchUpdates(_0x24fd70){return function(_0x2c0a29){try{jsonpatch[_0xaf6c('0x15')](_0x2c0a29,_0x24fd70,!![]);}catch(_0x3d9c04){return BPromise[_0xaf6c('0x16')](_0x3d9c04);}return _0x2c0a29[_0xaf6c('0x17')]();};}function saveUpdates(_0x18d52b,_0x4b6aed){return function(_0x1323e8){if(_0x1323e8){return _0x1323e8[_0xaf6c('0x18')](_0x18d52b)[_0xaf6c('0x19')](function(_0x225816){return _0x225816;});}return null;};}function removeEntity(_0x259067,_0x319954){return function(_0x500511){if(_0x500511){return _0x500511['destroy']()[_0xaf6c('0x19')](function(){_0x259067[_0xaf6c('0x11')](0xcc)[_0xaf6c('0x1a')]();});}};}function handleEntityNotFound(_0x5859be,_0x2e0e98){return function(_0x480a51){if(!_0x480a51){_0x5859be[_0xaf6c('0x10')](0x194);}return _0x480a51;};}function handleError(_0x5c4e13,_0x236c93){_0x236c93=_0x236c93||0x1f4;return function(_0x965e66){logger[_0xaf6c('0x1b')](_0x965e66[_0xaf6c('0x1c')]);if(_0x965e66[_0xaf6c('0x1d')]){delete _0x965e66['name'];}_0x5c4e13[_0xaf6c('0x11')](_0x236c93)[_0xaf6c('0x1e')](_0x965e66);};}exports[_0xaf6c('0x1f')]=function(_0x324ced,_0x201c96){var _0x34a56a={},_0x40827a={},_0x3f3ba6={'count':0x0,'rows':[]};var _0x5c0dc9=db['SmsApplication'][_0xaf6c('0x20')];_0x40827a[_0xaf6c('0x21')]=_[_0xaf6c('0x22')](_0x5c0dc9);var _0x1c8858={'dateStart':_0x324ced[_0xaf6c('0x23')]['dateStart'],'dateEnd':_0x324ced['query']['dateEnd']};delete _0x324ced[_0xaf6c('0x23')][_0xaf6c('0x24')];delete _0x324ced['query'][_0xaf6c('0x25')];_0x40827a[_0xaf6c('0x23')]=_[_0xaf6c('0x22')](_0x324ced[_0xaf6c('0x23')]);_0x40827a[_0xaf6c('0x26')]=_[_0xaf6c('0x27')](_0x40827a[_0xaf6c('0x21')],_0x40827a[_0xaf6c('0x23')]);_0x34a56a[_0xaf6c('0x28')]=_[_0xaf6c('0x27')](_0x40827a[_0xaf6c('0x21')],qs[_0xaf6c('0x29')](_0x324ced['query'][_0xaf6c('0x29')]));_0x34a56a[_0xaf6c('0x28')]=_0x34a56a[_0xaf6c('0x28')][_0xaf6c('0x2a')]?_0x34a56a[_0xaf6c('0x28')]:_0x40827a[_0xaf6c('0x21')];if(!_0x324ced[_0xaf6c('0x23')]['hasOwnProperty'](_0xaf6c('0x2b'))){_0x34a56a[_0xaf6c('0x2c')]=qs[_0xaf6c('0x2c')](_0x324ced[_0xaf6c('0x23')][_0xaf6c('0x2c')]);_0x34a56a['offset']=qs[_0xaf6c('0x2d')](_0x324ced[_0xaf6c('0x23')][_0xaf6c('0x2d')]);}_0x34a56a['order']=qs[_0xaf6c('0x2e')](_0x324ced['query'][_0xaf6c('0x2e')]);_0x34a56a['where']=qs[_0xaf6c('0x26')](_[_0xaf6c('0x2f')](_0x324ced[_0xaf6c('0x23')],_0x40827a[_0xaf6c('0x26')]));if(_0x1c8858[_0xaf6c('0x24')]){if(_0x1c8858['dateEnd']){_0x1c8858['dateEnd']=moment(_0x1c8858[_0xaf6c('0x25')])['add'](0x1,_0xaf6c('0x30'));}else{_0x1c8858[_0xaf6c('0x25')]=moment(_0x1c8858[_0xaf6c('0x24')])[_0xaf6c('0x31')](0x1,_0xaf6c('0x30'));}_[_0xaf6c('0x32')](_0x34a56a[_0xaf6c('0x33')],{'createdAt':{'$gte':_0x1c8858[_0xaf6c('0x24')],'$lte':_0x1c8858[_0xaf6c('0x25')]}});}if(_0x324ced['query'][_0xaf6c('0x34')]){_0x34a56a[_0xaf6c('0x33')]=_[_0xaf6c('0x32')](_0x34a56a[_0xaf6c('0x33')],{'$or':_['map'](_0x34a56a[_0xaf6c('0x28')],function(_0x34cdf1){var _0x230ea8={};_0x230ea8[_0x34cdf1]={'$like':'%'+_0x324ced['query']['filter']+'%'};return _0x230ea8;})});}_0x34a56a=_[_0xaf6c('0x32')]({},_0x34a56a,_0x324ced[_0xaf6c('0x35')]);var _0x3fd04={'where':_0x34a56a[_0xaf6c('0x33')]};return db['SmsApplication'][_0xaf6c('0x13')](_0x3fd04)['then'](function(_0x2f4407){_0x3f3ba6[_0xaf6c('0x13')]=_0x2f4407;if(_0x324ced[_0xaf6c('0x23')][_0xaf6c('0x36')]){_0x34a56a[_0xaf6c('0x37')]=[{'all':!![]}];}return db['SmsApplication'][_0xaf6c('0x38')](_0x34a56a);})[_0xaf6c('0x19')](function(_0x2542ac){_0x3f3ba6[_0xaf6c('0x39')]=_0x2542ac;return _0x3f3ba6;})[_0xaf6c('0x19')](respondWithFilteredResult(_0x201c96,_0x34a56a))[_0xaf6c('0x3a')](handleError(_0x201c96,null));};exports[_0xaf6c('0x3b')]=function(_0x494011,_0x4f1a11){var _0x5e45e6={'raw':!![],'where':{'id':_0x494011[_0xaf6c('0x3c')]['id']}},_0x50c86f={};_0x50c86f[_0xaf6c('0x21')]=_[_0xaf6c('0x22')](db[_0xaf6c('0x3d')]['rawAttributes']);_0x50c86f[_0xaf6c('0x23')]=_[_0xaf6c('0x22')](_0x494011[_0xaf6c('0x23')]);_0x50c86f['filters']=_[_0xaf6c('0x27')](_0x50c86f[_0xaf6c('0x21')],_0x50c86f[_0xaf6c('0x23')]);_0x5e45e6[_0xaf6c('0x28')]=_[_0xaf6c('0x27')](_0x50c86f[_0xaf6c('0x21')],qs[_0xaf6c('0x29')](_0x494011['query']['fields']));_0x5e45e6[_0xaf6c('0x28')]=_0x5e45e6[_0xaf6c('0x28')][_0xaf6c('0x2a')]?_0x5e45e6[_0xaf6c('0x28')]:_0x50c86f[_0xaf6c('0x21')];if(_0x494011[_0xaf6c('0x23')][_0xaf6c('0x36')]){_0x5e45e6['include']=[{'all':!![]}];}_0x5e45e6=_[_0xaf6c('0x32')]({},_0x5e45e6,_0x494011[_0xaf6c('0x35')]);return db[_0xaf6c('0x3d')][_0xaf6c('0x3e')](_0x5e45e6)['then'](handleEntityNotFound(_0x4f1a11,null))[_0xaf6c('0x19')](respondWithResult(_0x4f1a11,null))['catch'](handleError(_0x4f1a11,null));};exports[_0xaf6c('0x3f')]=function(_0x4cc767,_0x47a2c9){return db[_0xaf6c('0x3d')]['create'](_0x4cc767[_0xaf6c('0x40')],{})['then'](respondWithResult(_0x47a2c9,0xc9))[_0xaf6c('0x3a')](handleError(_0x47a2c9,null));};exports['update']=function(_0x463047,_0x345a7a){if(_0x463047[_0xaf6c('0x40')]['id']){delete _0x463047[_0xaf6c('0x40')]['id'];}return db[_0xaf6c('0x3d')]['find']({'where':{'id':_0x463047[_0xaf6c('0x3c')]['id']}})[_0xaf6c('0x19')](handleEntityNotFound(_0x345a7a,null))[_0xaf6c('0x19')](saveUpdates(_0x463047[_0xaf6c('0x40')],null))['then'](respondWithResult(_0x345a7a,null))[_0xaf6c('0x3a')](handleError(_0x345a7a,null));};exports[_0xaf6c('0x41')]=function(_0x1ca1a7,_0x1b301d){return db[_0xaf6c('0x3d')][_0xaf6c('0x3e')]({'where':{'id':_0x1ca1a7['params']['id']}})[_0xaf6c('0x19')](handleEntityNotFound(_0x1b301d,null))['then'](removeEntity(_0x1b301d,null))[_0xaf6c('0x3a')](handleError(_0x1b301d,null));}; \ No newline at end of file +var _0xc164=['reject','save','update','then','destroy','error','name','send','index','SmsApplication','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','day','add','merge','map','filter','includeAll','include','findAll','rows','catch','show','params','length','create','body','find','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','set','Content-Range','apply'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xc164,0x18e));var _0x4c16=function(_0x21948a,_0x4e8ac5){_0x21948a=_0x21948a-0x0;var _0x284a05=_0xc164[_0x21948a];return _0x284a05;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x4c16('0x0'));var moment=require(_0x4c16('0x1'));var BPromise=require(_0x4c16('0x2'));var Mustache=require(_0x4c16('0x3'));var util=require(_0x4c16('0x4'));var path=require(_0x4c16('0x5'));var sox=require(_0x4c16('0x6'));var csv=require(_0x4c16('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x4c16('0x8'));var squel=require(_0x4c16('0x9'));var crypto=require(_0x4c16('0xa'));var jsforce=require(_0x4c16('0xb'));var deskjs=require(_0x4c16('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4c16('0xd'));var Papa=require(_0x4c16('0xe'));var qs=require(_0x4c16('0xf'));var logger=require(_0x4c16('0x10'))('api');var utils=require(_0x4c16('0x11'));var config=require(_0x4c16('0x12'));var db=require(_0x4c16('0x13'))['db'];function respondWithStatusCode(_0xeeae8f,_0x118889){_0x118889=_0x118889||0xcc;return function(_0x9849b6){if(_0x9849b6){return _0xeeae8f[_0x4c16('0x14')](_0x118889);}return _0xeeae8f[_0x4c16('0x15')](_0x118889)[_0x4c16('0x16')]();};}function respondWithResult(_0x5961bb,_0x4d24ca){_0x4d24ca=_0x4d24ca||0xc8;return function(_0x1be7a3){if(_0x1be7a3){return _0x5961bb[_0x4c16('0x15')](_0x4d24ca)['json'](_0x1be7a3);}};}function respondWithFilteredResult(_0x444bf3,_0x3b6de4){return function(_0x42df39){if(_0x42df39){var _0x4d32bb=_0x42df39[_0x4c16('0x17')],_0x57fd65=_0x3b6de4[_0x4c16('0x18')],_0x35eff4=_0x3b6de4['offset']+_0x3b6de4['limit'],_0x3e7455;if(_0x35eff4>=_0x4d32bb){_0x35eff4=_0x4d32bb;_0x3e7455=0xc8;}else{_0x3e7455=0xce;}_0x444bf3[_0x4c16('0x15')](_0x3e7455);return _0x444bf3[_0x4c16('0x19')](_0x4c16('0x1a'),_0x57fd65+'-'+_0x35eff4+'/'+_0x4d32bb)['json'](_0x42df39);}return null;};}function patchUpdates(_0x3aa010){return function(_0x5b235d){try{jsonpatch[_0x4c16('0x1b')](_0x5b235d,_0x3aa010,!![]);}catch(_0x4a205d){return BPromise[_0x4c16('0x1c')](_0x4a205d);}return _0x5b235d[_0x4c16('0x1d')]();};}function saveUpdates(_0xa191e1,_0x2b8641){return function(_0x3b326b){if(_0x3b326b){return _0x3b326b[_0x4c16('0x1e')](_0xa191e1)[_0x4c16('0x1f')](function(_0x2df15d){return _0x2df15d;});}return null;};}function removeEntity(_0x1345e1,_0xb480b6){return function(_0x5c9473){if(_0x5c9473){return _0x5c9473[_0x4c16('0x20')]()['then'](function(){_0x1345e1[_0x4c16('0x15')](0xcc)[_0x4c16('0x16')]();});}};}function handleEntityNotFound(_0x423b0e,_0x3c9265){return function(_0x1f3e94){if(!_0x1f3e94){_0x423b0e[_0x4c16('0x14')](0x194);}return _0x1f3e94;};}function handleError(_0x5c7f24,_0x122af7){_0x122af7=_0x122af7||0x1f4;return function(_0x47061e){logger[_0x4c16('0x21')](_0x47061e['stack']);if(_0x47061e[_0x4c16('0x22')]){delete _0x47061e['name'];}_0x5c7f24['status'](_0x122af7)[_0x4c16('0x23')](_0x47061e);};}exports[_0x4c16('0x24')]=function(_0x162dda,_0x51f527){var _0x1548a9={},_0x14d2d7={},_0x44fa47={'count':0x0,'rows':[]};var _0x321fbd=db[_0x4c16('0x25')][_0x4c16('0x26')];_0x14d2d7[_0x4c16('0x27')]=_[_0x4c16('0x28')](_0x321fbd);var _0x5f4ea2={'dateStart':_0x162dda[_0x4c16('0x29')][_0x4c16('0x2a')],'dateEnd':_0x162dda[_0x4c16('0x29')][_0x4c16('0x2b')]};delete _0x162dda[_0x4c16('0x29')][_0x4c16('0x2a')];delete _0x162dda[_0x4c16('0x29')][_0x4c16('0x2b')];_0x14d2d7[_0x4c16('0x29')]=_[_0x4c16('0x28')](_0x162dda[_0x4c16('0x29')]);_0x14d2d7[_0x4c16('0x2c')]=_[_0x4c16('0x2d')](_0x14d2d7[_0x4c16('0x27')],_0x14d2d7['query']);_0x1548a9['attributes']=_[_0x4c16('0x2d')](_0x14d2d7[_0x4c16('0x27')],qs[_0x4c16('0x2e')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x2e')]));_0x1548a9['attributes']=_0x1548a9[_0x4c16('0x2f')]['length']?_0x1548a9[_0x4c16('0x2f')]:_0x14d2d7['model'];if(!_0x162dda[_0x4c16('0x29')][_0x4c16('0x30')](_0x4c16('0x31'))){_0x1548a9['limit']=qs[_0x4c16('0x32')](_0x162dda['query'][_0x4c16('0x32')]);_0x1548a9[_0x4c16('0x18')]=qs[_0x4c16('0x18')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x18')]);}_0x1548a9[_0x4c16('0x33')]=qs[_0x4c16('0x34')](_0x162dda[_0x4c16('0x29')][_0x4c16('0x34')]);_0x1548a9[_0x4c16('0x35')]=qs['filters'](_[_0x4c16('0x36')](_0x162dda['query'],_0x14d2d7[_0x4c16('0x2c')]));if(_0x5f4ea2[_0x4c16('0x2a')]){if(_0x5f4ea2['dateEnd']){_0x5f4ea2[_0x4c16('0x2b')]=moment(_0x5f4ea2[_0x4c16('0x2b')])['add'](0x1,_0x4c16('0x37'));}else{_0x5f4ea2[_0x4c16('0x2b')]=moment(_0x5f4ea2[_0x4c16('0x2a')])[_0x4c16('0x38')](0x1,_0x4c16('0x37'));}_[_0x4c16('0x39')](_0x1548a9[_0x4c16('0x35')],{'createdAt':{'$gte':_0x5f4ea2['dateStart'],'$lte':_0x5f4ea2[_0x4c16('0x2b')]}});}if(_0x162dda['query']['filter']){_0x1548a9[_0x4c16('0x35')]=_[_0x4c16('0x39')](_0x1548a9[_0x4c16('0x35')],{'$or':_[_0x4c16('0x3a')](_0x1548a9[_0x4c16('0x2f')],function(_0x5b90e7){var _0x946454={};_0x946454[_0x5b90e7]={'$like':'%'+_0x162dda[_0x4c16('0x29')][_0x4c16('0x3b')]+'%'};return _0x946454;})});}_0x1548a9=_[_0x4c16('0x39')]({},_0x1548a9,_0x162dda['options']);var _0x30e87c={'where':_0x1548a9[_0x4c16('0x35')]};return db[_0x4c16('0x25')][_0x4c16('0x17')](_0x30e87c)[_0x4c16('0x1f')](function(_0x585639){_0x44fa47[_0x4c16('0x17')]=_0x585639;if(_0x162dda[_0x4c16('0x29')][_0x4c16('0x3c')]){_0x1548a9[_0x4c16('0x3d')]=[{'all':!![]}];}return db[_0x4c16('0x25')][_0x4c16('0x3e')](_0x1548a9);})['then'](function(_0x33b9a9){_0x44fa47[_0x4c16('0x3f')]=_0x33b9a9;return _0x44fa47;})[_0x4c16('0x1f')](respondWithFilteredResult(_0x51f527,_0x1548a9))[_0x4c16('0x40')](handleError(_0x51f527,null));};exports[_0x4c16('0x41')]=function(_0x16671e,_0x34970c){var _0x154055={'raw':!![],'where':{'id':_0x16671e[_0x4c16('0x42')]['id']}},_0x2a8d00={};_0x2a8d00['model']=_[_0x4c16('0x28')](db[_0x4c16('0x25')]['rawAttributes']);_0x2a8d00[_0x4c16('0x29')]=_['keys'](_0x16671e[_0x4c16('0x29')]);_0x2a8d00[_0x4c16('0x2c')]=_[_0x4c16('0x2d')](_0x2a8d00['model'],_0x2a8d00[_0x4c16('0x29')]);_0x154055[_0x4c16('0x2f')]=_['intersection'](_0x2a8d00['model'],qs[_0x4c16('0x2e')](_0x16671e[_0x4c16('0x29')][_0x4c16('0x2e')]));_0x154055['attributes']=_0x154055['attributes'][_0x4c16('0x43')]?_0x154055[_0x4c16('0x2f')]:_0x2a8d00[_0x4c16('0x27')];if(_0x16671e['query']['includeAll']){_0x154055[_0x4c16('0x3d')]=[{'all':!![]}];}_0x154055=_[_0x4c16('0x39')]({},_0x154055,_0x16671e['options']);return db[_0x4c16('0x25')]['find'](_0x154055)[_0x4c16('0x1f')](handleEntityNotFound(_0x34970c,null))[_0x4c16('0x1f')](respondWithResult(_0x34970c,null))[_0x4c16('0x40')](handleError(_0x34970c,null));};exports[_0x4c16('0x44')]=function(_0xba5483,_0x3489e1){return db[_0x4c16('0x25')][_0x4c16('0x44')](_0xba5483[_0x4c16('0x45')],{})[_0x4c16('0x1f')](respondWithResult(_0x3489e1,0xc9))[_0x4c16('0x40')](handleError(_0x3489e1,null));};exports[_0x4c16('0x1e')]=function(_0x576ffb,_0x680ec4){if(_0x576ffb[_0x4c16('0x45')]['id']){delete _0x576ffb[_0x4c16('0x45')]['id'];}return db[_0x4c16('0x25')][_0x4c16('0x46')]({'where':{'id':_0x576ffb[_0x4c16('0x42')]['id']}})[_0x4c16('0x1f')](handleEntityNotFound(_0x680ec4,null))[_0x4c16('0x1f')](saveUpdates(_0x576ffb[_0x4c16('0x45')],null))['then'](respondWithResult(_0x680ec4,null))[_0x4c16('0x40')](handleError(_0x680ec4,null));};exports[_0x4c16('0x20')]=function(_0x470cc2,_0x408e8b){return db[_0x4c16('0x25')][_0x4c16('0x46')]({'where':{'id':_0x470cc2[_0x4c16('0x42')]['id']}})[_0x4c16('0x1f')](handleEntityNotFound(_0x408e8b,null))['then'](removeEntity(_0x408e8b,null))['catch'](handleError(_0x408e8b,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index c3c44c7..365a1c7 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 _0x2624=['define','SmsApplication','sms_applications','util','../../config/logger','bluebird','exports'];(function(_0x2006a6,_0x4ef445){var _0x1f2f4e=function(_0x51230b){while(--_0x51230b){_0x2006a6['push'](_0x2006a6['shift']());}};_0x1f2f4e(++_0x4ef445);}(_0x2624,0x7a));var _0x4262=function(_0x34a36f,_0x5a0eb6){_0x34a36f=_0x34a36f-0x0;var _0x45441d=_0x2624[_0x34a36f];return _0x45441d;};'use strict';var _=require('lodash');var util=require(_0x4262('0x0'));var logger=require(_0x4262('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4262('0x2'));var rp=require('request-promise');var attributes=require('./smsApplication.attributes');module[_0x4262('0x3')]=function(_0xdc5501,_0x357038){return _0xdc5501[_0x4262('0x4')](_0x4262('0x5'),attributes,{'tableName':_0x4262('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7903=['api','moment','request-promise','exports','SmsApplication','sms_applications','lodash','util'];(function(_0xdeb0b8,_0x4b9186){var _0x335714=function(_0x295235){while(--_0x295235){_0xdeb0b8['push'](_0xdeb0b8['shift']());}};_0x335714(++_0x4b9186);}(_0x7903,0xbe));var _0x3790=function(_0x4acfa1,_0x5ec5ac){_0x4acfa1=_0x4acfa1-0x0;var _0x257c54=_0x7903[_0x4acfa1];return _0x257c54;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require('../../config/logger')(_0x3790('0x2'));var moment=require(_0x3790('0x3'));var BPromise=require('bluebird');var rp=require(_0x3790('0x4'));var attributes=require('./smsApplication.attributes');module[_0x3790('0x5')]=function(_0x50e785,_0x3aab87){return _0x50e785['define'](_0x3790('0x6'),attributes,{'tableName':_0x3790('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 749283b..9b42d6e 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 _0xf244=['debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x276f43,_0x439250){var _0x1d2ada=function(_0x170eaf){while(--_0x170eaf){_0x276f43['push'](_0x276f43['shift']());}};_0x1d2ada(++_0x439250);}(_0xf244,0xae));var _0x4f24=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xf244[_0x2070da];return _0x4f9fe1;};'use strict';var _=require(_0x4f24('0x0'));var util=require(_0x4f24('0x1'));var moment=require(_0x4f24('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f24('0x3'));var fs=require('fs');var db=require(_0x4f24('0x4'))['db'];var utils=require(_0x4f24('0x5'));var logger=require(_0x4f24('0x6'))(_0x4f24('0x7'));var config=require(_0x4f24('0x8'));var jayson=require(_0x4f24('0x9'));var client=jayson['client'][_0x4f24('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdb773c,_0x174977,_0x5e95da){return new BPromise(function(_0x5e1613,_0xaf16be){return client['request'](_0xdb773c,_0x5e95da)[_0x4f24('0xb')](function(_0x32cb1a){logger[_0x4f24('0xc')](_0x4f24('0xd'),_0x174977,_0x4f24('0xe'));logger[_0x4f24('0xf')](_0x4f24('0x10'),_0x174977,_0x4f24('0xe'),JSON[_0x4f24('0x11')](_0x32cb1a));if(_0x32cb1a[_0x4f24('0x12')]){if(_0x32cb1a[_0x4f24('0x12')][_0x4f24('0x13')]===0x1f4){logger[_0x4f24('0x12')](_0x4f24('0xd'),_0x174977,_0x32cb1a['error'][_0x4f24('0x14')]);return _0xaf16be(_0x32cb1a[_0x4f24('0x12')]['message']);}logger['error'](_0x4f24('0xd'),_0x174977,_0x32cb1a['error'][_0x4f24('0x14')]);return _0x5e1613(_0x32cb1a[_0x4f24('0x12')][_0x4f24('0x14')]);}else{logger[_0x4f24('0xc')]('SmsApplication,\x20%s,\x20%s',_0x174977,_0x4f24('0xe'));_0x5e1613(_0x32cb1a['result'][_0x4f24('0x14')]);}})['catch'](function(_0x18710a){logger[_0x4f24('0x12')](_0x4f24('0xd'),_0x174977,_0x18710a);_0xaf16be(_0x18710a);});});} \ No newline at end of file +var _0xeaa0=['info','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1cf1c2,_0x394feb){var _0x57b1f8=function(_0x4fedbf){while(--_0x4fedbf){_0x1cf1c2['push'](_0x1cf1c2['shift']());}};_0x57b1f8(++_0x394feb);}(_0xeaa0,0x16e));var _0x0eaa=function(_0x3a4a66,_0x5afde4){_0x3a4a66=_0x3a4a66-0x0;var _0x2bd136=_0xeaa0[_0x3a4a66];return _0x2bd136;};'use strict';var _=require(_0x0eaa('0x0'));var util=require(_0x0eaa('0x1'));var moment=require(_0x0eaa('0x2'));var BPromise=require(_0x0eaa('0x3'));var rs=require(_0x0eaa('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x0eaa('0x5'));var logger=require(_0x0eaa('0x6'))('rpc');var config=require(_0x0eaa('0x7'));var jayson=require(_0x0eaa('0x8'));var client=jayson[_0x0eaa('0x9')][_0x0eaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7484,_0x4bbbc5,_0x41d4d7){return new BPromise(function(_0x9fdc9a,_0x3493b7){return client[_0x0eaa('0xb')](_0x2e7484,_0x41d4d7)['then'](function(_0x152ec6){logger[_0x0eaa('0xc')](_0x0eaa('0xd'),_0x4bbbc5,_0x0eaa('0xe'));logger['debug'](_0x0eaa('0xf'),_0x4bbbc5,_0x0eaa('0xe'),JSON[_0x0eaa('0x10')](_0x152ec6));if(_0x152ec6['error']){if(_0x152ec6[_0x0eaa('0x11')]['code']===0x1f4){logger[_0x0eaa('0x11')](_0x0eaa('0xd'),_0x4bbbc5,_0x152ec6['error'][_0x0eaa('0x12')]);return _0x3493b7(_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);}logger['error'](_0x0eaa('0xd'),_0x4bbbc5,_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);return _0x9fdc9a(_0x152ec6[_0x0eaa('0x11')][_0x0eaa('0x12')]);}else{logger[_0x0eaa('0xc')](_0x0eaa('0xd'),_0x4bbbc5,_0x0eaa('0xe'));_0x9fdc9a(_0x152ec6[_0x0eaa('0x13')][_0x0eaa('0x12')]);}})[_0x0eaa('0x14')](function(_0x46b2bb){logger[_0x0eaa('0x11')](_0x0eaa('0xd'),_0x4bbbc5,_0x46b2bb);_0x3493b7(_0x46b2bb);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3384cb5..d4e2a1c 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 _0xbb95=['../../components/auth/service','../../config/environment','index','get','isAuthenticated','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','exports','multer','util','Router'];(function(_0x5cd848,_0x5cf8ef){var _0xb70201=function(_0x3e124f){while(--_0x3e124f){_0x5cd848['push'](_0x5cd848['shift']());}};_0xb70201(++_0x5cf8ef);}(_0xbb95,0x7f));var _0x5bb9=function(_0x3810fc,_0x378fc4){_0x3810fc=_0x3810fc-0x0;var _0x223c88=_0xbb95[_0x3810fc];return _0x223c88;};'use strict';var multer=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var path=require('path');var express=require('express');var router=express[_0x5bb9('0x2')]();var auth=require(_0x5bb9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x5bb9('0x4'));var controller=require('./smsInteraction.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5bb9('0x5')]);router[_0x5bb9('0x6')]('/describe',auth[_0x5bb9('0x7')](),controller[_0x5bb9('0x8')]);router[_0x5bb9('0x6')]('/:id',auth[_0x5bb9('0x7')](),controller[_0x5bb9('0x9')]);router[_0x5bb9('0x6')](_0x5bb9('0xa'),auth[_0x5bb9('0x7')](),controller[_0x5bb9('0xb')]);router[_0x5bb9('0xc')]('/',auth[_0x5bb9('0x7')](),controller[_0x5bb9('0xd')]);router[_0x5bb9('0xc')]('/:id/messages',auth['isAuthenticated'](),controller[_0x5bb9('0xe')]);router[_0x5bb9('0xc')](_0x5bb9('0xf'),auth[_0x5bb9('0x7')](),interaction[_0x5bb9('0x10')](_0x5bb9('0x11'),_0x5bb9('0x12')),controller['addTags']);router['put'](_0x5bb9('0x13'),auth[_0x5bb9('0x7')](),interaction[_0x5bb9('0x10')]('sms',_0x5bb9('0x14')),controller[_0x5bb9('0x15')]);router['delete'](_0x5bb9('0x13'),auth[_0x5bb9('0x7')](),interaction[_0x5bb9('0x10')](_0x5bb9('0x11'),_0x5bb9('0x16')),controller[_0x5bb9('0x17')]);router[_0x5bb9('0x18')]('/:id/tags',auth[_0x5bb9('0x7')](),controller['removeTags']);module[_0x5bb9('0x19')]=router; \ No newline at end of file +var _0xb59c=['put','tracked','delete','sms','destroy','removeTags','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/messages','post','create','/:id/tags','smsinteraction:addtags','addTags'];(function(_0x5297ff,_0x447541){var _0x2280e0=function(_0x49c3fa){while(--_0x49c3fa){_0x5297ff['push'](_0x5297ff['shift']());}};_0x2280e0(++_0x447541);}(_0xb59c,0x10b));var _0xcb59=function(_0x30ff44,_0x143800){_0x30ff44=_0x30ff44-0x0;var _0x126c3c=_0xb59c[_0x30ff44];return _0x126c3c;};'use strict';var multer=require(_0xcb59('0x0'));var util=require(_0xcb59('0x1'));var path=require(_0xcb59('0x2'));var express=require('express');var router=express[_0xcb59('0x3')]();var auth=require(_0xcb59('0x4'));var interaction=require(_0xcb59('0x5'));var config=require(_0xcb59('0x6'));var controller=require('./smsInteraction.controller');router[_0xcb59('0x7')]('/',auth[_0xcb59('0x8')](),controller[_0xcb59('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xcb59('0xa')]);router[_0xcb59('0x7')](_0xcb59('0xb'),auth[_0xcb59('0x8')](),controller[_0xcb59('0xc')]);router[_0xcb59('0x7')](_0xcb59('0xd'),auth[_0xcb59('0x8')](),controller['getMessages']);router[_0xcb59('0xe')]('/',auth[_0xcb59('0x8')](),controller[_0xcb59('0xf')]);router[_0xcb59('0xe')]('/:id/messages',auth[_0xcb59('0x8')](),controller['addMessage']);router[_0xcb59('0xe')](_0xcb59('0x10'),auth[_0xcb59('0x8')](),interaction['tracked']('sms',_0xcb59('0x11')),controller[_0xcb59('0x12')]);router[_0xcb59('0x13')]('/:id',auth['isAuthenticated'](),interaction[_0xcb59('0x14')]('sms','smsinteraction:update'),controller['update']);router[_0xcb59('0x15')]('/:id',auth[_0xcb59('0x8')](),interaction[_0xcb59('0x14')](_0xcb59('0x16'),'smsinteraction:destroy'),controller[_0xcb59('0x17')]);router['delete'](_0xcb59('0x10'),auth['isAuthenticated'](),controller[_0xcb59('0x18')]);module[_0xcb59('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 18b856b..e4d27c8 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 _0x5df9=['DATE','STRING','out','ENUM','sequelize','moment','exports','BOOLEAN'];(function(_0x5b1d16,_0x4e3b68){var _0x3d97ac=function(_0x2c275f){while(--_0x2c275f){_0x5b1d16['push'](_0x5b1d16['shift']());}};_0x3d97ac(++_0x4e3b68);}(_0x5df9,0x194));var _0x95df=function(_0x58fb9c,_0x382fe4){_0x58fb9c=_0x58fb9c-0x0;var _0xc8cc32=_0x5df9[_0x58fb9c];return _0xc8cc32;};'use strict';var Sequelize=require(_0x95df('0x0'));var moment=require(_0x95df('0x1'));module[_0x95df('0x2')]={'closed':{'type':Sequelize[_0x95df('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x95df('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x95df('0x5')]},'read1stAt':{'type':Sequelize[_0x95df('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x95df('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x95df('0x7')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd32f=['sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x21545f,_0x54239a){var _0x4bc946=function(_0x2b9abc){while(--_0x2b9abc){_0x21545f['push'](_0x21545f['shift']());}};_0x4bc946(++_0x54239a);}(_0xd32f,0x68));var _0xfd32=function(_0x2f42ea,_0x4228bb){_0x2f42ea=_0x2f42ea-0x0;var _0x43e6a6=_0xd32f[_0x2f42ea];return _0x43e6a6;};'use strict';var Sequelize=require(_0xfd32('0x0'));var moment=require(_0xfd32('0x1'));module[_0xfd32('0x2')]={'closed':{'type':Sequelize[_0xfd32('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfd32('0x4')]},'disposition':{'type':Sequelize[_0xfd32('0x5')]},'note':{'type':Sequelize[_0xfd32('0x5')]},'phone':{'type':Sequelize[_0xfd32('0x5')]},'read1stAt':{'type':Sequelize[_0xfd32('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfd32('0x6')]('in',_0xfd32('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfd32('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xfd32('0x6')]('in',_0xfd32('0x7')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index cf9a352..cacbd31 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 _0xc8fa=['sort','where','pick','add','day','filter','merge','map','options','include','tag','push','Tags','distinct','Messages','direction','createdAt','read','SmsInteraction','includeAll','User','Users','fullname','CmContact','Contact','Owner','internal','SmsAccount','Account','SmsMessage','Tag','color','rows','catch','params','create','body','find','describe','addMessage','ids','omit','getMessages','findOne','SmsInteractionId','$gte','split','format','findAll','addTags','setTags','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/utils','../../config/environment','socket.io-emitter','localhost','register','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order'];(function(_0x27b4d3,_0x5fdcf4){var _0x286fc4=function(_0x9ae13a){while(--_0x9ae13a){_0x27b4d3['push'](_0x27b4d3['shift']());}};_0x286fc4(++_0x5fdcf4);}(_0xc8fa,0x1c7));var _0xac8f=function(_0x91d709,_0x4f8974){_0x91d709=_0x91d709-0x0;var _0x1e42f6=_0xc8fa[_0x91d709];return _0x1e42f6;};'use strict';var jsonpatch=require(_0xac8f('0x0'));var rp=require('request-promise');var moment=require(_0xac8f('0x1'));var BPromise=require(_0xac8f('0x2'));var Mustache=require('mustache');var util=require(_0xac8f('0x3'));var path=require(_0xac8f('0x4'));var sox=require('sox');var csv=require(_0xac8f('0x5'));var ejs=require(_0xac8f('0x6'));var fs=require('fs');var _=require(_0xac8f('0x7'));var squel=require(_0xac8f('0x8'));var crypto=require(_0xac8f('0x9'));var jsforce=require(_0xac8f('0xa'));var deskjs=require(_0xac8f('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xac8f('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xac8f('0xd'))('api');var utils=require(_0xac8f('0xe'));var config=require(_0xac8f('0xf'));var db=require('../../mysqldb')['db'];var socket=require(_0xac8f('0x10'))({'host':_0xac8f('0x11'),'port':0x18eb});require('./smsInteraction.socket')[_0xac8f('0x12')](socket);function respondWithStatusCode(_0x5e10ef,_0xf6b44b){_0xf6b44b=_0xf6b44b||0xcc;return function(_0x473bf9){if(_0x473bf9){return _0x5e10ef['sendStatus'](_0xf6b44b);}return _0x5e10ef[_0xac8f('0x13')](_0xf6b44b)[_0xac8f('0x14')]();};}function respondWithResult(_0x1e7379,_0x577882){_0x577882=_0x577882||0xc8;return function(_0x4a60ee){if(_0x4a60ee){return _0x1e7379[_0xac8f('0x13')](_0x577882)[_0xac8f('0x15')](_0x4a60ee);}};}function respondWithFilteredResult(_0x479dd2,_0x3cc28f){return function(_0x2b541a){if(_0x2b541a){var _0x322415=_0x2b541a[_0xac8f('0x16')],_0x4366ca=_0x3cc28f['offset'],_0x106008=_0x3cc28f[_0xac8f('0x17')]+_0x3cc28f[_0xac8f('0x18')],_0x52f455;if(_0x106008>=_0x322415){_0x106008=_0x322415;_0x52f455=0xc8;}else{_0x52f455=0xce;}_0x479dd2[_0xac8f('0x13')](_0x52f455);return _0x479dd2[_0xac8f('0x19')]('Content-Range',_0x4366ca+'-'+_0x106008+'/'+_0x322415)[_0xac8f('0x15')](_0x2b541a);}return null;};}function patchUpdates(_0x50bbd1){return function(_0xf103f3){try{jsonpatch[_0xac8f('0x1a')](_0xf103f3,_0x50bbd1,!![]);}catch(_0x53cfd4){return BPromise[_0xac8f('0x1b')](_0x53cfd4);}return _0xf103f3[_0xac8f('0x1c')]();};}function saveUpdates(_0x3f6701,_0x24ba9b){return function(_0xfd7fb2){if(_0xfd7fb2){return _0xfd7fb2[_0xac8f('0x1d')](_0x3f6701)[_0xac8f('0x1e')](function(_0x150b52){return _0x150b52;});}return null;};}function removeEntity(_0x3a6da1,_0x455444){return function(_0x3f6ba9){if(_0x3f6ba9){return _0x3f6ba9[_0xac8f('0x1f')]()[_0xac8f('0x1e')](function(){_0x3a6da1[_0xac8f('0x13')](0xcc)[_0xac8f('0x14')]();});}};}function handleEntityNotFound(_0x3d65ec,_0x307297){return function(_0xfb7f5d){if(!_0xfb7f5d){_0x3d65ec[_0xac8f('0x20')](0x194);}return _0xfb7f5d;};}function handleError(_0x5e5dbb,_0x342c47){_0x342c47=_0x342c47||0x1f4;return function(_0x299038){logger[_0xac8f('0x21')](_0x299038[_0xac8f('0x22')]);if(_0x299038[_0xac8f('0x23')]){delete _0x299038['name'];}_0x5e5dbb[_0xac8f('0x13')](_0x342c47)['send'](_0x299038);};}exports['index']=function(_0x544c77,_0x4284fc){var _0x2208b4={},_0xcfd9d3={},_0x17a085={'count':0x0,'rows':[]};var _0x12bdf9=db['SmsInteraction'][_0xac8f('0x24')];_0xcfd9d3[_0xac8f('0x25')]=_[_0xac8f('0x26')](_0x12bdf9);var _0x4f2558={'dateStart':_0x544c77[_0xac8f('0x27')]['dateStart'],'dateEnd':_0x544c77[_0xac8f('0x27')]['dateEnd']};delete _0x544c77['query'][_0xac8f('0x28')];delete _0x544c77[_0xac8f('0x27')][_0xac8f('0x29')];_0xcfd9d3[_0xac8f('0x27')]=_[_0xac8f('0x26')](_0x544c77[_0xac8f('0x27')]);_0xcfd9d3[_0xac8f('0x2a')]=_[_0xac8f('0x2b')](_0xcfd9d3[_0xac8f('0x25')],_0xcfd9d3['query']);_0x2208b4['attributes']=_[_0xac8f('0x2b')](_0xcfd9d3['model'],qs[_0xac8f('0x2c')](_0x544c77['query'][_0xac8f('0x2c')]));_0x2208b4['attributes']=_0x2208b4['attributes'][_0xac8f('0x2d')]?_0x2208b4[_0xac8f('0x2e')]:_0xcfd9d3[_0xac8f('0x25')];if(!_0x544c77[_0xac8f('0x27')][_0xac8f('0x2f')](_0xac8f('0x30'))){_0x2208b4['limit']=qs[_0xac8f('0x18')](_0x544c77[_0xac8f('0x27')][_0xac8f('0x18')]);_0x2208b4[_0xac8f('0x17')]=qs[_0xac8f('0x17')](_0x544c77[_0xac8f('0x27')][_0xac8f('0x17')]);}_0x2208b4[_0xac8f('0x31')]=qs[_0xac8f('0x32')](_0x544c77[_0xac8f('0x27')][_0xac8f('0x32')]);_0x2208b4[_0xac8f('0x33')]=qs['filters'](_[_0xac8f('0x34')](_0x544c77[_0xac8f('0x27')],_0xcfd9d3[_0xac8f('0x2a')]));if(_0x4f2558[_0xac8f('0x28')]){if(_0x4f2558[_0xac8f('0x29')]){_0x4f2558['dateEnd']=moment(_0x4f2558['dateEnd'])[_0xac8f('0x35')](0x1,_0xac8f('0x36'));}else{_0x4f2558[_0xac8f('0x29')]=moment(_0x4f2558['dateStart'])['add'](0x1,_0xac8f('0x36'));}_['merge'](_0x2208b4['where'],{'createdAt':{'$gte':_0x4f2558[_0xac8f('0x28')],'$lte':_0x4f2558[_0xac8f('0x29')]}});}if(_0x544c77[_0xac8f('0x27')][_0xac8f('0x37')]){_0x2208b4['where']=_[_0xac8f('0x38')](_0x2208b4[_0xac8f('0x33')],{'$or':_[_0xac8f('0x39')](_0x2208b4[_0xac8f('0x2e')],function(_0x113c20){var _0x1a7abe={};_0x1a7abe[_0x113c20]={'$like':'%'+_0x544c77['query'][_0xac8f('0x37')]+'%'};return _0x1a7abe;})});}_0x2208b4=_[_0xac8f('0x38')]({},_0x2208b4,_0x544c77[_0xac8f('0x3a')]);var _0xd0a425={'where':_0x2208b4[_0xac8f('0x33')]};_0xd0a425[_0xac8f('0x3b')]=[];if(_0x544c77[_0xac8f('0x27')][_0xac8f('0x3c')]){_0xd0a425[_0xac8f('0x3b')][_0xac8f('0x3d')]({'model':db['Tag'],'as':_0xac8f('0x3e'),'attributes':['id'],'where':{'id':_0x544c77[_0xac8f('0x27')]['tag']},'required':!![]});_0xd0a425[_0xac8f('0x3f')]=!![];}if(_0x544c77['query']['read']){_0xd0a425[_0xac8f('0x3b')]['push']({'model':db['SmsMessage'],'as':_0xac8f('0x40'),'attributes':['id',_0xac8f('0x41'),_0xac8f('0x42'),_0xac8f('0x43')],'where':{'direction':'in','read':_0x544c77[_0xac8f('0x27')][_0xac8f('0x43')]||![]},'required':!![]});_0xd0a425[_0xac8f('0x3f')]=!![];}return db[_0xac8f('0x44')][_0xac8f('0x16')](_0xd0a425)[_0xac8f('0x1e')](function(_0x4d8c41){_0x17a085['count']=_0x4d8c41;if(_0x544c77['query'][_0xac8f('0x45')]){_0x2208b4[_0xac8f('0x3b')]=[{'model':db[_0xac8f('0x46')],'as':_0xac8f('0x47'),'required':![],'attributes':['id','name',_0xac8f('0x48')]},{'model':db[_0xac8f('0x49')],'as':_0xac8f('0x4a'),'required':![]},{'model':db['User'],'as':_0xac8f('0x4b'),'attributes':[_0xac8f('0x23'),'fullname',_0xac8f('0x4c')],'required':![]},{'model':db[_0xac8f('0x4d')],'as':_0xac8f('0x4e'),'attributes':[_0xac8f('0x23'),'key'],'required':![]},{'model':db[_0xac8f('0x4f')],'as':_0xac8f('0x40'),'attributes':['id',_0xac8f('0x41'),_0xac8f('0x42'),'read'],'where':{'direction':'in','read':_0x544c77[_0xac8f('0x27')][_0xac8f('0x43')]||![]},'required':_0x544c77['query'][_0xac8f('0x43')]||![]},{'model':db[_0xac8f('0x50')],'as':_0xac8f('0x3e'),'attributes':['id',_0xac8f('0x23'),_0xac8f('0x51')],'required':_0x544c77['query'][_0xac8f('0x3c')]?!![]:![]},{'model':db[_0xac8f('0x50')],'as':'ThroughTags','attributes':['id','name',_0xac8f('0x51')],'through':_0x544c77[_0xac8f('0x27')]['tag']?{'attributes':[],'where':{'TagId':_0x544c77['query'][_0xac8f('0x3c')]||undefined}}:{},'required':_0x544c77[_0xac8f('0x27')][_0xac8f('0x3c')]?!![]:![]}];}return db[_0xac8f('0x44')]['findAll'](_0x2208b4);})[_0xac8f('0x1e')](function(_0x56c2e2){_0x17a085[_0xac8f('0x52')]=_0x56c2e2;return _0x17a085;})[_0xac8f('0x1e')](respondWithFilteredResult(_0x4284fc,_0x2208b4))[_0xac8f('0x53')](handleError(_0x4284fc,null));};exports['show']=function(_0xd676e4,_0x303fc8){var _0x48278e={'raw':![],'where':{'id':_0xd676e4[_0xac8f('0x54')]['id']}},_0x175938={};_0x175938['model']=_['keys'](db['SmsInteraction'][_0xac8f('0x24')]);_0x175938['query']=_[_0xac8f('0x26')](_0xd676e4['query']);_0x175938[_0xac8f('0x2a')]=_[_0xac8f('0x2b')](_0x175938[_0xac8f('0x25')],_0x175938[_0xac8f('0x27')]);_0x48278e[_0xac8f('0x2e')]=_[_0xac8f('0x2b')](_0x175938[_0xac8f('0x25')],qs[_0xac8f('0x2c')](_0xd676e4[_0xac8f('0x27')][_0xac8f('0x2c')]));_0x48278e['attributes']=_0x48278e[_0xac8f('0x2e')][_0xac8f('0x2d')]?_0x48278e[_0xac8f('0x2e')]:_0x175938['model'];if(_0xd676e4[_0xac8f('0x27')][_0xac8f('0x45')]){_0x48278e['include']=[{'all':!![]}];}_0x48278e=_['merge']({},_0x48278e,_0xd676e4[_0xac8f('0x3a')]);return db['SmsInteraction']['find'](_0x48278e)[_0xac8f('0x1e')](handleEntityNotFound(_0x303fc8,null))[_0xac8f('0x1e')](respondWithResult(_0x303fc8,null))[_0xac8f('0x53')](handleError(_0x303fc8,null));};exports[_0xac8f('0x55')]=function(_0x3e4e21,_0xed6446){return db[_0xac8f('0x44')][_0xac8f('0x55')](_0x3e4e21[_0xac8f('0x56')],{})[_0xac8f('0x1e')](respondWithResult(_0xed6446,0xc9))[_0xac8f('0x53')](handleError(_0xed6446,null));};exports['update']=function(_0x1d87e0,_0x58318f){if(_0x1d87e0['body']['id']){delete _0x1d87e0['body']['id'];}return db[_0xac8f('0x44')][_0xac8f('0x57')]({'where':{'id':_0x1d87e0['params']['id']}})[_0xac8f('0x1e')](handleEntityNotFound(_0x58318f,null))['then'](saveUpdates(_0x1d87e0['body'],null))['then'](respondWithResult(_0x58318f,null))[_0xac8f('0x53')](handleError(_0x58318f,null));};exports[_0xac8f('0x1f')]=function(_0x2c327a,_0x165cf3){return db['SmsInteraction'][_0xac8f('0x57')]({'where':{'id':_0x2c327a['params']['id']}})['then'](handleEntityNotFound(_0x165cf3,null))[_0xac8f('0x1e')](removeEntity(_0x165cf3,null))['catch'](handleError(_0x165cf3,null));};exports['describe']=function(_0x47ad20,_0x425097){return db[_0xac8f('0x44')][_0xac8f('0x58')]()[_0xac8f('0x1e')](respondWithResult(_0x425097,null))['catch'](handleError(_0x425097,null));};exports[_0xac8f('0x59')]=function(_0x2cde4f,_0x2ae9ac,_0x298cba){return db[_0xac8f('0x4f')][_0xac8f('0x57')]({'where':{'id':_0x2cde4f[_0xac8f('0x54')]['id']}})[_0xac8f('0x1e')](handleEntityNotFound(_0x2ae9ac,null))[_0xac8f('0x1e')](function(_0x346184){if(_0x346184){return _0x346184[_0xac8f('0x59')](_0x2cde4f[_0xac8f('0x56')][_0xac8f('0x5a')],_[_0xac8f('0x5b')](_0x2cde4f[_0xac8f('0x56')],[_0xac8f('0x5a'),'id'])||{});}})[_0xac8f('0x1e')](respondWithResult(_0x2ae9ac,null))['catch'](handleError(_0x2ae9ac,null));};exports[_0xac8f('0x5c')]=function(_0x42dfb9,_0x20ee0e,_0xa32d0a){var _0x301e6e={'raw':![],'where':{}};var _0x14d31a={};var _0x188eda={'count':0x0,'rows':[]};return db[_0xac8f('0x44')][_0xac8f('0x5d')]({'where':{'id':_0x42dfb9[_0xac8f('0x54')]['id']}})[_0xac8f('0x1e')](handleEntityNotFound(_0x20ee0e,null))[_0xac8f('0x1e')](function(_0x1b9fd7){if(_0x1b9fd7){_0x14d31a['model']=_[_0xac8f('0x26')](db[_0xac8f('0x4f')][_0xac8f('0x24')]);_0x14d31a['query']=_[_0xac8f('0x26')](_0x42dfb9[_0xac8f('0x27')]);_0x14d31a[_0xac8f('0x2a')]=_['intersection'](_0x14d31a['model'],_0x14d31a[_0xac8f('0x27')]);_0x301e6e['attributes']=_['intersection'](_0x14d31a[_0xac8f('0x25')],qs['fields'](_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x2c')]));_0x301e6e[_0xac8f('0x2e')]=_0x301e6e['attributes']['length']?_0x301e6e[_0xac8f('0x2e')]:_0x14d31a[_0xac8f('0x25')];if(!_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x2f')](_0xac8f('0x30'))){_0x301e6e[_0xac8f('0x18')]=qs[_0xac8f('0x18')](_0x42dfb9[_0xac8f('0x27')]['limit']);_0x301e6e[_0xac8f('0x17')]=qs[_0xac8f('0x17')](_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x17')]);}_0x301e6e[_0xac8f('0x31')]=qs[_0xac8f('0x32')](_0x42dfb9[_0xac8f('0x27')]['sort']);_0x301e6e[_0xac8f('0x33')]=qs['filters'](_[_0xac8f('0x34')](_0x42dfb9['query'],_0x14d31a[_0xac8f('0x2a')]));_0x301e6e[_0xac8f('0x33')][_0xac8f('0x5e')]=_0x1b9fd7['id'];if(_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x37')]){_0x301e6e['where']=_['merge'](_0x301e6e['where'],{'$or':_[_0xac8f('0x39')](_0x301e6e['attributes'],function(_0x23d803){var _0x2594d6={};_0x2594d6[_0x23d803]={'$like':'%'+_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x37')]+'%'};return _0x2594d6;})});}if(_0x42dfb9[_0xac8f('0x27')][_0xac8f('0x5f')]){var _0x4a0f59=_0x42dfb9['query'][_0xac8f('0x5f')][_0xac8f('0x60')](',');var _0x186dba={};_0x186dba[_0x4a0f59[0x0]]={'$gte':moment(_0x4a0f59[0x1])[_0xac8f('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x301e6e['where']=_[_0xac8f('0x38')](_0x301e6e[_0xac8f('0x33')],_0x186dba);}_0x301e6e=_[_0xac8f('0x38')]({},_0x301e6e,_0x42dfb9[_0xac8f('0x3a')]);return db[_0xac8f('0x4f')]['count']({'where':_0x301e6e[_0xac8f('0x33')]})[_0xac8f('0x1e')](function(_0x2ea91b){_0x188eda['count']=_0x2ea91b;if(_0x42dfb9['query'][_0xac8f('0x45')]){_0x301e6e[_0xac8f('0x3b')]=[{'all':!![]}];}return db[_0xac8f('0x4f')][_0xac8f('0x62')](_0x301e6e);})[_0xac8f('0x1e')](function(_0x383fd2){_0x188eda[_0xac8f('0x52')]=_0x383fd2;return _0x188eda;});}})['then'](respondWithFilteredResult(_0x20ee0e,_0x301e6e))[_0xac8f('0x53')](handleError(_0x20ee0e,null));};exports[_0xac8f('0x63')]=function(_0x4dc046,_0x3a2f1d,_0x3be703){return db[_0xac8f('0x44')]['find']({'where':{'id':_0x4dc046[_0xac8f('0x54')]['id']}})[_0xac8f('0x1e')](handleEntityNotFound(_0x3a2f1d,null))[_0xac8f('0x1e')](function(_0x3116e5){if(_0x3116e5){return _0x3116e5[_0xac8f('0x64')](_0x4dc046[_0xac8f('0x56')][_0xac8f('0x5a')],_[_0xac8f('0x5b')](_0x4dc046['body'],[_0xac8f('0x5a'),'id'])||{})['spread'](function(){return db[_0xac8f('0x50')][_0xac8f('0x62')]({'attributes':['id',_0xac8f('0x23'),'color'],'where':{'id':_0x4dc046[_0xac8f('0x56')][_0xac8f('0x5a')]}});})['then'](function(_0x148780){socket['emit']('smsInteractionTags:save',{'id':Number(_0x4dc046['params']['id']),'tags':_0x148780||[]});return{'id':Number(_0x4dc046[_0xac8f('0x54')]['id']),'tags':_0x148780||[]};});}})[_0xac8f('0x1e')](respondWithResult(_0x3a2f1d,null))[_0xac8f('0x53')](handleError(_0x3a2f1d,null));};exports['removeTags']=function(_0x24b085,_0x43768e,_0x56e42f){var _0x5479b7;return db[_0xac8f('0x44')][_0xac8f('0x57')]({'where':{'id':_0x24b085[_0xac8f('0x54')]['id']}})[_0xac8f('0x1e')](handleEntityNotFound(_0x43768e,null))[_0xac8f('0x1e')](function(_0x1e0dd7){if(_0x1e0dd7){return _0x1e0dd7['removeTags'](_0x24b085[_0xac8f('0x27')]['ids']);}})['then'](respondWithStatusCode(_0x43768e,null))[_0xac8f('0x53')](handleError(_0x43768e,null));}; \ No newline at end of file +var _0x9f6c=['rows','catch','show','params','find','create','body','ids','getMessages','SmsInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','emit','smsInteractionTags:save','removeTags','fast-json-patch','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsInteraction.socket','register','status','end','count','limit','set','json','reject','save','update','destroy','sendStatus','error','stack','name','send','index','SmsInteraction','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','day','merge','filter','map','options','include','tag','Tag','Tags','distinct','read','push','SmsMessage','Messages','createdAt','then','includeAll','User','Users','CmContact','Contact','Owner','fullname','SmsAccount','Account','key','direction','ThroughTags','findAll'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0x9f6c,0x150));var _0xc9f6=function(_0x5d70ae,_0x5b8c4c){_0x5d70ae=_0x5d70ae-0x0;var _0x104e9b=_0x9f6c[_0x5d70ae];return _0x104e9b;};'use strict';var jsonpatch=require(_0xc9f6('0x0'));var rp=require('request-promise');var moment=require(_0xc9f6('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc9f6('0x2'));var util=require(_0xc9f6('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xc9f6('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc9f6('0x5'));var squel=require(_0xc9f6('0x6'));var crypto=require(_0xc9f6('0x7'));var jsforce=require(_0xc9f6('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xc9f6('0x4'));var querystring=require(_0xc9f6('0x9'));var Papa=require(_0xc9f6('0xa'));var qs=require(_0xc9f6('0xb'));var logger=require(_0xc9f6('0xc'))('api');var utils=require(_0xc9f6('0xd'));var config=require(_0xc9f6('0xe'));var db=require(_0xc9f6('0xf'))['db'];var socket=require(_0xc9f6('0x10'))({'host':_0xc9f6('0x11'),'port':0x18eb});require(_0xc9f6('0x12'))[_0xc9f6('0x13')](socket);function respondWithStatusCode(_0x585f87,_0x47c4d4){_0x47c4d4=_0x47c4d4||0xcc;return function(_0x5803e4){if(_0x5803e4){return _0x585f87['sendStatus'](_0x47c4d4);}return _0x585f87[_0xc9f6('0x14')](_0x47c4d4)[_0xc9f6('0x15')]();};}function respondWithResult(_0x11552f,_0x3b7e3d){_0x3b7e3d=_0x3b7e3d||0xc8;return function(_0x5a1bc0){if(_0x5a1bc0){return _0x11552f[_0xc9f6('0x14')](_0x3b7e3d)['json'](_0x5a1bc0);}};}function respondWithFilteredResult(_0xb9aaf0,_0x1191c8){return function(_0x3f6b05){if(_0x3f6b05){var _0x1caba5=_0x3f6b05[_0xc9f6('0x16')],_0x616e94=_0x1191c8['offset'],_0x3486b9=_0x1191c8['offset']+_0x1191c8[_0xc9f6('0x17')],_0x2bf2fe;if(_0x3486b9>=_0x1caba5){_0x3486b9=_0x1caba5;_0x2bf2fe=0xc8;}else{_0x2bf2fe=0xce;}_0xb9aaf0[_0xc9f6('0x14')](_0x2bf2fe);return _0xb9aaf0[_0xc9f6('0x18')]('Content-Range',_0x616e94+'-'+_0x3486b9+'/'+_0x1caba5)[_0xc9f6('0x19')](_0x3f6b05);}return null;};}function patchUpdates(_0x69056e){return function(_0x38cd05){try{jsonpatch['apply'](_0x38cd05,_0x69056e,!![]);}catch(_0x370c13){return BPromise[_0xc9f6('0x1a')](_0x370c13);}return _0x38cd05[_0xc9f6('0x1b')]();};}function saveUpdates(_0x2797aa,_0x4f5688){return function(_0x5d36e7){if(_0x5d36e7){return _0x5d36e7[_0xc9f6('0x1c')](_0x2797aa)['then'](function(_0x302602){return _0x302602;});}return null;};}function removeEntity(_0x384f7a,_0x1ac03a){return function(_0x20420f){if(_0x20420f){return _0x20420f[_0xc9f6('0x1d')]()['then'](function(){_0x384f7a[_0xc9f6('0x14')](0xcc)[_0xc9f6('0x15')]();});}};}function handleEntityNotFound(_0x1c8955,_0x43c216){return function(_0x2861c7){if(!_0x2861c7){_0x1c8955[_0xc9f6('0x1e')](0x194);}return _0x2861c7;};}function handleError(_0x32643b,_0x2bf164){_0x2bf164=_0x2bf164||0x1f4;return function(_0x554e5a){logger[_0xc9f6('0x1f')](_0x554e5a[_0xc9f6('0x20')]);if(_0x554e5a[_0xc9f6('0x21')]){delete _0x554e5a['name'];}_0x32643b[_0xc9f6('0x14')](_0x2bf164)[_0xc9f6('0x22')](_0x554e5a);};}exports[_0xc9f6('0x23')]=function(_0x5775cf,_0x4c4393){var _0x21f9f5={},_0xe827c7={},_0x1b07ef={'count':0x0,'rows':[]};var _0x5a6d21=db[_0xc9f6('0x24')][_0xc9f6('0x25')];_0xe827c7[_0xc9f6('0x26')]=_[_0xc9f6('0x27')](_0x5a6d21);var _0x1ed2da={'dateStart':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x29')],'dateEnd':_0x5775cf['query'][_0xc9f6('0x2a')]};delete _0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x29')];delete _0x5775cf[_0xc9f6('0x28')]['dateEnd'];_0xe827c7[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x5775cf[_0xc9f6('0x28')]);_0xe827c7[_0xc9f6('0x2b')]=_['intersection'](_0xe827c7[_0xc9f6('0x26')],_0xe827c7[_0xc9f6('0x28')]);_0x21f9f5[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0xe827c7[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x5775cf['query']['fields']));_0x21f9f5['attributes']=_0x21f9f5[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0x21f9f5[_0xc9f6('0x2c')]:_0xe827c7[_0xc9f6('0x26')];if(!_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x30')](_0xc9f6('0x31'))){_0x21f9f5[_0xc9f6('0x17')]=qs[_0xc9f6('0x17')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x17')]);_0x21f9f5['offset']=qs[_0xc9f6('0x32')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x32')]);}_0x21f9f5[_0xc9f6('0x33')]=qs[_0xc9f6('0x34')](_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x34')]);_0x21f9f5[_0xc9f6('0x35')]=qs[_0xc9f6('0x2b')](_[_0xc9f6('0x36')](_0x5775cf[_0xc9f6('0x28')],_0xe827c7[_0xc9f6('0x2b')]));if(_0x1ed2da[_0xc9f6('0x29')]){if(_0x1ed2da[_0xc9f6('0x2a')]){_0x1ed2da['dateEnd']=moment(_0x1ed2da[_0xc9f6('0x2a')])['add'](0x1,_0xc9f6('0x37'));}else{_0x1ed2da[_0xc9f6('0x2a')]=moment(_0x1ed2da[_0xc9f6('0x29')])['add'](0x1,_0xc9f6('0x37'));}_[_0xc9f6('0x38')](_0x21f9f5[_0xc9f6('0x35')],{'createdAt':{'$gte':_0x1ed2da['dateStart'],'$lte':_0x1ed2da[_0xc9f6('0x2a')]}});}if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x39')]){_0x21f9f5[_0xc9f6('0x35')]=_[_0xc9f6('0x38')](_0x21f9f5[_0xc9f6('0x35')],{'$or':_[_0xc9f6('0x3a')](_0x21f9f5[_0xc9f6('0x2c')],function(_0x102b11){var _0x46c242={};_0x46c242[_0x102b11]={'$like':'%'+_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x39')]+'%'};return _0x46c242;})});}_0x21f9f5=_['merge']({},_0x21f9f5,_0x5775cf[_0xc9f6('0x3b')]);var _0x3dc695={'where':_0x21f9f5[_0xc9f6('0x35')]};_0x3dc695[_0xc9f6('0x3c')]=[];if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x3d')]){_0x3dc695[_0xc9f6('0x3c')]['push']({'model':db[_0xc9f6('0x3e')],'as':_0xc9f6('0x3f'),'attributes':['id'],'where':{'id':_0x5775cf[_0xc9f6('0x28')]['tag']},'required':!![]});_0x3dc695[_0xc9f6('0x40')]=!![];}if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]){_0x3dc695[_0xc9f6('0x3c')][_0xc9f6('0x42')]({'model':db[_0xc9f6('0x43')],'as':_0xc9f6('0x44'),'attributes':['id','direction',_0xc9f6('0x45'),_0xc9f6('0x41')],'where':{'direction':'in','read':_0x5775cf[_0xc9f6('0x28')]['read']||![]},'required':!![]});_0x3dc695[_0xc9f6('0x40')]=!![];}return db[_0xc9f6('0x24')][_0xc9f6('0x16')](_0x3dc695)[_0xc9f6('0x46')](function(_0x114cf6){_0x1b07ef['count']=_0x114cf6;if(_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x47')]){_0x21f9f5[_0xc9f6('0x3c')]=[{'model':db[_0xc9f6('0x48')],'as':_0xc9f6('0x49'),'required':![],'attributes':['id',_0xc9f6('0x21'),'fullname']},{'model':db[_0xc9f6('0x4a')],'as':_0xc9f6('0x4b'),'required':![]},{'model':db['User'],'as':_0xc9f6('0x4c'),'attributes':[_0xc9f6('0x21'),_0xc9f6('0x4d'),'internal'],'required':![]},{'model':db[_0xc9f6('0x4e')],'as':_0xc9f6('0x4f'),'attributes':[_0xc9f6('0x21'),_0xc9f6('0x50')],'required':![]},{'model':db[_0xc9f6('0x43')],'as':'Messages','attributes':['id',_0xc9f6('0x51'),_0xc9f6('0x45'),_0xc9f6('0x41')],'where':{'direction':'in','read':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]||![]},'required':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x41')]||![]},{'model':db[_0xc9f6('0x3e')],'as':_0xc9f6('0x3f'),'attributes':['id',_0xc9f6('0x21'),'color'],'required':_0x5775cf[_0xc9f6('0x28')][_0xc9f6('0x3d')]?!![]:![]},{'model':db['Tag'],'as':_0xc9f6('0x52'),'attributes':['id','name','color'],'through':_0x5775cf['query'][_0xc9f6('0x3d')]?{'attributes':[],'where':{'TagId':_0x5775cf['query'][_0xc9f6('0x3d')]||undefined}}:{},'required':_0x5775cf['query'][_0xc9f6('0x3d')]?!![]:![]}];}return db[_0xc9f6('0x24')][_0xc9f6('0x53')](_0x21f9f5);})[_0xc9f6('0x46')](function(_0x362bf2){_0x1b07ef[_0xc9f6('0x54')]=_0x362bf2;return _0x1b07ef;})[_0xc9f6('0x46')](respondWithFilteredResult(_0x4c4393,_0x21f9f5))[_0xc9f6('0x55')](handleError(_0x4c4393,null));};exports[_0xc9f6('0x56')]=function(_0x57df38,_0x58ea32){var _0x4d4253={'raw':![],'where':{'id':_0x57df38[_0xc9f6('0x57')]['id']}},_0x438602={};_0x438602['model']=_['keys'](db[_0xc9f6('0x24')][_0xc9f6('0x25')]);_0x438602[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x57df38[_0xc9f6('0x28')]);_0x438602[_0xc9f6('0x2b')]=_[_0xc9f6('0x2d')](_0x438602[_0xc9f6('0x26')],_0x438602[_0xc9f6('0x28')]);_0x4d4253[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0x438602[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x57df38[_0xc9f6('0x28')][_0xc9f6('0x2e')]));_0x4d4253[_0xc9f6('0x2c')]=_0x4d4253[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0x4d4253[_0xc9f6('0x2c')]:_0x438602[_0xc9f6('0x26')];if(_0x57df38[_0xc9f6('0x28')]['includeAll']){_0x4d4253[_0xc9f6('0x3c')]=[{'all':!![]}];}_0x4d4253=_[_0xc9f6('0x38')]({},_0x4d4253,_0x57df38[_0xc9f6('0x3b')]);return db[_0xc9f6('0x24')][_0xc9f6('0x58')](_0x4d4253)[_0xc9f6('0x46')](handleEntityNotFound(_0x58ea32,null))['then'](respondWithResult(_0x58ea32,null))[_0xc9f6('0x55')](handleError(_0x58ea32,null));};exports['create']=function(_0x4288c3,_0x24439a){return db[_0xc9f6('0x24')][_0xc9f6('0x59')](_0x4288c3['body'],{})['then'](respondWithResult(_0x24439a,0xc9))[_0xc9f6('0x55')](handleError(_0x24439a,null));};exports[_0xc9f6('0x1c')]=function(_0x2acb5d,_0x513a8b){if(_0x2acb5d[_0xc9f6('0x5a')]['id']){delete _0x2acb5d[_0xc9f6('0x5a')]['id'];}return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x2acb5d[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x513a8b,null))[_0xc9f6('0x46')](saveUpdates(_0x2acb5d[_0xc9f6('0x5a')],null))[_0xc9f6('0x46')](respondWithResult(_0x513a8b,null))[_0xc9f6('0x55')](handleError(_0x513a8b,null));};exports['destroy']=function(_0x5043d4,_0x3a6ecb){return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x5043d4[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x3a6ecb,null))[_0xc9f6('0x46')](removeEntity(_0x3a6ecb,null))['catch'](handleError(_0x3a6ecb,null));};exports['describe']=function(_0x573794,_0xb7ea15){return db[_0xc9f6('0x24')]['describe']()[_0xc9f6('0x46')](respondWithResult(_0xb7ea15,null))['catch'](handleError(_0xb7ea15,null));};exports['addMessage']=function(_0x5d5cb2,_0x27bdb6,_0x1dce9c){return db[_0xc9f6('0x43')]['find']({'where':{'id':_0x5d5cb2[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x27bdb6,null))[_0xc9f6('0x46')](function(_0x465309){if(_0x465309){return _0x465309['addMessage'](_0x5d5cb2[_0xc9f6('0x5a')][_0xc9f6('0x5b')],_['omit'](_0x5d5cb2[_0xc9f6('0x5a')],[_0xc9f6('0x5b'),'id'])||{});}})['then'](respondWithResult(_0x27bdb6,null))[_0xc9f6('0x55')](handleError(_0x27bdb6,null));};exports[_0xc9f6('0x5c')]=function(_0x31791e,_0x33d288,_0x4d302f){var _0xaf916b={'raw':![],'where':{}};var _0x2838da={};var _0xddf559={'count':0x0,'rows':[]};return db[_0xc9f6('0x24')]['findOne']({'where':{'id':_0x31791e[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x33d288,null))['then'](function(_0xd3ed2f){if(_0xd3ed2f){_0x2838da[_0xc9f6('0x26')]=_['keys'](db[_0xc9f6('0x43')]['rawAttributes']);_0x2838da[_0xc9f6('0x28')]=_[_0xc9f6('0x27')](_0x31791e[_0xc9f6('0x28')]);_0x2838da[_0xc9f6('0x2b')]=_[_0xc9f6('0x2d')](_0x2838da['model'],_0x2838da[_0xc9f6('0x28')]);_0xaf916b[_0xc9f6('0x2c')]=_[_0xc9f6('0x2d')](_0x2838da[_0xc9f6('0x26')],qs[_0xc9f6('0x2e')](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x2e')]));_0xaf916b[_0xc9f6('0x2c')]=_0xaf916b[_0xc9f6('0x2c')][_0xc9f6('0x2f')]?_0xaf916b['attributes']:_0x2838da[_0xc9f6('0x26')];if(!_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x30')](_0xc9f6('0x31'))){_0xaf916b[_0xc9f6('0x17')]=qs['limit'](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x17')]);_0xaf916b['offset']=qs['offset'](_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x32')]);}_0xaf916b['order']=qs[_0xc9f6('0x34')](_0x31791e['query']['sort']);_0xaf916b[_0xc9f6('0x35')]=qs[_0xc9f6('0x2b')](_[_0xc9f6('0x36')](_0x31791e['query'],_0x2838da[_0xc9f6('0x2b')]));_0xaf916b[_0xc9f6('0x35')][_0xc9f6('0x5d')]=_0xd3ed2f['id'];if(_0x31791e[_0xc9f6('0x28')]['filter']){_0xaf916b[_0xc9f6('0x35')]=_[_0xc9f6('0x38')](_0xaf916b[_0xc9f6('0x35')],{'$or':_['map'](_0xaf916b[_0xc9f6('0x2c')],function(_0x385883){var _0x5859f8={};_0x5859f8[_0x385883]={'$like':'%'+_0x31791e[_0xc9f6('0x28')]['filter']+'%'};return _0x5859f8;})});}if(_0x31791e[_0xc9f6('0x28')][_0xc9f6('0x5e')]){var _0x2b1483=_0x31791e['query'][_0xc9f6('0x5e')][_0xc9f6('0x5f')](',');var _0x1eaeda={};_0x1eaeda[_0x2b1483[0x0]]={'$gte':moment(_0x2b1483[0x1])[_0xc9f6('0x60')](_0xc9f6('0x61'))};_0xaf916b[_0xc9f6('0x35')]=_['merge'](_0xaf916b[_0xc9f6('0x35')],_0x1eaeda);}_0xaf916b=_[_0xc9f6('0x38')]({},_0xaf916b,_0x31791e[_0xc9f6('0x3b')]);return db[_0xc9f6('0x43')][_0xc9f6('0x16')]({'where':_0xaf916b[_0xc9f6('0x35')]})[_0xc9f6('0x46')](function(_0x139231){_0xddf559[_0xc9f6('0x16')]=_0x139231;if(_0x31791e['query'][_0xc9f6('0x47')]){_0xaf916b[_0xc9f6('0x3c')]=[{'all':!![]}];}return db[_0xc9f6('0x43')][_0xc9f6('0x53')](_0xaf916b);})[_0xc9f6('0x46')](function(_0x2b6c8e){_0xddf559[_0xc9f6('0x54')]=_0x2b6c8e;return _0xddf559;});}})['then'](respondWithFilteredResult(_0x33d288,_0xaf916b))[_0xc9f6('0x55')](handleError(_0x33d288,null));};exports[_0xc9f6('0x62')]=function(_0x300dc1,_0x5e896b,_0x52de8f){return db[_0xc9f6('0x24')][_0xc9f6('0x58')]({'where':{'id':_0x300dc1[_0xc9f6('0x57')]['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x5e896b,null))[_0xc9f6('0x46')](function(_0x4d140f){if(_0x4d140f){return _0x4d140f[_0xc9f6('0x63')](_0x300dc1[_0xc9f6('0x5a')][_0xc9f6('0x5b')],_[_0xc9f6('0x64')](_0x300dc1['body'],['ids','id'])||{})[_0xc9f6('0x65')](function(){return db[_0xc9f6('0x3e')][_0xc9f6('0x53')]({'attributes':['id',_0xc9f6('0x21'),'color'],'where':{'id':_0x300dc1[_0xc9f6('0x5a')][_0xc9f6('0x5b')]}});})[_0xc9f6('0x46')](function(_0x4cd190){socket[_0xc9f6('0x66')](_0xc9f6('0x67'),{'id':Number(_0x300dc1[_0xc9f6('0x57')]['id']),'tags':_0x4cd190||[]});return{'id':Number(_0x300dc1[_0xc9f6('0x57')]['id']),'tags':_0x4cd190||[]};});}})[_0xc9f6('0x46')](respondWithResult(_0x5e896b,null))['catch'](handleError(_0x5e896b,null));};exports[_0xc9f6('0x68')]=function(_0x1f8a71,_0x4031f6,_0x3b5791){var _0x2c6711;return db['SmsInteraction'][_0xc9f6('0x58')]({'where':{'id':_0x1f8a71['params']['id']}})[_0xc9f6('0x46')](handleEntityNotFound(_0x4031f6,null))['then'](function(_0x286b92){if(_0x286b92){return _0x286b92['removeTags'](_0x1f8a71[_0xc9f6('0x28')][_0xc9f6('0x5b')]);}})[_0xc9f6('0x46')](respondWithStatusCode(_0x4031f6,null))[_0xc9f6('0x55')](handleError(_0x4031f6,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index fccc7bd..1fb7f61 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 _0xc398=['../../mysqldb','SmsInteraction','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2aae31,_0x1014a2){var _0x379006=function(_0x5345ae){while(--_0x5345ae){_0x2aae31['push'](_0x2aae31['shift']());}};_0x379006(++_0x1014a2);}(_0xc398,0x1df));var _0x8c39=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0xc398[_0x2085f3];return _0x384e3c;};'use strict';var EventEmitter=require(_0x8c39('0x0'));var SmsInteraction=require(_0x8c39('0x1'))['db'][_0x8c39('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c39('0x3'),'afterDestroy':_0x8c39('0x4')};function emitEvent(_0x2686d1){return function(_0x3e5a40,_0x4ea6a0,_0x46687e){SmsInteractionEvents['emit'](_0x2686d1+':'+_0x3e5a40['id'],_0x3e5a40);SmsInteractionEvents[_0x8c39('0x5')](_0x2686d1,_0x3e5a40);_0x46687e(null);};}for(var e in events){if(events[_0x8c39('0x6')](e)){var event=events[e];SmsInteraction[_0x8c39('0x7')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x0b56=['hasOwnProperty','hook','exports','events','setMaxListeners','save','update','emit'];(function(_0x3110e2,_0x3a1b12){var _0x315c40=function(_0x58f5a6){while(--_0x58f5a6){_0x3110e2['push'](_0x3110e2['shift']());}};_0x315c40(++_0x3a1b12);}(_0x0b56,0x1bb));var _0x60b5=function(_0x5bb39e,_0x53f22a){_0x5bb39e=_0x5bb39e-0x0;var _0x438f88=_0x0b56[_0x5bb39e];return _0x438f88;};'use strict';var EventEmitter=require(_0x60b5('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x60b5('0x1')](0x0);var events={'afterCreate':_0x60b5('0x2'),'afterUpdate':_0x60b5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1c107a){return function(_0x1f9e2a,_0x1ea89c,_0x2f7cf1){SmsInteractionEvents[_0x60b5('0x4')](_0x1c107a+':'+_0x1f9e2a['id'],_0x1f9e2a);SmsInteractionEvents['emit'](_0x1c107a,_0x1f9e2a);_0x2f7cf1(null);};}for(var e in events){if(events[_0x60b5('0x5')](e)){var event=events[e];SmsInteraction[_0x60b5('0x6')](e,emitEvent(event));}}module[_0x60b5('0x7')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index cf06b6d..5204120 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 _0x9f39=['../../config/logger','moment','bluebird','request-promise','define','SmsInteraction','sms_interactions','lodash','util'];(function(_0x4489c3,_0x72c887){var _0x4dbe04=function(_0x4ccae6){while(--_0x4ccae6){_0x4489c3['push'](_0x4489c3['shift']());}};_0x4dbe04(++_0x72c887);}(_0x9f39,0x181));var _0x99f3=function(_0x4b420f,_0x503b3f){_0x4b420f=_0x4b420f-0x0;var _0x210345=_0x9f39[_0x4b420f];return _0x210345;};'use strict';var _=require(_0x99f3('0x0'));var util=require(_0x99f3('0x1'));var logger=require(_0x99f3('0x2'))('api');var moment=require(_0x99f3('0x3'));var BPromise=require(_0x99f3('0x4'));var rp=require(_0x99f3('0x5'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3be2db,_0x4799ba){return _0x3be2db[_0x99f3('0x6')](_0x99f3('0x7'),attributes,{'tableName':_0x99f3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbc7=['moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','util','../../config/logger'];(function(_0x528bb5,_0x119c5b){var _0x58e8ca=function(_0x5a8077){while(--_0x5a8077){_0x528bb5['push'](_0x528bb5['shift']());}};_0x58e8ca(++_0x119c5b);}(_0xfbc7,0x134));var _0x7fbc=function(_0x1e379d,_0x2feab6){_0x1e379d=_0x1e379d-0x0;var _0x301e5c=_0xfbc7[_0x1e379d];return _0x301e5c;};'use strict';var _=require('lodash');var util=require(_0x7fbc('0x0'));var logger=require(_0x7fbc('0x1'))('api');var moment=require(_0x7fbc('0x2'));var BPromise=require(_0x7fbc('0x3'));var rp=require(_0x7fbc('0x4'));var attributes=require(_0x7fbc('0x5'));module[_0x7fbc('0x6')]=function(_0x2abe67,_0x5cb54b){return _0x2abe67[_0x7fbc('0x7')](_0x7fbc('0x8'),attributes,{'tableName':_0x7fbc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 527c670..91b33b5 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 _0xa35e=['request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa35e,0x85));var _0xea35=function(_0x1d94ed,_0x136a22){_0x1d94ed=_0x1d94ed-0x0;var _0x372100=_0xa35e[_0x1d94ed];return _0x372100;};'use strict';var _=require(_0xea35('0x0'));var util=require(_0xea35('0x1'));var moment=require('moment');var BPromise=require(_0xea35('0x2'));var rs=require(_0xea35('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xea35('0x4'));var logger=require(_0xea35('0x5'))(_0xea35('0x6'));var config=require('../../config/environment');var jayson=require(_0xea35('0x7'));var client=jayson[_0xea35('0x8')]['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xea35('0x9'))[_0xea35('0xa')](socket);function respondWithRpcPromise(_0x3b862c,_0x4d9292,_0x5ce19a){return new BPromise(function(_0x94776c,_0x3a6cfa){return client[_0xea35('0xb')](_0x3b862c,_0x5ce19a)[_0xea35('0xc')](function(_0x2cedcd){logger[_0xea35('0xd')](_0xea35('0xe'),_0x4d9292,_0xea35('0xf'));logger[_0xea35('0x10')](_0xea35('0x11'),_0x4d9292,_0xea35('0xf'),JSON[_0xea35('0x12')](_0x2cedcd));if(_0x2cedcd[_0xea35('0x13')]){if(_0x2cedcd[_0xea35('0x13')]['code']===0x1f4){logger['error'](_0xea35('0xe'),_0x4d9292,_0x2cedcd['error'][_0xea35('0x14')]);return _0x3a6cfa(_0x2cedcd['error'][_0xea35('0x14')]);}logger[_0xea35('0x13')](_0xea35('0xe'),_0x4d9292,_0x2cedcd[_0xea35('0x13')][_0xea35('0x14')]);return _0x94776c(_0x2cedcd['error'][_0xea35('0x14')]);}else{logger[_0xea35('0xd')](_0xea35('0xe'),_0x4d9292,_0xea35('0xf'));_0x94776c(_0x2cedcd[_0xea35('0x15')][_0xea35('0x14')]);}})['catch'](function(_0x161002){logger[_0xea35('0x13')](_0xea35('0xe'),_0x4d9292,_0x161002);_0x3a6cfa(_0x161002);});});}exports[_0xea35('0x16')]=function(_0x71774f){var _0x38bc55=this;return new Promise(function(_0xa18ae7,_0x42de62){return db[_0xea35('0x17')][_0xea35('0x18')](_0x71774f[_0xea35('0x19')],{'raw':_0x71774f['options']?_0x71774f[_0xea35('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71774f['options']?_0x71774f[_0xea35('0x1a')][_0xea35('0x1b')]||null:null,'attributes':_0x71774f[_0xea35('0x1a')]?_0x71774f[_0xea35('0x1a')][_0xea35('0x1c')]||null:null,'limit':_0x71774f[_0xea35('0x1a')]?_0x71774f[_0xea35('0x1a')][_0xea35('0x1d')]||null:null})[_0xea35('0xc')](function(_0x48eb6c){logger[_0xea35('0xd')]('UpdateSmsInteraction',_0x71774f);logger[_0xea35('0x10')](_0xea35('0x16'),_0x71774f,JSON[_0xea35('0x12')](_0x48eb6c));_0xa18ae7(_0x48eb6c);})['catch'](function(_0x543461){logger[_0xea35('0x13')](_0xea35('0x16'),_0x543461[_0xea35('0x14')],_0x71774f);_0x42de62(_0x38bc55['error'](0x1f4,_0x543461[_0xea35('0x14')]));});});};exports[_0xea35('0x1e')]=function(_0x1aa5da){return new Promise(function(_0x516451,_0x312261){return db[_0xea35('0x17')][_0xea35('0x1f')]({'where':_0x1aa5da['options']?_0x1aa5da[_0xea35('0x1a')]['where']||null:null})[_0xea35('0xc')](function(_0x3cbd4c){if(_0x3cbd4c){return _0x3cbd4c['addTags'](_0x1aa5da[_0xea35('0x19')][_0xea35('0x20')],_[_0xea35('0x21')](_0x1aa5da[_0xea35('0x19')],[_0xea35('0x20'),'id'])||{});}})[_0xea35('0x22')](function(_0x4845bf){logger[_0xea35('0xd')](_0xea35('0x23'),_0x1aa5da);logger['debug'](_0xea35('0x23'),_0x1aa5da,JSON[_0xea35('0x12')](_0x4845bf));_0x516451(_0x4845bf);})[_0xea35('0x24')](function(_0x26ed1a){logger[_0xea35('0x13')](_0xea35('0x23'),_0x26ed1a['message'],_0x1aa5da);_0x312261(_this[_0xea35('0x13')](0x1f4,_0x26ed1a['message']));});});}; \ No newline at end of file +var _0x0d13=['where','limit','UpdateSmsInteraction','catch','find','addTags','body','ids','omit','spread','AddTags','util','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','localhost','./smsInteraction.socket','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','update','options','raw'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x0d13,0x71));var _0x30d1=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x0d13[_0x75f869];return _0x10af8b;};'use strict';var _=require('lodash');var util=require(_0x30d1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x30d1('0x1'))['db'];var utils=require(_0x30d1('0x2'));var logger=require(_0x30d1('0x3'))(_0x30d1('0x4'));var config=require('../../config/environment');var jayson=require(_0x30d1('0x5'));var client=jayson[_0x30d1('0x6')][_0x30d1('0x7')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x30d1('0x8'),'port':0x18eb});require(_0x30d1('0x9'))['register'](socket);function respondWithRpcPromise(_0x441fa3,_0x536e4d,_0x1dfb87){return new BPromise(function(_0x4b225c,_0x30e1b1){return client['request'](_0x441fa3,_0x1dfb87)[_0x30d1('0xa')](function(_0x42312d){logger[_0x30d1('0xb')](_0x30d1('0xc'),_0x536e4d,'request\x20sent');logger[_0x30d1('0xd')](_0x30d1('0xe'),_0x536e4d,'request\x20sent',JSON[_0x30d1('0xf')](_0x42312d));if(_0x42312d[_0x30d1('0x10')]){if(_0x42312d['error'][_0x30d1('0x11')]===0x1f4){logger[_0x30d1('0x10')](_0x30d1('0xc'),_0x536e4d,_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);return _0x30e1b1(_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);}logger[_0x30d1('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x536e4d,_0x42312d['error'][_0x30d1('0x12')]);return _0x4b225c(_0x42312d[_0x30d1('0x10')][_0x30d1('0x12')]);}else{logger[_0x30d1('0xb')](_0x30d1('0xc'),_0x536e4d,_0x30d1('0x13'));_0x4b225c(_0x42312d['result'][_0x30d1('0x12')]);}})['catch'](function(_0x5860f8){logger[_0x30d1('0x10')](_0x30d1('0xc'),_0x536e4d,_0x5860f8);_0x30e1b1(_0x5860f8);});});}exports['UpdateSmsInteraction']=function(_0x8a4149){var _0x116734=this;return new Promise(function(_0x552157,_0x1bdcab){return db['SmsInteraction'][_0x30d1('0x14')](_0x8a4149['body'],{'raw':_0x8a4149[_0x30d1('0x15')]?_0x8a4149[_0x30d1('0x15')][_0x30d1('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a4149[_0x30d1('0x15')]?_0x8a4149['options'][_0x30d1('0x17')]||null:null,'attributes':_0x8a4149[_0x30d1('0x15')]?_0x8a4149['options']['attributes']||null:null,'limit':_0x8a4149[_0x30d1('0x15')]?_0x8a4149[_0x30d1('0x15')][_0x30d1('0x18')]||null:null})[_0x30d1('0xa')](function(_0x5cad9b){logger[_0x30d1('0xb')](_0x30d1('0x19'),_0x8a4149);logger[_0x30d1('0xd')](_0x30d1('0x19'),_0x8a4149,JSON[_0x30d1('0xf')](_0x5cad9b));_0x552157(_0x5cad9b);})[_0x30d1('0x1a')](function(_0x1a53c7){logger[_0x30d1('0x10')](_0x30d1('0x19'),_0x1a53c7[_0x30d1('0x12')],_0x8a4149);_0x1bdcab(_0x116734[_0x30d1('0x10')](0x1f4,_0x1a53c7[_0x30d1('0x12')]));});});};exports['AddTagsToSmsInteraction']=function(_0x3d4dcc){return new Promise(function(_0x3e2a7b,_0x497018){return db['SmsInteraction'][_0x30d1('0x1b')]({'where':_0x3d4dcc['options']?_0x3d4dcc['options'][_0x30d1('0x17')]||null:null})[_0x30d1('0xa')](function(_0x22ab38){if(_0x22ab38){return _0x22ab38[_0x30d1('0x1c')](_0x3d4dcc[_0x30d1('0x1d')][_0x30d1('0x1e')],_[_0x30d1('0x1f')](_0x3d4dcc[_0x30d1('0x1d')],[_0x30d1('0x1e'),'id'])||{});}})[_0x30d1('0x20')](function(_0xc06889){logger[_0x30d1('0xb')](_0x30d1('0x21'),_0x3d4dcc);logger['debug'](_0x30d1('0x21'),_0x3d4dcc,JSON[_0x30d1('0xf')](_0xc06889));_0x3e2a7b(_0xc06889);})['catch'](function(_0x1fef67){logger[_0x30d1('0x10')](_0x30d1('0x21'),_0x1fef67['message'],_0x3d4dcc);_0x497018(_this[_0x30d1('0x10')](0x1f4,_0x1fef67[_0x30d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0c4254b..e36b799 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 _0xf266=['save','remove','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0xadc19e,_0x5d422a){var _0x5dc2f7=function(_0x2646b6){while(--_0x2646b6){_0xadc19e['push'](_0xadc19e['shift']());}};_0x5dc2f7(++_0x5d422a);}(_0xf266,0x10f));var _0x6f26=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xf266[_0x92c450];return _0x2a9599;};'use strict';var SmsInteractionEvents=require(_0x6f26('0x0'));var events=[_0x6f26('0x1'),_0x6f26('0x2'),'update'];function createListener(_0x37d96e,_0x27fcea){return function(_0x39b415){_0x27fcea[_0x6f26('0x3')](_0x37d96e,_0x39b415);};}function removeListener(_0x3dfc3c,_0xc1ff94){return function(){SmsInteractionEvents[_0x6f26('0x4')](_0x3dfc3c,_0xc1ff94);};}exports[_0x6f26('0x5')]=function(_0x558d2b){for(var _0x50f78f=0x0,_0x97423a=events[_0x6f26('0x6')];_0x50f78f<_0x97423a;_0x50f78f++){var _0x2e4f09=events[_0x50f78f];var _0x3ad233=createListener(_0x6f26('0x7')+_0x2e4f09,_0x558d2b);SmsInteractionEvents['on'](_0x2e4f09,_0x3ad233);}}; \ No newline at end of file +var _0xe469=['./smsInteraction.events','save','remove','update','emit'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xe469,0x1d6));var _0x9e46=function(_0x129a9a,_0x42d62f){_0x129a9a=_0x129a9a-0x0;var _0x3a1ac2=_0xe469[_0x129a9a];return _0x3a1ac2;};'use strict';var SmsInteractionEvents=require(_0x9e46('0x0'));var events=[_0x9e46('0x1'),_0x9e46('0x2'),_0x9e46('0x3')];function createListener(_0x521d2b,_0x1fb2fd){return function(_0x3ef21e){_0x1fb2fd[_0x9e46('0x4')](_0x521d2b,_0x3ef21e);};}function removeListener(_0x4bbf89,_0x2d2c93){return function(){SmsInteractionEvents['removeListener'](_0x4bbf89,_0x2d2c93);};}exports['register']=function(_0x577af8){for(var _0x1be16e=0x0,_0x278971=events['length'];_0x1be16e<_0x278971;_0x1be16e++){var _0x5c3eaa=events[_0x1be16e];var _0x130488=createListener('smsInteraction:'+_0x5c3eaa,_0x577af8);SmsInteractionEvents['on'](_0x5c3eaa,_0x130488);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 90c3845..53228c1 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 _0x73ed=['../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','post','tracked','sms','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','express','Router'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x73ed,0x168));var _0xd73e=function(_0x31081b,_0x17d016){_0x31081b=_0x31081b-0x0;var _0x5c4d77=_0x73ed[_0x31081b];return _0x5c4d77;};'use strict';var multer=require('multer');var util=require(_0xd73e('0x0'));var path=require(_0xd73e('0x1'));var express=require(_0xd73e('0x2'));var router=express[_0xd73e('0x3')]();var auth=require(_0xd73e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd73e('0x5'));var controller=require(_0xd73e('0x6'));router[_0xd73e('0x7')]('/',auth[_0xd73e('0x8')](),controller[_0xd73e('0x9')]);router[_0xd73e('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xd73e('0xa')]);router[_0xd73e('0x7')](_0xd73e('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd73e('0xc')]('/',auth[_0xd73e('0x8')](),interaction[_0xd73e('0xd')](_0xd73e('0xe'),'smsmessage:create'),controller[_0xd73e('0xf')]);router[_0xd73e('0xc')](_0xd73e('0x10'),controller[_0xd73e('0x11')]);router[_0xd73e('0x12')](_0xd73e('0xb'),auth[_0xd73e('0x8')](),controller[_0xd73e('0x13')]);router[_0xd73e('0x12')](_0xd73e('0x14'),auth[_0xd73e('0x8')](),controller[_0xd73e('0x15')]);router[_0xd73e('0x12')](_0xd73e('0x16'),auth[_0xd73e('0x8')](),controller[_0xd73e('0x17')]);router['delete'](_0xd73e('0xb'),auth['isAuthenticated'](),controller[_0xd73e('0x18')]);module[_0xd73e('0x19')]=router; \ No newline at end of file +var _0xaa63=['update','/:id/accept','/:id/reject','reject','delete','destroy','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','sms','create','status','put'];(function(_0x2f7e77,_0x3a4c36){var _0x243cab=function(_0x59c8ed){while(--_0x59c8ed){_0x2f7e77['push'](_0x2f7e77['shift']());}};_0x243cab(++_0x3a4c36);}(_0xaa63,0x127));var _0x3aa6=function(_0x240e6c,_0x456ccc){_0x240e6c=_0x240e6c-0x0;var _0x1aae46=_0xaa63[_0x240e6c];return _0x1aae46;};'use strict';var multer=require('multer');var util=require(_0x3aa6('0x0'));var path=require(_0x3aa6('0x1'));var express=require('express');var router=express[_0x3aa6('0x2')]();var auth=require(_0x3aa6('0x3'));var interaction=require(_0x3aa6('0x4'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x3aa6('0x5')]('/',auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x7')]);router[_0x3aa6('0x5')](_0x3aa6('0x8'),auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x9')]);router[_0x3aa6('0x5')](_0x3aa6('0xa'),auth[_0x3aa6('0x6')](),controller['show']);router[_0x3aa6('0xb')]('/',auth[_0x3aa6('0x6')](),interaction[_0x3aa6('0xc')](_0x3aa6('0xd'),'smsmessage:create'),controller[_0x3aa6('0xe')]);router[_0x3aa6('0xb')]('/:id/status',controller[_0x3aa6('0xf')]);router[_0x3aa6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3aa6('0x11')]);router[_0x3aa6('0x10')](_0x3aa6('0x12'),auth[_0x3aa6('0x6')](),controller['accept']);router['put'](_0x3aa6('0x13'),auth[_0x3aa6('0x6')](),controller[_0x3aa6('0x14')]);router[_0x3aa6('0x15')](_0x3aa6('0xa'),auth['isAuthenticated'](),controller[_0x3aa6('0x16')]);module[_0x3aa6('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d64dccd..6a7b38e 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 _0x2706=['BOOLEAN','out','STRING','DATE','exports','TEXT','medium'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x2706,0x107));var _0x6270=function(_0x509f0b,_0x4a6bc3){_0x509f0b=_0x509f0b-0x0;var _0x51991d=_0x2706[_0x509f0b];return _0x51991d;};'use strict';var Sequelize=require('sequelize');module[_0x6270('0x0')]={'body':{'type':Sequelize[_0x6270('0x1')](_0x6270('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x6270('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x6270('0x4')),'defaultValue':_0x6270('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6270('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6270('0x5')]},'readAt':{'type':Sequelize[_0x6270('0x6')]},'secret':{'type':Sequelize[_0x6270('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x6bac=['BOOLEAN','ENUM','STRING','DATE','sequelize','TEXT','medium'];(function(_0x13cafd,_0x30c87f){var _0x29e346=function(_0x2ccf54){while(--_0x2ccf54){_0x13cafd['push'](_0x13cafd['shift']());}};_0x29e346(++_0x30c87f);}(_0x6bac,0xa5));var _0xc6ba=function(_0x3851d1,_0x4dab08){_0x3851d1=_0x3851d1-0x0;var _0x13180f=_0x6bac[_0x3851d1];return _0x13180f;};'use strict';var Sequelize=require(_0xc6ba('0x0'));module['exports']={'body':{'type':Sequelize[_0xc6ba('0x1')](_0xc6ba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc6ba('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc6ba('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xc6ba('0x5')]},'readAt':{'type':Sequelize[_0xc6ba('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c301d79..9121ebd 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 _0xae59=['acceptmessage','reject','agent','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','rejectmessage','received\x20delivery\x20report\x20from','inspect','type','twilio','MessageSid','messageId','plivo','MessageUUID','sent','delivered','Status','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./smsMessage.socket','register','jayson/promise','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','rawAttributes','model','dateStart','query','dateEnd','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','add','merge','map','filter','options','SmsMessage','includeAll','include','rows','show','params','keys','length','body','find','sms-interactions','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager'];(function(_0x2efd7f,_0xa9b24f){var _0x4063a4=function(_0x55ce82){while(--_0x55ce82){_0x2efd7f['push'](_0x2efd7f['shift']());}};_0x4063a4(++_0xa9b24f);}(_0xae59,0x8d));var _0x9ae5=function(_0x43b457,_0x4e4f0f){_0x43b457=_0x43b457-0x0;var _0x453bcd=_0xae59[_0x43b457];return _0x453bcd;};'use strict';var jsonpatch=require(_0x9ae5('0x0'));var rp=require('request-promise');var moment=require(_0x9ae5('0x1'));var BPromise=require(_0x9ae5('0x2'));var Mustache=require('mustache');var util=require(_0x9ae5('0x3'));var path=require('path');var sox=require(_0x9ae5('0x4'));var csv=require('to-csv');var ejs=require(_0x9ae5('0x5'));var fs=require('fs');var _=require(_0x9ae5('0x6'));var squel=require(_0x9ae5('0x7'));var crypto=require(_0x9ae5('0x8'));var jsforce=require(_0x9ae5('0x9'));var deskjs=require(_0x9ae5('0xa'));var toCsv=require(_0x9ae5('0xb'));var querystring=require(_0x9ae5('0xc'));var Papa=require(_0x9ae5('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x9ae5('0xe'));var config=require(_0x9ae5('0xf'));var db=require(_0x9ae5('0x10'))['db'];var socket=require(_0x9ae5('0x11'))({'host':_0x9ae5('0x12'),'port':0x18eb});require(_0x9ae5('0x13'))[_0x9ae5('0x14')](socket);var jayson=require(_0x9ae5('0x15'));var client=jayson[_0x9ae5('0x16')]['http']({'port':0x232c});var client9002=jayson[_0x9ae5('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d9a1d,_0x235f8e,_0x41a930,_0x52dd6d){return new BPromise(function(_0x23abf0,_0x19e330){var _0x23e504=_0x52dd6d||client;return _0x23e504[_0x9ae5('0x17')](_0x5d9a1d,_0x41a930)[_0x9ae5('0x18')](function(_0x6bd78c){logger[_0x9ae5('0x19')](_0x9ae5('0x1a'),_0x235f8e,_0x9ae5('0x1b'));logger[_0x9ae5('0x1c')](_0x9ae5('0x1d'),_0x235f8e,_0x9ae5('0x1b'),JSON[_0x9ae5('0x1e')](_0x6bd78c));if(_0x6bd78c[_0x9ae5('0x1f')]){if(_0x6bd78c[_0x9ae5('0x1f')]['code']===0x1f4){logger[_0x9ae5('0x1f')](_0x9ae5('0x1a'),_0x235f8e,_0x6bd78c[_0x9ae5('0x1f')][_0x9ae5('0x20')]);return _0x19e330(_0x6bd78c['error']['message']);}logger[_0x9ae5('0x1f')](_0x9ae5('0x1a'),_0x235f8e,_0x6bd78c[_0x9ae5('0x1f')]['message']);return _0x23abf0(_0x6bd78c[_0x9ae5('0x1f')][_0x9ae5('0x20')]);}else{logger[_0x9ae5('0x19')](_0x9ae5('0x1a'),_0x235f8e,_0x9ae5('0x1b'));_0x23abf0(_0x6bd78c['result'][_0x9ae5('0x20')]);}})[_0x9ae5('0x21')](function(_0x2ed1d1){logger['error']('SmsMessage,\x20%s,\x20%s',_0x235f8e,_0x2ed1d1);_0x19e330(_0x2ed1d1);});});}function respondWithStatusCode(_0x362a20,_0x1d4624){_0x1d4624=_0x1d4624||0xcc;return function(_0x5bf6d7){if(_0x5bf6d7){return _0x362a20[_0x9ae5('0x22')](_0x1d4624);}return _0x362a20['status'](_0x1d4624)['end']();};}function respondWithResult(_0x535734,_0x30e8d0){_0x30e8d0=_0x30e8d0||0xc8;return function(_0x4a39b1){if(_0x4a39b1){return _0x535734[_0x9ae5('0x23')](_0x30e8d0)[_0x9ae5('0x24')](_0x4a39b1);}};}function respondWithFilteredResult(_0x2733c1,_0x29d330){return function(_0x379f2b){if(_0x379f2b){var _0x11c509=_0x379f2b[_0x9ae5('0x25')],_0x5852fa=_0x29d330[_0x9ae5('0x26')],_0x4d9aba=_0x29d330[_0x9ae5('0x26')]+_0x29d330[_0x9ae5('0x27')],_0xf4dbe4;if(_0x4d9aba>=_0x11c509){_0x4d9aba=_0x11c509;_0xf4dbe4=0xc8;}else{_0xf4dbe4=0xce;}_0x2733c1[_0x9ae5('0x23')](_0xf4dbe4);return _0x2733c1[_0x9ae5('0x28')](_0x9ae5('0x29'),_0x5852fa+'-'+_0x4d9aba+'/'+_0x11c509)[_0x9ae5('0x24')](_0x379f2b);}return null;};}function patchUpdates(_0x496b44){return function(_0x477249){try{jsonpatch[_0x9ae5('0x2a')](_0x477249,_0x496b44,!![]);}catch(_0xbe85b6){return BPromise['reject'](_0xbe85b6);}return _0x477249[_0x9ae5('0x2b')]();};}function saveUpdates(_0x346014,_0x1e58d5){return function(_0x1d3873){if(_0x1d3873){return _0x1d3873[_0x9ae5('0x2c')](_0x346014)[_0x9ae5('0x18')](function(_0x5ca9b9){return _0x5ca9b9;});}return null;};}function removeEntity(_0xcb0d52,_0x43aba4){return function(_0x410932){if(_0x410932){return _0x410932[_0x9ae5('0x2d')]()[_0x9ae5('0x18')](function(){_0xcb0d52[_0x9ae5('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54bd77,_0x56e5ed){return function(_0x2813b4){if(!_0x2813b4){_0x54bd77['sendStatus'](0x194);}return _0x2813b4;};}function handleError(_0x188a28,_0x227a67){_0x227a67=_0x227a67||0x1f4;return function(_0x11aebf){logger[_0x9ae5('0x1f')](_0x11aebf[_0x9ae5('0x2e')]);if(_0x11aebf[_0x9ae5('0x2f')]){delete _0x11aebf[_0x9ae5('0x2f')];}_0x188a28[_0x9ae5('0x23')](_0x227a67)[_0x9ae5('0x30')](_0x11aebf);};}exports[_0x9ae5('0x31')]=function(_0xdeef07,_0x5b5dee){var _0x28a6a3={},_0x308a41={},_0xd2ee66={'count':0x0,'rows':[]};var _0x4870cd=db['SmsMessage'][_0x9ae5('0x32')];_0x308a41[_0x9ae5('0x33')]=_['keys'](_0x4870cd);var _0x4983e5={'dateStart':_0xdeef07['query'][_0x9ae5('0x34')],'dateEnd':_0xdeef07[_0x9ae5('0x35')][_0x9ae5('0x36')]};delete _0xdeef07[_0x9ae5('0x35')][_0x9ae5('0x34')];delete _0xdeef07[_0x9ae5('0x35')]['dateEnd'];_0x308a41[_0x9ae5('0x35')]=_['keys'](_0xdeef07['query']);_0x308a41[_0x9ae5('0x37')]=_['intersection'](_0x308a41['model'],_0x308a41['query']);_0x28a6a3[_0x9ae5('0x38')]=_[_0x9ae5('0x39')](_0x308a41['model'],qs[_0x9ae5('0x3a')](_0xdeef07[_0x9ae5('0x35')]['fields']));_0x28a6a3[_0x9ae5('0x38')]=_0x28a6a3['attributes']['length']?_0x28a6a3[_0x9ae5('0x38')]:_0x308a41[_0x9ae5('0x33')];if(!_0xdeef07[_0x9ae5('0x35')]['hasOwnProperty'](_0x9ae5('0x3b'))){_0x28a6a3[_0x9ae5('0x27')]=qs['limit'](_0xdeef07[_0x9ae5('0x35')][_0x9ae5('0x27')]);_0x28a6a3[_0x9ae5('0x26')]=qs[_0x9ae5('0x26')](_0xdeef07[_0x9ae5('0x35')][_0x9ae5('0x26')]);}_0x28a6a3[_0x9ae5('0x3c')]=qs[_0x9ae5('0x3d')](_0xdeef07[_0x9ae5('0x35')][_0x9ae5('0x3d')]);_0x28a6a3[_0x9ae5('0x3e')]=qs[_0x9ae5('0x37')](_[_0x9ae5('0x3f')](_0xdeef07['query'],_0x308a41['filters']));if(_0x4983e5[_0x9ae5('0x34')]){if(_0x4983e5['dateEnd']){_0x4983e5['dateEnd']=moment(_0x4983e5[_0x9ae5('0x36')])[_0x9ae5('0x40')](0x1,'day');}else{_0x4983e5[_0x9ae5('0x36')]=moment(_0x4983e5[_0x9ae5('0x34')])[_0x9ae5('0x40')](0x1,'day');}_[_0x9ae5('0x41')](_0x28a6a3[_0x9ae5('0x3e')],{'createdAt':{'$gte':_0x4983e5[_0x9ae5('0x34')],'$lte':_0x4983e5[_0x9ae5('0x36')]}});}if(_0xdeef07['query']['filter']){_0x28a6a3[_0x9ae5('0x3e')]=_[_0x9ae5('0x41')](_0x28a6a3['where'],{'$or':_[_0x9ae5('0x42')](_0x28a6a3['attributes'],function(_0x47bd7a){var _0x470dfc={};_0x470dfc[_0x47bd7a]={'$like':'%'+_0xdeef07['query'][_0x9ae5('0x43')]+'%'};return _0x470dfc;})});}_0x28a6a3=_[_0x9ae5('0x41')]({},_0x28a6a3,_0xdeef07[_0x9ae5('0x44')]);var _0x4151d7={'where':_0x28a6a3[_0x9ae5('0x3e')]};return db[_0x9ae5('0x45')][_0x9ae5('0x25')](_0x4151d7)['then'](function(_0x5c53a4){_0xd2ee66[_0x9ae5('0x25')]=_0x5c53a4;if(_0xdeef07['query'][_0x9ae5('0x46')]){_0x28a6a3[_0x9ae5('0x47')]=[{'all':!![]}];}return db[_0x9ae5('0x45')]['findAll'](_0x28a6a3);})[_0x9ae5('0x18')](function(_0x2968ad){_0xd2ee66[_0x9ae5('0x48')]=_0x2968ad;return _0xd2ee66;})['then'](respondWithFilteredResult(_0x5b5dee,_0x28a6a3))[_0x9ae5('0x21')](handleError(_0x5b5dee,null));};exports[_0x9ae5('0x49')]=function(_0x2d6eca,_0x53ddd7){var _0x4ec713={'raw':!![],'where':{'id':_0x2d6eca[_0x9ae5('0x4a')]['id']}},_0x228833={};_0x228833[_0x9ae5('0x33')]=_[_0x9ae5('0x4b')](db[_0x9ae5('0x45')][_0x9ae5('0x32')]);_0x228833[_0x9ae5('0x35')]=_['keys'](_0x2d6eca[_0x9ae5('0x35')]);_0x228833[_0x9ae5('0x37')]=_[_0x9ae5('0x39')](_0x228833[_0x9ae5('0x33')],_0x228833[_0x9ae5('0x35')]);_0x4ec713[_0x9ae5('0x38')]=_[_0x9ae5('0x39')](_0x228833[_0x9ae5('0x33')],qs[_0x9ae5('0x3a')](_0x2d6eca['query'][_0x9ae5('0x3a')]));_0x4ec713[_0x9ae5('0x38')]=_0x4ec713['attributes'][_0x9ae5('0x4c')]?_0x4ec713[_0x9ae5('0x38')]:_0x228833[_0x9ae5('0x33')];if(_0x2d6eca['query'][_0x9ae5('0x46')]){_0x4ec713[_0x9ae5('0x47')]=[{'all':!![]}];}_0x4ec713=_['merge']({},_0x4ec713,_0x2d6eca['options']);return db[_0x9ae5('0x45')]['find'](_0x4ec713)[_0x9ae5('0x18')](handleEntityNotFound(_0x53ddd7,null))[_0x9ae5('0x18')](respondWithResult(_0x53ddd7,null))['catch'](handleError(_0x53ddd7,null));};exports['create']=function(_0x58262a,_0x290b1c){return db[_0x9ae5('0x45')]['create'](_0x58262a[_0x9ae5('0x4d')],{})['then'](respondWithResult(_0x290b1c,0xc9))[_0x9ae5('0x21')](handleError(_0x290b1c,null));};exports[_0x9ae5('0x2c')]=function(_0x1cad9f,_0xae806f){if(_0x1cad9f[_0x9ae5('0x4d')]['id']){delete _0x1cad9f[_0x9ae5('0x4d')]['id'];}return db[_0x9ae5('0x45')][_0x9ae5('0x4e')]({'where':{'id':_0x1cad9f[_0x9ae5('0x4a')]['id']}})['then'](handleEntityNotFound(_0xae806f,null))['then'](saveUpdates(_0x1cad9f['body'],null))[_0x9ae5('0x18')](respondWithResult(_0xae806f,null))[_0x9ae5('0x21')](handleError(_0xae806f,null));};exports[_0x9ae5('0x2d')]=function(_0x17611a,_0x540343){return db[_0x9ae5('0x45')]['find']({'where':{'id':_0x17611a[_0x9ae5('0x4a')]['id']}})[_0x9ae5('0x18')](handleEntityNotFound(_0x540343,null))[_0x9ae5('0x18')](removeEntity(_0x540343,null))[_0x9ae5('0x21')](handleError(_0x540343,null));};exports['describe']=function(_0x3e6666,_0x5ca1e2){return db['SmsMessage']['describe']()[_0x9ae5('0x18')](respondWithResult(_0x5ca1e2,null))['catch'](handleError(_0x5ca1e2,null));};var interaction_log=require('../../config/logger')(_0x9ae5('0x4f'));exports[_0x9ae5('0x50')]=function(_0x888140,_0x55e3b5,_0x36926d){var _0x1ec1d2={'channel':_0x9ae5('0x51')};if(_0x888140[_0x9ae5('0x4d')]['id']){delete _0x888140[_0x9ae5('0x4d')]['id'];}_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x52')]=!![];_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x53')]=moment()[_0x9ae5('0x54')](_0x9ae5('0x55'));_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x56')]=_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x56')]||_0x888140[_0x9ae5('0x57')]['id'];return db[_0x9ae5('0x45')][_0x9ae5('0x4e')]({'where':{'id':_0x888140[_0x9ae5('0x4a')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0x9ae5('0x58')}]})['then'](handleEntityNotFound(_0x55e3b5,null))[_0x9ae5('0x18')](saveUpdates(_0x888140[_0x9ae5('0x4d')],null))[_0x9ae5('0x18')](function(_0x53787b){if(_0x53787b){_0x1ec1d2[_0x9ae5('0x20')]=_0x53787b[_0x9ae5('0x59')]({'plain':!![]});return db['SmsInteraction'][_0x9ae5('0x4e')]({'where':{'id':_0x53787b[_0x9ae5('0x5a')]}});}return null;})['then'](handleEntityNotFound(_0x55e3b5,null))[_0x9ae5('0x18')](function(_0x47c956){if(_0x47c956){return _0x47c956[_0x9ae5('0x2c')]({'UserId':_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x56')],'read1stAt':_[_0x9ae5('0x5b')](_0x47c956[_0x9ae5('0x5c')])?moment()[_0x9ae5('0x54')](_0x9ae5('0x55')):undefined});}return null;})[_0x9ae5('0x18')](function(_0x4d15cf){if(_0x4d15cf){_0x1ec1d2[_0x9ae5('0x5d')]=_0x4d15cf[_0x9ae5('0x59')]({'plain':!![]});interaction_log[_0x9ae5('0x19')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x888140[_0x9ae5('0x57')]['id'],_0x888140[_0x9ae5('0x57')]['name'],_0x888140[_0x9ae5('0x57')][_0x9ae5('0x5e')],_0x1ec1d2['interaction']['id'],_0x888140[_0x9ae5('0x4d')]?JSON[_0x9ae5('0x1e')](_0x888140[_0x9ae5('0x4d')]):_0x9ae5('0x5f'));return respondWithRpcPromise(_0x9ae5('0x60'),_0x9ae5('0x61'),_0x1ec1d2);}return null;})[_0x9ae5('0x18')](function(_0x24f3d5){if(_0x24f3d5){if(_0x888140[_0x9ae5('0x4d')][_0x9ae5('0x62')]){_0x1ec1d2['message']['interface']=util[_0x9ae5('0x54')](_0x9ae5('0x63'),_0x888140[_0x9ae5('0x57')]['name']);_0x1ec1d2[_0x9ae5('0x20')][_0x9ae5('0x64')]=_0x1ec1d2[_0x9ae5('0x64')];_0x1ec1d2[_0x9ae5('0x20')][_0x9ae5('0x65')]='accept';return respondWithRpcPromise(_0x9ae5('0x66'),'EventManager',{'event':_0x9ae5('0x67'),'message':_0x1ec1d2['message']},client9002)[_0x9ae5('0x18')](function(){return _0x1ec1d2;});}return _0x1ec1d2;}return null;})['then'](respondWithResult(_0x55e3b5,null))[_0x9ae5('0x21')](handleError(_0x55e3b5,null));};var interaction_log=require('../../config/logger')(_0x9ae5('0x4f'));exports[_0x9ae5('0x68')]=function(_0x42420b,_0xfbb54a,_0x1966c3){var _0x972f4f={'agent':{},'channel':_0x9ae5('0x51')};if(_0x42420b[_0x9ae5('0x4d')]['id']){delete _0x42420b[_0x9ae5('0x4d')]['id'];}_0x42420b[_0x9ae5('0x4d')]['UserId']=_0x42420b[_0x9ae5('0x4d')][_0x9ae5('0x56')]||_0x42420b['user']['id'];_0x972f4f[_0x9ae5('0x69')]['id']=_0x42420b['body'][_0x9ae5('0x56')];return db[_0x9ae5('0x45')][_0x9ae5('0x4e')]({'where':{'id':_0x42420b[_0x9ae5('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xfbb54a,null))[_0x9ae5('0x18')](function(_0x278cea){if(_0x278cea){_0x972f4f[_0x9ae5('0x20')]=_0x278cea[_0x9ae5('0x59')]({'plain':!![]});return db[_0x9ae5('0x6a')][_0x9ae5('0x4e')]({'where':{'id':_0x278cea['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0xfbb54a,null))[_0x9ae5('0x18')](function(_0xac272b){if(_0xac272b){_0x972f4f[_0x9ae5('0x5d')]=_0xac272b[_0x9ae5('0x59')]({'plain':!![]});interaction_log[_0x9ae5('0x19')](_0x9ae5('0x6b'),_0x42420b[_0x9ae5('0x57')]['id'],_0x42420b[_0x9ae5('0x57')][_0x9ae5('0x2f')],_0x42420b['user']['role'],_0x972f4f[_0x9ae5('0x5d')]['id'],_0x42420b[_0x9ae5('0x4d')]?JSON[_0x9ae5('0x1e')](_0x42420b[_0x9ae5('0x4d')]):_0x9ae5('0x5f'));return respondWithRpcPromise(_0x9ae5('0x6c'),'rejectMessage',_0x972f4f);}return null;})[_0x9ae5('0x18')](function(_0x2e4373){if(_0x2e4373){_0x2e4373[_0x9ae5('0x20')][_0x9ae5('0x6d')]=util[_0x9ae5('0x54')]('SIP/%s',_0x42420b['user'][_0x9ae5('0x2f')]);_0x2e4373[_0x9ae5('0x20')][_0x9ae5('0x64')]=_0x972f4f[_0x9ae5('0x64')];_0x2e4373[_0x9ae5('0x20')]['event']=_0x9ae5('0x68');respondWithRpcPromise(_0x9ae5('0x66'),_0x9ae5('0x66'),{'event':_0x9ae5('0x6e'),'message':_0x2e4373[_0x9ae5('0x20')]},client9002);return _0x972f4f;}return null;})['then'](respondWithResult(_0xfbb54a,null))['catch'](handleError(_0xfbb54a,null));};exports['status']=function(_0x6c64d7,_0x4f3b7e,_0x48a946){if(_0x6c64d7[_0x9ae5('0x4d')]['id']){delete _0x6c64d7[_0x9ae5('0x4d')]['id'];}var _0x967752;return db[_0x9ae5('0x45')][_0x9ae5('0x4e')]({'where':{'id':_0x6c64d7[_0x9ae5('0x4a')]['id']}})[_0x9ae5('0x18')](handleEntityNotFound(_0x4f3b7e,null))[_0x9ae5('0x18')](function(_0xc6f385){if(_0xc6f385){_0x967752=_0xc6f385;return db['SmsAccount']['find']({'where':{'id':_0xc6f385['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x4f3b7e,null))[_0x9ae5('0x18')](function(_0x3281bf){if(_0x3281bf){logger[_0x9ae5('0x1c')](_0x9ae5('0x1d'),_0x9ae5('0x23'),_0x9ae5('0x6f'),_0x3281bf['type'],util[_0x9ae5('0x70')](_0x6c64d7[_0x9ae5('0x4d')],{'showHidden':![],'depth':null}));switch(_0x3281bf[_0x9ae5('0x71')]){case _0x9ae5('0x72'):if(_0x6c64d7[_0x9ae5('0x4d')][_0x9ae5('0x73')]&&_0x6c64d7[_0x9ae5('0x4d')]['MessageSid']===_0x967752[_0x9ae5('0x74')]){return _0x967752[_0x9ae5('0x2c')]({'read':!![]});}break;case _0x9ae5('0x75'):if(_0x6c64d7[_0x9ae5('0x4d')][_0x9ae5('0x76')]&&_0x6c64d7['body'][_0x9ae5('0x76')]===_0x967752[_0x9ae5('0x74')]&&_['indexOf']([_0x9ae5('0x77'),_0x9ae5('0x78')],_0x6c64d7[_0x9ae5('0x4d')][_0x9ae5('0x79')])>=0x0){return _0x967752['update']({'read':!![]});}break;}return _0x967752;}})['then'](respondWithResult(_0x4f3b7e,null))[_0x9ae5('0x21')](handleError(_0x4f3b7e,null));}; \ No newline at end of file +var _0x1fed=['./smsMessage.socket','register','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','count','set','Content-Range','save','update','stack','send','SmsMessage','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','offset','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','params','find','create','body','destroy','describe','sms-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','sms','agent','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectmessage','SmsAccount','received\x20delivery\x20report\x20from','type','inspect','twilio','messageId','plivo','MessageUUID','indexOf','sent','fast-json-patch','moment','bluebird','mustache','util','path','ejs','squel','crypto','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost'];(function(_0x32f26d,_0x2c0b5d){var _0x5d9ddc=function(_0x1f0e26){while(--_0x1f0e26){_0x32f26d['push'](_0x32f26d['shift']());}};_0x5d9ddc(++_0x2c0b5d);}(_0x1fed,0x1d3));var _0xd1fe=function(_0x330cc5,_0x147150){_0x330cc5=_0x330cc5-0x0;var _0x5b3ad9=_0x1fed[_0x330cc5];return _0x5b3ad9;};'use strict';var jsonpatch=require(_0xd1fe('0x0'));var rp=require('request-promise');var moment=require(_0xd1fe('0x1'));var BPromise=require(_0xd1fe('0x2'));var Mustache=require(_0xd1fe('0x3'));var util=require(_0xd1fe('0x4'));var path=require(_0xd1fe('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1fe('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd1fe('0x7'));var crypto=require(_0xd1fe('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd1fe('0x9'));var qs=require(_0xd1fe('0xa'));var logger=require(_0xd1fe('0xb'))(_0xd1fe('0xc'));var utils=require(_0xd1fe('0xd'));var config=require('../../config/environment');var db=require(_0xd1fe('0xe'))['db'];var socket=require(_0xd1fe('0xf'))({'host':_0xd1fe('0x10'),'port':0x18eb});require(_0xd1fe('0x11'))[_0xd1fe('0x12')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd1fe('0x13')][_0xd1fe('0x14')]({'port':0x232c});var client9002=jayson[_0xd1fe('0x13')][_0xd1fe('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x2225bb,_0x50a4de,_0x380a81,_0x445e19){return new BPromise(function(_0x542b17,_0x1d3fdb){var _0x597075=_0x445e19||client;return _0x597075[_0xd1fe('0x15')](_0x2225bb,_0x380a81)[_0xd1fe('0x16')](function(_0x37c88e){logger[_0xd1fe('0x17')](_0xd1fe('0x18'),_0x50a4de,'request\x20sent');logger[_0xd1fe('0x19')](_0xd1fe('0x1a'),_0x50a4de,'request\x20sent',JSON['stringify'](_0x37c88e));if(_0x37c88e[_0xd1fe('0x1b')]){if(_0x37c88e['error'][_0xd1fe('0x1c')]===0x1f4){logger[_0xd1fe('0x1b')](_0xd1fe('0x18'),_0x50a4de,_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);return _0x1d3fdb(_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);}logger[_0xd1fe('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x50a4de,_0x37c88e['error']['message']);return _0x542b17(_0x37c88e[_0xd1fe('0x1b')][_0xd1fe('0x1d')]);}else{logger[_0xd1fe('0x17')](_0xd1fe('0x18'),_0x50a4de,_0xd1fe('0x1e'));_0x542b17(_0x37c88e[_0xd1fe('0x1f')][_0xd1fe('0x1d')]);}})[_0xd1fe('0x20')](function(_0x18d109){logger[_0xd1fe('0x1b')]('SmsMessage,\x20%s,\x20%s',_0x50a4de,_0x18d109);_0x1d3fdb(_0x18d109);});});}function respondWithStatusCode(_0xc1d101,_0x5c1033){_0x5c1033=_0x5c1033||0xcc;return function(_0x5cd548){if(_0x5cd548){return _0xc1d101[_0xd1fe('0x21')](_0x5c1033);}return _0xc1d101[_0xd1fe('0x22')](_0x5c1033)[_0xd1fe('0x23')]();};}function respondWithResult(_0x297ba6,_0x412a0b){_0x412a0b=_0x412a0b||0xc8;return function(_0x50ddd5){if(_0x50ddd5){return _0x297ba6['status'](_0x412a0b)[_0xd1fe('0x24')](_0x50ddd5);}};}function respondWithFilteredResult(_0xe77dfa,_0x4a2c8f){return function(_0x2d7ab5){if(_0x2d7ab5){var _0x364413=_0x2d7ab5[_0xd1fe('0x25')],_0x3a0610=_0x4a2c8f['offset'],_0x5c5782=_0x4a2c8f['offset']+_0x4a2c8f['limit'],_0x124d78;if(_0x5c5782>=_0x364413){_0x5c5782=_0x364413;_0x124d78=0xc8;}else{_0x124d78=0xce;}_0xe77dfa['status'](_0x124d78);return _0xe77dfa[_0xd1fe('0x26')](_0xd1fe('0x27'),_0x3a0610+'-'+_0x5c5782+'/'+_0x364413)[_0xd1fe('0x24')](_0x2d7ab5);}return null;};}function patchUpdates(_0x56510c){return function(_0x4f366d){try{jsonpatch['apply'](_0x4f366d,_0x56510c,!![]);}catch(_0x890b58){return BPromise['reject'](_0x890b58);}return _0x4f366d[_0xd1fe('0x28')]();};}function saveUpdates(_0x526caa,_0x30460c){return function(_0x449c7f){if(_0x449c7f){return _0x449c7f[_0xd1fe('0x29')](_0x526caa)[_0xd1fe('0x16')](function(_0x30fb5f){return _0x30fb5f;});}return null;};}function removeEntity(_0x1db865,_0x15a9ea){return function(_0x30972a){if(_0x30972a){return _0x30972a['destroy']()[_0xd1fe('0x16')](function(){_0x1db865[_0xd1fe('0x22')](0xcc)[_0xd1fe('0x23')]();});}};}function handleEntityNotFound(_0x39f588,_0x450bc9){return function(_0x546e09){if(!_0x546e09){_0x39f588['sendStatus'](0x194);}return _0x546e09;};}function handleError(_0xe7715d,_0x3c2ae2){_0x3c2ae2=_0x3c2ae2||0x1f4;return function(_0x338f34){logger['error'](_0x338f34[_0xd1fe('0x2a')]);if(_0x338f34['name']){delete _0x338f34['name'];}_0xe7715d[_0xd1fe('0x22')](_0x3c2ae2)[_0xd1fe('0x2b')](_0x338f34);};}exports['index']=function(_0x557e7b,_0x3770e8){var _0x517ab5={},_0x52f953={},_0x4e8adb={'count':0x0,'rows':[]};var _0x2236a8=db[_0xd1fe('0x2c')][_0xd1fe('0x2d')];_0x52f953['model']=_[_0xd1fe('0x2e')](_0x2236a8);var _0x1bea67={'dateStart':_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x30')],'dateEnd':_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x31')]};delete _0x557e7b['query'][_0xd1fe('0x30')];delete _0x557e7b[_0xd1fe('0x2f')]['dateEnd'];_0x52f953['query']=_[_0xd1fe('0x2e')](_0x557e7b[_0xd1fe('0x2f')]);_0x52f953[_0xd1fe('0x32')]=_[_0xd1fe('0x33')](_0x52f953[_0xd1fe('0x34')],_0x52f953[_0xd1fe('0x2f')]);_0x517ab5[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0x52f953[_0xd1fe('0x34')],qs[_0xd1fe('0x36')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x36')]));_0x517ab5['attributes']=_0x517ab5[_0xd1fe('0x35')][_0xd1fe('0x37')]?_0x517ab5[_0xd1fe('0x35')]:_0x52f953['model'];if(!_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x38')]('nolimit')){_0x517ab5[_0xd1fe('0x39')]=qs[_0xd1fe('0x39')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x39')]);_0x517ab5[_0xd1fe('0x3a')]=qs[_0xd1fe('0x3a')](_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x3a')]);}_0x517ab5['order']=qs[_0xd1fe('0x3b')](_0x557e7b['query'][_0xd1fe('0x3b')]);_0x517ab5[_0xd1fe('0x3c')]=qs[_0xd1fe('0x32')](_[_0xd1fe('0x3d')](_0x557e7b[_0xd1fe('0x2f')],_0x52f953[_0xd1fe('0x32')]));if(_0x1bea67['dateStart']){if(_0x1bea67[_0xd1fe('0x31')]){_0x1bea67[_0xd1fe('0x31')]=moment(_0x1bea67[_0xd1fe('0x31')])[_0xd1fe('0x3e')](0x1,_0xd1fe('0x3f'));}else{_0x1bea67[_0xd1fe('0x31')]=moment(_0x1bea67[_0xd1fe('0x30')])[_0xd1fe('0x3e')](0x1,_0xd1fe('0x3f'));}_[_0xd1fe('0x40')](_0x517ab5[_0xd1fe('0x3c')],{'createdAt':{'$gte':_0x1bea67[_0xd1fe('0x30')],'$lte':_0x1bea67['dateEnd']}});}if(_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x41')]){_0x517ab5['where']=_[_0xd1fe('0x40')](_0x517ab5['where'],{'$or':_[_0xd1fe('0x42')](_0x517ab5[_0xd1fe('0x35')],function(_0x526932){var _0x4bdc91={};_0x4bdc91[_0x526932]={'$like':'%'+_0x557e7b['query'][_0xd1fe('0x41')]+'%'};return _0x4bdc91;})});}_0x517ab5=_[_0xd1fe('0x40')]({},_0x517ab5,_0x557e7b[_0xd1fe('0x43')]);var _0x4960cb={'where':_0x517ab5['where']};return db['SmsMessage'][_0xd1fe('0x25')](_0x4960cb)['then'](function(_0x357cc0){_0x4e8adb[_0xd1fe('0x25')]=_0x357cc0;if(_0x557e7b[_0xd1fe('0x2f')][_0xd1fe('0x44')]){_0x517ab5[_0xd1fe('0x45')]=[{'all':!![]}];}return db[_0xd1fe('0x2c')][_0xd1fe('0x46')](_0x517ab5);})[_0xd1fe('0x16')](function(_0x546866){_0x4e8adb[_0xd1fe('0x47')]=_0x546866;return _0x4e8adb;})[_0xd1fe('0x16')](respondWithFilteredResult(_0x3770e8,_0x517ab5))[_0xd1fe('0x20')](handleError(_0x3770e8,null));};exports['show']=function(_0x161972,_0x6716ba){var _0x31f55d={'raw':!![],'where':{'id':_0x161972[_0xd1fe('0x48')]['id']}},_0x44892b={};_0x44892b['model']=_[_0xd1fe('0x2e')](db[_0xd1fe('0x2c')][_0xd1fe('0x2d')]);_0x44892b[_0xd1fe('0x2f')]=_[_0xd1fe('0x2e')](_0x161972['query']);_0x44892b[_0xd1fe('0x32')]=_['intersection'](_0x44892b['model'],_0x44892b[_0xd1fe('0x2f')]);_0x31f55d[_0xd1fe('0x35')]=_[_0xd1fe('0x33')](_0x44892b['model'],qs[_0xd1fe('0x36')](_0x161972[_0xd1fe('0x2f')][_0xd1fe('0x36')]));_0x31f55d[_0xd1fe('0x35')]=_0x31f55d[_0xd1fe('0x35')][_0xd1fe('0x37')]?_0x31f55d[_0xd1fe('0x35')]:_0x44892b[_0xd1fe('0x34')];if(_0x161972[_0xd1fe('0x2f')][_0xd1fe('0x44')]){_0x31f55d[_0xd1fe('0x45')]=[{'all':!![]}];}_0x31f55d=_[_0xd1fe('0x40')]({},_0x31f55d,_0x161972[_0xd1fe('0x43')]);return db[_0xd1fe('0x2c')][_0xd1fe('0x49')](_0x31f55d)[_0xd1fe('0x16')](handleEntityNotFound(_0x6716ba,null))[_0xd1fe('0x16')](respondWithResult(_0x6716ba,null))[_0xd1fe('0x20')](handleError(_0x6716ba,null));};exports[_0xd1fe('0x4a')]=function(_0x395dd4,_0x38b65b){return db[_0xd1fe('0x2c')][_0xd1fe('0x4a')](_0x395dd4[_0xd1fe('0x4b')],{})['then'](respondWithResult(_0x38b65b,0xc9))[_0xd1fe('0x20')](handleError(_0x38b65b,null));};exports['update']=function(_0x22dd8c,_0xaeeeab){if(_0x22dd8c[_0xd1fe('0x4b')]['id']){delete _0x22dd8c['body']['id'];}return db[_0xd1fe('0x2c')][_0xd1fe('0x49')]({'where':{'id':_0x22dd8c[_0xd1fe('0x48')]['id']}})[_0xd1fe('0x16')](handleEntityNotFound(_0xaeeeab,null))[_0xd1fe('0x16')](saveUpdates(_0x22dd8c['body'],null))[_0xd1fe('0x16')](respondWithResult(_0xaeeeab,null))['catch'](handleError(_0xaeeeab,null));};exports[_0xd1fe('0x4c')]=function(_0x4dba71,_0x2c4fec){return db['SmsMessage']['find']({'where':{'id':_0x4dba71[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0x2c4fec,null))[_0xd1fe('0x16')](removeEntity(_0x2c4fec,null))[_0xd1fe('0x20')](handleError(_0x2c4fec,null));};exports['describe']=function(_0x1f2bf2,_0xb9f54a){return db['SmsMessage'][_0xd1fe('0x4d')]()[_0xd1fe('0x16')](respondWithResult(_0xb9f54a,null))['catch'](handleError(_0xb9f54a,null));};var interaction_log=require('../../config/logger')(_0xd1fe('0x4e'));exports[_0xd1fe('0x4f')]=function(_0x2683e5,_0x580c43,_0x3a9120){var _0x21b144={'channel':'sms'};if(_0x2683e5[_0xd1fe('0x4b')]['id']){delete _0x2683e5[_0xd1fe('0x4b')]['id'];}_0x2683e5[_0xd1fe('0x4b')]['read']=!![];_0x2683e5['body'][_0xd1fe('0x50')]=moment()[_0xd1fe('0x51')](_0xd1fe('0x52'));_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x53')]=_0x2683e5[_0xd1fe('0x4b')]['UserId']||_0x2683e5[_0xd1fe('0x54')]['id'];return db['SmsMessage'][_0xd1fe('0x49')]({'where':{'id':_0x2683e5[_0xd1fe('0x48')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':_0xd1fe('0x55')}]})[_0xd1fe('0x16')](handleEntityNotFound(_0x580c43,null))[_0xd1fe('0x16')](saveUpdates(_0x2683e5[_0xd1fe('0x4b')],null))[_0xd1fe('0x16')](function(_0x341dd5){if(_0x341dd5){_0x21b144[_0xd1fe('0x1d')]=_0x341dd5[_0xd1fe('0x56')]({'plain':!![]});return db[_0xd1fe('0x57')][_0xd1fe('0x49')]({'where':{'id':_0x341dd5[_0xd1fe('0x58')]}});}return null;})[_0xd1fe('0x16')](handleEntityNotFound(_0x580c43,null))[_0xd1fe('0x16')](function(_0x57dce1){if(_0x57dce1){return _0x57dce1['update']({'UserId':_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x53')],'read1stAt':_[_0xd1fe('0x59')](_0x57dce1[_0xd1fe('0x5a')])?moment()[_0xd1fe('0x51')](_0xd1fe('0x52')):undefined});}return null;})['then'](function(_0x4e0489){if(_0x4e0489){_0x21b144[_0xd1fe('0x5b')]=_0x4e0489[_0xd1fe('0x56')]({'plain':!![]});interaction_log['info'](_0xd1fe('0x5c'),_0x2683e5[_0xd1fe('0x54')]['id'],_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5d')],_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5e')],_0x21b144['interaction']['id'],_0x2683e5[_0xd1fe('0x4b')]?JSON[_0xd1fe('0x5f')](_0x2683e5[_0xd1fe('0x4b')]):_0xd1fe('0x60'));return respondWithRpcPromise(_0xd1fe('0x61'),_0xd1fe('0x62'),_0x21b144);}return null;})['then'](function(_0x1b298f){if(_0x1b298f){if(_0x2683e5[_0xd1fe('0x4b')][_0xd1fe('0x63')]){_0x21b144[_0xd1fe('0x1d')][_0xd1fe('0x64')]=util['format'](_0xd1fe('0x65'),_0x2683e5[_0xd1fe('0x54')][_0xd1fe('0x5d')]);_0x21b144['message'][_0xd1fe('0x66')]=_0x21b144['channel'];_0x21b144['message'][_0xd1fe('0x67')]='accept';return respondWithRpcPromise(_0xd1fe('0x68'),_0xd1fe('0x68'),{'event':_0xd1fe('0x69'),'message':_0x21b144[_0xd1fe('0x1d')]},client9002)[_0xd1fe('0x16')](function(){return _0x21b144;});}return _0x21b144;}return null;})[_0xd1fe('0x16')](respondWithResult(_0x580c43,null))['catch'](handleError(_0x580c43,null));};var interaction_log=require(_0xd1fe('0xb'))(_0xd1fe('0x4e'));exports[_0xd1fe('0x6a')]=function(_0x26992b,_0x3e34ba,_0x191b5d){var _0x5816dd={'agent':{},'channel':_0xd1fe('0x6b')};if(_0x26992b[_0xd1fe('0x4b')]['id']){delete _0x26992b[_0xd1fe('0x4b')]['id'];}_0x26992b['body'][_0xd1fe('0x53')]=_0x26992b[_0xd1fe('0x4b')][_0xd1fe('0x53')]||_0x26992b[_0xd1fe('0x54')]['id'];_0x5816dd[_0xd1fe('0x6c')]['id']=_0x26992b[_0xd1fe('0x4b')]['UserId'];return db[_0xd1fe('0x2c')]['find']({'where':{'id':_0x26992b[_0xd1fe('0x48')]['id'],'UserId':null}})[_0xd1fe('0x16')](handleEntityNotFound(_0x3e34ba,null))[_0xd1fe('0x16')](function(_0x5dab5a){if(_0x5dab5a){_0x5816dd[_0xd1fe('0x1d')]=_0x5dab5a['get']({'plain':!![]});return db['SmsInteraction'][_0xd1fe('0x49')]({'where':{'id':_0x5dab5a[_0xd1fe('0x58')]}});}return null;})[_0xd1fe('0x16')](handleEntityNotFound(_0x3e34ba,null))[_0xd1fe('0x16')](function(_0x2d8a42){if(_0x2d8a42){_0x5816dd[_0xd1fe('0x5b')]=_0x2d8a42[_0xd1fe('0x56')]({'plain':!![]});interaction_log[_0xd1fe('0x17')](_0xd1fe('0x6d'),_0x26992b[_0xd1fe('0x54')]['id'],_0x26992b[_0xd1fe('0x54')]['name'],_0x26992b[_0xd1fe('0x54')][_0xd1fe('0x5e')],_0x5816dd[_0xd1fe('0x5b')]['id'],_0x26992b[_0xd1fe('0x4b')]?JSON['stringify'](_0x26992b['body']):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x5816dd);}return null;})[_0xd1fe('0x16')](function(_0x22f85a){if(_0x22f85a){_0x22f85a[_0xd1fe('0x1d')]['interface']=util['format'](_0xd1fe('0x65'),_0x26992b[_0xd1fe('0x54')][_0xd1fe('0x5d')]);_0x22f85a[_0xd1fe('0x1d')]['channel']=_0x5816dd[_0xd1fe('0x66')];_0x22f85a[_0xd1fe('0x1d')][_0xd1fe('0x67')]=_0xd1fe('0x6a');respondWithRpcPromise(_0xd1fe('0x68'),_0xd1fe('0x68'),{'event':_0xd1fe('0x6e'),'message':_0x22f85a['message']},client9002);return _0x5816dd;}return null;})[_0xd1fe('0x16')](respondWithResult(_0x3e34ba,null))[_0xd1fe('0x20')](handleError(_0x3e34ba,null));};exports['status']=function(_0x23c751,_0xf2f103,_0xd56f60){if(_0x23c751['body']['id']){delete _0x23c751[_0xd1fe('0x4b')]['id'];}var _0xcc9578;return db[_0xd1fe('0x2c')][_0xd1fe('0x49')]({'where':{'id':_0x23c751[_0xd1fe('0x48')]['id']}})['then'](handleEntityNotFound(_0xf2f103,null))[_0xd1fe('0x16')](function(_0x41f9ec){if(_0x41f9ec){_0xcc9578=_0x41f9ec;return db[_0xd1fe('0x6f')][_0xd1fe('0x49')]({'where':{'id':_0x41f9ec['SmsAccountId']}});}})[_0xd1fe('0x16')](handleEntityNotFound(_0xf2f103,null))['then'](function(_0x1a35bb){if(_0x1a35bb){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xd1fe('0x70'),_0x1a35bb[_0xd1fe('0x71')],util[_0xd1fe('0x72')](_0x23c751['body'],{'showHidden':![],'depth':null}));switch(_0x1a35bb[_0xd1fe('0x71')]){case _0xd1fe('0x73'):if(_0x23c751['body']['MessageSid']&&_0x23c751[_0xd1fe('0x4b')]['MessageSid']===_0xcc9578[_0xd1fe('0x74')]){return _0xcc9578[_0xd1fe('0x29')]({'read':!![]});}break;case _0xd1fe('0x75'):if(_0x23c751['body'][_0xd1fe('0x76')]&&_0x23c751[_0xd1fe('0x4b')][_0xd1fe('0x76')]===_0xcc9578['messageId']&&_[_0xd1fe('0x77')]([_0xd1fe('0x78'),'delivered'],_0x23c751[_0xd1fe('0x4b')]['Status'])>=0x0){return _0xcc9578['update']({'read':!![]});}break;}return _0xcc9578;}})[_0xd1fe('0x16')](respondWithResult(_0xf2f103,null))[_0xd1fe('0x20')](handleError(_0xf2f103,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 86f0103..ea5fe6a 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 _0xe865=['hasOwnProperty','hook','events','SmsMessage','setMaxListeners','save','update','remove','emit'];(function(_0x43fcee,_0x37645a){var _0x2dfbac=function(_0x1a9155){while(--_0x1a9155){_0x43fcee['push'](_0x43fcee['shift']());}};_0x2dfbac(++_0x37645a);}(_0xe865,0x6e));var _0x5e86=function(_0xb9622e,_0x91225d){_0xb9622e=_0xb9622e-0x0;var _0x12969e=_0xe865[_0xb9622e];return _0x12969e;};'use strict';var EventEmitter=require(_0x5e86('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x5e86('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5e86('0x2')](0x0);var events={'afterCreate':_0x5e86('0x3'),'afterUpdate':_0x5e86('0x4'),'afterDestroy':_0x5e86('0x5')};function emitEvent(_0x140201){return function(_0x2f047e,_0x23f5a6,_0x3aaa20){SmsMessageEvents[_0x5e86('0x6')](_0x140201+':'+_0x2f047e['id'],_0x2f047e);SmsMessageEvents['emit'](_0x140201,_0x2f047e);_0x3aaa20(null);};}for(var e in events){if(events[_0x5e86('0x7')](e)){var event=events[e];SmsMessage[_0x5e86('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x9c83=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x1b8d1c,_0x395b3b){var _0x159a0b=function(_0x564655){while(--_0x564655){_0x1b8d1c['push'](_0x1b8d1c['shift']());}};_0x159a0b(++_0x395b3b);}(_0x9c83,0x8e));var _0x39c8=function(_0x366e49,_0x3b9642){_0x366e49=_0x366e49-0x0;var _0x2ba62d=_0x9c83[_0x366e49];return _0x2ba62d;};'use strict';var EventEmitter=require(_0x39c8('0x0'));var SmsMessage=require(_0x39c8('0x1'))['db'][_0x39c8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x39c8('0x3')](0x0);var events={'afterCreate':_0x39c8('0x4'),'afterUpdate':_0x39c8('0x5'),'afterDestroy':_0x39c8('0x6')};function emitEvent(_0x2eb61c){return function(_0x590611,_0xceb2ac,_0x244471){SmsMessageEvents[_0x39c8('0x7')](_0x2eb61c+':'+_0x590611['id'],_0x590611);SmsMessageEvents[_0x39c8('0x7')](_0x2eb61c,_0x590611);_0x244471(null);};}for(var e in events){if(events[_0x39c8('0x8')](e)){var event=events[e];SmsMessage['hook'](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 3bcc2f3..4154463 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 _0x3735=['lodash','util','api','moment','request-promise','SmsMessage','messageId','models','direction','out','secret','isNil','findOne','SmsInteractionId','then','update','toLowerCase','body','catch','error','SmsAccount','find','SmsAccountId','type','twilio','phone','authToken','messages','create','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','UTF-8','method','classic','send_sms_classic','sender_number','senderString','sender_string','classic+','POST','https://gateway.skebby.it/api/send/smseasy/advanced/http.php','utf8','parse','success','smsMethod','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','https://smsapi.connectel.se/api/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','password','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','Basic\x20%s','toString','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x3735,0xfc));var _0x5373=function(_0xe8fa1f,_0x12bba1){_0xe8fa1f=_0xe8fa1f-0x0;var _0x4b3a65=_0x3735[_0xe8fa1f];return _0x4b3a65;};'use strict';var _=require(_0x5373('0x0'));var util=require(_0x5373('0x1'));var logger=require('../../config/logger')(_0x5373('0x2'));var moment=require(_0x5373('0x3'));var BPromise=require('bluebird');var rp=require(_0x5373('0x4'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x3a4b52,_0xbe9560){return _0x3a4b52['define'](_0x5373('0x5'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x5373('0x6'),'fields':[_0x5373('0x6')]}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41aded,_0x55a750,_0x5449b9){var _0x4cb877=_0x3a4b52[_0x5373('0x7')];var _0x193f9d=_0x41aded['get']({'plain':!![]});if(_0x193f9d[_0x5373('0x8')]['toLowerCase']()==='in'||_0x193f9d[_0x5373('0x8')]['toLowerCase']()===_0x5373('0x9')&&!_0x193f9d[_0x5373('0xa')]&&!_[_0x5373('0xb')](_0x193f9d['UserId'])){_0x4cb877['SmsInteraction'][_0x5373('0xc')]({'where':{'id':_0x193f9d[_0x5373('0xd')]}})[_0x5373('0xe')](function(_0x7a0914){if(_0x7a0914){_0x7a0914[_0x5373('0xf')]({'lastMsgAt':_0x193f9d['createdAt'],'lastMsgDirection':_0x193f9d['direction'][_0x5373('0x10')](),'lastMsgBody':_0x193f9d[_0x5373('0x11')]});}})[_0x5373('0x12')](function(_0x3f3a54){console[_0x5373('0x13')](_0x3f3a54);});}if(_0x193f9d['direction']===_0x5373('0x9')&&!_0x193f9d[_0x5373('0xa')]){var _0x41d4bb;_0x4cb877[_0x5373('0x14')][_0x5373('0x15')]({'where':{'id':_0x193f9d[_0x5373('0x16')]},'raw':!![]})[_0x5373('0xe')](function(_0x50ec1a){_0x41d4bb=_0x50ec1a;if(_0x41d4bb&&_0x41d4bb[_0x5373('0x17')]){switch(_0x41d4bb[_0x5373('0x17')]){case _0x5373('0x18'):var _0x43bf92=require(_0x5373('0x18'));if(_0x41d4bb['accountSid']&&_0x41d4bb['authToken']&&_0x41d4bb[_0x5373('0x19')]){var _0x4acf50=new _0x43bf92(_0x41d4bb['accountSid'],_0x41d4bb[_0x5373('0x1a')]);_0x4acf50[_0x5373('0x1b')][_0x5373('0x1c')]({'body':_0x193f9d[_0x5373('0x11')],'to':_0x193f9d[_0x5373('0x19')],'from':_0x41d4bb[_0x5373('0x19')],'statusCallback':_0x41d4bb['remote']+_0x5373('0x1d')+_0x193f9d['id']+_0x5373('0x1e')+_0x41d4bb[_0x5373('0x1f')]})[_0x5373('0xe')](function(_0xa6dba0){if(_0xa6dba0[_0x5373('0x20')]){return _0x41aded[_0x5373('0xf')]({'messageId':_0xa6dba0['sid']});}})[_0x5373('0x12')](function(_0x485947){logger['error'](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x18'),util['inspect'](_0x485947,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5373('0x22'),_0x5373('0x18'),_0x5373('0x23'));}break;case _0x5373('0x24'):var _0x35013a=require(_0x5373('0x25'));if(_0x41d4bb['username']&&_0x41d4bb['password']){var _0x22a16b={'username':_0x41d4bb[_0x5373('0x26')],'password':_0x41d4bb['password'],'recipients[]':[_0x193f9d[_0x5373('0x19')]],'text':_0x193f9d[_0x5373('0x11')],'charset':_0x5373('0x27')};switch(_0x41d4bb['smsMethod']){case'basic':_0x22a16b[_0x5373('0x28')]='send_sms_basic';break;case _0x5373('0x29'):_0x22a16b[_0x5373('0x28')]=_0x5373('0x2a');_0x22a16b[_0x5373('0x2b')]=_0x41d4bb[_0x5373('0x19')];if(_0x41d4bb[_0x5373('0x2c')]){_0x22a16b[_0x5373('0x2d')]=_0x41d4bb['senderString'];}else if(_0x41d4bb['phone']){_0x22a16b[_0x5373('0x2b')]=_0x41d4bb['phone'];}break;case _0x5373('0x2e'):_0x22a16b[_0x5373('0x28')]='send_sms_classic_report';_0x22a16b[_0x5373('0x2b')]=_0x41d4bb[_0x5373('0x19')];if(_0x41d4bb[_0x5373('0x2c')]){_0x22a16b['sender_string']=_0x41d4bb[_0x5373('0x2c')];}else if(_0x41d4bb[_0x5373('0x19')]){_0x22a16b[_0x5373('0x2b')]=_0x41d4bb['phone'];}break;}var _0x6be9ca=_0x35013a['stringify'](_0x22a16b);var _0x55a750={'method':_0x5373('0x2f'),'uri':_0x5373('0x30'),'body':_0x6be9ca,'headers':{'Content-Type':'application/x-www-form-urlencoded','Content-Length':_0x6be9ca['length'],'Content-Encoding':_0x5373('0x31')}};rp(_0x55a750)[_0x5373('0xe')](function(_0x12e083){var _0x1633d9=_0x35013a[_0x5373('0x32')](_0x12e083);if(_0x1633d9['status']==_0x5373('0x33')){var _0x70a89a={'messageId':_0x1633d9['id']};if(_0x41d4bb[_0x5373('0x34')]!==_0x5373('0x2e')||!_0x41d4bb[_0x5373('0x35')]){_0x70a89a['read']=!![];}return _0x41aded[_0x5373('0xf')](_0x70a89a);}else{logger['error'](_0x5373('0x21'),'afterCreate',_0x5373('0x24'),util[_0x5373('0x36')](_0x1633d9,{'showHidden':![],'depth':null}));}})[_0x5373('0x12')](function(_0xc17f63){logger[_0x5373('0x13')](_0x5373('0x21'),'afterCreate',_0x5373('0x24'),util[_0x5373('0x36')](_0xc17f63,{'showHidden':![],'depth':null}));});}else{logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x24'),_0x5373('0x37'));}break;case _0x5373('0x38'):if(_0x41d4bb[_0x5373('0x1a')]){var _0x22a16b={'recipient':_0x193f9d[_0x5373('0x19')],'message':_0x193f9d[_0x5373('0x11')],'sender':_0x41d4bb['senderString']||_0x41d4bb[_0x5373('0x19')],'authorization':_0x41d4bb['authToken']};var _0x55a750={'method':_0x5373('0x2f'),'uri':_0x5373('0x39'),'body':_0x22a16b,'json':!![]};rp(_0x55a750)[_0x5373('0xe')](function(_0x2e667d){var _0x8a4fed={'messageId':_0x2e667d[_0x5373('0x3a')]};if(!_0x41d4bb['deliveryReport']){_0x8a4fed[_0x5373('0x3b')]=!![];}return _0x41aded[_0x5373('0xf')](_0x8a4fed);})[_0x5373('0x12')](function(_0x33082a){logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x38'),util[_0x5373('0x36')](_0x33082a,{'showHidden':![],'depth':null}));});}else{logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x38'),_0x5373('0x3c'));}break;case _0x5373('0x3d'):if(_0x41d4bb[_0x5373('0x26')]&&_0x41d4bb[_0x5373('0x3e')]){var _0x22a16b={'messages':[{'source':_0x5373('0x3f'),'to':_0x193f9d[_0x5373('0x19')],'body':_0x193f9d[_0x5373('0x11')],'from':_0x41d4bb['senderString']||_0x41d4bb[_0x5373('0x19')]}]};var _0x1a6eef=util['format'](_0x5373('0x40'),_0x41d4bb[_0x5373('0x26')],_0x41d4bb[_0x5373('0x3e')]);var _0x55a750={'method':_0x5373('0x2f'),'uri':_0x5373('0x41'),'body':_0x22a16b,'headers':{'Authorization':util[_0x5373('0x42')]('Basic\x20%s',new Buffer(_0x1a6eef)['toString'](_0x5373('0x43')))},'json':!![]};rp(_0x55a750)[_0x5373('0xe')](function(_0x21e911){if(_0x21e911[_0x5373('0x44')]>=0xc8&&_0x21e911[_0x5373('0x44')]<=0xce){if(_0x21e911[_0x5373('0x45')]&&_0x21e911[_0x5373('0x45')][_0x5373('0x46')]>0x0){var _0x298622=_[_0x5373('0x47')](_0x21e911[_0x5373('0x45')][_0x5373('0x1b')]);var _0x3f7fd1={'messageId':_0x298622[_0x5373('0x48')]};if(!_0x41d4bb['deliveryReport']){_0x3f7fd1[_0x5373('0x3b')]=!![];}return _0x41aded[_0x5373('0xf')](_0x3f7fd1);}else{logger['error'](_0x5373('0x21'),_0x5373('0x22'),'clickSend',util[_0x5373('0x36')](_0x21e911,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x5373('0x21'),'afterCreate',_0x5373('0x49'),util[_0x5373('0x36')](_0x21e911,{'showHidden':![],'depth':null}));}})[_0x5373('0x12')](function(_0x3fc002){logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x49'),util[_0x5373('0x36')](_0x3fc002,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x5373('0x21'),_0x5373('0x22'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0x5373('0x4a'):if(_0x41d4bb[_0x5373('0x4b')]&&_0x41d4bb[_0x5373('0x1a')]){var _0x22a16b={'dst':_0x193f9d[_0x5373('0x19')],'text':_0x193f9d[_0x5373('0x11')],'src':_0x41d4bb['senderString']||_0x41d4bb[_0x5373('0x19')],'url':_0x41d4bb[_0x5373('0x4c')]+_0x5373('0x1d')+_0x193f9d['id']+'/status?token='+_0x41d4bb[_0x5373('0x1f')]};var _0x1a6eef=util[_0x5373('0x42')](_0x5373('0x40'),_0x41d4bb[_0x5373('0x4b')],_0x41d4bb['authToken']);var _0x55a750={'method':_0x5373('0x2f'),'uri':util[_0x5373('0x42')]('https://api.plivo.com/v1/Account/%s/Message/',_0x41d4bb[_0x5373('0x4b')]),'body':_0x22a16b,'headers':{'Authorization':util[_0x5373('0x42')](_0x5373('0x4d'),new Buffer(_0x1a6eef)[_0x5373('0x4e')](_0x5373('0x43')))},'json':!![]};rp(_0x55a750)[_0x5373('0xe')](function(_0x4c5c46){var _0x7b49af={'messageId':_0x4c5c46[_0x5373('0x4f')][0x0]};return _0x41aded['update'](_0x7b49af);})[_0x5373('0x12')](function(_0x183fb8){logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),'plivo',util[_0x5373('0x36')](_0x183fb8,{'showHidden':![],'depth':null}));});}else{logger[_0x5373('0x13')](_0x5373('0x21'),_0x5373('0x22'),_0x5373('0x4a'),_0x5373('0x50'));}break;}}})[_0x5373('0x51')](function(){_0x5449b9();});}else{_0x5449b9();}}},'charset':_0x5373('0x52'),'collate':_0x5373('0x53')});}; \ No newline at end of file +var _0xbfc3=['/api/sms/messages/','/status?token=','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','querystring','username','password','UTF-8','smsMethod','basic','send_sms_basic','sender_number','senderString','sender_string','classic+','stringify','POST','https://gateway.skebby.it/api/send/smseasy/advanced/http.php','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','head','message_id','read','clickSend','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','models','get','direction','toLowerCase','isNil','UserId','SmsInteraction','then','update','createdAt','body','catch','error','out','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','remote'];(function(_0x1dfd2c,_0x4e598e){var _0x51a7a5=function(_0x3010ac){while(--_0x3010ac){_0x1dfd2c['push'](_0x1dfd2c['shift']());}};_0x51a7a5(++_0x4e598e);}(_0xbfc3,0x1c9));var _0x3bfc=function(_0x40c5fc,_0x253172){_0x40c5fc=_0x40c5fc-0x0;var _0x61daff=_0xbfc3[_0x40c5fc];return _0x61daff;};'use strict';var _=require(_0x3bfc('0x0'));var util=require(_0x3bfc('0x1'));var logger=require(_0x3bfc('0x2'))(_0x3bfc('0x3'));var moment=require(_0x3bfc('0x4'));var BPromise=require(_0x3bfc('0x5'));var rp=require(_0x3bfc('0x6'));var attributes=require(_0x3bfc('0x7'));module[_0x3bfc('0x8')]=function(_0x105657,_0x588ce6){return _0x105657[_0x3bfc('0x9')](_0x3bfc('0xa'),attributes,{'tableName':_0x3bfc('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfb7643,_0x61315,_0x1d0d80){var _0x483e4d=_0x105657[_0x3bfc('0xc')];var _0xa1b907=_0xfb7643[_0x3bfc('0xd')]({'plain':!![]});if(_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')]()==='in'||_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')]()==='out'&&!_0xa1b907['secret']&&!_[_0x3bfc('0x10')](_0xa1b907[_0x3bfc('0x11')])){_0x483e4d[_0x3bfc('0x12')]['findOne']({'where':{'id':_0xa1b907['SmsInteractionId']}})[_0x3bfc('0x13')](function(_0x5be301){if(_0x5be301){_0x5be301[_0x3bfc('0x14')]({'lastMsgAt':_0xa1b907[_0x3bfc('0x15')],'lastMsgDirection':_0xa1b907[_0x3bfc('0xe')][_0x3bfc('0xf')](),'lastMsgBody':_0xa1b907[_0x3bfc('0x16')]});}})[_0x3bfc('0x17')](function(_0x707e14){console[_0x3bfc('0x18')](_0x707e14);});}if(_0xa1b907[_0x3bfc('0xe')]===_0x3bfc('0x19')&&!_0xa1b907['secret']){var _0x5cb3cc;_0x483e4d[_0x3bfc('0x1a')][_0x3bfc('0x1b')]({'where':{'id':_0xa1b907['SmsAccountId']},'raw':!![]})[_0x3bfc('0x13')](function(_0x5421a9){_0x5cb3cc=_0x5421a9;if(_0x5cb3cc&&_0x5cb3cc[_0x3bfc('0x1c')]){switch(_0x5cb3cc[_0x3bfc('0x1c')]){case _0x3bfc('0x1d'):var _0x27d0e6=require('twilio');if(_0x5cb3cc[_0x3bfc('0x1e')]&&_0x5cb3cc[_0x3bfc('0x1f')]&&_0x5cb3cc[_0x3bfc('0x20')]){var _0x35fe8e=new _0x27d0e6(_0x5cb3cc[_0x3bfc('0x1e')],_0x5cb3cc[_0x3bfc('0x1f')]);_0x35fe8e[_0x3bfc('0x21')]['create']({'body':_0xa1b907['body'],'to':_0xa1b907[_0x3bfc('0x20')],'from':_0x5cb3cc['phone'],'statusCallback':_0x5cb3cc[_0x3bfc('0x22')]+_0x3bfc('0x23')+_0xa1b907['id']+_0x3bfc('0x24')+_0x5cb3cc['token']})[_0x3bfc('0x13')](function(_0x3bb913){if(_0x3bb913['sid']){return _0xfb7643[_0x3bfc('0x14')]({'messageId':_0x3bb913[_0x3bfc('0x25')]});}})[_0x3bfc('0x17')](function(_0x108e20){logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3bfc('0x26'),'twilio',util[_0x3bfc('0x27')](_0x108e20,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),'afterCreate',_0x3bfc('0x1d'),_0x3bfc('0x29'));}break;case _0x3bfc('0x2a'):var _0x4a4e12=require(_0x3bfc('0x2b'));if(_0x5cb3cc[_0x3bfc('0x2c')]&&_0x5cb3cc[_0x3bfc('0x2d')]){var _0x282d20={'username':_0x5cb3cc['username'],'password':_0x5cb3cc[_0x3bfc('0x2d')],'recipients[]':[_0xa1b907[_0x3bfc('0x20')]],'text':_0xa1b907['body'],'charset':_0x3bfc('0x2e')};switch(_0x5cb3cc[_0x3bfc('0x2f')]){case _0x3bfc('0x30'):_0x282d20['method']=_0x3bfc('0x31');break;case'classic':_0x282d20['method']='send_sms_classic';_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];if(_0x5cb3cc[_0x3bfc('0x33')]){_0x282d20[_0x3bfc('0x34')]=_0x5cb3cc[_0x3bfc('0x33')];}else if(_0x5cb3cc[_0x3bfc('0x20')]){_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];}break;case _0x3bfc('0x35'):_0x282d20['method']='send_sms_classic_report';_0x282d20['sender_number']=_0x5cb3cc[_0x3bfc('0x20')];if(_0x5cb3cc[_0x3bfc('0x33')]){_0x282d20[_0x3bfc('0x34')]=_0x5cb3cc[_0x3bfc('0x33')];}else if(_0x5cb3cc[_0x3bfc('0x20')]){_0x282d20[_0x3bfc('0x32')]=_0x5cb3cc[_0x3bfc('0x20')];}break;}var _0x13c21a=_0x4a4e12[_0x3bfc('0x36')](_0x282d20);var _0x61315={'method':_0x3bfc('0x37'),'uri':_0x3bfc('0x38'),'body':_0x13c21a,'headers':{'Content-Type':'application/x-www-form-urlencoded','Content-Length':_0x13c21a['length'],'Content-Encoding':'utf8'}};rp(_0x61315)['then'](function(_0x542706){var _0x577ccf=_0x4a4e12['parse'](_0x542706);if(_0x577ccf['status']=='success'){var _0x3eb239={'messageId':_0x577ccf['id']};if(_0x5cb3cc[_0x3bfc('0x2f')]!=='classic+'||!_0x5cb3cc[_0x3bfc('0x39')]){_0x3eb239['read']=!![];}return _0xfb7643['update'](_0x3eb239);}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),util[_0x3bfc('0x27')](_0x577ccf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1eca47){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),util[_0x3bfc('0x27')](_0x1eca47,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x2a'),_0x3bfc('0x3a'));}break;case _0x3bfc('0x3b'):if(_0x5cb3cc[_0x3bfc('0x1f')]){var _0x282d20={'recipient':_0xa1b907[_0x3bfc('0x20')],'message':_0xa1b907['body'],'sender':_0x5cb3cc['senderString']||_0x5cb3cc['phone'],'authorization':_0x5cb3cc[_0x3bfc('0x1f')]};var _0x61315={'method':_0x3bfc('0x37'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x282d20,'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x3c1980){var _0x1f860f={'messageId':_0x3c1980[_0x3bfc('0x3c')]};if(!_0x5cb3cc[_0x3bfc('0x39')]){_0x1f860f['read']=!![];}return _0xfb7643[_0x3bfc('0x14')](_0x1f860f);})['catch'](function(_0x2e9e07){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x3b'),util['inspect'](_0x2e9e07,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x3b'),_0x3bfc('0x3d'));}break;case _0x3bfc('0x3e'):if(_0x5cb3cc[_0x3bfc('0x2c')]&&_0x5cb3cc[_0x3bfc('0x2d')]){var _0x282d20={'messages':[{'source':'xCALLY\x20Motion','to':_0xa1b907[_0x3bfc('0x20')],'body':_0xa1b907[_0x3bfc('0x16')],'from':_0x5cb3cc[_0x3bfc('0x33')]||_0x5cb3cc[_0x3bfc('0x20')]}]};var _0x3ecc55=util[_0x3bfc('0x3f')]('%s:%s',_0x5cb3cc[_0x3bfc('0x2c')],_0x5cb3cc[_0x3bfc('0x2d')]);var _0x61315={'method':_0x3bfc('0x37'),'uri':_0x3bfc('0x40'),'body':_0x282d20,'headers':{'Authorization':util['format'](_0x3bfc('0x41'),new Buffer(_0x3ecc55)[_0x3bfc('0x42')](_0x3bfc('0x43')))},'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x422f69){if(_0x422f69[_0x3bfc('0x44')]>=0xc8&&_0x422f69[_0x3bfc('0x44')]<=0xce){if(_0x422f69['data']&&_0x422f69[_0x3bfc('0x45')]['queued_count']>0x0){var _0x12c59a=_[_0x3bfc('0x46')](_0x422f69[_0x3bfc('0x45')][_0x3bfc('0x21')]);var _0x5aafb7={'messageId':_0x12c59a[_0x3bfc('0x47')]};if(!_0x5cb3cc[_0x3bfc('0x39')]){_0x5aafb7[_0x3bfc('0x48')]=!![];}return _0xfb7643[_0x3bfc('0x14')](_0x5aafb7);}else{logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x3bfc('0x49'),util[_0x3bfc('0x27')](_0x422f69,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x3bfc('0x28'),_0x3bfc('0x26'),_0x3bfc('0x49'),util['inspect'](_0x422f69,{'showHidden':![],'depth':null}));}})[_0x3bfc('0x17')](function(_0x1e84c1){logger[_0x3bfc('0x18')](_0x3bfc('0x28'),'afterCreate','clickSend',util[_0x3bfc('0x27')](_0x1e84c1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x3bfc('0x28'),'afterCreate',_0x3bfc('0x49'),_0x3bfc('0x3a'));}break;case'plivo':if(_0x5cb3cc['authId']&&_0x5cb3cc[_0x3bfc('0x1f')]){var _0x282d20={'dst':_0xa1b907[_0x3bfc('0x20')],'text':_0xa1b907[_0x3bfc('0x16')],'src':_0x5cb3cc['senderString']||_0x5cb3cc[_0x3bfc('0x20')],'url':_0x5cb3cc['remote']+'/api/sms/messages/'+_0xa1b907['id']+'/status?token='+_0x5cb3cc[_0x3bfc('0x4a')]};var _0x3ecc55=util[_0x3bfc('0x3f')](_0x3bfc('0x4b'),_0x5cb3cc['authId'],_0x5cb3cc[_0x3bfc('0x1f')]);var _0x61315={'method':_0x3bfc('0x37'),'uri':util[_0x3bfc('0x3f')](_0x3bfc('0x4c'),_0x5cb3cc['authId']),'body':_0x282d20,'headers':{'Authorization':util[_0x3bfc('0x3f')]('Basic\x20%s',new Buffer(_0x3ecc55)['toString'](_0x3bfc('0x43')))},'json':!![]};rp(_0x61315)[_0x3bfc('0x13')](function(_0x45bec9){var _0x10d848={'messageId':_0x45bec9[_0x3bfc('0x4d')][0x0]};return _0xfb7643['update'](_0x10d848);})[_0x3bfc('0x17')](function(_0x4f3d7f){logger[_0x3bfc('0x18')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3bfc('0x26'),_0x3bfc('0x4e'),util[_0x3bfc('0x27')](_0x4f3d7f,{'showHidden':![],'depth':null}));});}else{logger[_0x3bfc('0x18')](_0x3bfc('0x28'),_0x3bfc('0x26'),'plivo',_0x3bfc('0x4f'));}break;}}})[_0x3bfc('0x50')](function(){_0x1d0d80();});}else{_0x1d0d80();}}},'charset':'utf8mb4','collate':_0x3bfc('0x51')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 6971a2b..d814f25 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 _0x0705=['raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','localhost','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsMessage','create','body','options'];(function(_0x2f8a10,_0x2615c4){var _0xc46a3f=function(_0x1d40b3){while(--_0x1d40b3){_0x2f8a10['push'](_0x2f8a10['shift']());}};_0xc46a3f(++_0x2615c4);}(_0x0705,0xda));var _0x5070=function(_0x3287f4,_0x131a75){_0x3287f4=_0x3287f4-0x0;var _0x4f6d7e=_0x0705[_0x3287f4];return _0x4f6d7e;};'use strict';var _=require(_0x5070('0x0'));var util=require(_0x5070('0x1'));var moment=require(_0x5070('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x5070('0x3'))['db'];var utils=require(_0x5070('0x4'));var logger=require(_0x5070('0x5'))(_0x5070('0x6'));var config=require(_0x5070('0x7'));var jayson=require(_0x5070('0x8'));var client=jayson['client'][_0x5070('0x9')]({'port':0x232a});var socket=require(_0x5070('0xa'))({'host':_0x5070('0xb'),'port':0x18eb});require(_0x5070('0xc'))[_0x5070('0xd')](socket);function respondWithRpcPromise(_0x435304,_0x11271a,_0xb3d6a9){return new BPromise(function(_0x2557f4,_0x45b15f){return client[_0x5070('0xe')](_0x435304,_0xb3d6a9)[_0x5070('0xf')](function(_0x15705b){logger[_0x5070('0x10')](_0x5070('0x11'),_0x11271a,_0x5070('0x12'));logger[_0x5070('0x13')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x11271a,'request\x20sent',JSON[_0x5070('0x14')](_0x15705b));if(_0x15705b[_0x5070('0x15')]){if(_0x15705b['error'][_0x5070('0x16')]===0x1f4){logger['error'](_0x5070('0x11'),_0x11271a,_0x15705b[_0x5070('0x15')]['message']);return _0x45b15f(_0x15705b[_0x5070('0x15')][_0x5070('0x17')]);}logger['error'](_0x5070('0x11'),_0x11271a,_0x15705b[_0x5070('0x15')][_0x5070('0x17')]);return _0x2557f4(_0x15705b[_0x5070('0x15')]['message']);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x11271a,'request\x20sent');_0x2557f4(_0x15705b[_0x5070('0x18')][_0x5070('0x17')]);}})[_0x5070('0x19')](function(_0x135aa2){logger[_0x5070('0x15')](_0x5070('0x11'),_0x11271a,_0x135aa2);_0x45b15f(_0x135aa2);});});}exports[_0x5070('0x1a')]=function(_0x53ca45){var _0x4d0a4f=this;return new Promise(function(_0x46226d,_0x68601e){return db['SmsMessage'][_0x5070('0x1b')](_0x53ca45[_0x5070('0x1c')],{'raw':_0x53ca45[_0x5070('0x1d')]?_0x53ca45['options'][_0x5070('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2c1e6e){logger['info']('CreateSmsMessage',_0x53ca45);logger[_0x5070('0x13')](_0x5070('0x1a'),_0x53ca45,JSON['stringify'](_0x2c1e6e));_0x46226d(_0x2c1e6e);})[_0x5070('0x19')](function(_0x20f121){logger[_0x5070('0x15')](_0x5070('0x1a'),_0x20f121[_0x5070('0x17')],_0x53ca45);_0x68601e(_0x4d0a4f[_0x5070('0x15')](0x1f4,_0x20f121[_0x5070('0x17')]));});});}; \ No newline at end of file +var _0x8cf9=['error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','socket.io-emitter','localhost','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43762c,_0x48ff0f){var _0x4a85e0=function(_0x452e89){while(--_0x452e89){_0x43762c['push'](_0x43762c['shift']());}};_0x4a85e0(++_0x48ff0f);}(_0x8cf9,0x1cd));var _0x98cf=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x8cf9[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0x98cf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x98cf('0x1'));var rs=require(_0x98cf('0x2'));var fs=require('fs');var db=require(_0x98cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x98cf('0x4'))(_0x98cf('0x5'));var config=require(_0x98cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x98cf('0x7')][_0x98cf('0x8')]({'port':0x232a});var socket=require(_0x98cf('0x9'))({'host':_0x98cf('0xa'),'port':0x18eb});require('./smsMessage.socket')[_0x98cf('0xb')](socket);function respondWithRpcPromise(_0x473d57,_0x303db5,_0x2b219b){return new BPromise(function(_0x321dd3,_0x2a05b3){return client[_0x98cf('0xc')](_0x473d57,_0x2b219b)[_0x98cf('0xd')](function(_0x3a3e4c){logger['info'](_0x98cf('0xe'),_0x303db5,_0x98cf('0xf'));logger[_0x98cf('0x10')](_0x98cf('0x11'),_0x303db5,_0x98cf('0xf'),JSON[_0x98cf('0x12')](_0x3a3e4c));if(_0x3a3e4c['error']){if(_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x14')]===0x1f4){logger[_0x98cf('0x13')]('SmsMessage,\x20%s,\x20%s',_0x303db5,_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x2a05b3(_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);}logger[_0x98cf('0x13')](_0x98cf('0xe'),_0x303db5,_0x3a3e4c[_0x98cf('0x13')][_0x98cf('0x15')]);return _0x321dd3(_0x3a3e4c['error']['message']);}else{logger[_0x98cf('0x16')](_0x98cf('0xe'),_0x303db5,_0x98cf('0xf'));_0x321dd3(_0x3a3e4c[_0x98cf('0x17')][_0x98cf('0x15')]);}})[_0x98cf('0x18')](function(_0x3de31e){logger[_0x98cf('0x13')](_0x98cf('0xe'),_0x303db5,_0x3de31e);_0x2a05b3(_0x3de31e);});});}exports[_0x98cf('0x19')]=function(_0x58cb3e){var _0x124666=this;return new Promise(function(_0x2cd0be,_0x16a606){return db[_0x98cf('0x1a')][_0x98cf('0x1b')](_0x58cb3e[_0x98cf('0x1c')],{'raw':_0x58cb3e[_0x98cf('0x1d')]?_0x58cb3e['options']['raw']===undefined?!![]:![]:!![]})[_0x98cf('0xd')](function(_0x4f98ec){logger[_0x98cf('0x16')](_0x98cf('0x19'),_0x58cb3e);logger[_0x98cf('0x10')](_0x98cf('0x19'),_0x58cb3e,JSON[_0x98cf('0x12')](_0x4f98ec));_0x2cd0be(_0x4f98ec);})[_0x98cf('0x18')](function(_0x4b2ba4){logger[_0x98cf('0x13')]('CreateSmsMessage',_0x4b2ba4[_0x98cf('0x15')],_0x58cb3e);_0x16a606(_0x124666[_0x98cf('0x13')](0x1f4,_0x4b2ba4['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 9e308a6..89401c1 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 _0x59e3=['smsMessage:','save','remove','update','register','length'];(function(_0x24e23d,_0x26684a){var _0x14db43=function(_0x23ff5a){while(--_0x23ff5a){_0x24e23d['push'](_0x24e23d['shift']());}};_0x14db43(++_0x26684a);}(_0x59e3,0xa9));var _0x359e=function(_0x1c5fd2,_0x18f71c){_0x1c5fd2=_0x1c5fd2-0x0;var _0x585e70=_0x59e3[_0x1c5fd2];return _0x585e70;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x359e('0x0'),_0x359e('0x1'),_0x359e('0x2')];function createListener(_0x18c9c6,_0x30ffdc){return function(_0x289c15){_0x30ffdc['emit'](_0x18c9c6,_0x289c15);};}function removeListener(_0x3fe942,_0x15ec52){return function(){SmsMessageEvents['removeListener'](_0x3fe942,_0x15ec52);};}exports[_0x359e('0x3')]=function(_0x3016d3){for(var _0x7a014e=0x0,_0x3f1388=events[_0x359e('0x4')];_0x7a014e<_0x3f1388;_0x7a014e++){var _0x44389c=events[_0x7a014e];var _0x59e50b=createListener(_0x359e('0x5')+_0x44389c,_0x3016d3);SmsMessageEvents['on'](_0x44389c,_0x59e50b);}}; \ No newline at end of file +var _0xb48c=['remove','update','emit','register'];(function(_0x1abbf4,_0x2f199d){var _0x4c28d9=function(_0x1c5316){while(--_0x1c5316){_0x1abbf4['push'](_0x1abbf4['shift']());}};_0x4c28d9(++_0x2f199d);}(_0xb48c,0xdc));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=['save',_0xcb48('0x0'),_0xcb48('0x1')];function createListener(_0x38aee7,_0xd1931e){return function(_0x24947b){_0xd1931e[_0xcb48('0x2')](_0x38aee7,_0x24947b);};}function removeListener(_0x3e33b5,_0x108e7e){return function(){SmsMessageEvents['removeListener'](_0x3e33b5,_0x108e7e);};}exports[_0xcb48('0x3')]=function(_0xa96b04){for(var _0x2ec260=0x0,_0xd40cd7=events['length'];_0x2ec260<_0xd40cd7;_0x2ec260++){var _0x2a53b5=events[_0x2ec260];var _0x4dc617=createListener('smsMessage:'+_0x2a53b5,_0xa96b04);SmsMessageEvents['on'](_0x2a53b5,_0x4dc617);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 7ad3fd1..dc01956 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 _0xbb64=['describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','put','update','delete','destroy','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe'];(function(_0x2aefff,_0x26a24b){var _0x4e4534=function(_0x592416){while(--_0x592416){_0x2aefff['push'](_0x2aefff['shift']());}};_0x4e4534(++_0x26a24b);}(_0xbb64,0x10e));var _0x4bb6=function(_0x43cb2f,_0x57b462){_0x43cb2f=_0x43cb2f-0x0;var _0x5a9d03=_0xbb64[_0x43cb2f];return _0x5a9d03;};'use strict';var multer=require(_0x4bb6('0x0'));var util=require(_0x4bb6('0x1'));var path=require('path');var express=require(_0x4bb6('0x2'));var router=express['Router']();var auth=require(_0x4bb6('0x3'));var interaction=require(_0x4bb6('0x4'));var config=require(_0x4bb6('0x5'));var controller=require(_0x4bb6('0x6'));router[_0x4bb6('0x7')]('/',auth[_0x4bb6('0x8')](),controller['index']);router[_0x4bb6('0x7')](_0x4bb6('0x9'),auth[_0x4bb6('0x8')](),controller[_0x4bb6('0xa')]);router[_0x4bb6('0x7')](_0x4bb6('0xb'),auth['isAuthenticated'](),controller[_0x4bb6('0xc')]);router[_0x4bb6('0x7')](_0x4bb6('0xd'),auth['isAuthenticated'](),controller[_0x4bb6('0xe')]);router[_0x4bb6('0x7')]('/:id/teams',auth[_0x4bb6('0x8')](),controller[_0x4bb6('0xf')]);router[_0x4bb6('0x7')](_0x4bb6('0x10'),auth['isAuthenticated'](),controller[_0x4bb6('0x11')]);router[_0x4bb6('0x12')]('/',auth['isAuthenticated'](),controller[_0x4bb6('0x13')]);router['post'](_0x4bb6('0x14'),auth['isAuthenticated'](),controller[_0x4bb6('0x15')]);router[_0x4bb6('0x12')](_0x4bb6('0x10'),auth[_0x4bb6('0x8')](),controller['addAgents']);router[_0x4bb6('0x16')](_0x4bb6('0xb'),auth[_0x4bb6('0x8')](),controller[_0x4bb6('0x17')]);router[_0x4bb6('0x18')](_0x4bb6('0xb'),auth[_0x4bb6('0x8')](),controller[_0x4bb6('0x19')]);router[_0x4bb6('0x18')](_0x4bb6('0x14'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x4bb6('0x18')](_0x4bb6('0x10'),auth['isAuthenticated'](),controller[_0x4bb6('0x1a')]);module[_0x4bb6('0x1b')]=router; \ No newline at end of file +var _0x5b3d=['/:id/users','getAgents','post','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','express','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams'];(function(_0x26730f,_0xedac84){var _0x3a7899=function(_0x39ce1e){while(--_0x39ce1e){_0x26730f['push'](_0x26730f['shift']());}};_0x3a7899(++_0xedac84);}(_0x5b3d,0xc7));var _0xd5b3=function(_0x104662,_0x53a7a7){_0x104662=_0x104662-0x0;var _0x19cba7=_0x5b3d[_0x104662];return _0x19cba7;};'use strict';var multer=require(_0xd5b3('0x0'));var util=require('util');var path=require(_0xd5b3('0x1'));var express=require(_0xd5b3('0x2'));var router=express[_0xd5b3('0x3')]();var auth=require(_0xd5b3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd5b3('0x5'));var controller=require(_0xd5b3('0x6'));router[_0xd5b3('0x7')]('/',auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x9')]);router[_0xd5b3('0x7')](_0xd5b3('0xa'),auth['isAuthenticated'](),controller[_0xd5b3('0xb')]);router[_0xd5b3('0x7')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller['show']);router[_0xd5b3('0x7')](_0xd5b3('0xd'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0xe')]);router['get'](_0xd5b3('0xf'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x10')]);router[_0xd5b3('0x7')](_0xd5b3('0x11'),auth['isAuthenticated'](),controller[_0xd5b3('0x12')]);router[_0xd5b3('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd5b3('0x13')](_0xd5b3('0xf'),auth['isAuthenticated'](),controller['addTeams']);router[_0xd5b3('0x13')](_0xd5b3('0x11'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x14')]);router[_0xd5b3('0x15')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x16')]);router[_0xd5b3('0x17')](_0xd5b3('0xc'),auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x18')]);router[_0xd5b3('0x17')](_0xd5b3('0xf'),auth['isAuthenticated'](),controller[_0xd5b3('0x19')]);router[_0xd5b3('0x17')]('/:id/users',auth[_0xd5b3('0x8')](),controller[_0xd5b3('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 053625b..9eeea97 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 _0x3b08=['STRING','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0x3b08,0x101));var _0x83b0=function(_0x451821,_0x172379){_0x451821=_0x451821-0x0;var _0x51c114=_0x3b08[_0x451821];return _0x51c114;};'use strict';var Sequelize=require(_0x83b0('0x0'));module[_0x83b0('0x1')]={'name':{'type':Sequelize[_0x83b0('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x83b0('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x83b0('0x3')](_0x83b0('0x4'),_0x83b0('0x5'),_0x83b0('0x6'))}}; \ No newline at end of file +var _0xacd0=['rrmemory','roundrobin','sequelize','name','STRING'];(function(_0x4d3c17,_0x317c47){var _0xe81017=function(_0x498f4a){while(--_0x498f4a){_0x4d3c17['push'](_0x4d3c17['shift']());}};_0xe81017(++_0x317c47);}(_0xacd0,0x75));var _0x0acd=function(_0x207a02,_0x278c56){_0x207a02=_0x207a02-0x0;var _0xd995c3=_0xacd0[_0x207a02];return _0xd995c3;};'use strict';var Sequelize=require(_0x0acd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0acd('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0acd('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0acd('0x3'),'beepall',_0x0acd('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 23cc871..5100726 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 _0xd002=['options','include','findAll','rows','catch','show','params','intersection','find','create','body','describe','findOne','get','UserSmsQueue','User','UserId','agent','smsPause','updatedAt','createdAt','getTeams','Team','addTeams','ids','Agents','union','penalty','removeTeams','removeAgents','addAgents','spread','emit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','./smsQueue.socket','register','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','SmsQueue','rawAttributes','model','keys','query','dateEnd','dateStart','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','where','filter','map'];(function(_0x5ccb97,_0x5f888c){var _0x558cdb=function(_0x11d744){while(--_0x11d744){_0x5ccb97['push'](_0x5ccb97['shift']());}};_0x558cdb(++_0x5f888c);}(_0xd002,0x1a1));var _0x2d00=function(_0x2c329e,_0x158237){_0x2c329e=_0x2c329e-0x0;var _0x5e50d8=_0xd002[_0x2c329e];return _0x5e50d8;};'use strict';var jsonpatch=require(_0x2d00('0x0'));var rp=require(_0x2d00('0x1'));var moment=require(_0x2d00('0x2'));var BPromise=require(_0x2d00('0x3'));var Mustache=require('mustache');var util=require(_0x2d00('0x4'));var path=require(_0x2d00('0x5'));var sox=require(_0x2d00('0x6'));var csv=require('to-csv');var ejs=require(_0x2d00('0x7'));var fs=require('fs');var _=require(_0x2d00('0x8'));var squel=require('squel');var crypto=require(_0x2d00('0x9'));var jsforce=require(_0x2d00('0xa'));var deskjs=require(_0x2d00('0xb'));var toCsv=require(_0x2d00('0xc'));var querystring=require(_0x2d00('0xd'));var Papa=require('papaparse');var qs=require(_0x2d00('0xe'));var logger=require(_0x2d00('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x2d00('0x10'));var db=require(_0x2d00('0x11'))['db'];var socket=require('socket.io-emitter')({'host':_0x2d00('0x12'),'port':0x18eb});require(_0x2d00('0x13'))[_0x2d00('0x14')](socket);function respondWithStatusCode(_0x4c3cfe,_0xd9ca51){_0xd9ca51=_0xd9ca51||0xcc;return function(_0x3ead9e){if(_0x3ead9e){return _0x4c3cfe[_0x2d00('0x15')](_0xd9ca51);}return _0x4c3cfe['status'](_0xd9ca51)['end']();};}function respondWithResult(_0x4a92da,_0x3cd708){_0x3cd708=_0x3cd708||0xc8;return function(_0x4ebbd9){if(_0x4ebbd9){return _0x4a92da[_0x2d00('0x16')](_0x3cd708)[_0x2d00('0x17')](_0x4ebbd9);}};}function respondWithFilteredResult(_0x55063d,_0x55d1f7){return function(_0x2f8aa5){if(_0x2f8aa5){var _0xee2659=_0x2f8aa5[_0x2d00('0x18')],_0x2c397c=_0x55d1f7[_0x2d00('0x19')],_0x1d5fa5=_0x55d1f7[_0x2d00('0x19')]+_0x55d1f7[_0x2d00('0x1a')],_0x6a7d1a;if(_0x1d5fa5>=_0xee2659){_0x1d5fa5=_0xee2659;_0x6a7d1a=0xc8;}else{_0x6a7d1a=0xce;}_0x55063d[_0x2d00('0x16')](_0x6a7d1a);return _0x55063d['set'](_0x2d00('0x1b'),_0x2c397c+'-'+_0x1d5fa5+'/'+_0xee2659)[_0x2d00('0x17')](_0x2f8aa5);}return null;};}function patchUpdates(_0x53cd0b){return function(_0x1b49fc){try{jsonpatch['apply'](_0x1b49fc,_0x53cd0b,!![]);}catch(_0x2ffb17){return BPromise[_0x2d00('0x1c')](_0x2ffb17);}return _0x1b49fc[_0x2d00('0x1d')]();};}function saveUpdates(_0x2ac5ff,_0x5a0910){return function(_0x5388ae){if(_0x5388ae){return _0x5388ae[_0x2d00('0x1e')](_0x2ac5ff)[_0x2d00('0x1f')](function(_0x1503ce){return _0x1503ce;});}return null;};}function removeEntity(_0x157a2e,_0x116ea4){return function(_0x105b51){if(_0x105b51){return _0x105b51[_0x2d00('0x20')]()['then'](function(){_0x157a2e[_0x2d00('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b36ac,_0x16c11e){return function(_0x1ec000){if(!_0x1ec000){_0x2b36ac[_0x2d00('0x15')](0x194);}return _0x1ec000;};}function handleError(_0xa6f566,_0x559562){_0x559562=_0x559562||0x1f4;return function(_0x3add59){logger[_0x2d00('0x21')](_0x3add59[_0x2d00('0x22')]);if(_0x3add59[_0x2d00('0x23')]){delete _0x3add59[_0x2d00('0x23')];}_0xa6f566[_0x2d00('0x16')](_0x559562)['send'](_0x3add59);};}exports['index']=function(_0x9307d0,_0x5a595d){var _0x4de7be={},_0x434d33={},_0x13989f={'count':0x0,'rows':[]};var _0x385624=db[_0x2d00('0x24')][_0x2d00('0x25')];_0x434d33[_0x2d00('0x26')]=_[_0x2d00('0x27')](_0x385624);var _0x31c6bf={'dateStart':_0x9307d0[_0x2d00('0x28')]['dateStart'],'dateEnd':_0x9307d0[_0x2d00('0x28')][_0x2d00('0x29')]};delete _0x9307d0[_0x2d00('0x28')][_0x2d00('0x2a')];delete _0x9307d0[_0x2d00('0x28')][_0x2d00('0x29')];_0x434d33[_0x2d00('0x28')]=_[_0x2d00('0x27')](_0x9307d0['query']);_0x434d33[_0x2d00('0x2b')]=_['intersection'](_0x434d33['model'],_0x434d33['query']);_0x4de7be[_0x2d00('0x2c')]=_['intersection'](_0x434d33['model'],qs[_0x2d00('0x2d')](_0x9307d0[_0x2d00('0x28')][_0x2d00('0x2d')]));_0x4de7be[_0x2d00('0x2c')]=_0x4de7be[_0x2d00('0x2c')][_0x2d00('0x2e')]?_0x4de7be[_0x2d00('0x2c')]:_0x434d33[_0x2d00('0x26')];if(!_0x9307d0[_0x2d00('0x28')][_0x2d00('0x2f')](_0x2d00('0x30'))){_0x4de7be[_0x2d00('0x1a')]=qs['limit'](_0x9307d0[_0x2d00('0x28')][_0x2d00('0x1a')]);_0x4de7be[_0x2d00('0x19')]=qs[_0x2d00('0x19')](_0x9307d0[_0x2d00('0x28')][_0x2d00('0x19')]);}_0x4de7be[_0x2d00('0x31')]=qs[_0x2d00('0x32')](_0x9307d0[_0x2d00('0x28')][_0x2d00('0x32')]);_0x4de7be['where']=qs['filters'](_[_0x2d00('0x33')](_0x9307d0['query'],_0x434d33[_0x2d00('0x2b')]));if(_0x31c6bf['dateStart']){if(_0x31c6bf[_0x2d00('0x29')]){_0x31c6bf[_0x2d00('0x29')]=moment(_0x31c6bf[_0x2d00('0x29')])[_0x2d00('0x34')](0x1,_0x2d00('0x35'));}else{_0x31c6bf[_0x2d00('0x29')]=moment(_0x31c6bf[_0x2d00('0x2a')])[_0x2d00('0x34')](0x1,_0x2d00('0x35'));}_[_0x2d00('0x36')](_0x4de7be[_0x2d00('0x37')],{'createdAt':{'$gte':_0x31c6bf['dateStart'],'$lte':_0x31c6bf[_0x2d00('0x29')]}});}if(_0x9307d0[_0x2d00('0x28')][_0x2d00('0x38')]){_0x4de7be[_0x2d00('0x37')]=_[_0x2d00('0x36')](_0x4de7be[_0x2d00('0x37')],{'$or':_[_0x2d00('0x39')](_0x4de7be['attributes'],function(_0x337537){var _0x23ed03={};_0x23ed03[_0x337537]={'$like':'%'+_0x9307d0['query'][_0x2d00('0x38')]+'%'};return _0x23ed03;})});}_0x4de7be=_[_0x2d00('0x36')]({},_0x4de7be,_0x9307d0[_0x2d00('0x3a')]);var _0x22e936={'where':_0x4de7be['where']};return db['SmsQueue'][_0x2d00('0x18')](_0x22e936)[_0x2d00('0x1f')](function(_0x3d22ae){_0x13989f[_0x2d00('0x18')]=_0x3d22ae;if(_0x9307d0[_0x2d00('0x28')]['includeAll']){_0x4de7be[_0x2d00('0x3b')]=[{'all':!![]}];}return db[_0x2d00('0x24')][_0x2d00('0x3c')](_0x4de7be);})[_0x2d00('0x1f')](function(_0x5974ac){_0x13989f[_0x2d00('0x3d')]=_0x5974ac;return _0x13989f;})[_0x2d00('0x1f')](respondWithFilteredResult(_0x5a595d,_0x4de7be))[_0x2d00('0x3e')](handleError(_0x5a595d,null));};exports[_0x2d00('0x3f')]=function(_0x5dca9a,_0x1a2002){var _0x3f0abd={'raw':!![],'where':{'id':_0x5dca9a[_0x2d00('0x40')]['id']}},_0x22d097={};_0x22d097[_0x2d00('0x26')]=_[_0x2d00('0x27')](db[_0x2d00('0x24')][_0x2d00('0x25')]);_0x22d097[_0x2d00('0x28')]=_[_0x2d00('0x27')](_0x5dca9a[_0x2d00('0x28')]);_0x22d097['filters']=_[_0x2d00('0x41')](_0x22d097[_0x2d00('0x26')],_0x22d097[_0x2d00('0x28')]);_0x3f0abd[_0x2d00('0x2c')]=_[_0x2d00('0x41')](_0x22d097['model'],qs[_0x2d00('0x2d')](_0x5dca9a[_0x2d00('0x28')][_0x2d00('0x2d')]));_0x3f0abd[_0x2d00('0x2c')]=_0x3f0abd[_0x2d00('0x2c')][_0x2d00('0x2e')]?_0x3f0abd[_0x2d00('0x2c')]:_0x22d097[_0x2d00('0x26')];if(_0x5dca9a[_0x2d00('0x28')]['includeAll']){_0x3f0abd[_0x2d00('0x3b')]=[{'all':!![]}];}_0x3f0abd=_[_0x2d00('0x36')]({},_0x3f0abd,_0x5dca9a[_0x2d00('0x3a')]);return db[_0x2d00('0x24')][_0x2d00('0x42')](_0x3f0abd)[_0x2d00('0x1f')](handleEntityNotFound(_0x1a2002,null))[_0x2d00('0x1f')](respondWithResult(_0x1a2002,null))[_0x2d00('0x3e')](handleError(_0x1a2002,null));};exports[_0x2d00('0x43')]=function(_0x24d4e3,_0x4fe5ef){return db[_0x2d00('0x24')][_0x2d00('0x43')](_0x24d4e3['body'],{})['then'](respondWithResult(_0x4fe5ef,0xc9))[_0x2d00('0x3e')](handleError(_0x4fe5ef,null));};exports[_0x2d00('0x1e')]=function(_0x29c1d4,_0x4cd208){if(_0x29c1d4[_0x2d00('0x44')]['id']){delete _0x29c1d4['body']['id'];}return db[_0x2d00('0x24')][_0x2d00('0x42')]({'where':{'id':_0x29c1d4[_0x2d00('0x40')]['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x4cd208,null))[_0x2d00('0x1f')](saveUpdates(_0x29c1d4[_0x2d00('0x44')],null))[_0x2d00('0x1f')](respondWithResult(_0x4cd208,null))['catch'](handleError(_0x4cd208,null));};exports[_0x2d00('0x20')]=function(_0x6bf0b0,_0x3f3b22){return db[_0x2d00('0x24')]['find']({'where':{'id':_0x6bf0b0[_0x2d00('0x40')]['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x3f3b22,null))[_0x2d00('0x1f')](removeEntity(_0x3f3b22,null))[_0x2d00('0x3e')](handleError(_0x3f3b22,null));};exports[_0x2d00('0x45')]=function(_0x30c2f7,_0x1967da){return db[_0x2d00('0x24')][_0x2d00('0x45')]()[_0x2d00('0x1f')](respondWithResult(_0x1967da,null))[_0x2d00('0x3e')](handleError(_0x1967da,null));};exports['getMembers']=function(_0x44fcbc,_0x513f37,_0x313d03){var _0x32e923={'raw':!![],'where':{}},_0x2b1f3b={},_0x533e4f;return db[_0x2d00('0x24')][_0x2d00('0x46')]({'where':{'id':_0x44fcbc[_0x2d00('0x40')]['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x513f37,null))['then'](function(_0x5c65ba){if(_0x5c65ba){_0x533e4f=_0x5c65ba[_0x2d00('0x47')]({'plain':!![]});_0x2b1f3b['model']=_[_0x2d00('0x27')](db[_0x2d00('0x48')]['rawAttributes']);_0x2b1f3b[_0x2d00('0x28')]=_['keys'](_0x44fcbc[_0x2d00('0x28')]);_0x2b1f3b[_0x2d00('0x2b')]=_[_0x2d00('0x41')](_0x2b1f3b[_0x2d00('0x26')],_0x2b1f3b[_0x2d00('0x28')]);_0x32e923[_0x2d00('0x2c')]=_[_0x2d00('0x41')](_0x2b1f3b[_0x2d00('0x26')],qs[_0x2d00('0x2d')](_0x44fcbc[_0x2d00('0x28')][_0x2d00('0x2d')]));_0x32e923[_0x2d00('0x2c')]=_0x32e923[_0x2d00('0x2c')][_0x2d00('0x2e')]?_0x32e923[_0x2d00('0x2c')]:_0x2b1f3b['model'];if(!_0x44fcbc['query'][_0x2d00('0x2f')]('nolimit')){_0x32e923['limit']=qs[_0x2d00('0x1a')](_0x44fcbc[_0x2d00('0x28')][_0x2d00('0x1a')]);_0x32e923[_0x2d00('0x19')]=qs[_0x2d00('0x19')](_0x44fcbc['query'][_0x2d00('0x19')]);}_0x32e923[_0x2d00('0x31')]=qs[_0x2d00('0x32')](_0x44fcbc[_0x2d00('0x28')][_0x2d00('0x32')]);_0x32e923['where']=qs[_0x2d00('0x2b')](_[_0x2d00('0x33')](_0x44fcbc[_0x2d00('0x28')],_0x2b1f3b[_0x2d00('0x2b')]));_0x32e923['where']['SmsQueueId']=_0x5c65ba['id'];if(_0x44fcbc[_0x2d00('0x28')][_0x2d00('0x38')]){_0x32e923[_0x2d00('0x37')]=_[_0x2d00('0x36')](_0x32e923[_0x2d00('0x37')],{'$or':_['map'](_0x32e923[_0x2d00('0x2c')],function(_0x1f68cf){var _0x35d7f4={};_0x35d7f4[_0x1f68cf]={'$like':'%'+_0x44fcbc[_0x2d00('0x28')][_0x2d00('0x38')]+'%'};return _0x35d7f4;})});}_0x32e923=_[_0x2d00('0x36')]({},_0x32e923,_0x44fcbc['options']);return db[_0x2d00('0x48')]['findAll'](_0x32e923);}})[_0x2d00('0x1f')](function(_0x242d7e){if(_0x242d7e){return db[_0x2d00('0x49')]['findAndCountAll']({'where':{'id':_[_0x2d00('0x39')](_0x242d7e,_0x2d00('0x4a')),'role':_0x2d00('0x4b')},'attributes':['id',_0x2d00('0x23'),_0x2d00('0x4c'),_0x2d00('0x4d'),_0x2d00('0x4e')]});}})['then'](function(_0x1b3e71){if(_0x1b3e71){return{'count':_0x1b3e71['count'],'rows':_[_0x2d00('0x39')](_0x1b3e71[_0x2d00('0x3d')],function(_0x10f193){return{'membername':_0x10f193['name'],'UserId':_0x10f193['id'],'queue_name':_0x533e4f['name'],'SmsQueueId':_0x533e4f['id'],'interface':util['format']('%s/%s','SIP',_0x10f193[_0x2d00('0x23')]),'penalty':0x0,'paused':_0x10f193[_0x2d00('0x4c')],'createdAt':_0x10f193['createdAt'],'updatedAt':_0x10f193['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2d00('0x1f')](respondWithFilteredResult(_0x513f37,_0x32e923))[_0x2d00('0x3e')](handleError(_0x513f37,null));};exports[_0x2d00('0x4f')]=function(_0x1aa5be,_0x5f10f3,_0x528182){var _0x2b5564={};var _0x1a4ded={};var _0x4e645b;var _0x80f665;return db[_0x2d00('0x24')]['findOne']({'where':{'id':_0x1aa5be[_0x2d00('0x40')]['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x5f10f3,null))[_0x2d00('0x1f')](function(_0xb5e2e6){if(_0xb5e2e6){_0x4e645b=_0xb5e2e6;_0x1a4ded[_0x2d00('0x26')]=_[_0x2d00('0x27')](db[_0x2d00('0x50')]['rawAttributes']);_0x1a4ded[_0x2d00('0x28')]=_[_0x2d00('0x27')](_0x1aa5be[_0x2d00('0x28')]);_0x1a4ded[_0x2d00('0x2b')]=_[_0x2d00('0x41')](_0x1a4ded[_0x2d00('0x26')],_0x1a4ded[_0x2d00('0x28')]);_0x2b5564[_0x2d00('0x2c')]=_[_0x2d00('0x41')](_0x1a4ded['model'],qs[_0x2d00('0x2d')](_0x1aa5be[_0x2d00('0x28')][_0x2d00('0x2d')]));_0x2b5564[_0x2d00('0x2c')]=_0x2b5564['attributes'][_0x2d00('0x2e')]?_0x2b5564['attributes']:_0x1a4ded[_0x2d00('0x26')];_0x2b5564['order']=qs[_0x2d00('0x32')](_0x1aa5be['query'][_0x2d00('0x32')]);_0x2b5564[_0x2d00('0x37')]=qs[_0x2d00('0x2b')](_[_0x2d00('0x33')](_0x1aa5be[_0x2d00('0x28')],_0x1a4ded[_0x2d00('0x2b')]));if(_0x1aa5be[_0x2d00('0x28')]['filter']){_0x2b5564[_0x2d00('0x37')]=_[_0x2d00('0x36')](_0x2b5564[_0x2d00('0x37')],{'$or':_[_0x2d00('0x39')](_0x2b5564[_0x2d00('0x2c')],function(_0x58173f){var _0x5c6462={};_0x5c6462[_0x58173f]={'$like':'%'+_0x1aa5be[_0x2d00('0x28')][_0x2d00('0x38')]+'%'};return _0x5c6462;})});}_0x2b5564=_[_0x2d00('0x36')]({},_0x2b5564,_0x1aa5be[_0x2d00('0x3a')]);return _0x4e645b['getTeams'](_0x2b5564);}})[_0x2d00('0x1f')](function(_0x2de748){if(_0x2de748){_0x80f665=_0x2de748[_0x2d00('0x2e')];if(!_0x1aa5be['query']['hasOwnProperty'](_0x2d00('0x30'))){_0x2b5564[_0x2d00('0x1a')]=qs[_0x2d00('0x1a')](_0x1aa5be[_0x2d00('0x28')][_0x2d00('0x1a')]);_0x2b5564[_0x2d00('0x19')]=qs['offset'](_0x1aa5be[_0x2d00('0x28')][_0x2d00('0x19')]);}return _0x4e645b[_0x2d00('0x4f')](_0x2b5564);}})[_0x2d00('0x1f')](function(_0x11c89e){if(_0x11c89e){return _0x11c89e?{'count':_0x80f665,'rows':_0x11c89e}:null;}})[_0x2d00('0x1f')](respondWithResult(_0x5f10f3,null))[_0x2d00('0x3e')](handleError(_0x5f10f3,null));};exports[_0x2d00('0x51')]=function(_0x5166b6,_0x22ab91,_0x2cb5e3){var _0x419e0c=[];var _0x3f4fd9;return db[_0x2d00('0x50')]['findAll']({'where':{'id':_0x5166b6[_0x2d00('0x44')][_0x2d00('0x52')]},'attributes':['id'],'include':[{'model':db[_0x2d00('0x49')],'as':_0x2d00('0x53'),'attributes':['id'],'raw':!![]}]})[_0x2d00('0x1f')](function(_0xc979d0){if(_0xc979d0){for(var _0x41c50f=0x0;_0x41c50f<_0xc979d0[_0x2d00('0x2e')];_0x41c50f+=0x1){for(var _0x26e356=0x0;_0x26e356<_0xc979d0[_0x41c50f]['Agents'][_0x2d00('0x2e')];_0x26e356+=0x1){_0x419e0c=_[_0x2d00('0x54')](_0x419e0c,[_0xc979d0[_0x41c50f][_0x2d00('0x53')][_0x26e356]['id']]);}}return _0x419e0c;}})[_0x2d00('0x1f')](function(_0x100a49){if(_0x100a49){return db[_0x2d00('0x24')][_0x2d00('0x42')]({'where':{'id':_0x5166b6['params']['id']}});}})[_0x2d00('0x1f')](function(_0x15b0af){if(_0x15b0af){_0x3f4fd9=_0x15b0af;return _0x3f4fd9['addAgents'](_0x419e0c,{'penalty':_0x5166b6[_0x2d00('0x44')][_0x2d00('0x55')]});}})[_0x2d00('0x1f')](function(_0x4c3c9c){if(_0x4c3c9c){return _0x3f4fd9['addTeams'](_0x5166b6[_0x2d00('0x44')]['ids']);}})[_0x2d00('0x1f')](handleEntityNotFound(_0x22ab91,null))['then'](respondWithStatusCode(_0x22ab91,null))[_0x2d00('0x3e')](handleError(_0x22ab91,null));};exports[_0x2d00('0x56')]=function(_0x1c9121,_0x1d8e19,_0x455846){var _0x1ae568=[];var _0x5c0792;return db[_0x2d00('0x50')][_0x2d00('0x3c')]({'where':{'id':_0x1c9121['query'][_0x2d00('0x52')]},'attributes':['id'],'include':[{'model':db[_0x2d00('0x49')],'as':_0x2d00('0x53'),'attributes':['id'],'raw':!![]}]})[_0x2d00('0x1f')](function(_0x455c2f){if(_0x455c2f){for(var _0x52ae9d=0x0;_0x52ae9d<_0x455c2f['length'];_0x52ae9d+=0x1){for(var _0x3e2a37=0x0;_0x3e2a37<_0x455c2f[_0x52ae9d][_0x2d00('0x53')][_0x2d00('0x2e')];_0x3e2a37+=0x1){_0x1ae568=_['union'](_0x1ae568,[_0x455c2f[_0x52ae9d][_0x2d00('0x53')][_0x3e2a37]['id']]);}}return _0x1ae568;}})[_0x2d00('0x1f')](function(_0x36c691){if(_0x36c691){return db[_0x2d00('0x24')][_0x2d00('0x42')]({'where':{'id':_0x1c9121[_0x2d00('0x40')]['id']}});}})[_0x2d00('0x1f')](function(_0x319202){if(_0x319202){_0x5c0792=_0x319202;return _0x5c0792[_0x2d00('0x57')](_0x1ae568);}})[_0x2d00('0x1f')](function(_0x5e85b8){if(_0x5c0792){return _0x5c0792[_0x2d00('0x56')](_0x1c9121['query'][_0x2d00('0x52')]);}})[_0x2d00('0x1f')](handleEntityNotFound(_0x1d8e19,null))[_0x2d00('0x1f')](respondWithStatusCode(_0x1d8e19,null))[_0x2d00('0x3e')](handleError(_0x1d8e19,null));};exports[_0x2d00('0x58')]=function(_0x41b9db,_0x2c673b,_0x2c2695){return db[_0x2d00('0x24')][_0x2d00('0x42')]({'where':{'id':_0x41b9db[_0x2d00('0x40')]['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x2c673b,null))[_0x2d00('0x1f')](function(_0x19dad0){if(_0x19dad0){return _0x19dad0[_0x2d00('0x58')](_0x41b9db[_0x2d00('0x44')]['ids'],_['omit'](_0x41b9db['body'],[_0x2d00('0x52'),'id'])||{})[_0x2d00('0x59')](function(_0x4b5787){for(var _0x24b63a=0x0;_0x24b63a<_0x41b9db['body'][_0x2d00('0x52')][_0x2d00('0x2e')];_0x24b63a+=0x1){socket[_0x2d00('0x5a')](_0x2d00('0x5b'),{'UserId':_0x41b9db[_0x2d00('0x44')]['ids'][_0x24b63a],'SmsQueueId':_0x41b9db[_0x2d00('0x40')]['id']});}return _0x4b5787;});}})[_0x2d00('0x1f')](respondWithResult(_0x2c673b,null))['catch'](handleError(_0x2c673b,null));};exports[_0x2d00('0x57')]=function(_0x414072,_0x46e5f4,_0x4a27b5){var _0x4169e5;return db[_0x2d00('0x24')][_0x2d00('0x42')]({'where':{'id':_0x414072['params']['id']}})[_0x2d00('0x1f')](handleEntityNotFound(_0x46e5f4,null))[_0x2d00('0x1f')](function(_0x3e8415){if(_0x3e8415){return _0x3e8415['removeAgents'](_0x414072[_0x2d00('0x28')][_0x2d00('0x52')])['then'](function(_0x22f4f0){if(_[_0x2d00('0x5c')](_0x414072['query']['ids'])){for(var _0x4f11c7=0x0;_0x4f11c7<_0x414072[_0x2d00('0x28')]['ids'][_0x2d00('0x2e')];_0x4f11c7+=0x1){socket[_0x2d00('0x5a')](_0x2d00('0x5d'),{'UserId':_0x414072[_0x2d00('0x28')]['ids'][_0x4f11c7],'SmsQueueId':_0x414072[_0x2d00('0x40')]['id']});}}else{socket[_0x2d00('0x5a')](_0x2d00('0x5d'),{'UserId':_0x414072[_0x2d00('0x28')]['ids'],'SmsQueueId':_0x414072[_0x2d00('0x40')]['id']});}});}})['then'](respondWithStatusCode(_0x46e5f4,null))['catch'](handleError(_0x46e5f4,null));};exports[_0x2d00('0x5e')]=function(_0x1e89e4,_0x371aa9,_0x5d5833){var _0x4573c9={};var _0x1c76c5={};var _0x2e969a;var _0x1984da;return db[_0x2d00('0x24')][_0x2d00('0x46')]({'where':{'id':_0x1e89e4[_0x2d00('0x40')]['id']}})['then'](handleEntityNotFound(_0x371aa9,null))[_0x2d00('0x1f')](function(_0x465fb7){if(_0x465fb7){_0x2e969a=_0x465fb7;_0x1c76c5[_0x2d00('0x26')]=_[_0x2d00('0x27')](db[_0x2d00('0x49')][_0x2d00('0x25')]);_0x1c76c5[_0x2d00('0x28')]=_[_0x2d00('0x27')](_0x1e89e4[_0x2d00('0x28')]);_0x1c76c5['filters']=_['intersection'](_0x1c76c5[_0x2d00('0x26')],_0x1c76c5[_0x2d00('0x28')]);_0x4573c9[_0x2d00('0x2c')]=_[_0x2d00('0x41')](_0x1c76c5[_0x2d00('0x26')],qs['fields'](_0x1e89e4['query']['fields']));_0x4573c9[_0x2d00('0x2c')]=_0x4573c9['attributes']['length']?_0x4573c9[_0x2d00('0x2c')]:_0x1c76c5[_0x2d00('0x26')];_0x4573c9[_0x2d00('0x31')]=qs[_0x2d00('0x32')](_0x1e89e4[_0x2d00('0x28')][_0x2d00('0x32')]);_0x4573c9['where']=qs[_0x2d00('0x2b')](_[_0x2d00('0x33')](_0x1e89e4['query'],_0x1c76c5['filters']));if(_0x1e89e4[_0x2d00('0x28')]['filter']){_0x4573c9[_0x2d00('0x37')]=_['merge'](_0x4573c9[_0x2d00('0x37')],{'$or':_[_0x2d00('0x39')](_0x4573c9['attributes'],function(_0x15b712){var _0x260e0f={};_0x260e0f[_0x15b712]={'$like':'%'+_0x1e89e4['query'][_0x2d00('0x38')]+'%'};return _0x260e0f;})});}_0x4573c9=_[_0x2d00('0x36')]({},_0x4573c9,_0x1e89e4[_0x2d00('0x3a')]);return _0x2e969a[_0x2d00('0x5e')](_0x4573c9);}})[_0x2d00('0x1f')](function(_0x4a0254){if(_0x4a0254){_0x1984da=_0x4a0254['length'];if(!_0x1e89e4[_0x2d00('0x28')][_0x2d00('0x2f')](_0x2d00('0x30'))){_0x4573c9[_0x2d00('0x1a')]=qs[_0x2d00('0x1a')](_0x1e89e4['query']['limit']);_0x4573c9[_0x2d00('0x19')]=qs[_0x2d00('0x19')](_0x1e89e4[_0x2d00('0x28')][_0x2d00('0x19')]);}return _0x2e969a[_0x2d00('0x5e')](_0x4573c9);}})[_0x2d00('0x1f')](function(_0x4ec639){if(_0x4ec639){return _0x4ec639?{'count':_0x1984da,'rows':_0x4ec639}:null;}})[_0x2d00('0x1f')](respondWithResult(_0x371aa9,null))[_0x2d00('0x3e')](handleError(_0x371aa9,null));}; \ No newline at end of file +var _0x2372=['papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','socket.io-emitter','localhost','./smsQueue.socket','end','status','json','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','SmsQueue','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','day','add','merge','filter','map','count','includeAll','include','rows','catch','show','params','options','create','body','find','describe','getMembers','findOne','get','UserSmsQueue','sort','pick','findAll','User','findAndCountAll','agent','smsPause','format','%s/%s','SIP','updatedAt','getTeams','Team','ids','Agents','addAgents','penalty','addTeams','removeTeams','removeAgents','omit','emit','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','fast-json-patch','moment','bluebird','path','ejs','lodash','squel','crypto','desk.js'];(function(_0x19158f,_0x52de63){var _0x526e39=function(_0x5ce78c){while(--_0x5ce78c){_0x19158f['push'](_0x19158f['shift']());}};_0x526e39(++_0x52de63);}(_0x2372,0x1e6));var _0x2237=function(_0x547274,_0x41c28b){_0x547274=_0x547274-0x0;var _0x7a2f5b=_0x2372[_0x547274];return _0x7a2f5b;};'use strict';var jsonpatch=require(_0x2237('0x0'));var rp=require('request-promise');var moment=require(_0x2237('0x1'));var BPromise=require(_0x2237('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2237('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2237('0x4'));var fs=require('fs');var _=require(_0x2237('0x5'));var squel=require(_0x2237('0x6'));var crypto=require(_0x2237('0x7'));var jsforce=require('jsforce');var deskjs=require(_0x2237('0x8'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2237('0x9'));var qs=require(_0x2237('0xa'));var logger=require(_0x2237('0xb'))(_0x2237('0xc'));var utils=require(_0x2237('0xd'));var config=require(_0x2237('0xe'));var db=require('../../mysqldb')['db'];var socket=require(_0x2237('0xf'))({'host':_0x2237('0x10'),'port':0x18eb});require(_0x2237('0x11'))['register'](socket);function respondWithStatusCode(_0x4aab67,_0x1d5976){_0x1d5976=_0x1d5976||0xcc;return function(_0x3811b8){if(_0x3811b8){return _0x4aab67['sendStatus'](_0x1d5976);}return _0x4aab67['status'](_0x1d5976)[_0x2237('0x12')]();};}function respondWithResult(_0x651ede,_0x45c8e5){_0x45c8e5=_0x45c8e5||0xc8;return function(_0x4efebf){if(_0x4efebf){return _0x651ede[_0x2237('0x13')](_0x45c8e5)[_0x2237('0x14')](_0x4efebf);}};}function respondWithFilteredResult(_0x1ea2b9,_0xa7cb99){return function(_0xda96c8){if(_0xda96c8){var _0x409d1c=_0xda96c8['count'],_0x57597c=_0xa7cb99[_0x2237('0x15')],_0x2d11f8=_0xa7cb99[_0x2237('0x15')]+_0xa7cb99['limit'],_0x52ae97;if(_0x2d11f8>=_0x409d1c){_0x2d11f8=_0x409d1c;_0x52ae97=0xc8;}else{_0x52ae97=0xce;}_0x1ea2b9[_0x2237('0x13')](_0x52ae97);return _0x1ea2b9[_0x2237('0x16')](_0x2237('0x17'),_0x57597c+'-'+_0x2d11f8+'/'+_0x409d1c)[_0x2237('0x14')](_0xda96c8);}return null;};}function patchUpdates(_0x264c1a){return function(_0xd94fd){try{jsonpatch[_0x2237('0x18')](_0xd94fd,_0x264c1a,!![]);}catch(_0x2b0111){return BPromise[_0x2237('0x19')](_0x2b0111);}return _0xd94fd[_0x2237('0x1a')]();};}function saveUpdates(_0x2e4a58,_0x491119){return function(_0x4c5913){if(_0x4c5913){return _0x4c5913[_0x2237('0x1b')](_0x2e4a58)['then'](function(_0x1e8ffb){return _0x1e8ffb;});}return null;};}function removeEntity(_0x572416,_0x4b5b02){return function(_0x40ed66){if(_0x40ed66){return _0x40ed66[_0x2237('0x1c')]()[_0x2237('0x1d')](function(){_0x572416[_0x2237('0x13')](0xcc)[_0x2237('0x12')]();});}};}function handleEntityNotFound(_0x1765dc,_0x37c7d8){return function(_0x3b14c7){if(!_0x3b14c7){_0x1765dc[_0x2237('0x1e')](0x194);}return _0x3b14c7;};}function handleError(_0x41fd2c,_0x1f8f12){_0x1f8f12=_0x1f8f12||0x1f4;return function(_0x2834c8){logger[_0x2237('0x1f')](_0x2834c8['stack']);if(_0x2834c8[_0x2237('0x20')]){delete _0x2834c8[_0x2237('0x20')];}_0x41fd2c[_0x2237('0x13')](_0x1f8f12)[_0x2237('0x21')](_0x2834c8);};}exports[_0x2237('0x22')]=function(_0x489106,_0x1a3b9e){var _0x4a3674={},_0x2835f1={},_0x294210={'count':0x0,'rows':[]};var _0x34ef2e=db[_0x2237('0x23')][_0x2237('0x24')];_0x2835f1[_0x2237('0x25')]=_[_0x2237('0x26')](_0x34ef2e);var _0x25ce6e={'dateStart':_0x489106[_0x2237('0x27')][_0x2237('0x28')],'dateEnd':_0x489106[_0x2237('0x27')][_0x2237('0x29')]};delete _0x489106[_0x2237('0x27')][_0x2237('0x28')];delete _0x489106[_0x2237('0x27')][_0x2237('0x29')];_0x2835f1[_0x2237('0x27')]=_['keys'](_0x489106[_0x2237('0x27')]);_0x2835f1[_0x2237('0x2a')]=_[_0x2237('0x2b')](_0x2835f1[_0x2237('0x25')],_0x2835f1['query']);_0x4a3674['attributes']=_[_0x2237('0x2b')](_0x2835f1[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x489106[_0x2237('0x27')][_0x2237('0x2c')]));_0x4a3674['attributes']=_0x4a3674[_0x2237('0x2d')][_0x2237('0x2e')]?_0x4a3674[_0x2237('0x2d')]:_0x2835f1[_0x2237('0x25')];if(!_0x489106[_0x2237('0x27')][_0x2237('0x2f')](_0x2237('0x30'))){_0x4a3674[_0x2237('0x31')]=qs[_0x2237('0x31')](_0x489106[_0x2237('0x27')][_0x2237('0x31')]);_0x4a3674[_0x2237('0x15')]=qs[_0x2237('0x15')](_0x489106[_0x2237('0x27')][_0x2237('0x15')]);}_0x4a3674[_0x2237('0x32')]=qs['sort'](_0x489106[_0x2237('0x27')]['sort']);_0x4a3674[_0x2237('0x33')]=qs[_0x2237('0x2a')](_['pick'](_0x489106[_0x2237('0x27')],_0x2835f1['filters']));if(_0x25ce6e['dateStart']){if(_0x25ce6e[_0x2237('0x29')]){_0x25ce6e[_0x2237('0x29')]=moment(_0x25ce6e[_0x2237('0x29')])['add'](0x1,_0x2237('0x34'));}else{_0x25ce6e[_0x2237('0x29')]=moment(_0x25ce6e['dateStart'])[_0x2237('0x35')](0x1,_0x2237('0x34'));}_[_0x2237('0x36')](_0x4a3674[_0x2237('0x33')],{'createdAt':{'$gte':_0x25ce6e[_0x2237('0x28')],'$lte':_0x25ce6e[_0x2237('0x29')]}});}if(_0x489106[_0x2237('0x27')][_0x2237('0x37')]){_0x4a3674[_0x2237('0x33')]=_[_0x2237('0x36')](_0x4a3674[_0x2237('0x33')],{'$or':_[_0x2237('0x38')](_0x4a3674[_0x2237('0x2d')],function(_0x53c161){var _0x3e97af={};_0x3e97af[_0x53c161]={'$like':'%'+_0x489106[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x3e97af;})});}_0x4a3674=_['merge']({},_0x4a3674,_0x489106['options']);var _0x1def07={'where':_0x4a3674[_0x2237('0x33')]};return db[_0x2237('0x23')][_0x2237('0x39')](_0x1def07)[_0x2237('0x1d')](function(_0x305150){_0x294210['count']=_0x305150;if(_0x489106['query'][_0x2237('0x3a')]){_0x4a3674[_0x2237('0x3b')]=[{'all':!![]}];}return db[_0x2237('0x23')]['findAll'](_0x4a3674);})['then'](function(_0x3aaa56){_0x294210[_0x2237('0x3c')]=_0x3aaa56;return _0x294210;})[_0x2237('0x1d')](respondWithFilteredResult(_0x1a3b9e,_0x4a3674))[_0x2237('0x3d')](handleError(_0x1a3b9e,null));};exports[_0x2237('0x3e')]=function(_0x49e017,_0x1fb238){var _0x47b183={'raw':!![],'where':{'id':_0x49e017[_0x2237('0x3f')]['id']}},_0x259ee8={};_0x259ee8[_0x2237('0x25')]=_[_0x2237('0x26')](db[_0x2237('0x23')]['rawAttributes']);_0x259ee8['query']=_[_0x2237('0x26')](_0x49e017[_0x2237('0x27')]);_0x259ee8['filters']=_[_0x2237('0x2b')](_0x259ee8[_0x2237('0x25')],_0x259ee8[_0x2237('0x27')]);_0x47b183[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x259ee8['model'],qs['fields'](_0x49e017[_0x2237('0x27')][_0x2237('0x2c')]));_0x47b183['attributes']=_0x47b183['attributes']['length']?_0x47b183[_0x2237('0x2d')]:_0x259ee8[_0x2237('0x25')];if(_0x49e017[_0x2237('0x27')][_0x2237('0x3a')]){_0x47b183[_0x2237('0x3b')]=[{'all':!![]}];}_0x47b183=_[_0x2237('0x36')]({},_0x47b183,_0x49e017[_0x2237('0x40')]);return db[_0x2237('0x23')]['find'](_0x47b183)[_0x2237('0x1d')](handleEntityNotFound(_0x1fb238,null))[_0x2237('0x1d')](respondWithResult(_0x1fb238,null))[_0x2237('0x3d')](handleError(_0x1fb238,null));};exports[_0x2237('0x41')]=function(_0x2dcb57,_0x10d675){return db['SmsQueue']['create'](_0x2dcb57['body'],{})['then'](respondWithResult(_0x10d675,0xc9))[_0x2237('0x3d')](handleError(_0x10d675,null));};exports['update']=function(_0x2bdba3,_0x4a1cee){if(_0x2bdba3[_0x2237('0x42')]['id']){delete _0x2bdba3[_0x2237('0x42')]['id'];}return db[_0x2237('0x23')]['find']({'where':{'id':_0x2bdba3['params']['id']}})['then'](handleEntityNotFound(_0x4a1cee,null))['then'](saveUpdates(_0x2bdba3[_0x2237('0x42')],null))['then'](respondWithResult(_0x4a1cee,null))['catch'](handleError(_0x4a1cee,null));};exports[_0x2237('0x1c')]=function(_0x531487,_0xbfc999){return db[_0x2237('0x23')][_0x2237('0x43')]({'where':{'id':_0x531487['params']['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0xbfc999,null))[_0x2237('0x1d')](removeEntity(_0xbfc999,null))[_0x2237('0x3d')](handleError(_0xbfc999,null));};exports[_0x2237('0x44')]=function(_0x211069,_0x3d778d){return db[_0x2237('0x23')][_0x2237('0x44')]()[_0x2237('0x1d')](respondWithResult(_0x3d778d,null))[_0x2237('0x3d')](handleError(_0x3d778d,null));};exports[_0x2237('0x45')]=function(_0x35fc5f,_0x1ce1cb,_0x3852b9){var _0xf33161={'raw':!![],'where':{}},_0x4f0d79={},_0x560ee1;return db[_0x2237('0x23')][_0x2237('0x46')]({'where':{'id':_0x35fc5f['params']['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x1ce1cb,null))[_0x2237('0x1d')](function(_0x2d103c){if(_0x2d103c){_0x560ee1=_0x2d103c[_0x2237('0x47')]({'plain':!![]});_0x4f0d79[_0x2237('0x25')]=_['keys'](db[_0x2237('0x48')][_0x2237('0x24')]);_0x4f0d79['query']=_['keys'](_0x35fc5f['query']);_0x4f0d79[_0x2237('0x2a')]=_[_0x2237('0x2b')](_0x4f0d79[_0x2237('0x25')],_0x4f0d79[_0x2237('0x27')]);_0xf33161[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x4f0d79[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x35fc5f[_0x2237('0x27')][_0x2237('0x2c')]));_0xf33161['attributes']=_0xf33161['attributes'][_0x2237('0x2e')]?_0xf33161[_0x2237('0x2d')]:_0x4f0d79[_0x2237('0x25')];if(!_0x35fc5f['query'][_0x2237('0x2f')](_0x2237('0x30'))){_0xf33161[_0x2237('0x31')]=qs['limit'](_0x35fc5f['query'][_0x2237('0x31')]);_0xf33161['offset']=qs['offset'](_0x35fc5f['query'][_0x2237('0x15')]);}_0xf33161[_0x2237('0x32')]=qs[_0x2237('0x49')](_0x35fc5f['query'][_0x2237('0x49')]);_0xf33161[_0x2237('0x33')]=qs[_0x2237('0x2a')](_[_0x2237('0x4a')](_0x35fc5f[_0x2237('0x27')],_0x4f0d79[_0x2237('0x2a')]));_0xf33161[_0x2237('0x33')]['SmsQueueId']=_0x2d103c['id'];if(_0x35fc5f[_0x2237('0x27')][_0x2237('0x37')]){_0xf33161['where']=_[_0x2237('0x36')](_0xf33161[_0x2237('0x33')],{'$or':_['map'](_0xf33161[_0x2237('0x2d')],function(_0x5d732d){var _0x3d12af={};_0x3d12af[_0x5d732d]={'$like':'%'+_0x35fc5f['query'][_0x2237('0x37')]+'%'};return _0x3d12af;})});}_0xf33161=_[_0x2237('0x36')]({},_0xf33161,_0x35fc5f[_0x2237('0x40')]);return db[_0x2237('0x48')][_0x2237('0x4b')](_0xf33161);}})[_0x2237('0x1d')](function(_0x465940){if(_0x465940){return db[_0x2237('0x4c')][_0x2237('0x4d')]({'where':{'id':_[_0x2237('0x38')](_0x465940,'UserId'),'role':_0x2237('0x4e')},'attributes':['id',_0x2237('0x20'),_0x2237('0x4f'),'updatedAt','createdAt']});}})[_0x2237('0x1d')](function(_0x14dc78){if(_0x14dc78){return{'count':_0x14dc78[_0x2237('0x39')],'rows':_['map'](_0x14dc78[_0x2237('0x3c')],function(_0x3891c0){return{'membername':_0x3891c0[_0x2237('0x20')],'UserId':_0x3891c0['id'],'queue_name':_0x560ee1['name'],'SmsQueueId':_0x560ee1['id'],'interface':util[_0x2237('0x50')](_0x2237('0x51'),_0x2237('0x52'),_0x3891c0[_0x2237('0x20')]),'penalty':0x0,'paused':_0x3891c0['smsPause'],'createdAt':_0x3891c0['createdAt'],'updatedAt':_0x3891c0[_0x2237('0x53')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2237('0x1d')](respondWithFilteredResult(_0x1ce1cb,_0xf33161))['catch'](handleError(_0x1ce1cb,null));};exports[_0x2237('0x54')]=function(_0x23d8c4,_0x138056,_0x9b15ea){var _0x363ef7={};var _0x334642={};var _0x764eb3;var _0x32e27d;return db[_0x2237('0x23')][_0x2237('0x46')]({'where':{'id':_0x23d8c4[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x138056,null))[_0x2237('0x1d')](function(_0x374910){if(_0x374910){_0x764eb3=_0x374910;_0x334642[_0x2237('0x25')]=_['keys'](db[_0x2237('0x55')][_0x2237('0x24')]);_0x334642['query']=_[_0x2237('0x26')](_0x23d8c4['query']);_0x334642['filters']=_[_0x2237('0x2b')](_0x334642[_0x2237('0x25')],_0x334642['query']);_0x363ef7[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x334642[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x2c')]));_0x363ef7[_0x2237('0x2d')]=_0x363ef7[_0x2237('0x2d')]['length']?_0x363ef7[_0x2237('0x2d')]:_0x334642[_0x2237('0x25')];_0x363ef7['order']=qs[_0x2237('0x49')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x49')]);_0x363ef7[_0x2237('0x33')]=qs['filters'](_[_0x2237('0x4a')](_0x23d8c4[_0x2237('0x27')],_0x334642[_0x2237('0x2a')]));if(_0x23d8c4[_0x2237('0x27')][_0x2237('0x37')]){_0x363ef7[_0x2237('0x33')]=_['merge'](_0x363ef7[_0x2237('0x33')],{'$or':_[_0x2237('0x38')](_0x363ef7['attributes'],function(_0x15b1bb){var _0x2ec32e={};_0x2ec32e[_0x15b1bb]={'$like':'%'+_0x23d8c4[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x2ec32e;})});}_0x363ef7=_[_0x2237('0x36')]({},_0x363ef7,_0x23d8c4[_0x2237('0x40')]);return _0x764eb3[_0x2237('0x54')](_0x363ef7);}})[_0x2237('0x1d')](function(_0x5c3405){if(_0x5c3405){_0x32e27d=_0x5c3405['length'];if(!_0x23d8c4[_0x2237('0x27')]['hasOwnProperty']('nolimit')){_0x363ef7[_0x2237('0x31')]=qs[_0x2237('0x31')](_0x23d8c4[_0x2237('0x27')][_0x2237('0x31')]);_0x363ef7[_0x2237('0x15')]=qs['offset'](_0x23d8c4[_0x2237('0x27')][_0x2237('0x15')]);}return _0x764eb3[_0x2237('0x54')](_0x363ef7);}})['then'](function(_0x584305){if(_0x584305){return _0x584305?{'count':_0x32e27d,'rows':_0x584305}:null;}})[_0x2237('0x1d')](respondWithResult(_0x138056,null))[_0x2237('0x3d')](handleError(_0x138056,null));};exports['addTeams']=function(_0x574fee,_0x1352ba,_0x62e4f5){var _0xd412e1=[];var _0x55d799;return db[_0x2237('0x55')]['findAll']({'where':{'id':_0x574fee['body'][_0x2237('0x56')]},'attributes':['id'],'include':[{'model':db[_0x2237('0x4c')],'as':_0x2237('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x5a2284){if(_0x5a2284){for(var _0xae9b81=0x0;_0xae9b81<_0x5a2284['length'];_0xae9b81+=0x1){for(var _0x45e115=0x0;_0x45e115<_0x5a2284[_0xae9b81][_0x2237('0x57')][_0x2237('0x2e')];_0x45e115+=0x1){_0xd412e1=_['union'](_0xd412e1,[_0x5a2284[_0xae9b81][_0x2237('0x57')][_0x45e115]['id']]);}}return _0xd412e1;}})[_0x2237('0x1d')](function(_0x11ffa3){if(_0x11ffa3){return db[_0x2237('0x23')]['find']({'where':{'id':_0x574fee[_0x2237('0x3f')]['id']}});}})[_0x2237('0x1d')](function(_0x36f165){if(_0x36f165){_0x55d799=_0x36f165;return _0x55d799[_0x2237('0x58')](_0xd412e1,{'penalty':_0x574fee[_0x2237('0x42')][_0x2237('0x59')]});}})[_0x2237('0x1d')](function(_0x14b873){if(_0x14b873){return _0x55d799[_0x2237('0x5a')](_0x574fee[_0x2237('0x42')]['ids']);}})[_0x2237('0x1d')](handleEntityNotFound(_0x1352ba,null))['then'](respondWithStatusCode(_0x1352ba,null))[_0x2237('0x3d')](handleError(_0x1352ba,null));};exports[_0x2237('0x5b')]=function(_0x48cdbe,_0x3a7c29,_0x1f05ce){var _0x216063=[];var _0x1bb893;return db[_0x2237('0x55')][_0x2237('0x4b')]({'where':{'id':_0x48cdbe['query'][_0x2237('0x56')]},'attributes':['id'],'include':[{'model':db[_0x2237('0x4c')],'as':_0x2237('0x57'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x232f31){if(_0x232f31){for(var _0x51aff4=0x0;_0x51aff4<_0x232f31[_0x2237('0x2e')];_0x51aff4+=0x1){for(var _0x59f7a1=0x0;_0x59f7a1<_0x232f31[_0x51aff4][_0x2237('0x57')]['length'];_0x59f7a1+=0x1){_0x216063=_['union'](_0x216063,[_0x232f31[_0x51aff4][_0x2237('0x57')][_0x59f7a1]['id']]);}}return _0x216063;}})[_0x2237('0x1d')](function(_0x2dfdfe){if(_0x2dfdfe){return db['SmsQueue'][_0x2237('0x43')]({'where':{'id':_0x48cdbe['params']['id']}});}})['then'](function(_0x403aa4){if(_0x403aa4){_0x1bb893=_0x403aa4;return _0x1bb893[_0x2237('0x5c')](_0x216063);}})[_0x2237('0x1d')](function(_0xa85646){if(_0x1bb893){return _0x1bb893[_0x2237('0x5b')](_0x48cdbe['query'][_0x2237('0x56')]);}})['then'](handleEntityNotFound(_0x3a7c29,null))[_0x2237('0x1d')](respondWithStatusCode(_0x3a7c29,null))[_0x2237('0x3d')](handleError(_0x3a7c29,null));};exports[_0x2237('0x58')]=function(_0x218005,_0x9f02c,_0x5138ea){return db[_0x2237('0x23')][_0x2237('0x43')]({'where':{'id':_0x218005[_0x2237('0x3f')]['id']}})['then'](handleEntityNotFound(_0x9f02c,null))['then'](function(_0x22c881){if(_0x22c881){return _0x22c881[_0x2237('0x58')](_0x218005['body']['ids'],_[_0x2237('0x5d')](_0x218005[_0x2237('0x42')],[_0x2237('0x56'),'id'])||{})['spread'](function(_0x2b7403){for(var _0x3d8a81=0x0;_0x3d8a81<_0x218005[_0x2237('0x42')][_0x2237('0x56')][_0x2237('0x2e')];_0x3d8a81+=0x1){socket[_0x2237('0x5e')](_0x2237('0x5f'),{'UserId':_0x218005['body'][_0x2237('0x56')][_0x3d8a81],'SmsQueueId':_0x218005[_0x2237('0x3f')]['id']});}return _0x2b7403;});}})['then'](respondWithResult(_0x9f02c,null))[_0x2237('0x3d')](handleError(_0x9f02c,null));};exports['removeAgents']=function(_0x594fdd,_0x47589d,_0x50f116){var _0x42193e;return db['SmsQueue']['find']({'where':{'id':_0x594fdd[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x47589d,null))[_0x2237('0x1d')](function(_0x402b66){if(_0x402b66){return _0x402b66['removeAgents'](_0x594fdd[_0x2237('0x27')][_0x2237('0x56')])[_0x2237('0x1d')](function(_0x2fce13){if(_[_0x2237('0x60')](_0x594fdd['query']['ids'])){for(var _0x143bae=0x0;_0x143bae<_0x594fdd[_0x2237('0x27')][_0x2237('0x56')][_0x2237('0x2e')];_0x143bae+=0x1){socket[_0x2237('0x5e')](_0x2237('0x61'),{'UserId':_0x594fdd[_0x2237('0x27')][_0x2237('0x56')][_0x143bae],'SmsQueueId':_0x594fdd[_0x2237('0x3f')]['id']});}}else{socket[_0x2237('0x5e')](_0x2237('0x61'),{'UserId':_0x594fdd[_0x2237('0x27')][_0x2237('0x56')],'SmsQueueId':_0x594fdd['params']['id']});}});}})[_0x2237('0x1d')](respondWithStatusCode(_0x47589d,null))['catch'](handleError(_0x47589d,null));};exports[_0x2237('0x62')]=function(_0x4a5fd2,_0x40fc3f,_0x42730a){var _0x1f2d33={};var _0x2c454e={};var _0x3ebce2;var _0x588a43;return db['SmsQueue']['findOne']({'where':{'id':_0x4a5fd2[_0x2237('0x3f')]['id']}})[_0x2237('0x1d')](handleEntityNotFound(_0x40fc3f,null))['then'](function(_0x2c581d){if(_0x2c581d){_0x3ebce2=_0x2c581d;_0x2c454e['model']=_[_0x2237('0x26')](db[_0x2237('0x4c')][_0x2237('0x24')]);_0x2c454e[_0x2237('0x27')]=_[_0x2237('0x26')](_0x4a5fd2['query']);_0x2c454e[_0x2237('0x2a')]=_['intersection'](_0x2c454e[_0x2237('0x25')],_0x2c454e[_0x2237('0x27')]);_0x1f2d33[_0x2237('0x2d')]=_[_0x2237('0x2b')](_0x2c454e[_0x2237('0x25')],qs[_0x2237('0x2c')](_0x4a5fd2['query']['fields']));_0x1f2d33['attributes']=_0x1f2d33[_0x2237('0x2d')][_0x2237('0x2e')]?_0x1f2d33[_0x2237('0x2d')]:_0x2c454e['model'];_0x1f2d33[_0x2237('0x32')]=qs[_0x2237('0x49')](_0x4a5fd2[_0x2237('0x27')][_0x2237('0x49')]);_0x1f2d33[_0x2237('0x33')]=qs[_0x2237('0x2a')](_['pick'](_0x4a5fd2[_0x2237('0x27')],_0x2c454e[_0x2237('0x2a')]));if(_0x4a5fd2[_0x2237('0x27')][_0x2237('0x37')]){_0x1f2d33['where']=_[_0x2237('0x36')](_0x1f2d33['where'],{'$or':_[_0x2237('0x38')](_0x1f2d33[_0x2237('0x2d')],function(_0x316839){var _0x354a44={};_0x354a44[_0x316839]={'$like':'%'+_0x4a5fd2[_0x2237('0x27')][_0x2237('0x37')]+'%'};return _0x354a44;})});}_0x1f2d33=_[_0x2237('0x36')]({},_0x1f2d33,_0x4a5fd2[_0x2237('0x40')]);return _0x3ebce2[_0x2237('0x62')](_0x1f2d33);}})['then'](function(_0x1c60cd){if(_0x1c60cd){_0x588a43=_0x1c60cd[_0x2237('0x2e')];if(!_0x4a5fd2[_0x2237('0x27')]['hasOwnProperty'](_0x2237('0x30'))){_0x1f2d33[_0x2237('0x31')]=qs['limit'](_0x4a5fd2[_0x2237('0x27')]['limit']);_0x1f2d33[_0x2237('0x15')]=qs[_0x2237('0x15')](_0x4a5fd2[_0x2237('0x27')][_0x2237('0x15')]);}return _0x3ebce2[_0x2237('0x62')](_0x1f2d33);}})[_0x2237('0x1d')](function(_0x3d3736){if(_0x3d3736){return _0x3d3736?{'count':_0x588a43,'rows':_0x3d3736}:null;}})[_0x2237('0x1d')](respondWithResult(_0x40fc3f,null))[_0x2237('0x3d')](handleError(_0x40fc3f,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 64cd698..19fe877 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 _0x5bd8=['save','update','remove','emit','SmsQueue','setMaxListeners'];(function(_0x29d400,_0x50a634){var _0x507b8e=function(_0x6e978f){while(--_0x6e978f){_0x29d400['push'](_0x29d400['shift']());}};_0x507b8e(++_0x50a634);}(_0x5bd8,0x88));var _0x85bd=function(_0x76c774,_0x436a21){_0x76c774=_0x76c774-0x0;var _0x3a69f5=_0x5bd8[_0x76c774];return _0x3a69f5;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x85bd('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x85bd('0x1')](0x0);var events={'afterCreate':_0x85bd('0x2'),'afterUpdate':_0x85bd('0x3'),'afterDestroy':_0x85bd('0x4')};function emitEvent(_0x559814){return function(_0x51101c,_0x45a1a7,_0x7f6ad8){SmsQueueEvents[_0x85bd('0x5')](_0x559814+':'+_0x51101c['id'],_0x51101c);SmsQueueEvents['emit'](_0x559814,_0x51101c);_0x7f6ad8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0x7344=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0xb39e3b,_0x2be5df){var _0x40515c=function(_0x58e386){while(--_0x58e386){_0xb39e3b['push'](_0xb39e3b['shift']());}};_0x40515c(++_0x2be5df);}(_0x7344,0xa9));var _0x4734=function(_0x100ee1,_0x15902f){_0x100ee1=_0x100ee1-0x0;var _0x299059=_0x7344[_0x100ee1];return _0x299059;};'use strict';var EventEmitter=require(_0x4734('0x0'));var SmsQueue=require(_0x4734('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x4734('0x2')](0x0);var events={'afterCreate':_0x4734('0x3'),'afterUpdate':_0x4734('0x4'),'afterDestroy':_0x4734('0x5')};function emitEvent(_0x215247){return function(_0x4fd288,_0x453455,_0x1b906d){SmsQueueEvents['emit'](_0x215247+':'+_0x4fd288['id'],_0x4fd288);SmsQueueEvents[_0x4734('0x6')](_0x215247,_0x4fd288);_0x1b906d(null);};}for(var e in events){if(events[_0x4734('0x7')](e)){var event=events[e];SmsQueue[_0x4734('0x8')](e,emitEvent(event));}}module[_0x4734('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 0ebcd01..9e9e678 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 _0x176a=['api','moment','bluebird','request-promise','./smsQueue.attributes','exports','define','sms_queues','lodash','util'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x176a,0x1ca));var _0xa176=function(_0x1727ad,_0x50581a){_0x1727ad=_0x1727ad-0x0;var _0x55badc=_0x176a[_0x1727ad];return _0x55badc;};'use strict';var _=require(_0xa176('0x0'));var util=require(_0xa176('0x1'));var logger=require('../../config/logger')(_0xa176('0x2'));var moment=require(_0xa176('0x3'));var BPromise=require(_0xa176('0x4'));var rp=require(_0xa176('0x5'));var attributes=require(_0xa176('0x6'));module[_0xa176('0x7')]=function(_0x5e1d8e,_0x34eb88){return _0x5e1d8e[_0xa176('0x8')]('SmsQueue',attributes,{'tableName':_0xa176('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa46=['util','../../config/logger','moment','bluebird','request-promise','./smsQueue.attributes','define','SmsQueue','lodash'];(function(_0x4cae10,_0x1598f4){var _0x20527a=function(_0x35737f){while(--_0x35737f){_0x4cae10['push'](_0x4cae10['shift']());}};_0x20527a(++_0x1598f4);}(_0xaa46,0x86));var _0x6aa4=function(_0x2ae9ab,_0x54da0a){_0x2ae9ab=_0x2ae9ab-0x0;var _0x5579e1=_0xaa46[_0x2ae9ab];return _0x5579e1;};'use strict';var _=require(_0x6aa4('0x0'));var util=require(_0x6aa4('0x1'));var logger=require(_0x6aa4('0x2'))('api');var moment=require(_0x6aa4('0x3'));var BPromise=require(_0x6aa4('0x4'));var rp=require(_0x6aa4('0x5'));var attributes=require(_0x6aa4('0x6'));module['exports']=function(_0x565db6,_0x4d5dc8){return _0x565db6[_0x6aa4('0x7')](_0x6aa4('0x8'),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 0db0fa1..fbbda0a 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 _0x5661=['request','then','info','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsQueue,\x20%s,\x20%s','result','catch','GetSmsQueue','SmsQueue','findAll','options','attributes','limit','include','map','model','debug','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','localhost','./smsQueue.socket','register'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x5661,0x81));var _0x1566=function(_0x119ded,_0x497e72){_0x119ded=_0x119ded-0x0;var _0x22108b=_0x5661[_0x119ded];return _0x22108b;};'use strict';var _=require(_0x1566('0x0'));var util=require(_0x1566('0x1'));var moment=require(_0x1566('0x2'));var BPromise=require(_0x1566('0x3'));var rs=require(_0x1566('0x4'));var fs=require('fs');var db=require(_0x1566('0x5'))['db'];var utils=require(_0x1566('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1566('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x1566('0x8'),'port':0x18eb});require(_0x1566('0x9'))[_0x1566('0xa')](socket);function respondWithRpcPromise(_0x2ef05b,_0x3422d8,_0x25d942){return new BPromise(function(_0x413ce1,_0x491216){return client[_0x1566('0xb')](_0x2ef05b,_0x25d942)[_0x1566('0xc')](function(_0x2b0f9a){logger[_0x1566('0xd')]('SmsQueue,\x20%s,\x20%s',_0x3422d8,_0x1566('0xe'));logger['debug'](_0x1566('0xf'),_0x3422d8,'request\x20sent',JSON[_0x1566('0x10')](_0x2b0f9a));if(_0x2b0f9a[_0x1566('0x11')]){if(_0x2b0f9a[_0x1566('0x11')][_0x1566('0x12')]===0x1f4){logger[_0x1566('0x11')]('SmsQueue,\x20%s,\x20%s',_0x3422d8,_0x2b0f9a[_0x1566('0x11')][_0x1566('0x13')]);return _0x491216(_0x2b0f9a[_0x1566('0x11')][_0x1566('0x13')]);}logger[_0x1566('0x11')]('SmsQueue,\x20%s,\x20%s',_0x3422d8,_0x2b0f9a[_0x1566('0x11')][_0x1566('0x13')]);return _0x413ce1(_0x2b0f9a['error'][_0x1566('0x13')]);}else{logger['info'](_0x1566('0x14'),_0x3422d8,'request\x20sent');_0x413ce1(_0x2b0f9a[_0x1566('0x15')][_0x1566('0x13')]);}})[_0x1566('0x16')](function(_0x2ec932){logger[_0x1566('0x11')](_0x1566('0x14'),_0x3422d8,_0x2ec932);_0x491216(_0x2ec932);});});}exports[_0x1566('0x17')]=function(_0x432e96){var _0x524475=this;return new Promise(function(_0x54d8bf,_0x4b3bbd){return db[_0x1566('0x18')][_0x1566('0x19')]({'raw':_0x432e96[_0x1566('0x1a')]?_0x432e96['options']['raw']===undefined?!![]:![]:!![],'where':_0x432e96[_0x1566('0x1a')]?_0x432e96[_0x1566('0x1a')]['where']||null:null,'attributes':_0x432e96[_0x1566('0x1a')]?_0x432e96[_0x1566('0x1a')][_0x1566('0x1b')]||null:null,'limit':_0x432e96[_0x1566('0x1a')]?_0x432e96[_0x1566('0x1a')][_0x1566('0x1c')]||null:null,'include':_0x432e96[_0x1566('0x1a')]?_0x432e96[_0x1566('0x1a')][_0x1566('0x1d')]?_[_0x1566('0x1e')](_0x432e96[_0x1566('0x1a')]['include'],function(_0x6b6859){return{'model':db[_0x6b6859[_0x1566('0x1f')]],'as':_0x6b6859['as'],'attributes':_0x6b6859['attributes'],'include':_0x6b6859['include']?_['map'](_0x6b6859[_0x1566('0x1d')],function(_0x511b0c){return{'model':db[_0x511b0c[_0x1566('0x1f')]],'as':_0x511b0c['as'],'attributes':_0x511b0c[_0x1566('0x1b')],'include':_0x511b0c[_0x1566('0x1d')]?_[_0x1566('0x1e')](_0x511b0c[_0x1566('0x1d')],function(_0x2aafd9){return{'model':db[_0x2aafd9[_0x1566('0x1f')]],'as':_0x2aafd9['as'],'attributes':_0x2aafd9[_0x1566('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1566('0xc')](function(_0x5673d7){logger['info'](_0x1566('0x17'),_0x432e96);logger[_0x1566('0x20')](_0x1566('0x17'),_0x432e96,JSON[_0x1566('0x10')](_0x5673d7));_0x54d8bf(_0x5673d7);})['catch'](function(_0x1f6b42){logger[_0x1566('0x11')]('GetSmsQueue',_0x1f6b42['message'],_0x432e96);_0x4b3bbd(_0x524475['error'](0x1f4,_0x1f6b42[_0x1566('0x13')]));});});};exports[_0x1566('0x21')]=function(_0x5de6d0){var _0x3abb6f=this;return new Promise(function(_0x4072e3,_0x2f2d71){return db[_0x1566('0x18')][_0x1566('0x22')]({'raw':_0x5de6d0['options']?_0x5de6d0['options']['raw']===undefined?!![]:![]:!![],'where':_0x5de6d0[_0x1566('0x1a')]?_0x5de6d0[_0x1566('0x1a')]['where']||null:null,'attributes':_0x5de6d0['options']?_0x5de6d0[_0x1566('0x1a')]['attributes']||null:null,'include':_0x5de6d0[_0x1566('0x1a')]?_0x5de6d0[_0x1566('0x1a')][_0x1566('0x1d')]?_[_0x1566('0x1e')](_0x5de6d0[_0x1566('0x1a')]['include'],function(_0x22bab9){return{'model':db[_0x22bab9['model']],'as':_0x22bab9['as'],'attributes':_0x22bab9[_0x1566('0x1b')],'include':_0x22bab9['include']?_['map'](_0x22bab9[_0x1566('0x1d')],function(_0x423079){return{'model':db[_0x423079[_0x1566('0x1f')]],'as':_0x423079['as'],'attributes':_0x423079[_0x1566('0x1b')],'include':_0x423079[_0x1566('0x1d')]?_[_0x1566('0x1e')](_0x423079['include'],function(_0x4e8e4d){return{'model':db[_0x4e8e4d[_0x1566('0x1f')]],'as':_0x4e8e4d['as'],'attributes':_0x4e8e4d[_0x1566('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1566('0xc')](function(_0x3b992e){logger[_0x1566('0xd')]('ShowSmsQueue',_0x5de6d0);logger[_0x1566('0x20')](_0x1566('0x21'),_0x5de6d0,JSON[_0x1566('0x10')](_0x3b992e));_0x4072e3(_0x3b992e);})[_0x1566('0x16')](function(_0x437a9e){logger['error']('ShowSmsQueue',_0x437a9e[_0x1566('0x13')],_0x5de6d0);_0x2f2d71(_0x3abb6f['error'](0x1f4,_0x437a9e[_0x1566('0x13')]));});});}; \ No newline at end of file +var _0xe8f3=['attributes','info','GetSmsQueue','ShowSmsQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','socket.io-emitter','localhost','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsQueue','raw','options','where','limit','include','map','model'];(function(_0x21c550,_0x4e6312){var _0x32a419=function(_0x442d71){while(--_0x442d71){_0x21c550['push'](_0x21c550['shift']());}};_0x32a419(++_0x4e6312);}(_0xe8f3,0x185));var _0x3e8f=function(_0x236d0d,_0x285c99){_0x236d0d=_0x236d0d-0x0;var _0x443710=_0xe8f3[_0x236d0d];return _0x443710;};'use strict';var _=require('lodash');var util=require(_0x3e8f('0x0'));var moment=require(_0x3e8f('0x1'));var BPromise=require(_0x3e8f('0x2'));var rs=require(_0x3e8f('0x3'));var fs=require('fs');var db=require(_0x3e8f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e8f('0x5'))(_0x3e8f('0x6'));var config=require(_0x3e8f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3e8f('0x8')]({'port':0x232a});var socket=require(_0x3e8f('0x9'))({'host':_0x3e8f('0xa'),'port':0x18eb});require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x51baba,_0x296726,_0x16b62b){return new BPromise(function(_0x5a19b6,_0x3141b5){return client[_0x3e8f('0xb')](_0x51baba,_0x16b62b)[_0x3e8f('0xc')](function(_0x36fd10){logger['info'](_0x3e8f('0xd'),_0x296726,_0x3e8f('0xe'));logger[_0x3e8f('0xf')](_0x3e8f('0x10'),_0x296726,_0x3e8f('0xe'),JSON[_0x3e8f('0x11')](_0x36fd10));if(_0x36fd10[_0x3e8f('0x12')]){if(_0x36fd10['error'][_0x3e8f('0x13')]===0x1f4){logger[_0x3e8f('0x12')]('SmsQueue,\x20%s,\x20%s',_0x296726,_0x36fd10[_0x3e8f('0x12')][_0x3e8f('0x14')]);return _0x3141b5(_0x36fd10['error'][_0x3e8f('0x14')]);}logger['error'](_0x3e8f('0xd'),_0x296726,_0x36fd10['error'][_0x3e8f('0x14')]);return _0x5a19b6(_0x36fd10[_0x3e8f('0x12')][_0x3e8f('0x14')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x296726,_0x3e8f('0xe'));_0x5a19b6(_0x36fd10[_0x3e8f('0x15')][_0x3e8f('0x14')]);}})[_0x3e8f('0x16')](function(_0x10942a){logger[_0x3e8f('0x12')](_0x3e8f('0xd'),_0x296726,_0x10942a);_0x3141b5(_0x10942a);});});}exports['GetSmsQueue']=function(_0x1630a1){var _0x3395ad=this;return new Promise(function(_0x5ec6fa,_0xb4306e){return db[_0x3e8f('0x17')]['findAll']({'raw':_0x1630a1['options']?_0x1630a1['options'][_0x3e8f('0x18')]===undefined?!![]:![]:!![],'where':_0x1630a1['options']?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1a')]||null:null,'attributes':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')]['attributes']||null:null,'limit':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1b')]||null:null,'include':_0x1630a1[_0x3e8f('0x19')]?_0x1630a1[_0x3e8f('0x19')][_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x1630a1['options']['include'],function(_0x2ef1a6){return{'model':db[_0x2ef1a6[_0x3e8f('0x1e')]],'as':_0x2ef1a6['as'],'attributes':_0x2ef1a6[_0x3e8f('0x1f')],'include':_0x2ef1a6[_0x3e8f('0x1c')]?_['map'](_0x2ef1a6[_0x3e8f('0x1c')],function(_0x3b6e17){return{'model':db[_0x3b6e17[_0x3e8f('0x1e')]],'as':_0x3b6e17['as'],'attributes':_0x3b6e17[_0x3e8f('0x1f')],'include':_0x3b6e17[_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x3b6e17[_0x3e8f('0x1c')],function(_0x1c494e){return{'model':db[_0x1c494e[_0x3e8f('0x1e')]],'as':_0x1c494e['as'],'attributes':_0x1c494e[_0x3e8f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e8f('0xc')](function(_0x53f0e1){logger[_0x3e8f('0x20')](_0x3e8f('0x21'),_0x1630a1);logger[_0x3e8f('0xf')](_0x3e8f('0x21'),_0x1630a1,JSON[_0x3e8f('0x11')](_0x53f0e1));_0x5ec6fa(_0x53f0e1);})[_0x3e8f('0x16')](function(_0x2a0214){logger[_0x3e8f('0x12')](_0x3e8f('0x21'),_0x2a0214[_0x3e8f('0x14')],_0x1630a1);_0xb4306e(_0x3395ad['error'](0x1f4,_0x2a0214['message']));});});};exports[_0x3e8f('0x22')]=function(_0x4a3971){var _0x3c7a02=this;return new Promise(function(_0x3120be,_0x189b72){return db[_0x3e8f('0x17')]['find']({'raw':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971['options'][_0x3e8f('0x18')]===undefined?!![]:![]:!![],'where':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1a')]||null:null,'attributes':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1f')]||null:null,'include':_0x4a3971[_0x3e8f('0x19')]?_0x4a3971['options'][_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x4a3971[_0x3e8f('0x19')][_0x3e8f('0x1c')],function(_0x31349e){return{'model':db[_0x31349e[_0x3e8f('0x1e')]],'as':_0x31349e['as'],'attributes':_0x31349e[_0x3e8f('0x1f')],'include':_0x31349e[_0x3e8f('0x1c')]?_[_0x3e8f('0x1d')](_0x31349e[_0x3e8f('0x1c')],function(_0x1b0117){return{'model':db[_0x1b0117[_0x3e8f('0x1e')]],'as':_0x1b0117['as'],'attributes':_0x1b0117[_0x3e8f('0x1f')],'include':_0x1b0117['include']?_[_0x3e8f('0x1d')](_0x1b0117[_0x3e8f('0x1c')],function(_0x173108){return{'model':db[_0x173108[_0x3e8f('0x1e')]],'as':_0x173108['as'],'attributes':_0x173108[_0x3e8f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3e8f('0xc')](function(_0x5f5e0c){logger[_0x3e8f('0x20')](_0x3e8f('0x22'),_0x4a3971);logger[_0x3e8f('0xf')](_0x3e8f('0x22'),_0x4a3971,JSON['stringify'](_0x5f5e0c));_0x3120be(_0x5f5e0c);})[_0x3e8f('0x16')](function(_0x30ce99){logger[_0x3e8f('0x12')](_0x3e8f('0x22'),_0x30ce99[_0x3e8f('0x14')],_0x4a3971);_0x189b72(_0x3c7a02[_0x3e8f('0x12')](0x1f4,_0x30ce99[_0x3e8f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index bce016e..f7e7e00 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 _0x99a0=['smsQueue:','./smsQueue.events','save','emit','removeListener','register'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x99a0,0x121));var _0x099a=function(_0x41d206,_0x4347b7){_0x41d206=_0x41d206-0x0;var _0x2c77a6=_0x99a0[_0x41d206];return _0x2c77a6;};'use strict';var SmsQueueEvents=require(_0x099a('0x0'));var events=[_0x099a('0x1'),'remove','update'];function createListener(_0x5b4308,_0x593af0){return function(_0x3f281a){_0x593af0[_0x099a('0x2')](_0x5b4308,_0x3f281a);};}function removeListener(_0x5d6b40,_0x21d681){return function(){SmsQueueEvents[_0x099a('0x3')](_0x5d6b40,_0x21d681);};}exports[_0x099a('0x4')]=function(_0x215a07){for(var _0x2f1aea=0x0,_0xaebf62=events['length'];_0x2f1aea<_0xaebf62;_0x2f1aea++){var _0x18f862=events[_0x2f1aea];var _0x2da8c8=createListener(_0x099a('0x5')+_0x18f862,_0x215a07);SmsQueueEvents['on'](_0x18f862,_0x2da8c8);}}; \ No newline at end of file +var _0xb6c9=['emit','removeListener','register','./smsQueue.events','update'];(function(_0x1f3f99,_0x183ac7){var _0x195f46=function(_0xd47f3c){while(--_0xd47f3c){_0x1f3f99['push'](_0x1f3f99['shift']());}};_0x195f46(++_0x183ac7);}(_0xb6c9,0x152));var _0x9b6c=function(_0x572644,_0x543d79){_0x572644=_0x572644-0x0;var _0x17efa9=_0xb6c9[_0x572644];return _0x17efa9;};'use strict';var SmsQueueEvents=require(_0x9b6c('0x0'));var events=['save','remove',_0x9b6c('0x1')];function createListener(_0x59cf40,_0x17bb1d){return function(_0x20ee3d){_0x17bb1d[_0x9b6c('0x2')](_0x59cf40,_0x20ee3d);};}function removeListener(_0x510296,_0x5dc26d){return function(){SmsQueueEvents[_0x9b6c('0x3')](_0x510296,_0x5dc26d);};}exports[_0x9b6c('0x4')]=function(_0x20897f){for(var _0x20dbc7=0x0,_0x584f4d=events['length'];_0x20dbc7<_0x584f4d;_0x20dbc7++){var _0x578073=events[_0x20dbc7];var _0x52bc9d=createListener('smsQueue:'+_0x578073,_0x20897f);SmsQueueEvents['on'](_0x578073,_0x52bc9d);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 45bef88..6d9d22f 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 _0x2750=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','put','update','delete','/:id','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2750,0x13b));var _0x0275=function(_0x258e65,_0x23dd7a){_0x258e65=_0x258e65-0x0;var _0x447b66=_0x2750[_0x258e65];return _0x447b66;};'use strict';var multer=require(_0x0275('0x0'));var util=require('util');var path=require(_0x0275('0x1'));var express=require(_0x0275('0x2'));var router=express[_0x0275('0x3')]();var auth=require(_0x0275('0x4'));var interaction=require(_0x0275('0x5'));var config=require(_0x0275('0x6'));var controller=require(_0x0275('0x7'));router[_0x0275('0x8')]('/',auth[_0x0275('0x9')](),controller[_0x0275('0xa')]);router['get'](_0x0275('0xb'),auth[_0x0275('0x9')](),controller[_0x0275('0xc')]);router[_0x0275('0x8')]('/:id',auth[_0x0275('0x9')](),controller[_0x0275('0xd')]);router[_0x0275('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0275('0xf')]('/:id',auth[_0x0275('0x9')](),controller[_0x0275('0x10')]);router[_0x0275('0x11')](_0x0275('0x12'),auth[_0x0275('0x9')](),controller['destroy']);module[_0x0275('0x13')]=router; \ No newline at end of file +var _0x01fe=['show','post','create','delete','destroy','exports','multer','path','express','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x12b42b,_0x5cf262){var _0x162296=function(_0x4dc1df){while(--_0x4dc1df){_0x12b42b['push'](_0x12b42b['shift']());}};_0x162296(++_0x5cf262);}(_0x01fe,0x102));var _0xe01f=function(_0x33ab11,_0x3bdb60){_0x33ab11=_0x33ab11-0x0;var _0x595951=_0x01fe[_0x33ab11];return _0x595951;};'use strict';var multer=require(_0xe01f('0x0'));var util=require('util');var path=require(_0xe01f('0x1'));var express=require(_0xe01f('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe01f('0x3'));var config=require(_0xe01f('0x4'));var controller=require(_0xe01f('0x5'));router[_0xe01f('0x6')]('/',auth['isAuthenticated'](),controller[_0xe01f('0x7')]);router['get'](_0xe01f('0x8'),auth[_0xe01f('0x9')](),controller[_0xe01f('0xa')]);router[_0xe01f('0x6')](_0xe01f('0xb'),auth['isAuthenticated'](),controller[_0xe01f('0xc')]);router[_0xe01f('0xd')]('/',auth['isAuthenticated'](),controller[_0xe01f('0xe')]);router['put'](_0xe01f('0xb'),auth[_0xe01f('0x9')](),controller['update']);router[_0xe01f('0xf')]('/:id',auth[_0xe01f('0x9')](),controller[_0xe01f('0x10')]);module[_0xe01f('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index ba6a84c..85fe5b4 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 _0xfb9c=['sequelize','STRING','DATE','moment'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0xfb9c,0x8f));var _0xcfb9=function(_0x14bb2f,_0x3c8ed0){_0x14bb2f=_0x14bb2f-0x0;var _0x5e2041=_0xfb9c[_0x14bb2f];return _0x5e2041;};'use strict';var moment=require(_0xcfb9('0x0'));var Sequelize=require(_0xcfb9('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcfb9('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcfb9('0x2')]},'joinAt':{'type':Sequelize[_0xcfb9('0x3')]},'leaveAt':{'type':Sequelize[_0xcfb9('0x3')]},'acceptAt':{'type':Sequelize[_0xcfb9('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcfb9('0x2')]}}; \ No newline at end of file +var _0xa34e=['moment','sequelize','exports','STRING','DATE'];(function(_0x3a4639,_0x42370a){var _0x17f851=function(_0x210a54){while(--_0x210a54){_0x3a4639['push'](_0x3a4639['shift']());}};_0x17f851(++_0x42370a);}(_0xa34e,0x145));var _0xea34=function(_0x3ce3bc,_0x3530af){_0x3ce3bc=_0x3ce3bc-0x0;var _0x31100b=_0xa34e[_0x3ce3bc];return _0x31100b;};'use strict';var moment=require(_0xea34('0x0'));var Sequelize=require(_0xea34('0x1'));module[_0xea34('0x2')]={'uniqueid':{'type':Sequelize[_0xea34('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xea34('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xea34('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xea34('0x4')]},'reason':{'type':Sequelize[_0xea34('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index cce0493..2f9965a 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 _0xd389=['includeAll','include','findAll','rows','catch','params','find','create','body','describe','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','count','offset','Content-Range','save','update','then','destroy','error','stack','send','index','SmsQueueReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','limit','where','pick','add','day','filter','merge','map','options'];(function(_0x530191,_0x52edef){var _0x212d5d=function(_0x3388f0){while(--_0x3388f0){_0x530191['push'](_0x530191['shift']());}};_0x212d5d(++_0x52edef);}(_0xd389,0x14f));var _0x9d38=function(_0x3e1e1b,_0x560c1e){_0x3e1e1b=_0x3e1e1b-0x0;var _0x3f78a4=_0xd389[_0x3e1e1b];return _0x3f78a4;};'use strict';var jsonpatch=require(_0x9d38('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9d38('0x1'));var Mustache=require(_0x9d38('0x2'));var util=require(_0x9d38('0x3'));var path=require(_0x9d38('0x4'));var sox=require(_0x9d38('0x5'));var csv=require(_0x9d38('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9d38('0x7'));var squel=require(_0x9d38('0x8'));var crypto=require(_0x9d38('0x9'));var jsforce=require(_0x9d38('0xa'));var deskjs=require(_0x9d38('0xb'));var toCsv=require(_0x9d38('0x6'));var querystring=require(_0x9d38('0xc'));var Papa=require(_0x9d38('0xd'));var qs=require(_0x9d38('0xe'));var logger=require(_0x9d38('0xf'))(_0x9d38('0x10'));var utils=require(_0x9d38('0x11'));var config=require('../../config/environment');var db=require(_0x9d38('0x12'))['db'];function respondWithStatusCode(_0x443bfa,_0xc696c1){_0xc696c1=_0xc696c1||0xcc;return function(_0x5b1454){if(_0x5b1454){return _0x443bfa[_0x9d38('0x13')](_0xc696c1);}return _0x443bfa[_0x9d38('0x14')](_0xc696c1)[_0x9d38('0x15')]();};}function respondWithResult(_0x3c4d82,_0x247439){_0x247439=_0x247439||0xc8;return function(_0x24a957){if(_0x24a957){return _0x3c4d82[_0x9d38('0x14')](_0x247439)['json'](_0x24a957);}};}function respondWithFilteredResult(_0x10b9f0,_0x410092){return function(_0x5be00b){if(_0x5be00b){var _0x5a501d=_0x5be00b[_0x9d38('0x16')],_0xbbc501=_0x410092['offset'],_0x4f4c0c=_0x410092[_0x9d38('0x17')]+_0x410092['limit'],_0x302eef;if(_0x4f4c0c>=_0x5a501d){_0x4f4c0c=_0x5a501d;_0x302eef=0xc8;}else{_0x302eef=0xce;}_0x10b9f0['status'](_0x302eef);return _0x10b9f0['set'](_0x9d38('0x18'),_0xbbc501+'-'+_0x4f4c0c+'/'+_0x5a501d)['json'](_0x5be00b);}return null;};}function patchUpdates(_0x15b796){return function(_0x2d9dfb){try{jsonpatch['apply'](_0x2d9dfb,_0x15b796,!![]);}catch(_0x41cb96){return BPromise['reject'](_0x41cb96);}return _0x2d9dfb[_0x9d38('0x19')]();};}function saveUpdates(_0x5a0e27,_0x1376ad){return function(_0x5b50a8){if(_0x5b50a8){return _0x5b50a8[_0x9d38('0x1a')](_0x5a0e27)[_0x9d38('0x1b')](function(_0x1c00bc){return _0x1c00bc;});}return null;};}function removeEntity(_0x35064a,_0x153c22){return function(_0x2ff7a4){if(_0x2ff7a4){return _0x2ff7a4[_0x9d38('0x1c')]()[_0x9d38('0x1b')](function(){_0x35064a[_0x9d38('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55d063,_0x77279d){return function(_0x48ab6b){if(!_0x48ab6b){_0x55d063[_0x9d38('0x13')](0x194);}return _0x48ab6b;};}function handleError(_0x5154a5,_0x754eb0){_0x754eb0=_0x754eb0||0x1f4;return function(_0xb849ee){logger[_0x9d38('0x1d')](_0xb849ee[_0x9d38('0x1e')]);if(_0xb849ee['name']){delete _0xb849ee['name'];}_0x5154a5[_0x9d38('0x14')](_0x754eb0)[_0x9d38('0x1f')](_0xb849ee);};}exports[_0x9d38('0x20')]=function(_0x3a1670,_0x59aa01){var _0x29980f={},_0x46d725={},_0x2c9223={'count':0x0,'rows':[]};var _0x9ce49a=db[_0x9d38('0x21')][_0x9d38('0x22')];_0x46d725[_0x9d38('0x23')]=_[_0x9d38('0x24')](_0x9ce49a);var _0xacfd2c={'dateStart':_0x3a1670['query']['dateStart'],'dateEnd':_0x3a1670[_0x9d38('0x25')][_0x9d38('0x26')]};delete _0x3a1670[_0x9d38('0x25')][_0x9d38('0x27')];delete _0x3a1670[_0x9d38('0x25')]['dateEnd'];_0x46d725[_0x9d38('0x25')]=_[_0x9d38('0x24')](_0x3a1670[_0x9d38('0x25')]);_0x46d725[_0x9d38('0x28')]=_[_0x9d38('0x29')](_0x46d725[_0x9d38('0x23')],_0x46d725[_0x9d38('0x25')]);_0x29980f[_0x9d38('0x2a')]=_[_0x9d38('0x29')](_0x46d725[_0x9d38('0x23')],qs['fields'](_0x3a1670['query'][_0x9d38('0x2b')]));_0x29980f[_0x9d38('0x2a')]=_0x29980f['attributes'][_0x9d38('0x2c')]?_0x29980f[_0x9d38('0x2a')]:_0x46d725[_0x9d38('0x23')];if(!_0x3a1670[_0x9d38('0x25')][_0x9d38('0x2d')]('nolimit')){_0x29980f[_0x9d38('0x2e')]=qs[_0x9d38('0x2e')](_0x3a1670[_0x9d38('0x25')][_0x9d38('0x2e')]);_0x29980f[_0x9d38('0x17')]=qs[_0x9d38('0x17')](_0x3a1670[_0x9d38('0x25')][_0x9d38('0x17')]);}_0x29980f['order']=qs['sort'](_0x3a1670[_0x9d38('0x25')]['sort']);_0x29980f[_0x9d38('0x2f')]=qs[_0x9d38('0x28')](_[_0x9d38('0x30')](_0x3a1670['query'],_0x46d725[_0x9d38('0x28')]));if(_0xacfd2c[_0x9d38('0x27')]){if(_0xacfd2c['dateEnd']){_0xacfd2c[_0x9d38('0x26')]=moment(_0xacfd2c[_0x9d38('0x26')])[_0x9d38('0x31')](0x1,_0x9d38('0x32'));}else{_0xacfd2c[_0x9d38('0x26')]=moment(_0xacfd2c[_0x9d38('0x27')])[_0x9d38('0x31')](0x1,_0x9d38('0x32'));}_['merge'](_0x29980f[_0x9d38('0x2f')],{'createdAt':{'$gte':_0xacfd2c['dateStart'],'$lte':_0xacfd2c[_0x9d38('0x26')]}});}if(_0x3a1670[_0x9d38('0x25')][_0x9d38('0x33')]){_0x29980f[_0x9d38('0x2f')]=_[_0x9d38('0x34')](_0x29980f[_0x9d38('0x2f')],{'$or':_[_0x9d38('0x35')](_0x29980f[_0x9d38('0x2a')],function(_0x2ae2a6){var _0x2029f2={};_0x2029f2[_0x2ae2a6]={'$like':'%'+_0x3a1670[_0x9d38('0x25')][_0x9d38('0x33')]+'%'};return _0x2029f2;})});}_0x29980f=_['merge']({},_0x29980f,_0x3a1670[_0x9d38('0x36')]);var _0x4074d0={'where':_0x29980f[_0x9d38('0x2f')]};return db[_0x9d38('0x21')][_0x9d38('0x16')](_0x4074d0)[_0x9d38('0x1b')](function(_0x10d76b){_0x2c9223[_0x9d38('0x16')]=_0x10d76b;if(_0x3a1670[_0x9d38('0x25')][_0x9d38('0x37')]){_0x29980f[_0x9d38('0x38')]=[{'all':!![]}];}return db[_0x9d38('0x21')][_0x9d38('0x39')](_0x29980f);})[_0x9d38('0x1b')](function(_0x111707){_0x2c9223[_0x9d38('0x3a')]=_0x111707;return _0x2c9223;})['then'](respondWithFilteredResult(_0x59aa01,_0x29980f))[_0x9d38('0x3b')](handleError(_0x59aa01,null));};exports['show']=function(_0xd451bf,_0x2890d5){var _0x12947f={'raw':!![],'where':{'id':_0xd451bf[_0x9d38('0x3c')]['id']}},_0x52b051={};_0x52b051['model']=_['keys'](db[_0x9d38('0x21')][_0x9d38('0x22')]);_0x52b051[_0x9d38('0x25')]=_[_0x9d38('0x24')](_0xd451bf[_0x9d38('0x25')]);_0x52b051['filters']=_[_0x9d38('0x29')](_0x52b051[_0x9d38('0x23')],_0x52b051[_0x9d38('0x25')]);_0x12947f['attributes']=_[_0x9d38('0x29')](_0x52b051['model'],qs['fields'](_0xd451bf[_0x9d38('0x25')][_0x9d38('0x2b')]));_0x12947f['attributes']=_0x12947f[_0x9d38('0x2a')]['length']?_0x12947f[_0x9d38('0x2a')]:_0x52b051[_0x9d38('0x23')];if(_0xd451bf[_0x9d38('0x25')][_0x9d38('0x37')]){_0x12947f[_0x9d38('0x38')]=[{'all':!![]}];}_0x12947f=_[_0x9d38('0x34')]({},_0x12947f,_0xd451bf[_0x9d38('0x36')]);return db[_0x9d38('0x21')][_0x9d38('0x3d')](_0x12947f)['then'](handleEntityNotFound(_0x2890d5,null))[_0x9d38('0x1b')](respondWithResult(_0x2890d5,null))[_0x9d38('0x3b')](handleError(_0x2890d5,null));};exports[_0x9d38('0x3e')]=function(_0x447e43,_0x5d954b){return db[_0x9d38('0x21')][_0x9d38('0x3e')](_0x447e43[_0x9d38('0x3f')],{})[_0x9d38('0x1b')](respondWithResult(_0x5d954b,0xc9))[_0x9d38('0x3b')](handleError(_0x5d954b,null));};exports[_0x9d38('0x1a')]=function(_0x2a7d91,_0x5d5a96){if(_0x2a7d91['body']['id']){delete _0x2a7d91[_0x9d38('0x3f')]['id'];}return db['SmsQueueReport'][_0x9d38('0x3d')]({'where':{'id':_0x2a7d91[_0x9d38('0x3c')]['id']}})[_0x9d38('0x1b')](handleEntityNotFound(_0x5d5a96,null))[_0x9d38('0x1b')](saveUpdates(_0x2a7d91['body'],null))[_0x9d38('0x1b')](respondWithResult(_0x5d5a96,null))[_0x9d38('0x3b')](handleError(_0x5d5a96,null));};exports[_0x9d38('0x1c')]=function(_0x592801,_0xe7e9cf){return db[_0x9d38('0x21')][_0x9d38('0x3d')]({'where':{'id':_0x592801[_0x9d38('0x3c')]['id']}})['then'](handleEntityNotFound(_0xe7e9cf,null))[_0x9d38('0x1b')](removeEntity(_0xe7e9cf,null))['catch'](handleError(_0xe7e9cf,null));};exports[_0x9d38('0x40')]=function(_0x2c575c,_0x27d11d){return db[_0x9d38('0x21')]['describe']()['then'](respondWithResult(_0x27d11d,null))['catch'](handleError(_0x27d11d,null));}; \ No newline at end of file +var _0x9537=['util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','apply','reject','save','update','end','name','send','index','model','keys','query','dateEnd','dateStart','filters','fields','attributes','hasOwnProperty','nolimit','limit','sort','where','add','day','merge','filter','options','then','includeAll','include','SmsQueueReport','findAll','catch','params','rawAttributes','intersection','find','create','body','destroy','describe','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x27656c,_0x66f769){var _0x28aa2f=function(_0x5e1768){while(--_0x5e1768){_0x27656c['push'](_0x27656c['shift']());}};_0x28aa2f(++_0x66f769);}(_0x9537,0xbe));var _0x7953=function(_0x4f4a4c,_0x1b44dd){_0x4f4a4c=_0x4f4a4c-0x0;var _0xd2eb35=_0x9537[_0x4f4a4c];return _0xd2eb35;};'use strict';var jsonpatch=require(_0x7953('0x0'));var rp=require(_0x7953('0x1'));var moment=require(_0x7953('0x2'));var BPromise=require(_0x7953('0x3'));var Mustache=require(_0x7953('0x4'));var util=require(_0x7953('0x5'));var path=require('path');var sox=require(_0x7953('0x6'));var csv=require(_0x7953('0x7'));var ejs=require(_0x7953('0x8'));var fs=require('fs');var _=require(_0x7953('0x9'));var squel=require(_0x7953('0xa'));var crypto=require(_0x7953('0xb'));var jsforce=require(_0x7953('0xc'));var deskjs=require(_0x7953('0xd'));var toCsv=require(_0x7953('0x7'));var querystring=require(_0x7953('0xe'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7953('0xf'));var utils=require(_0x7953('0x10'));var config=require(_0x7953('0x11'));var db=require(_0x7953('0x12'))['db'];function respondWithStatusCode(_0x493431,_0x2673d0){_0x2673d0=_0x2673d0||0xcc;return function(_0x7945ad){if(_0x7945ad){return _0x493431[_0x7953('0x13')](_0x2673d0);}return _0x493431['status'](_0x2673d0)['end']();};}function respondWithResult(_0x5c3f9d,_0x379794){_0x379794=_0x379794||0xc8;return function(_0x185961){if(_0x185961){return _0x5c3f9d[_0x7953('0x14')](_0x379794)[_0x7953('0x15')](_0x185961);}};}function respondWithFilteredResult(_0x1f2d12,_0x5dddc8){return function(_0x5719d6){if(_0x5719d6){var _0x29e43e=_0x5719d6[_0x7953('0x16')],_0x33470f=_0x5dddc8[_0x7953('0x17')],_0x328791=_0x5dddc8[_0x7953('0x17')]+_0x5dddc8['limit'],_0x2a516e;if(_0x328791>=_0x29e43e){_0x328791=_0x29e43e;_0x2a516e=0xc8;}else{_0x2a516e=0xce;}_0x1f2d12[_0x7953('0x14')](_0x2a516e);return _0x1f2d12[_0x7953('0x18')]('Content-Range',_0x33470f+'-'+_0x328791+'/'+_0x29e43e)[_0x7953('0x15')](_0x5719d6);}return null;};}function patchUpdates(_0x410f10){return function(_0x4211f8){try{jsonpatch[_0x7953('0x19')](_0x4211f8,_0x410f10,!![]);}catch(_0x370af3){return BPromise[_0x7953('0x1a')](_0x370af3);}return _0x4211f8[_0x7953('0x1b')]();};}function saveUpdates(_0x1f47bd,_0xfa7be7){return function(_0x245d6a){if(_0x245d6a){return _0x245d6a[_0x7953('0x1c')](_0x1f47bd)['then'](function(_0x5dc2a1){return _0x5dc2a1;});}return null;};}function removeEntity(_0x4cec91,_0x3b4155){return function(_0x35d422){if(_0x35d422){return _0x35d422['destroy']()['then'](function(){_0x4cec91['status'](0xcc)[_0x7953('0x1d')]();});}};}function handleEntityNotFound(_0x16348a,_0x38da58){return function(_0x15e4d9){if(!_0x15e4d9){_0x16348a['sendStatus'](0x194);}return _0x15e4d9;};}function handleError(_0x5369c4,_0x554b4c){_0x554b4c=_0x554b4c||0x1f4;return function(_0x513c8a){logger['error'](_0x513c8a['stack']);if(_0x513c8a[_0x7953('0x1e')]){delete _0x513c8a[_0x7953('0x1e')];}_0x5369c4[_0x7953('0x14')](_0x554b4c)[_0x7953('0x1f')](_0x513c8a);};}exports[_0x7953('0x20')]=function(_0x27025b,_0x175b10){var _0x34f743={},_0x37a54d={},_0x2c31a1={'count':0x0,'rows':[]};var _0x2d9d69=db['SmsQueueReport']['rawAttributes'];_0x37a54d[_0x7953('0x21')]=_[_0x7953('0x22')](_0x2d9d69);var _0xc01363={'dateStart':_0x27025b[_0x7953('0x23')]['dateStart'],'dateEnd':_0x27025b[_0x7953('0x23')][_0x7953('0x24')]};delete _0x27025b[_0x7953('0x23')][_0x7953('0x25')];delete _0x27025b[_0x7953('0x23')][_0x7953('0x24')];_0x37a54d['query']=_[_0x7953('0x22')](_0x27025b[_0x7953('0x23')]);_0x37a54d[_0x7953('0x26')]=_['intersection'](_0x37a54d[_0x7953('0x21')],_0x37a54d[_0x7953('0x23')]);_0x34f743['attributes']=_['intersection'](_0x37a54d[_0x7953('0x21')],qs['fields'](_0x27025b['query'][_0x7953('0x27')]));_0x34f743[_0x7953('0x28')]=_0x34f743['attributes']['length']?_0x34f743[_0x7953('0x28')]:_0x37a54d[_0x7953('0x21')];if(!_0x27025b['query'][_0x7953('0x29')](_0x7953('0x2a'))){_0x34f743[_0x7953('0x2b')]=qs[_0x7953('0x2b')](_0x27025b[_0x7953('0x23')][_0x7953('0x2b')]);_0x34f743[_0x7953('0x17')]=qs[_0x7953('0x17')](_0x27025b['query']['offset']);}_0x34f743['order']=qs['sort'](_0x27025b[_0x7953('0x23')][_0x7953('0x2c')]);_0x34f743[_0x7953('0x2d')]=qs['filters'](_['pick'](_0x27025b[_0x7953('0x23')],_0x37a54d[_0x7953('0x26')]));if(_0xc01363['dateStart']){if(_0xc01363[_0x7953('0x24')]){_0xc01363[_0x7953('0x24')]=moment(_0xc01363[_0x7953('0x24')])[_0x7953('0x2e')](0x1,_0x7953('0x2f'));}else{_0xc01363['dateEnd']=moment(_0xc01363['dateStart'])['add'](0x1,_0x7953('0x2f'));}_[_0x7953('0x30')](_0x34f743['where'],{'createdAt':{'$gte':_0xc01363[_0x7953('0x25')],'$lte':_0xc01363['dateEnd']}});}if(_0x27025b[_0x7953('0x23')][_0x7953('0x31')]){_0x34f743[_0x7953('0x2d')]=_[_0x7953('0x30')](_0x34f743[_0x7953('0x2d')],{'$or':_['map'](_0x34f743[_0x7953('0x28')],function(_0x571fa3){var _0x316bb1={};_0x316bb1[_0x571fa3]={'$like':'%'+_0x27025b[_0x7953('0x23')]['filter']+'%'};return _0x316bb1;})});}_0x34f743=_['merge']({},_0x34f743,_0x27025b[_0x7953('0x32')]);var _0x4ad9de={'where':_0x34f743['where']};return db['SmsQueueReport'][_0x7953('0x16')](_0x4ad9de)[_0x7953('0x33')](function(_0x311a84){_0x2c31a1[_0x7953('0x16')]=_0x311a84;if(_0x27025b[_0x7953('0x23')][_0x7953('0x34')]){_0x34f743[_0x7953('0x35')]=[{'all':!![]}];}return db[_0x7953('0x36')][_0x7953('0x37')](_0x34f743);})[_0x7953('0x33')](function(_0xece185){_0x2c31a1['rows']=_0xece185;return _0x2c31a1;})[_0x7953('0x33')](respondWithFilteredResult(_0x175b10,_0x34f743))[_0x7953('0x38')](handleError(_0x175b10,null));};exports['show']=function(_0x38bf63,_0x43cfa2){var _0x25173e={'raw':!![],'where':{'id':_0x38bf63[_0x7953('0x39')]['id']}},_0x4efd59={};_0x4efd59[_0x7953('0x21')]=_[_0x7953('0x22')](db['SmsQueueReport'][_0x7953('0x3a')]);_0x4efd59['query']=_[_0x7953('0x22')](_0x38bf63[_0x7953('0x23')]);_0x4efd59[_0x7953('0x26')]=_['intersection'](_0x4efd59['model'],_0x4efd59[_0x7953('0x23')]);_0x25173e[_0x7953('0x28')]=_[_0x7953('0x3b')](_0x4efd59['model'],qs[_0x7953('0x27')](_0x38bf63['query'][_0x7953('0x27')]));_0x25173e[_0x7953('0x28')]=_0x25173e[_0x7953('0x28')]['length']?_0x25173e['attributes']:_0x4efd59['model'];if(_0x38bf63['query'][_0x7953('0x34')]){_0x25173e[_0x7953('0x35')]=[{'all':!![]}];}_0x25173e=_['merge']({},_0x25173e,_0x38bf63[_0x7953('0x32')]);return db[_0x7953('0x36')][_0x7953('0x3c')](_0x25173e)[_0x7953('0x33')](handleEntityNotFound(_0x43cfa2,null))[_0x7953('0x33')](respondWithResult(_0x43cfa2,null))[_0x7953('0x38')](handleError(_0x43cfa2,null));};exports[_0x7953('0x3d')]=function(_0x5de034,_0x4c9851){return db[_0x7953('0x36')][_0x7953('0x3d')](_0x5de034['body'],{})[_0x7953('0x33')](respondWithResult(_0x4c9851,0xc9))[_0x7953('0x38')](handleError(_0x4c9851,null));};exports[_0x7953('0x1c')]=function(_0x4fb704,_0x163f8){if(_0x4fb704[_0x7953('0x3e')]['id']){delete _0x4fb704['body']['id'];}return db[_0x7953('0x36')]['find']({'where':{'id':_0x4fb704['params']['id']}})[_0x7953('0x33')](handleEntityNotFound(_0x163f8,null))['then'](saveUpdates(_0x4fb704[_0x7953('0x3e')],null))[_0x7953('0x33')](respondWithResult(_0x163f8,null))[_0x7953('0x38')](handleError(_0x163f8,null));};exports[_0x7953('0x3f')]=function(_0x1f7ffd,_0x189352){return db['SmsQueueReport'][_0x7953('0x3c')]({'where':{'id':_0x1f7ffd['params']['id']}})[_0x7953('0x33')](handleEntityNotFound(_0x189352,null))[_0x7953('0x33')](removeEntity(_0x189352,null))[_0x7953('0x38')](handleError(_0x189352,null));};exports[_0x7953('0x40')]=function(_0x356df,_0x156157){return db[_0x7953('0x36')][_0x7953('0x40')]()[_0x7953('0x33')](respondWithResult(_0x156157,null))['catch'](handleError(_0x156157,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index f911693..e43fa1f 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 _0xd72f=['util','api','bluebird','request-promise','exports','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x369513,_0x1b775a){var _0xab551f=function(_0x591275){while(--_0x591275){_0x369513['push'](_0x369513['shift']());}};_0xab551f(++_0x1b775a);}(_0xd72f,0x1d0));var _0xfd72=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xd72f[_0x37c22c];return _0x119d79;};'use strict';var _=require('lodash');var util=require(_0xfd72('0x0'));var logger=require('../../config/logger')(_0xfd72('0x1'));var moment=require('moment');var BPromise=require(_0xfd72('0x2'));var rp=require(_0xfd72('0x3'));var attributes=require('./smsQueueReport.attributes');module[_0xfd72('0x4')]=function(_0x35f672,_0x5e2ff7){return _0x35f672['define'](_0xfd72('0x5'),attributes,{'tableName':_0xfd72('0x6'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xfd72('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8f45=['api','request-promise','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x8f45,0x13e));var _0x58f4=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x8f45[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x58f4('0x0'));var util=require(_0x58f4('0x1'));var logger=require('../../config/logger')(_0x58f4('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58f4('0x3'));var attributes=require(_0x58f4('0x4'));module[_0x58f4('0x5')]=function(_0x546b1a,_0x3146ba){return _0x546b1a[_0x58f4('0x6')](_0x58f4('0x7'),attributes,{'tableName':_0x58f4('0x8'),'paranoid':![],'indexes':[{'name':_0x58f4('0x9'),'fields':[_0x58f4('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 88c2e22..462049f 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 _0x34b7=['create','body','options','raw','then','UpdateSmsQueueReport','update','where','attributes','limit','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x34b7,0x196));var _0x734b=function(_0x19fc2f,_0x2509a1){_0x19fc2f=_0x19fc2f-0x0;var _0x24a68f=_0x34b7[_0x19fc2f];return _0x24a68f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var db=require(_0x734b('0x3'))['db'];var utils=require(_0x734b('0x4'));var logger=require(_0x734b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x734b('0x6'));var client=jayson[_0x734b('0x7')][_0x734b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34fd70,_0x28918a,_0x35d685){return new BPromise(function(_0x58e2f1,_0x1eb803){return client[_0x734b('0x9')](_0x34fd70,_0x35d685)['then'](function(_0x53f163){logger['info'](_0x734b('0xa'),_0x28918a,'request\x20sent');logger[_0x734b('0xb')](_0x734b('0xc'),_0x28918a,_0x734b('0xd'),JSON[_0x734b('0xe')](_0x53f163));if(_0x53f163[_0x734b('0xf')]){if(_0x53f163[_0x734b('0xf')][_0x734b('0x10')]===0x1f4){logger[_0x734b('0xf')](_0x734b('0xa'),_0x28918a,_0x53f163[_0x734b('0xf')][_0x734b('0x11')]);return _0x1eb803(_0x53f163[_0x734b('0xf')][_0x734b('0x11')]);}logger[_0x734b('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x28918a,_0x53f163[_0x734b('0xf')][_0x734b('0x11')]);return _0x58e2f1(_0x53f163[_0x734b('0xf')][_0x734b('0x11')]);}else{logger[_0x734b('0x12')](_0x734b('0xa'),_0x28918a,_0x734b('0xd'));_0x58e2f1(_0x53f163[_0x734b('0x13')][_0x734b('0x11')]);}})[_0x734b('0x14')](function(_0x42407a){logger['error'](_0x734b('0xa'),_0x28918a,_0x42407a);_0x1eb803(_0x42407a);});});}exports[_0x734b('0x15')]=function(_0xfb661a){var _0x5edbe9=this;return new Promise(function(_0x4d3b9c,_0x56a95c){return db[_0x734b('0x16')][_0x734b('0x17')](_0xfb661a[_0x734b('0x18')],{'raw':_0xfb661a[_0x734b('0x19')]?_0xfb661a[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![]})[_0x734b('0x1b')](function(_0x6572ee){logger[_0x734b('0x12')](_0x734b('0x15'),_0xfb661a);logger[_0x734b('0xb')](_0x734b('0x15'),_0xfb661a,JSON[_0x734b('0xe')](_0x6572ee));_0x4d3b9c(_0x6572ee);})[_0x734b('0x14')](function(_0x56f807){logger[_0x734b('0xf')](_0x734b('0x15'),_0x56f807['message'],_0xfb661a);_0x56a95c(_0x5edbe9[_0x734b('0xf')](0x1f4,_0x56f807[_0x734b('0x11')]));});});};exports[_0x734b('0x1c')]=function(_0x11fb8e){var _0x46d432=this;return new Promise(function(_0x26d118,_0x26eccf){return db[_0x734b('0x16')][_0x734b('0x1d')](_0x11fb8e[_0x734b('0x18')],{'raw':_0x11fb8e[_0x734b('0x19')]?_0x11fb8e[_0x734b('0x19')][_0x734b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11fb8e['options']?_0x11fb8e['options'][_0x734b('0x1e')]||null:null,'attributes':_0x11fb8e[_0x734b('0x19')]?_0x11fb8e['options'][_0x734b('0x1f')]||null:null,'limit':_0x11fb8e[_0x734b('0x19')]?_0x11fb8e[_0x734b('0x19')][_0x734b('0x20')]||null:null})[_0x734b('0x1b')](function(_0x1b8295){logger[_0x734b('0x12')]('UpdateSmsQueueReport',_0x11fb8e);logger[_0x734b('0xb')](_0x734b('0x1c'),_0x11fb8e,JSON[_0x734b('0xe')](_0x1b8295));_0x26d118(_0x1b8295);})[_0x734b('0x14')](function(_0x729431){logger[_0x734b('0xf')](_0x734b('0x1c'),_0x729431[_0x734b('0x11')],_0x11fb8e);_0x26eccf(_0x46d432[_0x734b('0xf')](0x1f4,_0x729431[_0x734b('0x11')]));});});}; \ No newline at end of file +var _0xd3f5=['options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','body','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','result','catch','SmsQueueReport','create'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0xd3f5,0x147));var _0x5d3f=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xd3f5[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x5d3f('0x0'));var util=require(_0x5d3f('0x1'));var moment=require('moment');var BPromise=require(_0x5d3f('0x2'));var rs=require(_0x5d3f('0x3'));var fs=require('fs');var db=require(_0x5d3f('0x4'))['db'];var utils=require(_0x5d3f('0x5'));var logger=require(_0x5d3f('0x6'))(_0x5d3f('0x7'));var config=require(_0x5d3f('0x8'));var jayson=require(_0x5d3f('0x9'));var client=jayson['client'][_0x5d3f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b7986,_0x2e0ad6,_0x432033){return new BPromise(function(_0x5791d4,_0x1b18bb){return client['request'](_0x4b7986,_0x432033)[_0x5d3f('0xb')](function(_0x5c01b2){logger[_0x5d3f('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x2e0ad6,_0x5d3f('0xd'));logger[_0x5d3f('0xe')](_0x5d3f('0xf'),_0x2e0ad6,_0x5d3f('0xd'),JSON[_0x5d3f('0x10')](_0x5c01b2));if(_0x5c01b2[_0x5d3f('0x11')]){if(_0x5c01b2[_0x5d3f('0x11')][_0x5d3f('0x12')]===0x1f4){logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x5c01b2[_0x5d3f('0x11')]['message']);return _0x1b18bb(_0x5c01b2[_0x5d3f('0x11')][_0x5d3f('0x14')]);}logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x5c01b2['error'][_0x5d3f('0x14')]);return _0x5791d4(_0x5c01b2[_0x5d3f('0x11')]['message']);}else{logger[_0x5d3f('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x2e0ad6,_0x5d3f('0xd'));_0x5791d4(_0x5c01b2[_0x5d3f('0x15')][_0x5d3f('0x14')]);}})[_0x5d3f('0x16')](function(_0x3ac7d5){logger[_0x5d3f('0x11')](_0x5d3f('0x13'),_0x2e0ad6,_0x3ac7d5);_0x1b18bb(_0x3ac7d5);});});}exports['CreateSmsQueueReport']=function(_0x770aa8){var _0x4cdf5e=this;return new Promise(function(_0x4201b9,_0x31f573){return db[_0x5d3f('0x17')][_0x5d3f('0x18')](_0x770aa8['body'],{'raw':_0x770aa8[_0x5d3f('0x19')]?_0x770aa8['options'][_0x5d3f('0x1a')]===undefined?!![]:![]:!![]})[_0x5d3f('0xb')](function(_0x58127d){logger['info'](_0x5d3f('0x1b'),_0x770aa8);logger[_0x5d3f('0xe')](_0x5d3f('0x1b'),_0x770aa8,JSON[_0x5d3f('0x10')](_0x58127d));_0x4201b9(_0x58127d);})['catch'](function(_0x4b0a35){logger[_0x5d3f('0x11')](_0x5d3f('0x1b'),_0x4b0a35[_0x5d3f('0x14')],_0x770aa8);_0x31f573(_0x4cdf5e['error'](0x1f4,_0x4b0a35[_0x5d3f('0x14')]));});});};exports[_0x5d3f('0x1c')]=function(_0x59620d){var _0x345514=this;return new Promise(function(_0x56ea48,_0x14a8f0){return db['SmsQueueReport'][_0x5d3f('0x1d')](_0x59620d[_0x5d3f('0x1e')],{'raw':_0x59620d[_0x5d3f('0x19')]?_0x59620d[_0x5d3f('0x19')][_0x5d3f('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59620d[_0x5d3f('0x19')]?_0x59620d['options'][_0x5d3f('0x1f')]||null:null,'attributes':_0x59620d[_0x5d3f('0x19')]?_0x59620d[_0x5d3f('0x19')]['attributes']||null:null,'limit':_0x59620d[_0x5d3f('0x19')]?_0x59620d['options']['limit']||null:null})['then'](function(_0x2f2c74){logger[_0x5d3f('0xc')](_0x5d3f('0x1c'),_0x59620d);logger['debug'](_0x5d3f('0x1c'),_0x59620d,JSON[_0x5d3f('0x10')](_0x2f2c74));_0x56ea48(_0x2f2c74);})[_0x5d3f('0x16')](function(_0x41a1f0){logger['error']('UpdateSmsQueueReport',_0x41a1f0[_0x5d3f('0x14')],_0x59620d);_0x14a8f0(_0x345514[_0x5d3f('0x11')](0x1f4,_0x41a1f0['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d94829a..a699cb7 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 _0x976a=['get','isAuthenticated','describe','/:id','show','post','create','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x976a,0xf4));var _0xa976=function(_0x30c57f,_0x4e26ca){_0x30c57f=_0x30c57f-0x0;var _0x570756=_0x976a[_0x30c57f];return _0x570756;};'use strict';var multer=require(_0xa976('0x0'));var util=require(_0xa976('0x1'));var path=require(_0xa976('0x2'));var express=require('express');var router=express[_0xa976('0x3')]();var auth=require(_0xa976('0x4'));var interaction=require(_0xa976('0x5'));var config=require(_0xa976('0x6'));var controller=require(_0xa976('0x7'));router[_0xa976('0x8')]('/',auth[_0xa976('0x9')](),controller['index']);router['get']('/describe',auth[_0xa976('0x9')](),controller[_0xa976('0xa')]);router[_0xa976('0x8')](_0xa976('0xb'),auth[_0xa976('0x9')](),controller[_0xa976('0xc')]);router[_0xa976('0xd')]('/',auth[_0xa976('0x9')](),controller[_0xa976('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa976('0xf')]);router[_0xa976('0x10')](_0xa976('0xb'),auth[_0xa976('0x9')](),controller['destroy']);module[_0xa976('0x11')]=router; \ No newline at end of file +var _0x26c2=['../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','delete','destroy','exports','express','Router'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0x26c2,0x130));var _0x226c=function(_0x3a1fb5,_0x34d9d9){_0x3a1fb5=_0x3a1fb5-0x0;var _0x2f647b=_0x26c2[_0x3a1fb5];return _0x2f647b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x226c('0x0'));var router=express[_0x226c('0x1')]();var auth=require(_0x226c('0x2'));var interaction=require(_0x226c('0x3'));var config=require('../../config/environment');var controller=require(_0x226c('0x4'));router[_0x226c('0x5')]('/',auth['isAuthenticated'](),controller[_0x226c('0x6')]);router[_0x226c('0x5')](_0x226c('0x7'),auth[_0x226c('0x8')](),controller[_0x226c('0x9')]);router['get'](_0x226c('0xa'),auth[_0x226c('0x8')](),controller[_0x226c('0xb')]);router[_0x226c('0xc')]('/',auth[_0x226c('0x8')](),controller['create']);router[_0x226c('0xd')](_0x226c('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x226c('0xe')](_0x226c('0xa'),auth[_0x226c('0x8')](),controller[_0x226c('0xf')]);module[_0x226c('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 3176291..8affa82 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 _0xdfda=['ENUM','agent','queue','moment','sequelize','exports','STRING'];(function(_0xe9598c,_0x5649ac){var _0x2838da=function(_0x27fda5){while(--_0x27fda5){_0xe9598c['push'](_0xe9598c['shift']());}};_0x2838da(++_0x5649ac);}(_0xdfda,0x137));var _0xadfd=function(_0x436caa,_0x531393){_0x436caa=_0x436caa-0x0;var _0x47ab53=_0xdfda[_0x436caa];return _0x47ab53;};'use strict';var moment=require(_0xadfd('0x0'));var Sequelize=require(_0xadfd('0x1'));module[_0xadfd('0x2')]={'uniqueid':{'type':Sequelize[_0xadfd('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xadfd('0x4')]('account',_0xadfd('0x5'),_0xadfd('0x6')),'allowNull':![],'defaultValue':_0xadfd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xb40c=['DATE','NOW','sequelize','ENUM','account','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb40c,0x68));var _0xcb40=function(_0x1fd566,_0x140fd1){_0x1fd566=_0x1fd566-0x0;var _0x24697b=_0xb40c[_0x1fd566];return _0x24697b;};'use strict';var moment=require('moment');var Sequelize=require(_0xcb40('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xcb40('0x1')](_0xcb40('0x2'),'agent',_0xcb40('0x3')),'allowNull':![],'defaultValue':_0xcb40('0x3')},'transferredAt':{'type':Sequelize[_0xcb40('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xcb40('0x5')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c4350ff..a194692 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 _0x50d2=['show','params','length','create','body','find','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','model','keys','dateStart','query','dateEnd','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','day','merge','filter','map','options','includeAll','include','findAll','rows','catch'];(function(_0x2e7dd0,_0x2e0016){var _0x5699e4=function(_0x13c379){while(--_0x13c379){_0x2e7dd0['push'](_0x2e7dd0['shift']());}};_0x5699e4(++_0x2e0016);}(_0x50d2,0x165));var _0x250d=function(_0x45242a,_0xaad760){_0x45242a=_0x45242a-0x0;var _0x225aaa=_0x50d2[_0x45242a];return _0x225aaa;};'use strict';var jsonpatch=require(_0x250d('0x0'));var rp=require(_0x250d('0x1'));var moment=require(_0x250d('0x2'));var BPromise=require(_0x250d('0x3'));var Mustache=require(_0x250d('0x4'));var util=require(_0x250d('0x5'));var path=require(_0x250d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x250d('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x250d('0x8'));var crypto=require(_0x250d('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x250d('0xa'));var Papa=require(_0x250d('0xb'));var qs=require(_0x250d('0xc'));var logger=require(_0x250d('0xd'))(_0x250d('0xe'));var utils=require('../../config/utils');var config=require(_0x250d('0xf'));var db=require(_0x250d('0x10'))['db'];function respondWithStatusCode(_0x220b2c,_0x38ecc4){_0x38ecc4=_0x38ecc4||0xcc;return function(_0x1b93c2){if(_0x1b93c2){return _0x220b2c[_0x250d('0x11')](_0x38ecc4);}return _0x220b2c[_0x250d('0x12')](_0x38ecc4)[_0x250d('0x13')]();};}function respondWithResult(_0x3fc11b,_0x1d7fb9){_0x1d7fb9=_0x1d7fb9||0xc8;return function(_0x462750){if(_0x462750){return _0x3fc11b[_0x250d('0x12')](_0x1d7fb9)[_0x250d('0x14')](_0x462750);}};}function respondWithFilteredResult(_0x8d42c4,_0x27065d){return function(_0x1f566a){if(_0x1f566a){var _0x11084b=_0x1f566a[_0x250d('0x15')],_0x442de4=_0x27065d[_0x250d('0x16')],_0x5b5310=_0x27065d['offset']+_0x27065d[_0x250d('0x17')],_0x456bdf;if(_0x5b5310>=_0x11084b){_0x5b5310=_0x11084b;_0x456bdf=0xc8;}else{_0x456bdf=0xce;}_0x8d42c4[_0x250d('0x12')](_0x456bdf);return _0x8d42c4[_0x250d('0x18')](_0x250d('0x19'),_0x442de4+'-'+_0x5b5310+'/'+_0x11084b)[_0x250d('0x14')](_0x1f566a);}return null;};}function patchUpdates(_0x1dfec8){return function(_0xfe5f9f){try{jsonpatch[_0x250d('0x1a')](_0xfe5f9f,_0x1dfec8,!![]);}catch(_0x7254c6){return BPromise[_0x250d('0x1b')](_0x7254c6);}return _0xfe5f9f[_0x250d('0x1c')]();};}function saveUpdates(_0x24de06,_0x1da45b){return function(_0x265d92){if(_0x265d92){return _0x265d92[_0x250d('0x1d')](_0x24de06)[_0x250d('0x1e')](function(_0x3ba0b5){return _0x3ba0b5;});}return null;};}function removeEntity(_0x451b2a,_0x4e71e2){return function(_0x3a43b7){if(_0x3a43b7){return _0x3a43b7[_0x250d('0x1f')]()[_0x250d('0x1e')](function(){_0x451b2a[_0x250d('0x12')](0xcc)[_0x250d('0x13')]();});}};}function handleEntityNotFound(_0x5def0e,_0x38da6c){return function(_0x16333e){if(!_0x16333e){_0x5def0e[_0x250d('0x11')](0x194);}return _0x16333e;};}function handleError(_0x1b2243,_0xca907e){_0xca907e=_0xca907e||0x1f4;return function(_0xe907bf){logger[_0x250d('0x20')](_0xe907bf[_0x250d('0x21')]);if(_0xe907bf['name']){delete _0xe907bf[_0x250d('0x22')];}_0x1b2243[_0x250d('0x12')](_0xca907e)[_0x250d('0x23')](_0xe907bf);};}exports[_0x250d('0x24')]=function(_0x783505,_0xd22fc2){var _0x180714={},_0x597f9f={},_0x58972d={'count':0x0,'rows':[]};var _0x5afd1b=db[_0x250d('0x25')][_0x250d('0x26')];_0x597f9f[_0x250d('0x27')]=_[_0x250d('0x28')](_0x5afd1b);var _0x1802da={'dateStart':_0x783505['query'][_0x250d('0x29')],'dateEnd':_0x783505[_0x250d('0x2a')][_0x250d('0x2b')]};delete _0x783505[_0x250d('0x2a')][_0x250d('0x29')];delete _0x783505['query'][_0x250d('0x2b')];_0x597f9f[_0x250d('0x2a')]=_['keys'](_0x783505['query']);_0x597f9f['filters']=_[_0x250d('0x2c')](_0x597f9f[_0x250d('0x27')],_0x597f9f[_0x250d('0x2a')]);_0x180714['attributes']=_[_0x250d('0x2c')](_0x597f9f[_0x250d('0x27')],qs[_0x250d('0x2d')](_0x783505['query']['fields']));_0x180714[_0x250d('0x2e')]=_0x180714[_0x250d('0x2e')]['length']?_0x180714[_0x250d('0x2e')]:_0x597f9f[_0x250d('0x27')];if(!_0x783505[_0x250d('0x2a')][_0x250d('0x2f')](_0x250d('0x30'))){_0x180714[_0x250d('0x17')]=qs[_0x250d('0x17')](_0x783505[_0x250d('0x2a')][_0x250d('0x17')]);_0x180714[_0x250d('0x16')]=qs[_0x250d('0x16')](_0x783505[_0x250d('0x2a')][_0x250d('0x16')]);}_0x180714['order']=qs[_0x250d('0x31')](_0x783505[_0x250d('0x2a')][_0x250d('0x31')]);_0x180714[_0x250d('0x32')]=qs[_0x250d('0x33')](_[_0x250d('0x34')](_0x783505['query'],_0x597f9f[_0x250d('0x33')]));if(_0x1802da['dateStart']){if(_0x1802da['dateEnd']){_0x1802da[_0x250d('0x2b')]=moment(_0x1802da[_0x250d('0x2b')])['add'](0x1,_0x250d('0x35'));}else{_0x1802da['dateEnd']=moment(_0x1802da[_0x250d('0x29')])['add'](0x1,_0x250d('0x35'));}_[_0x250d('0x36')](_0x180714[_0x250d('0x32')],{'createdAt':{'$gte':_0x1802da[_0x250d('0x29')],'$lte':_0x1802da['dateEnd']}});}if(_0x783505[_0x250d('0x2a')][_0x250d('0x37')]){_0x180714[_0x250d('0x32')]=_[_0x250d('0x36')](_0x180714[_0x250d('0x32')],{'$or':_[_0x250d('0x38')](_0x180714['attributes'],function(_0xa45b30){var _0x2f9382={};_0x2f9382[_0xa45b30]={'$like':'%'+_0x783505[_0x250d('0x2a')][_0x250d('0x37')]+'%'};return _0x2f9382;})});}_0x180714=_[_0x250d('0x36')]({},_0x180714,_0x783505[_0x250d('0x39')]);var _0x3bc8ba={'where':_0x180714[_0x250d('0x32')]};return db[_0x250d('0x25')]['count'](_0x3bc8ba)[_0x250d('0x1e')](function(_0x9c5ad7){_0x58972d[_0x250d('0x15')]=_0x9c5ad7;if(_0x783505[_0x250d('0x2a')][_0x250d('0x3a')]){_0x180714[_0x250d('0x3b')]=[{'all':!![]}];}return db[_0x250d('0x25')][_0x250d('0x3c')](_0x180714);})['then'](function(_0x2cf1eb){_0x58972d[_0x250d('0x3d')]=_0x2cf1eb;return _0x58972d;})[_0x250d('0x1e')](respondWithFilteredResult(_0xd22fc2,_0x180714))[_0x250d('0x3e')](handleError(_0xd22fc2,null));};exports[_0x250d('0x3f')]=function(_0x3b8dc3,_0x489e16){var _0x336501={'raw':!![],'where':{'id':_0x3b8dc3[_0x250d('0x40')]['id']}},_0x5cf568={};_0x5cf568['model']=_[_0x250d('0x28')](db[_0x250d('0x25')][_0x250d('0x26')]);_0x5cf568['query']=_[_0x250d('0x28')](_0x3b8dc3[_0x250d('0x2a')]);_0x5cf568[_0x250d('0x33')]=_[_0x250d('0x2c')](_0x5cf568[_0x250d('0x27')],_0x5cf568[_0x250d('0x2a')]);_0x336501[_0x250d('0x2e')]=_['intersection'](_0x5cf568[_0x250d('0x27')],qs[_0x250d('0x2d')](_0x3b8dc3['query']['fields']));_0x336501[_0x250d('0x2e')]=_0x336501[_0x250d('0x2e')][_0x250d('0x41')]?_0x336501['attributes']:_0x5cf568[_0x250d('0x27')];if(_0x3b8dc3['query'][_0x250d('0x3a')]){_0x336501[_0x250d('0x3b')]=[{'all':!![]}];}_0x336501=_[_0x250d('0x36')]({},_0x336501,_0x3b8dc3[_0x250d('0x39')]);return db[_0x250d('0x25')]['find'](_0x336501)[_0x250d('0x1e')](handleEntityNotFound(_0x489e16,null))[_0x250d('0x1e')](respondWithResult(_0x489e16,null))[_0x250d('0x3e')](handleError(_0x489e16,null));};exports[_0x250d('0x42')]=function(_0x5db795,_0x52d64f){return db[_0x250d('0x25')][_0x250d('0x42')](_0x5db795[_0x250d('0x43')],{})[_0x250d('0x1e')](respondWithResult(_0x52d64f,0xc9))[_0x250d('0x3e')](handleError(_0x52d64f,null));};exports['update']=function(_0x185908,_0x102417){if(_0x185908[_0x250d('0x43')]['id']){delete _0x185908[_0x250d('0x43')]['id'];}return db[_0x250d('0x25')][_0x250d('0x44')]({'where':{'id':_0x185908[_0x250d('0x40')]['id']}})[_0x250d('0x1e')](handleEntityNotFound(_0x102417,null))[_0x250d('0x1e')](saveUpdates(_0x185908[_0x250d('0x43')],null))[_0x250d('0x1e')](respondWithResult(_0x102417,null))[_0x250d('0x3e')](handleError(_0x102417,null));};exports[_0x250d('0x1f')]=function(_0x4fc2f2,_0x1bd9a8){return db[_0x250d('0x25')]['find']({'where':{'id':_0x4fc2f2['params']['id']}})[_0x250d('0x1e')](handleEntityNotFound(_0x1bd9a8,null))[_0x250d('0x1e')](removeEntity(_0x1bd9a8,null))[_0x250d('0x3e')](handleError(_0x1bd9a8,null));};exports[_0x250d('0x45')]=function(_0x8d1c69,_0x22bae8){return db['SmsTransferReport'][_0x250d('0x45')]()[_0x250d('0x1e')](respondWithResult(_0x22bae8,null))[_0x250d('0x3e')](handleError(_0x22bae8,null));}; \ No newline at end of file +var _0x2a18=['hasOwnProperty','nolimit','order','sort','filters','pick','add','day','merge','where','filter','map','includeAll','include','rows','catch','show','options','find','create','body','params','describe','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','SmsTransferReport','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length'];(function(_0x153857,_0x1fa7e5){var _0x2ee31=function(_0x432d58){while(--_0x432d58){_0x153857['push'](_0x153857['shift']());}};_0x2ee31(++_0x1fa7e5);}(_0x2a18,0x166));var _0x82a1=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x2a18[_0x269094];return _0x10344f;};'use strict';var jsonpatch=require(_0x82a1('0x0'));var rp=require(_0x82a1('0x1'));var moment=require(_0x82a1('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x82a1('0x3'));var util=require(_0x82a1('0x4'));var path=require('path');var sox=require(_0x82a1('0x5'));var csv=require(_0x82a1('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x82a1('0x7'));var squel=require(_0x82a1('0x8'));var crypto=require('crypto');var jsforce=require(_0x82a1('0x9'));var deskjs=require(_0x82a1('0xa'));var toCsv=require('to-csv');var querystring=require(_0x82a1('0xb'));var Papa=require(_0x82a1('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0x82a1('0xd'))('api');var utils=require(_0x82a1('0xe'));var config=require(_0x82a1('0xf'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31e95f,_0x291fd7){_0x291fd7=_0x291fd7||0xcc;return function(_0x2b897d){if(_0x2b897d){return _0x31e95f[_0x82a1('0x10')](_0x291fd7);}return _0x31e95f[_0x82a1('0x11')](_0x291fd7)[_0x82a1('0x12')]();};}function respondWithResult(_0x5078f5,_0x1be5d2){_0x1be5d2=_0x1be5d2||0xc8;return function(_0x384974){if(_0x384974){return _0x5078f5['status'](_0x1be5d2)[_0x82a1('0x13')](_0x384974);}};}function respondWithFilteredResult(_0x37b00b,_0x16671f){return function(_0x5e6d0d){if(_0x5e6d0d){var _0x4943e1=_0x5e6d0d[_0x82a1('0x14')],_0x486779=_0x16671f[_0x82a1('0x15')],_0x33cf38=_0x16671f[_0x82a1('0x15')]+_0x16671f[_0x82a1('0x16')],_0x7a2a00;if(_0x33cf38>=_0x4943e1){_0x33cf38=_0x4943e1;_0x7a2a00=0xc8;}else{_0x7a2a00=0xce;}_0x37b00b['status'](_0x7a2a00);return _0x37b00b[_0x82a1('0x17')](_0x82a1('0x18'),_0x486779+'-'+_0x33cf38+'/'+_0x4943e1)['json'](_0x5e6d0d);}return null;};}function patchUpdates(_0x45acd0){return function(_0x11c67a){try{jsonpatch[_0x82a1('0x19')](_0x11c67a,_0x45acd0,!![]);}catch(_0x419cd9){return BPromise[_0x82a1('0x1a')](_0x419cd9);}return _0x11c67a['save']();};}function saveUpdates(_0x12f80a,_0x4906cb){return function(_0x30124b){if(_0x30124b){return _0x30124b[_0x82a1('0x1b')](_0x12f80a)[_0x82a1('0x1c')](function(_0x10e3fa){return _0x10e3fa;});}return null;};}function removeEntity(_0xae685c,_0x3e4d34){return function(_0x53abdc){if(_0x53abdc){return _0x53abdc[_0x82a1('0x1d')]()[_0x82a1('0x1c')](function(){_0xae685c[_0x82a1('0x11')](0xcc)[_0x82a1('0x12')]();});}};}function handleEntityNotFound(_0x32ff50,_0x3d2257){return function(_0x49619e){if(!_0x49619e){_0x32ff50[_0x82a1('0x10')](0x194);}return _0x49619e;};}function handleError(_0x36961e,_0x33d998){_0x33d998=_0x33d998||0x1f4;return function(_0x511749){logger['error'](_0x511749[_0x82a1('0x1e')]);if(_0x511749['name']){delete _0x511749[_0x82a1('0x1f')];}_0x36961e[_0x82a1('0x11')](_0x33d998)[_0x82a1('0x20')](_0x511749);};}exports['index']=function(_0x3eaab7,_0x1f9afb){var _0x25806d={},_0x124914={},_0x11b050={'count':0x0,'rows':[]};var _0x1b3813=db[_0x82a1('0x21')][_0x82a1('0x22')];_0x124914['model']=_[_0x82a1('0x23')](_0x1b3813);var _0xd0ce4c={'dateStart':_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x25')],'dateEnd':_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x26')]};delete _0x3eaab7[_0x82a1('0x24')]['dateStart'];delete _0x3eaab7['query']['dateEnd'];_0x124914[_0x82a1('0x24')]=_[_0x82a1('0x23')](_0x3eaab7[_0x82a1('0x24')]);_0x124914['filters']=_[_0x82a1('0x27')](_0x124914[_0x82a1('0x28')],_0x124914[_0x82a1('0x24')]);_0x25806d[_0x82a1('0x29')]=_[_0x82a1('0x27')](_0x124914[_0x82a1('0x28')],qs['fields'](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x2a')]));_0x25806d[_0x82a1('0x29')]=_0x25806d[_0x82a1('0x29')][_0x82a1('0x2b')]?_0x25806d['attributes']:_0x124914[_0x82a1('0x28')];if(!_0x3eaab7['query'][_0x82a1('0x2c')](_0x82a1('0x2d'))){_0x25806d[_0x82a1('0x16')]=qs[_0x82a1('0x16')](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x16')]);_0x25806d[_0x82a1('0x15')]=qs[_0x82a1('0x15')](_0x3eaab7['query'][_0x82a1('0x15')]);}_0x25806d[_0x82a1('0x2e')]=qs['sort'](_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x2f')]);_0x25806d['where']=qs[_0x82a1('0x30')](_[_0x82a1('0x31')](_0x3eaab7[_0x82a1('0x24')],_0x124914[_0x82a1('0x30')]));if(_0xd0ce4c[_0x82a1('0x25')]){if(_0xd0ce4c[_0x82a1('0x26')]){_0xd0ce4c['dateEnd']=moment(_0xd0ce4c[_0x82a1('0x26')])[_0x82a1('0x32')](0x1,'day');}else{_0xd0ce4c[_0x82a1('0x26')]=moment(_0xd0ce4c['dateStart'])['add'](0x1,_0x82a1('0x33'));}_[_0x82a1('0x34')](_0x25806d[_0x82a1('0x35')],{'createdAt':{'$gte':_0xd0ce4c['dateStart'],'$lte':_0xd0ce4c[_0x82a1('0x26')]}});}if(_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x36')]){_0x25806d['where']=_['merge'](_0x25806d['where'],{'$or':_[_0x82a1('0x37')](_0x25806d[_0x82a1('0x29')],function(_0x872b94){var _0x36bdbf={};_0x36bdbf[_0x872b94]={'$like':'%'+_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x36')]+'%'};return _0x36bdbf;})});}_0x25806d=_[_0x82a1('0x34')]({},_0x25806d,_0x3eaab7['options']);var _0x4ffd31={'where':_0x25806d[_0x82a1('0x35')]};return db['SmsTransferReport'][_0x82a1('0x14')](_0x4ffd31)[_0x82a1('0x1c')](function(_0x57c98a){_0x11b050['count']=_0x57c98a;if(_0x3eaab7[_0x82a1('0x24')][_0x82a1('0x38')]){_0x25806d[_0x82a1('0x39')]=[{'all':!![]}];}return db[_0x82a1('0x21')]['findAll'](_0x25806d);})[_0x82a1('0x1c')](function(_0x352896){_0x11b050[_0x82a1('0x3a')]=_0x352896;return _0x11b050;})[_0x82a1('0x1c')](respondWithFilteredResult(_0x1f9afb,_0x25806d))[_0x82a1('0x3b')](handleError(_0x1f9afb,null));};exports[_0x82a1('0x3c')]=function(_0x342cea,_0xc61765){var _0xa3d1bf={'raw':!![],'where':{'id':_0x342cea['params']['id']}},_0x355ebe={};_0x355ebe[_0x82a1('0x28')]=_['keys'](db[_0x82a1('0x21')][_0x82a1('0x22')]);_0x355ebe[_0x82a1('0x24')]=_['keys'](_0x342cea['query']);_0x355ebe['filters']=_[_0x82a1('0x27')](_0x355ebe[_0x82a1('0x28')],_0x355ebe[_0x82a1('0x24')]);_0xa3d1bf['attributes']=_['intersection'](_0x355ebe[_0x82a1('0x28')],qs[_0x82a1('0x2a')](_0x342cea['query'][_0x82a1('0x2a')]));_0xa3d1bf[_0x82a1('0x29')]=_0xa3d1bf[_0x82a1('0x29')][_0x82a1('0x2b')]?_0xa3d1bf['attributes']:_0x355ebe['model'];if(_0x342cea['query'][_0x82a1('0x38')]){_0xa3d1bf[_0x82a1('0x39')]=[{'all':!![]}];}_0xa3d1bf=_['merge']({},_0xa3d1bf,_0x342cea[_0x82a1('0x3d')]);return db['SmsTransferReport'][_0x82a1('0x3e')](_0xa3d1bf)[_0x82a1('0x1c')](handleEntityNotFound(_0xc61765,null))[_0x82a1('0x1c')](respondWithResult(_0xc61765,null))[_0x82a1('0x3b')](handleError(_0xc61765,null));};exports[_0x82a1('0x3f')]=function(_0x31131a,_0x50df5a){return db[_0x82a1('0x21')][_0x82a1('0x3f')](_0x31131a[_0x82a1('0x40')],{})[_0x82a1('0x1c')](respondWithResult(_0x50df5a,0xc9))[_0x82a1('0x3b')](handleError(_0x50df5a,null));};exports['update']=function(_0x39b25c,_0x42974f){if(_0x39b25c[_0x82a1('0x40')]['id']){delete _0x39b25c['body']['id'];}return db[_0x82a1('0x21')]['find']({'where':{'id':_0x39b25c['params']['id']}})['then'](handleEntityNotFound(_0x42974f,null))[_0x82a1('0x1c')](saveUpdates(_0x39b25c['body'],null))['then'](respondWithResult(_0x42974f,null))[_0x82a1('0x3b')](handleError(_0x42974f,null));};exports['destroy']=function(_0x3d0a08,_0x28c8c4){return db[_0x82a1('0x21')][_0x82a1('0x3e')]({'where':{'id':_0x3d0a08[_0x82a1('0x41')]['id']}})[_0x82a1('0x1c')](handleEntityNotFound(_0x28c8c4,null))[_0x82a1('0x1c')](removeEntity(_0x28c8c4,null))['catch'](handleError(_0x28c8c4,null));};exports[_0x82a1('0x42')]=function(_0x425a33,_0x116445){return db[_0x82a1('0x21')][_0x82a1('0x42')]()['then'](respondWithResult(_0x116445,null))[_0x82a1('0x3b')](handleError(_0x116445,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 7ae1927..53a08bd 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 _0xb821=['../../config/logger','bluebird','exports','define','report_sms_transfer','uniqueid','util'];(function(_0xf864b9,_0x30f151){var _0x21537b=function(_0x1b01ce){while(--_0x1b01ce){_0xf864b9['push'](_0xf864b9['shift']());}};_0x21537b(++_0x30f151);}(_0xb821,0xa7));var _0x1b82=function(_0x4cc4fe,_0x733c09){_0x4cc4fe=_0x4cc4fe-0x0;var _0x37f480=_0xb821[_0x4cc4fe];return _0x37f480;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var attributes=require('./smsTransferReport.attributes');module[_0x1b82('0x3')]=function(_0x1403ab,_0x3fadf0){return _0x1403ab[_0x1b82('0x4')]('SmsTransferReport',attributes,{'tableName':_0x1b82('0x5'),'paranoid':![],'indexes':[{'name':_0x1b82('0x6'),'fields':[_0x1b82('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['exports','define','report_sms_transfer','uniqueid','util','api','moment','bluebird'];(function(_0x857aa4,_0x5608f6){var _0x313d1e=function(_0x3937d6){while(--_0x3937d6){_0x857aa4['push'](_0x857aa4['shift']());}};_0x313d1e(++_0x5608f6);}(_0x9f62,0x154));var _0x29f6=function(_0x31bb2c,_0x58a715){_0x31bb2c=_0x31bb2c-0x0;var _0x22afa0=_0x9f62[_0x31bb2c];return _0x22afa0;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var attributes=require('./smsTransferReport.attributes');module[_0x29f6('0x4')]=function(_0x2f0420,_0xefa26c){return _0x2f0420[_0x29f6('0x5')]('SmsTransferReport',attributes,{'tableName':_0x29f6('0x6'),'paranoid':![],'indexes':[{'name':_0x29f6('0x7'),'fields':[_0x29f6('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3b7bb41..f417659 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 _0x2f0e=['error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4888cc,_0x41cd3d){var _0x31866f=function(_0x37c409){while(--_0x37c409){_0x4888cc['push'](_0x4888cc['shift']());}};_0x31866f(++_0x41cd3d);}(_0x2f0e,0x1ea));var _0xe2f0=function(_0x5d4199,_0x5d877f){_0x5d4199=_0x5d4199-0x0;var _0x3a9374=_0x2f0e[_0x5d4199];return _0x3a9374;};'use strict';var _=require(_0xe2f0('0x0'));var util=require(_0xe2f0('0x1'));var moment=require(_0xe2f0('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2f0('0x3'));var fs=require('fs');var db=require(_0xe2f0('0x4'))['db'];var utils=require(_0xe2f0('0x5'));var logger=require('../../config/logger')(_0xe2f0('0x6'));var config=require('../../config/environment');var jayson=require(_0xe2f0('0x7'));var client=jayson[_0xe2f0('0x8')][_0xe2f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d4e59,_0xf241f3,_0x15e99f){return new BPromise(function(_0x334bc7,_0x21a6d8){return client['request'](_0x2d4e59,_0x15e99f)[_0xe2f0('0xa')](function(_0xd503f1){logger[_0xe2f0('0xb')](_0xe2f0('0xc'),_0xf241f3,'request\x20sent');logger[_0xe2f0('0xd')](_0xe2f0('0xe'),_0xf241f3,'request\x20sent',JSON[_0xe2f0('0xf')](_0xd503f1));if(_0xd503f1[_0xe2f0('0x10')]){if(_0xd503f1[_0xe2f0('0x10')][_0xe2f0('0x11')]===0x1f4){logger[_0xe2f0('0x10')](_0xe2f0('0xc'),_0xf241f3,_0xd503f1['error'][_0xe2f0('0x12')]);return _0x21a6d8(_0xd503f1['error'][_0xe2f0('0x12')]);}logger['error'](_0xe2f0('0xc'),_0xf241f3,_0xd503f1['error'][_0xe2f0('0x12')]);return _0x334bc7(_0xd503f1['error'][_0xe2f0('0x12')]);}else{logger[_0xe2f0('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0xf241f3,_0xe2f0('0x13'));_0x334bc7(_0xd503f1[_0xe2f0('0x14')]['message']);}})[_0xe2f0('0x15')](function(_0x27c650){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0xf241f3,_0x27c650);_0x21a6d8(_0x27c650);});});} \ No newline at end of file +var _0x759e=['lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','catch'];(function(_0x37d1f1,_0x4303bc){var _0x5dba02=function(_0xafcd3c){while(--_0xafcd3c){_0x37d1f1['push'](_0x37d1f1['shift']());}};_0x5dba02(++_0x4303bc);}(_0x759e,0x176));var _0xe759=function(_0x3f9c29,_0x50a7cd){_0x3f9c29=_0x3f9c29-0x0;var _0x575ae2=_0x759e[_0x3f9c29];return _0x575ae2;};'use strict';var _=require(_0xe759('0x0'));var util=require('util');var moment=require(_0xe759('0x1'));var BPromise=require(_0xe759('0x2'));var rs=require(_0xe759('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe759('0x4'));var logger=require(_0xe759('0x5'))(_0xe759('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe759('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42c446,_0x350463,_0x858a8c){return new BPromise(function(_0x3532b3,_0x14a578){return client['request'](_0x42c446,_0x858a8c)[_0xe759('0x8')](function(_0x6348fa){logger['info'](_0xe759('0x9'),_0x350463,'request\x20sent');logger[_0xe759('0xa')](_0xe759('0xb'),_0x350463,'request\x20sent',JSON['stringify'](_0x6348fa));if(_0x6348fa[_0xe759('0xc')]){if(_0x6348fa[_0xe759('0xc')]['code']===0x1f4){logger[_0xe759('0xc')](_0xe759('0x9'),_0x350463,_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);return _0x14a578(_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);}logger['error'](_0xe759('0x9'),_0x350463,_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);return _0x3532b3(_0x6348fa[_0xe759('0xc')][_0xe759('0xd')]);}else{logger[_0xe759('0xe')](_0xe759('0x9'),_0x350463,_0xe759('0xf'));_0x3532b3(_0x6348fa['result'][_0xe759('0xd')]);}})[_0xe759('0x10')](function(_0x3f1a14){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x350463,_0x3f1a14);_0x14a578(_0x3f1a14);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1e5333c..0df0d4b 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 _0xcdbd=['post','single','create','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','join','root','replace','format','%s-%s%s','basename','originalname'];(function(_0x890bb2,_0x27f067){var _0x30fb81=function(_0x15f5ec){while(--_0x15f5ec){_0x890bb2['push'](_0x890bb2['shift']());}};_0x30fb81(++_0x27f067);}(_0xcdbd,0x19b));var _0xdcdb=function(_0x560509,_0x3ecf89){_0x560509=_0x560509-0x0;var _0x3b006d=_0xcdbd[_0x560509];return _0x3b006d;};'use strict';var multer=require('multer');var util=require(_0xdcdb('0x0'));var path=require(_0xdcdb('0x1'));var express=require(_0xdcdb('0x2'));var router=express[_0xdcdb('0x3')]();var auth=require(_0xdcdb('0x4'));var interaction=require(_0xdcdb('0x5'));var config=require(_0xdcdb('0x6'));var controller=require('./sound.controller');router[_0xdcdb('0x7')]('/',auth[_0xdcdb('0x8')](),controller['index']);router[_0xdcdb('0x7')](_0xdcdb('0x9'),auth[_0xdcdb('0x8')](),controller[_0xdcdb('0xa')]);router['get'](_0xdcdb('0xb'),auth[_0xdcdb('0x8')](),controller[_0xdcdb('0xc')]);var upload=multer({'storage':multer[_0xdcdb('0xd')]({'destination':function(_0x467226,_0x29e279,_0x14a188){_0x14a188(null,path[_0xdcdb('0xe')](config[_0xdcdb('0xf')],'server/files/sounds/original/'));},'filename':function(_0x1d296e,_0x5c1b0d,_0x4226f7){_0x5c1b0d['originalname']=_0x5c1b0d['originalname'][_0xdcdb('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4226f7(null,util[_0xdcdb('0x11')](_0xdcdb('0x12'),path[_0xdcdb('0x13')](_0x5c1b0d[_0xdcdb('0x14')],path['extname'](_0x5c1b0d[_0xdcdb('0x14')])),Date['now'](),path['extname'](_0x5c1b0d[_0xdcdb('0x14')])));}})});router[_0xdcdb('0x15')]('/',upload[_0xdcdb('0x16')]('file'),controller[_0xdcdb('0x17')]);router['put']('/:id',auth[_0xdcdb('0x8')](),controller[_0xdcdb('0x18')]);router[_0xdcdb('0x19')](_0xdcdb('0x9'),auth[_0xdcdb('0x8')](),controller[_0xdcdb('0x19')]);module[_0xdcdb('0x1a')]=router; \ No newline at end of file +var _0xebfc=['get','isAuthenticated','index','show','/:id/download','diskStorage','join','root','originalname','replace','%s-%s%s','basename','extname','now','post','file','put','/:id','update','delete','exports','multer','util','Router','../../components/auth/service','../../config/environment','./sound.controller'];(function(_0x166aa3,_0x263bd0){var _0x15550b=function(_0x2e9484){while(--_0x2e9484){_0x166aa3['push'](_0x166aa3['shift']());}};_0x15550b(++_0x263bd0);}(_0xebfc,0x108));var _0xcebf=function(_0x5b7788,_0x309ae5){_0x5b7788=_0x5b7788-0x0;var _0x573871=_0xebfc[_0x5b7788];return _0x573871;};'use strict';var multer=require(_0xcebf('0x0'));var util=require(_0xcebf('0x1'));var path=require('path');var express=require('express');var router=express[_0xcebf('0x2')]();var auth=require(_0xcebf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcebf('0x4'));var controller=require(_0xcebf('0x5'));router[_0xcebf('0x6')]('/',auth[_0xcebf('0x7')](),controller[_0xcebf('0x8')]);router[_0xcebf('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xcebf('0x9')]);router[_0xcebf('0x6')](_0xcebf('0xa'),auth[_0xcebf('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xcebf('0xb')]({'destination':function(_0x20d01d,_0x2d6576,_0x38a6e8){_0x38a6e8(null,path[_0xcebf('0xc')](config[_0xcebf('0xd')],'server/files/sounds/original/'));},'filename':function(_0xc6f89a,_0x330256,_0x580490){_0x330256[_0xcebf('0xe')]=_0x330256[_0xcebf('0xe')][_0xcebf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x580490(null,util['format'](_0xcebf('0x10'),path[_0xcebf('0x11')](_0x330256[_0xcebf('0xe')],path[_0xcebf('0x12')](_0x330256[_0xcebf('0xe')])),Date[_0xcebf('0x13')](),path[_0xcebf('0x12')](_0x330256[_0xcebf('0xe')])));}})});router[_0xcebf('0x14')]('/',upload['single'](_0xcebf('0x15')),controller['create']);router[_0xcebf('0x16')](_0xcebf('0x17'),auth[_0xcebf('0x7')](),controller[_0xcebf('0x18')]);router[_0xcebf('0x19')](_0xcebf('0x17'),auth['isAuthenticated'](),controller[_0xcebf('0x19')]);module[_0xcebf('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 03e0512..e126049 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 _0x946e=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x3df763,_0x492e89){var _0x4ccda8=function(_0x1a69c7){while(--_0x1a69c7){_0x3df763['push'](_0x3df763['shift']());}};_0x4ccda8(++_0x492e89);}(_0x946e,0x194));var _0xe946=function(_0x1f8acd,_0x26d834){_0x1f8acd=_0x1f8acd-0x0;var _0xf563d4=_0x946e[_0x1f8acd];return _0xf563d4;};'use strict';var Sequelize=require('sequelize');module[_0xe946('0x0')]={'name':{'type':Sequelize[_0xe946('0x1')],'unique':_0xe946('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xe946('0x1')]},'display_name':{'type':Sequelize[_0xe946('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xe946('0x1')]},'original_format':{'type':Sequelize[_0xe946('0x1')]},'original_duration':{'type':Sequelize[_0xe946('0x3')]},'original_sampleCount':{'type':Sequelize[_0xe946('0x4')]},'original_channelCount':{'type':Sequelize[_0xe946('0x5')]},'original_bitRate':{'type':Sequelize[_0xe946('0x4')]},'original_sampleRate':{'type':Sequelize[_0xe946('0x5')]},'converted_format':{'type':Sequelize[_0xe946('0x1')]},'converted_duration':{'type':Sequelize[_0xe946('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xe946('0x4')]},'converted_channelCount':{'type':Sequelize[_0xe946('0x5')]},'converted_bitRate':{'type':Sequelize[_0xe946('0x4')]},'converted_sampleRate':{'type':Sequelize[_0xe946('0x5')]}}; \ No newline at end of file +var _0x8779=['FLOAT','BIGINT','INTEGER','exports','STRING','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8779,0x1ef));var _0x9877=function(_0x42a29b,_0x5af12c){_0x42a29b=_0x42a29b-0x0;var _0x2e3f4b=_0x8779[_0x42a29b];return _0x2e3f4b;};'use strict';var Sequelize=require('sequelize');module[_0x9877('0x0')]={'name':{'type':Sequelize[_0x9877('0x1')],'unique':_0x9877('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x9877('0x1')]},'display_name':{'type':Sequelize[_0x9877('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x9877('0x1')]},'original_duration':{'type':Sequelize[_0x9877('0x3')]},'original_sampleCount':{'type':Sequelize[_0x9877('0x4')]},'original_channelCount':{'type':Sequelize[_0x9877('0x5')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x9877('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x9877('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x9877('0x4')]},'converted_channelCount':{'type':Sequelize[_0x9877('0x5')]},'converted_bitRate':{'type':Sequelize[_0x9877('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x9877('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index d9dc7a3..0741c30 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 _0x0ad9=['index','keys','query','dateStart','dateEnd','attributes','model','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','Sound','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','fields','find','save_name','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','download','%s.%s','converted_format','format','basename','originalname','extname','file','substring','join','server/files/sounds/original','filename','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','create','start','body','description','original_format','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send'];(function(_0xdbaba,_0x4786e3){var _0x270884=function(_0x209fde){while(--_0x209fde){_0xdbaba['push'](_0xdbaba['shift']());}};_0x270884(++_0x4786e3);}(_0x0ad9,0x12d));var _0x90ad=function(_0x52b398,_0x309cce){_0x52b398=_0x52b398-0x0;var _0xaa7c61=_0x0ad9[_0x52b398];return _0xaa7c61;};'use strict';var jsonpatch=require(_0x90ad('0x0'));var rp=require('request-promise');var moment=require(_0x90ad('0x1'));var BPromise=require(_0x90ad('0x2'));var Mustache=require(_0x90ad('0x3'));var util=require(_0x90ad('0x4'));var path=require('path');var sox=require(_0x90ad('0x5'));var csv=require(_0x90ad('0x6'));var ejs=require(_0x90ad('0x7'));var fs=require('fs');var _=require(_0x90ad('0x8'));var squel=require(_0x90ad('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90ad('0xa'));var toCsv=require(_0x90ad('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x90ad('0xb'));var logger=require(_0x90ad('0xc'))(_0x90ad('0xd'));var utils=require(_0x90ad('0xe'));var config=require(_0x90ad('0xf'));var db=require(_0x90ad('0x10'))['db'];function respondWithStatusCode(_0x201e34,_0x1d5cec){_0x1d5cec=_0x1d5cec||0xcc;return function(_0x4ee264){if(_0x4ee264){return _0x201e34[_0x90ad('0x11')](_0x1d5cec);}return _0x201e34[_0x90ad('0x12')](_0x1d5cec)[_0x90ad('0x13')]();};}function respondWithResult(_0x5987c9,_0x29fd1e){_0x29fd1e=_0x29fd1e||0xc8;return function(_0x8fd72f){if(_0x8fd72f){return _0x5987c9[_0x90ad('0x12')](_0x29fd1e)[_0x90ad('0x14')](_0x8fd72f);}};}function respondWithFilteredResult(_0x2e8087,_0x526265){return function(_0x5406f7){if(_0x5406f7){var _0x51982e=_0x5406f7[_0x90ad('0x15')],_0x2f87b0=_0x526265[_0x90ad('0x16')],_0x218cb4=_0x526265[_0x90ad('0x16')]+_0x526265[_0x90ad('0x17')],_0x94c726;if(_0x218cb4>=_0x51982e){_0x218cb4=_0x51982e;_0x94c726=0xc8;}else{_0x94c726=0xce;}_0x2e8087[_0x90ad('0x12')](_0x94c726);return _0x2e8087['set'](_0x90ad('0x18'),_0x2f87b0+'-'+_0x218cb4+'/'+_0x51982e)[_0x90ad('0x14')](_0x5406f7);}return null;};}function patchUpdates(_0x38696a){return function(_0x4cb0b9){try{jsonpatch[_0x90ad('0x19')](_0x4cb0b9,_0x38696a,!![]);}catch(_0x3c0010){return BPromise[_0x90ad('0x1a')](_0x3c0010);}return _0x4cb0b9[_0x90ad('0x1b')]();};}function saveUpdates(_0x546e42,_0x180931){return function(_0x14ae4c){if(_0x14ae4c){return _0x14ae4c[_0x90ad('0x1c')](_0x546e42)['then'](function(_0x5e97c8){return _0x5e97c8;});}return null;};}function removeEntity(_0x5e5322,_0xf14cc5){return function(_0x1dc2c5){if(_0x1dc2c5){return _0x1dc2c5[_0x90ad('0x1d')]()[_0x90ad('0x1e')](function(){_0x5e5322[_0x90ad('0x12')](0xcc)[_0x90ad('0x13')]();});}};}function handleEntityNotFound(_0x1dabd3,_0x3afb03){return function(_0x417a3c){if(!_0x417a3c){_0x1dabd3[_0x90ad('0x11')](0x194);}return _0x417a3c;};}function handleError(_0x356f30,_0x4b0405){_0x4b0405=_0x4b0405||0x1f4;return function(_0x1663cc){logger[_0x90ad('0x1f')](_0x1663cc[_0x90ad('0x20')]);if(_0x1663cc[_0x90ad('0x21')]){delete _0x1663cc[_0x90ad('0x21')];}_0x356f30['status'](_0x4b0405)[_0x90ad('0x22')](_0x1663cc);};}exports[_0x90ad('0x23')]=function(_0xf36046,_0x5685a1){var _0xb9d0a5={},_0x335ba1={},_0x128569={'count':0x0,'rows':[]};var _0x1ed81e=db['Sound']['rawAttributes'];_0x335ba1['model']=_[_0x90ad('0x24')](_0x1ed81e);var _0x5b2979={'dateStart':_0xf36046[_0x90ad('0x25')][_0x90ad('0x26')],'dateEnd':_0xf36046[_0x90ad('0x25')][_0x90ad('0x27')]};delete _0xf36046['query']['dateStart'];delete _0xf36046[_0x90ad('0x25')][_0x90ad('0x27')];_0x335ba1[_0x90ad('0x25')]=_['keys'](_0xf36046['query']);_0x335ba1['filters']=_['intersection'](_0x335ba1['model'],_0x335ba1[_0x90ad('0x25')]);_0xb9d0a5[_0x90ad('0x28')]=_['intersection'](_0x335ba1[_0x90ad('0x29')],qs['fields'](_0xf36046[_0x90ad('0x25')]['fields']));_0xb9d0a5['attributes']=_0xb9d0a5[_0x90ad('0x28')]['length']?_0xb9d0a5['attributes']:_0x335ba1['model'];if(!_0xf36046['query'][_0x90ad('0x2a')]('nolimit')){_0xb9d0a5[_0x90ad('0x17')]=qs['limit'](_0xf36046[_0x90ad('0x25')][_0x90ad('0x17')]);_0xb9d0a5['offset']=qs[_0x90ad('0x16')](_0xf36046[_0x90ad('0x25')]['offset']);}_0xb9d0a5[_0x90ad('0x2b')]=qs[_0x90ad('0x2c')](_0xf36046['query']['sort']);_0xb9d0a5[_0x90ad('0x2d')]=qs[_0x90ad('0x2e')](_[_0x90ad('0x2f')](_0xf36046[_0x90ad('0x25')],_0x335ba1['filters']));if(_0x5b2979[_0x90ad('0x26')]){if(_0x5b2979[_0x90ad('0x27')]){_0x5b2979[_0x90ad('0x27')]=moment(_0x5b2979[_0x90ad('0x27')])[_0x90ad('0x30')](0x1,_0x90ad('0x31'));}else{_0x5b2979[_0x90ad('0x27')]=moment(_0x5b2979[_0x90ad('0x26')])[_0x90ad('0x30')](0x1,_0x90ad('0x31'));}_[_0x90ad('0x32')](_0xb9d0a5[_0x90ad('0x2d')],{'createdAt':{'$gte':_0x5b2979[_0x90ad('0x26')],'$lte':_0x5b2979[_0x90ad('0x27')]}});}if(_0xf36046['query'][_0x90ad('0x33')]){_0xb9d0a5[_0x90ad('0x2d')]=_[_0x90ad('0x32')](_0xb9d0a5['where'],{'$or':_[_0x90ad('0x34')](_0xb9d0a5['attributes'],function(_0xbed33){var _0x57581e={};_0x57581e[_0xbed33]={'$like':'%'+_0xf36046[_0x90ad('0x25')][_0x90ad('0x33')]+'%'};return _0x57581e;})});}_0xb9d0a5=_['merge']({},_0xb9d0a5,_0xf36046[_0x90ad('0x35')]);var _0x2fdfb6={'where':_0xb9d0a5['where']};return db[_0x90ad('0x36')][_0x90ad('0x15')](_0x2fdfb6)[_0x90ad('0x1e')](function(_0x5e434a){_0x128569[_0x90ad('0x15')]=_0x5e434a;if(_0xf36046[_0x90ad('0x25')][_0x90ad('0x37')]){_0xb9d0a5[_0x90ad('0x38')]=[{'all':!![]}];}return db['Sound'][_0x90ad('0x39')](_0xb9d0a5);})['then'](function(_0x15aa1d){_0x128569[_0x90ad('0x3a')]=_0x15aa1d;return _0x128569;})[_0x90ad('0x1e')](respondWithFilteredResult(_0x5685a1,_0xb9d0a5))[_0x90ad('0x3b')](handleError(_0x5685a1,null));};exports[_0x90ad('0x3c')]=function(_0x34f040,_0x48c37d){var _0x3076cf={'raw':!![],'where':{'id':_0x34f040[_0x90ad('0x3d')]['id']}},_0x228e2f={};_0x228e2f[_0x90ad('0x29')]=_[_0x90ad('0x24')](db[_0x90ad('0x36')][_0x90ad('0x3e')]);_0x228e2f['query']=_[_0x90ad('0x24')](_0x34f040[_0x90ad('0x25')]);_0x228e2f['filters']=_[_0x90ad('0x3f')](_0x228e2f[_0x90ad('0x29')],_0x228e2f[_0x90ad('0x25')]);_0x3076cf[_0x90ad('0x28')]=_[_0x90ad('0x3f')](_0x228e2f[_0x90ad('0x29')],qs[_0x90ad('0x40')](_0x34f040[_0x90ad('0x25')][_0x90ad('0x40')]));_0x3076cf[_0x90ad('0x28')]=_0x3076cf[_0x90ad('0x28')]['length']?_0x3076cf[_0x90ad('0x28')]:_0x228e2f[_0x90ad('0x29')];if(_0x34f040[_0x90ad('0x25')]['includeAll']){_0x3076cf[_0x90ad('0x38')]=[{'all':!![]}];}_0x3076cf=_[_0x90ad('0x32')]({},_0x3076cf,_0x34f040[_0x90ad('0x35')]);return db[_0x90ad('0x36')][_0x90ad('0x41')](_0x3076cf)[_0x90ad('0x1e')](handleEntityNotFound(_0x48c37d,null))[_0x90ad('0x1e')](respondWithResult(_0x48c37d,null))[_0x90ad('0x3b')](handleError(_0x48c37d,null));};exports['download']=function(_0xd9a691,_0xc875f4,_0x589649){return db[_0x90ad('0x36')][_0x90ad('0x41')]({'where':{'id':_0xd9a691[_0x90ad('0x3d')]['id']},'attributes':[_0x90ad('0x21'),_0x90ad('0x42'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0xc875f4,null))['then'](function(_0x1db737){if(_0x1db737){if(!fs[_0x90ad('0x43')](path['join'](config[_0x90ad('0x44')],_0x90ad('0x45'),_0x1db737[_0x90ad('0x42')]+'.'+_0x1db737['converted_format']))){throw new db[(_0x90ad('0x46'))][(_0x90ad('0x47'))](_0x90ad('0x48'));}return _0xc875f4[_0x90ad('0x49')](path['join'](config['root'],_0x90ad('0x45'),util['format'](_0x90ad('0x4a'),_0x1db737[_0x90ad('0x42')],_0x1db737[_0x90ad('0x4b')])),util[_0x90ad('0x4c')](_0x90ad('0x4a'),_0x1db737[_0x90ad('0x21')],_0x1db737[_0x90ad('0x4b')]));}return null;})['catch'](handleError(_0xc875f4,null));};exports['create']=function(_0x1f1d45,_0x16ca5d,_0x40db4b){var _0x318814={'name':path[_0x90ad('0x4d')](_0x1f1d45['file'][_0x90ad('0x4e')],path[_0x90ad('0x4f')](_0x1f1d45['file'][_0x90ad('0x4e')])),'save_name':path['basename'](_0x1f1d45[_0x90ad('0x50')]['filename'],path[_0x90ad('0x4f')](_0x1f1d45[_0x90ad('0x50')]['filename'])),'original_format':path[_0x90ad('0x4f')](_0x1f1d45[_0x90ad('0x50')][_0x90ad('0x4e')])[_0x90ad('0x51')](0x1),'converted_format':'wav'};var _0x2c4a47=path[_0x90ad('0x52')](config[_0x90ad('0x44')],_0x90ad('0x53'),_0x1f1d45['file'][_0x90ad('0x54')]);var _0x15fdc8=path[_0x90ad('0x52')](config[_0x90ad('0x44')],_0x90ad('0x45'),util[_0x90ad('0x4c')]('%s.%s',path[_0x90ad('0x4d')](_0x1f1d45[_0x90ad('0x50')][_0x90ad('0x54')],path[_0x90ad('0x4f')](_0x1f1d45['file'][_0x90ad('0x54')])),_0x318814[_0x90ad('0x4b')]));logger[_0x90ad('0x55')]('Sound\x20upload\x20filepath:\x20%s',_0x2c4a47);logger[_0x90ad('0x55')](_0x90ad('0x56'),_0x15fdc8);try{fs[_0x90ad('0x57')](_0x2c4a47,parseInt(_0x90ad('0x58'),0x8));var _0x45796c=sox[_0x90ad('0x59')](_0x2c4a47,_0x15fdc8,{'sampleRate':0x1f40,'format':_0x90ad('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45796c['on'](_0x90ad('0x1f'),function(_0x44ed15){fs[_0x90ad('0x5b')](_0x2c4a47);_0x16ca5d[_0x90ad('0x12')](0x1f4)[_0x90ad('0x22')](_0x44ed15);});_0x45796c['on'](_0x90ad('0x5c'),function(_0x30d16a){_0x318814['original_duration']=isNaN(_0x30d16a['duration'])?null:_0x30d16a[_0x90ad('0x5d')]*0x3e8;_0x318814[_0x90ad('0x5e')]=isNaN(_0x30d16a[_0x90ad('0x5f')])?null:_0x30d16a['sampleCount'];_0x318814[_0x90ad('0x60')]=isNaN(_0x30d16a[_0x90ad('0x61')])?null:_0x30d16a['channelCount'];_0x318814[_0x90ad('0x62')]=isNaN(_0x30d16a['bitRate'])?null:_0x30d16a[_0x90ad('0x63')];_0x318814[_0x90ad('0x64')]=isNaN(_0x30d16a[_0x90ad('0x65')])?null:_0x30d16a[_0x90ad('0x65')];});_0x45796c['on'](_0x90ad('0x66'),function(_0x321b23){_0x318814[_0x90ad('0x67')]=isNaN(_0x321b23[_0x90ad('0x5d')])?null:_0x321b23[_0x90ad('0x5d')]*0x3e8;_0x318814[_0x90ad('0x68')]=isNaN(_0x321b23['sampleCount'])?null:_0x321b23[_0x90ad('0x5f')];_0x318814['converted_channelCount']=isNaN(_0x321b23[_0x90ad('0x61')])?null:_0x321b23[_0x90ad('0x61')];_0x318814[_0x90ad('0x69')]=isNaN(_0x321b23[_0x90ad('0x63')])?null:_0x321b23['bitRate'];_0x318814[_0x90ad('0x6a')]=isNaN(_0x321b23[_0x90ad('0x65')])?null:_0x321b23[_0x90ad('0x65')];});_0x45796c['on'](_0x90ad('0x13'),function(){fs[_0x90ad('0x57')](_0x15fdc8,parseInt(_0x90ad('0x58'),0x8));return db[_0x90ad('0x36')][_0x90ad('0x6b')](_0x318814)[_0x90ad('0x1e')](respondWithResult(_0x16ca5d,null))[_0x90ad('0x3b')](handleError(_0x16ca5d,null));});_0x45796c[_0x90ad('0x6c')]();}catch(_0x1f9645){_0x16ca5d[_0x90ad('0x12')](0x1f4)[_0x90ad('0x22')](_0x1f9645);}};exports['update']=function(_0x3ea7bc,_0x2d92e7,_0x3974c7){return db[_0x90ad('0x36')][_0x90ad('0x41')]({'where':{'id':_0x3ea7bc[_0x90ad('0x3d')]['id']}})[_0x90ad('0x1e')](handleEntityNotFound(_0x2d92e7,null))['then'](saveUpdates(_['pick'](_0x3ea7bc[_0x90ad('0x6d')],[_0x90ad('0x21'),_0x90ad('0x6e')]),null))[_0x90ad('0x1e')](respondWithResult(_0x2d92e7,null))[_0x90ad('0x3b')](handleError(_0x2d92e7,null));};exports['delete']=function(_0x2af65b,_0x3a322c,_0x5b9c80){return db['Sound'][_0x90ad('0x41')]({'where':{'id':_0x2af65b[_0x90ad('0x3d')]['id']}})[_0x90ad('0x1e')](function(_0xf8b576){if(_0xf8b576){return _0xf8b576[_0x90ad('0x1d')]();}})[_0x90ad('0x1e')](function(_0x24adfb){var _0x4a499c=path[_0x90ad('0x52')](config[_0x90ad('0x44')],_0x90ad('0x53'),util['format'](_0x90ad('0x4a'),_0x24adfb['save_name'],_0x24adfb[_0x90ad('0x6f')]));var _0x13c0c1=path[_0x90ad('0x52')](config[_0x90ad('0x44')],_0x90ad('0x45'),util[_0x90ad('0x4c')](_0x90ad('0x4a'),_0x24adfb[_0x90ad('0x42')],_0x24adfb['converted_format']));fs[_0x90ad('0x5b')](_0x4a499c);fs['unlinkSync'](_0x13c0c1);return _0x24adfb;})[_0x90ad('0x1e')](function(_0x4249fd){if(_0x4249fd){return _0x3a322c[_0x90ad('0x12')](0xcc)[_0x90ad('0x13')]();}})['then'](handleEntityNotFound(_0x3a322c,null))[_0x90ad('0x3b')](handleError(_0x3a322c,null));}; \ No newline at end of file +var _0x8162=['duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','send','update','pick','description','original_format','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','offset','status','Content-Range','save','then','destroy','end','error','name','index','Sound','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','length','nolimit','limit','order','sort','where','add','day','merge','filter','options','include','rows','catch','show','params','fields','includeAll','find','download','save_name','converted_format','join','server/files/sounds/converted','Sequelize','ValidationError','root','format','%s.%s','create','file','originalname','extname','basename','filename','substring','wav','server/files/sounds/original','info','chmodSync','0777','transcode','unlinkSync','src','original_duration'];(function(_0xfd8dcd,_0x537966){var _0x2283b4=function(_0x57fdbb){while(--_0x57fdbb){_0xfd8dcd['push'](_0xfd8dcd['shift']());}};_0x2283b4(++_0x537966);}(_0x8162,0x139));var _0x2816=function(_0x10d618,_0x1f1c82){_0x10d618=_0x10d618-0x0;var _0x57d044=_0x8162[_0x10d618];return _0x57d044;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2816('0x0'));var BPromise=require(_0x2816('0x1'));var Mustache=require('mustache');var util=require(_0x2816('0x2'));var path=require(_0x2816('0x3'));var sox=require(_0x2816('0x4'));var csv=require(_0x2816('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2816('0x6'));var crypto=require(_0x2816('0x7'));var jsforce=require(_0x2816('0x8'));var deskjs=require(_0x2816('0x9'));var toCsv=require(_0x2816('0x5'));var querystring=require('querystring');var Papa=require(_0x2816('0xa'));var qs=require('../../components/parsers/qs');var logger=require(_0x2816('0xb'))('api');var utils=require(_0x2816('0xc'));var config=require(_0x2816('0xd'));var db=require(_0x2816('0xe'))['db'];function respondWithStatusCode(_0x560761,_0x3b882a){_0x3b882a=_0x3b882a||0xcc;return function(_0x41b939){if(_0x41b939){return _0x560761[_0x2816('0xf')](_0x3b882a);}return _0x560761['status'](_0x3b882a)['end']();};}function respondWithResult(_0x53b290,_0xefedba){_0xefedba=_0xefedba||0xc8;return function(_0x33488e){if(_0x33488e){return _0x53b290['status'](_0xefedba)[_0x2816('0x10')](_0x33488e);}};}function respondWithFilteredResult(_0x1d1e56,_0x428286){return function(_0x79b9c){if(_0x79b9c){var _0x9a8a38=_0x79b9c[_0x2816('0x11')],_0x2d21ed=_0x428286['offset'],_0x3a7061=_0x428286[_0x2816('0x12')]+_0x428286['limit'],_0x4ccfdf;if(_0x3a7061>=_0x9a8a38){_0x3a7061=_0x9a8a38;_0x4ccfdf=0xc8;}else{_0x4ccfdf=0xce;}_0x1d1e56[_0x2816('0x13')](_0x4ccfdf);return _0x1d1e56['set'](_0x2816('0x14'),_0x2d21ed+'-'+_0x3a7061+'/'+_0x9a8a38)[_0x2816('0x10')](_0x79b9c);}return null;};}function patchUpdates(_0x1fe591){return function(_0x4e935d){try{jsonpatch['apply'](_0x4e935d,_0x1fe591,!![]);}catch(_0x587e8f){return BPromise['reject'](_0x587e8f);}return _0x4e935d[_0x2816('0x15')]();};}function saveUpdates(_0x19d746,_0x1b7ec1){return function(_0x4d3a63){if(_0x4d3a63){return _0x4d3a63['update'](_0x19d746)[_0x2816('0x16')](function(_0x3ed68c){return _0x3ed68c;});}return null;};}function removeEntity(_0x5f2485,_0x463c61){return function(_0x2a0575){if(_0x2a0575){return _0x2a0575[_0x2816('0x17')]()[_0x2816('0x16')](function(){_0x5f2485[_0x2816('0x13')](0xcc)[_0x2816('0x18')]();});}};}function handleEntityNotFound(_0x768b6d,_0x1cb208){return function(_0x1e84c3){if(!_0x1e84c3){_0x768b6d[_0x2816('0xf')](0x194);}return _0x1e84c3;};}function handleError(_0x316c95,_0x2c894e){_0x2c894e=_0x2c894e||0x1f4;return function(_0x26c63e){logger[_0x2816('0x19')](_0x26c63e['stack']);if(_0x26c63e[_0x2816('0x1a')]){delete _0x26c63e[_0x2816('0x1a')];}_0x316c95[_0x2816('0x13')](_0x2c894e)['send'](_0x26c63e);};}exports[_0x2816('0x1b')]=function(_0x7b8f4a,_0x531b15){var _0x12ec22={},_0x9e5943={},_0x5da99f={'count':0x0,'rows':[]};var _0x1d3bd4=db[_0x2816('0x1c')][_0x2816('0x1d')];_0x9e5943[_0x2816('0x1e')]=_[_0x2816('0x1f')](_0x1d3bd4);var _0x113d72={'dateStart':_0x7b8f4a[_0x2816('0x20')]['dateStart'],'dateEnd':_0x7b8f4a[_0x2816('0x20')][_0x2816('0x21')]};delete _0x7b8f4a[_0x2816('0x20')][_0x2816('0x22')];delete _0x7b8f4a[_0x2816('0x20')][_0x2816('0x21')];_0x9e5943[_0x2816('0x20')]=_[_0x2816('0x1f')](_0x7b8f4a['query']);_0x9e5943[_0x2816('0x23')]=_[_0x2816('0x24')](_0x9e5943[_0x2816('0x1e')],_0x9e5943['query']);_0x12ec22[_0x2816('0x25')]=_[_0x2816('0x24')](_0x9e5943[_0x2816('0x1e')],qs['fields'](_0x7b8f4a[_0x2816('0x20')]['fields']));_0x12ec22[_0x2816('0x25')]=_0x12ec22[_0x2816('0x25')][_0x2816('0x26')]?_0x12ec22[_0x2816('0x25')]:_0x9e5943[_0x2816('0x1e')];if(!_0x7b8f4a[_0x2816('0x20')]['hasOwnProperty'](_0x2816('0x27'))){_0x12ec22[_0x2816('0x28')]=qs[_0x2816('0x28')](_0x7b8f4a[_0x2816('0x20')][_0x2816('0x28')]);_0x12ec22[_0x2816('0x12')]=qs[_0x2816('0x12')](_0x7b8f4a[_0x2816('0x20')][_0x2816('0x12')]);}_0x12ec22[_0x2816('0x29')]=qs[_0x2816('0x2a')](_0x7b8f4a[_0x2816('0x20')]['sort']);_0x12ec22[_0x2816('0x2b')]=qs[_0x2816('0x23')](_['pick'](_0x7b8f4a[_0x2816('0x20')],_0x9e5943[_0x2816('0x23')]));if(_0x113d72[_0x2816('0x22')]){if(_0x113d72[_0x2816('0x21')]){_0x113d72[_0x2816('0x21')]=moment(_0x113d72[_0x2816('0x21')])[_0x2816('0x2c')](0x1,_0x2816('0x2d'));}else{_0x113d72[_0x2816('0x21')]=moment(_0x113d72['dateStart'])[_0x2816('0x2c')](0x1,'day');}_[_0x2816('0x2e')](_0x12ec22[_0x2816('0x2b')],{'createdAt':{'$gte':_0x113d72[_0x2816('0x22')],'$lte':_0x113d72['dateEnd']}});}if(_0x7b8f4a[_0x2816('0x20')][_0x2816('0x2f')]){_0x12ec22[_0x2816('0x2b')]=_[_0x2816('0x2e')](_0x12ec22['where'],{'$or':_['map'](_0x12ec22[_0x2816('0x25')],function(_0x13b655){var _0x1d235c={};_0x1d235c[_0x13b655]={'$like':'%'+_0x7b8f4a[_0x2816('0x20')][_0x2816('0x2f')]+'%'};return _0x1d235c;})});}_0x12ec22=_['merge']({},_0x12ec22,_0x7b8f4a[_0x2816('0x30')]);var _0x31f799={'where':_0x12ec22[_0x2816('0x2b')]};return db['Sound']['count'](_0x31f799)['then'](function(_0x26b51c){_0x5da99f[_0x2816('0x11')]=_0x26b51c;if(_0x7b8f4a['query']['includeAll']){_0x12ec22[_0x2816('0x31')]=[{'all':!![]}];}return db['Sound']['findAll'](_0x12ec22);})[_0x2816('0x16')](function(_0x2250bc){_0x5da99f[_0x2816('0x32')]=_0x2250bc;return _0x5da99f;})[_0x2816('0x16')](respondWithFilteredResult(_0x531b15,_0x12ec22))[_0x2816('0x33')](handleError(_0x531b15,null));};exports[_0x2816('0x34')]=function(_0x1c9f78,_0x3e9581){var _0x127045={'raw':!![],'where':{'id':_0x1c9f78[_0x2816('0x35')]['id']}},_0x20c679={};_0x20c679[_0x2816('0x1e')]=_[_0x2816('0x1f')](db[_0x2816('0x1c')][_0x2816('0x1d')]);_0x20c679[_0x2816('0x20')]=_[_0x2816('0x1f')](_0x1c9f78['query']);_0x20c679[_0x2816('0x23')]=_['intersection'](_0x20c679[_0x2816('0x1e')],_0x20c679[_0x2816('0x20')]);_0x127045[_0x2816('0x25')]=_['intersection'](_0x20c679['model'],qs[_0x2816('0x36')](_0x1c9f78[_0x2816('0x20')][_0x2816('0x36')]));_0x127045[_0x2816('0x25')]=_0x127045[_0x2816('0x25')][_0x2816('0x26')]?_0x127045[_0x2816('0x25')]:_0x20c679[_0x2816('0x1e')];if(_0x1c9f78['query'][_0x2816('0x37')]){_0x127045[_0x2816('0x31')]=[{'all':!![]}];}_0x127045=_[_0x2816('0x2e')]({},_0x127045,_0x1c9f78[_0x2816('0x30')]);return db[_0x2816('0x1c')][_0x2816('0x38')](_0x127045)[_0x2816('0x16')](handleEntityNotFound(_0x3e9581,null))[_0x2816('0x16')](respondWithResult(_0x3e9581,null))[_0x2816('0x33')](handleError(_0x3e9581,null));};exports[_0x2816('0x39')]=function(_0x237615,_0x124625,_0x46ba12){return db[_0x2816('0x1c')]['find']({'where':{'id':_0x237615[_0x2816('0x35')]['id']},'attributes':[_0x2816('0x1a'),_0x2816('0x3a'),_0x2816('0x3b')],'raw':!![]})['then'](handleEntityNotFound(_0x124625,null))[_0x2816('0x16')](function(_0x28fac4){if(_0x28fac4){if(!fs['existsSync'](path[_0x2816('0x3c')](config['root'],_0x2816('0x3d'),_0x28fac4[_0x2816('0x3a')]+'.'+_0x28fac4['converted_format']))){throw new db[(_0x2816('0x3e'))][(_0x2816('0x3f'))]('Sound\x20not\x20found');}return _0x124625[_0x2816('0x39')](path[_0x2816('0x3c')](config[_0x2816('0x40')],_0x2816('0x3d'),util[_0x2816('0x41')](_0x2816('0x42'),_0x28fac4[_0x2816('0x3a')],_0x28fac4[_0x2816('0x3b')])),util['format'](_0x2816('0x42'),_0x28fac4[_0x2816('0x1a')],_0x28fac4['converted_format']));}return null;})[_0x2816('0x33')](handleError(_0x124625,null));};exports[_0x2816('0x43')]=function(_0x174e19,_0x1debb2,_0x45b735){var _0x4b434c={'name':path['basename'](_0x174e19[_0x2816('0x44')][_0x2816('0x45')],path[_0x2816('0x46')](_0x174e19['file'][_0x2816('0x45')])),'save_name':path[_0x2816('0x47')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')],path['extname'](_0x174e19[_0x2816('0x44')][_0x2816('0x48')])),'original_format':path[_0x2816('0x46')](_0x174e19[_0x2816('0x44')]['originalname'])[_0x2816('0x49')](0x1),'converted_format':_0x2816('0x4a')};var _0x8d15a9=path[_0x2816('0x3c')](config[_0x2816('0x40')],_0x2816('0x4b'),_0x174e19[_0x2816('0x44')][_0x2816('0x48')]);var _0x2d4958=path['join'](config[_0x2816('0x40')],'server/files/sounds/converted',util['format']('%s.%s',path[_0x2816('0x47')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')],path[_0x2816('0x46')](_0x174e19[_0x2816('0x44')][_0x2816('0x48')])),_0x4b434c['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x8d15a9);logger[_0x2816('0x4c')]('Sound\x20upload\x20destination:\x20%s',_0x2d4958);try{fs[_0x2816('0x4d')](_0x8d15a9,parseInt(_0x2816('0x4e'),0x8));var _0x36a2fd=sox[_0x2816('0x4f')](_0x8d15a9,_0x2d4958,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36a2fd['on']('error',function(_0x4667e9){fs[_0x2816('0x50')](_0x8d15a9);_0x1debb2[_0x2816('0x13')](0x1f4)['send'](_0x4667e9);});_0x36a2fd['on'](_0x2816('0x51'),function(_0x338470){_0x4b434c[_0x2816('0x52')]=isNaN(_0x338470['duration'])?null:_0x338470[_0x2816('0x53')]*0x3e8;_0x4b434c['original_sampleCount']=isNaN(_0x338470[_0x2816('0x54')])?null:_0x338470['sampleCount'];_0x4b434c['original_channelCount']=isNaN(_0x338470[_0x2816('0x55')])?null:_0x338470['channelCount'];_0x4b434c[_0x2816('0x56')]=isNaN(_0x338470['bitRate'])?null:_0x338470[_0x2816('0x57')];_0x4b434c[_0x2816('0x58')]=isNaN(_0x338470[_0x2816('0x59')])?null:_0x338470['sampleRate'];});_0x36a2fd['on']('dest',function(_0x228255){_0x4b434c[_0x2816('0x5a')]=isNaN(_0x228255['duration'])?null:_0x228255[_0x2816('0x53')]*0x3e8;_0x4b434c['converted_sampleCount']=isNaN(_0x228255[_0x2816('0x54')])?null:_0x228255[_0x2816('0x54')];_0x4b434c[_0x2816('0x5b')]=isNaN(_0x228255[_0x2816('0x55')])?null:_0x228255[_0x2816('0x55')];_0x4b434c[_0x2816('0x5c')]=isNaN(_0x228255[_0x2816('0x57')])?null:_0x228255[_0x2816('0x57')];_0x4b434c[_0x2816('0x5d')]=isNaN(_0x228255[_0x2816('0x59')])?null:_0x228255['sampleRate'];});_0x36a2fd['on'](_0x2816('0x18'),function(){fs[_0x2816('0x4d')](_0x2d4958,parseInt(_0x2816('0x4e'),0x8));return db['Sound'][_0x2816('0x43')](_0x4b434c)[_0x2816('0x16')](respondWithResult(_0x1debb2,null))[_0x2816('0x33')](handleError(_0x1debb2,null));});_0x36a2fd['start']();}catch(_0x3f8209){_0x1debb2[_0x2816('0x13')](0x1f4)[_0x2816('0x5e')](_0x3f8209);}};exports[_0x2816('0x5f')]=function(_0x42e469,_0x5c332f,_0xf22fb0){return db['Sound'][_0x2816('0x38')]({'where':{'id':_0x42e469[_0x2816('0x35')]['id']}})['then'](handleEntityNotFound(_0x5c332f,null))['then'](saveUpdates(_[_0x2816('0x60')](_0x42e469['body'],[_0x2816('0x1a'),_0x2816('0x61')]),null))['then'](respondWithResult(_0x5c332f,null))[_0x2816('0x33')](handleError(_0x5c332f,null));};exports['delete']=function(_0x1bd4cc,_0x13605c,_0x522852){return db[_0x2816('0x1c')][_0x2816('0x38')]({'where':{'id':_0x1bd4cc['params']['id']}})[_0x2816('0x16')](function(_0x2d7c7a){if(_0x2d7c7a){return _0x2d7c7a[_0x2816('0x17')]();}})[_0x2816('0x16')](function(_0x1e76f4){var _0x207e10=path[_0x2816('0x3c')](config[_0x2816('0x40')],'server/files/sounds/original',util[_0x2816('0x41')]('%s.%s',_0x1e76f4[_0x2816('0x3a')],_0x1e76f4[_0x2816('0x62')]));var _0x331f6e=path[_0x2816('0x3c')](config['root'],'server/files/sounds/converted',util[_0x2816('0x41')](_0x2816('0x42'),_0x1e76f4[_0x2816('0x3a')],_0x1e76f4[_0x2816('0x3b')]));fs[_0x2816('0x50')](_0x207e10);fs[_0x2816('0x50')](_0x331f6e);return _0x1e76f4;})[_0x2816('0x16')](function(_0x1dac13){if(_0x1dac13){return _0x13605c['status'](0xcc)['end']();}})[_0x2816('0x16')](handleEntityNotFound(_0x13605c,null))['catch'](handleError(_0x13605c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 060c7cb..8e6c811 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 _0x775e=['tools_sounds','lodash','util','moment','bluebird','./sound.attributes','exports','define','Sound'];(function(_0x4b3300,_0x1137f1){var _0x2d26d3=function(_0x4678b5){while(--_0x4678b5){_0x4b3300['push'](_0x4b3300['shift']());}};_0x2d26d3(++_0x1137f1);}(_0x775e,0xc7));var _0xe775=function(_0x25f3a6,_0x4a3d87){_0x25f3a6=_0x25f3a6-0x0;var _0x1a5bb3=_0x775e[_0x25f3a6];return _0x1a5bb3;};'use strict';var _=require(_0xe775('0x0'));var util=require(_0xe775('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe775('0x2'));var BPromise=require(_0xe775('0x3'));var rp=require('request-promise');var attributes=require(_0xe775('0x4'));module[_0xe775('0x5')]=function(_0x18d0b5,_0x59fc7b){return _0x18d0b5[_0xe775('0x6')](_0xe775('0x7'),attributes,{'tableName':_0xe775('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x895b=['./sound.attributes','exports','define','Sound','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x22aaeb,_0x404725){var _0x5d42ee=function(_0x589c95){while(--_0x589c95){_0x22aaeb['push'](_0x22aaeb['shift']());}};_0x5d42ee(++_0x404725);}(_0x895b,0x9a));var _0xb895=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x895b[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xb895('0x0'));var util=require(_0xb895('0x1'));var logger=require(_0xb895('0x2'))(_0xb895('0x3'));var moment=require(_0xb895('0x4'));var BPromise=require('bluebird');var rp=require(_0xb895('0x5'));var attributes=require(_0xb895('0x6'));module[_0xb895('0x7')]=function(_0x40dc41,_0x1efd5c){return _0x40dc41[_0xb895('0x8')](_0xb895('0x9'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 6b9c9aa..9956fd1 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 _0x6818=['attributes','map','include','model','stringify','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSound','Sound','options','where'];(function(_0x56585b,_0x2f45cd){var _0xe7002f=function(_0x57b451){while(--_0x57b451){_0x56585b['push'](_0x56585b['shift']());}};_0xe7002f(++_0x2f45cd);}(_0x6818,0x139));var _0x8681=function(_0x4660cd,_0x10b40c){_0x4660cd=_0x4660cd-0x0;var _0x578aeb=_0x6818[_0x4660cd];return _0x578aeb;};'use strict';var _=require(_0x8681('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8681('0x1'));var rs=require(_0x8681('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8681('0x3'));var logger=require(_0x8681('0x4'))(_0x8681('0x5'));var config=require(_0x8681('0x6'));var jayson=require(_0x8681('0x7'));var client=jayson[_0x8681('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47b3b9,_0x28062b,_0x53f572){return new BPromise(function(_0x1bc3c6,_0x4c42b8){return client['request'](_0x47b3b9,_0x53f572)[_0x8681('0x9')](function(_0x1501eb){logger[_0x8681('0xa')](_0x8681('0xb'),_0x28062b,_0x8681('0xc'));logger[_0x8681('0xd')](_0x8681('0xe'),_0x28062b,_0x8681('0xc'),JSON['stringify'](_0x1501eb));if(_0x1501eb[_0x8681('0xf')]){if(_0x1501eb[_0x8681('0xf')][_0x8681('0x10')]===0x1f4){logger[_0x8681('0xf')](_0x8681('0xb'),_0x28062b,_0x1501eb[_0x8681('0xf')][_0x8681('0x11')]);return _0x4c42b8(_0x1501eb['error'][_0x8681('0x11')]);}logger[_0x8681('0xf')](_0x8681('0xb'),_0x28062b,_0x1501eb[_0x8681('0xf')]['message']);return _0x1bc3c6(_0x1501eb['error'][_0x8681('0x11')]);}else{logger['info'](_0x8681('0xb'),_0x28062b,'request\x20sent');_0x1bc3c6(_0x1501eb['result'][_0x8681('0x11')]);}})[_0x8681('0x12')](function(_0x4ec444){logger[_0x8681('0xf')](_0x8681('0xb'),_0x28062b,_0x4ec444);_0x4c42b8(_0x4ec444);});});}exports[_0x8681('0x13')]=function(_0x158a09){var _0x7847ee=this;return new Promise(function(_0x46a4f0,_0x3ccb5c){return db[_0x8681('0x14')]['find']({'raw':_0x158a09[_0x8681('0x15')]?_0x158a09[_0x8681('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x158a09['options']?_0x158a09[_0x8681('0x15')][_0x8681('0x16')]||null:null,'attributes':_0x158a09['options']?_0x158a09[_0x8681('0x15')][_0x8681('0x17')]||null:null,'include':_0x158a09[_0x8681('0x15')]?_0x158a09[_0x8681('0x15')]['include']?_[_0x8681('0x18')](_0x158a09[_0x8681('0x15')][_0x8681('0x19')],function(_0x1f6fe3){return{'model':db[_0x1f6fe3[_0x8681('0x1a')]],'as':_0x1f6fe3['as'],'attributes':_0x1f6fe3[_0x8681('0x17')],'include':_0x1f6fe3[_0x8681('0x19')]?_[_0x8681('0x18')](_0x1f6fe3[_0x8681('0x19')],function(_0x67fda1){return{'model':db[_0x67fda1['model']],'as':_0x67fda1['as'],'attributes':_0x67fda1['attributes'],'include':_0x67fda1['include']?_[_0x8681('0x18')](_0x67fda1[_0x8681('0x19')],function(_0x389d04){return{'model':db[_0x389d04[_0x8681('0x1a')]],'as':_0x389d04['as'],'attributes':_0x389d04[_0x8681('0x17')]};}):[]};}):[]};}):[]:[]})[_0x8681('0x9')](function(_0x2e129a){logger[_0x8681('0xa')](_0x8681('0x13'),_0x158a09);logger[_0x8681('0xd')](_0x8681('0x13'),_0x158a09,JSON[_0x8681('0x1b')](_0x2e129a));_0x46a4f0(_0x2e129a);})['catch'](function(_0x298d10){logger[_0x8681('0xf')](_0x8681('0x13'),_0x298d10[_0x8681('0x11')],_0x158a09);_0x3ccb5c(_0x7847ee[_0x8681('0xf')](0x1f4,_0x298d10['message']));});});}; \ No newline at end of file +var _0xaa2c=['catch','options','raw','where','attributes','include','map','model','then','ShowSound','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x1f0ca7,_0x403fe9){var _0x107ec2=function(_0x12f7af){while(--_0x12f7af){_0x1f0ca7['push'](_0x1f0ca7['shift']());}};_0x107ec2(++_0x403fe9);}(_0xaa2c,0x106));var _0xcaa2=function(_0xd4627b,_0xff27fe){_0xd4627b=_0xd4627b-0x0;var _0x30e307=_0xaa2c[_0xd4627b];return _0x30e307;};'use strict';var _=require(_0xcaa2('0x0'));var util=require('util');var moment=require(_0xcaa2('0x1'));var BPromise=require('bluebird');var rs=require(_0xcaa2('0x2'));var fs=require('fs');var db=require(_0xcaa2('0x3'))['db'];var utils=require(_0xcaa2('0x4'));var logger=require(_0xcaa2('0x5'))('rpc');var config=require(_0xcaa2('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x105529,_0x2dbde4,_0x552f31){return new BPromise(function(_0x27e51d,_0x46f2af){return client[_0xcaa2('0x7')](_0x105529,_0x552f31)['then'](function(_0x2792ba){logger[_0xcaa2('0x8')](_0xcaa2('0x9'),_0x2dbde4,'request\x20sent');logger[_0xcaa2('0xa')](_0xcaa2('0xb'),_0x2dbde4,_0xcaa2('0xc'),JSON[_0xcaa2('0xd')](_0x2792ba));if(_0x2792ba[_0xcaa2('0xe')]){if(_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0xf')]===0x1f4){logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);return _0x46f2af(_0x2792ba[_0xcaa2('0xe')]['message']);}logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);return _0x27e51d(_0x2792ba[_0xcaa2('0xe')][_0xcaa2('0x10')]);}else{logger[_0xcaa2('0x8')]('Sound,\x20%s,\x20%s',_0x2dbde4,_0xcaa2('0xc'));_0x27e51d(_0x2792ba[_0xcaa2('0x11')][_0xcaa2('0x10')]);}})[_0xcaa2('0x12')](function(_0x2eccdf){logger[_0xcaa2('0xe')](_0xcaa2('0x9'),_0x2dbde4,_0x2eccdf);_0x46f2af(_0x2eccdf);});});}exports['ShowSound']=function(_0x2fb229){var _0x30c023=this;return new Promise(function(_0x4dbc53,_0x461dfc){return db['Sound']['find']({'raw':_0x2fb229['options']?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x14')]===undefined?!![]:![]:!![],'where':_0x2fb229[_0xcaa2('0x13')]?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x15')]||null:null,'attributes':_0x2fb229[_0xcaa2('0x13')]?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x16')]||null:null,'include':_0x2fb229['options']?_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x17')]?_[_0xcaa2('0x18')](_0x2fb229[_0xcaa2('0x13')][_0xcaa2('0x17')],function(_0x2ba2d7){return{'model':db[_0x2ba2d7['model']],'as':_0x2ba2d7['as'],'attributes':_0x2ba2d7[_0xcaa2('0x16')],'include':_0x2ba2d7[_0xcaa2('0x17')]?_['map'](_0x2ba2d7[_0xcaa2('0x17')],function(_0x1093c5){return{'model':db[_0x1093c5[_0xcaa2('0x19')]],'as':_0x1093c5['as'],'attributes':_0x1093c5[_0xcaa2('0x16')],'include':_0x1093c5[_0xcaa2('0x17')]?_['map'](_0x1093c5['include'],function(_0x5e884b){return{'model':db[_0x5e884b[_0xcaa2('0x19')]],'as':_0x5e884b['as'],'attributes':_0x5e884b['attributes']};}):[]};}):[]};}):[]:[]})[_0xcaa2('0x1a')](function(_0x4ef70f){logger['info'](_0xcaa2('0x1b'),_0x2fb229);logger['debug'](_0xcaa2('0x1b'),_0x2fb229,JSON[_0xcaa2('0xd')](_0x4ef70f));_0x4dbc53(_0x4ef70f);})[_0xcaa2('0x12')](function(_0x3e9f6d){logger[_0xcaa2('0xe')]('ShowSound',_0x3e9f6d[_0xcaa2('0x10')],_0x2fb229);_0x461dfc(_0x30c023[_0xcaa2('0xe')](0x1f4,_0x3e9f6d[_0xcaa2('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 0c4b5ad..eb614ba 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 _0x2bd8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','test','put','update','destroy','multer','path'];(function(_0x16f2df,_0x23470a){var _0x5975f1=function(_0x741aff){while(--_0x741aff){_0x16f2df['push'](_0x16f2df['shift']());}};_0x5975f1(++_0x23470a);}(_0x2bd8,0x130));var _0x82bd=function(_0x410e4f,_0x10e10e){_0x410e4f=_0x410e4f-0x0;var _0x58fd61=_0x2bd8[_0x410e4f];return _0x58fd61;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var express=require(_0x82bd('0x2'));var router=express[_0x82bd('0x3')]();var auth=require(_0x82bd('0x4'));var interaction=require(_0x82bd('0x5'));var config=require(_0x82bd('0x6'));var controller=require(_0x82bd('0x7'));router['get']('/',auth[_0x82bd('0x8')](),controller[_0x82bd('0x9')]);router[_0x82bd('0xa')]('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0xb')]);router[_0x82bd('0xa')](_0x82bd('0xc'),auth['isAuthenticated'](),controller[_0x82bd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x82bd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router['delete']('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2bd8=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','show','/:id/test','test','put','update','destroy','multer','path'];(function(_0x3050b5,_0x182c6a){var _0x37cceb=function(_0x49b797){while(--_0x49b797){_0x3050b5['push'](_0x3050b5['shift']());}};_0x37cceb(++_0x182c6a);}(_0x2bd8,0x130));var _0x82bd=function(_0x2c9cf1,_0x27a659){_0x2c9cf1=_0x2c9cf1-0x0;var _0x8976c8=_0x2bd8[_0x2c9cf1];return _0x8976c8;};'use strict';var multer=require(_0x82bd('0x0'));var util=require('util');var path=require(_0x82bd('0x1'));var express=require(_0x82bd('0x2'));var router=express[_0x82bd('0x3')]();var auth=require(_0x82bd('0x4'));var interaction=require(_0x82bd('0x5'));var config=require(_0x82bd('0x6'));var controller=require(_0x82bd('0x7'));router['get']('/',auth[_0x82bd('0x8')](),controller[_0x82bd('0x9')]);router[_0x82bd('0xa')]('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0xb')]);router[_0x82bd('0xa')](_0x82bd('0xc'),auth['isAuthenticated'](),controller[_0x82bd('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x82bd('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x82bd('0xf')]);router['delete']('/:id',auth[_0x82bd('0x8')](),controller[_0x82bd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 34a5ea8..86f8d2b 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 _0xa2be=['STRING','name','sequelize','exports'];(function(_0x2ef98e,_0x171eb2){var _0x467c65=function(_0x122c79){while(--_0x122c79){_0x2ef98e['push'](_0x2ef98e['shift']());}};_0x467c65(++_0x171eb2);}(_0xa2be,0x16a));var _0xea2b=function(_0x365973,_0x24b441){_0x365973=_0x365973-0x0;var _0x5d12a5=_0xa2be[_0x365973];return _0x5d12a5;};'use strict';var Sequelize=require(_0xea2b('0x0'));module[_0xea2b('0x1')]={'name':{'type':Sequelize[_0xea2b('0x2')],'unique':_0xea2b('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xea2b('0x2')]},'description':{'type':Sequelize[_0xea2b('0x2')]}}; \ No newline at end of file +var _0x464b=['sequelize','exports','name','STRING'];(function(_0x9bde81,_0x3f7c44){var _0x493a5a=function(_0x4841c0){while(--_0x4841c0){_0x9bde81['push'](_0x9bde81['shift']());}};_0x493a5a(++_0x3f7c44);}(_0x464b,0x144));var _0xb464=function(_0x1aa0a0,_0x500078){_0x1aa0a0=_0x1aa0a0-0x0;var _0x17d8a1=_0x464b[_0x1aa0a0];return _0x17d8a1;};'use strict';var Sequelize=require(_0xb464('0x0'));module[_0xb464('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb464('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xb464('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 9ad30e5..5fbd439 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 _0xc7eb=['filter','options','includeAll','include','findAll','rows','show','catch','create','body','find','destroy','params','test','dsn','closeSync','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','limit','set','Content-Range','json','apply','update','then','error','stack','send','index','SquareOdbc','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','merge'];(function(_0x2c34d6,_0x185b44){var _0x2c7998=function(_0x4bc131){while(--_0x4bc131){_0x2c34d6['push'](_0x2c34d6['shift']());}};_0x2c7998(++_0x185b44);}(_0xc7eb,0xa4));var _0xbc7e=function(_0x20fdc1,_0xde1296){_0x20fdc1=_0x20fdc1-0x0;var _0x25397c=_0xc7eb[_0x20fdc1];return _0x25397c;};'use strict';var jsonpatch=require(_0xbc7e('0x0'));var rp=require(_0xbc7e('0x1'));var moment=require(_0xbc7e('0x2'));var BPromise=require(_0xbc7e('0x3'));var Mustache=require(_0xbc7e('0x4'));var util=require(_0xbc7e('0x5'));var path=require(_0xbc7e('0x6'));var sox=require('sox');var csv=require(_0xbc7e('0x7'));var ejs=require(_0xbc7e('0x8'));var fs=require('fs');var _=require(_0xbc7e('0x9'));var squel=require(_0xbc7e('0xa'));var crypto=require(_0xbc7e('0xb'));var jsforce=require(_0xbc7e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbc7e('0x7'));var querystring=require(_0xbc7e('0xd'));var Papa=require(_0xbc7e('0xe'));var qs=require(_0xbc7e('0xf'));var logger=require(_0xbc7e('0x10'))(_0xbc7e('0x11'));var utils=require(_0xbc7e('0x12'));var config=require(_0xbc7e('0x13'));var db=require(_0xbc7e('0x14'))['db'];function respondWithStatusCode(_0x181698,_0x57aaf8){_0x57aaf8=_0x57aaf8||0xcc;return function(_0x3a2992){if(_0x3a2992){return _0x181698[_0xbc7e('0x15')](_0x57aaf8);}return _0x181698[_0xbc7e('0x16')](_0x57aaf8)[_0xbc7e('0x17')]();};}function respondWithResult(_0x5db86,_0x2b7030){_0x2b7030=_0x2b7030||0xc8;return function(_0x30c90c){if(_0x30c90c){return _0x5db86['status'](_0x2b7030)['json'](_0x30c90c);}};}function respondWithFilteredResult(_0x2c5e0b,_0x5f4ac0){return function(_0x481236){if(_0x481236){var _0x1a09cd=_0x481236[_0xbc7e('0x18')],_0x45e359=_0x5f4ac0['offset'],_0x179035=_0x5f4ac0['offset']+_0x5f4ac0[_0xbc7e('0x19')],_0x72e759;if(_0x179035>=_0x1a09cd){_0x179035=_0x1a09cd;_0x72e759=0xc8;}else{_0x72e759=0xce;}_0x2c5e0b[_0xbc7e('0x16')](_0x72e759);return _0x2c5e0b[_0xbc7e('0x1a')](_0xbc7e('0x1b'),_0x45e359+'-'+_0x179035+'/'+_0x1a09cd)[_0xbc7e('0x1c')](_0x481236);}return null;};}function patchUpdates(_0x4705ee){return function(_0x3ffb6e){try{jsonpatch[_0xbc7e('0x1d')](_0x3ffb6e,_0x4705ee,!![]);}catch(_0x25c4fb){return BPromise['reject'](_0x25c4fb);}return _0x3ffb6e['save']();};}function saveUpdates(_0x5941c7,_0x19c97b){return function(_0x510741){if(_0x510741){return _0x510741[_0xbc7e('0x1e')](_0x5941c7)[_0xbc7e('0x1f')](function(_0x59c9b7){return _0x59c9b7;});}return null;};}function removeEntity(_0x41e49d,_0x394f41){return function(_0xbee234){if(_0xbee234){return _0xbee234['destroy']()['then'](function(){_0x41e49d[_0xbc7e('0x16')](0xcc)[_0xbc7e('0x17')]();});}};}function handleEntityNotFound(_0x406c41,_0x432dce){return function(_0x4d7871){if(!_0x4d7871){_0x406c41['sendStatus'](0x194);}return _0x4d7871;};}function handleError(_0x1cafc4,_0x7ccaff){_0x7ccaff=_0x7ccaff||0x1f4;return function(_0x1143cc){logger[_0xbc7e('0x20')](_0x1143cc[_0xbc7e('0x21')]);if(_0x1143cc['name']){delete _0x1143cc['name'];}_0x1cafc4[_0xbc7e('0x16')](_0x7ccaff)[_0xbc7e('0x22')](_0x1143cc);};}exports[_0xbc7e('0x23')]=function(_0x3fb880,_0x4188e6){var _0x10aa04={},_0x2f1ac2={},_0x1f15b3={'count':0x0,'rows':[]};var _0x47d84a=db[_0xbc7e('0x24')][_0xbc7e('0x25')];_0x2f1ac2['model']=_[_0xbc7e('0x26')](_0x47d84a);var _0x52a692={'dateStart':_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x28')],'dateEnd':_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x29')]};delete _0x3fb880[_0xbc7e('0x27')]['dateStart'];delete _0x3fb880['query'][_0xbc7e('0x29')];_0x2f1ac2[_0xbc7e('0x27')]=_[_0xbc7e('0x26')](_0x3fb880['query']);_0x2f1ac2[_0xbc7e('0x2a')]=_[_0xbc7e('0x2b')](_0x2f1ac2[_0xbc7e('0x2c')],_0x2f1ac2[_0xbc7e('0x27')]);_0x10aa04[_0xbc7e('0x2d')]=_['intersection'](_0x2f1ac2[_0xbc7e('0x2c')],qs['fields'](_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x2e')]));_0x10aa04[_0xbc7e('0x2d')]=_0x10aa04[_0xbc7e('0x2d')][_0xbc7e('0x2f')]?_0x10aa04['attributes']:_0x2f1ac2['model'];if(!_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x30')](_0xbc7e('0x31'))){_0x10aa04['limit']=qs[_0xbc7e('0x19')](_0x3fb880['query']['limit']);_0x10aa04[_0xbc7e('0x32')]=qs['offset'](_0x3fb880['query'][_0xbc7e('0x32')]);}_0x10aa04[_0xbc7e('0x33')]=qs[_0xbc7e('0x34')](_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x34')]);_0x10aa04[_0xbc7e('0x35')]=qs[_0xbc7e('0x2a')](_[_0xbc7e('0x36')](_0x3fb880['query'],_0x2f1ac2[_0xbc7e('0x2a')]));if(_0x52a692[_0xbc7e('0x28')]){if(_0x52a692[_0xbc7e('0x29')]){_0x52a692[_0xbc7e('0x29')]=moment(_0x52a692[_0xbc7e('0x29')])[_0xbc7e('0x37')](0x1,_0xbc7e('0x38'));}else{_0x52a692[_0xbc7e('0x29')]=moment(_0x52a692[_0xbc7e('0x28')])[_0xbc7e('0x37')](0x1,'day');}_['merge'](_0x10aa04[_0xbc7e('0x35')],{'createdAt':{'$gte':_0x52a692['dateStart'],'$lte':_0x52a692[_0xbc7e('0x29')]}});}if(_0x3fb880[_0xbc7e('0x27')]['filter']){_0x10aa04[_0xbc7e('0x35')]=_[_0xbc7e('0x39')](_0x10aa04[_0xbc7e('0x35')],{'$or':_['map'](_0x10aa04[_0xbc7e('0x2d')],function(_0x326a81){var _0x2a3012={};_0x2a3012[_0x326a81]={'$like':'%'+_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x3a')]+'%'};return _0x2a3012;})});}_0x10aa04=_[_0xbc7e('0x39')]({},_0x10aa04,_0x3fb880[_0xbc7e('0x3b')]);var _0x41577d={'where':_0x10aa04[_0xbc7e('0x35')]};return db[_0xbc7e('0x24')][_0xbc7e('0x18')](_0x41577d)[_0xbc7e('0x1f')](function(_0x37e724){_0x1f15b3[_0xbc7e('0x18')]=_0x37e724;if(_0x3fb880[_0xbc7e('0x27')][_0xbc7e('0x3c')]){_0x10aa04[_0xbc7e('0x3d')]=[{'all':!![]}];}return db['SquareOdbc'][_0xbc7e('0x3e')](_0x10aa04);})['then'](function(_0x4fb91e){_0x1f15b3[_0xbc7e('0x3f')]=_0x4fb91e;return _0x1f15b3;})[_0xbc7e('0x1f')](respondWithFilteredResult(_0x4188e6,_0x10aa04))['catch'](handleError(_0x4188e6,null));};exports[_0xbc7e('0x40')]=function(_0x38064e,_0x216ea6){var _0x3e3178={'raw':!![],'where':{'id':_0x38064e['params']['id']}},_0x89e3f1={};_0x89e3f1[_0xbc7e('0x2c')]=_[_0xbc7e('0x26')](db[_0xbc7e('0x24')][_0xbc7e('0x25')]);_0x89e3f1[_0xbc7e('0x27')]=_['keys'](_0x38064e[_0xbc7e('0x27')]);_0x89e3f1['filters']=_['intersection'](_0x89e3f1[_0xbc7e('0x2c')],_0x89e3f1[_0xbc7e('0x27')]);_0x3e3178['attributes']=_[_0xbc7e('0x2b')](_0x89e3f1['model'],qs[_0xbc7e('0x2e')](_0x38064e[_0xbc7e('0x27')][_0xbc7e('0x2e')]));_0x3e3178[_0xbc7e('0x2d')]=_0x3e3178['attributes'][_0xbc7e('0x2f')]?_0x3e3178[_0xbc7e('0x2d')]:_0x89e3f1[_0xbc7e('0x2c')];if(_0x38064e[_0xbc7e('0x27')][_0xbc7e('0x3c')]){_0x3e3178['include']=[{'all':!![]}];}_0x3e3178=_[_0xbc7e('0x39')]({},_0x3e3178,_0x38064e[_0xbc7e('0x3b')]);return db[_0xbc7e('0x24')]['find'](_0x3e3178)['then'](handleEntityNotFound(_0x216ea6,null))[_0xbc7e('0x1f')](respondWithResult(_0x216ea6,null))[_0xbc7e('0x41')](handleError(_0x216ea6,null));};exports[_0xbc7e('0x42')]=function(_0x3d1042,_0x4ea9b8){return db[_0xbc7e('0x24')][_0xbc7e('0x42')](_0x3d1042[_0xbc7e('0x43')],{})[_0xbc7e('0x1f')](respondWithResult(_0x4ea9b8,0xc9))[_0xbc7e('0x41')](handleError(_0x4ea9b8,null));};exports['update']=function(_0x1895d2,_0x4b3119){if(_0x1895d2[_0xbc7e('0x43')]['id']){delete _0x1895d2[_0xbc7e('0x43')]['id'];}return db[_0xbc7e('0x24')][_0xbc7e('0x44')]({'where':{'id':_0x1895d2['params']['id']}})[_0xbc7e('0x1f')](handleEntityNotFound(_0x4b3119,null))[_0xbc7e('0x1f')](saveUpdates(_0x1895d2['body'],null))[_0xbc7e('0x1f')](respondWithResult(_0x4b3119,null))[_0xbc7e('0x41')](handleError(_0x4b3119,null));};exports[_0xbc7e('0x45')]=function(_0x487818,_0x3d0be2){return db['SquareOdbc']['find']({'where':{'id':_0x487818[_0xbc7e('0x46')]['id']}})[_0xbc7e('0x1f')](handleEntityNotFound(_0x3d0be2,null))[_0xbc7e('0x1f')](removeEntity(_0x3d0be2,null))[_0xbc7e('0x41')](handleError(_0x3d0be2,null));};exports[_0xbc7e('0x47')]=function(_0x52d407,_0x1f6335,_0x3189d5){var _0x499757;return db[_0xbc7e('0x24')][_0xbc7e('0x44')]({'where':{'id':_0x52d407[_0xbc7e('0x46')]['id']},'attributes':['id',_0xbc7e('0x48')]})[_0xbc7e('0x1f')](handleEntityNotFound(_0x1f6335,null))[_0xbc7e('0x1f')](function(_0x54082a){if(_0x54082a){var _0x1c46f8=require('odbc')();_0x1c46f8['openSync'](_0x54082a[_0xbc7e('0x48')]);_0x1c46f8[_0xbc7e('0x49')]();return _0x54082a;}})[_0xbc7e('0x1f')](respondWithResult(_0x1f6335,null))['catch'](handleError(_0x1f6335,null));}; \ No newline at end of file +var _0xaf2e=['jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','SquareOdbc','rawAttributes','keys','query','dateEnd','dateStart','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','day','add','merge','filter','map','options','include','findAll','rows','catch','show','params','find','create','body','test','dsn','odbc','openSync','closeSync','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel'];(function(_0x1a87a8,_0x127bc9){var _0x51b8b7=function(_0x2b4752){while(--_0x2b4752){_0x1a87a8['push'](_0x1a87a8['shift']());}};_0x51b8b7(++_0x127bc9);}(_0xaf2e,0x83));var _0xeaf2=function(_0x558201,_0xeab2e2){_0x558201=_0x558201-0x0;var _0x220c4d=_0xaf2e[_0x558201];return _0x220c4d;};'use strict';var jsonpatch=require(_0xeaf2('0x0'));var rp=require('request-promise');var moment=require(_0xeaf2('0x1'));var BPromise=require(_0xeaf2('0x2'));var Mustache=require(_0xeaf2('0x3'));var util=require('util');var path=require(_0xeaf2('0x4'));var sox=require('sox');var csv=require(_0xeaf2('0x5'));var ejs=require(_0xeaf2('0x6'));var fs=require('fs');var _=require(_0xeaf2('0x7'));var squel=require(_0xeaf2('0x8'));var crypto=require('crypto');var jsforce=require(_0xeaf2('0x9'));var deskjs=require(_0xeaf2('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xeaf2('0xb'));var qs=require(_0xeaf2('0xc'));var logger=require(_0xeaf2('0xd'))(_0xeaf2('0xe'));var utils=require(_0xeaf2('0xf'));var config=require('../../config/environment');var db=require(_0xeaf2('0x10'))['db'];function respondWithStatusCode(_0x448f6f,_0x55035b){_0x55035b=_0x55035b||0xcc;return function(_0x5d6d26){if(_0x5d6d26){return _0x448f6f[_0xeaf2('0x11')](_0x55035b);}return _0x448f6f[_0xeaf2('0x12')](_0x55035b)['end']();};}function respondWithResult(_0x2d0a49,_0x15e4c2){_0x15e4c2=_0x15e4c2||0xc8;return function(_0x5e1a9b){if(_0x5e1a9b){return _0x2d0a49[_0xeaf2('0x12')](_0x15e4c2)['json'](_0x5e1a9b);}};}function respondWithFilteredResult(_0x31be10,_0x885076){return function(_0x55fefc){if(_0x55fefc){var _0x2dbd8b=_0x55fefc['count'],_0x2b1a56=_0x885076[_0xeaf2('0x13')],_0x2e4034=_0x885076[_0xeaf2('0x13')]+_0x885076[_0xeaf2('0x14')],_0x27369e;if(_0x2e4034>=_0x2dbd8b){_0x2e4034=_0x2dbd8b;_0x27369e=0xc8;}else{_0x27369e=0xce;}_0x31be10[_0xeaf2('0x12')](_0x27369e);return _0x31be10['set'](_0xeaf2('0x15'),_0x2b1a56+'-'+_0x2e4034+'/'+_0x2dbd8b)[_0xeaf2('0x16')](_0x55fefc);}return null;};}function patchUpdates(_0x2e24b6){return function(_0x2536f6){try{jsonpatch[_0xeaf2('0x17')](_0x2536f6,_0x2e24b6,!![]);}catch(_0x595c54){return BPromise[_0xeaf2('0x18')](_0x595c54);}return _0x2536f6[_0xeaf2('0x19')]();};}function saveUpdates(_0x8f62af,_0x3759b0){return function(_0x3bc950){if(_0x3bc950){return _0x3bc950[_0xeaf2('0x1a')](_0x8f62af)[_0xeaf2('0x1b')](function(_0x1a6735){return _0x1a6735;});}return null;};}function removeEntity(_0xafabb,_0x411bc3){return function(_0x790aa9){if(_0x790aa9){return _0x790aa9[_0xeaf2('0x1c')]()[_0xeaf2('0x1b')](function(){_0xafabb[_0xeaf2('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb94b,_0x434d6f){return function(_0x3c1646){if(!_0x3c1646){_0x3fb94b[_0xeaf2('0x11')](0x194);}return _0x3c1646;};}function handleError(_0x223d24,_0x275901){_0x275901=_0x275901||0x1f4;return function(_0xcc32dc){logger['error'](_0xcc32dc[_0xeaf2('0x1d')]);if(_0xcc32dc[_0xeaf2('0x1e')]){delete _0xcc32dc[_0xeaf2('0x1e')];}_0x223d24[_0xeaf2('0x12')](_0x275901)['send'](_0xcc32dc);};}exports[_0xeaf2('0x1f')]=function(_0x298826,_0x1d2dc6){var _0x127d11={},_0xbf026f={},_0x18728b={'count':0x0,'rows':[]};var _0x42173d=db[_0xeaf2('0x20')][_0xeaf2('0x21')];_0xbf026f['model']=_[_0xeaf2('0x22')](_0x42173d);var _0x30b07f={'dateStart':_0x298826[_0xeaf2('0x23')]['dateStart'],'dateEnd':_0x298826['query'][_0xeaf2('0x24')]};delete _0x298826[_0xeaf2('0x23')][_0xeaf2('0x25')];delete _0x298826[_0xeaf2('0x23')][_0xeaf2('0x24')];_0xbf026f[_0xeaf2('0x23')]=_[_0xeaf2('0x22')](_0x298826[_0xeaf2('0x23')]);_0xbf026f['filters']=_[_0xeaf2('0x26')](_0xbf026f[_0xeaf2('0x27')],_0xbf026f[_0xeaf2('0x23')]);_0x127d11[_0xeaf2('0x28')]=_[_0xeaf2('0x26')](_0xbf026f[_0xeaf2('0x27')],qs[_0xeaf2('0x29')](_0x298826[_0xeaf2('0x23')][_0xeaf2('0x29')]));_0x127d11['attributes']=_0x127d11['attributes'][_0xeaf2('0x2a')]?_0x127d11[_0xeaf2('0x28')]:_0xbf026f[_0xeaf2('0x27')];if(!_0x298826['query'][_0xeaf2('0x2b')](_0xeaf2('0x2c'))){_0x127d11['limit']=qs['limit'](_0x298826[_0xeaf2('0x23')]['limit']);_0x127d11['offset']=qs[_0xeaf2('0x13')](_0x298826['query'][_0xeaf2('0x13')]);}_0x127d11[_0xeaf2('0x2d')]=qs[_0xeaf2('0x2e')](_0x298826[_0xeaf2('0x23')]['sort']);_0x127d11[_0xeaf2('0x2f')]=qs[_0xeaf2('0x30')](_[_0xeaf2('0x31')](_0x298826[_0xeaf2('0x23')],_0xbf026f['filters']));if(_0x30b07f[_0xeaf2('0x25')]){if(_0x30b07f[_0xeaf2('0x24')]){_0x30b07f[_0xeaf2('0x24')]=moment(_0x30b07f['dateEnd'])['add'](0x1,_0xeaf2('0x32'));}else{_0x30b07f[_0xeaf2('0x24')]=moment(_0x30b07f[_0xeaf2('0x25')])[_0xeaf2('0x33')](0x1,_0xeaf2('0x32'));}_[_0xeaf2('0x34')](_0x127d11[_0xeaf2('0x2f')],{'createdAt':{'$gte':_0x30b07f[_0xeaf2('0x25')],'$lte':_0x30b07f['dateEnd']}});}if(_0x298826[_0xeaf2('0x23')][_0xeaf2('0x35')]){_0x127d11[_0xeaf2('0x2f')]=_[_0xeaf2('0x34')](_0x127d11['where'],{'$or':_[_0xeaf2('0x36')](_0x127d11[_0xeaf2('0x28')],function(_0x1bf75e){var _0x55ce8a={};_0x55ce8a[_0x1bf75e]={'$like':'%'+_0x298826[_0xeaf2('0x23')][_0xeaf2('0x35')]+'%'};return _0x55ce8a;})});}_0x127d11=_[_0xeaf2('0x34')]({},_0x127d11,_0x298826[_0xeaf2('0x37')]);var _0x589456={'where':_0x127d11[_0xeaf2('0x2f')]};return db[_0xeaf2('0x20')]['count'](_0x589456)[_0xeaf2('0x1b')](function(_0x5e9372){_0x18728b['count']=_0x5e9372;if(_0x298826[_0xeaf2('0x23')]['includeAll']){_0x127d11[_0xeaf2('0x38')]=[{'all':!![]}];}return db[_0xeaf2('0x20')][_0xeaf2('0x39')](_0x127d11);})[_0xeaf2('0x1b')](function(_0xf21077){_0x18728b[_0xeaf2('0x3a')]=_0xf21077;return _0x18728b;})[_0xeaf2('0x1b')](respondWithFilteredResult(_0x1d2dc6,_0x127d11))[_0xeaf2('0x3b')](handleError(_0x1d2dc6,null));};exports[_0xeaf2('0x3c')]=function(_0x3f4bf1,_0x312ba6){var _0x4e17fe={'raw':!![],'where':{'id':_0x3f4bf1[_0xeaf2('0x3d')]['id']}},_0x16d128={};_0x16d128[_0xeaf2('0x27')]=_['keys'](db[_0xeaf2('0x20')][_0xeaf2('0x21')]);_0x16d128[_0xeaf2('0x23')]=_[_0xeaf2('0x22')](_0x3f4bf1[_0xeaf2('0x23')]);_0x16d128[_0xeaf2('0x30')]=_['intersection'](_0x16d128['model'],_0x16d128['query']);_0x4e17fe[_0xeaf2('0x28')]=_[_0xeaf2('0x26')](_0x16d128[_0xeaf2('0x27')],qs[_0xeaf2('0x29')](_0x3f4bf1[_0xeaf2('0x23')][_0xeaf2('0x29')]));_0x4e17fe[_0xeaf2('0x28')]=_0x4e17fe[_0xeaf2('0x28')][_0xeaf2('0x2a')]?_0x4e17fe[_0xeaf2('0x28')]:_0x16d128['model'];if(_0x3f4bf1[_0xeaf2('0x23')]['includeAll']){_0x4e17fe[_0xeaf2('0x38')]=[{'all':!![]}];}_0x4e17fe=_[_0xeaf2('0x34')]({},_0x4e17fe,_0x3f4bf1[_0xeaf2('0x37')]);return db[_0xeaf2('0x20')][_0xeaf2('0x3e')](_0x4e17fe)['then'](handleEntityNotFound(_0x312ba6,null))['then'](respondWithResult(_0x312ba6,null))['catch'](handleError(_0x312ba6,null));};exports[_0xeaf2('0x3f')]=function(_0xa82e79,_0x27424d){return db[_0xeaf2('0x20')][_0xeaf2('0x3f')](_0xa82e79[_0xeaf2('0x40')],{})[_0xeaf2('0x1b')](respondWithResult(_0x27424d,0xc9))[_0xeaf2('0x3b')](handleError(_0x27424d,null));};exports[_0xeaf2('0x1a')]=function(_0x52b7cf,_0x484b67){if(_0x52b7cf[_0xeaf2('0x40')]['id']){delete _0x52b7cf['body']['id'];}return db[_0xeaf2('0x20')][_0xeaf2('0x3e')]({'where':{'id':_0x52b7cf[_0xeaf2('0x3d')]['id']}})[_0xeaf2('0x1b')](handleEntityNotFound(_0x484b67,null))[_0xeaf2('0x1b')](saveUpdates(_0x52b7cf[_0xeaf2('0x40')],null))[_0xeaf2('0x1b')](respondWithResult(_0x484b67,null))[_0xeaf2('0x3b')](handleError(_0x484b67,null));};exports[_0xeaf2('0x1c')]=function(_0x2afc6f,_0x10a7dc){return db['SquareOdbc'][_0xeaf2('0x3e')]({'where':{'id':_0x2afc6f[_0xeaf2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x10a7dc,null))[_0xeaf2('0x1b')](removeEntity(_0x10a7dc,null))['catch'](handleError(_0x10a7dc,null));};exports[_0xeaf2('0x41')]=function(_0x3d4a9c,_0x517c96,_0x4e0fe4){var _0x267cf3;return db[_0xeaf2('0x20')][_0xeaf2('0x3e')]({'where':{'id':_0x3d4a9c[_0xeaf2('0x3d')]['id']},'attributes':['id',_0xeaf2('0x42')]})[_0xeaf2('0x1b')](handleEntityNotFound(_0x517c96,null))['then'](function(_0x4badd0){if(_0x4badd0){var _0x14471e=require(_0xeaf2('0x43'))();_0x14471e[_0xeaf2('0x44')](_0x4badd0[_0xeaf2('0x42')]);_0x14471e[_0xeaf2('0x45')]();return _0x4badd0;}})[_0xeaf2('0x1b')](respondWithResult(_0x517c96,null))[_0xeaf2('0x3b')](handleError(_0x517c96,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e67c26e..a47089a 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 _0x2dae=['moment','bluebird','request-promise','exports','define','square_odbc','lodash','../../config/logger','api'];(function(_0x4a0ee8,_0x47bc69){var _0x1e279f=function(_0xee58b4){while(--_0xee58b4){_0x4a0ee8['push'](_0x4a0ee8['shift']());}};_0x1e279f(++_0x47bc69);}(_0x2dae,0xc3));var _0xe2da=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x2dae[_0x622035];return _0x326cf2;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var attributes=require('./squareOdbc.attributes');module[_0xe2da('0x6')]=function(_0x439b5d,_0x77e45e){return _0x439b5d[_0xe2da('0x7')]('SquareOdbc',attributes,{'tableName':_0xe2da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c44=['../../config/logger','api','moment','bluebird','request-promise','./squareOdbc.attributes','SquareOdbc','square_odbc'];(function(_0x343947,_0x3bf7ee){var _0x576764=function(_0x1e5aec){while(--_0x1e5aec){_0x343947['push'](_0x343947['shift']());}};_0x576764(++_0x3bf7ee);}(_0x9c44,0x178));var _0x49c4=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x9c44[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var attributes=require(_0x49c4('0x5'));module['exports']=function(_0x4941f1,_0x41a183){return _0x4941f1['define'](_0x49c4('0x6'),attributes,{'tableName':_0x49c4('0x7'),'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 c82ed1a..16b3dec 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 _0xb11b=['options','raw','where','attributes','include','map','model','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','ShowSquareOdbc','find'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xb11b,0x69));var _0xbb11=function(_0x1c9219,_0x46a66b){_0x1c9219=_0x1c9219-0x0;var _0x112897=_0xb11b[_0x1c9219];return _0x112897;};'use strict';var _=require(_0xbb11('0x0'));var util=require(_0xbb11('0x1'));var moment=require(_0xbb11('0x2'));var BPromise=require(_0xbb11('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xbb11('0x4'))['db'];var utils=require(_0xbb11('0x5'));var logger=require(_0xbb11('0x6'))(_0xbb11('0x7'));var config=require(_0xbb11('0x8'));var jayson=require(_0xbb11('0x9'));var client=jayson['client'][_0xbb11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d33ee,_0x11feed,_0xb24665){return new BPromise(function(_0x4c3629,_0x54b88b){return client[_0xbb11('0xb')](_0x2d33ee,_0xb24665)[_0xbb11('0xc')](function(_0x5e8682){logger[_0xbb11('0xd')](_0xbb11('0xe'),_0x11feed,'request\x20sent');logger['debug'](_0xbb11('0xf'),_0x11feed,'request\x20sent',JSON['stringify'](_0x5e8682));if(_0x5e8682[_0xbb11('0x10')]){if(_0x5e8682['error'][_0xbb11('0x11')]===0x1f4){logger[_0xbb11('0x10')](_0xbb11('0xe'),_0x11feed,_0x5e8682['error'][_0xbb11('0x12')]);return _0x54b88b(_0x5e8682[_0xbb11('0x10')]['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x11feed,_0x5e8682[_0xbb11('0x10')][_0xbb11('0x12')]);return _0x4c3629(_0x5e8682[_0xbb11('0x10')]['message']);}else{logger[_0xbb11('0xd')](_0xbb11('0xe'),_0x11feed,_0xbb11('0x13'));_0x4c3629(_0x5e8682['result'][_0xbb11('0x12')]);}})[_0xbb11('0x14')](function(_0x18f35e){logger[_0xbb11('0x10')]('SquareOdbc,\x20%s,\x20%s',_0x11feed,_0x18f35e);_0x54b88b(_0x18f35e);});});}exports[_0xbb11('0x15')]=function(_0x5f0733){var _0x250bd4=this;return new Promise(function(_0x4b62a5,_0x4eeb79){return db['SquareOdbc'][_0xbb11('0x16')]({'raw':_0x5f0733[_0xbb11('0x17')]?_0x5f0733['options'][_0xbb11('0x18')]===undefined?!![]:![]:!![],'where':_0x5f0733['options']?_0x5f0733['options'][_0xbb11('0x19')]||null:null,'attributes':_0x5f0733['options']?_0x5f0733[_0xbb11('0x17')][_0xbb11('0x1a')]||null:null,'include':_0x5f0733[_0xbb11('0x17')]?_0x5f0733[_0xbb11('0x17')][_0xbb11('0x1b')]?_[_0xbb11('0x1c')](_0x5f0733[_0xbb11('0x17')][_0xbb11('0x1b')],function(_0x96a296){return{'model':db[_0x96a296[_0xbb11('0x1d')]],'as':_0x96a296['as'],'attributes':_0x96a296['attributes'],'include':_0x96a296[_0xbb11('0x1b')]?_[_0xbb11('0x1c')](_0x96a296[_0xbb11('0x1b')],function(_0x2596cf){return{'model':db[_0x2596cf[_0xbb11('0x1d')]],'as':_0x2596cf['as'],'attributes':_0x2596cf[_0xbb11('0x1a')],'include':_0x2596cf['include']?_[_0xbb11('0x1c')](_0x2596cf[_0xbb11('0x1b')],function(_0x572f8e){return{'model':db[_0x572f8e[_0xbb11('0x1d')]],'as':_0x572f8e['as'],'attributes':_0x572f8e[_0xbb11('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbb11('0xc')](function(_0x270319){logger[_0xbb11('0xd')](_0xbb11('0x15'),_0x5f0733);logger[_0xbb11('0x1e')]('ShowSquareOdbc',_0x5f0733,JSON[_0xbb11('0x1f')](_0x270319));_0x4b62a5(_0x270319);})[_0xbb11('0x14')](function(_0x306535){logger[_0xbb11('0x10')](_0xbb11('0x15'),_0x306535['message'],_0x5f0733);_0x4eeb79(_0x250bd4[_0xbb11('0x10')](0x1f4,_0x306535[_0xbb11('0x12')]));});});}; \ No newline at end of file +var _0xe070=['where','attributes','include','map','model','ShowSquareOdbc','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','SquareOdbc','find','options'];(function(_0x301efe,_0x338d14){var _0x5d44c3=function(_0x10a315){while(--_0x10a315){_0x301efe['push'](_0x301efe['shift']());}};_0x5d44c3(++_0x338d14);}(_0xe070,0x1c6));var _0x0e07=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0xe070[_0x21e71a];return _0x174f46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0e07('0x0'));var BPromise=require(_0x0e07('0x1'));var rs=require(_0x0e07('0x2'));var fs=require('fs');var db=require(_0x0e07('0x3'))['db'];var utils=require(_0x0e07('0x4'));var logger=require(_0x0e07('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0e07('0x6')][_0x0e07('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3041a8,_0xe53a36,_0x21307b){return new BPromise(function(_0x55e25c,_0x1fe45d){return client['request'](_0x3041a8,_0x21307b)[_0x0e07('0x8')](function(_0x930956){logger[_0x0e07('0x9')]('SquareOdbc,\x20%s,\x20%s',_0xe53a36,_0x0e07('0xa'));logger[_0x0e07('0xb')](_0x0e07('0xc'),_0xe53a36,'request\x20sent',JSON[_0x0e07('0xd')](_0x930956));if(_0x930956[_0x0e07('0xe')]){if(_0x930956[_0x0e07('0xe')][_0x0e07('0xf')]===0x1f4){logger[_0x0e07('0xe')](_0x0e07('0x10'),_0xe53a36,_0x930956['error'][_0x0e07('0x11')]);return _0x1fe45d(_0x930956[_0x0e07('0xe')][_0x0e07('0x11')]);}logger[_0x0e07('0xe')](_0x0e07('0x10'),_0xe53a36,_0x930956['error'][_0x0e07('0x11')]);return _0x55e25c(_0x930956[_0x0e07('0xe')][_0x0e07('0x11')]);}else{logger[_0x0e07('0x9')](_0x0e07('0x10'),_0xe53a36,_0x0e07('0xa'));_0x55e25c(_0x930956['result'][_0x0e07('0x11')]);}})[_0x0e07('0x12')](function(_0x275e16){logger['error']('SquareOdbc,\x20%s,\x20%s',_0xe53a36,_0x275e16);_0x1fe45d(_0x275e16);});});}exports['ShowSquareOdbc']=function(_0x36d25f){var _0x4bb754=this;return new Promise(function(_0x11e2e4,_0x1b699f){return db[_0x0e07('0x13')][_0x0e07('0x14')]({'raw':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x16')]||null:null,'attributes':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x17')]||null:null,'include':_0x36d25f[_0x0e07('0x15')]?_0x36d25f[_0x0e07('0x15')][_0x0e07('0x18')]?_[_0x0e07('0x19')](_0x36d25f[_0x0e07('0x15')][_0x0e07('0x18')],function(_0x5e46d4){return{'model':db[_0x5e46d4[_0x0e07('0x1a')]],'as':_0x5e46d4['as'],'attributes':_0x5e46d4[_0x0e07('0x17')],'include':_0x5e46d4[_0x0e07('0x18')]?_[_0x0e07('0x19')](_0x5e46d4['include'],function(_0x444550){return{'model':db[_0x444550['model']],'as':_0x444550['as'],'attributes':_0x444550['attributes'],'include':_0x444550[_0x0e07('0x18')]?_['map'](_0x444550[_0x0e07('0x18')],function(_0x247226){return{'model':db[_0x247226['model']],'as':_0x247226['as'],'attributes':_0x247226[_0x0e07('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47738e){logger[_0x0e07('0x9')](_0x0e07('0x1b'),_0x36d25f);logger[_0x0e07('0xb')](_0x0e07('0x1b'),_0x36d25f,JSON[_0x0e07('0xd')](_0x47738e));_0x11e2e4(_0x47738e);})[_0x0e07('0x12')](function(_0x2c57c7){logger[_0x0e07('0xe')](_0x0e07('0x1b'),_0x2c57c7[_0x0e07('0x11')],_0x36d25f);_0x1b699f(_0x4bb754[_0x0e07('0xe')](0x1f4,_0x2c57c7[_0x0e07('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index f5a1e84..2c319fa 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 _0x1afe=['index','get','getUsers','post','addUsers','put','/:id','update','delete','removeUsers','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x1afe,0xa3));var _0xe1af=function(_0x42b397,_0x12bc3f){_0x42b397=_0x42b397-0x0;var _0x4aeeec=_0x1afe[_0x42b397];return _0x4aeeec;};'use strict';var multer=require(_0xe1af('0x0'));var util=require(_0xe1af('0x1'));var path=require('path');var express=require(_0xe1af('0x2'));var router=express[_0xe1af('0x3')]();var auth=require(_0xe1af('0x4'));var interaction=require(_0xe1af('0x5'));var config=require(_0xe1af('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xe1af('0x7')](),controller[_0xe1af('0x8')]);router[_0xe1af('0x9')]('/:id',auth[_0xe1af('0x7')](),controller['show']);router[_0xe1af('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xe1af('0xa')]);router[_0xe1af('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe1af('0xb')]('/:id/users',auth[_0xe1af('0x7')](),controller[_0xe1af('0xc')]);router[_0xe1af('0xd')](_0xe1af('0xe'),auth['isAuthenticated'](),controller[_0xe1af('0xf')]);router[_0xe1af('0x10')](_0xe1af('0xe'),auth[_0xe1af('0x7')](),controller['destroy']);router[_0xe1af('0x10')]('/:id/users',auth[_0xe1af('0x7')](),controller[_0xe1af('0x11')]);module[_0xe1af('0x12')]=router; \ No newline at end of file +var _0x5caf=['util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','/:id','get','/:id/users','isAuthenticated','getUsers','create','post','addUsers','put','update','delete','removeUsers','exports','multer'];(function(_0x3c8bc1,_0x237ad4){var _0x22b568=function(_0x3a6f46){while(--_0x3a6f46){_0x3c8bc1['push'](_0x3c8bc1['shift']());}};_0x22b568(++_0x237ad4);}(_0x5caf,0x149));var _0xf5ca=function(_0x519936,_0x2e5fdb){_0x519936=_0x519936-0x0;var _0x31ff2a=_0x5caf[_0x519936];return _0x31ff2a;};'use strict';var multer=require(_0xf5ca('0x0'));var util=require(_0xf5ca('0x1'));var path=require(_0xf5ca('0x2'));var express=require('express');var router=express[_0xf5ca('0x3')]();var auth=require(_0xf5ca('0x4'));var interaction=require(_0xf5ca('0x5'));var config=require(_0xf5ca('0x6'));var controller=require(_0xf5ca('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf5ca('0x8')]);router['get'](_0xf5ca('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xf5ca('0xa')](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0xd')]);router['post']('/',auth[_0xf5ca('0xc')](),controller[_0xf5ca('0xe')]);router[_0xf5ca('0xf')](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x10')]);router[_0xf5ca('0x11')](_0xf5ca('0x9'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x12')]);router[_0xf5ca('0x13')]('/:id',auth[_0xf5ca('0xc')](),controller['destroy']);router['delete'](_0xf5ca('0xb'),auth[_0xf5ca('0xc')](),controller[_0xf5ca('0x14')]);module[_0xf5ca('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 b6407a2..36f9434 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 _0xd86a=['toString','production','utf8','sequelize','exports','STRING','TEXT','BLOB','preproduction','getDataValue'];(function(_0x26c559,_0x472eee){var _0x7f6b67=function(_0x4fae62){while(--_0x4fae62){_0x26c559['push'](_0x26c559['shift']());}};_0x7f6b67(++_0x472eee);}(_0xd86a,0xf3));var _0xad86=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0xd86a[_0x55c00d];return _0x254a8f;};'use strict';var Sequelize=require(_0xad86('0x0'));module[_0xad86('0x1')]={'name':{'type':Sequelize[_0xad86('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xad86('0x3')]},'preproduction':{'type':Sequelize[_0xad86('0x4')]('long'),'get':function(){if(this['getDataValue'](_0xad86('0x5'))){return this[_0xad86('0x6')](_0xad86('0x5'))[_0xad86('0x7')]('utf8');}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xad86('0x6')](_0xad86('0x8'))){return this[_0xad86('0x6')](_0xad86('0x8'))[_0xad86('0x7')](_0xad86('0x9'));}}}}; \ No newline at end of file +var _0x176c=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','sequelize','exports','STRING','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x176c,0x134));var _0xc176=function(_0x28015a,_0x294621){_0x28015a=_0x28015a-0x0;var _0x57d888=_0x176c[_0x28015a];return _0x57d888;};'use strict';var Sequelize=require(_0xc176('0x0'));module[_0xc176('0x1')]={'name':{'type':Sequelize[_0xc176('0x2')],'unique':_0xc176('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xc176('0x2')]},'notes':{'type':Sequelize[_0xc176('0x4')]},'preproduction':{'type':Sequelize[_0xc176('0x5')]('long'),'get':function(){if(this[_0xc176('0x6')](_0xc176('0x7'))){return this['getDataValue'](_0xc176('0x7'))[_0xc176('0x8')](_0xc176('0x9'));}}},'production':{'type':Sequelize['BLOB'](_0xc176('0xa')),'get':function(){if(this[_0xc176('0x6')](_0xc176('0xb'))){return this[_0xc176('0x6')](_0xc176('0xb'))['toString'](_0xc176('0x9'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 7ed2874..9087b41 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 _0x2184=['offset','limit','set','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','add','day','merge','where','filter','map','options','SquareProject','includeAll','rows','catch','show','params','include','find','create','body','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','nolimit','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./squareProject.socket','sendStatus','status','end','json','count'];(function(_0x4da034,_0x38249c){var _0x6238bf=function(_0x290feb){while(--_0x290feb){_0x4da034['push'](_0x4da034['shift']());}};_0x6238bf(++_0x38249c);}(_0x2184,0x84));var _0x4218=function(_0x2cc62d,_0x574039){_0x2cc62d=_0x2cc62d-0x0;var _0x38d94c=_0x2184[_0x2cc62d];return _0x38d94c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x4218('0x0'));var moment=require(_0x4218('0x1'));var BPromise=require(_0x4218('0x2'));var Mustache=require(_0x4218('0x3'));var util=require(_0x4218('0x4'));var path=require(_0x4218('0x5'));var sox=require(_0x4218('0x6'));var csv=require(_0x4218('0x7'));var ejs=require(_0x4218('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4218('0x9'));var crypto=require('crypto');var jsforce=require(_0x4218('0xa'));var deskjs=require(_0x4218('0xb'));var toCsv=require(_0x4218('0x7'));var querystring=require(_0x4218('0xc'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0x4218('0xd'));var config=require(_0x4218('0xe'));var db=require(_0x4218('0xf'))['db'];var socket=require(_0x4218('0x10'))({'host':_0x4218('0x11'),'port':0x18eb});require(_0x4218('0x12'))['register'](socket);function respondWithStatusCode(_0x49d371,_0x46deb7){_0x46deb7=_0x46deb7||0xcc;return function(_0x49121e){if(_0x49121e){return _0x49d371[_0x4218('0x13')](_0x46deb7);}return _0x49d371[_0x4218('0x14')](_0x46deb7)[_0x4218('0x15')]();};}function respondWithResult(_0x57715f,_0x4adb1c){_0x4adb1c=_0x4adb1c||0xc8;return function(_0x3111aa){if(_0x3111aa){return _0x57715f[_0x4218('0x14')](_0x4adb1c)[_0x4218('0x16')](_0x3111aa);}};}function respondWithFilteredResult(_0x412196,_0x4c9f50){return function(_0x234094){if(_0x234094){var _0x2623e5=_0x234094[_0x4218('0x17')],_0x3ad2cd=_0x4c9f50[_0x4218('0x18')],_0x56d889=_0x4c9f50[_0x4218('0x18')]+_0x4c9f50[_0x4218('0x19')],_0x5b3ff5;if(_0x56d889>=_0x2623e5){_0x56d889=_0x2623e5;_0x5b3ff5=0xc8;}else{_0x5b3ff5=0xce;}_0x412196[_0x4218('0x14')](_0x5b3ff5);return _0x412196[_0x4218('0x1a')]('Content-Range',_0x3ad2cd+'-'+_0x56d889+'/'+_0x2623e5)[_0x4218('0x16')](_0x234094);}return null;};}function patchUpdates(_0x42b049){return function(_0x378141){try{jsonpatch['apply'](_0x378141,_0x42b049,!![]);}catch(_0xc30267){return BPromise[_0x4218('0x1b')](_0xc30267);}return _0x378141[_0x4218('0x1c')]();};}function saveUpdates(_0x3ecb00,_0x249d2a){return function(_0x5addb0){if(_0x5addb0){return _0x5addb0['update'](_0x3ecb00)[_0x4218('0x1d')](function(_0xe52a9a){return _0xe52a9a;});}return null;};}function removeEntity(_0x361b0c,_0x4a7edb){return function(_0x15c6e4){if(_0x15c6e4){return _0x15c6e4[_0x4218('0x1e')]()[_0x4218('0x1d')](function(){_0x361b0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7fdf55,_0x25e053){return function(_0x55b248){if(!_0x55b248){_0x7fdf55['sendStatus'](0x194);}return _0x55b248;};}function handleError(_0xdafecd,_0x2f74a6){_0x2f74a6=_0x2f74a6||0x1f4;return function(_0x5177c5){logger[_0x4218('0x1f')](_0x5177c5[_0x4218('0x20')]);if(_0x5177c5[_0x4218('0x21')]){delete _0x5177c5['name'];}_0xdafecd[_0x4218('0x14')](_0x2f74a6)[_0x4218('0x22')](_0x5177c5);};}exports[_0x4218('0x23')]=function(_0x594f80,_0x2f13bc){var _0x555c26={},_0x502119={},_0x1adacc={'count':0x0,'rows':[]};var _0x324bdc=db['SquareProject'][_0x4218('0x24')];_0x502119[_0x4218('0x25')]=_[_0x4218('0x26')](_0x324bdc);var _0x1190b0={'dateStart':_0x594f80[_0x4218('0x27')]['dateStart'],'dateEnd':_0x594f80['query'][_0x4218('0x28')]};delete _0x594f80[_0x4218('0x27')][_0x4218('0x29')];delete _0x594f80[_0x4218('0x27')][_0x4218('0x28')];_0x502119[_0x4218('0x27')]=_[_0x4218('0x26')](_0x594f80['query']);_0x502119[_0x4218('0x2a')]=_[_0x4218('0x2b')](_0x502119['model'],_0x502119['query']);_0x555c26[_0x4218('0x2c')]=_[_0x4218('0x2b')](_0x502119['model'],qs[_0x4218('0x2d')](_0x594f80[_0x4218('0x27')][_0x4218('0x2d')]));_0x555c26['attributes']=_0x555c26['attributes'][_0x4218('0x2e')]?_0x555c26[_0x4218('0x2c')]:_0x502119['model'];if(!_0x594f80[_0x4218('0x27')][_0x4218('0x2f')]('nolimit')){_0x555c26['limit']=qs[_0x4218('0x19')](_0x594f80[_0x4218('0x27')][_0x4218('0x19')]);_0x555c26['offset']=qs[_0x4218('0x18')](_0x594f80[_0x4218('0x27')][_0x4218('0x18')]);}_0x555c26[_0x4218('0x30')]=qs[_0x4218('0x31')](_0x594f80[_0x4218('0x27')][_0x4218('0x31')]);_0x555c26['where']=qs[_0x4218('0x2a')](_[_0x4218('0x32')](_0x594f80[_0x4218('0x27')],_0x502119[_0x4218('0x2a')]));if(_0x1190b0['dateStart']){if(_0x1190b0[_0x4218('0x28')]){_0x1190b0[_0x4218('0x28')]=moment(_0x1190b0[_0x4218('0x28')])[_0x4218('0x33')](0x1,_0x4218('0x34'));}else{_0x1190b0[_0x4218('0x28')]=moment(_0x1190b0[_0x4218('0x29')])['add'](0x1,_0x4218('0x34'));}_[_0x4218('0x35')](_0x555c26[_0x4218('0x36')],{'createdAt':{'$gte':_0x1190b0['dateStart'],'$lte':_0x1190b0[_0x4218('0x28')]}});}if(_0x594f80[_0x4218('0x27')][_0x4218('0x37')]){_0x555c26[_0x4218('0x36')]=_['merge'](_0x555c26[_0x4218('0x36')],{'$or':_[_0x4218('0x38')](_0x555c26['attributes'],function(_0x152145){var _0x300c55={};_0x300c55[_0x152145]={'$like':'%'+_0x594f80[_0x4218('0x27')]['filter']+'%'};return _0x300c55;})});}_0x555c26=_['merge']({},_0x555c26,_0x594f80[_0x4218('0x39')]);var _0x388adf={'where':_0x555c26[_0x4218('0x36')]};return db[_0x4218('0x3a')][_0x4218('0x17')](_0x388adf)[_0x4218('0x1d')](function(_0x1d200f){_0x1adacc[_0x4218('0x17')]=_0x1d200f;if(_0x594f80[_0x4218('0x27')][_0x4218('0x3b')]){_0x555c26['include']=[{'all':!![]}];}return db[_0x4218('0x3a')]['findAll'](_0x555c26);})[_0x4218('0x1d')](function(_0x318417){_0x1adacc[_0x4218('0x3c')]=_0x318417;return _0x1adacc;})[_0x4218('0x1d')](respondWithFilteredResult(_0x2f13bc,_0x555c26))[_0x4218('0x3d')](handleError(_0x2f13bc,null));};exports[_0x4218('0x3e')]=function(_0x41363a,_0x20a4a6){var _0x30f4fb={'raw':![],'where':{'id':_0x41363a[_0x4218('0x3f')]['id']}},_0x18f463={};_0x18f463[_0x4218('0x25')]=_[_0x4218('0x26')](db['SquareProject']['rawAttributes']);_0x18f463[_0x4218('0x27')]=_[_0x4218('0x26')](_0x41363a[_0x4218('0x27')]);_0x18f463[_0x4218('0x2a')]=_['intersection'](_0x18f463[_0x4218('0x25')],_0x18f463[_0x4218('0x27')]);_0x30f4fb[_0x4218('0x2c')]=_[_0x4218('0x2b')](_0x18f463['model'],qs[_0x4218('0x2d')](_0x41363a[_0x4218('0x27')][_0x4218('0x2d')]));_0x30f4fb[_0x4218('0x2c')]=_0x30f4fb[_0x4218('0x2c')][_0x4218('0x2e')]?_0x30f4fb['attributes']:_0x18f463[_0x4218('0x25')];if(_0x41363a['query'][_0x4218('0x3b')]){_0x30f4fb[_0x4218('0x40')]=[{'all':!![]}];}_0x30f4fb=_[_0x4218('0x35')]({},_0x30f4fb,_0x41363a[_0x4218('0x39')]);return db[_0x4218('0x3a')][_0x4218('0x41')](_0x30f4fb)[_0x4218('0x1d')](handleEntityNotFound(_0x20a4a6,null))[_0x4218('0x1d')](respondWithResult(_0x20a4a6,null))[_0x4218('0x3d')](handleError(_0x20a4a6,null));};exports[_0x4218('0x42')]=function(_0x81a12c,_0x4d2107){return db[_0x4218('0x3a')]['create'](_0x81a12c['body'],{})[_0x4218('0x1d')](respondWithResult(_0x4d2107,0xc9))[_0x4218('0x3d')](handleError(_0x4d2107,null));};exports['update']=function(_0x53317b,_0x387206){if(_0x53317b[_0x4218('0x43')]['id']){delete _0x53317b['body']['id'];}return db['SquareProject'][_0x4218('0x41')]({'where':{'id':_0x53317b[_0x4218('0x3f')]['id']}})[_0x4218('0x1d')](handleEntityNotFound(_0x387206,null))[_0x4218('0x1d')](saveUpdates(_0x53317b[_0x4218('0x43')],null))['then'](respondWithResult(_0x387206,null))[_0x4218('0x3d')](handleError(_0x387206,null));};exports[_0x4218('0x1e')]=function(_0x3d1a38,_0x223f42){return db['SquareProject'][_0x4218('0x41')]({'where':{'id':_0x3d1a38[_0x4218('0x3f')]['id']}})[_0x4218('0x1d')](handleEntityNotFound(_0x223f42,null))['then'](removeEntity(_0x223f42,null))[_0x4218('0x3d')](handleError(_0x223f42,null));};exports[_0x4218('0x44')]=function(_0x430b83,_0x48bc9f,_0x4b2f46){return db[_0x4218('0x3a')]['find']({'where':{'id':_0x430b83[_0x4218('0x3f')]['id']}})[_0x4218('0x1d')](handleEntityNotFound(_0x48bc9f,null))[_0x4218('0x1d')](function(_0x1d2a10){if(_0x1d2a10){return _0x1d2a10[_0x4218('0x44')](_0x430b83[_0x4218('0x43')][_0x4218('0x45')],_['omit'](_0x430b83[_0x4218('0x43')],[_0x4218('0x45'),'id'])||{});}})[_0x4218('0x1d')](respondWithResult(_0x48bc9f,null))[_0x4218('0x3d')](handleError(_0x48bc9f,null));};exports[_0x4218('0x46')]=function(_0x185dc7,_0x1048b5,_0x49e6bc){var _0x2ca5d5;return db[_0x4218('0x3a')]['find']({'where':{'id':_0x185dc7[_0x4218('0x3f')]['id']}})[_0x4218('0x1d')](handleEntityNotFound(_0x1048b5,null))[_0x4218('0x1d')](function(_0x162d59){if(_0x162d59){return _0x162d59[_0x4218('0x46')](_0x185dc7[_0x4218('0x27')]['ids'])[_0x4218('0x1d')](function(_0x428716){if(_[_0x4218('0x47')](_0x185dc7[_0x4218('0x27')]['ids'])){for(var _0x4221fb=0x0;_0x4221fb<_0x185dc7[_0x4218('0x27')]['ids']['length'];_0x4221fb+=0x1){socket[_0x4218('0x48')](_0x4218('0x49'),{'UserId':_0x185dc7['query'][_0x4218('0x45')][_0x4221fb],'SquareProjectId':_0x185dc7['params']['id']});}}else{socket[_0x4218('0x48')](_0x4218('0x49'),{'UserId':_0x185dc7['query']['ids'],'SquareProjectId':_0x185dc7[_0x4218('0x3f')]['id']});}});}})['then'](respondWithStatusCode(_0x1048b5,null))[_0x4218('0x3d')](handleError(_0x1048b5,null));};exports[_0x4218('0x4a')]=function(_0x2792c8,_0x3616cb,_0x47a0ca){var _0x5a4cf9={};var _0x426189={};var _0x223aad;var _0x142438;return db['SquareProject'][_0x4218('0x4b')]({'where':{'id':_0x2792c8[_0x4218('0x3f')]['id']}})[_0x4218('0x1d')](handleEntityNotFound(_0x3616cb,null))[_0x4218('0x1d')](function(_0x14c490){if(_0x14c490){_0x223aad=_0x14c490;_0x426189[_0x4218('0x25')]=_[_0x4218('0x26')](db[_0x4218('0x4c')][_0x4218('0x24')]);_0x426189['query']=_['keys'](_0x2792c8[_0x4218('0x27')]);_0x426189[_0x4218('0x2a')]=_['intersection'](_0x426189[_0x4218('0x25')],_0x426189[_0x4218('0x27')]);_0x5a4cf9[_0x4218('0x2c')]=_[_0x4218('0x2b')](_0x426189[_0x4218('0x25')],qs[_0x4218('0x2d')](_0x2792c8[_0x4218('0x27')][_0x4218('0x2d')]));_0x5a4cf9[_0x4218('0x2c')]=_0x5a4cf9[_0x4218('0x2c')]['length']?_0x5a4cf9['attributes']:_0x426189[_0x4218('0x25')];_0x5a4cf9[_0x4218('0x30')]=qs['sort'](_0x2792c8['query'][_0x4218('0x31')]);_0x5a4cf9[_0x4218('0x36')]=qs[_0x4218('0x2a')](_[_0x4218('0x32')](_0x2792c8['query'],_0x426189[_0x4218('0x2a')]));if(_0x2792c8[_0x4218('0x27')][_0x4218('0x37')]){_0x5a4cf9['where']=_[_0x4218('0x35')](_0x5a4cf9['where'],{'$or':_[_0x4218('0x38')](_0x5a4cf9[_0x4218('0x2c')],function(_0x28526b){var _0x2643ae={};_0x2643ae[_0x28526b]={'$like':'%'+_0x2792c8[_0x4218('0x27')][_0x4218('0x37')]+'%'};return _0x2643ae;})});}_0x5a4cf9=_[_0x4218('0x35')]({},_0x5a4cf9,_0x2792c8[_0x4218('0x39')]);return _0x223aad[_0x4218('0x4a')](_0x5a4cf9);}})[_0x4218('0x1d')](function(_0x314b6f){if(_0x314b6f){_0x142438=_0x314b6f[_0x4218('0x2e')];if(!_0x2792c8[_0x4218('0x27')][_0x4218('0x2f')](_0x4218('0x4d'))){_0x5a4cf9['limit']=qs[_0x4218('0x19')](_0x2792c8[_0x4218('0x27')][_0x4218('0x19')]);_0x5a4cf9[_0x4218('0x18')]=qs[_0x4218('0x18')](_0x2792c8[_0x4218('0x27')][_0x4218('0x18')]);}return _0x223aad[_0x4218('0x4a')](_0x5a4cf9);}})[_0x4218('0x1d')](function(_0x1191e6){if(_0x1191e6){return _0x1191e6?{'count':_0x142438,'rows':_0x1191e6}:null;}})[_0x4218('0x1d')](respondWithResult(_0x3616cb,null))[_0x4218('0x3d')](handleError(_0x3616cb,null));}; \ No newline at end of file +var _0x650d=['emit','getUsers','findOne','User','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./squareProject.socket','register','sendStatus','end','json','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareProject','rawAttributes','keys','dateEnd','query','dateStart','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','pick','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','addUsers','ids','removeUsers','isArray'];(function(_0x284e95,_0xede207){var _0x5cefd5=function(_0x5a5801){while(--_0x5a5801){_0x284e95['push'](_0x284e95['shift']());}};_0x5cefd5(++_0xede207);}(_0x650d,0xfd));var _0xd650=function(_0x4fae14,_0x4ef118){_0x4fae14=_0x4fae14-0x0;var _0x305e46=_0x650d[_0x4fae14];return _0x305e46;};'use strict';var jsonpatch=require(_0xd650('0x0'));var rp=require(_0xd650('0x1'));var moment=require(_0xd650('0x2'));var BPromise=require(_0xd650('0x3'));var Mustache=require(_0xd650('0x4'));var util=require(_0xd650('0x5'));var path=require(_0xd650('0x6'));var sox=require(_0xd650('0x7'));var csv=require('to-csv');var ejs=require(_0xd650('0x8'));var fs=require('fs');var _=require(_0xd650('0x9'));var squel=require(_0xd650('0xa'));var crypto=require(_0xd650('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd650('0xc'));var toCsv=require(_0xd650('0xd'));var querystring=require(_0xd650('0xe'));var Papa=require('papaparse');var qs=require(_0xd650('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xd650('0x10'));var config=require(_0xd650('0x11'));var db=require(_0xd650('0x12'))['db'];var socket=require(_0xd650('0x13'))({'host':'localhost','port':0x18eb});require(_0xd650('0x14'))[_0xd650('0x15')](socket);function respondWithStatusCode(_0x59ba2b,_0x5d61e2){_0x5d61e2=_0x5d61e2||0xcc;return function(_0x3d8d51){if(_0x3d8d51){return _0x59ba2b[_0xd650('0x16')](_0x5d61e2);}return _0x59ba2b['status'](_0x5d61e2)[_0xd650('0x17')]();};}function respondWithResult(_0x510d8e,_0x20c1b1){_0x20c1b1=_0x20c1b1||0xc8;return function(_0x4db392){if(_0x4db392){return _0x510d8e['status'](_0x20c1b1)[_0xd650('0x18')](_0x4db392);}};}function respondWithFilteredResult(_0x3e4b67,_0x124b0b){return function(_0x199739){if(_0x199739){var _0x57e82c=_0x199739[_0xd650('0x19')],_0x2638e1=_0x124b0b[_0xd650('0x1a')],_0x30c897=_0x124b0b[_0xd650('0x1a')]+_0x124b0b['limit'],_0x2407f1;if(_0x30c897>=_0x57e82c){_0x30c897=_0x57e82c;_0x2407f1=0xc8;}else{_0x2407f1=0xce;}_0x3e4b67[_0xd650('0x1b')](_0x2407f1);return _0x3e4b67[_0xd650('0x1c')](_0xd650('0x1d'),_0x2638e1+'-'+_0x30c897+'/'+_0x57e82c)[_0xd650('0x18')](_0x199739);}return null;};}function patchUpdates(_0x178d4c){return function(_0x33990d){try{jsonpatch[_0xd650('0x1e')](_0x33990d,_0x178d4c,!![]);}catch(_0x50db6e){return BPromise[_0xd650('0x1f')](_0x50db6e);}return _0x33990d[_0xd650('0x20')]();};}function saveUpdates(_0x4689e0,_0x838c68){return function(_0x27d25c){if(_0x27d25c){return _0x27d25c[_0xd650('0x21')](_0x4689e0)[_0xd650('0x22')](function(_0x2b2c6d){return _0x2b2c6d;});}return null;};}function removeEntity(_0x789aaa,_0x455432){return function(_0x42ae56){if(_0x42ae56){return _0x42ae56[_0xd650('0x23')]()[_0xd650('0x22')](function(){_0x789aaa[_0xd650('0x1b')](0xcc)[_0xd650('0x17')]();});}};}function handleEntityNotFound(_0x2d64b3,_0x484b8e){return function(_0x259330){if(!_0x259330){_0x2d64b3[_0xd650('0x16')](0x194);}return _0x259330;};}function handleError(_0x2ddea3,_0x5702af){_0x5702af=_0x5702af||0x1f4;return function(_0x2d9b7e){logger[_0xd650('0x24')](_0x2d9b7e[_0xd650('0x25')]);if(_0x2d9b7e[_0xd650('0x26')]){delete _0x2d9b7e['name'];}_0x2ddea3[_0xd650('0x1b')](_0x5702af)[_0xd650('0x27')](_0x2d9b7e);};}exports[_0xd650('0x28')]=function(_0x2f9593,_0x4e392b){var _0x3c5730={},_0x45e9f9={},_0x1a4c5d={'count':0x0,'rows':[]};var _0x27bd3b=db[_0xd650('0x29')][_0xd650('0x2a')];_0x45e9f9['model']=_[_0xd650('0x2b')](_0x27bd3b);var _0x76f198={'dateStart':_0x2f9593['query']['dateStart'],'dateEnd':_0x2f9593['query'][_0xd650('0x2c')]};delete _0x2f9593[_0xd650('0x2d')][_0xd650('0x2e')];delete _0x2f9593[_0xd650('0x2d')][_0xd650('0x2c')];_0x45e9f9[_0xd650('0x2d')]=_[_0xd650('0x2b')](_0x2f9593[_0xd650('0x2d')]);_0x45e9f9[_0xd650('0x2f')]=_[_0xd650('0x30')](_0x45e9f9[_0xd650('0x31')],_0x45e9f9[_0xd650('0x2d')]);_0x3c5730['attributes']=_[_0xd650('0x30')](_0x45e9f9[_0xd650('0x31')],qs[_0xd650('0x32')](_0x2f9593['query'][_0xd650('0x32')]));_0x3c5730[_0xd650('0x33')]=_0x3c5730['attributes'][_0xd650('0x34')]?_0x3c5730[_0xd650('0x33')]:_0x45e9f9[_0xd650('0x31')];if(!_0x2f9593[_0xd650('0x2d')][_0xd650('0x35')]('nolimit')){_0x3c5730[_0xd650('0x36')]=qs['limit'](_0x2f9593['query'][_0xd650('0x36')]);_0x3c5730[_0xd650('0x1a')]=qs[_0xd650('0x1a')](_0x2f9593[_0xd650('0x2d')]['offset']);}_0x3c5730[_0xd650('0x37')]=qs['sort'](_0x2f9593[_0xd650('0x2d')][_0xd650('0x38')]);_0x3c5730['where']=qs[_0xd650('0x2f')](_[_0xd650('0x39')](_0x2f9593[_0xd650('0x2d')],_0x45e9f9['filters']));if(_0x76f198['dateStart']){if(_0x76f198[_0xd650('0x2c')]){_0x76f198[_0xd650('0x2c')]=moment(_0x76f198['dateEnd'])[_0xd650('0x3a')](0x1,_0xd650('0x3b'));}else{_0x76f198[_0xd650('0x2c')]=moment(_0x76f198['dateStart'])['add'](0x1,_0xd650('0x3b'));}_[_0xd650('0x3c')](_0x3c5730['where'],{'createdAt':{'$gte':_0x76f198['dateStart'],'$lte':_0x76f198[_0xd650('0x2c')]}});}if(_0x2f9593[_0xd650('0x2d')][_0xd650('0x3d')]){_0x3c5730[_0xd650('0x3e')]=_['merge'](_0x3c5730['where'],{'$or':_[_0xd650('0x3f')](_0x3c5730[_0xd650('0x33')],function(_0xbbdb2e){var _0x257e2a={};_0x257e2a[_0xbbdb2e]={'$like':'%'+_0x2f9593[_0xd650('0x2d')][_0xd650('0x3d')]+'%'};return _0x257e2a;})});}_0x3c5730=_[_0xd650('0x3c')]({},_0x3c5730,_0x2f9593[_0xd650('0x40')]);var _0x1b749b={'where':_0x3c5730[_0xd650('0x3e')]};return db[_0xd650('0x29')][_0xd650('0x19')](_0x1b749b)[_0xd650('0x22')](function(_0x6690b6){_0x1a4c5d[_0xd650('0x19')]=_0x6690b6;if(_0x2f9593[_0xd650('0x2d')][_0xd650('0x41')]){_0x3c5730[_0xd650('0x42')]=[{'all':!![]}];}return db[_0xd650('0x29')][_0xd650('0x43')](_0x3c5730);})[_0xd650('0x22')](function(_0x40d771){_0x1a4c5d[_0xd650('0x44')]=_0x40d771;return _0x1a4c5d;})[_0xd650('0x22')](respondWithFilteredResult(_0x4e392b,_0x3c5730))[_0xd650('0x45')](handleError(_0x4e392b,null));};exports[_0xd650('0x46')]=function(_0x34e076,_0x3d685b){var _0x5c6da5={'raw':![],'where':{'id':_0x34e076[_0xd650('0x47')]['id']}},_0x3e9b12={};_0x3e9b12['model']=_[_0xd650('0x2b')](db[_0xd650('0x29')]['rawAttributes']);_0x3e9b12[_0xd650('0x2d')]=_['keys'](_0x34e076['query']);_0x3e9b12[_0xd650('0x2f')]=_['intersection'](_0x3e9b12[_0xd650('0x31')],_0x3e9b12[_0xd650('0x2d')]);_0x5c6da5[_0xd650('0x33')]=_[_0xd650('0x30')](_0x3e9b12[_0xd650('0x31')],qs['fields'](_0x34e076[_0xd650('0x2d')][_0xd650('0x32')]));_0x5c6da5[_0xd650('0x33')]=_0x5c6da5['attributes'][_0xd650('0x34')]?_0x5c6da5[_0xd650('0x33')]:_0x3e9b12[_0xd650('0x31')];if(_0x34e076['query'][_0xd650('0x41')]){_0x5c6da5['include']=[{'all':!![]}];}_0x5c6da5=_[_0xd650('0x3c')]({},_0x5c6da5,_0x34e076['options']);return db[_0xd650('0x29')]['find'](_0x5c6da5)[_0xd650('0x22')](handleEntityNotFound(_0x3d685b,null))[_0xd650('0x22')](respondWithResult(_0x3d685b,null))[_0xd650('0x45')](handleError(_0x3d685b,null));};exports[_0xd650('0x48')]=function(_0x548030,_0x594ecc){return db[_0xd650('0x29')]['create'](_0x548030['body'],{})[_0xd650('0x22')](respondWithResult(_0x594ecc,0xc9))[_0xd650('0x45')](handleError(_0x594ecc,null));};exports[_0xd650('0x21')]=function(_0xb88d2,_0x46e1bc){if(_0xb88d2[_0xd650('0x49')]['id']){delete _0xb88d2[_0xd650('0x49')]['id'];}return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0xb88d2[_0xd650('0x47')]['id']}})['then'](handleEntityNotFound(_0x46e1bc,null))[_0xd650('0x22')](saveUpdates(_0xb88d2['body'],null))[_0xd650('0x22')](respondWithResult(_0x46e1bc,null))[_0xd650('0x45')](handleError(_0x46e1bc,null));};exports[_0xd650('0x23')]=function(_0x29b657,_0x583d68){return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0x29b657['params']['id']}})['then'](handleEntityNotFound(_0x583d68,null))[_0xd650('0x22')](removeEntity(_0x583d68,null))[_0xd650('0x45')](handleError(_0x583d68,null));};exports[_0xd650('0x4b')]=function(_0x52feba,_0xf75a53,_0x5bc89e){return db[_0xd650('0x29')][_0xd650('0x4a')]({'where':{'id':_0x52feba['params']['id']}})[_0xd650('0x22')](handleEntityNotFound(_0xf75a53,null))['then'](function(_0x4eee3c){if(_0x4eee3c){return _0x4eee3c[_0xd650('0x4b')](_0x52feba[_0xd650('0x49')]['ids'],_['omit'](_0x52feba[_0xd650('0x49')],[_0xd650('0x4c'),'id'])||{});}})[_0xd650('0x22')](respondWithResult(_0xf75a53,null))['catch'](handleError(_0xf75a53,null));};exports[_0xd650('0x4d')]=function(_0x22dd3f,_0x2fe696,_0x291cc2){var _0x5d9e88;return db['SquareProject'][_0xd650('0x4a')]({'where':{'id':_0x22dd3f[_0xd650('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fe696,null))['then'](function(_0x53aaf2){if(_0x53aaf2){return _0x53aaf2[_0xd650('0x4d')](_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')])[_0xd650('0x22')](function(_0x40d2da){if(_[_0xd650('0x4e')](_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')])){for(var _0x5a7b9a=0x0;_0x5a7b9a<_0x22dd3f['query'][_0xd650('0x4c')][_0xd650('0x34')];_0x5a7b9a+=0x1){socket[_0xd650('0x4f')]('userSquareProject:remove',{'UserId':_0x22dd3f[_0xd650('0x2d')][_0xd650('0x4c')][_0x5a7b9a],'SquareProjectId':_0x22dd3f[_0xd650('0x47')]['id']});}}else{socket[_0xd650('0x4f')]('userSquareProject:remove',{'UserId':_0x22dd3f['query']['ids'],'SquareProjectId':_0x22dd3f[_0xd650('0x47')]['id']});}});}})[_0xd650('0x22')](respondWithStatusCode(_0x2fe696,null))[_0xd650('0x45')](handleError(_0x2fe696,null));};exports[_0xd650('0x50')]=function(_0x545b0d,_0x175a84,_0x2846b8){var _0x5e4c01={};var _0x321288={};var _0x55032e;var _0xfcb742;return db['SquareProject'][_0xd650('0x51')]({'where':{'id':_0x545b0d[_0xd650('0x47')]['id']}})[_0xd650('0x22')](handleEntityNotFound(_0x175a84,null))[_0xd650('0x22')](function(_0x169fb6){if(_0x169fb6){_0x55032e=_0x169fb6;_0x321288[_0xd650('0x31')]=_[_0xd650('0x2b')](db[_0xd650('0x52')]['rawAttributes']);_0x321288[_0xd650('0x2d')]=_['keys'](_0x545b0d['query']);_0x321288['filters']=_['intersection'](_0x321288[_0xd650('0x31')],_0x321288[_0xd650('0x2d')]);_0x5e4c01[_0xd650('0x33')]=_[_0xd650('0x30')](_0x321288[_0xd650('0x31')],qs['fields'](_0x545b0d[_0xd650('0x2d')][_0xd650('0x32')]));_0x5e4c01[_0xd650('0x33')]=_0x5e4c01[_0xd650('0x33')][_0xd650('0x34')]?_0x5e4c01['attributes']:_0x321288['model'];_0x5e4c01[_0xd650('0x37')]=qs[_0xd650('0x38')](_0x545b0d[_0xd650('0x2d')][_0xd650('0x38')]);_0x5e4c01['where']=qs[_0xd650('0x2f')](_[_0xd650('0x39')](_0x545b0d[_0xd650('0x2d')],_0x321288[_0xd650('0x2f')]));if(_0x545b0d[_0xd650('0x2d')][_0xd650('0x3d')]){_0x5e4c01[_0xd650('0x3e')]=_[_0xd650('0x3c')](_0x5e4c01['where'],{'$or':_[_0xd650('0x3f')](_0x5e4c01[_0xd650('0x33')],function(_0x3427aa){var _0x5133a0={};_0x5133a0[_0x3427aa]={'$like':'%'+_0x545b0d['query'][_0xd650('0x3d')]+'%'};return _0x5133a0;})});}_0x5e4c01=_['merge']({},_0x5e4c01,_0x545b0d[_0xd650('0x40')]);return _0x55032e[_0xd650('0x50')](_0x5e4c01);}})[_0xd650('0x22')](function(_0x10a585){if(_0x10a585){_0xfcb742=_0x10a585[_0xd650('0x34')];if(!_0x545b0d[_0xd650('0x2d')][_0xd650('0x35')]('nolimit')){_0x5e4c01[_0xd650('0x36')]=qs[_0xd650('0x36')](_0x545b0d[_0xd650('0x2d')][_0xd650('0x36')]);_0x5e4c01[_0xd650('0x1a')]=qs['offset'](_0x545b0d[_0xd650('0x2d')][_0xd650('0x1a')]);}return _0x55032e[_0xd650('0x50')](_0x5e4c01);}})['then'](function(_0x2405c8){if(_0x2405c8){return _0x2405c8?{'count':_0xfcb742,'rows':_0x2405c8}:null;}})['then'](respondWithResult(_0x175a84,null))[_0xd650('0x45')](handleError(_0x175a84,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 03ba1dd..e371281 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 _0xcf05=['setMaxListeners','save','update','remove','hook','exports','events','SquareProject'];(function(_0x25094e,_0x5d99c8){var _0x1d8ef9=function(_0x251f03){while(--_0x251f03){_0x25094e['push'](_0x25094e['shift']());}};_0x1d8ef9(++_0x5d99c8);}(_0xcf05,0x1d6));var _0x5cf0=function(_0x4d6f2e,_0x30d1cb){_0x4d6f2e=_0x4d6f2e-0x0;var _0x2d694e=_0xcf05[_0x4d6f2e];return _0x2d694e;};'use strict';var EventEmitter=require(_0x5cf0('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x5cf0('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x5cf0('0x2')](0x0);var events={'afterCreate':_0x5cf0('0x3'),'afterUpdate':_0x5cf0('0x4'),'afterDestroy':_0x5cf0('0x5')};function emitEvent(_0x32e24e){return function(_0x5533d4,_0x31dd18,_0x2afb88){SquareProjectEvents['emit'](_0x32e24e+':'+_0x5533d4['id'],_0x5533d4);SquareProjectEvents['emit'](_0x32e24e,_0x5533d4);_0x2afb88(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x5cf0('0x6')](e,emitEvent(event));}}module[_0x5cf0('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0x9e3a=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','SquareProject'];(function(_0x3fe04c,_0x10960){var _0x3c243a=function(_0xf921ea){while(--_0xf921ea){_0x3fe04c['push'](_0x3fe04c['shift']());}};_0x3c243a(++_0x10960);}(_0x9e3a,0x179));var _0xa9e3=function(_0x22911c,_0x52ebdb){_0x22911c=_0x22911c-0x0;var _0x5b68a4=_0x9e3a[_0x22911c];return _0x5b68a4;};'use strict';var EventEmitter=require(_0xa9e3('0x0'));var SquareProject=require(_0xa9e3('0x1'))['db'][_0xa9e3('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa9e3('0x3')](0x0);var events={'afterCreate':_0xa9e3('0x4'),'afterUpdate':_0xa9e3('0x5'),'afterDestroy':_0xa9e3('0x6')};function emitEvent(_0x1bdbb3){return function(_0x186b69,_0x24059f,_0x3cf697){SquareProjectEvents[_0xa9e3('0x7')](_0x1bdbb3+':'+_0x186b69['id'],_0x186b69);SquareProjectEvents['emit'](_0x1bdbb3,_0x186b69);_0x3cf697(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xa9e3('0x8')](e,emitEvent(event));}}module[_0xa9e3('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 948cf4d..eb73d01 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 _0x608c=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','api','moment','request-promise','./squareProject.attributes'];(function(_0x282e67,_0x5182c4){var _0x3b335e=function(_0x43abe3){while(--_0x43abe3){_0x282e67['push'](_0x282e67['shift']());}};_0x3b335e(++_0x5182c4);}(_0x608c,0x1b1));var _0xc608=function(_0x43f6d2,_0x11b4e9){_0x43f6d2=_0x43f6d2-0x0;var _0xaef57=_0x608c[_0x43f6d2];return _0xaef57;};'use strict';var _=require(_0xc608('0x0'));var util=require(_0xc608('0x1'));var logger=require(_0xc608('0x2'))(_0xc608('0x3'));var moment=require(_0xc608('0x4'));var BPromise=require('bluebird');var rp=require(_0xc608('0x5'));var attributes=require(_0xc608('0x6'));module[_0xc608('0x7')]=function(_0x56ed77,_0x32baf0){return _0x56ed77[_0xc608('0x8')](_0xc608('0x9'),attributes,{'tableName':_0xc608('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xffaa=['exports','define','SquareProject','square_projects','lodash','util','../../config/logger','bluebird','request-promise','./squareProject.attributes'];(function(_0x1947d1,_0x1c249b){var _0x515012=function(_0x4eda75){while(--_0x4eda75){_0x1947d1['push'](_0x1947d1['shift']());}};_0x515012(++_0x1c249b);}(_0xffaa,0x130));var _0xaffa=function(_0x1eef64,_0x5b1fb9){_0x1eef64=_0x1eef64-0x0;var _0x38fa49=_0xffaa[_0x1eef64];return _0x38fa49;};'use strict';var _=require(_0xaffa('0x0'));var util=require(_0xaffa('0x1'));var logger=require(_0xaffa('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaffa('0x3'));var rp=require(_0xaffa('0x4'));var attributes=require(_0xaffa('0x5'));module[_0xaffa('0x6')]=function(_0x444eef,_0x46692a){return _0x444eef[_0xaffa('0x7')](_0xaffa('0x8'),attributes,{'tableName':_0xaffa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1fe7f14..1099b96 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 _0x5106=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','localhost','request','then','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ShowSquareProject','SquareProject','raw','options','where','attributes','include','map','model','info','lodash','util','moment','bluebird'];(function(_0x483b60,_0x395592){var _0x3a0f0e=function(_0x2ecc8f){while(--_0x2ecc8f){_0x483b60['push'](_0x483b60['shift']());}};_0x3a0f0e(++_0x395592);}(_0x5106,0x172));var _0x6510=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5106[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x6510('0x0'));var util=require(_0x6510('0x1'));var moment=require(_0x6510('0x2'));var BPromise=require(_0x6510('0x3'));var rs=require(_0x6510('0x4'));var fs=require('fs');var db=require(_0x6510('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6510('0x6'))(_0x6510('0x7'));var config=require('../../config/environment');var jayson=require(_0x6510('0x8'));var client=jayson[_0x6510('0x9')][_0x6510('0xa')]({'port':0x232a});var socket=require(_0x6510('0xb'))({'host':_0x6510('0xc'),'port':0x18eb});require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0x526e89,_0x1a6ddb,_0x4a1e95){return new BPromise(function(_0x15db45,_0x393653){return client[_0x6510('0xd')](_0x526e89,_0x4a1e95)[_0x6510('0xe')](function(_0x1ed177){logger['info'](_0x6510('0xf'),_0x1a6ddb,'request\x20sent');logger[_0x6510('0x10')](_0x6510('0x11'),_0x1a6ddb,_0x6510('0x12'),JSON[_0x6510('0x13')](_0x1ed177));if(_0x1ed177[_0x6510('0x14')]){if(_0x1ed177[_0x6510('0x14')]['code']===0x1f4){logger[_0x6510('0x14')](_0x6510('0xf'),_0x1a6ddb,_0x1ed177[_0x6510('0x14')][_0x6510('0x15')]);return _0x393653(_0x1ed177['error'][_0x6510('0x15')]);}logger['error'](_0x6510('0xf'),_0x1a6ddb,_0x1ed177[_0x6510('0x14')][_0x6510('0x15')]);return _0x15db45(_0x1ed177['error'][_0x6510('0x15')]);}else{logger['info'](_0x6510('0xf'),_0x1a6ddb,_0x6510('0x12'));_0x15db45(_0x1ed177[_0x6510('0x16')][_0x6510('0x15')]);}})[_0x6510('0x17')](function(_0x5216f8){logger[_0x6510('0x14')]('SquareProject,\x20%s,\x20%s',_0x1a6ddb,_0x5216f8);_0x393653(_0x5216f8);});});}exports[_0x6510('0x18')]=function(_0x38f3b7){var _0x1113a9=this;return new Promise(function(_0x5333ba,_0x3d0ff5){return db[_0x6510('0x19')]['find']({'raw':_0x38f3b7['options']?_0x38f3b7['options'][_0x6510('0x1a')]===undefined?!![]:![]:!![],'where':_0x38f3b7['options']?_0x38f3b7[_0x6510('0x1b')][_0x6510('0x1c')]||null:null,'attributes':_0x38f3b7[_0x6510('0x1b')]?_0x38f3b7[_0x6510('0x1b')][_0x6510('0x1d')]||null:null,'include':_0x38f3b7[_0x6510('0x1b')]?_0x38f3b7[_0x6510('0x1b')][_0x6510('0x1e')]?_[_0x6510('0x1f')](_0x38f3b7[_0x6510('0x1b')][_0x6510('0x1e')],function(_0x45535a){return{'model':db[_0x45535a[_0x6510('0x20')]],'as':_0x45535a['as'],'attributes':_0x45535a[_0x6510('0x1d')],'include':_0x45535a[_0x6510('0x1e')]?_[_0x6510('0x1f')](_0x45535a[_0x6510('0x1e')],function(_0x348897){return{'model':db[_0x348897[_0x6510('0x20')]],'as':_0x348897['as'],'attributes':_0x348897[_0x6510('0x1d')],'include':_0x348897[_0x6510('0x1e')]?_[_0x6510('0x1f')](_0x348897[_0x6510('0x1e')],function(_0xb0e43){return{'model':db[_0xb0e43['model']],'as':_0xb0e43['as'],'attributes':_0xb0e43[_0x6510('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6510('0xe')](function(_0x5d4136){logger[_0x6510('0x21')](_0x6510('0x18'),_0x38f3b7);logger[_0x6510('0x10')](_0x6510('0x18'),_0x38f3b7,JSON['stringify'](_0x5d4136));_0x5333ba(_0x5d4136);})['catch'](function(_0x51199a){logger[_0x6510('0x14')](_0x6510('0x18'),_0x51199a['message'],_0x38f3b7);_0x3d0ff5(_0x1113a9[_0x6510('0x14')](0x1f4,_0x51199a[_0x6510('0x15')]));});});}; \ No newline at end of file +var _0x45b1=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','find','options','where','include','map','attributes','model','then','ShowSquareProject','stringify','lodash','moment','bluebird'];(function(_0x4b9273,_0x3ae0ea){var _0x363f36=function(_0x9b3d8f){while(--_0x9b3d8f){_0x4b9273['push'](_0x4b9273['shift']());}};_0x363f36(++_0x3ae0ea);}(_0x45b1,0xfd));var _0x145b=function(_0x29f170,_0x5ce657){_0x29f170=_0x29f170-0x0;var _0x4dc3a3=_0x45b1[_0x29f170];return _0x4dc3a3;};'use strict';var _=require(_0x145b('0x0'));var util=require('util');var moment=require(_0x145b('0x1'));var BPromise=require(_0x145b('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x145b('0x3'));var logger=require(_0x145b('0x4'))('rpc');var config=require(_0x145b('0x5'));var jayson=require(_0x145b('0x6'));var client=jayson[_0x145b('0x7')]['http']({'port':0x232a});var socket=require(_0x145b('0x8'))({'host':_0x145b('0x9'),'port':0x18eb});require('./squareProject.socket')[_0x145b('0xa')](socket);function respondWithRpcPromise(_0x3bb37a,_0xb1e57d,_0x4a68ed){return new BPromise(function(_0x2f9fda,_0x4cace8){return client[_0x145b('0xb')](_0x3bb37a,_0x4a68ed)['then'](function(_0xa4e4dd){logger[_0x145b('0xc')](_0x145b('0xd'),_0xb1e57d,_0x145b('0xe'));logger[_0x145b('0xf')](_0x145b('0x10'),_0xb1e57d,_0x145b('0xe'),JSON['stringify'](_0xa4e4dd));if(_0xa4e4dd[_0x145b('0x11')]){if(_0xa4e4dd[_0x145b('0x11')][_0x145b('0x12')]===0x1f4){logger[_0x145b('0x11')](_0x145b('0xd'),_0xb1e57d,_0xa4e4dd[_0x145b('0x11')]['message']);return _0x4cace8(_0xa4e4dd['error'][_0x145b('0x13')]);}logger['error'](_0x145b('0xd'),_0xb1e57d,_0xa4e4dd[_0x145b('0x11')][_0x145b('0x13')]);return _0x2f9fda(_0xa4e4dd[_0x145b('0x11')][_0x145b('0x13')]);}else{logger[_0x145b('0xc')]('SquareProject,\x20%s,\x20%s',_0xb1e57d,_0x145b('0xe'));_0x2f9fda(_0xa4e4dd[_0x145b('0x14')]['message']);}})[_0x145b('0x15')](function(_0x2a6765){logger[_0x145b('0x11')]('SquareProject,\x20%s,\x20%s',_0xb1e57d,_0x2a6765);_0x4cace8(_0x2a6765);});});}exports['ShowSquareProject']=function(_0x1e0eef){var _0xdd3743=this;return new Promise(function(_0x55d022,_0x183039){return db['SquareProject'][_0x145b('0x16')]({'raw':_0x1e0eef[_0x145b('0x17')]?_0x1e0eef[_0x145b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1e0eef['options']?_0x1e0eef[_0x145b('0x17')][_0x145b('0x18')]||null:null,'attributes':_0x1e0eef['options']?_0x1e0eef[_0x145b('0x17')]['attributes']||null:null,'include':_0x1e0eef[_0x145b('0x17')]?_0x1e0eef[_0x145b('0x17')][_0x145b('0x19')]?_[_0x145b('0x1a')](_0x1e0eef['options'][_0x145b('0x19')],function(_0x190b0c){return{'model':db[_0x190b0c['model']],'as':_0x190b0c['as'],'attributes':_0x190b0c[_0x145b('0x1b')],'include':_0x190b0c[_0x145b('0x19')]?_[_0x145b('0x1a')](_0x190b0c[_0x145b('0x19')],function(_0x872409){return{'model':db[_0x872409[_0x145b('0x1c')]],'as':_0x872409['as'],'attributes':_0x872409[_0x145b('0x1b')],'include':_0x872409[_0x145b('0x19')]?_[_0x145b('0x1a')](_0x872409[_0x145b('0x19')],function(_0x4d9ee9){return{'model':db[_0x4d9ee9[_0x145b('0x1c')]],'as':_0x4d9ee9['as'],'attributes':_0x4d9ee9['attributes']};}):[]};}):[]};}):[]:[]})[_0x145b('0x1d')](function(_0x31132c){logger['info'](_0x145b('0x1e'),_0x1e0eef);logger[_0x145b('0xf')](_0x145b('0x1e'),_0x1e0eef,JSON[_0x145b('0x1f')](_0x31132c));_0x55d022(_0x31132c);})[_0x145b('0x15')](function(_0x1ceea3){logger[_0x145b('0x11')]('ShowSquareProject',_0x1ceea3[_0x145b('0x13')],_0x1e0eef);_0x183039(_0xdd3743[_0x145b('0x11')](0x1f4,_0x1ceea3[_0x145b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0938586..8fd03b8 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 _0x28a2=['save','remove','update','removeListener','register','squareProject:','./squareProject.events'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0x28a2,0x141));var _0x228a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28a2[_0x3dd15e];return _0x231fd0;};'use strict';var SquareProjectEvents=require(_0x228a('0x0'));var events=[_0x228a('0x1'),_0x228a('0x2'),_0x228a('0x3')];function createListener(_0x466ef9,_0x41d4aa){return function(_0xfc342a){_0x41d4aa['emit'](_0x466ef9,_0xfc342a);};}function removeListener(_0x6efce7,_0x51e9e9){return function(){SquareProjectEvents[_0x228a('0x4')](_0x6efce7,_0x51e9e9);};}exports[_0x228a('0x5')]=function(_0x17727b){for(var _0xf86d1d=0x0,_0x100a6a=events['length'];_0xf86d1d<_0x100a6a;_0xf86d1d++){var _0x270d15=events[_0xf86d1d];var _0x7767ab=createListener(_0x228a('0x6')+_0x270d15,_0x17727b);SquareProjectEvents['on'](_0x270d15,_0x7767ab);}}; \ No newline at end of file +var _0xaf9b=['removeListener','register','squareProject:','./squareProject.events','remove','emit'];(function(_0x34567e,_0x589de6){var _0x48b765=function(_0x3fab65){while(--_0x3fab65){_0x34567e['push'](_0x34567e['shift']());}};_0x48b765(++_0x589de6);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x106205,_0x5484ff){_0x106205=_0x106205-0x0;var _0x44cbd0=_0xaf9b[_0x106205];return _0x44cbd0;};'use strict';var SquareProjectEvents=require(_0xbaf9('0x0'));var events=['save',_0xbaf9('0x1'),'update'];function createListener(_0x1f2f6e,_0x353aad){return function(_0x46312a){_0x353aad[_0xbaf9('0x2')](_0x1f2f6e,_0x46312a);};}function removeListener(_0x512b7c,_0x64585f){return function(){SquareProjectEvents[_0xbaf9('0x3')](_0x512b7c,_0x64585f);};}exports[_0xbaf9('0x4')]=function(_0x4b443e){for(var _0x40b949=0x0,_0x3578fd=events['length'];_0x40b949<_0x3578fd;_0x40b949++){var _0x4a8f38=events[_0x40b949];var _0x1168ed=createListener(_0xbaf9('0x5')+_0x4a8f38,_0x4b443e);SquareProjectEvents['on'](_0x4a8f38,_0x1168ed);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index ddfacc5..b197cbc 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 _0xf9cf=['Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','delete','exports','multer','util','path','express'];(function(_0x240f8f,_0x3373f6){var _0x4ab98a=function(_0x3d28ba){while(--_0x3d28ba){_0x240f8f['push'](_0x240f8f['shift']());}};_0x4ab98a(++_0x3373f6);}(_0xf9cf,0xf8));var _0xff9c=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0xf9cf[_0x5da27f];return _0x54a3fb;};'use strict';var multer=require(_0xff9c('0x0'));var util=require(_0xff9c('0x1'));var path=require(_0xff9c('0x2'));var express=require(_0xff9c('0x3'));var router=express[_0xff9c('0x4')]();var auth=require(_0xff9c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0xff9c('0x6')]('/',auth[_0xff9c('0x7')](),controller[_0xff9c('0x8')]);router[_0xff9c('0x6')](_0xff9c('0x9'),auth[_0xff9c('0x7')](),controller[_0xff9c('0xa')]);router[_0xff9c('0x6')](_0xff9c('0xb'),auth['isAuthenticated'](),controller[_0xff9c('0xc')]);router[_0xff9c('0xd')]('/',auth[_0xff9c('0x7')](),controller['create']);router[_0xff9c('0xe')](_0xff9c('0x9'),auth[_0xff9c('0x7')](),controller[_0xff9c('0xf')]);router[_0xff9c('0x10')](_0xff9c('0x9'),auth[_0xff9c('0x7')](),controller['destroy']);module[_0xff9c('0x11')]=router; \ No newline at end of file +var _0x43c8=['/:id','/:id/download','download','create','put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x43c8,0x107));var _0x843c=function(_0x2e5cea,_0x2e3db9){_0x2e5cea=_0x2e5cea-0x0;var _0x2f29a4=_0x43c8[_0x2e5cea];return _0x2f29a4;};'use strict';var multer=require(_0x843c('0x0'));var util=require(_0x843c('0x1'));var path=require(_0x843c('0x2'));var express=require(_0x843c('0x3'));var router=express['Router']();var auth=require(_0x843c('0x4'));var interaction=require(_0x843c('0x5'));var config=require('../../config/environment');var controller=require('./squareRecording.controller');router[_0x843c('0x6')]('/',auth[_0x843c('0x7')](),controller[_0x843c('0x8')]);router['get'](_0x843c('0x9'),auth[_0x843c('0x7')](),controller['show']);router[_0x843c('0x6')](_0x843c('0xa'),auth[_0x843c('0x7')](),controller[_0x843c('0xb')]);router['post']('/',auth[_0x843c('0x7')](),controller[_0x843c('0xc')]);router[_0x843c('0xd')](_0x843c('0x9'),auth[_0x843c('0x7')](),controller['update']);router[_0x843c('0xe')](_0x843c('0x9'),auth['isAuthenticated'](),controller[_0x843c('0xf')]);module[_0x843c('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 5a18a19..ca0e016 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 _0xd8ff=['STRING'];(function(_0x43186d,_0x4b40ec){var _0x5f562c=function(_0x18ed7e){while(--_0x18ed7e){_0x43186d['push'](_0x43186d['shift']());}};_0x5f562c(++_0x4b40ec);}(_0xd8ff,0xf3));var _0xfd8f=function(_0x238c37,_0x1f30ac){_0x238c37=_0x238c37-0x0;var _0x17848b=_0xd8ff[_0x238c37];return _0x17848b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfd8f('0x0')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfd8f('0x0')]},'context':{'type':Sequelize[_0xfd8f('0x0')]},'extension':{'type':Sequelize[_0xfd8f('0x0')]},'priority':{'type':Sequelize[_0xfd8f('0x0')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0xfd8f('0x0')]},'projectName':{'type':Sequelize[_0xfd8f('0x0')]},'saveName':{'type':Sequelize[_0xfd8f('0x0')]},'filename':{'type':Sequelize[_0xfd8f('0x0')]},'savePath':{'type':Sequelize[_0xfd8f('0x0')]}}; \ No newline at end of file +var _0x8fa7=['STRING'];(function(_0x2f0157,_0x1b4373){var _0xcc899d=function(_0x51c203){while(--_0x51c203){_0x2f0157['push'](_0x2f0157['shift']());}};_0xcc899d(++_0x1b4373);}(_0x8fa7,0x7b));var _0x78fa=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x8fa7[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x78fa('0x0')]},'callerid':{'type':Sequelize[_0x78fa('0x0')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x78fa('0x0')]},'extension':{'type':Sequelize[_0x78fa('0x0')]},'priority':{'type':Sequelize[_0x78fa('0x0')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x78fa('0x0')]},'projectName':{'type':Sequelize[_0x78fa('0x0')]},'saveName':{'type':Sequelize[_0x78fa('0x0')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x78fa('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 4383972..171b342 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 _0x5c12=['util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','reject','then','error','stack','name','send','index','SquareRecording','rawAttributes','model','query','dateStart','dateEnd','keys','filters','intersection','attributes','fields','nolimit','limit','order','where','pick','add','day','merge','map','filter','options','findAll','rows','catch','show','params','includeAll','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','request-promise','moment','mustache'];(function(_0x33a369,_0x12d2dc){var _0x4add12=function(_0x237741){while(--_0x237741){_0x33a369['push'](_0x33a369['shift']());}};_0x4add12(++_0x12d2dc);}(_0x5c12,0x188));var _0x25c1=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x5c12[_0x190ff6];return _0x5356d2;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x25c1('0x0'));var moment=require(_0x25c1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x25c1('0x2'));var util=require(_0x25c1('0x3'));var path=require(_0x25c1('0x4'));var sox=require(_0x25c1('0x5'));var csv=require(_0x25c1('0x6'));var ejs=require(_0x25c1('0x7'));var fs=require('fs');var _=require(_0x25c1('0x8'));var squel=require('squel');var crypto=require(_0x25c1('0x9'));var jsforce=require(_0x25c1('0xa'));var deskjs=require(_0x25c1('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25c1('0xc'));var qs=require(_0x25c1('0xd'));var logger=require(_0x25c1('0xe'))(_0x25c1('0xf'));var utils=require(_0x25c1('0x10'));var config=require('../../config/environment');var db=require(_0x25c1('0x11'))['db'];function respondWithStatusCode(_0x41c89d,_0x11a223){_0x11a223=_0x11a223||0xcc;return function(_0x81f0f4){if(_0x81f0f4){return _0x41c89d[_0x25c1('0x12')](_0x11a223);}return _0x41c89d['status'](_0x11a223)[_0x25c1('0x13')]();};}function respondWithResult(_0x401734,_0x49fb8e){_0x49fb8e=_0x49fb8e||0xc8;return function(_0x256ecd){if(_0x256ecd){return _0x401734[_0x25c1('0x14')](_0x49fb8e)[_0x25c1('0x15')](_0x256ecd);}};}function respondWithFilteredResult(_0x329ba9,_0x5d3d11){return function(_0x569ef9){if(_0x569ef9){var _0x4ef5d7=_0x569ef9[_0x25c1('0x16')],_0x54f6f4=_0x5d3d11[_0x25c1('0x17')],_0x3ef429=_0x5d3d11[_0x25c1('0x17')]+_0x5d3d11['limit'],_0x1412ed;if(_0x3ef429>=_0x4ef5d7){_0x3ef429=_0x4ef5d7;_0x1412ed=0xc8;}else{_0x1412ed=0xce;}_0x329ba9[_0x25c1('0x14')](_0x1412ed);return _0x329ba9['set']('Content-Range',_0x54f6f4+'-'+_0x3ef429+'/'+_0x4ef5d7)['json'](_0x569ef9);}return null;};}function patchUpdates(_0x284712){return function(_0x1a08b5){try{jsonpatch['apply'](_0x1a08b5,_0x284712,!![]);}catch(_0x4c55e7){return BPromise[_0x25c1('0x18')](_0x4c55e7);}return _0x1a08b5['save']();};}function saveUpdates(_0x7175d4,_0x23a418){return function(_0x5c3c5d){if(_0x5c3c5d){return _0x5c3c5d['update'](_0x7175d4)['then'](function(_0x2ce1ce){return _0x2ce1ce;});}return null;};}function removeEntity(_0x3d3149,_0x22a36e){return function(_0x1bf95d){if(_0x1bf95d){return _0x1bf95d['destroy']()[_0x25c1('0x19')](function(){_0x3d3149[_0x25c1('0x14')](0xcc)[_0x25c1('0x13')]();});}};}function handleEntityNotFound(_0x29e637,_0x517a46){return function(_0x4c3259){if(!_0x4c3259){_0x29e637[_0x25c1('0x12')](0x194);}return _0x4c3259;};}function handleError(_0xac3335,_0x396ed5){_0x396ed5=_0x396ed5||0x1f4;return function(_0x1c61e7){logger[_0x25c1('0x1a')](_0x1c61e7[_0x25c1('0x1b')]);if(_0x1c61e7[_0x25c1('0x1c')]){delete _0x1c61e7[_0x25c1('0x1c')];}_0xac3335[_0x25c1('0x14')](_0x396ed5)[_0x25c1('0x1d')](_0x1c61e7);};}exports[_0x25c1('0x1e')]=function(_0x284daa,_0x399d72){var _0x4915cc={},_0x2dadae={},_0x20dbb9={'count':0x0,'rows':[]};var _0x1b1c96=db[_0x25c1('0x1f')][_0x25c1('0x20')];_0x2dadae[_0x25c1('0x21')]=_['keys'](_0x1b1c96);var _0x17c924={'dateStart':_0x284daa[_0x25c1('0x22')][_0x25c1('0x23')],'dateEnd':_0x284daa[_0x25c1('0x22')][_0x25c1('0x24')]};delete _0x284daa[_0x25c1('0x22')]['dateStart'];delete _0x284daa[_0x25c1('0x22')]['dateEnd'];_0x2dadae[_0x25c1('0x22')]=_[_0x25c1('0x25')](_0x284daa[_0x25c1('0x22')]);_0x2dadae[_0x25c1('0x26')]=_[_0x25c1('0x27')](_0x2dadae[_0x25c1('0x21')],_0x2dadae[_0x25c1('0x22')]);_0x4915cc[_0x25c1('0x28')]=_[_0x25c1('0x27')](_0x2dadae['model'],qs[_0x25c1('0x29')](_0x284daa['query']['fields']));_0x4915cc[_0x25c1('0x28')]=_0x4915cc[_0x25c1('0x28')]['length']?_0x4915cc[_0x25c1('0x28')]:_0x2dadae['model'];if(!_0x284daa[_0x25c1('0x22')]['hasOwnProperty'](_0x25c1('0x2a'))){_0x4915cc[_0x25c1('0x2b')]=qs[_0x25c1('0x2b')](_0x284daa[_0x25c1('0x22')][_0x25c1('0x2b')]);_0x4915cc[_0x25c1('0x17')]=qs[_0x25c1('0x17')](_0x284daa[_0x25c1('0x22')]['offset']);}_0x4915cc[_0x25c1('0x2c')]=qs['sort'](_0x284daa[_0x25c1('0x22')]['sort']);_0x4915cc[_0x25c1('0x2d')]=qs[_0x25c1('0x26')](_[_0x25c1('0x2e')](_0x284daa[_0x25c1('0x22')],_0x2dadae[_0x25c1('0x26')]));if(_0x17c924[_0x25c1('0x23')]){if(_0x17c924[_0x25c1('0x24')]){_0x17c924[_0x25c1('0x24')]=moment(_0x17c924[_0x25c1('0x24')])[_0x25c1('0x2f')](0x1,_0x25c1('0x30'));}else{_0x17c924[_0x25c1('0x24')]=moment(_0x17c924[_0x25c1('0x23')])[_0x25c1('0x2f')](0x1,_0x25c1('0x30'));}_[_0x25c1('0x31')](_0x4915cc[_0x25c1('0x2d')],{'createdAt':{'$gte':_0x17c924[_0x25c1('0x23')],'$lte':_0x17c924[_0x25c1('0x24')]}});}if(_0x284daa[_0x25c1('0x22')]['filter']){_0x4915cc[_0x25c1('0x2d')]=_[_0x25c1('0x31')](_0x4915cc['where'],{'$or':_[_0x25c1('0x32')](_0x4915cc['attributes'],function(_0x32b3a4){var _0x4f978c={};_0x4f978c[_0x32b3a4]={'$like':'%'+_0x284daa[_0x25c1('0x22')][_0x25c1('0x33')]+'%'};return _0x4f978c;})});}_0x4915cc=_[_0x25c1('0x31')]({},_0x4915cc,_0x284daa[_0x25c1('0x34')]);var _0xbc20a3={'where':_0x4915cc['where']};return db[_0x25c1('0x1f')]['count'](_0xbc20a3)[_0x25c1('0x19')](function(_0xe83d32){_0x20dbb9[_0x25c1('0x16')]=_0xe83d32;if(_0x284daa[_0x25c1('0x22')]['includeAll']){_0x4915cc['include']=[{'all':!![]}];}return db['SquareRecording'][_0x25c1('0x35')](_0x4915cc);})[_0x25c1('0x19')](function(_0x530967){_0x20dbb9[_0x25c1('0x36')]=_0x530967;return _0x20dbb9;})['then'](respondWithFilteredResult(_0x399d72,_0x4915cc))[_0x25c1('0x37')](handleError(_0x399d72,null));};exports[_0x25c1('0x38')]=function(_0x3c24da,_0x4967a6){var _0x5502c1={'raw':!![],'where':{'id':_0x3c24da[_0x25c1('0x39')]['id']}},_0x53f87b={};_0x53f87b[_0x25c1('0x21')]=_['keys'](db[_0x25c1('0x1f')][_0x25c1('0x20')]);_0x53f87b[_0x25c1('0x22')]=_['keys'](_0x3c24da['query']);_0x53f87b['filters']=_['intersection'](_0x53f87b[_0x25c1('0x21')],_0x53f87b[_0x25c1('0x22')]);_0x5502c1['attributes']=_[_0x25c1('0x27')](_0x53f87b[_0x25c1('0x21')],qs[_0x25c1('0x29')](_0x3c24da[_0x25c1('0x22')][_0x25c1('0x29')]));_0x5502c1[_0x25c1('0x28')]=_0x5502c1[_0x25c1('0x28')]['length']?_0x5502c1['attributes']:_0x53f87b[_0x25c1('0x21')];if(_0x3c24da[_0x25c1('0x22')][_0x25c1('0x3a')]){_0x5502c1['include']=[{'all':!![]}];}_0x5502c1=_[_0x25c1('0x31')]({},_0x5502c1,_0x3c24da[_0x25c1('0x34')]);return db[_0x25c1('0x1f')][_0x25c1('0x3b')](_0x5502c1)['then'](handleEntityNotFound(_0x4967a6,null))[_0x25c1('0x19')](respondWithResult(_0x4967a6,null))[_0x25c1('0x37')](handleError(_0x4967a6,null));};exports[_0x25c1('0x3c')]=function(_0xfd0e50,_0x5d2ecc){return db['SquareRecording'][_0x25c1('0x3c')](_0xfd0e50[_0x25c1('0x3d')],{})[_0x25c1('0x19')](respondWithResult(_0x5d2ecc,0xc9))[_0x25c1('0x37')](handleError(_0x5d2ecc,null));};exports['update']=function(_0x6eff9e,_0x32943c){if(_0x6eff9e['body']['id']){delete _0x6eff9e[_0x25c1('0x3d')]['id'];}return db[_0x25c1('0x1f')][_0x25c1('0x3b')]({'where':{'id':_0x6eff9e[_0x25c1('0x39')]['id']}})['then'](handleEntityNotFound(_0x32943c,null))['then'](saveUpdates(_0x6eff9e[_0x25c1('0x3d')],null))[_0x25c1('0x19')](respondWithResult(_0x32943c,null))[_0x25c1('0x37')](handleError(_0x32943c,null));};exports['destroy']=function(_0x19028a,_0x2d874b){return db['SquareRecording'][_0x25c1('0x3b')]({'where':{'id':_0x19028a[_0x25c1('0x39')]['id']}})[_0x25c1('0x19')](handleEntityNotFound(_0x2d874b,null))[_0x25c1('0x19')](removeEntity(_0x2d874b,null))[_0x25c1('0x37')](handleError(_0x2d874b,null));};exports[_0x25c1('0x3e')]=function(_0xa5a154,_0x5102a0,_0x5344da){var _0x55d8cc=require(_0x25c1('0x3f'));var _0x5c588c=![];var _0x133d1d={};if(_0xa5a154[_0x25c1('0x22')][_0x25c1('0x40')]&&_0xa5a154[_0x25c1('0x22')][_0x25c1('0x40')]===_0x25c1('0x41')){_0x133d1d['uniqueid']=_0xa5a154[_0x25c1('0x39')]['id'];}else{_0x133d1d['id']=_0xa5a154[_0x25c1('0x39')]['id'];}return db[_0x25c1('0x1f')][_0x25c1('0x3b')]({'where':_0x133d1d,'attributes':['id',_0x25c1('0x42'),_0x25c1('0x43')],'raw':!![]})['then'](handleEntityNotFound(_0x5102a0,null))[_0x25c1('0x19')](function(_0x2e741f){if(_0x2e741f){var _0x18f7c5=util[_0x25c1('0x44')](_0x25c1('0x45'),_0x2e741f['value']);if(fs[_0x25c1('0x46')](_0x18f7c5)){_0x5c588c=!![];return _0x55d8cc[_0x25c1('0x47')](_0x18f7c5,_0x2e741f['savePath'],config[_0x25c1('0x48')][_0x25c1('0x49')])[_0x25c1('0x19')](function(){return _0x2e741f;});}return _0x2e741f;}})[_0x25c1('0x19')](function(_0x30ca5d){if(_0x30ca5d){if(!fs[_0x25c1('0x46')](_0x30ca5d['savePath'])){throw new db[(_0x25c1('0x4a'))][(_0x25c1('0x4b'))](_0x25c1('0x4c'));}if(_0x30ca5d[_0x25c1('0x43')]){return _0x5102a0[_0x25c1('0x3e')](_0x30ca5d[_0x25c1('0x42')],_0x30ca5d[_0x25c1('0x43')]+path[_0x25c1('0x4d')](_0x30ca5d[_0x25c1('0x42')]),function(){if(_0x5c588c){fs[_0x25c1('0x4e')](_0x30ca5d[_0x25c1('0x42')]);}});}else{return _0x5102a0[_0x25c1('0x3e')](_0x30ca5d[_0x25c1('0x42')],function(_0x11908c){if(_0x5c588c){fs['unlink'](_0x30ca5d[_0x25c1('0x42')]);}});}}})[_0x25c1('0x37')](handleError(_0x5102a0,null));}; \ No newline at end of file +var _0xac9d=['jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','SquareRecording','model','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','dateStart','day','add','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','download','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','value','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','extname','unlink','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto'];(function(_0x1ff26f,_0x2688e1){var _0x12ab8c=function(_0x186660){while(--_0x186660){_0x1ff26f['push'](_0x1ff26f['shift']());}};_0x12ab8c(++_0x2688e1);}(_0xac9d,0x14d));var _0xdac9=function(_0x31dde9,_0x12e816){_0x31dde9=_0x31dde9-0x0;var _0x1fbf2d=_0xac9d[_0x31dde9];return _0x1fbf2d;};'use strict';var jsonpatch=require(_0xdac9('0x0'));var rp=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var Mustache=require(_0xdac9('0x4'));var util=require(_0xdac9('0x5'));var path=require(_0xdac9('0x6'));var sox=require(_0xdac9('0x7'));var csv=require('to-csv');var ejs=require(_0xdac9('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xdac9('0x9'));var crypto=require(_0xdac9('0xa'));var jsforce=require(_0xdac9('0xb'));var deskjs=require(_0xdac9('0xc'));var toCsv=require(_0xdac9('0xd'));var querystring=require(_0xdac9('0xe'));var Papa=require('papaparse');var qs=require(_0xdac9('0xf'));var logger=require('../../config/logger')(_0xdac9('0x10'));var utils=require(_0xdac9('0x11'));var config=require(_0xdac9('0x12'));var db=require(_0xdac9('0x13'))['db'];function respondWithStatusCode(_0x23ec14,_0x2859bf){_0x2859bf=_0x2859bf||0xcc;return function(_0x255627){if(_0x255627){return _0x23ec14[_0xdac9('0x14')](_0x2859bf);}return _0x23ec14[_0xdac9('0x15')](_0x2859bf)['end']();};}function respondWithResult(_0x37b316,_0x43e0a5){_0x43e0a5=_0x43e0a5||0xc8;return function(_0x5a9bde){if(_0x5a9bde){return _0x37b316[_0xdac9('0x15')](_0x43e0a5)[_0xdac9('0x16')](_0x5a9bde);}};}function respondWithFilteredResult(_0xbfe6d8,_0x4b2436){return function(_0x16063f){if(_0x16063f){var _0x33ba20=_0x16063f[_0xdac9('0x17')],_0x9e1bf6=_0x4b2436[_0xdac9('0x18')],_0x5f0bbd=_0x4b2436['offset']+_0x4b2436[_0xdac9('0x19')],_0x5dd536;if(_0x5f0bbd>=_0x33ba20){_0x5f0bbd=_0x33ba20;_0x5dd536=0xc8;}else{_0x5dd536=0xce;}_0xbfe6d8[_0xdac9('0x15')](_0x5dd536);return _0xbfe6d8[_0xdac9('0x1a')](_0xdac9('0x1b'),_0x9e1bf6+'-'+_0x5f0bbd+'/'+_0x33ba20)[_0xdac9('0x16')](_0x16063f);}return null;};}function patchUpdates(_0x393acc){return function(_0x34a85a){try{jsonpatch[_0xdac9('0x1c')](_0x34a85a,_0x393acc,!![]);}catch(_0x4fa7c4){return BPromise[_0xdac9('0x1d')](_0x4fa7c4);}return _0x34a85a[_0xdac9('0x1e')]();};}function saveUpdates(_0x571e07,_0x1cd239){return function(_0xa57f2d){if(_0xa57f2d){return _0xa57f2d[_0xdac9('0x1f')](_0x571e07)[_0xdac9('0x20')](function(_0x522dc3){return _0x522dc3;});}return null;};}function removeEntity(_0x520369,_0x4029fc){return function(_0x20ece3){if(_0x20ece3){return _0x20ece3[_0xdac9('0x21')]()[_0xdac9('0x20')](function(){_0x520369['status'](0xcc)[_0xdac9('0x22')]();});}};}function handleEntityNotFound(_0x33cb7d,_0x27f473){return function(_0xae680a){if(!_0xae680a){_0x33cb7d[_0xdac9('0x14')](0x194);}return _0xae680a;};}function handleError(_0x42317c,_0x41335a){_0x41335a=_0x41335a||0x1f4;return function(_0xa1f726){logger[_0xdac9('0x23')](_0xa1f726[_0xdac9('0x24')]);if(_0xa1f726['name']){delete _0xa1f726[_0xdac9('0x25')];}_0x42317c[_0xdac9('0x15')](_0x41335a)[_0xdac9('0x26')](_0xa1f726);};}exports[_0xdac9('0x27')]=function(_0x5ca076,_0x1e631a){var _0x5686db={},_0x3ce475={},_0x2fce71={'count':0x0,'rows':[]};var _0x566d8c=db[_0xdac9('0x28')]['rawAttributes'];_0x3ce475[_0xdac9('0x29')]=_[_0xdac9('0x2a')](_0x566d8c);var _0xeff4b2={'dateStart':_0x5ca076[_0xdac9('0x2b')]['dateStart'],'dateEnd':_0x5ca076['query'][_0xdac9('0x2c')]};delete _0x5ca076[_0xdac9('0x2b')]['dateStart'];delete _0x5ca076['query'][_0xdac9('0x2c')];_0x3ce475[_0xdac9('0x2b')]=_[_0xdac9('0x2a')](_0x5ca076[_0xdac9('0x2b')]);_0x3ce475[_0xdac9('0x2d')]=_[_0xdac9('0x2e')](_0x3ce475[_0xdac9('0x29')],_0x3ce475[_0xdac9('0x2b')]);_0x5686db[_0xdac9('0x2f')]=_[_0xdac9('0x2e')](_0x3ce475[_0xdac9('0x29')],qs[_0xdac9('0x30')](_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x30')]));_0x5686db[_0xdac9('0x2f')]=_0x5686db[_0xdac9('0x2f')][_0xdac9('0x31')]?_0x5686db[_0xdac9('0x2f')]:_0x3ce475[_0xdac9('0x29')];if(!_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x32')]('nolimit')){_0x5686db['limit']=qs[_0xdac9('0x19')](_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x19')]);_0x5686db[_0xdac9('0x18')]=qs[_0xdac9('0x18')](_0x5ca076['query'][_0xdac9('0x18')]);}_0x5686db['order']=qs[_0xdac9('0x33')](_0x5ca076[_0xdac9('0x2b')]['sort']);_0x5686db[_0xdac9('0x34')]=qs['filters'](_['pick'](_0x5ca076[_0xdac9('0x2b')],_0x3ce475[_0xdac9('0x2d')]));if(_0xeff4b2[_0xdac9('0x35')]){if(_0xeff4b2[_0xdac9('0x2c')]){_0xeff4b2[_0xdac9('0x2c')]=moment(_0xeff4b2[_0xdac9('0x2c')])['add'](0x1,_0xdac9('0x36'));}else{_0xeff4b2[_0xdac9('0x2c')]=moment(_0xeff4b2['dateStart'])[_0xdac9('0x37')](0x1,_0xdac9('0x36'));}_[_0xdac9('0x38')](_0x5686db[_0xdac9('0x34')],{'createdAt':{'$gte':_0xeff4b2[_0xdac9('0x35')],'$lte':_0xeff4b2[_0xdac9('0x2c')]}});}if(_0x5ca076[_0xdac9('0x2b')]['filter']){_0x5686db[_0xdac9('0x34')]=_[_0xdac9('0x38')](_0x5686db[_0xdac9('0x34')],{'$or':_['map'](_0x5686db[_0xdac9('0x2f')],function(_0x338e4a){var _0x26ba56={};_0x26ba56[_0x338e4a]={'$like':'%'+_0x5ca076[_0xdac9('0x2b')]['filter']+'%'};return _0x26ba56;})});}_0x5686db=_['merge']({},_0x5686db,_0x5ca076[_0xdac9('0x39')]);var _0xe47a3c={'where':_0x5686db[_0xdac9('0x34')]};return db[_0xdac9('0x28')][_0xdac9('0x17')](_0xe47a3c)['then'](function(_0x8435e8){_0x2fce71['count']=_0x8435e8;if(_0x5ca076[_0xdac9('0x2b')][_0xdac9('0x3a')]){_0x5686db[_0xdac9('0x3b')]=[{'all':!![]}];}return db[_0xdac9('0x28')][_0xdac9('0x3c')](_0x5686db);})[_0xdac9('0x20')](function(_0x413fb1){_0x2fce71[_0xdac9('0x3d')]=_0x413fb1;return _0x2fce71;})[_0xdac9('0x20')](respondWithFilteredResult(_0x1e631a,_0x5686db))[_0xdac9('0x3e')](handleError(_0x1e631a,null));};exports[_0xdac9('0x3f')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x40')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x29')]=_['keys'](db[_0xdac9('0x28')][_0xdac9('0x41')]);_0x5335ae[_0xdac9('0x2b')]=_[_0xdac9('0x2a')](_0x24b570[_0xdac9('0x2b')]);_0x5335ae[_0xdac9('0x2d')]=_['intersection'](_0x5335ae[_0xdac9('0x29')],_0x5335ae['query']);_0x441676[_0xdac9('0x2f')]=_[_0xdac9('0x2e')](_0x5335ae[_0xdac9('0x29')],qs[_0xdac9('0x30')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x2f')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x29')];if(_0x24b570[_0xdac9('0x2b')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x38')]({},_0x441676,_0x24b570[_0xdac9('0x39')]);return db[_0xdac9('0x28')][_0xdac9('0x42')](_0x441676)[_0xdac9('0x20')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x20')](respondWithResult(_0x278826,null))[_0xdac9('0x3e')](handleError(_0x278826,null));};exports[_0xdac9('0x43')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x28')][_0xdac9('0x43')](_0x5c008b[_0xdac9('0x44')],{})[_0xdac9('0x20')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x3e')](handleError(_0x621cf,null));};exports[_0xdac9('0x1f')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x44')]['id']){delete _0x37b498[_0xdac9('0x44')]['id'];}return db[_0xdac9('0x28')][_0xdac9('0x42')]({'where':{'id':_0x37b498[_0xdac9('0x40')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x20')](respondWithResult(_0x140dc5,null))[_0xdac9('0x3e')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x28')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x40')]['id']}})[_0xdac9('0x20')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x45')]=function(_0x4469d8,_0x222de9,_0x370532){var _0x39df88=require(_0xdac9('0x46'));var _0x7a40ac=![];var _0x3a77e3={};if(_0x4469d8[_0xdac9('0x2b')][_0xdac9('0x47')]&&_0x4469d8[_0xdac9('0x2b')][_0xdac9('0x47')]===_0xdac9('0x48')){_0x3a77e3[_0xdac9('0x48')]=_0x4469d8[_0xdac9('0x40')]['id'];}else{_0x3a77e3['id']=_0x4469d8['params']['id'];}return db[_0xdac9('0x28')][_0xdac9('0x42')]({'where':_0x3a77e3,'attributes':['id',_0xdac9('0x49'),_0xdac9('0x4a')],'raw':!![]})[_0xdac9('0x20')](handleEntityNotFound(_0x222de9,null))[_0xdac9('0x20')](function(_0x4b118e){if(_0x4b118e){var _0x3ecdf7=util[_0xdac9('0x4b')](_0xdac9('0x4c'),_0x4b118e[_0xdac9('0x4d')]);if(fs[_0xdac9('0x4e')](_0x3ecdf7)){_0x7a40ac=!![];return _0x39df88[_0xdac9('0x4f')](_0x3ecdf7,_0x4b118e[_0xdac9('0x49')],config[_0xdac9('0x50')][_0xdac9('0x51')])['then'](function(){return _0x4b118e;});}return _0x4b118e;}})[_0xdac9('0x20')](function(_0x2c8411){if(_0x2c8411){if(!fs[_0xdac9('0x4e')](_0x2c8411[_0xdac9('0x49')])){throw new db[(_0xdac9('0x52'))][(_0xdac9('0x53'))]('SquareRecording\x20not\x20found');}if(_0x2c8411['filename']){return _0x222de9[_0xdac9('0x45')](_0x2c8411[_0xdac9('0x49')],_0x2c8411[_0xdac9('0x4a')]+path[_0xdac9('0x54')](_0x2c8411[_0xdac9('0x49')]),function(){if(_0x7a40ac){fs[_0xdac9('0x55')](_0x2c8411['savePath']);}});}else{return _0x222de9['download'](_0x2c8411['savePath'],function(_0xec5f49){if(_0x7a40ac){fs[_0xdac9('0x55')](_0x2c8411[_0xdac9('0x49')]);}});}}})[_0xdac9('0x3e')](handleError(_0x222de9,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index d9c971d..98f4f14 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 _0x425d=['bluebird','request-promise','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','api','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x425d,0x1e0));var _0xd425=function(_0x4ff597,_0x3b950a){_0x4ff597=_0x4ff597-0x0;var _0xd51646=_0x425d[_0x4ff597];return _0xd51646;};'use strict';var _=require(_0xd425('0x0'));var util=require('util');var logger=require(_0xd425('0x1'))(_0xd425('0x2'));var moment=require(_0xd425('0x3'));var BPromise=require(_0xd425('0x4'));var rp=require(_0xd425('0x5'));var attributes=require(_0xd425('0x6'));module[_0xd425('0x7')]=function(_0x596be7,_0x2987c5){return _0x596be7[_0xd425('0x8')](_0xd425('0x9'),attributes,{'tableName':_0xd425('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20d7=['square_recordings','../../config/logger','api','moment','exports'];(function(_0x278480,_0x2632dd){var _0x1cfb03=function(_0x359f80){while(--_0x359f80){_0x278480['push'](_0x278480['shift']());}};_0x1cfb03(++_0x2632dd);}(_0x20d7,0x146));var _0x720d=function(_0x43f60d,_0x56ae9e){_0x43f60d=_0x43f60d-0x0;var _0x202121=_0x20d7[_0x43f60d];return _0x202121;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x720d('0x0'))(_0x720d('0x1'));var moment=require(_0x720d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./squareRecording.attributes');module[_0x720d('0x3')]=function(_0x241e8d,_0x4cb8df){return _0x241e8d['define']('SquareRecording',attributes,{'tableName':_0x720d('0x4'),'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 79d5101..c885e5f 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 _0x5650=['code','message','result','catch','CreateSquareRecording','SquareRecording','create','options','raw','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','error'];(function(_0x571a99,_0x458daa){var _0x3c0508=function(_0x4aa76c){while(--_0x4aa76c){_0x571a99['push'](_0x571a99['shift']());}};_0x3c0508(++_0x458daa);}(_0x5650,0x1e6));var _0x0565=function(_0x3f0cb4,_0x49ec71){_0x3f0cb4=_0x3f0cb4-0x0;var _0x5f33b0=_0x5650[_0x3f0cb4];return _0x5f33b0;};'use strict';var _=require(_0x0565('0x0'));var util=require(_0x0565('0x1'));var moment=require('moment');var BPromise=require(_0x0565('0x2'));var rs=require(_0x0565('0x3'));var fs=require('fs');var db=require(_0x0565('0x4'))['db'];var utils=require(_0x0565('0x5'));var logger=require(_0x0565('0x6'))(_0x0565('0x7'));var config=require(_0x0565('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0565('0x9')][_0x0565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fce5a,_0xda858a,_0x3d8ba9){return new BPromise(function(_0x4906a2,_0xf675ec){return client[_0x0565('0xb')](_0x4fce5a,_0x3d8ba9)[_0x0565('0xc')](function(_0x95734d){logger[_0x0565('0xd')](_0x0565('0xe'),_0xda858a,'request\x20sent');logger[_0x0565('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0xda858a,_0x0565('0x10'),JSON['stringify'](_0x95734d));if(_0x95734d['error']){if(_0x95734d[_0x0565('0x11')][_0x0565('0x12')]===0x1f4){logger['error'](_0x0565('0xe'),_0xda858a,_0x95734d['error'][_0x0565('0x13')]);return _0xf675ec(_0x95734d[_0x0565('0x11')]['message']);}logger[_0x0565('0x11')](_0x0565('0xe'),_0xda858a,_0x95734d[_0x0565('0x11')][_0x0565('0x13')]);return _0x4906a2(_0x95734d['error'][_0x0565('0x13')]);}else{logger[_0x0565('0xd')](_0x0565('0xe'),_0xda858a,'request\x20sent');_0x4906a2(_0x95734d[_0x0565('0x14')][_0x0565('0x13')]);}})[_0x0565('0x15')](function(_0x346f43){logger[_0x0565('0x11')]('SquareRecording,\x20%s,\x20%s',_0xda858a,_0x346f43);_0xf675ec(_0x346f43);});});}exports[_0x0565('0x16')]=function(_0x2eed10){var _0x485b8d=this;return new Promise(function(_0x11ef6b,_0x30efe1){return db[_0x0565('0x17')][_0x0565('0x18')](_0x2eed10['body'],{'raw':_0x2eed10[_0x0565('0x19')]?_0x2eed10[_0x0565('0x19')][_0x0565('0x1a')]===undefined?!![]:![]:!![]})[_0x0565('0xc')](function(_0x65ae69){logger[_0x0565('0xd')](_0x0565('0x16'),_0x2eed10);logger['debug'](_0x0565('0x16'),_0x2eed10,JSON[_0x0565('0x1b')](_0x65ae69));_0x11ef6b(_0x65ae69);})[_0x0565('0x15')](function(_0x48c26b){logger['error'](_0x0565('0x16'),_0x48c26b[_0x0565('0x13')],_0x2eed10);_0x30efe1(_0x485b8d[_0x0565('0x11')](0x1f4,_0x48c26b['message']));});});}; \ No newline at end of file +var _0xfe85=['catch','CreateSquareRecording','body','options','raw','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareRecording,\x20%s,\x20%s','result'];(function(_0x5b1509,_0x16b638){var _0x3fa970=function(_0x3bbfe8){while(--_0x3bbfe8){_0x5b1509['push'](_0x5b1509['shift']());}};_0x3fa970(++_0x16b638);}(_0xfe85,0x13d));var _0x5fe8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfe85[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x5fe8('0x0'));var moment=require(_0x5fe8('0x1'));var BPromise=require(_0x5fe8('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x5fe8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5fe8('0x4'))(_0x5fe8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5fe8('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x321eb0,_0x33206f,_0x270ea4){return new BPromise(function(_0x3f7355,_0x1dd0e8){return client[_0x5fe8('0x7')](_0x321eb0,_0x270ea4)[_0x5fe8('0x8')](function(_0x4d3725){logger[_0x5fe8('0x9')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x5fe8('0xa'));logger[_0x5fe8('0xb')](_0x5fe8('0xc'),_0x33206f,'request\x20sent',JSON[_0x5fe8('0xd')](_0x4d3725));if(_0x4d3725[_0x5fe8('0xe')]){if(_0x4d3725[_0x5fe8('0xe')][_0x5fe8('0xf')]===0x1f4){logger[_0x5fe8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x4d3725[_0x5fe8('0xe')]['message']);return _0x1dd0e8(_0x4d3725[_0x5fe8('0xe')][_0x5fe8('0x10')]);}logger[_0x5fe8('0xe')](_0x5fe8('0x11'),_0x33206f,_0x4d3725[_0x5fe8('0xe')]['message']);return _0x3f7355(_0x4d3725[_0x5fe8('0xe')]['message']);}else{logger[_0x5fe8('0x9')](_0x5fe8('0x11'),_0x33206f,_0x5fe8('0xa'));_0x3f7355(_0x4d3725[_0x5fe8('0x12')][_0x5fe8('0x10')]);}})[_0x5fe8('0x13')](function(_0x483c5f){logger[_0x5fe8('0xe')]('SquareRecording,\x20%s,\x20%s',_0x33206f,_0x483c5f);_0x1dd0e8(_0x483c5f);});});}exports[_0x5fe8('0x14')]=function(_0x1ce170){var _0x21ec40=this;return new Promise(function(_0x2d64cd,_0x38dfeb){return db['SquareRecording']['create'](_0x1ce170[_0x5fe8('0x15')],{'raw':_0x1ce170[_0x5fe8('0x16')]?_0x1ce170['options'][_0x5fe8('0x17')]===undefined?!![]:![]:!![]})[_0x5fe8('0x8')](function(_0x380e23){logger[_0x5fe8('0x9')](_0x5fe8('0x14'),_0x1ce170);logger['debug'](_0x5fe8('0x14'),_0x1ce170,JSON['stringify'](_0x380e23));_0x2d64cd(_0x380e23);})[_0x5fe8('0x13')](function(_0xc5f5fb){logger[_0x5fe8('0xe')]('CreateSquareRecording',_0xc5f5fb[_0x5fe8('0x10')],_0x1ce170);_0x38dfeb(_0x21ec40[_0x5fe8('0xe')](0x1f4,_0xc5f5fb[_0x5fe8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index b003827..4d4ae94 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 _0x3591=['get','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x280f4a,_0x2ed8d6){var _0x1bb157=function(_0x37de94){while(--_0x37de94){_0x280f4a['push'](_0x280f4a['shift']());}};_0x1bb157(++_0x2ed8d6);}(_0x3591,0x1ad));var _0x1359=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3591[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1359('0x0'));var util=require('util');var path=require('path');var express=require(_0x1359('0x1'));var router=express[_0x1359('0x2')]();var auth=require(_0x1359('0x3'));var interaction=require(_0x1359('0x4'));var config=require(_0x1359('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x1359('0x6')](),controller[_0x1359('0x7')]);router[_0x1359('0x8')](_0x1359('0x9'),auth[_0x1359('0x6')](),controller[_0x1359('0xa')]);router['get'](_0x1359('0xb'),auth[_0x1359('0x6')](),controller[_0x1359('0xc')]);router[_0x1359('0xd')]('/',auth[_0x1359('0x6')](),controller[_0x1359('0xe')]);router[_0x1359('0xf')](_0x1359('0xb'),auth[_0x1359('0x6')](),controller[_0x1359('0x10')]);router[_0x1359('0x11')](_0x1359('0xb'),auth[_0x1359('0x6')](),controller['destroy']);module[_0x1359('0x12')]=router; \ No newline at end of file +var _0x14c3=['exports','util','path','express','Router','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','/:id','show','post','put','update','delete','destroy'];(function(_0x48ec91,_0x212edc){var _0x22766c=function(_0x136751){while(--_0x136751){_0x48ec91['push'](_0x48ec91['shift']());}};_0x22766c(++_0x212edc);}(_0x14c3,0xeb));var _0x314c=function(_0x57c5f8,_0x27c6ab){_0x57c5f8=_0x57c5f8-0x0;var _0x2aeca8=_0x14c3[_0x57c5f8];return _0x2aeca8;};'use strict';var multer=require('multer');var util=require(_0x314c('0x0'));var path=require(_0x314c('0x1'));var express=require(_0x314c('0x2'));var router=express[_0x314c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x314c('0x4'));var config=require(_0x314c('0x5'));var controller=require('./squareReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x314c('0x6')]);router[_0x314c('0x7')](_0x314c('0x8'),auth[_0x314c('0x9')](),controller['describe']);router[_0x314c('0x7')](_0x314c('0xa'),auth['isAuthenticated'](),controller[_0x314c('0xb')]);router[_0x314c('0xc')]('/',auth[_0x314c('0x9')](),controller['create']);router[_0x314c('0xd')](_0x314c('0xa'),auth[_0x314c('0x9')](),controller[_0x314c('0xe')]);router[_0x314c('0xf')]('/:id',auth[_0x314c('0x9')](),controller[_0x314c('0x10')]);module[_0x314c('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index bc78004..c7e8606 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 _0x33c0=['sequelize','exports','STRING','DATE'];(function(_0x3b9c82,_0x112c59){var _0x76881d=function(_0x2306ed){while(--_0x2306ed){_0x3b9c82['push'](_0x3b9c82['shift']());}};_0x76881d(++_0x112c59);}(_0x33c0,0x17c));var _0x033c=function(_0x193234,_0x43f894){_0x193234=_0x193234-0x0;var _0x5471c6=_0x33c0[_0x193234];return _0x5471c6;};'use strict';var Sequelize=require(_0x033c('0x0'));module[_0x033c('0x1')]={'network':{'type':Sequelize[_0x033c('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x033c('0x2')]},'channel':{'type':Sequelize[_0x033c('0x2')]},'language':{'type':Sequelize[_0x033c('0x2')]},'type':{'type':Sequelize[_0x033c('0x2')]},'uniqueid':{'type':Sequelize[_0x033c('0x2')]},'version':{'type':Sequelize[_0x033c('0x2')]},'callerid':{'type':Sequelize[_0x033c('0x2')]},'calleridname':{'type':Sequelize[_0x033c('0x2')]},'callingpres':{'type':Sequelize[_0x033c('0x2')]},'callingani2':{'type':Sequelize[_0x033c('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x033c('0x2')]},'dnid':{'type':Sequelize[_0x033c('0x2')]},'rdnis':{'type':Sequelize[_0x033c('0x2')]},'context':{'type':Sequelize[_0x033c('0x2')]},'extension':{'type':Sequelize[_0x033c('0x2')]},'priority':{'type':Sequelize[_0x033c('0x2')]},'enhanced':{'type':Sequelize[_0x033c('0x2')]},'accountcode':{'type':Sequelize[_0x033c('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x033c('0x3')]}}; \ No newline at end of file +var _0x0fc1=['sequelize','exports','STRING','DATE'];(function(_0x5ccca6,_0x4e6957){var _0x22afba=function(_0x3fc204){while(--_0x3fc204){_0x5ccca6['push'](_0x5ccca6['shift']());}};_0x22afba(++_0x4e6957);}(_0x0fc1,0x1d0));var _0x10fc=function(_0x27919b,_0x47449e){_0x27919b=_0x27919b-0x0;var _0x594fc8=_0x0fc1[_0x27919b];return _0x594fc8;};'use strict';var Sequelize=require(_0x10fc('0x0'));module[_0x10fc('0x1')]={'network':{'type':Sequelize[_0x10fc('0x2')]},'network_script':{'type':Sequelize[_0x10fc('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x10fc('0x2')]},'language':{'type':Sequelize[_0x10fc('0x2')]},'type':{'type':Sequelize[_0x10fc('0x2')]},'uniqueid':{'type':Sequelize[_0x10fc('0x2')]},'version':{'type':Sequelize[_0x10fc('0x2')]},'callerid':{'type':Sequelize[_0x10fc('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x10fc('0x2')]},'callingani2':{'type':Sequelize[_0x10fc('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x10fc('0x2')]},'dnid':{'type':Sequelize[_0x10fc('0x2')]},'rdnis':{'type':Sequelize[_0x10fc('0x2')]},'context':{'type':Sequelize[_0x10fc('0x2')]},'extension':{'type':Sequelize[_0x10fc('0x2')]},'priority':{'type':Sequelize[_0x10fc('0x2')]},'enhanced':{'type':Sequelize[_0x10fc('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x10fc('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x10fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 2223bb1..fa84fd5 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 _0x9f62=['filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','add','day','merge','filter','where','includeAll','findAll','rows','catch','fields','include','find','create','body','params','describe','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../config/environment','../../mysqldb','sendStatus','end','count','offset','limit','status','set','Content-Range','json','reject','save','update','destroy','then','error','name','send','SquareReport','rawAttributes','model','keys','query','dateStart','dateEnd'];(function(_0x39c8f2,_0x23df6c){var _0x445526=function(_0x56376c){while(--_0x56376c){_0x39c8f2['push'](_0x39c8f2['shift']());}};_0x445526(++_0x23df6c);}(_0x9f62,0x154));var _0x29f6=function(_0x720c4e,_0xbdd516){_0x720c4e=_0x720c4e-0x0;var _0x27a3cb=_0x9f62[_0x720c4e];return _0x27a3cb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var Mustache=require(_0x29f6('0x2'));var util=require(_0x29f6('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0x29f6('0x4'));var ejs=require(_0x29f6('0x5'));var fs=require('fs');var _=require(_0x29f6('0x6'));var squel=require(_0x29f6('0x7'));var crypto=require('crypto');var jsforce=require(_0x29f6('0x8'));var deskjs=require(_0x29f6('0x9'));var toCsv=require(_0x29f6('0x4'));var querystring=require(_0x29f6('0xa'));var Papa=require(_0x29f6('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x29f6('0xc'));var db=require(_0x29f6('0xd'))['db'];function respondWithStatusCode(_0x4fb455,_0x5a0724){_0x5a0724=_0x5a0724||0xcc;return function(_0x29b3f5){if(_0x29b3f5){return _0x4fb455[_0x29f6('0xe')](_0x5a0724);}return _0x4fb455['status'](_0x5a0724)[_0x29f6('0xf')]();};}function respondWithResult(_0xfa6765,_0x5cf872){_0x5cf872=_0x5cf872||0xc8;return function(_0x5b9b6a){if(_0x5b9b6a){return _0xfa6765['status'](_0x5cf872)['json'](_0x5b9b6a);}};}function respondWithFilteredResult(_0x2ae0e4,_0x55cf4){return function(_0x189344){if(_0x189344){var _0x11a1fd=_0x189344[_0x29f6('0x10')],_0x17de6e=_0x55cf4[_0x29f6('0x11')],_0x156c96=_0x55cf4[_0x29f6('0x11')]+_0x55cf4[_0x29f6('0x12')],_0x35d2e2;if(_0x156c96>=_0x11a1fd){_0x156c96=_0x11a1fd;_0x35d2e2=0xc8;}else{_0x35d2e2=0xce;}_0x2ae0e4[_0x29f6('0x13')](_0x35d2e2);return _0x2ae0e4[_0x29f6('0x14')](_0x29f6('0x15'),_0x17de6e+'-'+_0x156c96+'/'+_0x11a1fd)[_0x29f6('0x16')](_0x189344);}return null;};}function patchUpdates(_0x14dd56){return function(_0x3584a1){try{jsonpatch['apply'](_0x3584a1,_0x14dd56,!![]);}catch(_0x51c92f){return BPromise[_0x29f6('0x17')](_0x51c92f);}return _0x3584a1[_0x29f6('0x18')]();};}function saveUpdates(_0xb31436,_0x5c8246){return function(_0xcb90){if(_0xcb90){return _0xcb90[_0x29f6('0x19')](_0xb31436)['then'](function(_0x159227){return _0x159227;});}return null;};}function removeEntity(_0x3e81af,_0x42a8fa){return function(_0x41b9f0){if(_0x41b9f0){return _0x41b9f0[_0x29f6('0x1a')]()[_0x29f6('0x1b')](function(){_0x3e81af['status'](0xcc)[_0x29f6('0xf')]();});}};}function handleEntityNotFound(_0x59def4,_0x4acb15){return function(_0x470019){if(!_0x470019){_0x59def4[_0x29f6('0xe')](0x194);}return _0x470019;};}function handleError(_0x39c6b3,_0xafb5dd){_0xafb5dd=_0xafb5dd||0x1f4;return function(_0x54ddeb){logger[_0x29f6('0x1c')](_0x54ddeb['stack']);if(_0x54ddeb[_0x29f6('0x1d')]){delete _0x54ddeb[_0x29f6('0x1d')];}_0x39c6b3[_0x29f6('0x13')](_0xafb5dd)[_0x29f6('0x1e')](_0x54ddeb);};}exports['index']=function(_0x4290a2,_0x4d494f){var _0x47c385={},_0x1401fb={},_0x45f792={'count':0x0,'rows':[]};var _0x2519ac=db[_0x29f6('0x1f')][_0x29f6('0x20')];_0x1401fb[_0x29f6('0x21')]=_[_0x29f6('0x22')](_0x2519ac);var _0x50cdd2={'dateStart':_0x4290a2[_0x29f6('0x23')][_0x29f6('0x24')],'dateEnd':_0x4290a2[_0x29f6('0x23')][_0x29f6('0x25')]};delete _0x4290a2[_0x29f6('0x23')][_0x29f6('0x24')];delete _0x4290a2[_0x29f6('0x23')][_0x29f6('0x25')];_0x1401fb[_0x29f6('0x23')]=_[_0x29f6('0x22')](_0x4290a2[_0x29f6('0x23')]);_0x1401fb[_0x29f6('0x26')]=_[_0x29f6('0x27')](_0x1401fb[_0x29f6('0x21')],_0x1401fb[_0x29f6('0x23')]);_0x47c385[_0x29f6('0x28')]=_[_0x29f6('0x27')](_0x1401fb['model'],qs['fields'](_0x4290a2[_0x29f6('0x23')]['fields']));_0x47c385[_0x29f6('0x28')]=_0x47c385[_0x29f6('0x28')][_0x29f6('0x29')]?_0x47c385[_0x29f6('0x28')]:_0x1401fb['model'];if(!_0x4290a2['query'][_0x29f6('0x2a')](_0x29f6('0x2b'))){_0x47c385[_0x29f6('0x12')]=qs[_0x29f6('0x12')](_0x4290a2[_0x29f6('0x23')][_0x29f6('0x12')]);_0x47c385[_0x29f6('0x11')]=qs[_0x29f6('0x11')](_0x4290a2[_0x29f6('0x23')][_0x29f6('0x11')]);}_0x47c385[_0x29f6('0x2c')]=qs[_0x29f6('0x2d')](_0x4290a2[_0x29f6('0x23')][_0x29f6('0x2d')]);_0x47c385['where']=qs['filters'](_[_0x29f6('0x2e')](_0x4290a2[_0x29f6('0x23')],_0x1401fb[_0x29f6('0x26')]));if(_0x50cdd2['dateStart']){if(_0x50cdd2[_0x29f6('0x25')]){_0x50cdd2[_0x29f6('0x25')]=moment(_0x50cdd2[_0x29f6('0x25')])[_0x29f6('0x2f')](0x1,_0x29f6('0x30'));}else{_0x50cdd2['dateEnd']=moment(_0x50cdd2[_0x29f6('0x24')])[_0x29f6('0x2f')](0x1,_0x29f6('0x30'));}_[_0x29f6('0x31')](_0x47c385['where'],{'createdAt':{'$gte':_0x50cdd2[_0x29f6('0x24')],'$lte':_0x50cdd2[_0x29f6('0x25')]}});}if(_0x4290a2[_0x29f6('0x23')][_0x29f6('0x32')]){_0x47c385['where']=_['merge'](_0x47c385[_0x29f6('0x33')],{'$or':_['map'](_0x47c385[_0x29f6('0x28')],function(_0x551411){var _0x3a1a75={};_0x3a1a75[_0x551411]={'$like':'%'+_0x4290a2['query'][_0x29f6('0x32')]+'%'};return _0x3a1a75;})});}_0x47c385=_[_0x29f6('0x31')]({},_0x47c385,_0x4290a2['options']);var _0x1431fc={'where':_0x47c385['where']};return db[_0x29f6('0x1f')][_0x29f6('0x10')](_0x1431fc)['then'](function(_0xf9c531){_0x45f792[_0x29f6('0x10')]=_0xf9c531;if(_0x4290a2[_0x29f6('0x23')][_0x29f6('0x34')]){_0x47c385['include']=[{'all':!![]}];}return db[_0x29f6('0x1f')][_0x29f6('0x35')](_0x47c385);})[_0x29f6('0x1b')](function(_0x2322eb){_0x45f792[_0x29f6('0x36')]=_0x2322eb;return _0x45f792;})['then'](respondWithFilteredResult(_0x4d494f,_0x47c385))[_0x29f6('0x37')](handleError(_0x4d494f,null));};exports['show']=function(_0x2ea303,_0x552257){var _0xbfe671={'raw':!![],'where':{'id':_0x2ea303['params']['id']}},_0x3a8a12={};_0x3a8a12[_0x29f6('0x21')]=_[_0x29f6('0x22')](db[_0x29f6('0x1f')][_0x29f6('0x20')]);_0x3a8a12['query']=_[_0x29f6('0x22')](_0x2ea303[_0x29f6('0x23')]);_0x3a8a12[_0x29f6('0x26')]=_['intersection'](_0x3a8a12[_0x29f6('0x21')],_0x3a8a12['query']);_0xbfe671[_0x29f6('0x28')]=_['intersection'](_0x3a8a12['model'],qs['fields'](_0x2ea303[_0x29f6('0x23')][_0x29f6('0x38')]));_0xbfe671[_0x29f6('0x28')]=_0xbfe671[_0x29f6('0x28')][_0x29f6('0x29')]?_0xbfe671[_0x29f6('0x28')]:_0x3a8a12[_0x29f6('0x21')];if(_0x2ea303[_0x29f6('0x23')][_0x29f6('0x34')]){_0xbfe671[_0x29f6('0x39')]=[{'all':!![]}];}_0xbfe671=_['merge']({},_0xbfe671,_0x2ea303['options']);return db[_0x29f6('0x1f')][_0x29f6('0x3a')](_0xbfe671)[_0x29f6('0x1b')](handleEntityNotFound(_0x552257,null))[_0x29f6('0x1b')](respondWithResult(_0x552257,null))['catch'](handleError(_0x552257,null));};exports[_0x29f6('0x3b')]=function(_0x1f5609,_0x532df5){return db[_0x29f6('0x1f')][_0x29f6('0x3b')](_0x1f5609[_0x29f6('0x3c')],{})[_0x29f6('0x1b')](respondWithResult(_0x532df5,0xc9))[_0x29f6('0x37')](handleError(_0x532df5,null));};exports[_0x29f6('0x19')]=function(_0x320b5e,_0x1f03b6){if(_0x320b5e[_0x29f6('0x3c')]['id']){delete _0x320b5e[_0x29f6('0x3c')]['id'];}return db[_0x29f6('0x1f')][_0x29f6('0x3a')]({'where':{'id':_0x320b5e['params']['id']}})[_0x29f6('0x1b')](handleEntityNotFound(_0x1f03b6,null))[_0x29f6('0x1b')](saveUpdates(_0x320b5e[_0x29f6('0x3c')],null))[_0x29f6('0x1b')](respondWithResult(_0x1f03b6,null))[_0x29f6('0x37')](handleError(_0x1f03b6,null));};exports['destroy']=function(_0x2e29e3,_0x52be22){return db['SquareReport'][_0x29f6('0x3a')]({'where':{'id':_0x2e29e3[_0x29f6('0x3d')]['id']}})[_0x29f6('0x1b')](handleEntityNotFound(_0x52be22,null))[_0x29f6('0x1b')](removeEntity(_0x52be22,null))[_0x29f6('0x37')](handleError(_0x52be22,null));};exports['describe']=function(_0x167976,_0x458ada){return db['SquareReport'][_0x29f6('0x3e')]()['then'](respondWithResult(_0x458ada,null))[_0x29f6('0x37')](handleError(_0x458ada,null));}; \ No newline at end of file +var _0x54ef=['rows','catch','params','filters','includeAll','include','find','create','body','describe','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','apply','reject','save','update','then','destroy','stack','name','send','index','SquareReport','rawAttributes','model','dateStart','dateEnd','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','day','add','merge','where','filter','options','findAll'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0x54ef,0x112));var _0xf54e=function(_0x333d9d,_0x599648){_0x333d9d=_0x333d9d-0x0;var _0x64746a=_0x54ef[_0x333d9d];return _0x64746a;};'use strict';var jsonpatch=require(_0xf54e('0x0'));var rp=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xf54e('0x3'));var util=require(_0xf54e('0x4'));var path=require(_0xf54e('0x5'));var sox=require(_0xf54e('0x6'));var csv=require(_0xf54e('0x7'));var ejs=require(_0xf54e('0x8'));var fs=require('fs');var _=require(_0xf54e('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf54e('0xa'));var deskjs=require(_0xf54e('0xb'));var toCsv=require(_0xf54e('0x7'));var querystring=require('querystring');var Papa=require(_0xf54e('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xf54e('0xd'))(_0xf54e('0xe'));var utils=require('../../config/utils');var config=require(_0xf54e('0xf'));var db=require(_0xf54e('0x10'))['db'];function respondWithStatusCode(_0x6b9e61,_0x3ecfb3){_0x3ecfb3=_0x3ecfb3||0xcc;return function(_0x5f232a){if(_0x5f232a){return _0x6b9e61[_0xf54e('0x11')](_0x3ecfb3);}return _0x6b9e61[_0xf54e('0x12')](_0x3ecfb3)[_0xf54e('0x13')]();};}function respondWithResult(_0x326eef,_0x553759){_0x553759=_0x553759||0xc8;return function(_0x358c88){if(_0x358c88){return _0x326eef['status'](_0x553759)['json'](_0x358c88);}};}function respondWithFilteredResult(_0x15a9d4,_0x2033e9){return function(_0x28f776){if(_0x28f776){var _0x380f26=_0x28f776[_0xf54e('0x14')],_0x5644aa=_0x2033e9[_0xf54e('0x15')],_0x331732=_0x2033e9['offset']+_0x2033e9[_0xf54e('0x16')],_0x1bbeaa;if(_0x331732>=_0x380f26){_0x331732=_0x380f26;_0x1bbeaa=0xc8;}else{_0x1bbeaa=0xce;}_0x15a9d4[_0xf54e('0x12')](_0x1bbeaa);return _0x15a9d4[_0xf54e('0x17')]('Content-Range',_0x5644aa+'-'+_0x331732+'/'+_0x380f26)['json'](_0x28f776);}return null;};}function patchUpdates(_0xd87020){return function(_0x41fb35){try{jsonpatch[_0xf54e('0x18')](_0x41fb35,_0xd87020,!![]);}catch(_0x9647f){return BPromise[_0xf54e('0x19')](_0x9647f);}return _0x41fb35[_0xf54e('0x1a')]();};}function saveUpdates(_0x2e27b6,_0x1ef06e){return function(_0x1dcc04){if(_0x1dcc04){return _0x1dcc04[_0xf54e('0x1b')](_0x2e27b6)[_0xf54e('0x1c')](function(_0x50fc66){return _0x50fc66;});}return null;};}function removeEntity(_0x48a7e1,_0x23e14){return function(_0x59f338){if(_0x59f338){return _0x59f338[_0xf54e('0x1d')]()[_0xf54e('0x1c')](function(){_0x48a7e1[_0xf54e('0x12')](0xcc)[_0xf54e('0x13')]();});}};}function handleEntityNotFound(_0xf64f12,_0x3887b0){return function(_0x388aa0){if(!_0x388aa0){_0xf64f12[_0xf54e('0x11')](0x194);}return _0x388aa0;};}function handleError(_0x3c0169,_0x5f9eea){_0x5f9eea=_0x5f9eea||0x1f4;return function(_0x1c58bd){logger['error'](_0x1c58bd[_0xf54e('0x1e')]);if(_0x1c58bd['name']){delete _0x1c58bd[_0xf54e('0x1f')];}_0x3c0169[_0xf54e('0x12')](_0x5f9eea)[_0xf54e('0x20')](_0x1c58bd);};}exports[_0xf54e('0x21')]=function(_0x3805a7,_0x160160){var _0x1e08d1={},_0x43488d={},_0x2342a9={'count':0x0,'rows':[]};var _0x33457f=db[_0xf54e('0x22')][_0xf54e('0x23')];_0x43488d[_0xf54e('0x24')]=_['keys'](_0x33457f);var _0xb3706e={'dateStart':_0x3805a7['query'][_0xf54e('0x25')],'dateEnd':_0x3805a7['query'][_0xf54e('0x26')]};delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x25')];delete _0x3805a7[_0xf54e('0x27')][_0xf54e('0x26')];_0x43488d[_0xf54e('0x27')]=_[_0xf54e('0x28')](_0x3805a7['query']);_0x43488d['filters']=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],_0x43488d[_0xf54e('0x27')]);_0x1e08d1[_0xf54e('0x2a')]=_[_0xf54e('0x29')](_0x43488d[_0xf54e('0x24')],qs[_0xf54e('0x2b')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x2b')]));_0x1e08d1[_0xf54e('0x2a')]=_0x1e08d1['attributes']['length']?_0x1e08d1[_0xf54e('0x2a')]:_0x43488d[_0xf54e('0x24')];if(!_0x3805a7['query'][_0xf54e('0x2c')](_0xf54e('0x2d'))){_0x1e08d1[_0xf54e('0x16')]=qs[_0xf54e('0x16')](_0x3805a7['query']['limit']);_0x1e08d1['offset']=qs[_0xf54e('0x15')](_0x3805a7[_0xf54e('0x27')][_0xf54e('0x15')]);}_0x1e08d1[_0xf54e('0x2e')]=qs[_0xf54e('0x2f')](_0x3805a7[_0xf54e('0x27')]['sort']);_0x1e08d1['where']=qs['filters'](_[_0xf54e('0x30')](_0x3805a7[_0xf54e('0x27')],_0x43488d['filters']));if(_0xb3706e['dateStart']){if(_0xb3706e[_0xf54e('0x26')]){_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e[_0xf54e('0x26')])['add'](0x1,_0xf54e('0x31'));}else{_0xb3706e[_0xf54e('0x26')]=moment(_0xb3706e['dateStart'])[_0xf54e('0x32')](0x1,_0xf54e('0x31'));}_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'createdAt':{'$gte':_0xb3706e[_0xf54e('0x25')],'$lte':_0xb3706e[_0xf54e('0x26')]}});}if(_0x3805a7['query']['filter']){_0x1e08d1[_0xf54e('0x34')]=_[_0xf54e('0x33')](_0x1e08d1[_0xf54e('0x34')],{'$or':_['map'](_0x1e08d1[_0xf54e('0x2a')],function(_0x22fa6f){var _0x448054={};_0x448054[_0x22fa6f]={'$like':'%'+_0x3805a7[_0xf54e('0x27')][_0xf54e('0x35')]+'%'};return _0x448054;})});}_0x1e08d1=_[_0xf54e('0x33')]({},_0x1e08d1,_0x3805a7[_0xf54e('0x36')]);var _0x1345b0={'where':_0x1e08d1[_0xf54e('0x34')]};return db[_0xf54e('0x22')][_0xf54e('0x14')](_0x1345b0)[_0xf54e('0x1c')](function(_0x3dfd4e){_0x2342a9[_0xf54e('0x14')]=_0x3dfd4e;if(_0x3805a7[_0xf54e('0x27')]['includeAll']){_0x1e08d1['include']=[{'all':!![]}];}return db['SquareReport'][_0xf54e('0x37')](_0x1e08d1);})[_0xf54e('0x1c')](function(_0x5398b2){_0x2342a9[_0xf54e('0x38')]=_0x5398b2;return _0x2342a9;})[_0xf54e('0x1c')](respondWithFilteredResult(_0x160160,_0x1e08d1))[_0xf54e('0x39')](handleError(_0x160160,null));};exports['show']=function(_0x40675f,_0x13d145){var _0x1e016e={'raw':!![],'where':{'id':_0x40675f[_0xf54e('0x3a')]['id']}},_0x794be7={};_0x794be7[_0xf54e('0x24')]=_[_0xf54e('0x28')](db[_0xf54e('0x22')][_0xf54e('0x23')]);_0x794be7['query']=_[_0xf54e('0x28')](_0x40675f[_0xf54e('0x27')]);_0x794be7[_0xf54e('0x3b')]=_[_0xf54e('0x29')](_0x794be7[_0xf54e('0x24')],_0x794be7[_0xf54e('0x27')]);_0x1e016e['attributes']=_[_0xf54e('0x29')](_0x794be7['model'],qs[_0xf54e('0x2b')](_0x40675f['query'][_0xf54e('0x2b')]));_0x1e016e[_0xf54e('0x2a')]=_0x1e016e[_0xf54e('0x2a')]['length']?_0x1e016e[_0xf54e('0x2a')]:_0x794be7[_0xf54e('0x24')];if(_0x40675f[_0xf54e('0x27')][_0xf54e('0x3c')]){_0x1e016e[_0xf54e('0x3d')]=[{'all':!![]}];}_0x1e016e=_['merge']({},_0x1e016e,_0x40675f[_0xf54e('0x36')]);return db[_0xf54e('0x22')][_0xf54e('0x3e')](_0x1e016e)[_0xf54e('0x1c')](handleEntityNotFound(_0x13d145,null))['then'](respondWithResult(_0x13d145,null))[_0xf54e('0x39')](handleError(_0x13d145,null));};exports[_0xf54e('0x3f')]=function(_0x554c1f,_0x22c842){return db[_0xf54e('0x22')][_0xf54e('0x3f')](_0x554c1f[_0xf54e('0x40')],{})['then'](respondWithResult(_0x22c842,0xc9))[_0xf54e('0x39')](handleError(_0x22c842,null));};exports[_0xf54e('0x1b')]=function(_0x2527f6,_0xb4654f){if(_0x2527f6[_0xf54e('0x40')]['id']){delete _0x2527f6[_0xf54e('0x40')]['id'];}return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0x2527f6[_0xf54e('0x3a')]['id']}})[_0xf54e('0x1c')](handleEntityNotFound(_0xb4654f,null))[_0xf54e('0x1c')](saveUpdates(_0x2527f6[_0xf54e('0x40')],null))[_0xf54e('0x1c')](respondWithResult(_0xb4654f,null))[_0xf54e('0x39')](handleError(_0xb4654f,null));};exports[_0xf54e('0x1d')]=function(_0xa6c305,_0x40d8ab){return db[_0xf54e('0x22')][_0xf54e('0x3e')]({'where':{'id':_0xa6c305[_0xf54e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x40d8ab,null))['then'](removeEntity(_0x40d8ab,null))[_0xf54e('0x39')](handleError(_0x40d8ab,null));};exports[_0xf54e('0x41')]=function(_0x45861b,_0x40557d){return db[_0xf54e('0x22')][_0xf54e('0x41')]()[_0xf54e('0x1c')](respondWithResult(_0x40557d,null))[_0xf54e('0x39')](handleError(_0x40557d,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 4941236..9f23dc5 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 _0x89de=['define','SquareReport','report_square','uid_pname','project_name','leaveAt','util','api','moment','bluebird','./squareReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x89de,0x10e));var _0xe89d=function(_0x348be8,_0x5f2e09){_0x348be8=_0x348be8-0x0;var _0x52abd9=_0x89de[_0x348be8];return _0x52abd9;};'use strict';var _=require('lodash');var util=require(_0xe89d('0x0'));var logger=require('../../config/logger')(_0xe89d('0x1'));var moment=require(_0xe89d('0x2'));var BPromise=require(_0xe89d('0x3'));var rp=require('request-promise');var attributes=require(_0xe89d('0x4'));module[_0xe89d('0x5')]=function(_0x20d055,_0x2b76ef){return _0x20d055[_0xe89d('0x6')](_0xe89d('0x7'),attributes,{'tableName':_0xe89d('0x8'),'paranoid':![],'indexes':[{'name':_0xe89d('0x9'),'fields':['uniqueid',_0xe89d('0xa')]},{'name':'leaveAt','fields':[_0xe89d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9107=['api','moment','bluebird','./squareReport.attributes','exports','uniqueid','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0xd520e,_0x42d39c){var _0x48973e=function(_0x533543){while(--_0x533543){_0xd520e['push'](_0xd520e['shift']());}};_0x48973e(++_0x42d39c);}(_0x9107,0xef));var _0x7910=function(_0x239340,_0x361e19){_0x239340=_0x239340-0x0;var _0x2cd5b3=_0x9107[_0x239340];return _0x2cd5b3;};'use strict';var _=require(_0x7910('0x0'));var util=require(_0x7910('0x1'));var logger=require(_0x7910('0x2'))(_0x7910('0x3'));var moment=require(_0x7910('0x4'));var BPromise=require(_0x7910('0x5'));var rp=require('request-promise');var attributes=require(_0x7910('0x6'));module[_0x7910('0x7')]=function(_0x2c3621,_0x27d1ce){return _0x2c3621['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x7910('0x8'),_0x7910('0x9')]},{'name':_0x7910('0xa'),'fields':[_0x7910('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c002691..f6f93c5 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 _0x039b=['UpdateSquareReport','where','attributes','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','message','result','SquareReport','create','body','options','raw','CreateSquareReport','stringify','catch'];(function(_0x140cbe,_0xc6b12){var _0x51c4c8=function(_0x6f7e15){while(--_0x6f7e15){_0x140cbe['push'](_0x140cbe['shift']());}};_0x51c4c8(++_0xc6b12);}(_0x039b,0x199));var _0xb039=function(_0x433c5b,_0x50c160){_0x433c5b=_0x433c5b-0x0;var _0x566adf=_0x039b[_0x433c5b];return _0x566adf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb039('0x0'));var BPromise=require(_0xb039('0x1'));var rs=require(_0xb039('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb039('0x3'));var config=require(_0xb039('0x4'));var jayson=require(_0xb039('0x5'));var client=jayson[_0xb039('0x6')][_0xb039('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c1811,_0x53f824,_0x22e8c8){return new BPromise(function(_0x1b59ad,_0x25c0ed){return client[_0xb039('0x8')](_0x2c1811,_0x22e8c8)[_0xb039('0x9')](function(_0x5dae86){logger[_0xb039('0xa')](_0xb039('0xb'),_0x53f824,_0xb039('0xc'));logger[_0xb039('0xd')](_0xb039('0xe'),_0x53f824,'request\x20sent',JSON['stringify'](_0x5dae86));if(_0x5dae86[_0xb039('0xf')]){if(_0x5dae86[_0xb039('0xf')]['code']===0x1f4){logger[_0xb039('0xf')](_0xb039('0xb'),_0x53f824,_0x5dae86[_0xb039('0xf')][_0xb039('0x10')]);return _0x25c0ed(_0x5dae86[_0xb039('0xf')][_0xb039('0x10')]);}logger[_0xb039('0xf')](_0xb039('0xb'),_0x53f824,_0x5dae86[_0xb039('0xf')][_0xb039('0x10')]);return _0x1b59ad(_0x5dae86[_0xb039('0xf')][_0xb039('0x10')]);}else{logger[_0xb039('0xa')](_0xb039('0xb'),_0x53f824,_0xb039('0xc'));_0x1b59ad(_0x5dae86[_0xb039('0x11')][_0xb039('0x10')]);}})['catch'](function(_0x489c32){logger[_0xb039('0xf')]('SquareReport,\x20%s,\x20%s',_0x53f824,_0x489c32);_0x25c0ed(_0x489c32);});});}exports['CreateSquareReport']=function(_0x3a2ce9){var _0x4fe95c=this;return new Promise(function(_0x40b09d,_0x495996){return db[_0xb039('0x12')][_0xb039('0x13')](_0x3a2ce9[_0xb039('0x14')],{'raw':_0x3a2ce9[_0xb039('0x15')]?_0x3a2ce9['options'][_0xb039('0x16')]===undefined?!![]:![]:!![]})[_0xb039('0x9')](function(_0x30cb75){logger[_0xb039('0xa')](_0xb039('0x17'),_0x3a2ce9);logger[_0xb039('0xd')](_0xb039('0x17'),_0x3a2ce9,JSON[_0xb039('0x18')](_0x30cb75));_0x40b09d(_0x30cb75);})[_0xb039('0x19')](function(_0x34b4b8){logger[_0xb039('0xf')](_0xb039('0x17'),_0x34b4b8[_0xb039('0x10')],_0x3a2ce9);_0x495996(_0x4fe95c[_0xb039('0xf')](0x1f4,_0x34b4b8['message']));});});};exports[_0xb039('0x1a')]=function(_0x3534ec){var _0x2b2e83=this;return new Promise(function(_0xd61279,_0x5475dd){return db[_0xb039('0x12')]['update'](_0x3534ec[_0xb039('0x14')],{'raw':_0x3534ec['options']?_0x3534ec[_0xb039('0x15')][_0xb039('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3534ec[_0xb039('0x15')]?_0x3534ec[_0xb039('0x15')][_0xb039('0x1b')]||null:null,'attributes':_0x3534ec[_0xb039('0x15')]?_0x3534ec[_0xb039('0x15')][_0xb039('0x1c')]||null:null,'limit':_0x3534ec[_0xb039('0x15')]?_0x3534ec[_0xb039('0x15')]['limit']||null:null})['then'](function(_0x4b290a){logger['info'](_0xb039('0x1a'),_0x3534ec);logger['debug'](_0xb039('0x1a'),_0x3534ec,JSON['stringify'](_0x4b290a));_0xd61279(_0x4b290a);})[_0xb039('0x19')](function(_0x32e96b){logger[_0xb039('0xf')](_0xb039('0x1a'),_0x32e96b[_0xb039('0x10')],_0x3534ec);_0x5475dd(_0x2b2e83[_0xb039('0xf')](0x1f4,_0x32e96b[_0xb039('0x10')]));});});}; \ No newline at end of file +var _0xd298=['attributes','limit','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareReport','SquareReport','create','UpdateSquareReport','update','body','options','raw','where'];(function(_0x24994d,_0x5dd114){var _0x1a3545=function(_0x49c6c9){while(--_0x49c6c9){_0x24994d['push'](_0x24994d['shift']());}};_0x1a3545(++_0x5dd114);}(_0xd298,0x162));var _0x8d29=function(_0x3342e8,_0x401082){_0x3342e8=_0x3342e8-0x0;var _0x28c7b9=_0xd298[_0x3342e8];return _0x28c7b9;};'use strict';var _=require(_0x8d29('0x0'));var util=require(_0x8d29('0x1'));var moment=require(_0x8d29('0x2'));var BPromise=require(_0x8d29('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x8d29('0x4'));var logger=require(_0x8d29('0x5'))(_0x8d29('0x6'));var config=require('../../config/environment');var jayson=require(_0x8d29('0x7'));var client=jayson['client'][_0x8d29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x218303,_0x13a8f7,_0x1294ae){return new BPromise(function(_0x34d002,_0x30a310){return client[_0x8d29('0x9')](_0x218303,_0x1294ae)[_0x8d29('0xa')](function(_0x5d6d3e){logger[_0x8d29('0xb')](_0x8d29('0xc'),_0x13a8f7,_0x8d29('0xd'));logger[_0x8d29('0xe')](_0x8d29('0xf'),_0x13a8f7,'request\x20sent',JSON['stringify'](_0x5d6d3e));if(_0x5d6d3e[_0x8d29('0x10')]){if(_0x5d6d3e[_0x8d29('0x10')][_0x8d29('0x11')]===0x1f4){logger['error'](_0x8d29('0xc'),_0x13a8f7,_0x5d6d3e[_0x8d29('0x10')]['message']);return _0x30a310(_0x5d6d3e[_0x8d29('0x10')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x13a8f7,_0x5d6d3e[_0x8d29('0x10')][_0x8d29('0x12')]);return _0x34d002(_0x5d6d3e['error'][_0x8d29('0x12')]);}else{logger[_0x8d29('0xb')](_0x8d29('0xc'),_0x13a8f7,_0x8d29('0xd'));_0x34d002(_0x5d6d3e[_0x8d29('0x13')][_0x8d29('0x12')]);}})[_0x8d29('0x14')](function(_0x4c1a67){logger['error'](_0x8d29('0xc'),_0x13a8f7,_0x4c1a67);_0x30a310(_0x4c1a67);});});}exports[_0x8d29('0x15')]=function(_0x24c24e){var _0x1511a8=this;return new Promise(function(_0x3f517f,_0x4a5b49){return db[_0x8d29('0x16')][_0x8d29('0x17')](_0x24c24e['body'],{'raw':_0x24c24e['options']?_0x24c24e['options']['raw']===undefined?!![]:![]:!![]})[_0x8d29('0xa')](function(_0xebfed5){logger[_0x8d29('0xb')](_0x8d29('0x15'),_0x24c24e);logger['debug'](_0x8d29('0x15'),_0x24c24e,JSON['stringify'](_0xebfed5));_0x3f517f(_0xebfed5);})[_0x8d29('0x14')](function(_0x3f3f12){logger['error'](_0x8d29('0x15'),_0x3f3f12[_0x8d29('0x12')],_0x24c24e);_0x4a5b49(_0x1511a8[_0x8d29('0x10')](0x1f4,_0x3f3f12[_0x8d29('0x12')]));});});};exports[_0x8d29('0x18')]=function(_0x9123cf){var _0x405d5e=this;return new Promise(function(_0x5527ee,_0x1ee7dc){return db[_0x8d29('0x16')][_0x8d29('0x19')](_0x9123cf[_0x8d29('0x1a')],{'raw':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf['options'][_0x8d29('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf[_0x8d29('0x1b')][_0x8d29('0x1d')]||null:null,'attributes':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf['options'][_0x8d29('0x1e')]||null:null,'limit':_0x9123cf[_0x8d29('0x1b')]?_0x9123cf[_0x8d29('0x1b')][_0x8d29('0x1f')]||null:null})[_0x8d29('0xa')](function(_0x594efa){logger[_0x8d29('0xb')](_0x8d29('0x18'),_0x9123cf);logger[_0x8d29('0xe')]('UpdateSquareReport',_0x9123cf,JSON['stringify'](_0x594efa));_0x5527ee(_0x594efa);})['catch'](function(_0x134686){logger[_0x8d29('0x10')](_0x8d29('0x18'),_0x134686[_0x8d29('0x12')],_0x9123cf);_0x1ee7dc(_0x405d5e[_0x8d29('0x10')](0x1f4,_0x134686['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a681f7a..74b2509 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 _0x184b=['Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','index','/describe','isAuthenticated','describe','show','post','put','update','delete','/:id','destroy','multer','path'];(function(_0xab2021,_0x10fc42){var _0x11c2f8=function(_0x17d4eb){while(--_0x17d4eb){_0xab2021['push'](_0xab2021['shift']());}};_0x11c2f8(++_0x10fc42);}(_0x184b,0x6a));var _0xb184=function(_0x205cb0,_0x3ee1cc){_0x205cb0=_0x205cb0-0x0;var _0x108e4f=_0x184b[_0x205cb0];return _0x108e4f;};'use strict';var multer=require(_0xb184('0x0'));var util=require('util');var path=require(_0xb184('0x1'));var express=require('express');var router=express[_0xb184('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xb184('0x3'));var config=require(_0xb184('0x4'));var controller=require(_0xb184('0x5'));router[_0xb184('0x6')]('/',auth['isAuthenticated'](),controller[_0xb184('0x7')]);router['get'](_0xb184('0x8'),auth[_0xb184('0x9')](),controller[_0xb184('0xa')]);router['get']('/:id',auth[_0xb184('0x9')](),controller[_0xb184('0xb')]);router[_0xb184('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb184('0xd')]('/:id',auth[_0xb184('0x9')](),controller[_0xb184('0xe')]);router[_0xb184('0xf')](_0xb184('0x10'),auth[_0xb184('0x9')](),controller[_0xb184('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6658=['describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x3e7332,_0x47f81d){var _0x2977d6=function(_0x28c7f2){while(--_0x28c7f2){_0x3e7332['push'](_0x3e7332['shift']());}};_0x2977d6(++_0x47f81d);}(_0x6658,0x1ec));var _0x8665=function(_0x3766f4,_0x5880a9){_0x3766f4=_0x3766f4-0x0;var _0x5179a4=_0x6658[_0x3766f4];return _0x5179a4;};'use strict';var multer=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var path=require(_0x8665('0x2'));var express=require(_0x8665('0x3'));var router=express[_0x8665('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8665('0x5'));var config=require(_0x8665('0x6'));var controller=require(_0x8665('0x7'));router[_0x8665('0x8')]('/',auth[_0x8665('0x9')](),controller[_0x8665('0xa')]);router['get'](_0x8665('0xb'),auth[_0x8665('0x9')](),controller[_0x8665('0xc')]);router['get']('/:id',auth[_0x8665('0x9')](),controller[_0x8665('0xd')]);router[_0x8665('0xe')]('/',auth[_0x8665('0x9')](),controller['create']);router[_0x8665('0xf')](_0x8665('0x10'),auth[_0x8665('0x9')](),controller[_0x8665('0x11')]);router[_0x8665('0x12')]('/:id',auth[_0x8665('0x9')](),controller[_0x8665('0x13')]);module[_0x8665('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 213aa02..5587d6e 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 _0xe213=['STRING','sequelize','exports'];(function(_0x414247,_0x789832){var _0xa5057d=function(_0x2248bf){while(--_0x2248bf){_0x414247['push'](_0x414247['shift']());}};_0xa5057d(++_0x789832);}(_0xe213,0x79));var _0x3e21=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xe213[_0x4e7d25];return _0x526fe6;};'use strict';var Sequelize=require(_0x3e21('0x0'));module[_0x3e21('0x1')]={'uniqueid':{'type':Sequelize[_0x3e21('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x3e21('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x3e21('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdc49=['exports','STRING','TEXT','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc49,0x1db));var _0x9dc4=function(_0x2acf77,_0x47c010){_0x2acf77=_0x2acf77-0x0;var _0x56bd7a=_0xdc49[_0x2acf77];return _0x56bd7a;};'use strict';var Sequelize=require(_0x9dc4('0x0'));module[_0x9dc4('0x1')]={'uniqueid':{'type':Sequelize[_0x9dc4('0x2')]},'node':{'type':Sequelize[_0x9dc4('0x2')]},'application':{'type':Sequelize[_0x9dc4('0x2')]},'data':{'type':Sequelize[_0x9dc4('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index fe89f44..a01a193 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 _0xbcf4=['SquareDetailsReport','rawAttributes','model','keys','query','dateEnd','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','dateStart','add','day','merge','filter','options','includeAll','include','rows','catch','params','find','create','body','describe','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index'];(function(_0x1fea49,_0x2e8b16){var _0xd1fc37=function(_0x5a0439){while(--_0x5a0439){_0x1fea49['push'](_0x1fea49['shift']());}};_0xd1fc37(++_0x2e8b16);}(_0xbcf4,0x64));var _0x4bcf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcf4[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x4bcf('0x0'));var rp=require(_0x4bcf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4bcf('0x2'));var path=require(_0x4bcf('0x3'));var sox=require(_0x4bcf('0x4'));var csv=require(_0x4bcf('0x5'));var ejs=require(_0x4bcf('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4bcf('0x7'));var crypto=require(_0x4bcf('0x8'));var jsforce=require(_0x4bcf('0x9'));var deskjs=require(_0x4bcf('0xa'));var toCsv=require(_0x4bcf('0x5'));var querystring=require(_0x4bcf('0xb'));var Papa=require(_0x4bcf('0xc'));var qs=require(_0x4bcf('0xd'));var logger=require(_0x4bcf('0xe'))(_0x4bcf('0xf'));var utils=require(_0x4bcf('0x10'));var config=require('../../config/environment');var db=require(_0x4bcf('0x11'))['db'];function respondWithStatusCode(_0x51330f,_0x35adfe){_0x35adfe=_0x35adfe||0xcc;return function(_0x2e7d59){if(_0x2e7d59){return _0x51330f['sendStatus'](_0x35adfe);}return _0x51330f[_0x4bcf('0x12')](_0x35adfe)[_0x4bcf('0x13')]();};}function respondWithResult(_0xf6efab,_0x59aace){_0x59aace=_0x59aace||0xc8;return function(_0x21f875){if(_0x21f875){return _0xf6efab[_0x4bcf('0x12')](_0x59aace)[_0x4bcf('0x14')](_0x21f875);}};}function respondWithFilteredResult(_0x5d75d6,_0x290ced){return function(_0x452bc4){if(_0x452bc4){var _0x29ad9c=_0x452bc4[_0x4bcf('0x15')],_0x365a9b=_0x290ced[_0x4bcf('0x16')],_0x1ec0a5=_0x290ced[_0x4bcf('0x16')]+_0x290ced[_0x4bcf('0x17')],_0x1f51fb;if(_0x1ec0a5>=_0x29ad9c){_0x1ec0a5=_0x29ad9c;_0x1f51fb=0xc8;}else{_0x1f51fb=0xce;}_0x5d75d6[_0x4bcf('0x12')](_0x1f51fb);return _0x5d75d6['set'](_0x4bcf('0x18'),_0x365a9b+'-'+_0x1ec0a5+'/'+_0x29ad9c)['json'](_0x452bc4);}return null;};}function patchUpdates(_0x428265){return function(_0x2599da){try{jsonpatch[_0x4bcf('0x19')](_0x2599da,_0x428265,!![]);}catch(_0x4f6d04){return BPromise[_0x4bcf('0x1a')](_0x4f6d04);}return _0x2599da['save']();};}function saveUpdates(_0x1e1a1d,_0x129e91){return function(_0x281b5f){if(_0x281b5f){return _0x281b5f[_0x4bcf('0x1b')](_0x1e1a1d)[_0x4bcf('0x1c')](function(_0x3b9ab8){return _0x3b9ab8;});}return null;};}function removeEntity(_0x4aa104,_0x259391){return function(_0x42dd4d){if(_0x42dd4d){return _0x42dd4d[_0x4bcf('0x1d')]()[_0x4bcf('0x1c')](function(){_0x4aa104[_0x4bcf('0x12')](0xcc)[_0x4bcf('0x13')]();});}};}function handleEntityNotFound(_0x559040,_0x3a45a9){return function(_0x3c5f59){if(!_0x3c5f59){_0x559040[_0x4bcf('0x1e')](0x194);}return _0x3c5f59;};}function handleError(_0x3d742c,_0x176387){_0x176387=_0x176387||0x1f4;return function(_0x2bd2d2){logger[_0x4bcf('0x1f')](_0x2bd2d2[_0x4bcf('0x20')]);if(_0x2bd2d2['name']){delete _0x2bd2d2[_0x4bcf('0x21')];}_0x3d742c[_0x4bcf('0x12')](_0x176387)[_0x4bcf('0x22')](_0x2bd2d2);};}exports[_0x4bcf('0x23')]=function(_0x5f0f6a,_0x23d661){var _0x214349={},_0x1e034f={},_0x2f3bec={'count':0x0,'rows':[]};var _0x3738f1=db[_0x4bcf('0x24')][_0x4bcf('0x25')];_0x1e034f[_0x4bcf('0x26')]=_[_0x4bcf('0x27')](_0x3738f1);var _0x575ff4={'dateStart':_0x5f0f6a[_0x4bcf('0x28')]['dateStart'],'dateEnd':_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x29')]};delete _0x5f0f6a[_0x4bcf('0x28')]['dateStart'];delete _0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x29')];_0x1e034f[_0x4bcf('0x28')]=_[_0x4bcf('0x27')](_0x5f0f6a[_0x4bcf('0x28')]);_0x1e034f['filters']=_[_0x4bcf('0x2a')](_0x1e034f['model'],_0x1e034f['query']);_0x214349[_0x4bcf('0x2b')]=_['intersection'](_0x1e034f['model'],qs[_0x4bcf('0x2c')](_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x2c')]));_0x214349[_0x4bcf('0x2b')]=_0x214349[_0x4bcf('0x2b')][_0x4bcf('0x2d')]?_0x214349['attributes']:_0x1e034f[_0x4bcf('0x26')];if(!_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x2e')](_0x4bcf('0x2f'))){_0x214349[_0x4bcf('0x17')]=qs[_0x4bcf('0x17')](_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x17')]);_0x214349['offset']=qs[_0x4bcf('0x16')](_0x5f0f6a[_0x4bcf('0x28')]['offset']);}_0x214349[_0x4bcf('0x30')]=qs[_0x4bcf('0x31')](_0x5f0f6a[_0x4bcf('0x28')]['sort']);_0x214349[_0x4bcf('0x32')]=qs[_0x4bcf('0x33')](_[_0x4bcf('0x34')](_0x5f0f6a['query'],_0x1e034f[_0x4bcf('0x33')]));if(_0x575ff4[_0x4bcf('0x35')]){if(_0x575ff4['dateEnd']){_0x575ff4[_0x4bcf('0x29')]=moment(_0x575ff4['dateEnd'])[_0x4bcf('0x36')](0x1,'day');}else{_0x575ff4[_0x4bcf('0x29')]=moment(_0x575ff4['dateStart'])[_0x4bcf('0x36')](0x1,_0x4bcf('0x37'));}_[_0x4bcf('0x38')](_0x214349['where'],{'createdAt':{'$gte':_0x575ff4[_0x4bcf('0x35')],'$lte':_0x575ff4[_0x4bcf('0x29')]}});}if(_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x39')]){_0x214349[_0x4bcf('0x32')]=_[_0x4bcf('0x38')](_0x214349[_0x4bcf('0x32')],{'$or':_['map'](_0x214349['attributes'],function(_0x30bdf6){var _0x36a12b={};_0x36a12b[_0x30bdf6]={'$like':'%'+_0x5f0f6a['query']['filter']+'%'};return _0x36a12b;})});}_0x214349=_[_0x4bcf('0x38')]({},_0x214349,_0x5f0f6a[_0x4bcf('0x3a')]);var _0x99968={'where':_0x214349[_0x4bcf('0x32')]};return db[_0x4bcf('0x24')][_0x4bcf('0x15')](_0x99968)[_0x4bcf('0x1c')](function(_0x438472){_0x2f3bec[_0x4bcf('0x15')]=_0x438472;if(_0x5f0f6a[_0x4bcf('0x28')][_0x4bcf('0x3b')]){_0x214349[_0x4bcf('0x3c')]=[{'all':!![]}];}return db[_0x4bcf('0x24')]['findAll'](_0x214349);})[_0x4bcf('0x1c')](function(_0x1b7f0f){_0x2f3bec[_0x4bcf('0x3d')]=_0x1b7f0f;return _0x2f3bec;})[_0x4bcf('0x1c')](respondWithFilteredResult(_0x23d661,_0x214349))[_0x4bcf('0x3e')](handleError(_0x23d661,null));};exports['show']=function(_0x3f823f,_0x5aa9b2){var _0x3d4481={'raw':!![],'where':{'id':_0x3f823f[_0x4bcf('0x3f')]['id']}},_0xacc83e={};_0xacc83e[_0x4bcf('0x26')]=_['keys'](db[_0x4bcf('0x24')][_0x4bcf('0x25')]);_0xacc83e['query']=_[_0x4bcf('0x27')](_0x3f823f[_0x4bcf('0x28')]);_0xacc83e[_0x4bcf('0x33')]=_[_0x4bcf('0x2a')](_0xacc83e[_0x4bcf('0x26')],_0xacc83e[_0x4bcf('0x28')]);_0x3d4481[_0x4bcf('0x2b')]=_[_0x4bcf('0x2a')](_0xacc83e[_0x4bcf('0x26')],qs[_0x4bcf('0x2c')](_0x3f823f[_0x4bcf('0x28')][_0x4bcf('0x2c')]));_0x3d4481[_0x4bcf('0x2b')]=_0x3d4481['attributes'][_0x4bcf('0x2d')]?_0x3d4481[_0x4bcf('0x2b')]:_0xacc83e[_0x4bcf('0x26')];if(_0x3f823f['query']['includeAll']){_0x3d4481[_0x4bcf('0x3c')]=[{'all':!![]}];}_0x3d4481=_[_0x4bcf('0x38')]({},_0x3d4481,_0x3f823f[_0x4bcf('0x3a')]);return db[_0x4bcf('0x24')][_0x4bcf('0x40')](_0x3d4481)[_0x4bcf('0x1c')](handleEntityNotFound(_0x5aa9b2,null))['then'](respondWithResult(_0x5aa9b2,null))[_0x4bcf('0x3e')](handleError(_0x5aa9b2,null));};exports[_0x4bcf('0x41')]=function(_0x3e9b79,_0x270697){return db[_0x4bcf('0x24')][_0x4bcf('0x41')](_0x3e9b79[_0x4bcf('0x42')],{})['then'](respondWithResult(_0x270697,0xc9))['catch'](handleError(_0x270697,null));};exports[_0x4bcf('0x1b')]=function(_0x7c0fe5,_0x48dbf4){if(_0x7c0fe5[_0x4bcf('0x42')]['id']){delete _0x7c0fe5[_0x4bcf('0x42')]['id'];}return db[_0x4bcf('0x24')][_0x4bcf('0x40')]({'where':{'id':_0x7c0fe5[_0x4bcf('0x3f')]['id']}})[_0x4bcf('0x1c')](handleEntityNotFound(_0x48dbf4,null))[_0x4bcf('0x1c')](saveUpdates(_0x7c0fe5[_0x4bcf('0x42')],null))[_0x4bcf('0x1c')](respondWithResult(_0x48dbf4,null))[_0x4bcf('0x3e')](handleError(_0x48dbf4,null));};exports[_0x4bcf('0x1d')]=function(_0x2b55a1,_0x335638){return db[_0x4bcf('0x24')][_0x4bcf('0x40')]({'where':{'id':_0x2b55a1[_0x4bcf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x335638,null))[_0x4bcf('0x1c')](removeEntity(_0x335638,null))[_0x4bcf('0x3e')](handleError(_0x335638,null));};exports[_0x4bcf('0x43')]=function(_0x183d43,_0x5617b2){return db[_0x4bcf('0x24')][_0x4bcf('0x43')]()[_0x4bcf('0x1c')](respondWithResult(_0x5617b2,null))[_0x4bcf('0x3e')](handleError(_0x5617b2,null));}; \ No newline at end of file +var _0x046d=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','SquareDetailsReport','rawAttributes','model','keys','dateStart','query','dateEnd','attributes','intersection','fields','length','nolimit','offset','order','sort','where','filters','add','day','merge','map','filter','options','includeAll','include','findAll','show','params','find','catch','create','body','describe','fast-json-patch','moment','mustache','util','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api'];(function(_0x3cc006,_0x4dca9a){var _0x9c02b6=function(_0x5920cd){while(--_0x5920cd){_0x3cc006['push'](_0x3cc006['shift']());}};_0x9c02b6(++_0x4dca9a);}(_0x046d,0x13b));var _0xd046=function(_0x337d3a,_0x297363){_0x337d3a=_0x337d3a-0x0;var _0x3bc3be=_0x046d[_0x337d3a];return _0x3bc3be;};'use strict';var jsonpatch=require(_0xd046('0x0'));var rp=require('request-promise');var moment=require(_0xd046('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd046('0x2'));var util=require(_0xd046('0x3'));var path=require(_0xd046('0x4'));var sox=require('sox');var csv=require(_0xd046('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd046('0x6'));var squel=require('squel');var crypto=require(_0xd046('0x7'));var jsforce=require(_0xd046('0x8'));var deskjs=require(_0xd046('0x9'));var toCsv=require(_0xd046('0x5'));var querystring=require(_0xd046('0xa'));var Papa=require(_0xd046('0xb'));var qs=require(_0xd046('0xc'));var logger=require(_0xd046('0xd'))(_0xd046('0xe'));var utils=require(_0xd046('0xf'));var config=require(_0xd046('0x10'));var db=require(_0xd046('0x11'))['db'];function respondWithStatusCode(_0x5252fe,_0x35e22e){_0x35e22e=_0x35e22e||0xcc;return function(_0x441133){if(_0x441133){return _0x5252fe[_0xd046('0x12')](_0x35e22e);}return _0x5252fe['status'](_0x35e22e)['end']();};}function respondWithResult(_0x3e03e3,_0x3b8ed4){_0x3b8ed4=_0x3b8ed4||0xc8;return function(_0x470975){if(_0x470975){return _0x3e03e3[_0xd046('0x13')](_0x3b8ed4)[_0xd046('0x14')](_0x470975);}};}function respondWithFilteredResult(_0x573f71,_0x549efd){return function(_0x318637){if(_0x318637){var _0xff641e=_0x318637[_0xd046('0x15')],_0x5b1f17=_0x549efd['offset'],_0xd8aae3=_0x549efd['offset']+_0x549efd[_0xd046('0x16')],_0x13000a;if(_0xd8aae3>=_0xff641e){_0xd8aae3=_0xff641e;_0x13000a=0xc8;}else{_0x13000a=0xce;}_0x573f71['status'](_0x13000a);return _0x573f71[_0xd046('0x17')](_0xd046('0x18'),_0x5b1f17+'-'+_0xd8aae3+'/'+_0xff641e)[_0xd046('0x14')](_0x318637);}return null;};}function patchUpdates(_0x2986e5){return function(_0x11e265){try{jsonpatch['apply'](_0x11e265,_0x2986e5,!![]);}catch(_0x3c0ceb){return BPromise[_0xd046('0x19')](_0x3c0ceb);}return _0x11e265[_0xd046('0x1a')]();};}function saveUpdates(_0x555cc7,_0x345d72){return function(_0x9beed8){if(_0x9beed8){return _0x9beed8[_0xd046('0x1b')](_0x555cc7)[_0xd046('0x1c')](function(_0x295cd6){return _0x295cd6;});}return null;};}function removeEntity(_0x359e45,_0x5b7e05){return function(_0x46ffef){if(_0x46ffef){return _0x46ffef[_0xd046('0x1d')]()[_0xd046('0x1c')](function(){_0x359e45[_0xd046('0x13')](0xcc)[_0xd046('0x1e')]();});}};}function handleEntityNotFound(_0x356bda,_0x5f2621){return function(_0x4cd019){if(!_0x4cd019){_0x356bda[_0xd046('0x12')](0x194);}return _0x4cd019;};}function handleError(_0x1a3284,_0x12d7c0){_0x12d7c0=_0x12d7c0||0x1f4;return function(_0x3343cb){logger[_0xd046('0x1f')](_0x3343cb['stack']);if(_0x3343cb['name']){delete _0x3343cb[_0xd046('0x20')];}_0x1a3284[_0xd046('0x13')](_0x12d7c0)['send'](_0x3343cb);};}exports['index']=function(_0x5a35e8,_0x41138c){var _0x340457={},_0x7523b7={},_0xbb155={'count':0x0,'rows':[]};var _0x1735fa=db[_0xd046('0x21')][_0xd046('0x22')];_0x7523b7[_0xd046('0x23')]=_[_0xd046('0x24')](_0x1735fa);var _0x4cbdf8={'dateStart':_0x5a35e8['query'][_0xd046('0x25')],'dateEnd':_0x5a35e8[_0xd046('0x26')][_0xd046('0x27')]};delete _0x5a35e8[_0xd046('0x26')][_0xd046('0x25')];delete _0x5a35e8[_0xd046('0x26')]['dateEnd'];_0x7523b7['query']=_[_0xd046('0x24')](_0x5a35e8[_0xd046('0x26')]);_0x7523b7['filters']=_['intersection'](_0x7523b7[_0xd046('0x23')],_0x7523b7[_0xd046('0x26')]);_0x340457[_0xd046('0x28')]=_[_0xd046('0x29')](_0x7523b7[_0xd046('0x23')],qs[_0xd046('0x2a')](_0x5a35e8[_0xd046('0x26')][_0xd046('0x2a')]));_0x340457['attributes']=_0x340457['attributes'][_0xd046('0x2b')]?_0x340457[_0xd046('0x28')]:_0x7523b7[_0xd046('0x23')];if(!_0x5a35e8[_0xd046('0x26')]['hasOwnProperty'](_0xd046('0x2c'))){_0x340457[_0xd046('0x16')]=qs['limit'](_0x5a35e8[_0xd046('0x26')]['limit']);_0x340457[_0xd046('0x2d')]=qs[_0xd046('0x2d')](_0x5a35e8[_0xd046('0x26')]['offset']);}_0x340457[_0xd046('0x2e')]=qs[_0xd046('0x2f')](_0x5a35e8[_0xd046('0x26')][_0xd046('0x2f')]);_0x340457[_0xd046('0x30')]=qs[_0xd046('0x31')](_['pick'](_0x5a35e8[_0xd046('0x26')],_0x7523b7[_0xd046('0x31')]));if(_0x4cbdf8[_0xd046('0x25')]){if(_0x4cbdf8[_0xd046('0x27')]){_0x4cbdf8[_0xd046('0x27')]=moment(_0x4cbdf8[_0xd046('0x27')])[_0xd046('0x32')](0x1,_0xd046('0x33'));}else{_0x4cbdf8['dateEnd']=moment(_0x4cbdf8[_0xd046('0x25')])[_0xd046('0x32')](0x1,_0xd046('0x33'));}_[_0xd046('0x34')](_0x340457[_0xd046('0x30')],{'createdAt':{'$gte':_0x4cbdf8[_0xd046('0x25')],'$lte':_0x4cbdf8['dateEnd']}});}if(_0x5a35e8[_0xd046('0x26')]['filter']){_0x340457[_0xd046('0x30')]=_[_0xd046('0x34')](_0x340457[_0xd046('0x30')],{'$or':_[_0xd046('0x35')](_0x340457['attributes'],function(_0x268c30){var _0x1d00d3={};_0x1d00d3[_0x268c30]={'$like':'%'+_0x5a35e8[_0xd046('0x26')][_0xd046('0x36')]+'%'};return _0x1d00d3;})});}_0x340457=_[_0xd046('0x34')]({},_0x340457,_0x5a35e8[_0xd046('0x37')]);var _0x538aac={'where':_0x340457[_0xd046('0x30')]};return db[_0xd046('0x21')][_0xd046('0x15')](_0x538aac)[_0xd046('0x1c')](function(_0x242b6c){_0xbb155[_0xd046('0x15')]=_0x242b6c;if(_0x5a35e8[_0xd046('0x26')][_0xd046('0x38')]){_0x340457[_0xd046('0x39')]=[{'all':!![]}];}return db[_0xd046('0x21')][_0xd046('0x3a')](_0x340457);})[_0xd046('0x1c')](function(_0x5df1d8){_0xbb155['rows']=_0x5df1d8;return _0xbb155;})[_0xd046('0x1c')](respondWithFilteredResult(_0x41138c,_0x340457))['catch'](handleError(_0x41138c,null));};exports[_0xd046('0x3b')]=function(_0x151d27,_0xbb2fcb){var _0x29180d={'raw':!![],'where':{'id':_0x151d27[_0xd046('0x3c')]['id']}},_0x5500fd={};_0x5500fd['model']=_[_0xd046('0x24')](db[_0xd046('0x21')][_0xd046('0x22')]);_0x5500fd[_0xd046('0x26')]=_[_0xd046('0x24')](_0x151d27[_0xd046('0x26')]);_0x5500fd[_0xd046('0x31')]=_[_0xd046('0x29')](_0x5500fd[_0xd046('0x23')],_0x5500fd[_0xd046('0x26')]);_0x29180d[_0xd046('0x28')]=_[_0xd046('0x29')](_0x5500fd[_0xd046('0x23')],qs['fields'](_0x151d27[_0xd046('0x26')][_0xd046('0x2a')]));_0x29180d[_0xd046('0x28')]=_0x29180d[_0xd046('0x28')]['length']?_0x29180d['attributes']:_0x5500fd[_0xd046('0x23')];if(_0x151d27['query'][_0xd046('0x38')]){_0x29180d['include']=[{'all':!![]}];}_0x29180d=_[_0xd046('0x34')]({},_0x29180d,_0x151d27['options']);return db[_0xd046('0x21')][_0xd046('0x3d')](_0x29180d)['then'](handleEntityNotFound(_0xbb2fcb,null))['then'](respondWithResult(_0xbb2fcb,null))[_0xd046('0x3e')](handleError(_0xbb2fcb,null));};exports[_0xd046('0x3f')]=function(_0x12fd34,_0xcf96ed){return db[_0xd046('0x21')][_0xd046('0x3f')](_0x12fd34['body'],{})[_0xd046('0x1c')](respondWithResult(_0xcf96ed,0xc9))[_0xd046('0x3e')](handleError(_0xcf96ed,null));};exports['update']=function(_0x254f44,_0x156d12){if(_0x254f44[_0xd046('0x40')]['id']){delete _0x254f44[_0xd046('0x40')]['id'];}return db['SquareDetailsReport'][_0xd046('0x3d')]({'where':{'id':_0x254f44['params']['id']}})[_0xd046('0x1c')](handleEntityNotFound(_0x156d12,null))['then'](saveUpdates(_0x254f44[_0xd046('0x40')],null))[_0xd046('0x1c')](respondWithResult(_0x156d12,null))[_0xd046('0x3e')](handleError(_0x156d12,null));};exports['destroy']=function(_0x317412,_0x522595){return db[_0xd046('0x21')][_0xd046('0x3d')]({'where':{'id':_0x317412[_0xd046('0x3c')]['id']}})['then'](handleEntityNotFound(_0x522595,null))['then'](removeEntity(_0x522595,null))[_0xd046('0x3e')](handleError(_0x522595,null));};exports[_0xd046('0x41')]=function(_0x2cc7f3,_0x470948){return db[_0xd046('0x21')][_0xd046('0x41')]()[_0xd046('0x1c')](respondWithResult(_0x470948,null))[_0xd046('0x3e')](handleError(_0x470948,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 617d743..c0ff732 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 _0x1464=['util','moment','bluebird','request-promise','exports','report_square_details','lodash'];(function(_0x27b577,_0x36c492){var _0x1bea42=function(_0x4d13c3){while(--_0x4d13c3){_0x27b577['push'](_0x27b577['shift']());}};_0x1bea42(++_0x36c492);}(_0x1464,0x7d));var _0x4146=function(_0x5cc450,_0xbc6fa8){_0x5cc450=_0x5cc450-0x0;var _0x781ec6=_0x1464[_0x5cc450];return _0x781ec6;};'use strict';var _=require(_0x4146('0x0'));var util=require(_0x4146('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4146('0x2'));var BPromise=require(_0x4146('0x3'));var rp=require(_0x4146('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0x4146('0x5')]=function(_0x427f45,_0x3078c9){return _0x427f45['define']('SquareDetailsReport',attributes,{'tableName':_0x4146('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x82dc=['bluebird','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','moment'];(function(_0xf3b6b3,_0x4148df){var _0x225c1c=function(_0x554f09){while(--_0x554f09){_0xf3b6b3['push'](_0xf3b6b3['shift']());}};_0x225c1c(++_0x4148df);}(_0x82dc,0x1c7));var _0xc82d=function(_0x3774f8,_0x579746){_0x3774f8=_0x3774f8-0x0;var _0x3aed2b=_0x82dc[_0x3774f8];return _0x3aed2b;};'use strict';var _=require(_0xc82d('0x0'));var util=require(_0xc82d('0x1'));var logger=require('../../config/logger')(_0xc82d('0x2'));var moment=require(_0xc82d('0x3'));var BPromise=require(_0xc82d('0x4'));var rp=require('request-promise');var attributes=require('./squareReportDetail.attributes');module[_0xc82d('0x5')]=function(_0x4091c9,_0x367560){return _0x4091c9[_0xc82d('0x6')](_0xc82d('0x7'),attributes,{'tableName':_0xc82d('0x8'),'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 9c51583..fca84cb 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 _0x9957=['client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateSquareDetailsReport','body','raw','then','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4b2b03,_0xbf34ee){var _0x1bf0ed=function(_0x562785){while(--_0x562785){_0x4b2b03['push'](_0x4b2b03['shift']());}};_0x1bf0ed(++_0xbf34ee);}(_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 db=require(_0x7995('0x4'))['db'];var utils=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var config=require('../../config/environment');var jayson=require(_0x7995('0x8'));var client=jayson[_0x7995('0x9')][_0x7995('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219534,_0xbda126,_0x326741){return new BPromise(function(_0x4996ca,_0x465276){return client[_0x7995('0xb')](_0x219534,_0x326741)['then'](function(_0xa2e5f0){logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));logger[_0x7995('0xf')](_0x7995('0x10'),_0xbda126,_0x7995('0xe'),JSON['stringify'](_0xa2e5f0));if(_0xa2e5f0[_0x7995('0x11')]){if(_0xa2e5f0[_0x7995('0x11')]['code']===0x1f4){logger[_0x7995('0x11')](_0x7995('0xd'),_0xbda126,_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);return _0x465276(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}logger[_0x7995('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0xbda126,_0xa2e5f0['error'][_0x7995('0x12')]);return _0x4996ca(_0xa2e5f0[_0x7995('0x11')][_0x7995('0x12')]);}else{logger[_0x7995('0xc')](_0x7995('0xd'),_0xbda126,_0x7995('0xe'));_0x4996ca(_0xa2e5f0[_0x7995('0x13')][_0x7995('0x12')]);}})['catch'](function(_0x2eeacc){logger['error'](_0x7995('0xd'),_0xbda126,_0x2eeacc);_0x465276(_0x2eeacc);});});}exports[_0x7995('0x14')]=function(_0x43d4b8){var _0x291317=this;return new Promise(function(_0x1e1415,_0x37a7d4){return db['SquareDetailsReport']['create'](_0x43d4b8[_0x7995('0x15')],{'raw':_0x43d4b8['options']?_0x43d4b8['options'][_0x7995('0x16')]===undefined?!![]:![]:!![]})[_0x7995('0x17')](function(_0x4cbe10){logger[_0x7995('0xc')]('CreateSquareDetailsReport',_0x43d4b8);logger['debug'](_0x7995('0x14'),_0x43d4b8,JSON[_0x7995('0x18')](_0x4cbe10));_0x1e1415(_0x4cbe10);})[_0x7995('0x19')](function(_0x1a8568){logger[_0x7995('0x11')](_0x7995('0x14'),_0x1a8568['message'],_0x43d4b8);_0x37a7d4(_0x291317[_0x7995('0x11')](0x1f4,_0x1a8568[_0x7995('0x12')]));});});}; \ No newline at end of file +var _0x7a54=['result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','then','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x2d2820,_0x272af9){var _0x3be500=function(_0x3b0a28){while(--_0x3b0a28){_0x2d2820['push'](_0x2d2820['shift']());}};_0x3be500(++_0x272af9);}(_0x7a54,0x106));var _0x47a5=function(_0x154b21,_0x305abd){_0x154b21=_0x154b21-0x0;var _0x3f83c0=_0x7a54[_0x154b21];return _0x3f83c0;};'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 db=require(_0x47a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var jayson=require(_0x47a5('0x8'));var client=jayson[_0x47a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5629,_0x59199c,_0x343372){return new BPromise(function(_0x30e405,_0x506eda){return client[_0x47a5('0xa')](_0x3d5629,_0x343372)['then'](function(_0x5d90b3){logger['info'](_0x47a5('0xb'),_0x59199c,_0x47a5('0xc'));logger['debug'](_0x47a5('0xd'),_0x59199c,'request\x20sent',JSON['stringify'](_0x5d90b3));if(_0x5d90b3[_0x47a5('0xe')]){if(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0xf')]===0x1f4){logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x506eda(_0x5d90b3['error'][_0x47a5('0x10')]);}logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x30e405(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);}else{logger[_0x47a5('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x59199c,_0x47a5('0xc'));_0x30e405(_0x5d90b3[_0x47a5('0x12')][_0x47a5('0x10')]);}})[_0x47a5('0x13')](function(_0x1ef44c){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x59199c,_0x1ef44c);_0x506eda(_0x1ef44c);});});}exports[_0x47a5('0x14')]=function(_0x4b966e){var _0x5247fd=this;return new Promise(function(_0x423a81,_0xaf70a6){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x4b966e[_0x47a5('0x17')],{'raw':_0x4b966e[_0x47a5('0x18')]?_0x4b966e[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})[_0x47a5('0x1a')](function(_0x4a9fcb){logger[_0x47a5('0x11')](_0x47a5('0x14'),_0x4b966e);logger['debug'](_0x47a5('0x14'),_0x4b966e,JSON[_0x47a5('0x1b')](_0x4a9fcb));_0x423a81(_0x4a9fcb);})[_0x47a5('0x13')](function(_0x4c5910){logger[_0x47a5('0xe')](_0x47a5('0x14'),_0x4c5910[_0x47a5('0x10')],_0x4b966e);_0xaf70a6(_0x5247fd[_0x47a5('0xe')](0x1f4,_0x4c5910['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index bf76345..12b4c2e 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 _0xe4e4=['index','/process/:pid/kill','killProcess','exports','express','Router','./system.controller','get','isAuthenticated'];(function(_0x20ae28,_0x16e2b3){var _0x3d3a2a=function(_0x44b481){while(--_0x44b481){_0x20ae28['push'](_0x20ae28['shift']());}};_0x3d3a2a(++_0x16e2b3);}(_0xe4e4,0xe5));var _0x4e4e=function(_0x49908e,_0x446ade){_0x49908e=_0x49908e-0x0;var _0x4675d8=_0xe4e4[_0x49908e];return _0x4675d8;};'use strict';var express=require(_0x4e4e('0x0'));var router=express[_0x4e4e('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x4e4e('0x2'));router[_0x4e4e('0x3')]('/',auth[_0x4e4e('0x4')](),controller[_0x4e4e('0x5')]);router[_0x4e4e('0x3')](_0x4e4e('0x6'),auth[_0x4e4e('0x4')](),controller[_0x4e4e('0x7')]);module[_0x4e4e('0x8')]=router; \ No newline at end of file +var _0x0d69=['../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill','exports','express','Router'];(function(_0x466326,_0x5a69ea){var _0x3db288=function(_0x55218e){while(--_0x55218e){_0x466326['push'](_0x466326['shift']());}};_0x3db288(++_0x5a69ea);}(_0x0d69,0x106));var _0x90d6=function(_0x46a8dd,_0x54305a){_0x46a8dd=_0x46a8dd-0x0;var _0x522b7f=_0x0d69[_0x46a8dd];return _0x522b7f;};'use strict';var express=require(_0x90d6('0x0'));var router=express[_0x90d6('0x1')]();var auth=require(_0x90d6('0x2'));var controller=require(_0x90d6('0x3'));router['get']('/',auth[_0x90d6('0x4')](),controller[_0x90d6('0x5')]);router['get'](_0x90d6('0x6'),auth[_0x90d6('0x4')](),controller['killProcess']);module[_0x90d6('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 8d4b9dc..02ed5c4 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 _0x6b29=['length','indexOf','format','params','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','exec','api','util','bluebird','lodash','error','inspect','status','send','index','then','json','killProcess','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split'];(function(_0x1c0e08,_0x435c8f){var _0x549d6f=function(_0x2f2aaf){while(--_0x2f2aaf){_0x1c0e08['push'](_0x1c0e08['shift']());}};_0x549d6f(++_0x435c8f);}(_0x6b29,0x90));var _0x96b2=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0x6b29[_0xf10840];return _0x1fdf7e;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0x96b2('0x0')];var logger=require('../../config/logger')(_0x96b2('0x1'));var util=require(_0x96b2('0x2'));var BPromise=require(_0x96b2('0x3'));var _=require(_0x96b2('0x4'));function handleError(_0x594c8f,_0x3989ad,_0x4fe58a){_0x3989ad=_0x3989ad||0x1f4;return function(_0x2c8e96){logger[_0x96b2('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4fe58a,_0x3989ad,util[_0x96b2('0x6')](_0x2c8e96,{'showHidden':![],'depth':null}));delete _0x2c8e96['name'];_0x594c8f[_0x96b2('0x7')](_0x3989ad)[_0x96b2('0x8')](_0x2c8e96);};}exports[_0x96b2('0x9')]=function(_0x39f5c6,_0x59b70e){return info['getAllData']()[_0x96b2('0xa')](function(_0x280370){return _0x59b70e[_0x96b2('0x7')](0xc8)[_0x96b2('0xb')](_0x280370);})['catch'](function(_0x5474a1){return _0x59b70e[_0x96b2('0x7')](0x1f4)['json'](_0x5474a1);});};exports[_0x96b2('0xc')]=function(_0xd206c0,_0x53a29d){var _0x267e32=[_0x96b2('0xd')];return new BPromise(function(_0xf3f4be,_0x3f4e75){return exec(util['format'](_0x96b2('0xe'),_0xd206c0['params'][_0x96b2('0xf')]),function(_0xf943fd,_0x2e6620,_0x175d20){if(_0xf943fd){return _0x3f4e75(_0xf943fd);}return _0xf3f4be(_0x2e6620);});})['then'](function(_0x2d3fab){var _0x5f3f2f=![];var _0x1461b1=_0x2d3fab[_0x96b2('0x10')](/\n/);for(var _0x11c608=0x0,_0x2e179f=_0x267e32[_0x96b2('0x11')];_0x11c608<_0x2e179f,_0x5f3f2f===![];_0x11c608+=0x1){if(_0x2d3fab[_0x96b2('0x12')](_0x267e32[_0x11c608])>=0x0){_0x5f3f2f=!![];}}if(!_0x5f3f2f){throw new Error(util[_0x96b2('0x13')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0xd206c0[_0x96b2('0x14')][_0x96b2('0xf')]));}process['kill'](_0xd206c0[_0x96b2('0x14')][_0x96b2('0xf')],'SIGINT');return _0x53a29d[_0x96b2('0x7')](0xc8)[_0x96b2('0xb')]({'message':util['format'](_0x96b2('0x15'),_0xd206c0[_0x96b2('0x14')][_0x96b2('0xf')])});})[_0x96b2('0x16')](handleError(_0x53a29d,null,'killProcess'));}; \ No newline at end of file +var _0xa3ba=['index','getAllData','then','status','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','exec','../../config/logger','util','bluebird','lodash','error','name','send'];(function(_0x3ab379,_0x456f38){var _0x445342=function(_0x1a8bdf){while(--_0x1a8bdf){_0x3ab379['push'](_0x3ab379['shift']());}};_0x445342(++_0x456f38);}(_0xa3ba,0x198));var _0xaa3b=function(_0x203d64,_0x1ec79c){_0x203d64=_0x203d64-0x0;var _0x462ab3=_0xa3ba[_0x203d64];return _0x462ab3;};'use strict';var info=require('systeminformation');var exec=require('child_process')[_0xaa3b('0x0')];var logger=require(_0xaa3b('0x1'))('api');var util=require(_0xaa3b('0x2'));var BPromise=require(_0xaa3b('0x3'));var _=require(_0xaa3b('0x4'));function handleError(_0x34546f,_0x160043,_0x3540f1){_0x160043=_0x160043||0x1f4;return function(_0x1c9a08){logger[_0xaa3b('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x3540f1,_0x160043,util['inspect'](_0x1c9a08,{'showHidden':![],'depth':null}));delete _0x1c9a08[_0xaa3b('0x6')];_0x34546f['status'](_0x160043)[_0xaa3b('0x7')](_0x1c9a08);};}exports[_0xaa3b('0x8')]=function(_0x711bac,_0x5841fd){return info[_0xaa3b('0x9')]()[_0xaa3b('0xa')](function(_0x1dd288){return _0x5841fd[_0xaa3b('0xb')](0xc8)[_0xaa3b('0xc')](_0x1dd288);})[_0xaa3b('0xd')](function(_0x2b7cff){return _0x5841fd['status'](0x1f4)[_0xaa3b('0xc')](_0x2b7cff);});};exports['killProcess']=function(_0x19ddce,_0xc2af5){var _0x4196c9=[_0xaa3b('0xe')];return new BPromise(function(_0x2a5b38,_0x56199a){return exec(util[_0xaa3b('0xf')](_0xaa3b('0x10'),_0x19ddce['params'][_0xaa3b('0x11')]),function(_0x12a93b,_0x4cb289,_0x12afd1){if(_0x12a93b){return _0x56199a(_0x12a93b);}return _0x2a5b38(_0x4cb289);});})[_0xaa3b('0xa')](function(_0x45d805){var _0x17a2e9=![];var _0x140784=_0x45d805['split'](/\n/);for(var _0x594e86=0x0,_0xfc028b=_0x4196c9[_0xaa3b('0x12')];_0x594e86<_0xfc028b,_0x17a2e9===![];_0x594e86+=0x1){if(_0x45d805[_0xaa3b('0x13')](_0x4196c9[_0x594e86])>=0x0){_0x17a2e9=!![];}}if(!_0x17a2e9){throw new Error(util['format'](_0xaa3b('0x14'),_0x19ddce[_0xaa3b('0x15')][_0xaa3b('0x11')]));}process[_0xaa3b('0x16')](_0x19ddce['params'][_0xaa3b('0x11')],_0xaa3b('0x17'));return _0xc2af5[_0xaa3b('0xb')](0xc8)[_0xaa3b('0xc')]({'message':util[_0xaa3b('0xf')](_0xaa3b('0x18'),_0x19ddce[_0xaa3b('0x15')][_0xaa3b('0x11')])});})['catch'](handleError(_0xc2af5,null,_0xaa3b('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index b159dd6..6b53fbf 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 _0xc42f=['update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','create','/:id'];(function(_0x3e6d5d,_0x264c7a){var _0x238923=function(_0x201b19){while(--_0x201b19){_0x3e6d5d['push'](_0x3e6d5d['shift']());}};_0x238923(++_0x264c7a);}(_0xc42f,0x1e0));var _0xfc42=function(_0x59e8fb,_0x57f2ab){_0x59e8fb=_0x59e8fb-0x0;var _0x50e4b1=_0xc42f[_0x59e8fb];return _0x50e4b1;};'use strict';var multer=require(_0xfc42('0x0'));var util=require(_0xfc42('0x1'));var path=require('path');var express=require(_0xfc42('0x2'));var router=express[_0xfc42('0x3')]();var auth=require(_0xfc42('0x4'));var interaction=require(_0xfc42('0x5'));var config=require(_0xfc42('0x6'));var controller=require(_0xfc42('0x7'));router[_0xfc42('0x8')]('/',auth[_0xfc42('0x9')](),controller[_0xfc42('0xa')]);router[_0xfc42('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xfc42('0x9')](),controller[_0xfc42('0xb')]);router['put'](_0xfc42('0xc'),auth[_0xfc42('0x9')](),controller[_0xfc42('0xd')]);router[_0xfc42('0xe')](_0xfc42('0xc'),auth[_0xfc42('0x9')](),controller[_0xfc42('0xf')]);module[_0xfc42('0x10')]=router; \ No newline at end of file +var _0xf496=['put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x14e405,_0x387732){var _0x34822a=function(_0x29c0ab){while(--_0x29c0ab){_0x14e405['push'](_0x14e405['shift']());}};_0x34822a(++_0x387732);}(_0xf496,0x114));var _0x6f49=function(_0x4c2982,_0x3589e7){_0x4c2982=_0x4c2982-0x0;var _0x3ac10b=_0xf496[_0x4c2982];return _0x3ac10b;};'use strict';var multer=require(_0x6f49('0x0'));var util=require(_0x6f49('0x1'));var path=require(_0x6f49('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x6f49('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6f49('0x4'));var controller=require(_0x6f49('0x5'));router[_0x6f49('0x6')]('/',auth[_0x6f49('0x7')](),controller[_0x6f49('0x8')]);router[_0x6f49('0x6')](_0x6f49('0x9'),auth['isAuthenticated'](),controller[_0x6f49('0xa')]);router[_0x6f49('0xb')]('/',auth[_0x6f49('0x7')](),controller[_0x6f49('0xc')]);router[_0x6f49('0xd')]('/:id',auth[_0x6f49('0x7')](),controller['update']);router[_0x6f49('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x6f49('0xf')]);module[_0x6f49('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 34c5455..ede5f13 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 _0xf9fe=['STRING'];(function(_0x290ed2,_0x20c732){var _0x1d810a=function(_0x2c24f0){while(--_0x2c24f0){_0x290ed2['push'](_0x290ed2['shift']());}};_0x1d810a(++_0x20c732);}(_0xf9fe,0x186));var _0xef9f=function(_0x18d3a9,_0x4f3a3c){_0x18d3a9=_0x18d3a9-0x0;var _0x2c6270=_0xf9fe[_0x18d3a9];return _0x2c6270;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xef9f('0x0')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xef9f('0x0')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xef9f('0x0')]}}; \ No newline at end of file +var _0x83d0=['STRING','sequelize','exports','name'];(function(_0x46391f,_0xf59ecb){var _0x1a7d35=function(_0x10b406){while(--_0x10b406){_0x46391f['push'](_0x46391f['shift']());}};_0x1a7d35(++_0xf59ecb);}(_0x83d0,0x1f1));var _0x083d=function(_0x3e7a81,_0x1764f9){_0x3e7a81=_0x3e7a81-0x0;var _0x4db107=_0x83d0[_0x3e7a81];return _0x4db107;};'use strict';var Sequelize=require(_0x083d('0x0'));module[_0x083d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x083d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x083d('0x3')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x083d('0x3')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f76c124..7a60e7d 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 _0x4991=['dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','add','day','merge','filter','map','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','Tag','rawAttributes','model','keys','query','dateStart'];(function(_0x4bc413,_0x4a5161){var _0x13910d=function(_0xdb5c53){while(--_0xdb5c53){_0x4bc413['push'](_0x4bc413['shift']());}};_0x13910d(++_0x4a5161);}(_0x4991,0xf7));var _0x1499=function(_0x22a2ce,_0x96519c){_0x22a2ce=_0x22a2ce-0x0;var _0xef9c21=_0x4991[_0x22a2ce];return _0xef9c21;};'use strict';var jsonpatch=require(_0x1499('0x0'));var rp=require('request-promise');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1499('0x2'));var util=require(_0x1499('0x3'));var path=require(_0x1499('0x4'));var sox=require(_0x1499('0x5'));var csv=require(_0x1499('0x6'));var ejs=require(_0x1499('0x7'));var fs=require('fs');var _=require(_0x1499('0x8'));var squel=require(_0x1499('0x9'));var crypto=require('crypto');var jsforce=require(_0x1499('0xa'));var deskjs=require(_0x1499('0xb'));var toCsv=require(_0x1499('0x6'));var querystring=require(_0x1499('0xc'));var Papa=require(_0x1499('0xd'));var qs=require(_0x1499('0xe'));var logger=require(_0x1499('0xf'))(_0x1499('0x10'));var utils=require('../../config/utils');var config=require(_0x1499('0x11'));var db=require(_0x1499('0x12'))['db'];function respondWithStatusCode(_0x575251,_0x2a4816){_0x2a4816=_0x2a4816||0xcc;return function(_0x352180){if(_0x352180){return _0x575251['sendStatus'](_0x2a4816);}return _0x575251[_0x1499('0x13')](_0x2a4816)[_0x1499('0x14')]();};}function respondWithResult(_0x5de9a2,_0x4ab173){_0x4ab173=_0x4ab173||0xc8;return function(_0x4dd594){if(_0x4dd594){return _0x5de9a2[_0x1499('0x13')](_0x4ab173)[_0x1499('0x15')](_0x4dd594);}};}function respondWithFilteredResult(_0x34a928,_0x334d7e){return function(_0x2b95a5){if(_0x2b95a5){var _0x57a0a2=_0x2b95a5[_0x1499('0x16')],_0x5f34f2=_0x334d7e[_0x1499('0x17')],_0x308177=_0x334d7e[_0x1499('0x17')]+_0x334d7e[_0x1499('0x18')],_0x4e5195;if(_0x308177>=_0x57a0a2){_0x308177=_0x57a0a2;_0x4e5195=0xc8;}else{_0x4e5195=0xce;}_0x34a928['status'](_0x4e5195);return _0x34a928[_0x1499('0x19')](_0x1499('0x1a'),_0x5f34f2+'-'+_0x308177+'/'+_0x57a0a2)['json'](_0x2b95a5);}return null;};}function patchUpdates(_0x25164c){return function(_0x2d405f){try{jsonpatch[_0x1499('0x1b')](_0x2d405f,_0x25164c,!![]);}catch(_0xc92272){return BPromise[_0x1499('0x1c')](_0xc92272);}return _0x2d405f[_0x1499('0x1d')]();};}function saveUpdates(_0x5b9859,_0x541477){return function(_0x5bcb5f){if(_0x5bcb5f){return _0x5bcb5f[_0x1499('0x1e')](_0x5b9859)[_0x1499('0x1f')](function(_0x4a4e28){return _0x4a4e28;});}return null;};}function removeEntity(_0x351da9,_0x3c13a1){return function(_0x28dff3){if(_0x28dff3){return _0x28dff3[_0x1499('0x20')]()[_0x1499('0x1f')](function(){_0x351da9[_0x1499('0x13')](0xcc)[_0x1499('0x14')]();});}};}function handleEntityNotFound(_0x253439,_0xf8003e){return function(_0x15bcd4){if(!_0x15bcd4){_0x253439[_0x1499('0x21')](0x194);}return _0x15bcd4;};}function handleError(_0x836081,_0x223f4c){_0x223f4c=_0x223f4c||0x1f4;return function(_0x3b73f6){logger[_0x1499('0x22')](_0x3b73f6[_0x1499('0x23')]);if(_0x3b73f6[_0x1499('0x24')]){delete _0x3b73f6['name'];}_0x836081[_0x1499('0x13')](_0x223f4c)[_0x1499('0x25')](_0x3b73f6);};}exports[_0x1499('0x26')]=function(_0x3d10f3,_0x3968e0){var _0x16d036={},_0x54f3c2={},_0x501c0d={'count':0x0,'rows':[]};var _0x12739b=db[_0x1499('0x27')][_0x1499('0x28')];_0x54f3c2[_0x1499('0x29')]=_[_0x1499('0x2a')](_0x12739b);var _0x525d6f={'dateStart':_0x3d10f3[_0x1499('0x2b')]['dateStart'],'dateEnd':_0x3d10f3['query']['dateEnd']};delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2c')];delete _0x3d10f3[_0x1499('0x2b')][_0x1499('0x2d')];_0x54f3c2[_0x1499('0x2b')]=_[_0x1499('0x2a')](_0x3d10f3[_0x1499('0x2b')]);_0x54f3c2['filters']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],_0x54f3c2[_0x1499('0x2b')]);_0x16d036['attributes']=_[_0x1499('0x2e')](_0x54f3c2[_0x1499('0x29')],qs['fields'](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x2f')]));_0x16d036['attributes']=_0x16d036[_0x1499('0x30')][_0x1499('0x31')]?_0x16d036[_0x1499('0x30')]:_0x54f3c2[_0x1499('0x29')];if(!_0x3d10f3[_0x1499('0x2b')][_0x1499('0x32')](_0x1499('0x33'))){_0x16d036[_0x1499('0x18')]=qs[_0x1499('0x18')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x18')]);_0x16d036[_0x1499('0x17')]=qs[_0x1499('0x17')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x17')]);}_0x16d036[_0x1499('0x34')]=qs[_0x1499('0x35')](_0x3d10f3[_0x1499('0x2b')][_0x1499('0x35')]);_0x16d036[_0x1499('0x36')]=qs['filters'](_[_0x1499('0x37')](_0x3d10f3[_0x1499('0x2b')],_0x54f3c2[_0x1499('0x38')]));if(_0x525d6f[_0x1499('0x2c')]){if(_0x525d6f[_0x1499('0x2d')]){_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2d')])[_0x1499('0x39')](0x1,_0x1499('0x3a'));}else{_0x525d6f[_0x1499('0x2d')]=moment(_0x525d6f[_0x1499('0x2c')])['add'](0x1,'day');}_[_0x1499('0x3b')](_0x16d036['where'],{'createdAt':{'$gte':_0x525d6f[_0x1499('0x2c')],'$lte':_0x525d6f['dateEnd']}});}if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]){_0x16d036[_0x1499('0x36')]=_[_0x1499('0x3b')](_0x16d036['where'],{'$or':_[_0x1499('0x3d')](_0x16d036['attributes'],function(_0x2f9c59){var _0x3d518d={};_0x3d518d[_0x2f9c59]={'$like':'%'+_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3c')]+'%'};return _0x3d518d;})});}_0x16d036=_['merge']({},_0x16d036,_0x3d10f3[_0x1499('0x3e')]);var _0x815a99={'where':_0x16d036[_0x1499('0x36')]};return db[_0x1499('0x27')]['count'](_0x815a99)[_0x1499('0x1f')](function(_0x4cc411){_0x501c0d[_0x1499('0x16')]=_0x4cc411;if(_0x3d10f3[_0x1499('0x2b')][_0x1499('0x3f')]){_0x16d036[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x27')][_0x1499('0x41')](_0x16d036);})[_0x1499('0x1f')](function(_0xcb85eb){_0x501c0d[_0x1499('0x42')]=_0xcb85eb;return _0x501c0d;})[_0x1499('0x1f')](respondWithFilteredResult(_0x3968e0,_0x16d036))['catch'](handleError(_0x3968e0,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':!![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x29')]=_[_0x1499('0x2a')](db[_0x1499('0x27')][_0x1499('0x28')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2b')]);_0x5646cf[_0x1499('0x38')]=_['intersection'](_0x5646cf[_0x1499('0x29')],_0x5646cf[_0x1499('0x2b')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x29')],qs[_0x1499('0x2f')](_0x5dd36c[_0x1499('0x2b')]['fields']));_0x1af1a1[_0x1499('0x30')]=_0x1af1a1[_0x1499('0x30')][_0x1499('0x31')]?_0x1af1a1[_0x1499('0x30')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2b')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3b')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x27')][_0x1499('0x45')](_0x1af1a1)[_0x1499('0x1f')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x46')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x27')][_0x1499('0x46')](_0x491777[_0x1499('0x47')],{})[_0x1499('0x1f')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x48')](handleError(_0x7fa101,null));};exports[_0x1499('0x1e')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x47')]['id'];}return db[_0x1499('0x27')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x1f')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x1f')](respondWithResult(_0x420d16,null))[_0x1499('0x48')](handleError(_0x420d16,null));};exports[_0x1499('0x20')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x27')][_0x1499('0x45')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x1f')](handleEntityNotFound(_0x305599,null))[_0x1499('0x1f')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file +var _0x4325=['filters','pick','add','day','merge','where','map','options','includeAll','Tag','findAll','catch','show','params','rawAttributes','include','find','create','body','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','index','model','keys','query','dateStart','dateEnd','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x389c94,_0x2a93d9){var _0x1455cb=function(_0x5903d6){while(--_0x5903d6){_0x389c94['push'](_0x389c94['shift']());}};_0x1455cb(++_0x2a93d9);}(_0x4325,0x1da));var _0x5432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4325[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0x5432('0x0'));var rp=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var Mustache=require(_0x5432('0x3'));var util=require(_0x5432('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x5432('0x5'));var ejs=require(_0x5432('0x6'));var fs=require('fs');var _=require(_0x5432('0x7'));var squel=require('squel');var crypto=require(_0x5432('0x8'));var jsforce=require(_0x5432('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x5432('0x5'));var querystring=require('querystring');var Papa=require(_0x5432('0xa'));var qs=require(_0x5432('0xb'));var logger=require(_0x5432('0xc'))(_0x5432('0xd'));var utils=require(_0x5432('0xe'));var config=require('../../config/environment');var db=require(_0x5432('0xf'))['db'];function respondWithStatusCode(_0x58348a,_0x28ff19){_0x28ff19=_0x28ff19||0xcc;return function(_0x35faac){if(_0x35faac){return _0x58348a[_0x5432('0x10')](_0x28ff19);}return _0x58348a[_0x5432('0x11')](_0x28ff19)['end']();};}function respondWithResult(_0x5a5952,_0x11b25c){_0x11b25c=_0x11b25c||0xc8;return function(_0x24fb02){if(_0x24fb02){return _0x5a5952['status'](_0x11b25c)[_0x5432('0x12')](_0x24fb02);}};}function respondWithFilteredResult(_0x111c54,_0x3b1127){return function(_0x424b8f){if(_0x424b8f){var _0xb39d36=_0x424b8f[_0x5432('0x13')],_0x1a084d=_0x3b1127[_0x5432('0x14')],_0x54f41a=_0x3b1127[_0x5432('0x14')]+_0x3b1127[_0x5432('0x15')],_0x5617ce;if(_0x54f41a>=_0xb39d36){_0x54f41a=_0xb39d36;_0x5617ce=0xc8;}else{_0x5617ce=0xce;}_0x111c54[_0x5432('0x11')](_0x5617ce);return _0x111c54[_0x5432('0x16')]('Content-Range',_0x1a084d+'-'+_0x54f41a+'/'+_0xb39d36)[_0x5432('0x12')](_0x424b8f);}return null;};}function patchUpdates(_0x49e8fd){return function(_0x20aa50){try{jsonpatch[_0x5432('0x17')](_0x20aa50,_0x49e8fd,!![]);}catch(_0x333152){return BPromise[_0x5432('0x18')](_0x333152);}return _0x20aa50[_0x5432('0x19')]();};}function saveUpdates(_0x5f011f,_0x3f3873){return function(_0x22f030){if(_0x22f030){return _0x22f030[_0x5432('0x1a')](_0x5f011f)[_0x5432('0x1b')](function(_0x1cf960){return _0x1cf960;});}return null;};}function removeEntity(_0x451de4,_0x29e699){return function(_0x5da6ea){if(_0x5da6ea){return _0x5da6ea[_0x5432('0x1c')]()[_0x5432('0x1b')](function(){_0x451de4[_0x5432('0x11')](0xcc)[_0x5432('0x1d')]();});}};}function handleEntityNotFound(_0x44c1cb,_0x5dcb7b){return function(_0x5901e2){if(!_0x5901e2){_0x44c1cb['sendStatus'](0x194);}return _0x5901e2;};}function handleError(_0x61827e,_0xb900f2){_0xb900f2=_0xb900f2||0x1f4;return function(_0x19bdab){logger[_0x5432('0x1e')](_0x19bdab['stack']);if(_0x19bdab['name']){delete _0x19bdab[_0x5432('0x1f')];}_0x61827e[_0x5432('0x11')](_0xb900f2)['send'](_0x19bdab);};}exports[_0x5432('0x20')]=function(_0x375afe,_0x637582){var _0x4b6ea5={},_0xd9928a={},_0xccefeb={'count':0x0,'rows':[]};var _0xe7eda2=db['Tag']['rawAttributes'];_0xd9928a[_0x5432('0x21')]=_[_0x5432('0x22')](_0xe7eda2);var _0x589f79={'dateStart':_0x375afe[_0x5432('0x23')][_0x5432('0x24')],'dateEnd':_0x375afe[_0x5432('0x23')]['dateEnd']};delete _0x375afe[_0x5432('0x23')]['dateStart'];delete _0x375afe['query'][_0x5432('0x25')];_0xd9928a['query']=_[_0x5432('0x22')](_0x375afe['query']);_0xd9928a['filters']=_[_0x5432('0x26')](_0xd9928a[_0x5432('0x21')],_0xd9928a[_0x5432('0x23')]);_0x4b6ea5['attributes']=_[_0x5432('0x26')](_0xd9928a[_0x5432('0x21')],qs[_0x5432('0x27')](_0x375afe[_0x5432('0x23')][_0x5432('0x27')]));_0x4b6ea5[_0x5432('0x28')]=_0x4b6ea5[_0x5432('0x28')][_0x5432('0x29')]?_0x4b6ea5[_0x5432('0x28')]:_0xd9928a['model'];if(!_0x375afe['query'][_0x5432('0x2a')](_0x5432('0x2b'))){_0x4b6ea5[_0x5432('0x15')]=qs[_0x5432('0x15')](_0x375afe[_0x5432('0x23')]['limit']);_0x4b6ea5[_0x5432('0x14')]=qs['offset'](_0x375afe[_0x5432('0x23')][_0x5432('0x14')]);}_0x4b6ea5[_0x5432('0x2c')]=qs[_0x5432('0x2d')](_0x375afe[_0x5432('0x23')][_0x5432('0x2d')]);_0x4b6ea5['where']=qs[_0x5432('0x2e')](_[_0x5432('0x2f')](_0x375afe[_0x5432('0x23')],_0xd9928a[_0x5432('0x2e')]));if(_0x589f79['dateStart']){if(_0x589f79[_0x5432('0x25')]){_0x589f79[_0x5432('0x25')]=moment(_0x589f79[_0x5432('0x25')])[_0x5432('0x30')](0x1,_0x5432('0x31'));}else{_0x589f79[_0x5432('0x25')]=moment(_0x589f79[_0x5432('0x24')])[_0x5432('0x30')](0x1,_0x5432('0x31'));}_[_0x5432('0x32')](_0x4b6ea5[_0x5432('0x33')],{'createdAt':{'$gte':_0x589f79[_0x5432('0x24')],'$lte':_0x589f79[_0x5432('0x25')]}});}if(_0x375afe[_0x5432('0x23')]['filter']){_0x4b6ea5[_0x5432('0x33')]=_['merge'](_0x4b6ea5[_0x5432('0x33')],{'$or':_[_0x5432('0x34')](_0x4b6ea5[_0x5432('0x28')],function(_0x1a5561){var _0x4dc00e={};_0x4dc00e[_0x1a5561]={'$like':'%'+_0x375afe['query']['filter']+'%'};return _0x4dc00e;})});}_0x4b6ea5=_[_0x5432('0x32')]({},_0x4b6ea5,_0x375afe[_0x5432('0x35')]);var _0x139d0a={'where':_0x4b6ea5[_0x5432('0x33')]};return db['Tag'][_0x5432('0x13')](_0x139d0a)[_0x5432('0x1b')](function(_0x3cd343){_0xccefeb['count']=_0x3cd343;if(_0x375afe[_0x5432('0x23')][_0x5432('0x36')]){_0x4b6ea5['include']=[{'all':!![]}];}return db[_0x5432('0x37')][_0x5432('0x38')](_0x4b6ea5);})['then'](function(_0x23f8f4){_0xccefeb['rows']=_0x23f8f4;return _0xccefeb;})[_0x5432('0x1b')](respondWithFilteredResult(_0x637582,_0x4b6ea5))[_0x5432('0x39')](handleError(_0x637582,null));};exports[_0x5432('0x3a')]=function(_0x11c7f2,_0x5cf59a){var _0x9cfb8b={'raw':!![],'where':{'id':_0x11c7f2[_0x5432('0x3b')]['id']}},_0x4b93b4={};_0x4b93b4[_0x5432('0x21')]=_[_0x5432('0x22')](db[_0x5432('0x37')][_0x5432('0x3c')]);_0x4b93b4[_0x5432('0x23')]=_[_0x5432('0x22')](_0x11c7f2['query']);_0x4b93b4[_0x5432('0x2e')]=_[_0x5432('0x26')](_0x4b93b4[_0x5432('0x21')],_0x4b93b4[_0x5432('0x23')]);_0x9cfb8b[_0x5432('0x28')]=_[_0x5432('0x26')](_0x4b93b4[_0x5432('0x21')],qs['fields'](_0x11c7f2[_0x5432('0x23')][_0x5432('0x27')]));_0x9cfb8b[_0x5432('0x28')]=_0x9cfb8b[_0x5432('0x28')][_0x5432('0x29')]?_0x9cfb8b['attributes']:_0x4b93b4[_0x5432('0x21')];if(_0x11c7f2['query'][_0x5432('0x36')]){_0x9cfb8b[_0x5432('0x3d')]=[{'all':!![]}];}_0x9cfb8b=_['merge']({},_0x9cfb8b,_0x11c7f2[_0x5432('0x35')]);return db['Tag'][_0x5432('0x3e')](_0x9cfb8b)[_0x5432('0x1b')](handleEntityNotFound(_0x5cf59a,null))['then'](respondWithResult(_0x5cf59a,null))['catch'](handleError(_0x5cf59a,null));};exports[_0x5432('0x3f')]=function(_0xa971bd,_0x3718be){return db[_0x5432('0x37')][_0x5432('0x3f')](_0xa971bd[_0x5432('0x40')],{})[_0x5432('0x1b')](respondWithResult(_0x3718be,0xc9))['catch'](handleError(_0x3718be,null));};exports[_0x5432('0x1a')]=function(_0x14763c,_0x429da8){if(_0x14763c['body']['id']){delete _0x14763c['body']['id'];}return db['Tag']['find']({'where':{'id':_0x14763c[_0x5432('0x3b')]['id']}})[_0x5432('0x1b')](handleEntityNotFound(_0x429da8,null))[_0x5432('0x1b')](saveUpdates(_0x14763c[_0x5432('0x40')],null))[_0x5432('0x1b')](respondWithResult(_0x429da8,null))['catch'](handleError(_0x429da8,null));};exports[_0x5432('0x1c')]=function(_0xce691b,_0x7937f9){return db['Tag'][_0x5432('0x3e')]({'where':{'id':_0xce691b[_0x5432('0x3b')]['id']}})[_0x5432('0x1b')](handleEntityNotFound(_0x7937f9,null))[_0x5432('0x1b')](removeEntity(_0x7937f9,null))[_0x5432('0x39')](handleError(_0x7937f9,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index beeaaa2..cd8c133 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 _0xb6a8=['Tag','tools_tags','lodash','util','../../config/logger','api','moment','bluebird','define'];(function(_0x52f975,_0x305404){var _0x1b15a3=function(_0x5e9a63){while(--_0x5e9a63){_0x52f975['push'](_0x52f975['shift']());}};_0x1b15a3(++_0x305404);}(_0xb6a8,0xc8));var _0x8b6a=function(_0x591b53,_0x253049){_0x591b53=_0x591b53-0x0;var _0x2b9f0f=_0xb6a8[_0x591b53];return _0x2b9f0f;};'use strict';var _=require(_0x8b6a('0x0'));var util=require(_0x8b6a('0x1'));var logger=require(_0x8b6a('0x2'))(_0x8b6a('0x3'));var moment=require(_0x8b6a('0x4'));var BPromise=require(_0x8b6a('0x5'));var rp=require('request-promise');var attributes=require('./tag.attributes');module['exports']=function(_0x4aa68a,_0x26dc80){return _0x4aa68a[_0x8b6a('0x6')](_0x8b6a('0x7'),attributes,{'tableName':_0x8b6a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe944=['util','../../config/logger','api','moment','./tag.attributes','tools_tags','lodash'];(function(_0x24ddd5,_0x4933ec){var _0x35e166=function(_0x6868ca){while(--_0x6868ca){_0x24ddd5['push'](_0x24ddd5['shift']());}};_0x35e166(++_0x4933ec);}(_0xe944,0x117));var _0x4e94=function(_0x3e706d,_0x2c7ccb){_0x3e706d=_0x3e706d-0x0;var _0x525b87=_0xe944[_0x3e706d];return _0x525b87;};'use strict';var _=require(_0x4e94('0x0'));var util=require(_0x4e94('0x1'));var logger=require(_0x4e94('0x2'))(_0x4e94('0x3'));var moment=require(_0x4e94('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x4e94('0x5'));module['exports']=function(_0xcedacf,_0xc560d5){return _0xcedacf['define']('Tag',attributes,{'tableName':_0x4e94('0x6'),'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 3aa55ea..09cef8e 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 _0xc8d1=['../../config/environment','jayson/promise','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x28eedc,_0x176917){var _0x575e59=function(_0x40f58d){while(--_0x40f58d){_0x28eedc['push'](_0x28eedc['shift']());}};_0x575e59(++_0x176917);}(_0xc8d1,0x77));var _0x1c8d=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xc8d1[_0x280ae7];return _0x418b9e;};'use strict';var _=require('lodash');var util=require(_0x1c8d('0x0'));var moment=require(_0x1c8d('0x1'));var BPromise=require(_0x1c8d('0x2'));var rs=require(_0x1c8d('0x3'));var fs=require('fs');var db=require(_0x1c8d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1c8d('0x5'))(_0x1c8d('0x6'));var config=require(_0x1c8d('0x7'));var jayson=require(_0x1c8d('0x8'));var client=jayson['client'][_0x1c8d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x98b119,_0x65fb0f,_0x3115cb){return new BPromise(function(_0x34b607,_0x4624a8){return client[_0x1c8d('0xa')](_0x98b119,_0x3115cb)[_0x1c8d('0xb')](function(_0x2276bf){logger['info'](_0x1c8d('0xc'),_0x65fb0f,_0x1c8d('0xd'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x65fb0f,'request\x20sent',JSON[_0x1c8d('0xe')](_0x2276bf));if(_0x2276bf['error']){if(_0x2276bf[_0x1c8d('0xf')][_0x1c8d('0x10')]===0x1f4){logger['error'](_0x1c8d('0xc'),_0x65fb0f,_0x2276bf['error']['message']);return _0x4624a8(_0x2276bf[_0x1c8d('0xf')][_0x1c8d('0x11')]);}logger[_0x1c8d('0xf')](_0x1c8d('0xc'),_0x65fb0f,_0x2276bf['error'][_0x1c8d('0x11')]);return _0x34b607(_0x2276bf[_0x1c8d('0xf')]['message']);}else{logger[_0x1c8d('0x12')]('Tag,\x20%s,\x20%s',_0x65fb0f,_0x1c8d('0xd'));_0x34b607(_0x2276bf[_0x1c8d('0x13')][_0x1c8d('0x11')]);}})[_0x1c8d('0x14')](function(_0x19ec41){logger[_0x1c8d('0xf')](_0x1c8d('0xc'),_0x65fb0f,_0x19ec41);_0x4624a8(_0x19ec41);});});} \ No newline at end of file +var _0xe7c5=['error','code','message','result','lodash','util','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4efe4b,_0x2af93c){var _0x63e206=function(_0x2d2844){while(--_0x2d2844){_0x4efe4b['push'](_0x4efe4b['shift']());}};_0x63e206(++_0x2af93c);}(_0xe7c5,0xbf));var _0x5e7c=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0xe7c5[_0x43026b];return _0x4a96cd;};'use strict';var _=require(_0x5e7c('0x0'));var util=require(_0x5e7c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x5e7c('0x2'));var logger=require(_0x5e7c('0x3'))(_0x5e7c('0x4'));var config=require('../../config/environment');var jayson=require(_0x5e7c('0x5'));var client=jayson[_0x5e7c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24f1dc,_0x4d75da,_0x12cb6c){return new BPromise(function(_0x726f89,_0xe147f){return client['request'](_0x24f1dc,_0x12cb6c)[_0x5e7c('0x7')](function(_0x4d8303){logger[_0x5e7c('0x8')](_0x5e7c('0x9'),_0x4d75da,'request\x20sent');logger['debug'](_0x5e7c('0xa'),_0x4d75da,_0x5e7c('0xb'),JSON[_0x5e7c('0xc')](_0x4d8303));if(_0x4d8303['error']){if(_0x4d8303[_0x5e7c('0xd')][_0x5e7c('0xe')]===0x1f4){logger['error'](_0x5e7c('0x9'),_0x4d75da,_0x4d8303[_0x5e7c('0xd')]['message']);return _0xe147f(_0x4d8303['error']['message']);}logger[_0x5e7c('0xd')](_0x5e7c('0x9'),_0x4d75da,_0x4d8303[_0x5e7c('0xd')]['message']);return _0x726f89(_0x4d8303[_0x5e7c('0xd')][_0x5e7c('0xf')]);}else{logger['info'](_0x5e7c('0x9'),_0x4d75da,_0x5e7c('0xb'));_0x726f89(_0x4d8303[_0x5e7c('0x10')][_0x5e7c('0xf')]);}})['catch'](function(_0x186f10){logger[_0x5e7c('0xd')](_0x5e7c('0x9'),_0x4d75da,_0x186f10);_0xe147f(_0x186f10);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9e3f76a..ed3bcde 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 _0x7c24=['/:id/users','post','create','addQueues','put','update','delete','destroy','removeQueues','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/queues'];(function(_0x577270,_0x259e6f){var _0x17b5c2=function(_0x4a6766){while(--_0x4a6766){_0x577270['push'](_0x577270['shift']());}};_0x17b5c2(++_0x259e6f);}(_0x7c24,0x145));var _0x47c2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x7c24[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var path=require('path');var express=require('express');var router=express[_0x47c2('0x2')]();var auth=require(_0x47c2('0x3'));var interaction=require(_0x47c2('0x4'));var config=require(_0x47c2('0x5'));var controller=require('./team.controller');router[_0x47c2('0x6')]('/',auth[_0x47c2('0x7')](),controller['index']);router[_0x47c2('0x6')](_0x47c2('0x8'),auth['isAuthenticated'](),controller[_0x47c2('0x9')]);router[_0x47c2('0x6')](_0x47c2('0xa'),auth[_0x47c2('0x7')](),controller['getQueues']);router['get'](_0x47c2('0xb'),auth[_0x47c2('0x7')](),controller['getAgents']);router[_0x47c2('0xc')]('/',auth[_0x47c2('0x7')](),controller[_0x47c2('0xd')]);router[_0x47c2('0xc')]('/:id/queues',auth['isAuthenticated'](),controller[_0x47c2('0xe')]);router[_0x47c2('0xc')](_0x47c2('0xb'),auth['isAuthenticated'](),controller['addAgents']);router[_0x47c2('0xf')](_0x47c2('0x8'),auth[_0x47c2('0x7')](),controller[_0x47c2('0x10')]);router[_0x47c2('0x11')](_0x47c2('0x8'),auth[_0x47c2('0x7')](),controller[_0x47c2('0x12')]);router[_0x47c2('0x11')](_0x47c2('0xa'),auth[_0x47c2('0x7')](),controller[_0x47c2('0x13')]);router[_0x47c2('0x11')](_0x47c2('0xb'),auth[_0x47c2('0x7')](),controller['removeAgents']);module[_0x47c2('0x14')]=router; \ No newline at end of file +var _0xd8a6=['../../config/environment','./team.controller','get','isAuthenticated','index','/:id/queues','/:id/users','getAgents','post','create','addQueues','addAgents','/:id','update','delete','destroy','removeAgents','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8a6,0x71));var _0x6d8a=function(_0x59b907,_0x33de40){_0x59b907=_0x59b907-0x0;var _0x13fab4=_0xd8a6[_0x59b907];return _0x13fab4;};'use strict';var multer=require(_0x6d8a('0x0'));var util=require(_0x6d8a('0x1'));var path=require(_0x6d8a('0x2'));var express=require(_0x6d8a('0x3'));var router=express[_0x6d8a('0x4')]();var auth=require(_0x6d8a('0x5'));var interaction=require(_0x6d8a('0x6'));var config=require(_0x6d8a('0x7'));var controller=require(_0x6d8a('0x8'));router[_0x6d8a('0x9')]('/',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0xb')]);router['get']('/:id',auth[_0x6d8a('0xa')](),controller['show']);router['get'](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller['getQueues']);router[_0x6d8a('0x9')](_0x6d8a('0xd'),auth[_0x6d8a('0xa')](),controller[_0x6d8a('0xe')]);router[_0x6d8a('0xf')]('/',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x10')]);router[_0x6d8a('0xf')](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x11')]);router['post'](_0x6d8a('0xd'),auth['isAuthenticated'](),controller[_0x6d8a('0x12')]);router['put'](_0x6d8a('0x13'),auth['isAuthenticated'](),controller[_0x6d8a('0x14')]);router[_0x6d8a('0x15')]('/:id',auth[_0x6d8a('0xa')](),controller[_0x6d8a('0x16')]);router[_0x6d8a('0x15')](_0x6d8a('0xc'),auth[_0x6d8a('0xa')](),controller['removeQueues']);router[_0x6d8a('0x15')](_0x6d8a('0xd'),auth['isAuthenticated'](),controller[_0x6d8a('0x17')]);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 6bf6ada..e9af85a 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 _0xc336=['exports','name'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xc336,0xd2));var _0x6c33=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xc336[_0x1a8f86];return _0x20d876;};'use strict';var Sequelize=require('sequelize');module[_0x6c33('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c33('0x1')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3838=['STRING'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0x3838,0xdf));var _0x8383=function(_0x4d9f6a,_0x51d38b){_0x4d9f6a=_0x4d9f6a-0x0;var _0x6d44ab=_0x3838[_0x4d9f6a];return _0x6d44ab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8383('0x0')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x8383('0x0')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index d1283b2..87bc70d 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 _0xbb67=['sms','openchannel','each','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','upsert','%s/%s','SIP','omit','spread','emit','userTeam:save','removeAgents','mail','fax','isArray','userTeam:remove','getAgents','filter','map','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','query','dateStart','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','options','Team','rows','catch','params','include','find','create','body','getQueues','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','get','addQueues','findOne','Queues','ids','removeQueues','remove','addAgents','voice','chat'];(function(_0x13e563,_0x4bd012){var _0x44fa81=function(_0x512839){while(--_0x512839){_0x13e563['push'](_0x13e563['shift']());}};_0x44fa81(++_0x4bd012);}(_0xbb67,0x161));var _0x7bb6=function(_0x56e9eb,_0x931e84){_0x56e9eb=_0x56e9eb-0x0;var _0x5d36f7=_0xbb67[_0x56e9eb];return _0x5d36f7;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x7bb6('0x0'));var moment=require(_0x7bb6('0x1'));var BPromise=require(_0x7bb6('0x2'));var Mustache=require(_0x7bb6('0x3'));var util=require(_0x7bb6('0x4'));var path=require('path');var sox=require(_0x7bb6('0x5'));var csv=require(_0x7bb6('0x6'));var ejs=require(_0x7bb6('0x7'));var fs=require('fs');var _=require(_0x7bb6('0x8'));var squel=require(_0x7bb6('0x9'));var crypto=require(_0x7bb6('0xa'));var jsforce=require(_0x7bb6('0xb'));var deskjs=require(_0x7bb6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7bb6('0xd'));var Papa=require(_0x7bb6('0xe'));var qs=require(_0x7bb6('0xf'));var logger=require(_0x7bb6('0x10'))(_0x7bb6('0x11'));var utils=require(_0x7bb6('0x12'));var config=require(_0x7bb6('0x13'));var db=require(_0x7bb6('0x14'))['db'];var socket=require(_0x7bb6('0x15'))({'host':'localhost','port':0x18eb});require(_0x7bb6('0x16'))[_0x7bb6('0x17')](socket);function respondWithStatusCode(_0xdf6a76,_0x46be82){_0x46be82=_0x46be82||0xcc;return function(_0x1344fd){if(_0x1344fd){return _0xdf6a76[_0x7bb6('0x18')](_0x46be82);}return _0xdf6a76[_0x7bb6('0x19')](_0x46be82)[_0x7bb6('0x1a')]();};}function respondWithResult(_0x9367c6,_0x495cf2){_0x495cf2=_0x495cf2||0xc8;return function(_0x5e8002){if(_0x5e8002){return _0x9367c6[_0x7bb6('0x19')](_0x495cf2)[_0x7bb6('0x1b')](_0x5e8002);}};}function respondWithFilteredResult(_0x4d093f,_0x3240d9){return function(_0x415ad6){if(_0x415ad6){var _0x2868cc=_0x415ad6['count'],_0x3f6ed6=_0x3240d9[_0x7bb6('0x1c')],_0x2bd3b4=_0x3240d9[_0x7bb6('0x1c')]+_0x3240d9[_0x7bb6('0x1d')],_0x3d12cb;if(_0x2bd3b4>=_0x2868cc){_0x2bd3b4=_0x2868cc;_0x3d12cb=0xc8;}else{_0x3d12cb=0xce;}_0x4d093f[_0x7bb6('0x19')](_0x3d12cb);return _0x4d093f[_0x7bb6('0x1e')](_0x7bb6('0x1f'),_0x3f6ed6+'-'+_0x2bd3b4+'/'+_0x2868cc)['json'](_0x415ad6);}return null;};}function patchUpdates(_0xd1b489){return function(_0x5de5d4){try{jsonpatch[_0x7bb6('0x20')](_0x5de5d4,_0xd1b489,!![]);}catch(_0x86d630){return BPromise[_0x7bb6('0x21')](_0x86d630);}return _0x5de5d4['save']();};}function saveUpdates(_0x54a381,_0x533f9a){return function(_0x15eafb){if(_0x15eafb){return _0x15eafb[_0x7bb6('0x22')](_0x54a381)[_0x7bb6('0x23')](function(_0x30eb86){return _0x30eb86;});}return null;};}function removeEntity(_0x224342,_0x28d73e){return function(_0x50dc68){if(_0x50dc68){return _0x50dc68[_0x7bb6('0x24')]()[_0x7bb6('0x23')](function(){_0x224342['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4df0de,_0x16f4ba){return function(_0x1c91d3){if(!_0x1c91d3){_0x4df0de[_0x7bb6('0x18')](0x194);}return _0x1c91d3;};}function handleError(_0x541a1a,_0x38a569){_0x38a569=_0x38a569||0x1f4;return function(_0x2b989f){logger[_0x7bb6('0x25')](_0x2b989f[_0x7bb6('0x26')]);if(_0x2b989f[_0x7bb6('0x27')]){delete _0x2b989f[_0x7bb6('0x27')];}_0x541a1a['status'](_0x38a569)[_0x7bb6('0x28')](_0x2b989f);};}exports['index']=function(_0x1dade2,_0x472955){var _0x5d82d5={},_0x7a96b8={},_0x4058c4={'count':0x0,'rows':[]};var _0x3896ba=db['Team'][_0x7bb6('0x29')];_0x7a96b8['model']=_['keys'](_0x3896ba);var _0x8ac935={'dateStart':_0x1dade2[_0x7bb6('0x2a')][_0x7bb6('0x2b')],'dateEnd':_0x1dade2[_0x7bb6('0x2a')][_0x7bb6('0x2c')]};delete _0x1dade2[_0x7bb6('0x2a')]['dateStart'];delete _0x1dade2[_0x7bb6('0x2a')]['dateEnd'];_0x7a96b8[_0x7bb6('0x2a')]=_[_0x7bb6('0x2d')](_0x1dade2[_0x7bb6('0x2a')]);_0x7a96b8['filters']=_[_0x7bb6('0x2e')](_0x7a96b8[_0x7bb6('0x2f')],_0x7a96b8[_0x7bb6('0x2a')]);_0x5d82d5[_0x7bb6('0x30')]=_['intersection'](_0x7a96b8[_0x7bb6('0x2f')],qs[_0x7bb6('0x31')](_0x1dade2[_0x7bb6('0x2a')][_0x7bb6('0x31')]));_0x5d82d5[_0x7bb6('0x30')]=_0x5d82d5['attributes'][_0x7bb6('0x32')]?_0x5d82d5[_0x7bb6('0x30')]:_0x7a96b8[_0x7bb6('0x2f')];if(!_0x1dade2['query'][_0x7bb6('0x33')]('nolimit')){_0x5d82d5[_0x7bb6('0x1d')]=qs['limit'](_0x1dade2[_0x7bb6('0x2a')][_0x7bb6('0x1d')]);_0x5d82d5[_0x7bb6('0x1c')]=qs[_0x7bb6('0x1c')](_0x1dade2['query']['offset']);}_0x5d82d5[_0x7bb6('0x34')]=qs['sort'](_0x1dade2[_0x7bb6('0x2a')][_0x7bb6('0x35')]);_0x5d82d5[_0x7bb6('0x36')]=qs[_0x7bb6('0x37')](_[_0x7bb6('0x38')](_0x1dade2[_0x7bb6('0x2a')],_0x7a96b8[_0x7bb6('0x37')]));if(_0x8ac935[_0x7bb6('0x2b')]){if(_0x8ac935[_0x7bb6('0x2c')]){_0x8ac935[_0x7bb6('0x2c')]=moment(_0x8ac935['dateEnd'])[_0x7bb6('0x39')](0x1,_0x7bb6('0x3a'));}else{_0x8ac935[_0x7bb6('0x2c')]=moment(_0x8ac935[_0x7bb6('0x2b')])[_0x7bb6('0x39')](0x1,_0x7bb6('0x3a'));}_[_0x7bb6('0x3b')](_0x5d82d5[_0x7bb6('0x36')],{'createdAt':{'$gte':_0x8ac935[_0x7bb6('0x2b')],'$lte':_0x8ac935[_0x7bb6('0x2c')]}});}if(_0x1dade2[_0x7bb6('0x2a')]['filter']){_0x5d82d5[_0x7bb6('0x36')]=_[_0x7bb6('0x3b')](_0x5d82d5['where'],{'$or':_['map'](_0x5d82d5[_0x7bb6('0x30')],function(_0x1a4732){var _0x2dae3f={};_0x2dae3f[_0x1a4732]={'$like':'%'+_0x1dade2[_0x7bb6('0x2a')]['filter']+'%'};return _0x2dae3f;})});}_0x5d82d5=_[_0x7bb6('0x3b')]({},_0x5d82d5,_0x1dade2[_0x7bb6('0x3c')]);var _0x33d55b={'where':_0x5d82d5[_0x7bb6('0x36')]};return db[_0x7bb6('0x3d')]['count'](_0x33d55b)['then'](function(_0x3d7970){_0x4058c4['count']=_0x3d7970;if(_0x1dade2[_0x7bb6('0x2a')]['includeAll']){_0x5d82d5['include']=[{'all':!![]}];}return db[_0x7bb6('0x3d')]['findAll'](_0x5d82d5);})['then'](function(_0x42fac2){_0x4058c4[_0x7bb6('0x3e')]=_0x42fac2;return _0x4058c4;})['then'](respondWithFilteredResult(_0x472955,_0x5d82d5))[_0x7bb6('0x3f')](handleError(_0x472955,null));};exports['show']=function(_0x128f06,_0x22a97d){var _0x3e4b18={'raw':![],'where':{'id':_0x128f06[_0x7bb6('0x40')]['id']}},_0x13ff93={};_0x13ff93['model']=_[_0x7bb6('0x2d')](db[_0x7bb6('0x3d')][_0x7bb6('0x29')]);_0x13ff93[_0x7bb6('0x2a')]=_['keys'](_0x128f06[_0x7bb6('0x2a')]);_0x13ff93[_0x7bb6('0x37')]=_[_0x7bb6('0x2e')](_0x13ff93['model'],_0x13ff93[_0x7bb6('0x2a')]);_0x3e4b18[_0x7bb6('0x30')]=_[_0x7bb6('0x2e')](_0x13ff93['model'],qs[_0x7bb6('0x31')](_0x128f06[_0x7bb6('0x2a')][_0x7bb6('0x31')]));_0x3e4b18[_0x7bb6('0x30')]=_0x3e4b18[_0x7bb6('0x30')][_0x7bb6('0x32')]?_0x3e4b18['attributes']:_0x13ff93['model'];if(_0x128f06['query']['includeAll']){_0x3e4b18[_0x7bb6('0x41')]=[{'all':!![]}];}_0x3e4b18=_[_0x7bb6('0x3b')]({},_0x3e4b18,_0x128f06[_0x7bb6('0x3c')]);return db['Team'][_0x7bb6('0x42')](_0x3e4b18)['then'](handleEntityNotFound(_0x22a97d,null))[_0x7bb6('0x23')](respondWithResult(_0x22a97d,null))['catch'](handleError(_0x22a97d,null));};exports[_0x7bb6('0x43')]=function(_0x516230,_0x222628){return db[_0x7bb6('0x3d')][_0x7bb6('0x43')](_0x516230[_0x7bb6('0x44')],{})['then'](respondWithResult(_0x222628,0xc9))[_0x7bb6('0x3f')](handleError(_0x222628,null));};exports['update']=function(_0x5135b7,_0x2db784){if(_0x5135b7[_0x7bb6('0x44')]['id']){delete _0x5135b7[_0x7bb6('0x44')]['id'];}return db[_0x7bb6('0x3d')][_0x7bb6('0x42')]({'where':{'id':_0x5135b7['params']['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x2db784,null))[_0x7bb6('0x23')](saveUpdates(_0x5135b7['body'],null))[_0x7bb6('0x23')](respondWithResult(_0x2db784,null))[_0x7bb6('0x3f')](handleError(_0x2db784,null));};exports['destroy']=function(_0x5a5ab2,_0x57a7b6){return db[_0x7bb6('0x3d')][_0x7bb6('0x42')]({'where':{'id':_0x5a5ab2[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x57a7b6,null))[_0x7bb6('0x23')](removeEntity(_0x57a7b6,null))[_0x7bb6('0x3f')](handleError(_0x57a7b6,null));};exports[_0x7bb6('0x45')]=function(_0x369f96,_0x1fd3f0,_0x4c13d3){return db[_0x7bb6('0x3d')]['findOne']({'where':{'id':_0x369f96[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x1fd3f0,null))[_0x7bb6('0x23')](function(_0x4e29dd){if(!_0x369f96['query'][_0x7bb6('0x46')]||!utils[_0x7bb6('0x47')](_0x369f96[_0x7bb6('0x2a')][_0x7bb6('0x46')])){throw new db[(_0x7bb6('0x48'))][(_0x7bb6('0x49'))](_0x7bb6('0x4a'));}var _0x1d180f={};var _0x212701={};_0x212701[_0x7bb6('0x2f')]=_[_0x7bb6('0x2d')](db[_[_0x7bb6('0x4b')](_0x369f96[_0x7bb6('0x2a')][_0x7bb6('0x46')][_0x7bb6('0x4c')]())+'Queue']['rawAttributes']);_0x212701['query']=_[_0x7bb6('0x2d')](_0x369f96['query']);_0x212701[_0x7bb6('0x37')]=_['intersection'](_0x212701[_0x7bb6('0x2f')],_0x212701[_0x7bb6('0x2a')]);_0x1d180f[_0x7bb6('0x30')]=_[_0x7bb6('0x2e')](_0x212701[_0x7bb6('0x2f')],qs[_0x7bb6('0x31')](_0x369f96['query']['fields']));_0x1d180f[_0x7bb6('0x30')]=_0x1d180f[_0x7bb6('0x30')][_0x7bb6('0x32')]?_0x1d180f[_0x7bb6('0x30')]:_0x212701[_0x7bb6('0x2f')];_0x1d180f['limit']=qs[_0x7bb6('0x1d')](_0x369f96[_0x7bb6('0x2a')][_0x7bb6('0x1d')]);_0x1d180f['offset']=qs[_0x7bb6('0x1c')](_0x369f96[_0x7bb6('0x2a')][_0x7bb6('0x1c')]);_0x1d180f[_0x7bb6('0x34')]=qs[_0x7bb6('0x35')](_0x369f96['query']['sort']);_0x1d180f[_0x7bb6('0x36')]=qs[_0x7bb6('0x37')](_[_0x7bb6('0x38')](_0x369f96['query'],_0x212701[_0x7bb6('0x37')]));_0x1d180f=_[_0x7bb6('0x3b')]({},_0x1d180f,_0x369f96[_0x7bb6('0x3c')]);return _0x4e29dd[_0x7bb6('0x4d')+_['capitalize'](_0x369f96[_0x7bb6('0x2a')][_0x7bb6('0x46')][_0x7bb6('0x4c')]())+'Queues'](_0x1d180f);})[_0x7bb6('0x23')](respondWithResult(_0x1fd3f0,null))[_0x7bb6('0x3f')](handleError(_0x1fd3f0,null));};exports[_0x7bb6('0x4e')]=function(_0x2edcdc,_0x1dc3ca,_0xfa293){return db[_0x7bb6('0x3d')][_0x7bb6('0x4f')]({'where':{'id':_0x2edcdc[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](function(_0x4c638a){if(_0x4c638a){if(!_0x2edcdc[_0x7bb6('0x44')]['channel']||!utils[_0x7bb6('0x47')](_0x2edcdc[_0x7bb6('0x44')][_0x7bb6('0x46')])){throw new db['Sequelize'][(_0x7bb6('0x49'))]('Unknown\x20channel');}return _0x4c638a[_0x7bb6('0x39')+_[_0x7bb6('0x4b')](_0x2edcdc[_0x7bb6('0x44')][_0x7bb6('0x46')][_0x7bb6('0x4c')]())+_0x7bb6('0x50')](_0x2edcdc[_0x7bb6('0x44')][_0x7bb6('0x51')]);}return null;})[_0x7bb6('0x23')](handleEntityNotFound(_0x1dc3ca,null))[_0x7bb6('0x23')](respondWithStatusCode(_0x1dc3ca,null))[_0x7bb6('0x3f')](handleError(_0x1dc3ca,null));};exports[_0x7bb6('0x52')]=function(_0x43e284,_0x22a4f4,_0x30b5b9){return db[_0x7bb6('0x3d')][_0x7bb6('0x4f')]({'where':{'id':_0x43e284[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](function(_0x2d304c){if(_0x2d304c){if(!_0x43e284[_0x7bb6('0x2a')]['channel']||!utils[_0x7bb6('0x47')](_0x43e284['query'][_0x7bb6('0x46')])){throw new db[(_0x7bb6('0x48'))][(_0x7bb6('0x49'))](_0x7bb6('0x4a'));}return _0x2d304c[_0x7bb6('0x53')+_[_0x7bb6('0x4b')](_0x43e284['query'][_0x7bb6('0x46')][_0x7bb6('0x4c')]())+_0x7bb6('0x50')](_0x43e284[_0x7bb6('0x2a')][_0x7bb6('0x51')]);}return null;})[_0x7bb6('0x23')](handleEntityNotFound(_0x22a4f4,null))[_0x7bb6('0x23')](respondWithStatusCode(_0x22a4f4,null))[_0x7bb6('0x3f')](handleError(_0x22a4f4,null));};exports[_0x7bb6('0x54')]=function(_0x428819,_0x3fb9ba,_0x4f1780){return db[_0x7bb6('0x3d')]['find']({'where':{'id':_0x428819[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x3fb9ba,null))[_0x7bb6('0x23')](function(_0x6fcf96){if(_0x6fcf96){return BPromise['each']([_0x7bb6('0x55'),_0x7bb6('0x56'),'mail',_0x7bb6('0x57'),'fax',_0x7bb6('0x58')],function(_0x7e9412){return _0x6fcf96[_0x7bb6('0x4d')+_['capitalize'](_0x7e9412)+'Queues']({'attributes':['id',_0x7bb6('0x27')]})[_0x7bb6('0x23')](function(_0x1c73d7){return BPromise[_0x7bb6('0x59')](_0x1c73d7,function(_0x5dcd65){return _0x5dcd65['addAgents'](_0x428819[_0x7bb6('0x44')][_0x7bb6('0x51')])[_0x7bb6('0x23')](function(){if(_0x7e9412===_0x7bb6('0x55')){return db[_0x7bb6('0x5a')][_0x7bb6('0x5b')]({'where':{'id':_0x428819[_0x7bb6('0x44')][_0x7bb6('0x51')]},'attributes':['id','name',_0x7bb6('0x5c'),_0x7bb6('0x5d')],'raw':!![]});}})[_0x7bb6('0x23')](function(_0x57a99e){if(_0x7e9412===_0x7bb6('0x55')){return BPromise[_0x7bb6('0x59')](_0x57a99e,function(_0x8ef40c){return db[_0x7bb6('0x5e')][_0x7bb6('0x5f')]({'membername':_0x8ef40c['name'],'UserId':_0x8ef40c['id'],'queue_name':_0x5dcd65[_0x7bb6('0x27')],'VoiceQueueId':_0x5dcd65['id'],'interface':util['format'](_0x7bb6('0x60'),_0x7bb6('0x61'),_0x8ef40c[_0x7bb6('0x27')]),'paused':_0x8ef40c[_0x7bb6('0x5d')]||![],'penalty':0x0});});}});});})[_0x7bb6('0x23')](function(){return _0x6fcf96;});})['then'](function(){return _0x6fcf96;});}})['then'](function(_0xfdda99){if(_0xfdda99){return _0xfdda99['addAgents'](_0x428819[_0x7bb6('0x44')][_0x7bb6('0x51')],_[_0x7bb6('0x62')](_0x428819[_0x7bb6('0x44')],[_0x7bb6('0x51'),'id'])||{})[_0x7bb6('0x63')](function(_0x14b605){for(var _0x561fd3=0x0;_0x561fd3<_0x428819[_0x7bb6('0x44')]['ids'][_0x7bb6('0x32')];_0x561fd3+=0x1){socket[_0x7bb6('0x64')](_0x7bb6('0x65'),{'UserId':_0x428819['body'][_0x7bb6('0x51')][_0x561fd3],'TeamId':_0x428819[_0x7bb6('0x40')]['id']});}return _0x14b605;});}})[_0x7bb6('0x23')](respondWithResult(_0x3fb9ba,null))[_0x7bb6('0x3f')](handleError(_0x3fb9ba,null));};exports[_0x7bb6('0x66')]=function(_0x15ac33,_0x3c7319,_0x3e6b20){var _0x48935a;return db['Team'][_0x7bb6('0x42')]({'where':{'id':_0x15ac33[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x3c7319,null))[_0x7bb6('0x23')](function(_0x3af398){if(_0x3af398){return BPromise[_0x7bb6('0x59')]([_0x7bb6('0x55'),_0x7bb6('0x56'),_0x7bb6('0x67'),_0x7bb6('0x57'),_0x7bb6('0x68'),_0x7bb6('0x58')],function(_0x6f92f4){return _0x3af398['get'+_['capitalize'](_0x6f92f4)+_0x7bb6('0x50')]({'attributes':['id',_0x7bb6('0x27')]})[_0x7bb6('0x23')](function(_0x263547){return BPromise[_0x7bb6('0x59')](_0x263547,function(_0x10eef6){return _0x10eef6[_0x7bb6('0x66')](_0x15ac33['query'][_0x7bb6('0x51')])[_0x7bb6('0x23')](function(){if(_0x6f92f4===_0x7bb6('0x55')){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x10eef6['id'],'UserId':_0x15ac33[_0x7bb6('0x2a')]['ids']}});}});});})['then'](function(){return _0x3af398;});})[_0x7bb6('0x23')](function(){return _0x3af398;});}})[_0x7bb6('0x23')](function(_0x3d4ea9){if(_0x3d4ea9){return _0x3d4ea9[_0x7bb6('0x66')](_0x15ac33['query'][_0x7bb6('0x51')])[_0x7bb6('0x23')](function(_0x5b3e96){if(_[_0x7bb6('0x69')](_0x15ac33[_0x7bb6('0x2a')][_0x7bb6('0x51')])){for(var _0x2321c9=0x0;_0x2321c9<_0x15ac33['query'][_0x7bb6('0x51')][_0x7bb6('0x32')];_0x2321c9+=0x1){socket[_0x7bb6('0x64')](_0x7bb6('0x6a'),{'UserId':_0x15ac33['query'][_0x7bb6('0x51')][_0x2321c9],'TeamId':_0x15ac33[_0x7bb6('0x40')]['id']});}}else{socket[_0x7bb6('0x64')](_0x7bb6('0x6a'),{'UserId':_0x15ac33[_0x7bb6('0x2a')]['ids'],'TeamId':_0x15ac33[_0x7bb6('0x40')]['id']});}});}})[_0x7bb6('0x23')](respondWithStatusCode(_0x3c7319,null))[_0x7bb6('0x3f')](handleError(_0x3c7319,null));};exports[_0x7bb6('0x6b')]=function(_0x497f8f,_0x301223,_0x2eae34){var _0x3349dd={};var _0x6ed9a0={};var _0x4681a8;var _0x17234c;return db[_0x7bb6('0x3d')][_0x7bb6('0x4f')]({'where':{'id':_0x497f8f[_0x7bb6('0x40')]['id']}})[_0x7bb6('0x23')](handleEntityNotFound(_0x301223,null))[_0x7bb6('0x23')](function(_0x5d6c32){if(_0x5d6c32){_0x4681a8=_0x5d6c32;_0x6ed9a0['model']=_[_0x7bb6('0x2d')](db[_0x7bb6('0x5a')][_0x7bb6('0x29')]);_0x6ed9a0['query']=_[_0x7bb6('0x2d')](_0x497f8f[_0x7bb6('0x2a')]);_0x6ed9a0[_0x7bb6('0x37')]=_[_0x7bb6('0x2e')](_0x6ed9a0[_0x7bb6('0x2f')],_0x6ed9a0['query']);_0x3349dd[_0x7bb6('0x30')]=_[_0x7bb6('0x2e')](_0x6ed9a0[_0x7bb6('0x2f')],qs[_0x7bb6('0x31')](_0x497f8f[_0x7bb6('0x2a')][_0x7bb6('0x31')]));_0x3349dd['attributes']=_0x3349dd['attributes'][_0x7bb6('0x32')]?_0x3349dd[_0x7bb6('0x30')]:_0x6ed9a0[_0x7bb6('0x2f')];_0x3349dd[_0x7bb6('0x34')]=qs[_0x7bb6('0x35')](_0x497f8f[_0x7bb6('0x2a')][_0x7bb6('0x35')]);_0x3349dd[_0x7bb6('0x36')]=qs[_0x7bb6('0x37')](_['pick'](_0x497f8f[_0x7bb6('0x2a')],_0x6ed9a0['filters']));if(_0x497f8f['query'][_0x7bb6('0x6c')]){_0x3349dd[_0x7bb6('0x36')]=_[_0x7bb6('0x3b')](_0x3349dd[_0x7bb6('0x36')],{'$or':_[_0x7bb6('0x6d')](_0x3349dd[_0x7bb6('0x30')],function(_0x2fa27c){var _0x24c191={};_0x24c191[_0x2fa27c]={'$like':'%'+_0x497f8f['query'][_0x7bb6('0x6c')]+'%'};return _0x24c191;})});}_0x3349dd=_['merge']({},_0x3349dd,_0x497f8f[_0x7bb6('0x3c')]);return _0x4681a8[_0x7bb6('0x6b')](_0x3349dd);}})[_0x7bb6('0x23')](function(_0x48c5cc){if(_0x48c5cc){_0x17234c=_0x48c5cc[_0x7bb6('0x32')];if(!_0x497f8f[_0x7bb6('0x2a')][_0x7bb6('0x33')]('nolimit')){_0x3349dd[_0x7bb6('0x1d')]=qs[_0x7bb6('0x1d')](_0x497f8f[_0x7bb6('0x2a')][_0x7bb6('0x1d')]);_0x3349dd[_0x7bb6('0x1c')]=qs['offset'](_0x497f8f[_0x7bb6('0x2a')][_0x7bb6('0x1c')]);}return _0x4681a8['getAgents'](_0x3349dd);}})[_0x7bb6('0x23')](function(_0x35f7d1){if(_0x35f7d1){return _0x35f7d1?{'count':_0x17234c,'rows':_0x35f7d1}:null;}})['then'](respondWithResult(_0x301223,null))[_0x7bb6('0x3f')](handleError(_0x301223,null));}; \ No newline at end of file +var _0x1fcc=['register','status','end','json','count','offset','limit','set','apply','reject','save','then','destroy','sendStatus','error','name','send','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','Team','includeAll','include','rows','catch','show','params','options','find','create','body','getQueues','findOne','isValidChannel','Sequelize','Unknown\x20channel','capitalize','channel','toLowerCase','Queue','get','Queues','addQueues','ValidationError','ids','removeQueues','remove','addAgents','each','voice','chat','mail','fax','openchannel','User','findAll','loginInPause','voicePause','UserVoiceQueueRt','%s/%s','SIP','spread','userTeam:save','removeAgents','isArray','userTeam:remove','getAgents','map','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','socket.io-emitter','./team.socket'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1fcc,0x125));var _0xc1fc=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0x1fcc[_0x2aefb6];return _0x202772;};'use strict';var jsonpatch=require(_0xc1fc('0x0'));var rp=require(_0xc1fc('0x1'));var moment=require('moment');var BPromise=require(_0xc1fc('0x2'));var Mustache=require(_0xc1fc('0x3'));var util=require(_0xc1fc('0x4'));var path=require(_0xc1fc('0x5'));var sox=require(_0xc1fc('0x6'));var csv=require(_0xc1fc('0x7'));var ejs=require(_0xc1fc('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc1fc('0x9'));var crypto=require(_0xc1fc('0xa'));var jsforce=require(_0xc1fc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc1fc('0x7'));var querystring=require(_0xc1fc('0xc'));var Papa=require('papaparse');var qs=require(_0xc1fc('0xd'));var logger=require(_0xc1fc('0xe'))('api');var utils=require(_0xc1fc('0xf'));var config=require('../../config/environment');var db=require(_0xc1fc('0x10'))['db'];var socket=require(_0xc1fc('0x11'))({'host':'localhost','port':0x18eb});require(_0xc1fc('0x12'))[_0xc1fc('0x13')](socket);function respondWithStatusCode(_0x2a1426,_0x119d27){_0x119d27=_0x119d27||0xcc;return function(_0x62369d){if(_0x62369d){return _0x2a1426['sendStatus'](_0x119d27);}return _0x2a1426[_0xc1fc('0x14')](_0x119d27)[_0xc1fc('0x15')]();};}function respondWithResult(_0x354393,_0x55c62b){_0x55c62b=_0x55c62b||0xc8;return function(_0x159158){if(_0x159158){return _0x354393[_0xc1fc('0x14')](_0x55c62b)[_0xc1fc('0x16')](_0x159158);}};}function respondWithFilteredResult(_0x52b0bb,_0x2a8519){return function(_0x338ca8){if(_0x338ca8){var _0x2c5d9b=_0x338ca8[_0xc1fc('0x17')],_0x201115=_0x2a8519[_0xc1fc('0x18')],_0x232bc2=_0x2a8519[_0xc1fc('0x18')]+_0x2a8519[_0xc1fc('0x19')],_0xd04a31;if(_0x232bc2>=_0x2c5d9b){_0x232bc2=_0x2c5d9b;_0xd04a31=0xc8;}else{_0xd04a31=0xce;}_0x52b0bb['status'](_0xd04a31);return _0x52b0bb[_0xc1fc('0x1a')]('Content-Range',_0x201115+'-'+_0x232bc2+'/'+_0x2c5d9b)['json'](_0x338ca8);}return null;};}function patchUpdates(_0x6c0e26){return function(_0x20f4ec){try{jsonpatch[_0xc1fc('0x1b')](_0x20f4ec,_0x6c0e26,!![]);}catch(_0x8f5528){return BPromise[_0xc1fc('0x1c')](_0x8f5528);}return _0x20f4ec[_0xc1fc('0x1d')]();};}function saveUpdates(_0x28e2d2,_0x1ae5b6){return function(_0x2042b8){if(_0x2042b8){return _0x2042b8['update'](_0x28e2d2)[_0xc1fc('0x1e')](function(_0x36122b){return _0x36122b;});}return null;};}function removeEntity(_0x56b0f3,_0x5f41b7){return function(_0x36345c){if(_0x36345c){return _0x36345c[_0xc1fc('0x1f')]()[_0xc1fc('0x1e')](function(){_0x56b0f3['status'](0xcc)[_0xc1fc('0x15')]();});}};}function handleEntityNotFound(_0x54d500,_0x5ae947){return function(_0x2fe4bc){if(!_0x2fe4bc){_0x54d500[_0xc1fc('0x20')](0x194);}return _0x2fe4bc;};}function handleError(_0x34aaa4,_0x3aacf2){_0x3aacf2=_0x3aacf2||0x1f4;return function(_0x214ddd){logger[_0xc1fc('0x21')](_0x214ddd['stack']);if(_0x214ddd[_0xc1fc('0x22')]){delete _0x214ddd['name'];}_0x34aaa4[_0xc1fc('0x14')](_0x3aacf2)[_0xc1fc('0x23')](_0x214ddd);};}exports['index']=function(_0xcb3f32,_0x2d6f4a){var _0x281d16={},_0x23594f={},_0x41810e={'count':0x0,'rows':[]};var _0x9644db=db['Team'][_0xc1fc('0x24')];_0x23594f[_0xc1fc('0x25')]=_[_0xc1fc('0x26')](_0x9644db);var _0x5b5551={'dateStart':_0xcb3f32[_0xc1fc('0x27')]['dateStart'],'dateEnd':_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x28')]};delete _0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x29')];delete _0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x28')];_0x23594f['query']=_[_0xc1fc('0x26')](_0xcb3f32['query']);_0x23594f[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x23594f['model'],_0x23594f['query']);_0x281d16[_0xc1fc('0x2c')]=_['intersection'](_0x23594f[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0xcb3f32['query'][_0xc1fc('0x2d')]));_0x281d16['attributes']=_0x281d16[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x281d16['attributes']:_0x23594f[_0xc1fc('0x25')];if(!_0xcb3f32[_0xc1fc('0x27')]['hasOwnProperty'](_0xc1fc('0x2f'))){_0x281d16[_0xc1fc('0x19')]=qs['limit'](_0xcb3f32[_0xc1fc('0x27')]['limit']);_0x281d16['offset']=qs[_0xc1fc('0x18')](_0xcb3f32[_0xc1fc('0x27')]['offset']);}_0x281d16[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x281d16[_0xc1fc('0x32')]=qs[_0xc1fc('0x2a')](_[_0xc1fc('0x33')](_0xcb3f32[_0xc1fc('0x27')],_0x23594f[_0xc1fc('0x2a')]));if(_0x5b5551['dateStart']){if(_0x5b5551['dateEnd']){_0x5b5551[_0xc1fc('0x28')]=moment(_0x5b5551['dateEnd'])[_0xc1fc('0x34')](0x1,_0xc1fc('0x35'));}else{_0x5b5551[_0xc1fc('0x28')]=moment(_0x5b5551[_0xc1fc('0x29')])['add'](0x1,'day');}_[_0xc1fc('0x36')](_0x281d16[_0xc1fc('0x32')],{'createdAt':{'$gte':_0x5b5551[_0xc1fc('0x29')],'$lte':_0x5b5551[_0xc1fc('0x28')]}});}if(_0xcb3f32[_0xc1fc('0x27')][_0xc1fc('0x37')]){_0x281d16[_0xc1fc('0x32')]=_[_0xc1fc('0x36')](_0x281d16['where'],{'$or':_['map'](_0x281d16[_0xc1fc('0x2c')],function(_0x4da591){var _0x24bb75={};_0x24bb75[_0x4da591]={'$like':'%'+_0xcb3f32['query'][_0xc1fc('0x37')]+'%'};return _0x24bb75;})});}_0x281d16=_['merge']({},_0x281d16,_0xcb3f32['options']);var _0x1f29b6={'where':_0x281d16[_0xc1fc('0x32')]};return db[_0xc1fc('0x38')]['count'](_0x1f29b6)['then'](function(_0x248ea9){_0x41810e['count']=_0x248ea9;if(_0xcb3f32['query'][_0xc1fc('0x39')]){_0x281d16[_0xc1fc('0x3a')]=[{'all':!![]}];}return db[_0xc1fc('0x38')]['findAll'](_0x281d16);})['then'](function(_0x24730c){_0x41810e[_0xc1fc('0x3b')]=_0x24730c;return _0x41810e;})[_0xc1fc('0x1e')](respondWithFilteredResult(_0x2d6f4a,_0x281d16))[_0xc1fc('0x3c')](handleError(_0x2d6f4a,null));};exports[_0xc1fc('0x3d')]=function(_0x15315e,_0x1532fe){var _0x22f5ed={'raw':![],'where':{'id':_0x15315e[_0xc1fc('0x3e')]['id']}},_0x2330ce={};_0x2330ce[_0xc1fc('0x25')]=_['keys'](db[_0xc1fc('0x38')][_0xc1fc('0x24')]);_0x2330ce[_0xc1fc('0x27')]=_[_0xc1fc('0x26')](_0x15315e[_0xc1fc('0x27')]);_0x2330ce[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x2330ce['model'],_0x2330ce[_0xc1fc('0x27')]);_0x22f5ed[_0xc1fc('0x2c')]=_[_0xc1fc('0x2b')](_0x2330ce[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0x15315e[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x22f5ed[_0xc1fc('0x2c')]=_0x22f5ed['attributes'][_0xc1fc('0x2e')]?_0x22f5ed[_0xc1fc('0x2c')]:_0x2330ce[_0xc1fc('0x25')];if(_0x15315e[_0xc1fc('0x27')]['includeAll']){_0x22f5ed[_0xc1fc('0x3a')]=[{'all':!![]}];}_0x22f5ed=_[_0xc1fc('0x36')]({},_0x22f5ed,_0x15315e[_0xc1fc('0x3f')]);return db[_0xc1fc('0x38')][_0xc1fc('0x40')](_0x22f5ed)[_0xc1fc('0x1e')](handleEntityNotFound(_0x1532fe,null))[_0xc1fc('0x1e')](respondWithResult(_0x1532fe,null))[_0xc1fc('0x3c')](handleError(_0x1532fe,null));};exports[_0xc1fc('0x41')]=function(_0x246e37,_0x34bbae){return db['Team'][_0xc1fc('0x41')](_0x246e37[_0xc1fc('0x42')],{})[_0xc1fc('0x1e')](respondWithResult(_0x34bbae,0xc9))[_0xc1fc('0x3c')](handleError(_0x34bbae,null));};exports['update']=function(_0x51842e,_0x84fd31){if(_0x51842e['body']['id']){delete _0x51842e['body']['id'];}return db[_0xc1fc('0x38')]['find']({'where':{'id':_0x51842e[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x84fd31,null))['then'](saveUpdates(_0x51842e[_0xc1fc('0x42')],null))[_0xc1fc('0x1e')](respondWithResult(_0x84fd31,null))[_0xc1fc('0x3c')](handleError(_0x84fd31,null));};exports['destroy']=function(_0x3f1987,_0x22ee4a){return db[_0xc1fc('0x38')][_0xc1fc('0x40')]({'where':{'id':_0x3f1987[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x22ee4a,null))[_0xc1fc('0x1e')](removeEntity(_0x22ee4a,null))[_0xc1fc('0x3c')](handleError(_0x22ee4a,null));};exports[_0xc1fc('0x43')]=function(_0x5b1b0e,_0x2fc45d,_0x53cb2f){return db['Team'][_0xc1fc('0x44')]({'where':{'id':_0x5b1b0e[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x2fc45d,null))[_0xc1fc('0x1e')](function(_0x58b591){if(!_0x5b1b0e[_0xc1fc('0x27')]['channel']||!utils[_0xc1fc('0x45')](_0x5b1b0e[_0xc1fc('0x27')]['channel'])){throw new db[(_0xc1fc('0x46'))]['ValidationError'](_0xc1fc('0x47'));}var _0x5cae52={};var _0x40078b={};_0x40078b['model']=_['keys'](db[_[_0xc1fc('0x48')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4b')][_0xc1fc('0x24')]);_0x40078b['query']=_[_0xc1fc('0x26')](_0x5b1b0e['query']);_0x40078b[_0xc1fc('0x2a')]=_[_0xc1fc('0x2b')](_0x40078b[_0xc1fc('0x25')],_0x40078b[_0xc1fc('0x27')]);_0x5cae52[_0xc1fc('0x2c')]=_[_0xc1fc('0x2b')](_0x40078b[_0xc1fc('0x25')],qs[_0xc1fc('0x2d')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x5cae52[_0xc1fc('0x2c')]=_0x5cae52[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x5cae52[_0xc1fc('0x2c')]:_0x40078b[_0xc1fc('0x25')];_0x5cae52[_0xc1fc('0x19')]=qs[_0xc1fc('0x19')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x19')]);_0x5cae52[_0xc1fc('0x18')]=qs['offset'](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x18')]);_0x5cae52[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x5cae52[_0xc1fc('0x32')]=qs[_0xc1fc('0x2a')](_[_0xc1fc('0x33')](_0x5b1b0e['query'],_0x40078b[_0xc1fc('0x2a')]));_0x5cae52=_[_0xc1fc('0x36')]({},_0x5cae52,_0x5b1b0e[_0xc1fc('0x3f')]);return _0x58b591[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x5b1b0e[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x5cae52);})[_0xc1fc('0x1e')](respondWithResult(_0x2fc45d,null))['catch'](handleError(_0x2fc45d,null));};exports[_0xc1fc('0x4e')]=function(_0x6b5711,_0x48b290,_0x2d1c79){return db[_0xc1fc('0x38')]['findOne']({'where':{'id':_0x6b5711[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](function(_0x18e060){if(_0x18e060){if(!_0x6b5711['body']['channel']||!utils[_0xc1fc('0x45')](_0x6b5711['body']['channel'])){throw new db[(_0xc1fc('0x46'))][(_0xc1fc('0x4f'))](_0xc1fc('0x47'));}return _0x18e060['add'+_[_0xc1fc('0x48')](_0x6b5711[_0xc1fc('0x42')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x6b5711[_0xc1fc('0x42')][_0xc1fc('0x50')]);}return null;})[_0xc1fc('0x1e')](handleEntityNotFound(_0x48b290,null))[_0xc1fc('0x1e')](respondWithStatusCode(_0x48b290,null))[_0xc1fc('0x3c')](handleError(_0x48b290,null));};exports[_0xc1fc('0x51')]=function(_0x3640b2,_0x5a6656,_0x409937){return db[_0xc1fc('0x38')][_0xc1fc('0x44')]({'where':{'id':_0x3640b2[_0xc1fc('0x3e')]['id']}})['then'](function(_0x5b2078){if(_0x5b2078){if(!_0x3640b2[_0xc1fc('0x27')][_0xc1fc('0x49')]||!utils[_0xc1fc('0x45')](_0x3640b2['query']['channel'])){throw new db[(_0xc1fc('0x46'))]['ValidationError'](_0xc1fc('0x47'));}return _0x5b2078[_0xc1fc('0x52')+_[_0xc1fc('0x48')](_0x3640b2[_0xc1fc('0x27')][_0xc1fc('0x49')][_0xc1fc('0x4a')]())+_0xc1fc('0x4d')](_0x3640b2[_0xc1fc('0x27')]['ids']);}return null;})[_0xc1fc('0x1e')](handleEntityNotFound(_0x5a6656,null))['then'](respondWithStatusCode(_0x5a6656,null))[_0xc1fc('0x3c')](handleError(_0x5a6656,null));};exports[_0xc1fc('0x53')]=function(_0x23517d,_0x5e73ec,_0xfc1dac){return db[_0xc1fc('0x38')]['find']({'where':{'id':_0x23517d[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x5e73ec,null))[_0xc1fc('0x1e')](function(_0xa37472){if(_0xa37472){return BPromise[_0xc1fc('0x54')]([_0xc1fc('0x55'),_0xc1fc('0x56'),_0xc1fc('0x57'),'sms',_0xc1fc('0x58'),_0xc1fc('0x59')],function(_0x29e6b2){return _0xa37472[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x29e6b2)+_0xc1fc('0x4d')]({'attributes':['id',_0xc1fc('0x22')]})[_0xc1fc('0x1e')](function(_0x449b86){return BPromise[_0xc1fc('0x54')](_0x449b86,function(_0x1bf138){return _0x1bf138[_0xc1fc('0x53')](_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')])[_0xc1fc('0x1e')](function(){if(_0x29e6b2===_0xc1fc('0x55')){return db[_0xc1fc('0x5a')][_0xc1fc('0x5b')]({'where':{'id':_0x23517d['body'][_0xc1fc('0x50')]},'attributes':['id','name',_0xc1fc('0x5c'),_0xc1fc('0x5d')],'raw':!![]});}})[_0xc1fc('0x1e')](function(_0x3865d3){if(_0x29e6b2===_0xc1fc('0x55')){return BPromise[_0xc1fc('0x54')](_0x3865d3,function(_0x10d947){return db[_0xc1fc('0x5e')]['upsert']({'membername':_0x10d947[_0xc1fc('0x22')],'UserId':_0x10d947['id'],'queue_name':_0x1bf138[_0xc1fc('0x22')],'VoiceQueueId':_0x1bf138['id'],'interface':util['format'](_0xc1fc('0x5f'),_0xc1fc('0x60'),_0x10d947[_0xc1fc('0x22')]),'paused':_0x10d947[_0xc1fc('0x5d')]||![],'penalty':0x0});});}});});})['then'](function(){return _0xa37472;});})['then'](function(){return _0xa37472;});}})['then'](function(_0x43e4de){if(_0x43e4de){return _0x43e4de[_0xc1fc('0x53')](_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')],_['omit'](_0x23517d[_0xc1fc('0x42')],['ids','id'])||{})[_0xc1fc('0x61')](function(_0x2903b9){for(var _0x40f81d=0x0;_0x40f81d<_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')]['length'];_0x40f81d+=0x1){socket['emit'](_0xc1fc('0x62'),{'UserId':_0x23517d[_0xc1fc('0x42')][_0xc1fc('0x50')][_0x40f81d],'TeamId':_0x23517d[_0xc1fc('0x3e')]['id']});}return _0x2903b9;});}})[_0xc1fc('0x1e')](respondWithResult(_0x5e73ec,null))['catch'](handleError(_0x5e73ec,null));};exports[_0xc1fc('0x63')]=function(_0x250acc,_0x330fe8,_0x59abd7){var _0x22225d;return db[_0xc1fc('0x38')][_0xc1fc('0x40')]({'where':{'id':_0x250acc[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x330fe8,null))[_0xc1fc('0x1e')](function(_0x399435){if(_0x399435){return BPromise[_0xc1fc('0x54')]([_0xc1fc('0x55'),_0xc1fc('0x56'),_0xc1fc('0x57'),'sms',_0xc1fc('0x58'),_0xc1fc('0x59')],function(_0x15630c){return _0x399435[_0xc1fc('0x4c')+_[_0xc1fc('0x48')](_0x15630c)+'Queues']({'attributes':['id','name']})['then'](function(_0x3714ba){return BPromise[_0xc1fc('0x54')](_0x3714ba,function(_0x4ac2a3){return _0x4ac2a3['removeAgents'](_0x250acc['query'][_0xc1fc('0x50')])['then'](function(){if(_0x15630c==='voice'){return db[_0xc1fc('0x5e')][_0xc1fc('0x1f')]({'where':{'VoiceQueueId':_0x4ac2a3['id'],'UserId':_0x250acc['query'][_0xc1fc('0x50')]}});}});});})[_0xc1fc('0x1e')](function(){return _0x399435;});})[_0xc1fc('0x1e')](function(){return _0x399435;});}})['then'](function(_0x3280c8){if(_0x3280c8){return _0x3280c8['removeAgents'](_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')])[_0xc1fc('0x1e')](function(_0x2b368b){if(_[_0xc1fc('0x64')](_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')])){for(var _0x1a780a=0x0;_0x1a780a<_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')][_0xc1fc('0x2e')];_0x1a780a+=0x1){socket['emit'](_0xc1fc('0x65'),{'UserId':_0x250acc['query'][_0xc1fc('0x50')][_0x1a780a],'TeamId':_0x250acc[_0xc1fc('0x3e')]['id']});}}else{socket['emit'](_0xc1fc('0x65'),{'UserId':_0x250acc[_0xc1fc('0x27')][_0xc1fc('0x50')],'TeamId':_0x250acc[_0xc1fc('0x3e')]['id']});}});}})[_0xc1fc('0x1e')](respondWithStatusCode(_0x330fe8,null))[_0xc1fc('0x3c')](handleError(_0x330fe8,null));};exports[_0xc1fc('0x66')]=function(_0x48d1ca,_0x24595f,_0x43ce88){var _0x3a252e={};var _0x1c9069={};var _0x5aac40;var _0x4355da;return db['Team'][_0xc1fc('0x44')]({'where':{'id':_0x48d1ca[_0xc1fc('0x3e')]['id']}})[_0xc1fc('0x1e')](handleEntityNotFound(_0x24595f,null))[_0xc1fc('0x1e')](function(_0x4052e6){if(_0x4052e6){_0x5aac40=_0x4052e6;_0x1c9069['model']=_[_0xc1fc('0x26')](db[_0xc1fc('0x5a')][_0xc1fc('0x24')]);_0x1c9069[_0xc1fc('0x27')]=_[_0xc1fc('0x26')](_0x48d1ca['query']);_0x1c9069[_0xc1fc('0x2a')]=_['intersection'](_0x1c9069['model'],_0x1c9069[_0xc1fc('0x27')]);_0x3a252e[_0xc1fc('0x2c')]=_['intersection'](_0x1c9069['model'],qs[_0xc1fc('0x2d')](_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x2d')]));_0x3a252e[_0xc1fc('0x2c')]=_0x3a252e[_0xc1fc('0x2c')][_0xc1fc('0x2e')]?_0x3a252e[_0xc1fc('0x2c')]:_0x1c9069[_0xc1fc('0x25')];_0x3a252e[_0xc1fc('0x30')]=qs[_0xc1fc('0x31')](_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x31')]);_0x3a252e[_0xc1fc('0x32')]=qs['filters'](_[_0xc1fc('0x33')](_0x48d1ca['query'],_0x1c9069[_0xc1fc('0x2a')]));if(_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x37')]){_0x3a252e[_0xc1fc('0x32')]=_[_0xc1fc('0x36')](_0x3a252e['where'],{'$or':_[_0xc1fc('0x67')](_0x3a252e[_0xc1fc('0x2c')],function(_0x2a4e4a){var _0x4cfe27={};_0x4cfe27[_0x2a4e4a]={'$like':'%'+_0x48d1ca[_0xc1fc('0x27')][_0xc1fc('0x37')]+'%'};return _0x4cfe27;})});}_0x3a252e=_[_0xc1fc('0x36')]({},_0x3a252e,_0x48d1ca[_0xc1fc('0x3f')]);return _0x5aac40[_0xc1fc('0x66')](_0x3a252e);}})[_0xc1fc('0x1e')](function(_0x4139d4){if(_0x4139d4){_0x4355da=_0x4139d4['length'];if(!_0x48d1ca[_0xc1fc('0x27')]['hasOwnProperty'](_0xc1fc('0x2f'))){_0x3a252e[_0xc1fc('0x19')]=qs[_0xc1fc('0x19')](_0x48d1ca['query'][_0xc1fc('0x19')]);_0x3a252e[_0xc1fc('0x18')]=qs[_0xc1fc('0x18')](_0x48d1ca[_0xc1fc('0x27')]['offset']);}return _0x5aac40[_0xc1fc('0x66')](_0x3a252e);}})['then'](function(_0x4e31ec){if(_0x4e31ec){return _0x4e31ec?{'count':_0x4355da,'rows':_0x4e31ec}:null;}})[_0xc1fc('0x1e')](respondWithResult(_0x24595f,null))[_0xc1fc('0x3c')](handleError(_0x24595f,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 96cb87b..d9f6615 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 _0xa06a=['hook','exports','events','../../mysqldb','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x208b29,_0x5be5ed){var _0x29fc91=function(_0x11fd98){while(--_0x11fd98){_0x208b29['push'](_0x208b29['shift']());}};_0x29fc91(++_0x5be5ed);}(_0xa06a,0x122));var _0xaa06=function(_0x5d1853,_0x6b59d5){_0x5d1853=_0x5d1853-0x0;var _0x45e83f=_0xa06a[_0x5d1853];return _0x45e83f;};'use strict';var EventEmitter=require(_0xaa06('0x0'));var Team=require(_0xaa06('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xaa06('0x2')](0x0);var events={'afterCreate':_0xaa06('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4a5674){return function(_0x3b9a31,_0x5df22e,_0x14575b){TeamEvents['emit'](_0x4a5674+':'+_0x3b9a31['id'],_0x3b9a31);TeamEvents[_0xaa06('0x4')](_0x4a5674,_0x3b9a31);_0x14575b(null);};}for(var e in events){if(events[_0xaa06('0x5')](e)){var event=events[e];Team[_0xaa06('0x6')](e,emitEvent(event));}}module[_0xaa06('0x7')]=TeamEvents; \ No newline at end of file +var _0x5fcf=['hook','exports','save','update','remove','emit','hasOwnProperty'];(function(_0xac0657,_0x181242){var _0x436796=function(_0xc9ce7c){while(--_0xc9ce7c){_0xac0657['push'](_0xac0657['shift']());}};_0x436796(++_0x181242);}(_0x5fcf,0x159));var _0xf5fc=function(_0x47b229,_0x2ac804){_0x47b229=_0x47b229-0x0;var _0x144b64=_0x5fcf[_0x47b229];return _0x144b64;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf5fc('0x0'),'afterUpdate':_0xf5fc('0x1'),'afterDestroy':_0xf5fc('0x2')};function emitEvent(_0x1842ed){return function(_0x1c61bc,_0x21e8d0,_0x44ca22){TeamEvents[_0xf5fc('0x3')](_0x1842ed+':'+_0x1c61bc['id'],_0x1c61bc);TeamEvents[_0xf5fc('0x3')](_0x1842ed,_0x1c61bc);_0x44ca22(null);};}for(var e in events){if(events[_0xf5fc('0x4')](e)){var event=events[e];Team[_0xf5fc('0x5')](e,emitEvent(event));}}module[_0xf5fc('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index ed3a67c..b87bd83 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 _0x3e74=['moment','./team.attributes','define','Team','teams','lodash','../../config/logger','api'];(function(_0x3d3da6,_0x2e75dd){var _0x55f05e=function(_0x38e479){while(--_0x38e479){_0x3d3da6['push'](_0x3d3da6['shift']());}};_0x55f05e(++_0x2e75dd);}(_0x3e74,0x175));var _0x43e7=function(_0x23eb52,_0x1fcfe2){_0x23eb52=_0x23eb52-0x0;var _0x46e103=_0x3e74[_0x23eb52];return _0x46e103;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0x43e7('0x4'));module['exports']=function(_0x128b0f,_0xe838b4){return _0x128b0f[_0x43e7('0x5')](_0x43e7('0x6'),attributes,{'tableName':_0x43e7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['./team.attributes','exports','Team','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x46555d,_0x283c2b){var _0xb78fde=function(_0xa7335a){while(--_0xa7335a){_0x46555d['push'](_0x46555d['shift']());}};_0xb78fde(++_0x283c2b);}(_0x70e0,0x17b));var _0x070e=function(_0x36ceb3,_0x361237){_0x36ceb3=_0x36ceb3-0x0;var _0x5726db=_0x70e0[_0x36ceb3];return _0x5726db;};'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 attributes=require(_0x070e('0x5'));module[_0x070e('0x6')]=function(_0x5c90fc,_0x7bce9b){return _0x5c90fc['define'](_0x070e('0x7'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 098b24f..e708de3 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 _0xec10=['debug','stringify','error','code','Team,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','./team.socket','register','request','then','request\x20sent'];(function(_0x11ed52,_0xe2c31f){var _0xeee5ea=function(_0x4ea7af){while(--_0x4ea7af){_0x11ed52['push'](_0x11ed52['shift']());}};_0xeee5ea(++_0xe2c31f);}(_0xec10,0xc0));var _0x0ec1=function(_0x30e15b,_0x35b58d){_0x30e15b=_0x30e15b-0x0;var _0x2214cd=_0xec10[_0x30e15b];return _0x2214cd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ec1('0x0'));var BPromise=require(_0x0ec1('0x1'));var rs=require(_0x0ec1('0x2'));var fs=require('fs');var db=require(_0x0ec1('0x3'))['db'];var utils=require(_0x0ec1('0x4'));var logger=require('../../config/logger')(_0x0ec1('0x5'));var config=require(_0x0ec1('0x6'));var jayson=require(_0x0ec1('0x7'));var client=jayson[_0x0ec1('0x8')][_0x0ec1('0x9')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x0ec1('0xa'))[_0x0ec1('0xb')](socket);function respondWithRpcPromise(_0x526fc7,_0x50b8cf,_0x287e24){return new BPromise(function(_0x1bb5e1,_0x2db5c5){return client[_0x0ec1('0xc')](_0x526fc7,_0x287e24)[_0x0ec1('0xd')](function(_0x2b3647){logger['info']('Team,\x20%s,\x20%s',_0x50b8cf,_0x0ec1('0xe'));logger[_0x0ec1('0xf')]('Team,\x20%s,\x20%s,\x20%s',_0x50b8cf,_0x0ec1('0xe'),JSON[_0x0ec1('0x10')](_0x2b3647));if(_0x2b3647[_0x0ec1('0x11')]){if(_0x2b3647[_0x0ec1('0x11')][_0x0ec1('0x12')]===0x1f4){logger[_0x0ec1('0x11')](_0x0ec1('0x13'),_0x50b8cf,_0x2b3647[_0x0ec1('0x11')]['message']);return _0x2db5c5(_0x2b3647['error'][_0x0ec1('0x14')]);}logger[_0x0ec1('0x11')]('Team,\x20%s,\x20%s',_0x50b8cf,_0x2b3647[_0x0ec1('0x11')][_0x0ec1('0x14')]);return _0x1bb5e1(_0x2b3647[_0x0ec1('0x11')][_0x0ec1('0x14')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x50b8cf,'request\x20sent');_0x1bb5e1(_0x2b3647[_0x0ec1('0x15')][_0x0ec1('0x14')]);}})[_0x0ec1('0x16')](function(_0x52d64e){logger[_0x0ec1('0x11')]('Team,\x20%s,\x20%s',_0x50b8cf,_0x52d64e);_0x2db5c5(_0x52d64e);});});} \ No newline at end of file +var _0x107e=['request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','info','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./team.socket','register'];(function(_0x41c64f,_0x571aef){var _0x11e337=function(_0x3926bf){while(--_0x3926bf){_0x41c64f['push'](_0x41c64f['shift']());}};_0x11e337(++_0x571aef);}(_0x107e,0x1ba));var _0xe107=function(_0x11cffe,_0x430250){_0x11cffe=_0x11cffe-0x0;var _0x5248f9=_0x107e[_0x11cffe];return _0x5248f9;};'use strict';var _=require('lodash');var util=require(_0xe107('0x0'));var moment=require('moment');var BPromise=require(_0xe107('0x1'));var rs=require(_0xe107('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xe107('0x3'));var logger=require(_0xe107('0x4'))(_0xe107('0x5'));var config=require(_0xe107('0x6'));var jayson=require(_0xe107('0x7'));var client=jayson[_0xe107('0x8')][_0xe107('0x9')]({'port':0x232a});var socket=require(_0xe107('0xa'))({'host':_0xe107('0xb'),'port':0x18eb});require(_0xe107('0xc'))[_0xe107('0xd')](socket);function respondWithRpcPromise(_0x19021c,_0x59f8cb,_0x56eb2e){return new BPromise(function(_0x37064c,_0x54a0d0){return client[_0xe107('0xe')](_0x19021c,_0x56eb2e)[_0xe107('0xf')](function(_0x469a93){logger['info'](_0xe107('0x10'),_0x59f8cb,_0xe107('0x11'));logger[_0xe107('0x12')](_0xe107('0x13'),_0x59f8cb,_0xe107('0x11'),JSON['stringify'](_0x469a93));if(_0x469a93[_0xe107('0x14')]){if(_0x469a93['error'][_0xe107('0x15')]===0x1f4){logger[_0xe107('0x14')](_0xe107('0x10'),_0x59f8cb,_0x469a93['error']['message']);return _0x54a0d0(_0x469a93[_0xe107('0x14')]['message']);}logger[_0xe107('0x14')](_0xe107('0x10'),_0x59f8cb,_0x469a93[_0xe107('0x14')][_0xe107('0x16')]);return _0x37064c(_0x469a93[_0xe107('0x14')][_0xe107('0x16')]);}else{logger[_0xe107('0x17')](_0xe107('0x10'),_0x59f8cb,_0xe107('0x11'));_0x37064c(_0x469a93['result']['message']);}})['catch'](function(_0xa46601){logger[_0xe107('0x14')]('Team,\x20%s,\x20%s',_0x59f8cb,_0xa46601);_0x54a0d0(_0xa46601);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index c300375..a6b6027 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 _0xf7bf=['register','length','save','remove','update','emit','removeListener'];(function(_0x119733,_0x174703){var _0x3fd768=function(_0x16fbb2){while(--_0x16fbb2){_0x119733['push'](_0x119733['shift']());}};_0x3fd768(++_0x174703);}(_0xf7bf,0x1f3));var _0xff7b=function(_0x1b735a,_0x2ccf39){_0x1b735a=_0x1b735a-0x0;var _0x27570e=_0xf7bf[_0x1b735a];return _0x27570e;};'use strict';var TeamEvents=require('./team.events');var events=[_0xff7b('0x0'),_0xff7b('0x1'),_0xff7b('0x2')];function createListener(_0x15dcc3,_0xc2e737){return function(_0x3b7e4c){_0xc2e737[_0xff7b('0x3')](_0x15dcc3,_0x3b7e4c);};}function removeListener(_0x14b710,_0x35208f){return function(){TeamEvents[_0xff7b('0x4')](_0x14b710,_0x35208f);};}exports[_0xff7b('0x5')]=function(_0x5f5976){for(var _0x43ad3d=0x0,_0xae7f0=events[_0xff7b('0x6')];_0x43ad3d<_0xae7f0;_0x43ad3d++){var _0x5ced5e=events[_0x43ad3d];var _0x70ad5c=createListener('team:'+_0x5ced5e,_0x5f5976);TeamEvents['on'](_0x5ced5e,_0x70ad5c);}}; \ No newline at end of file +var _0xaffb=['removeListener','./team.events','remove','update','emit'];(function(_0x3cd91d,_0x163516){var _0x3b4fab=function(_0x1b3319){while(--_0x1b3319){_0x3cd91d['push'](_0x3cd91d['shift']());}};_0x3b4fab(++_0x163516);}(_0xaffb,0x173));var _0xbaff=function(_0x1f71d8,_0x278518){_0x1f71d8=_0x1f71d8-0x0;var _0x10b045=_0xaffb[_0x1f71d8];return _0x10b045;};'use strict';var TeamEvents=require(_0xbaff('0x0'));var events=['save',_0xbaff('0x1'),_0xbaff('0x2')];function createListener(_0x1a85fe,_0x22e2fd){return function(_0x2e02ac){_0x22e2fd[_0xbaff('0x3')](_0x1a85fe,_0x2e02ac);};}function removeListener(_0x5a531b,_0x312a2f){return function(){TeamEvents[_0xbaff('0x4')](_0x5a531b,_0x312a2f);};}exports['register']=function(_0x4d93c0){for(var _0x4c04ca=0x0,_0x11fe88=events['length'];_0x4c04ca<_0x11fe88;_0x4c04ca++){var _0x13990c=events[_0x4c04ca];var _0x4c4048=createListener('team:'+_0x13990c,_0x4d93c0);TeamEvents['on'](_0x13990c,_0x4c4048);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0c5e020..0a3e9ce 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 _0x8639=['get','isAuthenticated','index','/:id','show','post','create','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller'];(function(_0x43469e,_0x4e69d6){var _0xcefd2a=function(_0x8ded6f){while(--_0x8ded6f){_0x43469e['push'](_0x43469e['shift']());}};_0xcefd2a(++_0x4e69d6);}(_0x8639,0x15c));var _0x9863=function(_0x5dafbe,_0x4fdfd4){_0x5dafbe=_0x5dafbe-0x0;var _0x302dae=_0x8639[_0x5dafbe];return _0x302dae;};'use strict';var multer=require(_0x9863('0x0'));var util=require(_0x9863('0x1'));var path=require(_0x9863('0x2'));var express=require(_0x9863('0x3'));var router=express[_0x9863('0x4')]();var auth=require(_0x9863('0x5'));var interaction=require(_0x9863('0x6'));var config=require(_0x9863('0x7'));var controller=require(_0x9863('0x8'));router[_0x9863('0x9')]('/',auth[_0x9863('0xa')](),controller[_0x9863('0xb')]);router[_0x9863('0x9')](_0x9863('0xc'),auth[_0x9863('0xa')](),controller[_0x9863('0xd')]);router[_0x9863('0xe')]('/',auth[_0x9863('0xa')](),controller[_0x9863('0xf')]);router['put'](_0x9863('0xc'),auth[_0x9863('0xa')](),controller[_0x9863('0x10')]);router['delete']('/:id',auth[_0x9863('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc86d=['index','show','post','create','update','delete','/:id','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0xc86d,0x105));var _0xdc86=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xc86d[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0xdc86('0x0'));var util=require('util');var path=require('path');var express=require(_0xdc86('0x1'));var router=express[_0xdc86('0x2')]();var auth=require(_0xdc86('0x3'));var interaction=require(_0xdc86('0x4'));var config=require(_0xdc86('0x5'));var controller=require(_0xdc86('0x6'));router[_0xdc86('0x7')]('/',auth[_0xdc86('0x8')](),controller[_0xdc86('0x9')]);router[_0xdc86('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xdc86('0xa')]);router[_0xdc86('0xb')]('/',auth[_0xdc86('0x8')](),controller[_0xdc86('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xdc86('0xd')]);router[_0xdc86('0xe')](_0xdc86('0xf'),auth['isAuthenticated'](),controller[_0xdc86('0x10')]);module[_0xdc86('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index c94ac51..8da9530 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 _0x1552=['TEXT','exports','STRING'];(function(_0x3bec9e,_0xe7d568){var _0x5edfb5=function(_0x2ae132){while(--_0x2ae132){_0x3bec9e['push'](_0x3bec9e['shift']());}};_0x5edfb5(++_0xe7d568);}(_0x1552,0xd9));var _0x2155=function(_0x45f4ba,_0x5498c8){_0x45f4ba=_0x45f4ba-0x0;var _0x44db14=_0x1552[_0x45f4ba];return _0x44db14;};'use strict';var Sequelize=require('sequelize');module[_0x2155('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2155('0x1')]},'html':{'type':Sequelize[_0x2155('0x2')]}}; \ No newline at end of file +var _0x92c4=['exports','STRING','TEXT','sequelize'];(function(_0x4ad451,_0x58139f){var _0xd31fef=function(_0x4ef47e){while(--_0x4ef47e){_0x4ad451['push'](_0x4ad451['shift']());}};_0xd31fef(++_0x58139f);}(_0x92c4,0xcf));var _0x492c=function(_0x12e3c9,_0x4ff7b4){_0x12e3c9=_0x12e3c9-0x0;var _0x284d5d=_0x92c4[_0x12e3c9];return _0x284d5d;};'use strict';var Sequelize=require(_0x492c('0x0'));module[_0x492c('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x492c('0x2')]},'html':{'type':Sequelize[_0x492c('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 7cf2886..6c992ca 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 _0x8f8a=['limit','Content-Range','apply','save','update','destroy','then','error','name','index','rawAttributes','keys','query','dateStart','dateEnd','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','day','add','merge','filter','map','options','Template','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','end','status','json','offset'];(function(_0x1946ec,_0x27c21b){var _0x2e3bb3=function(_0x51023d){while(--_0x51023d){_0x1946ec['push'](_0x1946ec['shift']());}};_0x2e3bb3(++_0x27c21b);}(_0x8f8a,0x1b7));var _0xa8f8=function(_0x5085e4,_0x17fe0c){_0x5085e4=_0x5085e4-0x0;var _0x4f19af=_0x8f8a[_0x5085e4];return _0x4f19af;};'use strict';var jsonpatch=require(_0xa8f8('0x0'));var rp=require(_0xa8f8('0x1'));var moment=require(_0xa8f8('0x2'));var BPromise=require(_0xa8f8('0x3'));var Mustache=require(_0xa8f8('0x4'));var util=require('util');var path=require(_0xa8f8('0x5'));var sox=require(_0xa8f8('0x6'));var csv=require(_0xa8f8('0x7'));var ejs=require(_0xa8f8('0x8'));var fs=require('fs');var _=require(_0xa8f8('0x9'));var squel=require(_0xa8f8('0xa'));var crypto=require(_0xa8f8('0xb'));var jsforce=require(_0xa8f8('0xc'));var deskjs=require(_0xa8f8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0xa8f8('0xe'));var logger=require(_0xa8f8('0xf'))(_0xa8f8('0x10'));var utils=require(_0xa8f8('0x11'));var config=require(_0xa8f8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53fceb,_0x227fb5){_0x227fb5=_0x227fb5||0xcc;return function(_0x686d21){if(_0x686d21){return _0x53fceb['sendStatus'](_0x227fb5);}return _0x53fceb['status'](_0x227fb5)[_0xa8f8('0x13')]();};}function respondWithResult(_0x3e8826,_0x25e76a){_0x25e76a=_0x25e76a||0xc8;return function(_0x28776f){if(_0x28776f){return _0x3e8826[_0xa8f8('0x14')](_0x25e76a)[_0xa8f8('0x15')](_0x28776f);}};}function respondWithFilteredResult(_0x6bff0c,_0x1504ee){return function(_0x462152){if(_0x462152){var _0x33d7d7=_0x462152['count'],_0x22d032=_0x1504ee[_0xa8f8('0x16')],_0x50c48f=_0x1504ee[_0xa8f8('0x16')]+_0x1504ee[_0xa8f8('0x17')],_0x1b976a;if(_0x50c48f>=_0x33d7d7){_0x50c48f=_0x33d7d7;_0x1b976a=0xc8;}else{_0x1b976a=0xce;}_0x6bff0c['status'](_0x1b976a);return _0x6bff0c['set'](_0xa8f8('0x18'),_0x22d032+'-'+_0x50c48f+'/'+_0x33d7d7)[_0xa8f8('0x15')](_0x462152);}return null;};}function patchUpdates(_0x3d7600){return function(_0x4ad467){try{jsonpatch[_0xa8f8('0x19')](_0x4ad467,_0x3d7600,!![]);}catch(_0x3707a1){return BPromise['reject'](_0x3707a1);}return _0x4ad467[_0xa8f8('0x1a')]();};}function saveUpdates(_0x1499a0,_0x1a2135){return function(_0x1e316d){if(_0x1e316d){return _0x1e316d[_0xa8f8('0x1b')](_0x1499a0)['then'](function(_0x102189){return _0x102189;});}return null;};}function removeEntity(_0x55f9f6,_0x570f75){return function(_0x1262f3){if(_0x1262f3){return _0x1262f3[_0xa8f8('0x1c')]()[_0xa8f8('0x1d')](function(){_0x55f9f6[_0xa8f8('0x14')](0xcc)[_0xa8f8('0x13')]();});}};}function handleEntityNotFound(_0x24de33,_0x1c3cfa){return function(_0x54a71c){if(!_0x54a71c){_0x24de33['sendStatus'](0x194);}return _0x54a71c;};}function handleError(_0x393df7,_0x553a54){_0x553a54=_0x553a54||0x1f4;return function(_0x2481bd){logger[_0xa8f8('0x1e')](_0x2481bd['stack']);if(_0x2481bd[_0xa8f8('0x1f')]){delete _0x2481bd[_0xa8f8('0x1f')];}_0x393df7[_0xa8f8('0x14')](_0x553a54)['send'](_0x2481bd);};}exports[_0xa8f8('0x20')]=function(_0xe4a788,_0x355fcb){var _0x1578ef={},_0x1a7ff8={},_0x3068f4={'count':0x0,'rows':[]};var _0x1a22cc=db['Template'][_0xa8f8('0x21')];_0x1a7ff8['model']=_[_0xa8f8('0x22')](_0x1a22cc);var _0x28b91c={'dateStart':_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x24')],'dateEnd':_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x25')]};delete _0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x24')];delete _0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x25')];_0x1a7ff8[_0xa8f8('0x23')]=_[_0xa8f8('0x22')](_0xe4a788[_0xa8f8('0x23')]);_0x1a7ff8[_0xa8f8('0x26')]=_[_0xa8f8('0x27')](_0x1a7ff8[_0xa8f8('0x28')],_0x1a7ff8[_0xa8f8('0x23')]);_0x1578ef[_0xa8f8('0x29')]=_[_0xa8f8('0x27')](_0x1a7ff8[_0xa8f8('0x28')],qs['fields'](_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x2a')]));_0x1578ef[_0xa8f8('0x29')]=_0x1578ef[_0xa8f8('0x29')]['length']?_0x1578ef[_0xa8f8('0x29')]:_0x1a7ff8[_0xa8f8('0x28')];if(!_0xe4a788['query'][_0xa8f8('0x2b')]('nolimit')){_0x1578ef[_0xa8f8('0x17')]=qs['limit'](_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x17')]);_0x1578ef[_0xa8f8('0x16')]=qs['offset'](_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x16')]);}_0x1578ef[_0xa8f8('0x2c')]=qs[_0xa8f8('0x2d')](_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x2d')]);_0x1578ef[_0xa8f8('0x2e')]=qs[_0xa8f8('0x26')](_[_0xa8f8('0x2f')](_0xe4a788[_0xa8f8('0x23')],_0x1a7ff8[_0xa8f8('0x26')]));if(_0x28b91c[_0xa8f8('0x24')]){if(_0x28b91c[_0xa8f8('0x25')]){_0x28b91c['dateEnd']=moment(_0x28b91c['dateEnd'])['add'](0x1,_0xa8f8('0x30'));}else{_0x28b91c['dateEnd']=moment(_0x28b91c[_0xa8f8('0x24')])[_0xa8f8('0x31')](0x1,_0xa8f8('0x30'));}_[_0xa8f8('0x32')](_0x1578ef['where'],{'createdAt':{'$gte':_0x28b91c[_0xa8f8('0x24')],'$lte':_0x28b91c[_0xa8f8('0x25')]}});}if(_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x33')]){_0x1578ef[_0xa8f8('0x2e')]=_[_0xa8f8('0x32')](_0x1578ef['where'],{'$or':_[_0xa8f8('0x34')](_0x1578ef[_0xa8f8('0x29')],function(_0x1a08c1){var _0x7a5d47={};_0x7a5d47[_0x1a08c1]={'$like':'%'+_0xe4a788[_0xa8f8('0x23')][_0xa8f8('0x33')]+'%'};return _0x7a5d47;})});}_0x1578ef=_[_0xa8f8('0x32')]({},_0x1578ef,_0xe4a788[_0xa8f8('0x35')]);var _0x44ec11={'where':_0x1578ef['where']};return db[_0xa8f8('0x36')][_0xa8f8('0x37')](_0x44ec11)[_0xa8f8('0x1d')](function(_0x494070){_0x3068f4[_0xa8f8('0x37')]=_0x494070;if(_0xe4a788['query'][_0xa8f8('0x38')]){_0x1578ef[_0xa8f8('0x39')]=[{'all':!![]}];}return db[_0xa8f8('0x36')][_0xa8f8('0x3a')](_0x1578ef);})[_0xa8f8('0x1d')](function(_0x4c247e){_0x3068f4[_0xa8f8('0x3b')]=_0x4c247e;return _0x3068f4;})['then'](respondWithFilteredResult(_0x355fcb,_0x1578ef))[_0xa8f8('0x3c')](handleError(_0x355fcb,null));};exports[_0xa8f8('0x3d')]=function(_0x430486,_0x41204f){var _0x46514a={'raw':!![],'where':{'id':_0x430486['params']['id']}},_0x4556bb={};_0x4556bb[_0xa8f8('0x28')]=_[_0xa8f8('0x22')](db[_0xa8f8('0x36')][_0xa8f8('0x21')]);_0x4556bb[_0xa8f8('0x23')]=_['keys'](_0x430486[_0xa8f8('0x23')]);_0x4556bb[_0xa8f8('0x26')]=_[_0xa8f8('0x27')](_0x4556bb[_0xa8f8('0x28')],_0x4556bb[_0xa8f8('0x23')]);_0x46514a['attributes']=_[_0xa8f8('0x27')](_0x4556bb['model'],qs[_0xa8f8('0x2a')](_0x430486[_0xa8f8('0x23')][_0xa8f8('0x2a')]));_0x46514a[_0xa8f8('0x29')]=_0x46514a['attributes']['length']?_0x46514a[_0xa8f8('0x29')]:_0x4556bb[_0xa8f8('0x28')];if(_0x430486[_0xa8f8('0x23')][_0xa8f8('0x38')]){_0x46514a[_0xa8f8('0x39')]=[{'all':!![]}];}_0x46514a=_['merge']({},_0x46514a,_0x430486['options']);return db[_0xa8f8('0x36')][_0xa8f8('0x3e')](_0x46514a)[_0xa8f8('0x1d')](handleEntityNotFound(_0x41204f,null))[_0xa8f8('0x1d')](respondWithResult(_0x41204f,null))[_0xa8f8('0x3c')](handleError(_0x41204f,null));};exports[_0xa8f8('0x3f')]=function(_0x5533d4,_0x5d1017){return db[_0xa8f8('0x36')]['create'](_0x5533d4[_0xa8f8('0x40')],{})[_0xa8f8('0x1d')](respondWithResult(_0x5d1017,0xc9))[_0xa8f8('0x3c')](handleError(_0x5d1017,null));};exports[_0xa8f8('0x1b')]=function(_0x287263,_0xeaf51a){if(_0x287263[_0xa8f8('0x40')]['id']){delete _0x287263[_0xa8f8('0x40')]['id'];}return db['Template'][_0xa8f8('0x3e')]({'where':{'id':_0x287263[_0xa8f8('0x41')]['id']}})['then'](handleEntityNotFound(_0xeaf51a,null))[_0xa8f8('0x1d')](saveUpdates(_0x287263[_0xa8f8('0x40')],null))[_0xa8f8('0x1d')](respondWithResult(_0xeaf51a,null))['catch'](handleError(_0xeaf51a,null));};exports[_0xa8f8('0x1c')]=function(_0x41c7bd,_0x3e7953){return db[_0xa8f8('0x36')][_0xa8f8('0x3e')]({'where':{'id':_0x41c7bd[_0xa8f8('0x41')]['id']}})[_0xa8f8('0x1d')](handleEntityNotFound(_0x3e7953,null))[_0xa8f8('0x1d')](removeEntity(_0x3e7953,null))[_0xa8f8('0x3c')](handleError(_0x3e7953,null));}; \ No newline at end of file +var _0x1713=['dateEnd','dateStart','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','pick','add','day','merge','where','filter','map','options','includeAll','include','findAll','params','rawAttributes','length','find','catch','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','Template','model','keys','query'];(function(_0x34aed1,_0x26dda4){var _0x374733=function(_0x249252){while(--_0x249252){_0x34aed1['push'](_0x34aed1['shift']());}};_0x374733(++_0x26dda4);}(_0x1713,0xa3));var _0x3171=function(_0x54af58,_0x230016){_0x54af58=_0x54af58-0x0;var _0x53ff34=_0x1713[_0x54af58];return _0x53ff34;};'use strict';var jsonpatch=require(_0x3171('0x0'));var rp=require(_0x3171('0x1'));var moment=require(_0x3171('0x2'));var BPromise=require(_0x3171('0x3'));var Mustache=require(_0x3171('0x4'));var util=require(_0x3171('0x5'));var path=require(_0x3171('0x6'));var sox=require('sox');var csv=require(_0x3171('0x7'));var ejs=require(_0x3171('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3171('0x9'));var crypto=require(_0x3171('0xa'));var jsforce=require(_0x3171('0xb'));var deskjs=require(_0x3171('0xc'));var toCsv=require(_0x3171('0x7'));var querystring=require(_0x3171('0xd'));var Papa=require(_0x3171('0xe'));var qs=require(_0x3171('0xf'));var logger=require(_0x3171('0x10'))(_0x3171('0x11'));var utils=require('../../config/utils');var config=require(_0x3171('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x391754,_0x3f1db8){_0x3f1db8=_0x3f1db8||0xcc;return function(_0x19d51f){if(_0x19d51f){return _0x391754['sendStatus'](_0x3f1db8);}return _0x391754[_0x3171('0x13')](_0x3f1db8)['end']();};}function respondWithResult(_0x5d23b4,_0x148f3d){_0x148f3d=_0x148f3d||0xc8;return function(_0x5ced1a){if(_0x5ced1a){return _0x5d23b4[_0x3171('0x13')](_0x148f3d)[_0x3171('0x14')](_0x5ced1a);}};}function respondWithFilteredResult(_0x37d169,_0x1e1893){return function(_0x31d792){if(_0x31d792){var _0x438a86=_0x31d792[_0x3171('0x15')],_0xa31519=_0x1e1893[_0x3171('0x16')],_0x16c9b4=_0x1e1893[_0x3171('0x16')]+_0x1e1893[_0x3171('0x17')],_0x418162;if(_0x16c9b4>=_0x438a86){_0x16c9b4=_0x438a86;_0x418162=0xc8;}else{_0x418162=0xce;}_0x37d169[_0x3171('0x13')](_0x418162);return _0x37d169[_0x3171('0x18')](_0x3171('0x19'),_0xa31519+'-'+_0x16c9b4+'/'+_0x438a86)[_0x3171('0x14')](_0x31d792);}return null;};}function patchUpdates(_0x145d60){return function(_0x40a0eb){try{jsonpatch['apply'](_0x40a0eb,_0x145d60,!![]);}catch(_0x2f28e5){return BPromise[_0x3171('0x1a')](_0x2f28e5);}return _0x40a0eb[_0x3171('0x1b')]();};}function saveUpdates(_0x5871e0,_0xf861ae){return function(_0xe82b3b){if(_0xe82b3b){return _0xe82b3b[_0x3171('0x1c')](_0x5871e0)[_0x3171('0x1d')](function(_0x5d74de){return _0x5d74de;});}return null;};}function removeEntity(_0x4bc17f,_0x26e7b1){return function(_0x34cec1){if(_0x34cec1){return _0x34cec1[_0x3171('0x1e')]()[_0x3171('0x1d')](function(){_0x4bc17f['status'](0xcc)[_0x3171('0x1f')]();});}};}function handleEntityNotFound(_0x2f7ed3,_0x453c38){return function(_0xbcef25){if(!_0xbcef25){_0x2f7ed3[_0x3171('0x20')](0x194);}return _0xbcef25;};}function handleError(_0x447c9b,_0x167144){_0x167144=_0x167144||0x1f4;return function(_0x3c2632){logger[_0x3171('0x21')](_0x3c2632[_0x3171('0x22')]);if(_0x3c2632[_0x3171('0x23')]){delete _0x3c2632[_0x3171('0x23')];}_0x447c9b[_0x3171('0x13')](_0x167144)[_0x3171('0x24')](_0x3c2632);};}exports['index']=function(_0x1ac5d0,_0x38dea4){var _0x330ece={},_0x401a8a={},_0x116cef={'count':0x0,'rows':[]};var _0x2086c7=db[_0x3171('0x25')]['rawAttributes'];_0x401a8a[_0x3171('0x26')]=_[_0x3171('0x27')](_0x2086c7);var _0x50568a={'dateStart':_0x1ac5d0[_0x3171('0x28')]['dateStart'],'dateEnd':_0x1ac5d0[_0x3171('0x28')][_0x3171('0x29')]};delete _0x1ac5d0[_0x3171('0x28')][_0x3171('0x2a')];delete _0x1ac5d0[_0x3171('0x28')]['dateEnd'];_0x401a8a['query']=_[_0x3171('0x27')](_0x1ac5d0['query']);_0x401a8a[_0x3171('0x2b')]=_['intersection'](_0x401a8a[_0x3171('0x26')],_0x401a8a[_0x3171('0x28')]);_0x330ece[_0x3171('0x2c')]=_[_0x3171('0x2d')](_0x401a8a[_0x3171('0x26')],qs[_0x3171('0x2e')](_0x1ac5d0[_0x3171('0x28')]['fields']));_0x330ece[_0x3171('0x2c')]=_0x330ece[_0x3171('0x2c')]['length']?_0x330ece[_0x3171('0x2c')]:_0x401a8a[_0x3171('0x26')];if(!_0x1ac5d0[_0x3171('0x28')][_0x3171('0x2f')](_0x3171('0x30'))){_0x330ece['limit']=qs['limit'](_0x1ac5d0[_0x3171('0x28')][_0x3171('0x17')]);_0x330ece[_0x3171('0x16')]=qs[_0x3171('0x16')](_0x1ac5d0[_0x3171('0x28')][_0x3171('0x16')]);}_0x330ece[_0x3171('0x31')]=qs['sort'](_0x1ac5d0[_0x3171('0x28')]['sort']);_0x330ece['where']=qs[_0x3171('0x2b')](_[_0x3171('0x32')](_0x1ac5d0[_0x3171('0x28')],_0x401a8a['filters']));if(_0x50568a[_0x3171('0x2a')]){if(_0x50568a['dateEnd']){_0x50568a[_0x3171('0x29')]=moment(_0x50568a[_0x3171('0x29')])[_0x3171('0x33')](0x1,_0x3171('0x34'));}else{_0x50568a[_0x3171('0x29')]=moment(_0x50568a[_0x3171('0x2a')])['add'](0x1,_0x3171('0x34'));}_[_0x3171('0x35')](_0x330ece[_0x3171('0x36')],{'createdAt':{'$gte':_0x50568a[_0x3171('0x2a')],'$lte':_0x50568a[_0x3171('0x29')]}});}if(_0x1ac5d0[_0x3171('0x28')][_0x3171('0x37')]){_0x330ece['where']=_[_0x3171('0x35')](_0x330ece[_0x3171('0x36')],{'$or':_[_0x3171('0x38')](_0x330ece[_0x3171('0x2c')],function(_0x39ed36){var _0x2f7c60={};_0x2f7c60[_0x39ed36]={'$like':'%'+_0x1ac5d0['query']['filter']+'%'};return _0x2f7c60;})});}_0x330ece=_[_0x3171('0x35')]({},_0x330ece,_0x1ac5d0[_0x3171('0x39')]);var _0x18935b={'where':_0x330ece[_0x3171('0x36')]};return db[_0x3171('0x25')][_0x3171('0x15')](_0x18935b)['then'](function(_0x26092a){_0x116cef[_0x3171('0x15')]=_0x26092a;if(_0x1ac5d0[_0x3171('0x28')][_0x3171('0x3a')]){_0x330ece[_0x3171('0x3b')]=[{'all':!![]}];}return db[_0x3171('0x25')][_0x3171('0x3c')](_0x330ece);})['then'](function(_0x371e66){_0x116cef['rows']=_0x371e66;return _0x116cef;})['then'](respondWithFilteredResult(_0x38dea4,_0x330ece))['catch'](handleError(_0x38dea4,null));};exports['show']=function(_0x20a54f,_0x473020){var _0x4c609a={'raw':!![],'where':{'id':_0x20a54f[_0x3171('0x3d')]['id']}},_0xb7893={};_0xb7893['model']=_[_0x3171('0x27')](db[_0x3171('0x25')][_0x3171('0x3e')]);_0xb7893[_0x3171('0x28')]=_[_0x3171('0x27')](_0x20a54f[_0x3171('0x28')]);_0xb7893[_0x3171('0x2b')]=_[_0x3171('0x2d')](_0xb7893[_0x3171('0x26')],_0xb7893['query']);_0x4c609a[_0x3171('0x2c')]=_['intersection'](_0xb7893[_0x3171('0x26')],qs[_0x3171('0x2e')](_0x20a54f[_0x3171('0x28')][_0x3171('0x2e')]));_0x4c609a['attributes']=_0x4c609a[_0x3171('0x2c')][_0x3171('0x3f')]?_0x4c609a[_0x3171('0x2c')]:_0xb7893[_0x3171('0x26')];if(_0x20a54f[_0x3171('0x28')]['includeAll']){_0x4c609a['include']=[{'all':!![]}];}_0x4c609a=_[_0x3171('0x35')]({},_0x4c609a,_0x20a54f[_0x3171('0x39')]);return db['Template'][_0x3171('0x40')](_0x4c609a)[_0x3171('0x1d')](handleEntityNotFound(_0x473020,null))['then'](respondWithResult(_0x473020,null))[_0x3171('0x41')](handleError(_0x473020,null));};exports[_0x3171('0x42')]=function(_0x2f672d,_0x2c38b0){return db[_0x3171('0x25')][_0x3171('0x42')](_0x2f672d[_0x3171('0x43')],{})[_0x3171('0x1d')](respondWithResult(_0x2c38b0,0xc9))[_0x3171('0x41')](handleError(_0x2c38b0,null));};exports[_0x3171('0x1c')]=function(_0xce6a57,_0x3bc3d6){if(_0xce6a57[_0x3171('0x43')]['id']){delete _0xce6a57[_0x3171('0x43')]['id'];}return db[_0x3171('0x25')][_0x3171('0x40')]({'where':{'id':_0xce6a57[_0x3171('0x3d')]['id']}})[_0x3171('0x1d')](handleEntityNotFound(_0x3bc3d6,null))[_0x3171('0x1d')](saveUpdates(_0xce6a57[_0x3171('0x43')],null))[_0x3171('0x1d')](respondWithResult(_0x3bc3d6,null))['catch'](handleError(_0x3bc3d6,null));};exports[_0x3171('0x1e')]=function(_0x3f63ae,_0x24179c){return db['Template'][_0x3171('0x40')]({'where':{'id':_0x3f63ae['params']['id']}})[_0x3171('0x1d')](handleEntityNotFound(_0x24179c,null))[_0x3171('0x1d')](removeEntity(_0x24179c,null))[_0x3171('0x41')](handleError(_0x24179c,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d89ab09..9f1b1ea 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 _0x925b=['../../config/logger','api','bluebird','request-promise','exports','define','Template','tools_templates','lodash'];(function(_0x1cd442,_0x3b69ee){var _0x12da97=function(_0xd5c5ed){while(--_0xd5c5ed){_0x1cd442['push'](_0x1cd442['shift']());}};_0x12da97(++_0x3b69ee);}(_0x925b,0x1dc));var _0xb925=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0x925b[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0xb925('0x0'));var util=require('util');var logger=require(_0xb925('0x1'))(_0xb925('0x2'));var moment=require('moment');var BPromise=require(_0xb925('0x3'));var rp=require(_0xb925('0x4'));var attributes=require('./template.attributes');module[_0xb925('0x5')]=function(_0x48fe24,_0x94e6a){return _0x48fe24[_0xb925('0x6')](_0xb925('0x7'),attributes,{'tableName':_0xb925('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2e2=['define','Template','tools_templates','lodash','api','moment','request-promise','./template.attributes'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0xf2e2,0x163));var _0x2f2e=function(_0x3c0d47,_0x36bb78){_0x3c0d47=_0x3c0d47-0x0;var _0x5c4552=_0xf2e2[_0x3c0d47];return _0x5c4552;};'use strict';var _=require(_0x2f2e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2f2e('0x1'));var moment=require(_0x2f2e('0x2'));var BPromise=require('bluebird');var rp=require(_0x2f2e('0x3'));var attributes=require(_0x2f2e('0x4'));module['exports']=function(_0x1f4699,_0x4d2c9c){return _0x1f4699[_0x2f2e('0x5')](_0x2f2e('0x6'),attributes,{'tableName':_0x2f2e('0x7'),'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 27e0e84..9e82176 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 _0x9290=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','where','limit','include','map','model','GetTemplate','lodash','util','moment'];(function(_0x4a500b,_0x65d0e7){var _0x13c3ea=function(_0x5d1dcb){while(--_0x5d1dcb){_0x4a500b['push'](_0x4a500b['shift']());}};_0x13c3ea(++_0x65d0e7);}(_0x9290,0x79));var _0x0929=function(_0x122e9b,_0x391bf4){_0x122e9b=_0x122e9b-0x0;var _0x22c247=_0x9290[_0x122e9b];return _0x22c247;};'use strict';var _=require(_0x0929('0x0'));var util=require(_0x0929('0x1'));var moment=require(_0x0929('0x2'));var BPromise=require(_0x0929('0x3'));var rs=require(_0x0929('0x4'));var fs=require('fs');var db=require(_0x0929('0x5'))['db'];var utils=require(_0x0929('0x6'));var logger=require(_0x0929('0x7'))(_0x0929('0x8'));var config=require(_0x0929('0x9'));var jayson=require(_0x0929('0xa'));var client=jayson[_0x0929('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ebba4,_0x326c81,_0x33da67){return new BPromise(function(_0x134752,_0x2f2bc5){return client[_0x0929('0xc')](_0x4ebba4,_0x33da67)[_0x0929('0xd')](function(_0x1b531c){logger[_0x0929('0xe')](_0x0929('0xf'),_0x326c81,_0x0929('0x10'));logger[_0x0929('0x11')](_0x0929('0x12'),_0x326c81,_0x0929('0x10'),JSON['stringify'](_0x1b531c));if(_0x1b531c[_0x0929('0x13')]){if(_0x1b531c[_0x0929('0x13')][_0x0929('0x14')]===0x1f4){logger['error'](_0x0929('0xf'),_0x326c81,_0x1b531c[_0x0929('0x13')][_0x0929('0x15')]);return _0x2f2bc5(_0x1b531c['error'][_0x0929('0x15')]);}logger[_0x0929('0x13')](_0x0929('0xf'),_0x326c81,_0x1b531c[_0x0929('0x13')][_0x0929('0x15')]);return _0x134752(_0x1b531c[_0x0929('0x13')][_0x0929('0x15')]);}else{logger[_0x0929('0xe')](_0x0929('0xf'),_0x326c81,'request\x20sent');_0x134752(_0x1b531c[_0x0929('0x16')][_0x0929('0x15')]);}})[_0x0929('0x17')](function(_0x994a98){logger[_0x0929('0x13')](_0x0929('0xf'),_0x326c81,_0x994a98);_0x2f2bc5(_0x994a98);});});}exports['GetTemplate']=function(_0x59374b){var _0x9683d7=this;return new Promise(function(_0x589373,_0x2740a8){return db['Template']['findAll']({'raw':_0x59374b[_0x0929('0x18')]?_0x59374b[_0x0929('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x59374b['options']?_0x59374b[_0x0929('0x18')][_0x0929('0x19')]||null:null,'attributes':_0x59374b[_0x0929('0x18')]?_0x59374b[_0x0929('0x18')]['attributes']||null:null,'limit':_0x59374b[_0x0929('0x18')]?_0x59374b[_0x0929('0x18')][_0x0929('0x1a')]||null:null,'include':_0x59374b[_0x0929('0x18')]?_0x59374b[_0x0929('0x18')][_0x0929('0x1b')]?_[_0x0929('0x1c')](_0x59374b[_0x0929('0x18')][_0x0929('0x1b')],function(_0x1befc9){return{'model':db[_0x1befc9['model']],'as':_0x1befc9['as'],'attributes':_0x1befc9['attributes'],'include':_0x1befc9[_0x0929('0x1b')]?_[_0x0929('0x1c')](_0x1befc9[_0x0929('0x1b')],function(_0x3cdbb3){return{'model':db[_0x3cdbb3[_0x0929('0x1d')]],'as':_0x3cdbb3['as'],'attributes':_0x3cdbb3['attributes'],'include':_0x3cdbb3[_0x0929('0x1b')]?_[_0x0929('0x1c')](_0x3cdbb3[_0x0929('0x1b')],function(_0x99eb08){return{'model':db[_0x99eb08[_0x0929('0x1d')]],'as':_0x99eb08['as'],'attributes':_0x99eb08['attributes']};}):[]};}):[]};}):[]:[]})[_0x0929('0xd')](function(_0x465001){logger[_0x0929('0xe')](_0x0929('0x1e'),_0x59374b);logger[_0x0929('0x11')](_0x0929('0x1e'),_0x59374b,JSON['stringify'](_0x465001));_0x589373(_0x465001);})[_0x0929('0x17')](function(_0x40934b){logger[_0x0929('0x13')](_0x0929('0x1e'),_0x40934b['message'],_0x59374b);_0x2740a8(_0x9683d7[_0x0929('0x13')](0x1f4,_0x40934b['message']));});});}; \ No newline at end of file +var _0xb383=['attributes','limit','include','map','model','catch','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','Template,\x20%s,\x20%s','GetTemplate','Template','findAll','options','raw'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb383,0x114));var _0x3b38=function(_0x30bfed,_0x3a303a){_0x30bfed=_0x30bfed-0x0;var _0x2221e3=_0xb383[_0x30bfed];return _0x2221e3;};'use strict';var _=require('lodash');var util=require(_0x3b38('0x0'));var moment=require(_0x3b38('0x1'));var BPromise=require(_0x3b38('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x3b38('0x3'))['db'];var utils=require(_0x3b38('0x4'));var logger=require('../../config/logger')(_0x3b38('0x5'));var config=require(_0x3b38('0x6'));var jayson=require(_0x3b38('0x7'));var client=jayson[_0x3b38('0x8')][_0x3b38('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x999ebb,_0x12f8e6,_0x17c6e3){return new BPromise(function(_0xbc6ce6,_0x2116f2){return client['request'](_0x999ebb,_0x17c6e3)[_0x3b38('0xa')](function(_0x1c2cd1){logger[_0x3b38('0xb')]('Template,\x20%s,\x20%s',_0x12f8e6,_0x3b38('0xc'));logger[_0x3b38('0xd')](_0x3b38('0xe'),_0x12f8e6,_0x3b38('0xc'),JSON[_0x3b38('0xf')](_0x1c2cd1));if(_0x1c2cd1['error']){if(_0x1c2cd1[_0x3b38('0x10')]['code']===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x12f8e6,_0x1c2cd1['error'][_0x3b38('0x11')]);return _0x2116f2(_0x1c2cd1[_0x3b38('0x10')]['message']);}logger['error'](_0x3b38('0x12'),_0x12f8e6,_0x1c2cd1[_0x3b38('0x10')][_0x3b38('0x11')]);return _0xbc6ce6(_0x1c2cd1[_0x3b38('0x10')]['message']);}else{logger[_0x3b38('0xb')](_0x3b38('0x12'),_0x12f8e6,_0x3b38('0xc'));_0xbc6ce6(_0x1c2cd1['result'][_0x3b38('0x11')]);}})['catch'](function(_0x30cbd6){logger['error'](_0x3b38('0x12'),_0x12f8e6,_0x30cbd6);_0x2116f2(_0x30cbd6);});});}exports[_0x3b38('0x13')]=function(_0x5ce732){var _0x2e3354=this;return new Promise(function(_0x1c3d2b,_0x1aa245){return db[_0x3b38('0x14')][_0x3b38('0x15')]({'raw':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x17')]===undefined?!![]:![]:!![],'where':_0x5ce732['options']?_0x5ce732['options']['where']||null:null,'attributes':_0x5ce732['options']?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x18')]||null:null,'limit':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x19')]||null:null,'include':_0x5ce732[_0x3b38('0x16')]?_0x5ce732[_0x3b38('0x16')][_0x3b38('0x1a')]?_[_0x3b38('0x1b')](_0x5ce732[_0x3b38('0x16')][_0x3b38('0x1a')],function(_0x494bb3){return{'model':db[_0x494bb3[_0x3b38('0x1c')]],'as':_0x494bb3['as'],'attributes':_0x494bb3[_0x3b38('0x18')],'include':_0x494bb3[_0x3b38('0x1a')]?_[_0x3b38('0x1b')](_0x494bb3['include'],function(_0x5da537){return{'model':db[_0x5da537[_0x3b38('0x1c')]],'as':_0x5da537['as'],'attributes':_0x5da537[_0x3b38('0x18')],'include':_0x5da537['include']?_[_0x3b38('0x1b')](_0x5da537[_0x3b38('0x1a')],function(_0x37af39){return{'model':db[_0x37af39[_0x3b38('0x1c')]],'as':_0x37af39['as'],'attributes':_0x37af39[_0x3b38('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3b38('0xa')](function(_0x58cad1){logger[_0x3b38('0xb')](_0x3b38('0x13'),_0x5ce732);logger[_0x3b38('0xd')]('GetTemplate',_0x5ce732,JSON[_0x3b38('0xf')](_0x58cad1));_0x1c3d2b(_0x58cad1);})[_0x3b38('0x1d')](function(_0x475993){logger[_0x3b38('0x10')](_0x3b38('0x13'),_0x475993[_0x3b38('0x11')],_0x5ce732);_0x1aa245(_0x2e3354[_0x3b38('0x10')](0x1f4,_0x475993['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index a376d0e..a35d9f8 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 _0x61c2=['show','getAllConditions','/:id/any_conditions','/:id/actions','getActions','post','/:id/all_conditions','addAnyCondition','addAction','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','/:id'];(function(_0xe4e014,_0x18a82b){var _0x59faee=function(_0x17e8f7){while(--_0x17e8f7){_0xe4e014['push'](_0xe4e014['shift']());}};_0x59faee(++_0x18a82b);}(_0x61c2,0x1ed));var _0x261c=function(_0x427df3,_0x55fda5){_0x427df3=_0x427df3-0x0;var _0x4ac54f=_0x61c2[_0x427df3];return _0x4ac54f;};'use strict';var multer=require(_0x261c('0x0'));var util=require(_0x261c('0x1'));var path=require(_0x261c('0x2'));var express=require(_0x261c('0x3'));var router=express[_0x261c('0x4')]();var auth=require(_0x261c('0x5'));var interaction=require(_0x261c('0x6'));var config=require('../../config/environment');var controller=require(_0x261c('0x7'));router[_0x261c('0x8')]('/',auth[_0x261c('0x9')](),controller['index']);router[_0x261c('0x8')](_0x261c('0xa'),auth['isAuthenticated'](),controller[_0x261c('0xb')]);router[_0x261c('0x8')]('/:id/all_conditions',auth[_0x261c('0x9')](),controller[_0x261c('0xc')]);router[_0x261c('0x8')](_0x261c('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x261c('0x8')](_0x261c('0xe'),auth['isAuthenticated'](),controller[_0x261c('0xf')]);router[_0x261c('0x10')]('/',auth[_0x261c('0x9')](),controller['create']);router[_0x261c('0x10')](_0x261c('0x11'),auth[_0x261c('0x9')](),controller['addAllCondition']);router[_0x261c('0x10')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x261c('0x12')]);router[_0x261c('0x10')](_0x261c('0xe'),auth[_0x261c('0x9')](),controller[_0x261c('0x13')]);router[_0x261c('0x14')](_0x261c('0xa'),auth['isAuthenticated'](),controller[_0x261c('0x15')]);router[_0x261c('0x16')](_0x261c('0xa'),auth[_0x261c('0x9')](),controller[_0x261c('0x17')]);module['exports']=router; \ No newline at end of file +var _0x0853=['post','addAllCondition','/:id/actions','update','delete','/:id','destroy','exports','path','Router','../../components/auth/service','./trigger.controller','get','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions'];(function(_0x5eab9b,_0x113241){var _0x16bbc5=function(_0x523fae){while(--_0x523fae){_0x5eab9b['push'](_0x5eab9b['shift']());}};_0x16bbc5(++_0x113241);}(_0x0853,0x8d));var _0x3085=function(_0x35aa49,_0x1e3090){_0x35aa49=_0x35aa49-0x0;var _0x181883=_0x0853[_0x35aa49];return _0x181883;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3085('0x0'));var express=require('express');var router=express[_0x3085('0x1')]();var auth=require(_0x3085('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3085('0x3'));router[_0x3085('0x4')]('/',auth[_0x3085('0x5')](),controller['index']);router['get']('/:id',auth[_0x3085('0x5')](),controller[_0x3085('0x6')]);router[_0x3085('0x4')](_0x3085('0x7'),auth[_0x3085('0x5')](),controller['getAllConditions']);router[_0x3085('0x4')](_0x3085('0x8'),auth[_0x3085('0x5')](),controller[_0x3085('0x9')]);router[_0x3085('0x4')]('/:id/actions',auth['isAuthenticated'](),controller[_0x3085('0xa')]);router[_0x3085('0xb')]('/',auth[_0x3085('0x5')](),controller['create']);router['post']('/:id/all_conditions',auth[_0x3085('0x5')](),controller[_0x3085('0xc')]);router[_0x3085('0xb')](_0x3085('0x8'),auth[_0x3085('0x5')](),controller['addAnyCondition']);router[_0x3085('0xb')](_0x3085('0xd'),auth[_0x3085('0x5')](),controller['addAction']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3085('0xe')]);router[_0x3085('0xf')](_0x3085('0x10'),auth[_0x3085('0x5')](),controller[_0x3085('0x11')]);module[_0x3085('0x12')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 30c37b8..efdbb8d 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 _0x2e81=['sequelize','exports','STRING','BOOLEAN'];(function(_0x53c418,_0x3c9678){var _0x5be491=function(_0x1a86cb){while(--_0x1a86cb){_0x53c418['push'](_0x53c418['shift']());}};_0x5be491(++_0x3c9678);}(_0x2e81,0x188));var _0x12e8=function(_0x1a151a,_0x44325f){_0x1a151a=_0x1a151a-0x0;var _0x3ce862=_0x2e81[_0x1a151a];return _0x3ce862;};'use strict';var Sequelize=require(_0x12e8('0x0'));module[_0x12e8('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x12e8('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x12e8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x68f7=['BOOLEAN','sequelize','exports','STRING'];(function(_0x21836b,_0x2823b5){var _0x4a3107=function(_0x36fce4){while(--_0x36fce4){_0x21836b['push'](_0x21836b['shift']());}};_0x4a3107(++_0x2823b5);}(_0x68f7,0x119));var _0x768f=function(_0x1ed368,_0x5b0b79){_0x1ed368=_0x1ed368-0x0;var _0x4199fd=_0x68f7[_0x1ed368];return _0x4199fd;};'use strict';var Sequelize=require(_0x768f('0x0'));module[_0x768f('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x768f('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x768f('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 0addfbc..d19d4c9 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 _0x9c86=['include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','addAction','TriggerId','Action','getActions','map','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','Content-Range','json','update','then','stack','name','send','index','Trigger','rawAttributes','model','query','dateStart','dateEnd','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','filter','count','includeAll'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9c86,0x105));var _0x69c8=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9c86[_0x1ac595];return _0x455fff;};'use strict';var jsonpatch=require(_0x69c8('0x0'));var rp=require(_0x69c8('0x1'));var moment=require('moment');var BPromise=require(_0x69c8('0x2'));var Mustache=require(_0x69c8('0x3'));var util=require(_0x69c8('0x4'));var path=require(_0x69c8('0x5'));var sox=require(_0x69c8('0x6'));var csv=require(_0x69c8('0x7'));var ejs=require(_0x69c8('0x8'));var fs=require('fs');var _=require(_0x69c8('0x9'));var squel=require(_0x69c8('0xa'));var crypto=require(_0x69c8('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x69c8('0xc'));var toCsv=require(_0x69c8('0x7'));var querystring=require(_0x69c8('0xd'));var Papa=require('papaparse');var qs=require(_0x69c8('0xe'));var logger=require(_0x69c8('0xf'))(_0x69c8('0x10'));var utils=require(_0x69c8('0x11'));var config=require('../../config/environment');var db=require(_0x69c8('0x12'))['db'];function respondWithStatusCode(_0x236206,_0x386d71){_0x386d71=_0x386d71||0xcc;return function(_0x48db6e){if(_0x48db6e){return _0x236206[_0x69c8('0x13')](_0x386d71);}return _0x236206[_0x69c8('0x14')](_0x386d71)[_0x69c8('0x15')]();};}function respondWithResult(_0x1bec63,_0x15d269){_0x15d269=_0x15d269||0xc8;return function(_0x19b372){if(_0x19b372){return _0x1bec63[_0x69c8('0x14')](_0x15d269)['json'](_0x19b372);}};}function respondWithFilteredResult(_0xc4f492,_0x2674f0){return function(_0x483f8b){if(_0x483f8b){var _0x38491c=_0x483f8b['count'],_0x51c609=_0x2674f0[_0x69c8('0x16')],_0x4b8884=_0x2674f0[_0x69c8('0x16')]+_0x2674f0[_0x69c8('0x17')],_0x362ae4;if(_0x4b8884>=_0x38491c){_0x4b8884=_0x38491c;_0x362ae4=0xc8;}else{_0x362ae4=0xce;}_0xc4f492[_0x69c8('0x14')](_0x362ae4);return _0xc4f492['set'](_0x69c8('0x18'),_0x51c609+'-'+_0x4b8884+'/'+_0x38491c)[_0x69c8('0x19')](_0x483f8b);}return null;};}function patchUpdates(_0x472ffe){return function(_0x172c51){try{jsonpatch['apply'](_0x172c51,_0x472ffe,!![]);}catch(_0x136480){return BPromise['reject'](_0x136480);}return _0x172c51['save']();};}function saveUpdates(_0x4613ff,_0x5698b5){return function(_0x44c2ef){if(_0x44c2ef){return _0x44c2ef[_0x69c8('0x1a')](_0x4613ff)[_0x69c8('0x1b')](function(_0x46156c){return _0x46156c;});}return null;};}function removeEntity(_0x2120f1,_0x5e3676){return function(_0x503c15){if(_0x503c15){return _0x503c15['destroy']()[_0x69c8('0x1b')](function(){_0x2120f1[_0x69c8('0x14')](0xcc)[_0x69c8('0x15')]();});}};}function handleEntityNotFound(_0x38af7d,_0x4493f3){return function(_0x55de72){if(!_0x55de72){_0x38af7d[_0x69c8('0x13')](0x194);}return _0x55de72;};}function handleError(_0x491e79,_0x13b259){_0x13b259=_0x13b259||0x1f4;return function(_0xc67880){logger['error'](_0xc67880[_0x69c8('0x1c')]);if(_0xc67880[_0x69c8('0x1d')]){delete _0xc67880['name'];}_0x491e79[_0x69c8('0x14')](_0x13b259)[_0x69c8('0x1e')](_0xc67880);};}exports[_0x69c8('0x1f')]=function(_0x3917b4,_0x22f6de){var _0x2c45c4={},_0x375f46={},_0x9bcef6={'count':0x0,'rows':[]};var _0x4e81c6=db[_0x69c8('0x20')][_0x69c8('0x21')];_0x375f46[_0x69c8('0x22')]=_['keys'](_0x4e81c6);var _0x2d74b3={'dateStart':_0x3917b4[_0x69c8('0x23')][_0x69c8('0x24')],'dateEnd':_0x3917b4[_0x69c8('0x23')][_0x69c8('0x25')]};delete _0x3917b4['query'][_0x69c8('0x24')];delete _0x3917b4[_0x69c8('0x23')][_0x69c8('0x25')];_0x375f46['query']=_['keys'](_0x3917b4['query']);_0x375f46[_0x69c8('0x26')]=_[_0x69c8('0x27')](_0x375f46[_0x69c8('0x22')],_0x375f46[_0x69c8('0x23')]);_0x2c45c4['attributes']=_['intersection'](_0x375f46[_0x69c8('0x22')],qs[_0x69c8('0x28')](_0x3917b4[_0x69c8('0x23')][_0x69c8('0x28')]));_0x2c45c4[_0x69c8('0x29')]=_0x2c45c4['attributes'][_0x69c8('0x2a')]?_0x2c45c4[_0x69c8('0x29')]:_0x375f46['model'];if(!_0x3917b4[_0x69c8('0x23')][_0x69c8('0x2b')](_0x69c8('0x2c'))){_0x2c45c4[_0x69c8('0x17')]=qs[_0x69c8('0x17')](_0x3917b4['query'][_0x69c8('0x17')]);_0x2c45c4[_0x69c8('0x16')]=qs[_0x69c8('0x16')](_0x3917b4[_0x69c8('0x23')][_0x69c8('0x16')]);}_0x2c45c4[_0x69c8('0x2d')]=qs['sort'](_0x3917b4[_0x69c8('0x23')][_0x69c8('0x2e')]);_0x2c45c4[_0x69c8('0x2f')]=qs[_0x69c8('0x26')](_[_0x69c8('0x30')](_0x3917b4[_0x69c8('0x23')],_0x375f46[_0x69c8('0x26')]));if(_0x2d74b3[_0x69c8('0x24')]){if(_0x2d74b3[_0x69c8('0x25')]){_0x2d74b3['dateEnd']=moment(_0x2d74b3[_0x69c8('0x25')])[_0x69c8('0x31')](0x1,_0x69c8('0x32'));}else{_0x2d74b3[_0x69c8('0x25')]=moment(_0x2d74b3[_0x69c8('0x24')])[_0x69c8('0x31')](0x1,_0x69c8('0x32'));}_[_0x69c8('0x33')](_0x2c45c4['where'],{'createdAt':{'$gte':_0x2d74b3[_0x69c8('0x24')],'$lte':_0x2d74b3[_0x69c8('0x25')]}});}if(_0x3917b4['query']['filter']){_0x2c45c4[_0x69c8('0x2f')]=_[_0x69c8('0x33')](_0x2c45c4[_0x69c8('0x2f')],{'$or':_['map'](_0x2c45c4[_0x69c8('0x29')],function(_0x31f8cc){var _0x5225fe={};_0x5225fe[_0x31f8cc]={'$like':'%'+_0x3917b4['query'][_0x69c8('0x34')]+'%'};return _0x5225fe;})});}_0x2c45c4=_[_0x69c8('0x33')]({},_0x2c45c4,_0x3917b4['options']);var _0x5c1893={'where':_0x2c45c4['where']};return db[_0x69c8('0x20')][_0x69c8('0x35')](_0x5c1893)[_0x69c8('0x1b')](function(_0x4ac7b5){_0x9bcef6[_0x69c8('0x35')]=_0x4ac7b5;if(_0x3917b4[_0x69c8('0x23')][_0x69c8('0x36')]){_0x2c45c4[_0x69c8('0x37')]=[{'all':!![]}];}return db[_0x69c8('0x20')][_0x69c8('0x38')](_0x2c45c4);})['then'](function(_0x240415){_0x9bcef6[_0x69c8('0x39')]=_0x240415;return _0x9bcef6;})['then'](respondWithFilteredResult(_0x22f6de,_0x2c45c4))[_0x69c8('0x3a')](handleError(_0x22f6de,null));};exports[_0x69c8('0x3b')]=function(_0x1b7d20,_0x5784ec){var _0x294d20={'raw':![],'where':{'id':_0x1b7d20['params']['id']}},_0x478e25={};_0x478e25[_0x69c8('0x22')]=_['keys'](db[_0x69c8('0x20')][_0x69c8('0x21')]);_0x478e25[_0x69c8('0x23')]=_[_0x69c8('0x3c')](_0x1b7d20[_0x69c8('0x23')]);_0x478e25[_0x69c8('0x26')]=_[_0x69c8('0x27')](_0x478e25[_0x69c8('0x22')],_0x478e25[_0x69c8('0x23')]);_0x294d20[_0x69c8('0x29')]=_[_0x69c8('0x27')](_0x478e25[_0x69c8('0x22')],qs[_0x69c8('0x28')](_0x1b7d20[_0x69c8('0x23')][_0x69c8('0x28')]));_0x294d20[_0x69c8('0x29')]=_0x294d20[_0x69c8('0x29')][_0x69c8('0x2a')]?_0x294d20[_0x69c8('0x29')]:_0x478e25['model'];if(_0x1b7d20[_0x69c8('0x23')][_0x69c8('0x36')]){_0x294d20[_0x69c8('0x37')]=[{'all':!![]}];}_0x294d20=_['merge']({},_0x294d20,_0x1b7d20[_0x69c8('0x3d')]);return db[_0x69c8('0x20')][_0x69c8('0x3e')](_0x294d20)[_0x69c8('0x1b')](handleEntityNotFound(_0x5784ec,null))[_0x69c8('0x1b')](respondWithResult(_0x5784ec,null))[_0x69c8('0x3a')](handleError(_0x5784ec,null));};exports[_0x69c8('0x3f')]=function(_0x3822d3,_0x2511c4){return db[_0x69c8('0x20')][_0x69c8('0x3f')](_0x3822d3[_0x69c8('0x40')],{})[_0x69c8('0x1b')](respondWithResult(_0x2511c4,0xc9))[_0x69c8('0x3a')](handleError(_0x2511c4,null));};exports[_0x69c8('0x1a')]=function(_0xd0059a,_0x453ae4){if(_0xd0059a[_0x69c8('0x40')]['id']){delete _0xd0059a[_0x69c8('0x40')]['id'];}return db[_0x69c8('0x20')][_0x69c8('0x3e')]({'where':{'id':_0xd0059a[_0x69c8('0x41')]['id']}})['then'](handleEntityNotFound(_0x453ae4,null))[_0x69c8('0x1b')](saveUpdates(_0xd0059a['body'],null))[_0x69c8('0x1b')](respondWithResult(_0x453ae4,null))[_0x69c8('0x3a')](handleError(_0x453ae4,null));};exports[_0x69c8('0x42')]=function(_0x11b9c3,_0x4bee89){return db[_0x69c8('0x20')][_0x69c8('0x3e')]({'where':{'id':_0x11b9c3[_0x69c8('0x41')]['id']}})['then'](handleEntityNotFound(_0x4bee89,null))[_0x69c8('0x1b')](removeEntity(_0x4bee89,null))[_0x69c8('0x3a')](handleError(_0x4bee89,null));};exports[_0x69c8('0x43')]=function(_0x163ffb,_0x2fb468,_0x4b4a04){if(_0x163ffb['body']['id']){delete _0x163ffb[_0x69c8('0x40')]['id'];}return db['Trigger']['find']({'where':{'id':_0x163ffb['params']['id']}})['then'](handleEntityNotFound(_0x2fb468,null))[_0x69c8('0x1b')](function(_0x526379){if(_0x526379){_0x163ffb[_0x69c8('0x40')][_0x69c8('0x44')]=_0x526379['id'];return db[_0x69c8('0x45')]['create'](_0x163ffb[_0x69c8('0x40')]);}})[_0x69c8('0x1b')](respondWithResult(_0x2fb468,null))['catch'](handleError(_0x2fb468,null));};exports[_0x69c8('0x46')]=function(_0x597745,_0x4846b3,_0x4897c6){if(_0x597745[_0x69c8('0x40')]['id']){delete _0x597745[_0x69c8('0x40')]['id'];}return db['Trigger']['find']({'where':{'id':_0x597745[_0x69c8('0x41')]['id']}})[_0x69c8('0x1b')](handleEntityNotFound(_0x4846b3,null))[_0x69c8('0x1b')](function(_0x28d0f3){if(_0x28d0f3){_0x597745[_0x69c8('0x40')]['TriggerAnyId']=_0x28d0f3['id'];return db[_0x69c8('0x45')]['create'](_0x597745['body']);}})[_0x69c8('0x1b')](respondWithResult(_0x4846b3,null))[_0x69c8('0x3a')](handleError(_0x4846b3,null));};exports[_0x69c8('0x47')]=function(_0x4ad992,_0x205d7f,_0x36690d){var _0xa00848={};var _0x198de5={};var _0x303c26;var _0x77b463;return db[_0x69c8('0x20')]['findOne']({'where':{'id':_0x4ad992['params']['id']}})[_0x69c8('0x1b')](handleEntityNotFound(_0x205d7f,null))[_0x69c8('0x1b')](function(_0x3b4742){if(_0x3b4742){_0x303c26=_0x3b4742;_0x198de5[_0x69c8('0x22')]=_[_0x69c8('0x3c')](db[_0x69c8('0x45')][_0x69c8('0x21')]);_0x198de5[_0x69c8('0x23')]=_['keys'](_0x4ad992[_0x69c8('0x23')]);_0x198de5[_0x69c8('0x26')]=_[_0x69c8('0x27')](_0x198de5[_0x69c8('0x22')],_0x198de5['query']);_0xa00848['attributes']=_[_0x69c8('0x27')](_0x198de5['model'],qs['fields'](_0x4ad992['query'][_0x69c8('0x28')]));_0xa00848[_0x69c8('0x29')]=_0xa00848[_0x69c8('0x29')][_0x69c8('0x2a')]?_0xa00848[_0x69c8('0x29')]:_0x198de5[_0x69c8('0x22')];_0xa00848[_0x69c8('0x2d')]=qs[_0x69c8('0x2e')](_0x4ad992['query'][_0x69c8('0x2e')]);_0xa00848['where']=qs[_0x69c8('0x26')](_[_0x69c8('0x30')](_0x4ad992[_0x69c8('0x23')],_0x198de5['filters']));if(_0x4ad992['query'][_0x69c8('0x34')]){_0xa00848[_0x69c8('0x2f')]=_['merge'](_0xa00848[_0x69c8('0x2f')],{'$or':_['map'](_0xa00848[_0x69c8('0x29')],function(_0x491ebe){var _0x2b533c={};_0x2b533c[_0x491ebe]={'$like':'%'+_0x4ad992[_0x69c8('0x23')][_0x69c8('0x34')]+'%'};return _0x2b533c;})});}_0xa00848=_['merge']({},_0xa00848,_0x4ad992[_0x69c8('0x3d')]);return _0x303c26['getAllConditions'](_0xa00848);}})[_0x69c8('0x1b')](function(_0x1f1f16){if(_0x1f1f16){_0x77b463=_0x1f1f16[_0x69c8('0x2a')];if(!_0x4ad992[_0x69c8('0x23')][_0x69c8('0x2b')](_0x69c8('0x2c'))){_0xa00848[_0x69c8('0x17')]=qs['limit'](_0x4ad992['query'][_0x69c8('0x17')]);_0xa00848[_0x69c8('0x16')]=qs[_0x69c8('0x16')](_0x4ad992[_0x69c8('0x23')][_0x69c8('0x16')]);}return _0x303c26[_0x69c8('0x47')](_0xa00848);}})['then'](function(_0x34cbe2){if(_0x34cbe2){return _0x34cbe2?{'count':_0x77b463,'rows':_0x34cbe2}:null;}})[_0x69c8('0x1b')](respondWithResult(_0x205d7f,null))[_0x69c8('0x3a')](handleError(_0x205d7f,null));};exports[_0x69c8('0x48')]=function(_0x414c9a,_0x3bc3af,_0x3e3d27){var _0x1c4eca={};var _0x2c94c4={};var _0x4a5795;var _0x383f4e;return db[_0x69c8('0x20')][_0x69c8('0x49')]({'where':{'id':_0x414c9a[_0x69c8('0x41')]['id']}})[_0x69c8('0x1b')](handleEntityNotFound(_0x3bc3af,null))[_0x69c8('0x1b')](function(_0x11ff23){if(_0x11ff23){_0x4a5795=_0x11ff23;_0x2c94c4[_0x69c8('0x22')]=_[_0x69c8('0x3c')](db['Condition'][_0x69c8('0x21')]);_0x2c94c4['query']=_[_0x69c8('0x3c')](_0x414c9a[_0x69c8('0x23')]);_0x2c94c4[_0x69c8('0x26')]=_[_0x69c8('0x27')](_0x2c94c4[_0x69c8('0x22')],_0x2c94c4[_0x69c8('0x23')]);_0x1c4eca[_0x69c8('0x29')]=_[_0x69c8('0x27')](_0x2c94c4['model'],qs[_0x69c8('0x28')](_0x414c9a['query'][_0x69c8('0x28')]));_0x1c4eca['attributes']=_0x1c4eca[_0x69c8('0x29')][_0x69c8('0x2a')]?_0x1c4eca[_0x69c8('0x29')]:_0x2c94c4[_0x69c8('0x22')];_0x1c4eca[_0x69c8('0x2d')]=qs[_0x69c8('0x2e')](_0x414c9a[_0x69c8('0x23')][_0x69c8('0x2e')]);_0x1c4eca['where']=qs['filters'](_[_0x69c8('0x30')](_0x414c9a[_0x69c8('0x23')],_0x2c94c4['filters']));if(_0x414c9a[_0x69c8('0x23')][_0x69c8('0x34')]){_0x1c4eca[_0x69c8('0x2f')]=_[_0x69c8('0x33')](_0x1c4eca['where'],{'$or':_['map'](_0x1c4eca['attributes'],function(_0x43f3d4){var _0x3a2339={};_0x3a2339[_0x43f3d4]={'$like':'%'+_0x414c9a[_0x69c8('0x23')]['filter']+'%'};return _0x3a2339;})});}_0x1c4eca=_['merge']({},_0x1c4eca,_0x414c9a[_0x69c8('0x3d')]);return _0x4a5795[_0x69c8('0x48')](_0x1c4eca);}})[_0x69c8('0x1b')](function(_0x56e2e5){if(_0x56e2e5){_0x383f4e=_0x56e2e5[_0x69c8('0x2a')];if(!_0x414c9a[_0x69c8('0x23')][_0x69c8('0x2b')](_0x69c8('0x2c'))){_0x1c4eca[_0x69c8('0x17')]=qs[_0x69c8('0x17')](_0x414c9a[_0x69c8('0x23')]['limit']);_0x1c4eca[_0x69c8('0x16')]=qs['offset'](_0x414c9a[_0x69c8('0x23')][_0x69c8('0x16')]);}return _0x4a5795[_0x69c8('0x48')](_0x1c4eca);}})[_0x69c8('0x1b')](function(_0x3de37a){if(_0x3de37a){return _0x3de37a?{'count':_0x383f4e,'rows':_0x3de37a}:null;}})[_0x69c8('0x1b')](respondWithResult(_0x3bc3af,null))['catch'](handleError(_0x3bc3af,null));};exports[_0x69c8('0x4a')]=function(_0x20161c,_0xd58397,_0x3b1371){if(_0x20161c[_0x69c8('0x40')]['id']){delete _0x20161c[_0x69c8('0x40')]['id'];}return db['Trigger']['find']({'where':{'id':_0x20161c['params']['id']}})[_0x69c8('0x1b')](handleEntityNotFound(_0xd58397,null))[_0x69c8('0x1b')](function(_0x23d8ce){if(_0x23d8ce){_0x20161c[_0x69c8('0x40')][_0x69c8('0x4b')]=_0x23d8ce['id'];return db[_0x69c8('0x4c')][_0x69c8('0x3f')](_0x20161c[_0x69c8('0x40')]);}})[_0x69c8('0x1b')](respondWithResult(_0xd58397,null))[_0x69c8('0x3a')](handleError(_0xd58397,null));};exports[_0x69c8('0x4d')]=function(_0x1a77a5,_0x4a1f87,_0x3a3fe6){var _0x495a39={};var _0x27d65d={};var _0x156973;var _0xf5d916;return db[_0x69c8('0x20')][_0x69c8('0x49')]({'where':{'id':_0x1a77a5[_0x69c8('0x41')]['id']}})[_0x69c8('0x1b')](handleEntityNotFound(_0x4a1f87,null))[_0x69c8('0x1b')](function(_0x34fefd){if(_0x34fefd){_0x156973=_0x34fefd;_0x27d65d['model']=_[_0x69c8('0x3c')](db[_0x69c8('0x4c')][_0x69c8('0x21')]);_0x27d65d[_0x69c8('0x23')]=_['keys'](_0x1a77a5['query']);_0x27d65d[_0x69c8('0x26')]=_[_0x69c8('0x27')](_0x27d65d['model'],_0x27d65d['query']);_0x495a39[_0x69c8('0x29')]=_[_0x69c8('0x27')](_0x27d65d[_0x69c8('0x22')],qs[_0x69c8('0x28')](_0x1a77a5[_0x69c8('0x23')][_0x69c8('0x28')]));_0x495a39[_0x69c8('0x29')]=_0x495a39[_0x69c8('0x29')]['length']?_0x495a39[_0x69c8('0x29')]:_0x27d65d[_0x69c8('0x22')];_0x495a39[_0x69c8('0x2d')]=qs[_0x69c8('0x2e')](_0x1a77a5[_0x69c8('0x23')][_0x69c8('0x2e')]);_0x495a39[_0x69c8('0x2f')]=qs[_0x69c8('0x26')](_[_0x69c8('0x30')](_0x1a77a5[_0x69c8('0x23')],_0x27d65d[_0x69c8('0x26')]));if(_0x1a77a5[_0x69c8('0x23')][_0x69c8('0x34')]){_0x495a39[_0x69c8('0x2f')]=_['merge'](_0x495a39[_0x69c8('0x2f')],{'$or':_[_0x69c8('0x4e')](_0x495a39[_0x69c8('0x29')],function(_0x425780){var _0x5192af={};_0x5192af[_0x425780]={'$like':'%'+_0x1a77a5[_0x69c8('0x23')][_0x69c8('0x34')]+'%'};return _0x5192af;})});}_0x495a39=_['merge']({},_0x495a39,_0x1a77a5[_0x69c8('0x3d')]);return _0x156973[_0x69c8('0x4d')](_0x495a39);}})['then'](function(_0x20d406){if(_0x20d406){_0xf5d916=_0x20d406['length'];if(!_0x1a77a5[_0x69c8('0x23')]['hasOwnProperty']('nolimit')){_0x495a39['limit']=qs['limit'](_0x1a77a5[_0x69c8('0x23')][_0x69c8('0x17')]);_0x495a39[_0x69c8('0x16')]=qs[_0x69c8('0x16')](_0x1a77a5[_0x69c8('0x23')]['offset']);}return _0x156973[_0x69c8('0x4d')](_0x495a39);}})['then'](function(_0xed87c0){if(_0xed87c0){return _0xed87c0?{'count':_0xf5d916,'rows':_0xed87c0}:null;}})['then'](respondWithResult(_0x4a1f87,null))[_0x69c8('0x3a')](handleError(_0x4a1f87,null));}; \ No newline at end of file +var _0x1b1c=['pick','add','day','merge','filter','map','options','findAll','rows','catch','length','includeAll','include','create','body','params','find','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','getAnyConditions','findOne','order','addAction','TriggerId','getActions','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','Trigger','rawAttributes','model','keys','dateStart','dateEnd','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x1b1c,0x15c));var _0xc1b1=function(_0x3c36fb,_0x388539){_0x3c36fb=_0x3c36fb-0x0;var _0x4a47eb=_0x1b1c[_0x3c36fb];return _0x4a47eb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xc1b1('0x0'));var moment=require('moment');var BPromise=require(_0xc1b1('0x1'));var Mustache=require('mustache');var util=require(_0xc1b1('0x2'));var path=require(_0xc1b1('0x3'));var sox=require(_0xc1b1('0x4'));var csv=require(_0xc1b1('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc1b1('0x6'));var squel=require(_0xc1b1('0x7'));var crypto=require('crypto');var jsforce=require(_0xc1b1('0x8'));var deskjs=require(_0xc1b1('0x9'));var toCsv=require('to-csv');var querystring=require(_0xc1b1('0xa'));var Papa=require(_0xc1b1('0xb'));var qs=require(_0xc1b1('0xc'));var logger=require(_0xc1b1('0xd'))(_0xc1b1('0xe'));var utils=require(_0xc1b1('0xf'));var config=require(_0xc1b1('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31fff4,_0xbaff6d){_0xbaff6d=_0xbaff6d||0xcc;return function(_0x4c9923){if(_0x4c9923){return _0x31fff4[_0xc1b1('0x11')](_0xbaff6d);}return _0x31fff4[_0xc1b1('0x12')](_0xbaff6d)[_0xc1b1('0x13')]();};}function respondWithResult(_0x58dec7,_0x44131b){_0x44131b=_0x44131b||0xc8;return function(_0x24793a){if(_0x24793a){return _0x58dec7[_0xc1b1('0x12')](_0x44131b)[_0xc1b1('0x14')](_0x24793a);}};}function respondWithFilteredResult(_0x444fc6,_0x3b3d0c){return function(_0x3a3e2b){if(_0x3a3e2b){var _0x15a1b1=_0x3a3e2b[_0xc1b1('0x15')],_0x191af5=_0x3b3d0c['offset'],_0x1309c8=_0x3b3d0c['offset']+_0x3b3d0c[_0xc1b1('0x16')],_0x5e8229;if(_0x1309c8>=_0x15a1b1){_0x1309c8=_0x15a1b1;_0x5e8229=0xc8;}else{_0x5e8229=0xce;}_0x444fc6['status'](_0x5e8229);return _0x444fc6[_0xc1b1('0x17')](_0xc1b1('0x18'),_0x191af5+'-'+_0x1309c8+'/'+_0x15a1b1)[_0xc1b1('0x14')](_0x3a3e2b);}return null;};}function patchUpdates(_0x5679c4){return function(_0x214350){try{jsonpatch[_0xc1b1('0x19')](_0x214350,_0x5679c4,!![]);}catch(_0x5ea852){return BPromise[_0xc1b1('0x1a')](_0x5ea852);}return _0x214350[_0xc1b1('0x1b')]();};}function saveUpdates(_0x2db9bd,_0xa84adb){return function(_0x58bd85){if(_0x58bd85){return _0x58bd85[_0xc1b1('0x1c')](_0x2db9bd)['then'](function(_0x22429d){return _0x22429d;});}return null;};}function removeEntity(_0x537857,_0x462079){return function(_0x40fd61){if(_0x40fd61){return _0x40fd61[_0xc1b1('0x1d')]()[_0xc1b1('0x1e')](function(){_0x537857[_0xc1b1('0x12')](0xcc)[_0xc1b1('0x13')]();});}};}function handleEntityNotFound(_0xed21a8,_0x1ca3f1){return function(_0x157597){if(!_0x157597){_0xed21a8[_0xc1b1('0x11')](0x194);}return _0x157597;};}function handleError(_0x595432,_0x453598){_0x453598=_0x453598||0x1f4;return function(_0x44743f){logger[_0xc1b1('0x1f')](_0x44743f[_0xc1b1('0x20')]);if(_0x44743f[_0xc1b1('0x21')]){delete _0x44743f['name'];}_0x595432[_0xc1b1('0x12')](_0x453598)[_0xc1b1('0x22')](_0x44743f);};}exports[_0xc1b1('0x23')]=function(_0x7e5a53,_0xa674c1){var _0x6ff044={},_0x593f2d={},_0x4bc5bf={'count':0x0,'rows':[]};var _0x35d89c=db[_0xc1b1('0x24')][_0xc1b1('0x25')];_0x593f2d[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](_0x35d89c);var _0x4bd2d4={'dateStart':_0x7e5a53['query'][_0xc1b1('0x28')],'dateEnd':_0x7e5a53['query'][_0xc1b1('0x29')]};delete _0x7e5a53['query'][_0xc1b1('0x28')];delete _0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x29')];_0x593f2d[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x7e5a53[_0xc1b1('0x2a')]);_0x593f2d[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x593f2d['model'],_0x593f2d[_0xc1b1('0x2a')]);_0x6ff044[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x593f2d[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x7e5a53['query'][_0xc1b1('0x2e')]));_0x6ff044[_0xc1b1('0x2d')]=_0x6ff044['attributes']['length']?_0x6ff044[_0xc1b1('0x2d')]:_0x593f2d[_0xc1b1('0x26')];if(!_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x6ff044[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x7e5a53['query'][_0xc1b1('0x16')]);_0x6ff044[_0xc1b1('0x31')]=qs['offset'](_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}_0x6ff044['order']=qs[_0xc1b1('0x32')](_0x7e5a53[_0xc1b1('0x2a')]['sort']);_0x6ff044[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_[_0xc1b1('0x34')](_0x7e5a53[_0xc1b1('0x2a')],_0x593f2d['filters']));if(_0x4bd2d4[_0xc1b1('0x28')]){if(_0x4bd2d4['dateEnd']){_0x4bd2d4[_0xc1b1('0x29')]=moment(_0x4bd2d4[_0xc1b1('0x29')])[_0xc1b1('0x35')](0x1,_0xc1b1('0x36'));}else{_0x4bd2d4['dateEnd']=moment(_0x4bd2d4[_0xc1b1('0x28')])[_0xc1b1('0x35')](0x1,_0xc1b1('0x36'));}_[_0xc1b1('0x37')](_0x6ff044[_0xc1b1('0x33')],{'createdAt':{'$gte':_0x4bd2d4[_0xc1b1('0x28')],'$lte':_0x4bd2d4[_0xc1b1('0x29')]}});}if(_0x7e5a53[_0xc1b1('0x2a')][_0xc1b1('0x38')]){_0x6ff044[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x6ff044[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x6ff044[_0xc1b1('0x2d')],function(_0x410c6d){var _0x26676b={};_0x26676b[_0x410c6d]={'$like':'%'+_0x7e5a53[_0xc1b1('0x2a')]['filter']+'%'};return _0x26676b;})});}_0x6ff044=_[_0xc1b1('0x37')]({},_0x6ff044,_0x7e5a53[_0xc1b1('0x3a')]);var _0x3c5a0c={'where':_0x6ff044['where']};return db[_0xc1b1('0x24')][_0xc1b1('0x15')](_0x3c5a0c)[_0xc1b1('0x1e')](function(_0x4e9e94){_0x4bc5bf[_0xc1b1('0x15')]=_0x4e9e94;if(_0x7e5a53[_0xc1b1('0x2a')]['includeAll']){_0x6ff044['include']=[{'all':!![]}];}return db[_0xc1b1('0x24')][_0xc1b1('0x3b')](_0x6ff044);})['then'](function(_0x215946){_0x4bc5bf[_0xc1b1('0x3c')]=_0x215946;return _0x4bc5bf;})['then'](respondWithFilteredResult(_0xa674c1,_0x6ff044))[_0xc1b1('0x3d')](handleError(_0xa674c1,null));};exports['show']=function(_0x53925d,_0x5df0d8){var _0x140d1={'raw':![],'where':{'id':_0x53925d['params']['id']}},_0x21679f={};_0x21679f[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](db[_0xc1b1('0x24')][_0xc1b1('0x25')]);_0x21679f[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x53925d['query']);_0x21679f['filters']=_[_0xc1b1('0x2c')](_0x21679f[_0xc1b1('0x26')],_0x21679f[_0xc1b1('0x2a')]);_0x140d1[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x21679f[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x53925d[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x140d1['attributes']=_0x140d1[_0xc1b1('0x2d')][_0xc1b1('0x3e')]?_0x140d1[_0xc1b1('0x2d')]:_0x21679f['model'];if(_0x53925d[_0xc1b1('0x2a')][_0xc1b1('0x3f')]){_0x140d1[_0xc1b1('0x40')]=[{'all':!![]}];}_0x140d1=_[_0xc1b1('0x37')]({},_0x140d1,_0x53925d['options']);return db[_0xc1b1('0x24')]['find'](_0x140d1)[_0xc1b1('0x1e')](handleEntityNotFound(_0x5df0d8,null))['then'](respondWithResult(_0x5df0d8,null))[_0xc1b1('0x3d')](handleError(_0x5df0d8,null));};exports[_0xc1b1('0x41')]=function(_0x2e5e4a,_0x3eb754){return db[_0xc1b1('0x24')][_0xc1b1('0x41')](_0x2e5e4a['body'],{})[_0xc1b1('0x1e')](respondWithResult(_0x3eb754,0xc9))[_0xc1b1('0x3d')](handleError(_0x3eb754,null));};exports[_0xc1b1('0x1c')]=function(_0x3e784f,_0xd67c06){if(_0x3e784f[_0xc1b1('0x42')]['id']){delete _0x3e784f[_0xc1b1('0x42')]['id'];}return db['Trigger']['find']({'where':{'id':_0x3e784f[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0xd67c06,null))[_0xc1b1('0x1e')](saveUpdates(_0x3e784f[_0xc1b1('0x42')],null))[_0xc1b1('0x1e')](respondWithResult(_0xd67c06,null))['catch'](handleError(_0xd67c06,null));};exports[_0xc1b1('0x1d')]=function(_0x40d844,_0x366999){return db[_0xc1b1('0x24')][_0xc1b1('0x44')]({'where':{'id':_0x40d844[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x366999,null))['then'](removeEntity(_0x366999,null))[_0xc1b1('0x3d')](handleError(_0x366999,null));};exports[_0xc1b1('0x45')]=function(_0x4729c5,_0x110d20,_0x528914){if(_0x4729c5[_0xc1b1('0x42')]['id']){delete _0x4729c5[_0xc1b1('0x42')]['id'];}return db['Trigger'][_0xc1b1('0x44')]({'where':{'id':_0x4729c5[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x110d20,null))['then'](function(_0xe8294){if(_0xe8294){_0x4729c5['body'][_0xc1b1('0x46')]=_0xe8294['id'];return db[_0xc1b1('0x47')]['create'](_0x4729c5['body']);}})[_0xc1b1('0x1e')](respondWithResult(_0x110d20,null))[_0xc1b1('0x3d')](handleError(_0x110d20,null));};exports[_0xc1b1('0x48')]=function(_0x289ac3,_0x4ad9b7,_0x4dde13){if(_0x289ac3['body']['id']){delete _0x289ac3[_0xc1b1('0x42')]['id'];}return db['Trigger'][_0xc1b1('0x44')]({'where':{'id':_0x289ac3[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x4ad9b7,null))[_0xc1b1('0x1e')](function(_0x1499d8){if(_0x1499d8){_0x289ac3[_0xc1b1('0x42')]['TriggerAnyId']=_0x1499d8['id'];return db[_0xc1b1('0x47')]['create'](_0x289ac3[_0xc1b1('0x42')]);}})[_0xc1b1('0x1e')](respondWithResult(_0x4ad9b7,null))[_0xc1b1('0x3d')](handleError(_0x4ad9b7,null));};exports[_0xc1b1('0x49')]=function(_0x2ab701,_0x486ee6,_0x579e56){var _0x5375af={};var _0x148f69={};var _0x3fd4a3;var _0x5d3b58;return db['Trigger']['findOne']({'where':{'id':_0x2ab701['params']['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x486ee6,null))[_0xc1b1('0x1e')](function(_0x110eef){if(_0x110eef){_0x3fd4a3=_0x110eef;_0x148f69['model']=_[_0xc1b1('0x27')](db[_0xc1b1('0x47')][_0xc1b1('0x25')]);_0x148f69[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x2ab701[_0xc1b1('0x2a')]);_0x148f69[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x148f69[_0xc1b1('0x26')],_0x148f69['query']);_0x5375af[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x148f69[_0xc1b1('0x26')],qs[_0xc1b1('0x2e')](_0x2ab701['query'][_0xc1b1('0x2e')]));_0x5375af[_0xc1b1('0x2d')]=_0x5375af['attributes'][_0xc1b1('0x3e')]?_0x5375af['attributes']:_0x148f69[_0xc1b1('0x26')];_0x5375af['order']=qs[_0xc1b1('0x32')](_0x2ab701[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x5375af[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_['pick'](_0x2ab701[_0xc1b1('0x2a')],_0x148f69[_0xc1b1('0x2b')]));if(_0x2ab701['query']['filter']){_0x5375af[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x5375af[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x5375af[_0xc1b1('0x2d')],function(_0x5298a0){var _0x2d30b4={};_0x2d30b4[_0x5298a0]={'$like':'%'+_0x2ab701[_0xc1b1('0x2a')]['filter']+'%'};return _0x2d30b4;})});}_0x5375af=_[_0xc1b1('0x37')]({},_0x5375af,_0x2ab701['options']);return _0x3fd4a3['getAllConditions'](_0x5375af);}})[_0xc1b1('0x1e')](function(_0x4caab4){if(_0x4caab4){_0x5d3b58=_0x4caab4[_0xc1b1('0x3e')];if(!_0x2ab701['query'][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x5375af[_0xc1b1('0x16')]=qs['limit'](_0x2ab701[_0xc1b1('0x2a')][_0xc1b1('0x16')]);_0x5375af[_0xc1b1('0x31')]=qs['offset'](_0x2ab701['query'][_0xc1b1('0x31')]);}return _0x3fd4a3[_0xc1b1('0x49')](_0x5375af);}})[_0xc1b1('0x1e')](function(_0x16dcdb){if(_0x16dcdb){return _0x16dcdb?{'count':_0x5d3b58,'rows':_0x16dcdb}:null;}})['then'](respondWithResult(_0x486ee6,null))[_0xc1b1('0x3d')](handleError(_0x486ee6,null));};exports[_0xc1b1('0x4a')]=function(_0x30fe11,_0x4459c0,_0x5ad8d7){var _0x4d9371={};var _0x54ec56={};var _0x5220d4;var _0x29fc33;return db[_0xc1b1('0x24')][_0xc1b1('0x4b')]({'where':{'id':_0x30fe11[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x4459c0,null))[_0xc1b1('0x1e')](function(_0x458643){if(_0x458643){_0x5220d4=_0x458643;_0x54ec56['model']=_[_0xc1b1('0x27')](db[_0xc1b1('0x47')]['rawAttributes']);_0x54ec56['query']=_['keys'](_0x30fe11[_0xc1b1('0x2a')]);_0x54ec56[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x54ec56[_0xc1b1('0x26')],_0x54ec56[_0xc1b1('0x2a')]);_0x4d9371[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x54ec56[_0xc1b1('0x26')],qs['fields'](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x4d9371[_0xc1b1('0x2d')]=_0x4d9371['attributes'][_0xc1b1('0x3e')]?_0x4d9371['attributes']:_0x54ec56[_0xc1b1('0x26')];_0x4d9371[_0xc1b1('0x4c')]=qs[_0xc1b1('0x32')](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x4d9371[_0xc1b1('0x33')]=qs['filters'](_['pick'](_0x30fe11[_0xc1b1('0x2a')],_0x54ec56[_0xc1b1('0x2b')]));if(_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x38')]){_0x4d9371['where']=_[_0xc1b1('0x37')](_0x4d9371['where'],{'$or':_[_0xc1b1('0x39')](_0x4d9371[_0xc1b1('0x2d')],function(_0x2065d0){var _0x2a5b1b={};_0x2a5b1b[_0x2065d0]={'$like':'%'+_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x38')]+'%'};return _0x2a5b1b;})});}_0x4d9371=_['merge']({},_0x4d9371,_0x30fe11['options']);return _0x5220d4[_0xc1b1('0x4a')](_0x4d9371);}})[_0xc1b1('0x1e')](function(_0x430cc4){if(_0x430cc4){_0x29fc33=_0x430cc4['length'];if(!_0x30fe11[_0xc1b1('0x2a')]['hasOwnProperty']('nolimit')){_0x4d9371[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x30fe11[_0xc1b1('0x2a')]['limit']);_0x4d9371[_0xc1b1('0x31')]=qs['offset'](_0x30fe11[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}return _0x5220d4['getAnyConditions'](_0x4d9371);}})['then'](function(_0x1172c3){if(_0x1172c3){return _0x1172c3?{'count':_0x29fc33,'rows':_0x1172c3}:null;}})[_0xc1b1('0x1e')](respondWithResult(_0x4459c0,null))[_0xc1b1('0x3d')](handleError(_0x4459c0,null));};exports[_0xc1b1('0x4d')]=function(_0x185a11,_0x1ffd37,_0x4d3617){if(_0x185a11[_0xc1b1('0x42')]['id']){delete _0x185a11[_0xc1b1('0x42')]['id'];}return db[_0xc1b1('0x24')][_0xc1b1('0x44')]({'where':{'id':_0x185a11[_0xc1b1('0x43')]['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x1ffd37,null))[_0xc1b1('0x1e')](function(_0x5d40a9){if(_0x5d40a9){_0x185a11[_0xc1b1('0x42')][_0xc1b1('0x4e')]=_0x5d40a9['id'];return db['Action'][_0xc1b1('0x41')](_0x185a11[_0xc1b1('0x42')]);}})[_0xc1b1('0x1e')](respondWithResult(_0x1ffd37,null))[_0xc1b1('0x3d')](handleError(_0x1ffd37,null));};exports[_0xc1b1('0x4f')]=function(_0x120563,_0x3525bf,_0x5ce70c){var _0x252f79={};var _0x1ec762={};var _0x567b0a;var _0x3c8fee;return db[_0xc1b1('0x24')][_0xc1b1('0x4b')]({'where':{'id':_0x120563['params']['id']}})[_0xc1b1('0x1e')](handleEntityNotFound(_0x3525bf,null))['then'](function(_0xbf3747){if(_0xbf3747){_0x567b0a=_0xbf3747;_0x1ec762[_0xc1b1('0x26')]=_[_0xc1b1('0x27')](db['Action'][_0xc1b1('0x25')]);_0x1ec762[_0xc1b1('0x2a')]=_[_0xc1b1('0x27')](_0x120563[_0xc1b1('0x2a')]);_0x1ec762[_0xc1b1('0x2b')]=_[_0xc1b1('0x2c')](_0x1ec762['model'],_0x1ec762[_0xc1b1('0x2a')]);_0x252f79[_0xc1b1('0x2d')]=_[_0xc1b1('0x2c')](_0x1ec762['model'],qs[_0xc1b1('0x2e')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x2e')]));_0x252f79[_0xc1b1('0x2d')]=_0x252f79['attributes'][_0xc1b1('0x3e')]?_0x252f79[_0xc1b1('0x2d')]:_0x1ec762[_0xc1b1('0x26')];_0x252f79[_0xc1b1('0x4c')]=qs[_0xc1b1('0x32')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x32')]);_0x252f79[_0xc1b1('0x33')]=qs[_0xc1b1('0x2b')](_[_0xc1b1('0x34')](_0x120563[_0xc1b1('0x2a')],_0x1ec762[_0xc1b1('0x2b')]));if(_0x120563['query'][_0xc1b1('0x38')]){_0x252f79[_0xc1b1('0x33')]=_[_0xc1b1('0x37')](_0x252f79[_0xc1b1('0x33')],{'$or':_[_0xc1b1('0x39')](_0x252f79[_0xc1b1('0x2d')],function(_0x35b2df){var _0x4b1385={};_0x4b1385[_0x35b2df]={'$like':'%'+_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x38')]+'%'};return _0x4b1385;})});}_0x252f79=_[_0xc1b1('0x37')]({},_0x252f79,_0x120563['options']);return _0x567b0a[_0xc1b1('0x4f')](_0x252f79);}})[_0xc1b1('0x1e')](function(_0x133bcf){if(_0x133bcf){_0x3c8fee=_0x133bcf['length'];if(!_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x2f')](_0xc1b1('0x30'))){_0x252f79[_0xc1b1('0x16')]=qs[_0xc1b1('0x16')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x16')]);_0x252f79[_0xc1b1('0x31')]=qs[_0xc1b1('0x31')](_0x120563[_0xc1b1('0x2a')][_0xc1b1('0x31')]);}return _0x567b0a['getActions'](_0x252f79);}})[_0xc1b1('0x1e')](function(_0x28bede){if(_0x28bede){return _0x28bede?{'count':_0x3c8fee,'rows':_0x28bede}:null;}})[_0xc1b1('0x1e')](respondWithResult(_0x3525bf,null))[_0xc1b1('0x3d')](handleError(_0x3525bf,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index db7dcbe..4a86a96 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 _0xe2cb=['api','moment','bluebird','request-promise','exports','define','tools_triggers','lodash','../../config/logger'];(function(_0x27e4b5,_0x547273){var _0x235377=function(_0x139020){while(--_0x139020){_0x27e4b5['push'](_0x27e4b5['shift']());}};_0x235377(++_0x547273);}(_0xe2cb,0x1ae));var _0xbe2c=function(_0x472eba,_0x1da020){_0x472eba=_0x472eba-0x0;var _0x376f24=_0xe2cb[_0x472eba];return _0x376f24;};'use strict';var _=require(_0xbe2c('0x0'));var util=require('util');var logger=require(_0xbe2c('0x1'))(_0xbe2c('0x2'));var moment=require(_0xbe2c('0x3'));var BPromise=require(_0xbe2c('0x4'));var rp=require(_0xbe2c('0x5'));var attributes=require('./trigger.attributes');module[_0xbe2c('0x6')]=function(_0x3d1c42,_0x543dc9){return _0x3d1c42[_0xbe2c('0x7')]('Trigger',attributes,{'tableName':_0xbe2c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87a3=['../../config/logger','exports','Trigger','lodash','util'];(function(_0x5f28b3,_0x5df4e2){var _0x25672f=function(_0xc99c65){while(--_0xc99c65){_0x5f28b3['push'](_0x5f28b3['shift']());}};_0x25672f(++_0x5df4e2);}(_0x87a3,0x18e));var _0x387a=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x87a3[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x387a('0x0'));var util=require(_0x387a('0x1'));var logger=require(_0x387a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./trigger.attributes');module[_0x387a('0x3')]=function(_0x559cbc,_0x7fe2c6){return _0x559cbc['define'](_0x387a('0x4'),attributes,{'tableName':'tools_triggers','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 de44ac9..244df78 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 _0x7494=['include','map','model','then','stringify','catch','find','ShowTrigger','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit'];(function(_0xdf5faa,_0x39c554){var _0x12ab55=function(_0x465422){while(--_0x465422){_0xdf5faa['push'](_0xdf5faa['shift']());}};_0x12ab55(++_0x39c554);}(_0x7494,0xbc));var _0x4749=function(_0x2cc90e,_0x1ac471){_0x2cc90e=_0x2cc90e-0x0;var _0x2fe8dc=_0x7494[_0x2cc90e];return _0x2fe8dc;};'use strict';var _=require(_0x4749('0x0'));var util=require(_0x4749('0x1'));var moment=require(_0x4749('0x2'));var BPromise=require(_0x4749('0x3'));var rs=require(_0x4749('0x4'));var fs=require('fs');var db=require(_0x4749('0x5'))['db'];var utils=require(_0x4749('0x6'));var logger=require(_0x4749('0x7'))(_0x4749('0x8'));var config=require(_0x4749('0x9'));var jayson=require(_0x4749('0xa'));var client=jayson[_0x4749('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e014d,_0x449d91,_0x4946a8){return new BPromise(function(_0x4d28dd,_0x1a0f37){return client['request'](_0x5e014d,_0x4946a8)['then'](function(_0x3fcd84){logger[_0x4749('0xc')]('Trigger,\x20%s,\x20%s',_0x449d91,_0x4749('0xd'));logger[_0x4749('0xe')](_0x4749('0xf'),_0x449d91,_0x4749('0xd'),JSON['stringify'](_0x3fcd84));if(_0x3fcd84[_0x4749('0x10')]){if(_0x3fcd84[_0x4749('0x10')][_0x4749('0x11')]===0x1f4){logger[_0x4749('0x10')](_0x4749('0x12'),_0x449d91,_0x3fcd84['error'][_0x4749('0x13')]);return _0x1a0f37(_0x3fcd84[_0x4749('0x10')][_0x4749('0x13')]);}logger[_0x4749('0x10')]('Trigger,\x20%s,\x20%s',_0x449d91,_0x3fcd84[_0x4749('0x10')]['message']);return _0x4d28dd(_0x3fcd84[_0x4749('0x10')][_0x4749('0x13')]);}else{logger['info'](_0x4749('0x12'),_0x449d91,'request\x20sent');_0x4d28dd(_0x3fcd84['result'][_0x4749('0x13')]);}})['catch'](function(_0x30c147){logger['error'](_0x4749('0x12'),_0x449d91,_0x30c147);_0x1a0f37(_0x30c147);});});}exports[_0x4749('0x14')]=function(_0x3f290e){var _0x4edbea=this;return new Promise(function(_0x599d06,_0x916fc7){return db[_0x4749('0x15')][_0x4749('0x16')]({'raw':_0x3f290e[_0x4749('0x17')]?_0x3f290e[_0x4749('0x17')][_0x4749('0x18')]===undefined?!![]:![]:!![],'where':_0x3f290e[_0x4749('0x17')]?_0x3f290e[_0x4749('0x17')][_0x4749('0x19')]||null:null,'attributes':_0x3f290e[_0x4749('0x17')]?_0x3f290e[_0x4749('0x17')][_0x4749('0x1a')]||null:null,'limit':_0x3f290e['options']?_0x3f290e[_0x4749('0x17')][_0x4749('0x1b')]||null:null,'include':_0x3f290e[_0x4749('0x17')]?_0x3f290e[_0x4749('0x17')][_0x4749('0x1c')]?_[_0x4749('0x1d')](_0x3f290e[_0x4749('0x17')][_0x4749('0x1c')],function(_0x20173d){return{'model':db[_0x20173d[_0x4749('0x1e')]],'as':_0x20173d['as'],'attributes':_0x20173d[_0x4749('0x1a')],'include':_0x20173d[_0x4749('0x1c')]?_[_0x4749('0x1d')](_0x20173d[_0x4749('0x1c')],function(_0x1b45dc){return{'model':db[_0x1b45dc[_0x4749('0x1e')]],'as':_0x1b45dc['as'],'attributes':_0x1b45dc[_0x4749('0x1a')],'include':_0x1b45dc[_0x4749('0x1c')]?_[_0x4749('0x1d')](_0x1b45dc[_0x4749('0x1c')],function(_0x25dc24){return{'model':db[_0x25dc24['model']],'as':_0x25dc24['as'],'attributes':_0x25dc24[_0x4749('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4749('0x1f')](function(_0x8f6c24){logger[_0x4749('0xc')]('GetTrigger',_0x3f290e);logger['debug'](_0x4749('0x14'),_0x3f290e,JSON[_0x4749('0x20')](_0x8f6c24));_0x599d06(_0x8f6c24);})[_0x4749('0x21')](function(_0x37594c){logger[_0x4749('0x10')](_0x4749('0x14'),_0x37594c[_0x4749('0x13')],_0x3f290e);_0x916fc7(_0x4edbea[_0x4749('0x10')](0x1f4,_0x37594c[_0x4749('0x13')]));});});};exports['ShowTrigger']=function(_0xac4294){var _0x111845=this;return new Promise(function(_0x4289d7,_0xab2c62){return db['Trigger'][_0x4749('0x22')]({'raw':_0xac4294[_0x4749('0x17')]?_0xac4294['options']['raw']===undefined?!![]:![]:!![],'where':_0xac4294[_0x4749('0x17')]?_0xac4294[_0x4749('0x17')][_0x4749('0x19')]||null:null,'attributes':_0xac4294[_0x4749('0x17')]?_0xac4294[_0x4749('0x17')]['attributes']||null:null,'include':_0xac4294[_0x4749('0x17')]?_0xac4294[_0x4749('0x17')][_0x4749('0x1c')]?_[_0x4749('0x1d')](_0xac4294[_0x4749('0x17')][_0x4749('0x1c')],function(_0x2a5d09){return{'model':db[_0x2a5d09[_0x4749('0x1e')]],'as':_0x2a5d09['as'],'attributes':_0x2a5d09[_0x4749('0x1a')],'include':_0x2a5d09['include']?_[_0x4749('0x1d')](_0x2a5d09[_0x4749('0x1c')],function(_0x4e0f3e){return{'model':db[_0x4e0f3e[_0x4749('0x1e')]],'as':_0x4e0f3e['as'],'attributes':_0x4e0f3e[_0x4749('0x1a')],'include':_0x4e0f3e[_0x4749('0x1c')]?_['map'](_0x4e0f3e['include'],function(_0x207479){return{'model':db[_0x207479[_0x4749('0x1e')]],'as':_0x207479['as'],'attributes':_0x207479[_0x4749('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1fd673){logger['info']('ShowTrigger',_0xac4294);logger[_0x4749('0xe')](_0x4749('0x23'),_0xac4294,JSON[_0x4749('0x20')](_0x1fd673));_0x4289d7(_0x1fd673);})['catch'](function(_0x5461cc){logger[_0x4749('0x10')](_0x4749('0x23'),_0x5461cc[_0x4749('0x13')],_0xac4294);_0xab2c62(_0x111845['error'](0x1f4,_0x5461cc[_0x4749('0x13')]));});});}; \ No newline at end of file +var _0xfce2=['result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','map','include','model','stringify','ShowTrigger','find','debug','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','message','info'];(function(_0x12e821,_0x6c5bd5){var _0x18a885=function(_0x4ae8ee){while(--_0x4ae8ee){_0x12e821['push'](_0x12e821['shift']());}};_0x18a885(++_0x6c5bd5);}(_0xfce2,0xf7));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2fce('0x0'));var util=require('util');var moment=require(_0x2fce('0x1'));var BPromise=require('bluebird');var rs=require(_0x2fce('0x2'));var fs=require('fs');var db=require(_0x2fce('0x3'))['db'];var utils=require(_0x2fce('0x4'));var logger=require(_0x2fce('0x5'))(_0x2fce('0x6'));var config=require('../../config/environment');var jayson=require(_0x2fce('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x219cb6,_0x5f201e,_0x2f607e){return new BPromise(function(_0x57121e,_0x1bff28){return client[_0x2fce('0x8')](_0x219cb6,_0x2f607e)[_0x2fce('0x9')](function(_0x351a11){logger['info'](_0x2fce('0xa'),_0x5f201e,_0x2fce('0xb'));logger['debug'](_0x2fce('0xc'),_0x5f201e,_0x2fce('0xb'),JSON['stringify'](_0x351a11));if(_0x351a11[_0x2fce('0xd')]){if(_0x351a11[_0x2fce('0xd')][_0x2fce('0xe')]===0x1f4){logger[_0x2fce('0xd')](_0x2fce('0xa'),_0x5f201e,_0x351a11[_0x2fce('0xd')]['message']);return _0x1bff28(_0x351a11[_0x2fce('0xd')]['message']);}logger['error'](_0x2fce('0xa'),_0x5f201e,_0x351a11['error'][_0x2fce('0xf')]);return _0x57121e(_0x351a11['error'][_0x2fce('0xf')]);}else{logger[_0x2fce('0x10')](_0x2fce('0xa'),_0x5f201e,_0x2fce('0xb'));_0x57121e(_0x351a11[_0x2fce('0x11')][_0x2fce('0xf')]);}})[_0x2fce('0x12')](function(_0x6c0016){logger[_0x2fce('0xd')](_0x2fce('0xa'),_0x5f201e,_0x6c0016);_0x1bff28(_0x6c0016);});});}exports[_0x2fce('0x13')]=function(_0x32b2cd){var _0x5025a3=this;return new Promise(function(_0x797ca9,_0x441319){return db[_0x2fce('0x14')][_0x2fce('0x15')]({'raw':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd['options'][_0x2fce('0x17')]===undefined?!![]:![]:!![],'where':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x18')]||null:null,'attributes':_0x32b2cd['options']?_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x19')]||null:null,'limit':_0x32b2cd[_0x2fce('0x16')]?_0x32b2cd[_0x2fce('0x16')]['limit']||null:null,'include':_0x32b2cd['options']?_0x32b2cd[_0x2fce('0x16')]['include']?_[_0x2fce('0x1a')](_0x32b2cd[_0x2fce('0x16')][_0x2fce('0x1b')],function(_0x2a33c3){return{'model':db[_0x2a33c3[_0x2fce('0x1c')]],'as':_0x2a33c3['as'],'attributes':_0x2a33c3[_0x2fce('0x19')],'include':_0x2a33c3[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x2a33c3['include'],function(_0x2d61f3){return{'model':db[_0x2d61f3[_0x2fce('0x1c')]],'as':_0x2d61f3['as'],'attributes':_0x2d61f3[_0x2fce('0x19')],'include':_0x2d61f3['include']?_['map'](_0x2d61f3[_0x2fce('0x1b')],function(_0x35a781){return{'model':db[_0x35a781[_0x2fce('0x1c')]],'as':_0x35a781['as'],'attributes':_0x35a781[_0x2fce('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x312cb3){logger[_0x2fce('0x10')]('GetTrigger',_0x32b2cd);logger['debug'](_0x2fce('0x13'),_0x32b2cd,JSON[_0x2fce('0x1d')](_0x312cb3));_0x797ca9(_0x312cb3);})[_0x2fce('0x12')](function(_0x7f0093){logger['error'](_0x2fce('0x13'),_0x7f0093[_0x2fce('0xf')],_0x32b2cd);_0x441319(_0x5025a3['error'](0x1f4,_0x7f0093[_0x2fce('0xf')]));});});};exports[_0x2fce('0x1e')]=function(_0x1c5b0b){var _0x35e435=this;return new Promise(function(_0x3bd3d7,_0x1cd69e){return db[_0x2fce('0x14')][_0x2fce('0x1f')]({'raw':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b['options'][_0x2fce('0x17')]===undefined?!![]:![]:!![],'where':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')][_0x2fce('0x18')]||null:null,'attributes':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')]['attributes']||null:null,'include':_0x1c5b0b[_0x2fce('0x16')]?_0x1c5b0b[_0x2fce('0x16')]['include']?_[_0x2fce('0x1a')](_0x1c5b0b[_0x2fce('0x16')]['include'],function(_0x217e62){return{'model':db[_0x217e62[_0x2fce('0x1c')]],'as':_0x217e62['as'],'attributes':_0x217e62[_0x2fce('0x19')],'include':_0x217e62[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x217e62[_0x2fce('0x1b')],function(_0x59122f){return{'model':db[_0x59122f[_0x2fce('0x1c')]],'as':_0x59122f['as'],'attributes':_0x59122f['attributes'],'include':_0x59122f[_0x2fce('0x1b')]?_[_0x2fce('0x1a')](_0x59122f[_0x2fce('0x1b')],function(_0x5449d5){return{'model':db[_0x5449d5[_0x2fce('0x1c')]],'as':_0x5449d5['as'],'attributes':_0x5449d5[_0x2fce('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2fce('0x9')](function(_0x402c90){logger['info'](_0x2fce('0x1e'),_0x1c5b0b);logger[_0x2fce('0x20')]('ShowTrigger',_0x1c5b0b,JSON['stringify'](_0x402c90));_0x3bd3d7(_0x402c90);})[_0x2fce('0x12')](function(_0x1cd006){logger[_0x2fce('0xd')]('ShowTrigger',_0x1cd006[_0x2fce('0xf')],_0x1c5b0b);_0x1cd69e(_0x35e435[_0x2fce('0xd')](0x1f4,_0x1cd006[_0x2fce('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 621acf8..e4bf7ac 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 _0xb685=['post','/:id/clone','clone','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./trunk.controller','get','index','isAuthenticated','show'];(function(_0x844d38,_0x4f355e){var _0x2e7073=function(_0x758e1a){while(--_0x758e1a){_0x844d38['push'](_0x844d38['shift']());}};_0x2e7073(++_0x4f355e);}(_0xb685,0xc7));var _0x5b68=function(_0x26a570,_0x257772){_0x26a570=_0x26a570-0x0;var _0x1d22f1=_0xb685[_0x26a570];return _0x1d22f1;};'use strict';var multer=require(_0x5b68('0x0'));var util=require(_0x5b68('0x1'));var path=require(_0x5b68('0x2'));var express=require(_0x5b68('0x3'));var router=express['Router']();var auth=require(_0x5b68('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5b68('0x5'));var controller=require(_0x5b68('0x6'));router[_0x5b68('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b68('0x8')]);router[_0x5b68('0x7')]('/:id',auth[_0x5b68('0x9')](),controller[_0x5b68('0xa')]);router[_0x5b68('0xb')](_0x5b68('0xc'),auth[_0x5b68('0x9')](),controller[_0x5b68('0xd')]);router[_0x5b68('0xb')]('/',auth[_0x5b68('0x9')](),controller[_0x5b68('0xe')]);router[_0x5b68('0xf')](_0x5b68('0x10'),auth[_0x5b68('0x9')](),controller[_0x5b68('0x11')]);router[_0x5b68('0x12')]('/:id',auth[_0x5b68('0x9')](),controller[_0x5b68('0x13')]);module[_0x5b68('0x14')]=router; \ No newline at end of file +var _0x4a2b=['exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','clone','create','put','/:id','update'];(function(_0x5292c6,_0x1ed701){var _0x325c37=function(_0x4f3d68){while(--_0x4f3d68){_0x5292c6['push'](_0x5292c6['shift']());}};_0x325c37(++_0x1ed701);}(_0x4a2b,0xa1));var _0xb4a2=function(_0x51571c,_0x319c1b){_0x51571c=_0x51571c-0x0;var _0x47b024=_0x4a2b[_0x51571c];return _0x47b024;};'use strict';var multer=require('multer');var util=require(_0xb4a2('0x0'));var path=require('path');var express=require('express');var router=express[_0xb4a2('0x1')]();var auth=require(_0xb4a2('0x2'));var interaction=require(_0xb4a2('0x3'));var config=require(_0xb4a2('0x4'));var controller=require('./trunk.controller');router[_0xb4a2('0x5')]('/',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0x7')]);router[_0xb4a2('0x5')]('/:id',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0x8')]);router[_0xb4a2('0x9')]('/:id/clone',auth[_0xb4a2('0x6')](),controller[_0xb4a2('0xa')]);router[_0xb4a2('0x9')]('/',auth['isAuthenticated'](),controller[_0xb4a2('0xb')]);router[_0xb4a2('0xc')](_0xb4a2('0xd'),auth[_0xb4a2('0x6')](),controller[_0xb4a2('0xe')]);router['delete'](_0xb4a2('0xd'),auth[_0xb4a2('0x6')](),controller['destroy']);module[_0xb4a2('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7acb890..530f0d4 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 _0xb7e7=['always','accept','refuse','originate','uac','uas','fingerprint','active','passive','dynamic','update','update,nonat','BOOLEAN','sequelize','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','inband','auto','yes','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','port,invite','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER'];(function(_0x22656e,_0x1163dc){var _0x3e4255=function(_0x200a38){while(--_0x200a38){_0x22656e['push'](_0x22656e['shift']());}};_0x3e4255(++_0x1163dc);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb7e7[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7b7e('0x2')]('friend',_0x7b7e('0x3'),'peer'),'allowNull':![],'defaultValue':_0x7b7e('0x4')},'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x5')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8'),'PROHIB_NOT_SCREENED',_0x7b7e('0x9'),_0x7b7e('0xa'),_0x7b7e('0xb'))},'deny':{'type':Sequelize[_0x7b7e('0x1')]},'permit':{'type':Sequelize[_0x7b7e('0x1')]},'secret':{'type':Sequelize[_0x7b7e('0x1')]},'md5secret':{'type':Sequelize[_0x7b7e('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc'),'set':function(_0x10a666){this[_0x7b7e('0xd')](_0x7b7e('0xe'),_0x10a666?_0x10a666[_0x7b7e('0xf')](','):null);},'get':function(){return this[_0x7b7e('0x10')](_0x7b7e('0xe'))?this[_0x7b7e('0x10')]('transport')[_0x7b7e('0x11')](','):null;},'comment':_0x7b7e('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7b7e('0x13'),'info','shortinfo',_0x7b7e('0x14'),_0x7b7e('0x15')),'defaultValue':_0x7b7e('0x13')},'directmedia':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no','nonat','update',_0x7b7e('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7b7e('0x1')]},'directmediadeny':{'type':Sequelize[_0x7b7e('0x1')]},'nat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x18'),'set':function(_0x200ef7){this[_0x7b7e('0xd')](_0x7b7e('0x19'),_0x200ef7?_0x200ef7[_0x7b7e('0xf')](','):null);},'get':function(){return this[_0x7b7e('0x10')](_0x7b7e('0x19'))?this[_0x7b7e('0x10')](_0x7b7e('0x19'))[_0x7b7e('0x11')](','):null;},'comment':_0x7b7e('0x1a')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x7b7e('0x1')]},'pickupgroup':{'type':Sequelize[_0x7b7e('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7b7e('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x1b')},'allow':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x1c'),'set':function(_0x303d8c){this[_0x7b7e('0xd')](_0x7b7e('0x1d'),_0x303d8c?_0x303d8c['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x7b7e('0x1d'))?this[_0x7b7e('0x10')](_0x7b7e('0x1d'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no')},'insecure':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0x1e'),'set':function(_0x7aa71){this[_0x7b7e('0xd')]('insecure',_0x7aa71?_0x7aa71[_0x7b7e('0xf')](','):null);},'get':function(){return this[_0x7b7e('0x10')]('insecure')?this['getDataValue']('insecure')[_0x7b7e('0x11')](','):null;},'comment':_0x7b7e('0x1f')},'trustrpid':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no','never')},'promiscredir':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'useclientcode':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'accountcode':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7b7e('0x1')]},'callcounter':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no'),'defaultValue':_0x7b7e('0x16')},'busylevel':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'allowoverlap':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no')},'allowtransfer':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x7b7e('0x1')]},'template':{'type':Sequelize[_0x7b7e('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no',_0x7b7e('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'mailbox':{'type':Sequelize[_0x7b7e('0x1')]},'session_timers':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x22'),_0x7b7e('0x23'),_0x7b7e('0x24'))},'session_expires':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'session_minse':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'session_refresher':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x25'),_0x7b7e('0x26')),'defaultValue':_0x7b7e('0x26')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x7b7e('0x1')]},'fromdomain':{'type':Sequelize[_0x7b7e('0x1')]},'fromuser':{'type':Sequelize[_0x7b7e('0x1')]},'port':{'type':Sequelize[_0x7b7e('0x20')](0x5)},'qualify':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no'),'defaultValue':_0x7b7e('0x16')},'keepalive':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'defaultip':{'type':Sequelize[_0x7b7e('0x1')]},'defaultuser':{'type':Sequelize[_0x7b7e('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'sendrpid':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7b7e('0x1')]},'callbackextension':{'type':Sequelize[_0x7b7e('0x1')]},'timert1':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0x7b7e('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7b7e('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7b7e('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7b7e('0x20')](0xb)},'encryption':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'force_avp':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'icesupport':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x7b7e('0x2')]('yes','no',_0x7b7e('0x27'),'certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x7b7e('0x1')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7b7e('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7b7e('0x1')]},'dtlssetup':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x28'),_0x7b7e('0x29'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7b7e('0x1')]},'usereqphone':{'type':Sequelize[_0x7b7e('0x2')](_0x7b7e('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7b7e('0x1')]},'recordofffeature':{'type':Sequelize[_0x7b7e('0x1')]},'call_limit':{'type':Sequelize[_0x7b7e('0x20')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x7b7e('0x16'),'no')},'vmexten':{'type':Sequelize[_0x7b7e('0x1')]},'mohinterpret':{'type':Sequelize[_0x7b7e('0x1')]},'mohsuggest':{'type':Sequelize[_0x7b7e('0x1')]},'parkinglot':{'type':Sequelize[_0x7b7e('0x1')]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7b7e('0x2a')},'canreinvite':{'type':Sequelize[_0x7b7e('0x2')]('yes','no','nonat',_0x7b7e('0x2b'),_0x7b7e('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7b7e('0x1')]},'otherFields':{'type':Sequelize[_0x7b7e('0x1')]},'active':{'type':Sequelize[_0x7b7e('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2032=['all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','accept','refuse','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','exports','STRING','name','friend','user','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','getDataValue','rfc2833','inband','auto','yes','nonat','update','outgoing','setDataValue','join','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'];(function(_0x1fc053,_0xbf2b58){var _0xc5c4d9=function(_0x46c2db){while(--_0x46c2db){_0x1fc053['push'](_0x1fc053['shift']());}};_0xc5c4d9(++_0xbf2b58);}(_0x2032,0xd9));var _0x2203=function(_0x4e2e86,_0x42be8f){_0x4e2e86=_0x4e2e86-0x0;var _0x11b307=_0x2032[_0x4e2e86];return _0x11b307;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x2203('0x3'),_0x2203('0x4'),'peer'),'allowNull':![],'defaultValue':_0x2203('0x3')},'context':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':_0x2203('0x5')},'callingpres':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x7'),_0x2203('0x8'),_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),'PROHIB')},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2203('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2203('0x1')]},'remotesecret':{'type':Sequelize[_0x2203('0x1')]},'transport':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'udp','set':function(_0x849049){this['setDataValue'](_0x2203('0xe'),_0x849049?_0x849049['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0xe'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM'](_0x2203('0x10'),'info','shortinfo',_0x2203('0x11'),_0x2203('0x12')),'defaultValue':_0x2203('0x10')},'directmedia':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2203('0x1')]},'nat':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x3f9ef6){this[_0x2203('0x17')]('nat',_0x3f9ef6?_0x3f9ef6[_0x2203('0x18')](','):null);},'get':function(){return this['getDataValue'](_0x2203('0x19'))?this[_0x2203('0xf')](_0x2203('0x19'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x1b')},'callgroup':{'type':Sequelize[_0x2203('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x2203('0x1')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2203('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x1c')},'allow':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3ee25b){this['setDataValue']('allow',_0x3ee25b?_0x3ee25b[_0x2203('0x18')](';'):_0x2203('0x1d'));},'get':function(){return this[_0x2203('0xf')](_0x2203('0x1e'))?this[_0x2203('0xf')](_0x2203('0x1e'))[_0x2203('0x1a')](';'):null;},'comment':_0x2203('0x1f')},'autoframing':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'insecure':{'type':Sequelize[_0x2203('0x1')],'defaultValue':_0x2203('0x20'),'set':function(_0x5f11bf){this[_0x2203('0x17')](_0x2203('0x21'),_0x5f11bf?_0x5f11bf['join'](','):null);},'get':function(){return this[_0x2203('0xf')](_0x2203('0x21'))?this[_0x2203('0xf')](_0x2203('0x21'))[_0x2203('0x1a')](','):null;},'comment':_0x2203('0x22')},'trustrpid':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'useclientcode':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x2203('0x1')]},'callerid':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x2203('0x23')](0xb)},'allowoverlap':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'ignoresdpversion':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x2203('0x1')]},'template':{'type':Sequelize[_0x2203('0x1')]},'videosupport':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x24')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2203('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'mailbox':{'type':Sequelize[_0x2203('0x1')]},'session_timers':{'type':Sequelize['ENUM'](_0x2203('0x25'),_0x2203('0x26'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x2203('0x23')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2203('0x27'),_0x2203('0x28')),'defaultValue':_0x2203('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x2203('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x2203('0x23')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x2203('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x2203('0x1')]},'defaultuser':{'type':Sequelize[_0x2203('0x1')]},'rtptimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x2203('0x23')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM']('yes','no',_0x2203('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2203('0x1')]},'callbackextension':{'type':Sequelize[_0x2203('0x1')]},'timert1':{'type':Sequelize[_0x2203('0x23')](0xb)},'timerb':{'type':Sequelize[_0x2203('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2203('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x2203('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x2203('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x2203('0x1')]},'use_q850_reason':{'type':Sequelize[_0x2203('0x1')]},'maxforwards':{'type':Sequelize[_0x2203('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'force_avp':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no')},'icesupport':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x13'),'no',_0x2203('0x2a'),_0x2203('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x2203('0x23')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x2203('0x1')]},'dtlscipher':{'type':Sequelize[_0x2203('0x1')]},'dtlscafile':{'type':Sequelize[_0x2203('0x1')]},'dtlscapath':{'type':Sequelize[_0x2203('0x1')]},'dtlssetup':{'type':Sequelize[_0x2203('0x6')](_0x2203('0x2c'),_0x2203('0x2d'),_0x2203('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2203('0x1')]},'usereqphone':{'type':Sequelize[_0x2203('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2203('0x1')]},'recordofffeature':{'type':Sequelize[_0x2203('0x1')]},'call_limit':{'type':Sequelize[_0x2203('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2203('0x6')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x2203('0x13'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2203('0x1')]},'mohsuggest':{'type':Sequelize[_0x2203('0x1')]},'parkinglot':{'type':Sequelize[_0x2203('0x1')]},'description':{'type':Sequelize[_0x2203('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x2203('0x2f')},'canreinvite':{'type':Sequelize[_0x2203('0x6')]('yes','no',_0x2203('0x14'),_0x2203('0x15'),_0x2203('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2203('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2203('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index af13841..160cf99 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 _0x79e5=['model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','add','day','merge','map','filter','options','includeAll','include','rows','show','find','clone','params','get','omit','createdAt','updatedAt','body','create','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','/etc/asterisk/sip_xcally_trunks.conf','registry','writeFileSync','Reload','chan_sip.so','server/files/templates/registry.ejs','destroy','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','count','offset','set','apply','reject','update','sendStatus','stack','name','send','Trunk','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x79e5,0x1a4));var _0x579e=function(_0x374545,_0x55b9fe){_0x374545=_0x374545-0x0;var _0x255f93=_0x79e5[_0x374545];return _0x255f93;};'use strict';var jsonpatch=require(_0x579e('0x0'));var rp=require(_0x579e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x579e('0x2'));var util=require(_0x579e('0x3'));var path=require(_0x579e('0x4'));var sox=require(_0x579e('0x5'));var csv=require(_0x579e('0x6'));var ejs=require(_0x579e('0x7'));var fs=require('fs');var _=require(_0x579e('0x8'));var squel=require('squel');var crypto=require(_0x579e('0x9'));var jsforce=require(_0x579e('0xa'));var deskjs=require(_0x579e('0xb'));var toCsv=require(_0x579e('0x6'));var querystring=require(_0x579e('0xc'));var Papa=require(_0x579e('0xd'));var qs=require(_0x579e('0xe'));var logger=require(_0x579e('0xf'))('api');var utils=require('../../config/utils');var config=require(_0x579e('0x10'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb8cac7,_0x249b22,_0x375f14,_0x38fe3d){return new BPromise(function(_0x439aad,_0x111430){var _0x490adf=_0x38fe3d||client;return _0x490adf[_0x579e('0x11')](_0xb8cac7,_0x375f14)[_0x579e('0x12')](function(_0x14bfa6){logger[_0x579e('0x13')](_0x579e('0x14'),_0x249b22,_0x579e('0x15'));logger[_0x579e('0x16')](_0x579e('0x17'),_0x249b22,'request\x20sent',JSON[_0x579e('0x18')](_0x14bfa6));if(_0x14bfa6[_0x579e('0x19')]){if(_0x14bfa6[_0x579e('0x19')][_0x579e('0x1a')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x249b22,_0x14bfa6[_0x579e('0x19')][_0x579e('0x1b')]);return _0x111430(_0x14bfa6[_0x579e('0x19')][_0x579e('0x1b')]);}logger[_0x579e('0x19')](_0x579e('0x14'),_0x249b22,_0x14bfa6[_0x579e('0x19')][_0x579e('0x1b')]);return _0x439aad(_0x14bfa6[_0x579e('0x19')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x249b22,_0x579e('0x15'));_0x439aad(_0x14bfa6['result'][_0x579e('0x1b')]);}})[_0x579e('0x1c')](function(_0x589abd){logger[_0x579e('0x19')](_0x579e('0x14'),_0x249b22,_0x589abd);_0x111430(_0x589abd);});});}function respondWithStatusCode(_0x485579,_0x1dca10){_0x1dca10=_0x1dca10||0xcc;return function(_0x50038d){if(_0x50038d){return _0x485579['sendStatus'](_0x1dca10);}return _0x485579[_0x579e('0x1d')](_0x1dca10)[_0x579e('0x1e')]();};}function respondWithResult(_0x212340,_0x47ea9f){_0x47ea9f=_0x47ea9f||0xc8;return function(_0x572110){if(_0x572110){return _0x212340['status'](_0x47ea9f)[_0x579e('0x1f')](_0x572110);}};}function respondWithFilteredResult(_0x21c079,_0x478e26){return function(_0x1730c3){if(_0x1730c3){var _0x5702bb=_0x1730c3[_0x579e('0x20')],_0x3410bc=_0x478e26[_0x579e('0x21')],_0x28fdf2=_0x478e26[_0x579e('0x21')]+_0x478e26['limit'],_0x42dfb8;if(_0x28fdf2>=_0x5702bb){_0x28fdf2=_0x5702bb;_0x42dfb8=0xc8;}else{_0x42dfb8=0xce;}_0x21c079[_0x579e('0x1d')](_0x42dfb8);return _0x21c079[_0x579e('0x22')]('Content-Range',_0x3410bc+'-'+_0x28fdf2+'/'+_0x5702bb)[_0x579e('0x1f')](_0x1730c3);}return null;};}function patchUpdates(_0x4110fd){return function(_0x334274){try{jsonpatch[_0x579e('0x23')](_0x334274,_0x4110fd,!![]);}catch(_0x244dd4){return BPromise[_0x579e('0x24')](_0x244dd4);}return _0x334274['save']();};}function saveUpdates(_0x5323a1,_0x53ffc3){return function(_0x3a3be9){if(_0x3a3be9){return _0x3a3be9[_0x579e('0x25')](_0x5323a1)[_0x579e('0x12')](function(_0x5617ee){return _0x5617ee;});}return null;};}function removeEntity(_0x15a024,_0x143dd0){return function(_0x1ada3a){if(_0x1ada3a){return _0x1ada3a['destroy']()['then'](function(){_0x15a024[_0x579e('0x1d')](0xcc)[_0x579e('0x1e')]();});}};}function handleEntityNotFound(_0x27f6c6,_0x4c32ee){return function(_0x2181dc){if(!_0x2181dc){_0x27f6c6[_0x579e('0x26')](0x194);}return _0x2181dc;};}function handleError(_0x185ea8,_0x4b8932){_0x4b8932=_0x4b8932||0x1f4;return function(_0x6e523c){logger[_0x579e('0x19')](_0x6e523c[_0x579e('0x27')]);if(_0x6e523c[_0x579e('0x28')]){delete _0x6e523c[_0x579e('0x28')];}_0x185ea8[_0x579e('0x1d')](_0x4b8932)[_0x579e('0x29')](_0x6e523c);};}exports['index']=function(_0x413cb4,_0x1906ef){var _0x57ea3c={},_0x25ea6d={},_0x275d22={'count':0x0,'rows':[]};var _0x56871b=db[_0x579e('0x2a')][_0x579e('0x2b')];_0x25ea6d['model']=_[_0x579e('0x2c')](_0x56871b);var _0x3e9808={'dateStart':_0x413cb4[_0x579e('0x2d')]['dateStart'],'dateEnd':_0x413cb4['query'][_0x579e('0x2e')]};delete _0x413cb4[_0x579e('0x2d')][_0x579e('0x2f')];delete _0x413cb4[_0x579e('0x2d')][_0x579e('0x2e')];_0x25ea6d[_0x579e('0x2d')]=_[_0x579e('0x2c')](_0x413cb4['query']);_0x25ea6d[_0x579e('0x30')]=_[_0x579e('0x31')](_0x25ea6d[_0x579e('0x32')],_0x25ea6d['query']);_0x57ea3c[_0x579e('0x33')]=_[_0x579e('0x31')](_0x25ea6d[_0x579e('0x32')],qs[_0x579e('0x34')](_0x413cb4[_0x579e('0x2d')][_0x579e('0x34')]));_0x57ea3c['attributes']=_0x57ea3c[_0x579e('0x33')][_0x579e('0x35')]?_0x57ea3c['attributes']:_0x25ea6d[_0x579e('0x32')];if(!_0x413cb4[_0x579e('0x2d')][_0x579e('0x36')](_0x579e('0x37'))){_0x57ea3c[_0x579e('0x38')]=qs[_0x579e('0x38')](_0x413cb4['query']['limit']);_0x57ea3c[_0x579e('0x21')]=qs[_0x579e('0x21')](_0x413cb4['query'][_0x579e('0x21')]);}_0x57ea3c[_0x579e('0x39')]=qs[_0x579e('0x3a')](_0x413cb4['query']['sort']);_0x57ea3c[_0x579e('0x3b')]=qs[_0x579e('0x30')](_[_0x579e('0x3c')](_0x413cb4[_0x579e('0x2d')],_0x25ea6d[_0x579e('0x30')]));if(_0x3e9808[_0x579e('0x2f')]){if(_0x3e9808[_0x579e('0x2e')]){_0x3e9808[_0x579e('0x2e')]=moment(_0x3e9808['dateEnd'])[_0x579e('0x3d')](0x1,_0x579e('0x3e'));}else{_0x3e9808[_0x579e('0x2e')]=moment(_0x3e9808[_0x579e('0x2f')])['add'](0x1,_0x579e('0x3e'));}_[_0x579e('0x3f')](_0x57ea3c[_0x579e('0x3b')],{'createdAt':{'$gte':_0x3e9808[_0x579e('0x2f')],'$lte':_0x3e9808[_0x579e('0x2e')]}});}if(_0x413cb4['query']['filter']){_0x57ea3c[_0x579e('0x3b')]=_[_0x579e('0x3f')](_0x57ea3c[_0x579e('0x3b')],{'$or':_[_0x579e('0x40')](_0x57ea3c[_0x579e('0x33')],function(_0x4db9a4){var _0x45fdd6={};_0x45fdd6[_0x4db9a4]={'$like':'%'+_0x413cb4[_0x579e('0x2d')][_0x579e('0x41')]+'%'};return _0x45fdd6;})});}_0x57ea3c=_[_0x579e('0x3f')]({},_0x57ea3c,_0x413cb4[_0x579e('0x42')]);var _0x30839a={'where':_0x57ea3c[_0x579e('0x3b')]};return db['Trunk'][_0x579e('0x20')](_0x30839a)['then'](function(_0x2b39f4){_0x275d22[_0x579e('0x20')]=_0x2b39f4;if(_0x413cb4[_0x579e('0x2d')][_0x579e('0x43')]){_0x57ea3c[_0x579e('0x44')]=[{'all':!![]}];}return db[_0x579e('0x2a')]['findAll'](_0x57ea3c);})[_0x579e('0x12')](function(_0x3a3aaa){_0x275d22[_0x579e('0x45')]=_0x3a3aaa;return _0x275d22;})['then'](respondWithFilteredResult(_0x1906ef,_0x57ea3c))[_0x579e('0x1c')](handleError(_0x1906ef,null));};exports[_0x579e('0x46')]=function(_0x222474,_0x36969e){var _0x200199={'raw':![],'where':{'id':_0x222474['params']['id']}},_0x18af0f={};_0x18af0f['model']=_[_0x579e('0x2c')](db[_0x579e('0x2a')][_0x579e('0x2b')]);_0x18af0f[_0x579e('0x2d')]=_[_0x579e('0x2c')](_0x222474[_0x579e('0x2d')]);_0x18af0f['filters']=_[_0x579e('0x31')](_0x18af0f[_0x579e('0x32')],_0x18af0f[_0x579e('0x2d')]);_0x200199[_0x579e('0x33')]=_[_0x579e('0x31')](_0x18af0f[_0x579e('0x32')],qs[_0x579e('0x34')](_0x222474[_0x579e('0x2d')][_0x579e('0x34')]));_0x200199['attributes']=_0x200199[_0x579e('0x33')][_0x579e('0x35')]?_0x200199[_0x579e('0x33')]:_0x18af0f[_0x579e('0x32')];if(_0x222474[_0x579e('0x2d')][_0x579e('0x43')]){_0x200199[_0x579e('0x44')]=[{'all':!![]}];}_0x200199=_[_0x579e('0x3f')]({},_0x200199,_0x222474[_0x579e('0x42')]);return db[_0x579e('0x2a')][_0x579e('0x47')](_0x200199)['then'](handleEntityNotFound(_0x36969e,null))[_0x579e('0x12')](respondWithResult(_0x36969e,null))['catch'](handleError(_0x36969e,null));};exports[_0x579e('0x48')]=function(_0x31379b,_0xef131b){var _0x357124={'raw':![],'where':{'id':_0x31379b[_0x579e('0x49')]['id']}},_0x157300={};_0x157300[_0x579e('0x32')]=_['keys'](db['Trunk'][_0x579e('0x2b')]);_0x357124['attributes']=_[_0x579e('0x31')](_0x157300['model'],qs['fields'](_0x31379b[_0x579e('0x2d')][_0x579e('0x34')]));_0x357124['attributes']=_0x357124[_0x579e('0x33')][_0x579e('0x35')]?_0x357124[_0x579e('0x33')]:_0x157300['model'];if(_0x31379b['query']['includeAll']){_0x357124['include']=[{'all':!![]}];}_0x357124=_[_0x579e('0x3f')]({},_0x357124,_0x31379b[_0x579e('0x42')]);return db['Trunk'][_0x579e('0x47')](_0x357124)[_0x579e('0x12')](handleEntityNotFound(_0xef131b,null))[_0x579e('0x12')](function(_0x1c09ac){if(_0x1c09ac){var _0x374277=_0x1c09ac[_0x579e('0x4a')]({'plain':!![]});_0x374277=qs[_0x579e('0x4b')](_0x374277,['id',_0x579e('0x4c'),_0x579e('0x4d')]);_0x31379b['body']=_[_0x579e('0x4b')](_0x31379b[_0x579e('0x4e')],['id',_0x579e('0x4c'),_0x579e('0x4d')]);return db[_0x579e('0x2a')][_0x579e('0x4f')](_[_0x579e('0x3f')](_0x374277,_0x31379b[_0x579e('0x4e')]),{'include':_0x31379b[_0x579e('0x2d')][_0x579e('0x43')]?[{'all':!![]}]:undefined});}})[_0x579e('0x12')](respondWithResult(_0xef131b,0xc9))[_0x579e('0x1c')](handleError(_0xef131b,null));};exports[_0x579e('0x4f')]=function(_0x425a85,_0x558828,_0x251730){var _0x355218;return db[_0x579e('0x2a')][_0x579e('0x4f')](_0x425a85['body'],{'raw':!![]})['then'](function(_0x2fc555){_0x355218=_0x2fc555;return db['Trunk'][_0x579e('0x50')]({'raw':!![]});})[_0x579e('0x12')](function(_0x523b11){var _0x42b6d3=fs[_0x579e('0x51')](path[_0x579e('0x52')](config[_0x579e('0x53')],_0x579e('0x54')),_0x579e('0x55'));var _0x17f28b=fs['readFileSync'](path[_0x579e('0x52')](config[_0x579e('0x53')],'server/files/templates/registry.ejs'),_0x579e('0x55'));var _0x2e7473=ejs[_0x579e('0x56')](_0x42b6d3,{'trunks':_0x523b11||[]});fs['writeFileSync'](_0x579e('0x57'),_0x2e7473);if(_0x355218[_0x579e('0x58')]){var _0x27bca3=ejs[_0x579e('0x56')](_0x17f28b,{'trunks':_0x523b11||[]});fs[_0x579e('0x59')]('/etc/asterisk/sip_xcally_registers.conf',_0x27bca3);}})[_0x579e('0x12')](function(){return respondWithRpcPromise(_0x579e('0x5a'),'create',{'module':_0x579e('0x5b')});})['then'](function(){return _0x355218;})[_0x579e('0x12')](respondWithResult(_0x558828,0xc9))[_0x579e('0x1c')](handleError(_0x558828,null));};exports[_0x579e('0x25')]=function(_0x1943ce,_0x498211,_0x4c2586){var _0x36ba01;return db[_0x579e('0x2a')]['find']({'where':{'id':_0x1943ce[_0x579e('0x49')]['id']}})['then'](handleEntityNotFound(_0x498211,null))[_0x579e('0x12')](saveUpdates(_0x1943ce[_0x579e('0x4e')],null))[_0x579e('0x12')](function(_0x344f06){if(_0x344f06){_0x36ba01=_0x344f06;return db[_0x579e('0x2a')][_0x579e('0x50')]({'raw':!![]});}})[_0x579e('0x12')](function(_0x2b534f){if(_0x2b534f){var _0x173ae1=fs[_0x579e('0x51')](path[_0x579e('0x52')](config[_0x579e('0x53')],_0x579e('0x54')),_0x579e('0x55'));var _0x391fe6=fs['readFileSync'](path[_0x579e('0x52')](config[_0x579e('0x53')],_0x579e('0x5c')),_0x579e('0x55'));var _0x40db7e=ejs[_0x579e('0x56')](_0x173ae1,{'trunks':_0x2b534f||[]});fs['writeFileSync'](_0x579e('0x57'),_0x40db7e);var _0x435736=ejs[_0x579e('0x56')](_0x391fe6,{'trunks':_0x2b534f||[]});fs[_0x579e('0x59')]('/etc/asterisk/sip_xcally_registers.conf',_0x435736);return respondWithRpcPromise(_0x579e('0x5a'),_0x579e('0x25'),{'module':_0x579e('0x5b')});}return null;})[_0x579e('0x12')](function(_0x31ab82){if(_0x31ab82){return _0x36ba01;}})['then'](respondWithResult(_0x498211,null))[_0x579e('0x1c')](handleError(_0x498211,null));};exports[_0x579e('0x5d')]=function(_0x4e7fa0,_0x289d81,_0x9017ec){var _0x321727;return db[_0x579e('0x2a')][_0x579e('0x47')]({'where':{'id':_0x4e7fa0[_0x579e('0x49')]['id']}})[_0x579e('0x12')](handleEntityNotFound(_0x289d81,null))[_0x579e('0x12')](removeEntity(_0x289d81,null))[_0x579e('0x12')](function(){return db[_0x579e('0x2a')]['findAll']({'raw':!![]});})['then'](function(_0x3b8001){var _0x354d33=fs[_0x579e('0x51')](path[_0x579e('0x52')](config[_0x579e('0x53')],'server/files/templates/trunk.ejs'),_0x579e('0x55'));var _0x314fbb=fs[_0x579e('0x51')](path[_0x579e('0x52')](config[_0x579e('0x53')],_0x579e('0x5c')),_0x579e('0x55'));var _0x35a6d3=ejs[_0x579e('0x56')](_0x354d33,{'trunks':_0x3b8001});var _0xe99ed5=ejs[_0x579e('0x56')](_0x314fbb,{'trunks':_0x3b8001});fs[_0x579e('0x59')](_0x579e('0x57'),_0x35a6d3);fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0xe99ed5);return respondWithRpcPromise('Reload',_0x579e('0x5d'),{'module':_0x579e('0x5b')});})[_0x579e('0x1c')](handleError(_0x289d81,null));}; \ No newline at end of file +var _0x6e59=['sort','where','pick','add','day','merge','filter','map','options','includeAll','include','rows','show','params','rawAttributes','find','clone','createdAt','updatedAt','body','omit','create','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','count','offset','limit','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','Trunk','model','keys','query','dateEnd','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x4c0ac9,_0x540ed1){var _0x507a30=function(_0x11422a){while(--_0x11422a){_0x4c0ac9['push'](_0x4c0ac9['shift']());}};_0x507a30(++_0x540ed1);}(_0x6e59,0xe8));var _0x96e5=function(_0x280932,_0x38cad5){_0x280932=_0x280932-0x0;var _0x3ce8bb=_0x6e59[_0x280932];return _0x3ce8bb;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x96e5('0x0'));var moment=require(_0x96e5('0x1'));var BPromise=require(_0x96e5('0x2'));var Mustache=require(_0x96e5('0x3'));var util=require(_0x96e5('0x4'));var path=require(_0x96e5('0x5'));var sox=require(_0x96e5('0x6'));var csv=require('to-csv');var ejs=require(_0x96e5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x96e5('0x8'));var crypto=require(_0x96e5('0x9'));var jsforce=require(_0x96e5('0xa'));var deskjs=require(_0x96e5('0xb'));var toCsv=require('to-csv');var querystring=require(_0x96e5('0xc'));var Papa=require(_0x96e5('0xd'));var qs=require(_0x96e5('0xe'));var logger=require(_0x96e5('0xf'))(_0x96e5('0x10'));var utils=require(_0x96e5('0x11'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x96e5('0x12'));var client=jayson[_0x96e5('0x13')][_0x96e5('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x53d95b,_0x137ee0,_0x3be2a2,_0x3fea72){return new BPromise(function(_0x18bb93,_0x20ff29){var _0x3ba7b3=_0x3fea72||client;return _0x3ba7b3[_0x96e5('0x15')](_0x53d95b,_0x3be2a2)[_0x96e5('0x16')](function(_0x11b2c3){logger[_0x96e5('0x17')](_0x96e5('0x18'),_0x137ee0,_0x96e5('0x19'));logger['debug'](_0x96e5('0x1a'),_0x137ee0,_0x96e5('0x19'),JSON[_0x96e5('0x1b')](_0x11b2c3));if(_0x11b2c3[_0x96e5('0x1c')]){if(_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1d')]===0x1f4){logger[_0x96e5('0x1c')](_0x96e5('0x18'),_0x137ee0,_0x11b2c3['error'][_0x96e5('0x1e')]);return _0x20ff29(_0x11b2c3[_0x96e5('0x1c')]['message']);}logger['error'](_0x96e5('0x18'),_0x137ee0,_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1e')]);return _0x18bb93(_0x11b2c3[_0x96e5('0x1c')][_0x96e5('0x1e')]);}else{logger[_0x96e5('0x17')](_0x96e5('0x18'),_0x137ee0,_0x96e5('0x19'));_0x18bb93(_0x11b2c3[_0x96e5('0x1f')][_0x96e5('0x1e')]);}})[_0x96e5('0x20')](function(_0x357b56){logger[_0x96e5('0x1c')](_0x96e5('0x18'),_0x137ee0,_0x357b56);_0x20ff29(_0x357b56);});});}function respondWithStatusCode(_0xed9044,_0x1a989c){_0x1a989c=_0x1a989c||0xcc;return function(_0xfffc2d){if(_0xfffc2d){return _0xed9044[_0x96e5('0x21')](_0x1a989c);}return _0xed9044[_0x96e5('0x22')](_0x1a989c)['end']();};}function respondWithResult(_0x16bb7d,_0x67bef1){_0x67bef1=_0x67bef1||0xc8;return function(_0x817891){if(_0x817891){return _0x16bb7d['status'](_0x67bef1)['json'](_0x817891);}};}function respondWithFilteredResult(_0x2e3712,_0x7addf0){return function(_0x50c834){if(_0x50c834){var _0x5273f2=_0x50c834[_0x96e5('0x23')],_0x352647=_0x7addf0[_0x96e5('0x24')],_0x10bc86=_0x7addf0[_0x96e5('0x24')]+_0x7addf0[_0x96e5('0x25')],_0x4b4c9c;if(_0x10bc86>=_0x5273f2){_0x10bc86=_0x5273f2;_0x4b4c9c=0xc8;}else{_0x4b4c9c=0xce;}_0x2e3712[_0x96e5('0x22')](_0x4b4c9c);return _0x2e3712['set'](_0x96e5('0x26'),_0x352647+'-'+_0x10bc86+'/'+_0x5273f2)['json'](_0x50c834);}return null;};}function patchUpdates(_0x24b5f6){return function(_0x22ada7){try{jsonpatch[_0x96e5('0x27')](_0x22ada7,_0x24b5f6,!![]);}catch(_0x469058){return BPromise[_0x96e5('0x28')](_0x469058);}return _0x22ada7[_0x96e5('0x29')]();};}function saveUpdates(_0x12aa3a,_0x5b3b21){return function(_0x1e4fdb){if(_0x1e4fdb){return _0x1e4fdb[_0x96e5('0x2a')](_0x12aa3a)[_0x96e5('0x16')](function(_0xc264ab){return _0xc264ab;});}return null;};}function removeEntity(_0x58a3a1,_0x4ff609){return function(_0x531a4d){if(_0x531a4d){return _0x531a4d[_0x96e5('0x2b')]()[_0x96e5('0x16')](function(){_0x58a3a1[_0x96e5('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x466fd3,_0x53aab7){return function(_0x3fad61){if(!_0x3fad61){_0x466fd3[_0x96e5('0x21')](0x194);}return _0x3fad61;};}function handleError(_0x300bfc,_0x5e52aa){_0x5e52aa=_0x5e52aa||0x1f4;return function(_0x17e68a){logger[_0x96e5('0x1c')](_0x17e68a[_0x96e5('0x2c')]);if(_0x17e68a[_0x96e5('0x2d')]){delete _0x17e68a[_0x96e5('0x2d')];}_0x300bfc['status'](_0x5e52aa)[_0x96e5('0x2e')](_0x17e68a);};}exports[_0x96e5('0x2f')]=function(_0x4c58c1,_0x33f9f7){var _0x329c2d={},_0x21a38b={},_0xf81755={'count':0x0,'rows':[]};var _0x20389b=db[_0x96e5('0x30')]['rawAttributes'];_0x21a38b[_0x96e5('0x31')]=_[_0x96e5('0x32')](_0x20389b);var _0x2ccd16={'dateStart':_0x4c58c1['query']['dateStart'],'dateEnd':_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x34')]};delete _0x4c58c1[_0x96e5('0x33')][_0x96e5('0x35')];delete _0x4c58c1[_0x96e5('0x33')]['dateEnd'];_0x21a38b[_0x96e5('0x33')]=_[_0x96e5('0x32')](_0x4c58c1[_0x96e5('0x33')]);_0x21a38b[_0x96e5('0x36')]=_[_0x96e5('0x37')](_0x21a38b[_0x96e5('0x31')],_0x21a38b['query']);_0x329c2d[_0x96e5('0x38')]=_['intersection'](_0x21a38b['model'],qs[_0x96e5('0x39')](_0x4c58c1[_0x96e5('0x33')]['fields']));_0x329c2d['attributes']=_0x329c2d[_0x96e5('0x38')][_0x96e5('0x3a')]?_0x329c2d['attributes']:_0x21a38b[_0x96e5('0x31')];if(!_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x3b')](_0x96e5('0x3c'))){_0x329c2d[_0x96e5('0x25')]=qs['limit'](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x25')]);_0x329c2d[_0x96e5('0x24')]=qs[_0x96e5('0x24')](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x24')]);}_0x329c2d[_0x96e5('0x3d')]=qs['sort'](_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x3e')]);_0x329c2d[_0x96e5('0x3f')]=qs[_0x96e5('0x36')](_[_0x96e5('0x40')](_0x4c58c1['query'],_0x21a38b[_0x96e5('0x36')]));if(_0x2ccd16[_0x96e5('0x35')]){if(_0x2ccd16[_0x96e5('0x34')]){_0x2ccd16[_0x96e5('0x34')]=moment(_0x2ccd16[_0x96e5('0x34')])[_0x96e5('0x41')](0x1,_0x96e5('0x42'));}else{_0x2ccd16[_0x96e5('0x34')]=moment(_0x2ccd16[_0x96e5('0x35')])[_0x96e5('0x41')](0x1,'day');}_[_0x96e5('0x43')](_0x329c2d[_0x96e5('0x3f')],{'createdAt':{'$gte':_0x2ccd16[_0x96e5('0x35')],'$lte':_0x2ccd16[_0x96e5('0x34')]}});}if(_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x44')]){_0x329c2d[_0x96e5('0x3f')]=_['merge'](_0x329c2d['where'],{'$or':_[_0x96e5('0x45')](_0x329c2d[_0x96e5('0x38')],function(_0x53e16a){var _0x3c4844={};_0x3c4844[_0x53e16a]={'$like':'%'+_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x44')]+'%'};return _0x3c4844;})});}_0x329c2d=_[_0x96e5('0x43')]({},_0x329c2d,_0x4c58c1[_0x96e5('0x46')]);var _0x528a0e={'where':_0x329c2d['where']};return db[_0x96e5('0x30')][_0x96e5('0x23')](_0x528a0e)[_0x96e5('0x16')](function(_0x3c4bf9){_0xf81755[_0x96e5('0x23')]=_0x3c4bf9;if(_0x4c58c1[_0x96e5('0x33')][_0x96e5('0x47')]){_0x329c2d[_0x96e5('0x48')]=[{'all':!![]}];}return db[_0x96e5('0x30')]['findAll'](_0x329c2d);})['then'](function(_0x4d172b){_0xf81755[_0x96e5('0x49')]=_0x4d172b;return _0xf81755;})[_0x96e5('0x16')](respondWithFilteredResult(_0x33f9f7,_0x329c2d))[_0x96e5('0x20')](handleError(_0x33f9f7,null));};exports[_0x96e5('0x4a')]=function(_0x2921ae,_0x39c767){var _0x1d2873={'raw':![],'where':{'id':_0x2921ae[_0x96e5('0x4b')]['id']}},_0x449d3e={};_0x449d3e['model']=_[_0x96e5('0x32')](db[_0x96e5('0x30')][_0x96e5('0x4c')]);_0x449d3e[_0x96e5('0x33')]=_[_0x96e5('0x32')](_0x2921ae[_0x96e5('0x33')]);_0x449d3e[_0x96e5('0x36')]=_['intersection'](_0x449d3e['model'],_0x449d3e[_0x96e5('0x33')]);_0x1d2873[_0x96e5('0x38')]=_[_0x96e5('0x37')](_0x449d3e[_0x96e5('0x31')],qs[_0x96e5('0x39')](_0x2921ae[_0x96e5('0x33')]['fields']));_0x1d2873['attributes']=_0x1d2873[_0x96e5('0x38')]['length']?_0x1d2873[_0x96e5('0x38')]:_0x449d3e['model'];if(_0x2921ae[_0x96e5('0x33')][_0x96e5('0x47')]){_0x1d2873[_0x96e5('0x48')]=[{'all':!![]}];}_0x1d2873=_[_0x96e5('0x43')]({},_0x1d2873,_0x2921ae['options']);return db[_0x96e5('0x30')][_0x96e5('0x4d')](_0x1d2873)[_0x96e5('0x16')](handleEntityNotFound(_0x39c767,null))['then'](respondWithResult(_0x39c767,null))[_0x96e5('0x20')](handleError(_0x39c767,null));};exports[_0x96e5('0x4e')]=function(_0x1cb04a,_0x13391f){var _0x5b6116={'raw':![],'where':{'id':_0x1cb04a[_0x96e5('0x4b')]['id']}},_0x24a76d={};_0x24a76d[_0x96e5('0x31')]=_[_0x96e5('0x32')](db[_0x96e5('0x30')][_0x96e5('0x4c')]);_0x5b6116[_0x96e5('0x38')]=_[_0x96e5('0x37')](_0x24a76d[_0x96e5('0x31')],qs[_0x96e5('0x39')](_0x1cb04a['query'][_0x96e5('0x39')]));_0x5b6116[_0x96e5('0x38')]=_0x5b6116[_0x96e5('0x38')][_0x96e5('0x3a')]?_0x5b6116[_0x96e5('0x38')]:_0x24a76d[_0x96e5('0x31')];if(_0x1cb04a[_0x96e5('0x33')][_0x96e5('0x47')]){_0x5b6116[_0x96e5('0x48')]=[{'all':!![]}];}_0x5b6116=_['merge']({},_0x5b6116,_0x1cb04a[_0x96e5('0x46')]);return db['Trunk'][_0x96e5('0x4d')](_0x5b6116)[_0x96e5('0x16')](handleEntityNotFound(_0x13391f,null))[_0x96e5('0x16')](function(_0x4524d0){if(_0x4524d0){var _0x24d60d=_0x4524d0['get']({'plain':!![]});_0x24d60d=qs['omit'](_0x24d60d,['id',_0x96e5('0x4f'),_0x96e5('0x50')]);_0x1cb04a[_0x96e5('0x51')]=_[_0x96e5('0x52')](_0x1cb04a[_0x96e5('0x51')],['id','createdAt',_0x96e5('0x50')]);return db['Trunk'][_0x96e5('0x53')](_['merge'](_0x24d60d,_0x1cb04a[_0x96e5('0x51')]),{'include':_0x1cb04a[_0x96e5('0x33')][_0x96e5('0x47')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x13391f,0xc9))['catch'](handleError(_0x13391f,null));};exports[_0x96e5('0x53')]=function(_0x19e861,_0x7590f4,_0x47481b){var _0x5a906c;return db[_0x96e5('0x30')][_0x96e5('0x53')](_0x19e861[_0x96e5('0x51')],{'raw':!![]})[_0x96e5('0x16')](function(_0x4a426c){_0x5a906c=_0x4a426c;return db['Trunk'][_0x96e5('0x54')]({'raw':!![]});})[_0x96e5('0x16')](function(_0x41d2a6){var _0xb48c3=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x58')),_0x96e5('0x59'));var _0x19ddfe=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x5a')),'utf8');var _0x5343fc=ejs[_0x96e5('0x5b')](_0xb48c3,{'trunks':_0x41d2a6||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x5343fc);if(_0x5a906c[_0x96e5('0x5e')]){var _0x4886d4=ejs[_0x96e5('0x5b')](_0x19ddfe,{'trunks':_0x41d2a6||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5f'),_0x4886d4);}})[_0x96e5('0x16')](function(){return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x53'),{'module':_0x96e5('0x61')});})[_0x96e5('0x16')](function(){return _0x5a906c;})['then'](respondWithResult(_0x7590f4,0xc9))[_0x96e5('0x20')](handleError(_0x7590f4,null));};exports[_0x96e5('0x2a')]=function(_0x1d60fd,_0x4c2b0e,_0x3c1680){var _0x32d984;return db['Trunk'][_0x96e5('0x4d')]({'where':{'id':_0x1d60fd['params']['id']}})[_0x96e5('0x16')](handleEntityNotFound(_0x4c2b0e,null))[_0x96e5('0x16')](saveUpdates(_0x1d60fd[_0x96e5('0x51')],null))[_0x96e5('0x16')](function(_0x4a474a){if(_0x4a474a){_0x32d984=_0x4a474a;return db[_0x96e5('0x30')][_0x96e5('0x54')]({'raw':!![]});}})[_0x96e5('0x16')](function(_0x32579a){if(_0x32579a){var _0x3f50c2=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],'server/files/templates/trunk.ejs'),_0x96e5('0x59'));var _0x2906fc=fs['readFileSync'](path[_0x96e5('0x56')](config[_0x96e5('0x57')],'server/files/templates/registry.ejs'),'utf8');var _0x144183=ejs['render'](_0x3f50c2,{'trunks':_0x32579a||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x144183);var _0x1924e9=ejs['render'](_0x2906fc,{'trunks':_0x32579a||[]});fs[_0x96e5('0x5c')](_0x96e5('0x5f'),_0x1924e9);return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x2a'),{'module':_0x96e5('0x61')});}return null;})['then'](function(_0x421f4e){if(_0x421f4e){return _0x32d984;}})['then'](respondWithResult(_0x4c2b0e,null))['catch'](handleError(_0x4c2b0e,null));};exports['destroy']=function(_0x3ca9dc,_0x47be36,_0x353960){var _0x2d7d9a;return db[_0x96e5('0x30')][_0x96e5('0x4d')]({'where':{'id':_0x3ca9dc[_0x96e5('0x4b')]['id']}})['then'](handleEntityNotFound(_0x47be36,null))[_0x96e5('0x16')](removeEntity(_0x47be36,null))[_0x96e5('0x16')](function(){return db[_0x96e5('0x30')][_0x96e5('0x54')]({'raw':!![]});})[_0x96e5('0x16')](function(_0x443963){var _0x2385ec=fs['readFileSync'](path['join'](config['root'],_0x96e5('0x58')),_0x96e5('0x59'));var _0x265dd6=fs[_0x96e5('0x55')](path[_0x96e5('0x56')](config[_0x96e5('0x57')],_0x96e5('0x5a')),'utf8');var _0x24952c=ejs['render'](_0x2385ec,{'trunks':_0x443963});var _0x9b80f9=ejs[_0x96e5('0x5b')](_0x265dd6,{'trunks':_0x443963});fs[_0x96e5('0x5c')](_0x96e5('0x5d'),_0x24952c);fs['writeFileSync'](_0x96e5('0x5f'),_0x9b80f9);return respondWithRpcPromise(_0x96e5('0x60'),_0x96e5('0x2b'),{'module':_0x96e5('0x61')});})[_0x96e5('0x20')](handleError(_0x47be36,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2721ce9..eec86bc 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 _0x845f=['util','../../config/logger','api','bluebird','./trunk.attributes','exports','define','tools_trunks','lodash'];(function(_0x2f2b73,_0x4be42e){var _0x46903f=function(_0x5454d2){while(--_0x5454d2){_0x2f2b73['push'](_0x2f2b73['shift']());}};_0x46903f(++_0x4be42e);}(_0x845f,0x1dc));var _0xf845=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0x845f[_0x1f1e31];return _0x229b56;};'use strict';var _=require(_0xf845('0x0'));var util=require(_0xf845('0x1'));var logger=require(_0xf845('0x2'))(_0xf845('0x3'));var moment=require('moment');var BPromise=require(_0xf845('0x4'));var rp=require('request-promise');var attributes=require(_0xf845('0x5'));module[_0xf845('0x6')]=function(_0xd01af5,_0x274c2a){return _0xd01af5[_0xf845('0x7')]('Trunk',attributes,{'tableName':_0xf845('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x105f=['api','request-promise','./trunk.attributes','exports','define','tools_trunks','lodash','util'];(function(_0x52bbc9,_0xb342e0){var _0x5909d0=function(_0x24370d){while(--_0x24370d){_0x52bbc9['push'](_0x52bbc9['shift']());}};_0x5909d0(++_0xb342e0);}(_0x105f,0x14e));var _0xf105=function(_0x3e7f20,_0x453143){_0x3e7f20=_0x3e7f20-0x0;var _0x56399a=_0x105f[_0x3e7f20];return _0x56399a;};'use strict';var _=require(_0xf105('0x0'));var util=require(_0xf105('0x1'));var logger=require('../../config/logger')(_0xf105('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf105('0x3'));var attributes=require(_0xf105('0x4'));module[_0xf105('0x5')]=function(_0x30c8ae,_0x60d78b){return _0x30c8ae[_0xf105('0x6')]('Trunk',attributes,{'tableName':_0xf105('0x7'),'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 721e59f..e98fb51 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 _0xdfa1=['info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','catch','GetTrunk','Trunk','options','raw','attributes','include','model','map','then','ShowTrunk','where','bluebird','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2a7d25,_0x51b1a6){var _0x1211b6=function(_0x30bd97){while(--_0x30bd97){_0x2a7d25['push'](_0x2a7d25['shift']());}};_0x1211b6(++_0x51b1a6);}(_0xdfa1,0x1c5));var _0x1dfa=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xdfa1[_0x288f5e];return _0x476cc9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1dfa('0x0'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x1dfa('0x1'));var logger=require(_0x1dfa('0x2'))('rpc');var config=require(_0x1dfa('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x1dfa('0x4')][_0x1dfa('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x166c95,_0x580da5,_0x28f699){return new BPromise(function(_0x5126f6,_0x506459){return client['request'](_0x166c95,_0x28f699)['then'](function(_0x313ce6){logger[_0x1dfa('0x6')]('Trunk,\x20%s,\x20%s',_0x580da5,_0x1dfa('0x7'));logger[_0x1dfa('0x8')](_0x1dfa('0x9'),_0x580da5,_0x1dfa('0x7'),JSON[_0x1dfa('0xa')](_0x313ce6));if(_0x313ce6[_0x1dfa('0xb')]){if(_0x313ce6[_0x1dfa('0xb')][_0x1dfa('0xc')]===0x1f4){logger[_0x1dfa('0xb')](_0x1dfa('0xd'),_0x580da5,_0x313ce6[_0x1dfa('0xb')]['message']);return _0x506459(_0x313ce6[_0x1dfa('0xb')][_0x1dfa('0xe')]);}logger[_0x1dfa('0xb')](_0x1dfa('0xd'),_0x580da5,_0x313ce6['error'][_0x1dfa('0xe')]);return _0x5126f6(_0x313ce6[_0x1dfa('0xb')]['message']);}else{logger[_0x1dfa('0x6')](_0x1dfa('0xd'),_0x580da5,_0x1dfa('0x7'));_0x5126f6(_0x313ce6['result']['message']);}})[_0x1dfa('0xf')](function(_0x2627c0){logger[_0x1dfa('0xb')](_0x1dfa('0xd'),_0x580da5,_0x2627c0);_0x506459(_0x2627c0);});});}exports[_0x1dfa('0x10')]=function(_0x2aeaa2){var _0x2b22d8=this;return new Promise(function(_0x15d0ca,_0x40106a){return db[_0x1dfa('0x11')]['findAll']({'raw':_0x2aeaa2['options']?_0x2aeaa2[_0x1dfa('0x12')][_0x1dfa('0x13')]===undefined?!![]:![]:!![],'where':_0x2aeaa2[_0x1dfa('0x12')]?_0x2aeaa2['options']['where']||null:null,'attributes':_0x2aeaa2[_0x1dfa('0x12')]?_0x2aeaa2[_0x1dfa('0x12')][_0x1dfa('0x14')]||null:null,'limit':_0x2aeaa2['options']?_0x2aeaa2[_0x1dfa('0x12')]['limit']||null:null,'include':_0x2aeaa2[_0x1dfa('0x12')]?_0x2aeaa2[_0x1dfa('0x12')]['include']?_['map'](_0x2aeaa2['options'][_0x1dfa('0x15')],function(_0x413094){return{'model':db[_0x413094[_0x1dfa('0x16')]],'as':_0x413094['as'],'attributes':_0x413094[_0x1dfa('0x14')],'include':_0x413094['include']?_[_0x1dfa('0x17')](_0x413094[_0x1dfa('0x15')],function(_0x493c5c){return{'model':db[_0x493c5c[_0x1dfa('0x16')]],'as':_0x493c5c['as'],'attributes':_0x493c5c[_0x1dfa('0x14')],'include':_0x493c5c[_0x1dfa('0x15')]?_[_0x1dfa('0x17')](_0x493c5c[_0x1dfa('0x15')],function(_0x2fb81d){return{'model':db[_0x2fb81d[_0x1dfa('0x16')]],'as':_0x2fb81d['as'],'attributes':_0x2fb81d[_0x1dfa('0x14')]};}):[]};}):[]};}):[]:[]})[_0x1dfa('0x18')](function(_0x25257d){logger[_0x1dfa('0x6')](_0x1dfa('0x10'),_0x2aeaa2);logger[_0x1dfa('0x8')]('GetTrunk',_0x2aeaa2,JSON['stringify'](_0x25257d));_0x15d0ca(_0x25257d);})[_0x1dfa('0xf')](function(_0x232149){logger[_0x1dfa('0xb')](_0x1dfa('0x10'),_0x232149[_0x1dfa('0xe')],_0x2aeaa2);_0x40106a(_0x2b22d8[_0x1dfa('0xb')](0x1f4,_0x232149['message']));});});};exports[_0x1dfa('0x19')]=function(_0x58ca4b){var _0x220939=this;return new Promise(function(_0x1d9a08,_0x25bc6d){return db[_0x1dfa('0x11')]['find']({'raw':_0x58ca4b[_0x1dfa('0x12')]?_0x58ca4b[_0x1dfa('0x12')][_0x1dfa('0x13')]===undefined?!![]:![]:!![],'where':_0x58ca4b['options']?_0x58ca4b[_0x1dfa('0x12')][_0x1dfa('0x1a')]||null:null,'attributes':_0x58ca4b[_0x1dfa('0x12')]?_0x58ca4b[_0x1dfa('0x12')]['attributes']||null:null,'include':_0x58ca4b[_0x1dfa('0x12')]?_0x58ca4b['options'][_0x1dfa('0x15')]?_[_0x1dfa('0x17')](_0x58ca4b[_0x1dfa('0x12')][_0x1dfa('0x15')],function(_0x5e77c6){return{'model':db[_0x5e77c6['model']],'as':_0x5e77c6['as'],'attributes':_0x5e77c6[_0x1dfa('0x14')],'include':_0x5e77c6[_0x1dfa('0x15')]?_[_0x1dfa('0x17')](_0x5e77c6['include'],function(_0x465190){return{'model':db[_0x465190[_0x1dfa('0x16')]],'as':_0x465190['as'],'attributes':_0x465190[_0x1dfa('0x14')],'include':_0x465190[_0x1dfa('0x15')]?_['map'](_0x465190[_0x1dfa('0x15')],function(_0x24a0af){return{'model':db[_0x24a0af['model']],'as':_0x24a0af['as'],'attributes':_0x24a0af['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x531741){logger[_0x1dfa('0x6')](_0x1dfa('0x19'),_0x58ca4b);logger[_0x1dfa('0x8')](_0x1dfa('0x19'),_0x58ca4b,JSON[_0x1dfa('0xa')](_0x531741));_0x1d9a08(_0x531741);})[_0x1dfa('0xf')](function(_0x1b820a){logger['error'](_0x1dfa('0x19'),_0x1b820a[_0x1dfa('0xe')],_0x58ca4b);_0x25bc6d(_0x220939[_0x1dfa('0xb')](0x1f4,_0x1b820a[_0x1dfa('0xe')]));});});}; \ No newline at end of file +var _0x5862=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','info','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','then','find','raw','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','http','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5862,0x182));var _0x2586=function(_0x299970,_0x25c56e){_0x299970=_0x299970-0x0;var _0x1feecb=_0x5862[_0x299970];return _0x1feecb;};'use strict';var _=require(_0x2586('0x0'));var util=require(_0x2586('0x1'));var moment=require(_0x2586('0x2'));var BPromise=require(_0x2586('0x3'));var rs=require(_0x2586('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2586('0x5'));var logger=require(_0x2586('0x6'))(_0x2586('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2586('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d9926,_0x19badd,_0x47da35){return new BPromise(function(_0x74920f,_0x4727f6){return client['request'](_0x5d9926,_0x47da35)['then'](function(_0x4f0ea8){logger['info']('Trunk,\x20%s,\x20%s',_0x19badd,_0x2586('0x9'));logger[_0x2586('0xa')](_0x2586('0xb'),_0x19badd,'request\x20sent',JSON[_0x2586('0xc')](_0x4f0ea8));if(_0x4f0ea8[_0x2586('0xd')]){if(_0x4f0ea8['error'][_0x2586('0xe')]===0x1f4){logger['error'](_0x2586('0xf'),_0x19badd,_0x4f0ea8[_0x2586('0xd')][_0x2586('0x10')]);return _0x4727f6(_0x4f0ea8['error'][_0x2586('0x10')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x19badd,_0x4f0ea8[_0x2586('0xd')][_0x2586('0x10')]);return _0x74920f(_0x4f0ea8[_0x2586('0xd')]['message']);}else{logger[_0x2586('0x11')]('Trunk,\x20%s,\x20%s',_0x19badd,_0x2586('0x9'));_0x74920f(_0x4f0ea8['result']['message']);}})[_0x2586('0x12')](function(_0x4e1f66){logger[_0x2586('0xd')](_0x2586('0xf'),_0x19badd,_0x4e1f66);_0x4727f6(_0x4e1f66);});});}exports[_0x2586('0x13')]=function(_0x4a62bd){var _0x2e0590=this;return new Promise(function(_0x3eadef,_0x1e48cb){return db[_0x2586('0x14')][_0x2586('0x15')]({'raw':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x17')]||null:null,'attributes':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x18')]||null:null,'limit':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x19')]||null:null,'include':_0x4a62bd[_0x2586('0x16')]?_0x4a62bd[_0x2586('0x16')][_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x4a62bd['options']['include'],function(_0xe26170){return{'model':db[_0xe26170[_0x2586('0x1c')]],'as':_0xe26170['as'],'attributes':_0xe26170[_0x2586('0x18')],'include':_0xe26170[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0xe26170[_0x2586('0x1a')],function(_0x50fa05){return{'model':db[_0x50fa05[_0x2586('0x1c')]],'as':_0x50fa05['as'],'attributes':_0x50fa05[_0x2586('0x18')],'include':_0x50fa05[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x50fa05[_0x2586('0x1a')],function(_0x97a186){return{'model':db[_0x97a186[_0x2586('0x1c')]],'as':_0x97a186['as'],'attributes':_0x97a186[_0x2586('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x1d')](function(_0x38c776){logger[_0x2586('0x11')](_0x2586('0x13'),_0x4a62bd);logger['debug'](_0x2586('0x13'),_0x4a62bd,JSON[_0x2586('0xc')](_0x38c776));_0x3eadef(_0x38c776);})['catch'](function(_0x5b9687){logger[_0x2586('0xd')](_0x2586('0x13'),_0x5b9687['message'],_0x4a62bd);_0x1e48cb(_0x2e0590[_0x2586('0xd')](0x1f4,_0x5b9687['message']));});});};exports['ShowTrunk']=function(_0x4795f7){var _0x5b54a0=this;return new Promise(function(_0x49b7b5,_0x12e12c){return db[_0x2586('0x14')][_0x2586('0x1e')]({'raw':_0x4795f7[_0x2586('0x16')]?_0x4795f7[_0x2586('0x16')][_0x2586('0x1f')]===undefined?!![]:![]:!![],'where':_0x4795f7['options']?_0x4795f7[_0x2586('0x16')][_0x2586('0x17')]||null:null,'attributes':_0x4795f7[_0x2586('0x16')]?_0x4795f7['options'][_0x2586('0x18')]||null:null,'include':_0x4795f7[_0x2586('0x16')]?_0x4795f7[_0x2586('0x16')][_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x4795f7['options'][_0x2586('0x1a')],function(_0x2d0332){return{'model':db[_0x2d0332[_0x2586('0x1c')]],'as':_0x2d0332['as'],'attributes':_0x2d0332[_0x2586('0x18')],'include':_0x2d0332[_0x2586('0x1a')]?_[_0x2586('0x1b')](_0x2d0332['include'],function(_0x4617da){return{'model':db[_0x4617da['model']],'as':_0x4617da['as'],'attributes':_0x4617da[_0x2586('0x18')],'include':_0x4617da[_0x2586('0x1a')]?_['map'](_0x4617da[_0x2586('0x1a')],function(_0x52270d){return{'model':db[_0x52270d['model']],'as':_0x52270d['as'],'attributes':_0x52270d[_0x2586('0x18')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x1d')](function(_0x599663){logger[_0x2586('0x11')](_0x2586('0x20'),_0x4795f7);logger[_0x2586('0xa')](_0x2586('0x20'),_0x4795f7,JSON[_0x2586('0xc')](_0x599663));_0x49b7b5(_0x599663);})[_0x2586('0x12')](function(_0x313b11){logger[_0x2586('0xd')](_0x2586('0x20'),_0x313b11[_0x2586('0x10')],_0x4795f7);_0x12e12c(_0x5b54a0[_0x2586('0xd')](0x1f4,_0x313b11[_0x2586('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 396cbf0..b32cdc8 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 _0x7479=['removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','isAuthenticated','describe','/:id','show','getAvatar','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','getTeams','/:id/lists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/square_projects','/create_many','bulkCreate','post','addContacts','addQueues','diskStorage','root','server/files/images/','format','%s-%s','now','/:id/avatar','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addMailAccounts','addSmsAccounts','/:id/chat_websites','addSquareProjects','put','update','changePassword','delete','/:id/teams','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7479,0x1df));var _0x9747=function(_0x17c623,_0x375df5){_0x17c623=_0x17c623-0x0;var _0x2f76e9=_0x7479[_0x17c623];return _0x2f76e9;};'use strict';var multer=require(_0x9747('0x0'));var util=require(_0x9747('0x1'));var path=require(_0x9747('0x2'));var express=require(_0x9747('0x3'));var router=express[_0x9747('0x4')]();var auth=require(_0x9747('0x5'));var interaction=require(_0x9747('0x6'));var config=require(_0x9747('0x7'));var controller=require(_0x9747('0x8'));router[_0x9747('0x9')]('/',auth['isAuthenticated'](),controller[_0x9747('0xa')]);router[_0x9747('0x9')]('/describe',auth[_0x9747('0xb')](),controller[_0x9747('0xc')]);router['get'](_0x9747('0xd'),auth[_0x9747('0xb')](),controller[_0x9747('0xe')]);router['get']('/:id/avatar',controller[_0x9747('0xf')]);router[_0x9747('0x9')](_0x9747('0x10'),auth[_0x9747('0xb')](),controller[_0x9747('0x11')]);router[_0x9747('0x9')](_0x9747('0x12'),auth[_0x9747('0xb')](),controller['getQueues']);router[_0x9747('0x9')](_0x9747('0x13'),auth[_0x9747('0xb')](),controller[_0x9747('0x14')]);router[_0x9747('0x9')](_0x9747('0x15'),auth['isAuthenticated'](),controller[_0x9747('0x16')]);router[_0x9747('0x9')](_0x9747('0x17'),auth[_0x9747('0xb')](),controller['getRecordings']);router['get'](_0x9747('0x18'),auth['isAuthenticated'](),controller[_0x9747('0x19')]);router['get']('/:id/openchannel/interactions',auth[_0x9747('0xb')](),controller[_0x9747('0x1a')]);router[_0x9747('0x9')](_0x9747('0x1b'),auth[_0x9747('0xb')](),controller['getMailInteractions']);router[_0x9747('0x9')](_0x9747('0x1c'),auth['isAuthenticated'](),controller[_0x9747('0x1d')]);router[_0x9747('0x9')]('/:id/fax/interactions',auth[_0x9747('0xb')](),controller[_0x9747('0x1e')]);router[_0x9747('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9747('0x1f')]);router[_0x9747('0x9')](_0x9747('0x20'),auth[_0x9747('0xb')](),controller['getLists']);router[_0x9747('0x9')]('/:id/agents',auth[_0x9747('0xb')](),controller[_0x9747('0x21')]);router[_0x9747('0x9')](_0x9747('0x22'),auth[_0x9747('0xb')](),controller[_0x9747('0x23')]);router[_0x9747('0x9')](_0x9747('0x24'),auth[_0x9747('0xb')](),controller['getFaxAccounts']);router[_0x9747('0x9')]('/:id/mail_accounts',auth[_0x9747('0xb')](),controller[_0x9747('0x25')]);router[_0x9747('0x9')](_0x9747('0x26'),auth[_0x9747('0xb')](),controller['getOpenchannelAccounts']);router[_0x9747('0x9')](_0x9747('0x27'),auth[_0x9747('0xb')](),controller[_0x9747('0x28')]);router[_0x9747('0x9')]('/:id/chat_websites',auth[_0x9747('0xb')](),controller[_0x9747('0x29')]);router[_0x9747('0x9')](_0x9747('0x2a'),auth[_0x9747('0xb')](),controller['getSquareProjects']);router['post'](_0x9747('0x2b'),auth[_0x9747('0xb')](),controller[_0x9747('0x2c')]);router[_0x9747('0x2d')](_0x9747('0x10'),auth[_0x9747('0xb')](),controller[_0x9747('0x2e')]);router[_0x9747('0x2d')]('/',auth[_0x9747('0xb')](),controller['create']);router[_0x9747('0x2d')](_0x9747('0x12'),auth[_0x9747('0xb')](),controller[_0x9747('0x2f')]);var upload=multer({'storage':multer[_0x9747('0x30')]({'destination':function(_0x2b877,_0x5f36f5,_0x300a46){_0x300a46(null,path['join'](config[_0x9747('0x31')],_0x9747('0x32')));},'filename':function(_0x4f6492,_0x295053,_0x12597a){_0x12597a(null,util[_0x9747('0x33')](_0x9747('0x34'),Date[_0x9747('0x35')](),_0x295053['originalname']));}})});router[_0x9747('0x2d')](_0x9747('0x36'),upload[_0x9747('0x37')](_0x9747('0x38')),controller[_0x9747('0x39')]);router['post'](_0x9747('0x3a'),auth['isAuthenticated'](),controller[_0x9747('0x3b')]);router[_0x9747('0x2d')](_0x9747('0x3c'),auth[_0x9747('0xb')](),controller[_0x9747('0x3d')]);router['post'](_0x9747('0x3e'),auth['isAuthenticated'](),controller['pause']);router[_0x9747('0x2d')](_0x9747('0x3f'),auth[_0x9747('0xb')](),controller['unpause']);router[_0x9747('0x2d')]('/:id/teams',auth[_0x9747('0xb')](),controller[_0x9747('0x40')]);router[_0x9747('0x2d')](_0x9747('0x41'),auth[_0x9747('0xb')](),controller[_0x9747('0x42')]);router[_0x9747('0x2d')](_0x9747('0x43'),auth[_0x9747('0xb')](),controller[_0x9747('0x44')]);router[_0x9747('0x2d')]('/:id/fax_interactions',auth[_0x9747('0xb')](),controller[_0x9747('0x45')]);router[_0x9747('0x2d')](_0x9747('0x46'),auth[_0x9747('0xb')](),controller[_0x9747('0x47')]);router['post']('/:id/openchannel_interactions',auth[_0x9747('0xb')](),controller['addOpenchannelInteractions']);router[_0x9747('0x2d')](_0x9747('0x24'),auth[_0x9747('0xb')](),controller['addFaxAccounts']);router[_0x9747('0x2d')]('/:id/mail_accounts',auth[_0x9747('0xb')](),controller[_0x9747('0x48')]);router[_0x9747('0x2d')](_0x9747('0x26'),auth['isAuthenticated'](),controller['addOpenchannelAccounts']);router[_0x9747('0x2d')](_0x9747('0x27'),auth[_0x9747('0xb')](),controller[_0x9747('0x49')]);router[_0x9747('0x2d')](_0x9747('0x4a'),auth[_0x9747('0xb')](),controller['addChatWebsites']);router[_0x9747('0x2d')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x9747('0x4b')]);router[_0x9747('0x4c')](_0x9747('0xd'),auth[_0x9747('0xb')](),controller[_0x9747('0x4d')]);router['put']('/:id/password',auth['isAuthenticated'](),controller[_0x9747('0x4e')]);router[_0x9747('0x4f')](_0x9747('0x12'),auth[_0x9747('0xb')](),controller['removeQueues']);router[_0x9747('0x4f')](_0x9747('0x50'),auth['isAuthenticated'](),controller[_0x9747('0x51')]);router[_0x9747('0x4f')]('/:id',auth[_0x9747('0xb')](),controller[_0x9747('0x52')]);router[_0x9747('0x4f')](_0x9747('0x41'),auth[_0x9747('0xb')](),controller[_0x9747('0x53')]);router[_0x9747('0x4f')](_0x9747('0x43'),auth[_0x9747('0xb')](),controller[_0x9747('0x54')]);router[_0x9747('0x4f')](_0x9747('0x55'),auth[_0x9747('0xb')](),controller['removeFaxInteractions']);router[_0x9747('0x4f')]('/:id/sms_interactions',auth[_0x9747('0xb')](),controller[_0x9747('0x56')]);router['delete']('/:id/openchannel_interactions',auth[_0x9747('0xb')](),controller[_0x9747('0x57')]);router['delete']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x9747('0x58')]);router[_0x9747('0x4f')](_0x9747('0x59'),auth['isAuthenticated'](),controller[_0x9747('0x5a')]);router['delete'](_0x9747('0x26'),auth[_0x9747('0xb')](),controller[_0x9747('0x5b')]);router[_0x9747('0x4f')](_0x9747('0x27'),auth[_0x9747('0xb')](),controller[_0x9747('0x5c')]);router[_0x9747('0x4f')](_0x9747('0x4a'),auth['isAuthenticated'](),controller[_0x9747('0x5d')]);router[_0x9747('0x4f')](_0x9747('0x2a'),auth[_0x9747('0xb')](),controller['removeSquareProjects']);module[_0x9747('0x5e')]=router; \ No newline at end of file +var _0x98e9=['login','/:id/logout','logout','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addSquareProjects','update','put','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/avatar','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','getSquareProjects','post','addContacts','/:id/queues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','file','addAvatar','/:id/login'];(function(_0x17e174,_0x4991f8){var _0x3f26f1=function(_0x169012){while(--_0x169012){_0x17e174['push'](_0x17e174['shift']());}};_0x3f26f1(++_0x4991f8);}(_0x98e9,0x14f));var _0x998e=function(_0x244808,_0x314eae){_0x244808=_0x244808-0x0;var _0x454f38=_0x98e9[_0x244808];return _0x454f38;};'use strict';var multer=require(_0x998e('0x0'));var util=require(_0x998e('0x1'));var path=require(_0x998e('0x2'));var express=require(_0x998e('0x3'));var router=express['Router']();var auth=require(_0x998e('0x4'));var interaction=require(_0x998e('0x5'));var config=require(_0x998e('0x6'));var controller=require('./user.controller');router[_0x998e('0x7')]('/',auth[_0x998e('0x8')](),controller['index']);router[_0x998e('0x7')]('/describe',auth[_0x998e('0x8')](),controller[_0x998e('0x9')]);router[_0x998e('0x7')](_0x998e('0xa'),auth[_0x998e('0x8')](),controller[_0x998e('0xb')]);router[_0x998e('0x7')](_0x998e('0xc'),controller['getAvatar']);router[_0x998e('0x7')](_0x998e('0xd'),auth[_0x998e('0x8')](),controller[_0x998e('0xe')]);router[_0x998e('0x7')]('/:id/queues',auth['isAuthenticated'](),controller[_0x998e('0xf')]);router['get'](_0x998e('0x10'),auth[_0x998e('0x8')](),controller[_0x998e('0x11')]);router[_0x998e('0x7')](_0x998e('0x12'),auth[_0x998e('0x8')](),controller[_0x998e('0x13')]);router[_0x998e('0x7')](_0x998e('0x14'),auth[_0x998e('0x8')](),controller[_0x998e('0x15')]);router[_0x998e('0x7')](_0x998e('0x16'),auth['isAuthenticated'](),controller[_0x998e('0x17')]);router[_0x998e('0x7')](_0x998e('0x18'),auth['isAuthenticated'](),controller[_0x998e('0x19')]);router[_0x998e('0x7')](_0x998e('0x1a'),auth[_0x998e('0x8')](),controller[_0x998e('0x1b')]);router[_0x998e('0x7')]('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0x998e('0x1c')]);router['get']('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x998e('0x1d')]);router[_0x998e('0x7')](_0x998e('0x1e'),auth[_0x998e('0x8')](),controller[_0x998e('0x1f')]);router[_0x998e('0x7')](_0x998e('0x20'),auth['isAuthenticated'](),controller[_0x998e('0x21')]);router[_0x998e('0x7')]('/:id/agents',auth[_0x998e('0x8')](),controller[_0x998e('0x22')]);router[_0x998e('0x7')](_0x998e('0x23'),auth[_0x998e('0x8')](),controller['getVoicePrefixes']);router[_0x998e('0x7')](_0x998e('0x24'),auth[_0x998e('0x8')](),controller[_0x998e('0x25')]);router[_0x998e('0x7')](_0x998e('0x26'),auth[_0x998e('0x8')](),controller[_0x998e('0x27')]);router[_0x998e('0x7')]('/:id/openchannel_accounts',auth[_0x998e('0x8')](),controller[_0x998e('0x28')]);router['get'](_0x998e('0x29'),auth['isAuthenticated'](),controller[_0x998e('0x2a')]);router['get'](_0x998e('0x2b'),auth['isAuthenticated'](),controller[_0x998e('0x2c')]);router[_0x998e('0x7')](_0x998e('0x2d'),auth[_0x998e('0x8')](),controller[_0x998e('0x2e')]);router[_0x998e('0x2f')]('/create_many',auth[_0x998e('0x8')](),controller['bulkCreate']);router[_0x998e('0x2f')](_0x998e('0xd'),auth[_0x998e('0x8')](),controller[_0x998e('0x30')]);router[_0x998e('0x2f')]('/',auth[_0x998e('0x8')](),controller['create']);router[_0x998e('0x2f')](_0x998e('0x31'),auth[_0x998e('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x998e('0x32')]({'destination':function(_0x64cb55,_0x367cfd,_0x3ace1d){_0x3ace1d(null,path[_0x998e('0x33')](config[_0x998e('0x34')],_0x998e('0x35')));},'filename':function(_0x57a54f,_0x439e3c,_0x17f417){_0x17f417(null,util[_0x998e('0x36')](_0x998e('0x37'),Date[_0x998e('0x38')](),_0x439e3c[_0x998e('0x39')]));}})});router[_0x998e('0x2f')](_0x998e('0xc'),upload['single'](_0x998e('0x3a')),controller[_0x998e('0x3b')]);router['post'](_0x998e('0x3c'),auth[_0x998e('0x8')](),controller[_0x998e('0x3d')]);router[_0x998e('0x2f')](_0x998e('0x3e'),auth['isAuthenticated'](),controller[_0x998e('0x3f')]);router[_0x998e('0x2f')]('/:id/pause',auth[_0x998e('0x8')](),controller[_0x998e('0x40')]);router[_0x998e('0x2f')](_0x998e('0x41'),auth['isAuthenticated'](),controller['unpause']);router[_0x998e('0x2f')](_0x998e('0x1e'),auth[_0x998e('0x8')](),controller[_0x998e('0x42')]);router[_0x998e('0x2f')](_0x998e('0x43'),auth[_0x998e('0x8')](),controller[_0x998e('0x44')]);router[_0x998e('0x2f')](_0x998e('0x45'),auth[_0x998e('0x8')](),controller[_0x998e('0x46')]);router[_0x998e('0x2f')](_0x998e('0x47'),auth[_0x998e('0x8')](),controller[_0x998e('0x48')]);router['post'](_0x998e('0x49'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0x998e('0x2f')](_0x998e('0x4a'),auth[_0x998e('0x8')](),controller[_0x998e('0x4b')]);router[_0x998e('0x2f')](_0x998e('0x24'),auth['isAuthenticated'](),controller[_0x998e('0x4c')]);router[_0x998e('0x2f')](_0x998e('0x26'),auth['isAuthenticated'](),controller[_0x998e('0x4d')]);router[_0x998e('0x2f')](_0x998e('0x4e'),auth[_0x998e('0x8')](),controller[_0x998e('0x4f')]);router['post'](_0x998e('0x29'),auth[_0x998e('0x8')](),controller[_0x998e('0x50')]);router[_0x998e('0x2f')]('/:id/chat_websites',auth[_0x998e('0x8')](),controller[_0x998e('0x51')]);router[_0x998e('0x2f')](_0x998e('0x2d'),auth['isAuthenticated'](),controller[_0x998e('0x52')]);router['put']('/:id',auth[_0x998e('0x8')](),controller[_0x998e('0x53')]);router[_0x998e('0x54')]('/:id/password',auth[_0x998e('0x8')](),controller[_0x998e('0x55')]);router[_0x998e('0x56')]('/:id/queues',auth[_0x998e('0x8')](),controller[_0x998e('0x57')]);router[_0x998e('0x56')]('/:id/teams',auth[_0x998e('0x8')](),controller[_0x998e('0x58')]);router[_0x998e('0x56')](_0x998e('0xa'),auth[_0x998e('0x8')](),controller['destroy']);router[_0x998e('0x56')](_0x998e('0x43'),auth[_0x998e('0x8')](),controller[_0x998e('0x59')]);router['delete']('/:id/mail_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5a')]);router[_0x998e('0x56')]('/:id/fax_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5b')]);router[_0x998e('0x56')]('/:id/sms_interactions',auth[_0x998e('0x8')](),controller[_0x998e('0x5c')]);router[_0x998e('0x56')](_0x998e('0x4a'),auth['isAuthenticated'](),controller[_0x998e('0x5d')]);router['delete']('/:id/fax_accounts',auth[_0x998e('0x8')](),controller[_0x998e('0x5e')]);router[_0x998e('0x56')](_0x998e('0x26'),auth[_0x998e('0x8')](),controller[_0x998e('0x5f')]);router[_0x998e('0x56')](_0x998e('0x4e'),auth[_0x998e('0x8')](),controller[_0x998e('0x60')]);router[_0x998e('0x56')](_0x998e('0x29'),auth[_0x998e('0x8')](),controller[_0x998e('0x61')]);router['delete'](_0x998e('0x2b'),auth[_0x998e('0x8')](),controller['removeChatWebsites']);router[_0x998e('0x56')]('/:id/square_projects',auth['isAuthenticated'](),controller['removeSquareProjects']);module[_0x998e('0x62')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 72b2547..61970bf 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 _0x3294=['isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','dtlsenable','/etc/pki/tls/private/motion.key','TEXT','permissions','map','sequelize','moment','exports','STRING','name','setDataValue','defaultuser','fullname','\x22%s\x22\x20<%s>','internal','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','callerid','format','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','info','shortinfo','inband','auto','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','yes','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','get'];(function(_0x5b34c2,_0x25a118){var _0x577f60=function(_0x46b2b7){while(--_0x46b2b7){_0x5b34c2['push'](_0x5b34c2['shift']());}};_0x577f60(++_0x25a118);}(_0x3294,0x100));var _0x4329=function(_0xbd6555,_0x7348dd){_0xbd6555=_0xbd6555-0x0;var _0x3f25cc=_0x3294[_0xbd6555];return _0x3f25cc;};'use strict';var Sequelize=require(_0x4329('0x0'));var moment=require(_0x4329('0x1'));var util=require('util');var _=require('lodash');module[_0x4329('0x2')]={'name':{'type':Sequelize[_0x4329('0x3')],'allowNull':![],'unique':_0x4329('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x5de108){this[_0x4329('0x5')](_0x4329('0x4'),_0x5de108);this[_0x4329('0x5')](_0x4329('0x6'),_0x5de108);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2d1b8a){this[_0x4329('0x5')](_0x4329('0x7'),_0x2d1b8a);this[_0x4329('0x5')]('callerid',util['format'](_0x4329('0x8'),_0x2d1b8a,this['getDataValue'](_0x4329('0x9'))));}},'alias':{'type':Sequelize[_0x4329('0x3')]},'email':{'type':Sequelize[_0x4329('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x57aa7b){if(_0x57aa7b){this[_0x4329('0x5')]('email',_0x57aa7b['toLowerCase']());}}},'role':{'type':Sequelize[_0x4329('0xa')](_0x4329('0xb'),_0x4329('0xc'),_0x4329('0xd'),_0x4329('0xe')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x4329('0x3')],'defaultValue':_0x4329('0xf')},'internal':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':![],'unique':_0x4329('0x9'),'set':function(_0x5228c5){this[_0x4329('0x5')](_0x4329('0x9'),_0x5228c5);this['setDataValue'](_0x4329('0x11'),_0x5228c5);this[_0x4329('0x5')](_0x4329('0x12'),util[_0x4329('0x13')]('\x22%s\x22\x20<%s>',this[_0x4329('0x14')](_0x4329('0x7')),_0x5228c5));}},'salt':{'type':Sequelize[_0x4329('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x4329('0x3')]},'address':{'type':Sequelize[_0x4329('0x3')]},'zipcode':{'type':Sequelize[_0x4329('0x3')]},'userpic':{'type':Sequelize[_0x4329('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4329('0x3')]},'online':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x4329('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x4329('0x3')],'defaultValue':_0x4329('0x17')},'lastPauseAt':{'type':Sequelize[_0x4329('0x16')]},'chatCapacity':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x4329('0x10')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize[_0x4329('0x10')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x4329('0x10')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x18'),_0x4329('0xc'),'peer'),'allowNull':!![],'defaultValue':_0x4329('0x18')},'context':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![],'defaultValue':_0x4329('0x19')},'callingpres':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x1a'),_0x4329('0x1b'),_0x4329('0x1c'),'ALLOWED','PROHIB_NOT_SCREENED',_0x4329('0x1d'),'PROHIB_FAILED_SCREEN',_0x4329('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x443367){this[_0x4329('0x5')](_0x4329('0x1f'),_0x443367?_0x443367[_0x4329('0x20')](','):null);},'get':function(){return this['getDataValue']('transport')?this[_0x4329('0x14')]('transport')[_0x4329('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833',_0x4329('0x22'),_0x4329('0x23'),_0x4329('0x24'),_0x4329('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x4329('0xa')]('yes','no',_0x4329('0x26'),_0x4329('0x27'),_0x4329('0x28')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![],'defaultValue':_0x4329('0x29'),'set':function(_0x309e0a){this[_0x4329('0x5')](_0x4329('0x2a'),_0x309e0a?_0x309e0a[_0x4329('0x20')](','):null);},'get':function(){return this[_0x4329('0x14')]('nat')?this[_0x4329('0x14')](_0x4329('0x2a'))[_0x4329('0x21')](','):null;},'comment':_0x4329('0x2b')},'callgroup':{'type':Sequelize[_0x4329('0x3')]},'namedcallgroup':{'type':Sequelize[_0x4329('0x3')]},'pickupgroup':{'type':Sequelize[_0x4329('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4329('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4329('0x3')]},'disallow':{'type':Sequelize[_0x4329('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0x4329('0x3')],'allowNull':![],'defaultValue':_0x4329('0x2c'),'set':function(_0x2b8ec9){this[_0x4329('0x5')](_0x4329('0x2d'),_0x2b8ec9?_0x2b8ec9[_0x4329('0x20')](';'):_0x4329('0x2c'));},'get':function(){return this[_0x4329('0x14')](_0x4329('0x2d'))?this[_0x4329('0x14')](_0x4329('0x2d'))[_0x4329('0x21')](';'):null;},'comment':_0x4329('0x2e')},'autoframing':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![],'set':function(_0x44e2e7){this[_0x4329('0x5')]('insecure',_0x44e2e7?_0x44e2e7['join'](','):null);},'get':function(){return this[_0x4329('0x14')](_0x4329('0x30'))?this['getDataValue'](_0x4329('0x30'))[_0x4329('0x21')](','):null;},'comment':_0x4329('0x31')},'trustrpid':{'type':Sequelize[_0x4329('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4329('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no',_0x4329('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x4329('0xa')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4329('0x33')},'amaflags':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x4329('0x2f')},'busylevel':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no',_0x4329('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x35'),_0x4329('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x37'),'uas'),'allowNull':!![],'defaultValue':_0x4329('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![],'defaultValue':_0x4329('0x2f')},'keepalive':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x4329('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4329('0xa')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no',_0x4329('0x39'),_0x4329('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x3b'),_0x4329('0x3c'),_0x4329('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x4329('0x10')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x4329('0xa')](_0x4329('0x2f'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x4329('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x4329('0xa')]('yes','no',_0x4329('0x26'),'update',_0x4329('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x4329('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x4329('0x16')]},'showWebBar':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0,'set':function(_0x1aa55b){this[_0x4329('0x5')]('showWebBar',_0x1aa55b);var _0x114399=this[_0x4329('0x3f')]({'plain':!![]});switch(_0x1aa55b){case 0x0:case 0x1:var _0x55a5d7=_0x114399['transport']?_[_0x4329('0x40')](_0x114399[_0x4329('0x1f')])?_0x114399[_0x4329('0x1f')][_0x4329('0x20')]():_0x114399[_0x4329('0x1f')]:_0x4329('0x41');if(_0x55a5d7===_0x4329('0x42')){_0x55a5d7='udp';}this[_0x4329('0x5')](_0x4329('0x1f'),_0x55a5d7);this[_0x4329('0x5')](_0x4329('0x43'),'no');this[_0x4329('0x5')](_0x4329('0x44'),null);this[_0x4329('0x5')](_0x4329('0x45'),null);this['setDataValue'](_0x4329('0x46'),null);this[_0x4329('0x5')]('dtlsenable',null);this[_0x4329('0x5')]('dtlsverify',null);this[_0x4329('0x5')](_0x4329('0x47'),null);this[_0x4329('0x5')](_0x4329('0x48'),null);this['setDataValue'](_0x4329('0x49'),null);this['setDataValue'](_0x4329('0x4a'),'no');break;case 0x2:this['setDataValue'](_0x4329('0x1f'),_0x4329('0x42'));this[_0x4329('0x5')](_0x4329('0x43'),_0x4329('0x2f'));this[_0x4329('0x5')]('avpf','yes');this[_0x4329('0x5')](_0x4329('0x45'),_0x4329('0x2f'));this[_0x4329('0x5')]('icesupport',_0x4329('0x2f'));this[_0x4329('0x5')](_0x4329('0x4b'),_0x4329('0x2f'));this['setDataValue']('dtlsverify','no');this[_0x4329('0x5')]('dtlssetup',_0x4329('0x3d'));this[_0x4329('0x5')](_0x4329('0x48'),_0x114399[_0x4329('0x48')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x4329('0x49'),_0x114399[_0x4329('0x49')]||_0x4329('0x4c'));this[_0x4329('0x5')](_0x4329('0x4a'),_0x4329('0x2f'));break;default:}}},'permissions':{'type':Sequelize[_0x4329('0x4d')],'set':function(_0x215b85){this[_0x4329('0x5')](_0x4329('0x4e'),_0x215b85?_0x215b85[_0x4329('0x20')](','):[]);},'get':function(){return this[_0x4329('0x14')](_0x4329('0x4e'))?_[_0x4329('0x4f')](this[_0x4329('0x14')](_0x4329('0x4e'))[_0x4329('0x21')](','),function(_0x4cf179){return parseInt(_0x4cf179,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x4329('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x4329('0x3')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x4329('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x4329('0x10')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x4329('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0x4329('0x2f'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x4329('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x4329('0x3')]},'passwordResetAt':{'type':Sequelize[_0x4329('0x16')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x4329('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0x54ad=['auto','nonat','outgoing','yes','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','active','actpass','update','showWebBar','get','isArray','wss','avpf','force_avp','icesupport','dtlssetup','dtlscertfile','dtlsenable','dtlsverify','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','callerid','getDataValue','internal','STRING','email','toLowerCase','user','agent','telephone','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','fullname','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','transport','join','split','rfc2833','shortinfo','inband'];(function(_0x4d22af,_0x2da329){var _0x1aa3f4=function(_0x58538c){while(--_0x58538c){_0x4d22af['push'](_0x4d22af['shift']());}};_0x1aa3f4(++_0x2da329);}(_0x54ad,0x11d));var _0xd54a=function(_0x1f6610,_0x37b34d){_0x1f6610=_0x1f6610-0x0;var _0x35af1d=_0x54ad[_0x1f6610];return _0x35af1d;};'use strict';var Sequelize=require(_0xd54a('0x0'));var moment=require(_0xd54a('0x1'));var util=require(_0xd54a('0x2'));var _=require(_0xd54a('0x3'));module[_0xd54a('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd54a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x2c8b62){this[_0xd54a('0x6')](_0xd54a('0x5'),_0x2c8b62);this[_0xd54a('0x6')](_0xd54a('0x7'),_0x2c8b62);},'comment':_0xd54a('0x8')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x511781){this[_0xd54a('0x6')]('fullname',_0x511781);this[_0xd54a('0x6')](_0xd54a('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x511781,this[_0xd54a('0xa')](_0xd54a('0xb'))));}},'alias':{'type':Sequelize[_0xd54a('0xc')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd54a('0xd'),'validate':{'isEmail':!![]},'set':function(_0x10d77c){if(_0x10d77c){this[_0xd54a('0x6')]('email',_0x10d77c[_0xd54a('0xe')]());}}},'role':{'type':Sequelize['ENUM']('admin',_0xd54a('0xf'),_0xd54a('0x10'),_0xd54a('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':_0xd54a('0x12')},'internal':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':![],'unique':_0xd54a('0xb'),'set':function(_0x3f3e85){this[_0xd54a('0x6')](_0xd54a('0xb'),_0x3f3e85);this[_0xd54a('0x6')](_0xd54a('0x14'),_0x3f3e85);this[_0xd54a('0x6')](_0xd54a('0x9'),util['format'](_0xd54a('0x15'),this['getDataValue'](_0xd54a('0x16')),_0x3f3e85));}},'salt':{'type':Sequelize[_0xd54a('0xc')]},'phone':{'type':Sequelize[_0xd54a('0xc')]},'mobile':{'type':Sequelize[_0xd54a('0xc')]},'address':{'type':Sequelize[_0xd54a('0xc')]},'zipcode':{'type':Sequelize[_0xd54a('0xc')]},'userpic':{'type':Sequelize[_0xd54a('0xc')]},'city':{'type':Sequelize[_0xd54a('0xc')]},'country':{'type':Sequelize[_0xd54a('0xc')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xd54a('0x17')]},'voicePause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0xd54a('0x19')},'lastPauseAt':{'type':Sequelize[_0xd54a('0x17')]},'chatCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xd54a('0x13')](0x5),'defaultValue':0x13c4},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x1a')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xd54a('0x1b')]('friend',_0xd54a('0xf'),_0xd54a('0x1c')),'allowNull':!![],'defaultValue':_0xd54a('0x1d')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xd54a('0x1e')},'callingpres':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x1f'),_0xd54a('0x20'),_0xd54a('0x21'),_0xd54a('0x22'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xd54a('0x23'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'secret':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x24'),'set':function(_0x177d56){this['setDataValue'](_0xd54a('0x25'),_0x177d56?_0x177d56[_0xd54a('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xd54a('0x25'))?this[_0xd54a('0xa')]('transport')[_0xd54a('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x28'),'info',_0xd54a('0x29'),_0xd54a('0x2a'),_0xd54a('0x2b')),'allowNull':!![],'defaultValue':_0xd54a('0x28')},'directmedia':{'type':Sequelize[_0xd54a('0x1b')]('yes','no',_0xd54a('0x2c'),'update',_0xd54a('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x2f'),'set':function(_0x2eb17b){this[_0xd54a('0x6')](_0xd54a('0x30'),_0x2eb17b?_0x2eb17b[_0xd54a('0x26')](','):null);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x30'))?this[_0xd54a('0xa')]('nat')[_0xd54a('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xd54a('0xc')]},'namedcallgroup':{'type':Sequelize[_0xd54a('0xc')]},'pickupgroup':{'type':Sequelize[_0xd54a('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xd54a('0xc')]},'language':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xd54a('0xc')],'allowNull':![],'defaultValue':_0xd54a('0x31'),'set':function(_0x2f16bc){this[_0xd54a('0x6')](_0xd54a('0x32'),_0x2f16bc?_0x2f16bc[_0xd54a('0x26')](';'):_0xd54a('0x31'));},'get':function(){return this[_0xd54a('0xa')]('allow')?this[_0xd54a('0xa')](_0xd54a('0x32'))['split'](';'):null;},'comment':_0xd54a('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'set':function(_0x45af93){this['setDataValue'](_0xd54a('0x34'),_0x45af93?_0x45af93['join'](','):null);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x34'))?this[_0xd54a('0xa')](_0xd54a('0x34'))[_0xd54a('0x27')](','):null;},'comment':_0xd54a('0x35')},'trustrpid':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd54a('0x1b')]('yes','no',_0xd54a('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![],'defaultValue':_0xd54a('0x37')},'amaflags':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xd54a('0x2e')},'busylevel':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no',_0xd54a('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xd54a('0x39'),_0xd54a('0x3a'),_0xd54a('0x3b')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x3c'),_0xd54a('0x3d')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':_0xd54a('0x2e')},'keepalive':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no','fingerprint','certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x3e'),'passive',_0xd54a('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xd54a('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xd54a('0x1b')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xd54a('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xd54a('0x2e'),'no',_0xd54a('0x2c'),_0xd54a('0x40'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xd54a('0xc')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'showWebBar':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0,'set':function(_0xd0f1c4){this[_0xd54a('0x6')](_0xd54a('0x41'),_0xd0f1c4);var _0x229e4e=this[_0xd54a('0x42')]({'plain':!![]});switch(_0xd0f1c4){case 0x0:case 0x1:var _0x3311b1=_0x229e4e['transport']?_[_0xd54a('0x43')](_0x229e4e['transport'])?_0x229e4e[_0xd54a('0x25')][_0xd54a('0x26')]():_0x229e4e[_0xd54a('0x25')]:_0xd54a('0x24');if(_0x3311b1===_0xd54a('0x44')){_0x3311b1=_0xd54a('0x24');}this['setDataValue'](_0xd54a('0x25'),_0x3311b1);this[_0xd54a('0x6')]('encryption','no');this['setDataValue'](_0xd54a('0x45'),null);this[_0xd54a('0x6')](_0xd54a('0x46'),null);this[_0xd54a('0x6')](_0xd54a('0x47'),null);this['setDataValue']('dtlsenable',null);this[_0xd54a('0x6')]('dtlsverify',null);this['setDataValue'](_0xd54a('0x48'),null);this[_0xd54a('0x6')](_0xd54a('0x49'),null);this[_0xd54a('0x6')]('dtlsprivatekey',null);this[_0xd54a('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xd54a('0x6')](_0xd54a('0x25'),'wss');this['setDataValue']('encryption',_0xd54a('0x2e'));this['setDataValue'](_0xd54a('0x45'),'yes');this['setDataValue'](_0xd54a('0x46'),_0xd54a('0x2e'));this[_0xd54a('0x6')](_0xd54a('0x47'),_0xd54a('0x2e'));this['setDataValue'](_0xd54a('0x4a'),_0xd54a('0x2e'));this[_0xd54a('0x6')](_0xd54a('0x4b'),'no');this[_0xd54a('0x6')](_0xd54a('0x48'),_0xd54a('0x3f'));this['setDataValue']('dtlscertfile',_0x229e4e[_0xd54a('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0xd54a('0x6')](_0xd54a('0x4c'),_0x229e4e[_0xd54a('0x4c')]||_0xd54a('0x4d'));this[_0xd54a('0x6')](_0xd54a('0x4e'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xd54a('0x4f')],'set':function(_0x4feebc){this[_0xd54a('0x6')](_0xd54a('0x50'),_0x4feebc?_0x4feebc[_0xd54a('0x26')](','):[]);},'get':function(){return this[_0xd54a('0xa')](_0xd54a('0x50'))?_[_0xd54a('0x51')](this[_0xd54a('0xa')]('permissions')[_0xd54a('0x27')](','),function(_0x242d0c){return parseInt(_0x242d0c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xd54a('0xc')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xd54a('0xc')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xd54a('0xc')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xd54a('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xd54a('0x1b')](_0xd54a('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xd54a('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'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 7a98f81..adbd5ca 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 _0xa09e=['filter','map','sequelize','lower','col','options','count','includeAll','include','findAll','rows','catch','show','salt','find','bulkCreate','body','describe','params','addContacts','ids','role','agent','agent\x20role','telephone','admin','user','../../config/license/util','getLicense','telephones','users','isNil','License\x20limit\x20reached','format','count\x20%s:\x20%s','create','Setting','findById','min_internal','max','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','VoiceMail','password','fullname','email','permissions','101','102','103','110','104','105','106','108','100','111','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','loginInPause','voicePause','isValidChannel','channel','Unknown\x20channel','capitalize','toLowerCase','Queues','penalty','voice','VoiceQueue','push','%s/%s','SIP','upsert','removeQueues','remove','UserVoiceQueueRt','destroy','addAvatar','userpic','filename','getAvatar','join','download','existsSync','root','server/files/images/','getContacts','findOne','UserId','CmContact','order','getQueues','Queue','Unknown\x20role','get','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','login','phone','mobile','interface','SIP/%s','user:%s','emit','user:forcelogout','headers','connection','remoteAddress','socket','each','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','all','LOGIN','PAUSE','LOGININPAUSE','logout','QueuePause','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','pauseType','lastPauseAt','manual','mail','chat','fax','sms','%s%s','Pause','getTeams','Team','omit','removeTeams','getLists','getAgents','Agents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','spread','removeChatInteractions','user_has_chat_interactions:remove','user_has_mail_interactions:save','isArray','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','addSquareProjects','removeSquareProjects','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','papaparse','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','./user.socket','register','jayson/promise','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','end','json','offset','limit','status','set','apply','save','update','stack','name','send','index','User','rawAttributes','model','differenceBy','keys','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','dateStart','add','day','merge','where'];(function(_0x593941,_0x54b080){var _0x292692=function(_0x9eaf6c){while(--_0x9eaf6c){_0x593941['push'](_0x593941['shift']());}};_0x292692(++_0x54b080);}(_0xa09e,0xd6));var _0xea09=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0xa09e[_0x3ff4a3];return _0x38676f;};'use strict';var jsonpatch=require(_0xea09('0x0'));var rp=require(_0xea09('0x1'));var moment=require('moment');var BPromise=require(_0xea09('0x2'));var Mustache=require(_0xea09('0x3'));var util=require(_0xea09('0x4'));var path=require('path');var sox=require(_0xea09('0x5'));var csv=require(_0xea09('0x6'));var ejs=require(_0xea09('0x7'));var fs=require('fs');var _=require(_0xea09('0x8'));var squel=require(_0xea09('0x9'));var crypto=require(_0xea09('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xea09('0xb'));var qs=require(_0xea09('0xc'));var logger=require(_0xea09('0xd'))('api');var utils=require(_0xea09('0xe'));var config=require(_0xea09('0xf'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0xea09('0x10'))[_0xea09('0x11')](socket);var jayson=require(_0xea09('0x12'));var client=jayson[_0xea09('0x13')][_0xea09('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x234f69,_0x40c822,_0x34357b,_0x32f4de){return new BPromise(function(_0x19910d,_0x430088){var _0x1aad97=_0x32f4de||client;return _0x1aad97[_0xea09('0x15')](_0x234f69,_0x34357b)[_0xea09('0x16')](function(_0x34be04){logger[_0xea09('0x17')](_0xea09('0x18'),_0x40c822,_0xea09('0x19'));logger[_0xea09('0x1a')](_0xea09('0x1b'),_0x40c822,_0xea09('0x19'),JSON[_0xea09('0x1c')](_0x34be04));if(_0x34be04[_0xea09('0x1d')]){if(_0x34be04[_0xea09('0x1d')][_0xea09('0x1e')]===0x1f4){logger[_0xea09('0x1d')](_0xea09('0x18'),_0x40c822,_0x34be04[_0xea09('0x1d')][_0xea09('0x1f')]);return _0x430088(_0x34be04[_0xea09('0x1d')][_0xea09('0x1f')]);}logger[_0xea09('0x1d')](_0xea09('0x18'),_0x40c822,_0x34be04['error'][_0xea09('0x1f')]);return _0x19910d(_0x34be04[_0xea09('0x1d')][_0xea09('0x1f')]);}else{logger[_0xea09('0x17')](_0xea09('0x18'),_0x40c822,_0xea09('0x19'));_0x19910d(_0x34be04[_0xea09('0x20')]['message']);}})['catch'](function(_0x4c5453){logger['error'](_0xea09('0x18'),_0x40c822,_0x4c5453);_0x430088(_0x4c5453);});});}function respondWithStatusCode(_0x2a6890,_0x376fce){_0x376fce=_0x376fce||0xcc;return function(_0x3300d4){if(_0x3300d4){return _0x2a6890[_0xea09('0x21')](_0x376fce);}return _0x2a6890['status'](_0x376fce)[_0xea09('0x22')]();};}function respondWithResult(_0x128a98,_0x5021a1){_0x5021a1=_0x5021a1||0xc8;return function(_0x190ba7){if(_0x190ba7){return _0x128a98['status'](_0x5021a1)[_0xea09('0x23')](_0x190ba7);}};}function respondWithFilteredResult(_0x4fbcdf,_0x185f24){return function(_0x5c0678){if(_0x5c0678){var _0x2a0238=_0x5c0678['count'],_0x340002=_0x185f24[_0xea09('0x24')],_0x5d15dd=_0x185f24['offset']+_0x185f24[_0xea09('0x25')],_0xfac91c;if(_0x5d15dd>=_0x2a0238){_0x5d15dd=_0x2a0238;_0xfac91c=0xc8;}else{_0xfac91c=0xce;}_0x4fbcdf[_0xea09('0x26')](_0xfac91c);return _0x4fbcdf[_0xea09('0x27')]('Content-Range',_0x340002+'-'+_0x5d15dd+'/'+_0x2a0238)[_0xea09('0x23')](_0x5c0678);}return null;};}function patchUpdates(_0x2f60e3){return function(_0x27bace){try{jsonpatch[_0xea09('0x28')](_0x27bace,_0x2f60e3,!![]);}catch(_0x55ed93){return BPromise['reject'](_0x55ed93);}return _0x27bace[_0xea09('0x29')]();};}function saveUpdates(_0x33c786,_0x2cea22){return function(_0x5f1d50){if(_0x5f1d50){return _0x5f1d50[_0xea09('0x2a')](_0x33c786)[_0xea09('0x16')](function(_0x75e900){return _0x75e900;});}return null;};}function removeEntity(_0x4d0753,_0x5e73e2){return function(_0x5de42c){if(_0x5de42c){return _0x5de42c['destroy']()['then'](function(){_0x4d0753[_0xea09('0x26')](0xcc)[_0xea09('0x22')]();});}};}function handleEntityNotFound(_0x319750,_0x51997a){return function(_0x400469){if(!_0x400469){_0x319750[_0xea09('0x21')](0x194);}return _0x400469;};}function handleError(_0x57dac4,_0x2a6645){_0x2a6645=_0x2a6645||0x1f4;return function(_0x2b7df7){logger[_0xea09('0x1d')](_0x2b7df7[_0xea09('0x2b')]);if(_0x2b7df7[_0xea09('0x2c')]){delete _0x2b7df7[_0xea09('0x2c')];}_0x57dac4[_0xea09('0x26')](_0x2a6645)[_0xea09('0x2d')](_0x2b7df7);};}exports[_0xea09('0x2e')]=function(_0x2548ee,_0x2de4f9){var _0x3a1b25={},_0x192d95={},_0x5a2841={'count':0x0,'rows':[]};var _0x38b907=db[_0xea09('0x2f')][_0xea09('0x30')];_0x192d95[_0xea09('0x31')]=_[_0xea09('0x32')](_[_0xea09('0x33')](_0x38b907),['password','salt']);var _0x592c10={'dateStart':_0x2548ee[_0xea09('0x34')]['dateStart'],'dateEnd':_0x2548ee[_0xea09('0x34')][_0xea09('0x35')]};delete _0x2548ee[_0xea09('0x34')]['dateStart'];delete _0x2548ee[_0xea09('0x34')][_0xea09('0x35')];_0x192d95[_0xea09('0x34')]=_[_0xea09('0x33')](_0x2548ee[_0xea09('0x34')]);_0x192d95[_0xea09('0x36')]=_[_0xea09('0x37')](_0x192d95[_0xea09('0x31')],_0x192d95[_0xea09('0x34')]);_0x3a1b25[_0xea09('0x38')]=_[_0xea09('0x37')](_0x192d95[_0xea09('0x31')],qs[_0xea09('0x39')](_0x2548ee[_0xea09('0x34')][_0xea09('0x39')]));_0x3a1b25[_0xea09('0x38')]=_0x3a1b25[_0xea09('0x38')][_0xea09('0x3a')]?_0x3a1b25[_0xea09('0x38')]:_0x192d95['model'];if(!_0x2548ee[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x3a1b25[_0xea09('0x25')]=qs['limit'](_0x2548ee['query'][_0xea09('0x25')]);_0x3a1b25[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x2548ee[_0xea09('0x34')]['offset']);}_0x3a1b25['order']=qs[_0xea09('0x3d')](_0x2548ee['query'][_0xea09('0x3d')]);_0x3a1b25['where']=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x2548ee['query'],_0x192d95[_0xea09('0x36')]));if(_0x592c10[_0xea09('0x3f')]){if(_0x592c10[_0xea09('0x35')]){_0x592c10[_0xea09('0x35')]=moment(_0x592c10[_0xea09('0x35')])[_0xea09('0x40')](0x1,_0xea09('0x41'));}else{_0x592c10[_0xea09('0x35')]=moment(_0x592c10[_0xea09('0x3f')])[_0xea09('0x40')](0x1,_0xea09('0x41'));}_[_0xea09('0x42')](_0x3a1b25[_0xea09('0x43')],{'createdAt':{'$gte':_0x592c10[_0xea09('0x3f')],'$lte':_0x592c10[_0xea09('0x35')]}});}if(_0x2548ee[_0xea09('0x34')][_0xea09('0x44')]){_0x3a1b25[_0xea09('0x43')]=_['merge'](_0x3a1b25[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x3a1b25[_0xea09('0x38')],function(_0x5b6677){return db['sequelize'][_0xea09('0x43')](db[_0xea09('0x46')]['fn'](_0xea09('0x47'),db[_0xea09('0x46')][_0xea09('0x48')](_0x5b6677)),{'$like':db[_0xea09('0x46')]['fn'](_0xea09('0x47'),'%'+_0x2548ee[_0xea09('0x34')][_0xea09('0x44')]+'%')});})});}_0x3a1b25=_[_0xea09('0x42')]({},_0x3a1b25,_0x2548ee[_0xea09('0x49')]);var _0x36c2dd={'where':_0x3a1b25[_0xea09('0x43')]};return db[_0xea09('0x2f')][_0xea09('0x4a')](_0x36c2dd)[_0xea09('0x16')](function(_0x59334f){_0x5a2841[_0xea09('0x4a')]=_0x59334f;if(_0x2548ee[_0xea09('0x34')][_0xea09('0x4b')]){_0x3a1b25[_0xea09('0x4c')]=[{'all':!![]}];}return db[_0xea09('0x2f')][_0xea09('0x4d')](_0x3a1b25);})[_0xea09('0x16')](function(_0x2d2013){_0x5a2841[_0xea09('0x4e')]=_0x2d2013;return _0x5a2841;})['then'](respondWithFilteredResult(_0x2de4f9,_0x3a1b25))[_0xea09('0x4f')](handleError(_0x2de4f9,null));};exports[_0xea09('0x50')]=function(_0x101fde,_0x1d46be){var _0x352ec4={'raw':![],'where':{'id':_0x101fde['params']['id']}},_0x483c49={};_0x483c49[_0xea09('0x31')]=_['differenceBy'](_[_0xea09('0x33')](db[_0xea09('0x2f')][_0xea09('0x30')]),['password',_0xea09('0x51')]);_0x483c49[_0xea09('0x34')]=_['keys'](_0x101fde[_0xea09('0x34')]);_0x483c49[_0xea09('0x36')]=_[_0xea09('0x37')](_0x483c49[_0xea09('0x31')],_0x483c49[_0xea09('0x34')]);_0x352ec4[_0xea09('0x38')]=_[_0xea09('0x37')](_0x483c49[_0xea09('0x31')],qs[_0xea09('0x39')](_0x101fde[_0xea09('0x34')][_0xea09('0x39')]));_0x352ec4[_0xea09('0x38')]=_0x352ec4[_0xea09('0x38')][_0xea09('0x3a')]?_0x352ec4[_0xea09('0x38')]:_0x483c49[_0xea09('0x31')];if(_0x101fde[_0xea09('0x34')][_0xea09('0x4b')]){_0x352ec4['include']=[{'all':!![]}];}_0x352ec4=_[_0xea09('0x42')]({},_0x352ec4,_0x101fde['options']);return db[_0xea09('0x2f')][_0xea09('0x52')](_0x352ec4)[_0xea09('0x16')](handleEntityNotFound(_0x1d46be,null))[_0xea09('0x16')](respondWithResult(_0x1d46be,null))[_0xea09('0x4f')](handleError(_0x1d46be,null));};exports[_0xea09('0x53')]=function(_0x351fb1,_0x500467){return db[_0xea09('0x2f')][_0xea09('0x53')](_0x351fb1[_0xea09('0x54')],{'raw':![],'individualHooks':!![]})[_0xea09('0x16')](respondWithResult(_0x500467,0xc9))[_0xea09('0x4f')](handleError(_0x500467,null));};exports[_0xea09('0x2a')]=function(_0x4842e7,_0x5896b3){if(_0x4842e7['body']['id']){delete _0x4842e7[_0xea09('0x54')]['id'];}return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x4842e7['params']['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x5896b3,null))[_0xea09('0x16')](saveUpdates(_0x4842e7[_0xea09('0x54')],null))[_0xea09('0x16')](respondWithResult(_0x5896b3,null))[_0xea09('0x4f')](handleError(_0x5896b3,null));};exports[_0xea09('0x55')]=function(_0x47f058,_0x29a623){return db[_0xea09('0x2f')][_0xea09('0x55')]()['then'](respondWithResult(_0x29a623,null))['catch'](handleError(_0x29a623,null));};exports['addContacts']=function(_0x54665a,_0x537aee,_0x5cd21a){return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x54665a[_0xea09('0x56')]['id']}})['then'](handleEntityNotFound(_0x537aee,null))[_0xea09('0x16')](function(_0x100866){if(_0x100866){return _0x100866[_0xea09('0x57')](_0x54665a['body']['ids'],_['omit'](_0x54665a[_0xea09('0x54')],[_0xea09('0x58'),'id'])||{});}})[_0xea09('0x16')](respondWithResult(_0x537aee,null))['catch'](handleError(_0x537aee,null));};var getLicense=function(_0x44cc7d){return new BPromise(function(_0x4967f4,_0xba5e8c){var _0x38ea41=0x0;_0x44cc7d[_0xea09('0x54')][_0xea09('0x59')]===_0xea09('0x5a')&&_0x4967f4(_0xea09('0x5b'));return db['User'][_0xea09('0x4a')]({'where':{'$or':[{'role':_0x44cc7d['body'][_0xea09('0x59')]==='telephone'?_0xea09('0x5c'):[_0xea09('0x5d'),_0xea09('0x5e')]}]}})[_0xea09('0x16')](function(_0x5963c3){_0x38ea41=_0x5963c3;return require(_0xea09('0x5f'))[_0xea09('0x60')]();})[_0xea09('0x16')](function(_0x4952df){var _0x4b6cf1=_0x44cc7d['body']['role']==='telephone'?_0xea09('0x61'):_0xea09('0x62');if(!_[_0xea09('0x63')](_0x4952df[_0x4b6cf1])&&_0x38ea41>=_0x4952df[_0x4b6cf1]){return _0xba5e8c({'message':_0xea09('0x64')});}return _0x4967f4(util[_0xea09('0x65')](_0xea09('0x66'),_0x4b6cf1,_0x38ea41));})[_0xea09('0x4f')](function(_0x2a5df8){return _0xba5e8c(_0x2a5df8);});});};exports[_0xea09('0x67')]=function(_0x125f43,_0x54552b){return getLicense(_0x125f43)[_0xea09('0x16')](function(_0x3d0a38){if(!_0x125f43['body']['internal']){var _0x58814b;return db[_0xea09('0x68')][_0xea09('0x69')](0x1)[_0xea09('0x16')](function(_0x10f307){_0x58814b=_0x10f307[_0xea09('0x6a')];return db['User'][_0xea09('0x6b')]('internal');})[_0xea09('0x16')](function(_0xcc7467){if(_['isNil'](_0xcc7467)){if(_0x58814b){_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=_0x58814b;}else{_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=0x1;}}else{if(_['isNil'](_0x58814b)||_0x58814b==_0xcc7467){_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=_0xcc7467+0x1;}else if(_0x58814b>_0xcc7467){_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=_0x58814b;}else{return db[_0xea09('0x46')]['query'](_0xea09('0x6d'),{'type':db[_0xea09('0x46')][_0xea09('0x6e')][_0xea09('0x6f')]})[_0xea09('0x16')](function(_0x112b36){if(_0x112b36&&_0x112b36['length']){for(var _0x225837=0x0,_0x5699b4=_0x112b36[_0xea09('0x3a')];_0x225837<_0x5699b4&&_[_0xea09('0x63')](_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]);_0x225837++){if(_0x58814b<=_0x112b36[_0x225837][_0xea09('0x70')]){_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=_0x112b36[_0x225837][_0xea09('0x70')];}else if(_0x58814b>_0x112b36[_0x225837][_0xea09('0x70')]&&_0x58814b<=_0x112b36[_0x225837]['to']){_0x125f43[_0xea09('0x54')][_0xea09('0x6c')]=_0x58814b;}}}if(_[_0xea09('0x63')](_0x125f43['body'][_0xea09('0x6c')])){_0x125f43['body']['internal']=_0xcc7467+0x1;}});}}});}})[_0xea09('0x16')](function(){if(_0x125f43['body'][_0xea09('0x71')]){_0x125f43[_0xea09('0x54')][_0xea09('0x72')]=_0x125f43[_0xea09('0x54')][_0xea09('0x6c')];_0x125f43[_0xea09('0x54')][_0xea09('0x73')]={'mailbox':_0x125f43[_0xea09('0x54')][_0xea09('0x6c')],'password':_0x125f43['body'][_0xea09('0x74')],'fullname':_0x125f43['body'][_0xea09('0x75')],'email':_0x125f43[_0xea09('0x54')][_0xea09('0x76')]};}if(_0x125f43['body']&&_0x125f43[_0xea09('0x54')]['role']==='agent'){_0x125f43[_0xea09('0x54')][_0xea09('0x77')]=[_0xea09('0x78'),_0xea09('0x79'),_0xea09('0x7a'),_0xea09('0x7b'),_0xea09('0x7c'),_0xea09('0x7d'),_0xea09('0x7e'),'107',_0xea09('0x7f'),'109',_0xea09('0x80'),_0xea09('0x81')];}return db[_0xea09('0x2f')][_0xea09('0x67')](_0x125f43[_0xea09('0x54')],{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0xea09('0x16')](respondWithResult(_0x54552b,0xc9))[_0xea09('0x4f')](handleError(_0x54552b,null));};exports[_0xea09('0x82')]=function(_0x500184,_0x429efe,_0x41838f){if(_0x500184[_0xea09('0x54')]['id']){delete _0x500184['body']['id'];}return db[_0xea09('0x2f')]['find']({'where':{'id':_0x500184[_0xea09('0x56')]['id']}})[_0xea09('0x16')](function(_0x45af4b){if(_0x45af4b){if(_0x45af4b['id']==_0x500184[_0xea09('0x5e')]['id']){if(!_0x500184[_0xea09('0x54')][_0xea09('0x83')]||!_0x500184[_0xea09('0x54')][_0xea09('0x84')]){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))]('Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword');}if(!_0x45af4b['authenticate'](_0x500184[_0xea09('0x54')]['oldPassword'])){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))](_0xea09('0x87'));}if(_0x500184[_0xea09('0x54')]['oldPassword']==_0x500184[_0xea09('0x54')][_0xea09('0x84')]){throw new db['Sequelize'][(_0xea09('0x86'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x45af4b;}else if(_0x500184[_0xea09('0x5e')][_0xea09('0x59')]=='admin'){if(!_0x500184[_0xea09('0x54')][_0xea09('0x84')]){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))](_0xea09('0x88'));}return _0x45af4b;}else if(_0x500184[_0xea09('0x5e')][_0xea09('0x59')]==_0xea09('0x5e')){if(!_0x500184[_0xea09('0x54')]['newPassword']){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x45af4b[_0xea09('0x59')]!=_0xea09('0x5a')){throw new db['Sequelize']['ValidationError'](_0xea09('0x89'));}return _0x45af4b;}else{throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))](_0xea09('0x89'));}}return null;})[_0xea09('0x16')](handleEntityNotFound(_0x429efe,null))[_0xea09('0x16')](saveUpdates({'password':_0x500184['body'][_0xea09('0x84')],'passwordResetAt':_0x500184[_0xea09('0x5e')]['id']==_0x500184[_0xea09('0x56')]['id']?moment():null},null))[_0xea09('0x16')](respondWithResult(_0x429efe,null))[_0xea09('0x4f')](handleError(_0x429efe,null));};exports[_0xea09('0x8a')]=function(_0x622f5a,_0x34ad94,_0x63755f){var _0x21d795;return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x622f5a[_0xea09('0x56')]['id']},'attributes':['id','name','role',_0xea09('0x8b'),_0xea09('0x8c')]})['then'](handleEntityNotFound(_0x34ad94,null))[_0xea09('0x16')](function(_0x7003b9){if(_0x7003b9){_0x21d795=_0x7003b9;if(!utils[_0xea09('0x8d')](_0x622f5a['body'][_0xea09('0x8e')])){throw new db[(_0xea09('0x85'))]['ValidationError'](_0xea09('0x8f'));}return _0x7003b9[_0xea09('0x40')+_[_0xea09('0x90')](_0x622f5a[_0xea09('0x54')]['channel'][_0xea09('0x91')]())+_0xea09('0x92')](_0x622f5a[_0xea09('0x54')]['ids'],{'penalty':_0x622f5a['body'][_0xea09('0x93')]||0x0});}})['then'](function(){if(_0x622f5a[_0xea09('0x54')]['channel']===_0xea09('0x94')){return db[_0xea09('0x95')]['findAll']({'where':{'id':_0x622f5a[_0xea09('0x54')][_0xea09('0x58')]||[]},'raw':!![],'attributes':['id',_0xea09('0x2c')]});}})[_0xea09('0x16')](function(_0x27c597){var _0x2c4878=[];if(_0x622f5a[_0xea09('0x54')][_0xea09('0x8e')]===_0xea09('0x94')&&_0x21d795[_0xea09('0x59')]===_0xea09('0x5a')){for(var _0x713d35=0x0;_0x713d35<_0x27c597['length'];_0x713d35+=0x1){_0x2c4878[_0xea09('0x96')]({'membername':_0x21d795['name'],'UserId':_0x21d795['id'],'queue_name':_0x27c597[_0x713d35]['name'],'VoiceQueueId':_0x27c597[_0x713d35]['id'],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x21d795[_0xea09('0x2c')]),'paused':_0x21d795['voicePause']||![],'penalty':_0x622f5a[_0xea09('0x54')][_0xea09('0x93')]||0x0});}return BPromise['each'](_0x2c4878,function(_0x50c757){return db['UserVoiceQueueRt'][_0xea09('0x99')](_0x50c757);});}return _0x21d795;})[_0xea09('0x16')](respondWithStatusCode(_0x34ad94,null))[_0xea09('0x4f')](handleError(_0x34ad94,null));};exports[_0xea09('0x9a')]=function(_0x251ec2,_0xa9a5f7,_0x39554c){var _0x266ae8;return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x251ec2[_0xea09('0x56')]['id']},'attributes':['id',_0xea09('0x2c'),_0xea09('0x59')]})[_0xea09('0x16')](handleEntityNotFound(_0xa9a5f7,null))[_0xea09('0x16')](function(_0xdbf465){if(_0xdbf465){_0x266ae8=_0xdbf465;if(!_0x251ec2[_0xea09('0x34')]['channel']||!utils[_0xea09('0x8d')](_0x251ec2[_0xea09('0x34')]['channel'])){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))]('Unknown\x20channel');}return _0xdbf465[_0xea09('0x9b')+_[_0xea09('0x90')](_0x251ec2[_0xea09('0x34')]['channel'][_0xea09('0x91')]())+_0xea09('0x92')](_0x251ec2[_0xea09('0x34')][_0xea09('0x58')]);}})[_0xea09('0x16')](function(_0x5cf8ca){if(_0x251ec2[_0xea09('0x34')]['channel']===_0xea09('0x94')){return db[_0xea09('0x9c')][_0xea09('0x9d')]({'where':{'UserId':_0x251ec2[_0xea09('0x56')]['id'],'VoiceQueueId':_0x251ec2[_0xea09('0x34')][_0xea09('0x58')]},'individualHooks':!![]})['then'](function(){return _0x266ae8;});}return _0x266ae8;})[_0xea09('0x16')](respondWithStatusCode(_0xa9a5f7,null))[_0xea09('0x4f')](handleError(_0xa9a5f7,null));};exports[_0xea09('0x9e')]=function(_0x12ef17,_0x3d7ece,_0x2ce08b){_0x12ef17['body'][_0xea09('0x9f')]=_0x12ef17['file'][_0xea09('0xa0')];return db['User'][_0xea09('0x52')]({'where':{'id':_0x12ef17[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x3d7ece,null))[_0xea09('0x16')](saveUpdates(_0x12ef17[_0xea09('0x54')],null))[_0xea09('0x16')](respondWithResult(_0x3d7ece,null))['catch'](handleError(_0x3d7ece,null));};exports[_0xea09('0xa1')]=function(_0x500472,_0xea8ca8,_0x566991){var _0x524411=path[_0xea09('0xa2')](config['root'],'server/files/images/logos/default_profile.png');return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x500472[_0xea09('0x56')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0xea09('0x16')](handleEntityNotFound(_0xea8ca8,null))['then'](function(_0x5887ab){if(_0x5887ab){if(_[_0xea09('0x63')](_0x5887ab[_0xea09('0x9f')])){return _0xea8ca8[_0xea09('0xa3')](_0x524411);}else{if(!fs[_0xea09('0xa4')](path[_0xea09('0xa2')](config[_0xea09('0xa5')],'server/files/images/',_0x5887ab['userpic']))){return _0xea8ca8[_0xea09('0xa3')](_0x524411);}return _0xea8ca8['download'](path['join'](config['root'],_0xea09('0xa6'),_0x5887ab[_0xea09('0x9f')]));}}})['catch'](handleError(_0xea8ca8,null));};exports[_0xea09('0xa7')]=function(_0x5d893b,_0x34ed97,_0x5b8e10){var _0x24d5b3;var _0xf70090={'where':{}},_0x386092={},_0x3dd1d3={'count':0x0,'rows':[]};return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x5d893b[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x34ed97,null))[_0xea09('0x16')](function(_0x2ba597){if(_0x2ba597){_0x24d5b3=_0x2ba597;_0xf70090[_0xea09('0x43')][_0xea09('0xa9')]=_0x2ba597['id'];return db[_0xea09('0xaa')][_0xea09('0x55')]();}})[_0xea09('0x16')](function(_0x24eeb0){if(_0x24eeb0){_0x386092[_0xea09('0x31')]=_[_0xea09('0x33')](_0x24eeb0);_0x386092[_0xea09('0x34')]=_[_0xea09('0x33')](_0x5d893b[_0xea09('0x34')]);_0x386092[_0xea09('0x36')]=_[_0xea09('0x37')](_0x386092[_0xea09('0x31')],_0x386092[_0xea09('0x34')]);_0xf70090[_0xea09('0x38')]=_[_0xea09('0x37')](_0x386092[_0xea09('0x31')],qs[_0xea09('0x39')](_0x5d893b[_0xea09('0x34')]['fields']));_0xf70090[_0xea09('0x38')]=_0xf70090['attributes'][_0xea09('0x3a')]?_0xf70090['attributes']:_0x386092['model'];if(!_0x5d893b['query'][_0xea09('0x3b')](_0xea09('0x3c'))){_0xf70090[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x5d893b[_0xea09('0x34')][_0xea09('0x25')]);_0xf70090[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x5d893b[_0xea09('0x34')]['offset']);}_0xf70090[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x5d893b['query']['sort']);_0xf70090['where']=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x5d893b[_0xea09('0x34')],_0x386092[_0xea09('0x36')]));if(_0x5d893b[_0xea09('0x34')][_0xea09('0x44')]){_0xf70090[_0xea09('0x43')]=_[_0xea09('0x42')](_0xf70090[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0xf70090[_0xea09('0x38')],function(_0x5a4d04){var _0x4faaf7={};_0x4faaf7[_0x5a4d04]={'$like':'%'+_0x5d893b[_0xea09('0x34')]['filter']+'%'};return _0x4faaf7;})});}_0xf70090=_[_0xea09('0x42')]({},_0xf70090,_0x5d893b['options']);return _0x24d5b3[_0xea09('0xa7')](_[_0xea09('0x3e')](_0xf70090,[_0xea09('0x43')]))[_0xea09('0x16')](function(_0x26890b){_0x3dd1d3['count']=_0x26890b[_0xea09('0x3a')]||0x0;if(_0x5d893b[_0xea09('0x34')][_0xea09('0x4b')]){_0xf70090['include']=[{'all':!![]}];}return _0x24d5b3['getContacts'](_0xf70090);})['then'](function(_0x3477bb){_0x3dd1d3[_0xea09('0x4e')]=_0x3477bb;return _0x3dd1d3;});}})[_0xea09('0x16')](respondWithFilteredResult(_0x34ed97,_0xf70090))[_0xea09('0x4f')](handleError(_0x34ed97,null));};exports[_0xea09('0xac')]=function(_0x46032d,_0x3532b6,_0x2e8e4e){var _0x3817c4;var _0x420c80;var _0x1da1ab={};var _0x508299;return db['User'][_0xea09('0xa8')]({'where':{'id':_0x46032d[_0xea09('0x56')]['id']},'attributes':['id','name',_0xea09('0x59')]})[_0xea09('0x16')](handleEntityNotFound(_0x3532b6,null))[_0xea09('0x16')](function(_0xc195d4){if(!utils[_0xea09('0x8d')](_0x46032d[_0xea09('0x34')][_0xea09('0x8e')])){throw new db[(_0xea09('0x85'))][(_0xea09('0x86'))](_0xea09('0x8f'));}_0x3817c4=_0xc195d4;var _0x1f7cb4={};_0x1f7cb4[_0xea09('0x31')]=_[_0xea09('0x33')](db[_[_0xea09('0x90')](_0x46032d[_0xea09('0x34')][_0xea09('0x8e')])+_0xea09('0xad')]['rawAttributes']);_0x1f7cb4[_0xea09('0x34')]=_['keys'](_0x46032d[_0xea09('0x34')]);_0x1f7cb4[_0xea09('0x36')]=_['intersection'](_0x1f7cb4[_0xea09('0x31')],_0x1f7cb4[_0xea09('0x34')]);_0x1da1ab[_0xea09('0x38')]=_[_0xea09('0x37')](_0x1f7cb4[_0xea09('0x31')],qs[_0xea09('0x39')](_0x46032d[_0xea09('0x34')][_0xea09('0x39')]));_0x1da1ab[_0xea09('0x38')]=_0x1da1ab['attributes'][_0xea09('0x3a')]?_0x1da1ab[_0xea09('0x38')]:_0x1f7cb4[_0xea09('0x31')];_0x1da1ab[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x46032d[_0xea09('0x34')][_0xea09('0x3d')]);_0x1da1ab[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x46032d[_0xea09('0x34')],_0x1f7cb4[_0xea09('0x36')]));if(_0x46032d[_0xea09('0x34')][_0xea09('0x44')]){_0x1da1ab[_0xea09('0x43')]=_[_0xea09('0x42')](_0x1da1ab[_0xea09('0x43')],{'$or':_['map'](_0x1da1ab[_0xea09('0x38')],function(_0x149b1a){var _0x430e74={};_0x430e74[_0x149b1a]={'$like':'%'+_0x46032d[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x430e74;})});}_0x1da1ab=_['merge']({},_0x1da1ab,_0x46032d[_0xea09('0x49')]);switch(_0x3817c4[_0xea09('0x59')]){case'admin':return db[_['capitalize'](_0x46032d['query']['channel'])+_0xea09('0xad')]['findAll'](_0x1da1ab);case'user':case _0xea09('0x5a'):return _0x3817c4['get'+_[_0xea09('0x90')](_0x46032d[_0xea09('0x34')][_0xea09('0x8e')])+'Queues'](_0x1da1ab);default:throw new db[(_0xea09('0x85'))]['ValidationError'](_0xea09('0xae'));}})[_0xea09('0x16')](function(_0x4618c9){_0x508299=_0x4618c9['length'];if(!_0x46032d[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x1da1ab[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x46032d[_0xea09('0x34')][_0xea09('0x25')]);_0x1da1ab[_0xea09('0x24')]=qs['offset'](_0x46032d[_0xea09('0x34')][_0xea09('0x24')]);}switch(_0x3817c4[_0xea09('0x59')]){case _0xea09('0x5d'):return db[_[_0xea09('0x90')](_0x46032d['query'][_0xea09('0x8e')])+'Queue'][_0xea09('0x4d')](_0x1da1ab);case _0xea09('0x5e'):case _0xea09('0x5a'):return _0x3817c4[_0xea09('0xaf')+_[_0xea09('0x90')](_0x46032d[_0xea09('0x34')][_0xea09('0x8e')])+_0xea09('0x92')](_0x1da1ab);}})[_0xea09('0x16')](function(_0x468df6){return{'count':_0x508299,'rows':_0x468df6};})[_0xea09('0x16')](respondWithResult(_0x3532b6,null))[_0xea09('0x4f')](handleError(_0x3532b6,null));};exports[_0xea09('0xb0')]=function(_0x5da826,_0x3cb20a,_0x15a28d){var _0x2f6376={};var _0x4a7a86={};var _0x3c5cce;var _0x112d33;return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x5da826[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x3cb20a,null))[_0xea09('0x16')](function(_0x14bea2){if(_0x14bea2){_0x3c5cce=_0x14bea2;_0x4a7a86['model']=_[_0xea09('0x33')](db[_0xea09('0x9c')][_0xea09('0x30')]);_0x4a7a86[_0xea09('0x34')]=_[_0xea09('0x33')](_0x5da826[_0xea09('0x34')]);_0x4a7a86[_0xea09('0x36')]=_['intersection'](_0x4a7a86[_0xea09('0x31')],_0x4a7a86[_0xea09('0x34')]);_0x2f6376[_0xea09('0x38')]=_[_0xea09('0x37')](_0x4a7a86[_0xea09('0x31')],qs[_0xea09('0x39')](_0x5da826[_0xea09('0x34')][_0xea09('0x39')]));_0x2f6376[_0xea09('0x38')]=_0x2f6376[_0xea09('0x38')][_0xea09('0x3a')]?_0x2f6376['attributes']:_0x4a7a86[_0xea09('0x31')];_0x2f6376['order']=qs[_0xea09('0x3d')](_0x5da826[_0xea09('0x34')]['sort']);_0x2f6376[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x5da826[_0xea09('0x34')],_0x4a7a86[_0xea09('0x36')]));if(_0x5da826['query']['filter']){_0x2f6376['where']=_[_0xea09('0x42')](_0x2f6376[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x2f6376[_0xea09('0x38')],function(_0x3805a9){var _0x154fc5={};_0x154fc5[_0x3805a9]={'$like':'%'+_0x5da826['query'][_0xea09('0x44')]+'%'};return _0x154fc5;})});}_0x2f6376=_[_0xea09('0x42')]({},_0x2f6376,_0x5da826[_0xea09('0x49')]);return _0x3c5cce[_0xea09('0xb0')](_0x2f6376);}})[_0xea09('0x16')](function(_0x1a1f80){if(_0x1a1f80){_0x112d33=_0x1a1f80[_0xea09('0x3a')];if(!_0x5da826[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x2f6376[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x5da826['query']['limit']);_0x2f6376[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x5da826['query'][_0xea09('0x24')]);}return _0x3c5cce['getVoiceQueuesRt'](_0x2f6376);}})[_0xea09('0x16')](function(_0x164b10){if(_0x164b10){return _0x164b10?{'count':_0x112d33,'rows':_0x164b10}:null;}})['then'](respondWithResult(_0x3cb20a,null))[_0xea09('0x4f')](handleError(_0x3cb20a,null));};exports[_0xea09('0xb1')]=function(_0x182f1c,_0x59ee5c,_0x5b5128){var _0x5372e8={};var _0x162d32={};var _0x2dea0e;var _0x1debb6;return db[_0xea09('0x2f')]['findOne']({'where':{'id':_0x182f1c['params']['id']}})['then'](handleEntityNotFound(_0x59ee5c,null))[_0xea09('0x16')](function(_0x289e7f){if(_0x289e7f){_0x2dea0e=_0x289e7f;_0x162d32[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xb2')][_0xea09('0x30')]);_0x162d32[_0xea09('0x34')]=_[_0xea09('0x33')](_0x182f1c[_0xea09('0x34')]);_0x162d32[_0xea09('0x36')]=_[_0xea09('0x37')](_0x162d32[_0xea09('0x31')],_0x162d32[_0xea09('0x34')]);_0x5372e8[_0xea09('0x38')]=_[_0xea09('0x37')](_0x162d32[_0xea09('0x31')],qs['fields'](_0x182f1c['query'][_0xea09('0x39')]));_0x5372e8['attributes']=_0x5372e8['attributes'][_0xea09('0x3a')]?_0x5372e8[_0xea09('0x38')]:_0x162d32['model'];_0x5372e8[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x182f1c[_0xea09('0x34')][_0xea09('0x3d')]);_0x5372e8[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x182f1c[_0xea09('0x34')],_0x162d32[_0xea09('0x36')]));if(_0x182f1c[_0xea09('0x34')][_0xea09('0x44')]){_0x5372e8[_0xea09('0x43')]=_[_0xea09('0x42')](_0x5372e8[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x5372e8[_0xea09('0x38')],function(_0x43a3d6){var _0x13a893={};_0x13a893[_0x43a3d6]={'$like':'%'+_0x182f1c[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x13a893;})});}_0x5372e8=_[_0xea09('0x42')]({},_0x5372e8,_0x182f1c[_0xea09('0x49')]);return _0x2dea0e[_0xea09('0xb1')](_0x5372e8);}})[_0xea09('0x16')](function(_0x53ae9f){if(_0x53ae9f){_0x1debb6=_0x53ae9f['length'];if(!_0x182f1c[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x5372e8[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x182f1c[_0xea09('0x34')][_0xea09('0x25')]);_0x5372e8['offset']=qs[_0xea09('0x24')](_0x182f1c[_0xea09('0x34')][_0xea09('0x24')]);}return _0x2dea0e[_0xea09('0xb1')](_0x5372e8);}})['then'](function(_0x11a8c9){if(_0x11a8c9){return _0x11a8c9?{'count':_0x1debb6,'rows':_0x11a8c9}:null;}})[_0xea09('0x16')](respondWithResult(_0x59ee5c,null))['catch'](handleError(_0x59ee5c,null));};exports[_0xea09('0xb3')]=function(_0xf625ba,_0x5360b7,_0x52785b){var _0x57e654={'raw':!![],'where':{}};var _0x49818c={};var _0x2d2752={'count':0x0,'rows':[]};return db[_0xea09('0x2f')]['findOne']({'where':{'id':_0xf625ba[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x5360b7,null))[_0xea09('0x16')](function(_0x4a9330){if(_0x4a9330){_0x49818c[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xb4')]['rawAttributes']);_0x49818c[_0xea09('0x34')]=_[_0xea09('0x33')](_0xf625ba[_0xea09('0x34')]);_0x49818c['filters']=_[_0xea09('0x37')](_0x49818c[_0xea09('0x31')],_0x49818c[_0xea09('0x34')]);_0x57e654['attributes']=_['intersection'](_0x49818c['model'],qs['fields'](_0xf625ba[_0xea09('0x34')]['fields']));_0x57e654[_0xea09('0x38')]=_0x57e654['attributes'][_0xea09('0x3a')]?_0x57e654[_0xea09('0x38')]:_0x49818c[_0xea09('0x31')];if(!_0xf625ba[_0xea09('0x34')]['hasOwnProperty'](_0xea09('0x3c'))){_0x57e654[_0xea09('0x25')]=qs[_0xea09('0x25')](_0xf625ba[_0xea09('0x34')][_0xea09('0x25')]);_0x57e654[_0xea09('0x24')]=qs['offset'](_0xf625ba['query']['offset']);}_0x57e654[_0xea09('0xab')]=qs['sort'](_0xf625ba[_0xea09('0x34')][_0xea09('0x3d')]);_0x57e654[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0xf625ba[_0xea09('0x34')],_0x49818c[_0xea09('0x36')]));_0x57e654[_0xea09('0x43')][_0xea09('0xa9')]=_0x4a9330['id'];if(_0xf625ba[_0xea09('0x34')][_0xea09('0x44')]){_0x57e654[_0xea09('0x43')]=_['merge'](_0x57e654[_0xea09('0x43')],{'$or':_['map'](_0x57e654['attributes'],function(_0x16aa0e){var _0x51fcc0={};_0x51fcc0[_0x16aa0e]={'$like':'%'+_0xf625ba['query'][_0xea09('0x44')]+'%'};return _0x51fcc0;})});}_0x57e654=_[_0xea09('0x42')]({},_0x57e654,_0xf625ba[_0xea09('0x49')]);return db['VoiceRecording'][_0xea09('0x4a')]({'where':_0x57e654[_0xea09('0x43')]})[_0xea09('0x16')](function(_0x3b5dbc){_0x2d2752[_0xea09('0x4a')]=_0x3b5dbc;if(_0xf625ba[_0xea09('0x34')][_0xea09('0x4b')]){_0x57e654[_0xea09('0x4c')]=[{'all':!![]}];}return db[_0xea09('0xb4')][_0xea09('0x4d')](_0x57e654);})[_0xea09('0x16')](function(_0x2b8030){_0x2d2752[_0xea09('0x4e')]=_0x2b8030;return _0x2d2752;});}})['then'](respondWithFilteredResult(_0x5360b7,_0x57e654))[_0xea09('0x4f')](handleError(_0x5360b7,null));};exports[_0xea09('0xb5')]=function(_0x42bbab,_0x1d488e,_0x4885c5){var _0x44e685={};var _0x354a25={};var _0x3195a3;var _0x2bda0c;return db['User']['findOne']({'where':{'id':_0x42bbab['params']['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x1d488e,null))[_0xea09('0x16')](function(_0x24397e){if(_0x24397e){_0x3195a3=_0x24397e;_0x354a25[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xb6')][_0xea09('0x30')]);_0x354a25[_0xea09('0x34')]=_[_0xea09('0x33')](_0x42bbab[_0xea09('0x34')]);_0x354a25[_0xea09('0x36')]=_[_0xea09('0x37')](_0x354a25[_0xea09('0x31')],_0x354a25[_0xea09('0x34')]);_0x44e685[_0xea09('0x38')]=_[_0xea09('0x37')](_0x354a25[_0xea09('0x31')],qs[_0xea09('0x39')](_0x42bbab[_0xea09('0x34')][_0xea09('0x39')]));_0x44e685['attributes']=_0x44e685['attributes'][_0xea09('0x3a')]?_0x44e685[_0xea09('0x38')]:_0x354a25[_0xea09('0x31')];_0x44e685[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x42bbab['query']['sort']);_0x44e685[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x42bbab[_0xea09('0x34')],_0x354a25[_0xea09('0x36')]));if(_0x42bbab[_0xea09('0x34')][_0xea09('0x44')]){_0x44e685[_0xea09('0x43')]=_[_0xea09('0x42')](_0x44e685['where'],{'$or':_[_0xea09('0x45')](_0x44e685[_0xea09('0x38')],function(_0x1c2547){var _0x5e47bb={};_0x5e47bb[_0x1c2547]={'$like':'%'+_0x42bbab[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x5e47bb;})});}_0x44e685=_[_0xea09('0x42')]({},_0x44e685,_0x42bbab[_0xea09('0x49')]);return _0x3195a3[_0xea09('0xb5')](_0x44e685);}})[_0xea09('0x16')](function(_0x7e100e){if(_0x7e100e){_0x2bda0c=_0x7e100e[_0xea09('0x3a')];if(!_0x42bbab[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x44e685[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x42bbab[_0xea09('0x34')]['limit']);_0x44e685[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x42bbab[_0xea09('0x34')][_0xea09('0x24')]);}return _0x3195a3[_0xea09('0xb5')](_0x44e685);}})[_0xea09('0x16')](function(_0x590dc2){if(_0x590dc2){return _0x590dc2?{'count':_0x2bda0c,'rows':_0x590dc2}:null;}})[_0xea09('0x16')](respondWithResult(_0x1d488e,null))[_0xea09('0x4f')](handleError(_0x1d488e,null));};exports['getOpenchannelInteractions']=function(_0x5c09bc,_0x10d607,_0x4f1f0d){var _0x545d2a={};var _0x1516e0={};var _0x57eb01;var _0x4fdf6f;return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x5c09bc['params']['id']}})['then'](handleEntityNotFound(_0x10d607,null))[_0xea09('0x16')](function(_0x498ac4){if(_0x498ac4){_0x57eb01=_0x498ac4;_0x1516e0[_0xea09('0x31')]=_['keys'](db[_0xea09('0xb7')]['rawAttributes']);_0x1516e0[_0xea09('0x34')]=_['keys'](_0x5c09bc[_0xea09('0x34')]);_0x1516e0[_0xea09('0x36')]=_[_0xea09('0x37')](_0x1516e0[_0xea09('0x31')],_0x1516e0[_0xea09('0x34')]);_0x545d2a[_0xea09('0x38')]=_[_0xea09('0x37')](_0x1516e0[_0xea09('0x31')],qs['fields'](_0x5c09bc[_0xea09('0x34')]['fields']));_0x545d2a['attributes']=_0x545d2a[_0xea09('0x38')]['length']?_0x545d2a[_0xea09('0x38')]:_0x1516e0[_0xea09('0x31')];_0x545d2a[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x5c09bc[_0xea09('0x34')][_0xea09('0x3d')]);_0x545d2a[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x5c09bc['query'],_0x1516e0[_0xea09('0x36')]));if(_0x5c09bc[_0xea09('0x34')][_0xea09('0x44')]){_0x545d2a[_0xea09('0x43')]=_[_0xea09('0x42')](_0x545d2a[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x545d2a[_0xea09('0x38')],function(_0x764934){var _0x3dbf1b={};_0x3dbf1b[_0x764934]={'$like':'%'+_0x5c09bc['query']['filter']+'%'};return _0x3dbf1b;})});}_0x545d2a=_['merge']({},_0x545d2a,_0x5c09bc[_0xea09('0x49')]);return _0x57eb01[_0xea09('0xb8')](_0x545d2a);}})[_0xea09('0x16')](function(_0x202153){if(_0x202153){_0x4fdf6f=_0x202153['length'];if(!_0x5c09bc[_0xea09('0x34')]['hasOwnProperty'](_0xea09('0x3c'))){_0x545d2a[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x5c09bc[_0xea09('0x34')][_0xea09('0x25')]);_0x545d2a[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x5c09bc[_0xea09('0x34')][_0xea09('0x24')]);}return _0x57eb01[_0xea09('0xb8')](_0x545d2a);}})[_0xea09('0x16')](function(_0x14bdae){if(_0x14bdae){return _0x14bdae?{'count':_0x4fdf6f,'rows':_0x14bdae}:null;}})['then'](respondWithResult(_0x10d607,null))[_0xea09('0x4f')](handleError(_0x10d607,null));};exports[_0xea09('0xb9')]=function(_0x4d4e44,_0x136840,_0x20c58e){var _0x4dee91={'raw':!![],'where':{}};var _0x7740c1={};var _0x3d9285={'count':0x0,'rows':[]};return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x4d4e44[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x136840,null))[_0xea09('0x16')](function(_0x9f1532){if(_0x9f1532){_0x7740c1[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xba')][_0xea09('0x30')]);_0x7740c1['query']=_[_0xea09('0x33')](_0x4d4e44[_0xea09('0x34')]);_0x7740c1[_0xea09('0x36')]=_[_0xea09('0x37')](_0x7740c1[_0xea09('0x31')],_0x7740c1[_0xea09('0x34')]);_0x4dee91[_0xea09('0x38')]=_[_0xea09('0x37')](_0x7740c1[_0xea09('0x31')],qs['fields'](_0x4d4e44[_0xea09('0x34')][_0xea09('0x39')]));_0x4dee91[_0xea09('0x38')]=_0x4dee91[_0xea09('0x38')][_0xea09('0x3a')]?_0x4dee91[_0xea09('0x38')]:_0x7740c1[_0xea09('0x31')];if(!_0x4d4e44[_0xea09('0x34')]['hasOwnProperty'](_0xea09('0x3c'))){_0x4dee91['limit']=qs[_0xea09('0x25')](_0x4d4e44[_0xea09('0x34')]['limit']);_0x4dee91[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x4d4e44[_0xea09('0x34')]['offset']);}_0x4dee91[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x4d4e44[_0xea09('0x34')]['sort']);_0x4dee91[_0xea09('0x43')]=qs[_0xea09('0x36')](_['pick'](_0x4d4e44[_0xea09('0x34')],_0x7740c1[_0xea09('0x36')]));_0x4dee91[_0xea09('0x43')][_0xea09('0xa9')]=_0x9f1532['id'];if(_0x4d4e44['query']['filter']){_0x4dee91[_0xea09('0x43')]=_[_0xea09('0x42')](_0x4dee91[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x4dee91[_0xea09('0x38')],function(_0x2e7934){var _0x3d509e={};_0x3d509e[_0x2e7934]={'$like':'%'+_0x4d4e44['query'][_0xea09('0x44')]+'%'};return _0x3d509e;})});}_0x4dee91=_[_0xea09('0x42')]({},_0x4dee91,_0x4d4e44['options']);return db[_0xea09('0xba')][_0xea09('0x4a')]({'where':_0x4dee91[_0xea09('0x43')]})['then'](function(_0x2da00e){_0x3d9285[_0xea09('0x4a')]=_0x2da00e;if(_0x4d4e44[_0xea09('0x34')]['includeAll']){_0x4dee91[_0xea09('0x4c')]=[{'all':!![]}];}return db[_0xea09('0xba')][_0xea09('0x4d')](_0x4dee91);})[_0xea09('0x16')](function(_0x31eedd){_0x3d9285[_0xea09('0x4e')]=_0x31eedd;return _0x3d9285;});}})[_0xea09('0x16')](respondWithFilteredResult(_0x136840,_0x4dee91))[_0xea09('0x4f')](handleError(_0x136840,null));};exports['getSmsInteractions']=function(_0x5d6a10,_0xb10be9,_0x265a32){var _0x47633c={};var _0x2ab259={};var _0xf1b2a5;var _0xae8e22;return db['User'][_0xea09('0xa8')]({'where':{'id':_0x5d6a10[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0xb10be9,null))[_0xea09('0x16')](function(_0x2b69a4){if(_0x2b69a4){_0xf1b2a5=_0x2b69a4;_0x2ab259[_0xea09('0x31')]=_['keys'](db[_0xea09('0xbb')][_0xea09('0x30')]);_0x2ab259['query']=_[_0xea09('0x33')](_0x5d6a10['query']);_0x2ab259['filters']=_['intersection'](_0x2ab259[_0xea09('0x31')],_0x2ab259[_0xea09('0x34')]);_0x47633c[_0xea09('0x38')]=_[_0xea09('0x37')](_0x2ab259[_0xea09('0x31')],qs[_0xea09('0x39')](_0x5d6a10[_0xea09('0x34')][_0xea09('0x39')]));_0x47633c[_0xea09('0x38')]=_0x47633c['attributes'][_0xea09('0x3a')]?_0x47633c[_0xea09('0x38')]:_0x2ab259[_0xea09('0x31')];_0x47633c[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x5d6a10[_0xea09('0x34')][_0xea09('0x3d')]);_0x47633c[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x5d6a10[_0xea09('0x34')],_0x2ab259[_0xea09('0x36')]));if(_0x5d6a10[_0xea09('0x34')][_0xea09('0x44')]){_0x47633c[_0xea09('0x43')]=_[_0xea09('0x42')](_0x47633c[_0xea09('0x43')],{'$or':_[_0xea09('0x45')](_0x47633c['attributes'],function(_0x3c127b){var _0x560c84={};_0x560c84[_0x3c127b]={'$like':'%'+_0x5d6a10[_0xea09('0x34')]['filter']+'%'};return _0x560c84;})});}_0x47633c=_[_0xea09('0x42')]({},_0x47633c,_0x5d6a10['options']);return _0xf1b2a5[_0xea09('0xbc')](_0x47633c);}})[_0xea09('0x16')](function(_0x319327){if(_0x319327){_0xae8e22=_0x319327[_0xea09('0x3a')];if(!_0x5d6a10['query'][_0xea09('0x3b')]('nolimit')){_0x47633c[_0xea09('0x25')]=qs['limit'](_0x5d6a10[_0xea09('0x34')][_0xea09('0x25')]);_0x47633c[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x5d6a10[_0xea09('0x34')][_0xea09('0x24')]);}return _0xf1b2a5[_0xea09('0xbc')](_0x47633c);}})[_0xea09('0x16')](function(_0x137d34){if(_0x137d34){return _0x137d34?{'count':_0xae8e22,'rows':_0x137d34}:null;}})[_0xea09('0x16')](respondWithResult(_0xb10be9,null))[_0xea09('0x4f')](handleError(_0xb10be9,null));};exports['getFaxInteractions']=function(_0x5cbd96,_0x18d26f,_0x46aba9){var _0x1b8814={};var _0x544b24={};var _0x5201e9;var _0x4aa1e4;return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x5cbd96[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x18d26f,null))[_0xea09('0x16')](function(_0x3ea46e){if(_0x3ea46e){_0x5201e9=_0x3ea46e;_0x544b24[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xbd')][_0xea09('0x30')]);_0x544b24[_0xea09('0x34')]=_[_0xea09('0x33')](_0x5cbd96[_0xea09('0x34')]);_0x544b24[_0xea09('0x36')]=_[_0xea09('0x37')](_0x544b24['model'],_0x544b24[_0xea09('0x34')]);_0x1b8814[_0xea09('0x38')]=_[_0xea09('0x37')](_0x544b24[_0xea09('0x31')],qs[_0xea09('0x39')](_0x5cbd96['query'][_0xea09('0x39')]));_0x1b8814['attributes']=_0x1b8814['attributes']['length']?_0x1b8814[_0xea09('0x38')]:_0x544b24[_0xea09('0x31')];_0x1b8814[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x5cbd96['query'][_0xea09('0x3d')]);_0x1b8814[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x5cbd96[_0xea09('0x34')],_0x544b24[_0xea09('0x36')]));if(_0x5cbd96[_0xea09('0x34')][_0xea09('0x44')]){_0x1b8814[_0xea09('0x43')]=_[_0xea09('0x42')](_0x1b8814[_0xea09('0x43')],{'$or':_['map'](_0x1b8814[_0xea09('0x38')],function(_0x30d119){var _0x1a799c={};_0x1a799c[_0x30d119]={'$like':'%'+_0x5cbd96[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x1a799c;})});}_0x1b8814=_['merge']({},_0x1b8814,_0x5cbd96[_0xea09('0x49')]);return _0x5201e9['getFaxInteractions'](_0x1b8814);}})[_0xea09('0x16')](function(_0x281342){if(_0x281342){_0x4aa1e4=_0x281342['length'];if(!_0x5cbd96[_0xea09('0x34')][_0xea09('0x3b')](_0xea09('0x3c'))){_0x1b8814[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x5cbd96[_0xea09('0x34')][_0xea09('0x25')]);_0x1b8814[_0xea09('0x24')]=qs['offset'](_0x5cbd96[_0xea09('0x34')]['offset']);}return _0x5201e9[_0xea09('0xbe')](_0x1b8814);}})['then'](function(_0x21666b){if(_0x21666b){return _0x21666b?{'count':_0x4aa1e4,'rows':_0x21666b}:null;}})[_0xea09('0x16')](respondWithResult(_0x18d26f,null))['catch'](handleError(_0x18d26f,null));};exports[_0xea09('0xbf')]=function(_0x1ce3b2,_0x113497,_0x54f531){var _0x4b2e0e;var _0x493d23;var _0x92fb5b;return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x1ce3b2[_0xea09('0x56')]['id'],'role':_0xea09('0x5a')},'attributes':['id',_0xea09('0x2c'),_0xea09('0xc0'),_0xea09('0xc1'),_0xea09('0x59'),_0xea09('0x6c'),_0xea09('0x8b')]})[_0xea09('0x16')](handleEntityNotFound(_0x113497,null))[_0xea09('0x16')](function(_0x2061d0){if(_0x2061d0){_0x4b2e0e=_0x2061d0;_0x92fb5b=_0x1ce3b2[_0xea09('0x54')][_0xea09('0xc2')]&&_0x4b2e0e[_0x1ce3b2[_0xea09('0x54')][_0xea09('0xc2')]]?util[_0xea09('0x65')]('LOCAL/%s@from-sip/n',_0x4b2e0e[_0x1ce3b2[_0xea09('0x54')][_0xea09('0xc2')]]):util[_0xea09('0x65')](_0xea09('0xc3'),_0x4b2e0e[_0xea09('0x2c')]);socket['to'](util['format'](_0xea09('0xc4'),_0x4b2e0e['name']))[_0xea09('0xc5')](_0xea09('0xc6'),{'ip':_0x1ce3b2[_0xea09('0xc7')]['x-forwarded-for']||_0x1ce3b2[_0xea09('0xc8')][_0xea09('0xc9')]||_0x1ce3b2[_0xea09('0xca')][_0xea09('0xc9')]||_0x1ce3b2[_0xea09('0xc8')][_0xea09('0xca')]['remoteAddress']});return db['UserVoiceQueueRt'][_0xea09('0x9d')]({'where':{'membername':_0x4b2e0e['name']},'individualHooks':!![]});}})[_0xea09('0x16')](function(_0x4afb7b){if(_0x4b2e0e){return _0x4b2e0e['getVoiceQueues']({'raw':!![]});}})[_0xea09('0x16')](function(_0x5794f5){var _0x3bdd3a=[];if(_0x5794f5){_0x493d23=_0x5794f5;if(_0x493d23['length']){for(var _0x1ea34a=0x0;_0x1ea34a<_0x493d23['length'];_0x1ea34a++){_0x3bdd3a['push']({'membername':_0x4b2e0e[_0xea09('0x2c')],'UserId':_0x4b2e0e['id'],'queue_name':_0x493d23[_0x1ea34a][_0xea09('0x2c')],'VoiceQueueId':_0x493d23[_0x1ea34a]['id'],'interface':_0x92fb5b||util['format'](_0xea09('0x97'),_0xea09('0x98'),_0x4b2e0e[_0xea09('0x2c')]),'paused':_0x4b2e0e[_0xea09('0x8b')]||![],'penalty':_0x493d23[_0x1ea34a]['UserVoiceQueue.penalty']||0x0});}return BPromise[_0xea09('0xcb')](_0x3bdd3a,function(_0x4785c){return db[_0xea09('0x9c')][_0xea09('0x99')](_0x4785c);});}}})['then'](function(){return db[_0xea09('0xcc')][_0xea09('0x4d')]({'where':{'membername':_0x4b2e0e[_0xea09('0x2c')],'interface':util[_0xea09('0x65')](_0xea09('0x97'),'SIP',_0x4b2e0e[_0xea09('0x2c')]),'exitAt':null}});})[_0xea09('0x16')](function(_0x50d29d){var _0x13efb6=[];_0x50d29d[_0xea09('0xcd')](function(_0x3983ec){_0x13efb6['push'](_0x3983ec[_0xea09('0x2a')]({'exitAt':moment()[_0xea09('0x65')](_0xea09('0xce'))}));});return BPromise[_0xea09('0xcf')](_0x13efb6);})['then'](function(){var _0x4f8b50=[];var _0x247f47=[];var _0x3c6b1e=utils['getChannels']();var _0x244228={'membername':_0x4b2e0e[_0xea09('0x2c')],'interface':util['format'](_0xea09('0x97'),'SIP',_0x4b2e0e[_0xea09('0x2c')]),'enterAt':moment()['format'](_0xea09('0xce')),'role':_0x4b2e0e['role'],'internal':_0x4b2e0e['internal']};_0x3c6b1e[_0xea09('0xcd')](function(_0x2fc362){_0x4f8b50[_0xea09('0x96')](_[_0xea09('0x42')]({'channel':_0x2fc362,'type':_0xea09('0xd0'),'data1':_0x1ce3b2[_0xea09('0x54')]['device'],'data2':_0x92fb5b},_0x244228));if(_0x4b2e0e['loginInPause']){_0x247f47[_0xea09('0x96')](_[_0xea09('0x42')]({'channel':_0x2fc362,'type':_0xea09('0xd1'),'data1':_0xea09('0xd2')},_0x244228));}});return db[_0xea09('0xcc')][_0xea09('0x53')](_0x4f8b50['concat'](_0x247f47),{'individualHooks':!![]});})['then'](function(){return _0x4b2e0e['update']({'online':!![],'lastLoginAt':moment()[_0xea09('0x65')](_0xea09('0xce')),'voicePause':_0x4b2e0e[_0xea09('0x8b')]||![],'mailPause':_0x4b2e0e['loginInPause']||![],'chatPause':_0x4b2e0e[_0xea09('0x8b')]||![],'faxPause':_0x4b2e0e['loginInPause']||![],'smsPause':_0x4b2e0e[_0xea09('0x8b')]||![],'openchannelPause':_0x4b2e0e[_0xea09('0x8b')]||![],'pauseType':_0x4b2e0e[_0xea09('0x8b')]?_0xea09('0xd2'):null,'lastPauseAt':moment()[_0xea09('0x65')](_0xea09('0xce'))});})[_0xea09('0x16')](respondWithResult(_0x113497,null))['catch'](handleError(_0x113497,null));};exports[_0xea09('0xd3')]=function(_0x10a705,_0x1c6914,_0x59aae7){var _0x15de4d;return db['User']['find']({'where':{'id':_0x10a705[_0xea09('0x56')]['id'],'role':'agent'},'attributes':['id',_0xea09('0x2c'),'role']})[_0xea09('0x16')](handleEntityNotFound(_0x1c6914,null))[_0xea09('0x16')](function(_0x3b4006){if(_0x3b4006){_0x15de4d=_0x3b4006;return db['UserVoiceQueueRt'][_0xea09('0x9d')]({'where':{'membername':_0x15de4d['name']},'individualHooks':!![]});}})[_0xea09('0x16')](function(){return db[_0xea09('0xcc')][_0xea09('0x4d')]({'where':{'membername':_0x15de4d[_0xea09('0x2c')],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x15de4d[_0xea09('0x2c')]),'exitAt':null}});})[_0xea09('0x16')](function(_0xf706d0){var _0x28f052=[];_0xf706d0['forEach'](function(_0x944357){_0x28f052['push'](_0x944357['update']({'exitAt':moment()[_0xea09('0x65')](_0xea09('0xce'))}));});return BPromise[_0xea09('0xcf')](_0x28f052);})[_0xea09('0x16')](function(){return _0x15de4d[_0xea09('0x2a')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})[_0xea09('0x16')](respondWithResult(_0x1c6914,null))['catch'](handleError(_0x1c6914,null));};exports['pause']=function(_0x4f9847,_0x41f337,_0x48590c){var _0x4f95d8;return db['UserVoiceQueueRt'][_0xea09('0x2a')]({'paused':0x1},{'where':{'UserId':_0x4f9847[_0xea09('0x56')]['id']},'individualHooks':!![]})[_0xea09('0x16')](function(){return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x4f9847[_0xea09('0x56')]['id'],'role':_0xea09('0x5a')},'attributes':['id',_0xea09('0x2c'),_0xea09('0x59'),_0xea09('0x6c')]});})['then'](handleEntityNotFound(_0x41f337,null))['then'](function(_0x516180){if(_0x516180){_0x4f95d8=_0x516180;return respondWithRpcPromise(_0xea09('0xd4'),_0xea09('0xd5'),{'id':_0x4f95d8['id'],'name':_0x4f95d8[_0xea09('0x2c')],'pause':!![]});}})[_0xea09('0x16')](function(){if(_0x4f95d8){return db[_0xea09('0xcc')][_0xea09('0x4d')]({'where':{'membername':_0x4f95d8['name'],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x4f95d8['name']),'type':_0xea09('0xd1'),'exitAt':null}});}})[_0xea09('0x16')](function(_0x56aee2){if(_0x56aee2['length']){var _0x341eca=moment()[_0xea09('0x65')](_0xea09('0xce'));for(var _0x4a3b32=0x0,_0x44b4dc=_0x56aee2[_0xea09('0x3a')];_0x4a3b32<_0x44b4dc;_0x4a3b32++){_0x56aee2[_0x4a3b32][_0xea09('0xd6')]({'exitAt':_0x341eca});}}})['then'](function(){var _0x388d9f=[];var _0x1f818c=utils['getChannels']();_0x1f818c[_0xea09('0xcd')](function(_0x490853){_0x388d9f['push']({'channel':_0x490853,'membername':_0x4f95d8[_0xea09('0x2c')],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x4f95d8[_0xea09('0x2c')]),'type':'PAUSE','enterAt':moment()[_0xea09('0x65')](_0xea09('0xce')),'data1':_0x4f9847[_0xea09('0x54')][_0xea09('0xd7')]||_0xea09('0xd8'),'role':_0x4f95d8[_0xea09('0x59')],'internal':_0x4f95d8[_0xea09('0x6c')]});});return db[_0xea09('0xcc')][_0xea09('0x53')](_0x388d9f,{'individualHooks':!![]});})[_0xea09('0x16')](function(){return _0x4f95d8[_0xea09('0x2a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4f9847[_0xea09('0x54')][_0xea09('0xd7')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xea09('0x65')](_0xea09('0xce'))});})[_0xea09('0x16')](respondWithResult(_0x41f337,null))[_0xea09('0x4f')](handleError(_0x41f337,null));};exports[_0xea09('0xd9')]=function(_0x425ccc,_0x2ca253,_0x2ffc85){var _0x539a27;return db[_0xea09('0x2f')][_0xea09('0x52')]({'where':{'id':_0x425ccc[_0xea09('0x56')]['id']},'attributes':['id',_0xea09('0x2c'),_0xea09('0x59'),'voicePause',_0xea09('0xda'),_0xea09('0xdb'),'faxPause',_0xea09('0xdc'),_0xea09('0xdd'),_0xea09('0xde'),_0xea09('0xdf')]})['then'](handleEntityNotFound(_0x2ca253,null))['then'](function(_0x12f6f9){if(_0x12f6f9){_0x539a27=_0x12f6f9;if(_0x425ccc[_0xea09('0x54')][_0xea09('0x8e')]&&!utils[_0xea09('0x8d')](_0x425ccc[_0xea09('0x54')]['channel'])){throw new db[(_0xea09('0x85'))]['ValidationError']('Unknown\x20channel');}switch(_0x425ccc[_0xea09('0x54')]['channel']){case _0xea09('0x94'):return respondWithRpcPromise(_0xea09('0xd4'),_0xea09('0xd9'),{'id':_0x539a27['id'],'name':_0x539a27[_0xea09('0x2c')],'pause':![]})[_0xea09('0x16')](function(){return db[_0xea09('0x9c')]['update']({'paused':0x0},{'where':{'UserId':_0x539a27['id']},'individualHooks':!![]});})[_0xea09('0x16')](function(){return db['MemberReport'][_0xea09('0x52')]({'where':{'channel':_0x425ccc['body'][_0xea09('0x8e')],'membername':_0x539a27[_0xea09('0x2c')],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x539a27[_0xea09('0x2c')]),'type':_0xea09('0xd1'),'exitAt':null}});})[_0xea09('0x16')](function(_0xdff651){if(_0xdff651){return _0xdff651[_0xea09('0x2a')]({'exitAt':moment()[_0xea09('0x65')](_0xea09('0xce')),'data2':_0xea09('0xe0')},{'individualHooks':!![]});}return null;})[_0xea09('0x16')](function(){return _0x539a27['update']({'voicePause':![]});});case _0xea09('0xe1'):case _0xea09('0xe2'):case _0xea09('0xe3'):case _0xea09('0xe4'):case'openchannel':return db[_0xea09('0xcc')]['find']({'where':{'channel':_0x425ccc[_0xea09('0x54')]['channel'],'membername':_0x539a27['name'],'interface':util[_0xea09('0x65')](_0xea09('0x97'),_0xea09('0x98'),_0x539a27[_0xea09('0x2c')]),'type':_0xea09('0xd1'),'exitAt':null}})[_0xea09('0x16')](function(_0x56fb47){if(_0x56fb47){return _0x56fb47['update']({'exitAt':moment()[_0xea09('0x65')](_0xea09('0xce')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xea09('0x16')](function(){var _0x19433e={};_[_0xea09('0x27')](_0x19433e,util[_0xea09('0x65')](_0xea09('0xe5'),_0x425ccc['body'][_0xea09('0x8e')],_0xea09('0xe6')),![]);return _0x539a27[_0xea09('0x2a')](_0x19433e);});default:return respondWithRpcPromise('QueuePause','unpause',{'id':_0x539a27['id'],'name':_0x539a27[_0xea09('0x2c')],'pause':![]})[_0xea09('0x16')](function(){return db[_0xea09('0x9c')][_0xea09('0x2a')]({'paused':0x0},{'where':{'UserId':_0x539a27['id']}});})[_0xea09('0x16')](function(){return db[_0xea09('0xcc')]['findAll']({'where':{'membername':_0x539a27[_0xea09('0x2c')],'interface':util['format'](_0xea09('0x97'),_0xea09('0x98'),_0x539a27[_0xea09('0x2c')]),'type':_0xea09('0xd1'),'exitAt':null}});})[_0xea09('0x16')](function(_0x434a1e){var _0x2f2613=[];_0x434a1e[_0xea09('0xcd')](function(_0x4fb50b){_0x2f2613['push'](_0x4fb50b['update']({'exitAt':moment()[_0xea09('0x65')](_0xea09('0xce')),'data2':_0xea09('0xe0')}));});return BPromise[_0xea09('0xcf')](_0x2f2613);})[_0xea09('0x16')](function(){return _0x539a27['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})['then'](respondWithResult(_0x2ca253,null))['catch'](handleError(_0x2ca253,null));};exports[_0xea09('0xe7')]=function(_0x3da8aa,_0x262efe,_0x510363){var _0x358f54={};var _0x421916={};var _0xac320f;var _0x2c4b12;return db[_0xea09('0x2f')][_0xea09('0xa8')]({'where':{'id':_0x3da8aa[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x262efe,null))[_0xea09('0x16')](function(_0x2f588c){if(_0x2f588c){_0xac320f=_0x2f588c;_0x421916[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0xe8')]['rawAttributes']);_0x421916[_0xea09('0x34')]=_['keys'](_0x3da8aa[_0xea09('0x34')]);_0x421916[_0xea09('0x36')]=_[_0xea09('0x37')](_0x421916[_0xea09('0x31')],_0x421916[_0xea09('0x34')]);_0x358f54[_0xea09('0x38')]=_[_0xea09('0x37')](_0x421916[_0xea09('0x31')],qs[_0xea09('0x39')](_0x3da8aa[_0xea09('0x34')][_0xea09('0x39')]));_0x358f54[_0xea09('0x38')]=_0x358f54[_0xea09('0x38')][_0xea09('0x3a')]?_0x358f54[_0xea09('0x38')]:_0x421916[_0xea09('0x31')];_0x358f54[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x3da8aa[_0xea09('0x34')][_0xea09('0x3d')]);_0x358f54[_0xea09('0x43')]=qs[_0xea09('0x36')](_['pick'](_0x3da8aa[_0xea09('0x34')],_0x421916[_0xea09('0x36')]));if(_0x3da8aa[_0xea09('0x34')][_0xea09('0x44')]){_0x358f54[_0xea09('0x43')]=_[_0xea09('0x42')](_0x358f54['where'],{'$or':_[_0xea09('0x45')](_0x358f54[_0xea09('0x38')],function(_0x20c6c3){var _0x5b363c={};_0x5b363c[_0x20c6c3]={'$like':'%'+_0x3da8aa[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x5b363c;})});}_0x358f54=_[_0xea09('0x42')]({},_0x358f54,_0x3da8aa[_0xea09('0x49')]);return _0xac320f[_0xea09('0xe7')](_0x358f54);}})['then'](function(_0x1b1049){if(_0x1b1049){_0x2c4b12=_0x1b1049['length'];if(!_0x3da8aa[_0xea09('0x34')]['hasOwnProperty'](_0xea09('0x3c'))){_0x358f54[_0xea09('0x25')]=qs[_0xea09('0x25')](_0x3da8aa[_0xea09('0x34')][_0xea09('0x25')]);_0x358f54[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x3da8aa[_0xea09('0x34')][_0xea09('0x24')]);}return _0xac320f[_0xea09('0xe7')](_0x358f54);}})['then'](function(_0x543c87){if(_0x543c87){return _0x543c87?{'count':_0x2c4b12,'rows':_0x543c87}:null;}})[_0xea09('0x16')](respondWithResult(_0x262efe,null))[_0xea09('0x4f')](handleError(_0x262efe,null));};exports['addTeams']=function(_0x44c8f6,_0x4167e9,_0x4e81c7){return db['User'][_0xea09('0x52')]({'where':{'id':_0x44c8f6[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x4167e9,null))['then'](function(_0xc24dd0){if(_0xc24dd0){return _0xc24dd0['addTeams'](_0x44c8f6[_0xea09('0x54')]['ids'],_[_0xea09('0xe9')](_0x44c8f6[_0xea09('0x54')],[_0xea09('0x58'),'id'])||{});}})['then'](respondWithResult(_0x4167e9,null))['catch'](handleError(_0x4167e9,null));};exports['removeTeams']=function(_0x53b845,_0x49852a,_0x105030){var _0x1d776b;return db['User'][_0xea09('0x52')]({'where':{'id':_0x53b845[_0xea09('0x56')]['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x49852a,null))['then'](function(_0x4b26bc){if(_0x4b26bc){return _0x4b26bc[_0xea09('0xea')](_0x53b845[_0xea09('0x34')][_0xea09('0x58')]);}})[_0xea09('0x16')](respondWithStatusCode(_0x49852a,null))[_0xea09('0x4f')](handleError(_0x49852a,null));};exports[_0xea09('0xeb')]=function(_0x3f535c,_0x175c75,_0x21d155){var _0x3c78f1={};var _0x26a530={};var _0x293e37;var _0x2ccda6;return db['User'][_0xea09('0xa8')]({'where':{'id':_0x3f535c[_0xea09('0x56')]['id']}})['then'](handleEntityNotFound(_0x175c75,null))[_0xea09('0x16')](function(_0x52b172){if(_0x52b172){_0x293e37=_0x52b172;_0x26a530[_0xea09('0x31')]=_['keys'](db['CmList'][_0xea09('0x30')]);_0x26a530['query']=_[_0xea09('0x33')](_0x3f535c['query']);_0x26a530[_0xea09('0x36')]=_[_0xea09('0x37')](_0x26a530['model'],_0x26a530['query']);_0x3c78f1[_0xea09('0x38')]=_[_0xea09('0x37')](_0x26a530[_0xea09('0x31')],qs[_0xea09('0x39')](_0x3f535c[_0xea09('0x34')][_0xea09('0x39')]));_0x3c78f1[_0xea09('0x38')]=_0x3c78f1[_0xea09('0x38')][_0xea09('0x3a')]?_0x3c78f1[_0xea09('0x38')]:_0x26a530[_0xea09('0x31')];_0x3c78f1[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x3f535c[_0xea09('0x34')][_0xea09('0x3d')]);_0x3c78f1[_0xea09('0x43')]=qs[_0xea09('0x36')](_[_0xea09('0x3e')](_0x3f535c[_0xea09('0x34')],_0x26a530[_0xea09('0x36')]));if(_0x3f535c[_0xea09('0x34')]['filter']){_0x3c78f1[_0xea09('0x43')]=_[_0xea09('0x42')](_0x3c78f1['where'],{'$or':_['map'](_0x3c78f1[_0xea09('0x38')],function(_0x47f090){var _0x587f56={};_0x587f56[_0x47f090]={'$like':'%'+_0x3f535c[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x587f56;})});}_0x3c78f1=_[_0xea09('0x42')]({},_0x3c78f1,_0x3f535c[_0xea09('0x49')]);return _0x293e37[_0xea09('0xeb')](_0x3c78f1);}})[_0xea09('0x16')](function(_0x2e66e4){if(_0x2e66e4){_0x2ccda6=_0x2e66e4['length'];if(!_0x3f535c['query'][_0xea09('0x3b')](_0xea09('0x3c'))){_0x3c78f1['limit']=qs['limit'](_0x3f535c['query'][_0xea09('0x25')]);_0x3c78f1[_0xea09('0x24')]=qs[_0xea09('0x24')](_0x3f535c['query'][_0xea09('0x24')]);}return _0x293e37[_0xea09('0xeb')](_0x3c78f1);}})[_0xea09('0x16')](function(_0x3131ba){if(_0x3131ba){return _0x3131ba?{'count':_0x2ccda6,'rows':_0x3131ba}:null;}})[_0xea09('0x16')](respondWithResult(_0x175c75,null))[_0xea09('0x4f')](handleError(_0x175c75,null));};exports[_0xea09('0xec')]=function(_0x751abe,_0x131d37,_0x2d1aaa){var _0x16ed5b={};var _0x45fe51={};var _0x5c0e9c;var _0x27e13c;return db[_0xea09('0x2f')]['findOne']({'where':{'id':_0x751abe['params']['id']}})[_0xea09('0x16')](handleEntityNotFound(_0x131d37,null))[_0xea09('0x16')](function(_0x29ef93){if(_0x29ef93){_0x5c0e9c=_0x29ef93;_0x45fe51[_0xea09('0x31')]=_[_0xea09('0x33')](db[_0xea09('0x2f')][_0xea09('0x30')]);_0x45fe51[_0xea09('0x34')]=_[_0xea09('0x33')](_0x751abe[_0xea09('0x34')]);_0x45fe51['filters']=_[_0xea09('0x37')](_0x45fe51[_0xea09('0x31')],_0x45fe51[_0xea09('0x34')]);_0x16ed5b[_0xea09('0x38')]=_[_0xea09('0x37')](_0x45fe51[_0xea09('0x31')],qs['fields'](_0x751abe['query'][_0xea09('0x39')]));_0x16ed5b[_0xea09('0x38')]=_0x16ed5b[_0xea09('0x38')][_0xea09('0x3a')]?_0x16ed5b[_0xea09('0x38')]:_0x45fe51[_0xea09('0x31')];_0x16ed5b[_0xea09('0xab')]=qs[_0xea09('0x3d')](_0x751abe['query'][_0xea09('0x3d')]);_0x16ed5b['where']=qs['filters'](_[_0xea09('0x3e')](_0x751abe[_0xea09('0x34')],_0x45fe51[_0xea09('0x36')]));if(_0x751abe[_0xea09('0x34')][_0xea09('0x44')]){_0x16ed5b['where']=_[_0xea09('0x42')](_0x16ed5b['where'],{'$or':_[_0xea09('0x45')](_0x16ed5b[_0xea09('0x38')],function(_0x4239ea){var _0x1de867={};_0x1de867[_0x4239ea]={'$like':'%'+_0x751abe[_0xea09('0x34')][_0xea09('0x44')]+'%'};return _0x1de867;})});}_0x16ed5b[_0xea09('0x31')]=db[_0xea09('0x2f')];_0x16ed5b['as']=_0xea09('0xed');_0x16ed5b=_[_0xea09('0x42')]({},_0x16ed5b,_0x751abe[_0xea09('0x49')]);return _0x5c0e9c[_0xea09('0xee')]({'include':[_0x16ed5b]});}})[_0xea09('0x16')](function(_0x2b2a93){if(_0x2b2a93){var _0x4cccfd={},_0x6da076=[],_0x430bb1=0x0;for(var _0x2c2fcc=0x0;_0x2c2fcc<_0x2b2a93[_0xea09('0x3a')];_0x2c2fcc+=0x1){for(var _0x4cd630=0x0,_0x2c35b6;_0x4cd630<_0x2b2a93[_0x2c2fcc][_0xea09('0xed')][_0xea09('0x3a')];_0x4cd630+=0x1){_0x2c35b6=_0x2b2a93[_0x2c2fcc][_0xea09('0xed')][_0x4cd630][_0xea09('0xaf')]({'plain':!![]});_0x4cccfd[_0x2c35b6['id']]=_0x2c35b6;}}_0x4cccfd=_[_0xea09('0xef')](_0x4cccfd);for(var _0x1ff4dd=qs[_0xea09('0x24')](_0x751abe[_0xea09('0x34')]['offset']);_0x1ff4dd<_0x4cccfd['length']&&_0x6da076[_0xea09('0x3a')]=_0xb12ba3){_0x43b023=_0xb12ba3;_0x275de1=0xc8;}else{_0x275de1=0xce;}_0x124d39[_0xad68('0x22')](_0x275de1);return _0x124d39['set'](_0xad68('0x26'),_0x4b1e67+'-'+_0x43b023+'/'+_0xb12ba3)[_0xad68('0x27')](_0x419f88);}return null;};}function patchUpdates(_0x46248d){return function(_0x395134){try{jsonpatch[_0xad68('0x28')](_0x395134,_0x46248d,!![]);}catch(_0x535cef){return BPromise[_0xad68('0x29')](_0x535cef);}return _0x395134[_0xad68('0x2a')]();};}function saveUpdates(_0x495604,_0x29ba53){return function(_0x284ccd){if(_0x284ccd){return _0x284ccd[_0xad68('0x2b')](_0x495604)[_0xad68('0x15')](function(_0xac592e){return _0xac592e;});}return null;};}function removeEntity(_0x4a562d,_0x2cca90){return function(_0x98c488){if(_0x98c488){return _0x98c488[_0xad68('0x2c')]()[_0xad68('0x15')](function(){_0x4a562d[_0xad68('0x22')](0xcc)[_0xad68('0x23')]();});}};}function handleEntityNotFound(_0x40b6bc,_0x3c1170){return function(_0x2aa36f){if(!_0x2aa36f){_0x40b6bc[_0xad68('0x21')](0x194);}return _0x2aa36f;};}function handleError(_0x592513,_0x4e6950){_0x4e6950=_0x4e6950||0x1f4;return function(_0x215cd5){logger[_0xad68('0x1c')](_0x215cd5[_0xad68('0x2d')]);if(_0x215cd5[_0xad68('0x2e')]){delete _0x215cd5['name'];}_0x592513[_0xad68('0x22')](_0x4e6950)[_0xad68('0x2f')](_0x215cd5);};}exports[_0xad68('0x30')]=function(_0x2b6be0,_0x201b30){var _0x1b9b8f={},_0x1dada8={},_0x4689c5={'count':0x0,'rows':[]};var _0x148096=db[_0xad68('0x31')][_0xad68('0x32')];_0x1dada8[_0xad68('0x33')]=_[_0xad68('0x34')](_[_0xad68('0x35')](_0x148096),[_0xad68('0x36'),_0xad68('0x37')]);var _0x2ba769={'dateStart':_0x2b6be0[_0xad68('0x38')][_0xad68('0x39')],'dateEnd':_0x2b6be0[_0xad68('0x38')][_0xad68('0x3a')]};delete _0x2b6be0['query'][_0xad68('0x39')];delete _0x2b6be0['query'][_0xad68('0x3a')];_0x1dada8[_0xad68('0x38')]=_[_0xad68('0x35')](_0x2b6be0[_0xad68('0x38')]);_0x1dada8[_0xad68('0x3b')]=_['intersection'](_0x1dada8[_0xad68('0x33')],_0x1dada8[_0xad68('0x38')]);_0x1b9b8f[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x1dada8[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x3e')]));_0x1b9b8f[_0xad68('0x3c')]=_0x1b9b8f[_0xad68('0x3c')]['length']?_0x1b9b8f['attributes']:_0x1dada8[_0xad68('0x33')];if(!_0x2b6be0[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x1b9b8f[_0xad68('0x41')]=qs['limit'](_0x2b6be0['query'][_0xad68('0x41')]);_0x1b9b8f['offset']=qs[_0xad68('0x25')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x25')]);}_0x1b9b8f[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x2b6be0[_0xad68('0x38')][_0xad68('0x43')]);_0x1b9b8f['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x2b6be0[_0xad68('0x38')],_0x1dada8['filters']));if(_0x2ba769[_0xad68('0x39')]){if(_0x2ba769[_0xad68('0x3a')]){_0x2ba769[_0xad68('0x3a')]=moment(_0x2ba769[_0xad68('0x3a')])[_0xad68('0x45')](0x1,_0xad68('0x46'));}else{_0x2ba769[_0xad68('0x3a')]=moment(_0x2ba769[_0xad68('0x39')])['add'](0x1,_0xad68('0x46'));}_[_0xad68('0x47')](_0x1b9b8f[_0xad68('0x48')],{'createdAt':{'$gte':_0x2ba769['dateStart'],'$lte':_0x2ba769['dateEnd']}});}if(_0x2b6be0[_0xad68('0x38')]['filter']){_0x1b9b8f[_0xad68('0x48')]=_['merge'](_0x1b9b8f[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1b9b8f[_0xad68('0x3c')],function(_0x51253b){return db[_0xad68('0x4a')][_0xad68('0x48')](db['sequelize']['fn'](_0xad68('0x4b'),db['sequelize'][_0xad68('0x4c')](_0x51253b)),{'$like':db[_0xad68('0x4a')]['fn'](_0xad68('0x4b'),'%'+_0x2b6be0[_0xad68('0x38')]['filter']+'%')});})});}_0x1b9b8f=_[_0xad68('0x47')]({},_0x1b9b8f,_0x2b6be0[_0xad68('0x4d')]);var _0x1eb884={'where':_0x1b9b8f[_0xad68('0x48')]};return db[_0xad68('0x31')]['count'](_0x1eb884)['then'](function(_0x1b5336){_0x4689c5['count']=_0x1b5336;if(_0x2b6be0[_0xad68('0x38')][_0xad68('0x4e')]){_0x1b9b8f[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0x31')][_0xad68('0x50')](_0x1b9b8f);})[_0xad68('0x15')](function(_0x587a05){_0x4689c5[_0xad68('0x51')]=_0x587a05;return _0x4689c5;})[_0xad68('0x15')](respondWithFilteredResult(_0x201b30,_0x1b9b8f))['catch'](handleError(_0x201b30,null));};exports[_0xad68('0x52')]=function(_0x1565bd,_0x4b02d3){var _0x32eec1={'raw':![],'where':{'id':_0x1565bd[_0xad68('0x53')]['id']}},_0x2f1de0={};_0x2f1de0[_0xad68('0x33')]=_[_0xad68('0x34')](_[_0xad68('0x35')](db[_0xad68('0x31')][_0xad68('0x32')]),[_0xad68('0x36'),_0xad68('0x37')]);_0x2f1de0[_0xad68('0x38')]=_['keys'](_0x1565bd[_0xad68('0x38')]);_0x2f1de0[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x2f1de0[_0xad68('0x33')],_0x2f1de0[_0xad68('0x38')]);_0x32eec1[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x2f1de0['model'],qs[_0xad68('0x3e')](_0x1565bd[_0xad68('0x38')]['fields']));_0x32eec1['attributes']=_0x32eec1[_0xad68('0x3c')][_0xad68('0x54')]?_0x32eec1['attributes']:_0x2f1de0['model'];if(_0x1565bd[_0xad68('0x38')][_0xad68('0x4e')]){_0x32eec1[_0xad68('0x4f')]=[{'all':!![]}];}_0x32eec1=_['merge']({},_0x32eec1,_0x1565bd['options']);return db[_0xad68('0x31')]['find'](_0x32eec1)[_0xad68('0x15')](handleEntityNotFound(_0x4b02d3,null))[_0xad68('0x15')](respondWithResult(_0x4b02d3,null))[_0xad68('0x20')](handleError(_0x4b02d3,null));};exports[_0xad68('0x55')]=function(_0xcef0d0,_0x138400){return db[_0xad68('0x31')]['bulkCreate'](_0xcef0d0['body'],{'raw':![],'individualHooks':!![]})[_0xad68('0x15')](respondWithResult(_0x138400,0xc9))[_0xad68('0x20')](handleError(_0x138400,null));};exports[_0xad68('0x2b')]=function(_0x328e3c,_0x3fd7d2){if(_0x328e3c[_0xad68('0x56')]['id']){delete _0x328e3c['body']['id'];}return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x328e3c[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3fd7d2,null))[_0xad68('0x15')](saveUpdates(_0x328e3c[_0xad68('0x56')],null))[_0xad68('0x15')](respondWithResult(_0x3fd7d2,null))[_0xad68('0x20')](handleError(_0x3fd7d2,null));};exports[_0xad68('0x58')]=function(_0x1e36f3,_0x311283){return db['User'][_0xad68('0x58')]()[_0xad68('0x15')](respondWithResult(_0x311283,null))['catch'](handleError(_0x311283,null));};exports[_0xad68('0x59')]=function(_0x3273ba,_0x1debfb,_0x4d9727){return db[_0xad68('0x31')]['find']({'where':{'id':_0x3273ba[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x1debfb,null))[_0xad68('0x15')](function(_0x38c2e7){if(_0x38c2e7){return _0x38c2e7[_0xad68('0x59')](_0x3273ba[_0xad68('0x56')][_0xad68('0x5a')],_['omit'](_0x3273ba[_0xad68('0x56')],[_0xad68('0x5a'),'id'])||{});}})[_0xad68('0x15')](respondWithResult(_0x1debfb,null))[_0xad68('0x20')](handleError(_0x1debfb,null));};var getLicense=function(_0x41d12d){return new BPromise(function(_0x3d4ee5,_0x1e8496){var _0x5c3850=0x0;_0x41d12d[_0xad68('0x56')]['role']===_0xad68('0x5b')&&_0x3d4ee5(_0xad68('0x5c'));return db[_0xad68('0x31')][_0xad68('0x24')]({'where':{'$or':[{'role':_0x41d12d[_0xad68('0x56')][_0xad68('0x5d')]===_0xad68('0x5e')?'telephone':[_0xad68('0x5f'),_0xad68('0x60')]}]}})[_0xad68('0x15')](function(_0x930dc){_0x5c3850=_0x930dc;return require('../../config/license/util')[_0xad68('0x61')]();})[_0xad68('0x15')](function(_0x5413fd){var _0x92854e=_0x41d12d[_0xad68('0x56')]['role']===_0xad68('0x5e')?_0xad68('0x62'):_0xad68('0x63');if(!_[_0xad68('0x64')](_0x5413fd[_0x92854e])&&_0x5c3850>=_0x5413fd[_0x92854e]){return _0x1e8496({'message':_0xad68('0x65')});}return _0x3d4ee5(util[_0xad68('0x66')](_0xad68('0x67'),_0x92854e,_0x5c3850));})[_0xad68('0x20')](function(_0x430654){return _0x1e8496(_0x430654);});});};exports[_0xad68('0x68')]=function(_0x2a08b6,_0x280515){return getLicense(_0x2a08b6)[_0xad68('0x15')](function(_0x421705){if(!_0x2a08b6['body']['internal']){var _0x1b18c4;return db[_0xad68('0x69')][_0xad68('0x6a')](0x1)[_0xad68('0x15')](function(_0x118536){_0x1b18c4=_0x118536['min_internal'];return db[_0xad68('0x31')][_0xad68('0x6b')](_0xad68('0x6c'));})['then'](function(_0x26b8ff){if(_[_0xad68('0x64')](_0x26b8ff)){if(_0x1b18c4){_0x2a08b6['body']['internal']=_0x1b18c4;}else{_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=0x1;}}else{if(_[_0xad68('0x64')](_0x1b18c4)||_0x1b18c4==_0x26b8ff){_0x2a08b6['body'][_0xad68('0x6c')]=_0x26b8ff+0x1;}else if(_0x1b18c4>_0x26b8ff){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x1b18c4;}else{return db[_0xad68('0x4a')]['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xad68('0x4a')]['QueryTypes'][_0xad68('0x6d')]})['then'](function(_0x2e4192){if(_0x2e4192&&_0x2e4192[_0xad68('0x54')]){for(var _0x10531b=0x0,_0x2d2013=_0x2e4192[_0xad68('0x54')];_0x10531b<_0x2d2013&&_[_0xad68('0x64')](_0x2a08b6['body']['internal']);_0x10531b++){if(_0x1b18c4<=_0x2e4192[_0x10531b][_0xad68('0x6e')]){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x2e4192[_0x10531b][_0xad68('0x6e')];}else if(_0x1b18c4>_0x2e4192[_0x10531b][_0xad68('0x6e')]&&_0x1b18c4<=_0x2e4192[_0x10531b]['to']){_0x2a08b6['body']['internal']=_0x1b18c4;}}}if(_['isNil'](_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')])){_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')]=_0x26b8ff+0x1;}});}}});}})[_0xad68('0x15')](function(){if(_0x2a08b6[_0xad68('0x56')]['voicemail']){_0x2a08b6[_0xad68('0x56')]['mailbox']=_0x2a08b6[_0xad68('0x56')]['internal'];_0x2a08b6[_0xad68('0x56')]['VoiceMail']={'mailbox':_0x2a08b6[_0xad68('0x56')][_0xad68('0x6c')],'password':_0x2a08b6['body'][_0xad68('0x36')],'fullname':_0x2a08b6[_0xad68('0x56')]['fullname'],'email':_0x2a08b6['body'][_0xad68('0x6f')]};}if(_0x2a08b6[_0xad68('0x56')]&&_0x2a08b6['body'][_0xad68('0x5d')]==='agent'){_0x2a08b6['body'][_0xad68('0x70')]=[_0xad68('0x71'),_0xad68('0x72'),_0xad68('0x73'),'110',_0xad68('0x74'),'105',_0xad68('0x75'),_0xad68('0x76'),'108',_0xad68('0x77'),_0xad68('0x78'),_0xad68('0x79')];}return db[_0xad68('0x31')][_0xad68('0x68')](_0x2a08b6[_0xad68('0x56')],{'include':[{'model':db[_0xad68('0x7a')],'as':'VoiceMail'}]});})[_0xad68('0x15')](respondWithResult(_0x280515,0xc9))[_0xad68('0x20')](handleError(_0x280515,null));};exports[_0xad68('0x7b')]=function(_0x270d28,_0x2af571,_0x44d54d){if(_0x270d28[_0xad68('0x56')]['id']){delete _0x270d28[_0xad68('0x56')]['id'];}return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x270d28[_0xad68('0x53')]['id']}})[_0xad68('0x15')](function(_0x15a238){if(_0x15a238){if(_0x15a238['id']==_0x270d28[_0xad68('0x60')]['id']){if(!_0x270d28[_0xad68('0x56')]['oldPassword']||!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db['Sequelize'][(_0xad68('0x7d'))](_0xad68('0x7e'));}if(!_0x15a238['authenticate'](_0x270d28[_0xad68('0x56')][_0xad68('0x7f')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x81'));}if(_0x270d28['body'][_0xad68('0x7f')]==_0x270d28['body']['newPassword']){throw new db['Sequelize']['ValidationError']('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}return _0x15a238;}else if(_0x270d28[_0xad68('0x60')]['role']==_0xad68('0x5f')){if(!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x82'));}return _0x15a238;}else if(_0x270d28[_0xad68('0x60')][_0xad68('0x5d')]==_0xad68('0x60')){if(!_0x270d28[_0xad68('0x56')][_0xad68('0x7c')]){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x82'));}if(_0x15a238[_0xad68('0x5d')]!='agent'){throw new db['Sequelize'][(_0xad68('0x7d'))](_0xad68('0x83'));}return _0x15a238;}else{throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x83'));}}return null;})[_0xad68('0x15')](handleEntityNotFound(_0x2af571,null))[_0xad68('0x15')](saveUpdates({'password':_0x270d28[_0xad68('0x56')]['newPassword'],'passwordResetAt':_0x270d28['user']['id']==_0x270d28['params']['id']?moment():null},null))[_0xad68('0x15')](respondWithResult(_0x2af571,null))[_0xad68('0x20')](handleError(_0x2af571,null));};exports[_0xad68('0x84')]=function(_0x338b3e,_0x158091,_0x4a2340){var _0x51070e;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x338b3e[_0xad68('0x53')]['id']},'attributes':['id','name',_0xad68('0x5d'),_0xad68('0x85'),_0xad68('0x86')]})[_0xad68('0x15')](handleEntityNotFound(_0x158091,null))[_0xad68('0x15')](function(_0x3129d2){if(_0x3129d2){_0x51070e=_0x3129d2;if(!utils[_0xad68('0x87')](_0x338b3e[_0xad68('0x56')][_0xad68('0x88')])){throw new db['Sequelize']['ValidationError'](_0xad68('0x89'));}return _0x3129d2[_0xad68('0x45')+_[_0xad68('0x8a')](_0x338b3e['body'][_0xad68('0x88')][_0xad68('0x8b')]())+_0xad68('0x8c')](_0x338b3e[_0xad68('0x56')]['ids'],{'penalty':_0x338b3e[_0xad68('0x56')][_0xad68('0x8d')]||0x0});}})[_0xad68('0x15')](function(){if(_0x338b3e['body'][_0xad68('0x88')]===_0xad68('0x8e')){return db[_0xad68('0x8f')]['findAll']({'where':{'id':_0x338b3e[_0xad68('0x56')][_0xad68('0x5a')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xad68('0x15')](function(_0x68ad19){var _0x21354f=[];if(_0x338b3e['body'][_0xad68('0x88')]===_0xad68('0x8e')&&_0x51070e[_0xad68('0x5d')]==='agent'){for(var _0x2ba218=0x0;_0x2ba218<_0x68ad19['length'];_0x2ba218+=0x1){_0x21354f['push']({'membername':_0x51070e[_0xad68('0x2e')],'UserId':_0x51070e['id'],'queue_name':_0x68ad19[_0x2ba218][_0xad68('0x2e')],'VoiceQueueId':_0x68ad19[_0x2ba218]['id'],'interface':util['format'](_0xad68('0x90'),_0xad68('0x91'),_0x51070e[_0xad68('0x2e')]),'paused':_0x51070e[_0xad68('0x86')]||![],'penalty':_0x338b3e['body']['penalty']||0x0});}return BPromise[_0xad68('0x92')](_0x21354f,function(_0x10f645){return db[_0xad68('0x93')][_0xad68('0x94')](_0x10f645);});}return _0x51070e;})['then'](respondWithStatusCode(_0x158091,null))['catch'](handleError(_0x158091,null));};exports[_0xad68('0x95')]=function(_0x1542e9,_0x35bd7b,_0x1f655c){var _0x5d6323;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x1542e9[_0xad68('0x53')]['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x35bd7b,null))[_0xad68('0x15')](function(_0x23f251){if(_0x23f251){_0x5d6323=_0x23f251;if(!_0x1542e9[_0xad68('0x38')]['channel']||!utils[_0xad68('0x87')](_0x1542e9[_0xad68('0x38')][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))]('Unknown\x20channel');}return _0x23f251[_0xad68('0x96')+_[_0xad68('0x8a')](_0x1542e9[_0xad68('0x38')][_0xad68('0x88')][_0xad68('0x8b')]())+'Queues'](_0x1542e9[_0xad68('0x38')][_0xad68('0x5a')]);}})['then'](function(_0x2fb539){if(_0x1542e9[_0xad68('0x38')]['channel']===_0xad68('0x8e')){return db[_0xad68('0x93')]['destroy']({'where':{'UserId':_0x1542e9['params']['id'],'VoiceQueueId':_0x1542e9[_0xad68('0x38')][_0xad68('0x5a')]},'individualHooks':!![]})[_0xad68('0x15')](function(){return _0x5d6323;});}return _0x5d6323;})[_0xad68('0x15')](respondWithStatusCode(_0x35bd7b,null))[_0xad68('0x20')](handleError(_0x35bd7b,null));};exports['addAvatar']=function(_0x9ef3b6,_0x3aa09e,_0x258e59){_0x9ef3b6[_0xad68('0x56')][_0xad68('0x97')]=_0x9ef3b6[_0xad68('0x98')][_0xad68('0x99')];return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x9ef3b6[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3aa09e,null))['then'](saveUpdates(_0x9ef3b6['body'],null))[_0xad68('0x15')](respondWithResult(_0x3aa09e,null))[_0xad68('0x20')](handleError(_0x3aa09e,null));};exports['getAvatar']=function(_0x1a43c1,_0x51c7b9,_0x406802){var _0x3f3a42=path[_0xad68('0x9a')](config[_0xad68('0x9b')],'server/files/images/logos/default_profile.png');return db['User'][_0xad68('0x57')]({'where':{'id':_0x1a43c1[_0xad68('0x53')]['id']},'attributes':['id',_0xad68('0x97')],'raw':!![]})[_0xad68('0x15')](handleEntityNotFound(_0x51c7b9,null))[_0xad68('0x15')](function(_0xaf5463){if(_0xaf5463){if(_[_0xad68('0x64')](_0xaf5463['userpic'])){return _0x51c7b9[_0xad68('0x9c')](_0x3f3a42);}else{if(!fs[_0xad68('0x9d')](path[_0xad68('0x9a')](config[_0xad68('0x9b')],_0xad68('0x9e'),_0xaf5463[_0xad68('0x97')]))){return _0x51c7b9[_0xad68('0x9c')](_0x3f3a42);}return _0x51c7b9[_0xad68('0x9c')](path[_0xad68('0x9a')](config[_0xad68('0x9b')],'server/files/images/',_0xaf5463['userpic']));}}})['catch'](handleError(_0x51c7b9,null));};exports[_0xad68('0x9f')]=function(_0x3fb3c0,_0xb54962,_0x2e87bc){var _0x367775;var _0x2bd40f={'where':{}},_0x385908={},_0x553c0c={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x3fb3c0[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0xb54962,null))[_0xad68('0x15')](function(_0x363d1b){if(_0x363d1b){_0x367775=_0x363d1b;_0x2bd40f[_0xad68('0x48')]['UserId']=_0x363d1b['id'];return db[_0xad68('0xa1')][_0xad68('0x58')]();}})[_0xad68('0x15')](function(_0x336baf){if(_0x336baf){_0x385908['model']=_[_0xad68('0x35')](_0x336baf);_0x385908[_0xad68('0x38')]=_[_0xad68('0x35')](_0x3fb3c0['query']);_0x385908['filters']=_[_0xad68('0x3d')](_0x385908[_0xad68('0x33')],_0x385908[_0xad68('0x38')]);_0x2bd40f['attributes']=_[_0xad68('0x3d')](_0x385908[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x3fb3c0['query'][_0xad68('0x3e')]));_0x2bd40f[_0xad68('0x3c')]=_0x2bd40f[_0xad68('0x3c')][_0xad68('0x54')]?_0x2bd40f[_0xad68('0x3c')]:_0x385908[_0xad68('0x33')];if(!_0x3fb3c0['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x2bd40f[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x41')]);_0x2bd40f[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x25')]);}_0x2bd40f[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x3fb3c0[_0xad68('0x38')][_0xad68('0x43')]);_0x2bd40f[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x3fb3c0[_0xad68('0x38')],_0x385908[_0xad68('0x3b')]));if(_0x3fb3c0[_0xad68('0x38')][_0xad68('0xa2')]){_0x2bd40f['where']=_[_0xad68('0x47')](_0x2bd40f['where'],{'$or':_[_0xad68('0x49')](_0x2bd40f['attributes'],function(_0x4070c6){var _0x50af16={};_0x50af16[_0x4070c6]={'$like':'%'+_0x3fb3c0['query'][_0xad68('0xa2')]+'%'};return _0x50af16;})});}_0x2bd40f=_['merge']({},_0x2bd40f,_0x3fb3c0['options']);return _0x367775['getContacts'](_[_0xad68('0x44')](_0x2bd40f,[_0xad68('0x48')]))['then'](function(_0x14039a){_0x553c0c[_0xad68('0x24')]=_0x14039a[_0xad68('0x54')]||0x0;if(_0x3fb3c0['query'][_0xad68('0x4e')]){_0x2bd40f[_0xad68('0x4f')]=[{'all':!![]}];}return _0x367775['getContacts'](_0x2bd40f);})[_0xad68('0x15')](function(_0x1bbb35){_0x553c0c['rows']=_0x1bbb35;return _0x553c0c;});}})['then'](respondWithFilteredResult(_0xb54962,_0x2bd40f))[_0xad68('0x20')](handleError(_0xb54962,null));};exports['getQueues']=function(_0x4eab2a,_0x5073d9,_0x129c6e){var _0x1df53c;var _0x105120;var _0x97d47={};var _0x1997c5;return db['User']['findOne']({'where':{'id':_0x4eab2a['params']['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x5073d9,null))[_0xad68('0x15')](function(_0x22a089){if(!utils[_0xad68('0x87')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))]['ValidationError'](_0xad68('0x89'));}_0x1df53c=_0x22a089;var _0x4ecef3={};_0x4ecef3[_0xad68('0x33')]=_[_0xad68('0x35')](db[_['capitalize'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0xa3')][_0xad68('0x32')]);_0x4ecef3['query']=_['keys'](_0x4eab2a[_0xad68('0x38')]);_0x4ecef3[_0xad68('0x3b')]=_['intersection'](_0x4ecef3[_0xad68('0x33')],_0x4ecef3[_0xad68('0x38')]);_0x97d47[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x4ecef3['model'],qs['fields'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x3e')]));_0x97d47[_0xad68('0x3c')]=_0x97d47['attributes']['length']?_0x97d47[_0xad68('0x3c')]:_0x4ecef3[_0xad68('0x33')];_0x97d47['order']=qs[_0xad68('0x43')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x43')]);_0x97d47[_0xad68('0x48')]=qs['filters'](_['pick'](_0x4eab2a[_0xad68('0x38')],_0x4ecef3[_0xad68('0x3b')]));if(_0x4eab2a['query'][_0xad68('0xa2')]){_0x97d47[_0xad68('0x48')]=_[_0xad68('0x47')](_0x97d47[_0xad68('0x48')],{'$or':_['map'](_0x97d47[_0xad68('0x3c')],function(_0x4d390b){var _0x3b6685={};_0x3b6685[_0x4d390b]={'$like':'%'+_0x4eab2a[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x3b6685;})});}_0x97d47=_[_0xad68('0x47')]({},_0x97d47,_0x4eab2a[_0xad68('0x4d')]);switch(_0x1df53c[_0xad68('0x5d')]){case _0xad68('0x5f'):return db[_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0xa3')][_0xad68('0x50')](_0x97d47);case _0xad68('0x60'):case _0xad68('0x5b'):return _0x1df53c[_0xad68('0xa4')+_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+_0xad68('0x8c')](_0x97d47);default:throw new db['Sequelize']['ValidationError']('Unknown\x20role');}})['then'](function(_0x3ec4ba){_0x1997c5=_0x3ec4ba['length'];if(!_0x4eab2a[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x97d47[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x41')]);_0x97d47['offset']=qs[_0xad68('0x25')](_0x4eab2a[_0xad68('0x38')][_0xad68('0x25')]);}switch(_0x1df53c[_0xad68('0x5d')]){case'admin':return db[_['capitalize'](_0x4eab2a[_0xad68('0x38')][_0xad68('0x88')])+'Queue'][_0xad68('0x50')](_0x97d47);case'user':case'agent':return _0x1df53c[_0xad68('0xa4')+_[_0xad68('0x8a')](_0x4eab2a[_0xad68('0x38')]['channel'])+_0xad68('0x8c')](_0x97d47);}})['then'](function(_0x12d11e){return{'count':_0x1997c5,'rows':_0x12d11e};})[_0xad68('0x15')](respondWithResult(_0x5073d9,null))['catch'](handleError(_0x5073d9,null));};exports[_0xad68('0xa5')]=function(_0x827e2b,_0xc61626,_0x397c0f){var _0x208585={};var _0x4f9916={};var _0x452505;var _0x56d5a0;return db[_0xad68('0x31')]['findOne']({'where':{'id':_0x827e2b['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0xc61626,null))[_0xad68('0x15')](function(_0xcd33){if(_0xcd33){_0x452505=_0xcd33;_0x4f9916[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0x93')][_0xad68('0x32')]);_0x4f9916['query']=_[_0xad68('0x35')](_0x827e2b[_0xad68('0x38')]);_0x4f9916['filters']=_[_0xad68('0x3d')](_0x4f9916['model'],_0x4f9916[_0xad68('0x38')]);_0x208585['attributes']=_[_0xad68('0x3d')](_0x4f9916[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x827e2b[_0xad68('0x38')]['fields']));_0x208585[_0xad68('0x3c')]=_0x208585[_0xad68('0x3c')][_0xad68('0x54')]?_0x208585[_0xad68('0x3c')]:_0x4f9916[_0xad68('0x33')];_0x208585[_0xad68('0x42')]=qs['sort'](_0x827e2b[_0xad68('0x38')][_0xad68('0x43')]);_0x208585[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x827e2b['query'],_0x4f9916[_0xad68('0x3b')]));if(_0x827e2b[_0xad68('0x38')][_0xad68('0xa2')]){_0x208585[_0xad68('0x48')]=_[_0xad68('0x47')](_0x208585['where'],{'$or':_[_0xad68('0x49')](_0x208585[_0xad68('0x3c')],function(_0x2bd713){var _0x4b4652={};_0x4b4652[_0x2bd713]={'$like':'%'+_0x827e2b[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x4b4652;})});}_0x208585=_[_0xad68('0x47')]({},_0x208585,_0x827e2b[_0xad68('0x4d')]);return _0x452505[_0xad68('0xa5')](_0x208585);}})[_0xad68('0x15')](function(_0x364e51){if(_0x364e51){_0x56d5a0=_0x364e51[_0xad68('0x54')];if(!_0x827e2b[_0xad68('0x38')]['hasOwnProperty']('nolimit')){_0x208585[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x827e2b[_0xad68('0x38')][_0xad68('0x41')]);_0x208585[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x827e2b[_0xad68('0x38')][_0xad68('0x25')]);}return _0x452505[_0xad68('0xa5')](_0x208585);}})['then'](function(_0xb4e547){if(_0xb4e547){return _0xb4e547?{'count':_0x56d5a0,'rows':_0xb4e547}:null;}})[_0xad68('0x15')](respondWithResult(_0xc61626,null))[_0xad68('0x20')](handleError(_0xc61626,null));};exports[_0xad68('0xa6')]=function(_0x40d3e8,_0x53953c,_0x35bc24){var _0x54f0e4={};var _0x4b2070={};var _0x1813dd;var _0xb1cfa4;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x40d3e8[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x53953c,null))[_0xad68('0x15')](function(_0x55a0fc){if(_0x55a0fc){_0x1813dd=_0x55a0fc;_0x4b2070['model']=_[_0xad68('0x35')](db[_0xad68('0xa7')][_0xad68('0x32')]);_0x4b2070['query']=_[_0xad68('0x35')](_0x40d3e8['query']);_0x4b2070['filters']=_['intersection'](_0x4b2070[_0xad68('0x33')],_0x4b2070[_0xad68('0x38')]);_0x54f0e4[_0xad68('0x3c')]=_['intersection'](_0x4b2070['model'],qs[_0xad68('0x3e')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x3e')]));_0x54f0e4[_0xad68('0x3c')]=_0x54f0e4[_0xad68('0x3c')][_0xad68('0x54')]?_0x54f0e4['attributes']:_0x4b2070[_0xad68('0x33')];_0x54f0e4['order']=qs[_0xad68('0x43')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x43')]);_0x54f0e4['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x40d3e8[_0xad68('0x38')],_0x4b2070[_0xad68('0x3b')]));if(_0x40d3e8['query'][_0xad68('0xa2')]){_0x54f0e4[_0xad68('0x48')]=_[_0xad68('0x47')](_0x54f0e4['where'],{'$or':_[_0xad68('0x49')](_0x54f0e4[_0xad68('0x3c')],function(_0x5a1af9){var _0x1d8012={};_0x1d8012[_0x5a1af9]={'$like':'%'+_0x40d3e8[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x1d8012;})});}_0x54f0e4=_['merge']({},_0x54f0e4,_0x40d3e8[_0xad68('0x4d')]);return _0x1813dd['getGroups'](_0x54f0e4);}})[_0xad68('0x15')](function(_0x5b621e){if(_0x5b621e){_0xb1cfa4=_0x5b621e[_0xad68('0x54')];if(!_0x40d3e8[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x54f0e4[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x40d3e8['query']['limit']);_0x54f0e4['offset']=qs[_0xad68('0x25')](_0x40d3e8[_0xad68('0x38')][_0xad68('0x25')]);}return _0x1813dd[_0xad68('0xa6')](_0x54f0e4);}})['then'](function(_0x1c5073){if(_0x1c5073){return _0x1c5073?{'count':_0xb1cfa4,'rows':_0x1c5073}:null;}})[_0xad68('0x15')](respondWithResult(_0x53953c,null))[_0xad68('0x20')](handleError(_0x53953c,null));};exports[_0xad68('0xa8')]=function(_0xb4f35f,_0x2c50d2,_0x1249df){var _0x1f8085={'raw':!![],'where':{}};var _0x1bd2f8={};var _0x4f00e6={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0xb4f35f['params']['id']}})['then'](handleEntityNotFound(_0x2c50d2,null))[_0xad68('0x15')](function(_0x24bcab){if(_0x24bcab){_0x1bd2f8[_0xad68('0x33')]=_[_0xad68('0x35')](db['VoiceRecording'][_0xad68('0x32')]);_0x1bd2f8[_0xad68('0x38')]=_['keys'](_0xb4f35f[_0xad68('0x38')]);_0x1bd2f8[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x1bd2f8[_0xad68('0x33')],_0x1bd2f8[_0xad68('0x38')]);_0x1f8085[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x1bd2f8[_0xad68('0x33')],qs[_0xad68('0x3e')](_0xb4f35f['query']['fields']));_0x1f8085[_0xad68('0x3c')]=_0x1f8085[_0xad68('0x3c')][_0xad68('0x54')]?_0x1f8085[_0xad68('0x3c')]:_0x1bd2f8[_0xad68('0x33')];if(!_0xb4f35f[_0xad68('0x38')][_0xad68('0x3f')]('nolimit')){_0x1f8085['limit']=qs[_0xad68('0x41')](_0xb4f35f[_0xad68('0x38')][_0xad68('0x41')]);_0x1f8085[_0xad68('0x25')]=qs[_0xad68('0x25')](_0xb4f35f[_0xad68('0x38')]['offset']);}_0x1f8085[_0xad68('0x42')]=qs[_0xad68('0x43')](_0xb4f35f['query'][_0xad68('0x43')]);_0x1f8085[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0xb4f35f[_0xad68('0x38')],_0x1bd2f8[_0xad68('0x3b')]));_0x1f8085[_0xad68('0x48')][_0xad68('0xa9')]=_0x24bcab['id'];if(_0xb4f35f[_0xad68('0x38')][_0xad68('0xa2')]){_0x1f8085[_0xad68('0x48')]=_['merge'](_0x1f8085[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1f8085[_0xad68('0x3c')],function(_0x7bb4a5){var _0x4ffd01={};_0x4ffd01[_0x7bb4a5]={'$like':'%'+_0xb4f35f[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x4ffd01;})});}_0x1f8085=_['merge']({},_0x1f8085,_0xb4f35f[_0xad68('0x4d')]);return db[_0xad68('0xaa')][_0xad68('0x24')]({'where':_0x1f8085['where']})[_0xad68('0x15')](function(_0x27d21d){_0x4f00e6[_0xad68('0x24')]=_0x27d21d;if(_0xb4f35f['query'][_0xad68('0x4e')]){_0x1f8085[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0xaa')][_0xad68('0x50')](_0x1f8085);})[_0xad68('0x15')](function(_0x475984){_0x4f00e6[_0xad68('0x51')]=_0x475984;return _0x4f00e6;});}})[_0xad68('0x15')](respondWithFilteredResult(_0x2c50d2,_0x1f8085))[_0xad68('0x20')](handleError(_0x2c50d2,null));};exports[_0xad68('0xab')]=function(_0x27bf0a,_0x2c30c2,_0x5429c2){var _0x119ef2={};var _0x149454={};var _0x21415d;var _0x188484;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x27bf0a[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x2c30c2,null))[_0xad68('0x15')](function(_0x4616a7){if(_0x4616a7){_0x21415d=_0x4616a7;_0x149454[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xac')][_0xad68('0x32')]);_0x149454['query']=_[_0xad68('0x35')](_0x27bf0a[_0xad68('0x38')]);_0x149454[_0xad68('0x3b')]=_['intersection'](_0x149454[_0xad68('0x33')],_0x149454[_0xad68('0x38')]);_0x119ef2[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x149454[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x3e')]));_0x119ef2['attributes']=_0x119ef2['attributes'][_0xad68('0x54')]?_0x119ef2[_0xad68('0x3c')]:_0x149454['model'];_0x119ef2[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x43')]);_0x119ef2[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x27bf0a[_0xad68('0x38')],_0x149454[_0xad68('0x3b')]));if(_0x27bf0a[_0xad68('0x38')]['filter']){_0x119ef2['where']=_[_0xad68('0x47')](_0x119ef2[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x119ef2[_0xad68('0x3c')],function(_0x4f3ca6){var _0x48b9e5={};_0x48b9e5[_0x4f3ca6]={'$like':'%'+_0x27bf0a[_0xad68('0x38')]['filter']+'%'};return _0x48b9e5;})});}_0x119ef2=_[_0xad68('0x47')]({},_0x119ef2,_0x27bf0a[_0xad68('0x4d')]);return _0x21415d[_0xad68('0xab')](_0x119ef2);}})[_0xad68('0x15')](function(_0x35c779){if(_0x35c779){_0x188484=_0x35c779[_0xad68('0x54')];if(!_0x27bf0a['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x119ef2[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x41')]);_0x119ef2['offset']=qs[_0xad68('0x25')](_0x27bf0a[_0xad68('0x38')][_0xad68('0x25')]);}return _0x21415d[_0xad68('0xab')](_0x119ef2);}})[_0xad68('0x15')](function(_0x52fbb7){if(_0x52fbb7){return _0x52fbb7?{'count':_0x188484,'rows':_0x52fbb7}:null;}})[_0xad68('0x15')](respondWithResult(_0x2c30c2,null))[_0xad68('0x20')](handleError(_0x2c30c2,null));};exports[_0xad68('0xad')]=function(_0xd69a4a,_0x350ba4,_0x27a731){var _0x43dd47={};var _0x148ff1={};var _0x7df5fa;var _0x2368f9;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0xd69a4a[_0xad68('0x53')]['id']}})['then'](handleEntityNotFound(_0x350ba4,null))[_0xad68('0x15')](function(_0x5b808c){if(_0x5b808c){_0x7df5fa=_0x5b808c;_0x148ff1['model']=_[_0xad68('0x35')](db[_0xad68('0xae')][_0xad68('0x32')]);_0x148ff1[_0xad68('0x38')]=_[_0xad68('0x35')](_0xd69a4a[_0xad68('0x38')]);_0x148ff1['filters']=_['intersection'](_0x148ff1[_0xad68('0x33')],_0x148ff1[_0xad68('0x38')]);_0x43dd47['attributes']=_[_0xad68('0x3d')](_0x148ff1[_0xad68('0x33')],qs[_0xad68('0x3e')](_0xd69a4a[_0xad68('0x38')][_0xad68('0x3e')]));_0x43dd47[_0xad68('0x3c')]=_0x43dd47[_0xad68('0x3c')]['length']?_0x43dd47[_0xad68('0x3c')]:_0x148ff1['model'];_0x43dd47[_0xad68('0x42')]=qs[_0xad68('0x43')](_0xd69a4a[_0xad68('0x38')][_0xad68('0x43')]);_0x43dd47['where']=qs['filters'](_['pick'](_0xd69a4a[_0xad68('0x38')],_0x148ff1['filters']));if(_0xd69a4a['query'][_0xad68('0xa2')]){_0x43dd47[_0xad68('0x48')]=_[_0xad68('0x47')](_0x43dd47[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x43dd47[_0xad68('0x3c')],function(_0x58d78e){var _0x5b5804={};_0x5b5804[_0x58d78e]={'$like':'%'+_0xd69a4a[_0xad68('0x38')]['filter']+'%'};return _0x5b5804;})});}_0x43dd47=_[_0xad68('0x47')]({},_0x43dd47,_0xd69a4a[_0xad68('0x4d')]);return _0x7df5fa[_0xad68('0xad')](_0x43dd47);}})[_0xad68('0x15')](function(_0x92baad){if(_0x92baad){_0x2368f9=_0x92baad[_0xad68('0x54')];if(!_0xd69a4a[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x43dd47[_0xad68('0x41')]=qs['limit'](_0xd69a4a[_0xad68('0x38')][_0xad68('0x41')]);_0x43dd47[_0xad68('0x25')]=qs['offset'](_0xd69a4a[_0xad68('0x38')][_0xad68('0x25')]);}return _0x7df5fa[_0xad68('0xad')](_0x43dd47);}})[_0xad68('0x15')](function(_0x2c8c5d){if(_0x2c8c5d){return _0x2c8c5d?{'count':_0x2368f9,'rows':_0x2c8c5d}:null;}})[_0xad68('0x15')](respondWithResult(_0x350ba4,null))['catch'](handleError(_0x350ba4,null));};exports[_0xad68('0xaf')]=function(_0x55defe,_0x571066,_0x553b88){var _0x53da8c={'raw':!![],'where':{}};var _0x16a70f={};var _0x37264e={'count':0x0,'rows':[]};return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x55defe[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x571066,null))[_0xad68('0x15')](function(_0x1b7ec0){if(_0x1b7ec0){_0x16a70f['model']=_[_0xad68('0x35')](db[_0xad68('0xb0')][_0xad68('0x32')]);_0x16a70f['query']=_[_0xad68('0x35')](_0x55defe[_0xad68('0x38')]);_0x16a70f[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x16a70f[_0xad68('0x33')],_0x16a70f[_0xad68('0x38')]);_0x53da8c[_0xad68('0x3c')]=_['intersection'](_0x16a70f[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x55defe[_0xad68('0x38')][_0xad68('0x3e')]));_0x53da8c['attributes']=_0x53da8c[_0xad68('0x3c')][_0xad68('0x54')]?_0x53da8c['attributes']:_0x16a70f[_0xad68('0x33')];if(!_0x55defe['query']['hasOwnProperty'](_0xad68('0x40'))){_0x53da8c[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x55defe[_0xad68('0x38')][_0xad68('0x41')]);_0x53da8c[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x55defe[_0xad68('0x38')][_0xad68('0x25')]);}_0x53da8c['order']=qs['sort'](_0x55defe[_0xad68('0x38')]['sort']);_0x53da8c['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x55defe['query'],_0x16a70f[_0xad68('0x3b')]));_0x53da8c[_0xad68('0x48')][_0xad68('0xa9')]=_0x1b7ec0['id'];if(_0x55defe[_0xad68('0x38')][_0xad68('0xa2')]){_0x53da8c[_0xad68('0x48')]=_[_0xad68('0x47')](_0x53da8c[_0xad68('0x48')],{'$or':_['map'](_0x53da8c['attributes'],function(_0xd8100e){var _0x32c7e0={};_0x32c7e0[_0xd8100e]={'$like':'%'+_0x55defe['query'][_0xad68('0xa2')]+'%'};return _0x32c7e0;})});}_0x53da8c=_['merge']({},_0x53da8c,_0x55defe[_0xad68('0x4d')]);return db[_0xad68('0xb0')][_0xad68('0x24')]({'where':_0x53da8c['where']})[_0xad68('0x15')](function(_0x1289e5){_0x37264e[_0xad68('0x24')]=_0x1289e5;if(_0x55defe[_0xad68('0x38')]['includeAll']){_0x53da8c[_0xad68('0x4f')]=[{'all':!![]}];}return db[_0xad68('0xb0')]['findAll'](_0x53da8c);})['then'](function(_0x10169f){_0x37264e[_0xad68('0x51')]=_0x10169f;return _0x37264e;});}})[_0xad68('0x15')](respondWithFilteredResult(_0x571066,_0x53da8c))[_0xad68('0x20')](handleError(_0x571066,null));};exports[_0xad68('0xb1')]=function(_0x2edb0b,_0x3d4d05,_0x34e779){var _0x4f2a1b={};var _0xf0720a={};var _0x5bac6a;var _0x23f317;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x2edb0b['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x3d4d05,null))[_0xad68('0x15')](function(_0x277d9b){if(_0x277d9b){_0x5bac6a=_0x277d9b;_0xf0720a[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xb2')][_0xad68('0x32')]);_0xf0720a[_0xad68('0x38')]=_['keys'](_0x2edb0b['query']);_0xf0720a[_0xad68('0x3b')]=_['intersection'](_0xf0720a[_0xad68('0x33')],_0xf0720a[_0xad68('0x38')]);_0x4f2a1b['attributes']=_['intersection'](_0xf0720a['model'],qs['fields'](_0x2edb0b[_0xad68('0x38')]['fields']));_0x4f2a1b['attributes']=_0x4f2a1b[_0xad68('0x3c')][_0xad68('0x54')]?_0x4f2a1b[_0xad68('0x3c')]:_0xf0720a[_0xad68('0x33')];_0x4f2a1b[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x2edb0b[_0xad68('0x38')]['sort']);_0x4f2a1b['where']=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x2edb0b['query'],_0xf0720a[_0xad68('0x3b')]));if(_0x2edb0b[_0xad68('0x38')][_0xad68('0xa2')]){_0x4f2a1b[_0xad68('0x48')]=_[_0xad68('0x47')](_0x4f2a1b[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x4f2a1b[_0xad68('0x3c')],function(_0x307fdc){var _0x7e57fb={};_0x7e57fb[_0x307fdc]={'$like':'%'+_0x2edb0b[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x7e57fb;})});}_0x4f2a1b=_[_0xad68('0x47')]({},_0x4f2a1b,_0x2edb0b[_0xad68('0x4d')]);return _0x5bac6a[_0xad68('0xb1')](_0x4f2a1b);}})[_0xad68('0x15')](function(_0x27b25c){if(_0x27b25c){_0x23f317=_0x27b25c[_0xad68('0x54')];if(!_0x2edb0b[_0xad68('0x38')]['hasOwnProperty'](_0xad68('0x40'))){_0x4f2a1b['limit']=qs[_0xad68('0x41')](_0x2edb0b[_0xad68('0x38')][_0xad68('0x41')]);_0x4f2a1b['offset']=qs['offset'](_0x2edb0b['query'][_0xad68('0x25')]);}return _0x5bac6a[_0xad68('0xb1')](_0x4f2a1b);}})[_0xad68('0x15')](function(_0x512bbd){if(_0x512bbd){return _0x512bbd?{'count':_0x23f317,'rows':_0x512bbd}:null;}})['then'](respondWithResult(_0x3d4d05,null))[_0xad68('0x20')](handleError(_0x3d4d05,null));};exports[_0xad68('0xb3')]=function(_0x27b59e,_0x2e9ff9,_0x1b19cb){var _0x4d3857={};var _0x3b07d1={};var _0x34827f;var _0x493877;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x27b59e[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x2e9ff9,null))['then'](function(_0x566fee){if(_0x566fee){_0x34827f=_0x566fee;_0x3b07d1['model']=_[_0xad68('0x35')](db[_0xad68('0xb4')][_0xad68('0x32')]);_0x3b07d1[_0xad68('0x38')]=_[_0xad68('0x35')](_0x27b59e['query']);_0x3b07d1['filters']=_['intersection'](_0x3b07d1[_0xad68('0x33')],_0x3b07d1['query']);_0x4d3857[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x3b07d1[_0xad68('0x33')],qs[_0xad68('0x3e')](_0x27b59e[_0xad68('0x38')][_0xad68('0x3e')]));_0x4d3857[_0xad68('0x3c')]=_0x4d3857[_0xad68('0x3c')][_0xad68('0x54')]?_0x4d3857[_0xad68('0x3c')]:_0x3b07d1['model'];_0x4d3857['order']=qs[_0xad68('0x43')](_0x27b59e[_0xad68('0x38')][_0xad68('0x43')]);_0x4d3857[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x27b59e['query'],_0x3b07d1[_0xad68('0x3b')]));if(_0x27b59e[_0xad68('0x38')][_0xad68('0xa2')]){_0x4d3857[_0xad68('0x48')]=_[_0xad68('0x47')](_0x4d3857[_0xad68('0x48')],{'$or':_['map'](_0x4d3857['attributes'],function(_0xd1d4d1){var _0xcd1927={};_0xcd1927[_0xd1d4d1]={'$like':'%'+_0x27b59e[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0xcd1927;})});}_0x4d3857=_['merge']({},_0x4d3857,_0x27b59e[_0xad68('0x4d')]);return _0x34827f[_0xad68('0xb3')](_0x4d3857);}})[_0xad68('0x15')](function(_0x43858a){if(_0x43858a){_0x493877=_0x43858a['length'];if(!_0x27b59e['query'][_0xad68('0x3f')](_0xad68('0x40'))){_0x4d3857['limit']=qs[_0xad68('0x41')](_0x27b59e[_0xad68('0x38')][_0xad68('0x41')]);_0x4d3857[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x27b59e[_0xad68('0x38')]['offset']);}return _0x34827f['getFaxInteractions'](_0x4d3857);}})[_0xad68('0x15')](function(_0xba4af4){if(_0xba4af4){return _0xba4af4?{'count':_0x493877,'rows':_0xba4af4}:null;}})[_0xad68('0x15')](respondWithResult(_0x2e9ff9,null))[_0xad68('0x20')](handleError(_0x2e9ff9,null));};exports[_0xad68('0xb5')]=function(_0x37b2cd,_0x4b4687,_0x87120){var _0x3b0a9f;var _0x59f055;var _0x3d3df4;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x37b2cd[_0xad68('0x53')]['id'],'role':_0xad68('0x5b')},'attributes':['id','name',_0xad68('0xb6'),_0xad68('0xb7'),_0xad68('0x5d'),_0xad68('0x6c'),_0xad68('0x85')]})['then'](handleEntityNotFound(_0x4b4687,null))[_0xad68('0x15')](function(_0x4e628e){if(_0x4e628e){_0x3b0a9f=_0x4e628e;_0x3d3df4=_0x37b2cd[_0xad68('0x56')][_0xad68('0xb8')]&&_0x3b0a9f[_0x37b2cd['body'][_0xad68('0xb8')]]?util['format'](_0xad68('0xb9'),_0x3b0a9f[_0x37b2cd[_0xad68('0x56')][_0xad68('0xb8')]]):util[_0xad68('0x66')]('SIP/%s',_0x3b0a9f[_0xad68('0x2e')]);socket['to'](util[_0xad68('0x66')](_0xad68('0xba'),_0x3b0a9f[_0xad68('0x2e')]))[_0xad68('0xbb')]('user:forcelogout',{'ip':_0x37b2cd[_0xad68('0xbc')][_0xad68('0xbd')]||_0x37b2cd[_0xad68('0xbe')][_0xad68('0xbf')]||_0x37b2cd[_0xad68('0xc0')][_0xad68('0xbf')]||_0x37b2cd[_0xad68('0xbe')][_0xad68('0xc0')][_0xad68('0xbf')]});return db[_0xad68('0x93')][_0xad68('0x2c')]({'where':{'membername':_0x3b0a9f[_0xad68('0x2e')]},'individualHooks':!![]});}})['then'](function(_0x421d67){if(_0x3b0a9f){return _0x3b0a9f['getVoiceQueues']({'raw':!![]});}})[_0xad68('0x15')](function(_0x1afb5b){var _0x794d9a=[];if(_0x1afb5b){_0x59f055=_0x1afb5b;if(_0x59f055['length']){for(var _0x3df01b=0x0;_0x3df01b<_0x59f055['length'];_0x3df01b++){_0x794d9a[_0xad68('0xc1')]({'membername':_0x3b0a9f[_0xad68('0x2e')],'UserId':_0x3b0a9f['id'],'queue_name':_0x59f055[_0x3df01b]['name'],'VoiceQueueId':_0x59f055[_0x3df01b]['id'],'interface':_0x3d3df4||util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x3b0a9f[_0xad68('0x2e')]),'paused':_0x3b0a9f[_0xad68('0x85')]||![],'penalty':_0x59f055[_0x3df01b][_0xad68('0xc2')]||0x0});}return BPromise[_0xad68('0x92')](_0x794d9a,function(_0xd44aa5){return db[_0xad68('0x93')][_0xad68('0x94')](_0xd44aa5);});}}})[_0xad68('0x15')](function(){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x3b0a9f[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x3b0a9f['name']),'exitAt':null}});})[_0xad68('0x15')](function(_0x42d6df){var _0x551adc=[];_0x42d6df['forEach'](function(_0xbb95fc){_0x551adc[_0xad68('0xc1')](_0xbb95fc[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4'))}));});return BPromise[_0xad68('0xc5')](_0x551adc);})[_0xad68('0x15')](function(){var _0x228d02=[];var _0x30d39=[];var _0x258c33=utils[_0xad68('0xc6')]();var _0x5a769a={'membername':_0x3b0a9f[_0xad68('0x2e')],'interface':util['format'](_0xad68('0x90'),_0xad68('0x91'),_0x3b0a9f[_0xad68('0x2e')]),'enterAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'role':_0x3b0a9f['role'],'internal':_0x3b0a9f[_0xad68('0x6c')]};_0x258c33[_0xad68('0xc7')](function(_0x37724c){_0x228d02[_0xad68('0xc1')](_['merge']({'channel':_0x37724c,'type':_0xad68('0xc8'),'data1':_0x37b2cd['body'][_0xad68('0xc9')],'data2':_0x3d3df4},_0x5a769a));if(_0x3b0a9f['loginInPause']){_0x30d39[_0xad68('0xc1')](_['merge']({'channel':_0x37724c,'type':_0xad68('0xca'),'data1':_0xad68('0xcb')},_0x5a769a));}});return db[_0xad68('0xc3')][_0xad68('0x55')](_0x228d02[_0xad68('0xcc')](_0x30d39),{'individualHooks':!![]});})[_0xad68('0x15')](function(){return _0x3b0a9f[_0xad68('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'voicePause':_0x3b0a9f[_0xad68('0x85')]||![],'mailPause':_0x3b0a9f[_0xad68('0x85')]||![],'chatPause':_0x3b0a9f[_0xad68('0x85')]||![],'faxPause':_0x3b0a9f[_0xad68('0x85')]||![],'smsPause':_0x3b0a9f['loginInPause']||![],'openchannelPause':_0x3b0a9f['loginInPause']||![],'pauseType':_0x3b0a9f['loginInPause']?_0xad68('0xcb'):null,'lastPauseAt':moment()[_0xad68('0x66')](_0xad68('0xc4'))});})[_0xad68('0x15')](respondWithResult(_0x4b4687,null))[_0xad68('0x20')](handleError(_0x4b4687,null));};exports['logout']=function(_0x2be781,_0x5dc750,_0x25575f){var _0x49079b;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x2be781['params']['id'],'role':_0xad68('0x5b')},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d')]})[_0xad68('0x15')](handleEntityNotFound(_0x5dc750,null))[_0xad68('0x15')](function(_0x3c97bb){if(_0x3c97bb){_0x49079b=_0x3c97bb;return db[_0xad68('0x93')]['destroy']({'where':{'membername':_0x49079b[_0xad68('0x2e')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x49079b[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x49079b[_0xad68('0x2e')]),'exitAt':null}});})[_0xad68('0x15')](function(_0x4c88a8){var _0x1c1951=[];_0x4c88a8[_0xad68('0xc7')](function(_0x42fa52){_0x1c1951[_0xad68('0xc1')](_0x42fa52[_0xad68('0x2b')]({'exitAt':moment()['format'](_0xad68('0xc4'))}));});return BPromise[_0xad68('0xc5')](_0x1c1951);})[_0xad68('0x15')](function(){return _0x49079b[_0xad68('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});})['then'](respondWithResult(_0x5dc750,null))[_0xad68('0x20')](handleError(_0x5dc750,null));};exports['pause']=function(_0x4d0e7b,_0x5e7e5d,_0xc6aaa1){var _0x34f1f7;return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x1},{'where':{'UserId':_0x4d0e7b[_0xad68('0x53')]['id']},'individualHooks':!![]})[_0xad68('0x15')](function(){return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x4d0e7b[_0xad68('0x53')]['id'],'role':_0xad68('0x5b')},'attributes':['id','name',_0xad68('0x5d'),_0xad68('0x6c')]});})[_0xad68('0x15')](handleEntityNotFound(_0x5e7e5d,null))[_0xad68('0x15')](function(_0x89a9fd){if(_0x89a9fd){_0x34f1f7=_0x89a9fd;return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xce'),{'id':_0x34f1f7['id'],'name':_0x34f1f7[_0xad68('0x2e')],'pause':!![]});}})[_0xad68('0x15')](function(){if(_0x34f1f7){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x34f1f7[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x34f1f7[_0xad68('0x2e')]),'type':'PAUSE','exitAt':null}});}})[_0xad68('0x15')](function(_0x1b1a17){if(_0x1b1a17[_0xad68('0x54')]){var _0xd6cc76=moment()[_0xad68('0x66')](_0xad68('0xc4'));for(var _0x1f89c9=0x0,_0x32215a=_0x1b1a17['length'];_0x1f89c9<_0x32215a;_0x1f89c9++){_0x1b1a17[_0x1f89c9][_0xad68('0xcf')]({'exitAt':_0xd6cc76});}}})[_0xad68('0x15')](function(){var _0x8232b3=[];var _0x915de7=utils[_0xad68('0xc6')]();_0x915de7[_0xad68('0xc7')](function(_0xf152f1){_0x8232b3[_0xad68('0xc1')]({'channel':_0xf152f1,'membername':_0x34f1f7[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x34f1f7[_0xad68('0x2e')]),'type':_0xad68('0xca'),'enterAt':moment()[_0xad68('0x66')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x4d0e7b['body'][_0xad68('0xd0')]||_0xad68('0xd1'),'role':_0x34f1f7[_0xad68('0x5d')],'internal':_0x34f1f7[_0xad68('0x6c')]});});return db['MemberReport'][_0xad68('0x55')](_0x8232b3,{'individualHooks':!![]});})[_0xad68('0x15')](function(){return _0x34f1f7[_0xad68('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x4d0e7b[_0xad68('0x56')][_0xad68('0xd0')]||_0xad68('0xd1'),'lastPauseAt':moment()['format'](_0xad68('0xc4'))});})[_0xad68('0x15')](respondWithResult(_0x5e7e5d,null))[_0xad68('0x20')](handleError(_0x5e7e5d,null));};exports[_0xad68('0xd2')]=function(_0x201168,_0x34f6c0,_0x5ea1bf){var _0x1fce9e;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x201168['params']['id']},'attributes':['id',_0xad68('0x2e'),_0xad68('0x5d'),_0xad68('0x86'),_0xad68('0xd3'),_0xad68('0xd4'),_0xad68('0xd5'),_0xad68('0xd6'),_0xad68('0xd7'),_0xad68('0xd8'),'lastPauseAt']})[_0xad68('0x15')](handleEntityNotFound(_0x34f6c0,null))[_0xad68('0x15')](function(_0x647fc7){if(_0x647fc7){_0x1fce9e=_0x647fc7;if(_0x201168[_0xad68('0x56')][_0xad68('0x88')]&&!utils[_0xad68('0x87')](_0x201168['body'][_0xad68('0x88')])){throw new db[(_0xad68('0x80'))][(_0xad68('0x7d'))](_0xad68('0x89'));}switch(_0x201168[_0xad68('0x56')][_0xad68('0x88')]){case'voice':return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xd2'),{'id':_0x1fce9e['id'],'name':_0x1fce9e['name'],'pause':![]})[_0xad68('0x15')](function(){return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1fce9e['id']},'individualHooks':!![]});})['then'](function(){return db[_0xad68('0xc3')][_0xad68('0x57')]({'where':{'channel':_0x201168[_0xad68('0x56')][_0xad68('0x88')],'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),_0xad68('0x91'),_0x1fce9e[_0xad68('0x2e')]),'type':_0xad68('0xca'),'exitAt':null}});})[_0xad68('0x15')](function(_0x71d0c){if(_0x71d0c){return _0x71d0c[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'data2':_0xad68('0xd9')},{'individualHooks':!![]});}return null;})[_0xad68('0x15')](function(){return _0x1fce9e[_0xad68('0x2b')]({'voicePause':![]});});case _0xad68('0xda'):case _0xad68('0xdb'):case _0xad68('0xdc'):case _0xad68('0xdd'):case'openchannel':return db[_0xad68('0xc3')][_0xad68('0x57')]({'where':{'channel':_0x201168['body'][_0xad68('0x88')],'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')](_0xad68('0x90'),'SIP',_0x1fce9e['name']),'type':'PAUSE','exitAt':null}})['then'](function(_0x163a14){if(_0x163a14){return _0x163a14[_0xad68('0x2b')]({'exitAt':moment()[_0xad68('0x66')](_0xad68('0xc4')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xad68('0x15')](function(){var _0x3f74ba={};_[_0xad68('0xde')](_0x3f74ba,util[_0xad68('0x66')](_0xad68('0xdf'),_0x201168[_0xad68('0x56')]['channel'],'Pause'),![]);return _0x1fce9e[_0xad68('0x2b')](_0x3f74ba);});default:return respondWithRpcPromise(_0xad68('0xcd'),_0xad68('0xd2'),{'id':_0x1fce9e['id'],'name':_0x1fce9e['name'],'pause':![]})[_0xad68('0x15')](function(){return db[_0xad68('0x93')][_0xad68('0x2b')]({'paused':0x0},{'where':{'UserId':_0x1fce9e['id']}});})[_0xad68('0x15')](function(){return db[_0xad68('0xc3')][_0xad68('0x50')]({'where':{'membername':_0x1fce9e[_0xad68('0x2e')],'interface':util[_0xad68('0x66')]('%s/%s',_0xad68('0x91'),_0x1fce9e[_0xad68('0x2e')]),'type':_0xad68('0xca'),'exitAt':null}});})[_0xad68('0x15')](function(_0x4f3a01){var _0x3ba7f9=[];_0x4f3a01[_0xad68('0xc7')](function(_0x5104e5){_0x3ba7f9[_0xad68('0xc1')](_0x5104e5[_0xad68('0x2b')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xad68('0xd9')}));});return BPromise[_0xad68('0xc5')](_0x3ba7f9);})[_0xad68('0x15')](function(){return _0x1fce9e['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xad68('0x15')](respondWithResult(_0x34f6c0,null))[_0xad68('0x20')](handleError(_0x34f6c0,null));};exports['getTeams']=function(_0x337787,_0x202532,_0x8fcbc5){var _0x24403b={};var _0x59dafd={};var _0x252ca6;var _0x2a933c;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x337787[_0xad68('0x53')]['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x202532,null))[_0xad68('0x15')](function(_0x53b257){if(_0x53b257){_0x252ca6=_0x53b257;_0x59dafd['model']=_['keys'](db['Team'][_0xad68('0x32')]);_0x59dafd[_0xad68('0x38')]=_[_0xad68('0x35')](_0x337787[_0xad68('0x38')]);_0x59dafd['filters']=_[_0xad68('0x3d')](_0x59dafd['model'],_0x59dafd[_0xad68('0x38')]);_0x24403b['attributes']=_[_0xad68('0x3d')](_0x59dafd['model'],qs[_0xad68('0x3e')](_0x337787['query']['fields']));_0x24403b['attributes']=_0x24403b[_0xad68('0x3c')]['length']?_0x24403b['attributes']:_0x59dafd['model'];_0x24403b[_0xad68('0x42')]=qs[_0xad68('0x43')](_0x337787['query'][_0xad68('0x43')]);_0x24403b['where']=qs['filters'](_['pick'](_0x337787['query'],_0x59dafd['filters']));if(_0x337787[_0xad68('0x38')][_0xad68('0xa2')]){_0x24403b['where']=_[_0xad68('0x47')](_0x24403b[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x24403b[_0xad68('0x3c')],function(_0x3bffb6){var _0x52d8f9={};_0x52d8f9[_0x3bffb6]={'$like':'%'+_0x337787[_0xad68('0x38')]['filter']+'%'};return _0x52d8f9;})});}_0x24403b=_[_0xad68('0x47')]({},_0x24403b,_0x337787[_0xad68('0x4d')]);return _0x252ca6[_0xad68('0xe0')](_0x24403b);}})[_0xad68('0x15')](function(_0x3c8efa){if(_0x3c8efa){_0x2a933c=_0x3c8efa[_0xad68('0x54')];if(!_0x337787[_0xad68('0x38')][_0xad68('0x3f')](_0xad68('0x40'))){_0x24403b['limit']=qs['limit'](_0x337787[_0xad68('0x38')][_0xad68('0x41')]);_0x24403b[_0xad68('0x25')]=qs[_0xad68('0x25')](_0x337787['query']['offset']);}return _0x252ca6[_0xad68('0xe0')](_0x24403b);}})[_0xad68('0x15')](function(_0x135b31){if(_0x135b31){return _0x135b31?{'count':_0x2a933c,'rows':_0x135b31}:null;}})[_0xad68('0x15')](respondWithResult(_0x202532,null))[_0xad68('0x20')](handleError(_0x202532,null));};exports[_0xad68('0xe1')]=function(_0x3dcb7d,_0x274414,_0x9f12e0){return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x3dcb7d[_0xad68('0x53')]['id']}})['then'](handleEntityNotFound(_0x274414,null))[_0xad68('0x15')](function(_0x38c27f){if(_0x38c27f){return _0x38c27f[_0xad68('0xe1')](_0x3dcb7d[_0xad68('0x56')][_0xad68('0x5a')],_[_0xad68('0xe2')](_0x3dcb7d[_0xad68('0x56')],[_0xad68('0x5a'),'id'])||{});}})[_0xad68('0x15')](respondWithResult(_0x274414,null))[_0xad68('0x20')](handleError(_0x274414,null));};exports[_0xad68('0xe3')]=function(_0x349c10,_0x513f06,_0x2917ec){var _0x572621;return db[_0xad68('0x31')][_0xad68('0x57')]({'where':{'id':_0x349c10['params']['id']}})['then'](handleEntityNotFound(_0x513f06,null))[_0xad68('0x15')](function(_0x480da6){if(_0x480da6){return _0x480da6[_0xad68('0xe3')](_0x349c10[_0xad68('0x38')][_0xad68('0x5a')]);}})[_0xad68('0x15')](respondWithStatusCode(_0x513f06,null))['catch'](handleError(_0x513f06,null));};exports['getLists']=function(_0x138d51,_0x519908,_0x473afa){var _0x1f4b93={};var _0x438f7a={};var _0x34720b;var _0x2f910d;return db[_0xad68('0x31')][_0xad68('0xa0')]({'where':{'id':_0x138d51['params']['id']}})['then'](handleEntityNotFound(_0x519908,null))[_0xad68('0x15')](function(_0x41b7fa){if(_0x41b7fa){_0x34720b=_0x41b7fa;_0x438f7a[_0xad68('0x33')]=_[_0xad68('0x35')](db[_0xad68('0xe4')]['rawAttributes']);_0x438f7a[_0xad68('0x38')]=_[_0xad68('0x35')](_0x138d51[_0xad68('0x38')]);_0x438f7a[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x438f7a['model'],_0x438f7a[_0xad68('0x38')]);_0x1f4b93[_0xad68('0x3c')]=_[_0xad68('0x3d')](_0x438f7a['model'],qs['fields'](_0x138d51[_0xad68('0x38')]['fields']));_0x1f4b93['attributes']=_0x1f4b93[_0xad68('0x3c')][_0xad68('0x54')]?_0x1f4b93[_0xad68('0x3c')]:_0x438f7a[_0xad68('0x33')];_0x1f4b93['order']=qs[_0xad68('0x43')](_0x138d51[_0xad68('0x38')][_0xad68('0x43')]);_0x1f4b93[_0xad68('0x48')]=qs[_0xad68('0x3b')](_[_0xad68('0x44')](_0x138d51[_0xad68('0x38')],_0x438f7a[_0xad68('0x3b')]));if(_0x138d51[_0xad68('0x38')][_0xad68('0xa2')]){_0x1f4b93[_0xad68('0x48')]=_[_0xad68('0x47')](_0x1f4b93[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x1f4b93['attributes'],function(_0x29a453){var _0x2ca455={};_0x2ca455[_0x29a453]={'$like':'%'+_0x138d51[_0xad68('0x38')][_0xad68('0xa2')]+'%'};return _0x2ca455;})});}_0x1f4b93=_[_0xad68('0x47')]({},_0x1f4b93,_0x138d51[_0xad68('0x4d')]);return _0x34720b[_0xad68('0xe5')](_0x1f4b93);}})[_0xad68('0x15')](function(_0x21fbf5){if(_0x21fbf5){_0x2f910d=_0x21fbf5[_0xad68('0x54')];if(!_0x138d51[_0xad68('0x38')][_0xad68('0x3f')]('nolimit')){_0x1f4b93[_0xad68('0x41')]=qs[_0xad68('0x41')](_0x138d51[_0xad68('0x38')][_0xad68('0x41')]);_0x1f4b93['offset']=qs[_0xad68('0x25')](_0x138d51['query'][_0xad68('0x25')]);}return _0x34720b[_0xad68('0xe5')](_0x1f4b93);}})['then'](function(_0x376831){if(_0x376831){return _0x376831?{'count':_0x2f910d,'rows':_0x376831}:null;}})[_0xad68('0x15')](respondWithResult(_0x519908,null))['catch'](handleError(_0x519908,null));};exports[_0xad68('0xe6')]=function(_0x5bbafd,_0x400a29,_0x23edff){var _0x24ff17={};var _0x124fc7={};var _0x174d19;var _0x371da0;return db['User'][_0xad68('0xa0')]({'where':{'id':_0x5bbafd['params']['id']}})[_0xad68('0x15')](handleEntityNotFound(_0x400a29,null))[_0xad68('0x15')](function(_0x36a1db){if(_0x36a1db){_0x174d19=_0x36a1db;_0x124fc7[_0xad68('0x33')]=_['keys'](db[_0xad68('0x31')][_0xad68('0x32')]);_0x124fc7[_0xad68('0x38')]=_['keys'](_0x5bbafd[_0xad68('0x38')]);_0x124fc7[_0xad68('0x3b')]=_[_0xad68('0x3d')](_0x124fc7[_0xad68('0x33')],_0x124fc7['query']);_0x24ff17['attributes']=_[_0xad68('0x3d')](_0x124fc7['model'],qs[_0xad68('0x3e')](_0x5bbafd[_0xad68('0x38')][_0xad68('0x3e')]));_0x24ff17[_0xad68('0x3c')]=_0x24ff17['attributes'][_0xad68('0x54')]?_0x24ff17[_0xad68('0x3c')]:_0x124fc7[_0xad68('0x33')];_0x24ff17[_0xad68('0x42')]=qs['sort'](_0x5bbafd[_0xad68('0x38')][_0xad68('0x43')]);_0x24ff17['where']=qs['filters'](_[_0xad68('0x44')](_0x5bbafd['query'],_0x124fc7[_0xad68('0x3b')]));if(_0x5bbafd['query'][_0xad68('0xa2')]){_0x24ff17[_0xad68('0x48')]=_[_0xad68('0x47')](_0x24ff17[_0xad68('0x48')],{'$or':_[_0xad68('0x49')](_0x24ff17[_0xad68('0x3c')],function(_0x18dd87){var _0x252053={};_0x252053[_0x18dd87]={'$like':'%'+_0x5bbafd[_0xad68('0x38')]['filter']+'%'};return _0x252053;})});}_0x24ff17['model']=db[_0xad68('0x31')];_0x24ff17['as']='Agents';_0x24ff17=_[_0xad68('0x47')]({},_0x24ff17,_0x5bbafd[_0xad68('0x4d')]);return _0x174d19[_0xad68('0xe7')]({'include':[_0x24ff17]});}})['then'](function(_0x545f76){if(_0x545f76){var _0x144666={},_0x2c052b=[],_0xbb6529=0x0;for(var _0x277659=0x0;_0x277659<_0x545f76[_0xad68('0x54')];_0x277659+=0x1){for(var _0x4b800a=0x0,_0x4ab37c;_0x4b800a<_0x545f76[_0x277659]['Agents']['length'];_0x4b800a+=0x1){_0x4ab37c=_0x545f76[_0x277659][_0xad68('0xe8')][_0x4b800a][_0xad68('0xa4')]({'plain':!![]});_0x144666[_0x4ab37c['id']]=_0x4ab37c;}}_0x144666=_[_0xad68('0xe9')](_0x144666);for(var _0x508569=qs[_0xad68('0x25')](_0x5bbafd[_0xad68('0x38')][_0xad68('0x25')]);_0x508569<_0x144666[_0xad68('0x54')]&&_0x2c052b[_0xad68('0x54')]=_0x1a410c[_0xdb1a('0x53')]){throw new Error(_0xdb1a('0x54'));}})[_0xdb1a('0x10')](function(){if(_0xfd9bd6){return db[_0xdb1a('0x2b')][_0xdb1a('0x4b')]({'where':{'membername':_0xfd9bd6[_0xdb1a('0x28')]},'individualHooks':!![]});}})[_0xdb1a('0x10')](function(){if(_0xfd9bd6){return _0xfd9bd6[_0xdb1a('0x55')]({'raw':!![]});}})[_0xdb1a('0x10')](function(_0x49282e){if(_0xfd9bd6){if(_0x49282e){var _0x5b69dd=[];_0x211922=_0x49282e;if(_0x211922[_0xdb1a('0x32')]){for(var _0x167d79=0x0;_0x167d79<_0x211922[_0xdb1a('0x32')];_0x167d79++){_0x5b69dd[_0xdb1a('0x49')](db[_0xdb1a('0x2b')][_0xdb1a('0x56')]({'membername':_0xfd9bd6[_0xdb1a('0x28')],'UserId':_0xfd9bd6['id'],'queue_name':_0x211922[_0x167d79]['name'],'VoiceQueueId':_0x211922[_0x167d79]['id'],'interface':_0x499483[_0xdb1a('0x36')][_0xdb1a('0x57')]||util[_0xdb1a('0x2e')](_0xdb1a('0x2f'),'SIP',_0xfd9bd6['name']),'paused':_0xfd9bd6[_0xdb1a('0x4e')]||![],'penalty':_0x211922[_0x167d79]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xdb1a('0x4c')](_0x5b69dd);}}}})['then'](function(){if(_0xfd9bd6){return db[_0xdb1a('0x39')][_0xdb1a('0x2d')]({'where':{'membername':_0xfd9bd6['name'],'interface':util['format']('%s/%s',_0xdb1a('0x30'),_0xfd9bd6[_0xdb1a('0x28')]),'exitAt':null}});}})['then'](function(_0x59b416){if(_0xfd9bd6){if(_0x59b416&&_0x59b416[_0xdb1a('0x32')]){var _0x426faa=[];_0x59b416[_0xdb1a('0x48')](function(_0x47d1d9){_0x426faa[_0xdb1a('0x49')](_0x47d1d9[_0xdb1a('0x2c')]({'exitAt':moment()['format'](_0xdb1a('0x33'))}));});return BPromise['all'](_0x426faa);}}})[_0xdb1a('0x10')](function(_0xa2c6fe){if(_0xfd9bd6){var _0x1397d6=[];var _0x1121f0=[];var _0x4a25cb=utils['getChannels']();var _0x1b5066={'membername':_0xfd9bd6[_0xdb1a('0x28')],'interface':util['format'](_0xdb1a('0x2f'),_0xdb1a('0x30'),_0xfd9bd6[_0xdb1a('0x28')]),'enterAt':moment()[_0xdb1a('0x2e')](_0xdb1a('0x33')),'role':_0xfd9bd6[_0xdb1a('0x29')],'internal':_0xfd9bd6[_0xdb1a('0x2a')]};_0x4a25cb[_0xdb1a('0x48')](function(_0x3a572f){_0x1397d6[_0xdb1a('0x49')](_[_0xdb1a('0x58')]({'channel':_0x3a572f,'type':_0xdb1a('0x59'),'data1':_0xdb1a('0x5a'),'data2':_0x499483[_0xdb1a('0x36')][_0xdb1a('0x57')]||util['format'](_0xdb1a('0x2f'),_0xdb1a('0x30'),_0xfd9bd6['name'])},_0x1b5066));if(_0xfd9bd6[_0xdb1a('0x4e')]){_0x1121f0[_0xdb1a('0x49')](_['merge']({'channel':_0x3a572f,'type':'PAUSE','data1':_0xdb1a('0x5b')},_0x1b5066));}});return db[_0xdb1a('0x39')][_0xdb1a('0x3a')](_0x1397d6[_0xdb1a('0x5c')](_0x1121f0),{'individualHooks':!![]});}})[_0xdb1a('0x10')](function(){if(_0xfd9bd6){return _0xfd9bd6['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0xfd9bd6['loginInPause']||![],'mailPause':_0xfd9bd6['loginInPause']||![],'chatPause':_0xfd9bd6['loginInPause']||![],'faxPause':_0xfd9bd6[_0xdb1a('0x4e')]||![],'smsPause':_0xfd9bd6[_0xdb1a('0x4e')]||![],'openchannelPause':_0xfd9bd6[_0xdb1a('0x4e')]||![],'pauseType':_0xfd9bd6['loginInPause']?_0xdb1a('0x5b'):null,'lastPauseAt':moment()[_0xdb1a('0x2e')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xdb1a('0x10')](function(_0x5ab192){_0x48aba2(_0x5ab192);})[_0xdb1a('0x1a')](function(_0x5b1ea1){_0x49d0f0(_0x530bd4[_0xdb1a('0x15')](0x1f4,_0x5b1ea1[_0xdb1a('0x18')]));});});}; \ No newline at end of file +var _0x6efe=['destroy','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','interface','UserVoiceQueue.penalty','merge','LOGIN','callysquare','loginInPause','bulkCreate','concat','LOGININPAUSE','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','socket.io-emitter','localhost','request','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','raw','limit','map','include','model','attributes','then','find','where','ShowUser','PauseUser','name','role','internal','UserVoiceQueueRt','update','format','%s/%s','SIP','PAUSE','length','getChannels','forEach','push','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','uniqueid','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','MemberReport','chat','sms','openchannel','system','set','%s%s','all','LogoutUser'];(function(_0x40db16,_0xadd8f0){var _0x11761b=function(_0x2f0cb4){while(--_0x2f0cb4){_0x40db16['push'](_0x40db16['shift']());}};_0x11761b(++_0xadd8f0);}(_0x6efe,0xc6));var _0xe6ef=function(_0xd2a9ed,_0x2a0ab1){_0xd2a9ed=_0xd2a9ed-0x0;var _0x8c7540=_0x6efe[_0xd2a9ed];return _0x8c7540;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var moment=require(_0xe6ef('0x2'));var BPromise=require(_0xe6ef('0x3'));var rs=require(_0xe6ef('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe6ef('0x5'))(_0xe6ef('0x6'));var config=require(_0xe6ef('0x7'));var jayson=require(_0xe6ef('0x8'));var client=jayson[_0xe6ef('0x9')]['http']({'port':0x232a});var socket=require(_0xe6ef('0xa'))({'host':_0xe6ef('0xb'),'port':0x18eb});require('./user.socket')['register'](socket);function respondWithRpcPromise(_0x51a9eb,_0x3256ff,_0x2aff16){return new BPromise(function(_0x3fe8fa,_0x4fca2f){return client[_0xe6ef('0xc')](_0x51a9eb,_0x2aff16)['then'](function(_0x110250){logger[_0xe6ef('0xd')](_0xe6ef('0xe'),_0x3256ff,_0xe6ef('0xf'));logger[_0xe6ef('0x10')](_0xe6ef('0x11'),_0x3256ff,_0xe6ef('0xf'),JSON[_0xe6ef('0x12')](_0x110250));if(_0x110250['error']){if(_0x110250[_0xe6ef('0x13')][_0xe6ef('0x14')]===0x1f4){logger[_0xe6ef('0x13')](_0xe6ef('0xe'),_0x3256ff,_0x110250['error'][_0xe6ef('0x15')]);return _0x4fca2f(_0x110250['error'][_0xe6ef('0x15')]);}logger[_0xe6ef('0x13')](_0xe6ef('0xe'),_0x3256ff,_0x110250[_0xe6ef('0x13')][_0xe6ef('0x15')]);return _0x3fe8fa(_0x110250[_0xe6ef('0x13')][_0xe6ef('0x15')]);}else{logger[_0xe6ef('0xd')](_0xe6ef('0xe'),_0x3256ff,_0xe6ef('0xf'));_0x3fe8fa(_0x110250[_0xe6ef('0x16')][_0xe6ef('0x15')]);}})[_0xe6ef('0x17')](function(_0x260b3a){logger['error']('User,\x20%s,\x20%s',_0x3256ff,_0x260b3a);_0x4fca2f(_0x260b3a);});});}exports[_0xe6ef('0x18')]=function(_0x4e58d5){var _0x3ac094=this;return new Promise(function(_0x592176,_0x331ebc){return db[_0xe6ef('0x19')][_0xe6ef('0x1a')]({'raw':_0x4e58d5[_0xe6ef('0x1b')]?_0x4e58d5[_0xe6ef('0x1b')][_0xe6ef('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e58d5[_0xe6ef('0x1b')]?_0x4e58d5[_0xe6ef('0x1b')]['where']||null:null,'attributes':_0x4e58d5[_0xe6ef('0x1b')]?_0x4e58d5[_0xe6ef('0x1b')]['attributes']||null:null,'limit':_0x4e58d5[_0xe6ef('0x1b')]?_0x4e58d5[_0xe6ef('0x1b')][_0xe6ef('0x1d')]||null:null,'include':_0x4e58d5[_0xe6ef('0x1b')]?_0x4e58d5[_0xe6ef('0x1b')]['include']?_[_0xe6ef('0x1e')](_0x4e58d5[_0xe6ef('0x1b')][_0xe6ef('0x1f')],function(_0x49a265){return{'model':db[_0x49a265[_0xe6ef('0x20')]],'as':_0x49a265['as'],'attributes':_0x49a265[_0xe6ef('0x21')],'include':_0x49a265['include']?_[_0xe6ef('0x1e')](_0x49a265[_0xe6ef('0x1f')],function(_0xed2cfe){return{'model':db[_0xed2cfe['model']],'as':_0xed2cfe['as'],'attributes':_0xed2cfe[_0xe6ef('0x21')],'include':_0xed2cfe[_0xe6ef('0x1f')]?_['map'](_0xed2cfe[_0xe6ef('0x1f')],function(_0x2bbfbc){return{'model':db[_0x2bbfbc[_0xe6ef('0x20')]],'as':_0x2bbfbc['as'],'attributes':_0x2bbfbc[_0xe6ef('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe6ef('0x22')](function(_0x4e3259){logger[_0xe6ef('0xd')](_0xe6ef('0x18'),_0x4e58d5);logger[_0xe6ef('0x10')](_0xe6ef('0x18'),_0x4e58d5,JSON['stringify'](_0x4e3259));_0x592176(_0x4e3259);})[_0xe6ef('0x17')](function(_0x5590b0){logger[_0xe6ef('0x13')](_0xe6ef('0x18'),_0x5590b0[_0xe6ef('0x15')],_0x4e58d5);_0x331ebc(_0x3ac094[_0xe6ef('0x13')](0x1f4,_0x5590b0[_0xe6ef('0x15')]));});});};exports['ShowUser']=function(_0x2ed679){var _0xb992eb=this;return new Promise(function(_0x3921b7,_0x1a3264){return db[_0xe6ef('0x19')][_0xe6ef('0x23')]({'raw':_0x2ed679[_0xe6ef('0x1b')]?_0x2ed679['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ed679[_0xe6ef('0x1b')]?_0x2ed679[_0xe6ef('0x1b')][_0xe6ef('0x24')]||null:null,'attributes':_0x2ed679[_0xe6ef('0x1b')]?_0x2ed679[_0xe6ef('0x1b')][_0xe6ef('0x21')]||null:null,'include':_0x2ed679[_0xe6ef('0x1b')]?_0x2ed679['options'][_0xe6ef('0x1f')]?_[_0xe6ef('0x1e')](_0x2ed679[_0xe6ef('0x1b')]['include'],function(_0x19fede){return{'model':db[_0x19fede[_0xe6ef('0x20')]],'as':_0x19fede['as'],'attributes':_0x19fede['attributes'],'include':_0x19fede[_0xe6ef('0x1f')]?_[_0xe6ef('0x1e')](_0x19fede[_0xe6ef('0x1f')],function(_0x3bdff9){return{'model':db[_0x3bdff9[_0xe6ef('0x20')]],'as':_0x3bdff9['as'],'attributes':_0x3bdff9['attributes'],'include':_0x3bdff9[_0xe6ef('0x1f')]?_[_0xe6ef('0x1e')](_0x3bdff9[_0xe6ef('0x1f')],function(_0x28d0d7){return{'model':db[_0x28d0d7[_0xe6ef('0x20')]],'as':_0x28d0d7['as'],'attributes':_0x28d0d7[_0xe6ef('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d3264){logger[_0xe6ef('0xd')]('ShowUser',_0x2ed679);logger[_0xe6ef('0x10')](_0xe6ef('0x25'),_0x2ed679,JSON['stringify'](_0x2d3264));_0x3921b7(_0x2d3264);})[_0xe6ef('0x17')](function(_0x2c8c05){logger[_0xe6ef('0x13')](_0xe6ef('0x25'),_0x2c8c05[_0xe6ef('0x15')],_0x2ed679);_0x1a3264(_0xb992eb['error'](0x1f4,_0x2c8c05[_0xe6ef('0x15')]));});});};exports[_0xe6ef('0x26')]=function(_0x174774){var _0x5006af=this;return new Promise(function(_0x71f396,_0x419476){var _0x1557f9;return db['User'][_0xe6ef('0x23')]({'where':_0x174774['options']['where']||{},'attributes':['id',_0xe6ef('0x27'),_0xe6ef('0x28'),_0xe6ef('0x29')]})[_0xe6ef('0x22')](function(_0x292efa){if(_0x292efa){_0x1557f9=_0x292efa;return db[_0xe6ef('0x2a')][_0xe6ef('0x2b')]({'paused':0x1},{'where':{'UserId':_0x1557f9['id']},'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x1557f9){return db['MemberReport']['findAll']({'where':{'membername':_0x1557f9[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x1557f9[_0xe6ef('0x27')]),'type':_0xe6ef('0x2f'),'exitAt':null}});}})[_0xe6ef('0x22')](function(_0x566840){if(_0x1557f9){if(_0x566840&&_0x566840['length']){var _0x3294c2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x398ab5=0x0,_0x6e09bb=_0x566840[_0xe6ef('0x30')];_0x398ab5<_0x6e09bb;_0x398ab5++){_0x566840[_0x398ab5]['updateAttributes']({'exitAt':_0x3294c2});}}}})['then'](function(){if(_0x1557f9){var _0x104c13=[];var _0x1301ab=utils[_0xe6ef('0x31')]();_0x1301ab[_0xe6ef('0x32')](function(_0x43eb5c){_0x104c13[_0xe6ef('0x33')]({'channel':_0x43eb5c,'membername':_0x1557f9[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x1557f9[_0xe6ef('0x27')]),'type':_0xe6ef('0x2f'),'enterAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34')),'data1':_0x174774[_0xe6ef('0x35')][_0xe6ef('0x36')]||_0xe6ef('0x37'),'role':_0x1557f9['role'],'internal':_0x1557f9['internal'],'uniqueid':_0x174774[_0xe6ef('0x35')][_0xe6ef('0x38')]||null});});return db['MemberReport']['bulkCreate'](_0x104c13,{'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x1557f9){return _0x1557f9[_0xe6ef('0x2b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x174774[_0xe6ef('0x35')][_0xe6ef('0x36')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0xe6ef('0x34'))});}})[_0xe6ef('0x22')](function(_0x4aee38){_0x71f396(_0x4aee38);})[_0xe6ef('0x17')](function(_0x5251f4){_0x419476(_0x5006af[_0xe6ef('0x13')](0x1f4,_0x5251f4[_0xe6ef('0x15')]));});});};exports[_0xe6ef('0x39')]=function(_0x25d07e){var _0x57f592=this;return new Promise(function(_0x264175,_0x56d9b3){var _0x3a93ea;return db['User'][_0xe6ef('0x3a')]({'where':_0x25d07e[_0xe6ef('0x1b')][_0xe6ef('0x24')]||{},'attributes':['id',_0xe6ef('0x27')]})[_0xe6ef('0x22')](function(_0x1895c0){if(_0x1895c0){_0x3a93ea=_0x1895c0;if(_0x25d07e[_0xe6ef('0x35')][_0xe6ef('0x3b')]&&!utils[_0xe6ef('0x3c')](_0x25d07e[_0xe6ef('0x35')]['channel'])){throw new Error(_0xe6ef('0x3d'));}switch(_0x25d07e[_0xe6ef('0x35')]['channel']){case _0xe6ef('0x3e'):return db[_0xe6ef('0x2a')]['update']({'paused':0x0},{'where':{'UserId':_0x3a93ea['id']}})['then'](function(){return db[_0xe6ef('0x3f')][_0xe6ef('0x23')]({'where':{'channel':_0x25d07e[_0xe6ef('0x35')][_0xe6ef('0x3b')],'membername':_0x3a93ea[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),'SIP',_0x3a93ea[_0xe6ef('0x27')]),'type':_0xe6ef('0x2f'),'exitAt':null}});})[_0xe6ef('0x22')](function(_0x4c5bec){if(_0x4c5bec){return _0x4c5bec['update']({'exitAt':moment()[_0xe6ef('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0xe6ef('0x22')](function(){return _0x3a93ea[_0xe6ef('0x2b')]({'voicePause':![]});});case'mail':case _0xe6ef('0x40'):case'fax':case _0xe6ef('0x41'):case _0xe6ef('0x42'):return db[_0xe6ef('0x3f')][_0xe6ef('0x23')]({'where':{'channel':_0x25d07e[_0xe6ef('0x35')][_0xe6ef('0x3b')],'membername':_0x3a93ea[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')]('%s/%s',_0xe6ef('0x2e'),_0x3a93ea[_0xe6ef('0x27')]),'type':_0xe6ef('0x2f'),'exitAt':null}})['then'](function(_0x6e6b5e){return _0x6e6b5e['update']({'exitAt':moment()[_0xe6ef('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xe6ef('0x43')},{'individualHooks':!![]});})[_0xe6ef('0x22')](function(){var _0x309aa5={};_[_0xe6ef('0x44')](_0x309aa5,util[_0xe6ef('0x2c')](_0xe6ef('0x45'),_0x25d07e[_0xe6ef('0x35')][_0xe6ef('0x3b')],'Pause'),![]);return _0x3a93ea[_0xe6ef('0x2b')](_0x309aa5);});default:return db[_0xe6ef('0x2a')][_0xe6ef('0x2b')]({'paused':0x0},{'where':{'UserId':_0x3a93ea['id']}})['then'](function(){return db[_0xe6ef('0x3f')][_0xe6ef('0x1a')]({'where':{'membername':_0x3a93ea[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x3a93ea[_0xe6ef('0x27')]),'type':_0xe6ef('0x2f'),'exitAt':null}});})[_0xe6ef('0x22')](function(_0x1fd620){var _0x237f2f=[];_0x1fd620[_0xe6ef('0x32')](function(_0x26dec1){_0x237f2f[_0xe6ef('0x33')](_0x26dec1[_0xe6ef('0x2b')]({'exitAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34')),'data2':_0xe6ef('0x43')}));});return BPromise[_0xe6ef('0x46')](_0x237f2f);})[_0xe6ef('0x22')](function(){return _0x3a93ea['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xe6ef('0x22')](function(_0xe80633){_0x264175(_0xe80633);})[_0xe6ef('0x17')](function(_0x5c36c7){_0x56d9b3(_0x57f592[_0xe6ef('0x13')](0x1f4,_0x5c36c7[_0xe6ef('0x15')]));});});};exports[_0xe6ef('0x47')]=function(_0x16a535){var _0x1b50e5=this;return new Promise(function(_0x23016e,_0x4df96f){var _0x197e65;return db['User'][_0xe6ef('0x3a')]({'where':_0x16a535[_0xe6ef('0x1b')][_0xe6ef('0x24')]||{},'attributes':['id',_0xe6ef('0x27')]})[_0xe6ef('0x22')](function(_0x4c648b){if(_0x4c648b){_0x197e65=_0x4c648b;return db[_0xe6ef('0x2a')][_0xe6ef('0x48')]({'where':{'membername':_0x197e65[_0xe6ef('0x27')]},'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x197e65){return db[_0xe6ef('0x3f')][_0xe6ef('0x1a')]({'where':{'membername':_0x197e65[_0xe6ef('0x27')],'interface':util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x197e65[_0xe6ef('0x27')]),'exitAt':null}});}})[_0xe6ef('0x22')](function(_0x3238cb){if(_0x197e65){if(_0x3238cb&&_0x3238cb[_0xe6ef('0x30')]){var _0x365e4c=[];_0x3238cb[_0xe6ef('0x32')](function(_0x2bae56){_0x365e4c[_0xe6ef('0x33')](_0x2bae56[_0xe6ef('0x2b')]({'exitAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34'))}));});return BPromise[_0xe6ef('0x46')](_0x365e4c);}}})[_0xe6ef('0x22')](function(){if(_0x197e65){return _0x197e65[_0xe6ef('0x2b')]({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe6ef('0x22')](function(_0x1b157f){_0x23016e(_0x1b157f);})[_0xe6ef('0x17')](function(_0x21083f){_0x4df96f(_0x1b50e5[_0xe6ef('0x13')](0x1f4,_0x21083f[_0xe6ef('0x15')]));});});};exports['LoginUser']=function(_0x212533){var _0x57a3ee=this;return new Promise(function(_0x3af171,_0x5e3683){var _0x2e0356;var _0x3f36cb;var _0x48c880;return db[_0xe6ef('0x19')]['findOne']({'where':_0x212533[_0xe6ef('0x1b')]['where']||{},'attributes':['id',_0xe6ef('0x27'),_0xe6ef('0x28'),'internal','loginInPause']})[_0xe6ef('0x22')](function(_0x221ce0){if(_0x221ce0){_0x2e0356=_0x221ce0;return db[_0xe6ef('0x19')][_0xe6ef('0x49')]({'where':{'role':_0xe6ef('0x4a'),'online':!![],'id':{'$ne':_0x2e0356['id']}}});}})['then'](function(_0x1329d9){if(_0x1329d9){_0x48c880=_0x1329d9;return require(_0xe6ef('0x4b'))[_0xe6ef('0x4c')]();}})[_0xe6ef('0x22')](function(_0x4faf25){if(_0x4faf25&&_0x4faf25[_0xe6ef('0x4d')]&&_0x48c880>=_0x4faf25[_0xe6ef('0x4d')]){throw new Error(_0xe6ef('0x4e'));}})['then'](function(){if(_0x2e0356){return db[_0xe6ef('0x2a')]['destroy']({'where':{'membername':_0x2e0356['name']},'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return _0x2e0356[_0xe6ef('0x4f')]({'raw':!![]});}})[_0xe6ef('0x22')](function(_0x5985de){if(_0x2e0356){if(_0x5985de){var _0x45f914=[];_0x3f36cb=_0x5985de;if(_0x3f36cb['length']){for(var _0x113953=0x0;_0x113953<_0x3f36cb[_0xe6ef('0x30')];_0x113953++){_0x45f914['push'](db[_0xe6ef('0x2a')][_0xe6ef('0x50')]({'membername':_0x2e0356['name'],'UserId':_0x2e0356['id'],'queue_name':_0x3f36cb[_0x113953][_0xe6ef('0x27')],'VoiceQueueId':_0x3f36cb[_0x113953]['id'],'interface':_0x212533[_0xe6ef('0x35')][_0xe6ef('0x51')]||util[_0xe6ef('0x2c')](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'paused':_0x2e0356['loginInPause']||![],'penalty':_0x3f36cb[_0x113953][_0xe6ef('0x52')]||0x0}));}return BPromise[_0xe6ef('0x46')](_0x45f914);}}}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return db[_0xe6ef('0x3f')][_0xe6ef('0x1a')]({'where':{'membername':_0x2e0356['name'],'interface':util['format'](_0xe6ef('0x2d'),_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'exitAt':null}});}})[_0xe6ef('0x22')](function(_0x1225e6){if(_0x2e0356){if(_0x1225e6&&_0x1225e6['length']){var _0x1e9bce=[];_0x1225e6['forEach'](function(_0x47bdca){_0x1e9bce[_0xe6ef('0x33')](_0x47bdca[_0xe6ef('0x2b')]({'exitAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34'))}));});return BPromise[_0xe6ef('0x46')](_0x1e9bce);}}})['then'](function(_0x252e0f){if(_0x2e0356){var _0x5ca0eb=[];var _0x270899=[];var _0x70404c=utils[_0xe6ef('0x31')]();var _0x267b0f={'membername':_0x2e0356['name'],'interface':util[_0xe6ef('0x2c')]('%s/%s',_0xe6ef('0x2e'),_0x2e0356[_0xe6ef('0x27')]),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x2e0356[_0xe6ef('0x28')],'internal':_0x2e0356[_0xe6ef('0x29')]};_0x70404c['forEach'](function(_0x19fedb){_0x5ca0eb['push'](_[_0xe6ef('0x53')]({'channel':_0x19fedb,'type':_0xe6ef('0x54'),'data1':_0xe6ef('0x55'),'data2':_0x212533['body'][_0xe6ef('0x51')]||util['format']('%s/%s','SIP',_0x2e0356['name'])},_0x267b0f));if(_0x2e0356[_0xe6ef('0x56')]){_0x270899[_0xe6ef('0x33')](_[_0xe6ef('0x53')]({'channel':_0x19fedb,'type':'PAUSE','data1':'LOGININPAUSE'},_0x267b0f));}});return db[_0xe6ef('0x3f')][_0xe6ef('0x57')](_0x5ca0eb[_0xe6ef('0x58')](_0x270899),{'individualHooks':!![]});}})[_0xe6ef('0x22')](function(){if(_0x2e0356){return _0x2e0356[_0xe6ef('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34')),'voicePause':_0x2e0356[_0xe6ef('0x56')]||![],'mailPause':_0x2e0356['loginInPause']||![],'chatPause':_0x2e0356[_0xe6ef('0x56')]||![],'faxPause':_0x2e0356[_0xe6ef('0x56')]||![],'smsPause':_0x2e0356[_0xe6ef('0x56')]||![],'openchannelPause':_0x2e0356[_0xe6ef('0x56')]||![],'pauseType':_0x2e0356['loginInPause']?_0xe6ef('0x59'):null,'lastPauseAt':moment()[_0xe6ef('0x2c')](_0xe6ef('0x34'))});}})[_0xe6ef('0x22')](function(_0x5e4b44){_0x3af171(_0x5e4b44);})['catch'](function(_0x191e5f){_0x5e3683(_0x57a3ee['error'](0x1f4,_0x191e5f[_0xe6ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index c7de35d..7552e6a 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 _0x377c=['register','length','user:','./user.events','remove','update','emit','removeListener'];(function(_0x25996d,_0x5b282e){var _0x12d802=function(_0x34fe7b){while(--_0x34fe7b){_0x25996d['push'](_0x25996d['shift']());}};_0x12d802(++_0x5b282e);}(_0x377c,0x103));var _0xc377=function(_0xcf581b,_0x4359dd){_0xcf581b=_0xcf581b-0x0;var _0x4f454d=_0x377c[_0xcf581b];return _0x4f454d;};'use strict';var UserEvents=require(_0xc377('0x0'));var events=['save',_0xc377('0x1'),_0xc377('0x2')];function createListener(_0x4d5221,_0xe1c293){return function(_0x3b3b23){_0xe1c293[_0xc377('0x3')](_0x4d5221,_0x3b3b23);};}function removeListener(_0x263a6e,_0x5059cc){return function(){UserEvents[_0xc377('0x4')](_0x263a6e,_0x5059cc);};}exports[_0xc377('0x5')]=function(_0x375c86){for(var _0x355717=0x0,_0x4a9780=events[_0xc377('0x6')];_0x355717<_0x4a9780;_0x355717++){var _0x30fe43=events[_0x355717];var _0xeadb70=createListener(_0xc377('0x7')+_0x30fe43,_0x375c86);UserEvents['on'](_0x30fe43,_0xeadb70);}}; \ No newline at end of file +var _0xa533=['./user.events','remove','update','emit','removeListener','register','length','user:'];(function(_0x301ef5,_0x1ea20a){var _0x35ea95=function(_0x87020d){while(--_0x87020d){_0x301ef5['push'](_0x301ef5['shift']());}};_0x35ea95(++_0x1ea20a);}(_0xa533,0x90));var _0x3a53=function(_0x45174f,_0x22995d){_0x45174f=_0x45174f-0x0;var _0x2add9e=_0xa533[_0x45174f];return _0x2add9e;};'use strict';var UserEvents=require(_0x3a53('0x0'));var events=['save',_0x3a53('0x1'),_0x3a53('0x2')];function createListener(_0x1d7cd0,_0x3a1dab){return function(_0x7a6e2){_0x3a1dab[_0x3a53('0x3')](_0x1d7cd0,_0x7a6e2);};}function removeListener(_0x3d47d4,_0x30c56c){return function(){UserEvents[_0x3a53('0x4')](_0x3d47d4,_0x30c56c);};}exports[_0x3a53('0x5')]=function(_0x91f2b6){for(var _0x294e02=0x0,_0x1fd83f=events[_0x3a53('0x6')];_0x294e02<_0x1fd83f;_0x294e02++){var _0x180102=events[_0x294e02];var _0x399d1b=createListener(_0x3a53('0x7')+_0x180102,_0x91f2b6);UserEvents['on'](_0x180102,_0x399d1b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 6f7b408..b74f388 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 _0x3a79=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','path','express'];(function(_0x2bad0d,_0x443d33){var _0x2526b2=function(_0x2d2d62){while(--_0x2d2d62){_0x2bad0d['push'](_0x2bad0d['shift']());}};_0x2526b2(++_0x443d33);}(_0x3a79,0x10d));var _0x93a7=function(_0x2ef1cc,_0x28616e){_0x2ef1cc=_0x2ef1cc-0x0;var _0x10777a=_0x3a79[_0x2ef1cc];return _0x10777a;};'use strict';var multer=require(_0x93a7('0x0'));var util=require('util');var path=require(_0x93a7('0x1'));var express=require(_0x93a7('0x2'));var router=express[_0x93a7('0x3')]();var auth=require(_0x93a7('0x4'));var interaction=require(_0x93a7('0x5'));var config=require(_0x93a7('0x6'));module[_0x93a7('0x7')]=router; \ No newline at end of file +var _0x9b60=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x277f0a,_0x1ff552){var _0x173a99=function(_0x603e32){while(--_0x603e32){_0x277f0a['push'](_0x277f0a['shift']());}};_0x173a99(++_0x1ff552);}(_0x9b60,0xc1));var _0x09b6=function(_0x20ecd5,_0x4b955d){_0x20ecd5=_0x20ecd5-0x0;var _0x201547=_0x9b60[_0x20ecd5];return _0x201547;};'use strict';var multer=require(_0x09b6('0x0'));var util=require(_0x09b6('0x1'));var path=require(_0x09b6('0x2'));var express=require(_0x09b6('0x3'));var router=express[_0x09b6('0x4')]();var auth=require(_0x09b6('0x5'));var interaction=require(_0x09b6('0x6'));var config=require(_0x09b6('0x7'));module[_0x09b6('0x8')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d6d8a57..c552ca2 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 _0xdf7a=['exports','INTEGER','sequelize'];(function(_0x513f45,_0x10ed02){var _0x22e0fe=function(_0x5e581c){while(--_0x5e581c){_0x513f45['push'](_0x513f45['shift']());}};_0x22e0fe(++_0x10ed02);}(_0xdf7a,0x185));var _0xadf7=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xdf7a[_0x412b2a];return _0x5872e3;};'use strict';var Sequelize=require(_0xadf7('0x0'));module[_0xadf7('0x1')]={'penalty':{'type':Sequelize[_0xadf7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8611=['sequelize','INTEGER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8611,0xd8));var _0x1861=function(_0x434de1,_0x5edede){_0x434de1=_0x434de1-0x0;var _0x17e8a2=_0x8611[_0x434de1];return _0x17e8a2;};'use strict';var Sequelize=require(_0x1861('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x1861('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index c054515..64d3a53 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 _0xe2cf=['request-promise','./userChatQueue.attributes','exports','define','util','api','bluebird'];(function(_0x3b3c72,_0x9bb5a9){var _0x4fe5df=function(_0x568b80){while(--_0x568b80){_0x3b3c72['push'](_0x3b3c72['shift']());}};_0x4fe5df(++_0x9bb5a9);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x418060,_0xd3b3b7){_0x418060=_0x418060-0x0;var _0x21f56b=_0xe2cf[_0x418060];return _0x21f56b;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var attributes=require(_0xfe2c('0x4'));module[_0xfe2c('0x5')]=function(_0x494978,_0xd40c31){return _0x494978[_0xfe2c('0x6')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3495=['request-promise','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x303a35,_0x26b4a9){var _0x2f8882=function(_0x8134a3){while(--_0x8134a3){_0x303a35['push'](_0x303a35['shift']());}};_0x2f8882(++_0x26b4a9);}(_0x3495,0x1de));var _0x5349=function(_0x2d3087,_0x254ae7){_0x2d3087=_0x2d3087-0x0;var _0x5d2d2d=_0x3495[_0x2d3087];return _0x5d2d2d;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var logger=require(_0x5349('0x2'))(_0x5349('0x3'));var moment=require(_0x5349('0x4'));var BPromise=require(_0x5349('0x5'));var rp=require(_0x5349('0x6'));var attributes=require(_0x5349('0x7'));module[_0x5349('0x8')]=function(_0x5912ac,_0x4034ba){return _0x5912ac[_0x5349('0x9')]('UserChatQueue',attributes,{'tableName':_0x5349('0xa'),'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 a1beda5..b56c76e 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 _0x30a4=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug'];(function(_0x59fb8b,_0x4d6d2b){var _0x1a9502=function(_0x1074fe){while(--_0x1074fe){_0x59fb8b['push'](_0x59fb8b['shift']());}};_0x1a9502(++_0x4d6d2b);}(_0x30a4,0x64));var _0x430a=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x30a4[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0x430a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x430a('0x1'));var rs=require(_0x430a('0x2'));var fs=require('fs');var db=require(_0x430a('0x3'))['db'];var utils=require(_0x430a('0x4'));var logger=require(_0x430a('0x5'))(_0x430a('0x6'));var config=require(_0x430a('0x7'));var jayson=require(_0x430a('0x8'));var client=jayson[_0x430a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1873c5,_0x50f217,_0x4cb02e){return new BPromise(function(_0x22194e,_0x1b0750){return client[_0x430a('0xa')](_0x1873c5,_0x4cb02e)[_0x430a('0xb')](function(_0x375cb0){logger[_0x430a('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x50f217,_0x430a('0xd'));logger[_0x430a('0xe')](_0x430a('0xf'),_0x50f217,'request\x20sent',JSON[_0x430a('0x10')](_0x375cb0));if(_0x375cb0[_0x430a('0x11')]){if(_0x375cb0[_0x430a('0x11')][_0x430a('0x12')]===0x1f4){logger[_0x430a('0x11')](_0x430a('0x13'),_0x50f217,_0x375cb0[_0x430a('0x11')]['message']);return _0x1b0750(_0x375cb0[_0x430a('0x11')][_0x430a('0x14')]);}logger[_0x430a('0x11')](_0x430a('0x13'),_0x50f217,_0x375cb0[_0x430a('0x11')]['message']);return _0x22194e(_0x375cb0[_0x430a('0x11')][_0x430a('0x14')]);}else{logger[_0x430a('0xc')](_0x430a('0x13'),_0x50f217,_0x430a('0xd'));_0x22194e(_0x375cb0[_0x430a('0x15')][_0x430a('0x14')]);}})[_0x430a('0x16')](function(_0x488f81){logger['error'](_0x430a('0x13'),_0x50f217,_0x488f81);_0x1b0750(_0x488f81);});});} \ No newline at end of file +var _0x048f=['../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x34c78a,_0x4b227f){var _0x498e41=function(_0x3e3810){while(--_0x3e3810){_0x34c78a['push'](_0x34c78a['shift']());}};_0x498e41(++_0x4b227f);}(_0x048f,0x1ae));var _0xf048=function(_0x1b3f7a,_0x5a6361){_0x1b3f7a=_0x1b3f7a-0x0;var _0x1a6a68=_0x048f[_0x1b3f7a];return _0x1a6a68;};'use strict';var _=require('lodash');var util=require(_0xf048('0x0'));var moment=require(_0xf048('0x1'));var BPromise=require('bluebird');var rs=require(_0xf048('0x2'));var fs=require('fs');var db=require(_0xf048('0x3'))['db'];var utils=require(_0xf048('0x4'));var logger=require(_0xf048('0x5'))(_0xf048('0x6'));var config=require(_0xf048('0x7'));var jayson=require(_0xf048('0x8'));var client=jayson[_0xf048('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48e135,_0x366d9a,_0x31f3fe){return new BPromise(function(_0x26ab09,_0x1dcd10){return client[_0xf048('0xa')](_0x48e135,_0x31f3fe)[_0xf048('0xb')](function(_0x16611c){logger['info'](_0xf048('0xc'),_0x366d9a,_0xf048('0xd'));logger[_0xf048('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x366d9a,'request\x20sent',JSON['stringify'](_0x16611c));if(_0x16611c[_0xf048('0xf')]){if(_0x16611c['error'][_0xf048('0x10')]===0x1f4){logger['error'](_0xf048('0xc'),_0x366d9a,_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);return _0x1dcd10(_0x16611c[_0xf048('0xf')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x366d9a,_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);return _0x26ab09(_0x16611c[_0xf048('0xf')][_0xf048('0x11')]);}else{logger[_0xf048('0x12')](_0xf048('0xc'),_0x366d9a,'request\x20sent');_0x26ab09(_0x16611c['result'][_0xf048('0x11')]);}})['catch'](function(_0x9b57ae){logger[_0xf048('0xf')](_0xf048('0xc'),_0x366d9a,_0x9b57ae);_0x1dcd10(_0x9b57ae);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index c4a5b9c..6c4ddbd 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 _0xd54c=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router'];(function(_0x3b1e7d,_0x5acd93){var _0x5f1eae=function(_0x33f4e4){while(--_0x33f4e4){_0x3b1e7d['push'](_0x3b1e7d['shift']());}};_0x5f1eae(++_0x5acd93);}(_0xd54c,0xa3));var _0xcd54=function(_0x379e4a,_0x1f13cf){_0x379e4a=_0x379e4a-0x0;var _0x3aad06=_0xd54c[_0x379e4a];return _0x3aad06;};'use strict';var multer=require(_0xcd54('0x0'));var util=require(_0xcd54('0x1'));var path=require(_0xcd54('0x2'));var express=require(_0xcd54('0x3'));var router=express[_0xcd54('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd54('0x5'));var config=require(_0xcd54('0x6'));module[_0xcd54('0x7')]=router; \ No newline at end of file +var _0x13e4=['multer','util','path','Router','../../components/auth/service'];(function(_0x186612,_0x116fe0){var _0x277b85=function(_0x29870c){while(--_0x29870c){_0x186612['push'](_0x186612['shift']());}};_0x277b85(++_0x116fe0);}(_0x13e4,0x127));var _0x413e=function(_0x433b73,_0x2c5b9c){_0x433b73=_0x433b73-0x0;var _0x398401=_0x13e4[_0x433b73];return _0x398401;};'use strict';var multer=require(_0x413e('0x0'));var util=require(_0x413e('0x1'));var path=require(_0x413e('0x2'));var express=require('express');var router=express[_0x413e('0x3')]();var auth=require(_0x413e('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index e50fd68..7f13497 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 _0x9528=['exports','INTEGER','STRING','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9528,0xaf));var _0x8952=function(_0x274d63,_0x2dd37a){_0x274d63=_0x274d63-0x0;var _0x2e9abd=_0x9528[_0x274d63];return _0x2e9abd;};'use strict';var Sequelize=require(_0x8952('0x0'));module[_0x8952('0x1')]={'penalty':{'type':Sequelize[_0x8952('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8952('0x3')]}}; \ No newline at end of file +var _0x626f=['sequelize','exports','INTEGER'];(function(_0x2c8a5b,_0x1d47b6){var _0x48dc70=function(_0x2041fe){while(--_0x2041fe){_0x2c8a5b['push'](_0x2c8a5b['shift']());}};_0x48dc70(++_0x1d47b6);}(_0x626f,0xdb));var _0xf626=function(_0x116c47,_0x55a5e6){_0x116c47=_0x116c47-0x0;var _0x2796c4=_0x626f[_0x116c47];return _0x2796c4;};'use strict';var Sequelize=require(_0xf626('0x0'));module[_0xf626('0x1')]={'penalty':{'type':Sequelize[_0xf626('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf626('0x2')],'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 405f992..6208120 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 _0x9b9b=['request-promise','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','moment','bluebird'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x9b9b,0x114));var _0xb9b9=function(_0x276f6d,_0x10a50e){_0x276f6d=_0x276f6d-0x0;var _0xda31b5=_0x9b9b[_0x276f6d];return _0xda31b5;};'use strict';var _=require('lodash');var util=require(_0xb9b9('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb9b9('0x1'));var BPromise=require(_0xb9b9('0x2'));var rp=require(_0xb9b9('0x3'));var attributes=require(_0xb9b9('0x4'));module[_0xb9b9('0x5')]=function(_0x43c8ff,_0x23b016){return _0x43c8ff[_0xb9b9('0x6')](_0xb9b9('0x7'),attributes,{'tableName':_0xb9b9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50a6=['./userFaxQueue.attributes','exports','user_has_fax_queues','lodash','util','moment','request-promise'];(function(_0x25248b,_0x3c8491){var _0x509939=function(_0x457a27){while(--_0x457a27){_0x25248b['push'](_0x25248b['shift']());}};_0x509939(++_0x3c8491);}(_0x50a6,0xa4));var _0x650a=function(_0x248f6b,_0x401324){_0x248f6b=_0x248f6b-0x0;var _0x54b829=_0x50a6[_0x248f6b];return _0x54b829;};'use strict';var _=require(_0x650a('0x0'));var util=require(_0x650a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x650a('0x2'));var BPromise=require('bluebird');var rp=require(_0x650a('0x3'));var attributes=require(_0x650a('0x4'));module[_0x650a('0x5')]=function(_0x4a0147,_0xa3311){return _0x4a0147['define']('UserFaxQueue',attributes,{'tableName':_0x650a('0x6'),'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 0f48e6c..bbfcd93 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 _0xccef=['stringify','error','code','message','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1561ff,_0x2dfbd4){var _0x228a61=function(_0x264a56){while(--_0x264a56){_0x1561ff['push'](_0x1561ff['shift']());}};_0x228a61(++_0x2dfbd4);}(_0xccef,0x1d4));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var db=require(_0xfcce('0x3'))['db'];var utils=require(_0xfcce('0x4'));var logger=require(_0xfcce('0x5'))(_0xfcce('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfcce('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x96ac52,_0xd71971,_0x12d091){return new BPromise(function(_0x4598c1,_0x117bc3){return client[_0xfcce('0x8')](_0x96ac52,_0x12d091)[_0xfcce('0x9')](function(_0x5a6ce3){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0xd71971,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0xd71971,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x5a6ce3));if(_0x5a6ce3[_0xfcce('0x10')]){if(_0x5a6ce3[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger[_0xfcce('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0xd71971,_0x5a6ce3[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x117bc3(_0x5a6ce3[_0xfcce('0x10')][_0xfcce('0x12')]);}logger['error'](_0xfcce('0xb'),_0xd71971,_0x5a6ce3[_0xfcce('0x10')]['message']);return _0x4598c1(_0x5a6ce3['error'][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0xd71971,_0xfcce('0xc'));_0x4598c1(_0x5a6ce3[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0xd82ab6){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0xd71971,_0xd82ab6);_0x117bc3(_0xd82ab6);});});} \ No newline at end of file +var _0x7462=['rpc','jayson/promise','client','http','request','info','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','lodash','util','randomstring','../../config/logger'];(function(_0x225d2f,_0x37eed7){var _0x136a1b=function(_0x77d21f){while(--_0x77d21f){_0x225d2f['push'](_0x225d2f['shift']());}};_0x136a1b(++_0x37eed7);}(_0x7462,0x165));var _0x2746=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x7462[_0x3e69ae];return _0x3d7f42;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2746('0x3'))(_0x2746('0x4'));var config=require('../../config/environment');var jayson=require(_0x2746('0x5'));var client=jayson[_0x2746('0x6')][_0x2746('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x280dfb,_0x2a2f42,_0x2940d8){return new BPromise(function(_0x1447bc,_0x40ad2b){return client[_0x2746('0x8')](_0x280dfb,_0x2940d8)['then'](function(_0x2b908c){logger[_0x2746('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2746('0xa'));logger[_0x2746('0xb')](_0x2746('0xc'),_0x2a2f42,'request\x20sent',JSON[_0x2746('0xd')](_0x2b908c));if(_0x2b908c[_0x2746('0xe')]){if(_0x2b908c[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0x10'),_0x2a2f42,_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);return _0x40ad2b(_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);}logger[_0x2746('0xe')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2b908c['error'][_0x2746('0x11')]);return _0x1447bc(_0x2b908c[_0x2746('0xe')][_0x2746('0x11')]);}else{logger[_0x2746('0x9')]('UserFaxQueue,\x20%s,\x20%s',_0x2a2f42,_0x2746('0xa'));_0x1447bc(_0x2b908c[_0x2746('0x12')]['message']);}})['catch'](function(_0x314075){logger[_0x2746('0xe')](_0x2746('0x10'),_0x2a2f42,_0x314075);_0x40ad2b(_0x314075);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1a1ca7f..7154e04 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 _0xf53b=['express','Router','util','path'];(function(_0x236092,_0x2f90ba){var _0x353481=function(_0x591807){while(--_0x591807){_0x236092['push'](_0x236092['shift']());}};_0x353481(++_0x2f90ba);}(_0xf53b,0xca));var _0xbf53=function(_0x14847a,_0x34daa5){_0x14847a=_0x14847a-0x0;var _0x3b74c5=_0xf53b[_0x14847a];return _0x3b74c5;};'use strict';var multer=require('multer');var util=require(_0xbf53('0x0'));var path=require(_0xbf53('0x1'));var express=require(_0xbf53('0x2'));var router=express[_0xbf53('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xd114=['Router','../../components/auth/service','../../config/environment','exports','multer','util','path','express'];(function(_0x375aab,_0x597a8d){var _0x42c688=function(_0x4055a7){while(--_0x4055a7){_0x375aab['push'](_0x375aab['shift']());}};_0x42c688(++_0x597a8d);}(_0xd114,0x1e4));var _0x4d11=function(_0xd2a1d9,_0x54b2ff){_0xd2a1d9=_0xd2a1d9-0x0;var _0x15d898=_0xd114[_0xd2a1d9];return _0x15d898;};'use strict';var multer=require(_0x4d11('0x0'));var util=require(_0x4d11('0x1'));var path=require(_0x4d11('0x2'));var express=require(_0x4d11('0x3'));var router=express[_0x4d11('0x4')]();var auth=require(_0x4d11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4d11('0x6'));module[_0x4d11('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 7ae9315..c47bd11 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 _0xe851=['sequelize','exports','INTEGER'];(function(_0x56731c,_0x3af662){var _0x26ca08=function(_0x1af74d){while(--_0x1af74d){_0x56731c['push'](_0x56731c['shift']());}};_0x26ca08(++_0x3af662);}(_0xe851,0x1b0));var _0x1e85=function(_0x400d7f,_0x49ebf8){_0x400d7f=_0x400d7f-0x0;var _0x5471eb=_0xe851[_0x400d7f];return _0x5471eb;};'use strict';var Sequelize=require(_0x1e85('0x0'));module[_0x1e85('0x1')]={'penalty':{'type':Sequelize[_0x1e85('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9012=['sequelize'];(function(_0x3ecd8d,_0x4a3783){var _0x3706cc=function(_0x2a452e){while(--_0x2a452e){_0x3ecd8d['push'](_0x3ecd8d['shift']());}};_0x3706cc(++_0x4a3783);}(_0x9012,0x1cf));var _0x2901=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x9012[_0x547ff4];return _0xe41057;};'use strict';var Sequelize=require(_0x2901('0x0'));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 39c9543..824b9bd 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 _0x5a13=['../../config/logger','api','moment','bluebird','request-promise','exports','util'];(function(_0xf829b9,_0x33f9b2){var _0x1f16b0=function(_0x4f96a2){while(--_0x4f96a2){_0xf829b9['push'](_0xf829b9['shift']());}};_0x1f16b0(++_0x33f9b2);}(_0x5a13,0x92));var _0x35a1=function(_0x3deb92,_0x35ca7f){_0x3deb92=_0x3deb92-0x0;var _0x453cb5=_0x5a13[_0x3deb92];return _0x453cb5;};'use strict';var _=require('lodash');var util=require(_0x35a1('0x0'));var logger=require(_0x35a1('0x1'))(_0x35a1('0x2'));var moment=require(_0x35a1('0x3'));var BPromise=require(_0x35a1('0x4'));var rp=require(_0x35a1('0x5'));var attributes=require('./userMailQueue.attributes');module[_0x35a1('0x6')]=function(_0x570b25,_0x3950e0){return _0x570b25['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e22=['UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','./userMailQueue.attributes','define'];(function(_0x243efe,_0x1b3b6b){var _0x51549b=function(_0x2c8cca){while(--_0x2c8cca){_0x243efe['push'](_0x243efe['shift']());}};_0x51549b(++_0x1b3b6b);}(_0x7e22,0x1d8));var _0x27e2=function(_0x346be5,_0xbbd413){_0x346be5=_0x346be5-0x0;var _0x2f27e5=_0x7e22[_0x346be5];return _0x2f27e5;};'use strict';var _=require(_0x27e2('0x0'));var util=require('util');var logger=require(_0x27e2('0x1'))(_0x27e2('0x2'));var moment=require(_0x27e2('0x3'));var BPromise=require(_0x27e2('0x4'));var rp=require(_0x27e2('0x5'));var attributes=require(_0x27e2('0x6'));module['exports']=function(_0x43868c,_0x4b2588){return _0x43868c[_0x27e2('0x7')](_0x27e2('0x8'),attributes,{'tableName':_0x27e2('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 3d560aa..b36ed68 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 _0xa73a=['jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','error','code','message','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment'];(function(_0x4421bf,_0x181705){var _0x46149a=function(_0xc2b961){while(--_0xc2b961){_0x4421bf['push'](_0x4421bf['shift']());}};_0x46149a(++_0x181705);}(_0xa73a,0x82));var _0xaa73=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0xa73a[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require('lodash');var util=require(_0xaa73('0x0'));var moment=require(_0xaa73('0x1'));var BPromise=require(_0xaa73('0x2'));var rs=require(_0xaa73('0x3'));var fs=require('fs');var db=require(_0xaa73('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xaa73('0x5'));var jayson=require(_0xaa73('0x6'));var client=jayson[_0xaa73('0x7')][_0xaa73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf84c2e,_0x3c6837,_0x9ecf94){return new BPromise(function(_0x52dea4,_0x5772ab){return client[_0xaa73('0x9')](_0xf84c2e,_0x9ecf94)[_0xaa73('0xa')](function(_0xdb1187){logger[_0xaa73('0xb')](_0xaa73('0xc'),_0x3c6837,_0xaa73('0xd'));logger['debug']('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x3c6837,_0xaa73('0xd'),JSON['stringify'](_0xdb1187));if(_0xdb1187[_0xaa73('0xe')]){if(_0xdb1187['error'][_0xaa73('0xf')]===0x1f4){logger[_0xaa73('0xe')](_0xaa73('0xc'),_0x3c6837,_0xdb1187[_0xaa73('0xe')][_0xaa73('0x10')]);return _0x5772ab(_0xdb1187[_0xaa73('0xe')]['message']);}logger[_0xaa73('0xe')](_0xaa73('0xc'),_0x3c6837,_0xdb1187[_0xaa73('0xe')][_0xaa73('0x10')]);return _0x52dea4(_0xdb1187[_0xaa73('0xe')][_0xaa73('0x10')]);}else{logger[_0xaa73('0xb')](_0xaa73('0xc'),_0x3c6837,_0xaa73('0xd'));_0x52dea4(_0xdb1187['result'][_0xaa73('0x10')]);}})['catch'](function(_0x320dff){logger[_0xaa73('0xe')](_0xaa73('0xc'),_0x3c6837,_0x320dff);_0x5772ab(_0x320dff);});});} \ No newline at end of file +var _0xf185=['code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','UserMailQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x5ce3c8,_0x2503bd){var _0xa76867=function(_0x52815e){while(--_0x52815e){_0x5ce3c8['push'](_0x5ce3c8['shift']());}};_0xa76867(++_0x2503bd);}(_0xf185,0x1be));var _0x5f18=function(_0x2eda9e,_0x4899b6){_0x2eda9e=_0x2eda9e-0x0;var _0x53553c=_0xf185[_0x2eda9e];return _0x53553c;};'use strict';var _=require(_0x5f18('0x0'));var util=require('util');var moment=require(_0x5f18('0x1'));var BPromise=require(_0x5f18('0x2'));var rs=require(_0x5f18('0x3'));var fs=require('fs');var db=require(_0x5f18('0x4'))['db'];var utils=require(_0x5f18('0x5'));var logger=require(_0x5f18('0x6'))('rpc');var config=require(_0x5f18('0x7'));var jayson=require(_0x5f18('0x8'));var client=jayson[_0x5f18('0x9')][_0x5f18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b7cc5,_0x2982d6,_0x3c69ee){return new BPromise(function(_0x47e05a,_0x15b931){return client['request'](_0x5b7cc5,_0x3c69ee)[_0x5f18('0xb')](function(_0x2b19b1){logger['info'](_0x5f18('0xc'),_0x2982d6,_0x5f18('0xd'));logger['debug'](_0x5f18('0xe'),_0x2982d6,_0x5f18('0xd'),JSON['stringify'](_0x2b19b1));if(_0x2b19b1['error']){if(_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x10')]===0x1f4){logger[_0x5f18('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);return _0x15b931(_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);}logger[_0x5f18('0xf')](_0x5f18('0xc'),_0x2982d6,_0x2b19b1[_0x5f18('0xf')][_0x5f18('0x11')]);return _0x47e05a(_0x2b19b1[_0x5f18('0xf')]['message']);}else{logger[_0x5f18('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,'request\x20sent');_0x47e05a(_0x2b19b1[_0x5f18('0x13')][_0x5f18('0x11')]);}})[_0x5f18('0x14')](function(_0x418048){logger[_0x5f18('0xf')]('UserMailQueue,\x20%s,\x20%s',_0x2982d6,_0x418048);_0x15b931(_0x418048);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1d08310..413c4e9 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 _0xaf44=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','exports','util'];(function(_0x4fb9dc,_0x412553){var _0x37e454=function(_0x28cf08){while(--_0x28cf08){_0x4fb9dc['push'](_0x4fb9dc['shift']());}};_0x37e454(++_0x412553);}(_0xaf44,0x10d));var _0x4af4=function(_0x435d2f,_0x59db14){_0x435d2f=_0x435d2f-0x0;var _0x10d151=_0xaf44[_0x435d2f];return _0x10d151;};'use strict';var multer=require('multer');var util=require(_0x4af4('0x0'));var path=require('path');var express=require(_0x4af4('0x1'));var router=express['Router']();var auth=require(_0x4af4('0x2'));var interaction=require(_0x4af4('0x3'));var config=require(_0x4af4('0x4'));module[_0x4af4('0x5')]=router; \ No newline at end of file +var _0xc74c=['../../config/environment','exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x4d2a6e,_0x185f42){var _0x2fa8bf=function(_0x48f9d4){while(--_0x48f9d4){_0x4d2a6e['push'](_0x4d2a6e['shift']());}};_0x2fa8bf(++_0x185f42);}(_0xc74c,0xcd));var _0xcc74=function(_0x2b8cc4,_0x5ae5f5){_0x2b8cc4=_0x2b8cc4-0x0;var _0x2c504d=_0xc74c[_0x2b8cc4];return _0x2c504d;};'use strict';var multer=require(_0xcc74('0x0'));var util=require('util');var path=require(_0xcc74('0x1'));var express=require(_0xcc74('0x2'));var router=express['Router']();var auth=require(_0xcc74('0x3'));var interaction=require(_0xcc74('0x4'));var config=require(_0xcc74('0x5'));module[_0xcc74('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 2744baf..e5e1d70 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 _0x20e8=['INTEGER','sequelize','exports'];(function(_0x3f6565,_0x12a8bb){var _0x4abd23=function(_0x56dce7){while(--_0x56dce7){_0x3f6565['push'](_0x3f6565['shift']());}};_0x4abd23(++_0x12a8bb);}(_0x20e8,0x169));var _0x820e=function(_0x504939,_0x1be3d2){_0x504939=_0x504939-0x0;var _0x52184c=_0x20e8[_0x504939];return _0x52184c;};'use strict';var Sequelize=require(_0x820e('0x0'));module[_0x820e('0x1')]={'penalty':{'type':Sequelize[_0x820e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2826=['exports','INTEGER','sequelize'];(function(_0x2236fe,_0x4ef9e1){var _0x54ec9b=function(_0x5a1f37){while(--_0x5a1f37){_0x2236fe['push'](_0x2236fe['shift']());}};_0x54ec9b(++_0x4ef9e1);}(_0x2826,0x7d));var _0x6282=function(_0x29246a,_0x4b102b){_0x29246a=_0x29246a-0x0;var _0x29643e=_0x2826[_0x29246a];return _0x29643e;};'use strict';var Sequelize=require(_0x6282('0x0'));module[_0x6282('0x1')]={'penalty':{'type':Sequelize[_0x6282('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 01e73c3..779c452 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 _0xcb5c=['../../config/logger','api','moment','bluebird','request-promise','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util'];(function(_0x23c459,_0x323a1a){var _0x5e7e89=function(_0x52dea8){while(--_0x52dea8){_0x23c459['push'](_0x23c459['shift']());}};_0x5e7e89(++_0x323a1a);}(_0xcb5c,0xe8));var _0xccb5=function(_0x32e447,_0x1a501e){_0x32e447=_0x32e447-0x0;var _0x223cb0=_0xcb5c[_0x32e447];return _0x223cb0;};'use strict';var _=require(_0xccb5('0x0'));var util=require(_0xccb5('0x1'));var logger=require(_0xccb5('0x2'))(_0xccb5('0x3'));var moment=require(_0xccb5('0x4'));var BPromise=require(_0xccb5('0x5'));var rp=require(_0xccb5('0x6'));var attributes=require('./userOpenchannelQueue.attributes');module['exports']=function(_0x1559d7,_0x557cb6){return _0x1559d7['define'](_0xccb5('0x7'),attributes,{'tableName':_0xccb5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x415f=['exports','define','user_has_openchannel_queues','lodash','api','moment','bluebird','request-promise','./userOpenchannelQueue.attributes'];(function(_0x703ebd,_0x2674f3){var _0x4f0971=function(_0x2bb5c5){while(--_0x2bb5c5){_0x703ebd['push'](_0x703ebd['shift']());}};_0x4f0971(++_0x2674f3);}(_0x415f,0x81));var _0xf415=function(_0x49d03c,_0xd7bc2b){_0x49d03c=_0x49d03c-0x0;var _0x64411=_0x415f[_0x49d03c];return _0x64411;};'use strict';var _=require(_0xf415('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf415('0x1'));var moment=require(_0xf415('0x2'));var BPromise=require(_0xf415('0x3'));var rp=require(_0xf415('0x4'));var attributes=require(_0xf415('0x5'));module[_0xf415('0x6')]=function(_0x50b204,_0x103102){return _0x50b204[_0xf415('0x7')]('UserOpenchannelQueue',attributes,{'tableName':_0xf415('0x8'),'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 2f9baac..b1c67e8 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 _0x853a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','bluebird','randomstring','../../mysqldb'];(function(_0xef3cc8,_0x3c08ec){var _0x132bbf=function(_0x3c28fd){while(--_0x3c28fd){_0xef3cc8['push'](_0xef3cc8['shift']());}};_0x132bbf(++_0x3c08ec);}(_0x853a,0x94));var _0xa853=function(_0x22ea59,_0x387ed1){_0x22ea59=_0x22ea59-0x0;var _0x444611=_0x853a[_0x22ea59];return _0x444611;};'use strict';var _=require(_0xa853('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa853('0x1'));var rs=require(_0xa853('0x2'));var fs=require('fs');var db=require(_0xa853('0x3'))['db'];var utils=require(_0xa853('0x4'));var logger=require(_0xa853('0x5'))('rpc');var config=require(_0xa853('0x6'));var jayson=require(_0xa853('0x7'));var client=jayson[_0xa853('0x8')][_0xa853('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x131146,_0x38be7b,_0x17d314){return new BPromise(function(_0x9e1200,_0x2d932e){return client[_0xa853('0xa')](_0x131146,_0x17d314)[_0xa853('0xb')](function(_0x31a3d3){logger['info'](_0xa853('0xc'),_0x38be7b,'request\x20sent');logger[_0xa853('0xd')](_0xa853('0xe'),_0x38be7b,_0xa853('0xf'),JSON['stringify'](_0x31a3d3));if(_0x31a3d3[_0xa853('0x10')]){if(_0x31a3d3[_0xa853('0x10')][_0xa853('0x11')]===0x1f4){logger['error'](_0xa853('0xc'),_0x38be7b,_0x31a3d3['error'][_0xa853('0x12')]);return _0x2d932e(_0x31a3d3[_0xa853('0x10')][_0xa853('0x12')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x38be7b,_0x31a3d3[_0xa853('0x10')][_0xa853('0x12')]);return _0x9e1200(_0x31a3d3['error']['message']);}else{logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x38be7b,_0xa853('0xf'));_0x9e1200(_0x31a3d3['result'][_0xa853('0x12')]);}})['catch'](function(_0x21c481){logger['error'](_0xa853('0xc'),_0x38be7b,_0x21c481);_0x2d932e(_0x21c481);});});} \ No newline at end of file +var _0xc8ff=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xc1389,_0xbced76){var _0x3583f3=function(_0x42a34c){while(--_0x42a34c){_0xc1389['push'](_0xc1389['shift']());}};_0x3583f3(++_0xbced76);}(_0xc8ff,0x16c));var _0xfc8f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc8ff[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xfc8f('0x0'));var util=require(_0xfc8f('0x1'));var moment=require(_0xfc8f('0x2'));var BPromise=require(_0xfc8f('0x3'));var rs=require(_0xfc8f('0x4'));var fs=require('fs');var db=require(_0xfc8f('0x5'))['db'];var utils=require(_0xfc8f('0x6'));var logger=require(_0xfc8f('0x7'))('rpc');var config=require(_0xfc8f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfc8f('0x9')][_0xfc8f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a0ba8,_0x1cc150,_0x3c9047){return new BPromise(function(_0x4059a7,_0x41e10f){return client['request'](_0x1a0ba8,_0x3c9047)['then'](function(_0x5ccd18){logger[_0xfc8f('0xb')](_0xfc8f('0xc'),_0x1cc150,_0xfc8f('0xd'));logger['debug'](_0xfc8f('0xe'),_0x1cc150,_0xfc8f('0xd'),JSON['stringify'](_0x5ccd18));if(_0x5ccd18['error']){if(_0x5ccd18[_0xfc8f('0xf')][_0xfc8f('0x10')]===0x1f4){logger[_0xfc8f('0xf')](_0xfc8f('0xc'),_0x1cc150,_0x5ccd18[_0xfc8f('0xf')]['message']);return _0x41e10f(_0x5ccd18['error']['message']);}logger[_0xfc8f('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1cc150,_0x5ccd18[_0xfc8f('0xf')][_0xfc8f('0x11')]);return _0x4059a7(_0x5ccd18['error'][_0xfc8f('0x11')]);}else{logger[_0xfc8f('0xb')](_0xfc8f('0xc'),_0x1cc150,_0xfc8f('0xd'));_0x4059a7(_0x5ccd18[_0xfc8f('0x12')][_0xfc8f('0x11')]);}})[_0xfc8f('0x13')](function(_0x2562f3){logger['error'](_0xfc8f('0xc'),_0x1cc150,_0x2562f3);_0x41e10f(_0x2562f3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3ac1f61..1201cfd 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 _0x5006=['util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer'];(function(_0x4ce73d,_0x1d2f61){var _0x33b7c9=function(_0x4af7b8){while(--_0x4af7b8){_0x4ce73d['push'](_0x4ce73d['shift']());}};_0x33b7c9(++_0x1d2f61);}(_0x5006,0xd8));var _0x6500=function(_0x249326,_0x5d9374){_0x249326=_0x249326-0x0;var _0x4962c2=_0x5006[_0x249326];return _0x4962c2;};'use strict';var multer=require(_0x6500('0x0'));var util=require(_0x6500('0x1'));var path=require('path');var express=require(_0x6500('0x2'));var router=express[_0x6500('0x3')]();var auth=require(_0x6500('0x4'));var interaction=require(_0x6500('0x5'));var config=require(_0x6500('0x6'));module['exports']=router; \ No newline at end of file +var _0x451c=['multer','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x336f47,_0xe423ca){var _0xa87668=function(_0x3bf1e5){while(--_0x3bf1e5){_0x336f47['push'](_0x336f47['shift']());}};_0xa87668(++_0xe423ca);}(_0x451c,0x78));var _0xc451=function(_0x5b0128,_0x411925){_0x5b0128=_0x5b0128-0x0;var _0x507086=_0x451c[_0x5b0128];return _0x507086;};'use strict';var multer=require(_0xc451('0x0'));var util=require('util');var path=require('path');var express=require(_0xc451('0x1'));var router=express[_0xc451('0x2')]();var auth=require(_0xc451('0x3'));var interaction=require(_0xc451('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 748ea35..a74339d 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 _0x1ff3=['exports','sequelize'];(function(_0xc01ec,_0x42a593){var _0x5848a6=function(_0x471a17){while(--_0x471a17){_0xc01ec['push'](_0xc01ec['shift']());}};_0x5848a6(++_0x42a593);}(_0x1ff3,0xd5));var _0x31ff=function(_0x4a9a03,_0x643dec){_0x4a9a03=_0x4a9a03-0x0;var _0x204bd1=_0x1ff3[_0x4a9a03];return _0x204bd1;};'use strict';var Sequelize=require(_0x31ff('0x0'));module[_0x31ff('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3f72=['INTEGER','sequelize'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x3f72,0x115));var _0x23f7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3f72[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x23f7('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x23f7('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 3dc66e0..d265d11 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 _0xd3ea=['request-promise','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x17289b,_0x485e76){var _0x34b6ef=function(_0x3e9af0){while(--_0x3e9af0){_0x17289b['push'](_0x17289b['shift']());}};_0x34b6ef(++_0x485e76);}(_0xd3ea,0x101));var _0xad3e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xd3ea[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0xad3e('0x0'));var util=require(_0xad3e('0x1'));var logger=require(_0xad3e('0x2'))(_0xad3e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad3e('0x4'));var attributes=require(_0xad3e('0x5'));module['exports']=function(_0x33f98e,_0x33013e){return _0x33f98e[_0xad3e('0x6')](_0xad3e('0x7'),attributes,{'tableName':_0xad3e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc57a=['lodash','../../config/logger','request-promise','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xc57a,0x142));var _0xac57=function(_0x1bfd18,_0x3ba1ab){_0x1bfd18=_0x1bfd18-0x0;var _0x17c907=_0xc57a[_0x1bfd18];return _0x17c907;};'use strict';var _=require(_0xac57('0x0'));var util=require('util');var logger=require(_0xac57('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xac57('0x2'));var attributes=require(_0xac57('0x3'));module['exports']=function(_0x1e1dbc,_0x20d0e7){return _0x1e1dbc[_0xac57('0x4')](_0xac57('0x5'),attributes,{'tableName':_0xac57('0x6'),'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 f6afa6a..9342bcf 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 _0x4f03=['catch','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','http','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x4f03,0x17b));var _0x34f0=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x4f03[_0x1a0daa];return _0x1dbe15;};'use strict';var _=require(_0x34f0('0x0'));var util=require('util');var moment=require(_0x34f0('0x1'));var BPromise=require(_0x34f0('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x34f0('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x34f0('0x4'));var config=require(_0x34f0('0x5'));var jayson=require(_0x34f0('0x6'));var client=jayson['client'][_0x34f0('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1ec890,_0xdd575,_0x41abd5){return new BPromise(function(_0x5a4da1,_0x2e2b0e){return client['request'](_0x1ec890,_0x41abd5)['then'](function(_0xec0ebd){logger[_0x34f0('0x8')](_0x34f0('0x9'),_0xdd575,_0x34f0('0xa'));logger['debug'](_0x34f0('0xb'),_0xdd575,_0x34f0('0xa'),JSON[_0x34f0('0xc')](_0xec0ebd));if(_0xec0ebd[_0x34f0('0xd')]){if(_0xec0ebd['error'][_0x34f0('0xe')]===0x1f4){logger[_0x34f0('0xd')](_0x34f0('0x9'),_0xdd575,_0xec0ebd[_0x34f0('0xd')][_0x34f0('0xf')]);return _0x2e2b0e(_0xec0ebd['error'][_0x34f0('0xf')]);}logger[_0x34f0('0xd')](_0x34f0('0x9'),_0xdd575,_0xec0ebd[_0x34f0('0xd')]['message']);return _0x5a4da1(_0xec0ebd[_0x34f0('0xd')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0xdd575,_0x34f0('0xa'));_0x5a4da1(_0xec0ebd[_0x34f0('0x10')][_0x34f0('0xf')]);}})[_0x34f0('0x11')](function(_0x29809a){logger[_0x34f0('0xd')](_0x34f0('0x9'),_0xdd575,_0x29809a);_0x2e2b0e(_0x29809a);});});} \ No newline at end of file +var _0xa8b1=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4563b5,_0x2ceee2){var _0x698853=function(_0x2a2ea){while(--_0x2a2ea){_0x4563b5['push'](_0x4563b5['shift']());}};_0x698853(++_0x2ceee2);}(_0xa8b1,0xae));var _0x1a8b=function(_0x20b6d0,_0x6f4145){_0x20b6d0=_0x20b6d0-0x0;var _0x4700e1=_0xa8b1[_0x20b6d0];return _0x4700e1;};'use strict';var _=require(_0x1a8b('0x0'));var util=require('util');var moment=require(_0x1a8b('0x1'));var BPromise=require(_0x1a8b('0x2'));var rs=require(_0x1a8b('0x3'));var fs=require('fs');var db=require(_0x1a8b('0x4'))['db'];var utils=require(_0x1a8b('0x5'));var logger=require(_0x1a8b('0x6'))(_0x1a8b('0x7'));var config=require('../../config/environment');var jayson=require(_0x1a8b('0x8'));var client=jayson['client'][_0x1a8b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40055a,_0x468b20,_0x140cf5){return new BPromise(function(_0x4490ab,_0x189e6b){return client[_0x1a8b('0xa')](_0x40055a,_0x140cf5)['then'](function(_0x22f832){logger[_0x1a8b('0xb')](_0x1a8b('0xc'),_0x468b20,_0x1a8b('0xd'));logger[_0x1a8b('0xe')](_0x1a8b('0xf'),_0x468b20,_0x1a8b('0xd'),JSON['stringify'](_0x22f832));if(_0x22f832[_0x1a8b('0x10')]){if(_0x22f832[_0x1a8b('0x10')][_0x1a8b('0x11')]===0x1f4){logger[_0x1a8b('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x468b20,_0x22f832['error'][_0x1a8b('0x12')]);return _0x189e6b(_0x22f832[_0x1a8b('0x10')]['message']);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x468b20,_0x22f832[_0x1a8b('0x10')]['message']);return _0x4490ab(_0x22f832[_0x1a8b('0x10')][_0x1a8b('0x12')]);}else{logger[_0x1a8b('0xb')](_0x1a8b('0xc'),_0x468b20,_0x1a8b('0xd'));_0x4490ab(_0x22f832[_0x1a8b('0x13')][_0x1a8b('0x12')]);}})[_0x1a8b('0x14')](function(_0x4b0d39){logger[_0x1a8b('0x10')](_0x1a8b('0xc'),_0x468b20,_0x4b0d39);_0x189e6b(_0x4b0d39);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 2e3e81a..9323a5a 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 _0x9ec2=['Router','multer','path'];(function(_0x29d8ae,_0x175197){var _0x2eca67=function(_0x80b63e){while(--_0x80b63e){_0x29d8ae['push'](_0x29d8ae['shift']());}};_0x2eca67(++_0x175197);}(_0x9ec2,0x88));var _0x29ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9ec2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x29ec('0x0'));var util=require('util');var path=require(_0x29ec('0x1'));var express=require('express');var router=express[_0x29ec('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xa8e6=['../../config/environment','exports','multer','util','Router'];(function(_0x38850c,_0x4c20a3){var _0x41f7e9=function(_0x497331){while(--_0x497331){_0x38850c['push'](_0x38850c['shift']());}};_0x41f7e9(++_0x4c20a3);}(_0xa8e6,0x18d));var _0x6a8e=function(_0x2856f3,_0x644eac){_0x2856f3=_0x2856f3-0x0;var _0x51de75=_0xa8e6[_0x2856f3];return _0x51de75;};'use strict';var multer=require(_0x6a8e('0x0'));var util=require(_0x6a8e('0x1'));var path=require('path');var express=require('express');var router=express[_0x6a8e('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6a8e('0x3'));module[_0x6a8e('0x4')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 7d8a1c9..4729ea3 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 _0x46b8=['INTEGER','sequelize','exports'];(function(_0x520945,_0x28b144){var _0x17067a=function(_0x191ae1){while(--_0x191ae1){_0x520945['push'](_0x520945['shift']());}};_0x17067a(++_0x28b144);}(_0x46b8,0x16c));var _0x846b=function(_0x39314d,_0x5d57ff){_0x39314d=_0x39314d-0x0;var _0x1924e5=_0x46b8[_0x39314d];return _0x1924e5;};'use strict';var Sequelize=require(_0x846b('0x0'));module[_0x846b('0x1')]={'penalty':{'type':Sequelize[_0x846b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8689=['INTEGER','sequelize','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8689,0xd6));var _0x9868=function(_0x28556e,_0x297344){_0x28556e=_0x28556e-0x0;var _0x5f18a2=_0x8689[_0x28556e];return _0x5f18a2;};'use strict';var Sequelize=require(_0x9868('0x0'));module[_0x9868('0x1')]={'penalty':{'type':Sequelize[_0x9868('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 18a37df..3ce0f5a 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 _0x0a90=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','lodash','api','bluebird'];(function(_0x14ea45,_0x41737a){var _0x556f4d=function(_0x5df078){while(--_0x5df078){_0x14ea45['push'](_0x14ea45['shift']());}};_0x556f4d(++_0x41737a);}(_0x0a90,0xe4));var _0x00a9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x0a90[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x00a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x00a9('0x1'));var moment=require('moment');var BPromise=require(_0x00a9('0x2'));var rp=require('request-promise');var attributes=require(_0x00a9('0x3'));module[_0x00a9('0x4')]=function(_0x57b14a,_0x4ef551){return _0x57b14a[_0x00a9('0x5')]('UserVoiceQueue',attributes,{'tableName':_0x00a9('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4742=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define'];(function(_0x3ecd50,_0x5c86c8){var _0x2c8f6f=function(_0xba4e45){while(--_0xba4e45){_0x3ecd50['push'](_0x3ecd50['shift']());}};_0x2c8f6f(++_0x5c86c8);}(_0x4742,0xfb));var _0x2474=function(_0x1c4d77,_0x4382aa){_0x1c4d77=_0x1c4d77-0x0;var _0x4782be=_0x4742[_0x1c4d77];return _0x4782be;};'use strict';var _=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var logger=require(_0x2474('0x2'))(_0x2474('0x3'));var moment=require(_0x2474('0x4'));var BPromise=require(_0x2474('0x5'));var rp=require(_0x2474('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0x2474('0x7')]=function(_0x3fc6e4,_0x80959){return _0x3fc6e4[_0x2474('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x2474('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 9ca2f29..1e1f556 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 _0x6f76=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x5b077b,_0x50b707){var _0x16faf7=function(_0x41ba83){while(--_0x41ba83){_0x5b077b['push'](_0x5b077b['shift']());}};_0x16faf7(++_0x50b707);}(_0x6f76,0x170));var _0x66f7=function(_0x42dc74,_0x4fb156){_0x42dc74=_0x42dc74-0x0;var _0x5402a5=_0x6f76[_0x42dc74];return _0x5402a5;};'use strict';var _=require(_0x66f7('0x0'));var util=require('util');var moment=require(_0x66f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x66f7('0x2'));var fs=require('fs');var db=require(_0x66f7('0x3'))['db'];var utils=require(_0x66f7('0x4'));var logger=require(_0x66f7('0x5'))('rpc');var config=require(_0x66f7('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x66f7('0x7')][_0x66f7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ca39c,_0xa399e4,_0x39429f){return new BPromise(function(_0x298e94,_0x2b4f4e){return client[_0x66f7('0x9')](_0x4ca39c,_0x39429f)[_0x66f7('0xa')](function(_0x3cd72e){logger[_0x66f7('0xb')](_0x66f7('0xc'),_0xa399e4,_0x66f7('0xd'));logger['debug'](_0x66f7('0xe'),_0xa399e4,_0x66f7('0xd'),JSON[_0x66f7('0xf')](_0x3cd72e));if(_0x3cd72e[_0x66f7('0x10')]){if(_0x3cd72e[_0x66f7('0x10')][_0x66f7('0x11')]===0x1f4){logger[_0x66f7('0x10')](_0x66f7('0xc'),_0xa399e4,_0x3cd72e[_0x66f7('0x10')][_0x66f7('0x12')]);return _0x2b4f4e(_0x3cd72e[_0x66f7('0x10')][_0x66f7('0x12')]);}logger['error'](_0x66f7('0xc'),_0xa399e4,_0x3cd72e[_0x66f7('0x10')][_0x66f7('0x12')]);return _0x298e94(_0x3cd72e[_0x66f7('0x10')]['message']);}else{logger[_0x66f7('0xb')](_0x66f7('0xc'),_0xa399e4,_0x66f7('0xd'));_0x298e94(_0x3cd72e[_0x66f7('0x13')]['message']);}})['catch'](function(_0x52e28c){logger[_0x66f7('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0xa399e4,_0x52e28c);_0x2b4f4e(_0x52e28c);});});} \ No newline at end of file +var _0xb3a1=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x115d5b,_0x26aff2){var _0x6cfc50=function(_0x39a786){while(--_0x39a786){_0x115d5b['push'](_0x115d5b['shift']());}};_0x6cfc50(++_0x26aff2);}(_0xb3a1,0xf9));var _0x1b3a=function(_0x2c32bd,_0x297d3b){_0x2c32bd=_0x2c32bd-0x0;var _0x4ae220=_0xb3a1[_0x2c32bd];return _0x4ae220;};'use strict';var _=require(_0x1b3a('0x0'));var util=require(_0x1b3a('0x1'));var moment=require(_0x1b3a('0x2'));var BPromise=require(_0x1b3a('0x3'));var rs=require(_0x1b3a('0x4'));var fs=require('fs');var db=require(_0x1b3a('0x5'))['db'];var utils=require(_0x1b3a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1b3a('0x7')][_0x1b3a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x122a3a,_0x4341b0,_0x3e3bf0){return new BPromise(function(_0x3a22c2,_0x4f554d){return client[_0x1b3a('0x9')](_0x122a3a,_0x3e3bf0)[_0x1b3a('0xa')](function(_0x571745){logger['info'](_0x1b3a('0xb'),_0x4341b0,_0x1b3a('0xc'));logger['debug'](_0x1b3a('0xd'),_0x4341b0,'request\x20sent',JSON['stringify'](_0x571745));if(_0x571745[_0x1b3a('0xe')]){if(_0x571745['error'][_0x1b3a('0xf')]===0x1f4){logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x571745['error'][_0x1b3a('0x10')]);return _0x4f554d(_0x571745[_0x1b3a('0xe')]['message']);}logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x571745[_0x1b3a('0xe')][_0x1b3a('0x10')]);return _0x3a22c2(_0x571745[_0x1b3a('0xe')][_0x1b3a('0x10')]);}else{logger['info'](_0x1b3a('0xb'),_0x4341b0,_0x1b3a('0xc'));_0x3a22c2(_0x571745[_0x1b3a('0x11')][_0x1b3a('0x10')]);}})[_0x1b3a('0x12')](function(_0x3eaa0c){logger[_0x1b3a('0xe')](_0x1b3a('0xb'),_0x4341b0,_0x3eaa0c);_0x4f554d(_0x3eaa0c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index c64526f..ba6343d 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 _0x19ee=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router'];(function(_0x556df5,_0x29eb7f){var _0x23c04a=function(_0x15a991){while(--_0x15a991){_0x556df5['push'](_0x556df5['shift']());}};_0x23c04a(++_0x29eb7f);}(_0x19ee,0x96));var _0xe19e=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x19ee[_0xd39959];return _0x1ff69c;};'use strict';var multer=require(_0xe19e('0x0'));var util=require(_0xe19e('0x1'));var path=require(_0xe19e('0x2'));var express=require('express');var router=express[_0xe19e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xe19e('0x4'));var config=require(_0xe19e('0x5'));module[_0xe19e('0x6')]=router; \ No newline at end of file +var _0xba69=['util','path','express','Router','../../components/interaction/service','../../config/environment','multer'];(function(_0x526ba1,_0x1dc9c2){var _0x126a52=function(_0x9a5e2d){while(--_0x9a5e2d){_0x526ba1['push'](_0x526ba1['shift']());}};_0x126a52(++_0x1dc9c2);}(_0xba69,0x187));var _0x9ba6=function(_0x37fa90,_0x196e37){_0x37fa90=_0x37fa90-0x0;var _0x3b1a92=_0xba69[_0x37fa90];return _0x3b1a92;};'use strict';var multer=require(_0x9ba6('0x0'));var util=require(_0x9ba6('0x1'));var path=require(_0x9ba6('0x2'));var express=require(_0x9ba6('0x3'));var router=express[_0x9ba6('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x9ba6('0x5'));var config=require(_0x9ba6('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index c4daff3..0068508 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 _0x2e25=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x489c75,_0x28a022){var _0x45429d=function(_0x37599f){while(--_0x37599f){_0x489c75['push'](_0x489c75['shift']());}};_0x45429d(++_0x28a022);}(_0x2e25,0x1ef));var _0x52e2=function(_0xf20e33,_0xabebab){_0xf20e33=_0xf20e33-0x0;var _0x325459=_0x2e25[_0xf20e33];return _0x325459;};'use strict';var Sequelize=require(_0x52e2('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x52e2('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x52e2('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x52e2('0x2')},'UserId':{'type':Sequelize[_0x52e2('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x52e2('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0x52e2('0x2')},'VoiceQueueId':{'type':Sequelize[_0x52e2('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x52e2('0x3')],'allowNull':![],'unique':_0x52e2('0x4'),'comment':_0x52e2('0x2')},'penalty':{'type':Sequelize[_0x52e2('0x1')](0xb),'defaultValue':0x0,'comment':_0x52e2('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x52e2('0x2')}}; \ No newline at end of file +var _0x3218=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3d7669,_0x4b8da3){var _0x49764d=function(_0x33d2bc){while(--_0x33d2bc){_0x3d7669['push'](_0x3d7669['shift']());}};_0x49764d(++_0x4b8da3);}(_0x3218,0x158));var _0x8321=function(_0x38eb23,_0x196e8b){_0x38eb23=_0x38eb23-0x0;var _0x48506a=_0x3218[_0x38eb23];return _0x48506a;};'use strict';var Sequelize=require(_0x8321('0x0'));module[_0x8321('0x1')]={'uniqueid':{'type':Sequelize[_0x8321('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8321('0x3')},'membername':{'type':Sequelize[_0x8321('0x4')],'allowNull':![],'comment':_0x8321('0x3')},'UserId':{'type':Sequelize[_0x8321('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8321('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x8321('0x3')},'VoiceQueueId':{'type':Sequelize[_0x8321('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8321('0x5'),'comment':_0x8321('0x3')},'penalty':{'type':Sequelize[_0x8321('0x2')](0xb),'defaultValue':0x0,'comment':_0x8321('0x3')},'paused':{'type':Sequelize[_0x8321('0x2')](0xb),'defaultValue':0x0,'comment':_0x8321('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 172e895..b533e62 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 _0x3b6d=['exports','events','../../mysqldb','save','update','emit','hasOwnProperty','hook'];(function(_0x3b1bdc,_0xb8a6fd){var _0x1ce54a=function(_0x5eb684){while(--_0x5eb684){_0x3b1bdc['push'](_0x3b1bdc['shift']());}};_0x1ce54a(++_0xb8a6fd);}(_0x3b6d,0x131));var _0xd3b6=function(_0x113755,_0x217fc8){_0x113755=_0x113755-0x0;var _0x20e6ef=_0x3b6d[_0x113755];return _0x20e6ef;};'use strict';var EventEmitter=require(_0xd3b6('0x0'));var UserVoiceQueueRt=require(_0xd3b6('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd3b6('0x2'),'afterUpdate':_0xd3b6('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b77bc){return function(_0x4c231a,_0x3795f0,_0x488f3b){UserVoiceQueueRtEvents[_0xd3b6('0x4')](_0x5b77bc+':'+_0x4c231a['id'],_0x4c231a);UserVoiceQueueRtEvents[_0xd3b6('0x4')](_0x5b77bc,_0x4c231a);_0x488f3b(null);};}for(var e in events){if(events[_0xd3b6('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xd3b6('0x6')](e,emitEvent(event));}}module[_0xd3b6('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xccc3=['remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x1cd848,_0x1dcbf7){var _0x352bea=function(_0x4c13ad){while(--_0x4c13ad){_0x1cd848['push'](_0x1cd848['shift']());}};_0x352bea(++_0x1dcbf7);}(_0xccc3,0x1ea));var _0x3ccc=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xccc3[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0x3ccc('0x0'));var UserVoiceQueueRt=require(_0x3ccc('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x3ccc('0x2')](0x0);var events={'afterCreate':_0x3ccc('0x3'),'afterUpdate':_0x3ccc('0x4'),'afterDestroy':_0x3ccc('0x5')};function emitEvent(_0x430157){return function(_0x11998b,_0x27bb99,_0x4fae42){UserVoiceQueueRtEvents[_0x3ccc('0x6')](_0x430157+':'+_0x11998b['id'],_0x11998b);UserVoiceQueueRtEvents[_0x3ccc('0x6')](_0x430157,_0x11998b);_0x4fae42(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x3ccc('0x7')](e,emitEvent(event));}}module[_0x3ccc('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index a496af6..f9ab6f1 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 _0x3836=['exports','define','lodash','util','../../config/logger','api','bluebird','request-promise','./userVoiceQueueRt.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3836,0x17c));var _0x6383=function(_0x4b8ee6,_0x4d3b75){_0x4b8ee6=_0x4b8ee6-0x0;var _0x531138=_0x3836[_0x4b8ee6];return _0x531138;};'use strict';var _=require(_0x6383('0x0'));var util=require(_0x6383('0x1'));var logger=require(_0x6383('0x2'))(_0x6383('0x3'));var moment=require('moment');var BPromise=require(_0x6383('0x4'));var rp=require(_0x6383('0x5'));var attributes=require(_0x6383('0x6'));module[_0x6383('0x7')]=function(_0x9dba28,_0x2cd5fc){return _0x9dba28[_0x6383('0x8')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc866=['./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','../../config/logger','moment','bluebird','request-promise'];(function(_0x12cd4d,_0x2c79d6){var _0x39cd87=function(_0x163cc3){while(--_0x163cc3){_0x12cd4d['push'](_0x12cd4d['shift']());}};_0x39cd87(++_0x2c79d6);}(_0xc866,0x149));var _0x6c86=function(_0x1a9245,_0x2d3b15){_0x1a9245=_0x1a9245-0x0;var _0x80a274=_0xc866[_0x1a9245];return _0x80a274;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c86('0x0'))('api');var moment=require(_0x6c86('0x1'));var BPromise=require(_0x6c86('0x2'));var rp=require(_0x6c86('0x3'));var attributes=require(_0x6c86('0x4'));module[_0x6c86('0x5')]=function(_0x555ba1,_0x4edcaa){return _0x555ba1[_0x6c86('0x6')](_0x6c86('0x7'),attributes,{'tableName':_0x6c86('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 96e7bbd..b82ad00 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 _0xc817=['UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','then','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','socket.io-emitter','./userVoiceQueueRt.socket','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x113d45,_0x13904e){var _0xb0d258=function(_0x3c0982){while(--_0x3c0982){_0x113d45['push'](_0x113d45['shift']());}};_0xb0d258(++_0x13904e);}(_0xc817,0x75));var _0x7c81=function(_0x3f4f5d,_0x1f8285){_0x3f4f5d=_0x3f4f5d-0x0;var _0x4f0f3c=_0xc817[_0x3f4f5d];return _0x4f0f3c;};'use strict';var _=require(_0x7c81('0x0'));var util=require(_0x7c81('0x1'));var moment=require(_0x7c81('0x2'));var BPromise=require(_0x7c81('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x7c81('0x4'))['db'];var utils=require(_0x7c81('0x5'));var logger=require(_0x7c81('0x6'))(_0x7c81('0x7'));var config=require(_0x7c81('0x8'));var jayson=require(_0x7c81('0x9'));var client=jayson['client'][_0x7c81('0xa')]({'port':0x232a});var socket=require(_0x7c81('0xb'))({'host':'localhost','port':0x18eb});require(_0x7c81('0xc'))[_0x7c81('0xd')](socket);function respondWithRpcPromise(_0x5025de,_0x29ee1b,_0x210481){return new BPromise(function(_0x813846,_0x3845f0){return client[_0x7c81('0xe')](_0x5025de,_0x210481)['then'](function(_0x6b563){logger[_0x7c81('0xf')](_0x7c81('0x10'),_0x29ee1b,_0x7c81('0x11'));logger[_0x7c81('0x12')](_0x7c81('0x13'),_0x29ee1b,_0x7c81('0x11'),JSON[_0x7c81('0x14')](_0x6b563));if(_0x6b563[_0x7c81('0x15')]){if(_0x6b563[_0x7c81('0x15')][_0x7c81('0x16')]===0x1f4){logger[_0x7c81('0x15')](_0x7c81('0x10'),_0x29ee1b,_0x6b563[_0x7c81('0x15')][_0x7c81('0x17')]);return _0x3845f0(_0x6b563[_0x7c81('0x15')][_0x7c81('0x17')]);}logger[_0x7c81('0x15')](_0x7c81('0x10'),_0x29ee1b,_0x6b563['error'][_0x7c81('0x17')]);return _0x813846(_0x6b563[_0x7c81('0x15')][_0x7c81('0x17')]);}else{logger[_0x7c81('0xf')](_0x7c81('0x10'),_0x29ee1b,_0x7c81('0x11'));_0x813846(_0x6b563[_0x7c81('0x18')][_0x7c81('0x17')]);}})[_0x7c81('0x19')](function(_0x590e14){logger[_0x7c81('0x15')](_0x7c81('0x10'),_0x29ee1b,_0x590e14);_0x3845f0(_0x590e14);});});}exports[_0x7c81('0x1a')]=function(_0x182a2e){var _0x5d1aa5=this;return new Promise(function(_0x4c2d6c,_0x2e2b44){return db[_0x7c81('0x1b')][_0x7c81('0x1c')]({'raw':_0x182a2e[_0x7c81('0x1d')]?_0x182a2e['options'][_0x7c81('0x1e')]===undefined?!![]:![]:!![],'where':_0x182a2e[_0x7c81('0x1d')]?_0x182a2e[_0x7c81('0x1d')][_0x7c81('0x1f')]||null:null,'attributes':[[db[_0x7c81('0x20')]['fn']('COUNT',db[_0x7c81('0x20')]['fn']('IF',db[_0x7c81('0x20')][_0x7c81('0x21')](_0x7c81('0x22')))),'outboundQueuePauses']]})[_0x7c81('0x23')](function(_0x53bdb2){logger['info']('GetVoiceQueueRtPauses',_0x182a2e);logger[_0x7c81('0x12')]('GetVoiceQueueRtPauses',_0x182a2e,JSON['stringify'](_0x53bdb2));_0x4c2d6c(_0x53bdb2);})['catch'](function(_0x349b5c){logger['error'](_0x7c81('0x1a'),_0x349b5c[_0x7c81('0x17')],_0x182a2e);_0x2e2b44(_0x5d1aa5[_0x7c81('0x15')](0x1f4,_0x349b5c['message']));});});}; \ No newline at end of file +var _0x296f=['UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw','where','sequelize','COUNT','literal','outboundQueuePauses','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','socket.io-emitter','localhost','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x36bff5,_0x3156cb){var _0x80ade5=function(_0x5eee65){while(--_0x5eee65){_0x36bff5['push'](_0x36bff5['shift']());}};_0x80ade5(++_0x3156cb);}(_0x296f,0xf0));var _0xf296=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x296f[_0xf2628e];return _0x13863a;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var db=require(_0xf296('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf296('0x6'));var config=require(_0xf296('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});var socket=require(_0xf296('0x8'))({'host':_0xf296('0x9'),'port':0x18eb});require('./userVoiceQueueRt.socket')[_0xf296('0xa')](socket);function respondWithRpcPromise(_0x3197bc,_0x4b05c5,_0x25ff95){return new BPromise(function(_0x5c891c,_0x1ec8cc){return client[_0xf296('0xb')](_0x3197bc,_0x25ff95)[_0xf296('0xc')](function(_0x59366d){logger[_0xf296('0xd')](_0xf296('0xe'),_0x4b05c5,_0xf296('0xf'));logger['debug'](_0xf296('0x10'),_0x4b05c5,_0xf296('0xf'),JSON[_0xf296('0x11')](_0x59366d));if(_0x59366d[_0xf296('0x12')]){if(_0x59366d[_0xf296('0x12')]['code']===0x1f4){logger['error'](_0xf296('0xe'),_0x4b05c5,_0x59366d[_0xf296('0x12')]['message']);return _0x1ec8cc(_0x59366d[_0xf296('0x12')][_0xf296('0x13')]);}logger['error'](_0xf296('0xe'),_0x4b05c5,_0x59366d[_0xf296('0x12')]['message']);return _0x5c891c(_0x59366d['error']['message']);}else{logger[_0xf296('0xd')](_0xf296('0xe'),_0x4b05c5,_0xf296('0xf'));_0x5c891c(_0x59366d[_0xf296('0x14')][_0xf296('0x13')]);}})[_0xf296('0x15')](function(_0x3db703){logger[_0xf296('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x4b05c5,_0x3db703);_0x1ec8cc(_0x3db703);});});}exports[_0xf296('0x16')]=function(_0x2a931c){var _0xd2a9fd=this;return new Promise(function(_0x2dce6e,_0x468a31){return db[_0xf296('0x17')]['findAll']({'raw':_0x2a931c[_0xf296('0x18')]?_0x2a931c['options'][_0xf296('0x19')]===undefined?!![]:![]:!![],'where':_0x2a931c[_0xf296('0x18')]?_0x2a931c['options'][_0xf296('0x1a')]||null:null,'attributes':[[db[_0xf296('0x1b')]['fn'](_0xf296('0x1c'),db['sequelize']['fn']('IF',db[_0xf296('0x1b')][_0xf296('0x1d')]('`paused`\x20=\x201,\x201,\x20null'))),_0xf296('0x1e')]]})[_0xf296('0xc')](function(_0x1e4562){logger[_0xf296('0xd')](_0xf296('0x16'),_0x2a931c);logger[_0xf296('0x1f')]('GetVoiceQueueRtPauses',_0x2a931c,JSON[_0xf296('0x11')](_0x1e4562));_0x2dce6e(_0x1e4562);})[_0xf296('0x15')](function(_0xd4dc36){logger[_0xf296('0x12')](_0xf296('0x16'),_0xd4dc36[_0xf296('0x13')],_0x2a931c);_0x468a31(_0xd2a9fd['error'](0x1f4,_0xd4dc36[_0xf296('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 01dd459..a5b5e92 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 _0x3f8a=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x172053,_0x379c7e){var _0x893bba=function(_0x4c13d5){while(--_0x4c13d5){_0x172053['push'](_0x172053['shift']());}};_0x893bba(++_0x379c7e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x12ca7a,_0x3295bf){_0x12ca7a=_0x12ca7a-0x0;var _0x2249df=_0x3f8a[_0x12ca7a];return _0x2249df;};'use strict';var UserVoiceQueueRtEvents=require(_0xa3f8('0x0'));var events=[_0xa3f8('0x1'),_0xa3f8('0x2'),_0xa3f8('0x3')];function createListener(_0x512b4c,_0x467a6c){return function(_0x143375){_0x467a6c[_0xa3f8('0x4')](_0x512b4c,_0x143375);};}function removeListener(_0x15b6aa,_0x2553fd){return function(){UserVoiceQueueRtEvents[_0xa3f8('0x5')](_0x15b6aa,_0x2553fd);};}exports[_0xa3f8('0x6')]=function(_0x471464){for(var _0x1f160a=0x0,_0xf895d9=events[_0xa3f8('0x7')];_0x1f160a<_0xf895d9;_0x1f160a++){var _0x268332=events[_0x1f160a];var _0x2faf2e=createListener(_0xa3f8('0x8')+_0x268332,_0x471464);UserVoiceQueueRtEvents['on'](_0x268332,_0x2faf2e);}}; \ No newline at end of file +var _0xcca7=['save','remove','update','removeListener','register','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x255c48,_0x2a4449){var _0xaebda3=function(_0x12a04e){while(--_0x12a04e){_0x255c48['push'](_0x255c48['shift']());}};_0xaebda3(++_0x2a4449);}(_0xcca7,0x1aa));var _0x7cca=function(_0x292304,_0xa7fa2c){_0x292304=_0x292304-0x0;var _0x33a578=_0xcca7[_0x292304];return _0x33a578;};'use strict';var UserVoiceQueueRtEvents=require(_0x7cca('0x0'));var events=[_0x7cca('0x1'),_0x7cca('0x2'),_0x7cca('0x3')];function createListener(_0x5cfce5,_0x4c311e){return function(_0x30823f){_0x4c311e['emit'](_0x5cfce5,_0x30823f);};}function removeListener(_0x3b86a4,_0x9523f7){return function(){UserVoiceQueueRtEvents[_0x7cca('0x4')](_0x3b86a4,_0x9523f7);};}exports[_0x7cca('0x5')]=function(_0x1c6c95){for(var _0xe70805=0x0,_0x5aec51=events['length'];_0xe70805<_0x5aec51;_0xe70805++){var _0x937fad=events[_0xe70805];var _0xd7a28d=createListener(_0x7cca('0x6')+_0x937fad,_0x1c6c95);UserVoiceQueueRtEvents['on'](_0x937fad,_0xd7a28d);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 4643333..3f9b905 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 _0x2df8=['create','put','destroy','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./variable.controller','get','index','/:id','isAuthenticated','post'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x2df8,0x114));var _0x82df=function(_0x2af70f,_0x1a30c5){_0x2af70f=_0x2af70f-0x0;var _0x503d69=_0x2df8[_0x2af70f];return _0x503d69;};'use strict';var multer=require(_0x82df('0x0'));var util=require(_0x82df('0x1'));var path=require('path');var express=require(_0x82df('0x2'));var router=express[_0x82df('0x3')]();var auth=require(_0x82df('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x82df('0x5'));var controller=require(_0x82df('0x6'));router[_0x82df('0x7')]('/',auth['isAuthenticated'](),controller[_0x82df('0x8')]);router[_0x82df('0x7')](_0x82df('0x9'),auth[_0x82df('0xa')](),controller['show']);router[_0x82df('0xb')]('/',auth[_0x82df('0xa')](),controller[_0x82df('0xc')]);router[_0x82df('0xd')](_0x82df('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x82df('0x9'),auth['isAuthenticated'](),controller[_0x82df('0xe')]);module[_0x82df('0xf')]=router; \ No newline at end of file +var _0xc5c7=['../../config/environment','./variable.controller','get','isAuthenticated','index','create','/:id','update','delete','destroy','exports','multer','util','express','../../components/auth/service','../../components/interaction/service'];(function(_0xa1ba6b,_0x8a1478){var _0x4ebb79=function(_0x786673){while(--_0x786673){_0xa1ba6b['push'](_0xa1ba6b['shift']());}};_0x4ebb79(++_0x8a1478);}(_0xc5c7,0x1eb));var _0x7c5c=function(_0x5654ec,_0x3ef289){_0x5654ec=_0x5654ec-0x0;var _0xc0b356=_0xc5c7[_0x5654ec];return _0xc0b356;};'use strict';var multer=require(_0x7c5c('0x0'));var util=require(_0x7c5c('0x1'));var path=require('path');var express=require(_0x7c5c('0x2'));var router=express['Router']();var auth=require(_0x7c5c('0x3'));var interaction=require(_0x7c5c('0x4'));var config=require(_0x7c5c('0x5'));var controller=require(_0x7c5c('0x6'));router[_0x7c5c('0x7')]('/',auth[_0x7c5c('0x8')](),controller[_0x7c5c('0x9')]);router[_0x7c5c('0x7')]('/:id',auth[_0x7c5c('0x8')](),controller['show']);router['post']('/',auth[_0x7c5c('0x8')](),controller[_0x7c5c('0xa')]);router['put'](_0x7c5c('0xb'),auth[_0x7c5c('0x8')](),controller[_0x7c5c('0xc')]);router[_0x7c5c('0xd')](_0x7c5c('0xb'),auth['isAuthenticated'](),controller[_0x7c5c('0xe')]);module[_0x7c5c('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index c9fa1eb..67431ed 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 _0x779f=['exports','STRING'];(function(_0x2f0174,_0x4b79e8){var _0x3f24ab=function(_0x373623){while(--_0x373623){_0x2f0174['push'](_0x2f0174['shift']());}};_0x3f24ab(++_0x4b79e8);}(_0x779f,0x9a));var _0xf779=function(_0x1f598e,_0x4bc378){_0x1f598e=_0x1f598e-0x0;var _0x55392d=_0x779f[_0x1f598e];return _0x55392d;};'use strict';var Sequelize=require('sequelize');module[_0xf779('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf779('0x1')]}}; \ No newline at end of file +var _0x1e96=['name','sequelize'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1e96,0xb5));var _0x61e9=function(_0x292086,_0x533376){_0x292086=_0x292086-0x0;var _0x984216=_0x1e96[_0x292086];return _0x984216;};'use strict';var Sequelize=require(_0x61e9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x61e9('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 30f72c0..0d7eee8 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 _0x4fd5=['then','includeAll','include','rows','catch','create','body','find','params','fast-json-patch','request-promise','moment','path','sox','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','destroy','stack','name','send','index','Variable','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','add','day','merge','map','options','count'];(function(_0xee93b6,_0x58ae47){var _0x1890af=function(_0x34b65b){while(--_0x34b65b){_0xee93b6['push'](_0xee93b6['shift']());}};_0x1890af(++_0x58ae47);}(_0x4fd5,0x89));var _0x54fd=function(_0x2e3418,_0x59ad24){_0x2e3418=_0x2e3418-0x0;var _0x2bb55e=_0x4fd5[_0x2e3418];return _0x2bb55e;};'use strict';var jsonpatch=require(_0x54fd('0x0'));var rp=require(_0x54fd('0x1'));var moment=require(_0x54fd('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x54fd('0x3'));var sox=require(_0x54fd('0x4'));var csv=require('to-csv');var ejs=require(_0x54fd('0x5'));var fs=require('fs');var _=require(_0x54fd('0x6'));var squel=require(_0x54fd('0x7'));var crypto=require('crypto');var jsforce=require(_0x54fd('0x8'));var deskjs=require(_0x54fd('0x9'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x54fd('0xa'));var logger=require('../../config/logger')(_0x54fd('0xb'));var utils=require(_0x54fd('0xc'));var config=require(_0x54fd('0xd'));var db=require(_0x54fd('0xe'))['db'];function respondWithStatusCode(_0xb1ca58,_0x2e6db1){_0x2e6db1=_0x2e6db1||0xcc;return function(_0x237dbd){if(_0x237dbd){return _0xb1ca58[_0x54fd('0xf')](_0x2e6db1);}return _0xb1ca58[_0x54fd('0x10')](_0x2e6db1)[_0x54fd('0x11')]();};}function respondWithResult(_0x4d3e27,_0x5a4fff){_0x5a4fff=_0x5a4fff||0xc8;return function(_0x1a29ea){if(_0x1a29ea){return _0x4d3e27[_0x54fd('0x10')](_0x5a4fff)['json'](_0x1a29ea);}};}function respondWithFilteredResult(_0x25ee89,_0x4954da){return function(_0x4b657a){if(_0x4b657a){var _0x3a0977=_0x4b657a['count'],_0x595dcf=_0x4954da['offset'],_0x275462=_0x4954da[_0x54fd('0x12')]+_0x4954da['limit'],_0x4ec4b6;if(_0x275462>=_0x3a0977){_0x275462=_0x3a0977;_0x4ec4b6=0xc8;}else{_0x4ec4b6=0xce;}_0x25ee89[_0x54fd('0x10')](_0x4ec4b6);return _0x25ee89[_0x54fd('0x13')](_0x54fd('0x14'),_0x595dcf+'-'+_0x275462+'/'+_0x3a0977)[_0x54fd('0x15')](_0x4b657a);}return null;};}function patchUpdates(_0x4b644f){return function(_0x4dded3){try{jsonpatch['apply'](_0x4dded3,_0x4b644f,!![]);}catch(_0x3dcd56){return BPromise[_0x54fd('0x16')](_0x3dcd56);}return _0x4dded3[_0x54fd('0x17')]();};}function saveUpdates(_0x1af7ef,_0x14ed9e){return function(_0x56521b){if(_0x56521b){return _0x56521b[_0x54fd('0x18')](_0x1af7ef)['then'](function(_0x2c3c93){return _0x2c3c93;});}return null;};}function removeEntity(_0x4d629c,_0x152e44){return function(_0xeee04a){if(_0xeee04a){return _0xeee04a[_0x54fd('0x19')]()['then'](function(){_0x4d629c[_0x54fd('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x423eca,_0x4aa3f3){return function(_0x459371){if(!_0x459371){_0x423eca[_0x54fd('0xf')](0x194);}return _0x459371;};}function handleError(_0x1445bc,_0x27ae8a){_0x27ae8a=_0x27ae8a||0x1f4;return function(_0x5c9d7a){logger['error'](_0x5c9d7a[_0x54fd('0x1a')]);if(_0x5c9d7a['name']){delete _0x5c9d7a[_0x54fd('0x1b')];}_0x1445bc[_0x54fd('0x10')](_0x27ae8a)[_0x54fd('0x1c')](_0x5c9d7a);};}exports[_0x54fd('0x1d')]=function(_0x23fe13,_0x1638d7){var _0x590f2b={},_0x1cd66b={},_0x5e18a5={'count':0x0,'rows':[]};var _0x518557=db[_0x54fd('0x1e')][_0x54fd('0x1f')];_0x1cd66b['model']=_[_0x54fd('0x20')](_0x518557);var _0x31ea24={'dateStart':_0x23fe13[_0x54fd('0x21')][_0x54fd('0x22')],'dateEnd':_0x23fe13[_0x54fd('0x21')][_0x54fd('0x23')]};delete _0x23fe13[_0x54fd('0x21')][_0x54fd('0x22')];delete _0x23fe13['query'][_0x54fd('0x23')];_0x1cd66b[_0x54fd('0x21')]=_[_0x54fd('0x20')](_0x23fe13['query']);_0x1cd66b['filters']=_[_0x54fd('0x24')](_0x1cd66b[_0x54fd('0x25')],_0x1cd66b[_0x54fd('0x21')]);_0x590f2b[_0x54fd('0x26')]=_[_0x54fd('0x24')](_0x1cd66b['model'],qs[_0x54fd('0x27')](_0x23fe13[_0x54fd('0x21')]['fields']));_0x590f2b['attributes']=_0x590f2b[_0x54fd('0x26')][_0x54fd('0x28')]?_0x590f2b[_0x54fd('0x26')]:_0x1cd66b[_0x54fd('0x25')];if(!_0x23fe13['query'][_0x54fd('0x29')](_0x54fd('0x2a'))){_0x590f2b[_0x54fd('0x2b')]=qs[_0x54fd('0x2b')](_0x23fe13['query'][_0x54fd('0x2b')]);_0x590f2b[_0x54fd('0x12')]=qs['offset'](_0x23fe13[_0x54fd('0x21')]['offset']);}_0x590f2b[_0x54fd('0x2c')]=qs[_0x54fd('0x2d')](_0x23fe13[_0x54fd('0x21')][_0x54fd('0x2d')]);_0x590f2b[_0x54fd('0x2e')]=qs['filters'](_[_0x54fd('0x2f')](_0x23fe13[_0x54fd('0x21')],_0x1cd66b[_0x54fd('0x30')]));if(_0x31ea24[_0x54fd('0x22')]){if(_0x31ea24[_0x54fd('0x23')]){_0x31ea24['dateEnd']=moment(_0x31ea24[_0x54fd('0x23')])[_0x54fd('0x31')](0x1,_0x54fd('0x32'));}else{_0x31ea24[_0x54fd('0x23')]=moment(_0x31ea24[_0x54fd('0x22')])[_0x54fd('0x31')](0x1,'day');}_[_0x54fd('0x33')](_0x590f2b[_0x54fd('0x2e')],{'createdAt':{'$gte':_0x31ea24[_0x54fd('0x22')],'$lte':_0x31ea24[_0x54fd('0x23')]}});}if(_0x23fe13[_0x54fd('0x21')]['filter']){_0x590f2b[_0x54fd('0x2e')]=_[_0x54fd('0x33')](_0x590f2b[_0x54fd('0x2e')],{'$or':_[_0x54fd('0x34')](_0x590f2b['attributes'],function(_0x42182a){var _0x5e1a77={};_0x5e1a77[_0x42182a]={'$like':'%'+_0x23fe13[_0x54fd('0x21')]['filter']+'%'};return _0x5e1a77;})});}_0x590f2b=_[_0x54fd('0x33')]({},_0x590f2b,_0x23fe13[_0x54fd('0x35')]);var _0x3bdcbc={'where':_0x590f2b[_0x54fd('0x2e')]};return db[_0x54fd('0x1e')][_0x54fd('0x36')](_0x3bdcbc)[_0x54fd('0x37')](function(_0x327092){_0x5e18a5[_0x54fd('0x36')]=_0x327092;if(_0x23fe13[_0x54fd('0x21')][_0x54fd('0x38')]){_0x590f2b[_0x54fd('0x39')]=[{'all':!![]}];}return db[_0x54fd('0x1e')]['findAll'](_0x590f2b);})[_0x54fd('0x37')](function(_0x4f3071){_0x5e18a5[_0x54fd('0x3a')]=_0x4f3071;return _0x5e18a5;})['then'](respondWithFilteredResult(_0x1638d7,_0x590f2b))[_0x54fd('0x3b')](handleError(_0x1638d7,null));};exports['show']=function(_0x204871,_0x4f29c8){var _0x4a839c={'raw':!![],'where':{'id':_0x204871['params']['id']}},_0x2c6196={};_0x2c6196[_0x54fd('0x25')]=_[_0x54fd('0x20')](db[_0x54fd('0x1e')][_0x54fd('0x1f')]);_0x2c6196[_0x54fd('0x21')]=_['keys'](_0x204871[_0x54fd('0x21')]);_0x2c6196[_0x54fd('0x30')]=_[_0x54fd('0x24')](_0x2c6196[_0x54fd('0x25')],_0x2c6196[_0x54fd('0x21')]);_0x4a839c[_0x54fd('0x26')]=_[_0x54fd('0x24')](_0x2c6196[_0x54fd('0x25')],qs[_0x54fd('0x27')](_0x204871[_0x54fd('0x21')]['fields']));_0x4a839c[_0x54fd('0x26')]=_0x4a839c['attributes'][_0x54fd('0x28')]?_0x4a839c['attributes']:_0x2c6196[_0x54fd('0x25')];if(_0x204871[_0x54fd('0x21')][_0x54fd('0x38')]){_0x4a839c['include']=[{'all':!![]}];}_0x4a839c=_['merge']({},_0x4a839c,_0x204871[_0x54fd('0x35')]);return db[_0x54fd('0x1e')]['find'](_0x4a839c)[_0x54fd('0x37')](handleEntityNotFound(_0x4f29c8,null))[_0x54fd('0x37')](respondWithResult(_0x4f29c8,null))['catch'](handleError(_0x4f29c8,null));};exports['create']=function(_0x531ab9,_0x4d0a41){return db['Variable'][_0x54fd('0x3c')](_0x531ab9[_0x54fd('0x3d')],{})[_0x54fd('0x37')](respondWithResult(_0x4d0a41,0xc9))[_0x54fd('0x3b')](handleError(_0x4d0a41,null));};exports[_0x54fd('0x18')]=function(_0x4f8065,_0x48a0e6){if(_0x4f8065['body']['id']){delete _0x4f8065[_0x54fd('0x3d')]['id'];}return db[_0x54fd('0x1e')][_0x54fd('0x3e')]({'where':{'id':_0x4f8065[_0x54fd('0x3f')]['id']}})[_0x54fd('0x37')](handleEntityNotFound(_0x48a0e6,null))[_0x54fd('0x37')](saveUpdates(_0x4f8065[_0x54fd('0x3d')],null))['then'](respondWithResult(_0x48a0e6,null))[_0x54fd('0x3b')](handleError(_0x48a0e6,null));};exports[_0x54fd('0x19')]=function(_0x2fc45c,_0x37d2a8){return db['Variable'][_0x54fd('0x3e')]({'where':{'id':_0x2fc45c['params']['id']}})['then'](handleEntityNotFound(_0x37d2a8,null))[_0x54fd('0x37')](removeEntity(_0x37d2a8,null))[_0x54fd('0x3b')](handleError(_0x37d2a8,null));}; \ No newline at end of file +var _0x8145=['query','dateEnd','filters','attributes','intersection','fields','length','nolimit','limit','offset','order','sort','where','pick','add','day','merge','filter','options','includeAll','findAll','rows','catch','show','params','keys','find','create','body','moment','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','Variable','rawAttributes','model','dateStart'];(function(_0x135a1c,_0x28b5f6){var _0x295c98=function(_0x2747fc){while(--_0x2747fc){_0x135a1c['push'](_0x135a1c['shift']());}};_0x295c98(++_0x28b5f6);}(_0x8145,0xdd));var _0x5814=function(_0x447cc2,_0x276966){_0x447cc2=_0x447cc2-0x0;var _0x17c0ee=_0x8145[_0x447cc2];return _0x17c0ee;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5814('0x0'));var BPromise=require(_0x5814('0x1'));var Mustache=require(_0x5814('0x2'));var util=require(_0x5814('0x3'));var path=require(_0x5814('0x4'));var sox=require('sox');var csv=require(_0x5814('0x5'));var ejs=require(_0x5814('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5814('0x7'));var crypto=require('crypto');var jsforce=require(_0x5814('0x8'));var deskjs=require(_0x5814('0x9'));var toCsv=require(_0x5814('0x5'));var querystring=require(_0x5814('0xa'));var Papa=require('papaparse');var qs=require(_0x5814('0xb'));var logger=require(_0x5814('0xc'))(_0x5814('0xd'));var utils=require('../../config/utils');var config=require(_0x5814('0xe'));var db=require(_0x5814('0xf'))['db'];function respondWithStatusCode(_0xb9b6fa,_0x4c436a){_0x4c436a=_0x4c436a||0xcc;return function(_0x15215c){if(_0x15215c){return _0xb9b6fa[_0x5814('0x10')](_0x4c436a);}return _0xb9b6fa[_0x5814('0x11')](_0x4c436a)[_0x5814('0x12')]();};}function respondWithResult(_0x3c62d1,_0x433520){_0x433520=_0x433520||0xc8;return function(_0x1e6f6b){if(_0x1e6f6b){return _0x3c62d1[_0x5814('0x11')](_0x433520)[_0x5814('0x13')](_0x1e6f6b);}};}function respondWithFilteredResult(_0x32d4a2,_0x32c6cc){return function(_0x59fc47){if(_0x59fc47){var _0x1822dd=_0x59fc47[_0x5814('0x14')],_0x5165ef=_0x32c6cc['offset'],_0x1344a5=_0x32c6cc['offset']+_0x32c6cc['limit'],_0x41945a;if(_0x1344a5>=_0x1822dd){_0x1344a5=_0x1822dd;_0x41945a=0xc8;}else{_0x41945a=0xce;}_0x32d4a2[_0x5814('0x11')](_0x41945a);return _0x32d4a2[_0x5814('0x15')](_0x5814('0x16'),_0x5165ef+'-'+_0x1344a5+'/'+_0x1822dd)[_0x5814('0x13')](_0x59fc47);}return null;};}function patchUpdates(_0x38f48a){return function(_0x1e0d9c){try{jsonpatch[_0x5814('0x17')](_0x1e0d9c,_0x38f48a,!![]);}catch(_0x272cd1){return BPromise[_0x5814('0x18')](_0x272cd1);}return _0x1e0d9c['save']();};}function saveUpdates(_0x2a1ce5,_0x3c79e6){return function(_0xb55f5){if(_0xb55f5){return _0xb55f5['update'](_0x2a1ce5)['then'](function(_0x29ee7c){return _0x29ee7c;});}return null;};}function removeEntity(_0x169776,_0x2cf69f){return function(_0x5f3ad9){if(_0x5f3ad9){return _0x5f3ad9[_0x5814('0x19')]()[_0x5814('0x1a')](function(){_0x169776['status'](0xcc)[_0x5814('0x12')]();});}};}function handleEntityNotFound(_0x4b15a9,_0xeb72f4){return function(_0x569b2a){if(!_0x569b2a){_0x4b15a9['sendStatus'](0x194);}return _0x569b2a;};}function handleError(_0x5eae5d,_0x23d2d9){_0x23d2d9=_0x23d2d9||0x1f4;return function(_0x2999b1){logger['error'](_0x2999b1[_0x5814('0x1b')]);if(_0x2999b1[_0x5814('0x1c')]){delete _0x2999b1[_0x5814('0x1c')];}_0x5eae5d['status'](_0x23d2d9)[_0x5814('0x1d')](_0x2999b1);};}exports[_0x5814('0x1e')]=function(_0x27fd54,_0x173c76){var _0x34dd96={},_0xbc810d={},_0x106c38={'count':0x0,'rows':[]};var _0x4d87b1=db[_0x5814('0x1f')][_0x5814('0x20')];_0xbc810d[_0x5814('0x21')]=_['keys'](_0x4d87b1);var _0x5e44da={'dateStart':_0x27fd54['query'][_0x5814('0x22')],'dateEnd':_0x27fd54[_0x5814('0x23')]['dateEnd']};delete _0x27fd54[_0x5814('0x23')][_0x5814('0x22')];delete _0x27fd54[_0x5814('0x23')][_0x5814('0x24')];_0xbc810d['query']=_['keys'](_0x27fd54[_0x5814('0x23')]);_0xbc810d[_0x5814('0x25')]=_['intersection'](_0xbc810d['model'],_0xbc810d[_0x5814('0x23')]);_0x34dd96[_0x5814('0x26')]=_[_0x5814('0x27')](_0xbc810d[_0x5814('0x21')],qs[_0x5814('0x28')](_0x27fd54[_0x5814('0x23')][_0x5814('0x28')]));_0x34dd96['attributes']=_0x34dd96['attributes'][_0x5814('0x29')]?_0x34dd96[_0x5814('0x26')]:_0xbc810d['model'];if(!_0x27fd54[_0x5814('0x23')]['hasOwnProperty'](_0x5814('0x2a'))){_0x34dd96['limit']=qs['limit'](_0x27fd54[_0x5814('0x23')][_0x5814('0x2b')]);_0x34dd96[_0x5814('0x2c')]=qs['offset'](_0x27fd54[_0x5814('0x23')][_0x5814('0x2c')]);}_0x34dd96[_0x5814('0x2d')]=qs[_0x5814('0x2e')](_0x27fd54[_0x5814('0x23')][_0x5814('0x2e')]);_0x34dd96[_0x5814('0x2f')]=qs['filters'](_[_0x5814('0x30')](_0x27fd54[_0x5814('0x23')],_0xbc810d['filters']));if(_0x5e44da['dateStart']){if(_0x5e44da[_0x5814('0x24')]){_0x5e44da[_0x5814('0x24')]=moment(_0x5e44da[_0x5814('0x24')])[_0x5814('0x31')](0x1,_0x5814('0x32'));}else{_0x5e44da[_0x5814('0x24')]=moment(_0x5e44da[_0x5814('0x22')])['add'](0x1,_0x5814('0x32'));}_[_0x5814('0x33')](_0x34dd96[_0x5814('0x2f')],{'createdAt':{'$gte':_0x5e44da['dateStart'],'$lte':_0x5e44da[_0x5814('0x24')]}});}if(_0x27fd54[_0x5814('0x23')][_0x5814('0x34')]){_0x34dd96[_0x5814('0x2f')]=_['merge'](_0x34dd96[_0x5814('0x2f')],{'$or':_['map'](_0x34dd96['attributes'],function(_0x55b9f6){var _0x5a305a={};_0x5a305a[_0x55b9f6]={'$like':'%'+_0x27fd54[_0x5814('0x23')][_0x5814('0x34')]+'%'};return _0x5a305a;})});}_0x34dd96=_['merge']({},_0x34dd96,_0x27fd54[_0x5814('0x35')]);var _0x47c2a7={'where':_0x34dd96[_0x5814('0x2f')]};return db[_0x5814('0x1f')][_0x5814('0x14')](_0x47c2a7)['then'](function(_0x2725a7){_0x106c38['count']=_0x2725a7;if(_0x27fd54[_0x5814('0x23')][_0x5814('0x36')]){_0x34dd96['include']=[{'all':!![]}];}return db[_0x5814('0x1f')][_0x5814('0x37')](_0x34dd96);})[_0x5814('0x1a')](function(_0x231832){_0x106c38[_0x5814('0x38')]=_0x231832;return _0x106c38;})[_0x5814('0x1a')](respondWithFilteredResult(_0x173c76,_0x34dd96))[_0x5814('0x39')](handleError(_0x173c76,null));};exports[_0x5814('0x3a')]=function(_0x5c9a3c,_0x5d5569){var _0x1783ca={'raw':!![],'where':{'id':_0x5c9a3c[_0x5814('0x3b')]['id']}},_0x37aaf1={};_0x37aaf1[_0x5814('0x21')]=_[_0x5814('0x3c')](db['Variable'][_0x5814('0x20')]);_0x37aaf1[_0x5814('0x23')]=_[_0x5814('0x3c')](_0x5c9a3c[_0x5814('0x23')]);_0x37aaf1[_0x5814('0x25')]=_[_0x5814('0x27')](_0x37aaf1[_0x5814('0x21')],_0x37aaf1[_0x5814('0x23')]);_0x1783ca['attributes']=_[_0x5814('0x27')](_0x37aaf1[_0x5814('0x21')],qs['fields'](_0x5c9a3c['query'][_0x5814('0x28')]));_0x1783ca[_0x5814('0x26')]=_0x1783ca[_0x5814('0x26')]['length']?_0x1783ca['attributes']:_0x37aaf1[_0x5814('0x21')];if(_0x5c9a3c[_0x5814('0x23')][_0x5814('0x36')]){_0x1783ca['include']=[{'all':!![]}];}_0x1783ca=_['merge']({},_0x1783ca,_0x5c9a3c[_0x5814('0x35')]);return db[_0x5814('0x1f')][_0x5814('0x3d')](_0x1783ca)[_0x5814('0x1a')](handleEntityNotFound(_0x5d5569,null))[_0x5814('0x1a')](respondWithResult(_0x5d5569,null))[_0x5814('0x39')](handleError(_0x5d5569,null));};exports['create']=function(_0x3fce44,_0x242adf){return db['Variable'][_0x5814('0x3e')](_0x3fce44[_0x5814('0x3f')],{})[_0x5814('0x1a')](respondWithResult(_0x242adf,0xc9))[_0x5814('0x39')](handleError(_0x242adf,null));};exports['update']=function(_0x2328b1,_0x4f15dd){if(_0x2328b1[_0x5814('0x3f')]['id']){delete _0x2328b1[_0x5814('0x3f')]['id'];}return db['Variable'][_0x5814('0x3d')]({'where':{'id':_0x2328b1['params']['id']}})[_0x5814('0x1a')](handleEntityNotFound(_0x4f15dd,null))['then'](saveUpdates(_0x2328b1[_0x5814('0x3f')],null))['then'](respondWithResult(_0x4f15dd,null))[_0x5814('0x39')](handleError(_0x4f15dd,null));};exports['destroy']=function(_0x4f3e96,_0x190716){return db['Variable'][_0x5814('0x3d')]({'where':{'id':_0x4f3e96['params']['id']}})[_0x5814('0x1a')](handleEntityNotFound(_0x190716,null))['then'](removeEntity(_0x190716,null))[_0x5814('0x39')](handleError(_0x190716,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index f297ae9..2d0ea2d 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 _0x1cb9=['exports','define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','./variable.attributes'];(function(_0x23fcec,_0x48ec4c){var _0x447567=function(_0x4781bb){while(--_0x4781bb){_0x23fcec['push'](_0x23fcec['shift']());}};_0x447567(++_0x48ec4c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3fbec5,_0x226653){_0x3fbec5=_0x3fbec5-0x0;var _0x58240e=_0x1cb9[_0x3fbec5];return _0x58240e;};'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 attributes=require(_0x91cb('0x5'));module[_0x91cb('0x6')]=function(_0x5652cd,_0x17c21c){return _0x5652cd[_0x91cb('0x7')](_0x91cb('0x8'),attributes,{'tableName':_0x91cb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ef3=['api','moment','bluebird','./variable.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x147a36,_0x1d475b){var _0x1abb1a=function(_0xec2ba8){while(--_0xec2ba8){_0x147a36['push'](_0x147a36['shift']());}};_0x1abb1a(++_0x1d475b);}(_0x2ef3,0xba));var _0x32ef=function(_0x1dcff2,_0x12c6be){_0x1dcff2=_0x1dcff2-0x0;var _0x44b4a6=_0x2ef3[_0x1dcff2];return _0x44b4a6;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var attributes=require(_0x32ef('0x6'));module[_0x32ef('0x7')]=function(_0x524ab6,_0x402857){return _0x524ab6[_0x32ef('0x8')]('Variable',attributes,{'tableName':'tools_variables','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 bf31613..9b398fa 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 _0xb34d=['model','info','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','Variable,\x20%s,\x20%s','message','result','catch','ShowVariable','Variable','find','options','where','attributes','include','map'];(function(_0x32063f,_0x4eb145){var _0x3dfcf5=function(_0x3b8ff8){while(--_0x3b8ff8){_0x32063f['push'](_0x32063f['shift']());}};_0x3dfcf5(++_0x4eb145);}(_0xb34d,0x1f1));var _0xdb34=function(_0x4f2a08,_0x53ab9a){_0x4f2a08=_0x4f2a08-0x0;var _0x1ab66e=_0xb34d[_0x4f2a08];return _0x1ab66e;};'use strict';var _=require(_0xdb34('0x0'));var util=require(_0xdb34('0x1'));var moment=require(_0xdb34('0x2'));var BPromise=require(_0xdb34('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xdb34('0x4'))['db'];var utils=require(_0xdb34('0x5'));var logger=require(_0xdb34('0x6'))(_0xdb34('0x7'));var config=require(_0xdb34('0x8'));var jayson=require(_0xdb34('0x9'));var client=jayson[_0xdb34('0xa')][_0xdb34('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365b1c,_0x2c66ef,_0x46001e){return new BPromise(function(_0xee3c5,_0x579523){return client[_0xdb34('0xc')](_0x365b1c,_0x46001e)[_0xdb34('0xd')](function(_0x1e1757){logger['info']('Variable,\x20%s,\x20%s',_0x2c66ef,_0xdb34('0xe'));logger[_0xdb34('0xf')](_0xdb34('0x10'),_0x2c66ef,_0xdb34('0xe'),JSON[_0xdb34('0x11')](_0x1e1757));if(_0x1e1757[_0xdb34('0x12')]){if(_0x1e1757[_0xdb34('0x12')]['code']===0x1f4){logger['error'](_0xdb34('0x13'),_0x2c66ef,_0x1e1757['error']['message']);return _0x579523(_0x1e1757['error']['message']);}logger[_0xdb34('0x12')](_0xdb34('0x13'),_0x2c66ef,_0x1e1757[_0xdb34('0x12')]['message']);return _0xee3c5(_0x1e1757[_0xdb34('0x12')][_0xdb34('0x14')]);}else{logger['info'](_0xdb34('0x13'),_0x2c66ef,_0xdb34('0xe'));_0xee3c5(_0x1e1757[_0xdb34('0x15')][_0xdb34('0x14')]);}})[_0xdb34('0x16')](function(_0x4858ae){logger[_0xdb34('0x12')](_0xdb34('0x13'),_0x2c66ef,_0x4858ae);_0x579523(_0x4858ae);});});}exports[_0xdb34('0x17')]=function(_0x1d9513){var _0x34d5d3=this;return new Promise(function(_0x297c9b,_0x2e78ab){return db[_0xdb34('0x18')][_0xdb34('0x19')]({'raw':_0x1d9513['options']?_0x1d9513[_0xdb34('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d9513[_0xdb34('0x1a')]?_0x1d9513[_0xdb34('0x1a')][_0xdb34('0x1b')]||null:null,'attributes':_0x1d9513['options']?_0x1d9513[_0xdb34('0x1a')][_0xdb34('0x1c')]||null:null,'include':_0x1d9513[_0xdb34('0x1a')]?_0x1d9513['options'][_0xdb34('0x1d')]?_[_0xdb34('0x1e')](_0x1d9513[_0xdb34('0x1a')][_0xdb34('0x1d')],function(_0x20ed1a){return{'model':db[_0x20ed1a[_0xdb34('0x1f')]],'as':_0x20ed1a['as'],'attributes':_0x20ed1a[_0xdb34('0x1c')],'include':_0x20ed1a[_0xdb34('0x1d')]?_[_0xdb34('0x1e')](_0x20ed1a[_0xdb34('0x1d')],function(_0x50368c){return{'model':db[_0x50368c[_0xdb34('0x1f')]],'as':_0x50368c['as'],'attributes':_0x50368c[_0xdb34('0x1c')],'include':_0x50368c[_0xdb34('0x1d')]?_[_0xdb34('0x1e')](_0x50368c['include'],function(_0x36983c){return{'model':db[_0x36983c[_0xdb34('0x1f')]],'as':_0x36983c['as'],'attributes':_0x36983c[_0xdb34('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f0270){logger[_0xdb34('0x20')]('ShowVariable',_0x1d9513);logger[_0xdb34('0xf')](_0xdb34('0x17'),_0x1d9513,JSON[_0xdb34('0x11')](_0x4f0270));_0x297c9b(_0x4f0270);})[_0xdb34('0x16')](function(_0x51afed){logger['error']('ShowVariable',_0x51afed[_0xdb34('0x14')],_0x1d9513);_0x2e78ab(_0x34d5d3[_0xdb34('0x12')](0x1f4,_0x51afed[_0xdb34('0x14')]));});});}; \ No newline at end of file +var _0xe9b4=['client','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','Variable','find','options','raw','attributes','map','include','model','stringify','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x888fe5,_0x2c1477){var _0x3fa3bb=function(_0x833515){while(--_0x833515){_0x888fe5['push'](_0x888fe5['shift']());}};_0x3fa3bb(++_0x2c1477);}(_0xe9b4,0x106));var _0x4e9b=function(_0x2eabfa,_0x36e3ff){_0x2eabfa=_0x2eabfa-0x0;var _0x401a26=_0xe9b4[_0x2eabfa];return _0x401a26;};'use strict';var _=require(_0x4e9b('0x0'));var util=require(_0x4e9b('0x1'));var moment=require(_0x4e9b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0x4e9b('0x3'))['db'];var utils=require(_0x4e9b('0x4'));var logger=require('../../config/logger')(_0x4e9b('0x5'));var config=require(_0x4e9b('0x6'));var jayson=require(_0x4e9b('0x7'));var client=jayson[_0x4e9b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b5b8e,_0xcedaa6,_0x2795c6){return new BPromise(function(_0x1917bc,_0x342675){return client['request'](_0x4b5b8e,_0x2795c6)[_0x4e9b('0x9')](function(_0x2b6204){logger[_0x4e9b('0xa')](_0x4e9b('0xb'),_0xcedaa6,_0x4e9b('0xc'));logger[_0x4e9b('0xd')](_0x4e9b('0xe'),_0xcedaa6,_0x4e9b('0xc'),JSON['stringify'](_0x2b6204));if(_0x2b6204[_0x4e9b('0xf')]){if(_0x2b6204['error'][_0x4e9b('0x10')]===0x1f4){logger[_0x4e9b('0xf')](_0x4e9b('0xb'),_0xcedaa6,_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);return _0x342675(_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);}logger['error']('Variable,\x20%s,\x20%s',_0xcedaa6,_0x2b6204[_0x4e9b('0xf')][_0x4e9b('0x11')]);return _0x1917bc(_0x2b6204['error'][_0x4e9b('0x11')]);}else{logger[_0x4e9b('0xa')](_0x4e9b('0xb'),_0xcedaa6,_0x4e9b('0xc'));_0x1917bc(_0x2b6204[_0x4e9b('0x12')][_0x4e9b('0x11')]);}})[_0x4e9b('0x13')](function(_0x2f33ef){logger['error'](_0x4e9b('0xb'),_0xcedaa6,_0x2f33ef);_0x342675(_0x2f33ef);});});}exports[_0x4e9b('0x14')]=function(_0x559353){var _0x31dfef=this;return new Promise(function(_0x1f3a6c,_0x4239c4){return db[_0x4e9b('0x15')][_0x4e9b('0x16')]({'raw':_0x559353['options']?_0x559353[_0x4e9b('0x17')][_0x4e9b('0x18')]===undefined?!![]:![]:!![],'where':_0x559353[_0x4e9b('0x17')]?_0x559353[_0x4e9b('0x17')]['where']||null:null,'attributes':_0x559353[_0x4e9b('0x17')]?_0x559353['options'][_0x4e9b('0x19')]||null:null,'include':_0x559353['options']?_0x559353[_0x4e9b('0x17')]['include']?_[_0x4e9b('0x1a')](_0x559353[_0x4e9b('0x17')][_0x4e9b('0x1b')],function(_0x53f3cd){return{'model':db[_0x53f3cd[_0x4e9b('0x1c')]],'as':_0x53f3cd['as'],'attributes':_0x53f3cd[_0x4e9b('0x19')],'include':_0x53f3cd[_0x4e9b('0x1b')]?_[_0x4e9b('0x1a')](_0x53f3cd['include'],function(_0x3931ce){return{'model':db[_0x3931ce[_0x4e9b('0x1c')]],'as':_0x3931ce['as'],'attributes':_0x3931ce[_0x4e9b('0x19')],'include':_0x3931ce[_0x4e9b('0x1b')]?_[_0x4e9b('0x1a')](_0x3931ce[_0x4e9b('0x1b')],function(_0x35e076){return{'model':db[_0x35e076['model']],'as':_0x35e076['as'],'attributes':_0x35e076[_0x4e9b('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4e9b('0x9')](function(_0x56d483){logger[_0x4e9b('0xa')](_0x4e9b('0x14'),_0x559353);logger[_0x4e9b('0xd')](_0x4e9b('0x14'),_0x559353,JSON[_0x4e9b('0x1d')](_0x56d483));_0x1f3a6c(_0x56d483);})[_0x4e9b('0x13')](function(_0x5238c3){logger[_0x4e9b('0xf')](_0x4e9b('0x14'),_0x5238c3[_0x4e9b('0x11')],_0x559353);_0x4239c4(_0x31dfef[_0x4e9b('0xf')](0x1f4,_0x5238c3[_0x4e9b('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4e1263b..183e324 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 _0x27be=['exports','express','../../components/auth/service','./version.controller','/fetch','isAuthenticated','fetch','get','canUpdate','/pull','/restart','restart','/migrations'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x27be,0x1e2));var _0xe27b=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x27be[_0x5f36cd];return _0x49832a;};'use strict';var express=require(_0xe27b('0x0'));var router=express['Router']();var auth=require(_0xe27b('0x1'));var controller=require(_0xe27b('0x2'));router['get']('/',controller['index']);router['get'](_0xe27b('0x3'),auth[_0xe27b('0x4')](),auth['canUpdate'](),controller[_0xe27b('0x5')]);router[_0xe27b('0x6')]('/reset',auth[_0xe27b('0x4')](),auth[_0xe27b('0x7')](),controller['reset']);router[_0xe27b('0x6')](_0xe27b('0x8'),auth[_0xe27b('0x4')](),auth[_0xe27b('0x7')](),controller['pull']);router[_0xe27b('0x6')](_0xe27b('0x9'),auth[_0xe27b('0x4')](),controller[_0xe27b('0xa')]);router[_0xe27b('0x6')](_0xe27b('0xb'),controller['migrations']);module[_0xe27b('0xc')]=router; \ No newline at end of file +var _0x4f3b=['migrations','exports','express','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch','pull','/restart','restart','/migrations'];(function(_0x563227,_0x2b13bc){var _0x43def3=function(_0x3f8c01){while(--_0x3f8c01){_0x563227['push'](_0x563227['shift']());}};_0x43def3(++_0x2b13bc);}(_0x4f3b,0x147));var _0xb4f3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x4f3b[_0x126558];return _0x1f6d14;};'use strict';var express=require(_0xb4f3('0x0'));var router=express['Router']();var auth=require(_0xb4f3('0x1'));var controller=require(_0xb4f3('0x2'));router[_0xb4f3('0x3')]('/',controller['index']);router[_0xb4f3('0x3')]('/fetch',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller[_0xb4f3('0x6')]);router[_0xb4f3('0x3')]('/reset',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller['reset']);router[_0xb4f3('0x3')]('/pull',auth[_0xb4f3('0x4')](),auth[_0xb4f3('0x5')](),controller[_0xb4f3('0x7')]);router[_0xb4f3('0x3')](_0xb4f3('0x8'),auth[_0xb4f3('0x4')](),controller[_0xb4f3('0x9')]);router[_0xb4f3('0x3')](_0xb4f3('0xa'),controller[_0xb4f3('0xb')]);module[_0xb4f3('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index f03e4a8..17f1473 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 _0x9957=['status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20Migration\x20Completed!','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x46f01c,_0x3833de){var _0x2a9593=function(_0x40e7ca){while(--_0x40e7ca){_0x46f01c['push'](_0x46f01c['shift']());}};_0x2a9593(++_0x3833de);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Umzug=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var pkginfo=require(_0x7995('0x2'))(module,_0x7995('0x3'));var exec=require('child_process')[_0x7995('0x4')];var db=require(_0x7995('0x5'))['db'];var config=require(_0x7995('0x6'));var pm2=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var git=require(_0x7995('0x9'))(config[_0x7995('0xa')]);exports[_0x7995('0xb')]=function(_0xbda126,_0x326741){var _0x4996ca={'current':module[_0x7995('0xc')][_0x7995('0x3')],'phonebar':0x2};if(_0xbda126['query']&&_0xbda126[_0x7995('0xd')][_0x7995('0xe')]){return git[_0x7995('0xf')]()[_0x7995('0x10')](function(_0x3c1d19,_0x1e400a){_0x4996ca[_0x7995('0xe')]=(_0x3c1d19?module['exports'][_0x7995('0x3')]:_0x1e400a[_0x7995('0xe')])||'2.0.0';return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);});}else{return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);}};exports[_0x7995('0xf')]=function(_0x23999f,_0x2bbe7a){return git['fetch'](['origin',_0x7995('0x13')],function(_0x2233dd){if(_0x2233dd){logger[_0x7995('0x14')](_0x2233dd);return _0x2bbe7a[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x2233dd);}logger[_0x7995('0x15')](_0x7995('0x16'));return _0x2bbe7a[_0x7995('0x11')](0xc8)['json']({'output':_0x7995('0x17')});});};exports['reset']=function(_0x2f832e,_0x37f297){return git[_0x7995('0x18')]([_0x7995('0x19'),_0x7995('0x1a')],function(_0x37a7d4){if(_0x37a7d4){logger['error'](_0x37a7d4);return _0x37f297['status'](0x1f4)[_0x7995('0x12')](_0x37a7d4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37f297[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7995('0x1b')]=function(_0x51f276,_0x4b1a8e){exec(_0x7995('0x1c'),function(_0x327b1f,_0x350fd9,_0x1a8568){logger[_0x7995('0x15')](_0x350fd9);logger[_0x7995('0x15')](_0x1a8568);if(_0x327b1f){logger['error'](_0x327b1f);return _0x4b1a8e[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x350fd9});});};exports[_0x7995('0x1d')]=function(_0x13bc35,_0x475351){return pm2[_0x7995('0x1d')]('motion2')[_0x7995('0x1e')](function(_0x34e70c){logger[_0x7995('0x15')](_0x7995('0x1f'),_0x34e70c);return _0x475351[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7995('0x20')](function(_0x5911c3){logger[_0x7995('0x14')](_0x5911c3);return _0x475351[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x5911c3);});};exports[_0x7995('0x21')]=function(_0x11c1eb,_0x4b6f99){var _0x9b2a15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7995('0x22')],'modelName':_0x7995('0x22'),'columnName':_0x7995('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x7995('0x23')],function(){throw new Error(_0x7995('0x24'));}],'path':path[_0x7995('0x25')](config[_0x7995('0xa')],_0x7995('0x26'),_0x7995('0x21')),'pattern':/\.js$/}});_0x9b2a15['up']({'from':module['exports']['version']+_0x7995('0x27')})['then'](function(){return _0x4b6f99[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x7995('0x28')});})[_0x7995('0x20')](function(_0x1f7d27){return _0x4b6f99['status'](0x1f4)[_0x7995('0x12')](_0x1f7d27);});}; \ No newline at end of file +var _0x9957=['status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','pull','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','migrations','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','server','.js','Database\x20Migration\x20Completed!','umzug','path','pkginfo','version','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','root','index','exports','query','latest','fetch','tags'];(function(_0x5adcfe,_0xa10d0f){var _0x237deb=function(_0x2665d4){while(--_0x2665d4){_0x5adcfe['push'](_0x5adcfe['shift']());}};_0x237deb(++_0xa10d0f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Umzug=require(_0x7995('0x0'));var path=require(_0x7995('0x1'));var pkginfo=require(_0x7995('0x2'))(module,_0x7995('0x3'));var exec=require('child_process')[_0x7995('0x4')];var db=require(_0x7995('0x5'))['db'];var config=require(_0x7995('0x6'));var pm2=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var git=require(_0x7995('0x9'))(config[_0x7995('0xa')]);exports[_0x7995('0xb')]=function(_0xbda126,_0x326741){var _0x4996ca={'current':module[_0x7995('0xc')][_0x7995('0x3')],'phonebar':0x2};if(_0xbda126['query']&&_0xbda126[_0x7995('0xd')][_0x7995('0xe')]){return git[_0x7995('0xf')]()[_0x7995('0x10')](function(_0x3c1d19,_0x1e400a){_0x4996ca[_0x7995('0xe')]=(_0x3c1d19?module['exports'][_0x7995('0x3')]:_0x1e400a[_0x7995('0xe')])||'2.0.0';return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);});}else{return _0x326741[_0x7995('0x11')](0xc8)[_0x7995('0x12')](_0x4996ca);}};exports[_0x7995('0xf')]=function(_0x23999f,_0x2bbe7a){return git['fetch'](['origin',_0x7995('0x13')],function(_0x2233dd){if(_0x2233dd){logger[_0x7995('0x14')](_0x2233dd);return _0x2bbe7a[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x2233dd);}logger[_0x7995('0x15')](_0x7995('0x16'));return _0x2bbe7a[_0x7995('0x11')](0xc8)['json']({'output':_0x7995('0x17')});});};exports['reset']=function(_0x2f832e,_0x37f297){return git[_0x7995('0x18')]([_0x7995('0x19'),_0x7995('0x1a')],function(_0x37a7d4){if(_0x37a7d4){logger['error'](_0x37a7d4);return _0x37f297['status'](0x1f4)[_0x7995('0x12')](_0x37a7d4);}logger['info']('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x37f297[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0x7995('0x1b')]=function(_0x51f276,_0x4b1a8e){exec(_0x7995('0x1c'),function(_0x327b1f,_0x350fd9,_0x1a8568){logger[_0x7995('0x15')](_0x350fd9);logger[_0x7995('0x15')](_0x1a8568);if(_0x327b1f){logger['error'](_0x327b1f);return _0x4b1a8e[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x327b1f);}return _0x4b1a8e[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x350fd9});});};exports[_0x7995('0x1d')]=function(_0x13bc35,_0x475351){return pm2[_0x7995('0x1d')]('motion2')[_0x7995('0x1e')](function(_0x34e70c){logger[_0x7995('0x15')](_0x7995('0x1f'),_0x34e70c);return _0x475351[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x7995('0x20')](function(_0x5911c3){logger[_0x7995('0x14')](_0x5911c3);return _0x475351[_0x7995('0x11')](0x1f4)[_0x7995('0x12')](_0x5911c3);});};exports[_0x7995('0x21')]=function(_0x11c1eb,_0x4b6f99){var _0x9b2a15=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7995('0x22')],'modelName':_0x7995('0x22'),'columnName':_0x7995('0x3')},'migrations':{'params':[db['sequelize']['getQueryInterface'](),db['sequelize'][_0x7995('0x23')],function(){throw new Error(_0x7995('0x24'));}],'path':path[_0x7995('0x25')](config[_0x7995('0xa')],_0x7995('0x26'),_0x7995('0x21')),'pattern':/\.js$/}});_0x9b2a15['up']({'from':module['exports']['version']+_0x7995('0x27')})['then'](function(){return _0x4b6f99[_0x7995('0x11')](0xc8)[_0x7995('0x12')]({'output':_0x7995('0x28')});})[_0x7995('0x20')](function(_0x1f7d27){return _0x4b6f99['status'](0x1f4)[_0x7995('0x12')](_0x1f7d27);});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 05ca689..1ddb26e 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 _0x7a54=['/describe','describe','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x4fb968,_0x5901aa){var _0x3d12be=function(_0x2881ac){while(--_0x2881ac){_0x4fb968['push'](_0x4fb968['shift']());}};_0x3d12be(++_0x5901aa);}(_0x7a54,0x106));var _0x47a5=function(_0x4bdc16,_0x29c20c){_0x4bdc16=_0x4bdc16-0x0;var _0x5deb42=_0x7a54[_0x4bdc16];return _0x5deb42;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id',auth[_0x47a5('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0xc')]);router[_0x47a5('0xd')]('/:id',auth[_0x47a5('0x8')](),controller['update']);router['delete'](_0x47a5('0xe'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['/describe','describe','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index'];(function(_0x25092d,_0x5c74e7){var _0x5ec5cf=function(_0x4883c0){while(--_0x4883c0){_0x25092d['push'](_0x25092d['shift']());}};_0x5ec5cf(++_0x5c74e7);}(_0x7a54,0x106));var _0x47a5=function(_0x406c63,_0x3d9b9c){_0x406c63=_0x406c63-0x0;var _0x4912bb=_0x7a54[_0x406c63];return _0x4912bb;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var express=require('express');var router=express[_0x47a5('0x3')]();var auth=require(_0x47a5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x47a5('0x5'));var controller=require(_0x47a5('0x6'));router[_0x47a5('0x7')]('/',auth[_0x47a5('0x8')](),controller[_0x47a5('0x9')]);router['get'](_0x47a5('0xa'),auth['isAuthenticated'](),controller[_0x47a5('0xb')]);router[_0x47a5('0x7')]('/:id',auth[_0x47a5('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x47a5('0xc')]);router[_0x47a5('0xd')]('/:id',auth[_0x47a5('0x8')](),controller['update']);router['delete'](_0x47a5('0xe'),auth[_0x47a5('0x8')](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index ac745b5..6a6ad1d 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 _0xd3c7=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x36f471,_0x196e81){var _0x69ffce=function(_0x1fe448){while(--_0x1fe448){_0x36f471['push'](_0x36f471['shift']());}};_0x69ffce(++_0x196e81);}(_0xd3c7,0xd1));var _0x7d3c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd3c7[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0x7d3c('0x0'));module[_0x7d3c('0x1')]={'type':{'type':Sequelize[_0x7d3c('0x2')]},'uniqueid':{'type':Sequelize[_0x7d3c('0x2')]},'calleridnum':{'type':Sequelize[_0x7d3c('0x2')]},'calleridname':{'type':Sequelize[_0x7d3c('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7d3c('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x7d3c('0x3')]},'agentconnectAt':{'type':Sequelize[_0x7d3c('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x7d3c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x7d3c('0x3')]},'agentdumpAt':{'type':Sequelize[_0x7d3c('0x3')]},'holdtime':{'type':Sequelize[_0x7d3c('0x4')]},'agentcomplete':{'type':Sequelize[_0x7d3c('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7d3c('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x7d3c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7d3c('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7d3c('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7d3c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7d3c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x7d3c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7d3c('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7d3c('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7d3c('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7d3c('0x2')]},'destcalleridname':{'type':Sequelize[_0x7d3c('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7d3c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7d3c('0x2')]},'destlanguage':{'type':Sequelize[_0x7d3c('0x2')]},'destaccountcode':{'type':Sequelize[_0x7d3c('0x2')]},'destcontext':{'type':Sequelize[_0x7d3c('0x2')]},'destexten':{'type':Sequelize[_0x7d3c('0x2')]},'destpriority':{'type':Sequelize[_0x7d3c('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7d3c('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x7d3c('0x2')]}}; \ No newline at end of file +var _0x2d7d=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x2d7d,0x15b));var _0xd2d7=function(_0x12b2a4,_0x8cdedb){_0x12b2a4=_0x12b2a4-0x0;var _0x13ff03=_0x2d7d[_0x12b2a4];return _0x13ff03;};'use strict';var Sequelize=require(_0xd2d7('0x0'));module[_0xd2d7('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd2d7('0x2')]},'calleridnum':{'type':Sequelize[_0xd2d7('0x2')]},'calleridname':{'type':Sequelize[_0xd2d7('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentconnectAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xd2d7('0x3')]},'agentdumpAt':{'type':Sequelize[_0xd2d7('0x3')]},'holdtime':{'type':Sequelize[_0xd2d7('0x4')]},'agentcomplete':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xd2d7('0x4')]},'agentacw':{'type':Sequelize[_0xd2d7('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd2d7('0x2')]},'lastevent':{'type':Sequelize[_0xd2d7('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd2d7('0x4')]},'channelstatedesc':{'type':Sequelize[_0xd2d7('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd2d7('0x2')]},'connectedlinename':{'type':Sequelize[_0xd2d7('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd2d7('0x2')]},'context':{'type':Sequelize[_0xd2d7('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd2d7('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xd2d7('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xd2d7('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd2d7('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd2d7('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd2d7('0x2')]},'destlanguage':{'type':Sequelize[_0xd2d7('0x2')]},'destaccountcode':{'type':Sequelize[_0xd2d7('0x2')]},'destcontext':{'type':Sequelize[_0xd2d7('0x2')]},'destexten':{'type':Sequelize[_0xd2d7('0x2')]},'destpriority':{'type':Sequelize[_0xd2d7('0x2')]},'destuniqueid':{'type':Sequelize[_0xd2d7('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0xd2d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 5ae85bd..7d8c3b5 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 _0x3435=['../../config/utils','../../mysqldb','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','keys','dateStart','query','dateEnd','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','add','day','filter','merge','map','options','VoiceAgentReport','includeAll','include','findAll','catch','params','filters','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../config/logger'];(function(_0x3466f2,_0x1392eb){var _0x3c42a5=function(_0x5c1d08){while(--_0x5c1d08){_0x3466f2['push'](_0x3466f2['shift']());}};_0x3c42a5(++_0x1392eb);}(_0x3435,0xfa));var _0x5343=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x3435[_0x35885a];return _0xe86249;};'use strict';var jsonpatch=require(_0x5343('0x0'));var rp=require(_0x5343('0x1'));var moment=require(_0x5343('0x2'));var BPromise=require(_0x5343('0x3'));var Mustache=require(_0x5343('0x4'));var util=require(_0x5343('0x5'));var path=require('path');var sox=require(_0x5343('0x6'));var csv=require(_0x5343('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x5343('0x8'));var crypto=require(_0x5343('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5343('0x7'));var querystring=require(_0x5343('0xa'));var Papa=require(_0x5343('0xb'));var qs=require(_0x5343('0xc'));var logger=require(_0x5343('0xd'))('api');var utils=require(_0x5343('0xe'));var config=require('../../config/environment');var db=require(_0x5343('0xf'))['db'];function respondWithStatusCode(_0x328e54,_0x27ed68){_0x27ed68=_0x27ed68||0xcc;return function(_0x2e6df1){if(_0x2e6df1){return _0x328e54[_0x5343('0x10')](_0x27ed68);}return _0x328e54['status'](_0x27ed68)[_0x5343('0x11')]();};}function respondWithResult(_0x1eab36,_0x2356d0){_0x2356d0=_0x2356d0||0xc8;return function(_0x5f1724){if(_0x5f1724){return _0x1eab36[_0x5343('0x12')](_0x2356d0)['json'](_0x5f1724);}};}function respondWithFilteredResult(_0x82074d,_0x432158){return function(_0x58419f){if(_0x58419f){var _0x392797=_0x58419f[_0x5343('0x13')],_0x4cdfae=_0x432158[_0x5343('0x14')],_0x13066f=_0x432158['offset']+_0x432158[_0x5343('0x15')],_0x46c3d7;if(_0x13066f>=_0x392797){_0x13066f=_0x392797;_0x46c3d7=0xc8;}else{_0x46c3d7=0xce;}_0x82074d[_0x5343('0x12')](_0x46c3d7);return _0x82074d[_0x5343('0x16')](_0x5343('0x17'),_0x4cdfae+'-'+_0x13066f+'/'+_0x392797)[_0x5343('0x18')](_0x58419f);}return null;};}function patchUpdates(_0x2913e8){return function(_0x115de1){try{jsonpatch[_0x5343('0x19')](_0x115de1,_0x2913e8,!![]);}catch(_0x4cf3c2){return BPromise[_0x5343('0x1a')](_0x4cf3c2);}return _0x115de1[_0x5343('0x1b')]();};}function saveUpdates(_0x1f5098,_0x489e1c){return function(_0x1eb3bd){if(_0x1eb3bd){return _0x1eb3bd[_0x5343('0x1c')](_0x1f5098)[_0x5343('0x1d')](function(_0x2f1b48){return _0x2f1b48;});}return null;};}function removeEntity(_0x35e68c,_0xd93241){return function(_0x132505){if(_0x132505){return _0x132505[_0x5343('0x1e')]()[_0x5343('0x1d')](function(){_0x35e68c['status'](0xcc)[_0x5343('0x11')]();});}};}function handleEntityNotFound(_0x3da777,_0x5c2d6f){return function(_0x42f92d){if(!_0x42f92d){_0x3da777[_0x5343('0x10')](0x194);}return _0x42f92d;};}function handleError(_0x4e7c0f,_0x121b9b){_0x121b9b=_0x121b9b||0x1f4;return function(_0x130a9f){logger[_0x5343('0x1f')](_0x130a9f[_0x5343('0x20')]);if(_0x130a9f[_0x5343('0x21')]){delete _0x130a9f['name'];}_0x4e7c0f[_0x5343('0x12')](_0x121b9b)[_0x5343('0x22')](_0x130a9f);};}exports['index']=function(_0x3072ad,_0x96bbf6){var _0x1ab5eb={},_0x5e4344={},_0x539f0b={'count':0x0,'rows':[]};var _0x462cb6=db['VoiceAgentReport'][_0x5343('0x23')];_0x5e4344['model']=_[_0x5343('0x24')](_0x462cb6);var _0x55ab94={'dateStart':_0x3072ad['query'][_0x5343('0x25')],'dateEnd':_0x3072ad[_0x5343('0x26')]['dateEnd']};delete _0x3072ad['query'][_0x5343('0x25')];delete _0x3072ad['query'][_0x5343('0x27')];_0x5e4344['query']=_['keys'](_0x3072ad[_0x5343('0x26')]);_0x5e4344['filters']=_['intersection'](_0x5e4344[_0x5343('0x28')],_0x5e4344[_0x5343('0x26')]);_0x1ab5eb[_0x5343('0x29')]=_[_0x5343('0x2a')](_0x5e4344['model'],qs['fields'](_0x3072ad[_0x5343('0x26')][_0x5343('0x2b')]));_0x1ab5eb[_0x5343('0x29')]=_0x1ab5eb[_0x5343('0x29')][_0x5343('0x2c')]?_0x1ab5eb[_0x5343('0x29')]:_0x5e4344[_0x5343('0x28')];if(!_0x3072ad[_0x5343('0x26')][_0x5343('0x2d')](_0x5343('0x2e'))){_0x1ab5eb[_0x5343('0x15')]=qs[_0x5343('0x15')](_0x3072ad['query']['limit']);_0x1ab5eb[_0x5343('0x14')]=qs[_0x5343('0x14')](_0x3072ad['query'][_0x5343('0x14')]);}_0x1ab5eb['order']=qs[_0x5343('0x2f')](_0x3072ad[_0x5343('0x26')][_0x5343('0x2f')]);_0x1ab5eb[_0x5343('0x30')]=qs['filters'](_['pick'](_0x3072ad[_0x5343('0x26')],_0x5e4344['filters']));if(_0x55ab94[_0x5343('0x25')]){if(_0x55ab94[_0x5343('0x27')]){_0x55ab94['dateEnd']=moment(_0x55ab94[_0x5343('0x27')])['add'](0x1,'day');}else{_0x55ab94[_0x5343('0x27')]=moment(_0x55ab94[_0x5343('0x25')])[_0x5343('0x31')](0x1,_0x5343('0x32'));}_['merge'](_0x1ab5eb['where'],{'createdAt':{'$gte':_0x55ab94['dateStart'],'$lte':_0x55ab94['dateEnd']}});}if(_0x3072ad[_0x5343('0x26')][_0x5343('0x33')]){_0x1ab5eb[_0x5343('0x30')]=_[_0x5343('0x34')](_0x1ab5eb[_0x5343('0x30')],{'$or':_[_0x5343('0x35')](_0x1ab5eb[_0x5343('0x29')],function(_0x4d2951){var _0x42c8a5={};_0x42c8a5[_0x4d2951]={'$like':'%'+_0x3072ad['query'][_0x5343('0x33')]+'%'};return _0x42c8a5;})});}_0x1ab5eb=_[_0x5343('0x34')]({},_0x1ab5eb,_0x3072ad[_0x5343('0x36')]);var _0x2f004a={'where':_0x1ab5eb[_0x5343('0x30')]};return db[_0x5343('0x37')][_0x5343('0x13')](_0x2f004a)['then'](function(_0xb93d9){_0x539f0b['count']=_0xb93d9;if(_0x3072ad[_0x5343('0x26')][_0x5343('0x38')]){_0x1ab5eb[_0x5343('0x39')]=[{'all':!![]}];}return db[_0x5343('0x37')][_0x5343('0x3a')](_0x1ab5eb);})[_0x5343('0x1d')](function(_0x2c75bd){_0x539f0b['rows']=_0x2c75bd;return _0x539f0b;})[_0x5343('0x1d')](respondWithFilteredResult(_0x96bbf6,_0x1ab5eb))[_0x5343('0x3b')](handleError(_0x96bbf6,null));};exports['show']=function(_0x41df61,_0x16c880){var _0x4c576d={'raw':![],'where':{'id':_0x41df61[_0x5343('0x3c')]['id']}},_0x53c3c7={};_0x53c3c7[_0x5343('0x28')]=_[_0x5343('0x24')](db['VoiceAgentReport'][_0x5343('0x23')]);_0x53c3c7[_0x5343('0x26')]=_[_0x5343('0x24')](_0x41df61[_0x5343('0x26')]);_0x53c3c7[_0x5343('0x3d')]=_[_0x5343('0x2a')](_0x53c3c7[_0x5343('0x28')],_0x53c3c7['query']);_0x4c576d[_0x5343('0x29')]=_[_0x5343('0x2a')](_0x53c3c7[_0x5343('0x28')],qs[_0x5343('0x2b')](_0x41df61[_0x5343('0x26')][_0x5343('0x2b')]));_0x4c576d[_0x5343('0x29')]=_0x4c576d[_0x5343('0x29')][_0x5343('0x2c')]?_0x4c576d[_0x5343('0x29')]:_0x53c3c7[_0x5343('0x28')];if(_0x41df61[_0x5343('0x26')][_0x5343('0x38')]){_0x4c576d[_0x5343('0x39')]=[{'all':!![]}];}_0x4c576d=_[_0x5343('0x34')]({},_0x4c576d,_0x41df61['options']);return db[_0x5343('0x37')][_0x5343('0x3e')](_0x4c576d)['then'](handleEntityNotFound(_0x16c880,null))[_0x5343('0x1d')](respondWithResult(_0x16c880,null))[_0x5343('0x3b')](handleError(_0x16c880,null));};exports[_0x5343('0x3f')]=function(_0x1da1b7,_0x194316){return db['VoiceAgentReport'][_0x5343('0x3f')](_0x1da1b7['body'],{})['then'](respondWithResult(_0x194316,0xc9))[_0x5343('0x3b')](handleError(_0x194316,null));};exports[_0x5343('0x1c')]=function(_0x10329c,_0x1cd4ed){if(_0x10329c['body']['id']){delete _0x10329c[_0x5343('0x40')]['id'];}return db[_0x5343('0x37')][_0x5343('0x3e')]({'where':{'id':_0x10329c[_0x5343('0x3c')]['id']}})[_0x5343('0x1d')](handleEntityNotFound(_0x1cd4ed,null))[_0x5343('0x1d')](saveUpdates(_0x10329c[_0x5343('0x40')],null))[_0x5343('0x1d')](respondWithResult(_0x1cd4ed,null))[_0x5343('0x3b')](handleError(_0x1cd4ed,null));};exports[_0x5343('0x1e')]=function(_0x566d71,_0x1cbf7c){return db[_0x5343('0x37')][_0x5343('0x3e')]({'where':{'id':_0x566d71[_0x5343('0x3c')]['id']}})[_0x5343('0x1d')](handleEntityNotFound(_0x1cbf7c,null))[_0x5343('0x1d')](removeEntity(_0x1cbf7c,null))[_0x5343('0x3b')](handleError(_0x1cbf7c,null));};exports[_0x5343('0x41')]=function(_0x3b3c64,_0xad51f4){return db['VoiceAgentReport'][_0x5343('0x41')]()['then'](respondWithResult(_0xad51f4,null))['catch'](handleError(_0xad51f4,null));}; \ No newline at end of file +var _0x3937=['count','includeAll','include','findAll','rows','catch','params','find','create','body','describe','fast-json-patch','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','api','../../config/utils','../../config/environment','end','status','json','offset','Content-Range','update','then','stack','name','send','index','VoiceAgentReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','add','day','merge','where','filter','options'];(function(_0x175563,_0x42a3b2){var _0x57b296=function(_0x222850){while(--_0x222850){_0x175563['push'](_0x175563['shift']());}};_0x57b296(++_0x42a3b2);}(_0x3937,0xbf));var _0x7393=function(_0x3317b2,_0x42d109){_0x3317b2=_0x3317b2-0x0;var _0x5af126=_0x3937[_0x3317b2];return _0x5af126;};'use strict';var jsonpatch=require(_0x7393('0x0'));var rp=require('request-promise');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var Mustache=require('mustache');var util=require(_0x7393('0x3'));var path=require('path');var sox=require(_0x7393('0x4'));var csv=require('to-csv');var ejs=require(_0x7393('0x5'));var fs=require('fs');var _=require(_0x7393('0x6'));var squel=require(_0x7393('0x7'));var crypto=require(_0x7393('0x8'));var jsforce=require(_0x7393('0x9'));var deskjs=require(_0x7393('0xa'));var toCsv=require(_0x7393('0xb'));var querystring=require(_0x7393('0xc'));var Papa=require(_0x7393('0xd'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7393('0xe'));var utils=require(_0x7393('0xf'));var config=require(_0x7393('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xab290c,_0x5f0dd5){_0x5f0dd5=_0x5f0dd5||0xcc;return function(_0x56ed4c){if(_0x56ed4c){return _0xab290c['sendStatus'](_0x5f0dd5);}return _0xab290c['status'](_0x5f0dd5)[_0x7393('0x11')]();};}function respondWithResult(_0x633f9,_0x29d8cc){_0x29d8cc=_0x29d8cc||0xc8;return function(_0x4fb764){if(_0x4fb764){return _0x633f9[_0x7393('0x12')](_0x29d8cc)[_0x7393('0x13')](_0x4fb764);}};}function respondWithFilteredResult(_0x20fb41,_0x3aba71){return function(_0xe86cf4){if(_0xe86cf4){var _0x1fe171=_0xe86cf4['count'],_0x38eaad=_0x3aba71['offset'],_0x212f44=_0x3aba71[_0x7393('0x14')]+_0x3aba71['limit'],_0x11030d;if(_0x212f44>=_0x1fe171){_0x212f44=_0x1fe171;_0x11030d=0xc8;}else{_0x11030d=0xce;}_0x20fb41['status'](_0x11030d);return _0x20fb41['set'](_0x7393('0x15'),_0x38eaad+'-'+_0x212f44+'/'+_0x1fe171)['json'](_0xe86cf4);}return null;};}function patchUpdates(_0x2a1180){return function(_0x18252f){try{jsonpatch['apply'](_0x18252f,_0x2a1180,!![]);}catch(_0x459abf){return BPromise['reject'](_0x459abf);}return _0x18252f['save']();};}function saveUpdates(_0x31c8c2,_0x344bc8){return function(_0x1b032c){if(_0x1b032c){return _0x1b032c[_0x7393('0x16')](_0x31c8c2)[_0x7393('0x17')](function(_0x3e2453){return _0x3e2453;});}return null;};}function removeEntity(_0x21f712,_0x208b9a){return function(_0x546642){if(_0x546642){return _0x546642['destroy']()[_0x7393('0x17')](function(){_0x21f712[_0x7393('0x12')](0xcc)[_0x7393('0x11')]();});}};}function handleEntityNotFound(_0x7fc0ef,_0x131667){return function(_0x52f716){if(!_0x52f716){_0x7fc0ef['sendStatus'](0x194);}return _0x52f716;};}function handleError(_0x544487,_0x2d32cc){_0x2d32cc=_0x2d32cc||0x1f4;return function(_0x5b5ca9){logger['error'](_0x5b5ca9[_0x7393('0x18')]);if(_0x5b5ca9[_0x7393('0x19')]){delete _0x5b5ca9['name'];}_0x544487[_0x7393('0x12')](_0x2d32cc)[_0x7393('0x1a')](_0x5b5ca9);};}exports[_0x7393('0x1b')]=function(_0x3a0a83,_0x3fe456){var _0x2c025f={},_0x1b31b8={},_0x39ddd3={'count':0x0,'rows':[]};var _0x328c47=db[_0x7393('0x1c')][_0x7393('0x1d')];_0x1b31b8[_0x7393('0x1e')]=_[_0x7393('0x1f')](_0x328c47);var _0x4e1fea={'dateStart':_0x3a0a83[_0x7393('0x20')][_0x7393('0x21')],'dateEnd':_0x3a0a83[_0x7393('0x20')][_0x7393('0x22')]};delete _0x3a0a83[_0x7393('0x20')][_0x7393('0x21')];delete _0x3a0a83['query'][_0x7393('0x22')];_0x1b31b8['query']=_[_0x7393('0x1f')](_0x3a0a83['query']);_0x1b31b8[_0x7393('0x23')]=_[_0x7393('0x24')](_0x1b31b8[_0x7393('0x1e')],_0x1b31b8[_0x7393('0x20')]);_0x2c025f[_0x7393('0x25')]=_[_0x7393('0x24')](_0x1b31b8[_0x7393('0x1e')],qs[_0x7393('0x26')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x26')]));_0x2c025f[_0x7393('0x25')]=_0x2c025f[_0x7393('0x25')]['length']?_0x2c025f['attributes']:_0x1b31b8[_0x7393('0x1e')];if(!_0x3a0a83['query'][_0x7393('0x27')]('nolimit')){_0x2c025f[_0x7393('0x28')]=qs['limit'](_0x3a0a83[_0x7393('0x20')][_0x7393('0x28')]);_0x2c025f[_0x7393('0x14')]=qs[_0x7393('0x14')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x14')]);}_0x2c025f[_0x7393('0x29')]=qs[_0x7393('0x2a')](_0x3a0a83[_0x7393('0x20')][_0x7393('0x2a')]);_0x2c025f['where']=qs[_0x7393('0x23')](_['pick'](_0x3a0a83[_0x7393('0x20')],_0x1b31b8['filters']));if(_0x4e1fea[_0x7393('0x21')]){if(_0x4e1fea[_0x7393('0x22')]){_0x4e1fea[_0x7393('0x22')]=moment(_0x4e1fea[_0x7393('0x22')])[_0x7393('0x2b')](0x1,'day');}else{_0x4e1fea[_0x7393('0x22')]=moment(_0x4e1fea['dateStart'])[_0x7393('0x2b')](0x1,_0x7393('0x2c'));}_[_0x7393('0x2d')](_0x2c025f[_0x7393('0x2e')],{'createdAt':{'$gte':_0x4e1fea[_0x7393('0x21')],'$lte':_0x4e1fea['dateEnd']}});}if(_0x3a0a83['query'][_0x7393('0x2f')]){_0x2c025f[_0x7393('0x2e')]=_[_0x7393('0x2d')](_0x2c025f[_0x7393('0x2e')],{'$or':_['map'](_0x2c025f['attributes'],function(_0x594926){var _0x264393={};_0x264393[_0x594926]={'$like':'%'+_0x3a0a83[_0x7393('0x20')][_0x7393('0x2f')]+'%'};return _0x264393;})});}_0x2c025f=_[_0x7393('0x2d')]({},_0x2c025f,_0x3a0a83[_0x7393('0x30')]);var _0x406b35={'where':_0x2c025f[_0x7393('0x2e')]};return db[_0x7393('0x1c')][_0x7393('0x31')](_0x406b35)[_0x7393('0x17')](function(_0xc39c05){_0x39ddd3[_0x7393('0x31')]=_0xc39c05;if(_0x3a0a83[_0x7393('0x20')][_0x7393('0x32')]){_0x2c025f[_0x7393('0x33')]=[{'all':!![]}];}return db[_0x7393('0x1c')][_0x7393('0x34')](_0x2c025f);})[_0x7393('0x17')](function(_0x445b39){_0x39ddd3[_0x7393('0x35')]=_0x445b39;return _0x39ddd3;})[_0x7393('0x17')](respondWithFilteredResult(_0x3fe456,_0x2c025f))[_0x7393('0x36')](handleError(_0x3fe456,null));};exports['show']=function(_0x28dd3e,_0x16bcbf){var _0x25a2a6={'raw':![],'where':{'id':_0x28dd3e[_0x7393('0x37')]['id']}},_0x40ab6d={};_0x40ab6d[_0x7393('0x1e')]=_[_0x7393('0x1f')](db[_0x7393('0x1c')]['rawAttributes']);_0x40ab6d['query']=_[_0x7393('0x1f')](_0x28dd3e['query']);_0x40ab6d[_0x7393('0x23')]=_[_0x7393('0x24')](_0x40ab6d[_0x7393('0x1e')],_0x40ab6d[_0x7393('0x20')]);_0x25a2a6[_0x7393('0x25')]=_[_0x7393('0x24')](_0x40ab6d['model'],qs[_0x7393('0x26')](_0x28dd3e[_0x7393('0x20')][_0x7393('0x26')]));_0x25a2a6[_0x7393('0x25')]=_0x25a2a6[_0x7393('0x25')]['length']?_0x25a2a6['attributes']:_0x40ab6d[_0x7393('0x1e')];if(_0x28dd3e['query'][_0x7393('0x32')]){_0x25a2a6[_0x7393('0x33')]=[{'all':!![]}];}_0x25a2a6=_[_0x7393('0x2d')]({},_0x25a2a6,_0x28dd3e[_0x7393('0x30')]);return db[_0x7393('0x1c')][_0x7393('0x38')](_0x25a2a6)[_0x7393('0x17')](handleEntityNotFound(_0x16bcbf,null))[_0x7393('0x17')](respondWithResult(_0x16bcbf,null))[_0x7393('0x36')](handleError(_0x16bcbf,null));};exports[_0x7393('0x39')]=function(_0x2f19b6,_0x26c327){return db[_0x7393('0x1c')][_0x7393('0x39')](_0x2f19b6[_0x7393('0x3a')],{})['then'](respondWithResult(_0x26c327,0xc9))[_0x7393('0x36')](handleError(_0x26c327,null));};exports[_0x7393('0x16')]=function(_0x27b796,_0x351ba9){if(_0x27b796['body']['id']){delete _0x27b796[_0x7393('0x3a')]['id'];}return db[_0x7393('0x1c')][_0x7393('0x38')]({'where':{'id':_0x27b796[_0x7393('0x37')]['id']}})[_0x7393('0x17')](handleEntityNotFound(_0x351ba9,null))[_0x7393('0x17')](saveUpdates(_0x27b796[_0x7393('0x3a')],null))[_0x7393('0x17')](respondWithResult(_0x351ba9,null))[_0x7393('0x36')](handleError(_0x351ba9,null));};exports['destroy']=function(_0xd3d01d,_0x1f66cb){return db[_0x7393('0x1c')]['find']({'where':{'id':_0xd3d01d[_0x7393('0x37')]['id']}})[_0x7393('0x17')](handleEntityNotFound(_0x1f66cb,null))['then'](removeEntity(_0x1f66cb,null))[_0x7393('0x36')](handleError(_0x1f66cb,null));};exports['describe']=function(_0x396992,_0x575df2){return db[_0x7393('0x1c')][_0x7393('0x3b')]()['then'](respondWithResult(_0x575df2,null))[_0x7393('0x36')](handleError(_0x575df2,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f2c3b96..6a9ca08 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 _0x9172=['request-promise','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','api','moment'];(function(_0x5de8bf,_0x24e115){var _0x2be3e3=function(_0x385e2c){while(--_0x385e2c){_0x5de8bf['push'](_0x5de8bf['shift']());}};_0x2be3e3(++_0x24e115);}(_0x9172,0x1a5));var _0x2917=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x9172[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x2917('0x0'));var moment=require(_0x2917('0x1'));var BPromise=require('bluebird');var rp=require(_0x2917('0x2'));var attributes=require('./voiceAgentReport.attributes');module[_0x2917('0x3')]=function(_0x20d2d5,_0x34254d){return _0x20d2d5[_0x2917('0x4')](_0x2917('0x5'),attributes,{'tableName':_0x2917('0x6'),'paranoid':![],'indexes':[{'fields':[_0x2917('0x7'),_0x2917('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0487=['util','../../config/logger','api','moment','exports','define','VoiceAgentReport','uniqueid'];(function(_0x337f32,_0x376236){var _0x5c36f0=function(_0x577415){while(--_0x577415){_0x337f32['push'](_0x337f32['shift']());}};_0x5c36f0(++_0x376236);}(_0x0487,0x138));var _0x7048=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0x0487[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x7048('0x0'));var logger=require(_0x7048('0x1'))(_0x7048('0x2'));var moment=require(_0x7048('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require('./voiceAgentReport.attributes');module[_0x7048('0x4')]=function(_0x151f45,_0x20e113){return _0x151f45[_0x7048('0x5')](_0x7048('0x6'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7048('0x7'),'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 bfc2b57..edf5a65 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 _0x7a54=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','stringify','UpdateVoiceAgentReport','update','attributes','limit','debug','lodash','util'];(function(_0xa6a4ca,_0x533879){var _0x36db6b=function(_0xafd91c){while(--_0xafd91c){_0xa6a4ca['push'](_0xa6a4ca['shift']());}};_0x36db6b(++_0x533879);}(_0x7a54,0x106));var _0x47a5=function(_0x936c32,_0x3453b6){_0x936c32=_0x936c32-0x0;var _0x19011c=_0x7a54[_0x936c32];return _0x19011c;};'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 db=require(_0x47a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var jayson=require(_0x47a5('0x8'));var client=jayson[_0x47a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5629,_0x59199c,_0x343372){return new BPromise(function(_0x30e405,_0x506eda){return client[_0x47a5('0xa')](_0x3d5629,_0x343372)['then'](function(_0x5d90b3){logger['info'](_0x47a5('0xb'),_0x59199c,_0x47a5('0xc'));logger['debug'](_0x47a5('0xd'),_0x59199c,'request\x20sent',JSON['stringify'](_0x5d90b3));if(_0x5d90b3[_0x47a5('0xe')]){if(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0xf')]===0x1f4){logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x506eda(_0x5d90b3['error'][_0x47a5('0x10')]);}logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x30e405(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);}else{logger[_0x47a5('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x47a5('0xc'));_0x30e405(_0x5d90b3[_0x47a5('0x12')][_0x47a5('0x10')]);}})[_0x47a5('0x13')](function(_0x1ef44c){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x1ef44c);_0x506eda(_0x1ef44c);});});}exports[_0x47a5('0x14')]=function(_0x4b966e){var _0x5247fd=this;return new Promise(function(_0x423a81,_0xaf70a6){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x4b966e[_0x47a5('0x17')],{'raw':_0x4b966e[_0x47a5('0x18')]?_0x4b966e[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})[_0x47a5('0x1a')](function(_0x4a9fcb){logger[_0x47a5('0x11')](_0x47a5('0x14'),_0x4b966e);logger['debug'](_0x47a5('0x14'),_0x4b966e,JSON[_0x47a5('0x1b')](_0x4a9fcb));_0x423a81(_0x4a9fcb);})[_0x47a5('0x13')](function(_0x4c5910){logger[_0x47a5('0xe')](_0x47a5('0x14'),_0x4c5910[_0x47a5('0x10')],_0x4b966e);_0xaf70a6(_0x5247fd[_0x47a5('0xe')](0x1f4,_0x4c5910['message']));});});};exports[_0x47a5('0x1c')]=function(_0x385687){var _0x513981=this;return new Promise(function(_0x28747d,_0xc4cd63){return db[_0x47a5('0x15')][_0x47a5('0x1d')](_0x385687[_0x47a5('0x17')],{'raw':_0x385687['options']?_0x385687['options'][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385687['options']?_0x385687[_0x47a5('0x18')]['where']||null:null,'attributes':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x1a')](function(_0x136b14){logger[_0x47a5('0x11')](_0x47a5('0x1c'),_0x385687);logger[_0x47a5('0x20')](_0x47a5('0x1c'),_0x385687,JSON[_0x47a5('0x1b')](_0x136b14));_0x28747d(_0x136b14);})['catch'](function(_0x243210){logger['error'](_0x47a5('0x1c'),_0x243210[_0x47a5('0x10')],_0x385687);_0xc4cd63(_0x513981[_0x47a5('0xe')](0x1f4,_0x243210['message']));});});}; \ No newline at end of file +var _0x7a54=['moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','then','stringify','UpdateVoiceAgentReport','update','attributes','limit','debug','lodash','util'];(function(_0x571b24,_0x548390){var _0x2e5032=function(_0x3e8360){while(--_0x3e8360){_0x571b24['push'](_0x571b24['shift']());}};_0x2e5032(++_0x548390);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8cb2,_0x300c9f){_0x1c8cb2=_0x1c8cb2-0x0;var _0x4f6e3f=_0x7a54[_0x1c8cb2];return _0x4f6e3f;};'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 db=require(_0x47a5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var jayson=require(_0x47a5('0x8'));var client=jayson[_0x47a5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d5629,_0x59199c,_0x343372){return new BPromise(function(_0x30e405,_0x506eda){return client[_0x47a5('0xa')](_0x3d5629,_0x343372)['then'](function(_0x5d90b3){logger['info'](_0x47a5('0xb'),_0x59199c,_0x47a5('0xc'));logger['debug'](_0x47a5('0xd'),_0x59199c,'request\x20sent',JSON['stringify'](_0x5d90b3));if(_0x5d90b3[_0x47a5('0xe')]){if(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0xf')]===0x1f4){logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x506eda(_0x5d90b3['error'][_0x47a5('0x10')]);}logger[_0x47a5('0xe')](_0x47a5('0xb'),_0x59199c,_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);return _0x30e405(_0x5d90b3[_0x47a5('0xe')][_0x47a5('0x10')]);}else{logger[_0x47a5('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x47a5('0xc'));_0x30e405(_0x5d90b3[_0x47a5('0x12')][_0x47a5('0x10')]);}})[_0x47a5('0x13')](function(_0x1ef44c){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x59199c,_0x1ef44c);_0x506eda(_0x1ef44c);});});}exports[_0x47a5('0x14')]=function(_0x4b966e){var _0x5247fd=this;return new Promise(function(_0x423a81,_0xaf70a6){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x4b966e[_0x47a5('0x17')],{'raw':_0x4b966e[_0x47a5('0x18')]?_0x4b966e[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})[_0x47a5('0x1a')](function(_0x4a9fcb){logger[_0x47a5('0x11')](_0x47a5('0x14'),_0x4b966e);logger['debug'](_0x47a5('0x14'),_0x4b966e,JSON[_0x47a5('0x1b')](_0x4a9fcb));_0x423a81(_0x4a9fcb);})[_0x47a5('0x13')](function(_0x4c5910){logger[_0x47a5('0xe')](_0x47a5('0x14'),_0x4c5910[_0x47a5('0x10')],_0x4b966e);_0xaf70a6(_0x5247fd[_0x47a5('0xe')](0x1f4,_0x4c5910['message']));});});};exports[_0x47a5('0x1c')]=function(_0x385687){var _0x513981=this;return new Promise(function(_0x28747d,_0xc4cd63){return db[_0x47a5('0x15')][_0x47a5('0x1d')](_0x385687[_0x47a5('0x17')],{'raw':_0x385687['options']?_0x385687['options'][_0x47a5('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x385687['options']?_0x385687[_0x47a5('0x18')]['where']||null:null,'attributes':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x385687[_0x47a5('0x18')]?_0x385687[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x1a')](function(_0x136b14){logger[_0x47a5('0x11')](_0x47a5('0x1c'),_0x385687);logger[_0x47a5('0x20')](_0x47a5('0x1c'),_0x385687,JSON[_0x47a5('0x1b')](_0x136b14));_0x28747d(_0x136b14);})['catch'](function(_0x243210){logger['error'](_0x47a5('0x1c'),_0x243210[_0x47a5('0x10')],_0x385687);_0xc4cd63(_0x513981[_0x47a5('0xe')](0x1f4,_0x243210['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f59dd78..4142a48 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 _0x48ba=['put','update','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0xf9a9e0,_0x1fb249){var _0x47f613=function(_0x99996e){while(--_0x99996e){_0xf9a9e0['push'](_0xf9a9e0['shift']());}};_0x47f613(++_0x1fb249);}(_0x48ba,0x157));var _0xa48b=function(_0x1743e7,_0x17cc22){_0x1743e7=_0x1743e7-0x0;var _0x26f3f7=_0x48ba[_0x1743e7];return _0x26f3f7;};'use strict';var multer=require(_0xa48b('0x0'));var util=require('util');var path=require(_0xa48b('0x1'));var express=require(_0xa48b('0x2'));var router=express[_0xa48b('0x3')]();var auth=require(_0xa48b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa48b('0x5'));var controller=require('./voiceCallReport.controller');router[_0xa48b('0x6')]('/',auth[_0xa48b('0x7')](),controller[_0xa48b('0x8')]);router['get'](_0xa48b('0x9'),auth[_0xa48b('0x7')](),controller[_0xa48b('0xa')]);router[_0xa48b('0x6')](_0xa48b('0xb'),auth[_0xa48b('0x7')](),controller[_0xa48b('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa48b('0xd')]);router[_0xa48b('0xe')](_0xa48b('0xb'),auth[_0xa48b('0x7')](),controller[_0xa48b('0xf')]);router['delete'](_0xa48b('0xb'),auth[_0xa48b('0x7')](),controller[_0xa48b('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6976=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0xd964bd,_0x4c343a){var _0x361ab2=function(_0xdb11f7){while(--_0xdb11f7){_0xd964bd['push'](_0xd964bd['shift']());}};_0x361ab2(++_0x4c343a);}(_0x6976,0x1d5));var _0x6697=function(_0x4b6969,_0x53bf08){_0x4b6969=_0x4b6969-0x0;var _0x2b984e=_0x6976[_0x4b6969];return _0x2b984e;};'use strict';var multer=require('multer');var util=require(_0x6697('0x0'));var path=require(_0x6697('0x1'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x6697('0x2'));var config=require(_0x6697('0x3'));var controller=require('./voiceCallReport.controller');router[_0x6697('0x4')]('/',auth[_0x6697('0x5')](),controller[_0x6697('0x6')]);router['get'](_0x6697('0x7'),auth[_0x6697('0x5')](),controller[_0x6697('0x8')]);router[_0x6697('0x4')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0xa')]);router[_0x6697('0xb')]('/',auth[_0x6697('0x5')](),controller[_0x6697('0xc')]);router[_0x6697('0xd')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0xe')]);router[_0x6697('0xf')](_0x6697('0x9'),auth[_0x6697('0x5')](),controller[_0x6697('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index fdb7483..8fff9c0 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 _0x9be1=['ENUM','internal','outbound','inbound-fax','dialer','STRING','DATE','INTEGER','exports'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x9be1,0x1e5));var _0x19be=function(_0x420fe4,_0x412f4d){_0x420fe4=_0x420fe4-0x0;var _0x4beb3d=_0x9be1[_0x420fe4];return _0x4beb3d;};'use strict';var Sequelize=require('sequelize');module[_0x19be('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x19be('0x1')]('inbound',_0x19be('0x2'),_0x19be('0x3'),_0x19be('0x4'),'outbound-fax',_0x19be('0x5'))},'tag':{'type':Sequelize[_0x19be('0x6')]},'accountcode':{'type':Sequelize[_0x19be('0x6')]},'source':{'type':Sequelize[_0x19be('0x6')]},'destination':{'type':Sequelize[_0x19be('0x6')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x19be('0x6')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x19be('0x6')]},'lastapplication':{'type':Sequelize[_0x19be('0x6')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x19be('0x7')]},'answertime':{'type':Sequelize[_0x19be('0x7')]},'endtime':{'type':Sequelize[_0x19be('0x7')]},'duration':{'type':Sequelize[_0x19be('0x8')]},'billableseconds':{'type':Sequelize[_0x19be('0x8')]},'mohtime':{'type':Sequelize[_0x19be('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x19be('0x6')]},'amaflags':{'type':Sequelize[_0x19be('0x6')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x19be('0x6')]},'note':{'type':Sequelize[_0x19be('0x6')]},'prefix':{'type':Sequelize[_0x19be('0x6')]},'routeid':{'type':Sequelize[_0x19be('0x8')]}}; \ No newline at end of file +var _0xd450=['INTEGER','sequelize','STRING','inbound','internal','outbound','inbound-fax','dialer','DATE'];(function(_0x496958,_0x3cdbf5){var _0x1658f7=function(_0x5ef7ef){while(--_0x5ef7ef){_0x496958['push'](_0x496958['shift']());}};_0x1658f7(++_0x3cdbf5);}(_0xd450,0xd9));var _0x0d45=function(_0x1b48e7,_0x3025a2){_0x1b48e7=_0x1b48e7-0x0;var _0x3ebbe2=_0xd450[_0x1b48e7];return _0x3ebbe2;};'use strict';var Sequelize=require(_0x0d45('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x0d45('0x1')]},'type':{'type':Sequelize['ENUM'](_0x0d45('0x2'),_0x0d45('0x3'),_0x0d45('0x4'),_0x0d45('0x5'),'outbound-fax',_0x0d45('0x6'))},'tag':{'type':Sequelize[_0x0d45('0x1')]},'accountcode':{'type':Sequelize[_0x0d45('0x1')]},'source':{'type':Sequelize[_0x0d45('0x1')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d45('0x1')]},'channel':{'type':Sequelize[_0x0d45('0x1')]},'destinationchannel':{'type':Sequelize[_0x0d45('0x1')]},'lastapplication':{'type':Sequelize[_0x0d45('0x1')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x0d45('0x7')]},'endtime':{'type':Sequelize[_0x0d45('0x7')]},'duration':{'type':Sequelize[_0x0d45('0x8')]},'billableseconds':{'type':Sequelize[_0x0d45('0x8')]},'mohtime':{'type':Sequelize[_0x0d45('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x0d45('0x1')]},'userfield':{'type':Sequelize[_0x0d45('0x1')]},'userDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x0d45('0x8')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index eacfde3..bfb3c7b 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 _0x6cda=['sendStatus','stack','index','VoiceCallReport','rawAttributes','model','keys','query','dateStart','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','dateEnd','add','day','merge','map','filter','options','then','includeAll','include','name','alias','User','findAll','rows','catch','show','params','find','create','body','describe','uniqueid','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','save','update','destroy'];(function(_0x228636,_0x51d570){var _0x327b9e=function(_0x38b239){while(--_0x38b239){_0x228636['push'](_0x228636['shift']());}};_0x327b9e(++_0x51d570);}(_0x6cda,0x158));var _0xa6cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6cda[_0x3dd15e];return _0x231fd0;};'use strict';var jsonpatch=require(_0xa6cd('0x0'));var rp=require(_0xa6cd('0x1'));var moment=require(_0xa6cd('0x2'));var BPromise=require(_0xa6cd('0x3'));var Mustache=require(_0xa6cd('0x4'));var util=require(_0xa6cd('0x5'));var path=require('path');var sox=require(_0xa6cd('0x6'));var csv=require(_0xa6cd('0x7'));var ejs=require(_0xa6cd('0x8'));var fs=require('fs');var _=require(_0xa6cd('0x9'));var squel=require(_0xa6cd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa6cd('0xb'));var toCsv=require(_0xa6cd('0x7'));var querystring=require(_0xa6cd('0xc'));var Papa=require(_0xa6cd('0xd'));var qs=require(_0xa6cd('0xe'));var logger=require(_0xa6cd('0xf'))(_0xa6cd('0x10'));var utils=require(_0xa6cd('0x11'));var config=require(_0xa6cd('0x12'));var db=require(_0xa6cd('0x13'))['db'];function respondWithStatusCode(_0x3b464f,_0x176f1a){_0x176f1a=_0x176f1a||0xcc;return function(_0x3f439a){if(_0x3f439a){return _0x3b464f['sendStatus'](_0x176f1a);}return _0x3b464f['status'](_0x176f1a)[_0xa6cd('0x14')]();};}function respondWithResult(_0x53edb0,_0x350152){_0x350152=_0x350152||0xc8;return function(_0x3b3a95){if(_0x3b3a95){return _0x53edb0[_0xa6cd('0x15')](_0x350152)[_0xa6cd('0x16')](_0x3b3a95);}};}function respondWithFilteredResult(_0x30f2ba,_0x19995b){return function(_0x499987){if(_0x499987){var _0x59858e=_0x499987[_0xa6cd('0x17')],_0x127847=_0x19995b[_0xa6cd('0x18')],_0x402a84=_0x19995b[_0xa6cd('0x18')]+_0x19995b['limit'],_0x2ac62a;if(_0x402a84>=_0x59858e){_0x402a84=_0x59858e;_0x2ac62a=0xc8;}else{_0x2ac62a=0xce;}_0x30f2ba[_0xa6cd('0x15')](_0x2ac62a);return _0x30f2ba[_0xa6cd('0x19')](_0xa6cd('0x1a'),_0x127847+'-'+_0x402a84+'/'+_0x59858e)[_0xa6cd('0x16')](_0x499987);}return null;};}function patchUpdates(_0x2ccd8c){return function(_0x4695d1){try{jsonpatch[_0xa6cd('0x1b')](_0x4695d1,_0x2ccd8c,!![]);}catch(_0x199a06){return BPromise['reject'](_0x199a06);}return _0x4695d1[_0xa6cd('0x1c')]();};}function saveUpdates(_0x14a9b7,_0x3c8d9a){return function(_0x22641e){if(_0x22641e){return _0x22641e[_0xa6cd('0x1d')](_0x14a9b7)['then'](function(_0x4efc2f){return _0x4efc2f;});}return null;};}function removeEntity(_0x54f474,_0x1fc457){return function(_0x20f05c){if(_0x20f05c){return _0x20f05c[_0xa6cd('0x1e')]()['then'](function(){_0x54f474[_0xa6cd('0x15')](0xcc)[_0xa6cd('0x14')]();});}};}function handleEntityNotFound(_0x1b8d09,_0x3d0106){return function(_0xeee4b5){if(!_0xeee4b5){_0x1b8d09[_0xa6cd('0x1f')](0x194);}return _0xeee4b5;};}function handleError(_0x770248,_0x176a36){_0x176a36=_0x176a36||0x1f4;return function(_0x33918b){logger['error'](_0x33918b[_0xa6cd('0x20')]);if(_0x33918b['name']){delete _0x33918b['name'];}_0x770248['status'](_0x176a36)['send'](_0x33918b);};}exports[_0xa6cd('0x21')]=function(_0xce0b43,_0x512c2e){var _0x1dee27={},_0x5dbdf0={},_0x2b2f11={'count':0x0,'rows':[]};var _0x110280=db[_0xa6cd('0x22')][_0xa6cd('0x23')];_0x5dbdf0[_0xa6cd('0x24')]=_[_0xa6cd('0x25')](_0x110280);var _0x21d791={'dateStart':_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x27')],'dateEnd':_0xce0b43[_0xa6cd('0x26')]['dateEnd']};delete _0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x27')];delete _0xce0b43[_0xa6cd('0x26')]['dateEnd'];_0x5dbdf0[_0xa6cd('0x26')]=_[_0xa6cd('0x25')](_0xce0b43[_0xa6cd('0x26')]);_0x5dbdf0[_0xa6cd('0x28')]=_[_0xa6cd('0x29')](_0x5dbdf0[_0xa6cd('0x24')],_0x5dbdf0[_0xa6cd('0x26')]);_0x1dee27[_0xa6cd('0x2a')]=_['intersection'](_0x5dbdf0[_0xa6cd('0x24')],qs[_0xa6cd('0x2b')](_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x2b')]));_0x1dee27[_0xa6cd('0x2a')]=_0x1dee27[_0xa6cd('0x2a')][_0xa6cd('0x2c')]?_0x1dee27['attributes']:_0x5dbdf0[_0xa6cd('0x24')];if(!_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x2d')](_0xa6cd('0x2e'))){_0x1dee27[_0xa6cd('0x2f')]=qs[_0xa6cd('0x2f')](_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x2f')]);_0x1dee27['offset']=qs[_0xa6cd('0x18')](_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x18')]);}_0x1dee27[_0xa6cd('0x30')]=qs['sort'](_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x31')]);_0x1dee27[_0xa6cd('0x32')]=qs['filters'](_[_0xa6cd('0x33')](_0xce0b43[_0xa6cd('0x26')],_0x5dbdf0['filters']));if(_0x21d791['dateStart']){if(_0x21d791['dateEnd']){_0x21d791[_0xa6cd('0x34')]=moment(_0x21d791[_0xa6cd('0x34')])[_0xa6cd('0x35')](0x1,_0xa6cd('0x36'));}else{_0x21d791[_0xa6cd('0x34')]=moment(_0x21d791[_0xa6cd('0x27')])[_0xa6cd('0x35')](0x1,'day');}_[_0xa6cd('0x37')](_0x1dee27[_0xa6cd('0x32')],{'createdAt':{'$gte':_0x21d791[_0xa6cd('0x27')],'$lte':_0x21d791[_0xa6cd('0x34')]}});}if(_0xce0b43['query']['filter']){_0x1dee27['where']=_['merge'](_0x1dee27['where'],{'$or':_[_0xa6cd('0x38')](_0x1dee27[_0xa6cd('0x2a')],function(_0x1240f3){var _0x1250ae={};_0x1250ae[_0x1240f3]={'$like':'%'+_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x39')]+'%'};return _0x1250ae;})});}_0x1dee27=_['merge']({},_0x1dee27,_0xce0b43[_0xa6cd('0x3a')]);var _0x3add5e={'where':_0x1dee27['where']};return db['VoiceCallReport'][_0xa6cd('0x17')](_0x3add5e)[_0xa6cd('0x3b')](function(_0x44ece0){_0x2b2f11[_0xa6cd('0x17')]=_0x44ece0;if(_0xce0b43[_0xa6cd('0x26')][_0xa6cd('0x3c')]){_0x1dee27[_0xa6cd('0x3d')]=[{'attributes':['id',_0xa6cd('0x3e'),'fullname',_0xa6cd('0x3f')],'model':db[_0xa6cd('0x40')],'as':_0xa6cd('0x40')}];}return db[_0xa6cd('0x22')][_0xa6cd('0x41')](_0x1dee27);})[_0xa6cd('0x3b')](function(_0x2b9ffe){_0x2b2f11[_0xa6cd('0x42')]=_0x2b9ffe;return _0x2b2f11;})[_0xa6cd('0x3b')](respondWithFilteredResult(_0x512c2e,_0x1dee27))[_0xa6cd('0x43')](handleError(_0x512c2e,null));};exports[_0xa6cd('0x44')]=function(_0x20cd55,_0x101f0b){var _0x56c574={'raw':!![],'where':{'id':_0x20cd55[_0xa6cd('0x45')]['id']}},_0x5793e8={};_0x5793e8[_0xa6cd('0x24')]=_['keys'](db[_0xa6cd('0x22')][_0xa6cd('0x23')]);_0x5793e8[_0xa6cd('0x26')]=_[_0xa6cd('0x25')](_0x20cd55[_0xa6cd('0x26')]);_0x5793e8['filters']=_[_0xa6cd('0x29')](_0x5793e8[_0xa6cd('0x24')],_0x5793e8[_0xa6cd('0x26')]);_0x56c574[_0xa6cd('0x2a')]=_['intersection'](_0x5793e8[_0xa6cd('0x24')],qs[_0xa6cd('0x2b')](_0x20cd55['query'][_0xa6cd('0x2b')]));_0x56c574['attributes']=_0x56c574[_0xa6cd('0x2a')][_0xa6cd('0x2c')]?_0x56c574[_0xa6cd('0x2a')]:_0x5793e8[_0xa6cd('0x24')];if(_0x20cd55[_0xa6cd('0x26')][_0xa6cd('0x3c')]){_0x56c574[_0xa6cd('0x3d')]=[{'all':!![]}];}_0x56c574=_[_0xa6cd('0x37')]({},_0x56c574,_0x20cd55[_0xa6cd('0x3a')]);return db['VoiceCallReport'][_0xa6cd('0x46')](_0x56c574)[_0xa6cd('0x3b')](handleEntityNotFound(_0x101f0b,null))[_0xa6cd('0x3b')](respondWithResult(_0x101f0b,null))[_0xa6cd('0x43')](handleError(_0x101f0b,null));};exports[_0xa6cd('0x47')]=function(_0x2e87d7,_0x115b0d){return db[_0xa6cd('0x22')]['create'](_0x2e87d7[_0xa6cd('0x48')],{})[_0xa6cd('0x3b')](respondWithResult(_0x115b0d,0xc9))[_0xa6cd('0x43')](handleError(_0x115b0d,null));};exports[_0xa6cd('0x1e')]=function(_0x1e037,_0x27c849){return db[_0xa6cd('0x22')][_0xa6cd('0x46')]({'where':{'id':_0x1e037['params']['id']}})[_0xa6cd('0x3b')](handleEntityNotFound(_0x27c849,null))[_0xa6cd('0x3b')](removeEntity(_0x27c849,null))[_0xa6cd('0x43')](handleError(_0x27c849,null));};exports['describe']=function(_0x225f04,_0x38a8d1){return db[_0xa6cd('0x22')][_0xa6cd('0x49')]()['then'](respondWithResult(_0x38a8d1,null))[_0xa6cd('0x43')](handleError(_0x38a8d1,null));};exports['update']=function(_0x529385,_0x20da80){if(_0x529385[_0xa6cd('0x48')][_0xa6cd('0x4a')]){delete _0x529385[_0xa6cd('0x48')][_0xa6cd('0x4a')];}return db['VoiceCallReport'][_0xa6cd('0x46')]({'where':{'uniqueid':_0x529385['params']['id'],'UserId':{'$or':[null,_0x529385['user']['id']]}}})['then'](handleEntityNotFound(_0x20da80,null))['then'](saveUpdates(_0x529385[_0xa6cd('0x48')],null))[_0xa6cd('0x3b')](respondWithResult(_0x20da80,null))['catch'](handleError(_0x20da80,null));}; \ No newline at end of file +var _0x08b0=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','add','day','merge','filter','VoiceCallReport','count','include','fullname','alias','User','findAll','rows','catch','params','options','find','create','body','describe','uniqueid','user','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','../../config/environment','sendStatus','status','end','offset','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','keys','query','dateStart','dateEnd','filters'];(function(_0x5370d2,_0x503b5e){var _0x587eca=function(_0x1642b8){while(--_0x1642b8){_0x5370d2['push'](_0x5370d2['shift']());}};_0x587eca(++_0x503b5e);}(_0x08b0,0x192));var _0x008b=function(_0x40c98f,_0x538320){_0x40c98f=_0x40c98f-0x0;var _0x2380b5=_0x08b0[_0x40c98f];return _0x2380b5;};'use strict';var jsonpatch=require(_0x008b('0x0'));var rp=require(_0x008b('0x1'));var moment=require(_0x008b('0x2'));var BPromise=require(_0x008b('0x3'));var Mustache=require(_0x008b('0x4'));var util=require(_0x008b('0x5'));var path=require(_0x008b('0x6'));var sox=require(_0x008b('0x7'));var csv=require(_0x008b('0x8'));var ejs=require(_0x008b('0x9'));var fs=require('fs');var _=require(_0x008b('0xa'));var squel=require(_0x008b('0xb'));var crypto=require(_0x008b('0xc'));var jsforce=require(_0x008b('0xd'));var deskjs=require(_0x008b('0xe'));var toCsv=require(_0x008b('0x8'));var querystring=require(_0x008b('0xf'));var Papa=require(_0x008b('0x10'));var qs=require(_0x008b('0x11'));var logger=require(_0x008b('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x008b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e74f9,_0x2ee5c7){_0x2ee5c7=_0x2ee5c7||0xcc;return function(_0x524758){if(_0x524758){return _0x2e74f9[_0x008b('0x14')](_0x2ee5c7);}return _0x2e74f9[_0x008b('0x15')](_0x2ee5c7)[_0x008b('0x16')]();};}function respondWithResult(_0x11d337,_0x49624f){_0x49624f=_0x49624f||0xc8;return function(_0x44d94a){if(_0x44d94a){return _0x11d337['status'](_0x49624f)['json'](_0x44d94a);}};}function respondWithFilteredResult(_0x7c60d,_0x5a211e){return function(_0x532854){if(_0x532854){var _0x58dd5f=_0x532854['count'],_0x446b1a=_0x5a211e[_0x008b('0x17')],_0xf792d0=_0x5a211e[_0x008b('0x17')]+_0x5a211e['limit'],_0x10bb8b;if(_0xf792d0>=_0x58dd5f){_0xf792d0=_0x58dd5f;_0x10bb8b=0xc8;}else{_0x10bb8b=0xce;}_0x7c60d[_0x008b('0x15')](_0x10bb8b);return _0x7c60d[_0x008b('0x18')](_0x008b('0x19'),_0x446b1a+'-'+_0xf792d0+'/'+_0x58dd5f)[_0x008b('0x1a')](_0x532854);}return null;};}function patchUpdates(_0x22193a){return function(_0x1ef32c){try{jsonpatch['apply'](_0x1ef32c,_0x22193a,!![]);}catch(_0x562118){return BPromise[_0x008b('0x1b')](_0x562118);}return _0x1ef32c[_0x008b('0x1c')]();};}function saveUpdates(_0x32afc4,_0x596581){return function(_0x1e1e52){if(_0x1e1e52){return _0x1e1e52[_0x008b('0x1d')](_0x32afc4)[_0x008b('0x1e')](function(_0x312322){return _0x312322;});}return null;};}function removeEntity(_0x23df51,_0x353fe7){return function(_0x52c62a){if(_0x52c62a){return _0x52c62a[_0x008b('0x1f')]()[_0x008b('0x1e')](function(){_0x23df51[_0x008b('0x15')](0xcc)[_0x008b('0x16')]();});}};}function handleEntityNotFound(_0x5da956,_0x1bd089){return function(_0x2b45c8){if(!_0x2b45c8){_0x5da956[_0x008b('0x14')](0x194);}return _0x2b45c8;};}function handleError(_0x47e305,_0x5824e3){_0x5824e3=_0x5824e3||0x1f4;return function(_0x213a45){logger[_0x008b('0x20')](_0x213a45[_0x008b('0x21')]);if(_0x213a45[_0x008b('0x22')]){delete _0x213a45[_0x008b('0x22')];}_0x47e305[_0x008b('0x15')](_0x5824e3)['send'](_0x213a45);};}exports[_0x008b('0x23')]=function(_0x701ff3,_0x548dbc){var _0x2f9050={},_0x4d0147={},_0x209e6d={'count':0x0,'rows':[]};var _0x3ca46e=db['VoiceCallReport'][_0x008b('0x24')];_0x4d0147['model']=_[_0x008b('0x25')](_0x3ca46e);var _0x5243e7={'dateStart':_0x701ff3[_0x008b('0x26')][_0x008b('0x27')],'dateEnd':_0x701ff3[_0x008b('0x26')][_0x008b('0x28')]};delete _0x701ff3[_0x008b('0x26')][_0x008b('0x27')];delete _0x701ff3[_0x008b('0x26')][_0x008b('0x28')];_0x4d0147[_0x008b('0x26')]=_[_0x008b('0x25')](_0x701ff3['query']);_0x4d0147[_0x008b('0x29')]=_[_0x008b('0x2a')](_0x4d0147['model'],_0x4d0147[_0x008b('0x26')]);_0x2f9050['attributes']=_[_0x008b('0x2a')](_0x4d0147[_0x008b('0x2b')],qs[_0x008b('0x2c')](_0x701ff3[_0x008b('0x26')]['fields']));_0x2f9050[_0x008b('0x2d')]=_0x2f9050[_0x008b('0x2d')][_0x008b('0x2e')]?_0x2f9050[_0x008b('0x2d')]:_0x4d0147['model'];if(!_0x701ff3[_0x008b('0x26')][_0x008b('0x2f')](_0x008b('0x30'))){_0x2f9050[_0x008b('0x31')]=qs[_0x008b('0x31')](_0x701ff3[_0x008b('0x26')]['limit']);_0x2f9050[_0x008b('0x17')]=qs[_0x008b('0x17')](_0x701ff3[_0x008b('0x26')][_0x008b('0x17')]);}_0x2f9050[_0x008b('0x32')]=qs[_0x008b('0x33')](_0x701ff3[_0x008b('0x26')]['sort']);_0x2f9050[_0x008b('0x34')]=qs[_0x008b('0x29')](_['pick'](_0x701ff3[_0x008b('0x26')],_0x4d0147['filters']));if(_0x5243e7[_0x008b('0x27')]){if(_0x5243e7[_0x008b('0x28')]){_0x5243e7[_0x008b('0x28')]=moment(_0x5243e7['dateEnd'])[_0x008b('0x35')](0x1,'day');}else{_0x5243e7['dateEnd']=moment(_0x5243e7[_0x008b('0x27')])[_0x008b('0x35')](0x1,_0x008b('0x36'));}_[_0x008b('0x37')](_0x2f9050[_0x008b('0x34')],{'createdAt':{'$gte':_0x5243e7['dateStart'],'$lte':_0x5243e7[_0x008b('0x28')]}});}if(_0x701ff3[_0x008b('0x26')][_0x008b('0x38')]){_0x2f9050[_0x008b('0x34')]=_[_0x008b('0x37')](_0x2f9050[_0x008b('0x34')],{'$or':_['map'](_0x2f9050['attributes'],function(_0x20a2de){var _0x84c90c={};_0x84c90c[_0x20a2de]={'$like':'%'+_0x701ff3[_0x008b('0x26')]['filter']+'%'};return _0x84c90c;})});}_0x2f9050=_['merge']({},_0x2f9050,_0x701ff3['options']);var _0x2e91bf={'where':_0x2f9050['where']};return db[_0x008b('0x39')]['count'](_0x2e91bf)[_0x008b('0x1e')](function(_0x348fd1){_0x209e6d[_0x008b('0x3a')]=_0x348fd1;if(_0x701ff3[_0x008b('0x26')]['includeAll']){_0x2f9050[_0x008b('0x3b')]=[{'attributes':['id',_0x008b('0x22'),_0x008b('0x3c'),_0x008b('0x3d')],'model':db[_0x008b('0x3e')],'as':_0x008b('0x3e')}];}return db['VoiceCallReport'][_0x008b('0x3f')](_0x2f9050);})[_0x008b('0x1e')](function(_0x790f7d){_0x209e6d[_0x008b('0x40')]=_0x790f7d;return _0x209e6d;})[_0x008b('0x1e')](respondWithFilteredResult(_0x548dbc,_0x2f9050))[_0x008b('0x41')](handleError(_0x548dbc,null));};exports['show']=function(_0x3cb402,_0x502c61){var _0x26b1d6={'raw':!![],'where':{'id':_0x3cb402[_0x008b('0x42')]['id']}},_0x44de59={};_0x44de59[_0x008b('0x2b')]=_[_0x008b('0x25')](db['VoiceCallReport']['rawAttributes']);_0x44de59[_0x008b('0x26')]=_[_0x008b('0x25')](_0x3cb402['query']);_0x44de59[_0x008b('0x29')]=_[_0x008b('0x2a')](_0x44de59['model'],_0x44de59[_0x008b('0x26')]);_0x26b1d6[_0x008b('0x2d')]=_[_0x008b('0x2a')](_0x44de59[_0x008b('0x2b')],qs['fields'](_0x3cb402[_0x008b('0x26')]['fields']));_0x26b1d6[_0x008b('0x2d')]=_0x26b1d6[_0x008b('0x2d')][_0x008b('0x2e')]?_0x26b1d6[_0x008b('0x2d')]:_0x44de59[_0x008b('0x2b')];if(_0x3cb402[_0x008b('0x26')]['includeAll']){_0x26b1d6['include']=[{'all':!![]}];}_0x26b1d6=_['merge']({},_0x26b1d6,_0x3cb402[_0x008b('0x43')]);return db[_0x008b('0x39')][_0x008b('0x44')](_0x26b1d6)['then'](handleEntityNotFound(_0x502c61,null))[_0x008b('0x1e')](respondWithResult(_0x502c61,null))[_0x008b('0x41')](handleError(_0x502c61,null));};exports['create']=function(_0x54fb09,_0x4e76c2){return db['VoiceCallReport'][_0x008b('0x45')](_0x54fb09[_0x008b('0x46')],{})[_0x008b('0x1e')](respondWithResult(_0x4e76c2,0xc9))[_0x008b('0x41')](handleError(_0x4e76c2,null));};exports[_0x008b('0x1f')]=function(_0x43af9a,_0x1f6ba5){return db[_0x008b('0x39')][_0x008b('0x44')]({'where':{'id':_0x43af9a[_0x008b('0x42')]['id']}})[_0x008b('0x1e')](handleEntityNotFound(_0x1f6ba5,null))[_0x008b('0x1e')](removeEntity(_0x1f6ba5,null))[_0x008b('0x41')](handleError(_0x1f6ba5,null));};exports[_0x008b('0x47')]=function(_0x36c993,_0x5b6a1c){return db['VoiceCallReport'][_0x008b('0x47')]()[_0x008b('0x1e')](respondWithResult(_0x5b6a1c,null))[_0x008b('0x41')](handleError(_0x5b6a1c,null));};exports['update']=function(_0xe5174b,_0x3c35e3){if(_0xe5174b[_0x008b('0x46')][_0x008b('0x48')]){delete _0xe5174b[_0x008b('0x46')]['uniqueid'];}return db['VoiceCallReport'][_0x008b('0x44')]({'where':{'uniqueid':_0xe5174b[_0x008b('0x42')]['id'],'UserId':{'$or':[null,_0xe5174b[_0x008b('0x49')]['id']]}}})[_0x008b('0x1e')](handleEntityNotFound(_0x3c35e3,null))['then'](saveUpdates(_0xe5174b[_0x008b('0x46')],null))[_0x008b('0x1e')](respondWithResult(_0x3c35e3,null))[_0x008b('0x41')](handleError(_0x3c35e3,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5a81387..d6e2cf6 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 _0xa94d=['define','report_call','lodash','util','../../config/logger','api','bluebird','./voiceCallReport.attributes','exports'];(function(_0x2e0389,_0x2b01c9){var _0x154319=function(_0x34b88e){while(--_0x34b88e){_0x2e0389['push'](_0x2e0389['shift']());}};_0x154319(++_0x2b01c9);}(_0xa94d,0x80));var _0xda94=function(_0x21d60d,_0x26803b){_0x21d60d=_0x21d60d-0x0;var _0xd9d194=_0xa94d[_0x21d60d];return _0xd9d194;};'use strict';var _=require(_0xda94('0x0'));var util=require(_0xda94('0x1'));var logger=require(_0xda94('0x2'))(_0xda94('0x3'));var moment=require('moment');var BPromise=require(_0xda94('0x4'));var rp=require('request-promise');var attributes=require(_0xda94('0x5'));module[_0xda94('0x6')]=function(_0x3aef6b,_0x5a4768){return _0x3aef6b[_0xda94('0x7')]('VoiceCallReport',attributes,{'tableName':_0xda94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1b3=['request-promise','./voiceCallReport.attributes','define','VoiceCallReport','report_call','lodash','util','moment'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xd1b3,0x95));var _0x3d1b=function(_0x5d8d10,_0x52e34f){_0x5d8d10=_0x5d8d10-0x0;var _0x3f3abc=_0xd1b3[_0x5d8d10];return _0x3f3abc;};'use strict';var _=require(_0x3d1b('0x0'));var util=require(_0x3d1b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3d1b('0x2'));var BPromise=require('bluebird');var rp=require(_0x3d1b('0x3'));var attributes=require(_0x3d1b('0x4'));module['exports']=function(_0x3f2cd4,_0x409d4b){return _0x3f2cd4[_0x3d1b('0x5')](_0x3d1b('0x6'),attributes,{'tableName':_0x3d1b('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 1598111..d0d4ab6 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 _0xcc82=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','options','where','attributes','limit','include','CreateVoiceCallReport','create','body','raw','debug','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xcc82,0xc0));var _0x2cc8=function(_0x2b0f81,_0x3917f0){_0x2b0f81=_0x2b0f81-0x0;var _0x5ce74c=_0xcc82[_0x2b0f81];return _0x5ce74c;};'use strict';var _=require(_0x2cc8('0x0'));var util=require(_0x2cc8('0x1'));var moment=require(_0x2cc8('0x2'));var BPromise=require(_0x2cc8('0x3'));var rs=require(_0x2cc8('0x4'));var fs=require('fs');var db=require(_0x2cc8('0x5'))['db'];var utils=require(_0x2cc8('0x6'));var logger=require(_0x2cc8('0x7'))(_0x2cc8('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2cc8('0x9')][_0x2cc8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f29f7,_0x2c2650,_0x5622f4){return new BPromise(function(_0x9b2720,_0x4ae065){return client['request'](_0x3f29f7,_0x5622f4)[_0x2cc8('0xb')](function(_0x9eccbc){logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x2c2650,_0x2cc8('0xe'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x2c2650,_0x2cc8('0xe'),JSON[_0x2cc8('0xf')](_0x9eccbc));if(_0x9eccbc[_0x2cc8('0x10')]){if(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x11')]===0x1f4){logger[_0x2cc8('0x10')](_0x2cc8('0xd'),_0x2c2650,_0x9eccbc['error'][_0x2cc8('0x12')]);return _0x4ae065(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x12')]);}logger['error']('VoiceCallReport,\x20%s,\x20%s',_0x2c2650,_0x9eccbc['error'][_0x2cc8('0x12')]);return _0x9b2720(_0x9eccbc[_0x2cc8('0x10')][_0x2cc8('0x12')]);}else{logger[_0x2cc8('0xc')](_0x2cc8('0xd'),_0x2c2650,_0x2cc8('0xe'));_0x9b2720(_0x9eccbc[_0x2cc8('0x13')]['message']);}})[_0x2cc8('0x14')](function(_0x104807){logger[_0x2cc8('0x10')](_0x2cc8('0xd'),_0x2c2650,_0x104807);_0x4ae065(_0x104807);});});}exports[_0x2cc8('0x15')]=function(_0x40f441){var _0x314f00=this;return new Promise(function(_0x46d958,_0x37afe5){return db[_0x2cc8('0x16')]['findAll']({'raw':_0x40f441['options']?_0x40f441[_0x2cc8('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40f441[_0x2cc8('0x17')]?_0x40f441[_0x2cc8('0x17')][_0x2cc8('0x18')]||null:null,'attributes':_0x40f441[_0x2cc8('0x17')]?_0x40f441['options'][_0x2cc8('0x19')]||null:null,'limit':_0x40f441['options']?_0x40f441['options'][_0x2cc8('0x1a')]||null:null,'include':_0x40f441[_0x2cc8('0x17')]?_0x40f441['options']['include']?_['map'](_0x40f441[_0x2cc8('0x17')]['include'],function(_0x319811){return{'model':db[_0x319811['model']],'as':_0x319811['as'],'attributes':_0x319811[_0x2cc8('0x19')],'include':_0x319811['include']?_['map'](_0x319811['include'],function(_0x3d5724){return{'model':db[_0x3d5724['model']],'as':_0x3d5724['as'],'attributes':_0x3d5724['attributes'],'include':_0x3d5724[_0x2cc8('0x1b')]?_['map'](_0x3d5724['include'],function(_0x2a4a51){return{'model':db[_0x2a4a51['model']],'as':_0x2a4a51['as'],'attributes':_0x2a4a51[_0x2cc8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2cc8('0xb')](function(_0x3a75f6){logger[_0x2cc8('0xc')]('GetVoiceCallReport',_0x40f441);logger['debug']('GetVoiceCallReport',_0x40f441,JSON[_0x2cc8('0xf')](_0x3a75f6));_0x46d958(_0x3a75f6);})[_0x2cc8('0x14')](function(_0xbf1b48){logger['error'](_0x2cc8('0x15'),_0xbf1b48[_0x2cc8('0x12')],_0x40f441);_0x37afe5(_0x314f00[_0x2cc8('0x10')](0x1f4,_0xbf1b48['message']));});});};exports[_0x2cc8('0x1c')]=function(_0x1e6a8a){var _0x2297c3=this;return new Promise(function(_0x311124,_0x257b28){return db[_0x2cc8('0x16')][_0x2cc8('0x1d')](_0x1e6a8a[_0x2cc8('0x1e')],{'raw':_0x1e6a8a['options']?_0x1e6a8a[_0x2cc8('0x17')][_0x2cc8('0x1f')]===undefined?!![]:![]:!![]})[_0x2cc8('0xb')](function(_0x3c0c05){logger['info'](_0x2cc8('0x1c'),_0x1e6a8a);logger[_0x2cc8('0x20')](_0x2cc8('0x1c'),_0x1e6a8a,JSON[_0x2cc8('0xf')](_0x3c0c05));_0x311124(_0x3c0c05);})[_0x2cc8('0x14')](function(_0x5e8c6b){logger['error'](_0x2cc8('0x1c'),_0x5e8c6b[_0x2cc8('0x12')],_0x1e6a8a);_0x257b28(_0x2297c3[_0x2cc8('0x10')](0x1f4,_0x5e8c6b[_0x2cc8('0x12')]));});});};exports[_0x2cc8('0x21')]=function(_0x28b04e){var _0x3b60df=this;return new Promise(function(_0x418b07,_0x4a5a6a){return db['VoiceCallReport']['update'](_0x28b04e[_0x2cc8('0x1e')],{'raw':_0x28b04e[_0x2cc8('0x17')]?_0x28b04e[_0x2cc8('0x17')][_0x2cc8('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28b04e[_0x2cc8('0x17')]?_0x28b04e[_0x2cc8('0x17')]['where']||null:null,'attributes':_0x28b04e['options']?_0x28b04e['options']['attributes']||null:null,'limit':_0x28b04e['options']?_0x28b04e[_0x2cc8('0x17')][_0x2cc8('0x1a')]||null:null})['then'](function(_0x2e8a9c){logger[_0x2cc8('0xc')](_0x2cc8('0x21'),_0x28b04e);logger[_0x2cc8('0x20')](_0x2cc8('0x21'),_0x28b04e,JSON[_0x2cc8('0xf')](_0x2e8a9c));_0x418b07(_0x2e8a9c);})[_0x2cc8('0x14')](function(_0x166e99){logger[_0x2cc8('0x10')](_0x2cc8('0x21'),_0x166e99[_0x2cc8('0x12')],_0x28b04e);_0x4a5a6a(_0x3b60df[_0x2cc8('0x10')](0x1f4,_0x166e99['message']));});});}; \ No newline at end of file +var _0xcdae=['jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x474a31,_0x4ba9cd){var _0x355f3e=function(_0x34abfd){while(--_0x34abfd){_0x474a31['push'](_0x474a31['shift']());}};_0x355f3e(++_0x4ba9cd);}(_0xcdae,0x6f));var _0xecda=function(_0x1abc37,_0x51ae24){_0x1abc37=_0x1abc37-0x0;var _0x4efe63=_0xcdae[_0x1abc37];return _0x4efe63;};'use strict';var _=require(_0xecda('0x0'));var util=require(_0xecda('0x1'));var moment=require(_0xecda('0x2'));var BPromise=require(_0xecda('0x3'));var rs=require(_0xecda('0x4'));var fs=require('fs');var db=require(_0xecda('0x5'))['db'];var utils=require(_0xecda('0x6'));var logger=require('../../config/logger')(_0xecda('0x7'));var config=require(_0xecda('0x8'));var jayson=require(_0xecda('0x9'));var client=jayson[_0xecda('0xa')][_0xecda('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12adf2,_0x151cc5,_0x514c36){return new BPromise(function(_0x1158e3,_0x734345){return client[_0xecda('0xc')](_0x12adf2,_0x514c36)[_0xecda('0xd')](function(_0x67e63b){logger[_0xecda('0xe')](_0xecda('0xf'),_0x151cc5,'request\x20sent');logger[_0xecda('0x10')](_0xecda('0x11'),_0x151cc5,_0xecda('0x12'),JSON[_0xecda('0x13')](_0x67e63b));if(_0x67e63b[_0xecda('0x14')]){if(_0x67e63b[_0xecda('0x14')][_0xecda('0x15')]===0x1f4){logger[_0xecda('0x14')]('VoiceCallReport,\x20%s,\x20%s',_0x151cc5,_0x67e63b['error'][_0xecda('0x16')]);return _0x734345(_0x67e63b['error']['message']);}logger[_0xecda('0x14')](_0xecda('0xf'),_0x151cc5,_0x67e63b[_0xecda('0x14')][_0xecda('0x16')]);return _0x1158e3(_0x67e63b[_0xecda('0x14')]['message']);}else{logger[_0xecda('0xe')](_0xecda('0xf'),_0x151cc5,_0xecda('0x12'));_0x1158e3(_0x67e63b['result']['message']);}})[_0xecda('0x17')](function(_0x52aa14){logger[_0xecda('0x14')](_0xecda('0xf'),_0x151cc5,_0x52aa14);_0x734345(_0x52aa14);});});}exports[_0xecda('0x18')]=function(_0x15a94c){var _0x3a4ede=this;return new Promise(function(_0x4d22eb,_0x28aa22){return db[_0xecda('0x19')][_0xecda('0x1a')]({'raw':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![],'where':_0x15a94c['options']?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1d')]||null:null,'attributes':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1e')]||null:null,'limit':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x1f')]||null:null,'include':_0x15a94c[_0xecda('0x1b')]?_0x15a94c[_0xecda('0x1b')][_0xecda('0x20')]?_[_0xecda('0x21')](_0x15a94c['options'][_0xecda('0x20')],function(_0x5153d3){return{'model':db[_0x5153d3[_0xecda('0x22')]],'as':_0x5153d3['as'],'attributes':_0x5153d3['attributes'],'include':_0x5153d3[_0xecda('0x20')]?_[_0xecda('0x21')](_0x5153d3['include'],function(_0x5baa04){return{'model':db[_0x5baa04[_0xecda('0x22')]],'as':_0x5baa04['as'],'attributes':_0x5baa04['attributes'],'include':_0x5baa04['include']?_['map'](_0x5baa04['include'],function(_0x2e4b6e){return{'model':db[_0x2e4b6e[_0xecda('0x22')]],'as':_0x2e4b6e['as'],'attributes':_0x2e4b6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xecda('0xd')](function(_0x493219){logger[_0xecda('0xe')](_0xecda('0x18'),_0x15a94c);logger[_0xecda('0x10')](_0xecda('0x18'),_0x15a94c,JSON[_0xecda('0x13')](_0x493219));_0x4d22eb(_0x493219);})[_0xecda('0x17')](function(_0xe93197){logger[_0xecda('0x14')](_0xecda('0x18'),_0xe93197[_0xecda('0x16')],_0x15a94c);_0x28aa22(_0x3a4ede[_0xecda('0x14')](0x1f4,_0xe93197['message']));});});};exports['CreateVoiceCallReport']=function(_0x1da748){var _0x37282a=this;return new Promise(function(_0x176b55,_0x14c96a){return db['VoiceCallReport'][_0xecda('0x23')](_0x1da748[_0xecda('0x24')],{'raw':_0x1da748['options']?_0x1da748[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![]})[_0xecda('0xd')](function(_0x718bab){logger[_0xecda('0xe')]('CreateVoiceCallReport',_0x1da748);logger[_0xecda('0x10')](_0xecda('0x25'),_0x1da748,JSON['stringify'](_0x718bab));_0x176b55(_0x718bab);})[_0xecda('0x17')](function(_0x1cf7b3){logger[_0xecda('0x14')](_0xecda('0x25'),_0x1cf7b3['message'],_0x1da748);_0x14c96a(_0x37282a[_0xecda('0x14')](0x1f4,_0x1cf7b3[_0xecda('0x16')]));});});};exports[_0xecda('0x26')]=function(_0x356214){var _0x440ff8=this;return new Promise(function(_0x46c889,_0x5ce581){return db[_0xecda('0x19')][_0xecda('0x27')](_0x356214[_0xecda('0x24')],{'raw':_0x356214['options']?_0x356214[_0xecda('0x1b')][_0xecda('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1d')]||null:null,'attributes':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1e')]||null:null,'limit':_0x356214[_0xecda('0x1b')]?_0x356214[_0xecda('0x1b')][_0xecda('0x1f')]||null:null})['then'](function(_0x58f9f8){logger[_0xecda('0xe')](_0xecda('0x26'),_0x356214);logger[_0xecda('0x10')](_0xecda('0x26'),_0x356214,JSON['stringify'](_0x58f9f8));_0x46c889(_0x58f9f8);})[_0xecda('0x17')](function(_0x195a62){logger[_0xecda('0x14')](_0xecda('0x26'),_0x195a62[_0xecda('0x16')],_0x356214);_0x5ce581(_0x440ff8[_0xecda('0x14')](0x1f4,_0x195a62['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ec1fa45..3597280 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 _0x3e30=['../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','get','/:id','post','put','update','delete','destroy','exports','util','path','express','Router'];(function(_0x3dd6c5,_0x45fc43){var _0x2cdc5f=function(_0x446b86){while(--_0x446b86){_0x3dd6c5['push'](_0x3dd6c5['shift']());}};_0x2cdc5f(++_0x45fc43);}(_0x3e30,0x15c));var _0x03e3=function(_0x465137,_0x3ec0b0){_0x465137=_0x465137-0x0;var _0xd61384=_0x3e30[_0x465137];return _0xd61384;};'use strict';var multer=require('multer');var util=require(_0x03e3('0x0'));var path=require(_0x03e3('0x1'));var express=require(_0x03e3('0x2'));var router=express[_0x03e3('0x3')]();var auth=require(_0x03e3('0x4'));var interaction=require(_0x03e3('0x5'));var config=require('../../config/environment');var controller=require(_0x03e3('0x6'));router['get']('/',auth[_0x03e3('0x7')](),controller['index']);router[_0x03e3('0x8')](_0x03e3('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x03e3('0xa')]('/',auth[_0x03e3('0x7')](),controller['create']);router[_0x03e3('0xb')](_0x03e3('0x9'),auth[_0x03e3('0x7')](),controller[_0x03e3('0xc')]);router[_0x03e3('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x03e3('0xe')]);module[_0x03e3('0xf')]=router; \ No newline at end of file +var _0x405d=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','/:id','show','post','isAuthenticated','create','put'];(function(_0x357c3e,_0x4ca8c0){var _0x7b6384=function(_0x10c310){while(--_0x10c310){_0x357c3e['push'](_0x357c3e['shift']());}};_0x7b6384(++_0x4ca8c0);}(_0x405d,0x158));var _0xd405=function(_0x48f672,_0x59b4cc){_0x48f672=_0x48f672-0x0;var _0x21801d=_0x405d[_0x48f672];return _0x21801d;};'use strict';var multer=require(_0xd405('0x0'));var util=require(_0xd405('0x1'));var path=require(_0xd405('0x2'));var express=require(_0xd405('0x3'));var router=express[_0xd405('0x4')]();var auth=require(_0xd405('0x5'));var interaction=require(_0xd405('0x6'));var config=require(_0xd405('0x7'));var controller=require(_0xd405('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd405('0x9')](_0xd405('0xa'),auth['isAuthenticated'](),controller[_0xd405('0xb')]);router[_0xd405('0xc')]('/',auth[_0xd405('0xd')](),controller[_0xd405('0xe')]);router[_0xd405('0xf')](_0xd405('0xa'),auth[_0xd405('0xd')](),controller['update']);router['delete'](_0xd405('0xa'),auth[_0xd405('0xd')](),controller[_0xd405('0x10')]);module[_0xd405('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 95852ab..a8e0b3c 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 _0x16cf=['STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports'];(function(_0x777257,_0x5f4df4){var _0x3e6c17=function(_0x1c648c){while(--_0x1c648c){_0x777257['push'](_0x777257['shift']());}};_0x3e6c17(++_0x5f4df4);}(_0x16cf,0x198));var _0xf16c=function(_0xfb5d35,_0x1bc2ce){_0xfb5d35=_0xfb5d35-0x0;var _0x55c2e3=_0x16cf[_0xfb5d35];return _0x55c2e3;};'use strict';var Sequelize=require(_0xf16c('0x0'));module[_0xf16c('0x1')]={'name':{'type':Sequelize[_0xf16c('0x2')]},'prefix':{'type':Sequelize[_0xf16c('0x2')],'unique':_0xf16c('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xf16c('0x2')],'set':function(_0x1d2079){this[_0xf16c('0x4')](_0xf16c('0x5'),_0x1d2079?_0x1d2079[_0xf16c('0x6')](''):[]);},'get':function(){return this[_0xf16c('0x7')]('options')?this[_0xf16c('0x7')](_0xf16c('0x5'))[_0xf16c('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xf16c('0x2')]},'record':{'type':Sequelize[_0xf16c('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf16c('0x2')]},'description':{'type':Sequelize[_0xf16c('0x2')]}}; \ No newline at end of file +var _0xc3c0=['sequelize','exports','STRING','join','getDataValue','options','split','BOOLEAN'];(function(_0x5dd25a,_0x434e62){var _0x3a45c8=function(_0x156fe9){while(--_0x156fe9){_0x5dd25a['push'](_0x5dd25a['shift']());}};_0x3a45c8(++_0x434e62);}(_0xc3c0,0x198));var _0x0c3c=function(_0x2a8ed9,_0x3e5591){_0x2a8ed9=_0x2a8ed9-0x0;var _0x313d13=_0xc3c0[_0x2a8ed9];return _0x313d13;};'use strict';var Sequelize=require(_0x0c3c('0x0'));module[_0x0c3c('0x1')]={'name':{'type':Sequelize[_0x0c3c('0x2')]},'prefix':{'type':Sequelize[_0x0c3c('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x0c3c('0x2')],'set':function(_0x1f6421){this['setDataValue']('options',_0x1f6421?_0x1f6421[_0x0c3c('0x3')](''):[]);},'get':function(){return this[_0x0c3c('0x4')]('options')?this['getDataValue'](_0x0c3c('0x5'))[_0x0c3c('0x6')](''):[];}},'auth':{'type':Sequelize[_0x0c3c('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x0c3c('0x2')]},'record':{'type':Sequelize[_0x0c3c('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0c3c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9fdaa42..aad4ea0 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 _0xfb0d=['json','count','offset','limit','Content-Range','apply','reject','save','destroy','then','end','stack','name','send','VoiceChanSpy','model','query','dateStart','dateEnd','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','include','findAll','rows','catch','show','params','filters','includeAll','find','create','body','update','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x2b49ba,_0x14eecc){var _0x1e68ce=function(_0x286611){while(--_0x286611){_0x2b49ba['push'](_0x2b49ba['shift']());}};_0x1e68ce(++_0x14eecc);}(_0xfb0d,0x70));var _0xdfb0=function(_0x2e8f0e,_0x3df6b6){_0x2e8f0e=_0x2e8f0e-0x0;var _0x342f10=_0xfb0d[_0x2e8f0e];return _0x342f10;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xdfb0('0x0'));var moment=require(_0xdfb0('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xdfb0('0x2'));var util=require(_0xdfb0('0x3'));var path=require(_0xdfb0('0x4'));var sox=require(_0xdfb0('0x5'));var csv=require(_0xdfb0('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfb0('0x7'));var squel=require(_0xdfb0('0x8'));var crypto=require(_0xdfb0('0x9'));var jsforce=require(_0xdfb0('0xa'));var deskjs=require(_0xdfb0('0xb'));var toCsv=require(_0xdfb0('0x6'));var querystring=require('querystring');var Papa=require(_0xdfb0('0xc'));var qs=require('../../components/parsers/qs');var logger=require(_0xdfb0('0xd'))(_0xdfb0('0xe'));var utils=require(_0xdfb0('0xf'));var config=require(_0xdfb0('0x10'));var db=require(_0xdfb0('0x11'))['db'];function respondWithStatusCode(_0x3dd846,_0x83e651){_0x83e651=_0x83e651||0xcc;return function(_0x4671c8){if(_0x4671c8){return _0x3dd846[_0xdfb0('0x12')](_0x83e651);}return _0x3dd846['status'](_0x83e651)['end']();};}function respondWithResult(_0xaedb51,_0x433f73){_0x433f73=_0x433f73||0xc8;return function(_0x42b09a){if(_0x42b09a){return _0xaedb51[_0xdfb0('0x13')](_0x433f73)[_0xdfb0('0x14')](_0x42b09a);}};}function respondWithFilteredResult(_0x396ca4,_0x1535ef){return function(_0x275774){if(_0x275774){var _0x101b01=_0x275774[_0xdfb0('0x15')],_0xa90173=_0x1535ef[_0xdfb0('0x16')],_0xb9b8=_0x1535ef[_0xdfb0('0x16')]+_0x1535ef[_0xdfb0('0x17')],_0x29c164;if(_0xb9b8>=_0x101b01){_0xb9b8=_0x101b01;_0x29c164=0xc8;}else{_0x29c164=0xce;}_0x396ca4[_0xdfb0('0x13')](_0x29c164);return _0x396ca4['set'](_0xdfb0('0x18'),_0xa90173+'-'+_0xb9b8+'/'+_0x101b01)['json'](_0x275774);}return null;};}function patchUpdates(_0x3a1a0e){return function(_0x307c15){try{jsonpatch[_0xdfb0('0x19')](_0x307c15,_0x3a1a0e,!![]);}catch(_0x386e4f){return BPromise[_0xdfb0('0x1a')](_0x386e4f);}return _0x307c15[_0xdfb0('0x1b')]();};}function saveUpdates(_0x3311a1,_0x2996be){return function(_0x324091){if(_0x324091){return _0x324091['update'](_0x3311a1)['then'](function(_0x5a9d57){return _0x5a9d57;});}return null;};}function removeEntity(_0x12a1c0,_0x136fb7){return function(_0x2927f3){if(_0x2927f3){return _0x2927f3[_0xdfb0('0x1c')]()[_0xdfb0('0x1d')](function(){_0x12a1c0[_0xdfb0('0x13')](0xcc)[_0xdfb0('0x1e')]();});}};}function handleEntityNotFound(_0x327dbd,_0x211e84){return function(_0x25c2d){if(!_0x25c2d){_0x327dbd['sendStatus'](0x194);}return _0x25c2d;};}function handleError(_0x408d3f,_0x362c7c){_0x362c7c=_0x362c7c||0x1f4;return function(_0x33cba4){logger['error'](_0x33cba4[_0xdfb0('0x1f')]);if(_0x33cba4[_0xdfb0('0x20')]){delete _0x33cba4['name'];}_0x408d3f[_0xdfb0('0x13')](_0x362c7c)[_0xdfb0('0x21')](_0x33cba4);};}exports['index']=function(_0x1c06b1,_0x5bbb07){var _0x5f0d5f={},_0x5b5e0c={},_0x25f109={'count':0x0,'rows':[]};var _0x5053c4=db[_0xdfb0('0x22')]['rawAttributes'];_0x5b5e0c[_0xdfb0('0x23')]=_['keys'](_0x5053c4);var _0x286391={'dateStart':_0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x25')],'dateEnd':_0x1c06b1['query'][_0xdfb0('0x26')]};delete _0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x25')];delete _0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x26')];_0x5b5e0c[_0xdfb0('0x24')]=_[_0xdfb0('0x27')](_0x1c06b1['query']);_0x5b5e0c['filters']=_['intersection'](_0x5b5e0c[_0xdfb0('0x23')],_0x5b5e0c[_0xdfb0('0x24')]);_0x5f0d5f[_0xdfb0('0x28')]=_[_0xdfb0('0x29')](_0x5b5e0c[_0xdfb0('0x23')],qs[_0xdfb0('0x2a')](_0x1c06b1[_0xdfb0('0x24')]['fields']));_0x5f0d5f[_0xdfb0('0x28')]=_0x5f0d5f[_0xdfb0('0x28')][_0xdfb0('0x2b')]?_0x5f0d5f['attributes']:_0x5b5e0c[_0xdfb0('0x23')];if(!_0x1c06b1[_0xdfb0('0x24')]['hasOwnProperty'](_0xdfb0('0x2c'))){_0x5f0d5f[_0xdfb0('0x17')]=qs[_0xdfb0('0x17')](_0x1c06b1['query'][_0xdfb0('0x17')]);_0x5f0d5f[_0xdfb0('0x16')]=qs[_0xdfb0('0x16')](_0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x16')]);}_0x5f0d5f[_0xdfb0('0x2d')]=qs[_0xdfb0('0x2e')](_0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x2e')]);_0x5f0d5f[_0xdfb0('0x2f')]=qs['filters'](_[_0xdfb0('0x30')](_0x1c06b1[_0xdfb0('0x24')],_0x5b5e0c['filters']));if(_0x286391[_0xdfb0('0x25')]){if(_0x286391[_0xdfb0('0x26')]){_0x286391[_0xdfb0('0x26')]=moment(_0x286391[_0xdfb0('0x26')])[_0xdfb0('0x31')](0x1,_0xdfb0('0x32'));}else{_0x286391['dateEnd']=moment(_0x286391[_0xdfb0('0x25')])['add'](0x1,_0xdfb0('0x32'));}_[_0xdfb0('0x33')](_0x5f0d5f[_0xdfb0('0x2f')],{'createdAt':{'$gte':_0x286391[_0xdfb0('0x25')],'$lte':_0x286391[_0xdfb0('0x26')]}});}if(_0x1c06b1['query'][_0xdfb0('0x34')]){_0x5f0d5f['where']=_[_0xdfb0('0x33')](_0x5f0d5f[_0xdfb0('0x2f')],{'$or':_[_0xdfb0('0x35')](_0x5f0d5f[_0xdfb0('0x28')],function(_0x50c50b){var _0x1b81a8={};_0x1b81a8[_0x50c50b]={'$like':'%'+_0x1c06b1[_0xdfb0('0x24')][_0xdfb0('0x34')]+'%'};return _0x1b81a8;})});}_0x5f0d5f=_[_0xdfb0('0x33')]({},_0x5f0d5f,_0x1c06b1['options']);var _0x5a6b5b={'where':_0x5f0d5f[_0xdfb0('0x2f')]};return db[_0xdfb0('0x22')][_0xdfb0('0x15')](_0x5a6b5b)['then'](function(_0x435cca){_0x25f109[_0xdfb0('0x15')]=_0x435cca;if(_0x1c06b1['query']['includeAll']){_0x5f0d5f[_0xdfb0('0x36')]=[{'all':!![]}];}return db[_0xdfb0('0x22')][_0xdfb0('0x37')](_0x5f0d5f);})['then'](function(_0x43e6db){_0x25f109[_0xdfb0('0x38')]=_0x43e6db;return _0x25f109;})[_0xdfb0('0x1d')](respondWithFilteredResult(_0x5bbb07,_0x5f0d5f))[_0xdfb0('0x39')](handleError(_0x5bbb07,null));};exports[_0xdfb0('0x3a')]=function(_0x551c9a,_0x10d310){var _0x1b997a={'raw':![],'where':{'id':_0x551c9a[_0xdfb0('0x3b')]['id']}},_0xb515b8={};_0xb515b8[_0xdfb0('0x23')]=_['keys'](db[_0xdfb0('0x22')]['rawAttributes']);_0xb515b8[_0xdfb0('0x24')]=_[_0xdfb0('0x27')](_0x551c9a[_0xdfb0('0x24')]);_0xb515b8[_0xdfb0('0x3c')]=_['intersection'](_0xb515b8['model'],_0xb515b8[_0xdfb0('0x24')]);_0x1b997a[_0xdfb0('0x28')]=_[_0xdfb0('0x29')](_0xb515b8[_0xdfb0('0x23')],qs[_0xdfb0('0x2a')](_0x551c9a[_0xdfb0('0x24')][_0xdfb0('0x2a')]));_0x1b997a['attributes']=_0x1b997a['attributes'][_0xdfb0('0x2b')]?_0x1b997a[_0xdfb0('0x28')]:_0xb515b8[_0xdfb0('0x23')];if(_0x551c9a[_0xdfb0('0x24')][_0xdfb0('0x3d')]){_0x1b997a[_0xdfb0('0x36')]=[{'all':!![]}];}_0x1b997a=_[_0xdfb0('0x33')]({},_0x1b997a,_0x551c9a['options']);return db['VoiceChanSpy'][_0xdfb0('0x3e')](_0x1b997a)['then'](handleEntityNotFound(_0x10d310,null))[_0xdfb0('0x1d')](respondWithResult(_0x10d310,null))['catch'](handleError(_0x10d310,null));};exports[_0xdfb0('0x3f')]=function(_0x51d880,_0x54fad7){return db[_0xdfb0('0x22')][_0xdfb0('0x3f')](_0x51d880[_0xdfb0('0x40')],{})[_0xdfb0('0x1d')](respondWithResult(_0x54fad7,0xc9))[_0xdfb0('0x39')](handleError(_0x54fad7,null));};exports[_0xdfb0('0x41')]=function(_0x5dfc70,_0xcb800e){if(_0x5dfc70[_0xdfb0('0x40')]['id']){delete _0x5dfc70[_0xdfb0('0x40')]['id'];}return db[_0xdfb0('0x22')][_0xdfb0('0x3e')]({'where':{'id':_0x5dfc70['params']['id']}})[_0xdfb0('0x1d')](handleEntityNotFound(_0xcb800e,null))[_0xdfb0('0x1d')](saveUpdates(_0x5dfc70[_0xdfb0('0x40')],null))[_0xdfb0('0x1d')](respondWithResult(_0xcb800e,null))['catch'](handleError(_0xcb800e,null));};exports[_0xdfb0('0x1c')]=function(_0x2826c4,_0x324863){return db[_0xdfb0('0x22')]['find']({'where':{'id':_0x2826c4[_0xdfb0('0x3b')]['id']}})[_0xdfb0('0x1d')](handleEntityNotFound(_0x324863,null))[_0xdfb0('0x1d')](removeEntity(_0x324863,null))[_0xdfb0('0x39')](handleError(_0x324863,null));}; \ No newline at end of file +var _0xad6a=['moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','send','VoiceChanSpy','rawAttributes','keys','query','dateEnd','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','dateStart','add','day','merge','filter','map','options','includeAll','findAll','catch','show','params','include','create','body','find','destroy','fast-json-patch','request-promise'];(function(_0x581a82,_0x4ef243){var _0xcd70d0=function(_0x1df06d){while(--_0x1df06d){_0x581a82['push'](_0x581a82['shift']());}};_0xcd70d0(++_0x4ef243);}(_0xad6a,0x112));var _0xaad6=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xad6a[_0x36ed48];return _0x51c63a;};'use strict';var jsonpatch=require(_0xaad6('0x0'));var rp=require(_0xaad6('0x1'));var moment=require(_0xaad6('0x2'));var BPromise=require(_0xaad6('0x3'));var Mustache=require(_0xaad6('0x4'));var util=require(_0xaad6('0x5'));var path=require(_0xaad6('0x6'));var sox=require(_0xaad6('0x7'));var csv=require('to-csv');var ejs=require(_0xaad6('0x8'));var fs=require('fs');var _=require(_0xaad6('0x9'));var squel=require(_0xaad6('0xa'));var crypto=require(_0xaad6('0xb'));var jsforce=require(_0xaad6('0xc'));var deskjs=require(_0xaad6('0xd'));var toCsv=require(_0xaad6('0xe'));var querystring=require(_0xaad6('0xf'));var Papa=require('papaparse');var qs=require(_0xaad6('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xaad6('0x11'));var db=require(_0xaad6('0x12'))['db'];function respondWithStatusCode(_0x3d7b43,_0x586058){_0x586058=_0x586058||0xcc;return function(_0xa12f6a){if(_0xa12f6a){return _0x3d7b43[_0xaad6('0x13')](_0x586058);}return _0x3d7b43[_0xaad6('0x14')](_0x586058)[_0xaad6('0x15')]();};}function respondWithResult(_0x52088c,_0x3d2eb4){_0x3d2eb4=_0x3d2eb4||0xc8;return function(_0x465082){if(_0x465082){return _0x52088c['status'](_0x3d2eb4)[_0xaad6('0x16')](_0x465082);}};}function respondWithFilteredResult(_0x2213be,_0x4c9885){return function(_0x2d73b4){if(_0x2d73b4){var _0x43e93f=_0x2d73b4[_0xaad6('0x17')],_0x25100c=_0x4c9885[_0xaad6('0x18')],_0x227dab=_0x4c9885['offset']+_0x4c9885[_0xaad6('0x19')],_0x4e3b77;if(_0x227dab>=_0x43e93f){_0x227dab=_0x43e93f;_0x4e3b77=0xc8;}else{_0x4e3b77=0xce;}_0x2213be[_0xaad6('0x14')](_0x4e3b77);return _0x2213be[_0xaad6('0x1a')](_0xaad6('0x1b'),_0x25100c+'-'+_0x227dab+'/'+_0x43e93f)[_0xaad6('0x16')](_0x2d73b4);}return null;};}function patchUpdates(_0x333e91){return function(_0x37c565){try{jsonpatch['apply'](_0x37c565,_0x333e91,!![]);}catch(_0xe0fa4){return BPromise[_0xaad6('0x1c')](_0xe0fa4);}return _0x37c565[_0xaad6('0x1d')]();};}function saveUpdates(_0x148a21,_0x336d00){return function(_0x8e1b71){if(_0x8e1b71){return _0x8e1b71[_0xaad6('0x1e')](_0x148a21)[_0xaad6('0x1f')](function(_0x8b27d1){return _0x8b27d1;});}return null;};}function removeEntity(_0x444676,_0x3bc5c8){return function(_0x1d1833){if(_0x1d1833){return _0x1d1833['destroy']()['then'](function(){_0x444676[_0xaad6('0x14')](0xcc)[_0xaad6('0x15')]();});}};}function handleEntityNotFound(_0x3f65ce,_0xc008f6){return function(_0xada6e8){if(!_0xada6e8){_0x3f65ce[_0xaad6('0x13')](0x194);}return _0xada6e8;};}function handleError(_0x4006a1,_0x1fb30d){_0x1fb30d=_0x1fb30d||0x1f4;return function(_0x19c698){logger[_0xaad6('0x20')](_0x19c698[_0xaad6('0x21')]);if(_0x19c698[_0xaad6('0x22')]){delete _0x19c698[_0xaad6('0x22')];}_0x4006a1['status'](_0x1fb30d)[_0xaad6('0x23')](_0x19c698);};}exports['index']=function(_0x33dc71,_0x5e53d2){var _0x16e2ab={},_0x82b3a6={},_0x21c823={'count':0x0,'rows':[]};var _0x23cf98=db[_0xaad6('0x24')][_0xaad6('0x25')];_0x82b3a6['model']=_[_0xaad6('0x26')](_0x23cf98);var _0xac48c9={'dateStart':_0x33dc71[_0xaad6('0x27')]['dateStart'],'dateEnd':_0x33dc71['query'][_0xaad6('0x28')]};delete _0x33dc71[_0xaad6('0x27')]['dateStart'];delete _0x33dc71[_0xaad6('0x27')][_0xaad6('0x28')];_0x82b3a6[_0xaad6('0x27')]=_[_0xaad6('0x26')](_0x33dc71['query']);_0x82b3a6[_0xaad6('0x29')]=_[_0xaad6('0x2a')](_0x82b3a6[_0xaad6('0x2b')],_0x82b3a6[_0xaad6('0x27')]);_0x16e2ab['attributes']=_['intersection'](_0x82b3a6[_0xaad6('0x2b')],qs[_0xaad6('0x2c')](_0x33dc71[_0xaad6('0x27')]['fields']));_0x16e2ab[_0xaad6('0x2d')]=_0x16e2ab[_0xaad6('0x2d')][_0xaad6('0x2e')]?_0x16e2ab[_0xaad6('0x2d')]:_0x82b3a6[_0xaad6('0x2b')];if(!_0x33dc71[_0xaad6('0x27')][_0xaad6('0x2f')](_0xaad6('0x30'))){_0x16e2ab['limit']=qs[_0xaad6('0x19')](_0x33dc71[_0xaad6('0x27')][_0xaad6('0x19')]);_0x16e2ab[_0xaad6('0x18')]=qs[_0xaad6('0x18')](_0x33dc71[_0xaad6('0x27')][_0xaad6('0x18')]);}_0x16e2ab['order']=qs['sort'](_0x33dc71['query'][_0xaad6('0x31')]);_0x16e2ab[_0xaad6('0x32')]=qs[_0xaad6('0x29')](_[_0xaad6('0x33')](_0x33dc71[_0xaad6('0x27')],_0x82b3a6[_0xaad6('0x29')]));if(_0xac48c9[_0xaad6('0x34')]){if(_0xac48c9['dateEnd']){_0xac48c9[_0xaad6('0x28')]=moment(_0xac48c9['dateEnd'])[_0xaad6('0x35')](0x1,_0xaad6('0x36'));}else{_0xac48c9[_0xaad6('0x28')]=moment(_0xac48c9['dateStart'])[_0xaad6('0x35')](0x1,_0xaad6('0x36'));}_[_0xaad6('0x37')](_0x16e2ab[_0xaad6('0x32')],{'createdAt':{'$gte':_0xac48c9[_0xaad6('0x34')],'$lte':_0xac48c9[_0xaad6('0x28')]}});}if(_0x33dc71[_0xaad6('0x27')][_0xaad6('0x38')]){_0x16e2ab[_0xaad6('0x32')]=_[_0xaad6('0x37')](_0x16e2ab[_0xaad6('0x32')],{'$or':_[_0xaad6('0x39')](_0x16e2ab[_0xaad6('0x2d')],function(_0x3a4170){var _0x3df763={};_0x3df763[_0x3a4170]={'$like':'%'+_0x33dc71['query'][_0xaad6('0x38')]+'%'};return _0x3df763;})});}_0x16e2ab=_[_0xaad6('0x37')]({},_0x16e2ab,_0x33dc71[_0xaad6('0x3a')]);var _0xc806b={'where':_0x16e2ab[_0xaad6('0x32')]};return db[_0xaad6('0x24')][_0xaad6('0x17')](_0xc806b)[_0xaad6('0x1f')](function(_0x377d42){_0x21c823[_0xaad6('0x17')]=_0x377d42;if(_0x33dc71[_0xaad6('0x27')][_0xaad6('0x3b')]){_0x16e2ab['include']=[{'all':!![]}];}return db[_0xaad6('0x24')][_0xaad6('0x3c')](_0x16e2ab);})[_0xaad6('0x1f')](function(_0x3fd737){_0x21c823['rows']=_0x3fd737;return _0x21c823;})[_0xaad6('0x1f')](respondWithFilteredResult(_0x5e53d2,_0x16e2ab))[_0xaad6('0x3d')](handleError(_0x5e53d2,null));};exports[_0xaad6('0x3e')]=function(_0x517d1c,_0x16729e){var _0x976fb9={'raw':![],'where':{'id':_0x517d1c[_0xaad6('0x3f')]['id']}},_0x38d3be={};_0x38d3be[_0xaad6('0x2b')]=_[_0xaad6('0x26')](db[_0xaad6('0x24')][_0xaad6('0x25')]);_0x38d3be[_0xaad6('0x27')]=_['keys'](_0x517d1c[_0xaad6('0x27')]);_0x38d3be[_0xaad6('0x29')]=_[_0xaad6('0x2a')](_0x38d3be['model'],_0x38d3be[_0xaad6('0x27')]);_0x976fb9[_0xaad6('0x2d')]=_[_0xaad6('0x2a')](_0x38d3be[_0xaad6('0x2b')],qs[_0xaad6('0x2c')](_0x517d1c['query'][_0xaad6('0x2c')]));_0x976fb9[_0xaad6('0x2d')]=_0x976fb9[_0xaad6('0x2d')][_0xaad6('0x2e')]?_0x976fb9[_0xaad6('0x2d')]:_0x38d3be[_0xaad6('0x2b')];if(_0x517d1c[_0xaad6('0x27')][_0xaad6('0x3b')]){_0x976fb9[_0xaad6('0x40')]=[{'all':!![]}];}_0x976fb9=_[_0xaad6('0x37')]({},_0x976fb9,_0x517d1c[_0xaad6('0x3a')]);return db['VoiceChanSpy']['find'](_0x976fb9)[_0xaad6('0x1f')](handleEntityNotFound(_0x16729e,null))[_0xaad6('0x1f')](respondWithResult(_0x16729e,null))['catch'](handleError(_0x16729e,null));};exports[_0xaad6('0x41')]=function(_0x194b78,_0x2c8407){return db[_0xaad6('0x24')]['create'](_0x194b78['body'],{})['then'](respondWithResult(_0x2c8407,0xc9))[_0xaad6('0x3d')](handleError(_0x2c8407,null));};exports['update']=function(_0x4b28d3,_0x4496e2){if(_0x4b28d3[_0xaad6('0x42')]['id']){delete _0x4b28d3[_0xaad6('0x42')]['id'];}return db[_0xaad6('0x24')][_0xaad6('0x43')]({'where':{'id':_0x4b28d3[_0xaad6('0x3f')]['id']}})[_0xaad6('0x1f')](handleEntityNotFound(_0x4496e2,null))[_0xaad6('0x1f')](saveUpdates(_0x4b28d3[_0xaad6('0x42')],null))['then'](respondWithResult(_0x4496e2,null))[_0xaad6('0x3d')](handleError(_0x4496e2,null));};exports[_0xaad6('0x44')]=function(_0x173ca0,_0x49ba88){return db[_0xaad6('0x24')][_0xaad6('0x43')]({'where':{'id':_0x173ca0['params']['id']}})[_0xaad6('0x1f')](handleEntityNotFound(_0x49ba88,null))[_0xaad6('0x1f')](removeEntity(_0x49ba88,null))[_0xaad6('0x3d')](handleError(_0x49ba88,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 99dc7fe..c81ec9c 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 _0x2402=['api','./voiceChanSpy.attributes','from-sip','system','format','%s%s','push','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','merge','Authenticate','password','ChanSpy','name','join','StopMixMonitor','length','concat','User','findAll','internal','agent','then','models','define','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','../../config/logger'];(function(_0x3e2053,_0x4e3625){var _0x5f4dbf=function(_0x4459bb){while(--_0x4459bb){_0x3e2053['push'](_0x3e2053['shift']());}};_0x5f4dbf(++_0x4e3625);}(_0x2402,0xbf));var _0x2240=function(_0xa68da3,_0x59c382){_0xa68da3=_0xa68da3-0x0;var _0x40738b=_0x2402[_0xa68da3];return _0x40738b;};'use strict';var _=require(_0x2240('0x0'));var util=require(_0x2240('0x1'));var BPromise=require(_0x2240('0x2'));var logger=require(_0x2240('0x3'))(_0x2240('0x4'));var attributes=require(_0x2240('0x5'));var getUserApplications=function(_0x366a0d,_0xbef83a,_0x148c74){var _0x22181f=0x1;var _0x12ab15=[];var _0x3b33df={'context':_0x2240('0x6'),'type':_0x2240('0x7'),'isApp':![]};var _0x54e7fd={'exten':util[_0x2240('0x8')](_0x2240('0x9'),_0x366a0d['prefix'],_0x148c74),'ChanSpyId':_0x366a0d['id'],'UserId':_0xbef83a['id']};_0x12ab15[_0x2240('0xa')](_['merge']({'app':_0x2240('0xb'),'appdata':util[_0x2240('0x8')](_0x2240('0xc'),_0x2240('0xd')),'priority':_0x22181f++},_0x3b33df,_0x54e7fd));if(_0x366a0d[_0x2240('0xe')]){_0x12ab15[_0x2240('0xa')](_['merge']({'app':_0x2240('0xf'),'appdata':util['format'](_0x2240('0x10'),_0x366a0d[_0x2240('0x11')]),'priority':_0x22181f++},_0x3b33df,_0x54e7fd));}if(_0x366a0d[_0x2240('0x12')]){_0x12ab15[_0x2240('0xa')](_[_0x2240('0x13')]({'app':_0x2240('0x14'),'appdata':_0x366a0d[_0x2240('0x15')],'priority':_0x22181f++},_0x3b33df,_0x54e7fd));}_0x12ab15[_0x2240('0xa')](_['merge']({'app':_0x2240('0x16'),'appdata':util['format']('SIP/%s,%s',_0xbef83a[_0x2240('0x17')],_0x366a0d['options']?_0x366a0d['options'][_0x2240('0x18')](''):''),'priority':_0x22181f++},_0x3b33df,_0x54e7fd));if(_0x366a0d[_0x2240('0xe')]){_0x12ab15[_0x2240('0xa')](_['merge']({'app':_0x2240('0x19'),'priority':_0x22181f++},_0x3b33df,_0x54e7fd));}return _0x12ab15;};var getChanSpyApplications=function(_0x9e2828,_0x33a326){var _0x5dd379=[];for(var _0x1627c0=0x0,_0x2b418e=0x1;_0x1627c0<_0x33a326[_0x2240('0x1a')];_0x1627c0++,_0x2b418e=0x1){var _0x11abe9=getUserApplications(_0x9e2828,_0x33a326[_0x1627c0],_0x33a326[_0x1627c0]['internal']);var _0xc5431b=getUserApplications(_0x9e2828,_0x33a326[_0x1627c0],_0x33a326[_0x1627c0][_0x2240('0x17')]);_0x5dd379=_0x5dd379[_0x2240('0x1b')](_0x11abe9,_0xc5431b);}return _0x5dd379;};var getChanSpyPromise=function(_0x440aa5,_0x1e62ea){return new BPromise(function(_0x253900,_0x27af70){return _0x440aa5[_0x2240('0x1c')][_0x2240('0x1d')]({'attributes':['id',_0x2240('0x17'),_0x2240('0x1e')],'where':{'role':_0x2240('0x1f'),'chanspy':!![]},'raw':!![]})[_0x2240('0x20')](function(_0x1d8bfb){if(_0x1d8bfb){return _0x253900(getChanSpyApplications(_0x1e62ea,_0x1d8bfb));}return _0x253900([]);})['catch'](function(_0x3a48a2){_0x27af70(_0x3a48a2);});});};module['exports']=function(_0x274292,_0x48ffe4){var _0x1c3e62=_0x274292[_0x2240('0x21')];return _0x274292[_0x2240('0x22')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bc046,_0x4748a9,_0xc3c8fa){return getChanSpyPromise(_0x1c3e62,_0x2bc046)[_0x2240('0x20')](function(_0x62e06c){if(_0x62e06c&&_0x62e06c['length']){return _0x1c3e62['VoiceExtension']['bulkCreate'](_0x62e06c);}})['then'](function(){_0xc3c8fa();})['catch'](function(_0xd6d595){_0xc3c8fa(_0xd6d595);});},'afterUpdate':function(_0x5ccdf7,_0x1a0634,_0xd49eb7){return _0x1c3e62[_0x2240('0x23')]['destroy']({'where':{'ChanSpyId':_0x5ccdf7['id']}})[_0x2240('0x20')](function(){return getChanSpyPromise(_0x1c3e62,_0x5ccdf7);})['then'](function(_0x45190a){if(_0x45190a&&_0x45190a[_0x2240('0x1a')]){return _0x1c3e62['VoiceExtension'][_0x2240('0x24')](_0x45190a);}})[_0x2240('0x20')](function(){_0xd49eb7();})[_0x2240('0x25')](function(_0x4529cc){_0xd49eb7(_0x4529cc);});},'afterDestroy':function(_0x6c68f7,_0x18c3e5,_0x1a33e6){return _0x1c3e62[_0x2240('0x23')][_0x2240('0x26')]({'where':{'ChanSpyId':_0x6c68f7['id']}})[_0x2240('0x20')](function(){_0x1a33e6();})[_0x2240('0x25')](function(_0x1b172d){_0x1a33e6(_0x1b172d);});}}});}; \ No newline at end of file +var _0xccdb=['push','merge','Set','CDR(type)=%s','record','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','internal','concat','User','findAll','agent','catch','exports','models','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','system','format','%s%s','prefix'];(function(_0x224116,_0x319a4b){var _0x2fab3d=function(_0x21dd58){while(--_0x21dd58){_0x224116['push'](_0x224116['shift']());}};_0x2fab3d(++_0x319a4b);}(_0xccdb,0x90));var _0xbccd=function(_0x9de881,_0x449354){_0x9de881=_0x9de881-0x0;var _0x4d29d7=_0xccdb[_0x9de881];return _0x4d29d7;};'use strict';var _=require(_0xbccd('0x0'));var util=require(_0xbccd('0x1'));var BPromise=require(_0xbccd('0x2'));var logger=require('../../config/logger')('api');var attributes=require(_0xbccd('0x3'));var getUserApplications=function(_0x23064a,_0xf3a2f1,_0x2af1b0){var _0x5e8b42=0x1;var _0x106a33=[];var _0x1dbeba={'context':'from-sip','type':_0xbccd('0x4'),'isApp':![]};var _0x3fe658={'exten':util[_0xbccd('0x5')](_0xbccd('0x6'),_0x23064a[_0xbccd('0x7')],_0x2af1b0),'ChanSpyId':_0x23064a['id'],'UserId':_0xf3a2f1['id']};_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0xa'),'appdata':util[_0xbccd('0x5')](_0xbccd('0xb'),'chanspy'),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));if(_0x23064a[_0xbccd('0xc')]){_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0xd'),'appdata':util[_0xbccd('0x5')](_0xbccd('0xe'),_0x23064a[_0xbccd('0xf')]),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}if(_0x23064a[_0xbccd('0x10')]){_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0x11'),'appdata':_0x23064a['password'],'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}_0x106a33[_0xbccd('0x8')](_[_0xbccd('0x9')]({'app':_0xbccd('0x12'),'appdata':util[_0xbccd('0x5')](_0xbccd('0x13'),_0xf3a2f1[_0xbccd('0x14')],_0x23064a[_0xbccd('0x15')]?_0x23064a['options'][_0xbccd('0x16')](''):''),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));if(_0x23064a['record']){_0x106a33[_0xbccd('0x8')](_['merge']({'app':_0xbccd('0x17'),'priority':_0x5e8b42++},_0x1dbeba,_0x3fe658));}return _0x106a33;};var getChanSpyApplications=function(_0x2eaf37,_0x954356){var _0xf8e90e=[];for(var _0x2c4a66=0x0,_0x5556d3=0x1;_0x2c4a66<_0x954356[_0xbccd('0x18')];_0x2c4a66++,_0x5556d3=0x1){var _0x2b0127=getUserApplications(_0x2eaf37,_0x954356[_0x2c4a66],_0x954356[_0x2c4a66][_0xbccd('0x19')]);var _0x20e3cc=getUserApplications(_0x2eaf37,_0x954356[_0x2c4a66],_0x954356[_0x2c4a66][_0xbccd('0x14')]);_0xf8e90e=_0xf8e90e[_0xbccd('0x1a')](_0x2b0127,_0x20e3cc);}return _0xf8e90e;};var getChanSpyPromise=function(_0x4b1fd7,_0x45cc0c){return new BPromise(function(_0x1abfcd,_0x6903be){return _0x4b1fd7[_0xbccd('0x1b')][_0xbccd('0x1c')]({'attributes':['id','name',_0xbccd('0x19')],'where':{'role':_0xbccd('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x2bed07){if(_0x2bed07){return _0x1abfcd(getChanSpyApplications(_0x45cc0c,_0x2bed07));}return _0x1abfcd([]);})[_0xbccd('0x1e')](function(_0x58d120){_0x6903be(_0x58d120);});});};module[_0xbccd('0x1f')]=function(_0x396ca8,_0xb3384c){var _0x3ff310=_0x396ca8[_0xbccd('0x20')];return _0x396ca8['define']('VoiceChanSpy',attributes,{'tableName':_0xbccd('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x26a9c8,_0x4d14f8,_0x5825bd){return getChanSpyPromise(_0x3ff310,_0x26a9c8)[_0xbccd('0x22')](function(_0x4f9330){if(_0x4f9330&&_0x4f9330[_0xbccd('0x18')]){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x24')](_0x4f9330);}})['then'](function(){_0x5825bd();})['catch'](function(_0x5df040){_0x5825bd(_0x5df040);});},'afterUpdate':function(_0x23d3c6,_0x124581,_0x451845){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x25')]({'where':{'ChanSpyId':_0x23d3c6['id']}})['then'](function(){return getChanSpyPromise(_0x3ff310,_0x23d3c6);})[_0xbccd('0x22')](function(_0xa3cb6b){if(_0xa3cb6b&&_0xa3cb6b[_0xbccd('0x18')]){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x24')](_0xa3cb6b);}})[_0xbccd('0x22')](function(){_0x451845();})['catch'](function(_0x4d286a){_0x451845(_0x4d286a);});},'afterDestroy':function(_0x28fda0,_0x985a74,_0x53f44f){return _0x3ff310[_0xbccd('0x23')][_0xbccd('0x25')]({'where':{'ChanSpyId':_0x28fda0['id']}})[_0xbccd('0x22')](function(){_0x53f44f();})['catch'](function(_0x57325a){_0x53f44f(_0x57325a);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 1ba7d0f..677bcce 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 _0x0b3d=['info','request\x20sent','debug','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','../../config/utils','rpc','jayson/promise','client','request'];(function(_0xf8f929,_0xdceffc){var _0x449d84=function(_0x49273f){while(--_0x49273f){_0xf8f929['push'](_0xf8f929['shift']());}};_0x449d84(++_0xdceffc);}(_0x0b3d,0x76));var _0xd0b3=function(_0x36d14b,_0x1ba5eb){_0x36d14b=_0x36d14b-0x0;var _0x4be643=_0x0b3d[_0x36d14b];return _0x4be643;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var moment=require(_0xd0b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0b3('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xd0b3('0x3'));var logger=require('../../config/logger')(_0xd0b3('0x4'));var config=require('../../config/environment');var jayson=require(_0xd0b3('0x5'));var client=jayson[_0xd0b3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2968c9,_0x5bc883,_0x872957){return new BPromise(function(_0x5f3196,_0x5ab5b2){return client[_0xd0b3('0x7')](_0x2968c9,_0x872957)['then'](function(_0x4b9680){logger[_0xd0b3('0x8')]('VoiceChanSpy,\x20%s,\x20%s',_0x5bc883,_0xd0b3('0x9'));logger[_0xd0b3('0xa')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x5bc883,'request\x20sent',JSON[_0xd0b3('0xb')](_0x4b9680));if(_0x4b9680[_0xd0b3('0xc')]){if(_0x4b9680[_0xd0b3('0xc')][_0xd0b3('0xd')]===0x1f4){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x5bc883,_0x4b9680[_0xd0b3('0xc')][_0xd0b3('0xe')]);return _0x5ab5b2(_0x4b9680[_0xd0b3('0xc')][_0xd0b3('0xe')]);}logger[_0xd0b3('0xc')](_0xd0b3('0xf'),_0x5bc883,_0x4b9680[_0xd0b3('0xc')]['message']);return _0x5f3196(_0x4b9680[_0xd0b3('0xc')][_0xd0b3('0xe')]);}else{logger[_0xd0b3('0x8')](_0xd0b3('0xf'),_0x5bc883,'request\x20sent');_0x5f3196(_0x4b9680[_0xd0b3('0x10')][_0xd0b3('0xe')]);}})[_0xd0b3('0x11')](function(_0x51dbc8){logger[_0xd0b3('0xc')](_0xd0b3('0xf'),_0x5bc883,_0x51dbc8);_0x5ab5b2(_0x51dbc8);});});} \ No newline at end of file +var _0x5302=['rpc','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','../../config/utils'];(function(_0xb541ac,_0x140813){var _0x4a159f=function(_0x3b2d8d){while(--_0x3b2d8d){_0xb541ac['push'](_0xb541ac['shift']());}};_0x4a159f(++_0x140813);}(_0x5302,0x1b5));var _0x2530=function(_0x2355a4,_0xc0b80d){_0x2355a4=_0x2355a4-0x0;var _0xe22dd=_0x5302[_0x2355a4];return _0xe22dd;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2530('0x0'));var BPromise=require(_0x2530('0x1'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x2530('0x2'));var logger=require('../../config/logger')(_0x2530('0x3'));var config=require('../../config/environment');var jayson=require(_0x2530('0x4'));var client=jayson[_0x2530('0x5')][_0x2530('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x14ca82,_0x9f762,_0x574655){return new BPromise(function(_0x306dd4,_0x3d75d0){return client[_0x2530('0x7')](_0x14ca82,_0x574655)[_0x2530('0x8')](function(_0x3f7422){logger[_0x2530('0x9')](_0x2530('0xa'),_0x9f762,_0x2530('0xb'));logger[_0x2530('0xc')](_0x2530('0xd'),_0x9f762,_0x2530('0xb'),JSON[_0x2530('0xe')](_0x3f7422));if(_0x3f7422[_0x2530('0xf')]){if(_0x3f7422[_0x2530('0xf')][_0x2530('0x10')]===0x1f4){logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x3f7422['error'][_0x2530('0x11')]);return _0x3d75d0(_0x3f7422[_0x2530('0xf')][_0x2530('0x11')]);}logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x3f7422[_0x2530('0xf')][_0x2530('0x11')]);return _0x306dd4(_0x3f7422['error']['message']);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x9f762,_0x2530('0xb'));_0x306dd4(_0x3f7422[_0x2530('0x12')]['message']);}})[_0x2530('0x13')](function(_0x2bc155){logger[_0x2530('0xf')](_0x2530('0xa'),_0x9f762,_0x2bc155);_0x3d75d0(_0x2bc155);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4879061..f27cf9a 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 _0xf089=['index','get','/:id','post','create','update','delete','destroy','exports','multer','Router','../../config/environment','./voiceContext.controller','isAuthenticated'];(function(_0x2f7272,_0x46ab4a){var _0x3b7d7d=function(_0x300430){while(--_0x300430){_0x2f7272['push'](_0x2f7272['shift']());}};_0x3b7d7d(++_0x46ab4a);}(_0xf089,0x191));var _0x9f08=function(_0xbafaf9,_0x14aa72){_0xbafaf9=_0xbafaf9-0x0;var _0x435c28=_0xf089[_0xbafaf9];return _0x435c28;};'use strict';var multer=require(_0x9f08('0x0'));var util=require('util');var path=require('path');var express=require('express');var router=express[_0x9f08('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f08('0x2'));var controller=require(_0x9f08('0x3'));router['get']('/',auth[_0x9f08('0x4')](),controller[_0x9f08('0x5')]);router[_0x9f08('0x6')](_0x9f08('0x7'),auth[_0x9f08('0x4')](),controller['show']);router[_0x9f08('0x8')]('/',auth['isAuthenticated'](),controller[_0x9f08('0x9')]);router['put'](_0x9f08('0x7'),auth['isAuthenticated'](),controller[_0x9f08('0xa')]);router[_0x9f08('0xb')](_0x9f08('0x7'),auth[_0x9f08('0x4')](),controller[_0x9f08('0xc')]);module[_0x9f08('0xd')]=router; \ No newline at end of file +var _0xd8b6=['util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','show','put','update','delete','destroy','exports','multer'];(function(_0x2c99cf,_0x3b58c8){var _0x3388cd=function(_0x3a31d9){while(--_0x3a31d9){_0x2c99cf['push'](_0x2c99cf['shift']());}};_0x3388cd(++_0x3b58c8);}(_0xd8b6,0x10d));var _0x6d8b=function(_0x36ece1,_0x9e1dc7){_0x36ece1=_0x36ece1-0x0;var _0x10b964=_0xd8b6[_0x36ece1];return _0x10b964;};'use strict';var multer=require(_0x6d8b('0x0'));var util=require(_0x6d8b('0x1'));var path=require('path');var express=require(_0x6d8b('0x2'));var router=express['Router']();var auth=require(_0x6d8b('0x3'));var interaction=require(_0x6d8b('0x4'));var config=require(_0x6d8b('0x5'));var controller=require(_0x6d8b('0x6'));router['get']('/',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0x8')]);router['get']('/:id',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0x9')]);router['post']('/',auth[_0x6d8b('0x7')](),controller['create']);router[_0x6d8b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6d8b('0xb')]);router[_0x6d8b('0xc')]('/:id',auth[_0x6d8b('0x7')](),controller[_0x6d8b('0xd')]);module[_0x6d8b('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 0c158cb..a9631ca 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 _0x722b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x11e148,_0x2aeb53){var _0x392324=function(_0x24cc05){while(--_0x24cc05){_0x11e148['push'](_0x11e148['shift']());}};_0x392324(++_0x2aeb53);}(_0x722b,0x16e));var _0xb722=function(_0xafa7eb,_0x39a0c5){_0xafa7eb=_0xafa7eb-0x0;var _0x571ddc=_0x722b[_0xafa7eb];return _0x571ddc;};'use strict';var Sequelize=require(_0xb722('0x0'));module[_0xb722('0x1')]={'name':{'type':Sequelize[_0xb722('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xb722('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xb722('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf7e7=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0xf7e7,0x8d));var _0x7f7e=function(_0x460e21,_0x2339e0){_0x460e21=_0x460e21-0x0;var _0x76f68a=_0xf7e7[_0x460e21];return _0x76f68a;};'use strict';var Sequelize=require(_0x7f7e('0x0'));module[_0x7f7e('0x1')]={'name':{'type':Sequelize[_0x7f7e('0x2')],'unique':_0x7f7e('0x3')},'description':{'type':Sequelize[_0x7f7e('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7f7e('0x4')],'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 2f1de84..affe8f6 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 _0x1af2=['VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','limit','apply','reject','update','then','destroy','stack','name','send','VoiceContext','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','sort','day','add','merge','where','map','filter','options','count','includeAll','include','findAll','rows','show','params','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','render','Reload','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xc7b40c,_0x34c13d){var _0x10ede3=function(_0x2a2273){while(--_0x2a2273){_0xc7b40c['push'](_0xc7b40c['shift']());}};_0x10ede3(++_0x34c13d);}(_0x1af2,0x192));var _0x21af=function(_0x16aa70,_0x5b1f73){_0x16aa70=_0x16aa70-0x0;var _0x11875f=_0x1af2[_0x16aa70];return _0x11875f;};'use strict';var jsonpatch=require(_0x21af('0x0'));var rp=require(_0x21af('0x1'));var moment=require(_0x21af('0x2'));var BPromise=require(_0x21af('0x3'));var Mustache=require(_0x21af('0x4'));var util=require(_0x21af('0x5'));var path=require('path');var sox=require(_0x21af('0x6'));var csv=require(_0x21af('0x7'));var ejs=require(_0x21af('0x8'));var fs=require('fs');var _=require(_0x21af('0x9'));var squel=require(_0x21af('0xa'));var crypto=require(_0x21af('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x21af('0xc'));var toCsv=require(_0x21af('0x7'));var querystring=require('querystring');var Papa=require(_0x21af('0xd'));var qs=require(_0x21af('0xe'));var logger=require(_0x21af('0xf'))(_0x21af('0x10'));var utils=require(_0x21af('0x11'));var config=require(_0x21af('0x12'));var db=require('../../mysqldb')['db'];var jayson=require(_0x21af('0x13'));var client=jayson[_0x21af('0x14')][_0x21af('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x2a30b3,_0x2e0f33,_0x52a647,_0x5872d2){return new BPromise(function(_0x3e9a1a,_0x500f43){var _0x1acbee=_0x5872d2||client;return _0x1acbee[_0x21af('0x16')](_0x2a30b3,_0x52a647)['then'](function(_0x58e517){logger['info']('VoiceContext,\x20%s,\x20%s',_0x2e0f33,_0x21af('0x17'));logger['debug'](_0x21af('0x18'),_0x2e0f33,_0x21af('0x17'),JSON[_0x21af('0x19')](_0x58e517));if(_0x58e517[_0x21af('0x1a')]){if(_0x58e517[_0x21af('0x1a')][_0x21af('0x1b')]===0x1f4){logger[_0x21af('0x1a')](_0x21af('0x1c'),_0x2e0f33,_0x58e517['error'][_0x21af('0x1d')]);return _0x500f43(_0x58e517[_0x21af('0x1a')]['message']);}logger[_0x21af('0x1a')](_0x21af('0x1c'),_0x2e0f33,_0x58e517['error'][_0x21af('0x1d')]);return _0x3e9a1a(_0x58e517[_0x21af('0x1a')][_0x21af('0x1d')]);}else{logger['info'](_0x21af('0x1c'),_0x2e0f33,_0x21af('0x17'));_0x3e9a1a(_0x58e517[_0x21af('0x1e')][_0x21af('0x1d')]);}})[_0x21af('0x1f')](function(_0x202b1b){logger[_0x21af('0x1a')](_0x21af('0x1c'),_0x2e0f33,_0x202b1b);_0x500f43(_0x202b1b);});});}function respondWithStatusCode(_0x210cb8,_0x19fcaa){_0x19fcaa=_0x19fcaa||0xcc;return function(_0x1eea42){if(_0x1eea42){return _0x210cb8[_0x21af('0x20')](_0x19fcaa);}return _0x210cb8[_0x21af('0x21')](_0x19fcaa)[_0x21af('0x22')]();};}function respondWithResult(_0x1a6906,_0x41ab97){_0x41ab97=_0x41ab97||0xc8;return function(_0x26fd67){if(_0x26fd67){return _0x1a6906[_0x21af('0x21')](_0x41ab97)[_0x21af('0x23')](_0x26fd67);}};}function respondWithFilteredResult(_0xef88a2,_0x17697b){return function(_0x843492){if(_0x843492){var _0x5f547c=_0x843492['count'],_0x445c28=_0x17697b['offset'],_0x30f973=_0x17697b[_0x21af('0x24')]+_0x17697b[_0x21af('0x25')],_0x13f13a;if(_0x30f973>=_0x5f547c){_0x30f973=_0x5f547c;_0x13f13a=0xc8;}else{_0x13f13a=0xce;}_0xef88a2[_0x21af('0x21')](_0x13f13a);return _0xef88a2['set']('Content-Range',_0x445c28+'-'+_0x30f973+'/'+_0x5f547c)['json'](_0x843492);}return null;};}function patchUpdates(_0x2a7fb0){return function(_0x137b2a){try{jsonpatch[_0x21af('0x26')](_0x137b2a,_0x2a7fb0,!![]);}catch(_0x174098){return BPromise[_0x21af('0x27')](_0x174098);}return _0x137b2a['save']();};}function saveUpdates(_0x329af3,_0x464619){return function(_0xa10e10){if(_0xa10e10){return _0xa10e10[_0x21af('0x28')](_0x329af3)[_0x21af('0x29')](function(_0x426fbe){return _0x426fbe;});}return null;};}function removeEntity(_0x49e8de,_0x3981fa){return function(_0x551091){if(_0x551091){return _0x551091[_0x21af('0x2a')]()[_0x21af('0x29')](function(){_0x49e8de[_0x21af('0x21')](0xcc)[_0x21af('0x22')]();});}};}function handleEntityNotFound(_0x1adc63,_0xa379d3){return function(_0x4d085a){if(!_0x4d085a){_0x1adc63['sendStatus'](0x194);}return _0x4d085a;};}function handleError(_0xa6da29,_0x3ca233){_0x3ca233=_0x3ca233||0x1f4;return function(_0x9d0d72){logger['error'](_0x9d0d72[_0x21af('0x2b')]);if(_0x9d0d72[_0x21af('0x2c')]){delete _0x9d0d72[_0x21af('0x2c')];}_0xa6da29[_0x21af('0x21')](_0x3ca233)[_0x21af('0x2d')](_0x9d0d72);};}exports['index']=function(_0x1fe758,_0x39f1e8){var _0x118225={},_0x5b7c49={},_0x2ebc4f={'count':0x0,'rows':[]};var _0x2f0013=db[_0x21af('0x2e')][_0x21af('0x2f')];_0x5b7c49[_0x21af('0x30')]=_[_0x21af('0x31')](_0x2f0013);var _0x242f68={'dateStart':_0x1fe758[_0x21af('0x32')][_0x21af('0x33')],'dateEnd':_0x1fe758['query'][_0x21af('0x34')]};delete _0x1fe758[_0x21af('0x32')][_0x21af('0x33')];delete _0x1fe758[_0x21af('0x32')][_0x21af('0x34')];_0x5b7c49['query']=_[_0x21af('0x31')](_0x1fe758['query']);_0x5b7c49[_0x21af('0x35')]=_[_0x21af('0x36')](_0x5b7c49[_0x21af('0x30')],_0x5b7c49[_0x21af('0x32')]);_0x118225[_0x21af('0x37')]=_['intersection'](_0x5b7c49[_0x21af('0x30')],qs[_0x21af('0x38')](_0x1fe758[_0x21af('0x32')][_0x21af('0x38')]));_0x118225[_0x21af('0x37')]=_0x118225[_0x21af('0x37')][_0x21af('0x39')]?_0x118225[_0x21af('0x37')]:_0x5b7c49[_0x21af('0x30')];if(!_0x1fe758['query'][_0x21af('0x3a')]('nolimit')){_0x118225[_0x21af('0x25')]=qs['limit'](_0x1fe758[_0x21af('0x32')][_0x21af('0x25')]);_0x118225[_0x21af('0x24')]=qs['offset'](_0x1fe758[_0x21af('0x32')][_0x21af('0x24')]);}_0x118225['order']=qs[_0x21af('0x3b')](_0x1fe758['query'][_0x21af('0x3b')]);_0x118225['where']=qs[_0x21af('0x35')](_['pick'](_0x1fe758['query'],_0x5b7c49[_0x21af('0x35')]));if(_0x242f68['dateStart']){if(_0x242f68[_0x21af('0x34')]){_0x242f68[_0x21af('0x34')]=moment(_0x242f68['dateEnd'])['add'](0x1,_0x21af('0x3c'));}else{_0x242f68['dateEnd']=moment(_0x242f68[_0x21af('0x33')])[_0x21af('0x3d')](0x1,'day');}_[_0x21af('0x3e')](_0x118225[_0x21af('0x3f')],{'createdAt':{'$gte':_0x242f68[_0x21af('0x33')],'$lte':_0x242f68[_0x21af('0x34')]}});}if(_0x1fe758[_0x21af('0x32')]['filter']){_0x118225['where']=_[_0x21af('0x3e')](_0x118225['where'],{'$or':_[_0x21af('0x40')](_0x118225[_0x21af('0x37')],function(_0x5b0be3){var _0x35eafe={};_0x35eafe[_0x5b0be3]={'$like':'%'+_0x1fe758[_0x21af('0x32')][_0x21af('0x41')]+'%'};return _0x35eafe;})});}_0x118225=_[_0x21af('0x3e')]({},_0x118225,_0x1fe758[_0x21af('0x42')]);var _0x15d769={'where':_0x118225['where']};return db[_0x21af('0x2e')]['count'](_0x15d769)[_0x21af('0x29')](function(_0x4bd5bf){_0x2ebc4f[_0x21af('0x43')]=_0x4bd5bf;if(_0x1fe758['query'][_0x21af('0x44')]){_0x118225[_0x21af('0x45')]=[{'all':!![]}];}return db[_0x21af('0x2e')][_0x21af('0x46')](_0x118225);})[_0x21af('0x29')](function(_0x234b7c){_0x2ebc4f[_0x21af('0x47')]=_0x234b7c;return _0x2ebc4f;})[_0x21af('0x29')](respondWithFilteredResult(_0x39f1e8,_0x118225))[_0x21af('0x1f')](handleError(_0x39f1e8,null));};exports[_0x21af('0x48')]=function(_0x23a84a,_0x31b476){var _0x38d382={'raw':![],'where':{'id':_0x23a84a[_0x21af('0x49')]['id']}},_0x1da0ae={};_0x1da0ae[_0x21af('0x30')]=_['keys'](db[_0x21af('0x2e')][_0x21af('0x2f')]);_0x1da0ae[_0x21af('0x32')]=_[_0x21af('0x31')](_0x23a84a[_0x21af('0x32')]);_0x1da0ae[_0x21af('0x35')]=_[_0x21af('0x36')](_0x1da0ae[_0x21af('0x30')],_0x1da0ae[_0x21af('0x32')]);_0x38d382[_0x21af('0x37')]=_[_0x21af('0x36')](_0x1da0ae['model'],qs[_0x21af('0x38')](_0x23a84a[_0x21af('0x32')][_0x21af('0x38')]));_0x38d382[_0x21af('0x37')]=_0x38d382['attributes'][_0x21af('0x39')]?_0x38d382[_0x21af('0x37')]:_0x1da0ae[_0x21af('0x30')];if(_0x23a84a['query'][_0x21af('0x44')]){_0x38d382[_0x21af('0x45')]=[{'all':!![]}];}_0x38d382=_['merge']({},_0x38d382,_0x23a84a[_0x21af('0x42')]);return db['VoiceContext'][_0x21af('0x4a')](_0x38d382)['then'](handleEntityNotFound(_0x31b476,null))[_0x21af('0x29')](respondWithResult(_0x31b476,null))[_0x21af('0x1f')](handleError(_0x31b476,null));};exports[_0x21af('0x4b')]=function(_0x1ad874,_0x5da171,_0x36bc0e){var _0x47ac3a;return db[_0x21af('0x2e')][_0x21af('0x4b')](_0x1ad874['body'],{'raw':!![]})['then'](function(_0x246cad){_0x47ac3a=_0x246cad;return db[_0x21af('0x2e')][_0x21af('0x46')]({'raw':!![]});})[_0x21af('0x29')](function(_0x2ec06e){var _0x1e5831=fs[_0x21af('0x4c')](path[_0x21af('0x4d')](config[_0x21af('0x4e')],_0x21af('0x4f')),_0x21af('0x50'));var _0x34fed2=ejs['render'](_0x1e5831,{'contexts':_0x2ec06e||[]});fs[_0x21af('0x51')](_0x21af('0x52'),_0x34fed2);})[_0x21af('0x29')](function(){return respondWithRpcPromise('Reload',_0x21af('0x4b'),{'module':_0x21af('0x53')});})[_0x21af('0x29')](function(){return _0x47ac3a;})[_0x21af('0x29')](respondWithResult(_0x5da171,0xc9))[_0x21af('0x1f')](handleError(_0x5da171,null));};exports[_0x21af('0x28')]=function(_0x5671eb,_0x304d0c,_0xdcd8f3){var _0x3a0ad6;return db[_0x21af('0x2e')]['find']({'where':{'id':_0x5671eb[_0x21af('0x49')]['id']}})[_0x21af('0x29')](handleEntityNotFound(_0x304d0c,null))[_0x21af('0x29')](saveUpdates(_0x5671eb['body'],null))[_0x21af('0x29')](function(_0x19cf6e){if(_0x19cf6e){_0x3a0ad6=_0x19cf6e;return db[_0x21af('0x2e')]['findAll']({'raw':!![]});}})[_0x21af('0x29')](function(_0x5ad90a){var _0x5703b3=fs[_0x21af('0x4c')](path['join'](config[_0x21af('0x4e')],_0x21af('0x4f')),_0x21af('0x50'));var _0x305775=ejs[_0x21af('0x54')](_0x5703b3,{'contexts':_0x5ad90a||[]});fs['writeFileSync'](_0x21af('0x52'),_0x305775);})[_0x21af('0x29')](function(){return respondWithRpcPromise('Reload',_0x21af('0x28'),{'module':_0x21af('0x53')});})[_0x21af('0x29')](function(){return _0x3a0ad6;})[_0x21af('0x29')](respondWithResult(_0x304d0c,null))[_0x21af('0x1f')](handleError(_0x304d0c,null));};exports[_0x21af('0x2a')]=function(_0x2ad17a,_0x4365f3,_0x463586){var _0x54d15a;return db[_0x21af('0x2e')]['find']({'where':{'id':_0x2ad17a['params']['id']}})['then'](handleEntityNotFound(_0x4365f3,null))[_0x21af('0x29')](removeEntity(_0x4365f3,null))[_0x21af('0x29')](function(){return db[_0x21af('0x2e')][_0x21af('0x46')]({'raw':!![]});})[_0x21af('0x29')](function(_0x4939a6){var _0x4938b1=fs[_0x21af('0x4c')](path['join'](config[_0x21af('0x4e')],_0x21af('0x4f')),_0x21af('0x50'));var _0x229c81=ejs[_0x21af('0x54')](_0x4938b1,{'contexts':_0x4939a6});fs[_0x21af('0x51')](_0x21af('0x52'),_0x229c81);return respondWithRpcPromise(_0x21af('0x55'),_0x21af('0x2a'),{'module':_0x21af('0x53')});})[_0x21af('0x1f')](handleError(_0x4365f3,null));}; \ No newline at end of file +var _0x0388=['util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../config/logger','../../config/utils','jayson/promise','client','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','status','end','count','offset','limit','set','Content-Range','json','apply','update','destroy','then','sendStatus','stack','name','VoiceContext','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','order','sort','where','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','intersection','find','body','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','create','chan_sip.so','params','readFileSync','join','root','writeFileSync','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0388,0x1a9));var _0x8038=function(_0x3c7b00,_0x38b1ae){_0x3c7b00=_0x3c7b00-0x0;var _0x2645a3=_0x0388[_0x3c7b00];return _0x2645a3;};'use strict';var jsonpatch=require(_0x8038('0x0'));var rp=require(_0x8038('0x1'));var moment=require(_0x8038('0x2'));var BPromise=require(_0x8038('0x3'));var Mustache=require(_0x8038('0x4'));var util=require(_0x8038('0x5'));var path=require(_0x8038('0x6'));var sox=require(_0x8038('0x7'));var csv=require(_0x8038('0x8'));var ejs=require(_0x8038('0x9'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x8038('0xa'));var jsforce=require(_0x8038('0xb'));var deskjs=require(_0x8038('0xc'));var toCsv=require(_0x8038('0x8'));var querystring=require(_0x8038('0xd'));var Papa=require(_0x8038('0xe'));var qs=require('../../components/parsers/qs');var logger=require(_0x8038('0xf'))('api');var utils=require(_0x8038('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var jayson=require(_0x8038('0x11'));var client=jayson[_0x8038('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3e1b10,_0x5db270,_0x34afe1,_0x300020){return new BPromise(function(_0x103652,_0x54a461){var _0x21cff1=_0x300020||client;return _0x21cff1[_0x8038('0x13')](_0x3e1b10,_0x34afe1)['then'](function(_0x313f7b){logger[_0x8038('0x14')](_0x8038('0x15'),_0x5db270,_0x8038('0x16'));logger[_0x8038('0x17')](_0x8038('0x18'),_0x5db270,_0x8038('0x16'),JSON[_0x8038('0x19')](_0x313f7b));if(_0x313f7b['error']){if(_0x313f7b[_0x8038('0x1a')][_0x8038('0x1b')]===0x1f4){logger[_0x8038('0x1a')](_0x8038('0x15'),_0x5db270,_0x313f7b[_0x8038('0x1a')]['message']);return _0x54a461(_0x313f7b['error']['message']);}logger[_0x8038('0x1a')](_0x8038('0x15'),_0x5db270,_0x313f7b[_0x8038('0x1a')][_0x8038('0x1c')]);return _0x103652(_0x313f7b[_0x8038('0x1a')][_0x8038('0x1c')]);}else{logger['info'](_0x8038('0x15'),_0x5db270,_0x8038('0x16'));_0x103652(_0x313f7b['result'][_0x8038('0x1c')]);}})['catch'](function(_0x19fa34){logger['error'](_0x8038('0x15'),_0x5db270,_0x19fa34);_0x54a461(_0x19fa34);});});}function respondWithStatusCode(_0x30c24a,_0x2050be){_0x2050be=_0x2050be||0xcc;return function(_0xac181f){if(_0xac181f){return _0x30c24a['sendStatus'](_0x2050be);}return _0x30c24a[_0x8038('0x1d')](_0x2050be)[_0x8038('0x1e')]();};}function respondWithResult(_0x164405,_0x5ccd1a){_0x5ccd1a=_0x5ccd1a||0xc8;return function(_0x88f7b1){if(_0x88f7b1){return _0x164405[_0x8038('0x1d')](_0x5ccd1a)['json'](_0x88f7b1);}};}function respondWithFilteredResult(_0x4c4e8a,_0xde5682){return function(_0x9a15ac){if(_0x9a15ac){var _0x4bbcee=_0x9a15ac[_0x8038('0x1f')],_0x371006=_0xde5682[_0x8038('0x20')],_0x56e82c=_0xde5682[_0x8038('0x20')]+_0xde5682[_0x8038('0x21')],_0x38f905;if(_0x56e82c>=_0x4bbcee){_0x56e82c=_0x4bbcee;_0x38f905=0xc8;}else{_0x38f905=0xce;}_0x4c4e8a[_0x8038('0x1d')](_0x38f905);return _0x4c4e8a[_0x8038('0x22')](_0x8038('0x23'),_0x371006+'-'+_0x56e82c+'/'+_0x4bbcee)[_0x8038('0x24')](_0x9a15ac);}return null;};}function patchUpdates(_0x3458b4){return function(_0x2e78ab){try{jsonpatch[_0x8038('0x25')](_0x2e78ab,_0x3458b4,!![]);}catch(_0x1804cb){return BPromise['reject'](_0x1804cb);}return _0x2e78ab['save']();};}function saveUpdates(_0x44fed5,_0x181660){return function(_0x32e813){if(_0x32e813){return _0x32e813[_0x8038('0x26')](_0x44fed5)['then'](function(_0x4c690f){return _0x4c690f;});}return null;};}function removeEntity(_0x595cfc,_0xd198b6){return function(_0x12d9bc){if(_0x12d9bc){return _0x12d9bc[_0x8038('0x27')]()[_0x8038('0x28')](function(){_0x595cfc[_0x8038('0x1d')](0xcc)[_0x8038('0x1e')]();});}};}function handleEntityNotFound(_0x1f43ca,_0x48c660){return function(_0x13c0b5){if(!_0x13c0b5){_0x1f43ca[_0x8038('0x29')](0x194);}return _0x13c0b5;};}function handleError(_0x213487,_0x2962bf){_0x2962bf=_0x2962bf||0x1f4;return function(_0x124679){logger[_0x8038('0x1a')](_0x124679[_0x8038('0x2a')]);if(_0x124679[_0x8038('0x2b')]){delete _0x124679['name'];}_0x213487['status'](_0x2962bf)['send'](_0x124679);};}exports['index']=function(_0x4ccecd,_0x1e4d0a){var _0xb1a446={},_0x32c8eb={},_0x428481={'count':0x0,'rows':[]};var _0x103038=db[_0x8038('0x2c')][_0x8038('0x2d')];_0x32c8eb[_0x8038('0x2e')]=_[_0x8038('0x2f')](_0x103038);var _0x44418c={'dateStart':_0x4ccecd[_0x8038('0x30')][_0x8038('0x31')],'dateEnd':_0x4ccecd['query'][_0x8038('0x32')]};delete _0x4ccecd[_0x8038('0x30')][_0x8038('0x31')];delete _0x4ccecd[_0x8038('0x30')][_0x8038('0x32')];_0x32c8eb['query']=_[_0x8038('0x2f')](_0x4ccecd[_0x8038('0x30')]);_0x32c8eb[_0x8038('0x33')]=_['intersection'](_0x32c8eb[_0x8038('0x2e')],_0x32c8eb[_0x8038('0x30')]);_0xb1a446[_0x8038('0x34')]=_['intersection'](_0x32c8eb[_0x8038('0x2e')],qs[_0x8038('0x35')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x35')]));_0xb1a446[_0x8038('0x34')]=_0xb1a446[_0x8038('0x34')][_0x8038('0x36')]?_0xb1a446[_0x8038('0x34')]:_0x32c8eb['model'];if(!_0x4ccecd['query'][_0x8038('0x37')]('nolimit')){_0xb1a446[_0x8038('0x21')]=qs[_0x8038('0x21')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x21')]);_0xb1a446[_0x8038('0x20')]=qs[_0x8038('0x20')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x20')]);}_0xb1a446[_0x8038('0x38')]=qs[_0x8038('0x39')](_0x4ccecd[_0x8038('0x30')][_0x8038('0x39')]);_0xb1a446[_0x8038('0x3a')]=qs[_0x8038('0x33')](_['pick'](_0x4ccecd[_0x8038('0x30')],_0x32c8eb[_0x8038('0x33')]));if(_0x44418c[_0x8038('0x31')]){if(_0x44418c['dateEnd']){_0x44418c[_0x8038('0x32')]=moment(_0x44418c[_0x8038('0x32')])['add'](0x1,_0x8038('0x3b'));}else{_0x44418c[_0x8038('0x32')]=moment(_0x44418c[_0x8038('0x31')])[_0x8038('0x3c')](0x1,_0x8038('0x3b'));}_[_0x8038('0x3d')](_0xb1a446[_0x8038('0x3a')],{'createdAt':{'$gte':_0x44418c[_0x8038('0x31')],'$lte':_0x44418c[_0x8038('0x32')]}});}if(_0x4ccecd[_0x8038('0x30')][_0x8038('0x3e')]){_0xb1a446['where']=_[_0x8038('0x3d')](_0xb1a446[_0x8038('0x3a')],{'$or':_[_0x8038('0x3f')](_0xb1a446[_0x8038('0x34')],function(_0x31fbba){var _0x26e27e={};_0x26e27e[_0x31fbba]={'$like':'%'+_0x4ccecd[_0x8038('0x30')][_0x8038('0x3e')]+'%'};return _0x26e27e;})});}_0xb1a446=_[_0x8038('0x3d')]({},_0xb1a446,_0x4ccecd[_0x8038('0x40')]);var _0x402d04={'where':_0xb1a446[_0x8038('0x3a')]};return db['VoiceContext']['count'](_0x402d04)[_0x8038('0x28')](function(_0x243141){_0x428481[_0x8038('0x1f')]=_0x243141;if(_0x4ccecd['query'][_0x8038('0x41')]){_0xb1a446[_0x8038('0x42')]=[{'all':!![]}];}return db[_0x8038('0x2c')][_0x8038('0x43')](_0xb1a446);})[_0x8038('0x28')](function(_0x1a29fd){_0x428481[_0x8038('0x44')]=_0x1a29fd;return _0x428481;})[_0x8038('0x28')](respondWithFilteredResult(_0x1e4d0a,_0xb1a446))[_0x8038('0x45')](handleError(_0x1e4d0a,null));};exports[_0x8038('0x46')]=function(_0x3023d3,_0x5df101){var _0x35db1b={'raw':![],'where':{'id':_0x3023d3['params']['id']}},_0x270fab={};_0x270fab[_0x8038('0x2e')]=_['keys'](db[_0x8038('0x2c')][_0x8038('0x2d')]);_0x270fab[_0x8038('0x30')]=_[_0x8038('0x2f')](_0x3023d3[_0x8038('0x30')]);_0x270fab[_0x8038('0x33')]=_[_0x8038('0x47')](_0x270fab[_0x8038('0x2e')],_0x270fab[_0x8038('0x30')]);_0x35db1b[_0x8038('0x34')]=_[_0x8038('0x47')](_0x270fab[_0x8038('0x2e')],qs[_0x8038('0x35')](_0x3023d3[_0x8038('0x30')][_0x8038('0x35')]));_0x35db1b[_0x8038('0x34')]=_0x35db1b[_0x8038('0x34')][_0x8038('0x36')]?_0x35db1b[_0x8038('0x34')]:_0x270fab[_0x8038('0x2e')];if(_0x3023d3[_0x8038('0x30')][_0x8038('0x41')]){_0x35db1b[_0x8038('0x42')]=[{'all':!![]}];}_0x35db1b=_[_0x8038('0x3d')]({},_0x35db1b,_0x3023d3[_0x8038('0x40')]);return db[_0x8038('0x2c')][_0x8038('0x48')](_0x35db1b)[_0x8038('0x28')](handleEntityNotFound(_0x5df101,null))['then'](respondWithResult(_0x5df101,null))[_0x8038('0x45')](handleError(_0x5df101,null));};exports['create']=function(_0x389736,_0x2d257f,_0xbb44ae){var _0x19694d;return db[_0x8038('0x2c')]['create'](_0x389736[_0x8038('0x49')],{'raw':!![]})['then'](function(_0x5eb046){_0x19694d=_0x5eb046;return db[_0x8038('0x2c')][_0x8038('0x43')]({'raw':!![]});})['then'](function(_0x3c1bca){var _0x23bae5=fs['readFileSync'](path['join'](config['root'],_0x8038('0x4a')),_0x8038('0x4b'));var _0x2c33c1=ejs[_0x8038('0x4c')](_0x23bae5,{'contexts':_0x3c1bca||[]});fs['writeFileSync'](_0x8038('0x4d'),_0x2c33c1);})[_0x8038('0x28')](function(){return respondWithRpcPromise(_0x8038('0x4e'),_0x8038('0x4f'),{'module':_0x8038('0x50')});})['then'](function(){return _0x19694d;})[_0x8038('0x28')](respondWithResult(_0x2d257f,0xc9))[_0x8038('0x45')](handleError(_0x2d257f,null));};exports[_0x8038('0x26')]=function(_0x367e77,_0x5792a0,_0x45e15a){var _0x3e20c0;return db['VoiceContext'][_0x8038('0x48')]({'where':{'id':_0x367e77[_0x8038('0x51')]['id']}})[_0x8038('0x28')](handleEntityNotFound(_0x5792a0,null))[_0x8038('0x28')](saveUpdates(_0x367e77[_0x8038('0x49')],null))['then'](function(_0x3fc7d9){if(_0x3fc7d9){_0x3e20c0=_0x3fc7d9;return db[_0x8038('0x2c')]['findAll']({'raw':!![]});}})[_0x8038('0x28')](function(_0x272419){var _0x503547=fs[_0x8038('0x52')](path[_0x8038('0x53')](config[_0x8038('0x54')],_0x8038('0x4a')),_0x8038('0x4b'));var _0x365afe=ejs[_0x8038('0x4c')](_0x503547,{'contexts':_0x272419||[]});fs[_0x8038('0x55')](_0x8038('0x4d'),_0x365afe);})[_0x8038('0x28')](function(){return respondWithRpcPromise(_0x8038('0x4e'),'update',{'module':_0x8038('0x50')});})[_0x8038('0x28')](function(){return _0x3e20c0;})[_0x8038('0x28')](respondWithResult(_0x5792a0,null))[_0x8038('0x45')](handleError(_0x5792a0,null));};exports['destroy']=function(_0x1244e1,_0x435925,_0x5580be){var _0x26f5b4;return db[_0x8038('0x2c')][_0x8038('0x48')]({'where':{'id':_0x1244e1[_0x8038('0x51')]['id']}})['then'](handleEntityNotFound(_0x435925,null))[_0x8038('0x28')](removeEntity(_0x435925,null))[_0x8038('0x28')](function(){return db['VoiceContext'][_0x8038('0x43')]({'raw':!![]});})[_0x8038('0x28')](function(_0x3fe1ab){var _0x5cab8b=fs[_0x8038('0x52')](path[_0x8038('0x53')](config[_0x8038('0x54')],_0x8038('0x4a')),'utf8');var _0x413bd8=ejs[_0x8038('0x4c')](_0x5cab8b,{'contexts':_0x3fe1ab});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x413bd8);return respondWithRpcPromise(_0x8038('0x4e'),_0x8038('0x27'),{'module':_0x8038('0x50')});})[_0x8038('0x45')](handleError(_0x435925,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 05debed..ef443df 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 _0xbfe0=['VoiceContext','lodash','../../config/logger','api','bluebird','request-promise','./voiceContext.attributes','exports','define'];(function(_0x8c1218,_0x1b2229){var _0x59123d=function(_0x137b0){while(--_0x137b0){_0x8c1218['push'](_0x8c1218['shift']());}};_0x59123d(++_0x1b2229);}(_0xbfe0,0x6d));var _0x0bfe=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xbfe0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0bfe('0x0'));var util=require('util');var logger=require(_0x0bfe('0x1'))(_0x0bfe('0x2'));var moment=require('moment');var BPromise=require(_0x0bfe('0x3'));var rp=require(_0x0bfe('0x4'));var attributes=require(_0x0bfe('0x5'));module[_0x0bfe('0x6')]=function(_0x1b5ce7,_0x52176b){return _0x1b5ce7[_0x0bfe('0x7')](_0x0bfe('0x8'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6742=['bluebird','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','moment'];(function(_0x576c41,_0x49ceb9){var _0x4359e2=function(_0x509f5f){while(--_0x509f5f){_0x576c41['push'](_0x576c41['shift']());}};_0x4359e2(++_0x49ceb9);}(_0x6742,0x8d));var _0x2674=function(_0x419ba4,_0xf7e845){_0x419ba4=_0x419ba4-0x0;var _0x5bf9d0=_0x6742[_0x419ba4];return _0x5bf9d0;};'use strict';var _=require(_0x2674('0x0'));var util=require('util');var logger=require(_0x2674('0x1'))('api');var moment=require(_0x2674('0x2'));var BPromise=require(_0x2674('0x3'));var rp=require('request-promise');var attributes=require(_0x2674('0x4'));module[_0x2674('0x5')]=function(_0x1ede3e,_0x28ea9a){return _0x1ede3e[_0x2674('0x6')](_0x2674('0x7'),attributes,{'tableName':_0x2674('0x8'),'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 36b1c5a..49cf073 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 _0x4079=['request','info','debug','request\x20sent','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x374dbf,_0x26a285){var _0x54ceeb=function(_0x162049){while(--_0x162049){_0x374dbf['push'](_0x374dbf['shift']());}};_0x54ceeb(++_0x26a285);}(_0x4079,0x6e));var _0x9407=function(_0x1fbd96,_0x5caae5){_0x1fbd96=_0x1fbd96-0x0;var _0x427f59=_0x4079[_0x1fbd96];return _0x427f59;};'use strict';var _=require(_0x9407('0x0'));var util=require(_0x9407('0x1'));var moment=require('moment');var BPromise=require(_0x9407('0x2'));var rs=require(_0x9407('0x3'));var fs=require('fs');var db=require(_0x9407('0x4'))['db'];var utils=require(_0x9407('0x5'));var logger=require(_0x9407('0x6'))(_0x9407('0x7'));var config=require('../../config/environment');var jayson=require(_0x9407('0x8'));var client=jayson['client'][_0x9407('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13aa84,_0x2c7809,_0x3b5ed4){return new BPromise(function(_0x161cc0,_0x583ad0){return client[_0x9407('0xa')](_0x13aa84,_0x3b5ed4)['then'](function(_0x2da7d9){logger[_0x9407('0xb')]('VoiceContext,\x20%s,\x20%s',_0x2c7809,'request\x20sent');logger[_0x9407('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2c7809,_0x9407('0xd'),JSON[_0x9407('0xe')](_0x2da7d9));if(_0x2da7d9[_0x9407('0xf')]){if(_0x2da7d9[_0x9407('0xf')]['code']===0x1f4){logger[_0x9407('0xf')](_0x9407('0x10'),_0x2c7809,_0x2da7d9['error'][_0x9407('0x11')]);return _0x583ad0(_0x2da7d9[_0x9407('0xf')][_0x9407('0x11')]);}logger[_0x9407('0xf')](_0x9407('0x10'),_0x2c7809,_0x2da7d9['error']['message']);return _0x161cc0(_0x2da7d9['error'][_0x9407('0x11')]);}else{logger['info'](_0x9407('0x10'),_0x2c7809,'request\x20sent');_0x161cc0(_0x2da7d9[_0x9407('0x12')][_0x9407('0x11')]);}})[_0x9407('0x13')](function(_0x42a4bd){logger[_0x9407('0xf')](_0x9407('0x10'),_0x2c7809,_0x42a4bd);_0x583ad0(_0x42a4bd);});});} \ No newline at end of file +var _0x696f=['result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x696f,0x1e5));var _0xf696=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x696f[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xf696('0x0'));var util=require(_0xf696('0x1'));var moment=require(_0xf696('0x2'));var BPromise=require(_0xf696('0x3'));var rs=require(_0xf696('0x4'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf696('0x5'))(_0xf696('0x6'));var config=require(_0xf696('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf696('0x8')][_0xf696('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3addeb,_0x1b8804,_0x6c9038){return new BPromise(function(_0x48211e,_0x476a21){return client[_0xf696('0xa')](_0x3addeb,_0x6c9038)[_0xf696('0xb')](function(_0x4bf646){logger[_0xf696('0xc')](_0xf696('0xd'),_0x1b8804,_0xf696('0xe'));logger[_0xf696('0xf')](_0xf696('0x10'),_0x1b8804,'request\x20sent',JSON[_0xf696('0x11')](_0x4bf646));if(_0x4bf646[_0xf696('0x12')]){if(_0x4bf646[_0xf696('0x12')][_0xf696('0x13')]===0x1f4){logger[_0xf696('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);return _0x476a21(_0x4bf646['error'][_0xf696('0x14')]);}logger[_0xf696('0x12')]('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);return _0x48211e(_0x4bf646[_0xf696('0x12')][_0xf696('0x14')]);}else{logger[_0xf696('0xc')](_0xf696('0xd'),_0x1b8804,'request\x20sent');_0x48211e(_0x4bf646[_0xf696('0x15')][_0xf696('0x14')]);}})[_0xf696('0x16')](function(_0xab7b16){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1b8804,_0xab7b16);_0x476a21(_0xab7b16);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 50b7fd2..2d8b6c6 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 _0x814b=['path','express','Router','../../components/auth/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x2d7b82,_0x16889e){var _0x1a74a4=function(_0x25acde){while(--_0x25acde){_0x2d7b82['push'](_0x2d7b82['shift']());}};_0x1a74a4(++_0x16889e);}(_0x814b,0x1a2));var _0xb814=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x814b[_0x5e77db];return _0x34b675;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var express=require(_0xb814('0x3'));var router=express[_0xb814('0x4')]();var auth=require(_0xb814('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb814('0x6'));var controller=require(_0xb814('0x7'));router[_0xb814('0x8')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xa')]);router[_0xb814('0x8')]('/describe',auth[_0xb814('0x9')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0x9')](),controller[_0xb814('0xd')]);router[_0xb814('0xe')]('/',auth[_0xb814('0x9')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xc'),auth[_0xb814('0x9')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')]('/:id',auth[_0xb814('0x9')](),controller['destroy']);module[_0xb814('0x13')]=router; \ No newline at end of file +var _0x5f2f=['/describe','describe','/:id','show','create','put','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x59c4d8,_0x2fcb38){var _0x4af7e2=function(_0x2ec642){while(--_0x2ec642){_0x59c4d8['push'](_0x59c4d8['shift']());}};_0x4af7e2(++_0x2fcb38);}(_0x5f2f,0x73));var _0xf5f2=function(_0x128644,_0x12ccec){_0x128644=_0x128644-0x0;var _0x341ecf=_0x5f2f[_0x128644];return _0x341ecf;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var express=require(_0xf5f2('0x3'));var router=express[_0xf5f2('0x4')]();var auth=require(_0xf5f2('0x5'));var interaction=require(_0xf5f2('0x6'));var config=require(_0xf5f2('0x7'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xc')]);router['get'](_0xf5f2('0xd'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xe')]);router['post']('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')]('/:id',auth[_0xf5f2('0x8')](),controller['update']);router['delete'](_0xf5f2('0xd'),auth[_0xf5f2('0x8')](),controller['destroy']);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ebff37c..06b9fc5 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 _0x89ad=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x1442ab,_0x5ab739){var _0xc6ef7f=function(_0x3ccf3b){while(--_0x3ccf3b){_0x1442ab['push'](_0x1442ab['shift']());}};_0xc6ef7f(++_0x5ab739);}(_0x89ad,0x1c8));var _0xd89a=function(_0x48d249,_0x41c005){_0x48d249=_0x48d249-0x0;var _0x341cc4=_0x89ad[_0x48d249];return _0x341cc4;};'use strict';var Sequelize=require(_0xd89a('0x0'));module[_0xd89a('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd89a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xd89a('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd89a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xd89a('0x2')]},'connectedlinename':{'type':Sequelize[_0xd89a('0x2')]},'language':{'type':Sequelize[_0xd89a('0x2')]},'accountcode':{'type':Sequelize[_0xd89a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd89a('0x2')]},'priority':{'type':Sequelize[_0xd89a('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xd89a('0x2')]},'destchannel':{'type':Sequelize[_0xd89a('0x2')]},'destchannelstate':{'type':Sequelize[_0xd89a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xd89a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd89a('0x2')]},'destcalleridname':{'type':Sequelize[_0xd89a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd89a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xd89a('0x2')]},'destaccountcode':{'type':Sequelize[_0xd89a('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xd89a('0x2')]},'destpriority':{'type':Sequelize[_0xd89a('0x3')]},'destuniqueid':{'type':Sequelize[_0xd89a('0x2')]},'destlinkedid':{'type':Sequelize[_0xd89a('0x2')]},'dialstring':{'type':Sequelize[_0xd89a('0x2')]},'dialstatus':{'type':Sequelize[_0xd89a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd89a('0x4')]},'endtime':{'type':Sequelize[_0xd89a('0x4')]},'lastevent':{'type':Sequelize[_0xd89a('0x2')],'comment':_0xd89a('0x5')},'routeId':{'type':Sequelize[_0xd89a('0x3')]},'duration':{'type':Sequelize[_0xd89a('0x3')]},'holdtime':{'type':Sequelize[_0xd89a('0x3')]},'billableseconds':{'type':Sequelize[_0xd89a('0x3')]}}; \ No newline at end of file +var _0x9208=['sequelize','exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x5d92c2,_0x26d815){var _0x415601=function(_0x507e8f){while(--_0x507e8f){_0x5d92c2['push'](_0x5d92c2['shift']());}};_0x415601(++_0x26d815);}(_0x9208,0x108));var _0x8920=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9208[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x8920('0x0'));module[_0x8920('0x1')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x8920('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8920('0x2')]},'calleridname':{'type':Sequelize[_0x8920('0x2')]},'connectedlinenum':{'type':Sequelize[_0x8920('0x2')]},'connectedlinename':{'type':Sequelize[_0x8920('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8920('0x2')]},'context':{'type':Sequelize[_0x8920('0x2')]},'exten':{'type':Sequelize[_0x8920('0x2')]},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8920('0x2')]},'linkedid':{'type':Sequelize[_0x8920('0x2')]},'destchannel':{'type':Sequelize[_0x8920('0x2')]},'destchannelstate':{'type':Sequelize[_0x8920('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x8920('0x2')]},'destcalleridnum':{'type':Sequelize[_0x8920('0x2')]},'destcalleridname':{'type':Sequelize[_0x8920('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x8920('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x8920('0x2')]},'destaccountcode':{'type':Sequelize[_0x8920('0x2')]},'destcontext':{'type':Sequelize[_0x8920('0x2')]},'destexten':{'type':Sequelize[_0x8920('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x8920('0x2')]},'destlinkedid':{'type':Sequelize[_0x8920('0x2')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x8920('0x2')]},'starttime':{'type':Sequelize[_0x8920('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8920('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x8920('0x5')},'routeId':{'type':Sequelize[_0x8920('0x3')]},'duration':{'type':Sequelize[_0x8920('0x3')]},'holdtime':{'type':Sequelize[_0x8920('0x3')]},'billableseconds':{'type':Sequelize[_0x8920('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index bd2dcea..fa3a0de 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 _0x4916=['apply','reject','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','VoiceDialReport','include','findAll','rows','catch','show','params','intersection','includeAll','find','create','body','describe','fast-json-patch','request-promise','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit'];(function(_0x26d9b3,_0x591f4e){var _0x15c226=function(_0x17bbdb){while(--_0x17bbdb){_0x26d9b3['push'](_0x26d9b3['shift']());}};_0x15c226(++_0x591f4e);}(_0x4916,0x1a6));var _0x6491=function(_0x1ab96f,_0x80a9cb){_0x1ab96f=_0x1ab96f-0x0;var _0xb4b5df=_0x4916[_0x1ab96f];return _0xb4b5df;};'use strict';var jsonpatch=require(_0x6491('0x0'));var rp=require(_0x6491('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x6491('0x2'));var csv=require(_0x6491('0x3'));var ejs=require(_0x6491('0x4'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6491('0x5'));var crypto=require(_0x6491('0x6'));var jsforce=require(_0x6491('0x7'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6491('0x8'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0x6491('0x9'))(_0x6491('0xa'));var utils=require('../../config/utils');var config=require(_0x6491('0xb'));var db=require(_0x6491('0xc'))['db'];function respondWithStatusCode(_0x182df8,_0xb2e24){_0xb2e24=_0xb2e24||0xcc;return function(_0x2ed452){if(_0x2ed452){return _0x182df8['sendStatus'](_0xb2e24);}return _0x182df8[_0x6491('0xd')](_0xb2e24)[_0x6491('0xe')]();};}function respondWithResult(_0x223b8b,_0xa0361a){_0xa0361a=_0xa0361a||0xc8;return function(_0x471e5e){if(_0x471e5e){return _0x223b8b[_0x6491('0xd')](_0xa0361a)[_0x6491('0xf')](_0x471e5e);}};}function respondWithFilteredResult(_0x3d63ef,_0x3ef9fc){return function(_0x1e515b){if(_0x1e515b){var _0x11bf18=_0x1e515b[_0x6491('0x10')],_0x2b8300=_0x3ef9fc[_0x6491('0x11')],_0x1ae13c=_0x3ef9fc['offset']+_0x3ef9fc[_0x6491('0x12')],_0x52b9ae;if(_0x1ae13c>=_0x11bf18){_0x1ae13c=_0x11bf18;_0x52b9ae=0xc8;}else{_0x52b9ae=0xce;}_0x3d63ef['status'](_0x52b9ae);return _0x3d63ef['set']('Content-Range',_0x2b8300+'-'+_0x1ae13c+'/'+_0x11bf18)[_0x6491('0xf')](_0x1e515b);}return null;};}function patchUpdates(_0x113a3d){return function(_0x356d9e){try{jsonpatch[_0x6491('0x13')](_0x356d9e,_0x113a3d,!![]);}catch(_0x700c1c){return BPromise[_0x6491('0x14')](_0x700c1c);}return _0x356d9e['save']();};}function saveUpdates(_0x5dec2a,_0x2e0a87){return function(_0x5ce6ce){if(_0x5ce6ce){return _0x5ce6ce[_0x6491('0x15')](_0x5dec2a)[_0x6491('0x16')](function(_0xfdd142){return _0xfdd142;});}return null;};}function removeEntity(_0x2d0ef1,_0x12a737){return function(_0x1f64f5){if(_0x1f64f5){return _0x1f64f5[_0x6491('0x17')]()[_0x6491('0x16')](function(){_0x2d0ef1[_0x6491('0xd')](0xcc)[_0x6491('0xe')]();});}};}function handleEntityNotFound(_0x1cb8f3,_0x5d473e){return function(_0xe41214){if(!_0xe41214){_0x1cb8f3[_0x6491('0x18')](0x194);}return _0xe41214;};}function handleError(_0x517314,_0xf78fe7){_0xf78fe7=_0xf78fe7||0x1f4;return function(_0x2ca4f9){logger['error'](_0x2ca4f9[_0x6491('0x19')]);if(_0x2ca4f9[_0x6491('0x1a')]){delete _0x2ca4f9[_0x6491('0x1a')];}_0x517314[_0x6491('0xd')](_0xf78fe7)[_0x6491('0x1b')](_0x2ca4f9);};}exports[_0x6491('0x1c')]=function(_0x5ebd40,_0x350b04){var _0x30c240={},_0x3d769d={},_0x49614a={'count':0x0,'rows':[]};var _0xc78b7e=db['VoiceDialReport'][_0x6491('0x1d')];_0x3d769d[_0x6491('0x1e')]=_[_0x6491('0x1f')](_0xc78b7e);var _0x4fa45d={'dateStart':_0x5ebd40[_0x6491('0x20')][_0x6491('0x21')],'dateEnd':_0x5ebd40[_0x6491('0x20')]['dateEnd']};delete _0x5ebd40['query'][_0x6491('0x21')];delete _0x5ebd40[_0x6491('0x20')][_0x6491('0x22')];_0x3d769d['query']=_[_0x6491('0x1f')](_0x5ebd40[_0x6491('0x20')]);_0x3d769d[_0x6491('0x23')]=_['intersection'](_0x3d769d[_0x6491('0x1e')],_0x3d769d[_0x6491('0x20')]);_0x30c240[_0x6491('0x24')]=_['intersection'](_0x3d769d[_0x6491('0x1e')],qs[_0x6491('0x25')](_0x5ebd40[_0x6491('0x20')][_0x6491('0x25')]));_0x30c240[_0x6491('0x24')]=_0x30c240[_0x6491('0x24')][_0x6491('0x26')]?_0x30c240[_0x6491('0x24')]:_0x3d769d[_0x6491('0x1e')];if(!_0x5ebd40[_0x6491('0x20')]['hasOwnProperty'](_0x6491('0x27'))){_0x30c240[_0x6491('0x12')]=qs['limit'](_0x5ebd40[_0x6491('0x20')][_0x6491('0x12')]);_0x30c240[_0x6491('0x11')]=qs[_0x6491('0x11')](_0x5ebd40['query'][_0x6491('0x11')]);}_0x30c240[_0x6491('0x28')]=qs[_0x6491('0x29')](_0x5ebd40[_0x6491('0x20')]['sort']);_0x30c240[_0x6491('0x2a')]=qs[_0x6491('0x23')](_[_0x6491('0x2b')](_0x5ebd40['query'],_0x3d769d[_0x6491('0x23')]));if(_0x4fa45d[_0x6491('0x21')]){if(_0x4fa45d[_0x6491('0x22')]){_0x4fa45d[_0x6491('0x22')]=moment(_0x4fa45d['dateEnd'])[_0x6491('0x2c')](0x1,'day');}else{_0x4fa45d[_0x6491('0x22')]=moment(_0x4fa45d[_0x6491('0x21')])[_0x6491('0x2c')](0x1,_0x6491('0x2d'));}_['merge'](_0x30c240[_0x6491('0x2a')],{'createdAt':{'$gte':_0x4fa45d[_0x6491('0x21')],'$lte':_0x4fa45d[_0x6491('0x22')]}});}if(_0x5ebd40[_0x6491('0x20')][_0x6491('0x2e')]){_0x30c240[_0x6491('0x2a')]=_[_0x6491('0x2f')](_0x30c240[_0x6491('0x2a')],{'$or':_[_0x6491('0x30')](_0x30c240[_0x6491('0x24')],function(_0x2ab8b5){var _0x42051c={};_0x42051c[_0x2ab8b5]={'$like':'%'+_0x5ebd40['query'][_0x6491('0x2e')]+'%'};return _0x42051c;})});}_0x30c240=_[_0x6491('0x2f')]({},_0x30c240,_0x5ebd40[_0x6491('0x31')]);var _0x1ae618={'where':_0x30c240[_0x6491('0x2a')]};return db[_0x6491('0x32')][_0x6491('0x10')](_0x1ae618)[_0x6491('0x16')](function(_0x44fabe){_0x49614a[_0x6491('0x10')]=_0x44fabe;if(_0x5ebd40['query']['includeAll']){_0x30c240[_0x6491('0x33')]=[{'all':!![]}];}return db[_0x6491('0x32')][_0x6491('0x34')](_0x30c240);})['then'](function(_0x4664a1){_0x49614a[_0x6491('0x35')]=_0x4664a1;return _0x49614a;})[_0x6491('0x16')](respondWithFilteredResult(_0x350b04,_0x30c240))[_0x6491('0x36')](handleError(_0x350b04,null));};exports[_0x6491('0x37')]=function(_0x4d6d42,_0x34646d){var _0x2a850d={'raw':!![],'where':{'id':_0x4d6d42[_0x6491('0x38')]['id']}},_0xc01047={};_0xc01047[_0x6491('0x1e')]=_[_0x6491('0x1f')](db[_0x6491('0x32')][_0x6491('0x1d')]);_0xc01047[_0x6491('0x20')]=_[_0x6491('0x1f')](_0x4d6d42[_0x6491('0x20')]);_0xc01047[_0x6491('0x23')]=_[_0x6491('0x39')](_0xc01047[_0x6491('0x1e')],_0xc01047[_0x6491('0x20')]);_0x2a850d['attributes']=_[_0x6491('0x39')](_0xc01047[_0x6491('0x1e')],qs[_0x6491('0x25')](_0x4d6d42['query'][_0x6491('0x25')]));_0x2a850d[_0x6491('0x24')]=_0x2a850d[_0x6491('0x24')][_0x6491('0x26')]?_0x2a850d[_0x6491('0x24')]:_0xc01047[_0x6491('0x1e')];if(_0x4d6d42['query'][_0x6491('0x3a')]){_0x2a850d[_0x6491('0x33')]=[{'all':!![]}];}_0x2a850d=_[_0x6491('0x2f')]({},_0x2a850d,_0x4d6d42[_0x6491('0x31')]);return db['VoiceDialReport'][_0x6491('0x3b')](_0x2a850d)[_0x6491('0x16')](handleEntityNotFound(_0x34646d,null))['then'](respondWithResult(_0x34646d,null))['catch'](handleError(_0x34646d,null));};exports[_0x6491('0x3c')]=function(_0x252d29,_0x1166fc){return db[_0x6491('0x32')]['create'](_0x252d29[_0x6491('0x3d')],{})['then'](respondWithResult(_0x1166fc,0xc9))[_0x6491('0x36')](handleError(_0x1166fc,null));};exports[_0x6491('0x15')]=function(_0x2b96f4,_0x3d015d){if(_0x2b96f4[_0x6491('0x3d')]['id']){delete _0x2b96f4[_0x6491('0x3d')]['id'];}return db[_0x6491('0x32')][_0x6491('0x3b')]({'where':{'id':_0x2b96f4[_0x6491('0x38')]['id']}})[_0x6491('0x16')](handleEntityNotFound(_0x3d015d,null))[_0x6491('0x16')](saveUpdates(_0x2b96f4[_0x6491('0x3d')],null))[_0x6491('0x16')](respondWithResult(_0x3d015d,null))['catch'](handleError(_0x3d015d,null));};exports[_0x6491('0x17')]=function(_0x37fa13,_0x57c53e){return db[_0x6491('0x32')]['find']({'where':{'id':_0x37fa13['params']['id']}})['then'](handleEntityNotFound(_0x57c53e,null))[_0x6491('0x16')](removeEntity(_0x57c53e,null))['catch'](handleError(_0x57c53e,null));};exports[_0x6491('0x3e')]=function(_0x53ba7f,_0x6ef579){return db[_0x6491('0x32')][_0x6491('0x3e')]()[_0x6491('0x16')](respondWithResult(_0x6ef579,null))['catch'](handleError(_0x6ef579,null));}; \ No newline at end of file +var _0x8f11=['lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','reject','save','update','then','destroy','stack','name','send','index','VoiceDialReport','rawAttributes','model','keys','query','dateEnd','dateStart','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','filter','merge','map','options','includeAll','include','rows','catch','show','params','find','create','body','describe','request-promise','moment','mustache','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f11,0xc5));var _0x18f1=function(_0x4f7295,_0x555244){_0x4f7295=_0x4f7295-0x0;var _0x302b0c=_0x8f11[_0x4f7295];return _0x302b0c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x18f1('0x0'));var moment=require(_0x18f1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x18f1('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x18f1('0x3'));var fs=require('fs');var _=require(_0x18f1('0x4'));var squel=require('squel');var crypto=require(_0x18f1('0x5'));var jsforce=require(_0x18f1('0x6'));var deskjs=require(_0x18f1('0x7'));var toCsv=require(_0x18f1('0x8'));var querystring=require(_0x18f1('0x9'));var Papa=require(_0x18f1('0xa'));var qs=require(_0x18f1('0xb'));var logger=require(_0x18f1('0xc'))(_0x18f1('0xd'));var utils=require(_0x18f1('0xe'));var config=require(_0x18f1('0xf'));var db=require(_0x18f1('0x10'))['db'];function respondWithStatusCode(_0x1d61fb,_0x4b85d4){_0x4b85d4=_0x4b85d4||0xcc;return function(_0x51980c){if(_0x51980c){return _0x1d61fb[_0x18f1('0x11')](_0x4b85d4);}return _0x1d61fb[_0x18f1('0x12')](_0x4b85d4)[_0x18f1('0x13')]();};}function respondWithResult(_0x33caaf,_0x3c6dbf){_0x3c6dbf=_0x3c6dbf||0xc8;return function(_0x3d94bc){if(_0x3d94bc){return _0x33caaf[_0x18f1('0x12')](_0x3c6dbf)[_0x18f1('0x14')](_0x3d94bc);}};}function respondWithFilteredResult(_0x2df522,_0x217c3c){return function(_0x4c5903){if(_0x4c5903){var _0x16fc36=_0x4c5903[_0x18f1('0x15')],_0x37027a=_0x217c3c[_0x18f1('0x16')],_0x270686=_0x217c3c[_0x18f1('0x16')]+_0x217c3c[_0x18f1('0x17')],_0x1d8419;if(_0x270686>=_0x16fc36){_0x270686=_0x16fc36;_0x1d8419=0xc8;}else{_0x1d8419=0xce;}_0x2df522[_0x18f1('0x12')](_0x1d8419);return _0x2df522['set']('Content-Range',_0x37027a+'-'+_0x270686+'/'+_0x16fc36)['json'](_0x4c5903);}return null;};}function patchUpdates(_0x279338){return function(_0x38f73f){try{jsonpatch['apply'](_0x38f73f,_0x279338,!![]);}catch(_0x1ff1e9){return BPromise[_0x18f1('0x18')](_0x1ff1e9);}return _0x38f73f[_0x18f1('0x19')]();};}function saveUpdates(_0x101fbe,_0x59a435){return function(_0x393ef0){if(_0x393ef0){return _0x393ef0[_0x18f1('0x1a')](_0x101fbe)[_0x18f1('0x1b')](function(_0x3fbef0){return _0x3fbef0;});}return null;};}function removeEntity(_0xe3b36f,_0x2dd795){return function(_0x36b2be){if(_0x36b2be){return _0x36b2be[_0x18f1('0x1c')]()[_0x18f1('0x1b')](function(){_0xe3b36f[_0x18f1('0x12')](0xcc)[_0x18f1('0x13')]();});}};}function handleEntityNotFound(_0x4b739b,_0x2f7d01){return function(_0x33c638){if(!_0x33c638){_0x4b739b[_0x18f1('0x11')](0x194);}return _0x33c638;};}function handleError(_0x445ed9,_0x331256){_0x331256=_0x331256||0x1f4;return function(_0x35c3d6){logger['error'](_0x35c3d6[_0x18f1('0x1d')]);if(_0x35c3d6[_0x18f1('0x1e')]){delete _0x35c3d6[_0x18f1('0x1e')];}_0x445ed9[_0x18f1('0x12')](_0x331256)[_0x18f1('0x1f')](_0x35c3d6);};}exports[_0x18f1('0x20')]=function(_0x2dbf42,_0x19aade){var _0xe4e45c={},_0x1d4fe5={},_0x4393e7={'count':0x0,'rows':[]};var _0x3166ae=db[_0x18f1('0x21')][_0x18f1('0x22')];_0x1d4fe5[_0x18f1('0x23')]=_[_0x18f1('0x24')](_0x3166ae);var _0x1765a7={'dateStart':_0x2dbf42[_0x18f1('0x25')]['dateStart'],'dateEnd':_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x26')]};delete _0x2dbf42[_0x18f1('0x25')][_0x18f1('0x27')];delete _0x2dbf42['query'][_0x18f1('0x26')];_0x1d4fe5[_0x18f1('0x25')]=_[_0x18f1('0x24')](_0x2dbf42[_0x18f1('0x25')]);_0x1d4fe5[_0x18f1('0x28')]=_[_0x18f1('0x29')](_0x1d4fe5[_0x18f1('0x23')],_0x1d4fe5[_0x18f1('0x25')]);_0xe4e45c['attributes']=_[_0x18f1('0x29')](_0x1d4fe5['model'],qs[_0x18f1('0x2a')](_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x2a')]));_0xe4e45c[_0x18f1('0x2b')]=_0xe4e45c['attributes'][_0x18f1('0x2c')]?_0xe4e45c[_0x18f1('0x2b')]:_0x1d4fe5['model'];if(!_0x2dbf42['query'][_0x18f1('0x2d')](_0x18f1('0x2e'))){_0xe4e45c[_0x18f1('0x17')]=qs[_0x18f1('0x17')](_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x17')]);_0xe4e45c[_0x18f1('0x16')]=qs[_0x18f1('0x16')](_0x2dbf42['query'][_0x18f1('0x16')]);}_0xe4e45c[_0x18f1('0x2f')]=qs[_0x18f1('0x30')](_0x2dbf42[_0x18f1('0x25')]['sort']);_0xe4e45c[_0x18f1('0x31')]=qs[_0x18f1('0x28')](_[_0x18f1('0x32')](_0x2dbf42['query'],_0x1d4fe5[_0x18f1('0x28')]));if(_0x1765a7[_0x18f1('0x27')]){if(_0x1765a7[_0x18f1('0x26')]){_0x1765a7[_0x18f1('0x26')]=moment(_0x1765a7[_0x18f1('0x26')])[_0x18f1('0x33')](0x1,'day');}else{_0x1765a7[_0x18f1('0x26')]=moment(_0x1765a7[_0x18f1('0x27')])[_0x18f1('0x33')](0x1,_0x18f1('0x34'));}_['merge'](_0xe4e45c['where'],{'createdAt':{'$gte':_0x1765a7[_0x18f1('0x27')],'$lte':_0x1765a7[_0x18f1('0x26')]}});}if(_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x35')]){_0xe4e45c[_0x18f1('0x31')]=_[_0x18f1('0x36')](_0xe4e45c['where'],{'$or':_[_0x18f1('0x37')](_0xe4e45c['attributes'],function(_0x98f9e6){var _0x5a1f24={};_0x5a1f24[_0x98f9e6]={'$like':'%'+_0x2dbf42['query'][_0x18f1('0x35')]+'%'};return _0x5a1f24;})});}_0xe4e45c=_[_0x18f1('0x36')]({},_0xe4e45c,_0x2dbf42[_0x18f1('0x38')]);var _0x1acd9a={'where':_0xe4e45c[_0x18f1('0x31')]};return db[_0x18f1('0x21')][_0x18f1('0x15')](_0x1acd9a)['then'](function(_0x2fe134){_0x4393e7[_0x18f1('0x15')]=_0x2fe134;if(_0x2dbf42[_0x18f1('0x25')][_0x18f1('0x39')]){_0xe4e45c[_0x18f1('0x3a')]=[{'all':!![]}];}return db[_0x18f1('0x21')]['findAll'](_0xe4e45c);})[_0x18f1('0x1b')](function(_0x25a881){_0x4393e7[_0x18f1('0x3b')]=_0x25a881;return _0x4393e7;})[_0x18f1('0x1b')](respondWithFilteredResult(_0x19aade,_0xe4e45c))[_0x18f1('0x3c')](handleError(_0x19aade,null));};exports[_0x18f1('0x3d')]=function(_0x153d4e,_0x1137c8){var _0x69f113={'raw':!![],'where':{'id':_0x153d4e[_0x18f1('0x3e')]['id']}},_0x5c5698={};_0x5c5698[_0x18f1('0x23')]=_[_0x18f1('0x24')](db[_0x18f1('0x21')][_0x18f1('0x22')]);_0x5c5698[_0x18f1('0x25')]=_[_0x18f1('0x24')](_0x153d4e['query']);_0x5c5698[_0x18f1('0x28')]=_[_0x18f1('0x29')](_0x5c5698[_0x18f1('0x23')],_0x5c5698[_0x18f1('0x25')]);_0x69f113[_0x18f1('0x2b')]=_[_0x18f1('0x29')](_0x5c5698[_0x18f1('0x23')],qs[_0x18f1('0x2a')](_0x153d4e[_0x18f1('0x25')][_0x18f1('0x2a')]));_0x69f113['attributes']=_0x69f113[_0x18f1('0x2b')][_0x18f1('0x2c')]?_0x69f113['attributes']:_0x5c5698[_0x18f1('0x23')];if(_0x153d4e[_0x18f1('0x25')][_0x18f1('0x39')]){_0x69f113[_0x18f1('0x3a')]=[{'all':!![]}];}_0x69f113=_['merge']({},_0x69f113,_0x153d4e[_0x18f1('0x38')]);return db[_0x18f1('0x21')][_0x18f1('0x3f')](_0x69f113)['then'](handleEntityNotFound(_0x1137c8,null))[_0x18f1('0x1b')](respondWithResult(_0x1137c8,null))[_0x18f1('0x3c')](handleError(_0x1137c8,null));};exports['create']=function(_0x49f9f9,_0x21eb40){return db[_0x18f1('0x21')][_0x18f1('0x40')](_0x49f9f9['body'],{})[_0x18f1('0x1b')](respondWithResult(_0x21eb40,0xc9))[_0x18f1('0x3c')](handleError(_0x21eb40,null));};exports[_0x18f1('0x1a')]=function(_0x1484a9,_0xb39a55){if(_0x1484a9[_0x18f1('0x41')]['id']){delete _0x1484a9[_0x18f1('0x41')]['id'];}return db[_0x18f1('0x21')][_0x18f1('0x3f')]({'where':{'id':_0x1484a9[_0x18f1('0x3e')]['id']}})[_0x18f1('0x1b')](handleEntityNotFound(_0xb39a55,null))[_0x18f1('0x1b')](saveUpdates(_0x1484a9[_0x18f1('0x41')],null))[_0x18f1('0x1b')](respondWithResult(_0xb39a55,null))['catch'](handleError(_0xb39a55,null));};exports[_0x18f1('0x1c')]=function(_0x4e330c,_0x435d05){return db[_0x18f1('0x21')][_0x18f1('0x3f')]({'where':{'id':_0x4e330c[_0x18f1('0x3e')]['id']}})[_0x18f1('0x1b')](handleEntityNotFound(_0x435d05,null))[_0x18f1('0x1b')](removeEntity(_0x435d05,null))[_0x18f1('0x3c')](handleError(_0x435d05,null));};exports[_0x18f1('0x42')]=function(_0x2cf374,_0xb8e94e){return db[_0x18f1('0x21')][_0x18f1('0x42')]()[_0x18f1('0x1b')](respondWithResult(_0xb8e94e,null))['catch'](handleError(_0xb8e94e,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 321c298..efe23d0 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 _0xbbce=['lodash','../../config/logger','api','moment','bluebird','request-promise','define','VoiceDialReport','report_dial','uniqueid'];(function(_0xba7507,_0x336146){var _0x2faa5a=function(_0xc5934){while(--_0xc5934){_0xba7507['push'](_0xba7507['shift']());}};_0x2faa5a(++_0x336146);}(_0xbbce,0x6e));var _0xebbc=function(_0x21bef1,_0x4e3022){_0x21bef1=_0x21bef1-0x0;var _0x3e5641=_0xbbce[_0x21bef1];return _0x3e5641;};'use strict';var _=require(_0xebbc('0x0'));var util=require('util');var logger=require(_0xebbc('0x1'))(_0xebbc('0x2'));var moment=require(_0xebbc('0x3'));var BPromise=require(_0xebbc('0x4'));var rp=require(_0xebbc('0x5'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x313ae7,_0x2f7ecb){return _0x313ae7[_0xebbc('0x6')](_0xebbc('0x7'),attributes,{'tableName':_0xebbc('0x8'),'paranoid':![],'indexes':[{'fields':[_0xebbc('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe9a4=['exports','VoiceDialReport','report_dial','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./voiceDialReport.attributes'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xe9a4,0x92));var _0x4e9a=function(_0x491ec2,_0x540c00){_0x491ec2=_0x491ec2-0x0;var _0x1748db=_0xe9a4[_0x491ec2];return _0x1748db;};'use strict';var _=require(_0x4e9a('0x0'));var util=require(_0x4e9a('0x1'));var logger=require(_0x4e9a('0x2'))(_0x4e9a('0x3'));var moment=require(_0x4e9a('0x4'));var BPromise=require(_0x4e9a('0x5'));var rp=require(_0x4e9a('0x6'));var attributes=require(_0x4e9a('0x7'));module[_0x4e9a('0x8')]=function(_0x51ec9e,_0x573cbf){return _0x51ec9e['define'](_0x4e9a('0x9'),attributes,{'tableName':_0x4e9a('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index da0d2e9..0a2f769 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 _0x2032=['util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','create','options','raw','then','VoiceDialReport','update','body','limit','UpdateVoiceDialReport'];(function(_0x5e788d,_0x1afcc8){var _0x1af32f=function(_0x1e89c9){while(--_0x1e89c9){_0x5e788d['push'](_0x5e788d['shift']());}};_0x1af32f(++_0x1afcc8);}(_0x2032,0xd9));var _0x2203=function(_0x103790,_0x5729ea){_0x103790=_0x103790-0x0;var _0x14bf9e=_0x2032[_0x103790];return _0x14bf9e;};'use strict';var _=require('lodash');var util=require(_0x2203('0x0'));var moment=require(_0x2203('0x1'));var BPromise=require(_0x2203('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require(_0x2203('0x3'))['db'];var utils=require(_0x2203('0x4'));var logger=require('../../config/logger')(_0x2203('0x5'));var config=require(_0x2203('0x6'));var jayson=require(_0x2203('0x7'));var client=jayson[_0x2203('0x8')][_0x2203('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13367a,_0x2e0f63,_0x2676aa){return new BPromise(function(_0x18c4d6,_0x2049ff){return client[_0x2203('0xa')](_0x13367a,_0x2676aa)['then'](function(_0x526ae0){logger[_0x2203('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x2e0f63,_0x2203('0xc'));logger[_0x2203('0xd')](_0x2203('0xe'),_0x2e0f63,'request\x20sent',JSON[_0x2203('0xf')](_0x526ae0));if(_0x526ae0['error']){if(_0x526ae0[_0x2203('0x10')]['code']===0x1f4){logger[_0x2203('0x10')](_0x2203('0x11'),_0x2e0f63,_0x526ae0['error']['message']);return _0x2049ff(_0x526ae0['error']['message']);}logger['error'](_0x2203('0x11'),_0x2e0f63,_0x526ae0['error']['message']);return _0x18c4d6(_0x526ae0[_0x2203('0x10')][_0x2203('0x12')]);}else{logger[_0x2203('0xb')](_0x2203('0x11'),_0x2e0f63,_0x2203('0xc'));_0x18c4d6(_0x526ae0[_0x2203('0x13')][_0x2203('0x12')]);}})[_0x2203('0x14')](function(_0xdf9d0b){logger[_0x2203('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0x2e0f63,_0xdf9d0b);_0x2049ff(_0xdf9d0b);});});}exports[_0x2203('0x15')]=function(_0x2ee127){var _0x4893ff=this;return new Promise(function(_0x3f9ef6,_0x8906e1){return db['VoiceDialReport'][_0x2203('0x16')](_0x2ee127['body'],{'raw':_0x2ee127[_0x2203('0x17')]?_0x2ee127[_0x2203('0x17')][_0x2203('0x18')]===undefined?!![]:![]:!![]})[_0x2203('0x19')](function(_0x15cb1a){logger[_0x2203('0xb')]('CreateVoiceDialReport',_0x2ee127);logger[_0x2203('0xd')]('CreateVoiceDialReport',_0x2ee127,JSON['stringify'](_0x15cb1a));_0x3f9ef6(_0x15cb1a);})[_0x2203('0x14')](function(_0x496d82){logger[_0x2203('0x10')](_0x2203('0x15'),_0x496d82['message'],_0x2ee127);_0x8906e1(_0x4893ff[_0x2203('0x10')](0x1f4,_0x496d82['message']));});});};exports['UpdateVoiceDialReport']=function(_0x226374){var _0x2718f5=this;return new Promise(function(_0x21f930,_0xfd0970){return db[_0x2203('0x1a')][_0x2203('0x1b')](_0x226374[_0x2203('0x1c')],{'raw':_0x226374[_0x2203('0x17')]?_0x226374['options'][_0x2203('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226374[_0x2203('0x17')]?_0x226374[_0x2203('0x17')]['where']||null:null,'attributes':_0x226374[_0x2203('0x17')]?_0x226374[_0x2203('0x17')]['attributes']||null:null,'limit':_0x226374[_0x2203('0x17')]?_0x226374[_0x2203('0x17')][_0x2203('0x1d')]||null:null})[_0x2203('0x19')](function(_0x28ae02){logger[_0x2203('0xb')](_0x2203('0x1e'),_0x226374);logger['debug'](_0x2203('0x1e'),_0x226374,JSON[_0x2203('0xf')](_0x28ae02));_0x21f930(_0x28ae02);})[_0x2203('0x14')](function(_0x74f035){logger['error'](_0x2203('0x1e'),_0x74f035[_0x2203('0x12')],_0x226374);_0xfd0970(_0x2718f5[_0x2203('0x10')](0x1f4,_0x74f035[_0x2203('0x12')]));});});}; \ No newline at end of file +var _0x5f66=['CreateVoiceDialReport','body','stringify','catch','UpdateVoiceDialReport','VoiceDialReport','options','where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','message','VoiceDialReport,\x20%s,\x20%s','info','result'];(function(_0x378d6c,_0x1fd42b){var _0x391ec1=function(_0x56dd7a){while(--_0x56dd7a){_0x378d6c['push'](_0x378d6c['shift']());}};_0x391ec1(++_0x1fd42b);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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 db=require(_0x65f6('0x3'))['db'];var utils=require(_0x65f6('0x4'));var logger=require(_0x65f6('0x5'))('rpc');var config=require(_0x65f6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65f6('0x7')][_0x65f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4ec221,_0x4ed98f,_0x1c0e12){return new BPromise(function(_0x2c6571,_0x112079){return client[_0x65f6('0x9')](_0x4ec221,_0x1c0e12)[_0x65f6('0xa')](function(_0x14f4c7){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x4ed98f,_0x65f6('0xb'));logger[_0x65f6('0xc')](_0x65f6('0xd'),_0x4ed98f,_0x65f6('0xb'),JSON['stringify'](_0x14f4c7));if(_0x14f4c7[_0x65f6('0xe')]){if(_0x14f4c7['error']['code']===0x1f4){logger[_0x65f6('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x4ed98f,_0x14f4c7[_0x65f6('0xe')]['message']);return _0x112079(_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);}logger[_0x65f6('0xe')](_0x65f6('0x10'),_0x4ed98f,_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);return _0x2c6571(_0x14f4c7[_0x65f6('0xe')][_0x65f6('0xf')]);}else{logger[_0x65f6('0x11')](_0x65f6('0x10'),_0x4ed98f,'request\x20sent');_0x2c6571(_0x14f4c7[_0x65f6('0x12')]['message']);}})['catch'](function(_0x1693e6){logger[_0x65f6('0xe')](_0x65f6('0x10'),_0x4ed98f,_0x1693e6);_0x112079(_0x1693e6);});});}exports[_0x65f6('0x13')]=function(_0x1b1cbb){var _0x1f974c=this;return new Promise(function(_0xc8660c,_0x18380e){return db['VoiceDialReport']['create'](_0x1b1cbb[_0x65f6('0x14')],{'raw':_0x1b1cbb['options']?_0x1b1cbb['options']['raw']===undefined?!![]:![]:!![]})[_0x65f6('0xa')](function(_0x21ea88){logger['info'](_0x65f6('0x13'),_0x1b1cbb);logger[_0x65f6('0xc')](_0x65f6('0x13'),_0x1b1cbb,JSON[_0x65f6('0x15')](_0x21ea88));_0xc8660c(_0x21ea88);})[_0x65f6('0x16')](function(_0xc139c2){logger['error'](_0x65f6('0x13'),_0xc139c2['message'],_0x1b1cbb);_0x18380e(_0x1f974c['error'](0x1f4,_0xc139c2[_0x65f6('0xf')]));});});};exports[_0x65f6('0x17')]=function(_0x524e42){var _0x1eeaaa=this;return new Promise(function(_0x471a33,_0x2317ce){return db[_0x65f6('0x18')]['update'](_0x524e42[_0x65f6('0x14')],{'raw':_0x524e42[_0x65f6('0x19')]?_0x524e42[_0x65f6('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524e42['options']?_0x524e42['options'][_0x65f6('0x1a')]||null:null,'attributes':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1b')]||null:null,'limit':_0x524e42[_0x65f6('0x19')]?_0x524e42['options'][_0x65f6('0x1c')]||null:null})[_0x65f6('0xa')](function(_0x28d0df){logger['info']('UpdateVoiceDialReport',_0x524e42);logger['debug'](_0x65f6('0x17'),_0x524e42,JSON[_0x65f6('0x15')](_0x28d0df));_0x471a33(_0x28d0df);})[_0x65f6('0x16')](function(_0x408ccc){logger[_0x65f6('0xe')](_0x65f6('0x17'),_0x408ccc[_0x65f6('0xf')],_0x524e42);_0x2317ce(_0x1eeaaa['error'](0x1f4,_0x408ccc['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d5e9e56..9b0783a 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 _0x1d98=['show','post','/:id/applications','addApplications','put','update','destroy','exports','multer','util','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1d98,0x116));var _0x81d9=function(_0x303d0a,_0x18ecc4){_0x303d0a=_0x303d0a-0x0;var _0x162298=_0x1d98[_0x303d0a];return _0x162298;};'use strict';var multer=require(_0x81d9('0x0'));var util=require(_0x81d9('0x1'));var path=require('path');var express=require(_0x81d9('0x2'));var router=express[_0x81d9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x81d9('0x4'));var config=require(_0x81d9('0x5'));var controller=require('./voiceExtension.controller');router[_0x81d9('0x6')]('/',auth[_0x81d9('0x7')](),controller[_0x81d9('0x8')]);router[_0x81d9('0x6')](_0x81d9('0x9'),auth[_0x81d9('0x7')](),controller[_0x81d9('0xa')]);router[_0x81d9('0xb')]('/',auth[_0x81d9('0x7')](),controller['create']);router[_0x81d9('0xb')](_0x81d9('0xc'),auth['isAuthenticated'](),controller[_0x81d9('0xd')]);router[_0x81d9('0xe')](_0x81d9('0x9'),auth['isAuthenticated'](),controller[_0x81d9('0xf')]);router['delete']('/:id',auth[_0x81d9('0x7')](),controller[_0x81d9('0x10')]);module[_0x81d9('0x11')]=router; \ No newline at end of file +var _0x90d5=['isAuthenticated','create','post','/:id/applications','update','destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id'];(function(_0x30cf23,_0x1994a2){var _0x2123e4=function(_0x4f0cb1){while(--_0x4f0cb1){_0x30cf23['push'](_0x30cf23['shift']());}};_0x2123e4(++_0x1994a2);}(_0x90d5,0x14a));var _0x590d=function(_0xaa7a59,_0x5c644e){_0xaa7a59=_0xaa7a59-0x0;var _0x3c3a52=_0x90d5[_0xaa7a59];return _0x3c3a52;};'use strict';var multer=require(_0x590d('0x0'));var util=require('util');var path=require(_0x590d('0x1'));var express=require(_0x590d('0x2'));var router=express['Router']();var auth=require(_0x590d('0x3'));var interaction=require(_0x590d('0x4'));var config=require(_0x590d('0x5'));var controller=require(_0x590d('0x6'));router[_0x590d('0x7')]('/',auth['isAuthenticated'](),controller[_0x590d('0x8')]);router[_0x590d('0x7')](_0x590d('0x9'),auth[_0x590d('0xa')](),controller['show']);router['post']('/',auth[_0x590d('0xa')](),controller[_0x590d('0xb')]);router[_0x590d('0xc')](_0x590d('0xd'),auth[_0x590d('0xa')](),controller['addApplications']);router['put'](_0x590d('0x9'),auth[_0x590d('0xa')](),controller[_0x590d('0xe')]);router['delete'](_0x590d('0x9'),auth[_0x590d('0xa')](),controller[_0x590d('0xf')]);module[_0x590d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 10b9ba0..ffb7208 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 _0x8b96=['BOOLEAN','INTEGER','wav','exports','STRING','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax','system','any','*,*,*,*'];(function(_0x25e47d,_0x5e16c5){var _0x34216e=function(_0x47edef){while(--_0x47edef){_0x25e47d['push'](_0x25e47d['shift']());}};_0x34216e(++_0x5e16c5);}(_0x8b96,0x1ed));var _0x68b9=function(_0x20e7cd,_0x522b0e){_0x20e7cd=_0x20e7cd-0x0;var _0x18f2e0=_0x8b96[_0x20e7cd];return _0x18f2e0;};'use strict';var Sequelize=require('sequelize');module[_0x68b9('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x68b9('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x68b9('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x68b9('0x1')],'allowNull':![],'defaultValue':_0x68b9('0x2')},'appdata':{'type':Sequelize[_0x68b9('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x68b9('0x3')](_0x68b9('0x4'),_0x68b9('0x5'),'internal',_0x68b9('0x6'),_0x68b9('0x7'),_0x68b9('0x8'),_0x68b9('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x68b9('0x1')]},'interval':{'type':Sequelize[_0x68b9('0x1')],'allowNull':![],'defaultValue':_0x68b9('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x68b9('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x68b9('0x1')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x68b9('0xc')]},'recordingFormat':{'type':Sequelize[_0x68b9('0x1')],'defaultValue':_0x68b9('0xd')},'answer':{'type':Sequelize[_0x68b9('0xb')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1e81=['internal','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x54a542,_0x4b9e9e){var _0x386f0f=function(_0x13c7e0){while(--_0x13c7e0){_0x54a542['push'](_0x54a542['shift']());}};_0x386f0f(++_0x4b9e9e);}(_0x1e81,0x138));var _0x11e8=function(_0x2f63a0,_0x51855d){_0x2f63a0=_0x2f63a0-0x0;var _0x536ae8=_0x1e81[_0x2f63a0];return _0x536ae8;};'use strict';var Sequelize=require(_0x11e8('0x0'));module[_0x11e8('0x1')]={'context':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'unique':_0x11e8('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':_0x11e8('0x4')},'appdata':{'type':Sequelize[_0x11e8('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x11e8('0x5')](_0x11e8('0x6'),_0x11e8('0x7'),_0x11e8('0x8'),_0x11e8('0x9'),_0x11e8('0xa'),'system',_0x11e8('0xb')),'allowNull':![]},'description':{'type':Sequelize[_0x11e8('0x2')]},'interval':{'type':Sequelize[_0x11e8('0x2')],'allowNull':![],'defaultValue':_0x11e8('0xc')},'IntervalId':{'type':Sequelize[_0x11e8('0xd')]},'isApp':{'type':Sequelize[_0x11e8('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x11e8('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x11e8('0x2')],'defaultValue':_0x11e8('0xf')},'answer':{'type':Sequelize[_0x11e8('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 33e3d02..fb742e2 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 _0xa9e0=['json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','VoiceExtension','length','find','create','body','type','outbound','startsWith','exten','concat','description','cutdigits','context','destroy','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voiceExtension.socket','sendStatus','status','end'];(function(_0x3c3c48,_0x2674b9){var _0x284910=function(_0x3dab53){while(--_0x3dab53){_0x3c3c48['push'](_0x3c3c48['shift']());}};_0x284910(++_0x2674b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var socket=require(_0x0a9e('0xf'))({'host':_0x0a9e('0x10'),'port':0x18eb});require(_0x0a9e('0x11'))['register'](socket);function respondWithStatusCode(_0x50dfb2,_0x527cdd){_0x527cdd=_0x527cdd||0xcc;return function(_0x4cfe67){if(_0x4cfe67){return _0x50dfb2[_0x0a9e('0x12')](_0x527cdd);}return _0x50dfb2[_0x0a9e('0x13')](_0x527cdd)[_0x0a9e('0x14')]();};}function respondWithResult(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xc8;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['status'](_0x32d742)[_0x0a9e('0x15')](_0x69aeb7);}};}function respondWithFilteredResult(_0x239b12,_0x2b4227){return function(_0x281129){if(_0x281129){var _0x44dcfd=_0x281129['count'],_0x4d5611=_0x2b4227[_0x0a9e('0x16')],_0x52a03d=_0x2b4227['offset']+_0x2b4227[_0x0a9e('0x17')],_0x22dccb;if(_0x52a03d>=_0x44dcfd){_0x52a03d=_0x44dcfd;_0x22dccb=0xc8;}else{_0x22dccb=0xce;}_0x239b12[_0x0a9e('0x13')](_0x22dccb);return _0x239b12['set'](_0x0a9e('0x18'),_0x4d5611+'-'+_0x52a03d+'/'+_0x44dcfd)['json'](_0x281129);}return null;};}function patchUpdates(_0x459eb1){return function(_0x478723){try{jsonpatch[_0x0a9e('0x19')](_0x478723,_0x459eb1,!![]);}catch(_0x205fd6){return BPromise[_0x0a9e('0x1a')](_0x205fd6);}return _0x478723[_0x0a9e('0x1b')]();};}function saveUpdates(_0x530eb7,_0x20559e){return function(_0x1314ae){if(_0x1314ae){return _0x1314ae[_0x0a9e('0x1c')](_0x530eb7)[_0x0a9e('0x1d')](function(_0x105080){return _0x105080;});}return null;};}function removeEntity(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['destroy']()[_0x0a9e('0x1d')](function(){_0x4bb1e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(!_0x38e7c4){_0x3a02e1[_0x0a9e('0x12')](0x194);}return _0x38e7c4;};}function handleError(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0x1f4;return function(_0x2fb0e4){logger[_0x0a9e('0x1e')](_0x2fb0e4[_0x0a9e('0x1f')]);if(_0x2fb0e4[_0x0a9e('0x20')]){delete _0x2fb0e4[_0x0a9e('0x20')];}_0x4abc77[_0x0a9e('0x13')](_0xfb6e48)['send'](_0x2fb0e4);};}exports['index']=function(_0x197ec0,_0x3a8e58){var _0x40c424={},_0x33161b={},_0x526cf3={'count':0x0,'rows':[]};var _0x384319=db['VoiceExtension'][_0x0a9e('0x21')];_0x33161b['model']=_[_0x0a9e('0x22')](_0x384319);var _0x34dc65={'dateStart':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')],'dateEnd':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x25')]};delete _0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')];delete _0x197ec0['query'][_0x0a9e('0x25')];_0x33161b[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x197ec0[_0x0a9e('0x23')]);_0x33161b['filters']=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],_0x33161b[_0x0a9e('0x23')]);_0x40c424[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x40c424['attributes']=_0x40c424[_0x0a9e('0x28')]['length']?_0x40c424[_0x0a9e('0x28')]:_0x33161b[_0x0a9e('0x27')];if(!_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){_0x40c424['limit']=qs[_0x0a9e('0x17')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x17')]);_0x40c424[_0x0a9e('0x16')]=qs[_0x0a9e('0x16')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x16')]);}_0x40c424[_0x0a9e('0x2c')]=qs['sort'](_0x197ec0[_0x0a9e('0x23')]['sort']);_0x40c424[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x197ec0[_0x0a9e('0x23')],_0x33161b['filters']));if(_0x34dc65[_0x0a9e('0x24')]){if(_0x34dc65[_0x0a9e('0x25')]){_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65[_0x0a9e('0x25')])['add'](0x1,'day');}else{_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65['dateStart'])[_0x0a9e('0x30')](0x1,_0x0a9e('0x31'));}_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'createdAt':{'$gte':_0x34dc65['dateStart'],'$lte':_0x34dc65[_0x0a9e('0x25')]}});}if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x33')]){_0x40c424['where']=_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'$or':_[_0x0a9e('0x34')](_0x40c424['attributes'],function(_0x546ef8){var _0x11b61d={};_0x11b61d[_0x546ef8]={'$like':'%'+_0x197ec0[_0x0a9e('0x23')]['filter']+'%'};return _0x11b61d;})});}_0x40c424=_[_0x0a9e('0x32')]({},_0x40c424,_0x197ec0[_0x0a9e('0x35')]);var _0x2e1b3a={'where':_0x40c424[_0x0a9e('0x2d')]};return db['VoiceExtension']['count'](_0x2e1b3a)[_0x0a9e('0x1d')](function(_0x45b3d0){_0x526cf3['count']=_0x45b3d0;if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x40c424[_0x0a9e('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0a9e('0x38')](_0x40c424);})[_0x0a9e('0x1d')](function(_0x274e8e){_0x526cf3[_0x0a9e('0x39')]=_0x274e8e;return _0x526cf3;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3a8e58,_0x40c424))[_0x0a9e('0x3a')](handleError(_0x3a8e58,null));};exports[_0x0a9e('0x3b')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x3c')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x27')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x3d')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x22')](_0x45a9b8[_0x0a9e('0x23')]);_0x2c3711[_0x0a9e('0x2e')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],_0x2c3711[_0x0a9e('0x23')]);_0x3da2cd[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x28')][_0x0a9e('0x3e')]?_0x3da2cd[_0x0a9e('0x28')]:_0x2c3711[_0x0a9e('0x27')];if(_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x3da2cd[_0x0a9e('0x37')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x32')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x3d')]['find'](_0x3da2cd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x1d')](respondWithResult(_0x23b089,null))[_0x0a9e('0x3a')](handleError(_0x23b089,null));};exports['destroy']=function(_0x14bec2,_0x7f6eb1){return db[_0x0a9e('0x3d')][_0x0a9e('0x3f')]({'where':{'id':_0x14bec2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x1d')](removeEntity(_0x7f6eb1,null))['catch'](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x40')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x42')]===_0x0a9e('0x43')&&!_[_0x0a9e('0x44')](_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x45')],'_')){_0x1bde3c['body'][_0x0a9e('0x45')]='_'[_0x0a9e('0x46')](_0x1bde3c['body']['exten']);}return db['VoiceExtension'][_0x0a9e('0x40')](_0x1bde3c[_0x0a9e('0x41')],{'raw':![]})[_0x0a9e('0x1d')](respondWithResult(_0x1b5e80,0xc9))[_0x0a9e('0x3a')](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1c')]=function(_0x30decb,_0x2e5165){if(_0x30decb[_0x0a9e('0x41')]['id']){delete _0x30decb['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x30decb[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2e5165,null))[_0x0a9e('0x1d')](function(_0x5bb3ed){if(_0x5bb3ed){return db[_0x0a9e('0x3d')][_0x0a9e('0x1c')](_['pick'](_0x30decb['body'],[_0x0a9e('0x45'),'context',_0x0a9e('0x47'),'recordingFormat',_0x0a9e('0x48')]),{'where':{'context':_0x5bb3ed[_0x0a9e('0x49')],'exten':_0x5bb3ed[_0x0a9e('0x45')]},'individualHooks':!![]})['then'](function(_0x2f82da){return _0x2f82da;});}return null;})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports['addApplications']=function(_0x128aa6,_0x3aedd0,_0x49c095){return db[_0x0a9e('0x3d')]['findOne']({'where':{'id':_0x128aa6[_0x0a9e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3aedd0,null))[_0x0a9e('0x1d')](function(_0x4a6deb){if(_0x4a6deb){return db['sequelize']['transaction'](function(_0x2da03c){return db['VoiceExtension'][_0x0a9e('0x4a')]({'where':{'VoiceExtensionId':_0x128aa6[_0x0a9e('0x3c')]['id']},'transaction':_0x2da03c})[_0x0a9e('0x1d')](function(_0x19b4df){var _0x232830=_[_0x0a9e('0x34')](_0x128aa6[_0x0a9e('0x41')],function(_0x28d814){_0x28d814['VoiceExtensionId']=_0x128aa6[_0x0a9e('0x3c')]['id'];return _0x28d814;});return db[_0x0a9e('0x3d')][_0x0a9e('0x4b')](_0x232830,{'transaction':_0x2da03c});});})[_0x0a9e('0x1d')](function(){return db[_0x0a9e('0x3d')][_0x0a9e('0x4c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x128aa6['params']['id']},'order':_0x0a9e('0x4d')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,null))['catch'](handleError(_0x3aedd0,null));}; \ No newline at end of file +var _0xa9e0=['json','offset','limit','Content-Range','apply','reject','save','update','then','error','stack','name','rawAttributes','keys','query','dateStart','dateEnd','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','add','day','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','VoiceExtension','length','find','create','body','type','outbound','startsWith','exten','concat','description','cutdigits','context','destroy','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','localhost','./voiceExtension.socket','sendStatus','status','end'];(function(_0x492837,_0x514e8e){var _0x44f215=function(_0x527acb){while(--_0x527acb){_0x492837['push'](_0x492837['shift']());}};_0x44f215(++_0x514e8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];var socket=require(_0x0a9e('0xf'))({'host':_0x0a9e('0x10'),'port':0x18eb});require(_0x0a9e('0x11'))['register'](socket);function respondWithStatusCode(_0x50dfb2,_0x527cdd){_0x527cdd=_0x527cdd||0xcc;return function(_0x4cfe67){if(_0x4cfe67){return _0x50dfb2[_0x0a9e('0x12')](_0x527cdd);}return _0x50dfb2[_0x0a9e('0x13')](_0x527cdd)[_0x0a9e('0x14')]();};}function respondWithResult(_0x26d672,_0x32d742){_0x32d742=_0x32d742||0xc8;return function(_0x69aeb7){if(_0x69aeb7){return _0x26d672['status'](_0x32d742)[_0x0a9e('0x15')](_0x69aeb7);}};}function respondWithFilteredResult(_0x239b12,_0x2b4227){return function(_0x281129){if(_0x281129){var _0x44dcfd=_0x281129['count'],_0x4d5611=_0x2b4227[_0x0a9e('0x16')],_0x52a03d=_0x2b4227['offset']+_0x2b4227[_0x0a9e('0x17')],_0x22dccb;if(_0x52a03d>=_0x44dcfd){_0x52a03d=_0x44dcfd;_0x22dccb=0xc8;}else{_0x22dccb=0xce;}_0x239b12[_0x0a9e('0x13')](_0x22dccb);return _0x239b12['set'](_0x0a9e('0x18'),_0x4d5611+'-'+_0x52a03d+'/'+_0x44dcfd)['json'](_0x281129);}return null;};}function patchUpdates(_0x459eb1){return function(_0x478723){try{jsonpatch[_0x0a9e('0x19')](_0x478723,_0x459eb1,!![]);}catch(_0x205fd6){return BPromise[_0x0a9e('0x1a')](_0x205fd6);}return _0x478723[_0x0a9e('0x1b')]();};}function saveUpdates(_0x530eb7,_0x20559e){return function(_0x1314ae){if(_0x1314ae){return _0x1314ae[_0x0a9e('0x1c')](_0x530eb7)[_0x0a9e('0x1d')](function(_0x105080){return _0x105080;});}return null;};}function removeEntity(_0x4bb1e3,_0x2c3407){return function(_0x155cce){if(_0x155cce){return _0x155cce['destroy']()[_0x0a9e('0x1d')](function(){_0x4bb1e3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a02e1,_0x432e56){return function(_0x38e7c4){if(!_0x38e7c4){_0x3a02e1[_0x0a9e('0x12')](0x194);}return _0x38e7c4;};}function handleError(_0x4abc77,_0xfb6e48){_0xfb6e48=_0xfb6e48||0x1f4;return function(_0x2fb0e4){logger[_0x0a9e('0x1e')](_0x2fb0e4[_0x0a9e('0x1f')]);if(_0x2fb0e4[_0x0a9e('0x20')]){delete _0x2fb0e4[_0x0a9e('0x20')];}_0x4abc77[_0x0a9e('0x13')](_0xfb6e48)['send'](_0x2fb0e4);};}exports['index']=function(_0x197ec0,_0x3a8e58){var _0x40c424={},_0x33161b={},_0x526cf3={'count':0x0,'rows':[]};var _0x384319=db['VoiceExtension'][_0x0a9e('0x21')];_0x33161b['model']=_[_0x0a9e('0x22')](_0x384319);var _0x34dc65={'dateStart':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')],'dateEnd':_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x25')]};delete _0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x24')];delete _0x197ec0['query'][_0x0a9e('0x25')];_0x33161b[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x197ec0[_0x0a9e('0x23')]);_0x33161b['filters']=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],_0x33161b[_0x0a9e('0x23')]);_0x40c424[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x33161b[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x40c424['attributes']=_0x40c424[_0x0a9e('0x28')]['length']?_0x40c424[_0x0a9e('0x28')]:_0x33161b[_0x0a9e('0x27')];if(!_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x2a')](_0x0a9e('0x2b'))){_0x40c424['limit']=qs[_0x0a9e('0x17')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x17')]);_0x40c424[_0x0a9e('0x16')]=qs[_0x0a9e('0x16')](_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x16')]);}_0x40c424[_0x0a9e('0x2c')]=qs['sort'](_0x197ec0[_0x0a9e('0x23')]['sort']);_0x40c424[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x197ec0[_0x0a9e('0x23')],_0x33161b['filters']));if(_0x34dc65[_0x0a9e('0x24')]){if(_0x34dc65[_0x0a9e('0x25')]){_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65[_0x0a9e('0x25')])['add'](0x1,'day');}else{_0x34dc65[_0x0a9e('0x25')]=moment(_0x34dc65['dateStart'])[_0x0a9e('0x30')](0x1,_0x0a9e('0x31'));}_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'createdAt':{'$gte':_0x34dc65['dateStart'],'$lte':_0x34dc65[_0x0a9e('0x25')]}});}if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x33')]){_0x40c424['where']=_[_0x0a9e('0x32')](_0x40c424[_0x0a9e('0x2d')],{'$or':_[_0x0a9e('0x34')](_0x40c424['attributes'],function(_0x546ef8){var _0x11b61d={};_0x11b61d[_0x546ef8]={'$like':'%'+_0x197ec0[_0x0a9e('0x23')]['filter']+'%'};return _0x11b61d;})});}_0x40c424=_[_0x0a9e('0x32')]({},_0x40c424,_0x197ec0[_0x0a9e('0x35')]);var _0x2e1b3a={'where':_0x40c424[_0x0a9e('0x2d')]};return db['VoiceExtension']['count'](_0x2e1b3a)[_0x0a9e('0x1d')](function(_0x45b3d0){_0x526cf3['count']=_0x45b3d0;if(_0x197ec0[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x40c424[_0x0a9e('0x37')]=[{'all':!![]}];}return db['VoiceExtension'][_0x0a9e('0x38')](_0x40c424);})[_0x0a9e('0x1d')](function(_0x274e8e){_0x526cf3[_0x0a9e('0x39')]=_0x274e8e;return _0x526cf3;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3a8e58,_0x40c424))[_0x0a9e('0x3a')](handleError(_0x3a8e58,null));};exports[_0x0a9e('0x3b')]=function(_0x45a9b8,_0x23b089){var _0x3da2cd={'raw':![],'where':{'id':_0x45a9b8[_0x0a9e('0x3c')]['id']}},_0x2c3711={};_0x2c3711[_0x0a9e('0x27')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x3d')]['rawAttributes']);_0x2c3711['query']=_[_0x0a9e('0x22')](_0x45a9b8[_0x0a9e('0x23')]);_0x2c3711[_0x0a9e('0x2e')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],_0x2c3711[_0x0a9e('0x23')]);_0x3da2cd[_0x0a9e('0x28')]=_[_0x0a9e('0x26')](_0x2c3711[_0x0a9e('0x27')],qs[_0x0a9e('0x29')](_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x3da2cd['attributes']=_0x3da2cd[_0x0a9e('0x28')][_0x0a9e('0x3e')]?_0x3da2cd[_0x0a9e('0x28')]:_0x2c3711[_0x0a9e('0x27')];if(_0x45a9b8[_0x0a9e('0x23')][_0x0a9e('0x36')]){_0x3da2cd[_0x0a9e('0x37')]=[{'all':!![]}];}_0x3da2cd=_[_0x0a9e('0x32')]({},_0x3da2cd,_0x45a9b8['options']);return db[_0x0a9e('0x3d')]['find'](_0x3da2cd)[_0x0a9e('0x1d')](handleEntityNotFound(_0x23b089,null))[_0x0a9e('0x1d')](respondWithResult(_0x23b089,null))[_0x0a9e('0x3a')](handleError(_0x23b089,null));};exports['destroy']=function(_0x14bec2,_0x7f6eb1){return db[_0x0a9e('0x3d')][_0x0a9e('0x3f')]({'where':{'id':_0x14bec2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x7f6eb1,null))[_0x0a9e('0x1d')](removeEntity(_0x7f6eb1,null))['catch'](handleError(_0x7f6eb1,null));};exports[_0x0a9e('0x40')]=function(_0x1bde3c,_0x1b5e80){if(_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x42')]===_0x0a9e('0x43')&&!_[_0x0a9e('0x44')](_0x1bde3c[_0x0a9e('0x41')][_0x0a9e('0x45')],'_')){_0x1bde3c['body'][_0x0a9e('0x45')]='_'[_0x0a9e('0x46')](_0x1bde3c['body']['exten']);}return db['VoiceExtension'][_0x0a9e('0x40')](_0x1bde3c[_0x0a9e('0x41')],{'raw':![]})[_0x0a9e('0x1d')](respondWithResult(_0x1b5e80,0xc9))[_0x0a9e('0x3a')](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1c')]=function(_0x30decb,_0x2e5165){if(_0x30decb[_0x0a9e('0x41')]['id']){delete _0x30decb['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x30decb[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x2e5165,null))[_0x0a9e('0x1d')](function(_0x5bb3ed){if(_0x5bb3ed){return db[_0x0a9e('0x3d')][_0x0a9e('0x1c')](_['pick'](_0x30decb['body'],[_0x0a9e('0x45'),'context',_0x0a9e('0x47'),'recordingFormat',_0x0a9e('0x48')]),{'where':{'context':_0x5bb3ed[_0x0a9e('0x49')],'exten':_0x5bb3ed[_0x0a9e('0x45')]},'individualHooks':!![]})['then'](function(_0x2f82da){return _0x2f82da;});}return null;})[_0x0a9e('0x1d')](respondWithStatusCode(_0x2e5165,null))['catch'](handleError(_0x2e5165,null));};exports['addApplications']=function(_0x128aa6,_0x3aedd0,_0x49c095){return db[_0x0a9e('0x3d')]['findOne']({'where':{'id':_0x128aa6[_0x0a9e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3aedd0,null))[_0x0a9e('0x1d')](function(_0x4a6deb){if(_0x4a6deb){return db['sequelize']['transaction'](function(_0x2da03c){return db['VoiceExtension'][_0x0a9e('0x4a')]({'where':{'VoiceExtensionId':_0x128aa6[_0x0a9e('0x3c')]['id']},'transaction':_0x2da03c})[_0x0a9e('0x1d')](function(_0x19b4df){var _0x232830=_[_0x0a9e('0x34')](_0x128aa6[_0x0a9e('0x41')],function(_0x28d814){_0x28d814['VoiceExtensionId']=_0x128aa6[_0x0a9e('0x3c')]['id'];return _0x28d814;});return db[_0x0a9e('0x3d')][_0x0a9e('0x4b')](_0x232830,{'transaction':_0x2da03c});});})[_0x0a9e('0x1d')](function(){return db[_0x0a9e('0x3d')][_0x0a9e('0x4c')]({'where':{'isApp':!![],'VoiceExtensionId':_0x128aa6['params']['id']},'order':_0x0a9e('0x4d')});});}})[_0x0a9e('0x1d')](respondWithResult(_0x3aedd0,null))['catch'](handleError(_0x3aedd0,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index fb57166..5275a16 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 _0xe849=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','remove'];(function(_0x2a907b,_0x325c21){var _0x3b022f=function(_0x3477d4){while(--_0x3477d4){_0x2a907b['push'](_0x2a907b['shift']());}};_0x3b022f(++_0x325c21);}(_0xe849,0x96));var _0x9e84=function(_0x1d1b02,_0x102069){_0x1d1b02=_0x1d1b02-0x0;var _0x10c68b=_0xe849[_0x1d1b02];return _0x10c68b;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x9e84('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9e84('0x1')](0x0);var events={'afterCreate':_0x9e84('0x2'),'afterUpdate':'update','afterDestroy':_0x9e84('0x3')};function emitEvent(_0x642e8){return function(_0x5f0ae4,_0x41a265,_0x5c4a3f){VoiceExtensionEvents[_0x9e84('0x4')](_0x642e8+':'+_0x5f0ae4['id'],_0x5f0ae4);VoiceExtensionEvents['emit'](_0x642e8,_0x5f0ae4);_0x5c4a3f(null);};}for(var e in events){if(events[_0x9e84('0x5')](e)){var event=events[e];VoiceExtension[_0x9e84('0x6')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x811f=['../../mysqldb','setMaxListeners','emit','hasOwnProperty'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0x811f,0x15c));var _0xf811=function(_0x2c16ab,_0xaa3f47){_0x2c16ab=_0x2c16ab-0x0;var _0x50d50c=_0x811f[_0x2c16ab];return _0x50d50c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xf811('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf811('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x10e10e){return function(_0x1a74d,_0x518884,_0x3c32a8){VoiceExtensionEvents[_0xf811('0x2')](_0x10e10e+':'+_0x1a74d['id'],_0x1a74d);VoiceExtensionEvents[_0xf811('0x2')](_0x10e10e,_0x1a74d);_0x3c32a8(null);};}for(var e in events){if(events[_0xf811('0x3')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8eea610..56146c1 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 _0x2b72=['lodash','../../config/logger','api','moment','bluebird','request-promise','exports','define','VoiceExtension','voice_extensions'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2b72,0x1cc));var _0x22b7=function(_0x2a9754,_0x365da6){_0x2a9754=_0x2a9754-0x0;var _0x5c44e9=_0x2b72[_0x2a9754];return _0x5c44e9;};'use strict';var _=require(_0x22b7('0x0'));var util=require('util');var logger=require(_0x22b7('0x1'))(_0x22b7('0x2'));var moment=require(_0x22b7('0x3'));var BPromise=require(_0x22b7('0x4'));var rp=require(_0x22b7('0x5'));var attributes=require('./voiceExtension.attributes');module[_0x22b7('0x6')]=function(_0x29533d,_0x34a241){return _0x29533d[_0x22b7('0x7')](_0x22b7('0x8'),attributes,{'tableName':_0x22b7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1615=['../../config/logger','bluebird','request-promise','./voiceExtension.attributes','exports','define','VoiceExtension'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x1615,0x12d));var _0x5161=function(_0x4e4641,_0x12beac){_0x4e4641=_0x4e4641-0x0;var _0x22f685=_0x1615[_0x4e4641];return _0x22f685;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5161('0x0'))('api');var moment=require('moment');var BPromise=require(_0x5161('0x1'));var rp=require(_0x5161('0x2'));var attributes=require(_0x5161('0x3'));module[_0x5161('0x4')]=function(_0x23aa3c,_0x5a2110){return _0x23aa3c[_0x5161('0x5')](_0x5161('0x6'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index a543c6b..74132ac 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 _0x3c81=['VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','model','map','lodash','util','bluebird','randomstring','../../config/environment','jayson/promise','client','http','socket.io-emitter','localhost','./voiceExtension.socket','request','then','info'];(function(_0x19b5ac,_0x13c6de){var _0x33ee2b=function(_0x2c7975){while(--_0x2c7975){_0x19b5ac['push'](_0x19b5ac['shift']());}};_0x33ee2b(++_0x13c6de);}(_0x3c81,0x102));var _0x13c8=function(_0x447f81,_0x390eff){_0x447f81=_0x447f81-0x0;var _0xe31838=_0x3c81[_0x447f81];return _0xe31838;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x13c8('0x4'));var jayson=require(_0x13c8('0x5'));var client=jayson[_0x13c8('0x6')][_0x13c8('0x7')]({'port':0x232a});var socket=require(_0x13c8('0x8'))({'host':_0x13c8('0x9'),'port':0x18eb});require(_0x13c8('0xa'))['register'](socket);function respondWithRpcPromise(_0x17c228,_0x4905c3,_0x380aed){return new BPromise(function(_0x296463,_0x189ce6){return client[_0x13c8('0xb')](_0x17c228,_0x380aed)[_0x13c8('0xc')](function(_0x13c717){logger[_0x13c8('0xd')](_0x13c8('0xe'),_0x4905c3,_0x13c8('0xf'));logger[_0x13c8('0x10')](_0x13c8('0x11'),_0x4905c3,_0x13c8('0xf'),JSON[_0x13c8('0x12')](_0x13c717));if(_0x13c717[_0x13c8('0x13')]){if(_0x13c717['error'][_0x13c8('0x14')]===0x1f4){logger[_0x13c8('0x13')](_0x13c8('0xe'),_0x4905c3,_0x13c717[_0x13c8('0x13')]['message']);return _0x189ce6(_0x13c717[_0x13c8('0x13')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x4905c3,_0x13c717[_0x13c8('0x13')]['message']);return _0x296463(_0x13c717[_0x13c8('0x13')][_0x13c8('0x15')]);}else{logger[_0x13c8('0xd')](_0x13c8('0xe'),_0x4905c3,'request\x20sent');_0x296463(_0x13c717[_0x13c8('0x16')][_0x13c8('0x15')]);}})[_0x13c8('0x17')](function(_0x3bc5a9){logger[_0x13c8('0x13')](_0x13c8('0xe'),_0x4905c3,_0x3bc5a9);_0x189ce6(_0x3bc5a9);});});}exports[_0x13c8('0x18')]=function(_0x251c38){var _0x34fbc0=this;return new Promise(function(_0x31d122,_0xe9386a){return db['VoiceExtension'][_0x13c8('0x19')]({'raw':_0x251c38[_0x13c8('0x1a')]?_0x251c38[_0x13c8('0x1a')][_0x13c8('0x1b')]===undefined?!![]:![]:!![],'where':_0x251c38['options']?_0x251c38[_0x13c8('0x1a')][_0x13c8('0x1c')]||null:null,'attributes':_0x251c38[_0x13c8('0x1a')]?_0x251c38[_0x13c8('0x1a')][_0x13c8('0x1d')]||null:null,'limit':_0x251c38[_0x13c8('0x1a')]?_0x251c38['options'][_0x13c8('0x1e')]||null:null,'include':_0x251c38[_0x13c8('0x1a')]?_0x251c38[_0x13c8('0x1a')][_0x13c8('0x1f')]?_['map'](_0x251c38[_0x13c8('0x1a')][_0x13c8('0x1f')],function(_0x4e392f){return{'model':db[_0x4e392f['model']],'as':_0x4e392f['as'],'attributes':_0x4e392f[_0x13c8('0x1d')],'include':_0x4e392f[_0x13c8('0x1f')]?_['map'](_0x4e392f['include'],function(_0x288c3c){return{'model':db[_0x288c3c[_0x13c8('0x20')]],'as':_0x288c3c['as'],'attributes':_0x288c3c['attributes'],'include':_0x288c3c['include']?_[_0x13c8('0x21')](_0x288c3c['include'],function(_0x545b47){return{'model':db[_0x545b47[_0x13c8('0x20')]],'as':_0x545b47['as'],'attributes':_0x545b47[_0x13c8('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x13c8('0xc')](function(_0x560ede){logger['info'](_0x13c8('0x18'),_0x251c38);logger[_0x13c8('0x10')](_0x13c8('0x18'),_0x251c38,JSON[_0x13c8('0x12')](_0x560ede));_0x31d122(_0x560ede);})[_0x13c8('0x17')](function(_0x220d40){logger[_0x13c8('0x13')]('GetVoiceExtension',_0x220d40[_0x13c8('0x15')],_0x251c38);_0xe9386a(_0x34fbc0[_0x13c8('0x13')](0x1f4,_0x220d40['message']));});});}; \ No newline at end of file +var _0xbdb7=['include','map','model','GetVoiceExtension','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','socket.io-emitter','localhost','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','VoiceExtension','findAll','options','where','attributes','limit'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xbdb7[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var db=require(_0x7bdb('0x5'))['db'];var utils=require(_0x7bdb('0x6'));var logger=require(_0x7bdb('0x7'))(_0x7bdb('0x8'));var config=require('../../config/environment');var jayson=require(_0x7bdb('0x9'));var client=jayson['client']['http']({'port':0x232a});var socket=require(_0x7bdb('0xa'))({'host':_0x7bdb('0xb'),'port':0x18eb});require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x468041,_0x11a877,_0x530f81){return new BPromise(function(_0x4a3116,_0xdc2ffc){return client[_0x7bdb('0xc')](_0x468041,_0x530f81)[_0x7bdb('0xd')](function(_0x2c328e){logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x11a877,_0x7bdb('0x10'));logger[_0x7bdb('0x11')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x11a877,'request\x20sent',JSON['stringify'](_0x2c328e));if(_0x2c328e[_0x7bdb('0x12')]){if(_0x2c328e[_0x7bdb('0x12')]['code']===0x1f4){logger[_0x7bdb('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x11a877,_0x2c328e['error'][_0x7bdb('0x13')]);return _0xdc2ffc(_0x2c328e[_0x7bdb('0x12')]['message']);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x11a877,_0x2c328e[_0x7bdb('0x12')][_0x7bdb('0x13')]);return _0x4a3116(_0x2c328e[_0x7bdb('0x12')][_0x7bdb('0x13')]);}else{logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x11a877,_0x7bdb('0x10'));_0x4a3116(_0x2c328e[_0x7bdb('0x14')]['message']);}})[_0x7bdb('0x15')](function(_0x43f352){logger[_0x7bdb('0x12')](_0x7bdb('0xf'),_0x11a877,_0x43f352);_0xdc2ffc(_0x43f352);});});}exports['GetVoiceExtension']=function(_0x41f540){var _0x23e9eb=this;return new Promise(function(_0x5b8481,_0x3e5f8e){return db[_0x7bdb('0x16')][_0x7bdb('0x17')]({'raw':_0x41f540[_0x7bdb('0x18')]?_0x41f540[_0x7bdb('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x19')]||null:null,'attributes':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1a')]||null:null,'limit':_0x41f540[_0x7bdb('0x18')]?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1b')]||null:null,'include':_0x41f540['options']?_0x41f540[_0x7bdb('0x18')][_0x7bdb('0x1c')]?_[_0x7bdb('0x1d')](_0x41f540[_0x7bdb('0x18')]['include'],function(_0x4d6e44){return{'model':db[_0x4d6e44[_0x7bdb('0x1e')]],'as':_0x4d6e44['as'],'attributes':_0x4d6e44['attributes'],'include':_0x4d6e44['include']?_['map'](_0x4d6e44[_0x7bdb('0x1c')],function(_0x51ab04){return{'model':db[_0x51ab04[_0x7bdb('0x1e')]],'as':_0x51ab04['as'],'attributes':_0x51ab04[_0x7bdb('0x1a')],'include':_0x51ab04[_0x7bdb('0x1c')]?_[_0x7bdb('0x1d')](_0x51ab04[_0x7bdb('0x1c')],function(_0x523869){return{'model':db[_0x523869[_0x7bdb('0x1e')]],'as':_0x523869['as'],'attributes':_0x523869[_0x7bdb('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7bdb('0xd')](function(_0xe1141d){logger[_0x7bdb('0xe')](_0x7bdb('0x1f'),_0x41f540);logger[_0x7bdb('0x11')](_0x7bdb('0x1f'),_0x41f540,JSON[_0x7bdb('0x20')](_0xe1141d));_0x5b8481(_0xe1141d);})[_0x7bdb('0x15')](function(_0x9ec48d){logger[_0x7bdb('0x12')]('GetVoiceExtension',_0x9ec48d[_0x7bdb('0x13')],_0x41f540);_0x3e5f8e(_0x23e9eb[_0x7bdb('0x12')](0x1f4,_0x9ec48d[_0x7bdb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 7ce9e54..7cd372c 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 _0x33a4=['removeListener','register','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x29e54f,_0x33535a){var _0x4c619f=function(_0xc98342){while(--_0xc98342){_0x29e54f['push'](_0x29e54f['shift']());}};_0x4c619f(++_0x33535a);}(_0x33a4,0x17b));var _0x433a=function(_0x4217c8,_0x399fee){_0x4217c8=_0x4217c8-0x0;var _0x26a596=_0x33a4[_0x4217c8];return _0x26a596;};'use strict';var VoiceExtensionEvents=require(_0x433a('0x0'));var events=[_0x433a('0x1'),_0x433a('0x2'),_0x433a('0x3')];function createListener(_0x260d59,_0xaf64ac){return function(_0xe7cdcf){_0xaf64ac[_0x433a('0x4')](_0x260d59,_0xe7cdcf);};}function removeListener(_0x1cc7fb,_0x5144c8){return function(){VoiceExtensionEvents[_0x433a('0x5')](_0x1cc7fb,_0x5144c8);};}exports[_0x433a('0x6')]=function(_0x45d555){for(var _0x1be82f=0x0,_0x3292e8=events['length'];_0x1be82f<_0x3292e8;_0x1be82f++){var _0xeb54cc=events[_0x1be82f];var _0x72e280=createListener(_0x433a('0x7')+_0xeb54cc,_0x45d555);VoiceExtensionEvents['on'](_0xeb54cc,_0x72e280);}}; \ No newline at end of file +var _0xb417=['voiceExtension:','./voiceExtension.events','save','update','length'];(function(_0x3efd4d,_0x2d127b){var _0x38c6b7=function(_0x2387b1){while(--_0x2387b1){_0x3efd4d['push'](_0x3efd4d['shift']());}};_0x38c6b7(++_0x2d127b);}(_0xb417,0x17d));var _0x7b41=function(_0x3bd497,_0x37d7a8){_0x3bd497=_0x3bd497-0x0;var _0x32f967=_0xb417[_0x3bd497];return _0x32f967;};'use strict';var VoiceExtensionEvents=require(_0x7b41('0x0'));var events=[_0x7b41('0x1'),'remove',_0x7b41('0x2')];function createListener(_0x1a71ec,_0x2aeacd){return function(_0x298ff5){_0x2aeacd['emit'](_0x1a71ec,_0x298ff5);};}function removeListener(_0x2dc5a0,_0x5c19d2){return function(){VoiceExtensionEvents['removeListener'](_0x2dc5a0,_0x5c19d2);};}exports['register']=function(_0x14d2c5){for(var _0x21896e=0x0,_0x330a15=events[_0x7b41('0x3')];_0x21896e<_0x330a15;_0x21896e++){var _0x719f0e=events[_0x21896e];var _0x1856e9=createListener(_0x7b41('0x4')+_0x719f0e,_0x14d2c5);VoiceExtensionEvents['on'](_0x719f0e,_0x1856e9);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 11672c9..c40067e 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 _0xa9e0=['/:id','show','create','put','update','exports','multer','util','path','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x312634,_0x165c8e){var _0x34a887=function(_0x319519){while(--_0x319519){_0x312634['push'](_0x312634['shift']());}};_0x34a887(++_0x165c8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/messages',auth[_0x0a9e('0x7')](),controller['getMessages']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a9e('0xe')]=router; \ No newline at end of file +var _0xa9e0=['/:id','show','create','put','update','exports','multer','util','path','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x33e4a7,_0x2e80a2){var _0x598620=function(_0x65d618){while(--_0x65d618){_0x33e4a7['push'](_0x33e4a7['shift']());}};_0x598620(++_0x2e80a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['get']('/:id/messages',auth[_0x0a9e('0x7')](),controller['getMessages']);router['post']('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x0a9e('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9a9ee1e..2bc597c 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 _0x9fcb=['from-voicemail','contest_mailbox','email','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','sequelize','exports','STRING'];(function(_0x232c4f,_0x4c4d15){var _0x824a13=function(_0x566d7e){while(--_0x566d7e){_0x232c4f['push'](_0x232c4f['shift']());}};_0x824a13(++_0x4c4d15);}(_0x9fcb,0x1dd));var _0xb9fc=function(_0x1c0567,_0x4c323f){_0x1c0567=_0x1c0567-0x0;var _0x504619=_0x9fcb[_0x1c0567];return _0x504619;};'use strict';var Sequelize=require(_0xb9fc('0x0'));module[_0xb9fc('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb9fc('0x2')],'defaultValue':_0xb9fc('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xb9fc('0x2')],'defaultValue':'','allowNull':![],'unique':_0xb9fc('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xb9fc('0x2')]},'email':{'type':Sequelize[_0xb9fc('0x2')],'validate':{'isEmail':!![]},'set':function(_0x323bcf){this['setDataValue'](_0xb9fc('0x5'),typeof _0x323bcf==='string'&&_0x323bcf['trim']()?_0x323bcf['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xb9fc('0x2')],'defaultValue':_0xb9fc('0x6')},'attach':{'type':Sequelize['ENUM'](_0xb9fc('0x7'),'no'),'defaultValue':_0xb9fc('0x7'),'allowNull':![]},'saycid':{'type':Sequelize[_0xb9fc('0x8')]('yes','no'),'defaultValue':_0xb9fc('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xb9fc('0x2')]},'review':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xb9fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xb9fc('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xb9fc('0x8')](_0xb9fc('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xb9fc('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xb9fc('0x8')]('yes','no'),'defaultValue':_0xb9fc('0x7'),'allowNull':![]},'stamp':{'type':_0xb9fc('0xa')},'emailsubject':{'type':Sequelize[_0xb9fc('0x2')]},'emailbody':{'type':Sequelize[_0xb9fc('0x2')]},'name':{'type':Sequelize[_0xb9fc('0x2')]},'maxsecs':{'type':Sequelize[_0xb9fc('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xb9fc('0xb')](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file +var _0xa841=['TIMESTAMP','INTEGER','sequelize','exports','from-voicemail','contest_mailbox','STRING','email','trim','central','ENUM','yes','TINYINT(4)'];(function(_0x4f66ef,_0x3d47ef){var _0x34c6ec=function(_0x449aaf){while(--_0x449aaf){_0x4f66ef['push'](_0x4f66ef['shift']());}};_0x34c6ec(++_0x3d47ef);}(_0xa841,0x113));var _0x1a84=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xa841[_0x413feb];return _0x40ee88;};'use strict';var Sequelize=require(_0x1a84('0x0'));module[_0x1a84('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1a84('0x2'),'unique':_0x1a84('0x3')},'mailbox':{'type':Sequelize[_0x1a84('0x4')],'defaultValue':'','allowNull':![],'unique':_0x1a84('0x3')},'password':{'type':Sequelize[_0x1a84('0x4')]},'fullname':{'type':Sequelize[_0x1a84('0x4')]},'email':{'type':Sequelize[_0x1a84('0x4')],'validate':{'isEmail':!![]},'set':function(_0xdb77a3){this['setDataValue'](_0x1a84('0x5'),typeof _0xdb77a3==='string'&&_0xdb77a3[_0x1a84('0x6')]()?_0xdb77a3[_0x1a84('0x6')]():null);}},'pager':{'type':Sequelize[_0x1a84('0x4')]},'tz':{'type':Sequelize[_0x1a84('0x4')],'defaultValue':_0x1a84('0x7')},'attach':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x1a84('0x4')]},'review':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1a84('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1a84('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1a84('0x8')](_0x1a84('0x9'),'no'),'defaultValue':_0x1a84('0x9'),'allowNull':![]},'stamp':{'type':_0x1a84('0xb')},'emailsubject':{'type':Sequelize[_0x1a84('0x4')]},'emailbody':{'type':Sequelize[_0x1a84('0x4')]},'name':{'type':Sequelize[_0x1a84('0x4')]},'maxsecs':{'type':Sequelize[_0x1a84('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index c047866..bfef78b 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 _0xbabc=['jsforce','desk.js','querystring','../../config/logger','api','../../config/utils','../../mysqldb','status','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','sendStatus','error','stack','name','index','VoiceMail','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','add','day','merge','map','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','getMessages','findOne','VoiceMailMessage','filter','mailbox','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel'];(function(_0x2173a6,_0x30b04b){var _0x5b1c4c=function(_0x38109e){while(--_0x38109e){_0x2173a6['push'](_0x2173a6['shift']());}};_0x5b1c4c(++_0x30b04b);}(_0xbabc,0x151));var _0xcbab=function(_0x5bb0fe,_0x387a82){_0x5bb0fe=_0x5bb0fe-0x0;var _0x12e6d3=_0xbabc[_0x5bb0fe];return _0x12e6d3;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0xcbab('0x0'));var moment=require(_0xcbab('0x1'));var BPromise=require(_0xcbab('0x2'));var Mustache=require(_0xcbab('0x3'));var util=require('util');var path=require('path');var sox=require(_0xcbab('0x4'));var csv=require(_0xcbab('0x5'));var ejs=require(_0xcbab('0x6'));var fs=require('fs');var _=require('lodash');var squel=require(_0xcbab('0x7'));var crypto=require('crypto');var jsforce=require(_0xcbab('0x8'));var deskjs=require(_0xcbab('0x9'));var toCsv=require('to-csv');var querystring=require(_0xcbab('0xa'));var Papa=require('papaparse');var qs=require('../../components/parsers/qs');var logger=require(_0xcbab('0xb'))(_0xcbab('0xc'));var utils=require(_0xcbab('0xd'));var config=require('../../config/environment');var db=require(_0xcbab('0xe'))['db'];function respondWithStatusCode(_0x1abccc,_0x2b1d1f){_0x2b1d1f=_0x2b1d1f||0xcc;return function(_0x259082){if(_0x259082){return _0x1abccc['sendStatus'](_0x2b1d1f);}return _0x1abccc[_0xcbab('0xf')](_0x2b1d1f)['end']();};}function respondWithResult(_0x253b6e,_0x1306c3){_0x1306c3=_0x1306c3||0xc8;return function(_0x51ecba){if(_0x51ecba){return _0x253b6e[_0xcbab('0xf')](_0x1306c3)['json'](_0x51ecba);}};}function respondWithFilteredResult(_0x3c267c,_0x23528d){return function(_0x2a3c24){if(_0x2a3c24){var _0x586080=_0x2a3c24[_0xcbab('0x10')],_0x32b753=_0x23528d['offset'],_0x5b6b62=_0x23528d[_0xcbab('0x11')]+_0x23528d[_0xcbab('0x12')],_0x1bdb6c;if(_0x5b6b62>=_0x586080){_0x5b6b62=_0x586080;_0x1bdb6c=0xc8;}else{_0x1bdb6c=0xce;}_0x3c267c['status'](_0x1bdb6c);return _0x3c267c[_0xcbab('0x13')](_0xcbab('0x14'),_0x32b753+'-'+_0x5b6b62+'/'+_0x586080)[_0xcbab('0x15')](_0x2a3c24);}return null;};}function patchUpdates(_0x26db2d){return function(_0x3d5258){try{jsonpatch['apply'](_0x3d5258,_0x26db2d,!![]);}catch(_0x2f514f){return BPromise[_0xcbab('0x16')](_0x2f514f);}return _0x3d5258[_0xcbab('0x17')]();};}function saveUpdates(_0x12fdea,_0x21b11b){return function(_0x14af95){if(_0x14af95){return _0x14af95['update'](_0x12fdea)[_0xcbab('0x18')](function(_0x2de6d2){return _0x2de6d2;});}return null;};}function removeEntity(_0x7aa814,_0x527931){return function(_0x51dfba){if(_0x51dfba){return _0x51dfba[_0xcbab('0x19')]()['then'](function(){_0x7aa814[_0xcbab('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ee566,_0x1a82d0){return function(_0x21494e){if(!_0x21494e){_0x5ee566[_0xcbab('0x1a')](0x194);}return _0x21494e;};}function handleError(_0x1e1679,_0x52c68b){_0x52c68b=_0x52c68b||0x1f4;return function(_0x3c8d8){logger[_0xcbab('0x1b')](_0x3c8d8[_0xcbab('0x1c')]);if(_0x3c8d8[_0xcbab('0x1d')]){delete _0x3c8d8[_0xcbab('0x1d')];}_0x1e1679[_0xcbab('0xf')](_0x52c68b)['send'](_0x3c8d8);};}exports[_0xcbab('0x1e')]=function(_0x14f5ff,_0x1f1492){var _0x5e08ac={},_0xed6717={},_0x2fdcd4={'count':0x0,'rows':[]};var _0x52c64e=db[_0xcbab('0x1f')][_0xcbab('0x20')];_0xed6717[_0xcbab('0x21')]=_[_0xcbab('0x22')](_0x52c64e);var _0x45ae8b={'dateStart':_0x14f5ff[_0xcbab('0x23')][_0xcbab('0x24')],'dateEnd':_0x14f5ff[_0xcbab('0x23')][_0xcbab('0x25')]};delete _0x14f5ff['query'][_0xcbab('0x24')];delete _0x14f5ff[_0xcbab('0x23')]['dateEnd'];_0xed6717[_0xcbab('0x23')]=_['keys'](_0x14f5ff['query']);_0xed6717[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0xed6717[_0xcbab('0x21')],_0xed6717['query']);_0x5e08ac[_0xcbab('0x28')]=_[_0xcbab('0x27')](_0xed6717['model'],qs[_0xcbab('0x29')](_0x14f5ff['query']['fields']));_0x5e08ac[_0xcbab('0x28')]=_0x5e08ac[_0xcbab('0x28')][_0xcbab('0x2a')]?_0x5e08ac[_0xcbab('0x28')]:_0xed6717[_0xcbab('0x21')];if(!_0x14f5ff[_0xcbab('0x23')][_0xcbab('0x2b')](_0xcbab('0x2c'))){_0x5e08ac[_0xcbab('0x12')]=qs[_0xcbab('0x12')](_0x14f5ff[_0xcbab('0x23')]['limit']);_0x5e08ac[_0xcbab('0x11')]=qs[_0xcbab('0x11')](_0x14f5ff['query'][_0xcbab('0x11')]);}_0x5e08ac[_0xcbab('0x2d')]=qs[_0xcbab('0x2e')](_0x14f5ff[_0xcbab('0x23')][_0xcbab('0x2e')]);_0x5e08ac[_0xcbab('0x2f')]=qs['filters'](_[_0xcbab('0x30')](_0x14f5ff[_0xcbab('0x23')],_0xed6717[_0xcbab('0x26')]));if(_0x45ae8b[_0xcbab('0x24')]){if(_0x45ae8b[_0xcbab('0x25')]){_0x45ae8b[_0xcbab('0x25')]=moment(_0x45ae8b['dateEnd'])[_0xcbab('0x31')](0x1,_0xcbab('0x32'));}else{_0x45ae8b[_0xcbab('0x25')]=moment(_0x45ae8b['dateStart'])[_0xcbab('0x31')](0x1,_0xcbab('0x32'));}_[_0xcbab('0x33')](_0x5e08ac[_0xcbab('0x2f')],{'createdAt':{'$gte':_0x45ae8b[_0xcbab('0x24')],'$lte':_0x45ae8b[_0xcbab('0x25')]}});}if(_0x14f5ff['query']['filter']){_0x5e08ac[_0xcbab('0x2f')]=_['merge'](_0x5e08ac[_0xcbab('0x2f')],{'$or':_[_0xcbab('0x34')](_0x5e08ac['attributes'],function(_0x400fdf){var _0x5081a7={};_0x5081a7[_0x400fdf]={'$like':'%'+_0x14f5ff[_0xcbab('0x23')]['filter']+'%'};return _0x5081a7;})});}_0x5e08ac=_[_0xcbab('0x33')]({},_0x5e08ac,_0x14f5ff[_0xcbab('0x35')]);var _0x238aa2={'where':_0x5e08ac[_0xcbab('0x2f')]};return db[_0xcbab('0x1f')][_0xcbab('0x10')](_0x238aa2)[_0xcbab('0x18')](function(_0x4ffae9){_0x2fdcd4[_0xcbab('0x10')]=_0x4ffae9;if(_0x14f5ff[_0xcbab('0x23')][_0xcbab('0x36')]){_0x5e08ac[_0xcbab('0x37')]=[{'all':!![]}];}return db[_0xcbab('0x1f')][_0xcbab('0x38')](_0x5e08ac);})[_0xcbab('0x18')](function(_0x289e3f){_0x2fdcd4[_0xcbab('0x39')]=_0x289e3f;return _0x2fdcd4;})[_0xcbab('0x18')](respondWithFilteredResult(_0x1f1492,_0x5e08ac))['catch'](handleError(_0x1f1492,null));};exports[_0xcbab('0x3a')]=function(_0x3ffcc2,_0x23bf7d){var _0x46758f={'raw':!![],'where':{'id':_0x3ffcc2[_0xcbab('0x3b')]['id']}},_0x47b65b={};_0x47b65b['model']=_[_0xcbab('0x22')](db[_0xcbab('0x1f')][_0xcbab('0x20')]);_0x47b65b[_0xcbab('0x23')]=_[_0xcbab('0x22')](_0x3ffcc2['query']);_0x47b65b[_0xcbab('0x26')]=_['intersection'](_0x47b65b[_0xcbab('0x21')],_0x47b65b[_0xcbab('0x23')]);_0x46758f[_0xcbab('0x28')]=_['intersection'](_0x47b65b[_0xcbab('0x21')],qs['fields'](_0x3ffcc2[_0xcbab('0x23')][_0xcbab('0x29')]));_0x46758f['attributes']=_0x46758f['attributes']['length']?_0x46758f[_0xcbab('0x28')]:_0x47b65b[_0xcbab('0x21')];if(_0x3ffcc2[_0xcbab('0x23')][_0xcbab('0x36')]){_0x46758f['include']=[{'all':!![]}];}_0x46758f=_['merge']({},_0x46758f,_0x3ffcc2[_0xcbab('0x35')]);return db['VoiceMail'][_0xcbab('0x3c')](_0x46758f)[_0xcbab('0x18')](handleEntityNotFound(_0x23bf7d,null))[_0xcbab('0x18')](respondWithResult(_0x23bf7d,null))[_0xcbab('0x3d')](handleError(_0x23bf7d,null));};exports[_0xcbab('0x3e')]=function(_0x71abe6,_0x101952){return db['VoiceMail']['create'](_0x71abe6[_0xcbab('0x3f')],{})[_0xcbab('0x18')](respondWithResult(_0x101952,0xc9))[_0xcbab('0x3d')](handleError(_0x101952,null));};exports['update']=function(_0x3aa2c0,_0x24ac10){if(_0x3aa2c0[_0xcbab('0x3f')]['id']){delete _0x3aa2c0[_0xcbab('0x3f')]['id'];}return db[_0xcbab('0x1f')][_0xcbab('0x3c')]({'where':{'id':_0x3aa2c0[_0xcbab('0x3b')]['id']}})[_0xcbab('0x18')](handleEntityNotFound(_0x24ac10,null))[_0xcbab('0x18')](saveUpdates(_0x3aa2c0[_0xcbab('0x3f')],null))[_0xcbab('0x18')](respondWithResult(_0x24ac10,null))['catch'](handleError(_0x24ac10,null));};exports['destroy']=function(_0x5d8d2e,_0x3fa273){return db[_0xcbab('0x1f')][_0xcbab('0x3c')]({'where':{'id':_0x5d8d2e['params']['id']}})[_0xcbab('0x18')](handleEntityNotFound(_0x3fa273,null))[_0xcbab('0x18')](removeEntity(_0x3fa273,null))[_0xcbab('0x3d')](handleError(_0x3fa273,null));};exports[_0xcbab('0x40')]=function(_0x16c832,_0x43c52a,_0x2b1a08){return db['VoiceMail'][_0xcbab('0x41')]({'where':{'id':_0x16c832[_0xcbab('0x3b')]['id']}})[_0xcbab('0x18')](handleEntityNotFound(_0x43c52a,null))['then'](function(_0x28f6a2){var _0x42bf98;var _0x59a1d6={},_0x41d057={};_0x41d057[_0xcbab('0x21')]=_[_0xcbab('0x22')](db[_0xcbab('0x42')][_0xcbab('0x20')]);_0x41d057[_0xcbab('0x23')]=_[_0xcbab('0x22')](_0x16c832[_0xcbab('0x23')]);_0x41d057[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0x41d057[_0xcbab('0x21')],_0x41d057[_0xcbab('0x23')]);_0x59a1d6[_0xcbab('0x28')]=_['intersection'](_0x41d057[_0xcbab('0x21')],qs[_0xcbab('0x29')](_0x16c832['query']['fields']));_0x59a1d6['attributes']=_0x59a1d6[_0xcbab('0x28')]['length']?_0x59a1d6[_0xcbab('0x28')]:_0x41d057[_0xcbab('0x21')];if(!_0x16c832[_0xcbab('0x23')][_0xcbab('0x2b')](_0xcbab('0x2c'))){_0x59a1d6[_0xcbab('0x12')]=qs[_0xcbab('0x12')](_0x16c832[_0xcbab('0x23')][_0xcbab('0x12')]);_0x59a1d6[_0xcbab('0x11')]=qs[_0xcbab('0x11')](_0x16c832[_0xcbab('0x23')][_0xcbab('0x11')]);}_0x59a1d6[_0xcbab('0x2d')]=qs['sort'](_0x16c832[_0xcbab('0x23')][_0xcbab('0x2e')]);_0x59a1d6[_0xcbab('0x2f')]=qs['filters'](_[_0xcbab('0x30')](_0x16c832['query'],_0x41d057[_0xcbab('0x26')]));if(_0x16c832[_0xcbab('0x23')][_0xcbab('0x43')]){_0x59a1d6[_0xcbab('0x2f')]=_[_0xcbab('0x33')](_0x59a1d6[_0xcbab('0x2f')],{'$or':_[_0xcbab('0x34')](_0x59a1d6[_0xcbab('0x28')],function(_0x11dc81){var _0x5299ac={};_0x5299ac[_0x11dc81]={'$like':'%'+_0x16c832[_0xcbab('0x23')][_0xcbab('0x43')]+'%'};return _0x5299ac;})});}_0x59a1d6[_0xcbab('0x2f')]=_[_0xcbab('0x33')](_0x59a1d6[_0xcbab('0x2f')],{'mailboxuser':_0x28f6a2[_0xcbab('0x44')]});_0x59a1d6=_[_0xcbab('0x33')]({},_0x59a1d6,_0x16c832[_0xcbab('0x35')]);return db[_0xcbab('0x42')]['findAndCountAll'](_0x59a1d6)[_0xcbab('0x18')](respondWithFilteredResult(_0x43c52a,_0x59a1d6));})[_0xcbab('0x3d')](handleError(_0x43c52a,null));}; \ No newline at end of file +var _0xccf4=['status','json','count','offset','limit','reject','update','then','destroy','sendStatus','error','name','send','index','VoiceMail','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','order','sort','where','pick','day','add','merge','filter','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','VoiceMailMessage','hasOwnProperty','nolimit','mailbox','fast-json-patch','mustache','util','path','sox','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2ee052,_0x3f1484){var _0x39b8f7=function(_0x127d73){while(--_0x127d73){_0x2ee052['push'](_0x2ee052['shift']());}};_0x39b8f7(++_0x3f1484);}(_0xccf4,0x73));var _0x4ccf=function(_0x25e9cc,_0x21444c){_0x25e9cc=_0x25e9cc-0x0;var _0x464ec4=_0xccf4[_0x25e9cc];return _0x464ec4;};'use strict';var jsonpatch=require(_0x4ccf('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ccf('0x1'));var util=require(_0x4ccf('0x2'));var path=require(_0x4ccf('0x3'));var sox=require(_0x4ccf('0x4'));var csv=require('to-csv');var ejs=require(_0x4ccf('0x5'));var fs=require('fs');var _=require(_0x4ccf('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4ccf('0x7'));var deskjs=require(_0x4ccf('0x8'));var toCsv=require('to-csv');var querystring=require(_0x4ccf('0x9'));var Papa=require(_0x4ccf('0xa'));var qs=require(_0x4ccf('0xb'));var logger=require(_0x4ccf('0xc'))(_0x4ccf('0xd'));var utils=require(_0x4ccf('0xe'));var config=require(_0x4ccf('0xf'));var db=require(_0x4ccf('0x10'))['db'];function respondWithStatusCode(_0x4bc6bc,_0x517c92){_0x517c92=_0x517c92||0xcc;return function(_0x4e9417){if(_0x4e9417){return _0x4bc6bc['sendStatus'](_0x517c92);}return _0x4bc6bc[_0x4ccf('0x11')](_0x517c92)['end']();};}function respondWithResult(_0x5baece,_0x1f0def){_0x1f0def=_0x1f0def||0xc8;return function(_0xe9c50b){if(_0xe9c50b){return _0x5baece['status'](_0x1f0def)[_0x4ccf('0x12')](_0xe9c50b);}};}function respondWithFilteredResult(_0x4d8c16,_0x1c6333){return function(_0x2969d6){if(_0x2969d6){var _0x3d4368=_0x2969d6[_0x4ccf('0x13')],_0x332547=_0x1c6333[_0x4ccf('0x14')],_0x52f7f9=_0x1c6333[_0x4ccf('0x14')]+_0x1c6333[_0x4ccf('0x15')],_0x3ac864;if(_0x52f7f9>=_0x3d4368){_0x52f7f9=_0x3d4368;_0x3ac864=0xc8;}else{_0x3ac864=0xce;}_0x4d8c16['status'](_0x3ac864);return _0x4d8c16['set']('Content-Range',_0x332547+'-'+_0x52f7f9+'/'+_0x3d4368)['json'](_0x2969d6);}return null;};}function patchUpdates(_0x585526){return function(_0x22cf02){try{jsonpatch['apply'](_0x22cf02,_0x585526,!![]);}catch(_0x208ed6){return BPromise[_0x4ccf('0x16')](_0x208ed6);}return _0x22cf02['save']();};}function saveUpdates(_0x7cc964,_0x3b0aae){return function(_0x3ab333){if(_0x3ab333){return _0x3ab333[_0x4ccf('0x17')](_0x7cc964)[_0x4ccf('0x18')](function(_0x2d3cc2){return _0x2d3cc2;});}return null;};}function removeEntity(_0x61c56d,_0x50fef4){return function(_0x188a31){if(_0x188a31){return _0x188a31[_0x4ccf('0x19')]()['then'](function(){_0x61c56d[_0x4ccf('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de242,_0x3c3a91){return function(_0x5b891a){if(!_0x5b891a){_0x5de242[_0x4ccf('0x1a')](0x194);}return _0x5b891a;};}function handleError(_0x57c572,_0x5b85dc){_0x5b85dc=_0x5b85dc||0x1f4;return function(_0x3077fd){logger[_0x4ccf('0x1b')](_0x3077fd['stack']);if(_0x3077fd[_0x4ccf('0x1c')]){delete _0x3077fd[_0x4ccf('0x1c')];}_0x57c572[_0x4ccf('0x11')](_0x5b85dc)[_0x4ccf('0x1d')](_0x3077fd);};}exports[_0x4ccf('0x1e')]=function(_0x45a67c,_0x318f91){var _0x30760e={},_0x429d2b={},_0x1b0fd6={'count':0x0,'rows':[]};var _0x23216c=db[_0x4ccf('0x1f')]['rawAttributes'];_0x429d2b[_0x4ccf('0x20')]=_[_0x4ccf('0x21')](_0x23216c);var _0x4714cb={'dateStart':_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x23')],'dateEnd':_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x24')]};delete _0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x23')];delete _0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x24')];_0x429d2b[_0x4ccf('0x22')]=_[_0x4ccf('0x21')](_0x45a67c[_0x4ccf('0x22')]);_0x429d2b[_0x4ccf('0x25')]=_[_0x4ccf('0x26')](_0x429d2b[_0x4ccf('0x20')],_0x429d2b[_0x4ccf('0x22')]);_0x30760e[_0x4ccf('0x27')]=_['intersection'](_0x429d2b[_0x4ccf('0x20')],qs[_0x4ccf('0x28')](_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x28')]));_0x30760e[_0x4ccf('0x27')]=_0x30760e[_0x4ccf('0x27')][_0x4ccf('0x29')]?_0x30760e['attributes']:_0x429d2b[_0x4ccf('0x20')];if(!_0x45a67c[_0x4ccf('0x22')]['hasOwnProperty']('nolimit')){_0x30760e['limit']=qs['limit'](_0x45a67c[_0x4ccf('0x22')]['limit']);_0x30760e[_0x4ccf('0x14')]=qs[_0x4ccf('0x14')](_0x45a67c[_0x4ccf('0x22')]['offset']);}_0x30760e[_0x4ccf('0x2a')]=qs[_0x4ccf('0x2b')](_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x2b')]);_0x30760e[_0x4ccf('0x2c')]=qs['filters'](_[_0x4ccf('0x2d')](_0x45a67c[_0x4ccf('0x22')],_0x429d2b[_0x4ccf('0x25')]));if(_0x4714cb[_0x4ccf('0x23')]){if(_0x4714cb[_0x4ccf('0x24')]){_0x4714cb[_0x4ccf('0x24')]=moment(_0x4714cb[_0x4ccf('0x24')])['add'](0x1,_0x4ccf('0x2e'));}else{_0x4714cb['dateEnd']=moment(_0x4714cb[_0x4ccf('0x23')])[_0x4ccf('0x2f')](0x1,_0x4ccf('0x2e'));}_[_0x4ccf('0x30')](_0x30760e[_0x4ccf('0x2c')],{'createdAt':{'$gte':_0x4714cb['dateStart'],'$lte':_0x4714cb[_0x4ccf('0x24')]}});}if(_0x45a67c['query'][_0x4ccf('0x31')]){_0x30760e[_0x4ccf('0x2c')]=_['merge'](_0x30760e['where'],{'$or':_[_0x4ccf('0x32')](_0x30760e['attributes'],function(_0x15f04b){var _0x2edd01={};_0x2edd01[_0x15f04b]={'$like':'%'+_0x45a67c[_0x4ccf('0x22')]['filter']+'%'};return _0x2edd01;})});}_0x30760e=_[_0x4ccf('0x30')]({},_0x30760e,_0x45a67c[_0x4ccf('0x33')]);var _0x40462b={'where':_0x30760e[_0x4ccf('0x2c')]};return db[_0x4ccf('0x1f')][_0x4ccf('0x13')](_0x40462b)[_0x4ccf('0x18')](function(_0x20e67e){_0x1b0fd6['count']=_0x20e67e;if(_0x45a67c[_0x4ccf('0x22')][_0x4ccf('0x34')]){_0x30760e[_0x4ccf('0x35')]=[{'all':!![]}];}return db[_0x4ccf('0x1f')][_0x4ccf('0x36')](_0x30760e);})[_0x4ccf('0x18')](function(_0x3f9b32){_0x1b0fd6[_0x4ccf('0x37')]=_0x3f9b32;return _0x1b0fd6;})['then'](respondWithFilteredResult(_0x318f91,_0x30760e))[_0x4ccf('0x38')](handleError(_0x318f91,null));};exports[_0x4ccf('0x39')]=function(_0x5640a1,_0x53ba05){var _0x5459ab={'raw':!![],'where':{'id':_0x5640a1[_0x4ccf('0x3a')]['id']}},_0x13e72a={};_0x13e72a[_0x4ccf('0x20')]=_['keys'](db[_0x4ccf('0x1f')][_0x4ccf('0x3b')]);_0x13e72a['query']=_['keys'](_0x5640a1['query']);_0x13e72a[_0x4ccf('0x25')]=_[_0x4ccf('0x26')](_0x13e72a[_0x4ccf('0x20')],_0x13e72a[_0x4ccf('0x22')]);_0x5459ab['attributes']=_[_0x4ccf('0x26')](_0x13e72a[_0x4ccf('0x20')],qs[_0x4ccf('0x28')](_0x5640a1[_0x4ccf('0x22')]['fields']));_0x5459ab[_0x4ccf('0x27')]=_0x5459ab['attributes']['length']?_0x5459ab[_0x4ccf('0x27')]:_0x13e72a[_0x4ccf('0x20')];if(_0x5640a1[_0x4ccf('0x22')][_0x4ccf('0x34')]){_0x5459ab['include']=[{'all':!![]}];}_0x5459ab=_['merge']({},_0x5459ab,_0x5640a1[_0x4ccf('0x33')]);return db[_0x4ccf('0x1f')][_0x4ccf('0x3c')](_0x5459ab)[_0x4ccf('0x18')](handleEntityNotFound(_0x53ba05,null))[_0x4ccf('0x18')](respondWithResult(_0x53ba05,null))[_0x4ccf('0x38')](handleError(_0x53ba05,null));};exports['create']=function(_0x2e17ea,_0x338c95){return db['VoiceMail']['create'](_0x2e17ea['body'],{})['then'](respondWithResult(_0x338c95,0xc9))[_0x4ccf('0x38')](handleError(_0x338c95,null));};exports[_0x4ccf('0x17')]=function(_0x7867b0,_0x502dba){if(_0x7867b0[_0x4ccf('0x3d')]['id']){delete _0x7867b0[_0x4ccf('0x3d')]['id'];}return db['VoiceMail']['find']({'where':{'id':_0x7867b0[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x502dba,null))[_0x4ccf('0x18')](saveUpdates(_0x7867b0[_0x4ccf('0x3d')],null))['then'](respondWithResult(_0x502dba,null))[_0x4ccf('0x38')](handleError(_0x502dba,null));};exports[_0x4ccf('0x19')]=function(_0x4ce3c6,_0x5ba41b){return db[_0x4ccf('0x1f')][_0x4ccf('0x3c')]({'where':{'id':_0x4ce3c6[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x5ba41b,null))[_0x4ccf('0x18')](removeEntity(_0x5ba41b,null))[_0x4ccf('0x38')](handleError(_0x5ba41b,null));};exports['getMessages']=function(_0x6ed311,_0x225ef8,_0x35e13f){return db['VoiceMail']['findOne']({'where':{'id':_0x6ed311[_0x4ccf('0x3a')]['id']}})[_0x4ccf('0x18')](handleEntityNotFound(_0x225ef8,null))['then'](function(_0x30b88f){var _0x294120;var _0x4a82b3={},_0x4d76f8={};_0x4d76f8['model']=_[_0x4ccf('0x21')](db[_0x4ccf('0x3e')][_0x4ccf('0x3b')]);_0x4d76f8[_0x4ccf('0x22')]=_[_0x4ccf('0x21')](_0x6ed311[_0x4ccf('0x22')]);_0x4d76f8[_0x4ccf('0x25')]=_['intersection'](_0x4d76f8['model'],_0x4d76f8[_0x4ccf('0x22')]);_0x4a82b3['attributes']=_[_0x4ccf('0x26')](_0x4d76f8[_0x4ccf('0x20')],qs['fields'](_0x6ed311['query'][_0x4ccf('0x28')]));_0x4a82b3[_0x4ccf('0x27')]=_0x4a82b3[_0x4ccf('0x27')][_0x4ccf('0x29')]?_0x4a82b3[_0x4ccf('0x27')]:_0x4d76f8[_0x4ccf('0x20')];if(!_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x3f')](_0x4ccf('0x40'))){_0x4a82b3[_0x4ccf('0x15')]=qs['limit'](_0x6ed311[_0x4ccf('0x22')]['limit']);_0x4a82b3[_0x4ccf('0x14')]=qs['offset'](_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x14')]);}_0x4a82b3[_0x4ccf('0x2a')]=qs['sort'](_0x6ed311[_0x4ccf('0x22')]['sort']);_0x4a82b3[_0x4ccf('0x2c')]=qs[_0x4ccf('0x25')](_[_0x4ccf('0x2d')](_0x6ed311[_0x4ccf('0x22')],_0x4d76f8[_0x4ccf('0x25')]));if(_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x31')]){_0x4a82b3[_0x4ccf('0x2c')]=_[_0x4ccf('0x30')](_0x4a82b3[_0x4ccf('0x2c')],{'$or':_[_0x4ccf('0x32')](_0x4a82b3[_0x4ccf('0x27')],function(_0x28b643){var _0x473e55={};_0x473e55[_0x28b643]={'$like':'%'+_0x6ed311[_0x4ccf('0x22')][_0x4ccf('0x31')]+'%'};return _0x473e55;})});}_0x4a82b3[_0x4ccf('0x2c')]=_['merge'](_0x4a82b3[_0x4ccf('0x2c')],{'mailboxuser':_0x30b88f[_0x4ccf('0x41')]});_0x4a82b3=_[_0x4ccf('0x30')]({},_0x4a82b3,_0x6ed311[_0x4ccf('0x33')]);return db[_0x4ccf('0x3e')]['findAndCountAll'](_0x4a82b3)['then'](respondWithFilteredResult(_0x225ef8,_0x4a82b3));})[_0x4ccf('0x38')](handleError(_0x225ef8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index f671c1b..1127ed2 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 _0xfd97=['bluebird','request-promise','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','util','../../config/logger','api','moment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xfd97,0x96));var _0x7fd9=function(_0x40aa66,_0x2c7679){_0x40aa66=_0x40aa66-0x0;var _0x593df7=_0xfd97[_0x40aa66];return _0x593df7;};'use strict';var _=require('lodash');var util=require(_0x7fd9('0x0'));var logger=require(_0x7fd9('0x1'))(_0x7fd9('0x2'));var moment=require(_0x7fd9('0x3'));var BPromise=require(_0x7fd9('0x4'));var rp=require(_0x7fd9('0x5'));var attributes=require(_0x7fd9('0x6'));module[_0x7fd9('0x7')]=function(_0x2032d3,_0x1dccc1){return _0x2032d3[_0x7fd9('0x8')](_0x7fd9('0x9'),attributes,{'tableName':_0x7fd9('0xa'),'paranoid':![],'indexes':[{'name':_0x7fd9('0xb'),'fields':[_0x7fd9('0xc'),_0x7fd9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x13d3=['lodash','../../config/logger','api','bluebird','request-promise','exports','define','mailbox_context','mailbox','context'];(function(_0x1f90c0,_0x110e79){var _0x4d707d=function(_0x3acd00){while(--_0x3acd00){_0x1f90c0['push'](_0x1f90c0['shift']());}};_0x4d707d(++_0x110e79);}(_0x13d3,0x118));var _0x313d=function(_0x55234d,_0x1ea353){_0x55234d=_0x55234d-0x0;var _0x344a75=_0x13d3[_0x55234d];return _0x344a75;};'use strict';var _=require(_0x313d('0x0'));var util=require('util');var logger=require(_0x313d('0x1'))(_0x313d('0x2'));var moment=require('moment');var BPromise=require(_0x313d('0x3'));var rp=require(_0x313d('0x4'));var attributes=require('./voiceMail.attributes');module[_0x313d('0x5')]=function(_0x1003c3,_0x31cf0b){return _0x1003c3[_0x313d('0x6')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x313d('0x7'),'fields':[_0x313d('0x8'),_0x313d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 874287a..c701cbe 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 _0xbd6d=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird'];(function(_0x14f7fe,_0x5132c4){var _0x3d8309=function(_0x22f5c7){while(--_0x22f5c7){_0x14f7fe['push'](_0x14f7fe['shift']());}};_0x3d8309(++_0x5132c4);}(_0xbd6d,0x1c8));var _0xdbd6=function(_0x5b6576,_0x99240d){_0x5b6576=_0x5b6576-0x0;var _0x5dbcaf=_0xbd6d[_0x5b6576];return _0x5dbcaf;};'use strict';var _=require(_0xdbd6('0x0'));var util=require(_0xdbd6('0x1'));var moment=require(_0xdbd6('0x2'));var BPromise=require(_0xdbd6('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require(_0xdbd6('0x4'))['db'];var utils=require(_0xdbd6('0x5'));var logger=require('../../config/logger')(_0xdbd6('0x6'));var config=require(_0xdbd6('0x7'));var jayson=require(_0xdbd6('0x8'));var client=jayson['client'][_0xdbd6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57e3b7,_0x36343,_0x2f9562){return new BPromise(function(_0xbe219,_0x5c937c){return client['request'](_0x57e3b7,_0x2f9562)[_0xdbd6('0xa')](function(_0x3cc69b){logger[_0xdbd6('0xb')]('VoiceMail,\x20%s,\x20%s',_0x36343,_0xdbd6('0xc'));logger[_0xdbd6('0xd')](_0xdbd6('0xe'),_0x36343,_0xdbd6('0xc'),JSON['stringify'](_0x3cc69b));if(_0x3cc69b[_0xdbd6('0xf')]){if(_0x3cc69b[_0xdbd6('0xf')][_0xdbd6('0x10')]===0x1f4){logger[_0xdbd6('0xf')](_0xdbd6('0x11'),_0x36343,_0x3cc69b[_0xdbd6('0xf')][_0xdbd6('0x12')]);return _0x5c937c(_0x3cc69b[_0xdbd6('0xf')][_0xdbd6('0x12')]);}logger[_0xdbd6('0xf')]('VoiceMail,\x20%s,\x20%s',_0x36343,_0x3cc69b[_0xdbd6('0xf')][_0xdbd6('0x12')]);return _0xbe219(_0x3cc69b['error'][_0xdbd6('0x12')]);}else{logger[_0xdbd6('0xb')](_0xdbd6('0x11'),_0x36343,_0xdbd6('0xc'));_0xbe219(_0x3cc69b[_0xdbd6('0x13')][_0xdbd6('0x12')]);}})['catch'](function(_0x103c87){logger['error'](_0xdbd6('0x11'),_0x36343,_0x103c87);_0x5c937c(_0x103c87);});});} \ No newline at end of file +var _0xb06d=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xee5d2a,_0x534134){var _0x346948=function(_0x458fdf){while(--_0x458fdf){_0xee5d2a['push'](_0xee5d2a['shift']());}};_0x346948(++_0x534134);}(_0xb06d,0x19d));var _0xdb06=function(_0x39d91d,_0x32a478){_0x39d91d=_0x39d91d-0x0;var _0x179a84=_0xb06d[_0x39d91d];return _0x179a84;};'use strict';var _=require(_0xdb06('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xdb06('0x1'));var rs=require(_0xdb06('0x2'));var fs=require('fs');var db=require(_0xdb06('0x3'))['db'];var utils=require(_0xdb06('0x4'));var logger=require(_0xdb06('0x5'))(_0xdb06('0x6'));var config=require(_0xdb06('0x7'));var jayson=require(_0xdb06('0x8'));var client=jayson['client'][_0xdb06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3029bc,_0x43db2c,_0x2060c9){return new BPromise(function(_0x967268,_0x24b404){return client[_0xdb06('0xa')](_0x3029bc,_0x2060c9)['then'](function(_0x3c6090){logger[_0xdb06('0xb')]('VoiceMail,\x20%s,\x20%s',_0x43db2c,_0xdb06('0xc'));logger[_0xdb06('0xd')](_0xdb06('0xe'),_0x43db2c,'request\x20sent',JSON[_0xdb06('0xf')](_0x3c6090));if(_0x3c6090[_0xdb06('0x10')]){if(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x11')]===0x1f4){logger[_0xdb06('0x10')](_0xdb06('0x12'),_0x43db2c,_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);return _0x24b404(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);}logger[_0xdb06('0x10')](_0xdb06('0x12'),_0x43db2c,_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);return _0x967268(_0x3c6090[_0xdb06('0x10')][_0xdb06('0x13')]);}else{logger[_0xdb06('0xb')](_0xdb06('0x12'),_0x43db2c,'request\x20sent');_0x967268(_0x3c6090[_0xdb06('0x14')]['message']);}})[_0xdb06('0x15')](function(_0x24c736){logger['error'](_0xdb06('0x12'),_0x43db2c,_0x24c736);_0x24b404(_0x24c736);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 1f44824..2317975 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 _0xb44f=['./voiceMailMessage.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x395924,_0x58adf9){var _0x2edc62=function(_0x26ff7){while(--_0x26ff7){_0x395924['push'](_0x395924['shift']());}};_0x2edc62(++_0x58adf9);}(_0xb44f,0x81));var _0xfb44=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb44f[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xfb44('0x0'));var util=require(_0xfb44('0x1'));var path=require(_0xfb44('0x2'));var express=require(_0xfb44('0x3'));var router=express[_0xfb44('0x4')]();var auth=require(_0xfb44('0x5'));var interaction=require(_0xfb44('0x6'));var config=require('../../config/environment');var controller=require(_0xfb44('0x7'));router[_0xfb44('0x8')]('/',auth[_0xfb44('0x9')](),controller['index']);router[_0xfb44('0x8')](_0xfb44('0xa'),auth[_0xfb44('0x9')](),controller[_0xfb44('0xb')]);router['get']('/:id/download',auth[_0xfb44('0x9')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xfb44('0xc')]);router[_0xfb44('0xd')](_0xfb44('0xa'),auth[_0xfb44('0x9')](),controller['update']);router[_0xfb44('0xe')]('/:id',auth[_0xfb44('0x9')](),controller[_0xfb44('0xf')]);module[_0xfb44('0x10')]=router; \ No newline at end of file +var _0xe774=['destroy','exports','multer','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/download','download','create','put','update','/:id'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0xe774,0x156));var _0x4e77=function(_0x5d2bde,_0x172a7a){_0x5d2bde=_0x5d2bde-0x0;var _0x28e373=_0xe774[_0x5d2bde];return _0x28e373;};'use strict';var multer=require(_0x4e77('0x0'));var util=require(_0x4e77('0x1'));var path=require(_0x4e77('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x4e77('0x3'));var interaction=require(_0x4e77('0x4'));var config=require(_0x4e77('0x5'));var controller=require('./voiceMailMessage.controller');router[_0x4e77('0x6')]('/',auth[_0x4e77('0x7')](),controller['index']);router[_0x4e77('0x6')]('/:id',auth[_0x4e77('0x7')](),controller[_0x4e77('0x8')]);router[_0x4e77('0x6')](_0x4e77('0x9'),auth['isAuthenticated'](),controller[_0x4e77('0xa')]);router['post']('/',auth[_0x4e77('0x7')](),controller[_0x4e77('0xb')]);router[_0x4e77('0xc')]('/:id',auth[_0x4e77('0x7')](),controller[_0x4e77('0xd')]);router['delete'](_0x4e77('0xe'),auth[_0x4e77('0x7')](),controller[_0x4e77('0xf')]);module[_0x4e77('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 098a2ae..d819088 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 _0xbe53=['INTEGER','STRING','long','TIMESTAMP','sequelize','VIRTUAL','getDataValue'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0xbe53,0x18c));var _0x3be5=function(_0x3c0bbc,_0x11b0e2){_0x3c0bbc=_0x3c0bbc-0x0;var _0x3b4d89=_0xbe53[_0x3c0bbc];return _0x3b4d89;};'use strict';var Sequelize=require(_0x3be5('0x0'));module['exports']={'name':{'type':Sequelize[_0x3be5('0x1')],'get':function(_0x33bf02){return this[_0x3be5('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x3be5('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x3be5('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3be5('0x4')],'defaultValue':''},'stamp':{'type':_0x3be5('0x6'),'allowNull':![]}}; \ No newline at end of file +var _0xbc31=['BLOB','long','TIMESTAMP','exports','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xbc31,0xdb));var _0x1bc3=function(_0xcbe48f,_0x127dd5){_0xcbe48f=_0xcbe48f-0x0;var _0x41809b=_0xbc31[_0xcbe48f];return _0x41809b;};'use strict';var Sequelize=require('sequelize');module[_0x1bc3('0x0')]={'name':{'type':Sequelize[_0x1bc3('0x1')],'get':function(_0x3bf986){return this[_0x1bc3('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x1bc3('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x1bc3('0x5')](_0x1bc3('0x6')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1bc3('0x4')],'defaultValue':''},'stamp':{'type':_0x1bc3('0x7'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6e489f0..cd8ed71 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 _0xf5be=['day','merge','map','filter','options','includeAll','include','findAll','rows','catch','create','body','update','params','destroy','download','find','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','set','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','Content-Range','reject','then','sendStatus','error','stack','name','send','index','VoiceMailMessage','rawAttributes','model','keys','query','dateStart','dateEnd','intersection','attributes','fields','hasOwnProperty','nolimit','where','filters','pick','add'];(function(_0x115f82,_0x4ebe3){var _0x52cabb=function(_0x21f0fc){while(--_0x21f0fc){_0x115f82['push'](_0x115f82['shift']());}};_0x52cabb(++_0x4ebe3);}(_0xf5be,0x68));var _0xef5b=function(_0x24d815,_0x5b9ad4){_0x24d815=_0x24d815-0x0;var _0x3bb61c=_0xf5be[_0x24d815];return _0x3bb61c;};'use strict';var jsonpatch=require(_0xef5b('0x0'));var rp=require(_0xef5b('0x1'));var moment=require(_0xef5b('0x2'));var BPromise=require(_0xef5b('0x3'));var Mustache=require(_0xef5b('0x4'));var util=require(_0xef5b('0x5'));var path=require('path');var sox=require(_0xef5b('0x6'));var csv=require(_0xef5b('0x7'));var ejs=require(_0xef5b('0x8'));var fs=require('fs');var _=require(_0xef5b('0x9'));var squel=require('squel');var crypto=require(_0xef5b('0xa'));var jsforce=require(_0xef5b('0xb'));var deskjs=require(_0xef5b('0xc'));var toCsv=require(_0xef5b('0x7'));var querystring=require(_0xef5b('0xd'));var Papa=require('papaparse');var qs=require(_0xef5b('0xe'));var logger=require(_0xef5b('0xf'))(_0xef5b('0x10'));var utils=require('../../config/utils');var config=require(_0xef5b('0x11'));var db=require(_0xef5b('0x12'))['db'];function respondWithStatusCode(_0x2226b4,_0x361302){_0x361302=_0x361302||0xcc;return function(_0x3bb7c5){if(_0x3bb7c5){return _0x2226b4['sendStatus'](_0x361302);}return _0x2226b4[_0xef5b('0x13')](_0x361302)[_0xef5b('0x14')]();};}function respondWithResult(_0x399bef,_0x30a1aa){_0x30a1aa=_0x30a1aa||0xc8;return function(_0x3d9fbd){if(_0x3d9fbd){return _0x399bef[_0xef5b('0x13')](_0x30a1aa)[_0xef5b('0x15')](_0x3d9fbd);}};}function respondWithFilteredResult(_0x4fe1af,_0x2bc529){return function(_0x19b709){if(_0x19b709){var _0x26e2df=_0x19b709[_0xef5b('0x16')],_0x441b64=_0x2bc529[_0xef5b('0x17')],_0x5e9a86=_0x2bc529[_0xef5b('0x17')]+_0x2bc529[_0xef5b('0x18')],_0x18178d;if(_0x5e9a86>=_0x26e2df){_0x5e9a86=_0x26e2df;_0x18178d=0xc8;}else{_0x18178d=0xce;}_0x4fe1af['status'](_0x18178d);return _0x4fe1af['set'](_0xef5b('0x19'),_0x441b64+'-'+_0x5e9a86+'/'+_0x26e2df)[_0xef5b('0x15')](_0x19b709);}return null;};}function patchUpdates(_0x4c5f6a){return function(_0xbe31d8){try{jsonpatch['apply'](_0xbe31d8,_0x4c5f6a,!![]);}catch(_0x3d9187){return BPromise[_0xef5b('0x1a')](_0x3d9187);}return _0xbe31d8['save']();};}function saveUpdates(_0x512361,_0x728822){return function(_0x2e8fb8){if(_0x2e8fb8){return _0x2e8fb8['update'](_0x512361)[_0xef5b('0x1b')](function(_0x23f344){return _0x23f344;});}return null;};}function removeEntity(_0x3614f7,_0x33df5e){return function(_0x429417){if(_0x429417){return _0x429417['destroy']()['then'](function(){_0x3614f7['status'](0xcc)[_0xef5b('0x14')]();});}};}function handleEntityNotFound(_0x10a1a9,_0x4bee2c){return function(_0x2785ee){if(!_0x2785ee){_0x10a1a9[_0xef5b('0x1c')](0x194);}return _0x2785ee;};}function handleError(_0x2a060c,_0x51f5d7){_0x51f5d7=_0x51f5d7||0x1f4;return function(_0x510067){logger[_0xef5b('0x1d')](_0x510067[_0xef5b('0x1e')]);if(_0x510067[_0xef5b('0x1f')]){delete _0x510067[_0xef5b('0x1f')];}_0x2a060c[_0xef5b('0x13')](_0x51f5d7)[_0xef5b('0x20')](_0x510067);};}exports[_0xef5b('0x21')]=function(_0x385b29,_0xe84ba0){var _0x20ad12={},_0x3d8a84={},_0xf79d17={'count':0x0,'rows':[]};var _0x48c69a=db[_0xef5b('0x22')][_0xef5b('0x23')];_0x3d8a84[_0xef5b('0x24')]=_['differenceBy'](_[_0xef5b('0x25')](_0x48c69a),[_0xef5b('0x1f')]);var _0xc248d3={'dateStart':_0x385b29[_0xef5b('0x26')][_0xef5b('0x27')],'dateEnd':_0x385b29[_0xef5b('0x26')][_0xef5b('0x28')]};delete _0x385b29[_0xef5b('0x26')][_0xef5b('0x27')];delete _0x385b29[_0xef5b('0x26')][_0xef5b('0x28')];_0x3d8a84['query']=_[_0xef5b('0x25')](_0x385b29[_0xef5b('0x26')]);_0x3d8a84['filters']=_[_0xef5b('0x29')](_0x3d8a84[_0xef5b('0x24')],_0x3d8a84[_0xef5b('0x26')]);_0x20ad12[_0xef5b('0x2a')]=_['intersection'](_0x3d8a84[_0xef5b('0x24')],qs[_0xef5b('0x2b')](_0x385b29['query']['fields']));_0x20ad12[_0xef5b('0x2a')]=_0x20ad12[_0xef5b('0x2a')]['length']?_0x20ad12['attributes']:_0x3d8a84[_0xef5b('0x24')];if(!_0x385b29[_0xef5b('0x26')][_0xef5b('0x2c')](_0xef5b('0x2d'))){_0x20ad12[_0xef5b('0x18')]=qs['limit'](_0x385b29['query'][_0xef5b('0x18')]);_0x20ad12[_0xef5b('0x17')]=qs[_0xef5b('0x17')](_0x385b29[_0xef5b('0x26')][_0xef5b('0x17')]);}_0x20ad12['order']=qs['sort'](_0x385b29[_0xef5b('0x26')]['sort']);_0x20ad12[_0xef5b('0x2e')]=qs[_0xef5b('0x2f')](_[_0xef5b('0x30')](_0x385b29[_0xef5b('0x26')],_0x3d8a84[_0xef5b('0x2f')]));if(_0xc248d3[_0xef5b('0x27')]){if(_0xc248d3[_0xef5b('0x28')]){_0xc248d3[_0xef5b('0x28')]=moment(_0xc248d3[_0xef5b('0x28')])[_0xef5b('0x31')](0x1,_0xef5b('0x32'));}else{_0xc248d3[_0xef5b('0x28')]=moment(_0xc248d3['dateStart'])[_0xef5b('0x31')](0x1,'day');}_['merge'](_0x20ad12[_0xef5b('0x2e')],{'createdAt':{'$gte':_0xc248d3[_0xef5b('0x27')],'$lte':_0xc248d3[_0xef5b('0x28')]}});}if(_0x385b29[_0xef5b('0x26')]['filter']){_0x20ad12[_0xef5b('0x2e')]=_[_0xef5b('0x33')](_0x20ad12['where'],{'$or':_[_0xef5b('0x34')](_0x20ad12[_0xef5b('0x2a')],function(_0x28afd0){var _0x2f5f65={};_0x2f5f65[_0x28afd0]={'$like':'%'+_0x385b29['query'][_0xef5b('0x35')]+'%'};return _0x2f5f65;})});}_0x20ad12=_['merge']({},_0x20ad12,_0x385b29[_0xef5b('0x36')]);var _0x3e039d={'where':_0x20ad12[_0xef5b('0x2e')]};return db[_0xef5b('0x22')][_0xef5b('0x16')](_0x3e039d)[_0xef5b('0x1b')](function(_0x1000ed){_0xf79d17['count']=_0x1000ed;if(_0x385b29[_0xef5b('0x26')][_0xef5b('0x37')]){_0x20ad12[_0xef5b('0x38')]=[{'all':!![]}];}return db[_0xef5b('0x22')][_0xef5b('0x39')](_0x20ad12);})[_0xef5b('0x1b')](function(_0x3a3252){_0xf79d17[_0xef5b('0x3a')]=_0x3a3252;return _0xf79d17;})[_0xef5b('0x1b')](respondWithFilteredResult(_0xe84ba0,_0x20ad12))[_0xef5b('0x3b')](handleError(_0xe84ba0,null));};exports['show']=function(_0x4f73fa,_0x527d78){var _0x96eb7e={'raw':!![],'where':{'id':_0x4f73fa['params']['id']}},_0x23e91f={};_0x23e91f[_0xef5b('0x24')]=_[_0xef5b('0x25')](db['VoiceMailMessage'][_0xef5b('0x23')]);_0x23e91f[_0xef5b('0x26')]=_[_0xef5b('0x25')](_0x4f73fa['query']);_0x23e91f[_0xef5b('0x2f')]=_[_0xef5b('0x29')](_0x23e91f[_0xef5b('0x24')],_0x23e91f['query']);_0x96eb7e['attributes']=_[_0xef5b('0x29')](_0x23e91f['model'],qs[_0xef5b('0x2b')](_0x4f73fa[_0xef5b('0x26')][_0xef5b('0x2b')]));_0x96eb7e[_0xef5b('0x2a')]=_0x96eb7e['attributes']['length']?_0x96eb7e[_0xef5b('0x2a')]:_0x23e91f[_0xef5b('0x24')];if(_0x4f73fa[_0xef5b('0x26')][_0xef5b('0x37')]){_0x96eb7e[_0xef5b('0x38')]=[{'all':!![]}];}_0x96eb7e=_['merge']({},_0x96eb7e,_0x4f73fa[_0xef5b('0x36')]);return db[_0xef5b('0x22')]['find'](_0x96eb7e)[_0xef5b('0x1b')](handleEntityNotFound(_0x527d78,null))[_0xef5b('0x1b')](respondWithResult(_0x527d78,null))[_0xef5b('0x3b')](handleError(_0x527d78,null));};exports[_0xef5b('0x3c')]=function(_0x1f8dfe,_0x55590d){return db[_0xef5b('0x22')]['create'](_0x1f8dfe[_0xef5b('0x3d')],{})[_0xef5b('0x1b')](respondWithResult(_0x55590d,0xc9))[_0xef5b('0x3b')](handleError(_0x55590d,null));};exports[_0xef5b('0x3e')]=function(_0x256d8f,_0x5edf53){if(_0x256d8f[_0xef5b('0x3d')]['id']){delete _0x256d8f[_0xef5b('0x3d')]['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x256d8f[_0xef5b('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5edf53,null))['then'](saveUpdates(_0x256d8f['body'],null))['then'](respondWithResult(_0x5edf53,null))[_0xef5b('0x3b')](handleError(_0x5edf53,null));};exports[_0xef5b('0x40')]=function(_0x6a19cb,_0x421610){return db[_0xef5b('0x22')]['find']({'where':{'id':_0x6a19cb[_0xef5b('0x3f')]['id']}})[_0xef5b('0x1b')](handleEntityNotFound(_0x421610,null))[_0xef5b('0x1b')](removeEntity(_0x421610,null))[_0xef5b('0x3b')](handleError(_0x421610,null));};exports[_0xef5b('0x41')]=function(_0x15253b,_0x29a837,_0x2662e2){return db['VoiceMailMessage'][_0xef5b('0x42')]({'where':{'id':_0x15253b['params']['id']},'attributes':['id','recording',_0xef5b('0x43')]})[_0xef5b('0x1b')](handleEntityNotFound(_0x29a837,null))[_0xef5b('0x1b')](function(_0x16622f){if(_0x16622f){if(!_0x16622f[_0xef5b('0x44')]){throw new db[(_0xef5b('0x45'))][(_0xef5b('0x46'))](_0xef5b('0x47'));}var _0x259f57={'Content-Type':_0xef5b('0x48'),'Content-Disposition':_0xef5b('0x49')};if(_0x16622f[_0xef5b('0x43')]){_0x259f57[_0xef5b('0x4a')]='attachment;\x20filename=\x22'+_0x16622f[_0xef5b('0x43')]+_0xef5b('0x4b');}_0x29a837[_0xef5b('0x4c')](_0x259f57);return _0x29a837[_0xef5b('0x20')](new Buffer(_0x16622f[_0xef5b('0x44')]));}})['catch'](handleError(_0x29a837,null));}; \ No newline at end of file +var _0x1197=['include','catch','show','params','options','find','create','update','body','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','api','sendStatus','end','status','count','limit','set','Content-Range','json','apply','save','then','destroy','name','send','VoiceMailMessage','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','add','day','filter','map','merge','includeAll'];(function(_0xacb7cf,_0x1444b7){var _0x10feb3=function(_0x1c6071){while(--_0x1c6071){_0xacb7cf['push'](_0xacb7cf['shift']());}};_0x10feb3(++_0x1444b7);}(_0x1197,0xa8));var _0x7119=function(_0x173be1,_0x544a35){_0x173be1=_0x173be1-0x0;var _0x511b68=_0x1197[_0x173be1];return _0x511b68;};'use strict';var jsonpatch=require(_0x7119('0x0'));var rp=require('request-promise');var moment=require(_0x7119('0x1'));var BPromise=require(_0x7119('0x2'));var Mustache=require(_0x7119('0x3'));var util=require(_0x7119('0x4'));var path=require(_0x7119('0x5'));var sox=require(_0x7119('0x6'));var csv=require('to-csv');var ejs=require(_0x7119('0x7'));var fs=require('fs');var _=require(_0x7119('0x8'));var squel=require(_0x7119('0x9'));var crypto=require(_0x7119('0xa'));var jsforce=require(_0x7119('0xb'));var deskjs=require(_0x7119('0xc'));var toCsv=require(_0x7119('0xd'));var querystring=require(_0x7119('0xe'));var Papa=require(_0x7119('0xf'));var qs=require(_0x7119('0x10'));var logger=require('../../config/logger')(_0x7119('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d0ee7,_0x152e5c){_0x152e5c=_0x152e5c||0xcc;return function(_0x792620){if(_0x792620){return _0x4d0ee7[_0x7119('0x12')](_0x152e5c);}return _0x4d0ee7['status'](_0x152e5c)[_0x7119('0x13')]();};}function respondWithResult(_0x50f28b,_0x4dc633){_0x4dc633=_0x4dc633||0xc8;return function(_0xae45f){if(_0xae45f){return _0x50f28b[_0x7119('0x14')](_0x4dc633)['json'](_0xae45f);}};}function respondWithFilteredResult(_0xdbb8d9,_0x20722d){return function(_0x37c827){if(_0x37c827){var _0x4fdda0=_0x37c827[_0x7119('0x15')],_0x3a5aa3=_0x20722d['offset'],_0x27ded1=_0x20722d['offset']+_0x20722d[_0x7119('0x16')],_0x2fd142;if(_0x27ded1>=_0x4fdda0){_0x27ded1=_0x4fdda0;_0x2fd142=0xc8;}else{_0x2fd142=0xce;}_0xdbb8d9[_0x7119('0x14')](_0x2fd142);return _0xdbb8d9[_0x7119('0x17')](_0x7119('0x18'),_0x3a5aa3+'-'+_0x27ded1+'/'+_0x4fdda0)[_0x7119('0x19')](_0x37c827);}return null;};}function patchUpdates(_0x530c01){return function(_0x22c5b6){try{jsonpatch[_0x7119('0x1a')](_0x22c5b6,_0x530c01,!![]);}catch(_0x2651e6){return BPromise['reject'](_0x2651e6);}return _0x22c5b6[_0x7119('0x1b')]();};}function saveUpdates(_0xe42b95,_0x3c2643){return function(_0x52cd6b){if(_0x52cd6b){return _0x52cd6b['update'](_0xe42b95)[_0x7119('0x1c')](function(_0x33763c){return _0x33763c;});}return null;};}function removeEntity(_0x10e581,_0x245ec8){return function(_0x5668d6){if(_0x5668d6){return _0x5668d6[_0x7119('0x1d')]()[_0x7119('0x1c')](function(){_0x10e581['status'](0xcc)[_0x7119('0x13')]();});}};}function handleEntityNotFound(_0x3056cc,_0x48d625){return function(_0x47333c){if(!_0x47333c){_0x3056cc['sendStatus'](0x194);}return _0x47333c;};}function handleError(_0x494a91,_0x4bbb1b){_0x4bbb1b=_0x4bbb1b||0x1f4;return function(_0x33aed5){logger['error'](_0x33aed5['stack']);if(_0x33aed5[_0x7119('0x1e')]){delete _0x33aed5[_0x7119('0x1e')];}_0x494a91[_0x7119('0x14')](_0x4bbb1b)[_0x7119('0x1f')](_0x33aed5);};}exports['index']=function(_0x2b5520,_0x40e02f){var _0x5970e1={},_0x2b0047={},_0x3a5595={'count':0x0,'rows':[]};var _0x3a4351=db[_0x7119('0x20')][_0x7119('0x21')];_0x2b0047[_0x7119('0x22')]=_[_0x7119('0x23')](_[_0x7119('0x24')](_0x3a4351),[_0x7119('0x1e')]);var _0x223f40={'dateStart':_0x2b5520[_0x7119('0x25')][_0x7119('0x26')],'dateEnd':_0x2b5520[_0x7119('0x25')]['dateEnd']};delete _0x2b5520[_0x7119('0x25')][_0x7119('0x26')];delete _0x2b5520[_0x7119('0x25')][_0x7119('0x27')];_0x2b0047[_0x7119('0x25')]=_[_0x7119('0x24')](_0x2b5520[_0x7119('0x25')]);_0x2b0047[_0x7119('0x28')]=_[_0x7119('0x29')](_0x2b0047[_0x7119('0x22')],_0x2b0047[_0x7119('0x25')]);_0x5970e1[_0x7119('0x2a')]=_[_0x7119('0x29')](_0x2b0047['model'],qs[_0x7119('0x2b')](_0x2b5520[_0x7119('0x25')][_0x7119('0x2b')]));_0x5970e1['attributes']=_0x5970e1['attributes']['length']?_0x5970e1[_0x7119('0x2a')]:_0x2b0047[_0x7119('0x22')];if(!_0x2b5520[_0x7119('0x25')][_0x7119('0x2c')](_0x7119('0x2d'))){_0x5970e1[_0x7119('0x16')]=qs[_0x7119('0x16')](_0x2b5520[_0x7119('0x25')][_0x7119('0x16')]);_0x5970e1[_0x7119('0x2e')]=qs['offset'](_0x2b5520['query'][_0x7119('0x2e')]);}_0x5970e1[_0x7119('0x2f')]=qs[_0x7119('0x30')](_0x2b5520[_0x7119('0x25')][_0x7119('0x30')]);_0x5970e1[_0x7119('0x31')]=qs[_0x7119('0x28')](_[_0x7119('0x32')](_0x2b5520['query'],_0x2b0047[_0x7119('0x28')]));if(_0x223f40[_0x7119('0x26')]){if(_0x223f40[_0x7119('0x27')]){_0x223f40[_0x7119('0x27')]=moment(_0x223f40['dateEnd'])[_0x7119('0x33')](0x1,'day');}else{_0x223f40[_0x7119('0x27')]=moment(_0x223f40[_0x7119('0x26')])[_0x7119('0x33')](0x1,_0x7119('0x34'));}_['merge'](_0x5970e1[_0x7119('0x31')],{'createdAt':{'$gte':_0x223f40[_0x7119('0x26')],'$lte':_0x223f40[_0x7119('0x27')]}});}if(_0x2b5520[_0x7119('0x25')][_0x7119('0x35')]){_0x5970e1[_0x7119('0x31')]=_['merge'](_0x5970e1['where'],{'$or':_[_0x7119('0x36')](_0x5970e1[_0x7119('0x2a')],function(_0x598677){var _0x105d83={};_0x105d83[_0x598677]={'$like':'%'+_0x2b5520[_0x7119('0x25')][_0x7119('0x35')]+'%'};return _0x105d83;})});}_0x5970e1=_[_0x7119('0x37')]({},_0x5970e1,_0x2b5520['options']);var _0xf36db2={'where':_0x5970e1[_0x7119('0x31')]};return db[_0x7119('0x20')][_0x7119('0x15')](_0xf36db2)['then'](function(_0x4f715e){_0x3a5595[_0x7119('0x15')]=_0x4f715e;if(_0x2b5520[_0x7119('0x25')][_0x7119('0x38')]){_0x5970e1[_0x7119('0x39')]=[{'all':!![]}];}return db[_0x7119('0x20')]['findAll'](_0x5970e1);})[_0x7119('0x1c')](function(_0x49aaca){_0x3a5595['rows']=_0x49aaca;return _0x3a5595;})[_0x7119('0x1c')](respondWithFilteredResult(_0x40e02f,_0x5970e1))[_0x7119('0x3a')](handleError(_0x40e02f,null));};exports[_0x7119('0x3b')]=function(_0x2da5d7,_0x4002cc){var _0x457c73={'raw':!![],'where':{'id':_0x2da5d7[_0x7119('0x3c')]['id']}},_0x44ad87={};_0x44ad87['model']=_['keys'](db[_0x7119('0x20')][_0x7119('0x21')]);_0x44ad87[_0x7119('0x25')]=_[_0x7119('0x24')](_0x2da5d7[_0x7119('0x25')]);_0x44ad87[_0x7119('0x28')]=_[_0x7119('0x29')](_0x44ad87[_0x7119('0x22')],_0x44ad87[_0x7119('0x25')]);_0x457c73['attributes']=_[_0x7119('0x29')](_0x44ad87[_0x7119('0x22')],qs[_0x7119('0x2b')](_0x2da5d7[_0x7119('0x25')][_0x7119('0x2b')]));_0x457c73[_0x7119('0x2a')]=_0x457c73[_0x7119('0x2a')]['length']?_0x457c73[_0x7119('0x2a')]:_0x44ad87[_0x7119('0x22')];if(_0x2da5d7['query']['includeAll']){_0x457c73['include']=[{'all':!![]}];}_0x457c73=_[_0x7119('0x37')]({},_0x457c73,_0x2da5d7[_0x7119('0x3d')]);return db['VoiceMailMessage'][_0x7119('0x3e')](_0x457c73)[_0x7119('0x1c')](handleEntityNotFound(_0x4002cc,null))[_0x7119('0x1c')](respondWithResult(_0x4002cc,null))[_0x7119('0x3a')](handleError(_0x4002cc,null));};exports[_0x7119('0x3f')]=function(_0x507728,_0x3109b0){return db[_0x7119('0x20')]['create'](_0x507728['body'],{})[_0x7119('0x1c')](respondWithResult(_0x3109b0,0xc9))[_0x7119('0x3a')](handleError(_0x3109b0,null));};exports[_0x7119('0x40')]=function(_0x210cc0,_0x44c170){if(_0x210cc0['body']['id']){delete _0x210cc0[_0x7119('0x41')]['id'];}return db[_0x7119('0x20')][_0x7119('0x3e')]({'where':{'id':_0x210cc0['params']['id']}})[_0x7119('0x1c')](handleEntityNotFound(_0x44c170,null))[_0x7119('0x1c')](saveUpdates(_0x210cc0[_0x7119('0x41')],null))[_0x7119('0x1c')](respondWithResult(_0x44c170,null))[_0x7119('0x3a')](handleError(_0x44c170,null));};exports[_0x7119('0x1d')]=function(_0x101631,_0x192205){return db['VoiceMailMessage'][_0x7119('0x3e')]({'where':{'id':_0x101631['params']['id']}})[_0x7119('0x1c')](handleEntityNotFound(_0x192205,null))['then'](removeEntity(_0x192205,null))['catch'](handleError(_0x192205,null));};exports[_0x7119('0x42')]=function(_0x1e798e,_0x4bc3ee,_0x2c5c6a){return db[_0x7119('0x20')][_0x7119('0x3e')]({'where':{'id':_0x1e798e['params']['id']},'attributes':['id',_0x7119('0x43'),_0x7119('0x44')]})[_0x7119('0x1c')](handleEntityNotFound(_0x4bc3ee,null))[_0x7119('0x1c')](function(_0xefd1de){if(_0xefd1de){if(!_0xefd1de[_0x7119('0x43')]){throw new db[(_0x7119('0x45'))][(_0x7119('0x46'))](_0x7119('0x47'));}var _0x356a95={'Content-Type':_0x7119('0x48'),'Content-Disposition':_0x7119('0x49')};if(_0xefd1de['msg_id']){_0x356a95[_0x7119('0x4a')]='attachment;\x20filename=\x22'+_0xefd1de[_0x7119('0x44')]+'.wav\x22';}_0x4bc3ee[_0x7119('0x17')](_0x356a95);return _0x4bc3ee[_0x7119('0x1f')](new Buffer(_0xefd1de[_0x7119('0x43')]));}})['catch'](handleError(_0x4bc3ee,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index fd9d70c..7e824b0 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 _0xebda=['dir','lodash','util','api','moment','request-promise','./voiceMailMessage.attributes','exports','VoiceMailMessage'];(function(_0x3beb05,_0x578f1c){var _0x5039ef=function(_0x4b0c1c){while(--_0x4b0c1c){_0x3beb05['push'](_0x3beb05['shift']());}};_0x5039ef(++_0x578f1c);}(_0xebda,0x1c3));var _0xaebd=function(_0x3aaf0a,_0x450970){_0x3aaf0a=_0x3aaf0a-0x0;var _0x33e6bc=_0xebda[_0x3aaf0a];return _0x33e6bc;};'use strict';var _=require(_0xaebd('0x0'));var util=require(_0xaebd('0x1'));var logger=require('../../config/logger')(_0xaebd('0x2'));var moment=require(_0xaebd('0x3'));var BPromise=require('bluebird');var rp=require(_0xaebd('0x4'));var attributes=require(_0xaebd('0x5'));module[_0xaebd('0x6')]=function(_0x145de3,_0x275de1){return _0x145de3['define'](_0xaebd('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0xaebd('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x16ae=['voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','./voiceMailMessage.attributes'];(function(_0x2217ac,_0x230bb7){var _0x427dd8=function(_0xeb661b){while(--_0xeb661b){_0x2217ac['push'](_0x2217ac['shift']());}};_0x427dd8(++_0x230bb7);}(_0x16ae,0x1aa));var _0xe16a=function(_0x53267c,_0x45d9fe){_0x53267c=_0x53267c-0x0;var _0x2ef4d2=_0x16ae[_0x53267c];return _0x2ef4d2;};'use strict';var _=require(_0xe16a('0x0'));var util=require(_0xe16a('0x1'));var logger=require(_0xe16a('0x2'))(_0xe16a('0x3'));var moment=require(_0xe16a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var attributes=require(_0xe16a('0x5'));module['exports']=function(_0x5adf50,_0x256b99){return _0x5adf50['define']('VoiceMailMessage',attributes,{'tableName':_0xe16a('0x6'),'paranoid':![],'indexes':[{'name':_0xe16a('0x7'),'fields':[_0xe16a('0x7')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 5e04700..0c5ff6d 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 _0xe059=['catch','util','moment','bluebird','../../config/logger','rpc','client','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x8d472,_0xefa638){var _0x4e1ea6=function(_0xe64a2){while(--_0xe64a2){_0x8d472['push'](_0x8d472['shift']());}};_0x4e1ea6(++_0xefa638);}(_0xe059,0xb5));var _0x9e05=function(_0x41d4c0,_0x4a609a){_0x41d4c0=_0x41d4c0-0x0;var _0x21228c=_0xe059[_0x41d4c0];return _0x21228c;};'use strict';var _=require('lodash');var util=require(_0x9e05('0x0'));var moment=require(_0x9e05('0x1'));var BPromise=require(_0x9e05('0x2'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9e05('0x3'))(_0x9e05('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9e05('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5962,_0x4f6a62,_0xede26e){return new BPromise(function(_0x42198e,_0x18da65){return client['request'](_0x4e5962,_0xede26e)[_0x9e05('0x6')](function(_0x474b75){logger['info'](_0x9e05('0x7'),_0x4f6a62,_0x9e05('0x8'));logger[_0x9e05('0x9')](_0x9e05('0xa'),_0x4f6a62,_0x9e05('0x8'),JSON[_0x9e05('0xb')](_0x474b75));if(_0x474b75['error']){if(_0x474b75['error'][_0x9e05('0xc')]===0x1f4){logger[_0x9e05('0xd')](_0x9e05('0x7'),_0x4f6a62,_0x474b75[_0x9e05('0xd')][_0x9e05('0xe')]);return _0x18da65(_0x474b75[_0x9e05('0xd')][_0x9e05('0xe')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x4f6a62,_0x474b75[_0x9e05('0xd')]['message']);return _0x42198e(_0x474b75[_0x9e05('0xd')][_0x9e05('0xe')]);}else{logger[_0x9e05('0xf')](_0x9e05('0x7'),_0x4f6a62,_0x9e05('0x8'));_0x42198e(_0x474b75[_0x9e05('0x10')][_0x9e05('0xe')]);}})[_0x9e05('0x11')](function(_0xa1e14){logger[_0x9e05('0xd')](_0x9e05('0x7'),_0x4f6a62,_0xa1e14);_0x18da65(_0xa1e14);});});} \ No newline at end of file +var _0x4179=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x4179,0x19f));var _0x9417=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x4179[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0x9417('0x0'));var util=require(_0x9417('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9417('0x2'));var fs=require('fs');var db=require(_0x9417('0x3'))['db'];var utils=require(_0x9417('0x4'));var logger=require(_0x9417('0x5'))(_0x9417('0x6'));var config=require(_0x9417('0x7'));var jayson=require(_0x9417('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51e48d,_0x130535,_0x2c723c){return new BPromise(function(_0x260af6,_0xa303b1){return client[_0x9417('0x9')](_0x51e48d,_0x2c723c)[_0x9417('0xa')](function(_0x419081){logger[_0x9417('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x9417('0xc'));logger[_0x9417('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x130535,_0x9417('0xc'),JSON[_0x9417('0xe')](_0x419081));if(_0x419081[_0x9417('0xf')]){if(_0x419081['error']['code']===0x1f4){logger[_0x9417('0xf')](_0x9417('0x10'),_0x130535,_0x419081[_0x9417('0xf')][_0x9417('0x11')]);return _0xa303b1(_0x419081['error'][_0x9417('0x11')]);}logger[_0x9417('0xf')]('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x419081[_0x9417('0xf')][_0x9417('0x11')]);return _0x260af6(_0x419081[_0x9417('0xf')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x130535,_0x9417('0xc'));_0x260af6(_0x419081[_0x9417('0x12')][_0x9417('0x11')]);}})[_0x9417('0x13')](function(_0x446d13){logger[_0x9417('0xf')](_0x9417('0x10'),_0x130535,_0x446d13);_0xa303b1(_0x446d13);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5bef4bc..a1d854c 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 _0xd8bc=['../../components/interaction/service','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','addSound','put','update','destroy','delete','/:id/sounds/:id2','removeSound','multer','util','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8bc,0x6e));var _0xcd8b=function(_0x3a1be7,_0x92dc88){_0x3a1be7=_0x3a1be7-0x0;var _0x2700cb=_0xd8bc[_0x3a1be7];return _0x2700cb;};'use strict';var multer=require(_0xcd8b('0x0'));var util=require(_0xcd8b('0x1'));var path=require('path');var express=require(_0xcd8b('0x2'));var router=express[_0xcd8b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xcd8b('0x4'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0xcd8b('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcd8b('0x5')](_0xcd8b('0x6'),auth[_0xcd8b('0x7')](),controller[_0xcd8b('0x8')]);router[_0xcd8b('0x5')](_0xcd8b('0x9'),auth[_0xcd8b('0x7')](),controller[_0xcd8b('0xa')]);router['post']('/',auth[_0xcd8b('0x7')](),controller['create']);router[_0xcd8b('0xb')](_0xcd8b('0x9'),auth['isAuthenticated'](),controller[_0xcd8b('0xc')]);router[_0xcd8b('0xd')]('/:id',auth[_0xcd8b('0x7')](),controller[_0xcd8b('0xe')]);router['delete'](_0xcd8b('0x6'),auth[_0xcd8b('0x7')](),controller[_0xcd8b('0xf')]);router[_0xcd8b('0x10')](_0xcd8b('0x11'),auth['isAuthenticated'](),controller[_0xcd8b('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcd0d=['post','create','/:id','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','show','/:id/sounds','getSounds'];(function(_0x49e52e,_0x15f616){var _0x36a6e6=function(_0x2f7be2){while(--_0x2f7be2){_0x49e52e['push'](_0x49e52e['shift']());}};_0x36a6e6(++_0x15f616);}(_0xcd0d,0x193));var _0xdcd0=function(_0x47fd45,_0x40dd67){_0x47fd45=_0x47fd45-0x0;var _0x363313=_0xcd0d[_0x47fd45];return _0x363313;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var express=require(_0xdcd0('0x3'));var router=express[_0xdcd0('0x4')]();var auth=require(_0xdcd0('0x5'));var interaction=require(_0xdcd0('0x6'));var config=require(_0xdcd0('0x7'));var controller=require(_0xdcd0('0x8'));router['get']('/',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xa')]);router[_0xdcd0('0xb')]('/:id',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xc')]);router[_0xdcd0('0xb')](_0xdcd0('0xd'),auth[_0xdcd0('0x9')](),controller[_0xdcd0('0xe')]);router[_0xdcd0('0xf')]('/',auth[_0xdcd0('0x9')](),controller[_0xdcd0('0x10')]);router[_0xdcd0('0xf')](_0xdcd0('0xd'),auth[_0xdcd0('0x9')](),controller['addSound']);router['put'](_0xdcd0('0x11'),auth[_0xdcd0('0x9')](),controller['update']);router[_0xdcd0('0x12')](_0xdcd0('0x11'),auth[_0xdcd0('0x9')](),controller['destroy']);router[_0xdcd0('0x12')](_0xdcd0('0x13'),auth[_0xdcd0('0x9')](),controller[_0xdcd0('0x14')]);module[_0xdcd0('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 753d99a..c38b745 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 _0xc368=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','quietmp3nb','quietmp3','mp3','files','alpha'];(function(_0x222a12,_0x40ce68){var _0x20c958=function(_0x80aec0){while(--_0x80aec0){_0x222a12['push'](_0x222a12['shift']());}};_0x20c958(++_0x40ce68);}(_0xc368,0x120));var _0x8c36=function(_0x32ce05,_0x34615a){_0x32ce05=_0x32ce05-0x0;var _0x13b194=_0xc368[_0x32ce05];return _0x13b194;};'use strict';var Sequelize=require(_0x8c36('0x0'));module[_0x8c36('0x1')]={'name':{'type':Sequelize[_0x8c36('0x2')],'allowNull':![],'unique':_0x8c36('0x3')},'mode':{'type':Sequelize[_0x8c36('0x4')](_0x8c36('0x5'),'files','mp3nb',_0x8c36('0x6'),_0x8c36('0x7'),_0x8c36('0x8')),'allowNull':!![],'defaultValue':_0x8c36('0x9')},'directory':{'type':Sequelize[_0x8c36('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x8c36('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x8c36('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x8c36('0x2')],'allowNull':!![],'defaultValue':_0x8c36('0xa')},'format':{'type':Sequelize[_0x8c36('0x2')],'allowNull':!![]},'stamp':{'type':_0x8c36('0xb')},'defaultEntry':{'type':Sequelize[_0x8c36('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdee4=['name','ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','STRING'];(function(_0xd6ddab,_0x3f700e){var _0x81549e=function(_0x405c71){while(--_0x405c71){_0xd6ddab['push'](_0xd6ddab['shift']());}};_0x81549e(++_0x3f700e);}(_0xdee4,0x195));var _0x4dee=function(_0x120c03,_0x1a8eab){_0x120c03=_0x120c03-0x0;var _0x2f04a8=_0xdee4[_0x120c03];return _0x2f04a8;};'use strict';var Sequelize=require(_0x4dee('0x0'));module['exports']={'name':{'type':Sequelize[_0x4dee('0x1')],'allowNull':![],'unique':_0x4dee('0x2')},'mode':{'type':Sequelize[_0x4dee('0x3')]('custom',_0x4dee('0x4'),_0x4dee('0x5'),_0x4dee('0x6'),_0x4dee('0x7'),_0x4dee('0x8')),'allowNull':!![],'defaultValue':_0x4dee('0x4')},'directory':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4dee('0x9')},'format':{'type':Sequelize[_0x4dee('0x1')],'allowNull':!![]},'stamp':{'type':_0x4dee('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 64a2440..5083c06 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 _0xa9e0=['message','addSound','converted_format','createdAt','join','server/files/sounds/converted','%s.%s','basename','save_name','server/files/moh','symlinkSync','Sequelize','findOne','removeSound','id2','getSounds','Sound','hasOwnProperty','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','apply','reject','save','update','then','destroy','end','error','name','send','index','VoiceMusicOnHold','rawAttributes','keys','query','dateEnd','dateStart','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','add','day','merge','filter','map','options','includeAll','include','findAll','catch','show','params','find','body','create','sequelize','transaction','mode','directory','0777','readdirSync','forEach','unlinkSync','ValidationError'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var jsonpatch=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0a9e('0x3'));var path=require('path');var sox=require(_0x0a9e('0x4'));var csv=require(_0x0a9e('0x5'));var ejs=require(_0x0a9e('0x6'));var fs=require('fs');var _=require(_0x0a9e('0x7'));var squel=require(_0x0a9e('0x8'));var crypto=require('crypto');var jsforce=require(_0x0a9e('0x9'));var deskjs=require(_0x0a9e('0xa'));var toCsv=require(_0x0a9e('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var qs=require(_0x0a9e('0xb'));var logger=require('../../config/logger')('api');var utils=require(_0x0a9e('0xc'));var config=require(_0x0a9e('0xd'));var db=require(_0x0a9e('0xe'))['db'];function respondWithStatusCode(_0x3ab53f,_0xfeb75b){_0xfeb75b=_0xfeb75b||0xcc;return function(_0xbd1168){if(_0xbd1168){return _0x3ab53f['sendStatus'](_0xfeb75b);}return _0x3ab53f['status'](_0xfeb75b)['end']();};}function respondWithResult(_0x4cfe67,_0x273d4d){_0x273d4d=_0x273d4d||0xc8;return function(_0x36471c){if(_0x36471c){return _0x4cfe67[_0x0a9e('0xf')](_0x273d4d)[_0x0a9e('0x10')](_0x36471c);}};}function respondWithFilteredResult(_0x32d742,_0x69aeb7){return function(_0x5db4b0){if(_0x5db4b0){var _0x4283ce=_0x5db4b0[_0x0a9e('0x11')],_0x239b12=_0x69aeb7[_0x0a9e('0x12')],_0x2b4227=_0x69aeb7['offset']+_0x69aeb7[_0x0a9e('0x13')],_0x281129;if(_0x2b4227>=_0x4283ce){_0x2b4227=_0x4283ce;_0x281129=0xc8;}else{_0x281129=0xce;}_0x32d742['status'](_0x281129);return _0x32d742[_0x0a9e('0x14')]('Content-Range',_0x239b12+'-'+_0x2b4227+'/'+_0x4283ce)[_0x0a9e('0x10')](_0x5db4b0);}return null;};}function patchUpdates(_0x12066b){return function(_0x48f32d){try{jsonpatch[_0x0a9e('0x15')](_0x48f32d,_0x12066b,!![]);}catch(_0x5a0a06){return BPromise[_0x0a9e('0x16')](_0x5a0a06);}return _0x48f32d[_0x0a9e('0x17')]();};}function saveUpdates(_0x106033,_0x205fd6){return function(_0x31b1ca){if(_0x31b1ca){return _0x31b1ca[_0x0a9e('0x18')](_0x106033)[_0x0a9e('0x19')](function(_0x20559e){return _0x20559e;});}return null;};}function removeEntity(_0x1314ae,_0x112016){return function(_0x1c696a){if(_0x1c696a){return _0x1c696a[_0x0a9e('0x1a')]()['then'](function(){_0x1314ae[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x1b')]();});}};}function handleEntityNotFound(_0x53682f,_0x20f109){return function(_0x5a09ef){if(!_0x5a09ef){_0x53682f['sendStatus'](0x194);}return _0x5a09ef;};}function handleError(_0x3a02e1,_0x432e56){_0x432e56=_0x432e56||0x1f4;return function(_0x38e7c4){logger[_0x0a9e('0x1c')](_0x38e7c4['stack']);if(_0x38e7c4[_0x0a9e('0x1d')]){delete _0x38e7c4[_0x0a9e('0x1d')];}_0x3a02e1[_0x0a9e('0xf')](_0x432e56)[_0x0a9e('0x1e')](_0x38e7c4);};}exports[_0x0a9e('0x1f')]=function(_0x42ac8f,_0x16b1ca){var _0x5ea472={},_0x59181e={},_0x197ec0={'count':0x0,'rows':[]};var _0x3a8e58=db[_0x0a9e('0x20')][_0x0a9e('0x21')];_0x59181e['model']=_[_0x0a9e('0x22')](_0x3a8e58);var _0x479bc4={'dateStart':_0x42ac8f[_0x0a9e('0x23')]['dateStart'],'dateEnd':_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')]};delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x25')];delete _0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x24')];_0x59181e[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x42ac8f['query']);_0x59181e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],_0x59181e[_0x0a9e('0x23')]);_0x5ea472['attributes']=_[_0x0a9e('0x27')](_0x59181e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x5ea472[_0x0a9e('0x2a')]=_0x5ea472[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x5ea472[_0x0a9e('0x2a')]:_0x59181e['model'];if(!_0x42ac8f[_0x0a9e('0x23')]['hasOwnProperty'](_0x0a9e('0x2c'))){_0x5ea472[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x5ea472['offset']=qs[_0x0a9e('0x12')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x12')]);}_0x5ea472[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x2e')]);_0x5ea472[_0x0a9e('0x2f')]=qs['filters'](_[_0x0a9e('0x30')](_0x42ac8f['query'],_0x59181e[_0x0a9e('0x26')]));if(_0x479bc4[_0x0a9e('0x25')]){if(_0x479bc4[_0x0a9e('0x24')]){_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4['dateEnd'])[_0x0a9e('0x31')](0x1,_0x0a9e('0x32'));}else{_0x479bc4[_0x0a9e('0x24')]=moment(_0x479bc4[_0x0a9e('0x25')])['add'](0x1,'day');}_[_0x0a9e('0x33')](_0x5ea472['where'],{'createdAt':{'$gte':_0x479bc4[_0x0a9e('0x25')],'$lte':_0x479bc4[_0x0a9e('0x24')]}});}if(_0x42ac8f[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x5ea472['where']=_[_0x0a9e('0x33')](_0x5ea472[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x5ea472['attributes'],function(_0x1dbf74){var _0x1a180b={};_0x1a180b[_0x1dbf74]={'$like':'%'+_0x42ac8f[_0x0a9e('0x23')]['filter']+'%'};return _0x1a180b;})});}_0x5ea472=_['merge']({},_0x5ea472,_0x42ac8f[_0x0a9e('0x36')]);var _0x40d766={'where':_0x5ea472['where']};return db[_0x0a9e('0x20')][_0x0a9e('0x11')](_0x40d766)[_0x0a9e('0x19')](function(_0x148f55){_0x197ec0['count']=_0x148f55;if(_0x42ac8f['query'][_0x0a9e('0x37')]){_0x5ea472[_0x0a9e('0x38')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x0a9e('0x39')](_0x5ea472);})[_0x0a9e('0x19')](function(_0x1459bb){_0x197ec0['rows']=_0x1459bb;return _0x197ec0;})[_0x0a9e('0x19')](respondWithFilteredResult(_0x16b1ca,_0x5ea472))[_0x0a9e('0x3a')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x3b')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x3c')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x20')][_0x0a9e('0x21')]);_0x2881b3[_0x0a9e('0x23')]=_[_0x0a9e('0x22')](_0x43dd5b[_0x0a9e('0x23')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x28')],_0x2881b3[_0x0a9e('0x23')]);_0xeaa5e5[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x2881b3[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0xeaa5e5[_0x0a9e('0x2a')]=_0xeaa5e5[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0xeaa5e5[_0x0a9e('0x2a')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x23')][_0x0a9e('0x37')]){_0xeaa5e5[_0x0a9e('0x38')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x33')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x36')]);return db[_0x0a9e('0x20')][_0x0a9e('0x3d')](_0xeaa5e5)[_0x0a9e('0x19')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x3a')](handleError(_0x13cb1f,null));};exports['update']=function(_0x473dc8,_0x476688){if(_0x473dc8[_0x0a9e('0x3e')]['id']){delete _0x473dc8['body']['id'];}return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0x473dc8[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x476688,null))[_0x0a9e('0x19')](saveUpdates(_0x473dc8[_0x0a9e('0x3e')],null))[_0x0a9e('0x19')](respondWithResult(_0x476688,null))['catch'](handleError(_0x476688,null));};exports[_0x0a9e('0x3f')]=function(_0x1bde3c,_0x1b5e80,_0x16f976){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0x6054ee){if(_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x42')]==='files'){_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x43')]=path['join'](config['root'],'server/files/moh',_0x1bde3c[_0x0a9e('0x3e')][_0x0a9e('0x1d')]);}return db[_0x0a9e('0x20')][_0x0a9e('0x3f')](_0x1bde3c[_0x0a9e('0x3e')],{'transaction':_0x6054ee})[_0x0a9e('0x19')](function(_0x2e5165){if(_0x1bde3c[_0x0a9e('0x3e')]['mode']==='files'){fs['mkdirSync'](_0x2e5165[_0x0a9e('0x43')],parseInt(_0x0a9e('0x44'),0x8));}return _0x2e5165;});})[_0x0a9e('0x19')](respondWithResult(_0x1b5e80,0xc9))['catch'](handleError(_0x1b5e80,null));};exports[_0x0a9e('0x1a')]=function(_0x161aa7,_0x53d113,_0x5a88da){var _0x2ef381;return db['VoiceMusicOnHold'][_0x0a9e('0x3d')]({'where':{'id':_0x161aa7['params']['id']}})[_0x0a9e('0x19')](function(_0x3c20b2){if(_0x3c20b2){return db[_0x0a9e('0x40')]['transaction'](function(_0x2f82da){return _0x3c20b2[_0x0a9e('0x1a')]({'transaction':_0x2f82da,'raw':!![]})['then'](function(_0x50f687){if(_0x50f687[_0x0a9e('0x43')]){fs[_0x0a9e('0x45')](_0x50f687['directory'])[_0x0a9e('0x46')](function(_0x5ce9ac){fs[_0x0a9e('0x47')](path['join'](_0x50f687[_0x0a9e('0x43')],_0x5ce9ac));});fs['rmdirSync'](_0x50f687['directory']);}return _0x50f687;});})['catch'](function(_0x2da03c){throw new db['Sequelize'][(_0x0a9e('0x48'))](_0x2da03c[_0x0a9e('0x49')]);});}})[_0x0a9e('0x19')](handleEntityNotFound(_0x53d113,null))[_0x0a9e('0x19')](removeEntity(_0x53d113,null))[_0x0a9e('0x3a')](handleError(_0x53d113,null));};exports[_0x0a9e('0x4a')]=function(_0xd10662,_0x28d814,_0x4e67ab){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0x2642bb){var _0x30c491;return db[_0x0a9e('0x20')][_0x0a9e('0x3d')]({'where':{'id':_0xd10662['params']['id']}})[_0x0a9e('0x19')](function(_0x26bc80){if(_0x26bc80){_0x30c491=_0x26bc80;return _0x26bc80['addSound'](_0xd10662[_0x0a9e('0x3e')]['id'],{'transaction':_0x2642bb});}})['then'](function(_0x20c668){if(_0x20c668){return db['Sound']['findOne']({'where':{'id':_0xd10662['body']['id']},'attributes':['id',_0x0a9e('0x1d'),'save_name',_0x0a9e('0x4b'),_0x0a9e('0x4c')],'raw':!![]});}})[_0x0a9e('0x19')](function(_0x7be420){if(_0x7be420){var _0x1cca9f=path[_0x0a9e('0x4d')](config['root'],_0x0a9e('0x4e'),util['format'](_0x0a9e('0x4f'),path[_0x0a9e('0x50')](_0x7be420[_0x0a9e('0x51')],path['extname'](_0x7be420[_0x0a9e('0x51')])),_0x7be420[_0x0a9e('0x4b')]));var _0x119677=path[_0x0a9e('0x4d')](config['root'],_0x0a9e('0x52'),_0x30c491[_0x0a9e('0x1d')],util['format'](_0x0a9e('0x4f'),_0x7be420[_0x0a9e('0x1d')],_0x7be420[_0x0a9e('0x4b')]));fs[_0x0a9e('0x53')](_0x1cca9f,_0x119677);return _0x7be420;}})[_0x0a9e('0x3a')](function(_0x4d4a35){throw new db[(_0x0a9e('0x54'))][(_0x0a9e('0x48'))](_0x4d4a35[_0x0a9e('0x49')]);});})['then'](handleEntityNotFound(_0x28d814,null))[_0x0a9e('0x19')](respondWithResult(_0x28d814,0xc9))['catch'](handleError(_0x28d814,null));};exports['removeSound']=function(_0x242745,_0x4556c5,_0x9375fb){return db[_0x0a9e('0x40')][_0x0a9e('0x41')](function(_0xc8c264){var _0x387489;return db[_0x0a9e('0x20')][_0x0a9e('0x55')]({'where':{'id':_0x242745[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x19')](function(_0x2bbb86){if(_0x2bbb86){_0x387489=_0x2bbb86;return _0x2bbb86[_0x0a9e('0x56')](_0x242745[_0x0a9e('0x3c')][_0x0a9e('0x57')]);}})[_0x0a9e('0x19')](function(_0x4257c9){if(_0x4257c9){return db['Sound'][_0x0a9e('0x55')]({'where':{'id':_0x242745[_0x0a9e('0x3c')][_0x0a9e('0x57')]},'attributes':['id','name',_0x0a9e('0x51'),_0x0a9e('0x4b'),'createdAt'],'raw':!![]});}})[_0x0a9e('0x19')](function(_0x56e31e){if(_0x56e31e){fs[_0x0a9e('0x47')](path[_0x0a9e('0x4d')](_0x387489[_0x0a9e('0x43')],util['format']('%s.%s',_0x56e31e['name'],_0x56e31e[_0x0a9e('0x4b')])));return _0x56e31e;}})[_0x0a9e('0x3a')](function(_0x1104ad){throw new db[(_0x0a9e('0x54'))][(_0x0a9e('0x48'))](_0x1104ad[_0x0a9e('0x49')]);});})[_0x0a9e('0x19')](handleEntityNotFound(_0x4556c5,null))[_0x0a9e('0x19')](respondWithStatusCode(_0x4556c5,0xcc))['catch'](handleError(_0x4556c5,null));};exports[_0x0a9e('0x58')]=function(_0xcbc8b2,_0x12ccdb,_0x4a4fc7){var _0x2bdc44={};var _0x583b2e={};var _0x4437ff;var _0x44351d;return db['VoiceMusicOnHold'][_0x0a9e('0x55')]({'where':{'id':_0xcbc8b2[_0x0a9e('0x3c')]['id']}})[_0x0a9e('0x19')](handleEntityNotFound(_0x12ccdb,null))[_0x0a9e('0x19')](function(_0x542ece){if(_0x542ece){_0x4437ff=_0x542ece;_0x583b2e[_0x0a9e('0x28')]=_[_0x0a9e('0x22')](db[_0x0a9e('0x59')][_0x0a9e('0x21')]);_0x583b2e['query']=_[_0x0a9e('0x22')](_0xcbc8b2[_0x0a9e('0x23')]);_0x583b2e[_0x0a9e('0x26')]=_[_0x0a9e('0x27')](_0x583b2e['model'],_0x583b2e[_0x0a9e('0x23')]);_0x2bdc44[_0x0a9e('0x2a')]=_[_0x0a9e('0x27')](_0x583b2e[_0x0a9e('0x28')],qs[_0x0a9e('0x29')](_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x29')]));_0x2bdc44[_0x0a9e('0x2a')]=_0x2bdc44[_0x0a9e('0x2a')][_0x0a9e('0x2b')]?_0x2bdc44[_0x0a9e('0x2a')]:_0x583b2e[_0x0a9e('0x28')];_0x2bdc44[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2e')](_0xcbc8b2['query'][_0x0a9e('0x2e')]);_0x2bdc44[_0x0a9e('0x2f')]=qs[_0x0a9e('0x26')](_['pick'](_0xcbc8b2[_0x0a9e('0x23')],_0x583b2e[_0x0a9e('0x26')]));if(_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x34')]){_0x2bdc44['where']=_['merge'](_0x2bdc44[_0x0a9e('0x2f')],{'$or':_[_0x0a9e('0x35')](_0x2bdc44['attributes'],function(_0x45108c){var _0x53a6a1={};_0x53a6a1[_0x45108c]={'$like':'%'+_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x34')]+'%'};return _0x53a6a1;})});}_0x2bdc44=_['merge']({},_0x2bdc44,_0xcbc8b2[_0x0a9e('0x36')]);return _0x4437ff[_0x0a9e('0x58')](_0x2bdc44);}})[_0x0a9e('0x19')](function(_0x42b959){if(_0x42b959){_0x44351d=_0x42b959[_0x0a9e('0x2b')];if(!_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x5a')]('nolimit')){_0x2bdc44[_0x0a9e('0x13')]=qs[_0x0a9e('0x13')](_0xcbc8b2[_0x0a9e('0x23')][_0x0a9e('0x13')]);_0x2bdc44['offset']=qs[_0x0a9e('0x12')](_0xcbc8b2[_0x0a9e('0x23')]['offset']);}return _0x4437ff[_0x0a9e('0x58')](_0x2bdc44);}})['then'](function(_0x163710){if(_0x163710){return _0x163710?{'count':_0x44351d,'rows':_0x163710}:null;}})[_0x0a9e('0x19')](respondWithResult(_0x12ccdb,null))[_0x0a9e('0x3a')](handleError(_0x12ccdb,null));}; \ No newline at end of file +var _0x9957=['map','options','then','findAll','rows','show','rawAttributes','includeAll','include','find','body','params','catch','create','sequelize','mode','directory','join','mkdirSync','0777','transaction','readdirSync','forEach','unlinkSync','rmdirSync','message','addSound','Sound','findOne','createdAt','root','server/files/sounds/converted','format','basename','extname','save_name','converted_format','server/files/moh','%s.%s','Sequelize','ValidationError','removeSound','id2','getSounds','filters','nolimit','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','model','query','dateStart','dateEnd','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','add','day','merge','filter'];(function(_0x23814e,_0x3946c9){var _0x46f65e=function(_0x117c98){while(--_0x117c98){_0x23814e['push'](_0x23814e['shift']());}};_0x46f65e(++_0x3946c9);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var jsonpatch=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var Mustache=require('mustache');var util=require(_0x7995('0x4'));var path=require(_0x7995('0x5'));var sox=require(_0x7995('0x6'));var csv=require(_0x7995('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7995('0x8'));var squel=require(_0x7995('0x9'));var crypto=require(_0x7995('0xa'));var jsforce=require(_0x7995('0xb'));var deskjs=require(_0x7995('0xc'));var toCsv=require(_0x7995('0x7'));var querystring=require('querystring');var Papa=require(_0x7995('0xd'));var qs=require(_0x7995('0xe'));var logger=require('../../config/logger')(_0x7995('0xf'));var utils=require(_0x7995('0x10'));var config=require(_0x7995('0x11'));var db=require(_0x7995('0x12'))['db'];function respondWithStatusCode(_0x3c1d19,_0x1e400a){_0x1e400a=_0x1e400a||0xcc;return function(_0x341672){if(_0x341672){return _0x3c1d19['sendStatus'](_0x1e400a);}return _0x3c1d19[_0x7995('0x13')](_0x1e400a)[_0x7995('0x14')]();};}function respondWithResult(_0x581f22,_0xb0c872){_0xb0c872=_0xb0c872||0xc8;return function(_0x2cb37a){if(_0x2cb37a){return _0x581f22[_0x7995('0x13')](_0xb0c872)[_0x7995('0x15')](_0x2cb37a);}};}function respondWithFilteredResult(_0x281576,_0x23999f){return function(_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=_0x2bbe7a[_0x7995('0x16')],_0x58f5ad=_0x23999f[_0x7995('0x17')],_0x2b4e94=_0x23999f[_0x7995('0x17')]+_0x23999f[_0x7995('0x18')],_0x2233dd;if(_0x2b4e94>=_0x4cc004){_0x2b4e94=_0x4cc004;_0x2233dd=0xc8;}else{_0x2233dd=0xce;}_0x281576[_0x7995('0x13')](_0x2233dd);return _0x281576[_0x7995('0x19')]('Content-Range',_0x58f5ad+'-'+_0x2b4e94+'/'+_0x4cc004)[_0x7995('0x15')](_0x2bbe7a);}return null;};}function patchUpdates(_0x565d97){return function(_0x2f832e){try{jsonpatch[_0x7995('0x1a')](_0x2f832e,_0x565d97,!![]);}catch(_0x43d4b8){return BPromise[_0x7995('0x1b')](_0x43d4b8);}return _0x2f832e[_0x7995('0x1c')]();};}function saveUpdates(_0x37a7d4,_0x4faa60){return function(_0x54c9ae){if(_0x54c9ae){return _0x54c9ae[_0x7995('0x1d')](_0x37a7d4)['then'](function(_0x555f74){return _0x555f74;});}return null;};}function removeEntity(_0x3ec178,_0x3d463e){return function(_0x4cbe10){if(_0x4cbe10){return _0x4cbe10[_0x7995('0x1e')]()['then'](function(){_0x3ec178['status'](0xcc)[_0x7995('0x14')]();});}};}function handleEntityNotFound(_0x327b1f,_0x350fd9){return function(_0x1a8568){if(!_0x1a8568){_0x327b1f[_0x7995('0x1f')](0x194);}return _0x1a8568;};}function handleError(_0x1c278a,_0x5d40ae){_0x5d40ae=_0x5d40ae||0x1f4;return function(_0x32a09a){logger[_0x7995('0x20')](_0x32a09a[_0x7995('0x21')]);if(_0x32a09a[_0x7995('0x22')]){delete _0x32a09a[_0x7995('0x22')];}_0x1c278a[_0x7995('0x13')](_0x5d40ae)[_0x7995('0x23')](_0x32a09a);};}exports[_0x7995('0x24')]=function(_0x59405a,_0x39df42){var _0x34e70c={},_0x401dc3={},_0x268ce7={'count':0x0,'rows':[]};var _0x3a3fcf=db[_0x7995('0x25')]['rawAttributes'];_0x401dc3[_0x7995('0x26')]=_['keys'](_0x3a3fcf);var _0x229742={'dateStart':_0x59405a[_0x7995('0x27')][_0x7995('0x28')],'dateEnd':_0x59405a[_0x7995('0x27')][_0x7995('0x29')]};delete _0x59405a['query'][_0x7995('0x28')];delete _0x59405a['query'][_0x7995('0x29')];_0x401dc3[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x59405a['query']);_0x401dc3['filters']=_['intersection'](_0x401dc3[_0x7995('0x26')],_0x401dc3[_0x7995('0x27')]);_0x34e70c[_0x7995('0x2b')]=_[_0x7995('0x2c')](_0x401dc3[_0x7995('0x26')],qs[_0x7995('0x2d')](_0x59405a['query']['fields']));_0x34e70c[_0x7995('0x2b')]=_0x34e70c['attributes'][_0x7995('0x2e')]?_0x34e70c[_0x7995('0x2b')]:_0x401dc3[_0x7995('0x26')];if(!_0x59405a[_0x7995('0x27')][_0x7995('0x2f')]('nolimit')){_0x34e70c[_0x7995('0x18')]=qs[_0x7995('0x18')](_0x59405a['query']['limit']);_0x34e70c['offset']=qs[_0x7995('0x17')](_0x59405a[_0x7995('0x27')]['offset']);}_0x34e70c[_0x7995('0x30')]=qs['sort'](_0x59405a[_0x7995('0x27')][_0x7995('0x31')]);_0x34e70c[_0x7995('0x32')]=qs['filters'](_['pick'](_0x59405a[_0x7995('0x27')],_0x401dc3['filters']));if(_0x229742['dateStart']){if(_0x229742[_0x7995('0x29')]){_0x229742[_0x7995('0x29')]=moment(_0x229742['dateEnd'])[_0x7995('0x33')](0x1,_0x7995('0x34'));}else{_0x229742[_0x7995('0x29')]=moment(_0x229742[_0x7995('0x28')])[_0x7995('0x33')](0x1,'day');}_[_0x7995('0x35')](_0x34e70c[_0x7995('0x32')],{'createdAt':{'$gte':_0x229742[_0x7995('0x28')],'$lte':_0x229742[_0x7995('0x29')]}});}if(_0x59405a['query'][_0x7995('0x36')]){_0x34e70c[_0x7995('0x32')]=_[_0x7995('0x35')](_0x34e70c[_0x7995('0x32')],{'$or':_[_0x7995('0x37')](_0x34e70c[_0x7995('0x2b')],function(_0x5688a1){var _0x183a68={};_0x183a68[_0x5688a1]={'$like':'%'+_0x59405a[_0x7995('0x27')][_0x7995('0x36')]+'%'};return _0x183a68;})});}_0x34e70c=_[_0x7995('0x35')]({},_0x34e70c,_0x59405a[_0x7995('0x38')]);var _0x298fc2={'where':_0x34e70c[_0x7995('0x32')]};return db[_0x7995('0x25')][_0x7995('0x16')](_0x298fc2)[_0x7995('0x39')](function(_0x6fe77b){_0x268ce7[_0x7995('0x16')]=_0x6fe77b;if(_0x59405a[_0x7995('0x27')]['includeAll']){_0x34e70c['include']=[{'all':!![]}];}return db[_0x7995('0x25')][_0x7995('0x3a')](_0x34e70c);})['then'](function(_0x4b0855){_0x268ce7[_0x7995('0x3b')]=_0x4b0855;return _0x268ce7;})['then'](respondWithFilteredResult(_0x39df42,_0x34e70c))['catch'](handleError(_0x39df42,null));};exports[_0x7995('0x3c')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x26')]=_['keys'](db['VoiceMusicOnHold'][_0x7995('0x3d')]);_0x46ac4f[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x36e28b[_0x7995('0x27')]);_0x46ac4f['filters']=_[_0x7995('0x2c')](_0x46ac4f[_0x7995('0x26')],_0x46ac4f[_0x7995('0x27')]);_0x576b96[_0x7995('0x2b')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x2d')](_0x36e28b['query'][_0x7995('0x2d')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x2b')]['length']?_0x576b96[_0x7995('0x2b')]:_0x46ac4f[_0x7995('0x26')];if(_0x36e28b['query'][_0x7995('0x3e')]){_0x576b96[_0x7995('0x3f')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x35')]({},_0x576b96,_0x36e28b[_0x7995('0x38')]);return db['VoiceMusicOnHold'][_0x7995('0x40')](_0x576b96)[_0x7995('0x39')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x39')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x1d')]=function(_0x44f516,_0x511567){if(_0x44f516[_0x7995('0x41')]['id']){delete _0x44f516[_0x7995('0x41')]['id'];}return db['VoiceMusicOnHold'][_0x7995('0x40')]({'where':{'id':_0x44f516[_0x7995('0x42')]['id']}})['then'](handleEntityNotFound(_0x511567,null))[_0x7995('0x39')](saveUpdates(_0x44f516['body'],null))[_0x7995('0x39')](respondWithResult(_0x511567,null))[_0x7995('0x43')](handleError(_0x511567,null));};exports[_0x7995('0x44')]=function(_0x30e220,_0xddf537,_0x14b537){return db[_0x7995('0x45')]['transaction'](function(_0x427dcf){if(_0x30e220[_0x7995('0x41')][_0x7995('0x46')]==='files'){_0x30e220[_0x7995('0x41')][_0x7995('0x47')]=path[_0x7995('0x48')](config['root'],'server/files/moh',_0x30e220['body'][_0x7995('0x22')]);}return db[_0x7995('0x25')]['create'](_0x30e220[_0x7995('0x41')],{'transaction':_0x427dcf})[_0x7995('0x39')](function(_0x31f27c){if(_0x30e220[_0x7995('0x41')][_0x7995('0x46')]==='files'){fs[_0x7995('0x49')](_0x31f27c['directory'],parseInt(_0x7995('0x4a'),0x8));}return _0x31f27c;});})[_0x7995('0x39')](respondWithResult(_0xddf537,0xc9))[_0x7995('0x43')](handleError(_0xddf537,null));};exports['destroy']=function(_0x5e1f34,_0x54e2b1,_0x563f8e){var _0x2e13b0;return db[_0x7995('0x25')][_0x7995('0x40')]({'where':{'id':_0x5e1f34[_0x7995('0x42')]['id']}})[_0x7995('0x39')](function(_0x357e60){if(_0x357e60){return db[_0x7995('0x45')][_0x7995('0x4b')](function(_0x328671){return _0x357e60[_0x7995('0x1e')]({'transaction':_0x328671,'raw':!![]})[_0x7995('0x39')](function(_0x133c63){if(_0x133c63[_0x7995('0x47')]){fs[_0x7995('0x4c')](_0x133c63[_0x7995('0x47')])[_0x7995('0x4d')](function(_0x447a2b){fs[_0x7995('0x4e')](path[_0x7995('0x48')](_0x133c63['directory'],_0x447a2b));});fs[_0x7995('0x4f')](_0x133c63[_0x7995('0x47')]);}return _0x133c63;});})[_0x7995('0x43')](function(_0x32c0d3){throw new db['Sequelize']['ValidationError'](_0x32c0d3[_0x7995('0x50')]);});}})[_0x7995('0x39')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x39')](removeEntity(_0x54e2b1,null))[_0x7995('0x43')](handleError(_0x54e2b1,null));};exports['addSound']=function(_0x13cd7b,_0x74ff38,_0xef5044){return db[_0x7995('0x45')]['transaction'](function(_0x5e2d97){var _0x40e5fc;return db[_0x7995('0x25')][_0x7995('0x40')]({'where':{'id':_0x13cd7b[_0x7995('0x42')]['id']}})[_0x7995('0x39')](function(_0x27c5cd){if(_0x27c5cd){_0x40e5fc=_0x27c5cd;return _0x27c5cd[_0x7995('0x51')](_0x13cd7b[_0x7995('0x41')]['id'],{'transaction':_0x5e2d97});}})[_0x7995('0x39')](function(_0x50caf5){if(_0x50caf5){return db[_0x7995('0x52')][_0x7995('0x53')]({'where':{'id':_0x13cd7b[_0x7995('0x41')]['id']},'attributes':['id',_0x7995('0x22'),'save_name','converted_format',_0x7995('0x54')],'raw':!![]});}})[_0x7995('0x39')](function(_0x47d5d7){if(_0x47d5d7){var _0x971a23=path[_0x7995('0x48')](config[_0x7995('0x55')],_0x7995('0x56'),util[_0x7995('0x57')]('%s.%s',path[_0x7995('0x58')](_0x47d5d7['save_name'],path[_0x7995('0x59')](_0x47d5d7[_0x7995('0x5a')])),_0x47d5d7[_0x7995('0x5b')]));var _0x25b534=path[_0x7995('0x48')](config[_0x7995('0x55')],_0x7995('0x5c'),_0x40e5fc[_0x7995('0x22')],util[_0x7995('0x57')](_0x7995('0x5d'),_0x47d5d7[_0x7995('0x22')],_0x47d5d7[_0x7995('0x5b')]));fs['symlinkSync'](_0x971a23,_0x25b534);return _0x47d5d7;}})[_0x7995('0x43')](function(_0x23bbc1){throw new db[(_0x7995('0x5e'))][(_0x7995('0x5f'))](_0x23bbc1[_0x7995('0x50')]);});})['then'](handleEntityNotFound(_0x74ff38,null))['then'](respondWithResult(_0x74ff38,0xc9))[_0x7995('0x43')](handleError(_0x74ff38,null));};exports[_0x7995('0x60')]=function(_0x221542,_0xae6166,_0x5aa2ec){return db[_0x7995('0x45')]['transaction'](function(_0x5df621){var _0xca8238;return db[_0x7995('0x25')][_0x7995('0x53')]({'where':{'id':_0x221542[_0x7995('0x42')]['id']}})[_0x7995('0x39')](handleEntityNotFound(_0xae6166,null))[_0x7995('0x39')](function(_0x32a52f){if(_0x32a52f){_0xca8238=_0x32a52f;return _0x32a52f[_0x7995('0x60')](_0x221542[_0x7995('0x42')][_0x7995('0x61')]);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return db[_0x7995('0x52')][_0x7995('0x53')]({'where':{'id':_0x221542['params'][_0x7995('0x61')]},'attributes':['id',_0x7995('0x22'),_0x7995('0x5a'),_0x7995('0x5b'),_0x7995('0x54')],'raw':!![]});}})[_0x7995('0x39')](function(_0x550a10){if(_0x550a10){fs[_0x7995('0x4e')](path[_0x7995('0x48')](_0xca8238[_0x7995('0x47')],util[_0x7995('0x57')]('%s.%s',_0x550a10['name'],_0x550a10[_0x7995('0x5b')])));return _0x550a10;}})[_0x7995('0x43')](function(_0x39ebb6){throw new db[(_0x7995('0x5e'))]['ValidationError'](_0x39ebb6[_0x7995('0x50')]);});})[_0x7995('0x39')](handleEntityNotFound(_0xae6166,null))['then'](respondWithStatusCode(_0xae6166,0xcc))['catch'](handleError(_0xae6166,null));};exports[_0x7995('0x62')]=function(_0x305b5a,_0x555277,_0x228de1){var _0x5b1cba={};var _0x3758f9={};var _0xea9aba;var _0x4ff9ff;return db['VoiceMusicOnHold'][_0x7995('0x53')]({'where':{'id':_0x305b5a['params']['id']}})[_0x7995('0x39')](handleEntityNotFound(_0x555277,null))[_0x7995('0x39')](function(_0x3dd197){if(_0x3dd197){_0xea9aba=_0x3dd197;_0x3758f9[_0x7995('0x26')]=_[_0x7995('0x2a')](db[_0x7995('0x52')][_0x7995('0x3d')]);_0x3758f9[_0x7995('0x27')]=_[_0x7995('0x2a')](_0x305b5a[_0x7995('0x27')]);_0x3758f9[_0x7995('0x63')]=_[_0x7995('0x2c')](_0x3758f9[_0x7995('0x26')],_0x3758f9[_0x7995('0x27')]);_0x5b1cba[_0x7995('0x2b')]=_[_0x7995('0x2c')](_0x3758f9[_0x7995('0x26')],qs[_0x7995('0x2d')](_0x305b5a[_0x7995('0x27')][_0x7995('0x2d')]));_0x5b1cba[_0x7995('0x2b')]=_0x5b1cba[_0x7995('0x2b')][_0x7995('0x2e')]?_0x5b1cba[_0x7995('0x2b')]:_0x3758f9[_0x7995('0x26')];_0x5b1cba[_0x7995('0x30')]=qs[_0x7995('0x31')](_0x305b5a[_0x7995('0x27')]['sort']);_0x5b1cba[_0x7995('0x32')]=qs[_0x7995('0x63')](_['pick'](_0x305b5a['query'],_0x3758f9[_0x7995('0x63')]));if(_0x305b5a[_0x7995('0x27')][_0x7995('0x36')]){_0x5b1cba[_0x7995('0x32')]=_[_0x7995('0x35')](_0x5b1cba[_0x7995('0x32')],{'$or':_['map'](_0x5b1cba[_0x7995('0x2b')],function(_0xb68962){var _0x3fea6a={};_0x3fea6a[_0xb68962]={'$like':'%'+_0x305b5a[_0x7995('0x27')][_0x7995('0x36')]+'%'};return _0x3fea6a;})});}_0x5b1cba=_[_0x7995('0x35')]({},_0x5b1cba,_0x305b5a[_0x7995('0x38')]);return _0xea9aba[_0x7995('0x62')](_0x5b1cba);}})['then'](function(_0x1c8e7d){if(_0x1c8e7d){_0x4ff9ff=_0x1c8e7d[_0x7995('0x2e')];if(!_0x305b5a['query']['hasOwnProperty'](_0x7995('0x64'))){_0x5b1cba[_0x7995('0x18')]=qs[_0x7995('0x18')](_0x305b5a[_0x7995('0x27')][_0x7995('0x18')]);_0x5b1cba['offset']=qs[_0x7995('0x17')](_0x305b5a[_0x7995('0x27')]['offset']);}return _0xea9aba[_0x7995('0x62')](_0x5b1cba);}})[_0x7995('0x39')](function(_0x489bac){if(_0x489bac){return _0x489bac?{'count':_0x4ff9ff,'rows':_0x489bac}:null;}})[_0x7995('0x39')](respondWithResult(_0x555277,null))['catch'](handleError(_0x555277,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index cfb45ab..f913d2b 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 _0x7073=['bluebird','request-promise','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','lodash','util','api','moment'];(function(_0x41076b,_0xe7a8bf){var _0x19c1d9=function(_0x46e76a){while(--_0x46e76a){_0x41076b['push'](_0x41076b['shift']());}};_0x19c1d9(++_0xe7a8bf);}(_0x7073,0x114));var _0x3707=function(_0x1a75f1,_0x33574f){_0x1a75f1=_0x1a75f1-0x0;var _0x138758=_0x7073[_0x1a75f1];return _0x138758;};'use strict';var _=require(_0x3707('0x0'));var util=require(_0x3707('0x1'));var logger=require('../../config/logger')(_0x3707('0x2'));var moment=require(_0x3707('0x3'));var BPromise=require(_0x3707('0x4'));var rp=require(_0x3707('0x5'));var attributes=require(_0x3707('0x6'));module[_0x3707('0x7')]=function(_0x21936c,_0x1bcfcc){return _0x21936c[_0x3707('0x8')](_0x3707('0x9'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89cf=['api','moment','bluebird','request-promise','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x10764d,_0x1a6575){var _0x11f971=function(_0x63bc73){while(--_0x63bc73){_0x10764d['push'](_0x10764d['shift']());}};_0x11f971(++_0x1a6575);}(_0x89cf,0x13c));var _0xf89c=function(_0x47b3a4,_0xe1f5b9){_0x47b3a4=_0x47b3a4-0x0;var _0x308108=_0x89cf[_0x47b3a4];return _0x308108;};'use strict';var _=require(_0xf89c('0x0'));var util=require(_0xf89c('0x1'));var logger=require(_0xf89c('0x2'))(_0xf89c('0x3'));var moment=require(_0xf89c('0x4'));var BPromise=require(_0xf89c('0x5'));var rp=require(_0xf89c('0x6'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xf89c('0x7')]=function(_0x5dff40,_0x3998c3){return _0x5dff40[_0xf89c('0x8')](_0xf89c('0x9'),attributes,{'tableName':_0xf89c('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 95d08be..31ced64 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 _0x82d3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment'];(function(_0x245b58,_0x2e2431){var _0x504b83=function(_0x9ce3e4){while(--_0x9ce3e4){_0x245b58['push'](_0x245b58['shift']());}};_0x504b83(++_0x2e2431);}(_0x82d3,0x13f));var _0x382d=function(_0x29426d,_0x1b6680){_0x29426d=_0x29426d-0x0;var _0x23b9ef=_0x82d3[_0x29426d];return _0x23b9ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x382d('0x0'));var BPromise=require(_0x382d('0x1'));var rs=require(_0x382d('0x2'));var fs=require('fs');var db=require(_0x382d('0x3'))['db'];var utils=require(_0x382d('0x4'));var logger=require(_0x382d('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x382d('0x6')][_0x382d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2f9480,_0x8feccb,_0x79256a){return new BPromise(function(_0x440b2a,_0x373023){return client[_0x382d('0x8')](_0x2f9480,_0x79256a)[_0x382d('0x9')](function(_0x5bbc47){logger[_0x382d('0xa')](_0x382d('0xb'),_0x8feccb,_0x382d('0xc'));logger[_0x382d('0xd')](_0x382d('0xe'),_0x8feccb,_0x382d('0xc'),JSON[_0x382d('0xf')](_0x5bbc47));if(_0x5bbc47[_0x382d('0x10')]){if(_0x5bbc47[_0x382d('0x10')][_0x382d('0x11')]===0x1f4){logger[_0x382d('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x8feccb,_0x5bbc47[_0x382d('0x10')][_0x382d('0x12')]);return _0x373023(_0x5bbc47[_0x382d('0x10')][_0x382d('0x12')]);}logger[_0x382d('0x10')](_0x382d('0xb'),_0x8feccb,_0x5bbc47[_0x382d('0x10')][_0x382d('0x12')]);return _0x440b2a(_0x5bbc47[_0x382d('0x10')][_0x382d('0x12')]);}else{logger[_0x382d('0xa')](_0x382d('0xb'),_0x8feccb,'request\x20sent');_0x440b2a(_0x5bbc47['result']['message']);}})[_0x382d('0x13')](function(_0x140630){logger[_0x382d('0x10')](_0x382d('0xb'),_0x8feccb,_0x140630);_0x373023(_0x140630);});});} \ No newline at end of file +var _0x617c=['rpc','jayson/promise','client','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x169639,_0x146136){var _0x277351=function(_0x5e8e2a){while(--_0x5e8e2a){_0x169639['push'](_0x169639['shift']());}};_0x277351(++_0x146136);}(_0x617c,0x164));var _0xc617=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x617c[_0x4ed4d2];return _0x15ae2e;};'use strict';var _=require(_0xc617('0x0'));var util=require('util');var moment=require(_0xc617('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xc617('0x2'))['db'];var utils=require(_0xc617('0x3'));var logger=require(_0xc617('0x4'))(_0xc617('0x5'));var config=require('../../config/environment');var jayson=require(_0xc617('0x6'));var client=jayson[_0xc617('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6a50b,_0x48c57a,_0x3d7896){return new BPromise(function(_0x4c1e91,_0x44d928){return client['request'](_0xd6a50b,_0x3d7896)[_0xc617('0x8')](function(_0x54a089){logger[_0xc617('0x9')](_0xc617('0xa'),_0x48c57a,_0xc617('0xb'));logger[_0xc617('0xc')](_0xc617('0xd'),_0x48c57a,_0xc617('0xb'),JSON[_0xc617('0xe')](_0x54a089));if(_0x54a089[_0xc617('0xf')]){if(_0x54a089[_0xc617('0xf')][_0xc617('0x10')]===0x1f4){logger[_0xc617('0xf')](_0xc617('0xa'),_0x48c57a,_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);return _0x44d928(_0x54a089[_0xc617('0xf')]['message']);}logger[_0xc617('0xf')](_0xc617('0xa'),_0x48c57a,_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);return _0x4c1e91(_0x54a089[_0xc617('0xf')][_0xc617('0x11')]);}else{logger[_0xc617('0x9')](_0xc617('0xa'),_0x48c57a,_0xc617('0xb'));_0x4c1e91(_0x54a089['result'][_0xc617('0x11')]);}})[_0xc617('0x12')](function(_0x5abb62){logger['error'](_0xc617('0xa'),_0x48c57a,_0x5abb62);_0x44d928(_0x5abb62);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index a451ea1..10dee79 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 _0xcf49=['multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/users','post','addAgents','put','update','removeAgents','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcf49,0x1a2));var _0x9cf4=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xcf49[_0x593564];return _0x211a89;};'use strict';var multer=require(_0x9cf4('0x0'));var util=require(_0x9cf4('0x1'));var path=require(_0x9cf4('0x2'));var express=require(_0x9cf4('0x3'));var router=express[_0x9cf4('0x4')]();var auth=require(_0x9cf4('0x5'));var interaction=require(_0x9cf4('0x6'));var config=require(_0x9cf4('0x7'));var controller=require(_0x9cf4('0x8'));router[_0x9cf4('0x9')]('/',auth[_0x9cf4('0xa')](),controller[_0x9cf4('0xb')]);router[_0x9cf4('0x9')](_0x9cf4('0xc'),auth[_0x9cf4('0xa')](),controller['describe']);router[_0x9cf4('0x9')](_0x9cf4('0xd'),auth[_0x9cf4('0xa')](),controller[_0x9cf4('0xe')]);router[_0x9cf4('0x9')](_0x9cf4('0xf'),auth[_0x9cf4('0xa')](),controller['getAgents']);router[_0x9cf4('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9cf4('0x10')](_0x9cf4('0xf'),auth[_0x9cf4('0xa')](),controller[_0x9cf4('0x11')]);router[_0x9cf4('0x12')](_0x9cf4('0xd'),auth['isAuthenticated'](),controller[_0x9cf4('0x13')]);router['delete'](_0x9cf4('0xd'),auth[_0x9cf4('0xa')](),controller['destroy']);router['delete'](_0x9cf4('0xf'),auth[_0x9cf4('0xa')](),controller[_0x9cf4('0x14')]);module[_0x9cf4('0x15')]=router; \ No newline at end of file +var _0x8025=['/:id/users','getAgents','create','post','addAgents','put','update','delete','destroy','removeAgents','exports','multer','path','express','Router','../../components/auth/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xb5c596,_0x418482){var _0xbfb7b9=function(_0x53d143){while(--_0x53d143){_0xb5c596['push'](_0xb5c596['shift']());}};_0xbfb7b9(++_0x418482);}(_0x8025,0xd3));var _0x5802=function(_0x214890,_0x2562c0){_0x214890=_0x214890-0x0;var _0x760050=_0x8025[_0x214890];return _0x760050;};'use strict';var multer=require(_0x5802('0x0'));var util=require('util');var path=require(_0x5802('0x1'));var express=require(_0x5802('0x2'));var router=express[_0x5802('0x3')]();var auth=require(_0x5802('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5802('0x5'));var controller=require(_0x5802('0x6'));router[_0x5802('0x7')]('/',auth[_0x5802('0x8')](),controller[_0x5802('0x9')]);router[_0x5802('0x7')](_0x5802('0xa'),auth[_0x5802('0x8')](),controller[_0x5802('0xb')]);router[_0x5802('0x7')](_0x5802('0xc'),auth[_0x5802('0x8')](),controller[_0x5802('0xd')]);router['get'](_0x5802('0xe'),auth['isAuthenticated'](),controller[_0x5802('0xf')]);router['post']('/',auth[_0x5802('0x8')](),controller[_0x5802('0x10')]);router[_0x5802('0x11')]('/:id/users',auth[_0x5802('0x8')](),controller[_0x5802('0x12')]);router[_0x5802('0x13')](_0x5802('0xc'),auth[_0x5802('0x8')](),controller[_0x5802('0x14')]);router[_0x5802('0x15')](_0x5802('0xc'),auth['isAuthenticated'](),controller[_0x5802('0x16')]);router['delete'](_0x5802('0xe'),auth['isAuthenticated'](),controller[_0x5802('0x17')]);module[_0x5802('0x18')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 894cd45..0dbdedd 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 _0x8263=['STRING','system-','getDataValue','name','INTEGER','sequelize'];(function(_0x36d183,_0x321974){var _0x442e71=function(_0x422f4c){while(--_0x422f4c){_0x36d183['push'](_0x36d183['shift']());}};_0x442e71(++_0x321974);}(_0x8263,0x1a9));var _0x3826=function(_0x3a7817,_0xb6e5d5){_0x3a7817=_0x3a7817-0x0;var _0x323b6d=_0x8263[_0x3a7817];return _0x323b6d;};'use strict';var Sequelize=require(_0x3826('0x0'));module['exports']={'name':{'type':Sequelize[_0x3826('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x16b135){return _0x3826('0x2')+this[_0x3826('0x3')](_0x3826('0x4'))+'-';}},'description':{'type':Sequelize[_0x3826('0x1')]},'callerIdAll':{'type':Sequelize[_0x3826('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x3826('0x5')]}}; \ No newline at end of file +var _0xd67a=['getDataValue','INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x5e0f7b,_0x4ea2b6){var _0x409287=function(_0x1d648e){while(--_0x1d648e){_0x5e0f7b['push'](_0x5e0f7b['shift']());}};_0x409287(++_0x4ea2b6);}(_0xd67a,0x122));var _0xad67=function(_0x1d9d76,_0x43c1fa){_0x1d9d76=_0x1d9d76-0x0;var _0xbdd00c=_0xd67a[_0x1d9d76];return _0xbdd00c;};'use strict';var Sequelize=require(_0xad67('0x0'));module[_0xad67('0x1')]={'name':{'type':Sequelize[_0xad67('0x2')],'allowNull':![],'unique':_0xad67('0x3')},'prefix':{'type':Sequelize[_0xad67('0x4')],'get':function(_0x138a1d){return _0xad67('0x5')+this[_0xad67('0x6')](_0xad67('0x3'))+'-';}},'description':{'type':Sequelize[_0xad67('0x2')]},'callerIdAll':{'type':Sequelize[_0xad67('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xad67('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4b2375d..915ffec 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 _0x9990=['Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','filter','nolimit','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./voicePrefix.socket','register','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','VoicePrefix','rawAttributes','model','keys','query','dateStart','dateEnd','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','day','add','merge','map','options','includeAll','include','findAll','catch','params','intersection','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','context','from-sip','app','type','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId'];(function(_0x42150d,_0x495662){var _0x172c74=function(_0x53d6f1){while(--_0x53d6f1){_0x42150d['push'](_0x42150d['shift']());}};_0x172c74(++_0x495662);}(_0x9990,0xf6));var _0x0999=function(_0xd746ed,_0x81920c){_0xd746ed=_0xd746ed-0x0;var _0x5ef2a6=_0x9990[_0xd746ed];return _0x5ef2a6;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x0999('0x0'));var moment=require(_0x0999('0x1'));var BPromise=require(_0x0999('0x2'));var Mustache=require(_0x0999('0x3'));var util=require(_0x0999('0x4'));var path=require(_0x0999('0x5'));var sox=require(_0x0999('0x6'));var csv=require(_0x0999('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0999('0x8'));var squel=require(_0x0999('0x9'));var crypto=require(_0x0999('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0999('0xb'));var toCsv=require(_0x0999('0x7'));var querystring=require(_0x0999('0xc'));var Papa=require(_0x0999('0xd'));var qs=require(_0x0999('0xe'));var logger=require(_0x0999('0xf'))(_0x0999('0x10'));var utils=require('../../config/utils');var config=require(_0x0999('0x11'));var db=require(_0x0999('0x12'))['db'];var socket=require(_0x0999('0x13'))({'host':'localhost','port':0x18eb});require(_0x0999('0x14'))[_0x0999('0x15')](socket);function respondWithStatusCode(_0x3cbe78,_0x5c4bdf){_0x5c4bdf=_0x5c4bdf||0xcc;return function(_0x43f15c){if(_0x43f15c){return _0x3cbe78['sendStatus'](_0x5c4bdf);}return _0x3cbe78[_0x0999('0x16')](_0x5c4bdf)[_0x0999('0x17')]();};}function respondWithResult(_0x2ea251,_0x428b59){_0x428b59=_0x428b59||0xc8;return function(_0x1a7598){if(_0x1a7598){return _0x2ea251['status'](_0x428b59)[_0x0999('0x18')](_0x1a7598);}};}function respondWithFilteredResult(_0x2fa8e0,_0x39cba9){return function(_0x4011bf){if(_0x4011bf){var _0x294776=_0x4011bf[_0x0999('0x19')],_0x503eec=_0x39cba9[_0x0999('0x1a')],_0x137083=_0x39cba9[_0x0999('0x1a')]+_0x39cba9[_0x0999('0x1b')],_0x3757ae;if(_0x137083>=_0x294776){_0x137083=_0x294776;_0x3757ae=0xc8;}else{_0x3757ae=0xce;}_0x2fa8e0[_0x0999('0x16')](_0x3757ae);return _0x2fa8e0['set'](_0x0999('0x1c'),_0x503eec+'-'+_0x137083+'/'+_0x294776)[_0x0999('0x18')](_0x4011bf);}return null;};}function patchUpdates(_0x4f6440){return function(_0x107573){try{jsonpatch[_0x0999('0x1d')](_0x107573,_0x4f6440,!![]);}catch(_0x56373e){return BPromise[_0x0999('0x1e')](_0x56373e);}return _0x107573[_0x0999('0x1f')]();};}function saveUpdates(_0x220cc3,_0x470c84){return function(_0x3867cc){if(_0x3867cc){return _0x3867cc[_0x0999('0x20')](_0x220cc3)[_0x0999('0x21')](function(_0x113017){return _0x113017;});}return null;};}function removeEntity(_0x8a5ef6,_0x4d451b){return function(_0xe118ec){if(_0xe118ec){return _0xe118ec[_0x0999('0x22')]()['then'](function(){_0x8a5ef6['status'](0xcc)[_0x0999('0x17')]();});}};}function handleEntityNotFound(_0xf2820c,_0x2404be){return function(_0x1a9bb7){if(!_0x1a9bb7){_0xf2820c[_0x0999('0x23')](0x194);}return _0x1a9bb7;};}function handleError(_0x15a7e8,_0x4d4f38){_0x4d4f38=_0x4d4f38||0x1f4;return function(_0x20ba88){logger['error'](_0x20ba88[_0x0999('0x24')]);if(_0x20ba88['name']){delete _0x20ba88[_0x0999('0x25')];}_0x15a7e8[_0x0999('0x16')](_0x4d4f38)[_0x0999('0x26')](_0x20ba88);};}exports[_0x0999('0x27')]=function(_0x4ba35b,_0x55c8b3){var _0x1cc734={},_0x5e5681={},_0x353b0a={'count':0x0,'rows':[]};var _0x4ba497=db[_0x0999('0x28')][_0x0999('0x29')];_0x5e5681[_0x0999('0x2a')]=_[_0x0999('0x2b')](_0x4ba497);var _0x358f45={'dateStart':_0x4ba35b[_0x0999('0x2c')][_0x0999('0x2d')],'dateEnd':_0x4ba35b['query'][_0x0999('0x2e')]};delete _0x4ba35b[_0x0999('0x2c')][_0x0999('0x2d')];delete _0x4ba35b[_0x0999('0x2c')][_0x0999('0x2e')];_0x5e5681['query']=_[_0x0999('0x2b')](_0x4ba35b[_0x0999('0x2c')]);_0x5e5681[_0x0999('0x2f')]=_['intersection'](_0x5e5681['model'],_0x5e5681[_0x0999('0x2c')]);_0x1cc734[_0x0999('0x30')]=_['intersection'](_0x5e5681[_0x0999('0x2a')],qs[_0x0999('0x31')](_0x4ba35b[_0x0999('0x2c')]['fields']));_0x1cc734[_0x0999('0x30')]=_0x1cc734['attributes'][_0x0999('0x32')]?_0x1cc734[_0x0999('0x30')]:_0x5e5681[_0x0999('0x2a')];if(!_0x4ba35b[_0x0999('0x2c')][_0x0999('0x33')]('nolimit')){_0x1cc734['limit']=qs[_0x0999('0x1b')](_0x4ba35b[_0x0999('0x2c')][_0x0999('0x1b')]);_0x1cc734[_0x0999('0x1a')]=qs['offset'](_0x4ba35b[_0x0999('0x2c')][_0x0999('0x1a')]);}_0x1cc734['order']=qs[_0x0999('0x34')](_0x4ba35b[_0x0999('0x2c')][_0x0999('0x34')]);_0x1cc734[_0x0999('0x35')]=qs[_0x0999('0x2f')](_[_0x0999('0x36')](_0x4ba35b['query'],_0x5e5681[_0x0999('0x2f')]));if(_0x358f45['dateStart']){if(_0x358f45[_0x0999('0x2e')]){_0x358f45[_0x0999('0x2e')]=moment(_0x358f45[_0x0999('0x2e')])['add'](0x1,_0x0999('0x37'));}else{_0x358f45[_0x0999('0x2e')]=moment(_0x358f45[_0x0999('0x2d')])[_0x0999('0x38')](0x1,_0x0999('0x37'));}_[_0x0999('0x39')](_0x1cc734[_0x0999('0x35')],{'createdAt':{'$gte':_0x358f45[_0x0999('0x2d')],'$lte':_0x358f45[_0x0999('0x2e')]}});}if(_0x4ba35b[_0x0999('0x2c')]['filter']){_0x1cc734[_0x0999('0x35')]=_[_0x0999('0x39')](_0x1cc734['where'],{'$or':_[_0x0999('0x3a')](_0x1cc734[_0x0999('0x30')],function(_0x26ac17){var _0xb96f4a={};_0xb96f4a[_0x26ac17]={'$like':'%'+_0x4ba35b[_0x0999('0x2c')]['filter']+'%'};return _0xb96f4a;})});}_0x1cc734=_[_0x0999('0x39')]({},_0x1cc734,_0x4ba35b[_0x0999('0x3b')]);var _0x450ef3={'where':_0x1cc734['where']};return db[_0x0999('0x28')][_0x0999('0x19')](_0x450ef3)[_0x0999('0x21')](function(_0x16c73e){_0x353b0a[_0x0999('0x19')]=_0x16c73e;if(_0x4ba35b[_0x0999('0x2c')][_0x0999('0x3c')]){_0x1cc734[_0x0999('0x3d')]=[{'all':!![]}];}return db[_0x0999('0x28')][_0x0999('0x3e')](_0x1cc734);})[_0x0999('0x21')](function(_0x379e1e){_0x353b0a['rows']=_0x379e1e;return _0x353b0a;})[_0x0999('0x21')](respondWithFilteredResult(_0x55c8b3,_0x1cc734))[_0x0999('0x3f')](handleError(_0x55c8b3,null));};exports['show']=function(_0x51956e,_0x638982){var _0x5ee5e8={'raw':![],'where':{'id':_0x51956e[_0x0999('0x40')]['id']}},_0x4a3f28={};_0x4a3f28[_0x0999('0x2a')]=_[_0x0999('0x2b')](db[_0x0999('0x28')][_0x0999('0x29')]);_0x4a3f28[_0x0999('0x2c')]=_[_0x0999('0x2b')](_0x51956e[_0x0999('0x2c')]);_0x4a3f28[_0x0999('0x2f')]=_[_0x0999('0x41')](_0x4a3f28[_0x0999('0x2a')],_0x4a3f28['query']);_0x5ee5e8['attributes']=_[_0x0999('0x41')](_0x4a3f28[_0x0999('0x2a')],qs[_0x0999('0x31')](_0x51956e[_0x0999('0x2c')][_0x0999('0x31')]));_0x5ee5e8[_0x0999('0x30')]=_0x5ee5e8[_0x0999('0x30')][_0x0999('0x32')]?_0x5ee5e8['attributes']:_0x4a3f28['model'];if(_0x51956e[_0x0999('0x2c')][_0x0999('0x3c')]){_0x5ee5e8['include']=[{'all':!![]}];}_0x5ee5e8=_[_0x0999('0x39')]({},_0x5ee5e8,_0x51956e['options']);return db['VoicePrefix'][_0x0999('0x42')](_0x5ee5e8)[_0x0999('0x21')](handleEntityNotFound(_0x638982,null))[_0x0999('0x21')](respondWithResult(_0x638982,null))[_0x0999('0x3f')](handleError(_0x638982,null));};exports[_0x0999('0x22')]=function(_0x6ae41b,_0x24e5a6){return db[_0x0999('0x28')][_0x0999('0x42')]({'where':{'id':_0x6ae41b['params']['id']}})[_0x0999('0x21')](handleEntityNotFound(_0x24e5a6,null))[_0x0999('0x21')](removeEntity(_0x24e5a6,null))[_0x0999('0x3f')](handleError(_0x24e5a6,null));};exports[_0x0999('0x43')]=function(_0x3f2123,_0x2e0e6b){return db[_0x0999('0x28')][_0x0999('0x43')]()[_0x0999('0x21')](respondWithResult(_0x2e0e6b,null))['catch'](handleError(_0x2e0e6b,null));};exports[_0x0999('0x44')]=function(_0x5dea3f,_0x28924a){var _0x218092;return db[_0x0999('0x45')][_0x0999('0x46')](function(_0x422321){return db['VoicePrefix'][_0x0999('0x44')](_0x5dea3f[_0x0999('0x47')],{'transaction':_0x422321})[_0x0999('0x21')](function(_0x17942e){_0x218092=_0x17942e[_0x0999('0x48')]({'plain':!![]});return db[_0x0999('0x49')]['find']({'where':{'id':_0x218092[_0x0999('0x4a')]},'raw':!![]})[_0x0999('0x21')](function(_0x3faafa){return createVoicePrefixExtensions(_0x218092,_0x3faafa,_0x422321);});});})[_0x0999('0x21')](function(){return _0x218092;})[_0x0999('0x21')](respondWithResult(_0x28924a,null))[_0x0999('0x3f')](handleError(_0x28924a,null));};function Extension(_0x7d1b21,_0x4f8c8e,_0x10829d,_0x1df925){this[_0x0999('0x4b')]=_0x0999('0x4c');this['exten']=_0x7d1b21;this[_0x0999('0x4d')]=_0x10829d;this[_0x0999('0x4e')]=_0x0999('0x4f');this['description']=_0x0999('0x50');this[_0x0999('0x51')]=_0x4f8c8e;this[_0x0999('0x52')]=_0x1df925;}function createVoicePrefixExtensions(_0x501161,_0x179b47,_0x155312){return new BPromise(function(_0x1dba17,_0x364e57){var _0x46989a=new Extension(formatPrefixName(_0x501161[_0x0999('0x53')]),0x1,_0x0999('0x54'),_0x0999('0x55'));_0x46989a[_0x0999('0x56')]=_0x501161['id'];return db['VoiceExtension'][_0x0999('0x44')](_0x46989a,{'transaction':_0x155312})[_0x0999('0x21')](function(_0x29025d){var _0x4fe7f4=_0x29025d[_0x0999('0x48')]({'plain':!![]});var _0x4d86d4=_['map'](addVoicePrefixExtensions(_0x501161,_0x179b47),function(_0x295376){_0x295376[_0x0999('0x4a')]=_0x4fe7f4['id'];_0x295376['VoicePrefixId']=_0x501161['id'];return _0x295376;});return db['VoiceExtension']['bulkCreate'](_0x4d86d4,{'transaction':_0x155312})[_0x0999('0x21')](function(_0x3b44b5){if(!_0x3b44b5){return _0x364e57(_0x0999('0x57'));}else{return _0x1dba17(_0x3b44b5);}})[_0x0999('0x3f')](function(_0x31a672){return _0x364e57(_0x31a672);});});;});};function addVoicePrefixExtensions(_0x16614c,_0x1eefda){var _0x2e357b=[];var _0x1dd5b9=formatPrefixName(_0x16614c['prefix']);_0x2e357b[_0x0999('0x58')](new Extension(_0x1dd5b9,0x2,'Set',_0x0999('0x59')+_0x16614c[_0x0999('0x25')]));if(_0x16614c[_0x0999('0x5a')]){_0x2e357b[_0x0999('0x58')](new Extension(_0x1dd5b9,0x3,_0x0999('0x5b'),'PREFIX-CALLERIDALL='+_0x16614c['callerIdAll']));}else{_0x2e357b[_0x0999('0x58')](new Extension(_0x1dd5b9,0x3,_0x0999('0x54'),_0x0999('0x5c')));}_0x2e357b[_0x0999('0x58')](new Extension(_0x1dd5b9,0x4,_0x0999('0x5d'),_0x1eefda['context']+','+_0x0999('0x5e')+(0x8+_0x16614c[_0x0999('0x25')][_0x0999('0x32')])+'}'+','+0x1));return _0x2e357b;}function formatPrefixName(_0x27a4ae){var _0x313d3c='_';for(var _0x41e3eb=0x0;_0x41e3eb<_0x27a4ae[_0x0999('0x32')];_0x41e3eb++){if(_0x27a4ae[_0x0999('0x5f')](_0x41e3eb)=='-'){_0x313d3c+=_0x27a4ae[_0x0999('0x5f')](_0x41e3eb);}else{_0x313d3c+='['+_0x27a4ae[_0x0999('0x5f')](_0x41e3eb)+']';}}_0x313d3c+='.';return _0x313d3c;}exports['update']=function(_0x182d8b,_0x1fef12,_0x4837dd){var _0x192899=_0x182d8b[_0x0999('0x47')];_0x192899[_0x0999('0x53')]=_0x0999('0x60')+_0x192899['name']+'-';return db[_0x0999('0x45')][_0x0999('0x46')](function(_0x4179c0){return db['VoicePrefix']['update'](_0x192899,{'where':{'id':_0x192899['id']},'transaction':_0x4179c0})[_0x0999('0x21')](function(){return db[_0x0999('0x49')][_0x0999('0x22')]({'where':{'VoicePrefixId':_0x192899['id']},'transaction':_0x4179c0})['then'](function(){return db[_0x0999('0x49')][_0x0999('0x42')]({'where':{'id':_0x192899[_0x0999('0x4a')]},'raw':!![]})['then'](function(_0x5cdd52){return createVoicePrefixExtensions(_0x192899,_0x5cdd52,_0x4179c0);});});});})[_0x0999('0x21')](function(){return db[_0x0999('0x28')][_0x0999('0x61')](_0x192899['id']);})[_0x0999('0x21')](respondWithResult(_0x1fef12,null))[_0x0999('0x3f')](handleError(_0x1fef12,null));};exports['addAgents']=function(_0x511941,_0x4953dc,_0x279204){return db[_0x0999('0x28')][_0x0999('0x42')]({'where':{'id':_0x511941['params']['id']}})[_0x0999('0x21')](handleEntityNotFound(_0x4953dc,null))[_0x0999('0x21')](function(_0x139d36){if(_0x139d36){return _0x139d36['addAgents'](_0x511941[_0x0999('0x47')][_0x0999('0x62')],_[_0x0999('0x63')](_0x511941['body'],['ids','id'])||{})[_0x0999('0x64')](function(_0x576272){for(var _0x3b73ba=0x0;_0x3b73ba<_0x511941['body'][_0x0999('0x62')][_0x0999('0x32')];_0x3b73ba+=0x1){socket[_0x0999('0x65')]('userVoicePrefix:save',{'UserId':_0x511941[_0x0999('0x47')]['ids'][_0x3b73ba],'VoicePrefixId':_0x511941[_0x0999('0x40')]['id']});}return _0x576272;});}})[_0x0999('0x21')](respondWithResult(_0x4953dc,null))[_0x0999('0x3f')](handleError(_0x4953dc,null));};exports[_0x0999('0x66')]=function(_0x1b8a42,_0x401dd0,_0x329d61){var _0x41058e;return db[_0x0999('0x28')][_0x0999('0x42')]({'where':{'id':_0x1b8a42[_0x0999('0x40')]['id']}})[_0x0999('0x21')](handleEntityNotFound(_0x401dd0,null))['then'](function(_0x2e0f46){if(_0x2e0f46){return _0x2e0f46[_0x0999('0x66')](_0x1b8a42['query'][_0x0999('0x62')])[_0x0999('0x21')](function(_0x3580f2){if(_[_0x0999('0x67')](_0x1b8a42[_0x0999('0x2c')][_0x0999('0x62')])){for(var _0x10ef5f=0x0;_0x10ef5f<_0x1b8a42[_0x0999('0x2c')][_0x0999('0x62')]['length'];_0x10ef5f+=0x1){socket[_0x0999('0x65')]('userVoicePrefix:remove',{'UserId':_0x1b8a42[_0x0999('0x2c')][_0x0999('0x62')][_0x10ef5f],'VoicePrefixId':_0x1b8a42[_0x0999('0x40')]['id']});}}else{socket[_0x0999('0x65')](_0x0999('0x68'),{'UserId':_0x1b8a42['query'][_0x0999('0x62')],'VoicePrefixId':_0x1b8a42['params']['id']});}});}})[_0x0999('0x21')](respondWithStatusCode(_0x401dd0,null))[_0x0999('0x3f')](handleError(_0x401dd0,null));};exports[_0x0999('0x69')]=function(_0x46fabd,_0xe47622,_0x2528a6){var _0x586af1={};var _0x5f3020={};var _0x443d9a;var _0x13a417;return db['VoicePrefix'][_0x0999('0x6a')]({'where':{'id':_0x46fabd[_0x0999('0x40')]['id']}})[_0x0999('0x21')](handleEntityNotFound(_0xe47622,null))['then'](function(_0x368c0c){if(_0x368c0c){_0x443d9a=_0x368c0c;_0x5f3020[_0x0999('0x2a')]=_['keys'](db[_0x0999('0x6b')][_0x0999('0x29')]);_0x5f3020['query']=_[_0x0999('0x2b')](_0x46fabd[_0x0999('0x2c')]);_0x5f3020[_0x0999('0x2f')]=_['intersection'](_0x5f3020[_0x0999('0x2a')],_0x5f3020['query']);_0x586af1['attributes']=_[_0x0999('0x41')](_0x5f3020['model'],qs[_0x0999('0x31')](_0x46fabd[_0x0999('0x2c')][_0x0999('0x31')]));_0x586af1[_0x0999('0x30')]=_0x586af1[_0x0999('0x30')][_0x0999('0x32')]?_0x586af1[_0x0999('0x30')]:_0x5f3020['model'];_0x586af1[_0x0999('0x6c')]=qs['sort'](_0x46fabd['query'][_0x0999('0x34')]);_0x586af1[_0x0999('0x35')]=qs[_0x0999('0x2f')](_['pick'](_0x46fabd['query'],_0x5f3020['filters']));if(_0x46fabd['query'][_0x0999('0x6d')]){_0x586af1[_0x0999('0x35')]=_[_0x0999('0x39')](_0x586af1['where'],{'$or':_[_0x0999('0x3a')](_0x586af1[_0x0999('0x30')],function(_0x2cff11){var _0x30020a={};_0x30020a[_0x2cff11]={'$like':'%'+_0x46fabd[_0x0999('0x2c')]['filter']+'%'};return _0x30020a;})});}_0x586af1=_[_0x0999('0x39')]({},_0x586af1,_0x46fabd['options']);return _0x443d9a[_0x0999('0x69')](_0x586af1);}})[_0x0999('0x21')](function(_0x32fcde){if(_0x32fcde){_0x13a417=_0x32fcde[_0x0999('0x32')];if(!_0x46fabd[_0x0999('0x2c')][_0x0999('0x33')](_0x0999('0x6e'))){_0x586af1[_0x0999('0x1b')]=qs[_0x0999('0x1b')](_0x46fabd[_0x0999('0x2c')]['limit']);_0x586af1[_0x0999('0x1a')]=qs[_0x0999('0x1a')](_0x46fabd[_0x0999('0x2c')][_0x0999('0x1a')]);}return _0x443d9a[_0x0999('0x69')](_0x586af1);}})[_0x0999('0x21')](function(_0x4483e4){if(_0x4483e4){return _0x4483e4?{'count':_0x13a417,'rows':_0x4483e4}:null;}})[_0x0999('0x21')](respondWithResult(_0xe47622,null))[_0x0999('0x3f')](handleError(_0xe47622,null));}; \ No newline at end of file +var _0xf81a=['VoicePrefixId','get','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','name','charAt','body','sequelize','findById','addAgents','ids','omit','spread','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','User','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./voicePrefix.socket','register','sendStatus','end','json','offset','limit','set','Content-Range','apply','reject','update','then','status','error','stack','send','index','VoicePrefix','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','add','day','merge','filter','map','count','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','destroy','describe','create','transaction','VoiceExtension','VoiceExtensionId','context','from-sip','exten','app','type','system','description','priority','prefix','NoOp','Voice\x20Prefix'];(function(_0x11c7eb,_0x2e2415){var _0xea9298=function(_0x408bdd){while(--_0x408bdd){_0x11c7eb['push'](_0x11c7eb['shift']());}};_0xea9298(++_0x2e2415);}(_0xf81a,0x16b));var _0xaf81=function(_0x2beb05,_0x258f9f){_0x2beb05=_0x2beb05-0x0;var _0x10e993=_0xf81a[_0x2beb05];return _0x10e993;};'use strict';var jsonpatch=require(_0xaf81('0x0'));var rp=require(_0xaf81('0x1'));var moment=require(_0xaf81('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaf81('0x3'));var util=require(_0xaf81('0x4'));var path=require(_0xaf81('0x5'));var sox=require('sox');var csv=require(_0xaf81('0x6'));var ejs=require(_0xaf81('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0xaf81('0x8'));var crypto=require(_0xaf81('0x9'));var jsforce=require(_0xaf81('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xaf81('0x6'));var querystring=require(_0xaf81('0xb'));var Papa=require('papaparse');var qs=require(_0xaf81('0xc'));var logger=require(_0xaf81('0xd'))(_0xaf81('0xe'));var utils=require(_0xaf81('0xf'));var config=require('../../config/environment');var db=require(_0xaf81('0x10'))['db'];var socket=require(_0xaf81('0x11'))({'host':_0xaf81('0x12'),'port':0x18eb});require(_0xaf81('0x13'))[_0xaf81('0x14')](socket);function respondWithStatusCode(_0x678209,_0x4a1e29){_0x4a1e29=_0x4a1e29||0xcc;return function(_0x57ba9c){if(_0x57ba9c){return _0x678209[_0xaf81('0x15')](_0x4a1e29);}return _0x678209['status'](_0x4a1e29)[_0xaf81('0x16')]();};}function respondWithResult(_0x327517,_0x2b62dd){_0x2b62dd=_0x2b62dd||0xc8;return function(_0x3f6fbd){if(_0x3f6fbd){return _0x327517['status'](_0x2b62dd)[_0xaf81('0x17')](_0x3f6fbd);}};}function respondWithFilteredResult(_0x10974a,_0x120016){return function(_0x3f588c){if(_0x3f588c){var _0x3cdeda=_0x3f588c['count'],_0x569747=_0x120016[_0xaf81('0x18')],_0x201ae4=_0x120016[_0xaf81('0x18')]+_0x120016[_0xaf81('0x19')],_0x317077;if(_0x201ae4>=_0x3cdeda){_0x201ae4=_0x3cdeda;_0x317077=0xc8;}else{_0x317077=0xce;}_0x10974a['status'](_0x317077);return _0x10974a[_0xaf81('0x1a')](_0xaf81('0x1b'),_0x569747+'-'+_0x201ae4+'/'+_0x3cdeda)[_0xaf81('0x17')](_0x3f588c);}return null;};}function patchUpdates(_0xd1430d){return function(_0x1f252f){try{jsonpatch[_0xaf81('0x1c')](_0x1f252f,_0xd1430d,!![]);}catch(_0xdcc2b4){return BPromise[_0xaf81('0x1d')](_0xdcc2b4);}return _0x1f252f['save']();};}function saveUpdates(_0x1416c9,_0x5c9e27){return function(_0x25aebc){if(_0x25aebc){return _0x25aebc[_0xaf81('0x1e')](_0x1416c9)[_0xaf81('0x1f')](function(_0x1f004d){return _0x1f004d;});}return null;};}function removeEntity(_0x274ced,_0x5a543e){return function(_0x5e353e){if(_0x5e353e){return _0x5e353e['destroy']()[_0xaf81('0x1f')](function(){_0x274ced[_0xaf81('0x20')](0xcc)[_0xaf81('0x16')]();});}};}function handleEntityNotFound(_0x11439d,_0x15363d){return function(_0x9cbb14){if(!_0x9cbb14){_0x11439d[_0xaf81('0x15')](0x194);}return _0x9cbb14;};}function handleError(_0x146bf0,_0x1a8dfb){_0x1a8dfb=_0x1a8dfb||0x1f4;return function(_0x59f2fe){logger[_0xaf81('0x21')](_0x59f2fe[_0xaf81('0x22')]);if(_0x59f2fe['name']){delete _0x59f2fe['name'];}_0x146bf0['status'](_0x1a8dfb)[_0xaf81('0x23')](_0x59f2fe);};}exports[_0xaf81('0x24')]=function(_0x22099d,_0x3edffb){var _0x31cb17={},_0x28f593={},_0x2767c4={'count':0x0,'rows':[]};var _0x1d1d4a=db[_0xaf81('0x25')]['rawAttributes'];_0x28f593[_0xaf81('0x26')]=_[_0xaf81('0x27')](_0x1d1d4a);var _0xd85377={'dateStart':_0x22099d['query'][_0xaf81('0x28')],'dateEnd':_0x22099d[_0xaf81('0x29')][_0xaf81('0x2a')]};delete _0x22099d[_0xaf81('0x29')][_0xaf81('0x28')];delete _0x22099d['query'][_0xaf81('0x2a')];_0x28f593[_0xaf81('0x29')]=_[_0xaf81('0x27')](_0x22099d[_0xaf81('0x29')]);_0x28f593[_0xaf81('0x2b')]=_[_0xaf81('0x2c')](_0x28f593[_0xaf81('0x26')],_0x28f593[_0xaf81('0x29')]);_0x31cb17[_0xaf81('0x2d')]=_[_0xaf81('0x2c')](_0x28f593['model'],qs[_0xaf81('0x2e')](_0x22099d['query'][_0xaf81('0x2e')]));_0x31cb17['attributes']=_0x31cb17['attributes'][_0xaf81('0x2f')]?_0x31cb17['attributes']:_0x28f593[_0xaf81('0x26')];if(!_0x22099d['query'][_0xaf81('0x30')]('nolimit')){_0x31cb17[_0xaf81('0x19')]=qs[_0xaf81('0x19')](_0x22099d[_0xaf81('0x29')][_0xaf81('0x19')]);_0x31cb17[_0xaf81('0x18')]=qs[_0xaf81('0x18')](_0x22099d[_0xaf81('0x29')][_0xaf81('0x18')]);}_0x31cb17[_0xaf81('0x31')]=qs['sort'](_0x22099d[_0xaf81('0x29')][_0xaf81('0x32')]);_0x31cb17[_0xaf81('0x33')]=qs['filters'](_[_0xaf81('0x34')](_0x22099d[_0xaf81('0x29')],_0x28f593[_0xaf81('0x2b')]));if(_0xd85377[_0xaf81('0x28')]){if(_0xd85377['dateEnd']){_0xd85377['dateEnd']=moment(_0xd85377[_0xaf81('0x2a')])[_0xaf81('0x35')](0x1,_0xaf81('0x36'));}else{_0xd85377['dateEnd']=moment(_0xd85377[_0xaf81('0x28')])[_0xaf81('0x35')](0x1,_0xaf81('0x36'));}_[_0xaf81('0x37')](_0x31cb17[_0xaf81('0x33')],{'createdAt':{'$gte':_0xd85377[_0xaf81('0x28')],'$lte':_0xd85377[_0xaf81('0x2a')]}});}if(_0x22099d[_0xaf81('0x29')][_0xaf81('0x38')]){_0x31cb17[_0xaf81('0x33')]=_[_0xaf81('0x37')](_0x31cb17[_0xaf81('0x33')],{'$or':_[_0xaf81('0x39')](_0x31cb17[_0xaf81('0x2d')],function(_0x56d9c8){var _0x588d58={};_0x588d58[_0x56d9c8]={'$like':'%'+_0x22099d[_0xaf81('0x29')][_0xaf81('0x38')]+'%'};return _0x588d58;})});}_0x31cb17=_[_0xaf81('0x37')]({},_0x31cb17,_0x22099d['options']);var _0x4c8487={'where':_0x31cb17[_0xaf81('0x33')]};return db['VoicePrefix'][_0xaf81('0x3a')](_0x4c8487)['then'](function(_0x4baa95){_0x2767c4['count']=_0x4baa95;if(_0x22099d['query'][_0xaf81('0x3b')]){_0x31cb17[_0xaf81('0x3c')]=[{'all':!![]}];}return db[_0xaf81('0x25')][_0xaf81('0x3d')](_0x31cb17);})[_0xaf81('0x1f')](function(_0x280294){_0x2767c4['rows']=_0x280294;return _0x2767c4;})[_0xaf81('0x1f')](respondWithFilteredResult(_0x3edffb,_0x31cb17))[_0xaf81('0x3e')](handleError(_0x3edffb,null));};exports[_0xaf81('0x3f')]=function(_0x4979dd,_0x107bd0){var _0xb8d26d={'raw':![],'where':{'id':_0x4979dd[_0xaf81('0x40')]['id']}},_0x1755be={};_0x1755be[_0xaf81('0x26')]=_[_0xaf81('0x27')](db[_0xaf81('0x25')][_0xaf81('0x41')]);_0x1755be[_0xaf81('0x29')]=_[_0xaf81('0x27')](_0x4979dd['query']);_0x1755be['filters']=_['intersection'](_0x1755be[_0xaf81('0x26')],_0x1755be[_0xaf81('0x29')]);_0xb8d26d[_0xaf81('0x2d')]=_[_0xaf81('0x2c')](_0x1755be[_0xaf81('0x26')],qs[_0xaf81('0x2e')](_0x4979dd[_0xaf81('0x29')]['fields']));_0xb8d26d[_0xaf81('0x2d')]=_0xb8d26d[_0xaf81('0x2d')][_0xaf81('0x2f')]?_0xb8d26d['attributes']:_0x1755be['model'];if(_0x4979dd[_0xaf81('0x29')][_0xaf81('0x3b')]){_0xb8d26d[_0xaf81('0x3c')]=[{'all':!![]}];}_0xb8d26d=_[_0xaf81('0x37')]({},_0xb8d26d,_0x4979dd[_0xaf81('0x42')]);return db[_0xaf81('0x25')][_0xaf81('0x43')](_0xb8d26d)[_0xaf81('0x1f')](handleEntityNotFound(_0x107bd0,null))[_0xaf81('0x1f')](respondWithResult(_0x107bd0,null))[_0xaf81('0x3e')](handleError(_0x107bd0,null));};exports[_0xaf81('0x44')]=function(_0x46b806,_0x38a9fa){return db['VoicePrefix']['find']({'where':{'id':_0x46b806[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x38a9fa,null))[_0xaf81('0x1f')](removeEntity(_0x38a9fa,null))[_0xaf81('0x3e')](handleError(_0x38a9fa,null));};exports[_0xaf81('0x45')]=function(_0x2a40f7,_0x38193d){return db[_0xaf81('0x25')][_0xaf81('0x45')]()[_0xaf81('0x1f')](respondWithResult(_0x38193d,null))[_0xaf81('0x3e')](handleError(_0x38193d,null));};exports[_0xaf81('0x46')]=function(_0x5a2cc2,_0x392ad5){var _0x2f0ab8;return db['sequelize'][_0xaf81('0x47')](function(_0x37f854){return db[_0xaf81('0x25')][_0xaf81('0x46')](_0x5a2cc2['body'],{'transaction':_0x37f854})[_0xaf81('0x1f')](function(_0x131237){_0x2f0ab8=_0x131237['get']({'plain':!![]});return db[_0xaf81('0x48')][_0xaf81('0x43')]({'where':{'id':_0x2f0ab8[_0xaf81('0x49')]},'raw':!![]})['then'](function(_0x146e82){return createVoicePrefixExtensions(_0x2f0ab8,_0x146e82,_0x37f854);});});})[_0xaf81('0x1f')](function(){return _0x2f0ab8;})[_0xaf81('0x1f')](respondWithResult(_0x392ad5,null))[_0xaf81('0x3e')](handleError(_0x392ad5,null));};function Extension(_0x3414b1,_0x13810e,_0x58da6a,_0x170ade){this[_0xaf81('0x4a')]=_0xaf81('0x4b');this[_0xaf81('0x4c')]=_0x3414b1;this[_0xaf81('0x4d')]=_0x58da6a;this[_0xaf81('0x4e')]=_0xaf81('0x4f');this[_0xaf81('0x50')]='Voice\x20Prefix\x20Extension';this[_0xaf81('0x51')]=_0x13810e;this['appdata']=_0x170ade;}function createVoicePrefixExtensions(_0x183619,_0x57d882,_0x1b8189){return new BPromise(function(_0x1422a7,_0x5e040b){var _0x99ea7a=new Extension(formatPrefixName(_0x183619[_0xaf81('0x52')]),0x1,_0xaf81('0x53'),_0xaf81('0x54'));_0x99ea7a[_0xaf81('0x55')]=_0x183619['id'];return db[_0xaf81('0x48')][_0xaf81('0x46')](_0x99ea7a,{'transaction':_0x1b8189})[_0xaf81('0x1f')](function(_0x3a7dda){var _0x6b37aa=_0x3a7dda[_0xaf81('0x56')]({'plain':!![]});var _0x5c95fc=_[_0xaf81('0x39')](addVoicePrefixExtensions(_0x183619,_0x57d882),function(_0x426c87){_0x426c87[_0xaf81('0x49')]=_0x6b37aa['id'];_0x426c87[_0xaf81('0x55')]=_0x183619['id'];return _0x426c87;});return db[_0xaf81('0x48')][_0xaf81('0x57')](_0x5c95fc,{'transaction':_0x1b8189})['then'](function(_0x536128){if(!_0x536128){return _0x5e040b(_0xaf81('0x58'));}else{return _0x1422a7(_0x536128);}})['catch'](function(_0x458292){return _0x5e040b(_0x458292);});});;});};function addVoicePrefixExtensions(_0x306081,_0x2cda21){var _0x39d18c=[];var _0x3e8eb6=formatPrefixName(_0x306081[_0xaf81('0x52')]);_0x39d18c[_0xaf81('0x59')](new Extension(_0x3e8eb6,0x2,_0xaf81('0x5a'),_0xaf81('0x5b')+_0x306081['name']));if(_0x306081[_0xaf81('0x5c')]){_0x39d18c['push'](new Extension(_0x3e8eb6,0x3,_0xaf81('0x5a'),_0xaf81('0x5d')+_0x306081[_0xaf81('0x5c')]));}else{_0x39d18c[_0xaf81('0x59')](new Extension(_0x3e8eb6,0x3,_0xaf81('0x53'),_0xaf81('0x5e')));}_0x39d18c['push'](new Extension(_0x3e8eb6,0x4,_0xaf81('0x5f'),_0x2cda21[_0xaf81('0x4a')]+','+_0xaf81('0x60')+(0x8+_0x306081[_0xaf81('0x61')]['length'])+'}'+','+0x1));return _0x39d18c;}function formatPrefixName(_0x28c3d7){var _0x2c7810='_';for(var _0x25a4b7=0x0;_0x25a4b7<_0x28c3d7[_0xaf81('0x2f')];_0x25a4b7++){if(_0x28c3d7[_0xaf81('0x62')](_0x25a4b7)=='-'){_0x2c7810+=_0x28c3d7[_0xaf81('0x62')](_0x25a4b7);}else{_0x2c7810+='['+_0x28c3d7[_0xaf81('0x62')](_0x25a4b7)+']';}}_0x2c7810+='.';return _0x2c7810;}exports[_0xaf81('0x1e')]=function(_0x2927e9,_0x129b8a,_0x3e84d3){var _0xa133a5=_0x2927e9[_0xaf81('0x63')];_0xa133a5[_0xaf81('0x52')]='system-'+_0xa133a5['name']+'-';return db[_0xaf81('0x64')][_0xaf81('0x47')](function(_0x4a07da){return db[_0xaf81('0x25')][_0xaf81('0x1e')](_0xa133a5,{'where':{'id':_0xa133a5['id']},'transaction':_0x4a07da})[_0xaf81('0x1f')](function(){return db[_0xaf81('0x48')][_0xaf81('0x44')]({'where':{'VoicePrefixId':_0xa133a5['id']},'transaction':_0x4a07da})['then'](function(){return db[_0xaf81('0x48')]['find']({'where':{'id':_0xa133a5['VoiceExtensionId']},'raw':!![]})[_0xaf81('0x1f')](function(_0x562d69){return createVoicePrefixExtensions(_0xa133a5,_0x562d69,_0x4a07da);});});});})[_0xaf81('0x1f')](function(){return db['VoicePrefix'][_0xaf81('0x65')](_0xa133a5['id']);})[_0xaf81('0x1f')](respondWithResult(_0x129b8a,null))[_0xaf81('0x3e')](handleError(_0x129b8a,null));};exports[_0xaf81('0x66')]=function(_0x3c3424,_0x314886,_0x19587b){return db[_0xaf81('0x25')][_0xaf81('0x43')]({'where':{'id':_0x3c3424[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x314886,null))[_0xaf81('0x1f')](function(_0xbacc32){if(_0xbacc32){return _0xbacc32[_0xaf81('0x66')](_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')],_[_0xaf81('0x68')](_0x3c3424['body'],[_0xaf81('0x67'),'id'])||{})[_0xaf81('0x69')](function(_0x441bc2){for(var _0x33ae9a=0x0;_0x33ae9a<_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')]['length'];_0x33ae9a+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':_0x3c3424[_0xaf81('0x63')][_0xaf81('0x67')][_0x33ae9a],'VoicePrefixId':_0x3c3424[_0xaf81('0x40')]['id']});}return _0x441bc2;});}})[_0xaf81('0x1f')](respondWithResult(_0x314886,null))[_0xaf81('0x3e')](handleError(_0x314886,null));};exports['removeAgents']=function(_0x5a2070,_0x4321cb,_0xb5ed1b){var _0x3a0b19;return db[_0xaf81('0x25')]['find']({'where':{'id':_0x5a2070[_0xaf81('0x40')]['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x4321cb,null))['then'](function(_0x7f753e){if(_0x7f753e){return _0x7f753e[_0xaf81('0x6a')](_0x5a2070['query']['ids'])[_0xaf81('0x1f')](function(_0x1634c6){if(_[_0xaf81('0x6b')](_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')])){for(var _0x27fb70=0x0;_0x27fb70<_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')][_0xaf81('0x2f')];_0x27fb70+=0x1){socket[_0xaf81('0x6c')](_0xaf81('0x6d'),{'UserId':_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')][_0x27fb70],'VoicePrefixId':_0x5a2070[_0xaf81('0x40')]['id']});}}else{socket[_0xaf81('0x6c')](_0xaf81('0x6d'),{'UserId':_0x5a2070[_0xaf81('0x29')][_0xaf81('0x67')],'VoicePrefixId':_0x5a2070['params']['id']});}});}})[_0xaf81('0x1f')](respondWithStatusCode(_0x4321cb,null))[_0xaf81('0x3e')](handleError(_0x4321cb,null));};exports[_0xaf81('0x6e')]=function(_0x301e84,_0x190572,_0x6b7efa){var _0x59d921={};var _0xebbf99={};var _0x3a2c5d;var _0x2b8115;return db[_0xaf81('0x25')]['findOne']({'where':{'id':_0x301e84['params']['id']}})[_0xaf81('0x1f')](handleEntityNotFound(_0x190572,null))[_0xaf81('0x1f')](function(_0x26621b){if(_0x26621b){_0x3a2c5d=_0x26621b;_0xebbf99[_0xaf81('0x26')]=_[_0xaf81('0x27')](db[_0xaf81('0x6f')]['rawAttributes']);_0xebbf99[_0xaf81('0x29')]=_['keys'](_0x301e84[_0xaf81('0x29')]);_0xebbf99[_0xaf81('0x2b')]=_['intersection'](_0xebbf99[_0xaf81('0x26')],_0xebbf99[_0xaf81('0x29')]);_0x59d921['attributes']=_[_0xaf81('0x2c')](_0xebbf99[_0xaf81('0x26')],qs[_0xaf81('0x2e')](_0x301e84[_0xaf81('0x29')]['fields']));_0x59d921[_0xaf81('0x2d')]=_0x59d921[_0xaf81('0x2d')][_0xaf81('0x2f')]?_0x59d921[_0xaf81('0x2d')]:_0xebbf99[_0xaf81('0x26')];_0x59d921[_0xaf81('0x31')]=qs[_0xaf81('0x32')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x32')]);_0x59d921[_0xaf81('0x33')]=qs[_0xaf81('0x2b')](_['pick'](_0x301e84[_0xaf81('0x29')],_0xebbf99['filters']));if(_0x301e84[_0xaf81('0x29')][_0xaf81('0x38')]){_0x59d921[_0xaf81('0x33')]=_[_0xaf81('0x37')](_0x59d921['where'],{'$or':_[_0xaf81('0x39')](_0x59d921[_0xaf81('0x2d')],function(_0x235f8d){var _0x76582c={};_0x76582c[_0x235f8d]={'$like':'%'+_0x301e84[_0xaf81('0x29')][_0xaf81('0x38')]+'%'};return _0x76582c;})});}_0x59d921=_[_0xaf81('0x37')]({},_0x59d921,_0x301e84[_0xaf81('0x42')]);return _0x3a2c5d[_0xaf81('0x6e')](_0x59d921);}})[_0xaf81('0x1f')](function(_0x43a061){if(_0x43a061){_0x2b8115=_0x43a061['length'];if(!_0x301e84[_0xaf81('0x29')]['hasOwnProperty']('nolimit')){_0x59d921[_0xaf81('0x19')]=qs[_0xaf81('0x19')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x19')]);_0x59d921[_0xaf81('0x18')]=qs[_0xaf81('0x18')](_0x301e84[_0xaf81('0x29')][_0xaf81('0x18')]);}return _0x3a2c5d[_0xaf81('0x6e')](_0x59d921);}})[_0xaf81('0x1f')](function(_0x5489ee){if(_0x5489ee){return _0x5489ee?{'count':_0x2b8115,'rows':_0x5489ee}:null;}})[_0xaf81('0x1f')](respondWithResult(_0x190572,null))[_0xaf81('0x3e')](handleError(_0x190572,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 324e58e..d1c6a2d 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 _0x0c02=['VoicePrefix','save','update','remove','emit','hasOwnProperty','../../mysqldb'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x20c0('0x0'))['db'][_0x20c0('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x20c0('0x2'),'afterUpdate':_0x20c0('0x3'),'afterDestroy':_0x20c0('0x4')};function emitEvent(_0x6d03d0){return function(_0x38022e,_0x2e9d65,_0x2afa72){VoicePrefixEvents[_0x20c0('0x5')](_0x6d03d0+':'+_0x38022e['id'],_0x38022e);VoicePrefixEvents[_0x20c0('0x5')](_0x6d03d0,_0x38022e);_0x2afa72(null);};}for(var e in events){if(events[_0x20c0('0x6')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x50a6=['hasOwnProperty','hook','exports','events','../../mysqldb','save','remove'];(function(_0x470ff2,_0x553a47){var _0x766eb6=function(_0xa5a4fc){while(--_0xa5a4fc){_0x470ff2['push'](_0x470ff2['shift']());}};_0x766eb6(++_0x553a47);}(_0x50a6,0xa4));var _0x650a=function(_0x37b31c,_0x19ffd5){_0x37b31c=_0x37b31c-0x0;var _0x18cccc=_0x50a6[_0x37b31c];return _0x18cccc;};'use strict';var EventEmitter=require(_0x650a('0x0'));var VoicePrefix=require(_0x650a('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x650a('0x2'),'afterUpdate':'update','afterDestroy':_0x650a('0x3')};function emitEvent(_0x15dd02){return function(_0x2c71ba,_0x4a0147,_0xa3311){VoicePrefixEvents['emit'](_0x15dd02+':'+_0x2c71ba['id'],_0x2c71ba);VoicePrefixEvents['emit'](_0x15dd02,_0x2c71ba);_0xa3311(null);};}for(var e in events){if(events[_0x650a('0x4')](e)){var event=events[e];VoicePrefix[_0x650a('0x5')](e,emitEvent(event));}}module[_0x650a('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 24df759..b6e2218 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 _0x5294=['../../config/logger','api','moment','bluebird','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util'];(function(_0x5591b6,_0x5bde35){var _0x4e1b58=function(_0x3dafcf){while(--_0x3dafcf){_0x5591b6['push'](_0x5591b6['shift']());}};_0x4e1b58(++_0x5bde35);}(_0x5294,0x111));var _0x4529=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5294[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x4529('0x0'));var util=require(_0x4529('0x1'));var logger=require(_0x4529('0x2'))(_0x4529('0x3'));var moment=require(_0x4529('0x4'));var BPromise=require(_0x4529('0x5'));var rp=require('request-promise');var attributes=require(_0x4529('0x6'));module[_0x4529('0x7')]=function(_0xb3fbab,_0x5ee1a6){return _0xb3fbab[_0x4529('0x8')](_0x4529('0x9'),attributes,{'tableName':_0x4529('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea4a=['bluebird','request-promise','exports','define','VoicePrefix','voice_prefixes','lodash','api','moment'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xea4a,0xf0));var _0xaea4=function(_0x256124,_0x3bd5c7){_0x256124=_0x256124-0x0;var _0x5b23c3=_0xea4a[_0x256124];return _0x5b23c3;};'use strict';var _=require(_0xaea4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaea4('0x1'));var moment=require(_0xaea4('0x2'));var BPromise=require(_0xaea4('0x3'));var rp=require(_0xaea4('0x4'));var attributes=require('./voicePrefix.attributes');module[_0xaea4('0x5')]=function(_0x551892,_0x32ae28){return _0x551892[_0xaea4('0x6')](_0xaea4('0x7'),attributes,{'tableName':_0xaea4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index e3496da..fc8cc17 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 _0xeb38=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','socket.io-emitter','localhost','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x90bc3a,_0x588973){var _0x3805ff=function(_0x27ff9e){while(--_0x27ff9e){_0x90bc3a['push'](_0x90bc3a['shift']());}};_0x3805ff(++_0x588973);}(_0xeb38,0x1d2));var _0x8eb3=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xeb38[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x8eb3('0x0'));var util=require(_0x8eb3('0x1'));var moment=require(_0x8eb3('0x2'));var BPromise=require(_0x8eb3('0x3'));var rs=require(_0x8eb3('0x4'));var fs=require('fs');var db=require(_0x8eb3('0x5'))['db'];var utils=require(_0x8eb3('0x6'));var logger=require(_0x8eb3('0x7'))(_0x8eb3('0x8'));var config=require('../../config/environment');var jayson=require(_0x8eb3('0x9'));var client=jayson[_0x8eb3('0xa')][_0x8eb3('0xb')]({'port':0x232a});var socket=require(_0x8eb3('0xc'))({'host':_0x8eb3('0xd'),'port':0x18eb});require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x4b2957,_0x5b510e,_0x156527){return new BPromise(function(_0x4c5dec,_0x10e4fe){return client['request'](_0x4b2957,_0x156527)[_0x8eb3('0xe')](function(_0x3fed78){logger[_0x8eb3('0xf')](_0x8eb3('0x10'),_0x5b510e,_0x8eb3('0x11'));logger[_0x8eb3('0x12')](_0x8eb3('0x13'),_0x5b510e,_0x8eb3('0x11'),JSON[_0x8eb3('0x14')](_0x3fed78));if(_0x3fed78['error']){if(_0x3fed78[_0x8eb3('0x15')][_0x8eb3('0x16')]===0x1f4){logger[_0x8eb3('0x15')](_0x8eb3('0x10'),_0x5b510e,_0x3fed78[_0x8eb3('0x15')][_0x8eb3('0x17')]);return _0x10e4fe(_0x3fed78[_0x8eb3('0x15')][_0x8eb3('0x17')]);}logger[_0x8eb3('0x15')](_0x8eb3('0x10'),_0x5b510e,_0x3fed78['error'][_0x8eb3('0x17')]);return _0x4c5dec(_0x3fed78[_0x8eb3('0x15')]['message']);}else{logger['info'](_0x8eb3('0x10'),_0x5b510e,'request\x20sent');_0x4c5dec(_0x3fed78[_0x8eb3('0x18')][_0x8eb3('0x17')]);}})[_0x8eb3('0x19')](function(_0x15485b){logger[_0x8eb3('0x15')](_0x8eb3('0x10'),_0x5b510e,_0x15485b);_0x10e4fe(_0x15485b);});});} \ No newline at end of file +var _0x536a=['../../config/utils','rpc','../../config/environment','client','http','socket.io-emitter','localhost','./voicePrefix.socket','register','request','then','request\x20sent','debug','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x536a,0xe5));var _0xa536=function(_0x3239bb,_0x273106){_0x3239bb=_0x3239bb-0x0;var _0xf2690d=_0x536a[_0x3239bb];return _0xf2690d;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var moment=require(_0xa536('0x2'));var BPromise=require('bluebird');var rs=require(_0xa536('0x3'));var fs=require('fs');var db=require(_0xa536('0x4'))['db'];var utils=require(_0xa536('0x5'));var logger=require('../../config/logger')(_0xa536('0x6'));var config=require(_0xa536('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa536('0x8')][_0xa536('0x9')]({'port':0x232a});var socket=require(_0xa536('0xa'))({'host':_0xa536('0xb'),'port':0x18eb});require(_0xa536('0xc'))[_0xa536('0xd')](socket);function respondWithRpcPromise(_0x292199,_0x2ddbd8,_0x32c23c){return new BPromise(function(_0x1a87a4,_0x32c35c){return client[_0xa536('0xe')](_0x292199,_0x32c23c)[_0xa536('0xf')](function(_0x465b72){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x2ddbd8,_0xa536('0x10'));logger[_0xa536('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x2ddbd8,_0xa536('0x10'),JSON[_0xa536('0x12')](_0x465b72));if(_0x465b72[_0xa536('0x13')]){if(_0x465b72[_0xa536('0x13')][_0xa536('0x14')]===0x1f4){logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x465b72['error'][_0xa536('0x16')]);return _0x32c35c(_0x465b72[_0xa536('0x13')][_0xa536('0x16')]);}logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x465b72[_0xa536('0x13')][_0xa536('0x16')]);return _0x1a87a4(_0x465b72[_0xa536('0x13')]['message']);}else{logger[_0xa536('0x17')](_0xa536('0x15'),_0x2ddbd8,_0xa536('0x10'));_0x1a87a4(_0x465b72[_0xa536('0x18')]['message']);}})[_0xa536('0x19')](function(_0x1574e0){logger[_0xa536('0x13')](_0xa536('0x15'),_0x2ddbd8,_0x1574e0);_0x32c35c(_0x1574e0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index f6ba218..4e21b07 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 _0x5af7=['save','remove','update','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5af7,0x6f));var _0x75af=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x5af7[_0x483102];return _0x5cc885;};'use strict';var VoicePrefixEvents=require(_0x75af('0x0'));var events=[_0x75af('0x1'),_0x75af('0x2'),_0x75af('0x3')];function createListener(_0x614584,_0x316d98){return function(_0x31d35e){_0x316d98['emit'](_0x614584,_0x31d35e);};}function removeListener(_0x5aee05,_0x24afca){return function(){VoicePrefixEvents['removeListener'](_0x5aee05,_0x24afca);};}exports[_0x75af('0x4')]=function(_0x5781f2){for(var _0x427223=0x0,_0x2e2e13=events[_0x75af('0x5')];_0x427223<_0x2e2e13;_0x427223++){var _0x27cd45=events[_0x427223];var _0x3a8d07=createListener(_0x75af('0x6')+_0x27cd45,_0x5781f2);VoicePrefixEvents['on'](_0x27cd45,_0x3a8d07);}}; \ No newline at end of file +var _0x40f2=['register','length','./voicePrefix.events','save','update','emit','removeListener'];(function(_0x598681,_0x391edd){var _0x2cefcf=function(_0x461e05){while(--_0x461e05){_0x598681['push'](_0x598681['shift']());}};_0x2cefcf(++_0x391edd);}(_0x40f2,0x14b));var _0x240f=function(_0x22c792,_0x4a2119){_0x22c792=_0x22c792-0x0;var _0x1d285d=_0x40f2[_0x22c792];return _0x1d285d;};'use strict';var VoicePrefixEvents=require(_0x240f('0x0'));var events=[_0x240f('0x1'),'remove',_0x240f('0x2')];function createListener(_0x40d757,_0x537f52){return function(_0x35a164){_0x537f52[_0x240f('0x3')](_0x40d757,_0x35a164);};}function removeListener(_0x38d7da,_0x2c8153){return function(){VoicePrefixEvents[_0x240f('0x4')](_0x38d7da,_0x2c8153);};}exports[_0x240f('0x5')]=function(_0x20208b){for(var _0xf6de13=0x0,_0x4b549f=events[_0x240f('0x6')];_0xf6de13<_0x4b549f;_0xf6de13++){var _0x4ded61=events[_0xf6de13];var _0x3e9c1a=createListener('voicePrefix:'+_0x4ded61,_0x20208b);VoicePrefixEvents['on'](_0x4ded61,_0x3e9c1a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 8445d10..63c7ffa 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 _0xac72=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','getLists','/:id/blacklists','post','create','/:id/clone','clone','addTeams','addAgents','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','Router'];(function(_0x12e8a0,_0x54e93c){var _0x422643=function(_0x48340e){while(--_0x48340e){_0x12e8a0['push'](_0x12e8a0['shift']());}};_0x422643(++_0x54e93c);}(_0xac72,0x1eb));var _0x2ac7=function(_0x47001b,_0x36cfd2){_0x47001b=_0x47001b-0x0;var _0x5f0040=_0xac72[_0x47001b];return _0x5f0040;};'use strict';var multer=require(_0x2ac7('0x0'));var util=require(_0x2ac7('0x1'));var path=require(_0x2ac7('0x2'));var express=require('express');var router=express[_0x2ac7('0x3')]();var auth=require(_0x2ac7('0x4'));var interaction=require(_0x2ac7('0x5'));var config=require(_0x2ac7('0x6'));var controller=require(_0x2ac7('0x7'));router[_0x2ac7('0x8')]('/',auth[_0x2ac7('0x9')](),controller[_0x2ac7('0xa')]);router[_0x2ac7('0x8')](_0x2ac7('0xb'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0xc')]);router[_0x2ac7('0x8')]('/:id/hoppers',auth[_0x2ac7('0x9')](),controller[_0x2ac7('0xd')]);router['get'](_0x2ac7('0xe'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0xf')]);router[_0x2ac7('0x8')](_0x2ac7('0x10'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x11')]);router['get'](_0x2ac7('0x12'),auth['isAuthenticated'](),controller[_0x2ac7('0x13')]);router['get'](_0x2ac7('0x14'),auth[_0x2ac7('0x9')](),controller['getTeams']);router['get'](_0x2ac7('0x15'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x16')]);router[_0x2ac7('0x8')](_0x2ac7('0x17'),auth['isAuthenticated'](),controller[_0x2ac7('0x18')]);router[_0x2ac7('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2ac7('0x19')]);router[_0x2ac7('0x8')](_0x2ac7('0x1a'),auth[_0x2ac7('0x9')](),controller['getBlackLists']);router[_0x2ac7('0x1b')]('/',auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x1c')]);router[_0x2ac7('0x1b')](_0x2ac7('0x1d'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x1e')]);router[_0x2ac7('0x1b')](_0x2ac7('0x14'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x1f')]);router[_0x2ac7('0x1b')](_0x2ac7('0x15'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x20')]);router['post']('/:id/lists',auth['isAuthenticated'](),controller[_0x2ac7('0x21')]);router['post'](_0x2ac7('0x1a'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x22')]);router[_0x2ac7('0x23')]('/:id',auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x24')]);router[_0x2ac7('0x25')]('/:id',auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x26')]);router[_0x2ac7('0x25')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2ac7('0x27')]);router['delete'](_0x2ac7('0x15'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x28')]);router[_0x2ac7('0x25')](_0x2ac7('0x29'),auth[_0x2ac7('0x9')](),controller[_0x2ac7('0x2a')]);router['delete'](_0x2ac7('0x1a'),auth['isAuthenticated'](),controller[_0x2ac7('0x2b')]);module[_0x2ac7('0x2c')]=router; \ No newline at end of file +var _0x0379=['removeLists','removeBlackLists','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getTeams','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','/:id/lists','/:id/blacklists','addBlackLists','put','/:id','delete','/:id/users','removeAgents'];(function(_0x1ea3dc,_0xdefeba){var _0x5ac7b7=function(_0x55b14b){while(--_0x55b14b){_0x1ea3dc['push'](_0x1ea3dc['shift']());}};_0x5ac7b7(++_0xdefeba);}(_0x0379,0x114));var _0x9037=function(_0x5c8977,_0x10bc2e){_0x5c8977=_0x5c8977-0x0;var _0x5b307f=_0x0379[_0x5c8977];return _0x5b307f;};'use strict';var multer=require(_0x9037('0x0'));var util=require(_0x9037('0x1'));var path=require('path');var express=require(_0x9037('0x2'));var router=express[_0x9037('0x3')]();var auth=require(_0x9037('0x4'));var interaction=require(_0x9037('0x5'));var config=require('../../config/environment');var controller=require(_0x9037('0x6'));router[_0x9037('0x7')]('/',auth['isAuthenticated'](),controller[_0x9037('0x8')]);router[_0x9037('0x7')]('/:id',auth[_0x9037('0x9')](),controller[_0x9037('0xa')]);router[_0x9037('0x7')](_0x9037('0xb'),auth[_0x9037('0x9')](),controller[_0x9037('0xc')]);router[_0x9037('0x7')](_0x9037('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x9037('0x7')]('/:id/hopper_finals',auth[_0x9037('0x9')](),controller[_0x9037('0xe')]);router[_0x9037('0x7')](_0x9037('0xf'),auth[_0x9037('0x9')](),controller['getHopperBlacks']);router[_0x9037('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x9037('0x10')]);router[_0x9037('0x7')]('/:id/users',auth[_0x9037('0x9')](),controller[_0x9037('0x11')]);router['get'](_0x9037('0x12'),auth['isAuthenticated'](),controller[_0x9037('0x13')]);router[_0x9037('0x7')]('/:id/lists',auth[_0x9037('0x9')](),controller[_0x9037('0x14')]);router[_0x9037('0x7')]('/:id/blacklists',auth[_0x9037('0x9')](),controller[_0x9037('0x15')]);router[_0x9037('0x16')]('/',auth[_0x9037('0x9')](),controller[_0x9037('0x17')]);router[_0x9037('0x16')](_0x9037('0x18'),auth[_0x9037('0x9')](),controller[_0x9037('0x19')]);router[_0x9037('0x16')](_0x9037('0x1a'),auth[_0x9037('0x9')](),controller[_0x9037('0x1b')]);router[_0x9037('0x16')]('/:id/users',auth[_0x9037('0x9')](),controller['addAgents']);router[_0x9037('0x16')](_0x9037('0x1c'),auth[_0x9037('0x9')](),controller['addLists']);router[_0x9037('0x16')](_0x9037('0x1d'),auth['isAuthenticated'](),controller[_0x9037('0x1e')]);router[_0x9037('0x1f')](_0x9037('0x20'),auth[_0x9037('0x9')](),controller['update']);router['delete'](_0x9037('0x20'),auth[_0x9037('0x9')](),controller['destroy']);router[_0x9037('0x21')](_0x9037('0x1a'),auth[_0x9037('0x9')](),controller['removeTeams']);router[_0x9037('0x21')](_0x9037('0x22'),auth[_0x9037('0x9')](),controller[_0x9037('0x23')]);router[_0x9037('0x21')](_0x9037('0x1c'),auth[_0x9037('0x9')](),controller[_0x9037('0x24')]);router['delete'](_0x9037('0x1d'),auth[_0x9037('0x9')](),controller[_0x9037('0x25')]);module[_0x9037('0x26')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 8580748..b21d15b 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 _0xb10b=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#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)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x11b6d6,_0xe371ec){var _0x2710df=function(_0x3c6fdc){while(--_0x3c6fdc){_0x11b6d6['push'](_0x11b6d6['shift']());}};_0x2710df(++_0xe371ec);}(_0xb10b,0x12a));var _0xbb10=function(_0x317c38,_0x9d154d){_0x317c38=_0x317c38-0x0;var _0x304c05=_0xb10b[_0x317c38];return _0x304c05;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbb10('0x3')]('inbound',_0xbb10('0x4')),'allowNull':![],'defaultValue':_0xbb10('0x5')},'musiconhold':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x6')},'announce':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbb10('0x3')]('rr','ringall',_0xbb10('0x7'),_0xbb10('0x8'),'random',_0xbb10('0x9'),_0xbb10('0xa'),_0xbb10('0xb'),_0xbb10('0xc')),'allowNull':![],'defaultValue':_0xbb10('0xd'),'set':function(_0x1ce33e){this[_0xbb10('0xe')](_0xbb10('0xf'),_0x1ce33e?_0x1ce33e:'rrmemory');},'get':function(){var _0x4e47f8=this[_0xbb10('0x10')](_0xbb10('0x11'));var _0xce64f3=this['getDataValue'](_0xbb10('0x12'));var _0x5be7e0=this[_0xbb10('0x10')](_0xbb10('0xf'));if(_0x4e47f8===_0xbb10('0x5')){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x13')&&_0x5be7e0===_0xbb10('0x9')||_0xce64f3===_0xbb10('0x13')&&_0x5be7e0==='roundrobin'){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x14')||_0xce64f3===_0xbb10('0x15')||_0xce64f3===_0xbb10('0x16')){return _0x5be7e0;}return null;}},'servicelevel':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbb10('0x17')](0xb)},'timeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbb10('0x1')]},'weight':{'type':Sequelize[_0xbb10('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'autopause':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbb10('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'announce_holdtime':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbb10('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbb10('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbb10('0x1')]},'queue_quantity2':{'type':Sequelize[_0xbb10('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbb10('0x1')]},'queue_less_than':{'type':Sequelize[_0xbb10('0x1')]},'periodic_announce':{'type':Sequelize[_0xbb10('0x1b')],'set':function(_0x2ff4c1){this['setDataValue'](_0xbb10('0x1c'),_0x2ff4c1?_0x2ff4c1['join'](','):[]);},'get':function(){return this[_0xbb10('0x10')]('periodic_announce')?this[_0xbb10('0x10')](_0xbb10('0x1c'))[_0xbb10('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c3744){this[_0xbb10('0xe')]('joinempty',_0x4c3744?_0x4c3744[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x1f'))?this[_0xbb10('0x10')](_0xbb10('0x1f'))[_0xbb10('0x1d')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no','set':function(_0x4975f5){this[_0xbb10('0xe')](_0xbb10('0x20'),_0x4975f5?_0x4975f5[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x20'))?this[_0xbb10('0x10')](_0xbb10('0x20'))[_0xbb10('0x1d')](','):[];}},'reportholdtime':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eb3cc){this[_0xbb10('0xe')](_0xbb10('0x21'),_0x3eb3cc);if(_0x3eb3cc){if(this[_0xbb10('0x10')](_0xbb10('0x22'))<0x2){this[_0xbb10('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbb10('0x14'),_0xbb10('0x16'),_0xbb10('0x15'),'booked'),'defaultValue':_0xbb10('0x14'),'comment':_0xbb10('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbb10('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x25')},'dialLimitQueue':{'type':Sequelize[_0xbb10('0x17')](0x4)[_0xbb10('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xbb10('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbb10('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbb10('0x29'),_0xbb10('0x2a')),'defaultValue':_0xbb10('0x2a'),'comment':_0xbb10('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbb10('0x2c')](0x2)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbb10('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbb10('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'tTxX','comment':_0xbb10('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xbb10('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'comment':_0xbb10('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbb10('0x35')},'dialTimezone':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0x36')},'dialPrefix':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39')),'defaultValue':_0xbb10('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbb10('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbb10('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbb10('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbb10('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbb10('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbb10('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbb10('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbb10('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':_0xbb10('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbb10('0x45'),'ASC'),'defaultValue':_0xbb10('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbb10('0x1')],'comment':_0xbb10('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x47')},'dialCutDigit':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x48')}}; \ No newline at end of file +var _0xb10b=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','sequelize','STRING','name','ENUM','outbound','inbound','default','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','split','join','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','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','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#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)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0x1b5e02,_0xe22480){var _0x340fd5=function(_0x51214d){while(--_0x51214d){_0x1b5e02['push'](_0x1b5e02['shift']());}};_0x340fd5(++_0xe22480);}(_0xb10b,0x12a));var _0xbb10=function(_0x4b0211,_0x17f347){_0x4b0211=_0x4b0211-0x0;var _0x1906fc=_0xb10b[_0x4b0211];return _0x1906fc;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbb10('0x3')]('inbound',_0xbb10('0x4')),'allowNull':![],'defaultValue':_0xbb10('0x5')},'musiconhold':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':_0xbb10('0x6')},'announce':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xbb10('0x3')]('rr','ringall',_0xbb10('0x7'),_0xbb10('0x8'),'random',_0xbb10('0x9'),_0xbb10('0xa'),_0xbb10('0xb'),_0xbb10('0xc')),'allowNull':![],'defaultValue':_0xbb10('0xd'),'set':function(_0x1ce33e){this[_0xbb10('0xe')](_0xbb10('0xf'),_0x1ce33e?_0x1ce33e:'rrmemory');},'get':function(){var _0x4e47f8=this[_0xbb10('0x10')](_0xbb10('0x11'));var _0xce64f3=this['getDataValue'](_0xbb10('0x12'));var _0x5be7e0=this[_0xbb10('0x10')](_0xbb10('0xf'));if(_0x4e47f8===_0xbb10('0x5')){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x13')&&_0x5be7e0===_0xbb10('0x9')||_0xce64f3===_0xbb10('0x13')&&_0x5be7e0==='roundrobin'){return _0x5be7e0;}if(_0xce64f3===_0xbb10('0x14')||_0xce64f3===_0xbb10('0x15')||_0xce64f3===_0xbb10('0x16')){return _0x5be7e0;}return null;}},'servicelevel':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbb10('0x17')](0xb)},'timeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbb10('0x1')]},'weight':{'type':Sequelize[_0xbb10('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'autopause':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbb10('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':_0xbb10('0x18')},'announce_holdtime':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no',_0xbb10('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM']('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xbb10('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbb10('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbb10('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbb10('0x1')]},'queue_quantity2':{'type':Sequelize[_0xbb10('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xbb10('0x1')]},'queue_less_than':{'type':Sequelize[_0xbb10('0x1')]},'periodic_announce':{'type':Sequelize[_0xbb10('0x1b')],'set':function(_0x2ff4c1){this['setDataValue'](_0xbb10('0x1c'),_0x2ff4c1?_0x2ff4c1['join'](','):[]);},'get':function(){return this[_0xbb10('0x10')]('periodic_announce')?this[_0xbb10('0x10')](_0xbb10('0x1c'))[_0xbb10('0x1d')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c3744){this[_0xbb10('0xe')]('joinempty',_0x4c3744?_0x4c3744[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x1f'))?this[_0xbb10('0x10')](_0xbb10('0x1f'))[_0xbb10('0x1d')](','):[];}},'leavewhenempty':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'no','set':function(_0x4975f5){this[_0xbb10('0xe')](_0xbb10('0x20'),_0x4975f5?_0x4975f5[_0xbb10('0x1e')](','):[]);},'get':function(){return this[_0xbb10('0x10')](_0xbb10('0x20'))?this[_0xbb10('0x10')](_0xbb10('0x20'))[_0xbb10('0x1d')](','):[];}},'reportholdtime':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbb10('0x3')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbb10('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x3eb3cc){this[_0xbb10('0xe')](_0xbb10('0x21'),_0x3eb3cc);if(_0x3eb3cc){if(this[_0xbb10('0x10')](_0xbb10('0x22'))<0x2){this[_0xbb10('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0xbb10('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xbb10('0x14'),_0xbb10('0x16'),_0xbb10('0x15'),'booked'),'defaultValue':_0xbb10('0x14'),'comment':_0xbb10('0x24')},'dialLimitChannel':{'type':Sequelize[_0xbb10('0x17')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x25')},'dialLimitQueue':{'type':Sequelize[_0xbb10('0x17')](0x4)[_0xbb10('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbb10('0x27')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xbb10('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbb10('0x28')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xbb10('0x29'),_0xbb10('0x2a')),'defaultValue':_0xbb10('0x2a'),'comment':_0xbb10('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbb10('0x2c')](0x2)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbb10('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xbb10('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':'tTxX','comment':_0xbb10('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xbb10('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbb10('0x31')},'dialBusyRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'defaultValue':0x3,'comment':_0xbb10('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbb10('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xbb10('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xbb10('0x35')},'dialTimezone':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xbb10('0x36')},'dialPrefix':{'type':Sequelize[_0xbb10('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbb10('0x3')](_0xbb10('0x37'),_0xbb10('0x38'),_0xbb10('0x39')),'defaultValue':_0xbb10('0x37')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbb10('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbb10('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xbb10('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbb10('0x3e')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xbb10('0x3f')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbb10('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbb10('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbb10('0x17')](0x9)[_0xbb10('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbb10('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xbb10('0x17')](0x5)[_0xbb10('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbb10('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':0x0,'comment':_0xbb10('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xbb10('0x45'),'ASC'),'defaultValue':_0xbb10('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbb10('0x1')],'comment':_0xbb10('0x46')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbb10('0x23')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x47')},'dialCutDigit':{'type':Sequelize[_0xbb10('0x17')](0x3)[_0xbb10('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbb10('0x48')}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 3d7f941..f8524a5 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 _0xaa23=['getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','field','NOW()','CmListId','toString','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','cm_hopper_final','VoiceQueueId\x20=\x20?','onlyIfOpen','from','phone\x20NOT\x20IN\x20(?)','fromQuery','removeLists','getBlackLists','cm_hopper_black','push','sequelize','removeBlackLists','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','localhost','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','name','index','VoiceQueue','rawAttributes','model','query','dateEnd','dateStart','keys','filters','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','options','includeAll','rows','catch','show','params','length','find','body','clone','intersection','include','get','omit','updatedAt','createdAt','create','findOne','CmHopper','order','VoiceQueueId','filter','map','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','Team','getTeams','addTeams','ids','User','Agents','union','addAgents','penalty','removeTeams','removeAgents','emit','userVoiceQueue:save','loginInPause','UserVoiceQueueRt','upsert','%s/%s','voicePause','all','userVoiceQueue:remove','destroy','getAgents','getMembers'];(function(_0x469f0c,_0x233e1c){var _0x36a21=function(_0x48110c){while(--_0x48110c){_0x469f0c['push'](_0x469f0c['shift']());}};_0x36a21(++_0x233e1c);}(_0xaa23,0x13b));var _0x3aa2=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0xaa23[_0x25701b];return _0x3a8a2c;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x3aa2('0x0'));var moment=require(_0x3aa2('0x1'));var BPromise=require(_0x3aa2('0x2'));var Mustache=require(_0x3aa2('0x3'));var util=require(_0x3aa2('0x4'));var path=require(_0x3aa2('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3aa2('0x6'));var fs=require('fs');var _=require(_0x3aa2('0x7'));var squel=require(_0x3aa2('0x8'));var crypto=require(_0x3aa2('0x9'));var jsforce=require(_0x3aa2('0xa'));var deskjs=require(_0x3aa2('0xb'));var toCsv=require(_0x3aa2('0xc'));var querystring=require(_0x3aa2('0xd'));var Papa=require(_0x3aa2('0xe'));var qs=require(_0x3aa2('0xf'));var logger=require(_0x3aa2('0x10'))(_0x3aa2('0x11'));var utils=require('../../config/utils');var config=require(_0x3aa2('0x12'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':_0x3aa2('0x13'),'port':0x18eb});require('./voiceQueue.socket')[_0x3aa2('0x14')](socket);function respondWithStatusCode(_0x31a613,_0x3f826a){_0x3f826a=_0x3f826a||0xcc;return function(_0x43affc){if(_0x43affc){return _0x31a613[_0x3aa2('0x15')](_0x3f826a);}return _0x31a613[_0x3aa2('0x16')](_0x3f826a)[_0x3aa2('0x17')]();};}function respondWithResult(_0x595038,_0x306754){_0x306754=_0x306754||0xc8;return function(_0x45f3bb){if(_0x45f3bb){return _0x595038[_0x3aa2('0x16')](_0x306754)[_0x3aa2('0x18')](_0x45f3bb);}};}function respondWithFilteredResult(_0x170485,_0x32f4b5){return function(_0x397776){if(_0x397776){var _0x5d0f9f=_0x397776[_0x3aa2('0x19')],_0x1be8e3=_0x32f4b5[_0x3aa2('0x1a')],_0x5b01c1=_0x32f4b5['offset']+_0x32f4b5[_0x3aa2('0x1b')],_0x383f76;if(_0x5b01c1>=_0x5d0f9f){_0x5b01c1=_0x5d0f9f;_0x383f76=0xc8;}else{_0x383f76=0xce;}_0x170485['status'](_0x383f76);return _0x170485[_0x3aa2('0x1c')](_0x3aa2('0x1d'),_0x1be8e3+'-'+_0x5b01c1+'/'+_0x5d0f9f)[_0x3aa2('0x18')](_0x397776);}return null;};}function patchUpdates(_0x37333a){return function(_0xf9b8d4){try{jsonpatch['apply'](_0xf9b8d4,_0x37333a,!![]);}catch(_0x3831be){return BPromise[_0x3aa2('0x1e')](_0x3831be);}return _0xf9b8d4[_0x3aa2('0x1f')]();};}function saveUpdates(_0x37ed97,_0x2cd8c8){return function(_0x282671){if(_0x282671){return _0x282671[_0x3aa2('0x20')](_0x37ed97)[_0x3aa2('0x21')](function(_0x2e8155){return _0x2e8155;});}return null;};}function removeEntity(_0x368a05,_0x20561d){return function(_0xa8dc8){if(_0xa8dc8){return _0xa8dc8['destroy']()['then'](function(){_0x368a05[_0x3aa2('0x16')](0xcc)[_0x3aa2('0x17')]();});}};}function handleEntityNotFound(_0x50cbe0,_0x89c12a){return function(_0x456e23){if(!_0x456e23){_0x50cbe0['sendStatus'](0x194);}return _0x456e23;};}function handleError(_0x494afd,_0x53f5ae){_0x53f5ae=_0x53f5ae||0x1f4;return function(_0x5874d7){logger[_0x3aa2('0x22')](_0x5874d7[_0x3aa2('0x23')]);if(_0x5874d7[_0x3aa2('0x24')]){delete _0x5874d7[_0x3aa2('0x24')];}_0x494afd[_0x3aa2('0x16')](_0x53f5ae)['send'](_0x5874d7);};}exports[_0x3aa2('0x25')]=function(_0x2ed9f4,_0xeb8f42){var _0x20e078={},_0x4baca2={},_0x404463={'count':0x0,'rows':[]};var _0x307131=db[_0x3aa2('0x26')][_0x3aa2('0x27')];_0x4baca2[_0x3aa2('0x28')]=_['keys'](_0x307131);var _0x158803={'dateStart':_0x2ed9f4[_0x3aa2('0x29')]['dateStart'],'dateEnd':_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x2a')]};delete _0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x2b')];delete _0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x2a')];_0x4baca2['query']=_[_0x3aa2('0x2c')](_0x2ed9f4[_0x3aa2('0x29')]);_0x4baca2[_0x3aa2('0x2d')]=_['intersection'](_0x4baca2[_0x3aa2('0x28')],_0x4baca2['query']);_0x20e078['attributes']=_['intersection'](_0x4baca2[_0x3aa2('0x28')],qs['fields'](_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x2e')]));_0x20e078[_0x3aa2('0x2f')]=_0x20e078[_0x3aa2('0x2f')]['length']?_0x20e078[_0x3aa2('0x2f')]:_0x4baca2[_0x3aa2('0x28')];if(!_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0x20e078['limit']=qs[_0x3aa2('0x1b')](_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x20e078[_0x3aa2('0x1a')]=qs[_0x3aa2('0x1a')](_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x1a')]);}_0x20e078['order']=qs['sort'](_0x2ed9f4[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x20e078[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x2ed9f4[_0x3aa2('0x29')],_0x4baca2[_0x3aa2('0x2d')]));if(_0x158803['dateStart']){if(_0x158803[_0x3aa2('0x2a')]){_0x158803[_0x3aa2('0x2a')]=moment(_0x158803[_0x3aa2('0x2a')])[_0x3aa2('0x35')](0x1,_0x3aa2('0x36'));}else{_0x158803[_0x3aa2('0x2a')]=moment(_0x158803[_0x3aa2('0x2b')])[_0x3aa2('0x35')](0x1,_0x3aa2('0x36'));}_['merge'](_0x20e078[_0x3aa2('0x33')],{'createdAt':{'$gte':_0x158803[_0x3aa2('0x2b')],'$lte':_0x158803[_0x3aa2('0x2a')]}});}if(_0x2ed9f4[_0x3aa2('0x29')]['filter']){_0x20e078['where']=_['merge'](_0x20e078[_0x3aa2('0x33')],{'$or':_['map'](_0x20e078[_0x3aa2('0x2f')],function(_0xac5d84){var _0x1ca350={};_0x1ca350[_0xac5d84]={'$like':'%'+_0x2ed9f4['query']['filter']+'%'};return _0x1ca350;})});}_0x20e078=_[_0x3aa2('0x37')]({},_0x20e078,_0x2ed9f4[_0x3aa2('0x38')]);var _0x313dd9={'where':_0x20e078['where']};return db['VoiceQueue']['count'](_0x313dd9)['then'](function(_0x81493d){_0x404463[_0x3aa2('0x19')]=_0x81493d;if(_0x2ed9f4['query'][_0x3aa2('0x39')]){_0x20e078['include']=[{'all':!![]}];}return db[_0x3aa2('0x26')]['findAll'](_0x20e078);})[_0x3aa2('0x21')](function(_0x5137ba){_0x404463[_0x3aa2('0x3a')]=_0x5137ba;return _0x404463;})[_0x3aa2('0x21')](respondWithFilteredResult(_0xeb8f42,_0x20e078))[_0x3aa2('0x3b')](handleError(_0xeb8f42,null));};exports[_0x3aa2('0x3c')]=function(_0x3699cb,_0x25c58a){var _0x2188ba={'raw':![],'where':{'id':_0x3699cb[_0x3aa2('0x3d')]['id']}},_0x598cf8={};_0x598cf8[_0x3aa2('0x28')]=_['keys'](db['VoiceQueue'][_0x3aa2('0x27')]);_0x598cf8['query']=_[_0x3aa2('0x2c')](_0x3699cb[_0x3aa2('0x29')]);_0x598cf8['filters']=_['intersection'](_0x598cf8[_0x3aa2('0x28')],_0x598cf8['query']);_0x2188ba[_0x3aa2('0x2f')]=_['intersection'](_0x598cf8[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x3699cb['query']['fields']));_0x2188ba['attributes']=_0x2188ba['attributes'][_0x3aa2('0x3e')]?_0x2188ba[_0x3aa2('0x2f')]:_0x598cf8['model'];if(_0x3699cb[_0x3aa2('0x29')][_0x3aa2('0x39')]){_0x2188ba['include']=[{'all':!![]}];}_0x2188ba=_[_0x3aa2('0x37')]({},_0x2188ba,_0x3699cb[_0x3aa2('0x38')]);return db['VoiceQueue'][_0x3aa2('0x3f')](_0x2188ba)[_0x3aa2('0x21')](handleEntityNotFound(_0x25c58a,null))['then'](respondWithResult(_0x25c58a,null))[_0x3aa2('0x3b')](handleError(_0x25c58a,null));};exports['create']=function(_0x12a634,_0x5a7bfd){return db['VoiceQueue']['create'](_0x12a634[_0x3aa2('0x40')],{})[_0x3aa2('0x21')](respondWithResult(_0x5a7bfd,0xc9))['catch'](handleError(_0x5a7bfd,null));};exports[_0x3aa2('0x41')]=function(_0x30e103,_0x594039){var _0x52e51b={'raw':![],'where':{'id':_0x30e103[_0x3aa2('0x3d')]['id']}},_0x5ca5a6={};_0x5ca5a6[_0x3aa2('0x28')]=_['keys'](db[_0x3aa2('0x26')]['rawAttributes']);_0x52e51b['attributes']=_[_0x3aa2('0x42')](_0x5ca5a6[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x30e103[_0x3aa2('0x29')][_0x3aa2('0x2e')]));_0x52e51b['attributes']=_0x52e51b['attributes']['length']?_0x52e51b[_0x3aa2('0x2f')]:_0x5ca5a6['model'];if(_0x30e103[_0x3aa2('0x29')]['includeAll']){_0x52e51b[_0x3aa2('0x43')]=[{'all':!![]}];}_0x52e51b=_[_0x3aa2('0x37')]({},_0x52e51b,_0x30e103['options']);return db['VoiceQueue'][_0x3aa2('0x3f')](_0x52e51b)['then'](handleEntityNotFound(_0x594039,null))[_0x3aa2('0x21')](function(_0x484eb1){if(_0x484eb1){var _0x7a6276=_0x484eb1[_0x3aa2('0x44')]({'plain':!![]});_0x7a6276=qs[_0x3aa2('0x45')](_0x7a6276,['id','createdAt',_0x3aa2('0x46')]);_0x30e103[_0x3aa2('0x40')]=_['omit'](_0x30e103[_0x3aa2('0x40')],['id',_0x3aa2('0x47'),_0x3aa2('0x46')]);return db[_0x3aa2('0x26')][_0x3aa2('0x48')](_['merge'](_0x7a6276,_0x30e103['body']),{'include':_0x30e103[_0x3aa2('0x29')][_0x3aa2('0x39')]?[{'all':!![]}]:undefined});}})[_0x3aa2('0x21')](respondWithResult(_0x594039,0xc9))[_0x3aa2('0x3b')](handleError(_0x594039,null));};exports['update']=function(_0x1217f1,_0x241e6c){if(_0x1217f1['body']['id']){delete _0x1217f1[_0x3aa2('0x40')]['id'];}return db[_0x3aa2('0x26')]['find']({'where':{'id':_0x1217f1[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x241e6c,null))['then'](saveUpdates(_0x1217f1[_0x3aa2('0x40')],null))[_0x3aa2('0x21')](respondWithResult(_0x241e6c,null))[_0x3aa2('0x3b')](handleError(_0x241e6c,null));};exports['destroy']=function(_0x1b1f46,_0xfafcc7){return db[_0x3aa2('0x26')]['find']({'where':{'id':_0x1b1f46[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0xfafcc7,null))['then'](removeEntity(_0xfafcc7,null))[_0x3aa2('0x3b')](handleError(_0xfafcc7,null));};exports['getHoppers']=function(_0x5c54c7,_0x4d4000,_0xa5c411){var _0x1014aa={'raw':![],'where':{}};var _0x5a6a48={};var _0xfad017={'count':0x0,'rows':[]};return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x5c54c7['params']['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x4d4000,null))[_0x3aa2('0x21')](function(_0x6e4f04){if(_0x6e4f04){_0x5a6a48[_0x3aa2('0x28')]=_[_0x3aa2('0x2c')](db[_0x3aa2('0x4a')][_0x3aa2('0x27')]);_0x5a6a48[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x5c54c7['query']);_0x5a6a48['filters']=_[_0x3aa2('0x42')](_0x5a6a48[_0x3aa2('0x28')],_0x5a6a48[_0x3aa2('0x29')]);_0x1014aa[_0x3aa2('0x2f')]=_[_0x3aa2('0x42')](_0x5a6a48['model'],qs[_0x3aa2('0x2e')](_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x2e')]));_0x1014aa['attributes']=_0x1014aa[_0x3aa2('0x2f')][_0x3aa2('0x3e')]?_0x1014aa[_0x3aa2('0x2f')]:_0x5a6a48[_0x3aa2('0x28')];if(!_0x5c54c7[_0x3aa2('0x29')]['hasOwnProperty']('nolimit')){_0x1014aa['limit']=qs[_0x3aa2('0x1b')](_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x1014aa[_0x3aa2('0x1a')]=qs[_0x3aa2('0x1a')](_0x5c54c7['query'][_0x3aa2('0x1a')]);}_0x1014aa[_0x3aa2('0x4b')]=qs[_0x3aa2('0x32')](_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x1014aa[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x5c54c7['query'],_0x5a6a48[_0x3aa2('0x2d')]));_0x1014aa[_0x3aa2('0x33')][_0x3aa2('0x4c')]=_0x6e4f04['id'];if(_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x4d')]){_0x1014aa['where']=_[_0x3aa2('0x37')](_0x1014aa[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x1014aa[_0x3aa2('0x2f')],function(_0x145d1a){var _0x5f8673={};_0x5f8673[_0x145d1a]={'$like':'%'+_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x4d')]+'%'};return _0x5f8673;})});}_0x1014aa=_[_0x3aa2('0x37')]({},_0x1014aa,_0x5c54c7[_0x3aa2('0x38')]);return db[_0x3aa2('0x4a')][_0x3aa2('0x19')]({'where':_0x1014aa[_0x3aa2('0x33')]})[_0x3aa2('0x21')](function(_0x3f0bc2){_0xfad017[_0x3aa2('0x19')]=_0x3f0bc2;if(_0x5c54c7[_0x3aa2('0x29')][_0x3aa2('0x39')]){_0x1014aa[_0x3aa2('0x43')]=[{'all':!![]}];}return db['CmHopper'][_0x3aa2('0x4f')](_0x1014aa);})[_0x3aa2('0x21')](function(_0x1516fd){_0xfad017['rows']=_0x1516fd;return _0xfad017;});}})[_0x3aa2('0x21')](respondWithFilteredResult(_0x4d4000,_0x1014aa))[_0x3aa2('0x3b')](handleError(_0x4d4000,null));};exports[_0x3aa2('0x50')]=function(_0x1d5a85,_0x3b86be,_0x535441){var _0x5daaa6={'raw':!![],'where':{}};var _0x3cc842={};var _0x540207={'count':0x0,'rows':[]};return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x1d5a85['params']['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x3b86be,null))[_0x3aa2('0x21')](function(_0x498215){if(_0x498215){_0x3cc842['model']=_[_0x3aa2('0x2c')](db[_0x3aa2('0x51')][_0x3aa2('0x27')]);_0x3cc842['query']=_[_0x3aa2('0x2c')](_0x1d5a85[_0x3aa2('0x29')]);_0x3cc842[_0x3aa2('0x2d')]=_[_0x3aa2('0x42')](_0x3cc842[_0x3aa2('0x28')],_0x3cc842[_0x3aa2('0x29')]);_0x5daaa6[_0x3aa2('0x2f')]=_['intersection'](_0x3cc842[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x1d5a85['query'][_0x3aa2('0x2e')]));_0x5daaa6[_0x3aa2('0x2f')]=_0x5daaa6['attributes'][_0x3aa2('0x3e')]?_0x5daaa6['attributes']:_0x3cc842[_0x3aa2('0x28')];if(!_0x1d5a85[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0x5daaa6[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x1d5a85[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x5daaa6[_0x3aa2('0x1a')]=qs['offset'](_0x1d5a85['query'][_0x3aa2('0x1a')]);}_0x5daaa6[_0x3aa2('0x4b')]=qs['sort'](_0x1d5a85[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x5daaa6[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_['pick'](_0x1d5a85['query'],_0x3cc842[_0x3aa2('0x2d')]));_0x5daaa6[_0x3aa2('0x33')][_0x3aa2('0x4c')]=_0x498215['id'];if(_0x1d5a85[_0x3aa2('0x29')][_0x3aa2('0x4d')]){_0x5daaa6[_0x3aa2('0x33')]=_['merge'](_0x5daaa6[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x5daaa6[_0x3aa2('0x2f')],function(_0x20ba08){var _0x2b11f1={};_0x2b11f1[_0x20ba08]={'$like':'%'+_0x1d5a85[_0x3aa2('0x29')][_0x3aa2('0x4d')]+'%'};return _0x2b11f1;})});}_0x5daaa6=_[_0x3aa2('0x37')]({},_0x5daaa6,_0x1d5a85['options']);return db['CmHopperHistory']['count']({'where':_0x5daaa6[_0x3aa2('0x33')]})[_0x3aa2('0x21')](function(_0x5929e5){_0x540207[_0x3aa2('0x19')]=_0x5929e5;if(_0x1d5a85[_0x3aa2('0x29')]['includeAll']){_0x5daaa6[_0x3aa2('0x43')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x5daaa6);})[_0x3aa2('0x21')](function(_0x337b37){_0x540207[_0x3aa2('0x3a')]=_0x337b37;return _0x540207;});}})[_0x3aa2('0x21')](respondWithFilteredResult(_0x3b86be,_0x5daaa6))[_0x3aa2('0x3b')](handleError(_0x3b86be,null));};exports[_0x3aa2('0x52')]=function(_0x2d9a09,_0x1ea078,_0x37e7ff){var _0x36854b={'raw':!![],'where':{}};var _0x3a1651={};var _0xb897fc={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x3aa2('0x49')]({'where':{'id':_0x2d9a09[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x1ea078,null))[_0x3aa2('0x21')](function(_0xacbffb){if(_0xacbffb){_0x3a1651[_0x3aa2('0x28')]=_['keys'](db[_0x3aa2('0x53')][_0x3aa2('0x27')]);_0x3a1651[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x2d9a09[_0x3aa2('0x29')]);_0x3a1651['filters']=_[_0x3aa2('0x42')](_0x3a1651[_0x3aa2('0x28')],_0x3a1651['query']);_0x36854b[_0x3aa2('0x2f')]=_['intersection'](_0x3a1651[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x2d9a09[_0x3aa2('0x29')][_0x3aa2('0x2e')]));_0x36854b[_0x3aa2('0x2f')]=_0x36854b[_0x3aa2('0x2f')]['length']?_0x36854b['attributes']:_0x3a1651['model'];if(!_0x2d9a09['query'][_0x3aa2('0x30')]('nolimit')){_0x36854b['limit']=qs[_0x3aa2('0x1b')](_0x2d9a09[_0x3aa2('0x29')]['limit']);_0x36854b[_0x3aa2('0x1a')]=qs[_0x3aa2('0x1a')](_0x2d9a09[_0x3aa2('0x29')]['offset']);}_0x36854b[_0x3aa2('0x4b')]=qs[_0x3aa2('0x32')](_0x2d9a09[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x36854b[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x2d9a09['query'],_0x3a1651[_0x3aa2('0x2d')]));_0x36854b['where'][_0x3aa2('0x4c')]=_0xacbffb['id'];if(_0x2d9a09['query'][_0x3aa2('0x4d')]){_0x36854b[_0x3aa2('0x33')]=_[_0x3aa2('0x37')](_0x36854b[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x36854b[_0x3aa2('0x2f')],function(_0x49a289){var _0x43aa96={};_0x43aa96[_0x49a289]={'$like':'%'+_0x2d9a09[_0x3aa2('0x29')][_0x3aa2('0x4d')]+'%'};return _0x43aa96;})});}_0x36854b=_[_0x3aa2('0x37')]({},_0x36854b,_0x2d9a09[_0x3aa2('0x38')]);return db[_0x3aa2('0x53')][_0x3aa2('0x19')]({'where':_0x36854b[_0x3aa2('0x33')]})['then'](function(_0x4f2b44){_0xb897fc[_0x3aa2('0x19')]=_0x4f2b44;if(_0x2d9a09['query']['includeAll']){_0x36854b[_0x3aa2('0x43')]=[{'all':!![]}];}return db[_0x3aa2('0x53')][_0x3aa2('0x4f')](_0x36854b);})['then'](function(_0xed1c8c){_0xb897fc[_0x3aa2('0x3a')]=_0xed1c8c;return _0xb897fc;});}})[_0x3aa2('0x21')](respondWithFilteredResult(_0x1ea078,_0x36854b))['catch'](handleError(_0x1ea078,null));};exports['getHopperBlacks']=function(_0x28223b,_0x15f780,_0x586406){var _0xe19e27={'raw':!![],'where':{}};var _0x440109={};var _0x503324={'count':0x0,'rows':[]};return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x28223b[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x15f780,null))[_0x3aa2('0x21')](function(_0x35fc36){if(_0x35fc36){_0x440109[_0x3aa2('0x28')]=_['keys'](db['CmHopperBlack'][_0x3aa2('0x27')]);_0x440109[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x28223b['query']);_0x440109[_0x3aa2('0x2d')]=_[_0x3aa2('0x42')](_0x440109['model'],_0x440109[_0x3aa2('0x29')]);_0xe19e27[_0x3aa2('0x2f')]=_['intersection'](_0x440109[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x28223b[_0x3aa2('0x29')]['fields']));_0xe19e27[_0x3aa2('0x2f')]=_0xe19e27[_0x3aa2('0x2f')]['length']?_0xe19e27[_0x3aa2('0x2f')]:_0x440109[_0x3aa2('0x28')];if(!_0x28223b[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0xe19e27[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x28223b[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0xe19e27['offset']=qs[_0x3aa2('0x1a')](_0x28223b['query'][_0x3aa2('0x1a')]);}_0xe19e27[_0x3aa2('0x4b')]=qs[_0x3aa2('0x32')](_0x28223b['query'][_0x3aa2('0x32')]);_0xe19e27[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x28223b['query'],_0x440109['filters']));_0xe19e27[_0x3aa2('0x33')][_0x3aa2('0x4c')]=_0x35fc36['id'];if(_0x28223b[_0x3aa2('0x29')][_0x3aa2('0x4d')]){_0xe19e27[_0x3aa2('0x33')]=_['merge'](_0xe19e27[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0xe19e27['attributes'],function(_0x4383d6){var _0xa2bb48={};_0xa2bb48[_0x4383d6]={'$like':'%'+_0x28223b[_0x3aa2('0x29')][_0x3aa2('0x4d')]+'%'};return _0xa2bb48;})});}_0xe19e27=_[_0x3aa2('0x37')]({},_0xe19e27,_0x28223b[_0x3aa2('0x38')]);return db[_0x3aa2('0x54')][_0x3aa2('0x19')]({'where':_0xe19e27[_0x3aa2('0x33')]})[_0x3aa2('0x21')](function(_0x3aba02){_0x503324[_0x3aa2('0x19')]=_0x3aba02;if(_0x28223b['query'][_0x3aa2('0x39')]){_0xe19e27[_0x3aa2('0x43')]=[{'all':!![]}];}return db[_0x3aa2('0x54')][_0x3aa2('0x4f')](_0xe19e27);})[_0x3aa2('0x21')](function(_0xe6b70b){_0x503324['rows']=_0xe6b70b;return _0x503324;});}})[_0x3aa2('0x21')](respondWithFilteredResult(_0x15f780,_0xe19e27))[_0x3aa2('0x3b')](handleError(_0x15f780,null));};exports['getTeams']=function(_0x570aab,_0x3b96d5,_0xda8990){var _0x18b25c={};var _0x9a8e2b={};var _0x297970;var _0x3c0615;return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x570aab['params']['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x3b96d5,null))['then'](function(_0xc2cb1){if(_0xc2cb1){_0x297970=_0xc2cb1;_0x9a8e2b['model']=_['keys'](db[_0x3aa2('0x55')]['rawAttributes']);_0x9a8e2b[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x570aab[_0x3aa2('0x29')]);_0x9a8e2b[_0x3aa2('0x2d')]=_['intersection'](_0x9a8e2b[_0x3aa2('0x28')],_0x9a8e2b[_0x3aa2('0x29')]);_0x18b25c[_0x3aa2('0x2f')]=_['intersection'](_0x9a8e2b[_0x3aa2('0x28')],qs['fields'](_0x570aab['query']['fields']));_0x18b25c['attributes']=_0x18b25c[_0x3aa2('0x2f')][_0x3aa2('0x3e')]?_0x18b25c[_0x3aa2('0x2f')]:_0x9a8e2b[_0x3aa2('0x28')];_0x18b25c[_0x3aa2('0x4b')]=qs['sort'](_0x570aab['query'][_0x3aa2('0x32')]);_0x18b25c[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x570aab[_0x3aa2('0x29')],_0x9a8e2b['filters']));if(_0x570aab[_0x3aa2('0x29')]['filter']){_0x18b25c[_0x3aa2('0x33')]=_[_0x3aa2('0x37')](_0x18b25c['where'],{'$or':_['map'](_0x18b25c['attributes'],function(_0x36faaa){var _0x179f91={};_0x179f91[_0x36faaa]={'$like':'%'+_0x570aab[_0x3aa2('0x29')][_0x3aa2('0x4d')]+'%'};return _0x179f91;})});}_0x18b25c=_[_0x3aa2('0x37')]({},_0x18b25c,_0x570aab[_0x3aa2('0x38')]);return _0x297970[_0x3aa2('0x56')](_0x18b25c);}})['then'](function(_0x2ef2c5){if(_0x2ef2c5){_0x3c0615=_0x2ef2c5[_0x3aa2('0x3e')];if(!_0x570aab[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0x18b25c[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x570aab[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x18b25c['offset']=qs[_0x3aa2('0x1a')](_0x570aab['query'][_0x3aa2('0x1a')]);}return _0x297970[_0x3aa2('0x56')](_0x18b25c);}})[_0x3aa2('0x21')](function(_0x1462c2){if(_0x1462c2){return _0x1462c2?{'count':_0x3c0615,'rows':_0x1462c2}:null;}})['then'](respondWithResult(_0x3b96d5,null))[_0x3aa2('0x3b')](handleError(_0x3b96d5,null));};exports[_0x3aa2('0x57')]=function(_0x24440b,_0x56d6d3,_0x56e880){var _0x4e8fa4=[];var _0x82a686;return db[_0x3aa2('0x55')][_0x3aa2('0x4f')]({'where':{'id':_0x24440b[_0x3aa2('0x40')][_0x3aa2('0x58')]},'attributes':['id'],'include':[{'model':db[_0x3aa2('0x59')],'as':_0x3aa2('0x5a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x3713ab){if(_0x3713ab){for(var _0x52066e=0x0;_0x52066e<_0x3713ab['length'];_0x52066e+=0x1){for(var _0x578bd6=0x0;_0x578bd6<_0x3713ab[_0x52066e][_0x3aa2('0x5a')][_0x3aa2('0x3e')];_0x578bd6+=0x1){_0x4e8fa4=_[_0x3aa2('0x5b')](_0x4e8fa4,[_0x3713ab[_0x52066e][_0x3aa2('0x5a')][_0x578bd6]['id']]);}}return _0x4e8fa4;}})[_0x3aa2('0x21')](function(_0x3196d9){if(_0x3196d9){return db[_0x3aa2('0x26')][_0x3aa2('0x3f')]({'where':{'id':_0x24440b[_0x3aa2('0x3d')]['id']}});}})['then'](function(_0x447bca){if(_0x447bca){_0x82a686=_0x447bca;return _0x82a686[_0x3aa2('0x5c')](_0x4e8fa4,{'penalty':_0x24440b['body'][_0x3aa2('0x5d')]});}})[_0x3aa2('0x21')](function(_0x1c6b55){if(_0x1c6b55){return _0x82a686[_0x3aa2('0x57')](_0x24440b[_0x3aa2('0x40')]['ids']);}})[_0x3aa2('0x21')](handleEntityNotFound(_0x56d6d3,null))[_0x3aa2('0x21')](respondWithStatusCode(_0x56d6d3,null))[_0x3aa2('0x3b')](handleError(_0x56d6d3,null));};exports[_0x3aa2('0x5e')]=function(_0x3f3e72,_0x5a4261,_0x4b324f){var _0x2118b0=[];var _0x2ab33f;return db[_0x3aa2('0x55')][_0x3aa2('0x4f')]({'where':{'id':_0x3f3e72['query'][_0x3aa2('0x58')]},'attributes':['id'],'include':[{'model':db[_0x3aa2('0x59')],'as':_0x3aa2('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x3aa2('0x21')](function(_0x318e70){if(_0x318e70){for(var _0x3c2f43=0x0;_0x3c2f43<_0x318e70[_0x3aa2('0x3e')];_0x3c2f43+=0x1){for(var _0x1cd6e8=0x0;_0x1cd6e8<_0x318e70[_0x3c2f43][_0x3aa2('0x5a')][_0x3aa2('0x3e')];_0x1cd6e8+=0x1){_0x2118b0=_[_0x3aa2('0x5b')](_0x2118b0,[_0x318e70[_0x3c2f43][_0x3aa2('0x5a')][_0x1cd6e8]['id']]);}}return _0x2118b0;}})[_0x3aa2('0x21')](function(_0x4f1dd6){if(_0x4f1dd6){return db[_0x3aa2('0x26')][_0x3aa2('0x3f')]({'where':{'id':_0x3f3e72[_0x3aa2('0x3d')]['id']}});}})[_0x3aa2('0x21')](function(_0x583248){if(_0x583248){_0x2ab33f=_0x583248;return _0x2ab33f[_0x3aa2('0x5f')](_0x2118b0);}})[_0x3aa2('0x21')](function(_0x309f4f){if(_0x2ab33f){return _0x2ab33f[_0x3aa2('0x5e')](_0x3f3e72[_0x3aa2('0x29')]['ids']);}})['then'](handleEntityNotFound(_0x5a4261,null))[_0x3aa2('0x21')](respondWithStatusCode(_0x5a4261,null))[_0x3aa2('0x3b')](handleError(_0x5a4261,null));};exports[_0x3aa2('0x5c')]=function(_0xc03605,_0x3536d2,_0x22507f){var _0x55f7c6,_0x1885cd;return db['VoiceQueue'][_0x3aa2('0x3f')]({'where':{'id':_0xc03605[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x3536d2,null))[_0x3aa2('0x21')](function(_0x5639e3){if(_0x5639e3){_0x1885cd=_0x5639e3;return _0x5639e3[_0x3aa2('0x5c')](_0xc03605[_0x3aa2('0x40')][_0x3aa2('0x58')],_[_0x3aa2('0x45')](_0xc03605[_0x3aa2('0x40')],[_0x3aa2('0x58'),'id'])||{})['spread'](function(_0x5ecaaf){for(var _0x22152b=0x0;_0x22152b<_0xc03605['body'][_0x3aa2('0x58')][_0x3aa2('0x3e')];_0x22152b+=0x1){socket[_0x3aa2('0x60')](_0x3aa2('0x61'),{'UserId':_0xc03605[_0x3aa2('0x40')]['ids'][_0x22152b],'VoiceQueueId':_0xc03605[_0x3aa2('0x3d')]['id']});}return _0x5ecaaf;});}})[_0x3aa2('0x21')](function(_0x10e957){_0x55f7c6=_0x10e957||[];if(_0x1885cd){return db[_0x3aa2('0x59')]['findAll']({'where':{'id':_0xc03605[_0x3aa2('0x40')]['ids']},'attributes':['id',_0x3aa2('0x24'),_0x3aa2('0x62'),'voicePause'],'raw':!![]});}})[_0x3aa2('0x21')](function(_0x18e69d){if(_0x18e69d&&_0x18e69d[_0x3aa2('0x3e')]){var _0x2e44f0=[];for(var _0x2e22e8=0x0;_0x2e22e8<_0x18e69d[_0x3aa2('0x3e')];_0x2e22e8++){_0x2e44f0['push'](db[_0x3aa2('0x63')][_0x3aa2('0x64')]({'membername':_0x18e69d[_0x2e22e8][_0x3aa2('0x24')],'UserId':_0x18e69d[_0x2e22e8]['id'],'queue_name':_0x1885cd[_0x3aa2('0x24')],'VoiceQueueId':_0x1885cd['id'],'interface':util['format'](_0x3aa2('0x65'),'SIP',_0x18e69d[_0x2e22e8][_0x3aa2('0x24')]),'paused':_0x18e69d[_0x2e22e8][_0x3aa2('0x66')]||![],'penalty':_0xc03605[_0x3aa2('0x40')]['penalty']||0x0}));}return BPromise[_0x3aa2('0x67')](_0x2e44f0);}})['then'](function(_0x53a0cd){return _0x55f7c6;})['then'](respondWithResult(_0x3536d2,null))[_0x3aa2('0x3b')](handleError(_0x3536d2,null));};exports[_0x3aa2('0x5f')]=function(_0x158420,_0x363c0d,_0x20bf94){var _0x5b6520;return db[_0x3aa2('0x26')]['find']({'where':{'id':_0x158420[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x363c0d,null))['then'](function(_0x21b46f){if(_0x21b46f){return _0x21b46f['removeAgents'](_0x158420[_0x3aa2('0x29')][_0x3aa2('0x58')])[_0x3aa2('0x21')](function(_0x152d2e){if(_['isArray'](_0x158420['query'][_0x3aa2('0x58')])){for(var _0xb96912=0x0;_0xb96912<_0x158420[_0x3aa2('0x29')][_0x3aa2('0x58')]['length'];_0xb96912+=0x1){socket[_0x3aa2('0x60')](_0x3aa2('0x68'),{'UserId':_0x158420[_0x3aa2('0x29')][_0x3aa2('0x58')][_0xb96912],'VoiceQueueId':_0x158420[_0x3aa2('0x3d')]['id']});}}else{socket[_0x3aa2('0x60')](_0x3aa2('0x68'),{'UserId':_0x158420[_0x3aa2('0x29')][_0x3aa2('0x58')],'VoiceQueueId':_0x158420[_0x3aa2('0x3d')]['id']});}});}})[_0x3aa2('0x21')](function(_0x2de729){if(_0x158420[_0x3aa2('0x29')]['realtime']){_0x5b6520=_0x2de729;return db[_0x3aa2('0x63')][_0x3aa2('0x69')]({'where':{'VoiceQueueId':_0x158420[_0x3aa2('0x3d')]['id'],'UserId':_0x158420[_0x3aa2('0x29')][_0x3aa2('0x58')]}})[_0x3aa2('0x21')](function(){return _0x5b6520;});}})[_0x3aa2('0x21')](respondWithStatusCode(_0x363c0d,null))[_0x3aa2('0x3b')](handleError(_0x363c0d,null));};exports['getAgents']=function(_0x1decab,_0x3667de,_0x205896){var _0x1d45dc={};var _0x5f406d={};var _0x248f3e;var _0x253c10;return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x1decab[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3667de,null))[_0x3aa2('0x21')](function(_0x35a39d){if(_0x35a39d){_0x248f3e=_0x35a39d;_0x5f406d[_0x3aa2('0x28')]=_[_0x3aa2('0x2c')](db[_0x3aa2('0x59')][_0x3aa2('0x27')]);_0x5f406d[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x1decab['query']);_0x5f406d[_0x3aa2('0x2d')]=_['intersection'](_0x5f406d[_0x3aa2('0x28')],_0x5f406d[_0x3aa2('0x29')]);_0x1d45dc[_0x3aa2('0x2f')]=_['intersection'](_0x5f406d[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x1decab[_0x3aa2('0x29')]['fields']));_0x1d45dc[_0x3aa2('0x2f')]=_0x1d45dc[_0x3aa2('0x2f')]['length']?_0x1d45dc['attributes']:_0x5f406d['model'];_0x1d45dc[_0x3aa2('0x4b')]=qs[_0x3aa2('0x32')](_0x1decab['query'][_0x3aa2('0x32')]);_0x1d45dc['where']=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x1decab[_0x3aa2('0x29')],_0x5f406d[_0x3aa2('0x2d')]));if(_0x1decab['query'][_0x3aa2('0x4d')]){_0x1d45dc[_0x3aa2('0x33')]=_[_0x3aa2('0x37')](_0x1d45dc[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x1d45dc['attributes'],function(_0x2122cc){var _0x1ceeb7={};_0x1ceeb7[_0x2122cc]={'$like':'%'+_0x1decab['query'][_0x3aa2('0x4d')]+'%'};return _0x1ceeb7;})});}_0x1d45dc=_[_0x3aa2('0x37')]({},_0x1d45dc,_0x1decab['options']);return _0x248f3e[_0x3aa2('0x6a')](_0x1d45dc);}})[_0x3aa2('0x21')](function(_0xfc574e){if(_0xfc574e){_0x253c10=_0xfc574e[_0x3aa2('0x3e')];if(!_0x1decab[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0x1d45dc[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x1decab[_0x3aa2('0x29')]['limit']);_0x1d45dc[_0x3aa2('0x1a')]=qs[_0x3aa2('0x1a')](_0x1decab['query'][_0x3aa2('0x1a')]);}return _0x248f3e[_0x3aa2('0x6a')](_0x1d45dc);}})[_0x3aa2('0x21')](function(_0x5d7643){if(_0x5d7643){return _0x5d7643?{'count':_0x253c10,'rows':_0x5d7643}:null;}})[_0x3aa2('0x21')](respondWithResult(_0x3667de,null))[_0x3aa2('0x3b')](handleError(_0x3667de,null));};exports[_0x3aa2('0x6b')]=function(_0x166a97,_0x5a757a,_0x13eb2c){var _0x4afb74={};var _0x5ceb75={};var _0x290793;var _0x44e8d1;return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x166a97[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x5a757a,null))[_0x3aa2('0x21')](function(_0x5aad90){if(_0x5aad90){_0x290793=_0x5aad90;_0x5ceb75[_0x3aa2('0x28')]=_[_0x3aa2('0x2c')](db[_0x3aa2('0x63')]['rawAttributes']);_0x5ceb75[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x166a97[_0x3aa2('0x29')]);_0x5ceb75[_0x3aa2('0x2d')]=_['intersection'](_0x5ceb75[_0x3aa2('0x28')],_0x5ceb75[_0x3aa2('0x29')]);_0x4afb74[_0x3aa2('0x2f')]=_[_0x3aa2('0x42')](_0x5ceb75['model'],qs[_0x3aa2('0x2e')](_0x166a97[_0x3aa2('0x29')][_0x3aa2('0x2e')]));_0x4afb74[_0x3aa2('0x2f')]=_0x4afb74[_0x3aa2('0x2f')][_0x3aa2('0x3e')]?_0x4afb74[_0x3aa2('0x2f')]:_0x5ceb75['model'];_0x4afb74['order']=qs[_0x3aa2('0x32')](_0x166a97[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x4afb74[_0x3aa2('0x33')]=qs['filters'](_[_0x3aa2('0x34')](_0x166a97[_0x3aa2('0x29')],_0x5ceb75[_0x3aa2('0x2d')]));if(_0x166a97[_0x3aa2('0x29')]['filter']){_0x4afb74[_0x3aa2('0x33')]=_[_0x3aa2('0x37')](_0x4afb74[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x4afb74['attributes'],function(_0xf3eaaa){var _0x213689={};_0x213689[_0xf3eaaa]={'$like':'%'+_0x166a97['query'][_0x3aa2('0x4d')]+'%'};return _0x213689;})});}_0x4afb74=_[_0x3aa2('0x37')]({},_0x4afb74,_0x166a97[_0x3aa2('0x38')]);return _0x290793[_0x3aa2('0x6b')](_0x4afb74);}})[_0x3aa2('0x21')](function(_0x570a25){if(_0x570a25){_0x44e8d1=_0x570a25[_0x3aa2('0x3e')];if(!_0x166a97[_0x3aa2('0x29')][_0x3aa2('0x30')]('nolimit')){_0x4afb74[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x166a97[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x4afb74['offset']=qs[_0x3aa2('0x1a')](_0x166a97[_0x3aa2('0x29')][_0x3aa2('0x1a')]);}return _0x290793[_0x3aa2('0x6b')](_0x4afb74);}})[_0x3aa2('0x21')](function(_0x3347c6){return _0x3347c6?{'count':_0x44e8d1,'rows':_0x3347c6}:null;})[_0x3aa2('0x21')](respondWithResult(_0x5a757a,null))[_0x3aa2('0x3b')](handleError(_0x5a757a,null));};exports[_0x3aa2('0x6c')]=function(_0x4381bc,_0x13ccc9,_0x110305){var _0x55ccc1={};var _0x39b163={};var _0x40bf38;var _0x100d60;return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x4381bc['params']['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x13ccc9,null))[_0x3aa2('0x21')](function(_0x3ca7d1){if(_0x3ca7d1){_0x40bf38=_0x3ca7d1;_0x39b163[_0x3aa2('0x28')]=_[_0x3aa2('0x2c')](db[_0x3aa2('0x6d')][_0x3aa2('0x27')]);_0x39b163[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x4381bc[_0x3aa2('0x29')]);_0x39b163[_0x3aa2('0x2d')]=_['intersection'](_0x39b163[_0x3aa2('0x28')],_0x39b163['query']);_0x55ccc1[_0x3aa2('0x2f')]=_[_0x3aa2('0x42')](_0x39b163[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x4381bc[_0x3aa2('0x29')]['fields']));_0x55ccc1[_0x3aa2('0x2f')]=_0x55ccc1[_0x3aa2('0x2f')][_0x3aa2('0x3e')]?_0x55ccc1[_0x3aa2('0x2f')]:_0x39b163['model'];_0x55ccc1['order']=qs[_0x3aa2('0x32')](_0x4381bc[_0x3aa2('0x29')][_0x3aa2('0x32')]);_0x55ccc1['where']=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x4381bc['query'],_0x39b163[_0x3aa2('0x2d')]));if(_0x4381bc[_0x3aa2('0x29')]['filter']){_0x55ccc1['where']=_[_0x3aa2('0x37')](_0x55ccc1[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x55ccc1[_0x3aa2('0x2f')],function(_0x266787){var _0x69dc49={};_0x69dc49[_0x266787]={'$like':'%'+_0x4381bc['query'][_0x3aa2('0x4d')]+'%'};return _0x69dc49;})});}_0x55ccc1=_[_0x3aa2('0x37')]({},_0x55ccc1,_0x4381bc[_0x3aa2('0x38')]);return _0x40bf38[_0x3aa2('0x6c')](_0x55ccc1);}})[_0x3aa2('0x21')](function(_0x4f4024){if(_0x4f4024){_0x100d60=_0x4f4024[_0x3aa2('0x3e')];if(!_0x4381bc['query']['hasOwnProperty'](_0x3aa2('0x31'))){_0x55ccc1[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x4381bc[_0x3aa2('0x29')][_0x3aa2('0x1b')]);_0x55ccc1['offset']=qs[_0x3aa2('0x1a')](_0x4381bc[_0x3aa2('0x29')]['offset']);}return _0x40bf38['getLists'](_0x55ccc1);}})[_0x3aa2('0x21')](function(_0x3c8799){if(_0x3c8799){return _0x3c8799?{'count':_0x100d60,'rows':_0x3c8799}:null;}})[_0x3aa2('0x21')](respondWithResult(_0x13ccc9,null))[_0x3aa2('0x3b')](handleError(_0x13ccc9,null));};exports[_0x3aa2('0x6e')]=function(_0x2dc8d4,_0x51b52f,_0x14ab5f){var _0x3cce9f,_0x573b14;return db[_0x3aa2('0x26')][_0x3aa2('0x3f')]({'where':{'id':_0x2dc8d4[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x51b52f,null))[_0x3aa2('0x21')](function(_0x2b59c4){if(_0x2b59c4){_0x573b14=_0x2b59c4;return _0x2b59c4[_0x3aa2('0x6e')](_0x2dc8d4[_0x3aa2('0x40')][_0x3aa2('0x58')],_['omit'](_0x2dc8d4[_0x3aa2('0x40')],[_0x3aa2('0x58'),'id'])||{});}return null;})['spread'](function(_0x552f49){var _0x509448;_0x3cce9f=_0x552f49||[];var _0x3f40e9=[];if(_0x552f49){for(var _0x30dba9=0x0;_0x30dba9<_0x552f49[_0x3aa2('0x3e')];_0x30dba9+=0x1){var _0x3a74b8=_0x552f49[_0x30dba9]['get']({'plain':!![]});_0x573b14[_0x3aa2('0x6f')]=_0x2dc8d4['body'][_0x3aa2('0x6f')]?_0x2dc8d4[_0x3aa2('0x40')][_0x3aa2('0x6f')]:_0x573b14[_0x3aa2('0x6f')];switch(_0x573b14[_0x3aa2('0x6f')]){case _0x3aa2('0x70'):_0x509448=squel[_0x3aa2('0x71')]()[_0x3aa2('0x72')](_0x3aa2('0x73'))['fromQuery']([_0x3aa2('0x74'),_0x3aa2('0x75'),_0x3aa2('0x76'),'ListId',_0x3aa2('0x4c'),_0x3aa2('0x47'),'updatedAt'],squel['select']()[_0x3aa2('0x77')](_0x3aa2('0x74'),_0x3aa2('0x74'))['field'](_0x3aa2('0x78'),_0x3aa2('0x75'))['field']('id','ContactId')['field'](_0x3a74b8[_0x3aa2('0x79')][_0x3aa2('0x7a')](),_0x3aa2('0x7b'))[_0x3aa2('0x77')](_0x2dc8d4[_0x3aa2('0x3d')]['id'][_0x3aa2('0x7a')](),_0x3aa2('0x4c'))[_0x3aa2('0x77')](_0x3aa2('0x78'),'createdAt')[_0x3aa2('0x77')]('NOW()','updatedAt')['from'](_0x3aa2('0x7c'))[_0x3aa2('0x33')](_0x3aa2('0x7d'))[_0x3aa2('0x33')](_0x3aa2('0x7e'),_0x3a74b8[_0x3aa2('0x79')]['toString']())[_0x3aa2('0x33')](_0x3aa2('0x7f'))[_0x3aa2('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3aa2('0x80')]()[_0x3aa2('0x77')]('calleridnum')['from'](_0x3aa2('0x81'))[_0x3aa2('0x33')](_0x3aa2('0x82'),_0x2dc8d4['params']['id'][_0x3aa2('0x7a')]()))[_0x3aa2('0x33')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3aa2('0x80')]()[_0x3aa2('0x77')](_0x3aa2('0x74'))['from'](_0x3aa2('0x73'))['where'](_0x3aa2('0x82'),_0x2dc8d4['params']['id'][_0x3aa2('0x7a')]())))[_0x3aa2('0x7a')]();break;case _0x3aa2('0x83'):_0x509448=squel[_0x3aa2('0x71')]()[_0x3aa2('0x72')](_0x3aa2('0x73'))['fromQuery']([_0x3aa2('0x74'),_0x3aa2('0x75'),_0x3aa2('0x76'),_0x3aa2('0x7b'),_0x3aa2('0x4c'),'createdAt',_0x3aa2('0x46')],squel[_0x3aa2('0x80')]()[_0x3aa2('0x77')](_0x3aa2('0x74'),_0x3aa2('0x74'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x75'))[_0x3aa2('0x77')]('id',_0x3aa2('0x76'))[_0x3aa2('0x77')](_0x3a74b8[_0x3aa2('0x79')]['toString'](),_0x3aa2('0x7b'))[_0x3aa2('0x77')](_0x2dc8d4[_0x3aa2('0x3d')]['id']['toString'](),_0x3aa2('0x4c'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x47'))['field'](_0x3aa2('0x78'),_0x3aa2('0x46'))[_0x3aa2('0x84')](_0x3aa2('0x7c'))[_0x3aa2('0x33')]('deletedAt\x20IS\x20NULL')[_0x3aa2('0x33')](_0x3aa2('0x7e'),_0x3a74b8[_0x3aa2('0x79')][_0x3aa2('0x7a')]())[_0x3aa2('0x33')](_0x3aa2('0x7f'))[_0x3aa2('0x33')](_0x3aa2('0x85'),squel[_0x3aa2('0x80')]()[_0x3aa2('0x77')](_0x3aa2('0x74'))[_0x3aa2('0x84')](_0x3aa2('0x73'))[_0x3aa2('0x33')](_0x3aa2('0x82'),_0x2dc8d4['params']['id'][_0x3aa2('0x7a')]())))['toString']();break;default:_0x509448=squel['insert']()['into'](_0x3aa2('0x73'))[_0x3aa2('0x86')](['phone',_0x3aa2('0x75'),_0x3aa2('0x76'),_0x3aa2('0x7b'),'VoiceQueueId','createdAt',_0x3aa2('0x46')],squel[_0x3aa2('0x80')]()['field'](_0x3aa2('0x74'),_0x3aa2('0x74'))[_0x3aa2('0x77')](_0x3aa2('0x78'),'scheduledAt')[_0x3aa2('0x77')]('id',_0x3aa2('0x76'))[_0x3aa2('0x77')](_0x3a74b8[_0x3aa2('0x79')][_0x3aa2('0x7a')](),_0x3aa2('0x7b'))[_0x3aa2('0x77')](_0x2dc8d4[_0x3aa2('0x3d')]['id']['toString'](),_0x3aa2('0x4c'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x47'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x46'))[_0x3aa2('0x84')]('cm_contacts')['where'](_0x3aa2('0x7d'))[_0x3aa2('0x33')](_0x3aa2('0x7e'),_0x3a74b8['CmListId'][_0x3aa2('0x7a')]())['where'](_0x3aa2('0x7f')))[_0x3aa2('0x7a')]();}_0x3f40e9['push'](db['sequelize'][_0x3aa2('0x29')](_0x509448));}return BPromise[_0x3aa2('0x67')](_0x3f40e9);}})[_0x3aa2('0x21')](function(){return _0x3cce9f;})['then'](respondWithResult(_0x51b52f,null))['catch'](handleError(_0x51b52f,null));};exports[_0x3aa2('0x87')]=function(_0x96878c,_0x1ac216,_0x1caf5e){var _0x2ce43a;return db[_0x3aa2('0x26')][_0x3aa2('0x3f')]({'where':{'id':_0x96878c['params']['id']}})[_0x3aa2('0x21')](handleEntityNotFound(_0x1ac216,null))[_0x3aa2('0x21')](function(_0x109bd0){if(_0x109bd0){return _0x109bd0[_0x3aa2('0x87')](_0x96878c['query'][_0x3aa2('0x58')]);}})[_0x3aa2('0x21')](function(_0x2fb3e8){if(_0x2fb3e8){_0x2ce43a=_0x2fb3e8;return db[_0x3aa2('0x4a')][_0x3aa2('0x69')]({'where':{'ListId':_0x96878c[_0x3aa2('0x29')]['ids'],'VoiceQueueId':_0x96878c[_0x3aa2('0x3d')]['id']}})['then'](function(){return _0x2ce43a;});}})['then'](respondWithStatusCode(_0x1ac216,null))[_0x3aa2('0x3b')](handleError(_0x1ac216,null));};exports[_0x3aa2('0x88')]=function(_0x3dc30c,_0x462a31,_0x246e79){var _0x1b45ae={};var _0x155a4f={};var _0x2b72fd;var _0x413266;return db[_0x3aa2('0x26')][_0x3aa2('0x49')]({'where':{'id':_0x3dc30c[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x462a31,null))[_0x3aa2('0x21')](function(_0x2e0f75){if(_0x2e0f75){_0x2b72fd=_0x2e0f75;_0x155a4f[_0x3aa2('0x28')]=_[_0x3aa2('0x2c')](db[_0x3aa2('0x6d')][_0x3aa2('0x27')]);_0x155a4f[_0x3aa2('0x29')]=_[_0x3aa2('0x2c')](_0x3dc30c['query']);_0x155a4f['filters']=_[_0x3aa2('0x42')](_0x155a4f[_0x3aa2('0x28')],_0x155a4f['query']);_0x1b45ae['attributes']=_[_0x3aa2('0x42')](_0x155a4f[_0x3aa2('0x28')],qs[_0x3aa2('0x2e')](_0x3dc30c['query'][_0x3aa2('0x2e')]));_0x1b45ae[_0x3aa2('0x2f')]=_0x1b45ae[_0x3aa2('0x2f')][_0x3aa2('0x3e')]?_0x1b45ae[_0x3aa2('0x2f')]:_0x155a4f['model'];_0x1b45ae['order']=qs['sort'](_0x3dc30c[_0x3aa2('0x29')]['sort']);_0x1b45ae[_0x3aa2('0x33')]=qs[_0x3aa2('0x2d')](_[_0x3aa2('0x34')](_0x3dc30c['query'],_0x155a4f[_0x3aa2('0x2d')]));if(_0x3dc30c[_0x3aa2('0x29')][_0x3aa2('0x4d')]){_0x1b45ae[_0x3aa2('0x33')]=_[_0x3aa2('0x37')](_0x1b45ae[_0x3aa2('0x33')],{'$or':_[_0x3aa2('0x4e')](_0x1b45ae[_0x3aa2('0x2f')],function(_0x1db9a){var _0x4d3dc3={};_0x4d3dc3[_0x1db9a]={'$like':'%'+_0x3dc30c[_0x3aa2('0x29')]['filter']+'%'};return _0x4d3dc3;})});}_0x1b45ae=_[_0x3aa2('0x37')]({},_0x1b45ae,_0x3dc30c[_0x3aa2('0x38')]);return _0x2b72fd[_0x3aa2('0x88')](_0x1b45ae);}})[_0x3aa2('0x21')](function(_0xce90b0){if(_0xce90b0){_0x413266=_0xce90b0[_0x3aa2('0x3e')];if(!_0x3dc30c[_0x3aa2('0x29')][_0x3aa2('0x30')](_0x3aa2('0x31'))){_0x1b45ae[_0x3aa2('0x1b')]=qs[_0x3aa2('0x1b')](_0x3dc30c['query'][_0x3aa2('0x1b')]);_0x1b45ae['offset']=qs[_0x3aa2('0x1a')](_0x3dc30c[_0x3aa2('0x29')][_0x3aa2('0x1a')]);}return _0x2b72fd[_0x3aa2('0x88')](_0x1b45ae);}})[_0x3aa2('0x21')](function(_0x1ce476){if(_0x1ce476){return _0x1ce476?{'count':_0x413266,'rows':_0x1ce476}:null;}})[_0x3aa2('0x21')](respondWithResult(_0x462a31,null))['catch'](handleError(_0x462a31,null));};exports['addBlackLists']=function(_0x4cf9c9,_0x237aa2,_0x93ceff){var _0x1a7c34,_0x53421e;return db[_0x3aa2('0x26')]['find']({'where':{'id':_0x4cf9c9[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x237aa2,null))[_0x3aa2('0x21')](function(_0x5b1cf4){if(_0x5b1cf4){_0x53421e=_0x5b1cf4;return _0x5b1cf4['addBlackLists'](_0x4cf9c9[_0x3aa2('0x40')][_0x3aa2('0x58')],_[_0x3aa2('0x45')](_0x4cf9c9[_0x3aa2('0x40')],[_0x3aa2('0x58'),'id'])||{});}return null;})['spread'](function(_0x1ec1c7){var _0x2bc1d6;_0x1a7c34=_0x1ec1c7||[];var _0x17e353=[];if(_0x1ec1c7){for(var _0x32047f=0x0;_0x32047f<_0x1ec1c7[_0x3aa2('0x3e')];_0x32047f+=0x1){var _0xb61261=_0x1ec1c7[_0x32047f][_0x3aa2('0x44')]({'plain':!![]});_0x2bc1d6=squel[_0x3aa2('0x71')]()['into'](_0x3aa2('0x89'))[_0x3aa2('0x86')](['phone',_0x3aa2('0x76'),_0x3aa2('0x7b'),_0x3aa2('0x4c'),_0x3aa2('0x47'),_0x3aa2('0x46')],squel[_0x3aa2('0x80')]()[_0x3aa2('0x77')]('phone','phone')[_0x3aa2('0x77')]('id',_0x3aa2('0x76'))['field'](_0xb61261[_0x3aa2('0x79')][_0x3aa2('0x7a')](),_0x3aa2('0x7b'))['field'](_0x4cf9c9[_0x3aa2('0x3d')]['id'][_0x3aa2('0x7a')](),_0x3aa2('0x4c'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x47'))[_0x3aa2('0x77')](_0x3aa2('0x78'),_0x3aa2('0x46'))[_0x3aa2('0x84')]('cm_contacts')[_0x3aa2('0x33')]('deletedAt\x20IS\x20NULL')[_0x3aa2('0x33')](_0x3aa2('0x7e'),_0xb61261[_0x3aa2('0x79')][_0x3aa2('0x7a')]())[_0x3aa2('0x33')](_0x3aa2('0x7f')))[_0x3aa2('0x7a')]();_0x17e353[_0x3aa2('0x8a')](db[_0x3aa2('0x8b')][_0x3aa2('0x29')](_0x2bc1d6));}return BPromise['all'](_0x17e353);}})[_0x3aa2('0x21')](function(){return _0x1a7c34;})['then'](respondWithResult(_0x237aa2,null))[_0x3aa2('0x3b')](handleError(_0x237aa2,null));};exports[_0x3aa2('0x8c')]=function(_0x3ea3aa,_0x3b7483,_0x2d6c39){var _0x122bd5;return db['VoiceQueue'][_0x3aa2('0x3f')]({'where':{'id':_0x3ea3aa[_0x3aa2('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3b7483,null))[_0x3aa2('0x21')](function(_0x50d688){if(_0x50d688){return _0x50d688['removeBlackLists'](_0x3ea3aa[_0x3aa2('0x29')][_0x3aa2('0x58')]);}})[_0x3aa2('0x21')](function(_0x3b457d){if(_0x3b457d){_0x122bd5=_0x3b457d;return db['CmHopperBlack'][_0x3aa2('0x69')]({'where':{'ListId':_0x3ea3aa['query'][_0x3aa2('0x58')],'VoiceQueueId':_0x3ea3aa[_0x3aa2('0x3d')]['id']}})[_0x3aa2('0x21')](function(){return _0x122bd5;});}})[_0x3aa2('0x21')](respondWithStatusCode(_0x3b7483,null))[_0x3aa2('0x3b')](handleError(_0x3b7483,null));}; \ No newline at end of file +var _0x9076=['toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','VoiceQueueId\x20=\x20?','from','onlyIfOpen','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','socket.io-emitter','localhost','./voiceQueue.socket','register','sendStatus','end','status','offset','limit','set','Content-Range','reject','save','then','destroy','error','stack','name','index','VoiceQueue','keys','query','dateEnd','dateStart','filters','model','attributes','fields','length','nolimit','order','sort','pick','add','where','merge','map','filter','count','include','findAll','catch','params','intersection','includeAll','options','create','clone','find','get','omit','createdAt','updatedAt','body','findOne','CmHopper','rawAttributes','rows','CmHopperHistory','getHopperFinals','hasOwnProperty','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','ids','User','Agents','addAgents','penalty','union','userVoiceQueue:save','loginInPause','voicePause','format','%s/%s','all','removeAgents','emit','userVoiceQueue:remove','realtime','UserVoiceQueueRt','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','field','phone','NOW()','CmListId'];(function(_0x125ed8,_0x4d1612){var _0x53fcc7=function(_0x43b101){while(--_0x43b101){_0x125ed8['push'](_0x125ed8['shift']());}};_0x53fcc7(++_0x4d1612);}(_0x9076,0xa0));var _0x6907=function(_0x44056e,_0x20bb63){_0x44056e=_0x44056e-0x0;var _0x161c2b=_0x9076[_0x44056e];return _0x161c2b;};'use strict';var jsonpatch=require(_0x6907('0x0'));var rp=require('request-promise');var moment=require(_0x6907('0x1'));var BPromise=require(_0x6907('0x2'));var Mustache=require(_0x6907('0x3'));var util=require('util');var path=require(_0x6907('0x4'));var sox=require(_0x6907('0x5'));var csv=require(_0x6907('0x6'));var ejs=require(_0x6907('0x7'));var fs=require('fs');var _=require(_0x6907('0x8'));var squel=require(_0x6907('0x9'));var crypto=require(_0x6907('0xa'));var jsforce=require(_0x6907('0xb'));var deskjs=require(_0x6907('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6907('0xd'));var Papa=require('papaparse');var qs=require(_0x6907('0xe'));var logger=require(_0x6907('0xf'))(_0x6907('0x10'));var utils=require(_0x6907('0x11'));var config=require('../../config/environment');var db=require(_0x6907('0x12'))['db'];var socket=require(_0x6907('0x13'))({'host':_0x6907('0x14'),'port':0x18eb});require(_0x6907('0x15'))[_0x6907('0x16')](socket);function respondWithStatusCode(_0x2de5cd,_0x4182c2){_0x4182c2=_0x4182c2||0xcc;return function(_0x4554b3){if(_0x4554b3){return _0x2de5cd[_0x6907('0x17')](_0x4182c2);}return _0x2de5cd['status'](_0x4182c2)[_0x6907('0x18')]();};}function respondWithResult(_0x23297,_0x196335){_0x196335=_0x196335||0xc8;return function(_0x322a7b){if(_0x322a7b){return _0x23297[_0x6907('0x19')](_0x196335)['json'](_0x322a7b);}};}function respondWithFilteredResult(_0x1dc2ce,_0x4f8503){return function(_0x1099da){if(_0x1099da){var _0x25b108=_0x1099da['count'],_0x256fe9=_0x4f8503['offset'],_0x228f9d=_0x4f8503[_0x6907('0x1a')]+_0x4f8503[_0x6907('0x1b')],_0x5b5fdb;if(_0x228f9d>=_0x25b108){_0x228f9d=_0x25b108;_0x5b5fdb=0xc8;}else{_0x5b5fdb=0xce;}_0x1dc2ce[_0x6907('0x19')](_0x5b5fdb);return _0x1dc2ce[_0x6907('0x1c')](_0x6907('0x1d'),_0x256fe9+'-'+_0x228f9d+'/'+_0x25b108)['json'](_0x1099da);}return null;};}function patchUpdates(_0x59cb90){return function(_0x1e8452){try{jsonpatch['apply'](_0x1e8452,_0x59cb90,!![]);}catch(_0x36cd22){return BPromise[_0x6907('0x1e')](_0x36cd22);}return _0x1e8452[_0x6907('0x1f')]();};}function saveUpdates(_0x2b37b1,_0xc29219){return function(_0xf2c344){if(_0xf2c344){return _0xf2c344['update'](_0x2b37b1)[_0x6907('0x20')](function(_0x41ea32){return _0x41ea32;});}return null;};}function removeEntity(_0x1831e7,_0x473d93){return function(_0x44a804){if(_0x44a804){return _0x44a804[_0x6907('0x21')]()[_0x6907('0x20')](function(){_0x1831e7[_0x6907('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a259b,_0x53773f){return function(_0x5c6468){if(!_0x5c6468){_0x2a259b['sendStatus'](0x194);}return _0x5c6468;};}function handleError(_0x393af2,_0x2c9944){_0x2c9944=_0x2c9944||0x1f4;return function(_0x22493b){logger[_0x6907('0x22')](_0x22493b[_0x6907('0x23')]);if(_0x22493b[_0x6907('0x24')]){delete _0x22493b[_0x6907('0x24')];}_0x393af2[_0x6907('0x19')](_0x2c9944)['send'](_0x22493b);};}exports[_0x6907('0x25')]=function(_0x230e09,_0x26b34e){var _0x177921={},_0x427c02={},_0x42bdbe={'count':0x0,'rows':[]};var _0x59d5ba=db[_0x6907('0x26')]['rawAttributes'];_0x427c02['model']=_[_0x6907('0x27')](_0x59d5ba);var _0x194ec6={'dateStart':_0x230e09[_0x6907('0x28')]['dateStart'],'dateEnd':_0x230e09[_0x6907('0x28')][_0x6907('0x29')]};delete _0x230e09[_0x6907('0x28')][_0x6907('0x2a')];delete _0x230e09[_0x6907('0x28')][_0x6907('0x29')];_0x427c02[_0x6907('0x28')]=_[_0x6907('0x27')](_0x230e09[_0x6907('0x28')]);_0x427c02[_0x6907('0x2b')]=_['intersection'](_0x427c02[_0x6907('0x2c')],_0x427c02[_0x6907('0x28')]);_0x177921[_0x6907('0x2d')]=_['intersection'](_0x427c02[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x230e09[_0x6907('0x28')][_0x6907('0x2e')]));_0x177921['attributes']=_0x177921['attributes'][_0x6907('0x2f')]?_0x177921['attributes']:_0x427c02[_0x6907('0x2c')];if(!_0x230e09['query']['hasOwnProperty'](_0x6907('0x30'))){_0x177921[_0x6907('0x1b')]=qs['limit'](_0x230e09[_0x6907('0x28')][_0x6907('0x1b')]);_0x177921['offset']=qs[_0x6907('0x1a')](_0x230e09[_0x6907('0x28')][_0x6907('0x1a')]);}_0x177921[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x230e09[_0x6907('0x28')][_0x6907('0x32')]);_0x177921['where']=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x230e09[_0x6907('0x28')],_0x427c02['filters']));if(_0x194ec6[_0x6907('0x2a')]){if(_0x194ec6[_0x6907('0x29')]){_0x194ec6[_0x6907('0x29')]=moment(_0x194ec6[_0x6907('0x29')])[_0x6907('0x34')](0x1,'day');}else{_0x194ec6['dateEnd']=moment(_0x194ec6['dateStart'])[_0x6907('0x34')](0x1,'day');}_['merge'](_0x177921[_0x6907('0x35')],{'createdAt':{'$gte':_0x194ec6[_0x6907('0x2a')],'$lte':_0x194ec6['dateEnd']}});}if(_0x230e09['query']['filter']){_0x177921[_0x6907('0x35')]=_[_0x6907('0x36')](_0x177921[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x177921[_0x6907('0x2d')],function(_0x183f6f){var _0x4eba39={};_0x4eba39[_0x183f6f]={'$like':'%'+_0x230e09[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x4eba39;})});}_0x177921=_[_0x6907('0x36')]({},_0x177921,_0x230e09['options']);var _0xb52b3c={'where':_0x177921[_0x6907('0x35')]};return db[_0x6907('0x26')][_0x6907('0x39')](_0xb52b3c)['then'](function(_0x498c02){_0x42bdbe[_0x6907('0x39')]=_0x498c02;if(_0x230e09[_0x6907('0x28')]['includeAll']){_0x177921[_0x6907('0x3a')]=[{'all':!![]}];}return db[_0x6907('0x26')][_0x6907('0x3b')](_0x177921);})['then'](function(_0x19b0fe){_0x42bdbe['rows']=_0x19b0fe;return _0x42bdbe;})[_0x6907('0x20')](respondWithFilteredResult(_0x26b34e,_0x177921))[_0x6907('0x3c')](handleError(_0x26b34e,null));};exports['show']=function(_0x4c1792,_0x28d069){var _0x214698={'raw':![],'where':{'id':_0x4c1792[_0x6907('0x3d')]['id']}},_0x49bef0={};_0x49bef0[_0x6907('0x2c')]=_['keys'](db[_0x6907('0x26')]['rawAttributes']);_0x49bef0[_0x6907('0x28')]=_['keys'](_0x4c1792[_0x6907('0x28')]);_0x49bef0[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x49bef0[_0x6907('0x2c')],_0x49bef0[_0x6907('0x28')]);_0x214698[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x49bef0[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x4c1792[_0x6907('0x28')][_0x6907('0x2e')]));_0x214698[_0x6907('0x2d')]=_0x214698[_0x6907('0x2d')][_0x6907('0x2f')]?_0x214698[_0x6907('0x2d')]:_0x49bef0[_0x6907('0x2c')];if(_0x4c1792['query'][_0x6907('0x3f')]){_0x214698[_0x6907('0x3a')]=[{'all':!![]}];}_0x214698=_[_0x6907('0x36')]({},_0x214698,_0x4c1792[_0x6907('0x40')]);return db[_0x6907('0x26')]['find'](_0x214698)['then'](handleEntityNotFound(_0x28d069,null))[_0x6907('0x20')](respondWithResult(_0x28d069,null))[_0x6907('0x3c')](handleError(_0x28d069,null));};exports['create']=function(_0x20cc3f,_0x2ba08e){return db[_0x6907('0x26')][_0x6907('0x41')](_0x20cc3f['body'],{})[_0x6907('0x20')](respondWithResult(_0x2ba08e,0xc9))[_0x6907('0x3c')](handleError(_0x2ba08e,null));};exports[_0x6907('0x42')]=function(_0x121d33,_0x398159){var _0x59de9a={'raw':![],'where':{'id':_0x121d33[_0x6907('0x3d')]['id']}},_0x5b9317={};_0x5b9317[_0x6907('0x2c')]=_['keys'](db[_0x6907('0x26')]['rawAttributes']);_0x59de9a[_0x6907('0x2d')]=_['intersection'](_0x5b9317[_0x6907('0x2c')],qs['fields'](_0x121d33['query'][_0x6907('0x2e')]));_0x59de9a[_0x6907('0x2d')]=_0x59de9a[_0x6907('0x2d')][_0x6907('0x2f')]?_0x59de9a['attributes']:_0x5b9317['model'];if(_0x121d33[_0x6907('0x28')][_0x6907('0x3f')]){_0x59de9a[_0x6907('0x3a')]=[{'all':!![]}];}_0x59de9a=_[_0x6907('0x36')]({},_0x59de9a,_0x121d33['options']);return db[_0x6907('0x26')][_0x6907('0x43')](_0x59de9a)['then'](handleEntityNotFound(_0x398159,null))[_0x6907('0x20')](function(_0x176a99){if(_0x176a99){var _0x7df169=_0x176a99[_0x6907('0x44')]({'plain':!![]});_0x7df169=qs[_0x6907('0x45')](_0x7df169,['id',_0x6907('0x46'),'updatedAt']);_0x121d33['body']=_[_0x6907('0x45')](_0x121d33['body'],['id',_0x6907('0x46'),_0x6907('0x47')]);return db['VoiceQueue'][_0x6907('0x41')](_[_0x6907('0x36')](_0x7df169,_0x121d33[_0x6907('0x48')]),{'include':_0x121d33['query'][_0x6907('0x3f')]?[{'all':!![]}]:undefined});}})[_0x6907('0x20')](respondWithResult(_0x398159,0xc9))[_0x6907('0x3c')](handleError(_0x398159,null));};exports['update']=function(_0x5a4e1b,_0xbd1be5){if(_0x5a4e1b[_0x6907('0x48')]['id']){delete _0x5a4e1b[_0x6907('0x48')]['id'];}return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x5a4e1b[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xbd1be5,null))['then'](saveUpdates(_0x5a4e1b[_0x6907('0x48')],null))[_0x6907('0x20')](respondWithResult(_0xbd1be5,null))[_0x6907('0x3c')](handleError(_0xbd1be5,null));};exports[_0x6907('0x21')]=function(_0x18c359,_0x12c1a4){return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x18c359[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x12c1a4,null))[_0x6907('0x20')](removeEntity(_0x12c1a4,null))[_0x6907('0x3c')](handleError(_0x12c1a4,null));};exports['getHoppers']=function(_0x10b591,_0x19330f,_0x17d408){var _0x3cac98={'raw':![],'where':{}};var _0x11aad2={};var _0x279bdb={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x10b591['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x19330f,null))[_0x6907('0x20')](function(_0x199720){if(_0x199720){_0x11aad2[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x4a')][_0x6907('0x4b')]);_0x11aad2[_0x6907('0x28')]=_['keys'](_0x10b591[_0x6907('0x28')]);_0x11aad2[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x11aad2[_0x6907('0x2c')],_0x11aad2['query']);_0x3cac98['attributes']=_[_0x6907('0x3e')](_0x11aad2[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x10b591[_0x6907('0x28')][_0x6907('0x2e')]));_0x3cac98['attributes']=_0x3cac98['attributes']['length']?_0x3cac98[_0x6907('0x2d')]:_0x11aad2[_0x6907('0x2c')];if(!_0x10b591[_0x6907('0x28')]['hasOwnProperty']('nolimit')){_0x3cac98[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x10b591[_0x6907('0x28')]['limit']);_0x3cac98[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x10b591[_0x6907('0x28')][_0x6907('0x1a')]);}_0x3cac98['order']=qs['sort'](_0x10b591[_0x6907('0x28')][_0x6907('0x32')]);_0x3cac98[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x10b591[_0x6907('0x28')],_0x11aad2[_0x6907('0x2b')]));_0x3cac98['where']['VoiceQueueId']=_0x199720['id'];if(_0x10b591['query']['filter']){_0x3cac98['where']=_[_0x6907('0x36')](_0x3cac98['where'],{'$or':_[_0x6907('0x37')](_0x3cac98['attributes'],function(_0x1e57c2){var _0x48b5f4={};_0x48b5f4[_0x1e57c2]={'$like':'%'+_0x10b591['query'][_0x6907('0x38')]+'%'};return _0x48b5f4;})});}_0x3cac98=_['merge']({},_0x3cac98,_0x10b591['options']);return db[_0x6907('0x4a')][_0x6907('0x39')]({'where':_0x3cac98['where']})[_0x6907('0x20')](function(_0x53745a){_0x279bdb['count']=_0x53745a;if(_0x10b591[_0x6907('0x28')][_0x6907('0x3f')]){_0x3cac98['include']=[{'all':!![]}];}return db[_0x6907('0x4a')][_0x6907('0x3b')](_0x3cac98);})[_0x6907('0x20')](function(_0x5d4d1b){_0x279bdb[_0x6907('0x4c')]=_0x5d4d1b;return _0x279bdb;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x19330f,_0x3cac98))[_0x6907('0x3c')](handleError(_0x19330f,null));};exports['getHopperHistories']=function(_0x8b01f3,_0x67d051,_0x47e045){var _0x310402={'raw':!![],'where':{}};var _0x274e03={};var _0x276c0d={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x6907('0x49')]({'where':{'id':_0x8b01f3[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x67d051,null))[_0x6907('0x20')](function(_0x3dac92){if(_0x3dac92){_0x274e03[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x4d')]['rawAttributes']);_0x274e03[_0x6907('0x28')]=_[_0x6907('0x27')](_0x8b01f3['query']);_0x274e03[_0x6907('0x2b')]=_['intersection'](_0x274e03[_0x6907('0x2c')],_0x274e03[_0x6907('0x28')]);_0x310402[_0x6907('0x2d')]=_['intersection'](_0x274e03['model'],qs['fields'](_0x8b01f3['query'][_0x6907('0x2e')]));_0x310402[_0x6907('0x2d')]=_0x310402[_0x6907('0x2d')][_0x6907('0x2f')]?_0x310402[_0x6907('0x2d')]:_0x274e03['model'];if(!_0x8b01f3[_0x6907('0x28')]['hasOwnProperty'](_0x6907('0x30'))){_0x310402['limit']=qs[_0x6907('0x1b')](_0x8b01f3[_0x6907('0x28')]['limit']);_0x310402[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x8b01f3['query'][_0x6907('0x1a')]);}_0x310402[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x8b01f3[_0x6907('0x28')][_0x6907('0x32')]);_0x310402[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x8b01f3['query'],_0x274e03[_0x6907('0x2b')]));_0x310402['where']['VoiceQueueId']=_0x3dac92['id'];if(_0x8b01f3[_0x6907('0x28')]['filter']){_0x310402[_0x6907('0x35')]=_[_0x6907('0x36')](_0x310402[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x310402['attributes'],function(_0x3ce954){var _0xb764c4={};_0xb764c4[_0x3ce954]={'$like':'%'+_0x8b01f3[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0xb764c4;})});}_0x310402=_['merge']({},_0x310402,_0x8b01f3[_0x6907('0x40')]);return db[_0x6907('0x4d')][_0x6907('0x39')]({'where':_0x310402[_0x6907('0x35')]})['then'](function(_0x5c81d8){_0x276c0d['count']=_0x5c81d8;if(_0x8b01f3[_0x6907('0x28')][_0x6907('0x3f')]){_0x310402[_0x6907('0x3a')]=[{'all':!![]}];}return db[_0x6907('0x4d')][_0x6907('0x3b')](_0x310402);})[_0x6907('0x20')](function(_0x38a254){_0x276c0d[_0x6907('0x4c')]=_0x38a254;return _0x276c0d;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x67d051,_0x310402))[_0x6907('0x3c')](handleError(_0x67d051,null));};exports[_0x6907('0x4e')]=function(_0x483987,_0x466ce7,_0x27ddee){var _0x4806f2={'raw':!![],'where':{}};var _0x4dab4d={};var _0x18dbe4={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x483987['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x466ce7,null))[_0x6907('0x20')](function(_0x318597){if(_0x318597){_0x4dab4d[_0x6907('0x2c')]=_[_0x6907('0x27')](db['CmHopperFinal'][_0x6907('0x4b')]);_0x4dab4d['query']=_[_0x6907('0x27')](_0x483987['query']);_0x4dab4d[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x4dab4d[_0x6907('0x2c')],_0x4dab4d[_0x6907('0x28')]);_0x4806f2[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x4dab4d[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x483987[_0x6907('0x28')]['fields']));_0x4806f2[_0x6907('0x2d')]=_0x4806f2[_0x6907('0x2d')]['length']?_0x4806f2[_0x6907('0x2d')]:_0x4dab4d['model'];if(!_0x483987[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x4806f2[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x483987['query'][_0x6907('0x1b')]);_0x4806f2[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x483987[_0x6907('0x28')][_0x6907('0x1a')]);}_0x4806f2[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x483987[_0x6907('0x28')]['sort']);_0x4806f2[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x483987[_0x6907('0x28')],_0x4dab4d[_0x6907('0x2b')]));_0x4806f2[_0x6907('0x35')][_0x6907('0x50')]=_0x318597['id'];if(_0x483987[_0x6907('0x28')][_0x6907('0x38')]){_0x4806f2[_0x6907('0x35')]=_[_0x6907('0x36')](_0x4806f2['where'],{'$or':_['map'](_0x4806f2[_0x6907('0x2d')],function(_0x5c521e){var _0x105e7c={};_0x105e7c[_0x5c521e]={'$like':'%'+_0x483987['query'][_0x6907('0x38')]+'%'};return _0x105e7c;})});}_0x4806f2=_[_0x6907('0x36')]({},_0x4806f2,_0x483987[_0x6907('0x40')]);return db[_0x6907('0x51')]['count']({'where':_0x4806f2[_0x6907('0x35')]})[_0x6907('0x20')](function(_0x39b03e){_0x18dbe4['count']=_0x39b03e;if(_0x483987['query'][_0x6907('0x3f')]){_0x4806f2['include']=[{'all':!![]}];}return db[_0x6907('0x51')][_0x6907('0x3b')](_0x4806f2);})[_0x6907('0x20')](function(_0x25d50c){_0x18dbe4[_0x6907('0x4c')]=_0x25d50c;return _0x18dbe4;});}})['then'](respondWithFilteredResult(_0x466ce7,_0x4806f2))['catch'](handleError(_0x466ce7,null));};exports[_0x6907('0x52')]=function(_0x30d7a3,_0x3f2650,_0x1ff28a){var _0x32e7ef={'raw':!![],'where':{}};var _0x2ab2e4={};var _0x3b8340={'count':0x0,'rows':[]};return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x30d7a3[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3f2650,null))[_0x6907('0x20')](function(_0x1a2e56){if(_0x1a2e56){_0x2ab2e4[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x53')]['rawAttributes']);_0x2ab2e4[_0x6907('0x28')]=_[_0x6907('0x27')](_0x30d7a3[_0x6907('0x28')]);_0x2ab2e4[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x2ab2e4['model'],_0x2ab2e4[_0x6907('0x28')]);_0x32e7ef[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x2ab2e4[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x30d7a3[_0x6907('0x28')][_0x6907('0x2e')]));_0x32e7ef['attributes']=_0x32e7ef[_0x6907('0x2d')]['length']?_0x32e7ef[_0x6907('0x2d')]:_0x2ab2e4['model'];if(!_0x30d7a3['query'][_0x6907('0x4f')](_0x6907('0x30'))){_0x32e7ef[_0x6907('0x1b')]=qs['limit'](_0x30d7a3[_0x6907('0x28')][_0x6907('0x1b')]);_0x32e7ef[_0x6907('0x1a')]=qs['offset'](_0x30d7a3[_0x6907('0x28')][_0x6907('0x1a')]);}_0x32e7ef[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x30d7a3[_0x6907('0x28')][_0x6907('0x32')]);_0x32e7ef[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x30d7a3[_0x6907('0x28')],_0x2ab2e4[_0x6907('0x2b')]));_0x32e7ef[_0x6907('0x35')][_0x6907('0x50')]=_0x1a2e56['id'];if(_0x30d7a3[_0x6907('0x28')]['filter']){_0x32e7ef[_0x6907('0x35')]=_[_0x6907('0x36')](_0x32e7ef[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x32e7ef['attributes'],function(_0x4f0418){var _0x45dbba={};_0x45dbba[_0x4f0418]={'$like':'%'+_0x30d7a3['query'][_0x6907('0x38')]+'%'};return _0x45dbba;})});}_0x32e7ef=_[_0x6907('0x36')]({},_0x32e7ef,_0x30d7a3[_0x6907('0x40')]);return db['CmHopperBlack'][_0x6907('0x39')]({'where':_0x32e7ef[_0x6907('0x35')]})['then'](function(_0x4d1d65){_0x3b8340[_0x6907('0x39')]=_0x4d1d65;if(_0x30d7a3[_0x6907('0x28')][_0x6907('0x3f')]){_0x32e7ef['include']=[{'all':!![]}];}return db[_0x6907('0x53')][_0x6907('0x3b')](_0x32e7ef);})['then'](function(_0x2896fa){_0x3b8340[_0x6907('0x4c')]=_0x2896fa;return _0x3b8340;});}})[_0x6907('0x20')](respondWithFilteredResult(_0x3f2650,_0x32e7ef))[_0x6907('0x3c')](handleError(_0x3f2650,null));};exports[_0x6907('0x54')]=function(_0x44ae8d,_0xcb3f90,_0x1aa878){var _0x227db6={};var _0x492af0={};var _0x1be150;var _0x11615a;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x44ae8d[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xcb3f90,null))[_0x6907('0x20')](function(_0x24a3e4){if(_0x24a3e4){_0x1be150=_0x24a3e4;_0x492af0['model']=_[_0x6907('0x27')](db['Team'][_0x6907('0x4b')]);_0x492af0[_0x6907('0x28')]=_[_0x6907('0x27')](_0x44ae8d[_0x6907('0x28')]);_0x492af0[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x492af0[_0x6907('0x2c')],_0x492af0['query']);_0x227db6[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x492af0[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x2e')]));_0x227db6[_0x6907('0x2d')]=_0x227db6[_0x6907('0x2d')][_0x6907('0x2f')]?_0x227db6[_0x6907('0x2d')]:_0x492af0[_0x6907('0x2c')];_0x227db6[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x32')]);_0x227db6[_0x6907('0x35')]=qs['filters'](_[_0x6907('0x33')](_0x44ae8d[_0x6907('0x28')],_0x492af0[_0x6907('0x2b')]));if(_0x44ae8d[_0x6907('0x28')][_0x6907('0x38')]){_0x227db6[_0x6907('0x35')]=_[_0x6907('0x36')](_0x227db6[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x227db6[_0x6907('0x2d')],function(_0x8bb280){var _0x3f0e11={};_0x3f0e11[_0x8bb280]={'$like':'%'+_0x44ae8d[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x3f0e11;})});}_0x227db6=_[_0x6907('0x36')]({},_0x227db6,_0x44ae8d[_0x6907('0x40')]);return _0x1be150[_0x6907('0x54')](_0x227db6);}})[_0x6907('0x20')](function(_0x2fb35f){if(_0x2fb35f){_0x11615a=_0x2fb35f[_0x6907('0x2f')];if(!_0x44ae8d[_0x6907('0x28')]['hasOwnProperty'](_0x6907('0x30'))){_0x227db6[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x44ae8d[_0x6907('0x28')]['limit']);_0x227db6[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x44ae8d[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x1be150[_0x6907('0x54')](_0x227db6);}})[_0x6907('0x20')](function(_0x1ee7f9){if(_0x1ee7f9){return _0x1ee7f9?{'count':_0x11615a,'rows':_0x1ee7f9}:null;}})['then'](respondWithResult(_0xcb3f90,null))[_0x6907('0x3c')](handleError(_0xcb3f90,null));};exports[_0x6907('0x55')]=function(_0x2d026d,_0x76dc56,_0x1a5d50){var _0x28484c=[];var _0x1fd5e9;return db[_0x6907('0x56')]['findAll']({'where':{'id':_0x2d026d[_0x6907('0x48')][_0x6907('0x57')]},'attributes':['id'],'include':[{'model':db[_0x6907('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6907('0x20')](function(_0x1902fd){if(_0x1902fd){for(var _0x2a1d6a=0x0;_0x2a1d6a<_0x1902fd[_0x6907('0x2f')];_0x2a1d6a+=0x1){for(var _0x67a1be=0x0;_0x67a1be<_0x1902fd[_0x2a1d6a][_0x6907('0x59')][_0x6907('0x2f')];_0x67a1be+=0x1){_0x28484c=_['union'](_0x28484c,[_0x1902fd[_0x2a1d6a][_0x6907('0x59')][_0x67a1be]['id']]);}}return _0x28484c;}})[_0x6907('0x20')](function(_0x5cd951){if(_0x5cd951){return db[_0x6907('0x26')]['find']({'where':{'id':_0x2d026d[_0x6907('0x3d')]['id']}});}})['then'](function(_0x423ad3){if(_0x423ad3){_0x1fd5e9=_0x423ad3;return _0x1fd5e9[_0x6907('0x5a')](_0x28484c,{'penalty':_0x2d026d[_0x6907('0x48')][_0x6907('0x5b')]});}})[_0x6907('0x20')](function(_0x557d1c){if(_0x557d1c){return _0x1fd5e9[_0x6907('0x55')](_0x2d026d[_0x6907('0x48')]['ids']);}})[_0x6907('0x20')](handleEntityNotFound(_0x76dc56,null))['then'](respondWithStatusCode(_0x76dc56,null))['catch'](handleError(_0x76dc56,null));};exports['removeTeams']=function(_0x11ab6b,_0x178ded,_0x3d62ea){var _0x20a8ef=[];var _0x32806c;return db[_0x6907('0x56')]['findAll']({'where':{'id':_0x11ab6b[_0x6907('0x28')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6907('0x59'),'attributes':['id'],'raw':!![]}]})[_0x6907('0x20')](function(_0x52325a){if(_0x52325a){for(var _0x4f8d3e=0x0;_0x4f8d3e<_0x52325a['length'];_0x4f8d3e+=0x1){for(var _0x2acb01=0x0;_0x2acb01<_0x52325a[_0x4f8d3e]['Agents']['length'];_0x2acb01+=0x1){_0x20a8ef=_[_0x6907('0x5c')](_0x20a8ef,[_0x52325a[_0x4f8d3e][_0x6907('0x59')][_0x2acb01]['id']]);}}return _0x20a8ef;}})[_0x6907('0x20')](function(_0x5f223d){if(_0x5f223d){return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x11ab6b[_0x6907('0x3d')]['id']}});}})['then'](function(_0x2669e1){if(_0x2669e1){_0x32806c=_0x2669e1;return _0x32806c['removeAgents'](_0x20a8ef);}})[_0x6907('0x20')](function(_0x52d69c){if(_0x32806c){return _0x32806c['removeTeams'](_0x11ab6b[_0x6907('0x28')][_0x6907('0x57')]);}})[_0x6907('0x20')](handleEntityNotFound(_0x178ded,null))[_0x6907('0x20')](respondWithStatusCode(_0x178ded,null))[_0x6907('0x3c')](handleError(_0x178ded,null));};exports['addAgents']=function(_0x305ff0,_0x5589bd,_0x3cb903){var _0x564a22,_0x29d6d3;return db['VoiceQueue']['find']({'where':{'id':_0x305ff0[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5589bd,null))[_0x6907('0x20')](function(_0x5747d4){if(_0x5747d4){_0x29d6d3=_0x5747d4;return _0x5747d4[_0x6907('0x5a')](_0x305ff0[_0x6907('0x48')]['ids'],_[_0x6907('0x45')](_0x305ff0[_0x6907('0x48')],[_0x6907('0x57'),'id'])||{})['spread'](function(_0x4b210d){for(var _0x22fdea=0x0;_0x22fdea<_0x305ff0[_0x6907('0x48')][_0x6907('0x57')][_0x6907('0x2f')];_0x22fdea+=0x1){socket['emit'](_0x6907('0x5d'),{'UserId':_0x305ff0[_0x6907('0x48')]['ids'][_0x22fdea],'VoiceQueueId':_0x305ff0[_0x6907('0x3d')]['id']});}return _0x4b210d;});}})[_0x6907('0x20')](function(_0x483709){_0x564a22=_0x483709||[];if(_0x29d6d3){return db['User'][_0x6907('0x3b')]({'where':{'id':_0x305ff0[_0x6907('0x48')][_0x6907('0x57')]},'attributes':['id',_0x6907('0x24'),_0x6907('0x5e'),_0x6907('0x5f')],'raw':!![]});}})[_0x6907('0x20')](function(_0x211d56){if(_0x211d56&&_0x211d56[_0x6907('0x2f')]){var _0x42cb1b=[];for(var _0x29a770=0x0;_0x29a770<_0x211d56['length'];_0x29a770++){_0x42cb1b['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x211d56[_0x29a770][_0x6907('0x24')],'UserId':_0x211d56[_0x29a770]['id'],'queue_name':_0x29d6d3['name'],'VoiceQueueId':_0x29d6d3['id'],'interface':util[_0x6907('0x60')](_0x6907('0x61'),'SIP',_0x211d56[_0x29a770][_0x6907('0x24')]),'paused':_0x211d56[_0x29a770]['voicePause']||![],'penalty':_0x305ff0[_0x6907('0x48')][_0x6907('0x5b')]||0x0}));}return BPromise[_0x6907('0x62')](_0x42cb1b);}})[_0x6907('0x20')](function(_0x3af2df){return _0x564a22;})['then'](respondWithResult(_0x5589bd,null))['catch'](handleError(_0x5589bd,null));};exports[_0x6907('0x63')]=function(_0x2f7569,_0xf37eaa,_0x307ea6){var _0x33b22a;return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x2f7569[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0xf37eaa,null))[_0x6907('0x20')](function(_0x3f6e4a){if(_0x3f6e4a){return _0x3f6e4a[_0x6907('0x63')](_0x2f7569[_0x6907('0x28')][_0x6907('0x57')])[_0x6907('0x20')](function(_0x4e8112){if(_['isArray'](_0x2f7569[_0x6907('0x28')][_0x6907('0x57')])){for(var _0x446b5c=0x0;_0x446b5c<_0x2f7569[_0x6907('0x28')][_0x6907('0x57')][_0x6907('0x2f')];_0x446b5c+=0x1){socket[_0x6907('0x64')](_0x6907('0x65'),{'UserId':_0x2f7569['query'][_0x6907('0x57')][_0x446b5c],'VoiceQueueId':_0x2f7569['params']['id']});}}else{socket[_0x6907('0x64')]('userVoiceQueue:remove',{'UserId':_0x2f7569[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x2f7569[_0x6907('0x3d')]['id']});}});}})[_0x6907('0x20')](function(_0x34b0c8){if(_0x2f7569[_0x6907('0x28')][_0x6907('0x66')]){_0x33b22a=_0x34b0c8;return db[_0x6907('0x67')][_0x6907('0x21')]({'where':{'VoiceQueueId':_0x2f7569[_0x6907('0x3d')]['id'],'UserId':_0x2f7569[_0x6907('0x28')][_0x6907('0x57')]}})[_0x6907('0x20')](function(){return _0x33b22a;});}})[_0x6907('0x20')](respondWithStatusCode(_0xf37eaa,null))['catch'](handleError(_0xf37eaa,null));};exports[_0x6907('0x68')]=function(_0x82c115,_0x3957f8,_0x15d9e6){var _0x9a7e2f={};var _0x40adde={};var _0x51666b;var _0x5a8e23;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x82c115['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x3957f8,null))[_0x6907('0x20')](function(_0x13eea7){if(_0x13eea7){_0x51666b=_0x13eea7;_0x40adde[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x58')][_0x6907('0x4b')]);_0x40adde[_0x6907('0x28')]=_['keys'](_0x82c115['query']);_0x40adde[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x40adde['model'],_0x40adde[_0x6907('0x28')]);_0x9a7e2f[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x40adde[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x82c115[_0x6907('0x28')][_0x6907('0x2e')]));_0x9a7e2f[_0x6907('0x2d')]=_0x9a7e2f['attributes'][_0x6907('0x2f')]?_0x9a7e2f[_0x6907('0x2d')]:_0x40adde[_0x6907('0x2c')];_0x9a7e2f[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x82c115[_0x6907('0x28')]['sort']);_0x9a7e2f[_0x6907('0x35')]=qs['filters'](_[_0x6907('0x33')](_0x82c115[_0x6907('0x28')],_0x40adde[_0x6907('0x2b')]));if(_0x82c115[_0x6907('0x28')][_0x6907('0x38')]){_0x9a7e2f[_0x6907('0x35')]=_['merge'](_0x9a7e2f[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x9a7e2f[_0x6907('0x2d')],function(_0xd4c00c){var _0x22e655={};_0x22e655[_0xd4c00c]={'$like':'%'+_0x82c115['query'][_0x6907('0x38')]+'%'};return _0x22e655;})});}_0x9a7e2f=_[_0x6907('0x36')]({},_0x9a7e2f,_0x82c115[_0x6907('0x40')]);return _0x51666b[_0x6907('0x68')](_0x9a7e2f);}})[_0x6907('0x20')](function(_0xf463c6){if(_0xf463c6){_0x5a8e23=_0xf463c6[_0x6907('0x2f')];if(!_0x82c115[_0x6907('0x28')][_0x6907('0x4f')]('nolimit')){_0x9a7e2f['limit']=qs[_0x6907('0x1b')](_0x82c115[_0x6907('0x28')]['limit']);_0x9a7e2f[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x82c115[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x51666b[_0x6907('0x68')](_0x9a7e2f);}})[_0x6907('0x20')](function(_0x78747b){if(_0x78747b){return _0x78747b?{'count':_0x5a8e23,'rows':_0x78747b}:null;}})[_0x6907('0x20')](respondWithResult(_0x3957f8,null))[_0x6907('0x3c')](handleError(_0x3957f8,null));};exports['getMembers']=function(_0x321367,_0x29c0cb,_0x959398){var _0x3b6bd2={};var _0x578930={};var _0x37b6ba;var _0x5612d5;return db['VoiceQueue'][_0x6907('0x49')]({'where':{'id':_0x321367['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x29c0cb,null))[_0x6907('0x20')](function(_0xd2fd8c){if(_0xd2fd8c){_0x37b6ba=_0xd2fd8c;_0x578930[_0x6907('0x2c')]=_['keys'](db['UserVoiceQueueRt'][_0x6907('0x4b')]);_0x578930[_0x6907('0x28')]=_[_0x6907('0x27')](_0x321367[_0x6907('0x28')]);_0x578930[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x578930[_0x6907('0x2c')],_0x578930['query']);_0x3b6bd2[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x578930[_0x6907('0x2c')],qs['fields'](_0x321367['query'][_0x6907('0x2e')]));_0x3b6bd2['attributes']=_0x3b6bd2[_0x6907('0x2d')][_0x6907('0x2f')]?_0x3b6bd2[_0x6907('0x2d')]:_0x578930[_0x6907('0x2c')];_0x3b6bd2[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x321367['query'][_0x6907('0x32')]);_0x3b6bd2[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x321367[_0x6907('0x28')],_0x578930[_0x6907('0x2b')]));if(_0x321367[_0x6907('0x28')]['filter']){_0x3b6bd2[_0x6907('0x35')]=_[_0x6907('0x36')](_0x3b6bd2[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x3b6bd2['attributes'],function(_0xd53adc){var _0x45fc5d={};_0x45fc5d[_0xd53adc]={'$like':'%'+_0x321367[_0x6907('0x28')][_0x6907('0x38')]+'%'};return _0x45fc5d;})});}_0x3b6bd2=_[_0x6907('0x36')]({},_0x3b6bd2,_0x321367['options']);return _0x37b6ba[_0x6907('0x69')](_0x3b6bd2);}})[_0x6907('0x20')](function(_0x187ea0){if(_0x187ea0){_0x5612d5=_0x187ea0[_0x6907('0x2f')];if(!_0x321367[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x3b6bd2[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x321367[_0x6907('0x28')][_0x6907('0x1b')]);_0x3b6bd2['offset']=qs[_0x6907('0x1a')](_0x321367['query'][_0x6907('0x1a')]);}return _0x37b6ba[_0x6907('0x69')](_0x3b6bd2);}})['then'](function(_0xa2d599){return _0xa2d599?{'count':_0x5612d5,'rows':_0xa2d599}:null;})['then'](respondWithResult(_0x29c0cb,null))[_0x6907('0x3c')](handleError(_0x29c0cb,null));};exports[_0x6907('0x6a')]=function(_0x4a38b1,_0x1a5678,_0x233db4){var _0x182f39={};var _0x1d00b9={};var _0x668188;var _0x11de5;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x4a38b1['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x1a5678,null))['then'](function(_0xa28785){if(_0xa28785){_0x668188=_0xa28785;_0x1d00b9[_0x6907('0x2c')]=_[_0x6907('0x27')](db[_0x6907('0x6b')][_0x6907('0x4b')]);_0x1d00b9[_0x6907('0x28')]=_[_0x6907('0x27')](_0x4a38b1[_0x6907('0x28')]);_0x1d00b9[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x1d00b9['model'],_0x1d00b9[_0x6907('0x28')]);_0x182f39['attributes']=_[_0x6907('0x3e')](_0x1d00b9[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x4a38b1[_0x6907('0x28')]['fields']));_0x182f39[_0x6907('0x2d')]=_0x182f39[_0x6907('0x2d')][_0x6907('0x2f')]?_0x182f39[_0x6907('0x2d')]:_0x1d00b9['model'];_0x182f39[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x4a38b1[_0x6907('0x28')][_0x6907('0x32')]);_0x182f39[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x4a38b1['query'],_0x1d00b9[_0x6907('0x2b')]));if(_0x4a38b1[_0x6907('0x28')][_0x6907('0x38')]){_0x182f39[_0x6907('0x35')]=_[_0x6907('0x36')](_0x182f39[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x182f39[_0x6907('0x2d')],function(_0x1826d3){var _0x1bb517={};_0x1bb517[_0x1826d3]={'$like':'%'+_0x4a38b1['query'][_0x6907('0x38')]+'%'};return _0x1bb517;})});}_0x182f39=_[_0x6907('0x36')]({},_0x182f39,_0x4a38b1[_0x6907('0x40')]);return _0x668188[_0x6907('0x6a')](_0x182f39);}})[_0x6907('0x20')](function(_0x3a4d87){if(_0x3a4d87){_0x11de5=_0x3a4d87[_0x6907('0x2f')];if(!_0x4a38b1[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x182f39[_0x6907('0x1b')]=qs[_0x6907('0x1b')](_0x4a38b1['query'][_0x6907('0x1b')]);_0x182f39[_0x6907('0x1a')]=qs['offset'](_0x4a38b1[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x668188[_0x6907('0x6a')](_0x182f39);}})[_0x6907('0x20')](function(_0x194e01){if(_0x194e01){return _0x194e01?{'count':_0x11de5,'rows':_0x194e01}:null;}})[_0x6907('0x20')](respondWithResult(_0x1a5678,null))[_0x6907('0x3c')](handleError(_0x1a5678,null));};exports[_0x6907('0x6c')]=function(_0x34b9f7,_0x56b37a,_0x31035b){var _0x40cc92,_0xe09dc7;return db[_0x6907('0x26')][_0x6907('0x43')]({'where':{'id':_0x34b9f7['params']['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x56b37a,null))[_0x6907('0x20')](function(_0x1b7c81){if(_0x1b7c81){_0xe09dc7=_0x1b7c81;return _0x1b7c81[_0x6907('0x6c')](_0x34b9f7[_0x6907('0x48')][_0x6907('0x57')],_[_0x6907('0x45')](_0x34b9f7['body'],['ids','id'])||{});}return null;})[_0x6907('0x6d')](function(_0x1ebe7f){var _0x324475;_0x40cc92=_0x1ebe7f||[];var _0x12e214=[];if(_0x1ebe7f){for(var _0x40cb48=0x0;_0x40cb48<_0x1ebe7f[_0x6907('0x2f')];_0x40cb48+=0x1){var _0x4169f3=_0x1ebe7f[_0x40cb48][_0x6907('0x44')]({'plain':!![]});_0xe09dc7['dialCheckDuplicateType']=_0x34b9f7['body'][_0x6907('0x6e')]?_0x34b9f7[_0x6907('0x48')][_0x6907('0x6e')]:_0xe09dc7[_0x6907('0x6e')];switch(_0xe09dc7['dialCheckDuplicateType']){case _0x6907('0x6f'):_0x324475=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x72'))[_0x6907('0x73')](['phone',_0x6907('0x74'),_0x6907('0x75'),_0x6907('0x76'),'VoiceQueueId',_0x6907('0x46'),'updatedAt'],squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'),_0x6907('0x79'))['field'](_0x6907('0x7a'),_0x6907('0x74'))['field']('id',_0x6907('0x75'))[_0x6907('0x78')](_0x4169f3[_0x6907('0x7b')]['toString'](),_0x6907('0x76'))[_0x6907('0x78')](_0x34b9f7['params']['id'][_0x6907('0x7c')](),'VoiceQueueId')[_0x6907('0x78')](_0x6907('0x7a'),'createdAt')[_0x6907('0x78')]('NOW()','updatedAt')['from'](_0x6907('0x7d'))['where'](_0x6907('0x7e'))[_0x6907('0x35')](_0x6907('0x7f'),_0x4169f3[_0x6907('0x7b')][_0x6907('0x7c')]())[_0x6907('0x35')](_0x6907('0x80'))[_0x6907('0x35')](_0x6907('0x81'),squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x82'))['from'](_0x6907('0x83'))[_0x6907('0x35')](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]()))[_0x6907('0x35')](_0x6907('0x81'),squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'))[_0x6907('0x85')](_0x6907('0x72'))[_0x6907('0x35')](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]())))[_0x6907('0x7c')]();break;case _0x6907('0x86'):_0x324475=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x72'))['fromQuery']([_0x6907('0x79'),'scheduledAt',_0x6907('0x75'),'ListId',_0x6907('0x50'),_0x6907('0x46'),'updatedAt'],squel['select']()[_0x6907('0x78')](_0x6907('0x79'),'phone')[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x74'))[_0x6907('0x78')]('id',_0x6907('0x75'))['field'](_0x4169f3[_0x6907('0x7b')][_0x6907('0x7c')](),_0x6907('0x76'))[_0x6907('0x78')](_0x34b9f7[_0x6907('0x3d')]['id']['toString'](),_0x6907('0x50'))[_0x6907('0x78')]('NOW()',_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x47'))[_0x6907('0x85')](_0x6907('0x7d'))[_0x6907('0x35')]('deletedAt\x20IS\x20NULL')['where'](_0x6907('0x7f'),_0x4169f3[_0x6907('0x7b')]['toString']())[_0x6907('0x35')](_0x6907('0x80'))[_0x6907('0x35')]('phone\x20NOT\x20IN\x20(?)',squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'))[_0x6907('0x85')](_0x6907('0x72'))['where'](_0x6907('0x84'),_0x34b9f7[_0x6907('0x3d')]['id'][_0x6907('0x7c')]())))[_0x6907('0x7c')]();break;default:_0x324475=squel['insert']()[_0x6907('0x71')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x6907('0x75'),_0x6907('0x76'),_0x6907('0x50'),_0x6907('0x46'),_0x6907('0x47')],squel[_0x6907('0x77')]()[_0x6907('0x78')](_0x6907('0x79'),_0x6907('0x79'))[_0x6907('0x78')]('NOW()',_0x6907('0x74'))[_0x6907('0x78')]('id','ContactId')[_0x6907('0x78')](_0x4169f3['CmListId'][_0x6907('0x7c')](),'ListId')['field'](_0x34b9f7[_0x6907('0x3d')]['id']['toString'](),_0x6907('0x50'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),'updatedAt')[_0x6907('0x85')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0x6907('0x7f'),_0x4169f3['CmListId']['toString']())[_0x6907('0x35')](_0x6907('0x80')))['toString']();}_0x12e214[_0x6907('0x87')](db[_0x6907('0x88')][_0x6907('0x28')](_0x324475));}return BPromise['all'](_0x12e214);}})[_0x6907('0x20')](function(){return _0x40cc92;})[_0x6907('0x20')](respondWithResult(_0x56b37a,null))['catch'](handleError(_0x56b37a,null));};exports['removeLists']=function(_0x40865a,_0x469ab1,_0x5d6057){var _0x163a91;return db[_0x6907('0x26')]['find']({'where':{'id':_0x40865a[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x469ab1,null))[_0x6907('0x20')](function(_0x2eda5d){if(_0x2eda5d){return _0x2eda5d[_0x6907('0x89')](_0x40865a[_0x6907('0x28')]['ids']);}})[_0x6907('0x20')](function(_0x39884a){if(_0x39884a){_0x163a91=_0x39884a;return db['CmHopper'][_0x6907('0x21')]({'where':{'ListId':_0x40865a[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x40865a[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](function(){return _0x163a91;});}})[_0x6907('0x20')](respondWithStatusCode(_0x469ab1,null))['catch'](handleError(_0x469ab1,null));};exports['getBlackLists']=function(_0x27a06d,_0x2feba3,_0x466f2f){var _0x4177fa={};var _0x193d98={};var _0x45c59e;var _0x489a57;return db[_0x6907('0x26')][_0x6907('0x49')]({'where':{'id':_0x27a06d[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x2feba3,null))[_0x6907('0x20')](function(_0x37b4d4){if(_0x37b4d4){_0x45c59e=_0x37b4d4;_0x193d98['model']=_[_0x6907('0x27')](db['CmList'][_0x6907('0x4b')]);_0x193d98[_0x6907('0x28')]=_[_0x6907('0x27')](_0x27a06d[_0x6907('0x28')]);_0x193d98[_0x6907('0x2b')]=_[_0x6907('0x3e')](_0x193d98[_0x6907('0x2c')],_0x193d98[_0x6907('0x28')]);_0x4177fa[_0x6907('0x2d')]=_[_0x6907('0x3e')](_0x193d98[_0x6907('0x2c')],qs[_0x6907('0x2e')](_0x27a06d[_0x6907('0x28')]['fields']));_0x4177fa['attributes']=_0x4177fa['attributes']['length']?_0x4177fa[_0x6907('0x2d')]:_0x193d98[_0x6907('0x2c')];_0x4177fa[_0x6907('0x31')]=qs[_0x6907('0x32')](_0x27a06d['query']['sort']);_0x4177fa[_0x6907('0x35')]=qs[_0x6907('0x2b')](_[_0x6907('0x33')](_0x27a06d[_0x6907('0x28')],_0x193d98[_0x6907('0x2b')]));if(_0x27a06d[_0x6907('0x28')]['filter']){_0x4177fa[_0x6907('0x35')]=_[_0x6907('0x36')](_0x4177fa[_0x6907('0x35')],{'$or':_[_0x6907('0x37')](_0x4177fa['attributes'],function(_0x38f08d){var _0x3396ed={};_0x3396ed[_0x38f08d]={'$like':'%'+_0x27a06d['query'][_0x6907('0x38')]+'%'};return _0x3396ed;})});}_0x4177fa=_['merge']({},_0x4177fa,_0x27a06d[_0x6907('0x40')]);return _0x45c59e[_0x6907('0x8a')](_0x4177fa);}})['then'](function(_0xcb5670){if(_0xcb5670){_0x489a57=_0xcb5670[_0x6907('0x2f')];if(!_0x27a06d[_0x6907('0x28')][_0x6907('0x4f')](_0x6907('0x30'))){_0x4177fa[_0x6907('0x1b')]=qs['limit'](_0x27a06d[_0x6907('0x28')][_0x6907('0x1b')]);_0x4177fa[_0x6907('0x1a')]=qs[_0x6907('0x1a')](_0x27a06d[_0x6907('0x28')][_0x6907('0x1a')]);}return _0x45c59e[_0x6907('0x8a')](_0x4177fa);}})[_0x6907('0x20')](function(_0x118792){if(_0x118792){return _0x118792?{'count':_0x489a57,'rows':_0x118792}:null;}})[_0x6907('0x20')](respondWithResult(_0x2feba3,null))['catch'](handleError(_0x2feba3,null));};exports[_0x6907('0x8b')]=function(_0x3e3309,_0x47bbe3,_0x3d1dbb){var _0x29aee8,_0x270833;return db['VoiceQueue'][_0x6907('0x43')]({'where':{'id':_0x3e3309[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](handleEntityNotFound(_0x47bbe3,null))[_0x6907('0x20')](function(_0x238337){if(_0x238337){_0x270833=_0x238337;return _0x238337['addBlackLists'](_0x3e3309[_0x6907('0x48')][_0x6907('0x57')],_['omit'](_0x3e3309[_0x6907('0x48')],['ids','id'])||{});}return null;})[_0x6907('0x6d')](function(_0x1bcfbe){var _0x2fda9e;_0x29aee8=_0x1bcfbe||[];var _0x3e89cd=[];if(_0x1bcfbe){for(var _0x15eda0=0x0;_0x15eda0<_0x1bcfbe[_0x6907('0x2f')];_0x15eda0+=0x1){var _0x2947dd=_0x1bcfbe[_0x15eda0][_0x6907('0x44')]({'plain':!![]});_0x2fda9e=squel[_0x6907('0x70')]()[_0x6907('0x71')](_0x6907('0x8c'))[_0x6907('0x73')]([_0x6907('0x79'),_0x6907('0x75'),_0x6907('0x76'),'VoiceQueueId',_0x6907('0x46'),_0x6907('0x47')],squel[_0x6907('0x77')]()['field'](_0x6907('0x79'),_0x6907('0x79'))[_0x6907('0x78')]('id',_0x6907('0x75'))[_0x6907('0x78')](_0x2947dd[_0x6907('0x7b')]['toString'](),_0x6907('0x76'))['field'](_0x3e3309[_0x6907('0x3d')]['id'][_0x6907('0x7c')](),'VoiceQueueId')[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x46'))[_0x6907('0x78')](_0x6907('0x7a'),_0x6907('0x47'))[_0x6907('0x85')](_0x6907('0x7d'))[_0x6907('0x35')](_0x6907('0x7e'))[_0x6907('0x35')]('ListId\x20=\x20?',_0x2947dd[_0x6907('0x7b')]['toString']())[_0x6907('0x35')]('phone\x20IS\x20NOT\x20NULL'))[_0x6907('0x7c')]();_0x3e89cd[_0x6907('0x87')](db['sequelize'][_0x6907('0x28')](_0x2fda9e));}return BPromise['all'](_0x3e89cd);}})['then'](function(){return _0x29aee8;})['then'](respondWithResult(_0x47bbe3,null))[_0x6907('0x3c')](handleError(_0x47bbe3,null));};exports[_0x6907('0x8d')]=function(_0x12b52e,_0x2719c0,_0x386c97){var _0x775b79;return db[_0x6907('0x26')]['find']({'where':{'id':_0x12b52e[_0x6907('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2719c0,null))['then'](function(_0x5bbeaf){if(_0x5bbeaf){return _0x5bbeaf[_0x6907('0x8d')](_0x12b52e[_0x6907('0x28')][_0x6907('0x57')]);}})[_0x6907('0x20')](function(_0x25b9e1){if(_0x25b9e1){_0x775b79=_0x25b9e1;return db[_0x6907('0x53')][_0x6907('0x21')]({'where':{'ListId':_0x12b52e[_0x6907('0x28')][_0x6907('0x57')],'VoiceQueueId':_0x12b52e[_0x6907('0x3d')]['id']}})[_0x6907('0x20')](function(){return _0x775b79;});}})[_0x6907('0x20')](respondWithStatusCode(_0x2719c0,null))[_0x6907('0x3c')](handleError(_0x2719c0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 10105da..e1c5a3c 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 _0x13c0=['hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners','emit'];(function(_0x3b10de,_0x3bb7e4){var _0x461407=function(_0x1279d4){while(--_0x1279d4){_0x3b10de['push'](_0x3b10de['shift']());}};_0x461407(++_0x3bb7e4);}(_0x13c0,0x79));var _0x013c=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0x13c0[_0x16051a];return _0x35d20d;};'use strict';var EventEmitter=require(_0x013c('0x0'));var VoiceQueue=require(_0x013c('0x1'))['db'][_0x013c('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x013c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17ae19){return function(_0x70a468,_0x22fb4b,_0x2c5853){VoiceQueueEvents[_0x013c('0x4')](_0x17ae19+':'+_0x70a468['id'],_0x70a468);VoiceQueueEvents[_0x013c('0x4')](_0x17ae19,_0x70a468);_0x2c5853(null);};}for(var e in events){if(events[_0x013c('0x5')](e)){var event=events[e];VoiceQueue[_0x013c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0xad95=['events','../../mysqldb','VoiceQueue','update','remove','hook','exports'];(function(_0x3e32a8,_0x255953){var _0x2997b0=function(_0x2d564a){while(--_0x2d564a){_0x3e32a8['push'](_0x3e32a8['shift']());}};_0x2997b0(++_0x255953);}(_0xad95,0x70));var _0x5ad9=function(_0x5c0db6,_0x2b0800){_0x5c0db6=_0x5c0db6-0x0;var _0x2ee691=_0xad95[_0x5c0db6];return _0x2ee691;};'use strict';var EventEmitter=require(_0x5ad9('0x0'));var VoiceQueue=require(_0x5ad9('0x1'))['db'][_0x5ad9('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5ad9('0x3'),'afterDestroy':_0x5ad9('0x4')};function emitEvent(_0x59809d){return function(_0x5c9fd6,_0x185bff,_0x5277fa){VoiceQueueEvents['emit'](_0x59809d+':'+_0x5c9fd6['id'],_0x5c9fd6);VoiceQueueEvents['emit'](_0x59809d,_0x5c9fd6);_0x5277fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5ad9('0x5')](e,emitEvent(event));}}module[_0x5ad9('0x6')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index f94f2ac..c8fd185 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 _0x28f8=['./voiceQueue.attributes','define','VoiceQueue','voice_queues','lodash','api','moment','bluebird','request-promise'];(function(_0x30deaa,_0x5371c1){var _0xc205f8=function(_0x37940e){while(--_0x37940e){_0x30deaa['push'](_0x30deaa['shift']());}};_0xc205f8(++_0x5371c1);}(_0x28f8,0x124));var _0x828f=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x28f8[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0x828f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x828f('0x1'));var moment=require(_0x828f('0x2'));var BPromise=require(_0x828f('0x3'));var rp=require(_0x828f('0x4'));var attributes=require(_0x828f('0x5'));module['exports']=function(_0x4d1ec0,_0x15131f){return _0x4d1ec0[_0x828f('0x6')](_0x828f('0x7'),attributes,{'tableName':_0x828f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3923=['../../config/logger','moment','request-promise','exports','define','VoiceQueue','util'];(function(_0x24dbf0,_0x4a696c){var _0x2af377=function(_0x1daec4){while(--_0x1daec4){_0x24dbf0['push'](_0x24dbf0['shift']());}};_0x2af377(++_0x4a696c);}(_0x3923,0xb5));var _0x3392=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x3923[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x3392('0x0'));var logger=require(_0x3392('0x1'))('api');var moment=require(_0x3392('0x2'));var BPromise=require('bluebird');var rp=require(_0x3392('0x3'));var attributes=require('./voiceQueue.attributes');module[_0x3392('0x4')]=function(_0x4a9b37,_0x1f7917){return _0x4a9b37[_0x3392('0x5')](_0x3392('0x6'),attributes,{'tableName':'voice_queues','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 9071273..74b8585 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 _0x4819=['debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetVoiceQueue','ShowVoiceQueue','find','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x3f0aca,_0x7acc97){var _0xf7969b=function(_0x30228a){while(--_0x30228a){_0x3f0aca['push'](_0x3f0aca['shift']());}};_0xf7969b(++_0x7acc97);}(_0x4819,0xcd));var _0x9481=function(_0x36bf88,_0x15c459){_0x36bf88=_0x36bf88-0x0;var _0x332914=_0x4819[_0x36bf88];return _0x332914;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var moment=require(_0x9481('0x1'));var BPromise=require(_0x9481('0x2'));var rs=require(_0x9481('0x3'));var fs=require('fs');var db=require(_0x9481('0x4'))['db'];var utils=require(_0x9481('0x5'));var logger=require(_0x9481('0x6'))(_0x9481('0x7'));var config=require(_0x9481('0x8'));var jayson=require(_0x9481('0x9'));var client=jayson['client'][_0x9481('0xa')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x9481('0xb'))[_0x9481('0xc')](socket);function respondWithRpcPromise(_0x27c033,_0x3278ff,_0x15d895){return new BPromise(function(_0x4c7d9c,_0x1818cf){return client['request'](_0x27c033,_0x15d895)[_0x9481('0xd')](function(_0x564d5b){logger[_0x9481('0xe')](_0x9481('0xf'),_0x3278ff,_0x9481('0x10'));logger[_0x9481('0x11')](_0x9481('0x12'),_0x3278ff,_0x9481('0x10'),JSON[_0x9481('0x13')](_0x564d5b));if(_0x564d5b[_0x9481('0x14')]){if(_0x564d5b[_0x9481('0x14')]['code']===0x1f4){logger['error'](_0x9481('0xf'),_0x3278ff,_0x564d5b[_0x9481('0x14')][_0x9481('0x15')]);return _0x1818cf(_0x564d5b[_0x9481('0x14')][_0x9481('0x15')]);}logger[_0x9481('0x14')](_0x9481('0xf'),_0x3278ff,_0x564d5b['error'][_0x9481('0x15')]);return _0x4c7d9c(_0x564d5b[_0x9481('0x14')]['message']);}else{logger[_0x9481('0xe')]('VoiceQueue,\x20%s,\x20%s',_0x3278ff,_0x9481('0x10'));_0x4c7d9c(_0x564d5b[_0x9481('0x16')][_0x9481('0x15')]);}})[_0x9481('0x17')](function(_0x546fce){logger['error'](_0x9481('0xf'),_0x3278ff,_0x546fce);_0x1818cf(_0x546fce);});});}exports['GetVoiceQueue']=function(_0x4d0da7){var _0x26671c=this;return new Promise(function(_0x33e32b,_0x18c6f5){return db[_0x9481('0x18')][_0x9481('0x19')]({'raw':_0x4d0da7[_0x9481('0x1a')]?_0x4d0da7['options'][_0x9481('0x1b')]===undefined?!![]:![]:!![],'where':_0x4d0da7[_0x9481('0x1a')]?_0x4d0da7[_0x9481('0x1a')][_0x9481('0x1c')]||null:null,'attributes':_0x4d0da7[_0x9481('0x1a')]?_0x4d0da7['options'][_0x9481('0x1d')]||null:null,'limit':_0x4d0da7[_0x9481('0x1a')]?_0x4d0da7['options'][_0x9481('0x1e')]||null:null,'include':_0x4d0da7[_0x9481('0x1a')]?_0x4d0da7[_0x9481('0x1a')][_0x9481('0x1f')]?_[_0x9481('0x20')](_0x4d0da7['options'][_0x9481('0x1f')],function(_0x22f0b5){return{'model':db[_0x22f0b5['model']],'as':_0x22f0b5['as'],'attributes':_0x22f0b5['attributes'],'include':_0x22f0b5[_0x9481('0x1f')]?_[_0x9481('0x20')](_0x22f0b5['include'],function(_0x1e6f28){return{'model':db[_0x1e6f28[_0x9481('0x21')]],'as':_0x1e6f28['as'],'attributes':_0x1e6f28[_0x9481('0x1d')],'include':_0x1e6f28[_0x9481('0x1f')]?_['map'](_0x1e6f28[_0x9481('0x1f')],function(_0x3ca064){return{'model':db[_0x3ca064[_0x9481('0x21')]],'as':_0x3ca064['as'],'attributes':_0x3ca064['attributes']};}):[]};}):[]};}):[]:[]})[_0x9481('0xd')](function(_0x56e944){logger[_0x9481('0xe')](_0x9481('0x22'),_0x4d0da7);logger[_0x9481('0x11')](_0x9481('0x22'),_0x4d0da7,JSON[_0x9481('0x13')](_0x56e944));_0x33e32b(_0x56e944);})['catch'](function(_0x2aa9ff){logger[_0x9481('0x14')](_0x9481('0x22'),_0x2aa9ff['message'],_0x4d0da7);_0x18c6f5(_0x26671c['error'](0x1f4,_0x2aa9ff[_0x9481('0x15')]));});});};exports[_0x9481('0x23')]=function(_0x42df68){var _0x2b33f8=this;return new Promise(function(_0x5d9926,_0x5163e3){return db['VoiceQueue'][_0x9481('0x24')]({'raw':_0x42df68['options']?_0x42df68[_0x9481('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x42df68[_0x9481('0x1a')]?_0x42df68[_0x9481('0x1a')][_0x9481('0x1c')]||null:null,'attributes':_0x42df68[_0x9481('0x1a')]?_0x42df68[_0x9481('0x1a')]['attributes']||null:null,'include':_0x42df68[_0x9481('0x1a')]?_0x42df68[_0x9481('0x1a')][_0x9481('0x1f')]?_['map'](_0x42df68[_0x9481('0x1a')][_0x9481('0x1f')],function(_0x38d114){return{'model':db[_0x38d114[_0x9481('0x21')]],'as':_0x38d114['as'],'attributes':_0x38d114[_0x9481('0x1d')],'include':_0x38d114[_0x9481('0x1f')]?_['map'](_0x38d114[_0x9481('0x1f')],function(_0x53af85){return{'model':db[_0x53af85[_0x9481('0x21')]],'as':_0x53af85['as'],'attributes':_0x53af85[_0x9481('0x1d')],'include':_0x53af85[_0x9481('0x1f')]?_[_0x9481('0x20')](_0x53af85[_0x9481('0x1f')],function(_0x2face9){return{'model':db[_0x2face9['model']],'as':_0x2face9['as'],'attributes':_0x2face9[_0x9481('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9481('0xd')](function(_0x4ed991){logger['info'](_0x9481('0x23'),_0x42df68);logger['debug'](_0x9481('0x23'),_0x42df68,JSON[_0x9481('0x13')](_0x4ed991));_0x5d9926(_0x4ed991);})[_0x9481('0x17')](function(_0x2a1bcf){logger['error'](_0x9481('0x23'),_0x2a1bcf['message'],_0x42df68);_0x5163e3(_0x2b33f8[_0x9481('0x14')](0x1f4,_0x2a1bcf['message']));});});}; \ No newline at end of file +var _0xd117=['localhost','./voiceQueue.socket','request','then','info','debug','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','findAll','options','raw','where','attributes','include','map','model','GetVoiceQueue','VoiceQueue','find','ShowVoiceQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd117,0x182));var _0x7d11=function(_0x14bf63,_0xdbd373){_0x14bf63=_0x14bf63-0x0;var _0x410d22=_0xd117[_0x14bf63];return _0x410d22;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var db=require(_0x7d11('0x5'))['db'];var utils=require(_0x7d11('0x6'));var logger=require(_0x7d11('0x7'))(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var jayson=require(_0x7d11('0xa'));var client=jayson[_0x7d11('0xb')][_0x7d11('0xc')]({'port':0x232a});var socket=require(_0x7d11('0xd'))({'host':_0x7d11('0xe'),'port':0x18eb});require(_0x7d11('0xf'))['register'](socket);function respondWithRpcPromise(_0x3803b5,_0xffd020,_0x2007c1){return new BPromise(function(_0x5bdf01,_0x305eef){return client[_0x7d11('0x10')](_0x3803b5,_0x2007c1)[_0x7d11('0x11')](function(_0x4ed7ae){logger[_0x7d11('0x12')]('VoiceQueue,\x20%s,\x20%s',_0xffd020,'request\x20sent');logger[_0x7d11('0x13')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xffd020,'request\x20sent',JSON[_0x7d11('0x14')](_0x4ed7ae));if(_0x4ed7ae['error']){if(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x16')]===0x1f4){logger['error'](_0x7d11('0x17'),_0xffd020,_0x4ed7ae[_0x7d11('0x15')]['message']);return _0x305eef(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);}logger[_0x7d11('0x15')](_0x7d11('0x17'),_0xffd020,_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);return _0x5bdf01(_0x4ed7ae[_0x7d11('0x15')][_0x7d11('0x18')]);}else{logger['info'](_0x7d11('0x17'),_0xffd020,_0x7d11('0x19'));_0x5bdf01(_0x4ed7ae[_0x7d11('0x1a')][_0x7d11('0x18')]);}})[_0x7d11('0x1b')](function(_0x528fdc){logger[_0x7d11('0x15')](_0x7d11('0x17'),_0xffd020,_0x528fdc);_0x305eef(_0x528fdc);});});}exports['GetVoiceQueue']=function(_0x5459df){var _0x2ca3a2=this;return new Promise(function(_0x52a6ae,_0x1f9990){return db['VoiceQueue'][_0x7d11('0x1c')]({'raw':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x1e')]===undefined?!![]:![]:!![],'where':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x1f')]||null:null,'attributes':_0x5459df[_0x7d11('0x1d')]?_0x5459df['options'][_0x7d11('0x20')]||null:null,'limit':_0x5459df['options']?_0x5459df['options']['limit']||null:null,'include':_0x5459df[_0x7d11('0x1d')]?_0x5459df[_0x7d11('0x1d')][_0x7d11('0x21')]?_[_0x7d11('0x22')](_0x5459df[_0x7d11('0x1d')][_0x7d11('0x21')],function(_0x282e5c){return{'model':db[_0x282e5c[_0x7d11('0x23')]],'as':_0x282e5c['as'],'attributes':_0x282e5c['attributes'],'include':_0x282e5c[_0x7d11('0x21')]?_['map'](_0x282e5c['include'],function(_0x5126cf){return{'model':db[_0x5126cf[_0x7d11('0x23')]],'as':_0x5126cf['as'],'attributes':_0x5126cf['attributes'],'include':_0x5126cf[_0x7d11('0x21')]?_[_0x7d11('0x22')](_0x5126cf[_0x7d11('0x21')],function(_0x47c794){return{'model':db[_0x47c794[_0x7d11('0x23')]],'as':_0x47c794['as'],'attributes':_0x47c794[_0x7d11('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x11')](function(_0x5d38dd){logger[_0x7d11('0x12')](_0x7d11('0x24'),_0x5459df);logger[_0x7d11('0x13')](_0x7d11('0x24'),_0x5459df,JSON['stringify'](_0x5d38dd));_0x52a6ae(_0x5d38dd);})[_0x7d11('0x1b')](function(_0x512f7f){logger[_0x7d11('0x15')]('GetVoiceQueue',_0x512f7f[_0x7d11('0x18')],_0x5459df);_0x1f9990(_0x2ca3a2[_0x7d11('0x15')](0x1f4,_0x512f7f[_0x7d11('0x18')]));});});};exports['ShowVoiceQueue']=function(_0x5e721f){var _0x8e0a53=this;return new Promise(function(_0x1ed210,_0x5d540e){return db[_0x7d11('0x25')][_0x7d11('0x26')]({'raw':_0x5e721f[_0x7d11('0x1d')]?_0x5e721f['options'][_0x7d11('0x1e')]===undefined?!![]:![]:!![],'where':_0x5e721f['options']?_0x5e721f['options'][_0x7d11('0x1f')]||null:null,'attributes':_0x5e721f['options']?_0x5e721f[_0x7d11('0x1d')][_0x7d11('0x20')]||null:null,'include':_0x5e721f[_0x7d11('0x1d')]?_0x5e721f[_0x7d11('0x1d')]['include']?_[_0x7d11('0x22')](_0x5e721f[_0x7d11('0x1d')]['include'],function(_0x57aa8a){return{'model':db[_0x57aa8a[_0x7d11('0x23')]],'as':_0x57aa8a['as'],'attributes':_0x57aa8a[_0x7d11('0x20')],'include':_0x57aa8a['include']?_[_0x7d11('0x22')](_0x57aa8a['include'],function(_0x5c0113){return{'model':db[_0x5c0113[_0x7d11('0x23')]],'as':_0x5c0113['as'],'attributes':_0x5c0113['attributes'],'include':_0x5c0113['include']?_[_0x7d11('0x22')](_0x5c0113[_0x7d11('0x21')],function(_0x1b96d8){return{'model':db[_0x1b96d8[_0x7d11('0x23')]],'as':_0x1b96d8['as'],'attributes':_0x1b96d8[_0x7d11('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7d11('0x11')](function(_0x7c9516){logger[_0x7d11('0x12')](_0x7d11('0x27'),_0x5e721f);logger[_0x7d11('0x13')](_0x7d11('0x27'),_0x5e721f,JSON[_0x7d11('0x14')](_0x7c9516));_0x1ed210(_0x7c9516);})['catch'](function(_0x157731){logger['error'](_0x7d11('0x27'),_0x157731[_0x7d11('0x18')],_0x5e721f);_0x5d540e(_0x8e0a53[_0x7d11('0x15')](0x1f4,_0x157731[_0x7d11('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index bafb5d9..c15b932 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 _0xaef6=['update','emit','removeListener','length','./voiceQueue.events','save'];(function(_0x5c811c,_0x313b25){var _0x5df3af=function(_0x3460de){while(--_0x3460de){_0x5c811c['push'](_0x5c811c['shift']());}};_0x5df3af(++_0x313b25);}(_0xaef6,0x154));var _0x6aef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaef6[_0x20a584];return _0x4b41a8;};'use strict';var VoiceQueueEvents=require(_0x6aef('0x0'));var events=[_0x6aef('0x1'),'remove',_0x6aef('0x2')];function createListener(_0x5eac79,_0x237fde){return function(_0x32d2ed){_0x237fde[_0x6aef('0x3')](_0x5eac79,_0x32d2ed);};}function removeListener(_0x18b7ba,_0x5256f0){return function(){VoiceQueueEvents[_0x6aef('0x4')](_0x18b7ba,_0x5256f0);};}exports['register']=function(_0x50a7bd){for(var _0x52c58a=0x0,_0x178658=events[_0x6aef('0x5')];_0x52c58a<_0x178658;_0x52c58a++){var _0x44ba3d=events[_0x52c58a];var _0x1a0d80=createListener('voiceQueue:'+_0x44ba3d,_0x50a7bd);VoiceQueueEvents['on'](_0x44ba3d,_0x1a0d80);}}; \ No newline at end of file +var _0x3e60=['removeListener','voiceQueue:','./voiceQueue.events','save','remove','emit'];(function(_0x4d912e,_0x17f847){var _0x53ad55=function(_0x2a5166){while(--_0x2a5166){_0x4d912e['push'](_0x4d912e['shift']());}};_0x53ad55(++_0x17f847);}(_0x3e60,0x1be));var _0x03e6=function(_0x34ad72,_0x1e43f6){_0x34ad72=_0x34ad72-0x0;var _0x5c9aa8=_0x3e60[_0x34ad72];return _0x5c9aa8;};'use strict';var VoiceQueueEvents=require(_0x03e6('0x0'));var events=[_0x03e6('0x1'),_0x03e6('0x2'),'update'];function createListener(_0x12e0e6,_0x36b7c){return function(_0x10bfa6){_0x36b7c[_0x03e6('0x3')](_0x12e0e6,_0x10bfa6);};}function removeListener(_0x5cecf3,_0x334340){return function(){VoiceQueueEvents[_0x03e6('0x4')](_0x5cecf3,_0x334340);};}exports['register']=function(_0x54257a){for(var _0x58d58e=0x0,_0xdf6dc4=events['length'];_0x58d58e<_0xdf6dc4;_0x58d58e++){var _0x21f4b4=events[_0x58d58e];var _0x2c0da7=createListener(_0x03e6('0x5')+_0x21f4b4,_0x54257a);VoiceQueueEvents['on'](_0x21f4b4,_0x2c0da7);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2315fd6..70c2928 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 _0x4213=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','post','create','put'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x4213,0x77));var _0x3421=function(_0x4761c2,_0x1efae3){_0x4761c2=_0x4761c2-0x0;var _0x547374=_0x4213[_0x4761c2];return _0x547374;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var express=require(_0x3421('0x3'));var router=express[_0x3421('0x4')]();var auth=require(_0x3421('0x5'));var interaction=require(_0x3421('0x6'));var config=require('../../config/environment');var controller=require(_0x3421('0x7'));router['get']('/',auth[_0x3421('0x8')](),controller[_0x3421('0x9')]);router[_0x3421('0xa')](_0x3421('0xb'),auth['isAuthenticated'](),controller[_0x3421('0xc')]);router[_0x3421('0xa')](_0x3421('0xd'),auth[_0x3421('0x8')](),controller[_0x3421('0xe')]);router['get'](_0x3421('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x3421('0x10')]('/',auth['isAuthenticated'](),controller[_0x3421('0x11')]);router[_0x3421('0x12')](_0x3421('0xf'),auth[_0x3421('0x8')](),controller[_0x3421('0x13')]);router[_0x3421('0x14')](_0x3421('0xf'),auth['isAuthenticated'](),controller[_0x3421('0x15')]);module[_0x3421('0x16')]=router; \ No newline at end of file +var _0x5f2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/index','getVoiceQueuesReport','/:id','show','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x4b5039,_0x23b033){var _0x597f29=function(_0x34465e){while(--_0x34465e){_0x4b5039['push'](_0x4b5039['shift']());}};_0x597f29(++_0x23b033);}(_0x5f2f,0x73));var _0xf5f2=function(_0x36ae06,_0x57da2d){_0x36ae06=_0x36ae06-0x0;var _0x25ffc7=_0x5f2f[_0x36ae06];return _0x25ffc7;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var express=require(_0xf5f2('0x3'));var router=express[_0xf5f2('0x4')]();var auth=require(_0xf5f2('0x5'));var interaction=require(_0xf5f2('0x6'));var config=require(_0xf5f2('0x7'));var controller=require('./voiceQueueReport.controller');router['get']('/',auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xc')]);router['get'](_0xf5f2('0xd'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0xe')]);router['get'](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x10')]);router['post']('/',auth[_0xf5f2('0x8')](),controller['create']);router['put'](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller['update']);router[_0xf5f2('0x11')](_0xf5f2('0xf'),auth[_0xf5f2('0x8')](),controller[_0xf5f2('0x12')]);module[_0xf5f2('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 2a2be56..cff4729 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 _0x572d=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue'];(function(_0x10aa73,_0xc744f4){var _0x3496d9=function(_0x71c780){while(--_0x71c780){_0x10aa73['push'](_0x10aa73['shift']());}};_0x3496d9(++_0xc744f4);}(_0x572d,0x9a));var _0xd572=function(_0x5d4f12,_0x11e67c){_0x5d4f12=_0x5d4f12-0x0;var _0x4eb577=_0x572d[_0x5d4f12];return _0x4eb577;};'use strict';var Sequelize=require(_0xd572('0x0'));var moment=require(_0xd572('0x1'));module[_0xd572('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd572('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd572('0x3')]},'queue':{'type':Sequelize[_0xd572('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xd572('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xd572('0x4')],'set':function(_0x1e2285){var _0x309e36=moment(_0x1e2285);var _0x1e75c1=moment(this['getDataValue'](_0xd572('0x5')))[_0xd572('0x6')](_0xd572('0x7'));var _0x509058=_0x309e36['diff'](_0x1e75c1,_0xd572('0x8'));this['setDataValue'](_0xd572('0x9'),_0x1e2285);this[_0xd572('0xa')]('holdtime',_0x509058||null);}},'position':{'type':Sequelize[_0xd572('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0xd572('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xd572('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xd572('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xd572('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xd572('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd572('0x3')]},'connectedlinename':{'type':Sequelize[_0xd572('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xd572('0x3')]},'priority':{'type':Sequelize[_0xd572('0x3')]},'holdtime':{'type':Sequelize[_0xd572('0xb')]},'mohtime':{'type':Sequelize[_0xd572('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd572('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xd572('0x3')]},'transfer':{'type':Sequelize[_0xd572('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xd572('0xe')},'transferexten':{'type':Sequelize[_0xd572('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xd572('0x3')]}}; \ No newline at end of file +var _0xf36a=['STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports'];(function(_0x4e90e3,_0x570a1d){var _0x295e5b=function(_0x754043){while(--_0x754043){_0x4e90e3['push'](_0x4e90e3['shift']());}};_0x295e5b(++_0x570a1d);}(_0xf36a,0xb1));var _0xaf36=function(_0x144fb4,_0x2ce4d0){_0x144fb4=_0x144fb4-0x0;var _0x5cdb1d=_0xf36a[_0x144fb4];return _0x5cdb1d;};'use strict';var Sequelize=require(_0xaf36('0x0'));var moment=require(_0xaf36('0x1'));module[_0xaf36('0x2')]={'type':{'type':Sequelize[_0xaf36('0x3')]},'uniqueid':{'type':Sequelize[_0xaf36('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xaf36('0x3')]},'queue':{'type':Sequelize[_0xaf36('0x3')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0xaf36('0x4')],'set':function(_0x299e25){var _0x3d8534=moment(_0x299e25);var _0x238a47=moment(this[_0xaf36('0x5')](_0xaf36('0x6')))[_0xaf36('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x3442ca=_0x3d8534[_0xaf36('0x8')](_0x238a47,_0xaf36('0x9'));this[_0xaf36('0xa')]('queuecallerleaveAt',_0x299e25);this[_0xaf36('0xa')](_0xaf36('0xb'),_0x3442ca||null);}},'position':{'type':Sequelize[_0xaf36('0xc')]},'count':{'type':Sequelize[_0xaf36('0xc')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallerexit':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xaf36('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xaf36('0x3')],'comment':_0xaf36('0xe')},'originalposition':{'type':Sequelize[_0xaf36('0xc')]},'channel':{'type':Sequelize[_0xaf36('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xaf36('0x3')]},'context':{'type':Sequelize[_0xaf36('0x3')]},'exten':{'type':Sequelize[_0xaf36('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xaf36('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xaf36('0x3')]},'transfer':{'type':Sequelize[_0xaf36('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaf36('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index ffd243f..72a4d14 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 _0xe2a3=['fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','localhost','register','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','VoiceQueueReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','add','day','merge','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','getVoiceQueuesReport','sort','pick'];(function(_0x22a473,_0x966c95){var _0x333438=function(_0x55e82d){while(--_0x55e82d){_0x22a473['push'](_0x22a473['shift']());}};_0x333438(++_0x966c95);}(_0xe2a3,0xe4));var _0x3e2a=function(_0x5c1829,_0x5e5b18){_0x5c1829=_0x5c1829-0x0;var _0x45dd65=_0xe2a3[_0x5c1829];return _0x45dd65;};'use strict';var jsonpatch=require(_0x3e2a('0x0'));var rp=require('request-promise');var moment=require(_0x3e2a('0x1'));var BPromise=require(_0x3e2a('0x2'));var Mustache=require(_0x3e2a('0x3'));var util=require('util');var path=require(_0x3e2a('0x4'));var sox=require(_0x3e2a('0x5'));var csv=require('to-csv');var ejs=require(_0x3e2a('0x6'));var fs=require('fs');var _=require(_0x3e2a('0x7'));var squel=require(_0x3e2a('0x8'));var crypto=require(_0x3e2a('0x9'));var jsforce=require(_0x3e2a('0xa'));var deskjs=require(_0x3e2a('0xb'));var toCsv=require(_0x3e2a('0xc'));var querystring=require(_0x3e2a('0xd'));var Papa=require(_0x3e2a('0xe'));var qs=require(_0x3e2a('0xf'));var logger=require(_0x3e2a('0x10'))(_0x3e2a('0x11'));var utils=require('../../config/utils');var config=require(_0x3e2a('0x12'));var db=require(_0x3e2a('0x13'))['db'];var socket=require(_0x3e2a('0x14'))({'host':_0x3e2a('0x15'),'port':0x18eb});require('./voiceQueueReport.socket')[_0x3e2a('0x16')](socket);function respondWithStatusCode(_0x265848,_0x31c84e){_0x31c84e=_0x31c84e||0xcc;return function(_0x29950c){if(_0x29950c){return _0x265848['sendStatus'](_0x31c84e);}return _0x265848[_0x3e2a('0x17')](_0x31c84e)[_0x3e2a('0x18')]();};}function respondWithResult(_0x2e54ce,_0x464313){_0x464313=_0x464313||0xc8;return function(_0x7be16a){if(_0x7be16a){return _0x2e54ce[_0x3e2a('0x17')](_0x464313)['json'](_0x7be16a);}};}function respondWithFilteredResult(_0x1cc399,_0x221e30){return function(_0x480e7c){if(_0x480e7c){var _0x55b2a3=_0x480e7c[_0x3e2a('0x19')],_0x8adc50=_0x221e30['offset'],_0x176fb9=_0x221e30[_0x3e2a('0x1a')]+_0x221e30[_0x3e2a('0x1b')],_0x45caff;if(_0x176fb9>=_0x55b2a3){_0x176fb9=_0x55b2a3;_0x45caff=0xc8;}else{_0x45caff=0xce;}_0x1cc399['status'](_0x45caff);return _0x1cc399[_0x3e2a('0x1c')](_0x3e2a('0x1d'),_0x8adc50+'-'+_0x176fb9+'/'+_0x55b2a3)[_0x3e2a('0x1e')](_0x480e7c);}return null;};}function patchUpdates(_0x20b7ca){return function(_0x4602d4){try{jsonpatch['apply'](_0x4602d4,_0x20b7ca,!![]);}catch(_0x3a7dff){return BPromise[_0x3e2a('0x1f')](_0x3a7dff);}return _0x4602d4[_0x3e2a('0x20')]();};}function saveUpdates(_0x4e4881,_0x7e4d48){return function(_0x2f1395){if(_0x2f1395){return _0x2f1395[_0x3e2a('0x21')](_0x4e4881)[_0x3e2a('0x22')](function(_0x1aaf74){return _0x1aaf74;});}return null;};}function removeEntity(_0x33b1d3,_0x51d1c8){return function(_0x567a9b){if(_0x567a9b){return _0x567a9b[_0x3e2a('0x23')]()[_0x3e2a('0x22')](function(){_0x33b1d3[_0x3e2a('0x17')](0xcc)[_0x3e2a('0x18')]();});}};}function handleEntityNotFound(_0x31d1d0,_0x3fdc20){return function(_0x2ec91b){if(!_0x2ec91b){_0x31d1d0['sendStatus'](0x194);}return _0x2ec91b;};}function handleError(_0x24eefe,_0x540a3d){_0x540a3d=_0x540a3d||0x1f4;return function(_0x4f67af){logger[_0x3e2a('0x24')](_0x4f67af[_0x3e2a('0x25')]);if(_0x4f67af['name']){delete _0x4f67af[_0x3e2a('0x26')];}_0x24eefe['status'](_0x540a3d)[_0x3e2a('0x27')](_0x4f67af);};}exports['index']=function(_0x64c463,_0x4f80b6){var _0x4068f8={},_0x860b65={},_0x493cb4={'count':0x0,'rows':[]};var _0x1028f1=db[_0x3e2a('0x28')][_0x3e2a('0x29')];_0x860b65[_0x3e2a('0x2a')]=_[_0x3e2a('0x2b')](_0x1028f1);var _0x5941ef={'dateStart':_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x2d')],'dateEnd':_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x2e')]};delete _0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x2d')];delete _0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x2e')];_0x860b65['query']=_[_0x3e2a('0x2b')](_0x64c463[_0x3e2a('0x2c')]);_0x860b65[_0x3e2a('0x2f')]=_[_0x3e2a('0x30')](_0x860b65[_0x3e2a('0x2a')],_0x860b65[_0x3e2a('0x2c')]);_0x4068f8[_0x3e2a('0x31')]=_[_0x3e2a('0x30')](_0x860b65[_0x3e2a('0x2a')],qs['fields'](_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x32')]));_0x4068f8['attributes']=_0x4068f8[_0x3e2a('0x31')]['length']?_0x4068f8[_0x3e2a('0x31')]:_0x860b65[_0x3e2a('0x2a')];if(!_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x33')](_0x3e2a('0x34'))){_0x4068f8['limit']=qs['limit'](_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x1b')]);_0x4068f8[_0x3e2a('0x1a')]=qs['offset'](_0x64c463['query']['offset']);}_0x4068f8[_0x3e2a('0x35')]=qs['sort'](_0x64c463[_0x3e2a('0x2c')]['sort']);_0x4068f8['where']=qs[_0x3e2a('0x2f')](_['pick'](_0x64c463['query'],_0x860b65[_0x3e2a('0x2f')]));if(_0x5941ef[_0x3e2a('0x2d')]){if(_0x5941ef[_0x3e2a('0x2e')]){_0x5941ef[_0x3e2a('0x2e')]=moment(_0x5941ef[_0x3e2a('0x2e')])[_0x3e2a('0x36')](0x1,_0x3e2a('0x37'));}else{_0x5941ef[_0x3e2a('0x2e')]=moment(_0x5941ef[_0x3e2a('0x2d')])[_0x3e2a('0x36')](0x1,'day');}_[_0x3e2a('0x38')](_0x4068f8['where'],{'createdAt':{'$gte':_0x5941ef[_0x3e2a('0x2d')],'$lte':_0x5941ef['dateEnd']}});}if(_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x39')]){_0x4068f8[_0x3e2a('0x3a')]=_['merge'](_0x4068f8[_0x3e2a('0x3a')],{'$or':_[_0x3e2a('0x3b')](_0x4068f8['attributes'],function(_0x48a75e){var _0x3f9e92={};_0x3f9e92[_0x48a75e]={'$like':'%'+_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x39')]+'%'};return _0x3f9e92;})});}_0x4068f8=_[_0x3e2a('0x38')]({},_0x4068f8,_0x64c463[_0x3e2a('0x3c')]);var _0x475883={'where':_0x4068f8[_0x3e2a('0x3a')]};return db[_0x3e2a('0x28')]['count'](_0x475883)[_0x3e2a('0x22')](function(_0x4d88e1){_0x493cb4['count']=_0x4d88e1;if(_0x64c463[_0x3e2a('0x2c')][_0x3e2a('0x3d')]){_0x4068f8[_0x3e2a('0x3e')]=[{'all':!![]}];}return db[_0x3e2a('0x28')][_0x3e2a('0x3f')](_0x4068f8);})[_0x3e2a('0x22')](function(_0x3a22f3){_0x493cb4[_0x3e2a('0x40')]=_0x3a22f3;return _0x493cb4;})[_0x3e2a('0x22')](respondWithFilteredResult(_0x4f80b6,_0x4068f8))[_0x3e2a('0x41')](handleError(_0x4f80b6,null));};exports[_0x3e2a('0x42')]=function(_0x5edcba,_0x5166d3){var _0xaf657c={'raw':![],'where':{'id':_0x5edcba[_0x3e2a('0x43')]['id']}},_0x2436a5={};_0x2436a5[_0x3e2a('0x2a')]=_[_0x3e2a('0x2b')](db[_0x3e2a('0x28')][_0x3e2a('0x29')]);_0x2436a5['query']=_['keys'](_0x5edcba['query']);_0x2436a5[_0x3e2a('0x2f')]=_[_0x3e2a('0x30')](_0x2436a5['model'],_0x2436a5[_0x3e2a('0x2c')]);_0xaf657c['attributes']=_[_0x3e2a('0x30')](_0x2436a5[_0x3e2a('0x2a')],qs[_0x3e2a('0x32')](_0x5edcba['query'][_0x3e2a('0x32')]));_0xaf657c[_0x3e2a('0x31')]=_0xaf657c[_0x3e2a('0x31')][_0x3e2a('0x44')]?_0xaf657c[_0x3e2a('0x31')]:_0x2436a5[_0x3e2a('0x2a')];if(_0x5edcba['query']['includeAll']){_0xaf657c[_0x3e2a('0x3e')]=[{'all':!![]}];}_0xaf657c=_[_0x3e2a('0x38')]({},_0xaf657c,_0x5edcba[_0x3e2a('0x3c')]);return db[_0x3e2a('0x28')][_0x3e2a('0x45')](_0xaf657c)['then'](handleEntityNotFound(_0x5166d3,null))['then'](respondWithResult(_0x5166d3,null))[_0x3e2a('0x41')](handleError(_0x5166d3,null));};exports[_0x3e2a('0x46')]=function(_0x43cb03,_0x11c66b){return db[_0x3e2a('0x28')][_0x3e2a('0x46')](_0x43cb03[_0x3e2a('0x47')],{})['then'](respondWithResult(_0x11c66b,0xc9))[_0x3e2a('0x41')](handleError(_0x11c66b,null));};exports['update']=function(_0x17624a,_0x1023e1){if(_0x17624a['body']['id']){delete _0x17624a[_0x3e2a('0x47')]['id'];}return db['VoiceQueueReport'][_0x3e2a('0x45')]({'where':{'id':_0x17624a[_0x3e2a('0x43')]['id']}})['then'](handleEntityNotFound(_0x1023e1,null))[_0x3e2a('0x22')](saveUpdates(_0x17624a[_0x3e2a('0x47')],null))[_0x3e2a('0x22')](respondWithResult(_0x1023e1,null))[_0x3e2a('0x41')](handleError(_0x1023e1,null));};exports['destroy']=function(_0x2e8701,_0x1b0bf5){return db[_0x3e2a('0x28')][_0x3e2a('0x45')]({'where':{'id':_0x2e8701[_0x3e2a('0x43')]['id']}})[_0x3e2a('0x22')](handleEntityNotFound(_0x1b0bf5,null))[_0x3e2a('0x22')](removeEntity(_0x1b0bf5,null))['catch'](handleError(_0x1b0bf5,null));};exports[_0x3e2a('0x48')]=function(_0x3b0e7d,_0x3bf294){return db['VoiceQueueReport'][_0x3e2a('0x48')]()[_0x3e2a('0x22')](respondWithResult(_0x3bf294,null))['catch'](handleError(_0x3bf294,null));};exports[_0x3e2a('0x49')]=function(_0x2178a3,_0x480089){var _0x2c80e5={},_0xebef70={},_0x13f800={'count':0x0,'rows':[]};_0xebef70[_0x3e2a('0x2a')]=_[_0x3e2a('0x2b')](db[_0x3e2a('0x28')][_0x3e2a('0x29')]);var _0x1effc7={'dateStart':_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x2d')],'dateEnd':_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x2e')]};delete _0x2178a3[_0x3e2a('0x2c')]['dateStart'];delete _0x2178a3[_0x3e2a('0x2c')]['dateEnd'];_0xebef70[_0x3e2a('0x2c')]=_[_0x3e2a('0x2b')](_0x2178a3['query']);_0xebef70['filters']=_['intersection'](_0xebef70[_0x3e2a('0x2a')],_0xebef70['query']);_0x2c80e5['attributes']=_['intersection'](_0xebef70['model'],qs[_0x3e2a('0x32')](_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x32')]));_0x2c80e5[_0x3e2a('0x31')]=_0x2c80e5[_0x3e2a('0x31')][_0x3e2a('0x44')]?_0x2c80e5[_0x3e2a('0x31')]:_0xebef70[_0x3e2a('0x2a')];if(!_0x2178a3['query'][_0x3e2a('0x33')](_0x3e2a('0x34'))){_0x2c80e5[_0x3e2a('0x1b')]=qs[_0x3e2a('0x1b')](_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x1b')]);_0x2c80e5['offset']=qs[_0x3e2a('0x1a')](_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x1a')]);}_0x2c80e5['order']=qs[_0x3e2a('0x4a')](_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x4a')]);_0x2c80e5[_0x3e2a('0x3a')]=qs[_0x3e2a('0x2f')](_[_0x3e2a('0x4b')](_0x2178a3['query'],_0xebef70[_0x3e2a('0x2f')]));if(_0x1effc7[_0x3e2a('0x2d')]){if(_0x1effc7['dateEnd']){_0x1effc7[_0x3e2a('0x2e')]=moment(_0x1effc7[_0x3e2a('0x2e')])[_0x3e2a('0x36')](0x1,_0x3e2a('0x37'));}else{_0x1effc7[_0x3e2a('0x2e')]=moment(_0x1effc7[_0x3e2a('0x2d')])[_0x3e2a('0x36')](0x1,_0x3e2a('0x37'));}_[_0x3e2a('0x38')](_0x2c80e5[_0x3e2a('0x3a')],{'createdAt':{'$gte':_0x1effc7[_0x3e2a('0x2d')],'$lte':_0x1effc7[_0x3e2a('0x2e')]}});}if(_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x39')]){_0x2c80e5[_0x3e2a('0x3a')]=_[_0x3e2a('0x38')](_0x2c80e5[_0x3e2a('0x3a')],{'$or':_[_0x3e2a('0x3b')](_0x2c80e5[_0x3e2a('0x31')],function(_0x3f8a49){var _0x4403a5={};_0x4403a5[_0x3f8a49]={'$like':'%'+_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x39')]+'%'};return _0x4403a5;})});}_0x2c80e5=_[_0x3e2a('0x38')]({},_0x2c80e5,_0x2178a3[_0x3e2a('0x3c')]);var _0x3f2d2e={'where':_0x2c80e5['where']};return db[_0x3e2a('0x28')][_0x3e2a('0x19')](_0x3f2d2e)[_0x3e2a('0x22')](function(_0x503855){_0x13f800[_0x3e2a('0x19')]=_0x503855;if(_0x2178a3[_0x3e2a('0x2c')][_0x3e2a('0x3d')]){_0x2c80e5['include']=[{'all':!![]}];}return db[_0x3e2a('0x28')][_0x3e2a('0x3f')](_0x2c80e5);})['then'](function(_0x16abda){_0x13f800[_0x3e2a('0x40')]=_0x16abda;return _0x13f800;})[_0x3e2a('0x22')](respondWithFilteredResult(_0x480089,_0x2c80e5,_0x3e2a('0x49')))[_0x3e2a('0x41')](handleError(_0x480089,null,_0x3e2a('0x49')));}; \ No newline at end of file +var _0x47b9=['desk.js','papaparse','../../components/parsers/qs','api','../../config/utils','./voiceQueueReport.socket','register','sendStatus','status','end','json','limit','set','Content-Range','then','error','stack','name','send','index','VoiceQueueReport','rawAttributes','model','keys','dateStart','query','dateEnd','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','add','day','merge','filter','map','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','pick','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x35fb56,_0x5dadff){var _0x2fd52c=function(_0x97bd3f){while(--_0x97bd3f){_0x35fb56['push'](_0x35fb56['shift']());}};_0x2fd52c(++_0x5dadff);}(_0x47b9,0x15c));var _0x947b=function(_0x2ff739,_0x1c8e0f){_0x2ff739=_0x2ff739-0x0;var _0x12dc13=_0x47b9[_0x2ff739];return _0x12dc13;};'use strict';var jsonpatch=require(_0x947b('0x0'));var rp=require(_0x947b('0x1'));var moment=require(_0x947b('0x2'));var BPromise=require(_0x947b('0x3'));var Mustache=require(_0x947b('0x4'));var util=require(_0x947b('0x5'));var path=require('path');var sox=require(_0x947b('0x6'));var csv=require(_0x947b('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x947b('0x8'));var squel=require(_0x947b('0x9'));var crypto=require(_0x947b('0xa'));var jsforce=require(_0x947b('0xb'));var deskjs=require(_0x947b('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x947b('0xd'));var qs=require(_0x947b('0xe'));var logger=require('../../config/logger')(_0x947b('0xf'));var utils=require(_0x947b('0x10'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')({'host':'localhost','port':0x18eb});require(_0x947b('0x11'))[_0x947b('0x12')](socket);function respondWithStatusCode(_0xd02fb2,_0x363dea){_0x363dea=_0x363dea||0xcc;return function(_0x133c46){if(_0x133c46){return _0xd02fb2[_0x947b('0x13')](_0x363dea);}return _0xd02fb2[_0x947b('0x14')](_0x363dea)[_0x947b('0x15')]();};}function respondWithResult(_0x2fbc9c,_0x108989){_0x108989=_0x108989||0xc8;return function(_0x512c6b){if(_0x512c6b){return _0x2fbc9c[_0x947b('0x14')](_0x108989)[_0x947b('0x16')](_0x512c6b);}};}function respondWithFilteredResult(_0x5d3f0c,_0x9f619f){return function(_0xb08182){if(_0xb08182){var _0x50db2c=_0xb08182['count'],_0x104caf=_0x9f619f['offset'],_0x377c1e=_0x9f619f['offset']+_0x9f619f[_0x947b('0x17')],_0x40d101;if(_0x377c1e>=_0x50db2c){_0x377c1e=_0x50db2c;_0x40d101=0xc8;}else{_0x40d101=0xce;}_0x5d3f0c[_0x947b('0x14')](_0x40d101);return _0x5d3f0c[_0x947b('0x18')](_0x947b('0x19'),_0x104caf+'-'+_0x377c1e+'/'+_0x50db2c)[_0x947b('0x16')](_0xb08182);}return null;};}function patchUpdates(_0x4d4fb2){return function(_0x4ca6d8){try{jsonpatch['apply'](_0x4ca6d8,_0x4d4fb2,!![]);}catch(_0x558703){return BPromise['reject'](_0x558703);}return _0x4ca6d8['save']();};}function saveUpdates(_0x41b006,_0x25a20c){return function(_0x297012){if(_0x297012){return _0x297012['update'](_0x41b006)[_0x947b('0x1a')](function(_0x3a14ef){return _0x3a14ef;});}return null;};}function removeEntity(_0x31a9d2,_0x35c807){return function(_0x13cf34){if(_0x13cf34){return _0x13cf34['destroy']()['then'](function(){_0x31a9d2['status'](0xcc)[_0x947b('0x15')]();});}};}function handleEntityNotFound(_0x3fed7c,_0x4fb30a){return function(_0x55ce16){if(!_0x55ce16){_0x3fed7c[_0x947b('0x13')](0x194);}return _0x55ce16;};}function handleError(_0x2ff323,_0x267c1a){_0x267c1a=_0x267c1a||0x1f4;return function(_0x551d73){logger[_0x947b('0x1b')](_0x551d73[_0x947b('0x1c')]);if(_0x551d73[_0x947b('0x1d')]){delete _0x551d73[_0x947b('0x1d')];}_0x2ff323[_0x947b('0x14')](_0x267c1a)[_0x947b('0x1e')](_0x551d73);};}exports[_0x947b('0x1f')]=function(_0x157937,_0x527255){var _0x8a9817={},_0x1c8ace={},_0x36cf2e={'count':0x0,'rows':[]};var _0x4477c9=db[_0x947b('0x20')][_0x947b('0x21')];_0x1c8ace[_0x947b('0x22')]=_[_0x947b('0x23')](_0x4477c9);var _0x5e3366={'dateStart':_0x157937['query'][_0x947b('0x24')],'dateEnd':_0x157937[_0x947b('0x25')]['dateEnd']};delete _0x157937[_0x947b('0x25')]['dateStart'];delete _0x157937[_0x947b('0x25')][_0x947b('0x26')];_0x1c8ace[_0x947b('0x25')]=_[_0x947b('0x23')](_0x157937[_0x947b('0x25')]);_0x1c8ace[_0x947b('0x27')]=_[_0x947b('0x28')](_0x1c8ace['model'],_0x1c8ace[_0x947b('0x25')]);_0x8a9817[_0x947b('0x29')]=_[_0x947b('0x28')](_0x1c8ace['model'],qs[_0x947b('0x2a')](_0x157937[_0x947b('0x25')][_0x947b('0x2a')]));_0x8a9817[_0x947b('0x29')]=_0x8a9817[_0x947b('0x29')][_0x947b('0x2b')]?_0x8a9817['attributes']:_0x1c8ace[_0x947b('0x22')];if(!_0x157937['query']['hasOwnProperty'](_0x947b('0x2c'))){_0x8a9817['limit']=qs[_0x947b('0x17')](_0x157937[_0x947b('0x25')][_0x947b('0x17')]);_0x8a9817[_0x947b('0x2d')]=qs[_0x947b('0x2d')](_0x157937[_0x947b('0x25')][_0x947b('0x2d')]);}_0x8a9817[_0x947b('0x2e')]=qs[_0x947b('0x2f')](_0x157937[_0x947b('0x25')][_0x947b('0x2f')]);_0x8a9817[_0x947b('0x30')]=qs[_0x947b('0x27')](_['pick'](_0x157937[_0x947b('0x25')],_0x1c8ace['filters']));if(_0x5e3366[_0x947b('0x24')]){if(_0x5e3366[_0x947b('0x26')]){_0x5e3366[_0x947b('0x26')]=moment(_0x5e3366[_0x947b('0x26')])[_0x947b('0x31')](0x1,'day');}else{_0x5e3366[_0x947b('0x26')]=moment(_0x5e3366[_0x947b('0x24')])[_0x947b('0x31')](0x1,_0x947b('0x32'));}_[_0x947b('0x33')](_0x8a9817[_0x947b('0x30')],{'createdAt':{'$gte':_0x5e3366['dateStart'],'$lte':_0x5e3366[_0x947b('0x26')]}});}if(_0x157937[_0x947b('0x25')][_0x947b('0x34')]){_0x8a9817[_0x947b('0x30')]=_[_0x947b('0x33')](_0x8a9817[_0x947b('0x30')],{'$or':_[_0x947b('0x35')](_0x8a9817['attributes'],function(_0xa9bedc){var _0x5baaa1={};_0x5baaa1[_0xa9bedc]={'$like':'%'+_0x157937[_0x947b('0x25')][_0x947b('0x34')]+'%'};return _0x5baaa1;})});}_0x8a9817=_[_0x947b('0x33')]({},_0x8a9817,_0x157937[_0x947b('0x36')]);var _0x1dd18a={'where':_0x8a9817[_0x947b('0x30')]};return db[_0x947b('0x20')]['count'](_0x1dd18a)['then'](function(_0x10a9eb){_0x36cf2e[_0x947b('0x37')]=_0x10a9eb;if(_0x157937[_0x947b('0x25')][_0x947b('0x38')]){_0x8a9817[_0x947b('0x39')]=[{'all':!![]}];}return db[_0x947b('0x20')][_0x947b('0x3a')](_0x8a9817);})[_0x947b('0x1a')](function(_0x3cdee9){_0x36cf2e[_0x947b('0x3b')]=_0x3cdee9;return _0x36cf2e;})[_0x947b('0x1a')](respondWithFilteredResult(_0x527255,_0x8a9817))[_0x947b('0x3c')](handleError(_0x527255,null));};exports[_0x947b('0x3d')]=function(_0x3e60c2,_0x23869b){var _0x4d3bc1={'raw':![],'where':{'id':_0x3e60c2[_0x947b('0x3e')]['id']}},_0x4c08e3={};_0x4c08e3['model']=_[_0x947b('0x23')](db[_0x947b('0x20')][_0x947b('0x21')]);_0x4c08e3['query']=_['keys'](_0x3e60c2['query']);_0x4c08e3[_0x947b('0x27')]=_[_0x947b('0x28')](_0x4c08e3[_0x947b('0x22')],_0x4c08e3[_0x947b('0x25')]);_0x4d3bc1[_0x947b('0x29')]=_['intersection'](_0x4c08e3['model'],qs[_0x947b('0x2a')](_0x3e60c2[_0x947b('0x25')][_0x947b('0x2a')]));_0x4d3bc1['attributes']=_0x4d3bc1[_0x947b('0x29')][_0x947b('0x2b')]?_0x4d3bc1[_0x947b('0x29')]:_0x4c08e3['model'];if(_0x3e60c2['query'][_0x947b('0x38')]){_0x4d3bc1[_0x947b('0x39')]=[{'all':!![]}];}_0x4d3bc1=_['merge']({},_0x4d3bc1,_0x3e60c2['options']);return db[_0x947b('0x20')][_0x947b('0x3f')](_0x4d3bc1)[_0x947b('0x1a')](handleEntityNotFound(_0x23869b,null))[_0x947b('0x1a')](respondWithResult(_0x23869b,null))[_0x947b('0x3c')](handleError(_0x23869b,null));};exports[_0x947b('0x40')]=function(_0x1972bd,_0x1a9f7d){return db[_0x947b('0x20')][_0x947b('0x40')](_0x1972bd['body'],{})['then'](respondWithResult(_0x1a9f7d,0xc9))[_0x947b('0x3c')](handleError(_0x1a9f7d,null));};exports[_0x947b('0x41')]=function(_0x37f944,_0x15be68){if(_0x37f944[_0x947b('0x42')]['id']){delete _0x37f944[_0x947b('0x42')]['id'];}return db[_0x947b('0x20')][_0x947b('0x3f')]({'where':{'id':_0x37f944['params']['id']}})[_0x947b('0x1a')](handleEntityNotFound(_0x15be68,null))[_0x947b('0x1a')](saveUpdates(_0x37f944['body'],null))[_0x947b('0x1a')](respondWithResult(_0x15be68,null))[_0x947b('0x3c')](handleError(_0x15be68,null));};exports[_0x947b('0x43')]=function(_0xbc6fc2,_0x1f4f83){return db[_0x947b('0x20')][_0x947b('0x3f')]({'where':{'id':_0xbc6fc2['params']['id']}})[_0x947b('0x1a')](handleEntityNotFound(_0x1f4f83,null))[_0x947b('0x1a')](removeEntity(_0x1f4f83,null))[_0x947b('0x3c')](handleError(_0x1f4f83,null));};exports[_0x947b('0x44')]=function(_0xed2e93,_0xa26a91){return db[_0x947b('0x20')]['describe']()[_0x947b('0x1a')](respondWithResult(_0xa26a91,null))[_0x947b('0x3c')](handleError(_0xa26a91,null));};exports[_0x947b('0x45')]=function(_0x51e620,_0x22f63c){var _0x129f99={},_0x5821cd={},_0x5bb793={'count':0x0,'rows':[]};_0x5821cd[_0x947b('0x22')]=_[_0x947b('0x23')](db['VoiceQueueReport'][_0x947b('0x21')]);var _0x70514a={'dateStart':_0x51e620[_0x947b('0x25')][_0x947b('0x24')],'dateEnd':_0x51e620[_0x947b('0x25')][_0x947b('0x26')]};delete _0x51e620['query'][_0x947b('0x24')];delete _0x51e620[_0x947b('0x25')][_0x947b('0x26')];_0x5821cd[_0x947b('0x25')]=_[_0x947b('0x23')](_0x51e620[_0x947b('0x25')]);_0x5821cd[_0x947b('0x27')]=_[_0x947b('0x28')](_0x5821cd[_0x947b('0x22')],_0x5821cd[_0x947b('0x25')]);_0x129f99['attributes']=_[_0x947b('0x28')](_0x5821cd['model'],qs[_0x947b('0x2a')](_0x51e620['query'][_0x947b('0x2a')]));_0x129f99[_0x947b('0x29')]=_0x129f99[_0x947b('0x29')][_0x947b('0x2b')]?_0x129f99[_0x947b('0x29')]:_0x5821cd[_0x947b('0x22')];if(!_0x51e620[_0x947b('0x25')][_0x947b('0x46')]('nolimit')){_0x129f99[_0x947b('0x17')]=qs[_0x947b('0x17')](_0x51e620['query'][_0x947b('0x17')]);_0x129f99[_0x947b('0x2d')]=qs['offset'](_0x51e620[_0x947b('0x25')][_0x947b('0x2d')]);}_0x129f99[_0x947b('0x2e')]=qs[_0x947b('0x2f')](_0x51e620['query'][_0x947b('0x2f')]);_0x129f99[_0x947b('0x30')]=qs[_0x947b('0x27')](_[_0x947b('0x47')](_0x51e620[_0x947b('0x25')],_0x5821cd[_0x947b('0x27')]));if(_0x70514a[_0x947b('0x24')]){if(_0x70514a[_0x947b('0x26')]){_0x70514a[_0x947b('0x26')]=moment(_0x70514a['dateEnd'])[_0x947b('0x31')](0x1,_0x947b('0x32'));}else{_0x70514a[_0x947b('0x26')]=moment(_0x70514a[_0x947b('0x24')])[_0x947b('0x31')](0x1,_0x947b('0x32'));}_[_0x947b('0x33')](_0x129f99[_0x947b('0x30')],{'createdAt':{'$gte':_0x70514a['dateStart'],'$lte':_0x70514a['dateEnd']}});}if(_0x51e620['query']['filter']){_0x129f99[_0x947b('0x30')]=_[_0x947b('0x33')](_0x129f99[_0x947b('0x30')],{'$or':_['map'](_0x129f99[_0x947b('0x29')],function(_0x5450fc){var _0x217662={};_0x217662[_0x5450fc]={'$like':'%'+_0x51e620['query'][_0x947b('0x34')]+'%'};return _0x217662;})});}_0x129f99=_[_0x947b('0x33')]({},_0x129f99,_0x51e620['options']);var _0x1eac4b={'where':_0x129f99[_0x947b('0x30')]};return db[_0x947b('0x20')]['count'](_0x1eac4b)['then'](function(_0x11bd7f){_0x5bb793[_0x947b('0x37')]=_0x11bd7f;if(_0x51e620[_0x947b('0x25')][_0x947b('0x38')]){_0x129f99[_0x947b('0x39')]=[{'all':!![]}];}return db[_0x947b('0x20')][_0x947b('0x3a')](_0x129f99);})[_0x947b('0x1a')](function(_0x103136){_0x5bb793[_0x947b('0x3b')]=_0x103136;return _0x5bb793;})[_0x947b('0x1a')](respondWithFilteredResult(_0x22f63c,_0x129f99,'getVoiceQueuesReport'))['catch'](handleError(_0x22f63c,null,_0x947b('0x45')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index f14b86d..3a0eabd 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 _0x3ab3=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','save','update'];(function(_0x48d7,_0x371193){var _0x35aeb5=function(_0x3fa5b4){while(--_0x3fa5b4){_0x48d7['push'](_0x48d7['shift']());}};_0x35aeb5(++_0x371193);}(_0x3ab3,0x10d));var _0x33ab=function(_0x48271f,_0xc4f6d3){_0x48271f=_0x48271f-0x0;var _0x13eb5c=_0x3ab3[_0x48271f];return _0x13eb5c;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x33ab('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33ab('0x1'),'afterUpdate':_0x33ab('0x2'),'afterDestroy':_0x33ab('0x3')};function emitEvent(_0x1c1cb2){return function(_0x219df7,_0x5937b6,_0x1daddc){VoiceQueueReportEvents[_0x33ab('0x4')](_0x1c1cb2+':'+_0x219df7['id'],_0x219df7);VoiceQueueReportEvents['emit'](_0x1c1cb2,_0x219df7);_0x1daddc(null);};}for(var e in events){if(events[_0x33ab('0x5')](e)){var event=events[e];VoiceQueueReport[_0x33ab('0x6')](e,emitEvent(event));}}module[_0x33ab('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd3d5=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd3d5,0x1af));var _0x5d3d=function(_0x2ca269,_0x2b9fe8){_0x2ca269=_0x2ca269-0x0;var _0x42b4a8=_0xd3d5[_0x2ca269];return _0x42b4a8;};'use strict';var EventEmitter=require(_0x5d3d('0x0'));var VoiceQueueReport=require(_0x5d3d('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5d3d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x23f870){return function(_0x491349,_0x1d65b1,_0x1f7c46){VoiceQueueReportEvents[_0x5d3d('0x3')](_0x23f870+':'+_0x491349['id'],_0x491349);VoiceQueueReportEvents[_0x5d3d('0x3')](_0x23f870,_0x491349);_0x1f7c46(null);};}for(var e in events){if(events[_0x5d3d('0x4')](e)){var event=events[e];VoiceQueueReport[_0x5d3d('0x5')](e,emitEvent(event));}}module[_0x5d3d('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 23b32a7..b9a92b4 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 _0x653f=['util','../../config/logger','api','moment','bluebird','request-promise','./voiceQueueReport.attributes','define','report_queue','uniqueid','calleridnum','lodash'];(function(_0x41a596,_0x9963c){var _0x48cad1=function(_0x48736e){while(--_0x48736e){_0x41a596['push'](_0x41a596['shift']());}};_0x48cad1(++_0x9963c);}(_0x653f,0x113));var _0xf653=function(_0x43fadf,_0xaca3b1){_0x43fadf=_0x43fadf-0x0;var _0x3b21ba=_0x653f[_0x43fadf];return _0x3b21ba;};'use strict';var _=require(_0xf653('0x0'));var util=require(_0xf653('0x1'));var logger=require(_0xf653('0x2'))(_0xf653('0x3'));var moment=require(_0xf653('0x4'));var BPromise=require(_0xf653('0x5'));var rp=require(_0xf653('0x6'));var attributes=require(_0xf653('0x7'));module['exports']=function(_0x14a273,_0x5bb283){return _0x14a273[_0xf653('0x8')]('VoiceQueueReport',attributes,{'tableName':_0xf653('0x9'),'paranoid':![],'indexes':[{'fields':[_0xf653('0xa')]},{'fields':[_0xf653('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c5=['request-promise','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','bluebird'];(function(_0x58a68f,_0x4fb9d2){var _0x28063f=function(_0xb02ae){while(--_0xb02ae){_0x58a68f['push'](_0x58a68f['shift']());}};_0x28063f(++_0x4fb9d2);}(_0xe0c5,0x1dd));var _0x5e0c=function(_0x907e10,_0xc91573){_0x907e10=_0x907e10-0x0;var _0x19d89e=_0xe0c5[_0x907e10];return _0x19d89e;};'use strict';var _=require('lodash');var util=require(_0x5e0c('0x0'));var logger=require('../../config/logger')(_0x5e0c('0x1'));var moment=require('moment');var BPromise=require(_0x5e0c('0x2'));var rp=require(_0x5e0c('0x3'));var attributes=require(_0x5e0c('0x4'));module['exports']=function(_0x7dd4a8,_0x4310ed){return _0x7dd4a8[_0x5e0c('0x5')](_0x5e0c('0x6'),attributes,{'tableName':_0x5e0c('0x7'),'paranoid':![],'indexes':[{'fields':[_0x5e0c('0x8')]},{'fields':[_0x5e0c('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 838b6bf..d7e34bd 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 _0xc808=['VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','model','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','where','limit','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','register','request','then','info'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc808,0x97));var _0x8c80=function(_0x3b22e9,_0x354406){_0x3b22e9=_0x3b22e9-0x0;var _0x230314=_0xc808[_0x3b22e9];return _0x230314;};'use strict';var _=require(_0x8c80('0x0'));var util=require(_0x8c80('0x1'));var moment=require(_0x8c80('0x2'));var BPromise=require('bluebird');var rs=require(_0x8c80('0x3'));var fs=require('fs');var db=require(_0x8c80('0x4'))['db'];var utils=require(_0x8c80('0x5'));var logger=require(_0x8c80('0x6'))(_0x8c80('0x7'));var config=require(_0x8c80('0x8'));var jayson=require(_0x8c80('0x9'));var client=jayson[_0x8c80('0xa')][_0x8c80('0xb')]({'port':0x232a});var socket=require(_0x8c80('0xc'))({'host':'localhost','port':0x18eb});require('./voiceQueueReport.socket')[_0x8c80('0xd')](socket);function respondWithRpcPromise(_0x5468a3,_0x2ec495,_0x129696){return new BPromise(function(_0x4b8768,_0x47397e){return client[_0x8c80('0xe')](_0x5468a3,_0x129696)[_0x8c80('0xf')](function(_0x8ab979){logger[_0x8c80('0x10')](_0x8c80('0x11'),_0x2ec495,_0x8c80('0x12'));logger[_0x8c80('0x13')](_0x8c80('0x14'),_0x2ec495,_0x8c80('0x12'),JSON[_0x8c80('0x15')](_0x8ab979));if(_0x8ab979[_0x8c80('0x16')]){if(_0x8ab979[_0x8c80('0x16')][_0x8c80('0x17')]===0x1f4){logger['error'](_0x8c80('0x11'),_0x2ec495,_0x8ab979['error'][_0x8c80('0x18')]);return _0x47397e(_0x8ab979[_0x8c80('0x16')][_0x8c80('0x18')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2ec495,_0x8ab979[_0x8c80('0x16')][_0x8c80('0x18')]);return _0x4b8768(_0x8ab979[_0x8c80('0x16')][_0x8c80('0x18')]);}else{logger[_0x8c80('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x2ec495,_0x8c80('0x12'));_0x4b8768(_0x8ab979[_0x8c80('0x19')]['message']);}})[_0x8c80('0x1a')](function(_0x4dc546){logger[_0x8c80('0x16')](_0x8c80('0x11'),_0x2ec495,_0x4dc546);_0x47397e(_0x4dc546);});});}exports[_0x8c80('0x1b')]=function(_0xdf6958){var _0x3eaf44=this;return new Promise(function(_0x541f88,_0x42f5be){return db[_0x8c80('0x1c')][_0x8c80('0x1d')]({'raw':_0xdf6958[_0x8c80('0x1e')]?_0xdf6958[_0x8c80('0x1e')][_0x8c80('0x1f')]===undefined?!![]:![]:!![],'where':_0xdf6958[_0x8c80('0x1e')]?_0xdf6958['options']['where']||null:null,'attributes':_0xdf6958[_0x8c80('0x1e')]?_0xdf6958[_0x8c80('0x1e')][_0x8c80('0x20')]||null:null,'limit':_0xdf6958[_0x8c80('0x1e')]?_0xdf6958[_0x8c80('0x1e')]['limit']||null:null,'include':_0xdf6958[_0x8c80('0x1e')]?_0xdf6958[_0x8c80('0x1e')]['include']?_['map'](_0xdf6958[_0x8c80('0x1e')][_0x8c80('0x21')],function(_0x1e8df2){return{'model':db[_0x1e8df2[_0x8c80('0x22')]],'as':_0x1e8df2['as'],'attributes':_0x1e8df2[_0x8c80('0x20')],'include':_0x1e8df2[_0x8c80('0x21')]?_[_0x8c80('0x23')](_0x1e8df2[_0x8c80('0x21')],function(_0x36e059){return{'model':db[_0x36e059[_0x8c80('0x22')]],'as':_0x36e059['as'],'attributes':_0x36e059['attributes'],'include':_0x36e059[_0x8c80('0x21')]?_[_0x8c80('0x23')](_0x36e059[_0x8c80('0x21')],function(_0x425580){return{'model':db[_0x425580['model']],'as':_0x425580['as'],'attributes':_0x425580[_0x8c80('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13fa12){logger[_0x8c80('0x10')]('GetVoiceQueueReport',_0xdf6958);logger['debug']('GetVoiceQueueReport',_0xdf6958,JSON['stringify'](_0x13fa12));_0x541f88(_0x13fa12);})['catch'](function(_0x5153aa){logger[_0x8c80('0x16')](_0x8c80('0x1b'),_0x5153aa[_0x8c80('0x18')],_0xdf6958);_0x42f5be(_0x3eaf44[_0x8c80('0x16')](0x1f4,_0x5153aa['message']));});});};exports[_0x8c80('0x24')]=function(_0x19f993){var _0x23f327=this;return new Promise(function(_0x5204a6,_0x35cd41){return db['VoiceQueueReport'][_0x8c80('0x25')](_0x19f993[_0x8c80('0x26')],{'raw':_0x19f993['options']?_0x19f993[_0x8c80('0x1e')][_0x8c80('0x1f')]===undefined?!![]:![]:!![]})[_0x8c80('0xf')](function(_0x3b952d){logger[_0x8c80('0x10')]('CreateVoiceQueueReport',_0x19f993);logger[_0x8c80('0x13')](_0x8c80('0x24'),_0x19f993,JSON['stringify'](_0x3b952d));_0x5204a6(_0x3b952d);})[_0x8c80('0x1a')](function(_0x5f1e91){logger['error'](_0x8c80('0x24'),_0x5f1e91[_0x8c80('0x18')],_0x19f993);_0x35cd41(_0x23f327['error'](0x1f4,_0x5f1e91[_0x8c80('0x18')]));});});};exports[_0x8c80('0x27')]=function(_0x4f04ca){var _0x5e0933=this;return new Promise(function(_0x3370e6,_0x46de47){return db['VoiceQueueReport']['update'](_0x4f04ca[_0x8c80('0x26')],{'raw':_0x4f04ca[_0x8c80('0x1e')]?_0x4f04ca[_0x8c80('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f04ca[_0x8c80('0x1e')]?_0x4f04ca[_0x8c80('0x1e')][_0x8c80('0x28')]||null:null,'attributes':_0x4f04ca['options']?_0x4f04ca[_0x8c80('0x1e')]['attributes']||null:null,'limit':_0x4f04ca[_0x8c80('0x1e')]?_0x4f04ca['options'][_0x8c80('0x29')]||null:null})[_0x8c80('0xf')](function(_0xa78005){logger[_0x8c80('0x10')]('UpdateVoiceQueueReport',_0x4f04ca);logger[_0x8c80('0x13')](_0x8c80('0x27'),_0x4f04ca,JSON['stringify'](_0xa78005));_0x3370e6(_0xa78005);})[_0x8c80('0x1a')](function(_0x1c7106){logger[_0x8c80('0x16')](_0x8c80('0x27'),_0x1c7106[_0x8c80('0x18')],_0x4f04ca);_0x46de47(_0x5e0933[_0x8c80('0x16')](0x1f4,_0x1c7106[_0x8c80('0x18')]));});});}; \ No newline at end of file +var _0x0de8=['map','model','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','lodash','util','moment','bluebird','../../config/logger','rpc','../../config/environment','client','http','localhost','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x0de8,0x1db));var _0x80de=function(_0x43924b,_0x20ceee){_0x43924b=_0x43924b-0x0;var _0x3dfff6=_0x0de8[_0x43924b];return _0x3dfff6;};'use strict';var _=require(_0x80de('0x0'));var util=require(_0x80de('0x1'));var moment=require(_0x80de('0x2'));var BPromise=require(_0x80de('0x3'));var rs=require('randomstring');var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x80de('0x4'))(_0x80de('0x5'));var config=require(_0x80de('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x80de('0x7')][_0x80de('0x8')]({'port':0x232a});var socket=require('socket.io-emitter')({'host':_0x80de('0x9'),'port':0x18eb});require('./voiceQueueReport.socket')[_0x80de('0xa')](socket);function respondWithRpcPromise(_0x2a0305,_0x1dcafc,_0x458786){return new BPromise(function(_0x1aef22,_0x338a3a){return client['request'](_0x2a0305,_0x458786)[_0x80de('0xb')](function(_0x36c84f){logger[_0x80de('0xc')](_0x80de('0xd'),_0x1dcafc,_0x80de('0xe'));logger[_0x80de('0xf')](_0x80de('0x10'),_0x1dcafc,'request\x20sent',JSON[_0x80de('0x11')](_0x36c84f));if(_0x36c84f[_0x80de('0x12')]){if(_0x36c84f['error'][_0x80de('0x13')]===0x1f4){logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);return _0x338a3a(_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);}logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x36c84f[_0x80de('0x12')][_0x80de('0x14')]);return _0x1aef22(_0x36c84f[_0x80de('0x12')]['message']);}else{logger['info'](_0x80de('0xd'),_0x1dcafc,'request\x20sent');_0x1aef22(_0x36c84f[_0x80de('0x15')][_0x80de('0x14')]);}})[_0x80de('0x16')](function(_0x493f9e){logger[_0x80de('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1dcafc,_0x493f9e);_0x338a3a(_0x493f9e);});});}exports[_0x80de('0x17')]=function(_0x206b77){var _0x270be3=this;return new Promise(function(_0xbfb5ca,_0x345091){return db[_0x80de('0x18')][_0x80de('0x19')]({'raw':_0x206b77[_0x80de('0x1a')]?_0x206b77[_0x80de('0x1a')][_0x80de('0x1b')]===undefined?!![]:![]:!![],'where':_0x206b77[_0x80de('0x1a')]?_0x206b77['options'][_0x80de('0x1c')]||null:null,'attributes':_0x206b77['options']?_0x206b77[_0x80de('0x1a')][_0x80de('0x1d')]||null:null,'limit':_0x206b77['options']?_0x206b77[_0x80de('0x1a')][_0x80de('0x1e')]||null:null,'include':_0x206b77[_0x80de('0x1a')]?_0x206b77['options'][_0x80de('0x1f')]?_[_0x80de('0x20')](_0x206b77[_0x80de('0x1a')]['include'],function(_0x2520fd){return{'model':db[_0x2520fd[_0x80de('0x21')]],'as':_0x2520fd['as'],'attributes':_0x2520fd[_0x80de('0x1d')],'include':_0x2520fd[_0x80de('0x1f')]?_['map'](_0x2520fd[_0x80de('0x1f')],function(_0x21793b){return{'model':db[_0x21793b[_0x80de('0x21')]],'as':_0x21793b['as'],'attributes':_0x21793b[_0x80de('0x1d')],'include':_0x21793b['include']?_[_0x80de('0x20')](_0x21793b[_0x80de('0x1f')],function(_0xf634e1){return{'model':db[_0xf634e1[_0x80de('0x21')]],'as':_0xf634e1['as'],'attributes':_0xf634e1[_0x80de('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80de('0xb')](function(_0x4b0092){logger[_0x80de('0xc')](_0x80de('0x17'),_0x206b77);logger['debug'](_0x80de('0x17'),_0x206b77,JSON[_0x80de('0x11')](_0x4b0092));_0xbfb5ca(_0x4b0092);})[_0x80de('0x16')](function(_0x35c0f9){logger[_0x80de('0x12')]('GetVoiceQueueReport',_0x35c0f9[_0x80de('0x14')],_0x206b77);_0x345091(_0x270be3[_0x80de('0x12')](0x1f4,_0x35c0f9[_0x80de('0x14')]));});});};exports[_0x80de('0x22')]=function(_0x512df6){var _0x4671b2=this;return new Promise(function(_0x3182ed,_0x550a3e){return db[_0x80de('0x18')][_0x80de('0x23')](_0x512df6[_0x80de('0x24')],{'raw':_0x512df6[_0x80de('0x1a')]?_0x512df6[_0x80de('0x1a')][_0x80de('0x1b')]===undefined?!![]:![]:!![]})[_0x80de('0xb')](function(_0x56cd34){logger[_0x80de('0xc')](_0x80de('0x22'),_0x512df6);logger['debug'](_0x80de('0x22'),_0x512df6,JSON['stringify'](_0x56cd34));_0x3182ed(_0x56cd34);})[_0x80de('0x16')](function(_0x4ee042){logger['error'](_0x80de('0x22'),_0x4ee042[_0x80de('0x14')],_0x512df6);_0x550a3e(_0x4671b2[_0x80de('0x12')](0x1f4,_0x4ee042[_0x80de('0x14')]));});});};exports[_0x80de('0x25')]=function(_0x8a86a3){var _0x1439e3=this;return new Promise(function(_0x12755f,_0x4f4893){return db[_0x80de('0x18')][_0x80de('0x26')](_0x8a86a3[_0x80de('0x24')],{'raw':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')][_0x80de('0x1c')]||null:null,'attributes':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3[_0x80de('0x1a')]['attributes']||null:null,'limit':_0x8a86a3[_0x80de('0x1a')]?_0x8a86a3['options'][_0x80de('0x1e')]||null:null})[_0x80de('0xb')](function(_0x1661a2){logger[_0x80de('0xc')](_0x80de('0x25'),_0x8a86a3);logger[_0x80de('0xf')](_0x80de('0x25'),_0x8a86a3,JSON[_0x80de('0x11')](_0x1661a2));_0x12755f(_0x1661a2);})[_0x80de('0x16')](function(_0x5a172a){logger[_0x80de('0x12')](_0x80de('0x25'),_0x5a172a[_0x80de('0x14')],_0x8a86a3);_0x4f4893(_0x1439e3[_0x80de('0x12')](0x1f4,_0x5a172a[_0x80de('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 19e4868..8b22045 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 _0xced7=['voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length'];(function(_0x46c9cc,_0xd27dca){var _0x21b46e=function(_0x33b2f5){while(--_0x33b2f5){_0x46c9cc['push'](_0x46c9cc['shift']());}};_0x21b46e(++_0xd27dca);}(_0xced7,0xc7));var _0x7ced=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xced7[_0x3dd15e];return _0x231fd0;};'use strict';var VoiceQueueReportEvents=require(_0x7ced('0x0'));var events=[_0x7ced('0x1'),_0x7ced('0x2'),_0x7ced('0x3')];function createListener(_0x39d08e,_0x1b9c62){return function(_0x103391){_0x1b9c62[_0x7ced('0x4')](_0x39d08e,_0x103391);};}function removeListener(_0x270e0b,_0x58a642){return function(){VoiceQueueReportEvents[_0x7ced('0x5')](_0x270e0b,_0x58a642);};}exports[_0x7ced('0x6')]=function(_0xc9acda){for(var _0x835f4=0x0,_0x1bb692=events[_0x7ced('0x7')];_0x835f4<_0x1bb692;_0x835f4++){var _0x10cbfe=events[_0x835f4];var _0x2323db=createListener(_0x7ced('0x8')+_0x10cbfe,_0xc9acda);VoiceQueueReportEvents['on'](_0x10cbfe,_0x2323db);}}; \ No newline at end of file +var _0x2420=['update','emit','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0xfc9d62,_0x4c0a49){var _0xb6bf90=function(_0x42ba0a){while(--_0x42ba0a){_0xfc9d62['push'](_0xfc9d62['shift']());}};_0xb6bf90(++_0x4c0a49);}(_0x2420,0xfd));var _0x0242=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2420[_0x5b644e];return _0x49c6bf;};'use strict';var VoiceQueueReportEvents=require(_0x0242('0x0'));var events=[_0x0242('0x1'),_0x0242('0x2'),_0x0242('0x3')];function createListener(_0x5ab77d,_0x37a44b){return function(_0x33dda7){_0x37a44b[_0x0242('0x4')](_0x5ab77d,_0x33dda7);};}function removeListener(_0x538a61,_0x55521d){return function(){VoiceQueueReportEvents[_0x0242('0x5')](_0x538a61,_0x55521d);};}exports['register']=function(_0x58d160){for(var _0x1f0946=0x0,_0x3d5795=events[_0x0242('0x6')];_0x1f0946<_0x3d5795;_0x1f0946++){var _0x102de1=events[_0x1f0946];var _0x127d49=createListener(_0x0242('0x7')+_0x102de1,_0x58d160);VoiceQueueReportEvents['on'](_0x102de1,_0x127d49);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 773a2a3..1259b4a 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 _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x239049,_0x24390f){var _0x3b7cc9=function(_0x566ffd){while(--_0x566ffd){_0x239049['push'](_0x239049['shift']());}};_0x3b7cc9(++_0x24390f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router['put']('/:id',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['/:id','show','create','update','delete','destroy','multer','util','path','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x3dc9f0,_0x999d9){var _0x44f3c6=function(_0x10ef20){while(--_0x10ef20){_0x3dc9f0['push'](_0x3dc9f0['shift']());}};_0x44f3c6(++_0x999d9);}(_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 express=require('express');var router=express['Router']();var auth=require(_0x0a9e('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x0a9e('0x4'));var controller=require(_0x0a9e('0x5'));router[_0x0a9e('0x6')]('/',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0x8')]);router['get'](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router['put']('/:id',auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xc')]);router[_0x0a9e('0xd')](_0x0a9e('0x9'),auth[_0x0a9e('0x7')](),controller[_0x0a9e('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 92b3b3f..0180768 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 _0x6aa7=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa7,0x178));var _0x76aa=function(_0xd93ded,_0x295682){_0xd93ded=_0xd93ded-0x0;var _0x2981ac=_0x6aa7[_0xd93ded];return _0x2981ac;};'use strict';var Sequelize=require(_0x76aa('0x0'));var moment=require('moment');module[_0x76aa('0x1')]={'time':{'type':Sequelize[_0x76aa('0x2')]},'callid':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x76aa('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x76aa('0x3')],'allowNull':![],'defaultValue':moment()[_0x76aa('0x4')](_0x76aa('0x5'))}}; \ No newline at end of file +var _0x9f62=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1315db,_0x27c35c){var _0x13e0df=function(_0x313613){while(--_0x313613){_0x1315db['push'](_0x1315db['shift']());}};_0x13e0df(++_0x27c35c);}(_0x9f62,0x154));var _0x29f6=function(_0x596520,_0x398b5e){_0x596520=_0x596520-0x0;var _0x42bbe7=_0x9f62[_0x596520];return _0x42bbe7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x29f6('0x0'));module['exports']={'time':{'type':Sequelize[_0x29f6('0x1')]},'callid':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x29f6('0x2')],'allowNull':![],'defaultValue':moment()[_0x29f6('0x3')](_0x29f6('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index b349878..ecbef6d 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 _0x759c=['offset','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','stack','index','VoiceQueuesLog','model','query','dateStart','dateEnd','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count'];(function(_0x33048a,_0x19e683){var _0x459b03=function(_0x31d4ed){while(--_0x31d4ed){_0x33048a['push'](_0x33048a['shift']());}};_0x459b03(++_0x19e683);}(_0x759c,0x72));var _0xc759=function(_0x24dd99,_0x8633f4){_0x24dd99=_0x24dd99-0x0;var _0x101350=_0x759c[_0x24dd99];return _0x101350;};'use strict';var jsonpatch=require(_0xc759('0x0'));var rp=require(_0xc759('0x1'));var moment=require(_0xc759('0x2'));var BPromise=require(_0xc759('0x3'));var Mustache=require(_0xc759('0x4'));var util=require(_0xc759('0x5'));var path=require(_0xc759('0x6'));var sox=require(_0xc759('0x7'));var csv=require(_0xc759('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc759('0x9'));var squel=require(_0xc759('0xa'));var crypto=require(_0xc759('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc759('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc759('0xd'));var Papa=require(_0xc759('0xe'));var qs=require(_0xc759('0xf'));var logger=require('../../config/logger')(_0xc759('0x10'));var utils=require(_0xc759('0x11'));var config=require(_0xc759('0x12'));var db=require(_0xc759('0x13'))['db'];function respondWithStatusCode(_0x4f9a92,_0x31a871){_0x31a871=_0x31a871||0xcc;return function(_0x1f690c){if(_0x1f690c){return _0x4f9a92['sendStatus'](_0x31a871);}return _0x4f9a92[_0xc759('0x14')](_0x31a871)[_0xc759('0x15')]();};}function respondWithResult(_0x32b66d,_0x747081){_0x747081=_0x747081||0xc8;return function(_0x23bfe9){if(_0x23bfe9){return _0x32b66d[_0xc759('0x14')](_0x747081)[_0xc759('0x16')](_0x23bfe9);}};}function respondWithFilteredResult(_0x4688f2,_0x3fdc3d){return function(_0x596404){if(_0x596404){var _0x10ae85=_0x596404[_0xc759('0x17')],_0x27bc96=_0x3fdc3d['offset'],_0x2e7b72=_0x3fdc3d[_0xc759('0x18')]+_0x3fdc3d[_0xc759('0x19')],_0x53e241;if(_0x2e7b72>=_0x10ae85){_0x2e7b72=_0x10ae85;_0x53e241=0xc8;}else{_0x53e241=0xce;}_0x4688f2[_0xc759('0x14')](_0x53e241);return _0x4688f2[_0xc759('0x1a')](_0xc759('0x1b'),_0x27bc96+'-'+_0x2e7b72+'/'+_0x10ae85)['json'](_0x596404);}return null;};}function patchUpdates(_0x95d221){return function(_0x344f01){try{jsonpatch[_0xc759('0x1c')](_0x344f01,_0x95d221,!![]);}catch(_0x363188){return BPromise['reject'](_0x363188);}return _0x344f01[_0xc759('0x1d')]();};}function saveUpdates(_0x2218fc,_0x33f06b){return function(_0x56e71b){if(_0x56e71b){return _0x56e71b[_0xc759('0x1e')](_0x2218fc)['then'](function(_0x5b5423){return _0x5b5423;});}return null;};}function removeEntity(_0xb53404,_0x35a7b5){return function(_0x3aeee6){if(_0x3aeee6){return _0x3aeee6[_0xc759('0x1f')]()[_0xc759('0x20')](function(){_0xb53404[_0xc759('0x14')](0xcc)[_0xc759('0x15')]();});}};}function handleEntityNotFound(_0x4edf10,_0x4fe029){return function(_0x49ee37){if(!_0x49ee37){_0x4edf10[_0xc759('0x21')](0x194);}return _0x49ee37;};}function handleError(_0x5381bb,_0x10ba3e){_0x10ba3e=_0x10ba3e||0x1f4;return function(_0x529a79){logger[_0xc759('0x22')](_0x529a79[_0xc759('0x23')]);if(_0x529a79['name']){delete _0x529a79['name'];}_0x5381bb[_0xc759('0x14')](_0x10ba3e)['send'](_0x529a79);};}exports[_0xc759('0x24')]=function(_0x544b78,_0x132ed3){var _0x224f02={},_0x2cdff1={},_0x665b8c={'count':0x0,'rows':[]};var _0x45d70d=db[_0xc759('0x25')]['rawAttributes'];_0x2cdff1[_0xc759('0x26')]=_['keys'](_0x45d70d);var _0x2b04e6={'dateStart':_0x544b78[_0xc759('0x27')][_0xc759('0x28')],'dateEnd':_0x544b78['query']['dateEnd']};delete _0x544b78['query'][_0xc759('0x28')];delete _0x544b78['query'][_0xc759('0x29')];_0x2cdff1[_0xc759('0x27')]=_[_0xc759('0x2a')](_0x544b78['query']);_0x2cdff1[_0xc759('0x2b')]=_['intersection'](_0x2cdff1['model'],_0x2cdff1[_0xc759('0x27')]);_0x224f02[_0xc759('0x2c')]=_[_0xc759('0x2d')](_0x2cdff1['model'],qs[_0xc759('0x2e')](_0x544b78['query'][_0xc759('0x2e')]));_0x224f02[_0xc759('0x2c')]=_0x224f02[_0xc759('0x2c')][_0xc759('0x2f')]?_0x224f02[_0xc759('0x2c')]:_0x2cdff1['model'];if(!_0x544b78[_0xc759('0x27')][_0xc759('0x30')](_0xc759('0x31'))){_0x224f02[_0xc759('0x19')]=qs['limit'](_0x544b78[_0xc759('0x27')]['limit']);_0x224f02[_0xc759('0x18')]=qs[_0xc759('0x18')](_0x544b78['query'][_0xc759('0x18')]);}_0x224f02['order']=qs[_0xc759('0x32')](_0x544b78[_0xc759('0x27')]['sort']);_0x224f02[_0xc759('0x33')]=qs[_0xc759('0x2b')](_[_0xc759('0x34')](_0x544b78[_0xc759('0x27')],_0x2cdff1[_0xc759('0x2b')]));if(_0x2b04e6[_0xc759('0x28')]){if(_0x2b04e6[_0xc759('0x29')]){_0x2b04e6['dateEnd']=moment(_0x2b04e6[_0xc759('0x29')])[_0xc759('0x35')](0x1,'day');}else{_0x2b04e6['dateEnd']=moment(_0x2b04e6[_0xc759('0x28')])[_0xc759('0x35')](0x1,_0xc759('0x36'));}_[_0xc759('0x37')](_0x224f02[_0xc759('0x33')],{'createdAt':{'$gte':_0x2b04e6[_0xc759('0x28')],'$lte':_0x2b04e6['dateEnd']}});}if(_0x544b78[_0xc759('0x27')]['filter']){_0x224f02[_0xc759('0x33')]=_['merge'](_0x224f02['where'],{'$or':_[_0xc759('0x38')](_0x224f02[_0xc759('0x2c')],function(_0x1be0e5){var _0x3d7447={};_0x3d7447[_0x1be0e5]={'$like':'%'+_0x544b78['query']['filter']+'%'};return _0x3d7447;})});}_0x224f02=_[_0xc759('0x37')]({},_0x224f02,_0x544b78['options']);var _0x5c1b58={'where':_0x224f02[_0xc759('0x33')]};return db[_0xc759('0x25')][_0xc759('0x17')](_0x5c1b58)[_0xc759('0x20')](function(_0x2d92c8){_0x665b8c['count']=_0x2d92c8;if(_0x544b78[_0xc759('0x27')][_0xc759('0x39')]){_0x224f02[_0xc759('0x3a')]=[{'all':!![]}];}return db[_0xc759('0x25')][_0xc759('0x3b')](_0x224f02);})[_0xc759('0x20')](function(_0x224e88){_0x665b8c[_0xc759('0x3c')]=_0x224e88;return _0x665b8c;})[_0xc759('0x20')](respondWithFilteredResult(_0x132ed3,_0x224f02))[_0xc759('0x3d')](handleError(_0x132ed3,null));};exports[_0xc759('0x3e')]=function(_0x449eea,_0x2b548a){var _0x5e08ed={'raw':!![],'where':{'id':_0x449eea[_0xc759('0x3f')]['id']}},_0x31ece0={};_0x31ece0[_0xc759('0x26')]=_[_0xc759('0x2a')](db[_0xc759('0x25')][_0xc759('0x40')]);_0x31ece0[_0xc759('0x27')]=_['keys'](_0x449eea[_0xc759('0x27')]);_0x31ece0[_0xc759('0x2b')]=_[_0xc759('0x2d')](_0x31ece0[_0xc759('0x26')],_0x31ece0['query']);_0x5e08ed[_0xc759('0x2c')]=_[_0xc759('0x2d')](_0x31ece0[_0xc759('0x26')],qs[_0xc759('0x2e')](_0x449eea['query'][_0xc759('0x2e')]));_0x5e08ed['attributes']=_0x5e08ed[_0xc759('0x2c')]['length']?_0x5e08ed['attributes']:_0x31ece0[_0xc759('0x26')];if(_0x449eea[_0xc759('0x27')][_0xc759('0x39')]){_0x5e08ed[_0xc759('0x3a')]=[{'all':!![]}];}_0x5e08ed=_[_0xc759('0x37')]({},_0x5e08ed,_0x449eea[_0xc759('0x41')]);return db[_0xc759('0x25')][_0xc759('0x42')](_0x5e08ed)['then'](handleEntityNotFound(_0x2b548a,null))[_0xc759('0x20')](respondWithResult(_0x2b548a,null))[_0xc759('0x3d')](handleError(_0x2b548a,null));};exports[_0xc759('0x43')]=function(_0x1c6847,_0x5277b5){return db[_0xc759('0x25')][_0xc759('0x43')](_0x1c6847[_0xc759('0x44')],{})[_0xc759('0x20')](respondWithResult(_0x5277b5,0xc9))[_0xc759('0x3d')](handleError(_0x5277b5,null));};exports[_0xc759('0x1e')]=function(_0x699d74,_0x2552b9){if(_0x699d74[_0xc759('0x44')]['id']){delete _0x699d74[_0xc759('0x44')]['id'];}return db[_0xc759('0x25')]['find']({'where':{'id':_0x699d74[_0xc759('0x3f')]['id']}})[_0xc759('0x20')](handleEntityNotFound(_0x2552b9,null))['then'](saveUpdates(_0x699d74[_0xc759('0x44')],null))[_0xc759('0x20')](respondWithResult(_0x2552b9,null))[_0xc759('0x3d')](handleError(_0x2552b9,null));};exports[_0xc759('0x1f')]=function(_0x29e572,_0x1940f8){return db[_0xc759('0x25')][_0xc759('0x42')]({'where':{'id':_0x29e572[_0xc759('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1940f8,null))[_0xc759('0x20')](removeEntity(_0x1940f8,null))[_0xc759('0x3d')](handleError(_0x1940f8,null));}; \ No newline at end of file +var _0x655f=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','save','update','then','end','error','name','send','index','VoiceQueuesLog','rawAttributes','query','dateStart','dateEnd','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filters','add','day','filter','map','merge','includeAll','include','catch','show','options','create','body','params','destroy','fast-json-patch','moment'];(function(_0x39fee5,_0x33f715){var _0x43c19d=function(_0xff661){while(--_0xff661){_0x39fee5['push'](_0x39fee5['shift']());}};_0x43c19d(++_0x33f715);}(_0x655f,0x7a));var _0xf655=function(_0x5a6f62,_0x15d15e){_0x5a6f62=_0x5a6f62-0x0;var _0x270441=_0x655f[_0x5a6f62];return _0x270441;};'use strict';var jsonpatch=require(_0xf655('0x0'));var rp=require('request-promise');var moment=require(_0xf655('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xf655('0x2'));var util=require(_0xf655('0x3'));var path=require('path');var sox=require(_0xf655('0x4'));var csv=require(_0xf655('0x5'));var ejs=require(_0xf655('0x6'));var fs=require('fs');var _=require(_0xf655('0x7'));var squel=require(_0xf655('0x8'));var crypto=require(_0xf655('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf655('0xa'));var Papa=require(_0xf655('0xb'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var utils=require(_0xf655('0xc'));var config=require('../../config/environment');var db=require(_0xf655('0xd'))['db'];function respondWithStatusCode(_0x172627,_0x16729a){_0x16729a=_0x16729a||0xcc;return function(_0xe59256){if(_0xe59256){return _0x172627[_0xf655('0xe')](_0x16729a);}return _0x172627['status'](_0x16729a)['end']();};}function respondWithResult(_0xb1b932,_0x304f80){_0x304f80=_0x304f80||0xc8;return function(_0x17cf53){if(_0x17cf53){return _0xb1b932[_0xf655('0xf')](_0x304f80)[_0xf655('0x10')](_0x17cf53);}};}function respondWithFilteredResult(_0x350a56,_0x8e914c){return function(_0x4f9acd){if(_0x4f9acd){var _0x4dbcc1=_0x4f9acd[_0xf655('0x11')],_0x2b732f=_0x8e914c['offset'],_0x58d480=_0x8e914c[_0xf655('0x12')]+_0x8e914c['limit'],_0x3b405d;if(_0x58d480>=_0x4dbcc1){_0x58d480=_0x4dbcc1;_0x3b405d=0xc8;}else{_0x3b405d=0xce;}_0x350a56[_0xf655('0xf')](_0x3b405d);return _0x350a56[_0xf655('0x13')](_0xf655('0x14'),_0x2b732f+'-'+_0x58d480+'/'+_0x4dbcc1)['json'](_0x4f9acd);}return null;};}function patchUpdates(_0x555bad){return function(_0x1ed512){try{jsonpatch[_0xf655('0x15')](_0x1ed512,_0x555bad,!![]);}catch(_0x3616ee){return BPromise['reject'](_0x3616ee);}return _0x1ed512[_0xf655('0x16')]();};}function saveUpdates(_0x89e85,_0x4c1f5f){return function(_0x3b0ffb){if(_0x3b0ffb){return _0x3b0ffb[_0xf655('0x17')](_0x89e85)[_0xf655('0x18')](function(_0x257cb4){return _0x257cb4;});}return null;};}function removeEntity(_0x12f11c,_0x5b9d8a){return function(_0x139fb0){if(_0x139fb0){return _0x139fb0['destroy']()[_0xf655('0x18')](function(){_0x12f11c[_0xf655('0xf')](0xcc)[_0xf655('0x19')]();});}};}function handleEntityNotFound(_0x252bc9,_0x48cd3a){return function(_0x27607c){if(!_0x27607c){_0x252bc9[_0xf655('0xe')](0x194);}return _0x27607c;};}function handleError(_0x2e9163,_0x1b994d){_0x1b994d=_0x1b994d||0x1f4;return function(_0x1091f6){logger[_0xf655('0x1a')](_0x1091f6['stack']);if(_0x1091f6[_0xf655('0x1b')]){delete _0x1091f6[_0xf655('0x1b')];}_0x2e9163[_0xf655('0xf')](_0x1b994d)[_0xf655('0x1c')](_0x1091f6);};}exports[_0xf655('0x1d')]=function(_0xcd77d5,_0x5a48c0){var _0x1b96d0={},_0x4dad27={},_0x42b2cc={'count':0x0,'rows':[]};var _0x212784=db[_0xf655('0x1e')][_0xf655('0x1f')];_0x4dad27['model']=_['keys'](_0x212784);var _0x458d21={'dateStart':_0xcd77d5[_0xf655('0x20')][_0xf655('0x21')],'dateEnd':_0xcd77d5[_0xf655('0x20')]['dateEnd']};delete _0xcd77d5['query']['dateStart'];delete _0xcd77d5[_0xf655('0x20')][_0xf655('0x22')];_0x4dad27['query']=_[_0xf655('0x23')](_0xcd77d5[_0xf655('0x20')]);_0x4dad27['filters']=_[_0xf655('0x24')](_0x4dad27[_0xf655('0x25')],_0x4dad27[_0xf655('0x20')]);_0x1b96d0[_0xf655('0x26')]=_['intersection'](_0x4dad27[_0xf655('0x25')],qs[_0xf655('0x27')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x27')]));_0x1b96d0['attributes']=_0x1b96d0[_0xf655('0x26')][_0xf655('0x28')]?_0x1b96d0[_0xf655('0x26')]:_0x4dad27[_0xf655('0x25')];if(!_0xcd77d5['query'][_0xf655('0x29')](_0xf655('0x2a'))){_0x1b96d0[_0xf655('0x2b')]=qs[_0xf655('0x2b')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x2b')]);_0x1b96d0[_0xf655('0x12')]=qs[_0xf655('0x12')](_0xcd77d5[_0xf655('0x20')][_0xf655('0x12')]);}_0x1b96d0['order']=qs['sort'](_0xcd77d5[_0xf655('0x20')][_0xf655('0x2c')]);_0x1b96d0[_0xf655('0x2d')]=qs['filters'](_[_0xf655('0x2e')](_0xcd77d5[_0xf655('0x20')],_0x4dad27[_0xf655('0x2f')]));if(_0x458d21[_0xf655('0x21')]){if(_0x458d21[_0xf655('0x22')]){_0x458d21['dateEnd']=moment(_0x458d21[_0xf655('0x22')])[_0xf655('0x30')](0x1,_0xf655('0x31'));}else{_0x458d21[_0xf655('0x22')]=moment(_0x458d21[_0xf655('0x21')])[_0xf655('0x30')](0x1,_0xf655('0x31'));}_['merge'](_0x1b96d0['where'],{'createdAt':{'$gte':_0x458d21[_0xf655('0x21')],'$lte':_0x458d21[_0xf655('0x22')]}});}if(_0xcd77d5[_0xf655('0x20')][_0xf655('0x32')]){_0x1b96d0[_0xf655('0x2d')]=_['merge'](_0x1b96d0[_0xf655('0x2d')],{'$or':_[_0xf655('0x33')](_0x1b96d0[_0xf655('0x26')],function(_0x4c0669){var _0x552b58={};_0x552b58[_0x4c0669]={'$like':'%'+_0xcd77d5[_0xf655('0x20')][_0xf655('0x32')]+'%'};return _0x552b58;})});}_0x1b96d0=_[_0xf655('0x34')]({},_0x1b96d0,_0xcd77d5['options']);var _0x36ab4a={'where':_0x1b96d0['where']};return db[_0xf655('0x1e')][_0xf655('0x11')](_0x36ab4a)[_0xf655('0x18')](function(_0x347949){_0x42b2cc['count']=_0x347949;if(_0xcd77d5['query'][_0xf655('0x35')]){_0x1b96d0[_0xf655('0x36')]=[{'all':!![]}];}return db[_0xf655('0x1e')]['findAll'](_0x1b96d0);})[_0xf655('0x18')](function(_0x137de2){_0x42b2cc['rows']=_0x137de2;return _0x42b2cc;})[_0xf655('0x18')](respondWithFilteredResult(_0x5a48c0,_0x1b96d0))[_0xf655('0x37')](handleError(_0x5a48c0,null));};exports[_0xf655('0x38')]=function(_0x569c79,_0x23cb97){var _0x53b515={'raw':!![],'where':{'id':_0x569c79['params']['id']}},_0x42a1cd={};_0x42a1cd[_0xf655('0x25')]=_[_0xf655('0x23')](db[_0xf655('0x1e')][_0xf655('0x1f')]);_0x42a1cd['query']=_['keys'](_0x569c79[_0xf655('0x20')]);_0x42a1cd[_0xf655('0x2f')]=_[_0xf655('0x24')](_0x42a1cd[_0xf655('0x25')],_0x42a1cd[_0xf655('0x20')]);_0x53b515[_0xf655('0x26')]=_['intersection'](_0x42a1cd[_0xf655('0x25')],qs['fields'](_0x569c79[_0xf655('0x20')][_0xf655('0x27')]));_0x53b515[_0xf655('0x26')]=_0x53b515[_0xf655('0x26')][_0xf655('0x28')]?_0x53b515[_0xf655('0x26')]:_0x42a1cd[_0xf655('0x25')];if(_0x569c79[_0xf655('0x20')][_0xf655('0x35')]){_0x53b515['include']=[{'all':!![]}];}_0x53b515=_[_0xf655('0x34')]({},_0x53b515,_0x569c79[_0xf655('0x39')]);return db['VoiceQueuesLog']['find'](_0x53b515)[_0xf655('0x18')](handleEntityNotFound(_0x23cb97,null))[_0xf655('0x18')](respondWithResult(_0x23cb97,null))[_0xf655('0x37')](handleError(_0x23cb97,null));};exports[_0xf655('0x3a')]=function(_0x578db0,_0x28972b){return db[_0xf655('0x1e')]['create'](_0x578db0['body'],{})['then'](respondWithResult(_0x28972b,0xc9))['catch'](handleError(_0x28972b,null));};exports[_0xf655('0x17')]=function(_0x12e58c,_0x307f6e){if(_0x12e58c['body']['id']){delete _0x12e58c[_0xf655('0x3b')]['id'];}return db[_0xf655('0x1e')]['find']({'where':{'id':_0x12e58c[_0xf655('0x3c')]['id']}})[_0xf655('0x18')](handleEntityNotFound(_0x307f6e,null))[_0xf655('0x18')](saveUpdates(_0x12e58c[_0xf655('0x3b')],null))['then'](respondWithResult(_0x307f6e,null))[_0xf655('0x37')](handleError(_0x307f6e,null));};exports[_0xf655('0x3d')]=function(_0x293a17,_0x25eb5f){return db[_0xf655('0x1e')]['find']({'where':{'id':_0x293a17[_0xf655('0x3c')]['id']}})[_0xf655('0x18')](handleEntityNotFound(_0x25eb5f,null))[_0xf655('0x18')](removeEntity(_0x25eb5f,null))[_0xf655('0x37')](handleError(_0x25eb5f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 0d0343d..8f432c4 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 _0x2dcf=['dtm','util','api','moment','bluebird','request-promise','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm'];(function(_0xa3a07f,_0x4c8cd1){var _0x258f8f=function(_0xb7063f){while(--_0xb7063f){_0xa3a07f['push'](_0xa3a07f['shift']());}};_0x258f8f(++_0x4c8cd1);}(_0x2dcf,0x11f));var _0xf2dc=function(_0x5a6e7b,_0x18905f){_0x5a6e7b=_0x5a6e7b-0x0;var _0x4af6ff=_0x2dcf[_0x5a6e7b];return _0x4af6ff;};'use strict';var _=require('lodash');var util=require(_0xf2dc('0x0'));var logger=require('../../config/logger')(_0xf2dc('0x1'));var moment=require(_0xf2dc('0x2'));var BPromise=require(_0xf2dc('0x3'));var rp=require(_0xf2dc('0x4'));var attributes=require(_0xf2dc('0x5'));module[_0xf2dc('0x6')]=function(_0x3bc1e3,_0x4d7f3d){return _0x3bc1e3['define'](_0xf2dc('0x7'),attributes,{'tableName':_0xf2dc('0x8'),'paranoid':![],'indexes':[{'name':_0xf2dc('0x9'),'fields':['event',_0xf2dc('0xa')]}],'timestamps':![]});}; \ No newline at end of file +var _0x92ca=['VoiceQueuesLog','voice_queues_log','event_dtm','event','util','api','moment','bluebird'];(function(_0x16fdfb,_0x5e5918){var _0x496ec0=function(_0x4e0cc8){while(--_0x4e0cc8){_0x16fdfb['push'](_0x16fdfb['shift']());}};_0x496ec0(++_0x5e5918);}(_0x92ca,0x16c));var _0xa92c=function(_0x5baadf,_0x1bb942){_0x5baadf=_0x5baadf-0x0;var _0x3cd985=_0x92ca[_0x5baadf];return _0x3cd985;};'use strict';var _=require('lodash');var util=require(_0xa92c('0x0'));var logger=require('../../config/logger')(_0xa92c('0x1'));var moment=require(_0xa92c('0x2'));var BPromise=require(_0xa92c('0x3'));var rp=require('request-promise');var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1fa08a,_0x21260c){return _0x1fa08a['define'](_0xa92c('0x4'),attributes,{'tableName':_0xa92c('0x5'),'paranoid':![],'indexes':[{'name':_0xa92c('0x6'),'fields':[_0xa92c('0x7'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index a6d7712..a1ac5bc 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 _0xd00a=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','info','result'];(function(_0x1ddb2c,_0x59f5ee){var _0x2d7f1d=function(_0x376dec){while(--_0x376dec){_0x1ddb2c['push'](_0x1ddb2c['shift']());}};_0x2d7f1d(++_0x59f5ee);}(_0xd00a,0x1e3));var _0xad00=function(_0x119b01,_0x44c864){_0x119b01=_0x119b01-0x0;var _0x5d8997=_0xd00a[_0x119b01];return _0x5d8997;};'use strict';var _=require(_0xad00('0x0'));var util=require(_0xad00('0x1'));var moment=require(_0xad00('0x2'));var BPromise=require('bluebird');var rs=require(_0xad00('0x3'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0xad00('0x4'));var logger=require(_0xad00('0x5'))(_0xad00('0x6'));var config=require(_0xad00('0x7'));var jayson=require(_0xad00('0x8'));var client=jayson[_0xad00('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x375073,_0x1592d0,_0x20d2a1){return new BPromise(function(_0x506a81,_0x440358){return client['request'](_0x375073,_0x20d2a1)[_0xad00('0xa')](function(_0x56b095){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x1592d0,'request\x20sent');logger[_0xad00('0xb')](_0xad00('0xc'),_0x1592d0,_0xad00('0xd'),JSON[_0xad00('0xe')](_0x56b095));if(_0x56b095[_0xad00('0xf')]){if(_0x56b095['error'][_0xad00('0x10')]===0x1f4){logger[_0xad00('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1592d0,_0x56b095[_0xad00('0xf')][_0xad00('0x11')]);return _0x440358(_0x56b095[_0xad00('0xf')][_0xad00('0x11')]);}logger[_0xad00('0xf')](_0xad00('0x12'),_0x1592d0,_0x56b095[_0xad00('0xf')][_0xad00('0x11')]);return _0x506a81(_0x56b095[_0xad00('0xf')][_0xad00('0x11')]);}else{logger[_0xad00('0x13')](_0xad00('0x12'),_0x1592d0,'request\x20sent');_0x506a81(_0x56b095[_0xad00('0x14')][_0xad00('0x11')]);}})['catch'](function(_0x26f8f8){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1592d0,_0x26f8f8);_0x440358(_0x26f8f8);});});} \ No newline at end of file +var _0x9703=['info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','request','then'];(function(_0x13a913,_0x400d93){var _0xbf71de=function(_0xc750b5){while(--_0xc750b5){_0x13a913['push'](_0x13a913['shift']());}};_0xbf71de(++_0x400d93);}(_0x9703,0xdb));var _0x3970=function(_0x304fbd,_0x401f58){_0x304fbd=_0x304fbd-0x0;var _0x3a4448=_0x9703[_0x304fbd];return _0x3a4448;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3970('0x0'));var BPromise=require(_0x3970('0x1'));var rs=require(_0x3970('0x2'));var fs=require('fs');var db=require('../../mysqldb')['db'];var utils=require(_0x3970('0x3'));var logger=require('../../config/logger')(_0x3970('0x4'));var config=require('../../config/environment');var jayson=require(_0x3970('0x5'));var client=jayson[_0x3970('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5669ec,_0x21986b,_0x1bf4d6){return new BPromise(function(_0x282355,_0x41d4d1){return client[_0x3970('0x7')](_0x5669ec,_0x1bf4d6)[_0x3970('0x8')](function(_0x239d07){logger[_0x3970('0x9')]('VoiceQueuesLog,\x20%s,\x20%s',_0x21986b,_0x3970('0xa'));logger[_0x3970('0xb')](_0x3970('0xc'),_0x21986b,'request\x20sent',JSON[_0x3970('0xd')](_0x239d07));if(_0x239d07[_0x3970('0xe')]){if(_0x239d07['error'][_0x3970('0xf')]===0x1f4){logger[_0x3970('0xe')](_0x3970('0x10'),_0x21986b,_0x239d07[_0x3970('0xe')]['message']);return _0x41d4d1(_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);}logger[_0x3970('0xe')](_0x3970('0x10'),_0x21986b,_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);return _0x282355(_0x239d07[_0x3970('0xe')][_0x3970('0x11')]);}else{logger['info'](_0x3970('0x10'),_0x21986b,_0x3970('0xa'));_0x282355(_0x239d07['result'][_0x3970('0x11')]);}})[_0x3970('0x12')](function(_0x5dc2f7){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x21986b,_0x5dc2f7);_0x41d4d1(_0x5dc2f7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f4686f1..6c1aaf0 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 _0xdbbe=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/download','download','/:id/downloads','post','create','put','update','delete','destroy','util','path'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xdbbe,0x148));var _0xedbb=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xdbbe[_0x4b2436];return _0x4f5ab2;};'use strict';var multer=require('multer');var util=require(_0xedbb('0x0'));var path=require(_0xedbb('0x1'));var express=require(_0xedbb('0x2'));var router=express[_0xedbb('0x3')]();var auth=require(_0xedbb('0x4'));var interaction=require(_0xedbb('0x5'));var config=require('../../config/environment');var controller=require(_0xedbb('0x6'));router[_0xedbb('0x7')]('/',auth[_0xedbb('0x8')](),controller[_0xedbb('0x9')]);router[_0xedbb('0x7')](_0xedbb('0xa'),auth[_0xedbb('0x8')](),controller['describe']);router[_0xedbb('0x7')](_0xedbb('0xb'),auth['isAuthenticated'](),controller[_0xedbb('0xc')]);router['get'](_0xedbb('0xd'),auth[_0xedbb('0x8')](),controller[_0xedbb('0xe')]);router['get'](_0xedbb('0xf'),controller['downloads']);router[_0xedbb('0x10')]('/',auth[_0xedbb('0x8')](),controller[_0xedbb('0x11')]);router[_0xedbb('0x12')]('/:id',auth[_0xedbb('0x8')](),controller[_0xedbb('0x13')]);router[_0xedbb('0x14')](_0xedbb('0xb'),auth[_0xedbb('0x8')](),controller[_0xedbb('0x15')]);module['exports']=router; \ No newline at end of file +var _0xc999=['util','path','express','./voiceRecording.controller','isAuthenticated','get','/describe','/:id','show','/:id/download','download','/:id/downloads','downloads','create','put','destroy','exports'];(function(_0x15c6b1,_0x327487){var _0x583e13=function(_0x342c09){while(--_0x342c09){_0x15c6b1['push'](_0x15c6b1['shift']());}};_0x583e13(++_0x327487);}(_0xc999,0x176));var _0x9c99=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xc999[_0x4c7935];return _0x30651d;};'use strict';var multer=require('multer');var util=require(_0x9c99('0x0'));var path=require(_0x9c99('0x1'));var express=require(_0x9c99('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9c99('0x3'));router['get']('/',auth[_0x9c99('0x4')](),controller['index']);router[_0x9c99('0x5')](_0x9c99('0x6'),auth[_0x9c99('0x4')](),controller['describe']);router[_0x9c99('0x5')](_0x9c99('0x7'),auth[_0x9c99('0x4')](),controller[_0x9c99('0x8')]);router[_0x9c99('0x5')](_0x9c99('0x9'),auth['isAuthenticated'](),controller[_0x9c99('0xa')]);router[_0x9c99('0x5')](_0x9c99('0xb'),controller[_0x9c99('0xc')]);router['post']('/',auth[_0x9c99('0x4')](),controller[_0x9c99('0xd')]);router[_0x9c99('0xe')]('/:id',auth[_0x9c99('0x4')](),controller['update']);router['delete'](_0x9c99('0x7'),auth[_0x9c99('0x4')](),controller[_0x9c99('0xf')]);module[_0x9c99('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1829a2f..4415fea 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 _0x87f8=['getDataValue','extname','value','STRING','setDataValue','channel','membername','split','INTEGER','DATE','format','MM-DD-YYYY\x20HH:mm','updatedAt','toString','sequelize','path','exports','VIRTUAL'];(function(_0x4b4721,_0x5aa7ad){var _0x2a2655=function(_0x135de8){while(--_0x135de8){_0x4b4721['push'](_0x4b4721['shift']());}};_0x2a2655(++_0x5aa7ad);}(_0x87f8,0x8c));var _0x887f=function(_0x277854,_0x20e266){_0x277854=_0x277854-0x0;var _0x3e3684=_0x87f8[_0x277854];return _0x3e3684;};'use strict';var Sequelize=require(_0x887f('0x0'));var moment=require('moment');var path=require(_0x887f('0x1'));module[_0x887f('0x2')]={'format':{'type':Sequelize[_0x887f('0x3')],'get':function(){return this[_0x887f('0x4')]('value')?path[_0x887f('0x5')](this[_0x887f('0x4')](_0x887f('0x6'))):undefined;}},'uniqueid':{'type':Sequelize[_0x887f('0x7')]},'channel':{'type':Sequelize['STRING'],'set':function(_0x4ee09a){if(_0x4ee09a){this[_0x887f('0x8')](_0x887f('0x9'),_0x4ee09a);this[_0x887f('0x8')](_0x887f('0xa'),_0x4ee09a[_0x887f('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x887f('0x7')]},'calleridnum':{'type':Sequelize[_0x887f('0x7')]},'calleridname':{'type':Sequelize[_0x887f('0x7')]},'connectedlinenum':{'type':Sequelize[_0x887f('0x7')]},'connectedlinename':{'type':Sequelize[_0x887f('0x7')]},'accountcode':{'type':Sequelize[_0x887f('0x7')]},'context':{'type':Sequelize[_0x887f('0x7')]},'exten':{'type':Sequelize[_0x887f('0x7')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x887f('0x7')]},'rating':{'type':Sequelize[_0x887f('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x887f('0x7')]},'createdAt':{'type':Sequelize[_0x887f('0xd')],'get':function(){return moment(this[_0x887f('0x4')]('createdAt'))[_0x887f('0xe')](_0x887f('0xf'))['toString']();}},'updatedAt':{'type':Sequelize[_0x887f('0xd')],'get':function(){return moment(this['getDataValue'](_0x887f('0x10')))[_0x887f('0xe')](_0x887f('0xf'))[_0x887f('0x11')]();}}}; \ No newline at end of file +var _0x0426=['STRING','setDataValue','channel','membername','split','INTEGER','DATE','createdAt','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','path','exports','VIRTUAL','getDataValue','value','extname'];(function(_0xf0957e,_0x52b79b){var _0x4616db=function(_0x481bf3){while(--_0x481bf3){_0xf0957e['push'](_0xf0957e['shift']());}};_0x4616db(++_0x52b79b);}(_0x0426,0x116));var _0x6042=function(_0x20a2ed,_0x2f4590){_0x20a2ed=_0x20a2ed-0x0;var _0x5e39ed=_0x0426[_0x20a2ed];return _0x5e39ed;};'use strict';var Sequelize=require(_0x6042('0x0'));var moment=require('moment');var path=require(_0x6042('0x1'));module[_0x6042('0x2')]={'format':{'type':Sequelize[_0x6042('0x3')],'get':function(){return this[_0x6042('0x4')](_0x6042('0x5'))?path[_0x6042('0x6')](this['getDataValue'](_0x6042('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x6042('0x7')]},'channel':{'type':Sequelize[_0x6042('0x7')],'set':function(_0x5a8c82){if(_0x5a8c82){this[_0x6042('0x8')](_0x6042('0x9'),_0x5a8c82);this['setDataValue'](_0x6042('0xa'),_0x5a8c82[_0x6042('0xb')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x6042('0x7')]},'calleridnum':{'type':Sequelize[_0x6042('0x7')]},'calleridname':{'type':Sequelize[_0x6042('0x7')]},'connectedlinenum':{'type':Sequelize[_0x6042('0x7')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6042('0x7')]},'context':{'type':Sequelize[_0x6042('0x7')]},'exten':{'type':Sequelize[_0x6042('0x7')]},'value':{'type':Sequelize[_0x6042('0x7')]},'type':{'type':Sequelize[_0x6042('0x7')]},'rating':{'type':Sequelize[_0x6042('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'createdAt':{'type':Sequelize[_0x6042('0xd')],'get':function(){return moment(this[_0x6042('0x4')](_0x6042('0xe')))[_0x6042('0xf')](_0x6042('0x10'))[_0x6042('0x11')]();}},'updatedAt':{'type':Sequelize[_0x6042('0xd')],'get':function(){return moment(this[_0x6042('0x4')](_0x6042('0x12')))['format'](_0x6042('0x10'))[_0x6042('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 58e20d6..c999916 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 _0x1261=['Content-Range','apply','then','sendStatus','stack','send','index','rawAttributes','model','differenceBy','query','dateEnd','dateStart','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','add','day','merge','filter','options','VoiceRecording','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','../../components/encryptor','type','uniqueid','value','%s.cypher','existsSync','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','download','unlink','downloads','sequelize','col','token','$and','push','format','decryptFile','recording','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','count','offset'];(function(_0x2c6173,_0xf5a90a){var _0x1c64af=function(_0x3d64f1){while(--_0x3d64f1){_0x2c6173['push'](_0x2c6173['shift']());}};_0x1c64af(++_0xf5a90a);}(_0x1261,0x144));var _0x1126=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x1261[_0x32bb6b];return _0x58dcb4;};'use strict';var jsonpatch=require('fast-json-patch');var rp=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var Mustache=require(_0x1126('0x3'));var util=require(_0x1126('0x4'));var path=require(_0x1126('0x5'));var sox=require(_0x1126('0x6'));var csv=require(_0x1126('0x7'));var ejs=require(_0x1126('0x8'));var fs=require('fs');var _=require(_0x1126('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1126('0xa'));var deskjs=require(_0x1126('0xb'));var toCsv=require('to-csv');var querystring=require(_0x1126('0xc'));var Papa=require(_0x1126('0xd'));var qs=require(_0x1126('0xe'));var logger=require(_0x1126('0xf'))(_0x1126('0x10'));var utils=require('../../config/utils');var config=require(_0x1126('0x11'));var db=require(_0x1126('0x12'))['db'];function respondWithStatusCode(_0x167ef1,_0x5e72e2){_0x5e72e2=_0x5e72e2||0xcc;return function(_0x34571c){if(_0x34571c){return _0x167ef1['sendStatus'](_0x5e72e2);}return _0x167ef1['status'](_0x5e72e2)[_0x1126('0x13')]();};}function respondWithResult(_0x561b93,_0x15e89b){_0x15e89b=_0x15e89b||0xc8;return function(_0x1b364a){if(_0x1b364a){return _0x561b93[_0x1126('0x14')](_0x15e89b)[_0x1126('0x15')](_0x1b364a);}};}function respondWithFilteredResult(_0xca0355,_0x3f10e9){return function(_0xd8ca42){if(_0xd8ca42){var _0x2048ad=_0xd8ca42[_0x1126('0x16')],_0x43850b=_0x3f10e9[_0x1126('0x17')],_0x53a8f0=_0x3f10e9[_0x1126('0x17')]+_0x3f10e9['limit'],_0x5de9a7;if(_0x53a8f0>=_0x2048ad){_0x53a8f0=_0x2048ad;_0x5de9a7=0xc8;}else{_0x5de9a7=0xce;}_0xca0355[_0x1126('0x14')](_0x5de9a7);return _0xca0355['set'](_0x1126('0x18'),_0x43850b+'-'+_0x53a8f0+'/'+_0x2048ad)[_0x1126('0x15')](_0xd8ca42);}return null;};}function patchUpdates(_0x257b5f){return function(_0x4e1c97){try{jsonpatch[_0x1126('0x19')](_0x4e1c97,_0x257b5f,!![]);}catch(_0x1695f6){return BPromise['reject'](_0x1695f6);}return _0x4e1c97['save']();};}function saveUpdates(_0x22ae0b,_0x2b2487){return function(_0x58d11a){if(_0x58d11a){return _0x58d11a['update'](_0x22ae0b)[_0x1126('0x1a')](function(_0x58b109){return _0x58b109;});}return null;};}function removeEntity(_0x22ed37,_0x1d6d19){return function(_0x2f70ac){if(_0x2f70ac){return _0x2f70ac['destroy']()[_0x1126('0x1a')](function(){_0x22ed37['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30f6b3,_0x3a9bed){return function(_0x25b24b){if(!_0x25b24b){_0x30f6b3[_0x1126('0x1b')](0x194);}return _0x25b24b;};}function handleError(_0x526ca1,_0x29ab60){_0x29ab60=_0x29ab60||0x1f4;return function(_0x477e6a){logger['error'](_0x477e6a[_0x1126('0x1c')]);if(_0x477e6a['name']){delete _0x477e6a['name'];}_0x526ca1['status'](_0x29ab60)[_0x1126('0x1d')](_0x477e6a);};}exports[_0x1126('0x1e')]=function(_0x329914,_0x34bcf1){var _0x566c09={},_0x1b07a7={},_0xea0971={'count':0x0,'rows':[]};var _0x38119d=db['VoiceRecording'][_0x1126('0x1f')];_0x1b07a7[_0x1126('0x20')]=_[_0x1126('0x21')](_['keys'](_0x38119d),['format']);var _0xeb7d89={'dateStart':_0x329914[_0x1126('0x22')]['dateStart'],'dateEnd':_0x329914[_0x1126('0x22')][_0x1126('0x23')]};delete _0x329914['query'][_0x1126('0x24')];delete _0x329914['query'][_0x1126('0x23')];_0x1b07a7['query']=_[_0x1126('0x25')](_0x329914['query']);_0x1b07a7[_0x1126('0x26')]=_['intersection'](_0x1b07a7['model'],_0x1b07a7['query']);_0x566c09[_0x1126('0x27')]=_[_0x1126('0x28')](_0x1b07a7[_0x1126('0x20')],qs['fields'](_0x329914[_0x1126('0x22')][_0x1126('0x29')]));_0x566c09['attributes']=_0x566c09[_0x1126('0x27')][_0x1126('0x2a')]?_0x566c09[_0x1126('0x27')]:_0x1b07a7[_0x1126('0x20')];if(!_0x329914['query']['hasOwnProperty'](_0x1126('0x2b'))){_0x566c09[_0x1126('0x2c')]=qs[_0x1126('0x2c')](_0x329914[_0x1126('0x22')]['limit']);_0x566c09[_0x1126('0x17')]=qs[_0x1126('0x17')](_0x329914[_0x1126('0x22')][_0x1126('0x17')]);}_0x566c09[_0x1126('0x2d')]=qs['sort'](_0x329914[_0x1126('0x22')][_0x1126('0x2e')]);_0x566c09[_0x1126('0x2f')]=qs[_0x1126('0x26')](_['pick'](_0x329914['query'],_0x1b07a7[_0x1126('0x26')]));if(_0xeb7d89[_0x1126('0x24')]){if(_0xeb7d89['dateEnd']){_0xeb7d89[_0x1126('0x23')]=moment(_0xeb7d89[_0x1126('0x23')])[_0x1126('0x30')](0x1,'day');}else{_0xeb7d89['dateEnd']=moment(_0xeb7d89[_0x1126('0x24')])[_0x1126('0x30')](0x1,_0x1126('0x31'));}_[_0x1126('0x32')](_0x566c09['where'],{'createdAt':{'$gte':_0xeb7d89[_0x1126('0x24')],'$lte':_0xeb7d89['dateEnd']}});}if(_0x329914[_0x1126('0x22')][_0x1126('0x33')]){_0x566c09[_0x1126('0x2f')]=_[_0x1126('0x32')](_0x566c09[_0x1126('0x2f')],{'$or':_['map'](_0x566c09[_0x1126('0x27')],function(_0x3ea9de){var _0x2939a9={};_0x2939a9[_0x3ea9de]={'$like':'%'+_0x329914[_0x1126('0x22')][_0x1126('0x33')]+'%'};return _0x2939a9;})});}_0x566c09=_[_0x1126('0x32')]({},_0x566c09,_0x329914[_0x1126('0x34')]);var _0x4faaa3={'where':_0x566c09[_0x1126('0x2f')]};return db[_0x1126('0x35')][_0x1126('0x16')](_0x4faaa3)[_0x1126('0x1a')](function(_0xcf0483){_0xea0971['count']=_0xcf0483;if(_0x329914['query'][_0x1126('0x36')]){_0x566c09[_0x1126('0x37')]=[{'all':!![]}];}return db[_0x1126('0x35')][_0x1126('0x38')](_0x566c09);})[_0x1126('0x1a')](function(_0x276fd5){_0xea0971['rows']=_0x276fd5;return _0xea0971;})['then'](respondWithFilteredResult(_0x34bcf1,_0x566c09))['catch'](handleError(_0x34bcf1,null));};exports[_0x1126('0x39')]=function(_0x5d4194,_0xf84005){var _0x462da8={'raw':![],'where':{'id':_0x5d4194[_0x1126('0x3a')]['id']}},_0x3584a3={};_0x3584a3['model']=_['keys'](db[_0x1126('0x35')][_0x1126('0x1f')]);_0x3584a3[_0x1126('0x22')]=_['keys'](_0x5d4194[_0x1126('0x22')]);_0x3584a3['filters']=_[_0x1126('0x28')](_0x3584a3['model'],_0x3584a3[_0x1126('0x22')]);_0x462da8[_0x1126('0x27')]=_[_0x1126('0x28')](_0x3584a3['model'],qs[_0x1126('0x29')](_0x5d4194[_0x1126('0x22')][_0x1126('0x29')]));_0x462da8['attributes']=_0x462da8['attributes']['length']?_0x462da8[_0x1126('0x27')]:_0x3584a3['model'];if(_0x5d4194[_0x1126('0x22')]['includeAll']){_0x462da8[_0x1126('0x37')]=[{'all':!![]}];}_0x462da8=_[_0x1126('0x32')]({},_0x462da8,_0x5d4194[_0x1126('0x34')]);return db[_0x1126('0x35')][_0x1126('0x3b')](_0x462da8)['then'](handleEntityNotFound(_0xf84005,null))[_0x1126('0x1a')](respondWithResult(_0xf84005,null))[_0x1126('0x3c')](handleError(_0xf84005,null));};exports['create']=function(_0x1a15f8,_0x13dc39){return db['VoiceRecording'][_0x1126('0x3d')](_0x1a15f8[_0x1126('0x3e')],{})['then'](respondWithResult(_0x13dc39,0xc9))[_0x1126('0x3c')](handleError(_0x13dc39,null));};exports[_0x1126('0x3f')]=function(_0x213a76,_0x59656d){if(_0x213a76[_0x1126('0x3e')]['id']){delete _0x213a76[_0x1126('0x3e')]['id'];}return db[_0x1126('0x35')][_0x1126('0x3b')]({'where':{'id':_0x213a76[_0x1126('0x3a')]['id']}})[_0x1126('0x1a')](handleEntityNotFound(_0x59656d,null))[_0x1126('0x1a')](saveUpdates(_0x213a76[_0x1126('0x3e')],null))['then'](respondWithResult(_0x59656d,null))[_0x1126('0x3c')](handleError(_0x59656d,null));};exports['destroy']=function(_0x40168e,_0x2ad118){return db['VoiceRecording']['find']({'where':{'id':_0x40168e[_0x1126('0x3a')]['id']}})[_0x1126('0x1a')](handleEntityNotFound(_0x2ad118,null))[_0x1126('0x1a')](removeEntity(_0x2ad118,null))['catch'](handleError(_0x2ad118,null));};exports[_0x1126('0x40')]=function(_0x3506d7,_0x3ea23f){return db[_0x1126('0x35')]['describe']()[_0x1126('0x1a')](respondWithResult(_0x3ea23f,null))[_0x1126('0x3c')](handleError(_0x3ea23f,null));};exports['download']=function(_0x4bcc08,_0x4abb4d,_0x526b07){var _0x386c10=require(_0x1126('0x41'));var _0x4dc8cd=![];var _0x16552b={};if(_0x4bcc08[_0x1126('0x22')][_0x1126('0x42')]&&_0x4bcc08[_0x1126('0x22')][_0x1126('0x42')]==='uniqueid'){_0x16552b[_0x1126('0x43')]=_0x4bcc08[_0x1126('0x3a')]['id'];}else{_0x16552b['id']=_0x4bcc08['params']['id'];}return db[_0x1126('0x35')][_0x1126('0x3b')]({'where':_0x16552b,'attributes':['id',_0x1126('0x44')],'raw':!![]})[_0x1126('0x1a')](handleEntityNotFound(_0x4abb4d,null))[_0x1126('0x1a')](function(_0x59c3d0){if(_0x59c3d0){var _0x673c09=util['format'](_0x1126('0x45'),_0x59c3d0[_0x1126('0x44')]);if(fs[_0x1126('0x46')](_0x673c09)){_0x4dc8cd=!![];return _0x386c10['decryptFile'](_0x673c09,_0x59c3d0[_0x1126('0x44')],config[_0x1126('0x47')]['recording'])[_0x1126('0x1a')](function(){return _0x59c3d0;});}return _0x59c3d0;}})[_0x1126('0x1a')](function(_0x9bad53){if(_0x9bad53){if(!fs['existsSync'](_0x9bad53[_0x1126('0x44')])){throw new db[(_0x1126('0x48'))][(_0x1126('0x49'))](_0x1126('0x4a'));}if(_0x9bad53[_0x1126('0x4b')]){return _0x4abb4d[_0x1126('0x4c')](_0x9bad53[_0x1126('0x44')],_0x9bad53[_0x1126('0x4b')]+path['extname'](_0x9bad53[_0x1126('0x44')]),function(){if(_0x4dc8cd){fs[_0x1126('0x4d')](_0x9bad53[_0x1126('0x44')]);}});}else{return _0x4abb4d[_0x1126('0x4c')](_0x9bad53[_0x1126('0x44')],function(_0x4f5772){if(_0x4dc8cd){fs[_0x1126('0x4d')](_0x9bad53[_0x1126('0x44')]);}});}}})['catch'](handleError(_0x4abb4d,null));};exports[_0x1126('0x4e')]=function(_0x5246aa,_0x272274,_0x10ff91){var _0x478806=require(_0x1126('0x41'));var _0x21d4ef=![];var _0x375b76={'$and':[db['sequelize'][_0x1126('0x2f')](db['sequelize']['fn']('MD5',db[_0x1126('0x4f')][_0x1126('0x50')](_0x1126('0x43'))),_0x5246aa[_0x1126('0x22')][_0x1126('0x51')])]};if(_0x5246aa[_0x1126('0x22')][_0x1126('0x42')]&&_0x5246aa['query'][_0x1126('0x42')]===_0x1126('0x43')){_0x375b76[_0x1126('0x52')][_0x1126('0x53')]({'uniqueid':_0x5246aa[_0x1126('0x3a')]['id']});}else{_0x375b76[_0x1126('0x52')]['push']({'id':_0x5246aa['params']['id']});}return db[_0x1126('0x35')][_0x1126('0x3b')]({'where':_0x375b76,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x272274,null))['then'](function(_0x51a28d){if(_0x51a28d){var _0x964a2=util[_0x1126('0x54')](_0x1126('0x45'),_0x51a28d['value']);if(fs[_0x1126('0x46')](_0x964a2)){_0x21d4ef=!![];return _0x478806[_0x1126('0x55')](_0x964a2,_0x51a28d[_0x1126('0x44')],config[_0x1126('0x47')][_0x1126('0x56')])[_0x1126('0x1a')](function(){return _0x51a28d;});}return _0x51a28d;}})[_0x1126('0x1a')](function(_0x49a0a3){if(_0x49a0a3){if(!fs[_0x1126('0x46')](_0x49a0a3[_0x1126('0x44')])){throw new db[(_0x1126('0x48'))][(_0x1126('0x49'))](_0x1126('0x4a'));}if(_0x49a0a3['filename']){return _0x272274['download'](_0x49a0a3[_0x1126('0x44')],_0x49a0a3[_0x1126('0x4b')]+path['extname'](_0x49a0a3[_0x1126('0x44')]),function(){if(_0x21d4ef){fs[_0x1126('0x4d')](_0x49a0a3[_0x1126('0x44')]);}});}else{return _0x272274[_0x1126('0x4c')](_0x49a0a3[_0x1126('0x44')],function(_0x30d240){if(_0x21d4ef){fs[_0x1126('0x4d')](_0x49a0a3[_0x1126('0x44')]);}});}}})[_0x1126('0x3c')](handleError(_0x272274,null));}; \ No newline at end of file +var _0xdb28=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','name','rawAttributes','model','differenceBy','keys','query','dateStart','dateEnd','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','filters','add','day','merge','filter','map','options','VoiceRecording','includeAll','include','rows','catch','show','params','find','create','body','describe','download','type','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','downloads','../../components/encryptor','sequelize','MD5','col','token','push','$and','format','secrets','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x153c74,_0x4a096d){var _0x4f1d90=function(_0x3cd766){while(--_0x3cd766){_0x153c74['push'](_0x153c74['shift']());}};_0x4f1d90(++_0x4a096d);}(_0xdb28,0x106));var _0x8db2=function(_0x2fc1d9,_0x5d4048){_0x2fc1d9=_0x2fc1d9-0x0;var _0x326c4a=_0xdb28[_0x2fc1d9];return _0x326c4a;};'use strict';var jsonpatch=require(_0x8db2('0x0'));var rp=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var Mustache=require('mustache');var util=require(_0x8db2('0x4'));var path=require(_0x8db2('0x5'));var sox=require(_0x8db2('0x6'));var csv=require(_0x8db2('0x7'));var ejs=require(_0x8db2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0x9'));var crypto=require(_0x8db2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8db2('0x7'));var querystring=require(_0x8db2('0xb'));var Papa=require(_0x8db2('0xc'));var qs=require(_0x8db2('0xd'));var logger=require(_0x8db2('0xe'))(_0x8db2('0xf'));var utils=require(_0x8db2('0x10'));var config=require('../../config/environment');var db=require(_0x8db2('0x11'))['db'];function respondWithStatusCode(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xcc;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0x12')](_0x1f62af);}return _0x476216[_0x8db2('0x13')](_0x1f62af)['end']();};}function respondWithResult(_0x41beda,_0x3b2faa){_0x3b2faa=_0x3b2faa||0xc8;return function(_0x1349f6){if(_0x1349f6){return _0x41beda[_0x8db2('0x13')](_0x3b2faa)[_0x8db2('0x14')](_0x1349f6);}};}function respondWithFilteredResult(_0x559fb1,_0x49fadc){return function(_0x15070d){if(_0x15070d){var _0x15e87c=_0x15070d[_0x8db2('0x15')],_0x350d61=_0x49fadc[_0x8db2('0x16')],_0x1d6a15=_0x49fadc[_0x8db2('0x16')]+_0x49fadc[_0x8db2('0x17')],_0x227355;if(_0x1d6a15>=_0x15e87c){_0x1d6a15=_0x15e87c;_0x227355=0xc8;}else{_0x227355=0xce;}_0x559fb1[_0x8db2('0x13')](_0x227355);return _0x559fb1['set'](_0x8db2('0x18'),_0x350d61+'-'+_0x1d6a15+'/'+_0x15e87c)[_0x8db2('0x14')](_0x15070d);}return null;};}function patchUpdates(_0x48101e){return function(_0x2b3f73){try{jsonpatch[_0x8db2('0x19')](_0x2b3f73,_0x48101e,!![]);}catch(_0x21db8c){return BPromise[_0x8db2('0x1a')](_0x21db8c);}return _0x2b3f73[_0x8db2('0x1b')]();};}function saveUpdates(_0x46ce14,_0x51d60d){return function(_0x5df464){if(_0x5df464){return _0x5df464[_0x8db2('0x1c')](_0x46ce14)[_0x8db2('0x1d')](function(_0x1310d3){return _0x1310d3;});}return null;};}function removeEntity(_0x1b64e4,_0x58562e){return function(_0x431d60){if(_0x431d60){return _0x431d60[_0x8db2('0x1e')]()[_0x8db2('0x1d')](function(){_0x1b64e4[_0x8db2('0x13')](0xcc)[_0x8db2('0x1f')]();});}};}function handleEntityNotFound(_0x597260,_0x124467){return function(_0x3e30e6){if(!_0x3e30e6){_0x597260[_0x8db2('0x12')](0x194);}return _0x3e30e6;};}function handleError(_0x125be2,_0x2260d8){_0x2260d8=_0x2260d8||0x1f4;return function(_0x21704c){logger[_0x8db2('0x20')](_0x21704c['stack']);if(_0x21704c[_0x8db2('0x21')]){delete _0x21704c['name'];}_0x125be2['status'](_0x2260d8)['send'](_0x21704c);};}exports['index']=function(_0xec8cd2,_0x29b5cd){var _0x3be281={},_0x2baed0={},_0x145328={'count':0x0,'rows':[]};var _0x8d4f54=db['VoiceRecording'][_0x8db2('0x22')];_0x2baed0[_0x8db2('0x23')]=_[_0x8db2('0x24')](_[_0x8db2('0x25')](_0x8d4f54),['format']);var _0x2e0691={'dateStart':_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x27')],'dateEnd':_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x28')]};delete _0xec8cd2[_0x8db2('0x26')][_0x8db2('0x27')];delete _0xec8cd2[_0x8db2('0x26')][_0x8db2('0x28')];_0x2baed0['query']=_[_0x8db2('0x25')](_0xec8cd2['query']);_0x2baed0['filters']=_[_0x8db2('0x29')](_0x2baed0[_0x8db2('0x23')],_0x2baed0[_0x8db2('0x26')]);_0x3be281['attributes']=_[_0x8db2('0x29')](_0x2baed0['model'],qs[_0x8db2('0x2a')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x2a')]));_0x3be281['attributes']=_0x3be281['attributes'][_0x8db2('0x2b')]?_0x3be281[_0x8db2('0x2c')]:_0x2baed0['model'];if(!_0xec8cd2['query'][_0x8db2('0x2d')](_0x8db2('0x2e'))){_0x3be281[_0x8db2('0x17')]=qs[_0x8db2('0x17')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x17')]);_0x3be281[_0x8db2('0x16')]=qs[_0x8db2('0x16')](_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x16')]);}_0x3be281['order']=qs[_0x8db2('0x2f')](_0xec8cd2[_0x8db2('0x26')]['sort']);_0x3be281[_0x8db2('0x30')]=qs[_0x8db2('0x31')](_['pick'](_0xec8cd2['query'],_0x2baed0[_0x8db2('0x31')]));if(_0x2e0691['dateStart']){if(_0x2e0691[_0x8db2('0x28')]){_0x2e0691[_0x8db2('0x28')]=moment(_0x2e0691[_0x8db2('0x28')])[_0x8db2('0x32')](0x1,'day');}else{_0x2e0691[_0x8db2('0x28')]=moment(_0x2e0691['dateStart'])[_0x8db2('0x32')](0x1,_0x8db2('0x33'));}_[_0x8db2('0x34')](_0x3be281[_0x8db2('0x30')],{'createdAt':{'$gte':_0x2e0691['dateStart'],'$lte':_0x2e0691['dateEnd']}});}if(_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x35')]){_0x3be281['where']=_[_0x8db2('0x34')](_0x3be281[_0x8db2('0x30')],{'$or':_[_0x8db2('0x36')](_0x3be281['attributes'],function(_0x152e15){var _0x149186={};_0x149186[_0x152e15]={'$like':'%'+_0xec8cd2[_0x8db2('0x26')][_0x8db2('0x35')]+'%'};return _0x149186;})});}_0x3be281=_[_0x8db2('0x34')]({},_0x3be281,_0xec8cd2[_0x8db2('0x37')]);var _0x380046={'where':_0x3be281[_0x8db2('0x30')]};return db[_0x8db2('0x38')][_0x8db2('0x15')](_0x380046)[_0x8db2('0x1d')](function(_0x20bf0b){_0x145328[_0x8db2('0x15')]=_0x20bf0b;if(_0xec8cd2['query'][_0x8db2('0x39')]){_0x3be281[_0x8db2('0x3a')]=[{'all':!![]}];}return db['VoiceRecording']['findAll'](_0x3be281);})[_0x8db2('0x1d')](function(_0x4f1a49){_0x145328[_0x8db2('0x3b')]=_0x4f1a49;return _0x145328;})[_0x8db2('0x1d')](respondWithFilteredResult(_0x29b5cd,_0x3be281))[_0x8db2('0x3c')](handleError(_0x29b5cd,null));};exports[_0x8db2('0x3d')]=function(_0xb4fe2c,_0x30d606){var _0xa53fba={'raw':![],'where':{'id':_0xb4fe2c[_0x8db2('0x3e')]['id']}},_0x5c97ef={};_0x5c97ef[_0x8db2('0x23')]=_[_0x8db2('0x25')](db[_0x8db2('0x38')]['rawAttributes']);_0x5c97ef[_0x8db2('0x26')]=_[_0x8db2('0x25')](_0xb4fe2c[_0x8db2('0x26')]);_0x5c97ef[_0x8db2('0x31')]=_['intersection'](_0x5c97ef[_0x8db2('0x23')],_0x5c97ef['query']);_0xa53fba[_0x8db2('0x2c')]=_[_0x8db2('0x29')](_0x5c97ef[_0x8db2('0x23')],qs['fields'](_0xb4fe2c['query'][_0x8db2('0x2a')]));_0xa53fba['attributes']=_0xa53fba[_0x8db2('0x2c')][_0x8db2('0x2b')]?_0xa53fba[_0x8db2('0x2c')]:_0x5c97ef[_0x8db2('0x23')];if(_0xb4fe2c[_0x8db2('0x26')][_0x8db2('0x39')]){_0xa53fba[_0x8db2('0x3a')]=[{'all':!![]}];}_0xa53fba=_[_0x8db2('0x34')]({},_0xa53fba,_0xb4fe2c[_0x8db2('0x37')]);return db[_0x8db2('0x38')][_0x8db2('0x3f')](_0xa53fba)[_0x8db2('0x1d')](handleEntityNotFound(_0x30d606,null))['then'](respondWithResult(_0x30d606,null))[_0x8db2('0x3c')](handleError(_0x30d606,null));};exports[_0x8db2('0x40')]=function(_0xdbba64,_0x3244db){return db['VoiceRecording']['create'](_0xdbba64[_0x8db2('0x41')],{})[_0x8db2('0x1d')](respondWithResult(_0x3244db,0xc9))[_0x8db2('0x3c')](handleError(_0x3244db,null));};exports['update']=function(_0x540d90,_0x494d6e){if(_0x540d90[_0x8db2('0x41')]['id']){delete _0x540d90[_0x8db2('0x41')]['id'];}return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':{'id':_0x540d90[_0x8db2('0x3e')]['id']}})[_0x8db2('0x1d')](handleEntityNotFound(_0x494d6e,null))[_0x8db2('0x1d')](saveUpdates(_0x540d90['body'],null))['then'](respondWithResult(_0x494d6e,null))[_0x8db2('0x3c')](handleError(_0x494d6e,null));};exports[_0x8db2('0x1e')]=function(_0x2908e4,_0x2f0bd0){return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':{'id':_0x2908e4[_0x8db2('0x3e')]['id']}})[_0x8db2('0x1d')](handleEntityNotFound(_0x2f0bd0,null))[_0x8db2('0x1d')](removeEntity(_0x2f0bd0,null))[_0x8db2('0x3c')](handleError(_0x2f0bd0,null));};exports[_0x8db2('0x42')]=function(_0x319273,_0x345c74){return db[_0x8db2('0x38')][_0x8db2('0x42')]()['then'](respondWithResult(_0x345c74,null))[_0x8db2('0x3c')](handleError(_0x345c74,null));};exports[_0x8db2('0x43')]=function(_0x579317,_0x27b644,_0xd78022){var _0x3af298=require('../../components/encryptor');var _0x3498dc=![];var _0x27acd2={};if(_0x579317[_0x8db2('0x26')][_0x8db2('0x44')]&&_0x579317[_0x8db2('0x26')]['type']===_0x8db2('0x45')){_0x27acd2[_0x8db2('0x45')]=_0x579317[_0x8db2('0x3e')]['id'];}else{_0x27acd2['id']=_0x579317['params']['id'];}return db[_0x8db2('0x38')][_0x8db2('0x3f')]({'where':_0x27acd2,'attributes':['id',_0x8db2('0x46')],'raw':!![]})[_0x8db2('0x1d')](handleEntityNotFound(_0x27b644,null))[_0x8db2('0x1d')](function(_0x16d897){if(_0x16d897){var _0x12a81a=util['format'](_0x8db2('0x47'),_0x16d897[_0x8db2('0x46')]);if(fs['existsSync'](_0x12a81a)){_0x3498dc=!![];return _0x3af298[_0x8db2('0x48')](_0x12a81a,_0x16d897[_0x8db2('0x46')],config['secrets'][_0x8db2('0x49')])[_0x8db2('0x1d')](function(){return _0x16d897;});}return _0x16d897;}})[_0x8db2('0x1d')](function(_0x30f4f3){if(_0x30f4f3){if(!fs[_0x8db2('0x4a')](_0x30f4f3[_0x8db2('0x46')])){throw new db[(_0x8db2('0x4b'))][(_0x8db2('0x4c'))](_0x8db2('0x4d'));}if(_0x30f4f3[_0x8db2('0x4e')]){return _0x27b644[_0x8db2('0x43')](_0x30f4f3[_0x8db2('0x46')],_0x30f4f3[_0x8db2('0x4e')]+path[_0x8db2('0x4f')](_0x30f4f3[_0x8db2('0x46')]),function(){if(_0x3498dc){fs[_0x8db2('0x50')](_0x30f4f3['value']);}});}else{return _0x27b644[_0x8db2('0x43')](_0x30f4f3[_0x8db2('0x46')],function(_0x44118a){if(_0x3498dc){fs[_0x8db2('0x50')](_0x30f4f3[_0x8db2('0x46')]);}});}}})['catch'](handleError(_0x27b644,null));};exports[_0x8db2('0x51')]=function(_0x2c3087,_0x3ab670,_0x1e1c0d){var _0x2ad70f=require(_0x8db2('0x52'));var _0x17341d=![];var _0x2c7b04={'$and':[db[_0x8db2('0x53')][_0x8db2('0x30')](db[_0x8db2('0x53')]['fn'](_0x8db2('0x54'),db[_0x8db2('0x53')][_0x8db2('0x55')](_0x8db2('0x45'))),_0x2c3087[_0x8db2('0x26')][_0x8db2('0x56')])]};if(_0x2c3087[_0x8db2('0x26')]['type']&&_0x2c3087[_0x8db2('0x26')]['type']===_0x8db2('0x45')){_0x2c7b04['$and'][_0x8db2('0x57')]({'uniqueid':_0x2c3087[_0x8db2('0x3e')]['id']});}else{_0x2c7b04[_0x8db2('0x58')][_0x8db2('0x57')]({'id':_0x2c3087[_0x8db2('0x3e')]['id']});}return db['VoiceRecording']['find']({'where':_0x2c7b04,'attributes':['id',_0x8db2('0x46')],'raw':!![]})[_0x8db2('0x1d')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x1d')](function(_0x3ba1d2){if(_0x3ba1d2){var _0x20b49c=util[_0x8db2('0x59')](_0x8db2('0x47'),_0x3ba1d2[_0x8db2('0x46')]);if(fs['existsSync'](_0x20b49c)){_0x17341d=!![];return _0x2ad70f[_0x8db2('0x48')](_0x20b49c,_0x3ba1d2[_0x8db2('0x46')],config[_0x8db2('0x5a')][_0x8db2('0x49')])[_0x8db2('0x1d')](function(){return _0x3ba1d2;});}return _0x3ba1d2;}})[_0x8db2('0x1d')](function(_0x451746){if(_0x451746){if(!fs[_0x8db2('0x4a')](_0x451746['value'])){throw new db['Sequelize'][(_0x8db2('0x4c'))](_0x8db2('0x4d'));}if(_0x451746[_0x8db2('0x4e')]){return _0x3ab670[_0x8db2('0x43')](_0x451746[_0x8db2('0x46')],_0x451746['filename']+path['extname'](_0x451746[_0x8db2('0x46')]),function(){if(_0x17341d){fs[_0x8db2('0x50')](_0x451746['value']);}});}else{return _0x3ab670[_0x8db2('0x43')](_0x451746[_0x8db2('0x46')],function(_0x1ab84c){if(_0x17341d){fs['unlink'](_0x451746[_0x8db2('0x46')]);}});}}})[_0x8db2('0x3c')](handleError(_0x3ab670,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 6085a65..132c92a 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 _0xcaa4=['uniqueid','lodash','util','api','moment','bluebird','request-promise','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x4facb7,_0x241d7e){var _0x3482cc=function(_0x56809c){while(--_0x56809c){_0x4facb7['push'](_0x4facb7['shift']());}};_0x3482cc(++_0x241d7e);}(_0xcaa4,0x6d));var _0x4caa=function(_0x433274,_0x4d7efc){_0x433274=_0x433274-0x0;var _0x3949e1=_0xcaa4[_0x433274];return _0x3949e1;};'use strict';var _=require(_0x4caa('0x0'));var util=require(_0x4caa('0x1'));var logger=require('../../config/logger')(_0x4caa('0x2'));var moment=require(_0x4caa('0x3'));var BPromise=require(_0x4caa('0x4'));var rp=require(_0x4caa('0x5'));var attributes=require(_0x4caa('0x6'));module[_0x4caa('0x7')]=function(_0x1148d6,_0x50768b){return _0x1148d6[_0x4caa('0x8')](_0x4caa('0x9'),attributes,{'tableName':_0x4caa('0xa'),'paranoid':![],'indexes':[{'name':_0x4caa('0xb'),'fields':[_0x4caa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0219=['moment','bluebird','request-promise','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','../../config/logger','api'];(function(_0xdb21b2,_0x40a356){var _0x570aa5=function(_0x96823c){while(--_0x96823c){_0xdb21b2['push'](_0xdb21b2['shift']());}};_0x570aa5(++_0x40a356);}(_0x0219,0xfa));var _0x9021=function(_0x11a655,_0x36b87b){_0x11a655=_0x11a655-0x0;var _0x15184f=_0x0219[_0x11a655];return _0x15184f;};'use strict';var _=require(_0x9021('0x0'));var util=require('util');var logger=require(_0x9021('0x1'))(_0x9021('0x2'));var moment=require(_0x9021('0x3'));var BPromise=require(_0x9021('0x4'));var rp=require(_0x9021('0x5'));var attributes=require(_0x9021('0x6'));module[_0x9021('0x7')]=function(_0x3d7688,_0x5537b6){return _0x3d7688[_0x9021('0x8')](_0x9021('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x9021('0xa'),'fields':[_0x9021('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 230c23e..dbdff36 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 _0x2697=['callRecordingEncryption','create','value','format','%s.cypher','encryptFile','unlink','CreateVoiceRecording\x20file\x20encrypted','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','limit','stringify','CreateVoiceRecording','../../components/encryptor','findOne'];(function(_0x28b1d6,_0x3e3d6b){var _0x4e5433=function(_0x14c0ee){while(--_0x14c0ee){_0x28b1d6['push'](_0x28b1d6['shift']());}};_0x4e5433(++_0x3e3d6b);}(_0x2697,0x120));var _0x7269=function(_0x5bf2b3,_0xfcd364){_0x5bf2b3=_0x5bf2b3-0x0;var _0x5e8a9b=_0x2697[_0x5bf2b3];return _0x5e8a9b;};'use strict';var _=require('lodash');var util=require(_0x7269('0x0'));var moment=require(_0x7269('0x1'));var BPromise=require(_0x7269('0x2'));var rs=require(_0x7269('0x3'));var fs=require('fs');var db=require(_0x7269('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7269('0x5'))('rpc');var config=require(_0x7269('0x6'));var jayson=require(_0x7269('0x7'));var client=jayson[_0x7269('0x8')][_0x7269('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x438f7c,_0x1e47e3,_0x20ddbf){return new BPromise(function(_0x2c968f,_0x328097){return client[_0x7269('0xa')](_0x438f7c,_0x20ddbf)[_0x7269('0xb')](function(_0x5408ad){logger[_0x7269('0xc')](_0x7269('0xd'),_0x1e47e3,'request\x20sent');logger[_0x7269('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1e47e3,_0x7269('0xf'),JSON['stringify'](_0x5408ad));if(_0x5408ad[_0x7269('0x10')]){if(_0x5408ad['error'][_0x7269('0x11')]===0x1f4){logger[_0x7269('0x10')](_0x7269('0xd'),_0x1e47e3,_0x5408ad['error'][_0x7269('0x12')]);return _0x328097(_0x5408ad[_0x7269('0x10')]['message']);}logger[_0x7269('0x10')](_0x7269('0xd'),_0x1e47e3,_0x5408ad[_0x7269('0x10')]['message']);return _0x2c968f(_0x5408ad[_0x7269('0x10')][_0x7269('0x12')]);}else{logger[_0x7269('0xc')](_0x7269('0xd'),_0x1e47e3,_0x7269('0xf'));_0x2c968f(_0x5408ad[_0x7269('0x13')][_0x7269('0x12')]);}})[_0x7269('0x14')](function(_0x5f1a65){logger[_0x7269('0x10')](_0x7269('0xd'),_0x1e47e3,_0x5f1a65);_0x328097(_0x5f1a65);});});}exports[_0x7269('0x15')]=function(_0x1f7289){var _0x5812c4=this;return new Promise(function(_0x5589b7,_0x4db022){return db[_0x7269('0x16')][_0x7269('0x17')](_0x1f7289[_0x7269('0x18')],{'raw':_0x1f7289[_0x7269('0x19')]?_0x1f7289[_0x7269('0x19')][_0x7269('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7289[_0x7269('0x19')]?_0x1f7289['options']['where']||null:null,'attributes':_0x1f7289['options']?_0x1f7289[_0x7269('0x19')]['attributes']||null:null,'limit':_0x1f7289[_0x7269('0x19')]?_0x1f7289['options'][_0x7269('0x1b')]||null:null})[_0x7269('0xb')](function(_0x55e40d){logger[_0x7269('0xc')](_0x7269('0x15'),_0x1f7289);logger['debug'](_0x7269('0x15'),_0x1f7289,JSON[_0x7269('0x1c')](_0x55e40d));_0x5589b7(_0x55e40d);})[_0x7269('0x14')](function(_0x383fde){logger['error'](_0x7269('0x15'),_0x383fde[_0x7269('0x12')],_0x1f7289);_0x4db022(_0x5812c4[_0x7269('0x10')](0x1f4,_0x383fde[_0x7269('0x12')]));});});};exports[_0x7269('0x1d')]=function(_0x3d72c9){var _0x4c6810=this;return new Promise(function(_0x198b59,_0x3afb72){var _0x339414=require(_0x7269('0x1e'));var _0x43f33d;return db['Setting'][_0x7269('0x1f')]({'attributes':['id',_0x7269('0x20')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x1ad87c){_0x43f33d=_0x1ad87c;return db['VoiceRecording'][_0x7269('0x21')](_0x3d72c9[_0x7269('0x18')]);})[_0x7269('0xb')](function(_0x2be62e){if(_0x43f33d[_0x7269('0x20')]&&fs['existsSync'](_0x2be62e[_0x7269('0x22')])){var _0x12448b=util[_0x7269('0x23')](_0x7269('0x24'),_0x2be62e['value']);return _0x339414[_0x7269('0x25')](_0x2be62e[_0x7269('0x22')],_0x12448b,config['secrets']['recording'])[_0x7269('0xb')](function(){fs[_0x7269('0x26')](_0x2be62e[_0x7269('0x22')]);logger[_0x7269('0xc')](_0x7269('0x27'));return _0x2be62e;});}return _0x2be62e;})[_0x7269('0xb')](function(_0x577bcb){logger['info'](_0x7269('0x1d'),_0x3d72c9);logger[_0x7269('0xe')]('CreateVoiceRecording',_0x3d72c9,JSON[_0x7269('0x1c')](_0x577bcb));_0x198b59(_0x577bcb);})['catch'](function(_0x1f244c){logger[_0x7269('0x10')](_0x7269('0x1d'),_0x1f244c[_0x7269('0x12')],_0x3d72c9);_0x3afb72(_0x4c6810[_0x7269('0x10')](0x1f4,_0x1f244c[_0x7269('0x12')]));});});}; \ No newline at end of file +var _0x2333=['where','attributes','limit','../../components/encryptor','Setting','findOne','create','body','callRecordingEncryption','existsSync','format','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','options'];(function(_0x50414a,_0x131849){var _0x1b3657=function(_0x18661e){while(--_0x18661e){_0x50414a['push'](_0x50414a['shift']());}};_0x1b3657(++_0x131849);}(_0x2333,0x11a));var _0x3233=function(_0x5e4aa1,_0x375ce0){_0x5e4aa1=_0x5e4aa1-0x0;var _0x192002=_0x2333[_0x5e4aa1];return _0x192002;};'use strict';var _=require(_0x3233('0x0'));var util=require(_0x3233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3233('0x2'));var fs=require('fs');var db=require(_0x3233('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3233('0x4'))(_0x3233('0x5'));var config=require(_0x3233('0x6'));var jayson=require(_0x3233('0x7'));var client=jayson[_0x3233('0x8')][_0x3233('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4120f6,_0x33a56d,_0x1e93e8){return new BPromise(function(_0x1842a1,_0x1837b6){return client[_0x3233('0xa')](_0x4120f6,_0x1e93e8)[_0x3233('0xb')](function(_0x1fa4f5){logger[_0x3233('0xc')](_0x3233('0xd'),_0x33a56d,_0x3233('0xe'));logger[_0x3233('0xf')](_0x3233('0x10'),_0x33a56d,_0x3233('0xe'),JSON[_0x3233('0x11')](_0x1fa4f5));if(_0x1fa4f5['error']){if(_0x1fa4f5[_0x3233('0x12')][_0x3233('0x13')]===0x1f4){logger[_0x3233('0x12')](_0x3233('0xd'),_0x33a56d,_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);return _0x1837b6(_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);}logger[_0x3233('0x12')](_0x3233('0xd'),_0x33a56d,_0x1fa4f5[_0x3233('0x12')][_0x3233('0x14')]);return _0x1842a1(_0x1fa4f5[_0x3233('0x12')]['message']);}else{logger['info'](_0x3233('0xd'),_0x33a56d,_0x3233('0xe'));_0x1842a1(_0x1fa4f5[_0x3233('0x15')]['message']);}})[_0x3233('0x16')](function(_0x357fbd){logger[_0x3233('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x33a56d,_0x357fbd);_0x1837b6(_0x357fbd);});});}exports[_0x3233('0x17')]=function(_0x425e6f){var _0x55fa30=this;return new Promise(function(_0x38a9c0,_0x58420c){return db[_0x3233('0x18')]['update'](_0x425e6f['body'],{'raw':_0x425e6f['options']?_0x425e6f[_0x3233('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x425e6f[_0x3233('0x19')]?_0x425e6f['options'][_0x3233('0x1a')]||null:null,'attributes':_0x425e6f[_0x3233('0x19')]?_0x425e6f[_0x3233('0x19')][_0x3233('0x1b')]||null:null,'limit':_0x425e6f['options']?_0x425e6f[_0x3233('0x19')][_0x3233('0x1c')]||null:null})[_0x3233('0xb')](function(_0x531cd8){logger[_0x3233('0xc')]('UpdateVoiceRecording',_0x425e6f);logger[_0x3233('0xf')](_0x3233('0x17'),_0x425e6f,JSON[_0x3233('0x11')](_0x531cd8));_0x38a9c0(_0x531cd8);})['catch'](function(_0x3ca20d){logger['error'](_0x3233('0x17'),_0x3ca20d[_0x3233('0x14')],_0x425e6f);_0x58420c(_0x55fa30['error'](0x1f4,_0x3ca20d[_0x3233('0x14')]));});});};exports['CreateVoiceRecording']=function(_0x50871d){var _0x430e8e=this;return new Promise(function(_0x39a345,_0x5d8e63){var _0x276b6=require(_0x3233('0x1d'));var _0x27cec8;return db[_0x3233('0x1e')][_0x3233('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x3233('0xb')](function(_0xd4171b){_0x27cec8=_0xd4171b;return db[_0x3233('0x18')][_0x3233('0x20')](_0x50871d[_0x3233('0x21')]);})[_0x3233('0xb')](function(_0x31f0d6){if(_0x27cec8[_0x3233('0x22')]&&fs[_0x3233('0x23')](_0x31f0d6['value'])){var _0x392e56=util[_0x3233('0x24')]('%s.cypher',_0x31f0d6[_0x3233('0x25')]);return _0x276b6[_0x3233('0x26')](_0x31f0d6['value'],_0x392e56,config[_0x3233('0x27')][_0x3233('0x28')])['then'](function(){fs[_0x3233('0x29')](_0x31f0d6[_0x3233('0x25')]);logger['info'](_0x3233('0x2a'));return _0x31f0d6;});}return _0x31f0d6;})[_0x3233('0xb')](function(_0x5412f1){logger['info'](_0x3233('0x2b'),_0x50871d);logger['debug'](_0x3233('0x2b'),_0x50871d,JSON[_0x3233('0x11')](_0x5412f1));_0x39a345(_0x5412f1);})['catch'](function(_0x21a4e6){logger[_0x3233('0x12')](_0x3233('0x2b'),_0x21a4e6[_0x3233('0x14')],_0x50871d);_0x5d8e63(_0x430e8e[_0x3233('0x12')](0x1f4,_0x21a4e6[_0x3233('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ab20a3e..cbc5b6f 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 _0x3f0f=['destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4a065d,_0xc00173){var _0x2b9820=function(_0x41a5eb){while(--_0x41a5eb){_0x4a065d['push'](_0x4a065d['shift']());}};_0x2b9820(++_0xc00173);}(_0x3f0f,0x189));var _0xf3f0=function(_0x23dc5c,_0x3b452){_0x23dc5c=_0x23dc5c-0x0;var _0x4f3f38=_0x3f0f[_0x23dc5c];return _0x4f3f38;};'use strict';var multer=require(_0xf3f0('0x0'));var util=require(_0xf3f0('0x1'));var path=require(_0xf3f0('0x2'));var express=require(_0xf3f0('0x3'));var router=express['Router']();var auth=require(_0xf3f0('0x4'));var interaction=require(_0xf3f0('0x5'));var config=require(_0xf3f0('0x6'));var controller=require(_0xf3f0('0x7'));router[_0xf3f0('0x8')]('/',auth[_0xf3f0('0x9')](),controller[_0xf3f0('0xa')]);router['get'](_0xf3f0('0xb'),auth['isAuthenticated'](),controller[_0xf3f0('0xc')]);router[_0xf3f0('0xd')]('/',auth['isAuthenticated'](),controller[_0xf3f0('0xe')]);router['put'](_0xf3f0('0xb'),auth[_0xf3f0('0x9')](),controller['update']);router['delete'](_0xf3f0('0xb'),auth[_0xf3f0('0x9')](),controller[_0xf3f0('0xf')]);module[_0xf3f0('0x10')]=router; \ No newline at end of file +var _0xe923=['get','isAuthenticated','show','post','create','put','/:id','delete','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller'];(function(_0x2cf83b,_0x18e872){var _0x1b27f2=function(_0x26211d){while(--_0x26211d){_0x2cf83b['push'](_0x2cf83b['shift']());}};_0x1b27f2(++_0x18e872);}(_0xe923,0x8a));var _0x3e92=function(_0x404b9a,_0xca0480){_0x404b9a=_0x404b9a-0x0;var _0x30ba61=_0xe923[_0x404b9a];return _0x30ba61;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0x3e92('0x0'));var router=express[_0x3e92('0x1')]();var auth=require(_0x3e92('0x2'));var interaction=require(_0x3e92('0x3'));var config=require(_0x3e92('0x4'));var controller=require(_0x3e92('0x5'));router[_0x3e92('0x6')]('/',auth[_0x3e92('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3e92('0x8')]);router[_0x3e92('0x9')]('/',auth[_0x3e92('0x7')](),controller[_0x3e92('0xa')]);router[_0x3e92('0xb')](_0x3e92('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x3e92('0xd')](_0x3e92('0xc'),auth[_0x3e92('0x7')](),controller[_0x3e92('0xe')]);module[_0x3e92('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2ce9a2e..c3367f9 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 _0x6c97=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x6c97,0xda));var _0x76c9=function(_0x1022a9,_0x2e5fa3){_0x1022a9=_0x1022a9-0x0;var _0x342487=_0x6c97[_0x1022a9];return _0x342487;};'use strict';var Sequelize=require(_0x76c9('0x0'));var moment=require(_0x76c9('0x1'));module[_0x76c9('0x2')]={'type':{'type':Sequelize[_0x76c9('0x3')]('blind',_0x76c9('0x4'))},'result':{'type':Sequelize[_0x76c9('0x5')]},'transfererchannel':{'type':Sequelize[_0x76c9('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x76c9('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x76c9('0x5')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x76c9('0x5')]},'transfererexten':{'type':Sequelize[_0x76c9('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x76c9('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x76c9('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x76c9('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x76c9('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x76c9('0x5')]},'transfereecontext':{'type':Sequelize[_0x76c9('0x5')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x76c9('0x5')]},'isexternal':{'type':Sequelize[_0x76c9('0x3')](_0x76c9('0x6'),'No')},'context':{'type':Sequelize[_0x76c9('0x5')]},'extension':{'type':Sequelize[_0x76c9('0x5')]}}; \ No newline at end of file +var _0xbf22=['ENUM','Yes','moment','exports','blind','attended','STRING'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xbf22,0xf7));var _0x2bf2=function(_0x5c8bd1,_0x58b059){_0x5c8bd1=_0x5c8bd1-0x0;var _0x178a98=_0xbf22[_0x5c8bd1];return _0x178a98;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2bf2('0x0'));module[_0x2bf2('0x1')]={'type':{'type':Sequelize['ENUM'](_0x2bf2('0x2'),_0x2bf2('0x3'))},'result':{'type':Sequelize[_0x2bf2('0x4')]},'transfererchannel':{'type':Sequelize[_0x2bf2('0x4')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x2bf2('0x4')]},'transfererconnectedlinenum':{'type':Sequelize[_0x2bf2('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0x2bf2('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x2bf2('0x4')]},'transferercontext':{'type':Sequelize[_0x2bf2('0x4')]},'transfererexten':{'type':Sequelize[_0x2bf2('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x2bf2('0x4')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x2bf2('0x4')]},'transfereecontext':{'type':Sequelize[_0x2bf2('0x4')]},'transfereeexten':{'type':Sequelize[_0x2bf2('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x2bf2('0x4')]},'isexternal':{'type':Sequelize[_0x2bf2('0x5')](_0x2bf2('0x6'),'No')},'context':{'type':Sequelize[_0x2bf2('0x4')]},'extension':{'type':Sequelize[_0x2bf2('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 91bf5f3..ad5e52e 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 _0xf280=['sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','name','index','VoiceTransferReport','rawAttributes','model','keys','query','dateStart','dateEnd','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','add','day','merge','map','options','includeAll','include','findAll','rows','params','find','create','body','catch','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb'];(function(_0x40260f,_0x4c258f){var _0x677f92=function(_0x13944e){while(--_0x13944e){_0x40260f['push'](_0x40260f['shift']());}};_0x677f92(++_0x4c258f);}(_0xf280,0x73));var _0x0f28=function(_0x1c6089,_0x3816e2){_0x1c6089=_0x1c6089-0x0;var _0x4d97c1=_0xf280[_0x1c6089];return _0x4d97c1;};'use strict';var jsonpatch=require(_0x0f28('0x0'));var rp=require(_0x0f28('0x1'));var moment=require(_0x0f28('0x2'));var BPromise=require(_0x0f28('0x3'));var Mustache=require(_0x0f28('0x4'));var util=require('util');var path=require(_0x0f28('0x5'));var sox=require(_0x0f28('0x6'));var csv=require(_0x0f28('0x7'));var ejs=require(_0x0f28('0x8'));var fs=require('fs');var _=require(_0x0f28('0x9'));var squel=require('squel');var crypto=require(_0x0f28('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x0f28('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0f28('0xc'));var Papa=require(_0x0f28('0xd'));var qs=require(_0x0f28('0xe'));var logger=require(_0x0f28('0xf'))(_0x0f28('0x10'));var utils=require(_0x0f28('0x11'));var config=require('../../config/environment');var db=require(_0x0f28('0x12'))['db'];function respondWithStatusCode(_0x1ef4bd,_0x59ffcf){_0x59ffcf=_0x59ffcf||0xcc;return function(_0x4995b0){if(_0x4995b0){return _0x1ef4bd[_0x0f28('0x13')](_0x59ffcf);}return _0x1ef4bd[_0x0f28('0x14')](_0x59ffcf)['end']();};}function respondWithResult(_0x46b3cd,_0x5cee90){_0x5cee90=_0x5cee90||0xc8;return function(_0x309609){if(_0x309609){return _0x46b3cd[_0x0f28('0x14')](_0x5cee90)[_0x0f28('0x15')](_0x309609);}};}function respondWithFilteredResult(_0x552ee8,_0x399997){return function(_0x75b599){if(_0x75b599){var _0x37c53a=_0x75b599[_0x0f28('0x16')],_0x4f57ee=_0x399997[_0x0f28('0x17')],_0x42b508=_0x399997[_0x0f28('0x17')]+_0x399997[_0x0f28('0x18')],_0x4e4ede;if(_0x42b508>=_0x37c53a){_0x42b508=_0x37c53a;_0x4e4ede=0xc8;}else{_0x4e4ede=0xce;}_0x552ee8[_0x0f28('0x14')](_0x4e4ede);return _0x552ee8[_0x0f28('0x19')](_0x0f28('0x1a'),_0x4f57ee+'-'+_0x42b508+'/'+_0x37c53a)[_0x0f28('0x15')](_0x75b599);}return null;};}function patchUpdates(_0x5e3516){return function(_0x379793){try{jsonpatch[_0x0f28('0x1b')](_0x379793,_0x5e3516,!![]);}catch(_0x43f5ad){return BPromise['reject'](_0x43f5ad);}return _0x379793[_0x0f28('0x1c')]();};}function saveUpdates(_0x7ed268,_0x52fa0c){return function(_0x35cc66){if(_0x35cc66){return _0x35cc66[_0x0f28('0x1d')](_0x7ed268)[_0x0f28('0x1e')](function(_0x48d1e7){return _0x48d1e7;});}return null;};}function removeEntity(_0x1884bf,_0x449faf){return function(_0x505bbb){if(_0x505bbb){return _0x505bbb[_0x0f28('0x1f')]()[_0x0f28('0x1e')](function(){_0x1884bf[_0x0f28('0x14')](0xcc)[_0x0f28('0x20')]();});}};}function handleEntityNotFound(_0x396705,_0x4ff46c){return function(_0x421aa8){if(!_0x421aa8){_0x396705[_0x0f28('0x13')](0x194);}return _0x421aa8;};}function handleError(_0x5aa3bd,_0x21b86e){_0x21b86e=_0x21b86e||0x1f4;return function(_0x486f30){logger[_0x0f28('0x21')](_0x486f30['stack']);if(_0x486f30[_0x0f28('0x22')]){delete _0x486f30[_0x0f28('0x22')];}_0x5aa3bd[_0x0f28('0x14')](_0x21b86e)['send'](_0x486f30);};}exports[_0x0f28('0x23')]=function(_0xec74c7,_0x495c62){var _0x2912a4={},_0x588b5b={},_0x285c2c={'count':0x0,'rows':[]};var _0x303218=db[_0x0f28('0x24')][_0x0f28('0x25')];_0x588b5b[_0x0f28('0x26')]=_[_0x0f28('0x27')](_0x303218);var _0x2dac5b={'dateStart':_0xec74c7[_0x0f28('0x28')][_0x0f28('0x29')],'dateEnd':_0xec74c7[_0x0f28('0x28')][_0x0f28('0x2a')]};delete _0xec74c7['query'][_0x0f28('0x29')];delete _0xec74c7[_0x0f28('0x28')][_0x0f28('0x2a')];_0x588b5b[_0x0f28('0x28')]=_[_0x0f28('0x27')](_0xec74c7['query']);_0x588b5b[_0x0f28('0x2b')]=_[_0x0f28('0x2c')](_0x588b5b[_0x0f28('0x26')],_0x588b5b[_0x0f28('0x28')]);_0x2912a4[_0x0f28('0x2d')]=_[_0x0f28('0x2c')](_0x588b5b[_0x0f28('0x26')],qs[_0x0f28('0x2e')](_0xec74c7[_0x0f28('0x28')]['fields']));_0x2912a4[_0x0f28('0x2d')]=_0x2912a4['attributes'][_0x0f28('0x2f')]?_0x2912a4['attributes']:_0x588b5b[_0x0f28('0x26')];if(!_0xec74c7['query'][_0x0f28('0x30')](_0x0f28('0x31'))){_0x2912a4[_0x0f28('0x18')]=qs[_0x0f28('0x18')](_0xec74c7[_0x0f28('0x28')][_0x0f28('0x18')]);_0x2912a4[_0x0f28('0x17')]=qs[_0x0f28('0x17')](_0xec74c7['query'][_0x0f28('0x17')]);}_0x2912a4['order']=qs[_0x0f28('0x32')](_0xec74c7[_0x0f28('0x28')][_0x0f28('0x32')]);_0x2912a4[_0x0f28('0x33')]=qs['filters'](_[_0x0f28('0x34')](_0xec74c7[_0x0f28('0x28')],_0x588b5b['filters']));if(_0x2dac5b['dateStart']){if(_0x2dac5b['dateEnd']){_0x2dac5b[_0x0f28('0x2a')]=moment(_0x2dac5b[_0x0f28('0x2a')])[_0x0f28('0x35')](0x1,_0x0f28('0x36'));}else{_0x2dac5b[_0x0f28('0x2a')]=moment(_0x2dac5b[_0x0f28('0x29')])[_0x0f28('0x35')](0x1,_0x0f28('0x36'));}_[_0x0f28('0x37')](_0x2912a4['where'],{'createdAt':{'$gte':_0x2dac5b[_0x0f28('0x29')],'$lte':_0x2dac5b[_0x0f28('0x2a')]}});}if(_0xec74c7[_0x0f28('0x28')]['filter']){_0x2912a4['where']=_[_0x0f28('0x37')](_0x2912a4['where'],{'$or':_[_0x0f28('0x38')](_0x2912a4[_0x0f28('0x2d')],function(_0x43a8a6){var _0x282c1f={};_0x282c1f[_0x43a8a6]={'$like':'%'+_0xec74c7[_0x0f28('0x28')]['filter']+'%'};return _0x282c1f;})});}_0x2912a4=_[_0x0f28('0x37')]({},_0x2912a4,_0xec74c7[_0x0f28('0x39')]);var _0x54bc03={'where':_0x2912a4['where']};return db[_0x0f28('0x24')][_0x0f28('0x16')](_0x54bc03)[_0x0f28('0x1e')](function(_0x1ba2e6){_0x285c2c['count']=_0x1ba2e6;if(_0xec74c7[_0x0f28('0x28')][_0x0f28('0x3a')]){_0x2912a4[_0x0f28('0x3b')]=[{'all':!![]}];}return db[_0x0f28('0x24')][_0x0f28('0x3c')](_0x2912a4);})[_0x0f28('0x1e')](function(_0x1741ea){_0x285c2c[_0x0f28('0x3d')]=_0x1741ea;return _0x285c2c;})[_0x0f28('0x1e')](respondWithFilteredResult(_0x495c62,_0x2912a4))['catch'](handleError(_0x495c62,null));};exports['show']=function(_0x4e5571,_0x365fae){var _0x856125={'raw':!![],'where':{'id':_0x4e5571[_0x0f28('0x3e')]['id']}},_0x43fa53={};_0x43fa53[_0x0f28('0x26')]=_[_0x0f28('0x27')](db['VoiceTransferReport'][_0x0f28('0x25')]);_0x43fa53[_0x0f28('0x28')]=_[_0x0f28('0x27')](_0x4e5571[_0x0f28('0x28')]);_0x43fa53[_0x0f28('0x2b')]=_[_0x0f28('0x2c')](_0x43fa53['model'],_0x43fa53[_0x0f28('0x28')]);_0x856125[_0x0f28('0x2d')]=_[_0x0f28('0x2c')](_0x43fa53[_0x0f28('0x26')],qs['fields'](_0x4e5571[_0x0f28('0x28')][_0x0f28('0x2e')]));_0x856125[_0x0f28('0x2d')]=_0x856125[_0x0f28('0x2d')][_0x0f28('0x2f')]?_0x856125[_0x0f28('0x2d')]:_0x43fa53[_0x0f28('0x26')];if(_0x4e5571[_0x0f28('0x28')][_0x0f28('0x3a')]){_0x856125[_0x0f28('0x3b')]=[{'all':!![]}];}_0x856125=_[_0x0f28('0x37')]({},_0x856125,_0x4e5571[_0x0f28('0x39')]);return db[_0x0f28('0x24')][_0x0f28('0x3f')](_0x856125)[_0x0f28('0x1e')](handleEntityNotFound(_0x365fae,null))['then'](respondWithResult(_0x365fae,null))['catch'](handleError(_0x365fae,null));};exports[_0x0f28('0x40')]=function(_0x232c96,_0x50893b){return db['VoiceTransferReport'][_0x0f28('0x40')](_0x232c96[_0x0f28('0x41')],{})['then'](respondWithResult(_0x50893b,0xc9))[_0x0f28('0x42')](handleError(_0x50893b,null));};exports[_0x0f28('0x1d')]=function(_0x2fd04a,_0x435c2b){if(_0x2fd04a[_0x0f28('0x41')]['id']){delete _0x2fd04a[_0x0f28('0x41')]['id'];}return db[_0x0f28('0x24')][_0x0f28('0x3f')]({'where':{'id':_0x2fd04a[_0x0f28('0x3e')]['id']}})[_0x0f28('0x1e')](handleEntityNotFound(_0x435c2b,null))['then'](saveUpdates(_0x2fd04a['body'],null))[_0x0f28('0x1e')](respondWithResult(_0x435c2b,null))[_0x0f28('0x42')](handleError(_0x435c2b,null));};exports[_0x0f28('0x1f')]=function(_0x2cf8a3,_0x49f3f9){return db[_0x0f28('0x24')]['find']({'where':{'id':_0x2cf8a3[_0x0f28('0x3e')]['id']}})['then'](handleEntityNotFound(_0x49f3f9,null))[_0x0f28('0x1e')](removeEntity(_0x49f3f9,null))[_0x0f28('0x42')](handleError(_0x49f3f9,null));}; \ No newline at end of file +var _0x8fc6=['fields','hasOwnProperty','order','sort','where','filters','pick','add','day','merge','filter','map','options','include','VoiceTransferReport','rows','catch','show','params','keys','length','includeAll','find','create','body','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','count','offset','limit','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','rawAttributes','model','query','dateEnd','dateStart','intersection','attributes'];(function(_0x226c48,_0x11a8bc){var _0x4d9057=function(_0x5aaa5c){while(--_0x5aaa5c){_0x226c48['push'](_0x226c48['shift']());}};_0x4d9057(++_0x11a8bc);}(_0x8fc6,0x172));var _0x68fc=function(_0x5c8fa9,_0x638fc8){_0x5c8fa9=_0x5c8fa9-0x0;var _0x1b8c2e=_0x8fc6[_0x5c8fa9];return _0x1b8c2e;};'use strict';var jsonpatch=require(_0x68fc('0x0'));var rp=require(_0x68fc('0x1'));var moment=require(_0x68fc('0x2'));var BPromise=require(_0x68fc('0x3'));var Mustache=require('mustache');var util=require(_0x68fc('0x4'));var path=require(_0x68fc('0x5'));var sox=require(_0x68fc('0x6'));var csv=require(_0x68fc('0x7'));var ejs=require(_0x68fc('0x8'));var fs=require('fs');var _=require(_0x68fc('0x9'));var squel=require(_0x68fc('0xa'));var crypto=require(_0x68fc('0xb'));var jsforce=require(_0x68fc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x68fc('0x7'));var querystring=require(_0x68fc('0xd'));var Papa=require(_0x68fc('0xe'));var qs=require(_0x68fc('0xf'));var logger=require('../../config/logger')(_0x68fc('0x10'));var utils=require(_0x68fc('0x11'));var config=require(_0x68fc('0x12'));var db=require(_0x68fc('0x13'))['db'];function respondWithStatusCode(_0x5d5b35,_0xd74c9){_0xd74c9=_0xd74c9||0xcc;return function(_0x17bf1f){if(_0x17bf1f){return _0x5d5b35['sendStatus'](_0xd74c9);}return _0x5d5b35['status'](_0xd74c9)[_0x68fc('0x14')]();};}function respondWithResult(_0x423515,_0x2e92e2){_0x2e92e2=_0x2e92e2||0xc8;return function(_0x4eed92){if(_0x4eed92){return _0x423515[_0x68fc('0x15')](_0x2e92e2)[_0x68fc('0x16')](_0x4eed92);}};}function respondWithFilteredResult(_0xa8ec90,_0x1cd530){return function(_0x160afb){if(_0x160afb){var _0x1c022a=_0x160afb[_0x68fc('0x17')],_0x3e8add=_0x1cd530[_0x68fc('0x18')],_0x198221=_0x1cd530['offset']+_0x1cd530[_0x68fc('0x19')],_0x1b15b9;if(_0x198221>=_0x1c022a){_0x198221=_0x1c022a;_0x1b15b9=0xc8;}else{_0x1b15b9=0xce;}_0xa8ec90[_0x68fc('0x15')](_0x1b15b9);return _0xa8ec90['set'](_0x68fc('0x1a'),_0x3e8add+'-'+_0x198221+'/'+_0x1c022a)[_0x68fc('0x16')](_0x160afb);}return null;};}function patchUpdates(_0x2d8e8c){return function(_0x386eaf){try{jsonpatch[_0x68fc('0x1b')](_0x386eaf,_0x2d8e8c,!![]);}catch(_0x5baeca){return BPromise[_0x68fc('0x1c')](_0x5baeca);}return _0x386eaf[_0x68fc('0x1d')]();};}function saveUpdates(_0xb43403,_0x23d628){return function(_0x64e13){if(_0x64e13){return _0x64e13[_0x68fc('0x1e')](_0xb43403)[_0x68fc('0x1f')](function(_0x14b215){return _0x14b215;});}return null;};}function removeEntity(_0x47a450,_0x41f75d){return function(_0x483764){if(_0x483764){return _0x483764['destroy']()['then'](function(){_0x47a450[_0x68fc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc3846c,_0x337eaf){return function(_0x5286b5){if(!_0x5286b5){_0xc3846c[_0x68fc('0x20')](0x194);}return _0x5286b5;};}function handleError(_0x179d62,_0x203860){_0x203860=_0x203860||0x1f4;return function(_0x3f993a){logger[_0x68fc('0x21')](_0x3f993a[_0x68fc('0x22')]);if(_0x3f993a[_0x68fc('0x23')]){delete _0x3f993a[_0x68fc('0x23')];}_0x179d62[_0x68fc('0x15')](_0x203860)[_0x68fc('0x24')](_0x3f993a);};}exports['index']=function(_0x48b7dd,_0xfea30){var _0x355c32={},_0x1728bf={},_0x3c17df={'count':0x0,'rows':[]};var _0x45fea8=db['VoiceTransferReport'][_0x68fc('0x25')];_0x1728bf[_0x68fc('0x26')]=_['keys'](_0x45fea8);var _0x374693={'dateStart':_0x48b7dd[_0x68fc('0x27')]['dateStart'],'dateEnd':_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x28')]};delete _0x48b7dd[_0x68fc('0x27')][_0x68fc('0x29')];delete _0x48b7dd['query'][_0x68fc('0x28')];_0x1728bf[_0x68fc('0x27')]=_['keys'](_0x48b7dd[_0x68fc('0x27')]);_0x1728bf['filters']=_[_0x68fc('0x2a')](_0x1728bf[_0x68fc('0x26')],_0x1728bf[_0x68fc('0x27')]);_0x355c32[_0x68fc('0x2b')]=_[_0x68fc('0x2a')](_0x1728bf[_0x68fc('0x26')],qs['fields'](_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x2c')]));_0x355c32[_0x68fc('0x2b')]=_0x355c32['attributes']['length']?_0x355c32[_0x68fc('0x2b')]:_0x1728bf['model'];if(!_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x2d')]('nolimit')){_0x355c32[_0x68fc('0x19')]=qs['limit'](_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x19')]);_0x355c32[_0x68fc('0x18')]=qs['offset'](_0x48b7dd['query'][_0x68fc('0x18')]);}_0x355c32[_0x68fc('0x2e')]=qs[_0x68fc('0x2f')](_0x48b7dd[_0x68fc('0x27')]['sort']);_0x355c32[_0x68fc('0x30')]=qs[_0x68fc('0x31')](_[_0x68fc('0x32')](_0x48b7dd[_0x68fc('0x27')],_0x1728bf[_0x68fc('0x31')]));if(_0x374693[_0x68fc('0x29')]){if(_0x374693[_0x68fc('0x28')]){_0x374693[_0x68fc('0x28')]=moment(_0x374693['dateEnd'])[_0x68fc('0x33')](0x1,_0x68fc('0x34'));}else{_0x374693[_0x68fc('0x28')]=moment(_0x374693['dateStart'])['add'](0x1,_0x68fc('0x34'));}_[_0x68fc('0x35')](_0x355c32['where'],{'createdAt':{'$gte':_0x374693[_0x68fc('0x29')],'$lte':_0x374693['dateEnd']}});}if(_0x48b7dd[_0x68fc('0x27')][_0x68fc('0x36')]){_0x355c32['where']=_[_0x68fc('0x35')](_0x355c32[_0x68fc('0x30')],{'$or':_[_0x68fc('0x37')](_0x355c32['attributes'],function(_0x494db8){var _0x289325={};_0x289325[_0x494db8]={'$like':'%'+_0x48b7dd['query'][_0x68fc('0x36')]+'%'};return _0x289325;})});}_0x355c32=_[_0x68fc('0x35')]({},_0x355c32,_0x48b7dd[_0x68fc('0x38')]);var _0x524bae={'where':_0x355c32[_0x68fc('0x30')]};return db['VoiceTransferReport'][_0x68fc('0x17')](_0x524bae)[_0x68fc('0x1f')](function(_0x29c1fa){_0x3c17df[_0x68fc('0x17')]=_0x29c1fa;if(_0x48b7dd[_0x68fc('0x27')]['includeAll']){_0x355c32[_0x68fc('0x39')]=[{'all':!![]}];}return db[_0x68fc('0x3a')]['findAll'](_0x355c32);})[_0x68fc('0x1f')](function(_0x49b7dd){_0x3c17df[_0x68fc('0x3b')]=_0x49b7dd;return _0x3c17df;})[_0x68fc('0x1f')](respondWithFilteredResult(_0xfea30,_0x355c32))[_0x68fc('0x3c')](handleError(_0xfea30,null));};exports[_0x68fc('0x3d')]=function(_0x5b28e8,_0x4d25b2){var _0x21caaf={'raw':!![],'where':{'id':_0x5b28e8[_0x68fc('0x3e')]['id']}},_0x3d0c79={};_0x3d0c79[_0x68fc('0x26')]=_[_0x68fc('0x3f')](db[_0x68fc('0x3a')][_0x68fc('0x25')]);_0x3d0c79[_0x68fc('0x27')]=_[_0x68fc('0x3f')](_0x5b28e8[_0x68fc('0x27')]);_0x3d0c79['filters']=_[_0x68fc('0x2a')](_0x3d0c79[_0x68fc('0x26')],_0x3d0c79[_0x68fc('0x27')]);_0x21caaf[_0x68fc('0x2b')]=_[_0x68fc('0x2a')](_0x3d0c79[_0x68fc('0x26')],qs['fields'](_0x5b28e8[_0x68fc('0x27')][_0x68fc('0x2c')]));_0x21caaf[_0x68fc('0x2b')]=_0x21caaf['attributes'][_0x68fc('0x40')]?_0x21caaf['attributes']:_0x3d0c79[_0x68fc('0x26')];if(_0x5b28e8[_0x68fc('0x27')][_0x68fc('0x41')]){_0x21caaf['include']=[{'all':!![]}];}_0x21caaf=_[_0x68fc('0x35')]({},_0x21caaf,_0x5b28e8[_0x68fc('0x38')]);return db[_0x68fc('0x3a')][_0x68fc('0x42')](_0x21caaf)[_0x68fc('0x1f')](handleEntityNotFound(_0x4d25b2,null))['then'](respondWithResult(_0x4d25b2,null))[_0x68fc('0x3c')](handleError(_0x4d25b2,null));};exports[_0x68fc('0x43')]=function(_0x5b3ae4,_0x4a8fc3){return db[_0x68fc('0x3a')][_0x68fc('0x43')](_0x5b3ae4[_0x68fc('0x44')],{})[_0x68fc('0x1f')](respondWithResult(_0x4a8fc3,0xc9))[_0x68fc('0x3c')](handleError(_0x4a8fc3,null));};exports['update']=function(_0x23b9f5,_0x426f68){if(_0x23b9f5['body']['id']){delete _0x23b9f5[_0x68fc('0x44')]['id'];}return db[_0x68fc('0x3a')][_0x68fc('0x42')]({'where':{'id':_0x23b9f5[_0x68fc('0x3e')]['id']}})[_0x68fc('0x1f')](handleEntityNotFound(_0x426f68,null))['then'](saveUpdates(_0x23b9f5[_0x68fc('0x44')],null))[_0x68fc('0x1f')](respondWithResult(_0x426f68,null))[_0x68fc('0x3c')](handleError(_0x426f68,null));};exports['destroy']=function(_0x5a5c81,_0x42293c){return db[_0x68fc('0x3a')][_0x68fc('0x42')]({'where':{'id':_0x5a5c81[_0x68fc('0x3e')]['id']}})['then'](handleEntityNotFound(_0x42293c,null))[_0x68fc('0x1f')](removeEntity(_0x42293c,null))['catch'](handleError(_0x42293c,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 984f68e..8925045 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 _0xf379=['report_call_transfer','lodash','util','../../config/logger','api','moment','request-promise','exports','VoiceTransferReport'];(function(_0x3ddfb6,_0x4fe56d){var _0x4697f0=function(_0x481670){while(--_0x481670){_0x3ddfb6['push'](_0x3ddfb6['shift']());}};_0x4697f0(++_0x4fe56d);}(_0xf379,0x1f0));var _0x9f37=function(_0x5cfd03,_0x11585e){_0x5cfd03=_0x5cfd03-0x0;var _0x323144=_0xf379[_0x5cfd03];return _0x323144;};'use strict';var _=require(_0x9f37('0x0'));var util=require(_0x9f37('0x1'));var logger=require(_0x9f37('0x2'))(_0x9f37('0x3'));var moment=require(_0x9f37('0x4'));var BPromise=require('bluebird');var rp=require(_0x9f37('0x5'));var attributes=require('./voiceTransferReport.attributes');module[_0x9f37('0x6')]=function(_0x236505,_0x4b60e4){return _0x236505['define'](_0x9f37('0x7'),attributes,{'tableName':_0x9f37('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x93c2=['api','bluebird','request-promise','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0x93c2,0xbb));var _0x293c=function(_0xee39eb,_0x1eecdb){_0xee39eb=_0xee39eb-0x0;var _0x4f6498=_0x93c2[_0xee39eb];return _0x4f6498;};'use strict';var _=require(_0x293c('0x0'));var util=require(_0x293c('0x1'));var logger=require(_0x293c('0x2'))(_0x293c('0x3'));var moment=require('moment');var BPromise=require(_0x293c('0x4'));var rp=require(_0x293c('0x5'));var attributes=require(_0x293c('0x6'));module[_0x293c('0x7')]=function(_0x40bc59,_0x1fd632){return _0x40bc59[_0x293c('0x8')](_0x293c('0x9'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 892553f..8ec50d3 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 _0xaa47=['../../config/utils','rpc','../../config/environment','client','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceTransferReport','options','then','CreateVoiceTransferReport','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2af263,_0x2cdeee){var _0x1774cb=function(_0x2675aa){while(--_0x2675aa){_0x2af263['push'](_0x2af263['shift']());}};_0x1774cb(++_0x2cdeee);}(_0xaa47,0xfe));var _0x7aa4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xaa47[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x7aa4('0x0'));var util=require(_0x7aa4('0x1'));var moment=require(_0x7aa4('0x2'));var BPromise=require(_0x7aa4('0x3'));var rs=require(_0x7aa4('0x4'));var fs=require('fs');var db=require(_0x7aa4('0x5'))['db'];var utils=require(_0x7aa4('0x6'));var logger=require('../../config/logger')(_0x7aa4('0x7'));var config=require(_0x7aa4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7aa4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x521dbd,_0x5c1f65,_0x36097d){return new BPromise(function(_0x24de9d,_0x1b1d89){return client[_0x7aa4('0xa')](_0x521dbd,_0x36097d)['then'](function(_0x37a76c){logger[_0x7aa4('0xb')](_0x7aa4('0xc'),_0x5c1f65,_0x7aa4('0xd'));logger[_0x7aa4('0xe')](_0x7aa4('0xf'),_0x5c1f65,_0x7aa4('0xd'),JSON['stringify'](_0x37a76c));if(_0x37a76c[_0x7aa4('0x10')]){if(_0x37a76c[_0x7aa4('0x10')][_0x7aa4('0x11')]===0x1f4){logger[_0x7aa4('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c1f65,_0x37a76c[_0x7aa4('0x10')]['message']);return _0x1b1d89(_0x37a76c['error'][_0x7aa4('0x12')]);}logger[_0x7aa4('0x10')](_0x7aa4('0xc'),_0x5c1f65,_0x37a76c[_0x7aa4('0x10')][_0x7aa4('0x12')]);return _0x24de9d(_0x37a76c[_0x7aa4('0x10')][_0x7aa4('0x12')]);}else{logger[_0x7aa4('0xb')](_0x7aa4('0xc'),_0x5c1f65,_0x7aa4('0xd'));_0x24de9d(_0x37a76c[_0x7aa4('0x13')][_0x7aa4('0x12')]);}})[_0x7aa4('0x14')](function(_0x11108f){logger[_0x7aa4('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5c1f65,_0x11108f);_0x1b1d89(_0x11108f);});});}exports['CreateVoiceTransferReport']=function(_0x15e38c){var _0x3a8e9c=this;return new Promise(function(_0x9ff303,_0x3adee5){return db[_0x7aa4('0x15')]['create'](_0x15e38c['body'],{'raw':_0x15e38c[_0x7aa4('0x16')]?_0x15e38c[_0x7aa4('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x7aa4('0x17')](function(_0x5d30f0){logger[_0x7aa4('0xb')](_0x7aa4('0x18'),_0x15e38c);logger[_0x7aa4('0xe')](_0x7aa4('0x18'),_0x15e38c,JSON[_0x7aa4('0x19')](_0x5d30f0));_0x9ff303(_0x5d30f0);})[_0x7aa4('0x14')](function(_0x587beb){logger[_0x7aa4('0x10')](_0x7aa4('0x18'),_0x587beb['message'],_0x15e38c);_0x3adee5(_0x3a8e9c[_0x7aa4('0x10')](0x1f4,_0x587beb[_0x7aa4('0x12')]));});});}; \ No newline at end of file +var _0x316b=['error','code','VoiceTransferReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e0de6,_0x5d1459){var _0x5707ff=function(_0x567f3a){while(--_0x567f3a){_0x1e0de6['push'](_0x1e0de6['shift']());}};_0x5707ff(++_0x5d1459);}(_0x316b,0x176));var _0xb316=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x316b[_0x267d8d];return _0x11a98f;};'use strict';var _=require(_0xb316('0x0'));var util=require(_0xb316('0x1'));var moment=require(_0xb316('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var db=require(_0xb316('0x3'))['db'];var utils=require(_0xb316('0x4'));var logger=require(_0xb316('0x5'))(_0xb316('0x6'));var config=require(_0xb316('0x7'));var jayson=require(_0xb316('0x8'));var client=jayson[_0xb316('0x9')][_0xb316('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a338c,_0x5d3db6,_0xd872c1){return new BPromise(function(_0x12f335,_0x3fb500){return client[_0xb316('0xb')](_0x8a338c,_0xd872c1)[_0xb316('0xc')](function(_0x59b772){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x5d3db6,'request\x20sent');logger[_0xb316('0xd')](_0xb316('0xe'),_0x5d3db6,'request\x20sent',JSON[_0xb316('0xf')](_0x59b772));if(_0x59b772[_0xb316('0x10')]){if(_0x59b772[_0xb316('0x10')][_0xb316('0x11')]===0x1f4){logger['error'](_0xb316('0x12'),_0x5d3db6,_0x59b772['error']['message']);return _0x3fb500(_0x59b772[_0xb316('0x10')][_0xb316('0x13')]);}logger['error'](_0xb316('0x12'),_0x5d3db6,_0x59b772[_0xb316('0x10')][_0xb316('0x13')]);return _0x12f335(_0x59b772['error'][_0xb316('0x13')]);}else{logger[_0xb316('0x14')](_0xb316('0x12'),_0x5d3db6,_0xb316('0x15'));_0x12f335(_0x59b772[_0xb316('0x16')][_0xb316('0x13')]);}})[_0xb316('0x17')](function(_0x3888e9){logger[_0xb316('0x10')]('VoiceTransferReport,\x20%s,\x20%s',_0x5d3db6,_0x3888e9);_0x3fb500(_0x3888e9);});});}exports[_0xb316('0x18')]=function(_0xff37da){var _0x2e5f63=this;return new Promise(function(_0x366577,_0xff352f){return db[_0xb316('0x19')][_0xb316('0x1a')](_0xff37da[_0xb316('0x1b')],{'raw':_0xff37da['options']?_0xff37da[_0xb316('0x1c')][_0xb316('0x1d')]===undefined?!![]:![]:!![]})[_0xb316('0xc')](function(_0x2ac958){logger[_0xb316('0x14')](_0xb316('0x18'),_0xff37da);logger[_0xb316('0xd')]('CreateVoiceTransferReport',_0xff37da,JSON[_0xb316('0xf')](_0x2ac958));_0x366577(_0x2ac958);})[_0xb316('0x17')](function(_0x157615){logger['error'](_0xb316('0x18'),_0x157615[_0xb316('0x13')],_0xff37da);_0xff352f(_0x2e5f63['error'](0x1f4,_0x157615[_0xb316('0x13')]));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 313ad4b..49f01cc 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x03c5=['join','Offline\x20apps:','status','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule/chat','sync','then','start','info','Online\x20apps:','map','filter','online','name'];(function(_0x507ca4,_0x311f31){var _0x11c682=function(_0x4cec5e){while(--_0x4cec5e){_0x507ca4['push'](_0x507ca4['shift']());}};_0x11c682(++_0x311f31);}(_0x03c5,0x1a2));var _0x503c=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x03c5[_0x568496];return _0x26c5c1;};'use strict';var _=require(_0x503c('0x0'));var mysqldb=require(_0x503c('0x1'));var rpc=require(_0x503c('0x2'));var config=require(_0x503c('0x3'));var logger=require('./config/logger')(_0x503c('0x4'));var pm2=require(_0x503c('0x5'));var pm2Config=require(_0x503c('0x6'));var schedule=require('./config/schedule');var chat=require(_0x503c('0x7'));function main(){return mysqldb['db']['sequelize'][_0x503c('0x8')]()[_0x503c('0x9')](function(){return rpc['listen']();})[_0x503c('0x9')](function(_0x50046b){logger['info'](_0x50046b);return chat[_0x503c('0xa')]();})['then'](function(){return schedule[_0x503c('0xa')]();})[_0x503c('0x9')](function(_0x3187bf){logger[_0x503c('0xb')](_0x3187bf);return pm2['start'](pm2Config);})['then'](function(_0x5d47d7){logger[_0x503c('0xb')](_0x503c('0xc'),_[_0x503c('0xd')](_[_0x503c('0xe')](_0x5d47d7,{'status':_0x503c('0xf')}),_0x503c('0x10'))[_0x503c('0x11')]());logger[_0x503c('0xb')](_0x503c('0x12'),_[_0x503c('0xd')](_[_0x503c('0xe')](_0x5d47d7,function(_0xe95f93){return _0xe95f93[_0x503c('0x13')]!=='online';}),_0x503c('0x10'))[_0x503c('0x11')]()||_0x503c('0x14'));config[_0x503c('0x15')]&&require(_0x503c('0x16'))[_0x503c('0x17')]();require(_0x503c('0x18'))['default']();})[_0x503c('0x19')](function(_0x241917){logger[_0x503c('0x1a')](_0x503c('0x1b'),_0x241917);process[_0x503c('0x1c')](0x1);});}main(); \ No newline at end of file +var _0xb6b8=['default','./config/license','error','exit','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','sequelize','sync','then','info','start','Online\x20apps:','map','filter','online','status','join','None','seedDB','./config/seedDB'];(function(_0x5f1d51,_0x3c21a5){var _0x1e5e4b=function(_0xd1cd6c){while(--_0xd1cd6c){_0x5f1d51['push'](_0x5f1d51['shift']());}};_0x1e5e4b(++_0x3c21a5);}(_0xb6b8,0xe5));var _0x8b6b=function(_0x4ef4aa,_0x3cc5b3){_0x4ef4aa=_0x4ef4aa-0x0;var _0x1433b3=_0xb6b8[_0x4ef4aa];return _0x1433b3;};'use strict';var _=require('lodash');var mysqldb=require('./mysqldb');var rpc=require(_0x8b6b('0x0'));var config=require(_0x8b6b('0x1'));var logger=require(_0x8b6b('0x2'))(_0x8b6b('0x3'));var pm2=require(_0x8b6b('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x8b6b('0x5'));var chat=require(_0x8b6b('0x6'));function main(){return mysqldb['db'][_0x8b6b('0x7')][_0x8b6b('0x8')]()[_0x8b6b('0x9')](function(){return rpc['listen']();})[_0x8b6b('0x9')](function(_0x608857){logger[_0x8b6b('0xa')](_0x608857);return chat[_0x8b6b('0xb')]();})['then'](function(){return schedule[_0x8b6b('0xb')]();})['then'](function(_0x3a9115){logger[_0x8b6b('0xa')](_0x3a9115);return pm2[_0x8b6b('0xb')](pm2Config);})[_0x8b6b('0x9')](function(_0x9b8c6e){logger[_0x8b6b('0xa')](_0x8b6b('0xc'),_[_0x8b6b('0xd')](_[_0x8b6b('0xe')](_0x9b8c6e,{'status':_0x8b6b('0xf')}),'name')['join']());logger[_0x8b6b('0xa')]('Offline\x20apps:',_[_0x8b6b('0xd')](_[_0x8b6b('0xe')](_0x9b8c6e,function(_0x202b16){return _0x202b16[_0x8b6b('0x10')]!==_0x8b6b('0xf');}),'name')[_0x8b6b('0x11')]()||_0x8b6b('0x12'));config[_0x8b6b('0x13')]&&require(_0x8b6b('0x14'))[_0x8b6b('0x15')]();require(_0x8b6b('0x16'))[_0x8b6b('0x15')]();})['catch'](function(_0x27b818){logger[_0x8b6b('0x17')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x27b818);process[_0x8b6b('0x18')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 963be8a..3898009 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 _0x5612=['indexOf','cookie','motion.token','stringify','redirect','/dashboards/general','../../mysqldb','lodash','jsonwebtoken','express-jwt','composable-middleware','ipaddr.js','session','role','name','internal','email','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','isChatInteractionAuthorized','findOne','disposition','then','status','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','find','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format.','user','User\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','Forbidden','canUpdate','sign','secrets','signToken','hasRole','userRoles'];(function(_0x2a148c,_0x153356){var _0x315a27=function(_0x31d974){while(--_0x31d974){_0x2a148c['push'](_0x2a148c['shift']());}};_0x315a27(++_0x153356);}(_0x5612,0x7c));var _0x2561=function(_0x1ee7ef,_0x3a02c7){_0x1ee7ef=_0x1ee7ef-0x0;var _0x84066e=_0x5612[_0x1ee7ef];return _0x84066e;};'use strict';var db=require(_0x2561('0x0'))['db'];var config=require('../../config/environment');var _=require(_0x2561('0x1'));var jwt=require(_0x2561('0x2'));var expressJwt=require(_0x2561('0x3'));var compose=require(_0x2561('0x4'));var basicAuth=require('basic-auth');var ipaddr=require(_0x2561('0x5'));var validateJwt=expressJwt({'secret':config['secrets'][_0x2561('0x6')]});var userAttributes=['id',_0x2561('0x7'),'fullname',_0x2561('0x8'),_0x2561('0x9'),_0x2561('0xa'),'userpic',_0x2561('0xb'),_0x2561('0xc'),_0x2561('0xd'),_0x2561('0xe'),_0x2561('0xf'),_0x2561('0x10'),_0x2561('0x11'),_0x2561('0x12'),_0x2561('0x13'),_0x2561('0x14'),_0x2561('0x15')];exports[_0x2561('0x16')]=function(){return isAuthenticated(!![])['use'](function(_0x137963,_0x5c84fc,_0x48d828){if(_0x137963['user']){_0x48d828();}else{return db['ChatInteraction'][_0x2561('0x17')]({'where':{'id':_0x137963['params']['id']},'attributes':['id','closed',_0x2561('0x18')],'raw':!![]})[_0x2561('0x19')](function(_0x152506){if(_0x152506&&_0x152506['closed']){return _0x5c84fc[_0x2561('0x1a')](_0x152506[_0x2561('0x18')]==='unmanaged'?0x195:0x193)[_0x2561('0x1b')]({'message':_0x152506[_0x2561('0x18')]==='unmanaged'?_0x2561('0x1c'):_0x2561('0x1d')});}else{_0x48d828();}})[_0x2561('0x1e')](function(_0x565232){_0x48d828(_0x565232);});}});};function isAuthenticated(_0x41bf0a){return compose()[_0x2561('0x1f')](function(_0xe4a659,_0x355b2f,_0x34c26d){if(_0xe4a659[_0x2561('0x20')][_0x2561('0x21')]){if(_[_0x2561('0x22')](_0xe4a659[_0x2561('0x20')][_0x2561('0x21')],_0x2561('0x23'))){var _0x581441=basicAuth(_0xe4a659);db['User'][_0x2561('0x24')]({'where':{'name':_0x581441[_0x2561('0x8')]}})[_0x2561('0x19')](function(_0x29d254){if(!_0x29d254||!_0x29d254['authenticate'](_0x581441[_0x2561('0x25')])){return _0x355b2f[_0x2561('0x1a')](0x191)[_0x2561('0x1b')]({'message':_0x2561('0x26')});}_0xe4a659['user']={'id':_0x29d254['id']};_0x34c26d();})[_0x2561('0x1e')](function(_0x290185){_0x34c26d(_0x290185);});}else if(_[_0x2561('0x22')](_0xe4a659['headers']['authorization'],_0x2561('0x27'))){validateJwt(_0xe4a659,_0x355b2f,_0x34c26d);}}else{if(_0x41bf0a){_0x34c26d();}else{return _0x355b2f[_0x2561('0x1a')](0x191)[_0x2561('0x1b')]({'message':_0x2561('0x28')});}}})[_0x2561('0x1f')](function(_0x51d334,_0x3ca208,_0x38c67f){if(_0x51d334[_0x2561('0x29')]){db['User'][_0x2561('0x24')]({'where':{'id':_0x51d334[_0x2561('0x29')]['id']},'attributes':userAttributes})[_0x2561('0x19')](function(_0x31be99){if(!_0x31be99){return _0x3ca208[_0x2561('0x1a')](0x194)[_0x2561('0x1b')]({'message':_0x2561('0x2a')});}_0x51d334[_0x2561('0x29')]=_0x31be99;_0x38c67f();})['catch'](function(_0x2668e6){_0x38c67f(_0x2668e6);});}else if(_0x41bf0a){_0x38c67f();}else{return _0x3ca208[_0x2561('0x1a')](0x194)[_0x2561('0x1b')]({'message':'User\x20object\x20not\x20found.'});}});}exports[_0x2561('0x2b')]=isAuthenticated;function canUpdate(){return compose()[_0x2561('0x1f')](function(_0x3b56a2,_0x3108af,_0x2e1b0d){return require(_0x2561('0x2c'))[_0x2561('0x2d')]()[_0x2561('0x19')](function(_0x3a02f6){if(_0x3a02f6['update']){_0x2e1b0d();}else{return _0x3108af[_0x2561('0x1a')](0x193)[_0x2561('0x1b')]({'message':_0x2561('0x2e')});}})[_0x2561('0x1e')](function(_0x2b8655){_0x2e1b0d(_0x2b8655);});});}exports[_0x2561('0x2f')]=canUpdate;function signToken(_0x144090,_0x4f9850){return jwt[_0x2561('0x30')]({'id':_0x144090,'role':_0x4f9850},config[_0x2561('0x31')][_0x2561('0x6')],{'expiresIn':0x15180});}exports[_0x2561('0x32')]=signToken;exports[_0x2561('0x33')]=function(_0x52b78f){if(!_0x52b78f){throw new Error('Required\x20role\x20needs\x20to\x20be\x20set');}return compose()['use'](isAuthenticated())[_0x2561('0x1f')](function meetsRequirements(_0x3733e6,_0x1c7982,_0x2c1278){if(config[_0x2561('0x34')]['indexOf'](_0x3733e6['user'][_0x2561('0x7')])>=config[_0x2561('0x34')][_0x2561('0x35')](_0x52b78f)){return _0x2c1278();}else{return _0x1c7982['status'](0x193)[_0x2561('0x1b')]({'message':_0x2561('0x2e')});}});};exports['setTokenCookie']=function(_0x56eb78,_0x21bc5e){if(!_0x56eb78[_0x2561('0x29')]){return _0x21bc5e[_0x2561('0x1a')](0x194)[_0x2561('0x1b')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x2c3811=signToken(_0x56eb78[_0x2561('0x29')]['id'],_0x56eb78['user']['role']);_0x21bc5e[_0x2561('0x36')](_0x2561('0x37'),_0x2c3811);_0x21bc5e['cookie']('motion.user',JSON[_0x2561('0x38')](_['pick'](_0x56eb78['user'],userAttributes)));_0x21bc5e[_0x2561('0x39')](_0x2561('0x3a'));}; \ No newline at end of file +var _0xbe37=['authorization','startsWith','name','authenticate','Bearer','status','User','find','User\x20not\x20found.','User\x20object\x20not\x20found.','isAuthenticated','../../config/license/util','getLicense','canUpdate','sign','signToken','Required\x20role\x20needs\x20to\x20be\x20set','indexOf','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','motion.user','stringify','pick','redirect','/dashboards/general','../../mysqldb','lodash','jsonwebtoken','express-jwt','basic-auth','ipaddr.js','secrets','role','fullname','internal','userpic','permissions','voicePause','chatPause','mailPause','smsPause','pauseType','showWebBar','phoneBarRemoteControlPort','phoneBarRemoteControl','use','user','ChatInteraction','params','disposition','then','closed','unmanaged','json','Forbidden.','catch','headers'];(function(_0x3e2489,_0x41d9dd){var _0x2254ce=function(_0x227e46){while(--_0x227e46){_0x3e2489['push'](_0x3e2489['shift']());}};_0x2254ce(++_0x41d9dd);}(_0xbe37,0x107));var _0x7be3=function(_0x3c3416,_0x427c0a){_0x3c3416=_0x3c3416-0x0;var _0x1b6fbf=_0xbe37[_0x3c3416];return _0x1b6fbf;};'use strict';var db=require(_0x7be3('0x0'))['db'];var config=require('../../config/environment');var _=require(_0x7be3('0x1'));var jwt=require(_0x7be3('0x2'));var expressJwt=require(_0x7be3('0x3'));var compose=require('composable-middleware');var basicAuth=require(_0x7be3('0x4'));var ipaddr=require(_0x7be3('0x5'));var validateJwt=expressJwt({'secret':config[_0x7be3('0x6')]['session']});var userAttributes=['id',_0x7be3('0x7'),_0x7be3('0x8'),'name',_0x7be3('0x9'),'email',_0x7be3('0xa'),_0x7be3('0xb'),_0x7be3('0xc'),_0x7be3('0xd'),_0x7be3('0xe'),'faxPause',_0x7be3('0xf'),'openchannelPause',_0x7be3('0x10'),_0x7be3('0x11'),_0x7be3('0x12'),_0x7be3('0x13')];exports['isChatInteractionAuthorized']=function(){return isAuthenticated(!![])[_0x7be3('0x14')](function(_0x33bb2a,_0x21e8d8,_0x4414bb){if(_0x33bb2a[_0x7be3('0x15')]){_0x4414bb();}else{return db[_0x7be3('0x16')]['findOne']({'where':{'id':_0x33bb2a[_0x7be3('0x17')]['id']},'attributes':['id','closed',_0x7be3('0x18')],'raw':!![]})[_0x7be3('0x19')](function(_0x36c05b){if(_0x36c05b&&_0x36c05b[_0x7be3('0x1a')]){return _0x21e8d8['status'](_0x36c05b[_0x7be3('0x18')]===_0x7be3('0x1b')?0x195:0x193)[_0x7be3('0x1c')]({'message':_0x36c05b[_0x7be3('0x18')]==='unmanaged'?'Unmanaged.':_0x7be3('0x1d')});}else{_0x4414bb();}})[_0x7be3('0x1e')](function(_0x1b5d6b){_0x4414bb(_0x1b5d6b);});}});};function isAuthenticated(_0x269ef6){return compose()[_0x7be3('0x14')](function(_0x2ab041,_0x154c5c,_0x476a81){if(_0x2ab041[_0x7be3('0x1f')][_0x7be3('0x20')]){if(_[_0x7be3('0x21')](_0x2ab041['headers'][_0x7be3('0x20')],'Basic')){var _0x484d4a=basicAuth(_0x2ab041);db['User']['find']({'where':{'name':_0x484d4a[_0x7be3('0x22')]}})[_0x7be3('0x19')](function(_0x2bc1d8){if(!_0x2bc1d8||!_0x2bc1d8[_0x7be3('0x23')](_0x484d4a['pass'])){return _0x154c5c['status'](0x191)[_0x7be3('0x1c')]({'message':'Wrong\x20credentials.'});}_0x2ab041['user']={'id':_0x2bc1d8['id']};_0x476a81();})[_0x7be3('0x1e')](function(_0x46d17c){_0x476a81(_0x46d17c);});}else if(_[_0x7be3('0x21')](_0x2ab041[_0x7be3('0x1f')][_0x7be3('0x20')],_0x7be3('0x24'))){validateJwt(_0x2ab041,_0x154c5c,_0x476a81);}}else{if(_0x269ef6){_0x476a81();}else{return _0x154c5c[_0x7be3('0x25')](0x191)['json']({'message':'Unknown\x20authorization\x20format.'});}}})['use'](function(_0x458f90,_0x4ed24b,_0x3b0d22){if(_0x458f90[_0x7be3('0x15')]){db[_0x7be3('0x26')][_0x7be3('0x27')]({'where':{'id':_0x458f90[_0x7be3('0x15')]['id']},'attributes':userAttributes})['then'](function(_0x4ce638){if(!_0x4ce638){return _0x4ed24b[_0x7be3('0x25')](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x28')});}_0x458f90[_0x7be3('0x15')]=_0x4ce638;_0x3b0d22();})['catch'](function(_0x7aea66){_0x3b0d22(_0x7aea66);});}else if(_0x269ef6){_0x3b0d22();}else{return _0x4ed24b['status'](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x29')});}});}exports[_0x7be3('0x2a')]=isAuthenticated;function canUpdate(){return compose()[_0x7be3('0x14')](function(_0x57801f,_0x2111b5,_0x25720c){return require(_0x7be3('0x2b'))[_0x7be3('0x2c')]()['then'](function(_0x104af0){if(_0x104af0['update']){_0x25720c();}else{return _0x2111b5[_0x7be3('0x25')](0x193)[_0x7be3('0x1c')]({'message':'Forbidden'});}})[_0x7be3('0x1e')](function(_0x1cf1e2){_0x25720c(_0x1cf1e2);});});}exports[_0x7be3('0x2d')]=canUpdate;function signToken(_0xae4f00,_0x3915f5){return jwt[_0x7be3('0x2e')]({'id':_0xae4f00,'role':_0x3915f5},config[_0x7be3('0x6')]['session'],{'expiresIn':0x15180});}exports[_0x7be3('0x2f')]=signToken;exports['hasRole']=function(_0x4d59d3){if(!_0x4d59d3){throw new Error(_0x7be3('0x30'));}return compose()[_0x7be3('0x14')](isAuthenticated())[_0x7be3('0x14')](function meetsRequirements(_0x1c4307,_0x46bbcb,_0x230721){if(config['userRoles'][_0x7be3('0x31')](_0x1c4307[_0x7be3('0x15')][_0x7be3('0x7')])>=config['userRoles'][_0x7be3('0x31')](_0x4d59d3)){return _0x230721();}else{return _0x46bbcb['status'](0x193)['json']({'message':'Forbidden'});}});};exports[_0x7be3('0x32')]=function(_0xc40022,_0x426f4e){if(!_0xc40022[_0x7be3('0x15')]){return _0x426f4e[_0x7be3('0x25')](0x194)[_0x7be3('0x1c')]({'message':_0x7be3('0x33')});}var _0x30e7c0=signToken(_0xc40022[_0x7be3('0x15')]['id'],_0xc40022[_0x7be3('0x15')]['role']);_0x426f4e[_0x7be3('0x34')](_0x7be3('0x35'),_0x30e7c0);_0x426f4e[_0x7be3('0x34')](_0x7be3('0x36'),JSON[_0x7be3('0x37')](_[_0x7be3('0x38')](_0xc40022[_0x7be3('0x15')],userAttributes)));_0x426f4e[_0x7be3('0x39')](_0x7be3('0x3a'));}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index d2bb464..6651194 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 _0xff89=['data','update','binary','write','end','close','unlink','decryptFile','createDecipher','algorithm','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher'];(function(_0x5f4abc,_0x1692ac){var _0x3c29a6=function(_0x46309e){while(--_0x46309e){_0x5f4abc['push'](_0x5f4abc['shift']());}};_0x3c29a6(++_0x1692ac);}(_0xff89,0x196));var _0x9ff8=function(_0x377b2a,_0x17daf1){_0x377b2a=_0x377b2a-0x0;var _0x3b6c81=_0xff89[_0x377b2a];return _0x3b6c81;};'use strict';var crypto=require(_0x9ff8('0x0'));var fs=require('fs');var BPromise=require(_0x9ff8('0x1'));var defaultOptions={'algorithm':_0x9ff8('0x2')};function combineOptions(_0x18168d){var _0x5205ad={};for(var _0x19e76c in defaultOptions){if(defaultOptions[_0x9ff8('0x3')](_0x19e76c)){_0x5205ad[_0x19e76c]=defaultOptions[_0x19e76c];}}if(_0x18168d){for(var _0x26f2d8 in _0x18168d){if(_0x18168d['hasOwnProperty'](_0x26f2d8)){_0x5205ad[_0x26f2d8]=_0x18168d[_0x26f2d8];}}}return _0x5205ad;}exports[_0x9ff8('0x4')]=function(_0x1e3f56,_0x17ad9d,_0x15204a,_0x30c1a9){return new BPromise(function(_0x2c6b3d,_0x55253a){_0x30c1a9=combineOptions(_0x30c1a9);var _0x2415dc=new Buffer(_0x15204a);var _0x52d062=fs[_0x9ff8('0x5')](_0x1e3f56);var _0x328b99=fs[_0x9ff8('0x6')](_0x17ad9d);var _0x48c4db=crypto[_0x9ff8('0x7')](_0x30c1a9['algorithm'],_0x2415dc);_0x52d062['on'](_0x9ff8('0x8'),function(_0x245552){var _0x37f26b=new Buffer(_0x48c4db[_0x9ff8('0x9')](_0x245552),_0x9ff8('0xa'));_0x328b99[_0x9ff8('0xb')](_0x37f26b);});_0x52d062['on'](_0x9ff8('0xc'),function(){try{var _0x5a16dc=new Buffer(_0x48c4db['final'](_0x9ff8('0xa')),_0x9ff8('0xa'));_0x328b99[_0x9ff8('0xb')](_0x5a16dc);_0x328b99['end']();_0x328b99['on'](_0x9ff8('0xd'),function(){return _0x2c6b3d(_0x17ad9d);});}catch(_0x31f237){fs[_0x9ff8('0xe')](_0x17ad9d);return _0x55253a(_0x31f237);}});});};exports[_0x9ff8('0xf')]=function(_0x121f44,_0x2d9dd6,_0x11d1ed,_0x10fc93){return new BPromise(function(_0x44b15b,_0x3082e3){_0x10fc93=combineOptions(_0x10fc93);var _0x12a6b6=new Buffer(_0x11d1ed);var _0x159742=fs[_0x9ff8('0x5')](_0x121f44);var _0x54605d=fs['createWriteStream'](_0x2d9dd6);var _0x1b1e51=crypto[_0x9ff8('0x10')](_0x10fc93[_0x9ff8('0x11')],_0x12a6b6);_0x159742['on'](_0x9ff8('0x8'),function(_0x9fcbe3){var _0x158656=new Buffer(_0x1b1e51[_0x9ff8('0x9')](_0x9fcbe3),_0x9ff8('0xa'));_0x54605d[_0x9ff8('0xb')](_0x158656);});_0x159742['on'](_0x9ff8('0xc'),function(){try{var _0x49d5a7=new Buffer(_0x1b1e51['final'](_0x9ff8('0xa')),_0x9ff8('0xa'));_0x54605d['write'](_0x49d5a7);_0x54605d[_0x9ff8('0xc')]();_0x54605d['on'](_0x9ff8('0xd'),function(){return _0x44b15b(_0x2d9dd6);});}catch(_0x3a6b1d){fs[_0x9ff8('0xe')](_0x2d9dd6);return _0x3082e3(_0x3a6b1d);}});});}; \ No newline at end of file +var _0xa219=['binary','write','end','final','close','decryptFile','createWriteStream','createDecipher','unlink','crypto','bluebird','aes192','hasOwnProperty','createReadStream','createCipher','algorithm','data','update'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xa219,0x1dd));var _0x9a21=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xa219[_0x4d08b8];return _0x70214a;};'use strict';var crypto=require(_0x9a21('0x0'));var fs=require('fs');var BPromise=require(_0x9a21('0x1'));var defaultOptions={'algorithm':_0x9a21('0x2')};function combineOptions(_0x75e8d0){var _0x23303b={};for(var _0x660372 in defaultOptions){if(defaultOptions[_0x9a21('0x3')](_0x660372)){_0x23303b[_0x660372]=defaultOptions[_0x660372];}}if(_0x75e8d0){for(var _0x796326 in _0x75e8d0){if(_0x75e8d0[_0x9a21('0x3')](_0x796326)){_0x23303b[_0x796326]=_0x75e8d0[_0x796326];}}}return _0x23303b;}exports['encryptFile']=function(_0x34cd83,_0x3d5e8d,_0x532136,_0x2b317f){return new BPromise(function(_0x3dc55b,_0x5f09e9){_0x2b317f=combineOptions(_0x2b317f);var _0x500c40=new Buffer(_0x532136);var _0x4dd5ef=fs[_0x9a21('0x4')](_0x34cd83);var _0x2583d0=fs['createWriteStream'](_0x3d5e8d);var _0x5c5fae=crypto[_0x9a21('0x5')](_0x2b317f[_0x9a21('0x6')],_0x500c40);_0x4dd5ef['on'](_0x9a21('0x7'),function(_0x287253){var _0x2e2278=new Buffer(_0x5c5fae[_0x9a21('0x8')](_0x287253),_0x9a21('0x9'));_0x2583d0[_0x9a21('0xa')](_0x2e2278);});_0x4dd5ef['on'](_0x9a21('0xb'),function(){try{var _0x520f6a=new Buffer(_0x5c5fae[_0x9a21('0xc')](_0x9a21('0x9')),_0x9a21('0x9'));_0x2583d0[_0x9a21('0xa')](_0x520f6a);_0x2583d0[_0x9a21('0xb')]();_0x2583d0['on'](_0x9a21('0xd'),function(){return _0x3dc55b(_0x3d5e8d);});}catch(_0x5706d8){fs['unlink'](_0x3d5e8d);return _0x5f09e9(_0x5706d8);}});});};exports[_0x9a21('0xe')]=function(_0x14eb8c,_0x1d69c4,_0x2b3a5e,_0x36ff0f){return new BPromise(function(_0x4093a8,_0x30533d){_0x36ff0f=combineOptions(_0x36ff0f);var _0x368720=new Buffer(_0x2b3a5e);var _0x30f0bc=fs[_0x9a21('0x4')](_0x14eb8c);var _0x6b0682=fs[_0x9a21('0xf')](_0x1d69c4);var _0x4474fe=crypto[_0x9a21('0x10')](_0x36ff0f['algorithm'],_0x368720);_0x30f0bc['on'](_0x9a21('0x7'),function(_0x5e6d11){var _0x10cd6c=new Buffer(_0x4474fe[_0x9a21('0x8')](_0x5e6d11),_0x9a21('0x9'));_0x6b0682[_0x9a21('0xa')](_0x10cd6c);});_0x30f0bc['on'](_0x9a21('0xb'),function(){try{var _0x34bd2b=new Buffer(_0x4474fe[_0x9a21('0xc')]('binary'),_0x9a21('0x9'));_0x6b0682[_0x9a21('0xa')](_0x34bd2b);_0x6b0682[_0x9a21('0xb')]();_0x6b0682['on'](_0x9a21('0xd'),function(){return _0x4093a8(_0x1d69c4);});}catch(_0x2d4d0c){fs[_0x9a21('0x11')](_0x1d69c4);return _0x30533d(_0x2d4d0c);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1689908..f06fc60 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 _0x814b=['SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','error','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','Setting','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0x814b,0x1a2));var _0xb814=function(_0x19a11f,_0x6d8be7){_0x19a11f=_0x19a11f-0x0;var _0x51485f=_0x814b[_0x19a11f];return _0x51485f;};'use strict';var util=require(_0xb814('0x0'));var path=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var csv=require(_0xb814('0x3'));var fs=require('fs');var BPromise=require(_0xb814('0x4'));var zipdir=require(_0xb814('0x5'));var rimraf=require('rimraf');var db=require(_0xb814('0x6'))['db'];var dbH=require(_0xb814('0x6'))[_0xb814('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0xb814('0x8')][0x2]);var QUERY=process[_0xb814('0x8')][0x3];var PATH=process[_0xb814('0x8')][0x4];function analyticExtractedReport(_0x53e507,_0x3b0829){var _0x2e6272={'status':_0x53e507};var _0x5c8539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b0829){_0x2e6272[_0xb814('0x9')]=_0x3b0829;}return db[_0xb814('0xa')][_0xb814('0xb')](_0x2e6272,_0x5c8539);}function main(){var _0x41166c=0x1388;var _0x1fea33;return db[_0xb814('0xc')][_0xb814('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb814('0xe'),_0xb814('0xf')]})[_0xb814('0x10')](function(_0x10e4a6){if(_0x10e4a6){_0x1fea33=_0x10e4a6;_0x41166c=_0x1fea33['splitSizeCsv']||0x1388;}})[_0xb814('0x10')](function(){return dbH['sequelize'][_0xb814('0x11')](util[_0xb814('0x12')](_0xb814('0x13'),QUERY),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')][_0xb814('0x16')]});})[_0xb814('0x10')](function(_0x41ed7b){if(!_0x41ed7b[0x0][_0xb814('0x17')]){return analyticExtractedReport(_0xb814('0x18'));}var _0x3f4881=[];var _0x44fb96=0x0;var _0x17f5bd=!![];if(_0x41ed7b&&_0x41ed7b[_0xb814('0x19')]){var _0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c);if(_0x1fea33[_0xb814('0xe')]){for(;_0x17f5bd;_0x44fb96+=_0x41166c,_0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c)){if(_0x303aca==0x0||_0x303aca==_0x41ed7b[0x0][_0xb814('0x17')]){_0x17f5bd=![];}_0x3f4881[_0xb814('0x1a')](dbH[_0xb814('0x14')]['query'](util[_0xb814('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41166c,_0x44fb96),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')]['SELECT']}));}}else{_0x3f4881['push'](dbH['sequelize'][_0xb814('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb814('0x16')]}));}}var _0x24211d=path[_0xb814('0x1b')](PATH);var _0x4e139e=path[_0xb814('0x1c')](PATH,'.csv');var _0x1e6393=_0x1fea33[_0xb814('0xe')]&&_0x3f4881[_0xb814('0x19')]>0x1;var _0x470e81=[];if(!fs[_0xb814('0x1d')](path[_0xb814('0x1e')](_0x24211d,_0x4e139e))&&_0x1e6393){fs[_0xb814('0x1f')](path['join'](_0x24211d,_0x4e139e));}return BPromise[_0xb814('0x20')](_0x3f4881,function(_0x52b7a3){_0x470e81[_0xb814('0x1a')](_0x52b7a3);})[_0xb814('0x10')](function(){for(var _0x31c7ec=0x0;_0x31c7ec<_0x470e81[_0xb814('0x19')];_0x31c7ec+=0x1){var _0x1c8a2e;var _0xb9e57d=_0x470e81[_0x31c7ec];if(_0x1e6393){_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,_0x4e139e,util['format'](_0xb814('0x21'),_0x4e139e,_0x31c7ec,_0xb814('0x22')));}else{_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')](_0xb814('0x23'),_0x4e139e,_0xb814('0x22')));}fs[_0xb814('0x24')](_0x1c8a2e,csv(_0xb9e57d));}})[_0xb814('0x10')](function(){if(_0x1e6393){zipdir(path['join'](_0x24211d,_0x4e139e),{'saveTo':path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')]('%s.%s',_0x4e139e,_0xb814('0x25')))},function(_0x37d24d,_0x530744){});rimraf(path['join'](_0x24211d,_0x4e139e),function(){});}})[_0xb814('0x10')](function(){return analyticExtractedReport(_0xb814('0x26'),_0x1e6393?util['format'](_0xb814('0x23'),_0x4e139e,_0x1e6393?'zip':_0xb814('0x22')):null);});})['catch'](function(_0x4cfc58){console[_0xb814('0x27')](_0x4cfc58);return analyticExtractedReport('Error');});}main(); \ No newline at end of file +var _0x814b=['SELECT','num','Empty','length','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Completed','error','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','Setting','find','split','splitSizeCsv','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes'];(function(_0x2815,_0x5f3c49){var _0x42d012=function(_0x2288ad){while(--_0x2288ad){_0x2815['push'](_0x2815['shift']());}};_0x42d012(++_0x5f3c49);}(_0x814b,0x1a2));var _0xb814=function(_0x199b1f,_0x4ed849){_0x199b1f=_0x199b1f-0x0;var _0x267ac9=_0x814b[_0x199b1f];return _0x267ac9;};'use strict';var util=require(_0xb814('0x0'));var path=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var csv=require(_0xb814('0x3'));var fs=require('fs');var BPromise=require(_0xb814('0x4'));var zipdir=require(_0xb814('0x5'));var rimraf=require('rimraf');var db=require(_0xb814('0x6'))['db'];var dbH=require(_0xb814('0x6'))[_0xb814('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0xb814('0x8')][0x2]);var QUERY=process[_0xb814('0x8')][0x3];var PATH=process[_0xb814('0x8')][0x4];function analyticExtractedReport(_0x53e507,_0x3b0829){var _0x2e6272={'status':_0x53e507};var _0x5c8539={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3b0829){_0x2e6272[_0xb814('0x9')]=_0x3b0829;}return db[_0xb814('0xa')][_0xb814('0xb')](_0x2e6272,_0x5c8539);}function main(){var _0x41166c=0x1388;var _0x1fea33;return db[_0xb814('0xc')][_0xb814('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb814('0xe'),_0xb814('0xf')]})[_0xb814('0x10')](function(_0x10e4a6){if(_0x10e4a6){_0x1fea33=_0x10e4a6;_0x41166c=_0x1fea33['splitSizeCsv']||0x1388;}})[_0xb814('0x10')](function(){return dbH['sequelize'][_0xb814('0x11')](util[_0xb814('0x12')](_0xb814('0x13'),QUERY),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')][_0xb814('0x16')]});})[_0xb814('0x10')](function(_0x41ed7b){if(!_0x41ed7b[0x0][_0xb814('0x17')]){return analyticExtractedReport(_0xb814('0x18'));}var _0x3f4881=[];var _0x44fb96=0x0;var _0x17f5bd=!![];if(_0x41ed7b&&_0x41ed7b[_0xb814('0x19')]){var _0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c);if(_0x1fea33[_0xb814('0xe')]){for(;_0x17f5bd;_0x44fb96+=_0x41166c,_0x303aca=_0x41ed7b[0x0][_0xb814('0x17')]%(_0x44fb96+_0x41166c)){if(_0x303aca==0x0||_0x303aca==_0x41ed7b[0x0][_0xb814('0x17')]){_0x17f5bd=![];}_0x3f4881[_0xb814('0x1a')](dbH[_0xb814('0x14')]['query'](util[_0xb814('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x41166c,_0x44fb96),{'type':dbH[_0xb814('0x14')][_0xb814('0x15')]['SELECT']}));}}else{_0x3f4881['push'](dbH['sequelize'][_0xb814('0x11')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xb814('0x16')]}));}}var _0x24211d=path[_0xb814('0x1b')](PATH);var _0x4e139e=path[_0xb814('0x1c')](PATH,'.csv');var _0x1e6393=_0x1fea33[_0xb814('0xe')]&&_0x3f4881[_0xb814('0x19')]>0x1;var _0x470e81=[];if(!fs[_0xb814('0x1d')](path[_0xb814('0x1e')](_0x24211d,_0x4e139e))&&_0x1e6393){fs[_0xb814('0x1f')](path['join'](_0x24211d,_0x4e139e));}return BPromise[_0xb814('0x20')](_0x3f4881,function(_0x52b7a3){_0x470e81[_0xb814('0x1a')](_0x52b7a3);})[_0xb814('0x10')](function(){for(var _0x31c7ec=0x0;_0x31c7ec<_0x470e81[_0xb814('0x19')];_0x31c7ec+=0x1){var _0x1c8a2e;var _0xb9e57d=_0x470e81[_0x31c7ec];if(_0x1e6393){_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,_0x4e139e,util['format'](_0xb814('0x21'),_0x4e139e,_0x31c7ec,_0xb814('0x22')));}else{_0x1c8a2e=path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')](_0xb814('0x23'),_0x4e139e,_0xb814('0x22')));}fs[_0xb814('0x24')](_0x1c8a2e,csv(_0xb9e57d));}})[_0xb814('0x10')](function(){if(_0x1e6393){zipdir(path['join'](_0x24211d,_0x4e139e),{'saveTo':path[_0xb814('0x1e')](_0x24211d,util[_0xb814('0x12')]('%s.%s',_0x4e139e,_0xb814('0x25')))},function(_0x37d24d,_0x530744){});rimraf(path['join'](_0x24211d,_0x4e139e),function(){});}})[_0xb814('0x10')](function(){return analyticExtractedReport(_0xb814('0x26'),_0x1e6393?util['format'](_0xb814('0x23'),_0x4e139e,_0x1e6393?'zip':_0xb814('0x22')):null);});})['catch'](function(_0x4cfc58){console[_0xb814('0x27')](_0x4cfc58);return analyticExtractedReport('Error');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8bc6087..4fa36d3 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 _0x0d54=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','lodash','path','moment','zip-dir','rimraf','../../mysqldb','dbH','argv','AnalyticExtractedReport','update','hasOwnProperty','tableHeader','num','dirname','Setting','then','splitSizePdf','length','push','sequelize','query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','split','existsSync','join','each','name','startDate','endDate','landscape','header','black','toString','body','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','%s.%s','pdf','pipe','createWriteStream','error','log','end','zip','Completed','findOne'];(function(_0x58c982,_0x5697b4){var _0x3e93da=function(_0x5679cd){while(--_0x5679cd){_0x58c982['push'](_0x58c982['shift']());}};_0x3e93da(++_0x5697b4);}(_0x0d54,0x1c2));var _0x40d5=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0d54[_0xb24a3e];return _0x4038d7;};'use strict';var _=require(_0x40d5('0x0'));var fs=require('fs');var BPromise=require('bluebird');var util=require('util');var path=require(_0x40d5('0x1'));var moment=require(_0x40d5('0x2'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x40d5('0x3'));var rimraf=require(_0x40d5('0x4'));var db=require(_0x40d5('0x5'))['db'];var dbH=require(_0x40d5('0x5'))[_0x40d5('0x6')];var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x40d5('0x7')][0x4];var NAME=process[_0x40d5('0x7')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0x5b7c04,_0x50d170){var _0xc4a32={'status':_0x5b7c04};var _0x463c72={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50d170){_0xc4a32['savename']=_0x50d170;}return db[_0x40d5('0x8')][_0x40d5('0x9')](_0xc4a32,_0x463c72);}function getHeader(_0x5c2889){var _0x4e788f=[];for(var _0x3d16b2 in _0x5c2889){if(_0x5c2889[_0x40d5('0xa')](_0x3d16b2)){_0x4e788f['push']({'text':_0x3d16b2,'style':_0x40d5('0xb')});}}return _0x4e788f;}function extractReport(_0x4f414f){var _0x34803a=0x1388;var _0x2f3bd1;if(!_0x4f414f[0x0][_0x40d5('0xc')]){return analyticExtractedReport('Empty');}var _0x540cb0=[];var _0x4f182a=0x0;var _0x924ac8=!![];var _0x387f21=path[_0x40d5('0xd')](PATH);var _0x1b3bdc=path['basename'](PATH,'.pdf');var _0x14e14d=![];var _0x9ebec9=[];return db[_0x40d5('0xe')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x40d5('0xf')](function(_0x26ead7){if(_0x26ead7){_0x2f3bd1=_0x26ead7;_0x34803a=_0x2f3bd1[_0x40d5('0x10')]||0x3e8;}})[_0x40d5('0xf')](function(){if(_0x4f414f&&_0x4f414f[_0x40d5('0x11')]){var _0x152b35=_0x4f414f[0x0][_0x40d5('0xc')]%(_0x4f182a+_0x34803a);if(_0x2f3bd1['split']){for(;_0x924ac8;_0x4f182a+=_0x34803a,_0x152b35=_0x4f414f[0x0]['num']%(_0x4f182a+_0x34803a)){if(_0x152b35==0x0||_0x152b35==_0x4f414f[0x0][_0x40d5('0xc')]){_0x924ac8=![];}_0x540cb0[_0x40d5('0x12')](dbH[_0x40d5('0x13')][_0x40d5('0x14')](util[_0x40d5('0x15')](_0x40d5('0x16'),QUERY,_0x34803a,_0x4f182a),{'type':dbH['sequelize'][_0x40d5('0x17')][_0x40d5('0x18')]}));}}else{_0x540cb0['push'](dbH[_0x40d5('0x13')][_0x40d5('0x14')](QUERY,{'type':dbH[_0x40d5('0x13')][_0x40d5('0x17')][_0x40d5('0x18')]}));}}_0x14e14d=_0x2f3bd1[_0x40d5('0x19')]&&_0x540cb0['length']>0x1;if(!fs[_0x40d5('0x1a')](path[_0x40d5('0x1b')](_0x387f21,_0x1b3bdc))&&_0x14e14d){fs['mkdirSync'](path['join'](_0x387f21,_0x1b3bdc));}return BPromise[_0x40d5('0x1c')](_0x540cb0,function(_0x1a35f9){_0x9ebec9['push'](_0x1a35f9);});})['then'](function(){return BPromise[_0x40d5('0x1c')](_0x540cb0,function(_0x18633b,_0x2ceff6){var _0x46de0e;var _0x5af075=util[_0x40d5('0x15')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,_extractedReport[_0x40d5('0x1d')],moment(_extractedReport[_0x40d5('0x1e')])[_0x40d5('0x15')](FORMAT),moment(_extractedReport[_0x40d5('0x1f')])[_0x40d5('0x15')](FORMAT));var _0x601e36={'pageSize':'A4','pageOrientation':_0x40d5('0x20'),'content':[{'text':_0x5af075,'style':_0x40d5('0x21')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x40d5('0x22')}}};var _0x5c5254={'headerRows':0x1,'body':[]};_0x5c5254['body'][_0x40d5('0x12')](getHeader(_0x18633b[0x0]));var _0x233f4d;for(var _0x4dc722=0x0;_0x4dc722<_0x18633b[_0x40d5('0x11')];_0x4dc722+=0x1){_0x233f4d=[];for(var _0x2aacaa in _0x18633b[_0x4dc722]){if(_0x18633b[_0x4dc722][_0x40d5('0xa')](_0x2aacaa)){_0x233f4d[_0x40d5('0x12')](_0x18633b[_0x4dc722][_0x2aacaa]?_[_0x40d5('0x23')](_0x18633b[_0x4dc722][_0x2aacaa]):'');}}_0x5c5254[_0x40d5('0x24')][_0x40d5('0x12')](_0x233f4d);}_0x601e36[_0x40d5('0x25')]['push']({'table':_0x5c5254});return new BPromise(function(_0xb16c82,_0x5b9518){var _0x35ec40=new PdfPrinter({'Roboto':{'normal':__dirname+_0x40d5('0x26'),'bold':__dirname+_0x40d5('0x27'),'italics':__dirname+_0x40d5('0x28'),'bolditalics':__dirname+_0x40d5('0x29')}});var _0x150de0=_0x35ec40[_0x40d5('0x2a')](_0x601e36);if(_0x14e14d){_0x46de0e=path['join'](_0x387f21,_0x1b3bdc,util[_0x40d5('0x15')](_0x40d5('0x2b'),_0x1b3bdc,_0x2ceff6,'pdf'));}else{_0x46de0e=path['join'](_0x387f21,util[_0x40d5('0x15')](_0x40d5('0x2c'),_0x1b3bdc,_0x40d5('0x2d')));}var _0x5a8961=_0x150de0[_0x40d5('0x2e')](fs[_0x40d5('0x2f')](_0x46de0e));_0x5a8961['on']('finish',function(){_0xb16c82();});_0x5a8961['on'](_0x40d5('0x30'),function(_0x293453){console[_0x40d5('0x31')]('err',_0x293453);_0x5b9518(_0x293453);});_0x150de0[_0x40d5('0x32')]();});});})[_0x40d5('0xf')](function(){if(_0x14e14d){return new BPromise(function(_0xd7511,_0x5db602){zipdir(path[_0x40d5('0x1b')](_0x387f21,_0x1b3bdc),{'saveTo':path[_0x40d5('0x1b')](_0x387f21,util[_0x40d5('0x15')](_0x40d5('0x2c'),_0x1b3bdc,_0x40d5('0x33')))},function(_0xf38c7d){if(_0xf38c7d){_0x5db602(_0xf38c7d);}else{_0xd7511();}});});}})[_0x40d5('0xf')](function(){if(_0x14e14d){rimraf(path[_0x40d5('0x1b')](_0x387f21,_0x1b3bdc),function(){});}})['then'](function(){return analyticExtractedReport(_0x40d5('0x34'),_0x14e14d?util[_0x40d5('0x15')](_0x40d5('0x2c'),_0x1b3bdc,_0x14e14d?_0x40d5('0x33'):'pdf'):null);});}function main(){return db[_0x40d5('0x8')][_0x40d5('0x35')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x40d5('0xf')](function(_0x35116a){_extractedReport=_0x35116a;return dbH[_0x40d5('0x13')][_0x40d5('0x14')](util[_0x40d5('0x15')](_0x40d5('0x36'),QUERY),{'type':dbH[_0x40d5('0x13')][_0x40d5('0x17')]['SELECT']});})['then'](extractReport)[_0x40d5('0x37')](function(_0x2abc43){console[_0x40d5('0x30')](_0x2abc43);return analyticExtractedReport('Error');});}main(); \ No newline at end of file +var _0x2707=['Empty','dirname','basename','.pdf','find','split','splitSizePdf','then','length','num','push','sequelize','format','QueryTypes','SELECT','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','header','black','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','error','log','err','end','zip','Completed','AnalyticExtractedReport','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error','lodash','bluebird','path','pdfmake/src/printer','zip-dir','../../mysqldb','argv','savename','update','hasOwnProperty','tableHeader'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0x2707,0x65));var _0x7270=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x2707[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x7270('0x0'));var fs=require('fs');var BPromise=require(_0x7270('0x1'));var util=require('util');var path=require(_0x7270('0x2'));var moment=require('moment');var PdfPrinter=require(_0x7270('0x3'));var zipdir=require(_0x7270('0x4'));var rimraf=require('rimraf');var db=require(_0x7270('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var EXTRACTED_REPORT_ID=Number(process[_0x7270('0x6')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x7270('0x6')][0x4];var NAME=process[_0x7270('0x6')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var _extractedReport;function analyticExtractedReport(_0x1d3e3a,_0x2287d3){var _0x3fed28={'status':_0x1d3e3a};var _0x406169={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2287d3){_0x3fed28[_0x7270('0x7')]=_0x2287d3;}return db['AnalyticExtractedReport'][_0x7270('0x8')](_0x3fed28,_0x406169);}function getHeader(_0x1efb41){var _0x289604=[];for(var _0x46df3c in _0x1efb41){if(_0x1efb41[_0x7270('0x9')](_0x46df3c)){_0x289604['push']({'text':_0x46df3c,'style':_0x7270('0xa')});}}return _0x289604;}function extractReport(_0x496ea6){var _0x21b14a=0x1388;var _0x1833d9;if(!_0x496ea6[0x0]['num']){return analyticExtractedReport(_0x7270('0xb'));}var _0x2e02d0=[];var _0x4b4742=0x0;var _0x5d516c=!![];var _0x535e85=path[_0x7270('0xc')](PATH);var _0x423afd=path[_0x7270('0xd')](PATH,_0x7270('0xe'));var _0x3905ca=![];var _0xd909fa=[];return db['Setting'][_0x7270('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7270('0x10'),_0x7270('0x11')]})[_0x7270('0x12')](function(_0x3155aa){if(_0x3155aa){_0x1833d9=_0x3155aa;_0x21b14a=_0x1833d9[_0x7270('0x11')]||0x3e8;}})['then'](function(){if(_0x496ea6&&_0x496ea6[_0x7270('0x13')]){var _0x3877ee=_0x496ea6[0x0][_0x7270('0x14')]%(_0x4b4742+_0x21b14a);if(_0x1833d9[_0x7270('0x10')]){for(;_0x5d516c;_0x4b4742+=_0x21b14a,_0x3877ee=_0x496ea6[0x0]['num']%(_0x4b4742+_0x21b14a)){if(_0x3877ee==0x0||_0x3877ee==_0x496ea6[0x0][_0x7270('0x14')]){_0x5d516c=![];}_0x2e02d0[_0x7270('0x15')](dbH[_0x7270('0x16')]['query'](util[_0x7270('0x17')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x21b14a,_0x4b4742),{'type':dbH[_0x7270('0x16')][_0x7270('0x18')][_0x7270('0x19')]}));}}else{_0x2e02d0['push'](dbH[_0x7270('0x16')]['query'](QUERY,{'type':dbH['sequelize'][_0x7270('0x18')][_0x7270('0x19')]}));}}_0x3905ca=_0x1833d9[_0x7270('0x10')]&&_0x2e02d0[_0x7270('0x13')]>0x1;if(!fs['existsSync'](path[_0x7270('0x1a')](_0x535e85,_0x423afd))&&_0x3905ca){fs[_0x7270('0x1b')](path[_0x7270('0x1a')](_0x535e85,_0x423afd));}return BPromise[_0x7270('0x1c')](_0x2e02d0,function(_0x29f4ba){_0xd909fa['push'](_0x29f4ba);});})[_0x7270('0x12')](function(){return BPromise['each'](_0x2e02d0,function(_0xe85636,_0x2f2147){var _0x5e4839;var _0x1bdc68=util[_0x7270('0x17')](_0x7270('0x1d'),NAME,_extractedReport['name'],moment(_extractedReport[_0x7270('0x1e')])[_0x7270('0x17')](FORMAT),moment(_extractedReport[_0x7270('0x1f')])[_0x7270('0x17')](FORMAT));var _0x1d4f50={'pageSize':'A4','pageOrientation':_0x7270('0x20'),'content':[{'text':_0x1bdc68,'style':_0x7270('0x21')}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x7270('0x22')}}};var _0x2a3bc1={'headerRows':0x1,'body':[]};_0x2a3bc1[_0x7270('0x23')][_0x7270('0x15')](getHeader(_0xe85636[0x0]));var _0x57ac12;for(var _0x42855c=0x0;_0x42855c<_0xe85636[_0x7270('0x13')];_0x42855c+=0x1){_0x57ac12=[];for(var _0x5c0680 in _0xe85636[_0x42855c]){if(_0xe85636[_0x42855c][_0x7270('0x9')](_0x5c0680)){_0x57ac12[_0x7270('0x15')](_0xe85636[_0x42855c][_0x5c0680]?_[_0x7270('0x24')](_0xe85636[_0x42855c][_0x5c0680]):'');}}_0x2a3bc1[_0x7270('0x23')]['push'](_0x57ac12);}_0x1d4f50[_0x7270('0x25')][_0x7270('0x15')]({'table':_0x2a3bc1});return new BPromise(function(_0x55c672,_0x173613){var _0x348e82=new PdfPrinter({'Roboto':{'normal':__dirname+_0x7270('0x26'),'bold':__dirname+_0x7270('0x27'),'italics':__dirname+'/fonts/Roboto-Italic.ttf','bolditalics':__dirname+'/fonts/Roboto-MediumItalic.ttf'}});var _0x4512fb=_0x348e82[_0x7270('0x28')](_0x1d4f50);if(_0x3905ca){_0x5e4839=path[_0x7270('0x1a')](_0x535e85,_0x423afd,util[_0x7270('0x17')]('%s%d.%s',_0x423afd,_0x2f2147,_0x7270('0x29')));}else{_0x5e4839=path[_0x7270('0x1a')](_0x535e85,util[_0x7270('0x17')](_0x7270('0x2a'),_0x423afd,_0x7270('0x29')));}var _0x3638b1=_0x4512fb[_0x7270('0x2b')](fs[_0x7270('0x2c')](_0x5e4839));_0x3638b1['on'](_0x7270('0x2d'),function(){_0x55c672();});_0x3638b1['on'](_0x7270('0x2e'),function(_0x478003){console[_0x7270('0x2f')](_0x7270('0x30'),_0x478003);_0x173613(_0x478003);});_0x4512fb[_0x7270('0x31')]();});});})['then'](function(){if(_0x3905ca){return new BPromise(function(_0x568e8c,_0x2b5e0a){zipdir(path[_0x7270('0x1a')](_0x535e85,_0x423afd),{'saveTo':path[_0x7270('0x1a')](_0x535e85,util[_0x7270('0x17')]('%s.%s',_0x423afd,_0x7270('0x32')))},function(_0x394bba){if(_0x394bba){_0x2b5e0a(_0x394bba);}else{_0x568e8c();}});});}})[_0x7270('0x12')](function(){if(_0x3905ca){rimraf(path[_0x7270('0x1a')](_0x535e85,_0x423afd),function(){});}})[_0x7270('0x12')](function(){return analyticExtractedReport(_0x7270('0x33'),_0x3905ca?util[_0x7270('0x17')](_0x7270('0x2a'),_0x423afd,_0x3905ca?'zip':_0x7270('0x29')):null);});}function main(){return db[_0x7270('0x34')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x7270('0x12')](function(_0x200b27){_extractedReport=_0x200b27;return dbH[_0x7270('0x16')]['query'](util[_0x7270('0x17')](_0x7270('0x35'),QUERY),{'type':dbH[_0x7270('0x16')][_0x7270('0x18')][_0x7270('0x19')]});})['then'](extractReport)[_0x7270('0x36')](function(_0x6f1530){console['error'](_0x6f1530);return analyticExtractedReport(_0x7270('0x37'));});}main(); \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 62c8f80..14b6bfa 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 _0x1c7d=['binary','zip','catch','error','Error','util','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','Setting','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','split','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s'];(function(_0x15fef7,_0xbc02c5){var _0x13bb57=function(_0x488ce0){while(--_0x488ce0){_0x15fef7['push'](_0x15fef7['shift']());}};_0x13bb57(++_0xbc02c5);}(_0x1c7d,0x1a9));var _0xd1c7=function(_0xeadb5,_0x315c77){_0xeadb5=_0xeadb5-0x0;var _0x48b21d=_0x1c7d[_0xeadb5];return _0x48b21d;};'use strict';var util=require(_0xd1c7('0x0'));var path=require(_0xd1c7('0x1'));var _=require(_0xd1c7('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xd1c7('0x3'));var zipdir=require(_0xd1c7('0x4'));var rimraf=require(_0xd1c7('0x5'));var db=require(_0xd1c7('0x6'))['db'];var dbH=require(_0xd1c7('0x6'))[_0xd1c7('0x7')];var EXTRACTED_REPORT_ID=Number(process[_0xd1c7('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd1c7('0x8')][0x4];function analyticExtractedReport(_0x12075c,_0x19d416){var _0x46365a={'status':_0x12075c};var _0x3885e8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x19d416){_0x46365a[_0xd1c7('0x9')]=_0x19d416;}return db[_0xd1c7('0xa')][_0xd1c7('0xb')](_0x46365a,_0x3885e8);}function main(){var _0x290b96=0x1388;var _0xa55f89;return db[_0xd1c7('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xd1c7('0xd')]})[_0xd1c7('0xe')](function(_0x1a3eec){if(_0x1a3eec){_0xa55f89=_0x1a3eec;_0x290b96=_0xa55f89[_0xd1c7('0xd')]||0x1388;}})[_0xd1c7('0xe')](function(){return dbH['sequelize'][_0xd1c7('0xf')](util[_0xd1c7('0x10')](_0xd1c7('0x11'),QUERY),{'type':dbH[_0xd1c7('0x12')][_0xd1c7('0x13')][_0xd1c7('0x14')]});})['then'](function(_0x2757e2){if(!_0x2757e2[0x0][_0xd1c7('0x15')]){return analyticExtractedReport(_0xd1c7('0x16'));}var _0x13b035=[];var _0x2b34b6=0x0;var _0x142075=!![];if(_0xa55f89['split']){if(_0x2757e2&&_0x2757e2['length']){var _0x28bd32=_0x2757e2[0x0][_0xd1c7('0x15')]%(_0x2b34b6+_0x290b96);for(;_0x142075;_0x2b34b6+=_0x290b96,_0x28bd32=_0x2757e2[0x0][_0xd1c7('0x15')]%(_0x2b34b6+_0x290b96)){if(_0x28bd32==0x0||_0x28bd32==_0x2757e2[0x0][_0xd1c7('0x15')]){_0x142075=![];}_0x13b035[_0xd1c7('0x17')](dbH[_0xd1c7('0x12')]['query'](util['format'](_0xd1c7('0x18'),QUERY,_0x290b96,_0x2b34b6),{'type':dbH[_0xd1c7('0x12')][_0xd1c7('0x13')]['SELECT']}));}}}else{_0x13b035['push'](dbH['sequelize'][_0xd1c7('0xf')](QUERY,{'type':dbH[_0xd1c7('0x12')]['QueryTypes'][_0xd1c7('0x14')]}));}var _0xf54653=path[_0xd1c7('0x19')](PATH);var _0x40e687=path[_0xd1c7('0x1a')](PATH,_0xd1c7('0x1b'));var _0x3be76c=_0xa55f89[_0xd1c7('0x1c')]&&_0x13b035[_0xd1c7('0x1d')]>0x1;var _0x28970c=[];if(!fs[_0xd1c7('0x1e')](path[_0xd1c7('0x1f')](_0xf54653,_0x40e687))&&_0x3be76c){fs[_0xd1c7('0x20')](path[_0xd1c7('0x1f')](_0xf54653,_0x40e687));}return BPromise[_0xd1c7('0x21')](_0x13b035,function(_0x4cf5c9){_0x28970c[_0xd1c7('0x17')](_0x4cf5c9);})[_0xd1c7('0xe')](function(){for(var _0x270d33=0x0;_0x270d33<_0x28970c[_0xd1c7('0x1d')];_0x270d33+=0x1){var _0x5a863d;var _0x5161da=_0x28970c[_0x270d33];if(_0x3be76c){_0x5a863d=path['join'](_0xf54653,_0x40e687,util[_0xd1c7('0x10')](_0xd1c7('0x22'),_0x40e687,_0x270d33,_0xd1c7('0x23')));}else{_0x5a863d=path[_0xd1c7('0x1f')](_0xf54653,util['format'](_0xd1c7('0x24'),_0x40e687,_0xd1c7('0x23')));}fs['writeFileSync'](_0x5a863d,json2xls(_0x5161da),_0xd1c7('0x25'));}})['then'](function(){if(_0x3be76c){zipdir(path['join'](_0xf54653,_0x40e687),{'saveTo':path['join'](_0xf54653,util['format'](_0xd1c7('0x24'),_0x40e687,_0xd1c7('0x26')))},function(_0x21cca1,_0x1a1fa4){});rimraf(path[_0xd1c7('0x1f')](_0xf54653,_0x40e687),function(){});}})['then'](function(){return analyticExtractedReport('Completed',_0x3be76c?util[_0xd1c7('0x10')]('%s.%s',_0x40e687,_0x3be76c?'zip':_0xd1c7('0x23')):null);});})[_0xd1c7('0x27')](function(_0x6d2be2){console[_0xd1c7('0x28')](_0x6d2be2);return analyticExtractedReport(_0xd1c7('0x29'));});}main(); \ No newline at end of file +var _0x76f8=['util','path','lodash','json2xls','rimraf','../../mysqldb','dbH','argv','update','Setting','find','split','splitSizeXlsx','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','basename','join','mkdirSync','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','Completed','zip','catch','Error'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x76f8,0x1c8));var _0x876f=function(_0x50ad97,_0x5d6047){_0x50ad97=_0x50ad97-0x0;var _0x149ac2=_0x76f8[_0x50ad97];return _0x149ac2;};'use strict';var util=require(_0x876f('0x0'));var path=require(_0x876f('0x1'));var _=require(_0x876f('0x2'));var fs=require('fs');var json2xls=require(_0x876f('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x876f('0x4'));var db=require(_0x876f('0x5'))['db'];var dbH=require(_0x876f('0x5'))[_0x876f('0x6')];var EXTRACTED_REPORT_ID=Number(process[_0x876f('0x7')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x876f('0x7')][0x4];function analyticExtractedReport(_0x267552,_0x5cbdef){var _0x53416c={'status':_0x267552};var _0x3c62f1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5cbdef){_0x53416c['savename']=_0x5cbdef;}return db['AnalyticExtractedReport'][_0x876f('0x8')](_0x53416c,_0x3c62f1);}function main(){var _0x4935b2=0x1388;var _0x4b7599;return db[_0x876f('0x9')][_0x876f('0xa')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x876f('0xb'),_0x876f('0xc')]})['then'](function(_0x145dc4){if(_0x145dc4){_0x4b7599=_0x145dc4;_0x4935b2=_0x4b7599[_0x876f('0xc')]||0x1388;}})[_0x876f('0xd')](function(){return dbH[_0x876f('0xe')][_0x876f('0xf')](util[_0x876f('0x10')](_0x876f('0x11'),QUERY),{'type':dbH[_0x876f('0xe')][_0x876f('0x12')][_0x876f('0x13')]});})[_0x876f('0xd')](function(_0x1c5fd3){if(!_0x1c5fd3[0x0][_0x876f('0x14')]){return analyticExtractedReport(_0x876f('0x15'));}var _0x658d57=[];var _0x3e9874=0x0;var _0x3f1e17=!![];if(_0x4b7599['split']){if(_0x1c5fd3&&_0x1c5fd3[_0x876f('0x16')]){var _0x2d33b0=_0x1c5fd3[0x0]['num']%(_0x3e9874+_0x4935b2);for(;_0x3f1e17;_0x3e9874+=_0x4935b2,_0x2d33b0=_0x1c5fd3[0x0]['num']%(_0x3e9874+_0x4935b2)){if(_0x2d33b0==0x0||_0x2d33b0==_0x1c5fd3[0x0][_0x876f('0x14')]){_0x3f1e17=![];}_0x658d57['push'](dbH[_0x876f('0xe')][_0x876f('0xf')](util[_0x876f('0x10')](_0x876f('0x17'),QUERY,_0x4935b2,_0x3e9874),{'type':dbH[_0x876f('0xe')][_0x876f('0x12')][_0x876f('0x13')]}));}}}else{_0x658d57[_0x876f('0x18')](dbH[_0x876f('0xe')][_0x876f('0xf')](QUERY,{'type':dbH[_0x876f('0xe')][_0x876f('0x12')]['SELECT']}));}var _0x37c953=path['dirname'](PATH);var _0x328e32=path[_0x876f('0x19')](PATH,'.xlsx');var _0x56e3f5=_0x4b7599['split']&&_0x658d57[_0x876f('0x16')]>0x1;var _0x1a18fe=[];if(!fs['existsSync'](path[_0x876f('0x1a')](_0x37c953,_0x328e32))&&_0x56e3f5){fs[_0x876f('0x1b')](path[_0x876f('0x1a')](_0x37c953,_0x328e32));}return BPromise[_0x876f('0x1c')](_0x658d57,function(_0x38c93e){_0x1a18fe[_0x876f('0x18')](_0x38c93e);})[_0x876f('0xd')](function(){for(var _0x3b50b8=0x0;_0x3b50b8<_0x1a18fe[_0x876f('0x16')];_0x3b50b8+=0x1){var _0x7a349e;var _0x46d027=_0x1a18fe[_0x3b50b8];if(_0x56e3f5){_0x7a349e=path[_0x876f('0x1a')](_0x37c953,_0x328e32,util['format'](_0x876f('0x1d'),_0x328e32,_0x3b50b8,'xlsx'));}else{_0x7a349e=path[_0x876f('0x1a')](_0x37c953,util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,_0x876f('0x1f')));}fs[_0x876f('0x20')](_0x7a349e,json2xls(_0x46d027),_0x876f('0x21'));}})['then'](function(){if(_0x56e3f5){zipdir(path[_0x876f('0x1a')](_0x37c953,_0x328e32),{'saveTo':path[_0x876f('0x1a')](_0x37c953,util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,'zip'))},function(_0x321e89,_0x187d91){});rimraf(path[_0x876f('0x1a')](_0x37c953,_0x328e32),function(){});}})[_0x876f('0xd')](function(){return analyticExtractedReport(_0x876f('0x22'),_0x56e3f5?util[_0x876f('0x10')](_0x876f('0x1e'),_0x328e32,_0x56e3f5?_0x876f('0x23'):'xlsx'):null);});})[_0x876f('0x24')](function(_0x45a011){console['error'](_0x45a011);return analyticExtractedReport(_0x876f('0x25'));});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 6b33ba7..2b63494 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 _0x1ee9=['Progress','record','MixMonitor','recordingFormat',',ab','GotoIfTime',',${EXTEN},','last','Hangup','concat','transaction','bulkCreate','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','exten','CAST(priority\x20AS\x20UNSIGNED)','groupBy','queue','playback','hasOwnProperty','answer','priority','extensions','push','context','Set','format','VoiceExtensionId','length','updatedAt','*,*,*,*','interval','filter','tag','CDR(tag)=','callerID','type','CALLERID(all)=','indexOf','app','toLowerCase','custom','Answer','progress'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1ee9,0xe7));var _0x91ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ee9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91ee('0x0'));var util=require(_0x91ee('0x1'));function rewrite(_0x257bc7,_0x1e28e2){var _0x4f455d=this;return _0x257bc7[_0x91ee('0x2')][_0x91ee('0x3')][_0x91ee('0x4')]({'raw':!![]})[_0x91ee('0x5')](function(_0x25fe05){_0x4f455d[_0x91ee('0x6')]=_0x25fe05;return _0x257bc7['models'][_0x91ee('0x7')][_0x91ee('0x4')]({'where':{'IntervalId':_0x1e28e2[_0x91ee('0x8')]},'raw':!![]});})[_0x91ee('0x5')](function(_0x5e89e0){return _0x257bc7[_0x91ee('0x2')][_0x91ee('0x7')][_0x91ee('0x4')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x5e89e0,_0x91ee('0x9')))},'isApp':!![]},'order':[{'raw':_0x91ee('0xa')}],'raw':!![]});})[_0x91ee('0x5')](function(_0x5f2be1){var _0x3d68ac=_[_0x91ee('0xb')](_0x5f2be1,'exten');var _0x596112=[_0x91ee('0xc'),_0x91ee('0xd')];var _0xc20d2c=[];var _0x3d0a3a=[];for(var _0x3d36cd in _0x3d68ac){if(_0x3d68ac[_0x91ee('0xe')](_0x3d36cd)){_0x4f455d[_0x91ee('0xf')]=![];_0x4f455d['progress']=![];_0x4f455d[_0x91ee('0x10')]=0x2;_0x4f455d['extensions']=[];_0x4f455d[_0x91ee('0x11')][_0x91ee('0x12')]({'type':_0x3d68ac[_0x3d36cd][0x0]['type'],'context':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x13')],'exten':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x9')],'priority':_0x4f455d['priority']++,'app':_0x91ee('0x14'),'appdata':util[_0x91ee('0x15')]('CDR(type)=%s',_0x3d68ac[_0x3d36cd][0x0]['type']),'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});for(var _0xea9464=0x0,_0x1dda85=0x0;_0xea9464<_0x3d68ac[_0x3d36cd][_0x91ee('0x17')];_0xea9464+=0x1,_0x1dda85=0x0){var _0x183cd9=_0x3d68ac[_0x3d36cd][_0xea9464];var _0x28a44b=[];var _0x3e7d30=[];delete _0x183cd9['id'];delete _0x183cd9['createdAt'];delete _0x183cd9[_0x91ee('0x18')];var _0x17199f=_0x183cd9['interval']!==_0x91ee('0x19')?[_0x183cd9[_0x91ee('0x1a')]]:_0x183cd9[_0x91ee('0x8')]?_['map'](_[_0x91ee('0x1b')](_0x4f455d[_0x91ee('0x6')],{'IntervalId':_0x183cd9[_0x91ee('0x8')]}),_0x91ee('0x1a')):[];if(_0x183cd9['hasOwnProperty']('tag')){if(_0x183cd9['tag']&&_0x183cd9[_0x91ee('0x1c')]!=='--'){_0x28a44b['push']({'type':_0x183cd9['type'],'app':_0x91ee('0x14'),'appdata':_0x91ee('0x1d')+_0x183cd9['tag'],'context':_0x183cd9[_0x91ee('0x13')],'exten':_0x183cd9[_0x91ee('0x9')],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d['priority']+_0x1dda85++,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0]['VoiceExtensionId']});}}if(_0x183cd9[_0x91ee('0xe')](_0x91ee('0x1e'))){if(_0x183cd9[_0x91ee('0x1e')]){_0x28a44b[_0x91ee('0x12')]({'type':_0x183cd9[_0x91ee('0x1f')],'app':_0x91ee('0x14'),'appdata':_0x91ee('0x20')+_0x183cd9['callerID'],'context':_0x183cd9[_0x91ee('0x13')],'exten':_0x183cd9['exten'],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d[_0x91ee('0x10')]+_0x1dda85++,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});}}if(_0x183cd9[_0x91ee('0xe')](_0x91ee('0xf'))){if(_0x596112[_0x91ee('0x21')](_0x183cd9[_0x91ee('0x22')][_0x91ee('0x23')]())>=0x0&&_0x183cd9['appType']!==_0x91ee('0x24')){if(!_0x4f455d[_0x91ee('0xf')]&&_0x183cd9['answer']){_0x4f455d['answer']=!![];_0x28a44b[_0x91ee('0x12')]({'type':_0x183cd9[_0x91ee('0x1f')],'app':_0x91ee('0x25'),'context':_0x183cd9['context'],'exten':_0x183cd9[_0x91ee('0x9')],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d[_0x91ee('0x10')]+_0x1dda85++,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});}if(!_0x4f455d['answer']&&!_0x4f455d[_0x91ee('0x26')]&&!_0x183cd9[_0x91ee('0xf')]){_0x4f455d[_0x91ee('0x26')]=!![];_0x28a44b[_0x91ee('0x12')]({'type':_0x183cd9['type'],'app':_0x91ee('0x27'),'context':_0x183cd9[_0x91ee('0x13')],'exten':_0x183cd9['exten'],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d['priority']+_0x1dda85++,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});}}}if(_0x183cd9['hasOwnProperty'](_0x91ee('0x28'))&&_0x183cd9[_0x91ee('0xe')]('recordingFormat')){if(_0x183cd9[_0x91ee('0x28')]){_0x28a44b[_0x91ee('0x12')]({'type':_0x183cd9[_0x91ee('0x1f')],'app':_0x91ee('0x29'),'appdata':'${UNIQUEID}.'+_0x183cd9[_0x91ee('0x2a')]+_0x91ee('0x2b'),'context':_0x183cd9['context'],'exten':_0x183cd9[_0x91ee('0x9')],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d['priority']+_0x1dda85++,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0]['VoiceExtensionId']});}}if(_0x183cd9['hasOwnProperty'](_0x91ee('0x28'))&&_0x183cd9['hasOwnProperty']('recordingFormat')){if(_0x183cd9[_0x91ee('0x28')]){_0x3e7d30[_0x91ee('0x12')]({'type':_0x183cd9[_0x91ee('0x1f')],'app':'StopMixMonitor','appdata':null,'context':_0x183cd9[_0x91ee('0x13')],'exten':_0x183cd9[_0x91ee('0x9')],'priority':_0x17199f[_0x91ee('0x17')]+_0x4f455d[_0x91ee('0x10')]+_0x1dda85++ +0x1,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});}}for(var _0x5739d1=0x0;_0x5739d1<_0x17199f[_0x91ee('0x17')];_0x5739d1+=0x1){var _0xbd5750=_0x4f455d[_0x91ee('0x10')]+_0x17199f['length'];var _0x3ec310=_0x5739d1===_0x17199f[_0x91ee('0x17')]-0x1?_0x4f455d[_0x91ee('0x10')]+_0x28a44b['length']+_0x3e7d30[_0x91ee('0x17')]+0x2:_0x4f455d[_0x91ee('0x10')]+_0x5739d1+0x1;_0x28a44b['splice'](_0x5739d1,0x0,{'type':_0x183cd9[_0x91ee('0x1f')],'app':_0x91ee('0x2c'),'appdata':_0x17199f[_0x5739d1]+'?'+_0x183cd9[_0x91ee('0x13')]+_0x91ee('0x2d')+_0xbd5750+':'+_0x183cd9[_0x91ee('0x13')]+_0x91ee('0x2d')+_0x3ec310,'exten':_0x183cd9[_0x91ee('0x9')],'context':_0x183cd9[_0x91ee('0x13')],'priority':_0x4f455d[_0x91ee('0x10')]+_0x5739d1,'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});}_0x183cd9[_0x91ee('0x10')]=_0x28a44b[_0x91ee('0x17')]?_[_0x91ee('0x2e')](_0x28a44b)[_0x91ee('0x10')]+0x1:_0x4f455d['priority'];_0x4f455d[_0x91ee('0x10')]=(_0x3e7d30[_0x91ee('0x17')]?_[_0x91ee('0x2e')](_0x3e7d30)[_0x91ee('0x10')]:_0x183cd9[_0x91ee('0x10')])+0x1;_0x4f455d['extensions']=_['concat'](_0x4f455d[_0x91ee('0x11')],_0x28a44b,[_0x183cd9],_0x3e7d30);}_0x4f455d['extensions']['push']({'type':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x1f')],'app':_0x91ee('0x2f'),'exten':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x9')],'context':_0x3d68ac[_0x3d36cd][0x0]['context'],'priority':_0x4f455d[_0x91ee('0x10')],'VoiceExtensionId':_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]});_0xc20d2c['push'](_0x3d68ac[_0x3d36cd][0x0][_0x91ee('0x16')]);_0x3d0a3a=_[_0x91ee('0x30')](_0x3d0a3a,_0x4f455d[_0x91ee('0x11')]);}}return _0x257bc7[_0x91ee('0x31')](function(_0x4feeda){return _0x257bc7['models'][_0x91ee('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0xc20d2c}},'transaction':_0x4feeda})[_0x91ee('0x5')](function(_0x17cbbf){return _0x257bc7[_0x91ee('0x2')][_0x91ee('0x7')][_0x91ee('0x32')](_['sortBy'](_0x3d0a3a,_0x91ee('0x10')),{'transaction':_0x4feeda});});});})[_0x91ee('0x33')](function(_0x2f7218){console[_0x91ee('0x34')](_0x2f7218);});}exports[_0x91ee('0x35')]=rewrite; \ No newline at end of file +var _0x805a=['then','VoiceExtension','IntervalId','uniq','groupBy','exten','hasOwnProperty','answer','progress','priority','extensions','push','Set','format','CDR(type)=%s','type','VoiceExtensionId','length','updatedAt','interval','*,*,*,*','map','intervals','tag','CDR(tag)=','context','callerID','CALLERID(all)=','indexOf','toLowerCase','appType','custom','Answer','Progress','record','${UNIQUEID}.',',ab','recordingFormat','StopMixMonitor',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','util','models','findAll'];(function(_0x4388a9,_0xe58c02){var _0x4a9252=function(_0x71e58c){while(--_0x71e58c){_0x4388a9['push'](_0x4388a9['shift']());}};_0x4a9252(++_0xe58c02);}(_0x805a,0x18d));var _0xa805=function(_0x5eb456,_0x11789b){_0x5eb456=_0x5eb456-0x0;var _0x435279=_0x805a[_0x5eb456];return _0x435279;};'use strict';var _=require('lodash');var util=require(_0xa805('0x0'));function rewrite(_0x38bba6,_0x57c63b){var _0x2fb559=this;return _0x38bba6[_0xa805('0x1')]['Interval'][_0xa805('0x2')]({'raw':!![]})[_0xa805('0x3')](function(_0x3c66bc){_0x2fb559['intervals']=_0x3c66bc;return _0x38bba6['models'][_0xa805('0x4')][_0xa805('0x2')]({'where':{'IntervalId':_0x57c63b[_0xa805('0x5')]},'raw':!![]});})['then'](function(_0x1d43f3){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')]['findAll']({'where':{'exten':{'$in':_[_0xa805('0x6')](_['map'](_0x1d43f3,'exten'))},'isApp':!![]},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xa805('0x3')](function(_0x4b2a06){var _0x191cfb=_[_0xa805('0x7')](_0x4b2a06,_0xa805('0x8'));var _0x37ebaf=['queue','playback'];var _0x45081d=[];var _0x3fe0bd=[];for(var _0x9257f in _0x191cfb){if(_0x191cfb[_0xa805('0x9')](_0x9257f)){_0x2fb559[_0xa805('0xa')]=![];_0x2fb559[_0xa805('0xb')]=![];_0x2fb559[_0xa805('0xc')]=0x2;_0x2fb559[_0xa805('0xd')]=[];_0x2fb559[_0xa805('0xd')][_0xa805('0xe')]({'type':_0x191cfb[_0x9257f][0x0]['type'],'context':_0x191cfb[_0x9257f][0x0]['context'],'exten':_0x191cfb[_0x9257f][0x0][_0xa805('0x8')],'priority':_0x2fb559[_0xa805('0xc')]++,'app':_0xa805('0xf'),'appdata':util[_0xa805('0x10')](_0xa805('0x11'),_0x191cfb[_0x9257f][0x0][_0xa805('0x12')]),'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});for(var _0x1d6bc0=0x0,_0x2732c8=0x0;_0x1d6bc0<_0x191cfb[_0x9257f][_0xa805('0x14')];_0x1d6bc0+=0x1,_0x2732c8=0x0){var _0x5e2218=_0x191cfb[_0x9257f][_0x1d6bc0];var _0x722f5=[];var _0x305d1e=[];delete _0x5e2218['id'];delete _0x5e2218['createdAt'];delete _0x5e2218[_0xa805('0x15')];var _0x2e897e=_0x5e2218[_0xa805('0x16')]!==_0xa805('0x17')?[_0x5e2218['interval']]:_0x5e2218[_0xa805('0x5')]?_[_0xa805('0x18')](_['filter'](_0x2fb559[_0xa805('0x19')],{'IntervalId':_0x5e2218[_0xa805('0x5')]}),_0xa805('0x16')):[];if(_0x5e2218[_0xa805('0x9')](_0xa805('0x1a'))){if(_0x5e2218[_0xa805('0x1a')]&&_0x5e2218[_0xa805('0x1a')]!=='--'){_0x722f5[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':_0xa805('0xf'),'appdata':_0xa805('0x1b')+_0x5e2218[_0xa805('0x1a')],'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218['exten'],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559['priority']+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x1d'))){if(_0x5e2218[_0xa805('0x1d')]){_0x722f5['push']({'type':_0x5e2218['type'],'app':'Set','appdata':_0xa805('0x1e')+_0x5e2218[_0xa805('0x1d')],'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e['length']+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0xa'))){if(_0x37ebaf[_0xa805('0x1f')](_0x5e2218['app'][_0xa805('0x20')]())>=0x0&&_0x5e2218[_0xa805('0x21')]!==_0xa805('0x22')){if(!_0x2fb559['answer']&&_0x5e2218['answer']){_0x2fb559[_0xa805('0xa')]=!![];_0x722f5[_0xa805('0xe')]({'type':_0x5e2218['type'],'app':_0xa805('0x23'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0]['VoiceExtensionId']});}if(!_0x2fb559[_0xa805('0xa')]&&!_0x2fb559[_0xa805('0xb')]&&!_0x5e2218[_0xa805('0xa')]){_0x2fb559[_0xa805('0xb')]=!![];_0x722f5['push']({'type':_0x5e2218['type'],'app':_0xa805('0x24'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e['length']+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x25'))&&_0x5e2218[_0xa805('0x9')]('recordingFormat')){if(_0x5e2218[_0xa805('0x25')]){_0x722f5[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':'MixMonitor','appdata':_0xa805('0x26')+_0x5e2218['recordingFormat']+_0xa805('0x27'),'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218[_0xa805('0x8')],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0]['VoiceExtensionId']});}}if(_0x5e2218[_0xa805('0x9')](_0xa805('0x25'))&&_0x5e2218[_0xa805('0x9')](_0xa805('0x28'))){if(_0x5e2218[_0xa805('0x25')]){_0x305d1e[_0xa805('0xe')]({'type':_0x5e2218[_0xa805('0x12')],'app':_0xa805('0x29'),'appdata':null,'context':_0x5e2218[_0xa805('0x1c')],'exten':_0x5e2218['exten'],'priority':_0x2e897e[_0xa805('0x14')]+_0x2fb559[_0xa805('0xc')]+_0x2732c8++ +0x1,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}}for(var _0x1e45fe=0x0;_0x1e45fe<_0x2e897e[_0xa805('0x14')];_0x1e45fe+=0x1){var _0x21cc27=_0x2fb559[_0xa805('0xc')]+_0x2e897e[_0xa805('0x14')];var _0x53257b=_0x1e45fe===_0x2e897e[_0xa805('0x14')]-0x1?_0x2fb559[_0xa805('0xc')]+_0x722f5['length']+_0x305d1e[_0xa805('0x14')]+0x2:_0x2fb559[_0xa805('0xc')]+_0x1e45fe+0x1;_0x722f5['splice'](_0x1e45fe,0x0,{'type':_0x5e2218[_0xa805('0x12')],'app':'GotoIfTime','appdata':_0x2e897e[_0x1e45fe]+'?'+_0x5e2218['context']+',${EXTEN},'+_0x21cc27+':'+_0x5e2218['context']+_0xa805('0x2a')+_0x53257b,'exten':_0x5e2218[_0xa805('0x8')],'context':_0x5e2218['context'],'priority':_0x2fb559['priority']+_0x1e45fe,'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});}_0x5e2218['priority']=_0x722f5[_0xa805('0x14')]?_[_0xa805('0x2b')](_0x722f5)['priority']+0x1:_0x2fb559['priority'];_0x2fb559[_0xa805('0xc')]=(_0x305d1e['length']?_[_0xa805('0x2b')](_0x305d1e)[_0xa805('0xc')]:_0x5e2218['priority'])+0x1;_0x2fb559['extensions']=_['concat'](_0x2fb559['extensions'],_0x722f5,[_0x5e2218],_0x305d1e);}_0x2fb559['extensions']['push']({'type':_0x191cfb[_0x9257f][0x0][_0xa805('0x12')],'app':_0xa805('0x2c'),'exten':_0x191cfb[_0x9257f][0x0]['exten'],'context':_0x191cfb[_0x9257f][0x0][_0xa805('0x1c')],'priority':_0x2fb559['priority'],'VoiceExtensionId':_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]});_0x45081d[_0xa805('0xe')](_0x191cfb[_0x9257f][0x0][_0xa805('0x13')]);_0x3fe0bd=_[_0xa805('0x2d')](_0x3fe0bd,_0x2fb559[_0xa805('0xd')]);}}return _0x38bba6['transaction'](function(_0x5b42f2){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')][_0xa805('0x2e')]({'where':{'VoiceExtensionId':{'$in':_0x45081d}},'transaction':_0x5b42f2})[_0xa805('0x3')](function(_0x4485a4){return _0x38bba6[_0xa805('0x1')][_0xa805('0x4')][_0xa805('0x2f')](_[_0xa805('0x30')](_0x3fe0bd,'priority'),{'transaction':_0x5b42f2});});});})[_0xa805('0x31')](function(_0x379673){console['error'](_0x379673);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 3be7693..2984bf6 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 _0x6c76=['CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','\x20=\x20?','id\x20IN\x20?','str','calleridnum','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','all','Campaign','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','../../../mysqldb','../../../config/logger','util','lodash','socket.io-emitter','localhost','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','ListId'];(function(_0x52bd66,_0x226b74){var _0x61f4f8=function(_0x410941){while(--_0x410941){_0x52bd66['push'](_0x52bd66['shift']());}};_0x61f4f8(++_0x226b74);}(_0x6c76,0x184));var _0x66c7=function(_0x577a06,_0x50ac83){_0x577a06=_0x577a06-0x0;var _0x3f2595=_0x6c76[_0x577a06];return _0x3f2595;};'use strict';var BPromise=require(_0x66c7('0x0'));var db=require(_0x66c7('0x1'))['db'];var logger=require(_0x66c7('0x2'))('api');var util=require(_0x66c7('0x3'));var _=require(_0x66c7('0x4'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var socket=require(_0x66c7('0x5'))({'host':_0x66c7('0x6'),'port':0x18eb});require('../../../api/cmContact/cmContact.socket')[_0x66c7('0x7')](socket);try{if(!process[_0x66c7('0x8')][0x2]||process['argv'][0x2]===_0x66c7('0x9')||process['argv'][0x2]==='null'){throw new Error(_0x66c7('0xa'));}var FILEPATH=process[_0x66c7('0x8')][0x2];if(!process[_0x66c7('0x8')][0x3]||process['argv'][0x3]===_0x66c7('0x9')||process[_0x66c7('0x8')][0x3]===_0x66c7('0xb')||!process[_0x66c7('0x8')][0x4]||process['argv'][0x4]===_0x66c7('0x9')||process[_0x66c7('0x8')][0x4]===_0x66c7('0xb')){throw new Error(_0x66c7('0xc'));}var FIELDS=_[_0x66c7('0xd')](process[_0x66c7('0x8')][0x3][_0x66c7('0xe')](','),process['argv'][0x4][_0x66c7('0xe')](','));if(!process[_0x66c7('0x8')][0x5]||process[_0x66c7('0x8')][0x5]===_0x66c7('0x9')||process[_0x66c7('0x8')][0x5]===_0x66c7('0xb')){throw new Error(_0x66c7('0xf'));}var LISTID=process[_0x66c7('0x8')][0x5];var COMPANYID=process[_0x66c7('0x8')][0x6]&&process['argv'][0x6]!==_0x66c7('0x9')&&process['argv'][0x6]!==_0x66c7('0xb')?process[_0x66c7('0x8')][0x6]:null;var DUPLICATES=process[_0x66c7('0x8')][0x7]&&process[_0x66c7('0x8')][0x7]!==_0x66c7('0x9')&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x66c7('0x8')][0x8]===_0x66c7('0x9')||process['argv'][0x8]==='null'){throw new Error(_0x66c7('0x10'));}var SOCKET_TIMESTAMP=process[_0x66c7('0x8')][0x8];}catch(_0x4756f7){logger[_0x66c7('0x11')](_0x4756f7);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(_0x52437d,_0x49a3c7,_0x1853b2,_0x237177){var _0xf30f9={'message':_0x49a3c7};_0xf30f9[_0x52437d]=!![];if(_0x1853b2){_0xf30f9[_0x66c7('0x12')]=_0x1853b2;}if(_0x237177){_0xf30f9[_0x66c7('0x13')]=_0x237177;}return _0xf30f9;}function isEmail(_0x75f118){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'](_0x75f118);}function checkRow(_0x4ddbd2,_0x366e9b,_0x4a2b90){return new BPromise(function(_0x7462f1,_0x8b96b1){if(_[_0x66c7('0x14')](_0x4ddbd2)){return _0x8b96b1(handleCheckRowError(_0x66c7('0x11'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x4a2b90));}if(_0x4ddbd2[_0x66c7('0x15')]&&_0x4ddbd2[_0x66c7('0x15')]['length']){var _0x2ae31f=_[_0x66c7('0x16')](_0x4ddbd2[_0x66c7('0x15')],_0x66c7('0x17'))[_0x66c7('0x18')](';');return _0x8b96b1(handleCheckRowError('error',_0x2ae31f,null,_0x4a2b90));}var _0x5bc4e6={};for(var _0x4e514a in FIELDS){if(FIELDS[_0x66c7('0x19')](_0x4e514a)&&FIELDS[_0x4e514a]){_0x5bc4e6[_0x4e514a]=_0x4ddbd2[_0x66c7('0x1a')][0x0][FIELDS[_0x4e514a]]||_0x4ddbd2['data'][0x0]['\ufeff'+FIELDS[_0x4e514a]];}}if(!_0x5bc4e6[_0x66c7('0x1b')]){return _0x8b96b1(handleCheckRowError(_0x66c7('0x11'),_0x66c7('0x1c'),null,_0x4a2b90));}if(!_0x5bc4e6[_0x66c7('0x1d')]){return _0x8b96b1(handleCheckRowError(_0x66c7('0x11'),_0x66c7('0x1e'),null,_0x4a2b90));}if(_0x5bc4e6['birthDate']){var _0xccefb2=moment(_0x5bc4e6[_0x66c7('0x1f')],_0x66c7('0x20'));if(!_0xccefb2[_0x66c7('0x21')]()){return _0x8b96b1(handleCheckRowError(_0x66c7('0x11'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x4a2b90));}}if(_0x5bc4e6[_0x66c7('0x22')]){if(!isEmail(_0x5bc4e6['email'])){return _0x8b96b1(handleCheckRowError(_0x66c7('0x11'),'email\x20format\x20is\x20not\x20valid!',null,_0x4a2b90));}}_0x5bc4e6[_0x66c7('0x23')]=LISTID;_0x5bc4e6[_0x66c7('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x66c7('0x25')]&&_0x366e9b){var _0x2b492d={};for(var _0xb26028=0x0,_0x24e776=DUPLICATES['length'];_0xb26028<_0x24e776;_0xb26028+=0x1){_0x2b492d[DUPLICATES[_0xb26028]]=_0x5bc4e6[DUPLICATES[_0xb26028]];}var _0x520bd2=_[_0x66c7('0x26')](_0x366e9b,_0x2b492d);if(_0x520bd2){return _0x8b96b1(handleCheckRowError(_0x66c7('0x27'),_0x66c7('0x28'),_0x520bd2,_0x4a2b90));}}return db[_0x66c7('0x29')][_0x66c7('0x2a')](_0x5bc4e6,{'raw':!![],'hooks':![],'fields':_[_0x66c7('0x2b')](_0x5bc4e6)})[_0x66c7('0x2c')](function(_0x255ac3){if(DUPLICATES&&DUPLICATES[_0x66c7('0x25')]&&_0x366e9b){_0x366e9b[_0x66c7('0x2d')](_[_0x66c7('0x2e')](_0x5bc4e6,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x255ac3['id'];return _0x7462f1();})[_0x66c7('0x2f')](function(_0x4eb03f){return _0x8b96b1(handleCheckRowError('error',_0x66c7('0x30')+(_0x4eb03f[_0x66c7('0x17')]||JSON[_0x66c7('0x31')](_0x4eb03f)),null,_0x4a2b90));});});}function checkHopper(){function _0x1b2849(){return function(_0x45050c){logger[_0x66c7('0x11')](_0x66c7('0x32'),'checkHopper',util[_0x66c7('0x33')](_0x45050c,{'showHidden':![],'depth':null}));};}var _0x33b7ff=function(_0x2484d3,_0xd9e0f5){var _0x1e5993=squel[_0x66c7('0x34')]()[_0x66c7('0x35')](_0x66c7('0x36'))[_0x66c7('0x37')]([_0x66c7('0x1d'),_0x66c7('0x38'),'ContactId','ListId',_0xd9e0f5,_0x66c7('0x39'),_0x66c7('0x3a')],squel[_0x66c7('0x3b')]()['field']('phone',_0x66c7('0x1d'))[_0x66c7('0x3c')]('NOW()',_0x66c7('0x38'))[_0x66c7('0x3c')]('id',_0x66c7('0x3d'))['field'](LISTID[_0x66c7('0x3e')](),_0x66c7('0x23'))[_0x66c7('0x3c')](_0x2484d3['id'][_0x66c7('0x3e')](),_0xd9e0f5)[_0x66c7('0x3c')](_0x66c7('0x3f'),_0x66c7('0x39'))[_0x66c7('0x3c')](_0x66c7('0x3f'),'updatedAt')[_0x66c7('0x40')](_0x66c7('0x41'))[_0x66c7('0x42')](_0x66c7('0x43'))[_0x66c7('0x42')](_0x66c7('0x44'),LISTID[_0x66c7('0x3e')]())[_0x66c7('0x42')](_0x66c7('0x45'))[_0x66c7('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x66c7('0x1d'))[_0x66c7('0x40')]('cm_hopper')['where'](_0xd9e0f5+_0x66c7('0x46'),_0x2484d3['id'][_0x66c7('0x3e')]())))[_0x66c7('0x3e')]();return _0x1e5993;};var _0x900ee7=function(_0x2c5269,_0x48eae9){var _0x19309f=squel['insert']()['into'](_0x66c7('0x36'))[_0x66c7('0x37')]([_0x66c7('0x1d'),_0x66c7('0x38'),'ContactId','ListId',_0x48eae9,_0x66c7('0x39'),'updatedAt'],squel['select']()[_0x66c7('0x3c')](_0x66c7('0x1d'),_0x66c7('0x1d'))[_0x66c7('0x3c')]('NOW()',_0x66c7('0x38'))[_0x66c7('0x3c')]('id',_0x66c7('0x3d'))['field'](LISTID[_0x66c7('0x3e')](),_0x66c7('0x23'))[_0x66c7('0x3c')](_0x2c5269['id'][_0x66c7('0x3e')](),_0x48eae9)[_0x66c7('0x3c')](_0x66c7('0x3f'),_0x66c7('0x39'))[_0x66c7('0x3c')]('NOW()',_0x66c7('0x3a'))[_0x66c7('0x40')](_0x66c7('0x41'))[_0x66c7('0x42')](_0x66c7('0x43'))[_0x66c7('0x42')](_0x66c7('0x44'),LISTID[_0x66c7('0x3e')]())[_0x66c7('0x42')](_0x66c7('0x47'),squel[_0x66c7('0x48')](hopperContacts))[_0x66c7('0x42')](_0x66c7('0x45'))[_0x66c7('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x66c7('0x3b')]()[_0x66c7('0x3c')](_0x66c7('0x49'))[_0x66c7('0x40')]('cm_hopper_final')[_0x66c7('0x42')](_0x48eae9+_0x66c7('0x46'),_0x2c5269['id']['toString']()))[_0x66c7('0x42')](_0x66c7('0x4a'),squel[_0x66c7('0x3b')]()[_0x66c7('0x3c')](_0x66c7('0x1d'))[_0x66c7('0x40')](_0x66c7('0x36'))['where'](_0x48eae9+_0x66c7('0x46'),_0x2c5269['id'][_0x66c7('0x3e')]())))['toString']();return _0x19309f;};function _0x127dfe(_0x2617af,_0x3ef4cf){var _0x5df6d1=squel[_0x66c7('0x34')]()[_0x66c7('0x35')](_0x66c7('0x36'))[_0x66c7('0x37')]([_0x66c7('0x1d'),_0x66c7('0x38'),_0x66c7('0x3d'),_0x66c7('0x23'),_0x3ef4cf,'createdAt',_0x66c7('0x3a')],squel[_0x66c7('0x3b')]()['field'](_0x66c7('0x1d'),_0x66c7('0x1d'))[_0x66c7('0x3c')]('NOW()','scheduledAt')[_0x66c7('0x3c')]('id','ContactId')[_0x66c7('0x3c')](LISTID[_0x66c7('0x3e')](),_0x66c7('0x23'))[_0x66c7('0x3c')](_0x2617af['id'][_0x66c7('0x3e')](),_0x3ef4cf)[_0x66c7('0x3c')]('NOW()','createdAt')[_0x66c7('0x3c')](_0x66c7('0x3f'),'updatedAt')['from'](_0x66c7('0x41'))['where'](_0x66c7('0x43'))[_0x66c7('0x42')](_0x66c7('0x44'),LISTID[_0x66c7('0x3e')]())['where'](_0x66c7('0x47'),squel[_0x66c7('0x48')](hopperContacts))[_0x66c7('0x42')](_0x66c7('0x45')))[_0x66c7('0x3e')]();return _0x5df6d1;}function _0x137c4f(_0x4ec465,_0x24f22d){var _0x39c18e=squel[_0x66c7('0x34')]()['into'](_0x66c7('0x4b'))['fromQuery']([_0x66c7('0x1d'),_0x66c7('0x3d'),_0x66c7('0x23'),_0x24f22d,_0x66c7('0x39'),_0x66c7('0x3a')],squel[_0x66c7('0x3b')]()['field'](_0x66c7('0x1d'),_0x66c7('0x1d'))[_0x66c7('0x3c')]('id',_0x66c7('0x3d'))[_0x66c7('0x3c')](LISTID['toString'](),_0x66c7('0x23'))[_0x66c7('0x3c')](_0x4ec465['id'][_0x66c7('0x3e')](),_0x24f22d)[_0x66c7('0x3c')](_0x66c7('0x3f'),_0x66c7('0x39'))[_0x66c7('0x3c')](_0x66c7('0x3f'),_0x66c7('0x3a'))[_0x66c7('0x40')](_0x66c7('0x41'))[_0x66c7('0x42')]('deletedAt\x20IS\x20NULL')[_0x66c7('0x42')](_0x66c7('0x44'),LISTID[_0x66c7('0x3e')]())[_0x66c7('0x42')](_0x66c7('0x47'),squel[_0x66c7('0x48')](hopperContacts))[_0x66c7('0x42')]('phone\x20IS\x20NOT\x20NULL'))[_0x66c7('0x3e')]();return _0x39c18e;}return db[_0x66c7('0x4c')][_0x66c7('0x4d')]({'where':{'type':_0x66c7('0x4e')},'attributes':['id',_0x66c7('0x4f')],'include':[{'model':db[_0x66c7('0x50')],'as':_0x66c7('0x51'),'where':{'id':LISTID}}]})[_0x66c7('0x2c')](function(_0xe89d87){var _0x4069a6=[];if(_0xe89d87){var _0x21eb0a;for(var _0x450b14=0x0,_0x2e5a47;_0x450b14<_0xe89d87[_0x66c7('0x25')];_0x450b14+=0x1){_0x2e5a47=_0xe89d87[_0x450b14][_0x66c7('0x52')]({'plain':!![]});switch(_0x2e5a47[_0x66c7('0x4f')]){case'always':_0x4069a6[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x900ee7(_0x2e5a47,_0x66c7('0x55')))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));break;case _0x66c7('0x56'):_0x4069a6[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x33b7ff(_0x2e5a47,_0x66c7('0x55')))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));break;default:_0x4069a6[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x127dfe(_0x2e5a47,_0x66c7('0x55')))['then'](function(){})[_0x66c7('0x2f')](_0x1b2849()));}}}return _0x4069a6;})[_0x66c7('0x57')]()[_0x66c7('0x2c')](function(){return db[_0x66c7('0x4c')][_0x66c7('0x4d')]({'where':{'type':_0x66c7('0x4e')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x66c7('0x2c')](function(_0x59b45f){var _0x1d2af2=[];if(_0x59b45f){var _0xd0f389;for(var _0x367b59=0x0,_0x139529;_0x367b59<_0x59b45f[_0x66c7('0x25')];_0x367b59+=0x1){_0x139529=_0x59b45f[_0x367b59][_0x66c7('0x52')]({'plain':!![]});_0x1d2af2[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x137c4f(_0x139529,_0x66c7('0x55')))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));}}return _0x1d2af2;})['all']();})[_0x66c7('0x2c')](function(){return db[_0x66c7('0x58')][_0x66c7('0x4d')]({'attributes':['id',_0x66c7('0x4f')],'include':[{'model':db['CmList'],'as':_0x66c7('0x51'),'where':{'id':LISTID}}]})[_0x66c7('0x2c')](function(_0x4e0a54){var _0x34d944=[];if(_0x4e0a54){for(var _0x3a4fe1=0x0,_0x3f25c0;_0x3a4fe1<_0x4e0a54[_0x66c7('0x25')];_0x3a4fe1+=0x1){_0x3f25c0=_0x4e0a54[_0x3a4fe1][_0x66c7('0x52')]({'plain':!![]});switch(_0x3f25c0[_0x66c7('0x4f')]){case'always':_0x34d944['push'](db[_0x66c7('0x53')]['query'](_0x900ee7(_0x3f25c0,'CampaignId'))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));break;case _0x66c7('0x56'):_0x34d944[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x33b7ff(_0x3f25c0,_0x66c7('0x59')))[_0x66c7('0x2c')](function(){})['catch'](_0x1b2849()));break;default:_0x34d944[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x127dfe(_0x3f25c0,_0x66c7('0x59')))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));}}}return _0x34d944;})[_0x66c7('0x57')]();})[_0x66c7('0x2c')](function(){return db[_0x66c7('0x58')][_0x66c7('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x66c7('0x50')],'as':_0x66c7('0x5a'),'where':{'id':LISTID}}]})[_0x66c7('0x2c')](function(_0x4c6b01){var _0x19a425=[];if(_0x4c6b01){for(var _0x2aaba9=0x0,_0x2b1854;_0x2aaba9<_0x4c6b01[_0x66c7('0x25')];_0x2aaba9+=0x1){_0x2b1854=_0x4c6b01[_0x2aaba9][_0x66c7('0x52')]({'plain':!![]});_0x19a425[_0x66c7('0x2d')](db[_0x66c7('0x53')][_0x66c7('0x54')](_0x137c4f(_0x2b1854,_0x66c7('0x59')))[_0x66c7('0x2c')](function(){})[_0x66c7('0x2f')](_0x1b2849()));}}return _0x19a425;})[_0x66c7('0x57')]();})[_0x66c7('0x2f')](function(_0x48bd82){logger[_0x66c7('0x11')](_0x66c7('0x5b'),_0x66c7('0x5c'),_0x48bd82['message']);});}var processPromises=function(_0x321bb8){return BPromise[_0x66c7('0x57')](promises)[_0x66c7('0x2c')](function(_0x5cc59c){})[_0x66c7('0x2f')](function(_0x12994c){logger[_0x66c7('0x11')]('Error\x20processing\x20rows\x20block:',JSON[_0x66c7('0x31')](_0x12994c));})[_0x66c7('0x5d')](function(){socket[_0x66c7('0x5e')](_0x66c7('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x321bb8){return _0x321bb8['resume']();}});};var endCsv=function(){return BPromise[_0x66c7('0x60')]()[_0x66c7('0x2c')](function(){if(hopperContacts){return checkHopper();}})[_0x66c7('0x2c')](function(){socket[_0x66c7('0x5e')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x657126){logger[_0x66c7('0x11')](_0x66c7('0x61'),JSON[_0x66c7('0x31')](_0x657126));}finally{process[_0x66c7('0x62')](0x0);}});};process['on']('SIGINT',function(){logger[_0x66c7('0x63')](_0x66c7('0x64'));endCsv();});function main(){return BPromise[_0x66c7('0x60')]()[_0x66c7('0x2c')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x66c7('0xe')](',');return db['CmContact'][_0x66c7('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x66c7('0x2c')](function(_0x4a92bc){var _0x10b7d5=fs[_0x66c7('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x66c7('0x66')](_0x10b7d5,{'header':!![],'skipEmptyLines':!![],'step':function(_0x9b1421,_0x22fbc8){total+=0x1;var _0x50e2f2=total;promises[_0x66c7('0x2d')](checkRow(_0x9b1421,_0x4a92bc,_0x50e2f2)[_0x66c7('0x2c')](function(){success+=0x1;})[_0x66c7('0x2f')](function(_0x574e42){if(_0x574e42[_0x66c7('0x11')]){errors+=0x1;delete _0x574e42[_0x66c7('0x11')];}else if(_0x574e42[_0x66c7('0x27')]){duplicates+=0x1;delete _0x574e42[_0x66c7('0x27')];}rows[_0x66c7('0x2d')](_0x574e42);}));if(total%0xc8===0x0){_0x22fbc8[_0x66c7('0x67')]();return processPromises(_0x22fbc8);}},'complete':function(){return processPromises()[_0x66c7('0x2c')](function(){logger[_0x66c7('0x63')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x255a05,_0x1b1c6d){logger[_0x66c7('0x63')](_0x66c7('0x68'),JSON[_0x66c7('0x31')](_0x255a05));endCsv();}});})[_0x66c7('0x2f')](function(_0x58f604){logger[_0x66c7('0x11')](_0x66c7('0x69'),JSON[_0x66c7('0x31')](_0x58f604));});}main(); \ No newline at end of file +var _0x70e0=['firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','CompanyId','duplicate','CmContact','create','catch','Error\x20while\x20creating\x20contact:\x20','message','cmContact','checkHopper','inspect','insert','into','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','cm_contacts','id\x20IN\x20?','str','select','fromQuery','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','get','always','push','query','VoiceQueueId','sequelize','all','CmList','onlyIfOpen','CampaignId','Campaign','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','resume','resolve','contact:csv_','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','bluebird','../../../mysqldb','../../../config/logger','lodash','squel','papaparse','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','hasOwnProperty','data','firstName'];(function(_0x40f690,_0x137b1f){var _0x180d61=function(_0x2b1e4a){while(--_0x2b1e4a){_0x40f690['push'](_0x40f690['shift']());}};_0x180d61(++_0x137b1f);}(_0x70e0,0x17b));var _0x070e=function(_0x4c745a,_0x31ce68){_0x4c745a=_0x4c745a-0x0;var _0x3ad4fa=_0x70e0[_0x4c745a];return _0x3ad4fa;};'use strict';var BPromise=require(_0x070e('0x0'));var db=require(_0x070e('0x1'))['db'];var logger=require(_0x070e('0x2'))('api');var util=require('util');var _=require(_0x070e('0x3'));var fs=require('fs');var squel=require(_0x070e('0x4'));var Papa=require(_0x070e('0x5'));var socket=require(_0x070e('0x6'))({'host':'localhost','port':0x18eb});require(_0x070e('0x7'))['register'](socket);try{if(!process[_0x070e('0x8')][0x2]||process['argv'][0x2]==='undefined'||process['argv'][0x2]===_0x070e('0x9')){throw new Error(_0x070e('0xa'));}var FILEPATH=process[_0x070e('0x8')][0x2];if(!process[_0x070e('0x8')][0x3]||process[_0x070e('0x8')][0x3]===_0x070e('0xb')||process[_0x070e('0x8')][0x3]==='null'||!process['argv'][0x4]||process[_0x070e('0x8')][0x4]===_0x070e('0xb')||process[_0x070e('0x8')][0x4]===_0x070e('0x9')){throw new Error(_0x070e('0xc'));}var FIELDS=_[_0x070e('0xd')](process[_0x070e('0x8')][0x3][_0x070e('0xe')](','),process[_0x070e('0x8')][0x4][_0x070e('0xe')](','));if(!process[_0x070e('0x8')][0x5]||process['argv'][0x5]==='undefined'||process[_0x070e('0x8')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x070e('0x8')][0x6]&&process[_0x070e('0x8')][0x6]!=='undefined'&&process['argv'][0x6]!==_0x070e('0x9')?process[_0x070e('0x8')][0x6]:null;var DUPLICATES=process[_0x070e('0x8')][0x7]&&process[_0x070e('0x8')][0x7]!=='undefined'&&process['argv'][0x7]!==_0x070e('0x9')?process[_0x070e('0x8')][0x7]:null;if(!process[_0x070e('0x8')][0x8]||process[_0x070e('0x8')][0x8]===_0x070e('0xb')||process['argv'][0x8]===_0x070e('0x9')){throw new Error(_0x070e('0xf'));}var SOCKET_TIMESTAMP=process[_0x070e('0x8')][0x8];}catch(_0x3ea105){logger[_0x070e('0x10')](_0x3ea105);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(_0x5c16fd,_0x5b2f48,_0x4e958f,_0x9907cf){var _0x3004f0={'message':_0x5b2f48};_0x3004f0[_0x5c16fd]=!![];if(_0x4e958f){_0x3004f0[_0x070e('0x11')]=_0x4e958f;}if(_0x9907cf){_0x3004f0['index']=_0x9907cf;}return _0x3004f0;}function isEmail(_0x5b184){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'](_0x5b184);}function checkRow(_0xf8dd5d,_0x3f6985,_0x27a01e){return new BPromise(function(_0x33e8c6,_0x28a1c3){if(_[_0x070e('0x12')](_0xf8dd5d)){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x13'),null,_0x27a01e));}if(_0xf8dd5d['errors']&&_0xf8dd5d[_0x070e('0x14')][_0x070e('0x15')]){var _0x4790eb=_['map'](_0xf8dd5d[_0x070e('0x14')],'message')['join'](';');return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x4790eb,null,_0x27a01e));}var _0x25f6e={};for(var _0x41deb1 in FIELDS){if(FIELDS[_0x070e('0x16')](_0x41deb1)&&FIELDS[_0x41deb1]){_0x25f6e[_0x41deb1]=_0xf8dd5d[_0x070e('0x17')][0x0][FIELDS[_0x41deb1]]||_0xf8dd5d['data'][0x0]['\ufeff'+FIELDS[_0x41deb1]];}}if(!_0x25f6e[_0x070e('0x18')]){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x19'),null,_0x27a01e));}if(!_0x25f6e[_0x070e('0x1a')]){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x1b'),null,_0x27a01e));}if(_0x25f6e[_0x070e('0x1c')]){var _0x26373b=moment(_0x25f6e['birthDate'],_0x070e('0x1d'));if(!_0x26373b[_0x070e('0x1e')]()){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x27a01e));}}if(_0x25f6e['email']){if(!isEmail(_0x25f6e[_0x070e('0x1f')])){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x20'),null,_0x27a01e));}}_0x25f6e['ListId']=LISTID;_0x25f6e[_0x070e('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x070e('0x15')]&&_0x3f6985){var _0x3a9425={};for(var _0x5f2bee=0x0,_0x53d473=DUPLICATES['length'];_0x5f2bee<_0x53d473;_0x5f2bee+=0x1){_0x3a9425[DUPLICATES[_0x5f2bee]]=_0x25f6e[DUPLICATES[_0x5f2bee]];}var _0x523b75=_['find'](_0x3f6985,_0x3a9425);if(_0x523b75){return _0x28a1c3(handleCheckRowError(_0x070e('0x22'),'Duplicate\x20Contact',_0x523b75,_0x27a01e));}}return db[_0x070e('0x23')][_0x070e('0x24')](_0x25f6e,{'raw':!![],'hooks':![],'fields':_['keys'](_0x25f6e)})['then'](function(_0x699739){if(DUPLICATES&&DUPLICATES[_0x070e('0x15')]&&_0x3f6985){_0x3f6985['push'](_['pick'](_0x25f6e,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x699739['id'];return _0x33e8c6();})[_0x070e('0x25')](function(_0x27dd1f){return _0x28a1c3(handleCheckRowError(_0x070e('0x10'),_0x070e('0x26')+(_0x27dd1f[_0x070e('0x27')]||JSON['stringify'](_0x27dd1f)),null,_0x27a01e));});});}function checkHopper(){function _0x482cc2(){return function(_0x24d17d){logger[_0x070e('0x10')](_0x070e('0x28'),_0x070e('0x29'),util[_0x070e('0x2a')](_0x24d17d,{'showHidden':![],'depth':null}));};}var _0x4deaf8=function(_0x22f3a9,_0x1927f4){var _0x534150=squel[_0x070e('0x2b')]()[_0x070e('0x2c')]('cm_hopper')['fromQuery'](['phone',_0x070e('0x2d'),_0x070e('0x2e'),_0x070e('0x2f'),_0x1927f4,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),_0x070e('0x1a'))['field'](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id','ContactId')[_0x070e('0x32')](LISTID[_0x070e('0x34')](),'ListId')[_0x070e('0x32')](_0x22f3a9['id']['toString'](),_0x1927f4)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),'updatedAt')[_0x070e('0x35')]('cm_contacts')['where'](_0x070e('0x36'))[_0x070e('0x37')](_0x070e('0x38'),LISTID['toString']())[_0x070e('0x37')](_0x070e('0x39'))[_0x070e('0x37')](_0x070e('0x3a'),squel['select']()[_0x070e('0x32')]('phone')['from']('cm_hopper')[_0x070e('0x37')](_0x1927f4+_0x070e('0x3b'),_0x22f3a9['id'][_0x070e('0x34')]())))[_0x070e('0x34')]();return _0x534150;};var _0x34f23e=function(_0x562aa4,_0x18607f){var _0x59037e=squel[_0x070e('0x2b')]()[_0x070e('0x2c')](_0x070e('0x3c'))['fromQuery'](['phone',_0x070e('0x2d'),'ContactId',_0x070e('0x2f'),_0x18607f,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),'phone')['field'](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id',_0x070e('0x2e'))[_0x070e('0x32')](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0x562aa4['id'][_0x070e('0x34')](),_0x18607f)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))[_0x070e('0x37')](_0x070e('0x38'),LISTID['toString']())[_0x070e('0x37')](_0x070e('0x3e'),squel[_0x070e('0x3f')](hopperContacts))[_0x070e('0x37')](_0x070e('0x39'))[_0x070e('0x37')](_0x070e('0x3a'),squel[_0x070e('0x40')]()[_0x070e('0x32')]('calleridnum')[_0x070e('0x35')]('cm_hopper_final')[_0x070e('0x37')](_0x18607f+_0x070e('0x3b'),_0x562aa4['id']['toString']()))[_0x070e('0x37')](_0x070e('0x3a'),squel[_0x070e('0x40')]()[_0x070e('0x32')](_0x070e('0x1a'))[_0x070e('0x35')](_0x070e('0x3c'))['where'](_0x18607f+_0x070e('0x3b'),_0x562aa4['id']['toString']())))['toString']();return _0x59037e;};function _0x3a06c6(_0x3d1b5e,_0x208bb7){var _0x149375=squel[_0x070e('0x2b')]()[_0x070e('0x2c')](_0x070e('0x3c'))[_0x070e('0x41')](['phone',_0x070e('0x2d'),'ContactId','ListId',_0x208bb7,_0x070e('0x30'),_0x070e('0x31')],squel['select']()[_0x070e('0x32')](_0x070e('0x1a'),_0x070e('0x1a'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x2d'))[_0x070e('0x32')]('id','ContactId')['field'](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0x3d1b5e['id'][_0x070e('0x34')](),_0x208bb7)[_0x070e('0x32')]('NOW()',_0x070e('0x30'))['field'](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))['where'](_0x070e('0x38'),LISTID[_0x070e('0x34')]())[_0x070e('0x37')]('id\x20IN\x20?',squel[_0x070e('0x3f')](hopperContacts))[_0x070e('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0x070e('0x34')]();return _0x149375;}function _0x4e8dfc(_0xc89f90,_0x569f92){var _0x4cb86f=squel['insert']()[_0x070e('0x2c')](_0x070e('0x42'))[_0x070e('0x41')]([_0x070e('0x1a'),_0x070e('0x2e'),_0x070e('0x2f'),_0x569f92,'createdAt',_0x070e('0x31')],squel['select']()[_0x070e('0x32')]('phone',_0x070e('0x1a'))[_0x070e('0x32')]('id','ContactId')[_0x070e('0x32')](LISTID['toString'](),_0x070e('0x2f'))[_0x070e('0x32')](_0xc89f90['id'][_0x070e('0x34')](),_0x569f92)[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x30'))[_0x070e('0x32')](_0x070e('0x33'),_0x070e('0x31'))[_0x070e('0x35')](_0x070e('0x3d'))[_0x070e('0x37')](_0x070e('0x36'))[_0x070e('0x37')]('ListId\x20=\x20?',LISTID[_0x070e('0x34')]())[_0x070e('0x37')](_0x070e('0x3e'),squel[_0x070e('0x3f')](hopperContacts))['where'](_0x070e('0x39')))[_0x070e('0x34')]();return _0x4cb86f;}return db[_0x070e('0x43')][_0x070e('0x44')]({'where':{'type':_0x070e('0x45')},'attributes':['id',_0x070e('0x46')],'include':[{'model':db['CmList'],'as':_0x070e('0x47'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x240ec9){var _0x2fe202=[];if(_0x240ec9){var _0x551ca5;for(var _0x8b9c73=0x0,_0x52804d;_0x8b9c73<_0x240ec9[_0x070e('0x15')];_0x8b9c73+=0x1){_0x52804d=_0x240ec9[_0x8b9c73][_0x070e('0x49')]({'plain':!![]});switch(_0x52804d[_0x070e('0x46')]){case _0x070e('0x4a'):_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x34f23e(_0x52804d,_0x070e('0x4d')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;case'onlyIfOpen':_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4deaf8(_0x52804d,_0x070e('0x4d')))[_0x070e('0x48')](function(){})['catch'](_0x482cc2()));break;default:_0x2fe202[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x3a06c6(_0x52804d,'VoiceQueueId'))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));}}}return _0x2fe202;})['all']()[_0x070e('0x48')](function(){return db['VoiceQueue'][_0x070e('0x44')]({'where':{'type':_0x070e('0x45')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x3022cd){var _0xf67cfd=[];if(_0x3022cd){var _0x17cf15;for(var _0x25f1d0=0x0,_0x26c5c3;_0x25f1d0<_0x3022cd[_0x070e('0x15')];_0x25f1d0+=0x1){_0x26c5c3=_0x3022cd[_0x25f1d0][_0x070e('0x49')]({'plain':!![]});_0xf67cfd[_0x070e('0x4b')](db[_0x070e('0x4e')][_0x070e('0x4c')](_0x4e8dfc(_0x26c5c3,_0x070e('0x4d')))[_0x070e('0x48')](function(){})['catch'](_0x482cc2()));}}return _0xf67cfd;})[_0x070e('0x4f')]();})[_0x070e('0x48')](function(){return db['Campaign']['findAll']({'attributes':['id',_0x070e('0x46')],'include':[{'model':db[_0x070e('0x50')],'as':_0x070e('0x47'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x3b3e96){var _0x12fe4f=[];if(_0x3b3e96){for(var _0x3223a4=0x0,_0x110813;_0x3223a4<_0x3b3e96[_0x070e('0x15')];_0x3223a4+=0x1){_0x110813=_0x3b3e96[_0x3223a4][_0x070e('0x49')]({'plain':!![]});switch(_0x110813[_0x070e('0x46')]){case _0x070e('0x4a'):_0x12fe4f[_0x070e('0x4b')](db['sequelize']['query'](_0x34f23e(_0x110813,'CampaignId'))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;case _0x070e('0x51'):_0x12fe4f[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4deaf8(_0x110813,_0x070e('0x52')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));break;default:_0x12fe4f[_0x070e('0x4b')](db[_0x070e('0x4e')]['query'](_0x3a06c6(_0x110813,_0x070e('0x52')))['then'](function(){})[_0x070e('0x25')](_0x482cc2()));}}}return _0x12fe4f;})[_0x070e('0x4f')]();})[_0x070e('0x48')](function(){return db[_0x070e('0x53')][_0x070e('0x44')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x070e('0x54'),'where':{'id':LISTID}}]})[_0x070e('0x48')](function(_0x5d3bd8){var _0x421392=[];if(_0x5d3bd8){for(var _0x1e1d27=0x0,_0x553ea1;_0x1e1d27<_0x5d3bd8[_0x070e('0x15')];_0x1e1d27+=0x1){_0x553ea1=_0x5d3bd8[_0x1e1d27][_0x070e('0x49')]({'plain':!![]});_0x421392[_0x070e('0x4b')](db['sequelize'][_0x070e('0x4c')](_0x4e8dfc(_0x553ea1,_0x070e('0x52')))[_0x070e('0x48')](function(){})[_0x070e('0x25')](_0x482cc2()));}}return _0x421392;})[_0x070e('0x4f')]();})[_0x070e('0x25')](function(_0x3961a6){logger[_0x070e('0x10')](_0x070e('0x55'),_0x070e('0x56'),_0x3961a6[_0x070e('0x27')]);});}var processPromises=function(_0x46d2b7){return BPromise[_0x070e('0x4f')](promises)['then'](function(_0x28be73){})[_0x070e('0x25')](function(_0x392c45){logger[_0x070e('0x10')](_0x070e('0x57'),JSON[_0x070e('0x58')](_0x392c45));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x46d2b7){return _0x46d2b7[_0x070e('0x59')]();}});};var endCsv=function(){return BPromise[_0x070e('0x5a')]()[_0x070e('0x48')](function(){if(hopperContacts){return checkHopper();}})[_0x070e('0x48')](function(){socket['emit'](_0x070e('0x5b')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x070e('0x5c')](FILEPATH);}catch(_0x370209){logger['error'](_0x070e('0x5d'),JSON['stringify'](_0x370209));}finally{process[_0x070e('0x5e')](0x0);}});};process['on'](_0x070e('0x5f'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x070e('0x5a')]()[_0x070e('0x48')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x070e('0x23')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4caaa9){var _0x15480c=fs[_0x070e('0x60')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x070e('0x61')](_0x15480c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3aa652,_0x137dd8){total+=0x1;var _0x341756=total;promises[_0x070e('0x4b')](checkRow(_0x3aa652,_0x4caaa9,_0x341756)[_0x070e('0x48')](function(){success+=0x1;})[_0x070e('0x25')](function(_0xdcc60a){if(_0xdcc60a[_0x070e('0x10')]){errors+=0x1;delete _0xdcc60a[_0x070e('0x10')];}else if(_0xdcc60a[_0x070e('0x22')]){duplicates+=0x1;delete _0xdcc60a[_0x070e('0x22')];}rows[_0x070e('0x4b')](_0xdcc60a);}));if(total%0xc8===0x0){_0x137dd8[_0x070e('0x62')]();return processPromises(_0x137dd8);}},'complete':function(){return processPromises()[_0x070e('0x48')](function(){logger[_0x070e('0x63')](_0x070e('0x64'));endCsv();});},'error':function(_0x2948c3,_0x153a37){logger[_0x070e('0x63')]('CSV\x20parse\x20error',JSON[_0x070e('0x58')](_0x2948c3));endCsv();}});})[_0x070e('0x25')](function(_0x449337){logger[_0x070e('0x10')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x070e('0x58')](_0x449337));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 245202d..f84f2fa 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 _0x8a25=['scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','fromQuery','phone','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','keys',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','push','code','sequelize','query','spread','catch','main','stringify','send','start','root','server/files/tmp','header','writeFileSync','createReadStream','data','length','rows','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','format','CompanyId',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','parse','No\x20agent\x20available','SIGINT','path','papaparse','moment','squel','../../../config/environment','../../../config/logger','import','socket.io-emitter','localhost','YYYY-MM-DD\x20HH:mm:ss','test','field','from','join','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper'];(function(_0x3dad83,_0x52cf82){var _0x2fad75=function(_0x21c006){while(--_0x21c006){_0x3dad83['push'](_0x3dad83['shift']());}};_0x2fad75(++_0x52cf82);}(_0x8a25,0x161));var _0x58a2=function(_0x3b1790,_0x15d7f9){_0x3b1790=_0x3b1790-0x0;var _0x1d0d90=_0x8a25[_0x3b1790];return _0x1d0d90;};'use strict';var fs=require('fs');var path=require(_0x58a2('0x0'));var _=require('lodash');var Papa=require(_0x58a2('0x1'));var util=require('util');var BPromise=require('bluebird');var moment=require(_0x58a2('0x2'));var squel=require(_0x58a2('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x58a2('0x4'));var logger=require(_0x58a2('0x5'))(_0x58a2('0x6'));var socket=require(_0x58a2('0x7'))({'host':_0x58a2('0x8'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x58a2('0x9'));function isEmail(_0x37cd64){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))*$/[_0x58a2('0xa')](_0x37cd64);}function selectNotIn(_0x5801f0,_0x3b522d,_0x1261ba,_0x4b09fc,_0x49636e){return squel['select']()[_0x58a2('0xb')]('phone')[_0x58a2('0xc')](_0x4b09fc)[_0x58a2('0xd')](_0x3b522d,null,_0x3b522d+'.id\x20=\x20'+_0x4b09fc+'.'+_0x1261ba)[_0x58a2('0xe')](_0x4b09fc+'.'+_0x1261ba+'\x20=\x20'+_0x5801f0+'.'+_0x1261ba)['where'](_0x3b522d+_0x58a2('0xf')+_0x49636e[_0x58a2('0xd')]()+')');}function insertCmHopper(_0x109036,_0x24026a,_0x261c8c,_0x627ca3,_0x24ecce){var _0x4da062=[_0x58a2('0x10'),'cm_contacts.scheduledat',_0x58a2('0x11'),_0x58a2('0x12'),_0x24026a+'.'+_0x627ca3,_0x58a2('0x13'),_0x58a2('0x14'),_0x58a2('0x15'),'cm_contacts.UserId','\x22'+_0x24ecce+'\x22'];return squel[_0x58a2('0x16')]()[_0x58a2('0x17')](_0x58a2('0x18'))['fromQuery'](['phone',_0x58a2('0x19'),_0x58a2('0x1a'),_0x58a2('0x1b'),_0x627ca3,_0x58a2('0x1c'),_0x58a2('0x1d'),'priority',_0x58a2('0x1e'),_0x58a2('0x1f')],squel[_0x58a2('0x20')]()[_0x58a2('0x21')](_0x4da062)['from'](_0x24026a)['join'](_0x58a2('0x22'),null,_0x58a2('0x23')+_0x24026a+_0x58a2('0x24'))['join'](_0x261c8c,null,_0x261c8c+_0x58a2('0x25')+_0x24026a+'.'+_0x627ca3)['where'](_0x24026a+_0x58a2('0x26'),_0x109036)[_0x58a2('0xe')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x58a2('0x27'),selectNotIn(_0x24026a,_0x261c8c,_0x627ca3,'cm_hopper',['\x22always\x22',_0x58a2('0x28')]))[_0x58a2('0xe')](_0x58a2('0x27'),selectNotIn(_0x24026a,_0x261c8c,_0x627ca3,_0x58a2('0x18'),['\x22always\x22'])))[_0x58a2('0x29')]();}function insertCmHopperBlack(_0x1b279,_0x53d836,_0x3feba6,_0x14e806){var _0x4e18a5=[_0x58a2('0x10'),'cm_contacts.id','cm_contacts.ListId',_0x53d836+'.'+_0x14e806,_0x58a2('0x13'),_0x58a2('0x14')];return squel['insert']()[_0x58a2('0x17')]('cm_hopper_black')[_0x58a2('0x2a')]([_0x58a2('0x2b'),'ContactId',_0x58a2('0x1b'),_0x14e806,_0x58a2('0x1c'),_0x58a2('0x1d')],squel['select']()[_0x58a2('0x21')](_0x4e18a5)[_0x58a2('0xc')](_0x53d836)[_0x58a2('0xd')](_0x58a2('0x22'),null,'cm_contacts.ListId\x20=\x20'+_0x53d836+_0x58a2('0x24'))[_0x58a2('0xd')](_0x3feba6,null,_0x3feba6+_0x58a2('0x25')+_0x53d836+'.'+_0x14e806)[_0x58a2('0xe')](_0x53d836+'.CmListId\x20=\x20?',_0x1b279)[_0x58a2('0xe')](_0x58a2('0x2c'),NOW)['where'](_0x58a2('0x27'),squel['select']()[_0x58a2('0xb')]('phone')[_0x58a2('0xc')]('cm_hopper_black')[_0x58a2('0xe')](_0x58a2('0x2d'),_0x1b279)[_0x58a2('0xe')](_0x14e806+'\x20=\x20?',_0x53d836+'.'+_0x14e806)))[_0x58a2('0x29')]();}function insertCmContact(_0x2d0a16,_0x40e75c,_0x23b6fd,_0x551583){var _0x36d509=_['concat'](_[_0x58a2('0x2e')](_0x551583),[_0x58a2('0x1b'),'CompanyId',_0x58a2('0x1c'),'updatedAt']);return squel[_0x58a2('0x16')]()[_0x58a2('0x17')](_0x58a2('0x22'))[_0x58a2('0x2a')](_0x36d509,squel[_0x58a2('0x20')]()[_0x58a2('0x21')](_0x36d509)[_0x58a2('0xc')](_0x40e75c)[_0x58a2('0xe')]('('+_0x23b6fd['join'](',')+_0x58a2('0x2f'),squel[_0x58a2('0x20')]()[_0x58a2('0x21')](_0x23b6fd)[_0x58a2('0xc')](_0x58a2('0x22'))[_0x58a2('0xe')]('ListId\x20=\x20?',_0x2d0a16))[_0x58a2('0xe')]('id\x20IN\x20?',squel['select']()[_0x58a2('0xb')](_0x58a2('0x30'),_0x58a2('0x31'))['from'](_0x40e75c)[_0x58a2('0x32')](_0x23b6fd[_0x58a2('0xd')](','))))['toString']();}function handleStop(){logger[_0x58a2('0x33')](_0x58a2('0x34'));stopped=!![];}function handleUncaughtException(_0x10c92c){logger[_0x58a2('0x35')](_0x10c92c[_0x58a2('0x36')]);process[_0x58a2('0x37')](0x1);}function handleError(_0x35f7f9,_0x49c4f7){stats[_0x58a2('0x38')][_0x58a2('0x39')]({'name':_0x49c4f7[_0x58a2('0x3a')],'message':_0x49c4f7['message'],'row':_0x35f7f9});}function handleQuery(_0x2c9736){logger[_0x58a2('0x33')](_0x2c9736);return db[_0x58a2('0x3b')][_0x58a2('0x3c')](_0x2c9736)[_0x58a2('0x3d')](function(_0x1ac4cd){results[_0x58a2('0x39')](_0x1ac4cd);})[_0x58a2('0x3e')](function(_0x5887f0){logger[_0x58a2('0x35')](_0x5887f0[_0x58a2('0x36')]);});}function main(_0x5f158c,_0xf5e5ca,_0x406b16,_0x4ebfad){logger[_0x58a2('0x33')](_0x58a2('0x3f'),_0x5f158c,JSON[_0x58a2('0x40')](_0xf5e5ca));process[_0x58a2('0x41')](_0x58a2('0x42'));var _0x18bf4e=_0xf5e5ca['binding'];var _0x4848e7=_0xf5e5ca['socket_timestamp'];var _0xa9be80=path[_0x58a2('0xd')](config[_0x58a2('0x43')],_0x58a2('0x44'),_0x4848e7+'.csv');var _0x5e3fd1=_[_0x58a2('0x2e')](_0x18bf4e)[_0x58a2('0xd')]();logger[_0x58a2('0x33')](_0x58a2('0x45'),_0x5e3fd1);fs[_0x58a2('0x46')](_0xa9be80,_0x5e3fd1+'\x0a');Papa['parse'](fs[_0x58a2('0x47')](_0x5f158c),{'header':!![],'skipEmptyLines':!![],'step':function(_0x567aff,_0x3de6f3){try{for(var _0x592a21=0x0,_0x1d716c=[];_0x592a21<_0x567aff[_0x58a2('0x48')][_0x58a2('0x49')];_0x592a21++){stats[_0x58a2('0x4a')]+=0x1;if(_0x567aff[_0x58a2('0x38')][_0x592a21]){handleError(_0x567aff['data'][_0x592a21],_0x567aff['errors'][_0x592a21]);}else{var _0x46788e=[];for(var _0x2d5a2a in _0x18bf4e){if(_0x18bf4e['hasOwnProperty'](_0x2d5a2a)){if(_0x567aff[_0x58a2('0x48')][_0x592a21][_0x18bf4e[_0x2d5a2a]]){var _0x53cad1=_[_0x58a2('0x4b')](_0x567aff[_0x58a2('0x48')][_0x592a21][_0x18bf4e[_0x2d5a2a]][_0x58a2('0x4c')](/"/g,'\x27'));switch(_0x2d5a2a){case _0x58a2('0x19'):var _0xab773d=moment(_0x53cad1,_0x58a2('0x9'),!![]);if(_0xab773d['isValid']()){_0x1d716c[_0x58a2('0x39')]('\x22'+_0x53cad1+'\x22');}else{_0x46788e['push'](_0x58a2('0x4d'));}break;case _0x58a2('0x4e'):var _0x474a42=parseInt(_0x53cad1);_0x53cad1=_[_0x58a2('0x4f')](_0x474a42)||_0x474a42<0x0||_0x474a42>0x4?_0x4ebfad?0x3:0x2:_0x474a42;_0x1d716c['push']('\x22'+_0x53cad1+'\x22');break;case _0x58a2('0x1e'):var _0x5d3d12=parseInt(_0x53cad1);if(_[_0x58a2('0x50')](_0x5d3d12)&&_[_0x58a2('0x51')](_0x406b16,_0x5d3d12)){_0x1d716c['push']('\x22'+_0x5d3d12+'\x22');}else{_0x46788e[_0x58a2('0x39')](_0x58a2('0x52'));}break;case _0x58a2('0x53'):if(isEmail(_0x53cad1)){_0x1d716c['push']('\x22'+_0x53cad1+'\x22');}else{_0x46788e[_0x58a2('0x39')](_0x58a2('0x54'));}break;case'dateOfBirth':var _0x2fc2a6=moment(_0x53cad1,_0x58a2('0x55'),!![]);if(_0x2fc2a6[_0x58a2('0x56')]()){_0x1d716c[_0x58a2('0x39')]('\x22'+_0x53cad1+'\x22');}else{_0x46788e['push'](_0x58a2('0x57'));}break;default:_0x1d716c[_0x58a2('0x39')]('\x22'+_0x53cad1+'\x22');}}else{switch(_0x2d5a2a){case _0x58a2('0x58'):case _0x58a2('0x2b'):_0x46788e['push'](_0x2d5a2a+_0x58a2('0x59'));break;default:_0x1d716c[_0x58a2('0x39')]('\x22\x22');}}}}if(_0x46788e['length']){handleError(_0x567aff[_0x58a2('0x48')][_0x592a21],{'code':_0x58a2('0x5a'),'message':_0x46788e['join']()});}else{fs[_0x58a2('0x5b')](_0xa9be80,_0x1d716c[_0x58a2('0xd')]()+'\x0a');}_0x1d716c=[];}if(!(stats['rows']%0xc8)){socket[_0x58a2('0x5c')](_0x58a2('0x5d')+_0x4848e7,stats);stats['errors']=[];}}if(stopped){logger[_0x58a2('0x33')](_0x58a2('0x5e'));_0x3de6f3[_0x58a2('0x5f')]();}}catch(_0x23055c){handleError(_0x567aff['data'][_0x592a21],{'code':_0x58a2('0x60'),'message':_0x23055c[_0x58a2('0x36')]});logger['error'](_0x58a2('0x61'),_0x23055c['message']);}},'complete':function(){try{var _0x4d5509=[];var _0x30719f='cm_contacts';if(_0xf5e5ca[_0x58a2('0x62')]&&_0xf5e5ca[_0x58a2('0x62')]['length']){_0x30719f=_0x58a2('0x63')+_0x4848e7;_0x4d5509['push'](_0x58a2('0x64')+_0x30719f+_0x58a2('0x65'));}var _0x2aac54=util[_0x58a2('0x66')]('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',_0xa9be80,_0x30719f,_0x5e3fd1,_0xf5e5ca[_0x58a2('0x1b')],_0xf5e5ca[_0x58a2('0x67')]||null,NOW,NOW);if(_['isNil'](_0x18bf4e[_0x58a2('0x19')])){_0x2aac54+=_0x58a2('0x68');}_0x4d5509[_0x58a2('0x39')](_0x2aac54);if(_0xf5e5ca[_0x58a2('0x62')]&&_0xf5e5ca[_0x58a2('0x62')][_0x58a2('0x49')]){_0x4d5509['push'](insertCmContact(_0xf5e5ca[_0x58a2('0x1b')],_0x30719f,_0xf5e5ca[_0x58a2('0x62')],_0x18bf4e));_0x4d5509[_0x58a2('0x39')]('DROP\x20TABLE\x20'+_0x30719f+';');}_0x4d5509['push'](insertCmHopper(_0xf5e5ca['ListId'],'voice_queues_has_cm_lists',_0x58a2('0x69'),_0x58a2('0x6a'),_0x4ebfad));_0x4d5509[_0x58a2('0x39')](insertCmHopperBlack(_0xf5e5ca[_0x58a2('0x1b')],_0x58a2('0x6b'),_0x58a2('0x69'),_0x58a2('0x6a')));_0x4d5509[_0x58a2('0x39')](insertCmHopper(_0xf5e5ca[_0x58a2('0x1b')],_0x58a2('0x6c'),_0x58a2('0x6d'),_0x58a2('0x6e'),_0x4ebfad));_0x4d5509[_0x58a2('0x39')](insertCmHopperBlack(_0xf5e5ca[_0x58a2('0x1b')],_0x58a2('0x6f'),_0x58a2('0x6d'),'CampaignId'));BPromise[_0x58a2('0x70')](_0x4d5509,handleQuery)[_0x58a2('0x71')](function(_0x1d9fa4){stats['finish']=!![];stats[_0x58a2('0x72')]=_0xf5e5ca[_0x58a2('0x62')]&&_0xf5e5ca[_0x58a2('0x62')]['length']?results[0x2][_0x58a2('0x72')]:results[0x0][_0x58a2('0x72')];socket[_0x58a2('0x5c')](_0x58a2('0x5d')+_0x4848e7,stats);fs['unlink'](_0x5f158c);fs[_0x58a2('0x73')](_0xa9be80);process[_0x58a2('0x37')](0x0);})[_0x58a2('0x3e')](function(_0x365ca0){logger[_0x58a2('0x35')](_0x365ca0[_0x58a2('0x36')]);process[_0x58a2('0x37')](0x1);});}catch(_0x23192c){logger[_0x58a2('0x35')](_0x58a2('0x74'),_0x23192c[_0x58a2('0x36')]);process[_0x58a2('0x37')](0x1);}},'error':function(_0x3c5fe4,_0x5e872c,_0x4c6edb,_0x565850){throw new Error(_0x565850);}});}function validate(){if(process['argv']&&process[_0x58a2('0x75')][_0x58a2('0x49')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x4698e9=path['join'](config[_0x58a2('0x43')],_0x58a2('0x44'),process[_0x58a2('0x75')][0x2]);if(!fs[_0x58a2('0x76')](_0x4698e9)){throw new Error(_0x58a2('0x77'));}var _0x2009a2={};try{_0x2009a2=JSON['parse'](process[_0x58a2('0x75')][0x3]);if(!_0x2009a2['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x2009a2[_0x58a2('0x78')][_0x58a2('0x2b')]){throw new Error(_0x58a2('0x79'));}if(!_0x2009a2['binding'][_0x58a2('0x58')]){throw new Error(_0x58a2('0x7a'));}var _0x1bcb11=0x0;if(_0x2009a2[_0x58a2('0x78')][_0x58a2('0x1e')]){_0x1bcb11=0x1;}if(!_0x2009a2[_0x58a2('0x1b')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x13bc35){throw new Error('body\x20id\x20mandatory');}var _0x5946c4=[];try{_0x5946c4=_['map'](JSON[_0x58a2('0x7b')](process[_0x58a2('0x75')][0x4]),'id');}catch(_0x526c6e){logger['info'](_0x58a2('0x7c'));}main(_0x4698e9,_0x2009a2,_0x5946c4,_0x1bcb11);}validate();process['on'](_0x58a2('0x7d'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x3e8e=['cm_contacts.UserId','insert','into','cm_hopper','fromQuery','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','ContactId','ListId','field','cm_hopper_black','\x20=\x20?','concat','keys','CompanyId','fields',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','message','push','code','query','spread','error','main','binding','socket_timestamp','root','header','writeFileSync','createReadStream','data','length','rows','errors','trim','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','phone','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','catch','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','uncaughtException','path','lodash','util','moment','squel','../../../mysqldb','../../../config/environment','../../../config/logger','localhost','format','test','select','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority'];(function(_0xed6f46,_0x1c9006){var _0x5b267c=function(_0x59f0d2){while(--_0x59f0d2){_0xed6f46['push'](_0xed6f46['shift']());}};_0x5b267c(++_0x1c9006);}(_0x3e8e,0x1eb));var _0xe3e8=function(_0x564ef3,_0x4f49e4){_0x564ef3=_0x564ef3-0x0;var _0x2c1f0d=_0x3e8e[_0x564ef3];return _0x2c1f0d;};'use strict';var fs=require('fs');var path=require(_0xe3e8('0x0'));var _=require(_0xe3e8('0x1'));var Papa=require('papaparse');var util=require(_0xe3e8('0x2'));var BPromise=require('bluebird');var moment=require(_0xe3e8('0x3'));var squel=require(_0xe3e8('0x4'));var db=require(_0xe3e8('0x5'))['db'];var config=require(_0xe3e8('0x6'));var logger=require(_0xe3e8('0x7'))('import');var socket=require('socket.io-emitter')({'host':_0xe3e8('0x8'),'port':0x18eb});var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xe3e8('0x9')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x3eff61){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))*$/[_0xe3e8('0xa')](_0x3eff61);}function selectNotIn(_0x2a65bf,_0x48995c,_0x73d787,_0x4b3825,_0x1e16c6){return squel[_0xe3e8('0xb')]()['field']('phone')[_0xe3e8('0xc')](_0x4b3825)['join'](_0x48995c,null,_0x48995c+_0xe3e8('0xd')+_0x4b3825+'.'+_0x73d787)[_0xe3e8('0xe')](_0x4b3825+'.'+_0x73d787+_0xe3e8('0xf')+_0x2a65bf+'.'+_0x73d787)['where'](_0x48995c+_0xe3e8('0x10')+_0x1e16c6[_0xe3e8('0x11')]()+')');}function insertCmHopper(_0x4b1cdd,_0x312531,_0xe027ef,_0x1fc155,_0x22aedb){var _0x1ee346=[_0xe3e8('0x12'),_0xe3e8('0x13'),_0xe3e8('0x14'),_0xe3e8('0x15'),_0x312531+'.'+_0x1fc155,_0xe3e8('0x16'),_0xe3e8('0x17'),_0xe3e8('0x18'),_0xe3e8('0x19'),'\x22'+_0x22aedb+'\x22'];return squel[_0xe3e8('0x1a')]()[_0xe3e8('0x1b')](_0xe3e8('0x1c'))[_0xe3e8('0x1d')](['phone','scheduledat','ContactId','ListId',_0x1fc155,_0xe3e8('0x1e'),_0xe3e8('0x1f'),'priority',_0xe3e8('0x20'),'recallme'],squel['select']()['fields'](_0x1ee346)['from'](_0x312531)[_0xe3e8('0x11')](_0xe3e8('0x21'),null,_0xe3e8('0x22')+_0x312531+'.CmListId')['join'](_0xe027ef,null,_0xe027ef+_0xe3e8('0xd')+_0x312531+'.'+_0x1fc155)['where'](_0x312531+'.CmListId\x20=\x20?',_0x4b1cdd)[_0xe3e8('0xe')](_0xe3e8('0x23'),NOW)[_0xe3e8('0xe')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x312531,_0xe027ef,_0x1fc155,_0xe3e8('0x1c'),[_0xe3e8('0x24'),_0xe3e8('0x25')]))[_0xe3e8('0xe')](_0xe3e8('0x26'),selectNotIn(_0x312531,_0xe027ef,_0x1fc155,_0xe3e8('0x1c'),['\x22always\x22'])))[_0xe3e8('0x27')]();}function insertCmHopperBlack(_0xe790ea,_0x2c6183,_0x220e6e,_0x35424e){var _0x520840=['cm_contacts.phone',_0xe3e8('0x14'),_0xe3e8('0x15'),_0x2c6183+'.'+_0x35424e,_0xe3e8('0x16'),_0xe3e8('0x17')];return squel[_0xe3e8('0x1a')]()[_0xe3e8('0x1b')]('cm_hopper_black')[_0xe3e8('0x1d')](['phone',_0xe3e8('0x28'),_0xe3e8('0x29'),_0x35424e,'createdAt',_0xe3e8('0x1f')],squel['select']()['fields'](_0x520840)['from'](_0x2c6183)['join'](_0xe3e8('0x21'),null,'cm_contacts.ListId\x20=\x20'+_0x2c6183+'.CmListId')[_0xe3e8('0x11')](_0x220e6e,null,_0x220e6e+'.id\x20=\x20'+_0x2c6183+'.'+_0x35424e)[_0xe3e8('0xe')](_0x2c6183+'.CmListId\x20=\x20?',_0xe790ea)[_0xe3e8('0xe')](_0xe3e8('0x23'),NOW)[_0xe3e8('0xe')](_0xe3e8('0x26'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x2a')]('phone')['from'](_0xe3e8('0x2b'))[_0xe3e8('0xe')]('ListId\x20=\x20?',_0xe790ea)[_0xe3e8('0xe')](_0x35424e+_0xe3e8('0x2c'),_0x2c6183+'.'+_0x35424e)))[_0xe3e8('0x27')]();}function insertCmContact(_0x1eac99,_0x51be3e,_0x34cf38,_0x17a908){var _0x38d6f9=_[_0xe3e8('0x2d')](_[_0xe3e8('0x2e')](_0x17a908),[_0xe3e8('0x29'),_0xe3e8('0x2f'),_0xe3e8('0x1e'),'updatedAt']);return squel[_0xe3e8('0x1a')]()['into'](_0xe3e8('0x21'))[_0xe3e8('0x1d')](_0x38d6f9,squel['select']()[_0xe3e8('0x30')](_0x38d6f9)[_0xe3e8('0xc')](_0x51be3e)[_0xe3e8('0xe')]('('+_0x34cf38['join'](',')+_0xe3e8('0x31'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x30')](_0x34cf38)[_0xe3e8('0xc')]('cm_contacts')[_0xe3e8('0xe')](_0xe3e8('0x32'),_0x1eac99))['where'](_0xe3e8('0x33'),squel[_0xe3e8('0xb')]()[_0xe3e8('0x2a')](_0xe3e8('0x34'),'min_id')[_0xe3e8('0xc')](_0x51be3e)[_0xe3e8('0x35')](_0x34cf38[_0xe3e8('0x11')](','))))['toString']();}function handleStop(){logger[_0xe3e8('0x36')](_0xe3e8('0x37'));stopped=!![];}function handleUncaughtException(_0x1db51e){logger['error'](_0x1db51e[_0xe3e8('0x38')]);process['exit'](0x1);}function handleError(_0x5e25a1,_0x677eaa){stats['errors'][_0xe3e8('0x39')]({'name':_0x677eaa[_0xe3e8('0x3a')],'message':_0x677eaa[_0xe3e8('0x38')],'row':_0x5e25a1});}function handleQuery(_0x108650){logger[_0xe3e8('0x36')](_0x108650);return db['sequelize'][_0xe3e8('0x3b')](_0x108650)[_0xe3e8('0x3c')](function(_0x35b403){results[_0xe3e8('0x39')](_0x35b403);})['catch'](function(_0x58ce2d){logger[_0xe3e8('0x3d')](_0x58ce2d[_0xe3e8('0x38')]);});}function main(_0x29de96,_0x49c2b0,_0x722b1f,_0x5e7fa3){logger[_0xe3e8('0x36')](_0xe3e8('0x3e'),_0x29de96,JSON['stringify'](_0x49c2b0));process['send']('start');var _0x444d15=_0x49c2b0[_0xe3e8('0x3f')];var _0x3a6d1b=_0x49c2b0[_0xe3e8('0x40')];var _0x2ef8e3=path[_0xe3e8('0x11')](config[_0xe3e8('0x41')],'server/files/tmp',_0x3a6d1b+'.csv');var _0x14ee61=_[_0xe3e8('0x2e')](_0x444d15)['join']();logger[_0xe3e8('0x36')](_0xe3e8('0x42'),_0x14ee61);fs[_0xe3e8('0x43')](_0x2ef8e3,_0x14ee61+'\x0a');Papa['parse'](fs[_0xe3e8('0x44')](_0x29de96),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e67a7,_0x9b9b29){try{for(var _0xc96542=0x0,_0xaef44c=[];_0xc96542<_0x3e67a7[_0xe3e8('0x45')][_0xe3e8('0x46')];_0xc96542++){stats[_0xe3e8('0x47')]+=0x1;if(_0x3e67a7['errors'][_0xc96542]){handleError(_0x3e67a7[_0xe3e8('0x45')][_0xc96542],_0x3e67a7[_0xe3e8('0x48')][_0xc96542]);}else{var _0x5491d0=[];for(var _0x291fed in _0x444d15){if(_0x444d15['hasOwnProperty'](_0x291fed)){if(_0x3e67a7[_0xe3e8('0x45')][_0xc96542][_0x444d15[_0x291fed]]){var _0x2120e3=_[_0xe3e8('0x49')](_0x3e67a7[_0xe3e8('0x45')][_0xc96542][_0x444d15[_0x291fed]]['replace'](/"/g,'\x27'));switch(_0x291fed){case _0xe3e8('0x4a'):var _0x2c98b2=moment(_0x2120e3,_0xe3e8('0x4b'),!![]);if(_0x2c98b2[_0xe3e8('0x4c')]()){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0[_0xe3e8('0x39')](_0xe3e8('0x4d'));}break;case _0xe3e8('0x4e'):var _0x37eaff=parseInt(_0x2120e3);_0x2120e3=_[_0xe3e8('0x4f')](_0x37eaff)||_0x37eaff<0x0||_0x37eaff>0x4?_0x5e7fa3?0x3:0x2:_0x37eaff;_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');break;case _0xe3e8('0x20'):var _0x553496=parseInt(_0x2120e3);if(_[_0xe3e8('0x50')](_0x553496)&&_[_0xe3e8('0x51')](_0x722b1f,_0x553496)){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x553496+'\x22');}else{_0x5491d0[_0xe3e8('0x39')](_0xe3e8('0x52'));}break;case _0xe3e8('0x53'):if(isEmail(_0x2120e3)){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0[_0xe3e8('0x39')]('email\x20wrong\x20format');}break;case _0xe3e8('0x54'):var _0x2e8376=moment(_0x2120e3,_0xe3e8('0x55'),!![]);if(_0x2e8376['isValid']()){_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}else{_0x5491d0['push'](_0xe3e8('0x56'));}break;default:_0xaef44c[_0xe3e8('0x39')]('\x22'+_0x2120e3+'\x22');}}else{switch(_0x291fed){case _0xe3e8('0x57'):case _0xe3e8('0x58'):_0x5491d0[_0xe3e8('0x39')](_0x291fed+_0xe3e8('0x59'));break;default:_0xaef44c['push']('\x22\x22');}}}}if(_0x5491d0[_0xe3e8('0x46')]){handleError(_0x3e67a7['data'][_0xc96542],{'code':_0xe3e8('0x5a'),'message':_0x5491d0[_0xe3e8('0x11')]()});}else{fs[_0xe3e8('0x5b')](_0x2ef8e3,_0xaef44c[_0xe3e8('0x11')]()+'\x0a');}_0xaef44c=[];}if(!(stats[_0xe3e8('0x47')]%0xc8)){socket[_0xe3e8('0x5c')](_0xe3e8('0x5d')+_0x3a6d1b,stats);stats['errors']=[];}}if(stopped){logger[_0xe3e8('0x36')](_0xe3e8('0x5e'));_0x9b9b29[_0xe3e8('0x5f')]();}}catch(_0x3cb78a){handleError(_0x3e67a7['data'][_0xc96542],{'code':_0xe3e8('0x60'),'message':_0x3cb78a[_0xe3e8('0x38')]});logger['error'](_0xe3e8('0x61'),_0x3cb78a[_0xe3e8('0x38')]);}},'complete':function(){try{var _0x318ab8=[];var _0x3a52f9=_0xe3e8('0x21');if(_0x49c2b0[_0xe3e8('0x62')]&&_0x49c2b0[_0xe3e8('0x62')][_0xe3e8('0x46')]){_0x3a52f9=_0xe3e8('0x63')+_0x3a6d1b;_0x318ab8[_0xe3e8('0x39')](_0xe3e8('0x64')+_0x3a52f9+_0xe3e8('0x65'));}var _0x54a949=util['format'](_0xe3e8('0x66'),_0x2ef8e3,_0x3a52f9,_0x14ee61,_0x49c2b0[_0xe3e8('0x29')],_0x49c2b0[_0xe3e8('0x2f')]||null,NOW,NOW);if(_[_0xe3e8('0x67')](_0x444d15[_0xe3e8('0x4a')])){_0x54a949+=',\x20scheduledAt\x20=\x20NOW()';}_0x318ab8[_0xe3e8('0x39')](_0x54a949);if(_0x49c2b0['duplicates']&&_0x49c2b0[_0xe3e8('0x62')][_0xe3e8('0x46')]){_0x318ab8['push'](insertCmContact(_0x49c2b0[_0xe3e8('0x29')],_0x3a52f9,_0x49c2b0[_0xe3e8('0x62')],_0x444d15));_0x318ab8[_0xe3e8('0x39')](_0xe3e8('0x68')+_0x3a52f9+';');}_0x318ab8[_0xe3e8('0x39')](insertCmHopper(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x69'),_0xe3e8('0x6a'),'VoiceQueueId',_0x5e7fa3));_0x318ab8['push'](insertCmHopperBlack(_0x49c2b0['ListId'],_0xe3e8('0x6b'),'voice_queues','VoiceQueueId'));_0x318ab8['push'](insertCmHopper(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x6c'),_0xe3e8('0x6d'),_0xe3e8('0x6e'),_0x5e7fa3));_0x318ab8['push'](insertCmHopperBlack(_0x49c2b0[_0xe3e8('0x29')],_0xe3e8('0x6f'),_0xe3e8('0x6d'),_0xe3e8('0x6e')));BPromise[_0xe3e8('0x70')](_0x318ab8,handleQuery)[_0xe3e8('0x71')](function(_0x2dc32f){stats[_0xe3e8('0x72')]=!![];stats[_0xe3e8('0x73')]=_0x49c2b0[_0xe3e8('0x62')]&&_0x49c2b0['duplicates']['length']?results[0x2]['affectedRows']:results[0x0][_0xe3e8('0x73')];socket[_0xe3e8('0x5c')](_0xe3e8('0x5d')+_0x3a6d1b,stats);fs[_0xe3e8('0x74')](_0x29de96);fs['unlink'](_0x2ef8e3);process['exit'](0x0);})[_0xe3e8('0x75')](function(_0x3695fe){logger['error'](_0x3695fe[_0xe3e8('0x38')]);process[_0xe3e8('0x76')](0x1);});}catch(_0x1eb9bd){logger[_0xe3e8('0x3d')](_0xe3e8('0x77'),_0x1eb9bd[_0xe3e8('0x38')]);process['exit'](0x1);}},'error':function(_0x109b35,_0x17c1df,_0x30f2ad,_0x2c6e74){throw new Error(_0x2c6e74);}});}function validate(){if(process[_0xe3e8('0x78')]&&process[_0xe3e8('0x78')]['length']<0x4){throw new Error(_0xe3e8('0x79'));}var _0x4a524f=path[_0xe3e8('0x11')](config['root'],'server/files/tmp',process[_0xe3e8('0x78')][0x2]);if(!fs[_0xe3e8('0x7a')](_0x4a524f)){throw new Error(_0xe3e8('0x7b'));}var _0x17ba2e={};try{_0x17ba2e=JSON[_0xe3e8('0x7c')](process['argv'][0x3]);if(!_0x17ba2e[_0xe3e8('0x3f')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x17ba2e['binding']['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x17ba2e[_0xe3e8('0x3f')]['firstName']){throw new Error('firstName\x20is\x20mandatory');}var _0x44b5c9=0x0;if(_0x17ba2e['binding'][_0xe3e8('0x20')]){_0x44b5c9=0x1;}if(!_0x17ba2e['ListId']){throw new Error(_0xe3e8('0x7d'));}}catch(_0x27ea10){throw new Error(_0xe3e8('0x7e'));}var _0x54d4=[];try{_0x54d4=_[_0xe3e8('0x7f')](JSON[_0xe3e8('0x7c')](process[_0xe3e8('0x78')][0x4]),'id');}catch(_0x49bb39){logger[_0xe3e8('0x36')]('No\x20agent\x20available');}main(_0x4a524f,_0x17ba2e,_0x54d4,_0x44b5c9);}validate();process['on']('SIGINT',handleStop);process['on'](_0xe3e8('0x80'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 0083e2c..4ad4d9c 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','agentconnectAt','Agent\x20Complete','Hold\x20Time','holdtime','talktime','outbound','Member\x20Name','membername','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','string','[xCALLY\x20Ticket]','toLowerCase','voice','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date'];(function(_0x4d7c1e,_0x2cb4b8){var _0x67277f=function(_0x298340){while(--_0x298340){_0x4d7c1e['push'](_0x4d7c1e['shift']());}};_0x67277f(++_0x2cb4b8);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b6c96,_0x3f4f7b){_0x5b6c96=_0x5b6c96-0x0;var _0x5eed7d=_0xedd9[_0x5b6c96];return _0x5eed7d;};'use strict';exports['getSubjects']=function(_0x116130,_0x2d7989){var _0x2af857=[{'type':_0x9edd('0x0'),'content':_0x9edd('0x1'),'variableName':null}];switch(_0x116130[_0x9edd('0x2')]()){case _0x9edd('0x3'):switch(_0x2d7989[_0x9edd('0x2')]()){case'inbound':_0x2af857[_0x9edd('0x4')]({'type':_0x9edd('0x5'),'content':'','variableName':_0x9edd('0x6')});_0x2af857[_0x9edd('0x4')]({'type':'variable','content':'','variableName':_0x9edd('0x7')});break;case'outbound':_0x2af857[_0x9edd('0x4')]({'type':_0x9edd('0x0'),'content':_0x9edd('0x8'),'variableName':null});_0x2af857[_0x9edd('0x4')]({'type':'variable','content':'','variableName':_0x9edd('0x9')});break;}}return _0x2af857;};exports['getDescriptions']=function(_0x2076fc,_0x138767){var _0x523026=[];switch(_0x2076fc[_0x9edd('0x2')]()){case _0x9edd('0x3'):switch(_0x138767['toLowerCase']()){case _0x9edd('0xa'):_0x523026=[{'type':_0x9edd('0x0'),'content':_0x9edd('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0xd'),'keyType':_0x9edd('0x5'),'variableName':_0x9edd('0x7')},{'type':_0x9edd('0xc'),'content':'','key':'Caller\x20Name','keyType':_0x9edd('0x5'),'variableName':_0x9edd('0xe')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0xf'),'keyType':_0x9edd('0x5'),'variableName':_0x9edd('0x10')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x11'),'keyType':'variable','variableName':_0x9edd('0x6')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x12'),'keyType':'variable','variableName':_0x9edd('0x13')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x14'),'keyType':'variable','variableName':_0x9edd('0x15')},{'type':'string','content':_0x9edd('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x9edd('0xc'),'content':'','key':'Agent\x20Name','keyType':'variable','variableName':_0x9edd('0x17')},{'type':'keyValue','content':'','key':_0x9edd('0x18'),'keyType':'variable','variableName':'destcalleridnum'},{'type':_0x9edd('0x0'),'content':_0x9edd('0x19'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Ring','keyType':_0x9edd('0x5'),'variableName':_0x9edd('0x15')},{'type':_0x9edd('0xc'),'content':'','key':'Agent\x20Connect','keyType':_0x9edd('0x5'),'variableName':_0x9edd('0x1a')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x1b'),'keyType':_0x9edd('0x5'),'variableName':'agentcompleteAt'},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x1c'),'keyType':_0x9edd('0x5'),'variableName':_0x9edd('0x1d')},{'type':_0x9edd('0xc'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x9edd('0x1e')}];break;case _0x9edd('0x1f'):_0x523026=[{'type':_0x9edd('0x0'),'content':_0x9edd('0xb'),'variableName':null},{'type':_0x9edd('0xc'),'content':'','key':'Called\x20Number','keyType':'variable','keyContent':'','variableName':_0x9edd('0x9')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x20'),'keyType':'variable','keyContent':'','variableName':_0x9edd('0x21')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x12'),'keyType':_0x9edd('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x14'),'keyType':_0x9edd('0x5'),'keyContent':'','variableName':_0x9edd('0x22')},{'type':_0x9edd('0x0'),'content':_0x9edd('0x19')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x23'),'keyType':_0x9edd('0x5'),'keyContent':'','variableName':_0x9edd('0x24')},{'type':_0x9edd('0xc'),'content':'','key':_0x9edd('0x25'),'keyType':_0x9edd('0x5'),'keyContent':'','variableName':_0x9edd('0x26')}];break;}}return _0x523026;}; \ No newline at end of file +var _0x4b84=['Answer\x20Time','answertime','Complete\x20Time','endtime','getSubjects','string','voice','toLowerCase','inbound','push','calleridnum','variable','destcalleridnum','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4b84,0x1cc));var _0x44b8=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x4b84[_0x51beba];return _0x167ee0;};'use strict';exports[_0x44b8('0x0')]=function(_0x2ef8a8,_0x499894){var _0x5005fd=[{'type':_0x44b8('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x2ef8a8['toLowerCase']()){case _0x44b8('0x2'):switch(_0x499894[_0x44b8('0x3')]()){case _0x44b8('0x4'):_0x5005fd['push']({'type':'variable','content':'','variableName':'queue'});_0x5005fd[_0x44b8('0x5')]({'type':'variable','content':'','variableName':_0x44b8('0x6')});break;case'outbound':_0x5005fd[_0x44b8('0x5')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x5005fd[_0x44b8('0x5')]({'type':_0x44b8('0x7'),'content':'','variableName':_0x44b8('0x8')});break;}}return _0x5005fd;};exports['getDescriptions']=function(_0xc650ec,_0x2cc74b){var _0x4315f6=[];switch(_0xc650ec[_0x44b8('0x3')]()){case _0x44b8('0x2'):switch(_0x2cc74b[_0x44b8('0x3')]()){case _0x44b8('0x4'):_0x4315f6=[{'type':'string','content':_0x44b8('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':'Caller\x20Number','keyType':_0x44b8('0x7'),'variableName':'calleridnum'},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0xb'),'keyType':'variable','variableName':_0x44b8('0xc')},{'type':'keyValue','content':'','key':'Call\x20To','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0xd')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0xe'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0x44b8('0xf'),'keyType':'variable','variableName':_0x44b8('0x10')},{'type':_0x44b8('0xa'),'content':'','key':'Date','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x11')},{'type':'string','content':_0x44b8('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':'Agent\x20Name','keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x13')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x14'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x8')},{'type':_0x44b8('0x1'),'content':_0x44b8('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x16'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x11')},{'type':'keyValue','content':'','key':_0x44b8('0x17'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x18')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x19'),'keyType':'variable','variableName':_0x44b8('0x1a')},{'type':'keyValue','content':'','key':_0x44b8('0x1b'),'keyType':_0x44b8('0x7'),'variableName':_0x44b8('0x1c')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x1d'),'keyType':'variable','variableName':_0x44b8('0x1e')}];break;case'outbound':_0x4315f6=[{'type':_0x44b8('0x1'),'content':_0x44b8('0x9'),'variableName':null},{'type':'keyValue','content':'','key':_0x44b8('0x1f'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x8')},{'type':'keyValue','content':'','key':_0x44b8('0x20'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x44b8('0xa'),'content':'','key':'UniqueId','keyType':_0x44b8('0x7'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':'Date','keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x21')},{'type':_0x44b8('0x1'),'content':_0x44b8('0x15')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x22'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x23')},{'type':_0x44b8('0xa'),'content':'','key':_0x44b8('0x24'),'keyType':_0x44b8('0x7'),'keyContent':'','variableName':_0x44b8('0x25')}];break;}}return _0x4315f6;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9b17b27..bbdaa55 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1e1=['fax-interactions','chat-interactions','upperFirst','InteractionId','toLowerCase','toUpperCase','name','role','stringify','null','findOne','then','update','info','catch','error','tracked','query','clone','body','omit','phone','fax','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xc1e1,0x130));var _0x1c1e=function(_0x3d2c2f,_0x2915a6){_0x3d2c2f=_0x3d2c2f-0x0;var _0x32cd88=_0xc1e1[_0x3d2c2f];return _0x32cd88;};'use strict';var _=require('lodash');var db=require(_0x1c1e('0x0'))['db'];var loggers={'openchannel':require(_0x1c1e('0x1'))(_0x1c1e('0x2')),'mail':require(_0x1c1e('0x1'))(_0x1c1e('0x3')),'fax':require(_0x1c1e('0x1'))(_0x1c1e('0x4')),'sms':require(_0x1c1e('0x1'))('sms-interactions'),'chat':require(_0x1c1e('0x1'))(_0x1c1e('0x5'))};function getInteractionId(_0x598178,_0x4a66ff,_0x4742e8){if(_0x598178&&_0x598178[_[_0x1c1e('0x6')](_0x4742e8)+'InteractionId']){return _0x598178[_[_0x1c1e('0x6')](_0x4742e8)+_0x1c1e('0x7')];}else if(_0x598178&&_0x598178['id']){return _0x598178['id'];}else if(_0x4a66ff&&_0x4a66ff['id']){return _0x4a66ff['id'];}else{return'unknown';}}function log(_0x34c751,_0x5b576c,_0x3d9d2a,_0x537e46,_0x148996,_0x451771){loggers[_0x148996[_0x1c1e('0x8')]()][_0x34c751]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x451771[_0x1c1e('0x9')](),_0x5b576c?_0x5b576c['id']:null,_0x5b576c?_0x5b576c[_0x1c1e('0xa')]:null,_0x5b576c?_0x5b576c[_0x1c1e('0xb')]:null,getInteractionId(_0x3d9d2a,_0x537e46,_0x148996),_0x3d9d2a?JSON[_0x1c1e('0xc')](_0x3d9d2a):_0x1c1e('0xd'));}function updateUser(_0x2a11f5,_0x403aa6,_0x35b6b3,_0x5d8d75,_0xe98f5f){db[_[_0x1c1e('0x6')](_0x5d8d75)+'Interaction'][_0x1c1e('0xe')]({'where':{'id':getInteractionId(_0x403aa6,_0x35b6b3,_0x5d8d75)}})[_0x1c1e('0xf')](function(_0x4fef1b){if(_0x4fef1b){return _0x4fef1b[_0x1c1e('0x10')]({'UserId':_0x2a11f5?_0x2a11f5['id']:null});}})[_0x1c1e('0xf')](function(_0x589b78){if(_0x589b78){log(_0x1c1e('0x11'),_0x2a11f5,_0x403aa6,_0x35b6b3,_0x5d8d75,_0xe98f5f);}})[_0x1c1e('0x12')](function(){log(_0x1c1e('0x13'),_0x2a11f5,_0x403aa6,_0x35b6b3,_0x5d8d75,_0xe98f5f);});}exports[_0x1c1e('0x14')]=function(_0x34bd48,_0x2b7a98){return function(_0x446b83,_0x1b1916,_0x4b9da7){var _0x42d0bc=_0x446b83['user'];var _0x460733={};var _0x578c62=_0x446b83[_0x1c1e('0x15')];if(_0x460733){_0x460733=_[_0x1c1e('0x16')](_0x446b83[_0x1c1e('0x17')]);_0x460733=_[_0x1c1e('0x18')](_0x460733,[_0x1c1e('0x17'),'html',_0x1c1e('0x19'),_0x1c1e('0x1a'),_0x1c1e('0x1b')]);}updateUser(_0x42d0bc,_0x460733,_0x578c62,_0x34bd48,_0x2b7a98);_0x4b9da7(null);};}; \ No newline at end of file +var _0x9320=['upperFirst','InteractionId','unknown','name','role','stringify','null','then','update','error','tracked','user','query','clone','omit','body','phone','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions'];(function(_0x29f46b,_0x29b6f4){var _0x22b7c2=function(_0x39731d){while(--_0x39731d){_0x29f46b['push'](_0x29f46b['shift']());}};_0x22b7c2(++_0x29b6f4);}(_0x9320,0xfd));var _0x0932=function(_0x4be300,_0x50d073){_0x4be300=_0x4be300-0x0;var _0x3c7092=_0x9320[_0x4be300];return _0x3c7092;};'use strict';var _=require(_0x0932('0x0'));var db=require(_0x0932('0x1'))['db'];var loggers={'openchannel':require(_0x0932('0x2'))(_0x0932('0x3')),'mail':require(_0x0932('0x2'))(_0x0932('0x4')),'fax':require('../../config/logger')(_0x0932('0x5')),'sms':require(_0x0932('0x2'))('sms-interactions'),'chat':require(_0x0932('0x2'))(_0x0932('0x6'))};function getInteractionId(_0x3d54a3,_0x268f42,_0xe52d8d){if(_0x3d54a3&&_0x3d54a3[_[_0x0932('0x7')](_0xe52d8d)+_0x0932('0x8')]){return _0x3d54a3[_[_0x0932('0x7')](_0xe52d8d)+_0x0932('0x8')];}else if(_0x3d54a3&&_0x3d54a3['id']){return _0x3d54a3['id'];}else if(_0x268f42&&_0x268f42['id']){return _0x268f42['id'];}else{return _0x0932('0x9');}}function log(_0x282510,_0x56c8b6,_0x1df5e0,_0x41249c,_0x1503c4,_0x1721ca){loggers[_0x1503c4['toLowerCase']()][_0x282510]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1721ca['toUpperCase'](),_0x56c8b6?_0x56c8b6['id']:null,_0x56c8b6?_0x56c8b6[_0x0932('0xa')]:null,_0x56c8b6?_0x56c8b6[_0x0932('0xb')]:null,getInteractionId(_0x1df5e0,_0x41249c,_0x1503c4),_0x1df5e0?JSON[_0x0932('0xc')](_0x1df5e0):_0x0932('0xd'));}function updateUser(_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95){db[_[_0x0932('0x7')](_0x5471d5)+'Interaction']['findOne']({'where':{'id':getInteractionId(_0x155649,_0x1b0f45,_0x5471d5)}})[_0x0932('0xe')](function(_0x812533){if(_0x812533){return _0x812533[_0x0932('0xf')]({'UserId':_0x3086bb?_0x3086bb['id']:null});}})[_0x0932('0xe')](function(_0x50ceb5){if(_0x50ceb5){log('info',_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95);}})['catch'](function(){log(_0x0932('0x10'),_0x3086bb,_0x155649,_0x1b0f45,_0x5471d5,_0x677b95);});}exports[_0x0932('0x11')]=function(_0x55f624,_0x5c28ba){return function(_0x1a51a5,_0x1f72dd,_0x57ad16){var _0xf61fc9=_0x1a51a5[_0x0932('0x12')];var _0x52d093={};var _0x3a6b9c=_0x1a51a5[_0x0932('0x13')];if(_0x52d093){_0x52d093=_[_0x0932('0x14')](_0x1a51a5['body']);_0x52d093=_[_0x0932('0x15')](_0x52d093,[_0x0932('0x16'),'html',_0x0932('0x17'),_0x0932('0x18'),_0x0932('0x19')]);}updateUser(_0xf61fc9,_0x52d093,_0x3a6b9c,_0x55f624,_0x5c28ba);_0x57ad16(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index bb1192f..2e16b1b 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 _0x27de=['crypto','util','../../mysqldb','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','License','findOne','then','count','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user'];(function(_0xd19b87,_0x791058){var _0x5d3f1d=function(_0x33164b){while(--_0x33164b){_0xd19b87['push'](_0xd19b87['shift']());}};_0x5d3f1d(++_0x791058);}(_0x27de,0x1b0));var _0xe27d=function(_0x97ab66,_0x336c5c){_0x97ab66=_0x97ab66-0x0;var _0x5ed700=_0x27de[_0x97ab66];return _0x5ed700;};'use strict';var crypto=require(_0xe27d('0x0'));var util=require(_0xe27d('0x1'));var compose=require('composable-middleware');var db=require(_0xe27d('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x26e547,_0x5b53e0){if(_0x26e547&&_0x5b53e0){if(_0x5b53e0[_0xe27d('0x3')]&&_0x5b53e0['license']){var _0x5310c7=_0x5b53e0[_0xe27d('0x3')];var _0x563360=_0x5b53e0[_0xe27d('0x4')];var _0x471ffc=_0x5310c7[_0xe27d('0x5')]('-')[0x4];var _0x4d3a75=_0x5310c7[_0xe27d('0x5')]('-')[0x0];var _0x17f10d=crypto[_0xe27d('0x6')](_0xe27d('0x7'),util[_0xe27d('0x8')](_0xe27d('0x9'),_0x471ffc,_0x5310c7,_0x4d3a75));var _0x37d609=_0x17f10d[_0xe27d('0xa')](_0x563360,_0xe27d('0xb'),_0xe27d('0xc'));_0x37d609+=_0x17f10d[_0xe27d('0xd')]('utf8');var _0x1dce1f=JSON[_0xe27d('0xe')](_0x37d609);return _0x1dce1f[_0xe27d('0xf')](_0x26e547)?_0x1dce1f[_0x26e547]:null;}}return null;}function isLimit(_0x45e6d6,_0x5d2b60,_0x549fd4,_0x1b8f8f){var _0xcfcded=_0x5d2b60;return compose()['use'](function(_0x36b3b5,_0x598b2f,_0x316877){return db[_0xe27d('0x10')][_0xe27d('0x11')]({'where':{'id':0x1},'raw':!![]})[_0xe27d('0x12')](function(_0x4e2e9e){var _0x1dca2e=getValueFromLicense(_0x45e6d6,_0x4e2e9e);return _0x1dca2e?_0x1dca2e:_0xcfcded;})['then'](function(_0x4c12c3){_0xcfcded=_0x4c12c3;return _0x549fd4[_0xe27d('0x13')](_0x1b8f8f);})[_0xe27d('0x12')](function(_0x32eb0d){if(_0x32eb0d>=_0xcfcded){return _0x598b2f['status'](0x193)['json']({'message':util[_0xe27d('0x8')](_0xe27d('0x14'),_0x45e6d6)});}_0x316877();})['catch'](function(_0x190651){_0x316877(_0x190651);});});}function isUserLimit(){return isLimit(_0xe27d('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xe27d('0x16')},{'role':_0xe27d('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x71b0=['crypto','util','composable-middleware','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','admin','isUserLimit'];(function(_0x2e3514,_0x18dcaf){var _0x1b4215=function(_0x247a53){while(--_0x247a53){_0x2e3514['push'](_0x2e3514['shift']());}};_0x1b4215(++_0x18dcaf);}(_0x71b0,0x1ba));var _0x071b=function(_0x3fd9cc,_0x57816b){_0x3fd9cc=_0x3fd9cc-0x0;var _0x53e052=_0x71b0[_0x3fd9cc];return _0x53e052;};'use strict';var crypto=require(_0x071b('0x0'));var util=require(_0x071b('0x1'));var compose=require(_0x071b('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x54fd1d,_0x31169c){if(_0x54fd1d&&_0x31169c){if(_0x31169c[_0x071b('0x3')]&&_0x31169c[_0x071b('0x4')]){var _0x136654=_0x31169c['data1'];var _0x5f410a=_0x31169c['license'];var _0x1b3a78=_0x136654[_0x071b('0x5')]('-')[0x4];var _0x4f9c62=_0x136654[_0x071b('0x5')]('-')[0x0];var _0x339abc=crypto[_0x071b('0x6')](_0x071b('0x7'),util[_0x071b('0x8')](_0x071b('0x9'),_0x1b3a78,_0x136654,_0x4f9c62));var _0x11f3d5=_0x339abc[_0x071b('0xa')](_0x5f410a,_0x071b('0xb'),_0x071b('0xc'));_0x11f3d5+=_0x339abc['final'](_0x071b('0xc'));var _0x4f04bc=JSON['parse'](_0x11f3d5);return _0x4f04bc[_0x071b('0xd')](_0x54fd1d)?_0x4f04bc[_0x54fd1d]:null;}}return null;}function isLimit(_0x1caf99,_0x38f307,_0x1e0114,_0x557cc1){var _0x369e13=_0x38f307;return compose()[_0x071b('0xe')](function(_0x2887ca,_0x29350e,_0x5821e3){return db[_0x071b('0xf')][_0x071b('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x071b('0x11')](function(_0x28e34c){var _0x9456d=getValueFromLicense(_0x1caf99,_0x28e34c);return _0x9456d?_0x9456d:_0x369e13;})[_0x071b('0x11')](function(_0x2030bd){_0x369e13=_0x2030bd;return _0x1e0114[_0x071b('0x12')](_0x557cc1);})[_0x071b('0x11')](function(_0x20eb62){if(_0x20eb62>=_0x369e13){return _0x29350e[_0x071b('0x13')](0x193)[_0x071b('0x14')]({'message':util[_0x071b('0x8')](_0x071b('0x15'),_0x1caf99)});}_0x5821e3();})['catch'](function(_0xcdcebf){_0x5821e3(_0xcdcebf);});});}function isUserLimit(){return isLimit(_0x071b('0x16'),0x1,db[_0x071b('0x17')],{'where':{'$or':[{'role':_0x071b('0x18')},{'role':'user'}]}});}exports[_0x071b('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 20df115..ca800d0 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 _0xf46a=['substr','ASC','omit','isEmpty','isArray','length','isObject','isString','unset','hasOwnProperty','lodash','sequelize','fields','split','limit','offset','sort','map','cast','col','priority','unsigned'];(function(_0x142dca,_0x1262fa){var _0x87471b=function(_0x4c7f3c){while(--_0x4c7f3c){_0x142dca['push'](_0x142dca['shift']());}};_0x87471b(++_0x1262fa);}(_0xf46a,0x16a));var _0xaf46=function(_0x3386ca,_0x5c57b1){_0x3386ca=_0x3386ca-0x0;var _0x4764a6=_0xf46a[_0x3386ca];return _0x4764a6;};'use strict';var _=require(_0xaf46('0x0'));var sequelize=require(_0xaf46('0x1'));var LIMIT_VALUE=0xfa;exports[_0xaf46('0x2')]=function(_0x1888d7){var _0x3edc43=null;if(_0x1888d7){_0x3edc43=_0x1888d7['split'](',');}return _0x3edc43;};exports['filters']=function(_0x159dc8){var _0x44d8cc={};if(!_['isEmpty'](_0x159dc8)){_0x44d8cc={};_['forOwn'](_0x159dc8,function(_0xcbdc2d,_0x198663){try{_0x44d8cc[_0x198663]=JSON['parse'](_0xcbdc2d);}catch(_0x51be92){_0x44d8cc[_0x198663]=_0xcbdc2d[_0xaf46('0x3')](',');}});}return _0x44d8cc;};exports[_0xaf46('0x4')]=function(_0x4ff3e0){_0x4ff3e0=parseInt(_0x4ff3e0,0xa);if(!_0x4ff3e0||_0x4ff3e0<0x0){_0x4ff3e0=LIMIT_VALUE;}return _0x4ff3e0;};exports[_0xaf46('0x5')]=function(_0x286471){_0x286471=parseInt(_0x286471,0xa);if(!_0x286471||_0x286471<0x0){_0x286471=0x0;}return _0x286471;};exports[_0xaf46('0x6')]=function(_0x27fcc6){var _0x21ef26,_0xfb1ec=null;if(_0x27fcc6){_0x21ef26=_0x27fcc6['split'](',');_0xfb1ec=_[_0xaf46('0x7')](_0x21ef26,function(_0x4fef33){if(_0x4fef33['indexOf']('-')===0x0){return[_0x4fef33==='priority'?sequelize[_0xaf46('0x8')](sequelize[_0xaf46('0x9')](_0xaf46('0xa')),_0xaf46('0xb')):_0x4fef33[_0xaf46('0xc')](0x1),'DESC'];}else{return[_0x4fef33==='priority'?sequelize['cast'](sequelize[_0xaf46('0x9')](_0xaf46('0xa')),_0xaf46('0xb')):_0x4fef33,_0xaf46('0xd')];}});}return _0xfb1ec;};exports[_0xaf46('0xe')]=function(_0x5621b0,_0x59c956){if(_[_0xaf46('0xf')](_0x5621b0)){return _0x5621b0;}if(_[_0xaf46('0x10')](_0x5621b0)){for(var _0x2bba15=0x0;_0x2bba15<_0x5621b0[_0xaf46('0x11')];_0x2bba15+=0x1){_0x5621b0[_0x2bba15]=this[_0xaf46('0xe')](_0x5621b0[_0x2bba15],_0x59c956);}return _0x5621b0;}if(!_[_0xaf46('0x12')](_0x5621b0)){return _0x5621b0;}if(_[_0xaf46('0x13')](_0x59c956)){_0x59c956=[_0x59c956];}if(!_[_0xaf46('0x10')](_0x59c956)){return _0x5621b0;}for(var _0x1f74a0=0x0;_0x1f74a0<_0x59c956[_0xaf46('0x11')];_0x1f74a0+=0x1){_[_0xaf46('0x14')](_0x5621b0,_0x59c956[_0x1f74a0]);}for(var _0x125845 in _0x5621b0){if(_0x5621b0[_0xaf46('0x15')](_0x125845)){_0x5621b0[_0x125845]=this[_0xaf46('0xe')](_0x5621b0[_0x125845],_0x59c956);}}return _0x5621b0;}; \ No newline at end of file +var _0x5ab9=['omit','isObject','lodash','filters','isEmpty','forOwn','parse','split','offset','priority','col','unsigned','ASC','isArray','length'];(function(_0x29281f,_0xd278d2){var _0x1a6edc=function(_0x3118ca){while(--_0x3118ca){_0x29281f['push'](_0x29281f['shift']());}};_0x1a6edc(++_0xd278d2);}(_0x5ab9,0x1d3));var _0x95ab=function(_0x1a3ca2,_0xe144e7){_0x1a3ca2=_0x1a3ca2-0x0;var _0x30ea08=_0x5ab9[_0x1a3ca2];return _0x30ea08;};'use strict';var _=require(_0x95ab('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports['fields']=function(_0x28ad11){var _0x1cffa3=null;if(_0x28ad11){_0x1cffa3=_0x28ad11['split'](',');}return _0x1cffa3;};exports[_0x95ab('0x1')]=function(_0x463896){var _0x4623a6={};if(!_[_0x95ab('0x2')](_0x463896)){_0x4623a6={};_[_0x95ab('0x3')](_0x463896,function(_0x52b128,_0x58b10c){try{_0x4623a6[_0x58b10c]=JSON[_0x95ab('0x4')](_0x52b128);}catch(_0x2f25d3){_0x4623a6[_0x58b10c]=_0x52b128[_0x95ab('0x5')](',');}});}return _0x4623a6;};exports['limit']=function(_0x268b5d){_0x268b5d=parseInt(_0x268b5d,0xa);if(!_0x268b5d||_0x268b5d<0x0){_0x268b5d=LIMIT_VALUE;}return _0x268b5d;};exports[_0x95ab('0x6')]=function(_0x1a3c25){_0x1a3c25=parseInt(_0x1a3c25,0xa);if(!_0x1a3c25||_0x1a3c25<0x0){_0x1a3c25=0x0;}return _0x1a3c25;};exports['sort']=function(_0x314be0){var _0x48ed22,_0x51286c=null;if(_0x314be0){_0x48ed22=_0x314be0[_0x95ab('0x5')](',');_0x51286c=_['map'](_0x48ed22,function(_0xb29c1b){if(_0xb29c1b['indexOf']('-')===0x0){return[_0xb29c1b===_0x95ab('0x7')?sequelize['cast'](sequelize[_0x95ab('0x8')]('priority'),_0x95ab('0x9')):_0xb29c1b['substr'](0x1),'DESC'];}else{return[_0xb29c1b==='priority'?sequelize['cast'](sequelize[_0x95ab('0x8')](_0x95ab('0x7')),_0x95ab('0x9')):_0xb29c1b,_0x95ab('0xa')];}});}return _0x51286c;};exports['omit']=function(_0x15f2f6,_0x574588){if(_[_0x95ab('0x2')](_0x15f2f6)){return _0x15f2f6;}if(_[_0x95ab('0xb')](_0x15f2f6)){for(var _0xa9679f=0x0;_0xa9679f<_0x15f2f6[_0x95ab('0xc')];_0xa9679f+=0x1){_0x15f2f6[_0xa9679f]=this[_0x95ab('0xd')](_0x15f2f6[_0xa9679f],_0x574588);}return _0x15f2f6;}if(!_[_0x95ab('0xe')](_0x15f2f6)){return _0x15f2f6;}if(_['isString'](_0x574588)){_0x574588=[_0x574588];}if(!_[_0x95ab('0xb')](_0x574588)){return _0x15f2f6;}for(var _0x4e696d=0x0;_0x4e696d<_0x574588['length'];_0x4e696d+=0x1){_['unset'](_0x15f2f6,_0x574588[_0x4e696d]);}for(var _0x32fcee in _0x15f2f6){if(_0x15f2f6['hasOwnProperty'](_0x32fcee)){_0x15f2f6[_0x32fcee]=this['omit'](_0x15f2f6[_0x32fcee],_0x574588);}}return _0x15f2f6;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6faa672..6077e63 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['use','join','root','favicon.ico','set','appPath','development','test','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','body-parser','method-override','cookie-parser','errorhandler','path','cors','moment','./environment','../mysqldb','default','get','env','production'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var favicon=require('serve-favicon');var bodyParser=require(_0x3071('0x0'));var methodOverride=require(_0x3071('0x1'));var cookieParser=require(_0x3071('0x2'));var errorHandler=require(_0x3071('0x3'));var path=require(_0x3071('0x4'));var passport=require('passport');var cors=require(_0x3071('0x5'));var moment=require(_0x3071('0x6'));var config=require(_0x3071('0x7'));var db=require(_0x3071('0x8'))['db'];exports[_0x3071('0x9')]=function(_0x41cf76){var _0x1d3dd6=_0x41cf76[_0x3071('0xa')](_0x3071('0xb'));if(_0x1d3dd6===_0x3071('0xc')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'public',_0x3071('0x10'))));_0x41cf76[_0x3071('0x11')](_0x3071('0x12'),path[_0x3071('0xe')](config[_0x3071('0xf')],'public'));}if(_0x1d3dd6===_0x3071('0x13')||_0x1d3dd6===_0x3071('0x14')){_0x41cf76[_0x3071('0xd')](favicon(path[_0x3071('0xe')](config[_0x3071('0xf')],'client','favicon.ico')));_0x41cf76[_0x3071('0x11')]('appPath',path[_0x3071('0xe')](config[_0x3071('0xf')],'client'));_0x41cf76[_0x3071('0xd')](errorHandler());}_0x41cf76['set'](_0x3071('0x15'),function(_0x45c93b,_0x1271d0){if(this[_0x45c93b]instanceof Date){_0x1271d0=this[_0x45c93b][_0x3071('0x16')]()[_0x3071('0x17')]('.')[0x0]+'Z';}return _0x1271d0;});_0x41cf76[_0x3071('0xd')](express[_0x3071('0x18')](_0x41cf76[_0x3071('0xa')](_0x3071('0x12'))));_0x41cf76[_0x3071('0x11')]('views',config[_0x3071('0xf')]+_0x3071('0x19'));_0x41cf76[_0x3071('0x1a')](_0x3071('0x1b'),require(_0x3071('0x1c'))[_0x3071('0x1d')]);_0x41cf76[_0x3071('0x11')](_0x3071('0x1e'),'html');_0x41cf76[_0x3071('0xd')](bodyParser[_0x3071('0x1f')]({'limit':_0x3071('0x20'),'extended':!![]}));_0x41cf76['use'](bodyParser[_0x3071('0x21')]({'limit':'50mb'}));_0x41cf76[_0x3071('0xd')](cors());_0x41cf76[_0x3071('0xd')](methodOverride());_0x41cf76[_0x3071('0xd')](cookieParser());_0x41cf76[_0x3071('0xd')](passport[_0x3071('0x22')]());}; \ No newline at end of file +var _0x70e0=['test','client','set','json\x20replacer','split','static','get','views','/server/views','engine','html','renderFile','view\x20engine','json','50mb','initialize','express','serve-favicon','body-parser','errorhandler','path','passport','cors','./environment','default','env','production','use','join','root','public','favicon.ico','development'];(function(_0x55df88,_0xf7418a){var _0x171e61=function(_0x208edc){while(--_0x208edc){_0x55df88['push'](_0x55df88['shift']());}};_0x171e61(++_0xf7418a);}(_0x70e0,0x17b));var _0x070e=function(_0x3885c7,_0x515e15){_0x3885c7=_0x3885c7-0x0;var _0x214dd1=_0x70e0[_0x3885c7];return _0x214dd1;};'use strict';var express=require(_0x070e('0x0'));var favicon=require(_0x070e('0x1'));var bodyParser=require(_0x070e('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x070e('0x3'));var path=require(_0x070e('0x4'));var passport=require(_0x070e('0x5'));var cors=require(_0x070e('0x6'));var moment=require('moment');var config=require(_0x070e('0x7'));var db=require('../mysqldb')['db'];exports[_0x070e('0x8')]=function(_0x4b041d){var _0x56e420=_0x4b041d['get'](_0x070e('0x9'));if(_0x56e420===_0x070e('0xa')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe'),_0x070e('0xf'))));_0x4b041d['set']('appPath',path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0xe')));}if(_0x56e420===_0x070e('0x10')||_0x56e420===_0x070e('0x11')){_0x4b041d[_0x070e('0xb')](favicon(path[_0x070e('0xc')](config[_0x070e('0xd')],_0x070e('0x12'),_0x070e('0xf'))));_0x4b041d[_0x070e('0x13')]('appPath',path['join'](config[_0x070e('0xd')],'client'));_0x4b041d['use'](errorHandler());}_0x4b041d['set'](_0x070e('0x14'),function(_0x14c3fd,_0x51d14d){if(this[_0x14c3fd]instanceof Date){_0x51d14d=this[_0x14c3fd]['toISOString']()[_0x070e('0x15')]('.')[0x0]+'Z';}return _0x51d14d;});_0x4b041d[_0x070e('0xb')](express[_0x070e('0x16')](_0x4b041d[_0x070e('0x17')]('appPath')));_0x4b041d['set'](_0x070e('0x18'),config[_0x070e('0xd')]+_0x070e('0x19'));_0x4b041d[_0x070e('0x1a')](_0x070e('0x1b'),require('ejs')[_0x070e('0x1c')]);_0x4b041d[_0x070e('0x13')](_0x070e('0x1d'),_0x070e('0x1b'));_0x4b041d[_0x070e('0xb')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x4b041d['use'](bodyParser[_0x070e('0x1e')]({'limit':_0x070e('0x1f')}));_0x4b041d[_0x070e('0xb')](cors());_0x4b041d['use'](methodOverride());_0x4b041d[_0x070e('0xb')](cookieParser());_0x4b041d['use'](passport[_0x070e('0x20')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index e587b0c..3a29aa7 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 _0xb00d=['IPv4','internal','mac','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid','hostname','macAddress','ipAddress','update','substring','lodash','execSync','networkInterfaces','orderBy','keys'];(function(_0x2bfe78,_0x2ca821){var _0x4d852f=function(_0xf5f6cf){while(--_0xf5f6cf){_0x2bfe78['push'](_0x2bfe78['shift']());}};_0x4d852f(++_0x2ca821);}(_0xb00d,0x97));var _0xdb00=function(_0xd580e2,_0x109182){_0xd580e2=_0xd580e2-0x0;var _0x4d955f=_0xb00d[_0xd580e2];return _0x4d955f;};'use strict';var _=require(_0xdb00('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xdb00('0x1')];function getInterfaces(){var _0x3cfb25=[];var _0x1fb77e=os[_0xdb00('0x2')]();var _0x46131f=_[_0xdb00('0x3')](_[_0xdb00('0x4')](_0x1fb77e));for(var _0x2bcf4c=0x0;_0x2bcf4c<_0x46131f['length'];_0x2bcf4c++){var _0x1e7a8d=_0x1fb77e[_0x46131f[_0x2bcf4c]]['filter'](function(_0x493a23){return _0x493a23['family']===_0xdb00('0x5')&&_0x493a23[_0xdb00('0x6')]===![];});_0x3cfb25=_0x3cfb25['concat'](_0x1e7a8d);}return _0x3cfb25;}function getFirstInterface(){var _0x453e65=_['head'](getInterfaces());return{'macAddress':_0x453e65&&_0x453e65[_0xdb00('0x7')]?_0x453e65[_0xdb00('0x7')]:'00:00:00:00:00:00','ipAddress':_0x453e65&&_0x453e65['address']?_0x453e65['address']:_0xdb00('0x8')};}exports[_0xdb00('0x9')]=getFirstInterface;function getCPUhash(){var _0x17cd87=_['orderBy'](os[_0xdb00('0xa')]()[_0xdb00('0xb')](function(_0x2dedb0){return _0x2dedb0[_0xdb00('0xc')];}))[_0xdb00('0xd')](':');return crypto[_0xdb00('0xe')](_0xdb00('0xf'))['update'](_0x17cd87)[_0xdb00('0x10')](_0xdb00('0x11'));}exports['getUuid']=function(){switch(os[_0xdb00('0x12')]()){case _0xdb00('0x13'):return exec(_0xdb00('0x14'),{'encoding':'utf8'})['replace']('\x0d\x0a','');default:var _0x1f9295=getFirstInterface();var _0x25b570=getCPUhash();var _0x2e49fc=_0x25b570+'|'+os[_0xdb00('0x15')]()+'|'+_0x1f9295[_0xdb00('0x16')]+'|'+_0x1f9295[_0xdb00('0x17')];var _0x5beda0=crypto[_0xdb00('0xe')](_0xdb00('0xf'))[_0xdb00('0x18')](_0x2e49fc)[_0xdb00('0x10')]('hex');return _0x5beda0[_0xdb00('0x19')](0x0,0x8)+'-'+_0x5beda0[_0xdb00('0x19')](0x8,0xc)+'-'+_0x5beda0['substring'](0xc,0x10)+'-'+_0x5beda0[_0xdb00('0x19')](0x10,0x14)+'-'+_0x5beda0['substring'](0x14);}}; \ No newline at end of file +var _0x3820=['replace','hostname','macAddress','ipAddress','update','substring','lodash','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','family','IPv4','internal','concat','head','mac','address','cpus','map','model','createHash','md5','digest','hex','platform','win32','dmidecode\x20--string\x20system-uuid'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x3820,0x92));var _0x0382=function(_0x2583b2,_0x45a743){_0x2583b2=_0x2583b2-0x0;var _0xc1b07c=_0x3820[_0x2583b2];return _0xc1b07c;};'use strict';var _=require(_0x0382('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x0382('0x1'));var exec=require(_0x0382('0x2'))['execSync'];function getInterfaces(){var _0x72f57b=[];var _0x18ede3=os[_0x0382('0x3')]();var _0x5eb10f=_[_0x0382('0x4')](_['keys'](_0x18ede3));for(var _0x29e0e8=0x0;_0x29e0e8<_0x5eb10f['length'];_0x29e0e8++){var _0x3d5062=_0x18ede3[_0x5eb10f[_0x29e0e8]]['filter'](function(_0xa82408){return _0xa82408[_0x0382('0x5')]===_0x0382('0x6')&&_0xa82408[_0x0382('0x7')]===![];});_0x72f57b=_0x72f57b[_0x0382('0x8')](_0x3d5062);}return _0x72f57b;}function getFirstInterface(){var _0x85147b=_[_0x0382('0x9')](getInterfaces());return{'macAddress':_0x85147b&&_0x85147b[_0x0382('0xa')]?_0x85147b[_0x0382('0xa')]:'00:00:00:00:00:00','ipAddress':_0x85147b&&_0x85147b[_0x0382('0xb')]?_0x85147b[_0x0382('0xb')]:'127.0.0.1'};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xc01d87=_[_0x0382('0x4')](os[_0x0382('0xc')]()[_0x0382('0xd')](function(_0x5ca3ce){return _0x5ca3ce[_0x0382('0xe')];}))['join'](':');return crypto[_0x0382('0xf')](_0x0382('0x10'))['update'](_0xc01d87)[_0x0382('0x11')](_0x0382('0x12'));}exports['getUuid']=function(){switch(os[_0x0382('0x13')]()){case _0x0382('0x14'):return exec(_0x0382('0x15'),{'encoding':'utf8'})[_0x0382('0x16')]('\x0d\x0a','');default:var _0x396835=getFirstInterface();var _0x46ddbf=getCPUhash();var _0x5a7c71=_0x46ddbf+'|'+os[_0x0382('0x17')]()+'|'+_0x396835[_0x0382('0x18')]+'|'+_0x396835[_0x0382('0x19')];var _0x515ea7=crypto[_0x0382('0xf')](_0x0382('0x10'))[_0x0382('0x1a')](_0x5a7c71)['digest'](_0x0382('0x12'));return _0x515ea7[_0x0382('0x1b')](0x0,0x8)+'-'+_0x515ea7['substring'](0x8,0xc)+'-'+_0x515ea7[_0x0382('0x1b')](0xc,0x10)+'-'+_0x515ea7[_0x0382('0x1b')](0x10,0x14)+'-'+_0x515ea7[_0x0382('0x1b')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index df2aeda..c25cf88 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 _0x15f4=['./hardware','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','exports','GET','request','setEncoding','utf8','data','end','parse','error','createCipher','secrets','session','base64','final','createDecipher','aes-256-ctr','update','User','findOne','admin','fullname','email','then','|machineUuid|','|name|','getFirstInterface','ipAddress','MOTLICENSE','Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','catch','finally','getUuid','License','spread','message','default','https','crypto','moment','bluebird','pkginfo','version','../../mysqldb'];(function(_0x72641a,_0x3cc68a){var _0x37af36=function(_0x4e08ba){while(--_0x4e08ba){_0x72641a['push'](_0x72641a['shift']());}};_0x37af36(++_0x3cc68a);}(_0x15f4,0xfd));var _0x415f=function(_0x44eec6,_0x37bdc7){_0x44eec6=_0x44eec6-0x0;var _0x39e6eb=_0x15f4[_0x44eec6];return _0x39e6eb;};'use strict';var util=require('util');var https=require(_0x415f('0x0'));var crypto=require(_0x415f('0x1'));var moment=require(_0x415f('0x2'));var BPromise=require(_0x415f('0x3'));var pkginfo=require(_0x415f('0x4'))(module,_0x415f('0x5'));var db=require(_0x415f('0x6'))['db'];var config=require('../environment');var hardware=require(_0x415f('0x7'));var logger=require(_0x415f('0x8'))(_0x415f('0x9'));var jira=require(_0x415f('0xa'));var HOST=_0x415f('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x3c2a77){return new BPromise(function(_0x89ceb4,_0x4e97c4){var _0x5c6085={'host':HOST,'port':0x1bb,'path':util[_0x415f('0xc')]('/api/servers/%s/check?version=%s',_0x3c2a77,module[_0x415f('0xd')][_0x415f('0x5')]),'method':_0x415f('0xe'),'timeout':0xea60,'headers':{'Content-Type':'application/json'}};var _0x441577=https[_0x415f('0xf')](_0x5c6085,function(_0x4a3985){_0x4a3985[_0x415f('0x10')](_0x415f('0x11'));var _0x3314c6='';_0x4a3985['on'](_0x415f('0x12'),function(_0x296d69){_0x3314c6+=_0x296d69;});_0x4a3985['on'](_0x415f('0x13'),function(){try{_0x89ceb4(JSON[_0x415f('0x14')](_0x3314c6));}catch(_0x526b95){_0x4e97c4(_0x526b95);}});});_0x441577['on'](_0x415f('0x15'),_0x4e97c4);_0x441577[_0x415f('0x13')]();});}function encryptDate(_0x2fa0ff){var _0x40cd92=crypto[_0x415f('0x16')]('aes-256-ctr',config[_0x415f('0x17')][_0x415f('0x18')]);var _0x2b433e=_0x40cd92['update'](_0x2fa0ff,_0x415f('0x11'),_0x415f('0x19'));_0x2b433e+=_0x40cd92[_0x415f('0x1a')](_0x415f('0x19'));return _0x2b433e;}function decryptDate(_0x1c66f1){var _0x30de84=crypto[_0x415f('0x1b')](_0x415f('0x1c'),config[_0x415f('0x17')][_0x415f('0x18')]);var _0x56c23c=_0x30de84[_0x415f('0x1d')](_0x1c66f1,_0x415f('0x19'),'utf8');_0x56c23c+=_0x30de84['final']('utf8');return _0x56c23c;}function sendJiraAlert(_0x4f2a9f,_0x356349,_0x5d4ea7){var _0x1b8802='||FIELD||VALUE||\x0a';return db[_0x415f('0x1e')][_0x415f('0x1f')]({'where':{'role':_0x415f('0x20')},'attributes':[_0x415f('0x21'),_0x415f('0x22')],'raw':!![]})[_0x415f('0x23')](function(_0x5f5dd4){ADMIN=_0x5f5dd4;_0x1b8802+='|reason|'+_0x5d4ea7+'|\x0a';_0x1b8802+='|uuid|'+_0x4f2a9f+'|\x0a';_0x1b8802+=_0x415f('0x24')+_0x356349+'|\x0a';_0x1b8802+=_0x415f('0x25')+ADMIN[_0x415f('0x21')]+'|\x0a';_0x1b8802+='|email|'+ADMIN[_0x415f('0x22')]+'|\x0a';return _0x1b8802;})['then'](function(_0x3ae683){var _0x30344c=hardware[_0x415f('0x26')]()[_0x415f('0x27')];return jira['openIssue']({'key':_0x415f('0x28'),'summary':'Motion\x20License\x20Alert','description':_0x3ae683,'issuetype':_0x415f('0x29'),'oldToken':_0x4f2a9f,'newToken':_0x356349,'email':ADMIN['email'],'name':ADMIN[_0x415f('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x30344c});});}function manageLicense(_0x50b3ee,_0x4ffe5d){var _0x3b84db=_0x4ffe5d[_0x415f('0x2a')]({'plain':!![]});httpRequest(_0x50b3ee)[_0x415f('0x23')](function(_0x33a4e4){if(_0x33a4e4[_0x415f('0x2b')]){if(!_0x3b84db[_0x415f('0x9')]&&_0x3b84db[_0x415f('0x9')]!=_0x33a4e4[_0x415f('0x9')]||_0x3b84db['license']&&_0x3b84db[_0x415f('0x2c')]){logger[_0x415f('0x2d')](_0x415f('0x2e'));}if(_0x3b84db[_0x415f('0x9')]&&!_0x3b84db['data2']&&_0x3b84db[_0x415f('0x9')]!=_0x33a4e4[_0x415f('0x9')]){logger['info'](_0x415f('0x2f'));}if(_0x3b84db[_0x415f('0x9')]&&!_0x3b84db[_0x415f('0x2c')]&&_0x3b84db[_0x415f('0x9')]==_0x33a4e4[_0x415f('0x9')]){return _0x4ffe5d;}return _0x4ffe5d[_0x415f('0x1d')]({'data1':_0x50b3ee,'data2':null,'license':_0x33a4e4[_0x415f('0x9')]});}else{if(_0x33a4e4[_0x415f('0x9')]||_0x3b84db[_0x415f('0x9')]){if(!_0x3b84db['data2']){if(_0x3b84db[_0x415f('0x30')]==_0x50b3ee){GRAY_PERIOD_REASON='Disabled';logger[_0x415f('0x2d')](_0x415f('0x31'));}else{GRAY_PERIOD_REASON=_0x415f('0x32');logger['info'](_0x415f('0x33'),_0x3b84db[_0x415f('0x30')],_0x50b3ee);}sendJiraAlert(_0x3b84db[_0x415f('0x30')],_0x33a4e4[_0x415f('0x34')],GRAY_PERIOD_REASON);logger[_0x415f('0x2d')](_0x415f('0x35'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x415f('0xc')](_0x415f('0x36')));return _0x4ffe5d['update']({'data2':encryptDate(moment()[_0x415f('0xc')](_0x415f('0x36')))});}else{if(moment()[_0x415f('0x37')](decryptDate(_0x3b84db['data2']),_0x415f('0x38'))>DAYS){logger['info'](_0x415f('0x39'),moment()[_0x415f('0xc')](_0x415f('0x36')));return _0x4ffe5d['update']({'data1':_0x50b3ee,'data2':null,'license':null});}}}else{if(_0x3b84db[_0x415f('0x30')]!=_0x50b3ee){logger[_0x415f('0x2d')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3b84db[_0x415f('0x30')],_0x50b3ee);return _0x4ffe5d[_0x415f('0x1d')]({'data1':_0x50b3ee,'data2':null,'license':null});}}}return _0x4ffe5d;})[_0x415f('0x23')](function(_0x3b915c){_0x4ffe5d=_0x3b915c;})[_0x415f('0x3a')](function(_0x3eefb9){logger[_0x415f('0x15')](_0x3eefb9['message']);})[_0x415f('0x3b')](function(){setTimeout(function(){manageLicense(hardware[_0x415f('0x3c')](),_0x4ffe5d);},TIME);});}function defaultLicense(){var _0x1288e1=hardware[_0x415f('0x3c')]();if(_0x1288e1){return db[_0x415f('0x3d')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x1288e1}})[_0x415f('0x3e')](function(_0x150f03,_0x456cd9){logger[_0x415f('0x2d')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x1288e1);manageLicense(_0x1288e1,_0x150f03);})['catch'](function(_0x4738be){logger['error'](_0x4738be[_0x415f('0x3f')]);});}}exports[_0x415f('0x40')]=defaultLicense; \ No newline at end of file +var _0x54fc=['base64','final','createDecipher','secrets','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|','then','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','days','YYYY-MM-DD\x20HH:mm','catch','error','finally','getUuid','License','findOrCreate','message','default','https','crypto','moment','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','../../api/jira/jira.controller','www.xcallymotion.com','format','/api/servers/%s/check?version=%s','GET','application/json','request','setEncoding','utf8','data','end','parse','createCipher','aes-256-ctr','session'];(function(_0x189e79,_0x5e8260){var _0x52d4d3=function(_0x489cd7){while(--_0x489cd7){_0x189e79['push'](_0x189e79['shift']());}};_0x52d4d3(++_0x5e8260);}(_0x54fc,0x167));var _0xc54f=function(_0x432876,_0xe2266a){_0x432876=_0x432876-0x0;var _0x5c5dd1=_0x54fc[_0x432876];return _0x5c5dd1;};'use strict';var util=require('util');var https=require(_0xc54f('0x0'));var crypto=require(_0xc54f('0x1'));var moment=require(_0xc54f('0x2'));var BPromise=require(_0xc54f('0x3'));var pkginfo=require(_0xc54f('0x4'))(module,_0xc54f('0x5'));var db=require(_0xc54f('0x6'))['db'];var config=require('../environment');var hardware=require(_0xc54f('0x7'));var logger=require(_0xc54f('0x8'))(_0xc54f('0x9'));var jira=require(_0xc54f('0xa'));var HOST=_0xc54f('0xb');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;function httpRequest(_0x4023e1){return new BPromise(function(_0x2a7a34,_0x25886a){var _0x3fdc3a={'host':HOST,'port':0x1bb,'path':util[_0xc54f('0xc')](_0xc54f('0xd'),_0x4023e1,module['exports'][_0xc54f('0x5')]),'method':_0xc54f('0xe'),'timeout':0xea60,'headers':{'Content-Type':_0xc54f('0xf')}};var _0x156e27=https[_0xc54f('0x10')](_0x3fdc3a,function(_0x766faa){_0x766faa[_0xc54f('0x11')](_0xc54f('0x12'));var _0x2b2033='';_0x766faa['on'](_0xc54f('0x13'),function(_0x1b560b){_0x2b2033+=_0x1b560b;});_0x766faa['on'](_0xc54f('0x14'),function(){try{_0x2a7a34(JSON[_0xc54f('0x15')](_0x2b2033));}catch(_0x35e742){_0x25886a(_0x35e742);}});});_0x156e27['on']('error',_0x25886a);_0x156e27[_0xc54f('0x14')]();});}function encryptDate(_0x45b900){var _0xab6758=crypto[_0xc54f('0x16')](_0xc54f('0x17'),config['secrets'][_0xc54f('0x18')]);var _0x5cf1d7=_0xab6758['update'](_0x45b900,_0xc54f('0x12'),_0xc54f('0x19'));_0x5cf1d7+=_0xab6758[_0xc54f('0x1a')](_0xc54f('0x19'));return _0x5cf1d7;}function decryptDate(_0x370eff){var _0x1a5ae0=crypto[_0xc54f('0x1b')](_0xc54f('0x17'),config[_0xc54f('0x1c')]['session']);var _0xc30e0e=_0x1a5ae0['update'](_0x370eff,'base64',_0xc54f('0x12'));_0xc30e0e+=_0x1a5ae0[_0xc54f('0x1a')](_0xc54f('0x12'));return _0xc30e0e;}function sendJiraAlert(_0x3f72fc,_0x2f141f,_0x1decaf){var _0x4bcdcc=_0xc54f('0x1d');return db[_0xc54f('0x1e')][_0xc54f('0x1f')]({'where':{'role':_0xc54f('0x20')},'attributes':[_0xc54f('0x21'),_0xc54f('0x22')],'raw':!![]})['then'](function(_0x125102){ADMIN=_0x125102;_0x4bcdcc+=_0xc54f('0x23')+_0x1decaf+'|\x0a';_0x4bcdcc+=_0xc54f('0x24')+_0x3f72fc+'|\x0a';_0x4bcdcc+=_0xc54f('0x25')+_0x2f141f+'|\x0a';_0x4bcdcc+=_0xc54f('0x26')+ADMIN[_0xc54f('0x21')]+'|\x0a';_0x4bcdcc+=_0xc54f('0x27')+ADMIN[_0xc54f('0x22')]+'|\x0a';return _0x4bcdcc;})[_0xc54f('0x28')](function(_0x17dfc3){var _0x1938dc=hardware['getFirstInterface']()[_0xc54f('0x29')];return jira[_0xc54f('0x2a')]({'key':_0xc54f('0x2b'),'summary':_0xc54f('0x2c'),'description':_0x17dfc3,'issuetype':'Alert','oldToken':_0x3f72fc,'newToken':_0x2f141f,'email':ADMIN[_0xc54f('0x22')],'name':ADMIN[_0xc54f('0x21')],'reason':GRAY_PERIOD_REASON,'ip':_0x1938dc});});}function manageLicense(_0x4ecb9f,_0x3827bc){var _0x166a3c=_0x3827bc[_0xc54f('0x2d')]({'plain':!![]});httpRequest(_0x4ecb9f)['then'](function(_0x59e94c){if(_0x59e94c['active']){if(!_0x166a3c[_0xc54f('0x9')]&&_0x166a3c[_0xc54f('0x9')]!=_0x59e94c['license']||_0x166a3c[_0xc54f('0x9')]&&_0x166a3c[_0xc54f('0x2e')]){logger[_0xc54f('0x2f')](_0xc54f('0x30'));}if(_0x166a3c['license']&&!_0x166a3c['data2']&&_0x166a3c[_0xc54f('0x9')]!=_0x59e94c[_0xc54f('0x9')]){logger['info'](_0xc54f('0x31'));}if(_0x166a3c['license']&&!_0x166a3c[_0xc54f('0x2e')]&&_0x166a3c[_0xc54f('0x9')]==_0x59e94c[_0xc54f('0x9')]){return _0x3827bc;}return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':_0x59e94c[_0xc54f('0x9')]});}else{if(_0x59e94c['license']||_0x166a3c[_0xc54f('0x9')]){if(!_0x166a3c[_0xc54f('0x2e')]){if(_0x166a3c[_0xc54f('0x33')]==_0x4ecb9f){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger['info']('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x166a3c[_0xc54f('0x33')],_0x4ecb9f);}sendJiraAlert(_0x166a3c['data1'],_0x59e94c['uuid'],GRAY_PERIOD_REASON);logger[_0xc54f('0x2f')](_0xc54f('0x34'),GRAY_PERIOD_REASON[_0xc54f('0x35')](),moment()[_0xc54f('0xc')]('YYYY-MM-DD\x20HH:mm'));return _0x3827bc[_0xc54f('0x32')]({'data2':encryptDate(moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](decryptDate(_0x166a3c[_0xc54f('0x2e')]),_0xc54f('0x36'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0xc54f('0xc')](_0xc54f('0x37')));return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':null});}}}else{if(_0x166a3c[_0xc54f('0x33')]!=_0x4ecb9f){logger[_0xc54f('0x2f')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x166a3c[_0xc54f('0x33')],_0x4ecb9f);return _0x3827bc[_0xc54f('0x32')]({'data1':_0x4ecb9f,'data2':null,'license':null});}}}return _0x3827bc;})['then'](function(_0x4dcd11){_0x3827bc=_0x4dcd11;})[_0xc54f('0x38')](function(_0x51622a){logger[_0xc54f('0x39')](_0x51622a['message']);})[_0xc54f('0x3a')](function(){setTimeout(function(){manageLicense(hardware[_0xc54f('0x3b')](),_0x3827bc);},TIME);});}function defaultLicense(){var _0x50092a=hardware[_0xc54f('0x3b')]();if(_0x50092a){return db[_0xc54f('0x3c')][_0xc54f('0x3d')]({'where':{'id':0x1},'defaults':{'data1':_0x50092a}})['spread'](function(_0x190360,_0x37d21f){logger['info']('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x50092a);manageLicense(_0x50092a,_0x190360);})[_0xc54f('0x38')](function(_0x2946a2){logger[_0xc54f('0x39')](_0x2946a2[_0xc54f('0x3e')]);});}}exports[_0xc54f('0x3f')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index ae6c979..6245857 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 _0xcc64=['machineUuid','getUuid','gray','deadline','add','grayReason','changed','2027-01-01T00:00:00.000Z','Breaking\x20license','message','Demo\x20license','getLicense','License','defaults','then','checkLicense','util','lodash','moment','../environment','license','isEmpty','data1','data2','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','uuid'];(function(_0x292dee,_0x48456b){var _0x2ff214=function(_0x436c40){while(--_0x436c40){_0x292dee['push'](_0x292dee['shift']());}};_0x2ff214(++_0x48456b);}(_0xcc64,0x142));var _0x4cc6=function(_0x172bba,_0x4b0e1d){_0x172bba=_0x172bba-0x0;var _0x3bcf8a=_0xcc64[_0x172bba];return _0x3bcf8a;};'use strict';var crypto=require('crypto');var util=require(_0x4cc6('0x0'));var _=require(_0x4cc6('0x1'));var moment=require(_0x4cc6('0x2'));var hardware=require('./hardware');var config=require(_0x4cc6('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x261053,_0x37f748){if(_0x261053){try{var _0x4c9d31=_0x37f748||_0x261053[_0x4cc6('0x4')];if(_[_0x4cc6('0x5')](_0x4c9d31)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x3c5197=_0x261053[_0x4cc6('0x6')];var _0x1f9b56=_0x261053[_0x4cc6('0x7')];var _0x2ce841=_0x3c5197['split']('-')[0x4];var _0x51b35b=_0x3c5197[_0x4cc6('0x8')]('-')[0x0];var _0x22b2f7=crypto[_0x4cc6('0x9')](_0x4cc6('0xa'),util[_0x4cc6('0xb')](_0x4cc6('0xc'),_0x2ce841,_0x3c5197,_0x51b35b));var _0x345279=_0x22b2f7[_0x4cc6('0xd')](_0x4c9d31,_0x4cc6('0xe'),_0x4cc6('0xf'));_0x345279+=_0x22b2f7[_0x4cc6('0x10')](_0x4cc6('0xf'));var _0x118950=JSON['parse'](_0x345279);_0x118950['demo']=![];_0x118950[_0x4cc6('0x11')]=_0x3c5197;_0x118950[_0x4cc6('0x12')]=hardware[_0x4cc6('0x13')]();if(_0x1f9b56){var _0x5e76fd=crypto[_0x4cc6('0x9')](_0x4cc6('0xa'),config['secrets']['session']);var _0x28fcbc=_0x5e76fd[_0x4cc6('0xd')](_0x1f9b56,'base64',_0x4cc6('0xf'));_0x28fcbc+=_0x5e76fd[_0x4cc6('0x10')](_0x4cc6('0xf'));_0x118950[_0x4cc6('0x14')]=_0x28fcbc;_0x118950[_0x4cc6('0x15')]=moment(_0x28fcbc)[_0x4cc6('0x16')](0x7,'days')[_0x4cc6('0xb')]();_0x118950[_0x4cc6('0x17')]=_0x118950[_0x4cc6('0x11')]!=_0x118950[_0x4cc6('0x12')]?_0x4cc6('0x18'):'disabled';}return _0x118950;}catch(_0x2a96f8){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4cc6('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4cc6('0x1a'),'uuid':_0x261053[_0x4cc6('0x6')],'machineUuid':hardware[_0x4cc6('0x13')](),'message':_0x2a96f8[_0x4cc6('0x1b')],'virtual':0x0,'voice':!![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x4cc6('0x19'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x4cc6('0x1c'),'uuid':_0x261053[_0x4cc6('0x6')],'machineUuid':hardware[_0x4cc6('0x13')](),'virtual':0x0,'voice':!![]};}exports[_0x4cc6('0x1d')]=function(_0x215e58){return db[_0x4cc6('0x1e')]['find'](_[_0x4cc6('0x1f')](_0x215e58,{'raw':!![],'where':{'id':0x1}}))[_0x4cc6('0x20')](function(_0x1498b9){return checkLicense(_0x1498b9,null);});};exports[_0x4cc6('0x21')]=checkLicense; \ No newline at end of file +var _0x06b4=['data1','data2','split','format','%s:%s:%s','update','base64','utf8','parse','demo','uuid','getUuid','createDecipher','aes-256-ctr','secrets','session','gray','deadline','add','grayReason','machineUuid','disabled','Breaking\x20license','message','Demo\x20license','getLicense','License','find','defaults','then','crypto','moment','./hardware','../environment','isEmpty','License\x20key\x20value\x20not\x20found'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0x06b4,0x11a));var _0x406b=function(_0x2fd423,_0x1fc9ee){_0x2fd423=_0x2fd423-0x0;var _0x45ceb7=_0x06b4[_0x2fd423];return _0x45ceb7;};'use strict';var crypto=require(_0x406b('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x406b('0x1'));var hardware=require(_0x406b('0x2'));var config=require(_0x406b('0x3'));var db=require('../../mysqldb')['db'];function checkLicense(_0x516670,_0x303d2d){if(_0x516670){try{var _0x30f3e9=_0x303d2d||_0x516670['license'];if(_[_0x406b('0x4')](_0x30f3e9)){throw new Error(_0x406b('0x5'));}var _0x55b28f=_0x516670[_0x406b('0x6')];var _0x489351=_0x516670[_0x406b('0x7')];var _0x27bbb6=_0x55b28f[_0x406b('0x8')]('-')[0x4];var _0x3094d4=_0x55b28f[_0x406b('0x8')]('-')[0x0];var _0x1fa07e=crypto['createDecipher']('aes-256-ctr',util[_0x406b('0x9')](_0x406b('0xa'),_0x27bbb6,_0x55b28f,_0x3094d4));var _0x2b2982=_0x1fa07e[_0x406b('0xb')](_0x30f3e9,_0x406b('0xc'),_0x406b('0xd'));_0x2b2982+=_0x1fa07e['final'](_0x406b('0xd'));var _0xdc3ec6=JSON[_0x406b('0xe')](_0x2b2982);_0xdc3ec6[_0x406b('0xf')]=![];_0xdc3ec6[_0x406b('0x10')]=_0x55b28f;_0xdc3ec6['machineUuid']=hardware[_0x406b('0x11')]();if(_0x489351){var _0x1a9117=crypto[_0x406b('0x12')](_0x406b('0x13'),config[_0x406b('0x14')][_0x406b('0x15')]);var _0x40ec96=_0x1a9117[_0x406b('0xb')](_0x489351,_0x406b('0xc'),_0x406b('0xd'));_0x40ec96+=_0x1a9117['final'](_0x406b('0xd'));_0xdc3ec6[_0x406b('0x16')]=_0x40ec96;_0xdc3ec6[_0x406b('0x17')]=moment(_0x40ec96)[_0x406b('0x18')](0x7,'days')[_0x406b('0x9')]();_0xdc3ec6[_0x406b('0x19')]=_0xdc3ec6['uuid']!=_0xdc3ec6[_0x406b('0x1a')]?'changed':_0x406b('0x1b');}return _0xdc3ec6;}catch(_0x5f357d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x406b('0x1c'),'uuid':_0x516670['data1'],'machineUuid':hardware[_0x406b('0x11')](),'message':_0x5f357d[_0x406b('0x1d')],'virtual':0x0,'voice':!![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x406b('0x1e'),'uuid':_0x516670[_0x406b('0x6')],'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![]};}exports[_0x406b('0x1f')]=function(_0x65e300){return db[_0x406b('0x20')][_0x406b('0x21')](_[_0x406b('0x22')](_0x65e300,{'raw':!![],'where':{'id':0x1}}))[_0x406b('0x23')](function(_0x576402){return checkLicense(_0x576402,null);});};exports['checkLicense']=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index acf3874..3feba1a 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 _0x6c50=['exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x27f664,_0x28be85){var _0x2ee34c=function(_0x18731d){while(--_0x18731d){_0x27f664['push'](_0x27f664['shift']());}};_0x2ee34c(++_0x28be85);}(_0x6c50,0xa4));var _0x06c5=function(_0x31457d,_0x362568){_0x31457d=_0x31457d-0x0;var _0x203aae=_0x6c50[_0x31457d];return _0x203aae;};'use strict';module[_0x06c5('0x0')]={'DOMAIN':_0x06c5('0x1'),'SESSION_SECRET':_0x06c5('0x2'),'GOOGLE_ID':_0x06c5('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x4d46=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d46,0x197));var _0x64d4=function(_0x51fdbd,_0x43975b){_0x51fdbd=_0x51fdbd-0x0;var _0x91cee5=_0x4d46[_0x51fdbd];return _0x91cee5;};'use strict';module[_0x64d4('0x0')]={'DOMAIN':_0x64d4('0x1'),'SESSION_SECRET':_0x64d4('0x2'),'GOOGLE_ID':_0x64d4('0x3'),'GOOGLE_SECRET':_0x64d4('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index fb8a882..9032a1a 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5f3=['winston','util','path','INFO','join','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','File','%s-%s','error','info','transports','Console','env','moment'];(function(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0xb5f3,0xaf));var _0x3b5f=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0xb5f3[_0x2df507];return _0x1f7167;};'use strict';var moment=require(_0x3b5f('0x0'));var winston=require(_0x3b5f('0x1'));var util=require(_0x3b5f('0x2'));var path=require(_0x3b5f('0x3'));var debugLevel=_0x3b5f('0x4');function filename(_0x2a90a2,_0x220c28){return path[_0x3b5f('0x5')]('/var','log',_0x3b5f('0x6'),util[_0x3b5f('0x7')](_0x3b5f('0x8'),_0x2a90a2,_0x220c28));}function formatter(_0x33de37,_0x2b595b){return util['format'](_0x3b5f('0x9'),moment()[_0x3b5f('0x7')](_0x3b5f('0xa')),_0x2b595b[_0x3b5f('0xb')][_0x3b5f('0xc')](),_0x33de37,_0x2b595b['message']);}module[_0x3b5f('0xd')]=function(_0x1d60d0){return new winston[(_0x3b5f('0xe'))]({'transports':[new winston['transports'][(_0x3b5f('0xf'))]({'name':util[_0x3b5f('0x7')](_0x3b5f('0x10'),_0x1d60d0,'error'),'filename':filename(_0x1d60d0,_0x3b5f('0x11')),'level':_0x3b5f('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5105ba){return formatter(_0x1d60d0,_0x5105ba);}}),new winston['transports'][(_0x3b5f('0xf'))]({'name':util[_0x3b5f('0x7')](_0x3b5f('0x10'),_0x1d60d0,_0x3b5f('0x12')),'filename':filename(_0x1d60d0,_0x3b5f('0x12')),'level':_0x3b5f('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ae4d7){return formatter(_0x1d60d0,_0x2ae4d7);}}),new winston[(_0x3b5f('0x13'))][(_0x3b5f('0x14'))]({'level':process[_0x3b5f('0x15')]['debugLevel']||debugLevel,'json':![],'formatter':function(_0x424ab2){return formatter(_0x1d60d0,_0x424ab2);}})]});}; \ No newline at end of file +var _0xc992=['path','INFO','join','/var','log','xcally','format','%s-%s.log','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','util'];(function(_0xaed9db,_0x22412f){var _0x1b2dc9=function(_0x38e603){while(--_0x38e603){_0xaed9db['push'](_0xaed9db['shift']());}};_0x1b2dc9(++_0x22412f);}(_0xc992,0x106));var _0x2c99=function(_0x7325f3,_0x4c8836){_0x7325f3=_0x7325f3-0x0;var _0x4f5b5c=_0xc992[_0x7325f3];return _0x4f5b5c;};'use strict';var moment=require(_0x2c99('0x0'));var winston=require('winston');var util=require(_0x2c99('0x1'));var path=require(_0x2c99('0x2'));var debugLevel=_0x2c99('0x3');function filename(_0x44d539,_0x3596f6){return path[_0x2c99('0x4')](_0x2c99('0x5'),_0x2c99('0x6'),_0x2c99('0x7'),util[_0x2c99('0x8')](_0x2c99('0x9'),_0x44d539,_0x3596f6));}function formatter(_0x47fea9,_0x2f7493){return util['format'](_0x2c99('0xa'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x2f7493[_0x2c99('0xb')][_0x2c99('0xc')](),_0x47fea9,_0x2f7493[_0x2c99('0xd')]);}module[_0x2c99('0xe')]=function(_0x432c01){return new winston[(_0x2c99('0xf'))]({'transports':[new winston[(_0x2c99('0x10'))][(_0x2c99('0x11'))]({'name':util[_0x2c99('0x8')](_0x2c99('0x12'),_0x432c01,_0x2c99('0x13')),'filename':filename(_0x432c01,_0x2c99('0x13')),'level':_0x2c99('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x28c9c9){return formatter(_0x432c01,_0x28c9c9);}}),new winston[(_0x2c99('0x10'))][(_0x2c99('0x11'))]({'name':util[_0x2c99('0x8')](_0x2c99('0x12'),_0x432c01,_0x2c99('0x14')),'filename':filename(_0x432c01,'info'),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x225509){return formatter(_0x432c01,_0x225509);}}),new winston[(_0x2c99('0x10'))][(_0x2c99('0x15'))]({'level':process[_0x2c99('0x16')][_0x2c99('0x17')]||debugLevel,'json':![],'formatter':function(_0x10a7b0){return formatter(_0x432c01,_0x10a7b0);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index a4f4971..583cae7 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 _0x1bf2=['path','express','../../services/express/index.js','join','../../services/ami/index.js','agi','../../services/agi/index.js','email','routing','exports'];(function(_0x218332,_0x496e30){var _0x59a466=function(_0x27760d){while(--_0x27760d){_0x218332['push'](_0x218332['shift']());}};_0x59a466(++_0x496e30);}(_0x1bf2,0x6e));var _0x21bf=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x1bf2[_0xd1d19a];return _0x52a79d;};'use strict';var path=require(_0x21bf('0x0'));var os=require('os');var config={'apps':[{'name':_0x21bf('0x1'),'script':path['join'](__dirname,_0x21bf('0x2'))},{'name':'ami','script':path[_0x21bf('0x3')](__dirname,_0x21bf('0x4'))},{'name':_0x21bf('0x5'),'script':path[_0x21bf('0x3')](__dirname,_0x21bf('0x6'))},{'name':_0x21bf('0x7'),'script':path['join'](__dirname,'../../services/email/index.js')},{'name':_0x21bf('0x8'),'script':path[_0x21bf('0x3')](__dirname,'../../services/routing/index.js')}]};module[_0x21bf('0x9')]=config; \ No newline at end of file +var _0x5195=['join','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','../../services/routing/index.js','path','express','../../services/express/index.js'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5195,0xf9));var _0x5519=function(_0x7e557a,_0x3e41ab){_0x7e557a=_0x7e557a-0x0;var _0x3aba18=_0x5195[_0x7e557a];return _0x3aba18;};'use strict';var path=require(_0x5519('0x0'));var os=require('os');var config={'apps':[{'name':_0x5519('0x1'),'script':path['join'](__dirname,_0x5519('0x2'))},{'name':'ami','script':path[_0x5519('0x3')](__dirname,_0x5519('0x4'))},{'name':'agi','script':path[_0x5519('0x3')](__dirname,_0x5519('0x5'))},{'name':'email','script':path[_0x5519('0x3')](__dirname,_0x5519('0x6'))},{'name':_0x5519('0x7'),'script':path[_0x5519('0x3')](__dirname,_0x5519('0x8'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ea1cac7..38bfac7 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 _0x9957=['stop','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','start','then'];(function(_0x4c2623,_0x4838bb){var _0x2be431=function(_0x55829d){while(--_0x55829d){_0x4c2623['push'](_0x4c2623['shift']());}};_0x2be431(++_0x4838bb);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var pm2=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var config=require(_0x7995('0x2'));function connect(){return new BPromise(function(_0x10a05d,_0x5b96eb){return pm2[_0x7995('0x3')](function(_0x3c58eb){if(_0x3c58eb){return _0x5b96eb(_0x3c58eb);}return _0x10a05d(_0x7995('0x4'));});});};exports[_0x7995('0x5')]=function(_0x576d89){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1a36d8,_0x137b6b){return pm2[_0x7995('0x5')](_0x576d89,function(_0xbda126,_0x326741){if(_0xbda126){return _0x137b6b(_0xbda126);}pm2['disconnect']();return _0x1a36d8(_0x326741);});});});};exports[_0x7995('0x7')]=function(_0x1cad37){return connect()['then'](function(){return new BPromise(function(_0xa2e5f0,_0x3116fb){return pm2[_0x7995('0x7')](_0x1cad37,function(_0x35b5fe,_0x3c1d19){if(_0x35b5fe){return _0x3116fb(_0x35b5fe);}pm2[_0x7995('0x8')]();return _0xa2e5f0(_0x3c1d19);});});});};exports[_0x7995('0x9')]=function(_0x524f7b){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x41c652,_0x581f22){return pm2[_0x7995('0x9')](_0x524f7b,function(_0x2cb37a,_0x19a27e){if(_0x2cb37a){return _0x581f22(_0x2cb37a);}pm2[_0x7995('0x8')]();return _0x41c652(_0x19a27e);});});});};exports[_0x7995('0xa')]=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2bbe7a,_0x4cc004){return pm2['list'](function(_0x2b4e94,_0x2233dd){if(_0x2b4e94){return _0x4cc004(_0x2b4e94);}pm2[_0x7995('0x8')]();return _0x2bbe7a(_0x2233dd);});});});};exports[_0x7995('0xb')]=function(_0x3f1d3e){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x2202ce,_0x41cbf0){return pm2['describe'](_0x3f1d3e,function(_0x2eeacc,_0x565d97){if(_0x2eeacc){return _0x41cbf0(_0x2eeacc);}pm2[_0x7995('0x8')]();return _0x2202ce(_0x565d97);});});});};exports[_0x7995('0xc')]=function(_0x43d4b8){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x1e1415,_0x37a7d4){return pm2['delete'](_0x43d4b8,function(_0x54c9ae,_0x2536c8){if(_0x54c9ae){return _0x37a7d4(_0x54c9ae);}pm2['disconnect']();return _0x1e1415(_0x2536c8);});});});};exports['dump']=function(){return connect()[_0x7995('0x6')](function(){return new BPromise(function(_0x3d463e,_0x4cbe10){return pm2[_0x7995('0xd')](function(_0x51f276){if(_0x51f276){return _0x4cbe10(_0x51f276);}return _0x3d463e('saved');});});});}; \ No newline at end of file +var _0x3e74=['saved','pm2','./config','connected','then','start','disconnect','stop','list','describe','delete','dump'];(function(_0x5bfbb2,_0x3d0c99){var _0xac7867=function(_0x2b7b61){while(--_0x2b7b61){_0x5bfbb2['push'](_0x5bfbb2['shift']());}};_0xac7867(++_0x3d0c99);}(_0x3e74,0x175));var _0x43e7=function(_0x54688c,_0x4b82ec){_0x54688c=_0x54688c-0x0;var _0x4cc367=_0x3e74[_0x54688c];return _0x4cc367;};'use strict';var pm2=require(_0x43e7('0x0'));var BPromise=require('bluebird');var config=require(_0x43e7('0x1'));function connect(){return new BPromise(function(_0x287a1d,_0x151ad2){return pm2['connect'](function(_0x490ced){if(_0x490ced){return _0x151ad2(_0x490ced);}return _0x287a1d(_0x43e7('0x2'));});});};exports['start']=function(_0x128b0f){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xe78cb7,_0x1c503b){return pm2[_0x43e7('0x4')](_0x128b0f,function(_0x503698,_0x45a0d1){if(_0x503698){return _0x1c503b(_0x503698);}pm2[_0x43e7('0x5')]();return _0xe78cb7(_0x45a0d1);});});});};exports[_0x43e7('0x6')]=function(_0x8528fc){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x516b4d,_0x212c6c){return pm2['stop'](_0x8528fc,function(_0x54948c,_0x39c8bd){if(_0x54948c){return _0x212c6c(_0x54948c);}pm2[_0x43e7('0x5')]();return _0x516b4d(_0x39c8bd);});});});};exports['restart']=function(_0x2803d9){return connect()['then'](function(){return new BPromise(function(_0xf7c520,_0x37302c){return pm2['restart'](_0x2803d9,function(_0x3eb206,_0xc960ea){if(_0x3eb206){return _0x37302c(_0x3eb206);}pm2[_0x43e7('0x5')]();return _0xf7c520(_0xc960ea);});});});};exports[_0x43e7('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x583d85,_0x2fcb36){return pm2[_0x43e7('0x7')](function(_0x44b0bd,_0x51b974){if(_0x44b0bd){return _0x2fcb36(_0x44b0bd);}pm2['disconnect']();return _0x583d85(_0x51b974);});});});};exports[_0x43e7('0x8')]=function(_0x14c146){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x328445,_0x4de324){return pm2['describe'](_0x14c146,function(_0xdf16c,_0x264575){if(_0xdf16c){return _0x4de324(_0xdf16c);}pm2[_0x43e7('0x5')]();return _0x328445(_0x264575);});});});};exports['delete']=function(_0x4b5a6b){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0x1ca758,_0x9037d3){return pm2[_0x43e7('0x9')](_0x4b5a6b,function(_0x3776f5,_0x1f24fb){if(_0x3776f5){return _0x9037d3(_0x3776f5);}pm2[_0x43e7('0x5')]();return _0x1ca758(_0x1f24fb);});});});};exports[_0x43e7('0xa')]=function(){return connect()[_0x43e7('0x3')](function(){return new BPromise(function(_0xab63cf,_0x191dd5){return pm2[_0x43e7('0xa')](function(_0x4b5d64){if(_0x4b5d64){return _0x191dd5(_0x4b5d64);}return _0xab63cf(_0x43e7('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5e1168c..f27bb85 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 _0xa8b1=['../../mysqldb','socket.io-emitter','localhost','Setting','find','chatTimeout','lastMsgAt','subtract','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','emit','start','moment'];(function(_0x1ed975,_0xc5d4d9){var _0x5605d4=function(_0x10752b){while(--_0x10752b){_0x1ed975['push'](_0x1ed975['shift']());}};_0x5605d4(++_0xc5d4d9);}(_0xa8b1,0xd7));var _0x1a8b=function(_0x5f5cd5,_0x4c4b8b){_0x5f5cd5=_0x5f5cd5-0x0;var _0x21c1f9=_0xa8b1[_0x5f5cd5];return _0x21c1f9;};'use strict';var _=require('lodash');var moment=require(_0x1a8b('0x0'));var db=require(_0x1a8b('0x1'))['db'];var io=require(_0x1a8b('0x2'))({'host':_0x1a8b('0x3'),'port':0x18eb});function closeInteractions(){var _0x17cccf=0x0;var _0x366ce7=[];return db[_0x1a8b('0x4')][_0x1a8b('0x5')]({'raw':!![],'attributes':['id',_0x1a8b('0x6')],'where':{'id':0x1}})['then'](function(_0x4da80b){_0x17cccf=_0x4da80b[_0x1a8b('0x6')];if(_0x17cccf){return db['ChatInteraction']['findAll']({'raw':!![],'attributes':['id',_0x1a8b('0x7')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x1a8b('0x8')](_0x4da80b['chatTimeout'],'minutes')}}});}else{return[];}})['then'](function(_0x4851a6){_0x366ce7=_0x4851a6;if(_0x17cccf){return db[_0x1a8b('0x9')][_0x1a8b('0xa')]({'closeReason':_0x1a8b('0xb'),'disposition':_0x1a8b('0xc'),'closed':!![],'closedAt':moment()[_0x1a8b('0xd')](_0x1a8b('0xe'))},{'where':{'id':_['map'](_0x366ce7||[],'id')}});}})[_0x1a8b('0xf')](function(_0x36704e){for(var _0x127d78=0x0;_0x127d78<_0x366ce7['length'];_0x127d78++){io[_0x1a8b('0x10')]('chatInteraction:update',{'id':_0x366ce7[_0x127d78]['id'],'closed':!![]});}})['catch'](function(_0x4c44c1){console['error'](_0x4c44c1);});}exports[_0x1a8b('0x11')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xdeb3=['findAll','subtract','minutes','ChatInteraction','update','system','timeout','map','length','emit','chatInteraction:update','catch','moment','../../mysqldb','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xdeb3,0xb7));var _0x3deb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xdeb3[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var moment=require(_0x3deb('0x0'));var db=require(_0x3deb('0x1'))['db'];var io=require(_0x3deb('0x2'))({'host':'localhost','port':0x18eb});function closeInteractions(){var _0x5513ef=0x0;var _0x28d064=[];return db[_0x3deb('0x3')][_0x3deb('0x4')]({'raw':!![],'attributes':['id',_0x3deb('0x5')],'where':{'id':0x1}})[_0x3deb('0x6')](function(_0x4ed534){_0x5513ef=_0x4ed534[_0x3deb('0x5')];if(_0x5513ef){return db['ChatInteraction'][_0x3deb('0x7')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3deb('0x8')](_0x4ed534[_0x3deb('0x5')],_0x3deb('0x9'))}}});}else{return[];}})[_0x3deb('0x6')](function(_0x2eb451){_0x28d064=_0x2eb451;if(_0x5513ef){return db[_0x3deb('0xa')][_0x3deb('0xb')]({'closeReason':_0x3deb('0xc'),'disposition':_0x3deb('0xd'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_[_0x3deb('0xe')](_0x28d064||[],'id')}});}})[_0x3deb('0x6')](function(_0x756238){for(var _0x54c1b3=0x0;_0x54c1b3<_0x28d064[_0x3deb('0xf')];_0x54c1b3++){io[_0x3deb('0x10')](_0x3deb('0x11'),{'id':_0x28d064[_0x54c1b3]['id'],'closed':!![]});}})[_0x3deb('0x12')](function(_0x555a07){console['error'](_0x555a07);});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index fc42f24..ec27648 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 _0xcf9c=['attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','subtractNumber','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','intersection','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add','start','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','port','secure','auth','format','\x22%s\x22\x20<%s>','name','email','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','../../files/reports','%s.%s','savename','extname','zip','join','existsSync','message'];(function(_0x3cf487,_0x5ded17){var _0x1c6600=function(_0x16e7a3){while(--_0x16e7a3){_0x3cf487['push'](_0x3cf487['shift']());}};_0x1c6600(++_0x5ded17);}(_0xcf9c,0x1b5));var _0xccf9=function(_0x14d788,_0x23d92f){_0x14d788=_0x14d788-0x0;var _0xfe3675=_0xcf9c[_0x14d788];return _0xfe3675;};'use strict';var fs=require('fs');var util=require(_0xccf9('0x0'));var path=require(_0xccf9('0x1'));var _=require(_0xccf9('0x2'));var moment=require(_0xccf9('0x3'));var CronJobManager=require(_0xccf9('0x4'));var jayson=require(_0xccf9('0x5'));var BPromise=require(_0xccf9('0x6'));var logger=require(_0xccf9('0x7'))(_0xccf9('0x8'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xccf9('0x9'));var analyticDefaultReportController=require(_0xccf9('0xa'));var client=jayson[_0xccf9('0xb')][_0xccf9('0xc')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xfaa568,_0x5a5fd4){return function(){logger[_0xccf9('0xd')](_0xccf9('0xe'),_0xfaa568['email']);var _0x3c4f96=!![];var _0x217744={'tls':{'rejectUnauthorized':![]}};if(_0xfaa568[_0xccf9('0xf')][_0xccf9('0x10')][_0xccf9('0x11')]){_0x217744[_0xccf9('0x11')]=_0xfaa568['MailAccount'][_0xccf9('0x10')]['service'];}else{_0x217744[_0xccf9('0x12')]=_0xfaa568['MailAccount']['Smtp'][_0xccf9('0x12')];_0x217744[_0xccf9('0x13')]=_0xfaa568[_0xccf9('0xf')][_0xccf9('0x10')][_0xccf9('0x13')];_0x217744[_0xccf9('0x14')]=_0xfaa568[_0xccf9('0xf')]['Smtp']['secure'];}if(_0xfaa568['MailAccount'][_0xccf9('0x10')]['authentication']){_0x217744[_0xccf9('0x15')]={'user':_0xfaa568[_0xccf9('0xf')]['Smtp']['user'],'pass':_0xfaa568[_0xccf9('0xf')]['Smtp']['pass']};}var _0x3fb077={'account':_0x217744,'message':{'from':util[_0xccf9('0x16')](_0xccf9('0x17'),_0xfaa568[_0xccf9('0xf')][_0xccf9('0x18')],_0xfaa568[_0xccf9('0xf')][_0xccf9('0x19')]||_0xfaa568[_0xccf9('0xf')][_0xccf9('0x10')][_0xccf9('0x1a')]),'to':_0xfaa568[_0xccf9('0x19')],'cc':_0xfaa568['cc'],'bcc':_0xfaa568[_0xccf9('0x1b')],'subject':util[_0xccf9('0x16')](_0xccf9('0x1c'),_0x5a5fd4[_0xccf9('0x18')],_0xfaa568['subtractNumber'],_0xfaa568[_0xccf9('0x1d')])}};var _0x4a7b9f=path['join'](__dirname,_0xccf9('0x1e'));var _0x59cadd=_0x5a5fd4['savename'];var _0x6ef0a3=util['format'](_0xccf9('0x1f'),path['basename'](_0x5a5fd4[_0xccf9('0x20')],path[_0xccf9('0x21')](_0x5a5fd4[_0xccf9('0x20')])),_0xccf9('0x22'));var _0x110a4e=path[_0xccf9('0x23')](_0x4a7b9f,_0x59cadd);var _0x1dcdfe=path[_0xccf9('0x23')](_0x4a7b9f,_0x6ef0a3);if(fs[_0xccf9('0x24')](_0x110a4e)){_0x5a5fd4['status']='Sent';_0x3fb077[_0xccf9('0x25')][_0xccf9('0x26')]=[{'filename':_0x59cadd,'path':_0x110a4e}];_0x3fb077[_0xccf9('0x25')][_0xccf9('0x27')]=util['format'](_0xccf9('0x28'),JSON[_0xccf9('0x29')](_0x5a5fd4,null,0x2));}else if(fs[_0xccf9('0x24')](_0x1dcdfe)){_0x5a5fd4['status']=_0xccf9('0x2a');_0x3fb077['message'][_0xccf9('0x26')]=[{'filename':_0x6ef0a3,'path':_0x1dcdfe}];}else{_0x3fb077['message'][_0xccf9('0x27')]=_0xccf9('0x2b');if(!_0xfaa568[_0xccf9('0x2c')]){_0x3c4f96=![];logger[_0xccf9('0xd')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3c4f96){return client[_0xccf9('0x2d')](_0xccf9('0x2e'),_0x3fb077)[_0xccf9('0x2f')](function(_0x11a242){if(_0x11a242[_0xccf9('0x30')]){return logger[_0xccf9('0x30')](_0xccf9('0x31'),JSON[_0xccf9('0x29')](_0x11a242));}return logger[_0xccf9('0xd')](_0xccf9('0x32'));})[_0xccf9('0x33')](function(_0x2c2f59){return logger[_0xccf9('0x30')](_0xccf9('0x31'),JSON[_0xccf9('0x29')](_0x2c2f59));});}};}function handleError(){return function(_0x96485d){return logger[_0xccf9('0x30')](JSON['stringify'](_0x96485d));};}function handleResult(_0x183a0a){return function(_0x26c9ce){logger[_0xccf9('0xd')]('data',JSON[_0xccf9('0x29')](_0x26c9ce));if(_0x183a0a['MailAccount']&&_0x183a0a[_0xccf9('0xf')]['Smtp']&&!_['isNil'](_0x183a0a[_0xccf9('0x19')])){setTimeout(handleSendEmail(_0x183a0a,_0x26c9ce),0x3c*0x3e8);}};}function handleJob(_0x2508e3){return function(){try{if(_['isNil'](_0x2508e3[_0xccf9('0x34')])){return logger[_0xccf9('0xd')](_0xccf9('0x35'));}if(_[_0xccf9('0x36')](_0x2508e3['subtractUnit'])){return logger[_0xccf9('0xd')](_0xccf9('0x37'));}var _0x3c3960={'startDate':moment()[_0xccf9('0x38')](_0x2508e3[_0xccf9('0x34')],_0x2508e3[_0xccf9('0x1d')])['format'](_0xccf9('0x39')),'endDate':moment()[_0xccf9('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xccf9('0x3a'),'output':_0x2508e3['output'],'name':_0x2508e3[_0xccf9('0x18')]};if(!_[_0xccf9('0x36')](_0x2508e3[_0xccf9('0x3b')])){logger[_0xccf9('0xd')](_0xccf9('0x3c'),_0x2508e3[_0xccf9('0x3b')]);return analyticDefaultReportController['runReport']({'id':_0x2508e3[_0xccf9('0x3b')]},_0x3c3960)[_0xccf9('0x2f')](handleResult(_0x2508e3))['catch'](handleError());}if(!_[_0xccf9('0x36')](_0x2508e3[_0xccf9('0x3d')])){logger['info'](_0xccf9('0x3e'),_0x2508e3[_0xccf9('0x3d')]);return analyticCustomReportController[_0xccf9('0x3f')]({'id':_0x2508e3[_0xccf9('0x3d')]},_0x3c3960)['then'](handleResult(_0x2508e3))['catch'](handleError());}}catch(_0x31c480){logger[_0xccf9('0x30')](JSON['stringify'](_0x31c480));}return logger[_0xccf9('0xd')](_0xccf9('0x40'));};}function getJobs(_0x2beb5d){var _0x5d3b8f={};if(_0x2beb5d){_0x5d3b8f['id']=_0x2beb5d;}return db[_0xccf9('0x41')][_0xccf9('0x42')]({'where':_0x5d3b8f,'include':[{'model':db[_0xccf9('0xf')],'attributes':['id',_0xccf9('0x18'),'email'],'include':[{'model':db[_0xccf9('0x43')],'as':_0xccf9('0x10')}]}]})['then'](function(_0x42d866){var _0x4c5017=_[_0xccf9('0x44')](manager[_0xccf9('0x45')]);var _0x46b755=_['map'](_0x42d866,function(_0x2c893f){return _0x2c893f['id'][_0xccf9('0x46')]();});var _0x2cc16a=_[_0xccf9('0x47')](_0x42d866,function(_0x96b53e){return _0x96b53e['id'][_0xccf9('0x46')]();});var _0x2516b7=_0x2beb5d?_0x46b755:_[_0xccf9('0x48')](_0x46b755,_0x4c5017);var _0x442c5f=_[_0xccf9('0x49')](_0x46b755,_0x4c5017);var _0x1e0525=_['difference'](_0x4c5017,_0x46b755);var _0x1a4b66;var _0x3311e4;for(_0x1a4b66=0x0;_0x1a4b66<_0x1e0525['length']&&!_0x2beb5d;_0x1a4b66+=0x1){_0x3311e4=_0x1e0525[_0x1a4b66][_0xccf9('0x46')]();if(manager[_0xccf9('0x4a')](_0x3311e4)){manager[_0xccf9('0x4b')](_0x3311e4);manager[_0xccf9('0x4c')](_0x3311e4);logger[_0xccf9('0xd')](_0xccf9('0x4d'),_0x3311e4);}}logger['info'](_0xccf9('0x4e'),JSON[_0xccf9('0x29')](_0x2516b7));for(_0x1a4b66=0x0;_0x1a4b66<_0x2516b7[_0xccf9('0x4f')];_0x1a4b66+=0x1){_0x3311e4=_0x2516b7[_0x1a4b66][_0xccf9('0x46')]();logger[_0xccf9('0xd')](_0xccf9('0x50'),_0x3311e4);if(_0x2beb5d){logger[_0xccf9('0xd')](_0xccf9('0x51'),_0x2beb5d);logger[_0xccf9('0xd')](JSON[_0xccf9('0x29')](_0x2cc16a[_0x3311e4]));BPromise[_0xccf9('0x52')]()[_0xccf9('0x2f')](handleJob(_0x2cc16a[_0x3311e4]));logger[_0xccf9('0xd')](_0xccf9('0x53'),_0x2cc16a[_0x3311e4][_0xccf9('0x18')],_0x2cc16a[_0x3311e4][_0xccf9('0x54')]);}else if(_0x2cc16a[_0x3311e4][_0xccf9('0x54')]&&_0x2cc16a[_0x3311e4][_0xccf9('0x55')]&&moment()[_0xccf9('0x56')](_0x2cc16a[_0x3311e4][_0xccf9('0x57')],_0x2cc16a[_0x3311e4]['endAt'])){manager[_0xccf9('0x58')](_0x3311e4,_0x2cc16a[_0x3311e4][_0xccf9('0x54')],handleJob(_0x2cc16a[_0x3311e4]));manager[_0xccf9('0x59')](_0x3311e4);logger['info'](_0xccf9('0x5a'),_0x2cc16a[_0x3311e4][_0xccf9('0x18')],_0x2cc16a[_0x3311e4][_0xccf9('0x54')]);}else if(manager[_0xccf9('0x4a')](_0x3311e4)){manager[_0xccf9('0x4b')](_0x3311e4);manager['deleteJob'](_0x3311e4);logger['info'](_0xccf9('0x5b'),_0x2cc16a[_0x3311e4][_0xccf9('0x18')],_0x2cc16a[_0x3311e4][_0xccf9('0x54')]);}}for(_0x1a4b66=0x0,_0x3311e4;_0x1a4b66<_0x442c5f[_0xccf9('0x4f')]&&!_0x2beb5d;_0x1a4b66+=0x1){_0x3311e4=_0x442c5f[_0x1a4b66][_0xccf9('0x46')]();if(manager[_0xccf9('0x4a')](_0x3311e4)){if(_0x2cc16a[_0x3311e4]['cron']&&_0x2cc16a[_0x3311e4]['active']&&moment()[_0xccf9('0x56')](_0x2cc16a[_0x3311e4]['startAt'],_0x2cc16a[_0x3311e4]['endAt'])){manager[_0xccf9('0x5c')](_0x3311e4,_0x2cc16a[_0x3311e4]['cron'],handleJob(_0x2cc16a[_0x3311e4]));logger[_0xccf9('0xd')](_0xccf9('0x5d'),_0x2cc16a[_0x3311e4][_0xccf9('0x18')],_0x2cc16a[_0x3311e4][_0xccf9('0x54')]);}else{manager[_0xccf9('0x4b')](_0x3311e4);manager['deleteJob'](_0x3311e4);logger[_0xccf9('0xd')](_0xccf9('0x5b'),_0x2cc16a[_0x3311e4][_0xccf9('0x18')],_0x2cc16a[_0x3311e4][_0xccf9('0x54')]);}}}})[_0xccf9('0x33')](function(_0x5a8f15){logger[_0xccf9('0x30')](JSON[_0xccf9('0x29')](_0x5a8f15));});}exports[_0xccf9('0x5e')]=function(_0x3ffe24){return getJobs(_0x3ffe24);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xf541=['jobs','map','toString','keyBy','intersection','difference','length','exists','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add\x20cron','stop','deleteJob','stop\x20cron','active','update','update\x20cron','run','start','util','path','lodash','jayson/promise','schedule','../../mysqldb','http','info','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','%s.%s','basename','savename','extname','zip','existsSync','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','Schedule','MailServerOut','keys'];(function(_0x13ed1a,_0x265bc2){var _0x4b769b=function(_0x114209){while(--_0x114209){_0x13ed1a['push'](_0x13ed1a['shift']());}};_0x4b769b(++_0x265bc2);}(_0xf541,0x176));var _0x1f54=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0xf541[_0x3616bb];return _0x1c0994;};'use strict';var fs=require('fs');var util=require(_0x1f54('0x0'));var path=require(_0x1f54('0x1'));var _=require(_0x1f54('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x1f54('0x3'));var BPromise=require('bluebird');var logger=require('../logger')(_0x1f54('0x4'));var db=require(_0x1f54('0x5'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x1f54('0x6')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2545cf,_0x2c5fe2){return function(){logger[_0x1f54('0x7')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2545cf[_0x1f54('0x8')]);var _0x5b5152=!![];var _0xb16458={'tls':{'rejectUnauthorized':![]}};if(_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xb')]){_0xb16458[_0x1f54('0xb')]=_0x2545cf['MailAccount']['Smtp'][_0x1f54('0xb')];}else{_0xb16458[_0x1f54('0xc')]=_0x2545cf[_0x1f54('0x9')]['Smtp'][_0x1f54('0xc')];_0xb16458[_0x1f54('0xd')]=_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xd')];_0xb16458[_0x1f54('0xe')]=_0x2545cf['MailAccount'][_0x1f54('0xa')][_0x1f54('0xe')];}if(_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0xf')]){_0xb16458[_0x1f54('0x10')]={'user':_0x2545cf[_0x1f54('0x9')][_0x1f54('0xa')][_0x1f54('0x11')],'pass':_0x2545cf['MailAccount']['Smtp'][_0x1f54('0x12')]};}var _0x3c924c={'account':_0xb16458,'message':{'from':util[_0x1f54('0x13')](_0x1f54('0x14'),_0x2545cf['MailAccount'][_0x1f54('0x15')],_0x2545cf[_0x1f54('0x9')][_0x1f54('0x8')]||_0x2545cf[_0x1f54('0x9')]['Smtp']['user']),'to':_0x2545cf[_0x1f54('0x8')],'cc':_0x2545cf['cc'],'bcc':_0x2545cf[_0x1f54('0x16')],'subject':util[_0x1f54('0x13')](_0x1f54('0x17'),_0x2c5fe2[_0x1f54('0x15')],_0x2545cf[_0x1f54('0x18')],_0x2545cf['subtractUnit'])}};var _0x40ae9b=path[_0x1f54('0x19')](__dirname,_0x1f54('0x1a'));var _0x2b438c=_0x2c5fe2['savename'];var _0x20edbc=util[_0x1f54('0x13')](_0x1f54('0x1b'),path[_0x1f54('0x1c')](_0x2c5fe2[_0x1f54('0x1d')],path[_0x1f54('0x1e')](_0x2c5fe2[_0x1f54('0x1d')])),_0x1f54('0x1f'));var _0x4c696b=path[_0x1f54('0x19')](_0x40ae9b,_0x2b438c);var _0x13f20c=path['join'](_0x40ae9b,_0x20edbc);if(fs[_0x1f54('0x20')](_0x4c696b)){_0x2c5fe2[_0x1f54('0x21')]=_0x1f54('0x22');_0x3c924c['message']['attachments']=[{'filename':_0x2b438c,'path':_0x4c696b}];_0x3c924c[_0x1f54('0x23')][_0x1f54('0x24')]=util[_0x1f54('0x13')](_0x1f54('0x25'),JSON[_0x1f54('0x26')](_0x2c5fe2,null,0x2));}else if(fs['existsSync'](_0x13f20c)){_0x2c5fe2[_0x1f54('0x21')]=_0x1f54('0x22');_0x3c924c[_0x1f54('0x23')]['attachments']=[{'filename':_0x20edbc,'path':_0x13f20c}];}else{_0x3c924c[_0x1f54('0x23')][_0x1f54('0x24')]=_0x1f54('0x27');if(!_0x2545cf['sendIfEmpty']){_0x5b5152=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x5b5152){return client[_0x1f54('0x28')]('SendMail',_0x3c924c)[_0x1f54('0x29')](function(_0x48e216){if(_0x48e216[_0x1f54('0x2a')]){return logger['error'](_0x1f54('0x2b'),JSON[_0x1f54('0x26')](_0x48e216));}return logger[_0x1f54('0x7')](_0x1f54('0x2c'));})[_0x1f54('0x2d')](function(_0x192ec1){return logger[_0x1f54('0x2a')](_0x1f54('0x2b'),JSON[_0x1f54('0x26')](_0x192ec1));});}};}function handleError(){return function(_0x4d7716){return logger[_0x1f54('0x2a')](JSON[_0x1f54('0x26')](_0x4d7716));};}function handleResult(_0x50e037){return function(_0x5498dc){logger[_0x1f54('0x7')](_0x1f54('0x2e'),JSON['stringify'](_0x5498dc));if(_0x50e037['MailAccount']&&_0x50e037[_0x1f54('0x9')][_0x1f54('0xa')]&&!_[_0x1f54('0x2f')](_0x50e037[_0x1f54('0x8')])){setTimeout(handleSendEmail(_0x50e037,_0x5498dc),0x3c*0x3e8);}};}function handleJob(_0x3d660c){return function(){try{if(_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x18')])){return logger['info'](_0x1f54('0x30'));}if(_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x31')])){return logger[_0x1f54('0x7')]('subtractUnit\x20null\x20or\x20undefined');}var _0x4eac64={'startDate':moment()[_0x1f54('0x32')](_0x3d660c[_0x1f54('0x18')],_0x3d660c[_0x1f54('0x31')])[_0x1f54('0x13')](_0x1f54('0x33')),'endDate':moment()[_0x1f54('0x13')](_0x1f54('0x33')),'type':_0x1f54('0x34'),'output':_0x3d660c[_0x1f54('0x35')],'name':_0x3d660c[_0x1f54('0x15')]};if(!_[_0x1f54('0x2f')](_0x3d660c[_0x1f54('0x36')])){logger[_0x1f54('0x7')](_0x1f54('0x37'),_0x3d660c[_0x1f54('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x3d660c[_0x1f54('0x36')]},_0x4eac64)[_0x1f54('0x29')](handleResult(_0x3d660c))[_0x1f54('0x2d')](handleError());}if(!_[_0x1f54('0x2f')](_0x3d660c['CustomReportId'])){logger[_0x1f54('0x7')]('exec\x20custom\x20report\x20id:%s',_0x3d660c[_0x1f54('0x38')]);return analyticCustomReportController[_0x1f54('0x39')]({'id':_0x3d660c[_0x1f54('0x38')]},_0x4eac64)[_0x1f54('0x29')](handleResult(_0x3d660c))[_0x1f54('0x2d')](handleError());}}catch(_0x318aa9){logger[_0x1f54('0x2a')](JSON[_0x1f54('0x26')](_0x318aa9));}return logger[_0x1f54('0x7')]('no\x20report\x20id');};}function getJobs(_0x18d0a2){var _0x1b8ccc={};if(_0x18d0a2){_0x1b8ccc['id']=_0x18d0a2;}return db[_0x1f54('0x3a')]['findAll']({'where':_0x1b8ccc,'include':[{'model':db[_0x1f54('0x9')],'attributes':['id',_0x1f54('0x15'),_0x1f54('0x8')],'include':[{'model':db[_0x1f54('0x3b')],'as':'Smtp'}]}]})['then'](function(_0x1bbb0c){var _0x20fd0a=_[_0x1f54('0x3c')](manager[_0x1f54('0x3d')]);var _0x43feb7=_[_0x1f54('0x3e')](_0x1bbb0c,function(_0x3ea9df){return _0x3ea9df['id'][_0x1f54('0x3f')]();});var _0x253a53=_[_0x1f54('0x40')](_0x1bbb0c,function(_0x4b5016){return _0x4b5016['id']['toString']();});var _0x39a344=_0x18d0a2?_0x43feb7:_['difference'](_0x43feb7,_0x20fd0a);var _0x12112b=_[_0x1f54('0x41')](_0x43feb7,_0x20fd0a);var _0x291d29=_[_0x1f54('0x42')](_0x20fd0a,_0x43feb7);var _0x16bbdf;var _0xb1805d;for(_0x16bbdf=0x0;_0x16bbdf<_0x291d29[_0x1f54('0x43')]&&!_0x18d0a2;_0x16bbdf+=0x1){_0xb1805d=_0x291d29[_0x16bbdf][_0x1f54('0x3f')]();if(manager[_0x1f54('0x44')](_0xb1805d)){manager['stop'](_0xb1805d);manager['deleteJob'](_0xb1805d);logger[_0x1f54('0x7')]('delete\x20cron',_0xb1805d);}}logger[_0x1f54('0x7')](_0x1f54('0x45'),JSON[_0x1f54('0x26')](_0x39a344));for(_0x16bbdf=0x0;_0x16bbdf<_0x39a344[_0x1f54('0x43')];_0x16bbdf+=0x1){_0xb1805d=_0x39a344[_0x16bbdf][_0x1f54('0x3f')]();logger[_0x1f54('0x7')](_0x1f54('0x46'),_0xb1805d);if(_0x18d0a2){logger[_0x1f54('0x7')](_0x1f54('0x47'),_0x18d0a2);logger[_0x1f54('0x7')](JSON['stringify'](_0x253a53[_0xb1805d]));BPromise[_0x1f54('0x48')]()[_0x1f54('0x29')](handleJob(_0x253a53[_0xb1805d]));logger[_0x1f54('0x7')](_0x1f54('0x49'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else if(_0x253a53[_0xb1805d][_0x1f54('0x4a')]&&_0x253a53[_0xb1805d]['active']&&moment()[_0x1f54('0x4b')](_0x253a53[_0xb1805d][_0x1f54('0x4c')],_0x253a53[_0xb1805d][_0x1f54('0x4d')])){manager['add'](_0xb1805d,_0x253a53[_0xb1805d]['cron'],handleJob(_0x253a53[_0xb1805d]));manager['start'](_0xb1805d);logger[_0x1f54('0x7')](_0x1f54('0x4e'),_0x253a53[_0xb1805d]['name'],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else if(manager[_0x1f54('0x44')](_0xb1805d)){manager[_0x1f54('0x4f')](_0xb1805d);manager[_0x1f54('0x50')](_0xb1805d);logger[_0x1f54('0x7')](_0x1f54('0x51'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}}for(_0x16bbdf=0x0,_0xb1805d;_0x16bbdf<_0x12112b[_0x1f54('0x43')]&&!_0x18d0a2;_0x16bbdf+=0x1){_0xb1805d=_0x12112b[_0x16bbdf][_0x1f54('0x3f')]();if(manager[_0x1f54('0x44')](_0xb1805d)){if(_0x253a53[_0xb1805d]['cron']&&_0x253a53[_0xb1805d][_0x1f54('0x52')]&&moment()[_0x1f54('0x4b')](_0x253a53[_0xb1805d][_0x1f54('0x4c')],_0x253a53[_0xb1805d][_0x1f54('0x4d')])){manager[_0x1f54('0x53')](_0xb1805d,_0x253a53[_0xb1805d][_0x1f54('0x4a')],handleJob(_0x253a53[_0xb1805d]));logger[_0x1f54('0x7')](_0x1f54('0x54'),_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}else{manager['stop'](_0xb1805d);manager[_0x1f54('0x50')](_0xb1805d);logger[_0x1f54('0x7')]('stop\x20cron',_0x253a53[_0xb1805d][_0x1f54('0x15')],_0x253a53[_0xb1805d][_0x1f54('0x4a')]);}}}})[_0x1f54('0x2d')](function(_0x34e485){logger['error'](JSON['stringify'](_0x34e485));});}exports[_0x1f54('0x55')]=function(_0x10307b){return getJobs(_0x10307b);};exports[_0x1f54('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 2f1a56d..e3fb84b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7ea=['util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','contacts2','hopper2'];(function(_0x445c3d,_0x5de39c){var _0x398432=function(_0x5b6ad1){while(--_0x5b6ad1){_0x445c3d['push'](_0x445c3d['shift']());}};_0x398432(++_0x5de39c);}(_0xf7ea,0xea));var _0xaf7e=function(_0x35c94a,_0x1a3b01){_0x35c94a=_0x35c94a-0x0;var _0x77751c=_0xf7ea[_0x35c94a];return _0x77751c;};'use strict';var util=require(_0xaf7e('0x0'));var db=require(_0xaf7e('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xaf7e('0x2')]({'id':i,'firstName':_0xaf7e('0x3')+i,'lastName':_0xaf7e('0x4')+i,'phone':0xf879fb460+i,'email':_0xaf7e('0x5')+i+_0xaf7e('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xaf7e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xaf7e('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf7e('0x7')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaf7e('0x2')]({'id':i,'firstName':_0xaf7e('0x3')+i,'lastName':_0xaf7e('0x4')+i,'phone':0xf879fb460+i,'email':_0xaf7e('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xaf7e('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xaf7e('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaf7e('0x7')](),'updatedAt':Date[_0xaf7e('0x7')]()});}db[_0xaf7e('0x8')][_0xaf7e('0x9')]({'where':{}})[_0xaf7e('0xa')](function(){return db[_0xaf7e('0x8')]['bulkCreate'](contacts);})['then'](function(){console[_0xaf7e('0xb')](_0xaf7e('0xc'),_0xaf7e('0xd'));return db[_0xaf7e('0xe')][_0xaf7e('0x9')]({'where':{}});})[_0xaf7e('0xa')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xaf7e('0xa')](function(){console[_0xaf7e('0xb')]('finished\x20populating','hopper1');return db['CmContact'][_0xaf7e('0xf')](contacts2);})['then'](function(){console['log'](_0xaf7e('0xc'),_0xaf7e('0x10'));return db['CmHopper'][_0xaf7e('0xf')](hopper2);})[_0xaf7e('0xa')](function(){console['log'](_0xaf7e('0xc'),_0xaf7e('0x11'));})['catch'](function(_0x22e1ae){console['log'](_0x22e1ae);}); \ No newline at end of file +var _0xf169=['CmHopper','log','hopper1','contacts2','hopper2','catch','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','destroy','then','CmContact','bulkCreate','finished\x20populating','contacts1'];(function(_0xf7c91b,_0x242f8c){var _0x464692=function(_0x4671d9){while(--_0x4671d9){_0xf7c91b['push'](_0xf7c91b['shift']());}};_0x464692(++_0x242f8c);}(_0xf169,0x123));var _0x9f16=function(_0x1cdbb2,_0x5661b6){_0x1cdbb2=_0x1cdbb2-0x0;var _0x33279e=_0xf169[_0x1cdbb2];return _0x33279e;};'use strict';var util=require('util');var db=require(_0x9f16('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9f16('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9f16('0x2')+i,'phone':0xf879fb460+i,'email':_0x9f16('0x3')+i+_0x9f16('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9f16('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9f16('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9f16('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9f16('0x1')]({'id':i,'firstName':_0x9f16('0x6')+i,'lastName':_0x9f16('0x2')+i,'phone':0xf879fb460+i,'email':_0x9f16('0x3')+i+_0x9f16('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9f16('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x9f16('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x9f16('0x5')](),'updatedAt':Date['now']()});}db['CmContact'][_0x9f16('0x7')]({'where':{}})[_0x9f16('0x8')](function(){return db[_0x9f16('0x9')][_0x9f16('0xa')](contacts);})[_0x9f16('0x8')](function(){console['log'](_0x9f16('0xb'),_0x9f16('0xc'));return db['CmHopper']['destroy']({'where':{}});})[_0x9f16('0x8')](function(){return db[_0x9f16('0xd')][_0x9f16('0xa')](hopper);})[_0x9f16('0x8')](function(){console[_0x9f16('0xe')]('finished\x20populating',_0x9f16('0xf'));return db[_0x9f16('0x9')][_0x9f16('0xa')](contacts2);})['then'](function(){console[_0x9f16('0xe')](_0x9f16('0xb'),_0x9f16('0x10'));return db[_0x9f16('0xd')][_0x9f16('0xa')](hopper2);})[_0x9f16('0x8')](function(){console[_0x9f16('0xe')](_0x9f16('0xb'),_0x9f16('0x11'));})[_0x9f16('0x12')](function(_0x106b62){console['log'](_0x106b62);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 1bedfc2..b4eab04 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4689=['yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','../mysqldb','push','format','agent','%s%s','password','udp','wss','all','ulaw'];(function(_0x5be9fb,_0x46e393){var _0x254ef3=function(_0x2215d8){while(--_0x2215d8){_0x5be9fb['push'](_0x5be9fb['shift']());}};_0x254ef3(++_0x46e393);}(_0x4689,0xf2));var _0x9468=function(_0x3e8829,_0x2ad4f4){_0x3e8829=_0x3e8829-0x0;var _0x4f94c9=_0x4689[_0x3e8829];return _0x4f94c9;};'use strict';var util=require('util');var db=require(_0x9468('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x9468('0x1')]({'name':util[_0x9468('0x2')]('%s%s',_0x9468('0x3'),i),'fullname':util['format'](_0x9468('0x4'),_0x9468('0x3'),i),'email':util['format']('%s%s@xcally.com',_0x9468('0x3'),i),'role':_0x9468('0x3'),'password':_0x9468('0x5'),'internal':0xfa0+i,'type':'friend','transport':[_0x9468('0x6'),'ws',_0x9468('0x7')],'disallow':[_0x9468('0x8')],'allow':[_0x9468('0x9')],'defaultuser':util[_0x9468('0x2')](_0x9468('0x4'),_0x9468('0x3'),i),'encryption':_0x9468('0xa'),'avpf':_0x9468('0xa'),'force_avp':_0x9468('0xa'),'icesupport':_0x9468('0xa'),'dtlsenable':_0x9468('0xa'),'dtlsverify':'no','dtlscertfile':_0x9468('0xb'),'dtlsprivatekey':_0x9468('0xc'),'dtlssetup':_0x9468('0xd'),'callerid':util[_0x9468('0x2')](_0x9468('0xe'),util[_0x9468('0x2')]('%s%s',_0x9468('0x3'),i),0xfa0+i)});}db[_0x9468('0xf')]['bulkCreate'](users)[_0x9468('0x10')](function(){console[_0x9468('0x11')]('add\x20user');})['catch'](function(_0x7e7524){console['log'](_0x7e7524);}); \ No newline at end of file +var _0x0045=['%s%s','agent','%s%s@xcally.com','password','udp','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','util','../mysqldb','push','format'];(function(_0x1053e5,_0x29ba8d){var _0x55d410=function(_0x17e21c){while(--_0x17e21c){_0x1053e5['push'](_0x1053e5['shift']());}};_0x55d410(++_0x29ba8d);}(_0x0045,0xd8));var _0x5004=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0045[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x5004('0x0'));var db=require(_0x5004('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5004('0x2')]({'name':util[_0x5004('0x3')](_0x5004('0x4'),'agent',i),'fullname':util[_0x5004('0x3')]('%s%s',_0x5004('0x5'),i),'email':util[_0x5004('0x3')](_0x5004('0x6'),_0x5004('0x5'),i),'role':_0x5004('0x5'),'password':_0x5004('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x5004('0x8'),'ws',_0x5004('0x9')],'disallow':[_0x5004('0xa')],'allow':[_0x5004('0xb')],'defaultuser':util[_0x5004('0x3')](_0x5004('0x4'),_0x5004('0x5'),i),'encryption':_0x5004('0xc'),'avpf':'yes','force_avp':'yes','icesupport':_0x5004('0xc'),'dtlsenable':_0x5004('0xc'),'dtlsverify':'no','dtlscertfile':_0x5004('0xd'),'dtlsprivatekey':_0x5004('0xe'),'dtlssetup':_0x5004('0xf'),'callerid':util[_0x5004('0x3')]('\x22%s\x22\x20<%s>',util['format']('%s%s',_0x5004('0x5'),i),0xfa0+i)});}db[_0x5004('0x10')][_0x5004('0x11')](users)[_0x5004('0x12')](function(){console[_0x5004('0x13')]('add\x20user');})['catch'](function(_0x41c084){console[_0x5004('0x13')](_0x41c084);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 57e57b7..794cd3d 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf996=['FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','user','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','Campaign','getFaxQueues','getMailQueues','all','length','voice','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','map','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','catch','log','default','connection','setMaxListeners','address','remoteAddress','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','lodash','util','bluebird','./environment','User','name','role','agent','telephone','ivr','format','%s:queue:%s','Agents','handshake','query','find','ChatInteractions','MailInteraction','FaxInteractions','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','then','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','push','VoiceQueue','ChatQueue','findAll'];(function(_0x13e0c2,_0x5cf4c3){var _0x5bac89=function(_0xd26d35){while(--_0xd26d35){_0x13e0c2['push'](_0x13e0c2['shift']());}};_0x5bac89(++_0x5cf4c3);}(_0xf996,0x74));var _0x6f99=function(_0x4fda38,_0x44c823){_0x4fda38=_0x4fda38-0x0;var _0x16c06b=_0xf996[_0x4fda38];return _0x16c06b;};'use strict';var _=require(_0x6f99('0x0'));var util=require(_0x6f99('0x1'));var BPromise=require(_0x6f99('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x6f99('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x6f99('0x4')],'attributes':['id',_0x6f99('0x5'),_0x6f99('0x6')],'raw':!![],'where':{'role':_0x6f99('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6f99('0x5')],'where':{'role':_0x6f99('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6f99('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x6f99('0x5')],'where':{'role':_0x6f99('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6f99('0x5'),'type'],'where':{'type':_0x6f99('0x9')}};function joinOrLeaveQueues(_0x52e063,_0x178d9d,_0x185abd,_0x41f436){_0x52e063[_0x178d9d](util[_0x6f99('0xa')](_0x6f99('0xb'),_0x185abd,_0x41f436[_0x6f99('0x5')]));if(_0x41f436[_0x6f99('0xc')]){for(var _0x232d96=0x0;_0x232d96<_0x41f436[_0x6f99('0xc')]['length'];_0x232d96+=0x1){_0x52e063[_0x178d9d](util[_0x6f99('0xa')]('user:%s',_0x41f436['Agents'][_0x232d96]['name']));}}}function joinOrLeave(_0x12081d,_0xa1af95,_0x2560c7){var _0x107df6;if(_0x12081d[_0x6f99('0xd')][_0x6f99('0xe')]['id']){db[_0x6f99('0x4')][_0x6f99('0xf')]({'attributes':['id',_0x6f99('0x5'),_0x6f99('0x6')],'where':{'id':_0x12081d[_0x6f99('0xd')][_0x6f99('0xe')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6f99('0x10'),'attributes':['id'],'raw':!![]},{'model':db[_0x6f99('0x11')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6f99('0x12'),'attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6f99('0x13'),'attributes':['id'],'raw':!![]},{'model':db[_0x6f99('0x14')],'as':_0x6f99('0x15'),'attributes':['id'],'raw':!![]}]})[_0x6f99('0x16')](function(_0x9ab1a){if(_0x9ab1a){_0x107df6=_0x9ab1a;_0x12081d[_0xa1af95](util['format'](_0x6f99('0x17'),_0x9ab1a['name']));var _0x1ccbcf=[];switch(_0x9ab1a[_0x6f99('0x6')]){case _0x6f99('0x18'):_0x12081d[_0xa1af95](_0x6f99('0x19'));_0x12081d[_0xa1af95](_0x6f99('0x1a'));if(queryQueues[_0x6f99('0x1b')]('include')){delete queryQueues['include'];}_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x1d')]['findAll'](queryQueues));_0x1ccbcf['push'](db[_0x6f99('0x1e')][_0x6f99('0x1f')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x20')][_0x6f99('0x1f')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x21')][_0x6f99('0x1f')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x22')][_0x6f99('0x1f')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x23')][_0x6f99('0x1f')](queryQueues));_0x1ccbcf['push'](db[_0x6f99('0x4')][_0x6f99('0x1f')](queryTelephones));_0x1ccbcf['push'](db['Trunk'][_0x6f99('0x1f')](queryTrunks));_0x1ccbcf[_0x6f99('0x1c')](db['Campaign'][_0x6f99('0x1f')](queryCampaigns));_0x1ccbcf[_0x6f99('0x1c')](db['User'][_0x6f99('0x1f')](queryAgents));break;case _0x6f99('0x24'):_0x12081d[_0xa1af95]('voice:inbound');_0x12081d[_0xa1af95](_0x6f99('0x1a'));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x25')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x26')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a['getFaxQueues'](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x27')](queryQueues));_0x1ccbcf['push'](_0x9ab1a['getMailQueues'](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x28')](queryQueues));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x4')][_0x6f99('0x1f')](queryTelephones));_0x1ccbcf[_0x6f99('0x1c')](db['Trunk']['findAll'](queryTrunks));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x29')][_0x6f99('0x1f')](queryCampaigns));_0x1ccbcf[_0x6f99('0x1c')](db[_0x6f99('0x4')][_0x6f99('0x1f')](queryAgents));break;case _0x6f99('0x7'):_0x12081d[_0xa1af95](_0x6f99('0x19'));_0x12081d[_0xa1af95](_0x6f99('0x1a'));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x25')]({'attributes':['id','name']}));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x26')]({'attributes':['id',_0x6f99('0x5')]}));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x2a')]({'attributes':['id','name']}));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x27')]({'attributes':['id','name']}));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x2b')]({'attributes':['id',_0x6f99('0x5')]}));_0x1ccbcf[_0x6f99('0x1c')](_0x9ab1a[_0x6f99('0x28')]({'attributes':['id',_0x6f99('0x5')]}));break;}return BPromise[_0x6f99('0x2c')](_0x1ccbcf);}})[_0x6f99('0x16')](function(_0x56e206){if(_0x56e206&&_0x56e206[_0x6f99('0x2d')]){for(var _0x4d87a1=0x0;_0x4d87a1<_0x56e206[_0x6f99('0x2d')];_0x4d87a1+=0x1){for(var _0x383220=0x0;_0x383220<_0x56e206[_0x4d87a1][_0x6f99('0x2d')];_0x383220+=0x1){switch(_0x4d87a1){case 0x0:joinOrLeaveQueues(_0x12081d,_0xa1af95,_0x6f99('0x2e'),_0x56e206[_0x4d87a1][_0x383220]);break;case 0x1:joinOrLeaveQueues(_0x12081d,_0xa1af95,'chat',_0x56e206[_0x4d87a1][_0x383220]);break;case 0x2:joinOrLeaveQueues(_0x12081d,_0xa1af95,_0x6f99('0x2f'),_0x56e206[_0x4d87a1][_0x383220]);break;case 0x3:joinOrLeaveQueues(_0x12081d,_0xa1af95,'sms',_0x56e206[_0x4d87a1][_0x383220]);break;case 0x4:joinOrLeaveQueues(_0x12081d,_0xa1af95,_0x6f99('0x30'),_0x56e206[_0x4d87a1][_0x383220]);break;case 0x5:joinOrLeaveQueues(_0x12081d,_0xa1af95,_0x6f99('0x31'),_0x56e206[_0x4d87a1][_0x383220]);break;case 0x6:_0x12081d[_0xa1af95](util[_0x6f99('0xa')](_0x6f99('0x32'),_0x56e206[_0x4d87a1][_0x383220][_0x6f99('0x5')]));break;case 0x7:_0x12081d[_0xa1af95](util[_0x6f99('0xa')](_0x6f99('0x33'),_0x56e206[_0x4d87a1][_0x383220]['name']));break;case 0x8:_0x12081d[_0xa1af95](util[_0x6f99('0xa')](_0x6f99('0x34'),_0x56e206[_0x4d87a1][_0x383220][_0x6f99('0x35')],_0x56e206[_0x4d87a1][_0x383220]['name']));break;case 0x9:_0x12081d[_0xa1af95](util[_0x6f99('0xa')](_0x6f99('0x17'),_0x56e206[_0x4d87a1][_0x383220][_0x6f99('0x5')]));break;}}}}})[_0x6f99('0x16')](function(){if(_0xa1af95===_0x6f99('0x36')){var _0x3bb787=_[_0x6f99('0x37')](_0x107df6[_0x6f99('0x10')],'id');return _0x107df6['removeChatInteractions'](_0x3bb787)[_0x6f99('0x16')](function(){for(var _0x4fbd88=0x0;_0x4fbd88<_0x3bb787[_0x6f99('0x2d')];_0x4fbd88+=0x1){_0x2560c7[_0x6f99('0x38')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x3bb787[_0x4fbd88]),'UserId':Number(_0x107df6['id'])});}});}})[_0x6f99('0x16')](function(){if(_0xa1af95===_0x6f99('0x36')){var _0x1934c4=_[_0x6f99('0x37')](_0x107df6['MailInteractions'],'id');return _0x107df6[_0x6f99('0x39')](_0x1934c4)[_0x6f99('0x16')](function(){for(var _0x1792f4=0x0;_0x1792f4<_0x1934c4['length'];_0x1792f4+=0x1){_0x2560c7[_0x6f99('0x38')](_0x6f99('0x3a'),{'MailInteractionId':Number(_0x1934c4[_0x1792f4]),'UserId':Number(_0x107df6['id'])});}});}})[_0x6f99('0x16')](function(){if(_0xa1af95===_0x6f99('0x36')){var _0x298b3d=_[_0x6f99('0x37')](_0x107df6[_0x6f99('0x12')],'id');return _0x107df6[_0x6f99('0x3b')](_0x298b3d)['then'](function(){for(var _0x360713=0x0;_0x360713<_0x298b3d['length'];_0x360713+=0x1){_0x2560c7[_0x6f99('0x38')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x298b3d[_0x360713]),'UserId':Number(_0x107df6['id'])});}});}})[_0x6f99('0x16')](function(){if(_0xa1af95===_0x6f99('0x36')){var _0x113890=_[_0x6f99('0x37')](_0x107df6[_0x6f99('0x13')],'id');return _0x107df6[_0x6f99('0x3c')](_0x113890)[_0x6f99('0x16')](function(){for(var _0x524911=0x0;_0x524911<_0x113890[_0x6f99('0x2d')];_0x524911+=0x1){_0x2560c7[_0x6f99('0x38')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x113890[_0x524911]),'UserId':Number(_0x107df6['id'])});}});}})[_0x6f99('0x16')](function(){if(_0xa1af95===_0x6f99('0x36')){var _0x288730=_[_0x6f99('0x37')](_0x107df6[_0x6f99('0x15')],'id');return _0x107df6['removeOpenchannelInteractions'](_0x288730)[_0x6f99('0x16')](function(){for(var _0xd3616a=0x0;_0xd3616a<_0x288730[_0x6f99('0x2d')];_0xd3616a+=0x1){_0x2560c7[_0x6f99('0x38')](_0x6f99('0x3d'),{'OpenchannelInteractionId':Number(_0x288730[_0xd3616a]),'UserId':Number(_0x107df6['id'])});}});}})[_0x6f99('0x3e')](function(_0x2e54b1){_0x12081d[_0x6f99('0x3f')](_0x2e54b1);});}}function onDisconnect(_0x2c6cd8,_0x351c44){joinOrLeave(_0x2c6cd8,_0x6f99('0x36'),_0x351c44);}function onConnect(_0x40d6df){joinOrLeave(_0x40d6df,'join');}exports[_0x6f99('0x40')]=function(_0x1aa396){_0x1aa396['on'](_0x6f99('0x41'),function(_0x2011bd){_0x2011bd[_0x6f99('0x42')](0x0);_0x2011bd[_0x6f99('0x43')]=_0x2011bd['request'][_0x6f99('0x41')][_0x6f99('0x44')]+':'+_0x2011bd['request'][_0x6f99('0x41')][_0x6f99('0x45')];_0x2011bd[_0x6f99('0x46')]=new Date();_0x2011bd[_0x6f99('0x3f')]=function(_0xd90548){console['log']('SocketIO\x20'+_0x2011bd[_0x6f99('0x47')]['name']+'['+_0x2011bd[_0x6f99('0x43')]+']',_0xd90548);};_0x2011bd['on'](_0x6f99('0x48'),function(){onDisconnect(_0x2011bd,_0x1aa396);_0x2011bd[_0x6f99('0x3f')](_0x6f99('0x49'));});onConnect(_0x2011bd);_0x2011bd[_0x6f99('0x3f')]('CONNECTED');});}; \ No newline at end of file +var _0xf089=['openchannel','telephone:%s','trunk:%s','campaign:%s:%s','map','ChatInteractions','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','leave','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','join','connection','setMaxListeners','address','remoteAddress','request','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','util','bluebird','./environment','name','Agents','User','role','agent','telephone','type','ivr','%s:queue:%s','length','format','handshake','query','ChatInteraction','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','then','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','findAll','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','Campaign','user','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getVoiceQueues','getSmsQueues','voice','chat','fax','sms','mail'];(function(_0x353c55,_0x1b060a){var _0x2826f6=function(_0x3b0cb6){while(--_0x3b0cb6){_0x353c55['push'](_0x353c55['shift']());}};_0x2826f6(++_0x1b060a);}(_0xf089,0xba));var _0x9f08=function(_0x106d6c,_0x41c298){_0x106d6c=_0x106d6c-0x0;var _0x5db254=_0xf089[_0x106d6c];return _0x5db254;};'use strict';var _=require('lodash');var util=require(_0x9f08('0x0'));var BPromise=require(_0x9f08('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x9f08('0x2'));var queryQueues={'attributes':['id',_0x9f08('0x3')],'include':[{'as':_0x9f08('0x4'),'model':db[_0x9f08('0x5')],'attributes':['id','name',_0x9f08('0x6')],'raw':!![],'where':{'role':_0x9f08('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9f08('0x3')],'where':{'role':_0x9f08('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9f08('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x9f08('0x3')],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9f08('0x3'),_0x9f08('0x9')],'where':{'type':_0x9f08('0xa')}};function joinOrLeaveQueues(_0x4ce5b6,_0x4358e7,_0x286809,_0x3868b6){_0x4ce5b6[_0x4358e7](util['format'](_0x9f08('0xb'),_0x286809,_0x3868b6[_0x9f08('0x3')]));if(_0x3868b6[_0x9f08('0x4')]){for(var _0x5c6517=0x0;_0x5c6517<_0x3868b6['Agents'][_0x9f08('0xc')];_0x5c6517+=0x1){_0x4ce5b6[_0x4358e7](util[_0x9f08('0xd')]('user:%s',_0x3868b6[_0x9f08('0x4')][_0x5c6517][_0x9f08('0x3')]));}}}function joinOrLeave(_0x251b84,_0x597ae8,_0x582be0){var _0x9cd154;if(_0x251b84[_0x9f08('0xe')][_0x9f08('0xf')]['id']){db[_0x9f08('0x5')]['find']({'attributes':['id',_0x9f08('0x3'),_0x9f08('0x6')],'where':{'id':_0x251b84[_0x9f08('0xe')][_0x9f08('0xf')]['id']},'include':[{'model':db[_0x9f08('0x10')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x11')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x9f08('0x12'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x13')],'as':_0x9f08('0x14'),'attributes':['id'],'raw':!![]},{'model':db[_0x9f08('0x15')],'as':_0x9f08('0x16'),'attributes':['id'],'raw':!![]}]})[_0x9f08('0x17')](function(_0x40c97a){if(_0x40c97a){_0x9cd154=_0x40c97a;_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x18'),_0x40c97a[_0x9f08('0x3')]));var _0x2558fc=[];switch(_0x40c97a[_0x9f08('0x6')]){case _0x9f08('0x19'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8](_0x9f08('0x1b'));if(queryQueues[_0x9f08('0x1c')]('include')){delete queryQueues[_0x9f08('0x1d')];}_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x1f')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x21')]['findAll'](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x22')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x23')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db['MailQueue']['findAll'](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x24')][_0x9f08('0x20')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryTelephones));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x25')]['findAll'](queryTrunks));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x26')][_0x9f08('0x20')](queryCampaigns));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryAgents));break;case _0x9f08('0x27'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8]('voice:outbound');_0x2558fc[_0x9f08('0x1e')](_0x40c97a['getVoiceQueues'](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x28')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x29')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a['getSmsQueues'](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2a')](queryQueues));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2b')](queryQueues));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryTelephones));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x25')]['findAll'](queryTrunks));_0x2558fc[_0x9f08('0x1e')](db['Campaign'][_0x9f08('0x20')](queryCampaigns));_0x2558fc[_0x9f08('0x1e')](db[_0x9f08('0x5')][_0x9f08('0x20')](queryAgents));break;case _0x9f08('0x7'):_0x251b84[_0x597ae8](_0x9f08('0x1a'));_0x251b84[_0x597ae8]('voice:outbound');_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2c')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x28')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc['push'](_0x40c97a[_0x9f08('0x29')]({'attributes':['id','name']}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2d')]({'attributes':['id',_0x9f08('0x3')]}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2a')]({'attributes':['id','name']}));_0x2558fc[_0x9f08('0x1e')](_0x40c97a[_0x9f08('0x2b')]({'attributes':['id',_0x9f08('0x3')]}));break;}return BPromise['all'](_0x2558fc);}})[_0x9f08('0x17')](function(_0x445fe8){if(_0x445fe8&&_0x445fe8[_0x9f08('0xc')]){for(var _0x4618db=0x0;_0x4618db<_0x445fe8[_0x9f08('0xc')];_0x4618db+=0x1){for(var _0x5f33c0=0x0;_0x5f33c0<_0x445fe8[_0x4618db][_0x9f08('0xc')];_0x5f33c0+=0x1){switch(_0x4618db){case 0x0:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x2e'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x1:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x2f'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x2:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x30'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x3:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x31'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x4:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x32'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x5:joinOrLeaveQueues(_0x251b84,_0x597ae8,_0x9f08('0x33'),_0x445fe8[_0x4618db][_0x5f33c0]);break;case 0x6:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x34'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;case 0x7:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x35'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;case 0x8:_0x251b84[_0x597ae8](util['format'](_0x9f08('0x36'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x9')],_0x445fe8[_0x4618db][_0x5f33c0]['name']));break;case 0x9:_0x251b84[_0x597ae8](util[_0x9f08('0xd')](_0x9f08('0x18'),_0x445fe8[_0x4618db][_0x5f33c0][_0x9f08('0x3')]));break;}}}}})[_0x9f08('0x17')](function(){if(_0x597ae8==='leave'){var _0x180d85=_[_0x9f08('0x37')](_0x9cd154[_0x9f08('0x38')],'id');return _0x9cd154[_0x9f08('0x39')](_0x180d85)[_0x9f08('0x17')](function(){for(var _0x249199=0x0;_0x249199<_0x180d85['length'];_0x249199+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x3b'),{'ChatInteractionId':Number(_0x180d85[_0x249199]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8==='leave'){var _0x3b396a=_['map'](_0x9cd154[_0x9f08('0x3c')],'id');return _0x9cd154[_0x9f08('0x3d')](_0x3b396a)[_0x9f08('0x17')](function(){for(var _0x4e4230=0x0;_0x4e4230<_0x3b396a[_0x9f08('0xc')];_0x4e4230+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x3e'),{'MailInteractionId':Number(_0x3b396a[_0x4e4230]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x181217=_['map'](_0x9cd154[_0x9f08('0x12')],'id');return _0x9cd154['removeFaxInteractions'](_0x181217)[_0x9f08('0x17')](function(){for(var _0xdacb1b=0x0;_0xdacb1b<_0x181217[_0x9f08('0xc')];_0xdacb1b+=0x1){_0x582be0[_0x9f08('0x3a')](_0x9f08('0x40'),{'FaxInteractionId':Number(_0x181217[_0xdacb1b]),'UserId':Number(_0x9cd154['id'])});}});}})[_0x9f08('0x17')](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x581ae5=_['map'](_0x9cd154['SmsInteractions'],'id');return _0x9cd154['removeSmsInteractions'](_0x581ae5)['then'](function(){for(var _0x308fd9=0x0;_0x308fd9<_0x581ae5[_0x9f08('0xc')];_0x308fd9+=0x1){_0x582be0['emit'](_0x9f08('0x41'),{'SmsInteractionId':Number(_0x581ae5[_0x308fd9]),'UserId':Number(_0x9cd154['id'])});}});}})['then'](function(){if(_0x597ae8===_0x9f08('0x3f')){var _0x71d00a=_[_0x9f08('0x37')](_0x9cd154[_0x9f08('0x16')],'id');return _0x9cd154['removeOpenchannelInteractions'](_0x71d00a)[_0x9f08('0x17')](function(){for(var _0x131d09=0x0;_0x131d09<_0x71d00a[_0x9f08('0xc')];_0x131d09+=0x1){_0x582be0['emit'](_0x9f08('0x42'),{'OpenchannelInteractionId':Number(_0x71d00a[_0x131d09]),'UserId':Number(_0x9cd154['id'])});}});}})['catch'](function(_0x55d98d){_0x251b84['log'](_0x55d98d);});}}function onDisconnect(_0x2639c1,_0x3579b9){joinOrLeave(_0x2639c1,_0x9f08('0x3f'),_0x3579b9);}function onConnect(_0x257613){joinOrLeave(_0x257613,_0x9f08('0x43'));}exports['default']=function(_0x5b45af){_0x5b45af['on'](_0x9f08('0x44'),function(_0x574b2a){_0x574b2a[_0x9f08('0x45')](0x0);_0x574b2a[_0x9f08('0x46')]=_0x574b2a['request'][_0x9f08('0x44')][_0x9f08('0x47')]+':'+_0x574b2a[_0x9f08('0x48')][_0x9f08('0x44')]['remotePort'];_0x574b2a[_0x9f08('0x49')]=new Date();_0x574b2a[_0x9f08('0x4a')]=function(_0x54cf7b){console['log'](_0x9f08('0x4b')+_0x574b2a['nsp'][_0x9f08('0x3')]+'['+_0x574b2a[_0x9f08('0x46')]+']',_0x54cf7b);};_0x574b2a['on'](_0x9f08('0x4c'),function(){onDisconnect(_0x574b2a,_0x5b45af);_0x574b2a['log'](_0x9f08('0x4d'));});onConnect(_0x574b2a);_0x574b2a[_0x9f08('0x4a')](_0x9f08('0x4e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index adfe7f4..f137592 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 _0x73b1=['FaxInteraction','Mail','MailInteraction','newinteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','direction','User','name','interface','format','SIP/%s','incomingmessage','event','opened','changed','closed','find','UserId','default','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','SmsMessage','Fax'];(function(_0x3b326e,_0x12157e){var _0x5954b8=function(_0x550551){while(--_0x550551){_0x3b326e['push'](_0x3b326e['shift']());}};_0x5954b8(++_0x12157e);}(_0x73b1,0x101));var _0x173b=function(_0x474b1b,_0x8c6a7a){_0x474b1b=_0x474b1b-0x0;var _0x235ab6=_0x73b1[_0x474b1b];return _0x235ab6;};'use strict';var util=require(_0x173b('0x0'));var db=require(_0x173b('0x1'))['db'];var jayson=require(_0x173b('0x2'));var logger=require(_0x173b('0x3'))(_0x173b('0x4'));var client=jayson[_0x173b('0x5')][_0x173b('0x6')]({'port':0x232a});var triggers=[{'channel':_0x173b('0x7'),'model':_0x173b('0x8'),'event':_0x173b('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x173b('0x7'),'model':_0x173b('0x8'),'event':_0x173b('0xa'),'condition':_0x173b('0xb'),'callback':afterUpdate},{'channel':'Chat','model':_0x173b('0xc'),'event':_0x173b('0x9'),'condition':_0x173b('0xd'),'callback':afterCreateMessage},{'channel':_0x173b('0xe'),'model':_0x173b('0xf'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x173b('0xe'),'model':'SmsInteraction','event':_0x173b('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x173b('0xe'),'model':_0x173b('0x10'),'event':_0x173b('0x9'),'condition':_0x173b('0xd'),'callback':afterCreateMessage},{'channel':_0x173b('0x11'),'model':_0x173b('0x12'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0x173b('0x11'),'model':_0x173b('0x12'),'event':_0x173b('0xa'),'condition':_0x173b('0xb'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0x173b('0x9'),'condition':_0x173b('0xd'),'callback':afterCreateMessage},{'channel':_0x173b('0x13'),'model':_0x173b('0x14'),'event':_0x173b('0x9'),'condition':_0x173b('0x15'),'callback':afterCreate},{'channel':_0x173b('0x13'),'model':_0x173b('0x14'),'event':_0x173b('0xa'),'condition':_0x173b('0xb'),'callback':afterUpdate},{'channel':_0x173b('0x13'),'model':_0x173b('0x16'),'event':'afterCreate','condition':_0x173b('0xd'),'callback':afterCreateMessage},{'channel':_0x173b('0x17'),'model':'OpenchannelInteraction','event':'afterCreate','condition':_0x173b('0x15'),'callback':afterCreate},{'channel':_0x173b('0x17'),'model':_0x173b('0x18'),'event':_0x173b('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x173b('0x17'),'model':_0x173b('0x19'),'event':_0x173b('0x9'),'condition':_0x173b('0xd'),'callback':afterCreateMessage}];function request(_0xa01593){return client[_0x173b('0x1a')](_0x173b('0x1b'),_0xa01593)[_0x173b('0x1c')](function(_0x3434ce){logger[_0x173b('0x1d')](_0x173b('0x1e'),_0x173b('0x1b'),_0x3434ce);if(_0x3434ce[_0x173b('0x1f')]){if(_0x3434ce[_0x173b('0x1f')][_0x173b('0x20')]===0x1f4){logger[_0x173b('0x1f')](_0x173b('0x1e'),_0x173b('0x1b'),_0x3434ce[_0x173b('0x1f')]);}}})[_0x173b('0x21')](function(_0x345c35){logger[_0x173b('0x1f')](_0x173b('0x1e'),'EventManager',_0x345c35);});}function afterCreateMessage(_0x4010c5,_0x1881d8){return function(_0x1204fa,_0x30e743){_0x1204fa=_0x1204fa[_0x173b('0x22')]({'plain':!![]});_0x1204fa[_0x173b('0x23')]=_0x4010c5;_0x1204fa['event']=_0x1204fa[_0x173b('0x24')];if(_0x1204fa['UserId']){return db[_0x173b('0x25')]['find']({'where':{'id':_0x1204fa['UserId']},'attributes':['id',_0x173b('0x26')],'raw':!![]})[_0x173b('0x1c')](function(_0x4b2696){_0x1204fa[_0x173b('0x27')]=util[_0x173b('0x28')](_0x173b('0x29'),_0x4b2696[_0x173b('0x26')]);_0x1204fa[_0x173b('0x23')]=_0x4010c5;return request({'event':_0x173b('0x2a'),'message':_0x1204fa});})[_0x173b('0x21')](function(_0x4c0093){console[_0x173b('0x1f')](_0x4c0093);});}else{return request({'event':'outgoingmessage','message':_0x1204fa});}};}function afterCreate(_0x2016bc,_0xc4bf41){return function(_0x3c97ab,_0xa55089){_0x3c97ab=_0x3c97ab[_0x173b('0x22')]({'plain':!![]});_0x3c97ab[_0x173b('0x23')]=_0x2016bc;_0x3c97ab[_0x173b('0x2b')]=_0x173b('0x2c');return request({'event':_0xc4bf41,'message':_0x3c97ab});};}function afterUpdate(_0x47d058,_0x54c262){return function(_0x53595c,_0x30c35d){if(_0x53595c[_0x173b('0x2d')](_0x173b('0x2e'))&&_0x53595c['closed']){_0x53595c=_0x53595c['get']({'plain':!![]});_0x53595c[_0x173b('0x23')]=_0x47d058;_0x53595c['event']=_0x173b('0x2e');if(_0x53595c['UserId']){return db[_0x173b('0x25')][_0x173b('0x2f')]({'where':{'id':_0x53595c[_0x173b('0x30')]},'attributes':['id',_0x173b('0x26')],'raw':!![]})[_0x173b('0x1c')](function(_0x42849d){_0x53595c[_0x173b('0x27')]=util['format']('SIP/%s',_0x42849d[_0x173b('0x26')]);return request({'event':_0x54c262,'message':_0x53595c});})[_0x173b('0x21')](function(_0x41f513){console[_0x173b('0x1f')](_0x41f513);});}else{return request({'event':_0x54c262,'message':_0x53595c});}}};}exports[_0x173b('0x31')]=function(){for(var _0x7f9665=0x0;_0x7f96650x3){var _0x37dc99=/\((.+)\)/;var _0x5e8932=_0x2ddb5d['rx'][_0xc81f('0x1b')](_0x37dc99);if(_0x5e8932){_0x373eec=_0x5e8932[0x1];}else{_0x373eec=null;}}else{_0x373eec=null;}_0x2ddb5d['cb'](null,{'code':_0x318e07,'result':_0xc6cb34,'extra':_0x373eec});}});_0x2a83cb['on'](_0xc81f('0x1c'),function(_0x2f81f1){_0x4c0297[_0xc81f('0xa')]('error',new AGIError(_0xc81f('0x1d'),_0x2f81f1[_0xc81f('0x1e')]));});_0x2a83cb['on'](_0xc81f('0x1f'),function(){_0x4c0297['emit']('close',new AGIError(_0xc81f('0x20')));});_0x2a83cb['on']('timeout',function(){_0x4c0297['emit']('timeout',new AGIError(_0xc81f('0x21')));_0x2a83cb[_0xc81f('0x22')]();});_0x2a83cb[_0xc81f('0x23')](_0x6ce405);this[_0xc81f('0x24')]=function(_0x10894e,_0xbd346d){var _0x10894e=_0x10894e||'',_0xbd346d=typeof _0xbd346d=='function'?_0xbd346d:new Function();_0x2ddb5d={'tx':_0x10894e,'rx':'','cb':_0xbd346d};_0x2a83cb['write'](_0x10894e+'\x0a');},this[_0xc81f('0x1f')]=function(){_0x2a83cb[_0xc81f('0x22')]();};}util[_0xc81f('0x25')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc81f('0x26')]=function(_0x3781dc){return this[_0xc81f('0x24')][_0xc81f('0x27')](this,_0x3781dc);};AGIChannel[_0xc81f('0x28')][_0xc81f('0x29')]=function(){return this[_0xc81f('0x26')]('ANSWER');};AGIChannel[_0xc81f('0x28')][_0xc81f('0x2a')]=function(_0x1107cb,_0xe2bf3e,_0x405adb){_0x1107cb=_0x1107cb===undefined?'beep':_0x1107cb;_0xe2bf3e=_0xe2bf3e===undefined?'5':_0xe2bf3e;_0x405adb=_0x405adb===undefined?'1':_0x405adb;return this[_0xc81f('0x26')](util['format'](_0xc81f('0x2b'),_0x1107cb,_0xe2bf3e*0x3e8,_0x405adb));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x2c')]=function(_0x329460){_0x329460=_0x329460||_0xc81f('0x2d');return this[_0xc81f('0x26')](util['format'](_0xc81f('0x2e'),_0x329460));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x2f')]=function(_0x256694,_0x10f14c){if(_['isArray'](_0x10f14c)){return this['sendRequest'](util[_0xc81f('0x30')]('EXEC\x20%s\x20%s',_0x256694,_0x10f14c[_0xc81f('0x31')](',')));}return this[_0xc81f('0x26')](util[_0xc81f('0x30')](_0xc81f('0x32'),_0x256694,_0x10f14c));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x33')]=function(_0x4091c9){return this['sendRequest'](util[_0xc81f('0x30')](_0xc81f('0x34'),_0x4091c9));};AGIChannel['prototype'][_0xc81f('0x35')]=function(_0x5ccf29){return this['sendRequest'](util[_0xc81f('0x30')](_0xc81f('0x36'),_0x5ccf29));};AGIChannel['prototype'][_0xc81f('0x37')]=function(_0x2ec6de){return this[_0xc81f('0x26')](util[_0xc81f('0x30')](_0xc81f('0x38'),_0x2ec6de));};AGIChannel[_0xc81f('0x28')]['hangup']=function(){return this[_0xc81f('0x26')](_0xc81f('0x39'));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x3a')]=function(_0x2e1de2,_0x506e61){return this['sendRequest'](util[_0xc81f('0x30')](_0xc81f('0x3b'),_0x2e1de2,_0x506e61?_0x506e61[_0xc81f('0x3c')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x254626,_0x4546da){return this[_0xc81f('0x26')](util[_0xc81f('0x30')](_0xc81f('0x3d'),_0x254626,_0x4546da));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x3e')]=function(_0x1fb57f,_0x3851b4){return this['sendRequest'](util['format'](_0xc81f('0x3f'),_0x1fb57f,_0x3851b4));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x40')]=function(_0x4056c6,_0x20b7f4){return this['sendRequest'](util[_0xc81f('0x30')](_0xc81f('0x41'),_0x4056c6,_0x20b7f4));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x42')]=function(_0x3e8935,_0x490d85,_0x1def74){_0x490d85=_0x490d85||this[_0xc81f('0x43')];_0x1def74=_0x1def74||0x1;this[_0xc81f('0x33')](_0x3e8935);this[_0xc81f('0x35')](_0x490d85);this[_0xc81f('0x37')](_0x1def74);return this['noop'](util[_0xc81f('0x30')](_0xc81f('0x44'),_0x3e8935,_0x490d85,_0x1def74));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x45')]=function(_0x4f082b){return this[_0xc81f('0x26')](util[_0xc81f('0x30')]('GET\x20VARIABLE\x20\x22%s\x22',_0x4f082b));};AGIChannel[_0xc81f('0x28')][_0xc81f('0x46')]=function(_0x1b6301,_0x10e0ff,_0x2aa698,_0x3e2457,_0x18664b,_0xa0c54a){_0x10e0ff=_0x10e0ff||'wav';_0x2aa698=_0x2aa698||'';_0x3e2457=_0x3e2457===undefined?-0x1:_0x3e2457==='-1'?-0x1:_0x3e2457*0x3e8;_0x18664b=_0x18664b===undefined?'':'s='+_0x18664b;_0xa0c54a=_0xa0c54a?_0xc81f('0x47'):'';return this[_0xc81f('0x26')](util['format'](_0xc81f('0x48'),_0x1b6301,_0x10e0ff,_0x2aa698,_0x3e2457,_0xa0c54a,_0x18664b));};AGIChannel[_0xc81f('0x28')]['streamFile']=function(_0x51372b,_0xdbc096){_0xdbc096=_0xdbc096||'';return this['sendRequest'](util[_0xc81f('0x30')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x51372b,_0xdbc096));};AGIChannel['prototype'][_0xc81f('0x49')]=function(_0x25e945){return this[_0xc81f('0x2f')]('AGI',_0x25e945);};AGIChannel[_0xc81f('0x28')][_0xc81f('0x4a')]=function(_0x3c440c){return this[_0xc81f('0x2f')](_0xc81f('0x4b'),_0x3c440c);};AGIChannel[_0xc81f('0x28')]['error']=function(_0xed730a,_0xca04c0){this[_0xc81f('0x2c')](util[_0xc81f('0x30')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0xed730a['id'],_0xed730a['label'],_0xca04c0));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x6760=['toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','indexOf','substr','split','length','match','error','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','ANSWER','getData','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','HANGUP','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','replace','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready'];(function(_0x426b48,_0x595c31){var _0x31004d=function(_0x115016){while(--_0x115016){_0x426b48['push'](_0x426b48['shift']());}};_0x31004d(++_0x595c31);}(_0x6760,0x1b6));var _0x0676=function(_0x39b97d,_0x3cea45){_0x39b97d=_0x39b97d-0x0;var _0x391e91=_0x6760[_0x39b97d];return _0x391e91;};'use strict';var util=require(_0x0676('0x0'));var _=require(_0x0676('0x1'));var EventEmitter=require('events')[_0x0676('0x2')];var AGIReply=require(_0x0676('0x3'));var AGIError=require(_0x0676('0x4'));function AGIChannel(_0x5468d9){var _0x28d6c0=this,_0x4c9ddb=new AGIReply(),_0x59b47c=![],_0x5e6de7={};EventEmitter[_0x0676('0x5')](_0x28d6c0);_0x5468d9[_0x0676('0x6')](_0x0676('0x7'));_0x5468d9[_0x0676('0x8')](0x8*0x3c*0x3c*0x3e8);_0x4c9ddb[_0x0676('0x6')](_0x0676('0x7'));_0x4c9ddb['on'](_0x0676('0x9'),function(_0x23c117){for(var _0x59b7c0 in _0x23c117){_0x28d6c0[_0x59b7c0]=_0x23c117[_0x59b7c0];}_0x28d6c0[_0x0676('0xa')](_0x0676('0xb'));});_0x4c9ddb['on']('line',function(_0x176476){if(_0x176476[_0x0676('0xc')]()==_0x0676('0xd')){_0x28d6c0[_0x0676('0xa')](_0x0676('0xd'));return;}if(_0x176476['substring'](0x0,0xb)==_0x0676('0xe')){_0x59b47c=!![];}if(_0x59b47c){_0x5e6de7['rx']+=_0x176476+'\x0a';if(_0x176476[_0x0676('0xf')](_0x0676('0x10'))!=-0x1){_0x59b47c=![];}}else{_0x5e6de7['rx']=_0x176476;}if(_0x59b47c){return;}if(typeof _0x5e6de7['cb']==_0x0676('0x11')){var _0x3ec5e8=_0x5e6de7['rx'][_0x0676('0x12')](0x0,0x3),_0x2fcc3f=null,_0x59bcd1=null;_0x3ec5e8=parseInt(_0x3ec5e8);if(isNaN(_0x3ec5e8)){_0x5e6de7['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x3ec5e8!=0xc8){_0x5e6de7['cb'](null,{'code':_0x3ec5e8,'result':-0x1,'extra':'KO'});return;}_0x2fcc3f=_0x5e6de7['rx'][_0x0676('0x12')](0x4)['replace']('result=','');if(_0x2fcc3f[_0x0676('0x13')]('\x20')!=-0x1){_0x2fcc3f=_0x2fcc3f[_0x0676('0x14')](0x0,_0x2fcc3f[_0x0676('0x13')]('\x20'));}if(_['startsWith'](_0x2fcc3f,'-1')){_0x2fcc3f=parseInt(_0x2fcc3f);}_0x59bcd1=_0x5e6de7['rx'][_0x0676('0x15')]('\x20');if(_0x59bcd1[_0x0676('0x16')]==0x3){_0x59bcd1=_0x59bcd1[0x2][_0x0676('0x12')](0x1,_0x59bcd1[0x2]['length']-0x1);}else if(_0x59bcd1[_0x0676('0x16')]>0x3){var _0x5ee77e=/\((.+)\)/;var _0x1251d5=_0x5e6de7['rx'][_0x0676('0x17')](_0x5ee77e);if(_0x1251d5){_0x59bcd1=_0x1251d5[0x1];}else{_0x59bcd1=null;}}else{_0x59bcd1=null;}_0x5e6de7['cb'](null,{'code':_0x3ec5e8,'result':_0x2fcc3f,'extra':_0x59bcd1});}});_0x5468d9['on'](_0x0676('0x18'),function(_0x23040d){_0x28d6c0[_0x0676('0xa')](_0x0676('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x23040d[_0x0676('0x19')]));});_0x5468d9['on'](_0x0676('0x1a'),function(){_0x28d6c0[_0x0676('0xa')](_0x0676('0x1a'),new AGIError(_0x0676('0x1b')));});_0x5468d9['on'](_0x0676('0x1c'),function(){_0x28d6c0[_0x0676('0xa')]('timeout',new AGIError(_0x0676('0x1d')));_0x5468d9[_0x0676('0x1e')]();});_0x5468d9[_0x0676('0x1f')](_0x4c9ddb);this[_0x0676('0x20')]=function(_0x199b5b,_0x39018e){var _0x199b5b=_0x199b5b||'',_0x39018e=typeof _0x39018e==_0x0676('0x11')?_0x39018e:new Function();_0x5e6de7={'tx':_0x199b5b,'rx':'','cb':_0x39018e};_0x5468d9[_0x0676('0x21')](_0x199b5b+'\x0a');},this['close']=function(){_0x5468d9[_0x0676('0x1e')]();};}util[_0x0676('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x0676('0x23')][_0x0676('0x24')]=function(_0x4def7d){return this[_0x0676('0x20')]['sync'](this,_0x4def7d);};AGIChannel[_0x0676('0x23')]['answer']=function(){return this[_0x0676('0x24')](_0x0676('0x25'));};AGIChannel[_0x0676('0x23')][_0x0676('0x26')]=function(_0x433cdc,_0x5cdb7b,_0x58b0df){_0x433cdc=_0x433cdc===undefined?'beep':_0x433cdc;_0x5cdb7b=_0x5cdb7b===undefined?'5':_0x5cdb7b;_0x58b0df=_0x58b0df===undefined?'1':_0x58b0df;return this[_0x0676('0x24')](util[_0x0676('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x433cdc,_0x5cdb7b*0x3e8,_0x58b0df));};AGIChannel[_0x0676('0x23')]['noop']=function(_0x5b121a){_0x5b121a=_0x5b121a||_0x0676('0x28');return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x29'),_0x5b121a));};AGIChannel['prototype'][_0x0676('0x2a')]=function(_0x3e6c27,_0x1e805a){if(_[_0x0676('0x2b')](_0x1e805a)){return this[_0x0676('0x24')](util['format'](_0x0676('0x2c'),_0x3e6c27,_0x1e805a[_0x0676('0x2d')](',')));}return this[_0x0676('0x24')](util['format'](_0x0676('0x2c'),_0x3e6c27,_0x1e805a));};AGIChannel[_0x0676('0x23')][_0x0676('0x2e')]=function(_0x44d815){return this[_0x0676('0x24')](util['format'](_0x0676('0x2f'),_0x44d815));};AGIChannel['prototype']['setExtension']=function(_0x2dd078){return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x30'),_0x2dd078));};AGIChannel[_0x0676('0x23')][_0x0676('0x31')]=function(_0x507805){return this[_0x0676('0x24')](util[_0x0676('0x27')]('SET\x20PRIORITY\x20%s',_0x507805));};AGIChannel[_0x0676('0x23')][_0x0676('0xd')]=function(){return this[_0x0676('0x24')](_0x0676('0x32'));};AGIChannel[_0x0676('0x23')]['setVariable']=function(_0x170976,_0x11c9b5){return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x33'),_0x170976,_0x11c9b5?_0x11c9b5[_0x0676('0x34')]()[_0x0676('0x35')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0676('0x23')]['sayNumber']=function(_0x962339,_0x1c1fc8){return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x36'),_0x962339,_0x1c1fc8));};AGIChannel[_0x0676('0x23')][_0x0676('0x37')]=function(_0x126b92,_0x170811){return this[_0x0676('0x24')](util[_0x0676('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x126b92,_0x170811));};AGIChannel[_0x0676('0x23')][_0x0676('0x38')]=function(_0x5f3ae0,_0x568977){return this[_0x0676('0x24')](util['format'](_0x0676('0x39'),_0x5f3ae0,_0x568977));};AGIChannel[_0x0676('0x23')][_0x0676('0x3a')]=function(_0x1e1a7f,_0x42bab2,_0x11b7ce){_0x42bab2=_0x42bab2||this[_0x0676('0x3b')];_0x11b7ce=_0x11b7ce||0x1;this[_0x0676('0x2e')](_0x1e1a7f);this['setExtension'](_0x42bab2);this['setPriority'](_0x11b7ce);return this[_0x0676('0x3c')](util[_0x0676('0x27')](_0x0676('0x3d'),_0x1e1a7f,_0x42bab2,_0x11b7ce));};AGIChannel[_0x0676('0x23')][_0x0676('0x3e')]=function(_0x394b58){return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x3f'),_0x394b58));};AGIChannel[_0x0676('0x23')][_0x0676('0x40')]=function(_0x434374,_0x22c76f,_0x2b3eab,_0xb651fa,_0x9aac70,_0x183558){_0x22c76f=_0x22c76f||_0x0676('0x41');_0x2b3eab=_0x2b3eab||'';_0xb651fa=_0xb651fa===undefined?-0x1:_0xb651fa==='-1'?-0x1:_0xb651fa*0x3e8;_0x9aac70=_0x9aac70===undefined?'':'s='+_0x9aac70;_0x183558=_0x183558?_0x0676('0x42'):'';return this[_0x0676('0x24')](util[_0x0676('0x27')](_0x0676('0x43'),_0x434374,_0x22c76f,_0x2b3eab,_0xb651fa,_0x183558,_0x9aac70));};AGIChannel[_0x0676('0x23')][_0x0676('0x44')]=function(_0x5bc46c,_0x6cd3ad){_0x6cd3ad=_0x6cd3ad||'';return this['sendRequest'](util[_0x0676('0x27')](_0x0676('0x45'),_0x5bc46c,_0x6cd3ad));};AGIChannel[_0x0676('0x23')][_0x0676('0x46')]=function(_0xf31d2f){return this[_0x0676('0x2a')](_0x0676('0x47'),_0xf31d2f);};AGIChannel[_0x0676('0x23')][_0x0676('0x48')]=function(_0x28b9e5){return this[_0x0676('0x2a')](_0x0676('0x49'),_0x28b9e5);};AGIChannel[_0x0676('0x23')][_0x0676('0x18')]=function(_0x461fb1,_0x4ea04d){this[_0x0676('0x3c')](util[_0x0676('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x461fb1['id'],_0x461fb1[_0x0676('0x4a')],_0x4ea04d));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index f4ce3ce..6a641f1 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 _0x4020=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x838813,_0x448f0f){var _0x2bd32d=function(_0x57b589){while(--_0x57b589){_0x838813['push'](_0x838813['shift']());}};_0x2bd32d(++_0x448f0f);}(_0x4020,0x14e));var _0x0402=function(_0x229c86,_0x28f697){_0x229c86=_0x229c86-0x0;var _0x1a3582=_0x4020[_0x229c86];return _0x1a3582;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x0402('0x0'),'E_AGI_ARGUMENT_PORT':_0x0402('0x1'),'E_AGI_SERVER_ERROR':_0x0402('0x2'),'E_AGI_SERVER_CLOSE':_0x0402('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0402('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x0402('0x5'),'E_AGI_SOCKET_CLOSE':_0x0402('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0402('0x7'),'E_AGI_COMMAND_EMPTY':_0x0402('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0402('0x9')};function AGIError(_0x3ed53b){var _0x3ed53b=_0x3ed53b||null,_0x3eff7e=_0x3eff7e||[],_0x4a0bc3=0x1,_0x4791db='';if(!error[_0x3ed53b]){_0x3ed53b=_0x0402('0xa');}_0x3eff7e[_0x0402('0xb')](error[_0x3ed53b]);while(arguments[_0x4a0bc3]){_0x3eff7e[_0x0402('0xb')](arguments[_0x4a0bc3]);_0x4a0bc3++;}_0x4791db=util['format'][_0x0402('0xc')](util,_0x3eff7e);this[_0x0402('0xd')]=_0x4791db;this[_0x0402('0xe')]=_0x3ed53b;}module[_0x0402('0xf')]=AGIError; \ No newline at end of file +var _0x87fc=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.'];(function(_0x2cb249,_0x2959af){var _0x1c02db=function(_0x32ff10){while(--_0x32ff10){_0x2cb249['push'](_0x2cb249['shift']());}};_0x1c02db(++_0x2959af);}(_0x87fc,0x1ce));var _0xc87f=function(_0x37503a,_0x5b29b4){_0x37503a=_0x37503a-0x0;var _0x6a9c75=_0x87fc[_0x37503a];return _0x6a9c75;};'use strict';var util=require(_0xc87f('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xc87f('0x1'),'E_AGI_SERVER_CLOSE':_0xc87f('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0xc87f('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xc87f('0x4'),'E_AGI_SOCKET_CLOSE':_0xc87f('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xc87f('0x6'),'E_AGI_COMMAND_EMPTY':_0xc87f('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xc87f('0x8'),'E_AGI_IVR_ENTRY':_0xc87f('0x9')};function AGIError(_0x441ce9){var _0x441ce9=_0x441ce9||null,_0x2e96bc=_0x2e96bc||[],_0xb9b68e=0x1,_0x2ff795='';if(!error[_0x441ce9]){_0x441ce9='E_AGI_UNDEFINED';}_0x2e96bc['push'](error[_0x441ce9]);while(arguments[_0xb9b68e]){_0x2e96bc[_0xc87f('0xa')](arguments[_0xb9b68e]);_0xb9b68e++;}_0x2ff795=util[_0xc87f('0xb')][_0xc87f('0xc')](util,_0x2e96bc);this[_0xc87f('0xd')]=_0x2ff795;this['name']=_0x441ce9;}module[_0xc87f('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index bba70e2..ecd7b45 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 _0xe2cf=['vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','relations','getVertex','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','agicommand','default','invalid','target','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','../../../config/logger','menu','getsecretdigits'];(function(_0x49c8ef,_0x1d10c8){var _0x556b79=function(_0x487bf8){while(--_0x487bf8){_0x49c8ef['push'](_0x49c8ef['shift']());}};_0x556b79(++_0x1d10c8);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x6b7dd0,_0x2eebf2){_0x6b7dd0=_0x6b7dd0-0x0;var _0x2356cc=_0xe2cf[_0x6b7dd0];return _0x2356cc;};'use strict';var _=require('lodash');var logger=require(_0xfe2c('0x0'))('agi');var verticesWithRetry=[_0xfe2c('0x1'),'getdigits',_0xfe2c('0x2')];var Graph=function(){this[_0xfe2c('0x3')]={};this[_0xfe2c('0x4')]={};this[_0xfe2c('0x5')]=0x0;};Graph['prototype'][_0xfe2c('0x6')]=function(_0x14674d){this['vertices'][_0x14674d['id']]=_0x14674d;this['edges'][_0x14674d['id']]=[];};Graph[_0xfe2c('0x7')][_0xfe2c('0x8')]=function(_0x5e5b46,_0x485a24,_0x30aafe){this[_0xfe2c('0x4')][_0x5e5b46][_0xfe2c('0x9')]({'target':_0x485a24,'condition':_0x30aafe});this['numberOfEdges']+=0x1;};Graph['prototype'][_0xfe2c('0xa')]=function(){return _[_0xfe2c('0xa')](this['vertices']);};Graph[_0xfe2c('0x7')][_0xfe2c('0xb')]=function(){return this[_0xfe2c('0x5')];};Graph[_0xfe2c('0x7')][_0xfe2c('0xc')]=function(_0x45aa82){return this[_0xfe2c('0x3')][_0x45aa82];};Graph['prototype']['traverseBFS']=function(_0x59ecf8,_0x48ddcc){if(!this[_0xfe2c('0x3')][_0x59ecf8]){return logger['info']('no\x20vertex\x20found');}var _0x38ba2c=_0x48ddcc(this[_0xfe2c('0x3')][_0x59ecf8]);if(!_0x38ba2c){return logger[_0xfe2c('0xd')](_0xfe2c('0xe'));}if(this['edges'][_0x59ecf8]['length']===0x0){return logger[_0xfe2c('0xd')](_0xfe2c('0xf'));}for(var _0x1dbed4=0x0,_0x56cebc=[],_0x565f40=![];_0x1dbed4\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','0.0.0.0','listening','connection','lodash','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./graph','nextTick','log','[LISTENING]\x20Cally\x20Square\x20listening\x200.0.0.0:4573','error','format','[%s]\x20%s','name','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','addVertex','length','addEdge','source','target','value','getSquareProject','then','catch','indexOf','agi_','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','debug','joinAt','YYYY-MM-DD\x20HH:mm:ss','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code'];(function(_0x31f467,_0x1b5d9d){var _0x2e5f5a=function(_0x30bbf7){while(--_0x30bbf7){_0x31f467['push'](_0x31f467['shift']());}};_0x2e5f5a(++_0x1b5d9d);}(_0xe8cf,0x16e));var _0xfe8c=function(_0x4b303a,_0x50361e){_0x4b303a=_0x4b303a-0x0;var _0x3d3f09=_0xe8cf[_0x4b303a];return _0x3d3f09;};'use strict';var parser=require('xml2json');var _=require(_0xfe8c('0x0'));var syncho=require(_0xfe8c('0x1'));var util=require(_0xfe8c('0x2'));var moment=require(_0xfe8c('0x3'));var config=require(_0xfe8c('0x4'));var logger=require(_0xfe8c('0x5'))(_0xfe8c('0x6'));var utilLicense=require(_0xfe8c('0x7'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xfe8c('0x8'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0xb5ce37){process[_0xfe8c('0x9')](function(){syncho(function(){try{setChannelVariables(_0xb5ce37);agiHandler(_0xb5ce37);}catch(_0x37fd04){logger['error'](_0x37fd04['stack']);}});});}function listeningHandler(_0x135035){console[_0xfe8c('0xa')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',0x11dd);logger['info'](_0xfe8c('0xb'));}function errorHandler(_0x37a1c2){if(_0x37a1c2&&_0x37a1c2['name']&&_0x37a1c2['message']){logger[_0xfe8c('0xc')](util[_0xfe8c('0xd')](_0xfe8c('0xe'),_0x37a1c2[_0xfe8c('0xf')],_0x37a1c2['message']));}else{logger[_0xfe8c('0xc')](util[_0xfe8c('0xd')](_0xfe8c('0x10'),_0x37a1c2[_0xfe8c('0x11')]));}}function closeHandler(){logger[_0xfe8c('0x12')](util['format'](_0xfe8c('0x13'),this[_0xfe8c('0x14')],this[_0xfe8c('0x15')],this[_0xfe8c('0x16')],this[_0xfe8c('0x17')],this[_0xfe8c('0x18')]));try{createSquareReport(this);}catch(_0x36418f){logger[_0xfe8c('0xc')](_0x36418f['stack']);}}function timeoutHandler(){logger[_0xfe8c('0x12')](util[_0xfe8c('0xd')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xfe8c('0x14')],this[_0xfe8c('0x15')],this[_0xfe8c('0x16')],this[_0xfe8c('0x17')],this[_0xfe8c('0x18')]));}function hangupHandler(){logger[_0xfe8c('0x12')](util['format'](_0xfe8c('0x19'),this[_0xfe8c('0x14')],this['calleridname'],this[_0xfe8c('0x16')],this[_0xfe8c('0x17')],this[_0xfe8c('0x18')]));this[_0xfe8c('0x1a')]=!![];}function getRoot(_0x3e5425){return parser[_0xfe8c('0x1b')](_0x3e5425,{'object':!![]})[_0xfe8c('0x1c')][_0xfe8c('0x1d')];}function addVertex(_0xf74597,_0x46360a,_0x7fd8ef){_0x46360a[_0xfe8c('0x1e')]=_0x7fd8ef;if(_0x46360a[_0xfe8c('0x1f')](_0xfe8c('0x20'))){_0x46360a['maxRetry']=parseInt(_0x46360a[_0xfe8c('0x20')],0xa);}_0xf74597[_0xfe8c('0x21')](_['omit'](_0x46360a,'mxCell'));}function initGraph(_0x27987e,_0x4eab15){var _0x1b4ddf=new Graph();for(var _0x4476f0 in _0x27987e){if(_0x27987e[_0xfe8c('0x1f')](_0x4476f0)){if(_['isArray'](_0x27987e[_0x4476f0])){for(var _0x1e35fe=0x0;_0x1e35fe<_0x27987e[_0x4476f0][_0xfe8c('0x22')];_0x1e35fe+=0x1){addVertex(_0x1b4ddf,_0x27987e[_0x4476f0][_0x1e35fe],_0x4476f0);}}else{addVertex(_0x1b4ddf,_0x27987e[_0x4476f0],_0x4476f0);}}}for(var _0x52964a=0x0;_0x52964a<_0x4eab15[_0xfe8c('0x22')];_0x52964a+=0x1){if(_0x4eab15[_0x52964a]['source']&&_0x4eab15[_0x52964a]['target']){_0x1b4ddf[_0xfe8c('0x23')](_0x4eab15[_0x52964a][_0xfe8c('0x24')],_0x4eab15[_0x52964a][_0xfe8c('0x25')],_0x4eab15[_0x52964a][_0xfe8c('0x26')]);}}return _0x1b4ddf;}function getSquareProject(_0x2bf732,_0x391253){rpc[_0xfe8c('0x27')](_0x2bf732)[_0xfe8c('0x28')](function(_0x3bfa8c){_0x391253(null,_0x3bfa8c);})[_0xfe8c('0x29')](function(_0x5e4ef8){_0x391253(null,_0x5e4ef8);});}function createSquareReport(_0x118032,_0xc62b3){rpc['createSquareReport'](_0x118032)['then'](function(_0x5ae576){if(_0xc62b3){_0xc62b3(null,_0x5ae576);}})[_0xfe8c('0x29')](function(_0x5520d5){if(_0xc62b3){_0xc62b3(null,_0x5520d5);}});}function setChannelVariables(_0xd588c8){for(var _0x27b7cb in _0xd588c8){if(_0xd588c8[_0xfe8c('0x1f')](_0x27b7cb)){if(_0x27b7cb[_0xfe8c('0x2a')](_0xfe8c('0x2b'))===0x0){_0xd588c8[_0x27b7cb['substring'](0x4)]=_0xd588c8[_0x27b7cb];delete _0xd588c8[_0x27b7cb];}}}}function getLogFromObject(_0x756860){return util['inspect'](_0x756860,{'showHidden':![],'depth':null});}function agiHandler(_0x4cf867){var _0x2f8d6c,_0x135850,_0x109443,_0x430b08,_0x418407;logger['debug']('variables',JSON[_0xfe8c('0x2c')](_0x4cf867,null,0x2));logger[_0xfe8c('0x12')](util[_0xfe8c('0xd')](_0xfe8c('0x2d'),_0x4cf867[_0xfe8c('0x14')],_0x4cf867[_0xfe8c('0x15')],_0x4cf867['callerid'],_0x4cf867['dnid'],_0x4cf867[_0xfe8c('0x18')]));_0x4cf867['on'](_0xfe8c('0xc'),errorHandler);_0x4cf867['on'](_0xfe8c('0x2e'),closeHandler);_0x4cf867['on']('timeout',timeoutHandler);_0x4cf867['evtHangup']=![];_0x4cf867['on'](_0xfe8c('0x2f'),hangupHandler);var _0x1e4846=getSquareProject[_0xfe8c('0x30')](null,_0x4cf867[_0xfe8c('0x14')]);if(_0x1e4846){if(_0x1e4846[_0xfe8c('0x31')]){_0x2f8d6c=getRoot(_0x1e4846['production']);if(_0x2f8d6c&&_0x2f8d6c['start']){logger[_0xfe8c('0x32')]('root',JSON[_0xfe8c('0x2c')](_0x2f8d6c,null,0x2));_0x4cf867[_0xfe8c('0x33')]=moment()[_0xfe8c('0xd')](_0xfe8c('0x34'));_0x135850=initGraph(_[_0xfe8c('0x35')](_0x2f8d6c,'mxCell'),_0x2f8d6c['mxCell']);_0x109443=new Vertices(_0x4cf867,rpc,mailRpc);logger[_0xfe8c('0x12')](util['format'](_0xfe8c('0x36'),_0x4cf867[_0xfe8c('0x14')],_0x4cf867[_0xfe8c('0x15')],_0x4cf867[_0xfe8c('0x16')],_0x4cf867[_0xfe8c('0x17')],_0x4cf867[_0xfe8c('0x18')]));_0x135850['traverseBFS'](_0x2f8d6c[_0xfe8c('0x37')]['id'],function(_0x3c73c7){try{_0x3c73c7=_0x109443[_0xfe8c('0x38')](_0x3c73c7);logger['debug'](_0xfe8c('0x39'),JSON[_0xfe8c('0x2c')](_0x3c73c7,null,0x2));if(_0x3c73c7[_0xfe8c('0x1e')]==='gotoc'){logger[_0xfe8c('0x12')](_0xfe8c('0x3a'));_0x4cf867[_0xfe8c('0x3b')]=_0x3c73c7[_0xfe8c('0x3b')]||_0x4cf867[_0xfe8c('0x3b')];_0x4cf867[_0xfe8c('0x3c')]=_0x3c73c7[_0xfe8c('0x3c')];_0x4cf867[_0xfe8c('0x3d')]=_0x3c73c7[_0xfe8c('0x3d')]?_0x3c73c7['priority']-0x1:0x1;return null;}else if(_0x3c73c7&&_0x109443[_0x3c73c7['agicommand']]){_0x418407=_0x109443[_0x3c73c7['agicommand']](_0x3c73c7);logger[_0xfe8c('0x12')](_0xfe8c('0x3e'),JSON[_0xfe8c('0x2c')](_0x418407,null,0x2));if(_0x418407&&_0x418407[_0xfe8c('0x3f')]===AGI_CODE_SUCCESS&&_0x418407[_0xfe8c('0x40')]!==AGI_RESULT_ERROR&&!_0x4cf867[_0xfe8c('0x1a')]){logger[_0xfe8c('0x32')]('response',getLogFromObject(_0x418407));return _[_0xfe8c('0x41')](_0x418407[_0xfe8c('0x40')])?null:_0x418407[_0xfe8c('0x40')][_0xfe8c('0x42')]();}else{logger[_0xfe8c('0xc')]('response',getLogFromObject(_0x418407));return null;}}else{logger['error'](_0xfe8c('0x43'));return null;}}catch(_0x2fd632){logger[_0xfe8c('0xc')](_0x2fd632[_0xfe8c('0x11')]);return null;}});if(_0x2f8d6c[_0xfe8c('0x44')]){logger[_0xfe8c('0x12')](util[_0xfe8c('0xd')](_0xfe8c('0x45'),_0x4cf867[_0xfe8c('0x14')],_0x4cf867[_0xfe8c('0x15')],_0x4cf867[_0xfe8c('0x16')],_0x4cf867[_0xfe8c('0x17')],_0x4cf867['uniqueid']));_0x135850[_0xfe8c('0x46')](_0x2f8d6c[_0xfe8c('0x44')]['id'],function(_0x548007){try{_0x548007=_0x109443[_0xfe8c('0x38')](_0x548007);logger[_0xfe8c('0x32')](_0xfe8c('0x39'),JSON[_0xfe8c('0x2c')](_0x548007,null,0x2));if(_0x548007&&_0x109443[_0x548007['agicommand']]){_0x418407=_0x109443[_0x548007[_0xfe8c('0x1e')]](_0x548007);if(_0x418407){logger['debug']('response',getLogFromObject(_0x418407));return _[_0xfe8c('0x41')](_0x418407[_0xfe8c('0x40')])?null:_0x418407['result'][_0xfe8c('0x42')]();}else{logger[_0xfe8c('0xc')]('response',getLogFromObject(_0x418407));return null;}}else{logger[_0xfe8c('0xc')](_0xfe8c('0x43'));return null;}}catch(_0x42562c){logger[_0xfe8c('0xc')](_0x42562c[_0xfe8c('0x11')]);return null;}});}logger[_0xfe8c('0x12')](util[_0xfe8c('0xd')](_0xfe8c('0x47'),_0x4cf867['arg_1'],_0x4cf867['calleridname'],_0x4cf867[_0xfe8c('0x16')],_0x4cf867[_0xfe8c('0x17')],_0x4cf867[_0xfe8c('0x18')]));logger[_0xfe8c('0x12')](util['format'](_0xfe8c('0x48'),_0x4cf867[_0xfe8c('0x3b')],_0x4cf867['extension'],parseInt(_0x4cf867[_0xfe8c('0x3d')],0xa)+0x1));_0x4cf867[_0xfe8c('0x49')](_0x4cf867[_0xfe8c('0x3b')],_0x4cf867[_0xfe8c('0x3c')],parseInt(_0x4cf867['priority'],0xa)+0x1);_0x4cf867[_0xfe8c('0x2e')]();}}else{logger['error'](util['format'](_0xfe8c('0x4a'),_0x4cf867['arg_1']));_0x4cf867[_0xfe8c('0x49')](_0x4cf867['context'],_0x4cf867[_0xfe8c('0x3c')],parseInt(_0x4cf867['priority'],0xa)+0x1);_0x4cf867[_0xfe8c('0x2e')]();}}else{logger['error'](util[_0xfe8c('0xd')]('Project\x20%s\x20not\x20found',_0x4cf867['arg_1']));_0x4cf867['continueAt'](_0x4cf867[_0xfe8c('0x3b')],_0x4cf867[_0xfe8c('0x3c')],parseInt(_0x4cf867[_0xfe8c('0x3d')],0xa)+0x1);_0x4cf867[_0xfe8c('0x2e')]();}}function main(){var _0x341aa8;return utilLicense[_0xfe8c('0x4b')]()[_0xfe8c('0x28')](function(_0x594d50){if(_0x594d50){if(_0x594d50[_0xfe8c('0x4c')]){if(_0x594d50[_0xfe8c('0x4d')]&&_0x594d50['callysquare']>0x0){logger[_0xfe8c('0x12')](util[_0xfe8c('0xd')](_0xfe8c('0x4e'),_0x594d50[_0xfe8c('0x4d')]));_0x341aa8=_0x594d50['callysquare'];}else{logger[_0xfe8c('0x12')](_0xfe8c('0x4f'));}}else{logger[_0xfe8c('0x12')](_0xfe8c('0x50'));_0x341aa8=-0x1;}}})['catch'](function(_0x2bbdab){logger[_0xfe8c('0xc')](_0xfe8c('0x51'),_0x2bbdab[_0xfe8c('0x11')]);})['finally'](function(){var _0x12624f=require(_0xfe8c('0x52'))(0x11dd,_0xfe8c('0x53'),_0x341aa8);_0x12624f['on']('error',errorHandler);_0x12624f['on'](_0xfe8c('0x54'),listeningHandler);_0x12624f['on'](_0xfe8c('0x55'),connectionHandler);_0x12624f['on'](_0xfe8c('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0xa4de=['production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','catch','[LICENSE]','./server','0.0.0.0','connection','xml2json','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./mailRpc','./graph','error','stack','log','info','[LISTENING]\x20Cally\x20Square\x20listening\x200.0.0.0:4573','name','message','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','length','source','target','getSquareProject','then','createSquareReport','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','sync'];(function(_0xe0c564,_0x2ff569){var _0x32e0f6=function(_0x3fd0fc){while(--_0x3fd0fc){_0xe0c564['push'](_0xe0c564['shift']());}};_0x32e0f6(++_0x2ff569);}(_0xa4de,0x17d));var _0xea4d=function(_0x33f69e,_0x4112ec){_0x33f69e=_0x33f69e-0x0;var _0x5f0972=_0xa4de[_0x33f69e];return _0x5f0972;};'use strict';var parser=require(_0xea4d('0x0'));var _=require('lodash');var syncho=require(_0xea4d('0x1'));var util=require(_0xea4d('0x2'));var moment=require(_0xea4d('0x3'));var config=require(_0xea4d('0x4'));var logger=require(_0xea4d('0x5'))(_0xea4d('0x6'));var utilLicense=require(_0xea4d('0x7'));var rpc=require(_0xea4d('0x8'));var mailRpc=require(_0xea4d('0x9'));var Graph=require(_0xea4d('0xa'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function connectionHandler(_0x244120){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x244120);agiHandler(_0x244120);}catch(_0x13ce8c){logger[_0xea4d('0xb')](_0x13ce8c[_0xea4d('0xc')]);}});});}function listeningHandler(_0x5b13c6){console[_0xea4d('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',0x11dd);logger[_0xea4d('0xe')](_0xea4d('0xf'));}function errorHandler(_0x5680de){if(_0x5680de&&_0x5680de[_0xea4d('0x10')]&&_0x5680de[_0xea4d('0x11')]){logger[_0xea4d('0xb')](util[_0xea4d('0x12')]('[%s]\x20%s',_0x5680de[_0xea4d('0x10')],_0x5680de[_0xea4d('0x11')]));}else{logger['error'](util[_0xea4d('0x12')](_0xea4d('0x13'),_0x5680de[_0xea4d('0xc')]));}}function closeHandler(){logger['info'](util[_0xea4d('0x12')](_0xea4d('0x14'),this[_0xea4d('0x15')],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this['dnid'],this[_0xea4d('0x18')]));try{createSquareReport(this);}catch(_0x53179e){logger[_0xea4d('0xb')](_0x53179e[_0xea4d('0xc')]);}}function timeoutHandler(){logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x19'),this['arg_1'],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this[_0xea4d('0x1a')],this[_0xea4d('0x18')]));}function hangupHandler(){logger[_0xea4d('0xe')](util['format'](_0xea4d('0x1b'),this[_0xea4d('0x15')],this[_0xea4d('0x16')],this[_0xea4d('0x17')],this['dnid'],this[_0xea4d('0x18')]));this['evtHangup']=!![];}function getRoot(_0x31ea06){return parser[_0xea4d('0x1c')](_0x31ea06,{'object':!![]})['mxGraphModel'][_0xea4d('0x1d')];}function addVertex(_0x259cd2,_0x49c878,_0x1d9423){_0x49c878[_0xea4d('0x1e')]=_0x1d9423;if(_0x49c878[_0xea4d('0x1f')](_0xea4d('0x20'))){_0x49c878[_0xea4d('0x21')]=parseInt(_0x49c878[_0xea4d('0x20')],0xa);}_0x259cd2[_0xea4d('0x22')](_[_0xea4d('0x23')](_0x49c878,'mxCell'));}function initGraph(_0x53c2e3,_0x4f5a22){var _0x5ba165=new Graph();for(var _0x383198 in _0x53c2e3){if(_0x53c2e3['hasOwnProperty'](_0x383198)){if(_['isArray'](_0x53c2e3[_0x383198])){for(var _0x4de874=0x0;_0x4de874<_0x53c2e3[_0x383198][_0xea4d('0x24')];_0x4de874+=0x1){addVertex(_0x5ba165,_0x53c2e3[_0x383198][_0x4de874],_0x383198);}}else{addVertex(_0x5ba165,_0x53c2e3[_0x383198],_0x383198);}}}for(var _0x2367be=0x0;_0x2367be<_0x4f5a22[_0xea4d('0x24')];_0x2367be+=0x1){if(_0x4f5a22[_0x2367be][_0xea4d('0x25')]&&_0x4f5a22[_0x2367be][_0xea4d('0x26')]){_0x5ba165['addEdge'](_0x4f5a22[_0x2367be][_0xea4d('0x25')],_0x4f5a22[_0x2367be]['target'],_0x4f5a22[_0x2367be]['value']);}}return _0x5ba165;}function getSquareProject(_0x493caf,_0x2d4bd6){rpc[_0xea4d('0x27')](_0x493caf)[_0xea4d('0x28')](function(_0x311008){_0x2d4bd6(null,_0x311008);})['catch'](function(_0x31f1f0){_0x2d4bd6(null,_0x31f1f0);});}function createSquareReport(_0x26cf04,_0x37c01f){rpc[_0xea4d('0x29')](_0x26cf04)[_0xea4d('0x28')](function(_0x3f9eb2){if(_0x37c01f){_0x37c01f(null,_0x3f9eb2);}})['catch'](function(_0x57ac9b){if(_0x37c01f){_0x37c01f(null,_0x57ac9b);}});}function setChannelVariables(_0x41ab04){for(var _0x3fd9da in _0x41ab04){if(_0x41ab04['hasOwnProperty'](_0x3fd9da)){if(_0x3fd9da[_0xea4d('0x2a')](_0xea4d('0x2b'))===0x0){_0x41ab04[_0x3fd9da[_0xea4d('0x2c')](0x4)]=_0x41ab04[_0x3fd9da];delete _0x41ab04[_0x3fd9da];}}}}function getLogFromObject(_0x583507){return util[_0xea4d('0x2d')](_0x583507,{'showHidden':![],'depth':null});}function agiHandler(_0x52bd9c){var _0x3f06c8,_0x34b3fc,_0x4f7f55,_0x5d088e,_0x5ce816;logger[_0xea4d('0x2e')](_0xea4d('0x2f'),JSON[_0xea4d('0x30')](_0x52bd9c,null,0x2));logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x31'),_0x52bd9c['arg_1'],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x52bd9c['on'](_0xea4d('0xb'),errorHandler);_0x52bd9c['on'](_0xea4d('0x32'),closeHandler);_0x52bd9c['on'](_0xea4d('0x33'),timeoutHandler);_0x52bd9c[_0xea4d('0x34')]=![];_0x52bd9c['on']('hangup',hangupHandler);var _0x25224c=getSquareProject[_0xea4d('0x35')](null,_0x52bd9c[_0xea4d('0x15')]);if(_0x25224c){if(_0x25224c[_0xea4d('0x36')]){_0x3f06c8=getRoot(_0x25224c[_0xea4d('0x36')]);if(_0x3f06c8&&_0x3f06c8[_0xea4d('0x37')]){logger[_0xea4d('0x2e')](_0xea4d('0x1d'),JSON[_0xea4d('0x30')](_0x3f06c8,null,0x2));_0x52bd9c[_0xea4d('0x38')]=moment()[_0xea4d('0x12')](_0xea4d('0x39'));_0x34b3fc=initGraph(_[_0xea4d('0x23')](_0x3f06c8,_0xea4d('0x3a')),_0x3f06c8[_0xea4d('0x3a')]);_0x4f7f55=new Vertices(_0x52bd9c,rpc,mailRpc);logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x3b'),_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x34b3fc[_0xea4d('0x3c')](_0x3f06c8[_0xea4d('0x37')]['id'],function(_0x5f6794){try{_0x5f6794=_0x4f7f55[_0xea4d('0x3d')](_0x5f6794);logger[_0xea4d('0x2e')]('vertex',JSON[_0xea4d('0x30')](_0x5f6794,null,0x2));if(_0x5f6794[_0xea4d('0x1e')]==='gotoc'){logger['info'](_0xea4d('0x3e'));_0x52bd9c[_0xea4d('0x3f')]=_0x5f6794['context']||_0x52bd9c[_0xea4d('0x3f')];_0x52bd9c[_0xea4d('0x40')]=_0x5f6794[_0xea4d('0x40')];_0x52bd9c[_0xea4d('0x41')]=_0x5f6794[_0xea4d('0x41')]?_0x5f6794[_0xea4d('0x41')]-0x1:0x1;return null;}else if(_0x5f6794&&_0x4f7f55[_0x5f6794[_0xea4d('0x1e')]]){_0x5ce816=_0x4f7f55[_0x5f6794[_0xea4d('0x1e')]](_0x5f6794);logger[_0xea4d('0xe')](_0xea4d('0x42'),JSON[_0xea4d('0x30')](_0x5ce816,null,0x2));if(_0x5ce816&&_0x5ce816[_0xea4d('0x43')]===AGI_CODE_SUCCESS&&_0x5ce816[_0xea4d('0x44')]!==AGI_RESULT_ERROR&&!_0x52bd9c['evtHangup']){logger[_0xea4d('0x2e')](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return _[_0xea4d('0x45')](_0x5ce816[_0xea4d('0x44')])?null:_0x5ce816['result'][_0xea4d('0x46')]();}else{logger[_0xea4d('0xb')](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return null;}}else{logger[_0xea4d('0xb')](_0xea4d('0x47'));return null;}}catch(_0x379691){logger[_0xea4d('0xb')](_0x379691[_0xea4d('0xc')]);return null;}});if(_0x3f06c8['finally']){logger[_0xea4d('0xe')](util[_0xea4d('0x12')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c['callerid'],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));_0x34b3fc['traverseBFS'](_0x3f06c8[_0xea4d('0x48')]['id'],function(_0x2fefc5){try{_0x2fefc5=_0x4f7f55[_0xea4d('0x3d')](_0x2fefc5);logger[_0xea4d('0x2e')](_0xea4d('0x49'),JSON[_0xea4d('0x30')](_0x2fefc5,null,0x2));if(_0x2fefc5&&_0x4f7f55[_0x2fefc5[_0xea4d('0x1e')]]){_0x5ce816=_0x4f7f55[_0x2fefc5[_0xea4d('0x1e')]](_0x2fefc5);if(_0x5ce816){logger['debug'](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return _[_0xea4d('0x45')](_0x5ce816[_0xea4d('0x44')])?null:_0x5ce816[_0xea4d('0x44')]['toString']();}else{logger['error'](_0xea4d('0x42'),getLogFromObject(_0x5ce816));return null;}}else{logger[_0xea4d('0xb')](_0xea4d('0x47'));return null;}}catch(_0x1f0793){logger[_0xea4d('0xb')](_0x1f0793[_0xea4d('0xc')]);return null;}});}logger[_0xea4d('0xe')](util['format'](_0xea4d('0x4a'),_0x52bd9c[_0xea4d('0x15')],_0x52bd9c[_0xea4d('0x16')],_0x52bd9c[_0xea4d('0x17')],_0x52bd9c[_0xea4d('0x1a')],_0x52bd9c[_0xea4d('0x18')]));logger[_0xea4d('0xe')](util[_0xea4d('0x12')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x52bd9c['context'],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c['priority'],0xa)+0x1));_0x52bd9c[_0xea4d('0x4b')](_0x52bd9c[_0xea4d('0x3f')],_0x52bd9c['extension'],parseInt(_0x52bd9c['priority'],0xa)+0x1);_0x52bd9c[_0xea4d('0x32')]();}}else{logger['error'](util[_0xea4d('0x12')](_0xea4d('0x4c'),_0x52bd9c[_0xea4d('0x15')]));_0x52bd9c[_0xea4d('0x4b')](_0x52bd9c['context'],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c['priority'],0xa)+0x1);_0x52bd9c['close']();}}else{logger[_0xea4d('0xb')](util[_0xea4d('0x12')](_0xea4d('0x4d'),_0x52bd9c[_0xea4d('0x15')]));_0x52bd9c['continueAt'](_0x52bd9c[_0xea4d('0x3f')],_0x52bd9c[_0xea4d('0x40')],parseInt(_0x52bd9c[_0xea4d('0x41')],0xa)+0x1);_0x52bd9c['close']();}}function main(){var _0x225b57;return utilLicense[_0xea4d('0x4e')]()['then'](function(_0xe256ec){if(_0xe256ec){if(_0xe256ec[_0xea4d('0x4f')]){if(_0xe256ec[_0xea4d('0x50')]&&_0xe256ec[_0xea4d('0x50')]>0x0){logger[_0xea4d('0xe')](util[_0xea4d('0x12')](_0xea4d('0x51'),_0xe256ec['callysquare']));_0x225b57=_0xe256ec[_0xea4d('0x50')];}else{logger[_0xea4d('0xe')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xea4d('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x225b57=-0x1;}}})[_0xea4d('0x52')](function(_0x32a8df){logger[_0xea4d('0xb')](_0xea4d('0x53'),_0x32a8df[_0xea4d('0xc')]);})['finally'](function(){var _0x39f9a5=require(_0xea4d('0x54'))(0x11dd,_0xea4d('0x55'),_0x225b57);_0x39f9a5['on'](_0xea4d('0xb'),errorHandler);_0x39f9a5['on']('listening',listeningHandler);_0x39f9a5['on'](_0xea4d('0x56'),connectionHandler);_0x39f9a5['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 1fe8442..11f74c1 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 _0x814b=['bluebird','jayson/promise','client','http','request','then','error','result','catch','sendMailMessage','SendMail'];(function(_0x595d61,_0x1e976b){var _0x108fb3=function(_0x596e4f){while(--_0x596e4f){_0x595d61['push'](_0x595d61['shift']());}};_0x108fb3(++_0x1e976b);}(_0x814b,0x1a2));var _0xb814=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0x814b[_0x4450b1];return _0x399b0b;};'use strict';var BPromise=require(_0xb814('0x0'));var jayson=require(_0xb814('0x1'));var client=jayson[_0xb814('0x2')][_0xb814('0x3')]({'port':0x232b});function request(_0xfbb64b,_0x477725){return new BPromise(function(_0x4a98af,_0x38c21a){return client[_0xb814('0x4')](_0xfbb64b,_0x477725)[_0xb814('0x5')](function(_0x4237bc){if(_0x4237bc[_0xb814('0x6')]){return _0x38c21a(_0x4237bc[_0xb814('0x6')]['message']);}else{return _0x4a98af(_0x4237bc[_0xb814('0x7')]);}})[_0xb814('0x8')](function(_0x5c8539){return _0x38c21a(_0x5c8539);});});}exports[_0xb814('0x9')]=function(_0x2913a6,_0x186d5a){return request(_0xb814('0xa'),{'account':_0x2913a6,'message':_0x186d5a});}; \ No newline at end of file +var _0x9957=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http','request','error','message'];(function(_0xe0eb54,_0x3e4d15){var _0x154c33=function(_0x578877){while(--_0x578877){_0xe0eb54['push'](_0xe0eb54['shift']());}};_0x154c33(++_0x3e4d15);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var client=jayson[_0x7995('0x2')][_0x7995('0x3')]({'port':0x232b});function request(_0x5b96eb,_0x86c128){return new BPromise(function(_0x3c58eb,_0x1902b4){return client[_0x7995('0x4')](_0x5b96eb,_0x86c128)['then'](function(_0x744bea){if(_0x744bea[_0x7995('0x5')]){return _0x1902b4(_0x744bea[_0x7995('0x5')][_0x7995('0x6')]);}else{return _0x3c58eb(_0x744bea[_0x7995('0x7')]);}})[_0x7995('0x8')](function(_0x4996ca){return _0x1902b4(_0x4996ca);});});}exports[_0x7995('0x9')]=function(_0x1cad37,_0x4a64f7){return request(_0x7995('0xa'),{'account':_0x1cad37,'message':_0x4a64f7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 0ce3b8f..cd98c48 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 _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x1caf3f,_0x1b4800){var _0x1905f0=function(_0x36e1eb){while(--_0x36e1eb){_0x1caf3f['push'](_0x1caf3f['shift']());}};_0x1905f0(++_0x1b4800);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4ffbb7,_0x38f910){_0x4ffbb7=_0x4ffbb7-0x0;var _0x465a10=_0x5f2f[_0x4ffbb7];return _0x465a10;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file +var _0x5f2f=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','substring','length','split','slice','trim','headers','indexOf','emit','line'];(function(_0x713076,_0x20c1e7){var _0x1dabdd=function(_0x39d9d4){while(--_0x39d9d4){_0x713076['push'](_0x713076['shift']());}};_0x1dabdd(++_0x20c1e7);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f5df4,_0x446e97){_0x2f5df4=_0x2f5df4-0x0;var _0x4c83ad=_0x5f2f[_0x2f5df4];return _0x4c83ad;};'use strict';var util=require(_0xf5f2('0x0'));var Transform=require(_0xf5f2('0x1'))[_0xf5f2('0x2')];function AGIReply(_0x1a7be1){Transform[_0xf5f2('0x3')](this,_0x1a7be1);this[_0xf5f2('0x4')]='';this[_0xf5f2('0x5')]=![];}util[_0xf5f2('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x1665c7,_0x192215,_0xad7f65){var _0x3eebf6='\x0a',_0x3133bc=['\x0a\x0a',_0xf5f2('0x7')],_0x473100=-0x1,_0x5907aa=-0x1,_0x466882='',_0x46cd9c=0x0,_0x2ec345='',_0x56a69f='';this[_0xf5f2('0x4')]+=_0x1665c7[_0xf5f2('0x8')]();_0x2ec345=this['_localBuffer'];if(!this[_0xf5f2('0x5')]){_0x46cd9c=0x0;while(_0x3133bc[_0x46cd9c]){while((_0x5907aa=_0x2ec345['indexOf'](_0x3133bc[_0x46cd9c]))!=-0x1){_0x466882=_0x3133bc[_0x46cd9c];_0x56a69f=_0x2ec345['substring'](0x0,_0x5907aa);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x5907aa+_0x466882[_0xf5f2('0xa')]);var _0x4b78cd=_0x56a69f[_0xf5f2('0xb')](_0x3eebf6),_0x336f6b=0x0,_0x14b51f={},_0x331482='',_0x3f2997='',_0x59bb6c=-0x1;while(_0x4b78cd[_0x336f6b]){_0x59bb6c=_0x4b78cd[_0x336f6b]['indexOf'](':');if(_0x59bb6c!=-0x1){_0x331482=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](0x0,_0x59bb6c)[_0xf5f2('0xd')]();_0x3f2997=_0x4b78cd[_0x336f6b][_0xf5f2('0xc')](_0x59bb6c+0x1)[_0xf5f2('0xd')]();if(_0x331482[_0xf5f2('0xa')]>0x0){_0x14b51f[_0x331482]=_0x3f2997;}}else{}_0x336f6b++;}this['emit'](_0xf5f2('0xe'),_0x14b51f);this[_0xf5f2('0x5')]=!![];}_0x46cd9c++;}this[_0xf5f2('0x4')]=_0x2ec345;}else{while((_0x473100=_0x2ec345[_0xf5f2('0xf')](_0x3eebf6))!=-0x1){_0x56a69f=_0x2ec345[_0xf5f2('0x9')](0x0,_0x473100);this[_0xf5f2('0x10')](_0xf5f2('0x11'),_0x56a69f);_0x2ec345=_0x2ec345[_0xf5f2('0x9')](_0x473100+_0x3eebf6[_0xf5f2('0xa')]);}this[_0xf5f2('0x4')]=_0x2ec345;}_0xad7f65();};module[_0xf5f2('0x12')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index b96cc48..e8a4f46 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 _0x165f=['createSquareReport','CreateSquareReport','arg_2','YYYY-MM-DD\x20HH:mm:ss','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','agentUnpause','agentLogout','LogoutUser','bluebird','lodash','jayson/promise','client','then','error','message','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x165f,0x6b));var _0xf165=function(_0x5ed3cb,_0x12c05f){_0x5ed3cb=_0x5ed3cb-0x0;var _0x462aee=_0x165f[_0x5ed3cb];return _0x462aee;};'use strict';var BPromise=require(_0xf165('0x0'));var moment=require('moment');var _=require(_0xf165('0x1'));var util=require('util');var jayson=require(_0xf165('0x2'));var client=jayson[_0xf165('0x3')]['http']({'port':0x2329});function request(_0x401506,_0x32d1f7){return new BPromise(function(_0x110d3e,_0x2f6be9){return client['request'](_0x401506,_0x32d1f7)[_0xf165('0x4')](function(_0x1764ae){if(_0x1764ae[_0xf165('0x5')]){return _0x2f6be9(_0x1764ae[_0xf165('0x5')][_0xf165('0x6')]);}else{return _0x110d3e(_0x1764ae['result']);}})['catch'](function(_0x12ffde){return _0x2f6be9(_0x12ffde);});});}exports[_0xf165('0x7')]=function(_0x4bf767){return request(_0xf165('0x8'),{'options':{'raw':![],'where':{'name':_0x4bf767},'attributes':['production']}});};exports[_0xf165('0x9')]=function(_0x4a82f3){return request(_0xf165('0xa'),{'options':{'raw':![],'where':{'id':_0x4a82f3},'include':[{'model':'MailServerOut','as':_0xf165('0xb')}],'attributes':['id',_0xf165('0xc'),'email']}});};exports['getSquareProjectById']=function(_0x186f0c){return request(_0xf165('0x8'),{'options':{'where':{'id':_0x186f0c},'attributes':['name']}});};exports[_0xf165('0xd')]=function(_0x5a9c2c){return request(_0xf165('0xe'),{'options':{'where':{'id':_0x5a9c2c},'attributes':['name']}});};exports[_0xf165('0xf')]=function(_0x19169e){return request(_0xf165('0x10'),{'options':{'where':{'id':_0x19169e},'attributes':[_0xf165('0xc')]}});};exports[_0xf165('0x11')]=function(_0x34d214){return request(_0xf165('0x12'),{'options':{'where':{'id':_0x34d214},'attributes':['dsn']}});};exports[_0xf165('0x13')]=function(_0x53aa68){return request('ShowUser',{'options':{'where':{'id':_0x53aa68},'attributes':['name']}});};exports['getTrunkById']=function(_0x345d13){return request('ShowTrunk',{'options':{'where':{'id':_0x345d13},'attributes':[_0xf165('0xc')]}});};exports[_0xf165('0x14')]=function(_0x3e8e48){return request(_0xf165('0x15'),{'options':{'where':{'id':_0x3e8e48},'attributes':[_0xf165('0x16')]}});};exports[_0xf165('0x17')]=function(_0x5c024c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5c024c},'include':[{'model':_0xf165('0x18'),'as':_0xf165('0x19')}]}});};exports[_0xf165('0x1a')]=function(_0x5e432e){return request(_0xf165('0x1b'),{'options':{'where':{'id':_0x5e432e},'attributes':['id',_0xf165('0xc')]}});};exports['createSmsMessage']=function(_0x250712){return request(_0xf165('0x1c'),{'body':_0x250712});};exports[_0xf165('0x1d')]=function(_0x2d00b5){return request(_0xf165('0x1e'),{'body':_0x2d00b5});};exports[_0xf165('0x1f')]=function(_0x3a510f){return request(_0xf165('0x20'),{'body':_['merge'](_0x3a510f,{'project_name':_0x3a510f['arg_1'],'prev_project_name':_0x3a510f[_0xf165('0x21')]||'','is_subproject':_0x3a510f['arg_2']?!![]:![],'leaveAt':moment()['format'](_0xf165('0x22'))})});};exports['createSquareRecording']=function(_0x19b8b1){return request('CreateSquareRecording',{'body':_0x19b8b1});};exports[_0xf165('0x23')]=function(_0x4ad7c6){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x4ad7c6[_0xf165('0x24')],'ListId':_0x4ad7c6[_0xf165('0x25')]}}})[_0xf165('0x4')](function(_0x124217){if(_0x124217){return _0x124217;}return request('CreateCmContact',{'body':_0x4ad7c6});});};exports[_0xf165('0x26')]=function(_0x5935bd){return request(_0xf165('0x27'),{'options':{'where':{'id':_0x5935bd},'attributes':[_0xf165('0xc')]}});};exports[_0xf165('0x28')]=function(_0x19e7d2,_0x2084e7){return request(_0xf165('0x29'),{'body':{'interface':_0x2084e7},'options':{'where':_0x19e7d2}});};exports[_0xf165('0x2a')]=function(_0x414277,_0x4ffcf4,_0x60f57a){return request('PauseUser',{'body':{'type':_0x4ffcf4,'uniqueid':_0x60f57a},'options':{'where':_0x414277}});};exports[_0xf165('0x2b')]=function(_0x5b9863){return request('UnpauseUser',{'body':{},'options':{'where':_0x5b9863}});};exports[_0xf165('0x2c')]=function(_0xbaf096){return request(_0xf165('0x2d'),{'body':{},'options':{'where':_0xbaf096}});}; \ No newline at end of file +var _0x4cc4=['http','then','error','message','result','catch','ShowSquareProject','getMailAccountById','Smtp','email','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','dsn','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client'];(function(_0x2e4830,_0x20e63b){var _0x1f89a2=function(_0x24d30a){while(--_0x24d30a){_0x2e4830['push'](_0x2e4830['shift']());}};_0x1f89a2(++_0x20e63b);}(_0x4cc4,0x6f));var _0x44cc=function(_0x262b1a,_0x31df4c){_0x262b1a=_0x262b1a-0x0;var _0x20855f=_0x4cc4[_0x262b1a];return _0x20855f;};'use strict';var BPromise=require('bluebird');var moment=require(_0x44cc('0x0'));var _=require(_0x44cc('0x1'));var util=require(_0x44cc('0x2'));var jayson=require(_0x44cc('0x3'));var client=jayson[_0x44cc('0x4')][_0x44cc('0x5')]({'port':0x2329});function request(_0xa040e0,_0x156ec6){return new BPromise(function(_0x3e1b64,_0x42a30e){return client['request'](_0xa040e0,_0x156ec6)[_0x44cc('0x6')](function(_0x199830){if(_0x199830[_0x44cc('0x7')]){return _0x42a30e(_0x199830[_0x44cc('0x7')][_0x44cc('0x8')]);}else{return _0x3e1b64(_0x199830[_0x44cc('0x9')]);}})[_0x44cc('0xa')](function(_0x3d7f61){return _0x42a30e(_0x3d7f61);});});}exports['getSquareProject']=function(_0x301abe){return request(_0x44cc('0xb'),{'options':{'raw':![],'where':{'name':_0x301abe},'attributes':['production']}});};exports[_0x44cc('0xc')]=function(_0x18cb93){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x18cb93},'include':[{'model':'MailServerOut','as':_0x44cc('0xd')}],'attributes':['id','name',_0x44cc('0xe')]}});};exports[_0x44cc('0xf')]=function(_0x3e6b02){return request(_0x44cc('0xb'),{'options':{'where':{'id':_0x3e6b02},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x11')]=function(_0x16cf98){return request(_0x44cc('0x12'),{'options':{'where':{'id':_0x16cf98},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x13')]=function(_0x86aed1){return request(_0x44cc('0x14'),{'options':{'where':{'id':_0x86aed1},'attributes':[_0x44cc('0x10')]}});};exports['getSquareOdbcById']=function(_0x411156){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x411156},'attributes':[_0x44cc('0x15')]}});};exports['getUserById']=function(_0x29dd4e){return request(_0x44cc('0x16'),{'options':{'where':{'id':_0x29dd4e},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x17')]=function(_0x5b883f){return request(_0x44cc('0x18'),{'options':{'where':{'id':_0x5b883f},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x19')]=function(_0xea90c5){return request(_0x44cc('0x1a'),{'options':{'where':{'id':_0xea90c5},'attributes':[_0x44cc('0x1b')]}});};exports[_0x44cc('0x1c')]=function(_0xdbcd13){return request(_0x44cc('0x1d'),{'options':{'raw':![],'where':{'id':_0xdbcd13},'include':[{'model':_0x44cc('0x1e'),'as':_0x44cc('0x1f')}]}});};exports[_0x44cc('0x20')]=function(_0x42d3c3){return request(_0x44cc('0x21'),{'options':{'where':{'id':_0x42d3c3},'attributes':['id','name']}});};exports[_0x44cc('0x22')]=function(_0x27b6a4){return request(_0x44cc('0x23'),{'body':_0x27b6a4});};exports[_0x44cc('0x24')]=function(_0x43269a){return request(_0x44cc('0x25'),{'body':_0x43269a});};exports[_0x44cc('0x26')]=function(_0x16bf15){return request(_0x44cc('0x27'),{'body':_[_0x44cc('0x28')](_0x16bf15,{'project_name':_0x16bf15[_0x44cc('0x29')],'prev_project_name':_0x16bf15[_0x44cc('0x2a')]||'','is_subproject':_0x16bf15[_0x44cc('0x2a')]?!![]:![],'leaveAt':moment()[_0x44cc('0x2b')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x44cc('0x2c')]=function(_0x47e046){return request(_0x44cc('0x2d'),{'body':_0x47e046});};exports['createCmContact']=function(_0xf63c68){return request(_0x44cc('0x2e'),{'options':{'raw':![],'where':{'phone':_0xf63c68['phone'],'ListId':_0xf63c68[_0x44cc('0x2f')]}}})[_0x44cc('0x6')](function(_0x49dea0){if(_0x49dea0){return _0x49dea0;}return request(_0x44cc('0x30'),{'body':_0xf63c68});});};exports[_0x44cc('0x31')]=function(_0xd84de3){return request(_0x44cc('0x32'),{'options':{'where':{'id':_0xd84de3},'attributes':[_0x44cc('0x10')]}});};exports[_0x44cc('0x33')]=function(_0xc2e36d,_0x3a4788){return request('LoginUser',{'body':{'interface':_0x3a4788},'options':{'where':_0xc2e36d}});};exports[_0x44cc('0x34')]=function(_0x50307f,_0x1dfaf3,_0x5eec3a){return request(_0x44cc('0x35'),{'body':{'type':_0x1dfaf3,'uniqueid':_0x5eec3a},'options':{'where':_0x50307f}});};exports[_0x44cc('0x36')]=function(_0x4b6b8b){return request(_0x44cc('0x37'),{'body':{},'options':{'where':_0x4b6b8b}});};exports[_0x44cc('0x38')]=function(_0x421708){return request(_0x44cc('0x39'),{'body':{},'options':{'where':_0x421708}});}; \ 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 95d9688..074c214 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 _0x2833=['./polly','exports'];(function(_0x9d3477,_0x51f706){var _0x359de4=function(_0x2645c3){while(--_0x2645c3){_0x9d3477['push'](_0x9d3477['shift']());}};_0x359de4(++_0x51f706);}(_0x2833,0xd0));var _0x3283=function(_0x2901de,_0x360b50){_0x2901de=_0x2901de-0x0;var _0x1f619c=_0x2833[_0x2901de];return _0x1f619c;};var polly=require(_0x3283('0x0'));module[_0x3283('0x1')]={'polly':polly}; \ No newline at end of file +var _0x4d28=['exports'];(function(_0x3ae5be,_0x531ec8){var _0x3ebd88=function(_0x4d312a){while(--_0x4d312a){_0x3ae5be['push'](_0x3ae5be['shift']());}};_0x3ebd88(++_0x531ec8);}(_0x4d28,0x19c));var _0x84d2=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x4d28[_0x421196];return _0x2738af;};var polly=require('./polly');module[_0x84d2('0x0')]={'polly':polly}; \ 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 34f55e6..0700739 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7ff=['exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb7ff,0x79));var _0xfb7f=function(_0x3e8d23,_0x508ea0){_0x3e8d23=_0x3e8d23-0x0;var _0x4b1d50=_0xb7ff[_0x3e8d23];return _0x4b1d50;};'use strict';var polly=require('./lib/api');module[_0xfb7f('0x0')]=function(_0x24db2c,_0xbcca64,_0x2f64e1,_0x4c8165,_0x7d1d9c,_0x210ab8,_0x4a5de9){return polly(_0x24db2c,_0xbcca64,_0x2f64e1,_0x4c8165,_0x7d1d9c,_0x210ab8,_0x4a5de9);}; \ No newline at end of file +var _0xdc89=['./lib/api'];(function(_0x50732f,_0x1afe00){var _0x3ea804=function(_0x51de7c){while(--_0x51de7c){_0x50732f['push'](_0x50732f['shift']());}};_0x3ea804(++_0x1afe00);}(_0xdc89,0x9d));var _0x9dc8=function(_0x1ade10,_0x1c8f0d){_0x1ade10=_0x1ade10-0x0;var _0x432d4d=_0xdc89[_0x1ade10];return _0x432d4d;};'use strict';var polly=require(_0x9dc8('0x0'));module['exports']=function(_0x318280,_0x341f0b,_0x57d79e,_0x2b4f30,_0x4a560b,_0x20b98c,_0x3f0ab1){return polly(_0x318280,_0x341f0b,_0x57d79e,_0x2b4f30,_0x4a560b,_0x20b98c,_0x3f0ab1);}; \ 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 24b6dc5..5d85c8e 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 _0x70a4=['Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x25eee5,_0x397933){var _0x49a41f=function(_0x135a66){while(--_0x135a66){_0x25eee5['push'](_0x25eee5['shift']());}};_0x49a41f(++_0x397933);}(_0x70a4,0x67));var _0x470a=function(_0x1397ff,_0x37de78){_0x1397ff=_0x1397ff-0x0;var _0x5b94bc=_0x70a4[_0x1397ff];return _0x5b94bc;};'use strict';var fs=require('fs');var path=require(_0x470a('0x0'));var BPromise=require(_0x470a('0x1'));var rs=require(_0x470a('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4b0d91,_0x33ce33,_0x5590c){return new BPromise(function(_0x3c447b,_0x1e21d4){_0x4b0d91[_0x470a('0x3')](_0x33ce33,function(_0x5afba2,_0x413488){if(_0x5afba2){_0x1e21d4(_0x5afba2);}else if(_0x413488){if(_0x413488[_0x470a('0x4')]instanceof Buffer){fs['writeFile'](_0x5590c,_0x413488[_0x470a('0x4')],function(_0x425a4b){if(_0x425a4b){_0x1e21d4(_0x425a4b);}else{_0x3c447b();}});}else{_0x1e21d4(new Error(_0x470a('0x5')));}}else{_0x1e21d4(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x470a('0x6')]=function(_0x23437c,_0x296cb0,_0x592bad,_0x291cea,_0x90b5e2,_0x34c38e,_0x24751f){var _0x414d44=new AWS[(_0x470a('0x7'))]({'accessKeyId':_0x23437c,'secretAccessKey':_0x296cb0,'region':_0x592bad});var _0x5a2261={'Text':_0x90b5e2,'TextType':_0x34c38e||_0x470a('0x8'),'OutputFormat':_0x470a('0x9'),'VoiceId':_0x291cea};return pollyResult(_0x414d44,_0x5a2261,_0x24751f);}; \ No newline at end of file +var _0x8b43=['randomstring','aws-sdk','synthesizeSpeech','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x8b43,0x149));var _0x38b4=function(_0x4e85f4,_0x14797a){_0x4e85f4=_0x4e85f4-0x0;var _0x124c5d=_0x8b43[_0x4e85f4];return _0x124c5d;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x38b4('0x0'));var rs=require(_0x38b4('0x1'));var AWS=require(_0x38b4('0x2'));function pollyResult(_0x4479de,_0x39cc5a,_0x250aba){return new BPromise(function(_0x5cb674,_0x52eaaf){_0x4479de[_0x38b4('0x3')](_0x39cc5a,function(_0x3601b6,_0x311c32){if(_0x3601b6){_0x52eaaf(_0x3601b6);}else if(_0x311c32){if(_0x311c32['AudioStream']instanceof Buffer){fs[_0x38b4('0x4')](_0x250aba,_0x311c32['AudioStream'],function(_0x149fdd){if(_0x149fdd){_0x52eaaf(_0x149fdd);}else{_0x5cb674();}});}else{_0x52eaaf(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x52eaaf(new Error(_0x38b4('0x5')));}});});}module[_0x38b4('0x6')]=function(_0x1906fb,_0x5e02d4,_0x344c57,_0x5533a2,_0x5dcc91,_0x585124,_0x327a71){var _0x2591a6=new AWS[(_0x38b4('0x7'))]({'accessKeyId':_0x1906fb,'secretAccessKey':_0x5e02d4,'region':_0x344c57});var _0x238ce6={'Text':_0x5dcc91,'TextType':_0x585124||_0x38b4('0x8'),'OutputFormat':_0x38b4('0x9'),'VoiceId':_0x5533a2};return pollyResult(_0x2591a6,_0x238ce6,_0x327a71);}; \ 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 949071e..756dbf4 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 _0x7461=['exports','./lib/api'];(function(_0x252335,_0x679316){var _0x2a177b=function(_0x2e9504){while(--_0x2e9504){_0x252335['push'](_0x252335['shift']());}};_0x2a177b(++_0x679316);}(_0x7461,0xdb));var _0x1746=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0x7461[_0x1b25c1];return _0x1e4447;};'use strict';var asr=require(_0x1746('0x0'));module[_0x1746('0x1')]=function(_0x334a0d,_0x4a2415,_0x2fc60c,_0x5b396e){return asr(_0x334a0d,_0x4a2415,_0x2fc60c);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x2a2bdf,_0x2fc457,_0x27ad29,_0x204232){return asr(_0x2a2bdf,_0x2fc457,_0x27ad29);}; \ 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 23d5175..2afee6a 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 _0xb153=['url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','readFileSync','toString','POST','LINEAR16'];(function(_0x221625,_0x2bc87a){var _0x536216=function(_0x11af84){while(--_0x11af84){_0x221625['push'](_0x221625['shift']());}};_0x536216(++_0x2bc87a);}(_0xb153,0x1b0));var _0x3b15=function(_0x44674f,_0x2bd0f1){_0x44674f=_0x44674f-0x0;var _0x310dce=_0xb153[_0x44674f];return _0x310dce;};'use strict';var url=require(_0x3b15('0x0'));var BPromise=require(_0x3b15('0x1'));var fs=require('fs');var host=_0x3b15('0x2');module[_0x3b15('0x3')]=function(_0x89e505,_0x19368a,_0x33493e){return new BPromise(function(_0x282a3d,_0x10bb5c){var _0x2a573f;if(typeof _0x89e505!=='string'||_0x89e505[_0x3b15('0x4')]===0x0){return _0x10bb5c(_0x3b15('0x5'));}if(typeof _0x19368a!==_0x3b15('0x6')||_0x19368a[_0x3b15('0x4')]===0x0){return _0x10bb5c('key\x20should\x20be\x20a\x20string');}if(typeof _0x33493e!==_0x3b15('0x7')&&(typeof _0x33493e!==_0x3b15('0x6')||_0x33493e[_0x3b15('0x4')]===0x0)){return _0x10bb5c('lang\x20should\x20be\x20a\x20string');}try{_0x2a573f=fs[_0x3b15('0x8')](_0x89e505)[_0x3b15('0x9')]('base64');}catch(_0x57b1b0){return _0x10bb5c(_0x57b1b0);}return _0x282a3d({'method':_0x3b15('0xa'),'uri':host+'/v1/speech:recognize?key='+_0x19368a,'body':{'config':{'encoding':_0x3b15('0xb'),'sampleRateHertz':'8000','languageCode':_0x33493e},'audio':{'content':_0x2a573f}},'json':!![]});});}; \ No newline at end of file +var _0x24d4=['bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST','/v1/speech:recognize?key=','url'];(function(_0x39c341,_0x2f47ff){var _0x58f61e=function(_0x101e79){while(--_0x101e79){_0x39c341['push'](_0x39c341['shift']());}};_0x58f61e(++_0x2f47ff);}(_0x24d4,0x110));var _0x424d=function(_0x585d09,_0x1274bc){_0x585d09=_0x585d09-0x0;var _0x7d9a14=_0x24d4[_0x585d09];return _0x7d9a14;};'use strict';var url=require(_0x424d('0x0'));var BPromise=require(_0x424d('0x1'));var fs=require('fs');var host=_0x424d('0x2');module[_0x424d('0x3')]=function(_0x630299,_0x5aa529,_0x18bf81){return new BPromise(function(_0x24bdc9,_0x18a698){var _0x324c71;if(typeof _0x630299!=='string'||_0x630299[_0x424d('0x4')]===0x0){return _0x18a698(_0x424d('0x5'));}if(typeof _0x5aa529!=='string'||_0x5aa529[_0x424d('0x4')]===0x0){return _0x18a698('key\x20should\x20be\x20a\x20string');}if(typeof _0x18bf81!==_0x424d('0x6')&&(typeof _0x18bf81!==_0x424d('0x7')||_0x18bf81[_0x424d('0x4')]===0x0)){return _0x18a698(_0x424d('0x8'));}try{_0x324c71=fs[_0x424d('0x9')](_0x630299)[_0x424d('0xa')]('base64');}catch(_0x14204e){return _0x18a698(_0x14204e);}return _0x24bdc9({'method':_0x424d('0xb'),'uri':host+_0x424d('0xc')+_0x5aa529,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x18bf81},'audio':{'content':_0x324c71}},'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 4b99be0..3ecf004 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 _0xa9e0=['exports','./asr'];(function(_0xda6ea2,_0x1c7b7b){var _0x454bca=function(_0x428a10){while(--_0x428a10){_0xda6ea2['push'](_0xda6ea2['shift']());}};_0x454bca(++_0x1c7b7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};var asr=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'asr':asr}; \ No newline at end of file +var _0xedd9=['exports'];(function(_0x14bd69,_0x4484ad){var _0x195142=function(_0x8027c4){while(--_0x8027c4){_0x14bd69['push'](_0x14bd69['shift']());}};_0x195142(++_0x4484ad);}(_0xedd9,0xfc));var _0x9edd=function(_0x4bdee8,_0x5d5a8e){_0x4bdee8=_0x4bdee8-0x0;var _0x35eda4=_0xedd9[_0x4bdee8];return _0x35eda4;};var asr=require('./asr');module[_0x9edd('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 00775b8..cada235 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 _0x8c0d=['transcode','wav','error\x20convert','info','finish\x20to\x20convert','start','readFileSync','base64','googleTTS','then','tmp','generate','.mp3','chmodSync','777','goggleTTS\x20path','split','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','action','actionIncomplete','fulfillment','speech','score','status','code','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','resolve','.wav','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','dirName','path','http','https','url','parse','bluebird','request-promise','util','querystring','moment','google-tts-api','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','https:'];(function(_0x448a6f,_0x449ed3){var _0x354ae3=function(_0xdf3bd1){while(--_0xdf3bd1){_0x448a6f['push'](_0x448a6f['shift']());}};_0x354ae3(++_0x449ed3);}(_0x8c0d,0x1ee));var _0xd8c0=function(_0x45c417,_0x555d7b){_0x45c417=_0x45c417-0x0;var _0x3c88da=_0x8c0d[_0x45c417];return _0x3c88da;};'use strict';var fs=require('fs');var path=require(_0xd8c0('0x0'));var http=require(_0xd8c0('0x1'));var https=require(_0xd8c0('0x2'));var urlParse=require(_0xd8c0('0x3'))[_0xd8c0('0x4')];var BPromise=require(_0xd8c0('0x5'));var rs=require('randomstring');var sox=require('sox');var rp=require(_0xd8c0('0x6'));var util=require(_0xd8c0('0x7'));var querystring=require(_0xd8c0('0x8'));var moment=require(_0xd8c0('0x9'));var tts=require(_0xd8c0('0xa'));var apiai=require('apiai-promise');var google=require('./google');var aws=require(_0xd8c0('0xb'));var tilde=require(_0xd8c0('0xc'));var logger=require(_0xd8c0('0xd'))(_0xd8c0('0xe'));var ISPEECH_API=_0xd8c0('0xf');function downloadFile(_0x3ad298,_0x124ab3){return new BPromise(function(_0x101b41,_0x524ff0){var _0x5670c6=urlParse(_0x3ad298);var _0xe47030=_0x5670c6[_0xd8c0('0x10')]==='https:'?https:http;var _0x51e77e={'host':_0x5670c6[_0xd8c0('0x11')],'path':_0x5670c6[_0xd8c0('0x0')],'headers':{'user-agent':_0xd8c0('0x12')}};_0xe47030[_0xd8c0('0x13')](_0x51e77e,function(_0x756f36){if(_0x756f36[_0xd8c0('0x14')]!==0xc8){logger[_0xd8c0('0x15')](_0xd8c0('0x16')+_0x3ad298+_0xd8c0('0x17')+_0x756f36[_0xd8c0('0x14')]+'\x20('+_0x756f36[_0xd8c0('0x18')]+')');_0x524ff0(new Error('request\x20to\x20'+_0x3ad298+_0xd8c0('0x17')+_0x756f36['statusCode']+'\x20('+_0x756f36['statusMessage']+')'));return;}var _0x17560c=fs[_0xd8c0('0x19')](_0x124ab3);_0x17560c['on'](_0xd8c0('0x1a'),function(){logger['info'](_0xd8c0('0x1b'));_0x17560c[_0xd8c0('0x1c')](_0x101b41);});_0x17560c['on'](_0xd8c0('0x15'),function(_0x4771b0){fs[_0xd8c0('0x1d')](_0x124ab3);logger['error'](_0xd8c0('0x1e'),_0x4771b0);_0x524ff0(_0x4771b0);});_0x756f36[_0xd8c0('0x1f')](_0x17560c);})['on'](_0xd8c0('0x15'),function(_0x2c312a){logger[_0xd8c0('0x15')](_0x2c312a);_0x524ff0(_0x2c312a);})[_0xd8c0('0x20')]();});}function uploadFile(_0x3c3960){return new BPromise(function(_0x231653,_0x475731){var _0x42dfbc=urlParse(_0x3c3960);var _0x41a331=_0x42dfbc[_0xd8c0('0x10')]===_0xd8c0('0x21')?https:http;var _0x478fe9={'host':_0x42dfbc[_0xd8c0('0x11')],'path':_0x42dfbc[_0xd8c0('0x0')],'headers':{'user-agent':_0xd8c0('0x12')}};_0x41a331[_0xd8c0('0x13')](_0x478fe9,function(_0x27d3ef){if(_0x27d3ef[_0xd8c0('0x14')]!==0xc8){_0x475731(new Error(_0xd8c0('0x16')+_0x3c3960+_0xd8c0('0x17')+_0x27d3ef[_0xd8c0('0x14')]+'\x20('+_0x27d3ef[_0xd8c0('0x18')]+')'));return;}var _0x1278e6='';_0x27d3ef['on']('data',function(_0x4ef1c2){_0x1278e6+=_0x4ef1c2;});_0x27d3ef['on'](_0xd8c0('0x20'),function(){_0x231653(_0x1278e6);});})['on'](_0xd8c0('0x15'),function(_0x5b4b4c){_0x475731(_0x5b4b4c);})[_0xd8c0('0x20')]();});}function convertFile(_0x161f61,_0x300321){return new BPromise(function(_0x4ce330,_0x115002){var _0x159400=sox[_0xd8c0('0x22')](_0x161f61,_0x300321,{'sampleRate':0x1f40,'format':_0xd8c0('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x159400['on'](_0xd8c0('0x15'),function(_0x5a3197){logger[_0xd8c0('0x15')](_0xd8c0('0x24'),_0x5a3197);_0x115002(_0x5a3197);});_0x159400['on'](_0xd8c0('0x20'),function(){logger[_0xd8c0('0x25')](_0xd8c0('0x26'));_0x4ce330();});_0x159400[_0xd8c0('0x27')]();});}function base64Encode(_0x3651ae){var _0x2a68d4=fs[_0xd8c0('0x28')](_0x3651ae);return new Buffer(_0x2a68d4)['toString'](_0xd8c0('0x29'));}exports[_0xd8c0('0x2a')]=function(_0x2b97e5,_0x380ba0){var _0x1743be,_0xcc36f0;return tts(_0x2b97e5,_0x380ba0||'en',0x1)[_0xd8c0('0x2b')](function(_0x4deb21){logger[_0xd8c0('0x25')](_0x4deb21);_0x1743be=path['resolve'](__dirname,_0xd8c0('0x2c'),rs[_0xd8c0('0x2d')](0x4)+_0xd8c0('0x2e'));return downloadFile(_0x4deb21,_0x1743be);})[_0xd8c0('0x2b')](function(){_0xcc36f0=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x1743be,_0xcc36f0);})['then'](function(){try{fs[_0xd8c0('0x1d')](_0x1743be);fs[_0xd8c0('0x2f')](_0xcc36f0,_0xd8c0('0x30'));}catch(_0x49410e){logger[_0xd8c0('0x15')](_0x49410e);}logger[_0xd8c0('0x25')](_0xd8c0('0x31'),_0xcc36f0[_0xd8c0('0x32')]('.')[0x0]);return _0xcc36f0[_0xd8c0('0x32')]('.')[0x0];});};exports['googleASR']=function(_0x406879,_0xd67fef,_0x39c08a){return google['asr'](_0x406879,_0xd67fef,_0x39c08a)[_0xd8c0('0x2b')](function(_0x2c70cd){logger[_0xd8c0('0x25')](_0x2c70cd[_0xd8c0('0x33')]);return rp(_0x2c70cd);})['then'](function(_0xe3b5a3){var _0x5ab2ae='';var _0x1760a0=0x0;try{fs[_0xd8c0('0x1d')](_0x406879);}catch(_0x11bc6d){logger[_0xd8c0('0x15')](_0x11bc6d);}if(_0xe3b5a3&&_0xe3b5a3[_0xd8c0('0x34')]){_0x5ab2ae=_0xe3b5a3['results']['map'](function(_0x2a124e){return _0x2a124e&&_0x2a124e['alternatives'][0x0]&&_0x2a124e['alternatives'][0x0]['transcript']?_0x2a124e[_0xd8c0('0x35')][0x0][_0xd8c0('0x36')]:'';})['join']('\x0a');_0x1760a0=_0xe3b5a3[_0xd8c0('0x34')][_0xd8c0('0x37')](function(_0x45be64){return _0x45be64&&_0x45be64[_0xd8c0('0x35')][0x0]&&_0x45be64[_0xd8c0('0x35')][0x0][_0xd8c0('0x38')]?_0x45be64[_0xd8c0('0x35')][0x0][_0xd8c0('0x38')]:0x0;})['join']('\x0a');}logger[_0xd8c0('0x25')](_0xd8c0('0x39'),_0x5ab2ae);logger[_0xd8c0('0x25')](_0xd8c0('0x3a'),_0x1760a0);return{'transcript':_0x5ab2ae,'confidence':_0x1760a0};})[_0xd8c0('0x3b')](function(_0x13f934){logger['error'](_0xd8c0('0x3c'),_0x13f934[_0xd8c0('0x14')],_0x13f934[_0xd8c0('0x3d')],_0x13f934[_0xd8c0('0x3e')]);});};exports[_0xd8c0('0x3f')]=function(_0x18bf76,_0x2ffc6e,_0x47db87,_0x26aa7d){var _0x3fddbd=apiai(_0x2ffc6e,{'language':_0x26aa7d||'en'});return _0x3fddbd[_0xd8c0('0x40')](_0x47db87,{'sessionId':_0x18bf76})[_0xd8c0('0x2b')](function(_0x398e46){logger['info'](JSON[_0xd8c0('0x41')](_0x398e46));return{'source':_0x398e46[_0xd8c0('0x42')][_0xd8c0('0x43')],'resolvedQuery':_0x398e46[_0xd8c0('0x42')]['resolvedQuery'],'action':_0x398e46[_0xd8c0('0x42')][_0xd8c0('0x44')],'actionIncomplete':_0x398e46[_0xd8c0('0x42')][_0xd8c0('0x45')],'speech':_0x398e46[_0xd8c0('0x42')][_0xd8c0('0x46')][_0xd8c0('0x47')],'score':_0x398e46[_0xd8c0('0x42')][_0xd8c0('0x48')],'statusCode':_0x398e46[_0xd8c0('0x49')][_0xd8c0('0x4a')]};});};exports['tildeASR']=function(_0x80982c,_0x5b45a9,_0x8082f7,_0x5a4852){return tilde[_0xd8c0('0x4b')](_0x80982c,_0x5b45a9,_0x8082f7,_0x5a4852)[_0xd8c0('0x2b')](function(_0x43154d){try{fs[_0xd8c0('0x1d')](_0x80982c);}catch(_0x57b87a){logger[_0xd8c0('0x15')](_0x57b87a);}logger['info'](_0xd8c0('0x4c'),_0x43154d[_0xd8c0('0x36')]);logger[_0xd8c0('0x25')](_0xd8c0('0x4d'),_0x43154d[_0xd8c0('0x38')]);return _0x43154d;});};exports[_0xd8c0('0x4e')]=function(_0x1f694b,_0x4dce58,_0x5b6945,_0x30d579,_0x39b8c0,_0x1c3b67){var _0x263ea6=path[_0xd8c0('0x4f')](__dirname,_0xd8c0('0x2c'),rs[_0xd8c0('0x2d')](0x4)+'.mp3');var _0x287466;return aws['polly'](_0x1f694b,_0x4dce58,_0x5b6945,_0x30d579,_0x39b8c0,_0x1c3b67,_0x263ea6)[_0xd8c0('0x2b')](function(){_0x287466=path[_0xd8c0('0x4f')](__dirname,_0xd8c0('0x2c'),rs[_0xd8c0('0x2d')](0x4)+_0xd8c0('0x50'));return convertFile(_0x263ea6,_0x287466);})[_0xd8c0('0x2b')](function(){try{fs[_0xd8c0('0x1d')](_0x263ea6);fs[_0xd8c0('0x2f')](_0x287466,'777');}catch(_0x25e5ff){logger[_0xd8c0('0x15')](_0x25e5ff);}return _0x287466[_0xd8c0('0x32')]('.')[0x0];});};exports[_0xd8c0('0x51')]=function(_0x108f8a,_0x34c915,_0x118bfd,_0x1f68c7){var _0x2cf39e=util[_0xd8c0('0x52')](_0xd8c0('0x53'),ISPEECH_API,_0x108f8a,encodeURIComponent(_0x34c915),_0x118bfd,_0x1f68c7);var _0x2a5998=path[_0xd8c0('0x4f')](__dirname,'tmp',rs[_0xd8c0('0x2d')](0x4)+'.mp3');var _0x2f5846;return downloadFile(_0x2cf39e,_0x2a5998)[_0xd8c0('0x2b')](function(){_0x2f5846=path[_0xd8c0('0x4f')](__dirname,_0xd8c0('0x2c'),rs['generate'](0x4)+_0xd8c0('0x50'));return convertFile(_0x2a5998,_0x2f5846);})['then'](function(){try{fs[_0xd8c0('0x1d')](_0x2a5998);fs[_0xd8c0('0x2f')](_0x2f5846,'777');}catch(_0x18cae6){logger[_0xd8c0('0x15')](_0x18cae6);}return _0x2f5846[_0xd8c0('0x32')]('.')[0x0];});};exports[_0xd8c0('0x54')]=function(_0x1c86ad,_0x434799,_0x266062,_0x41ac6c){var _0x1a0119=util[_0xd8c0('0x52')](_0xd8c0('0x55'),ISPEECH_API,_0x434799,_0x266062,base64Encode(_0x1c86ad),_0x41ac6c?util[_0xd8c0('0x52')](_0xd8c0('0x56'),encodeURIComponent(_0x41ac6c)):'freeform=3');return uploadFile(_0x1a0119)[_0xd8c0('0x2b')](function(_0x4a0553){return querystring[_0xd8c0('0x4')](_0x4a0553);});};exports[_0xd8c0('0x57')]=function(){return __dirname;}; \ No newline at end of file +var _0xa264=['statusCode','error','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','info','finish\x20download\x20file','close','download\x20error','pipe','end','protocol','WHAT_EVER','get','data','transcode','error\x20convert','start','toString','base64','then','resolve','tmp','generate','.wav','unlink','chmodSync','777','split','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','source','resolvedQuery','result','score','code','tildeASR','asr','awsPolly','.mp3','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','dirName','path','https','url','parse','randomstring','sox','util','querystring','moment','apiai-promise','./aws','./tilde','agi','https://api.ispeech.org/api/rest','host'];(function(_0x586491,_0x320b0d){var _0x5df3b2=function(_0x26cf0b){while(--_0x26cf0b){_0x586491['push'](_0x586491['shift']());}};_0x5df3b2(++_0x320b0d);}(_0xa264,0xcf));var _0x4a26=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xa264[_0xf73c09];return _0xa8923c;};'use strict';var fs=require('fs');var path=require(_0x4a26('0x0'));var http=require('http');var https=require(_0x4a26('0x1'));var urlParse=require(_0x4a26('0x2'))[_0x4a26('0x3')];var BPromise=require('bluebird');var rs=require(_0x4a26('0x4'));var sox=require(_0x4a26('0x5'));var rp=require('request-promise');var util=require(_0x4a26('0x6'));var querystring=require(_0x4a26('0x7'));var moment=require(_0x4a26('0x8'));var tts=require('google-tts-api');var apiai=require(_0x4a26('0x9'));var google=require('./google');var aws=require(_0x4a26('0xa'));var tilde=require(_0x4a26('0xb'));var logger=require('../../../config/logger')(_0x4a26('0xc'));var ISPEECH_API=_0x4a26('0xd');function downloadFile(_0x3164ae,_0x245502){return new BPromise(function(_0x5554db,_0x59094e){var _0x490cc4=urlParse(_0x3164ae);var _0x1d44ca=_0x490cc4['protocol']==='https:'?https:http;var _0xa3ec6b={'host':_0x490cc4[_0x4a26('0xe')],'path':_0x490cc4[_0x4a26('0x0')],'headers':{'user-agent':'WHAT_EVER'}};_0x1d44ca['get'](_0xa3ec6b,function(_0x4b644a){if(_0x4b644a[_0x4a26('0xf')]!==0xc8){logger[_0x4a26('0x10')]('request\x20to\x20'+_0x3164ae+'\x20failed,\x20status\x20code\x20=\x20'+_0x4b644a[_0x4a26('0xf')]+'\x20('+_0x4b644a[_0x4a26('0x11')]+')');_0x59094e(new Error('request\x20to\x20'+_0x3164ae+_0x4a26('0x12')+_0x4b644a['statusCode']+'\x20('+_0x4b644a[_0x4a26('0x11')]+')'));return;}var _0x4613c3=fs[_0x4a26('0x13')](_0x245502);_0x4613c3['on']('finish',function(){logger[_0x4a26('0x14')](_0x4a26('0x15'));_0x4613c3[_0x4a26('0x16')](_0x5554db);});_0x4613c3['on'](_0x4a26('0x10'),function(_0x3b7797){fs['unlink'](_0x245502);logger[_0x4a26('0x10')](_0x4a26('0x17'),_0x3b7797);_0x59094e(_0x3b7797);});_0x4b644a[_0x4a26('0x18')](_0x4613c3);})['on']('error',function(_0x59d5d3){logger[_0x4a26('0x10')](_0x59d5d3);_0x59094e(_0x59d5d3);})[_0x4a26('0x19')]();});}function uploadFile(_0x18850e){return new BPromise(function(_0x5e739d,_0xf27d1c){var _0x55a075=urlParse(_0x18850e);var _0x337a3f=_0x55a075[_0x4a26('0x1a')]==='https:'?https:http;var _0x4f5ec3={'host':_0x55a075['host'],'path':_0x55a075[_0x4a26('0x0')],'headers':{'user-agent':_0x4a26('0x1b')}};_0x337a3f[_0x4a26('0x1c')](_0x4f5ec3,function(_0x352618){if(_0x352618[_0x4a26('0xf')]!==0xc8){_0xf27d1c(new Error('request\x20to\x20'+_0x18850e+_0x4a26('0x12')+_0x352618[_0x4a26('0xf')]+'\x20('+_0x352618['statusMessage']+')'));return;}var _0x2b9f2b='';_0x352618['on'](_0x4a26('0x1d'),function(_0x570a58){_0x2b9f2b+=_0x570a58;});_0x352618['on']('end',function(){_0x5e739d(_0x2b9f2b);});})['on']('error',function(_0x3a4389){_0xf27d1c(_0x3a4389);})[_0x4a26('0x19')]();});}function convertFile(_0x34f79a,_0x46ac44){return new BPromise(function(_0x1228a3,_0x504d3d){var _0x54aa6c=sox[_0x4a26('0x1e')](_0x34f79a,_0x46ac44,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x54aa6c['on'](_0x4a26('0x10'),function(_0x257751){logger[_0x4a26('0x10')](_0x4a26('0x1f'),_0x257751);_0x504d3d(_0x257751);});_0x54aa6c['on'](_0x4a26('0x19'),function(){logger[_0x4a26('0x14')]('finish\x20to\x20convert');_0x1228a3();});_0x54aa6c[_0x4a26('0x20')]();});}function base64Encode(_0x34d6e8){var _0x4dd180=fs['readFileSync'](_0x34d6e8);return new Buffer(_0x4dd180)[_0x4a26('0x21')](_0x4a26('0x22'));}exports['googleTTS']=function(_0x166f4a,_0x48936d){var _0x2f18f8,_0xf4524;return tts(_0x166f4a,_0x48936d||'en',0x1)[_0x4a26('0x23')](function(_0xd93cdc){logger['info'](_0xd93cdc);_0x2f18f8=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs['generate'](0x4)+'.mp3');return downloadFile(_0xd93cdc,_0x2f18f8);})[_0x4a26('0x23')](function(){_0xf4524=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x27'));return convertFile(_0x2f18f8,_0xf4524);})[_0x4a26('0x23')](function(){try{fs[_0x4a26('0x28')](_0x2f18f8);fs[_0x4a26('0x29')](_0xf4524,_0x4a26('0x2a'));}catch(_0x173625){logger[_0x4a26('0x10')](_0x173625);}logger['info']('goggleTTS\x20path',_0xf4524[_0x4a26('0x2b')]('.')[0x0]);return _0xf4524[_0x4a26('0x2b')]('.')[0x0];});};exports[_0x4a26('0x2c')]=function(_0x252240,_0x13157d,_0x19c7c8){return google['asr'](_0x252240,_0x13157d,_0x19c7c8)[_0x4a26('0x23')](function(_0x25a178){logger[_0x4a26('0x14')](_0x25a178[_0x4a26('0x2d')]);return rp(_0x25a178);})['then'](function(_0x7017a0){var _0x9daff0='';var _0x50552f=0x0;try{fs[_0x4a26('0x28')](_0x252240);}catch(_0x2ffb53){logger[_0x4a26('0x10')](_0x2ffb53);}if(_0x7017a0&&_0x7017a0[_0x4a26('0x2e')]){_0x9daff0=_0x7017a0['results'][_0x4a26('0x2f')](function(_0x1bae19){return _0x1bae19&&_0x1bae19[_0x4a26('0x30')][0x0]&&_0x1bae19[_0x4a26('0x30')][0x0][_0x4a26('0x31')]?_0x1bae19[_0x4a26('0x30')][0x0]['transcript']:'';})[_0x4a26('0x32')]('\x0a');_0x50552f=_0x7017a0[_0x4a26('0x2e')][_0x4a26('0x2f')](function(_0x25d686){return _0x25d686&&_0x25d686[_0x4a26('0x30')][0x0]&&_0x25d686[_0x4a26('0x30')][0x0][_0x4a26('0x33')]?_0x25d686[_0x4a26('0x30')][0x0][_0x4a26('0x33')]:0x0;})[_0x4a26('0x32')]('\x0a');}logger['info']('googleASR\x20transcription',_0x9daff0);logger[_0x4a26('0x14')](_0x4a26('0x34'),_0x50552f);return{'transcript':_0x9daff0,'confidence':_0x50552f};})[_0x4a26('0x35')](function(_0x415d81){logger['error']('[%s]\x20%s:%s',_0x415d81[_0x4a26('0xf')],_0x415d81[_0x4a26('0x36')],_0x415d81[_0x4a26('0x37')]);});};exports[_0x4a26('0x38')]=function(_0x2c37e5,_0x5f1655,_0x424a29,_0x163f49){var _0x525b6e=apiai(_0x5f1655,{'language':_0x163f49||'en'});return _0x525b6e[_0x4a26('0x39')](_0x424a29,{'sessionId':_0x2c37e5})['then'](function(_0xf372d2){logger[_0x4a26('0x14')](JSON['stringify'](_0xf372d2));return{'source':_0xf372d2['result'][_0x4a26('0x3a')],'resolvedQuery':_0xf372d2['result'][_0x4a26('0x3b')],'action':_0xf372d2[_0x4a26('0x3c')]['action'],'actionIncomplete':_0xf372d2[_0x4a26('0x3c')]['actionIncomplete'],'speech':_0xf372d2[_0x4a26('0x3c')]['fulfillment']['speech'],'score':_0xf372d2['result'][_0x4a26('0x3d')],'statusCode':_0xf372d2['status'][_0x4a26('0x3e')]};});};exports[_0x4a26('0x3f')]=function(_0x1e72ee,_0x4cdcd2,_0x5c71af,_0x298c58){return tilde[_0x4a26('0x40')](_0x1e72ee,_0x4cdcd2,_0x5c71af,_0x298c58)[_0x4a26('0x23')](function(_0x18fc0a){try{fs[_0x4a26('0x28')](_0x1e72ee);}catch(_0xbbd021){logger['error'](_0xbbd021);}logger[_0x4a26('0x14')]('Tilde\x20ASR\x20transcription',_0x18fc0a[_0x4a26('0x31')]);logger[_0x4a26('0x14')]('Tilde\x20ASR\x20confidence',_0x18fc0a[_0x4a26('0x33')]);return _0x18fc0a;});};exports[_0x4a26('0x41')]=function(_0x4476af,_0x3d8314,_0xdbf4b9,_0x48770f,_0x41801f,_0xf9eb9d){var _0x45f008=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x42'));var _0x9ed8a7;return aws['polly'](_0x4476af,_0x3d8314,_0xdbf4b9,_0x48770f,_0x41801f,_0xf9eb9d,_0x45f008)[_0x4a26('0x23')](function(){_0x9ed8a7=path[_0x4a26('0x24')](__dirname,'tmp',rs[_0x4a26('0x26')](0x4)+'.wav');return convertFile(_0x45f008,_0x9ed8a7);})[_0x4a26('0x23')](function(){try{fs['unlink'](_0x45f008);fs[_0x4a26('0x29')](_0x9ed8a7,_0x4a26('0x2a'));}catch(_0x317ef5){logger[_0x4a26('0x10')](_0x317ef5);}return _0x9ed8a7[_0x4a26('0x2b')]('.')[0x0];});};exports['ispeechTTS']=function(_0x1cc7d2,_0x7ee46f,_0x20f8b1,_0x55fa0c){var _0x2215ce=util[_0x4a26('0x43')](_0x4a26('0x44'),ISPEECH_API,_0x1cc7d2,encodeURIComponent(_0x7ee46f),_0x20f8b1,_0x55fa0c);var _0x209957=path[_0x4a26('0x24')](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x42'));var _0x2304a5;return downloadFile(_0x2215ce,_0x209957)[_0x4a26('0x23')](function(){_0x2304a5=path['resolve'](__dirname,_0x4a26('0x25'),rs[_0x4a26('0x26')](0x4)+_0x4a26('0x27'));return convertFile(_0x209957,_0x2304a5);})[_0x4a26('0x23')](function(){try{fs[_0x4a26('0x28')](_0x209957);fs[_0x4a26('0x29')](_0x2304a5,'777');}catch(_0x483256){logger[_0x4a26('0x10')](_0x483256);}return _0x2304a5[_0x4a26('0x2b')]('.')[0x0];});};exports[_0x4a26('0x45')]=function(_0x3ecf7b,_0xaea15d,_0x12afdf,_0x52646f){var _0x52963d=util[_0x4a26('0x43')](_0x4a26('0x46'),ISPEECH_API,_0xaea15d,_0x12afdf,base64Encode(_0x3ecf7b),_0x52646f?util[_0x4a26('0x43')](_0x4a26('0x47'),encodeURIComponent(_0x52646f)):_0x4a26('0x48'));return uploadFile(_0x52963d)[_0x4a26('0x23')](function(_0x166496){return querystring['parse'](_0x166496);});};exports[_0x4a26('0x49')]=function(){return __dirname;}; \ 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 7037c70..0b20a02 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 _0x3d05=['./lib/api'];(function(_0x33fd78,_0xe5ed45){var _0x3ad552=function(_0x20f92a){while(--_0x20f92a){_0x33fd78['push'](_0x33fd78['shift']());}};_0x3ad552(++_0xe5ed45);}(_0x3d05,0x8f));var _0x53d0=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x3d05[_0x33e93d];return _0x19e99d;};'use strict';var asr=require(_0x53d0('0x0'));module['exports']=function(_0x4c11b9,_0x9690c6,_0x1a7fad,_0x3d9e64){return asr(_0x4c11b9,_0x9690c6,_0x1a7fad,_0x3d9e64);}; \ No newline at end of file +var _0x9d60=['exports'];(function(_0x4c7a3e,_0x27d7bf){var _0x2b80ed=function(_0x3bb14a){while(--_0x3bb14a){_0x4c7a3e['push'](_0x4c7a3e['shift']());}};_0x2b80ed(++_0x27d7bf);}(_0x9d60,0x7e));var _0x09d6=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0x9d60[_0x478c8a];return _0x3b6b3e;};'use strict';var asr=require('./lib/api');module[_0x09d6('0x0')]=function(_0x2aad2f,_0x533a44,_0x11dd89,_0x2fb832){return asr(_0x2aad2f,_0x533a44,_0x11dd89,_0x2fb832);}; \ 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 9b1ed1f..635610e 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 _0xeb32=['Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','bluebird','lodash','moment','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','stringify','createReadStream','send','close','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.'];(function(_0x2bc996,_0x2555b4){var _0x253650=function(_0x2ede6b){while(--_0x2ede6b){_0x2bc996['push'](_0x2bc996['shift']());}};_0x253650(++_0x2555b4);}(_0xeb32,0x1db));var _0x2eb3=function(_0x4e490d,_0x2d205b){_0x4e490d=_0x4e490d-0x0;var _0x5c174b=_0xeb32[_0x4e490d];return _0x5c174b;};'use strict';var BPromise=require(_0x2eb3('0x0'));var _=require(_0x2eb3('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x2eb3('0x2'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')('agi');module[_0x2eb3('0x3')]=function(_0x1d6c14,_0xc15832,_0x54c34f,_0x3f0c79){return new BPromise(function(_0x19cce4,_0x2cd66c){logger[_0x2eb3('0x4')](_0x2eb3('0x5'),_0x3f0c79||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0xbdbddf=new WebSocket(_0x3f0c79||_0x2eb3('0x6'),{'perMessageDeflate':![]});var _0x49a092='';var _0x4d4eb2='0';var _0x24bab7='1';var _0x2e6938=_0x2eb3('0x7');function _0x1c6e0e(_0x4c9aad){var _0x1eaf75=crypto[_0x2eb3('0x8')](_0x2eb3('0x9'));_0x1eaf75[_0x2eb3('0xa')](_0x4c9aad);return _0x1eaf75[_0x2eb3('0xb')](_0x2eb3('0xc'));}function _0x4dab33(){try{logger[_0x2eb3('0x4')]('Open\x20Tilde\x20ASR\x20socket');var _0x23e8b6=moment()[_0x2eb3('0xd')]();var _0x5b52e9=_0x1c6e0e(_0x23e8b6+_0xc15832+_0x54c34f);_0xbdbddf['send'](JSON[_0x2eb3('0xe')]({'appID':_0xc15832,'timestamp':_0x23e8b6,'appKey':_0x5b52e9}));var _0x5c31f7=fs[_0x2eb3('0xf')](_0x1d6c14);_0x5c31f7['on']('data',function(_0x3a26ec){_0xbdbddf[_0x2eb3('0x10')](_0x3a26ec);});_0x5c31f7['on'](_0x2eb3('0x11'),function(){_0xbdbddf[_0x2eb3('0x10')]('EOS');});}catch(_0x45dae6){logger[_0x2eb3('0x12')](_0x2eb3('0x13'),JSON[_0x2eb3('0xe')](_0x45dae6));_0xbdbddf[_0x2eb3('0x14')]();}}function _0xa7aae7(_0x2d1e2b){try{if(_0x2d1e2b){var _0x1fba48=JSON[_0x2eb3('0x15')](_0x2d1e2b);switch(_0x1fba48[_0x2eb3('0x16')]){case 0x0:if(_0x1fba48[_0x2eb3('0x17')]){if(_0x1fba48[_0x2eb3('0x17')]['final']){logger['info'](_0x2eb3('0x18'),JSON[_0x2eb3('0xe')](_0x1fba48[_0x2eb3('0x17')][_0x2eb3('0x19')]));_0x49a092=_0x1fba48['result'][_0x2eb3('0x19')][0x0][_0x2eb3('0x1a')];_0x4d4eb2=_0x1fba48[_0x2eb3('0x17')][_0x2eb3('0x19')][0x0][_0x2eb3('0x1b')];_0x24bab7='0';_0x2e6938='Success.';_0xbdbddf[_0x2eb3('0x14')]();}}break;case 0x1:logger[_0x2eb3('0x4')](_0x2eb3('0x7'));_0x24bab7='1';_0x2e6938=_0x2eb3('0x7');break;case 0x2:logger[_0x2eb3('0x4')](_0x2eb3('0x1c'));_0x24bab7='2';_0x2e6938=_0x2eb3('0x1c');break;case 0x9:logger[_0x2eb3('0x4')](_0x2eb3('0x1d'));_0x24bab7='9';_0x2e6938='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x2eb3('0x4')](_0x2eb3('0x1e'));_0x24bab7='10';_0x2e6938='Authentication\x20failed.';break;case 0xb:logger[_0x2eb3('0x4')](_0x2eb3('0x1f'));_0x24bab7='11';_0x2e6938=_0x2eb3('0x1f');}}}catch(_0xdcd03f){logger[_0x2eb3('0x12')](_0x2eb3('0x20'),JSON[_0x2eb3('0xe')](_0xdcd03f));_0xbdbddf[_0x2eb3('0x14')]();}}function _0x5ba320(){logger[_0x2eb3('0x4')](_0x2eb3('0x21'));_0x19cce4({'transcript':_0x49a092,'confidence':_0x4d4eb2,'status':_0x24bab7,'status_message':_0x2e6938});}function _0x2f67a8(_0x16cecf){logger[_0x2eb3('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x2eb3('0x22')](_0x16cecf)){logger[_0x2eb3('0x12')](_[_0x2eb3('0x23')](_0x16cecf)?JSON[_0x2eb3('0xe')](_0x16cecf):_0x16cecf);}}_0xbdbddf['on']('open',_0x4dab33);_0xbdbddf['on']('message',_0xa7aae7);_0xbdbddf['on'](_0x2eb3('0x11'),_0x5ba320);_0xbdbddf['on'](_0x2eb3('0x12'),_0x2f67a8);});}; \ No newline at end of file +var _0x8140=['wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','EOS','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','error','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','open','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info'];(function(_0x3ff9bc,_0x454197){var _0x5c2db4=function(_0xc8d9e5){while(--_0xc8d9e5){_0x3ff9bc['push'](_0x3ff9bc['shift']());}};_0x5c2db4(++_0x454197);}(_0x8140,0x109));var _0x0814=function(_0x5c5dc3,_0x265cd5){_0x5c5dc3=_0x5c5dc3-0x0;var _0x1fa8ed=_0x8140[_0x5c5dc3];return _0x1fa8ed;};'use strict';var BPromise=require(_0x0814('0x0'));var _=require(_0x0814('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x0814('0x2'));var crypto=require(_0x0814('0x3'));var logger=require(_0x0814('0x4'))(_0x0814('0x5'));module[_0x0814('0x6')]=function(_0x322a1a,_0x355ee2,_0x356670,_0x2412fa){return new BPromise(function(_0x28cb0a,_0x1fec2b){logger[_0x0814('0x7')]('Tilde\x20URI',_0x2412fa||_0x0814('0x8'));var _0x1cc434=new WebSocket(_0x2412fa||_0x0814('0x8'),{'perMessageDeflate':![]});var _0xdc2ae6='';var _0x52d7d3='0';var _0x5ab067='1';var _0x3e5cc9=_0x0814('0x9');function _0x4b5755(_0x1d9e86){var _0x271792=crypto[_0x0814('0xa')](_0x0814('0xb'));_0x271792[_0x0814('0xc')](_0x1d9e86);return _0x271792['digest'](_0x0814('0xd'));}function _0xa6b531(){try{logger['info'](_0x0814('0xe'));var _0x399479=moment()[_0x0814('0xf')]();var _0x54deb4=_0x4b5755(_0x399479+_0x355ee2+_0x356670);_0x1cc434[_0x0814('0x10')](JSON[_0x0814('0x11')]({'appID':_0x355ee2,'timestamp':_0x399479,'appKey':_0x54deb4}));var _0x4518a8=fs['createReadStream'](_0x322a1a);_0x4518a8['on'](_0x0814('0x12'),function(_0x5829b6){_0x1cc434['send'](_0x5829b6);});_0x4518a8['on']('close',function(){_0x1cc434[_0x0814('0x10')](_0x0814('0x13'));});}catch(_0x5bd0cf){logger['error'](_0x0814('0x14'),JSON[_0x0814('0x11')](_0x5bd0cf));_0x1cc434[_0x0814('0x15')]();}}function _0x59ae74(_0xd28a8b){try{if(_0xd28a8b){var _0x3d69ba=JSON['parse'](_0xd28a8b);switch(_0x3d69ba[_0x0814('0x16')]){case 0x0:if(_0x3d69ba[_0x0814('0x17')]){if(_0x3d69ba[_0x0814('0x17')][_0x0814('0x18')]){logger['info'](_0x0814('0x19'),JSON[_0x0814('0x11')](_0x3d69ba[_0x0814('0x17')][_0x0814('0x1a')]));_0xdc2ae6=_0x3d69ba['result'][_0x0814('0x1a')][0x0]['transcript'];_0x52d7d3=_0x3d69ba[_0x0814('0x17')][_0x0814('0x1a')][0x0][_0x0814('0x1b')];_0x5ab067='0';_0x3e5cc9='Success.';_0x1cc434['terminate']();}}break;case 0x1:logger[_0x0814('0x7')](_0x0814('0x9'));_0x5ab067='1';_0x3e5cc9=_0x0814('0x9');break;case 0x2:logger[_0x0814('0x7')](_0x0814('0x1c'));_0x5ab067='2';_0x3e5cc9=_0x0814('0x1c');break;case 0x9:logger[_0x0814('0x7')](_0x0814('0x1d'));_0x5ab067='9';_0x3e5cc9=_0x0814('0x1d');break;case 0xa:logger[_0x0814('0x7')](_0x0814('0x1e'));_0x5ab067='10';_0x3e5cc9=_0x0814('0x1e');break;case 0xb:logger[_0x0814('0x7')](_0x0814('0x1f'));_0x5ab067='11';_0x3e5cc9=_0x0814('0x1f');}}}catch(_0x310e1d){logger[_0x0814('0x20')](_0x0814('0x21'),JSON[_0x0814('0x11')](_0x310e1d));_0x1cc434[_0x0814('0x15')]();}}function _0x2c9c71(){logger[_0x0814('0x7')](_0x0814('0x22'));_0x28cb0a({'transcript':_0xdc2ae6,'confidence':_0x52d7d3,'status':_0x5ab067,'status_message':_0x3e5cc9});}function _0x5ad504(_0x5b6f52){logger['error'](_0x0814('0x23'));if(!_['isNil'](_0x5b6f52)){logger['error'](_['isObject'](_0x5b6f52)?JSON['stringify'](_0x5b6f52):_0x5b6f52);}}_0x1cc434['on'](_0x0814('0x24'),_0xa6b531);_0x1cc434['on'](_0x0814('0x25'),_0x59ae74);_0x1cc434['on'](_0x0814('0x26'),_0x2c9c71);_0x1cc434['on']('error',_0x5ad504);});}; \ 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 8a5cd5e..cbba8b5 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 _0x70e0=['exports','./asr'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0x70e0,0x17b));var _0x070e=function(_0x348f2f,_0x280a99){_0x348f2f=_0x348f2f-0x0;var _0x46211e=_0x70e0[_0x348f2f];return _0x46211e;};var asr=require(_0x070e('0x0'));module[_0x070e('0x1')]={'asr':asr}; \ No newline at end of file +var _0x34e8=['./asr','exports'];(function(_0x3a6eba,_0x7db8ac){var _0x531c0a=function(_0x349132){while(--_0x349132){_0x3a6eba['push'](_0x3a6eba['shift']());}};_0x531c0a(++_0x7db8ac);}(_0x34e8,0x12c));var _0x834e=function(_0x3817c8,_0x541701){_0x3817c8=_0x3817c8-0x0;var _0x3e4ff1=_0x34e8[_0x3817c8];return _0x3e4ff1;};var asr=require(_0x834e('0x0'));module[_0x834e('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 56e3836..c35de1f 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 _0x7151=['./channel','0.0.0.0','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','net','events','EventEmitter','./error'];(function(_0x25389e,_0x14ade5){var _0x2e53fe=function(_0x563e9a){while(--_0x563e9a){_0x25389e['push'](_0x25389e['shift']());}};_0x2e53fe(++_0x14ade5);}(_0x7151,0x104));var _0x1715=function(_0x2b38f7,_0x3897af){_0x2b38f7=_0x2b38f7-0x0;var _0x4f8e27=_0x7151[_0x2b38f7];return _0x4f8e27;};'use strict';var util=require('util');var net=require(_0x1715('0x0'));var EventEmitter=require(_0x1715('0x1'))[_0x1715('0x2')];var AGIError=require(_0x1715('0x3'));var AGIChannel=require(_0x1715('0x4'));var AGIServer=function(_0x1e2588,_0x21f674,_0x16c4a7){var _0x1b569a=this,_0x1e2588=_0x1e2588||0x11dd,_0x21f674=_0x21f674||_0x1715('0x5'),_0x4d119b=null,_0x5969a7=0x0;EventEmitter['call'](_0x1b569a);function _0x442eda(){if(!_0x1e2588){_0x1b569a[_0x1715('0x6')](_0x1715('0x7'),new AGIError(_0x1715('0x8')));return![];}_0x4d119b=net['createServer']();_0x4d119b[_0x1715('0x9')](_0x1e2588,_0x21f674);_0x4d119b['on'](_0x1715('0xa'),function(){_0x1b569a[_0x1715('0x6')](_0x1715('0xa'));});_0x4d119b['on'](_0x1715('0xb'),function(_0x49d4fa){_0x4d119b[_0x1715('0xc')](function(_0x4a5a97,_0x274567){if(_0x4a5a97){_0x1b569a[_0x1715('0x6')](_0x1715('0x7'),new AGIError(_0x1715('0xd'),_0x4a5a97));}else if(_0x16c4a7&&_0x16c4a7<0x0){_0x1b569a[_0x1715('0x6')]('error',new AGIError(_0x1715('0xe')));_0x49d4fa[_0x1715('0xf')]();}else if(_0x16c4a7&&_0x16c4a7>0x0&&_0x16c4a7<_0x274567){_0x5969a7+=0x1;_0x1b569a[_0x1715('0x6')](_0x1715('0x7'),new AGIError(_0x1715('0x10'),_0x5969a7));_0x49d4fa[_0x1715('0xf')]();}else{var _0x292df6=new AGIChannel(_0x49d4fa);_0x292df6['on'](_0x1715('0x11'),function(){_0x1b569a[_0x1715('0x6')](_0x1715('0xb'),_0x292df6);});}});});_0x4d119b['on']('error',function(_0xede129){_0x1b569a['emit'](_0x1715('0x7'),new AGIError(_0x1715('0xd'),_0xede129[_0x1715('0x12')]));});_0x4d119b['on'](_0x1715('0x13'),function(){_0x1b569a['emit']('close',new AGIError(_0x1715('0x14')));});}process[_0x1715('0x15')](function(){_0x442eda();});};util[_0x1715('0x16')](AGIServer,EventEmitter);module[_0x1715('0x17')]=function(_0x538d2d,_0x3287ef,_0xf49d94){return new AGIServer(_0x538d2d,_0x3287ef,_0xf49d94);}; \ No newline at end of file +var _0x1e42=['E_AGI_SERVER_MAXCONNECTION','ready','code','close','E_AGI_SERVER_CLOSE','nextTick','exports','net','events','EventEmitter','./channel','0.0.0.0','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x40e695,_0x366877){var _0x55a70e=function(_0x44cc1c){while(--_0x44cc1c){_0x40e695['push'](_0x40e695['shift']());}};_0x55a70e(++_0x366877);}(_0x1e42,0x91));var _0x21e4=function(_0x33fbae,_0x4c3513){_0x33fbae=_0x33fbae-0x0;var _0x3c47d4=_0x1e42[_0x33fbae];return _0x3c47d4;};'use strict';var util=require('util');var net=require(_0x21e4('0x0'));var EventEmitter=require(_0x21e4('0x1'))[_0x21e4('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x21e4('0x3'));var AGIServer=function(_0x15a424,_0x5333e1,_0xd91615){var _0x594adf=this,_0x15a424=_0x15a424||0x11dd,_0x5333e1=_0x5333e1||_0x21e4('0x4'),_0xc55dac=null,_0x30d5d1=0x0;EventEmitter[_0x21e4('0x5')](_0x594adf);function _0x1252a3(){if(!_0x15a424){_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0x8')));return![];}_0xc55dac=net[_0x21e4('0x9')]();_0xc55dac[_0x21e4('0xa')](_0x15a424,_0x5333e1);_0xc55dac['on'](_0x21e4('0xb'),function(){_0x594adf[_0x21e4('0x6')]('listening');});_0xc55dac['on'](_0x21e4('0xc'),function(_0x34d18b){_0xc55dac['getConnections'](function(_0x903f8,_0x3ab6d2){if(_0x903f8){_0x594adf[_0x21e4('0x6')]('error',new AGIError(_0x21e4('0xd'),_0x903f8));}else if(_0xd91615&&_0xd91615<0x0){_0x594adf['emit'](_0x21e4('0x7'),new AGIError(_0x21e4('0xe')));_0x34d18b[_0x21e4('0xf')]();}else if(_0xd91615&&_0xd91615>0x0&&_0xd91615<_0x3ab6d2){_0x30d5d1+=0x1;_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0x10'),_0x30d5d1));_0x34d18b['destroy']();}else{var _0x40bf10=new AGIChannel(_0x34d18b);_0x40bf10['on'](_0x21e4('0x11'),function(){_0x594adf['emit'](_0x21e4('0xc'),_0x40bf10);});}});});_0xc55dac['on'](_0x21e4('0x7'),function(_0x3b784c){_0x594adf[_0x21e4('0x6')](_0x21e4('0x7'),new AGIError(_0x21e4('0xd'),_0x3b784c[_0x21e4('0x12')]));});_0xc55dac['on'](_0x21e4('0x13'),function(){_0x594adf['emit'](_0x21e4('0x13'),new AGIError(_0x21e4('0x14')));});}process[_0x21e4('0x15')](function(){_0x1252a3();});};util['inherits'](AGIServer,EventEmitter);module[_0x21e4('0x16')]=function(_0x41084a,_0x183d5d,_0x4c4ff2){return new AGIServer(_0x41084a,_0x183d5d,_0x4c4ff2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 545e2c2..bc89423 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 _0xebf6=['ispeechasr','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','isArray','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','pause','getPause','pause_id','playback','PLAYBACK','Executed\x20command\x20%s\x20%s','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','getMailAccount','account_id','Smtp','user','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','path','util','lodash','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','mailRpc','prototype','getVariable','rpc','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunkById','getSound','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','file','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','trim','replace','googleTTS','google_tts_language','key','text','dialogflow_language','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','googleASR','tildeASR','appsecret','uri','includes','clone','isString','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','isConfigured','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','result','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_INPUT()','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','keys','forEach','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','url','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','googleDialogflow','hasOwnProperty','DIALOGFLOW_%s','toUpperCase','Dialogflow\x20Result\x20%s','speech','Google\x20TTS\x20is\x20unreachable','end','ext_dial','trunk_id','getTrunk','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','test','stringify','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','unlink','.wav','googleasr','%s/recordings/%s','%s.%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','true','hangup'];(function(_0x5ed54b,_0x3a2827){var _0x4b58c7=function(_0x19d3b6){while(--_0x19d3b6){_0x5ed54b['push'](_0x5ed54b['shift']());}};_0x4b58c7(++_0x3a2827);}(_0xebf6,0x1da));var _0x6ebf=function(_0x1b43af,_0x501993){_0x1b43af=_0x1b43af-0x0;var _0x363e42=_0xebf6[_0x1b43af];return _0x363e42;};'use strict';var fs=require('fs');var path=require(_0x6ebf('0x0'));var util=require(_0x6ebf('0x1'));var _=require(_0x6ebf('0x2'));var sh=require('shelljs');var odbc=require(_0x6ebf('0x3'))();var rs=require(_0x6ebf('0x4'));var moment=require(_0x6ebf('0x5'));var Mustache=require(_0x6ebf('0x6'));var logger=require(_0x6ebf('0x7'))('agi');var config=require(_0x6ebf('0x8'));var scripts=require('./scripts');var FILES_PATH=_0x6ebf('0x9');var verticesWithRetry=[_0x6ebf('0xa'),_0x6ebf('0xb'),_0x6ebf('0xc')];var AGIVertices=function(_0x403051,_0x22b234,_0x46eb9){this['channel']=_0x403051;this['rpc']=_0x22b234;this[_0x6ebf('0xd')]=_0x46eb9;};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xf')]=function(_0x5bd340,_0x74ac3){this[_0x6ebf('0x10')]['getVariableById'](_0x5bd340)[_0x6ebf('0x11')](function(_0x3ef994){_0x74ac3(null,_0x3ef994?_0x3ef994[_0x6ebf('0x12')]:![]);})[_0x6ebf('0x13')](function(_0x2d09a2){_0x74ac3(_0x2d09a2);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x14')]=function(_0x46b027,_0x6c8897){this['rpc'][_0x6ebf('0x15')](_0x46b027)[_0x6ebf('0x11')](function(_0x4c7758){_0x6c8897(null,_0x4c7758?_0x4c7758[_0x6ebf('0x12')]:![]);})['catch'](function(_0x4e45f9){_0x6c8897(_0x4e45f9);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x16')]=function(_0x130404,_0xbb73c8){this[_0x6ebf('0x10')][_0x6ebf('0x17')](_0x130404)[_0x6ebf('0x11')](function(_0x4f8bc8){_0xbb73c8(null,_0x4f8bc8?_0x4f8bc8[_0x6ebf('0x12')]:![]);})[_0x6ebf('0x13')](function(_0x106903){_0xbb73c8(_0x106903);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x18')]=function(_0x210a2f,_0x3b808b){this[_0x6ebf('0x10')][_0x6ebf('0x19')](_0x210a2f)[_0x6ebf('0x11')](function(_0x55da25){_0x3b808b(null,_0x55da25?_0x55da25[_0x6ebf('0x1a')]:![]);})['catch'](function(_0xf642bc){_0x3b808b(_0xf642bc);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x1b')]=function(_0x4514e8,_0x35d160){this[_0x6ebf('0x10')][_0x6ebf('0x1c')](_0x4514e8)[_0x6ebf('0x11')](function(_0x1c83d2){_0x35d160(null,_0x1c83d2?_0x1c83d2[_0x6ebf('0x12')]:![]);})[_0x6ebf('0x13')](function(_0x56137e){_0x35d160(_0x56137e);});};AGIVertices[_0x6ebf('0xe')]['getTrunk']=function(_0x61ae28,_0x5cfc98){this[_0x6ebf('0x10')][_0x6ebf('0x1d')](_0x61ae28)['then'](function(_0x32028a){_0x5cfc98(null,_0x32028a?_0x32028a[_0x6ebf('0x12')]:![]);})[_0x6ebf('0x13')](function(_0x296572){_0x5cfc98(_0x296572);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x1e')]=function(_0x4d24ae,_0x755779){var _0x53918d=this;this[_0x6ebf('0x10')]['getSoundById'](_0x4d24ae)[_0x6ebf('0x11')](function(_0x2cf2fe){_0x755779(null,_0x2cf2fe?_0x53918d['getSoundPath'](_0x2cf2fe[_0x6ebf('0x1f')]):![]);})[_0x6ebf('0x13')](function(_0x5a0bb8){_0x755779(_0x5a0bb8);});};AGIVertices[_0x6ebf('0xe')]['getMailAccount']=function(_0x264066,_0x345e62){this[_0x6ebf('0x10')][_0x6ebf('0x20')](_0x264066)[_0x6ebf('0x11')](function(_0x4b8ae3){_0x345e62(null,_0x4b8ae3?_0x4b8ae3:![]);})[_0x6ebf('0x13')](function(_0x3986dd){_0x345e62(_0x3986dd);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x21')]=function(_0x2c46f9,_0x4aadc8,_0x7224f3){this[_0x6ebf('0xd')][_0x6ebf('0x21')](_0x2c46f9,_0x4aadc8)[_0x6ebf('0x11')](function(){_0x7224f3(null);})['catch'](function(_0x26e5af){_0x7224f3(_0x26e5af);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x22')]=function(_0x31eef8,_0x11f446){this[_0x6ebf('0x10')][_0x6ebf('0x23')](_0x31eef8)[_0x6ebf('0x11')](function(_0x432cb8){if(_0x432cb8){if(_0x432cb8[_0x6ebf('0x24')]){_0x11f446(null,[_0x432cb8[_0x6ebf('0x25')]]);}else{_0x11f446(null,_[_0x6ebf('0x26')](_0x432cb8[_0x6ebf('0x27')],'interval'));}}else{_0x11f446(null,![]);}})['catch'](function(_0x4a2d62){_0x11f446(_0x4a2d62);});};AGIVertices['prototype'][_0x6ebf('0x28')]=function(_0x47f274){return util[_0x6ebf('0x29')](_0x6ebf('0x2a'),FILES_PATH,_0x47f274);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x2b')]=function(_0x5acc02,_0x347c5e,_0x4cda2d){odbc[_0x6ebf('0x2c')](_0x5acc02,function(_0x4b6146){if(_0x4b6146){logger['error'](_0x6ebf('0x2d'),_0x4b6146);_0x4cda2d(_0x4b6146);}else{logger[_0x6ebf('0x2e')](_0x6ebf('0x2f'));odbc[_0x6ebf('0x30')](_0x347c5e,function(_0x53abb2,_0x169fe2){if(_0x53abb2){logger[_0x6ebf('0x2e')](_0x6ebf('0x31'),_0x347c5e);_0x4cda2d(_0x53abb2);}else{logger['info'](_0x6ebf('0x32'),_0x347c5e);odbc[_0x6ebf('0x33')](function(_0x3c636f){if(_0x3c636f){logger[_0x6ebf('0x34')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x3c636f);}_0x4cda2d(null,_0x169fe2);});}});}});};AGIVertices['prototype'][_0x6ebf('0x35')]=function(_0x48b819,_0x2a99ff){this['rpc'][_0x6ebf('0x36')](_0x48b819)[_0x6ebf('0x11')](function(_0x105b78){_0x2a99ff(null,_0x105b78?_0x105b78:![]);})[_0x6ebf('0x13')](function(_0x47e70a){_0x2a99ff(_0x47e70a);});};AGIVertices['prototype'][_0x6ebf('0x37')]=function(_0x2cbe0a,_0x1174a4){this[_0x6ebf('0x10')][_0x6ebf('0x37')](_0x2cbe0a)[_0x6ebf('0x11')](function(_0x109d9d){_0x1174a4(null,_0x109d9d);})[_0x6ebf('0x13')](function(_0x619ed){_0x1174a4(_0x619ed);});};AGIVertices['prototype'][_0x6ebf('0x38')]=function(_0x4d6ae9,_0xe68014,_0x3fa8f4){this[_0x6ebf('0x10')][_0x6ebf('0x38')]({'uniqueid':this['channel'][_0x6ebf('0x39')],'node':_0x4d6ae9[_0x6ebf('0x3a')],'application':_0x4d6ae9[_0x6ebf('0x3b')],'data':_0xe68014||null,'project_name':this[_0x6ebf('0x3c')][_0x6ebf('0x3d')],'callerid':this[_0x6ebf('0x3c')][_0x6ebf('0x3e')]})[_0x6ebf('0x11')](function(_0x2d0e90){_0x3fa8f4(null,_0x2d0e90);})['catch'](function(_0x4f0117){_0x3fa8f4(_0x4f0117);});};AGIVertices['prototype'][_0x6ebf('0x3f')]=function(_0x5c227a,_0x25c935,_0x8f148b,_0x60e7a0){this['rpc'][_0x6ebf('0x3f')]({'uniqueid':this[_0x6ebf('0x3c')]['uniqueid'],'callerid':this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],'calleridname':this['channel'][_0x6ebf('0x40')],'context':this[_0x6ebf('0x3c')][_0x6ebf('0x41')],'extension':this[_0x6ebf('0x3c')]['extension'],'priority':this[_0x6ebf('0x3c')]['priority'],'accountcode':this[_0x6ebf('0x3c')]['accountcode'],'dnid':this[_0x6ebf('0x3c')]['dnid'],'projectName':this[_0x6ebf('0x3c')][_0x6ebf('0x3d')],'saveName':_0x25c935,'filename':_0x5c227a[_0x6ebf('0x42')]||_0x25c935,'savePath':_0x8f148b})[_0x6ebf('0x11')](function(_0xfe2b75){_0x60e7a0(null,_0xfe2b75);})[_0x6ebf('0x13')](function(_0x32d7f9){_0x60e7a0(_0x32d7f9);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x43')]=function(_0x25bba4,_0x263700){this[_0x6ebf('0x10')][_0x6ebf('0x43')]({'firstName':_[_0x6ebf('0x44')](_0x25bba4['name'])||_[_0x6ebf('0x45')](_0x25bba4['name'])?_0x6ebf('0x46')+Math['random']():_0x25bba4[_0x6ebf('0x12')],'lastName':_[_0x6ebf('0x44')](_0x25bba4[_0x6ebf('0x47')])||_[_0x6ebf('0x45')](_0x25bba4[_0x6ebf('0x47')])?null:_0x25bba4[_0x6ebf('0x47')],'phone':_0x25bba4[_0x6ebf('0x48')],'ListId':_0x25bba4[_0x6ebf('0x49')],'scheduledAt':_0x25bba4[_0x6ebf('0x4a')],'callbackUniqueid':this['channel'][_0x6ebf('0x39')],'tags':_0x6ebf('0x4b'),'description':_0x6ebf('0x4c')+_0x25bba4['scheduledAt'][_0x6ebf('0x4d')](),'priority':_0x25bba4['callback_priority']})[_0x6ebf('0x11')](function(_0x5cce23){_0x263700(null,_0x5cce23);})[_0x6ebf('0x13')](function(_0x29b1f0){_0x263700(_0x29b1f0);});};AGIVertices['prototype']['getPause']=function(_0xadff3b,_0x3cbb32){this[_0x6ebf('0x10')][_0x6ebf('0x4e')](_0xadff3b)['then'](function(_0x36c8a6){_0x3cbb32(null,_0x36c8a6?_0x36c8a6['name']:![]);})[_0x6ebf('0x13')](function(_0x1179f0){_0x3cbb32(_0x1179f0);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x4f')]=function(_0x2b8665,_0x491cc8,_0xf64c52){var _0x144cf0={'role':_0x6ebf('0x50')};_0x144cf0[_0x2b8665]=this[_0x6ebf('0x3c')][_0x6ebf('0x3e')];this[_0x6ebf('0x10')]['agentPause'](_0x144cf0,_0x491cc8,this['channel'][_0x6ebf('0x39')])[_0x6ebf('0x11')](function(_0x5a3441){_0xf64c52(null,_[_0x6ebf('0x45')](_0x5a3441)?![]:!![]);})['catch'](function(_0x5c5c23){logger['error'](_0x5c5c23);_0xf64c52(null,![]);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x51')]=function(_0x375416,_0x4a3b28){var _0x1ddfc6={'role':'agent'};_0x1ddfc6[_0x375416]=this[_0x6ebf('0x3c')][_0x6ebf('0x3e')];this[_0x6ebf('0x10')][_0x6ebf('0x51')](_0x1ddfc6)[_0x6ebf('0x11')](function(_0x14d0b0){_0x4a3b28(null,_['isNil'](_0x14d0b0)?![]:!![]);})['catch'](function(_0x51025b){logger['error'](_0x51025b);_0x4a3b28(null,![]);});};AGIVertices[_0x6ebf('0xe')]['agentLogout']=function(_0x4c616d,_0x294850){var _0x5865c8={'role':_0x6ebf('0x50')};_0x5865c8[_0x4c616d]=this['channel'][_0x6ebf('0x3e')];this[_0x6ebf('0x10')][_0x6ebf('0x52')](_0x5865c8)[_0x6ebf('0x11')](function(_0x5711d3){_0x294850(null,_[_0x6ebf('0x45')](_0x5711d3)?![]:!![]);})[_0x6ebf('0x13')](function(_0x3dbc47){logger['error'](_0x3dbc47);_0x294850(null,![]);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x53')]=function(_0x4fb1d5,_0x198c01){var _0x3df4a2={'role':'agent'};_0x3df4a2[_0x4fb1d5]=this[_0x6ebf('0x3c')][_0x6ebf('0x3e')];var _0x2db9c1=_0x4fb1d5!=_0x6ebf('0x54')?util[_0x6ebf('0x29')](_0x6ebf('0x55'),'LOCAL',this[_0x6ebf('0x3c')][_0x6ebf('0x3e')]):undefined;this[_0x6ebf('0x10')][_0x6ebf('0x53')](_0x3df4a2,_0x2db9c1)['then'](function(_0x139c87){_0x198c01(null,_['isNil'](_0x139c87)?![]:!![]);})['catch'](function(_0x325c1e){logger['error'](_0x325c1e);_0x198c01(null,![]);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x56')]=function(_0x51f3da,_0x25726c){sh[_0x6ebf('0x57')](_[_0x6ebf('0x58')](_0x51f3da),function(_0x2db5de,_0x3ba7bc){var _0x5b2333=_0x3ba7bc[_0x6ebf('0x59')](/(\r\n|\n|\r)/gm,'');_0x25726c(null,_0x5b2333);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x5a')]=function(_0x30429a,_0x1d3060){scripts['googleTTS'](_0x30429a['text'],_0x30429a[_0x6ebf('0x5b')]||'en',0x1)[_0x6ebf('0x11')](function(_0x296086){_0x1d3060(null,_0x296086);})[_0x6ebf('0x13')](function(_0x1cd015){_0x1d3060(_0x1cd015);});};AGIVertices['prototype']['googleDialogflow']=function(_0x509120,_0x15d154){scripts['googleDialogflow'](this[_0x6ebf('0x3c')][_0x6ebf('0x39')],_0x509120[_0x6ebf('0x5c')],_0x509120[_0x6ebf('0x5d')],_0x509120[_0x6ebf('0x5e')]||'en')['then'](function(_0xaebb85){_0x15d154(null,_0xaebb85);})['catch'](function(_0x557bb9){_0x15d154(_0x557bb9);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x5f')]=function(_0x4c0f19,_0x373b6e){scripts['ispeechTTS'](_0x4c0f19[_0x6ebf('0x5c')],_0x4c0f19['text'],_0x4c0f19[_0x6ebf('0x60')]||_0x6ebf('0x61'),_0x4c0f19[_0x6ebf('0x62')])[_0x6ebf('0x11')](function(_0x5b5aa9){_0x373b6e(null,_0x5b5aa9);})[_0x6ebf('0x13')](function(_0xd8fbfe){_0x373b6e(_0xd8fbfe);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x63')]=function(_0x544f73,_0x55f74c,_0x508fe8){scripts[_0x6ebf('0x63')](_0x55f74c,_0x544f73[_0x6ebf('0x5c')],_0x544f73['ispeech_asr_language']||_0x6ebf('0x61'),this['isConfigured'](_0x544f73[_0x6ebf('0x64')])?_0x544f73[_0x6ebf('0x64')]:undefined)[_0x6ebf('0x11')](function(_0x17487c){_0x508fe8(null,_0x17487c);})[_0x6ebf('0x13')](function(_0x8298){_0x508fe8(_0x8298);});};AGIVertices['prototype'][_0x6ebf('0x65')]=function(_0x4094cd,_0x1025dc){scripts[_0x6ebf('0x65')](_0x4094cd[_0x6ebf('0x66')],_0x4094cd[_0x6ebf('0x67')],_0x4094cd[_0x6ebf('0x68')],_0x4094cd[_0x6ebf('0x69')]||'Amy',_0x4094cd['text'],_0x4094cd['aws_text_type']||_0x6ebf('0x5d'))[_0x6ebf('0x11')](function(_0x3222aa){_0x1025dc(null,_0x3222aa);})[_0x6ebf('0x13')](function(_0x539bea){_0x1025dc(_0x539bea);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x6a')]=function(_0xf24f80,_0x1d6971,_0x214115){scripts['googleASR'](_0x1d6971,_0xf24f80[_0x6ebf('0x5c')],_0xf24f80['google_asr_language']||_0x6ebf('0x61'))[_0x6ebf('0x11')](function(_0x1bc24b){_0x214115(null,_0x1bc24b);})[_0x6ebf('0x13')](function(_0x57c534){_0x214115(_0x57c534);});};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x6b')]=function(_0x40f8c3,_0x86daba,_0x23da97){scripts[_0x6ebf('0x6b')](_0x86daba,_0x40f8c3['appid'],_0x40f8c3[_0x6ebf('0x6c')],_0x40f8c3[_0x6ebf('0x6d')])[_0x6ebf('0x11')](function(_0x5952ed){_0x23da97(null,_0x5952ed);})['catch'](function(_0x3bf1cf){_0x23da97(_0x3bf1cf);});};AGIVertices[_0x6ebf('0xe')]['clear']=function(_0x2740d4){var _0xd9f7e8=_[_0x6ebf('0x6e')](verticesWithRetry,_0x2740d4[_0x6ebf('0x3b')])?_0x2740d4:_[_0x6ebf('0x6f')](_0x2740d4);for(var _0x338e2f in _0xd9f7e8){if(_0xd9f7e8['hasOwnProperty'](_0x338e2f)){if(_0xd9f7e8[_0x338e2f]&&_[_0x6ebf('0x70')](_0xd9f7e8[_0x338e2f])){_0xd9f7e8[_0x338e2f]=this[_0x6ebf('0x71')](_0xd9f7e8[_0x338e2f]);}}}return _0xd9f7e8;};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x71')]=function(_0x3cdb6b){var _0x2a716e=_0x3cdb6b[_0x6ebf('0x72')]('{');for(var _0x463eca=0x1;_0x463eca<_0x2a716e['length'];_0x463eca+=0x1){var _0x1a68b7=_0x2a716e[_0x463eca][_0x6ebf('0x72')]('}');if(_0x1a68b7[_0x6ebf('0x73')]>0x1){_0x3cdb6b=_0x3cdb6b[_0x6ebf('0x74')]('{'+_0x1a68b7[0x0]+'}',this[_0x6ebf('0x3c')][_0x6ebf('0xf')](_0x1a68b7[0x0])[_0x6ebf('0x75')]||_0x1a68b7[0x0]);}}if(_0x2a716e[_0x6ebf('0x73')]===0x1){return _0x3cdb6b[_0x6ebf('0x4d')]();}return this[_0x6ebf('0x71')](_0x3cdb6b);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x76')]=function(_0x4f5d41,_0x45daf0){var _0x3f1a82=this[_0x6ebf('0x3c')][_0x6ebf('0xf')](_0x4f5d41);if(_0x3f1a82['result']===-0x1){return _0x3f1a82;}logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x77'),_0x45daf0,_0x3f1a82['extra']));return this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x45daf0,_0x3f1a82['extra']);};AGIVertices[_0x6ebf('0xe')]['isConfigured']=function(_0x2919c0){return _0x2919c0&&_0x2919c0!=='0'&&_0x2919c0!=='-1'&&_0x2919c0!=='';};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x79')]=function(_0x323bff){this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x323bff,'-');_0x323bff[_0x6ebf('0x7b')]=_0x323bff[_0x6ebf('0x79')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x6ebf('0xe')]['agi']=function(_0x51f891){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x7c'),_0x51f891[_0x6ebf('0x3a')]));return this[_0x6ebf('0x3c')][_0x6ebf('0x7d')]([_0x51f891[_0x6ebf('0x7e')],_0x51f891[_0x6ebf('0x7f')]]);};AGIVertices['prototype']['answer']=function(_0x3bbcb7){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x80'),_0x3bbcb7[_0x6ebf('0x3a')]));if(this[_0x6ebf('0x81')](_0x3bbcb7[_0x6ebf('0x82')])){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x83'),_0x3bbcb7[_0x6ebf('0x82')]));var _0x79441f=this['channel'][_0x6ebf('0x84')](_0x3bbcb7['timeout']);if(_0x79441f[_0x6ebf('0x85')]===-0x1){return _0x79441f;}}return this[_0x6ebf('0x3c')][_0x6ebf('0x86')]();};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x4b')]=function(_0x3aa3e6){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x87'),_0x3aa3e6['label']));if(!this[_0x6ebf('0x81')](_0x3aa3e6[_0x6ebf('0x49')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x3aa3e6,_0x6ebf('0x88'));}_0x3aa3e6[_0x6ebf('0x4a')]=moment();if(this[_0x6ebf('0x81')](_0x3aa3e6[_0x6ebf('0x89')])){_0x3aa3e6['scheduledAt']=moment()['add'](_0x3aa3e6[_0x6ebf('0x89')],_0x6ebf('0x8a'));}if(!this['isConfigured'](_0x3aa3e6[_0x6ebf('0x8b')])){_0x3aa3e6[_0x6ebf('0x8b')]=0x2;}this[_0x6ebf('0x43')]['sync'](this,_0x3aa3e6);return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x8d'),_0x3aa3e6['phone'],_0x3aa3e6['list_id'],_0x3aa3e6[_0x6ebf('0x4a')]));};AGIVertices['prototype']['custom_app']=function(_0x21513f){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x8e'),_0x21513f[_0x6ebf('0x3a')]));var _0x2f6c7a=this['channel'][_0x6ebf('0x57')](_0x21513f[_0x6ebf('0x8f')],_0x21513f[_0x6ebf('0x90')]);if(_0x2f6c7a[_0x6ebf('0x85')]===-0x1){return _0x2f6c7a;}return this[_0x6ebf('0x3c')]['noop'](util[_0x6ebf('0x29')]('Executed\x20command\x20%s\x20%s',_0x21513f['application'],_0x21513f[_0x6ebf('0x90')]));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x91')]=function(_0x59b2cc){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x92'),_0x59b2cc[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x59b2cc[_0x6ebf('0x5d')])){return this['channel'][_0x6ebf('0x8c')](_0x6ebf('0x93'));}var _0x9ddc6d='\x22'+_0x59b2cc['text']+'\x22';if(this[_0x6ebf('0x81')](_0x59b2cc[_0x6ebf('0x90')])){_0x9ddc6d+=','+_0x59b2cc['options'];}var _0x2f13cf=this['channel'][_0x6ebf('0x57')](_0x6ebf('0x94'),_0x9ddc6d);if(_0x2f13cf[_0x6ebf('0x85')]===-0x1){return _0x2f13cf;}return this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x95'),_0x9ddc6d));};AGIVertices[_0x6ebf('0xe')]['lumenvoxasr']=function(_0x845643){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x96'),_0x845643[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x845643[_0x6ebf('0x97')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x98'));}var _0x29965c=_0x845643[_0x6ebf('0x97')];if(this[_0x6ebf('0x81')](_0x845643[_0x6ebf('0x90')])){_0x29965c+=','+_0x845643[_0x6ebf('0x90')];}var _0x189154=this[_0x6ebf('0x3c')]['exec'](_0x6ebf('0x99'),_0x29965c);if(_0x189154[_0x6ebf('0x85')]===-0x1){return _0x189154;}var _0x5317c8=this[_0x6ebf('0x76')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x5317c8['result']===-0x1){return _0x5317c8;}var _0x47228b=this[_0x6ebf('0x76')](_0x6ebf('0x9a'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x47228b['result']===-0x1){return _0x47228b;}var _0x20306e=this[_0x6ebf('0x76')](_0x6ebf('0x9b'),_0x6ebf('0x9c'));if(_0x20306e[_0x6ebf('0x85')]===-0x1){return _0x20306e;}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x29965c));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x9d')]=function(_0x2bcd14){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x9e'),_0x2bcd14[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x2bcd14[_0x6ebf('0x9f')])){return this[_0x6ebf('0x3c')]['error'](_0x2bcd14,_0x6ebf('0xa0'));}var _0x5f86da=this[_0x6ebf('0x18')]['sync'](this,_0x2bcd14[_0x6ebf('0x9f')]);if(!_0x5f86da){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2bcd14,_0x6ebf('0xa1'));}if(!this[_0x6ebf('0x81')](_0x2bcd14[_0x6ebf('0x30')])){return this[_0x6ebf('0x3c')]['error'](_0x2bcd14,_0x6ebf('0xa2'));}var _0x5e1a1d=_0x2bcd14[_0x6ebf('0x30')][_0x6ebf('0x59')](/(\r\n|\n|\r)/gm,'\x20');this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xa3'),_0x5e1a1d));var _0x313018=this[_0x6ebf('0x2b')][_0x6ebf('0x7a')](this,_0x5f86da,_0x5e1a1d);this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x2bcd14,_0x5e1a1d);if(!this['isConfigured'](_0x2bcd14[_0x6ebf('0xa4')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5cf48b=this['getVariable']['sync'](this,_0x2bcd14['variable_id']);if(!_0x5cf48b){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2bcd14,_0x6ebf('0xa5'));}var _0x11af91=this;_0x313018['forEach'](function(_0x326206,_0x518fe2){Object[_0x6ebf('0xa6')](_0x326206)[_0x6ebf('0xa7')](function(_0x1c5bbc){_0x11af91['channel'][_0x6ebf('0x78')](util[_0x6ebf('0x29')]('%s[%s][%s]',_0x5cf48b,_0x518fe2,_0x1c5bbc),_0x326206[_0x1c5bbc]);});});this['channel'][_0x6ebf('0x78')](util[_0x6ebf('0x29')](_0x6ebf('0xa8'),_0x5cf48b),_0x313018[_0x6ebf('0x73')]);return this['channel'][_0x6ebf('0x8c')](util['format']('variable\x20%s\x20set',_0x5cf48b));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xa9')]=function(_0x2fd9d4){logger[_0x6ebf('0xaa')](util['format'](_0x6ebf('0xab'),_0x2fd9d4[_0x6ebf('0x3a')]));if(!this['isConfigured'](_0x2fd9d4['sip_id'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2fd9d4,_0x6ebf('0xac'));}var _0x88a720=this[_0x6ebf('0x1b')][_0x6ebf('0x7a')](this,_0x2fd9d4['sip_id']);if(!_0x88a720){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2fd9d4,_0x6ebf('0xad'));}var _0x39c78c=this[_0x6ebf('0x3c')][_0x6ebf('0x57')](_0x6ebf('0xae'),[util[_0x6ebf('0x29')](_0x6ebf('0xaf'),_0x88a720),_0x2fd9d4[_0x6ebf('0x82')],_0x2fd9d4[_0x6ebf('0xb0')],_0x2fd9d4[_0x6ebf('0xb1')]]);if(_0x39c78c[_0x6ebf('0x85')]===-0x1){return _0x39c78c;}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xb2'),_0x6ebf('0xae')));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xb3')]=function(_0x543004){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xb4'),_0x543004[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x543004[_0x6ebf('0x5c')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0xb5'));}if(!this[_0x6ebf('0x81')](_0x543004[_0x6ebf('0x5d')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x93'));}this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('Trying\x20Dialogflow:\x20%s',_0x543004[_0x6ebf('0x5d')]));var _0x55861c=this[_0x6ebf('0xb6')]['sync'](this,_0x543004);if(_0x55861c){for(var _0x534daf in _0x55861c){if(_0x55861c[_0x6ebf('0xb7')](_0x534daf)){this['channel']['setVariable'](util[_0x6ebf('0x29')](_0x6ebf('0xb8'),_0x534daf[_0x6ebf('0xb9')]()),_0x55861c[_0x534daf]);}}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util['format'](_0x6ebf('0xba'),_0x55861c[_0x6ebf('0xbb')]));}return this['channel'][_0x6ebf('0x34')](_0x543004,_0x6ebf('0xbc'));};AGIVertices['prototype'][_0x6ebf('0xbd')]=function(_0xbd005c){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20END\x20(%s)\x20block',_0xbd005c[_0x6ebf('0x3a')]));return this['channel'][_0x6ebf('0x8c')](_0x6ebf('0xbd'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xbe')]=function(_0x25e3dc){logger[_0x6ebf('0x2e')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x25e3dc['label']));var _0x4513f2='';if(_0x25e3dc[_0x6ebf('0xbf')]){if(!this[_0x6ebf('0x81')](_0x25e3dc[_0x6ebf('0xbf')])){return this['channel']['error'](_0x25e3dc,'no\x20trunk\x20selected');}else{var _0x44f47f=parseInt(_0x25e3dc[_0x6ebf('0xbf')],0xa);if(isNaN(_0x44f47f)){_0x4513f2=_0x25e3dc[_0x6ebf('0xbf')];}else{_0x4513f2=this[_0x6ebf('0xc0')][_0x6ebf('0x7a')](this,_0x25e3dc[_0x6ebf('0xbf')]);if(!_0x4513f2){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x25e3dc,_0x6ebf('0xc1'));}}}}else if(_0x25e3dc[_0x6ebf('0xc2')]){_0x4513f2=_0x25e3dc[_0x6ebf('0xc2')];}else{return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x25e3dc,_0x6ebf('0xc3'));}var _0x579650=this[_0x6ebf('0x3c')][_0x6ebf('0x57')](_0x6ebf('0xae'),[util[_0x6ebf('0x29')](_0x6ebf('0xc4'),_0x4513f2,_0x25e3dc['phone']),_0x25e3dc[_0x6ebf('0x82')],_0x25e3dc[_0x6ebf('0xb0')],_0x25e3dc[_0x6ebf('0xb1')]]);if(_0x579650[_0x6ebf('0x85')]===-0x1){return _0x579650;}return this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xb2'),_0x6ebf('0xae')));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xc5')]=function(_0x34474d){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0xc6'),_0x34474d[_0x6ebf('0x3a')]));return this['channel'][_0x6ebf('0x8c')](_0x6ebf('0xc5'));};AGIVertices['prototype']['getdigits']=function(_0x39fafb){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xc7'),_0x39fafb['label']));if(_0x39fafb['retry']===0x0){return this[_0x6ebf('0x79')](_0x39fafb);}_0x39fafb[_0x6ebf('0x7b')]-=0x1;if(!this[_0x6ebf('0x81')](_0x39fafb['file_id'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x39fafb,_0x6ebf('0xc8'));}var _0x6363df=this[_0x6ebf('0x1e')][_0x6ebf('0x7a')](this,_0x39fafb[_0x6ebf('0xc9')]);if(!_0x6363df){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x39fafb,_0x6ebf('0xca'));}if(!this['isConfigured'](_0x39fafb['variable_id'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x6ebf('0xcb'));}var _0xd34872=this[_0x6ebf('0x3c')][_0x6ebf('0xcc')](_0x6363df,_0x39fafb['response'],_0x39fafb['maxdigit']);var _0x57c8d8=_0xd34872[_0x6ebf('0x85')]?_0xd34872[_0x6ebf('0x85')][_0x6ebf('0x4d')]():'';logger[_0x6ebf('0x2e')](_0x6ebf('0xcd'),JSON[_0x6ebf('0xce')](_0xd34872));if(_0xd34872[_0x6ebf('0x85')]===-0x1){this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x39fafb,_0x57c8d8);return _0xd34872;}else if(_0xd34872[_0x6ebf('0x75')]===_0x6ebf('0x82')){_0xd34872['result']=_0x57c8d8[_0x6ebf('0x73')]>=parseInt(_0x39fafb['mindigit'])?'x':'i';}else{_0xd34872['result']=_0x57c8d8['length']>=parseInt(_0x39fafb[_0x6ebf('0xcf')])&&_0x57c8d8[_0x6ebf('0x73')]<=parseInt(_0x39fafb[_0x6ebf('0xd0')])?'x':'i';}var _0x11908c=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x39fafb[_0x6ebf('0xa4')]);if(!_0x11908c){return this[_0x6ebf('0x3c')]['error'](_0x39fafb,_0x6ebf('0xa5'));}this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x11908c,_0x57c8d8);if(this[_0x6ebf('0x81')](_0x39fafb[_0x6ebf('0xd1')])){var _0x5da31c=parseInt(_0x39fafb[_0x6ebf('0xd1')],0xa);var _0x48ed0f=rs[_0x6ebf('0xd2')]({'charset':'*','length':_0x5da31c});var _0x19ea10=_0x57c8d8['length'];if(_0x19ea10>0x0){if(_0x19ea10>_0x5da31c){this[_0x6ebf('0x38')]['sync'](this,_0x39fafb,_0x39fafb[_0x6ebf('0xd3')]===_0x6ebf('0xd4')?_0x48ed0f+_0x57c8d8[_0x6ebf('0xd5')](_0x5da31c):_0x57c8d8[_0x6ebf('0xd5')](0x0,_0x19ea10-_0x5da31c)+_0x48ed0f);}else{this[_0x6ebf('0x38')]['sync'](this,_0x39fafb,rs[_0x6ebf('0xd2')]({'charset':'*','length':_0x19ea10}));}}else{this[_0x6ebf('0x38')]['sync'](this,_0x39fafb,'');}}else{this['createSquareDetailsReport'][_0x6ebf('0x7a')](this,_0x39fafb,_0x57c8d8);}return _0xd34872;};AGIVertices[_0x6ebf('0xe')]['getsecretdigits']=function(_0x3927ea){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xd6'),_0x3927ea[_0x6ebf('0x3a')]));return this[_0x6ebf('0xb')](_0x3927ea);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xd7')]=function(_0x14f373){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0xd8'),_0x14f373[_0x6ebf('0x3a')]));this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x14f373,_0x14f373['goalname']);return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xd9'),_0x14f373['goalname']));};AGIVertices['prototype'][_0x6ebf('0xda')]=function(_0x17c993){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0xdb'),_0x17c993[_0x6ebf('0x3a')]));if(!this['isConfigured'](_0x17c993['aws_access_key_id'])||!this[_0x6ebf('0x81')](_0x17c993[_0x6ebf('0x67')])){return this['channel']['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x17c993[_0x6ebf('0x5d')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x93'));}this[_0x6ebf('0x3c')]['noop'](util['format'](_0x6ebf('0xdc'),_0x17c993[_0x6ebf('0x5d')]));var _0x1cfd7f=this['awsPolly']['sync'](this,_0x17c993);if(_0x1cfd7f){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x1cfd7f));var _0x2ee7a9=this[_0x6ebf('0x3c')][_0x6ebf('0xdd')](_0x1cfd7f);try{fs[_0x6ebf('0xde')](_0x1cfd7f+_0x6ebf('0xdf'));}catch(_0x310e71){logger[_0x6ebf('0x34')](_0x310e71);}return _0x2ee7a9;}return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x17c993,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xe0')]=function(_0x49fa9e){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x49fa9e[_0x6ebf('0x3a')],_0x49fa9e['timeout']));if(!this[_0x6ebf('0x81')](_0x49fa9e[_0x6ebf('0x5c')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0xb5'));}var _0x2d1894='wav';var _0x51ea5f=util[_0x6ebf('0x29')](_0x6ebf('0xe1'),FILES_PATH,rs[_0x6ebf('0xd2')](0x4));var _0x487f98=util['format'](_0x6ebf('0xe2'),_0x51ea5f,_0x2d1894);var _0x25f4b4=!![];if(_0x49fa9e[_0x6ebf('0xe3')]===_0x6ebf('0xe4')){_0x25f4b4=![];}var _0x1f2549=this[_0x6ebf('0x3c')][_0x6ebf('0xe5')](_0x51ea5f,_0x2d1894,_0x49fa9e['intKey'],_0x49fa9e[_0x6ebf('0x82')],undefined,_0x25f4b4);if(_0x1f2549[_0x6ebf('0x85')]!==-0x1){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xe6'),_0x487f98));var _0x33b773=this[_0x6ebf('0x6a')][_0x6ebf('0x7a')](this,_0x49fa9e,_0x487f98);if(_0x33b773){for(var _0x271265 in _0x33b773){if(_0x33b773[_0x6ebf('0xb7')](_0x271265)){this[_0x6ebf('0x3c')][_0x6ebf('0x78')](util['format']('GOOGLE_ASR_%s',_0x271265[_0x6ebf('0xb9')]()),_0x33b773[_0x271265]);}}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xe7'),JSON['stringify'](_0x33b773)));}}return _0x1f2549;};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xe8')]=function(_0x1c2d39){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1c2d39[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x1c2d39[_0x6ebf('0xe9')])){return this['channel'][_0x6ebf('0x8c')](_0x6ebf('0xea'));}if(!this[_0x6ebf('0x81')](_0x1c2d39[_0x6ebf('0x6c')])){return this[_0x6ebf('0x3c')]['noop'](_0x6ebf('0xeb'));}var _0x25bccd=_0x6ebf('0xec');var _0x5741f7=util[_0x6ebf('0x29')](_0x6ebf('0xe1'),FILES_PATH,rs[_0x6ebf('0xd2')](0x4));var _0x355d90=util[_0x6ebf('0x29')]('%s.%s',_0x5741f7,_0x25bccd);var _0x4658b2=!![];if(_0x1c2d39[_0x6ebf('0xe3')]===_0x6ebf('0xe4')){_0x4658b2=![];}var _0x406e8c=this['channel'][_0x6ebf('0xe5')](_0x5741f7,_0x25bccd,_0x1c2d39['intKey'],_0x1c2d39[_0x6ebf('0x82')],undefined,_0x4658b2);if(_0x406e8c[_0x6ebf('0x85')]!==-0x1){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xed'),_0x355d90));var _0x4469bf=this[_0x6ebf('0x6b')][_0x6ebf('0x7a')](this,_0x1c2d39,_0x355d90);if(_0x4469bf){for(var _0x2dd07e in _0x4469bf){if(_0x4469bf['hasOwnProperty'](_0x2dd07e)){this['channel'][_0x6ebf('0x78')](util[_0x6ebf('0x29')](_0x6ebf('0xee'),_0x2dd07e[_0x6ebf('0xb9')]()),_0x4469bf[_0x2dd07e]);}}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0xef'),JSON['stringify'](_0x4469bf)));}}return _0x406e8c;};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xf0')]=function(_0x1db8cd){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xf1'),_0x1db8cd[_0x6ebf('0x3a')]));return this[_0x6ebf('0x3c')][_0x6ebf('0xf2')](_0x1db8cd[_0x6ebf('0x41')],_0x1db8cd[_0x6ebf('0xf3')],_0x1db8cd[_0x6ebf('0xf4')]);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0xf5')]=function(_0x182d74){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0xf6'),_0x182d74[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x182d74['condition'])){return this['channel']['error'](_0x182d74,_0x6ebf('0xf7'));}try{var _0x3008fa=eval(_0x182d74[_0x6ebf('0xf8')])?'true':_0x6ebf('0xf9');this[_0x6ebf('0x3c')]['noop'](util[_0x6ebf('0x29')](_0x6ebf('0xfa'),_0x182d74[_0x6ebf('0xf8')],_0x3008fa));return{'code':0xc8,'result':_0x3008fa};}catch(_0x442e14){return{'code':0xc8,'result':_0x6ebf('0xf9')};}};AGIVertices[_0x6ebf('0xe')]['gotoiftime']=function(_0x1f064f){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0xfb'),_0x1f064f['label']));if(!this[_0x6ebf('0x81')](_0x1f064f[_0x6ebf('0xfc')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x1f064f,_0x6ebf('0xfd'));}var _0x5605ea=this[_0x6ebf('0x22')][_0x6ebf('0x7a')](this,_0x1f064f[_0x6ebf('0xfc')]);if(!_0x5605ea){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x1f064f,_0x6ebf('0xfe'));}for(var _0x10bc19=0x0;_0x10bc19<_0x5605ea['length'];_0x10bc19+=0x1){var _0xd60b3e=this[_0x6ebf('0x3c')][_0x6ebf('0xf')](util[_0x6ebf('0x29')]('IFTIME(%s?true:false)',_0x5605ea[_0x10bc19]));if(_0xd60b3e[_0x6ebf('0x85')]===-0x1){return _0xd60b3e;}logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xff'),_0x5605ea[_0x10bc19],_0xd60b3e[_0x6ebf('0x75')]));if(_0xd60b3e[_0x6ebf('0x75')]==='true'){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('IFTIME\x20%s\x20%s',_0x5605ea[_0x10bc19],'true'));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('IFTIME\x20%s\x20%s',_0x5605ea[_0x10bc19],'true'));return{'code':0xc8,'result':_0x6ebf('0x100')};}else{logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0xff'),_0x5605ea[_0x10bc19],'false'));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util['format'](_0x6ebf('0xff'),_0x5605ea[_0x10bc19],_0x6ebf('0xf9')));}}return{'code':0xc8,'result':_0x6ebf('0xf9')};};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x101')]=function(_0x3aa790){logger[_0x6ebf('0x2e')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x3aa790['label']));return this[_0x6ebf('0x3c')]['hangup']();};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x102')]=function(_0x27d62a){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x27d62a['label']));if(!this[_0x6ebf('0x81')](_0x27d62a['key'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')]('no\x20key\x20configured');}var _0x604d4b=_0x6ebf('0xec');var _0x13dc7a=util['format'](_0x6ebf('0xe1'),FILES_PATH,rs[_0x6ebf('0xd2')](0x4));var _0x2ff64d=util[_0x6ebf('0x29')](_0x6ebf('0xe2'),_0x13dc7a,_0x604d4b);var _0x474198=!![];if(_0x27d62a[_0x6ebf('0xe3')]===_0x6ebf('0xe4')){_0x474198=![];}var _0x49712c=this[_0x6ebf('0x3c')][_0x6ebf('0xe5')](_0x13dc7a,_0x604d4b,_0x27d62a[_0x6ebf('0x103')],_0x27d62a[_0x6ebf('0x82')],undefined,_0x474198);if(_0x49712c[_0x6ebf('0x85')]!==-0x1){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util['format'](_0x6ebf('0x104'),_0x2ff64d));var _0x4288e3=this[_0x6ebf('0x63')][_0x6ebf('0x7a')](this,_0x27d62a,_0x2ff64d);if(_0x4288e3){for(var _0x28f1e1 in _0x4288e3){if(_0x4288e3['hasOwnProperty'](_0x28f1e1)){this[_0x6ebf('0x3c')]['setVariable'](util[_0x6ebf('0x29')](_0x6ebf('0x105'),_0x28f1e1['toUpperCase']()),_0x4288e3[_0x28f1e1]);}}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x106'),JSON['stringify'](_0x4288e3)));}}return _0x49712c;};AGIVertices['prototype'][_0x6ebf('0x107')]=function(_0x17af67){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x17af67[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x17af67[_0x6ebf('0x5c')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x17af67[_0x6ebf('0x5d')])){return this[_0x6ebf('0x3c')]['noop'](_0x6ebf('0x93'));}this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('Trying\x20ispeech\x20TTS\x20%s',_0x17af67['text']));var _0x47966c=this[_0x6ebf('0x5f')]['sync'](this,_0x17af67);if(_0x47966c){this['channel'][_0x6ebf('0x8c')](util['format'](_0x6ebf('0x104'),_0x47966c));var _0x276174=this[_0x6ebf('0x3c')][_0x6ebf('0xdd')](_0x47966c,_0x17af67['intKey']);try{fs[_0x6ebf('0xde')](_0x47966c+_0x6ebf('0xdf'));}catch(_0x412f42){logger[_0x6ebf('0x34')](_0x412f42);}return _0x276174;}return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x17af67,_0x6ebf('0x108'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x109')]=function(_0x2e9247){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x10a'),_0x2e9247['label']));if(!this[_0x6ebf('0x81')](_0x2e9247['findBy'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2e9247,_0x6ebf('0x10b'));}logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x10c'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x2e9247[_0x6ebf('0x10d')]));var _0x18c1c8=this[_0x6ebf('0x53')]['sync'](this,_0x2e9247[_0x6ebf('0x10d')]);if(_0x18c1c8){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this['channel'][_0x6ebf('0x3e')],_0x2e9247['findBy']));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this['channel'][_0x6ebf('0x3e')],_0x2e9247[_0x6ebf('0x10d')]));return{'code':0xc8,'result':_0x6ebf('0x10f')};}else{logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x110'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x2e9247[_0x6ebf('0x10d')]));this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x2e9247['findBy']));return{'code':0xc8,'result':_0x6ebf('0x111')};}};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x112')]=function(_0x57645e){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x113'),_0x57645e[_0x6ebf('0x3a')]));if(!this['isConfigured'](_0x57645e[_0x6ebf('0x10d')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x57645e,_0x6ebf('0x10b'));}logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x10c'),this['channel'][_0x6ebf('0x3e')],_0x57645e['findBy']));var _0x1bd040=this[_0x6ebf('0x52')][_0x6ebf('0x7a')](this,_0x57645e[_0x6ebf('0x10d')]);if(_0x1bd040){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x10e'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x57645e[_0x6ebf('0x10d')]));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x57645e['findBy']));return{'code':0xc8,'result':_0x6ebf('0x10f')};}else{logger['info'](util['format'](_0x6ebf('0x110'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x57645e[_0x6ebf('0x10d')]));this['channel']['noop'](util[_0x6ebf('0x29')](_0x6ebf('0x110'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x57645e[_0x6ebf('0x10d')]));return{'code':0xc8,'result':_0x6ebf('0x111')};}};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x114')]=function(_0x6a10d0){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x115'),_0x6a10d0[_0x6ebf('0x3a')]));if(!this['isConfigured'](_0x6a10d0[_0x6ebf('0x116')])){return this[_0x6ebf('0x3c')]['error'](_0x6a10d0,_0x6ebf('0x117'));}this['channel']['noop'](util[_0x6ebf('0x29')]('math\x20%s',_0x6a10d0[_0x6ebf('0x116')]));var _0x1be38b=eval(_0x6a10d0[_0x6ebf('0x116')]);if(!this[_0x6ebf('0x81')](_0x6a10d0['variable_id'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0xcb'));}var _0x342eca=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x6a10d0[_0x6ebf('0xa4')]);if(!_0x342eca){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x6a10d0,'no\x20variable\x20found');}if(_[_0x6ebf('0x118')](_0x1be38b)){var _0x57bcd1=this;_0x1be38b[_0x6ebf('0xa7')](function(_0x18b042,_0x4d76da){_0x57bcd1[_0x6ebf('0x3c')][_0x6ebf('0x78')](util[_0x6ebf('0x29')](_0x6ebf('0x119'),_0x342eca,_0x4d76da),_0x18b042);});return this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x11a'),_0x342eca));}else{return this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x342eca,_0x1be38b);}};AGIVertices['prototype']['menu']=function(_0x3ecdd4){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x11b'),_0x3ecdd4[_0x6ebf('0x3a')]));if(_0x3ecdd4[_0x6ebf('0x7b')]===0x0){return this[_0x6ebf('0x79')](_0x3ecdd4);}_0x3ecdd4['retry']-=0x1;if(!this[_0x6ebf('0x81')](_0x3ecdd4[_0x6ebf('0xc9')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x3ecdd4,_0x6ebf('0xc8'));}var _0xf1ddc3=this[_0x6ebf('0x1e')][_0x6ebf('0x7a')](this,_0x3ecdd4[_0x6ebf('0xc9')]);if(!_0xf1ddc3){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x3ecdd4,_0x6ebf('0xca'));}var _0x4898d5=this[_0x6ebf('0x3c')][_0x6ebf('0xcc')](_0xf1ddc3,_0x3ecdd4['response'],_0x3ecdd4[_0x6ebf('0x11c')]);var _0x546d16=_0x4898d5[_0x6ebf('0x85')];if(_0x4898d5[_0x6ebf('0x85')]===-0x1){this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x3ecdd4,'-1');return _0x4898d5;}else if(_0x4898d5[_0x6ebf('0x75')]===_0x6ebf('0x82')){_0x4898d5[_0x6ebf('0x85')]=_0x4898d5[_0x6ebf('0x85')][_0x6ebf('0x73')]>0x0?_0x4898d5[_0x6ebf('0x85')]:'t';}else if(_[_0x6ebf('0x44')](_0x4898d5[_0x6ebf('0x85')])){_0x4898d5['result']='#';_0x546d16='#';}if(!this[_0x6ebf('0x81')](_0x3ecdd4[_0x6ebf('0xa4')])){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0xcb'));}else{var _0x4db19b=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x3ecdd4[_0x6ebf('0xa4')]);if(!_0x4db19b){return this['channel'][_0x6ebf('0x34')](_0x3ecdd4,_0x6ebf('0xa5'));}this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x4db19b,_0x546d16);}this[_0x6ebf('0x38')]['sync'](this,_0x3ecdd4,_0x546d16);return _0x4898d5;};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x8c')]=function(_0x49dca9){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x49dca9['label']));return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x49dca9['output']||_0x49dca9['label']);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x11d')]=function(_0x595100){logger['info'](util['format']('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x595100['label']));if(!this[_0x6ebf('0x81')](_0x595100[_0x6ebf('0x10d')])){return this[_0x6ebf('0x3c')]['error'](_0x595100,_0x6ebf('0x10b'));}logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x10c'),this[_0x6ebf('0x3c')]['callerid'],_0x595100[_0x6ebf('0x10d')]));var _0x4ea457=this[_0x6ebf('0x11e')][_0x6ebf('0x7a')](this,_0x595100[_0x6ebf('0x11f')]);var _0x22c4b0=this['agentPause'][_0x6ebf('0x7a')](this,_0x595100[_0x6ebf('0x10d')],_0x4ea457);if(_0x22c4b0){logger['info'](util[_0x6ebf('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x595100[_0x6ebf('0x10d')]));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x595100['findBy']));return{'code':0xc8,'result':_0x6ebf('0x10f')};}else{logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x110'),this['channel'][_0x6ebf('0x3e')],_0x595100[_0x6ebf('0x10d')]));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this['channel'][_0x6ebf('0x3e')],_0x595100['findBy']));return{'code':0xc8,'result':_0x6ebf('0x111')};}};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x120')]=function(_0x4f8ce3){logger[_0x6ebf('0x2e')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x4f8ce3[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x4f8ce3['file_id'])){return this['channel'][_0x6ebf('0x34')](_0x4f8ce3,_0x6ebf('0xc8'));}var _0x25f3f7=this[_0x6ebf('0x1e')][_0x6ebf('0x7a')](this,_0x4f8ce3[_0x6ebf('0xc9')]);if(!_0x25f3f7){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x4f8ce3,_0x6ebf('0xca'));}var _0x4a12a2=this['channel'][_0x6ebf('0x57')](_0x6ebf('0x121'),[_0x25f3f7,_0x4f8ce3[_0x6ebf('0xb0')]]);if(_0x4a12a2[_0x6ebf('0x85')]===-0x1){return _0x4a12a2;}return this[_0x6ebf('0x3c')]['noop'](util[_0x6ebf('0x29')](_0x6ebf('0x122'),_0x6ebf('0x121'),_0x25f3f7));};AGIVertices[_0x6ebf('0xe')]['queue']=function(_0x1b7363){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x123'),_0x1b7363[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x1b7363['queue_id'])){return this['channel'][_0x6ebf('0x34')](_0x1b7363,_0x6ebf('0x124'));}var _0x83cc00='';var _0x5e97b8=parseInt(_0x1b7363[_0x6ebf('0x125')],0xa);if(isNaN(_0x5e97b8)){_0x83cc00=_0x1b7363[_0x6ebf('0x125')];}else{_0x83cc00=this[_0x6ebf('0x14')][_0x6ebf('0x7a')](this,_0x1b7363[_0x6ebf('0x125')]);if(!_0x83cc00){return this['channel'][_0x6ebf('0x34')](_0x1b7363,_0x6ebf('0x126'));}}var _0x19214c='';if(this[_0x6ebf('0x81')](_0x1b7363[_0x6ebf('0xc9')])){var _0x64c627=this['getSound'][_0x6ebf('0x7a')](this,_0x1b7363[_0x6ebf('0xc9')]);if(_0x64c627){_0x19214c=_0x64c627;}}this['createSquareDetailsReport'][_0x6ebf('0x7a')](this,_0x1b7363,_0x83cc00);if(_0x1b7363[_0x6ebf('0xb0')][_0x6ebf('0x127')]('x')<0x0){_0x1b7363[_0x6ebf('0xb0')]+='x';}if(_0x1b7363['opts'][_0x6ebf('0x127')]('X')<0x0){_0x1b7363[_0x6ebf('0xb0')]+='X';}this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x6ebf('0x128'),_0x83cc00?_0x83cc00[_0x6ebf('0x129')]():'');var _0x3cac90=this[_0x6ebf('0x3c')][_0x6ebf('0x57')]('QUEUE',[_0x83cc00,_0x1b7363[_0x6ebf('0xb0')],_0x1b7363[_0x6ebf('0xb1')],_0x19214c,_0x1b7363[_0x6ebf('0x82')],_0x1b7363[_0x6ebf('0x7d')],_0x1b7363['macro'],_0x1b7363['gosub'],'',_0x1b7363['position']]);if(_0x3cac90['result']===-0x1){return _0x3cac90;}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x122'),'QUEUE',_0x83cc00));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x12a')]=function(_0x546016){logger['info'](util[_0x6ebf('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x546016[_0x6ebf('0x3a')]));var _0x54568f=_0x546016[_0x6ebf('0x12b')]||_0x6ebf('0xec');var _0x4f701a=util[_0x6ebf('0x29')](_0x6ebf('0x12c'),this[_0x6ebf('0x3c')][_0x6ebf('0x39')],rs[_0x6ebf('0xd2')](0x5));var _0x4da683=util[_0x6ebf('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x4f701a,_0x54568f);var _0x1d1636=util[_0x6ebf('0x29')]('%s/recordings/%s',FILES_PATH,_0x4f701a);this[_0x6ebf('0x3f')]['sync'](this,_0x546016,_0x4f701a,_0x4da683);this['channel'][_0x6ebf('0x78')](_0x6ebf('0x12d'),_0x4f701a);logger[_0x6ebf('0x2e')](_0x6ebf('0x12e'),_0x1d1636,_0x54568f,_0x546016[_0x6ebf('0x12f')],_0x546016[_0x6ebf('0x82')]);return this['channel'][_0x6ebf('0xe5')](_0x1d1636,_0x54568f,_0x546016['escape_digits'],_0x546016['timeout'],undefined,!![]);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x130')]=function(_0x4ba54c){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x131'),_0x4ba54c[_0x6ebf('0x3a')]));return this['channel'][_0x6ebf('0x132')](_0x4ba54c[_0x6ebf('0x133')][_0x6ebf('0x59')](/\s+/g,''),_0x4ba54c[_0x6ebf('0x12f')]);};AGIVertices['prototype']['saynumber']=function(_0x4fbf78){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x134'),_0x4fbf78[_0x6ebf('0x3a')]));return this[_0x6ebf('0x3c')][_0x6ebf('0x135')](_0x4fbf78[_0x6ebf('0x136')]['replace'](/\s+/g,''),_0x4fbf78[_0x6ebf('0x12f')]);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x137')]=function(_0x1f1a2a){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x138'),_0x1f1a2a[_0x6ebf('0x3a')]));return this[_0x6ebf('0x3c')][_0x6ebf('0x139')](_0x1f1a2a['text'],_0x1f1a2a['escape_digits']);};AGIVertices[_0x6ebf('0xe')]['sendMail']=function(_0x39dcb2){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x13a'),_0x39dcb2[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x39dcb2['account_id'])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')]('no\x20mail\x20account\x20configured');}var _0x22ce2c=this[_0x6ebf('0x13b')][_0x6ebf('0x7a')](this,_0x39dcb2[_0x6ebf('0x13c')]);if(!_0x22ce2c||!_0x22ce2c[_0x6ebf('0x13d')]){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x39dcb2,'no\x20mail\x20account\x20found');}var _0x43bc9c={'from':util[_0x6ebf('0x29')]('\x22%s\x22\x20<%s>',_0x22ce2c[_0x6ebf('0x12')],_0x22ce2c['email']||_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x13e')]),'to':_0x39dcb2['to']||'','cc':_0x39dcb2['cc']||'','bcc':_0x39dcb2['bcc']||'','subject':_0x39dcb2[_0x6ebf('0x13f')],'html':_0x39dcb2[_0x6ebf('0x5d')],'text':_0x39dcb2['text']};var _0x5ef04e={'tls':{'rejectUnauthorized':![]}};if(_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x140')]){_0x5ef04e[_0x6ebf('0x140')]=_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x140')];}else{_0x5ef04e[_0x6ebf('0x141')]=_0x22ce2c['Smtp'][_0x6ebf('0x141')];_0x5ef04e[_0x6ebf('0x142')]=_0x22ce2c['Smtp'][_0x6ebf('0x142')];_0x5ef04e[_0x6ebf('0x143')]=_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x143')];}if(_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x144')]){_0x5ef04e['auth']={'user':_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x13e')],'pass':_0x22ce2c[_0x6ebf('0x13d')][_0x6ebf('0x145')]};}if(this[_0x6ebf('0x81')](_0x39dcb2[_0x6ebf('0x146')])){}logger[_0x6ebf('0xaa')](_0x6ebf('0x147'),JSON[_0x6ebf('0xce')](_0x43bc9c));this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x39dcb2,_0x39dcb2[_0x6ebf('0x13c')]);this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util['format'](_0x6ebf('0x148'),_0x22ce2c[_0x6ebf('0x12')]));this[_0x6ebf('0x21')]['sync'](this,_0x5ef04e,_0x43bc9c);return this[_0x6ebf('0x3c')]['noop']('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x6ebf('0xe')]['sendFax']=function(_0x12f174){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x149'),_0x12f174[_0x6ebf('0x3a')]));return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x14a'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x14b')]=function(_0x170f8d){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x170f8d['label']));if(!this[_0x6ebf('0x81')](_0x170f8d[_0x6ebf('0x14c')])){return this[_0x6ebf('0x3c')]['noop'](_0x6ebf('0x14d'));}var _0x363399=this['getSmsAccount'][_0x6ebf('0x7a')](this,_0x170f8d['sms_account_id']);if(!_0x363399){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x170f8d,_0x6ebf('0x14e'));}var _0x24e745={'body':_0x170f8d[_0x6ebf('0x14f')],'phone':_0x170f8d['to']||'','SmsAccountId':_0x363399['id']};logger[_0x6ebf('0xaa')](_0x6ebf('0x150'),JSON['stringify'](_0x24e745));this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x170f8d,_0x170f8d[_0x6ebf('0x14c')]);this[_0x6ebf('0x3c')]['noop'](util['format'](_0x6ebf('0x151'),_0x363399[_0x6ebf('0x12')]));this[_0x6ebf('0x37')]['sync'](this,_0x24e745);return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x152'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x153')]=function(_0x5c5877){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x154'),_0x5c5877[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x5c5877[_0x6ebf('0xa4')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x5c5877,'no\x20variable\x20selected');}var _0x11eba8=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x5c5877[_0x6ebf('0xa4')]);if(!_0x11eba8){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x5c5877,_0x6ebf('0xa5'));}return this['channel'][_0x6ebf('0x78')](_0x11eba8,_0x5c5877[_0x6ebf('0x155')]);};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x156')]=function(_0x5bceda){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x157'),_0x5bceda['label']));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x158'));if(_0x5bceda[_0x6ebf('0x86')]==='yes'){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')]('Answer');return this['channel'][_0x6ebf('0x86')]();}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x159'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x15a')]=function(_0x490cd8){logger['info'](util[_0x6ebf('0x29')](_0x6ebf('0x15b'),_0x490cd8[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x490cd8[_0x6ebf('0x15c')])){return this['channel'][_0x6ebf('0x34')](_0x490cd8,'no\x20subproject\x20selected');}var _0x187745=this[_0x6ebf('0x16')]['sync'](this,_0x490cd8[_0x6ebf('0x15c')]);if(!this['isConfigured'](_0x187745)){return this['channel'][_0x6ebf('0x34')](_0x490cd8,util[_0x6ebf('0x29')](_0x6ebf('0x15d'),_0x490cd8[_0x6ebf('0x15c')]));}if(_0x187745===this[_0x6ebf('0x3c')][_0x6ebf('0x3d')]){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x490cd8,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x6ebf('0x38')][_0x6ebf('0x7a')](this,_0x490cd8,_0x187745);var _0x3543e4=this[_0x6ebf('0x3c')][_0x6ebf('0x57')](_0x6ebf('0x15e'),util[_0x6ebf('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x6ebf('0x7d')][_0x6ebf('0x141')]||_0x6ebf('0x15f'),_0x187745,this['channel'][_0x6ebf('0x3d')]));if(_0x3543e4[_0x6ebf('0x85')]===-0x1){return _0x3543e4;}return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x122'),'AGI',_0x187745));};AGIVertices['prototype'][_0x6ebf('0x160')]=function(_0x3528f2){logger['info'](util['format'](_0x6ebf('0x161'),_0x3528f2[_0x6ebf('0x3a')]));var _0x53c54d=this[_0x6ebf('0x56')][_0x6ebf('0x7a')](this,_0x3528f2[_0x6ebf('0x7e')]);this[_0x6ebf('0x38')]['sync'](this,_0x3528f2,_0x3528f2['command']);if(this[_0x6ebf('0x81')](_0x3528f2[_0x6ebf('0xa4')])){var _0x29473d=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x3528f2['variable_id']);if(_0x29473d){this[_0x6ebf('0x3c')][_0x6ebf('0x78')](_0x29473d,_0x53c54d);return this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3528f2[_0x6ebf('0x7e')],_0x29473d));}}return this['channel'][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3528f2[_0x6ebf('0x7e')]));};AGIVertices['prototype'][_0x6ebf('0x162')]=function(_0x2d9c5f){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x163'),_0x2d9c5f['label']));if(!this[_0x6ebf('0x81')](_0x2d9c5f[_0x6ebf('0x5d')])){return this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](_0x6ebf('0x93'));}this['channel']['noop'](util['format'](_0x6ebf('0x164'),_0x2d9c5f[_0x6ebf('0x5d')]));var _0x2f3bf5=this['googleTTS'][_0x6ebf('0x7a')](this,_0x2d9c5f);if(_0x2f3bf5){this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x2f3bf5));var _0x15ffa9=this[_0x6ebf('0x3c')][_0x6ebf('0xdd')](_0x2f3bf5);try{fs['unlink'](_0x2f3bf5+_0x6ebf('0xdf'));}catch(_0x3fd307){logger['error'](_0x3fd307);}return _0x15ffa9;}return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x2d9c5f,_0x6ebf('0xbc'));};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x165')]=function(_0x1a12ef){logger['info'](util[_0x6ebf('0x29')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1a12ef[_0x6ebf('0x3a')]));if(!this[_0x6ebf('0x81')](_0x1a12ef[_0x6ebf('0x10d')])){return this[_0x6ebf('0x3c')]['error'](_0x1a12ef,_0x6ebf('0x10b'));}logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')](_0x6ebf('0x10c'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x1a12ef[_0x6ebf('0x10d')]));var _0x91e3ee=this[_0x6ebf('0x51')][_0x6ebf('0x7a')](this,_0x1a12ef['findBy']);if(_0x91e3ee){logger[_0x6ebf('0x2e')](util[_0x6ebf('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x1a12ef[_0x6ebf('0x10d')]));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')](_0x6ebf('0x10e'),this[_0x6ebf('0x3c')][_0x6ebf('0x3e')],_0x1a12ef[_0x6ebf('0x10d')]));return{'code':0xc8,'result':_0x6ebf('0x10f')};}else{logger['info'](util['format'](_0x6ebf('0x110'),this[_0x6ebf('0x3c')]['callerid'],_0x1a12ef[_0x6ebf('0x10d')]));this[_0x6ebf('0x3c')][_0x6ebf('0x8c')](util[_0x6ebf('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x6ebf('0x3c')]['callerid'],_0x1a12ef['findBy']));return{'code':0xc8,'result':_0x6ebf('0x111')};}};AGIVertices[_0x6ebf('0xe')][_0x6ebf('0x166')]=function(_0x3c6d7a){logger[_0x6ebf('0x2e')](util['format'](_0x6ebf('0x167'),_0x3c6d7a['label']));var _0x1256ce=this[_0x6ebf('0x3c')][_0x6ebf('0x57')]('VOICEMAIL',[_0x3c6d7a[_0x6ebf('0x168')],_0x3c6d7a[_0x6ebf('0x90')]]);if(_0x1256ce[_0x6ebf('0x85')]===-0x1){return _0x1256ce;}return this['channel']['noop'](util[_0x6ebf('0x29')](_0x6ebf('0x122'),_0x6ebf('0x169'),_0x3c6d7a[_0x6ebf('0x168')]));};AGIVertices['prototype'][_0x6ebf('0x16a')]=function(_0x3fc8f8){logger['info'](util['format'](_0x6ebf('0x16b'),_0x3fc8f8[_0x6ebf('0x3a')]));if(!this['isConfigured'](_0x3fc8f8[_0x6ebf('0xa4')])){return this[_0x6ebf('0x3c')]['error'](_0x3fc8f8,_0x6ebf('0x16c'));}var _0x5a1eae=this[_0x6ebf('0xf')][_0x6ebf('0x7a')](this,_0x3fc8f8[_0x6ebf('0xa4')]);if(!_0x5a1eae){return this[_0x6ebf('0x3c')][_0x6ebf('0x34')](_0x3fc8f8,_0x6ebf('0xa5'));}var _0x2c6b85=this[_0x6ebf('0x3c')][_0x6ebf('0xf')](_0x5a1eae);return{'code':0xc8,'result':_0x2c6b85[_0x6ebf('0x75')]?_0x2c6b85['extra']:'-'};};String[_0x6ebf('0xe')][_0x6ebf('0x74')]=function(_0xe74a16,_0x36ab3b){return this[_0x6ebf('0x72')](_0xe74a16)[_0x6ebf('0x16d')](_0x36ab3b);};module['exports']=AGIVertices; \ No newline at end of file +var _0x54f4=['prototype','getVariable','then','name','catch','getVoiceQueueById','getSquareProject','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','interval','map','format','getQueryOdbc','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleTTS','google_tts_language','googleDialogflow','key','text','dialogflow_language','ispeech_tts_language','en-US','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','googleASR','google_asr_language','tildeASR','uri','clear','clone','hasOwnProperty','isString','replaceAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','sync','retry','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','timeout','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','add','callback_priority','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','options','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','DIAL','opts','url','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','toUpperCase','Dialogflow\x20Result\x20%s','speech','Google\x20TTS\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','stringify','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','.wav','aws\x20Polly\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','%s.%s','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','beep','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','condition','no\x20condition\x20configured','true','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','ispeech\x20%s\x20file\x20created','login','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','no\x20queue\x20selected','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','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','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','service','host','port','secure','authentication','pass','template_id','sendMail\x20message','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20selected','arg_1','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','path','lodash','shelljs','odbc','randomstring','moment','mustache','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','menu','getdigits','getsecretdigits','channel','rpc','mailRpc'];(function(_0x3a4a66,_0x5afde4){var _0x2bd136=function(_0x3e0b45){while(--_0x3e0b45){_0x3a4a66['push'](_0x3a4a66['shift']());}};_0x2bd136(++_0x5afde4);}(_0x54f4,0x16a));var _0x454f=function(_0x9abeb6,_0x462036){_0x9abeb6=_0x9abeb6-0x0;var _0x85626e=_0x54f4[_0x9abeb6];return _0x85626e;};'use strict';var fs=require('fs');var path=require(_0x454f('0x0'));var util=require('util');var _=require(_0x454f('0x1'));var sh=require(_0x454f('0x2'));var odbc=require(_0x454f('0x3'))();var rs=require(_0x454f('0x4'));var moment=require(_0x454f('0x5'));var Mustache=require(_0x454f('0x6'));var logger=require('../../config/logger')(_0x454f('0x7'));var config=require(_0x454f('0x8'));var scripts=require(_0x454f('0x9'));var FILES_PATH=_0x454f('0xa');var verticesWithRetry=[_0x454f('0xb'),_0x454f('0xc'),_0x454f('0xd')];var AGIVertices=function(_0x5dda35,_0x4da1a0,_0x4c7ca1){this[_0x454f('0xe')]=_0x5dda35;this[_0x454f('0xf')]=_0x4da1a0;this[_0x454f('0x10')]=_0x4c7ca1;};AGIVertices[_0x454f('0x11')][_0x454f('0x12')]=function(_0x1198bb,_0x38135a){this[_0x454f('0xf')]['getVariableById'](_0x1198bb)[_0x454f('0x13')](function(_0x27ce96){_0x38135a(null,_0x27ce96?_0x27ce96[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x1c49a6){_0x38135a(_0x1c49a6);});};AGIVertices[_0x454f('0x11')]['getVoiceQueue']=function(_0x23fda1,_0x46e2fc){this[_0x454f('0xf')][_0x454f('0x16')](_0x23fda1)['then'](function(_0x5dcd69){_0x46e2fc(null,_0x5dcd69?_0x5dcd69[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x2cf267){_0x46e2fc(_0x2cf267);});};AGIVertices['prototype'][_0x454f('0x17')]=function(_0x4b0cd0,_0x10e5c8){this[_0x454f('0xf')]['getSquareProjectById'](_0x4b0cd0)[_0x454f('0x13')](function(_0x910483){_0x10e5c8(null,_0x910483?_0x910483[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x24da11){_0x10e5c8(_0x24da11);});};AGIVertices[_0x454f('0x11')]['getSquareOdbc']=function(_0x49c690,_0x86245c){this[_0x454f('0xf')]['getSquareOdbcById'](_0x49c690)[_0x454f('0x13')](function(_0x1ab893){_0x86245c(null,_0x1ab893?_0x1ab893[_0x454f('0x18')]:![]);})[_0x454f('0x15')](function(_0xedc57f){_0x86245c(_0xedc57f);});};AGIVertices[_0x454f('0x11')][_0x454f('0x19')]=function(_0x26389e,_0x598128){this[_0x454f('0xf')][_0x454f('0x1a')](_0x26389e)[_0x454f('0x13')](function(_0x58e41c){_0x598128(null,_0x58e41c?_0x58e41c[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x331ed3){_0x598128(_0x331ed3);});};AGIVertices[_0x454f('0x11')][_0x454f('0x1b')]=function(_0xe7a32d,_0x44db42){this[_0x454f('0xf')][_0x454f('0x1c')](_0xe7a32d)['then'](function(_0x4fed97){_0x44db42(null,_0x4fed97?_0x4fed97[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x5338ec){_0x44db42(_0x5338ec);});};AGIVertices[_0x454f('0x11')][_0x454f('0x1d')]=function(_0xd1906e,_0x17d157){var _0x59b54b=this;this[_0x454f('0xf')][_0x454f('0x1e')](_0xd1906e)[_0x454f('0x13')](function(_0x4aede6){_0x17d157(null,_0x4aede6?_0x59b54b[_0x454f('0x1f')](_0x4aede6[_0x454f('0x20')]):![]);})[_0x454f('0x15')](function(_0x2bc88a){_0x17d157(_0x2bc88a);});};AGIVertices[_0x454f('0x11')][_0x454f('0x21')]=function(_0x26cf65,_0x2e9fa4){this[_0x454f('0xf')]['getMailAccountById'](_0x26cf65)[_0x454f('0x13')](function(_0x5686bc){_0x2e9fa4(null,_0x5686bc?_0x5686bc:![]);})[_0x454f('0x15')](function(_0x251279){_0x2e9fa4(_0x251279);});};AGIVertices[_0x454f('0x11')][_0x454f('0x22')]=function(_0x3d8f5d,_0x25bb69,_0x2e66bf){this['mailRpc']['sendMailMessage'](_0x3d8f5d,_0x25bb69)['then'](function(){_0x2e66bf(null);})[_0x454f('0x15')](function(_0xff76ba){_0x2e66bf(_0xff76ba);});};AGIVertices[_0x454f('0x11')][_0x454f('0x23')]=function(_0x1d49ab,_0xd46c39){this[_0x454f('0xf')][_0x454f('0x24')](_0x1d49ab)[_0x454f('0x13')](function(_0x2c468d){if(_0x2c468d){if(_0x2c468d['IntervalId']){_0xd46c39(null,[_0x2c468d[_0x454f('0x25')]]);}else{_0xd46c39(null,_[_0x454f('0x26')](_0x2c468d['Intervals'],_0x454f('0x25')));}}else{_0xd46c39(null,![]);}})[_0x454f('0x15')](function(_0x35cb4c){_0xd46c39(_0x35cb4c);});};AGIVertices['prototype'][_0x454f('0x1f')]=function(_0x43a798){return util[_0x454f('0x27')]('%s/sounds/converted/%s',FILES_PATH,_0x43a798);};AGIVertices[_0x454f('0x11')][_0x454f('0x28')]=function(_0x35e28d,_0x157196,_0x3a7a35){odbc['open'](_0x35e28d,function(_0xea9f96){if(_0xea9f96){logger[_0x454f('0x29')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0xea9f96);_0x3a7a35(_0xea9f96);}else{logger[_0x454f('0x2a')](_0x454f('0x2b'));odbc['query'](_0x157196,function(_0x52f9b4,_0x5a6ccc){if(_0x52f9b4){logger['info'](_0x454f('0x2c'),_0x157196);_0x3a7a35(_0x52f9b4);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x157196);odbc[_0x454f('0x2d')](function(_0x574c26){if(_0x574c26){logger[_0x454f('0x29')](_0x454f('0x2e'),_0x574c26);}_0x3a7a35(null,_0x5a6ccc);});}});}});};AGIVertices['prototype'][_0x454f('0x2f')]=function(_0x12e0e1,_0x5d3e2a){this[_0x454f('0xf')]['getSmsAccountById'](_0x12e0e1)[_0x454f('0x13')](function(_0xbcccb7){_0x5d3e2a(null,_0xbcccb7?_0xbcccb7:![]);})[_0x454f('0x15')](function(_0x5a02aa){_0x5d3e2a(_0x5a02aa);});};AGIVertices[_0x454f('0x11')][_0x454f('0x30')]=function(_0x40c4c9,_0x3c90fb){this[_0x454f('0xf')][_0x454f('0x30')](_0x40c4c9)[_0x454f('0x13')](function(_0x34559e){_0x3c90fb(null,_0x34559e);})[_0x454f('0x15')](function(_0xa09c1){_0x3c90fb(_0xa09c1);});};AGIVertices[_0x454f('0x11')][_0x454f('0x31')]=function(_0x44842b,_0x99a4d4,_0x173106){this[_0x454f('0xf')][_0x454f('0x31')]({'uniqueid':this[_0x454f('0xe')][_0x454f('0x32')],'node':_0x44842b[_0x454f('0x33')],'application':_0x44842b[_0x454f('0x34')],'data':_0x99a4d4||null,'project_name':this['channel']['arg_1'],'callerid':this[_0x454f('0xe')][_0x454f('0x35')]})[_0x454f('0x13')](function(_0x848ace){_0x173106(null,_0x848ace);})[_0x454f('0x15')](function(_0x513771){_0x173106(_0x513771);});};AGIVertices[_0x454f('0x11')][_0x454f('0x36')]=function(_0x561241,_0x2a01a8,_0x3b7e57,_0x2e98a8){this['rpc']['createSquareRecording']({'uniqueid':this['channel'][_0x454f('0x32')],'callerid':this[_0x454f('0xe')]['callerid'],'calleridname':this[_0x454f('0xe')][_0x454f('0x37')],'context':this[_0x454f('0xe')][_0x454f('0x38')],'extension':this[_0x454f('0xe')]['extension'],'priority':this['channel'][_0x454f('0x39')],'accountcode':this[_0x454f('0xe')][_0x454f('0x3a')],'dnid':this['channel'][_0x454f('0x3b')],'projectName':this[_0x454f('0xe')]['arg_1'],'saveName':_0x2a01a8,'filename':_0x561241[_0x454f('0x3c')]||_0x2a01a8,'savePath':_0x3b7e57})[_0x454f('0x13')](function(_0x423d8b){_0x2e98a8(null,_0x423d8b);})['catch'](function(_0x50c0eb){_0x2e98a8(_0x50c0eb);});};AGIVertices[_0x454f('0x11')][_0x454f('0x3d')]=function(_0x2d34ce,_0x59785f){this[_0x454f('0xf')][_0x454f('0x3d')]({'firstName':_[_0x454f('0x3e')](_0x2d34ce[_0x454f('0x14')])||_[_0x454f('0x3f')](_0x2d34ce['name'])?_0x454f('0x40')+Math[_0x454f('0x41')]():_0x2d34ce['name'],'lastName':_['isEmpty'](_0x2d34ce[_0x454f('0x42')])||_['isNil'](_0x2d34ce[_0x454f('0x42')])?null:_0x2d34ce[_0x454f('0x42')],'phone':_0x2d34ce[_0x454f('0x43')],'ListId':_0x2d34ce[_0x454f('0x44')],'scheduledAt':_0x2d34ce[_0x454f('0x45')],'callbackUniqueid':this['channel'][_0x454f('0x32')],'tags':_0x454f('0x46'),'description':_0x454f('0x47')+_0x2d34ce[_0x454f('0x45')][_0x454f('0x48')](),'priority':_0x2d34ce['callback_priority']})[_0x454f('0x13')](function(_0x562d42){_0x59785f(null,_0x562d42);})[_0x454f('0x15')](function(_0x1a66c4){_0x59785f(_0x1a66c4);});};AGIVertices['prototype'][_0x454f('0x49')]=function(_0x31df00,_0x35f440){this[_0x454f('0xf')][_0x454f('0x4a')](_0x31df00)['then'](function(_0x21e82c){_0x35f440(null,_0x21e82c?_0x21e82c[_0x454f('0x14')]:![]);})[_0x454f('0x15')](function(_0x5ba84c){_0x35f440(_0x5ba84c);});};AGIVertices[_0x454f('0x11')][_0x454f('0x4b')]=function(_0x1e75d9,_0x14d303,_0x2414f6){var _0x3243ca={'role':_0x454f('0x4c')};_0x3243ca[_0x1e75d9]=this[_0x454f('0xe')]['callerid'];this[_0x454f('0xf')]['agentPause'](_0x3243ca,_0x14d303,this[_0x454f('0xe')][_0x454f('0x32')])[_0x454f('0x13')](function(_0x4d7ba0){_0x2414f6(null,_[_0x454f('0x3f')](_0x4d7ba0)?![]:!![]);})['catch'](function(_0x5de15e){logger['error'](_0x5de15e);_0x2414f6(null,![]);});};AGIVertices[_0x454f('0x11')][_0x454f('0x4d')]=function(_0x4b5a67,_0x56aaf3){var _0x52b463={'role':_0x454f('0x4c')};_0x52b463[_0x4b5a67]=this[_0x454f('0xe')][_0x454f('0x35')];this[_0x454f('0xf')][_0x454f('0x4d')](_0x52b463)['then'](function(_0x4b3061){_0x56aaf3(null,_[_0x454f('0x3f')](_0x4b3061)?![]:!![]);})['catch'](function(_0x3f1a42){logger[_0x454f('0x29')](_0x3f1a42);_0x56aaf3(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x275015,_0x13a3b6){var _0x78377={'role':_0x454f('0x4c')};_0x78377[_0x275015]=this[_0x454f('0xe')][_0x454f('0x35')];this[_0x454f('0xf')][_0x454f('0x4e')](_0x78377)[_0x454f('0x13')](function(_0xad716e){_0x13a3b6(null,_[_0x454f('0x3f')](_0xad716e)?![]:!![]);})[_0x454f('0x15')](function(_0x114026){logger[_0x454f('0x29')](_0x114026);_0x13a3b6(null,![]);});};AGIVertices[_0x454f('0x11')]['agentLogin']=function(_0x372565,_0x32276c){var _0x2cf392={'role':_0x454f('0x4c')};_0x2cf392[_0x372565]=this[_0x454f('0xe')][_0x454f('0x35')];var _0x189848=_0x372565!=_0x454f('0x4f')?util[_0x454f('0x27')](_0x454f('0x50'),_0x454f('0x51'),this[_0x454f('0xe')][_0x454f('0x35')]):undefined;this[_0x454f('0xf')][_0x454f('0x52')](_0x2cf392,_0x189848)[_0x454f('0x13')](function(_0x2562c2){_0x32276c(null,_['isNil'](_0x2562c2)?![]:!![]);})[_0x454f('0x15')](function(_0x2c7cfd){logger['error'](_0x2c7cfd);_0x32276c(null,![]);});};AGIVertices['prototype'][_0x454f('0x53')]=function(_0x3280d1,_0x19b38f){sh[_0x454f('0x54')](_['trim'](_0x3280d1),function(_0x5b5184,_0x50a68e){var _0x29a703=_0x50a68e[_0x454f('0x55')](/(\r\n|\n|\r)/gm,'');_0x19b38f(null,_0x29a703);});};AGIVertices['prototype'][_0x454f('0x56')]=function(_0x25ad18,_0x3aa96d){scripts[_0x454f('0x56')](_0x25ad18['text'],_0x25ad18[_0x454f('0x57')]||'en',0x1)[_0x454f('0x13')](function(_0x3210a0){_0x3aa96d(null,_0x3210a0);})[_0x454f('0x15')](function(_0x3895fc){_0x3aa96d(_0x3895fc);});};AGIVertices[_0x454f('0x11')][_0x454f('0x58')]=function(_0x1a1405,_0x33a43e){scripts[_0x454f('0x58')](this[_0x454f('0xe')][_0x454f('0x32')],_0x1a1405[_0x454f('0x59')],_0x1a1405[_0x454f('0x5a')],_0x1a1405[_0x454f('0x5b')]||'en')[_0x454f('0x13')](function(_0xc0f43f){_0x33a43e(null,_0xc0f43f);})['catch'](function(_0xe74d87){_0x33a43e(_0xe74d87);});};AGIVertices[_0x454f('0x11')]['ispeechTTS']=function(_0x5b7754,_0x52a784){scripts['ispeechTTS'](_0x5b7754[_0x454f('0x59')],_0x5b7754[_0x454f('0x5a')],_0x5b7754[_0x454f('0x5c')]||_0x454f('0x5d'),_0x5b7754[_0x454f('0x5e')])['then'](function(_0x2f216d){_0x52a784(null,_0x2f216d);})[_0x454f('0x15')](function(_0x6c03a4){_0x52a784(_0x6c03a4);});};AGIVertices[_0x454f('0x11')][_0x454f('0x5f')]=function(_0x4d0aba,_0x27e664,_0x2ee270){scripts['ispeechASR'](_0x27e664,_0x4d0aba[_0x454f('0x59')],_0x4d0aba['ispeech_asr_language']||_0x454f('0x5d'),this[_0x454f('0x60')](_0x4d0aba[_0x454f('0x61')])?_0x4d0aba['model']:undefined)[_0x454f('0x13')](function(_0x57490d){_0x2ee270(null,_0x57490d);})[_0x454f('0x15')](function(_0x2bf583){_0x2ee270(_0x2bf583);});};AGIVertices[_0x454f('0x11')][_0x454f('0x62')]=function(_0x3606ed,_0x170d81){scripts[_0x454f('0x62')](_0x3606ed[_0x454f('0x63')],_0x3606ed[_0x454f('0x64')],_0x3606ed[_0x454f('0x65')],_0x3606ed[_0x454f('0x66')]||_0x454f('0x67'),_0x3606ed[_0x454f('0x5a')],_0x3606ed[_0x454f('0x68')]||_0x454f('0x5a'))[_0x454f('0x13')](function(_0x3692be){_0x170d81(null,_0x3692be);})[_0x454f('0x15')](function(_0x189b51){_0x170d81(_0x189b51);});};AGIVertices[_0x454f('0x11')][_0x454f('0x69')]=function(_0x2bc502,_0x45f595,_0x585a75){scripts[_0x454f('0x69')](_0x45f595,_0x2bc502[_0x454f('0x59')],_0x2bc502[_0x454f('0x6a')]||_0x454f('0x5d'))['then'](function(_0x166edb){_0x585a75(null,_0x166edb);})['catch'](function(_0x550d1c){_0x585a75(_0x550d1c);});};AGIVertices['prototype'][_0x454f('0x6b')]=function(_0x2efa27,_0x26593b,_0x328cea){scripts[_0x454f('0x6b')](_0x26593b,_0x2efa27['appid'],_0x2efa27['appsecret'],_0x2efa27[_0x454f('0x6c')])[_0x454f('0x13')](function(_0x1ad27c){_0x328cea(null,_0x1ad27c);})[_0x454f('0x15')](function(_0xd0e9dc){_0x328cea(_0xd0e9dc);});};AGIVertices[_0x454f('0x11')][_0x454f('0x6d')]=function(_0xcd2210){var _0x439a48=_['includes'](verticesWithRetry,_0xcd2210[_0x454f('0x34')])?_0xcd2210:_[_0x454f('0x6e')](_0xcd2210);for(var _0x5147ec in _0x439a48){if(_0x439a48[_0x454f('0x6f')](_0x5147ec)){if(_0x439a48[_0x5147ec]&&_[_0x454f('0x70')](_0x439a48[_0x5147ec])){_0x439a48[_0x5147ec]=this[_0x454f('0x71')](_0x439a48[_0x5147ec]);}}}return _0x439a48;};AGIVertices[_0x454f('0x11')]['replaceAllVariables']=function(_0x362ecf){var _0x5ba20d=_0x362ecf[_0x454f('0x72')]('{');for(var _0x28930a=0x1;_0x28930a<_0x5ba20d[_0x454f('0x73')];_0x28930a+=0x1){var _0x1f634f=_0x5ba20d[_0x28930a][_0x454f('0x72')]('}');if(_0x1f634f['length']>0x1){_0x362ecf=_0x362ecf[_0x454f('0x74')]('{'+_0x1f634f[0x0]+'}',this[_0x454f('0xe')][_0x454f('0x12')](_0x1f634f[0x0])[_0x454f('0x75')]||_0x1f634f[0x0]);}}if(_0x5ba20d[_0x454f('0x73')]===0x1){return _0x362ecf[_0x454f('0x48')]();}return this[_0x454f('0x71')](_0x362ecf);};AGIVertices[_0x454f('0x11')][_0x454f('0x76')]=function(_0x28d164,_0x1d537c){var _0x11f1ab=this[_0x454f('0xe')]['getVariable'](_0x28d164);if(_0x11f1ab[_0x454f('0x77')]===-0x1){return _0x11f1ab;}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x78'),_0x1d537c,_0x11f1ab['extra']));return this[_0x454f('0xe')][_0x454f('0x79')](_0x1d537c,_0x11f1ab[_0x454f('0x75')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x60')]=function(_0x3d9908){return _0x3d9908&&_0x3d9908!=='0'&&_0x3d9908!=='-1'&&_0x3d9908!=='';};AGIVertices[_0x454f('0x11')][_0x454f('0x7a')]=function(_0x29eb5a){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x29eb5a,'-');_0x29eb5a[_0x454f('0x7c')]=_0x29eb5a[_0x454f('0x7a')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x454f('0x11')]['agi']=function(_0x44dbd4){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x7d'),_0x44dbd4['label']));return this[_0x454f('0xe')]['agi']([_0x44dbd4['command'],_0x44dbd4[_0x454f('0x7e')]]);};AGIVertices[_0x454f('0x11')][_0x454f('0x7f')]=function(_0x1d9255){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x80'),_0x1d9255['label']));if(this['isConfigured'](_0x1d9255[_0x454f('0x81')])){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x82'),_0x1d9255[_0x454f('0x81')]));var _0x4f3dc8=this['channel'][_0x454f('0x83')](_0x1d9255[_0x454f('0x81')]);if(_0x4f3dc8['result']===-0x1){return _0x4f3dc8;}}return this[_0x454f('0xe')][_0x454f('0x7f')]();};AGIVertices[_0x454f('0x11')]['callback']=function(_0x23205d){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x23205d['label']));if(!this[_0x454f('0x60')](_0x23205d[_0x454f('0x44')])){return this['channel'][_0x454f('0x29')](_0x23205d,_0x454f('0x84'));}_0x23205d['scheduledAt']=moment();if(this['isConfigured'](_0x23205d[_0x454f('0x85')])){_0x23205d[_0x454f('0x45')]=moment()[_0x454f('0x86')](_0x23205d[_0x454f('0x85')],'minutes');}if(!this[_0x454f('0x60')](_0x23205d[_0x454f('0x87')])){_0x23205d['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x23205d);return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x89'),_0x23205d['phone'],_0x23205d['list_id'],_0x23205d['scheduledAt']));};AGIVertices[_0x454f('0x11')]['custom_app']=function(_0x21a644){logger[_0x454f('0x2a')](util['format'](_0x454f('0x8a'),_0x21a644[_0x454f('0x33')]));var _0x4f4a1c=this[_0x454f('0xe')]['exec'](_0x21a644[_0x454f('0x8b')],_0x21a644[_0x454f('0x8c')]);if(_0x4f4a1c[_0x454f('0x77')]===-0x1){return _0x4f4a1c;}return this['channel']['noop'](util[_0x454f('0x27')]('Executed\x20command\x20%s\x20%s',_0x21a644[_0x454f('0x8b')],_0x21a644['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x2a7c08){logger[_0x454f('0x2a')](util['format'](_0x454f('0x8d'),_0x2a7c08[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x2a7c08[_0x454f('0x5a')])){return this['channel'][_0x454f('0x88')](_0x454f('0x8e'));}var _0x41b069='\x22'+_0x2a7c08['text']+'\x22';if(this[_0x454f('0x60')](_0x2a7c08[_0x454f('0x8c')])){_0x41b069+=','+_0x2a7c08[_0x454f('0x8c')];}var _0x334e8f=this[_0x454f('0xe')][_0x454f('0x54')]('MRCPSynth',_0x41b069);if(_0x334e8f['result']===-0x1){return _0x334e8f;}return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0x8f'),_0x41b069));};AGIVertices[_0x454f('0x11')][_0x454f('0x90')]=function(_0x931e33){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x91'),_0x931e33['label']));if(!this[_0x454f('0x60')](_0x931e33[_0x454f('0x92')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x93'));}var _0x341d2c=_0x931e33[_0x454f('0x92')];if(this[_0x454f('0x60')](_0x931e33[_0x454f('0x8c')])){_0x341d2c+=','+_0x931e33[_0x454f('0x8c')];}var _0xa79789=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x94'),_0x341d2c);if(_0xa79789[_0x454f('0x77')]===-0x1){return _0xa79789;}var _0x5fefdd=this[_0x454f('0x76')](_0x454f('0x95'),_0x454f('0x96'));if(_0x5fefdd[_0x454f('0x77')]===-0x1){return _0x5fefdd;}var _0x50c3c0=this['getAndSetVariable'](_0x454f('0x97'),_0x454f('0x98'));if(_0x50c3c0[_0x454f('0x77')]===-0x1){return _0x50c3c0;}var _0x1b15cd=this['getAndSetVariable'](_0x454f('0x99'),_0x454f('0x9a'));if(_0x1b15cd['result']===-0x1){return _0x1b15cd;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x9b'),_0x341d2c));};AGIVertices[_0x454f('0x11')][_0x454f('0x9c')]=function(_0x299ac8){logger[_0x454f('0x2a')](util['format'](_0x454f('0x9d'),_0x299ac8['label']));if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0x9e')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0x9f'));}var _0xab23e7=this['getSquareOdbc'][_0x454f('0x7b')](this,_0x299ac8[_0x454f('0x9e')]);if(!_0xab23e7){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0xa0'));}if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0xa1')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,_0x454f('0xa2'));}var _0x4ec618=_0x299ac8[_0x454f('0xa1')][_0x454f('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('query:\x20%s',_0x4ec618));var _0x4ef64a=this[_0x454f('0x28')][_0x454f('0x7b')](this,_0xab23e7,_0x4ec618);this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x299ac8,_0x4ec618);if(!this[_0x454f('0x60')](_0x299ac8[_0x454f('0xa3')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xa4'));}var _0x2e5a71=this['getVariable'][_0x454f('0x7b')](this,_0x299ac8[_0x454f('0xa3')]);if(!_0x2e5a71){return this[_0x454f('0xe')][_0x454f('0x29')](_0x299ac8,'no\x20variable\x20found');}var _0x3cf886=this;_0x4ef64a[_0x454f('0xa5')](function(_0x4a1893,_0xd128ff){Object['keys'](_0x4a1893)['forEach'](function(_0x33e6d5){_0x3cf886['channel'][_0x454f('0x79')](util[_0x454f('0x27')]('%s[%s][%s]',_0x2e5a71,_0xd128ff,_0x33e6d5),_0x4a1893[_0x33e6d5]);});});this[_0x454f('0xe')]['setVariable'](util[_0x454f('0x27')](_0x454f('0xa6'),_0x2e5a71),_0x4ef64a[_0x454f('0x73')]);return this[_0x454f('0xe')][_0x454f('0x88')](util['format']('variable\x20%s\x20set',_0x2e5a71));};AGIVertices['prototype'][_0x454f('0xa7')]=function(_0x1e1317){logger[_0x454f('0xa8')](util[_0x454f('0x27')](_0x454f('0xa9'),_0x1e1317['label']));if(!this[_0x454f('0x60')](_0x1e1317['sip_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x1e1317,_0x454f('0xaa'));}var _0x23b34a=this[_0x454f('0x19')][_0x454f('0x7b')](this,_0x1e1317[_0x454f('0xab')]);if(!_0x23b34a){return this['channel'][_0x454f('0x29')](_0x1e1317,'no\x20user\x20found');}var _0x58d8a1=this['channel'][_0x454f('0x54')](_0x454f('0xac'),[util[_0x454f('0x27')]('SIP/%s',_0x23b34a),_0x1e1317['timeout'],_0x1e1317[_0x454f('0xad')],_0x1e1317[_0x454f('0xae')]]);if(_0x58d8a1['result']===-0x1){return _0x58d8a1;}return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xaf'),'DIAL'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb0')]=function(_0x487bad){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x487bad[_0x454f('0x33')]));if(!this['isConfigured'](_0x487bad['key'])){return this['channel'][_0x454f('0x88')](_0x454f('0xb1'));}if(!this[_0x454f('0x60')](_0x487bad[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop'](_0x454f('0x8e'));}this[_0x454f('0xe')]['noop'](util['format'](_0x454f('0xb2'),_0x487bad[_0x454f('0x5a')]));var _0x9e38bb=this['googleDialogflow'][_0x454f('0x7b')](this,_0x487bad);if(_0x9e38bb){for(var _0x558fbe in _0x9e38bb){if(_0x9e38bb['hasOwnProperty'](_0x558fbe)){this[_0x454f('0xe')][_0x454f('0x79')](util[_0x454f('0x27')]('DIALOGFLOW_%s',_0x558fbe[_0x454f('0xb3')]()),_0x9e38bb[_0x558fbe]);}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xb4'),_0x9e38bb[_0x454f('0xb5')]));}return this['channel'][_0x454f('0x29')](_0x487bad,_0x454f('0xb6'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb7')]=function(_0x49020b){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xb8'),_0x49020b['label']));return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xb7'));};AGIVertices[_0x454f('0x11')][_0x454f('0xb9')]=function(_0x449e67){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xba'),_0x449e67[_0x454f('0x33')]));var _0x3fa2cc='';if(_0x449e67[_0x454f('0xbb')]){if(!this[_0x454f('0x60')](_0x449e67[_0x454f('0xbb')])){return this['channel'][_0x454f('0x29')](_0x449e67,_0x454f('0xbc'));}else{var _0x41696f=parseInt(_0x449e67[_0x454f('0xbb')],0xa);if(isNaN(_0x41696f)){_0x3fa2cc=_0x449e67[_0x454f('0xbb')];}else{_0x3fa2cc=this['getTrunk'][_0x454f('0x7b')](this,_0x449e67['trunk_id']);if(!_0x3fa2cc){return this['channel'][_0x454f('0x29')](_0x449e67,_0x454f('0xbd'));}}}}else if(_0x449e67[_0x454f('0xbe')]){_0x3fa2cc=_0x449e67['trunk_name'];}else{return this[_0x454f('0xe')]['error'](_0x449e67,_0x454f('0xbc'));}var _0x55a0e6=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0xac'),[util[_0x454f('0x27')](_0x454f('0xbf'),_0x3fa2cc,_0x449e67[_0x454f('0x43')]),_0x449e67[_0x454f('0x81')],_0x449e67[_0x454f('0xad')],_0x449e67[_0x454f('0xae')]]);if(_0x55a0e6['result']===-0x1){return _0x55a0e6;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('Executed\x20command\x20%s',_0x454f('0xac')));};AGIVertices[_0x454f('0x11')][_0x454f('0xc0')]=function(_0x4c610d){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4c610d[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xc0'));};AGIVertices[_0x454f('0x11')][_0x454f('0xc')]=function(_0x15b9e3){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x15b9e3[_0x454f('0x33')]));if(_0x15b9e3[_0x454f('0x7c')]===0x0){return this['maxRetry'](_0x15b9e3);}_0x15b9e3[_0x454f('0x7c')]-=0x1;if(!this[_0x454f('0x60')](_0x15b9e3['file_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc1'));}var _0x3d0429=this['getSound'][_0x454f('0x7b')](this,_0x15b9e3[_0x454f('0xc2')]);if(!_0x3d0429){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc3'));}if(!this[_0x454f('0x60')](_0x15b9e3[_0x454f('0xa3')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x454f('0xa4'));}var _0x5b9601=this[_0x454f('0xe')][_0x454f('0xc4')](_0x3d0429,_0x15b9e3['response'],_0x15b9e3[_0x454f('0xc5')]);var _0x1d7f46=_0x5b9601[_0x454f('0x77')]?_0x5b9601[_0x454f('0x77')][_0x454f('0x48')]():'';logger[_0x454f('0x2a')](_0x454f('0xc6'),JSON[_0x454f('0xc7')](_0x5b9601));if(_0x5b9601[_0x454f('0x77')]===-0x1){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,_0x1d7f46);return _0x5b9601;}else if(_0x5b9601['extra']===_0x454f('0x81')){_0x5b9601[_0x454f('0x77')]=_0x1d7f46[_0x454f('0x73')]>=parseInt(_0x15b9e3[_0x454f('0xc8')])?'x':'i';}else{_0x5b9601[_0x454f('0x77')]=_0x1d7f46[_0x454f('0x73')]>=parseInt(_0x15b9e3[_0x454f('0xc8')])&&_0x1d7f46[_0x454f('0x73')]<=parseInt(_0x15b9e3['maxdigit'])?'x':'i';}var _0x331117=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x15b9e3[_0x454f('0xa3')]);if(!_0x331117){return this[_0x454f('0xe')][_0x454f('0x29')](_0x15b9e3,_0x454f('0xc9'));}this[_0x454f('0xe')][_0x454f('0x79')](_0x331117,_0x1d7f46);if(this[_0x454f('0x60')](_0x15b9e3['hiddendigitsnum'])){var _0x85544d=parseInt(_0x15b9e3[_0x454f('0xca')],0xa);var _0x4f5e83=rs[_0x454f('0xcb')]({'charset':'*','length':_0x85544d});var _0x530d4e=_0x1d7f46[_0x454f('0x73')];if(_0x530d4e>0x0){if(_0x530d4e>_0x85544d){this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,_0x15b9e3[_0x454f('0xcc')]===_0x454f('0xcd')?_0x4f5e83+_0x1d7f46['substr'](_0x85544d):_0x1d7f46[_0x454f('0xce')](0x0,_0x530d4e-_0x85544d)+_0x4f5e83);}else{this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,rs[_0x454f('0xcb')]({'charset':'*','length':_0x530d4e}));}}else{this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x15b9e3,'');}}else{this['createSquareDetailsReport'][_0x454f('0x7b')](this,_0x15b9e3,_0x1d7f46);}return _0x5b9601;};AGIVertices[_0x454f('0x11')][_0x454f('0xd')]=function(_0x3ff93a){logger['info'](util['format'](_0x454f('0xcf'),_0x3ff93a[_0x454f('0x33')]));return this[_0x454f('0xc')](_0x3ff93a);};AGIVertices[_0x454f('0x11')][_0x454f('0xd0')]=function(_0x3b2df3){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xd1'),_0x3b2df3[_0x454f('0x33')]));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x3b2df3,_0x3b2df3[_0x454f('0xd2')]);return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xd3'),_0x3b2df3[_0x454f('0xd2')]));};AGIVertices[_0x454f('0x11')][_0x454f('0xd4')]=function(_0x59f58d){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xd5'),_0x59f58d[_0x454f('0x33')]));if(!this['isConfigured'](_0x59f58d[_0x454f('0x63')])||!this[_0x454f('0x60')](_0x59f58d[_0x454f('0x64')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xd6'));}if(!this['isConfigured'](_0x59f58d[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop']('no\x20text\x20configured');}this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xd7'),_0x59f58d[_0x454f('0x5a')]));var _0x5e495=this[_0x454f('0x62')][_0x454f('0x7b')](this,_0x59f58d);if(_0x5e495){this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xd8'),_0x5e495));var _0x221403=this[_0x454f('0xe')][_0x454f('0xd9')](_0x5e495);try{fs[_0x454f('0xda')](_0x5e495+_0x454f('0xdb'));}catch(_0x52cb17){logger[_0x454f('0x29')](_0x52cb17);}return _0x221403;}return this[_0x454f('0xe')][_0x454f('0x29')](_0x59f58d,_0x454f('0xdc'));};AGIVertices['prototype'][_0x454f('0xdd')]=function(_0x2a565d){logger[_0x454f('0x2a')](util['format'](_0x454f('0xde'),_0x2a565d[_0x454f('0x33')],_0x2a565d[_0x454f('0x81')]));if(!this['isConfigured'](_0x2a565d[_0x454f('0x59')])){return this[_0x454f('0xe')]['noop'](_0x454f('0xb1'));}var _0x276a11=_0x454f('0xdf');var _0x3f49fe=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs['generate'](0x4));var _0x12346f=util[_0x454f('0x27')](_0x454f('0xe1'),_0x3f49fe,_0x276a11);var _0x1c6c86=!![];if(_0x2a565d['beep']===_0x454f('0xe2')){_0x1c6c86=![];}var _0x38f6fa=this['channel'][_0x454f('0xe3')](_0x3f49fe,_0x276a11,_0x2a565d['intKey'],_0x2a565d[_0x454f('0x81')],undefined,_0x1c6c86);if(_0x38f6fa[_0x454f('0x77')]!==-0x1){this['channel'][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xe4'),_0x12346f));var _0x1baa01=this[_0x454f('0x69')][_0x454f('0x7b')](this,_0x2a565d,_0x12346f);if(_0x1baa01){for(var _0xefb0f7 in _0x1baa01){if(_0x1baa01[_0x454f('0x6f')](_0xefb0f7)){this[_0x454f('0xe')][_0x454f('0x79')](util[_0x454f('0x27')]('GOOGLE_ASR_%s',_0xefb0f7[_0x454f('0xb3')]()),_0x1baa01[_0xefb0f7]);}}return this['channel'][_0x454f('0x88')](util['format'](_0x454f('0xe5'),JSON[_0x454f('0xc7')](_0x1baa01)));}}return _0x38f6fa;};AGIVertices[_0x454f('0x11')][_0x454f('0xe6')]=function(_0x19e3c2){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xe7'),_0x19e3c2[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x19e3c2[_0x454f('0xe8')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xe9'));}if(!this['isConfigured'](_0x19e3c2[_0x454f('0xea')])){return this['channel'][_0x454f('0x88')]('no\x20appsecret\x20configured');}var _0x3d6917='wav';var _0xf1e4f1=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs[_0x454f('0xcb')](0x4));var _0x3a945e=util[_0x454f('0x27')](_0x454f('0xe1'),_0xf1e4f1,_0x3d6917);var _0x249644=!![];if(_0x19e3c2[_0x454f('0xeb')]===_0x454f('0xe2')){_0x249644=![];}var _0x9e2d07=this[_0x454f('0xe')][_0x454f('0xe3')](_0xf1e4f1,_0x3d6917,_0x19e3c2[_0x454f('0xec')],_0x19e3c2[_0x454f('0x81')],undefined,_0x249644);if(_0x9e2d07[_0x454f('0x77')]!==-0x1){this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xed'),_0x3a945e));var _0x324818=this[_0x454f('0x6b')][_0x454f('0x7b')](this,_0x19e3c2,_0x3a945e);if(_0x324818){for(var _0x2da095 in _0x324818){if(_0x324818[_0x454f('0x6f')](_0x2da095)){this['channel'][_0x454f('0x79')](util[_0x454f('0x27')](_0x454f('0xee'),_0x2da095[_0x454f('0xb3')]()),_0x324818[_0x2da095]);}}return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0xef'),JSON[_0x454f('0xc7')](_0x324818)));}}return _0x9e2d07;};AGIVertices[_0x454f('0x11')]['gotoc']=function(_0x122dd8){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0xf0'),_0x122dd8[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0xf1')](_0x122dd8[_0x454f('0x38')],_0x122dd8[_0x454f('0xf2')],_0x122dd8[_0x454f('0x39')]);};AGIVertices['prototype'][_0x454f('0xf3')]=function(_0x4ef70b){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4ef70b[_0x454f('0x33')]));if(!this['isConfigured'](_0x4ef70b[_0x454f('0xf4')])){return this[_0x454f('0xe')]['error'](_0x4ef70b,_0x454f('0xf5'));}try{var _0x29d1e2=eval(_0x4ef70b['condition'])?_0x454f('0xf6'):'false';this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4ef70b[_0x454f('0xf4')],_0x29d1e2));return{'code':0xc8,'result':_0x29d1e2};}catch(_0x168671){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x454f('0x11')]['gotoiftime']=function(_0x35a89a){logger['info'](util[_0x454f('0x27')](_0x454f('0xf7'),_0x35a89a['label']));if(!this[_0x454f('0x60')](_0x35a89a['interval_id'])){return this['channel'][_0x454f('0x29')](_0x35a89a,_0x454f('0xf8'));}var _0x261e53=this[_0x454f('0x23')][_0x454f('0x7b')](this,_0x35a89a[_0x454f('0xf9')]);if(!_0x261e53){return this[_0x454f('0xe')][_0x454f('0x29')](_0x35a89a,_0x454f('0xfa'));}for(var _0x35aa77=0x0;_0x35aa77<_0x261e53['length'];_0x35aa77+=0x1){var _0xd7bca5=this['channel'][_0x454f('0x12')](util['format'](_0x454f('0xfb'),_0x261e53[_0x35aa77]));if(_0xd7bca5[_0x454f('0x77')]===-0x1){return _0xd7bca5;}logger[_0x454f('0x2a')](util['format'](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0xd7bca5['extra']));if(_0xd7bca5[_0x454f('0x75')]===_0x454f('0xf6')){logger['info'](util[_0x454f('0x27')]('IFTIME\x20%s\x20%s',_0x261e53[_0x35aa77],_0x454f('0xf6')));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xf6')));return{'code':0xc8,'result':_0x454f('0xf6')};}else{logger['info'](util[_0x454f('0x27')](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xfd')));this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0xfc'),_0x261e53[_0x35aa77],_0x454f('0xfd')));}}return{'code':0xc8,'result':_0x454f('0xfd')};};AGIVertices['prototype'][_0x454f('0xfe')]=function(_0x145e4a){logger['info'](util[_0x454f('0x27')](_0x454f('0xff'),_0x145e4a[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0xfe')]();};AGIVertices[_0x454f('0x11')][_0x454f('0x100')]=function(_0x24ff91){logger['info'](util['format'](_0x454f('0x101'),_0x24ff91[_0x454f('0x33')]));if(!this['isConfigured'](_0x24ff91['key'])){return this[_0x454f('0xe')]['noop'](_0x454f('0xb1'));}var _0x1d9026='wav';var _0x547470=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,rs['generate'](0x4));var _0x5ded69=util[_0x454f('0x27')](_0x454f('0xe1'),_0x547470,_0x1d9026);var _0x4a8383=!![];if(_0x24ff91[_0x454f('0xeb')]===_0x454f('0xe2')){_0x4a8383=![];}var _0x570964=this[_0x454f('0xe')]['recordFile'](_0x547470,_0x1d9026,_0x24ff91[_0x454f('0xec')],_0x24ff91[_0x454f('0x81')],undefined,_0x4a8383);if(_0x570964['result']!==-0x1){this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('ispeech\x20%s\x20file\x20created',_0x5ded69));var _0x4e6b24=this[_0x454f('0x5f')][_0x454f('0x7b')](this,_0x24ff91,_0x5ded69);if(_0x4e6b24){for(var _0x15b02e in _0x4e6b24){if(_0x4e6b24[_0x454f('0x6f')](_0x15b02e)){this[_0x454f('0xe')][_0x454f('0x79')](util['format'](_0x454f('0x102'),_0x15b02e[_0x454f('0xb3')]()),_0x4e6b24[_0x15b02e]);}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x103'),JSON['stringify'](_0x4e6b24)));}}return _0x570964;};AGIVertices[_0x454f('0x11')][_0x454f('0x104')]=function(_0x3fde67){logger['info'](util['format'](_0x454f('0x105'),_0x3fde67[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x3fde67[_0x454f('0x59')])){return this['channel'][_0x454f('0x88')](_0x454f('0xb1'));}if(!this[_0x454f('0x60')](_0x3fde67[_0x454f('0x5a')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x8e'));}this['channel'][_0x454f('0x88')](util['format'](_0x454f('0x106'),_0x3fde67[_0x454f('0x5a')]));var _0x14f9bd=this[_0x454f('0x107')]['sync'](this,_0x3fde67);if(_0x14f9bd){this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x108'),_0x14f9bd));var _0x585b88=this[_0x454f('0xe')][_0x454f('0xd9')](_0x14f9bd,_0x3fde67['intKey']);try{fs[_0x454f('0xda')](_0x14f9bd+_0x454f('0xdb'));}catch(_0x12ad3f){logger[_0x454f('0x29')](_0x12ad3f);}return _0x585b88;}return this[_0x454f('0xe')][_0x454f('0x29')](_0x3fde67,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0x454f('0x109')]=function(_0x242e2b){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x242e2b['label']));if(!this[_0x454f('0x60')](_0x242e2b[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x242e2b,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util[_0x454f('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));var _0x46c9be=this[_0x454f('0x52')]['sync'](this,_0x242e2b[_0x454f('0x10a')]);if(_0x46c9be){logger[_0x454f('0x2a')](util['format'](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')]['callerid'],_0x242e2b[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10d')};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x242e2b[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')]['logout']=function(_0x5f5bf6){logger['info'](util[_0x454f('0x27')](_0x454f('0x110'),_0x5f5bf6[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x5f5bf6[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x5f5bf6,'no\x20find\x20by\x20configured');}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x111'),this[_0x454f('0xe')]['callerid'],_0x5f5bf6[_0x454f('0x10a')]));var _0x422810=this[_0x454f('0x4e')]['sync'](this,_0x5f5bf6['findBy']);if(_0x422810){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6[_0x454f('0x10a')]));this['channel'][_0x454f('0x88')](util['format'](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5f5bf6['findBy']));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10e'),this[_0x454f('0xe')]['callerid'],_0x5f5bf6['findBy']));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x112')]=function(_0x8d40ba){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x8d40ba['label']));if(!this['isConfigured'](_0x8d40ba[_0x454f('0x113')])){return this[_0x454f('0xe')]['error'](_0x8d40ba,_0x454f('0x114'));}this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')](_0x454f('0x115'),_0x8d40ba['operation']));var _0x17f96d=eval(_0x8d40ba[_0x454f('0x113')]);if(!this[_0x454f('0x60')](_0x8d40ba[_0x454f('0xa3')])){return this['channel'][_0x454f('0x88')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xdbf526=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x8d40ba['variable_id']);if(!_0xdbf526){return this['channel']['error'](_0x8d40ba,_0x454f('0xc9'));}if(_[_0x454f('0x116')](_0x17f96d)){var _0x264eb7=this;_0x17f96d[_0x454f('0xa5')](function(_0x1c43da,_0x10ed0f){_0x264eb7[_0x454f('0xe')][_0x454f('0x79')](util['format'](_0x454f('0x117'),_0xdbf526,_0x10ed0f),_0x1c43da);});return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x118'),_0xdbf526));}else{return this['channel'][_0x454f('0x79')](_0xdbf526,_0x17f96d);}};AGIVertices[_0x454f('0x11')][_0x454f('0xb')]=function(_0x2fe7e0){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20MENU\x20(%s)\x20block',_0x2fe7e0[_0x454f('0x33')]));if(_0x2fe7e0[_0x454f('0x7c')]===0x0){return this[_0x454f('0x7a')](_0x2fe7e0);}_0x2fe7e0[_0x454f('0x7c')]-=0x1;if(!this[_0x454f('0x60')](_0x2fe7e0[_0x454f('0xc2')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x2fe7e0,_0x454f('0xc1'));}var _0x8a99f8=this['getSound'][_0x454f('0x7b')](this,_0x2fe7e0['file_id']);if(!_0x8a99f8){return this['channel'][_0x454f('0x29')](_0x2fe7e0,_0x454f('0xc3'));}var _0x3ff8e0=this[_0x454f('0xe')][_0x454f('0xc4')](_0x8a99f8,_0x2fe7e0[_0x454f('0x119')],_0x2fe7e0[_0x454f('0x11a')]);var _0xec333=_0x3ff8e0[_0x454f('0x77')];if(_0x3ff8e0[_0x454f('0x77')]===-0x1){this['createSquareDetailsReport'][_0x454f('0x7b')](this,_0x2fe7e0,'-1');return _0x3ff8e0;}else if(_0x3ff8e0[_0x454f('0x75')]==='timeout'){_0x3ff8e0[_0x454f('0x77')]=_0x3ff8e0[_0x454f('0x77')][_0x454f('0x73')]>0x0?_0x3ff8e0['result']:'t';}else if(_[_0x454f('0x3e')](_0x3ff8e0[_0x454f('0x77')])){_0x3ff8e0[_0x454f('0x77')]='#';_0xec333='#';}if(!this[_0x454f('0x60')](_0x2fe7e0[_0x454f('0xa3')])){this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0xa4'));}else{var _0x36b4bf=this[_0x454f('0x12')]['sync'](this,_0x2fe7e0[_0x454f('0xa3')]);if(!_0x36b4bf){return this['channel']['error'](_0x2fe7e0,_0x454f('0xc9'));}this[_0x454f('0xe')][_0x454f('0x79')](_0x36b4bf,_0xec333);}this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x2fe7e0,_0xec333);return _0x3ff8e0;};AGIVertices['prototype'][_0x454f('0x88')]=function(_0x2d22aa){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x11b'),_0x2d22aa[_0x454f('0x33')]));return this[_0x454f('0xe')]['noop'](_0x2d22aa[_0x454f('0x11c')]||_0x2d22aa[_0x454f('0x33')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x11d')]=function(_0x5cbc56){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x11e'),_0x5cbc56['label']));if(!this[_0x454f('0x60')](_0x5cbc56[_0x454f('0x10a')])){return this['channel']['error'](_0x5cbc56,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util['format'](_0x454f('0x111'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));var _0x1dadd6=this[_0x454f('0x49')][_0x454f('0x7b')](this,_0x5cbc56['pause_id']);var _0x548915=this[_0x454f('0x4b')][_0x454f('0x7b')](this,_0x5cbc56[_0x454f('0x10a')],_0x1dadd6);if(_0x548915){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')]['callerid'],_0x5cbc56[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel'][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));return{'code':0xc8,'result':'success'};}else{logger[_0x454f('0x2a')](util[_0x454f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this[_0x454f('0xe')][_0x454f('0x35')],_0x5cbc56[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x11f')]=function(_0x54ed7c){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x120'),_0x54ed7c[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x54ed7c[_0x454f('0xc2')])){return this['channel'][_0x454f('0x29')](_0x54ed7c,_0x454f('0xc1'));}var _0x17880a=this[_0x454f('0x1d')][_0x454f('0x7b')](this,_0x54ed7c[_0x454f('0xc2')]);if(!_0x17880a){return this[_0x454f('0xe')][_0x454f('0x29')](_0x54ed7c,'no\x20file\x20audio\x20found');}var _0x55a37e=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x121'),[_0x17880a,_0x54ed7c[_0x454f('0xad')]]);if(_0x55a37e[_0x454f('0x77')]===-0x1){return _0x55a37e;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x122'),_0x454f('0x121'),_0x17880a));};AGIVertices['prototype'][_0x454f('0x123')]=function(_0x2322cf){logger['info'](util[_0x454f('0x27')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2322cf[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x2322cf['queue_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x2322cf,_0x454f('0x124'));}var _0x1ce5d5='';var _0x5afce0=parseInt(_0x2322cf[_0x454f('0x125')],0xa);if(isNaN(_0x5afce0)){_0x1ce5d5=_0x2322cf[_0x454f('0x125')];}else{_0x1ce5d5=this[_0x454f('0x126')]['sync'](this,_0x2322cf[_0x454f('0x125')]);if(!_0x1ce5d5){return this[_0x454f('0xe')]['error'](_0x2322cf,_0x454f('0x127'));}}var _0x532a20='';if(this[_0x454f('0x60')](_0x2322cf[_0x454f('0xc2')])){var _0x56b69e=this[_0x454f('0x1d')][_0x454f('0x7b')](this,_0x2322cf['file_id']);if(_0x56b69e){_0x532a20=_0x56b69e;}}this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x2322cf,_0x1ce5d5);if(_0x2322cf[_0x454f('0xad')]['indexOf']('x')<0x0){_0x2322cf[_0x454f('0xad')]+='x';}if(_0x2322cf[_0x454f('0xad')][_0x454f('0x128')]('X')<0x0){_0x2322cf[_0x454f('0xad')]+='X';}this['channel'][_0x454f('0x79')](_0x454f('0x129'),_0x1ce5d5?_0x1ce5d5[_0x454f('0x12a')]():'');var _0x34ab51=this[_0x454f('0xe')][_0x454f('0x54')]('QUEUE',[_0x1ce5d5,_0x2322cf[_0x454f('0xad')],_0x2322cf['url'],_0x532a20,_0x2322cf['timeout'],_0x2322cf[_0x454f('0x7')],_0x2322cf[_0x454f('0x12b')],_0x2322cf[_0x454f('0x12c')],'',_0x2322cf[_0x454f('0x12d')]]);if(_0x34ab51[_0x454f('0x77')]===-0x1){return _0x34ab51;}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x122'),_0x454f('0x12e'),_0x1ce5d5));};AGIVertices[_0x454f('0x11')]['record']=function(_0x1670c9){logger[_0x454f('0x2a')](util['format'](_0x454f('0x12f'),_0x1670c9[_0x454f('0x33')]));var _0x538dc9=_0x1670c9['recordingFormat']||_0x454f('0xdf');var _0x17e1b6=util['format'](_0x454f('0x130'),this['channel']['uniqueid'],rs[_0x454f('0xcb')](0x5));var _0xa5b4ab=util[_0x454f('0x27')](_0x454f('0x131'),FILES_PATH,_0x17e1b6,_0x538dc9);var _0x86c5d6=util[_0x454f('0x27')](_0x454f('0xe0'),FILES_PATH,_0x17e1b6);this[_0x454f('0x36')][_0x454f('0x7b')](this,_0x1670c9,_0x17e1b6,_0xa5b4ab);this['channel']['setVariable'](_0x454f('0x132'),_0x17e1b6);logger[_0x454f('0x2a')](_0x454f('0x133'),_0x86c5d6,_0x538dc9,_0x1670c9[_0x454f('0x134')],_0x1670c9['timeout']);return this['channel']['recordFile'](_0x86c5d6,_0x538dc9,_0x1670c9[_0x454f('0x134')],_0x1670c9['timeout'],undefined,!![]);};AGIVertices[_0x454f('0x11')][_0x454f('0x135')]=function(_0x402925){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x136'),_0x402925[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x137')](_0x402925[_0x454f('0x138')][_0x454f('0x55')](/\s+/g,''),_0x402925[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')]['saynumber']=function(_0x2bc598){logger[_0x454f('0x2a')](util[_0x454f('0x27')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2bc598[_0x454f('0x33')]));return this[_0x454f('0xe')]['sayNumber'](_0x2bc598[_0x454f('0x139')][_0x454f('0x55')](/\s+/g,''),_0x2bc598[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x13a')]=function(_0x5b1caa){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x13b'),_0x5b1caa[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x13c')](_0x5b1caa[_0x454f('0x5a')],_0x5b1caa[_0x454f('0x134')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x13d')]=function(_0x38bfed){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x13e'),_0x38bfed[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x38bfed[_0x454f('0x13f')])){return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x140'));}var _0x29247a=this[_0x454f('0x21')][_0x454f('0x7b')](this,_0x38bfed[_0x454f('0x13f')]);if(!_0x29247a||!_0x29247a['Smtp']){return this['channel'][_0x454f('0x29')](_0x38bfed,'no\x20mail\x20account\x20found');}var _0x2f266a={'from':util[_0x454f('0x27')](_0x454f('0x141'),_0x29247a[_0x454f('0x14')],_0x29247a[_0x454f('0x142')]||_0x29247a[_0x454f('0x143')][_0x454f('0x144')]),'to':_0x38bfed['to']||'','cc':_0x38bfed['cc']||'','bcc':_0x38bfed[_0x454f('0x145')]||'','subject':_0x38bfed[_0x454f('0x146')],'html':_0x38bfed[_0x454f('0x5a')],'text':_0x38bfed[_0x454f('0x5a')]};var _0x35b3b0={'tls':{'rejectUnauthorized':![]}};if(_0x29247a[_0x454f('0x143')][_0x454f('0x147')]){_0x35b3b0['service']=_0x29247a[_0x454f('0x143')][_0x454f('0x147')];}else{_0x35b3b0[_0x454f('0x148')]=_0x29247a['Smtp']['host'];_0x35b3b0[_0x454f('0x149')]=_0x29247a['Smtp']['port'];_0x35b3b0[_0x454f('0x14a')]=_0x29247a[_0x454f('0x143')][_0x454f('0x14a')];}if(_0x29247a['Smtp'][_0x454f('0x14b')]){_0x35b3b0['auth']={'user':_0x29247a['Smtp'][_0x454f('0x144')],'pass':_0x29247a[_0x454f('0x143')][_0x454f('0x14c')]};}if(this[_0x454f('0x60')](_0x38bfed[_0x454f('0x14d')])){}logger[_0x454f('0xa8')](_0x454f('0x14e'),JSON[_0x454f('0xc7')](_0x2f266a));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x38bfed,_0x38bfed['account_id']);this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x29247a[_0x454f('0x14')]));this[_0x454f('0x22')]['sync'](this,_0x35b3b0,_0x2f266a);return this['channel'][_0x454f('0x88')](_0x454f('0x14f'));};AGIVertices[_0x454f('0x11')][_0x454f('0x150')]=function(_0x268e2d){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x151'),_0x268e2d[_0x454f('0x33')]));return this[_0x454f('0xe')][_0x454f('0x88')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x454f('0x11')][_0x454f('0x152')]=function(_0x5601b6){logger[_0x454f('0x2a')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5601b6[_0x454f('0x33')]));if(!this['isConfigured'](_0x5601b6[_0x454f('0x153')])){return this[_0x454f('0xe')]['noop'](_0x454f('0x154'));}var _0x599695=this[_0x454f('0x2f')][_0x454f('0x7b')](this,_0x5601b6[_0x454f('0x153')]);if(!_0x599695){return this[_0x454f('0xe')][_0x454f('0x29')](_0x5601b6,_0x454f('0x155'));}var _0x299470={'body':_0x5601b6[_0x454f('0x156')],'phone':_0x5601b6['to']||'','SmsAccountId':_0x599695['id']};logger[_0x454f('0xa8')]('sendSMS\x20message',JSON[_0x454f('0xc7')](_0x299470));this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x5601b6,_0x5601b6[_0x454f('0x153')]);this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x157'),_0x599695['name']));this[_0x454f('0x30')][_0x454f('0x7b')](this,_0x299470);return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x158'));};AGIVertices[_0x454f('0x11')][_0x454f('0x159')]=function(_0x3b8b4e){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x15a'),_0x3b8b4e[_0x454f('0x33')]));if(!this[_0x454f('0x60')](_0x3b8b4e[_0x454f('0xa3')])){return this[_0x454f('0xe')]['error'](_0x3b8b4e,_0x454f('0x15b'));}var _0x1ad6ae=this['getVariable']['sync'](this,_0x3b8b4e[_0x454f('0xa3')]);if(!_0x1ad6ae){return this[_0x454f('0xe')]['error'](_0x3b8b4e,_0x454f('0xc9'));}return this[_0x454f('0xe')][_0x454f('0x79')](_0x1ad6ae,_0x3b8b4e[_0x454f('0x15c')]);};AGIVertices[_0x454f('0x11')][_0x454f('0x15d')]=function(_0x3ec885){logger['info'](util['format'](_0x454f('0x15e'),_0x3ec885[_0x454f('0x33')]));this[_0x454f('0xe')][_0x454f('0x88')]('START\x20CALLY\x20SQUARE');if(_0x3ec885['answer']===_0x454f('0x15f')){this[_0x454f('0xe')]['noop'](_0x454f('0x160'));return this[_0x454f('0xe')]['answer']();}return this[_0x454f('0xe')][_0x454f('0x88')](_0x454f('0x161'));};AGIVertices[_0x454f('0x11')][_0x454f('0x162')]=function(_0x34df3f){logger['info'](util[_0x454f('0x27')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x34df3f['label']));if(!this[_0x454f('0x60')](_0x34df3f[_0x454f('0x163')])){return this[_0x454f('0xe')]['error'](_0x34df3f,_0x454f('0x164'));}var _0x76e4df=this[_0x454f('0x17')][_0x454f('0x7b')](this,_0x34df3f[_0x454f('0x163')]);if(!this[_0x454f('0x60')](_0x76e4df)){return this[_0x454f('0xe')][_0x454f('0x29')](_0x34df3f,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x34df3f[_0x454f('0x163')]));}if(_0x76e4df===this[_0x454f('0xe')][_0x454f('0x165')]){return this['channel'][_0x454f('0x29')](_0x34df3f,_0x454f('0x166'));}this[_0x454f('0x31')]['sync'](this,_0x34df3f,_0x76e4df);var _0x1a8b80=this['channel'][_0x454f('0x54')](_0x454f('0x167'),util['format'](_0x454f('0x168'),config[_0x454f('0x7')]['host']||_0x454f('0x169'),_0x76e4df,this[_0x454f('0xe')][_0x454f('0x165')]));if(_0x1a8b80[_0x454f('0x77')]===-0x1){return _0x1a8b80;}return this[_0x454f('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x454f('0x167'),_0x76e4df));};AGIVertices[_0x454f('0x11')][_0x454f('0x16a')]=function(_0x3b85c2){logger[_0x454f('0x2a')](util['format'](_0x454f('0x16b'),_0x3b85c2[_0x454f('0x33')]));var _0x408cb6=this['shellCommand']['sync'](this,_0x3b85c2[_0x454f('0x16c')]);this[_0x454f('0x31')][_0x454f('0x7b')](this,_0x3b85c2,_0x3b85c2[_0x454f('0x16c')]);if(this[_0x454f('0x60')](_0x3b85c2[_0x454f('0xa3')])){var _0x2d0e63=this[_0x454f('0x12')]['sync'](this,_0x3b85c2[_0x454f('0xa3')]);if(_0x2d0e63){this[_0x454f('0xe')][_0x454f('0x79')](_0x2d0e63,_0x408cb6);return this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3b85c2['command'],_0x2d0e63));}}return this[_0x454f('0xe')][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x16d'),_0x3b85c2[_0x454f('0x16c')]));};AGIVertices['prototype']['tts']=function(_0x5169e6){logger['info'](util[_0x454f('0x27')](_0x454f('0x16e'),_0x5169e6['label']));if(!this[_0x454f('0x60')](_0x5169e6[_0x454f('0x5a')])){return this[_0x454f('0xe')]['noop']('no\x20text\x20configured');}this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x16f'),_0x5169e6['text']));var _0x5e5009=this[_0x454f('0x56')][_0x454f('0x7b')](this,_0x5169e6);if(_0x5e5009){this['channel']['noop'](util[_0x454f('0x27')](_0x454f('0x170'),_0x5e5009));var _0x18aeda=this[_0x454f('0xe')][_0x454f('0xd9')](_0x5e5009);try{fs[_0x454f('0xda')](_0x5e5009+_0x454f('0xdb'));}catch(_0x48caa8){logger[_0x454f('0x29')](_0x48caa8);}return _0x18aeda;}return this['channel'][_0x454f('0x29')](_0x5169e6,_0x454f('0xb6'));};AGIVertices['prototype'][_0x454f('0x171')]=function(_0x250282){logger['info'](util[_0x454f('0x27')](_0x454f('0x172'),_0x250282['label']));if(!this[_0x454f('0x60')](_0x250282[_0x454f('0x10a')])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x250282,_0x454f('0x10b'));}logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x111'),this['channel'][_0x454f('0x35')],_0x250282['findBy']));var _0x1a7220=this['agentUnpause'][_0x454f('0x7b')](this,_0x250282[_0x454f('0x10a')]);if(_0x1a7220){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel'][_0x454f('0x35')],_0x250282[_0x454f('0x10a')]));this['channel'][_0x454f('0x88')](util[_0x454f('0x27')](_0x454f('0x10c'),this['channel']['callerid'],_0x250282[_0x454f('0x10a')]));return{'code':0xc8,'result':_0x454f('0x10d')};}else{logger[_0x454f('0x2a')](util['format'](_0x454f('0x10e'),this[_0x454f('0xe')][_0x454f('0x35')],_0x250282[_0x454f('0x10a')]));this[_0x454f('0xe')]['noop'](util[_0x454f('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x454f('0xe')][_0x454f('0x35')],_0x250282['findBy']));return{'code':0xc8,'result':_0x454f('0x10f')};}};AGIVertices[_0x454f('0x11')][_0x454f('0x173')]=function(_0x236e98){logger[_0x454f('0x2a')](util['format'](_0x454f('0x174'),_0x236e98['label']));var _0x42c1ba=this[_0x454f('0xe')][_0x454f('0x54')](_0x454f('0x175'),[_0x236e98[_0x454f('0x176')],_0x236e98['options']]);if(_0x42c1ba[_0x454f('0x77')]===-0x1){return _0x42c1ba;}return this[_0x454f('0xe')][_0x454f('0x88')](util['format'](_0x454f('0x122'),'VOICEMAIL',_0x236e98[_0x454f('0x176')]));};AGIVertices[_0x454f('0x11')][_0x454f('0x177')]=function(_0x49bb2f){logger[_0x454f('0x2a')](util[_0x454f('0x27')](_0x454f('0x178'),_0x49bb2f['label']));if(!this[_0x454f('0x60')](_0x49bb2f['variable_id'])){return this[_0x454f('0xe')][_0x454f('0x29')](_0x49bb2f,_0x454f('0x15b'));}var _0x134bef=this[_0x454f('0x12')][_0x454f('0x7b')](this,_0x49bb2f['variable_id']);if(!_0x134bef){return this[_0x454f('0xe')][_0x454f('0x29')](_0x49bb2f,'no\x20variable\x20found');}var _0x1a422e=this[_0x454f('0xe')][_0x454f('0x12')](_0x134bef);return{'code':0xc8,'result':_0x1a422e[_0x454f('0x75')]?_0x1a422e[_0x454f('0x75')]:'-'};};String[_0x454f('0x11')]['replaceAll']=function(_0x5273a5,_0x3f4f39){return this[_0x454f('0x72')](_0x5273a5)[_0x454f('0x179')](_0x3f4f39);};module[_0x454f('0x17a')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 7d65f64..53593ca 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 _0xeb11=['[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','origtransfereruniqueid','[%s][ATTENDEDTRANSFER:LINKEDID]','origtransfererlinkedid','[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]','transfertargetuniqueid','find','format','localtwoconnectedlinename','findKey','SIP/%s','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','localhost','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','Action','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','ACW','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','uniqueid','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xeb11,0x6d));var _0x1eb1=function(_0x18b7a9,_0x415ae8){_0x18b7a9=_0x18b7a9-0x0;var _0x1ecbec=_0xeb11[_0x18b7a9];return _0x1ecbec;};'use strict';var util=require(_0x1eb1('0x0'));var _=require(_0x1eb1('0x1'));var moment=require(_0x1eb1('0x2'));var ami=require(_0x1eb1('0x3'));var logger=require(_0x1eb1('0x4'))(_0x1eb1('0x5'));var RpcUser=require(_0x1eb1('0x6'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var io=require('socket.io-emitter')({'host':_0x1eb1('0x7'),'port':0x18eb});function Acw(_0xe3dbaa){this[_0x1eb1('0x8')]=_0xe3dbaa[_0x1eb1('0x8')];this[_0x1eb1('0x9')]=_0xe3dbaa['agents'];this[_0x1eb1('0xa')]=_0xe3dbaa['timers'];this[_0x1eb1('0xb')]={};ami['on'](_0x1eb1('0xc'),this[_0x1eb1('0xd')][_0x1eb1('0xe')](this));ami['on'](_0x1eb1('0xf'),this[_0x1eb1('0x10')][_0x1eb1('0xe')](this));ami['on'](_0x1eb1('0x11'),this['syncHangup']['bind'](this));ami['on']('agentringnoanswer',this[_0x1eb1('0x12')][_0x1eb1('0xe')](this));ami['on'](_0x1eb1('0x13'),this[_0x1eb1('0x14')][_0x1eb1('0xe')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x1eb1('0xe')](this));ami['on'](_0x1eb1('0x15'),this['syncAgentConnectPreview'][_0x1eb1('0xe')](this));}function getDiff(_0x173a73){var _0x52996f=moment()['milliseconds'](0x0);var _0xbbc47b=moment(_0x173a73)[_0x1eb1('0x16')](0x0);return _0x52996f[_0x1eb1('0x17')](_0xbbc47b,_0x1eb1('0x18'));}Acw[_0x1eb1('0x19')][_0x1eb1('0x1a')]=function(_0x5af56e){try{var _0x425eba=this;var _0x32ce32=this[_0x1eb1('0xb')][_0x5af56e][_0x1eb1('0x1b')];var _0x3f4060=this[_0x1eb1('0xb')][_0x5af56e][_0x1eb1('0x1c')];ami[_0x1eb1('0x1d')]({'action':'QueuePause','interface':_0x32ce32,'paused':!![],'reason':'ACW'})[_0x1eb1('0x1e')](function(_0x5b6038){if(_0x425eba[_0x1eb1('0x9')][_0x32ce32]){return RpcUser[_0x1eb1('0x1f')](_0x425eba['agents'][_0x32ce32]['id'])[_0x1eb1('0x1e')](function(_0x1a6496){if(_0x1a6496&&!_0x1a6496[_0x1eb1('0x20')]){logger[_0x1eb1('0x21')](_0x1eb1('0x22'),_0x5af56e,_0x32ce32,_0x3f4060);return RpcUser[_0x1eb1('0x23')](_0x425eba[_0x1eb1('0x9')][_0x32ce32],_0x1eb1('0x24'),_0x5af56e)[_0x1eb1('0x1e')](function(_0x124c7a){_0x425eba[_0x1eb1('0xa')][_0x32ce32]={};logger['info'](_0x1eb1('0x25'),_0x5af56e,_0x425eba['voiceQueues'][_0x3f4060][_0x1eb1('0x26')],_0x32ce32,_0x3f4060);_0x425eba[_0x1eb1('0xa')][_0x32ce32][_0x1eb1('0x27')]=setTimeout(_0x425eba[_0x1eb1('0x28')][_0x1eb1('0xe')](_0x425eba,_0x32ce32),_0x425eba['voiceQueues'][_0x3f4060][_0x1eb1('0x26')]*0x3e8);_0x425eba[_0x1eb1('0xa')][_0x32ce32]['lastPauseAt']=_0x124c7a[_0x1eb1('0x29')];_0x425eba[_0x1eb1('0xa')][_0x32ce32][_0x1eb1('0x2a')]=_0x5af56e;_0x425eba['timers'][_0x32ce32][_0x1eb1('0x1c')]=_0x3f4060;_0x425eba[_0x1eb1('0xa')][_0x32ce32]['updateAcw']=function(){var _0x1352ba=getDiff(_0x425eba['timers'][_0x32ce32][_0x1eb1('0x29')]);clearTimeout(_0x425eba[_0x1eb1('0xa')][_0x32ce32][_0x1eb1('0x27')]);RpcVoiceAgentReport[_0x1eb1('0x2b')]({'acwtime':_0x1352ba},_0x425eba[_0x1eb1('0xa')][_0x32ce32][_0x1eb1('0x2a')],_0x32ce32)['then'](function(_0x39cbf0){logger[_0x1eb1('0x21')](_0x1eb1('0x2c'),_0x5af56e,_0x1352ba,_0x39cbf0);})[_0x1eb1('0x2d')](function(_0x801cf1){logger[_0x1eb1('0x2e')](_0x1eb1('0x2f'),_0x5af56e,_0x801cf1);});delete _0x425eba[_0x1eb1('0xa')][_0x32ce32];};});}else{logger['info'](_0x1eb1('0x30'),_0x5af56e,_0x32ce32,_0x3f4060);}});}})['catch'](function(_0x3b3d25){logger[_0x1eb1('0x2e')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x5af56e,_0x425eba[_0x1eb1('0x8')][_0x3f4060][_0x1eb1('0x26')],_0x32ce32,_0x3f4060);})['finally'](function(){delete _0x425eba[_0x1eb1('0xb')][_0x5af56e];});}catch(_0xfb5f2d){logger[_0x1eb1('0x2e')](_0x1eb1('0x31'),_0xfb5f2d['message']);}};Acw['prototype'][_0x1eb1('0x28')]=function(_0xf4b184){try{var _0x2838a3=this;if(_0x2838a3[_0x1eb1('0xa')][_0xf4b184]){var _0x173ad7=_0x2838a3[_0x1eb1('0xa')][_0xf4b184][_0x1eb1('0x2a')];var _0x2677ba=_0x2838a3[_0x1eb1('0xa')][_0xf4b184][_0x1eb1('0x1c')];var _0x19fa60=_0x2838a3[_0x1eb1('0x8')][_0x2677ba]['acwTimeout'];logger[_0x1eb1('0x21')]('[TIMER][STOP][AGENT:%s]',_0xf4b184);RpcUser[_0x1eb1('0x32')](this[_0x1eb1('0x9')][_0xf4b184]);RpcVoiceAgentReport[_0x1eb1('0x2b')]({'acwtime':_0x19fa60,'agentacw':!![]},_0x173ad7,_0xf4b184)['then'](function(_0x564a9e){logger[_0x1eb1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x173ad7,_0x19fa60,_0x564a9e);})['catch'](function(_0x601c6c){logger[_0x1eb1('0x2e')](_0x1eb1('0x2f'),_0x173ad7,_0x601c6c);});}else{logger[_0x1eb1('0x2e')](_0x1eb1('0x33'),_0xf4b184);if(_0x2838a3['timers']){logger[_0x1eb1('0x21')](_0x1eb1('0x34'),JSON['stringify'](_0x2838a3['timers']));}}}catch(_0x1d1f04){logger[_0x1eb1('0x2e')]('[ACW][STOP]\x20%s',_0x1d1f04[_0x1eb1('0x35')]);}};Acw['prototype'][_0x1eb1('0xd')]=function(_0x47be9f){try{if(this['voiceQueues'][_0x47be9f[_0x1eb1('0x1c')]]&&this[_0x1eb1('0x8')][_0x47be9f[_0x1eb1('0x1c')]][_0x1eb1('0x5')]){if(this[_0x1eb1('0x9')][_0x47be9f['interface']]){this[_0x1eb1('0xb')][_0x47be9f[_0x1eb1('0x2a')]]={'queue':_0x47be9f['queue'],'interface':_0x47be9f[_0x1eb1('0x1b')]};}}}catch(_0x4fa746){logger[_0x1eb1('0x2e')](_0x1eb1('0x36'),_0x4fa746[_0x1eb1('0x35')]);}};Acw[_0x1eb1('0x19')][_0x1eb1('0x37')]=function(_0x26c851){try{if(this[_0x1eb1('0x8')][_0x26c851[_0x1eb1('0x1c')]]&&this[_0x1eb1('0x8')][_0x26c851[_0x1eb1('0x1c')]][_0x1eb1('0x5')]){if(this[_0x1eb1('0x9')][_0x26c851[_0x1eb1('0x1b')]]){this[_0x1eb1('0xb')][_0x26c851[_0x1eb1('0x2a')]]={'queue':_0x26c851[_0x1eb1('0x1c')],'interface':_0x26c851[_0x1eb1('0x1b')]};}}}catch(_0x5898ce){logger[_0x1eb1('0x2e')](_0x1eb1('0x38'),_0x5898ce[_0x1eb1('0x35')]);}};Acw[_0x1eb1('0x19')][_0x1eb1('0x10')]=function(_0x5f27a0){try{if(this[_0x1eb1('0xb')][_0x5f27a0[_0x1eb1('0x2a')]]&&_[_0x1eb1('0x39')](this[_0x1eb1('0xb')][_0x5f27a0['uniqueid']][_0x1eb1('0x3a')])){logger[_0x1eb1('0x21')](_0x1eb1('0x3b'),_0x5f27a0[_0x1eb1('0x2a')]);this['startAcw'](_0x5f27a0[_0x1eb1('0x2a')]);}else if(this[_0x1eb1('0xb')][_0x5f27a0[_0x1eb1('0x3c')]]&&_['isUndefined'](this[_0x1eb1('0xb')][_0x5f27a0[_0x1eb1('0x3c')]]['attended'])){logger['info'](_0x1eb1('0x3d'),_0x5f27a0[_0x1eb1('0x3c')]);this[_0x1eb1('0x1a')](_0x5f27a0['linkedid']);}}catch(_0x1739e8){logger[_0x1eb1('0x2e')](_0x1eb1('0x3e'),_0x1739e8[_0x1eb1('0x35')]);}};Acw[_0x1eb1('0x19')]['syncHangup']=function(_0x3a0d6e){try{if(this['channels'][_0x3a0d6e[_0x1eb1('0x2a')]]&&this['channels'][_0x3a0d6e['uniqueid']][_0x1eb1('0x3a')]){logger[_0x1eb1('0x21')](_0x1eb1('0x3f'),_0x3a0d6e[_0x1eb1('0x2a')]);this[_0x1eb1('0x1a')](_0x3a0d6e[_0x1eb1('0x2a')]);}}catch(_0x2036e1){logger['error']('[ACW][syncHangup]\x20%s',_0x2036e1[_0x1eb1('0x35')]);}};Acw[_0x1eb1('0x19')][_0x1eb1('0x14')]=function(_0x47f5ae){try{if(this[_0x1eb1('0xb')][_0x47f5ae['origtransfereruniqueid']]){logger[_0x1eb1('0x21')]('[%s][ATTENDEDTRANSFER:UNIQUEID]',_0x47f5ae[_0x1eb1('0x40')]);this['startAcw'](_0x47f5ae[_0x1eb1('0x40')]);}else if(this[_0x1eb1('0xb')][_0x47f5ae['origtransfererlinkedid']]){logger[_0x1eb1('0x21')](_0x1eb1('0x41'),_0x47f5ae[_0x1eb1('0x42')]);this[_0x1eb1('0x1a')](_0x47f5ae['origtransfererlinkedid']);}logger[_0x1eb1('0x21')](_0x1eb1('0x43'),_0x47f5ae[_0x1eb1('0x44')]);this['channels'][_0x47f5ae['transfertargetuniqueid']]=_[_0x1eb1('0x45')](this['channels'],[_0x1eb1('0x1b'),util[_0x1eb1('0x46')]('SIP/%s',_0x47f5ae[_0x1eb1('0x47')])]);if(this[_0x1eb1('0xb')][_0x47f5ae['transfertargetuniqueid']]){this['channels'][_0x47f5ae[_0x1eb1('0x44')]]['attended']=!![];delete this[_0x1eb1('0xb')][_[_0x1eb1('0x48')](this[_0x1eb1('0xb')],[_0x1eb1('0x1b'),util[_0x1eb1('0x46')](_0x1eb1('0x49'),_0x47f5ae[_0x1eb1('0x47')])])];}}catch(_0x5c92a9){logger['error'](_0x1eb1('0x4a'),_0x5c92a9['message']);}};Acw['prototype'][_0x1eb1('0x4b')]=function(_0x1ffd18){try{if(this['channels'][_0x1ffd18['transfereruniqueid']]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x1ffd18[_0x1eb1('0x4c')]));this[_0x1eb1('0x1a')](_0x1ffd18[_0x1eb1('0x4c')]);}else if(this['channels'][_0x1ffd18[_0x1eb1('0x4d')]]){logger[_0x1eb1('0x21')](_0x1eb1('0x4e'),JSON[_0x1eb1('0x4f')](_0x1ffd18[_0x1eb1('0x4d')]));this[_0x1eb1('0x1a')](_0x1ffd18[_0x1eb1('0x4d')]);}}catch(_0x58fe93){logger['error'](_0x1eb1('0x50'),_0x58fe93[_0x1eb1('0x35')]);}};Acw[_0x1eb1('0x19')]['syncAgentRingNoAnswer']=function(_0x49e069){try{if(this['voiceQueues'][_0x49e069[_0x1eb1('0x1c')]]&&this['voiceQueues'][_0x49e069[_0x1eb1('0x1c')]][_0x1eb1('0x51')]===_0x1eb1('0x52')){if(this['agents'][_0x49e069['interface']]){logger[_0x1eb1('0x21')](_0x1eb1('0x53'),_0x49e069['uniqueid'],_0x49e069[_0x1eb1('0x1b')],_0x49e069[_0x1eb1('0x1c')]);return RpcUser[_0x1eb1('0x23')](this[_0x1eb1('0x9')][_0x49e069[_0x1eb1('0x1b')]],'Auto-Pause',_0x49e069[_0x1eb1('0x2a')]);}}}catch(_0x2c026f){logger[_0x1eb1('0x2e')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x2c026f['message']);}};module[_0x1eb1('0x54')]=Acw; \ No newline at end of file +var _0xdf17=['find','format','SIP/%s','localtwoconnectedlinename','findKey','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../rpc/user','socket.io-emitter','localhost','voiceQueues','agents','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','queue','Action','QueuePause','ACW','then','getAgent','info','[%s][START][AGENT:%s][QUEUE:%s]','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timers','stopAcw','acwTimeout','lastPauseAt','uniqueid','updateAcw','timer','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','error','[ACW][START]\x20%s','message','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','syncAgentConnect','acw','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','startAcw','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','[%s][ATTENDEDTRANSFER:UNIQUEID]','origtransfereruniqueid','origtransfererlinkedid','[%s][ATTENDEDTRANSFER:LINKEDID]','[%s][ATTENDEDTRANSFER:TRANSFERTARGETUNIQUEID]','transfertargetuniqueid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xdf17,0x16e));var _0x7df1=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdf17[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x7df1('0x0'));var _=require(_0x7df1('0x1'));var moment=require(_0x7df1('0x2'));var ami=require(_0x7df1('0x3'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0x7df1('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var io=require(_0x7df1('0x5'))({'host':_0x7df1('0x6'),'port':0x18eb});function Acw(_0x125a85){this[_0x7df1('0x7')]=_0x125a85[_0x7df1('0x7')];this[_0x7df1('0x8')]=_0x125a85['agents'];this['timers']=_0x125a85['timers'];this[_0x7df1('0x9')]={};ami['on'](_0x7df1('0xa'),this['syncAgentConnect'][_0x7df1('0xb')](this));ami['on'](_0x7df1('0xc'),this[_0x7df1('0xd')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0xe'),this[_0x7df1('0xf')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x10'),this[_0x7df1('0x11')]['bind'](this));ami['on']('attendedtransfer',this[_0x7df1('0x12')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x13'),this[_0x7df1('0x14')][_0x7df1('0xb')](this));ami['on'](_0x7df1('0x15'),this[_0x7df1('0x16')][_0x7df1('0xb')](this));}function getDiff(_0x305b20){var _0x3669cd=moment()[_0x7df1('0x17')](0x0);var _0xcd8687=moment(_0x305b20)[_0x7df1('0x17')](0x0);return _0x3669cd[_0x7df1('0x18')](_0xcd8687,_0x7df1('0x19'));}Acw[_0x7df1('0x1a')]['startAcw']=function(_0x4534f6){try{var _0x11c5c3=this;var _0xfb6158=this[_0x7df1('0x9')][_0x4534f6]['interface'];var _0x4242b9=this['channels'][_0x4534f6][_0x7df1('0x1b')];ami[_0x7df1('0x1c')]({'action':_0x7df1('0x1d'),'interface':_0xfb6158,'paused':!![],'reason':_0x7df1('0x1e')})[_0x7df1('0x1f')](function(_0x5f3bd7){if(_0x11c5c3[_0x7df1('0x8')][_0xfb6158]){return RpcUser[_0x7df1('0x20')](_0x11c5c3[_0x7df1('0x8')][_0xfb6158]['id'])[_0x7df1('0x1f')](function(_0x337466){if(_0x337466&&!_0x337466['voicePause']){logger[_0x7df1('0x21')](_0x7df1('0x22'),_0x4534f6,_0xfb6158,_0x4242b9);return RpcUser[_0x7df1('0x23')](_0x11c5c3['agents'][_0xfb6158],_0x7df1('0x1e'),_0x4534f6)[_0x7df1('0x1f')](function(_0xdb150){_0x11c5c3['timers'][_0xfb6158]={};logger[_0x7df1('0x21')](_0x7df1('0x24'),_0x4534f6,_0x11c5c3[_0x7df1('0x7')][_0x4242b9]['acwTimeout'],_0xfb6158,_0x4242b9);_0x11c5c3[_0x7df1('0x25')][_0xfb6158]['timer']=setTimeout(_0x11c5c3[_0x7df1('0x26')][_0x7df1('0xb')](_0x11c5c3,_0xfb6158),_0x11c5c3[_0x7df1('0x7')][_0x4242b9][_0x7df1('0x27')]*0x3e8);_0x11c5c3['timers'][_0xfb6158][_0x7df1('0x28')]=_0xdb150[_0x7df1('0x28')];_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x29')]=_0x4534f6;_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x1b')]=_0x4242b9;_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x2a')]=function(){var _0x46d5a7=getDiff(_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x28')]);clearTimeout(_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x2b')]);RpcVoiceAgentReport['update']({'acwtime':_0x46d5a7},_0x11c5c3[_0x7df1('0x25')][_0xfb6158][_0x7df1('0x29')],_0xfb6158)[_0x7df1('0x1f')](function(_0x18213b){logger[_0x7df1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x4534f6,_0x46d5a7,_0x18213b);})[_0x7df1('0x2c')](function(_0x3e2cf5){logger['error'](_0x7df1('0x2d'),_0x4534f6,_0x3e2cf5);});delete _0x11c5c3[_0x7df1('0x25')][_0xfb6158];};});}else{logger[_0x7df1('0x21')](_0x7df1('0x2e'),_0x4534f6,_0xfb6158,_0x4242b9);}});}})[_0x7df1('0x2c')](function(_0x5c54f8){logger['error'](_0x7df1('0x24'),_0x4534f6,_0x11c5c3[_0x7df1('0x7')][_0x4242b9]['acwTimeout'],_0xfb6158,_0x4242b9);})[_0x7df1('0x2f')](function(){delete _0x11c5c3['channels'][_0x4534f6];});}catch(_0x24c94a){logger[_0x7df1('0x30')](_0x7df1('0x31'),_0x24c94a[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x26')]=function(_0x195174){try{var _0x547937=this;if(_0x547937[_0x7df1('0x25')][_0x195174]){var _0x22329a=_0x547937['timers'][_0x195174][_0x7df1('0x29')];var _0x121278=_0x547937[_0x7df1('0x25')][_0x195174][_0x7df1('0x1b')];var _0x3199d9=_0x547937['voiceQueues'][_0x121278][_0x7df1('0x27')];logger['info']('[TIMER][STOP][AGENT:%s]',_0x195174);RpcUser[_0x7df1('0x33')](this[_0x7df1('0x8')][_0x195174]);RpcVoiceAgentReport[_0x7df1('0x34')]({'acwtime':_0x3199d9,'agentacw':!![]},_0x22329a,_0x195174)[_0x7df1('0x1f')](function(_0x4786cf){logger[_0x7df1('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x22329a,_0x3199d9,_0x4786cf);})[_0x7df1('0x2c')](function(_0x4c4a70){logger[_0x7df1('0x30')](_0x7df1('0x2d'),_0x22329a,_0x4c4a70);});}else{logger[_0x7df1('0x30')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x195174);if(_0x547937['timers']){logger[_0x7df1('0x21')](_0x7df1('0x35'),JSON[_0x7df1('0x36')](_0x547937[_0x7df1('0x25')]));}}}catch(_0x35713f){logger[_0x7df1('0x30')](_0x7df1('0x37'),_0x35713f[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x38')]=function(_0x2004bb){try{if(this[_0x7df1('0x7')][_0x2004bb[_0x7df1('0x1b')]]&&this[_0x7df1('0x7')][_0x2004bb[_0x7df1('0x1b')]][_0x7df1('0x39')]){if(this[_0x7df1('0x8')][_0x2004bb[_0x7df1('0x3a')]]){this[_0x7df1('0x9')][_0x2004bb[_0x7df1('0x29')]]={'queue':_0x2004bb[_0x7df1('0x1b')],'interface':_0x2004bb[_0x7df1('0x3a')]};}}}catch(_0x4993af){logger[_0x7df1('0x30')](_0x7df1('0x3b'),_0x4993af[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x16')]=function(_0x1789c1){try{if(this[_0x7df1('0x7')][_0x1789c1[_0x7df1('0x1b')]]&&this['voiceQueues'][_0x1789c1[_0x7df1('0x1b')]][_0x7df1('0x39')]){if(this['agents'][_0x1789c1[_0x7df1('0x3a')]]){this[_0x7df1('0x9')][_0x1789c1[_0x7df1('0x29')]]={'queue':_0x1789c1[_0x7df1('0x1b')],'interface':_0x1789c1[_0x7df1('0x3a')]};}}}catch(_0x236313){logger[_0x7df1('0x30')](_0x7df1('0x3c'),_0x236313['message']);}};Acw['prototype'][_0x7df1('0xd')]=function(_0x2d5eb2){try{if(this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x29')]]&&_['isUndefined'](this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x29')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x2d5eb2[_0x7df1('0x29')]);this[_0x7df1('0x3d')](_0x2d5eb2['uniqueid']);}else if(this[_0x7df1('0x9')][_0x2d5eb2[_0x7df1('0x3e')]]&&_[_0x7df1('0x3f')](this[_0x7df1('0x9')][_0x2d5eb2['linkedid']][_0x7df1('0x40')])){logger[_0x7df1('0x21')](_0x7df1('0x41'),_0x2d5eb2[_0x7df1('0x3e')]);this[_0x7df1('0x3d')](_0x2d5eb2['linkedid']);}}catch(_0x5327c0){logger[_0x7df1('0x30')]('[ACW][syncHangupRequest]\x20%s',_0x5327c0[_0x7df1('0x32')]);}};Acw[_0x7df1('0x1a')][_0x7df1('0xf')]=function(_0x23377c){try{if(this[_0x7df1('0x9')][_0x23377c[_0x7df1('0x29')]]&&this[_0x7df1('0x9')][_0x23377c[_0x7df1('0x29')]][_0x7df1('0x40')]){logger[_0x7df1('0x21')](_0x7df1('0x42'),_0x23377c[_0x7df1('0x29')]);this[_0x7df1('0x3d')](_0x23377c[_0x7df1('0x29')]);}}catch(_0x5bc421){logger['error'](_0x7df1('0x43'),_0x5bc421[_0x7df1('0x32')]);}};Acw[_0x7df1('0x1a')][_0x7df1('0x12')]=function(_0x44d7a1){try{if(this[_0x7df1('0x9')][_0x44d7a1['origtransfereruniqueid']]){logger[_0x7df1('0x21')](_0x7df1('0x44'),_0x44d7a1[_0x7df1('0x45')]);this[_0x7df1('0x3d')](_0x44d7a1[_0x7df1('0x45')]);}else if(this[_0x7df1('0x9')][_0x44d7a1[_0x7df1('0x46')]]){logger[_0x7df1('0x21')](_0x7df1('0x47'),_0x44d7a1['origtransfererlinkedid']);this['startAcw'](_0x44d7a1[_0x7df1('0x46')]);}logger['info'](_0x7df1('0x48'),_0x44d7a1[_0x7df1('0x49')]);this['channels'][_0x44d7a1[_0x7df1('0x49')]]=_[_0x7df1('0x4a')](this[_0x7df1('0x9')],['interface',util[_0x7df1('0x4b')](_0x7df1('0x4c'),_0x44d7a1[_0x7df1('0x4d')])]);if(this[_0x7df1('0x9')][_0x44d7a1[_0x7df1('0x49')]]){this['channels'][_0x44d7a1[_0x7df1('0x49')]]['attended']=!![];delete this[_0x7df1('0x9')][_[_0x7df1('0x4e')](this['channels'],['interface',util[_0x7df1('0x4b')](_0x7df1('0x4c'),_0x44d7a1[_0x7df1('0x4d')])])];}}catch(_0x49faa5){logger[_0x7df1('0x30')]('[ACW][syncAttendedTransfer]\x20%s',_0x49faa5['message']);}};Acw[_0x7df1('0x1a')][_0x7df1('0x14')]=function(_0x59f5a1){try{if(this[_0x7df1('0x9')][_0x59f5a1[_0x7df1('0x4f')]]){logger[_0x7df1('0x21')](_0x7df1('0x50'),JSON[_0x7df1('0x36')](_0x59f5a1[_0x7df1('0x4f')]));this[_0x7df1('0x3d')](_0x59f5a1[_0x7df1('0x4f')]);}else if(this['channels'][_0x59f5a1[_0x7df1('0x51')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x7df1('0x36')](_0x59f5a1[_0x7df1('0x51')]));this['startAcw'](_0x59f5a1[_0x7df1('0x51')]);}}catch(_0x1a270a){logger[_0x7df1('0x30')]('[ACW][syncBlindTransfer]\x20%s',_0x1a270a[_0x7df1('0x32')]);}};Acw['prototype'][_0x7df1('0x11')]=function(_0x49506e){try{if(this[_0x7df1('0x7')][_0x49506e['queue']]&&this[_0x7df1('0x7')][_0x49506e[_0x7df1('0x1b')]][_0x7df1('0x52')]===_0x7df1('0x53')){if(this[_0x7df1('0x8')][_0x49506e[_0x7df1('0x3a')]]){logger['info'](_0x7df1('0x54'),_0x49506e[_0x7df1('0x29')],_0x49506e[_0x7df1('0x3a')],_0x49506e[_0x7df1('0x1b')]);return RpcUser[_0x7df1('0x23')](this[_0x7df1('0x8')][_0x49506e[_0x7df1('0x3a')]],_0x7df1('0x55'),_0x49506e[_0x7df1('0x29')]);}}}catch(_0x720959){logger[_0x7df1('0x30')](_0x7df1('0x56'),_0x720959[_0x7df1('0x32')]);}};module[_0x7df1('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index fa5b619..cefbc36 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 _0x9957=['password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','SipShowRegistry','Action','sipshowregistry','actionDeviceStateList','info','action:','actionSipPeerStatus','SipPeerStatus','sippeerstatus','actionQueueSummary','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','log','asterisk-manager','bluebird','moment','util','../../config/logger','ami','../../config/environment','asterisk','username'];(function(_0x99aef1,_0x44772e){var _0x3c5203=function(_0x19d61e){while(--_0x19d61e){_0x99aef1['push'](_0x99aef1['shift']());}};_0x3c5203(++_0x44772e);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Manager=require(_0x7995('0x0'));var BPromise=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var _=require('lodash');var logger=require(_0x7995('0x4'))(_0x7995('0x5'));var config=require(_0x7995('0x6'));var ami=new Manager(config[_0x7995('0x7')]['port'],config[_0x7995('0x7')]['ip'],config[_0x7995('0x7')][_0x7995('0x8')],config[_0x7995('0x7')][_0x7995('0x9')],!![]);ami[_0x7995('0xa')]();ami['Action']=BPromise[_0x7995('0xb')](ami[_0x7995('0xc')]);function error(_0x4a64f7){logger[_0x7995('0xd')](util[_0x7995('0xe')](_0x7995('0xf'),config[_0x7995('0x7')][_0x7995('0x8')],config[_0x7995('0x7')]['ip'],config[_0x7995('0x7')]['port'],util[_0x7995('0x10')](_0x4a64f7,![],null)));}function close(){logger[_0x7995('0xd')](util['format'](_0x7995('0x11'),config[_0x7995('0x7')][_0x7995('0x8')],config[_0x7995('0x7')]['ip'],config[_0x7995('0x7')][_0x7995('0x12')]));}ami[_0x7995('0x13')]=function(){logger['info']('action:',_0x7995('0x14'));return function(){return ami[_0x7995('0x15')]({'action':_0x7995('0x16')});};};ami[_0x7995('0x17')]=function(){logger[_0x7995('0x18')](_0x7995('0x19'),_0x7995('0x14'));return function(){return ami[_0x7995('0x15')]({'action':'devicestatelist'});};};ami[_0x7995('0x1a')]=function(){logger['info'](_0x7995('0x19'),_0x7995('0x1b'));return function(){return ami[_0x7995('0x15')]({'action':_0x7995('0x1c')});};};ami[_0x7995('0x1d')]=function(){return function(){return ami[_0x7995('0x15')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x7995('0x15')]({'action':'coreshowchannels'});};};function connect(_0x555f74){logger[_0x7995('0x18')](util[_0x7995('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x7995('0x7')]['username'],config['asterisk']['ip'],config[_0x7995('0x7')][_0x7995('0x12')]));ami[_0x7995('0x1e')](_0x7995('0xd'),error);ami[_0x7995('0x1e')](_0x7995('0x1f'),close);}ami['on']('connect',connect);ami['on'](_0x7995('0x20'),function(_0x46ee4b){logger[_0x7995('0x18')](util[_0x7995('0xe')](_0x7995('0x21'),config[_0x7995('0x7')][_0x7995('0x8')],config[_0x7995('0x7')]['ip'],config['asterisk'][_0x7995('0x12')],util[_0x7995('0x10')](_0x46ee4b,![],null)));});ami['on'](_0x7995('0x22'),function(_0x268ce7){logger[_0x7995('0x18')](util[_0x7995('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x7995('0x7')]['username'],config[_0x7995('0x7')]['ip'],config[_0x7995('0x7')][_0x7995('0x12')]));return BPromise[_0x7995('0x23')]()[_0x7995('0x24')](ami['actionSipShowRegistry']())[_0x7995('0x24')](ami['actionDeviceStateList']())[_0x7995('0x24')](ami[_0x7995('0x1a')]())[_0x7995('0x24')](ami['actionQueueSummary']())['then'](ami['actionCoreShowChannels']())[_0x7995('0x25')](function(_0xe6b0b3){console[_0x7995('0x26')](_0xe6b0b3);});});ami[_0x7995('0x1e')](_0x7995('0xd'),error);ami[_0x7995('0x1e')]('close',close);module['exports']=ami; \ No newline at end of file +var _0x7a54=['Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','username','actionSipShowRegistry','info','action:','SipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','SipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','connect','shutdown','resolve','then','catch','log','exports','asterisk-manager','bluebird','moment','lodash','../../config/logger','../../config/environment','asterisk','port','keepConnected','Action','action'];(function(_0x22ed32,_0x37dedf){var _0x1e8eee=function(_0x5469fa){while(--_0x5469fa){_0x22ed32['push'](_0x22ed32['shift']());}};_0x1e8eee(++_0x37dedf);}(_0x7a54,0x106));var _0x47a5=function(_0x46ff77,_0x505583){_0x46ff77=_0x46ff77-0x0;var _0x92c9e1=_0x7a54[_0x46ff77];return _0x92c9e1;};'use strict';var Manager=require(_0x47a5('0x0'));var BPromise=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var util=require('util');var _=require(_0x47a5('0x3'));var logger=require(_0x47a5('0x4'))('ami');var config=require(_0x47a5('0x5'));var ami=new Manager(config[_0x47a5('0x6')][_0x47a5('0x7')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['password'],!![]);ami[_0x47a5('0x8')]();ami[_0x47a5('0x9')]=BPromise['promisify'](ami[_0x47a5('0xa')]);function error(_0x5077f3){logger['error'](util['format'](_0x47a5('0xb'),config[_0x47a5('0x6')]['username'],config[_0x47a5('0x6')]['ip'],config['asterisk']['port'],util[_0x47a5('0xc')](_0x5077f3,![],null)));}function close(){logger[_0x47a5('0xd')](util[_0x47a5('0xe')](_0x47a5('0xf'),config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config['asterisk'][_0x47a5('0x7')]));}ami[_0x47a5('0x11')]=function(){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x15')});};};ami[_0x47a5('0x16')]=function(){logger['info'](_0x47a5('0x13'),_0x47a5('0x14'));return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x17')});};};ami[_0x47a5('0x18')]=function(){logger['info']('action:',_0x47a5('0x19'));return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x47a5('0x1a')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1b')});};};ami[_0x47a5('0x1c')]=function(){return function(){return ami[_0x47a5('0x9')]({'action':_0x47a5('0x1d')});};};function connect(_0x2763d6){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config['asterisk']['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));ami[_0x47a5('0x1e')]('error',error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);}ami['on'](_0x47a5('0x20'),connect);ami['on'](_0x47a5('0x21'),function(_0x5ef1b1){logger[_0x47a5('0x12')](util[_0x47a5('0xe')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')],util['inspect'](_0x5ef1b1,![],null)));});ami['on']('fullybooted',function(_0x136745){logger['info'](util[_0x47a5('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x47a5('0x6')][_0x47a5('0x10')],config[_0x47a5('0x6')]['ip'],config[_0x47a5('0x6')][_0x47a5('0x7')]));return BPromise[_0x47a5('0x22')]()[_0x47a5('0x23')](ami[_0x47a5('0x11')]())[_0x47a5('0x23')](ami[_0x47a5('0x16')]())[_0x47a5('0x23')](ami[_0x47a5('0x18')]())[_0x47a5('0x23')](ami['actionQueueSummary']())[_0x47a5('0x23')](ami['actionCoreShowChannels']())[_0x47a5('0x24')](function(_0x9ac908){console[_0x47a5('0x25')](_0x9ac908);});});ami['once'](_0x47a5('0xd'),error);ami[_0x47a5('0x1e')](_0x47a5('0x1f'),close);module[_0x47a5('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 5cd4f3f..5d15af6 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 _0x58f5=['request','then','debug','memberReport','error','rpc','message','result','catch','jayson/promise','bluebird','../../config/logger','ami','client'];(function(_0x269ef0,_0x2c1b3f){var _0xf4a624=function(_0x1f9b30){while(--_0x1f9b30){_0x269ef0['push'](_0x269ef0['shift']());}};_0xf4a624(++_0x2c1b3f);}(_0x58f5,0x159));var _0x558f=function(_0x2e5a97,_0x29ab00){_0x2e5a97=_0x2e5a97-0x0;var _0x28b598=_0x58f5[_0x2e5a97];return _0x28b598;};'use strict';var jayson=require(_0x558f('0x0'));var BPromise=require(_0x558f('0x1'));var logger=require(_0x558f('0x2'))(_0x558f('0x3'));var client=jayson[_0x558f('0x4')]['http']({'port':0x2329});client['Request']=function(_0xb4c488,_0x253f6d){return new BPromise(function(_0x587f10,_0x1fbfe9){return client[_0x558f('0x5')](_0xb4c488,_0x253f6d)[_0x558f('0x6')](function(_0x490115){logger[_0x558f('0x7')]('rpc',_0x558f('0x8'),_0xb4c488,_0x253f6d,_0x490115);if(_0x490115[_0x558f('0x9')]){logger[_0x558f('0x9')](_0x558f('0xa'),_0x558f('0x8'),_0xb4c488,_0x490115[_0x558f('0x9')][_0x558f('0xb')],_0x253f6d);return _0x1fbfe9(_0x490115['error'][_0x558f('0xb')]);}else{return _0x587f10(_0x490115[_0x558f('0xc')]);}})[_0x558f('0xd')](function(_0x450d1e){logger[_0x558f('0x9')](_0x558f('0xa'),'memberReport',_0xb4c488,_0x450d1e,_0x253f6d);return _0x1fbfe9(_0x450d1e);});});};module['exports']=client; \ No newline at end of file +var _0x1611=['exports','jayson/promise','bluebird','../../config/logger','ami','Request','then','debug','rpc','memberReport','error','message','catch'];(function(_0x55969b,_0x1ebe62){var _0x3d7fc1=function(_0x5f2dbe){while(--_0x5f2dbe){_0x55969b['push'](_0x55969b['shift']());}};_0x3d7fc1(++_0x1ebe62);}(_0x1611,0xc4));var _0x1161=function(_0x7a286c,_0x22aee9){_0x7a286c=_0x7a286c-0x0;var _0x488661=_0x1611[_0x7a286c];return _0x488661;};'use strict';var jayson=require(_0x1161('0x0'));var BPromise=require(_0x1161('0x1'));var logger=require(_0x1161('0x2'))(_0x1161('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0x1161('0x4')]=function(_0x414eae,_0x3d3367){return new BPromise(function(_0x312324,_0x12394b){return client['request'](_0x414eae,_0x3d3367)[_0x1161('0x5')](function(_0x588680){logger[_0x1161('0x6')](_0x1161('0x7'),_0x1161('0x8'),_0x414eae,_0x3d3367,_0x588680);if(_0x588680['error']){logger['error'](_0x1161('0x7'),_0x1161('0x8'),_0x414eae,_0x588680[_0x1161('0x9')][_0x1161('0xa')],_0x3d3367);return _0x12394b(_0x588680[_0x1161('0x9')][_0x1161('0xa')]);}else{return _0x312324(_0x588680['result']);}})[_0x1161('0xb')](function(_0x2a579b){logger[_0x1161('0x9')]('rpc',_0x1161('0x8'),_0x414eae,_0x2a579b,_0x3d3367);return _0x12394b(_0x2a579b);});});};module[_0x1161('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 235766e..623af71 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4350=['VoiceQueueId','CampaignId','idHopper','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','number','substring','getQueue','exports','util','lodash','string','isNil','name','Contact','lastName','queue','active','type','dialQueueTimeout','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4350,0x1d0));var _0x0435=function(_0x5a65c9,_0x367902){_0x5a65c9=_0x5a65c9-0x0;var _0x55a806=_0x4350[_0x5a65c9];return _0x55a806;};'use strict';var util=require(_0x0435('0x0'));var _=require(_0x0435('0x1'));var moment=require('moment');function checkNameSurname(_0x165bec,_0x57ff95,_0x1527f9){var _0xf5146='';if(!_['isNil'](_0x57ff95)&&_0x0435('0x2')===typeof _0x57ff95){_0xf5146+=_0x57ff95;}if(!_[_0x0435('0x3')](_0x1527f9)&&_0x0435('0x2')===typeof _0x1527f9){_0xf5146+='\x20'+_0x1527f9;}if(_0xf5146!==''){return _0xf5146;}return _0x165bec;}function Action(_0x242079,_0x58a62d,_0x580eeb){this['voiceQueue']=_0x242079;this['uniqueid']=_0x580eeb||undefined;this[_0x0435('0x4')]=checkNameSurname(_0x58a62d['Contact']['phone'],_0x58a62d[_0x0435('0x5')]['firstName'],_0x58a62d[_0x0435('0x5')][_0x0435('0x6')]);this['number']=_0x58a62d[_0x0435('0x5')]['phone'];this[_0x0435('0x7')]=_0x242079[_0x0435('0x4')];this[_0x0435('0x8')]=_0x58a62d[_0x0435('0x8')]||![];this[_0x0435('0x9')]=_0x242079[_0x0435('0x9')];this[_0x0435('0xa')]=_0x242079[_0x0435('0xa')]||0x3;this['scheduledat']=_0x58a62d['scheduledat'];this[_0x0435('0xb')]=_0x58a62d['countbusyretry'];this[_0x0435('0xc')]=_0x58a62d['countcongestionretry'];this[_0x0435('0xd')]=_0x58a62d[_0x0435('0xd')];this['ContactId']=_0x58a62d[_0x0435('0xe')];this[_0x0435('0xf')]=_0x58a62d['ListId'];this[_0x0435('0x10')]=_0x58a62d['UserId'];this[_0x0435('0x11')]=_0x58a62d[_0x0435('0x11')];this[_0x0435('0x12')]=_0x58a62d[_0x0435('0x12')];this[_0x0435('0x13')]=_0x58a62d['id'];this['ContactFirstName']=_0x58a62d['Contact'][_0x0435('0x14')]||'';this[_0x0435('0x15')]=moment()[_0x0435('0x16')](_0x0435('0x17'));this[_0x0435('0x18')]=_0x58a62d[_0x0435('0x18')];this[_0x0435('0x19')]=_0x58a62d[_0x0435('0x19')];this[_0x0435('0x1a')]=_0x58a62d['callbackat'];this['recallme']=_0x58a62d['recallme'];this['originatecalleridnum']='';this[_0x0435('0x1b')]='';}Action[_0x0435('0x1c')][_0x0435('0x1d')]=function(){return util[_0x0435('0x16')](_0x0435('0x1e'),this[_0x0435('0x4')],this[_0x0435('0x1f')][_0x0435('0x20')]>0x0?this[_0x0435('0x21')][_0x0435('0x22')](this[_0x0435('0x1f')][_0x0435('0x20')]):this[_0x0435('0x21')]);};Action[_0x0435('0x1c')][_0x0435('0x23')]=function(){return this[_0x0435('0x7')];};module[_0x0435('0x24')]=Action; \ No newline at end of file +var _0xae1c=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','queue','exports','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','number','phone','active','type'];(function(_0xe1ff9d,_0x502072){var _0x5f21fb=function(_0x3749a9){while(--_0x3749a9){_0xe1ff9d['push'](_0xe1ff9d['shift']());}};_0x5f21fb(++_0x502072);}(_0xae1c,0xff));var _0xcae1=function(_0x857e56,_0x330617){_0x857e56=_0x857e56-0x0;var _0x281d2e=_0xae1c[_0x857e56];return _0x281d2e;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x5a90b0,_0x1ab262,_0x19e218){var _0x3e2e25='';if(!_[_0xcae1('0x0')](_0x1ab262)&&_0xcae1('0x1')===typeof _0x1ab262){_0x3e2e25+=_0x1ab262;}if(!_[_0xcae1('0x0')](_0x19e218)&&_0xcae1('0x1')===typeof _0x19e218){_0x3e2e25+='\x20'+_0x19e218;}if(_0x3e2e25!==''){return _0x3e2e25;}return _0x5a90b0;}function Action(_0x744199,_0x3513e5,_0x40fcec){this[_0xcae1('0x2')]=_0x744199;this[_0xcae1('0x3')]=_0x40fcec||undefined;this[_0xcae1('0x4')]=checkNameSurname(_0x3513e5['Contact']['phone'],_0x3513e5[_0xcae1('0x5')][_0xcae1('0x6')],_0x3513e5[_0xcae1('0x5')]['lastName']);this[_0xcae1('0x7')]=_0x3513e5[_0xcae1('0x5')][_0xcae1('0x8')];this['queue']=_0x744199[_0xcae1('0x4')];this[_0xcae1('0x9')]=_0x3513e5['active']||![];this['type']=_0x744199[_0xcae1('0xa')];this[_0xcae1('0xb')]=_0x744199[_0xcae1('0xb')]||0x3;this[_0xcae1('0xc')]=_0x3513e5[_0xcae1('0xc')];this[_0xcae1('0xd')]=_0x3513e5[_0xcae1('0xd')];this[_0xcae1('0xe')]=_0x3513e5[_0xcae1('0xe')];this[_0xcae1('0xf')]=_0x3513e5[_0xcae1('0xf')];this[_0xcae1('0x10')]=_0x3513e5[_0xcae1('0x10')];this[_0xcae1('0x11')]=_0x3513e5[_0xcae1('0x11')];this['UserId']=_0x3513e5[_0xcae1('0x12')];this[_0xcae1('0x13')]=_0x3513e5['VoiceQueueId'];this['CampaignId']=_0x3513e5[_0xcae1('0x14')];this[_0xcae1('0x15')]=_0x3513e5['id'];this['ContactFirstName']=_0x3513e5['Contact'][_0xcae1('0x6')]||'';this['starttime']=moment()[_0xcae1('0x16')](_0xcae1('0x17'));this[_0xcae1('0x18')]=_0x3513e5[_0xcae1('0x18')];this[_0xcae1('0x19')]=_0x3513e5[_0xcae1('0x19')];this[_0xcae1('0x1a')]=_0x3513e5[_0xcae1('0x1a')];this[_0xcae1('0x1b')]=_0x3513e5[_0xcae1('0x1b')];this[_0xcae1('0x1c')]='';this[_0xcae1('0x1d')]='';}Action[_0xcae1('0x1e')][_0xcae1('0x1f')]=function(){return util['format'](_0xcae1('0x20'),this[_0xcae1('0x4')],this[_0xcae1('0x2')][_0xcae1('0x21')]>0x0?this['number'][_0xcae1('0x22')](this[_0xcae1('0x2')][_0xcae1('0x21')]):this[_0xcae1('0x7')]);};Action[_0xcae1('0x1e')][_0xcae1('0x23')]=function(){return this[_0xcae1('0x24')];};module[_0xcae1('0x25')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 74c9629..2544774 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1206=['originatecalleridnum','originatecalleridname','util','lodash','moment','diff','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x27a633,_0xdf501d){var _0x40c81e=function(_0x4faeb6){while(--_0x4faeb6){_0x27a633['push'](_0x27a633['shift']());}};_0x40c81e(++_0xdf501d);}(_0x1206,0x13a));var _0x6120=function(_0x2a6ab8,_0x5eb621){_0x2a6ab8=_0x2a6ab8-0x0;var _0x5752ab=_0x1206[_0x2a6ab8];return _0x5752ab;};'use strict';var util=require(_0x6120('0x0'));var _=require(_0x6120('0x1'));var moment=require(_0x6120('0x2'));function getSeconds(_0xb2e54,_0x54e59b){var _0x41df51=moment(_0xb2e54)['milliseconds'](0x0);var _0x1c6429=moment(_0x54e59b)['milliseconds'](0x0);return _0x41df51[_0x6120('0x3')](_0x1c6429,'seconds');}function AgentComplete(_0x5cf798,_0x4a74e9){this[_0x6120('0x4')]=0x4;this[_0x6120('0x5')]='Answer';this['scheduledat']=_0x5cf798[_0x6120('0x6')];this[_0x6120('0x7')]=_0x5cf798[_0x6120('0x7')];this[_0x6120('0x8')]=_0x5cf798[_0x6120('0x7')]==='outbound'?_0x6120('0x9'):_0x5cf798[_0x6120('0x7')];this[_0x6120('0xa')]=_0x5cf798[_0x6120('0xa')];this[_0x6120('0xb')]=_0x5cf798[_0x6120('0xb')];this['countnoanswerretry']=_0x5cf798[_0x6120('0xc')];this[_0x6120('0xd')]=_0x5cf798[_0x6120('0xa')]+_0x5cf798[_0x6120('0xb')]+_0x5cf798[_0x6120('0xc')];this[_0x6120('0xe')]=_0x4a74e9[_0x6120('0xe')];this[_0x6120('0xf')]=_0x5cf798[_0x6120('0x10')];this[_0x6120('0x11')]=_0x5cf798[_0x6120('0x12')];this[_0x6120('0x13')]=_0x5cf798[_0x6120('0x13')];this[_0x6120('0x14')]=_0x5cf798[_0x6120('0x14')];this['answertime']=_0x5cf798[_0x6120('0x15')];this[_0x6120('0x16')]=moment()[_0x6120('0x17')](_0x6120('0x18'));this['ringtime']=getSeconds(_0x5cf798[_0x6120('0x14')],_0x5cf798[_0x6120('0x13')]);this[_0x6120('0x19')]=getSeconds(_0x5cf798[_0x6120('0x15')],_0x5cf798['responsetime']);this[_0x6120('0x1a')]=getSeconds(this[_0x6120('0x16')],_0x5cf798[_0x6120('0x15')]);this[_0x6120('0x9')]=_0x4a74e9[_0x6120('0x9')];this[_0x6120('0x1b')]=_0x4a74e9[_0x6120('0x1b')];this[_0x6120('0x1c')]=_0x4a74e9[_0x6120('0x1c')];this[_0x6120('0x1d')]=_0x5cf798['callback'];this[_0x6120('0x1e')]=_0x5cf798[_0x6120('0x1e')];this['callbackat']=_0x5cf798['callbackat'];this[_0x6120('0x1f')]=_0x5cf798[_0x6120('0x1f')];this[_0x6120('0x20')]=_0x5cf798['ContactId'];this[_0x6120('0x21')]=_0x5cf798['ListId'];this[_0x6120('0x22')]=_0x5cf798[_0x6120('0x22')];this[_0x6120('0x23')]=_0x5cf798[_0x6120('0x23')];this['CampaignId']=_0x5cf798[_0x6120('0x24')];this[_0x6120('0x25')]=_0x5cf798[_0x6120('0x25')]||'';this[_0x6120('0x26')]=_0x5cf798[_0x6120('0x26')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x63b6=['countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x339e07,_0x7a0da8){var _0x10a9c2=function(_0x3cf84f){while(--_0x3cf84f){_0x339e07['push'](_0x339e07['shift']());}};_0x10a9c2(++_0x7a0da8);}(_0x63b6,0x126));var _0x663b=function(_0x11fde2,_0x118c3f){_0x11fde2=_0x11fde2-0x0;var _0x250972=_0x63b6[_0x11fde2];return _0x250972;};'use strict';var util=require(_0x663b('0x0'));var _=require(_0x663b('0x1'));var moment=require('moment');function getSeconds(_0x3842f9,_0x1e2739){var _0x12403f=moment(_0x3842f9)['milliseconds'](0x0);var _0xb28b3c=moment(_0x1e2739)[_0x663b('0x2')](0x0);return _0x12403f[_0x663b('0x3')](_0xb28b3c,_0x663b('0x4'));}function AgentComplete(_0x582dc4,_0x19813e){this[_0x663b('0x5')]=0x4;this[_0x663b('0x6')]=_0x663b('0x7');this[_0x663b('0x8')]=_0x582dc4[_0x663b('0x8')];this[_0x663b('0x9')]=_0x582dc4[_0x663b('0x9')];this[_0x663b('0xa')]=_0x582dc4[_0x663b('0x9')]===_0x663b('0xb')?_0x663b('0xc'):_0x582dc4[_0x663b('0x9')];this[_0x663b('0xd')]=_0x582dc4['countbusyretry'];this[_0x663b('0xe')]=_0x582dc4[_0x663b('0xe')];this['countnoanswerretry']=_0x582dc4[_0x663b('0xf')];this[_0x663b('0x10')]=_0x582dc4[_0x663b('0xd')]+_0x582dc4[_0x663b('0xe')]+_0x582dc4[_0x663b('0xf')];this[_0x663b('0x11')]=_0x19813e[_0x663b('0x11')];this['calleridname']=_0x582dc4[_0x663b('0x12')];this[_0x663b('0x13')]=_0x582dc4[_0x663b('0x14')];this[_0x663b('0x15')]=_0x582dc4[_0x663b('0x15')];this[_0x663b('0x16')]=_0x582dc4[_0x663b('0x16')];this[_0x663b('0x17')]=_0x582dc4[_0x663b('0x17')];this[_0x663b('0x18')]=moment()[_0x663b('0x19')](_0x663b('0x1a'));this[_0x663b('0x1b')]=getSeconds(_0x582dc4[_0x663b('0x16')],_0x582dc4['starttime']);this[_0x663b('0x1c')]=getSeconds(_0x582dc4['answertime'],_0x582dc4[_0x663b('0x16')]);this[_0x663b('0x1d')]=getSeconds(this[_0x663b('0x18')],_0x582dc4[_0x663b('0x17')]);this[_0x663b('0xc')]=_0x19813e[_0x663b('0xc')];this[_0x663b('0x1e')]=_0x19813e[_0x663b('0x1e')];this[_0x663b('0x1f')]=_0x19813e[_0x663b('0x1f')];this[_0x663b('0x20')]=_0x582dc4['callback'];this[_0x663b('0x21')]=_0x582dc4[_0x663b('0x21')];this['callbackat']=_0x582dc4[_0x663b('0x22')];this[_0x663b('0x23')]=_0x582dc4[_0x663b('0x23')];this[_0x663b('0x24')]=_0x582dc4[_0x663b('0x24')];this[_0x663b('0x25')]=_0x582dc4[_0x663b('0x25')];this[_0x663b('0x26')]=_0x582dc4[_0x663b('0x26')];this[_0x663b('0x27')]=_0x582dc4[_0x663b('0x27')];this[_0x663b('0x28')]=_0x582dc4[_0x663b('0x28')];this[_0x663b('0x29')]=_0x582dc4[_0x663b('0x29')]||'';this[_0x663b('0x2a')]=_0x582dc4[_0x663b('0x2a')]||'';}module[_0x663b('0x2b')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 09b40f9..c5b2e12 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc359=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','diff','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc359,0x1d9));var _0x9c35=function(_0x277af0,_0x1f0361){_0x277af0=_0x277af0-0x0;var _0x43bd7c=_0xc359[_0x277af0];return _0x43bd7c;};'use strict';var util=require('util');var _=require(_0x9c35('0x0'));var moment=require('moment');function getSeconds(_0x1d6694,_0x9e8600){var _0xf6c007=moment(_0x1d6694)['milliseconds'](0x0);var _0x3cfffd=moment(_0x9e8600)['milliseconds'](0x0);return _0xf6c007[_0x9c35('0x1')](_0x3cfffd,'seconds');}function Final(_0x424df4){this['uniqueid']=_0x424df4['uniqueid'];this['scheduledat']=_0x424df4['scheduledat'];this[_0x9c35('0x2')]=_0x424df4[_0x9c35('0x2')];this[_0x9c35('0x3')]=_0x424df4[_0x9c35('0x2')]===_0x9c35('0x4')?_0x9c35('0x5'):_0x424df4['type'];this[_0x9c35('0x6')]=_0x424df4[_0x9c35('0x6')];this['countcongestionretry']=_0x424df4['countcongestionretry'];this['countnoanswerretry']=_0x424df4[_0x9c35('0x7')];this['countglobal']=_0x424df4[_0x9c35('0x6')]+_0x424df4[_0x9c35('0x8')]+_0x424df4[_0x9c35('0x7')];this['queue']=_0x424df4[_0x9c35('0x5')];this[_0x9c35('0x9')]=_0x424df4[_0x9c35('0x9')];this[_0x9c35('0xa')]=_0x424df4[_0x9c35('0xa')];this['starttime']=_0x424df4[_0x9c35('0xb')];this[_0x9c35('0xc')]=_0x424df4[_0x9c35('0xc')];this[_0x9c35('0xd')]=_0x424df4[_0x9c35('0xc')];this[_0x9c35('0xe')]=_0x424df4[_0x9c35('0xe')]||0x0;this[_0x9c35('0xf')]=_0x424df4[_0x9c35('0xf')]||0x0;this[_0x9c35('0x10')]=_0x424df4[_0x9c35('0x10')]||0x0;this[_0x9c35('0x11')]=_0x424df4[_0x9c35('0x11')];this[_0x9c35('0x12')]=_0x424df4[_0x9c35('0x12')];this['callbackat']=_0x424df4[_0x9c35('0x13')];this[_0x9c35('0x14')]=_0x424df4[_0x9c35('0x14')];this[_0x9c35('0x15')]=_0x424df4['ContactId'];this[_0x9c35('0x16')]=_0x424df4[_0x9c35('0x16')];this[_0x9c35('0x17')]=_0x424df4[_0x9c35('0x17')];this[_0x9c35('0x18')]=_0x424df4['VoiceQueueId'];this[_0x9c35('0x19')]=_0x424df4['CampaignId'];this[_0x9c35('0x1a')]=_0x424df4[_0x9c35('0x1a')]||'';this[_0x9c35('0x1b')]=_0x424df4[_0x9c35('0x1b')]||'';}module[_0x9c35('0x1c')]=Final; \ No newline at end of file +var _0x5232=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x59bfb3,_0xf90f6a){var _0x5a51f4=function(_0x3ecdf5){while(--_0x3ecdf5){_0x59bfb3['push'](_0x59bfb3['shift']());}};_0x5a51f4(++_0xf90f6a);}(_0x5232,0x1c9));var _0x2523=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x5232[_0x4226d6];return _0x19655b;};'use strict';var util=require(_0x2523('0x0'));var _=require(_0x2523('0x1'));var moment=require(_0x2523('0x2'));function getSeconds(_0x40bf09,_0x23cd16){var _0x4f72a8=moment(_0x40bf09)['milliseconds'](0x0);var _0x3ce9f5=moment(_0x23cd16)[_0x2523('0x3')](0x0);return _0x4f72a8['diff'](_0x3ce9f5,_0x2523('0x4'));}function Final(_0x3cf8c0){this[_0x2523('0x5')]=_0x3cf8c0[_0x2523('0x5')];this[_0x2523('0x6')]=_0x3cf8c0[_0x2523('0x6')];this[_0x2523('0x7')]=_0x3cf8c0[_0x2523('0x7')];this[_0x2523('0x8')]=_0x3cf8c0[_0x2523('0x7')]===_0x2523('0x9')?_0x2523('0xa'):_0x3cf8c0['type'];this[_0x2523('0xb')]=_0x3cf8c0[_0x2523('0xb')];this[_0x2523('0xc')]=_0x3cf8c0[_0x2523('0xc')];this[_0x2523('0xd')]=_0x3cf8c0[_0x2523('0xd')];this['countglobal']=_0x3cf8c0[_0x2523('0xb')]+_0x3cf8c0[_0x2523('0xc')]+_0x3cf8c0[_0x2523('0xd')];this[_0x2523('0xa')]=_0x3cf8c0['queue'];this[_0x2523('0xe')]=_0x3cf8c0[_0x2523('0xe')];this['calleridnum']=_0x3cf8c0[_0x2523('0xf')];this[_0x2523('0x10')]=_0x3cf8c0[_0x2523('0x10')];this[_0x2523('0x11')]=_0x3cf8c0['responsetime'];this[_0x2523('0x12')]=_0x3cf8c0['responsetime'];this[_0x2523('0x13')]=_0x3cf8c0[_0x2523('0x13')]||0x0;this[_0x2523('0x14')]=_0x3cf8c0[_0x2523('0x14')]||0x0;this['talktime']=_0x3cf8c0[_0x2523('0x15')]||0x0;this[_0x2523('0x16')]=_0x3cf8c0[_0x2523('0x16')];this[_0x2523('0x17')]=_0x3cf8c0[_0x2523('0x17')];this[_0x2523('0x18')]=_0x3cf8c0['callbackat'];this[_0x2523('0x19')]=_0x3cf8c0[_0x2523('0x19')];this['ContactId']=_0x3cf8c0[_0x2523('0x1a')];this[_0x2523('0x1b')]=_0x3cf8c0[_0x2523('0x1b')];this[_0x2523('0x1c')]=_0x3cf8c0['UserId'];this['VoiceQueueId']=_0x3cf8c0['VoiceQueueId'];this['CampaignId']=_0x3cf8c0[_0x2523('0x1d')];this[_0x2523('0x1e')]=_0x3cf8c0[_0x2523('0x1e')]||'';this[_0x2523('0x1f')]=_0x3cf8c0[_0x2523('0x1f')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index fed2001..9e7e08a 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['countglobal','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry'];(function(_0x3cf387,_0x31ed26){var _0x24425f=function(_0x500fc6){while(--_0x500fc6){_0x3cf387['push'](_0x3cf387['shift']());}};_0x24425f(++_0x31ed26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function getSeconds(_0x5dd881,_0x550fbc){var _0x18d5c9=moment(_0x5dd881)['milliseconds'](0x0);var _0x333808=moment(_0x550fbc)[_0x0a9e('0x3')](0x0);return _0x18d5c9[_0x0a9e('0x4')](_0x333808,_0x0a9e('0x5'));}function Hangup(_0x981158,_0x57b080){this[_0x0a9e('0x6')]=0x4;this[_0x0a9e('0x7')]=_0x0a9e('0x8');this['scheduledat']=_0x981158['scheduledat'];this[_0x0a9e('0x9')]=_0x981158['type'];this['campaigntype']=_0x981158[_0x0a9e('0x9')]===_0x0a9e('0xa')?_0x0a9e('0xb'):_0x981158[_0x0a9e('0x9')];this[_0x0a9e('0xc')]=_0x981158[_0x0a9e('0xc')];this['countcongestionretry']=_0x981158['countcongestionretry'];this['countnoanswerretry']=_0x981158['countnoanswerretry'];this[_0x0a9e('0xd')]=_0x981158[_0x0a9e('0xc')]+_0x981158[_0x0a9e('0xe')]+_0x981158[_0x0a9e('0xf')];this[_0x0a9e('0x10')]=_0x57b080[_0x0a9e('0x10')];this['calleridname']=_0x981158[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x981158[_0x0a9e('0x13')];this[_0x0a9e('0x14')]=_0x981158[_0x0a9e('0x14')];this[_0x0a9e('0x15')]=_0x981158['responsetime'];this[_0x0a9e('0x16')]=moment()['format'](_0x0a9e('0x17'));this['ringtime']=getSeconds(_0x981158[_0x0a9e('0x15')],_0x981158[_0x0a9e('0x14')]);this['holdtime']=0x0;this[_0x0a9e('0x18')]=getSeconds(this['endtime'],_0x981158[_0x0a9e('0x15')]);this[_0x0a9e('0xb')]=_0x981158[_0x0a9e('0xb')];this[_0x0a9e('0x19')]=_0x0a9e('0x1a');this[_0x0a9e('0x1b')]=_0x57b080[_0x0a9e('0x1c')];this[_0x0a9e('0x1d')]=_0x981158[_0x0a9e('0x1d')];this[_0x0a9e('0x1e')]=_0x981158[_0x0a9e('0x1e')];this[_0x0a9e('0x1f')]=_0x981158['callbackat'];this[_0x0a9e('0x20')]=_0x981158[_0x0a9e('0x20')];this['ContactId']=_0x981158[_0x0a9e('0x21')];this['ListId']=_0x981158['ListId'];this[_0x0a9e('0x22')]=_0x981158[_0x0a9e('0x22')];this[_0x0a9e('0x23')]=_0x981158[_0x0a9e('0x23')];this['CampaignId']=_0x981158[_0x0a9e('0x24')];}module[_0x0a9e('0x25')]=Hangup; \ No newline at end of file +var _0x9957=['state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','seconds'];(function(_0x3ced47,_0x28f492){var _0x3ad748=function(_0x5ba887){while(--_0x5ba887){_0x3ced47['push'](_0x3ced47['shift']());}};_0x3ad748(++_0x28f492);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));function getSeconds(_0x10a05d,_0x5b96eb){var _0x86c128=moment(_0x10a05d)[_0x7995('0x3')](0x0);var _0x1902b4=moment(_0x5b96eb)[_0x7995('0x3')](0x0);return _0x86c128['diff'](_0x1902b4,_0x7995('0x4'));}function Hangup(_0x1a36d8,_0x137b6b){this[_0x7995('0x5')]=0x4;this[_0x7995('0x6')]=_0x7995('0x7');this['scheduledat']=_0x1a36d8[_0x7995('0x8')];this[_0x7995('0x9')]=_0x1a36d8['type'];this[_0x7995('0xa')]=_0x1a36d8[_0x7995('0x9')]===_0x7995('0xb')?_0x7995('0xc'):_0x1a36d8[_0x7995('0x9')];this[_0x7995('0xd')]=_0x1a36d8[_0x7995('0xd')];this['countcongestionretry']=_0x1a36d8[_0x7995('0xe')];this[_0x7995('0xf')]=_0x1a36d8['countnoanswerretry'];this[_0x7995('0x10')]=_0x1a36d8[_0x7995('0xd')]+_0x1a36d8[_0x7995('0xe')]+_0x1a36d8[_0x7995('0xf')];this[_0x7995('0x11')]=_0x137b6b[_0x7995('0x11')];this[_0x7995('0x12')]=_0x1a36d8['name'];this['calleridnum']=_0x1a36d8[_0x7995('0x13')];this[_0x7995('0x14')]=_0x1a36d8[_0x7995('0x14')];this[_0x7995('0x15')]=_0x1a36d8[_0x7995('0x15')];this[_0x7995('0x16')]=moment()[_0x7995('0x17')](_0x7995('0x18'));this['ringtime']=getSeconds(_0x1a36d8[_0x7995('0x15')],_0x1a36d8['starttime']);this[_0x7995('0x19')]=0x0;this[_0x7995('0x1a')]=getSeconds(this[_0x7995('0x16')],_0x1a36d8[_0x7995('0x15')]);this[_0x7995('0xc')]=_0x1a36d8[_0x7995('0xc')];this['membername']='IVR';this[_0x7995('0x1b')]=_0x137b6b['cause-txt'];this['callback']=_0x1a36d8[_0x7995('0x1c')];this[_0x7995('0x1d')]=_0x1a36d8['callbackuniqueid'];this[_0x7995('0x1e')]=_0x1a36d8['callbackat'];this['recallme']=_0x1a36d8[_0x7995('0x1f')];this[_0x7995('0x20')]=_0x1a36d8[_0x7995('0x20')];this[_0x7995('0x21')]=_0x1a36d8[_0x7995('0x21')];this[_0x7995('0x22')]=_0x1a36d8['UserId'];this[_0x7995('0x23')]=_0x1a36d8[_0x7995('0x23')];this[_0x7995('0x24')]=_0x1a36d8[_0x7995('0x24')];}module[_0x7995('0x25')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index bd06b57..4552fdf 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2201=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback'];(function(_0x3a2855,_0x3495e1){var _0x1fc9cc=function(_0x3265f3){while(--_0x3265f3){_0x3a2855['push'](_0x3a2855['shift']());}};_0x1fc9cc(++_0x3495e1);}(_0x2201,0x73));var _0x1220=function(_0x51494d,_0x49f3d2){_0x51494d=_0x51494d-0x0;var _0x25a739=_0x2201[_0x51494d];return _0x25a739;};'use strict';var util=require(_0x1220('0x0'));var _=require(_0x1220('0x1'));var moment=require(_0x1220('0x2'));function getSeconds(_0x3367ad,_0x42d455){var _0x2ca077=moment(_0x3367ad)[_0x1220('0x3')](0x0);var _0x51fc29=moment(_0x42d455)['milliseconds'](0x0);return _0x2ca077[_0x1220('0x4')](_0x51fc29,'seconds');}function History(_0x7b4079){this[_0x1220('0x5')]=_0x7b4079[_0x1220('0x5')];this[_0x1220('0x6')]=_0x7b4079[_0x1220('0x6')]||undefined;this[_0x1220('0x7')]=_0x7b4079[_0x1220('0x7')];this[_0x1220('0x8')]=_0x7b4079[_0x1220('0x7')]===_0x1220('0x9')?_0x1220('0xa'):_0x7b4079[_0x1220('0x7')];this['countbusyretry']=_0x7b4079[_0x1220('0xb')];this[_0x1220('0xc')]=_0x7b4079[_0x1220('0xc')];this[_0x1220('0xd')]=_0x7b4079['countnoanswerretry'];this[_0x1220('0xe')]=_0x7b4079[_0x1220('0xb')]+_0x7b4079[_0x1220('0xc')]+_0x7b4079[_0x1220('0xd')];this['queue']=_0x7b4079[_0x1220('0xa')];this[_0x1220('0xf')]=_0x7b4079[_0x1220('0x10')];this['calleridnum']=_0x7b4079[_0x1220('0x11')];this['starttime']=_0x7b4079[_0x1220('0x12')];this[_0x1220('0x13')]=_0x7b4079['responsetime'];this[_0x1220('0x14')]=_0x7b4079[_0x1220('0x13')];this[_0x1220('0x15')]=getSeconds(_0x7b4079['responsetime'],_0x7b4079[_0x1220('0x12')]);this[_0x1220('0x16')]=0x0;this[_0x1220('0x17')]=0x0;this[_0x1220('0x18')]=_0x7b4079['callback'];this[_0x1220('0x19')]=_0x7b4079[_0x1220('0x19')];this[_0x1220('0x1a')]=_0x7b4079['callbackat'];this[_0x1220('0x1b')]=_0x7b4079[_0x1220('0x1b')];this[_0x1220('0x1c')]=_0x7b4079[_0x1220('0x1c')];this[_0x1220('0x1d')]=_0x7b4079[_0x1220('0x1d')];this[_0x1220('0x1e')]=_0x7b4079['UserId'];this[_0x1220('0x1f')]=_0x7b4079[_0x1220('0x1f')];this['CampaignId']=_0x7b4079['CampaignId'];this['originatecalleridnum']=_0x7b4079[_0x1220('0x20')]||'';this[_0x1220('0x21')]=_0x7b4079[_0x1220('0x21')]||'';}module[_0x1220('0x22')]=History; \ No newline at end of file +var _0x4da8=['countcongestionretry','countnoanswerretry','countglobal','calleridname','calleridnum','number','starttime','responsetime','ringtime','holdtime','talktime','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x4be871,_0x57ddf3){var _0x3cc1d4=function(_0x251bbb){while(--_0x251bbb){_0x4be871['push'](_0x4be871['shift']());}};_0x3cc1d4(++_0x57ddf3);}(_0x4da8,0xdc));var _0x84da=function(_0x13ee6e,_0x52de49){_0x13ee6e=_0x13ee6e-0x0;var _0x14cb57=_0x4da8[_0x13ee6e];return _0x14cb57;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x84da('0x0'));function getSeconds(_0x53d828,_0x1e24ed){var _0x34be10=moment(_0x53d828)[_0x84da('0x1')](0x0);var _0x2273a9=moment(_0x1e24ed)['milliseconds'](0x0);return _0x34be10[_0x84da('0x2')](_0x2273a9,_0x84da('0x3'));}function History(_0x45de0e){this[_0x84da('0x4')]=_0x45de0e[_0x84da('0x4')];this[_0x84da('0x5')]=_0x45de0e['scheduledat']||undefined;this['type']=_0x45de0e[_0x84da('0x6')];this[_0x84da('0x7')]=_0x45de0e[_0x84da('0x6')]===_0x84da('0x8')?_0x84da('0x9'):_0x45de0e[_0x84da('0x6')];this[_0x84da('0xa')]=_0x45de0e[_0x84da('0xa')];this[_0x84da('0xb')]=_0x45de0e[_0x84da('0xb')];this[_0x84da('0xc')]=_0x45de0e[_0x84da('0xc')];this[_0x84da('0xd')]=_0x45de0e['countbusyretry']+_0x45de0e[_0x84da('0xb')]+_0x45de0e[_0x84da('0xc')];this['queue']=_0x45de0e[_0x84da('0x9')];this[_0x84da('0xe')]=_0x45de0e['name'];this[_0x84da('0xf')]=_0x45de0e[_0x84da('0x10')];this[_0x84da('0x11')]=_0x45de0e[_0x84da('0x11')];this[_0x84da('0x12')]=_0x45de0e[_0x84da('0x12')];this['endtime']=_0x45de0e[_0x84da('0x12')];this[_0x84da('0x13')]=getSeconds(_0x45de0e[_0x84da('0x12')],_0x45de0e['starttime']);this[_0x84da('0x14')]=0x0;this[_0x84da('0x15')]=0x0;this['callback']=_0x45de0e['callback'];this[_0x84da('0x16')]=_0x45de0e['callbackuniqueid'];this[_0x84da('0x17')]=_0x45de0e[_0x84da('0x17')];this[_0x84da('0x18')]=_0x45de0e[_0x84da('0x18')];this[_0x84da('0x19')]=_0x45de0e[_0x84da('0x19')];this[_0x84da('0x1a')]=_0x45de0e[_0x84da('0x1a')];this[_0x84da('0x1b')]=_0x45de0e[_0x84da('0x1b')];this['VoiceQueueId']=_0x45de0e[_0x84da('0x1c')];this[_0x84da('0x1d')]=_0x45de0e[_0x84da('0x1d')];this[_0x84da('0x1e')]=_0x45de0e[_0x84da('0x1e')]||'';this[_0x84da('0x1f')]=_0x45de0e[_0x84da('0x1f')]||'';}module[_0x84da('0x20')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 535f079..4a70036 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 _0xb2d0=['uniqueId','optionPredictive','startPredictive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','Intervals','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','stringify','milliseconds','seconds','emit','outbound','available','pTalking','sumHoldTime','talking','total','type','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','md5','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','isUndefined','predictiveIntervalAvgTalktime','info','[checkGetDataPredictive][avgTalktime]','predictiveIntervalAvgHoldtime','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][objIsEmpty]','merge','startProgressive','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','waiting','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','prototype','sequence','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','then','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','pick','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','SIP/%s','uniqueid','isNil','variable','amdstatus','exten','dialAMDActive','HANGUP','statedesc','HangupInAMD','AMD','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','membername','amd','[syncMachine]','[syncHangupInAMDIvr]','value','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','cause-txt','syncAgentComplete','reason','agiafterat','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','TIMEOUT','dialQueueProject2','queueCallerAbandonCreateState','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','strategy','actionid','locked','paused','stateinterface','rrmemory','push','idHopper','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','ContactId','ListId','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTimeIntervals','ifTime','Failure','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','indexOf','content','some','GLOBAL_INTERVAL_IS_OVERTIME','Global:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIfTime','dialGlobalInterval','dialTimezone','pow','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','NONE','ACTIVE','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','getQueue','response','callProgressDetecting','checkRetriveMax','countbusyretry','countcongestionretry','countnoanswerretry','dialGlobalMaxRetry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','minutes','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','stateGlobal','createStateFinal','reason\x200\x20no\x20such\x20number....','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','floor','erlangAbandonmentRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','[startMethodPredictive][StartProgressive][Loop]','erlangCalls','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]','Agent\x20free','agent\x20max\x20free\x20','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','[startMethodPredictive][StartPredictive][First]','dialPredictiveInterval','getDataPredictive','[averageHandleTime][ErlangB]\x20','[startMethodPredictive][StartPredictive][Repeat]','startMethodPredictive','outboundQueuePauses','abandonmentRate','[CatchErlangB]','busyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[handlePredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','Blacklist','[Originate][historyBlacklist]','inBlackList','temp','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[getContactCampaign2]','dialLimitQueue','not_inuse','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20interval\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','[busyFactor]','\x20m\x20=\x20','\x20Umin\x20=\x20','Amax\x20=\x20','exports','util','uuid','moment','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','localhost','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb2d0,0x1bc));var _0x0b2d=function(_0x2bff81,_0x174530){_0x2bff81=_0x2bff81-0x0;var _0x5545ff=_0xb2d0[_0x2bff81];return _0x5545ff;};'use strict';var util=require(_0x0b2d('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x0b2d('0x1'));var moment=require(_0x0b2d('0x2'));var rr=require('rr');var md5=require('md5');var logger=require(_0x0b2d('0x3'))('dialer');var loggerBooked=require('../../../config/logger')(_0x0b2d('0x4'));var loggerPredictive=require(_0x0b2d('0x3'))(_0x0b2d('0x5'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0b2d('0x6'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x0b2d('0x7'));var config=require('../../../config/environment/');var ami=require('../ami');var io=require('socket.io-emitter')({'host':_0x0b2d('0x8'),'port':0x18eb});var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x0b2d('0x9'));var cmHopperHistory=require(_0x0b2d('0xa'));var cmHopperBlack=require(_0x0b2d('0xb'));var voiceQueueRt=require(_0x0b2d('0xc'));var Action=require(_0x0b2d('0xd'));var History=require(_0x0b2d('0xe'));var Final=require(_0x0b2d('0xf'));var AgentComplete=require(_0x0b2d('0x10'));var QueueCallerAbandon=require(_0x0b2d('0x11'));var Hangup=require('./hangup');var ipAgi=process['env']['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':'rrmemory','roundrobin':_0x0b2d('0x12')};var Sequence=function(){};Sequence['prototype'][_0x0b2d('0x13')]=function(_0x3a98e1){this[_0x0b2d('0x14')]=this[_0x0b2d('0x14')]?this[_0x0b2d('0x14')][_0x0b2d('0x15')](_0x3a98e1):_0x3a98e1();};function Dialer(_0x29eb13,_0x1cc787){this['sequence']=new Sequence();this[_0x0b2d('0x16')]=_0x1cc787;this[_0x0b2d('0x17')]=_0x29eb13[_0x0b2d('0x17')];this[_0x0b2d('0x18')]=_0x29eb13[_0x0b2d('0x18')];this[_0x0b2d('0x19')]=_0x29eb13['agents'];this[_0x0b2d('0x1a')]=_0x29eb13['trunks'];this['maxNumberOriginate']=config[_0x0b2d('0x1b')]||0x2;this[_0x0b2d('0x1c')]={};this['actions']={};this[_0x0b2d('0x1d')]={};this[_0x0b2d('0x1e')]={};this[_0x0b2d('0x1f')]={};this[_0x0b2d('0x20')]={};this['startProgressive']={};this[_0x0b2d('0x21')]={};this[_0x0b2d('0x22')]={};this[_0x0b2d('0x23')]={};ami['on'](_0x0b2d('0x24'),this[_0x0b2d('0x25')][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x27'),this[_0x0b2d('0x28')]['bind'](this));ami['on'](_0x0b2d('0x29'),this['syncOriginateResponse'][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x2a'),this['syncAgentComplete'][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x2b'),this[_0x0b2d('0x7')]['bind'](this));ami['on']('hangup',this[_0x0b2d('0x2c')][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x2d'),this[_0x0b2d('0x2e')][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x2f'),this[_0x0b2d('0x30')][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x31'),this[_0x0b2d('0x32')][_0x0b2d('0x26')](this));ami['on'](_0x0b2d('0x33'),this[_0x0b2d('0x34')]['bind'](this));this[_0x0b2d('0x35')]();this[_0x0b2d('0x36')]();}function isNotNull(_0x21c780){return _0x21c780!==null&&!_['isUndefined'](_0x21c780);}function checkIsLoggedIn(_0x72374f,_0x404427){return function(){if(_0x404427<=0x0){_0x72374f[_0x0b2d('0x37')]='AGENTS_NOT_LOGGED';throw _0x72374f[_0x0b2d('0x38')]+_0x0b2d('0x39');}};}function isActive(_0x20e1cd){return _0x20e1cd;}function checkIsActive(_0x1216da,_0x3e297e){return function(){if(!isActive(_0x3e297e)){_0x1216da[_0x0b2d('0x37')]=_0x0b2d('0x3a');throw _0x1216da[_0x0b2d('0x38')]+_0x0b2d('0x3b');}};}function checkInterval(_0x543afe){return function(){if(!isNotNull(_0x543afe['Interval'])){_0x543afe[_0x0b2d('0x37')]='INTERVAL_IS_NULL';throw _0x543afe[_0x0b2d('0x38')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x543afe[_0x0b2d('0x3c')][_0x0b2d('0x3d')])){_0x543afe['message']=_0x0b2d('0x3e');throw _0x543afe[_0x0b2d('0x38')]+_0x0b2d('0x3f');}if(!isNotNull(_[_0x0b2d('0x40')](_0x543afe[_0x0b2d('0x3c')]['Intervals']))){_0x543afe['message']=_0x0b2d('0x3e');throw _0x543afe[_0x0b2d('0x38')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x561cdd,_0x251326,_0xab2367){return{'action':_0x561cdd,'response':_0x251326,'message':_0xab2367};}function myreject(_0x2a9d8c){return function(_0x39721d){return _0x2a9d8c(msgResponse('[ifTime][Action]','Error',JSON[_0x0b2d('0x41')](_0x39721d)));};}function getSeconds(_0xb946a7,_0x2488df){var _0x266536=moment(_0xb946a7)[_0x0b2d('0x42')](0x0);var _0x637975=moment(_0x2488df)[_0x0b2d('0x42')](0x0);return _0x266536['diff'](_0x637975,_0x0b2d('0x43'));}function emit(_0x1ec74b,_0x261124,_0x129b6c){io['to'](_0x1ec74b)[_0x0b2d('0x44')](_0x261124,_0x129b6c);}function emitVoiceQueueSummary(_0x269478){if(_0x269478['type']===_0x0b2d('0x45')){var _0xd73717={'id':_0x269478['id'],'name':_0x269478['name'],'strategy':_0x269478['strategy'],'answered':_0x269478['answered'],'available':_0x269478[_0x0b2d('0x46')],'loggedIn':_0x269478['loggedIn'],'pTalking':_0x269478[_0x0b2d('0x47')],'sumBillable':_0x269478['sumBillable'],'sumDuration':_0x269478['sumDuration'],'sumHoldTime':_0x269478[_0x0b2d('0x48')]||0x0,'talking':_0x269478[_0x0b2d('0x49')],'total':_0x269478[_0x0b2d('0x4a')],'type':_0x269478[_0x0b2d('0x4b')],'unmanaged':_0x269478[_0x0b2d('0x4c')],'waiting':_0x269478['waiting'],'loggedInDb':_0x269478[_0x0b2d('0x4d')],'dialActive':_0x269478[_0x0b2d('0x4e')],'dialMethod':_0x269478[_0x0b2d('0x4f')],'dialOriginateCallerIdName':_0x269478['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x269478[_0x0b2d('0x50')],'dialOriginateTimeout':_0x269478[_0x0b2d('0x51')],'dialPrefix':_0x269478[_0x0b2d('0x52')],'outboundAnswerAgiCallsDay':_0x269478[_0x0b2d('0x53')],'outboundAnswerCallsDay':_0x269478[_0x0b2d('0x54')],'outboundBlacklistCallsDay':_0x269478[_0x0b2d('0x55')],'outboundBusyCallsDay':_0x269478['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x269478[_0x0b2d('0x56')],'outboundDropCallsDayACS':_0x269478[_0x0b2d('0x57')],'outboundDropCallsDayCallersExit':_0x269478['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x269478['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x269478[_0x0b2d('0x58')],'outboundNoSuchCallsDay':_0x269478[_0x0b2d('0x59')],'outboundOriginateFailureCallsDay':_0x269478['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x269478[_0x0b2d('0x5a')],'outboundRejectCallsDay':_0x269478[_0x0b2d('0x5b')],'outboundUnknownCallsDay':_0x269478[_0x0b2d('0x5c')],'predictiveIntervalAnsweredCalls':_0x269478[_0x0b2d('0x5d')],'predictiveIntervalAvgHoldtime':_0x269478['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x269478['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x269478[_0x0b2d('0x5e')],'predictiveIntervalDroppedCallsTimeout':_0x269478[_0x0b2d('0x5f')],'predictiveIntervalErlangCalls':_0x269478[_0x0b2d('0x60')],'predictiveIntervalErlangCallsDroppedCalls':_0x269478['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x269478[_0x0b2d('0x61')],'predictiveIntervalLowerLimit':_0x269478[_0x0b2d('0x62')],'predictiveIntervalMultiplicativeFactor':_0x269478['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x269478[_0x0b2d('0x63')],'predictiveIntervalTotalCalls':_0x269478[_0x0b2d('0x64')],'message':_0x269478['message'],'originated':_0x269478[_0x0b2d('0x65')]};if(_0x269478[_0x0b2d('0x66')]){_0xd73717['Trunk']={'id':_0x269478['Trunk']['id'],'name':_0x269478[_0x0b2d('0x66')][_0x0b2d('0x38')],'active':_0x269478['Trunk'][_0x0b2d('0x67')],'callerid':_0x269478[_0x0b2d('0x66')][_0x0b2d('0x68')]};}if(_0x269478[_0x0b2d('0x3c')]){_0xd73717[_0x0b2d('0x3c')]={'id':_0x269478[_0x0b2d('0x3c')]['id'],'name':_0x269478[_0x0b2d('0x3c')][_0x0b2d('0x38')]};}var _0x4f4d93=md5(JSON[_0x0b2d('0x41')](_0xd73717));if(_0x269478[_0x0b2d('0x69')]!==_0x4f4d93){_0x269478[_0x0b2d('0x69')]=_0x4f4d93;emit(util[_0x0b2d('0x6a')](_0x0b2d('0x6b'),_0xd73717[_0x0b2d('0x38')]),'voice_queue:save',_0xd73717);}}}function emitCampaignSummary(_0x20636a){if(_0x20636a[_0x0b2d('0x4b')]===_0x0b2d('0x6c')){emit(util[_0x0b2d('0x6a')](_0x0b2d('0x6d'),_0x20636a[_0x0b2d('0x38')]),_0x0b2d('0x6e'),_0x20636a);}}function checkGetDataPredictive(_0x4d109f){if(isNotNull(_0x4d109f)){if(!_[_0x0b2d('0x40')](_0x4d109f)){if(_0x4d109f['predictiveIntervalTotalCalls']>0x0){if(!_[_0x0b2d('0x6f')](_0x4d109f[_0x0b2d('0x70')])&&_0x4d109f[_0x0b2d('0x70')]>0x0){return!![];}else{loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x72'),JSON[_0x0b2d('0x41')](_0x4d109f));}if(!_['isUndefined'](_0x4d109f[_0x0b2d('0x73')])&&_0x4d109f['predictiveIntervalAvgHoldtime']>0x0){return!![];}else{loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x74'),JSON['stringify'](_0x4d109f));}}else{loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x75'),JSON[_0x0b2d('0x41')](_0x4d109f));}}else{loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x76'),JSON['stringify'](_0x4d109f));}}else{loggerPredictive[_0x0b2d('0x71')]('[checkGetDataPredictive][obj]',JSON[_0x0b2d('0x41')](_0x4d109f));}return![];}function mergeDataErlangB(_0x1c894c){return function(_0x51d0f4){loggerPredictive[_0x0b2d('0x71')]('[ErlangB]',JSON['stringify'](_0x51d0f4));_[_0x0b2d('0x77')](_0x1c894c,_0x51d0f4);};}function getDiff(_0x5ae120){var _0x2d9b21=moment()[_0x0b2d('0x42')](0x0);var _0x5efc6d=moment(_0x5ae120)[_0x0b2d('0x42')](0x0);return _0x2d9b21['diff'](_0x5efc6d,_0x0b2d('0x43'));}function ifInterval(_0x35fe3b,_0xfa1916){if(_[_0x0b2d('0x6f')](_0xfa1916)){return![];}if(getDiff(_0xfa1916)<_0x35fe3b*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x312d89){if(isNotNull(_0x312d89)){if(!_[_0x0b2d('0x6f')](_0x312d89[_0x0b2d('0x78')])){_0x312d89[_0x0b2d('0x78')]=undefined;loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x79'),_0x0b2d('0x78'),_0x312d89[_0x0b2d('0x38')]);}if(!_['isUndefined'](_0x312d89['startPredictive'])){_0x312d89['startPredictive']=undefined;loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x79'),_0x0b2d('0x20'),_0x312d89['name']);}if(!_[_0x0b2d('0x6f')](_0x312d89[_0x0b2d('0x7a')])){clearInterval(_0x312d89[_0x0b2d('0x7a')]);_0x312d89[_0x0b2d('0x7a')]=undefined;loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x79'),'handlePredictive',_0x312d89['name']);}}}function erlangb(_0x54e505,_0x16483b){if(_0x16483b===0x0){return 0x0;}var _0x22c734=0x1;for(var _0x1082d2=0x1;_0x1082d2<=_0x16483b;_0x1082d2+=0x1){_0x22c734=0x1+_0x22c734*_0x1082d2/_0x54e505;}return 0x1/_0x22c734;}function isVoiceQueueOutbound(_0x3854a9){return _0x3854a9===_0x0b2d('0x45');}function isNotPreview(_0x4ac459){return _0x4ac459!==_0x0b2d('0x16');}function isCampaignIvr(_0xc1fe8){return _0xc1fe8===_0x0b2d('0x6c');}function getCallerId(_0x228241,_0x2e95dd,_0x506824){if(!_['isUndefined'](_0x506824)&&_0x0b2d('0x7b')===typeof _0x506824&&!_['isEmpty'](_0x506824)){if(!_['isUndefined'](_0x2e95dd)&&_0x0b2d('0x7b')===typeof _0x2e95dd&&!_[_0x0b2d('0x40')](_0x2e95dd)){return util['format'](_0x0b2d('0x7c'),_0x2e95dd,_0x506824);}return util[_0x0b2d('0x6a')]('\x22%s\x22\x20<%s>',_0x506824,_0x506824);}if(!_[_0x0b2d('0x6f')](_0x228241)&&'string'===typeof _0x228241&&!_[_0x0b2d('0x40')](_0x228241)){return _0x228241;}return _0x0b2d('0x7d');}function loggerCatchQueueSummary(_0x251ad7,_0x4da389){return function(_0xb18895){freeVariablesPredictive(_0x4da389);emitVoiceQueueSummary(_0x4da389);emitCampaignSummary(_0x4da389);loggerSyncQueueSummary[_0x0b2d('0x7e')](_0x251ad7,util[_0x0b2d('0x7f')](_0xb18895,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x57f92d,_0x42c93e){return function(_0x582c3a){loggerPredictive[_0x0b2d('0x7e')](_0x57f92d,JSON[_0x0b2d('0x41')](_0x582c3a));freeVariablesPredictive(_0x42c93e);};}function loggerCatch(_0x355eb0){return function(_0x291213){logger[_0x0b2d('0x7e')](_0x355eb0,util[_0x0b2d('0x7f')](_0x291213,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x113777){return _0x113777&&!_[_0x0b2d('0x6f')](_0x113777)&&_0x113777['length']>0x0;}function decremetOriginate(_0x31b366){if(!_[_0x0b2d('0x6f')](_0x31b366)&&_0x31b366!==null){if(_0x31b366[_0x0b2d('0x80')](_0x0b2d('0x65'))){if(_0x31b366['originated']>0x0){_0x31b366[_0x0b2d('0x65')]-=0x1;}else{logger[_0x0b2d('0x7e')](_0x0b2d('0x81'));}}}else{logger[_0x0b2d('0x7e')](_0x0b2d('0x82'));}}function checkContactLowerLimitOriginate(_0x11a1af,_0x2b4658,_0x1ea9fb){if(_0x2b4658>_0x1ea9fb){for(var _0x2d6495=0x0;_0x2d6495<_0x2b4658-_0x1ea9fb;_0x2d6495+=0x1){decremetOriginate(_0x11a1af);}}}function loggerGetContactDialer(_0x3c3e52,_0x433b7f,_0x52584a){return function(_0x3fccf7){checkContactLowerLimitOriginate(_0x433b7f,_0x52584a,0x0);logger['error'](_0x3c3e52,util['inspect'](_0x3fccf7,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0xd5f508){return function(_0x1c8778){if(isNotNull(_0x1c8778)&&isNotNull(_0x1c8778[0x0])){if(_0x1c8778[0x0][_0x0b2d('0x83')]>0x0){_0xd5f508[_0x0b2d('0x37')]=_0x0b2d('0x84');logger['info'](_0x0b2d('0x85')+_0xd5f508[_0x0b2d('0x38')],_0x1c8778[0x0][_0x0b2d('0x83')],_0x0b2d('0x86'));}else{_0xd5f508[_0x0b2d('0x37')]=_0x0b2d('0x87');logger[_0x0b2d('0x71')]('[getContactDialer2][Empty]'+_0xd5f508[_0x0b2d('0x38')]);}}};}function notSendMessagesQueue(_0x20b984){if(_0x20b984['sendMessageOneNotActive']){freeVariablesPredictive(_0x20b984);if(_0x20b984[_0x0b2d('0x65')]===0x0&&_0x20b984[_0x0b2d('0x49')]===0x0&&_0x20b984[_0x0b2d('0x88')]===0x0&&(_0x20b984[_0x0b2d('0x47')]||0x0)===0x0){_0x20b984[_0x0b2d('0x89')]=![];_0x20b984[_0x0b2d('0x46')]=0x0;_0x20b984['message']=_0x0b2d('0x3a');loggerSyncQueueSummary['error'](_0x0b2d('0x8a'),_0x20b984[_0x0b2d('0x38')],_0x0b2d('0x8b'));}else{_0x20b984[_0x0b2d('0x37')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0b2d('0x7e')](_0x0b2d('0x8a'),_0x20b984[_0x0b2d('0x38')],_0x0b2d('0x8c'));}emitVoiceQueueSummary(_0x20b984);}}function notSendMessagesCampaign(_0x2631dd){if(_0x2631dd['sendMessageOneNotActive']){if(_0x2631dd[_0x0b2d('0x65')]===0x0){_0x2631dd[_0x0b2d('0x89')]=![];_0x2631dd[_0x0b2d('0x37')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0b2d('0x7e')](_0x0b2d('0x8d'),_0x2631dd[_0x0b2d('0x38')],'is\x20not\x20active');}else{_0x2631dd['message']=_0x0b2d('0x8e');loggerSyncQueueSummary[_0x0b2d('0x7e')](_0x0b2d('0x8d'),_0x2631dd[_0x0b2d('0x38')],_0x0b2d('0x8c'));}emitCampaignSummary(_0x2631dd);}}function createObjHistory(_0x1986c8,_0x3830b5,_0x43c5fb,_0x1815f7,_0x28b959){_0x1986c8[_0x0b2d('0x37')]=_0x43c5fb;var _0x49ed59=new Action(_0x1986c8,_0x3830b5);var _0x133b54=new History(_0x49ed59);_0x133b54[_0x0b2d('0x8f')]=_0x1815f7;_0x133b54['statedesc']=_0x28b959;_0x133b54[_0x0b2d('0x90')]=_0x49ed59[_0x0b2d('0x91')];return _0x133b54;}Dialer['prototype'][_0x0b2d('0x36')]=function(){var _0x544797=this;setInterval(function(){_0x544797[_0x0b2d('0x92')](_0x544797[_0x0b2d('0x1e')],_0x0b2d('0x93'));_0x544797[_0x0b2d('0x92')](_0x544797[_0x0b2d('0x94')],_0x0b2d('0x95'));},0x32c8);};Dialer[_0x0b2d('0x96')][_0x0b2d('0x92')]=function(_0x59e9bf,_0x2777eb){var _0x3237c5=this;for(var _0x12f2e9 in _0x59e9bf){if(_0x59e9bf['hasOwnProperty'](_0x12f2e9)){this[_0x0b2d('0x97')]['enqueue'](function(){if(!_['isNil'](_0x59e9bf[_0x12f2e9])){return ami[_0x0b2d('0x98')]({'action':_0x0b2d('0x99'),'channel':_0x59e9bf[_0x12f2e9][_0x0b2d('0x9a')]})[_0x0b2d('0x9b')](function(_0x31523b){if(_0x31523b[_0x0b2d('0x37')]===_0x0b2d('0x9c')){setTimeout(function(){if(_0x59e9bf[_0x12f2e9]&&_0x59e9bf[_0x12f2e9]['type']!=='ivr'){_0x3237c5[_0x0b2d('0x9d')](_0x3237c5[_0x0b2d('0x17')][_0x59e9bf[_0x12f2e9][_0x0b2d('0x9e')]]);logger[_0x0b2d('0x7e')](_0x0b2d('0x9f'),_0x2777eb,_0x12f2e9,_0x59e9bf[_0x12f2e9][_0x0b2d('0x9e')]);delete _0x59e9bf[_0x12f2e9];}if(_0x59e9bf[_0x12f2e9]&&_0x59e9bf[_0x12f2e9]['type']===_0x0b2d('0x6c')){_0x3237c5[_0x0b2d('0x9d')](_0x3237c5['campaigns'][_0x59e9bf[_0x12f2e9][_0x0b2d('0x9e')]]);logger[_0x0b2d('0x7e')](_0x0b2d('0xa0'),_0x2777eb,_0x12f2e9,_0x59e9bf[_0x12f2e9]['queue']);delete _0x59e9bf[_0x12f2e9];}},0x2328);}});}});}}};Dialer[_0x0b2d('0x96')][_0x0b2d('0xa1')]=function(_0x1a42ab){return BPromise[_0x0b2d('0xa2')]()['then'](cmHopper[_0x0b2d('0xa1')](_0x1a42ab))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xa3')));};Dialer[_0x0b2d('0x96')][_0x0b2d('0xa4')]=function(_0x4bcaa2){return BPromise[_0x0b2d('0xa2')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4bcaa2))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xa5')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x275223){return BPromise[_0x0b2d('0xa2')]()['then'](cmHopperBlack[_0x0b2d('0xa6')](_0x275223))['catch'](loggerCatch(_0x0b2d('0xa7')));};Dialer[_0x0b2d('0x96')][_0x0b2d('0xa8')]=function(_0x4d5b6e){return BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](cmHopperHistory[_0x0b2d('0xaa')](_0x4d5b6e))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xab')));};Dialer['prototype'][_0x0b2d('0xac')]=function(_0x24dbfc){return BPromise[_0x0b2d('0xa2')]()['then'](cmHopper[_0x0b2d('0xac')](_0x24dbfc))[_0x0b2d('0x9b')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x0b2d('0x96')][_0x0b2d('0xad')]=function(_0x2c25c5,_0x12a97c,_0x7a7865,_0x9689e6){return BPromise['resolve']()[_0x0b2d('0xa9')](cmHopper[_0x0b2d('0xad')](_0x2c25c5,_0x12a97c,_0x7a7865,_0x9689e6))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xae')));};Dialer[_0x0b2d('0x96')][_0x0b2d('0xaf')]=function(_0xa604f2,_0x36814b,_0x3edbbb){return BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](cmHopper[_0x0b2d('0xaf')](_0xa604f2,_0x36814b,_0x3edbbb))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xae')));};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0x366ece){return BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](voiceQueueRt[_0x0b2d('0xb0')](_0x366ece))['catch'](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer['prototype'][_0x0b2d('0xb1')]=function(_0x15ded2){return BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](cmHopper['moveContactManagedDialer'](_0x15ded2))['catch'](loggerCatch(_0x0b2d('0xb2')));};Dialer[_0x0b2d('0x96')]['createHistory']=function(_0x3708df){return BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](cmHopperHistory[_0x0b2d('0xb3')](_0x3708df))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xb4')));};Dialer['prototype'][_0x0b2d('0x9d')]=function(_0x22990c){if(!_[_0x0b2d('0x6f')](_0x22990c)&&_0x22990c!==null){if(_0x22990c[_0x0b2d('0x80')](_0x0b2d('0x65'))){if(_0x22990c[_0x0b2d('0x65')]>0x0){_0x22990c[_0x0b2d('0x65')]-=0x1;}else{logger[_0x0b2d('0x7e')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0b2d('0x7e')](_0x0b2d('0xb5'));}};Dialer[_0x0b2d('0x96')][_0x0b2d('0xb6')]=function(_0xd4c2d3,_0x20f5ca){var _0x2f062d=this;return function(_0x2928d2){_0x2f062d[_0x0b2d('0x9d')](_0x20f5ca);logger['error'](_0xd4c2d3,util[_0x0b2d('0x7f')](_0x2928d2,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x0b2d('0xb7')]=function(_0x355d8a,_0x2c989b,_0x105213){var _0x432036={'state':0x19,'statedesc':_0x0b2d('0xb8')};this[_0x0b2d('0x9d')](_0x2c989b);this['saveInDb'](_[_0x0b2d('0x77')](_0x432036,_[_0x0b2d('0xb9')](_0x105213,['ContactId','ListId',_0x0b2d('0xba'),_0x0b2d('0xbb'),_0x0b2d('0xbc')])),_0x0b2d('0xbd'),'[emptyContact]');logger[_0x0b2d('0x7e')](_0x355d8a);};Dialer[_0x0b2d('0x96')][_0x0b2d('0xbe')]=function(_0x2e38e3){return _0x2e38e3===_0x0b2d('0xbf');};Dialer['prototype']['isTrunkReachable']=function(_0x2a759e){return!_[_0x0b2d('0x6f')](_0x2a759e)&&_0x2a759e&&!_['isUndefined'](_0x2a759e['name'])&&!_['isUndefined'](_0x2a759e['active'])&&_0x2a759e['active']&&(this['trunks'][util[_0x0b2d('0x6a')](_0x0b2d('0xc0'),_0x2a759e[_0x0b2d('0x38')])]['status']==='reachable'||this[_0x0b2d('0x1a')][util[_0x0b2d('0x6a')](_0x0b2d('0xc0'),_0x2a759e[_0x0b2d('0x38')])][_0x0b2d('0x99')]==='unmonitored');};Dialer[_0x0b2d('0x96')]['saveInDb']=function(_0x271050,_0x4899aa,_0x58f32d){this[_0x0b2d('0xb3')](_0x271050)[_0x0b2d('0x9b')](loggerCatch(_0x4899aa));this[_0x0b2d('0xb1')](_0x271050)[_0x0b2d('0x9b')](loggerCatch(_0x58f32d));};Dialer[_0x0b2d('0x96')][_0x0b2d('0x30')]=function(_0x473062){var _0x42feab=this['uniqueId'][_0x473062[_0x0b2d('0xc1')]];var _0x577ee5;if(!_['isNil'](_0x473062)&&!_[_0x0b2d('0xc2')](_0x473062[_0x0b2d('0xc3')])&&!_[_0x0b2d('0xc2')](_0x473062[_0x0b2d('0xc3')][_0x0b2d('0xc4')])&&_0x473062[_0x0b2d('0xc5')]==='xcally-motion-dialer'&&_0x42feab){if(_0x42feab['type']!==_0x0b2d('0x6c')&&this[_0x0b2d('0x17')][_0x42feab['queue']][_0x0b2d('0xc6')]&&_0x473062['value']===_0x0b2d('0xc7')){delete this[_0x0b2d('0x1e')][_0x473062[_0x0b2d('0xc1')]];this[_0x0b2d('0x9d')](this[_0x0b2d('0x17')][_0x42feab[_0x0b2d('0x9e')]]);this[_0x0b2d('0x17')][_0x42feab[_0x0b2d('0x9e')]]['outboundAnswerCallsDay']+=0x1;this[_0x0b2d('0x17')][_0x42feab[_0x0b2d('0x9e')]][_0x0b2d('0x53')]+=0x1;_0x577ee5=new Hangup(_0x42feab,_0x473062);_0x577ee5['state']=0x12;_0x577ee5[_0x0b2d('0xc8')]=_0x0b2d('0xc9');_0x577ee5['membername']=_0x0b2d('0xca');this[_0x0b2d('0xcb')](_0x577ee5,_0x0b2d('0xcc'),_0x0b2d('0xcd'));}if(_0x42feab[_0x0b2d('0x4b')]!==_0x0b2d('0x6c')&&this[_0x0b2d('0x17')][_0x42feab['queue']][_0x0b2d('0xc6')]&&_0x473062['value']===_0x0b2d('0xce')){delete this[_0x0b2d('0x1e')][_0x473062[_0x0b2d('0xc1')]];this[_0x0b2d('0x9d')](this['voiceQueues'][_0x42feab[_0x0b2d('0x9e')]]);this[_0x0b2d('0x17')][_0x42feab[_0x0b2d('0x9e')]][_0x0b2d('0x54')]+=0x1;this[_0x0b2d('0x17')][_0x42feab[_0x0b2d('0x9e')]][_0x0b2d('0x53')]+=0x1;_0x577ee5=new Hangup(_0x42feab,_0x473062);_0x577ee5['state']=0x13;_0x577ee5[_0x0b2d('0xc8')]=_0x0b2d('0xcf');_0x577ee5[_0x0b2d('0xd0')]=_0x0b2d('0xca');_0x577ee5[_0x0b2d('0xd1')]=!![];this[_0x0b2d('0xcb')](_0x577ee5,'[syncMachine][createHistory]',_0x0b2d('0xd2'));}if(_0x42feab[_0x0b2d('0x4b')]===_0x0b2d('0x6c')&&this[_0x0b2d('0x18')][_0x42feab[_0x0b2d('0x9e')]][_0x0b2d('0xc6')]&&_0x473062['value']===_0x0b2d('0xc7')){delete this[_0x0b2d('0x1e')][_0x473062['uniqueid']];this['updateOriginated'](this['campaigns'][_0x42feab[_0x0b2d('0x9e')]]);_0x577ee5=new Hangup(_0x42feab,_0x473062);_0x577ee5[_0x0b2d('0x8f')]=0x12;_0x577ee5[_0x0b2d('0xc8')]=_0x0b2d('0xc9');_0x577ee5[_0x0b2d('0xd0')]='AMD';this[_0x0b2d('0xcb')](_0x577ee5,'[syncHangupInAMDIvr][createHistory]',_0x0b2d('0xd3'));}if(_0x42feab[_0x0b2d('0x4b')]==='ivr'&&this['campaigns'][_0x42feab[_0x0b2d('0x9e')]][_0x0b2d('0xc6')]&&_0x473062[_0x0b2d('0xd4')]===_0x0b2d('0xce')){delete this['uniqueId'][_0x473062[_0x0b2d('0xc1')]];this[_0x0b2d('0x9d')](this['campaigns'][_0x42feab[_0x0b2d('0x9e')]]);_0x577ee5=new Hangup(_0x42feab,_0x473062);_0x577ee5[_0x0b2d('0x8f')]=0x13;_0x577ee5[_0x0b2d('0xc8')]=_0x0b2d('0xcf');_0x577ee5['membername']='AMD';_0x577ee5[_0x0b2d('0xd1')]=!![];this[_0x0b2d('0xcb')](_0x577ee5,_0x0b2d('0xd5'),_0x0b2d('0xd6'));}}};Dialer['prototype'][_0x0b2d('0x2c')]=function(_0x5e85c0){var _0x34154f=this[_0x0b2d('0x1e')][_0x5e85c0[_0x0b2d('0xc1')]];var _0x4fd85e=this;var _0x260c3e;if(_0x34154f&&_0x34154f[_0x0b2d('0x4b')]===_0x0b2d('0x6c')){delete this[_0x0b2d('0x1e')][_0x5e85c0[_0x0b2d('0xc1')]];this[_0x0b2d('0x9d')](this[_0x0b2d('0x18')][_0x34154f[_0x0b2d('0x9e')]]);this['campaigns'][_0x34154f[_0x0b2d('0x9e')]][_0x0b2d('0xd7')]+=0x1;_0x260c3e=new Hangup(_0x34154f,_0x5e85c0);this[_0x0b2d('0xb3')](_0x260c3e)['catch'](loggerCatch(_0x0b2d('0xd8')));this[_0x0b2d('0xb1')](_0x260c3e)[_0x0b2d('0x9b')](loggerCatch('[syncHangupIvr]'));}if(_0x34154f&&_0x34154f[_0x0b2d('0x4b')]!==_0x0b2d('0x6c')&&isNotNull(this[_0x0b2d('0x17')][_0x34154f['queue']][_0x0b2d('0xd9')])){delete this[_0x0b2d('0x1e')][_0x5e85c0['uniqueid']];this[_0x0b2d('0x9d')](this[_0x0b2d('0x17')][_0x34154f[_0x0b2d('0x9e')]]);this[_0x0b2d('0x17')][_0x34154f['queue']][_0x0b2d('0x54')]+=0x1;this['voiceQueues'][_0x34154f['queue']][_0x0b2d('0x53')]+=0x1;_0x260c3e=new Hangup(_0x34154f,_0x5e85c0);_0x260c3e[_0x0b2d('0x8f')]=0x10;_0x260c3e['statedesc']=_0x0b2d('0xda');_0x260c3e[_0x0b2d('0xd0')]=_0x0b2d('0xdb');this[_0x0b2d('0xb3')](_0x260c3e)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xd8')));this[_0x0b2d('0xb1')](_0x260c3e)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xdc')));}if(_0x34154f&&_0x34154f[_0x0b2d('0x4b')]!==_0x0b2d('0x6c')&&!isNotNull(this[_0x0b2d('0x17')][_0x34154f[_0x0b2d('0x9e')]][_0x0b2d('0xd9')])){delete this[_0x0b2d('0x1e')][_0x5e85c0['uniqueid']];this[_0x0b2d('0x9d')](this[_0x0b2d('0x17')][_0x34154f[_0x0b2d('0x9e')]]);this[_0x0b2d('0x17')][_0x34154f[_0x0b2d('0x9e')]]['outboundUnknownCallsDay']+=0x1;_0x260c3e=new Hangup(_0x34154f,_0x5e85c0);_0x260c3e[_0x0b2d('0x8f')]=0xc;_0x260c3e[_0x0b2d('0xc8')]=_0x5e85c0[_0x0b2d('0xdd')];_0x260c3e['membername']='Unknow';this[_0x0b2d('0xb3')](_0x260c3e)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xd8')));this[_0x0b2d('0xb1')](_0x260c3e)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xdc')));}};Dialer['prototype'][_0x0b2d('0xde')]=function(_0x253eaf){var _0x1a8c9f=this[_0x0b2d('0x1e')][_0x253eaf[_0x0b2d('0xc1')]];var _0x7c2fc9=this;if(this[_0x0b2d('0x17')][_0x253eaf[_0x0b2d('0x9e')]]){if(_0x1a8c9f&&_0x1a8c9f[_0x0b2d('0x4b')]!==_0x0b2d('0x6c')){delete this[_0x0b2d('0x1e')][_0x253eaf['uniqueid']];this[_0x0b2d('0x17')][_0x253eaf[_0x0b2d('0x9e')]][_0x0b2d('0x54')]+=0x1;var _0x528120=new AgentComplete(_0x1a8c9f,_0x253eaf);if(_0x253eaf[_0x0b2d('0xdf')]==='agent'){_0x528120[_0x0b2d('0xe0')]=this[_0x0b2d('0x17')][_0x253eaf['queue']]['dialQueueProject2']&&this[_0x0b2d('0x17')][_0x253eaf[_0x0b2d('0x9e')]]['dialAgiAfterHangupAgent']?moment()[_0x0b2d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0b2d('0xb3')](_0x528120)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xe1')));this[_0x0b2d('0xb1')](_0x528120)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xe2')));}}};Dialer['prototype'][_0x0b2d('0x25')]=function(_0x2fd714){if(this[_0x0b2d('0x17')][_0x2fd714['queue']]){if(this[_0x0b2d('0x1e')][_0x2fd714['uniqueid']]&&this[_0x0b2d('0x1e')][_0x2fd714[_0x0b2d('0xc1')]]['type']!==_0x0b2d('0x6c')){this[_0x0b2d('0x9d')](this[_0x0b2d('0x17')][_0x2fd714[_0x0b2d('0x9e')]]);this['uniqueId'][_0x2fd714['uniqueid']]['answertime']=moment()[_0x0b2d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x32d339){this[_0x0b2d('0xb3')](_0x32d339)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xe1')));this[_0x0b2d('0xb1')](_0x32d339)[_0x0b2d('0x9b')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x0b2d('0x96')][_0x0b2d('0x28')]=function(_0x98a7c0){var _0x5444c4=this[_0x0b2d('0x1e')][_0x98a7c0['uniqueid']];var _0x317d1a=this;if(this[_0x0b2d('0x17')][_0x98a7c0[_0x0b2d('0x9e')]]){if(_0x5444c4&&_0x5444c4[_0x0b2d('0x4b')]!==_0x0b2d('0x6c')){delete this[_0x0b2d('0x1e')][_0x98a7c0[_0x0b2d('0xc1')]];this[_0x0b2d('0x9d')](this['voiceQueues'][_0x98a7c0['queue']]);_0x5444c4[_0x0b2d('0xe3')]=moment()['format'](_0x0b2d('0xe4'));var _0x85e381=new QueueCallerAbandon(_0x5444c4,_0x98a7c0);if(getSeconds(_0x5444c4[_0x0b2d('0xe3')],_0x5444c4[_0x0b2d('0xe5')])>=_0x5444c4[_0x0b2d('0xe6')]){this['voiceQueues'][_0x98a7c0[_0x0b2d('0x9e')]][_0x0b2d('0x5f')]+=0x1;this[_0x0b2d('0x17')][_0x98a7c0['queue']][_0x0b2d('0xe7')]+=0x1;this[_0x0b2d('0x17')][_0x98a7c0[_0x0b2d('0x9e')]][_0x0b2d('0xe8')]+=0x1;_0x85e381[_0x0b2d('0x8f')]=0xa;_0x85e381[_0x0b2d('0xc8')]='Drop';_0x85e381['dropreason']=_0x0b2d('0xe9');_0x85e381[_0x0b2d('0xe0')]=this[_0x0b2d('0x17')][_0x98a7c0[_0x0b2d('0x9e')]][_0x0b2d('0xea')]?moment()[_0x0b2d('0x6a')](_0x0b2d('0xe4')):undefined;this[_0x0b2d('0xeb')](_0x85e381);}else{this[_0x0b2d('0x17')][_0x98a7c0[_0x0b2d('0x9e')]][_0x0b2d('0x5e')]+=0x1;this['voiceQueues'][_0x98a7c0[_0x0b2d('0x9e')]][_0x0b2d('0xec')]+=0x1;_0x85e381['state']=0xb;_0x85e381[_0x0b2d('0xc8')]=_0x0b2d('0xed');_0x85e381['dropreason']=_0x0b2d('0xee');this['queueCallerAbandonCreateState'](_0x85e381);}}}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x2e')]=function(_0x10d633){if(this[_0x0b2d('0x94')][_0x10d633['uniqueid']]){this[_0x0b2d('0x94')][_0x10d633['uniqueid']][_0x0b2d('0x9a')]=_0x10d633[_0x0b2d('0x9a')];}if(this['uniqueId'][_0x10d633[_0x0b2d('0xc1')]]){this[_0x0b2d('0x1e')][_0x10d633[_0x0b2d('0xc1')]][_0x0b2d('0x9a')]=_0x10d633[_0x0b2d('0x9a')];}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x32')]=function(_0xdc6fbd){if(strategy[this[_0x0b2d('0x17')][this['actions'][_0xdc6fbd['actionid']]['queue']][_0x0b2d('0xef')]]===_0x0b2d('0x12')){if(this[_0x0b2d('0x94')][_0xdc6fbd['actionid']]&&_[_0x0b2d('0xc2')](this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]][_0x0b2d('0xf1')])&&_0xdc6fbd[_0x0b2d('0x99')]==='1'&&_0xdc6fbd[_0x0b2d('0xf2')]==='0'){if(this[_0x0b2d('0x19')][_0xdc6fbd[_0x0b2d('0xf3')]]){if(!this[_0x0b2d('0x19')][_0xdc6fbd[_0x0b2d('0xf3')]]['locked']){this['agents'][_0xdc6fbd['stateinterface']][_0x0b2d('0xf1')]=!![];this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]][_0x0b2d('0xf1')]=!![];this[_0x0b2d('0x94')][_0xdc6fbd['actionid']][_0x0b2d('0xf3')]=_0xdc6fbd[_0x0b2d('0xf3')];}}}}else if((strategy[this[_0x0b2d('0x17')][this[_0x0b2d('0x94')][_0xdc6fbd['actionid']][_0x0b2d('0x9e')]][_0x0b2d('0xef')]]||_0x0b2d('0xf4'))===_0x0b2d('0xf4')){if(this[_0x0b2d('0x94')][_0xdc6fbd['actionid']]){if(this['agents'][_0xdc6fbd[_0x0b2d('0xf3')]]){this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]]['stateinterface']=_0xdc6fbd['stateinterface'];if(_[_0x0b2d('0xc2')](this[_0x0b2d('0x22')][this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]]['queue']])){this[_0x0b2d('0x22')][this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]]=[];}this['queueBooked'][this[_0x0b2d('0x94')][_0xdc6fbd['actionid']]['queue']][_0x0b2d('0xf5')](_[_0x0b2d('0x77')](_[_0x0b2d('0xb9')](this[_0x0b2d('0x94')][_0xdc6fbd[_0x0b2d('0xf0')]],[_0x0b2d('0xf6'),_0x0b2d('0xf3')]),{'status':_0xdc6fbd['status'],'paused':_0xdc6fbd[_0x0b2d('0xf2')]}));}}}};function unlockQueueStatus(_0x63504a,_0x26f021){setTimeout(function(){if(_[_0x0b2d('0x6f')](_0x63504a[_0x0b2d('0xf7')])){loggerBooked[_0x0b2d('0x7e')]('[unlockQueueStatus][undefined]',_0x26f021);}_0x63504a['queueStatusComplete']=!![];loggerBooked[_0x0b2d('0x71')](_0x0b2d('0xf8'),_0x26f021,JSON[_0x0b2d('0x41')](_[_0x0b2d('0xb9')](_0x63504a,[_0x0b2d('0x38'),_0x0b2d('0xf7')])));},0x1f3);}Dialer[_0x0b2d('0x96')][_0x0b2d('0x34')]=function(_0x4d69cd){var _0x3c17ee=this;var _0x2a3c9b=_0x3c17ee[_0x0b2d('0x17')][_0x3c17ee['actions'][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]];if(strategy[this[_0x0b2d('0x17')][this['actions'][_0x4d69cd['actionid']][_0x0b2d('0x9e')]][_0x0b2d('0xef')]]===_0x0b2d('0x12')){if(this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]]&&this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]]['stateinterface']){this['preview'][_0x0b2d('0xf9')](this['actions'][_0x4d69cd[_0x0b2d('0xf0')]]['idHopper'],this['actions'][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0xf3')])['catch'](function(_0x39cc3f){logger[_0x0b2d('0x7e')](_0x0b2d('0xfa'),util['inspect'](_0x39cc3f,{'showHidden':![],'depth':null}));})[_0x0b2d('0x15')](function(){_0x3c17ee[_0x0b2d('0x9d')](_0x3c17ee[_0x0b2d('0x17')][_0x3c17ee[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]]);_0x3c17ee[_0x0b2d('0x19')][_0x3c17ee[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0xf3')]][_0x0b2d('0xf1')]=![];delete _0x3c17ee['actions'][_0x4d69cd[_0x0b2d('0xf0')]];unlockQueueStatus(_0x2a3c9b);});}else{this[_0x0b2d('0x9d')](this[_0x0b2d('0x17')][this['actions'][_0x4d69cd[_0x0b2d('0xf0')]]['queue']]);this[_0x0b2d('0xac')]({'active':![],'ContactId':this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0xfb')],'ListId':this['actions'][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0xfc')],'VoiceQueueId':this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0xbb')]||undefined,'CampaignId':this['actions'][_0x4d69cd['actionid']]['CampaignId']||undefined})[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xfd')));delete this[_0x0b2d('0x94')][_0x4d69cd['actionid']];unlockQueueStatus(_0x2a3c9b);}}else if((strategy[this['voiceQueues'][this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]][_0x0b2d('0xef')]]||_0x0b2d('0xf4'))===_0x0b2d('0xf4')){var _0x38cc4e;if(this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]]&&!_['isEmpty'](this[_0x0b2d('0x22')][this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]])){if(this[_0x0b2d('0x23')][_0x3c17ee[_0x0b2d('0x94')][_0x4d69cd['actionid']][_0x0b2d('0x9e')]]){this[_0x0b2d('0x23')][_0x3c17ee['actions'][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]]=this['queueBookedRR'][this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]]['queue']]?this[_0x0b2d('0x23')][this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]]:this[_0x0b2d('0x22')][this['actions'][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]]?this[_0x0b2d('0x22')][this['actions'][_0x4d69cd['actionid']][_0x0b2d('0x9e')]][_0x0b2d('0xfe')]||0x0:0x0;}this[_0x0b2d('0x22')][this[_0x0b2d('0x94')][_0x4d69cd['actionid']][_0x0b2d('0x9e')]][_0x0b2d('0xfe')]=this[_0x0b2d('0x23')][this[_0x0b2d('0x94')][_0x4d69cd[_0x0b2d('0xf0')]][_0x0b2d('0x9e')]];for(var _0x199556=0x0;_0x199556=0x0?!![]:![];})[_0x0b2d('0x9b')](myreject(_0x92565f)));}}else{_0x52dbd0[_0x0b2d('0xf5')](ami[_0x0b2d('0x98')]({'action':'command','command':util['format'](_0x0b2d('0x115'),_0x47a573,!_[_0x0b2d('0x6f')](config['timezones'][_0x2a7136])?_0x2a7136:'')})[_0x0b2d('0xa9')](function(_0x33aff7){return _0x33aff7[_0x0b2d('0x118')]['indexOf']('true')>=0x0?!![]:![];})['catch'](myreject(_0x92565f)));}BPromise['all'](_0x52dbd0)[_0x0b2d('0xa9')](function(_0x563661){var _0x198e5c=_[_0x0b2d('0x119')](_0x563661);if(_0x198e5c){return _0x28d6ef(_0x198e5c);}else{_0x10633e[_0x0b2d('0x37')]=_0x56d16f?_0x0b2d('0x11a'):'INTERVAL_IS_OVERTIME';return _0x92565f(msgResponse('[ifTime][promiseAll]',_0x0b2d('0x10e'),_0x0b2d('0x11b')+_0x56d16f+'\x20'+_0x284105+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0b2d('0x7f')](_0x47a573,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2a7136));}})['catch'](function(_0x3d22dd){return _0x92565f(msgResponse(_0x0b2d('0x10d'),_0x0b2d('0x10e'),JSON[_0x0b2d('0x41')](_0x3d22dd)));});});};Dialer[_0x0b2d('0x96')][_0x0b2d('0x11c')]=function(_0x47c4b8){var _0x2852b4=this;return function(){switch(_0x47c4b8[_0x0b2d('0x4f')]){case _0x0b2d('0x11d'):freeVariablesPredictive(_0x47c4b8);_0x2852b4[_0x0b2d('0x11e')](_0x47c4b8,0x1);break;case _0x0b2d('0x11f'):freeVariablesPredictive(_0x47c4b8);_0x2852b4[_0x0b2d('0x11e')](_0x47c4b8,_0x47c4b8[_0x0b2d('0x120')]);break;case'predictive':_0x2852b4[_0x0b2d('0x5')](_0x47c4b8);break;case _0x0b2d('0x4'):freeVariablesPredictive(_0x47c4b8);_0x2852b4[_0x0b2d('0x11e')](_0x47c4b8,0x1);break;default:freeVariablesPredictive(_0x47c4b8);logger[_0x0b2d('0x7e')](_0x0b2d('0x121'),_0x47c4b8[_0x0b2d('0x38')],_0x0b2d('0x122'));}};};Dialer['prototype'][_0x0b2d('0x123')]=function(_0x693f0f){var _0x4502ef=this;return function(){_0x4502ef[_0x0b2d('0x124')](_0x693f0f);};};Dialer[_0x0b2d('0x96')][_0x0b2d('0x7')]=function(_0x4695d8){var _0x7178d2=this;if(isNotPreview(_0x4695d8[_0x0b2d('0x4f')])){if(isVoiceQueueOutbound(_0x4695d8['type'])&&isActive(_0x4695d8['dialActive'])){_0x4695d8[_0x0b2d('0x89')]=!![];BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](checkIsLoggedIn(_0x4695d8,_0x4695d8[_0x0b2d('0x125')]))[_0x0b2d('0xa9')](checkIsActive(_0x4695d8,_0x4695d8[_0x0b2d('0x4e')]))[_0x0b2d('0xa9')](checkInterval(_0x4695d8))[_0x0b2d('0xa9')](_0x7178d2['checkIsTrunkReachable'](_0x4695d8))[_0x0b2d('0xa9')](_0x7178d2[_0x0b2d('0x126')](_0x4695d8[_0x0b2d('0x127')],_0x4695d8[_0x0b2d('0x128')],_0x4695d8[_0x0b2d('0x38')],_0x4695d8))[_0x0b2d('0xa9')](_0x7178d2[_0x0b2d('0x10c')](_0x4695d8['Interval'],_0x4695d8['dialTimezone'],_0x4695d8[_0x0b2d('0x38')],_0x4695d8))[_0x0b2d('0xa9')](_0x7178d2['checkDialMethod'](_0x4695d8))[_0x0b2d('0x9b')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4695d8));}else{notSendMessagesQueue(_0x4695d8);}}else{freeVariablesPredictive(_0x4695d8);}};Dialer['prototype']['syncCampaigns']=function(){var _0x288f89=this;var _0x3edfe8;for(var _0x33b4cd in this[_0x0b2d('0x18')]){if(this[_0x0b2d('0x18')]['hasOwnProperty'](_0x33b4cd)){_0x3edfe8=this[_0x0b2d('0x18')][_0x33b4cd];if(isCampaignIvr(_0x3edfe8[_0x0b2d('0x4b')])&&isActive(_0x3edfe8['active'])){_0x3edfe8[_0x0b2d('0x89')]=!![];BPromise[_0x0b2d('0xa2')]()[_0x0b2d('0xa9')](checkIsActive(_0x3edfe8,_0x3edfe8[_0x0b2d('0x67')]))[_0x0b2d('0xa9')](checkInterval(_0x3edfe8))[_0x0b2d('0xa9')](_0x288f89['checkIsTrunkReachable'](_0x3edfe8))[_0x0b2d('0xa9')](_0x288f89['checkIfTime'](_0x3edfe8[_0x0b2d('0x127')],_0x3edfe8[_0x0b2d('0x128')],_0x3edfe8[_0x0b2d('0x38')],_0x3edfe8))['then'](_0x288f89[_0x0b2d('0x10c')](_0x3edfe8['Interval'],_0x3edfe8[_0x0b2d('0x128')],_0x3edfe8[_0x0b2d('0x38')],_0x3edfe8))[_0x0b2d('0xa9')](_0x288f89[_0x0b2d('0x123')](_0x3edfe8))[_0x0b2d('0x9b')](loggerCatchQueueSummary('[syncCampaigns]',_0x3edfe8));}else{notSendMessagesCampaign(_0x3edfe8);}}}};function getCallerIdRandom(_0x58057d,_0x8d4cb0){var _0x1c3c81,_0x2b0b5f,_0x418a22;if(_0x8d4cb0<=0x0){_0x8d4cb0=0x1;}_0x1c3c81=new RegExp('\x5cw{0,'+_0x8d4cb0+'}$');_0x2b0b5f=Math[_0x0b2d('0x129')](0xa,_0x8d4cb0-0x1);_0x418a22=Math['pow'](0xa,_0x8d4cb0)-0x1;return util[_0x0b2d('0x6a')]('%s',_[_0x0b2d('0x12a')](_0x58057d,_0x1c3c81,_['random'](_0x2b0b5f,_0x418a22)));}function extractCalleridName(_0x253f62){var _0x215ac0=_0x253f62[_0x0b2d('0x12b')](/"(.*?)"/);return _0x215ac0?_0x215ac0[0x1]:_0x253f62;}function extractCalleridNumber(_0x2c696c){var _0x7c4d6b=_0x2c696c['match'](/<(.*?)>/);return _0x7c4d6b?_0x7c4d6b[0x1]:_0x2c696c;}Dialer[_0x0b2d('0x96')][_0x0b2d('0x12c')]=function(_0x54316d,_0x186bbf){var _0x558c35=this;var _0x35bc5c=uuid['v4']();this[_0x0b2d('0x94')][_0x35bc5c]=new Action(_0x54316d,_0x186bbf,_0x35bc5c);return new BPromise(function(_0x6995c2,_0x29355d){if(_[_0x0b2d('0x6f')](_0x54316d)&&_0x0b2d('0x12d')!==typeof _0x54316d){return _0x29355d(msgResponse(_0x0b2d('0x12e'),_0x0b2d('0x10e'),_0x0b2d('0x12f')));}if(_[_0x0b2d('0x6f')](_0x186bbf[_0x0b2d('0x130')][_0x0b2d('0x131')])||_0x186bbf[_0x0b2d('0x130')][_0x0b2d('0x131')]===null){return _0x29355d(msgResponse(_0x0b2d('0x12e'),'Failure',_0x0b2d('0x132')));}var _0x13cce1={'XMD-CALLERID':_0x558c35['actions'][_0x35bc5c][_0x0b2d('0x133')](),'XMD-AGI':_0x54316d[_0x0b2d('0xd9')]?util['format'](_0x0b2d('0x134'),ipAgi,_0x54316d['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x54316d['dialQueueProject2']?util[_0x0b2d('0x6a')](_0x0b2d('0x134'),ipAgi,_0x54316d[_0x0b2d('0xea')]):'NONE','XMD-QUEUE':_0x54316d[_0x0b2d('0x4b')]===_0x0b2d('0x45')?util[_0x0b2d('0x6a')](_0x0b2d('0x135'),_0x54316d['name'],_0x54316d[_0x0b2d('0x136')]||'',_0x54316d['dialAgiAfterHangupAgent']?'c':'',_0x54316d['dialQueueTimeout']||0x3):_0x0b2d('0x137'),'XMD-CONTACTID':_0x186bbf['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x558c35['actions'][_0x35bc5c][_0x0b2d('0x133')](),'XMD-AMD':_0x54316d[_0x0b2d('0xc6')]?_0x0b2d('0x138'):_0x0b2d('0x137'),'XMD-DESTINATION':_0x0b2d('0x139')};if(_0x54316d[_0x0b2d('0xc6')]){_0x13cce1[_0x0b2d('0x13a')]=_0x54316d[_0x0b2d('0x13b')]||0x9c4;_0x13cce1['XMD-AMDGREETING']=_0x54316d[_0x0b2d('0x13c')]||0x5dc;_0x13cce1[_0x0b2d('0x13d')]=_0x54316d['dialAMDAfterGreetingSilence']||0x320;_0x13cce1['XMD-AMDTOTALANALYSISTIME']=_0x54316d[_0x0b2d('0x13e')]||0x1388;_0x13cce1['XMD-AMDMINWORDLENGTH']=_0x54316d[_0x0b2d('0x13f')]||0x64;_0x13cce1[_0x0b2d('0x140')]=_0x54316d[_0x0b2d('0x141')]||0x32;_0x13cce1[_0x0b2d('0x142')]=_0x54316d['dialAMDMaximumNumberOfWords']||0x3;_0x13cce1[_0x0b2d('0x143')]=_0x54316d[_0x0b2d('0x144')]||0x100;_0x13cce1[_0x0b2d('0x145')]=_0x54316d[_0x0b2d('0x146')]||0x1388;}if(_0x54316d[_0x0b2d('0x4b')]===_0x0b2d('0x45')){_0x13cce1[_0x0b2d('0x147')]=_0x186bbf[_0x0b2d('0xbb')];}else{_0x13cce1[_0x0b2d('0x148')]=_0x186bbf['CampaignId'];}for(var _0x5f4006 in _0x186bbf[_0x0b2d('0x130')]){if(_0x186bbf[_0x0b2d('0x130')][_0x0b2d('0x80')](_0x5f4006)){if(isNotNull(_0x186bbf['Contact'][_0x5f4006])&&_0x5f4006!=='id'&&_0x5f4006!==_0x0b2d('0x149')&&_0x5f4006!==_0x0b2d('0x14a')&&_0x5f4006!=='updatedAt'){_0x13cce1[util[_0x0b2d('0x6a')](_0x0b2d('0x14b'),_0x0b2d('0x14c'),_['toUpper'](_0x5f4006))]=_0x186bbf[_0x0b2d('0x130')][_0x5f4006];}}}var _0x56c3f0=_0x558c35[_0x0b2d('0x109')](_0x54316d[_0x0b2d('0x66')])?getCallerId(_0x54316d[_0x0b2d('0x66')]['callerid'],_0x54316d[_0x0b2d('0x14d')],_0x54316d[_0x0b2d('0x14e')]>0x0?getCallerIdRandom(_0x54316d[_0x0b2d('0x50')],_0x54316d['dialRandomLastDigitCallerIdNumber']):_0x54316d[_0x0b2d('0x50')]):getCallerId(_[_0x0b2d('0xc2')](_0x54316d['TrunkBackup'])?_0x54316d[_0x0b2d('0x66')][_0x0b2d('0x68')]:_0x54316d['TrunkBackup'][_0x0b2d('0x68')],_0x54316d['dialOriginateCallerIdName'],_0x54316d[_0x0b2d('0x14e')]>0x0?getCallerIdRandom(_0x54316d[_0x0b2d('0x50')],_0x54316d[_0x0b2d('0x14e')]):_0x54316d['dialOriginateCallerIdNumber']);if(_0x56c3f0){_0x13cce1[_0x0b2d('0x14f')]=_0x558c35[_0x0b2d('0x94')][_0x35bc5c][_0x0b2d('0x150')]=extractCalleridName(_0x56c3f0);_0x13cce1[_0x0b2d('0x151')]=_0x558c35[_0x0b2d('0x94')][_0x35bc5c][_0x0b2d('0x152')]=extractCalleridNumber(_0x56c3f0);}return ami[_0x0b2d('0x98')]({'actionid':_0x35bc5c,'action':_0x0b2d('0x12e'),'channel':_0x558c35[_0x0b2d('0x109')](_0x54316d['Trunk'])?util[_0x0b2d('0x6a')](_0x0b2d('0x153'),_0x54316d[_0x0b2d('0x66')][_0x0b2d('0x38')],isNotNull(_0x54316d[_0x0b2d('0x52')])?_0x54316d['dialPrefix'][_0x0b2d('0x154')]()||'':'',_0x54316d[_0x0b2d('0x155')]>0x0?_0x186bbf['Contact'][_0x0b2d('0x131')][_0x0b2d('0x156')](_0x54316d[_0x0b2d('0x155')]):_0x186bbf[_0x0b2d('0x130')][_0x0b2d('0x131')]):util[_0x0b2d('0x6a')](_0x0b2d('0x153'),_[_0x0b2d('0xc2')](_0x54316d['TrunkBackup'])?_0x54316d[_0x0b2d('0x66')][_0x0b2d('0x38')]:_0x54316d[_0x0b2d('0x10a')][_0x0b2d('0x38')],isNotNull(_0x54316d[_0x0b2d('0x52')])?_0x54316d[_0x0b2d('0x52')][_0x0b2d('0x154')]()||'':'',_0x54316d[_0x0b2d('0x155')]>0x0?_0x186bbf['Contact'][_0x0b2d('0x131')][_0x0b2d('0x156')](_0x54316d[_0x0b2d('0x155')]):_0x186bbf[_0x0b2d('0x130')][_0x0b2d('0x131')]),'callerid':_0x56c3f0,'Exten':'xcally-motion-dialer','Context':_0x0b2d('0x157'),'Priority':'1','variable':_0x13cce1,'timeout':(_0x54316d[_0x0b2d('0x51')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35bc5c})['then'](function(_0xd132c2){return _0x6995c2(_0xd132c2);})[_0x0b2d('0x9b')](function(_0x4ed980){_0x54316d[_0x0b2d('0x158')]+=0x1;var _0xc22e71=new History(_0x558c35['actions'][_0x35bc5c]);logger['error'](util[_0x0b2d('0x6a')](_0x0b2d('0x159'),JSON[_0x0b2d('0x41')](_0x4ed980)));_0xc22e71[_0x0b2d('0x8f')]=0xe;_0xc22e71['statedesc']=_0x0b2d('0x15a');_0xc22e71[_0x0b2d('0x91')]=moment()[_0x0b2d('0x6a')](_0x0b2d('0xe4'));_0xc22e71[_0x0b2d('0x90')]=_0xc22e71[_0x0b2d('0x91')];_0x558c35['createHistory'](_0xc22e71)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x15b')));_0x558c35['moveContactManagedDialer'](_0xc22e71)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x15b')))[_0x0b2d('0x15')](function(){delete _0x558c35[_0x0b2d('0x94')][_0x35bc5c];return _0x29355d(msgResponse('originate',_0x0b2d('0x15c'),_0x0b2d('0x15d')));});});});};Dialer[_0x0b2d('0x96')][_0x0b2d('0x15e')]=function(_0x14e4f7){var _0x3093f5=this[_0x0b2d('0x94')][_0x14e4f7[_0x0b2d('0xf0')]];var _0x4cbdbf=this;if(_0x3093f5){delete this['actions'][_0x14e4f7[_0x0b2d('0xf0')]];_0x3093f5[_0x0b2d('0xe5')]=moment()[_0x0b2d('0x6a')](_0x0b2d('0xe4'));var _0x348b54=_0x3093f5[_0x0b2d('0x4b')]===_0x0b2d('0x6c')?this[_0x0b2d('0x18')][_0x3093f5['queue']]:this[_0x0b2d('0x17')][_0x3093f5[_0x0b2d('0x15f')]()];if(!this[_0x0b2d('0xbe')](_0x14e4f7[_0x0b2d('0x160')])){this[_0x0b2d('0x9d')](_0x348b54);return this[_0x0b2d('0x161')](_0x3093f5,_0x348b54,_0x14e4f7)[_0x0b2d('0xa9')](function(_0xb116a){})[_0x0b2d('0x9b')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x0b2d('0x1e')][_0x14e4f7[_0x0b2d('0xc1')]]=_0x3093f5;}}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x162')]=function(_0x15ac41,_0x294183,_0x500867){var _0x38d733=new History(_0x294183);if(_0x38d733[_0x0b2d('0x163')]+_0x38d733[_0x0b2d('0x164')]+_0x38d733[_0x0b2d('0x165')]>=_0x500867[_0x0b2d('0x166')]-0x1){return!![];}switch(_0x15ac41){case 0x3:if(_0x38d733['countnoanswerretry']>=_0x500867[_0x0b2d('0x167')]-0x1){return!![];}else{this[_0x0b2d('0xac')]({'active':![],'countnoanswerretry':_0x38d733[_0x0b2d('0x165')]+=0x1,'scheduledat':moment()[_0x0b2d('0x168')](_0x500867[_0x0b2d('0x169')],_0x0b2d('0x16a'))['format'](_0x0b2d('0xe4')),'ContactId':_0x38d733[_0x0b2d('0xfb')],'ListId':_0x38d733[_0x0b2d('0xfc')],'VoiceQueueId':_0x38d733[_0x0b2d('0xbb')]||undefined,'CampaignId':_0x38d733[_0x0b2d('0xbc')]||undefined})['catch'](loggerCatch(_0x0b2d('0x16b')));}break;case 0x5:if(_0x38d733[_0x0b2d('0x163')]>=_0x500867['dialBusyMaxRetry']-0x1){return!![];}else{this[_0x0b2d('0xac')]({'active':![],'countbusyretry':_0x38d733['countbusyretry']+=0x1,'scheduledat':moment()[_0x0b2d('0x168')](_0x500867[_0x0b2d('0x16c')],_0x0b2d('0x16a'))[_0x0b2d('0x6a')](_0x0b2d('0xe4')),'ContactId':_0x38d733[_0x0b2d('0xfb')],'ListId':_0x38d733[_0x0b2d('0xfc')],'VoiceQueueId':_0x38d733[_0x0b2d('0xbb')]||undefined,'CampaignId':_0x38d733[_0x0b2d('0xbc')]||undefined})['catch'](loggerCatch(_0x0b2d('0x16d')));}break;case 0x8:if(_0x38d733['countcongestionretry']>=_0x500867[_0x0b2d('0x16e')]-0x1){return!![];}else{this[_0x0b2d('0xac')]({'active':![],'countcongestionretry':_0x38d733[_0x0b2d('0x164')]+=0x1,'scheduledat':moment()[_0x0b2d('0x168')](_0x500867[_0x0b2d('0x16f')],_0x0b2d('0x16a'))[_0x0b2d('0x6a')](_0x0b2d('0xe4')),'ContactId':_0x38d733[_0x0b2d('0xfb')],'ListId':_0x38d733[_0x0b2d('0xfc')],'VoiceQueueId':_0x38d733[_0x0b2d('0xbb')]||undefined,'CampaignId':_0x38d733[_0x0b2d('0xbc')]||undefined})[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x170')));}break;default:return!![];}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x161')]=function(_0x3eae67,_0x27d8bb,_0x280ca5){var _0x546101=this;var _0x5aa41a=new History(_0x3eae67);return new BPromise(function(_0x17301a,_0x16c35f){if(_[_0x0b2d('0x6f')](_0x27d8bb)&&'object'!==typeof _0x27d8bb){return _0x16c35f(msgResponse(_0x0b2d('0x171'),_0x0b2d('0x10e'),_0x0b2d('0x172')));}if(_['isUndefined'](_0x280ca5)&&'object'!==typeof _0x280ca5){return _0x16c35f(msgResponse(_0x0b2d('0x171'),'Failure',_0x0b2d('0x173')));}switch(_0x280ca5[_0x0b2d('0xdf')]){case'0':_0x27d8bb[_0x0b2d('0x59')]+=0x1;_0x5aa41a['state']=0x0;_0x5aa41a[_0x0b2d('0xc8')]=_0x0b2d('0x174');_0x546101[_0x0b2d('0xb3')](_0x5aa41a)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x175')));if(_0x546101[_0x0b2d('0x162')](0x0,_0x3eae67,_0x27d8bb)){if(_0x5aa41a[_0x0b2d('0x163')]+_0x5aa41a['countcongestionretry']+_0x5aa41a[_0x0b2d('0x165')]>=_0x27d8bb[_0x0b2d('0x166')]){_0x546101[_0x0b2d('0x176')](_0x5aa41a,_0x17301a,_0x16c35f,'reason\x200\x20no\x20such\x20number....');}else{_0x546101[_0x0b2d('0x177')](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x178'));}}break;case'3':_0x27d8bb['outboundNoAnswerCallsDay']+=0x1;_0x5aa41a[_0x0b2d('0x8f')]=0x3;_0x5aa41a[_0x0b2d('0xc8')]='NoAnswer';_0x5aa41a[_0x0b2d('0x165')]+=0x1;_0x5aa41a[_0x0b2d('0x179')]+=0x1;_0x546101[_0x0b2d('0xb3')](_0x5aa41a)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x17a')));if(_0x546101[_0x0b2d('0x162')](0x3,_0x3eae67,_0x27d8bb)){if(_0x5aa41a[_0x0b2d('0x165')]>=_0x27d8bb[_0x0b2d('0x167')]){_0x546101[_0x0b2d('0x177')](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x17b'));}else{_0x546101[_0x0b2d('0x176')](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x17b'));}}break;case'5':_0x27d8bb[_0x0b2d('0x17c')]+=0x1;_0x5aa41a[_0x0b2d('0x8f')]=0x5;_0x5aa41a[_0x0b2d('0xc8')]='Busy';_0x5aa41a[_0x0b2d('0x163')]+=0x1;_0x5aa41a[_0x0b2d('0x179')]+=0x1;_0x546101[_0x0b2d('0xb3')](_0x5aa41a)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x17d')));if(_0x546101[_0x0b2d('0x162')](0x5,_0x3eae67,_0x27d8bb)){if(_0x5aa41a[_0x0b2d('0x163')]>=_0x27d8bb[_0x0b2d('0x17e')]){_0x546101['createStateFinal'](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x17f'));}else{_0x546101['stateGlobal'](_0x5aa41a,_0x17301a,_0x16c35f,'reason\x205\x20busy');}}break;case'8':_0x27d8bb['outboundCongestionCallsDay']+=0x1;_0x5aa41a[_0x0b2d('0x8f')]=0x8;_0x5aa41a['statedesc']=_0x0b2d('0x180');_0x5aa41a[_0x0b2d('0x164')]+=0x1;_0x5aa41a[_0x0b2d('0x179')]+=0x1;_0x546101['createHistory'](_0x5aa41a)[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x181')));if(_0x546101['checkRetriveMax'](0x8,_0x3eae67,_0x27d8bb)){if(_0x5aa41a[_0x0b2d('0x164')]>=_0x27d8bb[_0x0b2d('0x16e')]){_0x546101[_0x0b2d('0x177')](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x182'));}else{_0x546101[_0x0b2d('0x176')](_0x5aa41a,_0x17301a,_0x16c35f,_0x0b2d('0x182'));}}break;default:_0x27d8bb[_0x0b2d('0x5c')]+=0x1;_0x5aa41a[_0x0b2d('0x8f')]=0xc;_0x5aa41a[_0x0b2d('0xc8')]=_0x280ca5['reason'];_0x546101[_0x0b2d('0xb3')](_0x5aa41a)['catch'](loggerCatch(_0x0b2d('0x183')));if(_0x546101[_0x0b2d('0x162')](_0x280ca5['reason'],_0x3eae67,_0x27d8bb)){if(_0x5aa41a[_0x0b2d('0x163')]+_0x5aa41a[_0x0b2d('0x164')]+_0x5aa41a[_0x0b2d('0x165')]>=_0x27d8bb[_0x0b2d('0x166')]){_0x546101[_0x0b2d('0x176')](_0x5aa41a,_0x17301a,_0x16c35f,_0x280ca5['reason']);}else{_0x546101[_0x0b2d('0x177')](_0x5aa41a,_0x17301a,_0x16c35f,_0x280ca5[_0x0b2d('0xdf')]);}}}});};Dialer[_0x0b2d('0x96')][_0x0b2d('0x176')]=function(_0x36098a,_0x4b3b55,_0x2cba40,_0x36e18a){var _0x2253d0=new Final(_0x36098a);_0x2253d0[_0x0b2d('0x8f')]=0xf;_0x2253d0['statedesc']=_0x0b2d('0x184');this[_0x0b2d('0x177')](_0x2253d0,_0x4b3b55,_0x2cba40,_0x36e18a);};Dialer['prototype'][_0x0b2d('0x177')]=function(_0xd02ab,_0x50e994,_0x4db1ed,_0x4c18be){this[_0x0b2d('0xb1')](_0xd02ab)[_0x0b2d('0xa9')](function(_0x16df13){return _0x50e994(msgResponse(_0x0b2d('0x171'),_0x0b2d('0xbf'),_0x4c18be));})['catch'](function(_0x2ce08b){return _0x4db1ed(msgResponse(_0x0b2d('0x185'),_0x0b2d('0x10e'),_0x0b2d('0x186')));});};Dialer[_0x0b2d('0x96')][_0x0b2d('0x5')]=function(_0x151cdd){var _0x34f908=this;var _0x35750d=_0x151cdd[_0x0b2d('0x187')]/0x64;var _0x46c3bc=_0x151cdd[_0x0b2d('0xe7')]/(_0x151cdd['outboundDropCallsDayTimeout']+_0x151cdd['outboundAnswerCallsDay']);var _0x1e5400=_0x151cdd[_0x0b2d('0x125')]-_0x151cdd['predictiveIntervalPauses']-_0x151cdd[_0x0b2d('0x88')]-_0x151cdd[_0x0b2d('0x65')]-_0x151cdd[_0x0b2d('0x49')];var _0x839baf=(_0x151cdd[_0x0b2d('0x125')]-_0x151cdd[_0x0b2d('0x63')])*_0x151cdd[_0x0b2d('0x62')];var _0x415f39=Math[_0x0b2d('0x188')](_0x151cdd['erlangCalls']*_0x151cdd[_0x0b2d('0x189')]*_0x151cdd[_0x0b2d('0x61')]*_0x151cdd[_0x0b2d('0x18a')]);if(_['isUndefined'](_0x151cdd[_0x0b2d('0x78')])){loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x18b'));if(!_['isUndefined'](_0x151cdd[_0x0b2d('0x20')])){_0x151cdd['startPredictive']=undefined;loggerPredictive[_0x0b2d('0x7e')](_0x0b2d('0x18c'),_0x0b2d('0x18d'));}if(!_[_0x0b2d('0x6f')](_0x151cdd['handlePredictive'])){loggerPredictive[_0x0b2d('0x7e')](_0x0b2d('0x18c'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x151cdd[_0x0b2d('0x7a')]);_0x151cdd['handlePredictive']=undefined;}_0x151cdd[_0x0b2d('0x78')]=moment()[_0x0b2d('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x18e'),_0x151cdd[_0x0b2d('0x78')],_0x151cdd[_0x0b2d('0x38')]);this[_0x0b2d('0x11e')](_0x151cdd,0x1);}else if(ifInterval(_0x151cdd['dialPredictiveInterval'],_0x151cdd[_0x0b2d('0x78')])){this['handlePower'](_0x151cdd,0x1);loggerPredictiveCalls[_0x0b2d('0x71')](_0x0b2d('0x18f'),_0x151cdd[_0x0b2d('0x78')],_0x151cdd[_0x0b2d('0x38')]);_0x151cdd[_0x0b2d('0x190')]=0x0;_0x151cdd[_0x0b2d('0xe8')]=0x0;}else if(_0x35750d<_0x46c3bc&&_0x151cdd['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x151cdd);loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x191'),_0x0b2d('0x192'),_0x46c3bc,_0x0b2d('0x78'),_0x151cdd[_0x0b2d('0x38')]);}else if(_0x1e5400>_0x839baf){freeVariablesPredictive(_0x151cdd);loggerPredictive['info'](_0x0b2d('0x193'),_0x0b2d('0x194'),_0x1e5400,_0x0b2d('0x195'),_0x839baf);}else if(_0x415f39<_0x151cdd['predictiveIntervalErlangCallsDroppedCalls']&&_0x151cdd[_0x0b2d('0x196')]===_0x0b2d('0x197')){freeVariablesPredictive(_0x151cdd);loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x198'),_0x0b2d('0x199'),_0x415f39,'Drop\x20in\x20this\x20interval',_0x151cdd[_0x0b2d('0xe8')],_0x0b2d('0x78'),_0x151cdd[_0x0b2d('0x38')]);}else if(!ifInterval(_0x151cdd['dialPredictiveInterval'],_0x151cdd[_0x0b2d('0x78')])&&_['isUndefined'](_0x151cdd['startPredictive'])&&!_[_0x0b2d('0x6f')](_0x151cdd['startProgressive'])){_0x151cdd[_0x0b2d('0x20')]=moment()[_0x0b2d('0x6a')](_0x0b2d('0xe4'));loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x19a'),_0x151cdd[_0x0b2d('0x20')],_0x151cdd['name']);this[_0x0b2d('0xa8')](_0x151cdd[_0x0b2d('0x19b')])['then'](this[_0x0b2d('0x19c')](_0x151cdd))[_0x0b2d('0xa9')](mergeDataErlangB(_0x151cdd))[_0x0b2d('0xa9')](this['startMethodPredictive'](_0x151cdd))[_0x0b2d('0x9b')](loggerCatchPredictive(_0x0b2d('0x19d'),_0x151cdd));}else if(!ifInterval(_0x151cdd[_0x0b2d('0x19b')],_0x151cdd['startPredictive'])){_0x151cdd['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x151cdd[_0x0b2d('0x20')]=moment()[_0x0b2d('0x6a')](_0x0b2d('0xe4'));loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x19e'),_0x151cdd[_0x0b2d('0x20')],_0x151cdd[_0x0b2d('0x38')]);clearInterval(_0x151cdd[_0x0b2d('0x7a')]);_0x151cdd[_0x0b2d('0x7a')]=undefined;this[_0x0b2d('0xa8')](_0x151cdd[_0x0b2d('0x19b')])[_0x0b2d('0xa9')](this['getDataPredictive'](_0x151cdd))[_0x0b2d('0xa9')](mergeDataErlangB(_0x151cdd))[_0x0b2d('0xa9')](this[_0x0b2d('0x19f')](_0x151cdd))[_0x0b2d('0x9b')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x151cdd));}};Dialer['prototype']['getDataPredictive']=function(_0x2ba17d){var _0xf9c2f4=this;return function(_0x250518){return new BPromise(function(_0x1a216d,_0x7bb539){_['merge'](_0x2ba17d,_0x250518[0x0]);if(checkGetDataPredictive(_0x250518[0x0])){loggerPredictive[_0x0b2d('0x71')](JSON[_0x0b2d('0x41')](_0x250518[0x0]));if(_0x2ba17d['dialPredictiveOptimization']==='dropRate'){return _0xf9c2f4[_0x0b2d('0xb0')](_0x2ba17d['id'])[_0x0b2d('0xa9')](function(_0x51a051){var _0x1f217e=_0x2ba17d['loggedIn']-_0x51a051[0x0][_0x0b2d('0x1a0')];var _0x2d7c3f=_0x2ba17d['dialPredictiveInterval']*0x3c;var _0x160cca=_0x250518[0x0][_0x0b2d('0x70')]+_0x250518[0x0][_0x0b2d('0x73')];var _0x462135=(_0x250518[0x0][_0x0b2d('0x5d')]+_0x250518[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x250518[0x0][_0x0b2d('0x5e')])/_0x250518[0x0]['predictiveIntervalTotalCalls'];var _0x122f53=_0x2ba17d['dialPredictiveOptimizationPercentage']/0x64;_0x2ba17d[_0x0b2d('0x63')]=_0x51a051[0x0][_0x0b2d('0x1a0')]||0x0;_0x2ba17d['predictiveIntervalHitRate']=_0x462135>0x0?_0x462135:0x1;return _0xf9c2f4[_0x0b2d('0x1a1')](_0x1f217e,_0x2d7c3f,_0x160cca,_0x462135,_0x122f53);})['then'](function(_0x2ba346){return _0x1a216d(_0x2ba346);})[_0x0b2d('0x9b')](function(_0x5c5e92){return _0x7bb539(msgResponse(_0x0b2d('0x1a2'),_0x0b2d('0x10e'),JSON[_0x0b2d('0x41')](_0x5c5e92)));});}if(_0x2ba17d['dialPredictiveOptimization']==='agentBusyFactor'){return _0xf9c2f4[_0x0b2d('0xb0')](_0x2ba17d['id'])[_0x0b2d('0xa9')](function(_0x4d5e72){var _0x36acdf=_0x2ba17d['loggedIn']-_0x4d5e72[0x0]['outboundQueuePauses'];var _0x523b83=_0x2ba17d[_0x0b2d('0x19b')]*0x3c;var _0x521588=_0x250518[0x0][_0x0b2d('0x70')]+_0x250518[0x0][_0x0b2d('0x73')];var _0x13b0ad=(_0x250518[0x0][_0x0b2d('0x5d')]+_0x250518[0x0][_0x0b2d('0x5f')]+_0x250518[0x0][_0x0b2d('0x5e')])/_0x250518[0x0][_0x0b2d('0x64')];var _0x59c902=_0x2ba17d[_0x0b2d('0x187')]/0x64;_0x2ba17d[_0x0b2d('0x63')]=_0x4d5e72[0x0][_0x0b2d('0x1a0')]||0x0;_0x2ba17d[_0x0b2d('0x61')]=_0x13b0ad>0x0?_0x13b0ad:0x1;return _0xf9c2f4[_0x0b2d('0x1a3')](_0x36acdf,_0x523b83,_0x521588,_0x13b0ad,_0x59c902);})[_0x0b2d('0xa9')](function(_0xe70ebc){return _0x1a216d(_0xe70ebc);})[_0x0b2d('0x9b')](function(_0x36e169){return _0x7bb539(msgResponse(_0x0b2d('0x1a2'),_0x0b2d('0x10e'),JSON[_0x0b2d('0x41')](_0x36e169)));});}}else{return _0x7bb539(msgResponse(_0x0b2d('0x1a4'),_0x0b2d('0x10e'),_0x0b2d('0x1a5')));}});};};Dialer['prototype'][_0x0b2d('0x19f')]=function(_0x15109a){var _0x37530b=this;return function(){var _0x1ea2ea=0x0;var _0x5237df=Math[_0x0b2d('0x188')](_0x15109a[_0x0b2d('0x1a6')]*0x3e8);if(_0x5237df>0x0){_0x5237df=_0x5237df<0x64?0x64:_0x5237df;loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x1a7'),_0x5237df);_0x15109a['handlePredictive']=setInterval(function(){_0x37530b[_0x0b2d('0x7a')](_0x15109a);loggerPredictiveCalls[_0x0b2d('0x71')](_0x0b2d('0x1a8'),_0x1ea2ea+=0x1);},_0x5237df);}else{loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x1a9'),_0x0b2d('0x1aa'),_0x5237df);}};};Dialer[_0x0b2d('0x96')][_0x0b2d('0x1ab')]=function(_0x2c35ff,_0x37ec02){var _0x1f8935=this;return function(_0x22b0d2){if(_[_0x0b2d('0x40')](_0x22b0d2)){if(_[_0x0b2d('0xc2')](_0x37ec02[_0x0b2d('0xba')])||!_0x37ec02['recallme']){if(_0x2c35ff[_0x0b2d('0x4f')]===_0x0b2d('0x4')){_0x2c35ff[_0x0b2d('0xf7')]=_['isUndefined'](_0x2c35ff['queueStatusComplete'])?!![]:_0x2c35ff[_0x0b2d('0xf7')];var _0x1d2c3c=uuid['v4']();_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c]=new Action(_0x2c35ff,_0x37ec02,_0x1d2c3c);loggerBooked[_0x0b2d('0x71')](_0x0b2d('0x1ac'),_0x1d2c3c,_0x0b2d('0x1ad'),JSON[_0x0b2d('0x41')](_0x2c35ff[_0x0b2d('0xf7')]),'Queue:\x20',_0x2c35ff[_0x0b2d('0x38')]);if(_0x2c35ff[_0x0b2d('0xf7')]){_0x2c35ff[_0x0b2d('0xf7')]=![];_0x1f8935[_0x0b2d('0x22')][_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c]['queue']]=[];ami['Action']({'actionid':_0x1d2c3c,'action':_0x0b2d('0x1ae'),'queue':_0x2c35ff['name']})[_0x0b2d('0x9b')](function(_0xcfd15c){_0x1f8935[_0x0b2d('0x9d')](_0x2c35ff);_0x1f8935['rescheduleContact']({'active':![],'ContactId':_0x1f8935['actions'][_0x1d2c3c][_0x0b2d('0xfb')],'ListId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c][_0x0b2d('0xfc')],'VoiceQueueId':_0x1f8935['actions'][_0x1d2c3c][_0x0b2d('0xbb')]||undefined,'CampaignId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c]['CampaignId']||undefined})[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x1af')));delete _0x1f8935[_0x0b2d('0x94')][_0x1d2c3c];});}else{loggerBooked['info'](_0x0b2d('0x1b0'),JSON[_0x0b2d('0x41')](_0x2c35ff[_0x0b2d('0xf7')]),_0x0b2d('0x1b1'),_0x2c35ff[_0x0b2d('0x38')]);_0x1f8935[_0x0b2d('0x9d')](_0x2c35ff);_0x1f8935['rescheduleContact']({'active':![],'ContactId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c][_0x0b2d('0xfb')],'ListId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c][_0x0b2d('0xfc')],'VoiceQueueId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c][_0x0b2d('0xbb')]||undefined,'CampaignId':_0x1f8935[_0x0b2d('0x94')][_0x1d2c3c][_0x0b2d('0xbc')]||undefined})[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x1af')));delete _0x1f8935['actions'][_0x1d2c3c];}}else{return _0x1f8935[_0x0b2d('0x12c')](_0x2c35ff,_0x37ec02);}}else{if(getDiff(_0x37ec02['scheduledat'])<_0x2c35ff['dialRecallMeTimeout']*0x3c){_0x1f8935[_0x0b2d('0x16')][_0x0b2d('0xf9')](_0x37ec02['id'])[_0x0b2d('0x15')](function(){_0x1f8935[_0x0b2d('0x9d')](_0x2c35ff);});}else{_0x2c35ff['outboundReCallsDay']+=0x1;_0x1f8935[_0x0b2d('0x9d')](_0x2c35ff);if(_0x2c35ff[_0x0b2d('0x1b2')]){_0x1f8935[_0x0b2d('0xac')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x37ec02['ContactId'],'ListId':_0x37ec02['ListId'],'VoiceQueueId':_0x37ec02[_0x0b2d('0xbb')]||undefined,'CampaignId':_0x37ec02[_0x0b2d('0xbc')]||undefined})[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x1b3')));_0x1f8935[_0x0b2d('0xb3')](createObjHistory(_0x2c35ff,_0x37ec02,_0x0b2d('0x1b4'),0x17,_0x0b2d('0x1b5')))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0x1b6')));}else{_0x1f8935[_0x0b2d('0xcb')](createObjHistory(_0x2c35ff,_0x37ec02,_0x0b2d('0x1b7'),0x16,_0x0b2d('0x1b8')),_0x0b2d('0x1b9'),_0x0b2d('0x1ba'));}}}}else{_0x2c35ff[_0x0b2d('0x55')]+=0x1;_0x1f8935[_0x0b2d('0xcb')](createObjHistory(_0x2c35ff,_0x37ec02,'BLACKLIST',0xd,_0x0b2d('0x1bb')),_0x0b2d('0x1bc'),'[Originate][MoveBlacklist]');throw _0x0b2d('0x1bd');}};};Dialer[_0x0b2d('0x96')][_0x0b2d('0x124')]=function(_0x34bbd7){var _0x4a0f06=this;var _0x18f982=[];var _0x2fbba0=_0x34bbd7['limitCalls']-_0x34bbd7[_0x0b2d('0x65')]-_0x34bbd7['temp'];emitCampaignSummary(_0x34bbd7);if(_0x2fbba0>0x0){if(_0x2fbba0>this[_0x0b2d('0x1b')]){_0x2fbba0=this['maxNumberOriginate'];}_0x34bbd7[_0x0b2d('0x1be')]+=_0x2fbba0;this['getContactDialerIvr'](_0x34bbd7['id'],_0x2fbba0,_0x34bbd7[_0x0b2d('0x1bf')])[_0x0b2d('0xa9')](function(_0x5ca003){_0x34bbd7[_0x0b2d('0x1be')]-=_0x2fbba0;_0x34bbd7[_0x0b2d('0x1be')]=_0x34bbd7[_0x0b2d('0x1be')]>0x0?_0x34bbd7[_0x0b2d('0x1be')]:0x0;if(!checkContactEmpty(_0x5ca003)){_0x34bbd7[_0x0b2d('0x37')]=_0x0b2d('0x87');logger['info'](_0x0b2d('0x1c0')+_0x34bbd7['name']);}else{_0x34bbd7[_0x0b2d('0x65')]+=_0x5ca003[_0x0b2d('0xff')];_0x34bbd7['message']=_0x0b2d('0x1c1');for(var _0x520ac3=0x0;_0x520ac3<_0x5ca003['length'];_0x520ac3+=0x1){_0x34bbd7['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x5ca003[_0x520ac3])||_['isNil'](_0x5ca003[_0x520ac3][_0x0b2d('0x130')])||_[_0x0b2d('0xc2')](_0x5ca003[_0x520ac3][_0x0b2d('0x130')][_0x0b2d('0x131')])){_0x4a0f06[_0x0b2d('0xb7')](_0x0b2d('0x1c2'),_0x34bbd7,_0x5ca003[_0x520ac3]);}else{_0x4a0f06[_0x0b2d('0xa6')](_[_0x0b2d('0xb9')](_0x5ca003[_0x520ac3],['CampaignId',_0x0b2d('0x1c3')]))['then'](_0x4a0f06[_0x0b2d('0x1ab')](_0x34bbd7,_0x5ca003[_0x520ac3]))[_0x0b2d('0x9b')](_0x4a0f06[_0x0b2d('0xb6')]('[actionOriginateIvr]\x20',_0x34bbd7));}}}})[_0x0b2d('0x9b')](loggerGetContactDialer(_0x0b2d('0x1c4'),_0x34bbd7,_0x2fbba0));}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x11e')]=function(_0x1d4c4d,_0x12bcea){var _0xe9d88=this;var _0x1ff31d=[];var _0x66bb9f=_0x12bcea>=0x1?_0x12bcea:0x1;var _0x191ddc=[];if(_0x1d4c4d[_0x0b2d('0x4f')]===_0x0b2d('0x4')){_0x66bb9f=0x1;}var _0x3cf41=Math['floor'](_0x1d4c4d['available']*_0x66bb9f)-_0x1d4c4d[_0x0b2d('0x65')]-_0x1d4c4d['temp'];emitVoiceQueueSummary(_0x1d4c4d);if(_0x1d4c4d[_0x0b2d('0x1c5')]>0x0){var _0x180b02=_0x1d4c4d[_0x0b2d('0x1c5')]-_0x1d4c4d[_0x0b2d('0x65')]-_0x1d4c4d['talking']-_0x1d4c4d[_0x0b2d('0x1be')]-_0x1d4c4d[_0x0b2d('0x47')];if(_0x3cf41>_0x180b02){_0x3cf41=_0x180b02;}}if(_0x3cf41>0x0){if(_0x1d4c4d[_0x0b2d('0x4f')]==='booked'){_0x3cf41=0x1;}if(_0x3cf41>this[_0x0b2d('0x1b')]){_0x3cf41=this['maxNumberOriginate'];}_0x1d4c4d[_0x0b2d('0x1be')]+=_0x3cf41;for(var _0x45d33f in this[_0x0b2d('0x19')]){if(this[_0x0b2d('0x19')][_0x0b2d('0x80')](_0x45d33f)){if(this[_0x0b2d('0x19')][_0x45d33f][_0x0b2d('0x8f')]===_0x0b2d('0x1c6')&&this[_0x0b2d('0x19')][_0x45d33f][_0x0b2d('0x99')]==='reachable'){_0x1ff31d[_0x0b2d('0xf5')](this[_0x0b2d('0x19')][_0x45d33f]['id']);}}}this['getContactDialer'](_0x1d4c4d['id'],_0x1ff31d,_0x3cf41,_0x1d4c4d[_0x0b2d('0x1bf')])[_0x0b2d('0xa9')](function(_0x283086){_0x1d4c4d[_0x0b2d('0x1be')]-=_0x3cf41;_0x1d4c4d[_0x0b2d('0x1be')]=_0x1d4c4d[_0x0b2d('0x1be')]>0x0?_0x1d4c4d[_0x0b2d('0x1be')]:0x0;if(!checkContactEmpty(_0x283086)){_0xe9d88[_0x0b2d('0xa1')](_0x1d4c4d)[_0x0b2d('0xa9')](sendMessageReschedule(_0x1d4c4d))['catch'](loggerCatch(_0x0b2d('0xa3')));}else{_0x1d4c4d[_0x0b2d('0x65')]+=_0x283086[_0x0b2d('0xff')];_0x1d4c4d[_0x0b2d('0x37')]=_0x1d4c4d[_0x0b2d('0x4f')]==='booked'?_0x0b2d('0x138'):'RUNNING';for(var _0x5a9176=0x0;_0x5a9176<_0x283086['length'];_0x5a9176+=0x1){if(_[_0x0b2d('0xc2')](_0x283086[_0x5a9176])||_['isNil'](_0x283086[_0x5a9176][_0x0b2d('0x130')])||_[_0x0b2d('0xc2')](_0x283086[_0x5a9176][_0x0b2d('0x130')]['phone'])){_0xe9d88['emptyContact']('[actionOriginate]\x20',_0x1d4c4d,_0x283086[_0x5a9176]);}else{_0xe9d88[_0x0b2d('0xa4')](_[_0x0b2d('0xb9')](_0x283086[_0x5a9176],[_0x0b2d('0xbb'),_0x0b2d('0x1c3')]))[_0x0b2d('0xa9')](_0xe9d88[_0x0b2d('0x1ab')](_0x1d4c4d,_0x283086[_0x5a9176]))[_0x0b2d('0x9b')](_0xe9d88[_0x0b2d('0xb6')]('[actionOriginate]\x20',_0x1d4c4d));}}}})[_0x0b2d('0x9b')](loggerGetContactDialer(_0x0b2d('0x1c7'),_0x1d4c4d,_0x3cf41));}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x7a')]=function(_0x52c5f9){var _0x5b9ea1=this;if(_0x52c5f9['dialLimitQueue']>0x0){var _0x3e7b7c=_0x52c5f9[_0x0b2d('0x1c5')]-_0x52c5f9['originated']-_0x52c5f9[_0x0b2d('0x49')];if(_0x3e7b7c>0x0){this[_0x0b2d('0x1c8')](_0x52c5f9);}else{loggerPredictiveCalls['info'](_0x0b2d('0x1c9'));}}else{this['tryOriginatePredictive'](_0x52c5f9);}};Dialer[_0x0b2d('0x96')][_0x0b2d('0x1c8')]=function(_0x2085cf){var _0x2d52d9=this;var _0x5e8ba1=[];_0x2085cf[_0x0b2d('0x65')]+=0x1;for(var _0x30cac6 in this[_0x0b2d('0x19')]){if(this['agents']['hasOwnProperty'](_0x30cac6)){if(this[_0x0b2d('0x19')][_0x30cac6][_0x0b2d('0x8f')]===_0x0b2d('0x1c6')&&this[_0x0b2d('0x19')][_0x30cac6][_0x0b2d('0x99')]==='reachable'){_0x5e8ba1['push'](this['agents'][_0x30cac6]['id']);}}}this[_0x0b2d('0xad')](_0x2085cf['id'],_0x5e8ba1,0x1,_0x2085cf[_0x0b2d('0x1bf')])[_0x0b2d('0xa9')](function(_0x4d000b){if(!checkContactEmpty(_0x4d000b)){checkContactLowerLimitOriginate(_0x2085cf,0x1,0x0);_0x2d52d9[_0x0b2d('0xa1')](_0x2085cf)[_0x0b2d('0xa9')](sendMessageReschedule(_0x2085cf))[_0x0b2d('0x9b')](loggerCatch(_0x0b2d('0xa3')));}else{_0x2085cf['message']='RUNNING';if(_[_0x0b2d('0xc2')](_0x4d000b[0x0])||_[_0x0b2d('0xc2')](_0x4d000b[0x0][_0x0b2d('0x130')])||_[_0x0b2d('0xc2')](_0x4d000b[0x0][_0x0b2d('0x130')][_0x0b2d('0x131')])){_0x2d52d9['emptyContact'](_0x0b2d('0x1c2'),_0x2085cf,_0x4d000b[0x0]);}else{_0x2d52d9[_0x0b2d('0xa4')](_['pick'](_0x4d000b[0x0],[_0x0b2d('0xbb'),_0x0b2d('0x1c3')]))[_0x0b2d('0xa9')](_0x2d52d9[_0x0b2d('0x1ab')](_0x2085cf,_0x4d000b[0x0]))[_0x0b2d('0x9b')](_0x2d52d9[_0x0b2d('0xb6')](_0x0b2d('0x1ca'),_0x2085cf));}}})['catch'](loggerGetContactDialer(_0x0b2d('0x1cb'),_0x2085cf,0x1));emitVoiceQueueSummary(_0x2085cf);};Dialer[_0x0b2d('0x96')]['abandonmentRate']=function(_0x570aba,_0xaf583,_0x22f02c,_0xab676f,_0x358885,_0x141aae){loggerPredictive['info'](_0x0b2d('0x1cc'),'\x20m\x20=\x20',_0x570aba,_0x0b2d('0x1cd'),_0xaf583,_0x0b2d('0x1ce'),_0x22f02c,_0x0b2d('0x1cf'),_0xab676f,_0x0b2d('0x1d0'),_0x358885);return new BPromise(function(_0x345e61,_0xbfccad){if(_0x570aba<=0x0||isNaN(_0x570aba)){return _0xbfccad(msgResponse(_0x0b2d('0x1cc'),_0x0b2d('0x15c'),_0x0b2d('0x1d1')+_0x570aba));}if(_0x22f02c<=0x0||isNaN(_0x22f02c)){return _0xbfccad(msgResponse(_0x0b2d('0x1cc'),'Error',_0x0b2d('0x1d2')+_0x22f02c));}if(_0xab676f<=0x0||isNaN(_0xab676f)){return _0xbfccad(msgResponse(_0x0b2d('0x1cc'),'Error',_0x0b2d('0x1d3')+_0xab676f));}if(_0xaf583<=0x0||isNaN(_0xaf583)){return _0xbfccad(msgResponse('[abandonmentRate]',_0x0b2d('0x15c'),_0x0b2d('0x1d4')+_0xaf583));}if(_0x358885<=0x0||isNaN(_0x358885)){return _0xbfccad(msgResponse(_0x0b2d('0x1cc'),_0x0b2d('0x15c'),'Amax\x20=\x20'+_0x358885));}_0x141aae=_0x141aae||0x0;var _0xc8f79d=0x1/_0x22f02c;var _0x45d828=0x0;var _0x4fefcb=0x0;var _0x3adba4=0x0;var _0x14b374=0x0;for(var _0x501d7a=0x0;_0x3adba4<_0x358885;_0x501d7a+=0x1){_0x4fefcb=_0x501d7a/_0xaf583;_0x45d828=(_0xab676f*_0x4fefcb+_0x141aae)/_0xc8f79d;_0x3adba4=erlangb(_0x45d828,_0x570aba);_0x14b374=_0x45d828/_0x570aba*(0x1-erlangb(_0x45d828,_0x570aba));}return _0x345e61({'erlangCalls':_0x501d7a,'erlangCallToSecond':_0xaf583/_0x501d7a,'erlangAbandonmentRate':_0x3adba4,'erlangBusyFactor':_0x14b374});});};Dialer[_0x0b2d('0x96')][_0x0b2d('0x1a3')]=function(_0x3dc410,_0x4592e6,_0x3ad73f,_0x30eda0,_0x2be011,_0x3e7075){loggerPredictive[_0x0b2d('0x71')](_0x0b2d('0x1d5'),_0x0b2d('0x1d6'),_0x3dc410,_0x0b2d('0x1cd'),_0x4592e6,_0x0b2d('0x1ce'),_0x3ad73f,_0x0b2d('0x1cf'),_0x30eda0,_0x0b2d('0x1d7'),_0x2be011);return new BPromise(function(_0x2a9e3b,_0x5a2ecb){if(_0x3dc410<=0x0||isNaN(_0x3dc410)){return _0x5a2ecb(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x3dc410));}if(_0x3ad73f<=0x0||isNaN(_0x3ad73f)){return _0x5a2ecb(msgResponse(_0x0b2d('0x1cc'),_0x0b2d('0x15c'),_0x0b2d('0x1d2')+_0x3ad73f));}if(_0x30eda0<=0x0||isNaN(_0x30eda0)){return _0x5a2ecb(msgResponse(_0x0b2d('0x1cc'),'Error',_0x0b2d('0x1d3')+_0x30eda0));}if(_0x4592e6<=0x0||isNaN(_0x4592e6)){return _0x5a2ecb(msgResponse(_0x0b2d('0x1cc'),'Error','interval\x20=\x20'+_0x4592e6));}if(_0x2be011<=0x0||isNaN(_0x2be011)){return _0x5a2ecb(msgResponse(_0x0b2d('0x1cc'),_0x0b2d('0x15c'),_0x0b2d('0x1d8')+_0x2be011));}_0x3e7075=_0x3e7075||0x0;var _0x3b05eb=0x1/_0x3ad73f;var _0x3644a7=0x0;var _0x58f80a=0x0;var _0x3ac8ed=0x0;var _0x32d53f=0x0;for(var _0x2832d0=0x0;_0x32d53f<_0x2be011;_0x2832d0+=0x1){_0x58f80a=_0x2832d0/_0x4592e6;_0x3644a7=(_0x30eda0*_0x58f80a+_0x3e7075)/_0x3b05eb;_0x3ac8ed=erlangb(_0x3644a7,_0x3dc410);_0x32d53f=_0x3644a7/_0x3dc410*(0x1-erlangb(_0x3644a7,_0x3dc410));}return _0x2a9e3b({'erlangCalls':_0x2832d0,'erlangCallToSecond':_0x4592e6/_0x2832d0,'erlangAbandonmentRate':_0x3ac8ed,'erlangBusyFactor':_0x32d53f});});};module[_0x0b2d('0x1d9')]=Dialer; \ No newline at end of file +var _0xcf13=['isNil','Action','status','channel','catch','updateOriginated','queue','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','getContactDialer','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','emptyContact','notFound','saveInDb','pick','ContactId','ListId','UserId','VoiceQueueId','[emptyContact][createHistory]','[emptyContact]','Success','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','[syncHangupInAMD]','MACHINE','Machine','AMD','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','syncQueueCallerAbandon','droptime','YYYY-MM-DD\x20HH:mm:ss','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','Abandoned','CALLEREXIT','actionid','roundrobin','locked','paused','stateinterface','push','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','CampaignId','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','timezones','content','indexOf','iftime\x20%s,%s','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','handlePower','dialPowerLevel','Queue','launchHandleIvr','handleIvr','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','createdAt','%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','originate\x20action\x20Error','getQueue','isSuccess','response','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','add','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','minutes','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','callProgressDetecting','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','[syncAgentComplete][createHistory][0]','checkRetriveMax','countcongestionretry','stateGlobal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','[syncAgentComplete][createHistory][5]','createStateFinal','reason\x205\x20busy','Congestion','reason\x208\x20congestion','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','erlangAbandonmentRate','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive][First]','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive][Date]','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Agent\x20free','agent\x20max\x20free\x20','[startMethodPredictive][StartPredictive][First]','averageHandleTime','startMethodPredictive','[averageHandleTime][ErlangB]\x20','getDataPredictive','outboundQueuePauses','predictiveIntervalDroppedCallsTimeout','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','erlangCallToSecond','[startMethodPredictive]','[startMethodPredictive][milliseconds]\x20','Failure\x20','recallme','queueStatusComplete:\x20','Queue:\x20','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','floor','dialLimitQueue','not_inuse','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','[abandonmentRate]','\x20m\x20=\x20','\x20Ts\x20=\x20','\x20p\x20=\x20','\x20Amax\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','busyFactor','[busyFactor]','\x20interval\x20=\x20','\x20Umin\x20=\x20','m\x20=\x20','exports','bluebird','moment','md5','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../../../config/environment/','../ami','socket.io-emitter','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','127.0.0.1','rrmemory','prototype','enqueue','tail','finally','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','originateresponse','syncOriginateResponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','callerid','stringify','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','isEmpty','info','[checkGetDataPredictive][avgTalktime]','predictiveIntervalAvgHoldtime','[checkGetDataPredictive][avgHoldtime]','[checkGetDataPredictive][totalCalls]','[checkGetDataPredictive][obj]','merge','[freeVariablesPredictive]','handlePredictive','string','\x22%s\x22\x20<%s>','error','inspect','length','hasOwnProperty','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','is\x20not\x20active','IS_DISACTIVED','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','sequence'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0xcf13,0x130));var _0x3cf1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf13[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x3cf1('0x0'));var uuid=require('uuid');var moment=require(_0x3cf1('0x1'));var rr=require('rr');var md5=require(_0x3cf1('0x2'));var logger=require(_0x3cf1('0x3'))('dialer');var loggerBooked=require('../../../config/logger')(_0x3cf1('0x4'));var loggerPredictive=require('../../../config/logger')(_0x3cf1('0x5'));var loggerPredictiveCalls=require('../../../config/logger')(_0x3cf1('0x6'));var loggerSyncQueueSummary=require(_0x3cf1('0x3'))(_0x3cf1('0x7'));var config=require(_0x3cf1('0x8'));var ami=require(_0x3cf1('0x9'));var io=require(_0x3cf1('0xa'))({'host':'localhost','port':0x18eb});var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x3cf1('0xb'));var cmHopperHistory=require(_0x3cf1('0xc'));var cmHopperBlack=require(_0x3cf1('0xd'));var voiceQueueRt=require(_0x3cf1('0xe'));var Action=require(_0x3cf1('0xf'));var History=require(_0x3cf1('0x10'));var Final=require(_0x3cf1('0x11'));var AgentComplete=require(_0x3cf1('0x12'));var QueueCallerAbandon=require(_0x3cf1('0x13'));var Hangup=require(_0x3cf1('0x14'));var ipAgi=process[_0x3cf1('0x15')]['XCALLY_IP_AGI']||_0x3cf1('0x16');var strategy={'rrmemory':_0x3cf1('0x17'),'roundrobin':'roundrobin'};var Sequence=function(){};Sequence[_0x3cf1('0x18')][_0x3cf1('0x19')]=function(_0x35ebf5){this[_0x3cf1('0x1a')]=this[_0x3cf1('0x1a')]?this['tail'][_0x3cf1('0x1b')](_0x35ebf5):_0x35ebf5();};function Dialer(_0x1c845a,_0x2ff548){this['sequence']=new Sequence();this['preview']=_0x2ff548;this[_0x3cf1('0x1c')]=_0x1c845a['voiceQueues'];this['campaigns']=_0x1c845a[_0x3cf1('0x1d')];this[_0x3cf1('0x1e')]=_0x1c845a['agents'];this['trunks']=_0x1c845a[_0x3cf1('0x1f')];this[_0x3cf1('0x20')]=config[_0x3cf1('0x20')]||0x2;this[_0x3cf1('0x21')]={};this[_0x3cf1('0x22')]={};this['contactsId']={};this[_0x3cf1('0x23')]={};this[_0x3cf1('0x24')]={};this[_0x3cf1('0x25')]={};this[_0x3cf1('0x26')]={};this[_0x3cf1('0x27')]={};this[_0x3cf1('0x28')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x3cf1('0x29')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x3cf1('0x2a'),this[_0x3cf1('0x2b')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x2d'),this[_0x3cf1('0x2e')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x2f'),this[_0x3cf1('0x7')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x30'),this[_0x3cf1('0x31')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x32'),this[_0x3cf1('0x33')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x34'),this[_0x3cf1('0x35')][_0x3cf1('0x2c')](this));ami['on']('queuemember',this[_0x3cf1('0x36')][_0x3cf1('0x2c')](this));ami['on'](_0x3cf1('0x37'),this['syncQueueStatusComplete'][_0x3cf1('0x2c')](this));this[_0x3cf1('0x38')]();this[_0x3cf1('0x39')]();}function isNotNull(_0x218a51){return _0x218a51!==null&&!_[_0x3cf1('0x3a')](_0x218a51);}function checkIsLoggedIn(_0x130009,_0x20a66b){return function(){if(_0x20a66b<=0x0){_0x130009[_0x3cf1('0x3b')]='AGENTS_NOT_LOGGED';throw _0x130009['name']+_0x3cf1('0x3c');}};}function isActive(_0x520781){return _0x520781;}function checkIsActive(_0x166ba0,_0xccfbb9){return function(){if(!isActive(_0xccfbb9)){_0x166ba0[_0x3cf1('0x3b')]=_0x3cf1('0x3d');throw _0x166ba0[_0x3cf1('0x3e')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4639d9){return function(){if(!isNotNull(_0x4639d9[_0x3cf1('0x3f')])){_0x4639d9['message']='INTERVAL_IS_NULL';throw _0x4639d9[_0x3cf1('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x4639d9['Interval']['Intervals'])){_0x4639d9[_0x3cf1('0x3b')]=_0x3cf1('0x40');throw _0x4639d9[_0x3cf1('0x3e')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x4639d9[_0x3cf1('0x3f')]['Intervals']))){_0x4639d9['message']='INTERVAL_IS_NULL';throw _0x4639d9['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x546b62,_0x213074,_0x23e409){return{'action':_0x546b62,'response':_0x213074,'message':_0x23e409};}function myreject(_0x2c6862){return function(_0x2772d7){return _0x2c6862(msgResponse('[ifTime][Action]',_0x3cf1('0x41'),JSON['stringify'](_0x2772d7)));};}function getSeconds(_0x5a2ed4,_0x35bcdb){var _0xd2b1ca=moment(_0x5a2ed4)[_0x3cf1('0x42')](0x0);var _0x288a02=moment(_0x35bcdb)[_0x3cf1('0x42')](0x0);return _0xd2b1ca[_0x3cf1('0x43')](_0x288a02,_0x3cf1('0x44'));}function emit(_0x2adb9e,_0x71f041,_0x48510f){io['to'](_0x2adb9e)[_0x3cf1('0x45')](_0x71f041,_0x48510f);}function emitVoiceQueueSummary(_0x3dc4a0){if(_0x3dc4a0[_0x3cf1('0x46')]===_0x3cf1('0x47')){var _0x1fc7e7={'id':_0x3dc4a0['id'],'name':_0x3dc4a0[_0x3cf1('0x3e')],'strategy':_0x3dc4a0[_0x3cf1('0x48')],'answered':_0x3dc4a0[_0x3cf1('0x49')],'available':_0x3dc4a0[_0x3cf1('0x4a')],'loggedIn':_0x3dc4a0[_0x3cf1('0x4b')],'pTalking':_0x3dc4a0[_0x3cf1('0x4c')],'sumBillable':_0x3dc4a0[_0x3cf1('0x4d')],'sumDuration':_0x3dc4a0[_0x3cf1('0x4e')],'sumHoldTime':_0x3dc4a0[_0x3cf1('0x4f')]||0x0,'talking':_0x3dc4a0[_0x3cf1('0x50')],'total':_0x3dc4a0[_0x3cf1('0x51')],'type':_0x3dc4a0[_0x3cf1('0x46')],'unmanaged':_0x3dc4a0['unmanaged'],'waiting':_0x3dc4a0[_0x3cf1('0x52')],'loggedInDb':_0x3dc4a0[_0x3cf1('0x53')],'dialActive':_0x3dc4a0[_0x3cf1('0x54')],'dialMethod':_0x3dc4a0[_0x3cf1('0x55')],'dialOriginateCallerIdName':_0x3dc4a0['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3dc4a0[_0x3cf1('0x56')],'dialOriginateTimeout':_0x3dc4a0[_0x3cf1('0x57')],'dialPrefix':_0x3dc4a0[_0x3cf1('0x58')],'outboundAnswerAgiCallsDay':_0x3dc4a0[_0x3cf1('0x59')],'outboundAnswerCallsDay':_0x3dc4a0[_0x3cf1('0x5a')],'outboundBlacklistCallsDay':_0x3dc4a0['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x3dc4a0['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x3dc4a0[_0x3cf1('0x5b')],'outboundDropCallsDayACS':_0x3dc4a0[_0x3cf1('0x5c')],'outboundDropCallsDayCallersExit':_0x3dc4a0[_0x3cf1('0x5d')],'outboundDropCallsDayTimeout':_0x3dc4a0[_0x3cf1('0x5e')],'outboundNoAnswerCallsDay':_0x3dc4a0[_0x3cf1('0x5f')],'outboundNoSuchCallsDay':_0x3dc4a0['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3dc4a0['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x3dc4a0[_0x3cf1('0x60')],'outboundRejectCallsDay':_0x3dc4a0[_0x3cf1('0x61')],'outboundUnknownCallsDay':_0x3dc4a0[_0x3cf1('0x62')],'predictiveIntervalAnsweredCalls':_0x3dc4a0[_0x3cf1('0x63')],'predictiveIntervalAvgHoldtime':_0x3dc4a0['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x3dc4a0[_0x3cf1('0x64')],'predictiveIntervalDroppedCallsCallersExit':_0x3dc4a0[_0x3cf1('0x65')],'predictiveIntervalDroppedCallsTimeout':_0x3dc4a0['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x3dc4a0['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x3dc4a0['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x3dc4a0['predictiveIntervalHitRate'],'predictiveIntervalLowerLimit':_0x3dc4a0[_0x3cf1('0x66')],'predictiveIntervalMultiplicativeFactor':_0x3dc4a0[_0x3cf1('0x67')],'predictiveIntervalPauses':_0x3dc4a0[_0x3cf1('0x68')],'predictiveIntervalTotalCalls':_0x3dc4a0[_0x3cf1('0x69')],'message':_0x3dc4a0[_0x3cf1('0x3b')],'originated':_0x3dc4a0[_0x3cf1('0x6a')]};if(_0x3dc4a0[_0x3cf1('0x6b')]){_0x1fc7e7[_0x3cf1('0x6b')]={'id':_0x3dc4a0[_0x3cf1('0x6b')]['id'],'name':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x3e')],'active':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x6c')],'callerid':_0x3dc4a0[_0x3cf1('0x6b')][_0x3cf1('0x6d')]};}if(_0x3dc4a0['Interval']){_0x1fc7e7[_0x3cf1('0x3f')]={'id':_0x3dc4a0[_0x3cf1('0x3f')]['id'],'name':_0x3dc4a0[_0x3cf1('0x3f')][_0x3cf1('0x3e')]};}var _0x3ca6d3=md5(JSON[_0x3cf1('0x6e')](_0x1fc7e7));if(_0x3dc4a0[_0x3cf1('0x2')]!==_0x3ca6d3){_0x3dc4a0[_0x3cf1('0x2')]=_0x3ca6d3;emit(util['format'](_0x3cf1('0x6f'),_0x1fc7e7[_0x3cf1('0x3e')]),_0x3cf1('0x70'),_0x1fc7e7);}}}function emitCampaignSummary(_0x2517d6){if(_0x2517d6[_0x3cf1('0x46')]===_0x3cf1('0x71')){emit(util[_0x3cf1('0x72')](_0x3cf1('0x73'),_0x2517d6[_0x3cf1('0x3e')]),_0x3cf1('0x74'),_0x2517d6);}}function checkGetDataPredictive(_0x13a7c2){if(isNotNull(_0x13a7c2)){if(!_[_0x3cf1('0x75')](_0x13a7c2)){if(_0x13a7c2[_0x3cf1('0x69')]>0x0){if(!_[_0x3cf1('0x3a')](_0x13a7c2[_0x3cf1('0x64')])&&_0x13a7c2[_0x3cf1('0x64')]>0x0){return!![];}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x77'),JSON[_0x3cf1('0x6e')](_0x13a7c2));}if(!_[_0x3cf1('0x3a')](_0x13a7c2[_0x3cf1('0x78')])&&_0x13a7c2[_0x3cf1('0x78')]>0x0){return!![];}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x79'),JSON['stringify'](_0x13a7c2));}}else{loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x7a'),JSON[_0x3cf1('0x6e')](_0x13a7c2));}}else{loggerPredictive[_0x3cf1('0x76')]('[checkGetDataPredictive][objIsEmpty]',JSON['stringify'](_0x13a7c2));}}else{loggerPredictive['info'](_0x3cf1('0x7b'),JSON['stringify'](_0x13a7c2));}return![];}function mergeDataErlangB(_0x22342b){return function(_0xd45aa0){loggerPredictive[_0x3cf1('0x76')]('[ErlangB]',JSON['stringify'](_0xd45aa0));_[_0x3cf1('0x7c')](_0x22342b,_0xd45aa0);};}function getDiff(_0x2fa3cb){var _0x30aa22=moment()[_0x3cf1('0x42')](0x0);var _0xbe6787=moment(_0x2fa3cb)[_0x3cf1('0x42')](0x0);return _0x30aa22[_0x3cf1('0x43')](_0xbe6787,'seconds');}function ifInterval(_0x1be747,_0x5332e0){if(_['isUndefined'](_0x5332e0)){return![];}if(getDiff(_0x5332e0)<_0x1be747*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x1f4516){if(isNotNull(_0x1f4516)){if(!_[_0x3cf1('0x3a')](_0x1f4516[_0x3cf1('0x26')])){_0x1f4516[_0x3cf1('0x26')]=undefined;loggerPredictive['info'](_0x3cf1('0x7d'),'startProgressive',_0x1f4516[_0x3cf1('0x3e')]);}if(!_[_0x3cf1('0x3a')](_0x1f4516['startPredictive'])){_0x1f4516[_0x3cf1('0x25')]=undefined;loggerPredictive[_0x3cf1('0x76')]('[freeVariablesPredictive]',_0x3cf1('0x25'),_0x1f4516[_0x3cf1('0x3e')]);}if(!_[_0x3cf1('0x3a')](_0x1f4516[_0x3cf1('0x7e')])){clearInterval(_0x1f4516[_0x3cf1('0x7e')]);_0x1f4516[_0x3cf1('0x7e')]=undefined;loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x7d'),_0x3cf1('0x7e'),_0x1f4516[_0x3cf1('0x3e')]);}}}function erlangb(_0x1379b8,_0x2353f8){if(_0x2353f8===0x0){return 0x0;}var _0x57c9d6=0x1;for(var _0x5834a5=0x1;_0x5834a5<=_0x2353f8;_0x5834a5+=0x1){_0x57c9d6=0x1+_0x57c9d6*_0x5834a5/_0x1379b8;}return 0x1/_0x57c9d6;}function isVoiceQueueOutbound(_0x9d4c6b){return _0x9d4c6b===_0x3cf1('0x47');}function isNotPreview(_0x44faf6){return _0x44faf6!=='preview';}function isCampaignIvr(_0x529bf9){return _0x529bf9===_0x3cf1('0x71');}function getCallerId(_0x544492,_0x4c2a6a,_0x11642c){if(!_['isUndefined'](_0x11642c)&&_0x3cf1('0x7f')===typeof _0x11642c&&!_[_0x3cf1('0x75')](_0x11642c)){if(!_[_0x3cf1('0x3a')](_0x4c2a6a)&&_0x3cf1('0x7f')===typeof _0x4c2a6a&&!_[_0x3cf1('0x75')](_0x4c2a6a)){return util['format']('\x22%s\x22\x20<%s>',_0x4c2a6a,_0x11642c);}return util['format'](_0x3cf1('0x80'),_0x11642c,_0x11642c);}if(!_[_0x3cf1('0x3a')](_0x544492)&&_0x3cf1('0x7f')===typeof _0x544492&&!_[_0x3cf1('0x75')](_0x544492)){return _0x544492;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x4c8568,_0x38ead5){return function(_0xd4f4be){freeVariablesPredictive(_0x38ead5);emitVoiceQueueSummary(_0x38ead5);emitCampaignSummary(_0x38ead5);loggerSyncQueueSummary[_0x3cf1('0x81')](_0x4c8568,util[_0x3cf1('0x82')](_0xd4f4be,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x328dcf,_0x2b9fd){return function(_0x33d1f8){loggerPredictive[_0x3cf1('0x81')](_0x328dcf,JSON['stringify'](_0x33d1f8));freeVariablesPredictive(_0x2b9fd);};}function loggerCatch(_0x4ac677){return function(_0x152cdd){logger[_0x3cf1('0x81')](_0x4ac677,util['inspect'](_0x152cdd,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2f3deb){return _0x2f3deb&&!_['isUndefined'](_0x2f3deb)&&_0x2f3deb[_0x3cf1('0x83')]>0x0;}function decremetOriginate(_0x46fe50){if(!_['isUndefined'](_0x46fe50)&&_0x46fe50!==null){if(_0x46fe50[_0x3cf1('0x84')](_0x3cf1('0x6a'))){if(_0x46fe50[_0x3cf1('0x6a')]>0x0){_0x46fe50[_0x3cf1('0x6a')]-=0x1;}else{logger['error'](_0x3cf1('0x85'));}}}else{logger['error'](_0x3cf1('0x86'));}}function checkContactLowerLimitOriginate(_0x5041ea,_0x229905,_0x57bf3b){if(_0x229905>_0x57bf3b){for(var _0x3efdfe=0x0;_0x3efdfe<_0x229905-_0x57bf3b;_0x3efdfe+=0x1){decremetOriginate(_0x5041ea);}}}function loggerGetContactDialer(_0x247d76,_0x39a0fa,_0x3cd44b){return function(_0xe753ac){checkContactLowerLimitOriginate(_0x39a0fa,_0x3cd44b,0x0);logger[_0x3cf1('0x81')](_0x247d76,util[_0x3cf1('0x82')](_0xe753ac,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x41dd50){return function(_0x32d63f){if(isNotNull(_0x32d63f)&&isNotNull(_0x32d63f[0x0])){if(_0x32d63f[0x0][_0x3cf1('0x87')]>0x0){_0x41dd50['message']='RESCHEDULED_CONTACTS';logger[_0x3cf1('0x76')]('[getContactDialer2][ReScheduled]'+_0x41dd50[_0x3cf1('0x3e')],_0x32d63f[0x0][_0x3cf1('0x87')],_0x3cf1('0x88'));}else{_0x41dd50[_0x3cf1('0x3b')]=_0x3cf1('0x89');logger[_0x3cf1('0x76')]('[getContactDialer2][Empty]'+_0x41dd50[_0x3cf1('0x3e')]);}}};}function notSendMessagesQueue(_0x36e7e9){if(_0x36e7e9['sendMessageOneNotActive']){freeVariablesPredictive(_0x36e7e9);if(_0x36e7e9['originated']===0x0&&_0x36e7e9[_0x3cf1('0x50')]===0x0&&_0x36e7e9['waiting']===0x0&&(_0x36e7e9['pTalking']||0x0)===0x0){_0x36e7e9['sendMessageOneNotActive']=![];_0x36e7e9[_0x3cf1('0x4a')]=0x0;_0x36e7e9[_0x3cf1('0x3b')]=_0x3cf1('0x3d');loggerSyncQueueSummary[_0x3cf1('0x81')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x36e7e9['name'],_0x3cf1('0x8a'));}else{_0x36e7e9[_0x3cf1('0x3b')]=_0x3cf1('0x8b');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8c'),_0x36e7e9[_0x3cf1('0x3e')],_0x3cf1('0x8d'));}emitVoiceQueueSummary(_0x36e7e9);}}function notSendMessagesCampaign(_0x267f21){if(_0x267f21[_0x3cf1('0x8e')]){if(_0x267f21[_0x3cf1('0x6a')]===0x0){_0x267f21[_0x3cf1('0x8e')]=![];_0x267f21[_0x3cf1('0x3b')]=_0x3cf1('0x3d');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8f'),_0x267f21[_0x3cf1('0x3e')],_0x3cf1('0x8a'));}else{_0x267f21['message']=_0x3cf1('0x8b');loggerSyncQueueSummary[_0x3cf1('0x81')](_0x3cf1('0x8f'),_0x267f21[_0x3cf1('0x3e')],_0x3cf1('0x8d'));}emitCampaignSummary(_0x267f21);}}function createObjHistory(_0x59707c,_0x8a11a3,_0x2f55ac,_0x3bec63,_0x273013){_0x59707c[_0x3cf1('0x3b')]=_0x2f55ac;var _0x44529e=new Action(_0x59707c,_0x8a11a3);var _0x1afba0=new History(_0x44529e);_0x1afba0[_0x3cf1('0x90')]=_0x3bec63;_0x1afba0[_0x3cf1('0x91')]=_0x273013;_0x1afba0[_0x3cf1('0x92')]=_0x44529e[_0x3cf1('0x93')];return _0x1afba0;}Dialer['prototype']['loopClearZombieChannels']=function(){var _0x51c603=this;setInterval(function(){_0x51c603[_0x3cf1('0x94')](_0x51c603[_0x3cf1('0x23')],_0x3cf1('0x95'));_0x51c603['clearZombieChannels'](_0x51c603[_0x3cf1('0x22')],'[actions]');},0x32c8);};Dialer[_0x3cf1('0x18')][_0x3cf1('0x94')]=function(_0x2d7680,_0x576277){var _0x5e5966=this;for(var _0x35510a in _0x2d7680){if(_0x2d7680[_0x3cf1('0x84')](_0x35510a)){this[_0x3cf1('0x96')]['enqueue'](function(){if(!_[_0x3cf1('0x97')](_0x2d7680[_0x35510a])){return ami[_0x3cf1('0x98')]({'action':_0x3cf1('0x99'),'channel':_0x2d7680[_0x35510a][_0x3cf1('0x9a')]})[_0x3cf1('0x9b')](function(_0x5c4895){if(_0x5c4895[_0x3cf1('0x3b')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2d7680[_0x35510a]&&_0x2d7680[_0x35510a][_0x3cf1('0x46')]!=='ivr'){_0x5e5966[_0x3cf1('0x9c')](_0x5e5966[_0x3cf1('0x1c')][_0x2d7680[_0x35510a][_0x3cf1('0x9d')]]);logger[_0x3cf1('0x81')]('[Dialer][checkChannel]',_0x576277,_0x35510a,_0x2d7680[_0x35510a][_0x3cf1('0x9d')]);delete _0x2d7680[_0x35510a];}if(_0x2d7680[_0x35510a]&&_0x2d7680[_0x35510a]['type']===_0x3cf1('0x71')){_0x5e5966['updateOriginated'](_0x5e5966[_0x3cf1('0x1d')][_0x2d7680[_0x35510a][_0x3cf1('0x9d')]]);logger['error']('[Dialer][checkChannel][ivr]',_0x576277,_0x35510a,_0x2d7680[_0x35510a][_0x3cf1('0x9d')]);delete _0x2d7680[_0x35510a];}},0x2328);}});}});}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x9e')]=function(_0xc5d5ce){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0x9e')](_0xc5d5ce))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa1')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa2')]=function(_0x3be0f1){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopperBlack[_0x3cf1('0xa2')](_0x3be0f1))[_0x3cf1('0x9b')](loggerCatch('[checkIsBlackList]\x20'));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5aacf2){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopperBlack[_0x3cf1('0xa3')](_0x5aacf2))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa4')));};Dialer[_0x3cf1('0x18')]['averageHandleTime']=function(_0x58023b){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopperHistory[_0x3cf1('0xa5')](_0x58023b))['catch'](loggerCatch(_0x3cf1('0xa6')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa7')]=function(_0x2ff80d){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper['rescheduleContact'](_0x2ff80d))[_0x3cf1('0x9b')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xa8')]=function(_0x58be46,_0x3cd2db,_0x2561d2,_0x4191ce){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0xa8')](_0x58be46,_0x3cd2db,_0x2561d2,_0x4191ce))['catch'](loggerCatch(_0x3cf1('0xa9')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xaa')]=function(_0x46270a,_0x5c0cfb,_0xa65160){return BPromise[_0x3cf1('0x9f')]()['then'](cmHopper[_0x3cf1('0xaa')](_0x46270a,_0x5c0cfb,_0xa65160))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa9')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xab')]=function(_0x4aecbd){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](voiceQueueRt[_0x3cf1('0xab')](_0x4aecbd))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xac')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xad')]=function(_0x2308c2){return BPromise['resolve']()[_0x3cf1('0xa0')](cmHopper[_0x3cf1('0xad')](_0x2308c2))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xae')));};Dialer['prototype'][_0x3cf1('0xaf')]=function(_0x56cd55){return BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](cmHopperHistory[_0x3cf1('0xaf')](_0x56cd55))['catch'](loggerCatch(_0x3cf1('0xb0')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0x9c')]=function(_0x36482e){if(!_['isUndefined'](_0x36482e)&&_0x36482e!==null){if(_0x36482e[_0x3cf1('0x84')]('originated')){if(_0x36482e[_0x3cf1('0x6a')]>0x0){_0x36482e[_0x3cf1('0x6a')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x3cf1('0x81')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x3cf1('0x18')]['loggerHandler']=function(_0x43d461,_0x305402){var _0x54c729=this;return function(_0x5e67d9){_0x54c729['updateOriginated'](_0x305402);logger['error'](_0x43d461,util[_0x3cf1('0x82')](_0x5e67d9,{'showHidden':![],'depth':null}));};};Dialer[_0x3cf1('0x18')][_0x3cf1('0xb1')]=function(_0x534980,_0x4ab440,_0x16562d){var _0x1d0023={'state':0x19,'statedesc':_0x3cf1('0xb2')};this[_0x3cf1('0x9c')](_0x4ab440);this[_0x3cf1('0xb3')](_[_0x3cf1('0x7c')](_0x1d0023,_[_0x3cf1('0xb4')](_0x16562d,[_0x3cf1('0xb5'),_0x3cf1('0xb6'),_0x3cf1('0xb7'),_0x3cf1('0xb8'),'CampaignId'])),_0x3cf1('0xb9'),_0x3cf1('0xba'));logger[_0x3cf1('0x81')](_0x534980);};Dialer[_0x3cf1('0x18')]['isSuccess']=function(_0x3ed853){return _0x3ed853===_0x3cf1('0xbb');};Dialer[_0x3cf1('0x18')]['isTrunkReachable']=function(_0x22b7cb){return!_[_0x3cf1('0x3a')](_0x22b7cb)&&_0x22b7cb&&!_['isUndefined'](_0x22b7cb[_0x3cf1('0x3e')])&&!_['isUndefined'](_0x22b7cb['active'])&&_0x22b7cb[_0x3cf1('0x6c')]&&(this[_0x3cf1('0x1f')][util['format'](_0x3cf1('0xbc'),_0x22b7cb[_0x3cf1('0x3e')])][_0x3cf1('0x99')]===_0x3cf1('0xbd')||this[_0x3cf1('0x1f')][util[_0x3cf1('0x72')]('SIP/%s',_0x22b7cb[_0x3cf1('0x3e')])][_0x3cf1('0x99')]===_0x3cf1('0xbe'));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xb3')]=function(_0x4a3cb8,_0x2af135,_0x33fdc7){this[_0x3cf1('0xaf')](_0x4a3cb8)[_0x3cf1('0x9b')](loggerCatch(_0x2af135));this[_0x3cf1('0xad')](_0x4a3cb8)[_0x3cf1('0x9b')](loggerCatch(_0x33fdc7));};Dialer[_0x3cf1('0x18')][_0x3cf1('0x35')]=function(_0x538533){var _0xb57e36=this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];var _0x160fa8;if(!_[_0x3cf1('0x97')](_0x538533)&&!_[_0x3cf1('0x97')](_0x538533[_0x3cf1('0xc0')])&&!_[_0x3cf1('0x97')](_0x538533[_0x3cf1('0xc0')][_0x3cf1('0xc1')])&&_0x538533[_0x3cf1('0xc2')]===_0x3cf1('0xc3')&&_0xb57e36){if(_0xb57e36['type']!==_0x3cf1('0x71')&&this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533[_0x3cf1('0xc5')]===_0x3cf1('0xc6')){delete this['uniqueId'][_0x538533[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]]['outboundAnswerCallsDay']+=0x1;this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]]['outboundAnswerAgiCallsDay']+=0x1;_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x12;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xc7');_0x160fa8[_0x3cf1('0xc8')]='AMD';this[_0x3cf1('0xb3')](_0x160fa8,'[syncHangupInAMD][createHistory]',_0x3cf1('0xc9'));}if(_0xb57e36[_0x3cf1('0x46')]!=='ivr'&&this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533[_0x3cf1('0xc5')]===_0x3cf1('0xca')){delete this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];this['updateOriginated'](this['voiceQueues'][_0xb57e36['queue']]);this['voiceQueues'][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0x5a')]+=0x1;this[_0x3cf1('0x1c')][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0x59')]+=0x1;_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x13;_0x160fa8['statedesc']=_0x3cf1('0xcb');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');_0x160fa8[_0x3cf1('0xcd')]=!![];this[_0x3cf1('0xb3')](_0x160fa8,_0x3cf1('0xce'),_0x3cf1('0xcf'));}if(_0xb57e36[_0x3cf1('0x46')]===_0x3cf1('0x71')&&this[_0x3cf1('0x1d')][_0xb57e36['queue']]['dialAMDActive']&&_0x538533['value']==='HANGUP'){delete this[_0x3cf1('0x23')][_0x538533['uniqueid']];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0xb57e36['queue']]);_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8[_0x3cf1('0x90')]=0x12;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xc7');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');this['saveInDb'](_0x160fa8,_0x3cf1('0xd0'),_0x3cf1('0xd1'));}if(_0xb57e36[_0x3cf1('0x46')]==='ivr'&&this[_0x3cf1('0x1d')][_0xb57e36[_0x3cf1('0x9d')]][_0x3cf1('0xc4')]&&_0x538533['value']===_0x3cf1('0xca')){delete this[_0x3cf1('0x23')][_0x538533[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0xb57e36['queue']]);_0x160fa8=new Hangup(_0xb57e36,_0x538533);_0x160fa8['state']=0x13;_0x160fa8[_0x3cf1('0x91')]=_0x3cf1('0xcb');_0x160fa8[_0x3cf1('0xc8')]=_0x3cf1('0xcc');_0x160fa8[_0x3cf1('0xcd')]=!![];this['saveInDb'](_0x160fa8,'[syncMachineIvr][createHistory]',_0x3cf1('0xd2'));}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x31')]=function(_0x485984){var _0x4e03b6=this['uniqueId'][_0x485984[_0x3cf1('0xbf')]];var _0x38db97=this;var _0x3f3730;if(_0x4e03b6&&_0x4e03b6['type']===_0x3cf1('0x71')){delete this['uniqueId'][_0x485984[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1d')][_0x4e03b6[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1d')][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0xd3')]+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);this['createHistory'](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x3cf1('0xad')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd4')));}if(_0x4e03b6&&_0x4e03b6[_0x3cf1('0x46')]!==_0x3cf1('0x71')&&isNotNull(this['voiceQueues'][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0xd5')])){delete this[_0x3cf1('0x23')][_0x485984['uniqueid']];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]);this['voiceQueues'][_0x4e03b6[_0x3cf1('0x9d')]][_0x3cf1('0x5a')]+=0x1;this[_0x3cf1('0x1c')][_0x4e03b6['queue']][_0x3cf1('0x59')]+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);_0x3f3730[_0x3cf1('0x90')]=0x10;_0x3f3730[_0x3cf1('0x91')]='AnswerAGI';_0x3f3730[_0x3cf1('0xc8')]=_0x3cf1('0xd6');this[_0x3cf1('0xaf')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd7')));this[_0x3cf1('0xad')](_0x3f3730)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x4e03b6&&_0x4e03b6[_0x3cf1('0x46')]!=='ivr'&&!isNotNull(this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]['dialQueueProject'])){delete this[_0x3cf1('0x23')][_0x485984[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]);this[_0x3cf1('0x1c')][_0x4e03b6[_0x3cf1('0x9d')]]['outboundUnknownCallsDay']+=0x1;_0x3f3730=new Hangup(_0x4e03b6,_0x485984);_0x3f3730[_0x3cf1('0x90')]=0xc;_0x3f3730[_0x3cf1('0x91')]=_0x485984['cause-txt'];_0x3f3730['membername']='Unknow';this[_0x3cf1('0xaf')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd7')));this[_0x3cf1('0xad')](_0x3f3730)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xd4')));}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x2e')]=function(_0x53d2e6){var _0x12059e=this[_0x3cf1('0x23')][_0x53d2e6[_0x3cf1('0xbf')]];var _0x5d3f01=this;if(this[_0x3cf1('0x1c')][_0x53d2e6[_0x3cf1('0x9d')]]){if(_0x12059e&&_0x12059e[_0x3cf1('0x46')]!==_0x3cf1('0x71')){delete this[_0x3cf1('0x23')][_0x53d2e6[_0x3cf1('0xbf')]];this[_0x3cf1('0x1c')][_0x53d2e6['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3007b7=new AgentComplete(_0x12059e,_0x53d2e6);if(_0x53d2e6[_0x3cf1('0xd8')]===_0x3cf1('0xd9')){_0x3007b7[_0x3cf1('0xda')]=this[_0x3cf1('0x1c')][_0x53d2e6['queue']][_0x3cf1('0xdb')]&&this['voiceQueues'][_0x53d2e6[_0x3cf1('0x9d')]][_0x3cf1('0xdc')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x3cf1('0xaf')](_0x3007b7)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xdd')));this[_0x3cf1('0xad')](_0x3007b7)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0x3cf1('0x29')]=function(_0x1db888){if(this[_0x3cf1('0x1c')][_0x1db888['queue']]){if(this[_0x3cf1('0x23')][_0x1db888[_0x3cf1('0xbf')]]&&this['uniqueId'][_0x1db888[_0x3cf1('0xbf')]][_0x3cf1('0x46')]!=='ivr'){this[_0x3cf1('0x9c')](this[_0x3cf1('0x1c')][_0x1db888[_0x3cf1('0x9d')]]);this[_0x3cf1('0x23')][_0x1db888['uniqueid']][_0x3cf1('0xde')]=moment()[_0x3cf1('0x72')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x3cf1('0x18')][_0x3cf1('0xdf')]=function(_0x49e651){this['createHistory'](_0x49e651)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xdd')));this[_0x3cf1('0xad')](_0x49e651)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xe0')));};Dialer[_0x3cf1('0x18')][_0x3cf1('0xe1')]=function(_0x40c11e){var _0x54ae9e=this[_0x3cf1('0x23')][_0x40c11e[_0x3cf1('0xbf')]];var _0x5123de=this;if(this[_0x3cf1('0x1c')][_0x40c11e['queue']]){if(_0x54ae9e&&_0x54ae9e[_0x3cf1('0x46')]!==_0x3cf1('0x71')){delete this[_0x3cf1('0x23')][_0x40c11e[_0x3cf1('0xbf')]];this[_0x3cf1('0x9c')](this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]]);_0x54ae9e[_0x3cf1('0xe2')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));var _0x16cd96=new QueueCallerAbandon(_0x54ae9e,_0x40c11e);if(getSeconds(_0x54ae9e[_0x3cf1('0xe2')],_0x54ae9e[_0x3cf1('0xe4')])>=_0x54ae9e['dialQueueTimeout']){this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0xe5')]+=0x1;_0x16cd96[_0x3cf1('0x90')]=0xa;_0x16cd96[_0x3cf1('0x91')]=_0x3cf1('0xe6');_0x16cd96[_0x3cf1('0xe7')]=_0x3cf1('0xe8');_0x16cd96[_0x3cf1('0xda')]=this['voiceQueues'][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0xdb')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;this[_0x3cf1('0xdf')](_0x16cd96);}else{this[_0x3cf1('0x1c')][_0x40c11e[_0x3cf1('0x9d')]][_0x3cf1('0x65')]+=0x1;this[_0x3cf1('0x1c')][_0x40c11e['queue']]['outboundDropCallsDayCallersExit']+=0x1;_0x16cd96[_0x3cf1('0x90')]=0xb;_0x16cd96['statedesc']=_0x3cf1('0xe9');_0x16cd96[_0x3cf1('0xe7')]=_0x3cf1('0xea');this[_0x3cf1('0xdf')](_0x16cd96);}}}};Dialer['prototype'][_0x3cf1('0x33')]=function(_0x2ffd95){if(this[_0x3cf1('0x22')][_0x2ffd95[_0x3cf1('0xbf')]]){this[_0x3cf1('0x22')][_0x2ffd95['uniqueid']][_0x3cf1('0x9a')]=_0x2ffd95[_0x3cf1('0x9a')];}if(this[_0x3cf1('0x23')][_0x2ffd95['uniqueid']]){this[_0x3cf1('0x23')][_0x2ffd95[_0x3cf1('0xbf')]][_0x3cf1('0x9a')]=_0x2ffd95[_0x3cf1('0x9a')];}};Dialer[_0x3cf1('0x18')]['syncQueueMember']=function(_0x3ab567){if(strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0x48')]]===_0x3cf1('0xec')){if(this[_0x3cf1('0x22')][_0x3ab567['actionid']]&&_[_0x3cf1('0x97')](this[_0x3cf1('0x22')][_0x3ab567['actionid']][_0x3cf1('0xed')])&&_0x3ab567[_0x3cf1('0x99')]==='1'&&_0x3ab567[_0x3cf1('0xee')]==='0'){if(this[_0x3cf1('0x1e')][_0x3ab567[_0x3cf1('0xef')]]){if(!this['agents'][_0x3ab567[_0x3cf1('0xef')]][_0x3cf1('0xed')]){this['agents'][_0x3ab567[_0x3cf1('0xef')]][_0x3cf1('0xed')]=!![];this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xed')]=!![];this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xef')]=_0x3ab567['stateinterface'];}}}}else if((strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]]['queue']][_0x3cf1('0x48')]]||_0x3cf1('0x17'))===_0x3cf1('0x17')){if(this['actions'][_0x3ab567[_0x3cf1('0xeb')]]){if(this[_0x3cf1('0x1e')][_0x3ab567[_0x3cf1('0xef')]]){this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0xef')]=_0x3ab567['stateinterface'];if(_['isNil'](this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567['actionid']][_0x3cf1('0x9d')]])){this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]=[];}this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0xf0')](_['merge'](_['pick'](this[_0x3cf1('0x22')][_0x3ab567[_0x3cf1('0xeb')]],['idHopper',_0x3cf1('0xef')]),{'status':_0x3ab567['status'],'paused':_0x3ab567[_0x3cf1('0xee')]}));}}}};function unlockQueueStatus(_0xf55e29,_0x1e0b3f){setTimeout(function(){if(_['isUndefined'](_0xf55e29['queueStatusComplete'])){loggerBooked[_0x3cf1('0x81')](_0x3cf1('0xf1'),_0x1e0b3f);}_0xf55e29['queueStatusComplete']=!![];loggerBooked[_0x3cf1('0x76')](_0x3cf1('0xf2'),_0x1e0b3f,JSON[_0x3cf1('0x6e')](_[_0x3cf1('0xb4')](_0xf55e29,[_0x3cf1('0x3e'),_0x3cf1('0xf3')])));},0x1f3);}Dialer[_0x3cf1('0x18')]['syncQueueStatusComplete']=function(_0xd3b964){var _0x3138f2=this;var _0x40ed93=_0x3138f2[_0x3cf1('0x1c')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]];if(strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]][_0x3cf1('0x48')]]===_0x3cf1('0xec')){if(this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]]&&this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')]){this[_0x3cf1('0xf4')][_0x3cf1('0xf5')](this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xf6')],this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')])[_0x3cf1('0x9b')](function(_0x41e8da){logger[_0x3cf1('0x81')](_0x3cf1('0xf7'),util['inspect'](_0x41e8da,{'showHidden':![],'depth':null}));})[_0x3cf1('0x1b')](function(){_0x3138f2[_0x3cf1('0x9c')](_0x3138f2[_0x3cf1('0x1c')][_0x3138f2['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]);_0x3138f2[_0x3cf1('0x1e')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xef')]][_0x3cf1('0xed')]=![];delete _0x3138f2[_0x3cf1('0x22')][_0xd3b964['actionid']];unlockQueueStatus(_0x40ed93);});}else{this[_0x3cf1('0x9c')](this['voiceQueues'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]);this[_0x3cf1('0xa7')]({'active':![],'ContactId':this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb5')],'ListId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb6')],'VoiceQueueId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xb8')]||undefined,'CampaignId':this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0xf8')]||undefined})['catch'](loggerCatch(_0x3cf1('0xf9')));delete this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]];unlockQueueStatus(_0x40ed93);}}else if((strategy[this[_0x3cf1('0x1c')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]['strategy']]||_0x3cf1('0x17'))===_0x3cf1('0x17')){var _0x13462c;if(this['actions'][_0xd3b964['actionid']]&&!_[_0x3cf1('0x75')](this[_0x3cf1('0x28')][this['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]])){if(this[_0x3cf1('0xfa')][_0x3138f2[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]){this[_0x3cf1('0xfa')][_0x3138f2['actions'][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]=this[_0x3cf1('0xfa')][this[_0x3cf1('0x22')][_0xd3b964['actionid']]['queue']]?this['queueBookedRR'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]:this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]]?this[_0x3cf1('0x28')][this[_0x3cf1('0x22')][_0xd3b964['actionid']][_0x3cf1('0x9d')]][_0x3cf1('0xfb')]||0x0:0x0;}this['queueBooked'][this[_0x3cf1('0x22')][_0xd3b964['actionid']]['queue']][_0x3cf1('0xfb')]=this['queueBookedRR'][this[_0x3cf1('0x22')][_0xd3b964[_0x3cf1('0xeb')]][_0x3cf1('0x9d')]];for(var _0xed250a=0x0;_0xed250a=0x0?!![]:![];})[_0x3cf1('0x9b')](myreject(_0x474979)));}}else{_0x234754[_0x3cf1('0xf0')](ami[_0x3cf1('0x98')]({'action':'command','command':util[_0x3cf1('0x72')](_0x3cf1('0x115'),_0x1c5530,!_[_0x3cf1('0x3a')](config[_0x3cf1('0x112')][_0x53f3d7])?_0x53f3d7:'')})[_0x3cf1('0xa0')](function(_0x52c942){return _0x52c942['content']['indexOf'](_0x3cf1('0x116'))>=0x0?!![]:![];})[_0x3cf1('0x9b')](myreject(_0x474979)));}BPromise[_0x3cf1('0x117')](_0x234754)[_0x3cf1('0xa0')](function(_0x5a06d1){var _0x1c6908=_[_0x3cf1('0x118')](_0x5a06d1);if(_0x1c6908){return _0x607b71(_0x1c6908);}else{_0xcd671b['message']=_0x578081?_0x3cf1('0x119'):'INTERVAL_IS_OVERTIME';return _0x474979(msgResponse(_0x3cf1('0x11a'),_0x3cf1('0x10c'),'Global:\x20'+_0x578081+'\x20'+_0x179e90+'\x20Interval\x20is\x20overtime:\x20'+util[_0x3cf1('0x82')](_0x1c5530,{'showHidden':![],'depth':null})+_0x3cf1('0x11b')+_0x53f3d7));}})[_0x3cf1('0x9b')](function(_0x48535e){return _0x474979(msgResponse(_0x3cf1('0x109'),_0x3cf1('0x10c'),JSON['stringify'](_0x48535e)));});});};Dialer[_0x3cf1('0x18')][_0x3cf1('0x11c')]=function(_0xa0befa){var _0x5d7e1e=this;return function(){switch(_0xa0befa['dialMethod']){case'progressive':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,0x1);break;case'power':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,_0xa0befa[_0x3cf1('0x11e')]);break;case _0x3cf1('0x5'):_0x5d7e1e[_0x3cf1('0x5')](_0xa0befa);break;case'booked':freeVariablesPredictive(_0xa0befa);_0x5d7e1e[_0x3cf1('0x11d')](_0xa0befa,0x1);break;default:freeVariablesPredictive(_0xa0befa);logger['error'](_0x3cf1('0x11f'),_0xa0befa[_0x3cf1('0x3e')],'method\x20not\x20recognized');}};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x120')]=function(_0x7dfca3){var _0x313220=this;return function(){_0x313220[_0x3cf1('0x121')](_0x7dfca3);};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x7')]=function(_0x44d387){var _0x3c2692=this;if(isNotPreview(_0x44d387[_0x3cf1('0x55')])){if(isVoiceQueueOutbound(_0x44d387[_0x3cf1('0x46')])&&isActive(_0x44d387[_0x3cf1('0x54')])){_0x44d387['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0x3cf1('0xa0')](checkIsLoggedIn(_0x44d387,_0x44d387['loggedIn']))[_0x3cf1('0xa0')](checkIsActive(_0x44d387,_0x44d387[_0x3cf1('0x54')]))[_0x3cf1('0xa0')](checkInterval(_0x44d387))[_0x3cf1('0xa0')](_0x3c2692['checkIsTrunkReachable'](_0x44d387))[_0x3cf1('0xa0')](_0x3c2692[_0x3cf1('0x108')](_0x44d387[_0x3cf1('0x122')],_0x44d387[_0x3cf1('0x123')],_0x44d387[_0x3cf1('0x3e')],_0x44d387))[_0x3cf1('0xa0')](_0x3c2692[_0x3cf1('0x10a')](_0x44d387['Interval'],_0x44d387[_0x3cf1('0x123')],_0x44d387['name'],_0x44d387))['then'](_0x3c2692[_0x3cf1('0x11c')](_0x44d387))['catch'](loggerCatchQueueSummary(_0x3cf1('0x124'),_0x44d387));}else{notSendMessagesQueue(_0x44d387);}}else{freeVariablesPredictive(_0x44d387);}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x102')]=function(){var _0x1684f7=this;var _0x30484e;for(var _0x5a5d20 in this['campaigns']){if(this['campaigns'][_0x3cf1('0x84')](_0x5a5d20)){_0x30484e=this[_0x3cf1('0x1d')][_0x5a5d20];if(isCampaignIvr(_0x30484e[_0x3cf1('0x46')])&&isActive(_0x30484e[_0x3cf1('0x6c')])){_0x30484e['sendMessageOneNotActive']=!![];BPromise[_0x3cf1('0x9f')]()[_0x3cf1('0xa0')](checkIsActive(_0x30484e,_0x30484e[_0x3cf1('0x6c')]))[_0x3cf1('0xa0')](checkInterval(_0x30484e))[_0x3cf1('0xa0')](_0x1684f7[_0x3cf1('0x103')](_0x30484e))['then'](_0x1684f7[_0x3cf1('0x108')](_0x30484e[_0x3cf1('0x122')],_0x30484e[_0x3cf1('0x123')],_0x30484e[_0x3cf1('0x3e')],_0x30484e))[_0x3cf1('0xa0')](_0x1684f7['checkIfTimeIntervals'](_0x30484e[_0x3cf1('0x3f')],_0x30484e[_0x3cf1('0x123')],_0x30484e['name'],_0x30484e))['then'](_0x1684f7[_0x3cf1('0x120')](_0x30484e))[_0x3cf1('0x9b')](loggerCatchQueueSummary(_0x3cf1('0x125'),_0x30484e));}else{notSendMessagesCampaign(_0x30484e);}}}};function getCallerIdRandom(_0x3283ce,_0x116603){var _0x41e8e8,_0x32fa50,_0xd6e339;if(_0x116603<=0x0){_0x116603=0x1;}_0x41e8e8=new RegExp(_0x3cf1('0x126')+_0x116603+'}$');_0x32fa50=Math[_0x3cf1('0x127')](0xa,_0x116603-0x1);_0xd6e339=Math[_0x3cf1('0x127')](0xa,_0x116603)-0x1;return util[_0x3cf1('0x72')]('%s',_['replace'](_0x3283ce,_0x41e8e8,_[_0x3cf1('0x128')](_0x32fa50,_0xd6e339)));}function extractCalleridName(_0x57b459){var _0x330cb2=_0x57b459[_0x3cf1('0x129')](/"(.*?)"/);return _0x330cb2?_0x330cb2[0x1]:_0x57b459;}function extractCalleridNumber(_0x4a8a7d){var _0x4b512e=_0x4a8a7d[_0x3cf1('0x129')](/<(.*?)>/);return _0x4b512e?_0x4b512e[0x1]:_0x4a8a7d;}Dialer[_0x3cf1('0x18')][_0x3cf1('0x12a')]=function(_0xe86dc3,_0x1e7d8a){var _0x5edf50=this;var _0x438f85=uuid['v4']();this['actions'][_0x438f85]=new Action(_0xe86dc3,_0x1e7d8a,_0x438f85);return new BPromise(function(_0x1f87ee,_0x4cc169){if(_[_0x3cf1('0x3a')](_0xe86dc3)&&_0x3cf1('0x12b')!==typeof _0xe86dc3){return _0x4cc169(msgResponse('originate','Failure',_0x3cf1('0x12c')));}if(_['isUndefined'](_0x1e7d8a[_0x3cf1('0x12d')]['phone'])||_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')]===null){return _0x4cc169(msgResponse(_0x3cf1('0x12f'),'Failure',_0x3cf1('0x130')));}var _0x183da5={'XMD-CALLERID':_0x5edf50['actions'][_0x438f85][_0x3cf1('0x131')](),'XMD-AGI':_0xe86dc3['dialQueueProject']?util['format'](_0x3cf1('0x132'),ipAgi,_0xe86dc3[_0x3cf1('0xd5')]):_0x3cf1('0x133'),'XMD-AGIAFTER':_0xe86dc3[_0x3cf1('0xdb')]?util['format'](_0x3cf1('0x132'),ipAgi,_0xe86dc3[_0x3cf1('0xdb')]):_0x3cf1('0x133'),'XMD-QUEUE':_0xe86dc3['type']===_0x3cf1('0x47')?util[_0x3cf1('0x72')](_0x3cf1('0x134'),_0xe86dc3[_0x3cf1('0x3e')],_0xe86dc3['dialQueueOptions']||'',_0xe86dc3[_0x3cf1('0xdc')]?'c':'',_0xe86dc3['dialQueueTimeout']||0x3):_0x3cf1('0x133'),'XMD-CONTACTID':_0x1e7d8a[_0x3cf1('0xb5')],'XMD-CDRTYPE':_0x3cf1('0x135'),'CALLERID(all)':_0x5edf50[_0x3cf1('0x22')][_0x438f85][_0x3cf1('0x131')](),'XMD-AMD':_0xe86dc3[_0x3cf1('0xc4')]?_0x3cf1('0x136'):_0x3cf1('0x133'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0xe86dc3[_0x3cf1('0xc4')]){_0x183da5[_0x3cf1('0x137')]=_0xe86dc3[_0x3cf1('0x138')]||0x9c4;_0x183da5['XMD-AMDGREETING']=_0xe86dc3[_0x3cf1('0x139')]||0x5dc;_0x183da5[_0x3cf1('0x13a')]=_0xe86dc3[_0x3cf1('0x13b')]||0x320;_0x183da5['XMD-AMDTOTALANALYSISTIME']=_0xe86dc3['dialAMDTotalAnalysisTime']||0x1388;_0x183da5[_0x3cf1('0x13c')]=_0xe86dc3['dialAMDMinWordLength']||0x64;_0x183da5[_0x3cf1('0x13d')]=_0xe86dc3[_0x3cf1('0x13e')]||0x32;_0x183da5['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0xe86dc3[_0x3cf1('0x13f')]||0x3;_0x183da5['XMD-AMDSILENCETHRESHOLD']=_0xe86dc3[_0x3cf1('0x140')]||0x100;_0x183da5[_0x3cf1('0x141')]=_0xe86dc3[_0x3cf1('0x142')]||0x1388;}if(_0xe86dc3[_0x3cf1('0x46')]===_0x3cf1('0x47')){_0x183da5[_0x3cf1('0x143')]=_0x1e7d8a[_0x3cf1('0xb8')];}else{_0x183da5['XMD-CAMPAIGNID']=_0x1e7d8a['CampaignId'];}for(var _0x25dea6 in _0x1e7d8a[_0x3cf1('0x12d')]){if(_0x1e7d8a[_0x3cf1('0x12d')]['hasOwnProperty'](_0x25dea6)){if(isNotNull(_0x1e7d8a[_0x3cf1('0x12d')][_0x25dea6])&&_0x25dea6!=='id'&&_0x25dea6!=='tags'&&_0x25dea6!==_0x3cf1('0x144')&&_0x25dea6!=='updatedAt'){_0x183da5[util['format'](_0x3cf1('0x145'),'XMD-',_['toUpper'](_0x25dea6))]=_0x1e7d8a[_0x3cf1('0x12d')][_0x25dea6];}}}var _0xf4812=_0x5edf50['isTrunkReachable'](_0xe86dc3[_0x3cf1('0x6b')])?getCallerId(_0xe86dc3[_0x3cf1('0x6b')][_0x3cf1('0x6d')],_0xe86dc3[_0x3cf1('0x146')],_0xe86dc3['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xe86dc3[_0x3cf1('0x56')],_0xe86dc3[_0x3cf1('0x147')]):_0xe86dc3['dialOriginateCallerIdNumber']):getCallerId(_[_0x3cf1('0x97')](_0xe86dc3[_0x3cf1('0x105')])?_0xe86dc3[_0x3cf1('0x6b')][_0x3cf1('0x6d')]:_0xe86dc3['TrunkBackup'][_0x3cf1('0x6d')],_0xe86dc3[_0x3cf1('0x146')],_0xe86dc3[_0x3cf1('0x147')]>0x0?getCallerIdRandom(_0xe86dc3['dialOriginateCallerIdNumber'],_0xe86dc3[_0x3cf1('0x147')]):_0xe86dc3[_0x3cf1('0x56')]);if(_0xf4812){_0x183da5[_0x3cf1('0x148')]=_0x5edf50[_0x3cf1('0x22')][_0x438f85][_0x3cf1('0x149')]=extractCalleridName(_0xf4812);_0x183da5['XMD-ORIGINATECALLERIDNUM']=_0x5edf50['actions'][_0x438f85][_0x3cf1('0x14a')]=extractCalleridNumber(_0xf4812);}return ami['Action']({'actionid':_0x438f85,'action':_0x3cf1('0x12f'),'channel':_0x5edf50[_0x3cf1('0x104')](_0xe86dc3[_0x3cf1('0x6b')])?util[_0x3cf1('0x72')](_0x3cf1('0x14b'),_0xe86dc3['Trunk'][_0x3cf1('0x3e')],isNotNull(_0xe86dc3['dialPrefix'])?_0xe86dc3[_0x3cf1('0x58')][_0x3cf1('0x14c')]()||'':'',_0xe86dc3[_0x3cf1('0x14d')]>0x0?_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')][_0x3cf1('0x14e')](_0xe86dc3[_0x3cf1('0x14d')]):_0x1e7d8a[_0x3cf1('0x12d')][_0x3cf1('0x12e')]):util[_0x3cf1('0x72')]('SIP/%s/%s%s',_[_0x3cf1('0x97')](_0xe86dc3['TrunkBackup'])?_0xe86dc3['Trunk'][_0x3cf1('0x3e')]:_0xe86dc3[_0x3cf1('0x105')][_0x3cf1('0x3e')],isNotNull(_0xe86dc3[_0x3cf1('0x58')])?_0xe86dc3[_0x3cf1('0x58')][_0x3cf1('0x14c')]()||'':'',_0xe86dc3[_0x3cf1('0x14d')]>0x0?_0x1e7d8a['Contact'][_0x3cf1('0x12e')]['substring'](_0xe86dc3[_0x3cf1('0x14d')]):_0x1e7d8a['Contact']['phone']),'callerid':_0xf4812,'Exten':_0x3cf1('0xc3'),'Context':_0x3cf1('0x14f'),'Priority':'1','variable':_0x183da5,'timeout':(_0xe86dc3[_0x3cf1('0x57')]||0x1e)*0x3e8,'async':!![],'channelid':_0x438f85})['then'](function(_0x26726d){return _0x1f87ee(_0x26726d);})['catch'](function(_0x1b935a){_0xe86dc3['outboundOriginateFailureCallsDay']+=0x1;var _0x500a4a=new History(_0x5edf50[_0x3cf1('0x22')][_0x438f85]);logger['error'](util['format'](_0x3cf1('0x150'),JSON['stringify'](_0x1b935a)));_0x500a4a[_0x3cf1('0x90')]=0xe;_0x500a4a[_0x3cf1('0x91')]='OriginateError';_0x500a4a[_0x3cf1('0x93')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));_0x500a4a['endtime']=_0x500a4a[_0x3cf1('0x93')];_0x5edf50[_0x3cf1('0xaf')](_0x500a4a)['catch'](loggerCatch('[originate][error]'));_0x5edf50['moveContactManagedDialer'](_0x500a4a)[_0x3cf1('0x9b')](loggerCatch('[originate][error]'))[_0x3cf1('0x1b')](function(){delete _0x5edf50[_0x3cf1('0x22')][_0x438f85];return _0x4cc169(msgResponse('originate','Error',_0x3cf1('0x151')));});});});};Dialer['prototype'][_0x3cf1('0x2b')]=function(_0x3b86ec){var _0x5e1119=this[_0x3cf1('0x22')][_0x3b86ec['actionid']];var _0x51bad1=this;if(_0x5e1119){delete this[_0x3cf1('0x22')][_0x3b86ec[_0x3cf1('0xeb')]];_0x5e1119['responsetime']=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));var _0x585da1=_0x5e1119[_0x3cf1('0x46')]===_0x3cf1('0x71')?this[_0x3cf1('0x1d')][_0x5e1119[_0x3cf1('0x9d')]]:this[_0x3cf1('0x1c')][_0x5e1119[_0x3cf1('0x152')]()];if(!this[_0x3cf1('0x153')](_0x3b86ec[_0x3cf1('0x154')])){this['updateOriginated'](_0x585da1);return this['callProgressDetecting'](_0x5e1119,_0x585da1,_0x3b86ec)[_0x3cf1('0xa0')](function(_0x124a6f){})[_0x3cf1('0x9b')](loggerCatch('[callProgressDetecting]\x20'));}else{this[_0x3cf1('0x23')][_0x3b86ec[_0x3cf1('0xbf')]]=_0x5e1119;}}};Dialer[_0x3cf1('0x18')]['checkRetriveMax']=function(_0x164a47,_0xd8797f,_0x1f0ff4){var _0x550e2f=new History(_0xd8797f);if(_0x550e2f[_0x3cf1('0x155')]+_0x550e2f['countcongestionretry']+_0x550e2f[_0x3cf1('0x156')]>=_0x1f0ff4[_0x3cf1('0x157')]-0x1){return!![];}switch(_0x164a47){case 0x3:if(_0x550e2f[_0x3cf1('0x156')]>=_0x1f0ff4['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countnoanswerretry':_0x550e2f[_0x3cf1('0x156')]+=0x1,'scheduledat':moment()[_0x3cf1('0x158')](_0x1f0ff4[_0x3cf1('0x159')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x550e2f[_0x3cf1('0xb5')],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f['CampaignId']||undefined})['catch'](loggerCatch(_0x3cf1('0x15a')));}break;case 0x5:if(_0x550e2f[_0x3cf1('0x155')]>=_0x1f0ff4[_0x3cf1('0x15b')]-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countbusyretry':_0x550e2f[_0x3cf1('0x155')]+=0x1,'scheduledat':moment()[_0x3cf1('0x158')](_0x1f0ff4['dialBusyRetryFrequency'],_0x3cf1('0x15c'))[_0x3cf1('0x72')](_0x3cf1('0xe3')),'ContactId':_0x550e2f['ContactId'],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f['CampaignId']||undefined})['catch'](loggerCatch(_0x3cf1('0x15d')));}break;case 0x8:if(_0x550e2f['countcongestionretry']>=_0x1f0ff4[_0x3cf1('0x15e')]-0x1){return!![];}else{this[_0x3cf1('0xa7')]({'active':![],'countcongestionretry':_0x550e2f['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x1f0ff4[_0x3cf1('0x15f')],'minutes')[_0x3cf1('0x72')](_0x3cf1('0xe3')),'ContactId':_0x550e2f[_0x3cf1('0xb5')],'ListId':_0x550e2f[_0x3cf1('0xb6')],'VoiceQueueId':_0x550e2f[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x550e2f[_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x160')));}break;default:return!![];}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x161')]=function(_0x1d4d11,_0xdf896,_0x28f5cc){var _0x486aec=this;var _0x28cdb4=new History(_0x1d4d11);return new BPromise(function(_0x545538,_0x1c7d8b){if(_[_0x3cf1('0x3a')](_0xdf896)&&'object'!==typeof _0xdf896){return _0x1c7d8b(msgResponse(_0x3cf1('0x162'),'Failure','entity\x20is\x20undefine'));}if(_[_0x3cf1('0x3a')](_0x28f5cc)&&_0x3cf1('0x12b')!==typeof _0x28f5cc){return _0x1c7d8b(msgResponse('[callProgressDetecting]',_0x3cf1('0x10c'),_0x3cf1('0x163')));}switch(_0x28f5cc[_0x3cf1('0xd8')]){case'0':_0xdf896[_0x3cf1('0x164')]+=0x1;_0x28cdb4[_0x3cf1('0x90')]=0x0;_0x28cdb4[_0x3cf1('0x91')]='NoSuchNumber';_0x486aec['createHistory'](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x165')));if(_0x486aec[_0x3cf1('0x166')](0x0,_0x1d4d11,_0xdf896)){if(_0x28cdb4['countbusyretry']+_0x28cdb4[_0x3cf1('0x167')]+_0x28cdb4[_0x3cf1('0x156')]>=_0xdf896[_0x3cf1('0x157')]){_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x169'));}else{_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x169'));}}break;case'3':_0xdf896['outboundNoAnswerCallsDay']+=0x1;_0x28cdb4[_0x3cf1('0x90')]=0x3;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x16a');_0x28cdb4[_0x3cf1('0x156')]+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x16b')));if(_0x486aec[_0x3cf1('0x166')](0x3,_0x1d4d11,_0xdf896)){if(_0x28cdb4['countnoanswerretry']>=_0xdf896['dialNoAnswerMaxRetry']){_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,'reason\x203\x20ringing\x20no\x20answer');}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x16c'));}}break;case'5':_0xdf896['outboundBusyCallsDay']+=0x1;_0x28cdb4['state']=0x5;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x16d');_0x28cdb4['countbusyretry']+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x16e')));if(_0x486aec[_0x3cf1('0x166')](0x5,_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x155')]>=_0xdf896['dialBusyMaxRetry']){_0x486aec[_0x3cf1('0x16f')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x170'));}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x170'));}}break;case'8':_0xdf896[_0x3cf1('0x5b')]+=0x1;_0x28cdb4['state']=0x8;_0x28cdb4[_0x3cf1('0x91')]=_0x3cf1('0x171');_0x28cdb4[_0x3cf1('0x167')]+=0x1;_0x28cdb4['countglobal']+=0x1;_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x486aec[_0x3cf1('0x166')](0x8,_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x167')]>=_0xdf896[_0x3cf1('0x15e')]){_0x486aec[_0x3cf1('0x16f')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x172'));}else{_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x3cf1('0x172'));}}break;default:_0xdf896['outboundUnknownCallsDay']+=0x1;_0x28cdb4['state']=0xc;_0x28cdb4[_0x3cf1('0x91')]=_0x28f5cc[_0x3cf1('0xd8')];_0x486aec[_0x3cf1('0xaf')](_0x28cdb4)[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x173')));if(_0x486aec[_0x3cf1('0x166')](_0x28f5cc[_0x3cf1('0xd8')],_0x1d4d11,_0xdf896)){if(_0x28cdb4[_0x3cf1('0x155')]+_0x28cdb4['countcongestionretry']+_0x28cdb4[_0x3cf1('0x156')]>=_0xdf896['dialGlobalMaxRetry']){_0x486aec[_0x3cf1('0x168')](_0x28cdb4,_0x545538,_0x1c7d8b,_0x28f5cc[_0x3cf1('0xd8')]);}else{_0x486aec['createStateFinal'](_0x28cdb4,_0x545538,_0x1c7d8b,_0x28f5cc['reason']);}}}});};Dialer['prototype'][_0x3cf1('0x168')]=function(_0x179e18,_0x578901,_0x1237ed,_0x54e57f){var _0x1c2609=new Final(_0x179e18);_0x1c2609['state']=0xf;_0x1c2609[_0x3cf1('0x91')]='Global';this[_0x3cf1('0x16f')](_0x1c2609,_0x578901,_0x1237ed,_0x54e57f);};Dialer['prototype'][_0x3cf1('0x16f')]=function(_0x4552b0,_0x1927d0,_0x8b289c,_0xc4e570){this[_0x3cf1('0xad')](_0x4552b0)[_0x3cf1('0xa0')](function(_0x27f735){return _0x1927d0(msgResponse(_0x3cf1('0x162'),_0x3cf1('0xbb'),_0xc4e570));})[_0x3cf1('0x9b')](function(_0xc59291){return _0x8b289c(msgResponse(_0x3cf1('0x174'),_0x3cf1('0x10c'),'contact\x20not\x20moved'));});};Dialer['prototype'][_0x3cf1('0x5')]=function(_0x1a9e9c){var _0x45368c=this;var _0x3b20af=_0x1a9e9c[_0x3cf1('0x175')]/0x64;var _0x46af43=_0x1a9e9c[_0x3cf1('0x5e')]/(_0x1a9e9c[_0x3cf1('0x5e')]+_0x1a9e9c[_0x3cf1('0x5a')]);var _0x4b6078=_0x1a9e9c[_0x3cf1('0x4b')]-_0x1a9e9c[_0x3cf1('0x68')]-_0x1a9e9c[_0x3cf1('0x52')]-_0x1a9e9c['originated']-_0x1a9e9c[_0x3cf1('0x50')];var _0x3922e0=(_0x1a9e9c[_0x3cf1('0x4b')]-_0x1a9e9c[_0x3cf1('0x68')])*_0x1a9e9c[_0x3cf1('0x66')];var _0xa6af69=Math['floor'](_0x1a9e9c['erlangCalls']*_0x1a9e9c[_0x3cf1('0x176')]*_0x1a9e9c[_0x3cf1('0x177')]*_0x1a9e9c['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x1a9e9c[_0x3cf1('0x26')])){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x178'));if(!_[_0x3cf1('0x3a')](_0x1a9e9c['startPredictive'])){_0x1a9e9c[_0x3cf1('0x25')]=undefined;loggerPredictive[_0x3cf1('0x81')](_0x3cf1('0x179'),_0x3cf1('0x17a'));}if(!_['isUndefined'](_0x1a9e9c[_0x3cf1('0x7e')])){loggerPredictive[_0x3cf1('0x81')](_0x3cf1('0x179'),_0x3cf1('0x17b'));clearInterval(_0x1a9e9c[_0x3cf1('0x7e')]);_0x1a9e9c[_0x3cf1('0x7e')]=undefined;}_0x1a9e9c['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x17c'),_0x1a9e9c[_0x3cf1('0x26')],_0x1a9e9c[_0x3cf1('0x3e')]);this[_0x3cf1('0x11d')](_0x1a9e9c,0x1);}else if(ifInterval(_0x1a9e9c[_0x3cf1('0x17d')],_0x1a9e9c[_0x3cf1('0x26')])){this[_0x3cf1('0x11d')](_0x1a9e9c,0x1);loggerPredictiveCalls[_0x3cf1('0x76')](_0x3cf1('0x17e'),_0x1a9e9c['startProgressive'],_0x1a9e9c[_0x3cf1('0x3e')]);_0x1a9e9c['erlangCalls']=0x0;_0x1a9e9c[_0x3cf1('0xe5')]=0x0;}else if(_0x3b20af<_0x46af43&&_0x1a9e9c[_0x3cf1('0x17f')]===_0x3cf1('0x180')){freeVariablesPredictive(_0x1a9e9c);loggerPredictive[_0x3cf1('0x76')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x3cf1('0x181'),_0x46af43,_0x3cf1('0x26'),_0x1a9e9c[_0x3cf1('0x3e')]);}else if(_0x4b6078>_0x3922e0){freeVariablesPredictive(_0x1a9e9c);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][LowerLimitInterval]',_0x3cf1('0x182'),_0x4b6078,_0x3cf1('0x183'),_0x3922e0);}else if(_0xa6af69<_0x1a9e9c['predictiveIntervalErlangCallsDroppedCalls']&&_0x1a9e9c['dialPredictiveOptimization']===_0x3cf1('0x180')){freeVariablesPredictive(_0x1a9e9c);loggerPredictive[_0x3cf1('0x76')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0xa6af69,'Drop\x20in\x20this\x20interval',_0x1a9e9c[_0x3cf1('0xe5')],'startProgressive',_0x1a9e9c['name']);}else if(!ifInterval(_0x1a9e9c[_0x3cf1('0x17d')],_0x1a9e9c[_0x3cf1('0x26')])&&_[_0x3cf1('0x3a')](_0x1a9e9c[_0x3cf1('0x25')])&&!_[_0x3cf1('0x3a')](_0x1a9e9c[_0x3cf1('0x26')])){_0x1a9e9c[_0x3cf1('0x25')]=moment()[_0x3cf1('0x72')](_0x3cf1('0xe3'));loggerPredictive['info'](_0x3cf1('0x184'),_0x1a9e9c[_0x3cf1('0x25')],_0x1a9e9c[_0x3cf1('0x3e')]);this[_0x3cf1('0x185')](_0x1a9e9c[_0x3cf1('0x17d')])['then'](this['getDataPredictive'](_0x1a9e9c))[_0x3cf1('0xa0')](mergeDataErlangB(_0x1a9e9c))[_0x3cf1('0xa0')](this[_0x3cf1('0x186')](_0x1a9e9c))['catch'](loggerCatchPredictive(_0x3cf1('0x187'),_0x1a9e9c));}else if(!ifInterval(_0x1a9e9c['dialPredictiveInterval'],_0x1a9e9c[_0x3cf1('0x25')])){_0x1a9e9c[_0x3cf1('0xe5')]=0x0;_0x1a9e9c['startPredictive']=moment()['format'](_0x3cf1('0xe3'));loggerPredictive['info']('[startMethodPredictive][StartPredictive][Repeat]',_0x1a9e9c[_0x3cf1('0x25')],_0x1a9e9c[_0x3cf1('0x3e')]);clearInterval(_0x1a9e9c[_0x3cf1('0x7e')]);_0x1a9e9c[_0x3cf1('0x7e')]=undefined;this[_0x3cf1('0x185')](_0x1a9e9c[_0x3cf1('0x17d')])[_0x3cf1('0xa0')](this[_0x3cf1('0x188')](_0x1a9e9c))[_0x3cf1('0xa0')](mergeDataErlangB(_0x1a9e9c))['then'](this[_0x3cf1('0x186')](_0x1a9e9c))[_0x3cf1('0x9b')](loggerCatchPredictive('[averageHandleTime][ErlangB]\x20',_0x1a9e9c));}};Dialer[_0x3cf1('0x18')]['getDataPredictive']=function(_0x31844b){var _0x4ee6c4=this;return function(_0x4da44a){return new BPromise(function(_0x2b84a8,_0x11ec03){_[_0x3cf1('0x7c')](_0x31844b,_0x4da44a[0x0]);if(checkGetDataPredictive(_0x4da44a[0x0])){loggerPredictive[_0x3cf1('0x76')](JSON['stringify'](_0x4da44a[0x0]));if(_0x31844b[_0x3cf1('0x17f')]==='dropRate'){return _0x4ee6c4['getVoiceQueueRtPauses'](_0x31844b['id'])[_0x3cf1('0xa0')](function(_0x57f928){var _0x29d837=_0x31844b['loggedIn']-_0x57f928[0x0][_0x3cf1('0x189')];var _0x25b410=_0x31844b[_0x3cf1('0x17d')]*0x3c;var _0x39a58b=_0x4da44a[0x0][_0x3cf1('0x64')]+_0x4da44a[0x0]['predictiveIntervalAvgHoldtime'];var _0x16bdd4=(_0x4da44a[0x0]['predictiveIntervalAnsweredCalls']+_0x4da44a[0x0][_0x3cf1('0x18a')]+_0x4da44a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4da44a[0x0][_0x3cf1('0x69')];var _0x2a8ee1=_0x31844b[_0x3cf1('0x175')]/0x64;_0x31844b[_0x3cf1('0x68')]=_0x57f928[0x0][_0x3cf1('0x189')]||0x0;_0x31844b['predictiveIntervalHitRate']=_0x16bdd4>0x0?_0x16bdd4:0x1;return _0x4ee6c4[_0x3cf1('0x18b')](_0x29d837,_0x25b410,_0x39a58b,_0x16bdd4,_0x2a8ee1);})[_0x3cf1('0xa0')](function(_0x262d4f){return _0x2b84a8(_0x262d4f);})[_0x3cf1('0x9b')](function(_0x5536af){return _0x11ec03(msgResponse('[CatchErlangB]',_0x3cf1('0x10c'),JSON[_0x3cf1('0x6e')](_0x5536af)));});}if(_0x31844b[_0x3cf1('0x17f')]===_0x3cf1('0x18c')){return _0x4ee6c4[_0x3cf1('0xab')](_0x31844b['id'])[_0x3cf1('0xa0')](function(_0x37c42a){var _0x189179=_0x31844b['loggedIn']-_0x37c42a[0x0][_0x3cf1('0x189')];var _0x1714e8=_0x31844b[_0x3cf1('0x17d')]*0x3c;var _0x369f9d=_0x4da44a[0x0][_0x3cf1('0x64')]+_0x4da44a[0x0][_0x3cf1('0x78')];var _0x59a987=(_0x4da44a[0x0]['predictiveIntervalAnsweredCalls']+_0x4da44a[0x0][_0x3cf1('0x18a')]+_0x4da44a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4da44a[0x0]['predictiveIntervalTotalCalls'];var _0x5a34d9=_0x31844b['dialPredictiveOptimizationPercentage']/0x64;_0x31844b['predictiveIntervalPauses']=_0x37c42a[0x0]['outboundQueuePauses']||0x0;_0x31844b[_0x3cf1('0x177')]=_0x59a987>0x0?_0x59a987:0x1;return _0x4ee6c4['busyFactor'](_0x189179,_0x1714e8,_0x369f9d,_0x59a987,_0x5a34d9);})[_0x3cf1('0xa0')](function(_0x42d4b9){return _0x2b84a8(_0x42d4b9);})[_0x3cf1('0x9b')](function(_0x2ec9f8){return _0x11ec03(msgResponse('[CatchErlangB]','Failure',JSON[_0x3cf1('0x6e')](_0x2ec9f8)));});}}else{return _0x11ec03(msgResponse(_0x3cf1('0x18d'),_0x3cf1('0x10c'),_0x3cf1('0x18e')));}});};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x186')]=function(_0x4f7fc8){var _0x5850d1=this;return function(){var _0x2e6088=0x0;var _0x1f4f46=Math['floor'](_0x4f7fc8[_0x3cf1('0x18f')]*0x3e8);if(_0x1f4f46>0x0){_0x1f4f46=_0x1f4f46<0x64?0x64:_0x1f4f46;loggerPredictive['info'](_0x3cf1('0x190'),_0x1f4f46);_0x4f7fc8[_0x3cf1('0x7e')]=setInterval(function(){_0x5850d1[_0x3cf1('0x7e')](_0x4f7fc8);loggerPredictiveCalls[_0x3cf1('0x76')]('[handlePredictive]',_0x2e6088+=0x1);},_0x1f4f46);}else{loggerPredictive['info'](_0x3cf1('0x191'),_0x3cf1('0x192'),_0x1f4f46);}};};Dialer[_0x3cf1('0x18')]['checkContactBlack']=function(_0x5cdc7f,_0x577941){var _0x1f2d49=this;return function(_0x10b053){if(_['isEmpty'](_0x10b053)){if(_[_0x3cf1('0x97')](_0x577941[_0x3cf1('0xb7')])||!_0x577941[_0x3cf1('0x193')]){if(_0x5cdc7f[_0x3cf1('0x55')]==='booked'){_0x5cdc7f[_0x3cf1('0xf3')]=_[_0x3cf1('0x3a')](_0x5cdc7f['queueStatusComplete'])?!![]:_0x5cdc7f[_0x3cf1('0xf3')];var _0x649d94=uuid['v4']();_0x1f2d49[_0x3cf1('0x22')][_0x649d94]=new Action(_0x5cdc7f,_0x577941,_0x649d94);loggerBooked[_0x3cf1('0x76')]('[booked][checkContactBlack]',_0x649d94,_0x3cf1('0x194'),JSON['stringify'](_0x5cdc7f[_0x3cf1('0xf3')]),_0x3cf1('0x195'),_0x5cdc7f[_0x3cf1('0x3e')]);if(_0x5cdc7f[_0x3cf1('0xf3')]){_0x5cdc7f[_0x3cf1('0xf3')]=![];_0x1f2d49[_0x3cf1('0x28')][_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0x9d')]]=[];ami['Action']({'actionid':_0x649d94,'action':'queuestatus','queue':_0x5cdc7f[_0x3cf1('0x3e')]})['catch'](function(_0x29a48c){_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);_0x1f2d49['rescheduleContact']({'active':![],'ContactId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94]['ContactId'],'ListId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb6')],'VoiceQueueId':_0x1f2d49['actions'][_0x649d94][_0x3cf1('0xb8')]||undefined,'CampaignId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94]['CampaignId']||undefined})[_0x3cf1('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x1f2d49[_0x3cf1('0x22')][_0x649d94];});}else{loggerBooked[_0x3cf1('0x76')](_0x3cf1('0x196'),JSON[_0x3cf1('0x6e')](_0x5cdc7f['queueStatusComplete']),_0x3cf1('0x195'),_0x5cdc7f[_0x3cf1('0x3e')]);_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);_0x1f2d49['rescheduleContact']({'active':![],'ContactId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb5')],'ListId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xb6')],'VoiceQueueId':_0x1f2d49['actions'][_0x649d94][_0x3cf1('0xb8')]||undefined,'CampaignId':_0x1f2d49[_0x3cf1('0x22')][_0x649d94][_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x197')));delete _0x1f2d49[_0x3cf1('0x22')][_0x649d94];}}else{return _0x1f2d49[_0x3cf1('0x12a')](_0x5cdc7f,_0x577941);}}else{if(getDiff(_0x577941[_0x3cf1('0x198')])<_0x5cdc7f[_0x3cf1('0x199')]*0x3c){_0x1f2d49[_0x3cf1('0xf4')][_0x3cf1('0xf5')](_0x577941['id'])[_0x3cf1('0x1b')](function(){_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);});}else{_0x5cdc7f[_0x3cf1('0x60')]+=0x1;_0x1f2d49[_0x3cf1('0x9c')](_0x5cdc7f);if(_0x5cdc7f[_0x3cf1('0x19a')]){_0x1f2d49['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x577941['ContactId'],'ListId':_0x577941['ListId'],'VoiceQueueId':_0x577941[_0x3cf1('0xb8')]||undefined,'CampaignId':_0x577941[_0x3cf1('0xf8')]||undefined})[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x19b')));_0x1f2d49['createHistory'](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x19c'),0x17,_0x3cf1('0x19d')))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0x19e')));}else{_0x1f2d49['saveInDb'](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x19f'),0x16,'RecallFailedTimeout'),_0x3cf1('0x1a0'),'[Originate][HistoryRecallClose]');}}}}else{_0x5cdc7f[_0x3cf1('0x1a1')]+=0x1;_0x1f2d49[_0x3cf1('0xb3')](createObjHistory(_0x5cdc7f,_0x577941,_0x3cf1('0x1a2'),0xd,_0x3cf1('0x1a3')),_0x3cf1('0x1a4'),_0x3cf1('0x1a5'));throw _0x3cf1('0x1a6');}};};Dialer[_0x3cf1('0x18')][_0x3cf1('0x121')]=function(_0x4cff17){var _0x28e684=this;var _0x3bfca1=[];var _0x4d457d=_0x4cff17[_0x3cf1('0x1a7')]-_0x4cff17[_0x3cf1('0x6a')]-_0x4cff17['temp'];emitCampaignSummary(_0x4cff17);if(_0x4d457d>0x0){if(_0x4d457d>this[_0x3cf1('0x20')]){_0x4d457d=this['maxNumberOriginate'];}_0x4cff17[_0x3cf1('0x1a8')]+=_0x4d457d;this[_0x3cf1('0xaa')](_0x4cff17['id'],_0x4d457d,_0x4cff17[_0x3cf1('0x1a9')])['then'](function(_0x1bc334){_0x4cff17['temp']-=_0x4d457d;_0x4cff17[_0x3cf1('0x1a8')]=_0x4cff17['temp']>0x0?_0x4cff17['temp']:0x0;if(!checkContactEmpty(_0x1bc334)){_0x4cff17[_0x3cf1('0x3b')]='AVAILABLE_CONTACTS_FINISHED';logger[_0x3cf1('0x76')]('[getContactCampaign2][Empty]'+_0x4cff17['name']);}else{_0x4cff17[_0x3cf1('0x6a')]+=_0x1bc334[_0x3cf1('0x83')];_0x4cff17[_0x3cf1('0x3b')]=_0x3cf1('0x1aa');for(var _0x15eee0=0x0;_0x15eee0<_0x1bc334[_0x3cf1('0x83')];_0x15eee0+=0x1){_0x4cff17[_0x3cf1('0x1ab')]+=0x1;if(_[_0x3cf1('0x97')](_0x1bc334[_0x15eee0])||_[_0x3cf1('0x97')](_0x1bc334[_0x15eee0][_0x3cf1('0x12d')])||_['isNil'](_0x1bc334[_0x15eee0][_0x3cf1('0x12d')][_0x3cf1('0x12e')])){_0x28e684[_0x3cf1('0xb1')](_0x3cf1('0x1ac'),_0x4cff17,_0x1bc334[_0x15eee0]);}else{_0x28e684[_0x3cf1('0xa3')](_[_0x3cf1('0xb4')](_0x1bc334[_0x15eee0],[_0x3cf1('0xf8'),_0x3cf1('0x1ad')]))[_0x3cf1('0xa0')](_0x28e684[_0x3cf1('0x1ae')](_0x4cff17,_0x1bc334[_0x15eee0]))[_0x3cf1('0x9b')](_0x28e684[_0x3cf1('0x1af')](_0x3cf1('0x1b0'),_0x4cff17));}}}})[_0x3cf1('0x9b')](loggerGetContactDialer(_0x3cf1('0x1b1'),_0x4cff17,_0x4d457d));}};Dialer['prototype'][_0x3cf1('0x11d')]=function(_0x28047f,_0x5321f3){var _0x43154b=this;var _0x2a7970=[];var _0x264098=_0x5321f3>=0x1?_0x5321f3:0x1;var _0x1a37f7=[];if(_0x28047f[_0x3cf1('0x55')]===_0x3cf1('0x4')){_0x264098=0x1;}var _0x29e280=Math[_0x3cf1('0x1b2')](_0x28047f[_0x3cf1('0x4a')]*_0x264098)-_0x28047f['originated']-_0x28047f[_0x3cf1('0x1a8')];emitVoiceQueueSummary(_0x28047f);if(_0x28047f[_0x3cf1('0x1b3')]>0x0){var _0x2b2044=_0x28047f[_0x3cf1('0x1b3')]-_0x28047f[_0x3cf1('0x6a')]-_0x28047f[_0x3cf1('0x50')]-_0x28047f[_0x3cf1('0x1a8')]-_0x28047f[_0x3cf1('0x4c')];if(_0x29e280>_0x2b2044){_0x29e280=_0x2b2044;}}if(_0x29e280>0x0){if(_0x28047f[_0x3cf1('0x55')]==='booked'){_0x29e280=0x1;}if(_0x29e280>this[_0x3cf1('0x20')]){_0x29e280=this[_0x3cf1('0x20')];}_0x28047f[_0x3cf1('0x1a8')]+=_0x29e280;for(var _0x5555f6 in this['agents']){if(this['agents']['hasOwnProperty'](_0x5555f6)){if(this[_0x3cf1('0x1e')][_0x5555f6][_0x3cf1('0x90')]===_0x3cf1('0x1b4')&&this[_0x3cf1('0x1e')][_0x5555f6][_0x3cf1('0x99')]===_0x3cf1('0xbd')){_0x2a7970['push'](this[_0x3cf1('0x1e')][_0x5555f6]['id']);}}}this[_0x3cf1('0xa8')](_0x28047f['id'],_0x2a7970,_0x29e280,_0x28047f['dialOrderByScheduledAt'])[_0x3cf1('0xa0')](function(_0x328d3a){_0x28047f[_0x3cf1('0x1a8')]-=_0x29e280;_0x28047f[_0x3cf1('0x1a8')]=_0x28047f[_0x3cf1('0x1a8')]>0x0?_0x28047f[_0x3cf1('0x1a8')]:0x0;if(!checkContactEmpty(_0x328d3a)){_0x43154b[_0x3cf1('0x9e')](_0x28047f)[_0x3cf1('0xa0')](sendMessageReschedule(_0x28047f))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x28047f[_0x3cf1('0x6a')]+=_0x328d3a[_0x3cf1('0x83')];_0x28047f['message']=_0x28047f['dialMethod']===_0x3cf1('0x4')?_0x3cf1('0x136'):_0x3cf1('0x1aa');for(var _0x1764a7=0x0;_0x1764a7<_0x328d3a[_0x3cf1('0x83')];_0x1764a7+=0x1){if(_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7])||_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7][_0x3cf1('0x12d')])||_[_0x3cf1('0x97')](_0x328d3a[_0x1764a7][_0x3cf1('0x12d')]['phone'])){_0x43154b[_0x3cf1('0xb1')]('[actionOriginate]\x20',_0x28047f,_0x328d3a[_0x1764a7]);}else{_0x43154b[_0x3cf1('0xa2')](_[_0x3cf1('0xb4')](_0x328d3a[_0x1764a7],[_0x3cf1('0xb8'),_0x3cf1('0x1ad')]))['then'](_0x43154b[_0x3cf1('0x1ae')](_0x28047f,_0x328d3a[_0x1764a7]))[_0x3cf1('0x9b')](_0x43154b[_0x3cf1('0x1af')](_0x3cf1('0x1ac'),_0x28047f));}}}})[_0x3cf1('0x9b')](loggerGetContactDialer('[getContactDialer2]',_0x28047f,_0x29e280));}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x7e')]=function(_0x4e90d6){var _0x3162bd=this;if(_0x4e90d6[_0x3cf1('0x1b3')]>0x0){var _0x3a33dd=_0x4e90d6[_0x3cf1('0x1b3')]-_0x4e90d6[_0x3cf1('0x6a')]-_0x4e90d6[_0x3cf1('0x50')];if(_0x3a33dd>0x0){this['tryOriginatePredictive'](_0x4e90d6);}else{loggerPredictiveCalls[_0x3cf1('0x76')]('[handlePredictive][limitChannel]');}}else{this[_0x3cf1('0x1b5')](_0x4e90d6);}};Dialer[_0x3cf1('0x18')][_0x3cf1('0x1b5')]=function(_0x12b054){var _0x1404bc=this;var _0x1b94e0=[];_0x12b054[_0x3cf1('0x6a')]+=0x1;for(var _0x5a0636 in this[_0x3cf1('0x1e')]){if(this['agents'][_0x3cf1('0x84')](_0x5a0636)){if(this[_0x3cf1('0x1e')][_0x5a0636][_0x3cf1('0x90')]===_0x3cf1('0x1b4')&&this[_0x3cf1('0x1e')][_0x5a0636][_0x3cf1('0x99')]===_0x3cf1('0xbd')){_0x1b94e0[_0x3cf1('0xf0')](this[_0x3cf1('0x1e')][_0x5a0636]['id']);}}}this[_0x3cf1('0xa8')](_0x12b054['id'],_0x1b94e0,0x1,_0x12b054['dialOrderByScheduledAt'])[_0x3cf1('0xa0')](function(_0x2b82b5){if(!checkContactEmpty(_0x2b82b5)){checkContactLowerLimitOriginate(_0x12b054,0x1,0x0);_0x1404bc[_0x3cf1('0x9e')](_0x12b054)[_0x3cf1('0xa0')](sendMessageReschedule(_0x12b054))[_0x3cf1('0x9b')](loggerCatch(_0x3cf1('0xa1')));}else{_0x12b054['message']=_0x3cf1('0x1aa');if(_['isNil'](_0x2b82b5[0x0])||_[_0x3cf1('0x97')](_0x2b82b5[0x0][_0x3cf1('0x12d')])||_[_0x3cf1('0x97')](_0x2b82b5[0x0][_0x3cf1('0x12d')][_0x3cf1('0x12e')])){_0x1404bc[_0x3cf1('0xb1')]('[actionOriginate]\x20',_0x12b054,_0x2b82b5[0x0]);}else{_0x1404bc[_0x3cf1('0xa2')](_[_0x3cf1('0xb4')](_0x2b82b5[0x0],[_0x3cf1('0xb8'),'Contact.phone']))[_0x3cf1('0xa0')](_0x1404bc[_0x3cf1('0x1ae')](_0x12b054,_0x2b82b5[0x0]))[_0x3cf1('0x9b')](_0x1404bc['loggerHandler'](_0x3cf1('0x1b6'),_0x12b054));}}})[_0x3cf1('0x9b')](loggerGetContactDialer(_0x3cf1('0x1b7'),_0x12b054,0x1));emitVoiceQueueSummary(_0x12b054);};Dialer['prototype'][_0x3cf1('0x18b')]=function(_0x57d871,_0x51771c,_0x5a665c,_0x5be6c2,_0x2678d7,_0x4e38ce){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x1b8'),_0x3cf1('0x1b9'),_0x57d871,'\x20interval\x20=\x20',_0x51771c,_0x3cf1('0x1ba'),_0x5a665c,_0x3cf1('0x1bb'),_0x5be6c2,_0x3cf1('0x1bc'),_0x2678d7);return new BPromise(function(_0x1f1436,_0x38c082){if(_0x57d871<=0x0||isNaN(_0x57d871)){return _0x38c082(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),'m\x20=\x20'+_0x57d871));}if(_0x5a665c<=0x0||isNaN(_0x5a665c)){return _0x38c082(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),_0x3cf1('0x1bd')+_0x5a665c));}if(_0x5be6c2<=0x0||isNaN(_0x5be6c2)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1be')+_0x5be6c2));}if(_0x51771c<=0x0||isNaN(_0x51771c)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1bf')+_0x51771c));}if(_0x2678d7<=0x0||isNaN(_0x2678d7)){return _0x38c082(msgResponse(_0x3cf1('0x1b8'),'Error',_0x3cf1('0x1c0')+_0x2678d7));}_0x4e38ce=_0x4e38ce||0x0;var _0xcd33b1=0x1/_0x5a665c;var _0x2d7e00=0x0;var _0xbf11ad=0x0;var _0x174576=0x0;var _0x393cbb=0x0;for(var _0x3303af=0x0;_0x174576<_0x2678d7;_0x3303af+=0x1){_0xbf11ad=_0x3303af/_0x51771c;_0x2d7e00=(_0x5be6c2*_0xbf11ad+_0x4e38ce)/_0xcd33b1;_0x174576=erlangb(_0x2d7e00,_0x57d871);_0x393cbb=_0x2d7e00/_0x57d871*(0x1-erlangb(_0x2d7e00,_0x57d871));}return _0x1f1436({'erlangCalls':_0x3303af,'erlangCallToSecond':_0x51771c/_0x3303af,'erlangAbandonmentRate':_0x174576,'erlangBusyFactor':_0x393cbb});});};Dialer[_0x3cf1('0x18')][_0x3cf1('0x1c1')]=function(_0x384398,_0x33a4ec,_0x568759,_0x3d9926,_0xd0a606,_0x209e15){loggerPredictive[_0x3cf1('0x76')](_0x3cf1('0x1c2'),'\x20m\x20=\x20',_0x384398,_0x3cf1('0x1c3'),_0x33a4ec,_0x3cf1('0x1ba'),_0x568759,'\x20p\x20=\x20',_0x3d9926,_0x3cf1('0x1c4'),_0xd0a606);return new BPromise(function(_0x52a2c6,_0x54d3bc){if(_0x384398<=0x0||isNaN(_0x384398)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1c5')+_0x384398));}if(_0x568759<=0x0||isNaN(_0x568759)){return _0x54d3bc(msgResponse('[abandonmentRate]',_0x3cf1('0x41'),_0x3cf1('0x1bd')+_0x568759));}if(_0x3d9926<=0x0||isNaN(_0x3d9926)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),_0x3cf1('0x1be')+_0x3d9926));}if(_0x33a4ec<=0x0||isNaN(_0x33a4ec)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),'interval\x20=\x20'+_0x33a4ec));}if(_0xd0a606<=0x0||isNaN(_0xd0a606)){return _0x54d3bc(msgResponse(_0x3cf1('0x1b8'),_0x3cf1('0x41'),'Amax\x20=\x20'+_0xd0a606));}_0x209e15=_0x209e15||0x0;var _0x26e99d=0x1/_0x568759;var _0x4df368=0x0;var _0x3181bb=0x0;var _0x162b8e=0x0;var _0x27ad4d=0x0;for(var _0x2bee62=0x0;_0x27ad4d<_0xd0a606;_0x2bee62+=0x1){_0x3181bb=_0x2bee62/_0x33a4ec;_0x4df368=(_0x3d9926*_0x3181bb+_0x209e15)/_0x26e99d;_0x162b8e=erlangb(_0x4df368,_0x384398);_0x27ad4d=_0x4df368/_0x384398*(0x1-erlangb(_0x4df368,_0x384398));}return _0x52a2c6({'erlangCalls':_0x2bee62,'erlangCallToSecond':_0x33a4ec/_0x2bee62,'erlangAbandonmentRate':_0x162b8e,'erlangBusyFactor':_0x27ad4d});});};module[_0x3cf1('0x1c6')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index eaa4f34..14e95d8 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2fd=['originatecalleridnum','originatecalleridname','util','lodash','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','uniqueid','name','number','starttime','responsetime','droptime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xc2fd,0x1f1));var _0xdc2f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc2fd[_0xfae23b];return _0x200640;};'use strict';var util=require(_0xdc2f('0x0'));var _=require(_0xdc2f('0x1'));var moment=require('moment');function getSeconds(_0x57da10,_0x1e6425){var _0x35b253=moment(_0x57da10)[_0xdc2f('0x2')](0x0);var _0x47d056=moment(_0x1e6425)[_0xdc2f('0x2')](0x0);return _0x35b253['diff'](_0x47d056,_0xdc2f('0x3'));}function QueueCallerAbandon(_0x5c2e33,_0x363b94){this[_0xdc2f('0x4')]=_0x5c2e33[_0xdc2f('0x4')];this[_0xdc2f('0x5')]=_0x5c2e33[_0xdc2f('0x5')];this[_0xdc2f('0x6')]=_0x5c2e33[_0xdc2f('0x5')]===_0xdc2f('0x7')?'queue':_0x5c2e33[_0xdc2f('0x5')];this['countbusyretry']=_0x5c2e33[_0xdc2f('0x8')];this[_0xdc2f('0x9')]=_0x5c2e33[_0xdc2f('0x9')];this['countnoanswerretry']=_0x5c2e33[_0xdc2f('0xa')];this[_0xdc2f('0xb')]=_0x5c2e33[_0xdc2f('0x8')]+_0x5c2e33[_0xdc2f('0x9')]+_0x5c2e33[_0xdc2f('0xa')];this[_0xdc2f('0xc')]=_0x363b94[_0xdc2f('0xc')];this['calleridname']=_0x5c2e33[_0xdc2f('0xd')];this['calleridnum']=_0x5c2e33[_0xdc2f('0xe')];this['starttime']=_0x5c2e33[_0xdc2f('0xf')];this[_0xdc2f('0x10')]=_0x5c2e33['responsetime'];this['droptime']=_0x5c2e33[_0xdc2f('0x11')];this['endtime']=this[_0xdc2f('0x11')];this['ringtime']=getSeconds(_0x5c2e33['responsetime'],_0x5c2e33['starttime']);this[_0xdc2f('0x12')]=getSeconds(this[_0xdc2f('0x11')],_0x5c2e33[_0xdc2f('0x10')]);this[_0xdc2f('0x13')]=0x0;this['queue']=_0x363b94['queue'];this[_0xdc2f('0x14')]=_0x363b94[_0xdc2f('0x15')];this['reason']=_0x363b94[_0xdc2f('0x16')];this['callback']=_0x5c2e33[_0xdc2f('0x17')];this[_0xdc2f('0x18')]=_0x5c2e33[_0xdc2f('0x18')];this[_0xdc2f('0x19')]=_0x5c2e33['callbackat'];this[_0xdc2f('0x1a')]=_0x5c2e33['recallme'];this[_0xdc2f('0x1b')]=_0x5c2e33['ContactId'];this[_0xdc2f('0x1c')]=_0x5c2e33[_0xdc2f('0x1c')];this['UserId']=_0x5c2e33['UserId'];this['VoiceQueueId']=_0x5c2e33[_0xdc2f('0x1d')];this[_0xdc2f('0x1e')]=_0x5c2e33['CampaignId'];this['originatecalleridnum']=_0x5c2e33[_0xdc2f('0x1f')]||'';this[_0xdc2f('0x20')]=_0x5c2e33[_0xdc2f('0x20')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x3dd0=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','moment','diff','seconds'];(function(_0x3629de,_0x3f1514){var _0x535d4a=function(_0x173086){while(--_0x173086){_0x3629de['push'](_0x3629de['shift']());}};_0x535d4a(++_0x3f1514);}(_0x3dd0,0x17d));var _0x03dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3dd0[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x03dd('0x0'));function getSeconds(_0x228ff5,_0x5be369){var _0x43d31e=moment(_0x228ff5)['milliseconds'](0x0);var _0x3e4eff=moment(_0x5be369)['milliseconds'](0x0);return _0x43d31e[_0x03dd('0x1')](_0x3e4eff,_0x03dd('0x2'));}function QueueCallerAbandon(_0x26fc70,_0x554e6e){this[_0x03dd('0x3')]=_0x26fc70[_0x03dd('0x3')];this[_0x03dd('0x4')]=_0x26fc70[_0x03dd('0x4')];this[_0x03dd('0x5')]=_0x26fc70[_0x03dd('0x4')]===_0x03dd('0x6')?_0x03dd('0x7'):_0x26fc70[_0x03dd('0x4')];this[_0x03dd('0x8')]=_0x26fc70[_0x03dd('0x8')];this[_0x03dd('0x9')]=_0x26fc70[_0x03dd('0x9')];this[_0x03dd('0xa')]=_0x26fc70[_0x03dd('0xa')];this['countglobal']=_0x26fc70['countbusyretry']+_0x26fc70[_0x03dd('0x9')]+_0x26fc70[_0x03dd('0xa')];this[_0x03dd('0xb')]=_0x554e6e['uniqueid'];this['calleridname']=_0x26fc70[_0x03dd('0xc')];this[_0x03dd('0xd')]=_0x26fc70[_0x03dd('0xe')];this['starttime']=_0x26fc70[_0x03dd('0xf')];this[_0x03dd('0x10')]=_0x26fc70[_0x03dd('0x10')];this['droptime']=_0x26fc70[_0x03dd('0x11')];this['endtime']=this[_0x03dd('0x11')];this[_0x03dd('0x12')]=getSeconds(_0x26fc70[_0x03dd('0x10')],_0x26fc70['starttime']);this[_0x03dd('0x13')]=getSeconds(this[_0x03dd('0x11')],_0x26fc70[_0x03dd('0x10')]);this['talktime']=0x0;this[_0x03dd('0x7')]=_0x554e6e[_0x03dd('0x7')];this[_0x03dd('0x14')]=_0x554e6e[_0x03dd('0x15')];this['reason']=_0x554e6e['reason'];this['callback']=_0x26fc70['callback'];this[_0x03dd('0x16')]=_0x26fc70[_0x03dd('0x16')];this[_0x03dd('0x17')]=_0x26fc70['callbackat'];this[_0x03dd('0x18')]=_0x26fc70[_0x03dd('0x18')];this[_0x03dd('0x19')]=_0x26fc70[_0x03dd('0x19')];this[_0x03dd('0x1a')]=_0x26fc70[_0x03dd('0x1a')];this[_0x03dd('0x1b')]=_0x26fc70[_0x03dd('0x1b')];this[_0x03dd('0x1c')]=_0x26fc70[_0x03dd('0x1c')];this[_0x03dd('0x1d')]=_0x26fc70[_0x03dd('0x1d')];this['originatecalleridnum']=_0x26fc70[_0x03dd('0x1e')]||'';this[_0x03dd('0x1f')]=_0x26fc70[_0x03dd('0x1f')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e5bb916..f16ae31 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 _0xa75b=['%s/%s/%s','tech','Trunk','name','fax','localstationid','path','AttachmentId','util','uniqueid','channel','format'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0xa75b,0x170));var _0xba75=function(_0x46f992,_0x21229a){_0x46f992=_0x46f992-0x0;var _0x517d35=_0xa75b[_0x46f992];return _0x517d35;};'use strict';var util=require(_0xba75('0x0'));var _=require('lodash');var moment=require('moment');function Action(_0x10c0dd,_0x39dc19,_0x17b666){this[_0xba75('0x1')]=_0x10c0dd||undefined;this[_0xba75('0x2')]=util[_0xba75('0x3')](_0xba75('0x4'),_0x39dc19[_0xba75('0x5')],_0x39dc19[_0xba75('0x6')][_0xba75('0x7')],_0x17b666[_0xba75('0x8')]);this[_0xba75('0x9')]=_0x39dc19[_0xba75('0x9')];this['headerinfo']=_0x39dc19['headerinfo'];this[_0xba75('0xa')]=_0x17b666['path'];this['AttachmentId']=_0x17b666[_0xba75('0xb')];}module['exports']=Action; \ No newline at end of file +var _0x93e8=['headerinfo','path','AttachmentId','exports','util','lodash','moment','uniqueid','channel','%s/%s/%s','Trunk','name','fax','localstationid'];(function(_0x5ca209,_0x137dda){var _0x7d7e15=function(_0x28f03a){while(--_0x28f03a){_0x5ca209['push'](_0x5ca209['shift']());}};_0x7d7e15(++_0x137dda);}(_0x93e8,0x19a));var _0x893e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x93e8[_0x4b2863];return _0x567d67;};'use strict';var util=require(_0x893e('0x0'));var _=require(_0x893e('0x1'));var moment=require(_0x893e('0x2'));function Action(_0x17b04f,_0x3e77b5,_0x2db4a3){this[_0x893e('0x3')]=_0x17b04f||undefined;this[_0x893e('0x4')]=util['format'](_0x893e('0x5'),_0x3e77b5['tech'],_0x3e77b5[_0x893e('0x6')][_0x893e('0x7')],_0x2db4a3[_0x893e('0x8')]);this[_0x893e('0x9')]=_0x3e77b5[_0x893e('0x9')];this['headerinfo']=_0x3e77b5[_0x893e('0xa')];this[_0x893e('0xb')]=_0x2db4a3[_0x893e('0xb')];this[_0x893e('0xc')]=_0x2db4a3[_0x893e('0xc')];}module[_0x893e('0xd')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 8096192..904b427 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 _0x8067=['execOriginate','ext','isTrunkReachable','isNil','active','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','notify','error','stringify','catch','merge','pick','response','update','AttachmentId','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction'];(function(_0x4421a0,_0x1525bc){var _0x5626d0=function(_0x56d43e){while(--_0x56d43e){_0x4421a0['push'](_0x4421a0['shift']());}};_0x5626d0(++_0x1525bc);}(_0x8067,0x10c));var _0x7806=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x8067[_0x3ab51d];return _0x29a04e;};'use strict';var util=require('util');var _=require(_0x7806('0x0'));var BPromise=require(_0x7806('0x1'));var uuid=require(_0x7806('0x2'));var moment=require(_0x7806('0x3'));var path=require('path');var tiff2pdf=require(_0x7806('0x4'));var gs=require(_0x7806('0x5'));var logger=require(_0x7806('0x6'))(_0x7806('0x7'));var ami=require(_0x7806('0x8'));var rpcDb=require(_0x7806('0x9'));var Channel=require(_0x7806('0xa'));var ut=require(_0x7806('0xb'));var Action=require(_0x7806('0xc'));var faxAccount=require(_0x7806('0xd'));var attachment=require(_0x7806('0xe'));var faxMessage=require(_0x7806('0xf'));function Fax(_0x4a5038){this[_0x7806('0x10')]={};this[_0x7806('0x11')]=_0x4a5038[_0x7806('0x11')];this['trunks']=_0x4a5038['trunks'];this[_0x7806('0x12')]={};ami['on'](_0x7806('0x13'),this[_0x7806('0x14')][_0x7806('0x15')](this));ami['on']('varset',this[_0x7806('0x16')][_0x7806('0x15')](this));ami['on'](_0x7806('0x17'),this[_0x7806('0x18')][_0x7806('0x15')](this));ami['on']('newexten',this[_0x7806('0x19')][_0x7806('0x15')](this));ami['on'](_0x7806('0x1a'),this[_0x7806('0x1b')][_0x7806('0x15')](this));ami['on'](_0x7806('0x1c'),this[_0x7806('0x1d')][_0x7806('0x15')](this));ami['on'](_0x7806('0x1e'),this[_0x7806('0x1f')][_0x7806('0x15')](this));ami['on'](_0x7806('0x20'),this[_0x7806('0x21')][_0x7806('0x15')](this));}Fax[_0x7806('0x22')][_0x7806('0x14')]=function(_0x20f130){if(_0x20f130[_0x7806('0x23')]===_0x7806('0x24')){for(var _0x9006b9 in this[_0x7806('0x11')]){if(this['faxAccounts'][_0x7806('0x25')](_0x9006b9)){if(_0x20f130[_0x7806('0x26')]===this[_0x7806('0x11')][_0x9006b9][_0x7806('0x27')]){this[_0x7806('0x10')][_0x20f130[_0x7806('0x28')]]={};this[_0x7806('0x10')][_0x20f130['uniqueid']][_0x7806('0x29')]=_0x20f130[_0x7806('0x29')];this[_0x7806('0x10')][_0x20f130[_0x7806('0x28')]]['id']=this['faxAccounts'][_0x9006b9]['id'];this[_0x7806('0x10')][_0x20f130[_0x7806('0x28')]][_0x7806('0x2a')]=this[_0x7806('0x11')][_0x9006b9][_0x7806('0x2a')];logger['info'](_0x20f130['uniqueid'],_0x7806('0x2b'));}}}}if(this[_0x7806('0x12')][_0x20f130['uniqueid']]){this['channels'][_0x20f130[_0x7806('0x28')]]={};this[_0x7806('0x10')][_0x20f130[_0x7806('0x28')]][_0x7806('0x29')]=_0x20f130[_0x7806('0x29')];logger[_0x7806('0x2c')](_0x20f130[_0x7806('0x28')],_0x7806('0x2b'));}};Fax[_0x7806('0x22')]['syncVarSet']=function(_0x3c4fa1){if(this[_0x7806('0x10')][_0x3c4fa1['uniqueid']]){for(var _0x2e521a in _0x3c4fa1[_0x7806('0x2d')]){if(_0x3c4fa1[_0x7806('0x2d')][_0x7806('0x25')](_0x2e521a)){this['channels'][_0x3c4fa1[_0x7806('0x28')]][_0x2e521a]=_0x3c4fa1[_0x7806('0x2e')];}}}};Fax['prototype'][_0x7806('0x18')]=function(_0x458924){if(this[_0x7806('0x10')][_0x458924[_0x7806('0x28')]]){this[_0x7806('0x10')][_0x458924['uniqueid']][_0x7806('0x2f')]=_0x458924['channelstate'];this[_0x7806('0x10')][_0x458924[_0x7806('0x28')]][_0x7806('0x30')]=_0x458924['channelstatedesc'];}};Fax[_0x7806('0x22')][_0x7806('0x19')]=function(_0x402009){if(this[_0x7806('0x10')][_0x402009[_0x7806('0x28')]]){for(var _0x32817a in _0x402009[_0x7806('0x2d')]){if(_0x402009[_0x7806('0x2d')][_0x7806('0x25')](_0x32817a)){this['channels'][_0x402009[_0x7806('0x28')]][_0x32817a]=_0x402009[_0x7806('0x2e')];}}}};Fax[_0x7806('0x22')][_0x7806('0x1b')]=function(_0x115889){if(this[_0x7806('0x10')][_0x115889['uniqueid']]){this[_0x7806('0x10')][_0x115889[_0x7806('0x28')]][_0x7806('0x31')]=_0x115889[_0x7806('0x31')];this['channels'][_0x115889['uniqueid']][_0x7806('0x32')]=_0x115889[_0x7806('0x32')];this[_0x7806('0x10')][_0x115889['uniqueid']][_0x7806('0x27')]=_0x115889['localstationid'];this[_0x7806('0x10')][_0x115889['uniqueid']][_0x7806('0x33')]=_0x115889[_0x7806('0x33')];logger['info'](_0x115889[_0x7806('0x28')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x7806('0x1d')]=function(_0x7c3654){var _0x15b571=this;if(this['channels'][_0x7c3654['uniqueid']]){var _0x13e6d7=this['channels'][_0x7c3654[_0x7806('0x28')]]['id'];this[_0x7806('0x10')][_0x7c3654['uniqueid']][_0x7806('0x34')]=_0x7c3654[_0x7806('0x34')];this[_0x7806('0x10')][_0x7c3654[_0x7806('0x28')]]['pagestransferred']=_0x7c3654[_0x7806('0x35')];this[_0x7806('0x10')][_0x7c3654['uniqueid']][_0x7806('0x27')]=_0x7c3654['localstationid'];this['channels'][_0x7c3654[_0x7806('0x28')]][_0x7806('0x36')]=_0x7c3654[_0x7806('0x36')];this[_0x7806('0x10')][_0x7c3654[_0x7806('0x28')]][_0x7806('0x37')]=_0x7c3654[_0x7806('0x37')];this[_0x7806('0x10')][_0x7c3654['uniqueid']][_0x7806('0x33')]=_0x7c3654['filename'];this['channels'][_0x7c3654[_0x7806('0x28')]][_0x7806('0x38')]=_0x7c3654['calleridnum'];if(this[_0x7806('0x10')][_0x7c3654[_0x7806('0x28')]][_0x7806('0x35')]>0x0){tiff2pdf(_0x7c3654[_0x7806('0x33')],_0x7806('0x39'),function(_0x223da3){logger[_0x7806('0x2c')](_0x7c3654[_0x7806('0x28')],_0x7806('0x3a'),_0x223da3[_0x7806('0x3b')]);attachment[_0x7806('0x3c')]({'name':path['parse'](_0x7c3654['filename'])[_0x7806('0x2a')],'basename':path[_0x7806('0x3d')](_0x7c3654[_0x7806('0x33')])[_0x7806('0x2a')]+_0x7806('0x3e'),'type':_0x7806('0x3f')})['then'](function(_0x76e0d6){faxAccount[_0x7806('0x40')](_0x13e6d7,{'from':_0x7c3654[_0x7806('0x38')],'mapKey':_0x7806('0x7'),'body':path[_0x7806('0x3d')](_0x7c3654['filename'])['name']+_0x7806('0x3e'),'AttachmentId':_0x76e0d6['id']})['catch'](function(_0x267cb5){logger[_0x7806('0x41')](_0x7c3654['uniqueid'],'\x20notify\x20',JSON[_0x7806('0x42')](_0x267cb5));});})[_0x7806('0x43')](function(_0x358941){logger[_0x7806('0x41')](_0x7c3654[_0x7806('0x28')],'\x20receiveFax\x20',JSON[_0x7806('0x42')](_0x358941));});});}logger[_0x7806('0x2c')](_0x7c3654[_0x7806('0x28')],'\x20receiveFax\x20');}};Fax[_0x7806('0x22')]['syncOriginateResponse']=function(_0x41d0b4){if(this[_0x7806('0x12')][_0x41d0b4[_0x7806('0x28')]]){_[_0x7806('0x44')](this[_0x7806('0x10')][_0x41d0b4[_0x7806('0x28')]],_[_0x7806('0x45')](_0x41d0b4,[_0x7806('0x46'),'reason']));}};function updateStatus(_0x25614a){if(_0x25614a['AttachmentId']){faxMessage[_0x7806('0x47')](_0x25614a[_0x7806('0x48')],{'failMessage':_0x7806('0x49')})[_0x7806('0x4a')](function(_0x15b8f6){ut['logger']('[Fax][Message][Error][Updated]',_0x15b8f6);})[_0x7806('0x43')](function(_0xf0ebc8){ut[_0x7806('0x4b')](_0x7806('0x4c'),_0xf0ebc8);});}else{ut[_0x7806('0x4b')](_0x7806('0x4d'));}}Fax['prototype'][_0x7806('0x4e')]=function(_0x2f8e08,_0x5d282a,_0x124e42){var _0x174615=this;var _0x32b1e2={};if(_0x5d282a){_0x32b1e2={'read':_0x5d282a};}else{_0x32b1e2={'failMessage':_0x124e42};}if(this['actions'][_0x2f8e08][_0x7806('0x48')]){faxMessage[_0x7806('0x47')](this[_0x7806('0x12')][_0x2f8e08][_0x7806('0x48')],_0x32b1e2)[_0x7806('0x4a')](function(_0x2269ab){ut['logger'](_0x7806('0x4f'),_0x2269ab);})[_0x7806('0x43')](function(_0x559ab7){ut[_0x7806('0x4b')]('[Fax][Message][NoUpdate1]',_0x559ab7);})['finally'](function(){delete _0x174615[_0x7806('0x10')][_0x2f8e08];delete _0x174615[_0x7806('0x12')][_0x2f8e08];});}else{ut[_0x7806('0x4b')](_0x7806('0x50'));delete this['channels'][_0x2f8e08];delete this[_0x7806('0x12')][_0x2f8e08];}};Fax[_0x7806('0x22')][_0x7806('0x1f')]=function(_0x5e20db){var _0x4ac5c0=this;if(this['channels'][_0x5e20db[_0x7806('0x28')]]){if(this[_0x7806('0x12')][_0x5e20db[_0x7806('0x28')]]){this[_0x7806('0x10')][_0x5e20db['uniqueid']]['id']=this['actions'][_0x5e20db[_0x7806('0x28')]]['id'];this[_0x7806('0x10')][_0x5e20db[_0x7806('0x28')]][_0x7806('0x2a')]=this['actions'][_0x5e20db[_0x7806('0x28')]]['name'];}logger[_0x7806('0x2c')](_0x5e20db[_0x7806('0x28')],this[_0x7806('0x12')][_0x5e20db[_0x7806('0x28')]]?'\x20hangup\x20sendFile\x20':_0x7806('0x51'),JSON['stringify'](this[_0x7806('0x10')][_0x5e20db['uniqueid']]));if(this[_0x7806('0x12')][_0x5e20db[_0x7806('0x28')]]){if(this[_0x7806('0x10')][_0x5e20db[_0x7806('0x28')]][_0x7806('0x52')]>0x0&&this[_0x7806('0x10')][_0x5e20db[_0x7806('0x28')]][_0x7806('0x1a')]===_0x7806('0x53')){this[_0x7806('0x4e')](_0x5e20db[_0x7806('0x28')],!![]);}else{this[_0x7806('0x4e')](_0x5e20db[_0x7806('0x28')],![],this[_0x7806('0x10')][_0x5e20db['uniqueid']]['faxstatusstring']?_0x7806('0x54')+this[_0x7806('0x10')][_0x5e20db['uniqueid']][_0x7806('0x55')]:_0x7806('0x56'));}}}};Fax[_0x7806('0x22')][_0x7806('0x57')]=function(_0x111eee){var _0x49b5c5=this;return new BPromise(function(_0x1aad2b,_0xe6c921){_0x49b5c5['execOriginate'](_0x111eee,_0x49b5c5[_0x7806('0x11')][_0x111eee[_0x7806('0x58')]])[_0x7806('0x4a')](function(_0x1b558f){ut[_0x7806('0x4b')](_0x7806('0x59'),_0x1b558f);_0x1aad2b(ut[_0x7806('0x3b')](_0x7806('0x5a')));})[_0x7806('0x43')](function(_0xfb3af2){ut[_0x7806('0x4b')](_0x7806('0x5b'),_0xfb3af2);updateStatus(_0x111eee);_0xe6c921(ut['message'](_0x7806('0x5c')));});});};Fax['prototype'][_0x7806('0x5d')]=function(_0x4f7379){var _0x3a1166=this;return new BPromise(function(_0x478815,_0x5a2c6b){var _0x1942fd=_0x3a1166[_0x7806('0x5e')](_0x3a1166[_0x7806('0x11')][_0x4f7379[_0x7806('0x58')]][_0x7806('0x5f')],_0x4f7379);if(_0x1942fd[_0x7806('0x60')]){_0x478815(ut[_0x7806('0x3b')](_0x7806('0x61')));}else{_0x5a2c6b(ut[_0x7806('0x3b')](_0x1942fd[_0x7806('0x3b')]));}});};function originate(_0xe80d5f,_0x175f47,_0x88490d){return new BPromise(function(_0x2a0256,_0x31ec94){if(_0x88490d){var _0x4ce5d6=util[_0x7806('0x62')](_0x7806('0x63'),path[_0x7806('0x3d')](_0xe80d5f['path'])[_0x7806('0x2a')],_0xe80d5f[_0x7806('0x64')]);gs[_0x7806('0x65')](_0x4ce5d6)[_0x7806('0x4a')](function(){_0xe80d5f[_0x7806('0x64')]=util[_0x7806('0x62')](_0x7806('0x66'),path[_0x7806('0x3d')](_0xe80d5f[_0x7806('0x64')])[_0x7806('0x67')],path['parse'](_0xe80d5f[_0x7806('0x64')])[_0x7806('0x2a')]);_0x175f47['XMF-PATH']=_0xe80d5f[_0x7806('0x64')];ut[_0x7806('0x4b')](_0x7806('0x68'),'');ami['Action'](ut['variablesAction'](_0xe80d5f,_0x175f47))['then'](function(_0x5c1d3b){_0x2a0256(_0x5c1d3b);})['catch'](function(_0x30a0a0){_0x31ec94(_0x30a0a0);});})['catch'](function(_0x7e8e6a){_0x31ec94(_0x7e8e6a);});}else{ami[_0x7806('0x69')](ut[_0x7806('0x6a')](_0xe80d5f,_0x175f47))[_0x7806('0x4a')](function(_0x55da3d){_0x2a0256(_0x55da3d);})[_0x7806('0x43')](function(_0x561d1c){_0x31ec94(_0x561d1c);});}});}Fax[_0x7806('0x22')][_0x7806('0x6b')]=function(_0x40c63f,_0xdc8e4){var _0x443653=this;return new BPromise(function(_0x1cea08,_0xf8f744){var _0x16f07d=uuid['v4']();var _0x2f0191=ut['addVariables'](_0x40c63f,_0xdc8e4);_0x443653[_0x7806('0x12')][_0x16f07d]=new Action(_0x16f07d,_0xdc8e4,_0x40c63f);var _0x3f3c8f=_0x443653['actions'][_0x16f07d];if(path[_0x7806('0x3d')](_0x40c63f[_0x7806('0x64')])[_0x7806('0x6c')]===_0x7806('0x3e')){originate(_0x3f3c8f,_0x2f0191,!![])[_0x7806('0x4a')](function(_0x413573){_0x1cea08(_0x413573);})[_0x7806('0x43')](function(_0x51159c){_0xf8f744(_0x51159c);});}else{originate(_0x3f3c8f,_0x2f0191,![])[_0x7806('0x4a')](function(_0x87ebed){_0x1cea08(_0x87ebed);})[_0x7806('0x43')](function(_0x3333a7){_0xf8f744(_0x3333a7);});}});};Fax[_0x7806('0x22')][_0x7806('0x6d')]=function(_0x2530e6){return!_[_0x7806('0x6e')](_0x2530e6)&&!_[_0x7806('0x6e')](_0x2530e6['name'])&&!_['isNil'](_0x2530e6['active'])&&_0x2530e6[_0x7806('0x6f')]&&!_[_0x7806('0x6e')](this[_0x7806('0x70')][util[_0x7806('0x62')](_0x7806('0x71'),_0x2530e6[_0x7806('0x2a')])])&&!_[_0x7806('0x6e')](this['trunks'][util['format'](_0x7806('0x71'),_0x2530e6['name'])][_0x7806('0x32')])&&(this[_0x7806('0x70')][util[_0x7806('0x62')]('SIP/%s',_0x2530e6[_0x7806('0x2a')])]['status']===_0x7806('0x72')||this[_0x7806('0x70')][util[_0x7806('0x62')]('SIP/%s',_0x2530e6[_0x7806('0x2a')])][_0x7806('0x32')]===_0x7806('0x73'));};Fax[_0x7806('0x22')][_0x7806('0x5e')]=function(_0x5e277a,_0x2d976d){if(!this[_0x7806('0x6d')](_0x5e277a)){ut['logger'](_0x7806('0x74'),_[_0x7806('0x6e')](_0x5e277a)?'':_0x5e277a[_0x7806('0x2a')]+_0x7806('0x75'));return{'isValid':![],'message':_0x7806('0x76')};}if(_['isNil'](_0x2d976d[_0x7806('0x7')])){ut['logger'](_0x7806('0x77'),JSON[_0x7806('0x42')](_0x2d976d));return{'isValid':![],'message':_0x7806('0x78')};}if(_['isNil'](_0x2d976d[_0x7806('0x64')])){ut[_0x7806('0x4b')](_0x7806('0x79'),JSON[_0x7806('0x42')](_0x2d976d));return{'isValid':![],'message':_0x7806('0x7a')};}return{'isValid':!![],'message':_0x7806('0x7b')};};module[_0x7806('0x7c')]=Fax; \ No newline at end of file +var _0x49a3=['notify','fax','error','stringify','catch','\x20receiveFax\x20','merge','pick','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','then','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk','Trunk\x20Reachable','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','format','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','../ami','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','receivefax','syncReceiveFax','originateresponse','syncOriginateResponse','prototype','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','hasOwnProperty','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','remotestationid','pagestransferred','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x49a3,0x9f));var _0x349a=function(_0x4315dd,_0x156d91){_0x4315dd=_0x4315dd-0x0;var _0x186e27=_0x49a3[_0x4315dd];return _0x186e27;};'use strict';var util=require(_0x349a('0x0'));var _=require('lodash');var BPromise=require(_0x349a('0x1'));var uuid=require(_0x349a('0x2'));var moment=require(_0x349a('0x3'));var path=require(_0x349a('0x4'));var tiff2pdf=require(_0x349a('0x5'));var gs=require(_0x349a('0x6'));var logger=require(_0x349a('0x7'))('fax');var ami=require(_0x349a('0x8'));var rpcDb=require('./rpcDb');var Channel=require('./channel');var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x349a('0x9'));var attachment=require(_0x349a('0xa'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x57b5f7){this[_0x349a('0xb')]={};this[_0x349a('0xc')]=_0x57b5f7[_0x349a('0xc')];this[_0x349a('0xd')]=_0x57b5f7[_0x349a('0xd')];this['actions']={};ami['on'](_0x349a('0xe'),this[_0x349a('0xf')][_0x349a('0x10')](this));ami['on']('varset',this[_0x349a('0x11')][_0x349a('0x10')](this));ami['on']('newstate',this[_0x349a('0x12')]['bind'](this));ami['on'](_0x349a('0x13'),this[_0x349a('0x14')][_0x349a('0x10')](this));ami['on'](_0x349a('0x15'),this['syncFaxStatus']['bind'](this));ami['on'](_0x349a('0x16'),this[_0x349a('0x17')][_0x349a('0x10')](this));ami['on']('hangup',this['syncHangup'][_0x349a('0x10')](this));ami['on'](_0x349a('0x18'),this[_0x349a('0x19')][_0x349a('0x10')](this));}Fax[_0x349a('0x1a')][_0x349a('0xf')]=function(_0x17bf20){if(_0x17bf20['context']==='from-voip-provider'){for(var _0x5de9ce in this[_0x349a('0xc')]){if(this[_0x349a('0xc')]['hasOwnProperty'](_0x5de9ce)){if(_0x17bf20[_0x349a('0x1b')]===this[_0x349a('0xc')][_0x5de9ce][_0x349a('0x1c')]){this[_0x349a('0xb')][_0x17bf20['uniqueid']]={};this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]]['channel']=_0x17bf20[_0x349a('0x1e')];this[_0x349a('0xb')][_0x17bf20['uniqueid']]['id']=this[_0x349a('0xc')][_0x5de9ce]['id'];this['channels'][_0x17bf20[_0x349a('0x1d')]]['name']=this[_0x349a('0xc')][_0x5de9ce][_0x349a('0x1f')];logger[_0x349a('0x20')](_0x17bf20[_0x349a('0x1d')],_0x349a('0x21'));}}}}if(this[_0x349a('0x22')][_0x17bf20[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]]={};this[_0x349a('0xb')][_0x17bf20[_0x349a('0x1d')]][_0x349a('0x1e')]=_0x17bf20[_0x349a('0x1e')];logger[_0x349a('0x20')](_0x17bf20[_0x349a('0x1d')],_0x349a('0x21'));}};Fax[_0x349a('0x1a')][_0x349a('0x11')]=function(_0x5f4fa7){if(this['channels'][_0x5f4fa7[_0x349a('0x1d')]]){for(var _0xb8ca6d in _0x5f4fa7[_0x349a('0x23')]){if(_0x5f4fa7[_0x349a('0x23')][_0x349a('0x24')](_0xb8ca6d)){this[_0x349a('0xb')][_0x5f4fa7[_0x349a('0x1d')]][_0xb8ca6d]=_0x5f4fa7[_0x349a('0x25')];}}}};Fax[_0x349a('0x1a')][_0x349a('0x12')]=function(_0x3ac9e2){if(this['channels'][_0x3ac9e2['uniqueid']]){this[_0x349a('0xb')][_0x3ac9e2[_0x349a('0x1d')]][_0x349a('0x26')]=_0x3ac9e2[_0x349a('0x26')];this[_0x349a('0xb')][_0x3ac9e2[_0x349a('0x1d')]][_0x349a('0x27')]=_0x3ac9e2['channelstatedesc'];}};Fax[_0x349a('0x1a')][_0x349a('0x14')]=function(_0x56930e){if(this[_0x349a('0xb')][_0x56930e[_0x349a('0x1d')]]){for(var _0x320d2d in _0x56930e[_0x349a('0x23')]){if(_0x56930e[_0x349a('0x23')]['hasOwnProperty'](_0x320d2d)){this[_0x349a('0xb')][_0x56930e[_0x349a('0x1d')]][_0x320d2d]=_0x56930e[_0x349a('0x25')];}}}};Fax[_0x349a('0x1a')][_0x349a('0x28')]=function(_0x5b7823){if(this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]['operation']=_0x5b7823[_0x349a('0x29')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]][_0x349a('0x2a')]=_0x5b7823[_0x349a('0x2a')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]]['localstationid']=_0x5b7823[_0x349a('0x1c')];this[_0x349a('0xb')][_0x5b7823[_0x349a('0x1d')]][_0x349a('0x2b')]=_0x5b7823['filename'];logger[_0x349a('0x20')](_0x5b7823[_0x349a('0x1d')],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0x349a('0x17')]=function(_0x49edea){var _0x278a4a=this;if(this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]){var _0x22d9c4=this[_0x349a('0xb')][_0x49edea['uniqueid']]['id'];this['channels'][_0x49edea['uniqueid']][_0x349a('0x2c')]=_0x49edea[_0x349a('0x2c')];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2d')]=_0x49edea['pagestransferred'];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]['localstationid']=_0x49edea[_0x349a('0x1c')];this['channels'][_0x49edea[_0x349a('0x1d')]]['resolution']=_0x49edea['resolution'];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]]['transferrate']=_0x49edea[_0x349a('0x2e')];this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2b')]=_0x49edea[_0x349a('0x2b')];this[_0x349a('0xb')][_0x49edea['uniqueid']][_0x349a('0x2f')]=_0x49edea[_0x349a('0x2f')];if(this[_0x349a('0xb')][_0x49edea[_0x349a('0x1d')]][_0x349a('0x2d')]>0x0){tiff2pdf(_0x49edea['filename'],'/var/opt/motion2/server/files/attachments/',function(_0xfb6099){logger[_0x349a('0x20')](_0x49edea[_0x349a('0x1d')],_0x349a('0x30'),_0xfb6099[_0x349a('0x31')]);attachment['create']({'name':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')],'basename':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')]+_0x349a('0x33'),'type':_0x349a('0x34')})['then'](function(_0x52a964){faxAccount[_0x349a('0x35')](_0x22d9c4,{'from':_0x49edea[_0x349a('0x2f')],'mapKey':_0x349a('0x36'),'body':path[_0x349a('0x32')](_0x49edea['filename'])[_0x349a('0x1f')]+_0x349a('0x33'),'AttachmentId':_0x52a964['id']})['catch'](function(_0x54df1c){logger[_0x349a('0x37')](_0x49edea[_0x349a('0x1d')],'\x20notify\x20',JSON[_0x349a('0x38')](_0x54df1c));});})[_0x349a('0x39')](function(_0x12e932){logger[_0x349a('0x37')](_0x49edea[_0x349a('0x1d')],_0x349a('0x3a'),JSON[_0x349a('0x38')](_0x12e932));});});}logger[_0x349a('0x20')](_0x49edea[_0x349a('0x1d')],_0x349a('0x3a'));}};Fax[_0x349a('0x1a')][_0x349a('0x19')]=function(_0x37b4a9){if(this[_0x349a('0x22')][_0x37b4a9[_0x349a('0x1d')]]){_[_0x349a('0x3b')](this[_0x349a('0xb')][_0x37b4a9[_0x349a('0x1d')]],_[_0x349a('0x3c')](_0x37b4a9,['response',_0x349a('0x3d')]));}};function updateStatus(_0x32485d){if(_0x32485d[_0x349a('0x3e')]){faxMessage[_0x349a('0x3f')](_0x32485d[_0x349a('0x3e')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x1e4da9){ut[_0x349a('0x40')]('[Fax][Message][Error][Updated]',_0x1e4da9);})[_0x349a('0x39')](function(_0x5c9eca){ut[_0x349a('0x40')](_0x349a('0x41'),_0x5c9eca);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x349a('0x1a')][_0x349a('0x42')]=function(_0x5aadab,_0xd9313,_0x4ca05c){var _0x2a7e08=this;var _0x30473c={};if(_0xd9313){_0x30473c={'read':_0xd9313};}else{_0x30473c={'failMessage':_0x4ca05c};}if(this[_0x349a('0x22')][_0x5aadab][_0x349a('0x3e')]){faxMessage[_0x349a('0x3f')](this[_0x349a('0x22')][_0x5aadab][_0x349a('0x3e')],_0x30473c)[_0x349a('0x43')](function(_0x157f3d){ut[_0x349a('0x40')](_0x349a('0x44'),_0x157f3d);})['catch'](function(_0x2e8b43){ut[_0x349a('0x40')](_0x349a('0x45'),_0x2e8b43);})['finally'](function(){delete _0x2a7e08['channels'][_0x5aadab];delete _0x2a7e08[_0x349a('0x22')][_0x5aadab];});}else{ut[_0x349a('0x40')]('[Fax][Message][NoUpdate2]');delete this[_0x349a('0xb')][_0x5aadab];delete this[_0x349a('0x22')][_0x5aadab];}};Fax['prototype'][_0x349a('0x46')]=function(_0x18e179){var _0x30619f=this;if(this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]){if(this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]]){this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]['id']=this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]]['id'];this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x1f')]=this[_0x349a('0x22')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x1f')];}logger[_0x349a('0x20')](_0x18e179['uniqueid'],this[_0x349a('0x22')][_0x18e179['uniqueid']]?_0x349a('0x47'):_0x349a('0x48'),JSON['stringify'](this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]]));if(this[_0x349a('0x22')][_0x18e179['uniqueid']]){if(this['channels'][_0x18e179['uniqueid']][_0x349a('0x49')]>0x0&&this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x15')]===_0x349a('0x4a')){this[_0x349a('0x42')](_0x18e179[_0x349a('0x1d')],!![]);}else{this[_0x349a('0x42')](_0x18e179[_0x349a('0x1d')],![],this[_0x349a('0xb')][_0x18e179[_0x349a('0x1d')]][_0x349a('0x4b')]?_0x349a('0x4c')+this['channels'][_0x18e179[_0x349a('0x1d')]][_0x349a('0x4b')]:'SENDING\x20FAILED');}}}};Fax[_0x349a('0x1a')][_0x349a('0x4d')]=function(_0x40917b){var _0x3f4e51=this;return new BPromise(function(_0xe1f958,_0x48c7ce){_0x3f4e51[_0x349a('0x4e')](_0x40917b,_0x3f4e51[_0x349a('0xc')][_0x40917b[_0x349a('0x4f')]])[_0x349a('0x43')](function(_0x5147c2){ut[_0x349a('0x40')]('[Fax][execOriginate][success]',_0x5147c2);_0xe1f958(ut['message'](_0x349a('0x50')));})[_0x349a('0x39')](function(_0x42a425){ut['logger'](_0x349a('0x51'),_0x42a425);updateStatus(_0x40917b);_0x48c7ce(ut[_0x349a('0x31')]('Fax\x20failed'));});});};Fax[_0x349a('0x1a')][_0x349a('0x52')]=function(_0x4e8012){var _0xdafd95=this;return new BPromise(function(_0x319494,_0x380c8c){var _0x56b71e=_0xdafd95[_0x349a('0x53')](_0xdafd95[_0x349a('0xc')][_0x4e8012[_0x349a('0x4f')]][_0x349a('0x54')],_0x4e8012);if(_0x56b71e['isValid']){_0x319494(ut['message'](_0x349a('0x55')));}else{_0x380c8c(ut[_0x349a('0x31')](_0x56b71e[_0x349a('0x31')]));}});};function originate(_0x1e52ab,_0x2ad9aa,_0x142f8b){return new BPromise(function(_0x1a0979,_0x264908){if(_0x142f8b){var _0x44c49b=util['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',path[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])['name'],_0x1e52ab[_0x349a('0x4')]);gs['execute'](_0x44c49b)[_0x349a('0x43')](function(){_0x1e52ab[_0x349a('0x4')]=util['format']('%s/%s.tif',path[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])[_0x349a('0x56')],path[_0x349a('0x32')](_0x1e52ab[_0x349a('0x4')])[_0x349a('0x1f')]);_0x2ad9aa['XMF-PATH']=_0x1e52ab[_0x349a('0x4')];ut[_0x349a('0x40')](_0x349a('0x57'),'');ami[_0x349a('0x58')](ut[_0x349a('0x59')](_0x1e52ab,_0x2ad9aa))[_0x349a('0x43')](function(_0x19feaa){_0x1a0979(_0x19feaa);})[_0x349a('0x39')](function(_0x55139f){_0x264908(_0x55139f);});})[_0x349a('0x39')](function(_0x2eadca){_0x264908(_0x2eadca);});}else{ami[_0x349a('0x58')](ut[_0x349a('0x59')](_0x1e52ab,_0x2ad9aa))[_0x349a('0x43')](function(_0x215283){_0x1a0979(_0x215283);})[_0x349a('0x39')](function(_0x1ef138){_0x264908(_0x1ef138);});}});}Fax[_0x349a('0x1a')][_0x349a('0x4e')]=function(_0x333f0b,_0x36efbf){var _0x3b3a5d=this;return new BPromise(function(_0xe45409,_0x113314){var _0x921487=uuid['v4']();var _0x18a8ae=ut[_0x349a('0x5a')](_0x333f0b,_0x36efbf);_0x3b3a5d[_0x349a('0x22')][_0x921487]=new Action(_0x921487,_0x36efbf,_0x333f0b);var _0x54fee0=_0x3b3a5d[_0x349a('0x22')][_0x921487];if(path[_0x349a('0x32')](_0x333f0b[_0x349a('0x4')])['ext']===_0x349a('0x33')){originate(_0x54fee0,_0x18a8ae,!![])[_0x349a('0x43')](function(_0x4cc617){_0xe45409(_0x4cc617);})['catch'](function(_0x3194e1){_0x113314(_0x3194e1);});}else{originate(_0x54fee0,_0x18a8ae,![])['then'](function(_0x47d445){_0xe45409(_0x47d445);})[_0x349a('0x39')](function(_0x386088){_0x113314(_0x386088);});}});};Fax['prototype'][_0x349a('0x5b')]=function(_0x8059a7){return!_['isNil'](_0x8059a7)&&!_[_0x349a('0x5c')](_0x8059a7['name'])&&!_[_0x349a('0x5c')](_0x8059a7[_0x349a('0x5d')])&&_0x8059a7[_0x349a('0x5d')]&&!_[_0x349a('0x5c')](this[_0x349a('0xd')][util[_0x349a('0x5e')](_0x349a('0x5f'),_0x8059a7['name'])])&&!_['isNil'](this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7['name'])]['status'])&&(this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7['name'])][_0x349a('0x2a')]===_0x349a('0x60')||this['trunks'][util[_0x349a('0x5e')]('SIP/%s',_0x8059a7[_0x349a('0x1f')])][_0x349a('0x2a')]==='unmonitored');};Fax[_0x349a('0x1a')]['checkTrunk']=function(_0x39d7fd,_0x5b7cff){if(!this[_0x349a('0x5b')](_0x39d7fd)){ut[_0x349a('0x40')](_0x349a('0x61'),_['isNil'](_0x39d7fd)?'':_0x39d7fd[_0x349a('0x1f')]+_0x349a('0x62'));return{'isValid':![],'message':_0x349a('0x63')};}if(_[_0x349a('0x5c')](_0x5b7cff[_0x349a('0x36')])){ut[_0x349a('0x40')](_0x349a('0x64'),JSON[_0x349a('0x38')](_0x5b7cff));return{'isValid':![],'message':_0x349a('0x65')};}if(_[_0x349a('0x5c')](_0x5b7cff[_0x349a('0x4')])){ut[_0x349a('0x40')](_0x349a('0x66'),JSON[_0x349a('0x38')](_0x5b7cff));return{'isValid':![],'message':_0x349a('0x67')};}return{'isValid':!![],'message':_0x349a('0x68')};};module[_0x349a('0x69')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 09d6882..a5a2a0c 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 _0x57d8=['catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','resolve','notify'];(function(_0x354e84,_0x5c4d75){var _0x1f4c0d=function(_0x57b180){while(--_0x57b180){_0x354e84['push'](_0x354e84['shift']());}};_0x1f4c0d(++_0x5c4d75);}(_0x57d8,0xda));var _0x857d=function(_0x1c8f67,_0x4412da){_0x1c8f67=_0x1c8f67-0x0;var _0x4fcd1e=_0x57d8[_0x1c8f67];return _0x4fcd1e;};'use strict';var util=require(_0x857d('0x0'));var BPromise=require(_0x857d('0x1'));var logger=require(_0x857d('0x2'))(_0x857d('0x3'));var _=require(_0x857d('0x4'));var faxAccount=require(_0x857d('0x5'));function loggerCatch(_0x102c01){return function(_0x1f19d1){logger[_0x857d('0x6')](_0x102c01,util[_0x857d('0x7')](_0x1f19d1,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4d7d09,_0x28f113){return BPromise[_0x857d('0x8')]()['then'](faxAccount[_0x857d('0x9')](_0x4d7d09,_0x28f113))[_0x857d('0xa')](loggerCatch(_0x857d('0xb')));}; \ No newline at end of file +var _0x4da6=['preview','lodash','../rpc/faxAccount','error','inspect','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4da6,0x19f));var _0x64da=function(_0x74b51,_0x29d611){_0x74b51=_0x74b51-0x0;var _0x4d8294=_0x4da6[_0x74b51];return _0x4d8294;};'use strict';var util=require(_0x64da('0x0'));var BPromise=require(_0x64da('0x1'));var logger=require(_0x64da('0x2'))(_0x64da('0x3'));var _=require(_0x64da('0x4'));var faxAccount=require(_0x64da('0x5'));function loggerCatch(_0x571d11){return function(_0x3ee117){logger[_0x64da('0x6')](_0x571d11,util[_0x64da('0x7')](_0x3ee117,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x3ee2a9,_0x368088){return BPromise[_0x64da('0x8')]()['then'](faxAccount['notify'](_0x3ee2a9,_0x368088))[_0x64da('0x9')](loggerCatch(_0x64da('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index bb42f53..0cf8ab6 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 _0xa4c8=['child_process','execute','info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird'];(function(_0x4c3b5f,_0x54bd99){var _0x124232=function(_0x4a0e30){while(--_0x4a0e30){_0x4c3b5f['push'](_0x4c3b5f['shift']());}};_0x124232(++_0x54bd99);}(_0xa4c8,0xdd));var _0x8a4c=function(_0xebcdce,_0x187b85){_0xebcdce=_0xebcdce-0x0;var _0x1f86fb=_0xa4c8[_0xebcdce];return _0x1f86fb;};'use strict';var util=require(_0x8a4c('0x0'));var logger=require(_0x8a4c('0x1'))(_0x8a4c('0x2'));var BPromise=require(_0x8a4c('0x3'));var exec=require(_0x8a4c('0x4'))['exec'];exports[_0x8a4c('0x5')]=function(_0x148a13){return new BPromise(function(_0x3bedb9,_0x420a32){exec(_0x148a13,function(_0x44f267,_0x452b64,_0x38d749){logger[_0x8a4c('0x6')](_0x8a4c('0x7'),_0x452b64);if(_0x44f267){logger[_0x8a4c('0x6')](_0x8a4c('0x7'),'\x20Error\x20:',util[_0x8a4c('0x8')](_0x44f267,{'showHidden':![],'depth':null}),_0x452b64,_0x38d749);_0x420a32(_0x44f267);}_0x3bedb9(_0x452b64);});});}; \ No newline at end of file +var _0x38c7=['inspect','util','../../../../config/logger','fax','bluebird','exec','execute','info','Exec\x20gs'];(function(_0x52977a,_0x55c0fc){var _0x40ff34=function(_0xe78186){while(--_0xe78186){_0x52977a['push'](_0x52977a['shift']());}};_0x40ff34(++_0x55c0fc);}(_0x38c7,0xa3));var _0x738c=function(_0x18c60e,_0x5e2258){_0x18c60e=_0x18c60e-0x0;var _0x27bc35=_0x38c7[_0x18c60e];return _0x27bc35;};'use strict';var util=require(_0x738c('0x0'));var logger=require(_0x738c('0x1'))(_0x738c('0x2'));var BPromise=require(_0x738c('0x3'));var exec=require('child_process')[_0x738c('0x4')];exports[_0x738c('0x5')]=function(_0x75dea9){return new BPromise(function(_0x28653c,_0x58d636){exec(_0x75dea9,function(_0x36146a,_0x3e2346,_0x4cbdc2){logger[_0x738c('0x6')]('Exec\x20gs',_0x3e2346);if(_0x36146a){logger[_0x738c('0x6')](_0x738c('0x7'),'\x20Error\x20:',util[_0x738c('0x8')](_0x36146a,{'showHidden':![],'depth':null}),_0x3e2346,_0x4cbdc2);_0x58d636(_0x36146a);}_0x28653c(_0x3e2346);});});}; \ 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 4851c4f..be01e11 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 _0x0b31=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','message','logger','info','inspect','addVariables','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x0b31,0x10d));var _0x10b3=function(_0x460362,_0xfd1c4e){_0x460362=_0x460362-0x0;var _0x19029b=_0x0b31[_0x460362];return _0x19029b;};'use strict';var util=require(_0x10b3('0x0'));var _=require(_0x10b3('0x1'));var moment=require(_0x10b3('0x2'));var logger=require('../../../../config/logger')(_0x10b3('0x3'));exports[_0x10b3('0x4')]=function(_0x1a9776){return{'message':_0x1a9776};};exports[_0x10b3('0x5')]=function(_0x47ae29,_0x3b4e89){logger[_0x10b3('0x6')](_0x47ae29,util[_0x10b3('0x7')](_0x3b4e89,{'showHidden':![],'depth':null}));};exports[_0x10b3('0x8')]=function(_0x25f128,_0x18edcf){var _0x57686c={'XMF-ECM':_0x18edcf['ecm'],'XMF-HEADERINFO':_0x18edcf[_0x10b3('0x9')],'XMF-MINRATE':_0x18edcf[_0x10b3('0xa')],'XMF-MAXRATE':_0x18edcf['maxrate'],'XMF-MODEM':util[_0x10b3('0xb')](_0x10b3('0xc'),_0x18edcf[_0x10b3('0xd')]),'XMF-GATEWAY':_0x18edcf[_0x10b3('0xe')],'XMF-FAXDETECT':_0x18edcf[_0x10b3('0xf')],'XMF-T38TIMEOUT':_0x18edcf[_0x10b3('0x10')],'XMF-LOCALSTATIONID':_0x18edcf[_0x10b3('0x11')],'XMF-PATH':_0x25f128[_0x10b3('0x12')]};return _0x57686c;};exports[_0x10b3('0x13')]=function(_0x29cf48,_0x1e41f4){return{'actionid':_0x29cf48[_0x10b3('0x14')],'action':_0x10b3('0x15'),'channel':_0x29cf48[_0x10b3('0x16')],'Exten':_0x10b3('0x17'),'Context':_0x10b3('0x18'),'Priority':'1','callerid':util[_0x10b3('0xb')](_0x10b3('0x19'),_0x29cf48[_0x10b3('0x9')]?_0x29cf48['headerinfo']:'',_0x29cf48[_0x10b3('0x11')]),'variable':_0x1e41f4,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x29cf48['uniqueid']};}; \ No newline at end of file +var _0xa64a=['gateway','t38timeout','localstationid','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','fax','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem'];(function(_0x133243,_0x5509f6){var _0x15beb2=function(_0x742932){while(--_0x742932){_0x133243['push'](_0x133243['shift']());}};_0x15beb2(++_0x5509f6);}(_0xa64a,0xa7));var _0xaa64=function(_0x12441f,_0x59468c){_0x12441f=_0x12441f-0x0;var _0x524fd5=_0xa64a[_0x12441f];return _0x524fd5;};'use strict';var util=require(_0xaa64('0x0'));var _=require(_0xaa64('0x1'));var moment=require(_0xaa64('0x2'));var logger=require('../../../../config/logger')(_0xaa64('0x3'));exports['message']=function(_0x43d6c4){return{'message':_0x43d6c4};};exports[_0xaa64('0x4')]=function(_0x5c760e,_0x35f011){logger['info'](_0x5c760e,util[_0xaa64('0x5')](_0x35f011,{'showHidden':![],'depth':null}));};exports[_0xaa64('0x6')]=function(_0x58e2b2,_0x3cc04a){var _0x5274c6={'XMF-ECM':_0x3cc04a[_0xaa64('0x7')],'XMF-HEADERINFO':_0x3cc04a[_0xaa64('0x8')],'XMF-MINRATE':_0x3cc04a[_0xaa64('0x9')],'XMF-MAXRATE':_0x3cc04a[_0xaa64('0xa')],'XMF-MODEM':util['format'](_0xaa64('0xb'),_0x3cc04a[_0xaa64('0xc')]),'XMF-GATEWAY':_0x3cc04a[_0xaa64('0xd')],'XMF-FAXDETECT':_0x3cc04a['faxdetect'],'XMF-T38TIMEOUT':_0x3cc04a[_0xaa64('0xe')],'XMF-LOCALSTATIONID':_0x3cc04a[_0xaa64('0xf')],'XMF-PATH':_0x58e2b2['path']};return _0x5274c6;};exports['variablesAction']=function(_0x38efda,_0x210c38){return{'actionid':_0x38efda[_0xaa64('0x10')],'action':'originate','channel':_0x38efda[_0xaa64('0x11')],'Exten':'xcally-motion-fax','Context':_0xaa64('0x12'),'Priority':'1','callerid':util['format'](_0xaa64('0x13'),_0x38efda['headerinfo']?_0x38efda[_0xaa64('0x8')]:'',_0x38efda[_0xaa64('0xf')]),'variable':_0x210c38,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x38efda[_0xaa64('0x10')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 20071e5..0793d91 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 _0x97ee=['get','hour','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','catch','log','listen','sync','util','moment','./server','./acw','./dialer','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger'];(function(_0x2b57c5,_0x5d75cb){var _0x25bf83=function(_0x33041e){while(--_0x33041e){_0x2b57c5['push'](_0x2b57c5['shift']());}};_0x25bf83(++_0x5d75cb);}(_0x97ee,0x1a5));var _0xe97e=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x97ee[_0x403c20];return _0x2b271a;};'use strict';var BPromise=require('bluebird');var util=require(_0xe97e('0x0'));var moment=require(_0xe97e('0x1'));var server=require(_0xe97e('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0xe97e('0x3'));var Trigger=require('./trigger');var Dialer=require(_0xe97e('0x4'));var Preview=require('./preview');var Fax=require('./fax');var user=require(_0xe97e('0x5'));var voiceQueue=require(_0xe97e('0x6'));var voiceQueueReport=require(_0xe97e('0x7'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0xe97e('0x8'));var template=require(_0xe97e('0x9'));var cmHopperHistory=require(_0xe97e('0xa'));var campaign=require(_0xe97e('0xb'));var voiceExtension=require(_0xe97e('0xc'));var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xe97e('0xd'));var salesforce=require(_0xe97e('0xe'));var sugarcrm=require(_0xe97e('0xf'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xe97e('0x10'));var zoho=require(_0xe97e('0x11'));var vtiger=require(_0xe97e('0x12'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe97e('0x13')](_0xe97e('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe97e('0x13')](_0xe97e('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe97e('0x15')](user[_0xe97e('0x16')]())[_0xe97e('0x15')](realtime['initAgents']())[_0xe97e('0x15')](user[_0xe97e('0x17')]())[_0xe97e('0x15')](realtime['initTelephones']())[_0xe97e('0x15')](trunk[_0xe97e('0x18')]())[_0xe97e('0x15')](realtime[_0xe97e('0x19')]())[_0xe97e('0x15')](voiceQueue[_0xe97e('0x1a')]())[_0xe97e('0x15')](realtime['initVoiceQueues']())[_0xe97e('0x15')](trigger[_0xe97e('0x1b')]())[_0xe97e('0x15')](realtime[_0xe97e('0x1c')]())[_0xe97e('0x15')](template[_0xe97e('0x1d')]())['then'](realtime[_0xe97e('0x1e')]())['then'](zendesk['getZendeskAccounts']())[_0xe97e('0x15')](realtime[_0xe97e('0x1f')]())['then'](salesforce[_0xe97e('0x20')]())[_0xe97e('0x15')](realtime[_0xe97e('0x21')]())[_0xe97e('0x15')](sugarcrm[_0xe97e('0x22')]())[_0xe97e('0x15')](realtime['initSugarcrmAccounts']())[_0xe97e('0x15')](freshdesk[_0xe97e('0x23')]())[_0xe97e('0x15')](realtime[_0xe97e('0x24')]())[_0xe97e('0x15')](desk[_0xe97e('0x25')]())[_0xe97e('0x15')](realtime[_0xe97e('0x26')]())[_0xe97e('0x15')](zoho[_0xe97e('0x27')]())[_0xe97e('0x15')](realtime[_0xe97e('0x28')]())[_0xe97e('0x15')](vtiger[_0xe97e('0x29')]())[_0xe97e('0x15')](realtime[_0xe97e('0x2a')]())[_0xe97e('0x15')](campaign[_0xe97e('0x2b')]())[_0xe97e('0x15')](realtime[_0xe97e('0x2c')]())[_0xe97e('0x15')](voiceExtension['getVoiceExtensions']())[_0xe97e('0x15')](realtime['initVoiceExtensions']())[_0xe97e('0x15')](faxAccount[_0xe97e('0x2d')]())[_0xe97e('0x15')](realtime[_0xe97e('0x2e')]())['then'](function(){return realtime;});}function initParams(){return BPromise[_0xe97e('0x2f')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xe97e('0x15')](realtime[_0xe97e('0x30')]())['then'](cmHopperHistory[_0xe97e('0x31')]())[_0xe97e('0x15')](realtime['initVoiceQueueHopperHistory']())[_0xe97e('0x15')](cmHopperHistory[_0xe97e('0x32')]())[_0xe97e('0x15')](realtime['initCampaignHopperHistory']())[_0xe97e('0x15')](voiceCallReport['getVoiceCallReports']())[_0xe97e('0x15')](realtime['initVoiceCallReports']())[_0xe97e('0x15')](function(_0x1561fb){})[_0xe97e('0x33')](function(_0x252885){console[_0xe97e('0x34')](_0x252885);});}function main(){return server[_0xe97e('0x35')](realtime,preview,fax)[_0xe97e('0x15')](function(_0x3f2d5d){return initRealtime();})['then'](function(){return initParams();})[_0xe97e('0x15')](function(){report[_0xe97e('0x36')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x324e5e){console[_0xe97e('0x34')](_0x324e5e);});}main(); \ No newline at end of file +var _0xc4cc=['getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','log','sync','catch','util','moment','./server','./report','./acw','./dialer','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','hour','get','then','getAgents','initAgents','getTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports'];(function(_0x2977e1,_0x4b43fc){var _0x56acda=function(_0x3a4b1b){while(--_0x3a4b1b){_0x2977e1['push'](_0x2977e1['shift']());}};_0x56acda(++_0x4b43fc);}(_0xc4cc,0x110));var _0xcc4c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc4cc[_0x432682];return _0x463d05;};'use strict';var BPromise=require('bluebird');var util=require(_0xcc4c('0x0'));var moment=require(_0xcc4c('0x1'));var server=require(_0xcc4c('0x2'));var Realtime=require('./realtime');var Report=require(_0xcc4c('0x3'));var Acw=require(_0xcc4c('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xcc4c('0x5'));var Preview=require('./preview');var Fax=require(_0xcc4c('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xcc4c('0x7'));var voiceCallReport=require(_0xcc4c('0x8'));var trunk=require('./rpc/trunk');var trigger=require(_0xcc4c('0x9'));var template=require(_0xcc4c('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xcc4c('0xb'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xcc4c('0xc'));var zendesk=require(_0xcc4c('0xd'));var salesforce=require(_0xcc4c('0xe'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xcc4c('0xf'));var zoho=require(_0xcc4c('0x10'));var vtiger=require('./rpc/integrations/vtiger');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0xcc4c('0x11'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xcc4c('0x12')](_0xcc4c('0x11'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xcc4c('0x13')](user[_0xcc4c('0x14')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x15')]())['then'](user[_0xcc4c('0x16')]())[_0xcc4c('0x13')](realtime['initTelephones']())[_0xcc4c('0x13')](trunk[_0xcc4c('0x17')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x18')]())[_0xcc4c('0x13')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xcc4c('0x19')]())[_0xcc4c('0x13')](trigger[_0xcc4c('0x1a')]())[_0xcc4c('0x13')](realtime['initTriggers']())['then'](template[_0xcc4c('0x1b')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x1c')]())['then'](zendesk[_0xcc4c('0x1d')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x1e')]())[_0xcc4c('0x13')](salesforce[_0xcc4c('0x1f')]())['then'](realtime['initSalesforceAccounts']())[_0xcc4c('0x13')](sugarcrm[_0xcc4c('0x20')]())['then'](realtime[_0xcc4c('0x21')]())['then'](freshdesk[_0xcc4c('0x22')]())['then'](realtime[_0xcc4c('0x23')]())[_0xcc4c('0x13')](desk['getDeskAccounts']())['then'](realtime[_0xcc4c('0x24')]())['then'](zoho[_0xcc4c('0x25')]())[_0xcc4c('0x13')](realtime['initZohoAccounts']())[_0xcc4c('0x13')](vtiger[_0xcc4c('0x26')]())['then'](realtime['initVtigerAccounts']())[_0xcc4c('0x13')](campaign[_0xcc4c('0x27')]())[_0xcc4c('0x13')](realtime['initCampaigns']())[_0xcc4c('0x13')](voiceExtension[_0xcc4c('0x28')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x29')]())[_0xcc4c('0x13')](faxAccount[_0xcc4c('0x2a')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x2b')]())['then'](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0xcc4c('0x13')](voiceQueueReport[_0xcc4c('0x2c')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x2d')]())['then'](cmHopperHistory[_0xcc4c('0x2e')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0xcc4c('0x13')](cmHopperHistory[_0xcc4c('0x2f')]())[_0xcc4c('0x13')](realtime[_0xcc4c('0x30')]())['then'](voiceCallReport['getVoiceCallReports']())[_0xcc4c('0x13')](realtime[_0xcc4c('0x31')]())[_0xcc4c('0x13')](function(_0x102c80){})['catch'](function(_0x5b3917){console[_0xcc4c('0x32')](_0x5b3917);});}function main(){return server['listen'](realtime,preview,fax)[_0xcc4c('0x13')](function(_0x385c61){return initRealtime();})[_0xcc4c('0x13')](function(){return initParams();})[_0xcc4c('0x13')](function(){report[_0xcc4c('0x33')]();setInterval(initRealtime,0x1388);})[_0xcc4c('0x34')](function(_0x52f24b){console[_0xcc4c('0x32')](_0x52f24b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 355c48c..e922553 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 _0xa1ff=['user:save','exports','lodash','util','moment','md5','socket.io-emitter','localhost','name','email','fullname','state','unknown','address','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','talking','voiceStatus','statePause','format','accountcode','stringify','user:%s','emit'];(function(_0x1eb60b,_0x3b279e){var _0x4f6d44=function(_0x8e36ba){while(--_0x8e36ba){_0x1eb60b['push'](_0x1eb60b['shift']());}};_0x4f6d44(++_0x3b279e);}(_0xa1ff,0xa2));var _0xfa1f=function(_0x2d069d,_0x52790a){_0x2d069d=_0x2d069d-0x0;var _0x8a2ada=_0xa1ff[_0x2d069d];return _0x8a2ada;};'use strict';var _=require(_0xfa1f('0x0'));var util=require(_0xfa1f('0x1'));var moment=require(_0xfa1f('0x2'));var md5=require(_0xfa1f('0x3'));var io=require(_0xfa1f('0x4'))({'host':_0xfa1f('0x5'),'port':0x18eb});function Agent(_0x235921){this['id']=_0x235921['id']||0x0;this[_0xfa1f('0x6')]=_0x235921[_0xfa1f('0x6')]||'';this[_0xfa1f('0x7')]=_0x235921[_0xfa1f('0x7')]||'';this['accountcode']=_0x235921['accountcode']||'';this[_0xfa1f('0x8')]=_0x235921[_0xfa1f('0x8')]||'';this[_0xfa1f('0x9')]=_0xfa1f('0xa');this['stateTime']=0x0;this['status']='unknown';this[_0xfa1f('0xb')]='';this['phone']='';this[_0xfa1f('0xc')]='';this[_0xfa1f('0xd')]=_0x235921[_0xfa1f('0xd')]||![];this['voiceStatus']=_0xfa1f('0xa');this[_0xfa1f('0xe')]=0x0;this[_0xfa1f('0xf')]='';this[_0xfa1f('0x10')]='';this[_0xfa1f('0x11')]=![];this[_0xfa1f('0x3')]='';}Agent[_0xfa1f('0x12')][_0xfa1f('0x13')]=function(_0x486567){var _0x5904fd;if(_0x486567&&_0x486567['state']){_0x5904fd=_0x486567[_0xfa1f('0x9')][_0xfa1f('0x14')]();switch(_0x5904fd){case _0xfa1f('0x15'):_0x5904fd='idle';break;case'inuse':_0x5904fd=_0xfa1f('0x16');break;}}if(_0x5904fd&&this[_0xfa1f('0x17')]!==_0x5904fd||_0x486567[_0xfa1f('0x18')]){this[_0xfa1f('0xe')]=_['toNumber'](moment()[_0xfa1f('0x19')]('x'));}if(_0x5904fd){this[_0xfa1f('0x17')]=_0x5904fd;}var _0xc7341b={'id':this['id'],'name':this[_0xfa1f('0x6')],'email':this[_0xfa1f('0x7')],'accountcode':this[_0xfa1f('0x1a')],'fullname':this[_0xfa1f('0x8')],'state':this[_0xfa1f('0x9')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0xfa1f('0xd')],'voiceStatus':this[_0xfa1f('0x17')],'voiceStatusTime':this[_0xfa1f('0xe')],'voiceStatusCallerIdNumber':this[_0xfa1f('0xf')],'voiceStatusQueue':this[_0xfa1f('0x10')]};var _0x4fdba9=md5(JSON[_0xfa1f('0x1b')](_0xc7341b));if(this['md5']!==_0x4fdba9){this['md5']=_0x4fdba9;io['to'](util['format'](_0xfa1f('0x1c'),_0xc7341b[_0xfa1f('0x6')]))[_0xfa1f('0x1d')](_0xfa1f('0x1e'),_0xc7341b);}};module[_0xfa1f('0x1f')]=Agent; \ No newline at end of file +var _0x2bc2=['email','accountcode','fullname','state','unknown','stateTime','address','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','toLowerCase','not_inuse','idle','inuse','statePause','status','format','user:%s','emit','exports','lodash','util','moment','md5','localhost','name'];(function(_0x2a1f5c,_0x49b13f){var _0x43ce3d=function(_0x66f0bd){while(--_0x66f0bd){_0x2a1f5c['push'](_0x2a1f5c['shift']());}};_0x43ce3d(++_0x49b13f);}(_0x2bc2,0x1cb));var _0x22bc=function(_0x3d1082,_0x5b6160){_0x3d1082=_0x3d1082-0x0;var _0x1dc252=_0x2bc2[_0x3d1082];return _0x1dc252;};'use strict';var _=require(_0x22bc('0x0'));var util=require(_0x22bc('0x1'));var moment=require(_0x22bc('0x2'));var md5=require(_0x22bc('0x3'));var io=require('socket.io-emitter')({'host':_0x22bc('0x4'),'port':0x18eb});function Agent(_0x2bf311){this['id']=_0x2bf311['id']||0x0;this[_0x22bc('0x5')]=_0x2bf311[_0x22bc('0x5')]||'';this[_0x22bc('0x6')]=_0x2bf311[_0x22bc('0x6')]||'';this['accountcode']=_0x2bf311[_0x22bc('0x7')]||'';this[_0x22bc('0x8')]=_0x2bf311[_0x22bc('0x8')]||'';this[_0x22bc('0x9')]=_0x22bc('0xa');this[_0x22bc('0xb')]=0x0;this['status']=_0x22bc('0xa');this[_0x22bc('0xc')]='';this['phone']='';this[_0x22bc('0xd')]='';this['online']=_0x2bf311[_0x22bc('0xe')]||![];this[_0x22bc('0xf')]=_0x22bc('0xa');this[_0x22bc('0x10')]=0x0;this[_0x22bc('0x11')]='';this[_0x22bc('0x12')]='';this[_0x22bc('0x13')]=![];this['md5']='';}Agent[_0x22bc('0x14')]['updateStatusRealtime']=function(_0x19942b){var _0x30d252;if(_0x19942b&&_0x19942b[_0x22bc('0x9')]){_0x30d252=_0x19942b[_0x22bc('0x9')][_0x22bc('0x15')]();switch(_0x30d252){case _0x22bc('0x16'):_0x30d252=_0x22bc('0x17');break;case _0x22bc('0x18'):_0x30d252='talking';break;}}if(_0x30d252&&this[_0x22bc('0xf')]!==_0x30d252||_0x19942b[_0x22bc('0x19')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x30d252){this[_0x22bc('0xf')]=_0x30d252;}var _0x3096c4={'id':this['id'],'name':this[_0x22bc('0x5')],'email':this[_0x22bc('0x6')],'accountcode':this['accountcode'],'fullname':this[_0x22bc('0x8')],'state':this[_0x22bc('0x9')],'stateTime':this[_0x22bc('0xb')],'status':this[_0x22bc('0x1a')],'address':this[_0x22bc('0xc')],'online':this[_0x22bc('0xe')],'voiceStatus':this[_0x22bc('0xf')],'voiceStatusTime':this[_0x22bc('0x10')],'voiceStatusCallerIdNumber':this[_0x22bc('0x11')],'voiceStatusQueue':this[_0x22bc('0x12')]};var _0x547ac6=md5(JSON['stringify'](_0x3096c4));if(this['md5']!==_0x547ac6){this[_0x22bc('0x3')]=_0x547ac6;io['to'](util[_0x22bc('0x1b')](_0x22bc('0x1c'),_0x3096c4[_0x22bc('0x5')]))[_0x22bc('0x1d')]('user:save',_0x3096c4);}};module[_0x22bc('0x1e')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 55fd96b..8ed542d 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 _0xd845=['originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign'];(function(_0x537104,_0x35edb9){var _0x4147a5=function(_0x33aae5){while(--_0x33aae5){_0x537104['push'](_0x537104['shift']());}};_0x4147a5(++_0x35edb9);}(_0xd845,0x135));var _0x5d84=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xd845[_0x311c35];return _0x5cc50c;};'use strict';function Campaign(_0x16052d){this['id']=_0x16052d['id']||0x0;this[_0x5d84('0x0')]=_0x16052d[_0x5d84('0x0')]||'';this[_0x5d84('0x1')]=_0x16052d['type']||_0x5d84('0x2');this[_0x5d84('0x3')]=0x0;this[_0x5d84('0x4')]=0x0;this[_0x5d84('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5d84('0x6')]='';this[_0x5d84('0x7')]=!![];this[_0x5d84('0x8')]=_0x16052d[_0x5d84('0x8')];this[_0x5d84('0x9')]=_0x16052d[_0x5d84('0x9')];this['dialTimezone']=_0x16052d[_0x5d84('0xa')]||null;this['dialGlobalInterval']=_0x16052d[_0x5d84('0xb')]?_0x16052d[_0x5d84('0xb')]:null;this['dialOriginateCallerIdName']=_0x16052d[_0x5d84('0xc')];this[_0x5d84('0xd')]=_0x16052d['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x16052d[_0x5d84('0xe')]||0x1e;this[_0x5d84('0xf')]=_0x16052d[_0x5d84('0xf')];this[_0x5d84('0x10')]=_0x16052d[_0x5d84('0x10')];this['dialBusyMaxRetry']=_0x16052d[_0x5d84('0x11')];this[_0x5d84('0x12')]=_0x16052d[_0x5d84('0x12')];this[_0x5d84('0x13')]=_0x16052d[_0x5d84('0x13')];this[_0x5d84('0x14')]=_0x16052d['dialNoAnswerRetryFrequency'];this[_0x5d84('0x15')]=_0x16052d['dialGlobalMaxRetry'];this[_0x5d84('0x16')]=_0x16052d[_0x5d84('0x16')]||_0x5d84('0x17');this['dialPrefix']=_0x16052d[_0x5d84('0x18')]||undefined;this[_0x5d84('0x19')]=_0x16052d[_0x5d84('0x19')]||undefined;this[_0x5d84('0x1a')]=_0x16052d[_0x5d84('0x1a')]||undefined;this['TrunkBackup']=_0x16052d[_0x5d84('0x1b')]?_0x16052d['TrunkBackup']:undefined;this[_0x5d84('0x1c')]=_0x16052d['Trunk']?_0x16052d[_0x5d84('0x1c')]:undefined;this[_0x5d84('0x1d')]=_0x16052d[_0x5d84('0x1d')]?_0x16052d[_0x5d84('0x1d')]:undefined;this[_0x5d84('0x1e')]=_0x16052d[_0x5d84('0x1e')]?_0x16052d[_0x5d84('0x1e')]:undefined;this['dialQueueProject']=_0x16052d['SquareProject']?_0x16052d['SquareProject'][_0x5d84('0x0')]:undefined;this[_0x5d84('0x1f')]=_0x16052d[_0x5d84('0x1f')]||![];this[_0x5d84('0x20')]=_0x16052d[_0x5d84('0x20')];this[_0x5d84('0x21')]=_0x16052d[_0x5d84('0x21')];this['dialAMDAfterGreetingSilence']=_0x16052d['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x16052d['dialAMDTotalAnalysisTime'];this[_0x5d84('0x22')]=_0x16052d['dialAMDMinWordLength'];this[_0x5d84('0x23')]=_0x16052d[_0x5d84('0x23')];this[_0x5d84('0x24')]=_0x16052d[_0x5d84('0x24')];this[_0x5d84('0x25')]=_0x16052d['dialAMDSilenceThreshold'];this[_0x5d84('0x26')]=_0x16052d[_0x5d84('0x26')];}module['exports']=Campaign; \ No newline at end of file +var _0x780f=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x780f,0x6c));var _0xf780=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x780f[_0x22e9fe];return _0x47cd19;};'use strict';function Campaign(_0x37c848){this['id']=_0x37c848['id']||0x0;this[_0xf780('0x0')]=_0x37c848[_0xf780('0x0')]||'';this[_0xf780('0x1')]=_0x37c848[_0xf780('0x1')]||'campaign';this['originated']=0x0;this[_0xf780('0x2')]=0x0;this[_0xf780('0x3')]=0x0;this[_0xf780('0x4')]=0x0;this[_0xf780('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0xf780('0x6')]=_0x37c848['active'];this[_0xf780('0x7')]=_0x37c848[_0xf780('0x7')];this[_0xf780('0x8')]=_0x37c848[_0xf780('0x8')]||null;this[_0xf780('0x9')]=_0x37c848[_0xf780('0x9')]?_0x37c848['dialGlobalInterval']:null;this[_0xf780('0xa')]=_0x37c848[_0xf780('0xa')];this[_0xf780('0xb')]=_0x37c848[_0xf780('0xb')];this[_0xf780('0xc')]=_0x37c848[_0xf780('0xc')]||0x1e;this[_0xf780('0xd')]=_0x37c848['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x37c848[_0xf780('0xe')];this[_0xf780('0xf')]=_0x37c848[_0xf780('0xf')];this[_0xf780('0x10')]=_0x37c848['dialBusyRetryFrequency'];this[_0xf780('0x11')]=_0x37c848[_0xf780('0x11')];this[_0xf780('0x12')]=_0x37c848[_0xf780('0x12')];this['dialGlobalMaxRetry']=_0x37c848[_0xf780('0x13')];this['dialOrderByScheduledAt']=_0x37c848[_0xf780('0x14')]||_0xf780('0x15');this[_0xf780('0x16')]=_0x37c848[_0xf780('0x16')]||undefined;this[_0xf780('0x17')]=_0x37c848[_0xf780('0x17')]||undefined;this[_0xf780('0x18')]=_0x37c848['dialCutDigit']||undefined;this[_0xf780('0x19')]=_0x37c848[_0xf780('0x19')]?_0x37c848[_0xf780('0x19')]:undefined;this[_0xf780('0x1a')]=_0x37c848[_0xf780('0x1a')]?_0x37c848[_0xf780('0x1a')]:undefined;this['Interval']=_0x37c848[_0xf780('0x1b')]?_0x37c848[_0xf780('0x1b')]:undefined;this['SquareProject']=_0x37c848[_0xf780('0x1c')]?_0x37c848[_0xf780('0x1c')]:undefined;this['dialQueueProject']=_0x37c848[_0xf780('0x1c')]?_0x37c848[_0xf780('0x1c')][_0xf780('0x0')]:undefined;this[_0xf780('0x1d')]=_0x37c848[_0xf780('0x1d')]||![];this[_0xf780('0x1e')]=_0x37c848['dialAMDInitialSilence'];this[_0xf780('0x1f')]=_0x37c848['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x37c848[_0xf780('0x20')];this[_0xf780('0x21')]=_0x37c848[_0xf780('0x21')];this['dialAMDMinWordLength']=_0x37c848[_0xf780('0x22')];this[_0xf780('0x23')]=_0x37c848['dialAMDBetweenWordsSilence'];this[_0xf780('0x24')]=_0x37c848['dialAMDMaximumNumberOfWords'];this[_0xf780('0x25')]=_0x37c848[_0xf780('0x25')];this['dialAMDMaximumWordLength']=_0x37c848['dialAMDMaximumWordLength'];}module[_0xf780('0x26')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index bc0ebd7..16e8942 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 _0x43c4=['calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','answered','endtime','lastdata','duration','billableseconds','holdtime','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','channel','destinationchannel','calleridnum'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x43c4,0xf7));var _0x443c=function(_0x39030f,_0x39643b){_0x39030f=_0x39030f-0x0;var _0x4c24d6=_0x43c4[_0x39030f];return _0x4c24d6;};'use strict';function Channel(){this['starttime']=null;this[_0x443c('0x0')]='';this[_0x443c('0x1')]='';this[_0x443c('0x2')]=0x0;this[_0x443c('0x3')]='';this[_0x443c('0x4')]=undefined;this[_0x443c('0x5')]=undefined;this[_0x443c('0x6')]=0x0;this[_0x443c('0x7')]='';this[_0x443c('0x8')]=0x0;this['linkedid']=0x0;this[_0x443c('0x9')]=0x0;this[_0x443c('0xa')]=![];this['answertime']=null;this[_0x443c('0xb')]=null;this['unmanaged']=![];this['lastapplication']='';this[_0x443c('0xc')]='';this[_0x443c('0xd')]=0x0;this[_0x443c('0xe')]=0x0;this[_0x443c('0xf')]=0x0;this['type']=null;this[_0x443c('0x10')]=null;this[_0x443c('0x11')]=null;this['monitor']=![];this[_0x443c('0x12')]=null;this[_0x443c('0x13')]=null;this[_0x443c('0x14')]=[];this[_0x443c('0x15')]=undefined;this[_0x443c('0x16')]=undefined;this[_0x443c('0x17')]=0x0;}module[_0x443c('0x18')]=Channel; \ No newline at end of file +var _0x9303=['disposition','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','connectedlinenum','context','uniqueid','linkedid','exten','answertime','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9303,0xd7));var _0x3930=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x9303[_0x4f5108];return _0x2d56ca;};'use strict';function Channel(){this[_0x3930('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x3930('0x1')]=0x0;this['calleridname']='';this[_0x3930('0x2')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0x3930('0x3')]='';this[_0x3930('0x4')]=0x0;this[_0x3930('0x5')]=0x0;this[_0x3930('0x6')]=0x0;this['answered']=![];this[_0x3930('0x7')]=null;this['endtime']=null;this['unmanaged']=![];this[_0x3930('0x8')]='';this[_0x3930('0x9')]='';this[_0x3930('0xa')]=0x0;this[_0x3930('0xb')]=0x0;this[_0x3930('0xc')]=0x0;this['type']=null;this['tag']=null;this[_0x3930('0xd')]=null;this['monitor']=![];this['monitorFilename']=null;this['queue']=null;this[_0x3930('0xe')]=[];this[_0x3930('0xf')]=undefined;this[_0x3930('0x10')]=undefined;this[_0x3930('0x11')]=0x0;}module[_0x3930('0x12')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dafd5cf..8a8ddd1 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 _0x25d2=['type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret'];(function(_0x36103d,_0x3453b9){var _0x4edadd=function(_0x1b6e64){while(--_0x1b6e64){_0x36103d['push'](_0x36103d['shift']());}};_0x4edadd(++_0x3453b9);}(_0x25d2,0x1cb));var _0x225d=function(_0x4ff319,_0x41f013){_0x4ff319=_0x4ff319-0x0;var _0x4af6d2=_0x25d2[_0x4ff319];return _0x4af6d2;};'use strict';function DeskAccount(_0x16e20f){this['id']=_0x16e20f['id']||0x0;this[_0x225d('0x0')]=_0x16e20f[_0x225d('0x0')]||'';this[_0x225d('0x1')]=_0x16e20f['username']||'';this[_0x225d('0x2')]=_0x16e20f['remoteUri']||'';this[_0x225d('0x3')]=_0x16e20f[_0x225d('0x3')]||'';this['password']=_0x16e20f[_0x225d('0x4')]||'';this['consumerKey']=_0x16e20f[_0x225d('0x5')]||'';this[_0x225d('0x6')]=_0x16e20f[_0x225d('0x6')]||'';this[_0x225d('0x7')]=_0x16e20f[_0x225d('0x7')]||'';this[_0x225d('0x8')]=_0x16e20f[_0x225d('0x8')]||'';this[_0x225d('0x9')]=_0x16e20f[_0x225d('0x9')]||'';this[_0x225d('0xa')]=_0x16e20f[_0x225d('0xa')]||'';this[_0x225d('0xb')]=_0x16e20f['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0xad0c=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x352b44,_0x4a91a1){var _0x3e8baa=function(_0xed4bc3){while(--_0xed4bc3){_0x352b44['push'](_0x352b44['shift']());}};_0x3e8baa(++_0x4a91a1);}(_0xad0c,0xce));var _0xcad0=function(_0x2197c1,_0x5d09a5){_0x2197c1=_0x2197c1-0x0;var _0x438d1e=_0xad0c[_0x2197c1];return _0x438d1e;};'use strict';function DeskAccount(_0x71f4d6){this['id']=_0x71f4d6['id']||0x0;this['name']=_0x71f4d6[_0xcad0('0x0')]||'';this['username']=_0x71f4d6[_0xcad0('0x1')]||'';this['remoteUri']=_0x71f4d6[_0xcad0('0x2')]||'';this[_0xcad0('0x3')]=_0x71f4d6['authType']||'';this['password']=_0x71f4d6[_0xcad0('0x4')]||'';this[_0xcad0('0x5')]=_0x71f4d6['consumerKey']||'';this[_0xcad0('0x6')]=_0x71f4d6[_0xcad0('0x6')]||'';this['token']=_0x71f4d6[_0xcad0('0x7')]||'';this[_0xcad0('0x8')]=_0x71f4d6['tokenSecret']||'';this['type']=_0x71f4d6[_0xcad0('0x9')]||'';this[_0xcad0('0xa')]=_0x71f4d6[_0xcad0('0xa')]||'';this[_0xcad0('0xb')]=_0x71f4d6[_0xcad0('0xb')]||{};}module[_0xcad0('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c8fd4c8..e23e29e 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 _0x5ec6=['faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x1e356c,_0x1761c5){var _0x386592=function(_0x55e079){while(--_0x55e079){_0x1e356c['push'](_0x1e356c['shift']());}};_0x386592(++_0x1761c5);}(_0x5ec6,0x7f));var _0x65ec=function(_0x1df3f5,_0x9a45c5){_0x1df3f5=_0x1df3f5-0x0;var _0x559817=_0x5ec6[_0x1df3f5];return _0x559817;};'use strict';function FaxAccount(_0x167624){this['id']=_0x167624['id']||0x0;this[_0x65ec('0x0')]=_0x167624[_0x65ec('0x0')]||'';this['description']=_0x167624[_0x65ec('0x1')];this['ecm']=_0x167624[_0x65ec('0x2')];this['headerinfo']=_0x167624[_0x65ec('0x3')];this['localstationid']=_0x167624[_0x65ec('0x4')];this['minrate']=_0x167624[_0x65ec('0x5')]||0x960;this[_0x65ec('0x6')]=_0x167624['maxrate']||0x3840;this[_0x65ec('0x7')]=_0x167624[_0x65ec('0x7')]||'v17,v27,v29';this[_0x65ec('0x8')]=_0x167624[_0x65ec('0x8')]||'no';this[_0x65ec('0x9')]=_0x167624['faxdetect']||'no';this['t38timeout']=_0x167624[_0x65ec('0xa')]||0x1388;this['tech']=_0x167624[_0x65ec('0xb')]||_0x65ec('0xc');this['Trunk']=_0x167624[_0x65ec('0xd')]?_0x167624[_0x65ec('0xd')]:undefined;this['ListId']=_0x167624[_0x65ec('0xe')];this[_0x65ec('0xf')]=_0x167624['key'];}module[_0x65ec('0x10')]=FaxAccount; \ No newline at end of file +var _0xb4e6=['Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','v17,v27,v29','faxdetect','t38timeout','tech','SIP'];(function(_0x38c178,_0x336c72){var _0x1beb1c=function(_0xce7e21){while(--_0xce7e21){_0x38c178['push'](_0x38c178['shift']());}};_0x1beb1c(++_0x336c72);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0xb4e6[_0x52e0ee];return _0x32534c;};'use strict';function FaxAccount(_0x54acd0){this['id']=_0x54acd0['id']||0x0;this['name']=_0x54acd0[_0x6b4e('0x0')]||'';this[_0x6b4e('0x1')]=_0x54acd0[_0x6b4e('0x1')];this[_0x6b4e('0x2')]=_0x54acd0[_0x6b4e('0x2')];this[_0x6b4e('0x3')]=_0x54acd0[_0x6b4e('0x3')];this['localstationid']=_0x54acd0[_0x6b4e('0x4')];this[_0x6b4e('0x5')]=_0x54acd0[_0x6b4e('0x5')]||0x960;this['maxrate']=_0x54acd0[_0x6b4e('0x6')]||0x3840;this['modem']=_0x54acd0['modem']||_0x6b4e('0x7');this['gateway']=_0x54acd0['gateway']||'no';this[_0x6b4e('0x8')]=_0x54acd0[_0x6b4e('0x8')]||'no';this[_0x6b4e('0x9')]=_0x54acd0[_0x6b4e('0x9')]||0x1388;this[_0x6b4e('0xa')]=_0x54acd0[_0x6b4e('0xa')]||_0x6b4e('0xb');this['Trunk']=_0x54acd0[_0x6b4e('0xc')]?_0x54acd0[_0x6b4e('0xc')]:undefined;this['ListId']=_0x54acd0[_0x6b4e('0xd')];this[_0x6b4e('0xe')]=_0x54acd0[_0x6b4e('0xe')];}module[_0x6b4e('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 c4b1929..a8e4c85 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 _0x593b=['name','username','apiKey','token','serverUrl','Configurations'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x593b,0x6c));var _0xb593=function(_0x4d0cf4,_0x1513d5){_0x4d0cf4=_0x4d0cf4-0x0;var _0x35bb91=_0x593b[_0x4d0cf4];return _0x35bb91;};'use strict';function FreshdeskAccount(_0x5eb3ed){this['id']=_0x5eb3ed['id']||0x0;this[_0xb593('0x0')]=_0x5eb3ed[_0xb593('0x0')]||'';this[_0xb593('0x1')]=_0x5eb3ed[_0xb593('0x1')]||'';this[_0xb593('0x2')]=_0x5eb3ed[_0xb593('0x3')]||'';this['remoteUri']=_0x5eb3ed['remoteUri']||'';this['serverUrl']=_0x5eb3ed[_0xb593('0x4')]||'';this[_0xb593('0x5')]=_0x5eb3ed['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xd8ad=['name','username','apiKey','remoteUri','serverUrl','exports'];(function(_0x352ae4,_0x40ad77){var _0x3da615=function(_0x4eb31d){while(--_0x4eb31d){_0x352ae4['push'](_0x352ae4['shift']());}};_0x3da615(++_0x40ad77);}(_0xd8ad,0x138));var _0xdd8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xd8ad[_0x543084];return _0x306a57;};'use strict';function FreshdeskAccount(_0x246c07){this['id']=_0x246c07['id']||0x0;this[_0xdd8a('0x0')]=_0x246c07['name']||'';this[_0xdd8a('0x1')]=_0x246c07[_0xdd8a('0x1')]||'';this[_0xdd8a('0x2')]=_0x246c07['token']||'';this[_0xdd8a('0x3')]=_0x246c07['remoteUri']||'';this[_0xdd8a('0x4')]=_0x246c07[_0xdd8a('0x4')]||'';this['Configurations']=_0x246c07['Configurations']||{};}module[_0xdd8a('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index b8f12b7..6d813ae 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 _0x173d=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinenum','context','exten','holdtime','assigned','mohtime','variables','exports','inbound','calleridname'];(function(_0x459423,_0x3416a8){var _0x42ed14=function(_0x1d4f69){while(--_0x1d4f69){_0x459423['push'](_0x459423['shift']());}};_0x42ed14(++_0x3416a8);}(_0x173d,0x108));var _0xd173=function(_0x34bf1e,_0x3ca989){_0x34bf1e=_0x34bf1e-0x0;var _0x5df9ad=_0x173d[_0x34bf1e];return _0x5df9ad;};'use strict';function QueueReport(){this['type']=_0xd173('0x0');this['uniqueid']='';this['calleridnum']='';this[_0xd173('0x1')]='';this['queue']='';this[_0xd173('0x2')]=null;this[_0xd173('0x3')]=null;this[_0xd173('0x4')]=0x1;this[_0xd173('0x5')]=0x1;this[_0xd173('0x6')]=![];this['queuecallerabandonAt']=null;this[_0xd173('0x7')]=![];this[_0xd173('0x8')]=null;this[_0xd173('0x9')]=![];this['queuecallerexitAt']=null;this[_0xd173('0xa')]=0x1;this['channel']='';this[_0xd173('0xb')]='';this['connectedlinename']='';this['accountcode']='';this[_0xd173('0xc')]='';this[_0xd173('0xd')]='';this['priority']='';this[_0xd173('0xe')]=0x0;this[_0xd173('0xf')]=![];this['lastAssignedTo']='';this[_0xd173('0x10')]=0x0;this[_0xd173('0x11')]={};}module[_0xd173('0x12')]=QueueReport; \ No newline at end of file +var _0xb3cf=['assigned','lastAssignedTo','mohtime','variables','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinename','accountcode','context','exten','priority'];(function(_0x4c78a3,_0x40c9ff){var _0x53c50f=function(_0xc5eccd){while(--_0xc5eccd){_0x4c78a3['push'](_0x4c78a3['shift']());}};_0x53c50f(++_0x40c9ff);}(_0xb3cf,0xe0));var _0xfb3c=function(_0x4e2afd,_0x246d1c){_0x4e2afd=_0x4e2afd-0x0;var _0x39539b=_0xb3cf[_0x4e2afd];return _0x39539b;};'use strict';function QueueReport(){this['type']='inbound';this[_0xfb3c('0x0')]='';this[_0xfb3c('0x1')]='';this[_0xfb3c('0x2')]='';this[_0xfb3c('0x3')]='';this[_0xfb3c('0x4')]=null;this[_0xfb3c('0x5')]=null;this[_0xfb3c('0x6')]=0x1;this[_0xfb3c('0x7')]=0x1;this['queuecallerabandon']=![];this['queuecallerabandonAt']=null;this[_0xfb3c('0x8')]=![];this['queuecallercompleteAt']=null;this[_0xfb3c('0x9')]=![];this[_0xfb3c('0xa')]=null;this[_0xfb3c('0xb')]=0x1;this[_0xfb3c('0xc')]='';this['connectedlinenum']='';this[_0xfb3c('0xd')]='';this[_0xfb3c('0xe')]='';this[_0xfb3c('0xf')]='';this[_0xfb3c('0x10')]='';this[_0xfb3c('0x11')]='';this['holdtime']=0x0;this[_0xfb3c('0x12')]=![];this[_0xfb3c('0x13')]='';this[_0xfb3c('0x14')]=0x0;this[_0xfb3c('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index b677b74..24ebc3f 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 _0x39b0=['securityToken','type','serverUrl','Configurations','exports','name','username','password','clientId','clientSecret'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x39b0,0xe1));var _0x039b=function(_0x18c079,_0x4b7bdb){_0x18c079=_0x18c079-0x0;var _0x185df7=_0x39b0[_0x18c079];return _0x185df7;};'use strict';function SalesforceAccount(_0x24e418){this['id']=_0x24e418['id']||0x0;this['name']=_0x24e418[_0x039b('0x0')]||'';this[_0x039b('0x1')]=_0x24e418[_0x039b('0x1')]||'';this['remoteUri']=_0x24e418['remoteUri']||'';this['password']=_0x24e418[_0x039b('0x2')]||'';this[_0x039b('0x3')]=_0x24e418[_0x039b('0x3')]||'';this[_0x039b('0x4')]=_0x24e418[_0x039b('0x4')]||'';this[_0x039b('0x5')]=_0x24e418[_0x039b('0x5')]||'';this['type']=_0x24e418[_0x039b('0x6')]||'integrationTab';this[_0x039b('0x7')]=_0x24e418[_0x039b('0x7')]||'';this[_0x039b('0x8')]=_0x24e418[_0x039b('0x8')]||{};}module[_0x039b('0x9')]=SalesforceAccount; \ No newline at end of file +var _0x5e8c=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','username','remoteUri'];(function(_0x5f45ec,_0x57427a){var _0x7cdda1=function(_0x36ca29){while(--_0x36ca29){_0x5f45ec['push'](_0x5f45ec['shift']());}};_0x7cdda1(++_0x57427a);}(_0x5e8c,0x18a));var _0xc5e8=function(_0x9ddc2a,_0x31bcf6){_0x9ddc2a=_0x9ddc2a-0x0;var _0x4312e9=_0x5e8c[_0x9ddc2a];return _0x4312e9;};'use strict';function SalesforceAccount(_0x4a26e5){this['id']=_0x4a26e5['id']||0x0;this['name']=_0x4a26e5['name']||'';this[_0xc5e8('0x0')]=_0x4a26e5[_0xc5e8('0x0')]||'';this['remoteUri']=_0x4a26e5[_0xc5e8('0x1')]||'';this[_0xc5e8('0x2')]=_0x4a26e5[_0xc5e8('0x2')]||'';this['clientId']=_0x4a26e5[_0xc5e8('0x3')]||'';this[_0xc5e8('0x4')]=_0x4a26e5[_0xc5e8('0x4')]||'';this['securityToken']=_0x4a26e5[_0xc5e8('0x5')]||'';this[_0xc5e8('0x6')]=_0x4a26e5[_0xc5e8('0x6')]||_0xc5e8('0x7');this[_0xc5e8('0x8')]=_0x4a26e5[_0xc5e8('0x8')]||'';this['Configurations']=_0x4a26e5['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 405c393..5226550 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 _0xb94a=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xb94a,0xf0));var _0xab94=function(_0x431972,_0x3b1040){_0x431972=_0x431972-0x0;var _0x3f99c3=_0xb94a[_0x431972];return _0x3f99c3;};'use strict';function SugarcrmAccount(_0x245c05){this['id']=_0x245c05['id']||0x0;this[_0xab94('0x0')]=_0x245c05[_0xab94('0x0')]||'';this[_0xab94('0x1')]=_0x245c05['username']||'';this[_0xab94('0x2')]=_0x245c05['password']||'';this[_0xab94('0x3')]=_0x245c05[_0xab94('0x3')]||'';this[_0xab94('0x4')]=_0x245c05['serverUrl']||'';this['Configurations']=_0x245c05[_0xab94('0x5')]||{};}module[_0xab94('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x88fe=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4b9282,_0x58934a){var _0x33ed93=function(_0x4139ea){while(--_0x4139ea){_0x4b9282['push'](_0x4b9282['shift']());}};_0x33ed93(++_0x58934a);}(_0x88fe,0x1d8));var _0xe88f=function(_0xffa654,_0x4c734){_0xffa654=_0xffa654-0x0;var _0x5dd847=_0x88fe[_0xffa654];return _0x5dd847;};'use strict';function SugarcrmAccount(_0x48e86b){this['id']=_0x48e86b['id']||0x0;this['name']=_0x48e86b[_0xe88f('0x0')]||'';this[_0xe88f('0x1')]=_0x48e86b[_0xe88f('0x1')]||'';this[_0xe88f('0x2')]=_0x48e86b[_0xe88f('0x2')]||'';this[_0xe88f('0x3')]=_0x48e86b[_0xe88f('0x3')]||'';this[_0xe88f('0x4')]=_0x48e86b[_0xe88f('0x4')]||'';this[_0xe88f('0x5')]=_0x48e86b['Configurations']||{};}module[_0xe88f('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index cea605e..9262754 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 _0xf45a=['stateTime','status','exports','name','state','unknown'];(function(_0x2daf87,_0x2ffcdd){var _0x3398c0=function(_0x57f717){while(--_0x57f717){_0x2daf87['push'](_0x2daf87['shift']());}};_0x3398c0(++_0x2ffcdd);}(_0xf45a,0xcf));var _0xaf45=function(_0x4530e9,_0x6e2312){_0x4530e9=_0x4530e9-0x0;var _0x5d4c8b=_0xf45a[_0x4530e9];return _0x5d4c8b;};'use strict';function Telephone(_0x176722){this['id']=_0x176722['id']||0x0;this[_0xaf45('0x0')]=_0x176722[_0xaf45('0x0')]||'';this[_0xaf45('0x1')]=_0xaf45('0x2');this[_0xaf45('0x3')]=0x0;this[_0xaf45('0x4')]=_0xaf45('0x2');this['address']='';}module[_0xaf45('0x5')]=Telephone; \ No newline at end of file +var _0xf70b=['status','exports','name','state','stateTime'];(function(_0x4bb9dc,_0x4dfcce){var _0x62794a=function(_0xd2e2ff){while(--_0xd2e2ff){_0x4bb9dc['push'](_0x4bb9dc['shift']());}};_0x62794a(++_0x4dfcce);}(_0xf70b,0xc5));var _0xbf70=function(_0x3e811e,_0x3bb504){_0x3e811e=_0x3e811e-0x0;var _0x38262f=_0xf70b[_0x3e811e];return _0x38262f;};'use strict';function Telephone(_0x13305e){this['id']=_0x13305e['id']||0x0;this[_0xbf70('0x0')]=_0x13305e[_0xbf70('0x0')]||'';this[_0xbf70('0x1')]='unknown';this[_0xbf70('0x2')]=0x0;this[_0xbf70('0x3')]='unknown';this['address']='';}module[_0xbf70('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 2db89c1..0d17b8c 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 _0x1be1=['name','html','exports'];(function(_0x336df4,_0x52c1dc){var _0x580d8c=function(_0x2febf1){while(--_0x2febf1){_0x336df4['push'](_0x336df4['shift']());}};_0x580d8c(++_0x52c1dc);}(_0x1be1,0x192));var _0x11be=function(_0x1dbfd2,_0x12cb2b){_0x1dbfd2=_0x1dbfd2-0x0;var _0x3c4e8d=_0x1be1[_0x1dbfd2];return _0x3c4e8d;};'use strict';function template(_0x35110c){this['id']=_0x35110c['id']||0x0;this['name']=_0x35110c[_0x11be('0x0')]||'';this[_0x11be('0x1')]=_0x35110c['html']||'';}module[_0x11be('0x2')]=template; \ No newline at end of file +var _0x4bc3=['name','html'];(function(_0x487084,_0x1eb091){var _0x5bb80a=function(_0x281b36){while(--_0x281b36){_0x487084['push'](_0x487084['shift']());}};_0x5bb80a(++_0x1eb091);}(_0x4bc3,0x16e));var _0x34bc=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x4bc3[_0x51c819];return _0x15c5d2;};'use strict';function template(_0x2fede3){this['id']=_0x2fede3['id']||0x0;this[_0x34bc('0x0')]=_0x2fede3['name']||'';this[_0x34bc('0x1')]=_0x2fede3[_0x34bc('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index e328e4e..7848530 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 _0x6927=['voice','status','AllConditions','AnyConditions','name','channel'];(function(_0x3d7add,_0x37bdfe){var _0x55e63b=function(_0x196558){while(--_0x196558){_0x3d7add['push'](_0x3d7add['shift']());}};_0x55e63b(++_0x37bdfe);}(_0x6927,0xfa));var _0x7692=function(_0x4a77e9,_0x3dcb2c){_0x4a77e9=_0x4a77e9-0x0;var _0x4e0183=_0x6927[_0x4a77e9];return _0x4e0183;};'use strict';function Trigger(_0x1bd372){this['id']=_0x1bd372['id']||0x0;this[_0x7692('0x0')]=_0x1bd372['name']||'';this[_0x7692('0x1')]=_0x1bd372[_0x7692('0x1')]||_0x7692('0x2');this[_0x7692('0x3')]=_0x1bd372[_0x7692('0x3')]||![];this[_0x7692('0x4')]=_0x1bd372[_0x7692('0x4')]||[];this[_0x7692('0x5')]=_0x1bd372[_0x7692('0x5')]||[];this['Actions']=_0x1bd372['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x9540=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x9540,0xba));var _0x0954=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9540[_0x3dd15e];return _0x231fd0;};'use strict';function Trigger(_0x344345){this['id']=_0x344345['id']||0x0;this['name']=_0x344345[_0x0954('0x0')]||'';this['channel']=_0x344345[_0x0954('0x1')]||'voice';this[_0x0954('0x2')]=_0x344345[_0x0954('0x2')]||![];this[_0x0954('0x3')]=_0x344345[_0x0954('0x3')]||[];this[_0x0954('0x4')]=_0x344345['AnyConditions']||[];this[_0x0954('0x5')]=_0x344345['Actions']||[];}module[_0x0954('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index e142410..407ac98 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 _0x1e63=['port','domain','domainport','refresh','stateRegistry','registrationtime','name','state','unknown','status','registry','split','host'];(function(_0x42c876,_0xbc454b){var _0x3d46ef=function(_0x298f17){while(--_0x298f17){_0x42c876['push'](_0x42c876['shift']());}};_0x3d46ef(++_0xbc454b);}(_0x1e63,0x124));var _0x31e6=function(_0x301360,_0x57458d){_0x301360=_0x301360-0x0;var _0x5c8b68=_0x1e63[_0x301360];return _0x5c8b68;};'use strict';function Trunk(_0x2d65e7){this['id']=_0x2d65e7['id']||0x0;this['active']=_0x2d65e7['active']||![];this[_0x31e6('0x0')]=_0x2d65e7[_0x31e6('0x0')]||'';this[_0x31e6('0x1')]=_0x31e6('0x2');this['stateTime']=0x0;this[_0x31e6('0x3')]='unknown';this[_0x31e6('0x4')]=_0x2d65e7[_0x31e6('0x4')]&&_0x2d65e7[_0x31e6('0x4')]['indexOf'](':')?_0x2d65e7['registry'][_0x31e6('0x5')](':')[0x0]:'';this[_0x31e6('0x6')]='';this[_0x31e6('0x7')]='';this[_0x31e6('0x8')]='';this[_0x31e6('0x9')]='';this[_0x31e6('0xa')]='';this[_0x31e6('0xb')]=_0x31e6('0x2');this[_0x31e6('0xc')]='';this['address']='';}module['exports']=Trunk; \ No newline at end of file +var _0x0409=['active','name','state','unknown','status','registry','indexOf','split','host','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0xe2bfb9,_0x23df8b){var _0x2ad2b3=function(_0x57065e){while(--_0x57065e){_0xe2bfb9['push'](_0xe2bfb9['shift']());}};_0x2ad2b3(++_0x23df8b);}(_0x0409,0x1dc));var _0x9040=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x0409[_0x33032e];return _0x13316b;};'use strict';function Trunk(_0x61233b){this['id']=_0x61233b['id']||0x0;this[_0x9040('0x0')]=_0x61233b[_0x9040('0x0')]||![];this[_0x9040('0x1')]=_0x61233b[_0x9040('0x1')]||'';this[_0x9040('0x2')]=_0x9040('0x3');this['stateTime']=0x0;this[_0x9040('0x4')]=_0x9040('0x3');this[_0x9040('0x5')]=_0x61233b[_0x9040('0x5')]&&_0x61233b[_0x9040('0x5')][_0x9040('0x6')](':')?_0x61233b['registry'][_0x9040('0x7')](':')[0x0]:'';this[_0x9040('0x8')]='';this['port']='';this['domain']='';this[_0x9040('0x9')]='';this[_0x9040('0xa')]='';this[_0x9040('0xb')]=_0x9040('0x3');this[_0x9040('0xc')]='';this[_0x9040('0xd')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 9891954..3ce3373 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 _0x0bb5=['exten','recordingFormat','none','exports'];(function(_0x4e1533,_0x5d5e36){var _0x2b14b0=function(_0x332240){while(--_0x332240){_0x4e1533['push'](_0x4e1533['shift']());}};_0x2b14b0(++_0x5d5e36);}(_0x0bb5,0x148));var _0x50bb=function(_0x554074,_0x3b3d3c){_0x554074=_0x554074-0x0;var _0x3f1161=_0x0bb5[_0x554074];return _0x3f1161;};'use strict';function voiceExtension(_0x4878e5){this['id']=_0x4878e5['id']||0x0;this[_0x50bb('0x0')]=_0x4878e5['exten']||'';this['recordingFormat']=_0x4878e5[_0x50bb('0x1')]||_0x50bb('0x2');}module[_0x50bb('0x3')]=voiceExtension; \ No newline at end of file +var _0x2dae=['recordingFormat','none','exports','exten'];(function(_0x2ed9ee,_0x3a503c){var _0x163eca=function(_0x197971){while(--_0x197971){_0x2ed9ee['push'](_0x2ed9ee['shift']());}};_0x163eca(++_0x3a503c);}(_0x2dae,0xc3));var _0xe2da=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x2dae[_0x34325b];return _0x3da348;};'use strict';function voiceExtension(_0x463a36){this['id']=_0x463a36['id']||0x0;this['exten']=_0x463a36[_0xe2da('0x0')]||'';this[_0xe2da('0x1')]=_0x463a36[_0xe2da('0x1')]||_0xe2da('0x2');}module[_0xe2da('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 1457c17..83f9c7e 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 _0x2a96=['message','originated','dialTimezone','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumHoldTime','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x2a96,0xb8));var _0x62a9=function(_0x31d4c3,_0x5d218b){_0x31d4c3=_0x31d4c3-0x0;var _0x28a508=_0x2a96[_0x31d4c3];return _0x28a508;};'use strict';var statusDesc=[_0x62a9('0x0'),_0x62a9('0x1'),_0x62a9('0x2'),_0x62a9('0x3'),_0x62a9('0x4'),'unavailable',_0x62a9('0x5'),_0x62a9('0x6'),_0x62a9('0x7')];var monitorFormat={'wav':_0x62a9('0x8'),'wav49':_0x62a9('0x9'),'gsm':_0x62a9('0xa')};var strategy={'rrmemory':_0x62a9('0xb'),'roundrobin':'roundrobin'};function VoiceQueue(_0x448e8d){this['id']=_0x448e8d['id']||0x0;this[_0x62a9('0xc')]=_0x448e8d['name']||'';this[_0x62a9('0xd')]=_0x448e8d['monitor_format']||'';this[_0x62a9('0xe')]=_0x448e8d[_0x62a9('0xe')]||_0x62a9('0xf');this[_0x62a9('0x10')]=0x0;this[_0x62a9('0x11')]=0x0;this[_0x62a9('0x12')]=0x0;this[_0x62a9('0x13')]=0x0;this['sumDuration']=0x0;this[_0x62a9('0x14')]=0x0;this[_0x62a9('0x15')]=0x0;this[_0x62a9('0x16')]=0x0;this[_0x62a9('0x17')]=0x0;this['available']=0x0;this[_0x62a9('0x18')]=_0x448e8d[_0x62a9('0x18')]||![];this[_0x62a9('0x19')]=_0x448e8d[_0x62a9('0x19')]||0xa;this[_0x62a9('0x1a')]=_0x448e8d[_0x62a9('0x1a')]||'no';this[_0x62a9('0x1b')]=!![];this[_0x62a9('0x1c')]='';this[_0x62a9('0x1d')]=0x0;this['temp']=0x0;this[_0x62a9('0x1e')]=_0x448e8d[_0x62a9('0x1e')]||null;this['dialGlobalInterval']=_0x448e8d['dialGlobalInterval']?_0x448e8d['dialGlobalInterval']:null;this[_0x62a9('0x1f')]=_0x448e8d[_0x62a9('0x1f')];this['dialMethod']=_0x448e8d[_0x62a9('0x20')]||_0x62a9('0x21');this['dialLimitChannel']=_0x448e8d[_0x62a9('0x22')]||0x0;this[_0x62a9('0x23')]=_0x448e8d[_0x62a9('0x23')]||0x0;this[_0x62a9('0x24')]=_0x448e8d[_0x62a9('0x24')]||0x1;this[_0x62a9('0x25')]=_0x448e8d['dialPredictiveOptimization']||_0x62a9('0x26');this[_0x62a9('0x27')]=_0x448e8d['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x448e8d['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x448e8d[_0x62a9('0x28')]||_0x62a9('0x29');this[_0x62a9('0x2a')]=_0x448e8d[_0x62a9('0x2a')]||_0x62a9('0x29');this[_0x62a9('0x2b')]=_0x448e8d[_0x62a9('0x2b')]||0x1e;this[_0x62a9('0x2c')]=_0x448e8d['dialQueueOptions']||'tTxX';this[_0x62a9('0x2d')]=_0x448e8d['dialQueueTimeout']||0x3;this[_0x62a9('0x2e')]=_0x448e8d[_0x62a9('0x2e')]||undefined;this[_0x62a9('0x2f')]=_0x448e8d[_0x62a9('0x2f')]||0x3;this['dialCongestionRetryFrequency']=_0x448e8d[_0x62a9('0x30')]||0x96;this[_0x62a9('0x31')]=_0x448e8d[_0x62a9('0x31')]||0x3;this[_0x62a9('0x32')]=_0x448e8d[_0x62a9('0x32')]||0x96;this[_0x62a9('0x33')]=_0x448e8d['dialNoAnswerMaxRetry']||0x3;this[_0x62a9('0x34')]=_0x448e8d[_0x62a9('0x34')]||0x96;this[_0x62a9('0x35')]=_0x448e8d['dialGlobalMaxRetry']||0x4;this[_0x62a9('0x36')]=_0x448e8d['Trunk']?_0x448e8d[_0x62a9('0x36')]:undefined;this[_0x62a9('0x37')]=_0x448e8d['TrunkBackup']?_0x448e8d[_0x62a9('0x37')]:undefined;this[_0x62a9('0x38')]=_0x448e8d[_0x62a9('0x38')]||undefined;this[_0x62a9('0x39')]=_0x448e8d[_0x62a9('0x39')]?_0x448e8d[_0x62a9('0x39')]:undefined;this['dialOrderByScheduledAt']=_0x448e8d['dialOrderByScheduledAt']||_0x62a9('0x3a');this[_0x62a9('0x3b')]=_0x448e8d[_0x62a9('0x3b')]||undefined;this['dialCutDigit']=_0x448e8d[_0x62a9('0x3c')]||undefined;this[_0x62a9('0x3d')]=strategy[_0x448e8d[_0x62a9('0x3d')]]||'rrmemory';this[_0x62a9('0x3e')]=!![];this['dialAMDActive']=_0x448e8d[_0x62a9('0x3f')]||![];this[_0x62a9('0x40')]=_0x448e8d['dialAMDInitialSilence'];this[_0x62a9('0x41')]=_0x448e8d[_0x62a9('0x41')];this[_0x62a9('0x42')]=_0x448e8d[_0x62a9('0x42')];this['dialAMDTotalAnalysisTime']=_0x448e8d[_0x62a9('0x43')];this[_0x62a9('0x44')]=_0x448e8d['dialAMDMinWordLength'];this[_0x62a9('0x45')]=_0x448e8d[_0x62a9('0x45')];this[_0x62a9('0x46')]=_0x448e8d['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x448e8d['dialAMDSilenceThreshold'];this[_0x62a9('0x47')]=_0x448e8d[_0x62a9('0x47')];this[_0x62a9('0x48')]=0x0;this[_0x62a9('0x49')]=0x0;this[_0x62a9('0x4a')]=_0x448e8d[_0x62a9('0x4a')];this['outboundAnswerCallsDay']=0x0;this[_0x62a9('0x4b')]=0x0;this[_0x62a9('0x4c')]=0x0;this[_0x62a9('0x4d')]=0x0;this[_0x62a9('0x4e')]=0x0;this[_0x62a9('0x4f')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x62a9('0x50')]=0x0;this[_0x62a9('0x51')]=0x0;this[_0x62a9('0x52')]=0x0;this[_0x62a9('0x53')]=0x0;this[_0x62a9('0x54')]=0x0;this[_0x62a9('0x55')]=0x0;this['startProgressive']=undefined;this['startPredictive']=undefined;this[_0x62a9('0x56')]=undefined;this[_0x62a9('0x57')]=1.05;this[_0x62a9('0x58')]=0x0;this[_0x62a9('0x59')]=0x0;this[_0x62a9('0x5a')]=0x0;this[_0x62a9('0x5b')]=0x0;this[_0x62a9('0x5c')]=0x0;this[_0x62a9('0x5d')]=0x0;this[_0x62a9('0x5e')]=0x0;this[_0x62a9('0x5f')]=0.4;this[_0x62a9('0x60')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x62a9('0x61')]=0x0;this[_0x62a9('0x62')]=0x0;this[_0x62a9('0x63')]=0x0;this[_0x62a9('0x64')]=0x0;this['dialRecallMeTimeout']=_0x448e8d[_0x62a9('0x65')]||0x1e;this[_0x62a9('0x66')]=_0x448e8d[_0x62a9('0x66')]||![];this['dialQueueProject2']=_0x448e8d[_0x62a9('0x67')]||undefined;this['dialAgiAfterHangupClient']=_0x448e8d[_0x62a9('0x68')]||![];this[_0x62a9('0x69')]=_0x448e8d[_0x62a9('0x69')]||![];this[_0x62a9('0xd')]=monitorFormat[_0x448e8d[_0x62a9('0xd')]]?monitorFormat[_0x448e8d[_0x62a9('0xd')]]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0xeaa1=['loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','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','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalLowerLimit','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','exports','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','sumDuration','unmanaged'];(function(_0x29699a,_0x5d22e3){var _0x3570d3=function(_0xf9a2e1){while(--_0xf9a2e1){_0x29699a['push'](_0x29699a['shift']());}};_0x3570d3(++_0x5d22e3);}(_0xeaa1,0x192));var _0x1eaa=function(_0x5b1bd6,_0x286a57){_0x5b1bd6=_0x5b1bd6-0x0;var _0x1f5af8=_0xeaa1[_0x5b1bd6];return _0x1f5af8;};'use strict';var statusDesc=[_0x1eaa('0x0'),_0x1eaa('0x1'),_0x1eaa('0x2'),_0x1eaa('0x3'),_0x1eaa('0x4'),_0x1eaa('0x5'),_0x1eaa('0x6'),_0x1eaa('0x7'),_0x1eaa('0x8')];var monitorFormat={'wav':_0x1eaa('0x9'),'wav49':_0x1eaa('0xa'),'gsm':_0x1eaa('0xb')};var strategy={'rrmemory':_0x1eaa('0xc'),'roundrobin':_0x1eaa('0xd')};function VoiceQueue(_0x22d778){this['id']=_0x22d778['id']||0x0;this['name']=_0x22d778[_0x1eaa('0xe')]||'';this[_0x1eaa('0xf')]=_0x22d778[_0x1eaa('0xf')]||'';this[_0x1eaa('0x10')]=_0x22d778['type']||_0x1eaa('0x11');this[_0x1eaa('0x12')]=0x0;this[_0x1eaa('0x13')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0x1eaa('0x14')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x1eaa('0x15')]=0x0;this[_0x1eaa('0x16')]=0x0;this['available']=0x0;this[_0x1eaa('0x17')]=_0x22d778['acw']||![];this[_0x1eaa('0x18')]=_0x22d778['acwTimeout']||0xa;this[_0x1eaa('0x19')]=_0x22d778[_0x1eaa('0x19')]||'no';this[_0x1eaa('0x1a')]=!![];this[_0x1eaa('0x1b')]='';this[_0x1eaa('0x1c')]=0x0;this[_0x1eaa('0x1d')]=0x0;this[_0x1eaa('0x1e')]=_0x22d778['dialTimezone']||null;this[_0x1eaa('0x1f')]=_0x22d778[_0x1eaa('0x1f')]?_0x22d778[_0x1eaa('0x1f')]:null;this[_0x1eaa('0x20')]=_0x22d778['dialActive'];this[_0x1eaa('0x21')]=_0x22d778[_0x1eaa('0x21')]||_0x1eaa('0x22');this[_0x1eaa('0x23')]=_0x22d778[_0x1eaa('0x23')]||0x0;this[_0x1eaa('0x24')]=_0x22d778['dialLimitQueue']||0x0;this[_0x1eaa('0x25')]=_0x22d778[_0x1eaa('0x25')]||0x1;this[_0x1eaa('0x26')]=_0x22d778['dialPredictiveOptimization']||_0x1eaa('0x27');this['dialPredictiveOptimizationPercentage']=_0x22d778[_0x1eaa('0x28')]||0.03;this[_0x1eaa('0x29')]=_0x22d778[_0x1eaa('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x22d778[_0x1eaa('0x2a')]||_0x1eaa('0x2b');this[_0x1eaa('0x2c')]=_0x22d778['dialOriginateCallerIdNumber']||_0x1eaa('0x2b');this[_0x1eaa('0x2d')]=_0x22d778[_0x1eaa('0x2d')]||0x1e;this[_0x1eaa('0x2e')]=_0x22d778[_0x1eaa('0x2e')]||_0x1eaa('0x2f');this['dialQueueTimeout']=_0x22d778[_0x1eaa('0x30')]||0x3;this['dialQueueProject']=_0x22d778[_0x1eaa('0x31')]||undefined;this[_0x1eaa('0x32')]=_0x22d778[_0x1eaa('0x32')]||0x3;this[_0x1eaa('0x33')]=_0x22d778[_0x1eaa('0x33')]||0x96;this['dialBusyMaxRetry']=_0x22d778[_0x1eaa('0x34')]||0x3;this[_0x1eaa('0x35')]=_0x22d778[_0x1eaa('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x22d778[_0x1eaa('0x36')]||0x3;this[_0x1eaa('0x37')]=_0x22d778['dialNoAnswerRetryFrequency']||0x96;this[_0x1eaa('0x38')]=_0x22d778[_0x1eaa('0x38')]||0x4;this[_0x1eaa('0x39')]=_0x22d778['Trunk']?_0x22d778[_0x1eaa('0x39')]:undefined;this[_0x1eaa('0x3a')]=_0x22d778[_0x1eaa('0x3a')]?_0x22d778[_0x1eaa('0x3a')]:undefined;this['dialPrefix']=_0x22d778['dialPrefix']||undefined;this['Interval']=_0x22d778[_0x1eaa('0x3b')]?_0x22d778[_0x1eaa('0x3b')]:undefined;this[_0x1eaa('0x3c')]=_0x22d778[_0x1eaa('0x3c')]||_0x1eaa('0x3d');this[_0x1eaa('0x3e')]=_0x22d778[_0x1eaa('0x3e')]||undefined;this[_0x1eaa('0x3f')]=_0x22d778[_0x1eaa('0x3f')]||undefined;this[_0x1eaa('0x40')]=strategy[_0x22d778[_0x1eaa('0x40')]]||_0x1eaa('0xc');this['queueStatusComplete']=!![];this[_0x1eaa('0x41')]=_0x22d778['dialAMDActive']||![];this[_0x1eaa('0x42')]=_0x22d778['dialAMDInitialSilence'];this[_0x1eaa('0x43')]=_0x22d778['dialAMDGreeting'];this[_0x1eaa('0x44')]=_0x22d778[_0x1eaa('0x44')];this['dialAMDTotalAnalysisTime']=_0x22d778[_0x1eaa('0x45')];this['dialAMDMinWordLength']=_0x22d778['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x22d778['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x22d778['dialAMDMaximumNumberOfWords'];this[_0x1eaa('0x46')]=_0x22d778[_0x1eaa('0x46')];this[_0x1eaa('0x47')]=_0x22d778[_0x1eaa('0x47')];this[_0x1eaa('0x48')]=0x0;this[_0x1eaa('0x49')]=0x0;this[_0x1eaa('0x4a')]=_0x22d778[_0x1eaa('0x4a')];this[_0x1eaa('0x4b')]=0x0;this[_0x1eaa('0x4c')]=0x0;this[_0x1eaa('0x4d')]=0x0;this[_0x1eaa('0x4e')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x1eaa('0x4f')]=0x0;this[_0x1eaa('0x50')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x1eaa('0x51')]=0x0;this[_0x1eaa('0x52')]=0x0;this[_0x1eaa('0x53')]=0x0;this[_0x1eaa('0x54')]=0x0;this['outboundReCallsDay']=0x0;this[_0x1eaa('0x55')]=undefined;this[_0x1eaa('0x56')]=undefined;this[_0x1eaa('0x57')]=undefined;this[_0x1eaa('0x58')]=1.05;this[_0x1eaa('0x59')]=0x0;this[_0x1eaa('0x5a')]=0x0;this[_0x1eaa('0x5b')]=0x0;this[_0x1eaa('0x5c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x1eaa('0x5d')]=0x0;this[_0x1eaa('0x5e')]=0x0;this[_0x1eaa('0x5f')]=0.4;this['predictiveIntervalErlangCalls']=0x0;this[_0x1eaa('0x60')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x1eaa('0x61')]=0x0;this[_0x1eaa('0x62')]=0x0;this[_0x1eaa('0x63')]=0x0;this['dialRecallMeTimeout']=_0x22d778[_0x1eaa('0x64')]||0x1e;this[_0x1eaa('0x65')]=_0x22d778[_0x1eaa('0x65')]||![];this['dialQueueProject2']=_0x22d778[_0x1eaa('0x66')]||undefined;this[_0x1eaa('0x67')]=_0x22d778[_0x1eaa('0x67')]||![];this[_0x1eaa('0x68')]=_0x22d778[_0x1eaa('0x68')]||![];this[_0x1eaa('0xf')]=monitorFormat[_0x22d778[_0x1eaa('0xf')]]?monitorFormat[_0x22d778['monitor_format']]:undefined;}module[_0x1eaa('0x69')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 074e618..df7638b 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 _0x7333=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3e56da,_0x4a8924){var _0x486354=function(_0x2a143e){while(--_0x2a143e){_0x3e56da['push'](_0x3e56da['shift']());}};_0x486354(++_0x4a8924);}(_0x7333,0x1b7));var _0x3733=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7333[_0x21a9d9];return _0x46adce;};'use strict';function VtigerAccount(_0x358508){this['id']=_0x358508['id']||0x0;this[_0x3733('0x0')]=_0x358508[_0x3733('0x0')]||'';this[_0x3733('0x1')]=_0x358508[_0x3733('0x1')]||'';this[_0x3733('0x2')]=_0x358508['accessKey']||'';this[_0x3733('0x3')]=_0x358508[_0x3733('0x3')]||'';this[_0x3733('0x4')]=_0x358508[_0x3733('0x4')]||'';this['Configurations']=_0x358508[_0x3733('0x5')]||{};}module[_0x3733('0x6')]=VtigerAccount; \ No newline at end of file +var _0x2c1f=['name','username','accessKey','remoteUri','serverUrl','Configurations','exports'];(function(_0x44166f,_0x3e71e2){var _0x5f390a=function(_0x4876fb){while(--_0x4876fb){_0x44166f['push'](_0x44166f['shift']());}};_0x5f390a(++_0x3e71e2);}(_0x2c1f,0x188));var _0xf2c1=function(_0x58ddbf,_0x26f5fc){_0x58ddbf=_0x58ddbf-0x0;var _0x4bb2e6=_0x2c1f[_0x58ddbf];return _0x4bb2e6;};'use strict';function VtigerAccount(_0x50a1a0){this['id']=_0x50a1a0['id']||0x0;this[_0xf2c1('0x0')]=_0x50a1a0[_0xf2c1('0x0')]||'';this[_0xf2c1('0x1')]=_0x50a1a0[_0xf2c1('0x1')]||'';this[_0xf2c1('0x2')]=_0x50a1a0[_0xf2c1('0x2')]||'';this[_0xf2c1('0x3')]=_0x50a1a0[_0xf2c1('0x3')]||'';this[_0xf2c1('0x4')]=_0x50a1a0[_0xf2c1('0x4')]||'';this['Configurations']=_0x50a1a0[_0xf2c1('0x5')]||{};}module[_0xf2c1('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index a537479..1d21b9a 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 _0x9fe9=['Configurations','name','username','password','token','authType','type','integrationTab','serverUrl'];(function(_0x464082,_0x592f96){var _0x10a4ec=function(_0x10609b){while(--_0x10609b){_0x464082['push'](_0x464082['shift']());}};_0x10a4ec(++_0x592f96);}(_0x9fe9,0x184));var _0x99fe=function(_0x2ae00f,_0x126bb6){_0x2ae00f=_0x2ae00f-0x0;var _0xd64316=_0x9fe9[_0x2ae00f];return _0xd64316;};'use strict';function ZendeskAccount(_0x3aaa14){this['id']=_0x3aaa14['id']||0x0;this[_0x99fe('0x0')]=_0x3aaa14[_0x99fe('0x0')]||'';this['username']=_0x3aaa14[_0x99fe('0x1')]||'';this[_0x99fe('0x2')]=_0x3aaa14[_0x99fe('0x2')]||'';this[_0x99fe('0x3')]=_0x3aaa14[_0x99fe('0x3')]||'';this['remoteUri']=_0x3aaa14['remoteUri']||'';this[_0x99fe('0x4')]=_0x3aaa14['authType']||'';this[_0x99fe('0x5')]=_0x3aaa14['type']||_0x99fe('0x6');this['serverUrl']=_0x3aaa14[_0x99fe('0x7')]||'';this[_0x99fe('0x8')]=_0x3aaa14[_0x99fe('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xde69=['Configurations','exports','name','username','password','token','remoteUri','authType','type','serverUrl'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xde69,0x160));var _0x9de6=function(_0x48fd24,_0x13fa0b){_0x48fd24=_0x48fd24-0x0;var _0x2edb3a=_0xde69[_0x48fd24];return _0x2edb3a;};'use strict';function ZendeskAccount(_0x52291d){this['id']=_0x52291d['id']||0x0;this[_0x9de6('0x0')]=_0x52291d['name']||'';this[_0x9de6('0x1')]=_0x52291d[_0x9de6('0x1')]||'';this[_0x9de6('0x2')]=_0x52291d[_0x9de6('0x2')]||'';this['token']=_0x52291d[_0x9de6('0x3')]||'';this[_0x9de6('0x4')]=_0x52291d[_0x9de6('0x4')]||'';this[_0x9de6('0x5')]=_0x52291d[_0x9de6('0x5')]||'';this[_0x9de6('0x6')]=_0x52291d['type']||'integrationTab';this[_0x9de6('0x7')]=_0x52291d[_0x9de6('0x7')]||'';this[_0x9de6('0x8')]=_0x52291d[_0x9de6('0x8')]||{};}module[_0x9de6('0x9')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index eefb0a0..8a15dac 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 _0x5d17=['name','authToken','host','Configurations','serverUrl','exports'];(function(_0x14be9e,_0x3117bd){var _0xd0ddc=function(_0x566853){while(--_0x566853){_0x14be9e['push'](_0x14be9e['shift']());}};_0xd0ddc(++_0x3117bd);}(_0x5d17,0x114));var _0x75d1=function(_0x2c50a6,_0x2a9854){_0x2c50a6=_0x2c50a6-0x0;var _0x3e6556=_0x5d17[_0x2c50a6];return _0x3e6556;};'use strict';function ZohoAccount(_0x2dc953){this['id']=_0x2dc953['id']||0x0;this[_0x75d1('0x0')]=_0x2dc953['name']||'';this['authToken']=_0x2dc953[_0x75d1('0x1')]||'';this[_0x75d1('0x2')]=_0x2dc953[_0x75d1('0x2')]||'';this['Configurations']=_0x2dc953[_0x75d1('0x3')]||{};this[_0x75d1('0x4')]=_0x2dc953[_0x75d1('0x4')]||'';}module[_0x75d1('0x5')]=ZohoAccount; \ No newline at end of file +var _0x326f=['host','Configurations','serverUrl','exports','authToken'];(function(_0x165243,_0x3622b1){var _0x23988e=function(_0x247f7c){while(--_0x247f7c){_0x165243['push'](_0x165243['shift']());}};_0x23988e(++_0x3622b1);}(_0x326f,0xd1));var _0xf326=function(_0x172b2d,_0xa21793){_0x172b2d=_0x172b2d-0x0;var _0x31b3ad=_0x326f[_0x172b2d];return _0x31b3ad;};'use strict';function ZohoAccount(_0x450239){this['id']=_0x450239['id']||0x0;this['name']=_0x450239['name']||'';this[_0xf326('0x0')]=_0x450239[_0xf326('0x0')]||'';this[_0xf326('0x1')]=_0x450239[_0xf326('0x1')]||'';this[_0xf326('0x2')]=_0x450239[_0xf326('0x2')]||{};this[_0xf326('0x3')]=_0x450239[_0xf326('0x3')]||'';}module[_0xf326('0x4')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 5ec5989..67c9204 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 _0xac46=['name','channelAgent','format','SIP/%s','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','Agent'];(function(_0xb7a459,_0xc13228){var _0x104ab5=function(_0x186a0e){while(--_0x186a0e){_0xb7a459['push'](_0xb7a459['shift']());}};_0x104ab5(++_0xc13228);}(_0xac46,0x1e1));var _0x6ac4=function(_0x53350f,_0x520eaf){_0x53350f=_0x53350f-0x0;var _0x5e006f=_0xac46[_0x53350f];return _0x5e006f;};'use strict';var util=require('util');var _=require(_0x6ac4('0x0'));var moment=require('moment');function checkNameSurname(_0x58b9fc,_0x1aa842,_0x4f111e){var _0x25740b='';if(!_[_0x6ac4('0x1')](_0x1aa842)&&_0x6ac4('0x2')===typeof _0x1aa842){_0x25740b+=_0x1aa842;}if(!_[_0x6ac4('0x1')](_0x4f111e)&&_0x6ac4('0x2')===typeof _0x4f111e){_0x25740b+='\x20'+_0x4f111e;}if(_0x25740b!==''){return _0x25740b;}return _0x58b9fc;}function Action(_0x10e813,_0x1eb902,_0x2ac73e,_0x3e4c73,_0x2851f0){this[_0x6ac4('0x3')]=_0x2ac73e||undefined;this[_0x6ac4('0x4')]=_0x10e813['id'];this[_0x6ac4('0x5')]=_0x1eb902['name'];this['type']=_0x1eb902[_0x6ac4('0x6')];this[_0x6ac4('0x7')]=_0x6ac4('0x5');this[_0x6ac4('0x8')]=![];this[_0x6ac4('0x9')]=_[_0x6ac4('0x1')](_0x10e813['Agent'])?undefined:_0x10e813[_0x6ac4('0xa')][_0x6ac4('0xb')];this[_0x6ac4('0xc')]=this[_0x6ac4('0x9')]?util[_0x6ac4('0xd')](_0x6ac4('0xe'),this[_0x6ac4('0x9')]):_0x3e4c73||undefined;this[_0x6ac4('0xf')]=checkNameSurname(_0x10e813[_0x6ac4('0x10')][_0x6ac4('0x11')],_0x10e813[_0x6ac4('0x10')][_0x6ac4('0x12')],_0x10e813[_0x6ac4('0x10')][_0x6ac4('0x13')]);this[_0x6ac4('0x14')]=_0x10e813['active']||![];this[_0x6ac4('0x15')]=_0x10e813[_0x6ac4('0x10')][_0x6ac4('0x11')];this[_0x6ac4('0x16')]=_0x10e813[_0x6ac4('0x16')];this[_0x6ac4('0x17')]=_0x10e813[_0x6ac4('0x17')]||0x0;this[_0x6ac4('0x18')]=_0x10e813[_0x6ac4('0x18')]||0x0;this[_0x6ac4('0x19')]=_0x10e813['countnoanswerretry']||0x0;this[_0x6ac4('0x1a')]=(_0x10e813[_0x6ac4('0x17')]||0x0)+(_0x10e813['countcongestionretry']||0x0)+(_0x10e813[_0x6ac4('0x19')]||0x0);this[_0x6ac4('0x1b')]=_0x10e813['callback'];this[_0x6ac4('0x1c')]=_0x10e813[_0x6ac4('0x1c')];this[_0x6ac4('0x1d')]=_0x10e813['callbackat'];this['recallme']=_0x10e813[_0x6ac4('0x1e')];this[_0x6ac4('0x1f')]=_0x10e813[_0x6ac4('0x1f')];this[_0x6ac4('0x20')]=_0x10e813[_0x6ac4('0x20')];this[_0x6ac4('0x21')]=_[_0x6ac4('0x1')](_0x10e813[_0x6ac4('0xa')])?_0x10e813[_0x6ac4('0x21')]:_0x10e813['Agent']['id'];this[_0x6ac4('0x22')]=_0x10e813[_0x6ac4('0x22')];this[_0x6ac4('0x23')]='';this['originatecalleridname']='';}Action[_0x6ac4('0x24')][_0x6ac4('0x25')]=function(){return util[_0x6ac4('0xd')](_0x6ac4('0x26'),this[_0x6ac4('0xf')],this[_0x6ac4('0x27')]);};module[_0x6ac4('0x28')]=Action; \ No newline at end of file +var _0xd5e5=['name','channelAgent','membername','format','SIP/%s','calleridname','phone','firstName','Contact','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','isNil','string','uniqueid','type','campaigntype','queue','Agent'];(function(_0x1e172a,_0x52102b){var _0x96338b=function(_0x307313){while(--_0x307313){_0x1e172a['push'](_0x1e172a['shift']());}};_0x96338b(++_0x52102b);}(_0xd5e5,0x1d8));var _0x5d5e=function(_0x30f976,_0x2d86e9){_0x30f976=_0x30f976-0x0;var _0x30ee0f=_0xd5e5[_0x30f976];return _0x30ee0f;};'use strict';var util=require(_0x5d5e('0x0'));var _=require(_0x5d5e('0x1'));var moment=require('moment');function checkNameSurname(_0x5c0d3d,_0x3953a3,_0x25eb7e){var _0x474e0e='';if(!_[_0x5d5e('0x2')](_0x3953a3)&&_0x5d5e('0x3')===typeof _0x3953a3){_0x474e0e+=_0x3953a3;}if(!_[_0x5d5e('0x2')](_0x25eb7e)&&'string'===typeof _0x25eb7e){_0x474e0e+='\x20'+_0x25eb7e;}if(_0x474e0e!==''){return _0x474e0e;}return _0x5c0d3d;}function Action(_0x28b008,_0x2fcc70,_0x356d58,_0x22401b,_0x52d995){this[_0x5d5e('0x4')]=_0x356d58||undefined;this['idContact']=_0x28b008['id'];this['queue']=_0x2fcc70['name'];this[_0x5d5e('0x5')]=_0x2fcc70[_0x5d5e('0x5')];this[_0x5d5e('0x6')]=_0x5d5e('0x7');this['dialAnswer']=![];this['membername']=_[_0x5d5e('0x2')](_0x28b008[_0x5d5e('0x8')])?undefined:_0x28b008[_0x5d5e('0x8')][_0x5d5e('0x9')];this[_0x5d5e('0xa')]=this[_0x5d5e('0xb')]?util[_0x5d5e('0xc')](_0x5d5e('0xd'),this[_0x5d5e('0xb')]):_0x22401b||undefined;this[_0x5d5e('0xe')]=checkNameSurname(_0x28b008['Contact'][_0x5d5e('0xf')],_0x28b008['Contact'][_0x5d5e('0x10')],_0x28b008[_0x5d5e('0x11')][_0x5d5e('0x12')]);this[_0x5d5e('0x13')]=_0x28b008[_0x5d5e('0x13')]||![];this['calleridnum']=_0x28b008[_0x5d5e('0x11')][_0x5d5e('0xf')];this[_0x5d5e('0x14')]=_0x28b008[_0x5d5e('0x14')];this['countbusyretry']=_0x28b008[_0x5d5e('0x15')]||0x0;this[_0x5d5e('0x16')]=_0x28b008[_0x5d5e('0x16')]||0x0;this[_0x5d5e('0x17')]=_0x28b008['countnoanswerretry']||0x0;this[_0x5d5e('0x18')]=(_0x28b008[_0x5d5e('0x15')]||0x0)+(_0x28b008['countcongestionretry']||0x0)+(_0x28b008[_0x5d5e('0x17')]||0x0);this['callback']=_0x28b008[_0x5d5e('0x19')];this[_0x5d5e('0x1a')]=_0x28b008[_0x5d5e('0x1a')];this[_0x5d5e('0x1b')]=_0x28b008[_0x5d5e('0x1b')];this[_0x5d5e('0x1c')]=_0x28b008[_0x5d5e('0x1c')];this['ContactId']=_0x28b008['ContactId'];this[_0x5d5e('0x1d')]=_0x28b008[_0x5d5e('0x1d')];this[_0x5d5e('0x1e')]=_[_0x5d5e('0x2')](_0x28b008['Agent'])?_0x28b008['UserId']:_0x28b008[_0x5d5e('0x8')]['id'];this[_0x5d5e('0x1f')]=_0x28b008[_0x5d5e('0x1f')];this[_0x5d5e('0x20')]='';this['originatecalleridname']='';}Action['prototype'][_0x5d5e('0x21')]=function(){return util[_0x5d5e('0xc')](_0x5d5e('0x22'),this['calleridname'],this[_0x5d5e('0x23')]);};module[_0x5d5e('0x24')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 5c01e38..27e279d 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 _0x2a2b=['VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','size','agentReadyId','then','length','getDiff','scheduledat','run','logger2','[RecallMe]','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','ACTIVE','countglobal','totalGlobal','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','linkedid','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','custom:agentcomplete','buildObj','complete','decrementTalkink','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','Busy','countbusyretry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','[syncHangupRequest][logAgentReject]','unlockContact','idContact','disableContact','[default]','outboundUnknownCallsDay','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','uniqueid','ANSWER','destlinkedid','object','isUndefined','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','isEmpty','Agent','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','substring','trim','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','toLowerVariables','starttime','[originated][increment]','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','destuniqueid','addVariable','variables','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','md5','actionPreview','../ami','./rpcDb','./action','./util/util','socket.io-emitter','localhost','enqueue','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','hangup','syncHangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','originated','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','preview','booked','recallMe','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x2a2b,0x1de));var _0xb2a2=function(_0xf40589,_0x333d45){_0xf40589=_0xf40589-0x0;var _0x451dc9=_0x2a2b[_0xf40589];return _0x451dc9;};'use strict';var util=require(_0xb2a2('0x0'));var _=require(_0xb2a2('0x1'));var BPromise=require('bluebird');var uuid=require(_0xb2a2('0x2'));var moment=require(_0xb2a2('0x3'));var md5=require(_0xb2a2('0x4'));var logger=require('../../../config/logger')('preview');var loggerAction=require('../../../config/logger')(_0xb2a2('0x5'));var ami=require(_0xb2a2('0x6'));var rpcDb=require(_0xb2a2('0x7'));var Action=require(_0xb2a2('0x8'));var ut=require(_0xb2a2('0x9'));var io=require(_0xb2a2('0xa'))({'host':_0xb2a2('0xb'),'port':0x18eb});var Sequence=function(){};Sequence['prototype'][_0xb2a2('0xc')]=function(_0x559a86){this[_0xb2a2('0xd')]=this[_0xb2a2('0xd')]?this[_0xb2a2('0xd')][_0xb2a2('0xe')](_0x559a86):_0x559a86();};function Preview(_0x6379ae){this[_0xb2a2('0xf')]=new Sequence();this[_0xb2a2('0x10')]=_0x6379ae['voiceQueues'];this[_0xb2a2('0x11')]=_0x6379ae[_0xb2a2('0x11')];this[_0xb2a2('0x12')]={};this['agents']=_0x6379ae[_0xb2a2('0x13')];this[_0xb2a2('0x14')]=0x0;ami['on'](_0xb2a2('0x15'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xb2a2('0x16'),this[_0xb2a2('0x17')][_0xb2a2('0x18')](this));ami['on'](_0xb2a2('0x19'),this[_0xb2a2('0x1a')][_0xb2a2('0x18')](this));ami['on'](_0xb2a2('0x1b'),this[_0xb2a2('0x1c')]['bind'](this));ami['on'](_0xb2a2('0x1d'),this[_0xb2a2('0x1e')][_0xb2a2('0x18')](this));ami['on'](_0xb2a2('0x1f'),this[_0xb2a2('0x20')][_0xb2a2('0x18')](this));ami['on'](_0xb2a2('0x21'),this[_0xb2a2('0x22')][_0xb2a2('0x18')](this));ami['on'](_0xb2a2('0x23'),this[_0xb2a2('0x24')][_0xb2a2('0x18')](this));this[_0xb2a2('0x25')](this[_0xb2a2('0x10')]);}function emit(_0x39553f,_0x5855b2,_0x48c8f7){io['to'](_0x39553f)[_0xb2a2('0x26')](_0x5855b2,_0x48c8f7);}function emitCampaignPreview(_0x484bcc){if(_0x484bcc[_0xb2a2('0x27')]===_0xb2a2('0x28')){var _0x26b22d={'id':_0x484bcc['id'],'name':_0x484bcc[_0xb2a2('0x29')],'strategy':_0x484bcc['strategy'],'answered':_0x484bcc[_0xb2a2('0x2a')],'available':_0x484bcc[_0xb2a2('0x2b')],'loggedIn':_0x484bcc[_0xb2a2('0x2c')],'pTalking':_0x484bcc[_0xb2a2('0x2d')],'sumBillable':_0x484bcc[_0xb2a2('0x2e')],'sumDuration':_0x484bcc[_0xb2a2('0x2f')],'sumHoldTime':_0x484bcc[_0xb2a2('0x30')]||0x0,'talking':_0x484bcc[_0xb2a2('0x31')],'total':_0x484bcc[_0xb2a2('0x32')],'type':_0x484bcc[_0xb2a2('0x27')],'unmanaged':_0x484bcc[_0xb2a2('0x33')],'waiting':_0x484bcc[_0xb2a2('0x34')],'loggedInDb':_0x484bcc[_0xb2a2('0x35')],'dialActive':_0x484bcc[_0xb2a2('0x36')],'dialMethod':_0x484bcc[_0xb2a2('0x37')],'dialOriginateCallerIdName':_0x484bcc[_0xb2a2('0x38')],'dialOriginateCallerIdNumber':_0x484bcc[_0xb2a2('0x39')],'dialOriginateTimeout':_0x484bcc[_0xb2a2('0x3a')],'dialPrefix':_0x484bcc[_0xb2a2('0x3b')],'outboundAnswerAgiCallsDay':_0x484bcc[_0xb2a2('0x3c')],'outboundAnswerCallsDay':_0x484bcc[_0xb2a2('0x3d')],'outboundBlacklistCallsDay':_0x484bcc['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x484bcc[_0xb2a2('0x3e')],'outboundCongestionCallsDay':_0x484bcc[_0xb2a2('0x3f')],'outboundDropCallsDayACS':_0x484bcc['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x484bcc[_0xb2a2('0x40')],'outboundDropCallsDayTimeout':_0x484bcc[_0xb2a2('0x41')],'outboundNoAnswerCallsDay':_0x484bcc['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x484bcc[_0xb2a2('0x42')],'outboundOriginateFailureCallsDay':_0x484bcc[_0xb2a2('0x43')],'outboundReCallsDay':_0x484bcc[_0xb2a2('0x44')],'outboundRejectCallsDay':_0x484bcc[_0xb2a2('0x45')],'outboundUnknownCallsDay':_0x484bcc['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x484bcc['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x484bcc[_0xb2a2('0x46')],'predictiveIntervalAvgTalktime':_0x484bcc[_0xb2a2('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x484bcc[_0xb2a2('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x484bcc[_0xb2a2('0x49')],'predictiveIntervalErlangCalls':_0x484bcc[_0xb2a2('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x484bcc['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x484bcc[_0xb2a2('0x4b')],'predictiveIntervalLowerLimit':_0x484bcc['predictiveIntervalLowerLimit'],'predictiveIntervalMultiplicativeFactor':_0x484bcc[_0xb2a2('0x4c')],'predictiveIntervalPauses':_0x484bcc[_0xb2a2('0x4d')],'predictiveIntervalTotalCalls':_0x484bcc['predictiveIntervalTotalCalls'],'message':_0x484bcc[_0xb2a2('0x4e')],'originated':_0x484bcc[_0xb2a2('0x4f')]};if(_0x484bcc['Trunk']){_0x26b22d[_0xb2a2('0x50')]={'id':_0x484bcc[_0xb2a2('0x50')]['id'],'name':_0x484bcc[_0xb2a2('0x50')][_0xb2a2('0x29')],'active':_0x484bcc['Trunk'][_0xb2a2('0x51')],'callerid':_0x484bcc[_0xb2a2('0x50')][_0xb2a2('0x52')]};}if(_0x484bcc[_0xb2a2('0x53')]){_0x26b22d[_0xb2a2('0x53')]={'id':_0x484bcc['Interval']['id'],'name':_0x484bcc[_0xb2a2('0x53')][_0xb2a2('0x29')]};}var _0x12322a=md5(JSON[_0xb2a2('0x54')](_0x26b22d));if(_0x484bcc[_0xb2a2('0x4')]!==_0x12322a){_0x484bcc['md5']=_0x12322a;emit(util[_0xb2a2('0x55')](_0xb2a2('0x56'),_0x26b22d[_0xb2a2('0x29')]),_0xb2a2('0x57'),_0x26b22d);}}}function emitVoiceQueueChannelRemove(_0x1516ba){emit(util[_0xb2a2('0x55')](_0xb2a2('0x56'),_0x1516ba['name']),'voice_queue_channel:remove',_0x1516ba);}function notSendMessagesQueue(_0x468827){if(_0x468827[_0xb2a2('0x58')]){if(_0x468827[_0xb2a2('0x4f')]===0x0&&_0x468827[_0xb2a2('0x2d')]===0x0){_0x468827[_0xb2a2('0x58')]=![];_0x468827[_0xb2a2('0x2b')]=0x0;_0x468827[_0xb2a2('0x59')]=0x0;_0x468827[_0xb2a2('0x4e')]='NOT_ACTIVE';ut['logger'](_0xb2a2('0x5a'),_0x468827[_0xb2a2('0x29')]+_0xb2a2('0x5b'));}else{_0x468827['message']=_0xb2a2('0x5c');ut[_0xb2a2('0x5d')](_0xb2a2('0x5a'),_0x468827[_0xb2a2('0x29')]+_0xb2a2('0x5e'));}emitCampaignPreview(_0x468827);}}Preview[_0xb2a2('0x5f')][_0xb2a2('0x25')]=function(){var _0x2223c0=this;setInterval(function(){_0x2223c0['syncCampaigns']();},0x7cf);};Preview['prototype'][_0xb2a2('0x60')]=function(){var _0xe91db=this[_0xb2a2('0x10')];this[_0xb2a2('0x14')]+=0x1;for(var _0xd55d7 in _0xe91db){if(_0xe91db[_0xb2a2('0x61')](_0xd55d7)&&(_0xe91db[_0xd55d7][_0xb2a2('0x37')]===_0xb2a2('0x62')||_0xe91db[_0xd55d7][_0xb2a2('0x37')]===_0xb2a2('0x63'))&&_0xe91db[_0xd55d7][_0xb2a2('0x27')]===_0xb2a2('0x28')){if(this[_0xb2a2('0x14')]>0x7){this[_0xb2a2('0x14')]=0x0;this['clearZombieChannels']();}}if(_0xe91db['hasOwnProperty'](_0xd55d7)&&_0xe91db[_0xd55d7][_0xb2a2('0x37')]===_0xb2a2('0x62')&&_0xe91db[_0xd55d7][_0xb2a2('0x27')]===_0xb2a2('0x28')){if(_0xe91db[_0xd55d7][_0xb2a2('0x36')]){this['setMessage'](_0xe91db[_0xd55d7]);this[_0xb2a2('0x64')](_0xe91db[_0xd55d7]);}else{notSendMessagesQueue(_0xe91db[_0xd55d7]);}}}};Preview['prototype'][_0xb2a2('0x65')]=function(_0x294f3f){var _0x44d32e=this;this[_0xb2a2('0xf')][_0xb2a2('0xc')](function(){if(!_[_0xb2a2('0x66')](_0x44d32e[_0xb2a2('0x12')][_0x294f3f])){loggerAction[_0xb2a2('0x67')](_0xb2a2('0x68'),_0x294f3f,_0xb2a2('0x69'),_0x44d32e['actions'][_0x294f3f][_0xb2a2('0x6a')],_0xb2a2('0x6b'),JSON[_0xb2a2('0x54')](_0x44d32e[_0xb2a2('0x10')][_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x6a')]][_0xb2a2('0x4f')]),_0xb2a2('0x6c'),JSON['stringify'](_0x44d32e[_0xb2a2('0x10')][_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x6a')]]['pTalking']),JSON[_0xb2a2('0x54')](_0x44d32e['actions'][_0x294f3f][_0xb2a2('0x6d')]),JSON[_0xb2a2('0x54')](_[_0xb2a2('0x6e')](_0x44d32e[_0xb2a2('0x12')][_0x294f3f],[_0xb2a2('0x6f'),'UserId',_0xb2a2('0x70'),_0xb2a2('0x71')])));return ami[_0xb2a2('0x72')]({'action':_0xb2a2('0x73'),'channel':_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x74')]})[_0xb2a2('0x75')](function(_0x16ecea){if(_0x16ecea['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x44d32e[_0xb2a2('0x12')][_0x294f3f]){ut[_0xb2a2('0x76')](_0x44d32e[_0xb2a2('0x10')][_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x6a')]],_0xb2a2('0x77'));if(_0x44d32e['actions'][_0x294f3f][_0xb2a2('0x6d')]===!![]){ut['decrementTalkink'](_0x44d32e[_0xb2a2('0x10')][_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x6a')]],_0xb2a2('0x77'));ut[_0xb2a2('0x78')](_0xb2a2('0x79')+_0x294f3f,_0x44d32e[_0xb2a2('0x12')][_0x294f3f]['queue']);}ut[_0xb2a2('0x78')]('[Dialer][checkChannel][Preview]'+_0x294f3f,_0x44d32e[_0xb2a2('0x12')][_0x294f3f][_0xb2a2('0x6a')]);delete _0x44d32e[_0xb2a2('0x12')][_0x294f3f];}},0x2328);}});}});};Preview['prototype'][_0xb2a2('0x7a')]=function(){var _0x1be4a9=this;loggerAction['info']('[action]',_[_0xb2a2('0x7b')](this[_0xb2a2('0x12')]));for(var _0x395be8 in this['actions']){if(_0x1be4a9[_0xb2a2('0x12')][_0xb2a2('0x61')](_0x395be8)){_0x1be4a9[_0xb2a2('0x65')](_0x395be8);}}};Preview[_0xb2a2('0x5f')][_0xb2a2('0x64')]=function(_0x2a421a){var _0x15a900=this;rpcDb['getContactRecallMe'](_0x2a421a['id'],ut[_0xb2a2('0x7c')](this[_0xb2a2('0x13')]))[_0xb2a2('0x7d')](function(_0x165810){if(!_['isNil'](_0x165810)){for(var _0x1dde1c=0x0;_0x1dde1c<_0x165810[_0xb2a2('0x7e')];_0x1dde1c+=0x1){if(ut[_0xb2a2('0x7f')](_0x165810[_0x1dde1c][_0xb2a2('0x80')])<_0x2a421a['dialRecallMeTimeout']*0x3c){_0x15a900[_0xb2a2('0x81')](_0x165810[_0x1dde1c]['id'])[_0xb2a2('0x7d')](ut[_0xb2a2('0x82')](_0xb2a2('0x83')))['catch'](ut[_0xb2a2('0x82')](_0xb2a2('0x83')));}else{var _0x53eceb=new Action(_0x165810[_0x1dde1c],_0x2a421a);_0x53eceb['starttime']=moment()['format'](_0xb2a2('0x84'));_0x2a421a[_0xb2a2('0x44')]+=0x1;ut[_0xb2a2('0x85')](_0x53eceb,0x17,_0xb2a2('0x86'));if(_0x2a421a[_0xb2a2('0x87')]){rpcDb[_0xb2a2('0x88')](ut['createBody'](_0x165810[_0x1dde1c]));rpcDb[_0xb2a2('0x89')](_0x53eceb,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0xb2a2('0x85')](_0x53eceb,0x16,_0xb2a2('0x8a'));rpcDb['createCustomerHistory'](_0x53eceb,_0xb2a2('0x8b'));rpcDb[_0xb2a2('0x8c')](_0x53eceb,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xb2a2('0x82')]('[getContactRecallMe]'));};Preview[_0xb2a2('0x5f')]['setMessage']=function(_0x3a6b7f){_0x3a6b7f[_0xb2a2('0x58')]=!![];if(ut[_0xb2a2('0x8d')](_0x3a6b7f[_0xb2a2('0x2c')])){_0x3a6b7f[_0xb2a2('0x4e')]=_0xb2a2('0x8e');}else if(!ut[_0xb2a2('0x8f')](_0x3a6b7f[_0xb2a2('0x36')])){_0x3a6b7f['message']=_0xb2a2('0x90');}else if(!this[_0xb2a2('0x91')](_0x3a6b7f[_0xb2a2('0x50')])){if(!this[_0xb2a2('0x91')](_0x3a6b7f[_0xb2a2('0x92')])){_0x3a6b7f[_0xb2a2('0x4e')]='TRUNK_IS_NOT_REACHABLE';}else{_0x3a6b7f[_0xb2a2('0x4e')]=_0xb2a2('0x93');}}else{_0x3a6b7f[_0xb2a2('0x4e')]='ACTIVE';}emitCampaignPreview(_0x3a6b7f);};Preview['prototype']['callProgressDetectingCustomer']=function(_0x214c3e,_0x50fb07,_0x56ddd3){var _0x2a5f03=this;var _0x2f7140=this['actions'][_0x50fb07];var _0x13f27f=this['campaignsPreview'][_0x2f7140['queue']];var _0x338d42;if(_0x13f27f){switch(_0x56ddd3){case'1':_0x13f27f['outboundNoSuchCallsDay']+=0x1;_0x2f7140[_0xb2a2('0x94')]=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x0,'NoSuchNumber');rpcDb[_0xb2a2('0x89')](_0x2f7140,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0xb2a2('0x95')](_0x2f7140)>=_0x13f27f[_0xb2a2('0x96')]){_0x338d42=ut[_0xb2a2('0x97')](_0x2f7140,0xf,_0xb2a2('0x98'));rpcDb[_0xb2a2('0x8c')](_0x338d42,_0xb2a2('0x99'));}else{rpcDb[_0xb2a2('0x8c')](_0x2f7140,_0xb2a2('0x99'));}delete this[_0xb2a2('0x12')][_0x214c3e[_0xb2a2('0x9a')]];break;case'ANSWER':var _0x291de8=moment()[_0xb2a2('0x55')]('YYYY-MM-DD\x20HH:mm:ss');_0x2f7140['responsetime']=_0x291de8;_0x2f7140['answertime']=_0x291de8;_0x2f7140[_0xb2a2('0x6d')]=!![];_0x13f27f['pTalking']+=0x1;logger[_0xb2a2('0x67')](_0xb2a2('0x9b'),_0x2f7140['uniqueid'],_0xb2a2('0x9c'),_0x13f27f[_0xb2a2('0x29')],_0xb2a2('0x6c'),_0x13f27f[_0xb2a2('0x2d')]);ami['emit'](_0xb2a2('0x9d'),ut['buildObj'](_0x2f7140,_0xb2a2('0x9e')));if(_0x13f27f[_0xb2a2('0x9f')]){ami[_0xb2a2('0x26')](_0xb2a2('0xa0'),ut['buildAcw'](_0x2f7140));}break;case'16':ami['emit'](_0xb2a2('0xa1'),ut[_0xb2a2('0xa2')](_0x2f7140,_0xb2a2('0xa3')));emitVoiceQueueChannelRemove(ut[_0xb2a2('0xa2')](_0x2f7140,'complete'));_0x13f27f[_0xb2a2('0x3d')]+=0x1;_0x13f27f[_0xb2a2('0x32')]+=0x1;_0x13f27f[_0xb2a2('0x2a')]+=0x1;ut[_0xb2a2('0xa4')](_0x13f27f,'[16]');_0x2f7140['countglobal']=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x4,'Answer');rpcDb[_0xb2a2('0x89')](_0x2f7140,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xb2a2('0x8c')](_0x2f7140,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xb2a2('0xa5')](_0x2f7140);_0x13f27f[_0xb2a2('0x2f')]+=_0x2f7140[_0xb2a2('0xa6')];_0x13f27f['sumBillable']+=_0x2f7140[_0xb2a2('0xa6')];logger[_0xb2a2('0x67')](_0xb2a2('0xa7'),_0x2f7140['uniqueid'],_0xb2a2('0x9c'),_0x13f27f[_0xb2a2('0x29')],_0xb2a2('0x6c'),_0x13f27f[_0xb2a2('0x2d')]);delete this[_0xb2a2('0x12')][_0x214c3e[_0xb2a2('0x9a')]];break;case _0xb2a2('0xa8'):_0x13f27f[_0xb2a2('0x3e')]+=0x1;_0x2f7140['countbusyretry']+=0x1;_0x2f7140[_0xb2a2('0x94')]=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x5,_0xb2a2('0xa9'));rpcDb[_0xb2a2('0x89')](_0x2f7140,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xb2a2('0x95')](_0x2f7140)>=_0x13f27f[_0xb2a2('0x96')]){_0x338d42=ut[_0xb2a2('0x97')](_0x2f7140,0xf,'Global');rpcDb[_0xb2a2('0x8c')](_0x338d42,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x2f7140[_0xb2a2('0xaa')]>=_0x13f27f[_0xb2a2('0xab')]){rpcDb['createCustomerFinal'](_0x2f7140,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xb2a2('0xac')](ut['scheduledAt'](_0x2f7140,_0xb2a2('0xaa'),_0x13f27f[_0xb2a2('0xad')]),_0x2f7140[_0xb2a2('0xae')],_0x2f7140[_0xb2a2('0xaf')]);}}break;case _0xb2a2('0xb0'):_0x13f27f[_0xb2a2('0xb1')]+=0x1;_0x2f7140['countnoanswerretry']+=0x1;_0x2f7140[_0xb2a2('0x94')]=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x3,_0xb2a2('0xb2'));rpcDb[_0xb2a2('0x89')](_0x2f7140,_0xb2a2('0xb3'));if(ut[_0xb2a2('0x95')](_0x2f7140)>=_0x13f27f['dialGlobalMaxRetry']){_0x338d42=ut[_0xb2a2('0x97')](_0x2f7140,0xf,'Global');rpcDb[_0xb2a2('0x8c')](_0x338d42,_0xb2a2('0xb4'));}else{if(_0x2f7140[_0xb2a2('0xb5')]>=_0x13f27f[_0xb2a2('0xb6')]){rpcDb[_0xb2a2('0x8c')](_0x2f7140,_0xb2a2('0xb3'));}else{rpcDb[_0xb2a2('0xac')](ut[_0xb2a2('0xb7')](_0x2f7140,_0xb2a2('0xb5'),_0x13f27f[_0xb2a2('0xb8')]),_0x2f7140[_0xb2a2('0xae')],_0x2f7140[_0xb2a2('0xaf')]);}}break;case _0xb2a2('0xb9'):_0x13f27f[_0xb2a2('0x3f')]+=0x1;_0x2f7140[_0xb2a2('0xba')]+=0x1;_0x2f7140[_0xb2a2('0x94')]=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x8,'Congestion');rpcDb[_0xb2a2('0x89')](_0x2f7140,_0xb2a2('0xbb'));if(ut[_0xb2a2('0x95')](_0x2f7140)>=_0x13f27f[_0xb2a2('0x96')]){_0x338d42=ut['cloneAction'](_0x2f7140,0xf,_0xb2a2('0x98'));rpcDb[_0xb2a2('0x8c')](_0x338d42,_0xb2a2('0xbc'));}else{if(_0x2f7140['countcongestionretry']>=_0x13f27f['dialCongestionMaxRetry']){rpcDb[_0xb2a2('0x8c')](_0x2f7140,_0xb2a2('0xbb'));}else{rpcDb['rescheduleContact'](ut[_0xb2a2('0xb7')](_0x2f7140,'countcongestionretry',_0x13f27f[_0xb2a2('0xad')]),_0x2f7140['unlockAgent'],_0x2f7140[_0xb2a2('0xaf')]);}}break;case'CANCEL':_0x13f27f[_0xb2a2('0x45')]+=0x1;_0x2f7140['countglobal']=ut[_0xb2a2('0x95')](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0x14,'AgentReject');rpcDb[_0xb2a2('0x89')](_0x2f7140,_0xb2a2('0xbd'));if(_0x2f7140[_0xb2a2('0xae')]){rpcDb[_0xb2a2('0xbe')](_0x2f7140[_0xb2a2('0xbf')]);}if(_0x2f7140[_0xb2a2('0xaf')]){rpcDb[_0xb2a2('0xc0')](_0x2f7140[_0xb2a2('0xbf')]);}break;default:if(_0x2f7140[_0xb2a2('0x6d')]){ut[_0xb2a2('0xa4')](_0x13f27f,_0xb2a2('0xc1'));ut[_0xb2a2('0x78')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x13f27f[_0xb2a2('0x29')],_0x214c3e);}_0x13f27f[_0xb2a2('0xc2')]+=0x1;_0x2f7140['countglobal']=ut['totalGlobal'](_0x2f7140);ut[_0xb2a2('0x85')](_0x2f7140,0xc,_0x214c3e[_0xb2a2('0xc3')]||_0x214c3e[_0xb2a2('0xc4')]);rpcDb[_0xb2a2('0x89')](_0x2f7140,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0xb2a2('0x95')](_0x2f7140)>=_0x13f27f[_0xb2a2('0x96')]){_0x338d42=ut['cloneAction'](_0x2f7140,0xf,_0xb2a2('0x98'));rpcDb[_0xb2a2('0x8c')](_0x338d42,_0xb2a2('0xc5'));}else{rpcDb[_0xb2a2('0x8c')](_0x2f7140,_0xb2a2('0xc5'));}delete this[_0xb2a2('0x12')][_0x214c3e[_0xb2a2('0x9a')]];}if(!(_0x2f7140[_0xb2a2('0x6d')]&&_0x56ddd3==='16')){ut[_0xb2a2('0x76')](_0x13f27f,_0xb2a2('0xc6'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x2f7140[_0xb2a2('0xc7')],_0xb2a2('0x9c'),_0x13f27f['name'],'originated:\x20',_0x13f27f[_0xb2a2('0x4f')]);}if(_0x56ddd3!==_0xb2a2('0xc8')){delete this[_0xb2a2('0x12')][_0x214c3e[_0xb2a2('0x9a')]];delete this[_0xb2a2('0x12')][_0x214c3e[_0xb2a2('0xc9')]];}}};Preview['prototype']['callProgressDetectingAgent']=function(_0x1739ef,_0x20ad4d,_0x3703de){if(_['isUndefined'](_0x20ad4d)&&_0xb2a2('0xca')!==typeof _0x20ad4d){return;}if(_[_0xb2a2('0xcb')](_0x3703de)&&_0xb2a2('0xca')!==typeof _0x3703de){return;}switch(_0x3703de['reason']){case'0':ut[_0xb2a2('0xcc')](_0x1739ef,0x0,'NoSuchNumber');rpcDb[_0xb2a2('0xcd')](_0x1739ef,_0xb2a2('0xce'));break;case'3':ut[_0xb2a2('0xcc')](_0x1739ef,0x3,_0xb2a2('0xb2'));rpcDb[_0xb2a2('0xcd')](_0x1739ef,_0xb2a2('0xcf'));break;case'5':ut['logAgent'](_0x1739ef,0x5,_0xb2a2('0xa9'));rpcDb[_0xb2a2('0xcd')](_0x1739ef,_0xb2a2('0xd0'));break;case'8':ut[_0xb2a2('0xcc')](_0x1739ef,0x8,_0xb2a2('0xd1'));rpcDb['createAgentHistory'](_0x1739ef,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xb2a2('0xcc')](_0x1739ef,0x16,'AnswerAGI');rpcDb[_0xb2a2('0xcd')](_0x1739ef,_0xb2a2('0xd2'));break;default:ut[_0xb2a2('0xcc')](_0x1739ef,0xc,_0x3703de[_0xb2a2('0xd3')]);rpcDb[_0xb2a2('0xcd')](_0x1739ef,_0xb2a2('0xd4'));}ut[_0xb2a2('0x76')](_0x20ad4d,_0xb2a2('0xd5'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x1739ef[_0xb2a2('0xc7')],_0xb2a2('0x9c'),_0x20ad4d['name'],_0xb2a2('0x6b'),_0x20ad4d[_0xb2a2('0x4f')]);delete this['actions'][_0x1739ef[_0xb2a2('0xc7')]];};Preview[_0xb2a2('0x5f')][_0xb2a2('0xd6')]=function(_0x5d4ba4,_0x4f896f,_0x42acc2,_0xaee8d0,_0x6ebc7f){var _0x21c2a5=this;return new BPromise(function(_0x386493,_0x60dca4){if(_[_0xb2a2('0x66')](_0x4f896f)||_[_0xb2a2('0x66')](_0x4f896f[_0xb2a2('0xd7')])||_[_0xb2a2('0x66')](_0x4f896f['Contact'][_0xb2a2('0xd8')])||_[_0xb2a2('0x66')](_0x4f896f['VoiceQueueId'])){_0x60dca4(ut[_0xb2a2('0x4e')](_0xb2a2('0xd9'),_0xaee8d0,_0x6ebc7f));return;}var _0x28f91a=uuid['v4']();var _0x2e132a=_0x21c2a5['campaignsPreview'][_0x4f896f['Queue'][_0xb2a2('0x29')]];var _0x91214c=_0x42acc2?_0x21c2a5[_0xb2a2('0x13')][_0x42acc2]['id']:undefined;_0x21c2a5[_0xb2a2('0x12')][_0x28f91a]=new Action(_0x4f896f,_0x2e132a,_0x28f91a,_0x42acc2,_0x91214c);var _0x3250ac=_0x21c2a5[_0xb2a2('0x12')][_0x28f91a];_0x3250ac['unlockAgent']=_0xaee8d0;_0x3250ac['activeContact']=_0x6ebc7f;_0x3250ac[_0xb2a2('0xda')]=_0x42acc2;if(_['isEmpty'](_0x5d4ba4)){_0x21c2a5[_0xb2a2('0xdb')](_0x3250ac,_0x2e132a,_0x4f896f,_0x42acc2)[_0xb2a2('0x7d')](function(_0x6654bf){logger['info'](_0xb2a2('0xdc'),'Queue:\x20'+_0x3250ac['queue']+'\x20IdHopper:\x20'+_0x3250ac[_0xb2a2('0xbf')],JSON[_0xb2a2('0x54')](_0x6654bf));ami[_0xb2a2('0x26')](_0xb2a2('0xdd'),ut['buildObj'](_0x3250ac,_0xb2a2('0xde')));_0x386493(ut['message'](_0xb2a2('0xdf')));})[_0xb2a2('0x75')](function(_0x2dd5f8){ut[_0xb2a2('0x5d')](_0xb2a2('0xe0'),_0x2dd5f8);_0x60dca4(ut[_0xb2a2('0x4e')](_0xb2a2('0xe1'),_0xaee8d0,_0x6ebc7f));});}else{_0x2e132a['outboundBlacklistCallsDay']+=0x1;ut[_0xb2a2('0xe2')](_0x3250ac);rpcDb[_0xb2a2('0xe3')](_0x3250ac,_0xb2a2('0xe4'));delete _0x21c2a5[_0xb2a2('0x12')][_0x28f91a];_0x60dca4(ut['message'](_0xb2a2('0xe5'),_0xaee8d0,_0x6ebc7f));}});};Preview['prototype'][_0xb2a2('0x91')]=function(_0xef54ea){return!_[_0xb2a2('0x66')](_0xef54ea)&&!_[_0xb2a2('0x66')](_0xef54ea[_0xb2a2('0x29')])&&!_[_0xb2a2('0x66')](_0xef54ea['active'])&&_0xef54ea[_0xb2a2('0x51')]&&!_[_0xb2a2('0x66')](this['trunks'][util[_0xb2a2('0x55')](_0xb2a2('0xe6'),_0xef54ea[_0xb2a2('0x29')])])&&!_[_0xb2a2('0x66')](this[_0xb2a2('0x11')][util[_0xb2a2('0x55')]('SIP/%s',_0xef54ea[_0xb2a2('0x29')])]['status'])&&(this['trunks'][util[_0xb2a2('0x55')](_0xb2a2('0xe6'),_0xef54ea[_0xb2a2('0x29')])][_0xb2a2('0x73')]===_0xb2a2('0xe7')||this['trunks'][util[_0xb2a2('0x55')](_0xb2a2('0xe6'),_0xef54ea[_0xb2a2('0x29')])]['status']===_0xb2a2('0xe8'));};Preview[_0xb2a2('0x5f')]['run']=function(_0x2dc061,_0x547636){var _0xc09904=this;return new BPromise(function(_0x3eb022,_0x14f6d5){_0xc09904[_0xb2a2('0xe9')](_0x2dc061,_0x547636)['then'](function(_0x47fcf2){_0x3eb022(_[_0xb2a2('0x6e')](_0x47fcf2,[_0xb2a2('0x4e')]));})[_0xb2a2('0x75')](function(_0x44241d){if(_0x44241d[_0xb2a2('0xea')]){rpcDb[_0xb2a2('0xbe')](_0x2dc061);}if(_0x44241d['active']){rpcDb[_0xb2a2('0xc0')](_0x2dc061);}_0x14f6d5(_[_0xb2a2('0x6e')](_0x44241d,['message']));});});};Preview[_0xb2a2('0x5f')][_0xb2a2('0xe9')]=function(_0x3dd393,_0xd17dbf){var _0x19f67c=this;return new BPromise(function(_0x37e7eb,_0x2d0bb5){var _0x4b3b78,_0x402405;rpcDb[_0xb2a2('0xeb')](_0x3dd393)['then'](function(_0x165a10){if(!_['isNil'](_0x165a10[0x0])){_0x402405=_0x165a10[0x0][_0xb2a2('0xec')]?![]:!![];_0x4b3b78=_0x165a10[0x0]['recallme']?!![]:![];_0x4b3b78=_0xd17dbf?!![]:_0x4b3b78;}var _0x110c5c=_0x19f67c[_0xb2a2('0xed')](_0x165a10);if(_0x110c5c[_0xb2a2('0xee')]){rpcDb[_0xb2a2('0xef')](_[_0xb2a2('0x6e')](_0x165a10[0x0],[_0xb2a2('0x70'),'Contact.phone']))[_0xb2a2('0x7d')](function(_0x2f20fa){_0x19f67c['checkInBlack'](_0x2f20fa,_0x165a10[0x0],_0xd17dbf,_0x402405,_0x4b3b78)[_0xb2a2('0x7d')](function(_0x2fc330){_0x37e7eb(_0x2fc330);})[_0xb2a2('0x75')](function(_0x19e83c){_0x2d0bb5(_0x19e83c);});})[_0xb2a2('0x75')](function(_0x171592){ut[_0xb2a2('0x5d')](_0xb2a2('0xf0'),_0x171592);_0x2d0bb5(ut[_0xb2a2('0x4e')](_0xb2a2('0xf1'),_0x402405,_0x4b3b78));});}else{_0x2d0bb5(ut[_0xb2a2('0x4e')](_0x110c5c['message'],_0x402405,_0x4b3b78));}})['catch'](function(_0x135d6d){ut[_0xb2a2('0x5d')]('[Preview][getContactPreview]',_0x135d6d);_0x2d0bb5(ut[_0xb2a2('0x4e')]('Call\x20unsuccessful',![],!![]));});});};Preview['prototype'][_0xb2a2('0xed')]=function(_0x31c7be){if(_[_0xb2a2('0x66')](_0x31c7be)||_[_0xb2a2('0xf2')](_0x31c7be)||!_['isNil'](_0x31c7be[0x0][_0xb2a2('0xf3')])&&_[_0xb2a2('0x66')](_0x31c7be[0x0][_0xb2a2('0xf3')][_0xb2a2('0x29')])){ut[_0xb2a2('0x5d')]('[Preview][validateContact][Empty\x20Contact]',_0x31c7be);return{'isValid':![],'message':_0xb2a2('0xf4')};}var _0x44e5a9=this['campaignsPreview'][_0x31c7be[0x0]['Queue'][_0xb2a2('0x29')]];_0x44e5a9['message']=_0xb2a2('0x93');if(_['isNil'](_0x44e5a9)){ut[_0xb2a2('0x5d')](_0xb2a2('0xf5'),_0x44e5a9);return{'isValid':![],'message':_0xb2a2('0xf6')};}if(!this['isTrunkReachable'](_0x44e5a9['Trunk'])){ut[_0xb2a2('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xb2a2('0xf7')+_0x44e5a9['name']+_0xb2a2('0xf8'));if(!this[_0xb2a2('0x91')](_0x44e5a9[_0xb2a2('0x92')])){ut[_0xb2a2('0x5d')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x44e5a9[_0xb2a2('0x29')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0xb2a2('0xf9')};}}if(!ut['isActive'](_0x44e5a9[_0xb2a2('0x36')])){ut[_0xb2a2('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x44e5a9['name']+'\x20Not\x20Active');return{'isValid':![],'message':_0xb2a2('0xf7')+_0x44e5a9[_0xb2a2('0x29')]+_0xb2a2('0xfa')};}return{'isValid':!![],'message':_0xb2a2('0xfb')};};Preview[_0xb2a2('0x5f')][_0xb2a2('0xdb')]=function(_0x45deb3,_0x2c2d66,_0x4ed28b,_0x26e5d3){var _0x3030f5=this;return new BPromise(function(_0x478781,_0x50e9b9){var _0x45fc1f=_0x45deb3['uniqueid'];var _0x276fe1=_0x3030f5[_0xb2a2('0x91')](_0x2c2d66[_0xb2a2('0x50')])?util[_0xb2a2('0x55')](_0xb2a2('0xfc'),_0x2c2d66['Trunk'][_0xb2a2('0x29')],_[_0xb2a2('0x66')](_0x2c2d66['dialPrefix'])?'':_0x2c2d66[_0xb2a2('0x3b')]['trim']()||'',_0x2c2d66[_0xb2a2('0xfd')]>0x0?_0x4ed28b[_0xb2a2('0xd7')][_0xb2a2('0xd8')][_0xb2a2('0xfe')](_0x2c2d66[_0xb2a2('0xfd')]):_0x4ed28b[_0xb2a2('0xd7')][_0xb2a2('0xd8')]):util[_0xb2a2('0x55')](_0xb2a2('0xfc'),_['isNil'](_0x2c2d66[_0xb2a2('0x92')])?_0x2c2d66[_0xb2a2('0x50')]['name']:_0x2c2d66[_0xb2a2('0x92')][_0xb2a2('0x29')],_[_0xb2a2('0x66')](_0x2c2d66['dialPrefix'])?'':_0x2c2d66[_0xb2a2('0x3b')][_0xb2a2('0xff')]()||'',_0x2c2d66[_0xb2a2('0xfd')]>0x0?_0x4ed28b['Contact']['phone'][_0xb2a2('0xfe')](_0x2c2d66[_0xb2a2('0xfd')]):_0x4ed28b[_0xb2a2('0xd7')][_0xb2a2('0xd8')]);var _0x3f783a=_0x3030f5[_0xb2a2('0x91')](_0x2c2d66['Trunk'])?ut[_0xb2a2('0x100')](_0x2c2d66[_0xb2a2('0x50')][_0xb2a2('0x52')],_0x2c2d66[_0xb2a2('0x38')],_0x2c2d66[_0xb2a2('0x101')]>0x0?ut[_0xb2a2('0x102')](_0x2c2d66['dialOriginateCallerIdNumber'],_0x2c2d66[_0xb2a2('0x101')]):_0x2c2d66[_0xb2a2('0x39')]):ut[_0xb2a2('0x100')](_[_0xb2a2('0x66')](_0x2c2d66[_0xb2a2('0x92')])?_0x2c2d66[_0xb2a2('0x50')][_0xb2a2('0x52')]:_0x2c2d66['TrunkBackup'][_0xb2a2('0x52')],_0x2c2d66[_0xb2a2('0x38')],_0x2c2d66['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xb2a2('0x102')](_0x2c2d66[_0xb2a2('0x39')],_0x2c2d66[_0xb2a2('0x101')]):_0x2c2d66['dialOriginateCallerIdNumber']);if(_0x3f783a){_0x45deb3[_0xb2a2('0x103')]=ut['extractCalleridName'](_0x3f783a);_0x45deb3[_0xb2a2('0x104')]=ut[_0xb2a2('0x105')](_0x3f783a);}var _0x3ee9a7=ut[_0xb2a2('0x106')](_0x2c2d66,_0x4ed28b,_0x276fe1,_0x3f783a,_0x45fc1f,_0x45deb3);_['merge'](_0x45deb3,ut[_0xb2a2('0x107')](_0x3ee9a7));_0x45deb3[_0xb2a2('0x108')]=moment()['format'](_0xb2a2('0x84'));ami['Action'](ut['variablesAction'](_0x45deb3,_0x2c2d66,_0x3ee9a7,_0x45deb3[_0xb2a2('0xaf')],_0x26e5d3))[_0xb2a2('0x7d')](function(_0x1a9f91){_0x2c2d66[_0xb2a2('0x4f')]+=0x1;logger['info'](_0xb2a2('0x109'),_0x45fc1f,_0xb2a2('0x9c'),_0x2c2d66[_0xb2a2('0x29')],_0xb2a2('0x6b'),_0x2c2d66[_0xb2a2('0x4f')]);_0x478781(_0x1a9f91);})['catch'](function(_0x103a7f){ut[_0xb2a2('0xcc')](_0x45deb3,0xe,'OriginateError');rpcDb[_0xb2a2('0xcd')](_0x45deb3,_0xb2a2('0x10a'));_0x50e9b9(_0x103a7f);});});};Preview[_0xb2a2('0x5f')][_0xb2a2('0x1e')]=function(_0x5eef9e){if(this[_0xb2a2('0x12')][_0x5eef9e[_0xb2a2('0x9a')]]){this['actions'][_0x5eef9e[_0xb2a2('0x9a')]][_0xb2a2('0x74')]=_0x5eef9e[_0xb2a2('0x74')];}};Preview['prototype'][_0xb2a2('0x10b')]=function(_0x878024){var _0x8122dc=this;var _0x363c4a=this['actions'][_0x878024[_0xb2a2('0x10c')]];if(_0x363c4a){if(_0x363c4a[_0xb2a2('0xda')]&&this[_0xb2a2('0x13')][_0x363c4a[_0xb2a2('0xda')]]){ut[_0xb2a2('0x10d')](_0x363c4a,this[_0xb2a2('0x13')][_0x363c4a[_0xb2a2('0xda')]][_0xb2a2('0x29')],this[_0xb2a2('0x13')][_0x363c4a[_0xb2a2('0xda')]]['id']);}var _0x482b50=_[_0xb2a2('0x10e')](_0x363c4a);_0x482b50['responsetime']=moment()[_0xb2a2('0x55')](_0xb2a2('0x84'));var _0x1d6660=_0x8122dc['campaignsPreview'][_0x363c4a[_0xb2a2('0x6a')]];if(ut[_0xb2a2('0x10f')](_0x878024[_0xb2a2('0x110')])){if(_0x363c4a[_0xb2a2('0xae')]){rpcDb[_0xb2a2('0xbe')](_0x363c4a['idContact']);}if(_0x363c4a[_0xb2a2('0xaf')]){rpcDb[_0xb2a2('0xc0')](_0x363c4a[_0xb2a2('0xbf')]);}ami[_0xb2a2('0x26')](_0xb2a2('0x111'),ut[_0xb2a2('0xa2')](_0x363c4a,_0xb2a2('0x112')));this[_0xb2a2('0x113')](_0x482b50,_0x1d6660,_0x878024);}else{_0x363c4a[_0xb2a2('0x108')]=moment()[_0xb2a2('0x55')](_0xb2a2('0x84'));ut[_0xb2a2('0xcc')](_0x482b50,0x4,'Answer');rpcDb[_0xb2a2('0xcd')](_0x482b50,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0xb2a2('0x5f')][_0xb2a2('0x17')]=function(_0xdfc525){var _0x45d71d=this;var _0x38696a=this['actions'][_0xdfc525[_0xb2a2('0x9a')]];var _0x26dabb;if(_0x38696a){_0x26dabb=this[_0xb2a2('0x10')][_0x38696a[_0xb2a2('0x6a')]];logger[_0xb2a2('0x67')](_0xb2a2('0x114'),_0xdfc525[_0xb2a2('0x9a')],_0xb2a2('0x9c'),_0x26dabb[_0xb2a2('0x29')],'pTalking:\x20',_0x26dabb[_0xb2a2('0x2d')]);}if(this[_0xb2a2('0x12')][_0xdfc525['linkedid']]&&_0xdfc525[_0xb2a2('0x9a')]!==_0xdfc525[_0xb2a2('0xc7')]){if(_0xdfc525[_0xb2a2('0x115')]==='16'&&this[_0xb2a2('0x12')][_0xdfc525[_0xb2a2('0x9a')]]['dialAnswer']){this[_0xb2a2('0x116')](_0xdfc525,_0xdfc525[_0xb2a2('0x9a')],_0xdfc525[_0xb2a2('0x115')]);}else if(this[_0xb2a2('0x12')][_0xdfc525[_0xb2a2('0x9a')]]['dialAnswer']){logger[_0xb2a2('0x67')](_0xb2a2('0x117'),_0xdfc525['linkedid'],_0xdfc525[_0xb2a2('0x115')],_0xb2a2('0x9c'),_0x26dabb[_0xb2a2('0x29')],_0xb2a2('0x6c'),_0x26dabb[_0xb2a2('0x2d')]);this['callProgressDetectingCustomer'](_0xdfc525,_0xdfc525[_0xb2a2('0x9a')],_0xdfc525['cause']);}}else if(_0x38696a&&_[_0xb2a2('0x66')](_0x38696a[_0xb2a2('0x118')])&&_0x26dabb[_0xb2a2('0x119')]&&_0xdfc525[_0xb2a2('0x9a')]===_0xdfc525[_0xb2a2('0xc7')]&&_[_0xb2a2('0x66')](_0xdfc525['reason'])&&_0xdfc525[_0xb2a2('0x115')]==='16'&&_0xdfc525[_0xb2a2('0x11a')]==='6'&&_['isUndefined'](_0x38696a[_0xb2a2('0x11b')])){if(_0x38696a['unlockAgent']){rpcDb[_0xb2a2('0xbe')](_0x38696a[_0xb2a2('0xbf')]);}if(_0x38696a[_0xb2a2('0xaf')]){rpcDb[_0xb2a2('0xc0')](_0x38696a['idContact']);}_0xdfc525['reason']='22';this[_0xb2a2('0x113')](_0x38696a,_0x26dabb,_0xdfc525);}else if(_0x38696a&&_0x38696a[_0xb2a2('0x11b')]){if(_0xdfc525[_0xb2a2('0x115')]==='16'&&this[_0xb2a2('0x12')][_0xdfc525[_0xb2a2('0x9a')]][_0xb2a2('0x6d')]){logger[_0xb2a2('0x67')]('[syncHangup][talking][transfer]',_0xdfc525[_0xb2a2('0x9a')],_0xdfc525['cause'],_0xb2a2('0x9c'),_0x26dabb[_0xb2a2('0x29')],_0xb2a2('0x6c'),_0x26dabb[_0xb2a2('0x2d')]);this[_0xb2a2('0x116')](_0xdfc525,_0xdfc525[_0xb2a2('0x9a')],_0xdfc525['cause']);}else if(this[_0xb2a2('0x12')][_0xdfc525[_0xb2a2('0x9a')]][_0xb2a2('0x6d')]){logger[_0xb2a2('0x67')](_0xb2a2('0x117'),_0xdfc525[_0xb2a2('0x9a')],_0xdfc525[_0xb2a2('0x115')],_0xb2a2('0x9c'),_0x26dabb[_0xb2a2('0x29')],_0xb2a2('0x6c'),_0x26dabb[_0xb2a2('0x2d')]);this[_0xb2a2('0x116')](_0xdfc525,_0xdfc525[_0xb2a2('0x9a')],_0xdfc525[_0xb2a2('0x115')]);}}};Preview[_0xb2a2('0x5f')][_0xb2a2('0x1c')]=function(_0x3c5077){if(this['actions'][_0x3c5077['destlinkedid']]&&_0x3c5077[_0xb2a2('0xc9')]!==_0x3c5077[_0xb2a2('0x11c')]){this[_0xb2a2('0x116')](_0x3c5077,_0x3c5077['destlinkedid'],_0x3c5077[_0xb2a2('0xc4')]);}};Preview[_0xb2a2('0x5f')]['syncHangupRequest']=function(_0x155f63){if(this[_0xb2a2('0x12')][_0x155f63[_0xb2a2('0x9a')]]&&_0x155f63[_0xb2a2('0x9a')]!==_0x155f63[_0xb2a2('0xc7')]&&!this[_0xb2a2('0x12')][_0x155f63[_0xb2a2('0x9a')]]['dialAnswer']){if(_0x155f63[_0xb2a2('0x115')]==='1'){this['callProgressDetectingCustomer'](_0x155f63,_0x155f63[_0xb2a2('0x9a')],_0x155f63[_0xb2a2('0x115')]);}}};Preview['prototype'][_0xb2a2('0x11d')]=function(_0x26b9aa,_0x74ee17,_0x4036dc){if(this['actions'][_0x26b9aa]){if(_[_0xb2a2('0x66')](this[_0xb2a2('0x12')][_0x26b9aa][_0xb2a2('0x11e')])){this[_0xb2a2('0x12')][_0x26b9aa][_0xb2a2('0x11e')]={};}this['actions'][_0x26b9aa][_0xb2a2('0x11e')][_0x74ee17]=_0x4036dc;}};Preview['prototype'][_0xb2a2('0x20')]=function(_0x166aec){try{if(!_[_0xb2a2('0x66')](_0x166aec)){if(ut['filterKey'](_[_0xb2a2('0x11f')](_0x166aec['variable'])[0x0])){this[_0xb2a2('0x11d')](_0x166aec[_0xb2a2('0xc7')],_[_0xb2a2('0x11f')](_0x166aec[_0xb2a2('0x120')])[0x0],_0x166aec[_0xb2a2('0x121')]);}}}catch(_0x22893b){logger['error'](_0xb2a2('0x122'),util[_0xb2a2('0x123')](_0x22893b,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0xb2a2('0x22')]=function(_0x2dec15){if(_0x2dec15){if(this['actions'][_0x2dec15[_0xb2a2('0x124')]]){this[_0xb2a2('0x12')][_0x2dec15[_0xb2a2('0x124')]][_0xb2a2('0x11b')]=!![];}}};Preview[_0xb2a2('0x5f')][_0xb2a2('0x24')]=function(_0x515670){if(_0x515670){if(this[_0xb2a2('0x12')][_0x515670['transfererlinkedid']]){this[_0xb2a2('0x12')][_0x515670[_0xb2a2('0x125')]][_0xb2a2('0x11b')]=!![];}}};module[_0xb2a2('0x126')]=Preview; \ No newline at end of file +var _0xb3f9=['dialBusyRetryFrequency','unlockAgent','activeContact','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','countcongestionretry','CANCEL','[syncHangupRequest][logAgentReject]','unlockContact','idContact','disableContact','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','AnswerAGI','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','isNil','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','Calling','[Preview][execCall][failure]','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','unmonitored','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','Contact','phone','substring','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','actionid','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','syncHangup','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','variables','filterKey','keys','variable','addVariable','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','moment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','socket.io-emitter','localhost','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumHoldTime','total','unmanaged','waiting','loggedInDb','dialMethod','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','voice_queue_channel:remove','sendMessageOneNotActive','paused','message','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','logger','\x20is\x20disactive','prototype','syncCampaigns','hasOwnProperty','recallMe','clearZombieChannel','info','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','setMessage','AGENTS_NOT_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','[callProgressDetectingCustomer][logNoSuchGlobal]','createCustomerFinal','linkedid','ANSWER','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','scheduledAt'];(function(_0x3b2db8,_0xf196b0){var _0x43e4ca=function(_0x18c3e5){while(--_0x18c3e5){_0x3b2db8['push'](_0x3b2db8['shift']());}};_0x43e4ca(++_0xf196b0);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x207565,_0x245ed7){_0x207565=_0x207565-0x0;var _0x15014a=_0xb3f9[_0x207565];return _0x15014a;};'use strict';var util=require(_0x9b3f('0x0'));var _=require(_0x9b3f('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x9b3f('0x2'));var md5=require('md5');var logger=require(_0x9b3f('0x3'))(_0x9b3f('0x4'));var loggerAction=require(_0x9b3f('0x3'))(_0x9b3f('0x5'));var ami=require(_0x9b3f('0x6'));var rpcDb=require(_0x9b3f('0x7'));var Action=require('./action');var ut=require('./util/util');var io=require(_0x9b3f('0x8'))({'host':_0x9b3f('0x9'),'port':0x18eb});var Sequence=function(){};Sequence['prototype'][_0x9b3f('0xa')]=function(_0x53b154){this['tail']=this['tail']?this[_0x9b3f('0xb')]['finally'](_0x53b154):_0x53b154();};function Preview(_0x297ffa){this[_0x9b3f('0xc')]=new Sequence();this[_0x9b3f('0xd')]=_0x297ffa[_0x9b3f('0xe')];this[_0x9b3f('0xf')]=_0x297ffa['trunks'];this[_0x9b3f('0x10')]={};this[_0x9b3f('0x11')]=_0x297ffa[_0x9b3f('0x11')];this[_0x9b3f('0x12')]=0x0;ami['on'](_0x9b3f('0x13'),this[_0x9b3f('0x14')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x16'),this['syncHangup']['bind'](this));ami['on'](_0x9b3f('0x17'),this[_0x9b3f('0x18')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x19'),this[_0x9b3f('0x1a')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x1b'),this[_0x9b3f('0x1c')][_0x9b3f('0x15')](this));ami['on'](_0x9b3f('0x1d'),this[_0x9b3f('0x1e')]['bind'](this));ami['on']('blindtransfer',this[_0x9b3f('0x1f')][_0x9b3f('0x15')](this));this[_0x9b3f('0x20')](this[_0x9b3f('0xd')]);}function emit(_0x213f46,_0x297fa8,_0x1524cb){io['to'](_0x213f46)[_0x9b3f('0x21')](_0x297fa8,_0x1524cb);}function emitCampaignPreview(_0x3f16aa){if(_0x3f16aa[_0x9b3f('0x22')]===_0x9b3f('0x23')){var _0x1cb346={'id':_0x3f16aa['id'],'name':_0x3f16aa[_0x9b3f('0x24')],'strategy':_0x3f16aa[_0x9b3f('0x25')],'answered':_0x3f16aa[_0x9b3f('0x26')],'available':_0x3f16aa[_0x9b3f('0x27')],'loggedIn':_0x3f16aa[_0x9b3f('0x28')],'pTalking':_0x3f16aa[_0x9b3f('0x29')],'sumBillable':_0x3f16aa[_0x9b3f('0x2a')],'sumDuration':_0x3f16aa['sumDuration'],'sumHoldTime':_0x3f16aa[_0x9b3f('0x2b')]||0x0,'talking':_0x3f16aa['talking'],'total':_0x3f16aa[_0x9b3f('0x2c')],'type':_0x3f16aa['type'],'unmanaged':_0x3f16aa[_0x9b3f('0x2d')],'waiting':_0x3f16aa[_0x9b3f('0x2e')],'loggedInDb':_0x3f16aa[_0x9b3f('0x2f')],'dialActive':_0x3f16aa['dialActive'],'dialMethod':_0x3f16aa[_0x9b3f('0x30')],'dialOriginateCallerIdName':_0x3f16aa['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x3f16aa[_0x9b3f('0x31')],'dialOriginateTimeout':_0x3f16aa['dialOriginateTimeout'],'dialPrefix':_0x3f16aa[_0x9b3f('0x32')],'outboundAnswerAgiCallsDay':_0x3f16aa[_0x9b3f('0x33')],'outboundAnswerCallsDay':_0x3f16aa['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3f16aa[_0x9b3f('0x34')],'outboundBusyCallsDay':_0x3f16aa[_0x9b3f('0x35')],'outboundCongestionCallsDay':_0x3f16aa[_0x9b3f('0x36')],'outboundDropCallsDayACS':_0x3f16aa[_0x9b3f('0x37')],'outboundDropCallsDayCallersExit':_0x3f16aa['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x3f16aa['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x3f16aa[_0x9b3f('0x38')],'outboundNoSuchCallsDay':_0x3f16aa['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3f16aa[_0x9b3f('0x39')],'outboundReCallsDay':_0x3f16aa['outboundReCallsDay'],'outboundRejectCallsDay':_0x3f16aa[_0x9b3f('0x3a')],'outboundUnknownCallsDay':_0x3f16aa[_0x9b3f('0x3b')],'predictiveIntervalAnsweredCalls':_0x3f16aa[_0x9b3f('0x3c')],'predictiveIntervalAvgHoldtime':_0x3f16aa[_0x9b3f('0x3d')],'predictiveIntervalAvgTalktime':_0x3f16aa[_0x9b3f('0x3e')],'predictiveIntervalDroppedCallsCallersExit':_0x3f16aa['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3f16aa[_0x9b3f('0x3f')],'predictiveIntervalErlangCalls':_0x3f16aa[_0x9b3f('0x40')],'predictiveIntervalErlangCallsDroppedCalls':_0x3f16aa[_0x9b3f('0x41')],'predictiveIntervalHitRate':_0x3f16aa[_0x9b3f('0x42')],'predictiveIntervalLowerLimit':_0x3f16aa[_0x9b3f('0x43')],'predictiveIntervalMultiplicativeFactor':_0x3f16aa[_0x9b3f('0x44')],'predictiveIntervalPauses':_0x3f16aa[_0x9b3f('0x45')],'predictiveIntervalTotalCalls':_0x3f16aa['predictiveIntervalTotalCalls'],'message':_0x3f16aa['message'],'originated':_0x3f16aa[_0x9b3f('0x46')]};if(_0x3f16aa['Trunk']){_0x1cb346['Trunk']={'id':_0x3f16aa[_0x9b3f('0x47')]['id'],'name':_0x3f16aa['Trunk'][_0x9b3f('0x24')],'active':_0x3f16aa[_0x9b3f('0x47')][_0x9b3f('0x48')],'callerid':_0x3f16aa[_0x9b3f('0x47')][_0x9b3f('0x49')]};}if(_0x3f16aa['Interval']){_0x1cb346[_0x9b3f('0x4a')]={'id':_0x3f16aa[_0x9b3f('0x4a')]['id'],'name':_0x3f16aa[_0x9b3f('0x4a')][_0x9b3f('0x24')]};}var _0x378e87=md5(JSON[_0x9b3f('0x4b')](_0x1cb346));if(_0x3f16aa['md5']!==_0x378e87){_0x3f16aa[_0x9b3f('0x4c')]=_0x378e87;emit(util[_0x9b3f('0x4d')](_0x9b3f('0x4e'),_0x1cb346['name']),_0x9b3f('0x4f'),_0x1cb346);}}}function emitVoiceQueueChannelRemove(_0x417135){emit(util[_0x9b3f('0x4d')](_0x9b3f('0x4e'),_0x417135[_0x9b3f('0x24')]),_0x9b3f('0x50'),_0x417135);}function notSendMessagesQueue(_0x5431a6){if(_0x5431a6[_0x9b3f('0x51')]){if(_0x5431a6[_0x9b3f('0x46')]===0x0&&_0x5431a6[_0x9b3f('0x29')]===0x0){_0x5431a6[_0x9b3f('0x51')]=![];_0x5431a6[_0x9b3f('0x27')]=0x0;_0x5431a6[_0x9b3f('0x52')]=0x0;_0x5431a6[_0x9b3f('0x53')]=_0x9b3f('0x54');ut['logger'](_0x9b3f('0x55'),_0x5431a6[_0x9b3f('0x24')]+_0x9b3f('0x56'));}else{_0x5431a6[_0x9b3f('0x53')]=_0x9b3f('0x57');ut[_0x9b3f('0x58')](_0x9b3f('0x55'),_0x5431a6['name']+_0x9b3f('0x59'));}emitCampaignPreview(_0x5431a6);}}Preview[_0x9b3f('0x5a')]['loopCampaigns']=function(){var _0x38bb4b=this;setInterval(function(){_0x38bb4b[_0x9b3f('0x5b')]();},0x7cf);};Preview['prototype'][_0x9b3f('0x5b')]=function(){var _0x2afda2=this[_0x9b3f('0xd')];this['clockClearZombieChannels']+=0x1;for(var _0x11db55 in _0x2afda2){if(_0x2afda2[_0x9b3f('0x5c')](_0x11db55)&&(_0x2afda2[_0x11db55][_0x9b3f('0x30')]===_0x9b3f('0x4')||_0x2afda2[_0x11db55][_0x9b3f('0x30')]==='booked')&&_0x2afda2[_0x11db55]['type']===_0x9b3f('0x23')){if(this[_0x9b3f('0x12')]>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x2afda2[_0x9b3f('0x5c')](_0x11db55)&&_0x2afda2[_0x11db55]['dialMethod']===_0x9b3f('0x4')&&_0x2afda2[_0x11db55]['type']===_0x9b3f('0x23')){if(_0x2afda2[_0x11db55]['dialActive']){this['setMessage'](_0x2afda2[_0x11db55]);this[_0x9b3f('0x5d')](_0x2afda2[_0x11db55]);}else{notSendMessagesQueue(_0x2afda2[_0x11db55]);}}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x5e')]=function(_0x1300dc){var _0x588e84=this;this['sequence'][_0x9b3f('0xa')](function(){if(!_['isNil'](_0x588e84[_0x9b3f('0x10')][_0x1300dc])){loggerAction[_0x9b3f('0x5f')]('[clearZombieChannels][talking]',_0x1300dc,_0x9b3f('0x60'),_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')],_0x9b3f('0x62'),JSON['stringify'](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]][_0x9b3f('0x46')]),_0x9b3f('0x63'),JSON['stringify'](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc]['queue']][_0x9b3f('0x29')]),JSON[_0x9b3f('0x4b')](_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x64')]),JSON[_0x9b3f('0x4b')](_[_0x9b3f('0x65')](_0x588e84[_0x9b3f('0x10')][_0x1300dc],['contactId',_0x9b3f('0x66'),_0x9b3f('0x67'),_0x9b3f('0x68')])));return ami[_0x9b3f('0x69')]({'action':_0x9b3f('0x6a'),'channel':_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x6b')]})[_0x9b3f('0x6c')](function(_0xbbd406){if(_0xbbd406['message']===_0x9b3f('0x6d')){setTimeout(function(){if(_0x588e84['actions'][_0x1300dc]){ut[_0x9b3f('0x6e')](_0x588e84[_0x9b3f('0xd')][_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]],'[clearZombieChannel]');if(_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x64')]===!![]){ut[_0x9b3f('0x6f')](_0x588e84[_0x9b3f('0xd')][_0x588e84['actions'][_0x1300dc]['queue']],'[clearZombieChannel]');ut['loggerError'](_0x9b3f('0x70')+_0x1300dc,_0x588e84[_0x9b3f('0x10')][_0x1300dc][_0x9b3f('0x61')]);}ut[_0x9b3f('0x71')](_0x9b3f('0x72')+_0x1300dc,_0x588e84['actions'][_0x1300dc][_0x9b3f('0x61')]);delete _0x588e84['actions'][_0x1300dc];}},0x2328);}});}});};Preview[_0x9b3f('0x5a')][_0x9b3f('0x73')]=function(){var _0x5df6dc=this;loggerAction[_0x9b3f('0x5f')](_0x9b3f('0x74'),_[_0x9b3f('0x75')](this[_0x9b3f('0x10')]));for(var _0x36320e in this[_0x9b3f('0x10')]){if(_0x5df6dc[_0x9b3f('0x10')]['hasOwnProperty'](_0x36320e)){_0x5df6dc[_0x9b3f('0x5e')](_0x36320e);}}};Preview['prototype'][_0x9b3f('0x5d')]=function(_0x264de2){var _0x7839f9=this;rpcDb[_0x9b3f('0x76')](_0x264de2['id'],ut[_0x9b3f('0x77')](this['agents']))[_0x9b3f('0x78')](function(_0xbea8cb){if(!_['isNil'](_0xbea8cb)){for(var _0x91a863=0x0;_0x91a863<_0xbea8cb[_0x9b3f('0x79')];_0x91a863+=0x1){if(ut[_0x9b3f('0x7a')](_0xbea8cb[_0x91a863]['scheduledat'])<_0x264de2[_0x9b3f('0x7b')]*0x3c){_0x7839f9[_0x9b3f('0x7c')](_0xbea8cb[_0x91a863]['id'])['then'](ut[_0x9b3f('0x7d')](_0x9b3f('0x7e')))[_0x9b3f('0x6c')](ut[_0x9b3f('0x7d')](_0x9b3f('0x7e')));}else{var _0x526623=new Action(_0xbea8cb[_0x91a863],_0x264de2);_0x526623[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')](_0x9b3f('0x80'));_0x264de2[_0x9b3f('0x81')]+=0x1;ut[_0x9b3f('0x82')](_0x526623,0x17,_0x9b3f('0x83'));if(_0x264de2[_0x9b3f('0x84')]){rpcDb[_0x9b3f('0x85')](ut[_0x9b3f('0x86')](_0xbea8cb[_0x91a863]));rpcDb[_0x9b3f('0x87')](_0x526623,_0x9b3f('0x88'));}else{ut[_0x9b3f('0x82')](_0x526623,0x16,_0x9b3f('0x89'));rpcDb[_0x9b3f('0x87')](_0x526623,_0x9b3f('0x8a'));rpcDb['createCustomerFinal'](_0x526623,_0x9b3f('0x8a'));}}}}})[_0x9b3f('0x6c')](ut[_0x9b3f('0x7d')](_0x9b3f('0x8b')));};Preview[_0x9b3f('0x5a')][_0x9b3f('0x8c')]=function(_0x2ff84b){_0x2ff84b[_0x9b3f('0x51')]=!![];if(ut['IsNotLoggedIn'](_0x2ff84b[_0x9b3f('0x28')])){_0x2ff84b['message']=_0x9b3f('0x8d');}else if(!ut[_0x9b3f('0x8e')](_0x2ff84b[_0x9b3f('0x8f')])){_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x54');}else if(!this[_0x9b3f('0x90')](_0x2ff84b[_0x9b3f('0x47')])){if(!this[_0x9b3f('0x90')](_0x2ff84b[_0x9b3f('0x91')])){_0x2ff84b[_0x9b3f('0x53')]='TRUNK_IS_NOT_REACHABLE';}else{_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x92');}}else{_0x2ff84b[_0x9b3f('0x53')]=_0x9b3f('0x92');}emitCampaignPreview(_0x2ff84b);};Preview[_0x9b3f('0x5a')]['callProgressDetectingCustomer']=function(_0x1e5fd4,_0x3f8cba,_0x57e385){var _0x1f6049=this;var _0x5ad8df=this['actions'][_0x3f8cba];var _0x564850=this['campaignsPreview'][_0x5ad8df[_0x9b3f('0x61')]];var _0x401089;if(_0x564850){switch(_0x57e385){case'1':_0x564850['outboundNoSuchCallsDay']+=0x1;_0x5ad8df['countglobal']=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x0,_0x9b3f('0x94'));rpcDb['createCustomerHistory'](_0x5ad8df,_0x9b3f('0x95'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut['cloneAction'](_0x5ad8df,0xf,'Global');rpcDb['createCustomerFinal'](_0x401089,_0x9b3f('0x96'));}else{rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0x96'));}delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];break;case _0x9b3f('0x99'):var _0x321eb8=moment()['format'](_0x9b3f('0x80'));_0x5ad8df[_0x9b3f('0x9a')]=_0x321eb8;_0x5ad8df[_0x9b3f('0x9b')]=_0x321eb8;_0x5ad8df[_0x9b3f('0x64')]=!![];_0x564850[_0x9b3f('0x29')]+=0x1;logger['info']('[syncHangup][talking][increment]',_0x5ad8df[_0x9b3f('0x9c')],_0x9b3f('0x9d'),_0x564850['name'],_0x9b3f('0x63'),_0x564850[_0x9b3f('0x29')]);ami[_0x9b3f('0x21')](_0x9b3f('0x9e'),ut[_0x9b3f('0x9f')](_0x5ad8df,'connect'));if(_0x564850[_0x9b3f('0xa0')]){ami[_0x9b3f('0x21')](_0x9b3f('0xa1'),ut[_0x9b3f('0xa2')](_0x5ad8df));}break;case'16':ami['emit'](_0x9b3f('0xa3'),ut[_0x9b3f('0x9f')](_0x5ad8df,_0x9b3f('0xa4')));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5ad8df,_0x9b3f('0xa4')));_0x564850['outboundAnswerCallsDay']+=0x1;_0x564850[_0x9b3f('0x2c')]+=0x1;_0x564850[_0x9b3f('0x26')]+=0x1;ut[_0x9b3f('0x6f')](_0x564850,_0x9b3f('0xa5'));_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x4,_0x9b3f('0xa7'));rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xa8'));rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xa9'));rpcDb[_0x9b3f('0xaa')](_0x5ad8df);_0x564850[_0x9b3f('0xab')]+=_0x5ad8df[_0x9b3f('0xac')];_0x564850[_0x9b3f('0x2a')]+=_0x5ad8df['talktime'];logger['info'](_0x9b3f('0xad'),_0x5ad8df[_0x9b3f('0x9c')],_0x9b3f('0x9d'),_0x564850[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x564850[_0x9b3f('0x29')]);delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];break;case'BUSY':_0x564850[_0x9b3f('0x35')]+=0x1;_0x5ad8df[_0x9b3f('0xae')]+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x5,_0x9b3f('0xaf'));rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xb0'));if(ut[_0x9b3f('0x93')](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,'Global');rpcDb[_0x9b3f('0x97')](_0x401089,_0x9b3f('0xb2'));}else{if(_0x5ad8df['countbusyretry']>=_0x564850[_0x9b3f('0xb3')]){rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xb0'));}else{rpcDb[_0x9b3f('0xb4')](ut[_0x9b3f('0xb5')](_0x5ad8df,'countbusyretry',_0x564850[_0x9b3f('0xb6')]),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xb9'):_0x564850[_0x9b3f('0x38')]+=0x1;_0x5ad8df[_0x9b3f('0xba')]+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x3,'NoAnswer');rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xbb'));if(ut[_0x9b3f('0x93')](_0x5ad8df)>=_0x564850[_0x9b3f('0xbc')]){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb[_0x9b3f('0x97')](_0x401089,_0x9b3f('0xbe'));}else{if(_0x5ad8df['countnoanswerretry']>=_0x564850[_0x9b3f('0xbf')]){rpcDb['createCustomerFinal'](_0x5ad8df,_0x9b3f('0xbb'));}else{rpcDb[_0x9b3f('0xb4')](ut[_0x9b3f('0xb5')](_0x5ad8df,_0x9b3f('0xba'),_0x564850['dialNoAnswerRetryFrequency']),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xc0'):_0x564850['outboundCongestionCallsDay']+=0x1;_0x5ad8df['countcongestionretry']+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut[_0x9b3f('0x82')](_0x5ad8df,0x8,'Congestion');rpcDb['createCustomerHistory'](_0x5ad8df,_0x9b3f('0xc1'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb[_0x9b3f('0x97')](_0x401089,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x5ad8df['countcongestionretry']>=_0x564850[_0x9b3f('0xc2')]){rpcDb[_0x9b3f('0x97')](_0x5ad8df,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x9b3f('0xb5')](_0x5ad8df,_0x9b3f('0xc3'),_0x564850[_0x9b3f('0xb6')]),_0x5ad8df[_0x9b3f('0xb7')],_0x5ad8df[_0x9b3f('0xb8')]);}}break;case _0x9b3f('0xc4'):_0x564850[_0x9b3f('0x3a')]+=0x1;_0x5ad8df['countglobal']=ut[_0x9b3f('0x93')](_0x5ad8df);ut['logCustomer'](_0x5ad8df,0x14,'AgentReject');rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xc5'));if(_0x5ad8df[_0x9b3f('0xb7')]){rpcDb[_0x9b3f('0xc6')](_0x5ad8df[_0x9b3f('0xc7')]);}if(_0x5ad8df[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x5ad8df['idContact']);}break;default:if(_0x5ad8df[_0x9b3f('0x64')]){ut[_0x9b3f('0x6f')](_0x564850,_0x9b3f('0xc9'));ut[_0x9b3f('0x71')](_0x9b3f('0xca')+_0x564850[_0x9b3f('0x24')],_0x1e5fd4);}_0x564850['outboundUnknownCallsDay']+=0x1;_0x5ad8df[_0x9b3f('0xa6')]=ut[_0x9b3f('0x93')](_0x5ad8df);ut['logCustomer'](_0x5ad8df,0xc,_0x1e5fd4['cause-txt']||_0x1e5fd4[_0x9b3f('0xcb')]);rpcDb[_0x9b3f('0x87')](_0x5ad8df,_0x9b3f('0xcc'));if(ut['totalGlobal'](_0x5ad8df)>=_0x564850['dialGlobalMaxRetry']){_0x401089=ut[_0x9b3f('0xb1')](_0x5ad8df,0xf,_0x9b3f('0xbd'));rpcDb['createCustomerFinal'](_0x401089,_0x9b3f('0xcd'));}else{rpcDb[_0x9b3f('0x97')](_0x5ad8df,_0x9b3f('0xcd'));}delete this['actions'][_0x1e5fd4[_0x9b3f('0x98')]];}if(!(_0x5ad8df[_0x9b3f('0x64')]&&_0x57e385==='16')){ut[_0x9b3f('0x6e')](_0x564850,_0x9b3f('0xce'));logger[_0x9b3f('0x5f')](_0x9b3f('0xcf'),_0x5ad8df[_0x9b3f('0x9c')],'\x20Queue',_0x564850[_0x9b3f('0x24')],_0x9b3f('0x62'),_0x564850[_0x9b3f('0x46')]);}if(_0x57e385!==_0x9b3f('0x99')){delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0x98')]];delete this[_0x9b3f('0x10')][_0x1e5fd4[_0x9b3f('0xd0')]];}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0xd1')]=function(_0x5a6fa1,_0x5e7901,_0xa0582d){if(_[_0x9b3f('0xd2')](_0x5e7901)&&_0x9b3f('0xd3')!==typeof _0x5e7901){return;}if(_[_0x9b3f('0xd2')](_0xa0582d)&&_0x9b3f('0xd3')!==typeof _0xa0582d){return;}switch(_0xa0582d[_0x9b3f('0xd4')]){case'0':ut['logAgent'](_0x5a6fa1,0x0,'NoSuchNumber');rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xd6'));break;case'3':ut[_0x9b3f('0xd7')](_0x5a6fa1,0x3,'NoAnswer');rpcDb['createAgentHistory'](_0x5a6fa1,_0x9b3f('0xd8'));break;case'5':ut['logAgent'](_0x5a6fa1,0x5,_0x9b3f('0xaf'));rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xd9'));break;case'8':ut['logAgent'](_0x5a6fa1,0x8,_0x9b3f('0xda'));rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x9b3f('0xd7')](_0x5a6fa1,0x16,_0x9b3f('0xdb'));rpcDb['createAgentHistory'](_0x5a6fa1,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0x5a6fa1,0xc,_0xa0582d[_0x9b3f('0xd4')]);rpcDb[_0x9b3f('0xd5')](_0x5a6fa1,_0x9b3f('0xdc'));}ut[_0x9b3f('0x6e')](_0x5e7901,_0x9b3f('0xdd'));logger['info'](_0x9b3f('0xde'),_0x5a6fa1[_0x9b3f('0x9c')],'\x20Queue',_0x5e7901[_0x9b3f('0x24')],_0x9b3f('0x62'),_0x5e7901[_0x9b3f('0x46')]);delete this['actions'][_0x5a6fa1[_0x9b3f('0x9c')]];};Preview[_0x9b3f('0x5a')][_0x9b3f('0xdf')]=function(_0x2d4782,_0x4e3fc8,_0x352d65,_0x4193bc,_0x444708){var _0x12dd14=this;return new BPromise(function(_0x29a050,_0x23f276){if(_[_0x9b3f('0xe0')](_0x4e3fc8)||_[_0x9b3f('0xe0')](_0x4e3fc8['Contact'])||_['isNil'](_0x4e3fc8['Contact']['phone'])||_[_0x9b3f('0xe0')](_0x4e3fc8['VoiceQueueId'])){_0x23f276(ut[_0x9b3f('0x53')]('Contact\x20is\x20undefined',_0x4193bc,_0x444708));return;}var _0x5177dd=uuid['v4']();var _0x34a8f2=_0x12dd14['campaignsPreview'][_0x4e3fc8[_0x9b3f('0x60')][_0x9b3f('0x24')]];var _0x50d5a0=_0x352d65?_0x12dd14['agents'][_0x352d65]['id']:undefined;_0x12dd14[_0x9b3f('0x10')][_0x5177dd]=new Action(_0x4e3fc8,_0x34a8f2,_0x5177dd,_0x352d65,_0x50d5a0);var _0xf0d00f=_0x12dd14[_0x9b3f('0x10')][_0x5177dd];_0xf0d00f['unlockAgent']=_0x4193bc;_0xf0d00f[_0x9b3f('0xb8')]=_0x444708;_0xf0d00f[_0x9b3f('0xe1')]=_0x352d65;if(_['isEmpty'](_0x2d4782)){_0x12dd14[_0x9b3f('0xe2')](_0xf0d00f,_0x34a8f2,_0x4e3fc8,_0x352d65)[_0x9b3f('0x78')](function(_0x49c0ea){logger[_0x9b3f('0x5f')](_0x9b3f('0xe3'),_0x9b3f('0xe4')+_0xf0d00f[_0x9b3f('0x61')]+'\x20IdHopper:\x20'+_0xf0d00f['idContact'],JSON[_0x9b3f('0x4b')](_0x49c0ea));ami['emit']('custom:agentcalled',ut[_0x9b3f('0x9f')](_0xf0d00f,'called'));_0x29a050(ut[_0x9b3f('0x53')](_0x9b3f('0xe5')));})[_0x9b3f('0x6c')](function(_0x3fab5c){ut['logger'](_0x9b3f('0xe6'),_0x3fab5c);_0x23f276(ut[_0x9b3f('0x53')]('Call\x20failed',_0x4193bc,_0x444708));});}else{_0x34a8f2[_0x9b3f('0x34')]+=0x1;ut['logBlacklist'](_0xf0d00f);rpcDb[_0x9b3f('0xe7')](_0xf0d00f,_0x9b3f('0xe8'));delete _0x12dd14[_0x9b3f('0x10')][_0x5177dd];_0x23f276(ut['message'](_0x9b3f('0xe9'),_0x4193bc,_0x444708));}});};Preview[_0x9b3f('0x5a')][_0x9b3f('0x90')]=function(_0x12ed0a){return!_[_0x9b3f('0xe0')](_0x12ed0a)&&!_[_0x9b3f('0xe0')](_0x12ed0a[_0x9b3f('0x24')])&&!_[_0x9b3f('0xe0')](_0x12ed0a[_0x9b3f('0x48')])&&_0x12ed0a[_0x9b3f('0x48')]&&!_[_0x9b3f('0xe0')](this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a[_0x9b3f('0x24')])])&&!_[_0x9b3f('0xe0')](this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a['name'])]['status'])&&(this['trunks'][util[_0x9b3f('0x4d')]('SIP/%s',_0x12ed0a[_0x9b3f('0x24')])][_0x9b3f('0x6a')]==='reachable'||this[_0x9b3f('0xf')][util[_0x9b3f('0x4d')](_0x9b3f('0xea'),_0x12ed0a[_0x9b3f('0x24')])][_0x9b3f('0x6a')]===_0x9b3f('0xeb'));};Preview[_0x9b3f('0x5a')]['run']=function(_0xb8281a,_0x137786){var _0x13f0f2=this;return new BPromise(function(_0x45f5ca,_0x551c49){_0x13f0f2[_0x9b3f('0xec')](_0xb8281a,_0x137786)[_0x9b3f('0x78')](function(_0x14f1e9){_0x45f5ca(_['pick'](_0x14f1e9,[_0x9b3f('0x53')]));})['catch'](function(_0x57d6e2){if(_0x57d6e2['unlock']){rpcDb['unlockContact'](_0xb8281a);}if(_0x57d6e2['active']){rpcDb['disableContact'](_0xb8281a);}_0x551c49(_['pick'](_0x57d6e2,[_0x9b3f('0x53')]));});});};Preview[_0x9b3f('0x5a')][_0x9b3f('0xec')]=function(_0x2f01c8,_0x4507c9){var _0x34a2aa=this;return new BPromise(function(_0x33adb1,_0x2822ad){var _0x2f4ccd,_0x437bf2;rpcDb[_0x9b3f('0xed')](_0x2f01c8)['then'](function(_0x188157){if(!_[_0x9b3f('0xe0')](_0x188157[0x0])){_0x437bf2=_0x188157[0x0][_0x9b3f('0xee')]?![]:!![];_0x2f4ccd=_0x188157[0x0][_0x9b3f('0xee')]?!![]:![];_0x2f4ccd=_0x4507c9?!![]:_0x2f4ccd;}var _0x5a8d5a=_0x34a2aa[_0x9b3f('0xef')](_0x188157);if(_0x5a8d5a[_0x9b3f('0xf0')]){rpcDb[_0x9b3f('0xf1')](_['pick'](_0x188157[0x0],[_0x9b3f('0x67'),_0x9b3f('0xf2')]))[_0x9b3f('0x78')](function(_0x526297){_0x34a2aa[_0x9b3f('0xdf')](_0x526297,_0x188157[0x0],_0x4507c9,_0x437bf2,_0x2f4ccd)['then'](function(_0x2cb568){_0x33adb1(_0x2cb568);})['catch'](function(_0x48ddb0){_0x2822ad(_0x48ddb0);});})[_0x9b3f('0x6c')](function(_0xc4af69){ut[_0x9b3f('0x58')](_0x9b3f('0xf3'),_0xc4af69);_0x2822ad(ut[_0x9b3f('0x53')](_0x9b3f('0xf4'),_0x437bf2,_0x2f4ccd));});}else{_0x2822ad(ut[_0x9b3f('0x53')](_0x5a8d5a[_0x9b3f('0x53')],_0x437bf2,_0x2f4ccd));}})[_0x9b3f('0x6c')](function(_0x5cc7bf){ut[_0x9b3f('0x58')](_0x9b3f('0xf5'),_0x5cc7bf);_0x2822ad(ut[_0x9b3f('0x53')]('Call\x20unsuccessful',![],!![]));});});};Preview[_0x9b3f('0x5a')][_0x9b3f('0xef')]=function(_0x3fdd88){if(_[_0x9b3f('0xe0')](_0x3fdd88)||_[_0x9b3f('0xf6')](_0x3fdd88)||!_[_0x9b3f('0xe0')](_0x3fdd88[0x0][_0x9b3f('0xf7')])&&_['isNil'](_0x3fdd88[0x0][_0x9b3f('0xf7')]['name'])){ut[_0x9b3f('0x58')](_0x9b3f('0xf8'),_0x3fdd88);return{'isValid':![],'message':_0x9b3f('0xf9')};}var _0x4cfe09=this[_0x9b3f('0xd')][_0x3fdd88[0x0][_0x9b3f('0x60')][_0x9b3f('0x24')]];_0x4cfe09[_0x9b3f('0x53')]=_0x9b3f('0x92');if(_['isNil'](_0x4cfe09)){ut[_0x9b3f('0x58')](_0x9b3f('0xfa'),_0x4cfe09);return{'isValid':![],'message':_0x9b3f('0xfb')};}if(!this['isTrunkReachable'](_0x4cfe09[_0x9b3f('0x47')])){ut[_0x9b3f('0x58')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x9b3f('0xfc')+_0x4cfe09[_0x9b3f('0x24')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x9b3f('0x90')](_0x4cfe09[_0x9b3f('0x91')])){ut['logger'](_0x9b3f('0xfd'),_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0xfe'));return{'isValid':![],'message':_0x9b3f('0xff')};}}if(!ut[_0x9b3f('0x8e')](_0x4cfe09['dialActive'])){ut[_0x9b3f('0x58')]('[Preview][validateContact][Campaign\x20Active]',_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0x100'));return{'isValid':![],'message':_0x9b3f('0xfc')+_0x4cfe09[_0x9b3f('0x24')]+_0x9b3f('0x100')};}return{'isValid':!![],'message':_0x9b3f('0x101')};};Preview['prototype'][_0x9b3f('0xe2')]=function(_0x425968,_0x16ecbf,_0x59e63b,_0x27f5cf){var _0x142f6b=this;return new BPromise(function(_0x2f0f05,_0x31443f){var _0x42c2a7=_0x425968[_0x9b3f('0x9c')];var _0x27b823=_0x142f6b[_0x9b3f('0x90')](_0x16ecbf[_0x9b3f('0x47')])?util[_0x9b3f('0x4d')](_0x9b3f('0x102'),_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x24')],_[_0x9b3f('0xe0')](_0x16ecbf['dialPrefix'])?'':_0x16ecbf[_0x9b3f('0x32')][_0x9b3f('0x103')]()||'',_0x16ecbf[_0x9b3f('0x104')]>0x0?_0x59e63b[_0x9b3f('0x105')][_0x9b3f('0x106')][_0x9b3f('0x107')](_0x16ecbf[_0x9b3f('0x104')]):_0x59e63b[_0x9b3f('0x105')][_0x9b3f('0x106')]):util['format'](_0x9b3f('0x102'),_[_0x9b3f('0xe0')](_0x16ecbf[_0x9b3f('0x91')])?_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x24')]:_0x16ecbf[_0x9b3f('0x91')]['name'],_[_0x9b3f('0xe0')](_0x16ecbf['dialPrefix'])?'':_0x16ecbf[_0x9b3f('0x32')]['trim']()||'',_0x16ecbf['dialCutDigit']>0x0?_0x59e63b[_0x9b3f('0x105')]['phone'][_0x9b3f('0x107')](_0x16ecbf[_0x9b3f('0x104')]):_0x59e63b['Contact'][_0x9b3f('0x106')]);var _0x55b3e5=_0x142f6b[_0x9b3f('0x90')](_0x16ecbf[_0x9b3f('0x47')])?ut['getCallerId'](_0x16ecbf[_0x9b3f('0x47')]['callerid'],_0x16ecbf[_0x9b3f('0x108')],_0x16ecbf[_0x9b3f('0x109')]>0x0?ut[_0x9b3f('0x10a')](_0x16ecbf[_0x9b3f('0x31')],_0x16ecbf[_0x9b3f('0x109')]):_0x16ecbf[_0x9b3f('0x31')]):ut[_0x9b3f('0x10b')](_[_0x9b3f('0xe0')](_0x16ecbf[_0x9b3f('0x91')])?_0x16ecbf[_0x9b3f('0x47')][_0x9b3f('0x49')]:_0x16ecbf['TrunkBackup'][_0x9b3f('0x49')],_0x16ecbf['dialOriginateCallerIdName'],_0x16ecbf[_0x9b3f('0x109')]>0x0?ut[_0x9b3f('0x10a')](_0x16ecbf[_0x9b3f('0x31')],_0x16ecbf['dialRandomLastDigitCallerIdNumber']):_0x16ecbf[_0x9b3f('0x31')]);if(_0x55b3e5){_0x425968[_0x9b3f('0x10c')]=ut['extractCalleridName'](_0x55b3e5);_0x425968[_0x9b3f('0x10d')]=ut[_0x9b3f('0x10e')](_0x55b3e5);}var _0x508bdb=ut[_0x9b3f('0x10f')](_0x16ecbf,_0x59e63b,_0x27b823,_0x55b3e5,_0x42c2a7,_0x425968);_[_0x9b3f('0x110')](_0x425968,ut[_0x9b3f('0x111')](_0x508bdb));_0x425968[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')](_0x9b3f('0x80'));ami[_0x9b3f('0x69')](ut[_0x9b3f('0x112')](_0x425968,_0x16ecbf,_0x508bdb,_0x425968[_0x9b3f('0xb8')],_0x27f5cf))['then'](function(_0x2ab345){_0x16ecbf[_0x9b3f('0x46')]+=0x1;logger['info']('[originated][increment]',_0x42c2a7,_0x9b3f('0x9d'),_0x16ecbf['name'],_0x9b3f('0x62'),_0x16ecbf[_0x9b3f('0x46')]);_0x2f0f05(_0x2ab345);})[_0x9b3f('0x6c')](function(_0x53b787){ut['logAgent'](_0x425968,0xe,_0x9b3f('0x113'));rpcDb[_0x9b3f('0xd5')](_0x425968,_0x9b3f('0x114'));_0x31443f(_0x53b787);});});};Preview['prototype'][_0x9b3f('0x115')]=function(_0x3221eb){if(this[_0x9b3f('0x10')][_0x3221eb[_0x9b3f('0x98')]]){this[_0x9b3f('0x10')][_0x3221eb[_0x9b3f('0x98')]]['channel']=_0x3221eb[_0x9b3f('0x6b')];}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x14')]=function(_0x16a000){var _0x59ec1c=this;var _0x3fb18e=this[_0x9b3f('0x10')][_0x16a000[_0x9b3f('0x116')]];if(_0x3fb18e){if(_0x3fb18e[_0x9b3f('0xe1')]&&this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]]){ut['logLookAgent'](_0x3fb18e,this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]][_0x9b3f('0x24')],this[_0x9b3f('0x11')][_0x3fb18e[_0x9b3f('0xe1')]]['id']);}var _0x583e8d=_[_0x9b3f('0x117')](_0x3fb18e);_0x583e8d[_0x9b3f('0x9a')]=moment()['format'](_0x9b3f('0x80'));var _0x3e414e=_0x59ec1c[_0x9b3f('0xd')][_0x3fb18e[_0x9b3f('0x61')]];if(ut[_0x9b3f('0x118')](_0x16a000[_0x9b3f('0x119')])){if(_0x3fb18e['unlockAgent']){rpcDb['unlockContact'](_0x3fb18e[_0x9b3f('0xc7')]);}if(_0x3fb18e[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x3fb18e[_0x9b3f('0xc7')]);}ami[_0x9b3f('0x21')](_0x9b3f('0x11a'),ut['buildObj'](_0x3fb18e,'rejected'));this[_0x9b3f('0xd1')](_0x583e8d,_0x3e414e,_0x16a000);}else{_0x3fb18e[_0x9b3f('0x7f')]=moment()[_0x9b3f('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');ut['logAgent'](_0x583e8d,0x4,_0x9b3f('0xa7'));rpcDb[_0x9b3f('0xd5')](_0x583e8d,_0x9b3f('0x11b'));}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x11c')]=function(_0x51c72d){var _0x224012=this;var _0x4cb118=this['actions'][_0x51c72d['linkedid']];var _0x1c224a;if(_0x4cb118){_0x1c224a=this[_0x9b3f('0xd')][_0x4cb118[_0x9b3f('0x61')]];logger['info']('[syncHangup][talking]',_0x51c72d[_0x9b3f('0x98')],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);}if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]]&&_0x51c72d[_0x9b3f('0x98')]!==_0x51c72d[_0x9b3f('0x9c')]){if(_0x51c72d[_0x9b3f('0x11d')]==='16'&&this['actions'][_0x51c72d[_0x9b3f('0x98')]]['dialAnswer']){this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d['linkedid'],_0x51c72d[_0x9b3f('0x11d')]);}else if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]][_0x9b3f('0x64')]){logger[_0x9b3f('0x5f')](_0x9b3f('0x11f'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')]);}}else if(_0x4cb118&&_[_0x9b3f('0xe0')](_0x4cb118[_0x9b3f('0x120')])&&_0x1c224a[_0x9b3f('0x121')]&&_0x51c72d[_0x9b3f('0x98')]===_0x51c72d[_0x9b3f('0x9c')]&&_['isNil'](_0x51c72d[_0x9b3f('0xd4')])&&_0x51c72d[_0x9b3f('0x11d')]==='16'&&_0x51c72d[_0x9b3f('0x122')]==='6'&&_[_0x9b3f('0xd2')](_0x4cb118[_0x9b3f('0x123')])){if(_0x4cb118[_0x9b3f('0xb7')]){rpcDb[_0x9b3f('0xc6')](_0x4cb118[_0x9b3f('0xc7')]);}if(_0x4cb118[_0x9b3f('0xb8')]){rpcDb[_0x9b3f('0xc8')](_0x4cb118['idContact']);}_0x51c72d[_0x9b3f('0xd4')]='22';this['callProgressDetectingAgent'](_0x4cb118,_0x1c224a,_0x51c72d);}else if(_0x4cb118&&_0x4cb118[_0x9b3f('0x123')]){if(_0x51c72d[_0x9b3f('0x11d')]==='16'&&this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]][_0x9b3f('0x64')]){logger[_0x9b3f('0x5f')](_0x9b3f('0x124'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause'],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause']);}else if(this[_0x9b3f('0x10')][_0x51c72d[_0x9b3f('0x98')]]['dialAnswer']){logger[_0x9b3f('0x5f')](_0x9b3f('0x11f'),_0x51c72d[_0x9b3f('0x98')],_0x51c72d['cause'],_0x9b3f('0x9d'),_0x1c224a[_0x9b3f('0x24')],_0x9b3f('0x63'),_0x1c224a[_0x9b3f('0x29')]);this[_0x9b3f('0x11e')](_0x51c72d,_0x51c72d[_0x9b3f('0x98')],_0x51c72d[_0x9b3f('0x11d')]);}}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x1a')]=function(_0x1b45fa){if(this['actions'][_0x1b45fa['destlinkedid']]&&_0x1b45fa[_0x9b3f('0xd0')]!==_0x1b45fa[_0x9b3f('0x125')]){this[_0x9b3f('0x11e')](_0x1b45fa,_0x1b45fa['destlinkedid'],_0x1b45fa[_0x9b3f('0xcb')]);}};Preview[_0x9b3f('0x5a')][_0x9b3f('0x18')]=function(_0x24c433){if(this['actions'][_0x24c433[_0x9b3f('0x98')]]&&_0x24c433[_0x9b3f('0x98')]!==_0x24c433[_0x9b3f('0x9c')]&&!this[_0x9b3f('0x10')][_0x24c433[_0x9b3f('0x98')]][_0x9b3f('0x64')]){if(_0x24c433['cause']==='1'){this[_0x9b3f('0x11e')](_0x24c433,_0x24c433['linkedid'],_0x24c433[_0x9b3f('0x11d')]);}}};Preview[_0x9b3f('0x5a')]['addVariable']=function(_0x91624e,_0x3123f5,_0x5dd30c){if(this[_0x9b3f('0x10')][_0x91624e]){if(_['isNil'](this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')])){this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')]={};}this[_0x9b3f('0x10')][_0x91624e][_0x9b3f('0x126')][_0x3123f5]=_0x5dd30c;}};Preview['prototype']['syncVarSet']=function(_0x31be96){try{if(!_[_0x9b3f('0xe0')](_0x31be96)){if(ut[_0x9b3f('0x127')](_[_0x9b3f('0x128')](_0x31be96[_0x9b3f('0x129')])[0x0])){this[_0x9b3f('0x12a')](_0x31be96[_0x9b3f('0x9c')],_[_0x9b3f('0x128')](_0x31be96[_0x9b3f('0x129')])[0x0],_0x31be96['value']);}}}catch(_0x20480c){logger['error'](_0x9b3f('0x12b'),util[_0x9b3f('0x12c')](_0x20480c,{'showHidden':![],'depth':null}));}};Preview['prototype']['syncAttendedTransfer']=function(_0x56ec83){if(_0x56ec83){if(this[_0x9b3f('0x10')][_0x56ec83[_0x9b3f('0x12d')]]){this['actions'][_0x56ec83[_0x9b3f('0x12d')]][_0x9b3f('0x123')]=!![];}}};Preview['prototype'][_0x9b3f('0x1f')]=function(_0x380f2c){if(_0x380f2c){if(this[_0x9b3f('0x10')][_0x380f2c[_0x9b3f('0x12e')]]){this[_0x9b3f('0x10')][_0x380f2c['transfererlinkedid']][_0x9b3f('0x123')]=!![];}}};module[_0x9b3f('0x12f')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 8a1a931..91796bd 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 _0xcc31=['then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','resolve'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xcc31,0x176));var _0x1cc3=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xcc31[_0x8de54f];return _0x14cba4;};'use strict';var util=require(_0x1cc3('0x0'));var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x1cc3('0x1'));var _=require(_0x1cc3('0x2'));var cmHopper=require(_0x1cc3('0x3'));var cmHopperFinal=require(_0x1cc3('0x4'));var cmHopperHistory=require(_0x1cc3('0x5'));var cmHopperBlack=require(_0x1cc3('0x6'));var voiceQueueRt=require(_0x1cc3('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2f0578){return function(_0x105515){logger[_0x1cc3('0x8')](_0x2f0578,util[_0x1cc3('0x9')](_0x105515,{'showHidden':![],'depth':null}));};}function create(_0x5bf011){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopperHistory[_0x1cc3('0xc')](_0x5bf011))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0xe')));}function createAgent(_0xb42fe8){return BPromise['resolve']()[_0x1cc3('0xb')](agentReportPreview['createHistory'](_0xb42fe8))['catch'](loggerCatch(_0x1cc3('0xe')));}function moveContact(_0x1378c2){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopper['moveContactManagedDialer'](_0x1378c2,!![]))['catch'](loggerCatch(_0x1cc3('0xf')));}exports[_0x1cc3('0x10')]=function(_0x588463){return BPromise['resolve']()['then'](cmHopperBlack['checkIsBlackList'](_0x588463))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x11')));};exports['getContactPreview']=function(_0x1393bc){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x12')](_0x1393bc))['catch'](loggerCatch('[getContactPreview]\x20'));};exports[_0x1cc3('0xc')]=function(_0x1dac7b,_0x134493){create(_0x1dac7b)[_0x1cc3('0xd')](loggerCatch(_0x134493));moveContact(_0x1dac7b)[_0x1cc3('0xd')](loggerCatch(_0x134493));};exports[_0x1cc3('0x13')]=function(_0x5cfd2f,_0x35c7c8){createAgent(_0x5cfd2f)['catch'](loggerCatch(_0x35c7c8));};exports[_0x1cc3('0x14')]=function(_0x553b0a,_0x2f6a18){create(_0x553b0a)[_0x1cc3('0xd')](loggerCatch(_0x2f6a18));};exports[_0x1cc3('0x15')]=function(_0x329a37,_0x55ce9a){moveContact(_0x329a37)[_0x1cc3('0xd')](loggerCatch(_0x55ce9a));};exports['rescheduleContact']=function(_0xdac13e,_0x45e786,_0x15ddea){if(_0x45e786){_0xdac13e[_0x1cc3('0x16')]=null;}if(_0x15ddea){_0xdac13e[_0x1cc3('0x17')]=![];}return BPromise['resolve']()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x18')](_0xdac13e))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x19')));};exports['countReScheduled']=function(_0x2ecd65){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x1a')](_0x2ecd65))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x1b')));};exports[_0x1cc3('0x1c')]=function(_0x14e80d){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x1c')]({'UserId':null},_0x14e80d,0x1))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x1d')));};exports[_0x1cc3('0x1e')]=function(_0x524763){return BPromise['resolve']()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x1c')]({'active':![]},_0x524763,0x1))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x1f')));};exports['crateCustomerReportQueue']=function(_0x3f23f5){var _0xcf1a0={};_0xcf1a0[_0x1cc3('0x20')]=_0x3f23f5['type'];_0xcf1a0[_0x1cc3('0x21')]=_0x3f23f5['uniqueid'];_0xcf1a0[_0x1cc3('0x22')]=_0x3f23f5[_0x1cc3('0x22')];_0xcf1a0[_0x1cc3('0x23')]=_0x3f23f5[_0x1cc3('0x23')];_0xcf1a0[_0x1cc3('0x24')]=_0x3f23f5['queue'];_0xcf1a0['queuecallerjoinAt']=_0x3f23f5['answertime'];_0xcf1a0[_0x1cc3('0x25')]=_0x3f23f5[_0x1cc3('0x26')];_0xcf1a0[_0x1cc3('0x27')]=0x1;_0xcf1a0['queuecallercompleteAt']=_0x3f23f5[_0x1cc3('0x28')];_0xcf1a0[_0x1cc3('0x29')]=_0x3f23f5[_0x1cc3('0x2a')];_0xcf1a0[_0x1cc3('0x2b')]=_0x1cc3('0x2c');_0xcf1a0[_0x1cc3('0x2d')]='xcally-motion-preview';_0xcf1a0[_0x1cc3('0x2e')]=0x0;_0xcf1a0[_0x1cc3('0x2f')]=0x1;_0xcf1a0[_0x1cc3('0x30')]=_0x3f23f5[_0x1cc3('0x2a')];_0xcf1a0[_0x1cc3('0x31')]=_0x1cc3('0x32');return BPromise[_0x1cc3('0xa')]()['then'](voiceQueueReport['create'](_0xcf1a0))[_0x1cc3('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x3c8f3e,_0x360cb1){return BPromise['resolve']()['then'](cmHopper[_0x1cc3('0x33')](_0x3c8f3e,_0x360cb1))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x34')));};exports[_0x1cc3('0x35')]=function(_0x37f7e9){return BPromise[_0x1cc3('0xa')]()[_0x1cc3('0xb')](cmHopper[_0x1cc3('0x18')](_0x37f7e9,!![],!![]))[_0x1cc3('0xd')](loggerCatch(_0x1cc3('0x36')));}; \ No newline at end of file +var _0xbcf1=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xbcf1,0xe9));var _0x1bcf=function(_0x38c652,_0x1ea1b7){_0x38c652=_0x38c652-0x0;var _0x218a37=_0xbcf1[_0x38c652];return _0x218a37;};'use strict';var util=require(_0x1bcf('0x0'));var BPromise=require('bluebird');var logger=require(_0x1bcf('0x1'))(_0x1bcf('0x2'));var _=require(_0x1bcf('0x3'));var cmHopper=require(_0x1bcf('0x4'));var cmHopperFinal=require(_0x1bcf('0x5'));var cmHopperHistory=require(_0x1bcf('0x6'));var cmHopperBlack=require(_0x1bcf('0x7'));var voiceQueueRt=require(_0x1bcf('0x8'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x1bcf('0x9'));function loggerCatch(_0xe25da5){return function(_0x340779){logger[_0x1bcf('0xa')](_0xe25da5,util['inspect'](_0x340779,{'showHidden':![],'depth':null}));};}function create(_0x4e43bb){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopperHistory[_0x1bcf('0xd')](_0x4e43bb))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0xf')));}function createAgent(_0x16f75d){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](agentReportPreview['createHistory'](_0x16f75d))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0xf')));}function moveContact(_0x49ae10){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x49ae10,!![]))['catch'](loggerCatch(_0x1bcf('0x10')));}exports['checkIsBlackList']=function(_0x2813a4){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopperBlack[_0x1bcf('0x11')](_0x2813a4))['catch'](loggerCatch(_0x1bcf('0x12')));};exports[_0x1bcf('0x13')]=function(_0x5b65c8){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x13')](_0x5b65c8))['catch'](loggerCatch(_0x1bcf('0x14')));};exports['createHistory']=function(_0x69a8ad,_0x59e552){create(_0x69a8ad)[_0x1bcf('0xe')](loggerCatch(_0x59e552));moveContact(_0x69a8ad)['catch'](loggerCatch(_0x59e552));};exports[_0x1bcf('0x15')]=function(_0x22e9b6,_0x55d861){createAgent(_0x22e9b6)[_0x1bcf('0xe')](loggerCatch(_0x55d861));};exports['createCustomerHistory']=function(_0x1ed061,_0x2eb0c5){create(_0x1ed061)[_0x1bcf('0xe')](loggerCatch(_0x2eb0c5));};exports[_0x1bcf('0x16')]=function(_0x185528,_0x25c0d9){moveContact(_0x185528)['catch'](loggerCatch(_0x25c0d9));};exports[_0x1bcf('0x17')]=function(_0x9669f7,_0x1504a5,_0x46d0a0){if(_0x1504a5){_0x9669f7['UserId']=null;}if(_0x46d0a0){_0x9669f7[_0x1bcf('0x18')]=![];}return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x17')](_0x9669f7))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x19')));};exports['countReScheduled']=function(_0x408d5d){return BPromise[_0x1bcf('0xb')]()['then'](cmHopper['countReScheduled'](_0x408d5d))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x1a')));};exports[_0x1bcf('0x1b')]=function(_0x18cdc9){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper['unlockContact']({'UserId':null},_0x18cdc9,0x1))['catch'](loggerCatch(_0x1bcf('0x1c')));};exports['disableContact']=function(_0x202291){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper['unlockContact']({'active':![]},_0x202291,0x1))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x1d')));};exports[_0x1bcf('0x1e')]=function(_0x40d125){var _0xc48f18={};_0xc48f18[_0x1bcf('0x1f')]=_0x40d125[_0x1bcf('0x1f')];_0xc48f18[_0x1bcf('0x20')]=_0x40d125[_0x1bcf('0x20')];_0xc48f18[_0x1bcf('0x21')]=_0x40d125[_0x1bcf('0x21')];_0xc48f18[_0x1bcf('0x22')]=_0x40d125['calleridname'];_0xc48f18['queue']=_0x40d125['queue'];_0xc48f18[_0x1bcf('0x23')]=_0x40d125[_0x1bcf('0x24')];_0xc48f18[_0x1bcf('0x25')]=_0x40d125[_0x1bcf('0x24')];_0xc48f18['queuecallercomplete']=0x1;_0xc48f18[_0x1bcf('0x26')]=_0x40d125[_0x1bcf('0x27')];_0xc48f18[_0x1bcf('0x28')]=_0x40d125[_0x1bcf('0x29')];_0xc48f18['context']=_0x1bcf('0x2a');_0xc48f18[_0x1bcf('0x2b')]=_0x1bcf('0x2c');_0xc48f18['holdtime']=0x0;_0xc48f18[_0x1bcf('0x2d')]=0x1;_0xc48f18[_0x1bcf('0x2e')]=_0x40d125[_0x1bcf('0x29')];_0xc48f18[_0x1bcf('0x2f')]=_0x1bcf('0x30');return BPromise['resolve']()[_0x1bcf('0xc')](voiceQueueReport[_0x1bcf('0x31')](_0xc48f18))[_0x1bcf('0xe')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x1bcf('0x32')]=function(_0x547ad7,_0x5aadfe){return BPromise[_0x1bcf('0xb')]()[_0x1bcf('0xc')](cmHopper[_0x1bcf('0x32')](_0x547ad7,_0x5aadfe))[_0x1bcf('0xe')](loggerCatch(_0x1bcf('0x33')));};exports[_0x1bcf('0x34')]=function(_0x22419d){return BPromise['resolve']()['then'](cmHopper[_0x1bcf('0x17')](_0x22419d,!![],!![]))['catch'](loggerCatch(_0x1bcf('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 6ad6967..35c9344 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 _0x6fc3=['env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','logAgent','starttime','logLookAgent','UserId','logCustomer','endtime','ringtime','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','timeout','countbusyretry','countnoanswerretry','cloneAction','clone','Global','active','add','minutes','ContactId','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','channelAgent','interface','not_inuse','status','push','CampaignId','filterKey','idContact','type','campaigntype','membername','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','../../../../config/logger','preview'];(function(_0x4b14bb,_0xe7b4d3){var _0x285200=function(_0x48c1d7){while(--_0x48c1d7){_0x4b14bb['push'](_0x4b14bb['shift']());}};_0x285200(++_0xe7b4d3);}(_0x6fc3,0x117));var _0x36fc=function(_0x48b233,_0x38b05c){_0x48b233=_0x48b233-0x0;var _0x447454=_0x6fc3[_0x48b233];return _0x447454;};'use strict';var util=require(_0x36fc('0x0'));var _=require(_0x36fc('0x1'));var moment=require(_0x36fc('0x2'));var logger=require(_0x36fc('0x3'))(_0x36fc('0x4'));var ipAgi=process[_0x36fc('0x5')][_0x36fc('0x6')]||_0x36fc('0x7');function getSeconds(_0x4394e0,_0x4c9289){var _0x5416f1=moment(_0x4394e0)[_0x36fc('0x8')](0x0);var _0x1fb46a=moment(_0x4c9289)[_0x36fc('0x8')](0x0);return _0x5416f1[_0x36fc('0x9')](_0x1fb46a,_0x36fc('0xa'));}exports[_0x36fc('0xb')]=function(_0x4ce22c){return function(_0x1ce5db){logger[_0x36fc('0xc')](_0x4ce22c,util['inspect'](_0x1ce5db,{'showHidden':![],'depth':null}));};};exports[_0x36fc('0xd')]=function(_0x81f8e1,_0x1a4bea){logger[_0x36fc('0xe')](_0x81f8e1,util[_0x36fc('0xf')](_0x1a4bea,{'showHidden':![],'depth':null}));};exports[_0x36fc('0x10')]=function(_0x3ff634,_0x53e526){logger[_0x36fc('0xc')](_0x3ff634,util[_0x36fc('0xf')](_0x53e526,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1cfd00){return function(_0x5a4653){logger[_0x36fc('0xe')](_0x1cfd00,util[_0x36fc('0xf')](_0x5a4653,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x4a8f6a,_0x407ca1,_0x292ce4){return{'message':_0x4a8f6a,'unlock':_0x407ca1,'active':_0x292ce4};};exports[_0x36fc('0x11')]=function(_0x75abcd,_0x14fc70,_0x273078){if(!_[_0x36fc('0x12')](_0x273078)&&_0x36fc('0x13')===typeof _0x273078&&!_[_0x36fc('0x14')](_0x273078)){if(!_[_0x36fc('0x12')](_0x14fc70)&&'string'===typeof _0x14fc70&&!_[_0x36fc('0x14')](_0x14fc70)){return util[_0x36fc('0x15')](_0x36fc('0x16'),_0x14fc70,_0x273078);}return util['format'](_0x36fc('0x16'),_0x273078,_0x273078);}if(!_['isUndefined'](_0x75abcd)&&'string'===typeof _0x75abcd&&!_['isEmpty'](_0x75abcd)){return _0x75abcd;}return _0x36fc('0x17');};exports[_0x36fc('0x18')]=function(_0x1d7d85){if(_[_0x36fc('0x19')](_0x1d7d85)){return![];}return _0x1d7d85;};exports[_0x36fc('0x1a')]=function(_0xa6f550,_0x42991e,_0x35dc72,_0x62db5e,_0x311176,_0x2ac1cd){var _0x402a10={'XMD-QUEUE':_0x42991e[_0x36fc('0x1b')]?_0x42991e[_0x36fc('0x1b')][_0x36fc('0x1c')]:'','XMD-CALLERID':_0x62db5e,'XMD-CALLERID-PREVIEW':_0x2ac1cd?util[_0x36fc('0x15')](_0x36fc('0x16'),_0x2ac1cd[_0x36fc('0x1d')],_0x2ac1cd[_0x36fc('0x1e')]):_0x62db5e,'XMD-DIALID':_0x311176,'XMD-CONTACTID':_0x42991e['ContactId'],'XMD-CDRTYPE':_0x36fc('0x1f'),'CALLERID(all)':_0x62db5e,'XMD-VOICEQUEUEID':_0x42991e['VoiceQueueId'],'XMD-DIALCHANNEL':_0x35dc72,'XMD-DIALTIMEOUT':_0xa6f550[_0x36fc('0x20')]||0x1e,'XMD-DIALOPTIONS':util[_0x36fc('0x15')](_0x36fc('0x21'),_0xa6f550[_0x36fc('0x22')]?'g':'',_['isEmpty'](_0xa6f550[_0x36fc('0x23')])?'':_0x36fc('0x24')),'XMD-DIALURL':_0xa6f550[_0x36fc('0x25')]||'','XMD-AGI':_0xa6f550[_0x36fc('0x26')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550['dialQueueProject']):_0x36fc('0x28'),'XMD-AGIAFTER':_0xa6f550[_0x36fc('0x22')]?util[_0x36fc('0x15')](_0x36fc('0x27'),ipAgi,_0xa6f550[_0x36fc('0x22')]):_0x36fc('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2ac1cd?_0x2ac1cd[_0x36fc('0x2a')]:'','XMD-DESTINATION':_0x36fc('0x2b')};if(!_[_0x36fc('0x14')](_0xa6f550[_0x36fc('0x23')])){_0x402a10[util[_0x36fc('0x15')]('%s',_0x36fc('0x2c'))]=_0xa6f550[_0x36fc('0x23')];_0x402a10[util[_0x36fc('0x15')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x311176;}if(_0x42991e&&_0x42991e[_0x36fc('0x2d')]){for(var _0xcfc665 in _0x42991e[_0x36fc('0x2d')]){if(_0x42991e[_0x36fc('0x2d')][_0x36fc('0x2e')](_0xcfc665)){if(!_['isNil'](_0x42991e[_0x36fc('0x2d')][_0xcfc665])&&_0xcfc665!=='id'&&_0xcfc665!==_0x36fc('0x2f')&&_0xcfc665!==_0x36fc('0x30')&&_0xcfc665!=='updatedAt'){_0x402a10[util[_0x36fc('0x15')](_0x36fc('0x31'),_0x36fc('0x32'),_[_0x36fc('0x33')](_0xcfc665))]=_0x42991e[_0x36fc('0x2d')][_0xcfc665];}}}}return _0x402a10;};exports[_0x36fc('0x34')]=function(_0xeac05b){var _0x106f39={};for(var _0x59e7ee in _0xeac05b){if(_0xeac05b['hasOwnProperty'](_0x59e7ee)){_0x106f39[util[_0x36fc('0x15')]('%s',_[_0x36fc('0x35')](_0x59e7ee))]=_0xeac05b[_0x59e7ee];}}return{'variables':_0x106f39};};exports[_0x36fc('0x36')]=function(_0x240e9c,_0x3091db){if(!_[_0x36fc('0x19')](_0x240e9c)){if(_0x240e9c['hasOwnProperty']('originated')){if(_0x240e9c['originated']>0x0){_0x240e9c[_0x36fc('0x37')]-=0x1;}else{logger[_0x36fc('0xc')](_0x36fc('0x38'),_0x3091db);}}}else{logger['error'](_0x36fc('0x39'),_0x3091db);}};exports['logBlacklist']=function(_0x4b15e0){var _0x6698ae=moment()[_0x36fc('0x15')](_0x36fc('0x3a'));_0x4b15e0[_0x36fc('0x3b')]=0xd;_0x4b15e0[_0x36fc('0x3c')]=_0x36fc('0x3d');_0x4b15e0['starttime']=_0x6698ae;_0x4b15e0[_0x36fc('0x3e')]=_0x6698ae;_0x4b15e0['endtime']=_0x6698ae;};exports[_0x36fc('0x3f')]=function(_0x2a91b2,_0x11819e,_0x215482){var _0x5ea398=moment()[_0x36fc('0x15')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a91b2[_0x36fc('0x3b')]=_0x11819e;_0x2a91b2['statedesc']=_0x215482;_0x2a91b2['responsetime']=_0x5ea398;_0x2a91b2['ringtime']=getSeconds(_0x2a91b2['responsetime'],_0x2a91b2[_0x36fc('0x40')]);};exports[_0x36fc('0x41')]=function(_0x3fabe2,_0x4e22b2,_0x33f294){_0x3fabe2['membername']=_0x4e22b2;_0x3fabe2[_0x36fc('0x42')]=_0x33f294;};exports[_0x36fc('0x43')]=function(_0x591c5d,_0x6001dd,_0x48ec26){var _0x54f133=moment()['format'](_0x36fc('0x3a'));_0x591c5d[_0x36fc('0x3b')]=_0x6001dd;_0x591c5d['statedesc']=_0x48ec26;_0x591c5d[_0x36fc('0x3e')]=_0x591c5d[_0x36fc('0x3e')]?_0x591c5d[_0x36fc('0x3e')]:_0x54f133;_0x591c5d[_0x36fc('0x44')]=_0x591c5d[_0x36fc('0x44')]?_0x591c5d['endtime']:_0x54f133;_0x591c5d[_0x36fc('0x45')]=getSeconds(_0x591c5d[_0x36fc('0x3e')]||0x0,_0x591c5d[_0x36fc('0x40')]||0x0);_0x591c5d[_0x36fc('0x46')]=_0x591c5d[_0x36fc('0x47')]?getSeconds(_0x591c5d[_0x36fc('0x44')],_0x591c5d[_0x36fc('0x47')]):0x0;};exports[_0x36fc('0x48')]=function(_0x23d989){return _0x23d989==='Failure';};exports[_0x36fc('0x49')]=function(_0x5e7e6c,_0x8cec41,_0x56a8a1,_0x34cc11,_0x209d48){var _0x5d00f8=_0x34cc11?_0x36fc('0x4a'):_0x5e7e6c[_0x36fc('0x1d')];_0x5d00f8=_0x209d48?_0x36fc('0x4b'):_0x5d00f8;return{'actionid':_0x5e7e6c[_0x36fc('0x4c')],'action':_0x36fc('0x4d'),'channel':_0x5e7e6c['channelAgent'],'callerid':util[_0x36fc('0x15')]('\x22%s\x22\x20<%s>',_0x5d00f8,_0x5e7e6c[_0x36fc('0x1e')]),'Exten':_0x36fc('0x2b'),'Context':'from-sip','Priority':'1','variable':_0x56a8a1,'timeout':(_0x8cec41[_0x36fc('0x4e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5e7e6c[_0x36fc('0x4c')]};};exports['totalGlobal']=function(_0x22f9d4){return _0x22f9d4[_0x36fc('0x4f')]+_0x22f9d4['countcongestionretry']+_0x22f9d4[_0x36fc('0x50')];};exports[_0x36fc('0x51')]=function(_0x3ecc47){var _0x5dfc6c=_[_0x36fc('0x52')](_0x3ecc47);_0x5dfc6c[_0x36fc('0x3b')]=0xf;_0x5dfc6c[_0x36fc('0x3c')]=_0x36fc('0x53');return _0x5dfc6c;};exports['scheduledAt']=function(_0x3bbefa,_0x40f937,_0x1617dc){var _0x57bd76={};_0x57bd76[_0x40f937]=_0x3bbefa[_0x40f937];_0x57bd76[_0x36fc('0x54')]=![];_0x57bd76['scheduledat']=moment()[_0x36fc('0x55')](_0x1617dc,_0x36fc('0x56'))[_0x36fc('0x15')](_0x36fc('0x3a'));_0x57bd76[_0x36fc('0x57')]=_0x3bbefa[_0x36fc('0x57')];_0x57bd76['ListId']=_0x3bbefa[_0x36fc('0x58')];_0x57bd76[_0x36fc('0x59')]=_0x3bbefa[_0x36fc('0x59')]||undefined;return _0x57bd76;};exports[_0x36fc('0x5a')]=function(_0x291730,_0x1c06d1){if(!_[_0x36fc('0x19')](_0x291730)){if(_0x291730['pTalking']>0x0){_0x291730[_0x36fc('0x5b')]-=0x1;}else{logger[_0x36fc('0xc')](_0x1c06d1,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x36fc('0xc')](_0x1c06d1,_0x36fc('0x5c'));}};exports[_0x36fc('0x5d')]=function(_0x5099f2){if(_0x5099f2<=0x0){return!![];}return![];};exports[_0x36fc('0x5e')]=function(_0x3407c2,_0x48fefb){_0x3407c2[_0x36fc('0x5f')]=_0x48fefb;_0x3407c2[_0x36fc('0x1c')]=_0x3407c2[_0x36fc('0x60')];_0x3407c2['interface']=_0x3407c2[_0x36fc('0x61')];return _0x3407c2;};exports['buildAcw']=function(_0x454916){var _0x1bf182={};_0x1bf182['queue']=_0x454916[_0x36fc('0x60')];_0x1bf182[_0x36fc('0x62')]=_0x454916['channelAgent'];_0x1bf182[_0x36fc('0x4c')]=_0x454916[_0x36fc('0x4c')];return _0x1bf182;};exports['agentReadyId']=function(_0x5d222f){var _0x31d5ba=[];for(var _0x5da683 in _0x5d222f){if(_0x5d222f[_0x36fc('0x2e')](_0x5da683)){if(!_['isNil'](_0x5d222f[_0x5da683])&&_0x5d222f[_0x5da683][_0x36fc('0x3b')]===_0x36fc('0x63')&&_0x5d222f[_0x5da683][_0x36fc('0x64')]==='reachable'){_0x31d5ba[_0x36fc('0x65')](_0x5d222f[_0x5da683]['id']);}}}return _0x31d5ba;};exports['getDiff']=function(_0xa23d52){var _0x1d1648=moment()[_0x36fc('0x8')](0x0);var _0xd188ed=moment(_0xa23d52)[_0x36fc('0x8')](0x0);return _0x1d1648['diff'](_0xd188ed,_0x36fc('0xa'));};exports['createBody']=function(_0x5186e3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5186e3[_0x36fc('0x57')],'ListId':_0x5186e3[_0x36fc('0x58')],'VoiceQueueId':_0x5186e3[_0x36fc('0x59')]||undefined,'CampaignId':_0x5186e3[_0x36fc('0x66')]||undefined};};exports[_0x36fc('0x67')]=function(_0x4e7de4){if(_0x4e7de4==='uniqueid'||_0x4e7de4===_0x36fc('0x68')||_0x4e7de4===_0x36fc('0x60')||_0x4e7de4===_0x36fc('0x69')||_0x4e7de4===_0x36fc('0x6a')||_0x4e7de4==='dialAnswer'||_0x4e7de4===_0x36fc('0x6b')||_0x4e7de4===_0x36fc('0x61')||_0x4e7de4===_0x36fc('0x1d')||_0x4e7de4===_0x36fc('0x54')||_0x4e7de4===_0x36fc('0x1e')||_0x4e7de4==='scheduledat'||_0x4e7de4===_0x36fc('0x4f')||_0x4e7de4===_0x36fc('0x6c')||_0x4e7de4===_0x36fc('0x50')||_0x4e7de4===_0x36fc('0x6d')||_0x4e7de4===_0x36fc('0x6e')||_0x4e7de4===_0x36fc('0x6f')||_0x4e7de4===_0x36fc('0x70')||_0x4e7de4===_0x36fc('0x71')||_0x4e7de4===_0x36fc('0x57')||_0x4e7de4==='ListId'||_0x4e7de4==='UserId'||_0x4e7de4===_0x36fc('0x59')||_0x4e7de4===_0x36fc('0x72')||_0x4e7de4===_0x36fc('0x73')||_0x4e7de4===_0x36fc('0x74')||_0x4e7de4===_0x36fc('0x75')||_0x4e7de4==='xmd-listid'||_0x4e7de4===_0x36fc('0x76')||_0x4e7de4===_0x36fc('0x77')||_0x4e7de4===_0x36fc('0x78')||_0x4e7de4===_0x36fc('0x79')||_0x4e7de4===_0x36fc('0x7a')||_0x4e7de4===_0x36fc('0x7b')||_0x4e7de4===_0x36fc('0x7c')||_0x4e7de4==='xmd-callerid'||_0x4e7de4==='xmd-agiafter'||_0x4e7de4===_0x36fc('0x7d')||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4==='rtpaudioqosbridged'||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4===_0x36fc('0x80')||_0x4e7de4==='rtpaudioqoslossbridged'||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4==='rtpaudioqosrttbridged'||_0x4e7de4===_0x36fc('0x7e')||_0x4e7de4===_0x36fc('0x82')||_0x4e7de4===_0x36fc('0x7f')||_0x4e7de4==='rtpaudioqosjitterbridged'||_0x4e7de4==='rtpaudioqosloss'||_0x4e7de4===_0x36fc('0x83')||_0x4e7de4===_0x36fc('0x81')||_0x4e7de4===_0x36fc('0x84')||_0x4e7de4===_0x36fc('0x85')||_0x4e7de4==='bridgepvtcallid'||_0x4e7de4==='state'||_0x4e7de4===_0x36fc('0x3c')){return![];}return!![];};exports[_0x36fc('0x86')]=function(_0x17d6ec,_0x263fb2){var _0x1245e0,_0x5332cf,_0x54a0e1;if(_0x263fb2<=0x0){_0x263fb2=0x1;}_0x1245e0=new RegExp(_0x36fc('0x87')+_0x263fb2+'}$');_0x5332cf=Math[_0x36fc('0x88')](0xa,_0x263fb2-0x1);_0x54a0e1=Math[_0x36fc('0x88')](0xa,_0x263fb2)-0x1;return util['format']('%s',_[_0x36fc('0x89')](_0x17d6ec,_0x1245e0,_[_0x36fc('0x8a')](_0x5332cf,_0x54a0e1)));};exports[_0x36fc('0x8b')]=function(_0x4aee0e){var _0x4625dc=_0x4aee0e[_0x36fc('0x8c')](/"(.*?)"/);return _0x4625dc?_0x4625dc[0x1]:_0x4aee0e;};exports[_0x36fc('0x8d')]=function(_0x3733f4){var _0x39a813=_0x3733f4['match'](/<(.*?)>/);return _0x39a813?_0x39a813[0x1]:_0x3733f4;}; \ No newline at end of file +var _0xf474=['IsNotLoggedIn','lastevent','queue','interface','buildAcw','agentReadyId','not_inuse','status','getDiff','milliseconds','filterKey','type','campaigntype','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitter','getCallerIdRandom','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','127.0.0.1','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','message','getCallerId','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','toUpper','toLowerVariables','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','logLookAgent','membername','logCustomer','ringtime','starttime','answertime','isFailure','Failure','variablesAction','calleridname','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf474,0x13e));var _0x4f47=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xf474[_0x4e676e];return _0x336a3c;};'use strict';var util=require(_0x4f47('0x0'));var _=require('lodash');var moment=require(_0x4f47('0x1'));var logger=require(_0x4f47('0x2'))(_0x4f47('0x3'));var ipAgi=process[_0x4f47('0x4')]['XCALLY_IP_AGI']||_0x4f47('0x5');function getSeconds(_0x3e557d,_0x394d6a){var _0x46d4b6=moment(_0x3e557d)['milliseconds'](0x0);var _0x1d2896=moment(_0x394d6a)['milliseconds'](0x0);return _0x46d4b6[_0x4f47('0x6')](_0x1d2896,_0x4f47('0x7'));}exports[_0x4f47('0x8')]=function(_0x194360){return function(_0x1a3810){logger[_0x4f47('0x9')](_0x194360,util['inspect'](_0x1a3810,{'showHidden':![],'depth':null}));};};exports[_0x4f47('0xa')]=function(_0x49de20,_0x445d82){logger[_0x4f47('0xb')](_0x49de20,util[_0x4f47('0xc')](_0x445d82,{'showHidden':![],'depth':null}));};exports[_0x4f47('0xd')]=function(_0x51bd6e,_0x3a812a){logger[_0x4f47('0x9')](_0x51bd6e,util[_0x4f47('0xc')](_0x3a812a,{'showHidden':![],'depth':null}));};exports[_0x4f47('0xe')]=function(_0x297f39){return function(_0xbee140){logger[_0x4f47('0xb')](_0x297f39,util[_0x4f47('0xc')](_0xbee140,{'showHidden':![],'depth':null}));};};exports[_0x4f47('0xf')]=function(_0x90e3f1,_0x1a185a,_0x4ac0e8){return{'message':_0x90e3f1,'unlock':_0x1a185a,'active':_0x4ac0e8};};exports[_0x4f47('0x10')]=function(_0x24c111,_0x1122e0,_0x38e94e){if(!_[_0x4f47('0x11')](_0x38e94e)&&'string'===typeof _0x38e94e&&!_[_0x4f47('0x12')](_0x38e94e)){if(!_[_0x4f47('0x11')](_0x1122e0)&&_0x4f47('0x13')===typeof _0x1122e0&&!_['isEmpty'](_0x1122e0)){return util[_0x4f47('0x14')](_0x4f47('0x15'),_0x1122e0,_0x38e94e);}return util[_0x4f47('0x14')](_0x4f47('0x15'),_0x38e94e,_0x38e94e);}if(!_[_0x4f47('0x11')](_0x24c111)&&_0x4f47('0x13')===typeof _0x24c111&&!_[_0x4f47('0x12')](_0x24c111)){return _0x24c111;}return _0x4f47('0x16');};exports['isActive']=function(_0x2f8621){if(_[_0x4f47('0x17')](_0x2f8621)){return![];}return _0x2f8621;};exports[_0x4f47('0x18')]=function(_0x338b94,_0x1e3e10,_0x536238,_0x2fdeea,_0x131d50,_0x397c2b){var _0x3de8d7={'XMD-QUEUE':_0x1e3e10[_0x4f47('0x19')]?_0x1e3e10[_0x4f47('0x19')][_0x4f47('0x1a')]:'','XMD-CALLERID':_0x2fdeea,'XMD-CALLERID-PREVIEW':_0x397c2b?util[_0x4f47('0x14')](_0x4f47('0x15'),_0x397c2b['calleridname'],_0x397c2b[_0x4f47('0x1b')]):_0x2fdeea,'XMD-DIALID':_0x131d50,'XMD-CONTACTID':_0x1e3e10[_0x4f47('0x1c')],'XMD-CDRTYPE':_0x4f47('0x1d'),'CALLERID(all)':_0x2fdeea,'XMD-VOICEQUEUEID':_0x1e3e10[_0x4f47('0x1e')],'XMD-DIALCHANNEL':_0x536238,'XMD-DIALTIMEOUT':_0x338b94[_0x4f47('0x1f')]||0x1e,'XMD-DIALOPTIONS':util[_0x4f47('0x14')](_0x4f47('0x20'),_0x338b94['dialQueueProject2']?'g':'',_[_0x4f47('0x12')](_0x338b94[_0x4f47('0x21')])?'':_0x4f47('0x22')),'XMD-DIALURL':_0x338b94['dialPreviewUrl']||'','XMD-AGI':_0x338b94[_0x4f47('0x23')]?util[_0x4f47('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0x338b94['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x338b94['dialQueueProject2']?util[_0x4f47('0x14')](_0x4f47('0x24'),ipAgi,_0x338b94[_0x4f47('0x25')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x397c2b?_0x397c2b['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x397c2b?_0x397c2b[_0x4f47('0x26')]:'','XMD-DESTINATION':_0x4f47('0x27')};if(!_[_0x4f47('0x12')](_0x338b94[_0x4f47('0x21')])){_0x3de8d7[util[_0x4f47('0x14')]('%s',_0x4f47('0x28'))]=_0x338b94[_0x4f47('0x21')];_0x3de8d7[util[_0x4f47('0x14')]('%s',_0x4f47('0x29'))]=_0x131d50;}if(_0x1e3e10&&_0x1e3e10[_0x4f47('0x2a')]){for(var _0x249f58 in _0x1e3e10[_0x4f47('0x2a')]){if(_0x1e3e10[_0x4f47('0x2a')][_0x4f47('0x2b')](_0x249f58)){if(!_[_0x4f47('0x17')](_0x1e3e10[_0x4f47('0x2a')][_0x249f58])&&_0x249f58!=='id'&&_0x249f58!==_0x4f47('0x2c')&&_0x249f58!==_0x4f47('0x2d')&&_0x249f58!=='updatedAt'){_0x3de8d7[util[_0x4f47('0x14')](_0x4f47('0x2e'),'XMD-',_[_0x4f47('0x2f')](_0x249f58))]=_0x1e3e10['Contact'][_0x249f58];}}}}return _0x3de8d7;};exports[_0x4f47('0x30')]=function(_0x26d32e){var _0x579fea={};for(var _0x50cdb8 in _0x26d32e){if(_0x26d32e[_0x4f47('0x2b')](_0x50cdb8)){_0x579fea[util[_0x4f47('0x14')]('%s',_['toLower'](_0x50cdb8))]=_0x26d32e[_0x50cdb8];}}return{'variables':_0x579fea};};exports['updateOriginated']=function(_0x2fc1e1,_0x3ea109){if(!_['isNil'](_0x2fc1e1)){if(_0x2fc1e1[_0x4f47('0x2b')](_0x4f47('0x31'))){if(_0x2fc1e1['originated']>0x0){_0x2fc1e1[_0x4f47('0x31')]-=0x1;}else{logger[_0x4f47('0x9')](_0x4f47('0x32'),_0x3ea109);}}}else{logger[_0x4f47('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3ea109);}};exports[_0x4f47('0x33')]=function(_0x147d94){var _0x2f398b=moment()[_0x4f47('0x14')](_0x4f47('0x34'));_0x147d94[_0x4f47('0x35')]=0xd;_0x147d94[_0x4f47('0x36')]=_0x4f47('0x37');_0x147d94['starttime']=_0x2f398b;_0x147d94[_0x4f47('0x38')]=_0x2f398b;_0x147d94[_0x4f47('0x39')]=_0x2f398b;};exports[_0x4f47('0x3a')]=function(_0x35f001,_0x5b76fa,_0x5dedd7){var _0x2fc6cd=moment()[_0x4f47('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x35f001[_0x4f47('0x35')]=_0x5b76fa;_0x35f001[_0x4f47('0x36')]=_0x5dedd7;_0x35f001[_0x4f47('0x38')]=_0x2fc6cd;_0x35f001['ringtime']=getSeconds(_0x35f001[_0x4f47('0x38')],_0x35f001['starttime']);};exports[_0x4f47('0x3b')]=function(_0x33b955,_0x30fc90,_0x29c2f0){_0x33b955[_0x4f47('0x3c')]=_0x30fc90;_0x33b955['UserId']=_0x29c2f0;};exports[_0x4f47('0x3d')]=function(_0x532be4,_0x19f781,_0x55eca0){var _0x381372=moment()['format'](_0x4f47('0x34'));_0x532be4[_0x4f47('0x35')]=_0x19f781;_0x532be4[_0x4f47('0x36')]=_0x55eca0;_0x532be4[_0x4f47('0x38')]=_0x532be4[_0x4f47('0x38')]?_0x532be4[_0x4f47('0x38')]:_0x381372;_0x532be4[_0x4f47('0x39')]=_0x532be4[_0x4f47('0x39')]?_0x532be4[_0x4f47('0x39')]:_0x381372;_0x532be4[_0x4f47('0x3e')]=getSeconds(_0x532be4[_0x4f47('0x38')]||0x0,_0x532be4[_0x4f47('0x3f')]||0x0);_0x532be4['talktime']=_0x532be4[_0x4f47('0x40')]?getSeconds(_0x532be4['endtime'],_0x532be4[_0x4f47('0x40')]):0x0;};exports[_0x4f47('0x41')]=function(_0x202da5){return _0x202da5===_0x4f47('0x42');};exports[_0x4f47('0x43')]=function(_0x43ebc0,_0x22c75f,_0x2c6709,_0x3c986c,_0x4d4e6a){var _0x4745cd=_0x3c986c?'RECALL':_0x43ebc0[_0x4f47('0x44')];_0x4745cd=_0x4d4e6a?_0x4f47('0x45'):_0x4745cd;return{'actionid':_0x43ebc0[_0x4f47('0x46')],'action':_0x4f47('0x47'),'channel':_0x43ebc0[_0x4f47('0x48')],'callerid':util[_0x4f47('0x14')](_0x4f47('0x15'),_0x4745cd,_0x43ebc0['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x4f47('0x49'),'Priority':'1','variable':_0x2c6709,'timeout':(_0x22c75f[_0x4f47('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x43ebc0[_0x4f47('0x46')]};};exports[_0x4f47('0x4b')]=function(_0x405b5e){return _0x405b5e[_0x4f47('0x4c')]+_0x405b5e[_0x4f47('0x4d')]+_0x405b5e[_0x4f47('0x4e')];};exports[_0x4f47('0x4f')]=function(_0x297f5a){var _0x4ba461=_[_0x4f47('0x50')](_0x297f5a);_0x4ba461[_0x4f47('0x35')]=0xf;_0x4ba461[_0x4f47('0x36')]=_0x4f47('0x51');return _0x4ba461;};exports[_0x4f47('0x52')]=function(_0x3fb520,_0x334b72,_0x5270a0){var _0x5b3bb9={};_0x5b3bb9[_0x334b72]=_0x3fb520[_0x334b72];_0x5b3bb9[_0x4f47('0x53')]=![];_0x5b3bb9[_0x4f47('0x54')]=moment()[_0x4f47('0x55')](_0x5270a0,_0x4f47('0x56'))[_0x4f47('0x14')](_0x4f47('0x34'));_0x5b3bb9[_0x4f47('0x1c')]=_0x3fb520[_0x4f47('0x1c')];_0x5b3bb9[_0x4f47('0x57')]=_0x3fb520[_0x4f47('0x57')];_0x5b3bb9[_0x4f47('0x1e')]=_0x3fb520[_0x4f47('0x1e')]||undefined;return _0x5b3bb9;};exports['decrementTalkink']=function(_0x19ca3f,_0x1eed6d){if(!_[_0x4f47('0x17')](_0x19ca3f)){if(_0x19ca3f[_0x4f47('0x58')]>0x0){_0x19ca3f[_0x4f47('0x58')]-=0x1;}else{logger[_0x4f47('0x9')](_0x1eed6d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x1eed6d,_0x4f47('0x59'));}};exports[_0x4f47('0x5a')]=function(_0x2d2b18){if(_0x2d2b18<=0x0){return!![];}return![];};exports['buildObj']=function(_0x544026,_0x1f3909){_0x544026[_0x4f47('0x5b')]=_0x1f3909;_0x544026['name']=_0x544026[_0x4f47('0x5c')];_0x544026[_0x4f47('0x5d')]=_0x544026[_0x4f47('0x48')];return _0x544026;};exports[_0x4f47('0x5e')]=function(_0x29ccf8){var _0x595467={};_0x595467[_0x4f47('0x5c')]=_0x29ccf8['queue'];_0x595467[_0x4f47('0x5d')]=_0x29ccf8['channelAgent'];_0x595467['uniqueid']=_0x29ccf8[_0x4f47('0x46')];return _0x595467;};exports[_0x4f47('0x5f')]=function(_0x44eb13){var _0x1b0246=[];for(var _0x1438b8 in _0x44eb13){if(_0x44eb13[_0x4f47('0x2b')](_0x1438b8)){if(!_['isNil'](_0x44eb13[_0x1438b8])&&_0x44eb13[_0x1438b8][_0x4f47('0x35')]===_0x4f47('0x60')&&_0x44eb13[_0x1438b8][_0x4f47('0x61')]==='reachable'){_0x1b0246['push'](_0x44eb13[_0x1438b8]['id']);}}}return _0x1b0246;};exports[_0x4f47('0x62')]=function(_0x20cbdc){var _0x473b1d=moment()[_0x4f47('0x63')](0x0);var _0x3dadcb=moment(_0x20cbdc)[_0x4f47('0x63')](0x0);return _0x473b1d[_0x4f47('0x6')](_0x3dadcb,_0x4f47('0x7'));};exports['createBody']=function(_0x4c257a){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4c257a['ContactId'],'ListId':_0x4c257a['ListId'],'VoiceQueueId':_0x4c257a['VoiceQueueId']||undefined,'CampaignId':_0x4c257a['CampaignId']||undefined};};exports[_0x4f47('0x64')]=function(_0x164a92){if(_0x164a92===_0x4f47('0x46')||_0x164a92==='idContact'||_0x164a92===_0x4f47('0x5c')||_0x164a92===_0x4f47('0x65')||_0x164a92===_0x4f47('0x66')||_0x164a92==='dialAnswer'||_0x164a92===_0x4f47('0x3c')||_0x164a92===_0x4f47('0x48')||_0x164a92===_0x4f47('0x44')||_0x164a92===_0x4f47('0x53')||_0x164a92===_0x4f47('0x1b')||_0x164a92===_0x4f47('0x54')||_0x164a92==='countbusyretry'||_0x164a92===_0x4f47('0x4d')||_0x164a92==='countnoanswerretry'||_0x164a92===_0x4f47('0x67')||_0x164a92===_0x4f47('0x68')||_0x164a92===_0x4f47('0x69')||_0x164a92===_0x4f47('0x6a')||_0x164a92===_0x4f47('0x6b')||_0x164a92===_0x4f47('0x1c')||_0x164a92===_0x4f47('0x57')||_0x164a92===_0x4f47('0x6c')||_0x164a92===_0x4f47('0x1e')||_0x164a92===_0x4f47('0x6d')||_0x164a92==='xmd-voicequeueid'||_0x164a92===_0x4f47('0x6e')||_0x164a92==='xmd-phone'||_0x164a92===_0x4f47('0x6f')||_0x164a92===_0x4f47('0x70')||_0x164a92==='xmd-dialtimeout'||_0x164a92===_0x4f47('0x71')||_0x164a92===_0x4f47('0x72')||_0x164a92===_0x4f47('0x73')||_0x164a92===_0x4f47('0x74')||_0x164a92===_0x4f47('0x75')||_0x164a92===_0x4f47('0x76')||_0x164a92===_0x4f47('0x77')||_0x164a92===_0x4f47('0x78')||_0x164a92===_0x4f47('0x79')||_0x164a92===_0x4f47('0x7a')||_0x164a92==='rtpaudioqosjitter'||_0x164a92===_0x4f47('0x7b')||_0x164a92===_0x4f47('0x7c')||_0x164a92===_0x4f47('0x7d')||_0x164a92===_0x4f47('0x7e')||_0x164a92===_0x4f47('0x7f')||_0x164a92===_0x4f47('0x79')||_0x164a92===_0x4f47('0x7a')||_0x164a92===_0x4f47('0x80')||_0x164a92===_0x4f47('0x7b')||_0x164a92===_0x4f47('0x7c')||_0x164a92==='rtpaudioqoslossbridged'||_0x164a92===_0x4f47('0x7e')||_0x164a92===_0x4f47('0x7f')||_0x164a92==='bridgepeer'||_0x164a92==='bridgepvtcallid'||_0x164a92===_0x4f47('0x35')||_0x164a92==='statedesc'){return![];}return!![];};exports[_0x4f47('0x81')]=function(_0x5ddef6,_0x5d0f2e){var _0x2351a5,_0x1058b6,_0x49c1d6;if(_0x5d0f2e<=0x0){_0x5d0f2e=0x1;}_0x2351a5=new RegExp('\x5cw{0,'+_0x5d0f2e+'}$');_0x1058b6=Math['pow'](0xa,_0x5d0f2e-0x1);_0x49c1d6=Math[_0x4f47('0x82')](0xa,_0x5d0f2e)-0x1;return util[_0x4f47('0x14')]('%s',_[_0x4f47('0x83')](_0x5ddef6,_0x2351a5,_[_0x4f47('0x84')](_0x1058b6,_0x49c1d6)));};exports[_0x4f47('0x85')]=function(_0x4b6839){var _0x1c94f1=_0x4b6839[_0x4f47('0x86')](/"(.*?)"/);return _0x1c94f1?_0x1c94f1[0x1]:_0x4b6839;};exports[_0x4f47('0x87')]=function(_0x4fe78c){var _0x2c64a8=_0x4fe78c['match'](/<(.*?)>/);return _0x2c64a8?_0x2c64a8[0x1]:_0x4fe78c;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e8e9029..e4847d9 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 _0xd6d6=['queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect'];(function(_0xdfd5c,_0xb426e3){var _0x50dfd4=function(_0x38e7b9){while(--_0x38e7b9){_0xdfd5c['push'](_0xdfd5c['shift']());}};_0x50dfd4(++_0xb426e3);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x10c703,_0x175db8){_0x10c703=_0x10c703-0x0;var _0x55d5ee=_0xd6d6[_0x10c703];return _0x55d5ee;};'use strict';exports[_0x6d6d('0x0')]={'queue':{'type':_0x6d6d('0x1'),'required':!![]},'interface':{'type':_0x6d6d('0x1'),'required':!![]},'membername':{'type':_0x6d6d('0x1'),'required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x6d6d('0x2'),'required':![]}};exports[_0x6d6d('0x3')]={'queue':{'type':_0x6d6d('0x1'),'required':!![]},'interface':{'type':_0x6d6d('0x1'),'required':!![]}};exports[_0x6d6d('0x4')]={'interface':{'type':_0x6d6d('0x1'),'required':!![]},'paused':{'type':_0x6d6d('0x2')},'reason':{'type':'string','required':![]}};exports[_0x6d6d('0x5')]={'module':{'type':_0x6d6d('0x1'),'required':![]}};exports[_0x6d6d('0x6')]={'uniqueid':{'type':_0x6d6d('0x1'),'required':!![]}};exports[_0x6d6d('0x7')]={'uniqueid':{'type':_0x6d6d('0x1'),'required':!![]},'filename':{'type':_0x6d6d('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x6d6d('0x8')]={'uniqueid':{'type':_0x6d6d('0x1'),'required':!![]}};exports[_0x6d6d('0x9')]={'uniqueid':{'type':_0x6d6d('0x1'),'required':!![]},'exten':{'type':_0x6d6d('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x9879=['string','number','queueremove','queuepause','boolean','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x9879,0x98));var _0x9987=function(_0x2c49c0,_0x56cdca){_0x2c49c0=_0x2c49c0-0x0;var _0x135b31=_0x9879[_0x2c49c0];return _0x135b31;};'use strict';exports[_0x9987('0x0')]={'queue':{'type':_0x9987('0x1'),'required':!![]},'interface':{'type':_0x9987('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x9987('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x9987('0x3')]={'queue':{'type':_0x9987('0x1'),'required':!![]},'interface':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x4')]={'interface':{'type':_0x9987('0x1'),'required':!![]},'paused':{'type':_0x9987('0x5')},'reason':{'type':_0x9987('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x9987('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x6')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]},'filename':{'type':_0x9987('0x1')},'format':{'type':_0x9987('0x1')},'mixmonitorid':{'type':_0x9987('0x1')}};exports[_0x9987('0x7')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]}};exports[_0x9987('0x8')]={'uniqueid':{'type':_0x9987('0x1'),'required':!![]},'exten':{'type':_0x9987('0x1'),'required':!![]},'context':{'type':_0x9987('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 6733dad..fde9f28 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 _0x45ec=['initVoiceQueueHopperHistory','groupBy','queue','queuecallerexit','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','initVoiceExtensions','merge','exports','bluebird','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','hasOwnProperty','mapKeys','SIP/%s','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','unmanaged','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','isUndefined','format','length','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts'];(function(_0x121b8a,_0x2305e){var _0x1db4ad=function(_0x51bcd8){while(--_0x51bcd8){_0x121b8a['push'](_0x121b8a['shift']());}};_0x1db4ad(++_0x2305e);}(_0x45ec,0x199));var _0xc45e=function(_0x2a2b28,_0x44d7cd){_0x2a2b28=_0x2a2b28-0x0;var _0x1f2905=_0x45ec[_0x2a2b28];return _0x1f2905;};'use strict';var BPromise=require(_0xc45e('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0xc45e('0x1'));var Agent=require(_0xc45e('0x2'));var Telephone=require(_0xc45e('0x3'));var Trunk=require(_0xc45e('0x4'));var VoiceQueue=require(_0xc45e('0x5'));var Trigger=require(_0xc45e('0x6'));var Template=require(_0xc45e('0x7'));var Campaign=require(_0xc45e('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xc45e('0x9'));var SalesforceAccount=require(_0xc45e('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xc45e('0xb'));var ZohoAccount=require(_0xc45e('0xc'));var DeskAccount=require(_0xc45e('0xd'));var VtigerAccount=require(_0xc45e('0xe'));var FaxAccount=require(_0xc45e('0xf'));var Realtime=function(){this[_0xc45e('0x10')]={};this[_0xc45e('0x11')]={};this[_0xc45e('0x12')]={};this['voiceQueues']={};this[_0xc45e('0x13')]={};this[_0xc45e('0x14')]={};this[_0xc45e('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xc45e('0x16')]={};this[_0xc45e('0x17')]={};this['queueChannels']={};this[_0xc45e('0x18')]={};this[_0xc45e('0x19')]={};this['zendeskAccounts']={};this[_0xc45e('0x1a')]={};this[_0xc45e('0x1b')]={};this[_0xc45e('0x1c')]={};this[_0xc45e('0x1d')]={};this[_0xc45e('0x1e')]={};this[_0xc45e('0x1f')]={};this[_0xc45e('0x20')]={};};function freeIsNotKey(_0x90108d,_0x1c9605,_0x5af6d0){var _0x23e00d=_['mapKeys'](_0x90108d,function(_0x259dd1,_0x4250e3){return _0x259dd1[_0x5af6d0];});for(var _0x465117 in _0x1c9605){if(_0x1c9605[_0xc45e('0x21')](_0x465117)){if(!_0x23e00d[_0x465117]){delete _0x1c9605[_0x465117];}}}}function freeIsNotKeySip(_0x1a7037,_0x33d94b){var _0x37f15e=_[_0xc45e('0x22')](_0x1a7037,function(_0x5b542b,_0x2beac7){return util['format'](_0xc45e('0x23'),_0x5b542b[_0xc45e('0x24')]);});for(var _0x20fab4 in _0x33d94b){if(_0x33d94b[_0xc45e('0x21')](_0x20fab4)){if(!_0x37f15e[_0x20fab4]){delete _0x33d94b[_0x20fab4];}}}}function clearVoiceCallReports(_0x5f243e){_0x5f243e[_0xc45e('0x25')]=0x0;_0x5f243e[_0xc45e('0x26')]=0x0;_0x5f243e[_0xc45e('0x27')]=0x0;_0x5f243e[_0xc45e('0x28')]=0x0;_0x5f243e[_0xc45e('0x29')]=0x0;}function clearCampaigns(_0x24e1e8){if(!_[_0xc45e('0x2a')](_0x24e1e8)){for(var _0x397516 in _0x24e1e8){if(_0x24e1e8['hasOwnProperty'](_0x397516)){_0x24e1e8[_0x397516][_0xc45e('0x2b')]=0x0;_0x24e1e8[_0x397516]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x56853a){if(!_[_0xc45e('0x2a')](_0x56853a)){for(var _0x4f4073 in _0x56853a){if(_0x56853a[_0xc45e('0x21')](_0x4f4073)){_0x56853a[_0x4f4073][_0xc45e('0x25')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x26')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x2c')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x27')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x28')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x29')]=0x0;_0x56853a[_0x4f4073]['outboundAnswerAgiCallsDay']=0x0;_0x56853a[_0x4f4073][_0xc45e('0x2d')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x2e')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x2f')]=0x0;_0x56853a[_0x4f4073]['outboundNoSuchCallsDay']=0x0;_0x56853a[_0x4f4073][_0xc45e('0x30')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x31')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x32')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x33')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x34')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x35')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x36')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x37')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x38')]=0x0;_0x56853a[_0x4f4073][_0xc45e('0x39')]=!![];}}}}Realtime['prototype'][_0xc45e('0x3a')]=function(_0x2bb077,_0x4665e9){for(var _0x124731 in _0x4665e9){if(_0x2bb077['hasOwnProperty'](_0x124731)){_0x2bb077[_0x124731]=_0x4665e9[_0x124731];}}};Realtime[_0xc45e('0x3b')][_0xc45e('0x3c')]=function(){var _0x1122ce=this;return function(_0x373f52){if(_0x373f52){freeIsNotKeySip(_0x373f52,_0x1122ce[_0xc45e('0x10')]);for(var _0x4b6d4f=0x0,_0x112523={},_0xd821c7={};_0x4b6d4f<_0x373f52['length'];_0x4b6d4f+=0x1){_0x112523=_0x373f52[_0x4b6d4f];if(_[_0xc45e('0x3d')](_0x1122ce[_0xc45e('0x10')][util[_0xc45e('0x3e')](_0xc45e('0x23'),_0x112523['name'])])){_0x1122ce[_0xc45e('0x10')][util[_0xc45e('0x3e')]('SIP/%s',_0x112523[_0xc45e('0x24')])]=new Agent(_0x112523);}else{_0x1122ce[_0xc45e('0x3a')](_0x1122ce[_0xc45e('0x10')][util[_0xc45e('0x3e')](_0xc45e('0x23'),_0x112523['name'])],_0x112523);}}}return _0x1122ce[_0xc45e('0x10')];};};Realtime[_0xc45e('0x3b')]['initTelephones']=function(){var _0x4f7acf=this;return function(_0x11c469){if(_0x11c469){freeIsNotKeySip(_0x11c469,_0x4f7acf[_0xc45e('0x11')]);for(var _0x1feb8e=0x0,_0x5c9669={},_0x5c8b9d={};_0x1feb8e<_0x11c469[_0xc45e('0x3f')];_0x1feb8e+=0x1){_0x5c9669=_0x11c469[_0x1feb8e];if(_[_0xc45e('0x3d')](_0x4f7acf[_0xc45e('0x11')][util[_0xc45e('0x3e')](_0xc45e('0x23'),_0x5c9669[_0xc45e('0x24')])])){_0x4f7acf['telephones'][util[_0xc45e('0x3e')](_0xc45e('0x23'),_0x5c9669[_0xc45e('0x24')])]=new Telephone(_0x5c9669);}else{_0x4f7acf[_0xc45e('0x3a')](_0x4f7acf['telephones'][util['format'](_0xc45e('0x23'),_0x5c9669[_0xc45e('0x24')])],_0x5c9669);}}}return _0x4f7acf[_0xc45e('0x11')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x40')]=function(){var _0xd8e886=this;return function(_0x51c7c2){if(_0x51c7c2){freeIsNotKeySip(_0x51c7c2,_0xd8e886[_0xc45e('0x12')]);for(var _0x482abc=0x0,_0x594305={},_0x2b87cc={};_0x482abc<_0x51c7c2[_0xc45e('0x3f')];_0x482abc+=0x1){_0x594305=_0x51c7c2[_0x482abc];if(_[_0xc45e('0x3d')](_0xd8e886[_0xc45e('0x12')][util['format']('SIP/%s',_0x594305[_0xc45e('0x24')])])){_0xd8e886['trunks'][util['format'](_0xc45e('0x23'),_0x594305[_0xc45e('0x24')])]=new Trunk(_0x594305);}else{_0xd8e886[_0xc45e('0x3a')](_0xd8e886[_0xc45e('0x12')][util[_0xc45e('0x3e')](_0xc45e('0x23'),_0x594305[_0xc45e('0x24')])],_0x594305);}}}return _0xd8e886[_0xc45e('0x12')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x41')]=function(){var _0x24cc2d=this;return function(_0x2ed795){if(_0x2ed795){freeIsNotKey(_0x2ed795,_0x24cc2d[_0xc45e('0x42')],_0xc45e('0x24'));for(var _0x216eb4=0x0,_0x23ae0c={},_0x22732d={};_0x216eb4<_0x2ed795[_0xc45e('0x3f')];_0x216eb4+=0x1){_0x23ae0c=_0x2ed795[_0x216eb4];if(_[_0xc45e('0x3d')](_0x24cc2d['voiceQueues'][_0x23ae0c[_0xc45e('0x24')]])){_0x24cc2d['voiceQueues'][_0x23ae0c['name']]=new VoiceQueue(_0x23ae0c);}else{_0x24cc2d['mergeFromDatabase'](_0x24cc2d['voiceQueues'][_0x23ae0c[_0xc45e('0x24')]],_0x23ae0c);}}}return _0x24cc2d[_0xc45e('0x42')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x43')]=function(){var _0x1168ba=this;return function(_0x15f587){if(_0x15f587){freeIsNotKey(_0x15f587,_0x1168ba[_0xc45e('0x13')],'id');for(var _0x488e8e=0x0,_0x47b9ab={},_0x55739b={};_0x488e8e<_0x15f587[_0xc45e('0x3f')];_0x488e8e+=0x1){_0x47b9ab=_0x15f587[_0x488e8e];if(_['isUndefined'](_0x1168ba[_0xc45e('0x13')][_0x47b9ab['id']])){_0x1168ba['triggers'][_0x47b9ab['id']]=new Trigger(_0x47b9ab);}else{_0x1168ba[_0xc45e('0x3a')](_0x1168ba[_0xc45e('0x13')][_0x47b9ab['id']],_0x47b9ab);}}}return _0x1168ba['triggers'];};};Realtime[_0xc45e('0x3b')]['initTemplates']=function(){var _0x20d091=this;return function(_0xa5d16){if(_0xa5d16){freeIsNotKey(_0xa5d16,_0x20d091[_0xc45e('0x15')],'id');for(var _0x23b7f6=0x0,_0x631bd7={},_0x4482a8={};_0x23b7f6<_0xa5d16[_0xc45e('0x3f')];_0x23b7f6+=0x1){_0x631bd7=_0xa5d16[_0x23b7f6];if(_['isUndefined'](_0x20d091[_0xc45e('0x15')][_0x631bd7['id']])){_0x20d091[_0xc45e('0x15')][_0x631bd7['id']]=new Template(_0x631bd7);}else{_0x20d091[_0xc45e('0x3a')](_0x20d091[_0xc45e('0x15')][_0x631bd7['id']],_0x631bd7);}}}return _0x20d091[_0xc45e('0x15')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x44')]=function(){var _0x282ad6=this;return function(_0x58e62b){if(_0x58e62b){freeIsNotKey(_0x58e62b,_0x282ad6[_0xc45e('0x45')],'id');for(var _0x5446b6=0x0,_0x53a65c={},_0x2f2d40={};_0x5446b6<_0x58e62b[_0xc45e('0x3f')];_0x5446b6+=0x1){_0x53a65c=_0x58e62b[_0x5446b6];if(_[_0xc45e('0x3d')](_0x282ad6[_0xc45e('0x45')][_0x53a65c['id']])){_0x282ad6['zendeskAccounts'][_0x53a65c['id']]=new ZendeskAccount(_0x53a65c);}else{_0x282ad6[_0xc45e('0x3a')](_0x282ad6['zendeskAccounts'][_0x53a65c['id']],_0x53a65c);}}}return _0x282ad6[_0xc45e('0x45')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x46')]=function(){var _0x5a4aa4=this;return function(_0x477190){if(_0x477190){freeIsNotKey(_0x477190,_0x5a4aa4[_0xc45e('0x1a')],'id');for(var _0x5ee524=0x0,_0x5f1097={},_0x84cf07={};_0x5ee524<_0x477190['length'];_0x5ee524+=0x1){_0x5f1097=_0x477190[_0x5ee524];if(_[_0xc45e('0x3d')](_0x5a4aa4[_0xc45e('0x1a')][_0x5f1097['id']])){_0x5a4aa4[_0xc45e('0x1a')][_0x5f1097['id']]=new SalesforceAccount(_0x5f1097);}else{_0x5a4aa4[_0xc45e('0x3a')](_0x5a4aa4['salesforceAccounts'][_0x5f1097['id']],_0x5f1097);}}}return _0x5a4aa4[_0xc45e('0x1a')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x47')]=function(){var _0x6ce1be=this;return function(_0x327848){if(_0x327848){freeIsNotKey(_0x327848,_0x6ce1be[_0xc45e('0x1c')],'id');for(var _0x2613cc=0x0,_0x5424ec={},_0xea182c={};_0x2613cc<_0x327848[_0xc45e('0x3f')];_0x2613cc+=0x1){_0x5424ec=_0x327848[_0x2613cc];if(_['isUndefined'](_0x6ce1be[_0xc45e('0x1c')][_0x5424ec['id']])){_0x6ce1be['freshdeskAccounts'][_0x5424ec['id']]=new FreshdeskAccount(_0x5424ec);}else{_0x6ce1be[_0xc45e('0x3a')](_0x6ce1be['freshdeskAccounts'][_0x5424ec['id']],_0x5424ec);}}}return _0x6ce1be[_0xc45e('0x1c')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x48')]=function(){var _0x1841de=this;return function(_0x3a929e){if(_0x3a929e){freeIsNotKey(_0x3a929e,_0x1841de[_0xc45e('0x1d')],'id');for(var _0x3764f8=0x0,_0x580e39={},_0xbdb351={};_0x3764f8<_0x3a929e[_0xc45e('0x3f')];_0x3764f8+=0x1){_0x580e39=_0x3a929e[_0x3764f8];if(_['isUndefined'](_0x1841de[_0xc45e('0x1d')][_0x580e39['id']])){_0x1841de['zohoAccounts'][_0x580e39['id']]=new ZohoAccount(_0x580e39);}else{_0x1841de['mergeFromDatabase'](_0x1841de['zohoAccounts'][_0x580e39['id']],_0x580e39);}}}return _0x1841de['zohoAccounts'];};};Realtime['prototype'][_0xc45e('0x49')]=function(){var _0x201580=this;return function(_0x50900f){if(_0x50900f){freeIsNotKey(_0x50900f,_0x201580[_0xc45e('0x1e')],'id');for(var _0xb8e458=0x0,_0x49a7f2={},_0x2da1e2={};_0xb8e458<_0x50900f[_0xc45e('0x3f')];_0xb8e458+=0x1){_0x49a7f2=_0x50900f[_0xb8e458];if(_[_0xc45e('0x3d')](_0x201580[_0xc45e('0x1e')][_0x49a7f2['id']])){_0x201580[_0xc45e('0x1e')][_0x49a7f2['id']]=new DeskAccount(_0x49a7f2);}else{_0x201580['mergeFromDatabase'](_0x201580[_0xc45e('0x1e')][_0x49a7f2['id']],_0x49a7f2);}}}return _0x201580['deskAccounts'];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x4a')]=function(){var _0x30b477=this;return function(_0x253af8){if(_0x253af8){freeIsNotKey(_0x253af8,_0x30b477[_0xc45e('0x1b')],'id');for(var _0x12e876=0x0,_0x97a2cd={},_0x33c84c={};_0x12e876<_0x253af8['length'];_0x12e876+=0x1){_0x97a2cd=_0x253af8[_0x12e876];if(_[_0xc45e('0x3d')](_0x30b477['sugarcrmAccounts'][_0x97a2cd['id']])){_0x30b477[_0xc45e('0x1b')][_0x97a2cd['id']]=new SugarcrmAccount(_0x97a2cd);}else{_0x30b477['mergeFromDatabase'](_0x30b477[_0xc45e('0x1b')][_0x97a2cd['id']],_0x97a2cd);}}}return _0x30b477[_0xc45e('0x1b')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x4b')]=function(){var _0x278665=this;return function(_0x1440d4){if(_0x1440d4){freeIsNotKey(_0x1440d4,_0x278665[_0xc45e('0x1f')],'id');for(var _0x3b1c41=0x0,_0x5700f6={},_0x1ffadd={};_0x3b1c41<_0x1440d4[_0xc45e('0x3f')];_0x3b1c41+=0x1){_0x5700f6=_0x1440d4[_0x3b1c41];if(_[_0xc45e('0x3d')](_0x278665[_0xc45e('0x1f')][_0x5700f6['id']])){_0x278665[_0xc45e('0x1f')][_0x5700f6['id']]=new VtigerAccount(_0x5700f6);}else{_0x278665[_0xc45e('0x3a')](_0x278665['vtigerAccounts'][_0x5700f6['id']],_0x5700f6);}}}return _0x278665[_0xc45e('0x1f')];};};Realtime['prototype'][_0xc45e('0x4c')]=function(){var _0x5eda40=this;return function(_0x4ee64e){for(var _0x533672=0x0;_0x533672<_0x4ee64e[_0xc45e('0x3f')];_0x533672+=0x1){_['merge'](_0x5eda40[_0xc45e('0x42')][_0x4ee64e[_0x533672][_0xc45e('0x24')]],_0x4ee64e[_0x533672]);}return _0x5eda40['voiceQueues'];};};Realtime[_0xc45e('0x3b')]['initVoiceQueueReports']=function(){var _0x150706=this;return function(_0x2794fd){clearVoiceQueues(_0x150706[_0xc45e('0x42')]);if(_0x2794fd){_0x2794fd=_[_0xc45e('0x4d')](_0x2794fd,'uniqueid');for(var _0x3172c0 in _0x2794fd){if(_0x2794fd[_0xc45e('0x21')](_0x3172c0)){var _0x2ac87b={};for(var _0x2a188d=0x0;_0x2a188d<_0x2794fd[_0x3172c0][_0xc45e('0x3f')];_0x2a188d+=0x1){var _0x286159=_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x4e')];if(_0x150706[_0xc45e('0x42')][_0x286159]){if(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x4f')]){_0x150706[_0xc45e('0x42')][_0x286159]['unmanaged']+=0x1;}_0x150706['voiceQueues'][_0x286159]['sumHoldTime']+=moment(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x50')])[_0xc45e('0x51')](moment(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x52')]),_0xc45e('0x53'))||0x0;if(_0x2a188d===_0x2794fd[_0x3172c0]['length']-0x1){_0x150706[_0xc45e('0x42')][_0x286159]['sumDuration']+=moment(_0x2794fd[_0x3172c0][_0x2a188d]['queuecallercompleteAt']||_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x54')]||_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x55')])[_0xc45e('0x51')](moment(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x52')]),_0xc45e('0x53'))||0x0;_0x150706[_0xc45e('0x42')][_0x286159]['total']+=0x1;if(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x56')]){_0x150706[_0xc45e('0x42')][_0x286159][_0xc45e('0x26')]+=0x1;_0x150706[_0xc45e('0x42')][_0x286159][_0xc45e('0x29')]+=moment(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x57')])[_0xc45e('0x51')](moment(_0x2794fd[_0x3172c0][_0x2a188d][_0xc45e('0x50')]),_0xc45e('0x53'))||0x0;}}else{_0x150706[_0xc45e('0x42')][_0x286159]['sumDuration']+=_0x150706['voiceQueues'][_0x286159][_0xc45e('0x27')]||0x0;}}}}}}return _0x150706[_0xc45e('0x42')];};};Realtime[_0xc45e('0x3b')]['initVoiceCallReports']=function(){var _0x4c2819=this;return function(_0x51b1e3){clearVoiceCallReports(_0x4c2819[_0xc45e('0x58')]);if(_0x51b1e3){for(var _0x64a7af=0x0;_0x64a7af<_0x51b1e3[_0xc45e('0x3f')];_0x64a7af+=0x1){_0x4c2819[_0xc45e('0x58')][_0xc45e('0x25')]+=0x1;_0x4c2819[_0xc45e('0x58')][_0xc45e('0x28')]+=_0x51b1e3[_0x64a7af][_0xc45e('0x59')];if(_0x51b1e3[_0x64a7af][_0xc45e('0x5a')]===_0xc45e('0x5b')){_0x4c2819[_0xc45e('0x58')][_0xc45e('0x26')]+=0x1;_0x4c2819[_0xc45e('0x58')][_0xc45e('0x27')]+=_0x51b1e3[_0x64a7af][_0xc45e('0x59')]-_0x51b1e3[_0x64a7af][_0xc45e('0x5c')]||0x0;_0x4c2819[_0xc45e('0x58')][_0xc45e('0x29')]+=_0x51b1e3[_0x64a7af][_0xc45e('0x5c')];}}}return _0x4c2819[_0xc45e('0x58')];};};Realtime[_0xc45e('0x3b')][_0xc45e('0x5d')]=function(){var _0x4d7660=this;return function(_0x5cc952){if(_0x5cc952){freeIsNotKey(_0x5cc952,_0x4d7660['campaigns'],'name');for(var _0x3385ef=0x0,_0x13c988={};_0x3385ef<_0x5cc952[_0xc45e('0x3f')];_0x3385ef+=0x1){_0x13c988=_0x5cc952[_0x3385ef];if(_[_0xc45e('0x3d')](_0x4d7660[_0xc45e('0x14')][_0x13c988['name']])){_0x4d7660[_0xc45e('0x14')][_0x13c988[_0xc45e('0x24')]]=new Campaign(_0x13c988);}else{_0x4d7660['mergeFromDatabase'](_0x4d7660[_0xc45e('0x14')][_0x13c988[_0xc45e('0x24')]],_0x13c988);}}}return _0x4d7660['campaigns'];};};Realtime['prototype'][_0xc45e('0x5e')]=function(){var _0x3ee7d5=this;return function(_0x546d32){if(_0x546d32){freeIsNotKey(_0x546d32,_0x3ee7d5[_0xc45e('0x16')],'id');for(var _0x555f56=0x0,_0x55f510={};_0x555f56<_0x546d32['length'];_0x555f56+=0x1){_0x55f510=_0x546d32[_0x555f56];if(_[_0xc45e('0x3d')](_0x3ee7d5[_0xc45e('0x16')][_0x55f510['id']])){_0x3ee7d5[_0xc45e('0x16')][_0x55f510['id']]=new VoiceExtension(_0x55f510);}else{_0x3ee7d5[_0xc45e('0x3a')](_0x3ee7d5[_0xc45e('0x16')][_0x55f510['id']],_0x55f510);}}}return _0x3ee7d5['voiceExtensions'];};};Realtime[_0xc45e('0x3b')]['initCampaignHopperHistory']=function(){var _0xc84dba=this;return function(_0x1273e8){clearCampaigns(_0xc84dba[_0xc45e('0x14')]);for(var _0x27a6c5=0x0;_0x27a6c5<_0x1273e8['length'];_0x27a6c5+=0x1){_[_0xc45e('0x5f')](_0xc84dba[_0xc45e('0x14')][_0x1273e8[_0x27a6c5][_0xc45e('0x24')]],_0x1273e8[_0x27a6c5]);}return _0xc84dba['campaigns'];};};Realtime[_0xc45e('0x3b')]['initFaxAccounts']=function(){var _0x3ee61d=this;return function(_0x5a20fc){if(_0x5a20fc){freeIsNotKey(_0x5a20fc,_0x3ee61d[_0xc45e('0x20')],'id');for(var _0xea9691=0x0,_0x1f2175={},_0x3d465d={};_0xea9691<_0x5a20fc[_0xc45e('0x3f')];_0xea9691+=0x1){_0x1f2175=_0x5a20fc[_0xea9691];if(_[_0xc45e('0x3d')](_0x3ee61d[_0xc45e('0x20')][_0x1f2175['id']])){_0x3ee61d['faxAccounts'][_0x1f2175['id']]=new FaxAccount(_0x1f2175);}else{_0x3ee61d[_0xc45e('0x3a')](_0x3ee61d[_0xc45e('0x20')][_0x1f2175['id']],_0x1f2175);}}}return _0x3ee61d[_0xc45e('0x20')];};};module[_0xc45e('0x60')]=Realtime; \ No newline at end of file +var _0x2f55=['queue','queuecallerexit','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallerleaveAt','outbound','disposition','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','merge','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks','initTriggers','initTemplates','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid'];(function(_0x1735da,_0x3996eb){var _0x185fb0=function(_0x2fd537){while(--_0x2fd537){_0x1735da['push'](_0x1735da['shift']());}};_0x185fb0(++_0x3996eb);}(_0x2f55,0x181));var _0x52f5=function(_0x56bd25,_0x438b58){_0x56bd25=_0x56bd25-0x0;var _0x53ccb9=_0x2f55[_0x56bd25];return _0x53ccb9;};'use strict';var BPromise=require(_0x52f5('0x0'));var util=require(_0x52f5('0x1'));var _=require(_0x52f5('0x2'));var moment=require(_0x52f5('0x3'));var Agent=require(_0x52f5('0x4'));var Telephone=require(_0x52f5('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x52f5('0x6'));var Trigger=require(_0x52f5('0x7'));var Template=require(_0x52f5('0x8'));var Campaign=require(_0x52f5('0x9'));var VoiceExtension=require(_0x52f5('0xa'));var ZendeskAccount=require(_0x52f5('0xb'));var SalesforceAccount=require(_0x52f5('0xc'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x52f5('0xd'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0x52f5('0xe'));var VtigerAccount=require(_0x52f5('0xf'));var FaxAccount=require(_0x52f5('0x10'));var Realtime=function(){this[_0x52f5('0x11')]={};this[_0x52f5('0x12')]={};this[_0x52f5('0x13')]={};this[_0x52f5('0x14')]={};this[_0x52f5('0x15')]={};this[_0x52f5('0x16')]={};this[_0x52f5('0x17')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x52f5('0x18')]={};this[_0x52f5('0x19')]={};this[_0x52f5('0x1a')]={};this[_0x52f5('0x1b')]={};this[_0x52f5('0x1c')]={};this['zendeskAccounts']={};this[_0x52f5('0x1d')]={};this[_0x52f5('0x1e')]={};this[_0x52f5('0x1f')]={};this[_0x52f5('0x20')]={};this[_0x52f5('0x21')]={};this[_0x52f5('0x22')]={};this[_0x52f5('0x23')]={};};function freeIsNotKey(_0x32c761,_0x2268fe,_0x2ee68b){var _0x60036c=_['mapKeys'](_0x32c761,function(_0x5c83e1,_0x4ad676){return _0x5c83e1[_0x2ee68b];});for(var _0x4ead99 in _0x2268fe){if(_0x2268fe[_0x52f5('0x24')](_0x4ead99)){if(!_0x60036c[_0x4ead99]){delete _0x2268fe[_0x4ead99];}}}}function freeIsNotKeySip(_0x3614de,_0x120067){var _0x4347b5=_['mapKeys'](_0x3614de,function(_0x1a3e9c,_0x5de99d){return util[_0x52f5('0x25')](_0x52f5('0x26'),_0x1a3e9c[_0x52f5('0x27')]);});for(var _0x16a0ab in _0x120067){if(_0x120067[_0x52f5('0x24')](_0x16a0ab)){if(!_0x4347b5[_0x16a0ab]){delete _0x120067[_0x16a0ab];}}}}function clearVoiceCallReports(_0x294ec3){_0x294ec3[_0x52f5('0x28')]=0x0;_0x294ec3[_0x52f5('0x29')]=0x0;_0x294ec3[_0x52f5('0x2a')]=0x0;_0x294ec3[_0x52f5('0x2b')]=0x0;_0x294ec3[_0x52f5('0x2c')]=0x0;}function clearCampaigns(_0x1d94f8){if(!_[_0x52f5('0x2d')](_0x1d94f8)){for(var _0x49bca2 in _0x1d94f8){if(_0x1d94f8[_0x52f5('0x24')](_0x49bca2)){_0x1d94f8[_0x49bca2]['ivrTotalCallsDays']=0x0;_0x1d94f8[_0x49bca2][_0x52f5('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x217c44){if(!_[_0x52f5('0x2d')](_0x217c44)){for(var _0x1aced7 in _0x217c44){if(_0x217c44['hasOwnProperty'](_0x1aced7)){_0x217c44[_0x1aced7]['total']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x29')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2f')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2a')]=0x0;_0x217c44[_0x1aced7]['sumDuration']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x2c')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x30')]=0x0;_0x217c44[_0x1aced7]['outboundNoAnswerCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundBusyCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundCongestionCallsDay']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x31')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x32')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x33')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x34')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x35')]=0x0;_0x217c44[_0x1aced7]['outboundOriginateFailureCallsDay']=0x0;_0x217c44[_0x1aced7]['outboundRejectCallsDay']=0x0;_0x217c44[_0x1aced7][_0x52f5('0x36')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x30')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x37')]=0x0;_0x217c44[_0x1aced7][_0x52f5('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x18fe55,_0x470794){for(var _0x1d3baf in _0x470794){if(_0x18fe55[_0x52f5('0x24')](_0x1d3baf)){_0x18fe55[_0x1d3baf]=_0x470794[_0x1d3baf];}}};Realtime[_0x52f5('0x39')][_0x52f5('0x3a')]=function(){var _0x11b20a=this;return function(_0xc69d1e){if(_0xc69d1e){freeIsNotKeySip(_0xc69d1e,_0x11b20a[_0x52f5('0x11')]);for(var _0x10ccab=0x0,_0x199186={},_0x318656={};_0x10ccab<_0xc69d1e[_0x52f5('0x3b')];_0x10ccab+=0x1){_0x199186=_0xc69d1e[_0x10ccab];if(_[_0x52f5('0x3c')](_0x11b20a[_0x52f5('0x11')][util[_0x52f5('0x25')]('SIP/%s',_0x199186['name'])])){_0x11b20a[_0x52f5('0x11')][util['format'](_0x52f5('0x26'),_0x199186[_0x52f5('0x27')])]=new Agent(_0x199186);}else{_0x11b20a[_0x52f5('0x3d')](_0x11b20a[_0x52f5('0x11')][util['format'](_0x52f5('0x26'),_0x199186[_0x52f5('0x27')])],_0x199186);}}}return _0x11b20a[_0x52f5('0x11')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x3e')]=function(){var _0x1c3db8=this;return function(_0x3b0498){if(_0x3b0498){freeIsNotKeySip(_0x3b0498,_0x1c3db8[_0x52f5('0x12')]);for(var _0x1076a0=0x0,_0x1c3d58={},_0xc7e778={};_0x1076a0<_0x3b0498['length'];_0x1076a0+=0x1){_0x1c3d58=_0x3b0498[_0x1076a0];if(_['isUndefined'](_0x1c3db8['telephones'][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x1c3d58[_0x52f5('0x27')])])){_0x1c3db8[_0x52f5('0x12')][util[_0x52f5('0x25')]('SIP/%s',_0x1c3d58[_0x52f5('0x27')])]=new Telephone(_0x1c3d58);}else{_0x1c3db8[_0x52f5('0x3d')](_0x1c3db8['telephones'][util['format'](_0x52f5('0x26'),_0x1c3d58[_0x52f5('0x27')])],_0x1c3d58);}}}return _0x1c3db8[_0x52f5('0x12')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x3f')]=function(){var _0x2f9ef1=this;return function(_0x6482fe){if(_0x6482fe){freeIsNotKeySip(_0x6482fe,_0x2f9ef1[_0x52f5('0x13')]);for(var _0x329349=0x0,_0x22db0c={},_0x52181f={};_0x329349<_0x6482fe[_0x52f5('0x3b')];_0x329349+=0x1){_0x22db0c=_0x6482fe[_0x329349];if(_[_0x52f5('0x3c')](_0x2f9ef1['trunks'][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])])){_0x2f9ef1[_0x52f5('0x13')][util['format'](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])]=new Trunk(_0x22db0c);}else{_0x2f9ef1['mergeFromDatabase'](_0x2f9ef1[_0x52f5('0x13')][util[_0x52f5('0x25')](_0x52f5('0x26'),_0x22db0c[_0x52f5('0x27')])],_0x22db0c);}}}return _0x2f9ef1['trunks'];};};Realtime[_0x52f5('0x39')]['initVoiceQueues']=function(){var _0x2c62f4=this;return function(_0x453fff){if(_0x453fff){freeIsNotKey(_0x453fff,_0x2c62f4['voiceQueues'],_0x52f5('0x27'));for(var _0x5d91a9=0x0,_0x4332f9={},_0x8fe128={};_0x5d91a9<_0x453fff['length'];_0x5d91a9+=0x1){_0x4332f9=_0x453fff[_0x5d91a9];if(_[_0x52f5('0x3c')](_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]])){_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]]=new VoiceQueue(_0x4332f9);}else{_0x2c62f4[_0x52f5('0x3d')](_0x2c62f4[_0x52f5('0x14')][_0x4332f9[_0x52f5('0x27')]],_0x4332f9);}}}return _0x2c62f4[_0x52f5('0x14')];};};Realtime['prototype'][_0x52f5('0x40')]=function(){var _0x1864d0=this;return function(_0x4ce947){if(_0x4ce947){freeIsNotKey(_0x4ce947,_0x1864d0['triggers'],'id');for(var _0x6a3458=0x0,_0x358eb3={},_0x59bbe7={};_0x6a3458<_0x4ce947[_0x52f5('0x3b')];_0x6a3458+=0x1){_0x358eb3=_0x4ce947[_0x6a3458];if(_['isUndefined'](_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']])){_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']]=new Trigger(_0x358eb3);}else{_0x1864d0[_0x52f5('0x3d')](_0x1864d0[_0x52f5('0x15')][_0x358eb3['id']],_0x358eb3);}}}return _0x1864d0['triggers'];};};Realtime[_0x52f5('0x39')][_0x52f5('0x41')]=function(){var _0x429614=this;return function(_0x1ee532){if(_0x1ee532){freeIsNotKey(_0x1ee532,_0x429614[_0x52f5('0x17')],'id');for(var _0xc18d2b=0x0,_0x5ce6f1={},_0x13f13e={};_0xc18d2b<_0x1ee532[_0x52f5('0x3b')];_0xc18d2b+=0x1){_0x5ce6f1=_0x1ee532[_0xc18d2b];if(_['isUndefined'](_0x429614['templates'][_0x5ce6f1['id']])){_0x429614[_0x52f5('0x17')][_0x5ce6f1['id']]=new Template(_0x5ce6f1);}else{_0x429614[_0x52f5('0x3d')](_0x429614[_0x52f5('0x17')][_0x5ce6f1['id']],_0x5ce6f1);}}}return _0x429614['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x3db8b7=this;return function(_0x3e3edd){if(_0x3e3edd){freeIsNotKey(_0x3e3edd,_0x3db8b7['zendeskAccounts'],'id');for(var _0x1d22d2=0x0,_0x1f9ad3={},_0x21cb6b={};_0x1d22d2<_0x3e3edd['length'];_0x1d22d2+=0x1){_0x1f9ad3=_0x3e3edd[_0x1d22d2];if(_['isUndefined'](_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']])){_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']]=new ZendeskAccount(_0x1f9ad3);}else{_0x3db8b7[_0x52f5('0x3d')](_0x3db8b7[_0x52f5('0x42')][_0x1f9ad3['id']],_0x1f9ad3);}}}return _0x3db8b7[_0x52f5('0x42')];};};Realtime['prototype'][_0x52f5('0x43')]=function(){var _0x13c958=this;return function(_0x4a6c2c){if(_0x4a6c2c){freeIsNotKey(_0x4a6c2c,_0x13c958[_0x52f5('0x1d')],'id');for(var _0x48c050=0x0,_0x318c3e={},_0x111423={};_0x48c050<_0x4a6c2c[_0x52f5('0x3b')];_0x48c050+=0x1){_0x318c3e=_0x4a6c2c[_0x48c050];if(_[_0x52f5('0x3c')](_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']])){_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']]=new SalesforceAccount(_0x318c3e);}else{_0x13c958[_0x52f5('0x3d')](_0x13c958[_0x52f5('0x1d')][_0x318c3e['id']],_0x318c3e);}}}return _0x13c958[_0x52f5('0x1d')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x44')]=function(){var _0x431dc3=this;return function(_0x310213){if(_0x310213){freeIsNotKey(_0x310213,_0x431dc3[_0x52f5('0x1f')],'id');for(var _0x281463=0x0,_0x59d693={},_0x3c969a={};_0x281463<_0x310213[_0x52f5('0x3b')];_0x281463+=0x1){_0x59d693=_0x310213[_0x281463];if(_[_0x52f5('0x3c')](_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']])){_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']]=new FreshdeskAccount(_0x59d693);}else{_0x431dc3['mergeFromDatabase'](_0x431dc3[_0x52f5('0x1f')][_0x59d693['id']],_0x59d693);}}}return _0x431dc3[_0x52f5('0x1f')];};};Realtime['prototype']['initZohoAccounts']=function(){var _0x182306=this;return function(_0x460719){if(_0x460719){freeIsNotKey(_0x460719,_0x182306[_0x52f5('0x20')],'id');for(var _0x12c378=0x0,_0xac4fca={},_0x5d855d={};_0x12c378<_0x460719[_0x52f5('0x3b')];_0x12c378+=0x1){_0xac4fca=_0x460719[_0x12c378];if(_['isUndefined'](_0x182306[_0x52f5('0x20')][_0xac4fca['id']])){_0x182306[_0x52f5('0x20')][_0xac4fca['id']]=new ZohoAccount(_0xac4fca);}else{_0x182306[_0x52f5('0x3d')](_0x182306[_0x52f5('0x20')][_0xac4fca['id']],_0xac4fca);}}}return _0x182306[_0x52f5('0x20')];};};Realtime['prototype'][_0x52f5('0x45')]=function(){var _0x273f36=this;return function(_0x1b62e3){if(_0x1b62e3){freeIsNotKey(_0x1b62e3,_0x273f36[_0x52f5('0x21')],'id');for(var _0x56e3fb=0x0,_0x3defcf={},_0x432189={};_0x56e3fb<_0x1b62e3[_0x52f5('0x3b')];_0x56e3fb+=0x1){_0x3defcf=_0x1b62e3[_0x56e3fb];if(_[_0x52f5('0x3c')](_0x273f36[_0x52f5('0x21')][_0x3defcf['id']])){_0x273f36['deskAccounts'][_0x3defcf['id']]=new DeskAccount(_0x3defcf);}else{_0x273f36[_0x52f5('0x3d')](_0x273f36[_0x52f5('0x21')][_0x3defcf['id']],_0x3defcf);}}}return _0x273f36['deskAccounts'];};};Realtime['prototype']['initSugarcrmAccounts']=function(){var _0x383488=this;return function(_0x49f835){if(_0x49f835){freeIsNotKey(_0x49f835,_0x383488[_0x52f5('0x1e')],'id');for(var _0x136e66=0x0,_0x3cf0df={},_0x84071a={};_0x136e66<_0x49f835[_0x52f5('0x3b')];_0x136e66+=0x1){_0x3cf0df=_0x49f835[_0x136e66];if(_[_0x52f5('0x3c')](_0x383488[_0x52f5('0x1e')][_0x3cf0df['id']])){_0x383488[_0x52f5('0x1e')][_0x3cf0df['id']]=new SugarcrmAccount(_0x3cf0df);}else{_0x383488[_0x52f5('0x3d')](_0x383488['sugarcrmAccounts'][_0x3cf0df['id']],_0x3cf0df);}}}return _0x383488[_0x52f5('0x1e')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x46')]=function(){var _0x4338e0=this;return function(_0x1aad46){if(_0x1aad46){freeIsNotKey(_0x1aad46,_0x4338e0[_0x52f5('0x22')],'id');for(var _0x41f596=0x0,_0x523e3a={},_0x227a5f={};_0x41f596<_0x1aad46[_0x52f5('0x3b')];_0x41f596+=0x1){_0x523e3a=_0x1aad46[_0x41f596];if(_[_0x52f5('0x3c')](_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']])){_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']]=new VtigerAccount(_0x523e3a);}else{_0x4338e0['mergeFromDatabase'](_0x4338e0[_0x52f5('0x22')][_0x523e3a['id']],_0x523e3a);}}}return _0x4338e0[_0x52f5('0x22')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x47')]=function(){var _0x2b4645=this;return function(_0x47dfe4){for(var _0x55685b=0x0;_0x55685b<_0x47dfe4['length'];_0x55685b+=0x1){_['merge'](_0x2b4645[_0x52f5('0x14')][_0x47dfe4[_0x55685b]['name']],_0x47dfe4[_0x55685b]);}return _0x2b4645[_0x52f5('0x14')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x48')]=function(){var _0xc39b1f=this;return function(_0x25ceb1){clearVoiceQueues(_0xc39b1f['voiceQueues']);if(_0x25ceb1){_0x25ceb1=_[_0x52f5('0x49')](_0x25ceb1,_0x52f5('0x4a'));for(var _0x46f0d7 in _0x25ceb1){if(_0x25ceb1['hasOwnProperty'](_0x46f0d7)){var _0x251237={};for(var _0x41cfdd=0x0;_0x41cfdd<_0x25ceb1[_0x46f0d7]['length'];_0x41cfdd+=0x1){var _0x54cefe=_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4b')];if(_0xc39b1f[_0x52f5('0x14')][_0x54cefe]){if(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4c')]){_0xc39b1f[_0x52f5('0x14')][_0x54cefe]['unmanaged']+=0x1;}_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2a')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd]['queuecallerleaveAt'])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4e')]),_0x52f5('0x4f'))||0x0;if(_0x41cfdd===_0x25ceb1[_0x46f0d7]['length']-0x1){_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2b')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x50')]||_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x51')]||_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x52')])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x4e')]),_0x52f5('0x4f'))||0x0;_0xc39b1f['voiceQueues'][_0x54cefe][_0x52f5('0x28')]+=0x1;if(_0x25ceb1[_0x46f0d7][_0x41cfdd]['queuecallercomplete']){_0xc39b1f['voiceQueues'][_0x54cefe]['answered']+=0x1;_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2c')]+=moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x50')])[_0x52f5('0x4d')](moment(_0x25ceb1[_0x46f0d7][_0x41cfdd][_0x52f5('0x53')]),'seconds')||0x0;}}else{_0xc39b1f[_0x52f5('0x14')][_0x54cefe]['sumDuration']+=_0xc39b1f[_0x52f5('0x14')][_0x54cefe][_0x52f5('0x2a')]||0x0;}}}}}}return _0xc39b1f[_0x52f5('0x14')];};};Realtime[_0x52f5('0x39')]['initVoiceCallReports']=function(){var _0x379c9f=this;return function(_0x2cf77f){clearVoiceCallReports(_0x379c9f['outbound']);if(_0x2cf77f){for(var _0x29465c=0x0;_0x29465c<_0x2cf77f[_0x52f5('0x3b')];_0x29465c+=0x1){_0x379c9f[_0x52f5('0x54')][_0x52f5('0x28')]+=0x1;_0x379c9f[_0x52f5('0x54')]['sumDuration']+=_0x2cf77f[_0x29465c]['duration'];if(_0x2cf77f[_0x29465c][_0x52f5('0x55')]==='ANSWERED'){_0x379c9f['outbound'][_0x52f5('0x29')]+=0x1;_0x379c9f[_0x52f5('0x54')]['sumHoldTime']+=_0x2cf77f[_0x29465c]['duration']-_0x2cf77f[_0x29465c][_0x52f5('0x56')]||0x0;_0x379c9f[_0x52f5('0x54')][_0x52f5('0x2c')]+=_0x2cf77f[_0x29465c][_0x52f5('0x56')];}}}return _0x379c9f[_0x52f5('0x54')];};};Realtime[_0x52f5('0x39')][_0x52f5('0x57')]=function(){var _0x170c49=this;return function(_0x42b0f1){if(_0x42b0f1){freeIsNotKey(_0x42b0f1,_0x170c49['campaigns'],_0x52f5('0x27'));for(var _0x50dafc=0x0,_0x20b08a={};_0x50dafc<_0x42b0f1[_0x52f5('0x3b')];_0x50dafc+=0x1){_0x20b08a=_0x42b0f1[_0x50dafc];if(_['isUndefined'](_0x170c49[_0x52f5('0x16')][_0x20b08a[_0x52f5('0x27')]])){_0x170c49['campaigns'][_0x20b08a[_0x52f5('0x27')]]=new Campaign(_0x20b08a);}else{_0x170c49[_0x52f5('0x3d')](_0x170c49[_0x52f5('0x16')][_0x20b08a['name']],_0x20b08a);}}}return _0x170c49[_0x52f5('0x16')];};};Realtime['prototype'][_0x52f5('0x58')]=function(){var _0x48c10c=this;return function(_0x2a9ee1){if(_0x2a9ee1){freeIsNotKey(_0x2a9ee1,_0x48c10c[_0x52f5('0x18')],'id');for(var _0x23f05f=0x0,_0x1fe497={};_0x23f05f<_0x2a9ee1[_0x52f5('0x3b')];_0x23f05f+=0x1){_0x1fe497=_0x2a9ee1[_0x23f05f];if(_[_0x52f5('0x3c')](_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']])){_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']]=new VoiceExtension(_0x1fe497);}else{_0x48c10c[_0x52f5('0x3d')](_0x48c10c[_0x52f5('0x18')][_0x1fe497['id']],_0x1fe497);}}}return _0x48c10c[_0x52f5('0x18')];};};Realtime['prototype'][_0x52f5('0x59')]=function(){var _0x3ba91e=this;return function(_0x356770){clearCampaigns(_0x3ba91e['campaigns']);for(var _0x1c0b95=0x0;_0x1c0b95<_0x356770[_0x52f5('0x3b')];_0x1c0b95+=0x1){_[_0x52f5('0x5a')](_0x3ba91e['campaigns'][_0x356770[_0x1c0b95][_0x52f5('0x27')]],_0x356770[_0x1c0b95]);}return _0x3ba91e[_0x52f5('0x16')];};};Realtime['prototype']['initFaxAccounts']=function(){var _0x3fdce3=this;return function(_0x199201){if(_0x199201){freeIsNotKey(_0x199201,_0x3fdce3[_0x52f5('0x23')],'id');for(var _0x33720b=0x0,_0x5e35ce={},_0x23997f={};_0x33720b<_0x199201[_0x52f5('0x3b')];_0x33720b+=0x1){_0x5e35ce=_0x199201[_0x33720b];if(_[_0x52f5('0x3c')](_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']])){_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']]=new FaxAccount(_0x5e35ce);}else{_0x3fdce3['mergeFromDatabase'](_0x3fdce3[_0x52f5('0x23')][_0x5e35ce['id']],_0x5e35ce);}}}return _0x3fdce3['faxAccounts'];};};module[_0x52f5('0x5b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2a8c796..3132d70 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 _0x50ba=['blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','queuecallercomplete','match','destination','type','dialer','queue','lastdata','context','from-voip-provider','accountcode','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','disposition','ANSWERED','connectedlinenum','format','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','filename','createdAt','create','length','exports','bluebird','moment','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','sync','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport'];(function(_0x1ddd23,_0x4fc35a){var _0x1d2f47=function(_0x532344){while(--_0x532344){_0x1ddd23['push'](_0x1ddd23['shift']());}};_0x1d2f47(++_0x4fc35a);}(_0x50ba,0x121));var _0xa50b=function(_0x4bcb3c,_0x192122){_0x4bcb3c=_0x4bcb3c-0x0;var _0xfe09bb=_0x50ba[_0x4bcb3c];return _0xfe09bb;};'use strict';var BPromise=require(_0xa50b('0x0'));var _=require('lodash');var moment=require(_0xa50b('0x1'));var util=require(_0xa50b('0x2'));var logger=require(_0xa50b('0x3'))(_0xa50b('0x4'));var ami=require(_0xa50b('0x5'));var RpcVoiceAgentReport=require(_0xa50b('0x6'));var RpcVoiceCallReport=require(_0xa50b('0x7'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xa50b('0x8'));var RpcVoiceRecording=require(_0xa50b('0x9'));var RpcVoiceTransferReport=require(_0xa50b('0xa'));var VoiceQueueReport=require(_0xa50b('0xb'));var VoiceCallReport=require(_0xa50b('0xc'));var VoiceAgentReport=require(_0xa50b('0xd'));var VoiceDialReport=require(_0xa50b('0xe'));var UserReport=require(_0xa50b('0xf'));function Report(_0x5e3879){this[_0xa50b('0x10')]=_0x5e3879;}Report['prototype'][_0xa50b('0x11')]=function(_0x1c899b){var _0xdafa50=new VoiceQueueReport(this[_0xa50b('0x10')]);var _0x2ee75f=new VoiceAgentReport(this[_0xa50b('0x10')]);var _0x172f4f=new VoiceDialReport(this[_0xa50b('0x10')]);var _0x21e453=new VoiceCallReport(this['realtime']);var _0x3f4ad9=new UserReport(this['realtime']);ami['on'](_0xa50b('0x12'),this[_0xa50b('0x13')][_0xa50b('0x14')](this));ami['on']('custom:voiceCallReport',this[_0xa50b('0x15')][_0xa50b('0x14')](this));ami['on'](_0xa50b('0x16'),this[_0xa50b('0x17')]['bind'](this));ami['on'](_0xa50b('0x18'),this[_0xa50b('0x19')][_0xa50b('0x14')](this));ami['on'](_0xa50b('0x1a'),this[_0xa50b('0x1b')][_0xa50b('0x14')](this));ami['on'](_0xa50b('0x1c'),this[_0xa50b('0x1d')][_0xa50b('0x14')](this));};Report[_0xa50b('0x1e')][_0xa50b('0x13')]=function(_0xee26cf){for(var _0x2f1b9c=0x0;_0x2f1b9c<_0xee26cf['length'];_0x2f1b9c+=0x1){if(_0xee26cf[_0x2f1b9c][_0xa50b('0x1f')]){RpcMemberReport[_0xa50b('0x13')](_0xee26cf[_0x2f1b9c]);}RpcVoiceQueueReport['create'](_0xee26cf[_0x2f1b9c]);}};function extractCalleridNumber(_0x1f1efc){var _0x5668ee=_0x1f1efc[_0xa50b('0x20')](/<(.*?)>/);return _0x5668ee?_0x5668ee[0x1]:_0x1f1efc;}Report[_0xa50b('0x1e')][_0xa50b('0x15')]=function(_0x11c241){_0x11c241['destination']=_0x11c241[_0xa50b('0x21')]||_0x11c241['exten'];if(_0x11c241[_0xa50b('0x22')]==_0xa50b('0x23')){_0x11c241['lastapplication']=_0xa50b('0x24');_0x11c241[_0xa50b('0x25')]=_0x11c241[_0xa50b('0x24')];if(_0x11c241[_0xa50b('0x26')]==_0xa50b('0x27')){_0x11c241[_0xa50b('0x28')]='';_0x11c241[_0xa50b('0x21')]=extractCalleridNumber(_0x11c241['callerid']);}else if(_0x11c241[_0xa50b('0x26')]==_0xa50b('0x29')){if(_0x11c241['destination']==_0xa50b('0x2a')){_0x11c241[_0xa50b('0x21')]=extractCalleridNumber(_0x11c241[_0xa50b('0x2b')]);_0x11c241[_0xa50b('0x2c')]=_0x11c241[_0xa50b('0x2d')];_0x11c241[_0xa50b('0x2e')]=[_0x11c241[_0xa50b('0x2f')],_0x11c241['channel']=_0x11c241[_0xa50b('0x2e')]][0x0];_0x11c241[_0xa50b('0x30')]=_0x11c241[_0xa50b('0x2b')];}else{_0x11c241[_0xa50b('0x21')]=_0x11c241[_0xa50b('0x2c')];_0x11c241[_0xa50b('0x2c')]=_0x11c241['originatecalleridnum'];if(_0x11c241[_0xa50b('0x31')]==_0xa50b('0x32')){_0x11c241['accountcode']=_0x11c241[_0xa50b('0x33')];}else{_0x11c241[_0xa50b('0x28')]='';}}}}else{_0x11c241[_0xa50b('0x30')]=util[_0xa50b('0x34')](_0xa50b('0x35'),_0x11c241[_0xa50b('0x36')],_0x11c241[_0xa50b('0x2c')]);}if(_0x11c241[_0xa50b('0x37')]){for(var _0x7e492d=0x0;_0x7e492d<_0x11c241[_0xa50b('0x38')]['length'];_0x7e492d+=0x1){_0x11c241[_0xa50b('0x39')]=_0x11c241[_0xa50b('0x38')][_0x7e492d][_0xa50b('0x3a')];_0x11c241['createdAt']=_0x11c241[_0xa50b('0x38')][_0x7e492d][_0xa50b('0x3b')];RpcVoiceRecording[_0xa50b('0x3c')](_0x11c241);}}RpcVoiceCallReport[_0xa50b('0x3c')](_0x11c241);};Report['prototype'][_0xa50b('0x17')]=function(_0x47493c){for(var _0x58f1e8=0x0;_0x58f1e8<_0x47493c[_0xa50b('0x3d')];_0x58f1e8+=0x1){RpcVoiceAgentReport[_0xa50b('0x3c')](_0x47493c[_0x58f1e8]);}};Report[_0xa50b('0x1e')][_0xa50b('0x19')]=function(_0x51bba6){RpcVoiceDialReport[_0xa50b('0x3c')](_0x51bba6);RpcMemberReport[_0xa50b('0x19')](_0x51bba6);};Report['prototype'][_0xa50b('0x1b')]=function(_0x3730ce){RpcVoiceTransferReport[_0xa50b('0x1b')](_0x3730ce);};Report['prototype'][_0xa50b('0x1d')]=function(_0x5b5155){RpcVoiceTransferReport[_0xa50b('0x1d')](_0x5b5155);};module[_0xa50b('0x3e')]=Report; \ No newline at end of file +var _0x6dda=['destinationchannel','channel','disposition','ANSWERED','connectedlinenum','callerid','monitor','monitorFilename','monitors','createdAt','create','blindTransfer','exports','lodash','util','../../../config/logger','ami','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./userReport','realtime','prototype','sync','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','length','match','destination','exten','dialer','queue','lastdata','context','from-voip-provider','accountcode','calleridpreview','calleridnum','originatecalleridnum'];(function(_0x10e7dc,_0x107f01){var _0x32d917=function(_0x232f61){while(--_0x232f61){_0x10e7dc['push'](_0x10e7dc['shift']());}};_0x32d917(++_0x107f01);}(_0x6dda,0x179));var _0xa6dd=function(_0x32aec7,_0x28e7a4){_0x32aec7=_0x32aec7-0x0;var _0x2dc053=_0x6dda[_0x32aec7];return _0x2dc053;};'use strict';var BPromise=require('bluebird');var _=require(_0xa6dd('0x0'));var moment=require('moment');var util=require(_0xa6dd('0x1'));var logger=require(_0xa6dd('0x2'))(_0xa6dd('0x3'));var ami=require(_0xa6dd('0x4'));var RpcVoiceAgentReport=require(_0xa6dd('0x5'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa6dd('0x6'));var RpcMemberReport=require(_0xa6dd('0x7'));var RpcVoiceQueueReport=require(_0xa6dd('0x8'));var RpcVoiceRecording=require(_0xa6dd('0x9'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xa6dd('0xa'));var VoiceCallReport=require(_0xa6dd('0xb'));var VoiceAgentReport=require(_0xa6dd('0xc'));var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xa6dd('0xd'));function Report(_0xef765b){this[_0xa6dd('0xe')]=_0xef765b;}Report[_0xa6dd('0xf')][_0xa6dd('0x10')]=function(_0x201001){var _0x5de9a0=new VoiceQueueReport(this[_0xa6dd('0xe')]);var _0xfe2ee9=new VoiceAgentReport(this[_0xa6dd('0xe')]);var _0x484728=new VoiceDialReport(this[_0xa6dd('0xe')]);var _0x136860=new VoiceCallReport(this[_0xa6dd('0xe')]);var _0x2f8058=new UserReport(this[_0xa6dd('0xe')]);ami['on']('custom:voiceQueueReport',this[_0xa6dd('0x11')][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x13'),this[_0xa6dd('0x14')][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x15'),this['voiceAgentReport'][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x16'),this[_0xa6dd('0x17')][_0xa6dd('0x12')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xa6dd('0x12')](this));ami['on'](_0xa6dd('0x18'),this[_0xa6dd('0x19')]['bind'](this));};Report[_0xa6dd('0xf')][_0xa6dd('0x11')]=function(_0x25e1bf){for(var _0x1d8afa=0x0;_0x1d8afa<_0x25e1bf[_0xa6dd('0x1a')];_0x1d8afa+=0x1){if(_0x25e1bf[_0x1d8afa]['queuecallercomplete']){RpcMemberReport[_0xa6dd('0x11')](_0x25e1bf[_0x1d8afa]);}RpcVoiceQueueReport['create'](_0x25e1bf[_0x1d8afa]);}};function extractCalleridNumber(_0x3107e9){var _0x5d333a=_0x3107e9[_0xa6dd('0x1b')](/<(.*?)>/);return _0x5d333a?_0x5d333a[0x1]:_0x3107e9;}Report['prototype'][_0xa6dd('0x14')]=function(_0x4d5862){_0x4d5862[_0xa6dd('0x1c')]=_0x4d5862['destination']||_0x4d5862[_0xa6dd('0x1d')];if(_0x4d5862['type']==_0xa6dd('0x1e')){_0x4d5862['lastapplication']=_0xa6dd('0x1f');_0x4d5862[_0xa6dd('0x20')]=_0x4d5862['queue'];if(_0x4d5862[_0xa6dd('0x21')]==_0xa6dd('0x22')){_0x4d5862[_0xa6dd('0x23')]='';_0x4d5862[_0xa6dd('0x1c')]=extractCalleridNumber(_0x4d5862['callerid']);}else if(_0x4d5862['context']=='from-sip'){if(_0x4d5862[_0xa6dd('0x1c')]=='xcally-motion-preview'){_0x4d5862['destination']=extractCalleridNumber(_0x4d5862[_0xa6dd('0x24')]);_0x4d5862[_0xa6dd('0x25')]=_0x4d5862[_0xa6dd('0x26')];_0x4d5862[_0xa6dd('0x27')]=[_0x4d5862[_0xa6dd('0x28')],_0x4d5862[_0xa6dd('0x28')]=_0x4d5862[_0xa6dd('0x27')]][0x0];_0x4d5862['callerid']=_0x4d5862[_0xa6dd('0x24')];}else{_0x4d5862[_0xa6dd('0x1c')]=_0x4d5862[_0xa6dd('0x25')];_0x4d5862['calleridnum']=_0x4d5862[_0xa6dd('0x26')];if(_0x4d5862[_0xa6dd('0x29')]==_0xa6dd('0x2a')){_0x4d5862['accountcode']=_0x4d5862[_0xa6dd('0x2b')];}else{_0x4d5862['accountcode']='';}}}}else{_0x4d5862[_0xa6dd('0x2c')]=util['format']('\x22%s\x22\x20<%s>',_0x4d5862['calleridname'],_0x4d5862[_0xa6dd('0x25')]);}if(_0x4d5862[_0xa6dd('0x2d')]){for(var _0x4cad14=0x0;_0x4cad14<_0x4d5862['monitors'][_0xa6dd('0x1a')];_0x4cad14+=0x1){_0x4d5862[_0xa6dd('0x2e')]=_0x4d5862[_0xa6dd('0x2f')][_0x4cad14]['filename'];_0x4d5862[_0xa6dd('0x30')]=_0x4d5862[_0xa6dd('0x2f')][_0x4cad14]['createdAt'];RpcVoiceRecording[_0xa6dd('0x31')](_0x4d5862);}}RpcVoiceCallReport[_0xa6dd('0x31')](_0x4d5862);};Report['prototype']['voiceAgentReport']=function(_0x5944e9){for(var _0x1d73d8=0x0;_0x1d73d8<_0x5944e9[_0xa6dd('0x1a')];_0x1d73d8+=0x1){RpcVoiceAgentReport['create'](_0x5944e9[_0x1d73d8]);}};Report[_0xa6dd('0xf')][_0xa6dd('0x17')]=function(_0x499f09){RpcVoiceDialReport[_0xa6dd('0x31')](_0x499f09);RpcMemberReport['voiceDialReport'](_0x499f09);};Report[_0xa6dd('0xf')][_0xa6dd('0x32')]=function(_0x516708){RpcVoiceTransferReport[_0xa6dd('0x32')](_0x516708);};Report[_0xa6dd('0xf')][_0xa6dd('0x19')]=function(_0x57790a){RpcVoiceTransferReport[_0xa6dd('0x19')](_0x57790a);};module[_0xa6dd('0x33')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 9690073..72cc23d 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b57=['trunks','telephones','syncRegistry','registry','bind','devicestatechange','syncDeviceState','syncPeerStatus','loopSyncRealTimeShow','resolve','then','actionSipShowRegistry','actionSipPeerStatus','catch','[loopSyncRealTimeShow]','prototype','actionDeviceStateList','isNotNull','emit','find','username','stateRegistry','merge','omit','event','state','name','trunk:save','error','inspect','agents','device','local','inuse','toLowerCase','stateTime','toNumber','updateStatusRealtime','format','telephone:%s','trunk:%s','startsWith','Queue','Local','substring','indexOf','accountcode','[syncDeviceState][UserReport]','peerstatus','peer','registered','status','address','telephone:save','[syncPeerStatus][UserReport]','exports','lodash','bluebird','util','../../../config/logger','ami','socket.io-emitter','localhost'];(function(_0x5e4e74,_0x53b7a5){var _0x217a4a=function(_0x2fbf98){while(--_0x2fbf98){_0x5e4e74['push'](_0x5e4e74['shift']());}};_0x217a4a(++_0x53b7a5);}(_0x5b57,0xf5));var _0x75b5=function(_0x4ba564,_0x35ae13){_0x4ba564=_0x4ba564-0x0;var _0x119c31=_0x5b57[_0x4ba564];return _0x119c31;};'use strict';var _=require(_0x75b5('0x0'));var moment=require('moment');var BPromise=require(_0x75b5('0x1'));var util=require(_0x75b5('0x2'));var logger=require(_0x75b5('0x3'))(_0x75b5('0x4'));var ami=require('../ami');var io=require(_0x75b5('0x5'))({'host':_0x75b5('0x6'),'port':0x18eb});function UserReport(_0x236265){this[_0x75b5('0x7')]=_0x236265[_0x75b5('0x7')];this['agents']=_0x236265['agents'];this[_0x75b5('0x8')]=_0x236265[_0x75b5('0x8')];ami['on']('registryentry',this[_0x75b5('0x9')]['bind'](this));ami['on'](_0x75b5('0xa'),this[_0x75b5('0x9')][_0x75b5('0xb')](this));ami['on'](_0x75b5('0xc'),this[_0x75b5('0xd')][_0x75b5('0xb')](this));ami['on']('peerstatus',this[_0x75b5('0xe')][_0x75b5('0xb')](this));this[_0x75b5('0xf')]();return BPromise[_0x75b5('0x10')]()[_0x75b5('0x11')](ami[_0x75b5('0x12')]())[_0x75b5('0x11')](ami['actionDeviceStateList']())['then'](ami[_0x75b5('0x13')]())[_0x75b5('0x14')](loggerCatch(_0x75b5('0x15')));}function loggerCatch(_0x572d85){return function(_0x1f08bf){logger['error'](_0x572d85,util['inspect'](_0x1f08bf,{'showHidden':![],'depth':null}));};}UserReport[_0x75b5('0x16')][_0x75b5('0xf')]=function(){setInterval(function(){BPromise[_0x75b5('0x10')]()[_0x75b5('0x11')](ami[_0x75b5('0x12')]())['then'](ami[_0x75b5('0x17')]())[_0x75b5('0x11')](ami['actionSipPeerStatus']())[_0x75b5('0x14')](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport['prototype'][_0x75b5('0x18')]=function(_0x5eb23e){return _0x5eb23e!==null&&!_['isUndefined'](_0x5eb23e);};UserReport['prototype'][_0x75b5('0x19')]=function(_0x5270cb,_0x206778,_0x2c8391){io['to'](_0x5270cb)['emit'](_0x206778,_0x2c8391);};UserReport[_0x75b5('0x16')][_0x75b5('0x9')]=function(_0x2701f5){try{if(this[_0x75b5('0x18')](_0x2701f5)){var _0x51e44c=_[_0x75b5('0x1a')](this[_0x75b5('0x7')],{'registry':_0x2701f5[_0x75b5('0x1b')]});if(_0x51e44c){_0x2701f5[_0x75b5('0x1c')]=_0x2701f5['state'];_[_0x75b5('0x1d')](_0x51e44c,_[_0x75b5('0x1e')](_0x2701f5,[_0x75b5('0x1f'),'actionid',_0x75b5('0x1b'),_0x75b5('0x20')]));this[_0x75b5('0x19')](util['format']('trunk:%s',_0x51e44c[_0x75b5('0x21')]),_0x75b5('0x22'),_0x51e44c);}}}catch(_0x486c92){logger[_0x75b5('0x23')]('[syncRegistry][UserReport]',util[_0x75b5('0x24')](_0x486c92,{'showHidden':![],'depth':null}));}};UserReport[_0x75b5('0x16')][_0x75b5('0xd')]=function(_0x31d6e6){try{if(this[_0x75b5('0x18')](_0x31d6e6)){if(this['agents'][_0x31d6e6['device']]){if(!this[_0x75b5('0x25')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x27')]||_0x31d6e6[_0x75b5('0x20')]['toLowerCase']()==_0x75b5('0x28')){this[_0x75b5('0x25')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x27')]=![];if(this[_0x75b5('0x25')][_0x31d6e6['device']]['state']!==_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]()){this['agents'][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x2a')]=_[_0x75b5('0x2b')](moment()['format']('x'));}this['agents'][_0x31d6e6[_0x75b5('0x26')]]['state']=_0x31d6e6['state'][_0x75b5('0x29')]();this['agents'][_0x31d6e6['device']][_0x75b5('0x2c')](_0x31d6e6);}}else if(this[_0x75b5('0x8')][_0x31d6e6[_0x75b5('0x26')]]){if(this[_0x75b5('0x8')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x20')]!==_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]()){this['telephones'][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x2a')]=_[_0x75b5('0x2b')](moment()[_0x75b5('0x2d')]('x'));}this[_0x75b5('0x8')][_0x31d6e6['device']][_0x75b5('0x20')]=_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]();this[_0x75b5('0x19')](util[_0x75b5('0x2d')](_0x75b5('0x2e'),this[_0x75b5('0x8')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x21')]),'telephone:save',this[_0x75b5('0x8')][_0x31d6e6['device']]);}else if(this[_0x75b5('0x7')][_0x31d6e6[_0x75b5('0x26')]]){if(this[_0x75b5('0x7')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x20')]!==_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]()){this[_0x75b5('0x7')][_0x31d6e6['device']][_0x75b5('0x2a')]=_['toNumber'](moment()[_0x75b5('0x2d')]('x'));}this[_0x75b5('0x7')][_0x31d6e6[_0x75b5('0x26')]][_0x75b5('0x20')]=_0x31d6e6['state'][_0x75b5('0x29')]();this[_0x75b5('0x19')](util[_0x75b5('0x2d')](_0x75b5('0x2f'),this['trunks'][_0x31d6e6['device']][_0x75b5('0x21')]),_0x75b5('0x22'),this[_0x75b5('0x7')][_0x31d6e6[_0x75b5('0x26')]]);}else if(_[_0x75b5('0x30')](_0x31d6e6[_0x75b5('0x26')],_0x75b5('0x31'))){}else if(_[_0x75b5('0x30')](_0x31d6e6[_0x75b5('0x26')],_0x75b5('0x32'))){var _0x4a24de=_0x31d6e6['device'];var _0x55b235=_0x4a24de[_0x75b5('0x33')](_0x4a24de[_0x75b5('0x34')]('/')+0x1,_0x4a24de['indexOf']('@'));var _0x550437=_[_0x75b5('0x1a')](this['agents'],function(_0x2dcdd9){return _0x2dcdd9['mobile']==_0x55b235||_0x2dcdd9['phone']==_0x55b235||_0x2dcdd9[_0x75b5('0x35')]==_0x55b235;});if(_0x550437){if(_0x550437[_0x75b5('0x20')]!==_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]()){_0x550437[_0x75b5('0x2a')]=_[_0x75b5('0x2b')](moment()[_0x75b5('0x2d')]('x'));}_0x550437[_0x75b5('0x20')]=_0x31d6e6[_0x75b5('0x20')][_0x75b5('0x29')]();_0x550437[_0x75b5('0x27')]=!![];_0x550437[_0x75b5('0x2c')](_0x31d6e6);}}else{}}}catch(_0x57166f){logger['error'](_0x75b5('0x36'),util[_0x75b5('0x24')](_0x57166f,{'showHidden':![],'depth':null}));}};UserReport[_0x75b5('0x16')][_0x75b5('0xe')]=function(_0x4a6782){try{if(this['isNotNull'](_0x4a6782)&&this[_0x75b5('0x18')](_0x4a6782[_0x75b5('0x37')])){if(this[_0x75b5('0x25')][_0x4a6782[_0x75b5('0x38')]]){if(!this[_0x75b5('0x25')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x27')]||_0x4a6782['peerstatus']['toLowerCase']()==_0x75b5('0x39')){this['agents'][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x27')]=![];this[_0x75b5('0x25')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x3a')]=_0x4a6782[_0x75b5('0x37')][_0x75b5('0x29')]();this[_0x75b5('0x25')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x3b')]=_0x4a6782['address'];this['agents'][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x2c')](_0x4a6782);}}else if(this[_0x75b5('0x8')][_0x4a6782['peer']]){this['telephones'][_0x4a6782[_0x75b5('0x38')]]['status']=_0x4a6782[_0x75b5('0x37')][_0x75b5('0x29')]();this[_0x75b5('0x8')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x3b')]=_0x4a6782['address'];this['emit'](util[_0x75b5('0x2d')]('telephone:%s',this[_0x75b5('0x8')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x21')]),_0x75b5('0x3c'),this[_0x75b5('0x8')][_0x4a6782[_0x75b5('0x38')]]);}else if(this[_0x75b5('0x7')][_0x4a6782['peer']]){this[_0x75b5('0x7')][_0x4a6782['peer']][_0x75b5('0x3a')]=_0x4a6782[_0x75b5('0x37')][_0x75b5('0x29')]();this['trunks'][_0x4a6782['peer']][_0x75b5('0x3b')]=_0x4a6782['address'];this[_0x75b5('0x19')](util['format'](_0x75b5('0x2f'),this[_0x75b5('0x7')][_0x4a6782[_0x75b5('0x38')]][_0x75b5('0x21')]),_0x75b5('0x22'),this[_0x75b5('0x7')][_0x4a6782[_0x75b5('0x38')]]);}else{}}}catch(_0x3972a5){logger['error'](_0x75b5('0x3d'),util[_0x75b5('0x24')](_0x3972a5,{'showHidden':![],'depth':null}));}};module[_0x75b5('0x3e')]=UserReport; \ No newline at end of file +var _0x513d=['startsWith','Local','substring','indexOf','phone','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','exports','lodash','moment','bluebird','util','../../../config/logger','ami','../ami','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','loopSyncRealTimeShow','then','actionSipPeerStatus','error','inspect','resolve','actionDeviceStateList','prototype','isNotNull','isUndefined','find','username','stateRegistry','state','merge','event','emit','format','trunk:%s','name','trunk:save','[syncRegistry][UserReport]','device','local','toLowerCase','inuse','toNumber','stateTime','telephone:%s','telephone:save','Queue'];(function(_0x284506,_0x191316){var _0x1e9ee5=function(_0xe7eaa){while(--_0xe7eaa){_0x284506['push'](_0x284506['shift']());}};_0x1e9ee5(++_0x191316);}(_0x513d,0x1b7));var _0xd513=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x513d[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0xd513('0x0'));var moment=require(_0xd513('0x1'));var BPromise=require(_0xd513('0x2'));var util=require(_0xd513('0x3'));var logger=require(_0xd513('0x4'))(_0xd513('0x5'));var ami=require(_0xd513('0x6'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function UserReport(_0x4dad65){this['trunks']=_0x4dad65[_0xd513('0x7')];this['agents']=_0x4dad65[_0xd513('0x8')];this[_0xd513('0x9')]=_0x4dad65[_0xd513('0x9')];ami['on'](_0xd513('0xa'),this[_0xd513('0xb')][_0xd513('0xc')](this));ami['on'](_0xd513('0xd'),this[_0xd513('0xb')][_0xd513('0xc')](this));ami['on'](_0xd513('0xe'),this[_0xd513('0xf')]['bind'](this));ami['on'](_0xd513('0x10'),this[_0xd513('0x11')][_0xd513('0xc')](this));this[_0xd513('0x12')]();return BPromise['resolve']()[_0xd513('0x13')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xd513('0x13')](ami[_0xd513('0x14')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5d9515){return function(_0x110e17){logger[_0xd513('0x15')](_0x5d9515,util[_0xd513('0x16')](_0x110e17,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xd513('0x12')]=function(){setInterval(function(){BPromise[_0xd513('0x17')]()[_0xd513('0x13')](ami['actionSipShowRegistry']())[_0xd513('0x13')](ami[_0xd513('0x18')]())[_0xd513('0x13')](ami['actionSipPeerStatus']())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xd513('0x19')][_0xd513('0x1a')]=function(_0x3d3048){return _0x3d3048!==null&&!_[_0xd513('0x1b')](_0x3d3048);};UserReport[_0xd513('0x19')]['emit']=function(_0x2a8186,_0x2a0b1c,_0x5a54aa){io['to'](_0x2a8186)['emit'](_0x2a0b1c,_0x5a54aa);};UserReport[_0xd513('0x19')][_0xd513('0xb')]=function(_0x2c2a66){try{if(this[_0xd513('0x1a')](_0x2c2a66)){var _0x53aad7=_[_0xd513('0x1c')](this[_0xd513('0x7')],{'registry':_0x2c2a66[_0xd513('0x1d')]});if(_0x53aad7){_0x2c2a66[_0xd513('0x1e')]=_0x2c2a66[_0xd513('0x1f')];_[_0xd513('0x20')](_0x53aad7,_['omit'](_0x2c2a66,[_0xd513('0x21'),'actionid',_0xd513('0x1d'),_0xd513('0x1f')]));this[_0xd513('0x22')](util[_0xd513('0x23')](_0xd513('0x24'),_0x53aad7[_0xd513('0x25')]),_0xd513('0x26'),_0x53aad7);}}}catch(_0x526a32){logger[_0xd513('0x15')](_0xd513('0x27'),util[_0xd513('0x16')](_0x526a32,{'showHidden':![],'depth':null}));}};UserReport[_0xd513('0x19')]['syncDeviceState']=function(_0x1ecd59){try{if(this[_0xd513('0x1a')](_0x1ecd59)){if(this[_0xd513('0x8')][_0x1ecd59[_0xd513('0x28')]]){if(!this['agents'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x29')]||_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()==_0xd513('0x2b')){this[_0xd513('0x8')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x29')]=![];if(this[_0xd513('0x8')][_0x1ecd59['device']][_0xd513('0x1f')]!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){this['agents'][_0x1ecd59[_0xd513('0x28')]]['stateTime']=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}this[_0xd513('0x8')][_0x1ecd59['device']][_0xd513('0x1f')]=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();this['agents'][_0x1ecd59[_0xd513('0x28')]]['updateStatusRealtime'](_0x1ecd59);}}else if(this['telephones'][_0x1ecd59[_0xd513('0x28')]]){if(this['telephones'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x1f')]!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x2d')]=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}this[_0xd513('0x9')][_0x1ecd59['device']]['state']=_0x1ecd59[_0xd513('0x1f')]['toLowerCase']();this[_0xd513('0x22')](util['format'](_0xd513('0x2e'),this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x25')]),_0xd513('0x2f'),this[_0xd513('0x9')][_0x1ecd59[_0xd513('0x28')]]);}else if(this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]]){if(this['trunks'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x1f')]!==_0x1ecd59['state'][_0xd513('0x2a')]()){this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x2d')]=_['toNumber'](moment()[_0xd513('0x23')]('x'));}this['trunks'][_0x1ecd59[_0xd513('0x28')]]['state']=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();this['emit'](util[_0xd513('0x23')](_0xd513('0x24'),this['trunks'][_0x1ecd59[_0xd513('0x28')]][_0xd513('0x25')]),'trunk:save',this[_0xd513('0x7')][_0x1ecd59[_0xd513('0x28')]]);}else if(_['startsWith'](_0x1ecd59[_0xd513('0x28')],_0xd513('0x30'))){}else if(_[_0xd513('0x31')](_0x1ecd59[_0xd513('0x28')],_0xd513('0x32'))){var _0xf57a09=_0x1ecd59[_0xd513('0x28')];var _0x210e4c=_0xf57a09[_0xd513('0x33')](_0xf57a09[_0xd513('0x34')]('/')+0x1,_0xf57a09[_0xd513('0x34')]('@'));var _0x142438=_['find'](this[_0xd513('0x8')],function(_0x623e59){return _0x623e59['mobile']==_0x210e4c||_0x623e59[_0xd513('0x35')]==_0x210e4c||_0x623e59[_0xd513('0x36')]==_0x210e4c;});if(_0x142438){if(_0x142438['state']!==_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]()){_0x142438[_0xd513('0x2d')]=_[_0xd513('0x2c')](moment()[_0xd513('0x23')]('x'));}_0x142438[_0xd513('0x1f')]=_0x1ecd59[_0xd513('0x1f')][_0xd513('0x2a')]();_0x142438[_0xd513('0x29')]=!![];_0x142438['updateStatusRealtime'](_0x1ecd59);}}else{}}}catch(_0x36286f){logger[_0xd513('0x15')](_0xd513('0x37'),util[_0xd513('0x16')](_0x36286f,{'showHidden':![],'depth':null}));}};UserReport[_0xd513('0x19')][_0xd513('0x11')]=function(_0xf7ac90){try{if(this['isNotNull'](_0xf7ac90)&&this['isNotNull'](_0xf7ac90[_0xd513('0x10')])){if(this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]]){if(!this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]]['local']||_0xf7ac90[_0xd513('0x10')][_0xd513('0x2a')]()==_0xd513('0x39')){this['agents'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x29')]=![];this[_0xd513('0x8')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3a')]=_0xf7ac90[_0xd513('0x10')][_0xd513('0x2a')]();this[_0xd513('0x8')][_0xf7ac90['peer']][_0xd513('0x3b')]=_0xf7ac90[_0xd513('0x3b')];this['agents'][_0xf7ac90[_0xd513('0x38')]]['updateStatusRealtime'](_0xf7ac90);}}else if(this[_0xd513('0x9')][_0xf7ac90['peer']]){this['telephones'][_0xf7ac90['peer']]['status']=_0xf7ac90[_0xd513('0x10')]['toLowerCase']();this['telephones'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3b')]=_0xf7ac90['address'];this[_0xd513('0x22')](util[_0xd513('0x23')](_0xd513('0x2e'),this['telephones'][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x25')]),_0xd513('0x2f'),this[_0xd513('0x9')][_0xf7ac90[_0xd513('0x38')]]);}else if(this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]]){this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]]['status']=_0xf7ac90[_0xd513('0x10')]['toLowerCase']();this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x3b')]=_0xf7ac90[_0xd513('0x3b')];this['emit'](util[_0xd513('0x23')]('trunk:%s',this[_0xd513('0x7')][_0xf7ac90[_0xd513('0x38')]][_0xd513('0x25')]),'trunk:save',this['trunks'][_0xf7ac90['peer']]);}else{}}}catch(_0x179076){logger[_0xd513('0x15')]('[syncPeerStatus][UserReport]',util[_0xd513('0x16')](_0x179076,{'showHidden':![],'depth':null}));}};module[_0xd513('0x3c')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index dd08d0b..e5c110f 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d64=['lodash','moment','util','../../../config/logger','ami','socket.io-emitter','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','called','queue','type','merge','event','privilege','custom:agentcalled','membername','error','inspect','hasOwnProperty','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','destconnectedlinenum','user:%s','custom:agentconnect','agentringnoanswerAt','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','reason','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','abandoned','custom:agentqueuecallerabandon','[syncQueueCallerAbandon][VoiceAgentReport]','agentcomplete','agentcompleteAt','complete','talktime','agentacw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','syncVarSet','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','includes','custom:voiceAgentReport','values','[syncHangup][VoiceAgentReport]','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]'];(function(_0x31db4f,_0x13f0e9){var _0x3acad5=function(_0x227a29){while(--_0x227a29){_0x31db4f['push'](_0x31db4f['shift']());}};_0x3acad5(++_0x13f0e9);}(_0x0d64,0x6a));var _0x40d6=function(_0x481471,_0x26356b){_0x481471=_0x481471-0x0;var _0x1e92e0=_0x0d64[_0x481471];return _0x1e92e0;};'use strict';var _=require(_0x40d6('0x0'));var moment=require(_0x40d6('0x1'));var util=require(_0x40d6('0x2'));var logger=require(_0x40d6('0x3'))(_0x40d6('0x4'));var ami=require('../ami');var io=require(_0x40d6('0x5'))({'host':_0x40d6('0x6'),'port':0x18eb});function VoiceAgentReport(_0x3a45d3){this[_0x40d6('0x7')]={};this[_0x40d6('0x8')]=_0x3a45d3[_0x40d6('0x8')];this[_0x40d6('0x9')]=_0x3a45d3[_0x40d6('0x9')];this[_0x40d6('0xa')]={};ami['on'](_0x40d6('0xb'),this[_0x40d6('0xc')][_0x40d6('0xd')](this));ami['on'](_0x40d6('0xe'),this[_0x40d6('0xf')][_0x40d6('0xd')](this));ami['on'](_0x40d6('0x10'),this[_0x40d6('0x11')][_0x40d6('0xd')](this));ami['on'](_0x40d6('0x12'),this[_0x40d6('0x13')]['bind'](this));ami['on']('agentcomplete',this[_0x40d6('0x14')][_0x40d6('0xd')](this));ami['on'](_0x40d6('0x15'),this['syncVarSet']['bind'](this));ami['on'](_0x40d6('0x16'),this[_0x40d6('0x17')][_0x40d6('0xd')](this));ami['on']('musiconholdstart',this[_0x40d6('0x18')][_0x40d6('0xd')](this));ami['on'](_0x40d6('0x19'),this[_0x40d6('0x1a')][_0x40d6('0xd')](this));}VoiceAgentReport[_0x40d6('0x1b')]['emit']=function(_0x511c02,_0x152c79,_0x225c72){io['to'](_0x511c02)[_0x40d6('0x1c')](_0x152c79,_0x225c72);};VoiceAgentReport['prototype'][_0x40d6('0x1d')]=function(_0x2b46a8){return _0x2b46a8!==null&&!_[_0x40d6('0x1e')](_0x2b46a8);};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0xc')]=function(_0x285735){try{if(this[_0x40d6('0x1d')](_0x285735)){if(_[_0x40d6('0x1e')](this[_0x40d6('0x7')][_0x285735['uniqueid']])){this['channels'][_0x285735[_0x40d6('0x1f')]]={};}if(_['isUndefined'](this[_0x40d6('0x7')][_0x285735[_0x40d6('0x1f')]][_0x285735[_0x40d6('0x20')]])){this[_0x40d6('0x7')][_0x285735['uniqueid']][_0x285735[_0x40d6('0x20')]]={'agentcalledAt':moment()[_0x40d6('0x21')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x40d6('0x22'),'variables':this[_0x40d6('0xa')][_0x285735['uniqueid']],'type':this[_0x40d6('0x8')][_0x285735[_0x40d6('0x23')]]?this['voiceQueues'][_0x285735['queue']][_0x40d6('0x24')]||'inbound':'inbound'};}_[_0x40d6('0x25')](this[_0x40d6('0x7')][_0x285735['uniqueid']][_0x285735[_0x40d6('0x20')]],_['omit'](_0x285735,[_0x40d6('0x26'),_0x40d6('0x27')]));ami[_0x40d6('0x1c')](_0x40d6('0x28'),this[_0x40d6('0x7')][_0x285735['uniqueid']][_0x285735[_0x40d6('0x20')]]);this['emit'](util[_0x40d6('0x21')]('user:%s',_0x285735[_0x40d6('0x29')]),'user:called',this[_0x40d6('0x7')][_0x285735[_0x40d6('0x1f')]][_0x285735['destuniqueid']]);}}catch(_0x577175){logger[_0x40d6('0x2a')]('[syncAgentCalled][VoiceAgentReport]',util[_0x40d6('0x2b')](_0x577175,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40d6('0xf')]=function(_0x34c06c){try{if(this['isNotNull'](_0x34c06c)){if(this['channels'][_0x34c06c['uniqueid']]){for(var _0x1b4e06 in this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]]){if(this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x40d6('0x2c')](_0x1b4e06)){if(_0x34c06c['destuniqueid']===_0x1b4e06){this['channels'][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x2d')]=moment()[_0x40d6('0x21')](_0x40d6('0x2e'));this['channels'][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x2f')]=_0x40d6('0x30');this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]['holdtime']=_0x34c06c[_0x40d6('0x31')];this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]['connectedlinenum']=_0x34c06c[_0x40d6('0x32')];this['channels'][_0x34c06c['uniqueid']][_0x1b4e06][_0x40d6('0x33')]=_0x34c06c['connectedlinename'];this['channels'][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x34')]=_0x34c06c[_0x40d6('0x34')];this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x35')]=_0x34c06c[_0x40d6('0x35')];_['merge'](this[_0x40d6('0x9')][_0x34c06c[_0x40d6('0x36')]],_['pick'](_0x34c06c,[_0x40d6('0x23'),_0x40d6('0x37')]));this[_0x40d6('0x1c')](util[_0x40d6('0x21')](_0x40d6('0x38'),_0x34c06c[_0x40d6('0x29')]),'user:agentconnect',this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x34c06c[_0x40d6('0x20')]]);ami[_0x40d6('0x1c')](_0x40d6('0x39'),this['channels'][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]);}else if(this['isNotNull'](this[_0x40d6('0x7')][_0x34c06c['uniqueid']][_0x1b4e06][_0x40d6('0x10')])){this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]['agentringnoanswer']=!![];this[_0x40d6('0x7')][_0x34c06c['uniqueid']][_0x1b4e06][_0x40d6('0x3a')]=moment()[_0x40d6('0x21')](_0x40d6('0x2e'));this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]['reason']=_0x40d6('0x3b');this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x2f')]=_0x40d6('0x3b');this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06][_0x40d6('0x3c')]=_0x34c06c[_0x40d6('0x20')];this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]['answeredelsewheremembername']=_0x34c06c['membername'];ami[_0x40d6('0x1c')](_0x40d6('0x3d'),this[_0x40d6('0x7')][_0x34c06c[_0x40d6('0x1f')]][_0x1b4e06]);}}}}}}catch(_0x56b211){logger[_0x40d6('0x2a')]('[syncAgentConnect][VoiceAgentReport]',util[_0x40d6('0x2b')](_0x56b211,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0x11')]=function(_0x1cebf2){try{if(this[_0x40d6('0x1d')](_0x1cebf2)){if(this[_0x40d6('0x7')][_0x1cebf2[_0x40d6('0x1f')]]&&this[_0x40d6('0x7')][_0x1cebf2[_0x40d6('0x1f')]][_0x1cebf2['destuniqueid']]&&_[_0x40d6('0x1e')](this[_0x40d6('0x7')][_0x1cebf2['uniqueid']][_0x1cebf2[_0x40d6('0x20')]][_0x40d6('0x10')])){this[_0x40d6('0x7')][_0x1cebf2['uniqueid']][_0x1cebf2[_0x40d6('0x20')]][_0x40d6('0x10')]=!![];this[_0x40d6('0x7')][_0x1cebf2[_0x40d6('0x1f')]][_0x1cebf2[_0x40d6('0x20')]][_0x40d6('0x3a')]=moment()['format'](_0x40d6('0x2e'));this['channels'][_0x1cebf2[_0x40d6('0x1f')]][_0x1cebf2['destuniqueid']][_0x40d6('0x3e')]=_0x40d6('0x3f');this['channels'][_0x1cebf2[_0x40d6('0x1f')]][_0x1cebf2['destuniqueid']][_0x40d6('0x2f')]=_0x40d6('0x3f');ami[_0x40d6('0x1c')](_0x40d6('0x40'),this[_0x40d6('0x7')][_0x1cebf2[_0x40d6('0x1f')]][_0x1cebf2['destuniqueid']]);}}}catch(_0x1e0dbe){logger[_0x40d6('0x2a')](_0x40d6('0x41'),util['inspect'](_0x1e0dbe,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40d6('0x13')]=function(_0x30bd76){try{if(this['isNotNull'](_0x30bd76)){if(this['channels'][_0x30bd76[_0x40d6('0x1f')]]){for(var _0x57c4f3 in this[_0x40d6('0x7')][_0x30bd76['uniqueid']]){if(this['channels'][_0x30bd76[_0x40d6('0x1f')]][_0x40d6('0x2c')](_0x57c4f3)&&_['isUndefined'](this['channels'][_0x30bd76[_0x40d6('0x1f')]][_0x57c4f3][_0x40d6('0x10')])){this[_0x40d6('0x7')][_0x30bd76['uniqueid']][_0x57c4f3][_0x40d6('0x10')]=!![];this[_0x40d6('0x7')][_0x30bd76[_0x40d6('0x1f')]][_0x57c4f3][_0x40d6('0x3a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x40d6('0x7')][_0x30bd76['uniqueid']][_0x57c4f3][_0x40d6('0x3e')]=_0x40d6('0x42');this[_0x40d6('0x7')][_0x30bd76[_0x40d6('0x1f')]][_0x57c4f3][_0x40d6('0x2f')]=_0x40d6('0x42');ami[_0x40d6('0x1c')](_0x40d6('0x43'),this[_0x40d6('0x7')][_0x30bd76[_0x40d6('0x1f')]][_0x57c4f3]);}}}}}catch(_0x2ac498){logger['error'](_0x40d6('0x44'),util[_0x40d6('0x2b')](_0x2ac498,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0x14')]=function(_0x281274){try{if(this[_0x40d6('0x1d')](_0x281274)){if(this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]]&&this[_0x40d6('0x7')][_0x281274['uniqueid']][_0x281274[_0x40d6('0x20')]]&&_[_0x40d6('0x1e')](this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274[_0x40d6('0x20')]][_0x40d6('0x45')])){this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274[_0x40d6('0x20')]][_0x40d6('0x45')]=!![];this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274[_0x40d6('0x20')]][_0x40d6('0x46')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274['destuniqueid']][_0x40d6('0x2f')]=_0x40d6('0x47');this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274['destuniqueid']][_0x40d6('0x48')]=_0x281274[_0x40d6('0x48')];this[_0x40d6('0x7')][_0x281274[_0x40d6('0x1f')]][_0x281274['destuniqueid']][_0x40d6('0x3e')]=_0x281274[_0x40d6('0x3e')];if(this[_0x40d6('0x8')][_0x281274['queue']]&&this[_0x40d6('0x8')][_0x281274[_0x40d6('0x23')]]['acw']){this['channels'][_0x281274[_0x40d6('0x1f')]][_0x281274[_0x40d6('0x20')]][_0x40d6('0x49')]=!![];this['channels'][_0x281274[_0x40d6('0x1f')]][_0x281274[_0x40d6('0x20')]][_0x40d6('0x4a')]=this[_0x40d6('0x8')][_0x281274[_0x40d6('0x23')]][_0x40d6('0x4b')];}this[_0x40d6('0x9')][_0x281274[_0x40d6('0x36')]]=_['omit'](this[_0x40d6('0x9')][_0x281274['interface']],['queue',_0x40d6('0x37')]);this[_0x40d6('0x1c')](util[_0x40d6('0x21')](_0x40d6('0x38'),_0x281274[_0x40d6('0x29')]),_0x40d6('0x4c'),this[_0x40d6('0x7')][_0x281274['uniqueid']][_0x281274[_0x40d6('0x20')]]);ami['emit'](_0x40d6('0x4d'),this[_0x40d6('0x7')][_0x281274['uniqueid']][_0x281274['destuniqueid']]);}}}catch(_0x4f54fa){logger[_0x40d6('0x2a')](_0x40d6('0x4e'),util['inspect'](_0x4f54fa,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0x4f')]=function(_0x1ec828){try{if(this[_0x40d6('0x1d')](_0x1ec828)){this[_0x40d6('0x50')](_0x1ec828[_0x40d6('0x1f')],_[_0x40d6('0x51')](_0x1ec828[_0x40d6('0x52')])[0x0],_0x1ec828[_0x40d6('0x53')]);if(this['channels'][_0x1ec828[_0x40d6('0x1f')]]){for(var _0x12e1c1 in this[_0x40d6('0x7')][_0x1ec828[_0x40d6('0x1f')]]){if(this[_0x40d6('0x7')][_0x1ec828[_0x40d6('0x1f')]][_0x40d6('0x2c')](_0x12e1c1)){if(_[_0x40d6('0x1e')](this[_0x40d6('0x7')][_0x1ec828[_0x40d6('0x1f')]][_0x12e1c1][_0x40d6('0xa')])){this[_0x40d6('0x7')][_0x1ec828[_0x40d6('0x1f')]][_0x12e1c1][_0x40d6('0xa')]={};}this[_0x40d6('0x7')][_0x1ec828['uniqueid']][_0x12e1c1][_0x40d6('0xa')]=this['variables'][_0x1ec828[_0x40d6('0x1f')]];}}}}}catch(_0x4ef811){logger['error'](_0x40d6('0x54'),util[_0x40d6('0x2b')](_0x4ef811,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x40d6('0x50')]=function(_0x53ae99,_0x2fc618,_0x216b3d){var _0x162ceb=[_0x40d6('0x55'),_0x40d6('0x56'),_0x40d6('0x57'),'rtpaudioqosjitterbridged',_0x40d6('0x58'),_0x40d6('0x59'),_0x40d6('0x5a'),_0x40d6('0x5b'),_0x40d6('0x5c'),_0x40d6('0x5d'),_0x40d6('0x5e'),'bridgepvtcallid',_0x40d6('0x5f'),_0x40d6('0x60'),_0x40d6('0x61'),_0x40d6('0x62'),_0x40d6('0x29'),_0x40d6('0x63'),'memberrealtime'];if(!_['isNil'](_0x2fc618)&&!_[_0x40d6('0x64')](_0x162ceb,_0x2fc618)){if(_[_0x40d6('0x1e')](this[_0x40d6('0xa')][_0x53ae99])){this['variables'][_0x53ae99]={};}this['variables'][_0x53ae99][_0x2fc618]=_0x216b3d;}};VoiceAgentReport['prototype'][_0x40d6('0x17')]=function(_0x1ad90d){try{if(this[_0x40d6('0x1d')](_0x1ad90d)){if(this[_0x40d6('0x7')][_0x1ad90d[_0x40d6('0x1f')]]){ami[_0x40d6('0x1c')](_0x40d6('0x65'),_[_0x40d6('0x66')](this[_0x40d6('0x7')][_0x1ad90d['uniqueid']]));delete this['channels'][_0x1ad90d['uniqueid']];}if(this[_0x40d6('0xa')][_0x1ad90d[_0x40d6('0x1f')]]){delete this[_0x40d6('0xa')][_0x1ad90d[_0x40d6('0x1f')]];}}}catch(_0x5efad1){logger[_0x40d6('0x2a')](_0x40d6('0x67'),util[_0x40d6('0x2b')](_0x5efad1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0x18')]=function(_0x377323){try{if(this[_0x40d6('0x1d')](_0x377323)){if(this[_0x40d6('0x7')][_0x377323[_0x40d6('0x1f')]]){}}}catch(_0x4945c0){logger[_0x40d6('0x2a')](_0x40d6('0x68'),util[_0x40d6('0x2b')](_0x4945c0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x40d6('0x1b')][_0x40d6('0x1a')]=function(_0x4875ad){try{if(this[_0x40d6('0x1d')](_0x4875ad)){if(this[_0x40d6('0x7')][_0x4875ad[_0x40d6('0x1f')]]){}}}catch(_0x54889e){logger[_0x40d6('0x2a')](_0x40d6('0x69'),util['inspect'](_0x54889e,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x6544=['hasOwnProperty','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','interface','pick','destconnectedlinenum','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheremembername','membername','custom:agentansweredelsewhere','inspect','syncAgentRingNoAnswer','rejected','custom:agentringnoanswer','abandoned','[syncQueueCallerAbandon][VoiceAgentReport]','talktime','acw','agentacw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','values','[syncHangup][VoiceAgentReport]','[syncMusicOnHoldStart][VoiceAgentReport]','syncMusicOnHoldStop','[syncMusicOnHoldStop][VoiceAgentReport]','exports','moment','util','../../../config/logger','ami','../ami','socket.io-emitter','localhost','channels','voiceQueues','agents','variables','bind','agentconnect','agentringnoanswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','prototype','isNotNull','isUndefined','syncAgentCalled','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','inbound','merge','omit','privilege','emit','custom:agentcalled','user:%s','user:called','error','[syncAgentCalled][VoiceAgentReport]'];(function(_0x4cbe3f,_0x588d7c){var _0x30eff4=function(_0x1abfb4){while(--_0x1abfb4){_0x4cbe3f['push'](_0x4cbe3f['shift']());}};_0x30eff4(++_0x588d7c);}(_0x6544,0xa1));var _0x4654=function(_0x1e06c4,_0x38a792){_0x1e06c4=_0x1e06c4-0x0;var _0x529a41=_0x6544[_0x1e06c4];return _0x529a41;};'use strict';var _=require('lodash');var moment=require(_0x4654('0x0'));var util=require(_0x4654('0x1'));var logger=require(_0x4654('0x2'))(_0x4654('0x3'));var ami=require(_0x4654('0x4'));var io=require(_0x4654('0x5'))({'host':_0x4654('0x6'),'port':0x18eb});function VoiceAgentReport(_0x16fb18){this[_0x4654('0x7')]={};this[_0x4654('0x8')]=_0x16fb18[_0x4654('0x8')];this['agents']=_0x16fb18[_0x4654('0x9')];this[_0x4654('0xa')]={};ami['on']('agentcalled',this['syncAgentCalled'][_0x4654('0xb')](this));ami['on'](_0x4654('0xc'),this['syncAgentConnect']['bind'](this));ami['on'](_0x4654('0xd'),this['syncAgentRingNoAnswer'][_0x4654('0xb')](this));ami['on'](_0x4654('0xe'),this[_0x4654('0xf')]['bind'](this));ami['on'](_0x4654('0x10'),this[_0x4654('0x11')][_0x4654('0xb')](this));ami['on']('varset',this[_0x4654('0x12')]['bind'](this));ami['on'](_0x4654('0x13'),this[_0x4654('0x14')]['bind'](this));ami['on'](_0x4654('0x15'),this[_0x4654('0x16')][_0x4654('0xb')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop']['bind'](this));}VoiceAgentReport[_0x4654('0x17')]['emit']=function(_0x3bb62f,_0x268857,_0x53c624){io['to'](_0x3bb62f)['emit'](_0x268857,_0x53c624);};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x18')]=function(_0x1682ed){return _0x1682ed!==null&&!_[_0x4654('0x19')](_0x1682ed);};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x1a')]=function(_0x33eeaf){try{if(this['isNotNull'](_0x33eeaf)){if(_['isUndefined'](this[_0x4654('0x7')][_0x33eeaf['uniqueid']])){this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]]={};}if(_[_0x4654('0x19')](this[_0x4654('0x7')][_0x33eeaf['uniqueid']][_0x33eeaf[_0x4654('0x1c')]])){this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf['destuniqueid']]={'agentcalledAt':moment()[_0x4654('0x1d')](_0x4654('0x1e')),'lastevent':_0x4654('0x1f'),'variables':this[_0x4654('0xa')][_0x33eeaf[_0x4654('0x1b')]],'type':this['voiceQueues'][_0x33eeaf[_0x4654('0x20')]]?this['voiceQueues'][_0x33eeaf[_0x4654('0x20')]]['type']||_0x4654('0x21'):'inbound'};}_[_0x4654('0x22')](this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf['destuniqueid']],_[_0x4654('0x23')](_0x33eeaf,['event',_0x4654('0x24')]));ami[_0x4654('0x25')](_0x4654('0x26'),this['channels'][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf[_0x4654('0x1c')]]);this[_0x4654('0x25')](util[_0x4654('0x1d')](_0x4654('0x27'),_0x33eeaf['membername']),_0x4654('0x28'),this[_0x4654('0x7')][_0x33eeaf[_0x4654('0x1b')]][_0x33eeaf[_0x4654('0x1c')]]);}}catch(_0x29ec67){logger[_0x4654('0x29')](_0x4654('0x2a'),util['inspect'](_0x29ec67,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')]['syncAgentConnect']=function(_0x697f){try{if(this['isNotNull'](_0x697f)){if(this['channels'][_0x697f['uniqueid']]){for(var _0x427d2b in this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]]){if(this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x4654('0x2b')](_0x427d2b)){if(_0x697f[_0x4654('0x1c')]===_0x427d2b){this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b]['agentconnectAt']=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x2c')]=_0x4654('0x2d');this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x2e')]=_0x697f['holdtime'];this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x2f')]=_0x697f[_0x4654('0x2f')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x30')]=_0x697f[_0x4654('0x30')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['destchannelstate']=_0x697f[_0x4654('0x31')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x32')]=_0x697f[_0x4654('0x32')];_[_0x4654('0x22')](this['agents'][_0x697f[_0x4654('0x33')]],_[_0x4654('0x34')](_0x697f,['queue',_0x4654('0x35')]));this['emit'](util[_0x4654('0x1d')](_0x4654('0x27'),_0x697f['membername']),_0x4654('0x36'),this[_0x4654('0x7')][_0x697f['uniqueid']][_0x697f[_0x4654('0x1c')]]);ami[_0x4654('0x25')](_0x4654('0x37'),this['channels'][_0x697f['uniqueid']][_0x427d2b]);}else if(this[_0x4654('0x18')](this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0xd')])){this['channels'][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0xd')]=!![];this[_0x4654('0x7')][_0x697f['uniqueid']][_0x427d2b][_0x4654('0x38')]=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x39')]=_0x4654('0x3a');this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['lastevent']=_0x4654('0x3a');this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]['answeredelsewheredestinationuniqueid']=_0x697f[_0x4654('0x1c')];this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b][_0x4654('0x3b')]=_0x697f[_0x4654('0x3c')];ami[_0x4654('0x25')](_0x4654('0x3d'),this[_0x4654('0x7')][_0x697f[_0x4654('0x1b')]][_0x427d2b]);}}}}}}catch(_0x48bc4c){logger['error']('[syncAgentConnect][VoiceAgentReport]',util[_0x4654('0x3e')](_0x48bc4c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x3f')]=function(_0x2cd5ab){try{if(this[_0x4654('0x18')](_0x2cd5ab)){if(this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]]&&this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]]&&_[_0x4654('0x19')](this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab['destuniqueid']][_0x4654('0xd')])){this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0xd')]=!![];this[_0x4654('0x7')][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0x38')]=moment()['format'](_0x4654('0x1e'));this['channels'][_0x2cd5ab['uniqueid']][_0x2cd5ab[_0x4654('0x1c')]][_0x4654('0x39')]=_0x4654('0x40');this[_0x4654('0x7')][_0x2cd5ab['uniqueid']][_0x2cd5ab[_0x4654('0x1c')]]['lastevent']='rejected';ami['emit'](_0x4654('0x41'),this['channels'][_0x2cd5ab[_0x4654('0x1b')]][_0x2cd5ab[_0x4654('0x1c')]]);}}}catch(_0x19d9cf){logger[_0x4654('0x29')]('[syncAgentRingNoAnswer][VoiceAgentReport]',util[_0x4654('0x3e')](_0x19d9cf,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0xf')]=function(_0x11f5a1){try{if(this[_0x4654('0x18')](_0x11f5a1)){if(this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]]){for(var _0x363b4f in this[_0x4654('0x7')][_0x11f5a1['uniqueid']]){if(this['channels'][_0x11f5a1['uniqueid']]['hasOwnProperty'](_0x363b4f)&&_[_0x4654('0x19')](this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f][_0x4654('0xd')])){this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f][_0x4654('0xd')]=!![];this['channels'][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f]['agentringnoanswerAt']=moment()[_0x4654('0x1d')](_0x4654('0x1e'));this[_0x4654('0x7')][_0x11f5a1[_0x4654('0x1b')]][_0x363b4f][_0x4654('0x39')]=_0x4654('0x42');this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f][_0x4654('0x2c')]=_0x4654('0x42');ami[_0x4654('0x25')]('custom:agentqueuecallerabandon',this[_0x4654('0x7')][_0x11f5a1['uniqueid']][_0x363b4f]);}}}}}catch(_0x501cac){logger[_0x4654('0x29')](_0x4654('0x43'),util[_0x4654('0x3e')](_0x501cac,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4654('0x11')]=function(_0x1949e4){try{if(this[_0x4654('0x18')](_0x1949e4)){if(this['channels'][_0x1949e4['uniqueid']]&&this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]&&_['isUndefined'](this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x10')])){this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x10')]=!![];this['channels'][_0x1949e4['uniqueid']][_0x1949e4[_0x4654('0x1c')]]['agentcompleteAt']=moment()['format'](_0x4654('0x1e'));this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]['lastevent']='complete';this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x44')]=_0x1949e4[_0x4654('0x44')];this[_0x4654('0x7')][_0x1949e4['uniqueid']][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x39')]=_0x1949e4[_0x4654('0x39')];if(this['voiceQueues'][_0x1949e4[_0x4654('0x20')]]&&this[_0x4654('0x8')][_0x1949e4[_0x4654('0x20')]][_0x4654('0x45')]){this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']][_0x4654('0x46')]=!![];this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]][_0x4654('0x47')]=this[_0x4654('0x8')][_0x1949e4[_0x4654('0x20')]][_0x4654('0x48')];}this['agents'][_0x1949e4['interface']]=_[_0x4654('0x23')](this[_0x4654('0x9')][_0x1949e4['interface']],[_0x4654('0x20'),_0x4654('0x35')]);this['emit'](util[_0x4654('0x1d')]('user:%s',_0x1949e4[_0x4654('0x3c')]),_0x4654('0x49'),this['channels'][_0x1949e4[_0x4654('0x1b')]][_0x1949e4['destuniqueid']]);ami[_0x4654('0x25')](_0x4654('0x4a'),this[_0x4654('0x7')][_0x1949e4[_0x4654('0x1b')]][_0x1949e4[_0x4654('0x1c')]]);}}}catch(_0x15df40){logger['error'](_0x4654('0x4b'),util[_0x4654('0x3e')](_0x15df40,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x4654('0x12')]=function(_0x1b5a5d){try{if(this['isNotNull'](_0x1b5a5d)){this['addVariable'](_0x1b5a5d[_0x4654('0x1b')],_[_0x4654('0x4c')](_0x1b5a5d[_0x4654('0x4d')])[0x0],_0x1b5a5d[_0x4654('0x4e')]);if(this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]]){for(var _0x4e667b in this['channels'][_0x1b5a5d['uniqueid']]){if(this[_0x4654('0x7')][_0x1b5a5d['uniqueid']][_0x4654('0x2b')](_0x4e667b)){if(_[_0x4654('0x19')](this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]][_0x4e667b][_0x4654('0xa')])){this[_0x4654('0x7')][_0x1b5a5d[_0x4654('0x1b')]][_0x4e667b]['variables']={};}this[_0x4654('0x7')][_0x1b5a5d['uniqueid']][_0x4e667b][_0x4654('0xa')]=this[_0x4654('0xa')][_0x1b5a5d['uniqueid']];}}}}}catch(_0x550114){logger['error'](_0x4654('0x4f'),util[_0x4654('0x3e')](_0x550114,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['addVariable']=function(_0x11603f,_0x4eca80,_0x1f2437){var _0x5b5004=[_0x4654('0x50'),_0x4654('0x51'),_0x4654('0x52'),_0x4654('0x53'),_0x4654('0x54'),_0x4654('0x55'),_0x4654('0x56'),_0x4654('0x57'),'sipcallid','sipuri','bridgepeer',_0x4654('0x58'),_0x4654('0x59'),_0x4654('0x5a'),_0x4654('0x5b'),_0x4654('0x5c'),_0x4654('0x3c'),_0x4654('0x5d'),'memberrealtime'];if(!_[_0x4654('0x5e')](_0x4eca80)&&!_[_0x4654('0x5f')](_0x5b5004,_0x4eca80)){if(_[_0x4654('0x19')](this[_0x4654('0xa')][_0x11603f])){this[_0x4654('0xa')][_0x11603f]={};}this[_0x4654('0xa')][_0x11603f][_0x4eca80]=_0x1f2437;}};VoiceAgentReport['prototype'][_0x4654('0x14')]=function(_0x121fb4){try{if(this[_0x4654('0x18')](_0x121fb4)){if(this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]]){ami[_0x4654('0x25')]('custom:voiceAgentReport',_[_0x4654('0x60')](this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]]));delete this[_0x4654('0x7')][_0x121fb4[_0x4654('0x1b')]];}if(this['variables'][_0x121fb4[_0x4654('0x1b')]]){delete this['variables'][_0x121fb4[_0x4654('0x1b')]];}}}catch(_0x10aa78){logger['error'](_0x4654('0x61'),util[_0x4654('0x3e')](_0x10aa78,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')]['syncMusicOnHoldStart']=function(_0x5a5e6f){try{if(this[_0x4654('0x18')](_0x5a5e6f)){if(this[_0x4654('0x7')][_0x5a5e6f[_0x4654('0x1b')]]){}}}catch(_0x179e58){logger[_0x4654('0x29')](_0x4654('0x62'),util[_0x4654('0x3e')](_0x179e58,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x4654('0x17')][_0x4654('0x63')]=function(_0x3f70db){try{if(this[_0x4654('0x18')](_0x3f70db)){if(this['channels'][_0x3f70db[_0x4654('0x1b')]]){}}}catch(_0x33f902){logger[_0x4654('0x29')](_0x4654('0x64'),util[_0x4654('0x3e')](_0x33f902,{'showHidden':![],'depth':null}));}};module[_0x4654('0x65')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 4e98862..2c5c1a2 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3d8=['lastapplication','lastdata','startsWith','[syncNewExten][VoiceCallReport]','channelstate','answered','xcally-motion-preview','calleridnum','connectedlinename','toNumber','UserId','membername','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','endsWith','.WAV','monitorFilename','isNil','monitors','push','rec','syncVarSet','variable','xmd-phone','value','xmd-cdrtype','xmd-queue','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','mixmonitor_filename','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','answertime','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','BlindTransfer','transfererchannel','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','[syncMusicOnHoldStop][VoiceCallReport]','exports','bluebird','lodash','moment','util','path','../model/channel','unknown','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','hangup','syncHangup','newcallerid','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','resolve','then','actionCoreShowChannels','catch','log','prototype','isNotNull','emit','syncNewCallerId','uniqueid','linkedid','isUndefined','merge','pick','keys','error','[syncNewCallerId][VoiceCallReport]','channel','OutgoingSpoolFailed','starttime','format','disposition','context','from-sip','split','destconnectedlinenum','exten','user:%s','name','user:agentconnect','accountcode','[syncNewChannel][VoiceCallReport]','inspect','application','applicationdata','appdata','toLowerCase','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes'];(function(_0xbe102c,_0x3b0a1a){var _0xb8d7e5=function(_0x29ed0a){while(--_0x29ed0a){_0xbe102c['push'](_0xbe102c['shift']());}};_0xb8d7e5(++_0x3b0a1a);}(_0xa3d8,0xcc));var _0x8a3d=function(_0x4aabb6,_0x188125){_0x4aabb6=_0x4aabb6-0x0;var _0x1143e4=_0xa3d8[_0x4aabb6];return _0x1143e4;};'use strict';var BPromise=require(_0x8a3d('0x0'));var _=require(_0x8a3d('0x1'));var moment=require(_0x8a3d('0x2'));var util=require(_0x8a3d('0x3'));var path=require(_0x8a3d('0x4'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');var Channel=require(_0x8a3d('0x5'));var statusDesc=[_0x8a3d('0x6'),_0x8a3d('0x7'),_0x8a3d('0x8'),'busy','invalid',_0x8a3d('0x9'),_0x8a3d('0xa'),_0x8a3d('0xb'),_0x8a3d('0xc')];var applications=[_0x8a3d('0xd'),_0x8a3d('0xe'),_0x8a3d('0xf'),'dial',_0x8a3d('0x10'),_0x8a3d('0x11')];var dispositions=[_0x8a3d('0x12'),_0x8a3d('0x13'),_0x8a3d('0x13'),_0x8a3d('0x12'),_0x8a3d('0x12'),_0x8a3d('0x12'),_0x8a3d('0x14'),_0x8a3d('0x15'),_0x8a3d('0x13'),_0x8a3d('0x13'),'FAILED'];var actions={};var io=require(_0x8a3d('0x16'))({'host':'localhost','port':0x18eb});function VoiceCallReport(_0x2e80be){this[_0x8a3d('0x17')]=_0x2e80be[_0x8a3d('0x17')];this[_0x8a3d('0x18')]=_0x2e80be[_0x8a3d('0x18')];ami['on'](_0x8a3d('0x19'),this[_0x8a3d('0x1a')][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x1c'),this[_0x8a3d('0x1a')][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x1d'),this[_0x8a3d('0x1e')][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x1f'),this[_0x8a3d('0x20')]['bind'](this));ami['on'](_0x8a3d('0x21'),this['syncVarSet'][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x22'),this[_0x8a3d('0x23')]['bind'](this));ami['on'](_0x8a3d('0x24'),this['syncNewCallerId'][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x25'),this[_0x8a3d('0x26')]['bind'](this));ami['on']('blindtransfer',this[_0x8a3d('0x27')][_0x8a3d('0x1b')](this));ami['on'](_0x8a3d('0x28'),this['syncMusicOnHoldStart'][_0x8a3d('0x1b')](this));ami['on']('musiconholdstop',this[_0x8a3d('0x29')][_0x8a3d('0x1b')](this));return BPromise[_0x8a3d('0x2a')]()[_0x8a3d('0x2b')](ami[_0x8a3d('0x2c')]())[_0x8a3d('0x2d')](function(_0x515675){console[_0x8a3d('0x2e')](_0x515675);});}VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x30')]=function(_0x23aca0){return _0x23aca0!==null&&!_['isUndefined'](_0x23aca0);};VoiceCallReport['prototype'][_0x8a3d('0x31')]=function(_0x464414,_0x24811f,_0x5a3533){io['to'](_0x464414)[_0x8a3d('0x31')](_0x24811f,_0x5a3533);};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x32')]=function(_0x637346){try{if(this['isNotNull'](_0x637346)){if(_0x637346[_0x8a3d('0x33')]===_0x637346[_0x8a3d('0x34')]){if(!_[_0x8a3d('0x35')](this[_0x8a3d('0x17')][_0x637346['uniqueid']])){_[_0x8a3d('0x36')](this[_0x8a3d('0x17')][_0x637346['uniqueid']],_[_0x8a3d('0x37')](_0x637346,_[_0x8a3d('0x38')](this[_0x8a3d('0x17')][_0x637346[_0x8a3d('0x33')]])));}}}}catch(_0x4b5d25){logger[_0x8a3d('0x39')](_0x8a3d('0x3a'),util['inspect'](_0x4b5d25,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x1e')]=function(_0x581794){try{if(this['isNotNull'](_0x581794)){if(_0x581794[_0x8a3d('0x33')]===_0x581794['linkedid']&&_0x581794[_0x8a3d('0x3b')]!=_0x8a3d('0x3c')){if(_[_0x8a3d('0x35')](this['channels'][_0x581794['uniqueid']])){this['channels'][_0x581794['uniqueid']]=new Channel();this[_0x8a3d('0x17')][_0x581794[_0x8a3d('0x33')]][_0x8a3d('0x3d')]=moment()[_0x8a3d('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8a3d('0x17')][_0x581794[_0x8a3d('0x33')]][_0x8a3d('0x3f')]=dispositions[_['toNumber'](_0x581794['channelstate'])];_[_0x8a3d('0x36')](this[_0x8a3d('0x17')][_0x581794[_0x8a3d('0x33')]],_['pick'](_0x581794,_[_0x8a3d('0x38')](this[_0x8a3d('0x17')][_0x581794[_0x8a3d('0x33')]])));if(_0x581794[_0x8a3d('0x40')]===_0x8a3d('0x41')){if(this['agents'][_0x581794[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]){this[_0x8a3d('0x18')][_0x581794['channel']['split']('-')[0x0]][_0x8a3d('0x43')]=_0x581794[_0x8a3d('0x44')];this['emit'](util[_0x8a3d('0x3e')](_0x8a3d('0x45'),this[_0x8a3d('0x18')][_0x581794[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]][_0x8a3d('0x46')]),_0x8a3d('0x47'),{'destaccountcode':this[_0x8a3d('0x18')][_0x581794[_0x8a3d('0x3b')]['split']('-')[0x0]][_0x8a3d('0x48')],'destconnectedlinenum':_0x581794[_0x8a3d('0x44')]});}}}}}}catch(_0x693af5){logger[_0x8a3d('0x39')](_0x8a3d('0x49'),util[_0x8a3d('0x4a')](_0x693af5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x1a')]=function(_0x454870){try{if(this['isNotNull'](_0x454870)){if(_0x454870[_0x8a3d('0x33')]===_0x454870[_0x8a3d('0x34')]&&_0x454870[_0x8a3d('0x44')]!='h'&&_0x454870[_0x8a3d('0x3b')]!=_0x8a3d('0x3c')){_0x454870[_0x8a3d('0x4b')]=_0x454870[_0x8a3d('0x4b')]['toLowerCase']();_0x454870[_0x8a3d('0x4c')]=(_0x454870[_0x8a3d('0x4d')]||_0x454870[_0x8a3d('0x4c')])[_0x8a3d('0x4e')]();if(_[_0x8a3d('0x35')](this[_0x8a3d('0x17')][_0x454870['uniqueid']])){this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]]=new Channel();this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]][_0x8a3d('0x3d')]=_0x454870[_0x8a3d('0x4f')]?moment()[_0x8a3d('0x50')](moment[_0x8a3d('0x4f')](_0x454870[_0x8a3d('0x4f')])[_0x8a3d('0x51')](),_0x8a3d('0x51'))[_0x8a3d('0x3e')](_0x8a3d('0x52')):moment()['format'](_0x8a3d('0x52'));this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]][_0x8a3d('0x3f')]=_0x8a3d('0x12');}_[_0x8a3d('0x36')](this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]],_['pick'](_0x454870,_[_0x8a3d('0x38')](this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]])));if(_[_0x8a3d('0x53')](applications,_0x454870['application'])){this[_0x8a3d('0x17')][_0x454870['uniqueid']][_0x8a3d('0x54')]=_0x454870[_0x8a3d('0x4b')];this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]][_0x8a3d('0x55')]=_0x454870[_0x8a3d('0x4c')];if(_0x454870[_0x8a3d('0x4b')]===_0x8a3d('0xd')&&_[_0x8a3d('0x56')](_0x454870[_0x8a3d('0x4c')],'cdr(')){var _0x8b86af=_0x454870['applicationdata'][_0x8a3d('0x42')]('=');var _0x2cb819=_0x8b86af[0x0]['match'](/cdr\((.*)\)/);if(_0x2cb819){this[_0x8a3d('0x17')][_0x454870[_0x8a3d('0x33')]][_0x2cb819[0x1]]=_0x8b86af[0x1];}}else if(_0x454870[_0x8a3d('0x4b')]===_0x8a3d('0xe')){this[_0x8a3d('0x17')][_0x454870['uniqueid']]['queue']=_0x454870['applicationdata'][_0x8a3d('0x42')](',')[0x0];}}}}}catch(_0xdc8722){logger[_0x8a3d('0x39')](_0x8a3d('0x57'),util[_0x8a3d('0x4a')](_0xdc8722,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x20')]=function(_0xbbe4fc){try{if(this['isNotNull'](_0xbbe4fc)){if(_0xbbe4fc[_0x8a3d('0x33')]!==_0xbbe4fc['linkedid']){if(this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]]){if(_0xbbe4fc[_0x8a3d('0x58')]==='6'){if(!this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x59')]){this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]]['answered']=!![];this['channels'][_0xbbe4fc['linkedid']]['answertime']=moment()[_0x8a3d('0x3e')](_0x8a3d('0x52'));}this['channels'][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x34')]=_0xbbe4fc[_0x8a3d('0x33')];if(_0xbbe4fc['calleridnum']!==_0x8a3d('0x5a')){this[_0x8a3d('0x17')][_0xbbe4fc['linkedid']]['connectedlinenum']=_0xbbe4fc[_0x8a3d('0x5b')];}this['channels'][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x5c')]=_0xbbe4fc['calleridname'];this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]]['destinationchannel']=_0xbbe4fc[_0x8a3d('0x3b')];this['channels'][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x3f')]=dispositions[_[_0x8a3d('0x5d')](_0xbbe4fc[_0x8a3d('0x58')])];if(this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')]['split']('-')[0x0]]){this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x5e')]=this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]['id'];this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x34')]][_0x8a3d('0x5f')]=this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]['name'];}}}}else{if(this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x33')]]){if(_0xbbe4fc['channelstate']==='6'){if(this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]){this[_0x8a3d('0x17')][_0xbbe4fc[_0x8a3d('0x33')]][_0x8a3d('0x5e')]=this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]['id'];this[_0x8a3d('0x17')][_0xbbe4fc['uniqueid']][_0x8a3d('0x5f')]=this[_0x8a3d('0x18')][_0xbbe4fc[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]][_0x8a3d('0x46')];}}}}}}catch(_0x17cc05){logger[_0x8a3d('0x39')](_0x8a3d('0x60'),util[_0x8a3d('0x4a')](_0x17cc05,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x61')]=function(_0x1f3740,_0x30a478){if(this[_0x8a3d('0x17')][_0x1f3740]){this[_0x8a3d('0x17')][_0x1f3740]['monitor']=!![];if(_[_0x8a3d('0x62')](_0x30a478,'.wav49')){_0x30a478=_0x30a478['replace']('.wav49',_0x8a3d('0x63'));}this[_0x8a3d('0x17')][_0x1f3740][_0x8a3d('0x64')]=_0x30a478;var _0x2393fd=_['find'](this['channels'][_0x1f3740]['monitors'],{'filename':_0x30a478});if(_[_0x8a3d('0x65')](_0x2393fd)){this[_0x8a3d('0x17')][_0x1f3740][_0x8a3d('0x66')][_0x8a3d('0x67')]({'filename':_0x30a478,'createdAt':moment()[_0x8a3d('0x3e')](_0x8a3d('0x52')),'mixmonitorid':'','status':_0x8a3d('0x68')});}}};VoiceCallReport['prototype'][_0x8a3d('0x69')]=function(_0x2579ec){try{if(this[_0x8a3d('0x30')](_0x2579ec)){if(this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]&&_0x2579ec[_0x8a3d('0x3b')]!=_0x8a3d('0x3c')){if(this['isNotNull'](_0x2579ec[_0x8a3d('0x6a')])){if(this['isNotNull'](_0x2579ec['variable']['mixmonitor_filename'])){this['syncMixMonitorFilename'](_0x2579ec[_0x8a3d('0x33')],_0x2579ec['value']);}else if(this['isNotNull'](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x6b')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]['calleridnum']=_0x2579ec['value'];}else if(this['isNotNull'](_0x2579ec['variable']['xmd-callerid'])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]['callerid']=_0x2579ec[_0x8a3d('0x6c')];}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x6d')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]['type']=_0x2579ec['value'];}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x6e')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]['queue']=_0x2579ec[_0x8a3d('0x6c')][_0x8a3d('0x42')](',')[0x0];}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x6f')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]][_0x8a3d('0x70')]=_0x2579ec[_0x8a3d('0x6c')];}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x71')])){this['channels'][_0x2579ec['uniqueid']][_0x8a3d('0x72')]=_0x2579ec[_0x8a3d('0x6c')];}else if(this[_0x8a3d('0x30')](_0x2579ec['variable'][_0x8a3d('0x73')])){this['channels'][_0x2579ec[_0x8a3d('0x33')]][_0x8a3d('0x74')]=_0x2579ec[_0x8a3d('0x6c')];}else if(this[_0x8a3d('0x30')](_0x2579ec['variable'][_0x8a3d('0x75')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]][_0x8a3d('0xe')]=_0x2579ec['value'];}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x76')])){this[_0x8a3d('0x17')][_0x2579ec[_0x8a3d('0x33')]]['sipcalluniqueid']=_0x2579ec[_0x8a3d('0x6c')];}}}else if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')][_0x8a3d('0x77')])){if(_0x2579ec[_0x8a3d('0x6c')]){var _0x2f16d0=path['parse'](_0x2579ec['value'])[_0x8a3d('0x46')];this['syncMixMonitorFilename'](_0x2f16d0,_0x2579ec[_0x8a3d('0x6c')]);}}else if(this['channels'][_0x2579ec[_0x8a3d('0x34')]]){if(this['isNotNull'](_0x2579ec[_0x8a3d('0x6a')])){if(this[_0x8a3d('0x30')](_0x2579ec[_0x8a3d('0x6a')]['sipcallid'])){this['channels'][_0x2579ec[_0x8a3d('0x34')]][_0x8a3d('0x78')]=_0x2579ec[_0x8a3d('0x6c')];}}}}}catch(_0x43b0d9){logger[_0x8a3d('0x39')](_0x8a3d('0x79'),util[_0x8a3d('0x4a')](_0x43b0d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x23')]=function(_0x20bbcf){try{if(this[_0x8a3d('0x30')](_0x20bbcf)){if(this['channels'][_0x20bbcf[_0x8a3d('0x33')]]){var _0x15e0ac=moment();this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]][_0x8a3d('0x7a')]=_0x15e0ac[_0x8a3d('0x3e')](_0x8a3d('0x52'));this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]][_0x8a3d('0x4f')]=_0x15e0ac[_0x8a3d('0x7b')](this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]]['starttime'],'seconds');if(this['channels'][_0x20bbcf[_0x8a3d('0x33')]]['answered']){this[_0x8a3d('0x17')][_0x20bbcf['uniqueid']]['billableseconds']=_0x15e0ac[_0x8a3d('0x7b')](this['channels'][_0x20bbcf[_0x8a3d('0x33')]][_0x8a3d('0x7c')],_0x8a3d('0x51'));this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]]['holdtime']=this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]]['duration']-this[_0x8a3d('0x17')][_0x20bbcf['uniqueid']][_0x8a3d('0x7d')];}if(_0x20bbcf[_0x8a3d('0x40')]==='from-sip'){if(this[_0x8a3d('0x18')][_0x20bbcf['channel'][_0x8a3d('0x42')]('-')[0x0]]){this[_0x8a3d('0x18')][_0x20bbcf[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]]=_[_0x8a3d('0x7e')](this[_0x8a3d('0x18')][_0x20bbcf[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]],[_0x8a3d('0x43')]);this[_0x8a3d('0x31')](util['format'](_0x8a3d('0x45'),this[_0x8a3d('0x18')][_0x20bbcf[_0x8a3d('0x3b')]['split']('-')[0x0]][_0x8a3d('0x46')]),_0x8a3d('0x7f'),{'destaccountcode':this[_0x8a3d('0x18')][_0x20bbcf[_0x8a3d('0x3b')][_0x8a3d('0x42')]('-')[0x0]][_0x8a3d('0x48')]});}}ami[_0x8a3d('0x31')](_0x8a3d('0x80'),this['channels'][_0x20bbcf[_0x8a3d('0x33')]]);delete this[_0x8a3d('0x17')][_0x20bbcf[_0x8a3d('0x33')]];}}}catch(_0x198e20){logger[_0x8a3d('0x39')]('[syncHangup][VoiceCallReport]',util[_0x8a3d('0x4a')](_0x198e20,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')]['syncAttendedTransfer']=function(_0x59a610){try{if(this[_0x8a3d('0x30')](_0x59a610)){if(this['channels'][_0x59a610['transfereeuniqueid']]){this[_0x8a3d('0x17')][_0x59a610[_0x8a3d('0x81')]][_0x8a3d('0x82')]=_0x59a610[_0x8a3d('0x83')];this[_0x8a3d('0x17')][_0x59a610[_0x8a3d('0x81')]][_0x8a3d('0x84')]=_0x59a610['transfertargetcalleridnum'];var _0x5411a4=this[_0x8a3d('0x17')][_0x59a610[_0x8a3d('0x85')]];this[_0x8a3d('0x17')][_0x59a610[_0x8a3d('0x85')]]=this[_0x8a3d('0x17')][_0x59a610[_0x8a3d('0x81')]];this['channels'][_0x59a610[_0x8a3d('0x81')]]=_0x5411a4;}}}catch(_0x2967b5){logger[_0x8a3d('0x39')](_0x8a3d('0x86'),util[_0x8a3d('0x4a')](_0x2967b5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x5a4d8d){try{if(this['isNotNull'](_0x5a4d8d)){if(this[_0x8a3d('0x17')][_0x5a4d8d[_0x8a3d('0x81')]]){this[_0x8a3d('0x17')][_0x5a4d8d[_0x8a3d('0x81')]][_0x8a3d('0x82')]=_0x5a4d8d[_0x8a3d('0x87')];this['channels'][_0x5a4d8d['transfereeuniqueid']][_0x8a3d('0x84')]=_0x5a4d8d[_0x8a3d('0x88')];this[_0x8a3d('0x23')]({'event':_0x8a3d('0x89'),'uniqueid':_0x5a4d8d[_0x8a3d('0x81')],'context':_0x5a4d8d['context'],'channel':_0x5a4d8d[_0x8a3d('0x8a')]});}}}catch(_0x46da04){logger['error']('[syncBlindTransfer][VoiceCallReport]',util[_0x8a3d('0x4a')](_0x46da04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')]['syncMusicOnHoldStart']=function(_0x5658a8){try{if(this[_0x8a3d('0x30')](_0x5658a8)){if(this['channels'][_0x5658a8[_0x8a3d('0x33')]]){if(!_[_0x8a3d('0x65')](this[_0x8a3d('0x17')][_0x5658a8[_0x8a3d('0x33')]][_0x8a3d('0x7c')])){this[_0x8a3d('0x17')][_0x5658a8[_0x8a3d('0x33')]][_0x8a3d('0x8b')]=moment()[_0x8a3d('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x43c13e){logger[_0x8a3d('0x39')](_0x8a3d('0x8c'),util[_0x8a3d('0x4a')](_0x43c13e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x8a3d('0x2f')][_0x8a3d('0x29')]=function(_0x19e070){try{if(this[_0x8a3d('0x30')](_0x19e070)){if(this[_0x8a3d('0x17')][_0x19e070[_0x8a3d('0x33')]]){if(!_[_0x8a3d('0x65')](this[_0x8a3d('0x17')][_0x19e070[_0x8a3d('0x33')]]['mohstarttime'])){this['channels'][_0x19e070[_0x8a3d('0x33')]][_0x8a3d('0x8d')]+=moment()['milliseconds'](0x0)['diff'](this[_0x8a3d('0x17')][_0x19e070['uniqueid']][_0x8a3d('0x8b')],_0x8a3d('0x51'));delete this[_0x8a3d('0x17')][_0x19e070[_0x8a3d('0x33')]][_0x8a3d('0x8b')];}}}}catch(_0x526795){logger[_0x8a3d('0x39')](_0x8a3d('0x8e'),util[_0x8a3d('0x4a')](_0x526795,{'showHidden':![],'depth':null}));}};module[_0x8a3d('0x8f')]=VoiceCallReport; \ No newline at end of file +var _0x6309=['onhold','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','socket.io-emitter','localhost','channels','agents','syncNewExten','bind','newexten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','resolve','then','prototype','isNotNull','emit','uniqueid','linkedid','isUndefined','merge','pick','keys','error','inspect','channel','OutgoingSpoolFailed','starttime','format','disposition','context','split','user:%s','name','user:agentconnect','exten','application','toLowerCase','applicationdata','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','cdr(','match','channelstate','answered','xcally-motion-preview','connectedlinenum','calleridnum','calleridname','membername','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','isNil','push','rec','variable','mixmonitor_filename','value','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','sipcalluniqueid','parse','sipcalllinkedid','[syncVarSet][VoiceCallReport]','endtime','diff','billableseconds','answertime','holdtime','from-sip','omit','destconnectedlinenum','user:agentcomplete','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','syncBlindTransfer','extension','BlindTransfer','transfererchannel','[syncBlindTransfer][VoiceCallReport]','mohstarttime','milliseconds','exports','bluebird','lodash','moment','util','path','../../../config/logger','ami','../model/channel','not_inuse','inuse','busy','unavailable','ringing'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6309,0x84));var _0x9630=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0x6309[_0x4191bc];return _0x1ffd4e;};'use strict';var BPromise=require(_0x9630('0x0'));var _=require(_0x9630('0x1'));var moment=require(_0x9630('0x2'));var util=require(_0x9630('0x3'));var path=require(_0x9630('0x4'));var logger=require(_0x9630('0x5'))(_0x9630('0x6'));var ami=require('../ami');var Channel=require(_0x9630('0x7'));var statusDesc=['unknown',_0x9630('0x8'),_0x9630('0x9'),_0x9630('0xa'),'invalid',_0x9630('0xb'),_0x9630('0xc'),'ringinuse',_0x9630('0xd')];var applications=[_0x9630('0xe'),_0x9630('0xf'),'agi',_0x9630('0x10'),'playback',_0x9630('0x11')];var dispositions=[_0x9630('0x12'),_0x9630('0x13'),_0x9630('0x13'),'NO\x20ANSWER',_0x9630('0x12'),_0x9630('0x12'),_0x9630('0x14'),_0x9630('0x15'),_0x9630('0x13'),_0x9630('0x13'),_0x9630('0x13')];var actions={};var io=require(_0x9630('0x16'))({'host':_0x9630('0x17'),'port':0x18eb});function VoiceCallReport(_0x3e5297){this[_0x9630('0x18')]=_0x3e5297[_0x9630('0x18')];this[_0x9630('0x19')]=_0x3e5297['agents'];ami['on']('coreshowchannel',this[_0x9630('0x1a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x1c'),this[_0x9630('0x1a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x1d'),this[_0x9630('0x1e')]['bind'](this));ami['on'](_0x9630('0x1f'),this[_0x9630('0x20')]['bind'](this));ami['on'](_0x9630('0x21'),this[_0x9630('0x22')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x23'),this[_0x9630('0x24')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x25'),this[_0x9630('0x26')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x27'),this[_0x9630('0x28')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x29'),this['syncBlindTransfer'][_0x9630('0x1b')](this));ami['on']('musiconholdstart',this[_0x9630('0x2a')][_0x9630('0x1b')](this));ami['on'](_0x9630('0x2b'),this[_0x9630('0x2c')][_0x9630('0x1b')](this));return BPromise[_0x9630('0x2d')]()[_0x9630('0x2e')](ami['actionCoreShowChannels']())['catch'](function(_0x47571f){console['log'](_0x47571f);});}VoiceCallReport[_0x9630('0x2f')][_0x9630('0x30')]=function(_0x4e9f3f){return _0x4e9f3f!==null&&!_['isUndefined'](_0x4e9f3f);};VoiceCallReport['prototype'][_0x9630('0x31')]=function(_0xb81538,_0x3cc764,_0x1250ea){io['to'](_0xb81538)[_0x9630('0x31')](_0x3cc764,_0x1250ea);};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x26')]=function(_0x610652){try{if(this[_0x9630('0x30')](_0x610652)){if(_0x610652[_0x9630('0x32')]===_0x610652[_0x9630('0x33')]){if(!_[_0x9630('0x34')](this[_0x9630('0x18')][_0x610652[_0x9630('0x32')]])){_[_0x9630('0x35')](this[_0x9630('0x18')][_0x610652['uniqueid']],_[_0x9630('0x36')](_0x610652,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x610652[_0x9630('0x32')]])));}}}}catch(_0x3b08b2){logger[_0x9630('0x38')]('[syncNewCallerId][VoiceCallReport]',util[_0x9630('0x39')](_0x3b08b2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x1e')]=function(_0x2b869f){try{if(this[_0x9630('0x30')](_0x2b869f)){if(_0x2b869f['uniqueid']===_0x2b869f[_0x9630('0x33')]&&_0x2b869f[_0x9630('0x3a')]!=_0x9630('0x3b')){if(_[_0x9630('0x34')](this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]])){this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]]=new Channel();this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]][_0x9630('0x3c')]=moment()[_0x9630('0x3d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2b869f[_0x9630('0x32')]][_0x9630('0x3e')]=dispositions[_['toNumber'](_0x2b869f['channelstate'])];_['merge'](this['channels'][_0x2b869f[_0x9630('0x32')]],_[_0x9630('0x36')](_0x2b869f,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x2b869f[_0x9630('0x32')]])));if(_0x2b869f[_0x9630('0x3f')]==='from-sip'){if(this['agents'][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]){this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['destconnectedlinenum']=_0x2b869f['exten'];this['emit'](util['format'](_0x9630('0x41'),this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')]),_0x9630('0x43'),{'destaccountcode':this[_0x9630('0x19')][_0x2b869f[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2b869f[_0x9630('0x44')]});}}}}}}catch(_0x5b21b3){logger[_0x9630('0x38')]('[syncNewChannel][VoiceCallReport]',util[_0x9630('0x39')](_0x5b21b3,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x1a')]=function(_0x42bb23){try{if(this['isNotNull'](_0x42bb23)){if(_0x42bb23[_0x9630('0x32')]===_0x42bb23[_0x9630('0x33')]&&_0x42bb23['exten']!='h'&&_0x42bb23[_0x9630('0x3a')]!=_0x9630('0x3b')){_0x42bb23[_0x9630('0x45')]=_0x42bb23[_0x9630('0x45')][_0x9630('0x46')]();_0x42bb23[_0x9630('0x47')]=(_0x42bb23['appdata']||_0x42bb23[_0x9630('0x47')])[_0x9630('0x46')]();if(_['isUndefined'](this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]])){this[_0x9630('0x18')][_0x42bb23['uniqueid']]=new Channel();this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x3c')]=_0x42bb23[_0x9630('0x48')]?moment()['subtract'](moment[_0x9630('0x48')](_0x42bb23[_0x9630('0x48')])[_0x9630('0x49')](),_0x9630('0x49'))[_0x9630('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format'](_0x9630('0x4a'));this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x3e')]='NO\x20ANSWER';}_[_0x9630('0x35')](this['channels'][_0x42bb23[_0x9630('0x32')]],_[_0x9630('0x36')](_0x42bb23,_[_0x9630('0x37')](this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]])));if(_[_0x9630('0x4b')](applications,_0x42bb23[_0x9630('0x45')])){this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]]['lastapplication']=_0x42bb23[_0x9630('0x45')];this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0x4c')]=_0x42bb23[_0x9630('0x47')];if(_0x42bb23[_0x9630('0x45')]===_0x9630('0xe')&&_['startsWith'](_0x42bb23[_0x9630('0x47')],_0x9630('0x4d'))){var _0x75b494=_0x42bb23[_0x9630('0x47')][_0x9630('0x40')]('=');var _0xa54423=_0x75b494[0x0][_0x9630('0x4e')](/cdr\((.*)\)/);if(_0xa54423){this[_0x9630('0x18')][_0x42bb23['uniqueid']][_0xa54423[0x1]]=_0x75b494[0x1];}}else if(_0x42bb23['application']===_0x9630('0xf')){this[_0x9630('0x18')][_0x42bb23[_0x9630('0x32')]][_0x9630('0xf')]=_0x42bb23[_0x9630('0x47')][_0x9630('0x40')](',')[0x0];}}}}}catch(_0x4375f1){logger[_0x9630('0x38')]('[syncNewExten][VoiceCallReport]',util[_0x9630('0x39')](_0x4375f1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewState']=function(_0x59c3dd){try{if(this['isNotNull'](_0x59c3dd)){if(_0x59c3dd['uniqueid']!==_0x59c3dd[_0x9630('0x33')]){if(this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]){if(_0x59c3dd[_0x9630('0x4f')]==='6'){if(!this[_0x9630('0x18')][_0x59c3dd['linkedid']]['answered']){this['channels'][_0x59c3dd['linkedid']][_0x9630('0x50')]=!![];this['channels'][_0x59c3dd['linkedid']]['answertime']=moment()[_0x9630('0x3d')](_0x9630('0x4a'));}this[_0x9630('0x18')][_0x59c3dd['linkedid']]['linkedid']=_0x59c3dd[_0x9630('0x32')];if(_0x59c3dd['calleridnum']!==_0x9630('0x51')){this['channels'][_0x59c3dd[_0x9630('0x33')]][_0x9630('0x52')]=_0x59c3dd[_0x9630('0x53')];}this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]['connectedlinename']=_0x59c3dd[_0x9630('0x54')];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]]['destinationchannel']=_0x59c3dd[_0x9630('0x3a')];this['channels'][_0x59c3dd['linkedid']][_0x9630('0x3e')]=dispositions[_['toNumber'](_0x59c3dd[_0x9630('0x4f')])];if(this['agents'][_0x59c3dd['channel'][_0x9630('0x40')]('-')[0x0]]){this[_0x9630('0x18')][_0x59c3dd['linkedid']]['UserId']=this['agents'][_0x59c3dd['channel'][_0x9630('0x40')]('-')[0x0]]['id'];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x33')]][_0x9630('0x55')]=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')];}}}}else{if(this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x32')]]){if(_0x59c3dd[_0x9630('0x4f')]==='6'){if(this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')]['split']('-')[0x0]]){this['channels'][_0x59c3dd['uniqueid']][_0x9630('0x56')]=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['id'];this[_0x9630('0x18')][_0x59c3dd[_0x9630('0x32')]]['membername']=this[_0x9630('0x19')][_0x59c3dd[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]['name'];}}}}}}catch(_0x632727){logger[_0x9630('0x38')](_0x9630('0x57'),util[_0x9630('0x39')](_0x632727,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x58')]=function(_0x49643c,_0x305a12){if(this[_0x9630('0x18')][_0x49643c]){this[_0x9630('0x18')][_0x49643c][_0x9630('0x59')]=!![];if(_['endsWith'](_0x305a12,_0x9630('0x5a'))){_0x305a12=_0x305a12[_0x9630('0x5b')](_0x9630('0x5a'),_0x9630('0x5c'));}this[_0x9630('0x18')][_0x49643c][_0x9630('0x5d')]=_0x305a12;var _0x1afc29=_[_0x9630('0x5e')](this[_0x9630('0x18')][_0x49643c][_0x9630('0x5f')],{'filename':_0x305a12});if(_[_0x9630('0x60')](_0x1afc29)){this[_0x9630('0x18')][_0x49643c][_0x9630('0x5f')][_0x9630('0x61')]({'filename':_0x305a12,'createdAt':moment()[_0x9630('0x3d')](_0x9630('0x4a')),'mixmonitorid':'','status':_0x9630('0x62')});}}};VoiceCallReport[_0x9630('0x2f')]['syncVarSet']=function(_0xafb625){try{if(this[_0x9630('0x30')](_0xafb625)){if(this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]]&&_0xafb625['channel']!='OutgoingSpoolFailed'){if(this[_0x9630('0x30')](_0xafb625['variable'])){if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x64')])){this[_0x9630('0x58')](_0xafb625['uniqueid'],_0xafb625[_0x9630('0x65')]);}else if(this['isNotNull'](_0xafb625['variable'][_0x9630('0x66')])){this[_0x9630('0x18')][_0xafb625['uniqueid']][_0x9630('0x53')]=_0xafb625[_0x9630('0x65')];}else if(this['isNotNull'](_0xafb625['variable'][_0x9630('0x67')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0x68')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625['variable'][_0x9630('0x69')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0x6a')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6b')])){this['channels'][_0xafb625['uniqueid']][_0x9630('0xf')]=_0xafb625[_0x9630('0x65')][_0x9630('0x40')](',')[0x0];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6c')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]]['originatecalleridnum']=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6d')])){this['channels'][_0xafb625[_0x9630('0x32')]][_0x9630('0x6e')]=_0xafb625['value'];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x6f')])){this['channels'][_0xafb625['uniqueid']][_0x9630('0x70')]=_0xafb625[_0x9630('0x65')];}else if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x71')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x32')]][_0x9630('0xf')]=_0xafb625[_0x9630('0x65')];}else if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')][_0x9630('0x72')])){this[_0x9630('0x18')][_0xafb625['uniqueid']][_0x9630('0x73')]=_0xafb625['value'];}}}else if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x64')])){if(_0xafb625[_0x9630('0x65')]){var _0x18d871=path[_0x9630('0x74')](_0xafb625[_0x9630('0x65')])['name'];this[_0x9630('0x58')](_0x18d871,_0xafb625[_0x9630('0x65')]);}}else if(this[_0x9630('0x18')][_0xafb625[_0x9630('0x33')]]){if(this[_0x9630('0x30')](_0xafb625[_0x9630('0x63')])){if(this['isNotNull'](_0xafb625[_0x9630('0x63')][_0x9630('0x72')])){this[_0x9630('0x18')][_0xafb625[_0x9630('0x33')]][_0x9630('0x75')]=_0xafb625['value'];}}}}}catch(_0x3e5022){logger['error'](_0x9630('0x76'),util[_0x9630('0x39')](_0x3e5022,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x24')]=function(_0xd710e2){try{if(this[_0x9630('0x30')](_0xd710e2)){if(this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]){var _0x5ec366=moment();this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x77')]=_0x5ec366['format'](_0x9630('0x4a'));this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]['duration']=_0x5ec366[_0x9630('0x78')](this['channels'][_0xd710e2['uniqueid']][_0x9630('0x3c')],_0x9630('0x49'));if(this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x50')]){this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x79')]=_0x5ec366['diff'](this[_0x9630('0x18')][_0xd710e2['uniqueid']][_0x9630('0x7a')],_0x9630('0x49'));this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x7b')]=this['channels'][_0xd710e2[_0x9630('0x32')]][_0x9630('0x48')]-this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]][_0x9630('0x79')];}if(_0xd710e2[_0x9630('0x3f')]===_0x9630('0x7c')){if(this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]]){this['agents'][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]]=_[_0x9630('0x7d')](this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]],[_0x9630('0x7e')]);this['emit'](util[_0x9630('0x3d')](_0x9630('0x41'),this[_0x9630('0x19')][_0xd710e2[_0x9630('0x3a')]['split']('-')[0x0]][_0x9630('0x42')]),_0x9630('0x7f'),{'destaccountcode':this['agents'][_0xd710e2[_0x9630('0x3a')][_0x9630('0x40')]('-')[0x0]][_0x9630('0x80')]});}}ami[_0x9630('0x31')](_0x9630('0x81'),this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]]);delete this[_0x9630('0x18')][_0xd710e2[_0x9630('0x32')]];}}}catch(_0x2479e0){logger[_0x9630('0x38')](_0x9630('0x82'),util[_0x9630('0x39')](_0x2479e0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x28')]=function(_0x3992c2){try{if(this[_0x9630('0x30')](_0x3992c2)){if(this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]]){this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]][_0x9630('0x84')]=_0x3992c2[_0x9630('0x85')];this[_0x9630('0x18')][_0x3992c2[_0x9630('0x83')]][_0x9630('0x86')]=_0x3992c2['transfertargetcalleridnum'];var _0x1cb720=this[_0x9630('0x18')][_0x3992c2[_0x9630('0x87')]];this[_0x9630('0x18')][_0x3992c2['secondtransfereruniqueid']]=this['channels'][_0x3992c2[_0x9630('0x83')]];this[_0x9630('0x18')][_0x3992c2['transfereeuniqueid']]=_0x1cb720;}}}catch(_0x43805e){logger[_0x9630('0x38')](_0x9630('0x88'),util[_0x9630('0x39')](_0x43805e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x9630('0x89')]=function(_0x409fcc){try{if(this[_0x9630('0x30')](_0x409fcc)){if(this['channels'][_0x409fcc[_0x9630('0x83')]]){this[_0x9630('0x18')][_0x409fcc[_0x9630('0x83')]]['transfercalleridnum']=_0x409fcc['transfereecalleridnum'];this['channels'][_0x409fcc[_0x9630('0x83')]]['transferconnectedlinenum']=_0x409fcc[_0x9630('0x8a')];this[_0x9630('0x24')]({'event':_0x9630('0x8b'),'uniqueid':_0x409fcc[_0x9630('0x83')],'context':_0x409fcc[_0x9630('0x3f')],'channel':_0x409fcc[_0x9630('0x8c')]});}}}catch(_0x5f377d){logger[_0x9630('0x38')](_0x9630('0x8d'),util[_0x9630('0x39')](_0x5f377d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStart']=function(_0x458a9e){try{if(this[_0x9630('0x30')](_0x458a9e)){if(this[_0x9630('0x18')][_0x458a9e[_0x9630('0x32')]]){if(!_[_0x9630('0x60')](this[_0x9630('0x18')][_0x458a9e['uniqueid']]['answertime'])){this[_0x9630('0x18')][_0x458a9e[_0x9630('0x32')]]['mohstarttime']=moment()['format'](_0x9630('0x4a'));}}}}catch(_0x296b94){logger[_0x9630('0x38')]('[syncMusicOnHoldStart][VoiceCallReport]',util['inspect'](_0x296b94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x9630('0x2f')][_0x9630('0x2c')]=function(_0x47320b){try{if(this['isNotNull'](_0x47320b)){if(this[_0x9630('0x18')][_0x47320b[_0x9630('0x32')]]){if(!_[_0x9630('0x60')](this[_0x9630('0x18')][_0x47320b[_0x9630('0x32')]][_0x9630('0x8e')])){this['channels'][_0x47320b['uniqueid']]['mohtime']+=moment()[_0x9630('0x8f')](0x0)[_0x9630('0x78')](this[_0x9630('0x18')][_0x47320b['uniqueid']]['mohstarttime'],'seconds');delete this[_0x9630('0x18')][_0x47320b['uniqueid']][_0x9630('0x8e')];}}}}catch(_0x118d10){logger[_0x9630('0x38')]('[syncMusicOnHoldStop][VoiceCallReport]',util['inspect'](_0x118d10,{'showHidden':![],'depth':null}));}};module[_0x9630('0x90')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index eed9bb8..b91641d 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x38ca=['called','channel','substring','lastIndexOf','omit','event','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','syncDialEnd','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','custom:dialconnect','[syncDialEnd][VoiceDialReport]','addVariable','keys','variable','outboundrouteid','[syncVarSet][VoiceDialReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','endtime','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumHoldTime','sumBillable','custom:dialend','voice_outbound:save','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','util','../ami','socket.io-emitter','localhost','channels','outboundChannels','outbound','variables','syncDialBegin','bind','varset','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','uniqueid','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x19ccea,_0x5056b2){var _0x149dd4=function(_0x5bea14){while(--_0x5bea14){_0x19ccea['push'](_0x19ccea['shift']());}};_0x149dd4(++_0x5056b2);}(_0x38ca,0x84));var _0xa38c=function(_0xe13339,_0x5d1dc2){_0xe13339=_0xe13339-0x0;var _0x550e7c=_0x38ca[_0xe13339];return _0x550e7c;};'use strict';var _=require(_0xa38c('0x0'));var moment=require('moment');var util=require(_0xa38c('0x1'));var logger=require('../../../config/logger')('ami');var ami=require(_0xa38c('0x2'));var io=require(_0xa38c('0x3'))({'host':_0xa38c('0x4'),'port':0x18eb});function VoiceDialReport(_0x2ff933){this[_0xa38c('0x5')]=_0x2ff933[_0xa38c('0x6')];this[_0xa38c('0x7')]=_0x2ff933[_0xa38c('0x7')];this[_0xa38c('0x8')]={};ami['on']('dialbegin',this[_0xa38c('0x9')][_0xa38c('0xa')](this));ami['on']('dialend',this['syncDialEnd'][_0xa38c('0xa')](this));ami['on'](_0xa38c('0xb'),this['syncVarSet'][_0xa38c('0xa')](this));ami['on'](_0xa38c('0xc'),this[_0xa38c('0xd')][_0xa38c('0xa')](this));}VoiceDialReport['prototype'][_0xa38c('0xe')]=function(_0x1ab92d){return _0x1ab92d!==null&&!_[_0xa38c('0xf')](_0x1ab92d);};VoiceDialReport[_0xa38c('0x10')][_0xa38c('0x11')]=function(_0x28685c,_0x4bdc77,_0x24f8ea){io['to'](_0x28685c)[_0xa38c('0x11')](_0x4bdc77,_0x24f8ea);};VoiceDialReport[_0xa38c('0x10')]['syncDialBegin']=function(_0x264592){try{if(this[_0xa38c('0xe')](_0x264592)){if(this[_0xa38c('0x5')][_0x264592[_0xa38c('0x12')]]){_['merge'](this[_0xa38c('0x5')][_0x264592['uniqueid']],{'starttime':moment()['format'](_0xa38c('0x13')),'lastevent':_0xa38c('0x14'),'interface':_0x264592[_0xa38c('0x15')][_0xa38c('0x16')](0x0,_0x264592[_0xa38c('0x15')][_0xa38c('0x17')]('-')),'membername':_0x264592[_0xa38c('0x15')][_0xa38c('0x16')](_0x264592[_0xa38c('0x15')][_0xa38c('0x17')]('/')+0x1,_0x264592[_0xa38c('0x15')]['lastIndexOf']('-'))},_[_0xa38c('0x18')](_0x264592,[_0xa38c('0x19'),'privilege']));this[_0xa38c('0x11')](_0xa38c('0x1a'),_0xa38c('0x1b'),this[_0xa38c('0x5')][_0x264592[_0xa38c('0x12')]]);ami[_0xa38c('0x11')](_0xa38c('0x1c'),this[_0xa38c('0x5')][_0x264592[_0xa38c('0x12')]]);}}}catch(_0xaa8c35){logger[_0xa38c('0x1d')](_0xa38c('0x1e'),util[_0xa38c('0x1f')](_0xaa8c35,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa38c('0x10')][_0xa38c('0x20')]=function(_0x233837){try{if(this[_0xa38c('0xe')](_0x233837)){if(this[_0xa38c('0x5')][_0x233837[_0xa38c('0x12')]]){this[_0xa38c('0x5')][_0x233837['uniqueid']]['dialstatus']=_0x233837[_0xa38c('0x21')];if(_0x233837['dialstatus']==='ANSWER'){this[_0xa38c('0x5')][_0x233837[_0xa38c('0x12')]][_0xa38c('0x22')]=_0x233837['connectedlinenum'];this[_0xa38c('0x5')][_0x233837['uniqueid']]['connectedlinename']=_0x233837[_0xa38c('0x23')];this[_0xa38c('0x5')][_0x233837[_0xa38c('0x12')]][_0xa38c('0x24')]=moment()[_0xa38c('0x25')](_0xa38c('0x13'));this[_0xa38c('0x5')][_0x233837['uniqueid']][_0xa38c('0x26')]='connect';ami['emit'](_0xa38c('0x27'),this[_0xa38c('0x5')][_0x233837[_0xa38c('0x12')]]);}this[_0xa38c('0x11')]('voice:outbound',_0xa38c('0x1b'),this['channels'][_0x233837['uniqueid']]);}}}catch(_0x256798){logger['error'](_0xa38c('0x28'),util['inspect'](_0x256798,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncVarSet']=function(_0x5b7ed9){try{if(this[_0xa38c('0xe')](_0x5b7ed9)){this[_0xa38c('0x29')](_0x5b7ed9[_0xa38c('0x12')],_[_0xa38c('0x2a')](_0x5b7ed9[_0xa38c('0x2b')])[0x0],_0x5b7ed9['value']);if(this[_0xa38c('0xe')](_0x5b7ed9['variable'])&&this[_0xa38c('0xe')](_0x5b7ed9['variable'][_0xa38c('0x2c')])){if(_['isUndefined'](this[_0xa38c('0x5')][_0x5b7ed9[_0xa38c('0x12')]])){this[_0xa38c('0x5')][_0x5b7ed9['uniqueid']]={'routeId':_0x5b7ed9['value'],'variables':this[_0xa38c('0x8')][_0x5b7ed9[_0xa38c('0x12')]]};this['emit'](_0xa38c('0x1a'),'voice_outbound_channel:save',this[_0xa38c('0x5')][_0x5b7ed9['uniqueid']]);}}}}catch(_0x36ba8f){logger[_0xa38c('0x1d')](_0xa38c('0x2d'),util['inspect'](_0x36ba8f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa38c('0x29')]=function(_0x1c24ee,_0x301525,_0x24d9b1){var _0x33e0fd=['rtpaudioqos',_0xa38c('0x2e'),_0xa38c('0x2f'),_0xa38c('0x30'),_0xa38c('0x31'),_0xa38c('0x32'),_0xa38c('0x33'),_0xa38c('0x34'),'sipcallid',_0xa38c('0x35'),_0xa38c('0x36'),_0xa38c('0x37'),_0xa38c('0x38'),'memberdynamic',_0xa38c('0x39'),_0xa38c('0x3a'),_0xa38c('0x3b'),_0xa38c('0x3c'),_0xa38c('0x3d')];if(!_['isNil'](_0x301525)&&!_['includes'](_0x33e0fd,_0x301525)){if(_[_0xa38c('0xf')](this[_0xa38c('0x8')][_0x1c24ee])){this[_0xa38c('0x8')][_0x1c24ee]={};}this['variables'][_0x1c24ee][_0x301525]=_0x24d9b1;}};VoiceDialReport[_0xa38c('0x10')][_0xa38c('0xd')]=function(_0x1f399d){try{if(this[_0xa38c('0xe')](_0x1f399d)){if(this[_0xa38c('0x5')][_0x1f399d['uniqueid']]){this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]][_0xa38c('0x3e')]=moment()[_0xa38c('0x25')](_0xa38c('0x13'));this['channels'][_0x1f399d[_0xa38c('0x12')]]['duration']=moment(this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]]['endtime'])[_0xa38c('0x3f')](this['channels'][_0x1f399d['uniqueid']][_0xa38c('0x40')],_0xa38c('0x41'));this['channels'][_0x1f399d['uniqueid']][_0xa38c('0x26')]=_0xa38c('0x42');this[_0xa38c('0x7')]['total']+=0x1;if(this[_0xa38c('0x5')][_0x1f399d['uniqueid']]['answertime']){this[_0xa38c('0x7')][_0xa38c('0x43')]+=0x1;this[_0xa38c('0x5')][_0x1f399d['uniqueid']][_0xa38c('0x44')]=moment(this[_0xa38c('0x5')][_0x1f399d['uniqueid']][_0xa38c('0x24')])[_0xa38c('0x3f')](this['channels'][_0x1f399d[_0xa38c('0x12')]][_0xa38c('0x40')],'seconds');this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]][_0xa38c('0x45')]=moment(this[_0xa38c('0x5')][_0x1f399d['uniqueid']][_0xa38c('0x3e')])['diff'](this[_0xa38c('0x5')][_0x1f399d['uniqueid']]['answertime'],_0xa38c('0x41'));this['outbound'][_0xa38c('0x46')]+=this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]][_0xa38c('0x44')]||0x0;this[_0xa38c('0x7')][_0xa38c('0x47')]+=this[_0xa38c('0x5')][_0x1f399d['uniqueid']][_0xa38c('0x45')];}this[_0xa38c('0x7')]['sumDuration']+=this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]]['duration'];ami[_0xa38c('0x11')]('custom:voiceDialReport',this[_0xa38c('0x5')][_0x1f399d['uniqueid']]);ami[_0xa38c('0x11')](_0xa38c('0x48'),this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]]);this[_0xa38c('0x11')](_0xa38c('0x1a'),_0xa38c('0x49'),this[_0xa38c('0x7')]);this[_0xa38c('0x11')](_0xa38c('0x1a'),_0xa38c('0x4a'),this[_0xa38c('0x5')][_0x1f399d[_0xa38c('0x12')]]);delete this['channels'][_0x1f399d[_0xa38c('0x12')]];}if(this[_0xa38c('0x8')][_0x1f399d[_0xa38c('0x12')]]){delete this['variables'][_0x1f399d[_0xa38c('0x12')]];}}}catch(_0x492737){logger['error'](_0xa38c('0x4b'),util[_0xa38c('0x1f')](_0x492737,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0x9214=['answered','holdtime','diff','starttime','sumBillable','billableseconds','sumDuration','custom:dialend','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','lodash','moment','util','../../../config/logger','ami','../ami','socket.io-emitter','localhost','channels','outbound','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','syncVarSet','hangup','syncHangup','prototype','isNotNull','merge','uniqueid','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','emit','voice_outbound_channel:save','custom:dialbegin','error','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','voice:outbound','inspect','addVariable','keys','variable','value','isUndefined','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil','endtime','duration','lastevent','complete','total'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0x9214,0xaa));var _0x4921=function(_0x81fee8,_0x32f097){_0x81fee8=_0x81fee8-0x0;var _0x2b2c4e=_0x9214[_0x81fee8];return _0x2b2c4e;};'use strict';var _=require(_0x4921('0x0'));var moment=require(_0x4921('0x1'));var util=require(_0x4921('0x2'));var logger=require(_0x4921('0x3'))(_0x4921('0x4'));var ami=require(_0x4921('0x5'));var io=require(_0x4921('0x6'))({'host':_0x4921('0x7'),'port':0x18eb});function VoiceDialReport(_0x1cb841){this[_0x4921('0x8')]=_0x1cb841['outboundChannels'];this[_0x4921('0x9')]=_0x1cb841[_0x4921('0x9')];this[_0x4921('0xa')]={};ami['on'](_0x4921('0xb'),this[_0x4921('0xc')][_0x4921('0xd')](this));ami['on'](_0x4921('0xe'),this[_0x4921('0xf')][_0x4921('0xd')](this));ami['on']('varset',this[_0x4921('0x10')]['bind'](this));ami['on'](_0x4921('0x11'),this[_0x4921('0x12')][_0x4921('0xd')](this));}VoiceDialReport[_0x4921('0x13')]['isNotNull']=function(_0x22b7ed){return _0x22b7ed!==null&&!_['isUndefined'](_0x22b7ed);};VoiceDialReport[_0x4921('0x13')]['emit']=function(_0xfc467d,_0xf6d825,_0x50303b){io['to'](_0xfc467d)['emit'](_0xf6d825,_0x50303b);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x6cb4a){try{if(this[_0x4921('0x14')](_0x6cb4a)){if(this[_0x4921('0x8')][_0x6cb4a['uniqueid']]){_[_0x4921('0x15')](this['channels'][_0x6cb4a[_0x4921('0x16')]],{'starttime':moment()['format'](_0x4921('0x17')),'lastevent':_0x4921('0x18'),'interface':_0x6cb4a[_0x4921('0x19')][_0x4921('0x1a')](0x0,_0x6cb4a[_0x4921('0x19')]['lastIndexOf']('-')),'membername':_0x6cb4a[_0x4921('0x19')][_0x4921('0x1a')](_0x6cb4a['channel']['lastIndexOf']('/')+0x1,_0x6cb4a['channel'][_0x4921('0x1b')]('-'))},_[_0x4921('0x1c')](_0x6cb4a,[_0x4921('0x1d'),_0x4921('0x1e')]));this[_0x4921('0x1f')]('voice:outbound',_0x4921('0x20'),this['channels'][_0x6cb4a[_0x4921('0x16')]]);ami['emit'](_0x4921('0x21'),this['channels'][_0x6cb4a[_0x4921('0x16')]]);}}}catch(_0x5948ab){logger[_0x4921('0x22')]('[syncDialBegin][VoiceDialReport]',util['inspect'](_0x5948ab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0xf')]=function(_0x4340cb){try{if(this[_0x4921('0x14')](_0x4340cb)){if(this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]){this['channels'][_0x4340cb[_0x4921('0x16')]][_0x4921('0x23')]=_0x4340cb[_0x4921('0x23')];if(_0x4340cb[_0x4921('0x23')]===_0x4921('0x24')){this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]][_0x4921('0x25')]=_0x4340cb[_0x4921('0x25')];this['channels'][_0x4340cb[_0x4921('0x16')]][_0x4921('0x26')]=_0x4340cb[_0x4921('0x26')];this[_0x4921('0x8')][_0x4340cb['uniqueid']][_0x4921('0x27')]=moment()[_0x4921('0x28')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]['lastevent']='connect';ami['emit']('custom:dialconnect',this['channels'][_0x4340cb[_0x4921('0x16')]]);}this[_0x4921('0x1f')](_0x4921('0x29'),_0x4921('0x20'),this[_0x4921('0x8')][_0x4340cb[_0x4921('0x16')]]);}}}catch(_0x2d402d){logger[_0x4921('0x22')]('[syncDialEnd][VoiceDialReport]',util[_0x4921('0x2a')](_0x2d402d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x10')]=function(_0x2d4aa3){try{if(this[_0x4921('0x14')](_0x2d4aa3)){this[_0x4921('0x2b')](_0x2d4aa3['uniqueid'],_[_0x4921('0x2c')](_0x2d4aa3[_0x4921('0x2d')])[0x0],_0x2d4aa3[_0x4921('0x2e')]);if(this['isNotNull'](_0x2d4aa3[_0x4921('0x2d')])&&this[_0x4921('0x14')](_0x2d4aa3['variable']['outboundrouteid'])){if(_[_0x4921('0x2f')](this['channels'][_0x2d4aa3[_0x4921('0x16')]])){this['channels'][_0x2d4aa3[_0x4921('0x16')]]={'routeId':_0x2d4aa3[_0x4921('0x2e')],'variables':this['variables'][_0x2d4aa3['uniqueid']]};this['emit']('voice:outbound','voice_outbound_channel:save',this['channels'][_0x2d4aa3[_0x4921('0x16')]]);}}}}catch(_0x669a8a){logger[_0x4921('0x22')](_0x4921('0x30'),util[_0x4921('0x2a')](_0x669a8a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x2b')]=function(_0x1e5078,_0x115a38,_0x2fad67){var _0x225d11=[_0x4921('0x31'),'rtpaudioqosbridged',_0x4921('0x32'),_0x4921('0x33'),_0x4921('0x34'),'rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged',_0x4921('0x35'),_0x4921('0x36'),_0x4921('0x37'),_0x4921('0x38'),_0x4921('0x39'),_0x4921('0x3a'),_0x4921('0x3b'),_0x4921('0x3c'),_0x4921('0x3d'),_0x4921('0x3e'),_0x4921('0x3f')];if(!_[_0x4921('0x40')](_0x115a38)&&!_['includes'](_0x225d11,_0x115a38)){if(_[_0x4921('0x2f')](this['variables'][_0x1e5078])){this[_0x4921('0xa')][_0x1e5078]={};}this[_0x4921('0xa')][_0x1e5078][_0x115a38]=_0x2fad67;}};VoiceDialReport[_0x4921('0x13')][_0x4921('0x12')]=function(_0x156619){try{if(this[_0x4921('0x14')](_0x156619)){if(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]]){this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')]=moment()[_0x4921('0x28')](_0x4921('0x17'));this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x42')]=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')])['diff'](this['channels'][_0x156619['uniqueid']]['starttime'],'seconds');this['channels'][_0x156619['uniqueid']][_0x4921('0x43')]=_0x4921('0x44');this[_0x4921('0x9')][_0x4921('0x45')]+=0x1;if(this['channels'][_0x156619[_0x4921('0x16')]][_0x4921('0x27')]){this[_0x4921('0x9')][_0x4921('0x46')]+=0x1;this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x47')]=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x27')])[_0x4921('0x48')](this['channels'][_0x156619[_0x4921('0x16')]][_0x4921('0x49')],'seconds');this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]]['billableseconds']=moment(this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x41')])[_0x4921('0x48')](this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x27')],'seconds');this[_0x4921('0x9')]['sumHoldTime']+=this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x47')]||0x0;this[_0x4921('0x9')][_0x4921('0x4a')]+=this[_0x4921('0x8')][_0x156619['uniqueid']][_0x4921('0x4b')];}this[_0x4921('0x9')][_0x4921('0x4c')]+=this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]][_0x4921('0x42')];ami[_0x4921('0x1f')]('custom:voiceDialReport',this[_0x4921('0x8')][_0x156619['uniqueid']]);ami[_0x4921('0x1f')](_0x4921('0x4d'),this[_0x4921('0x8')][_0x156619['uniqueid']]);this['emit'](_0x4921('0x29'),'voice_outbound:save',this[_0x4921('0x9')]);this[_0x4921('0x1f')](_0x4921('0x29'),_0x4921('0x4e'),this['channels'][_0x156619['uniqueid']]);delete this[_0x4921('0x8')][_0x156619[_0x4921('0x16')]];}if(this['variables'][_0x156619[_0x4921('0x16')]]){delete this[_0x4921('0xa')][_0x156619[_0x4921('0x16')]];}}}catch(_0x1727f1){logger[_0x4921('0x22')](_0x4921('0x4f'),util[_0x4921('0x2a')](_0x1727f1,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index cbbdb66..4cd4c0c 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1b0=['push','last','holdtime','originalposition','queuecallerexitreason','ABANDONED','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','[syncQueueCallerLeave][VoiceQueueReport]','queuecallerabandonAt','assigned','membername','','startsWith','interface','toLowerCase','transfer','queuecallerexit','queuecallerexitAt','add','seconds','FORWARD','destexten','transferuniqueid','fullname','accountcode','destcalleridname','queuecallercomplete','queuecallercompleteAt','reason','COMPLETEDBY','toUpperCase','syncVarSet','addVariable','variable','value','queuestatus','CONTINUE','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberrealtime','length','diff','milliseconds','answered','lastevent','custom:queuecallerunmanaged','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','transfertargetuniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','[syncAttendedTransfer][VoiceQueueReport]','syncBlindTransfer','BLINDTRANSFER','BLIND','extension','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','[syncMusicOnHoldStop][VoiceQueueReport]','exports','lodash','bluebird','util','md5','../../../config/logger','ami','socket.io-emitter','localhost','prototype','enqueue','tail','queueReports','agents','channels','queueChannels','flagQueueSummary','campaigns','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','varset','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isUndefined','hasOwnProperty','originated','isEmpty','waiting','queueStatusComplete','unlockRR','clearZombieChannels','sequence','isNil','status','catch','No\x20such\x20channel','error','[voiceQueueReport][checkQueueReport]','variables','[voiceQueueReport][checkVariables]','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','name','voice_queue_channel:save','format','voice:queue:%s','emitVoiceQueueSummary','type','inbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','Trunk','active','Interval','voice_queue:save','queues','[queues]','Action','queuesummary','[queuesummary]','isNotNull','queue','countBy','callers','loggedin','toNumber','custom:queuesummary','inspect','syncQueueCallerJoin','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','pick','keys'];(function(_0x5556ec,_0x2c4323){var _0x1886b8=function(_0x4b6136){while(--_0x4b6136){_0x5556ec['push'](_0x5556ec['shift']());}};_0x1886b8(++_0x2c4323);}(_0xc1b0,0x10f));var _0x0c1b=function(_0x50cd41,_0x4874a7){_0x50cd41=_0x50cd41-0x0;var _0x399475=_0xc1b0[_0x50cd41];return _0x399475;};'use strict';var _=require(_0x0c1b('0x0'));var moment=require('moment');var BPromise=require(_0x0c1b('0x1'));var util=require(_0x0c1b('0x2'));var md5=require(_0x0c1b('0x3'));var logger=require(_0x0c1b('0x4'))(_0x0c1b('0x5'));var ami=require('../ami');var QueueReport=require('../model/queueReport');var io=require(_0x0c1b('0x6'))({'host':_0x0c1b('0x7'),'port':0x18eb});var Sequence=function(){};Sequence[_0x0c1b('0x8')][_0x0c1b('0x9')]=function(_0x1fa159){this[_0x0c1b('0xa')]=this[_0x0c1b('0xa')]?this[_0x0c1b('0xa')]['finally'](_0x1fa159):_0x1fa159();};function VoiceQueueReport(_0x1c9e8a){this['sequence']=new Sequence();this[_0x0c1b('0xb')]={};this['agents']=_0x1c9e8a[_0x0c1b('0xc')];this[_0x0c1b('0xd')]=_0x1c9e8a[_0x0c1b('0xe')];this['voiceQueues']=_0x1c9e8a['voiceQueues'];this[_0x0c1b('0xf')]=!![];this['campaigns']=_0x1c9e8a[_0x0c1b('0x10')];this['variables']={};ami['on']('queuesummary',this[_0x0c1b('0x11')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x13'),this[_0x0c1b('0x14')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x15'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0x0c1b('0x16'),this[_0x0c1b('0x17')]['bind'](this));ami['on'](_0x0c1b('0x18'),this[_0x0c1b('0x19')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x1a'),this[_0x0c1b('0x1b')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x1c'),this['syncVarSet'][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x1d'),this[_0x0c1b('0x1e')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x1f'),this[_0x0c1b('0x20')][_0x0c1b('0x12')](this));ami['on']('musiconholdstart',this[_0x0c1b('0x21')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x22'),this[_0x0c1b('0x23')][_0x0c1b('0x12')](this));ami['on'](_0x0c1b('0x24'),this[_0x0c1b('0x25')]['bind'](this));ami['on'](_0x0c1b('0x26'),this['syncBlindTransfer'][_0x0c1b('0x12')](this));this[_0x0c1b('0x27')]();this[_0x0c1b('0x28')]();}function isNotNull(_0x59f412){return _0x59f412!==null&&!_[_0x0c1b('0x29')](_0x59f412);}function clearChannels(_0x2d6c7f){if(!_['isEmpty'](_0x2d6c7f)){for(var _0x405fb2 in _0x2d6c7f){if(_0x2d6c7f[_0x0c1b('0x2a')](_0x405fb2)){delete _0x2d6c7f[_0x405fb2];}}}}function clearCampaigns(_0x3b6ebb){if(!_['isEmpty'](_0x3b6ebb)){for(var _0x3a8399 in _0x3b6ebb){if(_0x3b6ebb[_0x0c1b('0x2a')](_0x3a8399)){_0x3b6ebb[_0x3a8399][_0x0c1b('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x438083){if(!_[_0x0c1b('0x2c')](_0x438083)){for(var _0x4aaa29 in _0x438083){if(_0x438083[_0x0c1b('0x2a')](_0x4aaa29)){_0x438083[_0x4aaa29]['originated']=0x0;_0x438083[_0x4aaa29]['talking']=0x0;_0x438083[_0x4aaa29]['pTalking']=0x0;_0x438083[_0x4aaa29][_0x0c1b('0x2d')]=0x0;_0x438083[_0x4aaa29][_0x0c1b('0x2e')]=!![];}}}}function clearAgentBooked(_0x46521f){if(!_[_0x0c1b('0x2c')](_0x46521f)){for(var _0x3508e5 in _0x46521f){if(_0x46521f['hasOwnProperty'](_0x3508e5)){_0x46521f[_0x3508e5][_0x0c1b('0x2f')]=!![];}}}}VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x30')]=function(){var _0x513522=this;for(var _0x59363b in this['channels']){if(this[_0x0c1b('0xd')][_0x0c1b('0x2a')](_0x59363b)){this[_0x0c1b('0x31')][_0x0c1b('0x9')](function(){if(!_[_0x0c1b('0x32')](_0x513522[_0x0c1b('0xd')][_0x59363b])){return ami['Action']({'action':_0x0c1b('0x33'),'channel':_0x513522[_0x0c1b('0xd')][_0x59363b]['channel']})[_0x0c1b('0x34')](function(_0x26bff5){if(_0x26bff5['message']===_0x0c1b('0x35')){setTimeout(function(){if(_0x513522['channels'][_0x59363b]){delete _0x513522[_0x0c1b('0xd')][_0x59363b];logger[_0x0c1b('0x36')]('[voiceQueueReport][checkChannel]',_0x59363b);}if(_0x513522[_0x0c1b('0xb')][_0x59363b]){delete _0x513522['queueReports'][_0x59363b];logger['error'](_0x0c1b('0x37'),_0x59363b);}if(_0x513522[_0x0c1b('0x38')][_0x59363b]){delete _0x513522[_0x0c1b('0x38')][_0x59363b];logger[_0x0c1b('0x36')](_0x0c1b('0x39'),_0x59363b);}},0x1f40);}});}});}}};VoiceQueueReport[_0x0c1b('0x8')]['syncFullyBooted']=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0x0c1b('0x3a')](this['queueReports']);clearAgentBooked(this[_0x0c1b('0xc')]);clearVoiceQueues(this[_0x0c1b('0x3b')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype']['clearQueueReport']=function(_0xdc5b91){var _0xd8edd7=this;if(!_[_0x0c1b('0x2c')](_0xdc5b91)){for(var _0x4b8554 in _0xdc5b91){if(_0xdc5b91[_0x0c1b('0x2a')](_0x4b8554)){_0xd8edd7[_0x0c1b('0x3c')](_0xdc5b91[_0x4b8554]);delete _0xdc5b91[_0x4b8554];}}}};function loggerCatch(_0x2aae74){return function(_0x4cd9b8){logger[_0x0c1b('0x36')](_0x2aae74,util['inspect'](_0x4cd9b8,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x0c1b('0x8')]['emit']=function(_0x37094d,_0x5830cd,_0x5f337d){io['to'](_0x37094d)[_0x0c1b('0x3d')](_0x5830cd,_0x5f337d);};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x3e')]=function(_0x1f86b2){this[_0x0c1b('0x3d')](util['format']('voice:queue:%s',_0x1f86b2[_0x0c1b('0x3f')]),_0x0c1b('0x40'),_0x1f86b2);};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x3c')]=function(_0x4ee02b){this['emit'](util[_0x0c1b('0x41')](_0x0c1b('0x42'),_0x4ee02b[_0x0c1b('0x3f')]),'voice_queue_channel:remove',_0x4ee02b);};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x43')]=function(_0x429ef1){if(_0x429ef1[_0x0c1b('0x44')]===_0x0c1b('0x45')){var _0x274ce0={'id':_0x429ef1['id'],'name':_0x429ef1[_0x0c1b('0x3f')],'strategy':_0x429ef1[_0x0c1b('0x46')],'answered':_0x429ef1['answered'],'available':_0x429ef1[_0x0c1b('0x47')],'loggedIn':_0x429ef1[_0x0c1b('0x48')],'pTalking':_0x429ef1[_0x0c1b('0x49')],'sumBillable':_0x429ef1[_0x0c1b('0x4a')],'sumDuration':_0x429ef1[_0x0c1b('0x4b')],'sumHoldTime':_0x429ef1[_0x0c1b('0x4c')]||0x0,'talking':_0x429ef1[_0x0c1b('0x4d')],'total':_0x429ef1[_0x0c1b('0x4e')],'type':_0x429ef1[_0x0c1b('0x44')],'unmanaged':_0x429ef1[_0x0c1b('0x4f')],'waiting':_0x429ef1[_0x0c1b('0x2d')]};if(_0x429ef1[_0x0c1b('0x50')]){_0x274ce0['Trunk']={'id':_0x429ef1[_0x0c1b('0x50')]['id'],'name':_0x429ef1['Trunk'][_0x0c1b('0x3f')],'active':_0x429ef1['Trunk'][_0x0c1b('0x51')],'callerid':_0x429ef1[_0x0c1b('0x50')]['callerid']};}if(_0x429ef1[_0x0c1b('0x52')]){_0x274ce0[_0x0c1b('0x52')]={'id':_0x429ef1[_0x0c1b('0x52')]['id'],'name':_0x429ef1[_0x0c1b('0x52')][_0x0c1b('0x3f')]};}var _0x126e69=md5(JSON['stringify'](_0x274ce0));if(_0x429ef1[_0x0c1b('0x3')]!==_0x126e69){_0x429ef1[_0x0c1b('0x3')]=_0x126e69;this[_0x0c1b('0x3d')](util['format']('voice:queue:%s',_0x274ce0[_0x0c1b('0x3f')]),_0x0c1b('0x53'),_0x274ce0);}}};VoiceQueueReport[_0x0c1b('0x8')]['isNotNull']=function(_0x417817){return _0x417817!==null&&!_[_0x0c1b('0x29')](_0x417817);};VoiceQueueReport[_0x0c1b('0x8')]['loopQueueShow']=function(){var _0x41d12b=this;setInterval(function(){_0x41d12b[_0x0c1b('0x30')]();ami['Action']({'action':_0x0c1b('0x54')})[_0x0c1b('0x34')](loggerCatch(_0x0c1b('0x55')));},0x2710);};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x27')]=function(){var _0x2543c8=this;setInterval(function(){if(_0x2543c8['flagQueueSummary']){return ami[_0x0c1b('0x56')]({'action':_0x0c1b('0x57')})['then'](function(_0x356eac){_0x2543c8[_0x0c1b('0xf')]=![];})['catch'](loggerCatch(_0x0c1b('0x58')));}},0x3e8);};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x11')]=function(_0x493c76){try{if(this[_0x0c1b('0x59')](_0x493c76)&&this[_0x0c1b('0x59')](_0x493c76[_0x0c1b('0x5a')])){if(this['voiceQueues'][_0x493c76['queue']]){var _0x592bde=_[_0x0c1b('0x5b')](this[_0x0c1b('0xd')],'queue')[_0x493c76[_0x0c1b('0x5a')]]||0x0;var _0x1154b2=_0x592bde-_0x493c76[_0x0c1b('0x5c')];if(this['voiceQueues'][_0x493c76['queue']][_0x0c1b('0x2d')]!==_['toNumber'](_0x493c76[_0x0c1b('0x5c')])||this['voiceQueues'][_0x493c76['queue']][_0x0c1b('0x48')]!==_['toNumber'](_0x493c76[_0x0c1b('0x5d')])||this['voiceQueues'][_0x493c76['queue']]['available']!==_['toNumber'](_0x493c76[_0x0c1b('0x47')])||this[_0x0c1b('0x3b')][_0x493c76['queue']][_0x0c1b('0x4d')]!==_0x1154b2){this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]][_0x0c1b('0x2d')]=_[_0x0c1b('0x5e')](_0x493c76[_0x0c1b('0x5c')]);this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]][_0x0c1b('0x48')]=_[_0x0c1b('0x5e')](_0x493c76[_0x0c1b('0x5d')]);this['voiceQueues'][_0x493c76[_0x0c1b('0x5a')]][_0x0c1b('0x47')]=_[_0x0c1b('0x5e')](_0x493c76[_0x0c1b('0x47')]);this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]][_0x0c1b('0x4d')]=_0x1154b2>0x0?_0x1154b2:0x0;this[_0x0c1b('0x3b')][_0x493c76['queue']][_0x0c1b('0x4d')]=this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]]['talking']>_['toNumber'](_0x493c76[_0x0c1b('0x5d')])?_[_0x0c1b('0x5e')](_0x493c76['loggedin']):this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]][_0x0c1b('0x4d')];this[_0x0c1b('0x43')](this[_0x0c1b('0x3b')][_0x493c76[_0x0c1b('0x5a')]]);}ami[_0x0c1b('0x3d')](_0x0c1b('0x5f'),this[_0x0c1b('0x3b')][_0x493c76['queue']]);}}}catch(_0x51a480){logger[_0x0c1b('0x36')]('[syncQueueSummary][VoiceQueueReport]',util[_0x0c1b('0x60')](_0x51a480,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x18d921){this['flagQueueSummary']=!![];};VoiceQueueReport[_0x0c1b('0x8')]['syncNewExten']=function(_0xb8182f){};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x61')]=function(_0x5becf5){try{if(this[_0x0c1b('0x59')](_0x5becf5)){if(_[_0x0c1b('0x29')](this[_0x0c1b('0xb')][_0x5becf5[_0x0c1b('0x62')]])){this[_0x0c1b('0xb')][_0x5becf5['uniqueid']]=[];this[_0x0c1b('0xd')][_0x5becf5[_0x0c1b('0x62')]]={};}var _0x210c60=new QueueReport();_0x210c60['name']=_0x5becf5[_0x0c1b('0x5a')];_0x210c60[_0x0c1b('0x44')]=this['voiceQueues'][_0x210c60[_0x0c1b('0x3f')]]&&this[_0x0c1b('0x3b')][_0x210c60[_0x0c1b('0x3f')]]['type']?this['voiceQueues'][_0x210c60[_0x0c1b('0x3f')]][_0x0c1b('0x44')]||_0x0c1b('0x45'):'inbound';_0x210c60['queue']=_0x5becf5['queue'];_0x210c60[_0x0c1b('0x63')]=moment()[_0x0c1b('0x41')](_0x0c1b('0x64'));_0x210c60['position']=_0x5becf5[_0x0c1b('0x65')];_0x210c60[_0x0c1b('0x66')]=_0x5becf5[_0x0c1b('0x66')];_['merge'](_0x210c60,_[_0x0c1b('0x67')](_0x5becf5,_[_0x0c1b('0x68')](_0x210c60)));this[_0x0c1b('0xb')][_0x5becf5[_0x0c1b('0x62')]][_0x0c1b('0x69')](_0x210c60);this[_0x0c1b('0xd')][_0x5becf5[_0x0c1b('0x62')]]=_0x210c60;this[_0x0c1b('0x3e')](_0x210c60);}}catch(_0x49b5d4){logger[_0x0c1b('0x36')]('[syncQueueCallerJoin][VoiceQueueReport]',util[_0x0c1b('0x60')](_0x49b5d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c1b('0x8')]['syncQueueCallerAbandon']=function(_0x48d6ba){try{if(this['isNotNull'](_0x48d6ba)){if(this[_0x0c1b('0xb')][_0x48d6ba[_0x0c1b('0x62')]]){var _0x7e204c=_[_0x0c1b('0x6a')](this[_0x0c1b('0xb')][_0x48d6ba[_0x0c1b('0x62')]]);_0x7e204c[_0x0c1b('0x6b')]=_0x48d6ba[_0x0c1b('0x6b')];_0x7e204c[_0x0c1b('0x6c')]=_0x48d6ba['originalposition'];_0x7e204c[_0x0c1b('0x16')]=!![];_0x7e204c['queuecallerabandonAt']=moment()[_0x0c1b('0x41')](_0x0c1b('0x64'));_0x7e204c[_0x0c1b('0x6d')]=_0x0c1b('0x6e');_0x7e204c[_0x0c1b('0x6f')]=null;this[_0x0c1b('0xd')][_0x48d6ba[_0x0c1b('0x62')]]=_0x7e204c;this[_0x0c1b('0x3c')](_0x7e204c);}}}catch(_0x525283){logger[_0x0c1b('0x36')](_0x0c1b('0x70'),util[_0x0c1b('0x60')](_0x525283,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c1b('0x8')]['syncQueueCallerLeave']=function(_0x2b2d8f){try{if(this['isNotNull'](_0x2b2d8f)){if(this['queueReports'][_0x2b2d8f[_0x0c1b('0x62')]]){var _0x43fbd5=_[_0x0c1b('0x6a')](this['queueReports'][_0x2b2d8f[_0x0c1b('0x62')]]);_0x43fbd5[_0x0c1b('0x71')]=moment()[_0x0c1b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x43fbd5[_0x0c1b('0x72')]=_0x2b2d8f[_0x0c1b('0x72')];_0x43fbd5[_0x0c1b('0x73')]=_0x2b2d8f[_0x0c1b('0x73')];this['channels'][_0x2b2d8f[_0x0c1b('0x62')]]=_0x43fbd5;this[_0x0c1b('0x3e')](_0x43fbd5);}}}catch(_0x1abfdc){logger[_0x0c1b('0x36')](_0x0c1b('0x74'),util[_0x0c1b('0x60')](_0x1abfdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0c1b('0x1b')]=function(_0x33b301){try{if(this[_0x0c1b('0x59')](_0x33b301)){if(this['queueReports'][_0x33b301[_0x0c1b('0x62')]]){var _0x437451=_[_0x0c1b('0x6a')](this[_0x0c1b('0xb')][_0x33b301[_0x0c1b('0x62')]]);_0x437451[_0x0c1b('0x16')]=![];_0x437451[_0x0c1b('0x75')]=null;_0x437451[_0x0c1b('0x76')]=!![];_0x437451[_0x0c1b('0x6f')]=_0x33b301[_0x0c1b('0x77')];_0x437451[_0x0c1b('0x6b')]=_0x33b301['holdtime'];if(_0x33b301[_0x0c1b('0x72')]===_0x0c1b('0x78')&&_[_0x0c1b('0x79')](_0x33b301[_0x0c1b('0x7a')][_0x0c1b('0x7b')](),'sip/')){if(!_0x437451[_0x0c1b('0x7c')]){_0x437451[_0x0c1b('0x7d')]=!![];_0x437451[_0x0c1b('0x7e')]=moment(_0x437451[_0x0c1b('0x63')])[_0x0c1b('0x7f')](_0x33b301[_0x0c1b('0x6b')],_0x0c1b('0x80'))[_0x0c1b('0x41')](_0x0c1b('0x64'));_0x437451[_0x0c1b('0x6d')]='FORWARDTRANSFER';_0x437451[_0x0c1b('0x7c')]=!![];_0x437451['transfertype']=_0x0c1b('0x81');_0x437451['transferexten']=_0x33b301[_0x0c1b('0x82')];_0x437451[_0x0c1b('0x83')]=_0x33b301[_0x0c1b('0x62')];}if(this['agents'][_0x33b301[_0x0c1b('0x7a')]]){_0x437451[_0x0c1b('0x72')]=this[_0x0c1b('0xc')][_0x33b301[_0x0c1b('0x7a')]]['accountcode'];_0x437451['connectedlinename']=this[_0x0c1b('0xc')][_0x33b301['interface']][_0x0c1b('0x84')];_0x437451['destcalleridnum']=this[_0x0c1b('0xc')][_0x33b301[_0x0c1b('0x7a')]][_0x0c1b('0x85')];_0x437451[_0x0c1b('0x86')]=this['agents'][_0x33b301['interface']][_0x0c1b('0x84')];}}else{_0x437451[_0x0c1b('0x87')]=!![];_0x437451[_0x0c1b('0x88')]=moment()[_0x0c1b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x437451[_0x0c1b('0x7d')]=![];_0x437451[_0x0c1b('0x7e')]=null;if(_0x33b301[_0x0c1b('0x89')]!==_0x0c1b('0x7c')){_0x437451[_0x0c1b('0x6d')]=_0x0c1b('0x8a')+_0x33b301[_0x0c1b('0x89')][_0x0c1b('0x8b')]();}}this[_0x0c1b('0xd')][_0x33b301[_0x0c1b('0x62')]]=_0x437451;this[_0x0c1b('0x3c')](_0x437451);}}}catch(_0xb2116e){logger['error']('[syncAgentComplete][VoiceQueueReport]',util['inspect'](_0xb2116e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x8c')]=function(_0x1af08d){try{if(this[_0x0c1b('0x59')](_0x1af08d)){this[_0x0c1b('0x8d')](_0x1af08d[_0x0c1b('0x62')],_[_0x0c1b('0x68')](_0x1af08d[_0x0c1b('0x8e')])[0x0],_0x1af08d[_0x0c1b('0x8f')]);if(this['queueReports'][_0x1af08d[_0x0c1b('0x62')]]){var _0x5ef764=_[_0x0c1b('0x6a')](this[_0x0c1b('0xb')][_0x1af08d[_0x0c1b('0x62')]]);if(_0x5ef764){if(this['isNotNull'](_0x1af08d[_0x0c1b('0x8e')])&&this[_0x0c1b('0x59')](_0x1af08d['variable'][_0x0c1b('0x90')])){switch(_0x1af08d[_0x0c1b('0x8f')]){case _0x0c1b('0x91'):_0x5ef764[_0x0c1b('0x7d')]=![];_0x5ef764[_0x0c1b('0x7e')]=null;break;default:_0x5ef764[_0x0c1b('0x7d')]=!![];_0x5ef764[_0x0c1b('0x7e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ef764[_0x0c1b('0x71')]=moment()[_0x0c1b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5ef764[_0x0c1b('0x16')]=![];_0x5ef764[_0x0c1b('0x75')]=null;_0x5ef764[_0x0c1b('0x6d')]=_0x1af08d[_0x0c1b('0x8f')];this[_0x0c1b('0xd')][_0x1af08d[_0x0c1b('0x62')]]=_0x5ef764;this[_0x0c1b('0x3c')](_0x5ef764);}else if(this[_0x0c1b('0x59')](_0x1af08d['variable'])&&this[_0x0c1b('0x59')](_0x1af08d[_0x0c1b('0x8e')]['queueposition'])){if(!_0x5ef764[_0x0c1b('0x16')]){_0x5ef764[_0x0c1b('0x7d')]=!![];_0x5ef764[_0x0c1b('0x7e')]=moment()[_0x0c1b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x5ef764[_0x0c1b('0x6d')]=_0x0c1b('0x92');_0x5ef764['queuecallerleaveAt']=moment()[_0x0c1b('0x41')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x0c1b('0xd')][_0x1af08d[_0x0c1b('0x62')]]=_0x5ef764;}}_0x5ef764[_0x0c1b('0x38')]=this['variables'][_0x1af08d[_0x0c1b('0x62')]];}}}}catch(_0x1b03ed){logger[_0x0c1b('0x36')](_0x0c1b('0x93'),util[_0x0c1b('0x60')](_0x1b03ed,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0c1b('0x8')]['addVariable']=function(_0x2812e8,_0x172419,_0x1e76c7){var _0x190bd6=['rtpaudioqos',_0x0c1b('0x94'),_0x0c1b('0x95'),_0x0c1b('0x96'),_0x0c1b('0x97'),_0x0c1b('0x98'),'rtpaudioqosrtt',_0x0c1b('0x99'),_0x0c1b('0x9a'),_0x0c1b('0x9b'),_0x0c1b('0x9c'),_0x0c1b('0x9d'),_0x0c1b('0x9e'),'memberdynamic',_0x0c1b('0x9f'),_0x0c1b('0xa0'),'membername','memberpenalty',_0x0c1b('0xa1')];if(!_[_0x0c1b('0x32')](_0x172419)&&!_['includes'](_0x190bd6,_0x172419)){if(_[_0x0c1b('0x29')](this[_0x0c1b('0x38')][_0x2812e8])){this[_0x0c1b('0x38')][_0x2812e8]={};}this[_0x0c1b('0x38')][_0x2812e8][_0x172419]=_0x1e76c7;}};VoiceQueueReport[_0x0c1b('0x8')][_0x0c1b('0x1e')]=function(_0x2b2c98){try{if(this['isNotNull'](_0x2b2c98)){if(this[_0x0c1b('0xb')][_0x2b2c98['uniqueid']]){for(var _0x186c21=0x0,_0x54fe48={};_0x186c210x0?_0x115ae9:0x0;this[_0xda2b('0x13')][_0x3a6eb2['queue']][_0xda2b('0x2f')]=this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]][_0xda2b('0x2f')]>_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5f')])?_[_0xda2b('0x5c')](_0x3a6eb2[_0xda2b('0x5f')]):this[_0xda2b('0x13')][_0x3a6eb2['queue']][_0xda2b('0x2f')];this[_0xda2b('0x45')](this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]);}ami[_0xda2b('0x41')](_0xda2b('0x60'),this[_0xda2b('0x13')][_0x3a6eb2[_0xda2b('0x5a')]]);}}}catch(_0x1b6a00){logger[_0xda2b('0x3a')](_0xda2b('0x61'),util[_0xda2b('0x40')](_0x1b6a00,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x1b')]=function(_0xc291c0){this['flagQueueSummary']=!![];};VoiceQueueReport['prototype']['syncNewExten']=function(_0x4a07f8){};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x1d')]=function(_0x14b521){try{if(this[_0xda2b('0x56')](_0x14b521)){if(_['isUndefined'](this[_0xda2b('0xf')][_0x14b521['uniqueid']])){this['queueReports'][_0x14b521[_0xda2b('0x62')]]=[];this[_0xda2b('0x11')][_0x14b521[_0xda2b('0x62')]]={};}var _0xc375e2=new QueueReport();_0xc375e2[_0xda2b('0x47')]=_0x14b521[_0xda2b('0x5a')];_0xc375e2['type']=this['voiceQueues'][_0xc375e2['name']]&&this['voiceQueues'][_0xc375e2['name']]['type']?this[_0xda2b('0x13')][_0xc375e2[_0xda2b('0x47')]][_0xda2b('0x4e')]||_0xda2b('0x46'):'inbound';_0xc375e2[_0xda2b('0x5a')]=_0x14b521[_0xda2b('0x5a')];_0xc375e2['queuecallerjoinAt']=moment()[_0xda2b('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0xc375e2[_0xda2b('0x63')]=_0x14b521[_0xda2b('0x63')];_0xc375e2[_0xda2b('0x64')]=_0x14b521[_0xda2b('0x64')];_[_0xda2b('0x65')](_0xc375e2,_[_0xda2b('0x66')](_0x14b521,_[_0xda2b('0x67')](_0xc375e2)));this[_0xda2b('0xf')][_0x14b521[_0xda2b('0x62')]]['push'](_0xc375e2);this[_0xda2b('0x11')][_0x14b521[_0xda2b('0x62')]]=_0xc375e2;this[_0xda2b('0x42')](_0xc375e2);}}catch(_0x3898a3){logger[_0xda2b('0x3a')](_0xda2b('0x68'),util[_0xda2b('0x40')](_0x3898a3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')]['syncQueueCallerAbandon']=function(_0x4a425b){try{if(this[_0xda2b('0x56')](_0x4a425b)){if(this[_0xda2b('0xf')][_0x4a425b[_0xda2b('0x62')]]){var _0x4ab57d=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x4a425b['uniqueid']]);_0x4ab57d[_0xda2b('0x6a')]=_0x4a425b[_0xda2b('0x6a')];_0x4ab57d[_0xda2b('0x6b')]=_0x4a425b['originalposition'];_0x4ab57d['queuecallerabandon']=!![];_0x4ab57d[_0xda2b('0x6c')]=moment()['format'](_0xda2b('0x6d'));_0x4ab57d[_0xda2b('0x6e')]=_0xda2b('0x6f');_0x4ab57d[_0xda2b('0x70')]=null;this[_0xda2b('0x11')][_0x4a425b[_0xda2b('0x62')]]=_0x4ab57d;this[_0xda2b('0x3f')](_0x4ab57d);}}}catch(_0x120e5a){logger[_0xda2b('0x3a')](_0xda2b('0x71'),util[_0xda2b('0x40')](_0x120e5a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x72')]=function(_0x938fa4){try{if(this['isNotNull'](_0x938fa4)){if(this[_0xda2b('0xf')][_0x938fa4['uniqueid']]){var _0x556e80=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x938fa4[_0xda2b('0x62')]]);_0x556e80[_0xda2b('0x73')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));_0x556e80[_0xda2b('0x74')]=_0x938fa4[_0xda2b('0x74')];_0x556e80[_0xda2b('0x75')]=_0x938fa4[_0xda2b('0x75')];this['channels'][_0x938fa4[_0xda2b('0x62')]]=_0x556e80;this[_0xda2b('0x42')](_0x556e80);}}}catch(_0x330e1b){logger[_0xda2b('0x3a')](_0xda2b('0x76'),util[_0xda2b('0x40')](_0x330e1b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x21')]=function(_0x62f077){try{if(this['isNotNull'](_0x62f077)){if(this['queueReports'][_0x62f077[_0xda2b('0x62')]]){var _0x3bf598=_[_0xda2b('0x69')](this[_0xda2b('0xf')][_0x62f077['uniqueid']]);_0x3bf598[_0xda2b('0x77')]=![];_0x3bf598[_0xda2b('0x6c')]=null;_0x3bf598[_0xda2b('0x78')]=!![];_0x3bf598[_0xda2b('0x70')]=_0x62f077['membername'];_0x3bf598[_0xda2b('0x6a')]=_0x62f077['holdtime'];if(_0x62f077[_0xda2b('0x74')]===''&&_[_0xda2b('0x79')](_0x62f077[_0xda2b('0x7a')][_0xda2b('0x7b')](),_0xda2b('0x7c'))){if(!_0x3bf598[_0xda2b('0x7d')]){_0x3bf598['queuecallerexit']=!![];_0x3bf598[_0xda2b('0x7e')]=moment(_0x3bf598['queuecallerjoinAt'])['add'](_0x62f077[_0xda2b('0x6a')],'seconds')[_0xda2b('0x43')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bf598[_0xda2b('0x6e')]=_0xda2b('0x7f');_0x3bf598[_0xda2b('0x7d')]=!![];_0x3bf598[_0xda2b('0x80')]=_0xda2b('0x81');_0x3bf598[_0xda2b('0x82')]=_0x62f077[_0xda2b('0x83')];_0x3bf598[_0xda2b('0x84')]=_0x62f077[_0xda2b('0x62')];}if(this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]]){_0x3bf598[_0xda2b('0x74')]=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x85')];_0x3bf598[_0xda2b('0x75')]=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]]['fullname'];_0x3bf598['destcalleridnum']=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x85')];_0x3bf598['destcalleridname']=this[_0xda2b('0x10')][_0x62f077[_0xda2b('0x7a')]][_0xda2b('0x86')];}}else{_0x3bf598[_0xda2b('0x87')]=!![];_0x3bf598[_0xda2b('0x88')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));_0x3bf598['queuecallerexit']=![];_0x3bf598[_0xda2b('0x7e')]=null;if(_0x62f077[_0xda2b('0x89')]!==_0xda2b('0x7d')){_0x3bf598[_0xda2b('0x6e')]=_0xda2b('0x8a')+_0x62f077[_0xda2b('0x89')][_0xda2b('0x8b')]();}}this[_0xda2b('0x11')][_0x62f077[_0xda2b('0x62')]]=_0x3bf598;this[_0xda2b('0x3f')](_0x3bf598);}}}catch(_0x449727){logger[_0xda2b('0x3a')](_0xda2b('0x8c'),util[_0xda2b('0x40')](_0x449727,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xda2b('0x8d')]=function(_0x49b11b){try{if(this[_0xda2b('0x56')](_0x49b11b)){this[_0xda2b('0x8e')](_0x49b11b['uniqueid'],_[_0xda2b('0x67')](_0x49b11b['variable'])[0x0],_0x49b11b['value']);if(this[_0xda2b('0xf')][_0x49b11b[_0xda2b('0x62')]]){var _0x16526b=_[_0xda2b('0x69')](this['queueReports'][_0x49b11b[_0xda2b('0x62')]]);if(_0x16526b){if(this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')])&&this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')][_0xda2b('0x90')])){switch(_0x49b11b[_0xda2b('0x91')]){case _0xda2b('0x92'):_0x16526b[_0xda2b('0x93')]=![];_0x16526b[_0xda2b('0x7e')]=null;break;default:_0x16526b['queuecallerexit']=!![];_0x16526b[_0xda2b('0x7e')]=moment()['format'](_0xda2b('0x6d'));_0x16526b[_0xda2b('0x73')]=moment()['format'](_0xda2b('0x6d'));}_0x16526b[_0xda2b('0x77')]=![];_0x16526b[_0xda2b('0x6c')]=null;_0x16526b[_0xda2b('0x6e')]=_0x49b11b[_0xda2b('0x91')];this[_0xda2b('0x11')][_0x49b11b[_0xda2b('0x62')]]=_0x16526b;this[_0xda2b('0x3f')](_0x16526b);}else if(this['isNotNull'](_0x49b11b[_0xda2b('0x8f')])&&this[_0xda2b('0x56')](_0x49b11b[_0xda2b('0x8f')]['queueposition'])){if(!_0x16526b[_0xda2b('0x77')]){_0x16526b[_0xda2b('0x93')]=!![];_0x16526b[_0xda2b('0x7e')]=moment()['format'](_0xda2b('0x6d'));_0x16526b['queuecallerexitreason']=_0xda2b('0x94');_0x16526b[_0xda2b('0x73')]=moment()[_0xda2b('0x43')](_0xda2b('0x6d'));this['channels'][_0x49b11b[_0xda2b('0x62')]]=_0x16526b;}}_0x16526b[_0xda2b('0x16')]=this[_0xda2b('0x16')][_0x49b11b[_0xda2b('0x62')]];}}}}catch(_0x55b933){logger[_0xda2b('0x3a')](_0xda2b('0x95'),util[_0xda2b('0x40')](_0x55b933,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xda2b('0xa')][_0xda2b('0x8e')]=function(_0x4ba39a,_0x149761,_0x4a23f3){var _0x352e62=['rtpaudioqos',_0xda2b('0x96'),_0xda2b('0x97'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0xda2b('0x98'),_0xda2b('0x99'),_0xda2b('0x9a'),_0xda2b('0x9b'),'bridgepvtcallid','membercalls',_0xda2b('0x9c'),_0xda2b('0x9d'),_0xda2b('0x9e'),_0xda2b('0x9f'),_0xda2b('0xa0'),_0xda2b('0xa1')];if(!_['isNil'](_0x149761)&&!_[_0xda2b('0xa2')](_0x352e62,_0x149761)){if(_[_0xda2b('0x2b')](this[_0xda2b('0x16')][_0x4ba39a])){this[_0xda2b('0x16')][_0x4ba39a]={};}this[_0xda2b('0x16')][_0x4ba39a][_0x149761]=_0x4a23f3;}};VoiceQueueReport['prototype'][_0xda2b('0x24')]=function(_0x5f2403){try{if(this[_0xda2b('0x56')](_0x5f2403)){if(this[_0xda2b('0xf')][_0x5f2403[_0xda2b('0x62')]]){for(var _0x145065=0x0,_0x2abc94={};_0x145065=0x0?moment(_0x59159b[_0x3e07('0x17')])[_0x3e07('0xa')](_0x59159b[_0x3e07('0x16')],_0x3e07('0xc')):null,'data1':_0x3e07('0x18'),'data2':_0x59159b[_0x3e07('0x11')],'data3':_0x59159b[_0x3e07('0xe')],'data4':_0x59159b['dialstring']||null,'role':'agent','internal':_0x59159b[_0x3e07('0x11')]?_[_0x3e07('0x19')](_0x59159b[_0x3e07('0x11')]):undefined,'uniqueid':_0x59159b[_0x3e07('0x12')]},'log':_0x3e07('0x4')});}; \ No newline at end of file +var _0xc40c=['split','TALKING','starttime','endtime','diff','seconds','accountcode','dialstring','moment','lodash','../client','Request','CreateMemberReport','voice','lastAssignedTo','queuecallerleaveAt','queuecallercompleteAt','calleridnum','exten','agent','toNumber','uniqueid','voiceDialReport','channel'];(function(_0x2f9d51,_0x679fe4){var _0x148f5f=function(_0x120256){while(--_0x120256){_0x2f9d51['push'](_0x2f9d51['shift']());}};_0x148f5f(++_0x679fe4);}(_0xc40c,0x158));var _0xcc40=function(_0xeb6d4d,_0x2714b4){_0xeb6d4d=_0xeb6d4d-0x0;var _0x4575e4=_0xc40c[_0xeb6d4d];return _0x4575e4;};'use strict';var moment=require(_0xcc40('0x0'));var _=require(_0xcc40('0x1'));var client=require(_0xcc40('0x2'));exports['voiceQueueReport']=function(_0x5c14a0){return client[_0xcc40('0x3')](_0xcc40('0x4'),{'body':{'channel':_0xcc40('0x5'),'membername':_0x5c14a0[_0xcc40('0x6')],'interface':'SIP/'+_0x5c14a0[_0xcc40('0x6')],'type':'TALKING','enterAt':_0x5c14a0[_0xcc40('0x7')],'exitAt':_0x5c14a0[_0xcc40('0x8')],'duration':moment(_0x5c14a0[_0xcc40('0x8')])['diff'](_0x5c14a0['queuecallerleaveAt'],'seconds'),'data1':'inbound','data2':_0x5c14a0[_0xcc40('0x9')],'data3':_0x5c14a0[_0xcc40('0xa')],'data4':null,'data5':_0x5c14a0['queue'],'role':_0xcc40('0xb'),'internal':_0x5c14a0['accountcode']?_[_0xcc40('0xc')](_0x5c14a0['accountcode']):undefined,'uniqueid':_0x5c14a0[_0xcc40('0xd')]},'log':_0xcc40('0x4')});};exports[_0xcc40('0xe')]=function(_0x1d1467){return client['Request'](_0xcc40('0x4'),{'body':{'channel':'voice','membername':_0x1d1467[_0xcc40('0xf')]?_0x1d1467['channel'][_0xcc40('0x10')](/\/|-/)[0x1]:undefined,'interface':_0x1d1467[_0xcc40('0xf')]?_0x1d1467[_0xcc40('0xf')][_0xcc40('0x10')]('-')[0x0]:undefined,'type':_0xcc40('0x11'),'enterAt':_0x1d1467[_0xcc40('0x12')],'exitAt':_0x1d1467[_0xcc40('0x13')],'duration':moment(_0x1d1467[_0xcc40('0x13')])[_0xcc40('0x14')](_0x1d1467[_0xcc40('0x12')],_0xcc40('0x15'))>=0x0?moment(_0x1d1467[_0xcc40('0x13')])[_0xcc40('0x14')](_0x1d1467['starttime'],'seconds'):null,'data1':'outbound','data2':_0x1d1467[_0xcc40('0x16')],'data3':_0x1d1467[_0xcc40('0xa')],'data4':_0x1d1467[_0xcc40('0x17')]||null,'role':'agent','internal':_0x1d1467['accountcode']?_[_0xcc40('0xc')](_0x1d1467[_0xcc40('0x16')]):undefined,'uniqueid':_0x1d1467[_0xcc40('0xd')]},'log':_0xcc40('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9398edc..66afc9b 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 _0x134b=['Request','GetTemplate','name','html','../client'];(function(_0x192e49,_0x20c95a){var _0x4cf1a5=function(_0x217738){while(--_0x217738){_0x192e49['push'](_0x192e49['shift']());}};_0x4cf1a5(++_0x20c95a);}(_0x134b,0xa9));var _0xb134=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x134b[_0x46698a];return _0x356db0;};'use strict';var client=require(_0xb134('0x0'));exports['getTemplates']=function(_0x44e677){return function(_0x4da015){return client[_0xb134('0x1')](_0xb134('0x2'),{'options':{'raw':!![],'attributes':['id',_0xb134('0x3'),_0xb134('0x4')]},'log':_0xb134('0x2')});};}; \ No newline at end of file +var _0x6841=['GetTemplate','html','../client','getTemplates','Request'];(function(_0x579357,_0x1b3b3e){var _0x289d24=function(_0x47ff3a){while(--_0x47ff3a){_0x579357['push'](_0x579357['shift']());}};_0x289d24(++_0x1b3b3e);}(_0x6841,0x138));var _0x1684=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x6841[_0x34bc30];return _0x5706de;};'use strict';var client=require(_0x1684('0x0'));exports[_0x1684('0x1')]=function(_0x9a996c){return function(_0x5a60d7){return client[_0x1684('0x2')](_0x1684('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x1684('0x4')]},'log':_0x1684('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index cee5aaa..45f2518 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 _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x54d77c,_0x3a6956){var _0x587d8e=function(_0x42c3ae){while(--_0x42c3ae){_0x54d77c['push'](_0x54d77c['shift']());}};_0x587d8e(++_0x3a6956);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xa9e0=['data3','data4','data5','../client','getTriggers','GetTrigger','channel','status','Condition','AllConditions','field','value','AnyConditions','action','data1','data2'];(function(_0x401af0,_0x1a29f8){var _0x4ab016=function(_0xba68ca){while(--_0xba68ca){_0x401af0['push'](_0x401af0['shift']());}};_0x4ab016(++_0x1a29f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(_0x29929c){return function(_0x5dd881){return client['Request'](_0x0a9e('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),_0x0a9e('0x4')],'include':[{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x6'),'attributes':['id',_0x0a9e('0x7'),'operator',_0x0a9e('0x8')]},{'model':_0x0a9e('0x5'),'as':_0x0a9e('0x9'),'attributes':['id','field','operator',_0x0a9e('0x8')]},{'model':'Action','as':'Actions','attributes':['id',_0x0a9e('0xa'),_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),'data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 091f71d..651460e 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 _0x63b7=['Request','GetTrunk','name','../client','getTrunks'];(function(_0x9002c0,_0x5db8d1){var _0x2fdc48=function(_0x561693){while(--_0x561693){_0x9002c0['push'](_0x9002c0['shift']());}};_0x2fdc48(++_0x5db8d1);}(_0x63b7,0x166));var _0x763b=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x63b7[_0x3b3a82];return _0x267063;};'use strict';var client=require(_0x763b('0x0'));exports[_0x763b('0x1')]=function(_0x4a1277){return function(_0x4dad5a){return client[_0x763b('0x2')](_0x763b('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x763b('0x4'),'registry']},'log':_0x763b('0x3')});};}; \ No newline at end of file +var _0x4a5d=['name','getTrunks','Request','GetTrunk'];(function(_0x1bd8b8,_0xbbe020){var _0x55e63c=function(_0x537fa9){while(--_0x537fa9){_0x1bd8b8['push'](_0x1bd8b8['shift']());}};_0x55e63c(++_0xbbe020);}(_0x4a5d,0x145));var _0xd4a5=function(_0x4433b,_0x1eded1){_0x4433b=_0x4433b-0x0;var _0xffc1da=_0x4a5d[_0x4433b];return _0xffc1da;};'use strict';var client=require('../client');exports[_0xd4a5('0x0')]=function(_0x1d87a8){return function(_0xf45679){return client[_0xd4a5('0x1')](_0xd4a5('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xd4a5('0x3'),'registry']},'log':_0xd4a5('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 3e2e773..7fd126a 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 _0x557d=['voicePause','phone','mobile','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent','ShowUser','name','fullname','online','lastLoginAt','lastPauseAt','../client','getAgents','Request','GetUser','email','accountcode','pauseType'];(function(_0x4569e0,_0x3918bf){var _0x22c797=function(_0x202d66){while(--_0x202d66){_0x4569e0['push'](_0x4569e0['shift']());}};_0x22c797(++_0x3918bf);}(_0x557d,0xcb));var _0xd557=function(_0x2929f0,_0x323cb6){_0x2929f0=_0x2929f0-0x0;var _0x29b3ae=_0x557d[_0x2929f0];return _0x29b3ae;};'use strict';var client=require(_0xd557('0x0'));exports[_0xd557('0x1')]=function(){return function(){return client[_0xd557('0x2')](_0xd557('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id','name',_0xd557('0x4'),_0xd557('0x5'),'fullname','online','lastLoginAt',_0xd557('0x6'),'lastPauseAt',_0xd557('0x7'),_0xd557('0x8'),_0xd557('0x9')]},'log':'getAgents'});};};exports[_0xd557('0xa')]=function(){return function(){return client['Request'](_0xd557('0x3'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id','name']},'log':_0xd557('0xa')});};};exports[_0xd557('0xb')]=function(_0x717c89,_0x4626eb,_0x2d8ce3){return client[_0xd557('0x2')]('PauseUser',{'body':{'type':_0x4626eb,'uniqueid':_0x2d8ce3},'options':{'where':{'id':_0x717c89['id']}},'log':_0xd557('0xb')});};exports[_0xd557('0xc')]=function(_0x370f2c){return client[_0xd557('0x2')](_0xd557('0xd'),{'body':{},'options':{'where':{'id':_0x370f2c['id']}},'log':_0xd557('0xb')});};exports[_0xd557('0xe')]=function(_0x23c5ca){return client[_0xd557('0x2')](_0xd557('0xf'),{'options':{'raw':![],'where':{'role':'agent','id':_0x23c5ca},'attributes':['id',_0xd557('0x10'),_0xd557('0x4'),_0xd557('0x5'),_0xd557('0x11'),_0xd557('0x12'),_0xd557('0x13'),_0xd557('0x6'),_0xd557('0x14'),_0xd557('0x7')]},'log':_0xd557('0xe')});}; \ No newline at end of file +var _0xd243=['pauseType','voicePause','../client','Request','GetUser','agent','name','email','accountcode','fullname','online','lastLoginAt','lastPauseAt','phone','mobile','getAgents','getTelephones','savePause','saveUnpause','UnpauseUser','getAgent'];(function(_0x48cf9f,_0x22c0bb){var _0x4166d4=function(_0x336c9c){while(--_0x336c9c){_0x48cf9f['push'](_0x48cf9f['shift']());}};_0x4166d4(++_0x22c0bb);}(_0xd243,0xaa));var _0x3d24=function(_0x9d5cc6,_0x52b52f){_0x9d5cc6=_0x9d5cc6-0x0;var _0x4df207=_0xd243[_0x9d5cc6];return _0x4df207;};'use strict';var client=require(_0x3d24('0x0'));exports['getAgents']=function(){return function(){return client[_0x3d24('0x1')](_0x3d24('0x2'),{'options':{'raw':![],'where':{'role':_0x3d24('0x3')},'attributes':['id',_0x3d24('0x4'),_0x3d24('0x5'),_0x3d24('0x6'),_0x3d24('0x7'),_0x3d24('0x8'),_0x3d24('0x9'),'pauseType',_0x3d24('0xa'),'voicePause',_0x3d24('0xb'),_0x3d24('0xc')]},'log':_0x3d24('0xd')});};};exports[_0x3d24('0xe')]=function(){return function(){return client[_0x3d24('0x1')](_0x3d24('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3d24('0x4')]},'log':_0x3d24('0xe')});};};exports[_0x3d24('0xf')]=function(_0x5287f8,_0x2cb4d8,_0x3b0825){return client[_0x3d24('0x1')]('PauseUser',{'body':{'type':_0x2cb4d8,'uniqueid':_0x3b0825},'options':{'where':{'id':_0x5287f8['id']}},'log':_0x3d24('0xf')});};exports[_0x3d24('0x10')]=function(_0x1a226c){return client[_0x3d24('0x1')](_0x3d24('0x11'),{'body':{},'options':{'where':{'id':_0x1a226c['id']}},'log':_0x3d24('0xf')});};exports[_0x3d24('0x12')]=function(_0x394182){return client[_0x3d24('0x1')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3d24('0x3'),'id':_0x394182},'attributes':['id',_0x3d24('0x4'),_0x3d24('0x5'),'accountcode',_0x3d24('0x7'),_0x3d24('0x8'),'lastLoginAt',_0x3d24('0x13'),_0x3d24('0xa'),_0x3d24('0x14')]},'log':_0x3d24('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index b729cfe..7198656 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 _0xcd6c=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x337bcc,_0x47c1a6){var _0x45b2ce=function(_0x2ddd6e){while(--_0x2ddd6e){_0x337bcc['push'](_0x337bcc['shift']());}};_0x45b2ce(++_0x47c1a6);}(_0xcd6c,0x16d));var _0xccd6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd6c[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xccd6('0x0')]=function(_0x45f15f){return client[_0xccd6('0x1')](_0xccd6('0x2'),{'body':_0x45f15f,'log':_0xccd6('0x2')});};exports[_0xccd6('0x3')]=function(_0x321e00,_0x5de4b6,_0x10aa42){return client[_0xccd6('0x1')](_0xccd6('0x4'),{'body':_0x321e00,'options':{'where':{'uniqueid':_0x5de4b6,'interface':_0x10aa42}},'log':_0xccd6('0x4')});}; \ No newline at end of file +var _0xfb48=['CreateVoiceAgentReport','update','UpdateVoiceAgentReport','../client'];(function(_0x398c03,_0x2e8fe9){var _0x578e5e=function(_0x2b100e){while(--_0x2b100e){_0x398c03['push'](_0x398c03['shift']());}};_0x578e5e(++_0x2e8fe9);}(_0xfb48,0xfb));var _0x8fb4=function(_0x4fdb6e,_0x49d748){_0x4fdb6e=_0x4fdb6e-0x0;var _0x3c15f8=_0xfb48[_0x4fdb6e];return _0x3c15f8;};'use strict';var client=require(_0x8fb4('0x0'));exports['create']=function(_0x2816b7){return client['Request'](_0x8fb4('0x1'),{'body':_0x2816b7,'log':'CreateVoiceAgentReport'});};exports[_0x8fb4('0x2')]=function(_0x3ae389,_0x1a1575,_0x2b1339){return client['Request'](_0x8fb4('0x3'),{'body':_0x3ae389,'options':{'where':{'uniqueid':_0x1a1575,'interface':_0x2b1339}},'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 d3002ac..0b13f10 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 _0x274d=['Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x7ddea5,_0x5a56f1){var _0x2ecb59=function(_0x332ae8){while(--_0x332ae8){_0x7ddea5['push'](_0x7ddea5['shift']());}};_0x2ecb59(++_0x5a56f1);}(_0x274d,0x18c));var _0xd274=function(_0x27df38,_0x11cf85){_0x27df38=_0x27df38-0x0;var _0x44495d=_0x274d[_0x27df38];return _0x44495d;};'use strict';var moment=require(_0xd274('0x0'));var util=require(_0xd274('0x1'));var _=require(_0xd274('0x2'));var client=require(_0xd274('0x3'));exports['create']=function(_0x6ceea3){return client[_0xd274('0x4')](_0xd274('0x5'),{'body':_['merge'](_0x6ceea3,{'source':_0x6ceea3[_0xd274('0x6')],'destinationcontext':_0x6ceea3[_0xd274('0x7')],'callerid':_0x6ceea3[_0xd274('0x8')],'amaflags':_0xd274('0x9')}),'log':_0xd274('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0xd274('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xd274('0xa')],'createdAt':{'$between':[moment()[_0xd274('0xb')](_0xd274('0xc'))[_0xd274('0xd')](_0xd274('0xe')),moment()['endOf'](_0xd274('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xd274('0xf'),_0xd274('0x10'),_0xd274('0x11'),_0xd274('0x12')]},'log':_0xd274('0x13')});};}; \ No newline at end of file +var _0x93e7=['outbound','startOf','day','format','endOf','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x93e7,0xcf));var _0x793e=function(_0x51fe86,_0x422b66){_0x51fe86=_0x51fe86-0x0;var _0x3557d4=_0x93e7[_0x51fe86];return _0x3557d4;};'use strict';var moment=require(_0x793e('0x0'));var util=require(_0x793e('0x1'));var _=require(_0x793e('0x2'));var client=require(_0x793e('0x3'));exports['create']=function(_0x12e996){return client[_0x793e('0x4')]('CreateVoiceCallReport',{'body':_[_0x793e('0x5')](_0x12e996,{'source':_0x12e996[_0x793e('0x6')],'destinationcontext':_0x12e996[_0x793e('0x7')],'callerid':_0x12e996[_0x793e('0x8')],'amaflags':_0x793e('0x9')}),'log':_0x793e('0xa')});};exports[_0x793e('0xb')]=function(){return function(){return client[_0x793e('0x4')](_0x793e('0xc'),{'options':{'where':{'type':[_0x793e('0xd')],'createdAt':{'$between':[moment()[_0x793e('0xe')](_0x793e('0xf'))[_0x793e('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x793e('0x11')]('day')[_0x793e('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x793e('0x12'),_0x793e('0x13'),_0x793e('0x14')]},'log':_0x793e('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 02d766e..be047f4 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 _0x7524=['CreateVoiceDialReport','create'];(function(_0x40279f,_0x135e4d){var _0x9df5f6=function(_0x193801){while(--_0x193801){_0x40279f['push'](_0x40279f['shift']());}};_0x9df5f6(++_0x135e4d);}(_0x7524,0x12b));var _0x4752=function(_0x3d67df,_0x1ae733){_0x3d67df=_0x3d67df-0x0;var _0x105f24=_0x7524[_0x3d67df];return _0x105f24;};'use strict';var client=require('../client');exports[_0x4752('0x0')]=function(_0x105f32){return client['Request'](_0x4752('0x1'),{'body':_0x105f32,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x96e7=['create','CreateVoiceDialReport'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x96e7,0x1f2));var _0x796e=function(_0x5e8eae,_0x4f81e0){_0x5e8eae=_0x5e8eae-0x0;var _0xdd09cd=_0x96e7[_0x5e8eae];return _0xdd09cd;};'use strict';var client=require('../client');exports[_0x796e('0x0')]=function(_0xc873d){return client['Request']('CreateVoiceDialReport',{'body':_0xc873d,'log':_0x796e('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d3ea611..815e9ae 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 _0xede1=['GetVoiceExtension','exten','recordingFormat','getVoiceExtensions','Request'];(function(_0x578188,_0x332783){var _0x31ad38=function(_0x922b1){while(--_0x922b1){_0x578188['push'](_0x578188['shift']());}};_0x31ad38(++_0x332783);}(_0xede1,0x99));var _0x1ede=function(_0x4e7862,_0x2b15c0){_0x4e7862=_0x4e7862-0x0;var _0x3a71af=_0xede1[_0x4e7862];return _0x3a71af;};'use strict';var client=require('../client');exports[_0x1ede('0x0')]=function(){return function(){return client[_0x1ede('0x1')](_0x1ede('0x2'),{'options':{'raw':!![],'attributes':['id',_0x1ede('0x3'),_0x1ede('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1ede('0x0')});};}; \ No newline at end of file +var _0xc59c=['getVoiceExtensions','Request','GetVoiceExtension','exten','../client'];(function(_0x32e94b,_0x38c7a7){var _0x3b1567=function(_0x282670){while(--_0x282670){_0x32e94b['push'](_0x32e94b['shift']());}};_0x3b1567(++_0x38c7a7);}(_0xc59c,0x72));var _0xcc59=function(_0x446737,_0x411246){_0x446737=_0x446737-0x0;var _0x575b95=_0xc59c[_0x446737];return _0x575b95;};'use strict';var client=require(_0xcc59('0x0'));exports[_0xcc59('0x1')]=function(){return function(){return client[_0xcc59('0x2')](_0xcc59('0x3'),{'options':{'raw':!![],'attributes':['id',_0xcc59('0x4'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xcc59('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 09e1531..42a734c 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 _0x608a=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','active','Trunk','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','acwTimeout','autopause','type','dialActive','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout'];(function(_0x1d96f4,_0x33a9ad){var _0x836f58=function(_0x1ba947){while(--_0x1ba947){_0x1d96f4['push'](_0x1d96f4['shift']());}};_0x836f58(++_0x33a9ad);}(_0x608a,0xff));var _0xa608=function(_0x40fe45,_0x122a48){_0x40fe45=_0x40fe45-0x0;var _0x158416=_0x608a[_0x40fe45];return _0x158416;};'use strict';var client=require('../client');exports[_0xa608('0x0')]=function(){return function(){return client[_0xa608('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xa608('0x2'),_0xa608('0x3'),_0xa608('0x4'),_0xa608('0x5'),'monitor_format',_0xa608('0x6'),_0xa608('0x7'),'dialMethod','dialLimitChannel',_0xa608('0x8'),'dialPowerLevel',_0xa608('0x9'),_0xa608('0xa'),_0xa608('0xb'),'dialOriginateCallerIdName',_0xa608('0xc'),'dialOriginateTimeout',_0xa608('0xd'),_0xa608('0xe'),'dialQueueProject',_0xa608('0xf'),_0xa608('0x10'),_0xa608('0x11'),_0xa608('0x12'),'dialNoAnswerMaxRetry',_0xa608('0x13'),_0xa608('0x14'),_0xa608('0x15'),_0xa608('0x16'),_0xa608('0x17'),'dialCheckDuplicateType',_0xa608('0x18'),_0xa608('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0xa608('0x1a'),_0xa608('0x1b'),_0xa608('0x1c'),_0xa608('0x1d'),'dialAMDSilenceThreshold',_0xa608('0x1e'),_0xa608('0x1f'),'dialRecallMeTimeout',_0xa608('0x20'),_0xa608('0x21'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2',_0xa608('0x22'),_0xa608('0x23'),_0xa608('0x24'),_0xa608('0x25')],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0xa608('0x2'),'callerid',_0xa608('0x26')]},{'model':_0xa608('0x27'),'as':_0xa608('0x28'),'attributes':['id',_0xa608('0x2'),_0xa608('0x29'),_0xa608('0x26')]},{'model':_0xa608('0x2a'),'as':_0xa608('0x2a'),'attributes':['id',_0xa608('0x2')],'include':[{'model':_0xa608('0x2a'),'as':_0xa608('0x2b'),'attributes':['id',_0xa608('0x2'),_0xa608('0x2c')]}]}]},'log':_0xa608('0x0')});};}; \ No newline at end of file +var _0x63a6=['callerid','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','autopause','monitor_format','type','dialActive','dialPowerLevel','dialPredictiveOptimization','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','Trunk','active'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x63a6,0x1c7));var _0x663a=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x63a6[_0x2bddf9];return _0x3f3ae9;};'use strict';var client=require('../client');exports[_0x663a('0x0')]=function(){return function(){return client[_0x663a('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x663a('0x2'),_0x663a('0x3'),'acwTimeout',_0x663a('0x4'),_0x663a('0x5'),_0x663a('0x6'),_0x663a('0x7'),'dialMethod','dialLimitChannel','dialLimitQueue',_0x663a('0x8'),_0x663a('0x9'),'dialPredictiveOptimizationPercentage','dialPredictiveInterval',_0x663a('0xa'),_0x663a('0xb'),_0x663a('0xc'),'dialQueueOptions','dialQueueTimeout',_0x663a('0xd'),_0x663a('0xe'),_0x663a('0xf'),_0x663a('0x10'),_0x663a('0x11'),_0x663a('0x12'),'dialNoAnswerRetryFrequency',_0x663a('0x13'),_0x663a('0x14'),_0x663a('0x15'),'dialPrefix','dialCheckDuplicateType',_0x663a('0x16'),'dialAMDInitialSilence','dialAMDGreeting',_0x663a('0x17'),_0x663a('0x18'),'dialAMDMinWordLength',_0x663a('0x19'),'dialAMDMaximumNumberOfWords',_0x663a('0x1a'),_0x663a('0x1b'),_0x663a('0x1c'),_0x663a('0x1d'),_0x663a('0x1e'),'dialOrderByScheduledAt',_0x663a('0x1f'),'dialAgiAfterHangupClient',_0x663a('0x20'),_0x663a('0x5'),_0x663a('0x21'),_0x663a('0x22'),'dialCutDigit'],'include':[{'model':_0x663a('0x23'),'as':'Trunk','attributes':['id','name','callerid',_0x663a('0x24')]},{'model':_0x663a('0x23'),'as':'TrunkBackup','attributes':['id','name',_0x663a('0x25'),_0x663a('0x24')]},{'model':_0x663a('0x26'),'as':_0x663a('0x26'),'attributes':['id',_0x663a('0x2')],'include':[{'model':_0x663a('0x26'),'as':_0x663a('0x27'),'attributes':['id','name',_0x663a('0x28')]}]}]},'log':_0x663a('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index bcebc68..d2fd328 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 _0x059b=['endOf','uniqueid','queue','queuecallerjoinAt','queuecallerexit','queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x432d38,_0x201399){var _0x39c577=function(_0x436c2a){while(--_0x436c2a){_0x432d38['push'](_0x432d38['shift']());}};_0x39c577(++_0x201399);}(_0x059b,0x15e));var _0xb059=function(_0x363b04,_0x1bbef9){_0x363b04=_0x363b04-0x0;var _0x3f854a=_0x059b[_0x363b04];return _0x3f854a;};'use strict';var moment=require('moment');var _=require('lodash');var client=require(_0xb059('0x0'));exports[_0xb059('0x1')]=function(_0x57cd27){return client[_0xb059('0x2')](_0xb059('0x3'),{'body':_0x57cd27,'log':_0xb059('0x3')});};exports[_0xb059('0x4')]=function(){return function(){return client[_0xb059('0x2')](_0xb059('0x5'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb059('0x6')](_0xb059('0x7'))[_0xb059('0x8')](_0xb059('0x9')),moment()[_0xb059('0xa')](_0xb059('0x7'))[_0xb059('0x8')](_0xb059('0x9'))]}},'attributes':[_0xb059('0xb'),_0xb059('0xc'),_0xb059('0xd'),'queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt',_0xb059('0xe'),_0xb059('0xf'),_0xb059('0x10'),_0xb059('0x11')]},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0x9996=['GetVoiceQueueReports','lodash','../client','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandon'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x9996,0x112));var _0x6999=function(_0x295161,_0xa387f6){_0x295161=_0x295161-0x0;var _0x5551aa=_0x9996[_0x295161];return _0x5551aa;};'use strict';var moment=require('moment');var _=require(_0x6999('0x0'));var client=require(_0x6999('0x1'));exports[_0x6999('0x2')]=function(_0x26933b){return client[_0x6999('0x3')](_0x6999('0x4'),{'body':_0x26933b,'log':_0x6999('0x4')});};exports[_0x6999('0x5')]=function(){return function(){return client[_0x6999('0x3')](_0x6999('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6999('0x7')]('day')[_0x6999('0x8')](_0x6999('0x9')),moment()[_0x6999('0xa')](_0x6999('0xb'))[_0x6999('0x8')](_0x6999('0x9'))]}},'attributes':[_0x6999('0xc'),_0x6999('0xd'),_0x6999('0xe'),_0x6999('0xf'),_0x6999('0x10'),_0x6999('0x11'),'queuecallerexit',_0x6999('0x12'),_0x6999('0x13'),'queuecallerabandonAt']},'log':_0x6999('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 982377f..38a03d9 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 _0x8df2=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','Request'];(function(_0x27ef73,_0x2a45d9){var _0x58a12f=function(_0x10c1d0){while(--_0x10c1d0){_0x27ef73['push'](_0x27ef73['shift']());}};_0x58a12f(++_0x2a45d9);}(_0x8df2,0x1b1));var _0x28df=function(_0x495628,_0x35f3ec){_0x495628=_0x495628-0x0;var _0x31bdd4=_0x8df2[_0x495628];return _0x31bdd4;};'use strict';var client=require('../client');exports[_0x28df('0x0')]=function(_0x3eebff){return function(){return client[_0x28df('0x1')](_0x28df('0x2'),{'options':{'where':{'VoiceQueueId':_0x3eebff,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x3164=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x433036,_0x1a08b1){var _0x33f0bc=function(_0x3655ad){while(--_0x3655ad){_0x433036['push'](_0x433036['shift']());}};_0x33f0bc(++_0x1a08b1);}(_0x3164,0x18b));var _0x4316=function(_0x2798dc,_0x5084c9){_0x2798dc=_0x2798dc-0x0;var _0x38b659=_0x3164[_0x2798dc];return _0x38b659;};'use strict';var client=require(_0x4316('0x0'));exports['getVoiceQueueRtPauses']=function(_0x4822a3){return function(){return client['Request'](_0x4316('0x1'),{'options':{'where':{'VoiceQueueId':_0x4822a3,'paused':!![]},'raw':!![]},'log':_0x4316('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index a1e6097..b190e91 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 _0x3f52=['../client','create','Request','CreateVoiceRecording','lodash'];(function(_0x1b5bb2,_0x16f726){var _0x1f1b9e=function(_0xf6171){while(--_0xf6171){_0x1b5bb2['push'](_0x1b5bb2['shift']());}};_0x1f1b9e(++_0x16f726);}(_0x3f52,0xb8));var _0x23f5=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x3f52[_0x2dea24];return _0x309d58;};'use strict';var _=require(_0x23f5('0x0'));var client=require(_0x23f5('0x1'));exports[_0x23f5('0x2')]=function(_0x3bbb8e){return client[_0x23f5('0x3')](_0x23f5('0x4'),{'body':_['merge'](_0x3bbb8e,{'value':_0x3bbb8e['monitorFilename']}),'log':_0x23f5('0x4')});}; \ No newline at end of file +var _0x710c=['merge','monitorFilename','CreateVoiceRecording','../client','create','Request'];(function(_0x31db70,_0x62d245){var _0x5623a4=function(_0x13ae49){while(--_0x13ae49){_0x31db70['push'](_0x31db70['shift']());}};_0x5623a4(++_0x62d245);}(_0x710c,0xc9));var _0xc710=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x710c[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var client=require(_0xc710('0x0'));exports[_0xc710('0x1')]=function(_0x157979){return client[_0xc710('0x2')]('CreateVoiceRecording',{'body':_[_0xc710('0x3')](_0x157979,{'value':_0x157979[_0xc710('0x4')]}),'log':_0xc710('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 59b1db9..18dacff 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 _0xe93d=['attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xe93d,0x95));var _0xde93=function(_0x4d0241,_0x24eceb){_0x4d0241=_0x4d0241-0x0;var _0x34f20f=_0xe93d[_0x4d0241];return _0x34f20f;};'use strict';var client=require(_0xde93('0x0'));exports[_0xde93('0x1')]=function(_0xe942cd){return client[_0xde93('0x2')](_0xde93('0x3'),{'body':{'result':_0xe942cd[_0xde93('0x4')],'transfererchannel':_0xe942cd[_0xde93('0x5')],'transferercalleridnum':_0xe942cd['transferercalleridnum'],'transferercalleridname':_0xe942cd[_0xde93('0x6')],'transfererconnectedlinenum':_0xe942cd[_0xde93('0x7')],'transfererconnectedlinename':_0xe942cd[_0xde93('0x8')],'transfereraccountcode':_0xe942cd[_0xde93('0x9')],'transferercontext':_0xe942cd[_0xde93('0xa')],'transfererexten':_0xe942cd['transfererexten'],'transfererlinkedid':_0xe942cd[_0xde93('0xb')],'transfereechannel':_0xe942cd['transfereechannel'],'transfereecalleridnum':_0xe942cd['transfereecalleridnum'],'transfereecalleridname':_0xe942cd[_0xde93('0xc')],'transfereeconnectedlinenum':_0xe942cd[_0xde93('0xd')],'transfereeconnectedlinename':_0xe942cd['transfereeconnectedlinename'],'transfereeaccountcode':_0xe942cd[_0xde93('0xe')],'transfereecontext':_0xe942cd[_0xde93('0xf')],'transfereeexten':_0xe942cd[_0xde93('0x10')],'transfereelinkedid':_0xe942cd[_0xde93('0x11')],'isexternal':_0xe942cd[_0xde93('0x12')],'context':_0xe942cd[_0xde93('0x13')],'extension':_0xe942cd[_0xde93('0x14')],'type':_0xde93('0x15')},'log':_0xde93('0x3')});};exports[_0xde93('0x16')]=function(_0x45bad0){return client[_0xde93('0x2')](_0xde93('0x3'),{'body':{'result':_0x45bad0['result'],'transfererchannel':_0x45bad0['origtransfererchannel'],'transferercalleridnum':_0x45bad0['origtransferercalleridnum'],'transferercalleridname':_0x45bad0[_0xde93('0x17')],'transfererconnectedlinenum':_0x45bad0[_0xde93('0x18')],'transfererconnectedlinename':_0x45bad0[_0xde93('0x19')],'transfereraccountcode':_0x45bad0['origtransfereraccountcode'],'transferercontext':_0x45bad0[_0xde93('0x1a')],'transfererexten':_0x45bad0[_0xde93('0x1b')],'transfererlinkedid':_0x45bad0['origtransfererlinkedid'],'transfereechannel':_0x45bad0[_0xde93('0x1c')],'transfereecalleridnum':_0x45bad0[_0xde93('0x1d')],'transfereecalleridname':_0x45bad0['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x45bad0[_0xde93('0x1e')],'transfereeconnectedlinename':_0x45bad0[_0xde93('0x1f')],'transfereeaccountcode':_0x45bad0[_0xde93('0x20')],'transfereecontext':_0x45bad0[_0xde93('0x21')],'transfereeexten':_0x45bad0['transfertargetexten'],'transfereelinkedid':_0x45bad0[_0xde93('0x22')],'isexternal':_0x45bad0['isexternal'],'context':_0x45bad0['origtransferercontext'],'extension':_0x45bad0[_0xde93('0x23')],'type':_0xde93('0x24')},'log':_0xde93('0x3')});}; \ No newline at end of file +var _0xe964=['transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','CreateVoiceTransferReport','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','blindTransfer','Request','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid'];(function(_0x1a10bd,_0x3b3f02){var _0x56048b=function(_0x54f054){while(--_0x54f054){_0x1a10bd['push'](_0x1a10bd['shift']());}};_0x56048b(++_0x3b3f02);}(_0xe964,0x65));var _0x4e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe964[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4e96('0x0'));exports[_0x4e96('0x1')]=function(_0x27ce03){return client[_0x4e96('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x27ce03['result'],'transfererchannel':_0x27ce03[_0x4e96('0x3')],'transferercalleridnum':_0x27ce03['transferercalleridnum'],'transferercalleridname':_0x27ce03['transferercalleridname'],'transfererconnectedlinenum':_0x27ce03[_0x4e96('0x4')],'transfererconnectedlinename':_0x27ce03[_0x4e96('0x5')],'transfereraccountcode':_0x27ce03[_0x4e96('0x6')],'transferercontext':_0x27ce03[_0x4e96('0x7')],'transfererexten':_0x27ce03[_0x4e96('0x8')],'transfererlinkedid':_0x27ce03[_0x4e96('0x9')],'transfereechannel':_0x27ce03[_0x4e96('0xa')],'transfereecalleridnum':_0x27ce03[_0x4e96('0xb')],'transfereecalleridname':_0x27ce03[_0x4e96('0xc')],'transfereeconnectedlinenum':_0x27ce03[_0x4e96('0xd')],'transfereeconnectedlinename':_0x27ce03[_0x4e96('0xe')],'transfereeaccountcode':_0x27ce03[_0x4e96('0xf')],'transfereecontext':_0x27ce03[_0x4e96('0x10')],'transfereeexten':_0x27ce03[_0x4e96('0x11')],'transfereelinkedid':_0x27ce03['transfereelinkedid'],'isexternal':_0x27ce03[_0x4e96('0x12')],'context':_0x27ce03[_0x4e96('0x13')],'extension':_0x27ce03['extension'],'type':'blind'},'log':_0x4e96('0x14')});};exports[_0x4e96('0x15')]=function(_0x4d1820){return client['Request'](_0x4e96('0x14'),{'body':{'result':_0x4d1820[_0x4e96('0x16')],'transfererchannel':_0x4d1820[_0x4e96('0x17')],'transferercalleridnum':_0x4d1820[_0x4e96('0x18')],'transferercalleridname':_0x4d1820['origtransferercalleridname'],'transfererconnectedlinenum':_0x4d1820['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4d1820[_0x4e96('0x19')],'transfereraccountcode':_0x4d1820[_0x4e96('0x1a')],'transferercontext':_0x4d1820[_0x4e96('0x1b')],'transfererexten':_0x4d1820[_0x4e96('0x1c')],'transfererlinkedid':_0x4d1820[_0x4e96('0x1d')],'transfereechannel':_0x4d1820['transfertargetchannel'],'transfereecalleridnum':_0x4d1820['transfertargetcalleridnum'],'transfereecalleridname':_0x4d1820[_0x4e96('0x1e')],'transfereeconnectedlinenum':_0x4d1820['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d1820[_0x4e96('0x1f')],'transfereeaccountcode':_0x4d1820['transfertargetaccountcode'],'transfereecontext':_0x4d1820[_0x4e96('0x20')],'transfereeexten':_0x4d1820[_0x4e96('0x21')],'transfereelinkedid':_0x4d1820[_0x4e96('0x22')],'isexternal':_0x4d1820[_0x4e96('0x12')],'context':_0x4d1820[_0x4e96('0x23')],'extension':_0x4d1820[_0x4e96('0x24')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6555c07..fea6374 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 _0x5496=['pick','keys','action','Reload','Action','then','ami\x20disconnected','join','command','Command','content','catch','message','voiceQueues','hasOwnProperty','strategy','answered','loggedIn','pTalking','sumBillable','sumHoldTime','unmanaged','waiting','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','Trunk','active','Interval','push','length','values','channels','map','find','uniqueid','channel','%s.%s','filename','wav','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','resolve','StopMixMonitor','destinationchannel','status','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','jayson/promise','validate','bluebird','../../../config/environment','../ami','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','updateStatusRealtime','isConnected','error','asterisk','username'];(function(_0x487873,_0x56c325){var _0x4f9b85=function(_0x34d619){while(--_0x34d619){_0x487873['push'](_0x487873['shift']());}};_0x4f9b85(++_0x56c325);}(_0x5496,0x175));var _0x6549=function(_0x776d6d,_0x4c1c76){_0x776d6d=_0x776d6d-0x0;var _0x35818a=_0x5496[_0x776d6d];return _0x35818a;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var jayson=require(_0x6549('0x2'));var schema=require(_0x6549('0x3'));var BPromise=require(_0x6549('0x4'));var moment=require('moment');var config=require(_0x6549('0x5'));var properties=require('../properties');var ami=require(_0x6549('0x6'));exports[_0x6549('0x7')]=function(_0x3750cc,_0x4d0473,_0x5a4658){return new BPromise(function(_0x43cb17,_0x1d8cea){var _0x4fcffd={'QueuePause':function(_0x1ca8fc){return new Promise(function(_0x3442c3,_0x1ef2a6){var _0x5c47ba=util[_0x6549('0x8')](_0x6549('0x9'),_0x6549('0xa'),_0x1ca8fc[_0x6549('0xb')]);if(_0x3750cc[_0x6549('0xc')]&&_0x3750cc[_0x6549('0xc')][_0x5c47ba]&&_0x3750cc['timers'][_0x5c47ba]['timer']){_0x3750cc[_0x6549('0xc')][_0x5c47ba][_0x6549('0xd')]();}if(_0x3750cc[_0x6549('0xe')][_0x5c47ba]){_0x3750cc[_0x6549('0xe')][_0x5c47ba][_0x6549('0xf')]({'statePause':_0x1ca8fc['pause']?!![]:![]});}_0x3442c3({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x3f844f){var _0x39d78c=this;return new Promise(function(_0x57a149,_0x200ff1){if(ami[_0x6549('0x10')]()==![]){return _0x200ff1(_0x39d78c[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')][_0x6549('0x13')],'ami\x20disconnected']['join']('\x20')));}_0x3f844f=_[_0x6549('0x14')](_0x3f844f,_[_0x6549('0x15')](properties['module']));_0x3f844f[_0x6549('0x16')]=_0x6549('0x17');return ami[_0x6549('0x18')](_0x3f844f)[_0x6549('0x19')](function(_0xffc8b9){_0x57a149({'code':0xc8,'message':_0xffc8b9['message']});})['catch'](function(_0x26a212){_0x200ff1(_0x39d78c['error'](0x1f5,_0x26a212['message']));});});},'Command':function(_0x31f8e7){var _0x1e5079=this;return new Promise(function(_0x19c4a6,_0xfca192){if(ami[_0x6549('0x10')]()==![]){return _0xfca192(_0x1e5079['error'](0x1f4,[config[_0x6549('0x12')]['ip'],config['asterisk'][_0x6549('0x13')],_0x6549('0x1a')][_0x6549('0x1b')]('\x20')));}_0x31f8e7=_[_0x6549('0x14')](_0x31f8e7,_0x6549('0x1c'));_0x31f8e7[_0x6549('0x16')]=_0x6549('0x1d');return ami[_0x6549('0x18')](_0x31f8e7)[_0x6549('0x19')](function(_0x6ae00c){_0x19c4a6({'code':0xc8,'message':_0x6ae00c[_0x6549('0x1e')]});})[_0x6549('0x1f')](function(_0x23c0ba){_0xfca192(_0x1e5079['error'](0x1f5,_0x23c0ba[_0x6549('0x20')]));});});},'VoiceQueues':function(_0x1bc8db){return new Promise(function(_0x53bbca,_0x126967){var _0x29f89e=[];for(var _0x3768cb in _0x3750cc['voiceQueues']){if(_0x3750cc[_0x6549('0x21')][_0x6549('0x22')](_0x3768cb)){var _0x14de1f=_0x3750cc[_0x6549('0x21')][_0x3768cb];var _0x442862={'id':_0x14de1f['id'],'name':_0x14de1f[_0x6549('0xb')],'strategy':_0x14de1f[_0x6549('0x23')],'answered':_0x14de1f[_0x6549('0x24')],'available':_0x14de1f['available'],'loggedIn':_0x14de1f[_0x6549('0x25')],'pTalking':_0x14de1f[_0x6549('0x26')],'sumBillable':_0x14de1f[_0x6549('0x27')],'sumDuration':_0x14de1f['sumDuration'],'sumHoldTime':_0x14de1f[_0x6549('0x28')]||0x0,'talking':_0x14de1f['talking'],'total':_0x14de1f['total'],'type':_0x14de1f['type'],'unmanaged':_0x14de1f[_0x6549('0x29')],'waiting':_0x14de1f[_0x6549('0x2a')],'loggedInDb':_0x14de1f['loggedInDb']};if(_0x14de1f[_0x6549('0x2b')]===_0x6549('0x2c')){_0x442862[_0x6549('0x2d')]=_0x14de1f[_0x6549('0x2d')];_0x442862[_0x6549('0x2e')]=_0x14de1f[_0x6549('0x2e')];_0x442862[_0x6549('0x2f')]=_0x14de1f['dialOriginateCallerIdName'];_0x442862[_0x6549('0x30')]=_0x14de1f[_0x6549('0x30')];_0x442862[_0x6549('0x31')]=_0x14de1f[_0x6549('0x31')];_0x442862[_0x6549('0x32')]=_0x14de1f[_0x6549('0x32')];_0x442862['outboundAnswerAgiCallsDay']=_0x14de1f[_0x6549('0x33')];_0x442862['outboundAnswerCallsDay']=_0x14de1f[_0x6549('0x34')];_0x442862['outboundBlacklistCallsDay']=_0x14de1f[_0x6549('0x35')];_0x442862[_0x6549('0x36')]=_0x14de1f[_0x6549('0x36')];_0x442862['outboundCongestionCallsDay']=_0x14de1f[_0x6549('0x37')];_0x442862[_0x6549('0x38')]=_0x14de1f[_0x6549('0x38')];_0x442862[_0x6549('0x39')]=_0x14de1f['outboundDropCallsDayCallersExit'];_0x442862['outboundDropCallsDayTimeout']=_0x14de1f['outboundDropCallsDayTimeout'];_0x442862[_0x6549('0x3a')]=_0x14de1f[_0x6549('0x3a')];_0x442862['outboundNoSuchCallsDay']=_0x14de1f[_0x6549('0x3b')];_0x442862[_0x6549('0x3c')]=_0x14de1f[_0x6549('0x3c')];_0x442862[_0x6549('0x3d')]=_0x14de1f[_0x6549('0x3d')];_0x442862['outboundRejectCallsDay']=_0x14de1f['outboundRejectCallsDay'];_0x442862[_0x6549('0x3e')]=_0x14de1f[_0x6549('0x3e')];_0x442862[_0x6549('0x3f')]=_0x14de1f[_0x6549('0x3f')];_0x442862[_0x6549('0x40')]=_0x14de1f[_0x6549('0x40')];_0x442862[_0x6549('0x41')]=_0x14de1f[_0x6549('0x41')];_0x442862[_0x6549('0x42')]=_0x14de1f[_0x6549('0x42')];_0x442862['predictiveIntervalDroppedCallsTimeout']=_0x14de1f[_0x6549('0x43')];_0x442862[_0x6549('0x44')]=_0x14de1f[_0x6549('0x44')];_0x442862[_0x6549('0x45')]=_0x14de1f[_0x6549('0x45')];_0x442862['predictiveIntervalHitRate']=_0x14de1f['predictiveIntervalHitRate'];_0x442862['predictiveIntervalLowerLimit']=_0x14de1f[_0x6549('0x46')];_0x442862[_0x6549('0x47')]=_0x14de1f[_0x6549('0x47')];_0x442862[_0x6549('0x48')]=_0x14de1f['predictiveIntervalPauses'];_0x442862['predictiveIntervalTotalCalls']=_0x14de1f[_0x6549('0x49')];_0x442862[_0x6549('0x20')]=_0x14de1f[_0x6549('0x20')];_0x442862['originated']=_0x14de1f[_0x6549('0x4a')];}if(_0x14de1f['Trunk']){_0x442862[_0x6549('0x4b')]={'id':_0x14de1f[_0x6549('0x4b')]['id'],'name':_0x14de1f[_0x6549('0x4b')][_0x6549('0xb')],'active':_0x14de1f[_0x6549('0x4b')][_0x6549('0x4c')],'callerid':_0x14de1f[_0x6549('0x4b')]['callerid']};}if(_0x14de1f[_0x6549('0x4d')]){_0x442862[_0x6549('0x4d')]={'id':_0x14de1f[_0x6549('0x4d')]['id'],'name':_0x14de1f[_0x6549('0x4d')][_0x6549('0xb')]};}_0x29f89e[_0x6549('0x4e')](_0x442862);}}_0x53bbca({'count':_0x29f89e[_0x6549('0x4f')],'rows':_0x29f89e});});},'VoiceChannels':function(_0x1eb455){return new Promise(function(_0x451070,_0x1a0ee3){var _0x2b7b6a=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x51')]);_0x451070({'count':_0x2b7b6a[_0x6549('0x4f')],'rows':_0x2b7b6a});});},'VoiceChannelMixMonitor':function(_0x43a6bb){var _0x1bc338=this;return new Promise(function(_0x5669f2,_0x1aab51){if(ami[_0x6549('0x10')]()==![]){return _0x1aab51(_0x1bc338[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config['asterisk'][_0x6549('0x13')],'ami\x20disconnected'][_0x6549('0x1b')]('\x20')));}var _0x465fff=schema(properties['voicechannel'])[_0x6549('0x3')](_0x43a6bb);if(_0x465fff[_0x6549('0x4f')]>0x0){return _0x1aab51(_0x1bc338[_0x6549('0x11')](0x1f4,_[_0x6549('0x52')](_0x465fff,_0x6549('0x20'))['join'](',\x20')));}var _0x4ce2d2=_[_0x6549('0x53')](_0x3750cc[_0x6549('0x51')],{'uniqueid':_0x43a6bb[_0x6549('0x54')]});if(_0x4ce2d2&&_0x4ce2d2[_0x6549('0x55')]){var _0x1e562b=util['format'](_0x6549('0x56'),_0x43a6bb[_0x6549('0x57')]||_0x43a6bb[_0x6549('0x54')],_0x43a6bb[_0x6549('0x8')]||_0x6549('0x58'));return ami[_0x6549('0x18')]({'action':_0x6549('0x59'),'channel':_0x4ce2d2[_0x6549('0x55')],'file':_0x1e562b,'options':'ai(mixmonitorid)'})[_0x6549('0x19')](function(_0x58746c){var _0x2ed77c=_[_0x6549('0x53')](_0x4ce2d2[_0x6549('0x5a')],{'filename':'/var/spool/asterisk/monitor/'+_0x1e562b[_0x6549('0x5b')]()});if(_[_0x6549('0x5c')](_0x2ed77c)){_0x4ce2d2[_0x6549('0x5a')]['push']({'filename':_0x6549('0x5d')+_0x1e562b[_0x6549('0x5b')](),'createdAt':moment()[_0x6549('0x8')](_0x6549('0x5e')),'mixmonitorid':_0x58746c[_0x6549('0x5f')],'status':_0x6549('0x60')});}else{_0x2ed77c['mixmonitorid']=_0x58746c[_0x6549('0x5f')];_0x2ed77c['status']=_0x6549('0x60');}_0x5669f2({'code':0xc8,'message':[_0x43a6bb[_0x6549('0x54')],_0x6549('0x61'),_0x58746c[_0x6549('0x5f')]][_0x6549('0x1b')]('\x20'),'mixmonitorid':_0x58746c[_0x6549('0x5f')]});})[_0x6549('0x1f')](function(_0x2e59ad){_0x1aab51(_0x1bc338[_0x6549('0x11')](0x1f5,[_0x43a6bb[_0x6549('0x54')],_0x2e59ad[_0x6549('0x20')][_0x6549('0x5b')]()]['join']('\x20')));});}else{return _0x1aab51(_0x1bc338[_0x6549('0x11')](0x1f5,_0x6549('0x62')));}});},'VoiceChannelStopMixMonitor':function(_0x325c0a){var _0x1eaa0f=this;return new Promise(function(_0x260097,_0x1ffa23){if(ami[_0x6549('0x10')]()==![]){return _0x1ffa23(_0x1eaa0f[_0x6549('0x11')](0x1f4,[config['asterisk']['ip'],config[_0x6549('0x12')][_0x6549('0x13')],_0x6549('0x1a')][_0x6549('0x1b')]('\x20')));}var _0x2b0ba8=schema(properties[_0x6549('0x63')])[_0x6549('0x3')](_0x325c0a);if(_0x2b0ba8[_0x6549('0x4f')]>0x0){return _0x1ffa23(_0x1eaa0f['error'](0x1f4,_[_0x6549('0x52')](_0x2b0ba8,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x27ca0d=_[_0x6549('0x53')](_0x3750cc[_0x6549('0x51')],{'uniqueid':_0x325c0a['uniqueid']});if(_0x27ca0d){return BPromise[_0x6549('0x64')]()[_0x6549('0x19')](function(){if(_0x27ca0d['channel']){return ami[_0x6549('0x18')]({'action':_0x6549('0x65'),'channel':_0x27ca0d[_0x6549('0x55')],'mixmonitorid':_0x325c0a['mixmonitorid']})[_0x6549('0x1f')](function(_0x25d086){});}})['then'](function(){if(_0x27ca0d[_0x6549('0x66')]){return ami['Action']({'action':_0x6549('0x65'),'channel':_0x27ca0d['destinationchannel'],'mixmonitorid':_0x325c0a[_0x6549('0x5f')]})[_0x6549('0x1f')](function(_0x1b791c){});}})[_0x6549('0x19')](function(_0x2da535){var _0x45eb28=_[_0x6549('0x53')](_0x27ca0d[_0x6549('0x5a')],{'mixmonitorid':_0x325c0a[_0x6549('0x5f')]});if(_0x45eb28){_0x45eb28[_0x6549('0x67')]=_0x6549('0x68');}})[_0x6549('0x19')](function(){var _0x50cd18=util[_0x6549('0x8')]('%s.%s',_0x325c0a[_0x6549('0x57')]||_0x325c0a[_0x6549('0x54')],_0x325c0a['format']||_0x6549('0x58'));var _0x8eb1eb=_[_0x6549('0x53')](_0x27ca0d[_0x6549('0x5a')],{'filename':'/var/spool/asterisk/monitor/'+_0x50cd18[_0x6549('0x5b')]()});if(_0x8eb1eb){_0x8eb1eb[_0x6549('0x67')]=_0x6549('0x68');}})[_0x6549('0x19')](function(){_0x260097({'code':0xc8,'message':[_0x325c0a['uniqueid'],_0x6549('0x69')]['join']('\x20')});})[_0x6549('0x1f')](function(_0x16dc29){_0x1ffa23(_0x1eaa0f[_0x6549('0x11')](0x1f5,[_0x325c0a[_0x6549('0x54')],_0x16dc29[_0x6549('0x20')][_0x6549('0x5b')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x1ffa23(_0x1eaa0f[_0x6549('0x11')](0x1f5,_0x6549('0x62')));}});},'VoiceQueuesChannels':function(_0x1cd528){return new Promise(function(_0x49427f,_0x341170){var _0x3b326a=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x6a')]);_0x49427f({'count':_0x3b326a[_0x6549('0x4f')],'rows':_0x3b326a});});},'VoiceQueuesChannel':function(_0xfcebaf){var _0x56e144=this;return new Promise(function(_0x47f0ed,_0x368298){var _0x11886e=schema(properties[_0x6549('0x6b')])['validate'](_0xfcebaf);if(_0x11886e[_0x6549('0x4f')]>0x0){return _0x368298(_0x56e144[_0x6549('0x11')](0x1f4,_['map'](_0x11886e,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x46026b=_[_0x6549('0x53')](_0x3750cc[_0x6549('0x6a')],{'uniqueid':_0xfcebaf[_0x6549('0x54')]});if(_0x46026b){_0x47f0ed(_0x46026b);}else{return _0x368298(_0x56e144[_0x6549('0x11')](0x1f5,_0x6549('0x62')));}});},'VoiceQueuesChannelHangup':function(_0x503935){var _0x43c667=this;return new Promise(function(_0x51916f,_0x23e42b){if(ami[_0x6549('0x10')]()==![]){return _0x23e42b(_0x43c667['error'](0x1f4,[config[_0x6549('0x12')]['ip'],config[_0x6549('0x12')][_0x6549('0x13')],'ami\x20disconnected'][_0x6549('0x1b')]('\x20')));}var _0x755ff1=schema(properties[_0x6549('0x6c')])[_0x6549('0x3')](_0x503935);if(_0x755ff1[_0x6549('0x4f')]>0x0){return _0x23e42b(_0x43c667[_0x6549('0x11')](0x1f4,_['map'](_0x755ff1,_0x6549('0x20'))[_0x6549('0x1b')](',\x20')));}var _0x1f022d=_['find'](_0x3750cc['queueChannels'],{'uniqueid':_0x503935['uniqueid']});if(_0x1f022d&&_0x1f022d[_0x6549('0x55')]){return ami[_0x6549('0x18')]({'action':_0x6549('0x6d'),'channel':_0x1f022d['channel']})['then'](function(_0x1458a3){_0x51916f({'code':0xc8,'message':[_0x503935['uniqueid'],_0x1458a3[_0x6549('0x20')][_0x6549('0x5b')]()][_0x6549('0x1b')]('\x20')});})[_0x6549('0x1f')](function(_0x2180a6){_0x23e42b(_0x43c667[_0x6549('0x11')](0x1f5,[_0x503935[_0x6549('0x54')],_0x2180a6['message'][_0x6549('0x5b')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x23e42b(_0x43c667[_0x6549('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x22f06e){var _0x13ad42=this;return new Promise(function(_0x3e5958,_0x16a15f){if(ami[_0x6549('0x10')]()==![]){return _0x16a15f(_0x13ad42[_0x6549('0x11')](0x1f4,[config[_0x6549('0x12')]['ip'],config['asterisk'][_0x6549('0x13')],'ami\x20disconnected'][_0x6549('0x1b')]('\x20')));}var _0x476b0d=schema(properties[_0x6549('0x6e')])[_0x6549('0x3')](_0x22f06e);if(_0x476b0d[_0x6549('0x4f')]>0x0){return _0x16a15f(_0x13ad42[_0x6549('0x11')](0x1f4,_[_0x6549('0x52')](_0x476b0d,_0x6549('0x20'))['join'](',\x20')));}var _0x243bf3=_[_0x6549('0x53')](_0x3750cc[_0x6549('0x6a')],{'uniqueid':_0x22f06e[_0x6549('0x54')]});if(_0x243bf3&&_0x243bf3[_0x6549('0x55')]){return ami[_0x6549('0x18')]({'action':_0x6549('0x6f'),'channel':_0x243bf3[_0x6549('0x55')],'exten':_0x22f06e[_0x6549('0x70')],'context':_0x22f06e[_0x6549('0x71')]||_0x243bf3['context'],'priority':0x1})[_0x6549('0x19')](function(_0xa5a1ff){_0x3e5958({'code':0xc8,'message':[_0x22f06e[_0x6549('0x54')],_0xa5a1ff[_0x6549('0x20')][_0x6549('0x5b')]()][_0x6549('0x1b')]('\x20')});})[_0x6549('0x1f')](function(_0x463ab1){_0x16a15f(_0x13ad42[_0x6549('0x11')](0x1f5,[_0x22f06e[_0x6549('0x54')],_0x463ab1[_0x6549('0x20')][_0x6549('0x5b')]()][_0x6549('0x1b')]('\x20')));});}else{return _0x16a15f(_0x13ad42[_0x6549('0x11')](0x1f5,_0x6549('0x62')));}});},'Agents':function(_0x14fb53){return new Promise(function(_0x166d15,_0x1f9338){var _0x4b1652=_[_0x6549('0x50')](_0x3750cc[_0x6549('0xe')]);_0x166d15({'count':_0x4b1652[_0x6549('0x4f')],'rows':_0x4b1652});});},'Telephones':function(_0x35bad6){return new Promise(function(_0x371d8a,_0xfde69e){var _0x279757=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x72')]);_0x371d8a({'count':_0x279757[_0x6549('0x4f')],'rows':_0x279757});});},'Trunks':function(_0x1b1368){return new Promise(function(_0x1da2d7,_0x348d55){var _0x184995=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x73')]);_0x1da2d7({'count':_0x184995[_0x6549('0x4f')],'rows':_0x184995});});},'OutboundChannels':function(_0x4f8914){return new Promise(function(_0x2f6a6d,_0x42b100){var _0x45bc1e=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x74')]);_0x2f6a6d({'count':_0x45bc1e[_0x6549('0x4f')],'rows':_0x45bc1e});});},'Outbound':function(_0x3206e8){return new Promise(function(_0x51665b,_0x182528){_0x51665b(_0x3750cc['outbound']);});},'Campaigns':function(_0x597bbb){return new Promise(function(_0x3d0d09,_0x4ebaf9){var _0x3e8de9=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x75')]);_0x3d0d09({'count':_0x3e8de9[_0x6549('0x4f')],'rows':_0x3e8de9});});},'VoiceQueuesPreview':function(_0x419fdb){var _0x5ac35c=this;return new Promise(function(_0x352182,_0x51253c){_0x4d0473[_0x6549('0x76')](_0x419fdb['id'])[_0x6549('0x19')](function(_0x4528fd){_0x352182({'code':0xc8,'message':_0x4528fd['message']});})[_0x6549('0x1f')](function(_0x2e013e){_0x51253c(_0x5ac35c['error'](0x1f4,_0x2e013e['message']));});});},'EventManager':function(_0x2ab21b){var _0x154346=this;return new Promise(function(_0x16bb7e,_0x22c9f1){if(!_0x2ab21b[_0x6549('0x77')]){return _0x22c9f1(_0x154346[_0x6549('0x11')](0x1f4,_0x6549('0x78')));}ami[_0x6549('0x79')](_0x6549('0x7a')+_0x2ab21b[_0x6549('0x77')],_0x2ab21b[_0x6549('0x20')]);_0x16bb7e({'code':0xc8,'message':_0x2ab21b});});},'FaxAccounts':function(_0x24fbe8){return new Promise(function(_0x1b6f22,_0x4746bb){var _0x159467=_[_0x6549('0x50')](_0x3750cc[_0x6549('0x7b')]);_0x1b6f22({'count':_0x159467[_0x6549('0x4f')],'rows':_0x159467});});},'SendFax':function(_0x26773b){var _0x5285ea=this;return new Promise(function(_0x5b8b88,_0x3d5ccd){_0x5a4658[_0x6549('0x7c')](_0x26773b)[_0x6549('0x19')](function(_0x1273d6){_0x5b8b88({'code':0xc8,'message':_0x1273d6[_0x6549('0x20')]});})[_0x6549('0x1f')](function(_0x63496d){_0x3d5ccd(_0x5285ea[_0x6549('0x11')](0x1f4,_0x63496d[_0x6549('0x20')]));});});},'CheckAfterSend':function(_0x263803){var _0x4c5c63=this;return new Promise(function(_0x582217,_0x4fdff5){_0x5a4658[_0x6549('0x7d')](_0x263803)[_0x6549('0x19')](function(_0x4261c2){_0x582217({'code':0xc8,'message':_0x4261c2[_0x6549('0x20')]});})[_0x6549('0x1f')](function(_0x570f56){_0x4fdff5(_0x4c5c63[_0x6549('0x11')](0x1f4,_0x570f56[_0x6549('0x20')]));});});}};var _0x871c3=jayson[_0x6549('0x7e')](_0x4fcffd)[_0x6549('0x7f')]();_0x871c3['on'](_0x6549('0x11'),function(_0xaf1a80){return _0x1d8cea(_0xaf1a80);});_0x871c3[_0x6549('0x7')](0x232a,_0x6549('0x80'),function(){console[_0x6549('0x81')](_0x6549('0x82'),0x232a);return _0x43cb17('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0x975b=['outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalLowerLimit','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','Trunk','active','callerid','Interval','length','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','find','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','destinationchannel','StopMixMonitor','stop','voicequeuechannel','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','faxAccounts','server','http','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','bluebird','moment','../../../config/environment','../ami','listen','format','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','join','pick','keys','action','Action','then','message','catch','error','ami\x20disconnected','command','content','voiceQueues','hasOwnProperty','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay'];(function(_0x9cf222,_0x2232ab){var _0x10cbe8=function(_0x146255){while(--_0x146255){_0x9cf222['push'](_0x9cf222['shift']());}};_0x10cbe8(++_0x2232ab);}(_0x975b,0x1c9));var _0xb975=function(_0x9af9ef,_0x16d579){_0x9af9ef=_0x9af9ef-0x0;var _0x43f724=_0x975b[_0x9af9ef];return _0x43f724;};'use strict';var _=require(_0xb975('0x0'));var util=require(_0xb975('0x1'));var jayson=require(_0xb975('0x2'));var schema=require(_0xb975('0x3'));var BPromise=require(_0xb975('0x4'));var moment=require(_0xb975('0x5'));var config=require(_0xb975('0x6'));var properties=require('../properties');var ami=require(_0xb975('0x7'));exports[_0xb975('0x8')]=function(_0x2007e4,_0x233cd3,_0x599d95){return new BPromise(function(_0x1729fe,_0x3d84f1){var _0x5786ec={'QueuePause':function(_0x4178ee){return new Promise(function(_0x550f78,_0x3dab5b){var _0x593069=util[_0xb975('0x9')](_0xb975('0xa'),_0xb975('0xb'),_0x4178ee['name']);if(_0x2007e4[_0xb975('0xc')]&&_0x2007e4['timers'][_0x593069]&&_0x2007e4[_0xb975('0xc')][_0x593069]['timer']){_0x2007e4[_0xb975('0xc')][_0x593069]['updateAcw']();}if(_0x2007e4[_0xb975('0xd')][_0x593069]){_0x2007e4[_0xb975('0xd')][_0x593069][_0xb975('0xe')]({'statePause':_0x4178ee[_0xb975('0xf')]?!![]:![]});}_0x550f78({'code':0xc8,'message':_0xb975('0x10')});});},'Reload':function(_0x558727){var _0x189e0f=this;return new Promise(function(_0x29ee5d,_0x2979bd){if(ami[_0xb975('0x11')]()==![]){return _0x2979bd(_0x189e0f['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}_0x558727=_[_0xb975('0x15')](_0x558727,_[_0xb975('0x16')](properties['module']));_0x558727[_0xb975('0x17')]='Reload';return ami[_0xb975('0x18')](_0x558727)[_0xb975('0x19')](function(_0xaa1ba3){_0x29ee5d({'code':0xc8,'message':_0xaa1ba3[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x327728){_0x2979bd(_0x189e0f[_0xb975('0x1c')](0x1f5,_0x327728['message']));});});},'Command':function(_0x5c6830){var _0x2abb84=this;return new Promise(function(_0x2da9fd,_0x2e34a6){if(ami[_0xb975('0x11')]()==![]){return _0x2e34a6(_0x2abb84['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config['asterisk'][_0xb975('0x13')],_0xb975('0x1d')][_0xb975('0x14')]('\x20')));}_0x5c6830=_['pick'](_0x5c6830,_0xb975('0x1e'));_0x5c6830['action']='Command';return ami[_0xb975('0x18')](_0x5c6830)[_0xb975('0x19')](function(_0x226f21){_0x2da9fd({'code':0xc8,'message':_0x226f21[_0xb975('0x1f')]});})[_0xb975('0x1b')](function(_0x5620fc){_0x2e34a6(_0x2abb84[_0xb975('0x1c')](0x1f5,_0x5620fc['message']));});});},'VoiceQueues':function(_0x4663e0){return new Promise(function(_0x100546,_0xc0d861){var _0x263f73=[];for(var _0x5309c6 in _0x2007e4[_0xb975('0x20')]){if(_0x2007e4[_0xb975('0x20')][_0xb975('0x21')](_0x5309c6)){var _0xed596=_0x2007e4['voiceQueues'][_0x5309c6];var _0x323600={'id':_0xed596['id'],'name':_0xed596[_0xb975('0x22')],'strategy':_0xed596[_0xb975('0x23')],'answered':_0xed596[_0xb975('0x24')],'available':_0xed596[_0xb975('0x25')],'loggedIn':_0xed596[_0xb975('0x26')],'pTalking':_0xed596[_0xb975('0x27')],'sumBillable':_0xed596[_0xb975('0x28')],'sumDuration':_0xed596[_0xb975('0x29')],'sumHoldTime':_0xed596['sumHoldTime']||0x0,'talking':_0xed596[_0xb975('0x2a')],'total':_0xed596[_0xb975('0x2b')],'type':_0xed596[_0xb975('0x2c')],'unmanaged':_0xed596[_0xb975('0x2d')],'waiting':_0xed596[_0xb975('0x2e')],'loggedInDb':_0xed596[_0xb975('0x2f')]};if(_0xed596[_0xb975('0x2c')]===_0xb975('0x30')){_0x323600[_0xb975('0x31')]=_0xed596[_0xb975('0x31')];_0x323600[_0xb975('0x32')]=_0xed596['dialMethod'];_0x323600[_0xb975('0x33')]=_0xed596['dialOriginateCallerIdName'];_0x323600['dialOriginateCallerIdNumber']=_0xed596[_0xb975('0x34')];_0x323600['dialOriginateTimeout']=_0xed596[_0xb975('0x35')];_0x323600[_0xb975('0x36')]=_0xed596['dialPrefix'];_0x323600[_0xb975('0x37')]=_0xed596['outboundAnswerAgiCallsDay'];_0x323600[_0xb975('0x38')]=_0xed596[_0xb975('0x38')];_0x323600[_0xb975('0x39')]=_0xed596[_0xb975('0x39')];_0x323600[_0xb975('0x3a')]=_0xed596['outboundBusyCallsDay'];_0x323600[_0xb975('0x3b')]=_0xed596['outboundCongestionCallsDay'];_0x323600['outboundDropCallsDayACS']=_0xed596[_0xb975('0x3c')];_0x323600[_0xb975('0x3d')]=_0xed596[_0xb975('0x3d')];_0x323600[_0xb975('0x3e')]=_0xed596[_0xb975('0x3e')];_0x323600[_0xb975('0x3f')]=_0xed596[_0xb975('0x3f')];_0x323600[_0xb975('0x40')]=_0xed596['outboundNoSuchCallsDay'];_0x323600[_0xb975('0x41')]=_0xed596[_0xb975('0x41')];_0x323600['outboundReCallsDay']=_0xed596[_0xb975('0x42')];_0x323600[_0xb975('0x43')]=_0xed596[_0xb975('0x43')];_0x323600[_0xb975('0x44')]=_0xed596[_0xb975('0x44')];_0x323600[_0xb975('0x45')]=_0xed596[_0xb975('0x45')];_0x323600['predictiveIntervalAvgHoldtime']=_0xed596[_0xb975('0x46')];_0x323600['predictiveIntervalAvgTalktime']=_0xed596[_0xb975('0x47')];_0x323600[_0xb975('0x48')]=_0xed596['predictiveIntervalDroppedCallsCallersExit'];_0x323600[_0xb975('0x49')]=_0xed596['predictiveIntervalDroppedCallsTimeout'];_0x323600[_0xb975('0x4a')]=_0xed596[_0xb975('0x4a')];_0x323600[_0xb975('0x4b')]=_0xed596[_0xb975('0x4b')];_0x323600[_0xb975('0x4c')]=_0xed596[_0xb975('0x4c')];_0x323600[_0xb975('0x4d')]=_0xed596[_0xb975('0x4d')];_0x323600['predictiveIntervalMultiplicativeFactor']=_0xed596[_0xb975('0x4e')];_0x323600[_0xb975('0x4f')]=_0xed596[_0xb975('0x4f')];_0x323600['predictiveIntervalTotalCalls']=_0xed596['predictiveIntervalTotalCalls'];_0x323600[_0xb975('0x1a')]=_0xed596[_0xb975('0x1a')];_0x323600[_0xb975('0x50')]=_0xed596['originated'];}if(_0xed596['Trunk']){_0x323600[_0xb975('0x51')]={'id':_0xed596[_0xb975('0x51')]['id'],'name':_0xed596[_0xb975('0x51')][_0xb975('0x22')],'active':_0xed596['Trunk'][_0xb975('0x52')],'callerid':_0xed596[_0xb975('0x51')][_0xb975('0x53')]};}if(_0xed596[_0xb975('0x54')]){_0x323600['Interval']={'id':_0xed596[_0xb975('0x54')]['id'],'name':_0xed596[_0xb975('0x54')]['name']};}_0x263f73['push'](_0x323600);}}_0x100546({'count':_0x263f73[_0xb975('0x55')],'rows':_0x263f73});});},'VoiceChannels':function(_0x5eea71){return new Promise(function(_0x545b31,_0x224ef0){var _0x5e8472=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x57')]);_0x545b31({'count':_0x5e8472['length'],'rows':_0x5e8472});});},'VoiceChannelMixMonitor':function(_0x155402){var _0x3c3b17=this;return new Promise(function(_0x5df4ff,_0x10f3b2){if(ami[_0xb975('0x11')]()==![]){return _0x10f3b2(_0x3c3b17['error'](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x2d7ffa=schema(properties[_0xb975('0x58')])['validate'](_0x155402);if(_0x2d7ffa[_0xb975('0x55')]>0x0){return _0x10f3b2(_0x3c3b17[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x2d7ffa,_0xb975('0x1a'))['join'](',\x20')));}var _0x5ee69e=_['find'](_0x2007e4[_0xb975('0x57')],{'uniqueid':_0x155402[_0xb975('0x5a')]});if(_0x5ee69e&&_0x5ee69e[_0xb975('0x5b')]){var _0x2cb2cc=util[_0xb975('0x9')](_0xb975('0x5c'),_0x155402[_0xb975('0x5d')]||_0x155402[_0xb975('0x5a')],_0x155402[_0xb975('0x9')]||_0xb975('0x5e'));return ami[_0xb975('0x18')]({'action':'MixMonitor','channel':_0x5ee69e[_0xb975('0x5b')],'file':_0x2cb2cc,'options':'ai(mixmonitorid)'})['then'](function(_0x5a5f99){var _0x27852d=_[_0xb975('0x5f')](_0x5ee69e['monitors'],{'filename':_0xb975('0x60')+_0x2cb2cc[_0xb975('0x61')]()});if(_[_0xb975('0x62')](_0x27852d)){_0x5ee69e[_0xb975('0x63')][_0xb975('0x64')]({'filename':_0xb975('0x60')+_0x2cb2cc[_0xb975('0x61')](),'createdAt':moment()[_0xb975('0x9')](_0xb975('0x65')),'mixmonitorid':_0x5a5f99['mixmonitorid'],'status':'rec'});}else{_0x27852d['mixmonitorid']=_0x5a5f99[_0xb975('0x66')];_0x27852d[_0xb975('0x67')]='rec';}_0x5df4ff({'code':0xc8,'message':[_0x155402[_0xb975('0x5a')],_0xb975('0x68'),_0x5a5f99[_0xb975('0x66')]]['join']('\x20'),'mixmonitorid':_0x5a5f99[_0xb975('0x66')]});})['catch'](function(_0x3853ac){_0x10f3b2(_0x3c3b17['error'](0x1f5,[_0x155402[_0xb975('0x5a')],_0x3853ac[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x10f3b2(_0x3c3b17['error'](0x1f5,_0xb975('0x69')));}});},'VoiceChannelStopMixMonitor':function(_0x108872){var _0x4ee3b0=this;return new Promise(function(_0x57def2,_0x5c4831){if(ami[_0xb975('0x11')]()==![]){return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],_0xb975('0x1d')][_0xb975('0x14')]('\x20')));}var _0x117277=schema(properties[_0xb975('0x58')])[_0xb975('0x3')](_0x108872);if(_0x117277[_0xb975('0x55')]>0x0){return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x117277,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0x4ee894=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x57')],{'uniqueid':_0x108872[_0xb975('0x5a')]});if(_0x4ee894){return BPromise[_0xb975('0x6a')]()[_0xb975('0x19')](function(){if(_0x4ee894['channel']){return ami['Action']({'action':'StopMixMonitor','channel':_0x4ee894[_0xb975('0x5b')],'mixmonitorid':_0x108872[_0xb975('0x66')]})[_0xb975('0x1b')](function(_0xf4957b){});}})[_0xb975('0x19')](function(){if(_0x4ee894[_0xb975('0x6b')]){return ami['Action']({'action':_0xb975('0x6c'),'channel':_0x4ee894['destinationchannel'],'mixmonitorid':_0x108872[_0xb975('0x66')]})['catch'](function(_0x40a708){});}})[_0xb975('0x19')](function(_0x2dd984){var _0xdfce82=_[_0xb975('0x5f')](_0x4ee894[_0xb975('0x63')],{'mixmonitorid':_0x108872[_0xb975('0x66')]});if(_0xdfce82){_0xdfce82[_0xb975('0x67')]=_0xb975('0x6d');}})[_0xb975('0x19')](function(){var _0x44dad4=util[_0xb975('0x9')](_0xb975('0x5c'),_0x108872[_0xb975('0x5d')]||_0x108872[_0xb975('0x5a')],_0x108872[_0xb975('0x9')]||'wav');var _0x4e9873=_[_0xb975('0x5f')](_0x4ee894['monitors'],{'filename':_0xb975('0x60')+_0x44dad4[_0xb975('0x61')]()});if(_0x4e9873){_0x4e9873[_0xb975('0x67')]='stop';}})[_0xb975('0x19')](function(){_0x57def2({'code':0xc8,'message':[_0x108872[_0xb975('0x5a')],'StopMixMonitor\x20Success'][_0xb975('0x14')]('\x20')});})['catch'](function(_0x464c75){_0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f5,[_0x108872[_0xb975('0x5a')],_0x464c75[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x5c4831(_0x4ee3b0[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannels':function(_0xad129e){return new Promise(function(_0x318174,_0xf0393b){var _0x3b0e53=_[_0xb975('0x56')](_0x2007e4['queueChannels']);_0x318174({'count':_0x3b0e53[_0xb975('0x55')],'rows':_0x3b0e53});});},'VoiceQueuesChannel':function(_0x34cc42){var _0x1c52ac=this;return new Promise(function(_0x4a0739,_0x575702){var _0x69657c=schema(properties[_0xb975('0x6e')])[_0xb975('0x3')](_0x34cc42);if(_0x69657c[_0xb975('0x55')]>0x0){return _0x575702(_0x1c52ac[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x69657c,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0x390660=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x34cc42['uniqueid']});if(_0x390660){_0x4a0739(_0x390660);}else{return _0x575702(_0x1c52ac[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannelHangup':function(_0x5aa2be){var _0xa2c67=this;return new Promise(function(_0x52647f,_0x7661c4){if(ami[_0xb975('0x11')]()==![]){return _0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x547a85=schema(properties[_0xb975('0x70')])[_0xb975('0x3')](_0x5aa2be);if(_0x547a85[_0xb975('0x55')]>0x0){return _0x7661c4(_0xa2c67['error'](0x1f4,_[_0xb975('0x59')](_0x547a85,_0xb975('0x1a'))['join'](',\x20')));}var _0x559cfc=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x5aa2be[_0xb975('0x5a')]});if(_0x559cfc&&_0x559cfc[_0xb975('0x5b')]){return ami['Action']({'action':'Hangup','channel':_0x559cfc[_0xb975('0x5b')]})[_0xb975('0x19')](function(_0x457e57){_0x52647f({'code':0xc8,'message':[_0x5aa2be[_0xb975('0x5a')],_0x457e57[_0xb975('0x1a')][_0xb975('0x61')]()]['join']('\x20')});})['catch'](function(_0x1f7196){_0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f5,[_0x5aa2be[_0xb975('0x5a')],_0x1f7196[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')));});}else{return _0x7661c4(_0xa2c67[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'VoiceQueuesChannelRedirect':function(_0x282b2e){var _0x2125d4=this;return new Promise(function(_0x3d0c7b,_0x4b75aa){if(ami[_0xb975('0x11')]()==![]){return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f4,[config[_0xb975('0x12')]['ip'],config[_0xb975('0x12')][_0xb975('0x13')],'ami\x20disconnected'][_0xb975('0x14')]('\x20')));}var _0x18be39=schema(properties[_0xb975('0x71')])[_0xb975('0x3')](_0x282b2e);if(_0x18be39[_0xb975('0x55')]>0x0){return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f4,_[_0xb975('0x59')](_0x18be39,_0xb975('0x1a'))[_0xb975('0x14')](',\x20')));}var _0xa41c73=_[_0xb975('0x5f')](_0x2007e4[_0xb975('0x6f')],{'uniqueid':_0x282b2e[_0xb975('0x5a')]});if(_0xa41c73&&_0xa41c73[_0xb975('0x5b')]){return ami[_0xb975('0x18')]({'action':_0xb975('0x72'),'channel':_0xa41c73[_0xb975('0x5b')],'exten':_0x282b2e[_0xb975('0x73')],'context':_0x282b2e['context']||_0xa41c73[_0xb975('0x74')],'priority':0x1})[_0xb975('0x19')](function(_0x551afd){_0x3d0c7b({'code':0xc8,'message':[_0x282b2e[_0xb975('0x5a')],_0x551afd[_0xb975('0x1a')][_0xb975('0x61')]()][_0xb975('0x14')]('\x20')});})['catch'](function(_0xc98f70){_0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f5,[_0x282b2e[_0xb975('0x5a')],_0xc98f70[_0xb975('0x1a')]['toLowerCase']()][_0xb975('0x14')]('\x20')));});}else{return _0x4b75aa(_0x2125d4[_0xb975('0x1c')](0x1f5,_0xb975('0x69')));}});},'Agents':function(_0x4c33f8){return new Promise(function(_0x43cdc9,_0x140bb6){var _0xc9f295=_[_0xb975('0x56')](_0x2007e4[_0xb975('0xd')]);_0x43cdc9({'count':_0xc9f295[_0xb975('0x55')],'rows':_0xc9f295});});},'Telephones':function(_0x21bba3){return new Promise(function(_0x131f44,_0x5e0551){var _0x1b73c4=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x75')]);_0x131f44({'count':_0x1b73c4['length'],'rows':_0x1b73c4});});},'Trunks':function(_0x4177c2){return new Promise(function(_0x32d624,_0x28c74d){var _0x89b1d0=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x76')]);_0x32d624({'count':_0x89b1d0[_0xb975('0x55')],'rows':_0x89b1d0});});},'OutboundChannels':function(_0x2424d7){return new Promise(function(_0x7930ad,_0x186e66){var _0x5bc7e7=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x77')]);_0x7930ad({'count':_0x5bc7e7['length'],'rows':_0x5bc7e7});});},'Outbound':function(_0x42dfb8){return new Promise(function(_0x8c198a,_0x5c270e){_0x8c198a(_0x2007e4[_0xb975('0x30')]);});},'Campaigns':function(_0x1fdfc6){return new Promise(function(_0x22a13e,_0x66f58f){var _0x5b1e9f=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x78')]);_0x22a13e({'count':_0x5b1e9f[_0xb975('0x55')],'rows':_0x5b1e9f});});},'VoiceQueuesPreview':function(_0xaac8c1){var _0x7fcdae=this;return new Promise(function(_0x1d1943,_0x35d443){_0x233cd3[_0xb975('0x79')](_0xaac8c1['id'])[_0xb975('0x19')](function(_0x22bef3){_0x1d1943({'code':0xc8,'message':_0x22bef3[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x382a99){_0x35d443(_0x7fcdae[_0xb975('0x1c')](0x1f4,_0x382a99[_0xb975('0x1a')]));});});},'EventManager':function(_0x502907){var _0x3b5a9f=this;return new Promise(function(_0x5cc346,_0x4b61a6){if(!_0x502907[_0xb975('0x7a')]){return _0x4b61a6(_0x3b5a9f[_0xb975('0x1c')](0x1f4,_0xb975('0x7b')));}ami[_0xb975('0x7c')](_0xb975('0x7d')+_0x502907[_0xb975('0x7a')],_0x502907[_0xb975('0x1a')]);_0x5cc346({'code':0xc8,'message':_0x502907});});},'FaxAccounts':function(_0x4266e1){return new Promise(function(_0x585298,_0x1ca03d){var _0x1afd91=_[_0xb975('0x56')](_0x2007e4[_0xb975('0x7e')]);_0x585298({'count':_0x1afd91['length'],'rows':_0x1afd91});});},'SendFax':function(_0x1ac6ea){var _0x3b8d01=this;return new Promise(function(_0x47c86d,_0x5125b2){_0x599d95['send'](_0x1ac6ea)[_0xb975('0x19')](function(_0x21bbf4){_0x47c86d({'code':0xc8,'message':_0x21bbf4['message']});})['catch'](function(_0x3a922d){_0x5125b2(_0x3b8d01[_0xb975('0x1c')](0x1f4,_0x3a922d[_0xb975('0x1a')]));});});},'CheckAfterSend':function(_0x49821e){var _0x22c2f7=this;return new Promise(function(_0x10bcab,_0x365d8d){_0x599d95['checkAfterSend'](_0x49821e)['then'](function(_0x3b841d){_0x10bcab({'code':0xc8,'message':_0x3b841d[_0xb975('0x1a')]});})[_0xb975('0x1b')](function(_0x21963e){_0x365d8d(_0x22c2f7[_0xb975('0x1c')](0x1f4,_0x21963e['message']));});});}};var _0x5554d3=jayson[_0xb975('0x7f')](_0x5786ec)[_0xb975('0x80')]();_0x5554d3['on'](_0xb975('0x1c'),function(_0x11c453){return _0x3d84f1(_0x11c453);});_0x5554d3['listen'](0x232a,'127.0.0.1',function(){console['log'](_0xb975('0x81'),0x232a);return _0x1729fe(_0xb975('0x82')+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 cdaf03f..f5aa417 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 _0xa650=['../../../../config/logger','trigger','../../rpc/cmContact','socket.io-emitter','localhost','info','stringify','emit','exec','autoCreate','data2','calleridnum','isNil','routeId','firstName','calleridname','','destcalleridname','destcalleridnum','uniqueid','resolve','then','showContact','omit','xmd-contactid2','format','action','toLowerCase','merge','data1','user:%s','name','trigger:%s','catch','error','Error\x20creating\x20contact','bluebird','util'];(function(_0x34bf51,_0x3aae95){var _0x2326cb=function(_0x3d3d0f){while(--_0x3d3d0f){_0x34bf51['push'](_0x34bf51['shift']());}};_0x2326cb(++_0x3aae95);}(_0xa650,0x1c6));var _0x0a65=function(_0x49b020,_0x4b8d09){_0x49b020=_0x49b020-0x0;var _0x17f540=_0xa650[_0x49b020];return _0x17f540;};'use strict';var BPromise=require(_0x0a65('0x0'));var util=require(_0x0a65('0x1'));var _=require('lodash');var logger=require(_0x0a65('0x2'))(_0x0a65('0x3'));var cmContactRpc=require(_0x0a65('0x4'));var io=require(_0x0a65('0x5'))({'host':_0x0a65('0x6'),'port':0x18eb});function emit(_0x2a4891,_0x238287,_0x43c8c3){logger[_0x0a65('0x7')](_0x2a4891,_0x238287,JSON[_0x0a65('0x8')](_0x43c8c3));io['to'](_0x2a4891)[_0x0a65('0x9')](_0x238287,_0x43c8c3);}exports[_0x0a65('0xa')]=function(_0x3e8c33,_0x42d452,_0x1b47f4){_0x1b47f4[_0x0a65('0xb')]=0x0;if(_0x42d452['data2']&&parseInt(_0x42d452[_0x0a65('0xc')],0xa)){var _0x53abae={'ListId':parseInt(_0x42d452['data1'],0xa),'phone':_0x1b47f4[_0x0a65('0xd')]};if(_[_0x0a65('0xe')](_0x1b47f4[_0x0a65('0xf')])){_0x53abae[_0x0a65('0x10')]=_0x1b47f4['calleridname']&&_0x1b47f4[_0x0a65('0x11')]!==_0x0a65('0x12')?_0x1b47f4[_0x0a65('0x11')]:_0x1b47f4[_0x0a65('0xd')]||_0x1b47f4['uniqueid'];}else{_0x53abae[_0x0a65('0x10')]=_0x1b47f4['destcalleridname']&&_0x1b47f4['destcalleridname']!==_0x0a65('0x12')?_0x1b47f4[_0x0a65('0x13')]:_0x1b47f4[_0x0a65('0x14')]||_0x1b47f4[_0x0a65('0x15')];_0x53abae['phone']=_0x1b47f4[_0x0a65('0x13')]&&_0x1b47f4['destcalleridname']!==_0x0a65('0x12')?_0x1b47f4[_0x0a65('0x13')]:_0x1b47f4[_0x0a65('0x14')]||_0x1b47f4['uniqueid'];}BPromise[_0x0a65('0x16')]()[_0x0a65('0x17')](cmContactRpc[_0x0a65('0x18')]({'where':_[_0x0a65('0x19')](_0x53abae,[_0x0a65('0x10')])}))[_0x0a65('0x17')](function(_0x1ad4d8){if(_0x1ad4d8){_0x1b47f4[_0x0a65('0x1a')]=_0x1ad4d8['id'];emit(util['format']('user:%s',_0x3e8c33['name']),util[_0x0a65('0x1b')]('trigger:%s',_0x42d452[_0x0a65('0x1c')][_0x0a65('0x1d')]()),_[_0x0a65('0x1e')](_0x1b47f4,{'ListId':parseInt(_0x42d452[_0x0a65('0x1f')],0xa)}));return;}else{return BPromise['resolve']()['then'](cmContactRpc['createContact'](_0x53abae));}})[_0x0a65('0x17')](function(_0x300087){if(_0x300087){_0x1b47f4[_0x0a65('0x1a')]=_0x300087['id'];emit(util['format'](_0x0a65('0x20'),_0x3e8c33[_0x0a65('0x21')]),util[_0x0a65('0x1b')](_0x0a65('0x22'),_0x42d452['action'][_0x0a65('0x1d')]()),_[_0x0a65('0x1e')](_0x1b47f4,{'ListId':parseInt(_0x42d452[_0x0a65('0x1f')],0xa)}));}})[_0x0a65('0x23')](function(_0x33c468){logger[_0x0a65('0x24')](_0x0a65('0x25'),JSON['stringify'](_0x33c468));});}else{if(_0x3e8c33){emit(util[_0x0a65('0x1b')](_0x0a65('0x20'),_0x3e8c33[_0x0a65('0x21')]),util[_0x0a65('0x1b')](_0x0a65('0x22'),_0x42d452[_0x0a65('0x1c')]['toLowerCase']()),_['merge']({'ListId':parseInt(_0x42d452[_0x0a65('0x1f')],0xa)},_0x1b47f4));}}}; \ No newline at end of file +var _0xb0d8=['catch','toLowerCase','bluebird','util','lodash','../../rpc/cmContact','socket.io-emitter','info','stringify','emit','exec','data2','calleridnum','firstName','calleridname','uniqueid','destcalleridname','','destcalleridnum','phone','resolve','then','showContact','omit','xmd-contactid2','format','name','merge','data1','user:%s','trigger:%s','action'];(function(_0x345865,_0x1d878d){var _0x2e14f4=function(_0x52e646){while(--_0x52e646){_0x345865['push'](_0x345865['shift']());}};_0x2e14f4(++_0x1d878d);}(_0xb0d8,0x1c2));var _0x8b0d=function(_0x47a40b,_0x443ecf){_0x47a40b=_0x47a40b-0x0;var _0x19610c=_0xb0d8[_0x47a40b];return _0x19610c;};'use strict';var BPromise=require(_0x8b0d('0x0'));var util=require(_0x8b0d('0x1'));var _=require(_0x8b0d('0x2'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x8b0d('0x3'));var io=require(_0x8b0d('0x4'))({'host':'localhost','port':0x18eb});function emit(_0x478252,_0x3cf55a,_0x4091f9){logger[_0x8b0d('0x5')](_0x478252,_0x3cf55a,JSON[_0x8b0d('0x6')](_0x4091f9));io['to'](_0x478252)[_0x8b0d('0x7')](_0x3cf55a,_0x4091f9);}exports[_0x8b0d('0x8')]=function(_0x1ad198,_0x47f807,_0x1bbb37){_0x1bbb37['autoCreate']=0x0;if(_0x47f807['data2']&&parseInt(_0x47f807[_0x8b0d('0x9')],0xa)){var _0x3fc97a={'ListId':parseInt(_0x47f807['data1'],0xa),'phone':_0x1bbb37[_0x8b0d('0xa')]};if(_['isNil'](_0x1bbb37['routeId'])){_0x3fc97a[_0x8b0d('0xb')]=_0x1bbb37[_0x8b0d('0xc')]&&_0x1bbb37[_0x8b0d('0xc')]!==''?_0x1bbb37['calleridname']:_0x1bbb37[_0x8b0d('0xa')]||_0x1bbb37[_0x8b0d('0xd')];}else{_0x3fc97a[_0x8b0d('0xb')]=_0x1bbb37['destcalleridname']&&_0x1bbb37[_0x8b0d('0xe')]!==_0x8b0d('0xf')?_0x1bbb37[_0x8b0d('0xe')]:_0x1bbb37[_0x8b0d('0x10')]||_0x1bbb37[_0x8b0d('0xd')];_0x3fc97a[_0x8b0d('0x11')]=_0x1bbb37['destcalleridname']&&_0x1bbb37[_0x8b0d('0xe')]!==_0x8b0d('0xf')?_0x1bbb37[_0x8b0d('0xe')]:_0x1bbb37[_0x8b0d('0x10')]||_0x1bbb37['uniqueid'];}BPromise[_0x8b0d('0x12')]()[_0x8b0d('0x13')](cmContactRpc[_0x8b0d('0x14')]({'where':_[_0x8b0d('0x15')](_0x3fc97a,[_0x8b0d('0xb')])}))[_0x8b0d('0x13')](function(_0x1d6619){if(_0x1d6619){_0x1bbb37[_0x8b0d('0x16')]=_0x1d6619['id'];emit(util[_0x8b0d('0x17')]('user:%s',_0x1ad198[_0x8b0d('0x18')]),util['format']('trigger:%s',_0x47f807['action']['toLowerCase']()),_[_0x8b0d('0x19')](_0x1bbb37,{'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)}));return;}else{return BPromise[_0x8b0d('0x12')]()[_0x8b0d('0x13')](cmContactRpc['createContact'](_0x3fc97a));}})[_0x8b0d('0x13')](function(_0x563e39){if(_0x563e39){_0x1bbb37['xmd-contactid2']=_0x563e39['id'];emit(util[_0x8b0d('0x17')](_0x8b0d('0x1b'),_0x1ad198[_0x8b0d('0x18')]),util['format'](_0x8b0d('0x1c'),_0x47f807[_0x8b0d('0x1d')]['toLowerCase']()),_[_0x8b0d('0x19')](_0x1bbb37,{'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)}));}})[_0x8b0d('0x1e')](function(_0x1722a0){logger['error']('Error\x20creating\x20contact',JSON['stringify'](_0x1722a0));});}else{if(_0x1ad198){emit(util[_0x8b0d('0x17')](_0x8b0d('0x1b'),_0x1ad198[_0x8b0d('0x18')]),util[_0x8b0d('0x17')]('trigger:%s',_0x47f807[_0x8b0d('0x1d')][_0x8b0d('0x1f')]()),_[_0x8b0d('0x19')]({'ListId':parseInt(_0x47f807[_0x8b0d('0x1a')],0xa)},_0x1bbb37));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index ac5838d..2da747c 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 _0x6365=['every','checkConditions','channel','AnyConditions','some','field','account','chat','ChatWebsiteId','upperFirst','value','interaction','message','event','operator','lastevent','util','lodash','mustache','./urlforward','./integration','./cmContact','../../../config/logger','trigger','../ami','socket.io-emitter','localhost','integration','urlforward','popup','url','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','accounts','custom:agentconnect','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:queuecallerabandon','custom:dialbegin','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','emit','info','hasOwnProperty','checkTrigger','merge','variables','length','Actions','interface','action','toLowerCase','motionbar','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','uriLocation','windowWidth','data5','data6','600','winapp','winApplication','winArguments','format','name','jscripty','user:%s','trigger:%s','exec','queue','routeId','parse','query','search'];(function(_0x2dda31,_0x41f900){var _0x10735a=function(_0x147685){while(--_0x147685){_0x2dda31['push'](_0x2dda31['shift']());}};_0x10735a(++_0x41f900);}(_0x6365,0x76));var _0x5636=function(_0x9d2e65,_0x39a153){_0x9d2e65=_0x9d2e65-0x0;var _0x3a808d=_0x6365[_0x9d2e65];return _0x3a808d;};'use strict';var util=require(_0x5636('0x0'));var _=require(_0x5636('0x1'));var url=require('url');var Mustache=require(_0x5636('0x2'));var BPromise=require('bluebird');var urlforward=require(_0x5636('0x3'));var integration=require(_0x5636('0x4'));var cmContact=require(_0x5636('0x5'));var cmContactRpc=require('../rpc/cmContact');var logger=require(_0x5636('0x6'))(_0x5636('0x7'));var ami=require(_0x5636('0x8'));var io=require(_0x5636('0x9'))({'host':_0x5636('0xa'),'port':0x18eb});var operators={'equals':function(_0x168f8f,_0xa356f9){return _0x168f8f==_0xa356f9;},'not_equals':function(_0x4d9e1d,_0x352d30){return _0x4d9e1d!=_0x352d30;}};var serverActions=[_0x5636('0xb'),_0x5636('0xc')];var barAndWebActions=[_0x5636('0xd'),_0x5636('0xe'),'winapp'];function Trigger(_0x510d5a){this[_0x5636('0xf')]=_0x510d5a[_0x5636('0xf')];this['agents']=_0x510d5a[_0x5636('0x10')];this[_0x5636('0x11')]=_0x510d5a[_0x5636('0x11')];this[_0x5636('0x12')]=_0x510d5a[_0x5636('0x12')];this[_0x5636('0x13')]=_0x510d5a['voiceExtensions'];this[_0x5636('0x14')]=_0x510d5a[_0x5636('0x14')];this['freshdeskAccounts']=_0x510d5a[_0x5636('0x15')];this[_0x5636('0x16')]=_0x510d5a['salesforceAccounts'];this[_0x5636('0x17')]=_0x510d5a['sugarcrmAccounts'];this[_0x5636('0x18')]=_0x510d5a[_0x5636('0x18')];this[_0x5636('0x19')]=_0x510d5a[_0x5636('0x19')];this[_0x5636('0x1a')]=_0x510d5a[_0x5636('0x1a')];this[_0x5636('0x1b')]={'zendesk':this[_0x5636('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x5636('0x15')],'sugarcrm':this[_0x5636('0x17')],'zoho':this[_0x5636('0x18')],'desk':this[_0x5636('0x19')],'vtiger':this[_0x5636('0x1a')]};ami['on']('custom:agentcalled',this['syncCustomEvent']['bind'](this));ami['on'](_0x5636('0x1c'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x1f'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x20'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x21'),this['syncCustomEvent'][_0x5636('0x1e')](this));ami['on'](_0x5636('0x22'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x23'),this['syncCustomEvent'][_0x5636('0x1e')](this));ami['on'](_0x5636('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x5636('0x25'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x26'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x27'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x28'),this[_0x5636('0x1d')][_0x5636('0x1e')](this));ami['on'](_0x5636('0x29'),this[_0x5636('0x1d')]['bind'](this));ami['on']('custom:rejectmessage',this[_0x5636('0x1d')]['bind'](this));}Trigger[_0x5636('0x2a')][_0x5636('0x2b')]=function(_0x473b89,_0x2dbf49,_0x3af650){logger[_0x5636('0x2c')](_0x473b89,_0x2dbf49,JSON['stringify'](_0x3af650));io['to'](_0x473b89)['emit'](_0x2dbf49,_0x3af650);};Trigger[_0x5636('0x2a')][_0x5636('0x1d')]=function(_0x24772e){this['checkTriggers'](_0x24772e);};Trigger[_0x5636('0x2a')]['checkTriggers']=function(_0x4ef3d6){var _0x4a783a;for(var _0x376199 in this[_0x5636('0xf')]){if(this[_0x5636('0xf')][_0x5636('0x2d')](_0x376199)){if(this[_0x5636('0xf')][_0x376199]['status']){_0x4a783a=this[_0x5636('0x2e')](this[_0x5636('0xf')][_0x376199],_0x4ef3d6);if(_0x4a783a){_[_0x5636('0x2f')](_0x4ef3d6,_0x4ef3d6[_0x5636('0x30')]);for(var _0xd22f8b=0x0,_0x353309,_0x261853,_0x29bc60;_0xd22f8b0x0){_0x17b399=_[_0xa5f4('0x29')](_0x34ab1d,_0x4ae7ac);}return _0x17b399;}function getCustomFields(_0x169087,_0x1fe5bd){var _0x1da8a4=[];var _0x480fb8={'custom_fields':{}};if(_0x169087[_0xa5f4('0x28')]>0x0){_[_0xa5f4('0x2a')](_0x169087,function(_0x2dec17){if(_0x2dec17['type']==='string'&&_0x2dec17[_0xa5f4('0x2b')]&&!_0x2dec17[_0xa5f4('0x2c')]){_0x480fb8[_0x2dec17['nameField'][_0xa5f4('0x2d')]()]=_0x2dec17[_0xa5f4('0x2e')][_0xa5f4('0x20')]();}else if(_0x2dec17['type']===_0xa5f4('0x2f')&&_0x2dec17[_0xa5f4('0x30')]&&_0x2dec17[_0xa5f4('0x2c')]){_0x480fb8[_0xa5f4('0x31')][_0x2dec17[_0xa5f4('0x30')]]=_0x2dec17[_0xa5f4('0x2e')][_0xa5f4('0x20')]();}else if(_0x2dec17[_0xa5f4('0x32')]===_0xa5f4('0x33')&&_0x2dec17['variableName']&&_0x2dec17[_0xa5f4('0x30')]&&_0x2dec17[_0xa5f4('0x2c')]){_0x1fe5bd[_0x2dec17[_0xa5f4('0x34')]]&&(_0x480fb8[_0xa5f4('0x31')][_0x2dec17[_0xa5f4('0x30')]]=_0x1fe5bd[_0x2dec17[_0xa5f4('0x34')]]['toString']());}else if(_0x2dec17[_0xa5f4('0x32')]==='customVariable'&&_0x2dec17[_0xa5f4('0x35')]&&_0x2dec17[_0xa5f4('0x35')]['name']&&_0x2dec17[_0xa5f4('0x30')]&&_0x2dec17[_0xa5f4('0x2c')]){_0x1fe5bd[_0x2dec17[_0xa5f4('0x35')]['name'][_0xa5f4('0x2d')]()]&&(_0x480fb8[_0xa5f4('0x31')][_0x2dec17['idField']]=_0x1fe5bd[_0x2dec17[_0xa5f4('0x35')][_0xa5f4('0x36')]['toLowerCase']()]['toString']());}});}if(_0x480fb8['priority']){_0x480fb8[_0xa5f4('0x37')]=Number(_0x480fb8[_0xa5f4('0x37')]);}return _0x480fb8;}function getTicket(_0x197485,_0x3b8340,_0x197753,_0x413451,_0x2c07e8){logger['info']('Creating\x20new\x20ticket...');var _0x84429=_[_0xa5f4('0x38')]({'subject':intUtil[_0xa5f4('0x39')](_0x413451[_0xa5f4('0x3a')],_0x2c07e8,'\x20'),'type':'phone','status':_0xa5f4('0x3b'),'labels':['xCALLY',_0xa5f4('0x3c'),_0xa5f4('0x3d')]['concat'](getTags(_0x413451[_0xa5f4('0x3e')],_0xa5f4('0x36'))),'description':intUtil[_0xa5f4('0x39')](_0x413451['Descriptions'],_0x2c07e8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa5f4('0xa')]('/api/v2/users/%d',_0x3b8340['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0xa5f4('0x39')](_0x413451[_0xa5f4('0x3f')],_0x2c07e8,'\x0a')}},getCustomFields(_0x413451['Fields'],_0x2c07e8));return request({'uri':util[_0xa5f4('0xa')]('%s/customers/%d/cases',_0x197485['remoteUri'],_0x197753['id']),'method':_0xa5f4('0x26'),'body':_0x84429});}exports['queue']=function(_0x5b9e26,_0x2266ef,_0x29ed35,_0x5a00c9,_0xccb349,_0x4434d1){var _0x3e66c3,_0x23c879;_0x4434d1[_0xa5f4('0xb')]=intUtil['stripTrailingSlash'](_0x4434d1[_0xa5f4('0xb')]);_0x4434d1[_0xa5f4('0x40')]=intUtil[_0xa5f4('0x41')](_0x4434d1['serverUrl']);if(_0xccb349&&_0xccb349[_0xa5f4('0x42')]){logger['info'](_0xa5f4('0x43'),_0xa5f4('0x44'));_0x2266ef['recordingURL']=util['format'](_0xa5f4('0x45'),_0x4434d1['serverUrl'],_0x2266ef[_0xa5f4('0x46')],md5(_0x2266ef['uniqueid']));}else{_0x2266ef[_0xa5f4('0x47')]='';}headers[_0xa5f4('0x48')]=getAuth(_0x4434d1);return getUser(_0x4434d1,_0x5a00c9[_0xa5f4('0x49')])[_0xa5f4('0xc')](function(_0x5eb4a4){_0x3e66c3=_0x5eb4a4;logger[_0xa5f4('0x8')](_0xa5f4('0x4a'),_0x3e66c3['id']);return getEndUser(_0x4434d1,_0x2266ef[_0xa5f4('0x4b')],_0x2266ef[_0xa5f4('0x4c')]);})[_0xa5f4('0xc')](function(_0x474fbf){_0x23c879=_0x474fbf;logger['info'](_0xa5f4('0x4d'),_0x23c879['id']);return getTicket(_0x4434d1,_0x3e66c3,_0x23c879,_0x29ed35,_0x2266ef);})[_0xa5f4('0xc')](function(_0x32bb9d){if(_0x32bb9d){logger['info']('Ticket\x20created!');logger[_0xa5f4('0x8')](_0xa5f4('0x4e'),_0x32bb9d['id']);switch(_0x4434d1['type']){case _0xa5f4('0x4f'):logger[_0xa5f4('0x8')](_0xa5f4('0x43'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0xa5f4('0x50'),_0x5a00c9['name']),_0xa5f4('0x51'),{'recordId':_0x32bb9d['id']});break;case _0xa5f4('0x52'):logger[_0xa5f4('0x8')](_0xa5f4('0x43'),_0xa5f4('0x53'));emit(util[_0xa5f4('0xa')](_0xa5f4('0x50'),_0x5a00c9[_0xa5f4('0x36')]),'trigger:browser:url',{'uri':util['format'](_0xa5f4('0x54'),_0x32bb9d['id'])});break;default:logger[_0xa5f4('0x55')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0xa5f4('0x56')](function(_0x14f691){console['error'](_0x14f691);logger[_0xa5f4('0x55')](_0xa5f4('0x43'),JSON['stringify'](_0x14f691));});};exports[_0xa5f4('0x57')]=function(_0x19fa07,_0x2be6ae,_0x1db2cf,_0x47d91e,_0x230921,_0x52655a,_0x4b482d){var _0x277ae0,_0x5b6316;_0x52655a[_0xa5f4('0xb')]=intUtil['stripTrailingSlash'](_0x52655a[_0xa5f4('0xb')]);_0x52655a['serverUrl']=intUtil[_0xa5f4('0x41')](_0x52655a[_0xa5f4('0x40')]);if(_0x4b482d&&_0x4b482d[_0xa5f4('0x58')]&&_0x4b482d[_0xa5f4('0x58')]!==_0xa5f4('0x59')){logger[_0xa5f4('0x8')](_0xa5f4('0x5a'),_0xa5f4('0x44'));_0x2be6ae[_0xa5f4('0x47')]=util[_0xa5f4('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52655a['serverUrl'],_0x2be6ae[_0xa5f4('0x46')],md5(_0x2be6ae['uniqueid']));}headers[_0xa5f4('0x48')]=getAuth(_0x52655a);return getUser(_0x52655a,_0x47d91e[_0xa5f4('0x49')])[_0xa5f4('0xc')](function(_0x1316e0){_0x277ae0=_0x1316e0;logger['info']('The\x20User\x20ID\x20is:',_0x277ae0['id']);return getEndUser(_0x52655a,_0x2be6ae['destcalleridname'],_0x2be6ae[_0xa5f4('0x5b')]);})[_0xa5f4('0xc')](function(_0x34b322){_0x5b6316=_0x34b322;logger[_0xa5f4('0x8')](_0xa5f4('0x4d'),_0x5b6316['id']);return getTicket(_0x52655a,_0x277ae0,_0x5b6316,_0x1db2cf,_0x2be6ae);})[_0xa5f4('0xc')](function(_0x4de5fb){if(_0x4de5fb){logger[_0xa5f4('0x8')](_0xa5f4('0x5c'));logger[_0xa5f4('0x8')](_0xa5f4('0x4e'),_0x4de5fb['id']);switch(_0x52655a['type']){case _0xa5f4('0x4f'):logger[_0xa5f4('0x8')]('[QUEUE]',_0xa5f4('0x5d'));emit(util[_0xa5f4('0xa')](_0xa5f4('0x50'),_0x47d91e['name']),_0xa5f4('0x51'),{'recordId':_0x4de5fb['id']});break;case _0xa5f4('0x52'):logger[_0xa5f4('0x8')](_0xa5f4('0x43'),_0xa5f4('0x53'));emit(util[_0xa5f4('0xa')](_0xa5f4('0x50'),_0x47d91e['name']),_0xa5f4('0x5e'),{'uri':util[_0xa5f4('0xa')](_0xa5f4('0x5f'),_0x52655a['remoteUri'],_0x4de5fb['id'])});break;default:logger['error'](_0xa5f4('0x5a'),_0xa5f4('0x60'));}}})[_0xa5f4('0x56')](function(_0x3a0aec){logger[_0xa5f4('0x55')](_0xa5f4('0x5a'),JSON[_0xa5f4('0x16')](_0x3a0aec));});};exports[_0xa5f4('0x61')]=function(_0x3d439e,_0x304df0,_0x14720b,_0x2a34a8,_0x21de2d,_0x37d70a){var _0xc91e08,_0x3c30a1;_0x37d70a['remoteUri']=intUtil[_0xa5f4('0x41')](_0x37d70a[_0xa5f4('0xb')]);_0x37d70a[_0xa5f4('0x40')]=intUtil[_0xa5f4('0x41')](_0x37d70a['serverUrl']);if(_0x21de2d&&_0x21de2d[_0xa5f4('0x42')]){logger[_0xa5f4('0x8')](_0xa5f4('0x62'),'Recording\x20is\x20enabled!');_0x304df0[_0xa5f4('0x47')]=util[_0xa5f4('0xa')](_0xa5f4('0x45'),_0x37d70a[_0xa5f4('0x40')],_0x304df0[_0xa5f4('0x46')],md5(_0x304df0[_0xa5f4('0x46')]));}else{_0x304df0[_0xa5f4('0x47')]='';}headers['Authorization']=getAuth(_0x37d70a);return getUser(_0x37d70a)[_0xa5f4('0xc')](function(_0x3e9170){_0xc91e08=_0x3e9170;logger[_0xa5f4('0x8')](_0xa5f4('0x4a'),_0xc91e08['id']);return getEndUser(_0x37d70a,_0x304df0[_0xa5f4('0x4b')],_0x304df0[_0xa5f4('0x4c')]);})['then'](function(_0x55008e){_0x3c30a1=_0x55008e;logger[_0xa5f4('0x8')](_0xa5f4('0x4d'),_0x3c30a1['id']);return getTicket(_0x37d70a,_0xc91e08,_0x3c30a1,_0x14720b,_0x304df0);})[_0xa5f4('0xc')](function(_0x479c3c){if(_0x479c3c){logger['info'](_0xa5f4('0x5c'));logger[_0xa5f4('0x8')](_0xa5f4('0x4e'),_0x479c3c['id']);}})[_0xa5f4('0x56')](function(_0x196e83){logger['error'](_0xa5f4('0x62'),JSON[_0xa5f4('0x16')](_0x196e83));});}; \ No newline at end of file +var _0x5e56=['format','%s/users','total_entries','find','_embedded','then','info','Agent\x20found!','remoteUri','debug','[HTTP]','stringify','defaults','authType','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','length','type','string','customField','idField','custom_fields','content','variable','variableName','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','phone','Motion','Tags','/api/v2/users/%d','user','Descriptions','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','%s/agent/tickets/%s','[OUTBOUND]','abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','../../../../config/logger','desk','socket.io-emitter','localhost','application/json','Getting\x20agent\x20with\x20email'];(function(_0x164a97,_0x351c3b){var _0x50e151=function(_0x295a28){while(--_0x295a28){_0x164a97['push'](_0x164a97['shift']());}};_0x50e151(++_0x351c3b);}(_0x5e56,0xbd));var _0x65e5=function(_0x352abe,_0x44e21a){_0x352abe=_0x352abe-0x0;var _0x3808ca=_0x5e56[_0x352abe];return _0x3808ca;};'use strict';var _=require(_0x65e5('0x0'));var rp=require(_0x65e5('0x1'));var md5=require(_0x65e5('0x2'));var util=require(_0x65e5('0x3'));var intUtil=require(_0x65e5('0x4'));var logger=require(_0x65e5('0x5'))(_0x65e5('0x6'));var io=require(_0x65e5('0x7'))({'host':_0x65e5('0x8'),'port':0x18eb});function emit(_0x4bb0a7,_0x2fe3f0,_0x95a88a){io['to'](_0x4bb0a7)['emit'](_0x2fe3f0,_0x95a88a);}var headers={'Content-Type':_0x65e5('0x9'),'Accept':_0x65e5('0x9')};function getUser(_0x3d1c20,_0x27e4a4){logger['info'](_0x65e5('0xa'),_0x27e4a4);return request({'uri':util[_0x65e5('0xb')](_0x65e5('0xc'),_0x3d1c20['remoteUri'])})['then'](function(_0x4e9faa){if(_0x4e9faa[_0x65e5('0xd')]){return _[_0x65e5('0xe')](_0x4e9faa[_0x65e5('0xf')]['entries'],{'email':_0x27e4a4});}})[_0x65e5('0x10')](function(_0x380141){if(_0x380141){logger[_0x65e5('0x11')](_0x65e5('0x12'));return _0x380141;}else{logger[_0x65e5('0x11')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x65e5('0xb')]('%s/users/me',_0x3d1c20[_0x65e5('0x13')])});}});}function request(_0x1d5792){logger[_0x65e5('0x14')](_0x65e5('0x15'),JSON[_0x65e5('0x16')](_0x1d5792));return rp(_[_0x65e5('0x17')](_0x1d5792,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x54daf3){var _0x20c24e;if(_0x54daf3[_0x65e5('0x18')]==='basic'){_0x20c24e=util[_0x65e5('0xb')]('%s:%s',_0x54daf3[_0x65e5('0x19')],_0x54daf3[_0x65e5('0x1a')]);}else if(_0x54daf3['authType']===_0x65e5('0x1b')){_0x20c24e=util['format'](_0x65e5('0x1c'),_0x54daf3['username'],_0x54daf3['token']);}return util[_0x65e5('0xb')](_0x65e5('0x1d'),new Buffer(_0x20c24e)[_0x65e5('0x1e')](_0x65e5('0x1f')));}function getEndUser(_0x970403,_0x15fc5e,_0x4d7845){logger['info'](_0x65e5('0x20'),_0x4d7845);return request({'uri':util[_0x65e5('0xb')](_0x65e5('0x21'),_0x970403['remoteUri']),'qs':{'phone':_0x4d7845}})[_0x65e5('0x10')](function(_0x43818d){if(_0x43818d[_0x65e5('0xd')]){logger[_0x65e5('0x11')]('Enduser\x20found!');return _0x43818d[_0x65e5('0xf')][_0x65e5('0x22')][0x0];}else{logger[_0x65e5('0x11')](_0x65e5('0x23'));return request({'uri':util[_0x65e5('0xb')](_0x65e5('0x24'),_0x970403[_0x65e5('0x13')]),'method':_0x65e5('0x25'),'body':{'first_name':_0x15fc5e,'title':_0x15fc5e,'phone_numbers':[{'type':_0x65e5('0x26'),'value':_0x4d7845}]}});}});}function getTags(_0x1f6e8c,_0x25edea){var _0x54add4=[];if(_0x1f6e8c&&_0x1f6e8c['length']>0x0){_0x54add4=_[_0x65e5('0x27')](_0x1f6e8c,_0x25edea);}return _0x54add4;}function getCustomFields(_0x4d1ef0,_0x43b28a){var _0x1add89=[];var _0x2a951c={'custom_fields':{}};if(_0x4d1ef0[_0x65e5('0x28')]>0x0){_['forEach'](_0x4d1ef0,function(_0x50bf62){if(_0x50bf62[_0x65e5('0x29')]===_0x65e5('0x2a')&&_0x50bf62['nameField']&&!_0x50bf62[_0x65e5('0x2b')]){_0x2a951c[_0x50bf62['nameField']['toLowerCase']()]=_0x50bf62['content'][_0x65e5('0x1e')]();}else if(_0x50bf62[_0x65e5('0x29')]===_0x65e5('0x2a')&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62['customField']){_0x2a951c[_0x65e5('0x2d')][_0x50bf62[_0x65e5('0x2c')]]=_0x50bf62[_0x65e5('0x2e')][_0x65e5('0x1e')]();}else if(_0x50bf62['type']===_0x65e5('0x2f')&&_0x50bf62['variableName']&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62[_0x65e5('0x2b')]){_0x43b28a[_0x50bf62['variableName']]&&(_0x2a951c[_0x65e5('0x2d')][_0x50bf62['idField']]=_0x43b28a[_0x50bf62[_0x65e5('0x30')]][_0x65e5('0x1e')]());}else if(_0x50bf62[_0x65e5('0x29')]==='customVariable'&&_0x50bf62['Variable']&&_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')]&&_0x50bf62[_0x65e5('0x2c')]&&_0x50bf62[_0x65e5('0x2b')]){_0x43b28a[_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')][_0x65e5('0x33')]()]&&(_0x2a951c[_0x65e5('0x2d')][_0x50bf62['idField']]=_0x43b28a[_0x50bf62[_0x65e5('0x31')][_0x65e5('0x32')][_0x65e5('0x33')]()][_0x65e5('0x1e')]());}});}if(_0x2a951c[_0x65e5('0x34')]){_0x2a951c[_0x65e5('0x34')]=Number(_0x2a951c[_0x65e5('0x34')]);}return _0x2a951c;}function getTicket(_0x87ce14,_0x12d20f,_0x55c5d2,_0x59dd21,_0x1c0ac6){logger[_0x65e5('0x11')](_0x65e5('0x35'));var _0x557b95=_[_0x65e5('0x36')]({'subject':intUtil[_0x65e5('0x37')](_0x59dd21['Subjects'],_0x1c0ac6,'\x20'),'type':_0x65e5('0x38'),'status':'new','labels':['xCALLY',_0x65e5('0x39'),'CTI']['concat'](getTags(_0x59dd21[_0x65e5('0x3a')],_0x65e5('0x32'))),'description':intUtil['getString'](_0x59dd21['Descriptions'],_0x1c0ac6,'\x0a'),'_links':{'assigned_user':{'href':util[_0x65e5('0xb')](_0x65e5('0x3b'),_0x12d20f['id']),'class':_0x65e5('0x3c')}},'message':{'direction':'in','body':intUtil[_0x65e5('0x37')](_0x59dd21[_0x65e5('0x3d')],_0x1c0ac6,'\x0a')}},getCustomFields(_0x59dd21[_0x65e5('0x3e')],_0x1c0ac6));return request({'uri':util['format'](_0x65e5('0x3f'),_0x87ce14[_0x65e5('0x13')],_0x55c5d2['id']),'method':_0x65e5('0x25'),'body':_0x557b95});}exports['queue']=function(_0xf38010,_0xa10921,_0x2b8cb4,_0x1cbafd,_0x304805,_0x41e245){var _0x377259,_0x114290;_0x41e245[_0x65e5('0x13')]=intUtil[_0x65e5('0x40')](_0x41e245[_0x65e5('0x13')]);_0x41e245[_0x65e5('0x41')]=intUtil['stripTrailingSlash'](_0x41e245['serverUrl']);if(_0x304805&&_0x304805[_0x65e5('0x42')]){logger['info'](_0x65e5('0x43'),'Recording\x20is\x20enabled!');_0xa10921[_0x65e5('0x44')]=util[_0x65e5('0xb')](_0x65e5('0x45'),_0x41e245[_0x65e5('0x41')],_0xa10921[_0x65e5('0x46')],md5(_0xa10921['uniqueid']));}else{_0xa10921['recordingURL']='';}headers[_0x65e5('0x47')]=getAuth(_0x41e245);return getUser(_0x41e245,_0x1cbafd[_0x65e5('0x48')])[_0x65e5('0x10')](function(_0x3260c7){_0x377259=_0x3260c7;logger[_0x65e5('0x11')](_0x65e5('0x49'),_0x377259['id']);return getEndUser(_0x41e245,_0xa10921[_0x65e5('0x4a')],_0xa10921[_0x65e5('0x4b')]);})[_0x65e5('0x10')](function(_0x52f5c3){_0x114290=_0x52f5c3;logger[_0x65e5('0x11')](_0x65e5('0x4c'),_0x114290['id']);return getTicket(_0x41e245,_0x377259,_0x114290,_0x2b8cb4,_0xa10921);})['then'](function(_0x18003d){if(_0x18003d){logger[_0x65e5('0x11')](_0x65e5('0x4d'));logger[_0x65e5('0x11')](_0x65e5('0x4e'),_0x18003d['id']);switch(_0x41e245[_0x65e5('0x29')]){case _0x65e5('0x4f'):logger['info']('[QUEUE]',_0x65e5('0x50'));emit(util[_0x65e5('0xb')]('user:%s',_0x1cbafd['name']),_0x65e5('0x51'),{'recordId':_0x18003d['id']});break;case _0x65e5('0x52'):logger[_0x65e5('0x11')](_0x65e5('0x43'),_0x65e5('0x53'));emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x1cbafd['name']),_0x65e5('0x55'),{'uri':util[_0x65e5('0xb')](_0x65e5('0x56'),_0x18003d['id'])});break;default:logger[_0x65e5('0x57')](_0x65e5('0x43'),_0x65e5('0x58'));}}})[_0x65e5('0x59')](function(_0x4c0c2d){console[_0x65e5('0x57')](_0x4c0c2d);logger[_0x65e5('0x57')]('[QUEUE]',JSON[_0x65e5('0x16')](_0x4c0c2d));});};exports[_0x65e5('0x5a')]=function(_0x5d06db,_0x3b4f4b,_0x359999,_0x978a0c,_0x1d4633,_0x5707b0,_0x2388f6){var _0x503086,_0x10a0bb;_0x5707b0['remoteUri']=intUtil[_0x65e5('0x40')](_0x5707b0[_0x65e5('0x13')]);_0x5707b0[_0x65e5('0x41')]=intUtil[_0x65e5('0x40')](_0x5707b0[_0x65e5('0x41')]);if(_0x2388f6&&_0x2388f6['recordingFormat']&&_0x2388f6[_0x65e5('0x5b')]!==_0x65e5('0x5c')){logger[_0x65e5('0x11')]('[OUTBOUND]',_0x65e5('0x5d'));_0x3b4f4b['recordingURL']=util[_0x65e5('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5707b0[_0x65e5('0x41')],_0x3b4f4b[_0x65e5('0x46')],md5(_0x3b4f4b[_0x65e5('0x46')]));}headers[_0x65e5('0x47')]=getAuth(_0x5707b0);return getUser(_0x5707b0,_0x978a0c[_0x65e5('0x48')])[_0x65e5('0x10')](function(_0x1aa450){_0x503086=_0x1aa450;logger[_0x65e5('0x11')](_0x65e5('0x49'),_0x503086['id']);return getEndUser(_0x5707b0,_0x3b4f4b[_0x65e5('0x5e')],_0x3b4f4b[_0x65e5('0x5f')]);})[_0x65e5('0x10')](function(_0x4ce60c){_0x10a0bb=_0x4ce60c;logger[_0x65e5('0x11')]('The\x20Enduser\x20ID\x20is:',_0x10a0bb['id']);return getTicket(_0x5707b0,_0x503086,_0x10a0bb,_0x359999,_0x3b4f4b);})[_0x65e5('0x10')](function(_0x276a10){if(_0x276a10){logger['info'](_0x65e5('0x4d'));logger[_0x65e5('0x11')]('The\x20Ticket\x20ID\x20is:',_0x276a10['id']);switch(_0x5707b0[_0x65e5('0x29')]){case _0x65e5('0x4f'):logger[_0x65e5('0x11')](_0x65e5('0x43'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x978a0c[_0x65e5('0x32')]),_0x65e5('0x51'),{'recordId':_0x276a10['id']});break;case _0x65e5('0x52'):logger[_0x65e5('0x11')](_0x65e5('0x43'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x65e5('0xb')](_0x65e5('0x54'),_0x978a0c[_0x65e5('0x32')]),_0x65e5('0x55'),{'uri':util[_0x65e5('0xb')](_0x65e5('0x60'),_0x5707b0['remoteUri'],_0x276a10['id'])});break;default:logger['error'](_0x65e5('0x61'),_0x65e5('0x58'));}}})[_0x65e5('0x59')](function(_0x4e24d7){logger[_0x65e5('0x57')](_0x65e5('0x61'),JSON[_0x65e5('0x16')](_0x4e24d7));});};exports[_0x65e5('0x62')]=function(_0xa1d92e,_0x16a320,_0xb106fa,_0x2f2110,_0x5b52b0,_0x4af216){var _0x1b0dac,_0x188283;_0x4af216['remoteUri']=intUtil['stripTrailingSlash'](_0x4af216['remoteUri']);_0x4af216[_0x65e5('0x41')]=intUtil['stripTrailingSlash'](_0x4af216['serverUrl']);if(_0x5b52b0&&_0x5b52b0[_0x65e5('0x42')]){logger[_0x65e5('0x11')](_0x65e5('0x63'),_0x65e5('0x5d'));_0x16a320[_0x65e5('0x44')]=util[_0x65e5('0xb')](_0x65e5('0x45'),_0x4af216[_0x65e5('0x41')],_0x16a320[_0x65e5('0x46')],md5(_0x16a320[_0x65e5('0x46')]));}else{_0x16a320[_0x65e5('0x44')]='';}headers[_0x65e5('0x47')]=getAuth(_0x4af216);return getUser(_0x4af216)[_0x65e5('0x10')](function(_0x3d1eb8){_0x1b0dac=_0x3d1eb8;logger['info']('The\x20User\x20ID\x20is:',_0x1b0dac['id']);return getEndUser(_0x4af216,_0x16a320[_0x65e5('0x4a')],_0x16a320[_0x65e5('0x4b')]);})['then'](function(_0x4303ea){_0x188283=_0x4303ea;logger[_0x65e5('0x11')](_0x65e5('0x4c'),_0x188283['id']);return getTicket(_0x4af216,_0x1b0dac,_0x188283,_0xb106fa,_0x16a320);})[_0x65e5('0x10')](function(_0x386b1e){if(_0x386b1e){logger[_0x65e5('0x11')](_0x65e5('0x4d'));logger[_0x65e5('0x11')](_0x65e5('0x4e'),_0x386b1e['id']);}})[_0x65e5('0x59')](function(_0x1ac66b){logger['error'](_0x65e5('0x63'),JSON['stringify'](_0x1ac66b));});}; \ 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 5820d82..0cb3f28 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 _0x0713=['error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','abandoned','[ABANDONED]','md5','util','./util','../../../../config/logger','freshdesk','localhost','application/json','emit','info','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','debug','[HTTP]','stringify','defaults','GET','forEach','type','nameField','customField','toLowerCase','content','string','idField','variable','variableName','push','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','%s/helpdesk/tickets/%d','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x3071('0x0'));var util=require(_0x3071('0x1'));var intUtil=require(_0x3071('0x2'));var logger=require(_0x3071('0x3'))(_0x3071('0x4'));var io=require('socket.io-emitter')({'host':_0x3071('0x5'),'port':0x18eb});var headers={'Content-Type':_0x3071('0x6'),'Accept':_0x3071('0x6')};function emit(_0x3137c8,_0xabd7b6,_0x41cf76){io['to'](_0x3137c8)[_0x3071('0x7')](_0xabd7b6,_0x41cf76);}function getTicket(_0x2f1e87,_0xbd737f,_0x22274c,_0x3e9a5e,_0x2fce7a){logger[_0x3071('0x8')]('Creating\x20new\x20ticket...');var _0x3457cd=_[_0x3071('0x9')]({'responder_id':_0xbd737f['id'],'requester_id':_0x22274c['id'],'name':util[_0x3071('0xa')](_0x3071('0xb'),_0x2fce7a[_0x3071('0xc')]),'phone':_0x2fce7a['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x3071('0xd')](_0x3e9a5e[_0x3071('0xe')],_0x2fce7a,'\x20'),'description':intUtil[_0x3071('0xd')](_0x3e9a5e[_0x3071('0xf')],_0x2fce7a,_0x3071('0x10')),'tags':getTags(_0x3e9a5e['Tags'],'name')},getCustomFields(_0x3e9a5e[_0x3071('0x11')],_0x2fce7a));_0x3457cd['custom_fields']=_[_0x3071('0x12')](_[_0x3071('0x13')](_0x3457cd['custom_fields'],'id'),_0x3071('0x14'));return request({'uri':util['format'](_0x3071('0x15'),_0x2f1e87[_0x3071('0x16')]),'method':_0x3071('0x17'),'body':_0x3457cd})[_0x3071('0x18')](function(_0x1caa5d){logger[_0x3071('0x8')](_0x3071('0x19'));return _0x1caa5d;});}function getUser(_0x11bdc9,_0x21aad3){logger[_0x3071('0x8')]('Getting\x20agent\x20with\x20email',_0x21aad3);return request({'uri':util[_0x3071('0xa')](_0x3071('0x1a'),_0x11bdc9[_0x3071('0x16')]),'qs':{'email':_0x21aad3}})[_0x3071('0x18')](function(_0x3acf0e){if(_0x3acf0e[_0x3071('0x1b')]){logger[_0x3071('0x8')](_0x3071('0x1c'));return _['find'](_0x3acf0e,function(_0x359e66){return _0x359e66[_0x3071('0x1d')][_0x3071('0x1e')]===_0x21aad3;});}else{logger['info'](_0x3071('0x1f'));return request({'uri':util['format'](_0x3071('0x20'),_0x11bdc9[_0x3071('0x16')])})[_0x3071('0x18')](function(_0x457b57){logger[_0x3071('0x8')](_0x3071('0x21'));return _0x457b57;});}});}function getEndUser(_0x3c5cef,_0x211b4f,_0x542646){logger['info'](_0x3071('0x22'),_0x542646);return request({'uri':util[_0x3071('0xa')](_0x3071('0x23'),_0x3c5cef[_0x3071('0x16')]),'qs':{'phone':_0x542646}})[_0x3071('0x18')](function(_0x44b45f){if(_0x44b45f[_0x3071('0x1b')]){logger[_0x3071('0x8')](_0x3071('0x24'));return _['find'](_0x44b45f,{'phone':_0x542646});}else{logger[_0x3071('0x8')](_0x3071('0x25'));return request({'uri':util[_0x3071('0xa')]('%s/api/v2/contacts',_0x3c5cef[_0x3071('0x16')]),'method':_0x3071('0x17'),'body':{'name':_0x211b4f,'phone':_0x542646}})[_0x3071('0x18')](function(_0x950fde){logger[_0x3071('0x8')](_0x3071('0x26'));return _0x950fde;});}});}function getAuth(_0x177b5f){return util[_0x3071('0xa')](_0x3071('0x27'),new Buffer(_0x177b5f[_0x3071('0x28')]+':X')[_0x3071('0x29')]('base64'));}function request(_0x4f1484){logger[_0x3071('0x2a')](_0x3071('0x2b'),JSON[_0x3071('0x2c')](_0x4f1484));return rp(_[_0x3071('0x2d')](_0x4f1484,{'method':_0x3071('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0x29538c,_0x32b6b1){var _0x1ccc41=[];if(_0x29538c&&_0x29538c['length']>0x0){_0x1ccc41=_['map'](_0x29538c,_0x32b6b1);}return _0x1ccc41;}function getCustomFields(_0x4ab983,_0x1b0aaf){var _0x392800=[];var _0x5b5bf1={'custom_fields':[]};if(_0x4ab983[_0x3071('0x1b')]>0x0){_[_0x3071('0x2f')](_0x4ab983,function(_0x25250e){if(_0x25250e[_0x3071('0x30')]==='string'&&_0x25250e[_0x3071('0x31')]&&!_0x25250e[_0x3071('0x32')]){_0x5b5bf1[_0x25250e[_0x3071('0x31')][_0x3071('0x33')]()]=_0x25250e[_0x3071('0x34')][_0x3071('0x29')]();}else if(_0x25250e[_0x3071('0x30')]===_0x3071('0x35')&&_0x25250e['idField']&&_0x25250e[_0x3071('0x32')]){_0x5b5bf1['custom_fields']['push']({'id':_0x25250e[_0x3071('0x36')],'value':_0x25250e[_0x3071('0x34')]['toString']()});}else if(_0x25250e[_0x3071('0x30')]===_0x3071('0x37')&&_0x25250e[_0x3071('0x38')]&&_0x25250e[_0x3071('0x36')]&&_0x25250e[_0x3071('0x32')]){_0x1b0aaf[_0x25250e[_0x3071('0x38')]]&&_0x5b5bf1['custom_fields'][_0x3071('0x39')]({'id':_0x25250e[_0x3071('0x36')],'value':_0x1b0aaf[_0x25250e['variableName']][_0x3071('0x29')]()});}else if(_0x25250e['type']===_0x3071('0x3a')&&_0x25250e[_0x3071('0x3b')]&&_0x25250e['Variable']['name']&&_0x25250e[_0x3071('0x36')]&&_0x25250e[_0x3071('0x32')]){_0x1b0aaf[_0x25250e[_0x3071('0x3b')]['name'][_0x3071('0x33')]()]&&_0x5b5bf1['custom_fields'][_0x3071('0x39')]({'id':_0x25250e['idField'],'value':_0x1b0aaf[_0x25250e[_0x3071('0x3b')][_0x3071('0x3c')][_0x3071('0x33')]()][_0x3071('0x29')]()});}});}return _0x5b5bf1;}exports[_0x3071('0x3d')]=function(_0x593c9c,_0x53ed25,_0x4337eb,_0x17f9e6,_0x1455be,_0x1f69a6){var _0x525389,_0x3cfc05;_0x1f69a6[_0x3071('0x16')]=intUtil[_0x3071('0x3e')](_0x1f69a6[_0x3071('0x16')]);_0x1f69a6[_0x3071('0x3f')]=intUtil[_0x3071('0x3e')](_0x1f69a6['serverUrl']);if(_0x1455be&&_0x1455be[_0x3071('0x40')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x53ed25['recordingURL']=util[_0x3071('0xa')](_0x3071('0x41'),_0x1f69a6[_0x3071('0x3f')],_0x53ed25[_0x3071('0x42')],md5(_0x53ed25[_0x3071('0x42')]));}else{_0x53ed25[_0x3071('0x43')]='';}headers[_0x3071('0x44')]=getAuth(_0x1f69a6);return getUser(_0x1f69a6,_0x17f9e6[_0x3071('0x1e')])['then'](function(_0x1e8222){_0x525389=_0x1e8222;logger[_0x3071('0x8')](_0x3071('0x45'),_0x525389['id']);return getEndUser(_0x1f69a6,_0x53ed25[_0x3071('0xc')],_0x53ed25[_0x3071('0x46')]);})['then'](function(_0x5c93c7){_0x3cfc05=_0x5c93c7;logger[_0x3071('0x8')](_0x3071('0x47'),_0x3cfc05['id']);return getTicket(_0x1f69a6,_0x525389,_0x3cfc05,_0x4337eb,_0x53ed25);})[_0x3071('0x18')](function(_0x5c5865){if(_0x5c5865&&_0x5c5865['id']){logger[_0x3071('0x8')]('Ticket\x20created!');logger[_0x3071('0x8')]('The\x20Ticket\x20ID\x20is:',_0x5c5865['id']);logger[_0x3071('0x8')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3071('0xa')]('user:%s',_0x17f9e6[_0x3071('0x3c')]),'trigger:browser:url',{'uri':util[_0x3071('0xa')](_0x3071('0x48'),_0x1f69a6[_0x3071('0x16')],_0x5c5865['id'])});}})[_0x3071('0x49')](function(_0x554047){logger[_0x3071('0x4a')]('[QUEUE]',JSON[_0x3071('0x2c')](_0x554047));});};exports['outbound']=function(_0x46924d,_0x2060e9,_0x4d395a,_0x131ae6,_0x117e73,_0x224a70,_0x38bcc2){var _0x349adb,_0x2622b4;_0x224a70[_0x3071('0x16')]=intUtil['stripTrailingSlash'](_0x224a70[_0x3071('0x16')]);_0x224a70[_0x3071('0x3f')]=intUtil[_0x3071('0x3e')](_0x224a70[_0x3071('0x3f')]);if(_0x38bcc2&&_0x38bcc2['recordingFormat']&&_0x38bcc2[_0x3071('0x4b')]!==_0x3071('0x4c')){logger[_0x3071('0x8')](_0x3071('0x4d'),_0x3071('0x4e'));_0x2060e9[_0x3071('0x43')]=util[_0x3071('0xa')](_0x3071('0x41'),_0x224a70[_0x3071('0x3f')],_0x2060e9[_0x3071('0x42')],md5(_0x2060e9[_0x3071('0x42')]));}headers[_0x3071('0x44')]=getAuth(_0x224a70);return getUser(_0x224a70,_0x131ae6[_0x3071('0x1e')])[_0x3071('0x18')](function(_0x1656de){_0x349adb=_0x1656de;logger[_0x3071('0x8')]('The\x20User\x20ID\x20is:',_0x349adb['id']);return getEndUser(_0x224a70,_0x2060e9['destcalleridname'],_0x2060e9[_0x3071('0x4f')]);})['then'](function(_0x403761){_0x2622b4=_0x403761;logger[_0x3071('0x8')](_0x3071('0x47'),_0x2622b4['id']);return getTicket(_0x224a70,_0x349adb,_0x2622b4,_0x4d395a,_0x2060e9);})['then'](function(_0x1ec428){if(_0x1ec428&&_0x1ec428['id']){logger[_0x3071('0x8')]('Ticket\x20created!');logger['info'](_0x3071('0x50'),_0x1ec428['id']);logger[_0x3071('0x8')](_0x3071('0x4d'),_0x3071('0x51'));emit(util['format'](_0x3071('0x52'),_0x131ae6[_0x3071('0x3c')]),_0x3071('0x53'),{'uri':util[_0x3071('0xa')](_0x3071('0x48'),_0x224a70['remoteUri'],_0x1ec428['id'])});}})[_0x3071('0x49')](function(_0x67e36e){logger[_0x3071('0x4a')](_0x3071('0x4d'),JSON[_0x3071('0x2c')](_0x67e36e));});};exports[_0x3071('0x54')]=function(_0x71d921,_0x4bea5d,_0x4d6ed0,_0x18cad9,_0x4de4f3,_0xe96994){var _0x26ba8a,_0x499b6a;_0xe96994[_0x3071('0x16')]=intUtil[_0x3071('0x3e')](_0xe96994['remoteUri']);_0xe96994[_0x3071('0x3f')]=intUtil[_0x3071('0x3e')](_0xe96994[_0x3071('0x3f')]);if(_0x4de4f3&&_0x4de4f3[_0x3071('0x40')]){logger[_0x3071('0x8')]('[ABANDONED]',_0x3071('0x4e'));_0x4bea5d[_0x3071('0x43')]=util[_0x3071('0xa')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xe96994[_0x3071('0x3f')],_0x4bea5d[_0x3071('0x42')],md5(_0x4bea5d[_0x3071('0x42')]));}else{_0x4bea5d[_0x3071('0x43')]='';}headers[_0x3071('0x44')]=getAuth(_0xe96994);return getUser(_0xe96994,_0x18cad9[_0x3071('0x1e')])[_0x3071('0x18')](function(_0x2e39ff){_0x26ba8a=_0x2e39ff;logger[_0x3071('0x8')]('The\x20User\x20ID\x20is:',_0x26ba8a['id']);return getEndUser(_0xe96994,_0x4bea5d[_0x3071('0xc')],_0x4bea5d[_0x3071('0x46')]);})[_0x3071('0x18')](function(_0x26ecb2){_0x499b6a=_0x26ecb2;logger[_0x3071('0x8')](_0x3071('0x47'),_0x499b6a['id']);return getTicket(_0xe96994,_0x26ba8a,_0x499b6a,_0x4d6ed0,_0x4bea5d);})[_0x3071('0x18')](function(_0x287974){if(_0x287974){logger[_0x3071('0x8')](_0x3071('0x19'));logger[_0x3071('0x8')]('The\x20Ticket\x20ID\x20is:',_0x287974['id']);}})[_0x3071('0x49')](function(_0x315044){logger[_0x3071('0x4a')](_0x3071('0x55'),JSON[_0x3071('0x2c')](_0x315044));});}; \ No newline at end of file +var _0xf3cd=['Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','debug','defaults','GET','map','forEach','type','string','customField','nameField','toLowerCase','content','idField','variable','variableName','push','customVariable','Variable','queue','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','stringify','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','[ABANDONED]','error','lodash','request-promise','md5','util','./util','../../../../config/logger','socket.io-emitter','localhost','application/json','emit'];(function(_0x232b67,_0x3dc89e){var _0x39fcc0=function(_0x3e20c6){while(--_0x3e20c6){_0x232b67['push'](_0x232b67['shift']());}};_0x39fcc0(++_0x3dc89e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0xf3cd[_0x45161c];return _0x186581;};'use strict';var _=require(_0xdf3c('0x0'));var rp=require(_0xdf3c('0x1'));var md5=require(_0xdf3c('0x2'));var util=require(_0xdf3c('0x3'));var intUtil=require(_0xdf3c('0x4'));var logger=require(_0xdf3c('0x5'))('freshdesk');var io=require(_0xdf3c('0x6'))({'host':_0xdf3c('0x7'),'port':0x18eb});var headers={'Content-Type':_0xdf3c('0x8'),'Accept':'application/json'};function emit(_0x111a2e,_0x17d42a,_0x1313d5){io['to'](_0x111a2e)[_0xdf3c('0x9')](_0x17d42a,_0x1313d5);}function getTicket(_0x106021,_0x28edae,_0x52c073,_0x15705d,_0x52cf30){logger['info'](_0xdf3c('0xa'));var _0x981616=_['merge']({'responder_id':_0x28edae['id'],'requester_id':_0x52c073['id'],'name':util[_0xdf3c('0xb')](_0xdf3c('0xc'),_0x52cf30[_0xdf3c('0xd')]),'phone':_0x52cf30[_0xdf3c('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xdf3c('0xf')](_0x15705d[_0xdf3c('0x10')],_0x52cf30,'\x20'),'description':intUtil[_0xdf3c('0xf')](_0x15705d[_0xdf3c('0x11')],_0x52cf30,'
'),'tags':getTags(_0x15705d[_0xdf3c('0x12')],_0xdf3c('0x13'))},getCustomFields(_0x15705d[_0xdf3c('0x14')],_0x52cf30));_0x981616[_0xdf3c('0x15')]=_['mapValues'](_[_0xdf3c('0x16')](_0x981616[_0xdf3c('0x15')],'id'),_0xdf3c('0x17'));return request({'uri':util['format'](_0xdf3c('0x18'),_0x106021[_0xdf3c('0x19')]),'method':_0xdf3c('0x1a'),'body':_0x981616})[_0xdf3c('0x1b')](function(_0x21e587){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));return _0x21e587;});}function getUser(_0x92008b,_0x2986d0){logger[_0xdf3c('0x1c')]('Getting\x20agent\x20with\x20email',_0x2986d0);return request({'uri':util[_0xdf3c('0xb')](_0xdf3c('0x1e'),_0x92008b[_0xdf3c('0x19')]),'qs':{'email':_0x2986d0}})[_0xdf3c('0x1b')](function(_0x1e2690){if(_0x1e2690[_0xdf3c('0x1f')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x20'));return _[_0xdf3c('0x21')](_0x1e2690,function(_0x18fb5f){return _0x18fb5f[_0xdf3c('0x22')][_0xdf3c('0x23')]===_0x2986d0;});}else{logger[_0xdf3c('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xdf3c('0x24'),_0x92008b['remoteUri'])})[_0xdf3c('0x1b')](function(_0x40e7ec){logger[_0xdf3c('0x1c')](_0xdf3c('0x25'));return _0x40e7ec;});}});}function getEndUser(_0x33652f,_0x36ba1c,_0x50d8ca){logger[_0xdf3c('0x1c')](_0xdf3c('0x26'),_0x50d8ca);return request({'uri':util[_0xdf3c('0xb')](_0xdf3c('0x27'),_0x33652f[_0xdf3c('0x19')]),'qs':{'phone':_0x50d8ca}})[_0xdf3c('0x1b')](function(_0xef54cb){if(_0xef54cb[_0xdf3c('0x1f')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x28'));return _['find'](_0xef54cb,{'phone':_0x50d8ca});}else{logger[_0xdf3c('0x1c')](_0xdf3c('0x29'));return request({'uri':util['format'](_0xdf3c('0x27'),_0x33652f['remoteUri']),'method':'POST','body':{'name':_0x36ba1c,'phone':_0x50d8ca}})['then'](function(_0x14aac9){logger[_0xdf3c('0x1c')]('Enduser\x20created.');return _0x14aac9;});}});}function getAuth(_0x5c3b5a){return util[_0xdf3c('0xb')](_0xdf3c('0x2a'),new Buffer(_0x5c3b5a[_0xdf3c('0x2b')]+':X')[_0xdf3c('0x2c')]('base64'));}function request(_0x43ce06){logger[_0xdf3c('0x2d')]('[HTTP]',JSON['stringify'](_0x43ce06));return rp(_[_0xdf3c('0x2e')](_0x43ce06,{'method':_0xdf3c('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x36937e,_0x540f3a){var _0x2355f6=[];if(_0x36937e&&_0x36937e[_0xdf3c('0x1f')]>0x0){_0x2355f6=_[_0xdf3c('0x30')](_0x36937e,_0x540f3a);}return _0x2355f6;}function getCustomFields(_0x10099e,_0x575ae1){var _0xda0de0=[];var _0x46b445={'custom_fields':[]};if(_0x10099e['length']>0x0){_[_0xdf3c('0x31')](_0x10099e,function(_0x3daeda){if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x33')&&_0x3daeda['nameField']&&!_0x3daeda[_0xdf3c('0x34')]){_0x46b445[_0x3daeda[_0xdf3c('0x35')][_0xdf3c('0x36')]()]=_0x3daeda[_0xdf3c('0x37')]['toString']();}else if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x33')&&_0x3daeda['idField']&&_0x3daeda['customField']){_0x46b445[_0xdf3c('0x15')]['push']({'id':_0x3daeda[_0xdf3c('0x38')],'value':_0x3daeda['content']['toString']()});}else if(_0x3daeda['type']===_0xdf3c('0x39')&&_0x3daeda[_0xdf3c('0x3a')]&&_0x3daeda[_0xdf3c('0x38')]&&_0x3daeda[_0xdf3c('0x34')]){_0x575ae1[_0x3daeda['variableName']]&&_0x46b445['custom_fields'][_0xdf3c('0x3b')]({'id':_0x3daeda['idField'],'value':_0x575ae1[_0x3daeda[_0xdf3c('0x3a')]][_0xdf3c('0x2c')]()});}else if(_0x3daeda[_0xdf3c('0x32')]===_0xdf3c('0x3c')&&_0x3daeda[_0xdf3c('0x3d')]&&_0x3daeda[_0xdf3c('0x3d')][_0xdf3c('0x13')]&&_0x3daeda[_0xdf3c('0x38')]&&_0x3daeda[_0xdf3c('0x34')]){_0x575ae1[_0x3daeda['Variable'][_0xdf3c('0x13')]['toLowerCase']()]&&_0x46b445['custom_fields'][_0xdf3c('0x3b')]({'id':_0x3daeda['idField'],'value':_0x575ae1[_0x3daeda[_0xdf3c('0x3d')]['name'][_0xdf3c('0x36')]()][_0xdf3c('0x2c')]()});}});}return _0x46b445;}exports[_0xdf3c('0x3e')]=function(_0x1349a4,_0x3098cb,_0x5ebff9,_0x736ef5,_0x3d47fb,_0x3cf131){var _0xa65478,_0x424acf;_0x3cf131[_0xdf3c('0x19')]=intUtil['stripTrailingSlash'](_0x3cf131['remoteUri']);_0x3cf131[_0xdf3c('0x3f')]=intUtil['stripTrailingSlash'](_0x3cf131[_0xdf3c('0x3f')]);if(_0x3d47fb&&_0x3d47fb[_0xdf3c('0x40')]){logger[_0xdf3c('0x1c')](_0xdf3c('0x41'),'Recording\x20is\x20enabled!');_0x3098cb['recordingURL']=util[_0xdf3c('0xb')](_0xdf3c('0x42'),_0x3cf131[_0xdf3c('0x3f')],_0x3098cb['uniqueid'],md5(_0x3098cb[_0xdf3c('0x43')]));}else{_0x3098cb[_0xdf3c('0x44')]='';}headers[_0xdf3c('0x45')]=getAuth(_0x3cf131);return getUser(_0x3cf131,_0x736ef5[_0xdf3c('0x23')])['then'](function(_0x127685){_0xa65478=_0x127685;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xa65478['id']);return getEndUser(_0x3cf131,_0x3098cb[_0xdf3c('0xd')],_0x3098cb[_0xdf3c('0xe')]);})['then'](function(_0x410aaf){_0x424acf=_0x410aaf;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0x424acf['id']);return getTicket(_0x3cf131,_0xa65478,_0x424acf,_0x5ebff9,_0x3098cb);})[_0xdf3c('0x1b')](function(_0x36962d){if(_0x36962d&&_0x36962d['id']){logger[_0xdf3c('0x1c')]('Ticket\x20created!');logger['info'](_0xdf3c('0x48'),_0x36962d['id']);logger[_0xdf3c('0x1c')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf3c('0xb')](_0xdf3c('0x49'),_0x736ef5[_0xdf3c('0x13')]),_0xdf3c('0x4a'),{'uri':util[_0xdf3c('0xb')](_0xdf3c('0x4b'),_0x3cf131[_0xdf3c('0x19')],_0x36962d['id'])});}})[_0xdf3c('0x4c')](function(_0x4007b1){logger['error'](_0xdf3c('0x41'),JSON[_0xdf3c('0x4d')](_0x4007b1));});};exports[_0xdf3c('0x4e')]=function(_0xe760dd,_0xfc5901,_0x385824,_0x28a468,_0x553f70,_0x1751a8,_0x5c1dca){var _0xa4e137,_0x47b101;_0x1751a8[_0xdf3c('0x19')]=intUtil[_0xdf3c('0x4f')](_0x1751a8[_0xdf3c('0x19')]);_0x1751a8[_0xdf3c('0x3f')]=intUtil['stripTrailingSlash'](_0x1751a8['serverUrl']);if(_0x5c1dca&&_0x5c1dca['recordingFormat']&&_0x5c1dca[_0xdf3c('0x50')]!=='none'){logger[_0xdf3c('0x1c')](_0xdf3c('0x51'),_0xdf3c('0x52'));_0xfc5901[_0xdf3c('0x44')]=util[_0xdf3c('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1751a8['serverUrl'],_0xfc5901[_0xdf3c('0x43')],md5(_0xfc5901[_0xdf3c('0x43')]));}headers['Authorization']=getAuth(_0x1751a8);return getUser(_0x1751a8,_0x28a468[_0xdf3c('0x23')])[_0xdf3c('0x1b')](function(_0x168eaf){_0xa4e137=_0x168eaf;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xa4e137['id']);return getEndUser(_0x1751a8,_0xfc5901[_0xdf3c('0x53')],_0xfc5901[_0xdf3c('0x54')]);})['then'](function(_0x4c98dc){_0x47b101=_0x4c98dc;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0x47b101['id']);return getTicket(_0x1751a8,_0xa4e137,_0x47b101,_0x385824,_0xfc5901);})[_0xdf3c('0x1b')](function(_0x1ad771){if(_0x1ad771&&_0x1ad771['id']){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));logger[_0xdf3c('0x1c')](_0xdf3c('0x48'),_0x1ad771['id']);logger[_0xdf3c('0x1c')](_0xdf3c('0x51'),_0xdf3c('0x55'));emit(util['format'](_0xdf3c('0x49'),_0x28a468['name']),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1751a8['remoteUri'],_0x1ad771['id'])});}})[_0xdf3c('0x4c')](function(_0x1c18a9){logger['error'](_0xdf3c('0x51'),JSON[_0xdf3c('0x4d')](_0x1c18a9));});};exports['abandoned']=function(_0xa8dddb,_0x28f935,_0x10e9d5,_0x1389e0,_0x396461,_0x28f387){var _0xb54629,_0xdc859;_0x28f387[_0xdf3c('0x19')]=intUtil[_0xdf3c('0x4f')](_0x28f387[_0xdf3c('0x19')]);_0x28f387['serverUrl']=intUtil[_0xdf3c('0x4f')](_0x28f387[_0xdf3c('0x3f')]);if(_0x396461&&_0x396461[_0xdf3c('0x40')]){logger['info'](_0xdf3c('0x56'),_0xdf3c('0x52'));_0x28f935[_0xdf3c('0x44')]=util['format'](_0xdf3c('0x42'),_0x28f387[_0xdf3c('0x3f')],_0x28f935['uniqueid'],md5(_0x28f935[_0xdf3c('0x43')]));}else{_0x28f935['recordingURL']='';}headers[_0xdf3c('0x45')]=getAuth(_0x28f387);return getUser(_0x28f387,_0x1389e0[_0xdf3c('0x23')])[_0xdf3c('0x1b')](function(_0x3de07e){_0xb54629=_0x3de07e;logger[_0xdf3c('0x1c')](_0xdf3c('0x46'),_0xb54629['id']);return getEndUser(_0x28f387,_0x28f935[_0xdf3c('0xd')],_0x28f935[_0xdf3c('0xe')]);})[_0xdf3c('0x1b')](function(_0x330730){_0xdc859=_0x330730;logger[_0xdf3c('0x1c')](_0xdf3c('0x47'),_0xdc859['id']);return getTicket(_0x28f387,_0xb54629,_0xdc859,_0x10e9d5,_0x28f935);})[_0xdf3c('0x1b')](function(_0x206a18){if(_0x206a18){logger[_0xdf3c('0x1c')](_0xdf3c('0x1d'));logger[_0xdf3c('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x206a18['id']);}})['catch'](function(_0x2e8511){logger[_0xdf3c('0x57')](_0xdf3c('0x56'),JSON['stringify'](_0x2e8511));});}; \ 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 b4f7fcf..65831ba 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 _0xc053=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','exec','includes','data1','toLowerCase','data2','find'];(function(_0x50e7a6,_0x1e48c1){var _0x5140d8=function(_0x574dbd){while(--_0x574dbd){_0x50e7a6['push'](_0x50e7a6['shift']());}};_0x5140d8(++_0x1e48c1);}(_0xc053,0x13f));var _0x3c05=function(_0x2a9104,_0x1d805d){_0x2a9104=_0x2a9104-0x0;var _0x15fb8e=_0xc053[_0x2a9104];return _0x15fb8e;};'use strict';var _=require(_0x3c05('0x0'));var util=require(_0x3c05('0x1'));var zendesk=require(_0x3c05('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x3c05('0x3'));var freshdesk=require(_0x3c05('0x4'));var zoho=require(_0x3c05('0x5'));var desk=require(_0x3c05('0x6'));var vtiger=require(_0x3c05('0x7'));var integrations=[_0x3c05('0x8'),_0x3c05('0x9'),_0x3c05('0xa'),_0x3c05('0xb'),_0x3c05('0xc'),_0x3c05('0xd'),_0x3c05('0xe')];exports[_0x3c05('0xf')]=function(_0x2f44db,_0x2b5cb1,_0x42a3c9,_0x4f490c,_0x2ec34e,_0x47dfc3){if(_0x42a3c9){if(_[_0x3c05('0x10')](integrations,_0x2f44db[_0x3c05('0x11')]['toLowerCase']())){try{var _0x27fb99=null;var _0x3a2829='';var _0x24108a=_0x42a3c9[_0x2f44db[_0x3c05('0x11')][_0x3c05('0x12')]()];if(_0x24108a){var _0x1fb52b=_0x24108a[_0x2f44db[_0x3c05('0x13')]];if(_0x1fb52b){var _0x204f8f=_[_0x3c05('0x14')](_0x1fb52b[_0x3c05('0x15')],{'id':parseInt(_0x2f44db[_0x3c05('0x16')],0xa)});if(_0x204f8f){if(_0x4f490c){if(_0x2ec34e&&_0x2b5cb1[_0x3c05('0x17')]){_0x3a2829=_0x3c05('0x17');}else if(_0x2b5cb1[_0x3c05('0x18')]){_0x3a2829=_0x3c05('0x19');}else{console[_0x3c05('0x1a')](_0x3c05('0x1b'),_0x2b5cb1);}}else{_0x3a2829='abandoned';}switch(_0x2f44db[_0x3c05('0x11')][_0x3c05('0x12')]()){case _0x3c05('0x8'):zendesk[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0x9'):salesforce[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0xa'):sugarcrm[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0xb'):freshdesk[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0xc'):zoho[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0xd'):desk[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;case _0x3c05('0xe'):vtiger[_0x3a2829](_0x2f44db,_0x2b5cb1,_0x204f8f,_0x4f490c,_0x2ec34e,_0x1fb52b,_0x47dfc3);break;default:console[_0x3c05('0x1a')](_0x3c05('0x1c'));}}else{_0x27fb99=require(_0x3c05('0x1d'))(_0x2f44db[_0x3c05('0x11')][_0x3c05('0x12')]());_0x27fb99['error'](_0x3c05('0x1e'),util[_0x3c05('0x1f')](_0x3c05('0x20'),_0x2f44db[_0x3c05('0x11')]['toLowerCase'](),_0x2f44db[_0x3c05('0x16')]));}}else{_0x27fb99=require('../../../../config/logger')(_0x2f44db['data1'][_0x3c05('0x12')]());_0x27fb99[_0x3c05('0x21')](_0x3c05('0x1e'),util[_0x3c05('0x1f')]('%s\x20account\x20#%s\x20not\x20found',_0x2f44db['data1'][_0x3c05('0x12')](),_0x2f44db['data2']));}}else{}}catch(_0x3de3fe){console['error'](_0x3de3fe);}}}}; \ No newline at end of file +var _0x2c95=['./salesforce','./sugarcrm','./zoho','./desk','./vtiger','zendesk','sugarcrm','freshdesk','zoho','desk','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','abandoned','vtiger','unknown\x20integration','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk'];(function(_0x2fabfa,_0x175629){var _0x2c6d30=function(_0x110969){while(--_0x110969){_0x2fabfa['push'](_0x2fabfa['shift']());}};_0x2c6d30(++_0x175629);}(_0x2c95,0x1a1));var _0x52c9=function(_0x1591d4,_0x4ea3bd){_0x1591d4=_0x1591d4-0x0;var _0x4c46bb=_0x2c95[_0x1591d4];return _0x4c46bb;};'use strict';var _=require(_0x52c9('0x0'));var util=require(_0x52c9('0x1'));var zendesk=require(_0x52c9('0x2'));var salesforce=require(_0x52c9('0x3'));var sugarcrm=require(_0x52c9('0x4'));var freshdesk=require('./freshdesk');var zoho=require(_0x52c9('0x5'));var desk=require(_0x52c9('0x6'));var vtiger=require(_0x52c9('0x7'));var integrations=[_0x52c9('0x8'),'salesforce',_0x52c9('0x9'),_0x52c9('0xa'),_0x52c9('0xb'),_0x52c9('0xc'),'vtiger'];exports[_0x52c9('0xd')]=function(_0x5eba3d,_0x3225c8,_0xfaa346,_0x429cfb,_0x858c03,_0x42443d){if(_0xfaa346){if(_[_0x52c9('0xe')](integrations,_0x5eba3d['data1']['toLowerCase']())){try{var _0xae149f=null;var _0x479763='';var _0x2b2fdc=_0xfaa346[_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')]()];if(_0x2b2fdc){var _0x2c8268=_0x2b2fdc[_0x5eba3d[_0x52c9('0x11')]];if(_0x2c8268){var _0x314e91=_[_0x52c9('0x12')](_0x2c8268[_0x52c9('0x13')],{'id':parseInt(_0x5eba3d[_0x52c9('0x14')],0xa)});if(_0x314e91){if(_0x429cfb){if(_0x858c03&&_0x3225c8['queue']){_0x479763=_0x52c9('0x15');}else if(_0x3225c8[_0x52c9('0x16')]){_0x479763=_0x52c9('0x17');}else{console[_0x52c9('0x18')](_0x52c9('0x19'),_0x3225c8);}}else{_0x479763=_0x52c9('0x1a');}switch(_0x5eba3d['data1'][_0x52c9('0x10')]()){case'zendesk':zendesk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case'salesforce':salesforce[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0x9'):sugarcrm[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xa'):freshdesk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xb'):zoho[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0xc'):desk[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;case _0x52c9('0x1b'):vtiger[_0x479763](_0x5eba3d,_0x3225c8,_0x314e91,_0x429cfb,_0x858c03,_0x2c8268,_0x42443d);break;default:console[_0x52c9('0x18')](_0x52c9('0x1c'));}}else{_0xae149f=require('../../../../config/logger')(_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')]());_0xae149f[_0x52c9('0x1d')](_0x52c9('0x1e'),util[_0x52c9('0x1f')](_0x52c9('0x20'),_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')](),_0x5eba3d[_0x52c9('0x14')]));}}else{_0xae149f=require(_0x52c9('0x21'))(_0x5eba3d['data1'][_0x52c9('0x10')]());_0xae149f[_0x52c9('0x1d')](_0x52c9('0x1e'),util[_0x52c9('0x1f')](_0x52c9('0x22'),_0x5eba3d[_0x52c9('0xf')][_0x52c9('0x10')](),_0x5eba3d[_0x52c9('0x11')]));}}else{}}catch(_0xd3fd95){console[_0x52c9('0x1d')](_0xd3fd95);}}}}; \ 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 e0da252..726f00b 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 _0x8e26=['util','../../../../config/logger','salesforce','socket.io-emitter','localhost','emit','merge','utc','getString','Subjects','sobject','User','find','execute','then','length','Email','info','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','contact','Lead','Phone','Name','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','No\x20Company','upperFirst','create','forEach','string','idField','content','type','variableName','Variable','name','toLowerCase','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','username','Connection\x20established.','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[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','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','moment','bluebird','jsforce'];(function(_0x1ac08f,_0x1eba71){var _0x198b4b=function(_0xa4c8a4){while(--_0xa4c8a4){_0x1ac08f['push'](_0x1ac08f['shift']());}};_0x198b4b(++_0x1eba71);}(_0x8e26,0x1e1));var _0x68e2=function(_0x1c64a1,_0x2c90e1){_0x1c64a1=_0x1c64a1-0x0;var _0x46f1b4=_0x8e26[_0x1c64a1];return _0x46f1b4;};'use strict';var _=require(_0x68e2('0x0'));var rp=require('request-promise');var moment=require(_0x68e2('0x1'));var BPromise=require(_0x68e2('0x2'));var md5=require('md5');var jsforce=require(_0x68e2('0x3'));var util=require(_0x68e2('0x4'));var intUtil=require('./util');var logger=require(_0x68e2('0x5'))(_0x68e2('0x6'));var io=require(_0x68e2('0x7'))({'host':_0x68e2('0x8'),'port':0x18eb});function emit(_0x18daa7,_0x3e8727,_0x52cdbb){io['to'](_0x18daa7)[_0x68e2('0x9')](_0x3e8727,_0x52cdbb);}function getTicket(_0x4f7206,_0x539eaf,_0x411c33,_0x421c11,_0x9ca17c,_0x83bdcf,_0x387535){var _0x55defa=_[_0x68e2('0xa')]({'OwnerId':_0x539eaf['id'],'ActivityDate':moment[_0x68e2('0xb')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x68e2('0xc')](_0x421c11[_0x68e2('0xd')],_0x9ca17c,'\x20'),'Description':intUtil[_0x68e2('0xc')](_0x421c11['Descriptions'],_0x9ca17c,'\x0a')},getCustomFields(_0x83bdcf,_0x9ca17c));if(_0x411c33){_0x55defa['WhoId']=_0x411c33['id'];}return _0x387535[_0x68e2('0xe')]('Task')['create'](_0x55defa);}function getUser(_0x201814,_0x45b9e8,_0x44c036){var _0x88959b={'Email':_0x45b9e8};var _0x3609a2={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x44c036['sobject'](_0x68e2('0xf'))[_0x68e2('0x10')](_0x88959b,_0x3609a2)[_0x68e2('0x11')]()[_0x68e2('0x12')](function(_0x6d7b93){if(_0x6d7b93[_0x68e2('0x13')]){var _0x42fd1b=_[_0x68e2('0x10')](_0x6d7b93,function(_0x31241c){return _0x31241c[_0x68e2('0x14')]===_0x45b9e8;});if(_0x42fd1b){logger[_0x68e2('0x15')]('Agent\x20%s\x20found.',_0x45b9e8);return BPromise[_0x68e2('0x16')]({'id':_0x42fd1b['Id'],'name':_0x42fd1b['Name']});}}else{logger[_0x68e2('0x15')](_0x68e2('0x17'),_0x45b9e8);return _0x44c036[_0x68e2('0x18')]()[_0x68e2('0x12')](function(_0x20ef71){return BPromise[_0x68e2('0x16')]({'id':_0x20ef71[_0x68e2('0x19')],'name':_0x20ef71[_0x68e2('0x1a')]});});}});}function getEndUser(_0x38b5cb,_0xfecfc0,_0x47fe80,_0xf07dd7,_0x4ae5a4){var _0x36562d={'Phone':_0xf07dd7};var _0x458e21={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x68e2('0x16')]()['then'](function(){logger['info'](_0x68e2('0x1b'),_0xf07dd7,_0xfecfc0['moduleSearch']);switch(_0xfecfc0[_0x68e2('0x1c')]){case'contact_lead':return _0x4ae5a4[_0x68e2('0xe')](_0x68e2('0x1d'))['find'](_0x36562d,_0x458e21)['execute']()[_0x68e2('0x12')](function(_0x519920){if(_0x519920&&_0x519920[_0x68e2('0x13')]){return _0x519920;}else{return _0x4ae5a4['sobject']('Lead')[_0x68e2('0x10')](_0x36562d,_0x458e21);}});case _0x68e2('0x1e'):return _0x4ae5a4[_0x68e2('0xe')](_0x68e2('0x1d'))[_0x68e2('0x10')](_0x36562d,_0x458e21)[_0x68e2('0x11')]();case'lead':return _0x4ae5a4[_0x68e2('0xe')](_0x68e2('0x1f'))[_0x68e2('0x10')](_0x36562d,_0x458e21);default:return null;}})[_0x68e2('0x12')](function(_0x42ab6c){if(_0x42ab6c&&_0x42ab6c[_0x68e2('0x13')]){var _0x50f1ad=_['find'](_0x42ab6c,function(_0x5df62d){return _0x5df62d[_0x68e2('0x20')]===_0xf07dd7;});if(_0x50f1ad){return BPromise[_0x68e2('0x16')]({'id':_0x50f1ad['Id'],'name':_0x50f1ad[_0x68e2('0x21')],'phone':_0x50f1ad[_0x68e2('0x20')]});}}})[_0x68e2('0x12')](function(_0x5edc98){if(_0x5edc98){logger[_0x68e2('0x15')](_0x68e2('0x22'),_0xf07dd7);return BPromise[_0x68e2('0x16')](_0x5edc98);}else{logger[_0x68e2('0x15')](_0x68e2('0x23'),_0xf07dd7);var _0x1b7f67={'LastName':_0x47fe80!==_0x68e2('0x24')?_0x47fe80:util[_0x68e2('0x25')](_0x68e2('0x26'),_0xf07dd7),'Phone':_0xf07dd7};if(_0xfecfc0[_0x68e2('0x27')]){switch(_0xfecfc0[_0x68e2('0x27')]){case _0x68e2('0x1e'):logger[_0x68e2('0x15')](_0x68e2('0x28'),_0xf07dd7,_0xfecfc0['moduleCreate']);break;case _0x68e2('0x29'):logger['info'](_0x68e2('0x28'),_0xf07dd7,_0xfecfc0[_0x68e2('0x27')]);_0x1b7f67['Company']=_0x68e2('0x2a');break;default:return null;}}return _0x4ae5a4[_0x68e2('0xe')](_[_0x68e2('0x2b')](_0xfecfc0['moduleCreate']))[_0x68e2('0x2c')](_0x1b7f67);}});}function getCustomFields(_0x159df3,_0x507970){var _0x4d3586={};if(_0x159df3[_0x68e2('0x13')]>0x0){_[_0x68e2('0x2d')](_0x159df3,function(_0x36579c){if(_0x36579c['type']===_0x68e2('0x2e')&&_0x36579c[_0x68e2('0x2f')]){_0x4d3586[_0x36579c[_0x68e2('0x2f')]]=_0x36579c[_0x68e2('0x30')]['toString']();}else if(_0x36579c[_0x68e2('0x31')]==='variable'&&_0x36579c[_0x68e2('0x32')]&&_0x36579c['idField']){_0x507970[_0x36579c[_0x68e2('0x32')]]&&(_0x4d3586[_0x36579c[_0x68e2('0x2f')]]=_0x507970[_0x36579c['variableName']]['toString']());}else if(_0x36579c[_0x68e2('0x31')]==='customVariable'&&_0x36579c[_0x68e2('0x33')]&&_0x36579c[_0x68e2('0x33')][_0x68e2('0x34')]&&_0x36579c[_0x68e2('0x2f')]){_0x507970[_0x36579c[_0x68e2('0x33')][_0x68e2('0x34')][_0x68e2('0x35')]()]&&(_0x4d3586[_0x36579c['idField']]=_0x507970[_0x36579c['Variable'][_0x68e2('0x34')][_0x68e2('0x35')]()]['toString']());}});}return _0x4d3586;}function getConnection(_0x5c6d69){var _0x2edeee=_0x5c6d69[_0x68e2('0x36')]['concat'](_0x5c6d69[_0x68e2('0x37')]);var _0x533bc1=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5c6d69[_0x68e2('0x38')]||_0x68e2('0x39'),'clientId':_0x5c6d69[_0x68e2('0x3a')],'clientSecret':_0x5c6d69[_0x68e2('0x3b')]}});return _0x533bc1['login'](_0x5c6d69[_0x68e2('0x3c')],_0x2edeee)['then'](function(){logger[_0x68e2('0x15')](_0x68e2('0x3d'));return _0x533bc1;});}exports[_0x68e2('0x3e')]=function(_0xa80b4b,_0x34897b,_0x4e7b87,_0x95d005,_0x19685a,_0x207d19){var _0x4c4373,_0x3980c8,_0x5c161b,_0x38908f;_0x207d19['serverUrl']=intUtil[_0x68e2('0x3f')](_0x207d19['serverUrl']);if(_0x19685a&&_0x19685a[_0x68e2('0x40')]){logger[_0x68e2('0x15')](_0x68e2('0x41'),_0x68e2('0x42'));_0x34897b[_0x68e2('0x43')]=util[_0x68e2('0x25')](_0x68e2('0x44'),_0x207d19[_0x68e2('0x45')],_0x34897b[_0x68e2('0x46')],md5(_0x34897b[_0x68e2('0x46')]));}else{_0x34897b['recordingURL']='';}return getConnection(_0x207d19)[_0x68e2('0x12')](function(_0x364783){_0x38908f=_0x364783;return getUser(_0x207d19,_0x95d005[_0x68e2('0x47')],_0x38908f);})[_0x68e2('0x12')](function(_0x26058a){_0x4c4373=_0x26058a;return getEndUser(_0x207d19,_0x4e7b87,_0x34897b[_0x68e2('0x48')],_0x34897b[_0x68e2('0x49')],_0x38908f);})[_0x68e2('0x12')](function(_0x207c0f){_0x3980c8=_0x207c0f;return getTicket(_0x207d19,_0x4c4373,_0x3980c8,_0x4e7b87,_0x34897b,_0x4e7b87['Fields'],_0x38908f);})['then'](function(_0x200469){_0x5c161b=_0x200469;logger['info'](_0x68e2('0x4a'),_0x5c161b['id']);logger[_0x68e2('0x15')](_0x68e2('0x4b'),_0x5c161b['id'],_0x95d005['name'],_0x207d19[_0x68e2('0x31')]);switch(_0x207d19[_0x68e2('0x31')]){case'integrationTab':emit(util[_0x68e2('0x25')](_0x68e2('0x4c'),_0x95d005[_0x68e2('0x34')]),_0x68e2('0x4d'),{'recordId':_0x5c161b['id']});break;case'newTab':emit(util[_0x68e2('0x25')](_0x68e2('0x4c'),_0x95d005[_0x68e2('0x34')]),_0x68e2('0x4e'),{'uri':util['format'](_0x68e2('0x4f'),_0x38908f[_0x68e2('0x50')],_0x5c161b['id'])});break;default:logger[_0x68e2('0x51')](_0x68e2('0x52'));}})[_0x68e2('0x53')](function(_0x21a4db){logger[_0x68e2('0x51')]('[QUEUE]',JSON[_0x68e2('0x54')](_0x21a4db));});};exports[_0x68e2('0x55')]=function(_0x120c60,_0x689a9e,_0x414f80,_0x280362,_0x9dee54,_0x37820e,_0x485e62){var _0x459fcf,_0x345a8a,_0x16f6c2,_0x49915d;_0x37820e[_0x68e2('0x45')]=intUtil[_0x68e2('0x3f')](_0x37820e['serverUrl']);if(_0x485e62&&_0x485e62[_0x68e2('0x56')]&&_0x485e62[_0x68e2('0x56')]!==_0x68e2('0x57')){logger[_0x68e2('0x15')](_0x68e2('0x58'),'Recording\x20is\x20enabled!');_0x689a9e[_0x68e2('0x43')]=util['format'](_0x68e2('0x44'),_0x37820e['serverUrl'],_0x689a9e['uniqueid'],md5(_0x689a9e[_0x68e2('0x46')]));}return getConnection(_0x37820e)[_0x68e2('0x12')](function(_0x5776b0){_0x49915d=_0x5776b0;return getUser(_0x37820e,_0x280362[_0x68e2('0x47')],_0x49915d);})[_0x68e2('0x12')](function(_0x20ae1c){_0x459fcf=_0x20ae1c;return getEndUser(_0x37820e,_0x414f80,_0x689a9e['destcalleridname'],_0x689a9e[_0x68e2('0x59')],_0x49915d);})[_0x68e2('0x12')](function(_0x2e4a12){_0x345a8a=_0x2e4a12;return getTicket(_0x37820e,_0x459fcf,_0x345a8a,_0x414f80,_0x689a9e,_0x414f80[_0x68e2('0x5a')],_0x49915d);})[_0x68e2('0x12')](function(_0x53eb82){_0x16f6c2=_0x53eb82;logger[_0x68e2('0x15')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x16f6c2['id']);logger[_0x68e2('0x15')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x16f6c2['id'],_0x280362[_0x68e2('0x34')],_0x37820e['type']);switch(_0x37820e[_0x68e2('0x31')]){case _0x68e2('0x5b'):emit(util['format'](_0x68e2('0x4c'),_0x280362[_0x68e2('0x34')]),_0x68e2('0x4d'),{'recordId':_0x16f6c2['id']});break;case'newTab':emit(util[_0x68e2('0x25')](_0x68e2('0x4c'),_0x280362['name']),_0x68e2('0x4e'),{'uri':util['format'](_0x68e2('0x4f'),_0x49915d[_0x68e2('0x50')],_0x16f6c2['id'])});break;default:logger[_0x68e2('0x51')](_0x68e2('0x58'),_0x68e2('0x5c'));}})[_0x68e2('0x53')](function(_0xdb7b8d){logger[_0x68e2('0x51')](_0x68e2('0x58'),JSON[_0x68e2('0x54')](_0xdb7b8d));});};exports[_0x68e2('0x5d')]=function(_0x501454,_0x1b7957,_0x17fa8b,_0x1b5ec3,_0x1d8a61,_0x3231bb){var _0x1d89ed,_0x1037fa,_0x15da5c,_0x3410bc;_0x3231bb[_0x68e2('0x45')]=intUtil['stripTrailingSlash'](_0x3231bb[_0x68e2('0x45')]);if(_0x1d8a61&&_0x1d8a61['monitor_format']){logger[_0x68e2('0x15')](_0x68e2('0x5e'),_0x68e2('0x42'));_0x1b7957[_0x68e2('0x43')]=util['format'](_0x68e2('0x44'),_0x3231bb[_0x68e2('0x45')],_0x1b7957['uniqueid'],md5(_0x1b7957[_0x68e2('0x46')]));}else{_0x1b7957[_0x68e2('0x43')]='';}return getConnection(_0x3231bb)[_0x68e2('0x12')](function(_0x2d06bf){_0x3410bc=_0x2d06bf;return getUser(_0x3231bb,_0x1b5ec3['email'],_0x3410bc);})[_0x68e2('0x12')](function(_0x16511f){_0x1d89ed=_0x16511f;return getEndUser(_0x3231bb,_0x17fa8b,_0x1b7957[_0x68e2('0x48')],_0x1b7957['calleridnum'],_0x3410bc);})[_0x68e2('0x12')](function(_0x329102){_0x1037fa=_0x329102;return getTicket(_0x3231bb,_0x1d89ed,_0x1037fa,_0x17fa8b,_0x1b7957,_0x17fa8b['Fields'],_0x3410bc);})[_0x68e2('0x12')](function(_0x521446){_0x15da5c=_0x521446;logger['info'](_0x68e2('0x5f'),_0x15da5c['id']);logger[_0x68e2('0x15')](_0x68e2('0x60'),_0x3231bb[_0x68e2('0x31')]);})['catch'](function(_0x253af8){logger[_0x68e2('0x51')](_0x68e2('0x5e'),JSON['stringify'](_0x253af8));});}; \ No newline at end of file +var _0x4659=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','[QUEUE]\x20Ticket\x20%s\x20created','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','[ABANDONED]','calleridname','calleridnum','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','jsforce','./util','../../../../config/logger','salesforce','socket.io-emitter','localhost','emit','Subjects','getString','Descriptions','WhoId','sobject','create','User','find','execute','then','Email','info','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','Contact','length','Lead','contact','lead','Phone','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','format','Caller\x20-\x20%s','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','forEach','type','idField','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','Connection','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!'];(function(_0x5ee58f,_0x3ad41f){var _0x330129=function(_0x1d4d72){while(--_0x1d4d72){_0x5ee58f['push'](_0x5ee58f['shift']());}};_0x330129(++_0x3ad41f);}(_0x4659,0x83));var _0x9465=function(_0x2461cb,_0x35f985){_0x2461cb=_0x2461cb-0x0;var _0x9c1b8f=_0x4659[_0x2461cb];return _0x9c1b8f;};'use strict';var _=require(_0x9465('0x0'));var rp=require(_0x9465('0x1'));var moment=require(_0x9465('0x2'));var BPromise=require(_0x9465('0x3'));var md5=require('md5');var jsforce=require(_0x9465('0x4'));var util=require('util');var intUtil=require(_0x9465('0x5'));var logger=require(_0x9465('0x6'))(_0x9465('0x7'));var io=require(_0x9465('0x8'))({'host':_0x9465('0x9'),'port':0x18eb});function emit(_0x18b3ff,_0x2bee7e,_0x181fca){io['to'](_0x18b3ff)[_0x9465('0xa')](_0x2bee7e,_0x181fca);}function getTicket(_0x41998c,_0x4686b9,_0xd95848,_0x36e8a5,_0x46d793,_0x296762,_0x1a8326){var _0x4dd52e=_['merge']({'OwnerId':_0x4686b9['id'],'ActivityDate':moment['utc'](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil['getString'](_0x36e8a5[_0x9465('0xb')],_0x46d793,'\x20'),'Description':intUtil[_0x9465('0xc')](_0x36e8a5[_0x9465('0xd')],_0x46d793,'\x0a')},getCustomFields(_0x296762,_0x46d793));if(_0xd95848){_0x4dd52e[_0x9465('0xe')]=_0xd95848['id'];}return _0x1a8326[_0x9465('0xf')]('Task')[_0x9465('0x10')](_0x4dd52e);}function getUser(_0x462b7d,_0x46fef5,_0x46a1c3){var _0x48b443={'Email':_0x46fef5};var _0xfdc154={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x46a1c3[_0x9465('0xf')](_0x9465('0x11'))[_0x9465('0x12')](_0x48b443,_0xfdc154)[_0x9465('0x13')]()[_0x9465('0x14')](function(_0x56af5a){if(_0x56af5a['length']){var _0x414696=_[_0x9465('0x12')](_0x56af5a,function(_0x1eca8b){return _0x1eca8b[_0x9465('0x15')]===_0x46fef5;});if(_0x414696){logger['info']('Agent\x20%s\x20found.',_0x46fef5);return BPromise['resolve']({'id':_0x414696['Id'],'name':_0x414696['Name']});}}else{logger[_0x9465('0x16')](_0x9465('0x17'),_0x46fef5);return _0x46a1c3['identity']()[_0x9465('0x14')](function(_0xc773c7){return BPromise[_0x9465('0x18')]({'id':_0xc773c7[_0x9465('0x19')],'name':_0xc773c7['display_name']});});}});}function getEndUser(_0x16c08b,_0x542d1c,_0x1c151f,_0xcacad0,_0x4d701f){var _0x5e5c32={'Phone':_0xcacad0};var _0x162063={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9465('0x18')]()[_0x9465('0x14')](function(){logger[_0x9465('0x16')](_0x9465('0x1a'),_0xcacad0,_0x542d1c['moduleSearch']);switch(_0x542d1c[_0x9465('0x1b')]){case _0x9465('0x1c'):return _0x4d701f[_0x9465('0xf')](_0x9465('0x1d'))[_0x9465('0x12')](_0x5e5c32,_0x162063)[_0x9465('0x13')]()[_0x9465('0x14')](function(_0x3a900a){if(_0x3a900a&&_0x3a900a[_0x9465('0x1e')]){return _0x3a900a;}else{return _0x4d701f[_0x9465('0xf')](_0x9465('0x1f'))['find'](_0x5e5c32,_0x162063);}});case _0x9465('0x20'):return _0x4d701f[_0x9465('0xf')]('Contact')[_0x9465('0x12')](_0x5e5c32,_0x162063)[_0x9465('0x13')]();case _0x9465('0x21'):return _0x4d701f[_0x9465('0xf')](_0x9465('0x1f'))[_0x9465('0x12')](_0x5e5c32,_0x162063);default:return null;}})['then'](function(_0x23ad02){if(_0x23ad02&&_0x23ad02[_0x9465('0x1e')]){var _0x3fbb31=_[_0x9465('0x12')](_0x23ad02,function(_0x189314){return _0x189314[_0x9465('0x22')]===_0xcacad0;});if(_0x3fbb31){return BPromise['resolve']({'id':_0x3fbb31['Id'],'name':_0x3fbb31['Name'],'phone':_0x3fbb31[_0x9465('0x22')]});}}})[_0x9465('0x14')](function(_0x146b68){if(_0x146b68){logger[_0x9465('0x16')]('Enduser\x20with\x20phone\x20%s\x20found.',_0xcacad0);return BPromise[_0x9465('0x18')](_0x146b68);}else{logger[_0x9465('0x16')](_0x9465('0x23'),_0xcacad0);var _0x182d3a={'LastName':_0x1c151f!==_0x9465('0x24')?_0x1c151f:util[_0x9465('0x25')](_0x9465('0x26'),_0xcacad0),'Phone':_0xcacad0};if(_0x542d1c[_0x9465('0x27')]){switch(_0x542d1c[_0x9465('0x27')]){case _0x9465('0x20'):logger[_0x9465('0x16')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0xcacad0,_0x542d1c[_0x9465('0x27')]);break;case _0x9465('0x21'):logger[_0x9465('0x16')](_0x9465('0x28'),_0xcacad0,_0x542d1c['moduleCreate']);_0x182d3a[_0x9465('0x29')]=_0x9465('0x2a');break;default:return null;}}return _0x4d701f[_0x9465('0xf')](_[_0x9465('0x2b')](_0x542d1c[_0x9465('0x27')]))['create'](_0x182d3a);}});}function getCustomFields(_0x8cdb6a,_0x347e3c){var _0x16d9a9={};if(_0x8cdb6a[_0x9465('0x1e')]>0x0){_[_0x9465('0x2c')](_0x8cdb6a,function(_0x103041){if(_0x103041[_0x9465('0x2d')]==='string'&&_0x103041['idField']){_0x16d9a9[_0x103041[_0x9465('0x2e')]]=_0x103041[_0x9465('0x2f')]['toString']();}else if(_0x103041[_0x9465('0x2d')]===_0x9465('0x30')&&_0x103041['variableName']&&_0x103041[_0x9465('0x2e')]){_0x347e3c[_0x103041[_0x9465('0x31')]]&&(_0x16d9a9[_0x103041[_0x9465('0x2e')]]=_0x347e3c[_0x103041[_0x9465('0x31')]][_0x9465('0x32')]());}else if(_0x103041[_0x9465('0x2d')]===_0x9465('0x33')&&_0x103041['Variable']&&_0x103041[_0x9465('0x34')][_0x9465('0x35')]&&_0x103041[_0x9465('0x2e')]){_0x347e3c[_0x103041[_0x9465('0x34')]['name'][_0x9465('0x36')]()]&&(_0x16d9a9[_0x103041['idField']]=_0x347e3c[_0x103041[_0x9465('0x34')][_0x9465('0x35')]['toLowerCase']()][_0x9465('0x32')]());}});}return _0x16d9a9;}function getConnection(_0x2a36c9){var _0x63c702=_0x2a36c9[_0x9465('0x37')][_0x9465('0x38')](_0x2a36c9['securityToken']);var _0x2b52ac=new jsforce[(_0x9465('0x39'))]({'oauth2':{'loginUrl':_0x2a36c9[_0x9465('0x3a')]||_0x9465('0x3b'),'clientId':_0x2a36c9['clientId'],'clientSecret':_0x2a36c9['clientSecret']}});return _0x2b52ac[_0x9465('0x3c')](_0x2a36c9[_0x9465('0x3d')],_0x63c702)[_0x9465('0x14')](function(){logger[_0x9465('0x16')](_0x9465('0x3e'));return _0x2b52ac;});}exports[_0x9465('0x3f')]=function(_0x34e3d7,_0x1f7873,_0x3ebfd8,_0x593e97,_0x3d3af9,_0x16b143){var _0xbe8767,_0x4fb9cd,_0x3aa4ad,_0x1b7a46;_0x16b143[_0x9465('0x40')]=intUtil[_0x9465('0x41')](_0x16b143[_0x9465('0x40')]);if(_0x3d3af9&&_0x3d3af9['monitor_format']){logger['info']('[QUEUE]',_0x9465('0x42'));_0x1f7873['recordingURL']=util[_0x9465('0x25')](_0x9465('0x43'),_0x16b143[_0x9465('0x40')],_0x1f7873[_0x9465('0x44')],md5(_0x1f7873[_0x9465('0x44')]));}else{_0x1f7873[_0x9465('0x45')]='';}return getConnection(_0x16b143)['then'](function(_0x91c083){_0x1b7a46=_0x91c083;return getUser(_0x16b143,_0x593e97[_0x9465('0x46')],_0x1b7a46);})[_0x9465('0x14')](function(_0x31db18){_0xbe8767=_0x31db18;return getEndUser(_0x16b143,_0x3ebfd8,_0x1f7873['calleridname'],_0x1f7873['calleridnum'],_0x1b7a46);})[_0x9465('0x14')](function(_0x51ea14){_0x4fb9cd=_0x51ea14;return getTicket(_0x16b143,_0xbe8767,_0x4fb9cd,_0x3ebfd8,_0x1f7873,_0x3ebfd8['Fields'],_0x1b7a46);})[_0x9465('0x14')](function(_0x3358e1){_0x3aa4ad=_0x3358e1;logger[_0x9465('0x16')](_0x9465('0x47'),_0x3aa4ad['id']);logger['info']('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3aa4ad['id'],_0x593e97[_0x9465('0x35')],_0x16b143[_0x9465('0x2d')]);switch(_0x16b143['type']){case'integrationTab':emit(util[_0x9465('0x25')]('user:%s',_0x593e97[_0x9465('0x35')]),_0x9465('0x48'),{'recordId':_0x3aa4ad['id']});break;case _0x9465('0x49'):emit(util['format'](_0x9465('0x4a'),_0x593e97['name']),_0x9465('0x4b'),{'uri':util[_0x9465('0x25')](_0x9465('0x4c'),_0x1b7a46[_0x9465('0x4d')],_0x3aa4ad['id'])});break;default:logger[_0x9465('0x4e')](_0x9465('0x4f'));}})[_0x9465('0x50')](function(_0x303f6e){logger[_0x9465('0x4e')](_0x9465('0x51'),JSON[_0x9465('0x52')](_0x303f6e));});};exports[_0x9465('0x53')]=function(_0x20c902,_0xb37d37,_0x207574,_0x1904b3,_0x4aa1d5,_0x10026a,_0x38bf0f){var _0x128682,_0x3ab235,_0x8d982e,_0x2812be;_0x10026a[_0x9465('0x40')]=intUtil['stripTrailingSlash'](_0x10026a['serverUrl']);if(_0x38bf0f&&_0x38bf0f[_0x9465('0x54')]&&_0x38bf0f[_0x9465('0x54')]!==_0x9465('0x55')){logger[_0x9465('0x16')](_0x9465('0x56'),_0x9465('0x42'));_0xb37d37[_0x9465('0x45')]=util['format'](_0x9465('0x43'),_0x10026a['serverUrl'],_0xb37d37[_0x9465('0x44')],md5(_0xb37d37[_0x9465('0x44')]));}return getConnection(_0x10026a)[_0x9465('0x14')](function(_0xe12f2c){_0x2812be=_0xe12f2c;return getUser(_0x10026a,_0x1904b3[_0x9465('0x46')],_0x2812be);})[_0x9465('0x14')](function(_0x285498){_0x128682=_0x285498;return getEndUser(_0x10026a,_0x207574,_0xb37d37['destcalleridname'],_0xb37d37[_0x9465('0x57')],_0x2812be);})['then'](function(_0x372690){_0x3ab235=_0x372690;return getTicket(_0x10026a,_0x128682,_0x3ab235,_0x207574,_0xb37d37,_0x207574[_0x9465('0x58')],_0x2812be);})[_0x9465('0x14')](function(_0x5bcb2f){_0x8d982e=_0x5bcb2f;logger[_0x9465('0x16')](_0x9465('0x59'),_0x8d982e['id']);logger['info'](_0x9465('0x5a'),_0x8d982e['id'],_0x1904b3[_0x9465('0x35')],_0x10026a[_0x9465('0x2d')]);switch(_0x10026a[_0x9465('0x2d')]){case _0x9465('0x5b'):emit(util[_0x9465('0x25')](_0x9465('0x4a'),_0x1904b3[_0x9465('0x35')]),'trigger:salesforce:display',{'recordId':_0x8d982e['id']});break;case _0x9465('0x49'):emit(util[_0x9465('0x25')](_0x9465('0x4a'),_0x1904b3[_0x9465('0x35')]),'trigger:browser:url',{'uri':util[_0x9465('0x25')](_0x9465('0x4c'),_0x2812be['instanceUrl'],_0x8d982e['id'])});break;default:logger[_0x9465('0x4e')]('[OUTBOUND]',_0x9465('0x5c'));}})[_0x9465('0x50')](function(_0x3b64b9){logger[_0x9465('0x4e')](_0x9465('0x56'),JSON[_0x9465('0x52')](_0x3b64b9));});};exports[_0x9465('0x5d')]=function(_0xf47fd,_0x5f3ecc,_0x50472e,_0x2cd643,_0x3dfd8b,_0x2a7996){var _0x5a18ea,_0x29467c,_0x30cc40,_0x497717;_0x2a7996[_0x9465('0x40')]=intUtil[_0x9465('0x41')](_0x2a7996[_0x9465('0x40')]);if(_0x3dfd8b&&_0x3dfd8b[_0x9465('0x5e')]){logger[_0x9465('0x16')](_0x9465('0x5f'),_0x9465('0x42'));_0x5f3ecc[_0x9465('0x45')]=util[_0x9465('0x25')](_0x9465('0x43'),_0x2a7996[_0x9465('0x40')],_0x5f3ecc[_0x9465('0x44')],md5(_0x5f3ecc[_0x9465('0x44')]));}else{_0x5f3ecc['recordingURL']='';}return getConnection(_0x2a7996)[_0x9465('0x14')](function(_0x4f7ce1){_0x497717=_0x4f7ce1;return getUser(_0x2a7996,_0x2cd643[_0x9465('0x46')],_0x497717);})[_0x9465('0x14')](function(_0x1c6745){_0x5a18ea=_0x1c6745;return getEndUser(_0x2a7996,_0x50472e,_0x5f3ecc[_0x9465('0x60')],_0x5f3ecc[_0x9465('0x61')],_0x497717);})['then'](function(_0x2fecfb){_0x29467c=_0x2fecfb;return getTicket(_0x2a7996,_0x5a18ea,_0x29467c,_0x50472e,_0x5f3ecc,_0x50472e[_0x9465('0x58')],_0x497717);})[_0x9465('0x14')](function(_0x247004){_0x30cc40=_0x247004;logger[_0x9465('0x16')]('[ABANDONED]\x20Ticket\x20%s\x20created.',_0x30cc40['id']);logger[_0x9465('0x16')](_0x9465('0x62'),_0x2a7996[_0x9465('0x2d')]);})[_0x9465('0x50')](function(_0x4f26d9){logger[_0x9465('0x4e')](_0x9465('0x5f'),JSON[_0x9465('0x52')](_0x4f26d9));});}; \ 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 091c26c..4abf490 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 _0x9084=['getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','parent_name','forEach','variableName','push','idField','set_entry','JSON','stringify','format','Basic\x20%s','toString','base64','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','length','find','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','map','type','string','nameField','customField','content','custom_fields','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','users','contacts','error','[ABANDONED]','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','socket.io-emitter','localhost','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9084,0xcf));var _0x4908=function(_0x14b7c8,_0xdb312d){_0x14b7c8=_0x14b7c8-0x0;var _0x5c1617=_0x9084[_0x14b7c8];return _0x5c1617;};'use strict';var _=require(_0x4908('0x0'));var rp=require(_0x4908('0x1'));var BPromise=require(_0x4908('0x2'));var md5=require(_0x4908('0x3'));var util=require(_0x4908('0x4'));var intUtil=require(_0x4908('0x5'));var logger=require(_0x4908('0x6'))('sugarcrm');var io=require(_0x4908('0x7'))({'host':_0x4908('0x8'),'port':0x18eb});var def={'method':'POST','json':!![]};function emit(_0x33b6c3,_0x269025,_0x4d4ac7){io['to'](_0x33b6c3)[_0x4908('0x9')](_0x269025,_0x4d4ac7);}function getTicket(_0x5009c1,_0x1d5af1,_0x3708d2,_0x1347bd,_0x15b40f,_0x99ca5b,_0xce8f6f){logger[_0x4908('0xa')](_0x4908('0xb'));var _0x5e7087=new Date();var _0x1b3a16=[{'name':_0x4908('0xc'),'value':intUtil[_0x4908('0xd')](_0x1347bd[_0x4908('0xe')],_0x15b40f,'\x20')},{'name':_0x4908('0xf'),'value':_0x1d5af1['id']},{'name':_0x4908('0x10'),'value':_0x1d5af1['id']},{'name':'description','value':intUtil[_0x4908('0xd')](_0x1347bd[_0x4908('0x11')],_0x15b40f,'\x0a')},{'name':'date_start','value':_0x5e7087[_0x4908('0x12')]()[_0x4908('0x13')](0x0,0x13)[_0x4908('0x14')]('T','\x20')},{'name':_0x4908('0x15'),'value':'0'},{'name':_0x4908('0x16'),'value':'15'},{'name':_0x4908('0x17'),'value':_0x3708d2['id']},{'name':_0x4908('0x18'),'value':'Contacts'},{'name':_0x4908('0x19'),'value':_0x3708d2[_0x4908('0xc')]}];if(_0x99ca5b['length']){_[_0x4908('0x1a')](_0x99ca5b,function(_0x3bd56b){if(_0x15b40f[_0x3bd56b[_0x4908('0x1b')]]){_0x1b3a16[_0x4908('0x1c')]({'name':_0x3bd56b[_0x4908('0x1d')],'value':_0x15b40f[_0x3bd56b[_0x4908('0x1b')]]});}});}return request({'form':{'method':_0x4908('0x1e'),'input_type':_0x4908('0x1f'),'response_type':_0x4908('0x1f'),'rest_data':JSON[_0x4908('0x20')]({'session':_0xce8f6f['id'],'module_name':'Calls','name_value_list':_0x1b3a16})}});}function getAuth(_0x4ef0e2){return util[_0x4908('0x21')](_0x4908('0x22'),new Buffer(_0x4ef0e2['apiKey']+':X')[_0x4908('0x23')](_0x4908('0x24')));}function getServerInfo(_0x314f7b){return request({'form':{'method':_0x4908('0x25'),'input_type':_0x4908('0x1f'),'response_type':_0x4908('0x1f'),'rest_data':JSON['stringify']({'session':_0x314f7b['id']})}});}function getUser(_0x3c792f,_0x34c72b,_0xa889d){logger[_0x4908('0xa')]('Getting\x20agent\x20with\x20name',_0x34c72b);return request({'form':{'method':'get_entry_list','input_type':_0x4908('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xa889d['id'],'module_name':_0x4908('0x26'),'query':util['format'](_0x4908('0x27'),_0x34c72b),'order_by':'','offset':'0','select_fields':['id',_0x4908('0xc'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4908('0x28')](function(_0x5ca8f8){if(_0x5ca8f8[_0x4908('0x29')][_0x4908('0x2a')]){var _0x101a70=_[_0x4908('0x2b')](_0x5ca8f8[_0x4908('0x29')],function(_0x26bd27){return _0x26bd27[_0x4908('0x2c')][_0x4908('0x2d')][_0x4908('0x2e')]===_0x34c72b;});if(_0x101a70){logger[_0x4908('0xa')]('Agent\x20found!');return BPromise[_0x4908('0x2f')]({'id':_0x101a70[_0x4908('0x2c')]['id']['value'],'name':_0x101a70['name_value_list'][_0x4908('0xc')][_0x4908('0x2e')]});}}else{logger['info'](_0x4908('0x30'));return BPromise[_0x4908('0x2f')]({'id':_0xa889d[_0x4908('0x2c')]['user_id']['id'],'name':_0xa889d['name_value_list'][_0x4908('0x2d')]['id']});}});}function getEndUser(_0x3ed652,_0x5896ce,_0x27f212,_0x5ca4a4){logger[_0x4908('0xa')](_0x4908('0x31'),_0x27f212);return request({'form':{'method':_0x4908('0x32'),'input_type':_0x4908('0x1f'),'response_type':_0x4908('0x1f'),'rest_data':JSON['stringify']({'session':_0x5ca4a4['id'],'module_name':'Contacts','query':util[_0x4908('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x27f212),'order_by':'','offset':'0','select_fields':['id',_0x4908('0xc'),_0x4908('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4908('0x28')](function(_0x430eca){if(_0x430eca[_0x4908('0x29')]['length']){var _0x3cec5f=_[_0x4908('0x2b')](_0x430eca[_0x4908('0x29')],function(_0x2e3b4f){return _0x2e3b4f[_0x4908('0x2c')][_0x4908('0x33')][_0x4908('0x2e')]===_0x27f212;});if(_0x3cec5f){logger[_0x4908('0xa')](_0x4908('0x34'));return BPromise[_0x4908('0x2f')]({'id':_0x3cec5f[_0x4908('0x2c')]['id'][_0x4908('0x2e')],'name':_0x3cec5f['name_value_list'][_0x4908('0xc')][_0x4908('0x2e')],'phone':_0x3cec5f[_0x4908('0x2c')][_0x4908('0x33')][_0x4908('0x2e')]});}}else{logger[_0x4908('0xa')](_0x4908('0x35'));return request({'form':{'method':_0x4908('0x1e'),'input_type':_0x4908('0x1f'),'response_type':_0x4908('0x1f'),'rest_data':JSON[_0x4908('0x20')]({'session':_0x5ca4a4['id'],'module_name':'Contacts','name_value_list':[{'name':_0x4908('0x36'),'value':_0x5896ce!==''?_0x5896ce:util[_0x4908('0x21')](_0x4908('0x37'),_0x27f212)},{'name':_0x4908('0x33'),'value':_0x27f212}]})}})['then'](function(_0x2cc5f4){logger['info'](_0x4908('0x38'));return BPromise['resolve']({'id':_0x2cc5f4['id'],'name':_0x2cc5f4[_0x4908('0x29')]['first_name'][_0x4908('0x2e')],'phone':_0x2cc5f4[_0x4908('0x29')]['phone_home'][_0x4908('0x2e')]});});}});}function request(_0x1841a9){logger[_0x4908('0x39')]('[HTTP]',JSON[_0x4908('0x20')](_0x1841a9));return rp(_['merge'](def,_0x1841a9));}function getTags(_0x5f14da,_0xa5c72e){var _0x2e95a7=[];if(_0x5f14da&&_0x5f14da[_0x4908('0x2a')]>0x0){_0x2e95a7=_[_0x4908('0x3a')](_0x5f14da,_0xa5c72e);}return _0x2e95a7;}function getCustomFields(_0x17c5bc,_0x1bc5ad){var _0x3ae044=[];var _0x1a24dc={'custom_fields':[]};if(_0x17c5bc['length']>0x0){_[_0x4908('0x1a')](_0x17c5bc,function(_0x343ce4){if(_0x343ce4[_0x4908('0x3b')]===_0x4908('0x3c')&&_0x343ce4[_0x4908('0x3d')]&&!_0x343ce4[_0x4908('0x3e')]){_0x1a24dc[_0x343ce4['nameField']['toLowerCase']()]=_0x343ce4[_0x4908('0x3f')]['toString']();}else if(_0x343ce4[_0x4908('0x3b')]===_0x4908('0x3c')&&_0x343ce4['idField']&&_0x343ce4[_0x4908('0x3e')]){_0x1a24dc[_0x4908('0x40')][_0x4908('0x1c')]({'id':_0x343ce4['idField'],'value':_0x343ce4['content'][_0x4908('0x23')]()});}else if(_0x343ce4[_0x4908('0x3b')]===_0x4908('0x41')&&_0x343ce4[_0x4908('0x1b')]&&_0x343ce4[_0x4908('0x1d')]&&_0x343ce4[_0x4908('0x3e')]){_0x1bc5ad[_0x343ce4['variableName']]&&_0x1a24dc[_0x4908('0x40')]['push']({'id':_0x343ce4[_0x4908('0x1d')],'value':_0x1bc5ad[_0x343ce4['variableName']][_0x4908('0x23')]()});}else if(_0x343ce4[_0x4908('0x3b')]===_0x4908('0x42')&&_0x343ce4['Variable']&&_0x343ce4[_0x4908('0x43')]['name']&&_0x343ce4[_0x4908('0x1d')]&&_0x343ce4['customField']){_0x1bc5ad[_0x343ce4[_0x4908('0x43')][_0x4908('0xc')]['toLowerCase']()]&&_0x1a24dc['custom_fields'][_0x4908('0x1c')]({'id':_0x343ce4[_0x4908('0x1d')],'value':_0x1bc5ad[_0x343ce4[_0x4908('0x43')][_0x4908('0xc')]['toLowerCase']()][_0x4908('0x23')]()});}});}return _0x1a24dc;}function getConnection(_0x49c906){return request({'method':_0x4908('0x44'),'form':{'method':_0x4908('0x45'),'input_type':_0x4908('0x1f'),'response_type':'JSON','rest_data':JSON[_0x4908('0x20')]({'user_auth':{'user_name':_0x49c906[_0x4908('0x46')],'password':_0x49c906[_0x4908('0x47')],'encryption':_0x4908('0x48')},'application':_0x4908('0x49')})}})[_0x4908('0x28')](function(_0x2c9cfc){var _0x392dd5=_0x2c9cfc;if(_0x392dd5['id']){def['sessionID']=_0x392dd5['id'];return BPromise[_0x4908('0x2f')](_0x392dd5);}else{throw new Error(util[_0x4908('0x21')](_0x4908('0x4a'),_0x49c906['id']));}});}function setRelationship(_0x2fe2b5,_0x559db6,_0x264029,_0x378927){return request({'form':{'method':_0x4908('0x4b'),'input_type':_0x4908('0x1f'),'response_type':_0x4908('0x1f'),'rest_data':JSON[_0x4908('0x20')]({'session':_0x2fe2b5['id'],'module_name':'Calls','module_id':_0x264029['id'],'link_field_name':_0x378927,'related_ids':[_0x559db6['id']]})}});}exports[_0x4908('0x4c')]=function(_0x3bc2c5,_0x179248,_0x43f767,_0x2a48b4,_0x5d2d7d,_0x29ee9a){var _0x296003,_0x52e154,_0x44068a,_0x3ba7e8;_0x29ee9a['remoteUri']=intUtil[_0x4908('0x4d')](_0x29ee9a[_0x4908('0x4e')]);_0x29ee9a[_0x4908('0x4f')]=intUtil['stripTrailingSlash'](_0x29ee9a[_0x4908('0x4f')]);def[_0x4908('0x50')]=util[_0x4908('0x21')](_0x4908('0x51'),_0x29ee9a[_0x4908('0x4e')]);if(_0x5d2d7d&&_0x5d2d7d[_0x4908('0x52')]){logger[_0x4908('0xa')](_0x4908('0x53'),_0x4908('0x54'));_0x179248[_0x4908('0x55')]=util[_0x4908('0x21')](_0x4908('0x56'),_0x29ee9a[_0x4908('0x4f')],_0x179248['uniqueid'],md5(_0x179248[_0x4908('0x57')]));}else{_0x179248['recordingURL']='';}return getConnection(_0x29ee9a)[_0x4908('0x28')](function(_0x2af523){_0x3ba7e8=_0x2af523;return getUser(_0x29ee9a,_0x2a48b4[_0x4908('0xc')],_0x3ba7e8);})[_0x4908('0x28')](function(_0x5ca797){_0x296003=_0x5ca797;logger[_0x4908('0xa')](_0x4908('0x58'),_0x296003['id']);return getEndUser(_0x29ee9a,_0x179248['calleridname'],_0x179248[_0x4908('0x59')],_0x3ba7e8);})[_0x4908('0x28')](function(_0x194294){_0x52e154=_0x194294;logger[_0x4908('0xa')](_0x4908('0x5a'),_0x52e154['id']);return getTicket(_0x29ee9a,_0x296003,_0x52e154,_0x43f767,_0x179248,_0x43f767['Fields'],_0x3ba7e8);})[_0x4908('0x28')](function(_0x30ad99){_0x44068a=_0x30ad99;logger[_0x4908('0xa')](_0x4908('0x5b'));logger['info'](_0x4908('0x5c'),_0x44068a['id']);return setRelationship(_0x3ba7e8,_0x296003,_0x44068a,'users');})['then'](function(){return setRelationship(_0x3ba7e8,_0x52e154,_0x44068a,'contacts');})[_0x4908('0x28')](function(){return getServerInfo(_0x3ba7e8);})[_0x4908('0x28')](function(_0x37e571){var _0x533393=parseInt(_0x37e571[_0x4908('0x5d')][_0x4908('0x5e')](0x0));var _0x193a61=util[_0x4908('0x21')](_0x4908('0x5f'),_0x29ee9a[_0x4908('0x4e')],_0x44068a['id']);if(_0x533393>0x6){_0x193a61=util['format'](_0x4908('0x60'),_0x29ee9a[_0x4908('0x4e')],_0x44068a['id']);}logger['info'](_0x4908('0x53'),_0x4908('0x61'));emit(util[_0x4908('0x21')]('user:%s',_0x2a48b4[_0x4908('0xc')]),_0x4908('0x62'),{'uri':_0x193a61});})[_0x4908('0x63')](function(_0x5c153f){logger['error'](_0x4908('0x53'),JSON[_0x4908('0x20')](_0x5c153f));});};exports[_0x4908('0x64')]=function(_0x5457ef,_0x2718f2,_0x5aa6a7,_0x57e84a,_0x4ab970,_0x357970,_0x3bc592){var _0x823332,_0x530efc,_0x370d9b,_0x36d959;_0x357970[_0x4908('0x4e')]=intUtil[_0x4908('0x4d')](_0x357970[_0x4908('0x4e')]);_0x357970['serverUrl']=intUtil['stripTrailingSlash'](_0x357970['serverUrl']);def['uri']=util[_0x4908('0x21')](_0x4908('0x51'),_0x357970[_0x4908('0x4e')]);if(_0x3bc592&&_0x3bc592[_0x4908('0x65')]&&_0x3bc592['recordingFormat']!==_0x4908('0x66')){logger[_0x4908('0xa')](_0x4908('0x67'),_0x4908('0x54'));_0x2718f2[_0x4908('0x55')]=util['format'](_0x4908('0x56'),_0x357970['serverUrl'],_0x2718f2['uniqueid'],md5(_0x2718f2[_0x4908('0x57')]));}return getConnection(_0x357970)[_0x4908('0x28')](function(_0x551f21){_0x36d959=_0x551f21;return getUser(_0x357970,_0x57e84a[_0x4908('0xc')],_0x36d959);})[_0x4908('0x28')](function(_0x1d4986){_0x823332=_0x1d4986;logger[_0x4908('0xa')](_0x4908('0x58'),_0x823332['id']);return getEndUser(_0x357970,_0x2718f2[_0x4908('0x68')],_0x2718f2['destcalleridnum'],_0x36d959);})[_0x4908('0x28')](function(_0x3feeba){_0x530efc=_0x3feeba;logger[_0x4908('0xa')](_0x4908('0x5a'),_0x530efc['id']);return getTicket(_0x357970,_0x823332,_0x530efc,_0x5aa6a7,_0x2718f2,_0x5aa6a7[_0x4908('0x69')],_0x36d959);})['then'](function(_0x3fde43){_0x370d9b=_0x3fde43;logger[_0x4908('0xa')](_0x4908('0x5b'));logger[_0x4908('0xa')](_0x4908('0x5c'),_0x370d9b['id']);return setRelationship(_0x36d959,_0x823332,_0x370d9b,_0x4908('0x6a'));})['then'](function(){return setRelationship(_0x36d959,_0x530efc,_0x370d9b,_0x4908('0x6b'));})[_0x4908('0x28')](function(){return getServerInfo(_0x36d959);})[_0x4908('0x28')](function(_0x5394bb){var _0x46df69=parseInt(_0x5394bb['version']['charAt'](0x0));var _0x335c11=util[_0x4908('0x21')](_0x4908('0x5f'),_0x357970[_0x4908('0x4e')],_0x370d9b['id']);if(_0x46df69>0x6){_0x335c11=util[_0x4908('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x357970[_0x4908('0x4e')],_0x370d9b['id']);}logger['info'](_0x4908('0x67'),_0x4908('0x61'));emit(util['format']('user:%s',_0x57e84a[_0x4908('0xc')]),_0x4908('0x62'),{'uri':_0x335c11});})['catch'](function(_0x39f1cd){logger[_0x4908('0x6c')]('[OUTBOUND]',JSON[_0x4908('0x20')](_0x39f1cd));});};exports['abandoned']=function(_0x216149,_0x4dc1df,_0x2c32c4,_0xf57ffc,_0x2ed504,_0x380066){var _0x21fa9d,_0x47f00d,_0x5597e4,_0x8d1768;_0x380066[_0x4908('0x4e')]=intUtil['stripTrailingSlash'](_0x380066[_0x4908('0x4e')]);_0x380066[_0x4908('0x4f')]=intUtil[_0x4908('0x4d')](_0x380066[_0x4908('0x4f')]);def['uri']=util[_0x4908('0x21')]('%s/service/v4_1/rest.php',_0x380066['remoteUri']);if(_0x2ed504&&_0x2ed504[_0x4908('0x52')]){logger['info'](_0x4908('0x6d'),_0x4908('0x54'));_0x4dc1df[_0x4908('0x55')]=util[_0x4908('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x380066[_0x4908('0x4f')],_0x4dc1df[_0x4908('0x57')],md5(_0x4dc1df[_0x4908('0x57')]));}else{_0x4dc1df['recordingURL']='';}return getConnection(_0x380066)['then'](function(_0x4074cf){_0x8d1768=_0x4074cf;return getUser(_0x380066,_0xf57ffc[_0x4908('0xc')],_0x8d1768);})[_0x4908('0x28')](function(_0x532a01){_0x21fa9d=_0x532a01;logger[_0x4908('0xa')](_0x4908('0x58'),_0x21fa9d['id']);return getEndUser(_0x380066,_0x4dc1df['calleridname'],_0x4dc1df[_0x4908('0x59')],_0x8d1768);})[_0x4908('0x28')](function(_0x2cd271){_0x47f00d=_0x2cd271;logger['info']('The\x20Enduser\x20ID\x20is:',_0x47f00d['id']);return getTicket(_0x380066,_0x21fa9d,_0x47f00d,_0x2c32c4,_0x4dc1df,_0x2c32c4['Fields'],_0x8d1768);})[_0x4908('0x28')](function(_0x26da29){_0x5597e4=_0x26da29;logger[_0x4908('0xa')]('Ticket\x20created!');logger[_0x4908('0xa')]('The\x20Ticket\x20ID\x20is:',_0x5597e4['id']);return setRelationship(_0x8d1768,_0x21fa9d,_0x5597e4,_0x4908('0x6a'));})[_0x4908('0x28')](function(){return setRelationship(_0x8d1768,_0x47f00d,_0x5597e4,_0x4908('0x6b'));})[_0x4908('0x28')](function(){return getServerInfo(_0x8d1768);})[_0x4908('0x63')](function(_0x4b2605){logger[_0x4908('0x6c')](_0x4908('0x6d'),JSON[_0x4908('0x20')](_0x4b2605));});}; \ No newline at end of file +var _0x8602=['version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridnum','charAt','catch','abandoned','uri','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Fields','[ABANDONED]','request-promise','bluebird','md5','util','./util','../../../../config/logger','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','slice','duration_hours','parent_id','Contacts','length','forEach','variableName','push','JSON','Calls','format','Basic\x20%s','apiKey','toString','base64','stringify','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','find','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','customVariable','Variable','login','username','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','stripTrailingSlash','remoteUri','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x8602,0x7f));var _0x2860=function(_0x132d12,_0x2c9799){_0x132d12=_0x132d12-0x0;var _0x1c3163=_0x8602[_0x132d12];return _0x1c3163;};'use strict';var _=require('lodash');var rp=require(_0x2860('0x0'));var BPromise=require(_0x2860('0x1'));var md5=require(_0x2860('0x2'));var util=require(_0x2860('0x3'));var intUtil=require(_0x2860('0x4'));var logger=require(_0x2860('0x5'))('sugarcrm');var io=require(_0x2860('0x6'))({'host':'localhost','port':0x18eb});var def={'method':_0x2860('0x7'),'json':!![]};function emit(_0x5801ff,_0x628e5b,_0x34c1e8){io['to'](_0x5801ff)[_0x2860('0x8')](_0x628e5b,_0x34c1e8);}function getTicket(_0x3c583f,_0x285b3e,_0x2c404e,_0xae09bb,_0x3d6171,_0x12a2cf,_0x45c89b){logger[_0x2860('0x9')](_0x2860('0xa'));var _0x180441=new Date();var _0x11fcde=[{'name':_0x2860('0xb'),'value':intUtil[_0x2860('0xc')](_0xae09bb[_0x2860('0xd')],_0x3d6171,'\x20')},{'name':_0x2860('0xe'),'value':_0x285b3e['id']},{'name':_0x2860('0xf'),'value':_0x285b3e['id']},{'name':_0x2860('0x10'),'value':intUtil['getString'](_0xae09bb['Descriptions'],_0x3d6171,'\x0a')},{'name':_0x2860('0x11'),'value':_0x180441['toISOString']()[_0x2860('0x12')](0x0,0x13)['replace']('T','\x20')},{'name':_0x2860('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x2860('0x14'),'value':_0x2c404e['id']},{'name':'parent_type','value':_0x2860('0x15')},{'name':'parent_name','value':_0x2c404e[_0x2860('0xb')]}];if(_0x12a2cf[_0x2860('0x16')]){_[_0x2860('0x17')](_0x12a2cf,function(_0x5ce5cf){if(_0x3d6171[_0x5ce5cf[_0x2860('0x18')]]){_0x11fcde[_0x2860('0x19')]({'name':_0x5ce5cf['idField'],'value':_0x3d6171[_0x5ce5cf['variableName']]});}});}return request({'form':{'method':'set_entry','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON['stringify']({'session':_0x45c89b['id'],'module_name':_0x2860('0x1b'),'name_value_list':_0x11fcde})}});}function getAuth(_0x332d6d){return util[_0x2860('0x1c')](_0x2860('0x1d'),new Buffer(_0x332d6d[_0x2860('0x1e')]+':X')[_0x2860('0x1f')](_0x2860('0x20')));}function getServerInfo(_0x35d25a){return request({'form':{'method':'get_server_info','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x35d25a['id']})}});}function getUser(_0x3f048e,_0x17b603,_0x16027c){logger[_0x2860('0x9')]('Getting\x20agent\x20with\x20name',_0x17b603);return request({'form':{'method':_0x2860('0x22'),'input_type':'JSON','response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x16027c['id'],'module_name':_0x2860('0x23'),'query':util['format'](_0x2860('0x24'),_0x17b603),'order_by':'','offset':'0','select_fields':['id','name',_0x2860('0x25')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2860('0x26')](function(_0x37d060){if(_0x37d060[_0x2860('0x27')][_0x2860('0x16')]){var _0x54d31a=_[_0x2860('0x28')](_0x37d060[_0x2860('0x27')],function(_0x3663a7){return _0x3663a7['name_value_list'][_0x2860('0x25')][_0x2860('0x29')]===_0x17b603;});if(_0x54d31a){logger[_0x2860('0x9')](_0x2860('0x2a'));return BPromise[_0x2860('0x2b')]({'id':_0x54d31a[_0x2860('0x2c')]['id'][_0x2860('0x29')],'name':_0x54d31a['name_value_list'][_0x2860('0xb')][_0x2860('0x29')]});}}else{logger[_0x2860('0x9')](_0x2860('0x2d'));return BPromise['resolve']({'id':_0x16027c[_0x2860('0x2c')][_0x2860('0x2e')]['id'],'name':_0x16027c['name_value_list'][_0x2860('0x25')]['id']});}});}function getEndUser(_0x51621f,_0xf32d1c,_0x318a0f,_0x4f0d1c){logger[_0x2860('0x9')](_0x2860('0x2f'),_0x318a0f);return request({'form':{'method':_0x2860('0x22'),'input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x4f0d1c['id'],'module_name':_0x2860('0x15'),'query':util[_0x2860('0x1c')](_0x2860('0x30'),_0x318a0f),'order_by':'','offset':'0','select_fields':['id',_0x2860('0xb'),_0x2860('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x2860('0x26')](function(_0x3bc23c){if(_0x3bc23c[_0x2860('0x27')][_0x2860('0x16')]){var _0x1ccc07=_[_0x2860('0x28')](_0x3bc23c[_0x2860('0x27')],function(_0x468426){return _0x468426[_0x2860('0x2c')]['phone_home'][_0x2860('0x29')]===_0x318a0f;});if(_0x1ccc07){logger[_0x2860('0x9')](_0x2860('0x32'));return BPromise[_0x2860('0x2b')]({'id':_0x1ccc07[_0x2860('0x2c')]['id'][_0x2860('0x29')],'name':_0x1ccc07[_0x2860('0x2c')][_0x2860('0xb')][_0x2860('0x29')],'phone':_0x1ccc07[_0x2860('0x2c')][_0x2860('0x31')][_0x2860('0x29')]});}}else{logger[_0x2860('0x9')](_0x2860('0x33'));return request({'form':{'method':'set_entry','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x4f0d1c['id'],'module_name':'Contacts','name_value_list':[{'name':'first_name','value':_0xf32d1c!==''?_0xf32d1c:util[_0x2860('0x1c')](_0x2860('0x34'),_0x318a0f)},{'name':_0x2860('0x31'),'value':_0x318a0f}]})}})[_0x2860('0x26')](function(_0x282676){logger[_0x2860('0x9')](_0x2860('0x35'));return BPromise[_0x2860('0x2b')]({'id':_0x282676['id'],'name':_0x282676['entry_list'][_0x2860('0x36')][_0x2860('0x29')],'phone':_0x282676[_0x2860('0x27')]['phone_home'][_0x2860('0x29')]});});}});}function request(_0x14dbdc){logger[_0x2860('0x37')](_0x2860('0x38'),JSON[_0x2860('0x21')](_0x14dbdc));return rp(_[_0x2860('0x39')](def,_0x14dbdc));}function getTags(_0x4b0a7d,_0xde7270){var _0x40a116=[];if(_0x4b0a7d&&_0x4b0a7d[_0x2860('0x16')]>0x0){_0x40a116=_[_0x2860('0x3a')](_0x4b0a7d,_0xde7270);}return _0x40a116;}function getCustomFields(_0x5281f2,_0x27ba16){var _0x3aa5e7=[];var _0xadb53f={'custom_fields':[]};if(_0x5281f2[_0x2860('0x16')]>0x0){_['forEach'](_0x5281f2,function(_0x22dc56){if(_0x22dc56[_0x2860('0x3b')]==='string'&&_0x22dc56[_0x2860('0x3c')]&&!_0x22dc56[_0x2860('0x3d')]){_0xadb53f[_0x22dc56[_0x2860('0x3c')][_0x2860('0x3e')]()]=_0x22dc56[_0x2860('0x3f')][_0x2860('0x1f')]();}else if(_0x22dc56['type']===_0x2860('0x40')&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56['customField']){_0xadb53f[_0x2860('0x42')]['push']({'id':_0x22dc56[_0x2860('0x41')],'value':_0x22dc56[_0x2860('0x3f')][_0x2860('0x1f')]()});}else if(_0x22dc56[_0x2860('0x3b')]===_0x2860('0x43')&&_0x22dc56[_0x2860('0x18')]&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56[_0x2860('0x3d')]){_0x27ba16[_0x22dc56[_0x2860('0x18')]]&&_0xadb53f[_0x2860('0x42')][_0x2860('0x19')]({'id':_0x22dc56[_0x2860('0x41')],'value':_0x27ba16[_0x22dc56[_0x2860('0x18')]][_0x2860('0x1f')]()});}else if(_0x22dc56[_0x2860('0x3b')]===_0x2860('0x44')&&_0x22dc56[_0x2860('0x45')]&&_0x22dc56[_0x2860('0x45')]['name']&&_0x22dc56[_0x2860('0x41')]&&_0x22dc56[_0x2860('0x3d')]){_0x27ba16[_0x22dc56[_0x2860('0x45')][_0x2860('0xb')][_0x2860('0x3e')]()]&&_0xadb53f[_0x2860('0x42')][_0x2860('0x19')]({'id':_0x22dc56[_0x2860('0x41')],'value':_0x27ba16[_0x22dc56[_0x2860('0x45')]['name']['toLowerCase']()][_0x2860('0x1f')]()});}});}return _0xadb53f;}function getConnection(_0x48651e){return request({'method':_0x2860('0x7'),'form':{'method':_0x2860('0x46'),'input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'user_auth':{'user_name':_0x48651e[_0x2860('0x47')],'password':_0x48651e['password'],'encryption':_0x2860('0x48')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x2860('0x26')](function(_0x206c43){var _0x3397f2=_0x206c43;if(_0x3397f2['id']){def[_0x2860('0x49')]=_0x3397f2['id'];return BPromise[_0x2860('0x2b')](_0x3397f2);}else{throw new Error(util[_0x2860('0x1c')](_0x2860('0x4a'),_0x48651e['id']));}});}function setRelationship(_0x53bd07,_0x8c1585,_0x1cf59d,_0x1a59ab){return request({'form':{'method':'set_relationship','input_type':_0x2860('0x1a'),'response_type':_0x2860('0x1a'),'rest_data':JSON[_0x2860('0x21')]({'session':_0x53bd07['id'],'module_name':_0x2860('0x1b'),'module_id':_0x1cf59d['id'],'link_field_name':_0x1a59ab,'related_ids':[_0x8c1585['id']]})}});}exports['queue']=function(_0x3a24d6,_0x3483f3,_0x3e1d06,_0xd2e6d1,_0x23a839,_0x581e53){var _0x3322d3,_0x1b5fb8,_0x4f3ba1,_0x473cff;_0x581e53['remoteUri']=intUtil[_0x2860('0x4b')](_0x581e53[_0x2860('0x4c')]);_0x581e53[_0x2860('0x4d')]=intUtil[_0x2860('0x4b')](_0x581e53[_0x2860('0x4d')]);def['uri']=util[_0x2860('0x1c')]('%s/service/v4_1/rest.php',_0x581e53[_0x2860('0x4c')]);if(_0x23a839&&_0x23a839[_0x2860('0x4e')]){logger[_0x2860('0x9')]('[QUEUE]',_0x2860('0x4f'));_0x3483f3[_0x2860('0x50')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x581e53[_0x2860('0x4d')],_0x3483f3[_0x2860('0x51')],md5(_0x3483f3[_0x2860('0x51')]));}else{_0x3483f3[_0x2860('0x50')]='';}return getConnection(_0x581e53)[_0x2860('0x26')](function(_0x446024){_0x473cff=_0x446024;return getUser(_0x581e53,_0xd2e6d1[_0x2860('0xb')],_0x473cff);})[_0x2860('0x26')](function(_0x497cf6){_0x3322d3=_0x497cf6;logger['info'](_0x2860('0x52'),_0x3322d3['id']);return getEndUser(_0x581e53,_0x3483f3[_0x2860('0x53')],_0x3483f3[_0x2860('0x54')],_0x473cff);})[_0x2860('0x26')](function(_0x55d795){_0x1b5fb8=_0x55d795;logger[_0x2860('0x9')](_0x2860('0x55'),_0x1b5fb8['id']);return getTicket(_0x581e53,_0x3322d3,_0x1b5fb8,_0x3e1d06,_0x3483f3,_0x3e1d06['Fields'],_0x473cff);})['then'](function(_0x4233f4){_0x4f3ba1=_0x4233f4;logger[_0x2860('0x9')](_0x2860('0x56'));logger[_0x2860('0x9')](_0x2860('0x57'),_0x4f3ba1['id']);return setRelationship(_0x473cff,_0x3322d3,_0x4f3ba1,'users');})['then'](function(){return setRelationship(_0x473cff,_0x1b5fb8,_0x4f3ba1,_0x2860('0x58'));})[_0x2860('0x26')](function(){return getServerInfo(_0x473cff);})[_0x2860('0x26')](function(_0x2985f5){var _0x3e0f8f=parseInt(_0x2985f5[_0x2860('0x59')]['charAt'](0x0));var _0x5cc565=util[_0x2860('0x1c')](_0x2860('0x5a'),_0x581e53[_0x2860('0x4c')],_0x4f3ba1['id']);if(_0x3e0f8f>0x6){_0x5cc565=util[_0x2860('0x1c')](_0x2860('0x5b'),_0x581e53[_0x2860('0x4c')],_0x4f3ba1['id']);}logger[_0x2860('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x2860('0x5c'),_0xd2e6d1[_0x2860('0xb')]),_0x2860('0x5d'),{'uri':_0x5cc565});})['catch'](function(_0xab9091){logger[_0x2860('0x5e')](_0x2860('0x5f'),JSON['stringify'](_0xab9091));});};exports[_0x2860('0x60')]=function(_0x2a1fbd,_0x1c9318,_0x137865,_0xfca593,_0x29e498,_0x1adb5d,_0x326cd9){var _0x50f57a,_0x3d8688,_0x1d6bd7,_0x310ffa;_0x1adb5d[_0x2860('0x4c')]=intUtil[_0x2860('0x4b')](_0x1adb5d[_0x2860('0x4c')]);_0x1adb5d[_0x2860('0x4d')]=intUtil[_0x2860('0x4b')](_0x1adb5d['serverUrl']);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x1adb5d[_0x2860('0x4c')]);if(_0x326cd9&&_0x326cd9[_0x2860('0x61')]&&_0x326cd9[_0x2860('0x61')]!==_0x2860('0x62')){logger[_0x2860('0x9')](_0x2860('0x63'),'Recording\x20is\x20enabled!');_0x1c9318[_0x2860('0x50')]=util[_0x2860('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1adb5d['serverUrl'],_0x1c9318[_0x2860('0x51')],md5(_0x1c9318['uniqueid']));}return getConnection(_0x1adb5d)[_0x2860('0x26')](function(_0x233d11){_0x310ffa=_0x233d11;return getUser(_0x1adb5d,_0xfca593[_0x2860('0xb')],_0x310ffa);})[_0x2860('0x26')](function(_0x19a1e5){_0x50f57a=_0x19a1e5;logger['info'](_0x2860('0x52'),_0x50f57a['id']);return getEndUser(_0x1adb5d,_0x1c9318['destcalleridname'],_0x1c9318[_0x2860('0x64')],_0x310ffa);})['then'](function(_0x4b93bf){_0x3d8688=_0x4b93bf;logger[_0x2860('0x9')]('The\x20Enduser\x20ID\x20is:',_0x3d8688['id']);return getTicket(_0x1adb5d,_0x50f57a,_0x3d8688,_0x137865,_0x1c9318,_0x137865['Fields'],_0x310ffa);})[_0x2860('0x26')](function(_0x2386f8){_0x1d6bd7=_0x2386f8;logger[_0x2860('0x9')]('Ticket\x20created!');logger[_0x2860('0x9')](_0x2860('0x57'),_0x1d6bd7['id']);return setRelationship(_0x310ffa,_0x50f57a,_0x1d6bd7,'users');})[_0x2860('0x26')](function(){return setRelationship(_0x310ffa,_0x3d8688,_0x1d6bd7,_0x2860('0x58'));})['then'](function(){return getServerInfo(_0x310ffa);})['then'](function(_0x12d6d4){var _0x3fd6b0=parseInt(_0x12d6d4[_0x2860('0x59')][_0x2860('0x65')](0x0));var _0x3aed1c=util[_0x2860('0x1c')](_0x2860('0x5a'),_0x1adb5d[_0x2860('0x4c')],_0x1d6bd7['id']);if(_0x3fd6b0>0x6){_0x3aed1c=util[_0x2860('0x1c')](_0x2860('0x5b'),_0x1adb5d['remoteUri'],_0x1d6bd7['id']);}logger[_0x2860('0x9')](_0x2860('0x63'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2860('0x1c')]('user:%s',_0xfca593['name']),_0x2860('0x5d'),{'uri':_0x3aed1c});})[_0x2860('0x66')](function(_0x20ce49){logger[_0x2860('0x5e')]('[OUTBOUND]',JSON[_0x2860('0x21')](_0x20ce49));});};exports[_0x2860('0x67')]=function(_0x58a5e9,_0x59fcb7,_0x4c34ab,_0x1cd685,_0x20bf3d,_0x470f4c){var _0x554bce,_0x254aa5,_0x51e5ed,_0x573b95;_0x470f4c[_0x2860('0x4c')]=intUtil[_0x2860('0x4b')](_0x470f4c[_0x2860('0x4c')]);_0x470f4c['serverUrl']=intUtil[_0x2860('0x4b')](_0x470f4c[_0x2860('0x4d')]);def[_0x2860('0x68')]=util[_0x2860('0x1c')]('%s/service/v4_1/rest.php',_0x470f4c[_0x2860('0x4c')]);if(_0x20bf3d&&_0x20bf3d['monitor_format']){logger[_0x2860('0x9')]('[ABANDONED]',_0x2860('0x4f'));_0x59fcb7['recordingURL']=util['format'](_0x2860('0x69'),_0x470f4c['serverUrl'],_0x59fcb7[_0x2860('0x51')],md5(_0x59fcb7[_0x2860('0x51')]));}else{_0x59fcb7[_0x2860('0x50')]='';}return getConnection(_0x470f4c)[_0x2860('0x26')](function(_0x261d18){_0x573b95=_0x261d18;return getUser(_0x470f4c,_0x1cd685[_0x2860('0xb')],_0x573b95);})[_0x2860('0x26')](function(_0x1f362c){_0x554bce=_0x1f362c;logger['info'](_0x2860('0x52'),_0x554bce['id']);return getEndUser(_0x470f4c,_0x59fcb7[_0x2860('0x53')],_0x59fcb7[_0x2860('0x54')],_0x573b95);})['then'](function(_0x528bfe){_0x254aa5=_0x528bfe;logger[_0x2860('0x9')](_0x2860('0x55'),_0x254aa5['id']);return getTicket(_0x470f4c,_0x554bce,_0x254aa5,_0x4c34ab,_0x59fcb7,_0x4c34ab[_0x2860('0x6a')],_0x573b95);})[_0x2860('0x26')](function(_0x5b3296){_0x51e5ed=_0x5b3296;logger['info'](_0x2860('0x56'));logger[_0x2860('0x9')](_0x2860('0x57'),_0x51e5ed['id']);return setRelationship(_0x573b95,_0x554bce,_0x51e5ed,'users');})[_0x2860('0x26')](function(){return setRelationship(_0x573b95,_0x254aa5,_0x51e5ed,_0x2860('0x58'));})['then'](function(){return getServerInfo(_0x573b95);})['catch'](function(_0x361aef){logger['error'](_0x2860('0x6b'),JSON['stringify'](_0x361aef));});}; \ 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 e472d9d..8e3957e 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 _0x7359=['content','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','substr','util','sortBy','length','type','string','push'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x7359,0x1c6));var _0x9735=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7359[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require(_0x9735('0x0'));exports['getString']=function(_0x5f5be5,_0x14b222,_0x5aba0e){var _0x1191e0=[];if(_0x5f5be5['length']>0x0){var _0xf3cf83=_[_0x9735('0x1')](_0x5f5be5,['id']);for(var _0x2e8989=0x0;_0x2e8989<_0xf3cf83[_0x9735('0x2')];_0x2e8989++){var _0x52752f=_0xf3cf83[_0x2e8989];if(_0x52752f[_0x9735('0x3')]===_0x9735('0x4')){_0x1191e0[_0x9735('0x5')](_0x52752f[_0x9735('0x6')]);}else if(_0x52752f[_0x9735('0x3')]==='variable'&&_0x52752f[_0x9735('0x7')]){_0x14b222[_0x52752f[_0x9735('0x7')]]&&_0x1191e0[_0x9735('0x5')](_0x14b222[_0x52752f[_0x9735('0x7')]][_0x9735('0x8')]());}else if(_0x52752f[_0x9735('0x3')]==='customVariable'&&_0x52752f[_0x9735('0x9')]&&_0x52752f[_0x9735('0x9')]['name']){_0x14b222[_0x52752f[_0x9735('0x9')][_0x9735('0xa')][_0x9735('0xb')]()]&&_0x1191e0[_0x9735('0x5')](_0x14b222[_0x52752f[_0x9735('0x9')][_0x9735('0xa')]['toLowerCase']()][_0x9735('0x8')]());}else if(_0x52752f[_0x9735('0x3')]===_0x9735('0xc')){if(_0x52752f[_0x9735('0xd')]===_0x9735('0x4')&&_0x52752f[_0x9735('0xe')]){_0x1191e0['push'](util[_0x9735('0xf')](_0x9735('0x10'),_0x52752f['key'],_0x52752f[_0x9735('0x11')]));}else if(_0x52752f[_0x9735('0xd')]===_0x9735('0x12')&&_0x52752f[_0x9735('0x7')]&&_0x52752f[_0x9735('0xe')]){_0x14b222[_0x52752f['variableName']]&&_0x1191e0[_0x9735('0x5')](util[_0x9735('0xf')](_0x9735('0x10'),_0x52752f[_0x9735('0xe')],_0x14b222[_0x52752f[_0x9735('0x7')]]));}else if(_0x52752f[_0x9735('0xd')]===_0x9735('0x13')&&_0x52752f[_0x9735('0x9')]&&_0x52752f['Variable'][_0x9735('0xa')]&&_0x52752f[_0x9735('0xe')]){_0x14b222[_0x52752f['Variable'][_0x9735('0xa')]['toLowerCase']()]&&_0x1191e0['push'](util[_0x9735('0xf')](_0x9735('0x10'),_0x52752f[_0x9735('0xe')],_0x14b222[_0x52752f[_0x9735('0x9')][_0x9735('0xa')][_0x9735('0xb')]()]));}}}}return _0x1191e0[_0x9735('0x14')](_0x5aba0e);};exports[_0x9735('0x15')]=function(_0x35e0f6){if(_0x35e0f6&&_0x35e0f6[_0x9735('0x16')](-0x1)==='/'){return _0x35e0f6['substr'](0x0,_0x35e0f6[_0x9735('0x2')]-0x1);}return _0x35e0f6;}; \ No newline at end of file +var _0xa808=['getString','length','string','push','content','type','variableName','toString','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable','join','stripTrailingSlash','substr','util'];(function(_0x500a5f,_0x4faed2){var _0x27b165=function(_0x214bfc){while(--_0x214bfc){_0x500a5f['push'](_0x500a5f['shift']());}};_0x27b165(++_0x4faed2);}(_0xa808,0x68));var _0x8a80=function(_0x11c4b2,_0x376cde){_0x11c4b2=_0x11c4b2-0x0;var _0x412959=_0xa808[_0x11c4b2];return _0x412959;};'use strict';var _=require('lodash');var util=require(_0x8a80('0x0'));exports[_0x8a80('0x1')]=function(_0x1a8deb,_0x50bf2a,_0x2a6926){var _0x478301=[];if(_0x1a8deb[_0x8a80('0x2')]>0x0){var _0x41ab6c=_['sortBy'](_0x1a8deb,['id']);for(var _0x23ff1d=0x0;_0x23ff1d<_0x41ab6c[_0x8a80('0x2')];_0x23ff1d++){var _0x3c9372=_0x41ab6c[_0x23ff1d];if(_0x3c9372['type']===_0x8a80('0x3')){_0x478301[_0x8a80('0x4')](_0x3c9372[_0x8a80('0x5')]);}else if(_0x3c9372[_0x8a80('0x6')]==='variable'&&_0x3c9372[_0x8a80('0x7')]){_0x50bf2a[_0x3c9372[_0x8a80('0x7')]]&&_0x478301[_0x8a80('0x4')](_0x50bf2a[_0x3c9372[_0x8a80('0x7')]][_0x8a80('0x8')]());}else if(_0x3c9372[_0x8a80('0x6')]==='customVariable'&&_0x3c9372[_0x8a80('0x9')]&&_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')]){_0x50bf2a[_0x3c9372['Variable']['name'][_0x8a80('0xb')]()]&&_0x478301[_0x8a80('0x4')](_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()][_0x8a80('0x8')]());}else if(_0x3c9372['type']==='keyValue'){if(_0x3c9372[_0x8a80('0xc')]===_0x8a80('0x3')&&_0x3c9372[_0x8a80('0xd')]){_0x478301['push'](util[_0x8a80('0xe')](_0x8a80('0xf'),_0x3c9372[_0x8a80('0xd')],_0x3c9372[_0x8a80('0x10')]));}else if(_0x3c9372['keyType']===_0x8a80('0x11')&&_0x3c9372[_0x8a80('0x7')]&&_0x3c9372['key']){_0x50bf2a[_0x3c9372['variableName']]&&_0x478301[_0x8a80('0x4')](util[_0x8a80('0xe')](_0x8a80('0xf'),_0x3c9372['key'],_0x50bf2a[_0x3c9372[_0x8a80('0x7')]]));}else if(_0x3c9372['keyType']==='customVariable'&&_0x3c9372['Variable']&&_0x3c9372[_0x8a80('0x9')]['name']&&_0x3c9372[_0x8a80('0xd')]){_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()]&&_0x478301[_0x8a80('0x4')](util['format']('%s:\x20%s',_0x3c9372['key'],_0x50bf2a[_0x3c9372[_0x8a80('0x9')][_0x8a80('0xa')][_0x8a80('0xb')]()]));}}}}return _0x478301[_0x8a80('0x12')](_0x2a6926);};exports[_0x8a80('0x13')]=function(_0x4bfbef){if(_0x4bfbef&&_0x4bfbef[_0x8a80('0x14')](-0x1)==='/'){return _0x4bfbef[_0x8a80('0x14')](0x0,_0x4bfbef[_0x8a80('0x2')]-0x1);}return _0x4bfbef;}; \ 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 08fbe58..820d9d2 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 _0x209a=['email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Fields','abandoned','[ABANDONED]','lodash','request-promise','md5','util','./util','vTiger','socket.io-emitter','length','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','info','Creating\x20new\x20ticket...','Normal','Open','getString','Subjects','Descriptions','POST','format','%s/webservice.php','create','admin','sessionName','stringify','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','query','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','remoteUri','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','then','success','result','Agent\x20found!','email1','first_name','userId','username','getUser','Searching\x20end\x20user\x20with\x20phone','Contacts','Enduser\x20created.','lastname','phone','test','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','uniqueid'];(function(_0x4dedff,_0x4df266){var _0x35628e=function(_0x2f7f42){while(--_0x2f7f42){_0x4dedff['push'](_0x4dedff['shift']());}};_0x35628e(++_0x4df266);}(_0x209a,0x1da));var _0xa209=function(_0x4fbf9b,_0x38f608){_0x4fbf9b=_0x4fbf9b-0x0;var _0x2a059b=_0x209a[_0x4fbf9b];return _0x2a059b;};'use strict';var _=require(_0xa209('0x0'));var rp=require(_0xa209('0x1'));var BPromise=require('bluebird');var md5=require(_0xa209('0x2'));var util=require(_0xa209('0x3'));var intUtil=require(_0xa209('0x4'));var logger=require('../../../../config/logger')(_0xa209('0x5'));var io=require(_0xa209('0x6'))({'host':'localhost','port':0x18eb});function emit(_0x4346cf,_0x168eca,_0x3cbe62){io['to'](_0x4346cf)['emit'](_0x168eca,_0x3cbe62);}function getCustomFields(_0x1c9122,_0x33e574){var _0xaf6f69={};if(_0x1c9122[_0xa209('0x7')]>0x0){_[_0xa209('0x8')](_0x1c9122,function(_0x2b3c76){if(_0x2b3c76[_0xa209('0x9')]===_0xa209('0xa')&&_0x2b3c76[_0xa209('0xb')]){_0xaf6f69[_0x2b3c76['idField']]=_0x2b3c76[_0xa209('0xc')][_0xa209('0xd')]();}else if(_0x2b3c76[_0xa209('0x9')]==='variable'&&_0x2b3c76[_0xa209('0xe')]&&_0x2b3c76[_0xa209('0xb')]&&_0x33e574[_0x2b3c76[_0xa209('0xe')]]){_0xaf6f69[_0x2b3c76['idField']]=_0x33e574[_0x2b3c76[_0xa209('0xe')]]['toString']();}else if(_0x2b3c76[_0xa209('0x9')]===_0xa209('0xf')&&_0x2b3c76['Variable']&&_0x2b3c76[_0xa209('0x10')][_0xa209('0x11')]&&_0x2b3c76[_0xa209('0xb')]&&_0x33e574[_0x2b3c76[_0xa209('0x10')][_0xa209('0x11')]['toLowerCase']()]){_0xaf6f69[_0x2b3c76['idField']]=_0x33e574[_0x2b3c76[_0xa209('0x10')]['name']['toLowerCase']()][_0xa209('0xd')]();}});}return _0xaf6f69;}function createTicket(_0x3b345b,_0xcbef7d,_0x1cfb6c,_0x3bf7dc,_0x1c3936,_0x1c9ea0,_0x3ddf89){logger[_0xa209('0x12')](_0xa209('0x13'));var _0x54eed4=_['merge']({'parent_id':'','assigned_user_id':_0xcbef7d['id'],'ticketpriorities':_0xa209('0x14'),'ticketstatus':_0xa209('0x15'),'ticket_title':intUtil[_0xa209('0x16')](_0x3bf7dc[_0xa209('0x17')],_0x1c3936,'\x20'),'description':intUtil[_0xa209('0x16')](_0x3bf7dc[_0xa209('0x18')],_0x1c3936,'\x0a'),'contact_id':_0x1cfb6c['id']},getCustomFields(_0x1c9ea0,_0x1c3936));var _0x590cbb={'method':_0xa209('0x19'),'uri':util[_0xa209('0x1a')](_0xa209('0x1b'),_0x3b345b['remoteUri']),'form':{'operation':_0xa209('0x1c'),'username':_0xa209('0x1d'),'sessionName':_0x3ddf89[_0xa209('0x1e')],'elementType':'HelpDesk','element':JSON[_0xa209('0x1f')](_0x54eed4)},'json':!![]};return request(_0x590cbb)['then'](function(_0x2a961a){if(_0x2a961a['success']){return BPromise[_0xa209('0x20')]({'id':_0x2a961a['result']['id']});}else{throw new Error(util['format'](_0xa209('0x21'),JSON[_0xa209('0x1f')](_0x2a961a['error'])));}})[_0xa209('0x22')](function(_0x37d287){var _0x29820e=req[_0xa209('0x23')]['test']?0x1f4:_0x37d287[_0xa209('0x24')]||0x1f4;logger[_0xa209('0x25')](_0xa209('0x26'),'createTicket',_0x29820e,JSON[_0xa209('0x1f')](_0x37d287));});}function getUser(_0x14cff1,_0x56dd3f,_0x393e73){logger['info'](_0xa209('0x27'),_0x56dd3f);return request({'method':_0xa209('0x28'),'uri':util['format'](_0xa209('0x1b'),_0x14cff1[_0xa209('0x29')]),'qs':{'operation':_0xa209('0x23'),'username':_0xa209('0x1d'),'sessionName':_0x393e73[_0xa209('0x1e')],'query':util[_0xa209('0x1a')](_0xa209('0x2a'),_0x56dd3f)},'json':!![]})[_0xa209('0x2b')](function(_0x4a02c6){if(_0x4a02c6[_0xa209('0x2c')]&&_0x4a02c6[_0xa209('0x2d')]['length']){logger['info'](_0xa209('0x2e'));return BPromise['resolve']({'id':_0x4a02c6[_0xa209('0x2d')][0x0]['id'],'email':_0x4a02c6['result'][0x0][_0xa209('0x2f')],'name':_0x4a02c6[_0xa209('0x2d')][0x0][_0xa209('0x30')]+'\x20'+_0x4a02c6[_0xa209('0x2d')]['last_name']});}else{logger[_0xa209('0x12')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xa209('0x20')]({'id':_0x393e73[_0xa209('0x31')],'email':_0x14cff1[_0xa209('0x32')],'name':_0xa209('0x1d')});}})[_0xa209('0x22')](function(_0x350ea9){var _0x59207f=req[_0xa209('0x23')]['test']?0x1f4:_0x350ea9[_0xa209('0x24')]||0x1f4;logger[_0xa209('0x25')](_0xa209('0x26'),_0xa209('0x33'),_0x59207f,JSON['stringify'](_0x350ea9));});}function getEndUser(_0x22ccaf,_0x37b402,_0x211c54,_0x2e55aa){logger['info'](_0xa209('0x34'),_0x211c54);return request({'method':'GET','uri':util[_0xa209('0x1a')](_0xa209('0x1b'),_0x22ccaf[_0xa209('0x29')]),'qs':{'operation':_0xa209('0x23'),'username':_0xa209('0x1d'),'sessionName':_0x2e55aa['sessionName'],'query':util['format']('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;',_0x211c54,_0x211c54,_0x211c54,_0x211c54,_0x211c54)},'json':!![]})[_0xa209('0x2b')](function(_0x295fdc){if(_0x295fdc['success']&&_0x295fdc[_0xa209('0x2d')]['length']){logger[_0xa209('0x12')]('Enduser\x20found!');return BPromise[_0xa209('0x20')]({'id':_0x295fdc['result'][0x0]['id'],'name':_0x295fdc['result'][0x0]['firstname']+'\x20'+_0x295fdc[_0xa209('0x2d')][0x0]['lastname'],'phone':_0x211c54});}else{logger[_0xa209('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0xa209('0x1b'),_0x22ccaf[_0xa209('0x29')]),'form':{'operation':_0xa209('0x1c'),'sessionName':_0x2e55aa[_0xa209('0x1e')],'elementType':_0xa209('0x35'),'element':JSON[_0xa209('0x1f')]({'lastname':_0x37b402,'phone':_0x211c54,'assigned_user_id':'\x20'})},'json':!![]})[_0xa209('0x2b')](function(_0x4aa207){logger[_0xa209('0x12')](_0xa209('0x36'));return BPromise['resolve']({'id':_0x4aa207[_0xa209('0x2d')]['id'],'name':_0x4aa207[_0xa209('0x2d')][_0xa209('0x37')],'phone':_0x4aa207['result'][_0xa209('0x38')]});})[_0xa209('0x22')](function(_0x5cc08c){var _0x229729=req['query'][_0xa209('0x39')]?0x1f4:_0x5cc08c[_0xa209('0x24')]||0x1f4;logger[_0xa209('0x25')]('[vTiger],\x20%s,\x20%s,\x20%s',_0xa209('0x3a'),_0x229729,JSON[_0xa209('0x1f')](_0x5cc08c));});}});}function getConnection(_0x18dc54){var _0x3a762e=_0x18dc54[_0xa209('0x32')];var _0x263e14=_0x18dc54[_0xa209('0x3b')];return request({'method':_0xa209('0x28'),'uri':util[_0xa209('0x1a')]('%s/webservice.php',_0x18dc54[_0xa209('0x29')]),'qs':{'operation':_0xa209('0x3c'),'username':_0x3a762e},'json':!![]})[_0xa209('0x2b')](function(_0x5f50c4){if(_0x5f50c4[_0xa209('0x2c')]){return request({'method':_0xa209('0x19'),'uri':util['format']('%s/webservice.php',_0x18dc54[_0xa209('0x29')]),'form':{'operation':_0xa209('0x3d'),'username':'admin','accessKey':md5(_0x5f50c4['result'][_0xa209('0x3e')]+_0x263e14)},'json':!![]});}})[_0xa209('0x2b')](function(_0x2daaf9){if(_0x2daaf9[_0xa209('0x2c')]){return BPromise['resolve'](_0x2daaf9['result']);}else{throw new Error(util[_0xa209('0x1a')](_0xa209('0x3f'),_0x18dc54['id']));}})[_0xa209('0x22')](function(_0x33824f){var _0x1f679d=req[_0xa209('0x23')][_0xa209('0x39')]?0x1f4:_0x33824f[_0xa209('0x24')]||0x1f4;logger[_0xa209('0x25')](_0xa209('0x26'),_0xa209('0x40'),_0x1f679d,JSON[_0xa209('0x1f')](_0x33824f));});}function request(_0x331a8){logger[_0xa209('0x12')](_0xa209('0x41'),JSON[_0xa209('0x1f')](_0x331a8));return rp(_0x331a8);}exports['queue']=function(_0x1244c4,_0x22e9b2,_0x224c29,_0x23bf6e,_0x117649,_0x566e04){var _0xb7e94f,_0xfd8c8,_0x4e1c07,_0x306dd3;_0x566e04[_0xa209('0x29')]=intUtil[_0xa209('0x42')](_0x566e04['remoteUri']);if(_0x117649&&_0x117649['monitor_format']){logger['info'](_0xa209('0x43'),_0xa209('0x44'));_0x22e9b2[_0xa209('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x566e04[_0xa209('0x46')],_0x22e9b2['uniqueid'],md5(_0x22e9b2[_0xa209('0x47')]));}else{_0x22e9b2[_0xa209('0x45')]='';}return getConnection(_0x566e04)[_0xa209('0x2b')](function(_0x4b1ee4){_0x306dd3=_0x4b1ee4;return getUser(_0x566e04,_0x23bf6e?_0x23bf6e[_0xa209('0x48')]:'',_0x306dd3);})[_0xa209('0x2b')](function(_0x1fd334){_0xb7e94f=_0x1fd334;logger['info'](_0xa209('0x49'),_0xb7e94f['id']);return getEndUser(_0x566e04,_0x22e9b2['calleridname'],_0x22e9b2[_0xa209('0x4a')],_0x306dd3);})['then'](function(_0x5c03ec){_0xfd8c8=_0x5c03ec;logger[_0xa209('0x12')](_0xa209('0x4b'),_0xfd8c8['id']);return createTicket(_0x566e04,_0xb7e94f,_0xfd8c8,_0x224c29,_0x22e9b2,_0x224c29['Fields'],_0x306dd3);})[_0xa209('0x2b')](function(_0x68eb53){_0x4e1c07=_0x68eb53;logger[_0xa209('0x12')](_0xa209('0x4c'));logger[_0xa209('0x12')](_0xa209('0x4d'),_0x4e1c07['id']);var _0x2d3238=util[_0xa209('0x1a')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x566e04[_0xa209('0x29')],_[_0xa209('0x4e')](_0x4e1c07['id'],'x')[0x1]);logger[_0xa209('0x12')](_0xa209('0x43'),_0xa209('0x4f'));emit(util[_0xa209('0x1a')](_0xa209('0x50'),_0x23bf6e['name']),_0xa209('0x51'),{'uri':_0x2d3238});})[_0xa209('0x22')](function(_0x5943b6){logger['error']('[QUEUE]',JSON['stringify'](_0x5943b6));});};exports[_0xa209('0x52')]=function(_0x64e0cd,_0x27c092,_0x143e91,_0x4d4079,_0x252f5b,_0x4cec9c,_0x3cd02a){var _0x3fd94b,_0x282ed3,_0x3c81a5,_0x699fb9;_0x4cec9c[_0xa209('0x29')]=intUtil[_0xa209('0x42')](_0x4cec9c[_0xa209('0x29')]);_0x4cec9c[_0xa209('0x46')]=intUtil['stripTrailingSlash'](_0x4cec9c[_0xa209('0x46')]);if(_0x3cd02a&&_0x3cd02a[_0xa209('0x53')]&&_0x3cd02a[_0xa209('0x53')]!==_0xa209('0x54')){logger[_0xa209('0x12')](_0xa209('0x55'),_0xa209('0x44'));_0x27c092['recordingURL']=util[_0xa209('0x1a')](_0xa209('0x56'),_0x4cec9c[_0xa209('0x46')],_0x27c092[_0xa209('0x47')],md5(_0x27c092['uniqueid']));}return getConnection(_0x4cec9c)[_0xa209('0x2b')](function(_0x3ae5be){_0x699fb9=_0x3ae5be;return getUser(_0x4cec9c,_0x4d4079?_0x4d4079[_0xa209('0x48')]:'',_0x699fb9);})[_0xa209('0x2b')](function(_0x5904bf){_0x3fd94b=_0x5904bf;logger[_0xa209('0x12')](_0xa209('0x49'),_0x3fd94b['id']);return getEndUser(_0x4cec9c,_0x27c092[_0xa209('0x57')],_0x27c092['destcalleridnum'],_0x699fb9);})[_0xa209('0x2b')](function(_0x337b7c){_0x282ed3=_0x337b7c;logger['info'](_0xa209('0x4b'),_0x282ed3['id']);return createTicket(_0x4cec9c,_0x3fd94b,_0x282ed3,_0x143e91,_0x27c092,_0x143e91[_0xa209('0x58')],_0x699fb9);})[_0xa209('0x2b')](function(_0x1e1ea9){_0x3c81a5=_0x1e1ea9;logger['info'](_0xa209('0x4c'));logger[_0xa209('0x12')](_0xa209('0x4d'),_0x3c81a5['id']);var _0x36e168=util[_0xa209('0x1a')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4cec9c[_0xa209('0x29')],_['split'](_0x3c81a5['id'],'x')[0x1]);logger[_0xa209('0x12')](_0xa209('0x55'),_0xa209('0x4f'));emit(util[_0xa209('0x1a')](_0xa209('0x50'),_0x4d4079['name']),_0xa209('0x51'),{'uri':_0x36e168});})['catch'](function(_0xb99c0){logger[_0xa209('0x25')](_0xa209('0x55'),JSON[_0xa209('0x1f')](_0xb99c0));});};exports[_0xa209('0x59')]=function(_0x131391,_0x44ffff,_0x15f68c,_0x553bf9,_0x35a3de,_0x2e0dc7){var _0x646083,_0x56cfe1,_0x62a046,_0x3aebde;_0x2e0dc7[_0xa209('0x29')]=intUtil[_0xa209('0x42')](_0x2e0dc7[_0xa209('0x29')]);_0x2e0dc7[_0xa209('0x46')]=intUtil[_0xa209('0x42')](_0x2e0dc7['serverUrl']);if(_0x35a3de&&_0x35a3de['monitor_format']){logger['info'](_0xa209('0x5a'),'Recording\x20is\x20enabled!');_0x44ffff[_0xa209('0x45')]=util[_0xa209('0x1a')](_0xa209('0x56'),_0x2e0dc7[_0xa209('0x46')],_0x44ffff[_0xa209('0x47')],md5(_0x44ffff[_0xa209('0x47')]));}else{_0x44ffff[_0xa209('0x45')]='';}return getConnection(_0x2e0dc7)[_0xa209('0x2b')](function(_0x3b6cfa){_0x3aebde=_0x3b6cfa;return getUser(_0x2e0dc7,_0x553bf9?_0x553bf9['email']:'',_0x3aebde);})[_0xa209('0x2b')](function(_0x18dfe6){_0x646083=_0x18dfe6;logger[_0xa209('0x12')]('The\x20User\x20ID\x20is:',_0x646083['id']);return getEndUser(_0x2e0dc7,_0x44ffff['calleridname'],_0x44ffff[_0xa209('0x4a')],_0x3aebde);})['then'](function(_0x1f1946){_0x56cfe1=_0x1f1946;logger['info']('The\x20Enduser\x20ID\x20is:',_0x56cfe1['id']);return createTicket(_0x2e0dc7,_0x646083,_0x56cfe1,_0x15f68c,_0x44ffff,_0x15f68c[_0xa209('0x58')],_0x3aebde);})[_0xa209('0x2b')](function(_0x529779){_0x62a046=_0x529779;logger[_0xa209('0x12')](_0xa209('0x4c'));logger[_0xa209('0x12')](_0xa209('0x4d'),_0x62a046['id']);})['catch'](function(_0x4eb465){logger['error'](_0xa209('0x5a'),JSON[_0xa209('0x1f')](_0x4eb465));});}; \ No newline at end of file +var _0x8a85=['localhost','emit','length','forEach','string','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','Descriptions','%s/webservice.php','remoteUri','create','admin','sessionName','stringify','then','success','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','test','[vTiger],\x20%s,\x20%s,\x20%s','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','email1','first_name','last_name','userId','username','catch','getUser','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Contacts','Enduser\x20created.','phone','statusCode','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','abandoned','[ABANDONED]','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','vTiger','socket.io-emitter'];(function(_0x45cf22,_0x5e7983){var _0x3018a0=function(_0x2eb6bf){while(--_0x2eb6bf){_0x45cf22['push'](_0x45cf22['shift']());}};_0x3018a0(++_0x5e7983);}(_0x8a85,0x18f));var _0x58a8=function(_0x49d156,_0x7fc02a){_0x49d156=_0x49d156-0x0;var _0x2b564f=_0x8a85[_0x49d156];return _0x2b564f;};'use strict';var _=require(_0x58a8('0x0'));var rp=require(_0x58a8('0x1'));var BPromise=require(_0x58a8('0x2'));var md5=require(_0x58a8('0x3'));var util=require(_0x58a8('0x4'));var intUtil=require(_0x58a8('0x5'));var logger=require(_0x58a8('0x6'))(_0x58a8('0x7'));var io=require(_0x58a8('0x8'))({'host':_0x58a8('0x9'),'port':0x18eb});function emit(_0x4ecde4,_0x136546,_0x5ece1d){io['to'](_0x4ecde4)[_0x58a8('0xa')](_0x136546,_0x5ece1d);}function getCustomFields(_0x400d67,_0x30c2ad){var _0x3eded9={};if(_0x400d67[_0x58a8('0xb')]>0x0){_[_0x58a8('0xc')](_0x400d67,function(_0x42c223){if(_0x42c223['type']===_0x58a8('0xd')&&_0x42c223[_0x58a8('0xe')]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x42c223[_0x58a8('0xf')][_0x58a8('0x10')]();}else if(_0x42c223['type']===_0x58a8('0x11')&&_0x42c223[_0x58a8('0x12')]&&_0x42c223[_0x58a8('0xe')]&&_0x30c2ad[_0x42c223['variableName']]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x30c2ad[_0x42c223[_0x58a8('0x12')]][_0x58a8('0x10')]();}else if(_0x42c223['type']===_0x58a8('0x13')&&_0x42c223[_0x58a8('0x14')]&&_0x42c223['Variable']['name']&&_0x42c223['idField']&&_0x30c2ad[_0x42c223[_0x58a8('0x14')][_0x58a8('0x15')][_0x58a8('0x16')]()]){_0x3eded9[_0x42c223[_0x58a8('0xe')]]=_0x30c2ad[_0x42c223[_0x58a8('0x14')][_0x58a8('0x15')][_0x58a8('0x16')]()][_0x58a8('0x10')]();}});}return _0x3eded9;}function createTicket(_0xe55667,_0x36d96b,_0x1ba4d8,_0x10f6d0,_0x2277e9,_0x4f0d39,_0x1bab46){logger[_0x58a8('0x17')](_0x58a8('0x18'));var _0x141dab=_[_0x58a8('0x19')]({'parent_id':'','assigned_user_id':_0x36d96b['id'],'ticketpriorities':_0x58a8('0x1a'),'ticketstatus':_0x58a8('0x1b'),'ticket_title':intUtil[_0x58a8('0x1c')](_0x10f6d0[_0x58a8('0x1d')],_0x2277e9,'\x20'),'description':intUtil[_0x58a8('0x1c')](_0x10f6d0[_0x58a8('0x1e')],_0x2277e9,'\x0a'),'contact_id':_0x1ba4d8['id']},getCustomFields(_0x4f0d39,_0x2277e9));var _0x4e59ea={'method':'POST','uri':util['format'](_0x58a8('0x1f'),_0xe55667[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x21'),'username':_0x58a8('0x22'),'sessionName':_0x1bab46[_0x58a8('0x23')],'elementType':'HelpDesk','element':JSON[_0x58a8('0x24')](_0x141dab)},'json':!![]};return request(_0x4e59ea)[_0x58a8('0x25')](function(_0x5a858e){if(_0x5a858e[_0x58a8('0x26')]){return BPromise[_0x58a8('0x27')]({'id':_0x5a858e[_0x58a8('0x28')]['id']});}else{throw new Error(util[_0x58a8('0x29')](_0x58a8('0x2a'),JSON[_0x58a8('0x24')](_0x5a858e[_0x58a8('0x2b')])));}})['catch'](function(_0x2c2cb8){var _0xe26a1f=req['query'][_0x58a8('0x2c')]?0x1f4:_0x2c2cb8['statusCode']||0x1f4;logger['error'](_0x58a8('0x2d'),'createTicket',_0xe26a1f,JSON[_0x58a8('0x24')](_0x2c2cb8));});}function getUser(_0x5b8815,_0x511404,_0x4b33e4){logger[_0x58a8('0x17')](_0x58a8('0x2e'),_0x511404);return request({'method':_0x58a8('0x2f'),'uri':util['format']('%s/webservice.php',_0x5b8815[_0x58a8('0x20')]),'qs':{'operation':_0x58a8('0x30'),'username':_0x58a8('0x22'),'sessionName':_0x4b33e4[_0x58a8('0x23')],'query':util['format'](_0x58a8('0x31'),_0x511404)},'json':!![]})[_0x58a8('0x25')](function(_0x5a71a4){if(_0x5a71a4[_0x58a8('0x26')]&&_0x5a71a4['result'][_0x58a8('0xb')]){logger[_0x58a8('0x17')]('Agent\x20found!');return BPromise[_0x58a8('0x27')]({'id':_0x5a71a4[_0x58a8('0x28')][0x0]['id'],'email':_0x5a71a4[_0x58a8('0x28')][0x0][_0x58a8('0x32')],'name':_0x5a71a4['result'][0x0][_0x58a8('0x33')]+'\x20'+_0x5a71a4[_0x58a8('0x28')][_0x58a8('0x34')]});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x58a8('0x27')]({'id':_0x4b33e4[_0x58a8('0x35')],'email':_0x5b8815[_0x58a8('0x36')],'name':_0x58a8('0x22')});}})[_0x58a8('0x37')](function(_0x4378f8){var _0x47dee2=req[_0x58a8('0x30')][_0x58a8('0x2c')]?0x1f4:_0x4378f8['statusCode']||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s',_0x58a8('0x38'),_0x47dee2,JSON[_0x58a8('0x24')](_0x4378f8));});}function getEndUser(_0x5e500a,_0x1e681f,_0x465e9d,_0x439881){logger[_0x58a8('0x17')](_0x58a8('0x39'),_0x465e9d);return request({'method':'GET','uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x5e500a['remoteUri']),'qs':{'operation':_0x58a8('0x30'),'username':_0x58a8('0x22'),'sessionName':_0x439881[_0x58a8('0x23')],'query':util[_0x58a8('0x29')](_0x58a8('0x3a'),_0x465e9d,_0x465e9d,_0x465e9d,_0x465e9d,_0x465e9d)},'json':!![]})[_0x58a8('0x25')](function(_0x493f65){if(_0x493f65[_0x58a8('0x26')]&&_0x493f65[_0x58a8('0x28')][_0x58a8('0xb')]){logger[_0x58a8('0x17')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x493f65[_0x58a8('0x28')][0x0]['id'],'name':_0x493f65[_0x58a8('0x28')][0x0][_0x58a8('0x3b')]+'\x20'+_0x493f65[_0x58a8('0x28')][0x0][_0x58a8('0x3c')],'phone':_0x465e9d});}else{logger[_0x58a8('0x17')](_0x58a8('0x3d'));return request({'method':_0x58a8('0x3e'),'uri':util[_0x58a8('0x29')]('%s/webservice.php',_0x5e500a[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x21'),'sessionName':_0x439881['sessionName'],'elementType':_0x58a8('0x3f'),'element':JSON[_0x58a8('0x24')]({'lastname':_0x1e681f,'phone':_0x465e9d,'assigned_user_id':'\x20'})},'json':!![]})[_0x58a8('0x25')](function(_0xeef28c){logger[_0x58a8('0x17')](_0x58a8('0x40'));return BPromise[_0x58a8('0x27')]({'id':_0xeef28c['result']['id'],'name':_0xeef28c[_0x58a8('0x28')][_0x58a8('0x3c')],'phone':_0xeef28c[_0x58a8('0x28')][_0x58a8('0x41')]});})[_0x58a8('0x37')](function(_0x3f790d){var _0x2cc3f1=req[_0x58a8('0x30')][_0x58a8('0x2c')]?0x1f4:_0x3f790d[_0x58a8('0x42')]||0x1f4;logger[_0x58a8('0x2b')](_0x58a8('0x2d'),_0x58a8('0x43'),_0x2cc3f1,JSON[_0x58a8('0x24')](_0x3f790d));});}});}function getConnection(_0x237e57){var _0xb3a0ed=_0x237e57['username'];var _0xc0c5aa=_0x237e57[_0x58a8('0x44')];return request({'method':'GET','uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x237e57['remoteUri']),'qs':{'operation':'getchallenge','username':_0xb3a0ed},'json':!![]})[_0x58a8('0x25')](function(_0x30c81d){if(_0x30c81d[_0x58a8('0x26')]){return request({'method':_0x58a8('0x3e'),'uri':util[_0x58a8('0x29')](_0x58a8('0x1f'),_0x237e57[_0x58a8('0x20')]),'form':{'operation':_0x58a8('0x45'),'username':_0x58a8('0x22'),'accessKey':md5(_0x30c81d[_0x58a8('0x28')]['token']+_0xc0c5aa)},'json':!![]});}})[_0x58a8('0x25')](function(_0x42699c){if(_0x42699c[_0x58a8('0x26')]){return BPromise[_0x58a8('0x27')](_0x42699c[_0x58a8('0x28')]);}else{throw new Error(util['format'](_0x58a8('0x46'),_0x237e57['id']));}})[_0x58a8('0x37')](function(_0x96d5c1){var _0x2bac07=req['query']['test']?0x1f4:_0x96d5c1['statusCode']||0x1f4;logger[_0x58a8('0x2b')](_0x58a8('0x2d'),_0x58a8('0x47'),_0x2bac07,JSON[_0x58a8('0x24')](_0x96d5c1));});}function request(_0x120643){logger['info']('[HTTP]',JSON[_0x58a8('0x24')](_0x120643));return rp(_0x120643);}exports[_0x58a8('0x48')]=function(_0x506f6c,_0x503a5a,_0x1514f9,_0x1637cc,_0x1cf334,_0x3f0e26){var _0x4b14a5,_0xbca446,_0xc52c69,_0x4a7cc2;_0x3f0e26['remoteUri']=intUtil[_0x58a8('0x49')](_0x3f0e26[_0x58a8('0x20')]);if(_0x1cf334&&_0x1cf334[_0x58a8('0x4a')]){logger[_0x58a8('0x17')]('[QUEUE]',_0x58a8('0x4b'));_0x503a5a['recordingURL']=util[_0x58a8('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3f0e26[_0x58a8('0x4c')],_0x503a5a[_0x58a8('0x4d')],md5(_0x503a5a[_0x58a8('0x4d')]));}else{_0x503a5a[_0x58a8('0x4e')]='';}return getConnection(_0x3f0e26)[_0x58a8('0x25')](function(_0x179e14){_0x4a7cc2=_0x179e14;return getUser(_0x3f0e26,_0x1637cc?_0x1637cc[_0x58a8('0x4f')]:'',_0x4a7cc2);})[_0x58a8('0x25')](function(_0x1f0a76){_0x4b14a5=_0x1f0a76;logger[_0x58a8('0x17')](_0x58a8('0x50'),_0x4b14a5['id']);return getEndUser(_0x3f0e26,_0x503a5a[_0x58a8('0x51')],_0x503a5a[_0x58a8('0x52')],_0x4a7cc2);})['then'](function(_0x42e03c){_0xbca446=_0x42e03c;logger[_0x58a8('0x17')]('The\x20Enduser\x20ID\x20is:',_0xbca446['id']);return createTicket(_0x3f0e26,_0x4b14a5,_0xbca446,_0x1514f9,_0x503a5a,_0x1514f9[_0x58a8('0x53')],_0x4a7cc2);})[_0x58a8('0x25')](function(_0x5b49a5){_0xc52c69=_0x5b49a5;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger[_0x58a8('0x17')](_0x58a8('0x55'),_0xc52c69['id']);var _0x20db16=util[_0x58a8('0x29')](_0x58a8('0x56'),_0x3f0e26[_0x58a8('0x20')],_['split'](_0xc52c69['id'],'x')[0x1]);logger['info'](_0x58a8('0x57'),_0x58a8('0x58'));emit(util[_0x58a8('0x29')](_0x58a8('0x59'),_0x1637cc[_0x58a8('0x15')]),_0x58a8('0x5a'),{'uri':_0x20db16});})[_0x58a8('0x37')](function(_0xd9755c){logger['error'](_0x58a8('0x57'),JSON[_0x58a8('0x24')](_0xd9755c));});};exports[_0x58a8('0x5b')]=function(_0x1495f8,_0x486f59,_0x2a5c5b,_0x213d69,_0x26dbbd,_0xc780e3,_0x5394ba){var _0x8debfd,_0x3baf45,_0x12014d,_0x2dd2b9;_0xc780e3[_0x58a8('0x20')]=intUtil['stripTrailingSlash'](_0xc780e3[_0x58a8('0x20')]);_0xc780e3[_0x58a8('0x4c')]=intUtil[_0x58a8('0x49')](_0xc780e3[_0x58a8('0x4c')]);if(_0x5394ba&&_0x5394ba[_0x58a8('0x5c')]&&_0x5394ba[_0x58a8('0x5c')]!==_0x58a8('0x5d')){logger[_0x58a8('0x17')](_0x58a8('0x5e'),_0x58a8('0x4b'));_0x486f59[_0x58a8('0x4e')]=util['format'](_0x58a8('0x5f'),_0xc780e3[_0x58a8('0x4c')],_0x486f59['uniqueid'],md5(_0x486f59[_0x58a8('0x4d')]));}return getConnection(_0xc780e3)[_0x58a8('0x25')](function(_0x27cd06){_0x2dd2b9=_0x27cd06;return getUser(_0xc780e3,_0x213d69?_0x213d69['email']:'',_0x2dd2b9);})['then'](function(_0x30b52a){_0x8debfd=_0x30b52a;logger[_0x58a8('0x17')]('The\x20User\x20ID\x20is:',_0x8debfd['id']);return getEndUser(_0xc780e3,_0x486f59[_0x58a8('0x60')],_0x486f59[_0x58a8('0x61')],_0x2dd2b9);})[_0x58a8('0x25')](function(_0x5f5678){_0x3baf45=_0x5f5678;logger[_0x58a8('0x17')](_0x58a8('0x62'),_0x3baf45['id']);return createTicket(_0xc780e3,_0x8debfd,_0x3baf45,_0x2a5c5b,_0x486f59,_0x2a5c5b[_0x58a8('0x53')],_0x2dd2b9);})[_0x58a8('0x25')](function(_0xfdcb8c){_0x12014d=_0xfdcb8c;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger['info'](_0x58a8('0x55'),_0x12014d['id']);var _0xca4830=util[_0x58a8('0x29')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0xc780e3['remoteUri'],_[_0x58a8('0x63')](_0x12014d['id'],'x')[0x1]);logger[_0x58a8('0x17')](_0x58a8('0x5e'),_0x58a8('0x58'));emit(util[_0x58a8('0x29')](_0x58a8('0x59'),_0x213d69[_0x58a8('0x15')]),_0x58a8('0x5a'),{'uri':_0xca4830});})[_0x58a8('0x37')](function(_0x4803aa){logger['error']('[OUTBOUND]',JSON[_0x58a8('0x24')](_0x4803aa));});};exports[_0x58a8('0x64')]=function(_0x2803cf,_0x40e3d0,_0x25ff28,_0x17dbc0,_0x586c10,_0x4565c1){var _0x4cce0e,_0x4c6ca6,_0x198726,_0x40eead;_0x4565c1[_0x58a8('0x20')]=intUtil[_0x58a8('0x49')](_0x4565c1['remoteUri']);_0x4565c1[_0x58a8('0x4c')]=intUtil['stripTrailingSlash'](_0x4565c1[_0x58a8('0x4c')]);if(_0x586c10&&_0x586c10[_0x58a8('0x4a')]){logger[_0x58a8('0x17')]('[ABANDONED]',_0x58a8('0x4b'));_0x40e3d0[_0x58a8('0x4e')]=util['format'](_0x58a8('0x5f'),_0x4565c1[_0x58a8('0x4c')],_0x40e3d0['uniqueid'],md5(_0x40e3d0[_0x58a8('0x4d')]));}else{_0x40e3d0[_0x58a8('0x4e')]='';}return getConnection(_0x4565c1)['then'](function(_0x16f681){_0x40eead=_0x16f681;return getUser(_0x4565c1,_0x17dbc0?_0x17dbc0[_0x58a8('0x4f')]:'',_0x40eead);})[_0x58a8('0x25')](function(_0x34c59b){_0x4cce0e=_0x34c59b;logger[_0x58a8('0x17')](_0x58a8('0x50'),_0x4cce0e['id']);return getEndUser(_0x4565c1,_0x40e3d0['calleridname'],_0x40e3d0[_0x58a8('0x52')],_0x40eead);})[_0x58a8('0x25')](function(_0x550850){_0x4c6ca6=_0x550850;logger['info'](_0x58a8('0x62'),_0x4c6ca6['id']);return createTicket(_0x4565c1,_0x4cce0e,_0x4c6ca6,_0x25ff28,_0x40e3d0,_0x25ff28[_0x58a8('0x53')],_0x40eead);})['then'](function(_0x1a5f75){_0x198726=_0x1a5f75;logger[_0x58a8('0x17')](_0x58a8('0x54'));logger['info'](_0x58a8('0x55'),_0x198726['id']);})['catch'](function(_0x39de96){logger[_0x58a8('0x2b')](_0x58a8('0x65'),JSON['stringify'](_0x39de96));});}; \ 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 94ad580..a8c1ba0 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 _0x6a6f=['agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','count','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','Enduser\x20created.','user','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','GET','map','forEach','type','nameField','customField','content','string','push','idField','variableName','custom_fields','customVariable','Variable','toLowerCase','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','%s/agent/tickets/%s','error','catch','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','trigger:browser:url','[ABANDONED]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lodash','util','./util','../../../../config/logger','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','Ticket\x20created!','ticket','%s/search.json','Agent\x20found!','find','results'];(function(_0x27f461,_0x270279){var _0x375f24=function(_0x51e344){while(--_0x51e344){_0x27f461['push'](_0x27f461['shift']());}};_0x375f24(++_0x270279);}(_0x6a6f,0xf3));var _0xf6a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a6f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6a6('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xf6a6('0x1'));var intUtil=require(_0xf6a6('0x2'));var logger=require(_0xf6a6('0x3'))('zendesk');var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function emit(_0x290abc,_0x3e14e4,_0xccbbe0){io['to'](_0x290abc)['emit'](_0x3e14e4,_0xccbbe0);}var headers={'Content-Type':_0xf6a6('0x4'),'Accept':_0xf6a6('0x4')};function getTicket(_0x3f2d5d,_0x59519a,_0x373acc,_0x580080,_0x252e1e){logger[_0xf6a6('0x5')](_0xf6a6('0x6'));return request({'uri':util[_0xf6a6('0x7')](_0xf6a6('0x8'),_0x3f2d5d[_0xf6a6('0x9')]),'method':_0xf6a6('0xa'),'body':{'ticket':_[_0xf6a6('0xb')]({'requester_id':_0x373acc['id'],'submitter_id':_0x59519a?_0x59519a['id']:undefined,'assignee_id':_0x59519a?_0x59519a['id']:undefined,'tags':getTags(_0x580080[_0xf6a6('0xc')],_0xf6a6('0xd')),'subject':intUtil[_0xf6a6('0xe')](_0x580080[_0xf6a6('0xf')],_0x252e1e,'\x20'),'description':intUtil['getString'](_0x580080[_0xf6a6('0x10')],_0x252e1e,'\x0a'),'comment':{'public':![],'body':intUtil[_0xf6a6('0xe')](_0x580080[_0xf6a6('0x10')],_0x252e1e,'\x0a')}},getCustomFields(_0x580080['Fields'],_0x252e1e))}})[_0xf6a6('0x11')](function(_0x5618e9){logger[_0xf6a6('0x5')](_0xf6a6('0x12'));return _0x5618e9[_0xf6a6('0x13')];});}function getUser(_0xf74dfe,_0x528a72){logger[_0xf6a6('0x5')]('Getting\x20agent\x20with\x20email',_0x528a72);return request({'uri':util['format'](_0xf6a6('0x14'),_0xf74dfe[_0xf6a6('0x9')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x528a72)}})['then'](function(_0xddcd89){if(_0xddcd89['count']){logger['info'](_0xf6a6('0x15'));return _[_0xf6a6('0x16')](_0xddcd89[_0xf6a6('0x17')],{'email':_0x528a72,'role':_0xf6a6('0x18')});}else{logger['info'](_0xf6a6('0x19'));return request({'uri':util['format']('%s/users/me.json',_0xf74dfe[_0xf6a6('0x9')])})['then'](function(_0x3db660){logger[_0xf6a6('0x5')](_0xf6a6('0x1a'));return _0x3db660['user'];});}});}function getEndUser(_0x29215c,_0x17f8ea,_0x2ea0c5){logger[_0xf6a6('0x5')]('Searching\x20enduser\x20with\x20phone',_0x2ea0c5);return request({'uri':util[_0xf6a6('0x7')](_0xf6a6('0x14'),_0x29215c[_0xf6a6('0x9')]),'qs':{'query':util[_0xf6a6('0x7')]('type:user\x20role:end-user\x20phone:%s',_0x2ea0c5)}})[_0xf6a6('0x11')](function(_0x26d75c){if(_0x26d75c[_0xf6a6('0x1b')]){logger[_0xf6a6('0x5')](_0xf6a6('0x1c'));return _[_0xf6a6('0x16')](_0x26d75c[_0xf6a6('0x17')],{'phone':_0x2ea0c5,'role':'end-user'});}else{logger[_0xf6a6('0x5')](_0xf6a6('0x1d'));return request({'uri':util[_0xf6a6('0x7')]('%s/users.json',_0x29215c['remoteUri']),'method':'POST','body':{'user':{'role':_0xf6a6('0x1e'),'name':util[_0xf6a6('0x7')](_0xf6a6('0x1f'),_0x17f8ea||_0x2ea0c5),'phone':_0x2ea0c5}}})[_0xf6a6('0x11')](function(_0x5eb34e){logger[_0xf6a6('0x5')](_0xf6a6('0x20'));return _0x5eb34e[_0xf6a6('0x21')];});}});}function getAuth(_0x2dbb5a){var _0x3be5d0;if(_0x2dbb5a[_0xf6a6('0x22')]==='password'){_0x3be5d0=util[_0xf6a6('0x7')](_0xf6a6('0x23'),_0x2dbb5a[_0xf6a6('0x24')],_0x2dbb5a['password']);}else if(_0x2dbb5a[_0xf6a6('0x22')]===_0xf6a6('0x25')){_0x3be5d0=util[_0xf6a6('0x7')](_0xf6a6('0x26'),_0x2dbb5a[_0xf6a6('0x24')],_0x2dbb5a[_0xf6a6('0x25')]);}return util[_0xf6a6('0x7')](_0xf6a6('0x27'),new Buffer(_0x3be5d0)[_0xf6a6('0x28')](_0xf6a6('0x29')));}function request(_0x4d9b9f){logger['debug'](_0xf6a6('0x2a'),JSON[_0xf6a6('0x2b')](_0x4d9b9f));return rp(_[_0xf6a6('0x2c')](_0x4d9b9f,{'method':_0xf6a6('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0xfc2183,_0x1c62a9){var _0x1f7a62=[];if(_0xfc2183&&_0xfc2183['length']>0x0){_0x1f7a62=_[_0xf6a6('0x2e')](_0xfc2183,_0x1c62a9);}return _0x1f7a62;}function getCustomFields(_0x4e7f34,_0xdae16c){var _0x5af954=[];var _0x441af2={'custom_fields':[]};if(_0x4e7f34['length']>0x0){_[_0xf6a6('0x2f')](_0x4e7f34,function(_0x491c73){if(_0x491c73[_0xf6a6('0x30')]==='string'&&_0x491c73[_0xf6a6('0x31')]&&!_0x491c73[_0xf6a6('0x32')]){_0x441af2[_0x491c73[_0xf6a6('0x31')]['toLowerCase']()]=_0x491c73[_0xf6a6('0x33')][_0xf6a6('0x28')]();}else if(_0x491c73['type']===_0xf6a6('0x34')&&_0x491c73['idField']&&_0x491c73['customField']){_0x441af2['custom_fields'][_0xf6a6('0x35')]({'id':_0x491c73[_0xf6a6('0x36')],'value':_0x491c73[_0xf6a6('0x33')][_0xf6a6('0x28')]()});}else if(_0x491c73[_0xf6a6('0x30')]==='variable'&&_0x491c73[_0xf6a6('0x37')]&&_0x491c73[_0xf6a6('0x36')]&&_0x491c73['customField']){_0xdae16c[_0x491c73[_0xf6a6('0x37')]]&&_0x441af2[_0xf6a6('0x38')][_0xf6a6('0x35')]({'id':_0x491c73[_0xf6a6('0x36')],'value':_0xdae16c[_0x491c73['variableName']][_0xf6a6('0x28')]()});}else if(_0x491c73[_0xf6a6('0x30')]===_0xf6a6('0x39')&&_0x491c73[_0xf6a6('0x3a')]&&_0x491c73[_0xf6a6('0x3a')][_0xf6a6('0xd')]&&_0x491c73[_0xf6a6('0x36')]&&_0x491c73[_0xf6a6('0x32')]){_0xdae16c[_0x491c73[_0xf6a6('0x3a')]['name'][_0xf6a6('0x3b')]()]&&_0x441af2[_0xf6a6('0x38')]['push']({'id':_0x491c73[_0xf6a6('0x36')],'value':_0xdae16c[_0x491c73[_0xf6a6('0x3a')][_0xf6a6('0xd')][_0xf6a6('0x3b')]()][_0xf6a6('0x28')]()});}});}return _0x441af2;}exports['queue']=function(_0xe1179,_0x50d9c7,_0x306b75,_0x51ded8,_0xf50b35,_0x5c5b75){var _0x4053ec,_0x228e9d;_0x5c5b75['remoteUri']=intUtil['stripTrailingSlash'](_0x5c5b75[_0xf6a6('0x9')]);_0x5c5b75[_0xf6a6('0x3c')]=intUtil[_0xf6a6('0x3d')](_0x5c5b75['serverUrl']);if(_0xf50b35&&_0xf50b35['monitor_format']){logger[_0xf6a6('0x5')](_0xf6a6('0x3e'),_0xf6a6('0x3f'));_0x50d9c7[_0xf6a6('0x40')]=util[_0xf6a6('0x7')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c5b75[_0xf6a6('0x3c')],_0x50d9c7['uniqueid'],md5(_0x50d9c7[_0xf6a6('0x41')]));}else{_0x50d9c7[_0xf6a6('0x40')]='';}headers['Authorization']=getAuth(_0x5c5b75);return getUser(_0x5c5b75,_0x51ded8[_0xf6a6('0x42')])[_0xf6a6('0x11')](function(_0x3269ba){_0x4053ec=_0x3269ba;logger[_0xf6a6('0x5')](_0xf6a6('0x43'),_0x4053ec['id']);return getEndUser(_0x5c5b75,_0x50d9c7[_0xf6a6('0x44')],_0x50d9c7[_0xf6a6('0x45')]);})['then'](function(_0x494011){_0x228e9d=_0x494011;logger[_0xf6a6('0x5')](_0xf6a6('0x46'),_0x228e9d['id']);return getTicket(_0x5c5b75,_0x4053ec,_0x228e9d,_0x306b75,_0x50d9c7);})['then'](function(_0x3608ef){if(_0x3608ef){logger[_0xf6a6('0x5')](_0xf6a6('0x47'),_0x3608ef['id']);switch(_0x5c5b75[_0xf6a6('0x30')]){case'integrationTab':logger['info'](_0xf6a6('0x3e'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xf6a6('0x7')](_0xf6a6('0x48'),_0x5c5b75['remoteUri'],_0x4053ec['id'],_0x3608ef['id']),'method':'POST'});case _0xf6a6('0x49'):logger[_0xf6a6('0x5')](_0xf6a6('0x3e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xf6a6('0x4a'),_0x51ded8[_0xf6a6('0xd')]),'trigger:browser:url',{'uri':util['format'](_0xf6a6('0x4b'),_0x5c5b75[_0xf6a6('0x9')],_0x3608ef['id'])});break;default:logger[_0xf6a6('0x4c')](_0xf6a6('0x3e'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xf6a6('0x4d')](function(_0x1c552c){logger[_0xf6a6('0x4c')](_0xf6a6('0x3e'),JSON[_0xf6a6('0x2b')](_0x1c552c));});};exports[_0xf6a6('0x4e')]=function(_0x28030e,_0x43897a,_0x41764f,_0x199d7a,_0x128ae5,_0x1022dd,_0x2a47ca){var _0x4c45a1,_0x259c44;_0x1022dd[_0xf6a6('0x9')]=intUtil[_0xf6a6('0x3d')](_0x1022dd[_0xf6a6('0x9')]);_0x1022dd[_0xf6a6('0x3c')]=intUtil[_0xf6a6('0x3d')](_0x1022dd['serverUrl']);if(_0x2a47ca&&_0x2a47ca[_0xf6a6('0x4f')]&&_0x2a47ca['recordingFormat']!==_0xf6a6('0x50')){logger[_0xf6a6('0x5')](_0xf6a6('0x51'),'Recording\x20is\x20enabled!');_0x43897a[_0xf6a6('0x40')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1022dd['serverUrl'],_0x43897a['uniqueid'],md5(_0x43897a[_0xf6a6('0x41')]));}headers[_0xf6a6('0x52')]=getAuth(_0x1022dd);return getUser(_0x1022dd,_0x199d7a[_0xf6a6('0x42')])[_0xf6a6('0x11')](function(_0x4a56bc){_0x4c45a1=_0x4a56bc;logger['info']('The\x20User\x20ID\x20is:',_0x4c45a1['id']);return getEndUser(_0x1022dd,_0x43897a['destcalleridname'],_0x43897a[_0xf6a6('0x53')]);})['then'](function(_0x3c60d6){_0x259c44=_0x3c60d6;logger[_0xf6a6('0x5')]('The\x20Enduser\x20ID\x20is:',_0x259c44['id']);return getTicket(_0x1022dd,_0x4c45a1,_0x259c44,_0x41764f,_0x43897a);})[_0xf6a6('0x11')](function(_0x105160){if(_0x105160){logger[_0xf6a6('0x5')](_0xf6a6('0x47'),_0x105160['id']);switch(_0x1022dd[_0xf6a6('0x30')]){case _0xf6a6('0x54'):logger[_0xf6a6('0x5')](_0xf6a6('0x51'),_0xf6a6('0x55'));return request({'uri':util['format'](_0xf6a6('0x48'),_0x1022dd[_0xf6a6('0x9')],_0x4c45a1['id'],_0x105160['id']),'method':'POST'});case'newTab':logger[_0xf6a6('0x5')](_0xf6a6('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6a6('0x7')](_0xf6a6('0x4a'),_0x199d7a['name']),_0xf6a6('0x56'),{'uri':util[_0xf6a6('0x7')](_0xf6a6('0x4b'),_0x1022dd[_0xf6a6('0x9')],_0x105160['id'])});break;default:logger[_0xf6a6('0x4c')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xf6a6('0x4d')](function(_0x6efd81){logger['error'](_0xf6a6('0x51'),JSON[_0xf6a6('0x2b')](_0x6efd81));});};exports['abandoned']=function(_0xd4976c,_0x688144,_0x1b77dd,_0xaaf7d7,_0x47da40,_0x19d91a){var _0x41d28d,_0x70d449;_0x19d91a[_0xf6a6('0x9')]=intUtil[_0xf6a6('0x3d')](_0x19d91a['remoteUri']);_0x19d91a[_0xf6a6('0x3c')]=intUtil[_0xf6a6('0x3d')](_0x19d91a['serverUrl']);if(_0x47da40&&_0x47da40['monitor_format']){logger[_0xf6a6('0x5')](_0xf6a6('0x57'),_0xf6a6('0x3f'));_0x688144['recordingURL']=util[_0xf6a6('0x7')](_0xf6a6('0x58'),_0x19d91a[_0xf6a6('0x3c')],_0x688144['uniqueid'],md5(_0x688144[_0xf6a6('0x41')]));}else{_0x688144['recordingURL']='';}headers[_0xf6a6('0x52')]=getAuth(_0x19d91a);return getUser(_0x19d91a)[_0xf6a6('0x11')](function(_0x281611){_0x41d28d=_0x281611;logger[_0xf6a6('0x5')](_0xf6a6('0x43'),_0x41d28d['id']);return getEndUser(_0x19d91a,_0x688144[_0xf6a6('0x44')],_0x688144['calleridnum']);})['then'](function(_0x11ac45){_0x70d449=_0x11ac45;logger['info'](_0xf6a6('0x46'),_0x70d449['id']);return getTicket(_0x19d91a,_0x41d28d,_0x70d449,_0x1b77dd,_0x688144);})[_0xf6a6('0x11')](function(_0x53737a){if(_0x53737a){logger[_0xf6a6('0x5')](_0xf6a6('0x47'),_0x53737a['id']);}})[_0xf6a6('0x4d')](function(_0x4c270d){logger[_0xf6a6('0x4c')](_0xf6a6('0x57'),JSON[_0xf6a6('0x2b')](_0x4c270d));});}; \ No newline at end of file +var _0xd76f=['Descriptions','then','Ticket\x20created!','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','end-user','Caller\x20-\x20%s','authType','password','token','%s/token:%s','username','Basic\x20%s','base64','stringify','GET','length','map','forEach','type','string','nameField','customField','content','toString','custom_fields','push','variableName','idField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','destcalleridnum','[OUTBOUND]','catch','abandoned','calleridnum','lodash','md5','util','./util','zendesk','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString'];(function(_0x445ecd,_0x53348a){var _0x24b8eb=function(_0x5608b6){while(--_0x5608b6){_0x445ecd['push'](_0x445ecd['shift']());}};_0x24b8eb(++_0x53348a);}(_0xd76f,0x165));var _0xfd76=function(_0x4a782b,_0x55584a){_0x4a782b=_0x4a782b-0x0;var _0x5cb5a0=_0xd76f[_0x4a782b];return _0x5cb5a0;};'use strict';var _=require(_0xfd76('0x0'));var rp=require('request-promise');var md5=require(_0xfd76('0x1'));var util=require(_0xfd76('0x2'));var intUtil=require(_0xfd76('0x3'));var logger=require('../../../../config/logger')(_0xfd76('0x4'));var io=require(_0xfd76('0x5'))({'host':_0xfd76('0x6'),'port':0x18eb});function emit(_0x2a4ccb,_0x3e4c41,_0x18dfe0){io['to'](_0x2a4ccb)[_0xfd76('0x7')](_0x3e4c41,_0x18dfe0);}var headers={'Content-Type':_0xfd76('0x8'),'Accept':_0xfd76('0x8')};function getTicket(_0x529a1a,_0x5305b5,_0x3f336c,_0x5794f0,_0xcccf47){logger[_0xfd76('0x9')](_0xfd76('0xa'));return request({'uri':util[_0xfd76('0xb')](_0xfd76('0xc'),_0x529a1a[_0xfd76('0xd')]),'method':_0xfd76('0xe'),'body':{'ticket':_[_0xfd76('0xf')]({'requester_id':_0x3f336c['id'],'submitter_id':_0x5305b5?_0x5305b5['id']:undefined,'assignee_id':_0x5305b5?_0x5305b5['id']:undefined,'tags':getTags(_0x5794f0[_0xfd76('0x10')],_0xfd76('0x11')),'subject':intUtil[_0xfd76('0x12')](_0x5794f0['Subjects'],_0xcccf47,'\x20'),'description':intUtil[_0xfd76('0x12')](_0x5794f0[_0xfd76('0x13')],_0xcccf47,'\x0a'),'comment':{'public':![],'body':intUtil[_0xfd76('0x12')](_0x5794f0[_0xfd76('0x13')],_0xcccf47,'\x0a')}},getCustomFields(_0x5794f0['Fields'],_0xcccf47))}})[_0xfd76('0x14')](function(_0x33ce89){logger['info'](_0xfd76('0x15'));return _0x33ce89['ticket'];});}function getUser(_0x767798,_0x296512){logger[_0xfd76('0x9')](_0xfd76('0x16'),_0x296512);return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x17'),_0x767798[_0xfd76('0xd')]),'qs':{'query':util[_0xfd76('0xb')](_0xfd76('0x18'),_0x296512)}})[_0xfd76('0x14')](function(_0x177848){if(_0x177848[_0xfd76('0x19')]){logger['info'](_0xfd76('0x1a'));return _['find'](_0x177848[_0xfd76('0x1b')],{'email':_0x296512,'role':_0xfd76('0x1c')});}else{logger[_0xfd76('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x1d'),_0x767798['remoteUri'])})[_0xfd76('0x14')](function(_0x107eac){logger['info'](_0xfd76('0x1e'));return _0x107eac[_0xfd76('0x1f')];});}});}function getEndUser(_0x3eb727,_0x36d38d,_0x239137){logger[_0xfd76('0x9')](_0xfd76('0x20'),_0x239137);return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x17'),_0x3eb727[_0xfd76('0xd')]),'qs':{'query':util[_0xfd76('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x239137)}})['then'](function(_0x296cc2){if(_0x296cc2[_0xfd76('0x19')]){logger['info']('Enduser\x20found!');return _[_0xfd76('0x21')](_0x296cc2[_0xfd76('0x1b')],{'phone':_0x239137,'role':'end-user'});}else{logger[_0xfd76('0x9')](_0xfd76('0x22'));return request({'uri':util['format']('%s/users.json',_0x3eb727['remoteUri']),'method':_0xfd76('0xe'),'body':{'user':{'role':_0xfd76('0x23'),'name':util[_0xfd76('0xb')](_0xfd76('0x24'),_0x36d38d||_0x239137),'phone':_0x239137}}})[_0xfd76('0x14')](function(_0x21f409){logger[_0xfd76('0x9')]('Enduser\x20created.');return _0x21f409[_0xfd76('0x1f')];});}});}function getAuth(_0x17da40){var _0x21a69f;if(_0x17da40[_0xfd76('0x25')]===_0xfd76('0x26')){_0x21a69f=util['format']('%s:%s',_0x17da40['username'],_0x17da40['password']);}else if(_0x17da40[_0xfd76('0x25')]===_0xfd76('0x27')){_0x21a69f=util[_0xfd76('0xb')](_0xfd76('0x28'),_0x17da40[_0xfd76('0x29')],_0x17da40[_0xfd76('0x27')]);}return util[_0xfd76('0xb')](_0xfd76('0x2a'),new Buffer(_0x21a69f)['toString'](_0xfd76('0x2b')));}function request(_0x43d3b3){logger['debug']('[HTTP]',JSON[_0xfd76('0x2c')](_0x43d3b3));return rp(_['defaults'](_0x43d3b3,{'method':_0xfd76('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x4047ee,_0x248d28){var _0x301efd=[];if(_0x4047ee&&_0x4047ee[_0xfd76('0x2e')]>0x0){_0x301efd=_[_0xfd76('0x2f')](_0x4047ee,_0x248d28);}return _0x301efd;}function getCustomFields(_0x1abf45,_0x5336bd){var _0x1a3c69=[];var _0x2374a9={'custom_fields':[]};if(_0x1abf45[_0xfd76('0x2e')]>0x0){_[_0xfd76('0x30')](_0x1abf45,function(_0xa46834){if(_0xa46834[_0xfd76('0x31')]===_0xfd76('0x32')&&_0xa46834[_0xfd76('0x33')]&&!_0xa46834[_0xfd76('0x34')]){_0x2374a9[_0xa46834[_0xfd76('0x33')]['toLowerCase']()]=_0xa46834[_0xfd76('0x35')][_0xfd76('0x36')]();}else if(_0xa46834[_0xfd76('0x31')]==='string'&&_0xa46834['idField']&&_0xa46834[_0xfd76('0x34')]){_0x2374a9[_0xfd76('0x37')][_0xfd76('0x38')]({'id':_0xa46834['idField'],'value':_0xa46834[_0xfd76('0x35')][_0xfd76('0x36')]()});}else if(_0xa46834[_0xfd76('0x31')]==='variable'&&_0xa46834[_0xfd76('0x39')]&&_0xa46834[_0xfd76('0x3a')]&&_0xa46834[_0xfd76('0x34')]){_0x5336bd[_0xa46834[_0xfd76('0x39')]]&&_0x2374a9[_0xfd76('0x37')]['push']({'id':_0xa46834[_0xfd76('0x3a')],'value':_0x5336bd[_0xa46834[_0xfd76('0x39')]][_0xfd76('0x36')]()});}else if(_0xa46834[_0xfd76('0x31')]===_0xfd76('0x3b')&&_0xa46834[_0xfd76('0x3c')]&&_0xa46834[_0xfd76('0x3c')][_0xfd76('0x11')]&&_0xa46834[_0xfd76('0x3a')]&&_0xa46834['customField']){_0x5336bd[_0xa46834['Variable']['name'][_0xfd76('0x3d')]()]&&_0x2374a9[_0xfd76('0x37')][_0xfd76('0x38')]({'id':_0xa46834[_0xfd76('0x3a')],'value':_0x5336bd[_0xa46834[_0xfd76('0x3c')][_0xfd76('0x11')][_0xfd76('0x3d')]()]['toString']()});}});}return _0x2374a9;}exports[_0xfd76('0x3e')]=function(_0x33bdc5,_0x4fbee0,_0x297913,_0xb3eadc,_0x449a4c,_0x3401d8){var _0x1a1c99,_0x437e5d;_0x3401d8[_0xfd76('0xd')]=intUtil[_0xfd76('0x3f')](_0x3401d8[_0xfd76('0xd')]);_0x3401d8[_0xfd76('0x40')]=intUtil[_0xfd76('0x3f')](_0x3401d8[_0xfd76('0x40')]);if(_0x449a4c&&_0x449a4c[_0xfd76('0x41')]){logger[_0xfd76('0x9')](_0xfd76('0x42'),_0xfd76('0x43'));_0x4fbee0[_0xfd76('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3401d8[_0xfd76('0x40')],_0x4fbee0['uniqueid'],md5(_0x4fbee0['uniqueid']));}else{_0x4fbee0['recordingURL']='';}headers[_0xfd76('0x45')]=getAuth(_0x3401d8);return getUser(_0x3401d8,_0xb3eadc[_0xfd76('0x46')])[_0xfd76('0x14')](function(_0x6fdac){_0x1a1c99=_0x6fdac;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x1a1c99['id']);return getEndUser(_0x3401d8,_0x4fbee0[_0xfd76('0x48')],_0x4fbee0['calleridnum']);})[_0xfd76('0x14')](function(_0x91c785){_0x437e5d=_0x91c785;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x437e5d['id']);return getTicket(_0x3401d8,_0x1a1c99,_0x437e5d,_0x297913,_0x4fbee0);})[_0xfd76('0x14')](function(_0x3d09a0){if(_0x3d09a0){logger[_0xfd76('0x9')]('The\x20Ticket\x20ID\x20is:',_0x3d09a0['id']);switch(_0x3401d8[_0xfd76('0x31')]){case _0xfd76('0x4a'):logger[_0xfd76('0x9')](_0xfd76('0x42'),_0xfd76('0x4b'));return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x4c'),_0x3401d8[_0xfd76('0xd')],_0x1a1c99['id'],_0x3d09a0['id']),'method':_0xfd76('0xe')});case'newTab':logger['info'](_0xfd76('0x42'),_0xfd76('0x4d'));emit(util[_0xfd76('0xb')](_0xfd76('0x4e'),_0xb3eadc[_0xfd76('0x11')]),_0xfd76('0x4f'),{'uri':util[_0xfd76('0xb')](_0xfd76('0x50'),_0x3401d8[_0xfd76('0xd')],_0x3d09a0['id'])});break;default:logger[_0xfd76('0x51')](_0xfd76('0x42'),_0xfd76('0x52'));}}})['catch'](function(_0x4b981f){logger[_0xfd76('0x51')](_0xfd76('0x42'),JSON['stringify'](_0x4b981f));});};exports[_0xfd76('0x53')]=function(_0x4752fe,_0x4b4a04,_0x488bae,_0x3e084e,_0x5ad0dd,_0xef4fd8,_0x3f3710){var _0x475249,_0x4fafee;_0xef4fd8[_0xfd76('0xd')]=intUtil['stripTrailingSlash'](_0xef4fd8['remoteUri']);_0xef4fd8[_0xfd76('0x40')]=intUtil[_0xfd76('0x3f')](_0xef4fd8[_0xfd76('0x40')]);if(_0x3f3710&&_0x3f3710[_0xfd76('0x54')]&&_0x3f3710[_0xfd76('0x54')]!==_0xfd76('0x55')){logger[_0xfd76('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4b4a04[_0xfd76('0x44')]=util['format'](_0xfd76('0x56'),_0xef4fd8[_0xfd76('0x40')],_0x4b4a04[_0xfd76('0x57')],md5(_0x4b4a04['uniqueid']));}headers['Authorization']=getAuth(_0xef4fd8);return getUser(_0xef4fd8,_0x3e084e[_0xfd76('0x46')])['then'](function(_0x56711e){_0x475249=_0x56711e;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x475249['id']);return getEndUser(_0xef4fd8,_0x4b4a04[_0xfd76('0x58')],_0x4b4a04[_0xfd76('0x59')]);})[_0xfd76('0x14')](function(_0x5399f3){_0x4fafee=_0x5399f3;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x4fafee['id']);return getTicket(_0xef4fd8,_0x475249,_0x4fafee,_0x488bae,_0x4b4a04);})[_0xfd76('0x14')](function(_0x138d1a){if(_0x138d1a){logger['info']('The\x20Ticket\x20ID\x20is:',_0x138d1a['id']);switch(_0xef4fd8[_0xfd76('0x31')]){case'integrationTab':logger['info'](_0xfd76('0x5a'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xfd76('0xb')](_0xfd76('0x4c'),_0xef4fd8[_0xfd76('0xd')],_0x475249['id'],_0x138d1a['id']),'method':_0xfd76('0xe')});case'newTab':logger[_0xfd76('0x9')](_0xfd76('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xfd76('0xb')](_0xfd76('0x4e'),_0x3e084e[_0xfd76('0x11')]),_0xfd76('0x4f'),{'uri':util['format'](_0xfd76('0x50'),_0xef4fd8[_0xfd76('0xd')],_0x138d1a['id'])});break;default:logger[_0xfd76('0x51')](_0xfd76('0x5a'),_0xfd76('0x52'));}}})[_0xfd76('0x5b')](function(_0x24b8fa){logger[_0xfd76('0x51')](_0xfd76('0x5a'),JSON[_0xfd76('0x2c')](_0x24b8fa));});};exports[_0xfd76('0x5c')]=function(_0x21fbce,_0x509c10,_0x503bff,_0x150eee,_0x18e264,_0x13c405){var _0x57a1e8,_0x3cbaae;_0x13c405[_0xfd76('0xd')]=intUtil[_0xfd76('0x3f')](_0x13c405[_0xfd76('0xd')]);_0x13c405['serverUrl']=intUtil[_0xfd76('0x3f')](_0x13c405[_0xfd76('0x40')]);if(_0x18e264&&_0x18e264[_0xfd76('0x41')]){logger[_0xfd76('0x9')]('[ABANDONED]','Recording\x20is\x20enabled!');_0x509c10[_0xfd76('0x44')]=util[_0xfd76('0xb')](_0xfd76('0x56'),_0x13c405[_0xfd76('0x40')],_0x509c10[_0xfd76('0x57')],md5(_0x509c10['uniqueid']));}else{_0x509c10[_0xfd76('0x44')]='';}headers['Authorization']=getAuth(_0x13c405);return getUser(_0x13c405)[_0xfd76('0x14')](function(_0x281d81){_0x57a1e8=_0x281d81;logger[_0xfd76('0x9')](_0xfd76('0x47'),_0x57a1e8['id']);return getEndUser(_0x13c405,_0x509c10[_0xfd76('0x48')],_0x509c10[_0xfd76('0x5d')]);})[_0xfd76('0x14')](function(_0x33e0c3){_0x3cbaae=_0x33e0c3;logger[_0xfd76('0x9')](_0xfd76('0x49'),_0x3cbaae['id']);return getTicket(_0x13c405,_0x57a1e8,_0x3cbaae,_0x503bff,_0x509c10);})[_0xfd76('0x14')](function(_0x3e430c){if(_0x3e430c){logger[_0xfd76('0x9')]('The\x20Ticket\x20ID\x20is:',_0x3e430c['id']);}})['catch'](function(_0x3f14f5){logger[_0xfd76('0x51')]('[ABANDONED]',JSON[_0xfd76('0x2c')](_0x3f14f5));});}; \ 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 57c0745..7e30c04 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 _0x24eb=['xml2json','entities','../../../../config/logger','zoho','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','agentcalledAt','YYYY-MM-DD\x20HH:mm:ss','getString','Subjects','Descriptions','Fields','lastevent','called','Called','rejected','Call\x20Result','Rejected','Abandoned','talktime','Call\x20Duration','utc','format','answertime','endtime','diff','CONTACTID','LEADID','Leads','SEID','','hasOwnProperty','%s','encodeXML','','https://crm.%s/crm/private/xml/Calls/insertRecords','then','parse','response','result','recorddetail','Call\x20created!','stringify','Getting\x20agent\x20with\x20email','GET','https://crm.%s/crm/private/json/Users/getUsers','AllUsers','authToken','users','user','Standard','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','Searching\x20enduser\x20with\x20phone','https://crm.%s/crm/private/json/Contacts/searchRecords','crmapi','((Phone:%s))','Enduser\x20found\x20in\x20Contacts!','row','Contacts','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','host','Enduser\x20found\x20in\x20Leads!','length','POST','https://crm.%s/crm/private/xml/Leads/insertRecords','toJson','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','forEach','type','string','idField','variable','variableName','toString','customVariable','name','Variable','toLowerCase','split','queue','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','[ABANDONED]','The\x20User\x20ID\x20is:','lodash','md5','util'];(function(_0x2f88fb,_0x1ac09c){var _0x32d8a2=function(_0x193236){while(--_0x193236){_0x2f88fb['push'](_0x2f88fb['shift']());}};_0x32d8a2(++_0x1ac09c);}(_0x24eb,0xf1));var _0xb24e=function(_0x150397,_0x258581){_0x150397=_0x150397-0x0;var _0x5cadab=_0x24eb[_0x150397];return _0x5cadab;};'use strict';var _=require(_0xb24e('0x0'));var rp=require('request-promise');var md5=require(_0xb24e('0x1'));var util=require(_0xb24e('0x2'));var intUtil=require('./util');var parser=require(_0xb24e('0x3'));var entities=require(_0xb24e('0x4'));var moment=require('moment');var logger=require(_0xb24e('0x5'))(_0xb24e('0x6'));var io=require(_0xb24e('0x7'))({'host':_0xb24e('0x8'),'port':0x18eb});function emit(_0x12ac9f,_0x25bb19,_0x578ff7){io['to'](_0x12ac9f)[_0xb24e('0x9')](_0x25bb19,_0x578ff7);}var headers={'Content-Type':_0xb24e('0xa'),'Accept':_0xb24e('0xa')};function getCall(_0x17cea1,_0x581efa,_0xd9c84e,_0x2b396c,_0xd3aaed,_0x588793){logger[_0xb24e('0xb')](_0xb24e('0xc'));var _0x292e82=_[_0xb24e('0xd')]({'SMOWNERID':_0x581efa['id'],'Call Type':_0x588793||_0xb24e('0xe'),'Call Start Time':(_0x588793==='outbound'?_0xd3aaed['starttime']:_0xd3aaed[_0xb24e('0xf')])||moment()['format'](_0xb24e('0x10')),'Subject':intUtil[_0xb24e('0x11')](_0x2b396c[_0xb24e('0x12')],_0xd3aaed,'\x20'),'Description':intUtil[_0xb24e('0x11')](_0x2b396c[_0xb24e('0x13')],_0xd3aaed,'\x0a')},getCustomFields(_0x2b396c[_0xb24e('0x14')],_0xd3aaed));switch(_0xd3aaed[_0xb24e('0x15')]){case _0xb24e('0x16'):_0x292e82['Call\x20Result']=_0xb24e('0x17');break;case'complete':case'connect':_0x292e82['Call\x20Result']='Answered';break;case _0xb24e('0x18'):_0x292e82[_0xb24e('0x19')]=_0xb24e('0x1a');break;case'abandoned':_0x292e82['Call\x20Result']=_0xb24e('0x1b');break;default:}if(_0xd3aaed[_0xb24e('0x1c')]){_0x292e82[_0xb24e('0x1d')]=moment[_0xb24e('0x1e')](parseInt(_0xd3aaed[_0xb24e('0x1c')])*0x3e8)[_0xb24e('0x1f')]('mm:ss');}else if(_0xd3aaed[_0xb24e('0x20')]&&_0xd3aaed[_0xb24e('0x21')]){_0x292e82[_0xb24e('0x1d')]=moment[_0xb24e('0x1e')](moment(_0xd3aaed['endtime'],'YYYY-MM-DD\x20HH:mm:ss')[_0xb24e('0x22')](moment(_0xd3aaed['starttime'],_0xb24e('0x10'))))[_0xb24e('0x1f')]('mm:ss');}if(_0xd9c84e[_0xb24e('0x23')]){_0x292e82[_0xb24e('0x23')]=_0xd9c84e['CONTACTID'];}else if(_0xd9c84e[_0xb24e('0x24')]){_0x292e82['SEMODULE']=_0xb24e('0x25');_0x292e82[_0xb24e('0x26')]=_0xd9c84e['LEADID'];}var _0x5ba090=_0xb24e('0x27');for(var _0x13423b in _0x292e82){if(_0x292e82[_0xb24e('0x28')](_0x13423b)){_0x5ba090+=util[_0xb24e('0x1f')](_0xb24e('0x29'),entities[_0xb24e('0x2a')](_0x13423b),entities[_0xb24e('0x2a')](_0x292e82[_0x13423b]));}}_0x5ba090+=_0xb24e('0x2b');return request({'method':'POST','uri':util[_0xb24e('0x1f')](_0xb24e('0x2c'),_0x17cea1['host']),'qs':{'authtoken':_0x17cea1['authToken'],'scope':'crmapi','xmlData':_0x5ba090},'json':!![]})[_0xb24e('0x2d')](function(_0x290d29){_0x290d29=JSON[_0xb24e('0x2e')](parser['toJson'](_0x290d29));if(_0x290d29[_0xb24e('0x2f')]){if(_0x290d29[_0xb24e('0x2f')][_0xb24e('0x30')]&&_0x290d29['response'][_0xb24e('0x30')][_0xb24e('0x31')]){logger[_0xb24e('0xb')](_0xb24e('0x32'));return{'id':_0x290d29[_0xb24e('0x2f')][_0xb24e('0x30')]['recorddetail']['FL'][0x0]['$t']};}}throw new Error('Error\x20on\x20call\x20creation:\x20'+JSON[_0xb24e('0x33')](_0x290d29));});}function getUser(_0x1c20ec,_0x53599f){_0x53599f&&logger['info'](_0xb24e('0x34'),_0x53599f);return request({'method':_0xb24e('0x35'),'uri':util['format'](_0xb24e('0x36'),_0x1c20ec['host']),'qs':{'type':_0xb24e('0x37'),'authtoken':_0x1c20ec[_0xb24e('0x38')],'scope':'crmapi'},'json':!![]})[_0xb24e('0x2d')](function(_0xf33cc7){if(_0xf33cc7[_0xb24e('0x39')]&&_0xf33cc7[_0xb24e('0x39')][_0xb24e('0x3a')]){var _0x192925;if(_0x53599f){_0x192925=_['find'](_0xf33cc7['users']['user'],{'email':_0x53599f,'profile':_0xb24e('0x3b')});}if(_0x192925){logger[_0xb24e('0xb')]('Agent\x20found!');}else{logger[_0xb24e('0xb')](_0xb24e('0x3c'));_0x192925=_['find'](_0xf33cc7[_0xb24e('0x39')][_0xb24e('0x3a')],{'profile':_0xb24e('0x3d')});}return _0x192925;}else{logger[_0xb24e('0x3e')](_0xb24e('0x3f'),JSON['stringify'](_0xf33cc7));throw new Error(_0xb24e('0x40')+JSON['stringify'](_0xf33cc7));}});}function getEndUser(_0x369791,_0x30a07b,_0x438733){logger['info'](_0xb24e('0x41'),_0x438733);return request({'method':_0xb24e('0x35'),'uri':util[_0xb24e('0x1f')](_0xb24e('0x42'),_0x369791['host']),'qs':{'authtoken':_0x369791[_0xb24e('0x38')],'scope':_0xb24e('0x43'),'criteria':util['format'](_0xb24e('0x44'),_0x438733)},'json':!![]})[_0xb24e('0x2d')](function(_0x40fb10){if(_0x40fb10[_0xb24e('0x2f')]&&_0x40fb10[_0xb24e('0x2f')][_0xb24e('0x30')]){logger[_0xb24e('0xb')](_0xb24e('0x45'));var _0x37e8fb={};var _0x170728=_0x40fb10['response'][_0xb24e('0x30')]['Contacts'][_0xb24e('0x46')]['no']?_0x40fb10[_0xb24e('0x2f')][_0xb24e('0x30')][_0xb24e('0x47')][_0xb24e('0x46')]['FL']:_0x40fb10['response'][_0xb24e('0x30')]['Contacts']['row'][0x0]['FL'];for(var _0x43841c=0x0,_0x186cd8=_0x170728['length'];_0x43841c<_0x186cd8;_0x43841c++){_0x37e8fb[_0x170728[_0x43841c][_0xb24e('0x48')]]=_0x170728[_0x43841c][_0xb24e('0x49')];}return _0x37e8fb;}else{return request({'method':'GET','uri':util[_0xb24e('0x1f')](_0xb24e('0x4a'),_0x369791[_0xb24e('0x4b')]),'qs':{'authtoken':_0x369791[_0xb24e('0x38')],'scope':_0xb24e('0x43'),'criteria':util[_0xb24e('0x1f')](_0xb24e('0x44'),_0x438733)},'json':!![]})[_0xb24e('0x2d')](function(_0x5c7729){if(_0x5c7729[_0xb24e('0x2f')]&&_0x5c7729[_0xb24e('0x2f')][_0xb24e('0x30')]){logger['info'](_0xb24e('0x4c'));var _0xbccac={};var _0x28740e=_0x5c7729[_0xb24e('0x2f')][_0xb24e('0x30')][_0xb24e('0x25')][_0xb24e('0x46')]['no']?_0x5c7729[_0xb24e('0x2f')][_0xb24e('0x30')][_0xb24e('0x25')][_0xb24e('0x46')]['FL']:_0x5c7729[_0xb24e('0x2f')][_0xb24e('0x30')]['Leads'][_0xb24e('0x46')][0x0]['FL'];for(var _0xffc4c3=0x0,_0x5b4a57=_0x28740e[_0xb24e('0x4d')];_0xffc4c3<_0x5b4a57;_0xffc4c3++){_0xbccac[_0x28740e[_0xffc4c3][_0xb24e('0x48')]]=_0x28740e[_0xffc4c3][_0xb24e('0x49')];}return _0xbccac;}else{logger[_0xb24e('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x30a07b=getName(_0x30a07b);return request({'method':_0xb24e('0x4e'),'uri':util[_0xb24e('0x1f')](_0xb24e('0x4f'),_0x369791[_0xb24e('0x4b')]),'qs':{'authtoken':_0x369791[_0xb24e('0x38')],'scope':_0xb24e('0x43'),'xmlData':util[_0xb24e('0x1f')]('%s%s%s',entities['encodeXML'](_0x30a07b[0x0]),entities[_0xb24e('0x2a')](_0x30a07b[0x1]),_0x438733)},'json':!![]})[_0xb24e('0x2d')](function(_0x1bed9e){_0x1bed9e=JSON['parse'](parser[_0xb24e('0x50')](_0x1bed9e));if(_0x1bed9e[_0xb24e('0x2f')]){if(_0x1bed9e['response']['result']&&_0x1bed9e[_0xb24e('0x2f')]['result'][_0xb24e('0x31')]){logger[_0xb24e('0xb')](_0xb24e('0x51'));return request({'method':'GET','uri':util[_0xb24e('0x1f')](_0xb24e('0x52'),_0x369791[_0xb24e('0x4b')]),'qs':{'authtoken':_0x369791[_0xb24e('0x38')],'scope':_0xb24e('0x43'),'id':_0x1bed9e[_0xb24e('0x2f')]['result'][_0xb24e('0x31')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0xb24e('0x53')+JSON[_0xb24e('0x33')](_0x1bed9e));})['then'](function(_0x1f234f){if(_0x1f234f[_0xb24e('0x2f')]){if(_0x1f234f[_0xb24e('0x2f')][_0xb24e('0x30')]){var _0x53c55c={};for(var _0xb04499=0x0,_0x42e42e=_0x1f234f['response']['result'][_0xb24e('0x25')][_0xb24e('0x46')]['FL'][_0xb24e('0x4d')];_0xb04499<_0x42e42e;_0xb04499++){_0x53c55c[_0x1f234f[_0xb24e('0x2f')]['result'][_0xb24e('0x25')][_0xb24e('0x46')]['FL'][_0xb04499]['val']]=_0x1f234f[_0xb24e('0x2f')][_0xb24e('0x30')]['Leads'][_0xb24e('0x46')]['FL'][_0xb04499][_0xb24e('0x49')];}return _0x53c55c;}}throw new Error('Error\x20on\x20Lead\x20retrieve:\x20'+JSON[_0xb24e('0x33')](_0x1f234f));});}});}});}function request(_0x2ee76a){logger['debug']('[HTTP]',JSON[_0xb24e('0x33')](_0x2ee76a));return rp(_0x2ee76a);}function getCustomFields(_0x12c0c8,_0x5dceb5){var _0x21067b={};if(_0x12c0c8['length']>0x0){_[_0xb24e('0x54')](_0x12c0c8,function(_0x583b9c){if(_0x583b9c[_0xb24e('0x55')]===_0xb24e('0x56')&&_0x583b9c[_0xb24e('0x57')]){_0x21067b[_0x583b9c[_0xb24e('0x57')]]=_0x583b9c[_0xb24e('0x49')]['toString']();}else if(_0x583b9c[_0xb24e('0x55')]===_0xb24e('0x58')&&_0x583b9c[_0xb24e('0x59')]&&_0x583b9c[_0xb24e('0x57')]&&_0x5dceb5[_0x583b9c[_0xb24e('0x59')]]){_0x21067b[_0x583b9c['idField']]=_0x5dceb5[_0x583b9c[_0xb24e('0x59')]][_0xb24e('0x5a')]();}else if(_0x583b9c['type']===_0xb24e('0x5b')&&_0x583b9c['Variable']&&_0x583b9c['Variable'][_0xb24e('0x5c')]&&_0x583b9c['idField']&&_0x5dceb5[_0x583b9c[_0xb24e('0x5d')][_0xb24e('0x5c')]['toLowerCase']()]){_0x21067b[_0x583b9c[_0xb24e('0x57')]]=_0x5dceb5[_0x583b9c[_0xb24e('0x5d')][_0xb24e('0x5c')][_0xb24e('0x5e')]()][_0xb24e('0x5a')]();}});}return _0x21067b;}function getName(_0x384d4c){if(_0x384d4c['indexOf']('\x20')>0x0){var _0x47a30c=_0x384d4c[_0xb24e('0x5f')](/ (.+)/);if(_0x47a30c[0x1]){return _0x47a30c;}}return[_0x384d4c,_0x384d4c];}exports[_0xb24e('0x60')]=function(_0x2c627d,_0x28c467,_0xe07e83,_0x58a2b9,_0x889a3f,_0x3a01c0){var _0x5c633f,_0x3cbd0d;if(_0x889a3f&&_0x889a3f[_0xb24e('0x61')]){logger[_0xb24e('0xb')](_0xb24e('0x62'),'Recording\x20is\x20enabled!');_0x28c467[_0xb24e('0x63')]=util[_0xb24e('0x1f')](_0xb24e('0x64'),_0x3a01c0[_0xb24e('0x65')],_0x28c467['uniqueid'],md5(_0x28c467[_0xb24e('0x66')]));}else{_0x28c467['recordingURL']='';}return getUser(_0x3a01c0,_0x58a2b9[_0xb24e('0x67')])[_0xb24e('0x2d')](function(_0x37b758){_0x5c633f=_0x37b758;logger['info']('The\x20User\x20ID\x20is:',_0x5c633f['id']);return getEndUser(_0x3a01c0,_0x28c467[_0xb24e('0x68')],_0x28c467[_0xb24e('0x69')]);})['then'](function(_0x5034b2){_0x3cbd0d=_0x5034b2;logger[_0xb24e('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3cbd0d[_0xb24e('0x23')]||_0x3cbd0d[_0xb24e('0x24')]);return getCall(_0x3a01c0,_0x5c633f,_0x3cbd0d,_0xe07e83,_0x28c467,_0xb24e('0x6a'));})[_0xb24e('0x2d')](function(_0x5dc433){if(_0x5dc433){logger[_0xb24e('0xb')](_0xb24e('0x6b'),_0x5dc433['id']);logger[_0xb24e('0xb')](_0xb24e('0x62'),_0xb24e('0x6c'));emit(util[_0xb24e('0x1f')](_0xb24e('0x6d'),_0x58a2b9[_0xb24e('0x5c')]),_0xb24e('0x6e'),{'uri':util[_0xb24e('0x1f')](_0xb24e('0x6f'),_0x3a01c0[_0xb24e('0x4b')],_0x5dc433['id'])});}})[_0xb24e('0x70')](function(_0x1f712d){logger[_0xb24e('0x3e')]('[QUEUE]',JSON[_0xb24e('0x33')](_0x1f712d));});};exports[_0xb24e('0x71')]=function(_0x616930,_0x45195c,_0x2a1440,_0x51d8c8,_0x16d374,_0x3db141,_0x5bbb14){var _0x22dfa8,_0x1a09c4;if(_0x5bbb14&&_0x5bbb14[_0xb24e('0x72')]&&_0x5bbb14[_0xb24e('0x72')]!=='none'){logger[_0xb24e('0xb')](_0xb24e('0x73'),_0xb24e('0x74'));_0x45195c[_0xb24e('0x63')]=util[_0xb24e('0x1f')](_0xb24e('0x64'),_0x3db141[_0xb24e('0x65')],_0x45195c['uniqueid'],md5(_0x45195c[_0xb24e('0x66')]));}return getUser(_0x3db141,_0x51d8c8[_0xb24e('0x67')])[_0xb24e('0x2d')](function(_0x54ae25){_0x22dfa8=_0x54ae25;logger[_0xb24e('0xb')]('The\x20User\x20ID\x20is:',_0x22dfa8['id']);return getEndUser(_0x3db141,_0x45195c['destcalleridname'],_0x45195c[_0xb24e('0x75')]);})['then'](function(_0x8261b4){_0x1a09c4=_0x8261b4;logger[_0xb24e('0xb')](_0xb24e('0x76'),_0x1a09c4['CONTACTID']||_0x1a09c4[_0xb24e('0x24')]);return getCall(_0x3db141,_0x22dfa8,_0x1a09c4,_0x2a1440,_0x45195c,_0xb24e('0x77'));})[_0xb24e('0x2d')](function(_0x4bfac4){if(_0x4bfac4){logger[_0xb24e('0xb')]('The\x20Call\x20ID\x20is:',_0x4bfac4['id']);logger['info'](_0xb24e('0x73'),_0xb24e('0x6c'));emit(util[_0xb24e('0x1f')]('user:%s',_0x51d8c8[_0xb24e('0x5c')]),_0xb24e('0x6e'),{'uri':util[_0xb24e('0x1f')]('https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s',_0x3db141[_0xb24e('0x4b')],_0x4bfac4['id'])});}})[_0xb24e('0x70')](function(_0x30155c){logger[_0xb24e('0x3e')](_0xb24e('0x73'),JSON[_0xb24e('0x33')](_0x30155c));});};exports['abandoned']=function(_0xa48ee5,_0x47e089,_0x27790d,_0x187ba8,_0x3eb02d,_0x5dc320){var _0x24643e,_0x23707e;if(_0x3eb02d&&_0x3eb02d['monitor_format']){logger['info'](_0xb24e('0x78'),_0xb24e('0x74'));_0x47e089[_0xb24e('0x63')]=util[_0xb24e('0x1f')](_0xb24e('0x64'),_0x5dc320['serverUrl'],_0x47e089[_0xb24e('0x66')],md5(_0x47e089[_0xb24e('0x66')]));}else{_0x47e089[_0xb24e('0x63')]='';}return getUser(_0x5dc320)[_0xb24e('0x2d')](function(_0x2ad21a){_0x24643e=_0x2ad21a;logger[_0xb24e('0xb')](_0xb24e('0x79'),_0x24643e['id']);return getEndUser(_0x5dc320,_0x47e089[_0xb24e('0x68')],_0x47e089[_0xb24e('0x69')]);})[_0xb24e('0x2d')](function(_0x20a012){_0x23707e=_0x20a012;logger[_0xb24e('0xb')](_0xb24e('0x76'),_0x23707e['CONTACTID']||_0x23707e[_0xb24e('0x24')]);return getCall(_0x5dc320,_0x24643e,_0x23707e,_0x27790d,_0x47e089,_0xb24e('0x6a'));})[_0xb24e('0x2d')](function(_0x441034){if(_0x441034){logger[_0xb24e('0xb')]('The\x20Call\x20ID\x20is:',_0x441034['id']);}})[_0xb24e('0x70')](function(_0x316fdc){logger[_0xb24e('0x3e')](_0xb24e('0x78'),JSON['stringify'](_0x316fdc));});}; \ No newline at end of file +var _0x5608=['catch','Recording\x20is\x20enabled!','[ABANDONED]','lodash','request-promise','md5','util','xml2json','entities','moment','zoho','socket.io-emitter','localhost','emit','application/json','info','Creating\x20new\x20call...','merge','inbound','outbound','starttime','agentcalledAt','format','YYYY-MM-DD\x20HH:mm:ss','getString','Fields','lastevent','called','Call\x20Result','Called','connect','rejected','abandoned','talktime','Call\x20Duration','utc','mm:ss','answertime','diff','CONTACTID','LEADID','Leads','SEID','%s','encodeXML','','authToken','crmapi','then','parse','toJson','response','result','recorddetail','Error\x20on\x20call\x20creation:\x20','GET','https://crm.%s/crm/private/json/Users/getUsers','host','AllUsers','users','find','user','Standard','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','error','The\x20failing\x20result\x20is','stringify','Searching\x20enduser\x20with\x20phone','Enduser\x20found\x20in\x20Contacts!','Contacts','row','val','content','https://crm.%s/crm/private/json/Leads/searchRecords','Enduser\x20found\x20in\x20Leads!','length','POST','https://crm.%s/crm/private/xml/Leads/insertRecords','%s%s%s','Enduser\x20created.','https://crm.%s/crm/private/json/Leads/getRecordById','Error\x20on\x20Lead\x20creation:\x20','Error\x20on\x20Lead\x20retrieve:\x20','[HTTP]','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','queue','monitor_format','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.%s/crm/EntityInfo.do?module=Calls&id=%s','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound'];(function(_0x3e4011,_0x1daf18){var _0x43dbbe=function(_0x2d98a7){while(--_0x2d98a7){_0x3e4011['push'](_0x3e4011['shift']());}};_0x43dbbe(++_0x1daf18);}(_0x5608,0x7a));var _0x8560=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x5608[_0x487b0c];return _0x1adbdc;};'use strict';var _=require(_0x8560('0x0'));var rp=require(_0x8560('0x1'));var md5=require(_0x8560('0x2'));var util=require(_0x8560('0x3'));var intUtil=require('./util');var parser=require(_0x8560('0x4'));var entities=require(_0x8560('0x5'));var moment=require(_0x8560('0x6'));var logger=require('../../../../config/logger')(_0x8560('0x7'));var io=require(_0x8560('0x8'))({'host':_0x8560('0x9'),'port':0x18eb});function emit(_0x287e5e,_0x10cc16,_0x231e90){io['to'](_0x287e5e)[_0x8560('0xa')](_0x10cc16,_0x231e90);}var headers={'Content-Type':_0x8560('0xb'),'Accept':'application/json'};function getCall(_0x298cda,_0x4f89b7,_0x26894a,_0x5ca2e0,_0x340380,_0x5974aa){logger[_0x8560('0xc')](_0x8560('0xd'));var _0x20e9f5=_[_0x8560('0xe')]({'SMOWNERID':_0x4f89b7['id'],'Call Type':_0x5974aa||_0x8560('0xf'),'Call Start Time':(_0x5974aa===_0x8560('0x10')?_0x340380[_0x8560('0x11')]:_0x340380[_0x8560('0x12')])||moment()[_0x8560('0x13')](_0x8560('0x14')),'Subject':intUtil[_0x8560('0x15')](_0x5ca2e0['Subjects'],_0x340380,'\x20'),'Description':intUtil[_0x8560('0x15')](_0x5ca2e0['Descriptions'],_0x340380,'\x0a')},getCustomFields(_0x5ca2e0[_0x8560('0x16')],_0x340380));switch(_0x340380[_0x8560('0x17')]){case _0x8560('0x18'):_0x20e9f5[_0x8560('0x19')]=_0x8560('0x1a');break;case'complete':case _0x8560('0x1b'):_0x20e9f5[_0x8560('0x19')]='Answered';break;case _0x8560('0x1c'):_0x20e9f5[_0x8560('0x19')]='Rejected';break;case _0x8560('0x1d'):_0x20e9f5[_0x8560('0x19')]='Abandoned';break;default:}if(_0x340380[_0x8560('0x1e')]){_0x20e9f5[_0x8560('0x1f')]=moment[_0x8560('0x20')](parseInt(_0x340380[_0x8560('0x1e')])*0x3e8)[_0x8560('0x13')](_0x8560('0x21'));}else if(_0x340380[_0x8560('0x22')]&&_0x340380['endtime']){_0x20e9f5[_0x8560('0x1f')]=moment[_0x8560('0x20')](moment(_0x340380['endtime'],'YYYY-MM-DD\x20HH:mm:ss')[_0x8560('0x23')](moment(_0x340380['starttime'],'YYYY-MM-DD\x20HH:mm:ss')))['format'](_0x8560('0x21'));}if(_0x26894a[_0x8560('0x24')]){_0x20e9f5[_0x8560('0x24')]=_0x26894a[_0x8560('0x24')];}else if(_0x26894a[_0x8560('0x25')]){_0x20e9f5['SEMODULE']=_0x8560('0x26');_0x20e9f5[_0x8560('0x27')]=_0x26894a[_0x8560('0x25')];}var _0x1a2fb6='';for(var _0x4c8dd5 in _0x20e9f5){if(_0x20e9f5['hasOwnProperty'](_0x4c8dd5)){_0x1a2fb6+=util[_0x8560('0x13')](_0x8560('0x28'),entities[_0x8560('0x29')](_0x4c8dd5),entities[_0x8560('0x29')](_0x20e9f5[_0x4c8dd5]));}}_0x1a2fb6+=_0x8560('0x2a');return request({'method':'POST','uri':util[_0x8560('0x13')]('https://crm.%s/crm/private/xml/Calls/insertRecords',_0x298cda['host']),'qs':{'authtoken':_0x298cda[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'xmlData':_0x1a2fb6},'json':!![]})[_0x8560('0x2d')](function(_0x4d5dfc){_0x4d5dfc=JSON[_0x8560('0x2e')](parser[_0x8560('0x2f')](_0x4d5dfc));if(_0x4d5dfc[_0x8560('0x30')]){if(_0x4d5dfc['response'][_0x8560('0x31')]&&_0x4d5dfc['response'][_0x8560('0x31')][_0x8560('0x32')]){logger[_0x8560('0xc')]('Call\x20created!');return{'id':_0x4d5dfc[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]['FL'][0x0]['$t']};}}throw new Error(_0x8560('0x33')+JSON['stringify'](_0x4d5dfc));});}function getUser(_0x3005bf,_0x1b85e8){_0x1b85e8&&logger[_0x8560('0xc')]('Getting\x20agent\x20with\x20email',_0x1b85e8);return request({'method':_0x8560('0x34'),'uri':util[_0x8560('0x13')](_0x8560('0x35'),_0x3005bf[_0x8560('0x36')]),'qs':{'type':_0x8560('0x37'),'authtoken':_0x3005bf[_0x8560('0x2b')],'scope':_0x8560('0x2c')},'json':!![]})[_0x8560('0x2d')](function(_0x409a5c){if(_0x409a5c[_0x8560('0x38')]&&_0x409a5c[_0x8560('0x38')]['user']){var _0x1a2bcd;if(_0x1b85e8){_0x1a2bcd=_[_0x8560('0x39')](_0x409a5c['users'][_0x8560('0x3a')],{'email':_0x1b85e8,'profile':_0x8560('0x3b')});}if(_0x1a2bcd){logger[_0x8560('0xc')](_0x8560('0x3c'));}else{logger[_0x8560('0xc')](_0x8560('0x3d'));_0x1a2bcd=_[_0x8560('0x39')](_0x409a5c[_0x8560('0x38')][_0x8560('0x3a')],{'profile':_0x8560('0x3e')});}return _0x1a2bcd;}else{logger[_0x8560('0x3f')](_0x8560('0x40'),JSON[_0x8560('0x41')](_0x409a5c));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x409a5c));}});}function getEndUser(_0x201e45,_0x1b9437,_0x91c0f2){logger[_0x8560('0xc')](_0x8560('0x42'),_0x91c0f2);return request({'method':_0x8560('0x34'),'uri':util[_0x8560('0x13')]('https://crm.%s/crm/private/json/Contacts/searchRecords',_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'criteria':util[_0x8560('0x13')]('((Phone:%s))',_0x91c0f2)},'json':!![]})[_0x8560('0x2d')](function(_0x149ff9){if(_0x149ff9[_0x8560('0x30')]&&_0x149ff9[_0x8560('0x30')][_0x8560('0x31')]){logger['info'](_0x8560('0x43'));var _0x5d8f2c={};var _0x4c61a2=_0x149ff9[_0x8560('0x30')]['result']['Contacts']['row']['no']?_0x149ff9[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x44')][_0x8560('0x45')]['FL']:_0x149ff9[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x44')][_0x8560('0x45')][0x0]['FL'];for(var _0x135c9c=0x0,_0x4f38cc=_0x4c61a2['length'];_0x135c9c<_0x4f38cc;_0x135c9c++){_0x5d8f2c[_0x4c61a2[_0x135c9c][_0x8560('0x46')]]=_0x4c61a2[_0x135c9c][_0x8560('0x47')];}return _0x5d8f2c;}else{return request({'method':'GET','uri':util[_0x8560('0x13')](_0x8560('0x48'),_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'criteria':util['format']('((Phone:%s))',_0x91c0f2)},'json':!![]})['then'](function(_0x25e2f1){if(_0x25e2f1[_0x8560('0x30')]&&_0x25e2f1[_0x8560('0x30')][_0x8560('0x31')]){logger[_0x8560('0xc')](_0x8560('0x49'));var _0x14c220={};var _0x389d97=_0x25e2f1[_0x8560('0x30')][_0x8560('0x31')]['Leads'][_0x8560('0x45')]['no']?_0x25e2f1['response']['result'][_0x8560('0x26')][_0x8560('0x45')]['FL']:_0x25e2f1['response'][_0x8560('0x31')][_0x8560('0x26')][_0x8560('0x45')][0x0]['FL'];for(var _0x3b71da=0x0,_0x16acbc=_0x389d97[_0x8560('0x4a')];_0x3b71da<_0x16acbc;_0x3b71da++){_0x14c220[_0x389d97[_0x3b71da][_0x8560('0x46')]]=_0x389d97[_0x3b71da][_0x8560('0x47')];}return _0x14c220;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');_0x1b9437=getName(_0x1b9437);return request({'method':_0x8560('0x4b'),'uri':util['format'](_0x8560('0x4c'),_0x201e45['host']),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'xmlData':util['format'](_0x8560('0x4d'),entities['encodeXML'](_0x1b9437[0x0]),entities[_0x8560('0x29')](_0x1b9437[0x1]),_0x91c0f2)},'json':!![]})[_0x8560('0x2d')](function(_0x53a70d){_0x53a70d=JSON[_0x8560('0x2e')](parser[_0x8560('0x2f')](_0x53a70d));if(_0x53a70d[_0x8560('0x30')]){if(_0x53a70d['response'][_0x8560('0x31')]&&_0x53a70d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]){logger[_0x8560('0xc')](_0x8560('0x4e'));return request({'method':_0x8560('0x34'),'uri':util['format'](_0x8560('0x4f'),_0x201e45[_0x8560('0x36')]),'qs':{'authtoken':_0x201e45[_0x8560('0x2b')],'scope':_0x8560('0x2c'),'id':_0x53a70d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x32')]['FL'][0x0]['$t']},'json':!![]});}}throw new Error(_0x8560('0x50')+JSON[_0x8560('0x41')](_0x53a70d));})[_0x8560('0x2d')](function(_0x36d57d){if(_0x36d57d[_0x8560('0x30')]){if(_0x36d57d[_0x8560('0x30')][_0x8560('0x31')]){var _0x3d4b46={};for(var _0x1279ff=0x0,_0x56f5b6=_0x36d57d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x26')]['row']['FL']['length'];_0x1279ff<_0x56f5b6;_0x1279ff++){_0x3d4b46[_0x36d57d[_0x8560('0x30')][_0x8560('0x31')][_0x8560('0x26')]['row']['FL'][_0x1279ff][_0x8560('0x46')]]=_0x36d57d[_0x8560('0x30')]['result']['Leads'][_0x8560('0x45')]['FL'][_0x1279ff][_0x8560('0x47')];}return _0x3d4b46;}}throw new Error(_0x8560('0x51')+JSON[_0x8560('0x41')](_0x36d57d));});}});}});}function request(_0x5eb234){logger['debug'](_0x8560('0x52'),JSON[_0x8560('0x41')](_0x5eb234));return rp(_0x5eb234);}function getCustomFields(_0x291dd9,_0x1d1f83){var _0x5dc155={};if(_0x291dd9[_0x8560('0x4a')]>0x0){_[_0x8560('0x53')](_0x291dd9,function(_0x14ab8d){if(_0x14ab8d[_0x8560('0x54')]==='string'&&_0x14ab8d[_0x8560('0x55')]){_0x5dc155[_0x14ab8d['idField']]=_0x14ab8d['content'][_0x8560('0x56')]();}else if(_0x14ab8d[_0x8560('0x54')]===_0x8560('0x57')&&_0x14ab8d[_0x8560('0x58')]&&_0x14ab8d['idField']&&_0x1d1f83[_0x14ab8d[_0x8560('0x58')]]){_0x5dc155[_0x14ab8d['idField']]=_0x1d1f83[_0x14ab8d['variableName']][_0x8560('0x56')]();}else if(_0x14ab8d[_0x8560('0x54')]===_0x8560('0x59')&&_0x14ab8d[_0x8560('0x5a')]&&_0x14ab8d[_0x8560('0x5a')][_0x8560('0x5b')]&&_0x14ab8d[_0x8560('0x55')]&&_0x1d1f83[_0x14ab8d[_0x8560('0x5a')]['name'][_0x8560('0x5c')]()]){_0x5dc155[_0x14ab8d['idField']]=_0x1d1f83[_0x14ab8d['Variable'][_0x8560('0x5b')][_0x8560('0x5c')]()][_0x8560('0x56')]();}});}return _0x5dc155;}function getName(_0x4df5ec){if(_0x4df5ec[_0x8560('0x5d')]('\x20')>0x0){var _0x28577b=_0x4df5ec['split'](/ (.+)/);if(_0x28577b[0x1]){return _0x28577b;}}return[_0x4df5ec,_0x4df5ec];}exports[_0x8560('0x5e')]=function(_0x435891,_0xa0325,_0x21110a,_0x4e2e1b,_0x27301e,_0x39d4e1){var _0x543593,_0x5d9a1a;if(_0x27301e&&_0x27301e[_0x8560('0x5f')]){logger[_0x8560('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0xa0325[_0x8560('0x60')]=util[_0x8560('0x13')](_0x8560('0x61'),_0x39d4e1[_0x8560('0x62')],_0xa0325[_0x8560('0x63')],md5(_0xa0325['uniqueid']));}else{_0xa0325['recordingURL']='';}return getUser(_0x39d4e1,_0x4e2e1b['email'])[_0x8560('0x2d')](function(_0x53771b){_0x543593=_0x53771b;logger[_0x8560('0xc')]('The\x20User\x20ID\x20is:',_0x543593['id']);return getEndUser(_0x39d4e1,_0xa0325[_0x8560('0x64')],_0xa0325['calleridnum']);})[_0x8560('0x2d')](function(_0x5a7abb){_0x5d9a1a=_0x5a7abb;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5d9a1a[_0x8560('0x24')]||_0x5d9a1a[_0x8560('0x25')]);return getCall(_0x39d4e1,_0x543593,_0x5d9a1a,_0x21110a,_0xa0325,'Inbound');})['then'](function(_0x1f02b7){if(_0x1f02b7){logger['info'](_0x8560('0x65'),_0x1f02b7['id']);logger['info'](_0x8560('0x66'),_0x8560('0x67'));emit(util[_0x8560('0x13')](_0x8560('0x68'),_0x4e2e1b[_0x8560('0x5b')]),_0x8560('0x69'),{'uri':util[_0x8560('0x13')](_0x8560('0x6a'),_0x39d4e1[_0x8560('0x36')],_0x1f02b7['id'])});}})['catch'](function(_0x26cdf7){logger[_0x8560('0x3f')](_0x8560('0x66'),JSON['stringify'](_0x26cdf7));});};exports['outbound']=function(_0x3fb5b6,_0x808288,_0x47c1e6,_0x2695c5,_0x2ca259,_0x46616e,_0x2ba148){var _0x36bb86,_0x2e3529;if(_0x2ba148&&_0x2ba148[_0x8560('0x6b')]&&_0x2ba148['recordingFormat']!==_0x8560('0x6c')){logger[_0x8560('0xc')](_0x8560('0x6d'),'Recording\x20is\x20enabled!');_0x808288['recordingURL']=util['format'](_0x8560('0x61'),_0x46616e[_0x8560('0x62')],_0x808288[_0x8560('0x63')],md5(_0x808288[_0x8560('0x63')]));}return getUser(_0x46616e,_0x2695c5[_0x8560('0x6e')])['then'](function(_0x123e33){_0x36bb86=_0x123e33;logger[_0x8560('0xc')](_0x8560('0x6f'),_0x36bb86['id']);return getEndUser(_0x46616e,_0x808288[_0x8560('0x70')],_0x808288[_0x8560('0x71')]);})[_0x8560('0x2d')](function(_0xf85539){_0x2e3529=_0xf85539;logger[_0x8560('0xc')](_0x8560('0x72'),_0x2e3529[_0x8560('0x24')]||_0x2e3529[_0x8560('0x25')]);return getCall(_0x46616e,_0x36bb86,_0x2e3529,_0x47c1e6,_0x808288,_0x8560('0x73'));})[_0x8560('0x2d')](function(_0x4e90c2){if(_0x4e90c2){logger[_0x8560('0xc')](_0x8560('0x65'),_0x4e90c2['id']);logger[_0x8560('0xc')](_0x8560('0x6d'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x8560('0x13')](_0x8560('0x68'),_0x2695c5[_0x8560('0x5b')]),_0x8560('0x69'),{'uri':util[_0x8560('0x13')](_0x8560('0x6a'),_0x46616e[_0x8560('0x36')],_0x4e90c2['id'])});}})[_0x8560('0x74')](function(_0x7bd687){logger[_0x8560('0x3f')](_0x8560('0x6d'),JSON[_0x8560('0x41')](_0x7bd687));});};exports['abandoned']=function(_0x29beb1,_0x536266,_0x2f57bb,_0x5359e3,_0x2a9a42,_0x26a162){var _0xd756fa,_0x5451a9;if(_0x2a9a42&&_0x2a9a42[_0x8560('0x5f')]){logger[_0x8560('0xc')]('[ABANDONED]',_0x8560('0x75'));_0x536266[_0x8560('0x60')]=util[_0x8560('0x13')](_0x8560('0x61'),_0x26a162['serverUrl'],_0x536266[_0x8560('0x63')],md5(_0x536266['uniqueid']));}else{_0x536266[_0x8560('0x60')]='';}return getUser(_0x26a162)[_0x8560('0x2d')](function(_0x18428e){_0xd756fa=_0x18428e;logger[_0x8560('0xc')](_0x8560('0x6f'),_0xd756fa['id']);return getEndUser(_0x26a162,_0x536266[_0x8560('0x64')],_0x536266['calleridnum']);})[_0x8560('0x2d')](function(_0x5cf81f){_0x5451a9=_0x5cf81f;logger[_0x8560('0xc')](_0x8560('0x72'),_0x5451a9[_0x8560('0x24')]||_0x5451a9[_0x8560('0x25')]);return getCall(_0x26a162,_0xd756fa,_0x5451a9,_0x2f57bb,_0x536266,'Inbound');})[_0x8560('0x2d')](function(_0x489505){if(_0x489505){logger['info']('The\x20Call\x20ID\x20is:',_0x489505['id']);}})['catch'](function(_0x2e309e){logger[_0x8560('0x3f')](_0x8560('0x76'),JSON[_0x8560('0x41')](_0x2e309e));});}; \ 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 1596552..0030e00 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 _0x3dfa=['data2','GET','POST','body','data7','render','then','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','catch','error','format','%s\x20%s\x20%s\x20[%s]:%s','name','message','util','mustache','../../../../config/logger','exec','data1','toUpperCase'];(function(_0x9b14ee,_0x574340){var _0xc3fa3c=function(_0x44476d){while(--_0x44476d){_0x9b14ee['push'](_0x9b14ee['shift']());}};_0xc3fa3c(++_0x574340);}(_0x3dfa,0xd6));var _0xa3df=function(_0x164e8f,_0xdba27a){_0x164e8f=_0x164e8f-0x0;var _0x2b2840=_0x3dfa[_0x164e8f];return _0x2b2840;};'use strict';var rp=require('request-promise');var util=require(_0xa3df('0x0'));var Mustache=require(_0xa3df('0x1'));var logger=require(_0xa3df('0x2'))('trigger');exports[_0xa3df('0x3')]=function(_0xc981af,_0x9087cb){var _0x2ea57b={'method':_0xc981af[_0xa3df('0x4')][_0xa3df('0x5')](),'uri':encodeURI(Mustache['render'](_0xc981af[_0xa3df('0x6')],_0x9087cb)),'json':!![],'resolveWithFullResponse':!![]};switch(_0xc981af[_0xa3df('0x4')][_0xa3df('0x5')]()){case _0xa3df('0x7'):_0x2ea57b['qs']=_0x9087cb;break;case _0xa3df('0x8'):_0x2ea57b[_0xa3df('0x9')]=_0xc981af[_0xa3df('0xa')]?Mustache[_0xa3df('0xb')](_0xc981af[_0xa3df('0xa')],_0x9087cb):_0x9087cb;break;}rp(_0x2ea57b)[_0xa3df('0xc')](function(_0x1b77fe){logger[_0xa3df('0xd')](util['format'](_0xa3df('0xe'),_0xc981af['data1'],_0xc981af[_0xa3df('0x6')],_0x1b77fe[_0xa3df('0xf')],_0x1b77fe[_0xa3df('0x9')]));})[_0xa3df('0x10')](function(_0xd11122){logger[_0xa3df('0x11')](util[_0xa3df('0x12')](_0xa3df('0x13'),_0xc981af['data1'],_0xc981af[_0xa3df('0x6')],_0xd11122[_0xa3df('0xf')],_0xd11122[_0xa3df('0x14')],_0xd11122[_0xa3df('0x15')]));});}; \ No newline at end of file +var _0x4683=['GET','POST','data7','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20body:\x20%s','statusCode','body','catch','error','name','message','trigger','exec','data1','render','data2','toUpperCase'];(function(_0x18b2bd,_0x4efc00){var _0xce6d48=function(_0xbd3eb1){while(--_0xbd3eb1){_0x18b2bd['push'](_0x18b2bd['shift']());}};_0xce6d48(++_0x4efc00);}(_0x4683,0xb5));var _0x3468=function(_0x332768,_0x50ee09){_0x332768=_0x332768-0x0;var _0x27c669=_0x4683[_0x332768];return _0x27c669;};'use strict';var rp=require('request-promise');var util=require('util');var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x3468('0x0'));exports[_0x3468('0x1')]=function(_0x596213,_0xe5ce17){var _0x10b5b1={'method':_0x596213[_0x3468('0x2')]['toUpperCase'](),'uri':encodeURI(Mustache[_0x3468('0x3')](_0x596213[_0x3468('0x4')],_0xe5ce17)),'json':!![],'resolveWithFullResponse':!![]};switch(_0x596213[_0x3468('0x2')][_0x3468('0x5')]()){case _0x3468('0x6'):_0x10b5b1['qs']=_0xe5ce17;break;case _0x3468('0x7'):_0x10b5b1['body']=_0x596213[_0x3468('0x8')]?Mustache[_0x3468('0x3')](_0x596213['data7'],_0xe5ce17):_0xe5ce17;break;}rp(_0x10b5b1)['then'](function(_0x343ce7){logger[_0x3468('0x9')](util['format'](_0x3468('0xa'),_0x596213['data1'],_0x596213[_0x3468('0x4')],_0x343ce7[_0x3468('0xb')],_0x343ce7[_0x3468('0xc')]));})[_0x3468('0xd')](function(_0x150c7f){logger[_0x3468('0xe')](util['format']('%s\x20%s\x20%s\x20[%s]:%s',_0x596213[_0x3468('0x2')],_0x596213[_0x3468('0x4')],_0x150c7f[_0x3468('0xb')],_0x150c7f[_0x3468('0xf')],_0x150c7f[_0x3468('0x10')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 1a1aa42..90ae4e6 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 _0x23ea=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','catch'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x23ea,0xc3));var _0xa23e=function(_0x3fbeef,_0x2840b4){_0x3fbeef=_0x3fbeef-0x0;var _0x14ec1f=_0x23ea[_0x3fbeef];return _0x14ec1f;};'use strict';var jayson=require(_0xa23e('0x0'));var BPromise=require(_0xa23e('0x1'));var logger=require(_0xa23e('0x2'))(_0xa23e('0x3'));var client=jayson[_0xa23e('0x4')][_0xa23e('0x5')]({'port':0x2329});client[_0xa23e('0x6')]=function(_0x3428d6,_0xf8cea8){return new BPromise(function(_0x441b2e,_0x6f7d68){return client['request'](_0x3428d6,_0xf8cea8)[_0xa23e('0x7')](function(_0x423454){logger[_0xa23e('0x8')](_0xa23e('0x9'),_0xa23e('0x3'),_0x3428d6,_0xf8cea8,_0x423454);if(_0x423454[_0xa23e('0xa')]){logger['error']('rpc',_0xa23e('0x3'),_0x3428d6,_0x423454[_0xa23e('0xa')][_0xa23e('0xb')],_0xf8cea8);return _0x6f7d68(_0x423454[_0xa23e('0xa')]['message']);}else{return _0x441b2e(_0x423454['result']);}})[_0xa23e('0xc')](function(_0x33732b){logger['error'](_0xa23e('0x9'),_0xa23e('0x3'),_0x3428d6,_0x33732b,_0xf8cea8);return _0x6f7d68(_0x33732b);});});};module['exports']=client; \ No newline at end of file +var _0x50b9=['then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0xe73228,_0x226565){var _0x3288ea=function(_0xcf0598){while(--_0xcf0598){_0xe73228['push'](_0xe73228['shift']());}};_0x3288ea(++_0x226565);}(_0x50b9,0x171));var _0x950b=function(_0x1ab683,_0x27030b){_0x1ab683=_0x1ab683-0x0;var _0x357546=_0x50b9[_0x1ab683];return _0x357546;};'use strict';var jayson=require(_0x950b('0x0'));var BPromise=require('bluebird');var logger=require(_0x950b('0x1'))('routing');var client=jayson[_0x950b('0x2')][_0x950b('0x3')]({'port':0x2329});client[_0x950b('0x4')]=function(_0x3f68be,_0x237b83){return new BPromise(function(_0x986b16,_0x23b70f){return client[_0x950b('0x5')](_0x3f68be,_0x237b83)[_0x950b('0x6')](function(_0x56ce3f){logger[_0x950b('0x7')](_0x950b('0x8'),_0x950b('0x9'),_0x3f68be,_0x237b83,_0x56ce3f);if(_0x56ce3f['error']){logger['error']('rpc',_0x950b('0x9'),_0x3f68be,_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')],_0x237b83);return _0x23b70f(_0x56ce3f[_0x950b('0xa')][_0x950b('0xb')]);}else{return _0x986b16(_0x56ce3f[_0x950b('0xc')]);}})[_0x950b('0xd')](function(_0x585c89){logger[_0x950b('0xa')](_0x950b('0x8'),'routing',_0x3f68be,_0x585c89,_0x237b83);return _0x23b70f(_0x585c89);});});};module[_0x950b('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0f27332..8eaf4c4 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 _0x028b=['listen','catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh'];(function(_0x60d16b,_0x572343){var _0x53eea3=function(_0x22ed4c){while(--_0x22ed4c){_0x60d16b['push'](_0x60d16b['shift']());}};_0x53eea3(++_0x572343);}(_0x028b,0xf3));var _0xb028=function(_0x1f7a53,_0x1bf16f){_0x1f7a53=_0x1f7a53-0x0;var _0x372cfe=_0x028b[_0x1f7a53];return _0x372cfe;};'use strict';var BPromise=require(_0xb028('0x0'));var server=require(_0xb028('0x1'));var Realtime=require(_0xb028('0x2'));var EmailChannel=require(_0xb028('0x3'));var mailAccount=require(_0xb028('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xb028('0x5')]()[_0xb028('0x6')](mailAccount['getMailAccounts']())[_0xb028('0x6')](realtime[_0xb028('0x7')]())[_0xb028('0x6')](function(){email[_0xb028('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb028('0x9')](realtime,email)['then'](function(_0x40ef2d){return initRealtime();})[_0xb028('0x6')](function(_0x4cb97a){return setInterval(initRealtime,0x2710);})[_0xb028('0xa')](function(_0x50c710){console[_0xb028('0xb')](_0x50c710);});}main(); \ No newline at end of file +var _0x02b9=['./server','./lib/email','./rpc/mailAccount','resolve','then','refresh','mailAccounts','listen','catch','log','bluebird'];(function(_0x2c7a96,_0x424b02){var _0x393ac1=function(_0x32ef44){while(--_0x32ef44){_0x2c7a96['push'](_0x2c7a96['shift']());}};_0x393ac1(++_0x424b02);}(_0x02b9,0x1ee));var _0x902b=function(_0x5d2a9d,_0x414208){_0x5d2a9d=_0x5d2a9d-0x0;var _0x39b9c9=_0x02b9[_0x5d2a9d];return _0x39b9c9;};'use strict';var BPromise=require(_0x902b('0x0'));var server=require(_0x902b('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x902b('0x2'));var mailAccount=require(_0x902b('0x3'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x902b('0x4')]()[_0x902b('0x5')](mailAccount['getMailAccounts']())[_0x902b('0x5')](realtime['initMailAccounts']())[_0x902b('0x5')](function(){email[_0x902b('0x6')](realtime[_0x902b('0x7')]);return realtime;});}function main(){return server[_0x902b('0x8')](realtime,email)['then'](function(_0x3b3f28){return initRealtime();})[_0x902b('0x5')](function(_0x516312){return setInterval(initRealtime,0x2710);})[_0x902b('0x9')](function(_0x4d28a0){console[_0x902b('0xa')](_0x4d28a0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index b300fb2..4beaed2 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 _0x29fa=['refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','error','handleImapError','disabled','connected','name','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','socket.io-emitter','./imap','../../../config/logger','email','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update'];(function(_0x3116d6,_0x2d574f){var _0x18729d=function(_0x1945a0){while(--_0x1945a0){_0x3116d6['push'](_0x3116d6['shift']());}};_0x18729d(++_0x2d574f);}(_0x29fa,0x190));var _0xa29f=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0x29fa[_0x382e89];return _0x3a1318;};'use strict';var _=require(_0xa29f('0x0'));var moment=require(_0xa29f('0x1'));var BPromise=require(_0xa29f('0x2'));var md5=require(_0xa29f('0x3'));var io=require(_0xa29f('0x4'))({'host':'localhost','port':0x18eb});var EmailImap=require(_0xa29f('0x5'));var EmailSmtp=require('./smtp');var logger=require(_0xa29f('0x6'))(_0xa29f('0x7'));var mailAccount=require(_0xa29f('0x8'));var md5Accounts={};function EmailChannel(_0x26b3b5){logger[_0xa29f('0x9')](_0xa29f('0xa'));this[_0xa29f('0xb')]=_0x26b3b5[_0xa29f('0xb')];this['imapAccounts']={};this[_0xa29f('0xc')]=new EmailSmtp();}EmailChannel[_0xa29f('0xd')][_0xa29f('0xe')]=function(_0x3c7a3a){var _0x1b98d0=this['mailAccounts'][_0x3c7a3a];var _0x2084ce={'id':_0x1b98d0['id'],'name':_0x1b98d0['name'],'key':_0x1b98d0[_0xa29f('0xf')],'active':_0x1b98d0[_0xa29f('0x10')],'Imap':{'status':_0x1b98d0[_0xa29f('0x11')][_0xa29f('0x12')],'messageStatus':_0x1b98d0[_0xa29f('0x11')][_0xa29f('0x13')],'total':_0x1b98d0[_0xa29f('0x11')][_0xa29f('0x14')]}};if(_[_0xa29f('0x15')](md5Accounts[_0x3c7a3a])){md5Accounts[_0x3c7a3a]={};}var _0x159bc9=md5(JSON[_0xa29f('0x16')](_0x2084ce));if(md5Accounts[_0x3c7a3a][_0xa29f('0x3')]!==_0x159bc9){md5Accounts[_0x3c7a3a]['md5']=_0x159bc9;io['emit'](_0xa29f('0x17'),_0x2084ce);}};EmailChannel[_0xa29f('0xd')][_0xa29f('0x18')]=function(_0x354cbd){for(var _0x10ae53 in _0x354cbd){if(_0x354cbd[_0xa29f('0x19')](_0x10ae53)){if(_0x354cbd[_0x10ae53][_0xa29f('0x11')]&&_0x354cbd[_0x10ae53][_0xa29f('0x10')]){var _0x5598b4=_0x354cbd[_0x10ae53][_0xa29f('0x11')];if(!this[_0xa29f('0x1a')][_0xa29f('0x19')](_0x5598b4['id'])){this[_0xa29f('0x1a')][_0x5598b4['id']]=new EmailImap(_0x5598b4,_0x354cbd[_0x10ae53][_0xa29f('0x7')]);this[_0xa29f('0x1a')][_0x5598b4['id']]['on'](_0xa29f('0x1b'),this[_0xa29f('0x1c')][_0xa29f('0x1d')](this,_0x10ae53));this[_0xa29f('0x1a')][_0x5598b4['id']]['on'](_0xa29f('0x7'),this[_0xa29f('0x1e')][_0xa29f('0x1d')](this,_0x10ae53));this[_0xa29f('0x1a')][_0x5598b4['id']]['on']('end',this['handleImapEnd'][_0xa29f('0x1d')](this,_0x10ae53));this[_0xa29f('0x1a')][_0x5598b4['id']]['on'](_0xa29f('0x1f'),this[_0xa29f('0x20')][_0xa29f('0x1d')](this,_0x10ae53));}}else{if(_[_0xa29f('0x15')](this[_0xa29f('0xb')][_0x10ae53][_0xa29f('0x11')])){this[_0xa29f('0xb')][_0x10ae53][_0xa29f('0x11')]={};}this[_0xa29f('0xb')][_0x10ae53][_0xa29f('0x11')][_0xa29f('0x12')]=_0xa29f('0x21');this['mailAccounts'][_0x10ae53][_0xa29f('0x11')]['messageStatus']='';this['emit'](_0x10ae53);}}}};EmailChannel[_0xa29f('0xd')]['handleImapBox']=function(_0x3c5388,_0x595d1a){if(this[_0xa29f('0xb')][_0x3c5388]){this[_0xa29f('0xb')][_0x3c5388][_0xa29f('0x11')][_0xa29f('0x12')]=_0xa29f('0x22');this[_0xa29f('0xb')][_0x3c5388][_0xa29f('0x11')][_0xa29f('0x13')]=_0x595d1a[_0xa29f('0x23')];if(_0x595d1a[_0xa29f('0x24')]){this[_0xa29f('0xb')][_0x3c5388]['Imap'][_0xa29f('0x14')]=_0x595d1a['messages'][_0xa29f('0x14')];}return this[_0xa29f('0xe')](_0x3c5388);}};EmailChannel[_0xa29f('0xd')][_0xa29f('0x1e')]=function(_0xeef04e,_0x4decd7){logger[_0xa29f('0x9')](_0xa29f('0x25'),_0x4decd7[_0xa29f('0x26')],_0x4decd7[_0xa29f('0x27')],_0x4decd7['from'],_0xeef04e);if(this[_0xa29f('0xb')][_0xeef04e]){return mailAccount[_0xa29f('0x28')](_0xeef04e,_0x4decd7)[_0xa29f('0x29')](function(_0x5dd7b7){if(_0x5dd7b7){logger[_0xa29f('0x9')](_0xa29f('0x2a'));}})['catch'](function(_0x18f318){logger[_0xa29f('0x1f')](_0xa29f('0x2b'),JSON[_0xa29f('0x16')](_0x18f318));});}};EmailChannel[_0xa29f('0xd')][_0xa29f('0x2c')]=function(_0x4b04fd){if(this['mailAccounts'][_0x4b04fd]&&this[_0xa29f('0xb')][_0x4b04fd]['Imap']){if(this['imapAccounts'][this[_0xa29f('0xb')][_0x4b04fd][_0xa29f('0x11')]['id']]){delete this[_0xa29f('0x1a')][this[_0xa29f('0xb')][_0x4b04fd][_0xa29f('0x11')]['id']];}this[_0xa29f('0xb')][_0x4b04fd][_0xa29f('0x11')][_0xa29f('0x2d')]=moment();this[_0xa29f('0xe')](_0x4b04fd);}};EmailChannel[_0xa29f('0xd')][_0xa29f('0x20')]=function(_0x3435d,_0xee2d31){if(this[_0xa29f('0xb')][_0x3435d]){this[_0xa29f('0xb')][_0x3435d][_0xa29f('0x11')]['status']=_0xa29f('0x1f');this[_0xa29f('0xb')][_0x3435d]['Imap']['messageStatus']=_0xee2d31;return this[_0xa29f('0xe')](_0x3435d);}};EmailChannel[_0xa29f('0xd')][_0xa29f('0x2e')]=function(_0x74216,_0x2b78ff){return this[_0xa29f('0xc')][_0xa29f('0x2f')](_0x74216,_0x2b78ff);};EmailChannel[_0xa29f('0xd')][_0xa29f('0x30')]=function(_0x5e428b){var _0x44b21b=this;if(this['mailAccounts'][_0x5e428b['id']]){if(_[_0xa29f('0x15')](this['mailAccounts'][_0x5e428b['id']][_0xa29f('0x31')])){this[_0xa29f('0xb')][_0x5e428b['id']][_0xa29f('0x31')]={};}this[_0xa29f('0xb')][_0x5e428b['id']][_0xa29f('0x31')][_0xa29f('0x2d')]=moment();return new BPromise(function(_0x44ef34,_0x574349){return _0x44b21b[_0xa29f('0xc')][_0xa29f('0x32')](_0x5e428b)[_0xa29f('0x29')](function(_0xdcb3ac){_0x44b21b[_0xa29f('0xb')][_0x5e428b['id']]['Smtp'][_0xa29f('0x12')]=_0xa29f('0x33');_0x44b21b['mailAccounts'][_0x5e428b['id']][_0xa29f('0x31')][_0xa29f('0x13')]='';_0x44b21b[_0xa29f('0xe')](_0x5e428b['id']);_0x44ef34(_0xdcb3ac);})['catch'](function(_0x2418d7){_0x44b21b[_0xa29f('0xb')][_0x5e428b['id']][_0xa29f('0x31')][_0xa29f('0x12')]=_0xa29f('0x1f');_0x44b21b[_0xa29f('0xb')][_0x5e428b['id']]['Smtp'][_0xa29f('0x13')]=_0x2418d7;_0x44b21b[_0xa29f('0xe')](_0x5e428b['id']);_0x574349(_0x2418d7);});});}return this[_0xa29f('0xc')]['verify'](_0x5e428b);};module[_0xa29f('0x34')]=EmailChannel; \ No newline at end of file +var _0x8a5a=['bluebird','socket.io-emitter','localhost','./imap','../../../config/logger','email','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','active','status','Imap','total','stringify','md5','mailAccount:update','prototype','hasOwnProperty','imapAccounts','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','messageStatus','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','then','verify','exports','moment'];(function(_0xbad0aa,_0x4d0d8a){var _0x564de=function(_0x4f35cf){while(--_0x4f35cf){_0xbad0aa['push'](_0xbad0aa['shift']());}};_0x564de(++_0x4d0d8a);}(_0x8a5a,0x1d3));var _0xa8a5=function(_0x323b95,_0x4aaaf0){_0x323b95=_0x323b95-0x0;var _0x246a93=_0x8a5a[_0x323b95];return _0x246a93;};'use strict';var _=require('lodash');var moment=require(_0xa8a5('0x0'));var BPromise=require(_0xa8a5('0x1'));var md5=require('md5');var io=require(_0xa8a5('0x2'))({'host':_0xa8a5('0x3'),'port':0x18eb});var EmailImap=require(_0xa8a5('0x4'));var EmailSmtp=require('./smtp');var logger=require(_0xa8a5('0x5'))(_0xa8a5('0x6'));var mailAccount=require(_0xa8a5('0x7'));var md5Accounts={};function EmailChannel(_0x3267fc){logger['info'](_0xa8a5('0x8'));this[_0xa8a5('0x9')]=_0x3267fc[_0xa8a5('0x9')];this['imapAccounts']={};this[_0xa8a5('0xa')]=new EmailSmtp();}EmailChannel['prototype'][_0xa8a5('0xb')]=function(_0x67afd8){var _0x3f9212=this[_0xa8a5('0x9')][_0x67afd8];var _0x25e48c={'id':_0x3f9212['id'],'name':_0x3f9212[_0xa8a5('0xc')],'key':_0x3f9212[_0xa8a5('0xd')],'active':_0x3f9212[_0xa8a5('0xe')],'Imap':{'status':_0x3f9212['Imap'][_0xa8a5('0xf')],'messageStatus':_0x3f9212[_0xa8a5('0x10')]['messageStatus'],'total':_0x3f9212[_0xa8a5('0x10')][_0xa8a5('0x11')]}};if(_['isNil'](md5Accounts[_0x67afd8])){md5Accounts[_0x67afd8]={};}var _0x349b94=md5(JSON[_0xa8a5('0x12')](_0x25e48c));if(md5Accounts[_0x67afd8][_0xa8a5('0x13')]!==_0x349b94){md5Accounts[_0x67afd8]['md5']=_0x349b94;io[_0xa8a5('0xb')](_0xa8a5('0x14'),_0x25e48c);}};EmailChannel[_0xa8a5('0x15')]['refresh']=function(_0x50e7a1){for(var _0x5a25c7 in _0x50e7a1){if(_0x50e7a1['hasOwnProperty'](_0x5a25c7)){if(_0x50e7a1[_0x5a25c7][_0xa8a5('0x10')]&&_0x50e7a1[_0x5a25c7]['active']){var _0x2f3e49=_0x50e7a1[_0x5a25c7][_0xa8a5('0x10')];if(!this['imapAccounts'][_0xa8a5('0x16')](_0x2f3e49['id'])){this[_0xa8a5('0x17')][_0x2f3e49['id']]=new EmailImap(_0x2f3e49,_0x50e7a1[_0x5a25c7][_0xa8a5('0x6')]);this[_0xa8a5('0x17')][_0x2f3e49['id']]['on']('box',this['handleImapBox'][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x6'),this[_0xa8a5('0x19')][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x1a'),this[_0xa8a5('0x1b')][_0xa8a5('0x18')](this,_0x5a25c7));this[_0xa8a5('0x17')][_0x2f3e49['id']]['on'](_0xa8a5('0x1c'),this[_0xa8a5('0x1d')][_0xa8a5('0x18')](this,_0x5a25c7));}}else{if(_[_0xa8a5('0x1e')](this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')])){this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')]={};}this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')][_0xa8a5('0xf')]='disabled';this[_0xa8a5('0x9')][_0x5a25c7][_0xa8a5('0x10')][_0xa8a5('0x1f')]='';this[_0xa8a5('0xb')](_0x5a25c7);}}}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x20')]=function(_0x3c17c2,_0x399c23){if(this[_0xa8a5('0x9')][_0x3c17c2]){this[_0xa8a5('0x9')][_0x3c17c2][_0xa8a5('0x10')]['status']=_0xa8a5('0x21');this['mailAccounts'][_0x3c17c2][_0xa8a5('0x10')][_0xa8a5('0x1f')]=_0x399c23[_0xa8a5('0xc')];if(_0x399c23['messages']){this[_0xa8a5('0x9')][_0x3c17c2]['Imap'][_0xa8a5('0x11')]=_0x399c23[_0xa8a5('0x22')][_0xa8a5('0x11')];}return this[_0xa8a5('0xb')](_0x3c17c2);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x19')]=function(_0x1b95af,_0x52ffca){logger['info'](_0xa8a5('0x23'),_0x52ffca[_0xa8a5('0x24')],_0x52ffca[_0xa8a5('0x25')],_0x52ffca[_0xa8a5('0x26')],_0x1b95af);if(this[_0xa8a5('0x9')][_0x1b95af]){return mailAccount[_0xa8a5('0x27')](_0x1b95af,_0x52ffca)['then'](function(_0x18d801){if(_0x18d801){logger[_0xa8a5('0x28')](_0xa8a5('0x29'));}})[_0xa8a5('0x2a')](function(_0x547081){logger[_0xa8a5('0x1c')](_0xa8a5('0x2b'),JSON[_0xa8a5('0x12')](_0x547081));});}};EmailChannel['prototype'][_0xa8a5('0x1b')]=function(_0xbb8c93){if(this['mailAccounts'][_0xbb8c93]&&this['mailAccounts'][_0xbb8c93][_0xa8a5('0x10')]){if(this[_0xa8a5('0x17')][this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')]['id']]){delete this['imapAccounts'][this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')]['id']];}this[_0xa8a5('0x9')][_0xbb8c93][_0xa8a5('0x10')][_0xa8a5('0x2c')]=moment();this[_0xa8a5('0xb')](_0xbb8c93);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x1d')]=function(_0x2b8c76,_0x57fa86){if(this[_0xa8a5('0x9')][_0x2b8c76]){this[_0xa8a5('0x9')][_0x2b8c76][_0xa8a5('0x10')]['status']=_0xa8a5('0x1c');this[_0xa8a5('0x9')][_0x2b8c76][_0xa8a5('0x10')][_0xa8a5('0x1f')]=_0x57fa86;return this['emit'](_0x2b8c76);}};EmailChannel[_0xa8a5('0x15')][_0xa8a5('0x2d')]=function(_0x14d957,_0x3216d4){return this[_0xa8a5('0xa')][_0xa8a5('0x2e')](_0x14d957,_0x3216d4);};EmailChannel['prototype'][_0xa8a5('0x2f')]=function(_0x1e07c1){var _0x57f3ec=this;if(this['mailAccounts'][_0x1e07c1['id']]){if(_[_0xa8a5('0x1e')](this[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'])){this[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')]={};}this[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x2c')]=moment();return new BPromise(function(_0x138915,_0x5771a6){return _0x57f3ec[_0xa8a5('0xa')]['verify'](_0x1e07c1)[_0xa8a5('0x31')](function(_0x736076){_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'][_0xa8a5('0xf')]='verified';_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x1f')]='';_0x57f3ec[_0xa8a5('0xb')](_0x1e07c1['id']);_0x138915(_0x736076);})[_0xa8a5('0x2a')](function(_0x5d149a){_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']]['Smtp'][_0xa8a5('0xf')]=_0xa8a5('0x1c');_0x57f3ec[_0xa8a5('0x9')][_0x1e07c1['id']][_0xa8a5('0x30')][_0xa8a5('0x1f')]=_0x5d149a;_0x57f3ec['emit'](_0x1e07c1['id']);_0x5771a6(_0x5d149a);});});}return this[_0xa8a5('0xa')][_0xa8a5('0x32')](_0x1e07c1);};module[_0xa8a5('0x33')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c363567..abb42ff 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 _0x19e1=['handleSimpleParser','emit','parser','handleFetchEnd','stringify','textCode','upperFirst','path','util','imap','lodash','simpleParser','events','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','once','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','anonymous@xcally.com','handleOpenBox','box','readUnseen','handleCloseBox','search','handleReadUnseen','fetch','message','handleFetchMessage','error','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd'];(function(_0x5ce6f1,_0xb0aa10){var _0x250fe2=function(_0x21d3e7){while(--_0x21d3e7){_0x5ce6f1['push'](_0x5ce6f1['shift']());}};_0x250fe2(++_0xb0aa10);}(_0x19e1,0x163));var _0x119e=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x19e1[_0x3b7b8a];return _0x441206;};'use strict';var fs=require('fs');var path=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var Imap=require(_0x119e('0x2'));var _=require(_0x119e('0x3'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0x119e('0x4')];var EventEmitter=require(_0x119e('0x5'))['EventEmitter'];var utils=require(_0x119e('0x6'));var logger=require(_0x119e('0x7'))('email');function EmailImap(_0x2ce0a3,_0x5a6b88){this[_0x119e('0x8')]=_0x119e('0x9');this[_0x119e('0xa')]=this[_0x119e('0xb')](_0x2ce0a3,_0x5a6b88);this['imap']=new Imap(this[_0x119e('0xa')]);this[_0x119e('0x2')][_0x119e('0xc')]('ready',this['handleReady'][_0x119e('0xd')](this));this[_0x119e('0x2')][_0x119e('0xc')](_0x119e('0xe'),this[_0x119e('0xf')][_0x119e('0xd')](this));this[_0x119e('0x2')]['on']('error',this[_0x119e('0x10')][_0x119e('0xd')](this));this[_0x119e('0x2')][_0x119e('0x11')]();}util[_0x119e('0x12')](EmailImap,EventEmitter);EmailImap[_0x119e('0x13')]['getAccount']=function(_0x1d46eb,_0x8a9fad){var _0x1c6fd5={'connTimeout':_0x1d46eb[_0x119e('0x14')]?_0x1d46eb[_0x119e('0x14')]*0x3e8:0x2710,'authTimeout':_0x1d46eb[_0x119e('0x15')]?_0x1d46eb[_0x119e('0x15')]*0x3e8:0x1388};if(_[_0x119e('0x16')](_0x1d46eb[_0x119e('0x17')])){if(_0x1d46eb[_0x119e('0x18')]){_0x1c6fd5[_0x119e('0x19')]=_0x1d46eb['user'];_0x1c6fd5[_0x119e('0x1a')]=_0x1d46eb[_0x119e('0x1a')];}_0x1c6fd5[_0x119e('0x1b')]=_0x1d46eb[_0x119e('0x1b')];_0x1c6fd5[_0x119e('0x1c')]=_0x1d46eb[_0x119e('0x1c')]||0x3e1;if(_0x1d46eb[_0x119e('0x1d')]){_0x1c6fd5[_0x119e('0x1d')]=!![];}else{_0x1c6fd5[_0x119e('0x1d')]=![];_0x1c6fd5[_0x119e('0x1e')]=_0x119e('0x1f');}}else{_0x1c6fd5['user']=_0x1d46eb[_0x119e('0x19')];_0x1c6fd5['password']=_0x1d46eb[_0x119e('0x1a')];_0x1c6fd5['host']=utils[_0x119e('0x20')](_0x1d46eb[_0x119e('0x17')]);_0x1c6fd5['port']=0x3e1;_0x1c6fd5['tls']=!![];}_0x1c6fd5[_0x119e('0x21')]=_0x8a9fad||_0x1d46eb[_0x119e('0x19')]||_0x119e('0x22');return _0x1c6fd5;};EmailImap['prototype']['handleReady']=function(){this[_0x119e('0x2')]['openBox'](this[_0x119e('0x8')],![],this[_0x119e('0x23')][_0x119e('0xd')](this));};EmailImap['prototype'][_0x119e('0x23')]=function(_0x59fc43,_0x1e2dd8){if(_0x59fc43){this['handleError'](_0x59fc43,!![]);}else{this['emit'](_0x119e('0x24'),_0x1e2dd8);this[_0x119e('0x25')]();}};EmailImap[_0x119e('0x13')][_0x119e('0x26')]=function(_0x476f0){if(_0x476f0){this[_0x119e('0x10')](_0x476f0,!![]);}else{this['imap'][_0x119e('0xe')]();}};EmailImap[_0x119e('0x13')]['readUnseen']=function(){this[_0x119e('0x2')][_0x119e('0x27')](['UNSEEN'],this[_0x119e('0x28')]['bind'](this));};EmailImap[_0x119e('0x13')][_0x119e('0x28')]=function(_0x4211fb,_0x1e122a){if(_0x4211fb){this[_0x119e('0x10')](_0x4211fb,!![]);}else{if(_0x1e122a['length']){try{var _0x1853f9=this[_0x119e('0x2')][_0x119e('0x29')](_0x1e122a,{'bodies':'','markSeen':!![]});_0x1853f9['on'](_0x119e('0x2a'),this[_0x119e('0x2b')][_0x119e('0xd')](this));_0x1853f9['once']('error',this['handleFetchError']['bind'](this));_0x1853f9[_0x119e('0xc')](_0x119e('0xe'),this['handleFetchEnd']['bind'](this));}catch(_0x3cc2cc){logger[_0x119e('0x2c')](_0x3cc2cc);}}else{this['imap'][_0x119e('0x2d')](!![],this[_0x119e('0x26')]['bind'](this));}}};EmailImap[_0x119e('0x13')][_0x119e('0x2b')]=function(_0x1f629f,_0x1b4458){_0x1f629f['on'](_0x119e('0x2e'),this[_0x119e('0x2f')][_0x119e('0xd')](this));_0x1f629f[_0x119e('0xc')](_0x119e('0x30'),this[_0x119e('0x31')][_0x119e('0xd')](this));_0x1f629f[_0x119e('0xc')](_0x119e('0xe'),this[_0x119e('0x32')][_0x119e('0xd')](this));};EmailImap['prototype'][_0x119e('0x2f')]=function(_0x247826,_0x42f2ab){simpleParser(_0x247826,this['handleSimpleParser'][_0x119e('0xd')](this));};EmailImap[_0x119e('0x13')][_0x119e('0x31')]=function(_0x2d661c){};EmailImap[_0x119e('0x13')]['handleMessageEnd']=function(){};EmailImap['prototype'][_0x119e('0x33')]=function(_0x39a9fd,_0x42b89d){if(_0x39a9fd){logger[_0x119e('0x2c')](_0x39a9fd);}else{this[_0x119e('0x34')](_0x119e('0x21'),utils[_0x119e('0x35')](this['account'],_0x42b89d));}};EmailImap['prototype'][_0x119e('0x36')]=function(){this['imap']['closeBox'](!![],this[_0x119e('0x26')]['bind'](this));};EmailImap['prototype']['handleFetchError']=function(_0x617e53){this[_0x119e('0x10')](_0x617e53);this[_0x119e('0x2')][_0x119e('0x2d')](!![],this[_0x119e('0x26')][_0x119e('0xd')](this));};EmailImap[_0x119e('0x13')][_0x119e('0xf')]=function(){this[_0x119e('0x34')](_0x119e('0xe'));};EmailImap[_0x119e('0x13')][_0x119e('0x10')]=function(_0x24abdd,_0x3a1ada){logger['error'](_0x119e('0x10'),this[_0x119e('0xa')][_0x119e('0x21')],JSON[_0x119e('0x37')](_0x24abdd));var _0x3f10bd='';if(_0x24abdd){if(_0x24abdd[_0x119e('0x38')]){_0x3f10bd=_0x24abdd['textCode'];}else{for(var _0x14880d in _0x24abdd){if(_0x24abdd['hasOwnProperty'](_0x14880d)){_0x3f10bd+=_[_0x119e('0x39')](_0x14880d)+':\x20'+_0x24abdd[_0x14880d]+'\x0a';}}}}if(_0x3a1ada){this[_0x119e('0x2')][_0x119e('0xe')]();}else{this[_0x119e('0x34')](_0x119e('0x2c'),_0x3f10bd);this[_0x119e('0x34')](_0x119e('0xe'));}};module['exports']=EmailImap; \ No newline at end of file +var _0xb7e7=['host','port','tls','autotls','required','getHost','service','email','anonymous@xcally.com','prototype','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','emit','parser','textCode','hasOwnProperty','upperFirst','exports','path','imap','randomstring','simpleParser','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','getAccount','account','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','authentication','user','password'];(function(_0x41a15d,_0x1a3ab7){var _0x1b893a=function(_0x5ee647){while(--_0x5ee647){_0x41a15d['push'](_0x41a15d['shift']());}};_0x1b893a(++_0x1a3ab7);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb7e7[_0x3947c9];return _0x2e7871;};'use strict';var fs=require('fs');var path=require(_0x7b7e('0x0'));var util=require('util');var Imap=require(_0x7b7e('0x1'));var _=require('lodash');var rs=require(_0x7b7e('0x2'));var simpleParser=require('mailparser')[_0x7b7e('0x3')];var EventEmitter=require('events')[_0x7b7e('0x4')];var utils=require(_0x7b7e('0x5'));var logger=require(_0x7b7e('0x6'))('email');function EmailImap(_0x53ed64,_0x333fa4){this[_0x7b7e('0x7')]=_0x7b7e('0x8');this['account']=this[_0x7b7e('0x9')](_0x53ed64,_0x333fa4);this[_0x7b7e('0x1')]=new Imap(this[_0x7b7e('0xa')]);this[_0x7b7e('0x1')][_0x7b7e('0xb')](_0x7b7e('0xc'),this[_0x7b7e('0xd')]['bind'](this));this[_0x7b7e('0x1')][_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0xf')][_0x7b7e('0x10')](this));this[_0x7b7e('0x1')]['on'](_0x7b7e('0x11'),this[_0x7b7e('0x12')][_0x7b7e('0x10')](this));this['imap'][_0x7b7e('0x13')]();}util[_0x7b7e('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0x7b7e('0x9')]=function(_0x5976ac,_0x4c6011){var _0x2889ed={'connTimeout':_0x5976ac[_0x7b7e('0x15')]?_0x5976ac[_0x7b7e('0x15')]*0x3e8:0x2710,'authTimeout':_0x5976ac[_0x7b7e('0x16')]?_0x5976ac[_0x7b7e('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x5976ac['service'])){if(_0x5976ac[_0x7b7e('0x17')]){_0x2889ed[_0x7b7e('0x18')]=_0x5976ac[_0x7b7e('0x18')];_0x2889ed[_0x7b7e('0x19')]=_0x5976ac[_0x7b7e('0x19')];}_0x2889ed[_0x7b7e('0x1a')]=_0x5976ac[_0x7b7e('0x1a')];_0x2889ed[_0x7b7e('0x1b')]=_0x5976ac[_0x7b7e('0x1b')]||0x3e1;if(_0x5976ac[_0x7b7e('0x1c')]){_0x2889ed[_0x7b7e('0x1c')]=!![];}else{_0x2889ed[_0x7b7e('0x1c')]=![];_0x2889ed[_0x7b7e('0x1d')]=_0x7b7e('0x1e');}}else{_0x2889ed[_0x7b7e('0x18')]=_0x5976ac[_0x7b7e('0x18')];_0x2889ed[_0x7b7e('0x19')]=_0x5976ac['password'];_0x2889ed[_0x7b7e('0x1a')]=utils[_0x7b7e('0x1f')](_0x5976ac[_0x7b7e('0x20')]);_0x2889ed['port']=0x3e1;_0x2889ed[_0x7b7e('0x1c')]=!![];}_0x2889ed[_0x7b7e('0x21')]=_0x4c6011||_0x5976ac[_0x7b7e('0x18')]||_0x7b7e('0x22');return _0x2889ed;};EmailImap[_0x7b7e('0x23')][_0x7b7e('0xd')]=function(){this[_0x7b7e('0x1')][_0x7b7e('0x24')](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x25')]=function(_0x23bfa3,_0x483c6f){if(_0x23bfa3){this['handleError'](_0x23bfa3,!![]);}else{this['emit'](_0x7b7e('0x26'),_0x483c6f);this[_0x7b7e('0x27')]();}};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x28')]=function(_0x3ceaf5){if(_0x3ceaf5){this['handleError'](_0x3ceaf5,!![]);}else{this[_0x7b7e('0x1')][_0x7b7e('0xe')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x7b7e('0x29')]([_0x7b7e('0x2a')],this['handleReadUnseen'][_0x7b7e('0x10')](this));};EmailImap['prototype'][_0x7b7e('0x2b')]=function(_0xb9b6bf,_0x27b525){if(_0xb9b6bf){this['handleError'](_0xb9b6bf,!![]);}else{if(_0x27b525[_0x7b7e('0x2c')]){try{var _0xe31336=this[_0x7b7e('0x1')][_0x7b7e('0x2d')](_0x27b525,{'bodies':'','markSeen':!![]});_0xe31336['on'](_0x7b7e('0x2e'),this['handleFetchMessage'][_0x7b7e('0x10')](this));_0xe31336['once'](_0x7b7e('0x11'),this[_0x7b7e('0x2f')][_0x7b7e('0x10')](this));_0xe31336[_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0x30')][_0x7b7e('0x10')](this));}catch(_0x4bfe7f){logger['error'](_0x4bfe7f);}}else{this[_0x7b7e('0x1')][_0x7b7e('0x31')](!![],this['handleCloseBox'][_0x7b7e('0x10')](this));}}};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x32')]=function(_0x48e255,_0x330b1d){_0x48e255['on'](_0x7b7e('0x33'),this[_0x7b7e('0x34')][_0x7b7e('0x10')](this));_0x48e255[_0x7b7e('0xb')](_0x7b7e('0x35'),this[_0x7b7e('0x36')][_0x7b7e('0x10')](this));_0x48e255[_0x7b7e('0xb')](_0x7b7e('0xe'),this[_0x7b7e('0x37')][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x34')]=function(_0x116563,_0x279f46){simpleParser(_0x116563,this['handleSimpleParser'][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x36')]=function(_0x242609){};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x37')]=function(){};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x38')]=function(_0x1c6d11,_0x18011c){if(_0x1c6d11){logger['error'](_0x1c6d11);}else{this[_0x7b7e('0x39')](_0x7b7e('0x21'),utils[_0x7b7e('0x3a')](this[_0x7b7e('0xa')],_0x18011c));}};EmailImap['prototype'][_0x7b7e('0x30')]=function(){this[_0x7b7e('0x1')][_0x7b7e('0x31')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x7b7e('0x23')]['handleFetchError']=function(_0x35382c){this[_0x7b7e('0x12')](_0x35382c);this['imap'][_0x7b7e('0x31')](!![],this[_0x7b7e('0x28')][_0x7b7e('0x10')](this));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0xf')]=function(){this[_0x7b7e('0x39')](_0x7b7e('0xe'));};EmailImap[_0x7b7e('0x23')][_0x7b7e('0x12')]=function(_0x525a74,_0x5d61c1){logger[_0x7b7e('0x11')]('handleError',this[_0x7b7e('0xa')]['email'],JSON['stringify'](_0x525a74));var _0x356db0='';if(_0x525a74){if(_0x525a74['textCode']){_0x356db0=_0x525a74[_0x7b7e('0x3b')];}else{for(var _0x52051c in _0x525a74){if(_0x525a74[_0x7b7e('0x3c')](_0x52051c)){_0x356db0+=_[_0x7b7e('0x3d')](_0x52051c)+':\x20'+_0x525a74[_0x52051c]+'\x0a';}}}}if(_0x5d61c1){this[_0x7b7e('0x1')][_0x7b7e('0xe')]();}else{this['emit'](_0x7b7e('0x11'),_0x356db0);this[_0x7b7e('0x39')](_0x7b7e('0xe'));}};module[_0x7b7e('0x3e')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 56a34d9..7b638ac 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 _0x7d1d=['nodemailer','bluebird','prototype','send','sendMail','verify','createTransport','toString','Not\x20verifired','exports'];(function(_0x41d32a,_0xaaa183){var _0x220391=function(_0x3589b9){while(--_0x3589b9){_0x41d32a['push'](_0x41d32a['shift']());}};_0x220391(++_0xaaa183);}(_0x7d1d,0x17c));var _0xd7d1=function(_0x533132,_0xf5b6fa){_0x533132=_0x533132-0x0;var _0x1a7447=_0x7d1d[_0x533132];return _0x1a7447;};'use strict';var nodemailer=require(_0xd7d1('0x0'));var BPromise=require(_0xd7d1('0x1'));function EmailSmtp(){}EmailSmtp[_0xd7d1('0x2')][_0xd7d1('0x3')]=function(_0x6f1860,_0x1ebf6c){return new BPromise(function(_0x3f93da,_0x5d886d){var _0x2eaf60=nodemailer['createTransport'](_0x6f1860);_0x2eaf60[_0xd7d1('0x4')](_0x1ebf6c,function(_0x2941c7,_0x1d3cde){if(_0x2941c7){_0x5d886d(_0x2941c7['toString']());}else{_0x3f93da(_0x1d3cde);}});});};EmailSmtp[_0xd7d1('0x2')][_0xd7d1('0x5')]=function(_0x16db3a){return new BPromise(function(_0x4b39d3,_0xafc435){var _0x4007f3=nodemailer[_0xd7d1('0x6')](_0x16db3a);_0x4007f3['verify'](function(_0x18bdac,_0x9e007c){if(_0x18bdac){_0xafc435(_0x18bdac[_0xd7d1('0x7')]());}else{if(_0x9e007c){_0x4b39d3(_0x9e007c);}else{_0xafc435(_0xd7d1('0x8'));}}});});};module[_0xd7d1('0x9')]=EmailSmtp; \ No newline at end of file +var _0x127a=['toString','prototype','verify','Not\x20verifired','exports','nodemailer','sendMail'];(function(_0x3be1a3,_0x4aa713){var _0x2e81b7=function(_0x1d2651){while(--_0x1d2651){_0x3be1a3['push'](_0x3be1a3['shift']());}};_0x2e81b7(++_0x4aa713);}(_0x127a,0xde));var _0xa127=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x127a[_0x243b59];return _0x3e1676;};'use strict';var nodemailer=require(_0xa127('0x0'));var BPromise=require('bluebird');function EmailSmtp(){}EmailSmtp['prototype']['send']=function(_0x16a68c,_0x67315a){return new BPromise(function(_0x39cca9,_0x250677){var _0x4dace3=nodemailer['createTransport'](_0x16a68c);_0x4dace3[_0xa127('0x1')](_0x67315a,function(_0x3e790b,_0x5aca9e){if(_0x3e790b){_0x250677(_0x3e790b[_0xa127('0x2')]());}else{_0x39cca9(_0x5aca9e);}});});};EmailSmtp[_0xa127('0x3')][_0xa127('0x4')]=function(_0x282e93){return new BPromise(function(_0x5453e5,_0x8a257a){var _0xa748e8=nodemailer['createTransport'](_0x282e93);_0xa748e8[_0xa127('0x4')](function(_0x448230,_0x4686c4){if(_0x448230){_0x8a257a(_0x448230['toString']());}else{if(_0x4686c4){_0x5453e5(_0x4686c4);}else{_0x8a257a(_0xa127('0x5'));}}});});};module[_0xa127('0x6')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e700481..a41faec 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 _0x38a0=['message','isEmpty','originTo','includes','originCc','attach','attachments','type','filename','attachment-','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','getHost','gmail','imap.gmail.com','yahoo','outlook365','moment','randomstring','path','util','../../../config/logger','../../../config/environment','head','value','address','anonymous','name','split','length','slice','join','pop','generate','@xcally.com','parser','from','email','subject','messageId','inReplyTo','date','format','YYYY-MM-DD\x20HH:mm:ss','html','test','replace','body','textAsHtml','0x1?_0x214d08[_0x038a('0xf')]():'';}return'';}function getMails(_0x2c2598,_0x2560c3){var _0x443388='';for(var _0x3e63dd=0x0;_0x3e63dd<_0x2560c3[_0x038a('0x7')][_0x038a('0xc')];_0x3e63dd+=0x1){if(_0x2560c3['value'][_0x3e63dd][_0x038a('0x8')]!==_0x2c2598){if(!_['isEmpty'](_0x443388)){_0x443388+=',';}_0x443388+=_0x2560c3['value'][_0x3e63dd][_0x038a('0xa')]||_0x2560c3[_0x038a('0x7')][_0x3e63dd][_0x038a('0x8')]||'';_0x443388+='\x20<';_0x443388+=_0x2560c3[_0x038a('0x7')][_0x3e63dd][_0x038a('0x8')]?_0x2560c3[_0x038a('0x7')][_0x3e63dd][_0x038a('0x8')]:_0x038a('0x9')+random[_0x038a('0x10')](0x6)+_0x038a('0x11');_0x443388+='>';}}return _0x443388;}exports[_0x038a('0x12')]=function(_0x28725a,_0x16e712){var _0xdf5d9c={'from':getAddress(_0x16e712[_0x038a('0x13')]),'firstName':getFirstName(_0x16e712['from']),'lastName':getLastName(_0x16e712[_0x038a('0x13')]),'mapKey':'email','message':{'from':getMails(_0x28725a[_0x038a('0x14')],_0x16e712[_0x038a('0x13')]),'to':_0x28725a[_0x038a('0x14')],'cc':'','subject':_0x16e712[_0x038a('0x15')]||'','messageId':_0x16e712[_0x038a('0x16')],'inReplyTo':_0x16e712[_0x038a('0x17')],'sentAt':moment(_0x16e712[_0x038a('0x18')])[_0x038a('0x19')](_0x038a('0x1a')),'attach':![],'attachments':[]}};if(_0x16e712[_0x038a('0x1b')]){var _0x526a3d=/)<[^<]*)*<\/script>/gi;while(_0x526a3d[_0x038a('0x1c')](_0x16e712['html'])){_0x16e712[_0x038a('0x1b')]=_0x16e712[_0x038a('0x1b')][_0x038a('0x1d')](_0x526a3d,'');}_0xdf5d9c[_0x038a('0x1e')]=_0x16e712[_0x038a('0x1b')];}else{_0xdf5d9c[_0x038a('0x1e')]=_0x16e712[_0x038a('0x1f')];}if(_0xdf5d9c[_0x038a('0x1e')]){_0xdf5d9c['body']=_0xdf5d9c[_0x038a('0x1e')][_0x038a('0x1d')](/0x1?_0x24c1b8[_0xee01('0x10')]():'';}return'';}function getMails(_0xdd9cdb,_0x2f49e4){var _0x24feb8='';for(var _0x56bc63=0x0;_0x56bc63<_0x2f49e4[_0xee01('0x9')][_0xee01('0x11')];_0x56bc63+=0x1){if(_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]!==_0xdd9cdb){if(!_[_0xee01('0x12')](_0x24feb8)){_0x24feb8+=',';}_0x24feb8+=_0x2f49e4['value'][_0x56bc63][_0xee01('0xd')]||_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]||'';_0x24feb8+='\x20<';_0x24feb8+=_0x2f49e4[_0xee01('0x9')][_0x56bc63][_0xee01('0xa')]?_0x2f49e4[_0xee01('0x9')][_0x56bc63]['address']:_0xee01('0x13')+random[_0xee01('0xb')](0x6)+'@xcally.com';_0x24feb8+='>';}}return _0x24feb8;}exports[_0xee01('0x14')]=function(_0x24e634,_0x162806){var _0x5a068b={'from':getAddress(_0x162806[_0xee01('0x15')]),'firstName':getFirstName(_0x162806['from']),'lastName':getLastName(_0x162806[_0xee01('0x15')]),'mapKey':_0xee01('0x6'),'message':{'from':getMails(_0x24e634['email'],_0x162806['from']),'to':_0x24e634[_0xee01('0x6')],'cc':'','subject':_0x162806[_0xee01('0x16')]||'','messageId':_0x162806['messageId'],'inReplyTo':_0x162806[_0xee01('0x17')],'sentAt':moment(_0x162806['date'])[_0xee01('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(_0x162806['html']){var _0x290998=/)<[^<]*)*<\/script>/gi;while(_0x290998['test'](_0x162806['html'])){_0x162806['html']=_0x162806[_0xee01('0x19')]['replace'](_0x290998,'');}_0x5a068b[_0xee01('0x1a')]=_0x162806[_0xee01('0x19')];}else{_0x5a068b[_0xee01('0x1a')]=_0x162806['textAsHtml'];}if(_0x5a068b[_0xee01('0x1a')]){_0x5a068b[_0xee01('0x1a')]=_0x5a068b[_0xee01('0x1a')]['replace'](/0x0){if(this[_0x3fe0ae+_0x9ee0('0x20')]>0x0&&this[_0x3fe0ae+'CurrentCapacity']>=this[_0x3fe0ae+_0x9ee0('0x20')]){return'maxcapacity';}else{return _0x9ee0('0x21');}}else{return _0x9ee0('0x22');}};Agent[_0x9ee0('0x23')]['updateRealtime']=function(){var _0x168332=[_0x9ee0('0x24'),_0x9ee0('0x25'),'openchannel',_0x9ee0('0x26'),_0x9ee0('0x27')];for(var _0x54096e=0x0;_0x54096e<_0x168332[_0x9ee0('0x28')];_0x54096e+=0x1){var _0x37e984=this['getChannelStatus'](_0x168332[_0x54096e]);if(this[_0x168332[_0x54096e]+_0x9ee0('0x29')]!==_0x37e984){this[_0x168332[_0x54096e]+_0x9ee0('0x2a')]=_[_0x9ee0('0x2b')](moment()[_0x9ee0('0x2c')]('x'));}this[_0x168332[_0x54096e]+_0x9ee0('0x29')]=_0x37e984;}io['emit'](_0x9ee0('0x2d'),this);};module['exports']=Agent; \ No newline at end of file +var _0x7d08=['mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','length','Status','StatusTime','toNumber','format','emit','exports','moment','socket.io-emitter','localhost','name','online','voicePause','chatPause'];(function(_0x43daa8,_0x2b964e){var _0x42a182=function(_0x16a94b){while(--_0x16a94b){_0x43daa8['push'](_0x43daa8['shift']());}};_0x42a182(++_0x2b964e);}(_0x7d08,0x134));var _0x87d0=function(_0x54190b,_0x1575fa){_0x54190b=_0x54190b-0x0;var _0x365ecd=_0x7d08[_0x54190b];return _0x365ecd;};'use strict';var _=require('lodash');var moment=require(_0x87d0('0x0'));var io=require(_0x87d0('0x1'))({'host':_0x87d0('0x2'),'port':0x18eb});function Agent(_0x507e23){this['id']=_0x507e23['id']||0x0;this[_0x87d0('0x3')]=_0x507e23['name']||'';this['online']=_0x507e23[_0x87d0('0x4')]||!![];this[_0x87d0('0x5')]=_0x507e23['voicePause']||![];this[_0x87d0('0x6')]=_0x507e23[_0x87d0('0x6')]||![];this['mailPause']=_0x507e23[_0x87d0('0x7')]||![];this[_0x87d0('0x8')]=_0x507e23['faxPause']||![];this[_0x87d0('0x9')]=_0x507e23[_0x87d0('0x9')]||![];this[_0x87d0('0xa')]=_0x507e23[_0x87d0('0xa')]||![];this[_0x87d0('0xb')]=_0x87d0('0xc');this[_0x87d0('0xd')]=0x0;this[_0x87d0('0xe')]=_0x507e23[_0x87d0('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x87d0('0xc');this[_0x87d0('0xf')]=0x0;this['mailCapacity']=_0x507e23['mailCapacity']||0x0;this[_0x87d0('0x10')]=0x0;this[_0x87d0('0x11')]=_0x87d0('0xc');this['faxStatusTime']=0x0;this[_0x87d0('0x12')]=_0x507e23[_0x87d0('0x12')]||0x0;this[_0x87d0('0x13')]=0x0;this['smsStatus']=_0x87d0('0xc');this[_0x87d0('0x14')]=0x0;this[_0x87d0('0x15')]=_0x507e23[_0x87d0('0x15')]||0x0;this[_0x87d0('0x16')]=0x0;this[_0x87d0('0x17')]=_0x87d0('0xc');this[_0x87d0('0x18')]=0x0;this[_0x87d0('0x19')]=_0x507e23['openchannelCapacity']||0x0;this[_0x87d0('0x1a')]=0x0;this[_0x87d0('0x1b')]=![];this[_0x87d0('0x1c')]=undefined;this[_0x87d0('0x1d')]();}Agent[_0x87d0('0x1e')][_0x87d0('0x1f')]=function(_0x1964a3){if(this[_0x1964a3+_0x87d0('0x20')]>0x0){if(this[_0x1964a3+'Capacity']>0x0&&this[_0x1964a3+_0x87d0('0x20')]>=this[_0x1964a3+_0x87d0('0x21')]){return _0x87d0('0x22');}else{return _0x87d0('0x23');}}else{return _0x87d0('0x24');}};Agent[_0x87d0('0x1e')]['updateRealtime']=function(){var _0x3d4f17=[_0x87d0('0x25'),'chat','openchannel','fax','sms'];for(var _0x173e46=0x0;_0x173e46<_0x3d4f17[_0x87d0('0x26')];_0x173e46+=0x1){var _0x59d9d9=this[_0x87d0('0x1f')](_0x3d4f17[_0x173e46]);if(this[_0x3d4f17[_0x173e46]+_0x87d0('0x27')]!==_0x59d9d9){this[_0x3d4f17[_0x173e46]+_0x87d0('0x28')]=_[_0x87d0('0x29')](moment()[_0x87d0('0x2a')]('x'));}this[_0x3d4f17[_0x173e46]+_0x87d0('0x27')]=_0x59d9d9;}io[_0x87d0('0x2b')]('user:save',this);};module[_0x87d0('0x2c')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index ac114df..26bc82e 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 _0xcb91=['waiting','md5','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','length','online','chatPause','paused','available','format','chat:queue:%s','emit','chat_queue:save','util','socket.io-emitter','localhost','name','timeout','strategy','Agents'];(function(_0x573b53,_0x4edc29){var _0x562679=function(_0x534dcb){while(--_0x534dcb){_0x573b53['push'](_0x573b53['shift']());}};_0x562679(++_0x4edc29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x156a0d,_0x3946ce){_0x156a0d=_0x156a0d-0x0;var _0x98a9ba=_0xcb91[_0x156a0d];return _0x98a9ba;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x1cb9('0x0'));var io=require(_0x1cb9('0x1'))({'host':_0x1cb9('0x2'),'port':0x18eb});function ChatQueue(_0x22c4b8){this['id']=_0x22c4b8['id']||0x0;this['name']=_0x22c4b8[_0x1cb9('0x3')]||'';this[_0x1cb9('0x4')]=_0x22c4b8['timeout']||0xa;this[_0x1cb9('0x5')]=_0x22c4b8[_0x1cb9('0x5')]||'beepall';this[_0x1cb9('0x6')]=_0x22c4b8[_0x1cb9('0x6')];this['mapAgentsId']={};this[_0x1cb9('0x7')]=0x0;this[_0x1cb9('0x8')]='';this['updateRouting']();this[_0x1cb9('0x9')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x45a12f=this[_0x1cb9('0xa')][_0x1cb9('0xb')];this[_0x1cb9('0xa')]=_[_0x1cb9('0xc')](this['Agents'],'id');this[_0x1cb9('0xa')][_0x1cb9('0xb')]=_0x45a12f;};ChatQueue[_0x1cb9('0xd')][_0x1cb9('0x9')]=function(){this[_0x1cb9('0xe')]=0x0;this['paused']=0x0;for(var _0x5e3c19=0x0;_0x5e3c19=0x0?this[_0x1cb9('0x13')]:0x0;var _0x3cc765={'id':this['id'],'available':this[_0x1cb9('0x13')],'loggedIn':this[_0x1cb9('0xe')],'name':this[_0x1cb9('0x3')],'paused':this[_0x1cb9('0x12')],'waiting':this[_0x1cb9('0x7')]};var _0x4e1340=md5(JSON['stringify'](_0x3cc765));if(this[_0x1cb9('0x8')]!==_0x4e1340){this[_0x1cb9('0x8')]=_0x4e1340;io['to'](util[_0x1cb9('0x14')](_0x1cb9('0x15'),_0x3cc765[_0x1cb9('0x3')]))[_0x1cb9('0x16')](_0x1cb9('0x17'),_0x3cc765);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa9e0=['_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','name','timeout','strategy','Agents','mapAgentsId','updateRouting'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function ChatQueue(_0x18d5c9){this['id']=_0x18d5c9['id']||0x0;this['name']=_0x18d5c9[_0x0a9e('0x3')]||'';this[_0x0a9e('0x4')]=_0x18d5c9[_0x0a9e('0x4')]||0xa;this[_0x0a9e('0x5')]=_0x18d5c9[_0x0a9e('0x5')]||'beepall';this[_0x0a9e('0x6')]=_0x18d5c9[_0x0a9e('0x6')];this[_0x0a9e('0x7')]={};this['waiting']=0x0;this['md5']='';this[_0x0a9e('0x8')]();this['updateRealtime']();}ChatQueue['prototype'][_0x0a9e('0x8')]=function(){var _0xf81284=this[_0x0a9e('0x7')][_0x0a9e('0x9')];this[_0x0a9e('0x7')]=_[_0x0a9e('0xa')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xf81284;};ChatQueue['prototype'][_0x0a9e('0xb')]=function(){this[_0x0a9e('0xc')]=0x0;this[_0x0a9e('0xd')]=0x0;for(var _0x26d672=0x0;_0x26d672=0x0?this['available']:0x0;var _0x16033c={'id':this['id'],'available':this[_0x0a9e('0x11')],'loggedIn':this['loggedIn'],'name':this[_0x0a9e('0x3')],'paused':this['paused'],'waiting':this[_0x0a9e('0x12')]};var _0x478723=md5(JSON[_0x0a9e('0x13')](_0x16033c));if(this[_0x0a9e('0x1')]!==_0x478723){this[_0x0a9e('0x1')]=_0x478723;io['to'](util[_0x0a9e('0x14')](_0x0a9e('0x15'),_0x16033c[_0x0a9e('0x3')]))[_0x0a9e('0x16')](_0x0a9e('0x17'),_0x16033c);}};module[_0x0a9e('0x18')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index c1bf67f..e84e4d2 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 _0x12cb=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','length','online','faxPause','paused','available','stringify','format','fax:queue:%s','emit','exports','lodash','md5','util','socket.io-emitter'];(function(_0x13eae1,_0x34693e){var _0x26cf2c=function(_0x2937c4){while(--_0x2937c4){_0x13eae1['push'](_0x13eae1['shift']());}};_0x26cf2c(++_0x34693e);}(_0x12cb,0x9e));var _0xb12c=function(_0x1e004f,_0x57af21){_0x1e004f=_0x1e004f-0x0;var _0xd7ab02=_0x12cb[_0x1e004f];return _0xd7ab02;};'use strict';var _=require(_0xb12c('0x0'));var md5=require(_0xb12c('0x1'));var util=require(_0xb12c('0x2'));var io=require(_0xb12c('0x3'))({'host':'localhost','port':0x18eb});function FaxQueue(_0x1c3076){this['id']=_0x1c3076['id']||0x0;this[_0xb12c('0x4')]=_0x1c3076['name']||'';this['timeout']=_0x1c3076[_0xb12c('0x5')]||0xa;this[_0xb12c('0x6')]=_0x1c3076[_0xb12c('0x6')]||_0xb12c('0x7');this[_0xb12c('0x8')]=_0x1c3076[_0xb12c('0x8')];this[_0xb12c('0x9')]={};this[_0xb12c('0xa')]=0x0;this[_0xb12c('0x1')]='';this[_0xb12c('0xb')]();this[_0xb12c('0xc')]();}FaxQueue[_0xb12c('0xd')][_0xb12c('0xb')]=function(){var _0x584acd=this[_0xb12c('0x9')]['_rr'];this[_0xb12c('0x9')]=_[_0xb12c('0xe')](this[_0xb12c('0x8')],'id');this[_0xb12c('0x9')][_0xb12c('0xf')]=_0x584acd;};FaxQueue[_0xb12c('0xd')][_0xb12c('0xc')]=function(){this[_0xb12c('0x10')]=0x0;this['paused']=0x0;for(var _0x4c746e=0x0;_0x4c746e=0x0?this[_0xb12c('0x15')]:0x0;var _0x4caf10={'id':this['id'],'available':this[_0xb12c('0x15')],'loggedIn':this['loggedIn'],'name':this[_0xb12c('0x4')],'paused':this[_0xb12c('0x14')],'waiting':this[_0xb12c('0xa')]};var _0x5e37a0=md5(JSON[_0xb12c('0x16')](_0x4caf10));if(this[_0xb12c('0x1')]!==_0x5e37a0){this[_0xb12c('0x1')]=_0x5e37a0;io['to'](util[_0xb12c('0x17')](_0xb12c('0x18'),_0x4caf10['name']))[_0xb12c('0x19')]('fax_queue:save',_0x4caf10);}};module[_0xb12c('0x1a')]=FaxQueue; \ No newline at end of file +var _0xb413=['fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format'];(function(_0x118776,_0x85063c){var _0xa8ac29=function(_0x112319){while(--_0x112319){_0x118776['push'](_0x118776['shift']());}};_0xa8ac29(++_0x85063c);}(_0xb413,0x170));var _0x3b41=function(_0x189968,_0xa77571){_0x189968=_0x189968-0x0;var _0x3f352d=_0xb413[_0x189968];return _0x3f352d;};'use strict';var _=require(_0x3b41('0x0'));var md5=require(_0x3b41('0x1'));var util=require(_0x3b41('0x2'));var io=require(_0x3b41('0x3'))({'host':_0x3b41('0x4'),'port':0x18eb});function FaxQueue(_0x3ec6cf){this['id']=_0x3ec6cf['id']||0x0;this[_0x3b41('0x5')]=_0x3ec6cf['name']||'';this['timeout']=_0x3ec6cf[_0x3b41('0x6')]||0xa;this['strategy']=_0x3ec6cf[_0x3b41('0x7')]||_0x3b41('0x8');this[_0x3b41('0x9')]=_0x3ec6cf[_0x3b41('0x9')];this[_0x3b41('0xa')]={};this[_0x3b41('0xb')]=0x0;this[_0x3b41('0x1')]='';this[_0x3b41('0xc')]();this[_0x3b41('0xd')]();}FaxQueue['prototype'][_0x3b41('0xc')]=function(){var _0x5c8672=this[_0x3b41('0xa')][_0x3b41('0xe')];this[_0x3b41('0xa')]=_['map'](this['Agents'],'id');this[_0x3b41('0xa')]['_rr']=_0x5c8672;};FaxQueue[_0x3b41('0xf')]['updateRealtime']=function(){this[_0x3b41('0x10')]=0x0;this[_0x3b41('0x11')]=0x0;for(var _0x5d5024=0x0;_0x5d5024=0x0?this[_0x3b41('0x15')]:0x0;var _0x59aa39={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3b41('0x10')],'name':this[_0x3b41('0x5')],'paused':this[_0x3b41('0x11')],'waiting':this[_0x3b41('0xb')]};var _0x2b430b=md5(JSON[_0x3b41('0x16')](_0x59aa39));if(this[_0x3b41('0x1')]!==_0x2b430b){this[_0x3b41('0x1')]=_0x2b430b;io['to'](util[_0x3b41('0x17')](_0x3b41('0x18'),_0x59aa39[_0x3b41('0x5')]))[_0x3b41('0x19')](_0x3b41('0x1a'),_0x59aa39);}};module[_0x3b41('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index b35eac3..709bf5d 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 _0xe29b=['exports','name','Intervals'];(function(_0x1562ea,_0x3b1e93){var _0x21f47d=function(_0x36b972){while(--_0x36b972){_0x1562ea['push'](_0x1562ea['shift']());}};_0x21f47d(++_0x3b1e93);}(_0xe29b,0xd9));var _0xbe29=function(_0x2c255a,_0x32048a){_0x2c255a=_0x2c255a-0x0;var _0xabe8ec=_0xe29b[_0x2c255a];return _0xabe8ec;};'use strict';function Interval(_0x5abf5e){this['id']=_0x5abf5e['id']||0x0;this[_0xbe29('0x0')]=_0x5abf5e[_0xbe29('0x0')]||'';this[_0xbe29('0x1')]=_0x5abf5e[_0xbe29('0x1')]||{};}module[_0xbe29('0x2')]=Interval; \ No newline at end of file +var _0xe8d2=['name','Intervals'];(function(_0x36749d,_0x4c6f86){var _0x419c87=function(_0x169edf){while(--_0x169edf){_0x36749d['push'](_0x36749d['shift']());}};_0x419c87(++_0x4c6f86);}(_0xe8d2,0xc8));var _0x2e8d=function(_0x343f55,_0x2f7273){_0x343f55=_0x343f55-0x0;var _0x4082b0=_0xe8d2[_0x343f55];return _0x4082b0;};'use strict';function Interval(_0x5ed485){this['id']=_0x5ed485['id']||0x0;this[_0x2e8d('0x0')]=_0x5ed485[_0x2e8d('0x0')]||'';this[_0x2e8d('0x1')]=_0x5ed485[_0x2e8d('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e1258d3..ba49f0d 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 _0x3574=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','md5','util','socket.io-emitter','localhost','name','timeout','strategy'];(function(_0x204539,_0x3281d6){var _0x1db565=function(_0x205056){while(--_0x205056){_0x204539['push'](_0x204539['shift']());}};_0x1db565(++_0x3281d6);}(_0x3574,0x19c));var _0x4357=function(_0xb3339d,_0x8803d){_0xb3339d=_0xb3339d-0x0;var _0x4dce04=_0x3574[_0xb3339d];return _0x4dce04;};'use strict';var _=require(_0x4357('0x0'));var md5=require(_0x4357('0x1'));var util=require(_0x4357('0x2'));var io=require(_0x4357('0x3'))({'host':_0x4357('0x4'),'port':0x18eb});function MailQueue(_0x502fe8){this['id']=_0x502fe8['id']||0x0;this[_0x4357('0x5')]=_0x502fe8['name']||'';this[_0x4357('0x6')]=_0x502fe8[_0x4357('0x6')]||0xa;this[_0x4357('0x7')]=_0x502fe8[_0x4357('0x7')]||_0x4357('0x8');this[_0x4357('0x9')]=_0x502fe8[_0x4357('0x9')];this[_0x4357('0xa')]={};this[_0x4357('0xb')]=0x0;this['md5']='';this[_0x4357('0xc')]();this[_0x4357('0xd')]();}MailQueue[_0x4357('0xe')]['updateRouting']=function(){var _0x44fa1e=this[_0x4357('0xa')][_0x4357('0xf')];this['mapAgentsId']=_[_0x4357('0x10')](this[_0x4357('0x9')],'id');this[_0x4357('0xa')][_0x4357('0xf')]=_0x44fa1e;};MailQueue[_0x4357('0xe')][_0x4357('0xd')]=function(){this[_0x4357('0x11')]=0x0;this[_0x4357('0x12')]=0x0;for(var _0x160481=0x0;_0x160481=0x0?this[_0x4357('0x16')]:0x0;var _0x382870={'id':this['id'],'available':this[_0x4357('0x16')],'loggedIn':this[_0x4357('0x11')],'name':this[_0x4357('0x5')],'paused':this[_0x4357('0x12')],'waiting':this[_0x4357('0xb')]};var _0xfd6d10=md5(JSON[_0x4357('0x17')](_0x382870));if(this['md5']!==_0xfd6d10){this[_0x4357('0x1')]=_0xfd6d10;io['to'](util[_0x4357('0x18')](_0x4357('0x19'),_0x382870[_0x4357('0x5')]))['emit'](_0x4357('0x1a'),_0x382870);}};module[_0x4357('0x1b')]=MailQueue; \ No newline at end of file +var _0x3177=['md5','util','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','mail_queue:save','exports','lodash'];(function(_0x29ab7e,_0x47d7d5){var _0xd52511=function(_0x93512e){while(--_0x93512e){_0x29ab7e['push'](_0x29ab7e['shift']());}};_0xd52511(++_0x47d7d5);}(_0x3177,0xef));var _0x7317=function(_0x5d3a27,_0x4d283a){_0x5d3a27=_0x5d3a27-0x0;var _0x9f99d2=_0x3177[_0x5d3a27];return _0x9f99d2;};'use strict';var _=require(_0x7317('0x0'));var md5=require(_0x7317('0x1'));var util=require(_0x7317('0x2'));var io=require('socket.io-emitter')({'host':_0x7317('0x3'),'port':0x18eb});function MailQueue(_0x1c7716){this['id']=_0x1c7716['id']||0x0;this['name']=_0x1c7716[_0x7317('0x4')]||'';this[_0x7317('0x5')]=_0x1c7716[_0x7317('0x5')]||0xa;this[_0x7317('0x6')]=_0x1c7716[_0x7317('0x6')]||_0x7317('0x7');this['Agents']=_0x1c7716[_0x7317('0x8')];this['mapAgentsId']={};this[_0x7317('0x9')]=0x0;this[_0x7317('0x1')]='';this[_0x7317('0xa')]();this[_0x7317('0xb')]();}MailQueue['prototype'][_0x7317('0xa')]=function(){var _0x4e3b44=this[_0x7317('0xc')][_0x7317('0xd')];this['mapAgentsId']=_[_0x7317('0xe')](this[_0x7317('0x8')],'id');this[_0x7317('0xc')]['_rr']=_0x4e3b44;};MailQueue['prototype'][_0x7317('0xb')]=function(){this[_0x7317('0xf')]=0x0;this[_0x7317('0x10')]=0x0;for(var _0x4bec9a=0x0;_0x4bec9a=0x0?this[_0x7317('0x13')]:0x0;var _0x57a644={'id':this['id'],'available':this[_0x7317('0x13')],'loggedIn':this[_0x7317('0xf')],'name':this[_0x7317('0x4')],'paused':this['paused'],'waiting':this['waiting']};var _0x4dd2ff=md5(JSON[_0x7317('0x14')](_0x57a644));if(this[_0x7317('0x1')]!==_0x4dd2ff){this[_0x7317('0x1')]=_0x4dd2ff;io['to'](util[_0x7317('0x15')]('mail:queue:%s',_0x57a644[_0x7317('0x4')]))['emit'](_0x7317('0x16'),_0x57a644);}};module[_0x7317('0x17')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 2c8c7f4..a6c40ce 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 _0x88b0=['online','openchannelPause','paused','available','stringify','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length'];(function(_0xd4599c,_0x188d68){var _0x119443=function(_0x3b8d50){while(--_0x3b8d50){_0xd4599c['push'](_0xd4599c['shift']());}};_0x119443(++_0x188d68);}(_0x88b0,0x1cb));var _0x088b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x88b0[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x088b('0x0'));var md5=require(_0x088b('0x1'));var util=require('util');var io=require('socket.io-emitter')({'host':_0x088b('0x2'),'port':0x18eb});function OpenchannelQueue(_0x1ead50){this['id']=_0x1ead50['id']||0x0;this[_0x088b('0x3')]=_0x1ead50[_0x088b('0x3')]||'';this['timeout']=_0x1ead50[_0x088b('0x4')]||0xa;this[_0x088b('0x5')]=_0x1ead50[_0x088b('0x5')]||'beepall';this['Agents']=_0x1ead50[_0x088b('0x6')];this[_0x088b('0x7')]={};this[_0x088b('0x8')]=0x0;this[_0x088b('0x1')]='';this[_0x088b('0x9')]();this[_0x088b('0xa')]();}OpenchannelQueue[_0x088b('0xb')]['updateRouting']=function(){var _0x110508=this['mapAgentsId'][_0x088b('0xc')];this['mapAgentsId']=_[_0x088b('0xd')](this[_0x088b('0x6')],'id');this['mapAgentsId']['_rr']=_0x110508;};OpenchannelQueue[_0x088b('0xb')][_0x088b('0xa')]=function(){this[_0x088b('0xe')]=0x0;this['paused']=0x0;for(var _0x458b1c=0x0;_0x458b1c=0x0?this[_0x088b('0x13')]:0x0;var _0xdee68a={'id':this['id'],'available':this[_0x088b('0x13')],'loggedIn':this[_0x088b('0xe')],'name':this['name'],'paused':this[_0x088b('0x12')],'waiting':this[_0x088b('0x8')]};var _0x135e00=md5(JSON[_0x088b('0x14')](_0xdee68a));if(this[_0x088b('0x1')]!==_0x135e00){this['md5']=_0x135e00;io['to'](util['format'](_0x088b('0x15'),_0xdee68a[_0x088b('0x3')]))[_0x088b('0x16')](_0x088b('0x17'),_0xdee68a);}};module[_0x088b('0x18')]=OpenchannelQueue; \ No newline at end of file +var _0xc5af=['beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','paused','available','format','openchannel:queue:%s','emit','openchannel_queue:save','exports','lodash','md5','util','socket.io-emitter','name','timeout','strategy'];(function(_0x5b6acc,_0x17e719){var _0xe7db7d=function(_0x51f6fe){while(--_0x51f6fe){_0x5b6acc['push'](_0x5b6acc['shift']());}};_0xe7db7d(++_0x17e719);}(_0xc5af,0x10c));var _0xfc5a=function(_0x464ba2,_0x3dbb57){_0x464ba2=_0x464ba2-0x0;var _0x49791b=_0xc5af[_0x464ba2];return _0x49791b;};'use strict';var _=require(_0xfc5a('0x0'));var md5=require(_0xfc5a('0x1'));var util=require(_0xfc5a('0x2'));var io=require(_0xfc5a('0x3'))({'host':'localhost','port':0x18eb});function OpenchannelQueue(_0x370d52){this['id']=_0x370d52['id']||0x0;this[_0xfc5a('0x4')]=_0x370d52[_0xfc5a('0x4')]||'';this[_0xfc5a('0x5')]=_0x370d52['timeout']||0xa;this[_0xfc5a('0x6')]=_0x370d52[_0xfc5a('0x6')]||_0xfc5a('0x7');this[_0xfc5a('0x8')]=_0x370d52[_0xfc5a('0x8')];this['mapAgentsId']={};this[_0xfc5a('0x9')]=0x0;this[_0xfc5a('0x1')]='';this[_0xfc5a('0xa')]();this[_0xfc5a('0xb')]();}OpenchannelQueue[_0xfc5a('0xc')][_0xfc5a('0xa')]=function(){var _0x5bad86=this[_0xfc5a('0xd')][_0xfc5a('0xe')];this[_0xfc5a('0xd')]=_[_0xfc5a('0xf')](this[_0xfc5a('0x8')],'id');this[_0xfc5a('0xd')][_0xfc5a('0xe')]=_0x5bad86;};OpenchannelQueue[_0xfc5a('0xc')][_0xfc5a('0xb')]=function(){this[_0xfc5a('0x10')]=0x0;this['paused']=0x0;for(var _0x37f7a5=0x0;_0x37f7a5=0x0?this['available']:0x0;var _0xee081b={'id':this['id'],'available':this[_0xfc5a('0x13')],'loggedIn':this[_0xfc5a('0x10')],'name':this[_0xfc5a('0x4')],'paused':this['paused'],'waiting':this[_0xfc5a('0x9')]};var _0xae2221=md5(JSON['stringify'](_0xee081b));if(this[_0xfc5a('0x1')]!==_0xae2221){this[_0xfc5a('0x1')]=_0xae2221;io['to'](util[_0xfc5a('0x14')](_0xfc5a('0x15'),_0xee081b[_0xfc5a('0x4')]))[_0xfc5a('0x16')](_0xfc5a('0x17'),_0xee081b);}};module[_0xfc5a('0x18')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 21bb8f1..15f3b97 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 _0xf109=['updateRouting','updateRealtime','prototype','_rr','map','paused','online','smsPause','loggedIn','available','format','emit','sms_queue:save','exports','lodash','md5','util','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting'];(function(_0x42b004,_0x71d3d){var _0x4a5bc4=function(_0x52e1d2){while(--_0x52e1d2){_0x42b004['push'](_0x42b004['shift']());}};_0x4a5bc4(++_0x71d3d);}(_0xf109,0xce));var _0x9f10=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0xf109[_0x12f688];return _0x59c3de;};'use strict';var _=require(_0x9f10('0x0'));var md5=require(_0x9f10('0x1'));var util=require(_0x9f10('0x2'));var io=require('socket.io-emitter')({'host':'localhost','port':0x18eb});function SmsQueue(_0x4cbc7a){this['id']=_0x4cbc7a['id']||0x0;this[_0x9f10('0x3')]=_0x4cbc7a[_0x9f10('0x3')]||'';this[_0x9f10('0x4')]=_0x4cbc7a[_0x9f10('0x4')]||0xa;this[_0x9f10('0x5')]=_0x4cbc7a[_0x9f10('0x5')]||_0x9f10('0x6');this[_0x9f10('0x7')]=_0x4cbc7a[_0x9f10('0x7')];this[_0x9f10('0x8')]={};this[_0x9f10('0x9')]=0x0;this['md5']='';this[_0x9f10('0xa')]();this[_0x9f10('0xb')]();}SmsQueue[_0x9f10('0xc')][_0x9f10('0xa')]=function(){var _0x325f22=this['mapAgentsId'][_0x9f10('0xd')];this[_0x9f10('0x8')]=_[_0x9f10('0xe')](this['Agents'],'id');this['mapAgentsId'][_0x9f10('0xd')]=_0x325f22;};SmsQueue[_0x9f10('0xc')][_0x9f10('0xb')]=function(){this['loggedIn']=0x0;this[_0x9f10('0xf')]=0x0;for(var _0x260606=0x0;_0x260606=0x0?this['available']:0x0;var _0x14d3fe={'id':this['id'],'available':this[_0x9f10('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x9f10('0x3')],'paused':this[_0x9f10('0xf')],'waiting':this['waiting']};var _0x150813=md5(JSON['stringify'](_0x14d3fe));if(this[_0x9f10('0x1')]!==_0x150813){this['md5']=_0x150813;io['to'](util[_0x9f10('0x14')]('sms:queue:%s',_0x14d3fe['name']))[_0x9f10('0x15')](_0x9f10('0x16'),_0x14d3fe);}};module[_0x9f10('0x17')]=SmsQueue; \ No newline at end of file +var _0x0713=['util','socket.io-emitter','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports'];(function(_0x339078,_0x10c4ee){var _0xf6cc05=function(_0x431898){while(--_0x431898){_0x339078['push'](_0x339078['shift']());}};_0xf6cc05(++_0x10c4ee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x3071('0x0'));var io=require(_0x3071('0x1'))({'host':_0x3071('0x2'),'port':0x18eb});function SmsQueue(_0x305d85){this['id']=_0x305d85['id']||0x0;this[_0x3071('0x3')]=_0x305d85['name']||'';this[_0x3071('0x4')]=_0x305d85[_0x3071('0x4')]||0xa;this[_0x3071('0x5')]=_0x305d85[_0x3071('0x5')]||_0x3071('0x6');this[_0x3071('0x7')]=_0x305d85[_0x3071('0x7')];this[_0x3071('0x8')]={};this[_0x3071('0x9')]=0x0;this[_0x3071('0xa')]='';this[_0x3071('0xb')]();this[_0x3071('0xc')]();}SmsQueue[_0x3071('0xd')]['updateRouting']=function(){var _0x3457cd=this[_0x3071('0x8')][_0x3071('0xe')];this[_0x3071('0x8')]=_[_0x3071('0xf')](this['Agents'],'id');this[_0x3071('0x8')][_0x3071('0xe')]=_0x3457cd;};SmsQueue[_0x3071('0xd')][_0x3071('0xc')]=function(){this[_0x3071('0x10')]=0x0;this['paused']=0x0;for(var _0x5330a8=0x0;_0x5330a8=0x0?this[_0x3071('0x13')]:0x0;var _0x11bdc9={'id':this['id'],'available':this[_0x3071('0x13')],'loggedIn':this[_0x3071('0x10')],'name':this['name'],'paused':this[_0x3071('0x12')],'waiting':this[_0x3071('0x9')]};var _0x1068d9=md5(JSON[_0x3071('0x14')](_0x11bdc9));if(this[_0x3071('0xa')]!==_0x1068d9){this[_0x3071('0xa')]=_0x1068d9;io['to'](util[_0x3071('0x15')](_0x3071('0x16'),_0x11bdc9['name']))[_0x3071('0x17')](_0x3071('0x18'),_0x11bdc9);}};module[_0x3071('0x19')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1d76deb..288a31d 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 _0x3517=['intervals','openchannelQueues','chatQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','hasOwnProperty','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initOpenchannelQueues','updateRouting','updateRealtime','initSmsQueues','smsQueues','initMailQueues','mailQueues','initFaxQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue'];(function(_0x4392af,_0xec5afe){var _0x9fa8eb=function(_0x41d7a4){while(--_0x41d7a4){_0x4392af['push'](_0x4392af['shift']());}};_0x9fa8eb(++_0xec5afe);}(_0x3517,0xbc));var _0x7351=function(_0x202ba6,_0x239806){_0x202ba6=_0x202ba6-0x0;var _0x3b4396=_0x3517[_0x202ba6];return _0x3b4396;};'use strict';var BPromise=require(_0x7351('0x0'));var util=require('util');var _=require(_0x7351('0x1'));var moment=require(_0x7351('0x2'));var Agent=require(_0x7351('0x3'));var Interval=require(_0x7351('0x4'));var OpenchannelQueue=require(_0x7351('0x5'));var ChatQueue=require(_0x7351('0x6'));var SmsQueue=require(_0x7351('0x7'));var MailQueue=require(_0x7351('0x8'));var FaxQueue=require(_0x7351('0x9'));var Realtime=function(){this['agents']={};this[_0x7351('0xa')]={};this[_0x7351('0xb')]={};this[_0x7351('0xc')]={};this['smsQueues']={};this['mailQueues']={};this[_0x7351('0xd')]={};this[_0x7351('0xe')]={};this[_0x7351('0xf')]={};this['openchannelQueuesWaitingInteractions']={};this[_0x7351('0x10')]={};this[_0x7351('0x11')]={};};function freeIsNotKey(_0x267348,_0x43cbfb,_0x19c3ba){var _0x2ac1a2=_['mapKeys'](_0x267348,function(_0x44b3ec,_0x201675){return _0x44b3ec[_0x19c3ba];});for(var _0xedda54 in _0x43cbfb){if(_0x43cbfb[_0x7351('0x12')](_0xedda54)){if(!_0x2ac1a2[_0xedda54]){delete _0x43cbfb[_0xedda54];}}}}Realtime[_0x7351('0x13')]['mergeFromDatabase']=function(_0x2e1d16,_0x4ff9d4){for(var _0x201ece in _0x4ff9d4){if(_0x2e1d16[_0x7351('0x12')](_0x201ece)){_0x2e1d16[_0x201ece]=_0x4ff9d4[_0x201ece];}}};Realtime[_0x7351('0x13')][_0x7351('0x14')]=function(){var _0x9e6b62=this;return function(_0x99eb34){if(_0x99eb34){freeIsNotKey(_0x99eb34,_0x9e6b62[_0x7351('0x15')],'id');for(var _0xd579a9=0x0,_0x219292={},_0x3c0f31={};_0xd579a9<_0x99eb34[_0x7351('0x16')];_0xd579a9+=0x1){_0x219292=_0x99eb34[_0xd579a9];if(_[_0x7351('0x17')](_0x9e6b62[_0x7351('0x15')][_0x219292['id']])){_0x9e6b62[_0x7351('0x15')][_0x219292['id']]=new Agent(_0x219292);}else{_0x9e6b62['mergeFromDatabase'](_0x9e6b62['agents'][_0x219292['id']],_0x219292);}}}return _0x9e6b62[_0x7351('0x15')];};};Realtime[_0x7351('0x13')]['initIntervals']=function(){var _0x403ed0=this;return function(_0x17a9de){if(_0x17a9de){freeIsNotKey(_0x17a9de,_0x403ed0[_0x7351('0xa')],'id');for(var _0x41a140=0x0,_0x4c5344={},_0x19f171={};_0x41a140<_0x17a9de[_0x7351('0x16')];_0x41a140+=0x1){_0x4c5344=_0x17a9de[_0x41a140];if(_[_0x7351('0x17')](_0x403ed0[_0x7351('0xa')][_0x4c5344['id']])){_0x403ed0[_0x7351('0xa')][_0x4c5344['id']]=new Interval(_0x4c5344);}else{_0x403ed0[_0x7351('0x18')](_0x403ed0[_0x7351('0xa')][_0x4c5344['id']],_0x4c5344);}}}return _0x403ed0['intervals'];};};Realtime['prototype'][_0x7351('0x19')]=function(){var _0x4b7409=this;return function(_0xdea81){if(_0xdea81){freeIsNotKey(_0xdea81,_0x4b7409[_0x7351('0xb')],'id');for(var _0x5b98c7=0x0,_0x3f990e={},_0x1f268e={};_0x5b98c7<_0xdea81['length'];_0x5b98c7+=0x1){_0x3f990e=_0xdea81[_0x5b98c7];if(_[_0x7351('0x17')](_0x4b7409[_0x7351('0xb')][_0x3f990e['id']])){_0x4b7409[_0x7351('0xb')][_0x3f990e['id']]=new OpenchannelQueue(_0x3f990e);}else{_0x4b7409[_0x7351('0x18')](_0x4b7409[_0x7351('0xb')][_0x3f990e['id']],_0x3f990e);}_0x4b7409[_0x7351('0xb')][_0x3f990e['id']][_0x7351('0x1a')]();_0x4b7409[_0x7351('0xb')][_0x3f990e['id']][_0x7351('0x1b')]();}}return _0x4b7409[_0x7351('0xb')];};};Realtime['prototype']['initChatQueues']=function(){var _0x394199=this;return function(_0x33fb39){if(_0x33fb39){freeIsNotKey(_0x33fb39,_0x394199[_0x7351('0xc')],'id');for(var _0x3ed826=0x0,_0x50056f={},_0x4000cf={};_0x3ed826<_0x33fb39[_0x7351('0x16')];_0x3ed826+=0x1){_0x50056f=_0x33fb39[_0x3ed826];if(_[_0x7351('0x17')](_0x394199[_0x7351('0xc')][_0x50056f['id']])){_0x394199[_0x7351('0xc')][_0x50056f['id']]=new ChatQueue(_0x50056f);}else{_0x394199[_0x7351('0x18')](_0x394199[_0x7351('0xc')][_0x50056f['id']],_0x50056f);}_0x394199[_0x7351('0xc')][_0x50056f['id']][_0x7351('0x1a')]();_0x394199[_0x7351('0xc')][_0x50056f['id']][_0x7351('0x1b')]();}}return _0x394199['chatQueues'];};};Realtime[_0x7351('0x13')][_0x7351('0x1c')]=function(){var _0x3c6c52=this;return function(_0x27df4a){if(_0x27df4a){freeIsNotKey(_0x27df4a,_0x3c6c52[_0x7351('0x1d')],'id');for(var _0x3e2bb4=0x0,_0x49bac9={},_0x40813d={};_0x3e2bb4<_0x27df4a['length'];_0x3e2bb4+=0x1){_0x49bac9=_0x27df4a[_0x3e2bb4];if(_['isUndefined'](_0x3c6c52[_0x7351('0x1d')][_0x49bac9['id']])){_0x3c6c52['smsQueues'][_0x49bac9['id']]=new SmsQueue(_0x49bac9);}else{_0x3c6c52[_0x7351('0x18')](_0x3c6c52[_0x7351('0x1d')][_0x49bac9['id']],_0x49bac9);}_0x3c6c52[_0x7351('0x1d')][_0x49bac9['id']][_0x7351('0x1a')]();_0x3c6c52[_0x7351('0x1d')][_0x49bac9['id']][_0x7351('0x1b')]();}}return _0x3c6c52['smsQueues'];};};Realtime[_0x7351('0x13')][_0x7351('0x1e')]=function(){var _0x1ff7e5=this;return function(_0x4847c8){if(_0x4847c8){freeIsNotKey(_0x4847c8,_0x1ff7e5[_0x7351('0x1f')],'id');for(var _0x352409=0x0,_0x4f4b48={},_0x4991cb={};_0x352409<_0x4847c8[_0x7351('0x16')];_0x352409+=0x1){_0x4f4b48=_0x4847c8[_0x352409];if(_['isUndefined'](_0x1ff7e5[_0x7351('0x1f')][_0x4f4b48['id']])){_0x1ff7e5[_0x7351('0x1f')][_0x4f4b48['id']]=new MailQueue(_0x4f4b48);}else{_0x1ff7e5[_0x7351('0x18')](_0x1ff7e5[_0x7351('0x1f')][_0x4f4b48['id']],_0x4f4b48);}_0x1ff7e5['mailQueues'][_0x4f4b48['id']][_0x7351('0x1a')]();_0x1ff7e5['mailQueues'][_0x4f4b48['id']][_0x7351('0x1b')]();}}return _0x1ff7e5['mailQueues'];};};Realtime[_0x7351('0x13')][_0x7351('0x20')]=function(){var _0x23e689=this;return function(_0x420dca){if(_0x420dca){freeIsNotKey(_0x420dca,_0x23e689['faxQueues'],'id');for(var _0x12d650=0x0,_0x3304b5={},_0x5b2d87={};_0x12d650<_0x420dca['length'];_0x12d650+=0x1){_0x3304b5=_0x420dca[_0x12d650];if(_[_0x7351('0x17')](_0x23e689[_0x7351('0xd')][_0x3304b5['id']])){_0x23e689[_0x7351('0xd')][_0x3304b5['id']]=new FaxQueue(_0x3304b5);}else{_0x23e689['mergeFromDatabase'](_0x23e689[_0x7351('0xd')][_0x3304b5['id']],_0x3304b5);}_0x23e689[_0x7351('0xd')][_0x3304b5['id']]['updateRouting']();_0x23e689[_0x7351('0xd')][_0x3304b5['id']][_0x7351('0x1b')]();}}return _0x23e689[_0x7351('0xd')];};};module['exports']=Realtime; \ No newline at end of file +var _0xab02=['../model/chatQueue','../model/smsQueue','agents','openchannelQueues','chatQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','hasOwnProperty','mergeFromDatabase','prototype','length','isUndefined','initIntervals','intervals','initOpenchannelQueues','updateRealtime','updateRouting','initSmsQueues','initMailQueues','mailQueues','exports','bluebird','moment','../model/agent','../model/interval'];(function(_0x923d21,_0xcb8c09){var _0x4f19f1=function(_0x3d7426){while(--_0x3d7426){_0x923d21['push'](_0x923d21['shift']());}};_0x4f19f1(++_0xcb8c09);}(_0xab02,0x1cc));var _0x2ab0=function(_0x5e5ab9,_0x212cde){_0x5e5ab9=_0x5e5ab9-0x0;var _0x2417ed=_0xab02[_0x5e5ab9];return _0x2417ed;};'use strict';var BPromise=require(_0x2ab0('0x0'));var util=require('util');var _=require('lodash');var moment=require(_0x2ab0('0x1'));var Agent=require(_0x2ab0('0x2'));var Interval=require(_0x2ab0('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x2ab0('0x4'));var SmsQueue=require(_0x2ab0('0x5'));var MailQueue=require('../model/mailQueue');var FaxQueue=require('../model/faxQueue');var Realtime=function(){this[_0x2ab0('0x6')]={};this['intervals']={};this[_0x2ab0('0x7')]={};this[_0x2ab0('0x8')]={};this[_0x2ab0('0x9')]={};this['mailQueues']={};this[_0x2ab0('0xa')]={};this[_0x2ab0('0xb')]={};this[_0x2ab0('0xc')]={};this[_0x2ab0('0xd')]={};this['smsQueuesWaitingInteractions']={};this[_0x2ab0('0xe')]={};};function freeIsNotKey(_0x2abe0e,_0x5133a8,_0xe91e7b){var _0x2356a4=_['mapKeys'](_0x2abe0e,function(_0xe92930,_0x107e65){return _0xe92930[_0xe91e7b];});for(var _0xfcd086 in _0x5133a8){if(_0x5133a8[_0x2ab0('0xf')](_0xfcd086)){if(!_0x2356a4[_0xfcd086]){delete _0x5133a8[_0xfcd086];}}}}Realtime['prototype'][_0x2ab0('0x10')]=function(_0x2ac5bd,_0x108750){for(var _0x53b7fd in _0x108750){if(_0x2ac5bd['hasOwnProperty'](_0x53b7fd)){_0x2ac5bd[_0x53b7fd]=_0x108750[_0x53b7fd];}}};Realtime[_0x2ab0('0x11')]['initAgents']=function(){var _0x122749=this;return function(_0x48ff2c){if(_0x48ff2c){freeIsNotKey(_0x48ff2c,_0x122749[_0x2ab0('0x6')],'id');for(var _0x3cc969=0x0,_0x5af57e={},_0x3a8396={};_0x3cc969<_0x48ff2c[_0x2ab0('0x12')];_0x3cc969+=0x1){_0x5af57e=_0x48ff2c[_0x3cc969];if(_[_0x2ab0('0x13')](_0x122749[_0x2ab0('0x6')][_0x5af57e['id']])){_0x122749['agents'][_0x5af57e['id']]=new Agent(_0x5af57e);}else{_0x122749[_0x2ab0('0x10')](_0x122749[_0x2ab0('0x6')][_0x5af57e['id']],_0x5af57e);}}}return _0x122749['agents'];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x14')]=function(){var _0xa00325=this;return function(_0x27f2a4){if(_0x27f2a4){freeIsNotKey(_0x27f2a4,_0xa00325[_0x2ab0('0x15')],'id');for(var _0x22e309=0x0,_0x25d1da={},_0x7ac22b={};_0x22e309<_0x27f2a4[_0x2ab0('0x12')];_0x22e309+=0x1){_0x25d1da=_0x27f2a4[_0x22e309];if(_[_0x2ab0('0x13')](_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']])){_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']]=new Interval(_0x25d1da);}else{_0xa00325[_0x2ab0('0x10')](_0xa00325[_0x2ab0('0x15')][_0x25d1da['id']],_0x25d1da);}}}return _0xa00325[_0x2ab0('0x15')];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x16')]=function(){var _0x315795=this;return function(_0x17e267){if(_0x17e267){freeIsNotKey(_0x17e267,_0x315795[_0x2ab0('0x7')],'id');for(var _0x1ff5bb=0x0,_0x5b49c9={},_0x48acb9={};_0x1ff5bb<_0x17e267[_0x2ab0('0x12')];_0x1ff5bb+=0x1){_0x5b49c9=_0x17e267[_0x1ff5bb];if(_[_0x2ab0('0x13')](_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']])){_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']]=new OpenchannelQueue(_0x5b49c9);}else{_0x315795[_0x2ab0('0x10')](_0x315795['openchannelQueues'][_0x5b49c9['id']],_0x5b49c9);}_0x315795[_0x2ab0('0x7')][_0x5b49c9['id']]['updateRouting']();_0x315795['openchannelQueues'][_0x5b49c9['id']][_0x2ab0('0x17')]();}}return _0x315795[_0x2ab0('0x7')];};};Realtime[_0x2ab0('0x11')]['initChatQueues']=function(){var _0x5c68e4=this;return function(_0x3054f0){if(_0x3054f0){freeIsNotKey(_0x3054f0,_0x5c68e4['chatQueues'],'id');for(var _0x57f401=0x0,_0x133f90={},_0x33dc53={};_0x57f401<_0x3054f0[_0x2ab0('0x12')];_0x57f401+=0x1){_0x133f90=_0x3054f0[_0x57f401];if(_[_0x2ab0('0x13')](_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']])){_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']]=new ChatQueue(_0x133f90);}else{_0x5c68e4['mergeFromDatabase'](_0x5c68e4[_0x2ab0('0x8')][_0x133f90['id']],_0x133f90);}_0x5c68e4['chatQueues'][_0x133f90['id']][_0x2ab0('0x18')]();_0x5c68e4['chatQueues'][_0x133f90['id']][_0x2ab0('0x17')]();}}return _0x5c68e4[_0x2ab0('0x8')];};};Realtime[_0x2ab0('0x11')][_0x2ab0('0x19')]=function(){var _0x2644fb=this;return function(_0x5a8cef){if(_0x5a8cef){freeIsNotKey(_0x5a8cef,_0x2644fb[_0x2ab0('0x9')],'id');for(var _0x743b6f=0x0,_0x3a666f={},_0x240c04={};_0x743b6f<_0x5a8cef[_0x2ab0('0x12')];_0x743b6f+=0x1){_0x3a666f=_0x5a8cef[_0x743b6f];if(_[_0x2ab0('0x13')](_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']])){_0x2644fb['smsQueues'][_0x3a666f['id']]=new SmsQueue(_0x3a666f);}else{_0x2644fb[_0x2ab0('0x10')](_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']],_0x3a666f);}_0x2644fb[_0x2ab0('0x9')][_0x3a666f['id']]['updateRouting']();_0x2644fb['smsQueues'][_0x3a666f['id']][_0x2ab0('0x17')]();}}return _0x2644fb['smsQueues'];};};Realtime['prototype'][_0x2ab0('0x1a')]=function(){var _0x506c10=this;return function(_0x34a4d8){if(_0x34a4d8){freeIsNotKey(_0x34a4d8,_0x506c10[_0x2ab0('0x1b')],'id');for(var _0x1dc452=0x0,_0x496d75={},_0x4865b8={};_0x1dc452<_0x34a4d8[_0x2ab0('0x12')];_0x1dc452+=0x1){_0x496d75=_0x34a4d8[_0x1dc452];if(_[_0x2ab0('0x13')](_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']])){_0x506c10['mailQueues'][_0x496d75['id']]=new MailQueue(_0x496d75);}else{_0x506c10[_0x2ab0('0x10')](_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']],_0x496d75);}_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']][_0x2ab0('0x18')]();_0x506c10[_0x2ab0('0x1b')][_0x496d75['id']][_0x2ab0('0x17')]();}}return _0x506c10['mailQueues'];};};Realtime[_0x2ab0('0x11')]['initFaxQueues']=function(){var _0x541b9f=this;return function(_0x402767){if(_0x402767){freeIsNotKey(_0x402767,_0x541b9f[_0x2ab0('0xa')],'id');for(var _0xd57f2a=0x0,_0x401631={},_0x236f00={};_0xd57f2a<_0x402767['length'];_0xd57f2a+=0x1){_0x401631=_0x402767[_0xd57f2a];if(_['isUndefined'](_0x541b9f[_0x2ab0('0xa')][_0x401631['id']])){_0x541b9f[_0x2ab0('0xa')][_0x401631['id']]=new FaxQueue(_0x401631);}else{_0x541b9f['mergeFromDatabase'](_0x541b9f[_0x2ab0('0xa')][_0x401631['id']],_0x401631);}_0x541b9f[_0x2ab0('0xa')][_0x401631['id']][_0x2ab0('0x18')]();_0x541b9f[_0x2ab0('0xa')][_0x401631['id']][_0x2ab0('0x17')]();}}return _0x541b9f['faxQueues'];};};module[_0x2ab0('0x1c')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6d782fd..2414da9 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 _0x44b5=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x44b5,0x1e5));var _0x544b=function(_0xb1e23e,_0x1b2194){_0xb1e23e=_0xb1e23e-0x0;var _0x5a2a0c=_0x44b5[_0xb1e23e];return _0x5a2a0c;};'use strict';var client=require(_0x544b('0x0'));exports[_0x544b('0x1')]=function(_0x2b17f9,_0x30efe0){return client[_0x544b('0x2')](_0x544b('0x3'),{'body':_0x30efe0,'options':{'where':{'id':_0x2b17f9}},'log':_0x544b('0x4')});};exports['addTags']=function(_0x5413e0,_0x186a26){return client[_0x544b('0x2')](_0x544b('0x5'),{'body':_0x186a26,'options':{'where':{'id':_0x5413e0}},'log':_0x544b('0x6')});}; \ No newline at end of file +var _0xaa31=['AddTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0xc4d9e6,_0xf8e46){var _0x416db2=function(_0x2d172e){while(--_0x2d172e){_0xc4d9e6['push'](_0xc4d9e6['shift']());}};_0x416db2(++_0xf8e46);}(_0xaa31,0xd9));var _0x1aa3=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xaa31[_0x344a3f];return _0x264712;};'use strict';var client=require(_0x1aa3('0x0'));exports['update']=function(_0x51a95d,_0x4dc415){return client[_0x1aa3('0x1')](_0x1aa3('0x2'),{'body':_0x4dc415,'options':{'where':{'id':_0x51a95d}},'log':_0x1aa3('0x3')});};exports[_0x1aa3('0x4')]=function(_0x2cec7a,_0x3480d2){return client['Request'](_0x1aa3('0x5'),{'body':_0x3480d2,'options':{'where':{'id':_0x2cec7a}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 8e40c7d..b5ca43b 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 _0xc4b0=['create','Request','CreateChatMessage','../client'];(function(_0x403407,_0x5023c9){var _0x356b87=function(_0x240c33){while(--_0x240c33){_0x403407['push'](_0x403407['shift']());}};_0x356b87(++_0x5023c9);}(_0xc4b0,0x187));var _0x0c4b=function(_0x397de4,_0x38ac08){_0x397de4=_0x397de4-0x0;var _0x1ace8e=_0xc4b0[_0x397de4];return _0x1ace8e;};'use strict';var client=require(_0x0c4b('0x0'));exports[_0x0c4b('0x1')]=function(_0x2c24af){return client[_0x0c4b('0x2')](_0x0c4b('0x3'),{'body':_0x2c24af,'log':'createChatMessage'});}; \ No newline at end of file +var _0x773e=['create','Request','CreateChatMessage','createChatMessage'];(function(_0x2b069e,_0x342c30){var _0x2044cd=function(_0x15b6f0){while(--_0x15b6f0){_0x2b069e['push'](_0x2b069e['shift']());}};_0x2044cd(++_0x342c30);}(_0x773e,0x1b0));var _0xe773=function(_0x1c9263,_0x162625){_0x1c9263=_0x1c9263-0x0;var _0x4b7bec=_0x773e[_0x1c9263];return _0x4b7bec;};'use strict';var client=require('../client');exports[_0xe773('0x0')]=function(_0x442ba7){return client[_0xe773('0x1')](_0xe773('0x2'),{'body':_0x442ba7,'log':_0xe773('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index b303d0e..da9d3e4 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 _0x9631=['getChatQueues','../client','Request','GetChatQueue','name','timeout','User','online','chatPause'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x9631,0x1e7));var _0x1963=function(_0x138a4b,_0x5490c8){_0x138a4b=_0x138a4b-0x0;var _0x37ea8a=_0x9631[_0x138a4b];return _0x37ea8a;};'use strict';var client=require(_0x1963('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x1963('0x1')](_0x1963('0x2'),{'options':{'raw':![],'attributes':['id',_0x1963('0x3'),_0x1963('0x4'),'strategy'],'include':[{'model':_0x1963('0x5'),'as':'Agents','attributes':['id',_0x1963('0x3'),_0x1963('0x6'),_0x1963('0x7')]}]},'log':_0x1963('0x8')});};}; \ No newline at end of file +var _0x9f51=['name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0x407b9f,_0x26e3e1){var _0x7a8eeb=function(_0x1be7d4){while(--_0x1be7d4){_0x407b9f['push'](_0x407b9f['shift']());}};_0x7a8eeb(++_0x26e3e1);}(_0x9f51,0x19c));var _0x19f5=function(_0x5b791d,_0x49cc81){_0x5b791d=_0x5b791d-0x0;var _0xdd1c36=_0x9f51[_0x5b791d];return _0xdd1c36;};'use strict';var client=require(_0x19f5('0x0'));exports[_0x19f5('0x1')]=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x19f5('0x2'),_0x19f5('0x3'),_0x19f5('0x4')],'include':[{'model':_0x19f5('0x5'),'as':_0x19f5('0x6'),'attributes':['id','name',_0x19f5('0x7'),_0x19f5('0x8')]}]},'log':_0x19f5('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 40e2dc6..c630d98 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 _0x3d9c=['UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport','update'];(function(_0x3230e2,_0x155cf2){var _0x3769d0=function(_0x37b358){while(--_0x37b358){_0x3230e2['push'](_0x3230e2['shift']());}};_0x3769d0(++_0x155cf2);}(_0x3d9c,0x134));var _0xc3d9=function(_0x21ce67,_0x2ec17b){_0x21ce67=_0x21ce67-0x0;var _0x1840ac=_0x3d9c[_0x21ce67];return _0x1840ac;};'use strict';var client=require(_0xc3d9('0x0'));exports['create']=function(_0x39de33){return client[_0xc3d9('0x1')](_0xc3d9('0x2'),{'body':_0x39de33,'log':'CreateChatQueueReport'});};exports[_0xc3d9('0x3')]=function(_0x384978,_0x2532cf){return client[_0xc3d9('0x1')](_0xc3d9('0x4'),{'body':_0x2532cf,'options':{'where':{'uniqueid':_0x384978},'order':[['id',_0xc3d9('0x5')]],'limit':0x1},'log':_0xc3d9('0x4')});}; \ No newline at end of file +var _0x6611=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x6611,0xdd));var _0x1661=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x6611[_0x432682];return _0x463d05;};'use strict';var client=require('../client');exports[_0x1661('0x0')]=function(_0x42056f){return client[_0x1661('0x1')](_0x1661('0x2'),{'body':_0x42056f,'log':_0x1661('0x2')});};exports[_0x1661('0x3')]=function(_0x44e418,_0x25bce6){return client[_0x1661('0x1')](_0x1661('0x4'),{'body':_0x25bce6,'options':{'where':{'uniqueid':_0x44e418},'order':[['id',_0x1661('0x5')]],'limit':0x1},'log':_0x1661('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index bbf8473..238c3b0 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 _0x32f1=['addTags','AddTagsToFaxInteraction','../client','update','Request','updateFaxInteraction'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x32f1,0x1ac));var _0x132f=function(_0x184220,_0x33edb5){_0x184220=_0x184220-0x0;var _0x48d454=_0x32f1[_0x184220];return _0x48d454;};'use strict';var client=require(_0x132f('0x0'));exports[_0x132f('0x1')]=function(_0x3e24b7,_0x17eb9d){return client[_0x132f('0x2')]('UpdateFaxInteraction',{'body':_0x17eb9d,'options':{'where':{'id':_0x3e24b7}},'log':_0x132f('0x3')});};exports[_0x132f('0x4')]=function(_0x4f5913,_0x3660c2){return client['Request'](_0x132f('0x5'),{'body':_0x3660c2,'options':{'where':{'id':_0x4f5913}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x5ed9=['AddTagsToFaxInteraction','update','UpdateFaxInteraction','Request'];(function(_0x3248bd,_0x1b7104){var _0x2a3dc1=function(_0x28de13){while(--_0x28de13){_0x3248bd['push'](_0x3248bd['shift']());}};_0x2a3dc1(++_0x1b7104);}(_0x5ed9,0x185));var _0x95ed=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5ed9[_0x13d07a];return _0x5ee0ee;};'use strict';var client=require('../client');exports[_0x95ed('0x0')]=function(_0x59bd8d,_0x4b8c41){return client['Request'](_0x95ed('0x1'),{'body':_0x4b8c41,'options':{'where':{'id':_0x59bd8d}},'log':'updateFaxInteraction'});};exports['addTags']=function(_0x21044f,_0x588882){return client[_0x95ed('0x2')](_0x95ed('0x3'),{'body':_0x588882,'options':{'where':{'id':_0x21044f}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a0ed0b0..beae980 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 _0x7680=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x613da1,_0x3eecb1){var _0x2cecc1=function(_0x4d8751){while(--_0x4d8751){_0x613da1['push'](_0x613da1['shift']());}};_0x2cecc1(++_0x3eecb1);}(_0x7680,0x1eb));var _0x0768=function(_0xe260c2,_0x56d51e){_0xe260c2=_0xe260c2-0x0;var _0x32ddfb=_0x7680[_0xe260c2];return _0x32ddfb;};'use strict';var client=require(_0x0768('0x0'));exports[_0x0768('0x1')]=function(_0x1139f1){return client[_0x0768('0x2')](_0x0768('0x3'),{'body':_0x1139f1,'log':_0x0768('0x4')});}; \ No newline at end of file +var _0xe989=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xe989,0x13d));var _0x9e98=function(_0x2993c1,_0x37681f){_0x2993c1=_0x2993c1-0x0;var _0x41c9cf=_0xe989[_0x2993c1];return _0x41c9cf;};'use strict';var client=require(_0x9e98('0x0'));exports[_0x9e98('0x1')]=function(_0x46e5d5){return client[_0x9e98('0x2')](_0x9e98('0x3'),{'body':_0x46e5d5,'log':_0x9e98('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index e691a23..bd877cd 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 _0xca02=['../client','Request','timeout','strategy','User','Agents','name','faxPause','getFaxQueues'];(function(_0xdb17ab,_0x60eda8){var _0x407c1b=function(_0x5387a5){while(--_0x5387a5){_0xdb17ab['push'](_0xdb17ab['shift']());}};_0x407c1b(++_0x60eda8);}(_0xca02,0x18c));var _0x2ca0=function(_0x5c0832,_0x5ada3b){_0x5c0832=_0x5c0832-0x0;var _0x364a46=_0xca02[_0x5c0832];return _0x364a46;};'use strict';var client=require(_0x2ca0('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x2ca0('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id','name',_0x2ca0('0x2'),_0x2ca0('0x3')],'include':[{'model':_0x2ca0('0x4'),'as':_0x2ca0('0x5'),'attributes':['id',_0x2ca0('0x6'),'online',_0x2ca0('0x7')]}]},'log':_0x2ca0('0x8')});};}; \ No newline at end of file +var _0x2193=['name','timeout','User','Agents','faxPause','../client','getFaxQueues'];(function(_0xef6e46,_0x4b2206){var _0x3aba23=function(_0x48024f){while(--_0x48024f){_0xef6e46['push'](_0xef6e46['shift']());}};_0x3aba23(++_0x4b2206);}(_0x2193,0x1e1));var _0x3219=function(_0x563b5c,_0x164c39){_0x563b5c=_0x563b5c-0x0;var _0x44aafb=_0x2193[_0x563b5c];return _0x44aafb;};'use strict';var client=require(_0x3219('0x0'));exports[_0x3219('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x3219('0x2'),_0x3219('0x3'),'strategy'],'include':[{'model':_0x3219('0x4'),'as':_0x3219('0x5'),'attributes':['id',_0x3219('0x2'),'online',_0x3219('0x6')]}]},'log':_0x3219('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d9cbdd1..bbe2125 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 _0x427f=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client','create'];(function(_0x27c24e,_0x5db1c7){var _0x39004a=function(_0x44286d){while(--_0x44286d){_0x27c24e['push'](_0x27c24e['shift']());}};_0x39004a(++_0x5db1c7);}(_0x427f,0x1ba));var _0xf427=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x427f[_0x618414];return _0x21c19a;};'use strict';var client=require(_0xf427('0x0'));exports[_0xf427('0x1')]=function(_0x587bd0){return client[_0xf427('0x2')]('CreateFaxQueueReport',{'body':_0x587bd0,'log':_0xf427('0x3')});};exports[_0xf427('0x4')]=function(_0x341838,_0x580bb6){return client['Request'](_0xf427('0x5'),{'body':_0x580bb6,'options':{'where':{'uniqueid':_0x341838},'order':[['id','DESC']],'limit':0x1},'log':_0xf427('0x5')});}; \ No newline at end of file +var _0x6a93=['UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update','Request'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6a93,0x1d7));var _0x36a9=function(_0x5dc303,_0x473b18){_0x5dc303=_0x5dc303-0x0;var _0x229e47=_0x6a93[_0x5dc303];return _0x229e47;};'use strict';var client=require(_0x36a9('0x0'));exports[_0x36a9('0x1')]=function(_0x3821a9){return client['Request']('CreateFaxQueueReport',{'body':_0x3821a9,'log':_0x36a9('0x2')});};exports[_0x36a9('0x3')]=function(_0x4942ac,_0x2deb45){return client[_0x36a9('0x4')](_0x36a9('0x5'),{'body':_0x2deb45,'options':{'where':{'uniqueid':_0x4942ac},'order':[['id',_0x36a9('0x6')]],'limit':0x1},'log':_0x36a9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index dde8149..7cbe706 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 _0x7d98=['name','Interval','interval','../client','Request','GetInterval'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d98,0xe7));var _0x87d9=function(_0x1f6f84,_0x2bab55){_0x1f6f84=_0x1f6f84-0x0;var _0x177f40=_0x7d98[_0x1f6f84];return _0x177f40;};'use strict';var client=require(_0x87d9('0x0'));exports['getIntervals']=function(){return function(){return client[_0x87d9('0x1')](_0x87d9('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x87d9('0x3')],'include':[{'model':_0x87d9('0x4'),'as':'Intervals','attributes':['id',_0x87d9('0x3'),_0x87d9('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x9c00=['interval','../client','getIntervals','name','Interval'];(function(_0x44714c,_0x2ac454){var _0x57d4d5=function(_0x5aca44){while(--_0x5aca44){_0x44714c['push'](_0x44714c['shift']());}};_0x57d4d5(++_0x2ac454);}(_0x9c00,0x1a0));var _0x09c0=function(_0x18b56f,_0x2d8823){_0x18b56f=_0x18b56f-0x0;var _0x4df0e0=_0x9c00[_0x18b56f];return _0x4df0e0;};'use strict';var client=require(_0x09c0('0x0'));exports[_0x09c0('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x09c0('0x2')],'include':[{'model':_0x09c0('0x3'),'as':'Intervals','attributes':['id',_0x09c0('0x2'),_0x09c0('0x4')]}]},'log':_0x09c0('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cfb633a..2800b80 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 _0x9fd8=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x584ab6,_0x49bb0a){var _0x17609e=function(_0x3833f8){while(--_0x3833f8){_0x584ab6['push'](_0x584ab6['shift']());}};_0x17609e(++_0x49bb0a);}(_0x9fd8,0x185));var _0x89fd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9fd8[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x89fd('0x0'));exports[_0x89fd('0x1')]=function(_0xc8ad17,_0x267b70){return client[_0x89fd('0x2')](_0x89fd('0x3'),{'body':_0x267b70,'options':{'where':{'id':_0xc8ad17}},'log':_0x89fd('0x4')});};exports[_0x89fd('0x5')]=function(_0x58453c,_0x2f59ca){return client[_0x89fd('0x2')](_0x89fd('0x6'),{'body':_0x2f59ca,'options':{'where':{'id':_0x58453c}},'log':_0x89fd('0x7')});}; \ No newline at end of file +var _0xd163=['UpdateMailInteraction','updateMailInteraction','addTags','Request','addTagsToChatInteraction','../client','update'];(function(_0x4a30a1,_0x483a3f){var _0x2617c1=function(_0x555d49){while(--_0x555d49){_0x4a30a1['push'](_0x4a30a1['shift']());}};_0x2617c1(++_0x483a3f);}(_0xd163,0x91));var _0x3d16=function(_0x1057a3,_0x28d9b7){_0x1057a3=_0x1057a3-0x0;var _0x131cdb=_0xd163[_0x1057a3];return _0x131cdb;};'use strict';var client=require(_0x3d16('0x0'));exports[_0x3d16('0x1')]=function(_0x2d6c5e,_0x6882d1){return client['Request'](_0x3d16('0x2'),{'body':_0x6882d1,'options':{'where':{'id':_0x2d6c5e}},'log':_0x3d16('0x3')});};exports[_0x3d16('0x4')]=function(_0x33290e,_0x294df8){return client[_0x3d16('0x5')]('AddTagsToMailInteraction',{'body':_0x294df8,'options':{'where':{'id':_0x33290e}},'log':_0x3d16('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2fc3499..1ba406e 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 _0xdd85=['../client','Request','createMailMessage'];(function(_0x43b92d,_0x10c4ef){var _0x14d450=function(_0x45b7fd){while(--_0x45b7fd){_0x43b92d['push'](_0x43b92d['shift']());}};_0x14d450(++_0x10c4ef);}(_0xdd85,0x10b));var _0x5dd8=function(_0x283111,_0x2bda51){_0x283111=_0x283111-0x0;var _0x1a2b0a=_0xdd85[_0x283111];return _0x1a2b0a;};'use strict';var client=require(_0x5dd8('0x0'));exports['create']=function(_0xd3650c){return client[_0x5dd8('0x1')]('CreateMailMessage',{'body':_0xd3650c,'log':_0x5dd8('0x2')});}; \ No newline at end of file +var _0x9b20=['Request','createMailMessage','../client','create'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x9b20,0xa6));var _0x09b2=function(_0x2959a6,_0x32b484){_0x2959a6=_0x2959a6-0x0;var _0x5090e3=_0x9b20[_0x2959a6];return _0x5090e3;};'use strict';var client=require(_0x09b2('0x0'));exports[_0x09b2('0x1')]=function(_0x1e2136){return client[_0x09b2('0x2')]('CreateMailMessage',{'body':_0x1e2136,'log':_0x09b2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 2e9c3fa..77b8d9e 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 _0x972b=['getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause','../client'];(function(_0xeb84b,_0x2e045c){var _0x19a09d=function(_0x5e1a96){while(--_0x5e1a96){_0xeb84b['push'](_0xeb84b['shift']());}};_0x19a09d(++_0x2e045c);}(_0x972b,0x18b));var _0xb972=function(_0x3ddfaf,_0x3ea732){_0x3ddfaf=_0x3ddfaf-0x0;var _0x352f07=_0x972b[_0x3ddfaf];return _0x352f07;};'use strict';var client=require(_0xb972('0x0'));exports[_0xb972('0x1')]=function(){return function(){return client[_0xb972('0x2')](_0xb972('0x3'),{'options':{'raw':![],'attributes':['id',_0xb972('0x4'),_0xb972('0x5'),_0xb972('0x6')],'include':[{'model':_0xb972('0x7'),'as':_0xb972('0x8'),'attributes':['id','name',_0xb972('0x9'),_0xb972('0xa')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0x547f=['strategy','User','Agents','online','mailPause','getMailQueues','Request','GetMailQueue'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x547f,0xa5));var _0xf547=function(_0x5b254c,_0x2f65cd){_0x5b254c=_0x5b254c-0x0;var _0x3394d8=_0x547f[_0x5b254c];return _0x3394d8;};'use strict';var client=require('../client');exports[_0xf547('0x0')]=function(){return function(){return client[_0xf547('0x1')](_0xf547('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xf547('0x3')],'include':[{'model':_0xf547('0x4'),'as':_0xf547('0x5'),'attributes':['id','name',_0xf547('0x6'),_0xf547('0x7')]}]},'log':_0xf547('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index bdd5cb0..1eda3a1 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 _0xf309=['../client','create','CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC'];(function(_0x2def17,_0x1037e4){var _0x52c09c=function(_0x4f5514){while(--_0x4f5514){_0x2def17['push'](_0x2def17['shift']());}};_0x52c09c(++_0x1037e4);}(_0xf309,0x103));var _0x9f30=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xf309[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x9f30('0x0'));exports[_0x9f30('0x1')]=function(_0x238c19){return client['Request']('CreateMailQueueReport',{'body':_0x238c19,'log':_0x9f30('0x2')});};exports[_0x9f30('0x3')]=function(_0x3b5cbd,_0x24bda4){return client[_0x9f30('0x4')](_0x9f30('0x5'),{'body':_0x24bda4,'options':{'where':{'uniqueid':_0x3b5cbd},'order':[['id',_0x9f30('0x6')]],'limit':0x1},'log':_0x9f30('0x5')});}; \ No newline at end of file +var _0xd374=['create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x474b00,_0x281516){var _0x48ca63=function(_0x41eb18){while(--_0x41eb18){_0x474b00['push'](_0x474b00['shift']());}};_0x48ca63(++_0x281516);}(_0xd374,0xc8));var _0x4d37=function(_0x86509f,_0x2de480){_0x86509f=_0x86509f-0x0;var _0xbf41b4=_0xd374[_0x86509f];return _0xbf41b4;};'use strict';var client=require('../client');exports[_0x4d37('0x0')]=function(_0x4d9895){return client['Request'](_0x4d37('0x1'),{'body':_0x4d9895,'log':_0x4d37('0x1')});};exports[_0x4d37('0x2')]=function(_0x1d957b,_0x5b6897){return client['Request'](_0x4d37('0x3'),{'body':_0x5b6897,'options':{'where':{'uniqueid':_0x1d957b},'order':[['id',_0x4d37('0x4')]],'limit':0x1},'log':_0x4d37('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 970bb00..209a3f3 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 _0xd97f=['../client','update','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x5e0f5b,_0x437b03){var _0x15898a=function(_0x1e53b5){while(--_0x1e53b5){_0x5e0f5b['push'](_0x5e0f5b['shift']());}};_0x15898a(++_0x437b03);}(_0xd97f,0x1ab));var _0xfd97=function(_0x5f3756,_0xa54ec7){_0x5f3756=_0x5f3756-0x0;var _0x4e5d2c=_0xd97f[_0x5f3756];return _0x4e5d2c;};'use strict';var client=require(_0xfd97('0x0'));exports[_0xfd97('0x1')]=function(_0x4b4340,_0x20558b){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x20558b,'options':{'where':{'id':_0x4b4340}},'log':_0xfd97('0x2')});};exports[_0xfd97('0x3')]=function(_0x46f5d9,_0x16cdea){return client[_0xfd97('0x4')](_0xfd97('0x5'),{'body':_0x16cdea,'options':{'where':{'id':_0x46f5d9}},'log':_0xfd97('0x6')});}; \ No newline at end of file +var _0x70fa=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','../client','update'];(function(_0x3c9b30,_0x923cce){var _0x32b462=function(_0x204307){while(--_0x204307){_0x3c9b30['push'](_0x3c9b30['shift']());}};_0x32b462(++_0x923cce);}(_0x70fa,0x1e4));var _0xa70f=function(_0xc81ca7,_0xb90d5){_0xc81ca7=_0xc81ca7-0x0;var _0x366401=_0x70fa[_0xc81ca7];return _0x366401;};'use strict';var client=require(_0xa70f('0x0'));exports[_0xa70f('0x1')]=function(_0x901711,_0x2b0117){return client['Request'](_0xa70f('0x2'),{'body':_0x2b0117,'options':{'where':{'id':_0x901711}},'log':_0xa70f('0x3')});};exports[_0xa70f('0x4')]=function(_0x529298,_0x5040d0){return client[_0xa70f('0x5')]('AddTagsToOpenchannelInteraction',{'body':_0x5040d0,'options':{'where':{'id':_0x529298}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index a72258e..d8783f0 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 _0x00bb=['CreateOpenchannelMessage','../client','create'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var client=require(_0xb00b('0x0'));exports[_0xb00b('0x1')]=function(_0x468a51){return client['Request'](_0xb00b('0x2'),{'body':_0x468a51,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xe14d=['Request','createOpenchannelMessage','../client','create'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe14d,0x1ee));var _0xde14=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xe14d[_0x257642];return _0x3d813b;};'use strict';var client=require(_0xde14('0x0'));exports[_0xde14('0x1')]=function(_0x1b5d3b){return client[_0xde14('0x2')]('CreateOpenchannelMessage',{'body':_0x1b5d3b,'log':_0xde14('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 08a6529..7214e74 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 _0xa66f=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','name','timeout','strategy'];(function(_0x3ed2ef,_0x296c36){var _0x3f231f=function(_0x423f2e){while(--_0x423f2e){_0x3ed2ef['push'](_0x3ed2ef['shift']());}};_0x3f231f(++_0x296c36);}(_0xa66f,0x175));var _0xfa66=function(_0x572b25,_0x5442c6){_0x572b25=_0x572b25-0x0;var _0x86b1f1=_0xa66f[_0x572b25];return _0x86b1f1;};'use strict';var client=require('../client');exports[_0xfa66('0x0')]=function(){return function(){return client[_0xfa66('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xfa66('0x2'),_0xfa66('0x3'),_0xfa66('0x4')],'include':[{'model':_0xfa66('0x5'),'as':_0xfa66('0x6'),'attributes':['id','name',_0xfa66('0x7'),_0xfa66('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x1082=['GetOpenchannelQueue','name','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x1082,0x156));var _0x2108=function(_0x574d9b,_0x2063da){_0x574d9b=_0x574d9b-0x0;var _0x31d2a5=_0x1082[_0x574d9b];return _0x31d2a5;};'use strict';var client=require(_0x2108('0x0'));exports[_0x2108('0x1')]=function(){return function(){return client['Request'](_0x2108('0x2'),{'options':{'raw':![],'attributes':['id',_0x2108('0x3'),'timeout',_0x2108('0x4')],'include':[{'model':_0x2108('0x5'),'as':_0x2108('0x6'),'attributes':['id',_0x2108('0x3'),'online',_0x2108('0x7')]}]},'log':_0x2108('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index c900821..bce1078 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 _0x619b=['Request','CreateOpenchannelQueueReport','update','DESC','create'];(function(_0x551108,_0x2afac5){var _0x73b895=function(_0x51a3f0){while(--_0x51a3f0){_0x551108['push'](_0x551108['shift']());}};_0x73b895(++_0x2afac5);}(_0x619b,0x9f));var _0xb619=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x619b[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require('../client');exports[_0xb619('0x0')]=function(_0x26987f){return client[_0xb619('0x1')](_0xb619('0x2'),{'body':_0x26987f,'log':_0xb619('0x2')});};exports[_0xb619('0x3')]=function(_0x3be97d,_0x4b61b4){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x4b61b4,'options':{'where':{'uniqueid':_0x3be97d},'order':[['id',_0xb619('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x55cd=['create','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x348ca1,_0x429707){var _0x466322=function(_0x131ed7){while(--_0x131ed7){_0x348ca1['push'](_0x348ca1['shift']());}};_0x466322(++_0x429707);}(_0x55cd,0x19f));var _0xd55c=function(_0x5cd864,_0xf99289){_0x5cd864=_0x5cd864-0x0;var _0x23771e=_0x55cd[_0x5cd864];return _0x23771e;};'use strict';var client=require('../client');exports[_0xd55c('0x0')]=function(_0x280b4e){return client['Request'](_0xd55c('0x1'),{'body':_0x280b4e,'log':_0xd55c('0x1')});};exports[_0xd55c('0x2')]=function(_0x55df5a,_0x347fc9){return client['Request'](_0xd55c('0x3'),{'body':_0x347fc9,'options':{'where':{'uniqueid':_0x55df5a},'order':[['id',_0xd55c('0x4')]],'limit':0x1},'log':_0xd55c('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 1957b63..5ea41e3 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 _0xab3d=['../client','Request','addTags','AddTagsToSmsInteraction'];(function(_0xc01bd9,_0xabb55a){var _0x2bdd92=function(_0x4aa5c2){while(--_0x4aa5c2){_0xc01bd9['push'](_0xc01bd9['shift']());}};_0x2bdd92(++_0xabb55a);}(_0xab3d,0xb0));var _0xdab3=function(_0x4aee96,_0x20e15c){_0x4aee96=_0x4aee96-0x0;var _0x3daba5=_0xab3d[_0x4aee96];return _0x3daba5;};'use strict';var client=require(_0xdab3('0x0'));exports['update']=function(_0x53e2a0,_0x578c88){return client[_0xdab3('0x1')]('UpdateSmsInteraction',{'body':_0x578c88,'options':{'where':{'id':_0x53e2a0}},'log':'updateSmsInteraction'});};exports[_0xdab3('0x2')]=function(_0x50e9a4,_0x538c9a){return client[_0xdab3('0x1')](_0xdab3('0x3'),{'body':_0x538c9a,'options':{'where':{'id':_0x50e9a4}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0xca8a=['update','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','addTagsToSmsInteraction','../client'];(function(_0x3ad474,_0x21bd8e){var _0x38801b=function(_0x4152a8){while(--_0x4152a8){_0x3ad474['push'](_0x3ad474['shift']());}};_0x38801b(++_0x21bd8e);}(_0xca8a,0xca));var _0xaca8=function(_0x300e32,_0x2c8a78){_0x300e32=_0x300e32-0x0;var _0x19d1ca=_0xca8a[_0x300e32];return _0x19d1ca;};'use strict';var client=require(_0xaca8('0x0'));exports[_0xaca8('0x1')]=function(_0x4dd6b7,_0x5d1b91){return client[_0xaca8('0x2')](_0xaca8('0x3'),{'body':_0x5d1b91,'options':{'where':{'id':_0x4dd6b7}},'log':_0xaca8('0x4')});};exports[_0xaca8('0x5')]=function(_0x4317aa,_0x1c1b74){return client[_0xaca8('0x2')]('AddTagsToSmsInteraction',{'body':_0x1c1b74,'options':{'where':{'id':_0x4317aa}},'log':_0xaca8('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 20502bd..fe24759 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 _0x5137=['createSmsMessage','../client','Request'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x5137,0x1c9));var _0x7513=function(_0x4760d1,_0x6490d3){_0x4760d1=_0x4760d1-0x0;var _0x5870a4=_0x5137[_0x4760d1];return _0x5870a4;};'use strict';var client=require(_0x7513('0x0'));exports['create']=function(_0x2100fd){return client[_0x7513('0x1')]('CreateSmsMessage',{'body':_0x2100fd,'log':_0x7513('0x2')});}; \ No newline at end of file +var _0x4c2e=['CreateSmsMessage','createSmsMessage','../client','Request'];(function(_0x4c3904,_0x56db61){var _0x44fd48=function(_0x1e84a2){while(--_0x1e84a2){_0x4c3904['push'](_0x4c3904['shift']());}};_0x44fd48(++_0x56db61);}(_0x4c2e,0xfe));var _0xe4c2=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x4c2e[_0x88cd7b];return _0x56fcc8;};'use strict';var client=require(_0xe4c2('0x0'));exports['create']=function(_0x44efeb){return client[_0xe4c2('0x1')](_0xe4c2('0x2'),{'body':_0x44efeb,'log':_0xe4c2('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 9db6997..1028c06 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 _0x35a5=['timeout','User','Agents','online','smsPause','GetSmsQueue','name'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x35a5,0x1b7));var _0x535a=function(_0x299989,_0x2eb785){_0x299989=_0x299989-0x0;var _0x279289=_0x35a5[_0x299989];return _0x279289;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client['Request'](_0x535a('0x0'),{'options':{'raw':![],'attributes':['id',_0x535a('0x1'),_0x535a('0x2'),'strategy'],'include':[{'model':_0x535a('0x3'),'as':_0x535a('0x4'),'attributes':['id',_0x535a('0x1'),_0x535a('0x5'),_0x535a('0x6')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0x727a=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause','../client'];(function(_0x135b26,_0x55cf7e){var _0x2170f7=function(_0x12b4a3){while(--_0x12b4a3){_0x135b26['push'](_0x135b26['shift']());}};_0x2170f7(++_0x55cf7e);}(_0x727a,0x95));var _0xa727=function(_0x163992,_0x1fe416){_0x163992=_0x163992-0x0;var _0x195179=_0x727a[_0x163992];return _0x195179;};'use strict';var client=require(_0xa727('0x0'));exports[_0xa727('0x1')]=function(){return function(){return client[_0xa727('0x2')](_0xa727('0x3'),{'options':{'raw':![],'attributes':['id',_0xa727('0x4'),_0xa727('0x5'),_0xa727('0x6')],'include':[{'model':'User','as':_0xa727('0x7'),'attributes':['id',_0xa727('0x4'),_0xa727('0x8'),_0xa727('0x9')]}]},'log':_0xa727('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ab1a3b8..ecef431 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 _0x4502=['update','Request','UpdateSmsQueueReport','DESC','../client','create'];(function(_0xd863d4,_0x2d5e66){var _0x15c91d=function(_0x4c3567){while(--_0x4c3567){_0xd863d4['push'](_0xd863d4['shift']());}};_0x15c91d(++_0x2d5e66);}(_0x4502,0xa0));var _0x2450=function(_0x56040e,_0x15ae2b){_0x56040e=_0x56040e-0x0;var _0x4e40f5=_0x4502[_0x56040e];return _0x4e40f5;};'use strict';var client=require(_0x2450('0x0'));exports[_0x2450('0x1')]=function(_0x42076b){return client['Request']('CreateSmsQueueReport',{'body':_0x42076b,'log':'CreateSmsQueueReport'});};exports[_0x2450('0x2')]=function(_0x3d7eea,_0x4a70eb){return client[_0x2450('0x3')](_0x2450('0x4'),{'body':_0x4a70eb,'options':{'where':{'uniqueid':_0x3d7eea},'order':[['id',_0x2450('0x5')]],'limit':0x1},'log':_0x2450('0x4')});}; \ No newline at end of file +var _0x89f5=['Request','CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','create'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x89f5,0x118));var _0x589f=function(_0xd73a2e,_0x221610){_0xd73a2e=_0xd73a2e-0x0;var _0x4da810=_0x89f5[_0xd73a2e];return _0x4da810;};'use strict';var client=require(_0x589f('0x0'));exports[_0x589f('0x1')]=function(_0x3ff65c){return client[_0x589f('0x2')]('CreateSmsQueueReport',{'body':_0x3ff65c,'log':_0x589f('0x3')});};exports['update']=function(_0x507fa5,_0x795c30){return client[_0x589f('0x2')](_0x589f('0x4'),{'body':_0x795c30,'options':{'where':{'uniqueid':_0x507fa5},'order':[['id',_0x589f('0x5')]],'limit':0x1},'log':_0x589f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 86d8c55..11f1086 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 _0xaf83=['name','online','pauseType','lastPauseAt','voicePause','chatPause','mailPause','faxPause','openchannelPause','getAgents','agent'];(function(_0x46e655,_0x500988){var _0x2c4946=function(_0x479963){while(--_0x479963){_0x46e655['push'](_0x46e655['shift']());}};_0x2c4946(++_0x500988);}(_0xaf83,0x15e));var _0x3af8=function(_0x1494e8,_0x3c8327){_0x1494e8=_0x1494e8-0x0;var _0x28e3c3=_0xaf83[_0x1494e8];return _0x28e3c3;};'use strict';var client=require('../client');exports[_0x3af8('0x0')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x3af8('0x1')},'attributes':['id',_0x3af8('0x2'),_0x3af8('0x3'),_0x3af8('0x4'),_0x3af8('0x5'),_0x3af8('0x6'),_0x3af8('0x7'),_0x3af8('0x8'),_0x3af8('0x9'),'smsPause',_0x3af8('0xa'),'chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity']},'log':_0x3af8('0x0')});};}; \ No newline at end of file +var _0xe5f0=['mailPause','smsPause','chatCapacity','mailCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','GetUser','agent','name','online','pauseType','lastPauseAt','voicePause','chatPause'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xe5f0,0xe3));var _0x0e5f=function(_0x406402,_0x14113b){_0x406402=_0x406402-0x0;var _0x7d255e=_0xe5f0[_0x406402];return _0x7d255e;};'use strict';var client=require(_0x0e5f('0x0'));exports[_0x0e5f('0x1')]=function(){return function(){return client[_0x0e5f('0x2')](_0x0e5f('0x3'),{'options':{'raw':!![],'where':{'role':_0x0e5f('0x4')},'attributes':['id',_0x0e5f('0x5'),_0x0e5f('0x6'),_0x0e5f('0x7'),_0x0e5f('0x8'),_0x0e5f('0x9'),_0x0e5f('0xa'),_0x0e5f('0xb'),'faxPause',_0x0e5f('0xc'),'openchannelPause',_0x0e5f('0xd'),_0x0e5f('0xe'),'faxCapacity',_0x0e5f('0xf'),_0x0e5f('0x10')]},'log':_0x0e5f('0x1')});};}; \ 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 71a9562..b6572e0 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 _0xb10b=['[%s][QUEUE]\x20%s','stringify','validate','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','agents','timeout','createQueue','channel','format','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x2d8434,_0x43d781){var _0x26b9e4=function(_0x54f5b8){while(--_0x54f5b8){_0x2d8434['push'](_0x2d8434['shift']());}};_0x26b9e4(++_0x43d781);}(_0xb10b,0x12a));var _0xbb10=function(_0x49bf83,_0x3a54dc){_0x49bf83=_0x49bf83-0x0;var _0x339b39=_0xb10b[_0x49bf83];return _0x339b39;};'use strict';var schema=require(_0xbb10('0x0'));var _=require('lodash');var util=require(_0xbb10('0x1'));var seqqueue=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('routing');var strategy=require(_0xbb10('0x4'));var queue=schema({'name':{'type':_0xbb10('0x5'),'required':!![],'message':_0xbb10('0x6')},'timeout':{'type':_0xbb10('0x7'),'message':_0xbb10('0x8')}});function writeLog(_0x312b72,_0x481979,_0x328583){return logger[_0xbb10('0x9')](util['format'](_0xbb10('0xa'),_0x312b72,_0x481979[_0xbb10('0xb')],_0x328583));}function handleFindAgent(_0x21370f){return function(_0x1c3ee5){return _0x1c3ee5[_0xbb10('0xb')][_0xbb10('0xc')]()===_0x21370f[_0xbb10('0xc')]();};}exports[_0xbb10('0xd')]=function(_0x5ab04a,_0x4e47f8,_0x20bd61,_0x118a74){return function(_0xce64f3){try{var _0x5e136d={'name':_0x4e47f8[0x0],'timeout':_0x4e47f8[0x1]};var _0x408248=queue['validate'](_0x5e136d,{'typecast':!![]});if(_0x408248[_0xbb10('0xe')]){logger[_0xbb10('0xf')](_0xbb10('0x10'),_0x5ab04a,_[_0xbb10('0x11')](_0x408248,_0xbb10('0x12'))[_0xbb10('0x13')](',\x20'));_0xce64f3['stop']();}else{var _0x26e021=_[_0xbb10('0x14')](_0x20bd61[_0xbb10('0x15')],handleFindAgent(_0x5e136d[_0xbb10('0xb')]));if(_0x26e021){var _0x3df17b=(_0x5e136d[_0xbb10('0x16')]||0xa)*0x3e8;var _0x24a57b,_0x36b5e8;var _0x3e26f4=seqqueue[_0xbb10('0x17')](_0x3df17b);_0x3e26f4['id']=_0x5ab04a;_0x3e26f4['atimeout']=_0x3df17b;_0x3e26f4[_0xbb10('0x18')]=_0x118a74[_0xbb10('0x18')];writeLog(_0x5ab04a,_0x26e021,util[_0xbb10('0x19')](_0xbb10('0x1a'),_0x3df17b));_0x24a57b=setInterval(function(){if(_0x20bd61[_0xbb10('0x1b')]&&!_0x20bd61[_0xbb10('0x1b')][_0x5ab04a]){logger[_0xbb10('0x9')](_0xbb10('0x1c'),_0x5ab04a);clearInterval(_0x24a57b);clearTimeout(_0x36b5e8);_0x36b5e8=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x1e')]();}},0x3e8);_0x36b5e8=setTimeout(function(){logger['info'](_0xbb10('0x1f'),_0x5ab04a);clearInterval(_0x24a57b);_0x24a57b=undefined;_0x3e26f4[_0xbb10('0x1d')](!![]);_0xce64f3[_0xbb10('0x20')]();},_0x3df17b);strategy[_0xbb10('0x21')](_0x3e26f4,_0x26e021,_0x20bd61,_0x118a74);}else{logger[_0xbb10('0xf')](_0xbb10('0x22'),_0x5ab04a,_0x5e136d['name']);_0xce64f3[_0xbb10('0x1e')]();}}}catch(_0x12ef77){console['log'](_0x12ef77);logger['error'](_0xbb10('0x23'),_0x5ab04a,JSON[_0xbb10('0x24')](_0x12ef77));_0xce64f3[_0xbb10('0x1e')]();}};}; \ No newline at end of file +var _0xa9e0=['agents','name','atimeout','channel','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','stringify','validate','lodash','util','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','stop','find'];(function(_0x4810a7,_0x21f10b){var _0x3a7b9f=function(_0x269a32){while(--_0x269a32){_0x4810a7['push'](_0x4810a7['shift']());}};_0x3a7b9f(++_0x21f10b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var schema=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')(_0x0a9e('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x0a9e('0x4'),'required':!![],'message':_0x0a9e('0x5')},'timeout':{'type':_0x0a9e('0x6'),'message':_0x0a9e('0x7')}});function writeLog(_0x981158,_0x57b080,_0x219af0){return logger[_0x0a9e('0x8')](util[_0x0a9e('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x981158,_0x57b080['name'],_0x219af0));}function handleFindAgent(_0xe42b77){return function(_0x56465b){return _0x56465b['name'][_0x0a9e('0xa')]()===_0xe42b77[_0x0a9e('0xa')]();};}exports[_0x0a9e('0xb')]=function(_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56){return function(_0x50dfb2){try{var _0x527cdd={'name':_0xfeb75b[0x0],'timeout':_0xfeb75b[0x1]};var _0x4cfe67=queue[_0x0a9e('0x0')](_0x527cdd,{'typecast':!![]});if(_0x4cfe67[_0x0a9e('0xc')]){logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x3ab53f,_[_0x0a9e('0xf')](_0x4cfe67,_0x0a9e('0x10'))['join'](',\x20'));_0x50dfb2[_0x0a9e('0x11')]();}else{var _0x239b12=_[_0x0a9e('0x12')](_0xbd1168[_0x0a9e('0x13')],handleFindAgent(_0x527cdd[_0x0a9e('0x14')]));if(_0x239b12){var _0x4d5611=(_0x527cdd['timeout']||0xa)*0x3e8;var _0x22dccb,_0x5d0880;var _0x1985b6=seqqueue['createQueue'](_0x4d5611);_0x1985b6['id']=_0x3ab53f;_0x1985b6[_0x0a9e('0x15')]=_0x4d5611;_0x1985b6[_0x0a9e('0x16')]=_0x4a4c56['channel'];writeLog(_0x3ab53f,_0x239b12,util[_0x0a9e('0x9')]('START:%s',_0x4d5611));_0x22dccb=setInterval(function(){if(_0xbd1168[_0x0a9e('0x17')]&&!_0xbd1168[_0x0a9e('0x17')][_0x3ab53f]){logger[_0x0a9e('0x8')](_0x0a9e('0x18'),_0x3ab53f);clearInterval(_0x22dccb);clearTimeout(_0x5d0880);_0x5d0880=undefined;_0x1985b6[_0x0a9e('0x19')](!![]);_0x50dfb2[_0x0a9e('0x11')]();}},0x3e8);_0x5d0880=setTimeout(function(){logger[_0x0a9e('0x8')](_0x0a9e('0x1a'),_0x3ab53f);clearInterval(_0x22dccb);_0x22dccb=undefined;_0x1985b6[_0x0a9e('0x19')](!![]);_0x50dfb2[_0x0a9e('0x1b')]();},_0x4d5611);strategy[_0x0a9e('0x1c')](_0x1985b6,_0x239b12,_0xbd1168,_0x4a4c56);}else{logger[_0x0a9e('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3ab53f,_0x527cdd[_0x0a9e('0x14')]);_0x50dfb2[_0x0a9e('0x11')]();}}}catch(_0x53682f){console[_0x0a9e('0x1d')](_0x53682f);logger['error']('[%s][QUEUE]\x20%s',_0x3ab53f,JSON[_0x0a9e('0x1e')](_0x53682f));_0x50dfb2[_0x0a9e('0x11')]();}};}; \ 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 def519b..b8c4368 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 _0xe706=['next','channel','getMustacheRender','YYYY-MM-DD\x20HH:mm:ss','out','message','from','read','subject','Re:','Re:\x20','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','html','','replace','body','';return mailRpc[_0x6e70('0x33')](_0x228350,_0x37b3e0)['then'](function(_0x259486){logger['info'](_0x6e70('0x34'),_0x1b0389);_0x37b3e0[_0x6e70('0x2c')]=_0x259486[_0x6e70('0x16')]['messageId'];return rpc[_0x743eb5+_0x6e70('0x22')][_0x6e70('0x35')](_0x37b3e0);})['then'](function(_0x13d673){logger[_0x6e70('0xe')]('[%s][AUTOREPLY]\x20%s',_0x1b0389,JSON[_0x6e70('0x36')](_0x13d673));})[_0x6e70('0x37')](function(_0x2d52bd){logger[_0x6e70('0x38')](_0x6e70('0x39'),_0x1b0389,JSON[_0x6e70('0x36')](_0x2d52bd));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}else{return rpc[this[_0x6e70('0x12')]+_0x6e70('0x22')]['create'](_0x37b3e0)[_0x6e70('0x3b')](function(_0x4795a0){logger[_0x6e70('0xe')](_0x6e70('0xf'),_0x1b0389,_0x37b3e0[_0x6e70('0x30')]);})[_0x6e70('0x37')](function(_0x233a83){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON[_0x6e70('0x36')](_0x233a83));})[_0x6e70('0x3a')](function(){_0x36357b[_0x6e70('0x11')]();});}}}catch(_0x2a5444){logger[_0x6e70('0x38')](_0x6e70('0xf'),_0x1b0389,JSON['stringify'](_0x2a5444));_0x36357b['stop']();}};}; \ No newline at end of file +var _0xa9e0=['messageId','html','replace','body',''+_[_0x0a9e('0x29')](_0xbd1168[_0x0a9e('0x2a')],_0x0a9e('0x2b'),_0x0a9e('0x2c'))+'';return mailRpc[_0x0a9e('0x2d')](_0x20f109,_0xbd1168)[_0x0a9e('0x2e')](function(_0x1843b2){logger[_0x0a9e('0x2f')](_0x0a9e('0x30'),_0x57b080);_0xbd1168[_0x0a9e('0x27')]=_0x1843b2[_0x0a9e('0x10')][_0x0a9e('0x27')];return rpc[_0x3ab53f+_0x0a9e('0x1d')]['create'](_0xbd1168);})[_0x0a9e('0x2e')](function(_0x5d1e0e){logger[_0x0a9e('0x2f')](_0x0a9e('0xb'),_0x57b080,JSON[_0x0a9e('0x31')](_0x5d1e0e));})[_0x0a9e('0x32')](function(_0x25ce3a){logger['error'](_0x0a9e('0x33'),_0x57b080,JSON[_0x0a9e('0x31')](_0x25ce3a));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}else{return rpc[this[_0x0a9e('0xe')]+_0x0a9e('0x1d')][_0x0a9e('0x35')](_0xbd1168)[_0x0a9e('0x2e')](function(_0x5583a4){logger[_0x0a9e('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x57b080,_0xbd1168[_0x0a9e('0x2a')]);})[_0x0a9e('0x32')](function(_0x2b7e7f){logger[_0x0a9e('0x36')]('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x2b7e7f));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}}}catch(_0x15de0e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x15de0e));_0x441e3a['stop']();}};}; \ 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 8492514..335acbe 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 _0x1bc6=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','update','interaction','then','[%s][CLOSE]\x20%s','stringify','error','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction'];(function(_0x5bd755,_0x3d74ec){var _0x27b9de=function(_0xc6d925){while(--_0xc6d925){_0x5bd755['push'](_0x5bd755['shift']());}};_0x27b9de(++_0x3d74ec);}(_0x1bc6,0x94));var _0x61bc=function(_0x39d3f5,_0x6864d7){_0x39d3f5=_0x39d3f5-0x0;var _0x4e4aca=_0x1bc6[_0x39d3f5];return _0x4e4aca;};'use strict';var moment=require(_0x61bc('0x0'));var logger=require(_0x61bc('0x1'))(_0x61bc('0x2'));var rpc={'chatInteraction':require(_0x61bc('0x3')),'openchannelInteraction':require(_0x61bc('0x4')),'smsInteraction':require(_0x61bc('0x5')),'mailInteraction':require(_0x61bc('0x6')),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0x61bc('0x7')]=function(_0x364993,_0x344a7,_0x225202,_0x362ebb){return function(_0x1af9bc){try{logger[_0x61bc('0x8')](_0x61bc('0x9'),_0x364993,_0x344a7[0x0]);var _0x151ef4={'closed':0x1,'closedAt':moment()['format'](_0x61bc('0xa')),'closeReason':'system','disposition':_0x344a7[0x0]};if(rpc[_0x362ebb[_0x61bc('0xb')]+'Interaction']){rpc[_0x362ebb[_0x61bc('0xb')]+'Interaction'][_0x61bc('0xc')](_0x362ebb[_0x61bc('0xd')]['id'],_0x151ef4)[_0x61bc('0xe')](function(_0x5f2543){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x364993,_0x362ebb['interaction']['id']);})['catch'](function(_0x378b24){logger['error'](_0x61bc('0xf'),_0x364993,JSON[_0x61bc('0x10')](_0x378b24));})['finally'](function(){_0x1af9bc['stop']();});}}catch(_0x5cfac9){logger[_0x61bc('0x11')](_0x61bc('0xf'),_0x364993,JSON['stringify'](_0x5cfac9));_0x1af9bc[_0x61bc('0x12')]();}};}; \ No newline at end of file +var _0xc933=['info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','then'];(function(_0x311cf6,_0x5994fd){var _0x47fe75=function(_0x4f1c03){while(--_0x4f1c03){_0x311cf6['push'](_0x311cf6['shift']());}};_0x47fe75(++_0x5994fd);}(_0xc933,0xf9));var _0x3c93=function(_0x37c37e,_0x52f1c0){_0x37c37e=_0x37c37e-0x0;var _0x3e3182=_0xc933[_0x37c37e];return _0x3e3182;};'use strict';var moment=require(_0x3c93('0x0'));var logger=require(_0x3c93('0x1'))(_0x3c93('0x2'));var rpc={'chatInteraction':require(_0x3c93('0x3')),'openchannelInteraction':require(_0x3c93('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x3c93('0x5')),'faxInteraction':require(_0x3c93('0x6'))};exports[_0x3c93('0x7')]=function(_0x343f96,_0x26478a,_0x47a995,_0x1f2667){return function(_0x19939f){try{logger['info'](_0x3c93('0x8'),_0x343f96,_0x26478a[0x0]);var _0x489139={'closed':0x1,'closedAt':moment()[_0x3c93('0x9')](_0x3c93('0xa')),'closeReason':_0x3c93('0xb'),'disposition':_0x26478a[0x0]};if(rpc[_0x1f2667[_0x3c93('0xc')]+_0x3c93('0xd')]){rpc[_0x1f2667[_0x3c93('0xc')]+'Interaction']['update'](_0x1f2667['interaction']['id'],_0x489139)[_0x3c93('0xe')](function(_0x39ff98){logger[_0x3c93('0xf')](_0x3c93('0x10'),_0x343f96,_0x1f2667[_0x3c93('0x11')]['id']);})[_0x3c93('0x12')](function(_0x283ed8){logger[_0x3c93('0x13')](_0x3c93('0x14'),_0x343f96,JSON[_0x3c93('0x15')](_0x283ed8));})[_0x3c93('0x16')](function(){_0x19939f[_0x3c93('0x17')]();});}}catch(_0xaa2eae){logger[_0x3c93('0x13')](_0x3c93('0x14'),_0x343f96,JSON[_0x3c93('0x15')](_0xaa2eae));_0x19939f[_0x3c93('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 9e33e9f..53df5af 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 _0xd117=['info','[%s][DIALOGFLOW]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','account','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','metadata','error','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId'];(function(_0x2f833a,_0x5c0f24){var _0x496633=function(_0x5f1504){while(--_0x5f1504){_0x2f833a['push'](_0x2f833a['shift']());}};_0x496633(++_0x5c0f24);}(_0xd117,0x182));var _0x7d11=function(_0x54e6f5,_0x4f4e99){_0x54e6f5=_0x54e6f5-0x0;var _0x5e8794=_0xd117[_0x54e6f5];return _0x5e8794;};'use strict';var _=require(_0x7d11('0x0'));var moment=require(_0x7d11('0x1'));var apiai=require(_0x7d11('0x2'));var utils=require(_0x7d11('0x3'));var logger=require(_0x7d11('0x4'))(_0x7d11('0x5'));var rpc={'chatMessage':require(_0x7d11('0x6')),'openchannelMessage':require(_0x7d11('0x7')),'mailMessage':require(_0x7d11('0x8')),'smsMessage':require(_0x7d11('0x9')),'faxMessage':require(_0x7d11('0xa'))};exports[_0x7d11('0xb')]=function(_0x27d7e8,_0x40c3c4){return function(_0x345602){try{if(!_[_0x7d11('0xc')](this['interaction'][_0x7d11('0xd')])){logger[_0x7d11('0xe')](_0x7d11('0xf'),_0x27d7e8,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x345602[_0x7d11('0x10')]();}var _0x30cc64={'ContactId':this[_0x7d11('0x11')]['id'],'sentAt':moment()['format'](_0x7d11('0x12')),'direction':'out'};var _0x58a6fd=this[_0x7d11('0x13')];if(_0x58a6fd==='chat'){_0x30cc64['ChatWebsiteId']=this[_0x7d11('0x14')]['id'];}else{_0x30cc64[_['upperFirst'](_0x58a6fd)+_0x7d11('0x15')]=this[_0x7d11('0x14')]['id'];}_0x30cc64[_['upperFirst'](_0x58a6fd)+_0x7d11('0x16')]=this[_0x7d11('0x17')]['id'];if(this['interaction'][_0x7d11('0x18')]){var _0x16949d=_0x40c3c4[0x2];if(!_[_0x7d11('0x19')](_0x16949d)){_0x30cc64[_0x7d11('0x1a')]=utils[_0x7d11('0x1b')](_0x16949d,this);return rpc[_0x58a6fd+_0x7d11('0x1c')][_0x7d11('0x1d')](_0x30cc64)[_0x7d11('0x1e')](function(_0x4aa795){logger[_0x7d11('0xe')](_0x7d11('0xf'),_0x27d7e8,_0x30cc64[_0x7d11('0x1a')]);})[_0x7d11('0x1f')](function(_0x45f916){logger['error'](_0x7d11('0xf'),_0x27d7e8,JSON[_0x7d11('0x20')](_0x45f916));})['finally'](function(){logger['info'](_0x7d11('0x21'),_0x27d7e8);_0x345602['stop']();});}else{logger[_0x7d11('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x27d7e8);_0x345602[_0x7d11('0x22')]();}}else{var _0x17e539=apiai(_0x40c3c4[0x0],{'language':_0x40c3c4[0x1]||'en'});return _0x17e539[_0x7d11('0x23')](this[_0x7d11('0x24')][_0x7d11('0x1a')],{'sessionId':this[_0x7d11('0x17')]['id']})[_0x7d11('0x1e')](function(_0x3d2574){_0x30cc64['body']=_0x3d2574[_0x7d11('0x25')]['fulfillment']['speech'];return rpc[_0x58a6fd+'Message'][_0x7d11('0x1d')](_0x30cc64)[_0x7d11('0x1e')](function(_0x44476c){logger[_0x7d11('0xe')](_0x7d11('0xf'),_0x27d7e8,_0x30cc64[_0x7d11('0x1a')]);if(_0x3d2574[_0x7d11('0x25')][_0x7d11('0x26')]['endConversation']){_0x345602[_0x7d11('0x10')]();}else{_0x345602['stop']();}})['catch'](function(_0x5126cf){logger[_0x7d11('0x27')]('[%s][DIALOGFLOW]\x20%s',_0x27d7e8,JSON[_0x7d11('0x20')](_0x5126cf));_0x345602[_0x7d11('0x10')]();});});}}catch(_0x328ab7){logger['error'](_0x7d11('0xf'),_0x27d7e8,JSON[_0x7d11('0x20')](_0x328ab7));_0x345602[_0x7d11('0x22')]();}};}; \ No newline at end of file +var _0x82c4=['AccountId','InteractionId','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','speech','metadata','lodash','moment','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','chat','account','upperFirst'];(function(_0x4361e9,_0x3bdf99){var _0x29e3f8=function(_0x3ff6c5){while(--_0x3ff6c5){_0x4361e9['push'](_0x4361e9['shift']());}};_0x29e3f8(++_0x3bdf99);}(_0x82c4,0x1ca));var _0x482c=function(_0x1ae4c0,_0x2212ed){_0x1ae4c0=_0x1ae4c0-0x0;var _0xe6b31b=_0x82c4[_0x1ae4c0];return _0xe6b31b;};'use strict';var _=require(_0x482c('0x0'));var moment=require(_0x482c('0x1'));var apiai=require(_0x482c('0x2'));var utils=require(_0x482c('0x3'));var logger=require(_0x482c('0x4'))(_0x482c('0x5'));var rpc={'chatMessage':require(_0x482c('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x482c('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x482c('0x8'))};exports['consequence']=function(_0x477cf4,_0x5d7c76){return function(_0xfdb92){try{if(!_[_0x482c('0x9')](this[_0x482c('0xa')][_0x482c('0xb')])){logger[_0x482c('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x477cf4,_0x482c('0xd'));return _0xfdb92[_0x482c('0xe')]();}var _0x3859ad={'ContactId':this[_0x482c('0xf')]['id'],'sentAt':moment()[_0x482c('0x10')](_0x482c('0x11')),'direction':'out'};var _0x4df2a1=this[_0x482c('0x12')];if(_0x4df2a1===_0x482c('0x13')){_0x3859ad['ChatWebsiteId']=this[_0x482c('0x14')]['id'];}else{_0x3859ad[_[_0x482c('0x15')](_0x4df2a1)+_0x482c('0x16')]=this['account']['id'];}_0x3859ad[_['upperFirst'](_0x4df2a1)+_0x482c('0x17')]=this[_0x482c('0xa')]['id'];if(this['interaction']['created']){var _0x14452b=_0x5d7c76[0x2];if(!_[_0x482c('0x18')](_0x14452b)){_0x3859ad[_0x482c('0x19')]=utils[_0x482c('0x1a')](_0x14452b,this);return rpc[_0x4df2a1+_0x482c('0x1b')][_0x482c('0x1c')](_0x3859ad)[_0x482c('0x1d')](function(_0xf65563){logger[_0x482c('0xc')](_0x482c('0x1e'),_0x477cf4,_0x3859ad[_0x482c('0x19')]);})[_0x482c('0x1f')](function(_0x4bdf15){logger[_0x482c('0x20')]('[%s][DIALOGFLOW]\x20%s',_0x477cf4,JSON[_0x482c('0x21')](_0x4bdf15));})[_0x482c('0x22')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x477cf4);_0xfdb92[_0x482c('0x23')]();});}else{logger['info'](_0x482c('0x24'),_0x477cf4);_0xfdb92[_0x482c('0x23')]();}}else{var _0x281c60=apiai(_0x5d7c76[0x0],{'language':_0x5d7c76[0x1]||'en'});return _0x281c60[_0x482c('0x25')](this['message'][_0x482c('0x19')],{'sessionId':this[_0x482c('0xa')]['id']})[_0x482c('0x1d')](function(_0xd18658){_0x3859ad[_0x482c('0x19')]=_0xd18658['result']['fulfillment'][_0x482c('0x26')];return rpc[_0x4df2a1+_0x482c('0x1b')][_0x482c('0x1c')](_0x3859ad)['then'](function(_0x3d5490){logger['info'](_0x482c('0x1e'),_0x477cf4,_0x3859ad[_0x482c('0x19')]);if(_0xd18658['result'][_0x482c('0x27')]['endConversation']){_0xfdb92['next']();}else{_0xfdb92[_0x482c('0x23')]();}})[_0x482c('0x1f')](function(_0x36b25c){logger[_0x482c('0x20')](_0x482c('0x1e'),_0x477cf4,JSON[_0x482c('0x21')](_0x36b25c));_0xfdb92[_0x482c('0xe')]();});});}}catch(_0x5ad788){logger[_0x482c('0x20')](_0x482c('0x1e'),_0x477cf4,JSON['stringify'](_0x5ad788));_0xfdb92[_0x482c('0x23')]();}};}; \ 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 6ee572a..e323de3 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 _0x6bb7=['stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','error','[%s][GOTOIF]\x20%s','message','join','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x6bb7,0x14c));var _0x76bb=function(_0x4ed06b,_0x393f8e){_0x4ed06b=_0x4ed06b-0x0;var _0x469c10=_0x6bb7[_0x4ed06b];return _0x469c10;};'use strict';var schema=require(_0x76bb('0x0'));var _=require(_0x76bb('0x1'));var htmlToText=require(_0x76bb('0x2'));var utils=require(_0x76bb('0x3'));var logger=require(_0x76bb('0x4'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x76bb('0x5')},'priorityTrue':{'type':'number','message':_0x76bb('0x6')},'priorityFalse':{'type':_0x76bb('0x7'),'message':_0x76bb('0x8')}});exports[_0x76bb('0x9')]=function(_0x1c90e6,_0x2a64b1){return function(_0x57686e){try{var _0x4b3960={'condition':htmlToText['fromString'](utils[_0x76bb('0xa')](_0x2a64b1[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2a64b1[0x1],'priorityFalse':_0x2a64b1[0x2]};var _0x4d31be=gotoif['validate'](_0x4b3960,{'typecast':!![]});if(_0x4d31be['length']){logger[_0x76bb('0xb')](_0x76bb('0xc'),_0x1c90e6,_['map'](_0x4d31be,_0x76bb('0xd'))[_0x76bb('0xe')](',\x20'));_0x57686e['stop']();}else{try{var _0x59d842=eval('('+_0x4b3960['condition']+')');var _0x12ebb1=_0x59d842?_0x4b3960['priorityTrue']:_0x4b3960[_0x76bb('0xf')];logger[_0x76bb('0x10')](_0x76bb('0x11'),_0x1c90e6,_0x4b3960['condition'],_0x59d842,_0x12ebb1||_0x76bb('0x12'));if(_0x12ebb1){var _0x366ec0=_['findIndex'](_0x57686e['rules'](),{'p':_0x12ebb1});if(_0x366ec0>=0x0){logger['info'](_0x76bb('0x13'),_0x1c90e6,_0x12ebb1||_0x76bb('0x12'),_0x366ec0);_0x57686e[_0x76bb('0x12')](_0x366ec0);}else{logger[_0x76bb('0x10')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x1c90e6,_0x12ebb1||_0x76bb('0x12'));_0x57686e[_0x76bb('0x14')]();}}else{_0x57686e[_0x76bb('0x12')]();}}catch(_0x38706d){logger[_0x76bb('0xb')](_0x76bb('0x15'),_0x1c90e6,_0x38706d[_0x76bb('0xd')]);_0x57686e[_0x76bb('0x14')]();}}}catch(_0x3b1a92){logger[_0x76bb('0xb')]('[%s][GOTOIF]\x20%s',_0x1c90e6,JSON['stringify'](_0x3b1a92));_0x57686e[_0x76bb('0x14')]();}};}; \ No newline at end of file +var _0x1c82=['./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','lodash','html-to-text'];(function(_0x318670,_0x5220f0){var _0xffc4bc=function(_0x13469e){while(--_0x13469e){_0x318670['push'](_0x318670['shift']());}};_0xffc4bc(++_0x5220f0);}(_0x1c82,0x1a2));var _0x21c8=function(_0x237566,_0x2c9246){_0x237566=_0x237566-0x0;var _0x1b7d77=_0x1c82[_0x237566];return _0x1b7d77;};'use strict';var schema=require('validate');var _=require(_0x21c8('0x0'));var htmlToText=require(_0x21c8('0x1'));var utils=require(_0x21c8('0x2'));var logger=require(_0x21c8('0x3'))(_0x21c8('0x4'));var gotoif=schema({'condition':{'type':_0x21c8('0x5'),'required':!![],'message':_0x21c8('0x6')},'priorityTrue':{'type':_0x21c8('0x7'),'message':_0x21c8('0x8')},'priorityFalse':{'type':_0x21c8('0x7'),'message':_0x21c8('0x9')}});exports['consequence']=function(_0x3a70b0,_0x28267d){return function(_0x4364f5){try{var _0x3de2e2={'condition':htmlToText[_0x21c8('0xa')](utils[_0x21c8('0xb')](_0x28267d[0x0],this),{'wordwrap':![]})[_0x21c8('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x28267d[0x1],'priorityFalse':_0x28267d[0x2]};var _0x4e8a99=gotoif[_0x21c8('0xd')](_0x3de2e2,{'typecast':!![]});if(_0x4e8a99[_0x21c8('0xe')]){logger[_0x21c8('0xf')](_0x21c8('0x10'),_0x3a70b0,_[_0x21c8('0x11')](_0x4e8a99,_0x21c8('0x12'))[_0x21c8('0x13')](',\x20'));_0x4364f5['stop']();}else{try{var _0x3d46e5=eval('('+_0x3de2e2[_0x21c8('0x14')]+')');var _0x2d192e=_0x3d46e5?_0x3de2e2[_0x21c8('0x15')]:_0x3de2e2[_0x21c8('0x16')];logger[_0x21c8('0x17')](_0x21c8('0x18'),_0x3a70b0,_0x3de2e2[_0x21c8('0x14')],_0x3d46e5,_0x2d192e||_0x21c8('0x19'));if(_0x2d192e){var _0xf8b113=_[_0x21c8('0x1a')](_0x4364f5[_0x21c8('0x1b')](),{'p':_0x2d192e});if(_0xf8b113>=0x0){logger[_0x21c8('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3a70b0,_0x2d192e||_0x21c8('0x19'),_0xf8b113);_0x4364f5[_0x21c8('0x19')](_0xf8b113);}else{logger[_0x21c8('0x17')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3a70b0,_0x2d192e||_0x21c8('0x19'));_0x4364f5[_0x21c8('0x1c')]();}}else{_0x4364f5[_0x21c8('0x19')]();}}catch(_0x624770){logger[_0x21c8('0xf')](_0x21c8('0x1d'),_0x3a70b0,_0x624770[_0x21c8('0x12')]);_0x4364f5['stop']();}}}catch(_0x152669){logger['error'](_0x21c8('0x10'),_0x3a70b0,JSON['stringify'](_0x152669));_0x4364f5['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 71d1199..772f15a 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 _0xbd8e=['priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','error','[%s][GOTOP]\x20%s','map','message','join','priority','findIndex','rules','info','next','stringify','routing','number'];(function(_0x5b69f3,_0x58b066){var _0x42c0e3=function(_0x5edb10){while(--_0x5edb10){_0x5b69f3['push'](_0x5b69f3['shift']());}};_0x42c0e3(++_0x58b066);}(_0xbd8e,0x10e));var _0xebd8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xbd8e[_0x17d9e3];return _0x14192d;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require('../../../../config/logger')(_0xebd8('0x0'));var gotop=schema({'priority':{'type':_0xebd8('0x1'),'required':!![],'message':_0xebd8('0x2')}});exports[_0xebd8('0x3')]=function(_0x5df124,_0x2f705b){return function(_0x1cbd77){try{var _0x151e4a={'priority':_0x2f705b[0x0]};var _0xf9b355=gotop[_0xebd8('0x4')](_0x151e4a,{'typecast':!![]});if(_0xf9b355['length']){logger[_0xebd8('0x5')](_0xebd8('0x6'),_0x5df124,_[_0xebd8('0x7')](_0xf9b355,_0xebd8('0x8'))[_0xebd8('0x9')](',\x20'));_0x1cbd77['stop']();}else{logger['info']('[%s][GOTOP]\x20priority\x20%s',_0x5df124,_0x151e4a['priority']);if(_0x151e4a[_0xebd8('0xa')]){var _0x23e32f=_[_0xebd8('0xb')](_0x1cbd77[_0xebd8('0xc')](),{'p':_0x151e4a['priority']});if(_0x23e32f>=0x0){logger[_0xebd8('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5df124,_0x151e4a[_0xebd8('0xa')]||'next',_0x23e32f);_0x1cbd77['next'](_0x23e32f);}else{logger[_0xebd8('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x5df124,_0x151e4a[_0xebd8('0xa')]||'next');_0x1cbd77['stop']();}}else{_0x1cbd77[_0xebd8('0xe')]();}}}catch(_0x3b6f9b){logger[_0xebd8('0x5')](_0xebd8('0x6'),_0x5df124,JSON[_0xebd8('0xf')](_0x3b6f9b));_0x1cbd77['stop']();}};}; \ No newline at end of file +var _0xaf55=['map','join','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop','[%s][GOTOP]\x20%s','stringify','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error'];(function(_0x4de208,_0x285c13){var _0x376354=function(_0x5b79fe){while(--_0x5b79fe){_0x4de208['push'](_0x4de208['shift']());}};_0x376354(++_0x285c13);}(_0xaf55,0x128));var _0x5af5=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xaf55[_0x36c5b0];return _0xf19333;};'use strict';var schema=require('validate');var _=require(_0x5af5('0x0'));var logger=require('../../../../config/logger')(_0x5af5('0x1'));var gotop=schema({'priority':{'type':_0x5af5('0x2'),'required':!![],'message':_0x5af5('0x3')}});exports[_0x5af5('0x4')]=function(_0x379918,_0xd9b322){return function(_0x1b56f8){try{var _0x40d18e={'priority':_0xd9b322[0x0]};var _0x38c106=gotop[_0x5af5('0x5')](_0x40d18e,{'typecast':!![]});if(_0x38c106[_0x5af5('0x6')]){logger[_0x5af5('0x7')]('[%s][GOTOP]\x20%s',_0x379918,_[_0x5af5('0x8')](_0x38c106,'message')[_0x5af5('0x9')](',\x20'));_0x1b56f8['stop']();}else{logger[_0x5af5('0xa')](_0x5af5('0xb'),_0x379918,_0x40d18e[_0x5af5('0xc')]);if(_0x40d18e[_0x5af5('0xc')]){var _0x21637c=_[_0x5af5('0xd')](_0x1b56f8['rules'](),{'p':_0x40d18e[_0x5af5('0xc')]});if(_0x21637c>=0x0){logger[_0x5af5('0xa')](_0x5af5('0xe'),_0x379918,_0x40d18e[_0x5af5('0xc')]||_0x5af5('0xf'),_0x21637c);_0x1b56f8['next'](_0x21637c);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x379918,_0x40d18e[_0x5af5('0xc')]||_0x5af5('0xf'));_0x1b56f8[_0x5af5('0x10')]();}}else{_0x1b56f8[_0x5af5('0xf')]();}}}catch(_0x57cf48){logger[_0x5af5('0x7')](_0x5af5('0x11'),_0x379918,JSON[_0x5af5('0x12')](_0x57cf48));_0x1b56f8[_0x5af5('0x10')]();}};}; \ 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 4346f2b..c37be61 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 _0x2564=['AccountId','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','ChatWebsiteId','account'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2564,0x1cf));var _0x4256=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2564[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var utils=require(_0x4256('0x0'));var logger=require(_0x4256('0x1'))('routing');var rpc={'chatMessage':require(_0x4256('0x2')),'openchannelMessage':require(_0x4256('0x3')),'mailMessage':require(_0x4256('0x4')),'smsMessage':require(_0x4256('0x5')),'faxMessage':require(_0x4256('0x6'))};exports[_0x4256('0x7')]=function(_0xdc70de,_0x1b2055){return function(_0x35e61e){try{var _0x3be77a={'body':utils['getMustacheRender'](_0x1b2055[0x0],this),'ContactId':this[_0x4256('0x8')]['id']};if(this[_0x4256('0x9')]==='chat'){_0x3be77a[_0x4256('0xa')]=this[_0x4256('0xb')]['id'];}else{_0x3be77a[_['upperFirst'](this[_0x4256('0x9')])+_0x4256('0xc')]=this[_0x4256('0xb')]['id'];}_0x3be77a[_[_0x4256('0xd')](this[_0x4256('0x9')])+_0x4256('0xe')]=this[_0x4256('0xf')]['id'];if(rpc[this[_0x4256('0x9')]+_0x4256('0x10')]){return rpc[this[_0x4256('0x9')]+_0x4256('0x10')][_0x4256('0x11')](_0x3be77a)[_0x4256('0x12')](function(_0x1dad2c){logger['info'](_0x4256('0x13'),_0xdc70de,_0x3be77a[_0x4256('0x14')]);_0x35e61e[_0x4256('0x15')]();})['catch'](function(_0x46dd10){logger[_0x4256('0x16')](_0x4256('0x13'),_0xdc70de,JSON[_0x4256('0x17')](_0x46dd10));_0x35e61e[_0x4256('0x18')]();});}}catch(_0x109ae1){logger[_0x4256('0x16')]('[%s][MESSAGE]\x20%s',_0xdc70de,JSON[_0x4256('0x17')](_0x109ae1));_0x35e61e['stop']();}};}; \ No newline at end of file +var _0xaeca=['chat','account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','next','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','contact'];(function(_0x5a17d6,_0x514820){var _0x409d71=function(_0x583acd){while(--_0x583acd){_0x5a17d6['push'](_0x5a17d6['shift']());}};_0x409d71(++_0x514820);}(_0xaeca,0x1eb));var _0xaaec=function(_0x19a17b,_0x5ae2cf){_0x19a17b=_0x19a17b-0x0;var _0x3ab04e=_0xaeca[_0x19a17b];return _0x3ab04e;};'use strict';var _=require(_0xaaec('0x0'));var utils=require(_0xaaec('0x1'));var logger=require(_0xaaec('0x2'))('routing');var rpc={'chatMessage':require(_0xaaec('0x3')),'openchannelMessage':require(_0xaaec('0x4')),'mailMessage':require(_0xaaec('0x5')),'smsMessage':require(_0xaaec('0x6')),'faxMessage':require(_0xaaec('0x7'))};exports['consequence']=function(_0x405603,_0x57602c){return function(_0x580cd2){try{var _0x5586ce={'body':utils['getMustacheRender'](_0x57602c[0x0],this),'ContactId':this[_0xaaec('0x8')]['id']};if(this['channel']===_0xaaec('0x9')){_0x5586ce['ChatWebsiteId']=this[_0xaaec('0xa')]['id'];}else{_0x5586ce[_[_0xaaec('0xb')](this[_0xaaec('0xc')])+_0xaaec('0xd')]=this['account']['id'];}_0x5586ce[_[_0xaaec('0xb')](this['channel'])+_0xaaec('0xe')]=this[_0xaaec('0xf')]['id'];if(rpc[this['channel']+_0xaaec('0x10')]){return rpc[this[_0xaaec('0xc')]+_0xaaec('0x10')][_0xaaec('0x11')](_0x5586ce)[_0xaaec('0x12')](function(_0x4a0f0c){logger[_0xaaec('0x13')]('[%s][MESSAGE]\x20%s',_0x405603,_0x5586ce['body']);_0x580cd2[_0xaaec('0x14')]();})['catch'](function(_0x25ca6a){logger[_0xaaec('0x15')](_0xaaec('0x16'),_0x405603,JSON['stringify'](_0x25ca6a));_0x580cd2['stop']();});}}catch(_0x4d97e1){logger['error'](_0xaaec('0x16'),_0x405603,JSON[_0xaaec('0x17')](_0x4d97e1));_0x580cd2[_0xaaec('0x18')]();}};}; \ 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 ac6cd2a..af8565b 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 _0xf176=['stringify','./utils','../../../../config/logger','consequence','info','next','[%s][NOOP]\x20%s'];(function(_0x242ea3,_0x13920b){var _0xfc39d7=function(_0x5bdecd){while(--_0x5bdecd){_0x242ea3['push'](_0x242ea3['shift']());}};_0xfc39d7(++_0x13920b);}(_0xf176,0x104));var _0x6f17=function(_0x4055f8,_0x44c50e){_0x4055f8=_0x4055f8-0x0;var _0x1677e0=_0xf176[_0x4055f8];return _0x1677e0;};'use strict';var utils=require(_0x6f17('0x0'));var logger=require(_0x6f17('0x1'))('routing');exports[_0x6f17('0x2')]=function(_0x43c379,_0x1ebf88){return function(_0x21398d){try{logger[_0x6f17('0x3')]('[%s][NOOP]\x20%s',_0x43c379,utils['getMustacheRender'](_0x1ebf88[0x0],this));_0x21398d[_0x6f17('0x4')]();}catch(_0x2c42db){logger['error'](_0x6f17('0x5'),_0x43c379,JSON[_0x6f17('0x6')](_0x2c42db));_0x21398d['stop']();}};}; \ No newline at end of file +var _0x2528=['next','error','stringify','stop','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x214fdf,_0x138a83){var _0x14da4b=function(_0x210f69){while(--_0x210f69){_0x214fdf['push'](_0x214fdf['shift']());}};_0x14da4b(++_0x138a83);}(_0x2528,0x130));var _0x8252=function(_0x2917fc,_0x24d51e){_0x2917fc=_0x2917fc-0x0;var _0x40839b=_0x2528[_0x2917fc];return _0x40839b;};'use strict';var utils=require(_0x8252('0x0'));var logger=require('../../../../config/logger')(_0x8252('0x1'));exports[_0x8252('0x2')]=function(_0x5572a,_0xf4c94c){return function(_0x3c54b3){try{logger[_0x8252('0x3')](_0x8252('0x4'),_0x5572a,utils[_0x8252('0x5')](_0xf4c94c[0x0],this));_0x3c54b3[_0x8252('0x6')]();}catch(_0x460569){logger[_0x8252('0x7')](_0x8252('0x4'),_0x5572a,JSON[_0x8252('0x8')](_0x460569));_0x3c54b3[_0x8252('0x9')]();}};}; \ 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 3821f7e..58613e2 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 _0xea38=['%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','InteractionId','interaction','message','chat','AccountId','info','name','QueueReport','create','create\x20queue\x20report','accepted','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','error','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','close','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stringify','validate','util','moment','routing','./strategy','socket.io-emitter','localhost','queue_id','account','queue','joinAt','emit','format'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xea38,0x151));var _0x8ea3=function(_0x1e79e3,_0x48cfc0){_0x1e79e3=_0x1e79e3-0x0;var _0x15dfdd=_0xea38[_0x1e79e3];return _0x15dfdd;};'use strict';var schema=require(_0x8ea3('0x0'));var _=require('lodash');var util=require(_0x8ea3('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x8ea3('0x2'));var logger=require('../../../../config/logger')(_0x8ea3('0x3'));var strategy=require(_0x8ea3('0x4'));var io=require(_0x8ea3('0x5'))({'host':_0x8ea3('0x6'),'port':0x18eb});var attributes=['id',_0x8ea3('0x7'),_0x8ea3('0x8'),_0x8ea3('0x9'),'from',_0x8ea3('0xa')];function emit(_0x3ded70,_0x40857c,_0x5c0678){io['to'](_0x3ded70)[_0x8ea3('0xb')](_0x40857c,_0x5c0678);}function emitChannelQueueInteraction(_0x402077,_0x10faaf,_0x182b28,_0x55b031,_0x2ab8ca,_0x2beb9e,_0x573441,_0x3dff80){_0x182b28['queue_id']=_0x3dff80;_0x182b28['queue']=_0x10faaf;_0x182b28[_0x8ea3('0x8')]=_0x55b031;_0x182b28['id']=_0x2ab8ca;if(_0x2beb9e){_0x573441[util[_0x8ea3('0xc')](_0x8ea3('0xd'),_0x402077)][_0x2ab8ca]=_[_0x8ea3('0xe')](_0x182b28,attributes);}else{delete _0x573441[util['format'](_0x8ea3('0xd'),_0x402077)][_0x2ab8ca];}emit(util[_0x8ea3('0xc')](_0x8ea3('0xf'),_0x402077,_0x10faaf),util[_0x8ea3('0xc')](_0x8ea3('0x10'),_0x402077,_0x2beb9e?_0x8ea3('0x11'):_0x8ea3('0x12')),_['pick'](_0x182b28,attributes));}var rpc={'openchannelQueueReport':require(_0x8ea3('0x13')),'mailQueueReport':require(_0x8ea3('0x14')),'chatQueueReport':require(_0x8ea3('0x15')),'smsQueueReport':require(_0x8ea3('0x16')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':_0x8ea3('0x17'),'required':!![],'message':_0x8ea3('0x18')},'timeout':{'type':_0x8ea3('0x19'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x58d388,_0x398183,_0x21fb6d,_0x484979){if(_0x58d388&&_0x398183&&_0x21fb6d){_0x398183[_0x8ea3('0x1a')]+=0x1;var _0x4c3cd6={'uniqueid':_0x58d388,'from':_0x21fb6d[_0x8ea3('0x1b')]?_0x21fb6d['body'][_0x8ea3('0x1c')]:'','joinAt':moment()['format'](_0x8ea3('0x1d')),'ContactId':_0x21fb6d[_0x8ea3('0x1e')]?_0x21fb6d['contact']['id']:null,'ListId':_0x21fb6d[_0x8ea3('0x1f')]?_0x21fb6d[_0x8ea3('0x1f')]['id']:null};_0x4c3cd6[_[_0x8ea3('0x20')](_0x21fb6d[_0x8ea3('0x21')])+'QueueId']=_0x398183['id']||null;_0x4c3cd6[_[_0x8ea3('0x20')](_0x21fb6d[_0x8ea3('0x21')])+_0x8ea3('0x22')]=_0x21fb6d[_0x8ea3('0x23')]?_0x21fb6d[_0x8ea3('0x23')]['id']:null;_0x4c3cd6[_[_0x8ea3('0x20')](_0x21fb6d[_0x8ea3('0x21')])+'MessageId']=_0x21fb6d[_0x8ea3('0x24')]?_0x21fb6d[_0x8ea3('0x24')]['id']:null;_0x4c3cd6[_['upperFirst'](_0x21fb6d['channel'])+(_0x21fb6d[_0x8ea3('0x21')]!==_0x8ea3('0x25')?_0x8ea3('0x26'):'WebsiteId')]=_0x21fb6d[_0x8ea3('0x8')]?_0x21fb6d[_0x8ea3('0x8')]['id']:null;logger[_0x8ea3('0x27')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x58d388,_0x398183[_0x8ea3('0x28')]));emitChannelQueueInteraction(_0x21fb6d[_0x8ea3('0x21')],_0x398183[_0x8ea3('0x28')],_0x4c3cd6,_0x21fb6d[_0x8ea3('0x8')][_0x8ea3('0x28')],_0x21fb6d[_0x8ea3('0x24')]['id'],!![],_0x484979,_0x398183['id']);if(rpc[_0x21fb6d['channel']+_0x8ea3('0x29')]){return rpc[_0x21fb6d[_0x8ea3('0x21')]+_0x8ea3('0x29')][_0x8ea3('0x2a')](_0x4c3cd6)['catch'](function(_0x12aa64){logger['error'](_0x8ea3('0x2b'));});}}}function stopRouting(_0x5c42b3,_0x243638,_0x10593f,_0x369ba2){if(_0x5c42b3&&_0x243638){_0x243638['waiting']-=0x1;var _0x569196={'leaveAt':moment()[_0x8ea3('0xc')](_0x8ea3('0x1d')),'acceptAt':moment()[_0x8ea3('0xc')](_0x8ea3('0x1d')),'reason':_0x8ea3('0x2c')};logger['info'](util[_0x8ea3('0xc')]('[%s][STOP:QUEUE][NAME:%s]',_0x5c42b3,_0x243638[_0x8ea3('0x28')]));emitChannelQueueInteraction(_0x10593f[_0x8ea3('0x21')],_0x243638[_0x8ea3('0x28')],_0x10593f[_0x8ea3('0x1b')],_0x10593f[_0x8ea3('0x8')]['name'],_0x10593f[_0x8ea3('0x24')]['id'],![],_0x369ba2,_0x243638['id']);if(rpc[_0x10593f[_0x8ea3('0x21')]+_0x8ea3('0x29')]){return rpc[_0x10593f[_0x8ea3('0x21')]+_0x8ea3('0x29')][_0x8ea3('0x2d')](_0x5c42b3,_0x569196)[_0x8ea3('0x2e')](function(_0x3ba041){logger['error'](_0x8ea3('0x2f'));});}}}function endRouting(_0x4aae4b,_0x133a87,_0x294fca,_0x56d0c3){if(_0x4aae4b&&_0x133a87){_0x133a87['waiting']-=0x1;var _0xe936ac={'leaveAt':moment()['format'](_0x8ea3('0x1d')),'exitAt':moment()[_0x8ea3('0xc')](_0x8ea3('0x1d')),'reason':_0x8ea3('0x30')};logger[_0x8ea3('0x27')](util[_0x8ea3('0xc')](_0x8ea3('0x31'),_0x4aae4b,_0x133a87[_0x8ea3('0x28')]));emitChannelQueueInteraction(_0x294fca['channel'],_0x133a87[_0x8ea3('0x28')],_0x294fca[_0x8ea3('0x1b')],_0x294fca['account'][_0x8ea3('0x28')],_0x294fca[_0x8ea3('0x24')]['id'],![],_0x56d0c3);if(rpc[_0x294fca[_0x8ea3('0x21')]+_0x8ea3('0x29')]){return rpc[_0x294fca['channel']+_0x8ea3('0x29')][_0x8ea3('0x2d')](_0x4aae4b,_0xe936ac)[_0x8ea3('0x2e')](function(_0x2cbe89){logger['error'](_0x8ea3('0x2f'));});}}}function handleFindQueue(_0x541abe){return function(_0x5c9e5b){return _0x5c9e5b[_0x8ea3('0x28')]['toLowerCase']()===_0x541abe[_0x8ea3('0x32')]();};}exports[_0x8ea3('0x33')]=function(_0xc9c888,_0x2be4f0,_0x3fd8b4,_0x3e5bea){return function(_0x354ecb){try{var _0x3b318b={'name':_0x2be4f0[0x0],'timeout':_0x2be4f0[0x1]};var _0x2eb379=queue[_0x8ea3('0x0')](_0x3b318b,{'typecast':!![]});if(_0x2eb379['length']){logger[_0x8ea3('0x34')](_0x8ea3('0x35'),_0xc9c888,_[_0x8ea3('0x36')](_0x2eb379,_0x8ea3('0x24'))[_0x8ea3('0x37')](',\x20'));_0x354ecb[_0x8ea3('0x38')]();}else{var _0x281664=_[_0x8ea3('0x39')](_0x3fd8b4[_0x3e5bea[_0x8ea3('0x21')]+_0x8ea3('0x3a')],handleFindQueue(_0x3b318b[_0x8ea3('0x28')]));if(_0x281664){startRouting(_0xc9c888,_0x281664,_0x3e5bea,_0x3fd8b4);var _0x5a8895=(_0x281664[_0x8ea3('0x30')]||0xa)*0x3e8;var _0x57e7ba=(_0x3b318b[_0x8ea3('0x30')]||0x14)*0x3e8;var _0x3280af,_0x172afb;if(_0x5a8895>_0x57e7ba){_0x57e7ba=_0x5a8895;}var _0x3d0eb4=seqqueue[_0x8ea3('0x3b')](_0x5a8895);_0x3d0eb4['id']=_0xc9c888;_0x3d0eb4[_0x8ea3('0x3c')]=_0x5a8895;_0x3d0eb4[_0x8ea3('0x3d')]=_0x57e7ba;_0x3d0eb4[_0x8ea3('0x21')]=_0x3e5bea[_0x8ea3('0x21')];_0x172afb=setInterval(function(){if(_0x3fd8b4[_0x8ea3('0x3e')]&&!_0x3fd8b4[_0x8ea3('0x3e')][_0xc9c888]){stopRouting(_0xc9c888,_0x281664,_0x3e5bea,_0x3fd8b4);clearTimeout(_0x3280af);clearInterval(_0x172afb);_0x3280af=undefined;_0x3d0eb4['close'](!![]);_0x354ecb[_0x8ea3('0x38')]();}},0x3e8);_0x3280af=setTimeout(function(){endRouting(_0xc9c888,_0x281664,_0x3e5bea,_0x3fd8b4);clearInterval(_0x172afb);_0x172afb=undefined;_0x3d0eb4[_0x8ea3('0x3f')](!![]);_0x354ecb[_0x8ea3('0x40')]();},_0x57e7ba);switch(_0x281664[_0x8ea3('0x41')]){case _0x8ea3('0x42'):strategy['rrmemory'](_0x3d0eb4,_0x281664,_0x3fd8b4,_0x3e5bea);break;default:strategy[_0x8ea3('0x43')](_0x3d0eb4,_0x281664,_0x3fd8b4,_0x3e5bea);}}else{logger[_0x8ea3('0x34')](_0x8ea3('0x44'),_0xc9c888,_0x3b318b[_0x8ea3('0x28')]);_0x354ecb['stop']();}}}catch(_0x340374){console['log'](_0x340374);logger[_0x8ea3('0x34')](_0x8ea3('0x35'),_0xc9c888,JSON[_0x8ea3('0x45')](_0x340374));_0x354ecb[_0x8ea3('0x38')]();}};}; \ No newline at end of file +var _0x4a24=['map','join','stop','createQueue','atimeout','rules','close','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','moment','../../../../config/logger','routing','./strategy','socket.io-emitter','localhost','queue_id','account','queue','emit','pick','format','%sQueuesWaitingInteractions','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','from','YYYY-MM-DD\x20HH:mm:ss','list','upperFirst','QueueId','channel','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','error','waiting','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s'];(function(_0x127250,_0x59b5da){var _0x6a1541=function(_0x1ba9ee){while(--_0x1ba9ee){_0x127250['push'](_0x127250['shift']());}};_0x6a1541(++_0x59b5da);}(_0x4a24,0x103));var _0x44a2=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x4a24[_0x507ac5];return _0x12c1bc;};'use strict';var schema=require(_0x44a2('0x0'));var _=require(_0x44a2('0x1'));var util=require(_0x44a2('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x44a2('0x3'));var logger=require(_0x44a2('0x4'))(_0x44a2('0x5'));var strategy=require(_0x44a2('0x6'));var io=require(_0x44a2('0x7'))({'host':_0x44a2('0x8'),'port':0x18eb});var attributes=['id',_0x44a2('0x9'),_0x44a2('0xa'),_0x44a2('0xb'),'from','joinAt'];function emit(_0x23e0f7,_0x1ce3d6,_0x14ea99){io['to'](_0x23e0f7)[_0x44a2('0xc')](_0x1ce3d6,_0x14ea99);}function emitChannelQueueInteraction(_0x2c16a0,_0x18618c,_0x19e4d5,_0x3d098e,_0x4317c6,_0x22d82a,_0xa5e393,_0x2a9760){_0x19e4d5[_0x44a2('0x9')]=_0x2a9760;_0x19e4d5['queue']=_0x18618c;_0x19e4d5[_0x44a2('0xa')]=_0x3d098e;_0x19e4d5['id']=_0x4317c6;if(_0x22d82a){_0xa5e393[util['format']('%sQueuesWaitingInteractions',_0x2c16a0)][_0x4317c6]=_[_0x44a2('0xd')](_0x19e4d5,attributes);}else{delete _0xa5e393[util[_0x44a2('0xe')](_0x44a2('0xf'),_0x2c16a0)][_0x4317c6];}emit(util['format']('%s:queue:%s',_0x2c16a0,_0x18618c),util[_0x44a2('0xe')]('%s_queue_waiting_interaction:%s',_0x2c16a0,_0x22d82a?'save':_0x44a2('0x10')),_[_0x44a2('0xd')](_0x19e4d5,attributes));}var rpc={'openchannelQueueReport':require(_0x44a2('0x11')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x44a2('0x12')),'smsQueueReport':require(_0x44a2('0x13')),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x44a2('0x14')},'timeout':{'type':_0x44a2('0x15'),'message':_0x44a2('0x16')}});function startRouting(_0x55ba54,_0x591127,_0x2adfa0,_0x3a5b79){if(_0x55ba54&&_0x591127&&_0x2adfa0){_0x591127['waiting']+=0x1;var _0xb0b74c={'uniqueid':_0x55ba54,'from':_0x2adfa0[_0x44a2('0x17')]?_0x2adfa0[_0x44a2('0x17')][_0x44a2('0x18')]:'','joinAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'ContactId':_0x2adfa0['contact']?_0x2adfa0['contact']['id']:null,'ListId':_0x2adfa0[_0x44a2('0x1a')]?_0x2adfa0[_0x44a2('0x1a')]['id']:null};_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0['channel'])+_0x44a2('0x1c')]=_0x591127['id']||null;_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0[_0x44a2('0x1d')])+_0x44a2('0x1e')]=_0x2adfa0[_0x44a2('0x1f')]?_0x2adfa0[_0x44a2('0x1f')]['id']:null;_0xb0b74c[_[_0x44a2('0x1b')](_0x2adfa0['channel'])+_0x44a2('0x20')]=_0x2adfa0[_0x44a2('0x21')]?_0x2adfa0[_0x44a2('0x21')]['id']:null;_0xb0b74c[_['upperFirst'](_0x2adfa0['channel'])+(_0x2adfa0[_0x44a2('0x1d')]!==_0x44a2('0x22')?_0x44a2('0x23'):_0x44a2('0x24'))]=_0x2adfa0[_0x44a2('0xa')]?_0x2adfa0[_0x44a2('0xa')]['id']:null;logger[_0x44a2('0x25')](util[_0x44a2('0xe')](_0x44a2('0x26'),_0x55ba54,_0x591127[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x2adfa0[_0x44a2('0x1d')],_0x591127[_0x44a2('0x27')],_0xb0b74c,_0x2adfa0[_0x44a2('0xa')][_0x44a2('0x27')],_0x2adfa0[_0x44a2('0x21')]['id'],!![],_0x3a5b79,_0x591127['id']);if(rpc[_0x2adfa0[_0x44a2('0x1d')]+_0x44a2('0x28')]){return rpc[_0x2adfa0[_0x44a2('0x1d')]+_0x44a2('0x28')]['create'](_0xb0b74c)[_0x44a2('0x29')](function(_0x3d9b71){logger[_0x44a2('0x2a')]('create\x20queue\x20report');});}}}function stopRouting(_0x40a65d,_0x5db0d8,_0x3a8260,_0xb4369){if(_0x40a65d&&_0x5db0d8){_0x5db0d8[_0x44a2('0x2b')]-=0x1;var _0x2d83ca={'leaveAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'acceptAt':moment()[_0x44a2('0xe')](_0x44a2('0x19')),'reason':'accepted'};logger[_0x44a2('0x25')](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x40a65d,_0x5db0d8[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x3a8260[_0x44a2('0x1d')],_0x5db0d8[_0x44a2('0x27')],_0x3a8260[_0x44a2('0x17')],_0x3a8260['account']['name'],_0x3a8260[_0x44a2('0x21')]['id'],![],_0xb4369,_0x5db0d8['id']);if(rpc[_0x3a8260[_0x44a2('0x1d')]+'QueueReport']){return rpc[_0x3a8260['channel']+'QueueReport'][_0x44a2('0x2c')](_0x40a65d,_0x2d83ca)[_0x44a2('0x29')](function(_0x25eeb2){logger[_0x44a2('0x2a')](_0x44a2('0x2d'));});}}}function endRouting(_0xb37dd6,_0x397643,_0x3839be,_0x1593ee){if(_0xb37dd6&&_0x397643){_0x397643[_0x44a2('0x2b')]-=0x1;var _0x216ceb={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format'](_0x44a2('0x19')),'reason':_0x44a2('0x2e')};logger[_0x44a2('0x25')](util[_0x44a2('0xe')](_0x44a2('0x2f'),_0xb37dd6,_0x397643[_0x44a2('0x27')]));emitChannelQueueInteraction(_0x3839be[_0x44a2('0x1d')],_0x397643[_0x44a2('0x27')],_0x3839be[_0x44a2('0x17')],_0x3839be[_0x44a2('0xa')][_0x44a2('0x27')],_0x3839be[_0x44a2('0x21')]['id'],![],_0x1593ee);if(rpc[_0x3839be[_0x44a2('0x1d')]+'QueueReport']){return rpc[_0x3839be[_0x44a2('0x1d')]+_0x44a2('0x28')][_0x44a2('0x2c')](_0xb37dd6,_0x216ceb)[_0x44a2('0x29')](function(_0x105db5){logger['error'](_0x44a2('0x2d'));});}}}function handleFindQueue(_0x8a02ab){return function(_0xb73204){return _0xb73204[_0x44a2('0x27')]['toLowerCase']()===_0x8a02ab[_0x44a2('0x30')]();};}exports['consequence']=function(_0x32decc,_0x49cc38,_0x2a2ee6,_0x2c3595){return function(_0x5cc9ac){try{var _0x5d45aa={'name':_0x49cc38[0x0],'timeout':_0x49cc38[0x1]};var _0x187a5c=queue[_0x44a2('0x0')](_0x5d45aa,{'typecast':!![]});if(_0x187a5c[_0x44a2('0x31')]){logger[_0x44a2('0x2a')](_0x44a2('0x32'),_0x32decc,_[_0x44a2('0x33')](_0x187a5c,_0x44a2('0x21'))[_0x44a2('0x34')](',\x20'));_0x5cc9ac[_0x44a2('0x35')]();}else{var _0x24e908=_['find'](_0x2a2ee6[_0x2c3595[_0x44a2('0x1d')]+'Queues'],handleFindQueue(_0x5d45aa[_0x44a2('0x27')]));if(_0x24e908){startRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);var _0x3fbcda=(_0x24e908['timeout']||0xa)*0x3e8;var _0x1bffcd=(_0x5d45aa['timeout']||0x14)*0x3e8;var _0x32d5cb,_0x3b15b;if(_0x3fbcda>_0x1bffcd){_0x1bffcd=_0x3fbcda;}var _0x333be5=seqqueue[_0x44a2('0x36')](_0x3fbcda);_0x333be5['id']=_0x32decc;_0x333be5[_0x44a2('0x37')]=_0x3fbcda;_0x333be5['qtimeout']=_0x1bffcd;_0x333be5['channel']=_0x2c3595[_0x44a2('0x1d')];_0x3b15b=setInterval(function(){if(_0x2a2ee6[_0x44a2('0x38')]&&!_0x2a2ee6[_0x44a2('0x38')][_0x32decc]){stopRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);clearTimeout(_0x32d5cb);clearInterval(_0x3b15b);_0x32d5cb=undefined;_0x333be5[_0x44a2('0x39')](!![]);_0x5cc9ac[_0x44a2('0x35')]();}},0x3e8);_0x32d5cb=setTimeout(function(){endRouting(_0x32decc,_0x24e908,_0x2c3595,_0x2a2ee6);clearInterval(_0x3b15b);_0x3b15b=undefined;_0x333be5[_0x44a2('0x39')](!![]);_0x5cc9ac['next']();},_0x1bffcd);switch(_0x24e908[_0x44a2('0x3a')]){case _0x44a2('0x3b'):strategy[_0x44a2('0x3b')](_0x333be5,_0x24e908,_0x2a2ee6,_0x2c3595);break;default:strategy['beepall'](_0x333be5,_0x24e908,_0x2a2ee6,_0x2c3595);}}else{logger[_0x44a2('0x2a')](_0x44a2('0x3c'),_0x32decc,_0x5d45aa[_0x44a2('0x27')]);_0x5cc9ac[_0x44a2('0x35')]();}}}catch(_0x2685e1){console[_0x44a2('0x3d')](_0x2685e1);logger[_0x44a2('0x2a')](_0x44a2('0x32'),_0x32decc,JSON['stringify'](_0x2685e1));_0x5cc9ac[_0x44a2('0x35')]();}};}; \ 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 24e412e..33e9c3b 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 _0x7183=['busyQueue','hideNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','handleRun','done','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','realtime','RINGING',':FORCED','busy','TIMEOUT'];(function(_0x113c12,_0x4a1d04){var _0x12c3fe=function(_0x17f8c8){while(--_0x17f8c8){_0x113c12['push'](_0x113c12['shift']());}};_0x12c3fe(++_0x4a1d04);}(_0x7183,0x137));var _0x3718=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7183[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x3718('0x0'));var uuid=require(_0x3718('0x1'));var util=require(_0x3718('0x2'));var logger=require(_0x3718('0x3'))(_0x3718('0x4'));var Agent=function(_0x2bf848,_0x2cf21f,_0xe6351d,_0x19ee0a){this[_0x3718('0x5')]=uuid['v4']();this[_0x3718('0x6')]=_0x2bf848;this[_0x3718('0x7')]=_0x2cf21f;this['realtime']=_0xe6351d;this['routing']=_0x19ee0a;this[_0x3718('0x6')][_0x3718('0x8')](this['handleRun'][_0x3718('0x9')](this),this[_0x3718('0xa')]['bind'](this));this[_0x3718('0x6')]['on']('drained',this[_0x3718('0xa')][_0x3718('0x9')](this));};Agent['prototype'][_0x3718('0x8')]=function(){this['squeue'][_0x3718('0x8')](this[_0x3718('0xb')][_0x3718('0x9')](this),this[_0x3718('0xa')][_0x3718('0x9')](this));};Agent['prototype'][_0x3718('0xc')]=function(_0x322507){if(_0x322507){setTimeout(this[_0x3718('0x8')]['bind'](this),0x3e8);_0x322507['done']();}};Agent[_0x3718('0xd')]['handleRun']=function(_0x322770){logger[_0x3718('0xe')](_0x3718('0xf'),this[_0x3718('0x6')]['id'],this[_0x3718('0x7')]['id']);if(_[_0x3718('0x10')](this['realtime'][_0x3718('0x11')][this['agent']['id']])){logger[_0x3718('0xe')](_0x3718('0x12'),this[_0x3718('0x6')]['id'],this['agent']['id']);this[_0x3718('0xc')](_0x322770);}else{if(this['routing'][_0x3718('0x13')]||util['isAgentAvailable'](this[_0x3718('0x6')]['id'],this[_0x3718('0x14')][_0x3718('0x11')][this[_0x3718('0x7')]['id']],this[_0x3718('0x6')]['channel'],![])){util['writeLog'](this[_0x3718('0x6')]['id'],this[_0x3718('0x14')][_0x3718('0x11')][this[_0x3718('0x7')]['id']],_0x3718('0x15')+(this[_0x3718('0x4')][_0x3718('0x13')]?_0x3718('0x16'):''));this['realtime'][_0x3718('0x11')][this[_0x3718('0x7')]['id']][_0x3718('0x17')]=!![];this['realtime'][_0x3718('0x11')][this['agent']['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this[_0x3718('0x6')]['id'],this[_0x3718('0x14')][_0x3718('0x11')][this['agent']['id']],null,this[_0x3718('0x4')]);}else{this['done'](_0x322770);}}};Agent[_0x3718('0xd')][_0x3718('0xa')]=function(){logger[_0x3718('0xe')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x3718('0x6')]['id'],this['agent']['id']);if(_[_0x3718('0x10')](this[_0x3718('0x14')][_0x3718('0x11')][this[_0x3718('0x7')]['id']])){return logger[_0x3718('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x3718('0x7')]['id']);}else{util['writeLog'](this[_0x3718('0x6')]['id'],this['realtime'][_0x3718('0x11')][this[_0x3718('0x7')]['id']],_0x3718('0x18'));this[_0x3718('0x14')][_0x3718('0x11')][this['agent']['id']][_0x3718('0x17')]=![];this[_0x3718('0x14')][_0x3718('0x11')][this['agent']['id']][_0x3718('0x19')]=undefined;util[_0x3718('0x1a')](this[_0x3718('0x5')],this[_0x3718('0x6')]['id'],this[_0x3718('0x14')][_0x3718('0x11')][this[_0x3718('0x7')]['id']],null,this[_0x3718('0x4')]);}};function agent(_0x48326a,_0x5e341a,_0x69fdf4,_0x414e06){return new Agent(_0x48326a,_0x5e341a,_0x69fdf4,_0x414e06);}module[_0x3718('0x1b')]=agent; \ No newline at end of file +var _0x2ae7=['channel','writeLog',':FORCED','busy','busyQueue','showNotification','notificationId','[%s][AGENT]\x20timeout\x20with\x20%s','isNil','TIMEOUT','hideNotification','exports','lodash','./util','../../../../../config/logger','routing','agent','squeue','handleRun','bind','handleTimeout','drained','prototype','done','info','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x3f8a19,_0x19123e){var _0x39813e=function(_0x325c21){while(--_0x325c21){_0x3f8a19['push'](_0x3f8a19['shift']());}};_0x39813e(++_0x19123e);}(_0x2ae7,0x11a));var _0x72ae=function(_0x5ad3e8,_0x1666bb){_0x5ad3e8=_0x5ad3e8-0x0;var _0x285201=_0x2ae7[_0x5ad3e8];return _0x285201;};'use strict';var _=require(_0x72ae('0x0'));var uuid=require('uuid');var util=require(_0x72ae('0x1'));var logger=require(_0x72ae('0x2'))(_0x72ae('0x3'));var Agent=function(_0xd18443,_0x57760d,_0x268731,_0x10210c){this['notificationId']=uuid['v4']();this['squeue']=_0xd18443;this[_0x72ae('0x4')]=_0x57760d;this['realtime']=_0x268731;this[_0x72ae('0x3')]=_0x10210c;this[_0x72ae('0x5')]['push'](this[_0x72ae('0x6')][_0x72ae('0x7')](this),this[_0x72ae('0x8')][_0x72ae('0x7')](this));this[_0x72ae('0x5')]['on'](_0x72ae('0x9'),this['handleTimeout'][_0x72ae('0x7')](this));};Agent[_0x72ae('0xa')]['push']=function(){this[_0x72ae('0x5')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x72ae('0x7')](this));};Agent[_0x72ae('0xa')][_0x72ae('0xb')]=function(_0x582d17){if(_0x582d17){setTimeout(this['push']['bind'](this),0x3e8);_0x582d17[_0x72ae('0xb')]();}};Agent['prototype'][_0x72ae('0x6')]=function(_0x51c4fe){logger[_0x72ae('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x72ae('0x5')]['id'],this[_0x72ae('0x4')]['id']);if(_['isNil'](this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']])){logger[_0x72ae('0xc')](_0x72ae('0xf'),this['squeue']['id'],this[_0x72ae('0x4')]['id']);this['done'](_0x51c4fe);}else{if(this[_0x72ae('0x3')][_0x72ae('0x10')]||util[_0x72ae('0x11')](this[_0x72ae('0x5')]['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],this[_0x72ae('0x5')][_0x72ae('0x12')],![])){util[_0x72ae('0x13')](this[_0x72ae('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],'RINGING'+(this['routing']['forcedOwnership']?_0x72ae('0x14'):''));this['realtime'][_0x72ae('0xe')][this['agent']['id']][_0x72ae('0x15')]=!![];this[_0x72ae('0xd')]['agents'][this[_0x72ae('0x4')]['id']][_0x72ae('0x16')]=undefined;util[_0x72ae('0x17')](this[_0x72ae('0x18')],this[_0x72ae('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x72ae('0x3')]);}else{this[_0x72ae('0xb')](_0x51c4fe);}}};Agent['prototype'][_0x72ae('0x8')]=function(){logger[_0x72ae('0xc')](_0x72ae('0x19'),this['squeue']['id'],this[_0x72ae('0x4')]['id']);if(_[_0x72ae('0x1a')](this['realtime']['agents'][this[_0x72ae('0x4')]['id']])){return logger[_0x72ae('0xc')](_0x72ae('0xf'),this[_0x72ae('0x5')]['id'],this[_0x72ae('0x4')]['id']);}else{util[_0x72ae('0x13')](this[_0x72ae('0x5')]['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],_0x72ae('0x1b'));this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']][_0x72ae('0x15')]=![];this[_0x72ae('0xd')]['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x72ae('0x1c')](this[_0x72ae('0x18')],this['squeue']['id'],this[_0x72ae('0xd')][_0x72ae('0xe')][this[_0x72ae('0x4')]['id']],null,this[_0x72ae('0x3')]);}};function agent(_0x5b863a,_0x32d489,_0x4cc858,_0x51a26a){return new Agent(_0x5b863a,_0x32d489,_0x4cc858,_0x51a26a);}module[_0x72ae('0x1d')]=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 4562f77..e432aae 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 _0x0cfa=['agents','info','isAgentAvailable','channel','RINGING','busy','busyQueue','name','showNotification','routing','[%s][QUEUE]\x20EMPTY','writeLog','hideNotification','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','queue','realtime','length','module','qtimeout','atimeout','push','handleRun','bind','handleTimeout','drained','prototype','done','isNil','Agents'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x0cfa,0x18f));var _0xa0cf=function(_0x444d18,_0x58369b){_0x444d18=_0x444d18-0x0;var _0x1683fc=_0x0cfa[_0x444d18];return _0x1683fc;};'use strict';var _=require(_0xa0cf('0x0'));var uuid=require(_0xa0cf('0x1'));var util=require(_0xa0cf('0x2'));var logger=require(_0xa0cf('0x3'))('routing');var Beepall=function(_0x525629,_0x4d8758,_0x37c4e1,_0x5cd2e7){this[_0xa0cf('0x4')]=uuid['v4']();this[_0xa0cf('0x5')]=_0x525629;this[_0xa0cf('0x6')]=_0x4d8758;this[_0xa0cf('0x7')]=_0x37c4e1;this['routing']=_0x5cd2e7;this[_0xa0cf('0x8')]=Math['floor'](this[_0xa0cf('0x5')]['qtimeout']/this[_0xa0cf('0x5')]['atimeout']);this[_0xa0cf('0x9')]=this[_0xa0cf('0x5')][_0xa0cf('0xa')]%this['squeue'][_0xa0cf('0xb')];for(var _0x327033=0x0;_0x3270330x0){for(var _0x1bd05c=0x0,_0x1112f8;_0x1bd05c0x0){for(var _0x163ccb=0x0,_0x2aa14b;_0x163ccb0x0&&_0x3bb813[_0x194979+_0x28cb('0x20')]>=_0x3bb813[_0x194979+'Capacity']){writeLog(_0x28e9f7,_0x3bb813,_0x194979[_0x28cb('0x21')]()+_0x28cb('0x22'));return![];}}return!![];};exports[_0x28cb('0x23')]=function(_0x15bc1c,_0x1513c9,_0xe15fce,_0x523a05,_0x5216dc){return sendNotification(!![],_0x15bc1c,_0x1513c9,_0xe15fce,_0x523a05,_0x5216dc);};exports[_0x28cb('0x24')]=function(_0x5ceaba,_0x1964a3,_0x16447e,_0x1ecf3d,_0xab788e){return sendNotification(![],_0x5ceaba,_0x1964a3,_0x16447e,_0x1ecf3d,_0xab788e);};exports[_0x28cb('0x25')]=writeLog; \ No newline at end of file +var _0xcde8=['msg','error','format','[%s][QUEUE]\x20%s','message','user:%s','remove','info','isAgentAvailable','online','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','hideNotification','writeLog','util','../utils','mustache','../../../../../config/logger','routing','socket.io-emitter','emit','name','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue'];(function(_0x2e7ea9,_0x31f0d9){var _0x5ba523=function(_0x1a696c){while(--_0x1a696c){_0x2e7ea9['push'](_0x2e7ea9['shift']());}};_0x5ba523(++_0x31f0d9);}(_0xcde8,0x144));var _0x8cde=function(_0x27c60f,_0x189b92){_0x27c60f=_0x27c60f-0x0;var _0x56e7a5=_0xcde8[_0x27c60f];return _0x56e7a5;};'use strict';var util=require(_0x8cde('0x0'));var utils=require(_0x8cde('0x1'));var Mustache=require(_0x8cde('0x2'));var logger=require(_0x8cde('0x3'))(_0x8cde('0x4'));var io=require(_0x8cde('0x5'))({'host':'localhost','port':0x18eb});function emit(_0x8c69a4,_0x233c29,_0x35adf2){io['to'](_0x8c69a4)[_0x8cde('0x6')](_0x233c29,_0x35adf2);}function sendNotification(_0x2b588b,_0xd62036,_0x4bee66,_0xc6c90,_0x535488,_0x3e74e7){io['to'](util['format']('user:%s',_0xc6c90[_0x8cde('0x7')]))[_0x8cde('0x6')](_0x8cde('0x8'),_0xc6c90);var _0x1f81b6=_0x3e74e7||{};var _0x31b149=_0x4bee66[_0x8cde('0x9')]('.');var _0x237f36={'uniqueid':_0xd62036,'channel':_0x31b149[0x0],'id':_0x31b149[0x1],'title':_0x31b149[0x0]+_0x8cde('0xa'),'interactionId':_0x31b149[0x2],'queue':_0x535488?_0x535488[_0x8cde('0x7')]:null,'sound':_0x1f81b6['account'][_0x8cde('0xb')],'shake':_0x1f81b6[_0x8cde('0xc')][_0x8cde('0xd')]};try{if(!_0x1f81b6['body']){_0x1f81b6['body']={};}if(_0x535488){_0x1f81b6[_0x8cde('0xe')][_0x8cde('0xf')]=_0x535488;}else if(_0x1f81b6['body']['queue']){delete _0x1f81b6[_0x8cde('0xe')][_0x8cde('0xf')];}_0x237f36['msg']=utils['getMustacheRender'](_0x1f81b6['account']['notificationTemplate'],_0x1f81b6);}catch(_0x14714f){_0x237f36[_0x8cde('0x10')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x8cde('0x11')](util[_0x8cde('0x12')](_0x8cde('0x13'),_0xd62036,_0x14714f[_0x8cde('0x14')]));}io['to'](util['format'](_0x8cde('0x15'),_0xc6c90['name']))['emit'](util[_0x8cde('0x12')]('notification:%s',_0x2b588b?'save':_0x8cde('0x16')),_0x237f36);}function writeLog(_0x4261d5,_0xa6eacf,_0x1852d4){return logger[_0x8cde('0x17')](util[_0x8cde('0x12')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x4261d5,_0xa6eacf[_0x8cde('0x7')],_0x1852d4));}exports[_0x8cde('0x18')]=function(_0x59434f,_0x267540,_0x188cf7,_0x71177a){if(_0x267540['busy']){writeLog(_0x59434f,_0x267540,'BUSY');return![];}if(!_0x267540[_0x8cde('0x19')]){writeLog(_0x59434f,_0x267540,'OFFLINE');return![];}if(_0x267540[_0x188cf7+'Pause']){writeLog(_0x59434f,_0x267540,_0x8cde('0x1a'));return![];}if(_0x71177a&&_0x267540['hasOwnProperty'](_0x188cf7+_0x8cde('0x1b'))&&_0x267540[_0x8cde('0x1c')](_0x188cf7+_0x8cde('0x1d'))){if(_0x267540[_0x188cf7+'Capacity']>0x0&&_0x267540[_0x188cf7+_0x8cde('0x1d')]>=_0x267540[_0x188cf7+_0x8cde('0x1b')]){writeLog(_0x59434f,_0x267540,_0x188cf7[_0x8cde('0x1e')]()+_0x8cde('0x1f'));return![];}}return!![];};exports['showNotification']=function(_0x3f207d,_0x588e92,_0x51b77d,_0x5b704f,_0x205fbc){return sendNotification(!![],_0x3f207d,_0x588e92,_0x51b77d,_0x5b704f,_0x205fbc);};exports[_0x8cde('0x20')]=function(_0x3ef2c9,_0x5a406d,_0x455640,_0x1bc2dd,_0x465ae2){return sendNotification(![],_0x3ef2c9,_0x5a406d,_0x455640,_0x1bc2dd,_0x465ae2);};exports[_0x8cde('0x21')]=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 406ad47..a44a8a5 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 _0xc2f2=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','info','next','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','lodash','./utils'];(function(_0x49e04c,_0x1b3350){var _0x197469=function(_0x446ee2){while(--_0x446ee2){_0x49e04c['push'](_0x49e04c['shift']());}};_0x197469(++_0x1b3350);}(_0xc2f2,0x123));var _0x2c2f=function(_0x12833b,_0x26c1d2){_0x12833b=_0x12833b-0x0;var _0x3acad3=_0xc2f2[_0x12833b];return _0x3acad3;};'use strict';var schema=require(_0x2c2f('0x0'));var sh=require('shelljs');var _=require(_0x2c2f('0x1'));var utils=require(_0x2c2f('0x2'));var logger=require(_0x2c2f('0x3'))(_0x2c2f('0x4'));var system=schema({'command':{'type':_0x2c2f('0x5'),'required':!![],'message':_0x2c2f('0x6')}});exports[_0x2c2f('0x7')]=function(_0x20e9b9,_0x39ce5f){return function(_0x5a82f0){try{var _0x35b34a={'command':_0x39ce5f[0x0]};var _0x4b7d63=system[_0x2c2f('0x0')](_0x35b34a,{'typecast':!![]});if(_0x4b7d63[_0x2c2f('0x8')]){logger[_0x2c2f('0x9')](_0x2c2f('0xa'),_0x20e9b9,_[_0x2c2f('0xb')](_0x4b7d63,'message')['join'](',\x20'));logger[_0x2c2f('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x20e9b9);_0x5a82f0[_0x2c2f('0xd')]();}else{var _0x58bae7=this;var _0x112c5c=utils['getMustacheRender'](_0x39ce5f[0x0],this);logger[_0x2c2f('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x20e9b9,_0x112c5c);sh['exec'](_['trim'](_0x112c5c),function(_0x437fbb,_0x5cee4e){logger[_0x2c2f('0xc')](_0x2c2f('0xe'),_0x20e9b9,_0x437fbb);if(_0x437fbb==0x0){var _0x3ff542=_0x5cee4e[_0x2c2f('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x2c2f('0x10')](_0x39ce5f[0x1])||_['isEmpty'](_0x39ce5f[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x20e9b9);_0x58bae7[_0x2c2f('0x11')][_0x39ce5f[0x1]]=_0x3ff542;}else{logger['info'](_0x2c2f('0x12'),_0x20e9b9,_0x39ce5f[0x1],_0x3ff542);_0x58bae7[_0x2c2f('0x11')][_0x39ce5f[0x1]]=_0x3ff542;}}_0x5a82f0[_0x2c2f('0xd')]();});}}catch(_0x3a9318){logger[_0x2c2f('0x9')]('[%s][SYSTEM]\x20%s',_0x20e9b9,_[_0x2c2f('0x13')](_0x3a9318)?JSON[_0x2c2f('0x14')](_0x3a9318):_0x3a9318);logger[_0x2c2f('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x20e9b9);_0x5a82f0['next']();}};}; \ No newline at end of file +var _0x741f=['next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x741f,0x111));var _0xf741=function(_0x5ed3bd,_0x2a10e1){_0x5ed3bd=_0x5ed3bd-0x0;var _0x5db4b3=_0x741f[_0x5ed3bd];return _0x5db4b3;};'use strict';var schema=require(_0xf741('0x0'));var sh=require(_0xf741('0x1'));var _=require(_0xf741('0x2'));var utils=require('./utils');var logger=require(_0xf741('0x3'))('routing');var system=schema({'command':{'type':_0xf741('0x4'),'required':!![],'message':_0xf741('0x5')}});exports[_0xf741('0x6')]=function(_0x38ba5e,_0x516522){return function(_0x50d907){try{var _0x129876={'command':_0x516522[0x0]};var _0x3bca2d=system[_0xf741('0x0')](_0x129876,{'typecast':!![]});if(_0x3bca2d[_0xf741('0x7')]){logger[_0xf741('0x8')]('[%s][SYSTEM]\x20%s',_0x38ba5e,_[_0xf741('0x9')](_0x3bca2d,_0xf741('0xa'))[_0xf741('0xb')](',\x20'));logger['info'](_0xf741('0xc'),_0x38ba5e);_0x50d907[_0xf741('0xd')]();}else{var _0x39d608=this;var _0x3a83fa=utils[_0xf741('0xe')](_0x516522[0x0],this);logger[_0xf741('0xf')](_0xf741('0x10'),_0x38ba5e,_0x3a83fa);sh[_0xf741('0x11')](_[_0xf741('0x12')](_0x3a83fa),function(_0x3ba4b8,_0xeaa22){logger[_0xf741('0xf')](_0xf741('0x13'),_0x38ba5e,_0x3ba4b8);if(_0x3ba4b8==0x0){var _0x558700=_0xeaa22[_0xf741('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0xf741('0x15')](_0x516522[0x1])||_['isEmpty'](_0x516522[0x1])){logger['info'](_0xf741('0x16'),_0x38ba5e);_0x39d608[_0xf741('0x17')][_0x516522[0x1]]=_0x558700;}else{logger[_0xf741('0xf')](_0xf741('0x18'),_0x38ba5e,_0x516522[0x1],_0x558700);_0x39d608[_0xf741('0x17')][_0x516522[0x1]]=_0x558700;}}_0x50d907['next']();});}}catch(_0x3761fe){logger[_0xf741('0x8')]('[%s][SYSTEM]\x20%s',_0x38ba5e,_[_0xf741('0x19')](_0x3761fe)?JSON['stringify'](_0x3761fe):_0x3761fe);logger['info'](_0xf741('0xc'),_0x38ba5e);_0x50d907[_0xf741('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 8bf1cf3..0df0907 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 _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x554b34,_0x33678c){var _0x48ade7=function(_0x491d28){while(--_0x491d28){_0x554b34['push'](_0x554b34['shift']());}};_0x48ade7(++_0x33678c);}(_0x7a54,0x106));var _0x47a5=function(_0x56230b,_0x5d228a){_0x56230b=_0x56230b-0x0;var _0x5df091=_0x7a54[_0x56230b];return _0x5df091;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x1a7350,_0x482868){var _0x2b72b3=function(_0x1ad67e){while(--_0x1ad67e){_0x1a7350['push'](_0x1a7350['shift']());}};_0x2b72b3(++_0x482868);}(_0x7a54,0x106));var _0x47a5=function(_0x10c2eb,_0x2e18ee){_0x10c2eb=_0x10c2eb-0x0;var _0x316c46=_0x7a54[_0x10c2eb];return _0x316c46;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ 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 8ea661a..ad0084f 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 _0xd3b4=['render','merge','contact','account','interaction','list','mustache'];(function(_0x3ed4d7,_0x3783e0){var _0x2be1a4=function(_0x5d492f){while(--_0x5d492f){_0x3ed4d7['push'](_0x3ed4d7['shift']());}};_0x2be1a4(++_0x3783e0);}(_0xd3b4,0x1e9));var _0x4d3b=function(_0xff2470,_0x4c02dc){_0xff2470=_0xff2470-0x0;var _0x2ae259=_0xd3b4[_0xff2470];return _0x2ae259;};'use strict';var Mustache=require(_0x4d3b('0x0'));var _=require('lodash');module['exports']={'getMustacheRender':function(_0x13bd33,_0x43d1e9){return Mustache[_0x4d3b('0x1')](_0x13bd33,_[_0x4d3b('0x2')](_0x43d1e9['body'],{'contact':_0x43d1e9[_0x4d3b('0x3')],'message':_0x43d1e9['message'],'account':_0x43d1e9[_0x4d3b('0x4')],'interaction':_0x43d1e9[_0x4d3b('0x5')],'list':_0x43d1e9[_0x4d3b('0x6')]}))||'';}}; \ No newline at end of file +var _0x89e8=['merge','body','interaction','list','mustache','lodash','exports','render'];(function(_0x460eb3,_0x406265){var _0x2909d7=function(_0x36f872){while(--_0x36f872){_0x460eb3['push'](_0x460eb3['shift']());}};_0x2909d7(++_0x406265);}(_0x89e8,0x74));var _0x889e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x89e8[_0x1ac595];return _0x455fff;};'use strict';var Mustache=require(_0x889e('0x0'));var _=require(_0x889e('0x1'));module[_0x889e('0x2')]={'getMustacheRender':function(_0x319ddb,_0x35d770){return Mustache[_0x889e('0x3')](_0x319ddb,_[_0x889e('0x4')](_0x35d770[_0x889e('0x5')],{'contact':_0x35d770['contact'],'message':_0x35d770['message'],'account':_0x35d770['account'],'interaction':_0x35d770[_0x889e('0x6')],'list':_0x35d770[_0x889e('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 36cb69c..a99ac84 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 _0xf533=['message','interaction','applications','length','existsSync','.js','app','split','push','join','dialogflow','appdata','slice','tag','TagId','%s:%s:%s','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','stringify','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','updateRealtime','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel'];(function(_0xa3a1b5,_0x2a5450){var _0x444171=function(_0x47db52){while(--_0x47db52){_0xa3a1b5['push'](_0xa3a1b5['shift']());}};_0x444171(++_0x2a5450);}(_0xf533,0x91));var _0x3f53=function(_0x1bb47b,_0x54e02e){_0x1bb47b=_0x1bb47b-0x0;var _0x566418=_0xf533[_0x1bb47b];return _0x566418;};'use strict';var _=require(_0x3f53('0x0'));var util=require('util');var path=require(_0x3f53('0x1'));var fs=require('fs');var jayson=require(_0x3f53('0x2'));var BPromise=require(_0x3f53('0x3'));var uuid=require('uuid');var config=require(_0x3f53('0x4'));var logger=require(_0x3f53('0x5'))(_0x3f53('0x6'));var rpc={'openchannelQueueReport':require(_0x3f53('0x7'))};var rpc={'openchannelQueueReport':require(_0x3f53('0x7')),'mailQueueReport':require(_0x3f53('0x8')),'chatQueueReport':require(_0x3f53('0x9')),'smsQueueReport':require(_0x3f53('0xa')),'faxQueueReport':require(_0x3f53('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x6b33f9,_0x4dbe3a,_0x5732f7){return util[_0x3f53('0xc')](_0x3f53('0xd'),_0x6b33f9,_0x4dbe3a||0x0,_0x5732f7||0x0);}function getIntervals(_0x8d63f2,_0xd09202){var _0x4c3f61=[];if(!_[_0x3f53('0xe')](_0xd09202[_0x3f53('0xf')])&&!_['isNil'](_0x8d63f2[_0xd09202[_0x3f53('0xf')]])&&!_['isNil'](_0x8d63f2[_0xd09202[_0x3f53('0xf')]][_0x3f53('0x10')])){_0x4c3f61=_[_0x3f53('0x11')](_0x8d63f2[_0xd09202[_0x3f53('0xf')]][_0x3f53('0x10')],'interval');}else if(!_[_0x3f53('0xe')](_0xd09202[_0x3f53('0x12')])){_0x4c3f61=[_0xd09202['interval']];}return _0x4c3f61;}exports[_0x3f53('0x13')]=function(_0x1254e5){_0x1254e5['rules']={};return new BPromise(function(_0x30ae8d,_0x2d5a82){var _0x24eb19={'Start':function(_0x47efd2){var _0x2fcffc=this;return new Promise(function(_0x1dba05,_0x46876b){if(_0x47efd2){try{var _0x4a90ae=[];var _0xfd76f7=getId(_0x47efd2[_0x3f53('0x14')],_0x47efd2[_0x3f53('0x15')]?_0x47efd2[_0x3f53('0x15')]['id']:0x0,_0x47efd2[_0x3f53('0x16')]?_0x47efd2[_0x3f53('0x16')]['id']:0x0);if(_0x47efd2[_0x3f53('0x17')]&&_['isArray'](_0x47efd2[_0x3f53('0x17')])&&_0x47efd2[_0x3f53('0x17')][_0x3f53('0x18')]){for(var _0x5e5622=0x0;_0x5e5622<_0x47efd2[_0x3f53('0x17')]['length'];_0x5e5622+=0x1){var _0x3e6e89=_0x47efd2[_0x3f53('0x17')][_0x5e5622];if(fs[_0x3f53('0x19')](path['join'](__dirname,'applications',_0x3e6e89['app']+_0x3f53('0x1a')))){var _0x25f2b9=[];switch(_0x3e6e89[_0x3f53('0x1b')]['toLowerCase']()){case'autoreply':var _0x35d6a4=_0x3e6e89['appdata'][_0x3f53('0x1c')](',');_0x25f2b9[_0x3f53('0x1d')](_0x35d6a4[0x0]);_0x25f2b9[_0x3f53('0x1d')](_0x35d6a4['slice'](0x1,_0x35d6a4[_0x3f53('0x18')])[_0x3f53('0x1e')](','));break;case _0x3f53('0x1f'):var _0x35d6a4=_0x3e6e89[_0x3f53('0x20')][_0x3f53('0x1c')](',');_0x25f2b9[_0x3f53('0x1d')](_0x35d6a4[0x0]);_0x25f2b9[_0x3f53('0x1d')](_0x35d6a4[0x1]);_0x25f2b9[_0x3f53('0x1d')](_0x35d6a4[_0x3f53('0x21')](0x2,_0x35d6a4[_0x3f53('0x18')])[_0x3f53('0x1e')](','));break;case _0x3f53('0x15'):_0x25f2b9[_0x3f53('0x1d')](_0x3e6e89['appdata']);break;case _0x3f53('0x22'):_0x25f2b9[_0x3f53('0x1d')](_0x3e6e89[_0x3f53('0x23')]);_0x25f2b9[_0x3f53('0x1d')](_0x3e6e89[_0x3f53('0x20')]);break;default:_0x25f2b9=_[_0x3f53('0xe')](_0x3e6e89['appdata'])?[]:_0x3e6e89[_0x3f53('0x20')]['split'](',');}var _0x347a74={'id':util[_0x3f53('0xc')](_0x3f53('0x24'),_0xfd76f7,_0x3e6e89['id'],_0x3e6e89[_0x3f53('0x1b')]),'condition':require('./interval')[_0x3f53('0x25')](_0xfd76f7,getIntervals(_0x1254e5[_0x3f53('0x26')],_0x3e6e89),_0x1254e5),'consequence':require(_0x3f53('0x27')+_0x3e6e89[_0x3f53('0x1b')])[_0x3f53('0x28')](_0xfd76f7,_0x25f2b9,_0x1254e5,_0x47efd2),'p':_0x3e6e89[_0x3f53('0x29')]||0x0};logger[_0x3f53('0x2a')](_0x3f53('0x2b'),_0x347a74['id'],_0x3f53('0x2c'),getIntervals(_0x1254e5[_0x3f53('0x26')],_0x3e6e89)[_0x3f53('0x1e')](_0x3f53('0x2d')));_0x4a90ae[_0x3f53('0x1d')](_0x347a74);}else{logger[_0x3f53('0x2e')](_0x3f53('0x2f'),path[_0x3f53('0x1e')](__dirname,_0x3f53('0x17'),_0x3e6e89[_0x3f53('0x1b')]+_0x3f53('0x1a')));}}_0x1254e5[_0x3f53('0x30')][_0xfd76f7]=new RuleEngine(_0x4a90ae);_0x1254e5[_0x3f53('0x30')][_0xfd76f7]['execute'](_0x47efd2,function(_0x34a471){logger['info'](_0x3f53('0x31'),JSON[_0x3f53('0x32')](_0x34a471['matchPath']));if(_0x1254e5[_0x3f53('0x30')][_0xfd76f7]){delete _0x1254e5[_0x3f53('0x30')][_0xfd76f7];}});return _0x1dba05({'code':0xc8,'message':_0x47efd2});}else{logger[_0x3f53('0x2a')]('No\x20applications\x20to\x20execute');return _0x1dba05({'code':0xc8,'message':_0x47efd2});}}catch(_0x36bac2){logger[_0x3f53('0x2e')](JSON['stringify'](_0x36bac2));return _0x46876b(_0x2fcffc[_0x3f53('0x2e')](0x1f4,_0x36bac2));}}return _0x46876b('routing\x20is\x20empty');});},'AcceptMessage':function(_0x16ef6f){var _0x37310b=this;return new Promise(function(_0x25b1b1,_0x531536){if(_0x16ef6f['message']&&_0x16ef6f[_0x3f53('0x15')]['id']){try{var _0x337a89=getId(_0x16ef6f[_0x3f53('0x14')],_0x16ef6f[_0x3f53('0x15')]?_0x16ef6f[_0x3f53('0x15')]['id']:0x0,_0x16ef6f[_0x3f53('0x16')]?_0x16ef6f['interaction']['id']:0x0);if(_0x1254e5[_0x3f53('0x30')][_0x337a89]){delete _0x1254e5['rules'][_0x337a89];if(rpc[_0x16ef6f['channel']+_0x3f53('0x33')]){rpc[_0x16ef6f['channel']+'QueueReport'][_0x3f53('0x34')](_0x337a89,{'UserId':_0x16ef6f[_0x3f53('0x15')][_0x3f53('0x35')]})['catch'](function(_0x65bd06){logger[_0x3f53('0x2e')](_0x3f53('0x36'));});}}return _0x25b1b1({'code':0xc8,'message':_0x16ef6f});}catch(_0x1ef19a){logger[_0x3f53('0x2e')](JSON['stringify'](_0x1ef19a));return _0x531536(_0x37310b[_0x3f53('0x2e')](0x1f4,_0x1ef19a));}}logger[_0x3f53('0x2e')](_0x3f53('0x37'));return _0x531536(_0x37310b[_0x3f53('0x2e')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0xc06ac4){var _0x421f92=this;return new Promise(function(_0xf43fb8,_0x5520ec){if(_0xc06ac4[_0x3f53('0x38')]&&_0xc06ac4['agent']['id']){try{if(_0x1254e5[_0x3f53('0x39')][_0xc06ac4['agent']['id']]){_0x1254e5[_0x3f53('0x39')][_0xc06ac4[_0x3f53('0x38')]['id']][_0x3f53('0x3a')]=![];_0x1254e5[_0x3f53('0x39')][_0xc06ac4[_0x3f53('0x38')]['id']][_0x3f53('0x3b')]=undefined;}return _0xf43fb8({'code':0xc8,'message':_0xc06ac4});}catch(_0x20e9e4){logger['error'](JSON[_0x3f53('0x32')](_0x20e9e4));return _0x5520ec(_0x421f92[_0x3f53('0x2e')](0x1f4,_0x20e9e4));}}logger['error'](_0x3f53('0x37'));return _0x5520ec(_0x421f92[_0x3f53('0x2e')](0x1f4,_0x3f53('0x37')));});},'AbandonInteraction':function(_0x52487e){var _0x3da112=this;return new Promise(function(_0x2329f4,_0x24f68d){if(_0x52487e[_0x3f53('0x14')]&&_0x52487e[_0x3f53('0x16')]&&_0x52487e['interaction']['id']){try{var _0x155567=getId(_0x52487e[_0x3f53('0x14')],_0x52487e['message']?_0x52487e['message']['id']:0x0,_0x52487e[_0x3f53('0x16')]?_0x52487e[_0x3f53('0x16')]['id']:0x0);if(_0x1254e5[_0x3f53('0x30')][_0x155567]){delete _0x1254e5[_0x3f53('0x30')][_0x155567];}return _0x2329f4({'code':0xc8,'message':_0x52487e});}catch(_0x4c491c){logger['error'](JSON['stringify'](_0x4c491c));return _0x24f68d(_0x3da112[_0x3f53('0x2e')](0x1f4,_0x4c491c));}}logger[_0x3f53('0x2e')](_0x3f53('0x37'));return _0x24f68d(_0x3da112[_0x3f53('0x2e')](0x1f4,_0x3f53('0x37')));});},'AgentCapacity':function(_0x4d3b4f){var _0x108eba=this;return new Promise(function(_0x1781b6,_0x30dcf1){if(_0x1254e5['agents'][_0x3f53('0x3c')](_0x4d3b4f['id'])){for(var _0x53481f in _0x4d3b4f['capacity']){if(_0x4d3b4f[_0x3f53('0x3d')][_0x3f53('0x3c')](_0x53481f)){if(_0x1254e5[_0x3f53('0x39')][_0x4d3b4f['id']][_0x3f53('0x3c')](_0x53481f+'CurrentCapacity')){_0x1254e5[_0x3f53('0x39')][_0x4d3b4f['id']][_0x53481f+'CurrentCapacity']=parseInt(_0x4d3b4f['capacity'][_0x53481f],0xa);_0x1254e5[_0x3f53('0x39')][_0x4d3b4f['id']][_0x3f53('0x3e')]();}}}return _0x1781b6({'code':0xc8,'message':_0x1254e5[_0x3f53('0x39')][_0x4d3b4f['id']]});}else{return _0x30dcf1(_0x108eba['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x36440d){return new Promise(function(_0x5c0afe,_0x432704){var _0x2b988b=_[_0x3f53('0x3f')](_0x1254e5[_0x3f53('0x39')]);_0x5c0afe({'count':_0x2b988b['length'],'rows':_0x2b988b});});},'ChatQueues':function(_0x1aabba){return new Promise(function(_0x35d015,_0x4aaa6b){var _0x43a894=[];for(var _0x30565d in _0x1254e5[_0x3f53('0x40')]){if(_0x1254e5['chatQueues']['hasOwnProperty'](_0x30565d)){var _0x23fcf0=_0x1254e5['chatQueues'][_0x30565d];var _0x25a21d={'id':_0x23fcf0['id'],'available':_0x23fcf0['available'],'loggedIn':_0x23fcf0[_0x3f53('0x41')],'name':_0x23fcf0[_0x3f53('0x42')],'paused':_0x23fcf0[_0x3f53('0x43')],'waiting':_0x23fcf0[_0x3f53('0x44')]};_0x43a894[_0x3f53('0x1d')](_0x25a21d);}}_0x35d015({'count':_0x43a894[_0x3f53('0x18')],'rows':_0x43a894});});},'MailQueues':function(_0x54d6f7){return new Promise(function(_0x198104,_0x169c4c){var _0xf2a84d=[];for(var _0x5d6c96 in _0x1254e5[_0x3f53('0x45')]){if(_0x1254e5[_0x3f53('0x45')][_0x3f53('0x3c')](_0x5d6c96)){var _0x5b848a=_0x1254e5[_0x3f53('0x45')][_0x5d6c96];var _0x195b7b={'id':_0x5b848a['id'],'available':_0x5b848a[_0x3f53('0x46')],'loggedIn':_0x5b848a[_0x3f53('0x41')],'name':_0x5b848a[_0x3f53('0x42')],'paused':_0x5b848a[_0x3f53('0x43')],'waiting':_0x5b848a['waiting']};_0xf2a84d['push'](_0x195b7b);}}_0x198104({'count':_0xf2a84d[_0x3f53('0x18')],'rows':_0xf2a84d});});},'OpenchannelQueues':function(_0x1cee15){return new Promise(function(_0x1c1d7d,_0xaf954e){var _0x5189db=[];for(var _0x334259 in _0x1254e5['openchannelQueues']){if(_0x1254e5[_0x3f53('0x47')][_0x3f53('0x3c')](_0x334259)){var _0xceea6b=_0x1254e5[_0x3f53('0x47')][_0x334259];var _0x26e69c={'id':_0xceea6b['id'],'available':_0xceea6b['available'],'loggedIn':_0xceea6b['loggedIn'],'name':_0xceea6b['name'],'paused':_0xceea6b[_0x3f53('0x43')],'waiting':_0xceea6b['waiting']};_0x5189db['push'](_0x26e69c);}}_0x1c1d7d({'count':_0x5189db['length'],'rows':_0x5189db});});},'SmsQueues':function(_0x2f57f2){return new Promise(function(_0x44344d,_0x259bd0){var _0x58e003=[];for(var _0x1fd5bd in _0x1254e5[_0x3f53('0x48')]){if(_0x1254e5[_0x3f53('0x48')][_0x3f53('0x3c')](_0x1fd5bd)){var _0x440594=_0x1254e5[_0x3f53('0x48')][_0x1fd5bd];var _0x12ba0b={'id':_0x440594['id'],'available':_0x440594[_0x3f53('0x46')],'loggedIn':_0x440594[_0x3f53('0x41')],'name':_0x440594[_0x3f53('0x42')],'paused':_0x440594[_0x3f53('0x43')],'waiting':_0x440594[_0x3f53('0x44')]};_0x58e003['push'](_0x12ba0b);}}_0x44344d({'count':_0x58e003['length'],'rows':_0x58e003});});},'FaxQueues':function(_0xf8f53c){return new Promise(function(_0x50c461,_0x101c69){var _0x3f3ce1=[];for(var _0x54ef71 in _0x1254e5[_0x3f53('0x49')]){if(_0x1254e5[_0x3f53('0x49')][_0x3f53('0x3c')](_0x54ef71)){var _0x318f16=_0x1254e5[_0x3f53('0x49')][_0x54ef71];var _0x1a49a0={'id':_0x318f16['id'],'available':_0x318f16[_0x3f53('0x46')],'loggedIn':_0x318f16['loggedIn'],'name':_0x318f16[_0x3f53('0x42')],'paused':_0x318f16[_0x3f53('0x43')],'waiting':_0x318f16[_0x3f53('0x44')]};_0x3f3ce1[_0x3f53('0x1d')](_0x1a49a0);}}_0x50c461({'count':_0x3f3ce1[_0x3f53('0x18')],'rows':_0x3f3ce1});});},'ChatQueuesWaitingInteractions':function(_0x31dc92){return new Promise(function(_0x193095,_0xc84fc5){var _0x5dfe75=_[_0x3f53('0x3f')](_0x1254e5[_0x3f53('0x4a')]);_0x193095({'count':_0x5dfe75[_0x3f53('0x18')],'rows':_0x5dfe75});});},'MailQueuesWaitingInteractions':function(_0x59ebf4){return new Promise(function(_0x4a3c2a,_0x5dd73f){var _0xc5b100=_[_0x3f53('0x3f')](_0x1254e5[_0x3f53('0x4b')]);_0x4a3c2a({'count':_0xc5b100[_0x3f53('0x18')],'rows':_0xc5b100});});},'OpenchannelQueuesWaitingInteractions':function(_0x5baf8f){return new Promise(function(_0x3c4bf1,_0x209944){var _0x5f01a9=_['values'](_0x1254e5[_0x3f53('0x4c')]);_0x3c4bf1({'count':_0x5f01a9[_0x3f53('0x18')],'rows':_0x5f01a9});});},'SmsQueuesWaitingInteractions':function(_0x5926d8){return new Promise(function(_0x5779e0,_0x17b586){var _0x2e6c66=_['values'](_0x1254e5['smsQueuesWaitingInteractions']);_0x5779e0({'count':_0x2e6c66[_0x3f53('0x18')],'rows':_0x2e6c66});});},'FaxQueuesWaitingInteractions':function(_0x2fd2a3){return new Promise(function(_0x20c416,_0x3fd41b){var _0x481965=_[_0x3f53('0x3f')](_0x1254e5[_0x3f53('0x4d')]);_0x20c416({'count':_0x481965['length'],'rows':_0x481965});});}};var _0x5d83a7=jayson[_0x3f53('0x4e')](_0x24eb19)[_0x3f53('0x4f')]();_0x5d83a7['on']('error',function(_0x252b92){logger[_0x3f53('0x2e')](JSON[_0x3f53('0x32')](_0x252b92));return _0x2d5a82(_0x252b92);});_0x5d83a7[_0x3f53('0x13')](0x232c,_0x3f53('0x50'),function(){console[_0x3f53('0x51')](_0x3f53('0x52'),0x232c);return _0x30ae8d('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file +var _0x3e06=['Intervals','interval','listen','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','tag','TagId','./interval','condition','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','matchPath','No\x20applications\x20to\x20execute','routing\x20is\x20empty','channel','QueueReport','update','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId'];(function(_0xab193f,_0x1002f7){var _0x1d3fe9=function(_0x224e0b){while(--_0x224e0b){_0xab193f['push'](_0xab193f['shift']());}};_0x1d3fe9(++_0x1002f7);}(_0x3e06,0x153));var _0x63e0=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3e06[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var path=require(_0x63e0('0x2'));var fs=require('fs');var jayson=require(_0x63e0('0x3'));var BPromise=require(_0x63e0('0x4'));var uuid=require(_0x63e0('0x5'));var config=require('../../../config/environment');var logger=require(_0x63e0('0x6'))(_0x63e0('0x7'));var rpc={'openchannelQueueReport':require(_0x63e0('0x8'))};var rpc={'openchannelQueueReport':require(_0x63e0('0x8')),'mailQueueReport':require(_0x63e0('0x9')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x63e0('0xa')),'faxQueueReport':require(_0x63e0('0xb'))};var RuleEngine=require(_0x63e0('0xc'));function getId(_0x29ad2e,_0x20ba81,_0x2482fb){return util[_0x63e0('0xd')](_0x63e0('0xe'),_0x29ad2e,_0x20ba81||0x0,_0x2482fb||0x0);}function getIntervals(_0x4a7bf2,_0x4326d5){var _0x4ebd9b=[];if(!_[_0x63e0('0xf')](_0x4326d5[_0x63e0('0x10')])&&!_['isNil'](_0x4a7bf2[_0x4326d5[_0x63e0('0x10')]])&&!_['isNil'](_0x4a7bf2[_0x4326d5['IntervalId']][_0x63e0('0x11')])){_0x4ebd9b=_['map'](_0x4a7bf2[_0x4326d5[_0x63e0('0x10')]][_0x63e0('0x11')],'interval');}else if(!_[_0x63e0('0xf')](_0x4326d5[_0x63e0('0x12')])){_0x4ebd9b=[_0x4326d5['interval']];}return _0x4ebd9b;}exports[_0x63e0('0x13')]=function(_0x36fd57){_0x36fd57['rules']={};return new BPromise(function(_0x2131a0,_0x73948d){var _0x3844aa={'Start':function(_0x23292c){var _0x2b9b32=this;return new Promise(function(_0x316753,_0x2cf197){if(_0x23292c){try{var _0x5396b2=[];var _0x2ca2ab=getId(_0x23292c['channel'],_0x23292c[_0x63e0('0x14')]?_0x23292c['message']['id']:0x0,_0x23292c[_0x63e0('0x15')]?_0x23292c['interaction']['id']:0x0);if(_0x23292c[_0x63e0('0x16')]&&_[_0x63e0('0x17')](_0x23292c[_0x63e0('0x16')])&&_0x23292c[_0x63e0('0x16')]['length']){for(var _0x8a9e02=0x0;_0x8a9e02<_0x23292c[_0x63e0('0x16')][_0x63e0('0x18')];_0x8a9e02+=0x1){var _0x51ddd3=_0x23292c[_0x63e0('0x16')][_0x8a9e02];if(fs[_0x63e0('0x19')](path[_0x63e0('0x1a')](__dirname,_0x63e0('0x16'),_0x51ddd3[_0x63e0('0x1b')]+_0x63e0('0x1c')))){var _0x1c2429=[];switch(_0x51ddd3[_0x63e0('0x1b')][_0x63e0('0x1d')]()){case _0x63e0('0x1e'):var _0x5b1cfb=_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');_0x1c2429['push'](_0x5b1cfb[0x0]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[_0x63e0('0x22')](0x1,_0x5b1cfb['length'])[_0x63e0('0x1a')](','));break;case _0x63e0('0x23'):var _0x5b1cfb=_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[0x0]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb[0x1]);_0x1c2429[_0x63e0('0x21')](_0x5b1cfb['slice'](0x2,_0x5b1cfb[_0x63e0('0x18')])[_0x63e0('0x1a')](','));break;case _0x63e0('0x14'):_0x1c2429[_0x63e0('0x21')](_0x51ddd3[_0x63e0('0x1f')]);break;case _0x63e0('0x24'):_0x1c2429[_0x63e0('0x21')](_0x51ddd3[_0x63e0('0x25')]);_0x1c2429[_0x63e0('0x21')](_0x51ddd3['appdata']);break;default:_0x1c2429=_[_0x63e0('0xf')](_0x51ddd3[_0x63e0('0x1f')])?[]:_0x51ddd3[_0x63e0('0x1f')][_0x63e0('0x20')](',');}var _0x741d27={'id':util[_0x63e0('0xd')]('%s:%s:%s',_0x2ca2ab,_0x51ddd3['id'],_0x51ddd3['app']),'condition':require(_0x63e0('0x26'))[_0x63e0('0x27')](_0x2ca2ab,getIntervals(_0x36fd57[_0x63e0('0x28')],_0x51ddd3),_0x36fd57),'consequence':require(_0x63e0('0x29')+_0x51ddd3[_0x63e0('0x1b')])['consequence'](_0x2ca2ab,_0x1c2429,_0x36fd57,_0x23292c),'p':_0x51ddd3[_0x63e0('0x2a')]||0x0};logger[_0x63e0('0x2b')](_0x63e0('0x2c'),_0x741d27['id'],_0x63e0('0x2d'),getIntervals(_0x36fd57[_0x63e0('0x28')],_0x51ddd3)['join'](_0x63e0('0x2e')));_0x5396b2['push'](_0x741d27);}else{logger[_0x63e0('0x2f')](_0x63e0('0x30'),path[_0x63e0('0x1a')](__dirname,'applications',_0x51ddd3[_0x63e0('0x1b')]+'.js'));}}_0x36fd57[_0x63e0('0x31')][_0x2ca2ab]=new RuleEngine(_0x5396b2);_0x36fd57[_0x63e0('0x31')][_0x2ca2ab][_0x63e0('0x32')](_0x23292c,function(_0x3a006f){logger[_0x63e0('0x2b')](_0x63e0('0x33'),JSON[_0x63e0('0x34')](_0x3a006f[_0x63e0('0x35')]));if(_0x36fd57[_0x63e0('0x31')][_0x2ca2ab]){delete _0x36fd57[_0x63e0('0x31')][_0x2ca2ab];}});return _0x316753({'code':0xc8,'message':_0x23292c});}else{logger['info'](_0x63e0('0x36'));return _0x316753({'code':0xc8,'message':_0x23292c});}}catch(_0x56e08f){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0x56e08f));return _0x2cf197(_0x2b9b32[_0x63e0('0x2f')](0x1f4,_0x56e08f));}}return _0x2cf197(_0x63e0('0x37'));});},'AcceptMessage':function(_0x383ce4){var _0x2a50ab=this;return new Promise(function(_0xd8e004,_0x4114dc){if(_0x383ce4[_0x63e0('0x14')]&&_0x383ce4[_0x63e0('0x14')]['id']){try{var _0x283bc6=getId(_0x383ce4['channel'],_0x383ce4[_0x63e0('0x14')]?_0x383ce4['message']['id']:0x0,_0x383ce4[_0x63e0('0x15')]?_0x383ce4[_0x63e0('0x15')]['id']:0x0);if(_0x36fd57[_0x63e0('0x31')][_0x283bc6]){delete _0x36fd57[_0x63e0('0x31')][_0x283bc6];if(rpc[_0x383ce4[_0x63e0('0x38')]+_0x63e0('0x39')]){rpc[_0x383ce4[_0x63e0('0x38')]+'QueueReport'][_0x63e0('0x3a')](_0x283bc6,{'UserId':_0x383ce4[_0x63e0('0x14')]['UserId']})['catch'](function(_0x592f6d){logger[_0x63e0('0x2f')](_0x63e0('0x3b'));});}}return _0xd8e004({'code':0xc8,'message':_0x383ce4});}catch(_0x1bcbac){logger['error'](JSON[_0x63e0('0x34')](_0x1bcbac));return _0x4114dc(_0x2a50ab[_0x63e0('0x2f')](0x1f4,_0x1bcbac));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x4114dc(_0x2a50ab[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'RejectMessage':function(_0x399083){var _0x4fd47e=this;return new Promise(function(_0xc538a4,_0x87a390){if(_0x399083['agent']&&_0x399083[_0x63e0('0x3d')]['id']){try{if(_0x36fd57[_0x63e0('0x3e')][_0x399083[_0x63e0('0x3d')]['id']]){_0x36fd57['agents'][_0x399083[_0x63e0('0x3d')]['id']][_0x63e0('0x3f')]=![];_0x36fd57[_0x63e0('0x3e')][_0x399083['agent']['id']]['busyQueue']=undefined;}return _0xc538a4({'code':0xc8,'message':_0x399083});}catch(_0x52d2cd){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0x52d2cd));return _0x87a390(_0x4fd47e[_0x63e0('0x2f')](0x1f4,_0x52d2cd));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x87a390(_0x4fd47e[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'AbandonInteraction':function(_0x2adacb){var _0x2454d9=this;return new Promise(function(_0x7f8ded,_0x5df546){if(_0x2adacb[_0x63e0('0x38')]&&_0x2adacb['interaction']&&_0x2adacb[_0x63e0('0x15')]['id']){try{var _0x3215f2=getId(_0x2adacb['channel'],_0x2adacb['message']?_0x2adacb[_0x63e0('0x14')]['id']:0x0,_0x2adacb[_0x63e0('0x15')]?_0x2adacb['interaction']['id']:0x0);if(_0x36fd57[_0x63e0('0x31')][_0x3215f2]){delete _0x36fd57[_0x63e0('0x31')][_0x3215f2];}return _0x7f8ded({'code':0xc8,'message':_0x2adacb});}catch(_0x1cccf1){logger['error'](JSON[_0x63e0('0x34')](_0x1cccf1));return _0x5df546(_0x2454d9[_0x63e0('0x2f')](0x1f4,_0x1cccf1));}}logger[_0x63e0('0x2f')](_0x63e0('0x3c'));return _0x5df546(_0x2454d9[_0x63e0('0x2f')](0x1f4,_0x63e0('0x3c')));});},'AgentCapacity':function(_0x475912){var _0x2ddc44=this;return new Promise(function(_0x576388,_0x125382){if(_0x36fd57[_0x63e0('0x3e')]['hasOwnProperty'](_0x475912['id'])){for(var _0x337e25 in _0x475912[_0x63e0('0x40')]){if(_0x475912[_0x63e0('0x40')][_0x63e0('0x41')](_0x337e25)){if(_0x36fd57[_0x63e0('0x3e')][_0x475912['id']][_0x63e0('0x41')](_0x337e25+_0x63e0('0x42'))){_0x36fd57['agents'][_0x475912['id']][_0x337e25+_0x63e0('0x42')]=parseInt(_0x475912[_0x63e0('0x40')][_0x337e25],0xa);_0x36fd57['agents'][_0x475912['id']][_0x63e0('0x43')]();}}}return _0x576388({'code':0xc8,'message':_0x36fd57[_0x63e0('0x3e')][_0x475912['id']]});}else{return _0x125382(_0x2ddc44[_0x63e0('0x2f')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0xbb642f){return new Promise(function(_0x5173ee,_0x3a157){var _0x4c1b12=_[_0x63e0('0x44')](_0x36fd57['agents']);_0x5173ee({'count':_0x4c1b12['length'],'rows':_0x4c1b12});});},'ChatQueues':function(_0x49ef0d){return new Promise(function(_0x525d94,_0x1a27b4){var _0x112d25=[];for(var _0x24d7ad in _0x36fd57[_0x63e0('0x45')]){if(_0x36fd57[_0x63e0('0x45')][_0x63e0('0x41')](_0x24d7ad)){var _0x3fd040=_0x36fd57['chatQueues'][_0x24d7ad];var _0x2fc2da={'id':_0x3fd040['id'],'available':_0x3fd040[_0x63e0('0x46')],'loggedIn':_0x3fd040[_0x63e0('0x47')],'name':_0x3fd040['name'],'paused':_0x3fd040[_0x63e0('0x48')],'waiting':_0x3fd040[_0x63e0('0x49')]};_0x112d25[_0x63e0('0x21')](_0x2fc2da);}}_0x525d94({'count':_0x112d25[_0x63e0('0x18')],'rows':_0x112d25});});},'MailQueues':function(_0xf51e5d){return new Promise(function(_0x384256,_0x1d90b1){var _0xf01ad9=[];for(var _0x2c4b0d in _0x36fd57[_0x63e0('0x4a')]){if(_0x36fd57[_0x63e0('0x4a')][_0x63e0('0x41')](_0x2c4b0d)){var _0x93ead=_0x36fd57[_0x63e0('0x4a')][_0x2c4b0d];var _0x7c3353={'id':_0x93ead['id'],'available':_0x93ead[_0x63e0('0x46')],'loggedIn':_0x93ead[_0x63e0('0x47')],'name':_0x93ead[_0x63e0('0x4b')],'paused':_0x93ead[_0x63e0('0x48')],'waiting':_0x93ead['waiting']};_0xf01ad9['push'](_0x7c3353);}}_0x384256({'count':_0xf01ad9['length'],'rows':_0xf01ad9});});},'OpenchannelQueues':function(_0x7600c1){return new Promise(function(_0xfd653,_0x5b5913){var _0x5dab09=[];for(var _0x38f2d9 in _0x36fd57[_0x63e0('0x4c')]){if(_0x36fd57[_0x63e0('0x4c')]['hasOwnProperty'](_0x38f2d9)){var _0x4849c0=_0x36fd57[_0x63e0('0x4c')][_0x38f2d9];var _0x3e5ef0={'id':_0x4849c0['id'],'available':_0x4849c0[_0x63e0('0x46')],'loggedIn':_0x4849c0[_0x63e0('0x47')],'name':_0x4849c0['name'],'paused':_0x4849c0[_0x63e0('0x48')],'waiting':_0x4849c0[_0x63e0('0x49')]};_0x5dab09[_0x63e0('0x21')](_0x3e5ef0);}}_0xfd653({'count':_0x5dab09[_0x63e0('0x18')],'rows':_0x5dab09});});},'SmsQueues':function(_0x36f91a){return new Promise(function(_0x35fb67,_0x3e2020){var _0x99c1c1=[];for(var _0x47c986 in _0x36fd57[_0x63e0('0x4d')]){if(_0x36fd57[_0x63e0('0x4d')][_0x63e0('0x41')](_0x47c986)){var _0x394ef3=_0x36fd57['smsQueues'][_0x47c986];var _0x4d26f5={'id':_0x394ef3['id'],'available':_0x394ef3[_0x63e0('0x46')],'loggedIn':_0x394ef3[_0x63e0('0x47')],'name':_0x394ef3['name'],'paused':_0x394ef3[_0x63e0('0x48')],'waiting':_0x394ef3[_0x63e0('0x49')]};_0x99c1c1[_0x63e0('0x21')](_0x4d26f5);}}_0x35fb67({'count':_0x99c1c1[_0x63e0('0x18')],'rows':_0x99c1c1});});},'FaxQueues':function(_0x4155da){return new Promise(function(_0x30a1aa,_0x232a97){var _0x4be447=[];for(var _0x16860c in _0x36fd57[_0x63e0('0x4e')]){if(_0x36fd57[_0x63e0('0x4e')][_0x63e0('0x41')](_0x16860c)){var _0x292aa4=_0x36fd57[_0x63e0('0x4e')][_0x16860c];var _0x17f461={'id':_0x292aa4['id'],'available':_0x292aa4[_0x63e0('0x46')],'loggedIn':_0x292aa4[_0x63e0('0x47')],'name':_0x292aa4[_0x63e0('0x4b')],'paused':_0x292aa4[_0x63e0('0x48')],'waiting':_0x292aa4[_0x63e0('0x49')]};_0x4be447['push'](_0x17f461);}}_0x30a1aa({'count':_0x4be447[_0x63e0('0x18')],'rows':_0x4be447});});},'ChatQueuesWaitingInteractions':function(_0xa21729){return new Promise(function(_0x27e8cc,_0x512989){var _0x4c561d=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x4f')]);_0x27e8cc({'count':_0x4c561d[_0x63e0('0x18')],'rows':_0x4c561d});});},'MailQueuesWaitingInteractions':function(_0x469bf0){return new Promise(function(_0x191bff,_0x41a636){var _0x5ea452=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x50')]);_0x191bff({'count':_0x5ea452['length'],'rows':_0x5ea452});});},'OpenchannelQueuesWaitingInteractions':function(_0x187254){return new Promise(function(_0x2c226f,_0x8ce3c6){var _0x1c051b=_['values'](_0x36fd57[_0x63e0('0x51')]);_0x2c226f({'count':_0x1c051b[_0x63e0('0x18')],'rows':_0x1c051b});});},'SmsQueuesWaitingInteractions':function(_0x601896){return new Promise(function(_0x5eafe2,_0x30d83c){var _0x219ca2=_['values'](_0x36fd57[_0x63e0('0x52')]);_0x5eafe2({'count':_0x219ca2[_0x63e0('0x18')],'rows':_0x219ca2});});},'FaxQueuesWaitingInteractions':function(_0x352889){return new Promise(function(_0x59a4d5,_0x2663b3){var _0xf15eda=_[_0x63e0('0x44')](_0x36fd57[_0x63e0('0x53')]);_0x59a4d5({'count':_0xf15eda[_0x63e0('0x18')],'rows':_0xf15eda});});}};var _0x379bd7=jayson[_0x63e0('0x54')](_0x3844aa)[_0x63e0('0x55')]();_0x379bd7['on']('error',function(_0xa5c30f){logger[_0x63e0('0x2f')](JSON[_0x63e0('0x34')](_0xa5c30f));return _0x73948d(_0xa5c30f);});_0x379bd7[_0x63e0('0x13')](0x232c,'127.0.0.1',function(){console[_0x63e0('0x56')](_0x63e0('0x57'),0x232c);return _0x2131a0(_0x63e0('0x58')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d985c5a..5e5a9fd 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 _0x6518=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','format','iftime\x20%s','indexOf','true','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stop','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','request','then','error','message','catch','condition','rules','info'];(function(_0x46fecb,_0x589468){var _0x288179=function(_0x9b629){while(--_0x9b629){_0x46fecb['push'](_0x46fecb['shift']());}};_0x288179(++_0x589468);}(_0x6518,0x136));var _0x8651=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x6518[_0x55f8b4];return _0x2475f9;};'use strict';var util=require('util');var BPromise=require(_0x8651('0x0'));var jayson=require(_0x8651('0x1'));var _=require(_0x8651('0x2'));var logger=require(_0x8651('0x3'))(_0x8651('0x4'));var client=jayson[_0x8651('0x5')]['http']({'port':0x232a});function request(_0x56fca6,_0x48b941){return new BPromise(function(_0x1365f5,_0x3ab4e9){return client[_0x8651('0x6')](_0x56fca6,_0x48b941)[_0x8651('0x7')](function(_0xe7d73d){if(_0xe7d73d[_0x8651('0x8')]){return _0x3ab4e9(_0xe7d73d[_0x8651('0x8')][_0x8651('0x9')]);}else{return _0x1365f5(_0xe7d73d['result']);}})[_0x8651('0xa')](function(_0x415376){return _0x3ab4e9(_0x415376);});});}exports[_0x8651('0xb')]=function(_0x1adf1b,_0x4d79c4,_0x411ded){return function(_0x52cb6e){if(_0x411ded['rules']&&!_0x411ded[_0x8651('0xc')][_0x1adf1b]){logger[_0x8651('0xd')](_0x8651('0xe'),_0x1adf1b);return _0x52cb6e['stop']();}var _0x3c18c3=[];for(var _0x1c76c8=0x0;_0x1c76c8<_0x4d79c4[_0x8651('0xf')];_0x1c76c8+=0x1){_0x3c18c3[_0x8651('0x10')](request('Command',{'command':util[_0x8651('0x11')](_0x8651('0x12'),_0x4d79c4[_0x1c76c8])})[_0x8651('0x7')](function(_0x31fc24){return _0x31fc24&&_0x31fc24['message']&&_0x31fc24[_0x8651('0x9')][_0x8651('0x13')](_0x8651('0x14'))>=0x0?!![]:![];})[_0x8651('0xa')](function(_0x33d048){logger[_0x8651('0x8')]('[%s][INTERVAL]\x20%s',_0x1adf1b,_0x4d79c4[_0x1c76c8]);}));}BPromise[_0x8651('0x15')](_0x3c18c3)['then'](function(_0x5f44ff){var _0x1e7502=_['some'](_0x5f44ff);logger[_0x8651('0xd')](_0x8651('0x16'),_0x1adf1b,_0x4d79c4[_0x8651('0x17')](_0x8651('0x18')),_0x1e7502);_0x52cb6e[_0x8651('0x19')](_0x1e7502);})[_0x8651('0xa')](function(_0xbb3ab7){console['log'](_0xbb3ab7);logger[_0x8651('0x8')](_0x8651('0x16'),_0x1adf1b,_0x4d79c4[_0x8651('0x17')](_0x8651('0x18')),JSON['stringify'](_0xbb3ab7));_0x52cb6e[_0x8651('0x1a')]();});};}; \ No newline at end of file +var _0xf2a6=['util','bluebird','jayson/promise','../../../config/logger','client','http','request','error','message','result','catch','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','then','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20'];(function(_0x1c1e05,_0x5a2d33){var _0x3ad5d5=function(_0x3a6ef9){while(--_0x3a6ef9){_0x1c1e05['push'](_0x1c1e05['shift']());}};_0x3ad5d5(++_0x5a2d33);}(_0xf2a6,0x8a));var _0x6f2a=function(_0x33c804,_0x1d6378){_0x33c804=_0x33c804-0x0;var _0x31e22b=_0xf2a6[_0x33c804];return _0x31e22b;};'use strict';var util=require(_0x6f2a('0x0'));var BPromise=require(_0x6f2a('0x1'));var jayson=require(_0x6f2a('0x2'));var _=require('lodash');var logger=require(_0x6f2a('0x3'))('routing');var client=jayson[_0x6f2a('0x4')][_0x6f2a('0x5')]({'port':0x232a});function request(_0x3f01ae,_0x3448d4){return new BPromise(function(_0x3dc48d,_0x159a8a){return client[_0x6f2a('0x6')](_0x3f01ae,_0x3448d4)['then'](function(_0x1e2823){if(_0x1e2823[_0x6f2a('0x7')]){return _0x159a8a(_0x1e2823[_0x6f2a('0x7')][_0x6f2a('0x8')]);}else{return _0x3dc48d(_0x1e2823[_0x6f2a('0x9')]);}})[_0x6f2a('0xa')](function(_0x3c2f3d){return _0x159a8a(_0x3c2f3d);});});}exports['condition']=function(_0x353d1e,_0x3be3ae,_0x60ef7a){return function(_0x437328){if(_0x60ef7a['rules']&&!_0x60ef7a['rules'][_0x353d1e]){logger[_0x6f2a('0xb')](_0x6f2a('0xc'),_0x353d1e);return _0x437328[_0x6f2a('0xd')]();}var _0x53e262=[];for(var _0x157e7e=0x0;_0x157e7e<_0x3be3ae['length'];_0x157e7e+=0x1){_0x53e262['push'](request('Command',{'command':util[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x3be3ae[_0x157e7e])})[_0x6f2a('0x10')](function(_0x476177){return _0x476177&&_0x476177[_0x6f2a('0x8')]&&_0x476177[_0x6f2a('0x8')]['indexOf']('true')>=0x0?!![]:![];})[_0x6f2a('0xa')](function(_0x470978){logger[_0x6f2a('0x7')](_0x6f2a('0x11'),_0x353d1e,_0x3be3ae[_0x157e7e]);}));}BPromise[_0x6f2a('0x12')](_0x53e262)[_0x6f2a('0x10')](function(_0x5a4f19){var _0x4e4beb=_[_0x6f2a('0x13')](_0x5a4f19);logger[_0x6f2a('0xb')](_0x6f2a('0x14'),_0x353d1e,_0x3be3ae[_0x6f2a('0x15')]('\x20|\x20'),_0x4e4beb);_0x437328['when'](_0x4e4beb);})[_0x6f2a('0xa')](function(_0x3179af){console['log'](_0x3179af);logger[_0x6f2a('0x7')](_0x6f2a('0x14'),_0x353d1e,_0x3be3ae[_0x6f2a('0x15')](_0x6f2a('0x16')),JSON['stringify'](_0x3179af));_0x437328[_0x6f2a('0xd')]();});};}; \ No newline at end of file -- 1.7.1